import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../../application/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_items_FilterBlockInitializer_mjs__ from "../../../../schema-initializer/items/FilterBlockInitializer.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__createFilterFormBlockSchema_mjs__ from "./createFilterFormBlockSchema.mjs";
const FilterFormBlockInitializer = (param)=>{
    let { filterCollections, onlyCurrentDataSource, hideChildrenIfSingleCollection } = param;
    const itemConfig = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializerItem)();
    const { insert } = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializer)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_initializer_items_FilterBlockInitializer_mjs__.FilterBlockInitializer, {
        ...itemConfig,
        icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.FormOutlined, {}),
        onlyCurrentDataSource: onlyCurrentDataSource,
        componentType: 'FilterFormItem',
        templateWrap: (templateSchema, param)=>{
            let { item } = param;
            const s = (0, __WEBPACK_EXTERNAL_MODULE__createFilterFormBlockSchema_mjs__.createFilterFormBlockSchema)({
                templateSchema: templateSchema,
                dataSource: item.dataSource,
                collectionName: item.name || item.collectionName
            });
            if (item.template && 'reference' === item.mode) s['x-template-key'] = item.template.key;
            return s;
        },
        onCreateBlockSchema: (param)=>{
            let { item } = param;
            return insert((0, __WEBPACK_EXTERNAL_MODULE__createFilterFormBlockSchema_mjs__.createFilterFormBlockSchema)({
                collectionName: item.collectionName || item.name,
                dataSource: item.dataSource
            }));
        },
        filter: filterCollections,
        hideChildrenIfSingleCollection: hideChildrenIfSingleCollection
    });
};
export { FilterFormBlockInitializer };
