@wordpress/core-data 7.32.0 → 7.32.1-next.ff1cebbba.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 (383) hide show
  1. package/build/actions.js +375 -632
  2. package/build/actions.js.map +7 -1
  3. package/build/batch/create-batch.js +49 -62
  4. package/build/batch/create-batch.js.map +7 -1
  5. package/build/batch/default-processor.js +43 -39
  6. package/build/batch/default-processor.js.map +7 -1
  7. package/build/batch/index.js +38 -17
  8. package/build/batch/index.js.map +7 -1
  9. package/build/dynamic-entities.js +30 -32
  10. package/build/dynamic-entities.js.map +7 -1
  11. package/build/entities.js +298 -410
  12. package/build/entities.js.map +7 -1
  13. package/build/entity-context.js +29 -12
  14. package/build/entity-context.js.map +7 -1
  15. package/build/entity-provider.js +38 -46
  16. package/build/entity-provider.js.map +7 -1
  17. package/build/entity-types/attachment.js +16 -5
  18. package/build/entity-types/attachment.js.map +7 -1
  19. package/build/entity-types/base-entity-records.js +16 -42
  20. package/build/entity-types/base-entity-records.js.map +7 -1
  21. package/build/entity-types/base.js +16 -5
  22. package/build/entity-types/base.js.map +7 -1
  23. package/build/entity-types/comment.js +16 -5
  24. package/build/entity-types/comment.js.map +7 -1
  25. package/build/entity-types/global-styles-revision.js +16 -5
  26. package/build/entity-types/global-styles-revision.js.map +7 -1
  27. package/build/entity-types/helpers.js +16 -5
  28. package/build/entity-types/helpers.js.map +7 -1
  29. package/build/entity-types/index.js +16 -5
  30. package/build/entity-types/index.js.map +7 -1
  31. package/build/entity-types/menu-location.js +16 -5
  32. package/build/entity-types/menu-location.js.map +7 -1
  33. package/build/entity-types/nav-menu-item.js +16 -5
  34. package/build/entity-types/nav-menu-item.js.map +7 -1
  35. package/build/entity-types/nav-menu.js +16 -5
  36. package/build/entity-types/nav-menu.js.map +7 -1
  37. package/build/entity-types/page.js +16 -5
  38. package/build/entity-types/page.js.map +7 -1
  39. package/build/entity-types/plugin.js +16 -5
  40. package/build/entity-types/plugin.js.map +7 -1
  41. package/build/entity-types/post-revision.js +16 -5
  42. package/build/entity-types/post-revision.js.map +7 -1
  43. package/build/entity-types/post-status.js +16 -5
  44. package/build/entity-types/post-status.js.map +7 -1
  45. package/build/entity-types/post.js +16 -5
  46. package/build/entity-types/post.js.map +7 -1
  47. package/build/entity-types/settings.js +16 -5
  48. package/build/entity-types/settings.js.map +7 -1
  49. package/build/entity-types/sidebar.js +16 -5
  50. package/build/entity-types/sidebar.js.map +7 -1
  51. package/build/entity-types/taxonomy.js +16 -5
  52. package/build/entity-types/taxonomy.js.map +7 -1
  53. package/build/entity-types/term.js +16 -5
  54. package/build/entity-types/term.js.map +7 -1
  55. package/build/entity-types/theme.js +16 -5
  56. package/build/entity-types/theme.js.map +7 -1
  57. package/build/entity-types/type.js +16 -5
  58. package/build/entity-types/type.js.map +7 -1
  59. package/build/entity-types/user.js +16 -5
  60. package/build/entity-types/user.js.map +7 -1
  61. package/build/entity-types/widget-type.js +16 -5
  62. package/build/entity-types/widget-type.js.map +7 -1
  63. package/build/entity-types/widget.js +16 -5
  64. package/build/entity-types/widget.js.map +7 -1
  65. package/build/entity-types/wp-template-part.js +16 -5
  66. package/build/entity-types/wp-template-part.js.map +7 -1
  67. package/build/entity-types/wp-template.js +16 -5
  68. package/build/entity-types/wp-template.js.map +7 -1
  69. package/build/fetch/__experimental-fetch-link-suggestions.js +141 -154
  70. package/build/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
  71. package/build/fetch/__experimental-fetch-url-data.js +47 -59
  72. package/build/fetch/__experimental-fetch-url-data.js.map +7 -1
  73. package/build/fetch/index.js +53 -32
  74. package/build/fetch/index.js.map +7 -1
  75. package/build/footnotes/get-footnotes-order.js +38 -25
  76. package/build/footnotes/get-footnotes-order.js.map +7 -1
  77. package/build/footnotes/get-rich-text-values-cached.js +26 -27
  78. package/build/footnotes/get-rich-text-values-cached.js.map +7 -1
  79. package/build/footnotes/index.js +68 -55
  80. package/build/footnotes/index.js.map +7 -1
  81. package/build/hooks/constants.js +33 -12
  82. package/build/hooks/constants.js.map +7 -1
  83. package/build/hooks/index.js +59 -68
  84. package/build/hooks/index.js.map +7 -1
  85. package/build/hooks/memoize.js +34 -12
  86. package/build/hooks/memoize.js.map +7 -1
  87. package/build/hooks/use-entity-block-editor.js +111 -119
  88. package/build/hooks/use-entity-block-editor.js.map +7 -1
  89. package/build/hooks/use-entity-id.js +25 -23
  90. package/build/hooks/use-entity-id.js.map +7 -1
  91. package/build/hooks/use-entity-prop.js +59 -60
  92. package/build/hooks/use-entity-prop.js.map +7 -1
  93. package/build/hooks/use-entity-record.js +95 -155
  94. package/build/hooks/use-entity-record.js.map +7 -1
  95. package/build/hooks/use-entity-records.js +131 -139
  96. package/build/hooks/use-entity-records.js.map +7 -1
  97. package/build/hooks/use-query-select.js +65 -84
  98. package/build/hooks/use-query-select.js.map +7 -1
  99. package/build/hooks/use-resource-permissions.js +92 -145
  100. package/build/hooks/use-resource-permissions.js.map +7 -1
  101. package/build/index.js +96 -153
  102. package/build/index.js.map +7 -1
  103. package/build/lock-unlock.js +31 -14
  104. package/build/lock-unlock.js.map +7 -1
  105. package/build/locks/actions.js +36 -19
  106. package/build/locks/actions.js.map +7 -1
  107. package/build/locks/engine.js +48 -47
  108. package/build/locks/engine.js.map +7 -1
  109. package/build/locks/reducer.js +54 -63
  110. package/build/locks/reducer.js.map +7 -1
  111. package/build/locks/selectors.js +35 -30
  112. package/build/locks/selectors.js.map +7 -1
  113. package/build/locks/utils.js +37 -16
  114. package/build/locks/utils.js.map +7 -1
  115. package/build/name.js +27 -12
  116. package/build/name.js.map +7 -1
  117. package/build/private-actions.js +67 -75
  118. package/build/private-actions.js.map +7 -1
  119. package/build/private-apis.js +33 -16
  120. package/build/private-apis.js.map +7 -1
  121. package/build/private-selectors.js +204 -184
  122. package/build/private-selectors.js.map +7 -1
  123. package/build/queried-data/actions.js +32 -41
  124. package/build/queried-data/actions.js.map +7 -1
  125. package/build/queried-data/get-query-parts.js +41 -79
  126. package/build/queried-data/get-query-parts.js.map +7 -1
  127. package/build/queried-data/index.js +39 -36
  128. package/build/queried-data/index.js.map +7 -1
  129. package/build/queried-data/reducer.js +162 -193
  130. package/build/queried-data/reducer.js.map +7 -1
  131. package/build/queried-data/selectors.js +57 -85
  132. package/build/queried-data/selectors.js.map +7 -1
  133. package/build/reducer.js +279 -404
  134. package/build/reducer.js.map +7 -1
  135. package/build/resolvers.js +553 -600
  136. package/build/resolvers.js.map +7 -1
  137. package/build/selectors.js +456 -981
  138. package/build/selectors.js.map +7 -1
  139. package/build/sync.js +34 -22
  140. package/build/sync.js.map +7 -1
  141. package/build/types.js +16 -5
  142. package/build/types.js.map +7 -1
  143. package/build/utils/conservative-map-item.js +34 -27
  144. package/build/utils/conservative-map-item.js.map +7 -1
  145. package/build/utils/crdt-blocks.js +289 -0
  146. package/build/utils/crdt-blocks.js.map +7 -0
  147. package/build/utils/crdt.js +202 -0
  148. package/build/utils/crdt.js.map +7 -0
  149. package/build/utils/forward-resolver.js +24 -16
  150. package/build/utils/forward-resolver.js.map +7 -1
  151. package/build/utils/get-nested-value.js +26 -21
  152. package/build/utils/get-nested-value.js.map +7 -1
  153. package/build/utils/get-normalized-comma-separable.js +25 -17
  154. package/build/utils/get-normalized-comma-separable.js.map +7 -1
  155. package/build/utils/if-matching-action.js +25 -19
  156. package/build/utils/if-matching-action.js.map +7 -1
  157. package/build/utils/index.js +77 -108
  158. package/build/utils/index.js.map +7 -1
  159. package/build/utils/is-numeric-id.js +22 -12
  160. package/build/utils/is-numeric-id.js.map +7 -1
  161. package/build/utils/is-raw-attribute.js +22 -13
  162. package/build/utils/is-raw-attribute.js.map +7 -1
  163. package/build/utils/log-entity-deprecation.js +37 -38
  164. package/build/utils/log-entity-deprecation.js.map +7 -1
  165. package/build/utils/on-sub-key.js +30 -24
  166. package/build/utils/on-sub-key.js.map +7 -1
  167. package/build/utils/receive-intermediate-results.js +29 -6
  168. package/build/utils/receive-intermediate-results.js.map +7 -1
  169. package/build/utils/replace-action.js +24 -17
  170. package/build/utils/replace-action.js.map +7 -1
  171. package/build/utils/set-nested-value.js +25 -30
  172. package/build/utils/set-nested-value.js.map +7 -1
  173. package/build/utils/user-permissions.js +41 -13
  174. package/build/utils/user-permissions.js.map +7 -1
  175. package/build/utils/with-weak-map-cache.js +26 -22
  176. package/build/utils/with-weak-map-cache.js.map +7 -1
  177. package/build-module/actions.js +322 -601
  178. package/build-module/actions.js.map +7 -1
  179. package/build-module/batch/create-batch.js +21 -57
  180. package/build-module/batch/create-batch.js.map +7 -1
  181. package/build-module/batch/default-processor.js +14 -33
  182. package/build-module/batch/default-processor.js.map +7 -1
  183. package/build-module/batch/index.js +7 -3
  184. package/build-module/batch/index.js.map +7 -1
  185. package/build-module/dynamic-entities.js +7 -28
  186. package/build-module/dynamic-entities.js.map +7 -1
  187. package/build-module/entities.js +263 -399
  188. package/build-module/entities.js.map +7 -1
  189. package/build-module/entity-context.js +7 -7
  190. package/build-module/entity-context.js.map +7 -1
  191. package/build-module/entity-provider.js +19 -42
  192. package/build-module/entity-provider.js.map +7 -1
  193. package/build-module/entity-types/attachment.js +1 -2
  194. package/build-module/entity-types/attachment.js.map +7 -1
  195. package/build-module/entity-types/base-entity-records.js +1 -37
  196. package/build-module/entity-types/base-entity-records.js.map +7 -1
  197. package/build-module/entity-types/base.js +1 -2
  198. package/build-module/entity-types/base.js.map +7 -1
  199. package/build-module/entity-types/comment.js +1 -2
  200. package/build-module/entity-types/comment.js.map +7 -1
  201. package/build-module/entity-types/global-styles-revision.js +1 -2
  202. package/build-module/entity-types/global-styles-revision.js.map +7 -1
  203. package/build-module/entity-types/helpers.js +1 -2
  204. package/build-module/entity-types/helpers.js.map +7 -1
  205. package/build-module/entity-types/index.js +1 -2
  206. package/build-module/entity-types/index.js.map +7 -1
  207. package/build-module/entity-types/menu-location.js +1 -2
  208. package/build-module/entity-types/menu-location.js.map +7 -1
  209. package/build-module/entity-types/nav-menu-item.js +1 -2
  210. package/build-module/entity-types/nav-menu-item.js.map +7 -1
  211. package/build-module/entity-types/nav-menu.js +1 -2
  212. package/build-module/entity-types/nav-menu.js.map +7 -1
  213. package/build-module/entity-types/page.js +1 -2
  214. package/build-module/entity-types/page.js.map +7 -1
  215. package/build-module/entity-types/plugin.js +1 -2
  216. package/build-module/entity-types/plugin.js.map +7 -1
  217. package/build-module/entity-types/post-revision.js +1 -2
  218. package/build-module/entity-types/post-revision.js.map +7 -1
  219. package/build-module/entity-types/post-status.js +1 -2
  220. package/build-module/entity-types/post-status.js.map +7 -1
  221. package/build-module/entity-types/post.js +1 -2
  222. package/build-module/entity-types/post.js.map +7 -1
  223. package/build-module/entity-types/settings.js +1 -2
  224. package/build-module/entity-types/settings.js.map +7 -1
  225. package/build-module/entity-types/sidebar.js +1 -2
  226. package/build-module/entity-types/sidebar.js.map +7 -1
  227. package/build-module/entity-types/taxonomy.js +1 -2
  228. package/build-module/entity-types/taxonomy.js.map +7 -1
  229. package/build-module/entity-types/term.js +1 -2
  230. package/build-module/entity-types/term.js.map +7 -1
  231. package/build-module/entity-types/theme.js +1 -2
  232. package/build-module/entity-types/theme.js.map +7 -1
  233. package/build-module/entity-types/type.js +1 -2
  234. package/build-module/entity-types/type.js.map +7 -1
  235. package/build-module/entity-types/user.js +1 -2
  236. package/build-module/entity-types/user.js.map +7 -1
  237. package/build-module/entity-types/widget-type.js +1 -2
  238. package/build-module/entity-types/widget-type.js.map +7 -1
  239. package/build-module/entity-types/widget.js +1 -2
  240. package/build-module/entity-types/widget.js.map +7 -1
  241. package/build-module/entity-types/wp-template-part.js +1 -2
  242. package/build-module/entity-types/wp-template-part.js.map +7 -1
  243. package/build-module/entity-types/wp-template.js +1 -2
  244. package/build-module/entity-types/wp-template.js.map +7 -1
  245. package/build-module/fetch/__experimental-fetch-link-suggestions.js +111 -149
  246. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
  247. package/build-module/fetch/__experimental-fetch-url-data.js +20 -49
  248. package/build-module/fetch/__experimental-fetch-url-data.js.map +7 -1
  249. package/build-module/fetch/index.js +20 -15
  250. package/build-module/fetch/index.js.map +7 -1
  251. package/build-module/footnotes/get-footnotes-order.js +10 -19
  252. package/build-module/footnotes/get-footnotes-order.js.map +7 -1
  253. package/build-module/footnotes/get-rich-text-values-cached.js +8 -23
  254. package/build-module/footnotes/get-rich-text-values-cached.js.map +7 -1
  255. package/build-module/footnotes/index.js +34 -47
  256. package/build-module/footnotes/index.js.map +7 -1
  257. package/build-module/hooks/constants.js +11 -8
  258. package/build-module/hooks/constants.js.map +7 -1
  259. package/build-module/hooks/index.js +27 -15
  260. package/build-module/hooks/index.js.map +7 -1
  261. package/build-module/hooks/memoize.js +6 -8
  262. package/build-module/hooks/memoize.js.map +7 -1
  263. package/build-module/hooks/use-entity-block-editor.js +80 -110
  264. package/build-module/hooks/use-entity-block-editor.js.map +7 -1
  265. package/build-module/hooks/use-entity-id.js +7 -19
  266. package/build-module/hooks/use-entity-id.js.map +7 -1
  267. package/build-module/hooks/use-entity-prop.js +31 -55
  268. package/build-module/hooks/use-entity-prop.js.map +7 -1
  269. package/build-module/hooks/use-entity-record.js +63 -148
  270. package/build-module/hooks/use-entity-record.js.map +7 -1
  271. package/build-module/hooks/use-entity-records.js +98 -131
  272. package/build-module/hooks/use-entity-records.js.map +7 -1
  273. package/build-module/hooks/use-query-select.js +27 -71
  274. package/build-module/hooks/use-query-select.js.map +7 -1
  275. package/build-module/hooks/use-resource-permissions.js +57 -136
  276. package/build-module/hooks/use-resource-permissions.js.map +7 -1
  277. package/build-module/index.js +49 -71
  278. package/build-module/index.js.map +7 -1
  279. package/build-module/lock-unlock.js +8 -7
  280. package/build-module/lock-unlock.js.map +7 -1
  281. package/build-module/locks/actions.js +8 -13
  282. package/build-module/locks/actions.js.map +7 -1
  283. package/build-module/locks/engine.js +17 -38
  284. package/build-module/locks/engine.js.map +7 -1
  285. package/build-module/locks/reducer.js +37 -59
  286. package/build-module/locks/reducer.js.map +7 -1
  287. package/build-module/locks/selectors.js +16 -23
  288. package/build-module/locks/selectors.js.map +7 -1
  289. package/build-module/locks/utils.js +15 -12
  290. package/build-module/locks/utils.js.map +7 -1
  291. package/build-module/name.js +5 -8
  292. package/build-module/name.js.map +7 -1
  293. package/build-module/private-actions.js +35 -69
  294. package/build-module/private-actions.js.map +7 -1
  295. package/build-module/private-apis.js +8 -8
  296. package/build-module/private-apis.js.map +7 -1
  297. package/build-module/private-selectors.js +167 -174
  298. package/build-module/private-selectors.js.map +7 -1
  299. package/build-module/queried-data/actions.js +11 -38
  300. package/build-module/queried-data/actions.js.map +7 -1
  301. package/build-module/queried-data/get-query-parts.js +20 -75
  302. package/build-module/queried-data/get-query-parts.js.map +7 -1
  303. package/build-module/queried-data/index.js +7 -4
  304. package/build-module/queried-data/index.js.map +7 -1
  305. package/build-module/queried-data/reducer.js +134 -185
  306. package/build-module/queried-data/reducer.js.map +7 -1
  307. package/build-module/queried-data/selectors.js +23 -78
  308. package/build-module/queried-data/selectors.js.map +7 -1
  309. package/build-module/reducer.js +243 -393
  310. package/build-module/reducer.js.map +7 -1
  311. package/build-module/resolvers.js +478 -549
  312. package/build-module/resolvers.js.map +7 -1
  313. package/build-module/selectors.js +410 -953
  314. package/build-module/selectors.js.map +7 -1
  315. package/build-module/sync.js +14 -17
  316. package/build-module/sync.js.map +7 -1
  317. package/build-module/types.js +1 -2
  318. package/build-module/types.js.map +7 -1
  319. package/build-module/utils/conservative-map-item.js +6 -22
  320. package/build-module/utils/conservative-map-item.js.map +7 -1
  321. package/build-module/utils/crdt-blocks.js +255 -0
  322. package/build-module/utils/crdt-blocks.js.map +7 -0
  323. package/build-module/utils/crdt.js +167 -0
  324. package/build-module/utils/crdt.js.map +7 -0
  325. package/build-module/utils/forward-resolver.js +6 -12
  326. package/build-module/utils/forward-resolver.js.map +7 -1
  327. package/build-module/utils/get-nested-value.js +9 -18
  328. package/build-module/utils/get-nested-value.js.map +7 -1
  329. package/build-module/utils/get-normalized-comma-separable.js +7 -13
  330. package/build-module/utils/get-normalized-comma-separable.js.map +7 -1
  331. package/build-module/utils/if-matching-action.js +7 -15
  332. package/build-module/utils/if-matching-action.js.map +7 -1
  333. package/build-module/utils/index.js +35 -14
  334. package/build-module/utils/index.js.map +7 -1
  335. package/build-module/utils/is-numeric-id.js +5 -9
  336. package/build-module/utils/is-numeric-id.js.map +7 -1
  337. package/build-module/utils/is-raw-attribute.js +5 -10
  338. package/build-module/utils/is-raw-attribute.js.map +7 -1
  339. package/build-module/utils/log-entity-deprecation.js +8 -31
  340. package/build-module/utils/log-entity-deprecation.js.map +7 -1
  341. package/build-module/utils/on-sub-key.js +8 -19
  342. package/build-module/utils/on-sub-key.js.map +7 -1
  343. package/build-module/utils/receive-intermediate-results.js +7 -2
  344. package/build-module/utils/receive-intermediate-results.js.map +7 -1
  345. package/build-module/utils/replace-action.js +6 -13
  346. package/build-module/utils/replace-action.js.map +7 -1
  347. package/build-module/utils/set-nested-value.js +8 -27
  348. package/build-module/utils/set-nested-value.js.map +7 -1
  349. package/build-module/utils/user-permissions.js +19 -9
  350. package/build-module/utils/user-permissions.js.map +7 -1
  351. package/build-module/utils/with-weak-map-cache.js +8 -18
  352. package/build-module/utils/with-weak-map-cache.js.map +7 -1
  353. package/build-types/actions.d.ts.map +1 -1
  354. package/build-types/entities.d.ts +0 -56
  355. package/build-types/entities.d.ts.map +1 -1
  356. package/build-types/index.d.ts.map +1 -1
  357. package/build-types/private-selectors.d.ts.map +1 -1
  358. package/build-types/resolvers.d.ts +3 -0
  359. package/build-types/resolvers.d.ts.map +1 -1
  360. package/build-types/selectors.d.ts.map +1 -1
  361. package/build-types/sync.d.ts +6 -1
  362. package/build-types/sync.d.ts.map +1 -1
  363. package/build-types/types.d.ts +9 -0
  364. package/build-types/types.d.ts.map +1 -1
  365. package/build-types/utils/crdt-blocks.d.ts +30 -0
  366. package/build-types/utils/crdt-blocks.d.ts.map +1 -0
  367. package/build-types/utils/crdt.d.ts +49 -0
  368. package/build-types/utils/crdt.d.ts.map +1 -0
  369. package/package.json +26 -19
  370. package/src/actions.js +56 -74
  371. package/src/entities.js +59 -113
  372. package/src/private-selectors.ts +32 -7
  373. package/src/resolvers.js +173 -120
  374. package/src/selectors.ts +0 -13
  375. package/src/sync.ts +12 -0
  376. package/src/test/resolvers.js +183 -0
  377. package/src/types.ts +12 -0
  378. package/src/utils/crdt-blocks.ts +503 -0
  379. package/src/utils/crdt.ts +310 -0
  380. package/src/utils/test/crdt-blocks.ts +375 -0
  381. package/src/utils/test/crdt.ts +254 -0
  382. package/tsconfig.tsbuildinfo +1 -1
  383. package/src/sync.js +0 -27
@@ -1,41 +1,62 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "__experimentalFetchLinkSuggestions", {
8
- enumerable: true,
9
- get: function () {
10
- return _experimentalFetchLinkSuggestions.default;
11
- }
12
- });
13
- Object.defineProperty(exports, "__experimentalFetchUrlData", {
14
- enumerable: true,
15
- get: function () {
16
- return _experimentalFetchUrlData.default;
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var fetch_exports = {};
30
+ __export(fetch_exports, {
31
+ __experimentalFetchLinkSuggestions: () => import_experimental_fetch_link_suggestions.default,
32
+ __experimentalFetchUrlData: () => import_experimental_fetch_url_data.default,
33
+ fetchBlockPatterns: () => fetchBlockPatterns
18
34
  });
19
- exports.fetchBlockPatterns = fetchBlockPatterns;
20
- var _changeCase = require("change-case");
21
- var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
22
- var _experimentalFetchLinkSuggestions = _interopRequireDefault(require("./__experimental-fetch-link-suggestions"));
23
- var _experimentalFetchUrlData = _interopRequireDefault(require("./__experimental-fetch-url-data"));
24
- /**
25
- * External dependencies
26
- */
27
-
28
- /**
29
- * WordPress dependencies
30
- */
31
-
35
+ module.exports = __toCommonJS(fetch_exports);
36
+ var import_change_case = require("change-case");
37
+ var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
38
+ var import_experimental_fetch_link_suggestions = __toESM(require("./__experimental-fetch-link-suggestions"));
39
+ var import_experimental_fetch_url_data = __toESM(require("./__experimental-fetch-url-data"));
32
40
  async function fetchBlockPatterns() {
33
- const restPatterns = await (0, _apiFetch.default)({
34
- path: '/wp/v2/block-patterns/patterns'
41
+ const restPatterns = await (0, import_api_fetch.default)({
42
+ path: "/wp/v2/block-patterns/patterns"
35
43
  });
36
44
  if (!restPatterns) {
37
45
  return [];
38
46
  }
39
- return restPatterns.map(pattern => Object.fromEntries(Object.entries(pattern).map(([key, value]) => [(0, _changeCase.camelCase)(key), value])));
47
+ return restPatterns.map(
48
+ (pattern) => Object.fromEntries(
49
+ Object.entries(pattern).map(([key, value]) => [
50
+ (0, import_change_case.camelCase)(key),
51
+ value
52
+ ])
53
+ )
54
+ );
40
55
  }
41
- //# sourceMappingURL=index.js.map
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ __experimentalFetchLinkSuggestions,
59
+ __experimentalFetchUrlData,
60
+ fetchBlockPatterns
61
+ });
62
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_changeCase","require","_apiFetch","_interopRequireDefault","_experimentalFetchLinkSuggestions","_experimentalFetchUrlData","fetchBlockPatterns","restPatterns","apiFetch","path","map","pattern","Object","fromEntries","entries","key","value","camelCase"],"sources":["@wordpress/core-data/src/fetch/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\nexport { default as __experimentalFetchLinkSuggestions } from './__experimental-fetch-link-suggestions';\nexport { default as __experimentalFetchUrlData } from './__experimental-fetch-url-data';\n\nexport async function fetchBlockPatterns() {\n\tconst restPatterns = await apiFetch( {\n\t\tpath: '/wp/v2/block-patterns/patterns',\n\t} );\n\tif ( ! restPatterns ) {\n\t\treturn [];\n\t}\n\treturn restPatterns.map( ( pattern ) =>\n\t\tObject.fromEntries(\n\t\t\tObject.entries( pattern ).map( ( [ key, value ] ) => [\n\t\t\t\tcamelCase( key ),\n\t\t\t\tvalue,\n\t\t\t] )\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,iCAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,yBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMO,eAAeK,kBAAkBA,CAAA,EAAG;EAC1C,MAAMC,YAAY,GAAG,MAAM,IAAAC,iBAAQ,EAAE;IACpCC,IAAI,EAAE;EACP,CAAE,CAAC;EACH,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAO,EAAE;EACV;EACA,OAAOA,YAAY,CAACG,GAAG,CAAIC,OAAO,IACjCC,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAAEH,OAAQ,CAAC,CAACD,GAAG,CAAE,CAAE,CAAEK,GAAG,EAAEC,KAAK,CAAE,KAAM,CACpD,IAAAC,qBAAS,EAAEF,GAAI,CAAC,EAChBC,KAAK,CACJ,CACH,CACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/fetch/index.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\nexport { default as __experimentalFetchLinkSuggestions } from './__experimental-fetch-link-suggestions';\nexport { default as __experimentalFetchUrlData } from './__experimental-fetch-url-data';\n\nexport async function fetchBlockPatterns() {\n\tconst restPatterns = await apiFetch( {\n\t\tpath: '/wp/v2/block-patterns/patterns',\n\t} );\n\tif ( ! restPatterns ) {\n\t\treturn [];\n\t}\n\treturn restPatterns.map( ( pattern ) =>\n\t\tObject.fromEntries(\n\t\t\tObject.entries( pattern ).map( ( [ key, value ] ) => [\n\t\t\t\tcamelCase( key ),\n\t\t\t\tvalue,\n\t\t\t] )\n\t\t)\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAA0B;AAK1B,uBAAqB;AAErB,iDAA8D;AAC9D,yCAAsD;AAEtD,eAAsB,qBAAqB;AAC1C,QAAM,eAAe,UAAM,iBAAAA,SAAU;AAAA,IACpC,MAAM;AAAA,EACP,CAAE;AACF,MAAK,CAAE,cAAe;AACrB,WAAO,CAAC;AAAA,EACT;AACA,SAAO,aAAa;AAAA,IAAK,CAAE,YAC1B,OAAO;AAAA,MACN,OAAO,QAAS,OAAQ,EAAE,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO;AAAA,YACpD,8BAAW,GAAI;AAAA,QACf;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AACD;",
6
+ "names": ["apiFetch"]
7
+ }
@@ -1,31 +1,48 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var get_footnotes_order_exports = {};
30
+ __export(get_footnotes_order_exports, {
31
+ default: () => getFootnotesOrder
6
32
  });
7
- exports.default = getFootnotesOrder;
8
- var _getRichTextValuesCached = _interopRequireDefault(require("./get-rich-text-values-cached"));
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- const cache = new WeakMap();
33
+ module.exports = __toCommonJS(get_footnotes_order_exports);
34
+ var import_get_rich_text_values_cached = __toESM(require("./get-rich-text-values-cached"));
35
+ const cache = /* @__PURE__ */ new WeakMap();
14
36
  function getBlockFootnotesOrder(block) {
15
37
  if (!cache.has(block)) {
16
38
  const order = [];
17
- for (const value of (0, _getRichTextValuesCached.default)(block)) {
39
+ for (const value of (0, import_get_rich_text_values_cached.default)(block)) {
18
40
  if (!value) {
19
41
  continue;
20
42
  }
21
-
22
- // replacements is a sparse array, use forEach to skip empty slots.
23
- value.replacements.forEach(({
24
- type,
25
- attributes
26
- }) => {
27
- if (type === 'core/footnote') {
28
- order.push(attributes['data-fn']);
43
+ value.replacements.forEach(({ type, attributes }) => {
44
+ if (type === "core/footnote") {
45
+ order.push(attributes["data-fn"]);
29
46
  }
30
47
  });
31
48
  }
@@ -34,10 +51,6 @@ function getBlockFootnotesOrder(block) {
34
51
  return cache.get(block);
35
52
  }
36
53
  function getFootnotesOrder(blocks) {
37
- // We can only separate getting order from blocks at the root level. For
38
- // deeper inner blocks, this will not work since it's possible to have both
39
- // inner blocks and block attributes, so order needs to be computed from the
40
- // Edit functions as a whole.
41
54
  return blocks.flatMap(getBlockFootnotesOrder);
42
55
  }
43
- //# sourceMappingURL=get-footnotes-order.js.map
56
+ //# sourceMappingURL=get-footnotes-order.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_getRichTextValuesCached","_interopRequireDefault","require","cache","WeakMap","getBlockFootnotesOrder","block","has","order","value","getRichTextValuesCached","replacements","forEach","type","attributes","push","set","get","getFootnotesOrder","blocks","flatMap"],"sources":["@wordpress/core-data/src/footnotes/get-footnotes-order.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getRichTextValuesCached from './get-rich-text-values-cached';\n\nconst cache = new WeakMap();\n\nfunction getBlockFootnotesOrder( block ) {\n\tif ( ! cache.has( block ) ) {\n\t\tconst order = [];\n\t\tfor ( const value of getRichTextValuesCached( block ) ) {\n\t\t\tif ( ! value ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// replacements is a sparse array, use forEach to skip empty slots.\n\t\t\tvalue.replacements.forEach( ( { type, attributes } ) => {\n\t\t\t\tif ( type === 'core/footnote' ) {\n\t\t\t\t\torder.push( attributes[ 'data-fn' ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\tcache.set( block, order );\n\t}\n\n\treturn cache.get( block );\n}\n\nexport default function getFootnotesOrder( blocks ) {\n\t// We can only separate getting order from blocks at the root level. For\n\t// deeper inner blocks, this will not work since it's possible to have both\n\t// inner blocks and block attributes, so order needs to be computed from the\n\t// Edit functions as a whole.\n\treturn blocks.flatMap( getBlockFootnotesOrder );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,wBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE3B,SAASC,sBAAsBA,CAAEC,KAAK,EAAG;EACxC,IAAK,CAAEH,KAAK,CAACI,GAAG,CAAED,KAAM,CAAC,EAAG;IAC3B,MAAME,KAAK,GAAG,EAAE;IAChB,KAAM,MAAMC,KAAK,IAAI,IAAAC,gCAAuB,EAAEJ,KAAM,CAAC,EAAG;MACvD,IAAK,CAAEG,KAAK,EAAG;QACd;MACD;;MAEA;MACAA,KAAK,CAACE,YAAY,CAACC,OAAO,CAAE,CAAE;QAAEC,IAAI;QAAEC;MAAW,CAAC,KAAM;QACvD,IAAKD,IAAI,KAAK,eAAe,EAAG;UAC/BL,KAAK,CAACO,IAAI,CAAED,UAAU,CAAE,SAAS,CAAG,CAAC;QACtC;MACD,CAAE,CAAC;IACJ;IACAX,KAAK,CAACa,GAAG,CAAEV,KAAK,EAAEE,KAAM,CAAC;EAC1B;EAEA,OAAOL,KAAK,CAACc,GAAG,CAAEX,KAAM,CAAC;AAC1B;AAEe,SAASY,iBAAiBA,CAAEC,MAAM,EAAG;EACnD;EACA;EACA;EACA;EACA,OAAOA,MAAM,CAACC,OAAO,CAAEf,sBAAuB,CAAC;AAChD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/footnotes/get-footnotes-order.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport getRichTextValuesCached from './get-rich-text-values-cached';\n\nconst cache = new WeakMap();\n\nfunction getBlockFootnotesOrder( block ) {\n\tif ( ! cache.has( block ) ) {\n\t\tconst order = [];\n\t\tfor ( const value of getRichTextValuesCached( block ) ) {\n\t\t\tif ( ! value ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// replacements is a sparse array, use forEach to skip empty slots.\n\t\t\tvalue.replacements.forEach( ( { type, attributes } ) => {\n\t\t\t\tif ( type === 'core/footnote' ) {\n\t\t\t\t\torder.push( attributes[ 'data-fn' ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\tcache.set( block, order );\n\t}\n\n\treturn cache.get( block );\n}\n\nexport default function getFootnotesOrder( blocks ) {\n\t// We can only separate getting order from blocks at the root level. For\n\t// deeper inner blocks, this will not work since it's possible to have both\n\t// inner blocks and block attributes, so order needs to be computed from the\n\t// Edit functions as a whole.\n\treturn blocks.flatMap( getBlockFootnotesOrder );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yCAAoC;AAEpC,MAAM,QAAQ,oBAAI,QAAQ;AAE1B,SAAS,uBAAwB,OAAQ;AACxC,MAAK,CAAE,MAAM,IAAK,KAAM,GAAI;AAC3B,UAAM,QAAQ,CAAC;AACf,eAAY,aAAS,mCAAAA,SAAyB,KAAM,GAAI;AACvD,UAAK,CAAE,OAAQ;AACd;AAAA,MACD;AAGA,YAAM,aAAa,QAAS,CAAE,EAAE,MAAM,WAAW,MAAO;AACvD,YAAK,SAAS,iBAAkB;AAC/B,gBAAM,KAAM,WAAY,SAAU,CAAE;AAAA,QACrC;AAAA,MACD,CAAE;AAAA,IACH;AACA,UAAM,IAAK,OAAO,KAAM;AAAA,EACzB;AAEA,SAAO,MAAM,IAAK,KAAM;AACzB;AAEe,SAAR,kBAAoC,QAAS;AAKnD,SAAO,OAAO,QAAS,sBAAuB;AAC/C;",
6
+ "names": ["getRichTextValuesCached"]
7
+ }
@@ -1,34 +1,33 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var get_rich_text_values_cached_exports = {};
20
+ __export(get_rich_text_values_cached_exports, {
21
+ default: () => getRichTextValuesCached
5
22
  });
6
- exports.default = getRichTextValuesCached;
7
- var _blockEditor = require("@wordpress/block-editor");
8
- var _lockUnlock = require("../lock-unlock");
9
- /**
10
- * WordPress dependencies
11
- */
12
-
13
- /**
14
- * Internal dependencies
15
- */
16
-
17
- // TODO: The following line should have been:
18
- //
19
- // const unlockedApis = unlock( blockEditorPrivateApis );
20
- //
21
- // But there are hidden circular dependencies in RNMobile code, specifically in
22
- // certain native components in the `components` package that depend on
23
- // `block-editor`. What follows is a workaround that defers the `unlock` call
24
- // to prevent native code from failing.
25
- //
26
- // Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.
23
+ module.exports = __toCommonJS(get_rich_text_values_cached_exports);
24
+ var import_block_editor = require("@wordpress/block-editor");
25
+ var import_lock_unlock = require("../lock-unlock");
27
26
  let unlockedApis;
28
- const cache = new WeakMap();
27
+ const cache = /* @__PURE__ */ new WeakMap();
29
28
  function getRichTextValuesCached(block) {
30
29
  if (!unlockedApis) {
31
- unlockedApis = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
30
+ unlockedApis = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
32
31
  }
33
32
  if (!cache.has(block)) {
34
33
  const values = unlockedApis.getRichTextValues([block]);
@@ -36,4 +35,4 @@ function getRichTextValuesCached(block) {
36
35
  }
37
36
  return cache.get(block);
38
37
  }
39
- //# sourceMappingURL=get-rich-text-values-cached.js.map
38
+ //# sourceMappingURL=get-rich-text-values-cached.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_blockEditor","require","_lockUnlock","unlockedApis","cache","WeakMap","getRichTextValuesCached","block","unlock","blockEditorPrivateApis","has","values","getRichTextValues","set","get"],"sources":["@wordpress/core-data/src/footnotes/get-rich-text-values-cached.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// TODO: The following line should have been:\n//\n// const unlockedApis = unlock( blockEditorPrivateApis );\n//\n// But there are hidden circular dependencies in RNMobile code, specifically in\n// certain native components in the `components` package that depend on\n// `block-editor`. What follows is a workaround that defers the `unlock` call\n// to prevent native code from failing.\n//\n// Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.\nlet unlockedApis;\n\nconst cache = new WeakMap();\n\nexport default function getRichTextValuesCached( block ) {\n\tif ( ! unlockedApis ) {\n\t\tunlockedApis = unlock( blockEditorPrivateApis );\n\t}\n\n\tif ( ! cache.has( block ) ) {\n\t\tconst values = unlockedApis.getRichTextValues( [ block ] );\n\t\tcache.set( block, values );\n\t}\n\treturn cache.get( block );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,YAAY;AAEhB,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAC,CAAC;AAEZ,SAASC,uBAAuBA,CAAEC,KAAK,EAAG;EACxD,IAAK,CAAEJ,YAAY,EAAG;IACrBA,YAAY,GAAG,IAAAK,kBAAM,EAAEC,wBAAuB,CAAC;EAChD;EAEA,IAAK,CAAEL,KAAK,CAACM,GAAG,CAAEH,KAAM,CAAC,EAAG;IAC3B,MAAMI,MAAM,GAAGR,YAAY,CAACS,iBAAiB,CAAE,CAAEL,KAAK,CAAG,CAAC;IAC1DH,KAAK,CAACS,GAAG,CAAEN,KAAK,EAAEI,MAAO,CAAC;EAC3B;EACA,OAAOP,KAAK,CAACU,GAAG,CAAEP,KAAM,CAAC;AAC1B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/footnotes/get-rich-text-values-cached.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// TODO: The following line should have been:\n//\n// const unlockedApis = unlock( blockEditorPrivateApis );\n//\n// But there are hidden circular dependencies in RNMobile code, specifically in\n// certain native components in the `components` package that depend on\n// `block-editor`. What follows is a workaround that defers the `unlock` call\n// to prevent native code from failing.\n//\n// Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.\nlet unlockedApis;\n\nconst cache = new WeakMap();\n\nexport default function getRichTextValuesCached( block ) {\n\tif ( ! unlockedApis ) {\n\t\tunlockedApis = unlock( blockEditorPrivateApis );\n\t}\n\n\tif ( ! cache.has( block ) ) {\n\t\tconst values = unlockedApis.getRichTextValues( [ block ] );\n\t\tcache.set( block, values );\n\t}\n\treturn cache.get( block );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAsD;AAKtD,yBAAuB;AAYvB,IAAI;AAEJ,MAAM,QAAQ,oBAAI,QAAQ;AAEX,SAAR,wBAA0C,OAAQ;AACxD,MAAK,CAAE,cAAe;AACrB,uBAAe,2BAAQ,oBAAAA,WAAuB;AAAA,EAC/C;AAEA,MAAK,CAAE,MAAM,IAAK,KAAM,GAAI;AAC3B,UAAM,SAAS,aAAa,kBAAmB,CAAE,KAAM,CAAE;AACzD,UAAM,IAAK,OAAO,MAAO;AAAA,EAC1B;AACA,SAAO,MAAM,IAAK,KAAM;AACzB;",
6
+ "names": ["blockEditorPrivateApis"]
7
+ }
@@ -1,93 +1,105 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var footnotes_exports = {};
30
+ __export(footnotes_exports, {
31
+ updateFootnotesFromMeta: () => updateFootnotesFromMeta
6
32
  });
7
- exports.updateFootnotesFromMeta = updateFootnotesFromMeta;
8
- var _richText = require("@wordpress/rich-text");
9
- var _getFootnotesOrder = _interopRequireDefault(require("./get-footnotes-order"));
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
-
33
+ module.exports = __toCommonJS(footnotes_exports);
34
+ var import_rich_text = require("@wordpress/rich-text");
35
+ var import_get_footnotes_order = __toESM(require("./get-footnotes-order"));
18
36
  let oldFootnotes = {};
19
37
  function updateFootnotesFromMeta(blocks, meta) {
20
- const output = {
21
- blocks
22
- };
38
+ const output = { blocks };
23
39
  if (!meta) {
24
40
  return output;
25
41
  }
26
-
27
- // If meta.footnotes is empty, it means the meta is not registered.
28
- if (meta.footnotes === undefined) {
42
+ if (meta.footnotes === void 0) {
29
43
  return output;
30
44
  }
31
- const newOrder = (0, _getFootnotesOrder.default)(blocks);
45
+ const newOrder = (0, import_get_footnotes_order.default)(blocks);
32
46
  const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : [];
33
- const currentOrder = footnotes.map(fn => fn.id);
34
- if (currentOrder.join('') === newOrder.join('')) {
47
+ const currentOrder = footnotes.map((fn) => fn.id);
48
+ if (currentOrder.join("") === newOrder.join("")) {
35
49
  return output;
36
50
  }
37
- const newFootnotes = newOrder.map(fnId => footnotes.find(fn => fn.id === fnId) || oldFootnotes[fnId] || {
38
- id: fnId,
39
- content: ''
40
- });
51
+ const newFootnotes = newOrder.map(
52
+ (fnId) => footnotes.find((fn) => fn.id === fnId) || oldFootnotes[fnId] || {
53
+ id: fnId,
54
+ content: ""
55
+ }
56
+ );
41
57
  function updateAttributes(attributes) {
42
- // Only attempt to update attributes, if attributes is an object.
43
- if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') {
58
+ if (!attributes || Array.isArray(attributes) || typeof attributes !== "object") {
44
59
  return attributes;
45
60
  }
46
- attributes = {
47
- ...attributes
48
- };
61
+ attributes = { ...attributes };
49
62
  for (const key in attributes) {
50
63
  const value = attributes[key];
51
64
  if (Array.isArray(value)) {
52
65
  attributes[key] = value.map(updateAttributes);
53
66
  continue;
54
67
  }
55
-
56
- // To do, remove support for string values?
57
- if (typeof value !== 'string' && !(value instanceof _richText.RichTextData)) {
68
+ if (typeof value !== "string" && !(value instanceof import_rich_text.RichTextData)) {
58
69
  continue;
59
70
  }
60
- const richTextValue = typeof value === 'string' ? _richText.RichTextData.fromHTMLString(value) : new _richText.RichTextData(value);
71
+ const richTextValue = typeof value === "string" ? import_rich_text.RichTextData.fromHTMLString(value) : new import_rich_text.RichTextData(value);
61
72
  let hasFootnotes = false;
62
- richTextValue.replacements.forEach(replacement => {
63
- if (replacement.type === 'core/footnote') {
64
- const id = replacement.attributes['data-fn'];
73
+ richTextValue.replacements.forEach((replacement) => {
74
+ if (replacement.type === "core/footnote") {
75
+ const id = replacement.attributes["data-fn"];
65
76
  const index = newOrder.indexOf(id);
66
- // The innerHTML contains the count wrapped in a link.
67
- const countValue = (0, _richText.create)({
77
+ const countValue = (0, import_rich_text.create)({
68
78
  html: replacement.innerHTML
69
79
  });
70
80
  countValue.text = String(index + 1);
71
- countValue.formats = Array.from({
72
- length: countValue.text.length
73
- }, () => countValue.formats[0]);
74
- countValue.replacements = Array.from({
75
- length: countValue.text.length
76
- }, () => countValue.replacements[0]);
77
- replacement.innerHTML = (0, _richText.toHTMLString)({
81
+ countValue.formats = Array.from(
82
+ { length: countValue.text.length },
83
+ () => countValue.formats[0]
84
+ );
85
+ countValue.replacements = Array.from(
86
+ { length: countValue.text.length },
87
+ () => countValue.replacements[0]
88
+ );
89
+ replacement.innerHTML = (0, import_rich_text.toHTMLString)({
78
90
  value: countValue
79
91
  });
80
92
  hasFootnotes = true;
81
93
  }
82
94
  });
83
95
  if (hasFootnotes) {
84
- attributes[key] = typeof value === 'string' ? richTextValue.toHTMLString() : richTextValue;
96
+ attributes[key] = typeof value === "string" ? richTextValue.toHTMLString() : richTextValue;
85
97
  }
86
98
  }
87
99
  return attributes;
88
100
  }
89
101
  function updateBlocksAttributes(__blocks) {
90
- return __blocks.map(block => {
102
+ return __blocks.map((block) => {
91
103
  return {
92
104
  ...block,
93
105
  attributes: updateAttributes(block.attributes),
@@ -95,9 +107,6 @@ function updateFootnotesFromMeta(blocks, meta) {
95
107
  };
96
108
  });
97
109
  }
98
-
99
- // We need to go through all block attributes deeply and update the
100
- // footnote anchor numbering (textContent) to match the new order.
101
110
  const newBlocks = updateBlocksAttributes(blocks);
102
111
  oldFootnotes = {
103
112
  ...oldFootnotes,
@@ -116,4 +125,8 @@ function updateFootnotesFromMeta(blocks, meta) {
116
125
  blocks: newBlocks
117
126
  };
118
127
  }
119
- //# sourceMappingURL=index.js.map
128
+ // Annotate the CommonJS export names for ESM import in node:
129
+ 0 && (module.exports = {
130
+ updateFootnotesFromMeta
131
+ });
132
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_richText","require","_getFootnotesOrder","_interopRequireDefault","oldFootnotes","updateFootnotesFromMeta","blocks","meta","output","footnotes","undefined","newOrder","getFootnotesOrder","JSON","parse","currentOrder","map","fn","id","join","newFootnotes","fnId","find","content","updateAttributes","attributes","Array","isArray","key","value","RichTextData","richTextValue","fromHTMLString","hasFootnotes","replacements","forEach","replacement","type","index","indexOf","countValue","create","html","innerHTML","text","String","formats","from","length","toHTMLString","updateBlocksAttributes","__blocks","block","innerBlocks","newBlocks","reduce","acc","includes","stringify"],"sources":["@wordpress/core-data/src/footnotes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RichTextData, create, toHTMLString } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport getFootnotesOrder from './get-footnotes-order';\n\nlet oldFootnotes = {};\n\nexport function updateFootnotesFromMeta( blocks, meta ) {\n\tconst output = { blocks };\n\tif ( ! meta ) {\n\t\treturn output;\n\t}\n\n\t// If meta.footnotes is empty, it means the meta is not registered.\n\tif ( meta.footnotes === undefined ) {\n\t\treturn output;\n\t}\n\n\tconst newOrder = getFootnotesOrder( blocks );\n\n\tconst footnotes = meta.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst currentOrder = footnotes.map( ( fn ) => fn.id );\n\n\tif ( currentOrder.join( '' ) === newOrder.join( '' ) ) {\n\t\treturn output;\n\t}\n\n\tconst newFootnotes = newOrder.map(\n\t\t( fnId ) =>\n\t\t\tfootnotes.find( ( fn ) => fn.id === fnId ) ||\n\t\t\toldFootnotes[ fnId ] || {\n\t\t\t\tid: fnId,\n\t\t\t\tcontent: '',\n\t\t\t}\n\t);\n\n\tfunction updateAttributes( attributes ) {\n\t\t// Only attempt to update attributes, if attributes is an object.\n\t\tif (\n\t\t\t! attributes ||\n\t\t\tArray.isArray( attributes ) ||\n\t\t\ttypeof attributes !== 'object'\n\t\t) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes = { ...attributes };\n\n\t\tfor ( const key in attributes ) {\n\t\t\tconst value = attributes[ key ];\n\n\t\t\tif ( Array.isArray( value ) ) {\n\t\t\t\tattributes[ key ] = value.map( updateAttributes );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// To do, remove support for string values?\n\t\t\tif (\n\t\t\t\ttypeof value !== 'string' &&\n\t\t\t\t! ( value instanceof RichTextData )\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst richTextValue =\n\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t? RichTextData.fromHTMLString( value )\n\t\t\t\t\t: new RichTextData( value );\n\n\t\t\tlet hasFootnotes = false;\n\n\t\t\trichTextValue.replacements.forEach( ( replacement ) => {\n\t\t\t\tif ( replacement.type === 'core/footnote' ) {\n\t\t\t\t\tconst id = replacement.attributes[ 'data-fn' ];\n\t\t\t\t\tconst index = newOrder.indexOf( id );\n\t\t\t\t\t// The innerHTML contains the count wrapped in a link.\n\t\t\t\t\tconst countValue = create( {\n\t\t\t\t\t\thtml: replacement.innerHTML,\n\t\t\t\t\t} );\n\t\t\t\t\tcountValue.text = String( index + 1 );\n\t\t\t\t\tcountValue.formats = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.formats[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\tcountValue.replacements = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.replacements[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\treplacement.innerHTML = toHTMLString( {\n\t\t\t\t\t\tvalue: countValue,\n\t\t\t\t\t} );\n\t\t\t\t\thasFootnotes = true;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tif ( hasFootnotes ) {\n\t\t\t\tattributes[ key ] =\n\t\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t\t? richTextValue.toHTMLString()\n\t\t\t\t\t\t: richTextValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tfunction updateBlocksAttributes( __blocks ) {\n\t\treturn __blocks.map( ( block ) => {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tattributes: updateAttributes( block.attributes ),\n\t\t\t\tinnerBlocks: updateBlocksAttributes( block.innerBlocks ),\n\t\t\t};\n\t\t} );\n\t}\n\n\t// We need to go through all block attributes deeply and update the\n\t// footnote anchor numbering (textContent) to match the new order.\n\tconst newBlocks = updateBlocksAttributes( blocks );\n\n\toldFootnotes = {\n\t\t...oldFootnotes,\n\t\t...footnotes.reduce( ( acc, fn ) => {\n\t\t\tif ( ! newOrder.includes( fn.id ) ) {\n\t\t\t\tacc[ fn.id ] = fn;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} ),\n\t};\n\n\treturn {\n\t\tmeta: {\n\t\t\t...meta,\n\t\t\tfootnotes: JSON.stringify( newFootnotes ),\n\t\t},\n\t\tblocks: newBlocks,\n\t};\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/footnotes/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichTextData, create, toHTMLString } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport getFootnotesOrder from './get-footnotes-order';\n\nlet oldFootnotes = {};\n\nexport function updateFootnotesFromMeta( blocks, meta ) {\n\tconst output = { blocks };\n\tif ( ! meta ) {\n\t\treturn output;\n\t}\n\n\t// If meta.footnotes is empty, it means the meta is not registered.\n\tif ( meta.footnotes === undefined ) {\n\t\treturn output;\n\t}\n\n\tconst newOrder = getFootnotesOrder( blocks );\n\n\tconst footnotes = meta.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst currentOrder = footnotes.map( ( fn ) => fn.id );\n\n\tif ( currentOrder.join( '' ) === newOrder.join( '' ) ) {\n\t\treturn output;\n\t}\n\n\tconst newFootnotes = newOrder.map(\n\t\t( fnId ) =>\n\t\t\tfootnotes.find( ( fn ) => fn.id === fnId ) ||\n\t\t\toldFootnotes[ fnId ] || {\n\t\t\t\tid: fnId,\n\t\t\t\tcontent: '',\n\t\t\t}\n\t);\n\n\tfunction updateAttributes( attributes ) {\n\t\t// Only attempt to update attributes, if attributes is an object.\n\t\tif (\n\t\t\t! attributes ||\n\t\t\tArray.isArray( attributes ) ||\n\t\t\ttypeof attributes !== 'object'\n\t\t) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes = { ...attributes };\n\n\t\tfor ( const key in attributes ) {\n\t\t\tconst value = attributes[ key ];\n\n\t\t\tif ( Array.isArray( value ) ) {\n\t\t\t\tattributes[ key ] = value.map( updateAttributes );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// To do, remove support for string values?\n\t\t\tif (\n\t\t\t\ttypeof value !== 'string' &&\n\t\t\t\t! ( value instanceof RichTextData )\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst richTextValue =\n\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t? RichTextData.fromHTMLString( value )\n\t\t\t\t\t: new RichTextData( value );\n\n\t\t\tlet hasFootnotes = false;\n\n\t\t\trichTextValue.replacements.forEach( ( replacement ) => {\n\t\t\t\tif ( replacement.type === 'core/footnote' ) {\n\t\t\t\t\tconst id = replacement.attributes[ 'data-fn' ];\n\t\t\t\t\tconst index = newOrder.indexOf( id );\n\t\t\t\t\t// The innerHTML contains the count wrapped in a link.\n\t\t\t\t\tconst countValue = create( {\n\t\t\t\t\t\thtml: replacement.innerHTML,\n\t\t\t\t\t} );\n\t\t\t\t\tcountValue.text = String( index + 1 );\n\t\t\t\t\tcountValue.formats = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.formats[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\tcountValue.replacements = Array.from(\n\t\t\t\t\t\t{ length: countValue.text.length },\n\t\t\t\t\t\t() => countValue.replacements[ 0 ]\n\t\t\t\t\t);\n\t\t\t\t\treplacement.innerHTML = toHTMLString( {\n\t\t\t\t\t\tvalue: countValue,\n\t\t\t\t\t} );\n\t\t\t\t\thasFootnotes = true;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tif ( hasFootnotes ) {\n\t\t\t\tattributes[ key ] =\n\t\t\t\t\ttypeof value === 'string'\n\t\t\t\t\t\t? richTextValue.toHTMLString()\n\t\t\t\t\t\t: richTextValue;\n\t\t\t}\n\t\t}\n\n\t\treturn attributes;\n\t}\n\n\tfunction updateBlocksAttributes( __blocks ) {\n\t\treturn __blocks.map( ( block ) => {\n\t\t\treturn {\n\t\t\t\t...block,\n\t\t\t\tattributes: updateAttributes( block.attributes ),\n\t\t\t\tinnerBlocks: updateBlocksAttributes( block.innerBlocks ),\n\t\t\t};\n\t\t} );\n\t}\n\n\t// We need to go through all block attributes deeply and update the\n\t// footnote anchor numbering (textContent) to match the new order.\n\tconst newBlocks = updateBlocksAttributes( blocks );\n\n\toldFootnotes = {\n\t\t...oldFootnotes,\n\t\t...footnotes.reduce( ( acc, fn ) => {\n\t\t\tif ( ! newOrder.includes( fn.id ) ) {\n\t\t\t\tacc[ fn.id ] = fn;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} ),\n\t};\n\n\treturn {\n\t\tmeta: {\n\t\t\t...meta,\n\t\t\tfootnotes: JSON.stringify( newFootnotes ),\n\t\t},\n\t\tblocks: newBlocks,\n\t};\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["getFootnotesOrder"]
7
+ }
@@ -1,14 +1,35 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var constants_exports = {};
20
+ __export(constants_exports, {
21
+ Status: () => Status
5
22
  });
6
- exports.Status = void 0;
7
- let Status = exports.Status = /*#__PURE__*/function (Status) {
8
- Status["Idle"] = "IDLE";
9
- Status["Resolving"] = "RESOLVING";
10
- Status["Error"] = "ERROR";
11
- Status["Success"] = "SUCCESS";
12
- return Status;
13
- }({});
14
- //# sourceMappingURL=constants.js.map
23
+ module.exports = __toCommonJS(constants_exports);
24
+ var Status = /* @__PURE__ */ ((Status2) => {
25
+ Status2["Idle"] = "IDLE";
26
+ Status2["Resolving"] = "RESOLVING";
27
+ Status2["Error"] = "ERROR";
28
+ Status2["Success"] = "SUCCESS";
29
+ return Status2;
30
+ })(Status || {});
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ Status
34
+ });
35
+ //# sourceMappingURL=constants.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["Status","exports"],"sources":["@wordpress/core-data/src/hooks/constants.ts"],"sourcesContent":["export const enum Status {\n\tIdle = 'IDLE',\n\tResolving = 'RESOLVING',\n\tError = 'ERROR',\n\tSuccess = 'SUCCESS',\n}\n"],"mappings":";;;;;;IAAkBA,MAAM,GAAAC,OAAA,CAAAD,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/constants.ts"],
4
+ "sourcesContent": ["export const enum Status {\n\tIdle = 'IDLE',\n\tResolving = 'RESOLVING',\n\tError = 'ERROR',\n\tSuccess = 'SUCCESS',\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAW,SAAX,kBAAWA,YAAX;AACN,EAAAA,QAAA,UAAO;AACP,EAAAA,QAAA,eAAY;AACZ,EAAAA,QAAA,WAAQ;AACR,EAAAA,QAAA,aAAU;AAJO,SAAAA;AAAA,GAAA;",
6
+ "names": ["Status"]
7
+ }