"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__, {
    EdgeToolbar: ()=>EdgeToolbar
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
const react_namespaceObject = require("motion/react");
const external_react_namespaceObject = require("react");
const CanvasInlineButton_cjs_namespaceObject = require("../../ButtonHandle/CanvasInlineButton.cjs");
const EdgeToolbarComponent = ({ edgeId, visible, positioning, config, onMouseEnter, onMouseLeave })=>{
    const transform = (0, external_react_namespaceObject.useMemo)(()=>`translate(-50%, -50%) translate(${positioning.offsetPosition.x}px, ${positioning.offsetPosition.y}px)`, [
        positioning.offsetPosition
    ]);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.EdgeLabelRenderer, {
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.AnimatePresence, {
            children: visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.motion.div, {
                className: "nodrag nopan absolute top-0 left-0 z-1004 pointer-events-auto flex flex-row items-center gap-1",
                initial: {
                    opacity: 0
                },
                animate: {
                    opacity: 1
                },
                exit: {
                    opacity: 0
                },
                transition: {
                    duration: 0.15,
                    ease: 'easeOut'
                },
                style: {
                    transform
                },
                onMouseEnter: onMouseEnter,
                onMouseLeave: onMouseLeave,
                children: config.actions.map((action)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CanvasInlineButton_cjs_namespaceObject.CanvasInlineButton, {
                        "aria-label": action.label ?? action.id,
                        disabled: action.disabled,
                        icon: action.icon ?? 'plus',
                        onClick: (e)=>{
                            e.stopPropagation();
                            e.preventDefault();
                            if (!action.disabled) action.onAction(edgeId, positioning.pathPosition);
                        }
                    }, action.id))
            }, `edge-toolbar-${edgeId}`)
        })
    });
};
EdgeToolbarComponent.displayName = 'EdgeToolbar';
const EdgeToolbar = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(EdgeToolbarComponent);
exports.EdgeToolbar = __webpack_exports__.EdgeToolbar;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "EdgeToolbar"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
