@wordpress/core-data 4.0.3 → 4.0.7

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 (99) hide show
  1. package/README.md +2 -4
  2. package/build/actions.js +321 -247
  3. package/build/actions.js.map +1 -1
  4. package/build/batch/create-batch.js +17 -9
  5. package/build/batch/create-batch.js.map +1 -1
  6. package/build/entities.js +58 -14
  7. package/build/entities.js.map +1 -1
  8. package/build/entity-provider.js +18 -13
  9. package/build/entity-provider.js.map +1 -1
  10. package/build/fetch/__experimental-fetch-link-suggestions.js +3 -1
  11. package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  12. package/build/fetch/__experimental-fetch-url-data.js +3 -2
  13. package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
  14. package/build/index.js +25 -5
  15. package/build/index.js.map +1 -1
  16. package/build/locks/actions.js +4 -3
  17. package/build/locks/actions.js.map +1 -1
  18. package/build/locks/reducer.js +4 -1
  19. package/build/locks/reducer.js.map +1 -1
  20. package/build/locks/selectors.js +4 -3
  21. package/build/locks/selectors.js.map +1 -1
  22. package/build/locks/utils.js +7 -5
  23. package/build/locks/utils.js.map +1 -1
  24. package/build/queried-data/actions.js +6 -3
  25. package/build/queried-data/actions.js.map +1 -1
  26. package/build/queried-data/get-query-parts.js +1 -1
  27. package/build/queried-data/reducer.js +17 -6
  28. package/build/queried-data/reducer.js.map +1 -1
  29. package/build/queried-data/selectors.js +2 -1
  30. package/build/queried-data/selectors.js.map +1 -1
  31. package/build/reducer.js +90 -43
  32. package/build/reducer.js.map +1 -1
  33. package/build/resolvers.js +216 -163
  34. package/build/resolvers.js.map +1 -1
  35. package/build/selectors.js +75 -22
  36. package/build/selectors.js.map +1 -1
  37. package/build/utils/forward-resolver.js +30 -0
  38. package/build/utils/forward-resolver.js.map +1 -0
  39. package/build/utils/index.js +9 -9
  40. package/build/utils/index.js.map +1 -1
  41. package/build/utils/on-sub-key.js +4 -2
  42. package/build/utils/on-sub-key.js.map +1 -1
  43. package/build-module/actions.js +306 -240
  44. package/build-module/actions.js.map +1 -1
  45. package/build-module/batch/create-batch.js +17 -9
  46. package/build-module/batch/create-batch.js.map +1 -1
  47. package/build-module/entities.js +57 -13
  48. package/build-module/entities.js.map +1 -1
  49. package/build-module/entity-provider.js +17 -12
  50. package/build-module/entity-provider.js.map +1 -1
  51. package/build-module/fetch/__experimental-fetch-link-suggestions.js +3 -1
  52. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  53. package/build-module/fetch/__experimental-fetch-url-data.js +3 -2
  54. package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
  55. package/build-module/index.js +21 -3
  56. package/build-module/index.js.map +1 -1
  57. package/build-module/locks/actions.js +4 -3
  58. package/build-module/locks/actions.js.map +1 -1
  59. package/build-module/locks/reducer.js +4 -1
  60. package/build-module/locks/reducer.js.map +1 -1
  61. package/build-module/locks/selectors.js +4 -3
  62. package/build-module/locks/selectors.js.map +1 -1
  63. package/build-module/locks/utils.js +5 -3
  64. package/build-module/locks/utils.js.map +1 -1
  65. package/build-module/queried-data/actions.js +5 -2
  66. package/build-module/queried-data/actions.js.map +1 -1
  67. package/build-module/queried-data/reducer.js +15 -4
  68. package/build-module/queried-data/reducer.js.map +1 -1
  69. package/build-module/queried-data/selectors.js +2 -1
  70. package/build-module/queried-data/selectors.js.map +1 -1
  71. package/build-module/reducer.js +80 -34
  72. package/build-module/reducer.js.map +1 -1
  73. package/build-module/resolvers.js +211 -161
  74. package/build-module/resolvers.js.map +1 -1
  75. package/build-module/selectors.js +44 -3
  76. package/build-module/selectors.js.map +1 -1
  77. package/build-module/utils/forward-resolver.js +22 -0
  78. package/build-module/utils/forward-resolver.js.map +1 -0
  79. package/build-module/utils/index.js +1 -1
  80. package/build-module/utils/index.js.map +1 -1
  81. package/build-module/utils/on-sub-key.js +3 -1
  82. package/build-module/utils/on-sub-key.js.map +1 -1
  83. package/package.json +12 -12
  84. package/src/actions.js +51 -5
  85. package/src/entities.js +35 -6
  86. package/src/fetch/__experimental-fetch-url-data.js +1 -1
  87. package/src/reducer.js +14 -17
  88. package/src/resolvers.js +57 -20
  89. package/src/selectors.js +43 -4
  90. package/src/test/actions.js +89 -0
  91. package/src/test/selectors.js +56 -1
  92. package/src/utils/forward-resolver.js +14 -0
  93. package/src/utils/index.js +1 -1
  94. package/build/utils/if-not-resolved.js +0 -31
  95. package/build/utils/if-not-resolved.js.map +0 -1
  96. package/build-module/utils/if-not-resolved.js +0 -23
  97. package/build-module/utils/if-not-resolved.js.map +0 -1
  98. package/src/utils/if-not-resolved.js +0 -22
  99. package/src/utils/test/if-not-resolved.js +0 -76
@@ -5,34 +5,44 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.__experimentalGetCurrentGlobalStylesId = __experimentalGetCurrentGlobalStylesId;
9
+ exports.__experimentalGetCurrentThemeBaseGlobalStyles = __experimentalGetCurrentThemeBaseGlobalStyles;
10
+ exports.__experimentalGetEntitiesBeingSaved = exports.__experimentalGetDirtyEntityRecords = void 0;
11
+ exports.__experimentalGetEntityRecordNoResolver = __experimentalGetEntityRecordNoResolver;
12
+ exports.__experimentalGetTemplateForLink = __experimentalGetTemplateForLink;
13
+ exports.canUser = canUser;
14
+ exports.canUserEditEntityRecord = canUserEditEntityRecord;
8
15
  exports.getAuthors = getAuthors;
16
+ exports.getAutosave = getAutosave;
17
+ exports.getAutosaves = getAutosaves;
18
+ exports.getCurrentTheme = getCurrentTheme;
9
19
  exports.getCurrentUser = getCurrentUser;
20
+ exports.getEditedEntityRecord = void 0;
21
+ exports.getEmbedPreview = getEmbedPreview;
10
22
  exports.getEntitiesByKind = getEntitiesByKind;
11
23
  exports.getEntity = getEntity;
12
- exports.__experimentalGetEntityRecordNoResolver = __experimentalGetEntityRecordNoResolver;
13
- exports.hasEntityRecords = hasEntityRecords;
14
- exports.getEntityRecords = getEntityRecords;
24
+ exports.getEntityRecord = void 0;
15
25
  exports.getEntityRecordEdits = getEntityRecordEdits;
16
- exports.hasEditsForEntityRecord = hasEditsForEntityRecord;
17
- exports.isAutosavingEntityRecord = isAutosavingEntityRecord;
18
- exports.isSavingEntityRecord = isSavingEntityRecord;
19
- exports.isDeletingEntityRecord = isDeletingEntityRecord;
20
- exports.getLastEntitySaveError = getLastEntitySaveError;
26
+ exports.getEntityRecordNonTransientEdits = void 0;
27
+ exports.getEntityRecords = getEntityRecords;
21
28
  exports.getLastEntityDeleteError = getLastEntityDeleteError;
22
- exports.getUndoEdit = getUndoEdit;
29
+ exports.getLastEntitySaveError = getLastEntitySaveError;
30
+ exports.getRawEntityRecord = void 0;
23
31
  exports.getRedoEdit = getRedoEdit;
24
- exports.hasUndo = hasUndo;
25
- exports.hasRedo = hasRedo;
26
- exports.getCurrentTheme = getCurrentTheme;
32
+ exports.getReferenceByDistinctEdits = void 0;
27
33
  exports.getThemeSupports = getThemeSupports;
28
- exports.getEmbedPreview = getEmbedPreview;
34
+ exports.getUndoEdit = getUndoEdit;
35
+ exports.getUserQueryResults = void 0;
36
+ exports.hasEditsForEntityRecord = hasEditsForEntityRecord;
37
+ exports.hasEntityRecords = hasEntityRecords;
38
+ exports.hasFetchedAutosaves = void 0;
39
+ exports.hasRedo = hasRedo;
40
+ exports.hasUndo = hasUndo;
41
+ exports.isAutosavingEntityRecord = isAutosavingEntityRecord;
42
+ exports.isDeletingEntityRecord = isDeletingEntityRecord;
29
43
  exports.isPreviewEmbedFallback = isPreviewEmbedFallback;
30
- exports.canUser = canUser;
31
- exports.canUserEditEntityRecord = canUserEditEntityRecord;
32
- exports.getAutosaves = getAutosaves;
33
- exports.getAutosave = getAutosave;
34
- exports.__experimentalGetTemplateForLink = __experimentalGetTemplateForLink;
35
- exports.getReferenceByDistinctEdits = exports.hasFetchedAutosaves = exports.getEditedEntityRecord = exports.getEntityRecordNonTransientEdits = exports.__experimentalGetEntitiesBeingSaved = exports.__experimentalGetDirtyEntityRecords = exports.getRawEntityRecord = exports.getEntityRecord = exports.getUserQueryResults = exports.isRequestingEmbedPreview = void 0;
44
+ exports.isRequestingEmbedPreview = void 0;
45
+ exports.isSavingEntityRecord = isSavingEntityRecord;
36
46
 
37
47
  var _rememo = _interopRequireDefault(require("rememo"));
38
48
 
@@ -64,6 +74,14 @@ var _utils = require("./utils");
64
74
  * Internal dependencies
65
75
  */
66
76
 
77
+ /**
78
+ * Shared reference to an empty object for cases where it is important to avoid
79
+ * returning a new object reference on every invocation, as in a connected or
80
+ * other pure component which performs `shouldComponentUpdate` check on props.
81
+ * This should be used as a last resort, since the normalized data should be
82
+ * maintained by the reducer result in state.
83
+ */
84
+ const EMPTY_OBJECT = {};
67
85
  /**
68
86
  * Shared reference to an empty array for cases where it is important to avoid
69
87
  * returning a new array reference on every invocation, as in a connected or
@@ -73,6 +91,7 @@ var _utils = require("./utils");
73
91
  *
74
92
  * @type {Array}
75
93
  */
94
+
76
95
  const EMPTY_ARRAY = [];
77
96
  /**
78
97
  * Returns true if a request is in progress for embed preview data, or false
@@ -335,7 +354,9 @@ const __experimentalGetDirtyEntityRecords = (0, _rememo.default)(state => {
335
354
  const dirtyRecords = [];
336
355
  Object.keys(data).forEach(kind => {
337
356
  Object.keys(data[kind]).forEach(name => {
338
- const primaryKeys = Object.keys(data[kind][name].edits).filter(primaryKey => hasEditsForEntityRecord(state, kind, name, primaryKey));
357
+ const primaryKeys = Object.keys(data[kind][name].edits).filter(primaryKey => // The entity record must exist (not be deleted),
358
+ // and it must have edits.
359
+ getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey));
339
360
 
340
361
  if (primaryKeys.length) {
341
362
  const entity = getEntity(state, kind, name);
@@ -645,7 +666,19 @@ function hasRedo(state) {
645
666
 
646
667
 
647
668
  function getCurrentTheme(state) {
648
- return state.themes[state.currentTheme];
669
+ return getEntityRecord(state, 'root', 'theme', state.currentTheme);
670
+ }
671
+ /**
672
+ * Return the ID of the current global styles object.
673
+ *
674
+ * @param {Object} state Data state.
675
+ *
676
+ * @return {string} The current global styles ID.
677
+ */
678
+
679
+
680
+ function __experimentalGetCurrentGlobalStylesId(state) {
681
+ return state.currentGlobalStylesId;
649
682
  }
650
683
  /**
651
684
  * Return theme supports data in the index.
@@ -657,7 +690,9 @@ function getCurrentTheme(state) {
657
690
 
658
691
 
659
692
  function getThemeSupports(state) {
660
- return state.themeSupports;
693
+ var _getCurrentTheme$them, _getCurrentTheme;
694
+
695
+ return (_getCurrentTheme$them = (_getCurrentTheme = getCurrentTheme(state)) === null || _getCurrentTheme === void 0 ? void 0 : _getCurrentTheme.theme_supports) !== null && _getCurrentTheme$them !== void 0 ? _getCurrentTheme$them : EMPTY_OBJECT;
661
696
  }
662
697
  /**
663
698
  * Returns the embed preview for the given URL.
@@ -843,4 +878,22 @@ function __experimentalGetTemplateForLink(state, link) {
843
878
 
844
879
  return template;
845
880
  }
881
+ /**
882
+ * Retrieve the current theme's base global styles
883
+ *
884
+ * @param {Object} state Editor state.
885
+ *
886
+ * @return {Object?} The Global Styles object.
887
+ */
888
+
889
+
890
+ function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
891
+ const currentTheme = getCurrentTheme(state);
892
+
893
+ if (!currentTheme) {
894
+ return null;
895
+ }
896
+
897
+ return state.themeBaseGlobalStyles[currentTheme.stylesheet];
898
+ }
846
899
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["EMPTY_ARRAY","isRequestingEmbedPreview","select","state","url","STORE_NAME","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","entities","config","getEntity","name","getEntityRecord","key","queriedState","data","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","filter","primaryKey","hasEditsForEntityRecord","entity","entityRecord","getEditedEntityRecord","push","DEFAULT_ENTITY_KEY","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","themes","currentTheme","getThemeSupports","themeSupports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","records","template"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,wBAAwB,GAAG,kCACrCC,MAAF,IAAc,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC/B,SAAOF,MAAM,CAAEG,gBAAF,CAAN,CAAqBC,WAArB,CAAkC,iBAAlC,EAAqD,CAAEF,GAAF,CAArD,CAAP;AACA,CAHsC,CAAjC;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,UAAT,CAAqBJ,KAArB,EAA4BK,KAA5B,EAAoC;AAC1C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aAHC,CAF6B,CAApC;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,gCAAT,CAA2CvH,KAA3C,EAAkDwH,IAAlD,EAAyD;AAC/D,QAAMC,OAAO,GAAGpE,gBAAgB,CAAErD,KAAF,EAAS,UAAT,EAAqB,aAArB,EAAoC;AACnE,qBAAiBwH;AADkD,GAApC,CAAhC;AAIA,QAAME,QAAQ,GAAGD,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEpF,MAAT,GAAkBoF,OAAO,CAAE,CAAF,CAAzB,GAAiC,IAAlD;;AACA,MAAKC,QAAL,EAAgB;AACf,WAAO1D,qBAAqB,CAC3BhE,KAD2B,EAE3B,UAF2B,EAG3B,aAH2B,EAI3B0H,QAAQ,CAAC1G,EAJkB,CAA5B;AAMA;;AACD,SAAO0G,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { 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 { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array 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 *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\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 {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\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 {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns whether the entities for the give kind are loaded.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity object given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity\n */\nexport function getEntity( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\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 {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object?} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.data, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\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 && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields );\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( 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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif ( isRawAttribute( getEntity( state, kind, name ), _key ) ) {\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 ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\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}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\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 {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\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. Thus, a\n\t// return value of an empty array is used instead of `null` (where `null` is\n\t// otherwise used to represent an unknown state).\n\tconst queriedState = get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn EMPTY_ARRAY;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].edits\n\t\t\t\t).filter( ( primaryKey ) =>\n\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 entity = getEntity( 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:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.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.data ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].saving\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 entity = getEntity( 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:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.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.data ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [ kind, name, 'edits', recordId ] );\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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntity( 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, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.data, [ 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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [ 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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\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 {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\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 {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn state.themes[ state.currentTheme ];\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn state.themeSupports;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} 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, url ) {\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 {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\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 {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( 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 {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entity = getEntity( state, kind, name );\n\tif ( ! entity ) {\n\t\treturn false;\n\t}\n\tconst resource = entity.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, 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 {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\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 {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["EMPTY_OBJECT","EMPTY_ARRAY","isRequestingEmbedPreview","select","state","url","STORE_NAME","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","entities","config","getEntity","name","getEntityRecord","key","queriedState","data","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","filter","primaryKey","hasEditsForEntityRecord","entity","entityRecord","getEditedEntityRecord","push","DEFAULT_ENTITY_KEY","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","currentTheme","__experimentalGetCurrentGlobalStylesId","currentGlobalStylesId","getThemeSupports","theme_supports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","records","template","__experimentalGetCurrentThemeBaseGlobalStyles","themeBaseGlobalStyles","stylesheet"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA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CAAzB,GAAiC,IAAlD;;AACA,MAAKC,QAAL,EAAgB;AACf,WAAO3D,qBAAqB,CAC3BhE,KAD2B,EAE3B,UAF2B,EAG3B,aAH2B,EAI3B2H,QAAQ,CAAC3G,EAJkB,CAA5B;AAMA;;AACD,SAAO2G,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,6CAAT,CAAwD5H,KAAxD,EAAgE;AACtE,QAAM4F,YAAY,GAAGD,eAAe,CAAE3F,KAAF,CAApC;;AACA,MAAK,CAAE4F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO5F,KAAK,CAAC6H,qBAAN,CAA6BjC,YAAY,CAACkC,UAA1C,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { 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 { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\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 * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array 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 *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\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 {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\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 {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns whether the entities for the give kind are loaded.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity object given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity\n */\nexport function getEntity( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\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 {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object?} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.data, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\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 && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields );\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( 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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif ( isRawAttribute( getEntity( state, kind, name ), _key ) ) {\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 ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\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}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\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 {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\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. Thus, a\n\t// return value of an empty array is used instead of `null` (where `null` is\n\t// otherwise used to represent an unknown state).\n\tconst queriedState = get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn EMPTY_ARRAY;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].edits\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 entity = getEntity( 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:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.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.data ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].saving\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 entity = getEntity( 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:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.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.data ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [ kind, name, 'edits', recordId ] );\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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntity( 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, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.data, [ 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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [ 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 {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\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 {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\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 {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string} The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state ) {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} 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, url ) {\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 {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\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 {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( 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 {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entity = getEntity( state, kind, name );\n\tif ( ! entity ) {\n\t\treturn false;\n\t}\n\tconst resource = entity.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, 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 {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\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 {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param {Object} state Editor state.\n *\n * @return {Object?} The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n"]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /**
9
+ * Higher-order function which forward the resolution to another resolver with the same arguments.
10
+ *
11
+ * @param {string} resolverName forwarded resolver.
12
+ *
13
+ * @return {Function} Enhanced resolver.
14
+ */
15
+ const forwardResolver = resolverName => function () {
16
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
17
+ args[_key] = arguments[_key];
18
+ }
19
+
20
+ return async _ref => {
21
+ let {
22
+ resolveSelect
23
+ } = _ref;
24
+ await resolveSelect[resolverName](...args);
25
+ };
26
+ };
27
+
28
+ var _default = forwardResolver;
29
+ exports.default = _default;
30
+ //# sourceMappingURL=forward-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/core-data/src/utils/forward-resolver.js"],"names":["forwardResolver","resolverName","args","resolveSelect"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,eAAe,GAAKC,YAAF,IAAoB;AAAA,oCAAKC,IAAL;AAAKA,IAAAA,IAAL;AAAA;;AAAA,SAAe,cAEpD;AAAA,QAF4D;AAClEC,MAAAA;AADkE,KAE5D;AACN,UAAMA,aAAa,CAAEF,YAAF,CAAb,CAA+B,GAAGC,IAAlC,CAAN;AACA,GAJ2C;AAAA,CAA5C;;eAMeF,e","sourcesContent":["/**\n * Higher-order function which forward the resolution to another resolver with the same arguments.\n *\n * @param {string} resolverName forwarded resolver.\n *\n * @return {Function} Enhanced resolver.\n */\nconst forwardResolver = ( resolverName ) => ( ...args ) => async ( {\n\tresolveSelect,\n} ) => {\n\tawait resolveSelect[ resolverName ]( ...args );\n};\n\nexport default forwardResolver;\n"]}
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "conservativeMapItem", {
11
11
  return _conservativeMapItem.default;
12
12
  }
13
13
  });
14
+ Object.defineProperty(exports, "forwardResolver", {
15
+ enumerable: true,
16
+ get: function () {
17
+ return _forwardResolver.default;
18
+ }
19
+ });
14
20
  Object.defineProperty(exports, "getNormalizedCommaSeparable", {
15
21
  enumerable: true,
16
22
  get: function () {
@@ -23,10 +29,10 @@ Object.defineProperty(exports, "ifMatchingAction", {
23
29
  return _ifMatchingAction.default;
24
30
  }
25
31
  });
26
- Object.defineProperty(exports, "ifNotResolved", {
32
+ Object.defineProperty(exports, "isRawAttribute", {
27
33
  enumerable: true,
28
34
  get: function () {
29
- return _ifNotResolved.default;
35
+ return _isRawAttribute.default;
30
36
  }
31
37
  });
32
38
  Object.defineProperty(exports, "onSubKey", {
@@ -47,12 +53,6 @@ Object.defineProperty(exports, "withWeakMapCache", {
47
53
  return _withWeakMapCache.default;
48
54
  }
49
55
  });
50
- Object.defineProperty(exports, "isRawAttribute", {
51
- enumerable: true,
52
- get: function () {
53
- return _isRawAttribute.default;
54
- }
55
- });
56
56
 
57
57
  var _conservativeMapItem = _interopRequireDefault(require("./conservative-map-item"));
58
58
 
@@ -60,7 +60,7 @@ var _getNormalizedCommaSeparable = _interopRequireDefault(require("./get-normali
60
60
 
61
61
  var _ifMatchingAction = _interopRequireDefault(require("./if-matching-action"));
62
62
 
63
- var _ifNotResolved = _interopRequireDefault(require("./if-not-resolved"));
63
+ var _forwardResolver = _interopRequireDefault(require("./forward-resolver"));
64
64
 
65
65
  var _onSubKey = _interopRequireDefault(require("./on-sub-key"));
66
66
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/utils/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { default as conservativeMapItem } from './conservative-map-item';\nexport { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';\nexport { default as ifMatchingAction } from './if-matching-action';\nexport { default as ifNotResolved } from './if-not-resolved';\nexport { default as onSubKey } from './on-sub-key';\nexport { default as replaceAction } from './replace-action';\nexport { default as withWeakMapCache } from './with-weak-map-cache';\nexport { default as isRawAttribute } from './is-raw-attribute';\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/utils/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { default as conservativeMapItem } from './conservative-map-item';\nexport { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';\nexport { default as ifMatchingAction } from './if-matching-action';\nexport { default as forwardResolver } from './forward-resolver';\nexport { default as onSubKey } from './on-sub-key';\nexport { default as replaceAction } from './replace-action';\nexport { default as withWeakMapCache } from './with-weak-map-cache';\nexport { default as isRawAttribute } from './is-raw-attribute';\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.onSubKey = void 0;
6
+ exports.onSubKey = exports.default = void 0;
7
7
 
8
8
  /**
9
9
  * Higher-order reducer creator which creates a combined reducer object, keyed
@@ -13,7 +13,9 @@ exports.default = exports.onSubKey = void 0;
13
13
  *
14
14
  * @return {Function} Higher-order reducer.
15
15
  */
16
- const onSubKey = actionProperty => reducer => (state = {}, action) => {
16
+ const onSubKey = actionProperty => reducer => function () {
17
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
+ let action = arguments.length > 1 ? arguments[1] : undefined;
17
19
  // Retrieve subkey from action. Do not track if undefined; useful for cases
18
20
  // where reducer is scoped by action shape.
19
21
  const key = action[actionProperty];
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/utils/on-sub-key.js"],"names":["onSubKey","actionProperty","reducer","state","action","key","undefined","nextKeyState"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAKC,cAAF,IAAwBC,OAAF,IAAe,CAC5DC,KAAK,GAAG,EADoD,EAE5DC,MAF4D,KAGxD;AACJ;AACA;AACA,QAAMC,GAAG,GAAGD,MAAM,CAAEH,cAAF,CAAlB;;AACA,MAAKI,GAAG,KAAKC,SAAb,EAAyB;AACxB,WAAOH,KAAP;AACA,GANG,CAQJ;AACA;;;AACA,QAAMI,YAAY,GAAGL,OAAO,CAAEC,KAAK,CAAEE,GAAF,CAAP,EAAgBD,MAAhB,CAA5B;;AACA,MAAKG,YAAY,KAAKJ,KAAK,CAAEE,GAAF,CAA3B,EAAqC;AACpC,WAAOF,KAAP;AACA;;AAED,SAAO,EACN,GAAGA,KADG;AAEN,KAAEE,GAAF,GAASE;AAFH,GAAP;AAIA,CAtBM;;;eAwBQP,Q","sourcesContent":["/**\n * Higher-order reducer creator which creates a combined reducer object, keyed\n * by a property on the action object.\n *\n * @param {string} actionProperty Action property by which to key object.\n *\n * @return {Function} Higher-order reducer.\n */\nexport const onSubKey = ( actionProperty ) => ( reducer ) => (\n\tstate = {},\n\taction\n) => {\n\t// Retrieve subkey from action. Do not track if undefined; useful for cases\n\t// where reducer is scoped by action shape.\n\tconst key = action[ actionProperty ];\n\tif ( key === undefined ) {\n\t\treturn state;\n\t}\n\n\t// Avoid updating state if unchanged. Note that this also accounts for a\n\t// reducer which returns undefined on a key which is not yet tracked.\n\tconst nextKeyState = reducer( state[ key ], action );\n\tif ( nextKeyState === state[ key ] ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ key ]: nextKeyState,\n\t};\n};\n\nexport default onSubKey;\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/utils/on-sub-key.js"],"names":["onSubKey","actionProperty","reducer","state","action","key","undefined","nextKeyState"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAKC,cAAF,IAAwBC,OAAF,IAAe,YAGxD;AAAA,MAFJC,KAEI,uEAFI,EAEJ;AAAA,MADJC,MACI;AACJ;AACA;AACA,QAAMC,GAAG,GAAGD,MAAM,CAAEH,cAAF,CAAlB;;AACA,MAAKI,GAAG,KAAKC,SAAb,EAAyB;AACxB,WAAOH,KAAP;AACA,GANG,CAQJ;AACA;;;AACA,QAAMI,YAAY,GAAGL,OAAO,CAAEC,KAAK,CAAEE,GAAF,CAAP,EAAgBD,MAAhB,CAA5B;;AACA,MAAKG,YAAY,KAAKJ,KAAK,CAAEE,GAAF,CAA3B,EAAqC;AACpC,WAAOF,KAAP;AACA;;AAED,SAAO,EACN,GAAGA,KADG;AAEN,KAAEE,GAAF,GAASE;AAFH,GAAP;AAIA,CAtBM;;;eAwBQP,Q","sourcesContent":["/**\n * Higher-order reducer creator which creates a combined reducer object, keyed\n * by a property on the action object.\n *\n * @param {string} actionProperty Action property by which to key object.\n *\n * @return {Function} Higher-order reducer.\n */\nexport const onSubKey = ( actionProperty ) => ( reducer ) => (\n\tstate = {},\n\taction\n) => {\n\t// Retrieve subkey from action. Do not track if undefined; useful for cases\n\t// where reducer is scoped by action shape.\n\tconst key = action[ actionProperty ];\n\tif ( key === undefined ) {\n\t\treturn state;\n\t}\n\n\t// Avoid updating state if unchanged. Note that this also accounts for a\n\t// reducer which returns undefined on a key which is not yet tracked.\n\tconst nextKeyState = reducer( state[ key ], action );\n\tif ( nextKeyState === state[ key ] ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ key ]: nextKeyState,\n\t};\n};\n\nexport default onSubKey;\n"]}