"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__, {
    useAgentFlow: ()=>useAgentFlow,
    AgentVisualizationFlowProvider: ()=>AgentVisualizationFlowProvider
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const cache_namespaceObject = require("@emotion/cache");
var cache_default = /*#__PURE__*/ __webpack_require__.n(cache_namespaceObject);
const react_namespaceObject = require("@emotion/react");
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
const external_react_namespaceObject = require("react");
const BaseCanvas_constants_cjs_namespaceObject = require("../../BaseCanvas/BaseCanvas.constants.cjs");
const AgentFlowProviderContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(null);
const AgentVisualizationFlowProviderInner = ({ children, styleContainer, fitViewOptions })=>{
    const reactFlow = (0, react_cjs_namespaceObject.useReactFlow)();
    const emotionCache = (0, external_react_namespaceObject.useMemo)(()=>{
        if (styleContainer) return cache_default()({
            key: 'agent-flow-shadow',
            container: styleContainer,
            prepend: true
        });
    }, [
        styleContainer
    ]);
    const resetViewport = (0, external_react_namespaceObject.useCallback)(()=>{
        reactFlow.fitView(fitViewOptions ?? BaseCanvas_constants_cjs_namespaceObject.BASE_CANVAS_DEFAULTS.fitViewOptions);
    }, [
        reactFlow,
        fitViewOptions
    ]);
    const value = (0, external_react_namespaceObject.useMemo)(()=>({
            resetViewport
        }), [
        resetViewport
    ]);
    const content = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AgentFlowProviderContext.Provider, {
        value: value,
        children: children
    });
    return emotionCache ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.CacheProvider, {
        value: emotionCache,
        children: content
    }) : content;
};
const AgentVisualizationFlowProvider = ({ styleContainer, fitViewOptions, ...props })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AgentVisualizationFlowProviderInner, {
            styleContainer: styleContainer,
            fitViewOptions: fitViewOptions,
            ...props
        })
    });
const useAgentFlow = ()=>{
    const context = (0, external_react_namespaceObject.useContext)(AgentFlowProviderContext);
    if (!context) throw new Error('useAgentFlow must be used within an AgentFlowProvider');
    return context;
};
exports.AgentVisualizationFlowProvider = __webpack_exports__.AgentVisualizationFlowProvider;
exports.useAgentFlow = __webpack_exports__.useAgentFlow;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AgentVisualizationFlowProvider",
    "useAgentFlow"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
