import { jsx } from "react/jsx-runtime";
import "react";
import { useTranslation } from "react-i18next";
import { SchemaInitializerChildren } from "../../application/schema-initializer/components/SchemaInitializerChildren.mjs";
import { SchemaInitializer } from "../../application/schema-initializer/SchemaInitializer.mjs";
import { useCompile } from "../../schema-component/index.mjs";
import { gridRowColWrap, useCustomFormItemInitializerFields, useInheritsFormItemInitializerFields } from "../utils.mjs";
const ParentCollectionFields = ()=>{
    const inheritFields = useInheritsFormItemInitializerFields({
        component: 'AssignedField'
    });
    const { t } = useTranslation();
    const compile = useCompile();
    if (!(null == inheritFields ? void 0 : inheritFields.length)) return null;
    const res = [];
    inheritFields.forEach((inherit)=>{
        Object.values(inherit)[0].length && res.push({
            type: 'itemGroup',
            divider: true,
            title: t("Parent collection fields") + '(' + compile("".concat(Object.keys(inherit)[0])) + ')',
            children: Object.values(inherit)[0]
        });
    });
    return /*#__PURE__*/ jsx(SchemaInitializerChildren, {
        children: res
    });
};
const customFormItemInitializers = new SchemaInitializer({
    name: 'assignFieldValuesForm:configureFields',
    wrap: gridRowColWrap,
    icon: 'SettingOutlined',
    title: '{{t("Configure fields")}}',
    items: [
        {
            type: 'itemGroup',
            title: '{{t("Configure fields")}}',
            name: 'configureFields',
            useChildren: useCustomFormItemInitializerFields
        },
        {
            name: 'parentCollectionFields',
            Component: ParentCollectionFields
        }
    ]
});
export { customFormItemInitializers };
