UNPKG

@wordpress/block-library

Version:
1 lines • 24.1 kB
{"version":3,"file":"edit.cjs","names":["customLink","__","LINK_DESTINATION_ATTACHMENT","imageIcon","LINK_DESTINATION_MEDIA","fullscreen","LINK_DESTINATION_LIGHTBOX","linkOff","_x","LINK_DESTINATION_NONE","useBlockEditingMode","useSettings","getDefaultLinkDestination","isGalleryFlexLayout","useSelect","blockEditorStore","useDispatch","noticesStore","useGetMedia","useMemo","useState","useDynamicGallery","getImageAttributes","createBlobURL","createBlock","getHrefAndDestination","sprintf","useBlockProps","useInnerBlocksProps","MediaPlaceholder","sharedIcon","Button","getDynamicSource","ATTACHED_MEDIA","InspectorControls","GallerySourcePanel","GalleryControls","BlockControls","ToolbarDropdownMenu","linkIcon","MenuGroup","MenuItem","MediaReplaceFlow","GalleryStyles","GalleryDynamicView","Gallery"],"sources":["../../src/gallery/edit.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tstore as blockEditorStore,\n\tMediaPlaceholder,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tuseBlockEditingMode,\n\tBlockControls,\n\tMediaReplaceFlow,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\nimport {\n\tlink as linkIcon,\n\tcustomLink,\n\timage as imageIcon,\n\tlinkOff,\n\tfullscreen,\n} from '@wordpress/icons';\nimport { sharedIcon } from './shared-icon';\nimport { getImageAttributes, isGalleryFlexLayout } from './shared';\nimport { getHrefAndDestination } from './utils';\nimport { getDefaultLinkDestination } from '../image/utils';\nimport Gallery from './gallery';\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_LIGHTBOX,\n} from './constants';\nimport useGetMedia from './use-get-media';\nimport useApplyGallerySettings from './use-apply-gallery-settings';\nimport GalleryStyles from './gallery-styles';\nimport GalleryControls from './controls';\nimport useDynamicGallery from './use-dynamic-gallery';\nimport { GallerySourcePanel, GalleryDynamicView } from './dynamic-gallery';\nimport { getDynamicSource, ATTACHED_MEDIA } from './dynamic-source';\n\nconst LINK_OPTIONS = [\n\t{\n\t\ticon: customLink,\n\t\tlabel: __( 'Link images to attachment pages' ),\n\t\tvalue: LINK_DESTINATION_ATTACHMENT,\n\t\tnoticeText: __( 'Attachment Pages' ),\n\t},\n\t{\n\t\ticon: imageIcon,\n\t\tlabel: __( 'Link images to media files' ),\n\t\tvalue: LINK_DESTINATION_MEDIA,\n\t\tnoticeText: __( 'Media Files' ),\n\t},\n\t{\n\t\ticon: fullscreen,\n\t\tlabel: __( 'Enlarge on click' ),\n\t\tvalue: LINK_DESTINATION_LIGHTBOX,\n\t\tnoticeText: __( 'Lightbox effect' ),\n\t\tinfoText: __( 'Scale images with a lightbox effect' ),\n\t},\n\t{\n\t\ticon: linkOff,\n\t\tlabel: _x( 'None', 'Media item link option' ),\n\t\tvalue: LINK_DESTINATION_NONE,\n\t\tnoticeText: __( 'None' ),\n\t},\n];\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nconst PLACEHOLDER_TEXT = __(\n\t'Drag and drop images, upload, or choose from your library.'\n);\n\nconst DEFAULT_BLOCK = { name: 'core/image' };\nconst EMPTY_ARRAY = [];\n\nexport default function GalleryEdit( props ) {\n\tconst {\n\t\tsetAttributes,\n\t\tattributes,\n\t\tclassName,\n\t\tclientId,\n\t\tinsertBlocksAfter,\n\t\tcontext,\n\t} = props;\n\n\tconst postId = context?.postId;\n\tconst postType = context?.postType;\n\n\t// Entering dynamic mode is a structural change (it discards inner blocks and\n\t// switches the block's mode), so the entry point is only offered when the\n\t// block is fully editable — mirroring the dynamic view's \"Edit images\"\n\t// toolbar control. Under a content lock the mode is `'contentOnly'`/\n\t// `'disabled'`, where structural affordances are hidden.\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst [ lightboxSetting ] = useSettings( 'blocks.core/image.lightbox' );\n\n\tconst linkOptions = ! lightboxSetting?.allowEditing\n\t\t? LINK_OPTIONS.filter(\n\t\t\t\t( option ) => option.value !== LINK_DESTINATION_LIGHTBOX\n\t\t\t)\n\t\t: LINK_OPTIONS;\n\n\tconst { layout } = attributes;\n\tconst isDynamic = !! attributes.dynamicContent;\n\t// The site default only applies to images being added, which a dynamic\n\t// gallery never has, so match the server render.\n\tconst linkTo =\n\t\tattributes.linkTo ??\n\t\t( isDynamic ? LINK_DESTINATION_NONE : getDefaultLinkDestination() );\n\tconst galleryAttributes = { ...attributes, linkTo };\n\tconst isFlexLayout = isGalleryFlexLayout( layout );\n\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceInnerBlocks, updateBlockAttributes, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { innerBlockImages, multiGallerySelection, selectedStyleState } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockName,\n\t\t\t\t\tgetMultiSelectedBlockClientIds,\n\t\t\t\t\tgetBlocks: _getBlocks,\n\t\t\t\t\tgetSelectedBlockStyleState,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\n\t\t\t\treturn {\n\t\t\t\t\tinnerBlockImages: _getBlocks( clientId ),\n\t\t\t\t\tmultiGallerySelection:\n\t\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/gallery'\n\t\t\t\t\t\t),\n\t\t\t\t\tselectedStyleState: getSelectedBlockStyleState( clientId ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\tconst isViewportStyleState =\n\t\tselectedStyleState?.viewport &&\n\t\tselectedStyleState.viewport !== 'default';\n\n\tconst imageData = useGetMedia( innerBlockImages );\n\tconst mediaById = useMemo(\n\t\t() => new Map( imageData.map( ( media ) => [ media.id, media ] ) ),\n\t\t[ imageData ]\n\t);\n\n\tconst hasImages = !! innerBlockImages.length;\n\n\t// The static \"Order by\" control shows the last sort applied from it, for as\n\t// long as the images stay in the sequence that sort produced. Any other\n\t// change to the images (a drag, an addition, a removal) drops it back to\n\t// \"Custom\"; it never reports an order the user didn't choose. Nothing is\n\t// stored, so this is local state rather than an attribute. It lives here,\n\t// not in the Settings panel, which unmounts when the block is deselected.\n\tconst [ appliedSort, setAppliedSort ] = useState( null );\n\n\t// Dynamic mode (resolving images from a source instead of inner blocks):\n\t// source resolution, the editor-preview blocks, and the mode/ordering\n\t// actions.\n\tconst dynamic = useDynamicGallery( {\n\t\tattributes: galleryAttributes,\n\t\tsetAttributes,\n\t\tclientId,\n\t\tpostId,\n\t\tpostType,\n\t} );\n\n\tuseApplyGallerySettings( innerBlockImages, mediaById, ( imageAttributes ) =>\n\t\tgetImageAttributes(\n\t\t\tgalleryAttributes,\n\t\t\timageAttributes,\n\t\t\tmediaById.get( imageAttributes.id )\n\t\t)\n\t);\n\n\tfunction isValidFileType( file ) {\n\t\tconst mediaTypeSelector = file.type;\n\n\t\treturn (\n\t\t\tALLOWED_MEDIA_TYPES.some(\n\t\t\t\t( mediaType ) => mediaTypeSelector?.indexOf( mediaType ) === 0\n\t\t\t) || file.blob\n\t\t);\n\t}\n\n\tfunction updateImages( selectedImages ) {\n\t\tconst newFileUploads =\n\t\t\tObject.prototype.toString.call( selectedImages ) ===\n\t\t\t'[object FileList]';\n\n\t\t// Uploaded files become blobs before validation, so only picked or\n\t\t// dropped files can be rejected.\n\t\tconst imageArray = Array.from( selectedImages, ( file ) =>\n\t\t\tfile.url || ( ! newFileUploads && ! isValidFileType( file ) )\n\t\t\t\t? file\n\t\t\t\t: { blob: file.blob || createBlobURL( file ) }\n\t\t);\n\n\t\tif ( ! imageArray.every( isValidFileType ) ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\t__(\n\t\t\t\t\t'If uploading to a gallery all files need to be image formats'\n\t\t\t\t),\n\t\t\t\t{ id: 'gallery-upload-invalid-file', type: 'snackbar' }\n\t\t\t);\n\t\t}\n\n\t\tconst processedImages = imageArray.filter(\n\t\t\t( file ) => file.url || isValidFileType( file )\n\t\t);\n\n\t\t// Because we are reusing existing innerImage blocks any reordering\n\t\t// done in the media library will be lost so we need to reapply that ordering\n\t\t// once the new image blocks are merged in with existing.\n\t\tconst newOrderMap = processedImages.reduce(\n\t\t\t( result, image, index ) => (\n\t\t\t\t( result[ image.id ] = index ),\n\t\t\t\tresult\n\t\t\t ),\n\t\t\t{}\n\t\t);\n\n\t\tconst selectedIds = new Set( processedImages.map( ( img ) => img.id ) );\n\t\tconst existingImageBlocks = ! newFileUploads\n\t\t\t? innerBlockImages.filter( ( block ) =>\n\t\t\t\t\tselectedIds.has( block.attributes.id )\n\t\t\t\t)\n\t\t\t: innerBlockImages;\n\n\t\tconst existingIds = new Set(\n\t\t\texistingImageBlocks.map( ( block ) => block.attributes.id )\n\t\t);\n\t\tconst newImageList = processedImages.filter(\n\t\t\t( img ) => ! existingIds.has( img.id )\n\t\t);\n\n\t\tconst newBlocks = newImageList.map( ( image ) => {\n\t\t\treturn createBlock( 'core/image', {\n\t\t\t\tid: image.id,\n\t\t\t\tblob: image.blob,\n\t\t\t\turl: image.url,\n\t\t\t\tcaption: image.caption,\n\t\t\t\talt: image.alt,\n\t\t\t} );\n\t\t} );\n\n\t\treplaceInnerBlocks(\n\t\t\tclientId,\n\t\t\texistingImageBlocks\n\t\t\t\t.concat( newBlocks )\n\t\t\t\t.sort(\n\t\t\t\t\t( a, b ) =>\n\t\t\t\t\t\tnewOrderMap[ a.attributes.id ] -\n\t\t\t\t\t\tnewOrderMap[ b.attributes.id ]\n\t\t\t\t)\n\t\t);\n\n\t\t// Select the first block to scroll into view when new blocks are added.\n\t\tif ( newBlocks?.length > 0 ) {\n\t\t\tselectBlock( newBlocks[ 0 ].clientId );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction updateInnerImages( getAttributes ) {\n\t\tconst images = getBlocks( clientId );\n\t\tupdateBlockAttributes(\n\t\t\timages.map( ( block ) => block.clientId ),\n\t\t\tObject.fromEntries(\n\t\t\t\timages.map( ( block ) => [\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tgetAttributes(\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tmediaById.get( block.attributes.id )\n\t\t\t\t\t),\n\t\t\t\t] )\n\t\t\t),\n\t\t\t{ uniqueByBlock: true }\n\t\t);\n\t}\n\n\tfunction setLinkTo( value ) {\n\t\tsetAttributes( { linkTo: value } );\n\t\tupdateInnerImages( ( block, media ) =>\n\t\t\tgetHrefAndDestination(\n\t\t\t\tmedia,\n\t\t\t\tvalue,\n\t\t\t\tfalse,\n\t\t\t\tblock.attributes,\n\t\t\t\tlightboxSetting\n\t\t\t)\n\t\t);\n\t\tconst linkToText = [ ...linkOptions ].find(\n\t\t\t( linkType ) => linkType.value === value\n\t\t);\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: image size settings */\n\t\t\t\t__( 'All gallery image links updated to: %s' ),\n\t\t\t\tlinkToText.noticeText\n\t\t\t),\n\t\t\t{\n\t\t\t\tid: 'gallery-attributes-linkTo',\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst hasImageIds =\n\t\thasImages &&\n\t\tinnerBlockImages.some( ( block ) => !! block.attributes.id );\n\tconst imagesUploading = innerBlockImages.some(\n\t\t( block ) =>\n\t\t\t! block.attributes.id &&\n\t\t\tblock.attributes.url?.indexOf( 'blob:' ) === 0\n\t);\n\n\tconst mediaPlaceholderProps = {\n\t\taddToGallery: false,\n\t\tdisableMediaButtons: imagesUploading,\n\t\tvalue: {},\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\tclassName,\n\t\t\t'has-nested-images',\n\t\t\t`wp-block-gallery-${ clientId }`\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\t// In dynamic mode nothing may be inserted: the images are resolved from\n\t\t// the source, not authored as inner blocks. `allowedBlocks: []` enforces\n\t\t// this in every context — unlike `templateLock: 'all'`, it isn't relaxed\n\t\t// to `contentOnly` by a content-locked ancestor — so it blocks insertion\n\t\t// and drag-and-drop (via `canInsertBlockType`). It's also what opts the\n\t\t// gallery out of the List View: a block that can't be inserted into and\n\t\t// has no inner blocks has nothing to navigate or add (see\n\t\t// `shouldRenderBlockListView`). This reaches the block's list settings\n\t\t// only while the inner blocks are mounted, which is why the dynamic view\n\t\t// still renders the (empty) inner blocks.\n\t\tallowedBlocks: isDynamic ? EMPTY_ARRAY : undefined,\n\t} );\n\n\tif ( ! hasImages && ! isDynamic ) {\n\t\treturn (\n\t\t\t<div { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\thandleUpload={ false }\n\t\t\t\t\ticon={ sharedIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Gallery' ),\n\t\t\t\t\t\tinstructions: PLACEHOLDER_TEXT,\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ updateImages }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tmultiple\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t{ ...mediaPlaceholderProps }\n\t\t\t\t>\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Entry into dynamic mode. Gated on the editing mode so it's\n\t\t\t\t\t * hidden in content-only editing (where this structural change\n\t\t\t\t\t * isn't allowed), but intentionally not hidden by\n\t\t\t\t\t * `canUseDynamicSource` the way the inspector is (see\n\t\t\t\t\t * `dynamic-gallery.jsx`): even with no\n\t\t\t\t\t * post type to preview against, the source still resolves at\n\t\t\t\t\t * render time via `get_the_ID()` (see `index.php`) — e.g. in a\n\t\t\t\t\t * template part or pattern shown on a singular page.\n\t\t\t\t\t */ }\n\t\t\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ dynamic.enableDynamicMode }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ getDynamicSource( ATTACHED_MEDIA ).title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls\n\t\t\t\tgroup={ isViewportStyleState ? 'style-state' : 'default' }\n\t\t\t>\n\t\t\t\t{ ! isViewportStyleState && (\n\t\t\t\t\t<GallerySourcePanel\n\t\t\t\t\t\tdynamic={ dynamic }\n\t\t\t\t\t\thasImages={ hasImages }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<GalleryControls\n\t\t\t\t\tattributes={ galleryAttributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tviewport={\n\t\t\t\t\t\tisViewportStyleState\n\t\t\t\t\t\t\t? selectedStyleState.viewport\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tinnerBlockImages={ innerBlockImages }\n\t\t\t\t\tmediaById={ mediaById }\n\t\t\t\t\tdynamic={ dynamic }\n\t\t\t\t\tupdateInnerImages={ updateInnerImages }\n\t\t\t\t\tappliedSort={ appliedSort }\n\t\t\t\t\tsetAppliedSort={ setAppliedSort }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<ToolbarDropdownMenu icon={ linkIcon } label={ __( 'Link' ) }>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ linkOptions.map( ( linkItem ) => {\n\t\t\t\t\t\t\t\tconst isOptionSelected =\n\t\t\t\t\t\t\t\t\tlinkTo === linkItem.value;\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ linkItem.value }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isOptionSelected }\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t'is-active': isOptionSelected,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\ticon={ linkItem.icon }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetLinkTo( linkItem.value );\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t\tinfo={ linkItem.infoText }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ linkItem.label }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t{ ! multiGallerySelection && ! isDynamic && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\thandleUpload={ false }\n\t\t\t\t\t\tonSelect={ updateImages }\n\t\t\t\t\t\tname={ __( 'Add' ) }\n\t\t\t\t\t\tmultiple\n\t\t\t\t\t\tmediaIds={ innerBlockImages\n\t\t\t\t\t\t\t.filter( ( block ) => block.attributes.id )\n\t\t\t\t\t\t\t.map( ( block ) => block.attributes.id ) }\n\t\t\t\t\t\taddToGallery={ hasImageIds }\n\t\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<GalleryStyles\n\t\t\t\tstyle={ attributes.style }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisFlexLayout={ isFlexLayout }\n\t\t\t/>\n\t\t\t{ isDynamic ? (\n\t\t\t\t<GalleryDynamicView\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tdynamic={ dynamic }\n\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\tinnerBlocksProps={ innerBlocksProps }\n\t\t\t\t\tmultiGallerySelection={ multiGallerySelection }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Gallery\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tblockProps={ innerBlocksProps }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tmultiGallerySelection={ multiGallerySelection }\n\t\t\t\t>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t</Gallery>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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