import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__ from "../../../data-source/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__flag_provider_index_mjs__ from "../../../flag-provider/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_association_field_hooks_mjs__ from "../../../schema-component/antd/association-field/hooks.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__useBaseVariable_mjs__ from "./useBaseVariable.mjs";
const useIterationVariable = (param)=>{
    let { currentCollection, collectionField, schema, noDisabled, targetFieldSchema } = param;
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const result = (0, __WEBPACK_EXTERNAL_MODULE__useBaseVariable_mjs__.useBaseVariable)({
        collectionField,
        uiSchema: schema,
        targetFieldSchema,
        maxDepth: 4,
        name: '$iteration',
        title: t('Current object'),
        collectionName: currentCollection,
        noDisabled,
        returnFields: (fields, option)=>fields
    });
    return result;
};
const useCurrentObjectVariable = function() {
    let { collectionField, schema, noDisabled, targetFieldSchema } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    const collection = (0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useCollection)();
    const { formValue: currentObjectCtx, collection: collectionOfCurrentObject } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_association_field_hooks_mjs__.useSubFormValue)();
    const { isInSubForm, isInSubTable } = (0, __WEBPACK_EXTERNAL_MODULE__flag_provider_index_mjs__.useFlag)() || {};
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const currentObjectSettings = (0, __WEBPACK_EXTERNAL_MODULE__useBaseVariable_mjs__.useBaseVariable)({
        collectionField,
        uiSchema: schema,
        targetFieldSchema,
        maxDepth: 4,
        name: '$iteration',
        title: t('Current object'),
        collectionName: (null == collectionOfCurrentObject ? void 0 : collectionOfCurrentObject.name) || (null == collection ? void 0 : collection.name),
        noDisabled,
        returnFields: (fields, option)=>fields
    });
    return {
        shouldDisplayCurrentObject: isInSubForm || isInSubTable,
        currentObjectCtx,
        currentObjectSettings
    };
};
export { useCurrentObjectVariable, useIterationVariable };
