import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__block_provider_FormBlockProvider_mjs__ from "../../../block-provider/FormBlockProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__useBaseVariable_mjs__ from "./useBaseVariable.mjs";
const useRecordVariable = (props)=>{
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const currentRecordVariable = (0, __WEBPACK_EXTERNAL_MODULE__useBaseVariable_mjs__.useBaseVariable)({
        collectionField: props.collectionField,
        uiSchema: props.schema,
        name: '$nRecord',
        title: t('Current record'),
        collectionName: props.collectionName,
        noDisabled: props.noDisabled,
        targetFieldSchema: props.targetFieldSchema
    });
    return currentRecordVariable;
};
const useCurrentRecordVariable = function() {
    let props = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const { formRecord, collectionName } = (0, __WEBPACK_EXTERNAL_MODULE__block_provider_FormBlockProvider_mjs__.useFormBlockContext)();
    const currentRecordSettings = (0, __WEBPACK_EXTERNAL_MODULE__useBaseVariable_mjs__.useBaseVariable)({
        collectionField: props.collectionField,
        uiSchema: props.schema,
        name: '$nRecord',
        title: t('Current record'),
        collectionName: collectionName,
        noDisabled: props.noDisabled,
        targetFieldSchema: props.targetFieldSchema
    });
    return {
        currentRecordSettings,
        currentRecordCtx: null == formRecord ? void 0 : formRecord.data,
        shouldDisplayCurrentRecord: !(null == formRecord ? void 0 : formRecord.isNew) && !__WEBPACK_EXTERNAL_MODULE_lodash__["default"].isEmpty(null == formRecord ? void 0 : formRecord.data),
        collectionName
    };
};
export { useCurrentRecordVariable, useRecordVariable };
