{"version":3,"file":"AutoCloneFailureModal.mjs","sources":["../../../../../admin/src/pages/ListView/components/AutoCloneFailureModal.tsx"],"sourcesContent":["import { Box, Flex, Typography } from '@strapi/design-system';\nimport { ChevronRight } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../../../utils/translations';\n\nimport type { ProhibitedCloningField } from '../../../../../shared/contracts/collection-types';\n\ntype Reason = ProhibitedCloningField[1];\n\ninterface AutoCloneFailureModalBodyProps {\n prohibitedFields: ProhibitedCloningField[];\n}\n\nconst AutoCloneFailureModalBody = ({ prohibitedFields }: AutoCloneFailureModalBodyProps) => {\n const { formatMessage } = useIntl();\n\n const getDefaultErrorMessage = (reason: Reason) => {\n switch (reason) {\n case 'relation':\n return 'Duplicating the relation could remove it from the original entry.';\n case 'unique':\n return 'Identical values in a unique field are not allowed';\n default:\n return reason;\n }\n };\n\n return (\n <>\n \n {formatMessage({\n id: getTranslation('containers.list.autoCloneModal.title'),\n defaultMessage: \"This entry can't be duplicated directly.\",\n })}\n \n \n \n {formatMessage({\n id: getTranslation('containers.list.autoCloneModal.description'),\n defaultMessage:\n \"A new entry will be created with the same content, but you'll have to change the following fields to save it.\",\n })}\n \n \n \n {prohibitedFields.map(([fieldPath, reason]) => (\n \n \n {fieldPath.map((pathSegment, index) => (\n \n {pathSegment}\n {index !== fieldPath.length - 1 && (\n \n )}\n \n ))}\n \n \n {formatMessage({\n id: getTranslation(`containers.list.autoCloneModal.error.${reason}`),\n defaultMessage: getDefaultErrorMessage(reason),\n })}\n \n \n ))}\n \n \n );\n};\n\nexport { AutoCloneFailureModalBody };\nexport type { AutoCloneFailureModalBodyProps };\n"],"names":["AutoCloneFailureModalBody","prohibitedFields","formatMessage","useIntl","getDefaultErrorMessage","reason","_jsxs","_Fragment","_jsx","Typography","variant","id","getTranslation","defaultMessage","Box","marginTop","textColor","Flex","gap","direction","alignItems","map","fieldPath","borderColor","hasRadius","padding","tag","pathSegment","index","fontWeight","length","ChevronRight","fill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