{"version":3,"file":"index.cjs","names":["unlock","mediaUtilsPrivateApis","useMovingAnimation","useState","MediaUpload","withFilters","isBlobURL","WCSpinner","DropZone","Tooltip","Truncate","decodeEntities","Button","chevronLeft","chevronUp","__","chevronRight","chevronDown","WCIcon","audio","video","archive","file","sprintf","VStack","HStack","closeSmall","useSelect","coreStore","useRef","useMemo","useDispatch","noticesStore","useCallback","getBlobTypeByURL","WCText","Stack","VisuallyHidden","BaseControl","ValidityIndicator"],"sources":["../../../src/components/media-edit/index.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport {\n\tButton,\n\tDropZone,\n\tIcon as WCIcon,\n\tSpinner as WCSpinner,\n\t__experimentalText as WCText,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tBaseControl,\n\twithFilters,\n} from '@wordpress/components';\nimport { isBlobURL, getBlobTypeByURL } from '@wordpress/blob';\nimport { store as coreStore, type Attachment } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tarchive,\n\taudio,\n\tvideo,\n\tfile,\n\tcloseSmall,\n\tchevronUp,\n\tchevronDown,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport {\n\tStack,\n\tTooltip,\n\tValidityIndicator,\n\tVisuallyHidden,\n} from '@wordpress/ui';\nimport { speak } from '@wordpress/a11y';\nimport {\n\tMediaUpload,\n\tuploadMedia,\n\tprivateApis as mediaUtilsPrivateApis,\n} from '@wordpress/media-utils';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { unlock } from '../../lock-unlock';\nimport type { MediaEditProps } from '../../types';\nimport useMovingAnimation from './use-moving-animation';\n\nconst { MediaUploadModal } = unlock( mediaUtilsPrivateApis );\n\nfunction AnimatedMediaItem( {\n\tchildren,\n\tindex,\n\titemsKey,\n\tclassName,\n}: {\n\tchildren: React.ReactNode;\n\tindex: number;\n\titemsKey: string;\n\tclassName?: string;\n} ) {\n\tconst ref = useMovingAnimation( index, itemsKey );\n\treturn (\n\t\t<div ref={ ref } className={ className }>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\ntype BlobItem = {\n\tid: string;\n\tsource_url: string;\n\tmime_type: string | undefined;\n\talt_text?: string;\n};\n\nfunction normalizeValue( value: number | number[] | undefined ): number[] {\n\tif ( Array.isArray( value ) ) {\n\t\treturn value;\n\t}\n\treturn value ? [ value ] : [];\n}\n\n/**\n * Conditional Media component that uses MediaUploadModal when experiment is enabled,\n * otherwise falls back to media-utils MediaUpload. Also what `FilteredMediaUpload`\n * falls back to when nothing is registered on `editor.MediaUpload`, as in tests.\n *\n * @param root0          Component props.\n * @param root0.render   Render prop function that receives { open } object.\n * @param root0.multiple Whether to allow multiple media selections; `'add'` keeps the current selection in the legacy media frame.\n * @return The component.\n */\nfunction ConditionalMediaUpload( { render, multiple, ...props }: any ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tif ( ( window as any ).__experimentalDataViewsMediaModal ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ render && render( { open: () => setIsModalOpen( true ) } ) }\n\t\t\t\t{ isModalOpen && (\n\t\t\t\t\t<MediaUploadModal\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t// The modal takes a boolean.\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tprops.onClose?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonSelect={ ( media: any ) => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tprops.onSelect?.( media );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\t// Fallback to media-utils MediaUpload when experiment is disabled.\n\treturn <MediaUpload { ...props } render={ render } multiple={ multiple } />;\n}\n\n/*\n * `ConditionalMediaUpload` resolved through `editor.MediaUpload`: the hook\n * through which the editor supplies its media library to blocks and plugins\n * extend it (extra sources, validation). Those callbacks assume an editor\n * context, so `MediaEdit` does not use it; `MediaEditControl` does when\n * `isPickerFiltered` is set, for fields that render inside the editor.\n */\nconst FilteredMediaUpload = withFilters( 'editor.MediaUpload' )(\n\tConditionalMediaUpload\n) as React.ComponentType< Record< string, unknown > >;\n\nfunction MediaPickerButton( {\n\topen,\n\tchildren,\n\tlabel,\n\tshowTooltip = false,\n\tonFilesDrop,\n\tattachment,\n\tisUploading = false,\n}: {\n\topen: () => void;\n\tchildren: React.ReactNode;\n\tlabel: string;\n\tshowTooltip?: boolean;\n\tonFilesDrop: MediaEditAttachmentsProps[ 'onFilesDrop' ];\n\tattachment?: MediaEditAttachment;\n\tisUploading?: boolean;\n} ) {\n\tconst isBlob = attachment && isBlobURL( attachment.source_url );\n\tconst mediaPickerButton = (\n\t\t<div\n\t\t\tclassName={ clsx( 'fields__media-edit-picker-button', {\n\t\t\t\t'has-attachment': attachment,\n\t\t\t} ) }\n\t\t\trole=\"button\"\n\t\t\ttabIndex={ 0 }\n\t\t\tonClick={ () => {\n\t\t\t\tif ( ! isUploading ) {\n\t\t\t\t\topen();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( isUploading ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\topen();\n\t\t\t\t}\n\t\t\t} }\n\t\t\taria-label={ label }\n\t\t\taria-disabled={ isUploading }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ isBlob && (\n\t\t\t\t<span className=\"fields__media-edit-picker-button-spinner\">\n\t\t\t\t\t<WCSpinner />\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ ! isUploading && (\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ ( files ) =>\n\t\t\t\t\t\tonFilesDrop( files, attachment?.id as number )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n\tif ( ! showTooltip ) {\n\t\treturn mediaPickerButton;\n\t}\n\treturn (\n\t\t<Tooltip.Root>\n\t\t\t<Tooltip.Trigger render={ mediaPickerButton } />\n\t\t\t<Tooltip.Popup>{ label }</Tooltip.Popup>\n\t\t</Tooltip.Root>\n\t);\n}\n\nconst archiveMimeTypes = [\n\t'application/zip',\n\t'application/x-zip-compressed',\n\t'application/x-rar-compressed',\n\t'application/x-7z-compressed',\n\t'application/x-tar',\n\t'application/x-gzip',\n];\n\nfunction MediaTitle( { attachment }: { attachment: Attachment< 'view' > } ) {\n\treturn (\n\t\t<Truncate className=\"fields__media-edit-filename\">\n\t\t\t{ decodeEntities( attachment.title.rendered ) }\n\t\t</Truncate>\n\t);\n}\n\nfunction MediaEditPlaceholder( props: {\n\topen: () => void;\n\tlabel: string;\n\tonFilesDrop: MediaEditAttachmentsProps[ 'onFilesDrop' ];\n\tisUploading: boolean;\n} ) {\n\treturn (\n\t\t<MediaPickerButton { ...props }>\n\t\t\t<span className=\"fields__media-edit-placeholder\">\n\t\t\t\t{ props.label }\n\t\t\t</span>\n\t\t</MediaPickerButton>\n\t);\n}\n\nfunction MoveButtons( {\n\titemId,\n\tindex,\n\ttotalItems,\n\tisUploading,\n\tmoveItem,\n\torientation = 'vertical',\n}: {\n\titemId: number;\n\tindex: number;\n\ttotalItems: number;\n\tisUploading: boolean;\n\tmoveItem: ( id: number, direction: 'up' | 'down' ) => void;\n\torientation?: 'vertical' | 'horizontal';\n} ) {\n\tconst isHorizontal = orientation === 'horizontal';\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\ticon={ isHorizontal ? chevronLeft : chevronUp }\n\t\t\t\tlabel={ isHorizontal ? __( 'Move left' ) : __( 'Move up' ) }\n\t\t\t\tsize=\"small\"\n\t\t\t\tdisabled={ isUploading || index === 0 }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\tonClick={ ( event: React.MouseEvent< HTMLButtonElement > ) => {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tmoveItem( itemId, 'up' );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\ticon={ isHorizontal ? chevronRight : chevronDown }\n\t\t\t\tlabel={ isHorizontal ? __( 'Move right' ) : __( 'Move down' ) }\n\t\t\t\tsize=\"small\"\n\t\t\t\tdisabled={ isUploading || index === totalItems - 1 }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\tonClick={ ( event: React.MouseEvent< HTMLButtonElement > ) => {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tmoveItem( itemId, 'down' );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nfunction MediaPreview( { attachment }: { attachment: MediaEditAttachment } ) {\n\tconst url = attachment.source_url;\n\tconst mimeType = attachment.mime_type || '';\n\tif ( mimeType.startsWith( 'image' ) ) {\n\t\treturn (\n\t\t\t<img\n\t\t\t\tclassName=\"fields__media-edit-thumbnail\"\n\t\t\t\talt={ attachment.alt_text || '' }\n\t\t\t\tsrc={ url }\n\t\t\t/>\n\t\t);\n\t} else if ( mimeType.startsWith( 'audio' ) ) {\n\t\treturn <WCIcon icon={ audio } />;\n\t} else if ( mimeType.startsWith( 'video' ) ) {\n\t\treturn <WCIcon icon={ video } />;\n\t} else if ( archiveMimeTypes.includes( mimeType ) ) {\n\t\treturn <WCIcon icon={ archive } />;\n\t}\n\treturn <WCIcon icon={ file } />;\n}\n\ntype MediaEditAttachment = Attachment< 'view' > | BlobItem;\n\n/**\n * Identifies the set of items regardless of their order, so a reorder can be\n * told apart from items being added or removed.\n *\n * @param items The items in the list.\n * @return A key that only changes when items are added or removed.\n */\nfunction getItemsKey( items: Array< MediaEditAttachment > | null ) {\n\treturn ( items ?? [] )\n\t\t.map( ( item ) => String( item.id ) )\n\t\t.sort()\n\t\t.join( ',' );\n}\n\ninterface MediaEditAttachmentsProps {\n\tallItems: Array< MediaEditAttachment > | null;\n\taddButtonLabel: string;\n\tmultiple?: boolean;\n\tremoveItem: ( itemId: number ) => void;\n\tmoveItem: ( itemId: number, direction: 'up' | 'down' ) => void;\n\topen: () => void;\n\tonFilesDrop: ( files: File[], attachmentId?: number ) => void;\n\tisUploading: boolean;\n\tsetTargetItemId: ( id?: number ) => void;\n}\n\nfunction ExpandedMediaEditAttachments( {\n\tallItems,\n\taddButtonLabel,\n\tmultiple,\n\tremoveItem,\n\tmoveItem,\n\topen,\n\tonFilesDrop,\n\tisUploading,\n\tsetTargetItemId,\n}: MediaEditAttachmentsProps ) {\n\tconst itemsKey = getItemsKey( allItems );\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'fields__media-edit-expanded', {\n\t\t\t\t'is-multiple': multiple,\n\t\t\t\t'is-single': ! multiple,\n\t\t\t\t'is-empty': ! allItems?.length,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ allItems?.map( ( attachment, index ) => {\n\t\t\t\tconst hasPreviewImage =\n\t\t\t\t\tattachment.mime_type?.startsWith( 'image' );\n\t\t\t\tconst isBlob = isBlobURL( attachment.source_url );\n\t\t\t\tconst attachmentNumericId = attachment.id as number;\n\t\t\t\treturn (\n\t\t\t\t\t<AnimatedMediaItem\n\t\t\t\t\t\tkey={ attachment.id }\n\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\titemsKey={ itemsKey }\n\t\t\t\t\t\tclassName={ clsx( 'fields__media-edit-expanded-item', {\n\t\t\t\t\t\t\t'has-preview-image': hasPreviewImage,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaPickerButton\n\t\t\t\t\t\t\topen={ () => {\n\t\t\t\t\t\t\t\tsetTargetItemId( attachmentNumericId );\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t! isBlob\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: The title of the media item. */\n\t\t\t\t\t\t\t\t\t\t\t__( 'Replace %s' ),\n\t\t\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\tattachment as Attachment< 'view' >\n\t\t\t\t\t\t\t\t\t\t\t\t ).title.rendered\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: __( 'Replace' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"fields__media-edit-expanded-preview\">\n\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-expanded-preview-stack\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ ( ! isBlob || hasPreviewImage ) && (\n\t\t\t\t\t\t\t\t\t\t<MediaPreview\n\t\t\t\t\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</MediaPickerButton>\n\t\t\t\t\t\t{ ! isBlob && (\n\t\t\t\t\t\t\t<div className=\"fields__media-edit-expanded-overlay\">\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-expanded-actions\"\n\t\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\t\talignment=\"flex-end\"\n\t\t\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ multiple && allItems.length > 1 && (\n\t\t\t\t\t\t\t\t\t\t<MoveButtons\n\t\t\t\t\t\t\t\t\t\t\titemId={ attachmentNumericId }\n\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\ttotalItems={ allItems.length }\n\t\t\t\t\t\t\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t\t\t\t\t\t\t\tmoveItem={ moveItem }\n\t\t\t\t\t\t\t\t\t\t\torientation=\"horizontal\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tdisabled={ isUploading }\n\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tremoveItem( attachmentNumericId );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatedMediaItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ ( multiple || ! allItems?.length ) && (\n\t\t\t\t<MediaEditPlaceholder\n\t\t\t\t\topen={ () => {\n\t\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ addButtonLabel }\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction CompactMediaEditAttachments( {\n\tallItems,\n\taddButtonLabel,\n\tmultiple,\n\tremoveItem,\n\tmoveItem,\n\topen,\n\tonFilesDrop,\n\tisUploading,\n\tsetTargetItemId,\n}: MediaEditAttachmentsProps ) {\n\tconst itemsKey = getItemsKey( allItems );\n\treturn (\n\t\t<>\n\t\t\t{ !! allItems?.length && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'fields__media-edit-compact-group', {\n\t\t\t\t\t\t'is-single': allItems.length === 1,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ allItems.map( ( attachment, index ) => {\n\t\t\t\t\t\t\tconst isBlob = isBlobURL( attachment.source_url );\n\t\t\t\t\t\t\tconst showMoveButtons =\n\t\t\t\t\t\t\t\tmultiple && allItems.length > 1;\n\t\t\t\t\t\t\tconst attachmentNumericId = attachment.id as number;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<AnimatedMediaItem\n\t\t\t\t\t\t\t\t\tkey={ attachment.id }\n\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\titemsKey={ itemsKey }\n\t\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-compact\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<MediaPickerButton\n\t\t\t\t\t\t\t\t\t\topen={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetTargetItemId(\n\t\t\t\t\t\t\t\t\t\t\t\tattachmentNumericId\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\t\t\t\tisUploading={ isUploading }\n\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\t\t<MediaPreview\n\t\t\t\t\t\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ ! isBlob && (\n\t\t\t\t\t\t\t\t\t\t\t\t<MediaTitle\n\t\t\t\t\t\t\t\t\t\t\t\t\tattachment={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tattachment as Attachment< 'view' >\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\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</MediaPickerButton>\n\t\t\t\t\t\t\t\t\t{ ! isBlob && (\n\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-compact-movers\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\t\t\t\talignment=\"flex-end\"\n\t\t\t\t\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ showMoveButtons && (\n\t\t\t\t\t\t\t\t\t\t\t\t<MoveButtons\n\t\t\t\t\t\t\t\t\t\t\t\t\titemId={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tattachmentNumericId\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\t\t\t\t\t\ttotalItems={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tallItems.length\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t\t\t\t\t\t\t\t\t\tmoveItem={ moveItem }\n\t\t\t\t\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={ isUploading }\n\t\t\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"top\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\t\t\tremoveItem(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tattachmentNumericId\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</AnimatedMediaItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ( multiple || ! allItems?.length ) && (\n\t\t\t\t<MediaEditPlaceholder\n\t\t\t\t\topen={ () => {\n\t\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t\tlabel={ addButtonLabel }\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * A media edit control component that provides a media picker UI with upload functionality\n * for selecting WordPress media attachments. Supports both the traditional WordPress media\n * library and the experimental DataViews media modal.\n *\n * This component is intended to be used as the `Edit` property of a field definition when\n * registering fields with `registerEntityField` from `@wordpress/editor`.\n *\n * @template Item - The type of the item being edited.\n *\n * @param {MediaEditProps<Item>} props                       - The component props.\n * @param {Item}                 props.data                  - The item being edited.\n * @param {Object}               props.field                 - The field configuration with getValue and setValue methods.\n * @param {Function}             props.onChange              - Callback function when the media selection changes.\n * @param {string[]}             [props.allowedTypes]        - Array of allowed media types. Use `['*']` to allow all file types. Default `['image']`.\n * @param {boolean}              [props.multiple]            - Whether to allow multiple media selections. Default `false`.\n * @param {boolean}              [props.hideLabelFromVision] - Whether the label should be hidden from vision.\n * @param {boolean}              [props.isExpanded]          - Whether to render in an expanded form. Default `false`.\n *\n * @return {React.JSX.Element} The media edit control component.\n *\n * @example\n * ```tsx\n * import { MediaEdit } from '@wordpress/fields';\n * import type { DataFormControlProps } from '@wordpress/dataviews';\n *\n * const featuredImageField = {\n *   id: 'featured_media',\n *   type: 'media',\n *   label: 'Featured Image',\n *   Edit: (props: DataFormControlProps<MyPostType>) => (\n *     <MediaEdit\n *       {...props}\n *       allowedTypes={['image']}\n *     />\n *   ),\n * };\n * ```\n */\nexport default function MediaEdit< Item >( props: MediaEditProps< Item > ) {\n\treturn <MediaEditControl { ...props } />;\n}\n\n/*\n * Body of `MediaEdit`. Package-internal: the featured image field renders it\n * for the props the public control doesn't offer.\n */\nexport function MediaEditControl< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tallowedTypes = [ 'image' ],\n\tmultiple,\n\tisExpanded,\n\tvalidity,\n\tisPickerFiltered,\n\tfeaturedImageFlow,\n\tpickerTitle,\n}: MediaEditProps< Item > & {\n\t/**\n\t * Whether the picker resolves through the `editor.MediaUpload` filter, so\n\t * the plugin extensions registered on it apply.\n\t */\n\tisPickerFiltered?: boolean;\n\t/**\n\t * Opens the featured-image media frame, as the classic panel does; plugins\n\t * extending `editor.MediaUpload` recognize the featured image by it.\n\t */\n\tfeaturedImageFlow?: boolean;\n\t/**\n\t * Title of the picker, in place of the field label.\n\t */\n\tpickerTitle?: string;\n} ) {\n\tconst MediaUploadComponent = isPickerFiltered\n\t\t? FilteredMediaUpload\n\t\t: ConditionalMediaUpload;\n\tconst value = field.getValue( { item: data } );\n\t// While the permission is unresolved, show the picker, as the editor does.\n\tconst canUpload = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'attachment',\n\t\t\t} ) ?? true,\n\t\t[]\n\t);\n\tconst [ isTouched, setIsTouched ] = useState( false );\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst [ customValidity, setCustomValidity ] = useState<\n\t\t| { type: 'valid' | 'validating' | 'invalid'; message?: string }\n\t\t| undefined\n\t>( undefined );\n\t// Listen for invalid event (e.g., form submission, reportValidity())\n\t// to show validation messages even before blur.\n\tuseEffect( () => {\n\t\tconst validityTarget = validityTargetRef.current;\n\t\tconst handler = () => {\n\t\t\tsetIsTouched( true );\n\t\t};\n\t\tvalidityTarget?.addEventListener( 'invalid', handler );\n\t\treturn () => validityTarget?.removeEventListener( 'invalid', handler );\n\t}, [] );\n\tconst attachments = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! value ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst normalizedValue = normalizeValue( value );\n\t\t\t// Sorted IDs ensure stable cache key, avoiding\n\t\t\t// unnecessary new requests on reorder.\n\t\t\tconst sortedIds = normalizedValue.toSorted( ( a, b ) => a - b );\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', 'attachment', {\n\t\t\t\tinclude: sortedIds,\n\t\t\t} ) as Attachment< 'view' >[] | null;\n\t\t},\n\t\t[ value ]\n\t);\n\t// Keep previous attachments during null transitions. When value changes,\n\t// useSelect briefly returns null while the new query resolves. For pure\n\t// reorders (same IDs), we fall back to the cached list to avoid a visual\n\t// flash in compact mode. For replacements/uploads (new IDs not in cache),\n\t// we let attachments be null as normal.\n\tconst stableAttachmentsRef = useRef< Attachment< 'view' >[] >( null );\n\tif ( attachments !== null ) {\n\t\tstableAttachmentsRef.current = attachments;\n\t}\n\tlet stableAttachments = attachments;\n\tif ( attachments === null && stableAttachmentsRef.current && value ) {\n\t\tconst stableIds = new Set(\n\t\t\tstableAttachmentsRef.current.map( ( a ) => a.id )\n\t\t);\n\t\tif ( normalizeValue( value ).every( ( id ) => stableIds.has( id ) ) ) {\n\t\t\tstableAttachments = stableAttachmentsRef.current;\n\t\t}\n\t}\n\t// Reorder attachments to match value order.\n\tconst orderedAttachments = useMemo( () => {\n\t\tif ( ! stableAttachments ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst normalizedValue = normalizeValue( value );\n\t\tconst attachmentMap = new Map(\n\t\t\tstableAttachments.map( ( a ) => [ a.id, a ] )\n\t\t);\n\t\treturn normalizedValue\n\t\t\t.map( ( id ) => attachmentMap.get( id ) )\n\t\t\t.filter( ( a ): a is Attachment< 'view' > => a !== undefined );\n\t}, [ stableAttachments, value ] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { receiveEntityRecords } = useDispatch( coreStore );\n\t// Support one upload action at a time for now.\n\tconst [ targetItemId, setTargetItemId ] = useState< number >();\n\t// Deferred open: the legacy class-based MediaUpload reads props\n\t// imperatively when `open()` is called, so calling it in the same\n\t// handler as `setTargetItemId()` would open the modal with stale\n\t// `value`/`multiple` props. Setting a pending flag defers the open\n\t// until after the next render when props are up to date.\n\tconst openModalRef = useRef< () => void >( undefined );\n\tconst [ pendingOpen, setPendingOpen ] = useState( false );\n\tconst [ blobs, setBlobs ] = useState< string[] >( [] );\n\tuseEffect( () => {\n\t\tif ( pendingOpen ) {\n\t\t\tsetPendingOpen( false );\n\t\t\topenModalRef.current?.();\n\t\t}\n\t}, [ pendingOpen ] );\n\tconst onChangeControl = useCallback(\n\t\t( newValue: number | number[] | undefined ) =>\n\t\t\tonChange( field.setValue( { item: data, value: newValue } ) ),\n\t\t[ data, field, onChange ]\n\t);\n\tconst removeItem = useCallback(\n\t\t( itemId: number ) => {\n\t\t\tconst currentIds = normalizeValue( value );\n\t\t\tconst newIds = currentIds.filter( ( id ) => id !== itemId );\n\t\t\t// Mark as touched to immediately show any validation error.\n\t\t\tsetIsTouched( true );\n\t\t\tonChangeControl( newIds.length ? newIds : undefined );\n\t\t},\n\t\t[ value, onChangeControl ]\n\t);\n\tconst moveItem = useCallback(\n\t\t( itemId: number, direction: 'up' | 'down' ) => {\n\t\t\tif ( ! orderedAttachments ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst currentIds = orderedAttachments.map( ( a ) => a.id );\n\t\t\tconst index = currentIds.indexOf( itemId );\n\t\t\tconst newIndex = direction === 'up' ? index - 1 : index + 1;\n\t\t\t[ currentIds[ index ], currentIds[ newIndex ] ] = [\n\t\t\t\tcurrentIds[ newIndex ],\n\t\t\t\tcurrentIds[ index ],\n\t\t\t];\n\t\t\tonChangeControl( currentIds );\n\t\t},\n\t\t[ orderedAttachments, onChangeControl ]\n\t);\n\tconst onFilesDrop = useCallback(\n\t\t( files: File[], _targetItemId?: number ) => {\n\t\t\tsetTargetItemId( _targetItemId );\n\t\t\tuploadMedia( {\n\t\t\t\tallowedTypes: allowedTypes?.length ? allowedTypes : undefined,\n\t\t\t\tfilesList: files,\n\t\t\t\tonFileChange( uploadedMedia: any[] ) {\n\t\t\t\t\tconst blobUrls = uploadedMedia\n\t\t\t\t\t\t.filter( ( item ) => isBlobURL( item.url ) )\n\t\t\t\t\t\t.map( ( item ) => item.url );\n\t\t\t\t\tsetBlobs( blobUrls );\n\t\t\t\t\t// Wait for all uploads to complete before updating value.\n\t\t\t\t\tif ( !! blobUrls.length ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// `uploadMedia` creates attachments via `apiFetch`\n\t\t\t\t\t// outside the core-data store, so invalidate\n\t\t\t\t\t// all attachment queries to keep them fresh for\n\t\t\t\t\t// other components that rely on core-data.\n\t\t\t\t\treceiveEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t[],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t\tconst uploadedIds = uploadedMedia.map(\n\t\t\t\t\t\t( item ) => item.id\n\t\t\t\t\t);\n\t\t\t\t\tif ( ! multiple ) {\n\t\t\t\t\t\tonChangeControl( uploadedIds[ 0 ] );\n\t\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst currentValue = normalizeValue( value );\n\t\t\t\t\t// Dropped on placeholder: append new items.\n\t\t\t\t\tif ( _targetItemId === undefined ) {\n\t\t\t\t\t\tonChangeControl( [ ...currentValue, ...uploadedIds ] );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Dropped on existing item: insert at that position.\n\t\t\t\t\t\tconst newValue = [ ...currentValue ];\n\t\t\t\t\t\tnewValue.splice(\n\t\t\t\t\t\t\tcurrentValue.indexOf( _targetItemId ),\n\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t...uploadedIds\n\t\t\t\t\t\t);\n\t\t\t\t\t\tonChangeControl( newValue );\n\t\t\t\t\t}\n\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t},\n\t\t\t\tonError( error: Error ) {\n\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t\tsetBlobs( [] );\n\t\t\t\t\tcreateErrorNotice( error.message, { type: 'snackbar' } );\n\t\t\t\t},\n\t\t\t\tmultiple: !! multiple,\n\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tallowedTypes,\n\t\t\tvalue,\n\t\t\tmultiple,\n\t\t\tcreateErrorNotice,\n\t\t\tonChangeControl,\n\t\t\treceiveEntityRecords,\n\t\t]\n\t);\n\tconst addButtonLabel =\n\t\tfield.placeholder ||\n\t\t( multiple ? __( 'Choose files' ) : __( 'Choose file' ) );\n\t// Merge real attachments with any existing blob items that are being uploaded.\n\tconst allItems: Array< MediaEditAttachment > | null = useMemo( () => {\n\t\tif ( ! blobs.length ) {\n\t\t\treturn orderedAttachments;\n\t\t}\n\t\tconst items: Array< MediaEditAttachment > = [\n\t\t\t...( orderedAttachments || [] ),\n\t\t];\n\t\tconst blobItems = blobs.map( ( url ) => ( {\n\t\t\tid: url,\n\t\t\tsource_url: url,\n\t\t\tmime_type: getBlobTypeByURL( url ),\n\t\t} ) );\n\t\tif ( targetItemId !== undefined ) {\n\t\t\t// When files are dropped in existing media item, place the blobs at that item.\n\t\t\tconst targetIndex = items.findIndex(\n\t\t\t\t( a ) => a.id === targetItemId\n\t\t\t);\n\t\t\titems.splice( targetIndex, 1, ...blobItems );\n\t\t} else {\n\t\t\titems.push( ...blobItems );\n\t\t}\n\t\treturn items;\n\t}, [ orderedAttachments, targetItemId, blobs ] );\n\tuseEffect( () => {\n\t\tif ( ! isTouched ) {\n\t\t\treturn;\n\t\t}\n\t\tconst input = validityTargetRef.current;\n\t\tif ( ! input ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( validity ) {\n\t\t\tconst customValidityResult = validity?.custom;\n\t\t\tsetCustomValidity( customValidityResult );\n\n\t\t\t// Set custom validity on hidden input for HTML5 form validation.\n\t\t\tif ( customValidityResult?.type === 'invalid' ) {\n\t\t\t\tinput.setCustomValidity(\n\t\t\t\t\tcustomValidityResult.message || __( 'Invalid' )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinput.setCustomValidity( '' ); // Clear validity.\n\t\t\t}\n\t\t} else {\n\t\t\t// Clear any previous validation.\n\t\t\tinput.setCustomValidity( '' );\n\t\t\tsetCustomValidity( undefined );\n\t\t}\n\t}, [ isTouched, field.isValid, validity ] );\n\n\tuseEffect( () => {\n\t\tif ( isTouched && customValidity?.message ) {\n\t\t\tspeak( customValidity.message );\n\t\t}\n\t}, [ isTouched, customValidity?.message ] );\n\n\tconst onBlur = useCallback(\n\t\t( event: React.FocusEvent< HTMLElement > ) => {\n\t\t\tif ( isTouched ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\t! event.relatedTarget ||\n\t\t\t\t! event.currentTarget.contains( event.relatedTarget )\n\t\t\t) {\n\t\t\t\tsetIsTouched( true );\n\t\t\t}\n\t\t},\n\t\t[ isTouched ]\n\t);\n\tif ( ! canUpload ) {\n\t\treturn (\n\t\t\t<fieldset className=\"fields__media-edit\" data-field-id={ field.id }>\n\t\t\t\t<WCText>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: The field label. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'%s: To edit this field, you need permission to upload media.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfield.label\n\t\t\t\t\t) }\n\t\t\t\t</WCText>\n\t\t\t</fieldset>\n\t\t);\n\t}\n\treturn (\n\t\t<Stack direction=\"column\" gap=\"sm\" onBlur={ onBlur }>\n\t\t\t<fieldset className=\"fields__media-edit\" data-field-id={ field.id }>\n\t\t\t\t<MediaUploadComponent\n\t\t\t\t\ttitle={ pickerTitle ?? field.label }\n\t\t\t\t\tfeaturedImageFlow={ featuredImageFlow }\n\t\t\t\t\t// The deprecated name is passed too, because the callbacks on\n\t\t\t\t\t// `editor.MediaUpload` read it from the props and would\n\t\t\t\t\t// otherwise stop recognizing the featured image. It will be\n\t\t\t\t\t// removed in the near future, and passing both raises no\n\t\t\t\t\t// warning.\n\t\t\t\t\tunstableFeaturedImageFlow={ featuredImageFlow }\n\t\t\t\t\tonSelect={ ( selectedMedia: any ) => {\n\t\t\t\t\t\tif ( ! multiple ) {\n\t\t\t\t\t\t\tonChangeControl( selectedMedia.id );\n\t\t\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst newIds = Array.isArray( selectedMedia )\n\t\t\t\t\t\t\t? selectedMedia.map( ( m: any ) => m.id )\n\t\t\t\t\t\t\t: [ selectedMedia.id ];\n\t\t\t\t\t\tconst currentValue = normalizeValue( value );\n\t\t\t\t\t\tif ( ! currentValue.length ) {\n\t\t\t\t\t\t\tonChangeControl( newIds );\n\t\t\t\t\t\t} else if ( targetItemId === undefined ) {\n\t\t\t\t\t\t\t// Placeholder clicked: keep existing items that are\n\t\t\t\t\t\t\t// still selected, then append newly selected items.\n\t\t\t\t\t\t\tconst existingItems = currentValue.filter( ( id ) =>\n\t\t\t\t\t\t\t\tnewIds.includes( id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst newItems = newIds.filter(\n\t\t\t\t\t\t\t\t( id ) => ! currentValue.includes( id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChangeControl( [\n\t\t\t\t\t\t\t\t...existingItems,\n\t\t\t\t\t\t\t\t...newItems,\n\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t} else if ( selectedMedia.id !== targetItemId ) {\n\t\t\t\t\t\t\t// Remove selected item from its old position, if it\n\t\t\t\t\t\t\t// already exists in the value.\n\t\t\t\t\t\t\tconst filtered = currentValue.filter(\n\t\t\t\t\t\t\t\t( id ) => id !== selectedMedia.id\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// Replace the clicked item with the selected one.\n\t\t\t\t\t\t\tonChangeControl(\n\t\t\t\t\t\t\t\tfiltered.map( ( id ) =>\n\t\t\t\t\t\t\t\t\tid === targetItemId ? selectedMedia.id : id\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetTargetItemId( undefined );\n\t\t\t\t\t} }\n\t\t\t\t\tonClose={ () => setTargetItemId( undefined ) }\n\t\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\t\t// When replacing an existing item, pass only that item's ID\n\t\t\t\t\t// and open in single-select mode so the user picks exactly\n\t\t\t\t\t// one replacement, even if `multiple` is true.\n\t\t\t\t\tvalue={ targetItemId !== undefined ? targetItemId : value }\n\t\t\t\t\t// Pickers on `editor.MediaUpload` take the block-editor\n\t\t\t\t\t// `MediaUpload` value, `'add'` to keep the current selection\n\t\t\t\t\t// or `false`, so the control speaks that API.\n\t\t\t\t\tmultiple={\n\t\t\t\t\t\tmultiple && targetItemId === undefined ? 'add' : false\n\t\t\t\t\t}\n\t\t\t\t\trender={ ( { open }: any ) => {\n\t\t\t\t\t\t// Keep a ref to the latest `open` so the deferred effect can call it.\n\t\t\t\t\t\topenModalRef.current = open;\n\t\t\t\t\t\tconst AttachmentsComponent = isExpanded\n\t\t\t\t\t\t\t? ExpandedMediaEditAttachments\n\t\t\t\t\t\t\t: CompactMediaEditAttachments;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t\t\t\t{ field.label &&\n\t\t\t\t\t\t\t\t\t( hideLabelFromVision ? (\n\t\t\t\t\t\t\t\t\t\t<VisuallyHidden render={ <legend /> }>\n\t\t\t\t\t\t\t\t\t\t\t{ field.label }\n\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<BaseControl.VisualLabel\n\t\t\t\t\t\t\t\t\t\t\tas=\"legend\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={ { marginBottom: 0 } }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ field.label }\n\t\t\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t<AttachmentsComponent\n\t\t\t\t\t\t\t\t\tallItems={ allItems }\n\t\t\t\t\t\t\t\t\taddButtonLabel={ addButtonLabel }\n\t\t\t\t\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\t\t\t\t\tremoveItem={ removeItem }\n\t\t\t\t\t\t\t\t\tmoveItem={ moveItem }\n\t\t\t\t\t\t\t\t\topen={ () => setPendingOpen( true ) }\n\t\t\t\t\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\t\t\t\t\tisUploading={ !! blobs.length }\n\t\t\t\t\t\t\t\t\tsetTargetItemId={ setTargetItemId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ field.description && (\n\t\t\t\t\t\t\t\t\t<WCText\n\t\t\t\t\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"fields__media-edit-description\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ field.description }\n\t\t\t\t\t\t\t\t\t</WCText>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</fieldset>\n\t\t\t{ /* Visually hidden text input for validation. */ }\n\t\t\t<VisuallyHidden>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tref={ validityTargetRef }\n\t\t\t\t\tvalue={ value ?? '' }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tonChange={ () => {} }\n\t\t\t\t/>\n\t\t\t</VisuallyHidden>\n\t\t\t{ customValidity && (\n\t\t\t\t<ValidityIndicator\n\t\t\t\t\ttype={ customValidity.type }\n\t\t\t\t\tmessage={ customValidity.message }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,EAAE,sBAAA,GAAqBA,qBAAAA,OAAAA,CAAQC,uBAAAA,WAAsB;AAE3D,SAAS,kBAAmB,EAC3B,UACA,OACA,UACA,aAMG;CACH,MAAM,OAAA,GAAMC,0BAAAA,QAAAA,CAAoB,OAAO,QAAS;CAChD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAW;EAAkB;EAC1B;CACE,CAAA;AAEP;AASA,SAAS,eAAgB,OAAiD;CACzE,IAAK,MAAM,QAAS,KAAM,GACzB,OAAO;CAER,OAAO,QAAQ,CAAE,KAAM,IAAI,CAAC;AAC7B;;;;;;;;;;;AAYA,SAAS,uBAAwB,EAAE,QAAQ,UAAU,GAAG,SAAe;CACtE,MAAM,CAAE,aAAa,mBAAA,GAAmBC,mBAAAA,SAAAA,CAAU,KAAM;CACxD,IAAO,OAAgB,mCACtB,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,UAAU,OAAQ,EAAE,YAAY,eAAgB,IAAK,EAAE,CAAE,GACzD,eACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;EACC,GAAK;EAEL,UAAW,CAAC,CAAE;EACd,QAAS;EACT,eAAgB;GACf,eAAgB,KAAM;GACtB,MAAM,UAAU;EACjB;EACA,WAAa,UAAgB;GAC5B,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