@wordpress/core-data 7.37.0 → 7.37.1-next.ba3aee3a2.0

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 (410) hide show
  1. package/CHANGELOG.md +0 -2
  2. package/LICENSE.md +1 -1
  3. package/README.md +0 -1
  4. package/build/{actions.js → actions.cjs} +8 -8
  5. package/build/batch/{create-batch.js → create-batch.cjs} +2 -2
  6. package/build/batch/{default-processor.js → default-processor.cjs} +1 -1
  7. package/build/batch/{index.js → index.cjs} +3 -3
  8. package/build/{dynamic-entities.js → dynamic-entities.cjs} +1 -1
  9. package/build/{entities.js → entities.cjs} +3 -3
  10. package/build/{entity-context.js → entity-context.cjs} +1 -1
  11. package/build/{entity-provider.js → entity-provider.cjs} +2 -2
  12. package/build/entity-types/{attachment.js → attachment.cjs} +1 -1
  13. package/build/entity-types/{base-entity-records.js → base-entity-records.cjs} +1 -1
  14. package/build/entity-types/{base.js → base.cjs} +1 -1
  15. package/build/entity-types/{comment.js → comment.cjs} +1 -1
  16. package/build/entity-types/{font-collection.js → font-collection.cjs} +1 -1
  17. package/build/entity-types/{font-family.js → font-family.cjs} +1 -1
  18. package/build/entity-types/{global-styles-revision.js → global-styles-revision.cjs} +1 -1
  19. package/build/entity-types/{helpers.js → helpers.cjs} +1 -1
  20. package/build/entity-types/{index.js → index.cjs} +1 -1
  21. package/build/entity-types/{menu-location.js → menu-location.cjs} +1 -1
  22. package/build/entity-types/{nav-menu-item.js → nav-menu-item.cjs} +1 -1
  23. package/build/entity-types/{nav-menu.js → nav-menu.cjs} +1 -1
  24. package/build/entity-types/{page.js → page.cjs} +1 -1
  25. package/build/entity-types/{plugin.js → plugin.cjs} +1 -1
  26. package/build/entity-types/{post-revision.js → post-revision.cjs} +1 -1
  27. package/build/entity-types/{post-status.js → post-status.cjs} +1 -1
  28. package/build/entity-types/{post.js → post.cjs} +1 -1
  29. package/build/entity-types/{settings.js → settings.cjs} +1 -1
  30. package/build/entity-types/{sidebar.js → sidebar.cjs} +1 -1
  31. package/build/entity-types/{taxonomy.js → taxonomy.cjs} +1 -1
  32. package/build/entity-types/{term.js → term.cjs} +1 -1
  33. package/build/entity-types/{theme.js → theme.cjs} +1 -1
  34. package/build/entity-types/{type.js → type.cjs} +1 -1
  35. package/build/entity-types/{user.js → user.cjs} +1 -1
  36. package/build/entity-types/{widget-type.js → widget-type.cjs} +1 -1
  37. package/build/entity-types/{widget.js → widget.cjs} +1 -1
  38. package/build/entity-types/{wp-template-part.js → wp-template-part.cjs} +1 -1
  39. package/build/entity-types/{wp-template.js → wp-template.cjs} +1 -1
  40. package/build/fetch/{__experimental-fetch-link-suggestions.js → __experimental-fetch-link-suggestions.cjs} +1 -1
  41. package/build/fetch/{__experimental-fetch-url-data.js → __experimental-fetch-url-data.cjs} +1 -1
  42. package/build/fetch/{index.js → index.cjs} +3 -3
  43. package/build/footnotes/{get-footnotes-order.js → get-footnotes-order.cjs} +2 -2
  44. package/build/footnotes/{get-rich-text-values-cached.js → get-rich-text-values-cached.cjs} +2 -2
  45. package/build/footnotes/{index.js → index.cjs} +2 -2
  46. package/build/hooks/{constants.js → constants.cjs} +1 -1
  47. package/build/hooks/{index.js → index.cjs} +7 -7
  48. package/build/hooks/{memoize.js → memoize.cjs} +1 -1
  49. package/build/hooks/{use-entity-block-editor.js → use-entity-block-editor.cjs} +4 -4
  50. package/build/hooks/{use-entity-id.js → use-entity-id.cjs} +2 -2
  51. package/build/hooks/{use-entity-prop.js → use-entity-prop.cjs} +3 -3
  52. package/build/hooks/{use-entity-record.js → use-entity-record.cjs} +3 -3
  53. package/build/hooks/{use-entity-record.js.map → use-entity-record.cjs.map} +2 -2
  54. package/build/hooks/{use-entity-records.js → use-entity-records.cjs} +5 -5
  55. package/build/hooks/{use-query-select.js → use-query-select.cjs} +3 -3
  56. package/build/hooks/{use-resource-permissions.js → use-resource-permissions.cjs} +4 -4
  57. package/build/{index.js → index.cjs} +24 -24
  58. package/build/{index.js.map → index.cjs.map} +1 -1
  59. package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
  60. package/build/locks/{actions.js → actions.cjs} +2 -2
  61. package/build/locks/{engine.js → engine.cjs} +3 -3
  62. package/build/locks/{reducer.js → reducer.cjs} +2 -2
  63. package/build/locks/{selectors.js → selectors.cjs} +2 -2
  64. package/build/locks/{utils.js → utils.cjs} +1 -1
  65. package/build/{name.js → name.cjs} +1 -1
  66. package/build/{private-actions.js → private-actions.cjs} +2 -2
  67. package/build/{private-apis.js → private-apis.cjs} +4 -4
  68. package/build/{private-selectors.js → private-selectors.cjs} +6 -6
  69. package/build/queried-data/{actions.js → actions.cjs} +1 -1
  70. package/build/queried-data/{get-query-parts.js → get-query-parts.cjs} +2 -2
  71. package/build/queried-data/{index.js → index.cjs} +6 -6
  72. package/build/queried-data/{index.js.map → index.cjs.map} +1 -1
  73. package/build/queried-data/{reducer.js → reducer.cjs} +4 -4
  74. package/build/queried-data/{selectors.js → selectors.cjs} +3 -3
  75. package/build/{reducer.js → reducer.cjs} +4 -4
  76. package/build/{resolvers.js → resolvers.cjs} +6 -6
  77. package/build/{selectors.js → selectors.cjs} +7 -7
  78. package/build/{selectors.js.map → selectors.cjs.map} +2 -2
  79. package/build/{sync.js → sync.cjs} +1 -1
  80. package/build/{types.js → types.cjs} +1 -1
  81. package/build/utils/{conservative-map-item.js → conservative-map-item.cjs} +1 -1
  82. package/build/utils/{crdt-blocks.js → crdt-blocks.cjs} +7 -6
  83. package/build/utils/{crdt-blocks.js.map → crdt-blocks.cjs.map} +2 -2
  84. package/build/utils/{crdt.js → crdt.cjs} +4 -4
  85. package/build/utils/{crdt.js.map → crdt.cjs.map} +2 -2
  86. package/build/utils/{forward-resolver.js → forward-resolver.cjs} +1 -1
  87. package/build/utils/{get-nested-value.js → get-nested-value.cjs} +1 -1
  88. package/build/utils/{get-normalized-comma-separable.js → get-normalized-comma-separable.cjs} +1 -1
  89. package/build/utils/{if-matching-action.js → if-matching-action.cjs} +1 -1
  90. package/build/utils/{index.js → index.cjs} +14 -14
  91. package/build/utils/{is-numeric-id.js → is-numeric-id.cjs} +1 -1
  92. package/build/utils/{is-raw-attribute.js → is-raw-attribute.cjs} +1 -1
  93. package/build/utils/{log-entity-deprecation.js → log-entity-deprecation.cjs} +2 -2
  94. package/build/utils/{on-sub-key.js → on-sub-key.cjs} +1 -1
  95. package/build/utils/{receive-intermediate-results.js → receive-intermediate-results.cjs} +2 -2
  96. package/build/utils/{replace-action.js → replace-action.cjs} +1 -1
  97. package/build/utils/{set-nested-value.js → set-nested-value.cjs} +1 -1
  98. package/build/utils/{user-permissions.js → user-permissions.cjs} +1 -1
  99. package/build/utils/{with-weak-map-cache.js → with-weak-map-cache.cjs} +1 -1
  100. package/build-module/{actions.js → actions.mjs} +8 -8
  101. package/build-module/batch/{create-batch.js → create-batch.mjs} +2 -2
  102. package/build-module/batch/{default-processor.js → default-processor.mjs} +1 -1
  103. package/build-module/batch/index.mjs +8 -0
  104. package/build-module/{dynamic-entities.js → dynamic-entities.mjs} +1 -1
  105. package/build-module/{entities.js → entities.mjs} +3 -3
  106. package/build-module/{entity-context.js → entity-context.mjs} +1 -1
  107. package/build-module/{entity-provider.js → entity-provider.mjs} +2 -2
  108. package/build-module/entity-types/attachment.mjs +1 -0
  109. package/build-module/entity-types/base-entity-records.mjs +1 -0
  110. package/build-module/entity-types/base.mjs +1 -0
  111. package/build-module/entity-types/comment.mjs +1 -0
  112. package/build-module/entity-types/font-collection.mjs +1 -0
  113. package/build-module/entity-types/font-family.mjs +1 -0
  114. package/build-module/entity-types/global-styles-revision.mjs +1 -0
  115. package/build-module/entity-types/helpers.mjs +1 -0
  116. package/build-module/entity-types/index.mjs +1 -0
  117. package/build-module/entity-types/menu-location.mjs +1 -0
  118. package/build-module/entity-types/nav-menu-item.mjs +1 -0
  119. package/build-module/entity-types/nav-menu.mjs +1 -0
  120. package/build-module/entity-types/page.mjs +1 -0
  121. package/build-module/entity-types/plugin.mjs +1 -0
  122. package/build-module/entity-types/post-revision.mjs +1 -0
  123. package/build-module/entity-types/post-status.mjs +1 -0
  124. package/build-module/entity-types/post.mjs +1 -0
  125. package/build-module/entity-types/settings.mjs +1 -0
  126. package/build-module/entity-types/sidebar.mjs +1 -0
  127. package/build-module/entity-types/taxonomy.mjs +1 -0
  128. package/build-module/entity-types/term.mjs +1 -0
  129. package/build-module/entity-types/theme.mjs +1 -0
  130. package/build-module/entity-types/type.mjs +1 -0
  131. package/build-module/entity-types/user.mjs +1 -0
  132. package/build-module/entity-types/widget-type.mjs +1 -0
  133. package/build-module/entity-types/widget.mjs +1 -0
  134. package/build-module/entity-types/wp-template-part.mjs +1 -0
  135. package/build-module/entity-types/wp-template.mjs +1 -0
  136. package/build-module/fetch/{__experimental-fetch-link-suggestions.js → __experimental-fetch-link-suggestions.mjs} +1 -1
  137. package/build-module/fetch/{__experimental-fetch-url-data.js → __experimental-fetch-url-data.mjs} +1 -1
  138. package/build-module/fetch/{index.js → index.mjs} +3 -3
  139. package/build-module/footnotes/{get-footnotes-order.js → get-footnotes-order.mjs} +2 -2
  140. package/build-module/footnotes/{get-rich-text-values-cached.js → get-rich-text-values-cached.mjs} +2 -2
  141. package/build-module/footnotes/{index.js → index.mjs} +2 -2
  142. package/build-module/hooks/{constants.js → constants.mjs} +1 -1
  143. package/build-module/hooks/{index.js → index.mjs} +7 -7
  144. package/build-module/hooks/{memoize.js → memoize.mjs} +1 -1
  145. package/build-module/hooks/{use-entity-block-editor.js → use-entity-block-editor.mjs} +4 -4
  146. package/build-module/hooks/{use-entity-id.js → use-entity-id.mjs} +2 -2
  147. package/build-module/hooks/{use-entity-prop.js → use-entity-prop.mjs} +3 -3
  148. package/build-module/hooks/{use-entity-record.js → use-entity-record.mjs} +3 -3
  149. package/build-module/hooks/{use-entity-record.js.map → use-entity-record.mjs.map} +2 -2
  150. package/build-module/hooks/{use-entity-records.js → use-entity-records.mjs} +5 -5
  151. package/build-module/hooks/{use-query-select.js → use-query-select.mjs} +3 -3
  152. package/build-module/hooks/{use-resource-permissions.js → use-resource-permissions.mjs} +4 -4
  153. package/build-module/{index.js → index.mjs} +19 -19
  154. package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
  155. package/build-module/locks/{actions.js → actions.mjs} +2 -2
  156. package/build-module/locks/{engine.js → engine.mjs} +3 -3
  157. package/build-module/locks/{reducer.js → reducer.mjs} +2 -2
  158. package/build-module/locks/{selectors.js → selectors.mjs} +2 -2
  159. package/build-module/locks/{utils.js → utils.mjs} +1 -1
  160. package/build-module/{name.js → name.mjs} +1 -1
  161. package/build-module/{private-actions.js → private-actions.mjs} +2 -2
  162. package/build-module/{private-apis.js → private-apis.mjs} +4 -4
  163. package/build-module/{private-selectors.js → private-selectors.mjs} +6 -6
  164. package/build-module/queried-data/{actions.js → actions.mjs} +1 -1
  165. package/build-module/queried-data/{get-query-parts.js → get-query-parts.mjs} +2 -2
  166. package/build-module/queried-data/index.mjs +8 -0
  167. package/build-module/queried-data/{reducer.js → reducer.mjs} +4 -4
  168. package/build-module/queried-data/{selectors.js → selectors.mjs} +3 -3
  169. package/build-module/{reducer.js → reducer.mjs} +4 -4
  170. package/build-module/{resolvers.js → resolvers.mjs} +6 -6
  171. package/build-module/{selectors.js → selectors.mjs} +7 -7
  172. package/build-module/{selectors.js.map → selectors.mjs.map} +2 -2
  173. package/build-module/{sync.js → sync.mjs} +1 -1
  174. package/build-module/types.mjs +1 -0
  175. package/build-module/utils/{conservative-map-item.js → conservative-map-item.mjs} +1 -1
  176. package/build-module/utils/{crdt-blocks.js → crdt-blocks.mjs} +7 -6
  177. package/build-module/utils/{crdt-blocks.js.map → crdt-blocks.mjs.map} +2 -2
  178. package/build-module/utils/{crdt.js → crdt.mjs} +4 -4
  179. package/build-module/utils/{crdt.js.map → crdt.mjs.map} +2 -2
  180. package/build-module/utils/{forward-resolver.js → forward-resolver.mjs} +1 -1
  181. package/build-module/utils/{get-nested-value.js → get-nested-value.mjs} +1 -1
  182. package/build-module/utils/{get-normalized-comma-separable.js → get-normalized-comma-separable.mjs} +1 -1
  183. package/build-module/utils/{if-matching-action.js → if-matching-action.mjs} +1 -1
  184. package/build-module/utils/{index.js → index.mjs} +14 -14
  185. package/build-module/utils/{is-numeric-id.js → is-numeric-id.mjs} +1 -1
  186. package/build-module/utils/{is-raw-attribute.js → is-raw-attribute.mjs} +1 -1
  187. package/build-module/utils/{log-entity-deprecation.js → log-entity-deprecation.mjs} +2 -2
  188. package/build-module/utils/{on-sub-key.js → on-sub-key.mjs} +1 -1
  189. package/build-module/utils/{receive-intermediate-results.js → receive-intermediate-results.mjs} +2 -2
  190. package/build-module/utils/{replace-action.js → replace-action.mjs} +1 -1
  191. package/build-module/utils/{set-nested-value.js → set-nested-value.mjs} +1 -1
  192. package/build-module/utils/{user-permissions.js → user-permissions.mjs} +1 -1
  193. package/build-module/utils/{with-weak-map-cache.js → with-weak-map-cache.mjs} +1 -1
  194. package/build-types/hooks/use-entity-record.d.ts +0 -1
  195. package/build-types/hooks/use-entity-record.d.ts.map +1 -1
  196. package/build-types/index.d.ts +9 -9
  197. package/build-types/index.d.ts.map +1 -1
  198. package/build-types/selectors.d.ts +2 -1
  199. package/build-types/selectors.d.ts.map +1 -1
  200. package/build-types/utils/crdt-blocks.d.ts.map +1 -1
  201. package/package.json +34 -24
  202. package/src/hooks/use-entity-record.ts +0 -1
  203. package/src/selectors.ts +11 -1
  204. package/src/utils/crdt-blocks.ts +8 -6
  205. package/src/utils/crdt.ts +3 -3
  206. package/src/utils/test/crdt-blocks.ts +99 -0
  207. package/src/utils/test/crdt.ts +42 -3
  208. package/build-module/batch/index.js +0 -8
  209. package/build-module/entity-types/attachment.js +0 -1
  210. package/build-module/entity-types/base-entity-records.js +0 -1
  211. package/build-module/entity-types/base.js +0 -1
  212. package/build-module/entity-types/comment.js +0 -1
  213. package/build-module/entity-types/font-collection.js +0 -1
  214. package/build-module/entity-types/font-family.js +0 -1
  215. package/build-module/entity-types/global-styles-revision.js +0 -1
  216. package/build-module/entity-types/helpers.js +0 -1
  217. package/build-module/entity-types/index.js +0 -1
  218. package/build-module/entity-types/menu-location.js +0 -1
  219. package/build-module/entity-types/nav-menu-item.js +0 -1
  220. package/build-module/entity-types/nav-menu.js +0 -1
  221. package/build-module/entity-types/page.js +0 -1
  222. package/build-module/entity-types/plugin.js +0 -1
  223. package/build-module/entity-types/post-revision.js +0 -1
  224. package/build-module/entity-types/post-status.js +0 -1
  225. package/build-module/entity-types/post.js +0 -1
  226. package/build-module/entity-types/settings.js +0 -1
  227. package/build-module/entity-types/sidebar.js +0 -1
  228. package/build-module/entity-types/taxonomy.js +0 -1
  229. package/build-module/entity-types/term.js +0 -1
  230. package/build-module/entity-types/theme.js +0 -1
  231. package/build-module/entity-types/type.js +0 -1
  232. package/build-module/entity-types/user.js +0 -1
  233. package/build-module/entity-types/widget-type.js +0 -1
  234. package/build-module/entity-types/widget.js +0 -1
  235. package/build-module/entity-types/wp-template-part.js +0 -1
  236. package/build-module/entity-types/wp-template.js +0 -1
  237. package/build-module/queried-data/index.js +0 -8
  238. package/build-module/types.js +0 -1
  239. package/tsconfig.json +0 -25
  240. package/tsconfig.tsbuildinfo +0 -1
  241. /package/build/{actions.js.map → actions.cjs.map} +0 -0
  242. /package/build/batch/{create-batch.js.map → create-batch.cjs.map} +0 -0
  243. /package/build/batch/{default-processor.js.map → default-processor.cjs.map} +0 -0
  244. /package/build/batch/{index.js.map → index.cjs.map} +0 -0
  245. /package/build/{dynamic-entities.js.map → dynamic-entities.cjs.map} +0 -0
  246. /package/build/{entities.js.map → entities.cjs.map} +0 -0
  247. /package/build/{entity-context.js.map → entity-context.cjs.map} +0 -0
  248. /package/build/{entity-provider.js.map → entity-provider.cjs.map} +0 -0
  249. /package/build/entity-types/{attachment.js.map → attachment.cjs.map} +0 -0
  250. /package/build/entity-types/{base-entity-records.js.map → base-entity-records.cjs.map} +0 -0
  251. /package/build/entity-types/{base.js.map → base.cjs.map} +0 -0
  252. /package/build/entity-types/{comment.js.map → comment.cjs.map} +0 -0
  253. /package/build/entity-types/{font-collection.js.map → font-collection.cjs.map} +0 -0
  254. /package/build/entity-types/{font-family.js.map → font-family.cjs.map} +0 -0
  255. /package/build/entity-types/{global-styles-revision.js.map → global-styles-revision.cjs.map} +0 -0
  256. /package/build/entity-types/{helpers.js.map → helpers.cjs.map} +0 -0
  257. /package/build/entity-types/{index.js.map → index.cjs.map} +0 -0
  258. /package/build/entity-types/{menu-location.js.map → menu-location.cjs.map} +0 -0
  259. /package/build/entity-types/{nav-menu-item.js.map → nav-menu-item.cjs.map} +0 -0
  260. /package/build/entity-types/{nav-menu.js.map → nav-menu.cjs.map} +0 -0
  261. /package/build/entity-types/{page.js.map → page.cjs.map} +0 -0
  262. /package/build/entity-types/{plugin.js.map → plugin.cjs.map} +0 -0
  263. /package/build/entity-types/{post-revision.js.map → post-revision.cjs.map} +0 -0
  264. /package/build/entity-types/{post-status.js.map → post-status.cjs.map} +0 -0
  265. /package/build/entity-types/{post.js.map → post.cjs.map} +0 -0
  266. /package/build/entity-types/{settings.js.map → settings.cjs.map} +0 -0
  267. /package/build/entity-types/{sidebar.js.map → sidebar.cjs.map} +0 -0
  268. /package/build/entity-types/{taxonomy.js.map → taxonomy.cjs.map} +0 -0
  269. /package/build/entity-types/{term.js.map → term.cjs.map} +0 -0
  270. /package/build/entity-types/{theme.js.map → theme.cjs.map} +0 -0
  271. /package/build/entity-types/{type.js.map → type.cjs.map} +0 -0
  272. /package/build/entity-types/{user.js.map → user.cjs.map} +0 -0
  273. /package/build/entity-types/{widget-type.js.map → widget-type.cjs.map} +0 -0
  274. /package/build/entity-types/{widget.js.map → widget.cjs.map} +0 -0
  275. /package/build/entity-types/{wp-template-part.js.map → wp-template-part.cjs.map} +0 -0
  276. /package/build/entity-types/{wp-template.js.map → wp-template.cjs.map} +0 -0
  277. /package/build/fetch/{__experimental-fetch-link-suggestions.js.map → __experimental-fetch-link-suggestions.cjs.map} +0 -0
  278. /package/build/fetch/{__experimental-fetch-url-data.js.map → __experimental-fetch-url-data.cjs.map} +0 -0
  279. /package/build/fetch/{index.js.map → index.cjs.map} +0 -0
  280. /package/build/footnotes/{get-footnotes-order.js.map → get-footnotes-order.cjs.map} +0 -0
  281. /package/build/footnotes/{get-rich-text-values-cached.js.map → get-rich-text-values-cached.cjs.map} +0 -0
  282. /package/build/footnotes/{index.js.map → index.cjs.map} +0 -0
  283. /package/build/hooks/{constants.js.map → constants.cjs.map} +0 -0
  284. /package/build/hooks/{index.js.map → index.cjs.map} +0 -0
  285. /package/build/hooks/{memoize.js.map → memoize.cjs.map} +0 -0
  286. /package/build/hooks/{use-entity-block-editor.js.map → use-entity-block-editor.cjs.map} +0 -0
  287. /package/build/hooks/{use-entity-id.js.map → use-entity-id.cjs.map} +0 -0
  288. /package/build/hooks/{use-entity-prop.js.map → use-entity-prop.cjs.map} +0 -0
  289. /package/build/hooks/{use-entity-records.js.map → use-entity-records.cjs.map} +0 -0
  290. /package/build/hooks/{use-query-select.js.map → use-query-select.cjs.map} +0 -0
  291. /package/build/hooks/{use-resource-permissions.js.map → use-resource-permissions.cjs.map} +0 -0
  292. /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
  293. /package/build/locks/{actions.js.map → actions.cjs.map} +0 -0
  294. /package/build/locks/{engine.js.map → engine.cjs.map} +0 -0
  295. /package/build/locks/{reducer.js.map → reducer.cjs.map} +0 -0
  296. /package/build/locks/{selectors.js.map → selectors.cjs.map} +0 -0
  297. /package/build/locks/{utils.js.map → utils.cjs.map} +0 -0
  298. /package/build/{name.js.map → name.cjs.map} +0 -0
  299. /package/build/{private-actions.js.map → private-actions.cjs.map} +0 -0
  300. /package/build/{private-apis.js.map → private-apis.cjs.map} +0 -0
  301. /package/build/{private-selectors.js.map → private-selectors.cjs.map} +0 -0
  302. /package/build/queried-data/{actions.js.map → actions.cjs.map} +0 -0
  303. /package/build/queried-data/{get-query-parts.js.map → get-query-parts.cjs.map} +0 -0
  304. /package/build/queried-data/{reducer.js.map → reducer.cjs.map} +0 -0
  305. /package/build/queried-data/{selectors.js.map → selectors.cjs.map} +0 -0
  306. /package/build/{reducer.js.map → reducer.cjs.map} +0 -0
  307. /package/build/{resolvers.js.map → resolvers.cjs.map} +0 -0
  308. /package/build/{sync.js.map → sync.cjs.map} +0 -0
  309. /package/build/{types.js.map → types.cjs.map} +0 -0
  310. /package/build/utils/{conservative-map-item.js.map → conservative-map-item.cjs.map} +0 -0
  311. /package/build/utils/{forward-resolver.js.map → forward-resolver.cjs.map} +0 -0
  312. /package/build/utils/{get-nested-value.js.map → get-nested-value.cjs.map} +0 -0
  313. /package/build/utils/{get-normalized-comma-separable.js.map → get-normalized-comma-separable.cjs.map} +0 -0
  314. /package/build/utils/{if-matching-action.js.map → if-matching-action.cjs.map} +0 -0
  315. /package/build/utils/{index.js.map → index.cjs.map} +0 -0
  316. /package/build/utils/{is-numeric-id.js.map → is-numeric-id.cjs.map} +0 -0
  317. /package/build/utils/{is-raw-attribute.js.map → is-raw-attribute.cjs.map} +0 -0
  318. /package/build/utils/{log-entity-deprecation.js.map → log-entity-deprecation.cjs.map} +0 -0
  319. /package/build/utils/{on-sub-key.js.map → on-sub-key.cjs.map} +0 -0
  320. /package/build/utils/{receive-intermediate-results.js.map → receive-intermediate-results.cjs.map} +0 -0
  321. /package/build/utils/{replace-action.js.map → replace-action.cjs.map} +0 -0
  322. /package/build/utils/{set-nested-value.js.map → set-nested-value.cjs.map} +0 -0
  323. /package/build/utils/{user-permissions.js.map → user-permissions.cjs.map} +0 -0
  324. /package/build/utils/{with-weak-map-cache.js.map → with-weak-map-cache.cjs.map} +0 -0
  325. /package/build-module/{actions.js.map → actions.mjs.map} +0 -0
  326. /package/build-module/batch/{create-batch.js.map → create-batch.mjs.map} +0 -0
  327. /package/build-module/batch/{default-processor.js.map → default-processor.mjs.map} +0 -0
  328. /package/build-module/batch/{index.js.map → index.mjs.map} +0 -0
  329. /package/build-module/{dynamic-entities.js.map → dynamic-entities.mjs.map} +0 -0
  330. /package/build-module/{entities.js.map → entities.mjs.map} +0 -0
  331. /package/build-module/{entity-context.js.map → entity-context.mjs.map} +0 -0
  332. /package/build-module/{entity-provider.js.map → entity-provider.mjs.map} +0 -0
  333. /package/build-module/entity-types/{attachment.js.map → attachment.mjs.map} +0 -0
  334. /package/build-module/entity-types/{base-entity-records.js.map → base-entity-records.mjs.map} +0 -0
  335. /package/build-module/entity-types/{base.js.map → base.mjs.map} +0 -0
  336. /package/build-module/entity-types/{comment.js.map → comment.mjs.map} +0 -0
  337. /package/build-module/entity-types/{font-collection.js.map → font-collection.mjs.map} +0 -0
  338. /package/build-module/entity-types/{font-family.js.map → font-family.mjs.map} +0 -0
  339. /package/build-module/entity-types/{global-styles-revision.js.map → global-styles-revision.mjs.map} +0 -0
  340. /package/build-module/entity-types/{helpers.js.map → helpers.mjs.map} +0 -0
  341. /package/build-module/entity-types/{index.js.map → index.mjs.map} +0 -0
  342. /package/build-module/entity-types/{menu-location.js.map → menu-location.mjs.map} +0 -0
  343. /package/build-module/entity-types/{nav-menu-item.js.map → nav-menu-item.mjs.map} +0 -0
  344. /package/build-module/entity-types/{nav-menu.js.map → nav-menu.mjs.map} +0 -0
  345. /package/build-module/entity-types/{page.js.map → page.mjs.map} +0 -0
  346. /package/build-module/entity-types/{plugin.js.map → plugin.mjs.map} +0 -0
  347. /package/build-module/entity-types/{post-revision.js.map → post-revision.mjs.map} +0 -0
  348. /package/build-module/entity-types/{post-status.js.map → post-status.mjs.map} +0 -0
  349. /package/build-module/entity-types/{post.js.map → post.mjs.map} +0 -0
  350. /package/build-module/entity-types/{settings.js.map → settings.mjs.map} +0 -0
  351. /package/build-module/entity-types/{sidebar.js.map → sidebar.mjs.map} +0 -0
  352. /package/build-module/entity-types/{taxonomy.js.map → taxonomy.mjs.map} +0 -0
  353. /package/build-module/entity-types/{term.js.map → term.mjs.map} +0 -0
  354. /package/build-module/entity-types/{theme.js.map → theme.mjs.map} +0 -0
  355. /package/build-module/entity-types/{type.js.map → type.mjs.map} +0 -0
  356. /package/build-module/entity-types/{user.js.map → user.mjs.map} +0 -0
  357. /package/build-module/entity-types/{widget-type.js.map → widget-type.mjs.map} +0 -0
  358. /package/build-module/entity-types/{widget.js.map → widget.mjs.map} +0 -0
  359. /package/build-module/entity-types/{wp-template-part.js.map → wp-template-part.mjs.map} +0 -0
  360. /package/build-module/entity-types/{wp-template.js.map → wp-template.mjs.map} +0 -0
  361. /package/build-module/fetch/{__experimental-fetch-link-suggestions.js.map → __experimental-fetch-link-suggestions.mjs.map} +0 -0
  362. /package/build-module/fetch/{__experimental-fetch-url-data.js.map → __experimental-fetch-url-data.mjs.map} +0 -0
  363. /package/build-module/fetch/{index.js.map → index.mjs.map} +0 -0
  364. /package/build-module/footnotes/{get-footnotes-order.js.map → get-footnotes-order.mjs.map} +0 -0
  365. /package/build-module/footnotes/{get-rich-text-values-cached.js.map → get-rich-text-values-cached.mjs.map} +0 -0
  366. /package/build-module/footnotes/{index.js.map → index.mjs.map} +0 -0
  367. /package/build-module/hooks/{constants.js.map → constants.mjs.map} +0 -0
  368. /package/build-module/hooks/{index.js.map → index.mjs.map} +0 -0
  369. /package/build-module/hooks/{memoize.js.map → memoize.mjs.map} +0 -0
  370. /package/build-module/hooks/{use-entity-block-editor.js.map → use-entity-block-editor.mjs.map} +0 -0
  371. /package/build-module/hooks/{use-entity-id.js.map → use-entity-id.mjs.map} +0 -0
  372. /package/build-module/hooks/{use-entity-prop.js.map → use-entity-prop.mjs.map} +0 -0
  373. /package/build-module/hooks/{use-entity-records.js.map → use-entity-records.mjs.map} +0 -0
  374. /package/build-module/hooks/{use-query-select.js.map → use-query-select.mjs.map} +0 -0
  375. /package/build-module/hooks/{use-resource-permissions.js.map → use-resource-permissions.mjs.map} +0 -0
  376. /package/build-module/{index.js.map → index.mjs.map} +0 -0
  377. /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
  378. /package/build-module/locks/{actions.js.map → actions.mjs.map} +0 -0
  379. /package/build-module/locks/{engine.js.map → engine.mjs.map} +0 -0
  380. /package/build-module/locks/{reducer.js.map → reducer.mjs.map} +0 -0
  381. /package/build-module/locks/{selectors.js.map → selectors.mjs.map} +0 -0
  382. /package/build-module/locks/{utils.js.map → utils.mjs.map} +0 -0
  383. /package/build-module/{name.js.map → name.mjs.map} +0 -0
  384. /package/build-module/{private-actions.js.map → private-actions.mjs.map} +0 -0
  385. /package/build-module/{private-apis.js.map → private-apis.mjs.map} +0 -0
  386. /package/build-module/{private-selectors.js.map → private-selectors.mjs.map} +0 -0
  387. /package/build-module/queried-data/{actions.js.map → actions.mjs.map} +0 -0
  388. /package/build-module/queried-data/{get-query-parts.js.map → get-query-parts.mjs.map} +0 -0
  389. /package/build-module/queried-data/{index.js.map → index.mjs.map} +0 -0
  390. /package/build-module/queried-data/{reducer.js.map → reducer.mjs.map} +0 -0
  391. /package/build-module/queried-data/{selectors.js.map → selectors.mjs.map} +0 -0
  392. /package/build-module/{reducer.js.map → reducer.mjs.map} +0 -0
  393. /package/build-module/{resolvers.js.map → resolvers.mjs.map} +0 -0
  394. /package/build-module/{sync.js.map → sync.mjs.map} +0 -0
  395. /package/build-module/{types.js.map → types.mjs.map} +0 -0
  396. /package/build-module/utils/{conservative-map-item.js.map → conservative-map-item.mjs.map} +0 -0
  397. /package/build-module/utils/{forward-resolver.js.map → forward-resolver.mjs.map} +0 -0
  398. /package/build-module/utils/{get-nested-value.js.map → get-nested-value.mjs.map} +0 -0
  399. /package/build-module/utils/{get-normalized-comma-separable.js.map → get-normalized-comma-separable.mjs.map} +0 -0
  400. /package/build-module/utils/{if-matching-action.js.map → if-matching-action.mjs.map} +0 -0
  401. /package/build-module/utils/{index.js.map → index.mjs.map} +0 -0
  402. /package/build-module/utils/{is-numeric-id.js.map → is-numeric-id.mjs.map} +0 -0
  403. /package/build-module/utils/{is-raw-attribute.js.map → is-raw-attribute.mjs.map} +0 -0
  404. /package/build-module/utils/{log-entity-deprecation.js.map → log-entity-deprecation.mjs.map} +0 -0
  405. /package/build-module/utils/{on-sub-key.js.map → on-sub-key.mjs.map} +0 -0
  406. /package/build-module/utils/{receive-intermediate-results.js.map → receive-intermediate-results.mjs.map} +0 -0
  407. /package/build-module/utils/{replace-action.js.map → replace-action.mjs.map} +0 -0
  408. /package/build-module/utils/{set-nested-value.js.map → set-nested-value.mjs.map} +0 -0
  409. /package/build-module/utils/{user-permissions.js.map → user-permissions.mjs.map} +0 -0
  410. /package/build-module/utils/{with-weak-map-cache.js.map → with-weak-map-cache.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/selectors.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport {\n\tgetQueriedItems,\n\tgetQueriedTotalItems,\n\tgetQueriedTotalPages,\n} from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getUndoManager } from './private-selectors';\nimport {\n\tgetNormalizedCommaSeparable,\n\tisRawAttribute,\n\tsetNestedValue,\n\tisNumericID,\n\tgetUserPermissionCacheKey,\n} from './utils';\nimport type * as ET from './entity-types';\nimport type { UndoManager } from '@wordpress/undo-manager';\nimport logEntityDeprecation from './utils/log-entity-deprecation';\n\n// This is an incomplete, high-level approximation of the State type.\n// It makes the selectors slightly more safe, but is intended to evolve\n// into a more detailed representation over time.\n// See https://github.com/WordPress/gutenberg/pull/40025#discussion_r865410589 for more context.\nexport interface State {\n\tautosaves: Record< string | number, Array< unknown > >;\n\tblockPatterns: Array< unknown >;\n\tblockPatternCategories: Array< unknown >;\n\tcurrentGlobalStylesId: string;\n\tcurrentTheme: string;\n\tcurrentUser: ET.User< 'view' >;\n\tembedPreviews: Record< string, { html: string } >;\n\tentities: EntitiesState;\n\tthemeBaseGlobalStyles: Record< string, Object >;\n\tthemeGlobalStyleVariations: Record< string, string >;\n\tthemeGlobalStyleRevisions: Record< number, Object >;\n\tundoManager: UndoManager;\n\tuserPermissions: Record< string, boolean >;\n\tusers: UserState;\n\tnavigationFallbackId: EntityRecordKey;\n\tuserPatternCategories: Array< UserPatternCategory >;\n\tdefaultTemplates: Record< string, string >;\n\tregisteredPostMeta: Record< string, Object >;\n\teditorSettings: Record< string, any > | null;\n\teditorAssets: Record< string, any > | null;\n}\n\ntype EntityRecordKey = string | number;\n\ninterface EntitiesState {\n\tconfig: EntityConfig[];\n\trecords: Record< string, Record< string, EntityState< ET.EntityRecord > > >;\n}\n\ninterface QueriedData {\n\titems: Record< ET.Context, Record< number, ET.EntityRecord > >;\n\titemIsComplete: Record< ET.Context, Record< number, boolean > >;\n\tqueries: Record< ET.Context, Record< string, Array< number > > >;\n}\n\ntype RevisionRecord =\n\t| Record< ET.Context, Record< number, ET.PostRevision > >\n\t| Record< ET.Context, Record< number, ET.GlobalStylesRevision > >;\n\ninterface RevisionsQueriedData {\n\titems: RevisionRecord;\n\titemIsComplete: Record< ET.Context, Record< number, boolean > >;\n\tqueries: Record< ET.Context, Record< string, Array< number > > >;\n}\n\ninterface EntityState< EntityRecord extends ET.EntityRecord > {\n\tedits: Record< string, Partial< EntityRecord > >;\n\tsaving: Record<\n\t\tstring,\n\t\tPartial< { pending: boolean; isAutosave: boolean; error: Error } >\n\t>;\n\tdeleting: Record< string, Partial< { pending: boolean; error: Error } > >;\n\tqueriedData: QueriedData;\n\trevisions?: RevisionsQueriedData;\n}\n\ninterface EntityConfig {\n\tname: string;\n\tkind: string;\n}\n\ninterface UserState {\n\tqueries: Record< string, EntityRecordKey[] >;\n\tbyId: Record< EntityRecordKey, ET.User< 'edit' > >;\n}\n\ntype TemplateQuery = {\n\tslug?: string;\n\tis_custom?: boolean;\n\tignore_empty?: boolean;\n};\n\nexport interface UserPatternCategory {\n\tid: number;\n\tname: string;\n\tlabel: string;\n\tslug: string;\n\tdescription: string;\n}\n\ntype Optional< T > = T | undefined;\n\n/**\n * HTTP Query parameters sent with the API request to fetch the entity records.\n */\nexport type GetRecordsHttpQuery = Record< string, any >;\n\n/**\n * Arguments for EntityRecord selectors.\n */\ntype EntityRecordArgs =\n\t| [ string, string, EntityRecordKey ]\n\t| [ string, string, EntityRecordKey, GetRecordsHttpQuery ];\n\ntype EntityResource = { kind: string; name: string; id?: EntityRecordKey };\n\n/**\n * Shared reference to an empty object for cases where it is important to avoid\n * returning a new object reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n */\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param state Data state.\n * @param url URL the preview would be for.\n *\n * @return Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select: any ) =>\n\t\t( state: State, url: string ): boolean => {\n\t\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [\n\t\t\t\turl,\n\t\t\t] );\n\t\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param state Data state.\n * @param query Optional object of query parameters to\n * include with request. For valid query parameters see the [Users page](https://developer.wordpress.org/rest-api/reference/users/) in the REST API Handbook and see the arguments for [List Users](https://developer.wordpress.org/rest-api/reference/users/#list-users) and [Retrieve a User](https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user).\n * @return Authors list.\n */\nexport function getAuthors(\n\tstate: State,\n\tquery?: GetRecordsHttpQuery\n): ET.User[] {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param state Data state.\n *\n * @return Current user object.\n */\nexport function getCurrentUser( state: State ): ET.User< 'view' > {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param state Data state.\n * @param queryID Query ID.\n *\n * @return Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state: State, queryID: string ): ET.User< 'edit' >[] => {\n\t\tconst queryResults = state.users.queries[ queryID ] ?? [];\n\n\t\treturn queryResults.map( ( id ) => state.users.byId[ id ] );\n\t},\n\t( state: State, queryID: string ) => [\n\t\tstate.users.queries[ queryID ],\n\t\tstate.users.byId,\n\t]\n);\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @deprecated since WordPress 6.0. Use getEntitiesConfig instead\n * @param state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state: State, kind: string ): Array< any > {\n\tdeprecated( \"wp.data.select( 'core' ).getEntitiesByKind()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntitiesConfig()\",\n\t} );\n\treturn getEntitiesConfig( state, kind );\n}\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @param state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport const getEntitiesConfig = createSelector(\n\t( state: State, kind: string ): Array< any > =>\n\t\tstate.entities.config.filter( ( entity ) => entity.kind === kind ),\n\t/* eslint-disable @typescript-eslint/no-unused-vars */\n\t( state: State, kind: string ) => state.entities.config\n\t/* eslint-enable @typescript-eslint/no-unused-vars */\n);\n/**\n * Returns the entity config given its kind and name.\n *\n * @deprecated since WordPress 6.0. Use getEntityConfig instead\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntity( state: State, kind: string, name: string ): any {\n\tdeprecated( \"wp.data.select( 'core' ).getEntity()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntityConfig()\",\n\t} );\n\treturn getEntityConfig( state, kind, name );\n}\n\n/**\n * Returns the entity config given its kind and name.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntityConfig(\n\tstate: State,\n\tkind: string,\n\tname: string\n): any {\n\tlogEntityDeprecation( kind, name, 'getEntityConfig' );\n\n\treturn state.entities.config?.find(\n\t\t( config ) => config.kind === kind && config.name === name\n\t);\n}\n\n/**\n * GetEntityRecord is declared as a *callable interface* with\n * two signatures to work around the fact that TypeScript doesn't\n * allow currying generic functions:\n *\n * ```ts\n * \t\ttype CurriedState = F extends ( state: any, ...args: infer P ) => infer R\n * \t\t\t? ( ...args: P ) => R\n * \t\t\t: F;\n * \t\ttype Selector = <K extends string | number>(\n * state: any,\n * kind: K,\n * key: K extends string ? 'string value' : false\n * ) => K;\n * \t\ttype BadlyInferredSignature = CurriedState< Selector >\n * // BadlyInferredSignature evaluates to:\n * // (kind: string number, key: false | \"string value\") => string number\n * ```\n *\n * The signature without the state parameter shipped as CurriedSignature\n * is used in the return value of `select( coreStore )`.\n *\n * See https://github.com/WordPress/gutenberg/pull/41578 for more details.\n */\nexport interface GetEntityRecord {\n\t<\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey?: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord | undefined;\n\n\tCurriedSignature: <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tkind: string,\n\t\tname: string,\n\t\tkey?: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => EntityRecord | undefined;\n\t__unstableNormalizeArgs?: ( args: EntityRecordArgs ) => EntityRecordArgs;\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included.\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available \"Retrieve a [Entity kind]\".\n *\n * @return Record.\n */\nexport const getEntityRecord = createSelector(\n\t( <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey?: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord | undefined => {\n\t\tlogEntityDeprecation( kind, name, 'getEntityRecord' );\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( ! query || ! query._fields ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( ! item ) {\n\t\t\treturn item;\n\t\t}\n\n\t\tconst filteredItem = {};\n\t\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\tlet value = item;\n\t\t\tfield.forEach( ( fieldName ) => {\n\t\t\t\tvalue = value?.[ fieldName ];\n\t\t\t} );\n\t\t\tsetNestedValue( filteredItem, field, value );\n\t\t}\n\t\treturn filteredItem as EntityRecord;\n\t} ) as GetEntityRecord,\n\t( state: State, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\t\treturn [\n\t\t\tqueriedState?.items[ context ]?.[ recordId ],\n\t\t\tqueriedState?.itemIsComplete[ context ]?.[ recordId ],\n\t\t];\n\t}\n) as GetEntityRecord;\n\n/**\n * Normalizes `recordKey`s that look like numeric IDs to numbers.\n *\n * @param args EntityRecordArgs the selector arguments.\n * @return EntityRecordArgs the normalized arguments.\n */\ngetEntityRecord.__unstableNormalizeArgs = (\n\targs: EntityRecordArgs\n): EntityRecordArgs => {\n\tconst newArgs = [ ...args ] as EntityRecordArgs;\n\tconst recordKey = newArgs?.[ 2 ];\n\n\t// If recordKey looks to be a numeric ID then coerce to number.\n\tnewArgs[ 2 ] = isNumericID( recordKey ) ? Number( recordKey ) : recordKey;\n\n\treturn newArgs;\n};\n\n/**\n * Returns true if a record has been received for the given set of parameters, or false otherwise.\n *\n * Note: This action does not trigger a request for the entity record from the API\n * if it's not available in the local state.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key.\n * @param query Optional query.\n *\n * @return Whether an entity record has been received.\n */\nexport function hasEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tkey?: EntityRecordKey,\n\tquery?: GetRecordsHttpQuery\n): boolean {\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn false;\n\t}\n\tconst context = query?.context ?? 'default';\n\n\t// If expecting a complete item, validate that completeness.\n\tif ( ! query || ! query._fields ) {\n\t\treturn !! queriedState.itemIsComplete[ context ]?.[ key ];\n\t}\n\n\tconst item = queriedState.items[ context ]?.[ key ];\n\tif ( ! item ) {\n\t\treturn false;\n\t}\n\n\t// When `query._fields` is provided, check that each requested field exists,\n\t// including any nested paths, on the item; return false if any part is missing.\n\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\tfor ( let i = 0; i < fields.length; i++ ) {\n\t\tconst path = fields[ i ].split( '.' );\n\t\tlet value = item;\n\t\tfor ( let p = 0; p < path.length; p++ ) {\n\t\t\tconst part = path[ p ];\n\t\t\tif ( ! value || ! Object.hasOwn( value, part ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvalue = value[ part ];\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key\n *\n * @return Record.\n */\nexport function __experimentalGetEntityRecordNoResolver<\n\tEntityRecord extends ET.EntityRecord< any >,\n>( state: State, kind: string, name: string, key: EntityRecordKey ) {\n\treturn getEntityRecord< EntityRecord >( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key.\n *\n * @return Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t< EntityRecord extends ET.EntityRecord< any > >(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey: EntityRecordKey\n\t): EntityRecord | undefined => {\n\t\tlogEntityDeprecation( kind, name, 'getRawEntityRecord' );\n\n\t\tconst record = getEntityRecord< EntityRecord >(\n\t\t\tstate,\n\t\t\tkind,\n\t\t\tname,\n\t\t\tkey\n\t\t);\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif (\n\t\t\t\t\tisRawAttribute( getEntityConfig( state, kind, name ), _key )\n\t\t\t\t) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] =\n\t\t\t\t\t\trecord[ _key ]?.raw !== undefined\n\t\t\t\t\t\t\t? record[ _key ]?.raw\n\t\t\t\t\t\t\t: record[ _key ];\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} as any )\n\t\t);\n\t},\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData?.items[\n\t\t\t\tcontext\n\t\t\t]?.[ recordId ],\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData\n\t\t\t\t?.itemIsComplete[ context ]?.[ recordId ],\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return Whether entity records have been received.\n */\nexport function hasEntityRecords(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery?: GetRecordsHttpQuery\n): boolean {\n\tlogEntityDeprecation( kind, name, 'hasEntityRecords' );\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * GetEntityRecord is declared as a *callable interface* with\n * two signatures to work around the fact that TypeScript doesn't\n * allow currying generic functions.\n *\n * @see GetEntityRecord\n * @see https://github.com/WordPress/gutenberg/pull/41578\n */\nexport interface GetEntityRecords {\n\t<\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord[] | null;\n\n\tCurriedSignature: <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tkind: string,\n\t\tname: string,\n\t\tquery?: GetRecordsHttpQuery\n\t) => EntityRecord[] | null;\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return Records.\n */\nexport const getEntityRecords = ( <\n\tEntityRecord extends\n\t\t| ET.EntityRecord< any >\n\t\t| Partial< ET.EntityRecord< any > >,\n>(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery: GetRecordsHttpQuery\n): EntityRecord[] | null => {\n\tlogEntityDeprecation( kind, name, 'getEntityRecords' );\n\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedItems( queriedState, query );\n} ) as GetEntityRecords;\n\n/**\n * Returns the Entity's total available records for a given query (ignoring pagination).\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return number | null.\n */\nexport const getEntityRecordsTotalItems = (\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery: GetRecordsHttpQuery\n): number | null => {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordsTotalItems' );\n\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedTotalItems( queriedState, query );\n};\n\n/**\n * Returns the number of available pages for the given query.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return number | null.\n */\nexport const getEntityRecordsTotalPages = (\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery: GetRecordsHttpQuery\n): number | null => {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordsTotalPages' );\n\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\tif ( query?.per_page === -1 ) {\n\t\treturn 1;\n\t}\n\tconst totalItems = getQueriedTotalItems( queriedState, query );\n\tif ( ! totalItems ) {\n\t\treturn totalItems;\n\t}\n\t// If `per_page` is not set and the query relies on the defaults of the\n\t// REST endpoint, get the info from query's meta.\n\tif ( ! query?.per_page ) {\n\t\treturn getQueriedTotalPages( queriedState, query );\n\t}\n\treturn Math.ceil( totalItems / query.per_page );\n};\n\ntype DirtyEntityRecord = {\n\ttitle: string;\n\tkey: EntityRecordKey;\n\tname: string;\n\tkind: string;\n};\n/**\n * Returns the list of dirty entity records.\n *\n * @param state State tree.\n *\n * @return The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst dirtyRecords: DirtyEntityRecord[] = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = (\n\t\t\t\t\tObject.keys( records[ kind ][ name ].edits ) as string[]\n\t\t\t\t ).filter(\n\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\tgetEntityRecord( state, kind, name, primaryKey ) &&\n\t\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey: entityRecord\n\t\t\t\t\t\t\t\t? entityRecord[\n\t\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param state State tree.\n *\n * @return The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst recordsBeingSaved: DirtyEntityRecord[] = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = (\n\t\t\t\t\tObject.keys( records[ kind ][ name ].saving ) as string[]\n\t\t\t\t ).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey: entityRecord\n\t\t\t\t\t\t\t\t? entityRecord[\n\t\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's edits.\n */\nexport function getEntityRecordEdits(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): Optional< any > {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordEdits' );\n\treturn state.entities.records?.[ kind ]?.[ name ]?.edits?.[\n\t\trecordId as string | number\n\t];\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey\n\t): Optional< any > => {\n\t\tlogEntityDeprecation( kind, name, 'getEntityRecordNonTransientEdits' );\n\t\tconst { transientEdits } = getEntityConfig( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state: State, kind: string, name: string, recordId: EntityRecordKey ) => [\n\t\tstate.entities.config,\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.edits?.[ recordId ],\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'hasEditsForEntityRecord' );\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t< EntityRecord extends ET.EntityRecord< any > >(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey\n\t): ET.Updatable< EntityRecord > | false => {\n\t\tlogEntityDeprecation( kind, name, 'getEditedEntityRecord' );\n\t\tconst raw = getRawEntityRecord( state, kind, name, recordId );\n\t\tconst edited = getEntityRecordEdits( state, kind, name, recordId );\n\t\t// Never return a non-falsy empty object. Unfortunately we can't return\n\t\t// undefined or null because we were previously returning an empty\n\t\t// object, so trying to read properties from the result would throw.\n\t\t// Using false here is a workaround to avoid breaking changes.\n\t\tif ( ! raw && ! edited ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn {\n\t\t\t...raw,\n\t\t\t...edited,\n\t\t};\n\t},\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData.items[\n\t\t\t\tcontext\n\t\t\t]?.[ recordId ],\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData\n\t\t\t\t.itemIsComplete[ context ]?.[ recordId ],\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.edits?.[ recordId ],\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'isAutosavingEntityRecord' );\n\tconst { pending, isAutosave } =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.saving?.[ recordId ] ?? {};\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'isSavingEntityRecord' );\n\treturn (\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.saving?.[\n\t\t\trecordId as EntityRecordKey\n\t\t]?.pending ?? false\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'isDeletingEntityRecord' );\n\treturn (\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.deleting?.[\n\t\t\trecordId as EntityRecordKey\n\t\t]?.pending ?? false\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntitySaveError(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): any {\n\tlogEntityDeprecation( kind, name, 'getLastEntitySaveError' );\n\treturn state.entities.records?.[ kind ]?.[ name ]?.saving?.[ recordId ]\n\t\t?.error;\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntityDeleteError(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): any {\n\tlogEntityDeprecation( kind, name, 'getLastEntityDeleteError' );\n\treturn state.entities.records?.[ kind ]?.[ name ]?.deleting?.[ recordId ]\n\t\t?.error;\n}\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @deprecated since 6.3\n *\n * @param state State tree.\n *\n * @return The edit.\n */\nexport function getUndoEdit( state: State ): Optional< any > {\n\tdeprecated( \"select( 'core' ).getUndoEdit()\", {\n\t\tsince: '6.3',\n\t} );\n\treturn undefined;\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @deprecated since 6.3\n *\n * @param state State tree.\n *\n * @return The edit.\n */\nexport function getRedoEdit( state: State ): Optional< any > {\n\tdeprecated( \"select( 'core' ).getRedoEdit()\", {\n\t\tsince: '6.3',\n\t} );\n\treturn undefined;\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param state State tree.\n *\n * @return Whether there is a previous edit or not.\n */\nexport function hasUndo( state: State ): boolean {\n\treturn getUndoManager( state ).hasUndo();\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param state State tree.\n *\n * @return Whether there is a next edit or not.\n */\nexport function hasRedo( state: State ): boolean {\n\treturn getUndoManager( state ).hasRedo();\n}\n\n/**\n * Return the current theme.\n *\n * @param state Data state.\n *\n * @return The current theme.\n */\nexport function getCurrentTheme( state: State ): any {\n\tif ( ! state.currentTheme ) {\n\t\treturn null;\n\t}\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state: State ): string {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param state Data state.\n *\n * @return Index data.\n */\nexport function getThemeSupports( state: State ): any {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param state Data state.\n * @param url Embedded URL.\n *\n * @return Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state: State, url: string ): any {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param state Data state.\n * @param url Embedded URL.\n *\n * @return Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state: State, url: string ): boolean {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param state Data state.\n * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param resource Entity resource to check. Accepts entity object `{ kind: 'postType', name: 'attachment', id: 1 }`\n * or REST base as a string - `media`.\n * @param id Optional ID of the rest resource to check.\n *\n * @return Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser(\n\tstate: State,\n\taction: string,\n\tresource: string | EntityResource,\n\tid?: EntityRecordKey\n): boolean | undefined {\n\tconst isEntity = typeof resource === 'object';\n\tif ( isEntity && ( ! resource.kind || ! resource.name ) ) {\n\t\treturn false;\n\t}\n\tif ( isEntity ) {\n\t\tlogEntityDeprecation( resource.kind, resource.name, 'canUser' );\n\t}\n\n\tconst key = getUserPermissionCacheKey( action, resource, id );\n\n\treturn state.userPermissions[ key ];\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record's id.\n * @return Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean | undefined {\n\tdeprecated( `wp.data.select( 'core' ).canUserEditEntityRecord()`, {\n\t\tsince: '6.7',\n\t\talternative: `wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )`,\n\t} );\n\n\treturn canUser( state, 'update', { kind, name, id: recordId } );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves(\n\tstate: State,\n\tpostType: string,\n\tpostId: EntityRecordKey\n): Array< any > | undefined {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n * @param authorId The id of the author.\n *\n * @return The autosave for the post and author.\n */\nexport function getAutosave< EntityRecord extends ET.EntityRecord< any > >(\n\tstate: State,\n\tpostType: string,\n\tpostId: EntityRecordKey,\n\tauthorId: EntityRecordKey\n): EntityRecord | undefined {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\n\treturn autosaves?.find(\n\t\t( autosave: any ) => autosave.author === authorId\n\t) as EntityRecord | undefined;\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) =>\n\t\t(\n\t\t\tstate: State,\n\t\t\tpostType: string,\n\t\t\tpostId: EntityRecordKey\n\t\t): boolean => {\n\t\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\t\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param state Editor state.\n *\n * @return A value whose reference will change only when an edit occurs.\n */\nexport function getReferenceByDistinctEdits( state ) {\n\treturn state.editsReference;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param state Editor state.\n *\n * @return The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles(\n\tstate: State\n): any {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations(\n\tstate: State\n): string | null {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n\n/**\n * Retrieve the list of registered block patterns.\n *\n * @param state Data state.\n *\n * @return Block pattern list.\n */\nexport function getBlockPatterns( state: State ): Array< any > {\n\treturn state.blockPatterns;\n}\n\n/**\n * Retrieve the list of registered block pattern categories.\n *\n * @param state Data state.\n *\n * @return Block pattern category list.\n */\nexport function getBlockPatternCategories( state: State ): Array< any > {\n\treturn state.blockPatternCategories;\n}\n\n/**\n * Retrieve the registered user pattern categories.\n *\n * @param state Data state.\n *\n * @return User patterns category array.\n */\n\nexport function getUserPatternCategories(\n\tstate: State\n): Array< UserPatternCategory > {\n\treturn state.userPatternCategories;\n}\n\n/**\n * Returns the revisions of the current global styles theme.\n *\n * @deprecated since WordPress 6.5.0. Callers should use `select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )` instead, where `recordKey` is the id of the global styles parent post.\n *\n * @param state Data state.\n *\n * @return The current global styles.\n */\nexport function getCurrentThemeGlobalStylesRevisions(\n\tstate: State\n): Array< object > | null {\n\tdeprecated( \"select( 'core' ).getCurrentThemeGlobalStylesRevisions()\", {\n\t\tsince: '6.5.0',\n\t\talternative:\n\t\t\t\"select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )\",\n\t} );\n\tconst currentGlobalStylesId =\n\t\t__experimentalGetCurrentGlobalStylesId( state );\n\n\tif ( ! currentGlobalStylesId ) {\n\t\treturn null;\n\t}\n\n\treturn state.themeGlobalStyleRevisions[ currentGlobalStylesId ];\n}\n\n/**\n * Returns the default template use to render a given query.\n *\n * @param state Data state.\n * @param query Query.\n *\n * @return The default template id for the given query.\n */\nexport function getDefaultTemplateId(\n\tstate: State,\n\tquery: TemplateQuery\n): string {\n\treturn state.defaultTemplates[ JSON.stringify( query ) ];\n}\n\n/**\n * Returns an entity's revisions.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordKey The key of the entity record whose revisions you want to fetch.\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available \"Retrieve a [Entity kind]\".\n *\n * @return Record.\n */\nexport const getRevisions = (\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordKey: EntityRecordKey,\n\tquery?: GetRecordsHttpQuery\n): RevisionRecord[] | null => {\n\tlogEntityDeprecation( kind, name, 'getRevisions' );\n\tconst queriedStateRevisions =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.revisions?.[ recordKey ];\n\tif ( ! queriedStateRevisions ) {\n\t\treturn null;\n\t}\n\n\treturn getQueriedItems( queriedStateRevisions, query );\n};\n\n/**\n * Returns a single, specific revision of a parent entity.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordKey The key of the entity record whose revisions you want to fetch.\n * @param revisionKey The revision's key.\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available \"Retrieve a [entity kind]\".\n *\n * @return Record.\n */\nexport const getRevision = createSelector(\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordKey: EntityRecordKey,\n\t\trevisionKey: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): RevisionRecord | Record< PropertyKey, never > | undefined => {\n\t\tlogEntityDeprecation( kind, name, 'getRevision' );\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.revisions?.[\n\t\t\t\trecordKey\n\t\t\t];\n\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( ! query || ! query._fields ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ revisionKey ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ revisionKey ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ revisionKey ];\n\t\tif ( ! item ) {\n\t\t\treturn item;\n\t\t}\n\n\t\tconst filteredItem = {};\n\t\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\n\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\tlet value = item;\n\t\t\tfield.forEach( ( fieldName ) => {\n\t\t\t\tvalue = value?.[ fieldName ];\n\t\t\t} );\n\t\t\tsetNestedValue( filteredItem, field, value );\n\t\t}\n\n\t\treturn filteredItem;\n\t},\n\t( state: State, kind, name, recordKey, revisionKey, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.revisions?.[\n\t\t\t\trecordKey\n\t\t\t];\n\t\treturn [\n\t\t\tqueriedState?.items?.[ context ]?.[ revisionKey ],\n\t\t\tqueriedState?.itemIsComplete?.[ context ]?.[ revisionKey ],\n\t\t];\n\t}\n);\n"],
5
- "mappings": ";AAGA,SAAS,gBAAgB,8BAA8B;AACvD,SAAS,oBAAoB;AAC7B,OAAO,gBAAgB;AAKvB,SAAS,kBAAkB;AAC3B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAGP,OAAO,0BAA0B;AA8GjC,IAAM,eAAe,CAAC;AAWf,IAAM,2BAA2B;AAAA,EACvC,CAAE,WACD,CAAE,OAAc,QAA0B;AACzC,WAAO,OAAQ,UAAW,EAAE,YAAa,mBAAmB;AAAA,MAC3D;AAAA,IACD,CAAE;AAAA,EACH;AACF;AAYO,SAAS,WACf,OACA,OACY;AACZ,aAAY,iCAAiC;AAAA,IAC5C,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,QAAM,OAAO;AAAA,IACZ;AAAA,IACA;AAAA,EACD;AACA,SAAO,oBAAqB,OAAO,IAAK;AACzC;AASO,SAAS,eAAgB,OAAkC;AACjE,S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,UAAU,OAAO,WAAW;AAElC,QAAK,CAAE,SAAS,CAAE,MAAM,SAAU;AAEjC,UAAK,CAAE,aAAa,eAAgB,OAAQ,IAAK,WAAY,GAAI;AAChE,eAAO;AAAA,MACR;AAEA,aAAO,aAAa,MAAO,OAAQ,EAAG,WAAY;AAAA,IACnD;AAEA,UAAM,OAAO,aAAa,MAAO,OAAQ,IAAK,WAAY;AAC1D,QAAK,CAAE,MAAO;AACb,aAAO;AAAA,IACR;AAEA,UAAM,eAAe,CAAC;AACtB,UAAM,SAAS,4BAA6B,MAAM,OAAQ,KAAK,CAAC;AAEhE,aAAU,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAM;AACzC,YAAM,QAAQ,OAAQ,CAAE,EAAE,MAAO,GAAI;AACrC,UAAI,QAAQ;AACZ,YAAM,QAAS,CAAE,cAAe;AAC/B,gBAAQ,QAAS,SAAU;AAAA,MAC5B,CAAE;AACF,qBAAgB,cAAc,OAAO,KAAM;AAAA,IAC5C;AAEA,WAAO;AAAA,EACR;AAAA,EACA,CAAE,OAAc,MAAM,MAAM,WAAW,aAAa,UAAW;AAC9D,UAAM,UAAU,OAAO,WAAW;AAClC,UAAM,eACL,MAAM,SAAS,UAAW,IAAK,IAAK,IAAK,GAAG,YAC3C,SACD;AACD,WAAO;AAAA,MACN,cAAc,QAAS,OAAQ,IAAK,WAAY;AAAA,MAChD,cAAc,iBAAkB,OAAQ,IAAK,WAAY;AAAA,IAC1D;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport type { UndoManager } from '@wordpress/undo-manager';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport {\n\tgetQueriedItems,\n\tgetQueriedTotalItems,\n\tgetQueriedTotalPages,\n} from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getUndoManager } from './private-selectors';\nimport {\n\tgetNormalizedCommaSeparable,\n\tisRawAttribute,\n\tsetNestedValue,\n\tisNumericID,\n\tgetUserPermissionCacheKey,\n} from './utils';\nimport type * as ET from './entity-types';\nimport logEntityDeprecation from './utils/log-entity-deprecation';\n\n// This is an incomplete, high-level approximation of the State type.\n// It makes the selectors slightly more safe, but is intended to evolve\n// into a more detailed representation over time.\n// See https://github.com/WordPress/gutenberg/pull/40025#discussion_r865410589 for more context.\nexport interface State {\n\tautosaves: Record< string | number, Array< unknown > >;\n\tblockPatterns: Array< unknown >;\n\tblockPatternCategories: Array< unknown >;\n\tcurrentGlobalStylesId: string;\n\tcurrentTheme: string;\n\tcurrentUser: ET.User< 'view' >;\n\tembedPreviews: Record< string, { html: string } >;\n\tentities: EntitiesState;\n\tthemeBaseGlobalStyles: Record< string, Object >;\n\tthemeGlobalStyleVariations: Record< string, string >;\n\tthemeGlobalStyleRevisions: Record< number, Object >;\n\tundoManager: UndoManager;\n\tuserPermissions: Record< string, boolean >;\n\tusers: UserState;\n\tnavigationFallbackId: EntityRecordKey;\n\tuserPatternCategories: Array< UserPatternCategory >;\n\tdefaultTemplates: Record< string, string >;\n\tregisteredPostMeta: Record< string, Object >;\n\teditorSettings: Record< string, any > | null;\n\teditorAssets: Record< string, any > | null;\n}\n\ntype EntityRecordKey = string | number;\n\ninterface EntitiesState {\n\tconfig: EntityConfig[];\n\trecords: Record< string, Record< string, EntityState< ET.EntityRecord > > >;\n}\n\ninterface QueriedData {\n\titems: Record< ET.Context, Record< number, ET.EntityRecord > >;\n\titemIsComplete: Record< ET.Context, Record< number, boolean > >;\n\tqueries: Record< ET.Context, Record< string, Array< number > > >;\n}\n\ntype RevisionRecord =\n\t| Record< ET.Context, Record< number, ET.PostRevision > >\n\t| Record< ET.Context, Record< number, ET.GlobalStylesRevision > >;\n\ninterface RevisionsQueriedData {\n\titems: RevisionRecord;\n\titemIsComplete: Record< ET.Context, Record< number, boolean > >;\n\tqueries: Record< ET.Context, Record< string, Array< number > > >;\n}\n\ninterface EntityState< EntityRecord extends ET.EntityRecord > {\n\tedits: Record< string, Partial< EntityRecord > >;\n\tsaving: Record<\n\t\tstring,\n\t\tPartial< { pending: boolean; isAutosave: boolean; error: Error } >\n\t>;\n\tdeleting: Record< string, Partial< { pending: boolean; error: Error } > >;\n\tqueriedData: QueriedData;\n\trevisions?: RevisionsQueriedData;\n}\n\ninterface EntityConfig {\n\tname: string;\n\tkind: string;\n}\n\ninterface UserState {\n\tqueries: Record< string, EntityRecordKey[] >;\n\tbyId: Record< EntityRecordKey, ET.User< 'edit' > >;\n}\n\ntype TemplateQuery = {\n\tslug?: string;\n\tis_custom?: boolean;\n\tignore_empty?: boolean;\n};\n\nexport interface UserPatternCategory {\n\tid: number;\n\tname: string;\n\tlabel: string;\n\tslug: string;\n\tdescription: string;\n}\n\ntype Optional< T > = T | undefined;\n\n/**\n * HTTP Query parameters sent with the API request to fetch the entity records.\n */\nexport type GetRecordsHttpQuery = Record< string, any >;\n\n/**\n * Arguments for EntityRecord selectors.\n */\ntype EntityRecordArgs =\n\t| [ string, string, EntityRecordKey ]\n\t| [ string, string, EntityRecordKey, GetRecordsHttpQuery ];\n\ntype EntityResource = { kind: string; name: string; id?: EntityRecordKey };\n\n/**\n * Shared reference to an empty object for cases where it is important to avoid\n * returning a new object reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n */\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param state Data state.\n * @param url URL the preview would be for.\n *\n * @return Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select: any ) =>\n\t\t( state: State, url: string ): boolean => {\n\t\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [\n\t\t\t\turl,\n\t\t\t] );\n\t\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param state Data state.\n * @param query Optional object of query parameters to\n * include with request. For valid query parameters see the [Users page](https://developer.wordpress.org/rest-api/reference/users/) in the REST API Handbook and see the arguments for [List Users](https://developer.wordpress.org/rest-api/reference/users/#list-users) and [Retrieve a User](https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user).\n * @return Authors list.\n */\nexport function getAuthors(\n\tstate: State,\n\tquery?: GetRecordsHttpQuery\n): ET.User[] {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param state Data state.\n *\n * @return Current user object.\n */\nexport function getCurrentUser( state: State ): ET.User< 'view' > {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param state Data state.\n * @param queryID Query ID.\n *\n * @return Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state: State, queryID: string ): ET.User< 'edit' >[] => {\n\t\tconst queryResults = state.users.queries[ queryID ] ?? [];\n\n\t\treturn queryResults.map( ( id ) => state.users.byId[ id ] );\n\t},\n\t( state: State, queryID: string ) => [\n\t\tstate.users.queries[ queryID ],\n\t\tstate.users.byId,\n\t]\n);\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @deprecated since WordPress 6.0. Use getEntitiesConfig instead\n * @param state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state: State, kind: string ): Array< any > {\n\tdeprecated( \"wp.data.select( 'core' ).getEntitiesByKind()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntitiesConfig()\",\n\t} );\n\treturn getEntitiesConfig( state, kind );\n}\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @param state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport const getEntitiesConfig = createSelector(\n\t( state: State, kind: string ): Array< any > =>\n\t\tstate.entities.config.filter( ( entity ) => entity.kind === kind ),\n\t/* eslint-disable @typescript-eslint/no-unused-vars */\n\t( state: State, kind: string ) => state.entities.config\n\t/* eslint-enable @typescript-eslint/no-unused-vars */\n);\n/**\n * Returns the entity config given its kind and name.\n *\n * @deprecated since WordPress 6.0. Use getEntityConfig instead\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntity( state: State, kind: string, name: string ): any {\n\tdeprecated( \"wp.data.select( 'core' ).getEntity()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntityConfig()\",\n\t} );\n\treturn getEntityConfig( state, kind, name );\n}\n\n/**\n * Returns the entity config given its kind and name.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntityConfig(\n\tstate: State,\n\tkind: string,\n\tname: string\n): any {\n\tlogEntityDeprecation( kind, name, 'getEntityConfig' );\n\n\treturn state.entities.config?.find(\n\t\t( config ) => config.kind === kind && config.name === name\n\t);\n}\n\n/**\n * GetEntityRecord is declared as a *callable interface* with\n * two signatures to work around the fact that TypeScript doesn't\n * allow currying generic functions:\n *\n * ```ts\n * \t\ttype CurriedState = F extends ( state: any, ...args: infer P ) => infer R\n * \t\t\t? ( ...args: P ) => R\n * \t\t\t: F;\n * \t\ttype Selector = <K extends string | number>(\n * state: any,\n * kind: K,\n * key: K extends string ? 'string value' : false\n * ) => K;\n * \t\ttype BadlyInferredSignature = CurriedState< Selector >\n * // BadlyInferredSignature evaluates to:\n * // (kind: string number, key: false | \"string value\") => string number\n * ```\n *\n * The signature without the state parameter shipped as CurriedSignature\n * is used in the return value of `select( coreStore )`.\n *\n * See https://github.com/WordPress/gutenberg/pull/41578 for more details.\n */\nexport interface GetEntityRecord {\n\t<\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey?: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord | undefined;\n\n\tCurriedSignature: <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tkind: string,\n\t\tname: string,\n\t\tkey?: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => EntityRecord | undefined;\n\t__unstableNormalizeArgs?: ( args: EntityRecordArgs ) => EntityRecordArgs;\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included.\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available \"Retrieve a [Entity kind]\".\n *\n * @return Record.\n */\nexport const getEntityRecord = createSelector(\n\t( <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey?: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord | undefined => {\n\t\tlogEntityDeprecation( kind, name, 'getEntityRecord' );\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( ! query || ! query._fields ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( ! item ) {\n\t\t\treturn item;\n\t\t}\n\n\t\tconst filteredItem = {};\n\t\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\tlet value = item;\n\t\t\tfield.forEach( ( fieldName ) => {\n\t\t\t\tvalue = value?.[ fieldName ];\n\t\t\t} );\n\t\t\tsetNestedValue( filteredItem, field, value );\n\t\t}\n\t\treturn filteredItem as EntityRecord;\n\t} ) as GetEntityRecord,\n\t( state: State, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\t\treturn [\n\t\t\tqueriedState?.items[ context ]?.[ recordId ],\n\t\t\tqueriedState?.itemIsComplete[ context ]?.[ recordId ],\n\t\t];\n\t}\n) as GetEntityRecord;\n\n/**\n * Normalizes `recordKey`s that look like numeric IDs to numbers.\n *\n * @param args EntityRecordArgs the selector arguments.\n * @return EntityRecordArgs the normalized arguments.\n */\ngetEntityRecord.__unstableNormalizeArgs = (\n\targs: EntityRecordArgs\n): EntityRecordArgs => {\n\tconst newArgs = [ ...args ] as EntityRecordArgs;\n\tconst recordKey = newArgs?.[ 2 ];\n\n\t// If recordKey looks to be a numeric ID then coerce to number.\n\tnewArgs[ 2 ] = isNumericID( recordKey ) ? Number( recordKey ) : recordKey;\n\n\treturn newArgs;\n};\n\n/**\n * Returns true if a record has been received for the given set of parameters, or false otherwise.\n *\n * Note: This action does not trigger a request for the entity record from the API\n * if it's not available in the local state.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key.\n * @param query Optional query.\n *\n * @return Whether an entity record has been received.\n */\nexport function hasEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tkey?: EntityRecordKey,\n\tquery?: GetRecordsHttpQuery\n): boolean {\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn false;\n\t}\n\tconst context = query?.context ?? 'default';\n\n\t// If expecting a complete item, validate that completeness.\n\tif ( ! query || ! query._fields ) {\n\t\treturn !! queriedState.itemIsComplete[ context ]?.[ key ];\n\t}\n\n\tconst item = queriedState.items[ context ]?.[ key ];\n\tif ( ! item ) {\n\t\treturn false;\n\t}\n\n\t// When `query._fields` is provided, check that each requested field exists,\n\t// including any nested paths, on the item; return false if any part is missing.\n\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\tfor ( let i = 0; i < fields.length; i++ ) {\n\t\tconst path = fields[ i ].split( '.' );\n\t\tlet value = item;\n\t\tfor ( let p = 0; p < path.length; p++ ) {\n\t\t\tconst part = path[ p ];\n\t\t\tif ( ! value || ! Object.hasOwn( value, part ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvalue = value[ part ];\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key\n *\n * @return Record.\n */\nexport function __experimentalGetEntityRecordNoResolver<\n\tEntityRecord extends ET.EntityRecord< any >,\n>( state: State, kind: string, name: string, key: EntityRecordKey ) {\n\treturn getEntityRecord< EntityRecord >( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key.\n *\n * @return Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t< EntityRecord extends ET.EntityRecord< any > >(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey: EntityRecordKey\n\t): EntityRecord | undefined => {\n\t\tlogEntityDeprecation( kind, name, 'getRawEntityRecord' );\n\n\t\tconst record = getEntityRecord< EntityRecord >(\n\t\t\tstate,\n\t\t\tkind,\n\t\t\tname,\n\t\t\tkey\n\t\t);\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif (\n\t\t\t\t\tisRawAttribute( getEntityConfig( state, kind, name ), _key )\n\t\t\t\t) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] =\n\t\t\t\t\t\trecord[ _key ]?.raw !== undefined\n\t\t\t\t\t\t\t? record[ _key ]?.raw\n\t\t\t\t\t\t\t: record[ _key ];\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} as any )\n\t\t);\n\t},\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData?.items[\n\t\t\t\tcontext\n\t\t\t]?.[ recordId ],\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData\n\t\t\t\t?.itemIsComplete[ context ]?.[ recordId ],\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return Whether entity records have been received.\n */\nexport function hasEntityRecords(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery?: GetRecordsHttpQuery\n): boolean {\n\tlogEntityDeprecation( kind, name, 'hasEntityRecords' );\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * GetEntityRecord is declared as a *callable interface* with\n * two signatures to work around the fact that TypeScript doesn't\n * allow currying generic functions.\n *\n * @see GetEntityRecord\n * @see https://github.com/WordPress/gutenberg/pull/41578\n */\nexport interface GetEntityRecords {\n\t<\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord[] | null;\n\n\tCurriedSignature: <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tkind: string,\n\t\tname: string,\n\t\tquery?: GetRecordsHttpQuery\n\t) => EntityRecord[] | null;\n\n\tPromiseCurriedSignature: <\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >,\n\t>(\n\t\tkind: string,\n\t\tname: string,\n\t\tquery?: GetRecordsHttpQuery\n\t) => Promise< EntityRecord[] | null >;\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return Records.\n */\nexport const getEntityRecords = ( <\n\tEntityRecord extends\n\t\t| ET.EntityRecord< any >\n\t\t| Partial< ET.EntityRecord< any > >,\n>(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery: GetRecordsHttpQuery\n): EntityRecord[] | null => {\n\tlogEntityDeprecation( kind, name, 'getEntityRecords' );\n\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedItems( queriedState, query );\n} ) as GetEntityRecords;\n\n/**\n * Returns the Entity's total available records for a given query (ignoring pagination).\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return number | null.\n */\nexport const getEntityRecordsTotalItems = (\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery: GetRecordsHttpQuery\n): number | null => {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordsTotalItems' );\n\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedTotalItems( queriedState, query );\n};\n\n/**\n * Returns the number of available pages for the given query.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for \"List [Entity kind]s\".\n *\n * @return number | null.\n */\nexport const getEntityRecordsTotalPages = (\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery: GetRecordsHttpQuery\n): number | null => {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordsTotalPages' );\n\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData;\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\tif ( query?.per_page === -1 ) {\n\t\treturn 1;\n\t}\n\tconst totalItems = getQueriedTotalItems( queriedState, query );\n\tif ( ! totalItems ) {\n\t\treturn totalItems;\n\t}\n\t// If `per_page` is not set and the query relies on the defaults of the\n\t// REST endpoint, get the info from query's meta.\n\tif ( ! query?.per_page ) {\n\t\treturn getQueriedTotalPages( queriedState, query );\n\t}\n\treturn Math.ceil( totalItems / query.per_page );\n};\n\ntype DirtyEntityRecord = {\n\ttitle: string;\n\tkey: EntityRecordKey;\n\tname: string;\n\tkind: string;\n};\n/**\n * Returns the list of dirty entity records.\n *\n * @param state State tree.\n *\n * @return The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst dirtyRecords: DirtyEntityRecord[] = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = (\n\t\t\t\t\tObject.keys( records[ kind ][ name ].edits ) as string[]\n\t\t\t\t ).filter(\n\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\tgetEntityRecord( state, kind, name, primaryKey ) &&\n\t\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey: entityRecord\n\t\t\t\t\t\t\t\t? entityRecord[\n\t\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param state State tree.\n *\n * @return The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst recordsBeingSaved: DirtyEntityRecord[] = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = (\n\t\t\t\t\tObject.keys( records[ kind ][ name ].saving ) as string[]\n\t\t\t\t ).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey: entityRecord\n\t\t\t\t\t\t\t\t? entityRecord[\n\t\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's edits.\n */\nexport function getEntityRecordEdits(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): Optional< any > {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordEdits' );\n\treturn state.entities.records?.[ kind ]?.[ name ]?.edits?.[\n\t\trecordId as string | number\n\t];\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey\n\t): Optional< any > => {\n\t\tlogEntityDeprecation( kind, name, 'getEntityRecordNonTransientEdits' );\n\t\tconst { transientEdits } = getEntityConfig( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state: State, kind: string, name: string, recordId: EntityRecordKey ) => [\n\t\tstate.entities.config,\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.edits?.[ recordId ],\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'hasEditsForEntityRecord' );\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t< EntityRecord extends ET.EntityRecord< any > >(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey\n\t): ET.Updatable< EntityRecord > | false => {\n\t\tlogEntityDeprecation( kind, name, 'getEditedEntityRecord' );\n\t\tconst raw = getRawEntityRecord( state, kind, name, recordId );\n\t\tconst edited = getEntityRecordEdits( state, kind, name, recordId );\n\t\t// Never return a non-falsy empty object. Unfortunately we can't return\n\t\t// undefined or null because we were previously returning an empty\n\t\t// object, so trying to read properties from the result would throw.\n\t\t// Using false here is a workaround to avoid breaking changes.\n\t\tif ( ! raw && ! edited ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn {\n\t\t\t...raw,\n\t\t\t...edited,\n\t\t};\n\t},\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData.items[\n\t\t\t\tcontext\n\t\t\t]?.[ recordId ],\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.queriedData\n\t\t\t\t.itemIsComplete[ context ]?.[ recordId ],\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.edits?.[ recordId ],\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'isAutosavingEntityRecord' );\n\tconst { pending, isAutosave } =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.saving?.[ recordId ] ?? {};\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'isSavingEntityRecord' );\n\treturn (\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.saving?.[\n\t\t\trecordId as EntityRecordKey\n\t\t]?.pending ?? false\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\tlogEntityDeprecation( kind, name, 'isDeletingEntityRecord' );\n\treturn (\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.deleting?.[\n\t\t\trecordId as EntityRecordKey\n\t\t]?.pending ?? false\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntitySaveError(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): any {\n\tlogEntityDeprecation( kind, name, 'getLastEntitySaveError' );\n\treturn state.entities.records?.[ kind ]?.[ name ]?.saving?.[ recordId ]\n\t\t?.error;\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntityDeleteError(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): any {\n\tlogEntityDeprecation( kind, name, 'getLastEntityDeleteError' );\n\treturn state.entities.records?.[ kind ]?.[ name ]?.deleting?.[ recordId ]\n\t\t?.error;\n}\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @deprecated since 6.3\n *\n * @param state State tree.\n *\n * @return The edit.\n */\nexport function getUndoEdit( state: State ): Optional< any > {\n\tdeprecated( \"select( 'core' ).getUndoEdit()\", {\n\t\tsince: '6.3',\n\t} );\n\treturn undefined;\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @deprecated since 6.3\n *\n * @param state State tree.\n *\n * @return The edit.\n */\nexport function getRedoEdit( state: State ): Optional< any > {\n\tdeprecated( \"select( 'core' ).getRedoEdit()\", {\n\t\tsince: '6.3',\n\t} );\n\treturn undefined;\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param state State tree.\n *\n * @return Whether there is a previous edit or not.\n */\nexport function hasUndo( state: State ): boolean {\n\treturn getUndoManager( state ).hasUndo();\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param state State tree.\n *\n * @return Whether there is a next edit or not.\n */\nexport function hasRedo( state: State ): boolean {\n\treturn getUndoManager( state ).hasRedo();\n}\n\n/**\n * Return the current theme.\n *\n * @param state Data state.\n *\n * @return The current theme.\n */\nexport function getCurrentTheme( state: State ): any {\n\tif ( ! state.currentTheme ) {\n\t\treturn null;\n\t}\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state: State ): string {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param state Data state.\n *\n * @return Index data.\n */\nexport function getThemeSupports( state: State ): any {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param state Data state.\n * @param url Embedded URL.\n *\n * @return Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state: State, url: string ): any {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param state Data state.\n * @param url Embedded URL.\n *\n * @return Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state: State, url: string ): boolean {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param state Data state.\n * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param resource Entity resource to check. Accepts entity object `{ kind: 'postType', name: 'attachment', id: 1 }`\n * or REST base as a string - `media`.\n * @param id Optional ID of the rest resource to check.\n *\n * @return Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser(\n\tstate: State,\n\taction: string,\n\tresource: string | EntityResource,\n\tid?: EntityRecordKey\n): boolean | undefined {\n\tconst isEntity = typeof resource === 'object';\n\tif ( isEntity && ( ! resource.kind || ! resource.name ) ) {\n\t\treturn false;\n\t}\n\tif ( isEntity ) {\n\t\tlogEntityDeprecation( resource.kind, resource.name, 'canUser' );\n\t}\n\n\tconst key = getUserPermissionCacheKey( action, resource, id );\n\n\treturn state.userPermissions[ key ];\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record's id.\n * @return Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean | undefined {\n\tdeprecated( `wp.data.select( 'core' ).canUserEditEntityRecord()`, {\n\t\tsince: '6.7',\n\t\talternative: `wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )`,\n\t} );\n\n\treturn canUser( state, 'update', { kind, name, id: recordId } );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves(\n\tstate: State,\n\tpostType: string,\n\tpostId: EntityRecordKey\n): Array< any > | undefined {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n * @param authorId The id of the author.\n *\n * @return The autosave for the post and author.\n */\nexport function getAutosave< EntityRecord extends ET.EntityRecord< any > >(\n\tstate: State,\n\tpostType: string,\n\tpostId: EntityRecordKey,\n\tauthorId: EntityRecordKey\n): EntityRecord | undefined {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\n\treturn autosaves?.find(\n\t\t( autosave: any ) => autosave.author === authorId\n\t) as EntityRecord | undefined;\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) =>\n\t\t(\n\t\t\tstate: State,\n\t\t\tpostType: string,\n\t\t\tpostId: EntityRecordKey\n\t\t): boolean => {\n\t\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\t\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param state Editor state.\n *\n * @return A value whose reference will change only when an edit occurs.\n */\nexport function getReferenceByDistinctEdits( state ) {\n\treturn state.editsReference;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param state Editor state.\n *\n * @return The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles(\n\tstate: State\n): any {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations(\n\tstate: State\n): string | null {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n\n/**\n * Retrieve the list of registered block patterns.\n *\n * @param state Data state.\n *\n * @return Block pattern list.\n */\nexport function getBlockPatterns( state: State ): Array< any > {\n\treturn state.blockPatterns;\n}\n\n/**\n * Retrieve the list of registered block pattern categories.\n *\n * @param state Data state.\n *\n * @return Block pattern category list.\n */\nexport function getBlockPatternCategories( state: State ): Array< any > {\n\treturn state.blockPatternCategories;\n}\n\n/**\n * Retrieve the registered user pattern categories.\n *\n * @param state Data state.\n *\n * @return User patterns category array.\n */\n\nexport function getUserPatternCategories(\n\tstate: State\n): Array< UserPatternCategory > {\n\treturn state.userPatternCategories;\n}\n\n/**\n * Returns the revisions of the current global styles theme.\n *\n * @deprecated since WordPress 6.5.0. Callers should use `select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )` instead, where `recordKey` is the id of the global styles parent post.\n *\n * @param state Data state.\n *\n * @return The current global styles.\n */\nexport function getCurrentThemeGlobalStylesRevisions(\n\tstate: State\n): Array< object > | null {\n\tdeprecated( \"select( 'core' ).getCurrentThemeGlobalStylesRevisions()\", {\n\t\tsince: '6.5.0',\n\t\talternative:\n\t\t\t\"select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )\",\n\t} );\n\tconst currentGlobalStylesId =\n\t\t__experimentalGetCurrentGlobalStylesId( state );\n\n\tif ( ! currentGlobalStylesId ) {\n\t\treturn null;\n\t}\n\n\treturn state.themeGlobalStyleRevisions[ currentGlobalStylesId ];\n}\n\n/**\n * Returns the default template use to render a given query.\n *\n * @param state Data state.\n * @param query Query.\n *\n * @return The default template id for the given query.\n */\nexport function getDefaultTemplateId(\n\tstate: State,\n\tquery: TemplateQuery\n): string {\n\treturn state.defaultTemplates[ JSON.stringify( query ) ];\n}\n\n/**\n * Returns an entity's revisions.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordKey The key of the entity record whose revisions you want to fetch.\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available \"Retrieve a [Entity kind]\".\n *\n * @return Record.\n */\nexport const getRevisions = (\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordKey: EntityRecordKey,\n\tquery?: GetRecordsHttpQuery\n): RevisionRecord[] | null => {\n\tlogEntityDeprecation( kind, name, 'getRevisions' );\n\tconst queriedStateRevisions =\n\t\tstate.entities.records?.[ kind ]?.[ name ]?.revisions?.[ recordKey ];\n\tif ( ! queriedStateRevisions ) {\n\t\treturn null;\n\t}\n\n\treturn getQueriedItems( queriedStateRevisions, query );\n};\n\n/**\n * Returns a single, specific revision of a parent entity.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordKey The key of the entity record whose revisions you want to fetch.\n * @param revisionKey The revision's key.\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available \"Retrieve a [entity kind]\".\n *\n * @return Record.\n */\nexport const getRevision = createSelector(\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordKey: EntityRecordKey,\n\t\trevisionKey: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): RevisionRecord | Record< PropertyKey, never > | undefined => {\n\t\tlogEntityDeprecation( kind, name, 'getRevision' );\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.revisions?.[\n\t\t\t\trecordKey\n\t\t\t];\n\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( ! query || ! query._fields ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ revisionKey ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ revisionKey ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ revisionKey ];\n\t\tif ( ! item ) {\n\t\t\treturn item;\n\t\t}\n\n\t\tconst filteredItem = {};\n\t\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\n\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\tlet value = item;\n\t\t\tfield.forEach( ( fieldName ) => {\n\t\t\t\tvalue = value?.[ fieldName ];\n\t\t\t} );\n\t\t\tsetNestedValue( filteredItem, field, value );\n\t\t}\n\n\t\treturn filteredItem;\n\t},\n\t( state: State, kind, name, recordKey, revisionKey, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\tconst queriedState =\n\t\t\tstate.entities.records?.[ kind ]?.[ name ]?.revisions?.[\n\t\t\t\trecordKey\n\t\t\t];\n\t\treturn [\n\t\t\tqueriedState?.items?.[ context ]?.[ revisionKey ],\n\t\t\tqueriedState?.itemIsComplete?.[ context ]?.[ revisionKey ],\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;AAC/B,gBAAQ,QAAS,SAAU;AAAA,MAC5B,CAAE;AACF,qBAAgB,cAAc,OAAO,KAAM;AAAA,IAC5C;AAEA,WAAO;AAAA,EACR;AAAA,EACA,CAAE,OAAc,MAAM,MAAM,WAAW,aAAa,UAAW;AAC9D,UAAM,UAAU,OAAO,WAAW;AAClC,UAAM,eACL,MAAM,SAAS,UAAW,IAAK,IAAK,IAAK,GAAG,YAC3C,SACD;AACD,WAAO;AAAA,MACN,cAAc,QAAS,OAAQ,IAAK,WAAY;AAAA,MAChD,cAAc,iBAAkB,OAAQ,IAAK,WAAY;AAAA,IAC1D;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -23,4 +23,4 @@ export {
23
23
  WORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE,
24
24
  getSyncManager
25
25
  };
26
- //# sourceMappingURL=sync.js.map
26
+ //# sourceMappingURL=sync.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -27,4 +27,4 @@ function conservativeMapItem(item, nextItem) {
27
27
  export {
28
28
  conservativeMapItem as default
29
29
  };
30
- //# sourceMappingURL=conservative-map-item.js.map
30
+ //# sourceMappingURL=conservative-map-item.mjs.map
@@ -154,12 +154,13 @@ function mergeCrdtBlocks(yblocks, incomingBlocks, lastSelection) {
154
154
  block.name,
155
155
  attributeName
156
156
  );
157
- if (isRichText && "string" === typeof attributeValue) {
158
- const blockYText = currentAttributes.get(
159
- attributeName
160
- );
157
+ if (isRichText && "string" === typeof attributeValue && currentAttributes.has(attributeName) && currentAttributes.get(
158
+ attributeName
159
+ ) instanceof Y.Text) {
161
160
  mergeRichTextUpdate(
162
- blockYText,
161
+ currentAttributes.get(
162
+ attributeName
163
+ ),
163
164
  attributeValue,
164
165
  lastSelection
165
166
  );
@@ -253,4 +254,4 @@ function mergeRichTextUpdate(blockYText, updatedValue, lastSelection) {
253
254
  export {
254
255
  mergeCrdtBlocks
255
256
  };
256
- //# sourceMappingURL=crdt-blocks.js.map
257
+ //# sourceMappingURL=crdt-blocks.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/crdt-blocks.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuidv4 } from 'uuid';\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { RichTextData } from '@wordpress/rich-text';\nimport { Y } from '@wordpress/sync';\n\n// @ts-expect-error No exported types.\nimport { getBlockTypes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { WPBlockSelection } from '../types';\n\ninterface BlockAttributes {\n\t[ key: string ]: unknown;\n}\n\ninterface BlockType {\n\tname: string;\n\tattributes?: Record< string, { type?: string } >;\n}\n\nexport interface Block {\n\tattributes: BlockAttributes;\n\tclientId?: string;\n\tinnerBlocks: Block[];\n\toriginalContent?: string; // unserializable\n\tvalidationIssues?: string[]; // unserializable\n\tname: string;\n}\n\nexport type YBlock = Y.Map<\n\t/* name, clientId, and originalContent are strings. */\n\t| string\n\t/* validationIssues? is an array of strings. */\n\t| string[]\n\t/* attributes is a Y.Map< unknown >. */\n\t| YBlockAttributes\n\t/* innerBlocks is a Y.Array< YBlock >. */\n\t| YBlocks\n>;\n\nexport type YBlocks = Y.Array< YBlock >;\nexport type YBlockAttributes = Y.Map< Y.Text | unknown >;\n\n// The Y.Map type is not easy to work with. The generic type it accepts represents\n// the possible values of the map, which are varied in our case. This type is\n// accurate, but will require aggressive type narrowing when the map values are\n// accessed -- or type casting with `as`.\n// export type YBlock = Y.Map< Block[ keyof Block ] >;\n\nconst serializableBlocksCache = new WeakMap< WeakKey, Block[] >();\n\nfunction makeBlockAttributesSerializable(\n\tattributes: BlockAttributes\n): BlockAttributes {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks: Block[] | YBlocks ): Block[] {\n\treturn blocks.map( ( block: Block | YBlock ) => {\n\t\tconst blockAsJson = block instanceof Y.Map ? block.toJSON() : block;\n\t\tconst { name, innerBlocks, attributes, ...rest } = blockAsJson;\n\t\tdelete rest.validationIssues;\n\t\tdelete rest.originalContent;\n\t\t// delete rest.isValid\n\t\treturn {\n\t\t\t...rest,\n\t\t\tname,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * @param {any} gblock\n * @param {Y.Map} yblock\n */\nfunction areBlocksEqual( gblock: Block, yblock: YBlock ): boolean {\n\tconst yblockAsJson = yblock.toJSON();\n\n\t// we must not sync clientId, as this can't be generated consistently and\n\t// hence will lead to merge conflicts.\n\tconst overwrites = {\n\t\tinnerBlocks: null,\n\t\tclientId: null,\n\t};\n\tconst res = fastDeepEqual(\n\t\tObject.assign( {}, gblock, overwrites ),\n\t\tObject.assign( {}, yblockAsJson, overwrites )\n\t);\n\tconst inners = gblock.innerBlocks || [];\n\tconst yinners = yblock.get( 'innerBlocks' ) as YBlocks;\n\treturn (\n\t\tres &&\n\t\tinners.length === yinners.length &&\n\t\tinners.every( ( block: Block, i: number ) =>\n\t\t\tareBlocksEqual( block, yinners.get( i ) )\n\t\t)\n\t);\n}\n\nfunction createNewYAttributeMap(\n\tblockName: string,\n\tattributes: BlockAttributes\n): YBlockAttributes {\n\treturn new Y.Map(\n\t\tObject.entries( attributes ).map(\n\t\t\t( [ attributeName, attributeValue ] ) => {\n\t\t\t\treturn [\n\t\t\t\t\tattributeName,\n\t\t\t\t\tcreateNewYAttributeValue(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\tattributeValue\n\t\t\t\t\t),\n\t\t\t\t];\n\t\t\t}\n\t\t)\n\t);\n}\n\nfunction createNewYAttributeValue(\n\tblockName: string,\n\tattributeName: string,\n\tattributeValue: unknown\n): Y.Text | unknown {\n\tconst isRichText = isRichTextAttribute( blockName, attributeName );\n\n\tif ( isRichText ) {\n\t\treturn new Y.Text( attributeValue?.toString() ?? '' );\n\t}\n\n\treturn attributeValue;\n}\n\nfunction createNewYBlock( block: Block ): YBlock {\n\treturn new Y.Map(\n\t\tObject.entries( block ).map( ( [ key, value ] ) => {\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'attributes': {\n\t\t\t\t\treturn [ key, createNewYAttributeMap( block.name, value ) ];\n\t\t\t\t}\n\n\t\t\t\tcase 'innerBlocks': {\n\t\t\t\t\tconst innerBlocks = new Y.Array();\n\n\t\t\t\t\t// If not an array, set to empty Y.Array.\n\t\t\t\t\tif ( ! Array.isArray( value ) ) {\n\t\t\t\t\t\treturn [ key, innerBlocks ];\n\t\t\t\t\t}\n\n\t\t\t\t\tinnerBlocks.insert(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tvalue.map( ( innerBlock: Block ) =>\n\t\t\t\t\t\t\tcreateNewYBlock( innerBlock )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\t\treturn [ key, innerBlocks ];\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\treturn [ key, value ];\n\t\t\t}\n\t\t} )\n\t);\n}\n\n/**\n * Merge incoming block data into the local Y.Doc.\n * This function is called to sync local block changes to a shared Y.Doc.\n *\n * @param yblocks The blocks in the local Y.Doc.\n * @param incomingBlocks Gutenberg blocks being synced, either from a peer or from the local editor.\n * @param lastSelection The last cursor position, used for hinting the diff algorithm.\n */\nexport function mergeCrdtBlocks(\n\tyblocks: YBlocks,\n\tincomingBlocks: Block[],\n\tlastSelection: WPBlockSelection | null\n): void {\n\t// Ensure we are working with serializable block data.\n\tif ( ! serializableBlocksCache.has( incomingBlocks ) ) {\n\t\tserializableBlocksCache.set(\n\t\t\tincomingBlocks,\n\t\t\tmakeBlocksSerializable( incomingBlocks )\n\t\t);\n\t}\n\tconst allBlocks = serializableBlocksCache.get( incomingBlocks ) ?? [];\n\n\t// Ensure we skip blocks that we don't want to sync at the moment\n\tconst blocksToSync = allBlocks.filter( ( block ) =>\n\t\tshouldBlockBeSynced( block )\n\t);\n\n\t// This is a rudimentary diff implementation similar to the y-prosemirror diffing\n\t// approach.\n\t// A better implementation would also diff the textual content and represent it\n\t// using a Y.Text type.\n\t// However, at this time it makes more sense to keep this algorithm generic to\n\t// support all kinds of block types.\n\t// Ideally, we ensure that block data structure have a consistent data format.\n\t// E.g.:\n\t// - textual content (using rich-text formatting?) may always be stored under `block.text`\n\t// - local information that shouldn't be shared (e.g. clientId or isDragging) is stored under `block.private`\n\t//\n\t// @credit Kevin Jahns (dmonad)\n\t// @link https://github.com/WordPress/gutenberg/pull/68483\n\tconst numOfCommonEntries = Math.min(\n\t\tblocksToSync.length ?? 0,\n\t\tyblocks.length\n\t);\n\n\tlet left = 0;\n\tlet right = 0;\n\n\t// skip equal blocks from left\n\tfor (\n\t\t;\n\t\tleft < numOfCommonEntries &&\n\t\tareBlocksEqual( blocksToSync[ left ], yblocks.get( left ) );\n\t\tleft++\n\t) {\n\t\t/* nop */\n\t}\n\n\t// skip equal blocks from right\n\tfor (\n\t\t;\n\t\tright < numOfCommonEntries - left &&\n\t\tareBlocksEqual(\n\t\t\tblocksToSync[ blocksToSync.length - right - 1 ],\n\t\t\tyblocks.get( yblocks.length - right - 1 )\n\t\t);\n\t\tright++\n\t) {\n\t\t/* nop */\n\t}\n\n\tconst numOfUpdatesNeeded = numOfCommonEntries - left - right;\n\tconst numOfInsertionsNeeded = Math.max(\n\t\t0,\n\t\tblocksToSync.length - yblocks.length\n\t);\n\tconst numOfDeletionsNeeded = Math.max(\n\t\t0,\n\t\tyblocks.length - blocksToSync.length\n\t);\n\n\t// updates\n\tfor ( let i = 0; i < numOfUpdatesNeeded; i++, left++ ) {\n\t\tconst block = blocksToSync[ left ];\n\t\tconst yblock = yblocks.get( left );\n\t\tObject.entries( block ).forEach( ( [ key, value ] ) => {\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'attributes': {\n\t\t\t\t\tconst currentAttributes = yblock.get(\n\t\t\t\t\t\tkey\n\t\t\t\t\t) as YBlockAttributes;\n\n\t\t\t\t\t// If attributes are not set on the yblock, use the new values.\n\t\t\t\t\tif ( ! currentAttributes ) {\n\t\t\t\t\t\tyblock.set(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tcreateNewYAttributeMap( block.name, value )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tObject.entries( value ).forEach(\n\t\t\t\t\t\t( [ attributeName, attributeValue ] ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tfastDeepEqual(\n\t\t\t\t\t\t\t\t\tcurrentAttributes?.get( attributeName ),\n\t\t\t\t\t\t\t\t\tattributeValue\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\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst isRichText = isRichTextAttribute(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisRichText &&\n\t\t\t\t\t\t\t\t'string' === typeof attributeValue\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Rich text values are stored as persistent Y.Text instances.\n\t\t\t\t\t\t\t\t// Update the value with a delta in place.\n\t\t\t\t\t\t\t\tconst blockYText = currentAttributes.get(\n\t\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t\t) as Y.Text;\n\n\t\t\t\t\t\t\t\tmergeRichTextUpdate(\n\t\t\t\t\t\t\t\t\tblockYText,\n\t\t\t\t\t\t\t\t\tattributeValue,\n\t\t\t\t\t\t\t\t\tlastSelection\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrentAttributes.set(\n\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\tcreateNewYAttributeValue(\n\t\t\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\t\tattributeValue\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\n\t\t\t\t\t// Delete any attributes that are no longer present.\n\t\t\t\t\tcurrentAttributes.forEach(\n\t\t\t\t\t\t( _attrValue: unknown, attrName: string ) => {\n\t\t\t\t\t\t\tif ( ! value.hasOwnProperty( attrName ) ) {\n\t\t\t\t\t\t\t\tcurrentAttributes.delete( attrName );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'innerBlocks': {\n\t\t\t\t\t// Recursively merge innerBlocks\n\t\t\t\t\tconst yInnerBlocks = yblock.get( key ) as Y.Array< YBlock >;\n\t\t\t\t\tmergeCrdtBlocks( yInnerBlocks, value ?? [], lastSelection );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tif ( ! fastDeepEqual( block[ key ], yblock.get( key ) ) ) {\n\t\t\t\t\t\tyblock.set( key, value );\n\t\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t\tyblock.forEach( ( _v, k ) => {\n\t\t\tif ( ! block.hasOwnProperty( k ) ) {\n\t\t\t\tyblock.delete( k );\n\t\t\t}\n\t\t} );\n\t}\n\n\t// deletes\n\tyblocks.delete( left, numOfDeletionsNeeded );\n\n\t// inserts\n\tfor ( let i = 0; i < numOfInsertionsNeeded; i++, left++ ) {\n\t\tconst newBlock = [ createNewYBlock( blocksToSync[ left ] ) ];\n\n\t\tyblocks.insert( left, newBlock );\n\t}\n\n\t// remove duplicate clientids\n\tconst knownClientIds = new Set< string >();\n\tfor ( let j = 0; j < yblocks.length; j++ ) {\n\t\tconst yblock: YBlock = yblocks.get( j );\n\n\t\tlet clientId: string = yblock.get( 'clientId' ) as string;\n\n\t\tif ( knownClientIds.has( clientId ) ) {\n\t\t\tclientId = uuidv4();\n\t\t\tyblock.set( 'clientId', clientId );\n\t\t}\n\t\tknownClientIds.add( clientId );\n\t}\n}\n\n/**\n * Determine if a block should be synced.\n *\n * Ex: A gallery block should not be synced until the images have been\n * uploaded to WordPress, and their url is available. Before that,\n * it's not possible to access the blobs on a client as those are\n * local.\n *\n * @param block The block to check.\n * @return True if the block should be synced, false otherwise.\n */\nfunction shouldBlockBeSynced( block: Block ): boolean {\n\t// Verify that the gallery block is ready to be synced.\n\t// This means that, all images have had their blobs converted to full URLs.\n\t// Checking for only the blobs ensures that blocks that have just been inserted work as well.\n\tif ( 'core/gallery' === block.name ) {\n\t\treturn ! block.innerBlocks.some(\n\t\t\t( innerBlock ) =>\n\t\t\t\tinnerBlock.attributes && innerBlock.attributes.blob\n\t\t);\n\t}\n\n\t// Allow all other blocks to be synced.\n\treturn true;\n}\n\n// Cache rich-text attributes for all block types.\nlet cachedRichTextAttributes: Map< string, Map< string, true > >;\n\n/**\n * Given a block name and attribute key, return true if the attribute is rich-text typed.\n *\n * @param blockName The name of the block, e.g. 'core/paragraph'.\n * @param attributeName The name of the attribute to check, e.g. 'content'.\n * @return True if the attribute is rich-text typed, false otherwise.\n */\nfunction isRichTextAttribute(\n\tblockName: string,\n\tattributeName: string\n): boolean {\n\tif ( ! cachedRichTextAttributes ) {\n\t\t// Parse the attributes for all blocks once.\n\t\tcachedRichTextAttributes = new Map< string, Map< string, true > >();\n\n\t\tfor ( const blockType of getBlockTypes() as BlockType[] ) {\n\t\t\tconst richTextAttributeMap = new Map< string, true >();\n\n\t\t\tfor ( const [ name, definition ] of Object.entries(\n\t\t\t\tblockType.attributes ?? {}\n\t\t\t) ) {\n\t\t\t\tif ( 'rich-text' === definition.type ) {\n\t\t\t\t\trichTextAttributeMap.set( name, true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcachedRichTextAttributes.set(\n\t\t\t\tblockType.name,\n\t\t\t\trichTextAttributeMap\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\tcachedRichTextAttributes.get( blockName )?.has( attributeName ) ?? false\n\t);\n}\n\n/**\n * Given a Y.Text object and an updated string value, diff the new value and\n * apply the delta to the Y.Text.\n *\n * @param blockYText The Y.Text to update.\n * @param updatedValue The updated value.\n * @param lastSelection The last cursor position before this update, used to hint the diff algorithm.\n */\nfunction mergeRichTextUpdate(\n\tblockYText: Y.Text,\n\tupdatedValue: string,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tlastSelection: WPBlockSelection | null\n): void {\n\t// TODO\n\t// ====\n\t// Gutenberg does not use Yjs shared types natively, so we can only subscribe\n\t// to changes from store and apply them to Yjs types that we create and\n\t// manage. Crucially, for rich-text attributes, we do not receive granular\n\t// string updates; we get the new full string value on each change, even when\n\t// only a single character changed.\n\t//\n\t// The code below allows us to compute a delta between the current and new\n\t// value, then apply it to the Y.Text. However, it relies on a library\n\t// (quill-delta) with a licensing issue that we are working to resolve.\n\t//\n\t// For now, we simply replace the full text content on each change.\n\t//\n\t// if ( ! localDoc ) {\n\t// \t// Y.Text must be attached to a Y.Doc to be able to do operations on it.\n\t// \t// Create a temporary Y.Text attached to a local Y.Doc for delta computation.\n\t// \tlocalDoc = new Y.Doc();\n\t// }\n\n\t// const localYText = localDoc.getText( 'temporary-text' );\n\t// localYText.delete( 0, localYText.length );\n\t// localYText.insert( 0, updatedValue );\n\n\t// const currentValueAsDelta = new Delta( blockYText.toDelta() );\n\t// const updatedValueAsDelta = new Delta( localYText.toDelta() );\n\n\t// const deltaDiff = currentValueAsDelta.diff(\n\t// \tupdatedValueAsDelta,\n\t// \tlastSelection?.offset\n\t// );\n\n\t// blockYText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AI,IAAc;AACzC,WAAU,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAM;AAC1C,UAAM,SAAiB,QAAQ,IAAK,CAAE;AAEtC,QAAI,WAAmB,OAAO,IAAK,UAAW;AAE9C,QAAK,eAAe,IAAK,QAAS,GAAI;AACrC,iBAAW,OAAO;AAClB,aAAO,IAAK,YAAY,QAAS;AAAA,IAClC;AACA,mBAAe,IAAK,QAAS;AAAA,EAC9B;AACD;AAaA,SAAS,oBAAqB,OAAwB;AAIrD,MAAK,mBAAmB,MAAM,MAAO;AACpC,WAAO,CAAE,MAAM,YAAY;AAAA,MAC1B,CAAE,eACD,WAAW,cAAc,WAAW,WAAW;AAAA,IACjD;AAAA,EACD;AAGA,SAAO;AACR;AAGA,IAAI;AASJ,SAAS,oBACR,WACA,eACU;AACV,MAAK,CAAE,0BAA2B;AAEjC,+BAA2B,oBAAI,IAAmC;AAElE,eAAY,aAAa,cAAc,GAAmB;AACzD,YAAM,uBAAuB,oBAAI,IAAoB;AAErD,iBAAY,CAAE,MAAM,UAAW,KAAK,OAAO;AAAA,QAC1C,UAAU,cAAc,CAAC;AAAA,MAC1B,GAAI;AACH,YAAK,gBAAgB,WAAW,MAAO;AACtC,+BAAqB,IAAK,MAAM,IAAK;AAAA,QACtC;AAAA,MACD;AAEA,+BAAyB;AAAA,QACxB,UAAU;AAAA,QACV;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SACC,yBAAyB,IAAK,SAAU,GAAG,IAAK,aAAc,KAAK;AAErE;AAUA,SAAS,oBACR,YACA,cAEA,eACO;AAmCP,aAAW,OAAQ,GAAG,WAAW,SAAS,EAAE,MAAO;AACnD,aAAW,OAAQ,GAAG,YAAa;AACpC;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuidv4 } from 'uuid';\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { RichTextData } from '@wordpress/rich-text';\nimport { Y } from '@wordpress/sync';\n\n// @ts-expect-error No exported types.\nimport { getBlockTypes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { WPBlockSelection } from '../types';\n\ninterface BlockAttributes {\n\t[ key: string ]: unknown;\n}\n\ninterface BlockType {\n\tname: string;\n\tattributes?: Record< string, { type?: string } >;\n}\n\nexport interface Block {\n\tattributes: BlockAttributes;\n\tclientId?: string;\n\tinnerBlocks: Block[];\n\toriginalContent?: string; // unserializable\n\tvalidationIssues?: string[]; // unserializable\n\tname: string;\n}\n\nexport type YBlock = Y.Map<\n\t/* name, clientId, and originalContent are strings. */\n\t| string\n\t/* validationIssues? is an array of strings. */\n\t| string[]\n\t/* attributes is a Y.Map< unknown >. */\n\t| YBlockAttributes\n\t/* innerBlocks is a Y.Array< YBlock >. */\n\t| YBlocks\n>;\n\nexport type YBlocks = Y.Array< YBlock >;\nexport type YBlockAttributes = Y.Map< Y.Text | unknown >;\n\n// The Y.Map type is not easy to work with. The generic type it accepts represents\n// the possible values of the map, which are varied in our case. This type is\n// accurate, but will require aggressive type narrowing when the map values are\n// accessed -- or type casting with `as`.\n// export type YBlock = Y.Map< Block[ keyof Block ] >;\n\nconst serializableBlocksCache = new WeakMap< WeakKey, Block[] >();\n\nfunction makeBlockAttributesSerializable(\n\tattributes: BlockAttributes\n): BlockAttributes {\n\tconst newAttributes = { ...attributes };\n\tfor ( const [ key, value ] of Object.entries( attributes ) ) {\n\t\tif ( value instanceof RichTextData ) {\n\t\t\tnewAttributes[ key ] = value.valueOf();\n\t\t}\n\t}\n\treturn newAttributes;\n}\n\nfunction makeBlocksSerializable( blocks: Block[] | YBlocks ): Block[] {\n\treturn blocks.map( ( block: Block | YBlock ) => {\n\t\tconst blockAsJson = block instanceof Y.Map ? block.toJSON() : block;\n\t\tconst { name, innerBlocks, attributes, ...rest } = blockAsJson;\n\t\tdelete rest.validationIssues;\n\t\tdelete rest.originalContent;\n\t\t// delete rest.isValid\n\t\treturn {\n\t\t\t...rest,\n\t\t\tname,\n\t\t\tattributes: makeBlockAttributesSerializable( attributes ),\n\t\t\tinnerBlocks: makeBlocksSerializable( innerBlocks ),\n\t\t};\n\t} );\n}\n\n/**\n * @param {any} gblock\n * @param {Y.Map} yblock\n */\nfunction areBlocksEqual( gblock: Block, yblock: YBlock ): boolean {\n\tconst yblockAsJson = yblock.toJSON();\n\n\t// we must not sync clientId, as this can't be generated consistently and\n\t// hence will lead to merge conflicts.\n\tconst overwrites = {\n\t\tinnerBlocks: null,\n\t\tclientId: null,\n\t};\n\tconst res = fastDeepEqual(\n\t\tObject.assign( {}, gblock, overwrites ),\n\t\tObject.assign( {}, yblockAsJson, overwrites )\n\t);\n\tconst inners = gblock.innerBlocks || [];\n\tconst yinners = yblock.get( 'innerBlocks' ) as YBlocks;\n\treturn (\n\t\tres &&\n\t\tinners.length === yinners.length &&\n\t\tinners.every( ( block: Block, i: number ) =>\n\t\t\tareBlocksEqual( block, yinners.get( i ) )\n\t\t)\n\t);\n}\n\nfunction createNewYAttributeMap(\n\tblockName: string,\n\tattributes: BlockAttributes\n): YBlockAttributes {\n\treturn new Y.Map(\n\t\tObject.entries( attributes ).map(\n\t\t\t( [ attributeName, attributeValue ] ) => {\n\t\t\t\treturn [\n\t\t\t\t\tattributeName,\n\t\t\t\t\tcreateNewYAttributeValue(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\tattributeValue\n\t\t\t\t\t),\n\t\t\t\t];\n\t\t\t}\n\t\t)\n\t);\n}\n\nfunction createNewYAttributeValue(\n\tblockName: string,\n\tattributeName: string,\n\tattributeValue: unknown\n): Y.Text | unknown {\n\tconst isRichText = isRichTextAttribute( blockName, attributeName );\n\n\tif ( isRichText ) {\n\t\treturn new Y.Text( attributeValue?.toString() ?? '' );\n\t}\n\n\treturn attributeValue;\n}\n\nfunction createNewYBlock( block: Block ): YBlock {\n\treturn new Y.Map(\n\t\tObject.entries( block ).map( ( [ key, value ] ) => {\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'attributes': {\n\t\t\t\t\treturn [ key, createNewYAttributeMap( block.name, value ) ];\n\t\t\t\t}\n\n\t\t\t\tcase 'innerBlocks': {\n\t\t\t\t\tconst innerBlocks = new Y.Array();\n\n\t\t\t\t\t// If not an array, set to empty Y.Array.\n\t\t\t\t\tif ( ! Array.isArray( value ) ) {\n\t\t\t\t\t\treturn [ key, innerBlocks ];\n\t\t\t\t\t}\n\n\t\t\t\t\tinnerBlocks.insert(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tvalue.map( ( innerBlock: Block ) =>\n\t\t\t\t\t\t\tcreateNewYBlock( innerBlock )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\t\treturn [ key, innerBlocks ];\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\treturn [ key, value ];\n\t\t\t}\n\t\t} )\n\t);\n}\n\n/**\n * Merge incoming block data into the local Y.Doc.\n * This function is called to sync local block changes to a shared Y.Doc.\n *\n * @param yblocks The blocks in the local Y.Doc.\n * @param incomingBlocks Gutenberg blocks being synced, either from a peer or from the local editor.\n * @param lastSelection The last cursor position, used for hinting the diff algorithm.\n */\nexport function mergeCrdtBlocks(\n\tyblocks: YBlocks,\n\tincomingBlocks: Block[],\n\tlastSelection: WPBlockSelection | null\n): void {\n\t// Ensure we are working with serializable block data.\n\tif ( ! serializableBlocksCache.has( incomingBlocks ) ) {\n\t\tserializableBlocksCache.set(\n\t\t\tincomingBlocks,\n\t\t\tmakeBlocksSerializable( incomingBlocks )\n\t\t);\n\t}\n\tconst allBlocks = serializableBlocksCache.get( incomingBlocks ) ?? [];\n\n\t// Ensure we skip blocks that we don't want to sync at the moment\n\tconst blocksToSync = allBlocks.filter( ( block ) =>\n\t\tshouldBlockBeSynced( block )\n\t);\n\n\t// This is a rudimentary diff implementation similar to the y-prosemirror diffing\n\t// approach.\n\t// A better implementation would also diff the textual content and represent it\n\t// using a Y.Text type.\n\t// However, at this time it makes more sense to keep this algorithm generic to\n\t// support all kinds of block types.\n\t// Ideally, we ensure that block data structure have a consistent data format.\n\t// E.g.:\n\t// - textual content (using rich-text formatting?) may always be stored under `block.text`\n\t// - local information that shouldn't be shared (e.g. clientId or isDragging) is stored under `block.private`\n\t//\n\t// @credit Kevin Jahns (dmonad)\n\t// @link https://github.com/WordPress/gutenberg/pull/68483\n\tconst numOfCommonEntries = Math.min(\n\t\tblocksToSync.length ?? 0,\n\t\tyblocks.length\n\t);\n\n\tlet left = 0;\n\tlet right = 0;\n\n\t// skip equal blocks from left\n\tfor (\n\t\t;\n\t\tleft < numOfCommonEntries &&\n\t\tareBlocksEqual( blocksToSync[ left ], yblocks.get( left ) );\n\t\tleft++\n\t) {\n\t\t/* nop */\n\t}\n\n\t// skip equal blocks from right\n\tfor (\n\t\t;\n\t\tright < numOfCommonEntries - left &&\n\t\tareBlocksEqual(\n\t\t\tblocksToSync[ blocksToSync.length - right - 1 ],\n\t\t\tyblocks.get( yblocks.length - right - 1 )\n\t\t);\n\t\tright++\n\t) {\n\t\t/* nop */\n\t}\n\n\tconst numOfUpdatesNeeded = numOfCommonEntries - left - right;\n\tconst numOfInsertionsNeeded = Math.max(\n\t\t0,\n\t\tblocksToSync.length - yblocks.length\n\t);\n\tconst numOfDeletionsNeeded = Math.max(\n\t\t0,\n\t\tyblocks.length - blocksToSync.length\n\t);\n\n\t// updates\n\tfor ( let i = 0; i < numOfUpdatesNeeded; i++, left++ ) {\n\t\tconst block = blocksToSync[ left ];\n\t\tconst yblock = yblocks.get( left );\n\t\tObject.entries( block ).forEach( ( [ key, value ] ) => {\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'attributes': {\n\t\t\t\t\tconst currentAttributes = yblock.get(\n\t\t\t\t\t\tkey\n\t\t\t\t\t) as YBlockAttributes;\n\n\t\t\t\t\t// If attributes are not set on the yblock, use the new values.\n\t\t\t\t\tif ( ! currentAttributes ) {\n\t\t\t\t\t\tyblock.set(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tcreateNewYAttributeMap( block.name, value )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tObject.entries( value ).forEach(\n\t\t\t\t\t\t( [ attributeName, attributeValue ] ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tfastDeepEqual(\n\t\t\t\t\t\t\t\t\tcurrentAttributes?.get( attributeName ),\n\t\t\t\t\t\t\t\t\tattributeValue\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\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst isRichText = isRichTextAttribute(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisRichText &&\n\t\t\t\t\t\t\t\t'string' === typeof attributeValue &&\n\t\t\t\t\t\t\t\tcurrentAttributes.has( attributeName ) &&\n\t\t\t\t\t\t\t\tcurrentAttributes.get(\n\t\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t\t) instanceof Y.Text\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Rich text values are stored as persistent Y.Text instances.\n\t\t\t\t\t\t\t\t// Update the value with a delta in place.\n\t\t\t\t\t\t\t\tmergeRichTextUpdate(\n\t\t\t\t\t\t\t\t\tcurrentAttributes.get(\n\t\t\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t\t\t) as Y.Text,\n\t\t\t\t\t\t\t\t\tattributeValue,\n\t\t\t\t\t\t\t\t\tlastSelection\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrentAttributes.set(\n\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\tcreateNewYAttributeValue(\n\t\t\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\t\t\t\tattributeValue\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\n\t\t\t\t\t// Delete any attributes that are no longer present.\n\t\t\t\t\tcurrentAttributes.forEach(\n\t\t\t\t\t\t( _attrValue: unknown, attrName: string ) => {\n\t\t\t\t\t\t\tif ( ! value.hasOwnProperty( attrName ) ) {\n\t\t\t\t\t\t\t\tcurrentAttributes.delete( attrName );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'innerBlocks': {\n\t\t\t\t\t// Recursively merge innerBlocks\n\t\t\t\t\tconst yInnerBlocks = yblock.get( key ) as Y.Array< YBlock >;\n\t\t\t\t\tmergeCrdtBlocks( yInnerBlocks, value ?? [], lastSelection );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tif ( ! fastDeepEqual( block[ key ], yblock.get( key ) ) ) {\n\t\t\t\t\t\tyblock.set( key, value );\n\t\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t\tyblock.forEach( ( _v, k ) => {\n\t\t\tif ( ! block.hasOwnProperty( k ) ) {\n\t\t\t\tyblock.delete( k );\n\t\t\t}\n\t\t} );\n\t}\n\n\t// deletes\n\tyblocks.delete( left, numOfDeletionsNeeded );\n\n\t// inserts\n\tfor ( let i = 0; i < numOfInsertionsNeeded; i++, left++ ) {\n\t\tconst newBlock = [ createNewYBlock( blocksToSync[ left ] ) ];\n\n\t\tyblocks.insert( left, newBlock );\n\t}\n\n\t// remove duplicate clientids\n\tconst knownClientIds = new Set< string >();\n\tfor ( let j = 0; j < yblocks.length; j++ ) {\n\t\tconst yblock: YBlock = yblocks.get( j );\n\n\t\tlet clientId: string = yblock.get( 'clientId' ) as string;\n\n\t\tif ( knownClientIds.has( clientId ) ) {\n\t\t\tclientId = uuidv4();\n\t\t\tyblock.set( 'clientId', clientId );\n\t\t}\n\t\tknownClientIds.add( clientId );\n\t}\n}\n\n/**\n * Determine if a block should be synced.\n *\n * Ex: A gallery block should not be synced until the images have been\n * uploaded to WordPress, and their url is available. Before that,\n * it's not possible to access the blobs on a client as those are\n * local.\n *\n * @param block The block to check.\n * @return True if the block should be synced, false otherwise.\n */\nfunction shouldBlockBeSynced( block: Block ): boolean {\n\t// Verify that the gallery block is ready to be synced.\n\t// This means that, all images have had their blobs converted to full URLs.\n\t// Checking for only the blobs ensures that blocks that have just been inserted work as well.\n\tif ( 'core/gallery' === block.name ) {\n\t\treturn ! block.innerBlocks.some(\n\t\t\t( innerBlock ) =>\n\t\t\t\tinnerBlock.attributes && innerBlock.attributes.blob\n\t\t);\n\t}\n\n\t// Allow all other blocks to be synced.\n\treturn true;\n}\n\n// Cache rich-text attributes for all block types.\nlet cachedRichTextAttributes: Map< string, Map< string, true > >;\n\n/**\n * Given a block name and attribute key, return true if the attribute is rich-text typed.\n *\n * @param blockName The name of the block, e.g. 'core/paragraph'.\n * @param attributeName The name of the attribute to check, e.g. 'content'.\n * @return True if the attribute is rich-text typed, false otherwise.\n */\nfunction isRichTextAttribute(\n\tblockName: string,\n\tattributeName: string\n): boolean {\n\tif ( ! cachedRichTextAttributes ) {\n\t\t// Parse the attributes for all blocks once.\n\t\tcachedRichTextAttributes = new Map< string, Map< string, true > >();\n\n\t\tfor ( const blockType of getBlockTypes() as BlockType[] ) {\n\t\t\tconst richTextAttributeMap = new Map< string, true >();\n\n\t\t\tfor ( const [ name, definition ] of Object.entries(\n\t\t\t\tblockType.attributes ?? {}\n\t\t\t) ) {\n\t\t\t\tif ( 'rich-text' === definition.type ) {\n\t\t\t\t\trichTextAttributeMap.set( name, true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcachedRichTextAttributes.set(\n\t\t\t\tblockType.name,\n\t\t\t\trichTextAttributeMap\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\tcachedRichTextAttributes.get( blockName )?.has( attributeName ) ?? false\n\t);\n}\n\n/**\n * Given a Y.Text object and an updated string value, diff the new value and\n * apply the delta to the Y.Text.\n *\n * @param blockYText The Y.Text to update.\n * @param updatedValue The updated value.\n * @param lastSelection The last cursor position before this update, used to hint the diff algorithm.\n */\nfunction mergeRichTextUpdate(\n\tblockYText: Y.Text,\n\tupdatedValue: string,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tlastSelection: WPBlockSelection | null\n): void {\n\t// TODO\n\t// ====\n\t// Gutenberg does not use Yjs shared types natively, so we can only subscribe\n\t// to changes from store and apply them to Yjs types that we create and\n\t// manage. Crucially, for rich-text attributes, we do not receive granular\n\t// string updates; we get the new full string value on each change, even when\n\t// only a single character changed.\n\t//\n\t// The code below allows us to compute a delta between the current and new\n\t// value, then apply it to the Y.Text. However, it relies on a library\n\t// (quill-delta) with a licensing issue that we are working to resolve.\n\t//\n\t// For now, we simply replace the full text content on each change.\n\t//\n\t// if ( ! localDoc ) {\n\t// \t// Y.Text must be attached to a Y.Doc to be able to do operations on it.\n\t// \t// Create a temporary Y.Text attached to a local Y.Doc for delta computation.\n\t// \tlocalDoc = new Y.Doc();\n\t// }\n\n\t// const localYText = localDoc.getText( 'temporary-text' );\n\t// localYText.delete( 0, localYText.length );\n\t// localYText.insert( 0, updatedValue );\n\n\t// const currentValueAsDelta = new Delta( blockYText.toDelta() );\n\t// const updatedValueAsDelta = new Delta( localYText.toDelta() );\n\n\t// const deltaDiff = currentValueAsDelta.diff(\n\t// \tupdatedValueAsDelta,\n\t// \tlastSelection?.offset\n\t// );\n\n\t// blockYText.applyDelta( deltaDiff.ops );\n\n\tblockYText.delete( 0, blockYText.toString().length );\n\tblockYText.insert( 0, updatedValue );\n}\n"],
5
+ "mappings": ";AAGA,SAAS,MAAM,cAAc;AAC7B,OAAO,mBAAmB;AAK1B,SAAS,oBAAoB;AAC7B,SAAS,SAA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AAK,UAAW;AAE9C,QAAK,eAAe,IAAK,QAAS,GAAI;AACrC,iBAAW,OAAO;AAClB,aAAO,IAAK,YAAY,QAAS;AAAA,IAClC;AACA,mBAAe,IAAK,QAAS;AAAA,EAC9B;AACD;AAaA,SAAS,oBAAqB,OAAwB;AAIrD,MAAK,mBAAmB,MAAM,MAAO;AACpC,WAAO,CAAE,MAAM,YAAY;AAAA,MAC1B,CAAE,eACD,WAAW,cAAc,WAAW,WAAW;AAAA,IACjD;AAAA,EACD;AAGA,SAAO;AACR;AAGA,IAAI;AASJ,SAAS,oBACR,WACA,eACU;AACV,MAAK,CAAE,0BAA2B;AAEjC,+BAA2B,oBAAI,IAAmC;AAElE,eAAY,aAAa,cAAc,GAAmB;AACzD,YAAM,uBAAuB,oBAAI,IAAoB;AAErD,iBAAY,CAAE,MAAM,UAAW,KAAK,OAAO;AAAA,QAC1C,UAAU,cAAc,CAAC;AAAA,MAC1B,GAAI;AACH,YAAK,gBAAgB,WAAW,MAAO;AACtC,+BAAqB,IAAK,MAAM,IAAK;AAAA,QACtC;AAAA,MACD;AAEA,+BAAyB;AAAA,QACxB,UAAU;AAAA,QACV;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SACC,yBAAyB,IAAK,SAAU,GAAG,IAAK,aAAc,KAAK;AAErE;AAUA,SAAS,oBACR,YACA,cAEA,eACO;AAmCP,aAAW,OAAQ,GAAG,WAAW,SAAS,EAAE,MAAO;AACnD,aAAW,OAAQ,GAAG,YAAa;AACpC;",
6
6
  "names": []
7
7
  }
@@ -4,12 +4,12 @@ import { __unstableSerializeAndClean } from "@wordpress/blocks";
4
4
  import { Y } from "@wordpress/sync";
5
5
  import {
6
6
  mergeCrdtBlocks
7
- } from "./crdt-blocks";
7
+ } from "./crdt-blocks.mjs";
8
8
  import {
9
9
  CRDT_DOC_META_PERSISTENCE_KEY,
10
10
  CRDT_RECORD_MAP_KEY,
11
11
  WORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE
12
- } from "../sync";
12
+ } from "../sync.mjs";
13
13
  var lastSelection = null;
14
14
  var allowedPostProperties = /* @__PURE__ */ new Set([
15
15
  "author",
@@ -157,7 +157,7 @@ function getPostChangesFromCRDTDoc(ydoc, editedRecord, _postType) {
157
157
  const currentDateIsFloating = ["draft", "auto-draft", "pending"].includes(
158
158
  ymap.get("status")
159
159
  ) && (null === currentValue || editedRecord.modified === currentValue);
160
- if (!newValue && currentDateIsFloating) {
160
+ if (currentDateIsFloating) {
161
161
  return false;
162
162
  }
163
163
  return haveValuesChanged(currentValue, newValue);
@@ -225,4 +225,4 @@ export {
225
225
  defaultGetChangesFromCRDTDoc,
226
226
  getPostChangesFromCRDTDoc
227
227
  };
228
- //# sourceMappingURL=crdt.js.map
228
+ //# sourceMappingURL=crdt.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/crdt.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\n// @ts-expect-error No exported types.\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { type CRDTDoc, type ObjectData, Y } from '@wordpress/sync';\n\n/**\n * Internal dependencies\n */\nimport {\n\tmergeCrdtBlocks,\n\ttype Block,\n\ttype YBlock,\n\ttype YBlocks,\n} from './crdt-blocks';\nimport { type Post } from '../entity-types/post';\nimport { type Type } from '../entity-types';\nimport {\n\tCRDT_DOC_META_PERSISTENCE_KEY,\n\tCRDT_RECORD_MAP_KEY,\n\tWORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE,\n} from '../sync';\nimport type { WPBlockSelection, WPSelection } from '../types';\n\nexport type PostChanges = Partial< Post > & {\n\tblocks?: Block[];\n\texcerpt?: Post[ 'excerpt' ] | string;\n\tselection?: WPSelection;\n\ttitle?: Post[ 'title' ] | string;\n};\n\n// Hold a reference to the last known selection to help compute Y.Text deltas.\nlet lastSelection: WPBlockSelection | null = null;\n\n// Properties that are allowed to be synced for a post.\nconst allowedPostProperties = new Set< string >( [\n\t'author',\n\t'blocks',\n\t'comment_status',\n\t'date',\n\t'excerpt',\n\t'featured_media',\n\t'format',\n\t'ping_status',\n\t'meta',\n\t'slug',\n\t'status',\n\t'sticky',\n\t'tags',\n\t'template',\n\t'title',\n] );\n\n// Post meta keys that should *not* be synced.\nconst disallowedPostMetaKeys = new Set< string >( [\n\tWORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE,\n] );\n\n/**\n * Given a set of local changes to a generic entity record, apply those changes\n * to the local Y.Doc.\n *\n * @param {CRDTDoc} ydoc\n * @param {Partial< ObjectData >} changes\n * @return {void}\n */\nexport function defaultApplyChangesToCRDTDoc(\n\tydoc: CRDTDoc,\n\tchanges: ObjectData\n): void {\n\tconst ymap = ydoc.getMap( CRDT_RECORD_MAP_KEY );\n\n\tObject.entries( changes ).forEach( ( [ key, newValue ] ) => {\n\t\t// Cannot serialize function values, so cannot sync them.\n\t\tif ( 'function' === typeof newValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set the value in the root document.\n\t\tfunction setValue< T = unknown >( updatedValue: T ): void {\n\t\t\tymap.set( key, updatedValue );\n\t\t}\n\n\t\tswitch ( key ) {\n\t\t\t// Add support for additional data types here.\n\n\t\t\tdefault: {\n\t\t\t\tconst currentValue = ymap.get( key );\n\t\t\t\tmergeValue( currentValue, newValue, setValue );\n\t\t\t}\n\t\t}\n\t} );\n}\n\n/**\n * Given a set of local changes to a post record, apply those changes to the\n * local Y.Doc.\n *\n * @param {CRDTDoc} ydoc\n * @param {PostChanges} changes\n * @param {Type} _postType\n * @return {void}\n */\nexport function applyPostChangesToCRDTDoc(\n\tydoc: CRDTDoc,\n\tchanges: PostChanges,\n\t_postType: Type // eslint-disable-line @typescript-eslint/no-unused-vars\n): void {\n\tconst ymap = ydoc.getMap( CRDT_RECORD_MAP_KEY );\n\n\tObject.entries( changes ).forEach( ( [ key, newValue ] ) => {\n\t\tif ( ! allowedPostProperties.has( key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Cannot serialize function values, so cannot sync them.\n\t\tif ( 'function' === typeof newValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set the value in the root document.\n\t\tfunction setValue< T = unknown >( updatedValue: T ): void {\n\t\t\tymap.set( key, updatedValue );\n\t\t}\n\n\t\tswitch ( key ) {\n\t\t\tcase 'blocks': {\n\t\t\t\tlet currentBlocks = ymap.get( 'blocks' ) as YBlocks;\n\n\t\t\t\t// Initialize.\n\t\t\t\tif ( ! ( currentBlocks instanceof Y.Array ) ) {\n\t\t\t\t\tcurrentBlocks = new Y.Array< YBlock >();\n\t\t\t\t\tsetValue( currentBlocks );\n\t\t\t\t}\n\n\t\t\t\t// Block[] from local changes.\n\t\t\t\tconst newBlocks = ( newValue as PostChanges[ 'blocks' ] ) ?? [];\n\n\t\t\t\t// Merge blocks does not need `setValue` because it is operating on a\n\t\t\t\t// Yjs type that is already in the Y.Doc.\n\t\t\t\tmergeCrdtBlocks( currentBlocks, newBlocks, lastSelection );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'excerpt': {\n\t\t\t\tconst currentValue = ymap.get( 'excerpt' ) as\n\t\t\t\t\t| string\n\t\t\t\t\t| undefined;\n\t\t\t\tconst rawNewValue = getRawValue( newValue );\n\n\t\t\t\tmergeValue( currentValue, rawNewValue, setValue );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// \"Meta\" is overloaded term; here, it refers to post meta.\n\t\t\tcase 'meta': {\n\t\t\t\tlet metaMap = ymap.get( 'meta' ) as Y.Map< unknown >;\n\n\t\t\t\t// Initialize.\n\t\t\t\tif ( ! ( metaMap instanceof Y.Map ) ) {\n\t\t\t\t\tmetaMap = new Y.Map();\n\t\t\t\t\tsetValue( metaMap );\n\t\t\t\t}\n\n\t\t\t\t// Iterate over each meta property in the new value and merge it if it\n\t\t\t\t// should be synced.\n\t\t\t\tObject.entries( newValue ?? {} ).forEach(\n\t\t\t\t\t( [ metaKey, metaValue ] ) => {\n\t\t\t\t\t\tif ( disallowedPostMetaKeys.has( metaKey ) ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmergeValue(\n\t\t\t\t\t\t\tmetaMap.get( metaKey ), // current value in CRDT\n\t\t\t\t\t\t\tmetaValue, // new value from changes\n\t\t\t\t\t\t\t( updatedMetaValue: unknown ): void => {\n\t\t\t\t\t\t\t\tmetaMap.set( metaKey, updatedMetaValue );\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\tbreak;\n\t\t\t}\n\n\t\t\tcase 'slug': {\n\t\t\t\t// Do not sync an empty slug. This indicates that the post is using\n\t\t\t\t// the default auto-generated slug.\n\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst currentValue = ymap.get( 'slug' ) as string;\n\t\t\t\tmergeValue( currentValue, newValue, setValue );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'title': {\n\t\t\t\tconst currentValue = ymap.get( 'title' ) as string | undefined;\n\n\t\t\t\t// Copy logic from prePersistPostType to ensure that the \"Auto\n\t\t\t\t// Draft\" template title is not synced.\n\t\t\t\tlet rawNewValue = getRawValue( newValue );\n\t\t\t\tif ( ! currentValue && 'Auto Draft' === rawNewValue ) {\n\t\t\t\t\trawNewValue = '';\n\t\t\t\t}\n\n\t\t\t\tmergeValue( currentValue, rawNewValue, setValue );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Add support for additional data types here.\n\n\t\t\tdefault: {\n\t\t\t\tconst currentValue = ymap.get( key );\n\t\t\t\tmergeValue( currentValue, newValue, setValue );\n\t\t\t}\n\t\t}\n\t} );\n\n\t// Update the lastSelection for use in computing Y.Text deltas.\n\tif ( 'selection' in changes ) {\n\t\tlastSelection = changes.selection?.selectionStart ?? null;\n\t}\n}\n\nexport function defaultGetChangesFromCRDTDoc( crdtDoc: CRDTDoc ): ObjectData {\n\treturn crdtDoc.getMap( CRDT_RECORD_MAP_KEY ).toJSON();\n}\n\n/**\n * Given a local Y.Doc that *may* contain changes from remote peers, compare\n * against the local record and determine if there are changes (edits) we want\n * to dispatch.\n *\n * @param {CRDTDoc} ydoc\n * @param {Post} editedRecord\n * @param {Type} _postType\n * @return {Partial<PostChanges>} The changes that should be applied to the local record.\n */\nexport function getPostChangesFromCRDTDoc(\n\tydoc: CRDTDoc,\n\teditedRecord: Post,\n\t_postType: Type // eslint-disable-line @typescript-eslint/no-unused-vars\n): PostChanges {\n\tconst ymap = ydoc.getMap( CRDT_RECORD_MAP_KEY );\n\n\tlet allowedMetaChanges: Post[ 'meta' ] = {};\n\n\tconst changes = Object.fromEntries(\n\t\tObject.entries( ymap.toJSON() ).filter( ( [ key, newValue ] ) => {\n\t\t\tif ( ! allowedPostProperties.has( key ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst currentValue = editedRecord[ key ];\n\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'blocks': {\n\t\t\t\t\t// When we are passed a persisted CRDT document, make a special\n\t\t\t\t\t// comparison of the content and blocks.\n\t\t\t\t\t//\n\t\t\t\t\t// When other fields (besides `blocks`) are mutated outside the block\n\t\t\t\t\t// editor, the change is caught by an equality check (see other cases\n\t\t\t\t\t// in this `switch` statement). As a transient property, `blocks`\n\t\t\t\t\t// cannot be directly mutated outside the block editor -- only\n\t\t\t\t\t// `content` can.\n\t\t\t\t\t//\n\t\t\t\t\t// Therefore, for this special comparison, we serialize the `blocks`\n\t\t\t\t\t// from the persisted CRDT document and compare that to the content\n\t\t\t\t\t// from the persisted record. If they differ, we know that the content\n\t\t\t\t\t// in the database has changed, and therefore the blocks have changed.\n\t\t\t\t\t//\n\t\t\t\t\t// We cannot directly compare the `blocks` from the CRDT document to\n\t\t\t\t\t// the `blocks` derived from the `content` in the persisted record,\n\t\t\t\t\t// because the latter will have different client IDs.\n\t\t\t\t\tif (\n\t\t\t\t\t\tydoc.meta?.get( CRDT_DOC_META_PERSISTENCE_KEY ) &&\n\t\t\t\t\t\teditedRecord.content\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst blocks = ymap.get( 'blocks' ) as YBlocks;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t__unstableSerializeAndClean(\n\t\t\t\t\t\t\t\tblocks.toJSON()\n\t\t\t\t\t\t\t).trim() !== editedRecord.content.raw.trim()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// The consumers of blocks have memoization that renders optimization\n\t\t\t\t\t// here unnecessary.\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tcase 'date': {\n\t\t\t\t\t// Do not sync an empty date if our current value is a \"floating\" date.\n\t\t\t\t\t// Borrowing logic from the isEditedPostDateFloating selector.\n\t\t\t\t\tconst currentDateIsFloating =\n\t\t\t\t\t\t[ 'draft', 'auto-draft', 'pending' ].includes(\n\t\t\t\t\t\t\tymap.get( 'status' ) as string\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\t( null === currentValue ||\n\t\t\t\t\t\t\teditedRecord.modified === currentValue );\n\n\t\t\t\t\tif ( ! newValue && currentDateIsFloating ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn haveValuesChanged( currentValue, newValue );\n\t\t\t\t}\n\n\t\t\t\tcase 'meta': {\n\t\t\t\t\tallowedMetaChanges = Object.fromEntries(\n\t\t\t\t\t\tObject.entries( newValue ?? {} ).filter(\n\t\t\t\t\t\t\t( [ metaKey ] ) =>\n\t\t\t\t\t\t\t\t! disallowedPostMetaKeys.has( metaKey )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\t\t// Merge the allowed meta changes with the current meta values since\n\t\t\t\t\t// not all meta properties are synced.\n\t\t\t\t\tconst mergedValue = {\n\t\t\t\t\t\t...( currentValue as PostChanges[ 'meta' ] ),\n\t\t\t\t\t\t...allowedMetaChanges,\n\t\t\t\t\t};\n\n\t\t\t\t\treturn haveValuesChanged( currentValue, mergedValue );\n\t\t\t\t}\n\n\t\t\t\tcase 'status': {\n\t\t\t\t\t// Do not sync an invalid status.\n\t\t\t\t\tif ( 'auto-draft' === newValue ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn haveValuesChanged( currentValue, newValue );\n\t\t\t\t}\n\n\t\t\t\tcase 'excerpt':\n\t\t\t\tcase 'title': {\n\t\t\t\t\treturn haveValuesChanged(\n\t\t\t\t\t\tgetRawValue( currentValue ),\n\t\t\t\t\t\tnewValue\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Add support for additional data types here.\n\n\t\t\t\tdefault: {\n\t\t\t\t\treturn haveValuesChanged( currentValue, newValue );\n\t\t\t\t}\n\t\t\t}\n\t\t} )\n\t);\n\n\t// Meta changes must be merged with the edited record since not all meta\n\t// properties are synced.\n\tif ( 'object' === typeof changes.meta ) {\n\t\tchanges.meta = {\n\t\t\t...editedRecord.meta,\n\t\t\t...allowedMetaChanges,\n\t\t};\n\t}\n\n\treturn changes;\n}\n\n/**\n * Extract the raw string value from a property that may be a string or an object\n * with a `raw` property (`RenderedText`).\n *\n * @param {unknown} value The value to extract from.\n * @return {string|undefined} The raw string value, or undefined if it could not be determined.\n */\nfunction getRawValue( value?: unknown ): string | undefined {\n\t// Value may be a string property or a nested object with a `raw` property.\n\tif ( 'string' === typeof value ) {\n\t\treturn value;\n\t}\n\n\tif (\n\t\tvalue &&\n\t\t'object' === typeof value &&\n\t\t'raw' in value &&\n\t\t'string' === typeof value.raw\n\t) {\n\t\treturn value.raw;\n\t}\n\n\treturn undefined;\n}\n\nfunction haveValuesChanged< ValueType = any >(\n\tcurrentValue: ValueType,\n\tnewValue: ValueType\n): boolean {\n\treturn ! fastDeepEqual( currentValue, newValue );\n}\n\nfunction mergeValue< ValueType = any >(\n\tcurrentValue: ValueType,\n\tnewValue: ValueType,\n\tsetValue: ( value: ValueType ) => void\n): void {\n\tif ( haveValuesChanged< ValueType >( currentValue, newValue ) ) {\n\t\tsetValue( newValue );\n\t}\n}\n"],
5
- "mappings": ";AAGA,OAAO,mBAAmB;AAM1B,SAAS,mCAAmC;AAC5C,SAAwC,SAAS;AAKjD;AAAA,EACC;AAAA,OAIM;AAGP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAWP,IAAI,gBAAyC;AAG7C,IAAM,wBAAwB,oBAAI,IAAe;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAGF,IAAM,yBAAyB,oBAAI,IAAe;AAAA,EACjD;AACD,CAAE;AAUK,SAAS,6BACf,MACA,SACO;AACP,QAAM,OAAO,KAAK,OAAQ,mBAAoB;AAE9C,SAAO,QAAS,OAAQ,EAAE,QAAS,CAAE,CAAE,KAAK,QAAS,MAAO;AAE3D,QAAK,eAAe,OAAO,UAAW;AACrC;AAAA,IACD;AAGA,aAAS,SAAyB,cAAwB;AACzD,WAAK,IAAK,KAAK,YAAa;AAAA,IAC7B;AAEA,YAAS,KAAM;AAAA;AAAA,MAGd,SAAS;AACR,cAAM,eAAe,KAAK,IAAK,GAAI;AACnC,mBAAY,cAAc,UAAU,QAAS;AAAA,MAC9C;AAAA,IACD;AAAA,EACD,CAAE;AACH;AAWO,SAAS,0BACf,MACA,SACA,WACO;AACP,QAAM,OAAO,KAAK,OAAQ,mBAAoB;AAE9C,SAAO,QAAS,OAAQ,EAAE,QAAS,CAAE,CAAE,KAAK,QAAS,MAAO;AAC3D,QAAK,CAAE,sBAAsB,IAAK,GAAI,GAAI;AACzC;AAAA,IACD;AAGA,QAAK,eAAe,OAAO,UAAW;AACrC;AAAA,IACD;A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;AACZ,+BAAqB,OAAO;AAAA,YAC3B,OAAO,QAAS,YAAY,CAAC,CAAE,EAAE;AAAA,cAChC,CAAE,CAAE,OAAQ,MACX,CAAE,uBAAuB,IAAK,OAAQ;AAAA,YACxC;AAAA,UACD;AAIA,gBAAM,cAAc;AAAA,YACnB,GAAK;AAAA,YACL,GAAG;AAAA,UACJ;AAEA,iBAAO,kBAAmB,cAAc,WAAY;AAAA,QACrD;AAAA,QAEA,KAAK,UAAU;AAEd,cAAK,iBAAiB,UAAW;AAChC,mBAAO;AAAA,UACR;AAEA,iBAAO,kBAAmB,cAAc,QAAS;AAAA,QAClD;AAAA,QAEA,KAAK;AAAA,QACL,KAAK,SAAS;AACb,iBAAO;AAAA,YACN,YAAa,YAAa;AAAA,YAC1B;AAAA,UACD;AAAA,QACD;AAAA;AAAA,QAIA,SAAS;AACR,iBAAO,kBAAmB,cAAc,QAAS;AAAA,QAClD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH;AAIA,MAAK,aAAa,OAAO,QAAQ,MAAO;AACvC,YAAQ,OAAO;AAAA,MACd,GAAG,aAAa;AAAA,MAChB,GAAG;AAAA,IACJ;AAAA,EACD;AAEA,SAAO;AACR;AASA,SAAS,YAAa,OAAsC;AAE3D,MAAK,aAAa,OAAO,OAAQ;AAChC,WAAO;AAAA,EACR;AAEA,MACC,SACA,aAAa,OAAO,SACpB,SAAS,SACT,aAAa,OAAO,MAAM,KACzB;AACD,WAAO,MAAM;AAAA,EACd;AAEA,SAAO;AACR;AAEA,SAAS,kBACR,cACA,UACU;AACV,SAAO,CAAE,cAAe,cAAc,QAAS;AAChD;AAEA,SAAS,WACR,cACA,UACA,UACO;AACP,MAAK,kBAAgC,cAAc,QAAS,GAAI;AAC/D,aAAU,QAAS;AAAA,EACpB;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\n// @ts-expect-error No exported types.\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { type CRDTDoc, type ObjectData, Y } from '@wordpress/sync';\n\n/**\n * Internal dependencies\n */\nimport {\n\tmergeCrdtBlocks,\n\ttype Block,\n\ttype YBlock,\n\ttype YBlocks,\n} from './crdt-blocks';\nimport { type Post } from '../entity-types/post';\nimport { type Type } from '../entity-types';\nimport {\n\tCRDT_DOC_META_PERSISTENCE_KEY,\n\tCRDT_RECORD_MAP_KEY,\n\tWORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE,\n} from '../sync';\nimport type { WPBlockSelection, WPSelection } from '../types';\n\nexport type PostChanges = Partial< Post > & {\n\tblocks?: Block[];\n\texcerpt?: Post[ 'excerpt' ] | string;\n\tselection?: WPSelection;\n\ttitle?: Post[ 'title' ] | string;\n};\n\n// Hold a reference to the last known selection to help compute Y.Text deltas.\nlet lastSelection: WPBlockSelection | null = null;\n\n// Properties that are allowed to be synced for a post.\nconst allowedPostProperties = new Set< string >( [\n\t'author',\n\t'blocks',\n\t'comment_status',\n\t'date',\n\t'excerpt',\n\t'featured_media',\n\t'format',\n\t'ping_status',\n\t'meta',\n\t'slug',\n\t'status',\n\t'sticky',\n\t'tags',\n\t'template',\n\t'title',\n] );\n\n// Post meta keys that should *not* be synced.\nconst disallowedPostMetaKeys = new Set< string >( [\n\tWORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE,\n] );\n\n/**\n * Given a set of local changes to a generic entity record, apply those changes\n * to the local Y.Doc.\n *\n * @param {CRDTDoc} ydoc\n * @param {Partial< ObjectData >} changes\n * @return {void}\n */\nexport function defaultApplyChangesToCRDTDoc(\n\tydoc: CRDTDoc,\n\tchanges: ObjectData\n): void {\n\tconst ymap = ydoc.getMap( CRDT_RECORD_MAP_KEY );\n\n\tObject.entries( changes ).forEach( ( [ key, newValue ] ) => {\n\t\t// Cannot serialize function values, so cannot sync them.\n\t\tif ( 'function' === typeof newValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set the value in the root document.\n\t\tfunction setValue< T = unknown >( updatedValue: T ): void {\n\t\t\tymap.set( key, updatedValue );\n\t\t}\n\n\t\tswitch ( key ) {\n\t\t\t// Add support for additional data types here.\n\n\t\t\tdefault: {\n\t\t\t\tconst currentValue = ymap.get( key );\n\t\t\t\tmergeValue( currentValue, newValue, setValue );\n\t\t\t}\n\t\t}\n\t} );\n}\n\n/**\n * Given a set of local changes to a post record, apply those changes to the\n * local Y.Doc.\n *\n * @param {CRDTDoc} ydoc\n * @param {PostChanges} changes\n * @param {Type} _postType\n * @return {void}\n */\nexport function applyPostChangesToCRDTDoc(\n\tydoc: CRDTDoc,\n\tchanges: PostChanges,\n\t_postType: Type // eslint-disable-line @typescript-eslint/no-unused-vars\n): void {\n\tconst ymap = ydoc.getMap( CRDT_RECORD_MAP_KEY );\n\n\tObject.entries( changes ).forEach( ( [ key, newValue ] ) => {\n\t\tif ( ! allowedPostProperties.has( key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Cannot serialize function values, so cannot sync them.\n\t\tif ( 'function' === typeof newValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set the value in the root document.\n\t\tfunction setValue< T = unknown >( updatedValue: T ): void {\n\t\t\tymap.set( key, updatedValue );\n\t\t}\n\n\t\tswitch ( key ) {\n\t\t\tcase 'blocks': {\n\t\t\t\tlet currentBlocks = ymap.get( 'blocks' ) as YBlocks;\n\n\t\t\t\t// Initialize.\n\t\t\t\tif ( ! ( currentBlocks instanceof Y.Array ) ) {\n\t\t\t\t\tcurrentBlocks = new Y.Array< YBlock >();\n\t\t\t\t\tsetValue( currentBlocks );\n\t\t\t\t}\n\n\t\t\t\t// Block[] from local changes.\n\t\t\t\tconst newBlocks = ( newValue as PostChanges[ 'blocks' ] ) ?? [];\n\n\t\t\t\t// Merge blocks does not need `setValue` because it is operating on a\n\t\t\t\t// Yjs type that is already in the Y.Doc.\n\t\t\t\tmergeCrdtBlocks( currentBlocks, newBlocks, lastSelection );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'excerpt': {\n\t\t\t\tconst currentValue = ymap.get( 'excerpt' ) as\n\t\t\t\t\t| string\n\t\t\t\t\t| undefined;\n\t\t\t\tconst rawNewValue = getRawValue( newValue );\n\n\t\t\t\tmergeValue( currentValue, rawNewValue, setValue );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// \"Meta\" is overloaded term; here, it refers to post meta.\n\t\t\tcase 'meta': {\n\t\t\t\tlet metaMap = ymap.get( 'meta' ) as Y.Map< unknown >;\n\n\t\t\t\t// Initialize.\n\t\t\t\tif ( ! ( metaMap instanceof Y.Map ) ) {\n\t\t\t\t\tmetaMap = new Y.Map();\n\t\t\t\t\tsetValue( metaMap );\n\t\t\t\t}\n\n\t\t\t\t// Iterate over each meta property in the new value and merge it if it\n\t\t\t\t// should be synced.\n\t\t\t\tObject.entries( newValue ?? {} ).forEach(\n\t\t\t\t\t( [ metaKey, metaValue ] ) => {\n\t\t\t\t\t\tif ( disallowedPostMetaKeys.has( metaKey ) ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmergeValue(\n\t\t\t\t\t\t\tmetaMap.get( metaKey ), // current value in CRDT\n\t\t\t\t\t\t\tmetaValue, // new value from changes\n\t\t\t\t\t\t\t( updatedMetaValue: unknown ): void => {\n\t\t\t\t\t\t\t\tmetaMap.set( metaKey, updatedMetaValue );\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\tbreak;\n\t\t\t}\n\n\t\t\tcase 'slug': {\n\t\t\t\t// Do not sync an empty slug. This indicates that the post is using\n\t\t\t\t// the default auto-generated slug.\n\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst currentValue = ymap.get( 'slug' ) as string;\n\t\t\t\tmergeValue( currentValue, newValue, setValue );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'title': {\n\t\t\t\tconst currentValue = ymap.get( 'title' ) as string | undefined;\n\n\t\t\t\t// Copy logic from prePersistPostType to ensure that the \"Auto\n\t\t\t\t// Draft\" template title is not synced.\n\t\t\t\tlet rawNewValue = getRawValue( newValue );\n\t\t\t\tif ( ! currentValue && 'Auto Draft' === rawNewValue ) {\n\t\t\t\t\trawNewValue = '';\n\t\t\t\t}\n\n\t\t\t\tmergeValue( currentValue, rawNewValue, setValue );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Add support for additional data types here.\n\n\t\t\tdefault: {\n\t\t\t\tconst currentValue = ymap.get( key );\n\t\t\t\tmergeValue( currentValue, newValue, setValue );\n\t\t\t}\n\t\t}\n\t} );\n\n\t// Update the lastSelection for use in computing Y.Text deltas.\n\tif ( 'selection' in changes ) {\n\t\tlastSelection = changes.selection?.selectionStart ?? null;\n\t}\n}\n\nexport function defaultGetChangesFromCRDTDoc( crdtDoc: CRDTDoc ): ObjectData {\n\treturn crdtDoc.getMap( CRDT_RECORD_MAP_KEY ).toJSON();\n}\n\n/**\n * Given a local Y.Doc that *may* contain changes from remote peers, compare\n * against the local record and determine if there are changes (edits) we want\n * to dispatch.\n *\n * @param {CRDTDoc} ydoc\n * @param {Post} editedRecord\n * @param {Type} _postType\n * @return {Partial<PostChanges>} The changes that should be applied to the local record.\n */\nexport function getPostChangesFromCRDTDoc(\n\tydoc: CRDTDoc,\n\teditedRecord: Post,\n\t_postType: Type // eslint-disable-line @typescript-eslint/no-unused-vars\n): PostChanges {\n\tconst ymap = ydoc.getMap( CRDT_RECORD_MAP_KEY );\n\n\tlet allowedMetaChanges: Post[ 'meta' ] = {};\n\n\tconst changes = Object.fromEntries(\n\t\tObject.entries( ymap.toJSON() ).filter( ( [ key, newValue ] ) => {\n\t\t\tif ( ! allowedPostProperties.has( key ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst currentValue = editedRecord[ key ];\n\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'blocks': {\n\t\t\t\t\t// When we are passed a persisted CRDT document, make a special\n\t\t\t\t\t// comparison of the content and blocks.\n\t\t\t\t\t//\n\t\t\t\t\t// When other fields (besides `blocks`) are mutated outside the block\n\t\t\t\t\t// editor, the change is caught by an equality check (see other cases\n\t\t\t\t\t// in this `switch` statement). As a transient property, `blocks`\n\t\t\t\t\t// cannot be directly mutated outside the block editor -- only\n\t\t\t\t\t// `content` can.\n\t\t\t\t\t//\n\t\t\t\t\t// Therefore, for this special comparison, we serialize the `blocks`\n\t\t\t\t\t// from the persisted CRDT document and compare that to the content\n\t\t\t\t\t// from the persisted record. If they differ, we know that the content\n\t\t\t\t\t// in the database has changed, and therefore the blocks have changed.\n\t\t\t\t\t//\n\t\t\t\t\t// We cannot directly compare the `blocks` from the CRDT document to\n\t\t\t\t\t// the `blocks` derived from the `content` in the persisted record,\n\t\t\t\t\t// because the latter will have different client IDs.\n\t\t\t\t\tif (\n\t\t\t\t\t\tydoc.meta?.get( CRDT_DOC_META_PERSISTENCE_KEY ) &&\n\t\t\t\t\t\teditedRecord.content\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst blocks = ymap.get( 'blocks' ) as YBlocks;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t__unstableSerializeAndClean(\n\t\t\t\t\t\t\t\tblocks.toJSON()\n\t\t\t\t\t\t\t).trim() !== editedRecord.content.raw.trim()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// The consumers of blocks have memoization that renders optimization\n\t\t\t\t\t// here unnecessary.\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tcase 'date': {\n\t\t\t\t\t// Do not overwrite a \"floating\" date. Borrowing logic from the\n\t\t\t\t\t// isEditedPostDateFloating selector.\n\t\t\t\t\tconst currentDateIsFloating =\n\t\t\t\t\t\t[ 'draft', 'auto-draft', 'pending' ].includes(\n\t\t\t\t\t\t\tymap.get( 'status' ) as string\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\t( null === currentValue ||\n\t\t\t\t\t\t\teditedRecord.modified === currentValue );\n\n\t\t\t\t\tif ( currentDateIsFloating ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn haveValuesChanged( currentValue, newValue );\n\t\t\t\t}\n\n\t\t\t\tcase 'meta': {\n\t\t\t\t\tallowedMetaChanges = Object.fromEntries(\n\t\t\t\t\t\tObject.entries( newValue ?? {} ).filter(\n\t\t\t\t\t\t\t( [ metaKey ] ) =>\n\t\t\t\t\t\t\t\t! disallowedPostMetaKeys.has( metaKey )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\t\t// Merge the allowed meta changes with the current meta values since\n\t\t\t\t\t// not all meta properties are synced.\n\t\t\t\t\tconst mergedValue = {\n\t\t\t\t\t\t...( currentValue as PostChanges[ 'meta' ] ),\n\t\t\t\t\t\t...allowedMetaChanges,\n\t\t\t\t\t};\n\n\t\t\t\t\treturn haveValuesChanged( currentValue, mergedValue );\n\t\t\t\t}\n\n\t\t\t\tcase 'status': {\n\t\t\t\t\t// Do not sync an invalid status.\n\t\t\t\t\tif ( 'auto-draft' === newValue ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn haveValuesChanged( currentValue, newValue );\n\t\t\t\t}\n\n\t\t\t\tcase 'excerpt':\n\t\t\t\tcase 'title': {\n\t\t\t\t\treturn haveValuesChanged(\n\t\t\t\t\t\tgetRawValue( currentValue ),\n\t\t\t\t\t\tnewValue\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Add support for additional data types here.\n\n\t\t\t\tdefault: {\n\t\t\t\t\treturn haveValuesChanged( currentValue, newValue );\n\t\t\t\t}\n\t\t\t}\n\t\t} )\n\t);\n\n\t// Meta changes must be merged with the edited record since not all meta\n\t// properties are synced.\n\tif ( 'object' === typeof changes.meta ) {\n\t\tchanges.meta = {\n\t\t\t...editedRecord.meta,\n\t\t\t...allowedMetaChanges,\n\t\t};\n\t}\n\n\treturn changes;\n}\n\n/**\n * Extract the raw string value from a property that may be a string or an object\n * with a `raw` property (`RenderedText`).\n *\n * @param {unknown} value The value to extract from.\n * @return {string|undefined} The raw string value, or undefined if it could not be determined.\n */\nfunction getRawValue( value?: unknown ): string | undefined {\n\t// Value may be a string property or a nested object with a `raw` property.\n\tif ( 'string' === typeof value ) {\n\t\treturn value;\n\t}\n\n\tif (\n\t\tvalue &&\n\t\t'object' === typeof value &&\n\t\t'raw' in value &&\n\t\t'string' === typeof value.raw\n\t) {\n\t\treturn value.raw;\n\t}\n\n\treturn undefined;\n}\n\nfunction haveValuesChanged< ValueType = any >(\n\tcurrentValue: ValueType,\n\tnewValue: ValueType\n): boolean {\n\treturn ! fastDeepEqual( currentValue, newValue );\n}\n\nfunction mergeValue< ValueType = any >(\n\tcurrentValue: ValueType,\n\tnewValue: ValueType,\n\tsetValue: ( value: ValueType ) => void\n): void {\n\tif ( haveValuesChanged< ValueType >( currentValue, newValue ) ) {\n\t\tsetValue( newValue );\n\t}\n}\n"],
5
+ "mappings": ";AAGA,OAAO,mBAAmB;AAM1B,SAAS,mCAAmC;AAC5C,SAAwC,SAAS;AAKjD;AAAA,EACC;AAAA,OAIM;AAGP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAWP,IAAI,gBAAyC;AAG7C,IAAM,wBAAwB,oBAAI,IAAe;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAGF,IAAM,yBAAyB,oBAAI,IAAe;AAAA,EACjD;AACD,CAAE;AAUK,SAAS,6BACf,MACA,SACO;AACP,QAAM,OAAO,KAAK,OAAQ,mBAAoB;AAE9C,SAAO,QAAS,OAAQ,EAAE,QAAS,CAAE,CAAE,KAAK,QAAS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J;AAAA,EACD;AAEA,SAAO;AACR;AASA,SAAS,YAAa,OAAsC;AAE3D,MAAK,aAAa,OAAO,OAAQ;AAChC,WAAO;AAAA,EACR;AAEA,MACC,SACA,aAAa,OAAO,SACpB,SAAS,SACT,aAAa,OAAO,MAAM,KACzB;AACD,WAAO,MAAM;AAAA,EACd;AAEA,SAAO;AACR;AAEA,SAAS,kBACR,cACA,UACU;AACV,SAAO,CAAE,cAAe,cAAc,QAAS;AAChD;AAEA,SAAS,WACR,cACA,UACA,UACO;AACP,MAAK,kBAAgC,cAAc,QAAS,GAAI;AAC/D,aAAU,QAAS;AAAA,EACpB;AACD;",
6
6
  "names": []
7
7
  }
@@ -6,4 +6,4 @@ var forward_resolver_default = forwardResolver;
6
6
  export {
7
7
  forward_resolver_default as default
8
8
  };
9
- //# sourceMappingURL=forward-resolver.js.map
9
+ //# sourceMappingURL=forward-resolver.mjs.map
@@ -13,4 +13,4 @@ function getNestedValue(object, path, defaultValue) {
13
13
  export {
14
14
  getNestedValue as default
15
15
  };
16
- //# sourceMappingURL=get-nested-value.js.map
16
+ //# sourceMappingURL=get-nested-value.mjs.map
@@ -11,4 +11,4 @@ var get_normalized_comma_separable_default = getNormalizedCommaSeparable;
11
11
  export {
12
12
  get_normalized_comma_separable_default as default
13
13
  };
14
- //# sourceMappingURL=get-normalized-comma-separable.js.map
14
+ //# sourceMappingURL=get-normalized-comma-separable.mjs.map