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__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_GeneralSchemaDesigner_mjs__ from "../../../schema-settings/GeneralSchemaDesigner.mjs";
const useSchemaToolbarRender = (fieldSchema)=>{
    const { designable } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
    const toolbar = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
        if (fieldSchema['x-toolbar'] || fieldSchema['x-designer']) return fieldSchema['x-toolbar'] || fieldSchema['x-designer'];
        if (fieldSchema['x-settings']) return __WEBPACK_EXTERNAL_MODULE__schema_settings_GeneralSchemaDesigner_mjs__.SchemaToolbar;
    }, [
        fieldSchema
    ]);
    const C = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useComponent)(toolbar);
    return {
        render (props) {
            if (!designable || !C) return null;
            return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(C, {
                ...fieldSchema['x-toolbar-props'],
                ...props
            });
        },
        exists: !!C
    };
};
export { useSchemaToolbarRender };
