@wordpress/block-library 10.0.1-next.v.202606191442.0 → 10.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/build/audio/edit.cjs +8 -1
  3. package/build/audio/edit.cjs.map +2 -2
  4. package/build/breadcrumbs/edit.cjs +0 -1
  5. package/build/breadcrumbs/edit.cjs.map +2 -2
  6. package/build/button/edit.cjs +0 -1
  7. package/build/button/edit.cjs.map +2 -2
  8. package/build/cover/edit/embed-video-url-input.cjs +0 -1
  9. package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
  10. package/build/details/edit.cjs +0 -1
  11. package/build/details/edit.cjs.map +2 -2
  12. package/build/form/edit.cjs +0 -2
  13. package/build/form/edit.cjs.map +2 -2
  14. package/build/form-input/edit.cjs +0 -2
  15. package/build/form-input/edit.cjs.map +2 -2
  16. package/build/freeform/edit.cjs +5 -14
  17. package/build/freeform/edit.cjs.map +3 -3
  18. package/build/freeform/migration-notice.cjs.map +2 -2
  19. package/build/home-link/edit.cjs +0 -1
  20. package/build/home-link/edit.cjs.map +2 -2
  21. package/build/html/modal.cjs +6 -3
  22. package/build/html/modal.cjs.map +2 -2
  23. package/build/icon/edit.cjs +2 -4
  24. package/build/icon/edit.cjs.map +2 -2
  25. package/build/image/image.cjs +0 -2
  26. package/build/image/image.cjs.map +2 -2
  27. package/build/image/use-open-image-media-editor-modal.cjs +5 -25
  28. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  29. package/build/list/ordered-list-settings.cjs +0 -1
  30. package/build/list/ordered-list-settings.cjs.map +2 -2
  31. package/build/navigation/edit/index.cjs +9 -9
  32. package/build/navigation/edit/index.cjs.map +2 -2
  33. package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
  34. package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
  35. package/build/navigation-link/block.json +1 -1
  36. package/build/navigation-link/link-ui/page-creator.cjs +0 -1
  37. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  38. package/build/navigation-link/shared/controls.cjs +0 -2
  39. package/build/navigation-link/shared/controls.cjs.map +2 -2
  40. package/build/playlist-track/edit.cjs +0 -3
  41. package/build/playlist-track/edit.cjs.map +2 -2
  42. package/build/post-comment/edit.cjs +0 -1
  43. package/build/post-comment/edit.cjs.map +2 -2
  44. package/build/post-featured-image/edit.cjs +0 -1
  45. package/build/post-featured-image/edit.cjs.map +2 -2
  46. package/build/post-terms/edit.cjs +0 -1
  47. package/build/post-terms/edit.cjs.map +2 -2
  48. package/build/post-title/edit.cjs +0 -1
  49. package/build/post-title/edit.cjs.map +2 -2
  50. package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
  51. package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
  52. package/build/query/edit/inspector-controls/index.cjs +0 -1
  53. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  54. package/build/rss/edit.cjs +0 -1
  55. package/build/rss/edit.cjs.map +2 -2
  56. package/build/search/block.json +4 -0
  57. package/build/search/edit.cjs +242 -204
  58. package/build/search/edit.cjs.map +2 -2
  59. package/build/site-logo/edit.cjs +2 -1
  60. package/build/site-logo/edit.cjs.map +2 -2
  61. package/build/social-link/edit.cjs +0 -3
  62. package/build/social-link/edit.cjs.map +2 -2
  63. package/build/tab-list/block.json +2 -2
  64. package/build/tab-list/edit.cjs +14 -8
  65. package/build/tab-list/edit.cjs.map +2 -2
  66. package/build/tab-list/init.cjs +28 -0
  67. package/build/tab-list/init.cjs.map +7 -0
  68. package/build/tab-panel/edit.cjs +0 -9
  69. package/build/tab-panel/edit.cjs.map +2 -2
  70. package/build/tab-panel/save.cjs +2 -1
  71. package/build/tab-panel/save.cjs.map +2 -2
  72. package/build/tab-panels/block.json +0 -1
  73. package/build/tab-panels/init.cjs +28 -0
  74. package/build/tab-panels/init.cjs.map +7 -0
  75. package/build/table/edit.cjs +0 -2
  76. package/build/table/edit.cjs.map +2 -2
  77. package/build/tabs/view.cjs +20 -94
  78. package/build/tabs/view.cjs.map +2 -2
  79. package/build/template-part/edit/advanced-controls.cjs +0 -1
  80. package/build/template-part/edit/advanced-controls.cjs.map +2 -2
  81. package/build/template-part/edit/title-modal.cjs +1 -2
  82. package/build/template-part/edit/title-modal.cjs.map +2 -2
  83. package/build/video/edit.cjs +3 -2
  84. package/build/video/edit.cjs.map +2 -2
  85. package/build/video/tracks-editor.cjs +0 -2
  86. package/build/video/tracks-editor.cjs.map +2 -2
  87. package/build-module/audio/edit.mjs +8 -2
  88. package/build-module/audio/edit.mjs.map +2 -2
  89. package/build-module/breadcrumbs/edit.mjs +0 -1
  90. package/build-module/breadcrumbs/edit.mjs.map +2 -2
  91. package/build-module/button/edit.mjs +0 -1
  92. package/build-module/button/edit.mjs.map +2 -2
  93. package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
  94. package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
  95. package/build-module/details/edit.mjs +0 -1
  96. package/build-module/details/edit.mjs.map +2 -2
  97. package/build-module/form/edit.mjs +0 -2
  98. package/build-module/form/edit.mjs.map +2 -2
  99. package/build-module/form-input/edit.mjs +0 -2
  100. package/build-module/form-input/edit.mjs.map +2 -2
  101. package/build-module/freeform/edit.mjs +5 -14
  102. package/build-module/freeform/edit.mjs.map +2 -2
  103. package/build-module/freeform/migration-notice.mjs.map +2 -2
  104. package/build-module/home-link/edit.mjs +0 -1
  105. package/build-module/home-link/edit.mjs.map +2 -2
  106. package/build-module/html/modal.mjs +6 -3
  107. package/build-module/html/modal.mjs.map +2 -2
  108. package/build-module/icon/edit.mjs +2 -4
  109. package/build-module/icon/edit.mjs.map +2 -2
  110. package/build-module/image/image.mjs +0 -2
  111. package/build-module/image/image.mjs.map +2 -2
  112. package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
  113. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  114. package/build-module/list/ordered-list-settings.mjs +0 -1
  115. package/build-module/list/ordered-list-settings.mjs.map +2 -2
  116. package/build-module/navigation/edit/index.mjs +9 -9
  117. package/build-module/navigation/edit/index.mjs.map +2 -2
  118. package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
  119. package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
  120. package/build-module/navigation-link/block.json +1 -1
  121. package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
  122. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  123. package/build-module/navigation-link/shared/controls.mjs +0 -2
  124. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  125. package/build-module/playlist-track/edit.mjs +0 -3
  126. package/build-module/playlist-track/edit.mjs.map +2 -2
  127. package/build-module/post-comment/edit.mjs +0 -1
  128. package/build-module/post-comment/edit.mjs.map +2 -2
  129. package/build-module/post-featured-image/edit.mjs +0 -1
  130. package/build-module/post-featured-image/edit.mjs.map +2 -2
  131. package/build-module/post-terms/edit.mjs +0 -1
  132. package/build-module/post-terms/edit.mjs.map +2 -2
  133. package/build-module/post-title/edit.mjs +0 -1
  134. package/build-module/post-title/edit.mjs.map +2 -2
  135. package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
  136. package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
  137. package/build-module/query/edit/inspector-controls/index.mjs +0 -1
  138. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  139. package/build-module/rss/edit.mjs +0 -1
  140. package/build-module/rss/edit.mjs.map +2 -2
  141. package/build-module/search/block.json +4 -0
  142. package/build-module/search/edit.mjs +242 -204
  143. package/build-module/search/edit.mjs.map +2 -2
  144. package/build-module/site-logo/edit.mjs +2 -1
  145. package/build-module/site-logo/edit.mjs.map +2 -2
  146. package/build-module/social-link/edit.mjs +0 -3
  147. package/build-module/social-link/edit.mjs.map +2 -2
  148. package/build-module/tab-list/block.json +2 -2
  149. package/build-module/tab-list/edit.mjs +15 -9
  150. package/build-module/tab-list/edit.mjs.map +2 -2
  151. package/build-module/tab-list/init.mjs +7 -0
  152. package/build-module/tab-list/init.mjs.map +7 -0
  153. package/build-module/tab-panel/edit.mjs +1 -10
  154. package/build-module/tab-panel/edit.mjs.map +2 -2
  155. package/build-module/tab-panel/save.mjs +2 -1
  156. package/build-module/tab-panel/save.mjs.map +2 -2
  157. package/build-module/tab-panels/block.json +0 -1
  158. package/build-module/tab-panels/init.mjs +7 -0
  159. package/build-module/tab-panels/init.mjs.map +7 -0
  160. package/build-module/table/edit.mjs +0 -2
  161. package/build-module/table/edit.mjs.map +2 -2
  162. package/build-module/tabs/view.mjs +20 -94
  163. package/build-module/tabs/view.mjs.map +2 -2
  164. package/build-module/template-part/edit/advanced-controls.mjs +0 -1
  165. package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
  166. package/build-module/template-part/edit/title-modal.mjs +1 -2
  167. package/build-module/template-part/edit/title-modal.mjs.map +2 -2
  168. package/build-module/video/edit.mjs +3 -3
  169. package/build-module/video/edit.mjs.map +2 -2
  170. package/build-module/video/tracks-editor.mjs +0 -2
  171. package/build-module/video/tracks-editor.mjs.map +2 -2
  172. package/build-style/editor-rtl.css +0 -15
  173. package/build-style/editor.css +0 -15
  174. package/build-style/style-rtl.css +1 -1
  175. package/build-style/style.css +1 -1
  176. package/build-style/tab-list/style-rtl.css +1 -1
  177. package/build-style/tab-list/style.css +1 -1
  178. package/package.json +40 -40
  179. package/src/audio/edit.js +5 -9
  180. package/src/breadcrumbs/edit.js +0 -1
  181. package/src/button/edit.js +0 -1
  182. package/src/cover/edit/embed-video-url-input.js +0 -1
  183. package/src/cover/test/edit.js +51 -2
  184. package/src/details/edit.js +0 -1
  185. package/src/editor.scss +0 -1
  186. package/src/form/edit.js +0 -2
  187. package/src/form-input/edit.js +0 -2
  188. package/src/freeform/edit.js +6 -29
  189. package/src/freeform/migration-notice.js +2 -4
  190. package/src/home-link/edit.js +0 -1
  191. package/src/html/modal.js +3 -0
  192. package/src/icon/edit.js +0 -2
  193. package/src/image/image.js +0 -2
  194. package/src/image/test/use-open-image-media-editor-modal.js +20 -26
  195. package/src/image/use-open-image-media-editor-modal.js +24 -42
  196. package/src/list/ordered-list-settings.js +0 -1
  197. package/src/navigation/edit/index.js +9 -13
  198. package/src/navigation/edit/navigation-menu-name-control.js +0 -1
  199. package/src/navigation-link/README.md +1 -1
  200. package/src/navigation-link/block.json +1 -1
  201. package/src/navigation-link/link-ui/page-creator.js +0 -1
  202. package/src/navigation-link/shared/controls.js +0 -2
  203. package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
  204. package/src/playlist-track/edit.js +0 -3
  205. package/src/post-comment/edit.js +0 -1
  206. package/src/post-featured-image/edit.js +0 -1
  207. package/src/post-terms/edit.js +0 -1
  208. package/src/post-title/edit.js +0 -1
  209. package/src/query/edit/enhanced-pagination-modal.js +11 -1
  210. package/src/query/edit/inspector-controls/index.js +0 -1
  211. package/src/rss/edit.js +0 -1
  212. package/src/search/README.md +1 -0
  213. package/src/search/block.json +4 -0
  214. package/src/search/edit.js +106 -55
  215. package/src/search/index.php +25 -1
  216. package/src/site-logo/edit.js +3 -1
  217. package/src/social-link/edit.js +0 -3
  218. package/src/tab-list/README.md +1 -1
  219. package/src/tab-list/block.json +2 -2
  220. package/src/tab-list/edit.js +14 -8
  221. package/src/tab-list/index.php +4 -6
  222. package/src/tab-list/init.js +6 -0
  223. package/src/tab-list/style.scss +1 -2
  224. package/src/tab-panel/edit.js +1 -14
  225. package/src/tab-panel/index.php +2 -25
  226. package/src/tab-panel/save.js +1 -0
  227. package/src/tab-panels/block.json +0 -1
  228. package/src/tab-panels/init.js +6 -0
  229. package/src/table/edit.js +0 -2
  230. package/src/tabs/index.php +12 -19
  231. package/src/tabs/view.js +20 -100
  232. package/src/template-part/edit/advanced-controls.js +0 -1
  233. package/src/template-part/edit/title-modal.js +0 -1
  234. package/src/utils/test/style-state.js +26 -26
  235. package/src/video/edit.js +9 -16
  236. package/src/video/tracks-editor.js +0 -2
  237. package/build/freeform/convert-to-blocks-button.cjs +0 -40
  238. package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
  239. package/build/list-item/utils.cjs +0 -57
  240. package/build/list-item/utils.cjs.map +0 -7
  241. package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
  242. package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
  243. package/build-module/list-item/utils.mjs +0 -32
  244. package/build-module/list-item/utils.mjs.map +0 -7
  245. package/build-style/tab-list/editor-rtl.css +0 -14
  246. package/build-style/tab-list/editor.css +0 -14
  247. package/src/freeform/convert-to-blocks-button.js +0 -18
  248. package/src/list-item/utils.js +0 -34
  249. package/src/tab-list/editor.scss +0 -17
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/image/image.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tFocalPointPicker,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tTextControl,\n\tCheckboxControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\tPlaceholder,\n\tMenuItem,\n\tToolbarItem,\n\tDropdownMenu,\n\tPopover,\n} from '@wordpress/components';\nimport {\n\tuseMergeRefs,\n\tuseResizeObserver,\n\tuseViewportMatch,\n} from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSettings,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockSettingsMenuControls,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport { getBlockBindingsSource, switchToBlockType } from '@wordpress/blocks';\nimport { crop, overlayText, upload, chevronDown } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport { isExternalImage } from './edit';\nimport { Caption } from '../utils/caption';\nimport { MediaControl } from '../utils/media-control';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport {\n\tgetActiveDimensionValue,\n\tgetDimensionResetAttributes,\n\tgetDimensionUpdateAttributes,\n\tgetStyleStateKey,\n} from '../utils/style-state';\nimport { useOpenImageMediaEditorModal } from './use-open-image-media-editor-modal';\nimport {\n\tMIN_SIZE,\n\tALLOWED_MEDIA_TYPES,\n\tSIZED_LAYOUTS,\n\tDEFAULT_MEDIA_SIZE_SLUG,\n} from './constants';\nimport { evalAspectRatio, mediaPosition } from './utils';\n\nconst {\n\tDimensionsTool,\n\tisDefaultBlockStyleState,\n\tResolutionTool,\n\tmediaEditKey,\n} = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nconst WRITEMODE_POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\n// If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles.\nconst ImageWrapper = ( { href, children } ) => {\n\tif ( ! href ) {\n\t\treturn children;\n\t}\n\treturn (\n\t\t<a\n\t\t\thref={ href }\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\taria-disabled\n\t\t\tstyle={ {\n\t\t\t\t// When the Image block is linked,\n\t\t\t\t// it's wrapped with a disabled <a /> tag.\n\t\t\t\t// Restore cursor style so it doesn't appear 'clickable'\n\t\t\t\t// and remove pointer events. Safari needs the display property.\n\t\t\t\tpointerEvents: 'none',\n\t\t\t\tcursor: 'default',\n\t\t\t\tdisplay: 'inline',\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</a>\n\t);\n};\n\nfunction ContentOnlyControls( {\n\tattributes,\n\tsetAttributes,\n\tlockAltControls,\n\tlockAltControlsMessage,\n\tlockTitleControls,\n\tlockTitleControlsMessage,\n} ) {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst [ isAltDialogOpen, setIsAltDialogOpen ] = useState( false );\n\tconst [ isTitleDialogOpen, setIsTitleDialogOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarItem ref={ setPopoverAnchor }>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'More' ) }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t\tdescription: __( 'Displays more controls.' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ WRITEMODE_POPOVER_PROPS }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsAltDialogOpen( true );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ _x(\n\t\t\t\t\t\t\t\t\t\t'Alternative text',\n\t\t\t\t\t\t\t\t\t\t'Alternative text for an image. Block toolbar label, a low character count is preferred.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTitleDialogOpen( true );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Title text' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t\t{ isAltDialogOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonClose={ () => setIsAltDialogOpen( false ) }\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-image__toolbar_content_textarea__container\">\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\tclassName=\"wp-block-image__toolbar_content_textarea\"\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tvalue={ attributes.alt || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisabled={ lockAltControls }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tlockAltControls ? (\n\t\t\t\t\t\t\t\t\t<>{ lockAltControlsMessage }</>\n\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\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\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\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\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</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t\t{ isTitleDialogOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonClose={ () => setIsTitleDialogOpen( false ) }\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-image__toolbar_content_textarea__container\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"wp-block-image__toolbar_content_textarea\"\n\t\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\t\tvalue={ attributes.title || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ttitle: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisabled={ lockTitleControls }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tlockTitleControls ? (\n\t\t\t\t\t\t\t\t\t<>{ lockTitleControlsMessage }</>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\tcreateInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'Describe the role of this image on the page. <a>(Note: many devices and browsers do not display this text.)</a>'\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\" />\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)\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</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function Image( {\n\ttemporaryURL,\n\tisSideloading,\n\tattributes,\n\tsetAttributes,\n\tisSingleSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n\tparentLayoutType,\n\tmaxContentWidth,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tfocalPoint,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t\tmetadata,\n\t\tisDecorative,\n\t} = attributes;\n\tconst [ imageElement, setImageElement ] = useState();\n\tconst [ resizeDelta, setResizeDelta ] = useState( null );\n\tconst [ pixelSize, setPixelSize ] = useState( {} );\n\tconst [ offsetTop, setOffsetTop ] = useState( 0 );\n\tconst setResizeObserved = useResizeObserver( ( [ entry ] ) => {\n\t\tif ( ! resizeDelta ) {\n\t\t\tconst [ box ] = entry.borderBoxSize;\n\t\t\tsetPixelSize( { width: box.inlineSize, height: box.blockSize } );\n\t\t}\n\t\t// This is usually 0 unless the image height is less than the line-height.\n\t\tsetOffsetTop( entry.target.offsetTop );\n\t} );\n\tconst effectResizeableBoxPlacement = useCallback( () => {\n\t\tsetOffsetTop( imageElement?.offsetTop ?? 0 );\n\t}, [ imageElement ] );\n\tconst setRefs = useMergeRefs( [ setImageElement, setResizeObserved ] );\n\tconst { allowResize = true } = context;\n\n\tconst { image, attachmentResolutionError } = useSelect(\n\t\t( select ) => {\n\t\t\tconst imageRecord =\n\t\t\t\tid && isSingleSelected\n\t\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t\t )\n\t\t\t\t\t: null;\n\n\t\t\t// Check if the attachment resolution failed with a specific error.\n\t\t\t// We use getResolutionError instead of hasFinishedResolution so we\n\t\t\t// can distinguish 404 (attachment doesn't exist) from transient\n\t\t\t// errors (500, 403, network) that shouldn't clear the id.\n\t\t\tconst resolutionError =\n\t\t\t\tid && isSingleSelected\n\t\t\t\t\t? select( coreStore ).getResolutionError(\n\t\t\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t{ context: 'view' },\n\t\t\t\t\t\t\t]\n\t\t\t\t\t )\n\t\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\timage: imageRecord,\n\t\t\t\tattachmentResolutionError: resolutionError,\n\t\t\t};\n\t\t},\n\t\t[ id, isSingleSelected ]\n\t);\n\n\tconst {\n\t\tcanInsertCover,\n\t\timageEditing,\n\t\timageSizes,\n\t\tmaxWidth,\n\t\teditMediaEntity,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst settings = getSettings();\n\n\t\t\treturn {\n\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\teditMediaEntity: settings?.[ mediaEditKey ],\n\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { getBlock, getSettings } = useSelect( blockEditorStore );\n\tconst cropButtonRef = useRef();\n\tconst handleMediaEditorModalClose = useCallback(\n\t\t() => cropButtonRef.current?.focus(),\n\t\t[]\n\t);\n\tconst openImageMediaEditorModal = useOpenImageMediaEditorModal( {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tonClose: handleMediaEditorModalClose,\n\t} );\n\n\tconst {\n\t\treplaceBlocks,\n\t\ttoggleSelection,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst [ hasImageErrored, setHasImageErrored ] = useState( false );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isContentOnlyMode = blockEditingMode === 'contentOnly';\n\tconst showDimensionsControls = allowResize && hasNonContentControls;\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! isWideAligned &&\n\t\tisLargeViewport;\n\t// An image is uploading if it has a temporary blob URL, or if it is\n\t// being processed client-side (e.g. transcoded or generating sub-sizes).\n\tconst isUploading = !! temporaryURL || isSideloading;\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\t// If the image has an id but the attachment doesn't exist on this site,\n\t// clear the id so Gutenberg treats the image as external.\n\t// This handles content copied between WordPress sites.\n\t//\n\t// Known limitation: if a different attachment with the same id happens to\n\t// exist on the destination site, the lookup will succeed and the wrong\n\t// local image will be used. URL matching could address this in a follow-up.\n\t// See: https://github.com/WordPress/gutenberg/issues/74156\n\tuseEffect( () => {\n\t\tif ( ! id || ! isSingleSelected ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only clear for confirmed 404s. apiFetch throws the Response object\n\t\t// for HTTP errors, so checking .status === 404 avoids incorrectly\n\t\t// clearing the id on 403, 500, or network failures, which would\n\t\t// cause data loss for valid local attachments.\n\t\tif ( attachmentResolutionError?.status === 404 ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { id: undefined } );\n\t\t}\n\t}, [\n\t\tid,\n\t\tisSingleSelected,\n\t\tattachmentResolutionError,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSingleSelected ||\n\t\t\t! getSettings().mediaUpload\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSingleSelected, externalBlob, getSettings ] );\n\n\t// Get naturalWidth and naturalHeight from image, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageElement?.naturalWidth || loadedNaturalWidth || undefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageElement?.naturalHeight || loadedNaturalHeight || undefined,\n\t\t};\n\t}, [ loadedNaturalWidth, loadedNaturalHeight, imageElement?.complete ] );\n\n\tfunction onImageError() {\n\t\tsetHasImageErrored( true );\n\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onImageLoad( event ) {\n\t\tsetHasImageErrored( false );\n\t\tsetLoadedNaturalSize( {\n\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t} );\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetLightbox( enable ) {\n\t\tif ( enable && ! lightboxSetting?.enabled ) {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: { enabled: true },\n\t\t\t\tisDecorative: false,\n\t\t\t} );\n\t\t} else if ( ! enable && lightboxSetting?.enabled ) {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: { enabled: false },\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction resetLightbox() {\n\t\t// When deleting a link from an image while lightbox settings\n\t\t// are enabled by default, we should disable the lightbox,\n\t\t// otherwise the resulting UX looks like a mistake.\n\t\t// See https://github.com/WordPress/gutenberg/pull/59890/files#r1532286123.\n\t\tif ( lightboxSetting?.enabled && lightboxSetting?.allowEditing ) {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: { enabled: false },\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateIsDecorative( value ) {\n\t\tsetAttributes( {\n\t\t\tisDecorative: value || undefined,\n\t\t\t...( value && {\n\t\t\t\talt: '',\n\t\t\t\tcaption: undefined,\n\t\t\t\thref: undefined,\n\t\t\t\tlinkDestination: undefined,\n\t\t\t\tlinkTarget: undefined,\n\t\t\t\trel: undefined,\n\t\t\t} ),\n\t\t} );\n\t}\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tif ( imageElement ) {\n\t\t\timageElement.style.setProperty(\n\t\t\t\t'object-position',\n\t\t\t\tmediaPosition( value )\n\t\t\t);\n\t\t}\n\t};\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tconst { mediaUpload } = getSettings();\n\t\tif ( ! mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\t\tlet notified = false;\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// With client-side media processing, onFileChange fires\n\t\t\t\t// for each generated sub-size. Only show the notice once.\n\t\t\t\tif ( ! notified ) {\n\t\t\t\t\tnotified = true;\n\t\t\t\t\tsetExternalBlob();\n\t\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t}, [ isSingleSelected ] );\n\n\tconst canEditImage =\n\t\tid &&\n\t\tnaturalWidth &&\n\t\tnaturalHeight &&\n\t\timageEditing &&\n\t\t!! editMediaEntity;\n\tconst allowCrop =\n\t\tisSingleSelected &&\n\t\tcanEditImage &&\n\t\t! isEditingImage &&\n\t\t! isContentOnlyMode &&\n\t\t! isUploading;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst [ lightboxSetting ] = useSettings( 'lightbox' );\n\n\tconst showLightboxSetting =\n\t\t// If a block-level override is set, we should give users the option to\n\t\t// remove that override, even if the lightbox UI is disabled in the settings.\n\t\t( !! lightbox && lightbox?.enabled !== lightboxSetting?.enabled ) ||\n\t\tlightboxSetting?.allowEditing;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst selectedStyleState = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst { getSelectedBlockStyleState } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn getSelectedBlockStyleState( clientId );\n\t\t},\n\t\t[ clientId, isSingleSelected ]\n\t);\n\tconst hasSelectedStyleState =\n\t\t! isDefaultBlockStyleState( selectedStyleState );\n\tconst selectedStyleStateKey = getStyleStateKey( selectedStyleState );\n\tconst activeWidth = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'width',\n\t} );\n\tconst activeHeight = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'height',\n\t} );\n\tconst activeAspectRatio = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'aspectRatio',\n\t} );\n\tconst activeScale = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'scale',\n\t\tstyleKey: 'objectFit',\n\t} );\n\tconst setDimensionAttributes = ( nextDimensions ) => {\n\t\tsetAttributes(\n\t\t\tgetDimensionUpdateAttributes( {\n\t\t\t\tstyle: attributes.style,\n\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\thasSelectedStyleState,\n\t\t\t\tnextDimensions,\n\t\t\t\tdimensionKeyMap: { scale: 'objectFit' },\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst dimensionsControl =\n\t\tshowDimensionsControls &&\n\t\t( SIZED_LAYOUTS.includes( parentLayoutType ) ? (\n\t\t\t<DimensionsTool\n\t\t\t\tkey={ selectedStyleStateKey }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tvalue={ { aspectRatio: activeAspectRatio, scale: activeScale } }\n\t\t\t\tonChange={ ( { aspectRatio: newAspectRatio } ) => {\n\t\t\t\t\tsetDimensionAttributes( {\n\t\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t\t\tscale: 'cover',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\t\ttools={ [ 'aspectRatio' ] }\n\t\t\t/>\n\t\t) : (\n\t\t\t<DimensionsTool\n\t\t\t\tkey={ selectedStyleStateKey }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tvalue={ {\n\t\t\t\t\twidth: activeWidth,\n\t\t\t\t\theight: activeHeight,\n\t\t\t\t\tscale: activeScale,\n\t\t\t\t\taspectRatio: activeAspectRatio,\n\t\t\t\t} }\n\t\t\t\tonChange={ ( {\n\t\t\t\t\twidth: newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} ) => {\n\t\t\t\t\tsetDimensionAttributes( {\n\t\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\t\theight: newHeight,\n\t\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t\t\tscale: newScale,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdefaultScale=\"cover\"\n\t\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\t\tscaleOptions={ scaleOptions }\n\t\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t\t\ttools={\n\t\t\t\t\tisWideAligned\n\t\t\t\t\t\t? [ 'aspectRatio', 'scale' ]\n\t\t\t\t\t\t: [ 'aspectRatio', 'widthHeight', 'scale' ]\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\n\tconst resetSettings = () => {\n\t\tsetAttributes( {\n\t\t\tlightbox: undefined,\n\t\t} );\n\t\tupdateImage( DEFAULT_MEDIA_SIZE_SLUG );\n\t};\n\n\tconst arePatternOverridesEnabled =\n\t\tmetadata?.bindings?.__default?.source === 'core/pattern-overrides';\n\n\tconst {\n\t\tlockUrlControls = false,\n\t\tlockHrefControls = false,\n\t\tlockAltControls = false,\n\t\tlockAltControlsMessage,\n\t\tlockTitleControls = false,\n\t\tlockTitleControlsMessage,\n\t\thideCaptionControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst {\n\t\t\t\turl: urlBinding,\n\t\t\t\talt: altBinding,\n\t\t\t\ttitle: titleBinding,\n\t\t\t\tcaption: captionBinding,\n\t\t\t} = metadata?.bindings || {};\n\t\t\tconst hasParentPattern = !! context[ 'pattern/overrides' ];\n\t\t\tconst urlBindingSource = getBlockBindingsSource(\n\t\t\t\turlBinding?.source\n\t\t\t);\n\t\t\tconst altBindingSource = getBlockBindingsSource(\n\t\t\t\taltBinding?.source\n\t\t\t);\n\t\t\tconst titleBindingSource = getBlockBindingsSource(\n\t\t\t\ttitleBinding?.source\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! urlBinding &&\n\t\t\t\t\t! urlBindingSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: urlBinding?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockHrefControls:\n\t\t\t\t\t// Disable editing the link of the URL if the image is inside a pattern instance.\n\t\t\t\t\t// This is a temporary solution until we support overriding the link on the frontend.\n\t\t\t\t\thasParentPattern || arePatternOverridesEnabled,\n\t\t\t\thideCaptionControls: !! captionBinding,\n\t\t\t\tlockAltControls:\n\t\t\t\t\t!! altBinding &&\n\t\t\t\t\t! altBindingSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: altBinding?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockAltControlsMessage: altBindingSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\taltBindingSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t\tlockTitleControls:\n\t\t\t\t\t!! titleBinding &&\n\t\t\t\t\t! titleBindingSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: titleBinding?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockTitleControlsMessage: titleBindingSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\ttitleBindingSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tarePatternOverridesEnabled,\n\t\t\tcontext,\n\t\t\tisSingleSelected,\n\t\t\tmetadata?.bindings,\n\t\t]\n\t);\n\n\tconst showUrlInput =\n\t\tisSingleSelected &&\n\t\t! isEditingImage &&\n\t\t! lockHrefControls &&\n\t\t! lockUrlControls &&\n\t\t! isDecorative;\n\n\tconst showCoverControls =\n\t\tisSingleSelected && canInsertCover && ! isContentOnlyMode;\n\n\tconst showBlockControls = showUrlInput || allowCrop || showCoverControls;\n\n\tconst mediaReplaceFlow = isSingleSelected &&\n\t\t! isEditingImage &&\n\t\t! lockUrlControls && (\n\t\t\t// For contentOnly mode, put this button in its own area so it has borders around it.\n\t\t\t<BlockControls group={ isContentOnlyMode ? 'inline' : 'other' }>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tname={ ! url ? __( 'Add image' ) : __( 'Replace' ) }\n\t\t\t\t\tonReset={ () => onSelectImage( undefined ) }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t);\n\n\tconst hasDataFormBlockFields =\n\t\twindow?.__experimentalContentOnlyInspectorFields;\n\n\tconst controls = (\n\t\t<>\n\t\t\t{ showBlockControls && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t{ showUrlInput && (\n\t\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\t\tshowLightboxSetting={ showLightboxSetting }\n\t\t\t\t\t\t\tlightboxEnabled={ lightboxChecked }\n\t\t\t\t\t\t\tonSetLightbox={ onSetLightbox }\n\t\t\t\t\t\t\tresetLightbox={ resetLightbox }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ allowCrop && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tref={ cropButtonRef }\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\topenImageMediaEditorModal\n\t\t\t\t\t\t\t\t\t? openImageMediaEditorModal\n\t\t\t\t\t\t\t\t\t: () => setIsEditingImage( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-haspopup={\n\t\t\t\t\t\t\t\topenImageMediaEditorModal ? 'dialog' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showCoverControls && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isSingleSelected && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload to Media Library' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isContentOnlyMode && (\n\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t// to edit these attributes.\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ContentOnlyControls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tlockAltControls={ lockAltControls }\n\t\t\t\t\t\tlockAltControlsMessage={ lockAltControlsMessage }\n\t\t\t\t\t\tlockTitleControls={ lockTitleControls }\n\t\t\t\t\t\tlockTitleControlsMessage={ lockTitleControlsMessage }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! hasDataFormBlockFields && isSingleSelected && (\n\t\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Media' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tonSelectImage( undefined );\n\t\t\t\t\t\t\tsetAttributes( { isDecorative: false } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! lockUrlControls && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\t\t\t\thasValue={ () => !! url }\n\t\t\t\t\t\t\t\tonDeselect={ () => onSelectImage( undefined ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MediaControl\n\t\t\t\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\t\t\t\tmediaUrl={ url }\n\t\t\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\t\t\tfilename={\n\t\t\t\t\t\t\t\t\t\timage?.media_details?.sizes?.full\n\t\t\t\t\t\t\t\t\t\t\t?.file ||\n\t\t\t\t\t\t\t\t\t\timage?.slug ||\n\t\t\t\t\t\t\t\t\t\tgetFilename( url )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\t\t\t\tonReset={ () => onSelectImage( undefined ) }\n\t\t\t\t\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t\t\t\t\t\temptyLabel={ __( 'Add image' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isDecorative && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt || '' }\n\t\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\t\treadOnly={ lockAltControls }\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\tlockAltControls ? (\n\t\t\t\t\t\t\t\t\t\t\t<>{ lockAltControlsMessage }</>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\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\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\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</ExternalLink>\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/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ ! lockAltControls && ! lightboxChecked && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Mark as decorative' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! isDecorative }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isDecorative: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Mark as decorative' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! isDecorative }\n\t\t\t\t\t\t\t\t\tonChange={ updateIsDecorative }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Hidden from assistive technologies.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tresetAllFilter={ ( attrs ) => {\n\t\t\t\t\treturn getDimensionResetAttributes( {\n\t\t\t\t\t\tattributes: attrs,\n\t\t\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\t\t\thasSelectedStyleState,\n\t\t\t\t\t\tkeys: [ 'aspectRatio', 'height', 'objectFit', 'width' ],\n\t\t\t\t\t\tdefaultAttributes: {\n\t\t\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t\tscale: undefined,\n\t\t\t\t\t\t\tfocalPoint: undefined,\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\t\t{ dimensionsControl }\n\t\t\t\t{ ! hasSelectedStyleState && url && scale && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ resetSettings }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\treadOnly={ lockTitleControls }\n\t\t\t\t\thelp={\n\t\t\t\t\t\tlockTitleControls ? (\n\t\t\t\t\t\t\t<>{ lockTitleControlsMessage }</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tcreateInterpolateElement(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Describe the role of this image on the page. <a>(Note: many devices and browsers do not display this text.)</a>'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\" />\n\t\t\t\t\t\t\t\t\t),\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}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( isDecorative ) {\n\t\tdefaultedAlt = filename\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'This image has been marked as decorative; its file name is %s'\n\t\t\t\t\t),\n\t\t\t\t\tfilename\n\t\t\t )\n\t\t\t: __( 'This image has been marked as decorative.' );\n\t} else if ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tconst { postType, postId, queryId } = context;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\n\tlet img =\n\t\ttemporaryURL && hasImageErrored ? (\n\t\t\t// Show a placeholder during upload when the blob URL can't be loaded. This can\n\t\t\t// happen when the user uploads a HEIC image in a browser that doesn't support them.\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-image__placeholder\"\n\t\t\t\twithIllustration\n\t\t\t>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t) : (\n\t\t\t<>\n\t\t\t\t<img\n\t\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\t\talt={ defaultedAlt }\n\t\t\t\t\tonError={ onImageError }\n\t\t\t\t\tonLoad={ onImageLoad }\n\t\t\t\t\tref={ setRefs }\n\t\t\t\t\tclassName={ borderProps.className }\n\t\t\t\t\twidth={ naturalWidth }\n\t\t\t\t\theight={ naturalHeight }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t\t...( resizeDelta\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\twidth: pixelSize.width + resizeDelta.width,\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tpixelSize.height + resizeDelta.height,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: ( () => {\n\t\t\t\t\t\t\t\t\tconst style = {};\n\t\t\t\t\t\t\t\t\tif ( width === 'auto' ) {\n\t\t\t\t\t\t\t\t\t\tstyle.width = 'auto';\n\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\twidth !== undefined &&\n\t\t\t\t\t\t\t\t\t\twidth !== null\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tstyle.width =\n\t\t\t\t\t\t\t\t\t\t\ttypeof width === 'number'\n\t\t\t\t\t\t\t\t\t\t\t\t? `${ width }px`\n\t\t\t\t\t\t\t\t\t\t\t\t: width;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\theight === 'auto' ||\n\t\t\t\t\t\t\t\t\t\theight === undefined ||\n\t\t\t\t\t\t\t\t\t\theight === null\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tstyle.height = 'auto';\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tstyle.height =\n\t\t\t\t\t\t\t\t\t\t\ttypeof height === 'number'\n\t\t\t\t\t\t\t\t\t\t\t\t? `${ height }px`\n\t\t\t\t\t\t\t\t\t\t\t\t: height;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn style;\n\t\t\t\t\t\t\t } )() ),\n\t\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t\tobjectPosition:\n\t\t\t\t\t\t\tfocalPoint && scale\n\t\t\t\t\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ isUploading && <Spinner /> }\n\t\t\t</>\n\t\t);\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageWrapper href={ href }>\n\t\t\t\t<ImageEditor\n\t\t\t\t\tid={ id }\n\t\t\t\t\turl={ url }\n\t\t\t\t\t{ ...pixelSize }\n\t\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t\t}\n\t\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t\t} }\n\t\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t\t/>\n\t\t\t</ImageWrapper>\n\t\t);\n\t} else {\n\t\timg = <ImageWrapper href={ href }>{ img }</ImageWrapper>;\n\t}\n\n\tlet resizableBox;\n\tif (\n\t\tisResizable &&\n\t\tisSingleSelected &&\n\t\t! isEditingImage &&\n\t\t! isUploading &&\n\t\t! SIZED_LAYOUTS.includes( parentLayoutType )\n\t) {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = pixelSize.width / pixelSize.height;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\t\tconst maxResizeWidth = maxContentWidth || maxWidthBuffer;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\t\tresizableBox = (\n\t\t\t<ResizableBox\n\t\t\t\tref={ effectResizeableBoxPlacement }\n\t\t\t\tstyle={ {\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t// To match the vertical-align: bottom of the img (from style.scss)\n\t\t\t\t\t// syncs the top with the img. This matters when the img height is\n\t\t\t\t\t// less than the line-height.\n\t\t\t\t\tinset: `${ offsetTop }px 0 0 0`,\n\t\t\t\t} }\n\t\t\t\tsize={ pixelSize }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxResizeWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxResizeWidth / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResize={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetResizeDelta( delta );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\tsetResizeDelta( null );\n\t\t\t\t\tsetPixelSize( ( current ) => ( {\n\t\t\t\t\t\twidth: current.width + delta.width,\n\t\t\t\t\t\theight: current.height + delta.height,\n\t\t\t\t\t} ) );\n\n\t\t\t\t\t// Clear hardcoded width if the resized width is close to the max-content width.\n\t\t\t\t\tif (\n\t\t\t\t\t\tmaxContentWidth &&\n\t\t\t\t\t\t// Only do this if the image is bigger than the container to prevent it from being squished.\n\t\t\t\t\t\t// TODO: Remove this check if the image support setting 100% width.\n\t\t\t\t\t\tnaturalWidth >= maxContentWidth &&\n\t\t\t\t\t\tMath.abs( elt.offsetWidth - maxContentWidth ) < 10\n\t\t\t\t\t) {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ mediaReplaceFlow }\n\t\t\t\t{ controls }\n\t\t\t</>\n\t\t);\n\t}\n\n\t/**\n\t * Set the post's featured image with the current image.\n\t */\n\tconst setPostFeatureImage = () => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tfeatured_media: id,\n\t\t} );\n\t\tcreateSuccessNotice( __( 'Post featured image updated.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst featuredImageControl =\n\t\t! isDescendentOfQueryLoop && postId && id ? (\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { canEdit, selectedClientIds } ) =>\n\t\t\t\t\tcanEdit &&\n\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\tclientId === selectedClientIds[ 0 ] && (\n\t\t\t\t\t\t<MenuItem onClick={ setPostFeatureImage }>\n\t\t\t\t\t\t\t{ __( 'Set as featured image' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</BlockSettingsMenuControls>\n\t\t) : null;\n\n\treturn (\n\t\t<>\n\t\t\t{ mediaReplaceFlow }\n\t\t\t{ controls }\n\t\t\t{ featuredImageControl }\n\t\t\t{ img }\n\t\t\t{ resizableBox }\n\n\t\t\t{ ! isDecorative && (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Image caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSel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W,IAAI;AAAA;AAAA,IACxC;AAAA,EAEF;AAEA,MAAK,CAAE,OAAO,CAAE,cAAe;AAC9B,WACC,4EACG;AAAA;AAAA,MACA;AAAA,OACH;AAAA,EAEF;AAKA,QAAM,sBAAsB,MAAM;AACjC,qBAAkB,YAAY,UAAU,QAAQ;AAAA,MAC/C,gBAAgB;AAAA,IACjB,CAAE;AACF,4BAAqB,gBAAI,8BAA+B,GAAG;AAAA,MAC1D,MAAM;AAAA,IACP,CAAE;AAAA,EACH;AAEA,QAAM,uBACL,CAAE,2BAA2B,UAAU,KACtC,4CAAC,iDACE,WAAE,EAAE,SAAS,kBAAkB,MAChC,WACA,kBAAkB,WAAW,KAC7B,aAAa,kBAAmB,CAAE,KACjC,4CAAC,8BAAS,SAAU,qBACjB,8BAAI,uBAAwB,GAC/B,GAGH,IACG;AAEL,SACC,4EACG;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,CAAE,gBACH;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAa;AAAA,QACb;AAAA,QACA,WAAQ,gBAAI,oBAAqB;AAAA,QACjC,mBACC,qBACE,yBAAyB,sBAC3B,CAAE;AAAA;AAAA,IAEJ;AAAA,KAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tFocalPointPicker,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tTextControl,\n\tCheckboxControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\tPlaceholder,\n\tMenuItem,\n\tToolbarItem,\n\tDropdownMenu,\n\tPopover,\n} from '@wordpress/components';\nimport {\n\tuseMergeRefs,\n\tuseResizeObserver,\n\tuseViewportMatch,\n} from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSettings,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockSettingsMenuControls,\n} from '@wordpress/block-editor';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport { getBlockBindingsSource, switchToBlockType } from '@wordpress/blocks';\nimport { crop, overlayText, upload, chevronDown } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport { isExternalImage } from './edit';\nimport { Caption } from '../utils/caption';\nimport { MediaControl } from '../utils/media-control';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport {\n\tgetActiveDimensionValue,\n\tgetDimensionResetAttributes,\n\tgetDimensionUpdateAttributes,\n\tgetStyleStateKey,\n} from '../utils/style-state';\nimport { useOpenImageMediaEditorModal } from './use-open-image-media-editor-modal';\nimport {\n\tMIN_SIZE,\n\tALLOWED_MEDIA_TYPES,\n\tSIZED_LAYOUTS,\n\tDEFAULT_MEDIA_SIZE_SLUG,\n} from './constants';\nimport { evalAspectRatio, mediaPosition } from './utils';\n\nconst {\n\tDimensionsTool,\n\tisDefaultBlockStyleState,\n\tResolutionTool,\n\tmediaEditKey,\n} = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nconst WRITEMODE_POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\n// If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles.\nconst ImageWrapper = ( { href, children } ) => {\n\tif ( ! href ) {\n\t\treturn children;\n\t}\n\treturn (\n\t\t<a\n\t\t\thref={ href }\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\taria-disabled\n\t\t\tstyle={ {\n\t\t\t\t// When the Image block is linked,\n\t\t\t\t// it's wrapped with a disabled <a /> tag.\n\t\t\t\t// Restore cursor style so it doesn't appear 'clickable'\n\t\t\t\t// and remove pointer events. Safari needs the display property.\n\t\t\t\tpointerEvents: 'none',\n\t\t\t\tcursor: 'default',\n\t\t\t\tdisplay: 'inline',\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</a>\n\t);\n};\n\nfunction ContentOnlyControls( {\n\tattributes,\n\tsetAttributes,\n\tlockAltControls,\n\tlockAltControlsMessage,\n\tlockTitleControls,\n\tlockTitleControlsMessage,\n} ) {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst [ isAltDialogOpen, setIsAltDialogOpen ] = useState( false );\n\tconst [ isTitleDialogOpen, setIsTitleDialogOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarItem ref={ setPopoverAnchor }>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'More' ) }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t\tdescription: __( 'Displays more controls.' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ WRITEMODE_POPOVER_PROPS }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsAltDialogOpen( true );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ _x(\n\t\t\t\t\t\t\t\t\t\t'Alternative text',\n\t\t\t\t\t\t\t\t\t\t'Alternative text for an image. Block toolbar label, a low character count is preferred.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTitleDialogOpen( true );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Title text' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t\t{ isAltDialogOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonClose={ () => setIsAltDialogOpen( false ) }\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-image__toolbar_content_textarea__container\">\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\tclassName=\"wp-block-image__toolbar_content_textarea\"\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tvalue={ attributes.alt || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisabled={ lockAltControls }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tlockAltControls ? (\n\t\t\t\t\t\t\t\t\t<>{ lockAltControlsMessage }</>\n\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\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\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\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\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</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t\t{ isTitleDialogOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonClose={ () => setIsTitleDialogOpen( false ) }\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-image__toolbar_content_textarea__container\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tclassName=\"wp-block-image__toolbar_content_textarea\"\n\t\t\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\t\t\tvalue={ attributes.title || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ttitle: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisabled={ lockTitleControls }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tlockTitleControls ? (\n\t\t\t\t\t\t\t\t\t<>{ lockTitleControlsMessage }</>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\tcreateInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'Describe the role of this image on the page. <a>(Note: many devices and browsers do not display this text.)</a>'\n\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\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\" />\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)\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</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function Image( {\n\ttemporaryURL,\n\tisSideloading,\n\tattributes,\n\tsetAttributes,\n\tisSingleSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n\tparentLayoutType,\n\tmaxContentWidth,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tfocalPoint,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t\tmetadata,\n\t\tisDecorative,\n\t} = attributes;\n\tconst [ imageElement, setImageElement ] = useState();\n\tconst [ resizeDelta, setResizeDelta ] = useState( null );\n\tconst [ pixelSize, setPixelSize ] = useState( {} );\n\tconst [ offsetTop, setOffsetTop ] = useState( 0 );\n\tconst setResizeObserved = useResizeObserver( ( [ entry ] ) => {\n\t\tif ( ! resizeDelta ) {\n\t\t\tconst [ box ] = entry.borderBoxSize;\n\t\t\tsetPixelSize( { width: box.inlineSize, height: box.blockSize } );\n\t\t}\n\t\t// This is usually 0 unless the image height is less than the line-height.\n\t\tsetOffsetTop( entry.target.offsetTop );\n\t} );\n\tconst effectResizeableBoxPlacement = useCallback( () => {\n\t\tsetOffsetTop( imageElement?.offsetTop ?? 0 );\n\t}, [ imageElement ] );\n\tconst setRefs = useMergeRefs( [ setImageElement, setResizeObserved ] );\n\tconst { allowResize = true } = context;\n\n\tconst { image, attachmentResolutionError } = useSelect(\n\t\t( select ) => {\n\t\t\tconst imageRecord =\n\t\t\t\tid && isSingleSelected\n\t\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t\t )\n\t\t\t\t\t: null;\n\n\t\t\t// Check if the attachment resolution failed with a specific error.\n\t\t\t// We use getResolutionError instead of hasFinishedResolution so we\n\t\t\t// can distinguish 404 (attachment doesn't exist) from transient\n\t\t\t// errors (500, 403, network) that shouldn't clear the id.\n\t\t\tconst resolutionError =\n\t\t\t\tid && isSingleSelected\n\t\t\t\t\t? select( coreStore ).getResolutionError(\n\t\t\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t{ context: 'view' },\n\t\t\t\t\t\t\t]\n\t\t\t\t\t )\n\t\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\timage: imageRecord,\n\t\t\t\tattachmentResolutionError: resolutionError,\n\t\t\t};\n\t\t},\n\t\t[ id, isSingleSelected ]\n\t);\n\n\tconst {\n\t\tcanInsertCover,\n\t\timageEditing,\n\t\timageSizes,\n\t\tmaxWidth,\n\t\teditMediaEntity,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst settings = getSettings();\n\n\t\t\treturn {\n\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\teditMediaEntity: settings?.[ mediaEditKey ],\n\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { getBlock, getSettings } = useSelect( blockEditorStore );\n\tconst cropButtonRef = useRef();\n\tconst handleMediaEditorModalClose = useCallback(\n\t\t() => cropButtonRef.current?.focus(),\n\t\t[]\n\t);\n\tconst openImageMediaEditorModal = useOpenImageMediaEditorModal( {\n\t\tattributes,\n\t\tsetAttributes,\n\t\tonClose: handleMediaEditorModalClose,\n\t} );\n\n\tconst {\n\t\treplaceBlocks,\n\t\ttoggleSelection,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst [ hasImageErrored, setHasImageErrored ] = useState( false );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isContentOnlyMode = blockEditingMode === 'contentOnly';\n\tconst showDimensionsControls = allowResize && hasNonContentControls;\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! isWideAligned &&\n\t\tisLargeViewport;\n\t// An image is uploading if it has a temporary blob URL, or if it is\n\t// being processed client-side (e.g. transcoded or generating sub-sizes).\n\tconst isUploading = !! temporaryURL || isSideloading;\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\t// If the image has an id but the attachment doesn't exist on this site,\n\t// clear the id so Gutenberg treats the image as external.\n\t// This handles content copied between WordPress sites.\n\t//\n\t// Known limitation: if a different attachment with the same id happens to\n\t// exist on the destination site, the lookup will succeed and the wrong\n\t// local image will be used. URL matching could address this in a follow-up.\n\t// See: https://github.com/WordPress/gutenberg/issues/74156\n\tuseEffect( () => {\n\t\tif ( ! id || ! isSingleSelected ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only clear for confirmed 404s. apiFetch throws the Response object\n\t\t// for HTTP errors, so checking .status === 404 avoids incorrectly\n\t\t// clearing the id on 403, 500, or network failures, which would\n\t\t// cause data loss for valid local attachments.\n\t\tif ( attachmentResolutionError?.status === 404 ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { id: undefined } );\n\t\t}\n\t}, [\n\t\tid,\n\t\tisSingleSelected,\n\t\tattachmentResolutionError,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSingleSelected ||\n\t\t\t! getSettings().mediaUpload\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSingleSelected, externalBlob, getSettings ] );\n\n\t// Get naturalWidth and naturalHeight from image, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageElement?.naturalWidth || loadedNaturalWidth || undefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageElement?.naturalHeight || loadedNaturalHeight || undefined,\n\t\t};\n\t}, [ loadedNaturalWidth, loadedNaturalHeight, imageElement?.complete ] );\n\n\tfunction onImageError() {\n\t\tsetHasImageErrored( true );\n\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onImageLoad( event ) {\n\t\tsetHasImageErrored( false );\n\t\tsetLoadedNaturalSize( {\n\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t} );\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetLightbox( enable ) {\n\t\tif ( enable && ! lightboxSetting?.enabled ) {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: { enabled: true },\n\t\t\t\tisDecorative: false,\n\t\t\t} );\n\t\t} else if ( ! enable && lightboxSetting?.enabled ) {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: { enabled: false },\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction resetLightbox() {\n\t\t// When deleting a link from an image while lightbox settings\n\t\t// are enabled by default, we should disable the lightbox,\n\t\t// otherwise the resulting UX looks like a mistake.\n\t\t// See https://github.com/WordPress/gutenberg/pull/59890/files#r1532286123.\n\t\tif ( lightboxSetting?.enabled && lightboxSetting?.allowEditing ) {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: { enabled: false },\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( {\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateIsDecorative( value ) {\n\t\tsetAttributes( {\n\t\t\tisDecorative: value || undefined,\n\t\t\t...( value && {\n\t\t\t\talt: '',\n\t\t\t\tcaption: undefined,\n\t\t\t\thref: undefined,\n\t\t\t\tlinkDestination: undefined,\n\t\t\t\tlinkTarget: undefined,\n\t\t\t\trel: undefined,\n\t\t\t} ),\n\t\t} );\n\t}\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tif ( imageElement ) {\n\t\t\timageElement.style.setProperty(\n\t\t\t\t'object-position',\n\t\t\t\tmediaPosition( value )\n\t\t\t);\n\t\t}\n\t};\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tconst { mediaUpload } = getSettings();\n\t\tif ( ! mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\t\tlet notified = false;\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// With client-side media processing, onFileChange fires\n\t\t\t\t// for each generated sub-size. Only show the notice once.\n\t\t\t\tif ( ! notified ) {\n\t\t\t\t\tnotified = true;\n\t\t\t\t\tsetExternalBlob();\n\t\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t}, [ isSingleSelected ] );\n\n\tconst canEditImage =\n\t\tid &&\n\t\tnaturalWidth &&\n\t\tnaturalHeight &&\n\t\timageEditing &&\n\t\t!! editMediaEntity;\n\tconst allowCrop =\n\t\tisSingleSelected &&\n\t\tcanEditImage &&\n\t\t! isEditingImage &&\n\t\t! isContentOnlyMode &&\n\t\t! isUploading;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst [ lightboxSetting ] = useSettings( 'lightbox' );\n\n\tconst showLightboxSetting =\n\t\t// If a block-level override is set, we should give users the option to\n\t\t// remove that override, even if the lightbox UI is disabled in the settings.\n\t\t( !! lightbox && lightbox?.enabled !== lightboxSetting?.enabled ) ||\n\t\tlightboxSetting?.allowEditing;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst selectedStyleState = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst { getSelectedBlockStyleState } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn getSelectedBlockStyleState( clientId );\n\t\t},\n\t\t[ clientId, isSingleSelected ]\n\t);\n\tconst hasSelectedStyleState =\n\t\t! isDefaultBlockStyleState( selectedStyleState );\n\tconst selectedStyleStateKey = getStyleStateKey( selectedStyleState );\n\tconst activeWidth = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'width',\n\t} );\n\tconst activeHeight = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'height',\n\t} );\n\tconst activeAspectRatio = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'aspectRatio',\n\t} );\n\tconst activeScale = getActiveDimensionValue( {\n\t\tattributes,\n\t\tselectedState: selectedStyleState,\n\t\thasSelectedStyleState,\n\t\tattributeKey: 'scale',\n\t\tstyleKey: 'objectFit',\n\t} );\n\tconst setDimensionAttributes = ( nextDimensions ) => {\n\t\tsetAttributes(\n\t\t\tgetDimensionUpdateAttributes( {\n\t\t\t\tstyle: attributes.style,\n\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\thasSelectedStyleState,\n\t\t\t\tnextDimensions,\n\t\t\t\tdimensionKeyMap: { scale: 'objectFit' },\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst dimensionsControl =\n\t\tshowDimensionsControls &&\n\t\t( SIZED_LAYOUTS.includes( parentLayoutType ) ? (\n\t\t\t<DimensionsTool\n\t\t\t\tkey={ selectedStyleStateKey }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tvalue={ { aspectRatio: activeAspectRatio, scale: activeScale } }\n\t\t\t\tonChange={ ( { aspectRatio: newAspectRatio } ) => {\n\t\t\t\t\tsetDimensionAttributes( {\n\t\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t\t\tscale: 'cover',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\t\ttools={ [ 'aspectRatio' ] }\n\t\t\t/>\n\t\t) : (\n\t\t\t<DimensionsTool\n\t\t\t\tkey={ selectedStyleStateKey }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tvalue={ {\n\t\t\t\t\twidth: activeWidth,\n\t\t\t\t\theight: activeHeight,\n\t\t\t\t\tscale: activeScale,\n\t\t\t\t\taspectRatio: activeAspectRatio,\n\t\t\t\t} }\n\t\t\t\tonChange={ ( {\n\t\t\t\t\twidth: newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} ) => {\n\t\t\t\t\tsetDimensionAttributes( {\n\t\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\t\theight: newHeight,\n\t\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t\t\tscale: newScale,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdefaultScale=\"cover\"\n\t\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\t\tscaleOptions={ scaleOptions }\n\t\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t\t\ttools={\n\t\t\t\t\tisWideAligned\n\t\t\t\t\t\t? [ 'aspectRatio', 'scale' ]\n\t\t\t\t\t\t: [ 'aspectRatio', 'widthHeight', 'scale' ]\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\n\tconst resetSettings = () => {\n\t\tsetAttributes( {\n\t\t\tlightbox: undefined,\n\t\t} );\n\t\tupdateImage( DEFAULT_MEDIA_SIZE_SLUG );\n\t};\n\n\tconst arePatternOverridesEnabled =\n\t\tmetadata?.bindings?.__default?.source === 'core/pattern-overrides';\n\n\tconst {\n\t\tlockUrlControls = false,\n\t\tlockHrefControls = false,\n\t\tlockAltControls = false,\n\t\tlockAltControlsMessage,\n\t\tlockTitleControls = false,\n\t\tlockTitleControlsMessage,\n\t\thideCaptionControls = false,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst {\n\t\t\t\turl: urlBinding,\n\t\t\t\talt: altBinding,\n\t\t\t\ttitle: titleBinding,\n\t\t\t\tcaption: captionBinding,\n\t\t\t} = metadata?.bindings || {};\n\t\t\tconst hasParentPattern = !! context[ 'pattern/overrides' ];\n\t\t\tconst urlBindingSource = getBlockBindingsSource(\n\t\t\t\turlBinding?.source\n\t\t\t);\n\t\t\tconst altBindingSource = getBlockBindingsSource(\n\t\t\t\taltBinding?.source\n\t\t\t);\n\t\t\tconst titleBindingSource = getBlockBindingsSource(\n\t\t\t\ttitleBinding?.source\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! urlBinding &&\n\t\t\t\t\t! urlBindingSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: urlBinding?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockHrefControls:\n\t\t\t\t\t// Disable editing the link of the URL if the image is inside a pattern instance.\n\t\t\t\t\t// This is a temporary solution until we support overriding the link on the frontend.\n\t\t\t\t\thasParentPattern || arePatternOverridesEnabled,\n\t\t\t\thideCaptionControls: !! captionBinding,\n\t\t\t\tlockAltControls:\n\t\t\t\t\t!! altBinding &&\n\t\t\t\t\t! altBindingSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: altBinding?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockAltControlsMessage: altBindingSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\taltBindingSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t\tlockTitleControls:\n\t\t\t\t\t!! titleBinding &&\n\t\t\t\t\t! titleBindingSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: titleBinding?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockTitleControlsMessage: titleBindingSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\ttitleBindingSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tarePatternOverridesEnabled,\n\t\t\tcontext,\n\t\t\tisSingleSelected,\n\t\t\tmetadata?.bindings,\n\t\t]\n\t);\n\n\tconst showUrlInput =\n\t\tisSingleSelected &&\n\t\t! isEditingImage &&\n\t\t! lockHrefControls &&\n\t\t! lockUrlControls &&\n\t\t! isDecorative;\n\n\tconst showCoverControls =\n\t\tisSingleSelected && canInsertCover && ! isContentOnlyMode;\n\n\tconst showBlockControls = showUrlInput || allowCrop || showCoverControls;\n\n\tconst mediaReplaceFlow = isSingleSelected &&\n\t\t! isEditingImage &&\n\t\t! lockUrlControls && (\n\t\t\t// For contentOnly mode, put this button in its own area so it has borders around it.\n\t\t\t<BlockControls group={ isContentOnlyMode ? 'inline' : 'other' }>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tname={ ! url ? __( 'Add image' ) : __( 'Replace' ) }\n\t\t\t\t\tonReset={ () => onSelectImage( undefined ) }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t);\n\n\tconst hasDataFormBlockFields =\n\t\twindow?.__experimentalContentOnlyInspectorFields;\n\n\tconst controls = (\n\t\t<>\n\t\t\t{ showBlockControls && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t{ showUrlInput && (\n\t\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t\t\tshowLightboxSetting={ showLightboxSetting }\n\t\t\t\t\t\t\tlightboxEnabled={ lightboxChecked }\n\t\t\t\t\t\t\tonSetLightbox={ onSetLightbox }\n\t\t\t\t\t\t\tresetLightbox={ resetLightbox }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ allowCrop && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tref={ cropButtonRef }\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\topenImageMediaEditorModal\n\t\t\t\t\t\t\t\t\t? openImageMediaEditorModal\n\t\t\t\t\t\t\t\t\t: () => setIsEditingImage( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taria-haspopup={\n\t\t\t\t\t\t\t\topenImageMediaEditorModal ? 'dialog' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showCoverControls && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isSingleSelected && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload to Media Library' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ isContentOnlyMode && (\n\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t// to edit these attributes.\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ContentOnlyControls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tlockAltControls={ lockAltControls }\n\t\t\t\t\t\tlockAltControlsMessage={ lockAltControlsMessage }\n\t\t\t\t\t\tlockTitleControls={ lockTitleControls }\n\t\t\t\t\t\tlockTitleControlsMessage={ lockTitleControlsMessage }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! hasDataFormBlockFields && isSingleSelected && (\n\t\t\t\t<InspectorControls group=\"content\">\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Media' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tonSelectImage( undefined );\n\t\t\t\t\t\t\tsetAttributes( { isDecorative: false } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! lockUrlControls && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\t\t\t\thasValue={ () => !! url }\n\t\t\t\t\t\t\t\tonDeselect={ () => onSelectImage( undefined ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MediaControl\n\t\t\t\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\t\t\t\tmediaUrl={ url }\n\t\t\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\t\t\tfilename={\n\t\t\t\t\t\t\t\t\t\timage?.media_details?.sizes?.full\n\t\t\t\t\t\t\t\t\t\t\t?.file ||\n\t\t\t\t\t\t\t\t\t\timage?.slug ||\n\t\t\t\t\t\t\t\t\t\tgetFilename( url )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\t\t\t\tonReset={ () => onSelectImage( undefined ) }\n\t\t\t\t\t\t\t\t\tisUploading={ isUploading }\n\t\t\t\t\t\t\t\t\temptyLabel={ __( 'Add image' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isDecorative && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt || '' }\n\t\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\t\treadOnly={ lockAltControls }\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\tlockAltControls ? (\n\t\t\t\t\t\t\t\t\t\t\t<>{ lockAltControlsMessage }</>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\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\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\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</ExternalLink>\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/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ ! lockAltControls && ! lightboxChecked && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Mark as decorative' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! isDecorative }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isDecorative: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Mark as decorative' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! isDecorative }\n\t\t\t\t\t\t\t\t\tonChange={ updateIsDecorative }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Hidden from assistive technologies.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"dimensions\"\n\t\t\t\tresetAllFilter={ ( attrs ) => {\n\t\t\t\t\treturn getDimensionResetAttributes( {\n\t\t\t\t\t\tattributes: attrs,\n\t\t\t\t\t\tselectedState: selectedStyleState,\n\t\t\t\t\t\thasSelectedStyleState,\n\t\t\t\t\t\tkeys: [ 'aspectRatio', 'height', 'objectFit', 'width' ],\n\t\t\t\t\t\tdefaultAttributes: {\n\t\t\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t\tscale: undefined,\n\t\t\t\t\t\t\tfocalPoint: undefined,\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\t\t{ dimensionsControl }\n\t\t\t\t{ ! hasSelectedStyleState && url && scale && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ resetSettings }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\treadOnly={ lockTitleControls }\n\t\t\t\t\thelp={\n\t\t\t\t\t\tlockTitleControls ? (\n\t\t\t\t\t\t\t<>{ lockTitleControlsMessage }</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tcreateInterpolateElement(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Describe the role of this image on the page. <a>(Note: many devices and browsers do not display this text.)</a>'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\" />\n\t\t\t\t\t\t\t\t\t),\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}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( isDecorative ) {\n\t\tdefaultedAlt = filename\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'This image has been marked as decorative; its file name is %s'\n\t\t\t\t\t),\n\t\t\t\t\tfilename\n\t\t\t )\n\t\t\t: __( 'This image has been marked as decorative.' );\n\t} else if ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tconst { postType, postId, queryId } = context;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\n\tlet img =\n\t\ttemporaryURL && hasImageErrored ? (\n\t\t\t// Show a placeholder during upload when the blob URL can't be loaded. This can\n\t\t\t// happen when the user uploads a HEIC image in a browser that doesn't support them.\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-image__placeholder\"\n\t\t\t\twithIllustration\n\t\t\t>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t) : (\n\t\t\t<>\n\t\t\t\t<img\n\t\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\t\talt={ defaultedAlt }\n\t\t\t\t\tonError={ onImageError }\n\t\t\t\t\tonLoad={ onImageLoad }\n\t\t\t\t\tref={ setRefs }\n\t\t\t\t\tclassName={ borderProps.className }\n\t\t\t\t\twidth={ naturalWidth }\n\t\t\t\t\theight={ naturalHeight }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t\t...( resizeDelta\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\twidth: pixelSize.width + resizeDelta.width,\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tpixelSize.height + resizeDelta.height,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: ( () => {\n\t\t\t\t\t\t\t\t\tconst style = {};\n\t\t\t\t\t\t\t\t\tif ( width === 'auto' ) {\n\t\t\t\t\t\t\t\t\t\tstyle.width = 'auto';\n\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\twidth !== undefined &&\n\t\t\t\t\t\t\t\t\t\twidth !== null\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tstyle.width =\n\t\t\t\t\t\t\t\t\t\t\ttypeof width === 'number'\n\t\t\t\t\t\t\t\t\t\t\t\t? `${ width }px`\n\t\t\t\t\t\t\t\t\t\t\t\t: width;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\theight === 'auto' ||\n\t\t\t\t\t\t\t\t\t\theight === undefined ||\n\t\t\t\t\t\t\t\t\t\theight === null\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tstyle.height = 'auto';\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tstyle.height =\n\t\t\t\t\t\t\t\t\t\t\ttypeof height === 'number'\n\t\t\t\t\t\t\t\t\t\t\t\t? `${ height }px`\n\t\t\t\t\t\t\t\t\t\t\t\t: height;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn style;\n\t\t\t\t\t\t\t } )() ),\n\t\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t\tobjectPosition:\n\t\t\t\t\t\t\tfocalPoint && scale\n\t\t\t\t\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...shadowProps.style,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ isUploading && <Spinner /> }\n\t\t\t</>\n\t\t);\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageWrapper href={ href }>\n\t\t\t\t<ImageEditor\n\t\t\t\t\tid={ id }\n\t\t\t\t\turl={ url }\n\t\t\t\t\t{ ...pixelSize }\n\t\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t\t}\n\t\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t\t} }\n\t\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t\t/>\n\t\t\t</ImageWrapper>\n\t\t);\n\t} else {\n\t\timg = <ImageWrapper href={ href }>{ img }</ImageWrapper>;\n\t}\n\n\tlet resizableBox;\n\tif (\n\t\tisResizable &&\n\t\tisSingleSelected &&\n\t\t! isEditingImage &&\n\t\t! isUploading &&\n\t\t! SIZED_LAYOUTS.includes( parentLayoutType )\n\t) {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = pixelSize.width / pixelSize.height;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\t\tconst maxResizeWidth = maxContentWidth || maxWidthBuffer;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\t\tresizableBox = (\n\t\t\t<ResizableBox\n\t\t\t\tref={ effectResizeableBoxPlacement }\n\t\t\t\tstyle={ {\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t// To match the vertical-align: bottom of the img (from style.scss)\n\t\t\t\t\t// syncs the top with the img. This matters when the img height is\n\t\t\t\t\t// less than the line-height.\n\t\t\t\t\tinset: `${ offsetTop }px 0 0 0`,\n\t\t\t\t} }\n\t\t\t\tsize={ pixelSize }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxResizeWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxResizeWidth / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResize={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetResizeDelta( delta );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\tsetResizeDelta( null );\n\t\t\t\t\tsetPixelSize( ( current ) => ( {\n\t\t\t\t\t\twidth: current.width + delta.width,\n\t\t\t\t\t\theight: current.height + delta.height,\n\t\t\t\t\t} ) );\n\n\t\t\t\t\t// Clear hardcoded width if the resized width is close to the max-content width.\n\t\t\t\t\tif (\n\t\t\t\t\t\tmaxContentWidth &&\n\t\t\t\t\t\t// Only do this if the image is bigger than the container to prevent it from being squished.\n\t\t\t\t\t\t// TODO: Remove this check if the image support setting 100% width.\n\t\t\t\t\t\tnaturalWidth >= maxContentWidth &&\n\t\t\t\t\t\tMath.abs( elt.offsetWidth - maxContentWidth ) < 10\n\t\t\t\t\t) {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\theight: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ mediaReplaceFlow }\n\t\t\t\t{ controls }\n\t\t\t</>\n\t\t);\n\t}\n\n\t/**\n\t * Set the post's featured image with the current image.\n\t */\n\tconst setPostFeatureImage = () => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tfeatured_media: id,\n\t\t} );\n\t\tcreateSuccessNotice( __( 'Post featured image updated.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst featuredImageControl =\n\t\t! isDescendentOfQueryLoop && postId && id ? (\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { canEdit, selectedClientIds } ) =>\n\t\t\t\t\tcanEdit &&\n\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\tclientId === selectedClientIds[ 0 ] && (\n\t\t\t\t\t\t<MenuItem onClick={ setPostFeatureImage }>\n\t\t\t\t\t\t\t{ __( 'Set as featured image' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</BlockSettingsMenuControls>\n\t\t) : null;\n\n\treturn (\n\t\t<>\n\t\t\t{ mediaReplaceFlow }\n\t\t\t{ controls }\n\t\t\t{ featuredImageControl }\n\t\t\t{ img }\n\t\t\t{ resizableBox }\n\n\t\t\t{ ! isDecorative && (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Image caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected &&\n\t\t\t\t\t\t( hasNonContentControls || isContentOnlyMode ) &&\n\t\t\t\t\t\t! hideCaptionControls\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,wBAkBO;AACP,qBAIO;AACP,kBAAuC;AACvC,0BAYO;AACP,qBAOO;AACP,kBAAuC;AACvC,iBAA4B;AAC5B,oBAA0D;AAC1D,mBAAuD;AACvD,qBAAsC;AACtC,uBAAmC;AAKnC,yBAAuB;AACvB,kBAAyC;AACzC,kBAAgC;AAChC,qBAAwB;AACxB,2BAA6B;AAC7B,mBAA+C;AAC/C,yBAKO;AACP,+CAA6C;AAC7C,uBAKO;AACP,mBAA+C;AAgC7C;AA9BF,IAAM;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,QAAI,2BAAQ,oBAAAA,WAAuB;AAEnC,IAAM,eAAe;AAAA,EACpB;AAAA,IACC,OAAO;AAAA,IACP,WAAO,gBAAI,SAAS,qCAAsC;AAAA,IAC1D,UAAM,gBAAI,gCAAiC;AAAA,EAC5C;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,WAAO,gBAAI,WAAW,qCAAsC;AAAA,IAC5D,UAAM,gBAAI,wCAAyC;AAAA,EACpD;AACD;AAEA,IAAM,0BAA0B;AAAA,EAC/B,WAAW;AACZ;AAGA,IAAM,eAAe,CAAE,EAAE,MAAM,SAAS,MAAO;AAC9C,M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A,cACP,QAAQ;AAAA,YACT,CAAE;AACF;AAAA,UACD;AAMA,wBAAe;AAAA,YACd,OAAO,GAAI,IAAI,WAAY;AAAA,YAC3B,QAAQ;AAAA,YACR,aACC,UAAU,eACP,SACA,OAAQ,KAAM;AAAA,UACnB,CAAE;AAAA,QACH;AAAA,QACA,aAAc,UAAU,WAAW,IAAI;AAAA;AAAA,IACxC;AAAA,EAEF;AAEA,MAAK,CAAE,OAAO,CAAE,cAAe;AAC9B,WACC,4EACG;AAAA;AAAA,MACA;AAAA,OACH;AAAA,EAEF;AAKA,QAAM,sBAAsB,MAAM;AACjC,qBAAkB,YAAY,UAAU,QAAQ;AAAA,MAC/C,gBAAgB;AAAA,IACjB,CAAE;AACF,4BAAqB,gBAAI,8BAA+B,GAAG;AAAA,MAC1D,MAAM;AAAA,IACP,CAAE;AAAA,EACH;AAEA,QAAM,uBACL,CAAE,2BAA2B,UAAU,KACtC,4CAAC,iDACE,WAAE,EAAE,SAAS,kBAAkB,MAChC,WACA,kBAAkB,WAAW,KAC7B,aAAa,kBAAmB,CAAE,KACjC,4CAAC,8BAAS,SAAU,qBACjB,8BAAI,uBAAwB,GAC/B,GAGH,IACG;AAEL,SACC,4EACG;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,CAAE,gBACH;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,YAAa;AAAA,QACb;AAAA,QACA,WAAQ,gBAAI,oBAAqB;AAAA,QACjC,mBACC,qBACE,yBAAyB,sBAC3B,CAAE;AAAA;AAAA,IAEJ;AAAA,KAEF;AAEF;",
6
6
  "names": ["blockEditorPrivateApis", "coreStore", "getSettings", "blockEditorStore", "noticesStore", "img", "useCustomUnits", "ImageURLInputUI", "ToolsPanel", "ToolsPanelItem", "useBorderProps", "getShadowClassesAndStyles", "ImageEditor"]
7
7
  }
@@ -82,7 +82,6 @@ function getSyncedImageBlockAttributes(currentAttributes, originalAttachment, up
82
82
  return syncedAttributes;
83
83
  }
84
84
  var { openMediaEditorModalKey } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
85
- var ATTACHMENT_EDIT_QUERY = { context: "edit" };
86
85
  function getAttachmentFallbackForEmptyBlockMetadata({ alt, caption }) {
87
86
  const attachment = {};
88
87
  if (!alt) {
@@ -129,19 +128,11 @@ function useOpenImageMediaEditorModal({
129
128
  };
130
129
  }, [alt, caption, id, url]);
131
130
  const getCachedAttachmentRecord = (0, import_element.useCallback)(
132
- (attachmentId) => {
133
- const { getEditedEntityRecord, getEntityRecord } = registry.select(import_core_data.store);
134
- return getEditedEntityRecord(
135
- "postType",
136
- "attachment",
137
- attachmentId
138
- ) || getEntityRecord(
139
- "postType",
140
- "attachment",
141
- attachmentId,
142
- ATTACHMENT_EDIT_QUERY
143
- ) || getEntityRecord("postType", "attachment", attachmentId);
144
- },
131
+ (attachmentId) => registry.select(import_core_data.store).getEditedEntityRecord(
132
+ "postType",
133
+ "attachment",
134
+ attachmentId
135
+ ),
145
136
  [registry]
146
137
  );
147
138
  const resolveAttachmentRecord = (0, import_element.useCallback)(
@@ -149,11 +140,6 @@ function useOpenImageMediaEditorModal({
149
140
  const resolveSelect = registry.resolveSelect(import_core_data.store);
150
141
  try {
151
142
  return await resolveSelect.getEntityRecord(
152
- "postType",
153
- "attachment",
154
- attachmentId,
155
- ATTACHMENT_EDIT_QUERY
156
- ) || await resolveSelect.getEntityRecord(
157
143
  "postType",
158
144
  "attachment",
159
145
  attachmentId
@@ -172,12 +158,6 @@ function useOpenImageMediaEditorModal({
172
158
  "attachment",
173
159
  attachmentId
174
160
  ]);
175
- invalidateResolution("getEntityRecord", [
176
- "postType",
177
- "attachment",
178
- attachmentId,
179
- ATTACHMENT_EDIT_QUERY
180
- ]);
181
161
  return resolveAttachmentRecord(attachmentId);
182
162
  },
183
163
  [registry, resolveAttachmentRecord]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/image/use-open-image-media-editor-modal.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nfunction normalizeImageBlockCaption( caption ) {\n\tif ( typeof caption !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tconst textContent = stripHTML( caption ).trim();\n\n\tif ( ! textContent ) {\n\t\treturn '';\n\t}\n\n\treturn caption.replace( /\\n/g, '<br>' );\n}\n\nfunction getAttachmentCaption( attachment ) {\n\tconst caption = attachment?.caption;\n\n\tif ( typeof caption === 'string' ) {\n\t\treturn normalizeImageBlockCaption( caption );\n\t}\n\n\tif (\n\t\tcaption &&\n\t\ttypeof caption === 'object' &&\n\t\tObject.hasOwn( caption, 'raw' )\n\t) {\n\t\treturn normalizeImageBlockCaption( caption.raw );\n\t}\n\n\treturn undefined;\n}\n\nexport function getImageBlockMetadataFromAttachment( attachment ) {\n\treturn {\n\t\talt:\n\t\t\ttypeof attachment?.alt_text === 'string'\n\t\t\t\t? attachment.alt_text\n\t\t\t\t: attachment?.alt || '',\n\t\tcaption: getAttachmentCaption( attachment ),\n\t};\n}\n\nfunction normalizeMetadataAttribute( value ) {\n\treturn value || '';\n}\n\nexport function getSyncedImageBlockAttributes(\n\tcurrentAttributes,\n\toriginalAttachment,\n\tupdatedAttachment\n) {\n\tif ( ! originalAttachment || ! updatedAttachment ) {\n\t\treturn {};\n\t}\n\n\tconst originalMetadata =\n\t\tgetImageBlockMetadataFromAttachment( originalAttachment );\n\tconst updatedMetadata =\n\t\tgetImageBlockMetadataFromAttachment( updatedAttachment );\n\tconst syncedAttributes = {};\n\n\tconst normalizedCurrentAlt = normalizeMetadataAttribute(\n\t\tcurrentAttributes.alt\n\t);\n\tif (\n\t\toriginalMetadata.alt !== updatedMetadata.alt &&\n\t\t( normalizedCurrentAlt === originalMetadata.alt ||\n\t\t\t! normalizedCurrentAlt )\n\t) {\n\t\tsyncedAttributes.alt = updatedMetadata.alt;\n\t}\n\n\tconst normalizedCurrentCaption = normalizeMetadataAttribute(\n\t\tcurrentAttributes.caption\n\t);\n\tif (\n\t\toriginalMetadata.caption !== undefined &&\n\t\tupdatedMetadata.caption !== undefined &&\n\t\toriginalMetadata.caption !== updatedMetadata.caption &&\n\t\t( normalizedCurrentCaption === originalMetadata.caption ||\n\t\t\t! normalizedCurrentCaption )\n\t) {\n\t\tsyncedAttributes.caption = updatedMetadata.caption || undefined;\n\t}\n\n\treturn syncedAttributes;\n}\n\nconst { openMediaEditorModalKey } = unlock( blockEditorPrivateApis );\n// Caption sync needs `caption.raw`; view/default attachment records can contain\n// only rendered caption data or be tied to an in-flight stale resolution.\nconst ATTACHMENT_EDIT_QUERY = { context: 'edit' };\n\nfunction getAttachmentFallbackForEmptyBlockMetadata( { alt, caption } ) {\n\tconst attachment = {};\n\n\tif ( ! alt ) {\n\t\tattachment.alt_text = '';\n\t}\n\n\tif ( ! caption?.toString() ) {\n\t\tattachment.caption = '';\n\t}\n\n\treturn Object.keys( attachment ).length ? attachment : undefined;\n}\n\nfunction hasKnownAttachmentMetadata( attachment ) {\n\tif ( ! attachment ) {\n\t\treturn false;\n\t}\n\n\tconst hasKnownAlt =\n\t\ttypeof attachment.alt_text === 'string' ||\n\t\ttypeof attachment.alt === 'string';\n\tconst hasKnownCaption =\n\t\tgetImageBlockMetadataFromAttachment( attachment ).caption !== undefined;\n\n\treturn hasKnownAlt && hasKnownCaption;\n}\n\nexport function useOpenImageMediaEditorModal( {\n\tattributes,\n\tsetAttributes,\n\tonClose,\n} ) {\n\t// Keep this hook private to the Image block and pass the block attributes\n\t// object so the callsite stays compact. Destructure only the attributes\n\t// currently used for metadata sync; add more here if the sync policy grows.\n\tconst { id, url, alt, caption } = attributes;\n\tconst registry = useRegistry();\n\tconst openMediaEditorModal = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()[ openMediaEditorModalKey ],\n\t\t[]\n\t);\n\t// Track the block's current attachment and metadata in a ref so\n\t// handleMediaUpdate can read the latest values without being listed as\n\t// dependencies (which would recreate the callback and re-register the\n\t// onUpdate handler on every block change while the modal is open).\n\tconst blockAttributesRef = useRef( {\n\t\tid,\n\t\turl,\n\t\talt,\n\t\tcaption: caption?.toString(),\n\t} );\n\t// Snapshot of the attachment's metadata taken just before the modal opens,\n\t// used as the baseline for detecting what changed during the editing session.\n\tconst mediaEditorMetadataBaselineRef = useRef();\n\t// Incremented on every handleMediaUpdate call; stale async continuations\n\t// check against this to bail out if a newer update has since started.\n\tconst mediaEditorMetadataSyncRequestRef = useRef( 0 );\n\n\tuseEffect( () => {\n\t\tblockAttributesRef.current = {\n\t\t\tid,\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption: caption?.toString(),\n\t\t};\n\t}, [ alt, caption, id, url ] );\n\n\tconst getCachedAttachmentRecord = useCallback(\n\t\t( attachmentId ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecord } =\n\t\t\t\tregistry.select( coreStore );\n\t\t\treturn (\n\t\t\t\tgetEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t) ||\n\t\t\t\tgetEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId,\n\t\t\t\t\tATTACHMENT_EDIT_QUERY\n\t\t\t\t) ||\n\t\t\t\tgetEntityRecord( 'postType', 'attachment', attachmentId )\n\t\t\t);\n\t\t},\n\t\t[ registry ]\n\t);\n\n\tconst resolveAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\tconst resolveSelect = registry.resolveSelect( coreStore );\n\n\t\t\ttry {\n\t\t\t\treturn (\n\t\t\t\t\t( await resolveSelect.getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tattachmentId,\n\t\t\t\t\t\tATTACHMENT_EDIT_QUERY\n\t\t\t\t\t) ) ||\n\t\t\t\t\t( await resolveSelect.getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tattachmentId\n\t\t\t\t\t) )\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\t[ registry ]\n\t);\n\n\tconst resolveFreshAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\t// Bust cached records so resolveAttachmentRecord fetches the\n\t\t\t// server state that reflects the media editor's saved changes.\n\t\t\tconst { invalidateResolution } = registry.dispatch( coreStore );\n\n\t\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tattachmentId,\n\t\t\t] );\n\t\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tattachmentId,\n\t\t\t\tATTACHMENT_EDIT_QUERY,\n\t\t\t] );\n\t\t\treturn resolveAttachmentRecord( attachmentId );\n\t\t},\n\t\t[ registry, resolveAttachmentRecord ]\n\t);\n\n\tconst handleMediaUpdate = useCallback(\n\t\tasync ( { id: newId, url: newUrl } ) => {\n\t\t\tif ( typeof newId !== 'number' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Capture and clear the baseline so a rapid second save doesn't\n\t\t\t// reuse a stale snapshot.\n\t\t\tconst originalAttachment = mediaEditorMetadataBaselineRef.current;\n\t\t\tmediaEditorMetadataBaselineRef.current = undefined;\n\t\t\tconst syncRequest = ++mediaEditorMetadataSyncRequestRef.current;\n\t\t\tconst nextAttributes = {};\n\n\t\t\tconst currentBlockAttributes = blockAttributesRef.current;\n\n\t\t\tif ( newId !== currentBlockAttributes.id ) {\n\t\t\t\tnextAttributes.id = newId;\n\t\t\t\tnextAttributes.url = newUrl ?? currentBlockAttributes.url;\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\tid: nextAttributes.id,\n\t\t\t\t\turl: nextAttributes.url,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( originalAttachment ) {\n\t\t\t\t// Fetch fresh server state so the comparison reflects what\n\t\t\t\t// the media editor actually saved, not a potentially stale\n\t\t\t\t// cache.\n\t\t\t\tconst resolvedAttachment =\n\t\t\t\t\tawait resolveFreshAttachmentRecord( newId );\n\n\t\t\t\t// A newer update started while we were awaiting; discard\n\t\t\t\t// this one.\n\t\t\t\tif (\n\t\t\t\t\tsyncRequest !== mediaEditorMetadataSyncRequestRef.current\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Sync alt text and caption back to the block only when\n\t\t\t\t// they were changed in the media editor. Fields the user\n\t\t\t\t// has independently customised on the block (i.e. values\n\t\t\t\t// that don't match the pre-session attachment metadata)\n\t\t\t\t// are left untouched.\n\t\t\t\tconst latestBlockAttributes = blockAttributesRef.current;\n\t\t\t\tconst resolvedMetadataAttributes =\n\t\t\t\t\tgetSyncedImageBlockAttributes(\n\t\t\t\t\t\tlatestBlockAttributes,\n\t\t\t\t\t\toriginalAttachment,\n\t\t\t\t\t\tresolvedAttachment\n\t\t\t\t\t);\n\n\t\t\t\tif ( Object.keys( resolvedMetadataAttributes ).length ) {\n\t\t\t\t\tObject.assign( nextAttributes, resolvedMetadataAttributes );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( Object.keys( nextAttributes ).length ) {\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\t...nextAttributes,\n\t\t\t\t};\n\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t}\n\t\t},\n\t\t[ resolveFreshAttachmentRecord, setAttributes ]\n\t);\n\n\tconst openImageMediaEditorModal = useCallback( async () => {\n\t\tif ( ! id || ! openMediaEditorModal ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Snapshot the attachment's current metadata before the user makes\n\t\t// any changes so handleMediaUpdate can compare against it later.\n\t\t// Prefer a freshly resolved edit-context record for accuracy; fall\n\t\t// back to whatever is in the cache, or a minimal object derived from\n\t\t// the block's own attributes when nothing is cached yet.\n\t\tconst cachedAttachmentRecord = getCachedAttachmentRecord( id );\n\t\tconst fallbackAttachmentRecord =\n\t\t\tgetAttachmentFallbackForEmptyBlockMetadata(\n\t\t\t\tblockAttributesRef.current\n\t\t\t);\n\t\tconst resolvedAttachmentRecord = hasKnownAttachmentMetadata(\n\t\t\tcachedAttachmentRecord\n\t\t)\n\t\t\t? undefined\n\t\t\t: await resolveAttachmentRecord( id );\n\n\t\tmediaEditorMetadataBaselineRef.current =\n\t\t\tresolvedAttachmentRecord ||\n\t\t\t( hasKnownAttachmentMetadata( cachedAttachmentRecord )\n\t\t\t\t? cachedAttachmentRecord\n\t\t\t\t: fallbackAttachmentRecord ) ||\n\t\t\tcachedAttachmentRecord;\n\n\t\topenMediaEditorModal( {\n\t\t\tid,\n\t\t\tonUpdate: handleMediaUpdate,\n\t\t\tonClose,\n\t\t} );\n\t}, [\n\t\tgetCachedAttachmentRecord,\n\t\thandleMediaUpdate,\n\t\tid,\n\t\tonClose,\n\t\topenMediaEditorModal,\n\t\tresolveAttachmentRecord,\n\t] );\n\n\treturn id && openMediaEditorModal ? openImageMediaEditorModal : undefined;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AACnC,0BAGO;AACP,iBAAiD;AACjD,kBAAuC;AACvC,qBAA+C;AAK/C,yBAAuB;AAEvB,SAAS,2BAA4B,SAAU;AAC9C,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR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AAU,uBAAuB;AACtD,2BAAmB,UAAU;AAAA,UAC5B,GAAG,mBAAmB;AAAA,UACtB,IAAI,eAAe;AAAA,UACnB,KAAK,eAAe;AAAA,QACrB;AAAA,MACD;AAEA,UAAK,oBAAqB;AAIzB,cAAM,qBACL,MAAM,6BAA8B,KAAM;AAI3C,YACC,gBAAgB,kCAAkC,SACjD;AACD;AAAA,QACD;AAOA,cAAM,wBAAwB,mBAAmB;AACjD,cAAM,6BACL;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAED,YAAK,OAAO,KAAM,0BAA2B,EAAE,QAAS;AACvD,iBAAO,OAAQ,gBAAgB,0BAA2B;AAAA,QAC3D;AAAA,MACD;AAEA,UAAK,OAAO,KAAM,cAAe,EAAE,QAAS;AAC3C,2BAAmB,UAAU;AAAA,UAC5B,GAAG,mBAAmB;AAAA,UACtB,GAAG;AAAA,QACJ;AACA,sBAAe,cAAe;AAAA,MAC/B;AAAA,IACD;AAAA,IACA,CAAE,8BAA8B,aAAc;AAAA,EAC/C;AAEA,QAAM,gCAA4B,4BAAa,YAAY;AAC1D,QAAK,CAAE,MAAM,CAAE,sBAAuB;AACrC;AAAA,IACD;AAOA,UAAM,yBAAyB,0BAA2B,EAAG;AAC7D,UAAM,2BACL;AAAA,MACC,mBAAmB;AAAA,IACpB;AACD,UAAM,2BAA2B;AAAA,MAChC;AAAA,IACD,IACG,SACA,MAAM,wBAAyB,EAAG;AAErC,mCAA+B,UAC9B,6BACE,2BAA4B,sBAAuB,IAClD,yBACA,6BACH;AAED,yBAAsB;AAAA,MACrB;AAAA,MACA,UAAU;AAAA,MACV;AAAA,IACD,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO,MAAM,uBAAuB,4BAA4B;AACjE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nfunction normalizeImageBlockCaption( caption ) {\n\tif ( typeof caption !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tconst textContent = stripHTML( caption ).trim();\n\n\tif ( ! textContent ) {\n\t\treturn '';\n\t}\n\n\treturn caption.replace( /\\n/g, '<br>' );\n}\n\nfunction getAttachmentCaption( attachment ) {\n\tconst caption = attachment?.caption;\n\n\tif ( typeof caption === 'string' ) {\n\t\treturn normalizeImageBlockCaption( caption );\n\t}\n\n\tif (\n\t\tcaption &&\n\t\ttypeof caption === 'object' &&\n\t\tObject.hasOwn( caption, 'raw' )\n\t) {\n\t\treturn normalizeImageBlockCaption( caption.raw );\n\t}\n\n\treturn undefined;\n}\n\nexport function getImageBlockMetadataFromAttachment( attachment ) {\n\treturn {\n\t\talt:\n\t\t\ttypeof attachment?.alt_text === 'string'\n\t\t\t\t? attachment.alt_text\n\t\t\t\t: attachment?.alt || '',\n\t\tcaption: getAttachmentCaption( attachment ),\n\t};\n}\n\nfunction normalizeMetadataAttribute( value ) {\n\treturn value || '';\n}\n\nexport function getSyncedImageBlockAttributes(\n\tcurrentAttributes,\n\toriginalAttachment,\n\tupdatedAttachment\n) {\n\tif ( ! originalAttachment || ! updatedAttachment ) {\n\t\treturn {};\n\t}\n\n\tconst originalMetadata =\n\t\tgetImageBlockMetadataFromAttachment( originalAttachment );\n\tconst updatedMetadata =\n\t\tgetImageBlockMetadataFromAttachment( updatedAttachment );\n\tconst syncedAttributes = {};\n\n\tconst normalizedCurrentAlt = normalizeMetadataAttribute(\n\t\tcurrentAttributes.alt\n\t);\n\tif (\n\t\toriginalMetadata.alt !== updatedMetadata.alt &&\n\t\t( normalizedCurrentAlt === originalMetadata.alt ||\n\t\t\t! normalizedCurrentAlt )\n\t) {\n\t\tsyncedAttributes.alt = updatedMetadata.alt;\n\t}\n\n\tconst normalizedCurrentCaption = normalizeMetadataAttribute(\n\t\tcurrentAttributes.caption\n\t);\n\tif (\n\t\toriginalMetadata.caption !== undefined &&\n\t\tupdatedMetadata.caption !== undefined &&\n\t\toriginalMetadata.caption !== updatedMetadata.caption &&\n\t\t( normalizedCurrentCaption === originalMetadata.caption ||\n\t\t\t! normalizedCurrentCaption )\n\t) {\n\t\tsyncedAttributes.caption = updatedMetadata.caption || undefined;\n\t}\n\n\treturn syncedAttributes;\n}\n\nconst { openMediaEditorModalKey } = unlock( blockEditorPrivateApis );\n\nfunction getAttachmentFallbackForEmptyBlockMetadata( { alt, caption } ) {\n\tconst attachment = {};\n\n\tif ( ! alt ) {\n\t\tattachment.alt_text = '';\n\t}\n\n\tif ( ! caption?.toString() ) {\n\t\tattachment.caption = '';\n\t}\n\n\treturn Object.keys( attachment ).length ? attachment : undefined;\n}\n\nfunction hasKnownAttachmentMetadata( attachment ) {\n\tif ( ! attachment ) {\n\t\treturn false;\n\t}\n\n\tconst hasKnownAlt =\n\t\ttypeof attachment.alt_text === 'string' ||\n\t\ttypeof attachment.alt === 'string';\n\tconst hasKnownCaption =\n\t\tgetImageBlockMetadataFromAttachment( attachment ).caption !== undefined;\n\n\treturn hasKnownAlt && hasKnownCaption;\n}\n\nexport function useOpenImageMediaEditorModal( {\n\tattributes,\n\tsetAttributes,\n\tonClose,\n} ) {\n\t// Keep this hook private to the Image block and pass the block attributes\n\t// object so the callsite stays compact. Destructure only the attributes\n\t// currently used for metadata sync; add more here if the sync policy grows.\n\tconst { id, url, alt, caption } = attributes;\n\tconst registry = useRegistry();\n\tconst openMediaEditorModal = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()[ openMediaEditorModalKey ],\n\t\t[]\n\t);\n\t// Track the block's current attachment and metadata in a ref so\n\t// handleMediaUpdate can read the latest values without being listed as\n\t// dependencies (which would recreate the callback and re-register the\n\t// onUpdate handler on every block change while the modal is open).\n\tconst blockAttributesRef = useRef( {\n\t\tid,\n\t\turl,\n\t\talt,\n\t\tcaption: caption?.toString(),\n\t} );\n\t// Snapshot of the attachment's metadata taken just before the modal opens,\n\t// used as the baseline for detecting what changed during the editing session.\n\tconst mediaEditorMetadataBaselineRef = useRef();\n\t// Incremented on every handleMediaUpdate call; stale async continuations\n\t// check against this to bail out if a newer update has since started.\n\tconst mediaEditorMetadataSyncRequestRef = useRef( 0 );\n\n\tuseEffect( () => {\n\t\tblockAttributesRef.current = {\n\t\t\tid,\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption: caption?.toString(),\n\t\t};\n\t}, [ alt, caption, id, url ] );\n\n\t// Reads the cached attachment record. The `attachment` postType entity\n\t// fetches with `context: 'edit'` by default, so `getEditedEntityRecord`\n\t// returns the edit-context record — carrying `caption` as `{ raw }` and a\n\t// usable `alt_text` — without us specifying a context. It is resolver-\n\t// backed, so on a cold cache this also kicks off the fetch and returns a\n\t// falsy value synchronously; that resolution shares its cache key with the\n\t// `resolveAttachmentRecord` call below (both keyed on the no-query\n\t// `getEntityRecord`), so the two dedupe into a single request.\n\tconst getCachedAttachmentRecord = useCallback(\n\t\t( attachmentId ) =>\n\t\t\tregistry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t),\n\t\t[ registry ]\n\t);\n\n\tconst resolveAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\tconst resolveSelect = registry.resolveSelect( coreStore );\n\n\t\t\ttry {\n\t\t\t\treturn await resolveSelect.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\t[ registry ]\n\t);\n\n\tconst resolveFreshAttachmentRecord = useCallback(\n\t\tasync ( attachmentId ) => {\n\t\t\t// Invalidate the cached resolution so resolveAttachmentRecord\n\t\t\t// re-fetches the server state that reflects the media editor's\n\t\t\t// saved changes.\n\t\t\tconst { invalidateResolution } = registry.dispatch( coreStore );\n\n\t\t\tinvalidateResolution( 'getEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\tattachmentId,\n\t\t\t] );\n\t\t\treturn resolveAttachmentRecord( attachmentId );\n\t\t},\n\t\t[ registry, resolveAttachmentRecord ]\n\t);\n\n\tconst handleMediaUpdate = useCallback(\n\t\tasync ( { id: newId, url: newUrl } ) => {\n\t\t\tif ( typeof newId !== 'number' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Capture and clear the baseline so a rapid second save doesn't\n\t\t\t// reuse a stale snapshot.\n\t\t\tconst originalAttachment = mediaEditorMetadataBaselineRef.current;\n\t\t\tmediaEditorMetadataBaselineRef.current = undefined;\n\t\t\tconst syncRequest = ++mediaEditorMetadataSyncRequestRef.current;\n\t\t\tconst nextAttributes = {};\n\n\t\t\tconst currentBlockAttributes = blockAttributesRef.current;\n\n\t\t\tif ( newId !== currentBlockAttributes.id ) {\n\t\t\t\tnextAttributes.id = newId;\n\t\t\t\tnextAttributes.url = newUrl ?? currentBlockAttributes.url;\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\tid: nextAttributes.id,\n\t\t\t\t\turl: nextAttributes.url,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( originalAttachment ) {\n\t\t\t\t// Fetch fresh server state so the comparison reflects what\n\t\t\t\t// the media editor actually saved, not a potentially stale\n\t\t\t\t// cache.\n\t\t\t\tconst resolvedAttachment =\n\t\t\t\t\tawait resolveFreshAttachmentRecord( newId );\n\n\t\t\t\t// A newer update started while we were awaiting; discard\n\t\t\t\t// this one.\n\t\t\t\tif (\n\t\t\t\t\tsyncRequest !== mediaEditorMetadataSyncRequestRef.current\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Sync alt text and caption back to the block only when\n\t\t\t\t// they were changed in the media editor. Fields the user\n\t\t\t\t// has independently customised on the block (i.e. values\n\t\t\t\t// that don't match the pre-session attachment metadata)\n\t\t\t\t// are left untouched.\n\t\t\t\tconst latestBlockAttributes = blockAttributesRef.current;\n\t\t\t\tconst resolvedMetadataAttributes =\n\t\t\t\t\tgetSyncedImageBlockAttributes(\n\t\t\t\t\t\tlatestBlockAttributes,\n\t\t\t\t\t\toriginalAttachment,\n\t\t\t\t\t\tresolvedAttachment\n\t\t\t\t\t);\n\n\t\t\t\tif ( Object.keys( resolvedMetadataAttributes ).length ) {\n\t\t\t\t\tObject.assign( nextAttributes, resolvedMetadataAttributes );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( Object.keys( nextAttributes ).length ) {\n\t\t\t\tblockAttributesRef.current = {\n\t\t\t\t\t...blockAttributesRef.current,\n\t\t\t\t\t...nextAttributes,\n\t\t\t\t};\n\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t}\n\t\t},\n\t\t[ resolveFreshAttachmentRecord, setAttributes ]\n\t);\n\n\tconst openImageMediaEditorModal = useCallback( async () => {\n\t\tif ( ! id || ! openMediaEditorModal ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Snapshot the attachment's current metadata before the user makes\n\t\t// any changes so handleMediaUpdate can compare against it later. Use\n\t\t// the cached record when it's already present; only resolve when\n\t\t// nothing is cached yet, then fall back to a minimal object derived\n\t\t// from the block's own attributes.\n\t\tconst cachedAttachmentRecord = getCachedAttachmentRecord( id );\n\t\tconst fallbackAttachmentRecord =\n\t\t\tgetAttachmentFallbackForEmptyBlockMetadata(\n\t\t\t\tblockAttributesRef.current\n\t\t\t);\n\t\tconst resolvedAttachmentRecord = hasKnownAttachmentMetadata(\n\t\t\tcachedAttachmentRecord\n\t\t)\n\t\t\t? undefined\n\t\t\t: await resolveAttachmentRecord( id );\n\n\t\tmediaEditorMetadataBaselineRef.current =\n\t\t\tresolvedAttachmentRecord ||\n\t\t\t( hasKnownAttachmentMetadata( cachedAttachmentRecord )\n\t\t\t\t? cachedAttachmentRecord\n\t\t\t\t: fallbackAttachmentRecord ) ||\n\t\t\tcachedAttachmentRecord;\n\n\t\topenMediaEditorModal( {\n\t\t\tid,\n\t\t\tonUpdate: handleMediaUpdate,\n\t\t\tonClose,\n\t\t} );\n\t}, [\n\t\tgetCachedAttachmentRecord,\n\t\thandleMediaUpdate,\n\t\tid,\n\t\tonClose,\n\t\topenMediaEditorModal,\n\t\tresolveAttachmentRecord,\n\t] );\n\n\treturn id && openMediaEditorModal ? openImageMediaEditorModal : undefined;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AACnC,0BAGO;AACP,iBAAiD;AACjD,kBAAuC;AACvC,qBAA+C;AAK/C,yBAAuB;AAEvB,SAAS,2BAA4B,SAAU;AAC9C,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAEA,QAAM,kBAAc,WAAAA,qBAAW,OAAQ,EAAE,KAAK;AAE9C,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AAEA,SAAO,QAAQ,QAAS,OAAO,MAAO;AACvC;AAEA,SAAS,qBAAsB,YAAa;AAC3C,QAAM,UAAU,YAAY;AAE5B,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO,2BAA4B,OAAQ;AAAA,EAC5C;AAEA,MACC,WACA,OAAO,YAAY,YACnB,OAAO,OAAQ,SAAS,KAAM,GAC7B;AACD,WAAO,2BAA4B,QAAQ,GAAI;AAAA,EAChD;AAEA,SAAO;AACR;AAEO,SAAS,oCAAqC,YAAa;AACjE,SAAO;AAAA,IACN,KACC,OAAO,YAAY,aAAa,WAC7B,W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UAAM,2BAA2B;AAAA,MAChC;AAAA,IACD,IACG,SACA,MAAM,wBAAyB,EAAG;AAErC,mCAA+B,UAC9B,6BACE,2BAA4B,sBAAuB,IAClD,yBACA,6BACH;AAED,yBAAsB;AAAA,MACrB;AAAA,MACA,UAAU;AAAA,MACV;AAAA,IACD,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO,MAAM,uBAAuB,4BAA4B;AACjE;",
6
6
  "names": ["stripHTML", "blockEditorPrivateApis", "blockEditorStore", "coreStore"]
7
7
  }
@@ -98,7 +98,6 @@ var OrderedListSettings = ({ setAttributes, reversed, start, type }) => {
98
98
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
99
  import_components.TextControl,
100
100
  {
101
- __next40pxDefaultSize: true,
102
101
  label: (0, import_i18n.__)("Start value"),
103
102
  type: "number",
104
103
  onChange: (value) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/list/ordered-list-settings.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst LIST_STYLE_OPTIONS = [\n\t{\n\t\tlabel: __( 'Numbers' ),\n\t\tvalue: 'decimal',\n\t},\n\t{\n\t\tlabel: __( 'Uppercase letters' ),\n\t\tvalue: 'upper-alpha',\n\t},\n\t{\n\t\tlabel: __( 'Lowercase letters' ),\n\t\tvalue: 'lower-alpha',\n\t},\n\t{\n\t\tlabel: __( 'Uppercase Roman numerals' ),\n\t\tvalue: 'upper-roman',\n\t},\n\t{\n\t\tlabel: __( 'Lowercase Roman numerals' ),\n\t\tvalue: 'lower-roman',\n\t},\n];\n\nconst OrderedListSettings = ( { setAttributes, reversed, start, type } ) => {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\ttype: undefined,\n\t\t\t\t\t\tstart: undefined,\n\t\t\t\t\t\treversed: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'List style' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => !! type }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttype: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'List style' ) }\n\t\t\t\t\t\toptions={ LIST_STYLE_OPTIONS }\n\t\t\t\t\t\tvalue={ type || 'decimal' }\n\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { type: newValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Start value' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => !! start }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstart: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Start value' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tconst int = parseInt( value, 10 );\n\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t// It should be possible to unset the value,\n\t\t\t\t\t\t\t\t// e.g. with an empty string.\n\t\t\t\t\t\t\t\tstart: isNaN( int ) ? undefined : int,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tNumber.isInteger( start )\n\t\t\t\t\t\t\t\t? start.toString( 10 )\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Reverse order' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => !! reversed }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\treversed: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Reverse order' ) }\n\t\t\t\t\t\tchecked={ reversed || false }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t// Unset the attribute if not reversed.\n\t\t\t\t\t\t\t\treversed: value || undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default OrderedListSettings;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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AA;AAAA,YACA,WAAQ,gBAAI,aAAc;AAAA,YAC1B,kBAAgB;AAAA,YAChB,UAAW,MAAM,CAAC,CAAE;AAAA,YACpB,YAAa,MACZ,cAAe;AAAA,cACd,OAAO;AAAA,YACR,CAAE;AAAA,YAGH;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,WAAQ,gBAAI,aAAc;AAAA,gBAC1B,MAAK;AAAA,gBACL,UAAW,CAAE,UAAW;AACvB,wBAAM,MAAM,SAAU,OAAO,EAAG;AAEhC,gCAAe;AAAA;AAAA;AAAA,oBAGd,OAAO,MAAO,GAAI,IAAI,SAAY;AAAA,kBACnC,CAAE;AAAA,gBACH;AAAA,gBACA,OACC,OAAO,UAAW,KAAM,IACrB,MAAM,SAAU,EAAG,IACnB;AAAA,gBAEJ,MAAK;AAAA;AAAA,YACN;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC,kBAAAA;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,eAAgB;AAAA,YAC5B,kBAAgB;AAAA,YAChB,UAAW,MAAM,CAAC,CAAE;AAAA,YACpB,YAAa,MACZ,cAAe;AAAA,cACd,UAAU;AAAA,YACX,CAAE;AAAA,YAGH;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,eAAgB;AAAA,gBAC5B,SAAU,YAAY;AAAA,gBACtB,UAAW,CAAE,UAAW;AACvB,gCAAe;AAAA;AAAA,oBAEd,UAAU,SAAS;AAAA,kBACpB,CAAE;AAAA,gBACH;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,gCAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst LIST_STYLE_OPTIONS = [\n\t{\n\t\tlabel: __( 'Numbers' ),\n\t\tvalue: 'decimal',\n\t},\n\t{\n\t\tlabel: __( 'Uppercase letters' ),\n\t\tvalue: 'upper-alpha',\n\t},\n\t{\n\t\tlabel: __( 'Lowercase letters' ),\n\t\tvalue: 'lower-alpha',\n\t},\n\t{\n\t\tlabel: __( 'Uppercase Roman numerals' ),\n\t\tvalue: 'upper-roman',\n\t},\n\t{\n\t\tlabel: __( 'Lowercase Roman numerals' ),\n\t\tvalue: 'lower-roman',\n\t},\n];\n\nconst OrderedListSettings = ( { setAttributes, reversed, start, type } ) => {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\ttype: undefined,\n\t\t\t\t\t\tstart: undefined,\n\t\t\t\t\t\treversed: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'List style' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => !! type }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttype: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'List style' ) }\n\t\t\t\t\t\toptions={ LIST_STYLE_OPTIONS }\n\t\t\t\t\t\tvalue={ type || 'decimal' }\n\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\tsetAttributes( { type: newValue } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Start value' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => !! start }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstart: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Start value' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tconst int = parseInt( value, 10 );\n\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t// It should be possible to unset the value,\n\t\t\t\t\t\t\t\t// e.g. with an empty string.\n\t\t\t\t\t\t\t\tstart: isNaN( int ) ? undefined : int,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tNumber.isInteger( start )\n\t\t\t\t\t\t\t\t? start.toString( 10 )\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Reverse order' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => !! reversed }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\treversed: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Reverse order' ) }\n\t\t\t\t\t\tchecked={ reversed || false }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t// Unset the attribute if not reversed.\n\t\t\t\t\t\t\t\treversed: value || undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default OrderedListSettings;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAkC;AAClC,wBAMO;AAKP,mBAA+C;AA8B5C;AA5BH,IAAM,qBAAqB;AAAA,EAC1B;AAAA,IACC,WAAO,gBAAI,SAAU;AAAA,IACrB,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,mBAAoB;AAAA,IAC/B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,mBAAoB;AAAA,IAC/B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,0BAA2B;AAAA,IACtC,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,WAAO,gBAAI,0BAA2B;AAAA,IACtC,OAAO;AAAA,EACR;AACD;AAEA,IAAM,sBAAsB,CAAE,EAAE,eAAe,UAAU,OAAO,KAAK,MAAO;AAC3E,QAAM,wBAAoB,6CAA+B;AAEzD,SACC,4CAAC,yCACA;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,UAAW;AAAA,MACvB,UAAW,MAAM;AAChB,sBAAe;AAAA,UACd,MAAM;AAAA,UACN,OAAO;AAAA,UACP,UAAU;AAAA,QACX,CAAE;AAAA,MACH;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,YAAa;AAAA,YACzB,kBAAgB;AAAA,YAChB,UAAW,MAAM,CAAC,CAAE;AAAA,YACpB,YAAa,M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;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,gCAAQ;",
6
6
  "names": ["ToolsPanel", "ToolsPanelItem"]
7
7
  }
@@ -296,19 +296,24 @@ function Navigation({
296
296
  isInnerBlockSelected,
297
297
  innerBlocks
298
298
  } = (0, import_use_inner_blocks.useInnerBlocks)(clientId);
299
+ const {
300
+ replaceInnerBlocks,
301
+ selectBlock,
302
+ __unstableMarkNextChangeAsNotPersistent
303
+ } = (0, import_data.useDispatch)(import_block_editor.store);
299
304
  (0, import_element.useEffect)(() => {
300
- if ((isSelected || isInnerBlockSelected) && orientation === "horizontal" && submenuVisibility === "always") {
305
+ if (orientation === "horizontal" && submenuVisibility === "always") {
306
+ __unstableMarkNextChangeAsNotPersistent();
301
307
  setAttributes({
302
308
  submenuVisibility: "hover",
303
309
  showSubmenuIcon: true
304
310
  });
305
311
  }
306
312
  }, [
307
- isSelected,
308
- isInnerBlockSelected,
309
313
  orientation,
310
314
  submenuVisibility,
311
- setAttributes
315
+ setAttributes,
316
+ __unstableMarkNextChangeAsNotPersistent
312
317
  ]);
313
318
  const hasPageListWithSubmenuRef = (0, import_element.useRef)(false);
314
319
  const hasSubmenus = (0, import_data.useSelect)(
@@ -349,11 +354,6 @@ function Navigation({
349
354
  const hasOverlays = overlayTemplateParts?.some(
350
355
  (templatePart) => templatePart.area === import_constants.NAVIGATION_OVERLAY_TEMPLATE_PART_AREA
351
356
  ) ?? false;
352
- const {
353
- replaceInnerBlocks,
354
- selectBlock,
355
- __unstableMarkNextChangeAsNotPersistent
356
- } = (0, import_data.useDispatch)(import_block_editor.store);
357
357
  const [isResponsiveMenuOpen, setResponsiveMenuVisibility] = (0, import_element.useState)(false);
358
358
  const [overlayMenuPreview, setOverlayMenuPreview] = (0, import_element.useState)(false);
359
359
  const {