'use client';
import { flattenTopLevelFields } from 'payload/shared';
import { useTranslation } from '../providers/Translation/index.js';
export const useUseTitleField = (collection)=>{
    const { admin: { useAsTitle }, fields } = collection;
    const { i18n } = useTranslation();
    const topLevelFields = flattenTopLevelFields(fields, {
        i18n,
        moveSubFieldsToTop: true
    });
    return topLevelFields?.find((field)=>'name' in field && field.name === useAsTitle);
};

//# sourceMappingURL=useUseAsTitle.js.map