import { jsx } from "react/jsx-runtime";
import { useMemo } from "react";
import { NodeTypeRegistry } from "./NodeTypeRegistry.js";
import { NodeRegistryContext } from "./useNodeTypeRegistry.js";
const NodeRegistryProvider = ({ children, manifest, registrations })=>{
    const registry = useMemo(()=>{
        const reg = new NodeTypeRegistry();
        if (manifest) reg.registerManifest(manifest.nodes, manifest.categories);
        else if (registrations) reg.registerNodeManifests(registrations);
        return reg;
    }, [
        manifest,
        registrations
    ]);
    const contextValue = useMemo(()=>({
            registry
        }), [
        registry
    ]);
    return /*#__PURE__*/ jsx(NodeRegistryContext.Provider, {
        value: contextValue,
        children: children
    });
};
export { NodeRegistryProvider };
