"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__, {
    showCenteredContainerPreview: ()=>showCenteredContainerPreview
});
const container_cjs_namespaceObject = require("../../utils/container.cjs");
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
const NodeUtils_cjs_namespaceObject = require("../../utils/NodeUtils.cjs");
const external_LoopNode_helpers_cjs_namespaceObject = require("./LoopNode.helpers.cjs");
function showCenteredContainerPreview({ containerId, reactFlowInstance, previewHandles, trailingEdgeId }) {
    const containerNode = reactFlowInstance.getNode(containerId);
    if (!containerNode) return;
    const allNodes = reactFlowInstance.getNodes();
    const containerAbsolutePosition = (0, NodeUtils_cjs_namespaceObject.getAbsolutePosition)(containerNode, allNodes);
    const relativeCenter = (0, external_LoopNode_helpers_cjs_namespaceObject.getContainerRelativeBodyCenter)(containerNode);
    const containerSize = (0, container_cjs_namespaceObject.getNodeDimensions)(containerNode);
    const previewCenter = {
        x: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(containerAbsolutePosition.x + relativeCenter.x),
        y: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(containerAbsolutePosition.y + containerSize.height / 2)
    };
    const placement = {
        containerId,
        sourceNodeId: containerId,
        targetNodeId: containerId,
        mode: 'first-child'
    };
    (0, createPreviewGraph_cjs_namespaceObject.showPreviewGraph)({
        source: {
            nodeId: containerId,
            handleId: previewHandles.sourceHandleId
        },
        reactFlowInstance,
        position: previewCenter,
        positionMode: 'center',
        handlePosition: previewHandles.sourceHandlePosition,
        target: {
            nodeId: containerId,
            handleId: previewHandles.targetHandleId
        },
        data: {
            placement
        },
        containerId,
        trailingEdgeId
    });
}
exports.showCenteredContainerPreview = __webpack_exports__.showCenteredContainerPreview;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "showCenteredContainerPreview"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
