"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__, {
    AddNodePreview: ()=>AddNodePreview
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
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 BaseNodeInnerShape_cjs_namespaceObject = require("../BaseNode/BaseNodeInnerShape.cjs");
const AddNodePreview = ({ selected, data, width, height, dragging })=>{
    const nodeData = data;
    const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
    const handlePointerEnter = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(true), []);
    const handlePointerLeave = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(false), []);
    const icon = (0, external_react_namespaceObject.useMemo)(()=>{
        const IconComponent = (0, icon_registry_cjs_namespaceObject.getIcon)(nodeData?.iconName ?? 'square-dashed');
        return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(IconComponent, {});
    }, [
        nodeData?.iconName
    ]);
    const inputPosition = nodeData?.inputHandlePosition ?? react_cjs_namespaceObject.Position.Left;
    const outputPosition = nodeData?.outputHandlePosition ?? react_cjs_namespaceObject.Position.Right;
    const containerWidth = width ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
    const containerHeight = height ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
    const containerClassName = (0, external_react_namespaceObject.useMemo)(()=>(0, apollo_wind_namespaceObject.cn)('relative flex flex-col items-center justify-center bg-surface-overlay', 'w-(--node-w) h-(--node-h) rounded-(--node-radius)', 'border border-dashed', 'shadow-(--canvas-node-shadow-rest) transition-[box-shadow,border-color] duration-150', isHovered && 'shadow-(--canvas-node-shadow-hover)', dragging && 'shadow-(--canvas-node-shadow-lifted) cursor-grabbing'), [
        isHovered,
        dragging
    ]);
    const containerStyle = (0, external_react_namespaceObject.useMemo)(()=>{
        const basis = Math.min(containerWidth, containerHeight);
        const gap = basis * (1 - external_constants_cjs_namespaceObject.NODE_INNER_SHAPE_RATIO);
        const innerW = containerWidth - gap;
        const innerH = containerHeight - gap;
        return {
            '--node-w': `${containerWidth}px`,
            '--node-h': `${containerHeight}px`,
            '--node-radius': `${basis * external_constants_cjs_namespaceObject.NODE_CONTAINER_RADIUS_RATIO}px`,
            '--inner-w': `${innerW}px`,
            '--inner-h': `${innerH}px`,
            '--inner-radius': `${basis * external_constants_cjs_namespaceObject.NODE_INNER_RADIUS_RATIO}px`,
            '--icon-size': `${basis * external_constants_cjs_namespaceObject.NODE_INNER_ICON_RATIO}px`,
            borderColor: selected ? 'var(--canvas-selection-indicator)' : 'var(--canvas-border-de-emp)',
            opacity: selected ? 0.8 : 0.6,
            strokeWidth: 1.5
        };
    }, [
        containerWidth,
        containerHeight,
        selected
    ]);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                className: containerClassName,
                style: containerStyle,
                onPointerEnter: handlePointerEnter,
                onPointerLeave: handlePointerLeave,
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(BaseNodeInnerShape_cjs_namespaceObject.BaseInnerShape, {
                    children: icon
                })
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Handle, {
                type: "target",
                position: inputPosition,
                id: "input",
                style: {
                    background: 'transparent',
                    border: 'none',
                    width: 8,
                    height: 8
                },
                isConnectable: false
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Handle, {
                type: "source",
                position: outputPosition,
                id: "output",
                style: {
                    background: 'transparent',
                    border: 'none'
                },
                isConnectable: false
            })
        ]
    });
};
exports.AddNodePreview = __webpack_exports__.AddNodePreview;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AddNodePreview"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
