import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
const useSchemaOptionsContext = ()=>{
    const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
    return options || {};
};
const SchemaComponentOptions = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.memo)((props)=>{
    const { children } = props;
    const options = useSchemaOptionsContext();
    const components = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
            ...options.components,
            ...props.components
        }), [
        options.components,
        props.components
    ]);
    const scope = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
            ...options.scope,
            ...props.scope
        }), [
        options.scope,
        props.scope
    ]);
    const schemaOptionsContextValue = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
            scope,
            components
        }), [
        scope,
        components
    ]);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext.Provider, {
        value: schemaOptionsContextValue,
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaComponentsContext.Provider, {
            value: components,
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.ExpressionScope, {
                value: scope,
                children: children
            })
        })
    });
});
SchemaComponentOptions.displayName = 'SchemaComponentOptions';
export { SchemaComponentOptions, useSchemaOptionsContext };
