"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __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__, {
    StageHandle: ()=>StageHandle
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const styled_namespaceObject = require("@emotion/styled");
var styled_default = /*#__PURE__*/ __webpack_require__.n(styled_namespaceObject);
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
const StyledHandle = styled_default()(react_cjs_namespaceObject.Handle, {
    shouldForwardProp: (prop)=>!prop.startsWith('$')
})`
  position: absolute;
  top: ${(props)=>{
    if (props.position === react_cjs_namespaceObject.Position.Top) return '-15px';
    if (props.position === react_cjs_namespaceObject.Position.Bottom) return 'auto';
    return '0';
}};
  bottom: ${(props)=>props.position === react_cjs_namespaceObject.Position.Bottom ? '-15px' : 'auto'};
  left: ${(props)=>{
    if (props.position === react_cjs_namespaceObject.Position.Left) return '-15px';
    if (props.position === react_cjs_namespaceObject.Position.Right) return 'auto';
    return '0';
}};
  right: ${(props)=>props.position === react_cjs_namespaceObject.Position.Right ? '-15px' : 'auto'};
  width: ${(props)=>{
    if (props.position === react_cjs_namespaceObject.Position.Top || props.position === react_cjs_namespaceObject.Position.Bottom) return props.$isConnecting && props.type !== props.$sourceType ? 'calc(100% + 20px)' : '100%';
    return props.$isConnecting && props.type !== props.$sourceType ? 'calc(20px + 100%)' : '20px';
}};
  height: ${(props)=>{
    if (props.position === react_cjs_namespaceObject.Position.Left || props.position === react_cjs_namespaceObject.Position.Right) return '100%';
    return '20px';
}};
  background: transparent;
  border: 0px solid transparent;
  border-radius: 0;
  transform: unset;
  opacity: ${(props)=>props.$isVisible && props.type !== props.$sourceType ? 0.5 : 0};
`;
const HANDLE_ID_SEPARATOR = '____';
function generateHandleId(nodeId, sourceOrTarget, handlePosition) {
    return [
        nodeId,
        sourceOrTarget,
        handlePosition
    ].join(HANDLE_ID_SEPARATOR);
}
const StageHandle = ({ id, type, position, isVisible = true })=>{
    const { inProgress, fromHandle } = (0, react_cjs_namespaceObject.useConnection)();
    const sourceType = fromHandle?.type;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StyledHandle, {
        isConnectableStart: 'source' === type,
        isConnectableEnd: 'target' === type,
        id: generateHandleId(id, type, position),
        type: type,
        $sourceType: sourceType,
        $isConnecting: inProgress,
        position: position,
        $isVisible: isVisible,
        isConnectable: true
    });
};
exports.StageHandle = __webpack_exports__.StageHandle;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "StageHandle"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
