"use strict";
var __webpack_require__ = {};
(()=>{
    __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__, {
    SuggestionGroupPanel: ()=>SuggestionGroupPanel
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const apollo_core_namespaceObject = require("@uipath/apollo-core");
const index_cjs_namespaceObject = require("../../../layouts/index.cjs");
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
const external_react_namespaceObject = require("react");
const external_constants_cjs_namespaceObject = require("../../../constants.cjs");
const icon_registry_cjs_namespaceObject = require("../../../utils/icon-registry.cjs");
const RejectAllButton = ({ suggestionGroup, onClick, compact })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Button, {
        variant: "ghost",
        size: "sm",
        onClick: ()=>onClick(suggestionGroup.id),
        className: compact ? 'text-xs min-w-0' : void 0,
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
                icon: "x",
                size: 16
            }),
            "Reject all"
        ]
    });
const AcceptAllButton = ({ suggestionGroup, onClick, compact })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Button, {
        size: "sm",
        onClick: ()=>onClick(suggestionGroup.id),
        className: compact ? 'text-xs min-w-0' : void 0,
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
                icon: "check",
                size: 16
            }),
            "Accept all"
        ]
    });
const Divider = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
        style: {
            width: 1,
            height: '24px',
            backgroundColor: 'var(--canvas-border)'
        }
    });
const SuggestionGroupNavigator = ({ currentIndex, total, onNavigateNext, onNavigatePrevious, compact })=>{
    const [isHoveringUp, setIsHoveringUp] = (0, external_react_namespaceObject.useState)(false);
    const [isHoveringDown, setIsHoveringDown] = (0, external_react_namespaceObject.useState)(false);
    const iconSize = compact ? 16 : 20;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        style: {
            display: 'flex',
            alignItems: 'center',
            gap: apollo_core_namespaceObject.Spacing.SpacingMicro,
            minWidth: compact ? '80px' : '100px'
        },
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
                variant: "ghost",
                size: "icon",
                className: "h-8 w-8",
                onMouseEnter: ()=>setIsHoveringUp(true),
                onMouseLeave: ()=>setIsHoveringUp(false),
                onClick: onNavigatePrevious,
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
                    icon: "chevron-up",
                    color: isHoveringUp ? 'var(--canvas-primary)' : 'var(--canvas-foreground-de-emp)',
                    size: iconSize
                })
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
                className: (0, apollo_wind_namespaceObject.cn)('font-bold text-foreground-muted', compact ? 'text-xs' : 'text-sm'),
                children: [
                    currentIndex + 1,
                    " of ",
                    total
                ]
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
                variant: "ghost",
                size: "icon",
                className: "h-8 w-8",
                onMouseEnter: ()=>setIsHoveringDown(true),
                onMouseLeave: ()=>setIsHoveringDown(false),
                onClick: onNavigateNext,
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
                    icon: "chevron-down",
                    color: isHoveringDown ? 'var(--canvas-primary)' : 'var(--canvas-foreground-de-emp)',
                    size: iconSize
                })
            })
        ]
    });
};
const SuggestionGroupPanel = ({ suggestionGroup, onRejectAll, onAcceptAll, currentIndex = 0, onNavigateNext, onNavigatePrevious })=>{
    const canvasWidth = (0, react_cjs_namespaceObject.useStore)((state)=>state.width);
    const isCompact = canvasWidth < external_constants_cjs_namespaceObject.CANVAS_COMPACT_BREAKPOINT;
    const nonStandaloneSuggestions = suggestionGroup?.suggestions.filter((s)=>!s.isStandalone) ?? [];
    const placeholderCount = nonStandaloneSuggestions.length;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
        children: placeholderCount > 0 && suggestionGroup && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Column, {
            py: apollo_core_namespaceObject.Spacing.SpacingMicro,
            px: apollo_core_namespaceObject.Spacing.SpacingXs,
            gap: apollo_core_namespaceObject.Spacing.SpacingXs,
            style: {
                backgroundColor: 'var(--canvas-background-secondary)',
                color: 'var(--canvas-foreground)',
                borderRadius: '8px',
                border: '1px solid var(--canvas-border-de-emp)',
                boxShadow: '0px 6px 10px rgba(0, 0, 0, 0.3)'
            },
            children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
                align: "center",
                gap: isCompact ? apollo_core_namespaceObject.Spacing.SpacingXs : apollo_core_namespaceObject.Spacing.SpacingS,
                justify: "space-evenly",
                style: {
                    whiteSpace: 'nowrap'
                },
                children: [
                    onRejectAll && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RejectAllButton, {
                        suggestionGroup: suggestionGroup,
                        onClick: onRejectAll,
                        compact: isCompact
                    }),
                    onAcceptAll && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AcceptAllButton, {
                        suggestionGroup: suggestionGroup,
                        onClick: onAcceptAll,
                        compact: isCompact
                    }),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Divider, {}),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SuggestionGroupNavigator, {
                        currentIndex: currentIndex,
                        total: placeholderCount,
                        onNavigateNext: onNavigateNext,
                        onNavigatePrevious: onNavigatePrevious,
                        compact: isCompact
                    })
                ]
            })
        })
    });
};
exports.SuggestionGroupPanel = __webpack_exports__.SuggestionGroupPanel;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "SuggestionGroupPanel"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
