"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__, {
    createAddNodePreview: ()=>createAddNodePreview
});
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
const manifest_resolver_cjs_namespaceObject = require("../../utils/manifest-resolver.cjs");
const LoopNode_helpers_cjs_namespaceObject = require("../LoopNode/LoopNode.helpers.cjs");
function buildSourceBoundaryResolver(sourceNodeId, reactFlowInstance, getManifestForNode) {
    const sourceNode = reactFlowInstance.getNode(sourceNodeId);
    if (!sourceNode) return;
    const manifest = getManifestForNode(sourceNode);
    if (!manifest?.handleConfiguration) return;
    const resolvedGroups = (0, manifest_resolver_cjs_namespaceObject.resolveHandles)(manifest.handleConfiguration, {
        ...sourceNode.data,
        nodeId: sourceNode.id
    });
    const handleToBoundary = new Map();
    for (const group of resolvedGroups){
        const boundary = group.boundary ?? 'outer';
        for (const handle of group.handles)handleToBoundary.set(handle.id, boundary);
    }
    return (handleId)=>handleToBoundary.get(handleId);
}
function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = react_cjs_namespaceObject.Position.Right, sourceHandleType = 'source', ignoredNodeTypes = [], options = {}) {
    const source = {
        nodeId: sourceNodeId,
        handleId: sourceHandleId
    };
    const overrides = options.getManifestForNode ? (0, LoopNode_helpers_cjs_namespaceObject.resolveContainerAddNodePreview)({
        source,
        sourceHandleType,
        reactFlowInstance,
        getManifestForNode: options.getManifestForNode
    }) : null;
    const sourceBoundaryOf = options.getManifestForNode ? buildSourceBoundaryResolver(sourceNodeId, reactFlowInstance, options.getManifestForNode) : void 0;
    (0, createPreviewGraph_cjs_namespaceObject.showPreviewGraph)({
        source,
        reactFlowInstance,
        sourceHandleType,
        handlePosition,
        ignoredNodeTypes,
        sourceBoundaryOf,
        ...overrides ?? {}
    });
}
exports.createAddNodePreview = __webpack_exports__.createAddNodePreview;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "createAddNodePreview"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
