@wordpress/customize-widgets 5.32.0 → 5.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.
- package/build/components/block-appender/index.js +33 -27
- package/build/components/block-appender/index.js.map +7 -1
- package/build/components/block-inspector-button/index.js +51 -36
- package/build/components/block-inspector-button/index.js.map +7 -1
- package/build/components/customize-widgets/index.js +83 -61
- package/build/components/customize-widgets/index.js.map +7 -1
- package/build/components/customize-widgets/use-clear-selected-block.js +56 -63
- package/build/components/customize-widgets/use-clear-selected-block.js.map +7 -1
- package/build/components/error-boundary/index.js +46 -45
- package/build/components/error-boundary/index.js.map +7 -1
- package/build/components/focus-control/index.js +69 -57
- package/build/components/focus-control/index.js.map +7 -1
- package/build/components/focus-control/use-blocks-focus-control.js +38 -31
- package/build/components/focus-control/use-blocks-focus-control.js.map +7 -1
- package/build/components/header/index.js +110 -71
- package/build/components/header/index.js.map +7 -1
- package/build/components/inserter/index.js +77 -53
- package/build/components/inserter/index.js.map +7 -1
- package/build/components/inserter/use-inserter.js +46 -29
- package/build/components/inserter/use-inserter.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
- package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +155 -110
- package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +76 -56
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +60 -51
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/more-menu/index.js +151 -90
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/sidebar-block-editor/index.js +133 -105
- package/build/components/sidebar-block-editor/index.js.map +7 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.js +73 -67
- package/build/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +51 -33
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js +100 -79
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
- package/build/components/sidebar-controls/index.js +45 -31
- package/build/components/sidebar-controls/index.js.map +7 -1
- package/build/components/welcome-guide/index.js +86 -58
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/controls/inserter-outer-section.js +49 -58
- package/build/controls/inserter-outer-section.js.map +7 -1
- package/build/controls/inspector-section.js +30 -36
- package/build/controls/inspector-section.js.map +7 -1
- package/build/controls/sidebar-control.js +51 -30
- package/build/controls/sidebar-control.js.map +7 -1
- package/build/controls/sidebar-section.js +71 -39
- package/build/controls/sidebar-section.js.map +7 -1
- package/build/filters/index.js +4 -6
- package/build/filters/index.js.map +7 -1
- package/build/filters/move-to-sidebar.js +77 -79
- package/build/filters/move-to-sidebar.js.map +7 -1
- package/build/filters/replace-media-upload.js +9 -11
- package/build/filters/replace-media-upload.js.map +7 -1
- package/build/filters/wide-widget-display.js +20 -25
- package/build/filters/wide-widget-display.js.map +7 -1
- package/build/index.js +81 -70
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/store/actions.js +27 -44
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -10
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +44 -40
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +25 -19
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +31 -44
- package/build/store/selectors.js.map +7 -1
- package/build/utils.js +45 -73
- package/build/utils.js.map +7 -1
- package/build-module/components/block-appender/index.js +17 -20
- package/build-module/components/block-appender/index.js.map +7 -1
- package/build-module/components/block-inspector-button/index.js +33 -30
- package/build-module/components/block-inspector-button/index.js.map +7 -1
- package/build-module/components/customize-widgets/index.js +52 -51
- package/build-module/components/customize-widgets/index.js.map +7 -1
- package/build-module/components/customize-widgets/use-clear-selected-block.js +38 -58
- package/build-module/components/customize-widgets/use-clear-selected-block.js.map +7 -1
- package/build-module/components/error-boundary/index.js +27 -37
- package/build-module/components/error-boundary/index.js.map +7 -1
- package/build-module/components/focus-control/index.js +50 -45
- package/build-module/components/focus-control/index.js.map +7 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js +17 -22
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +7 -1
- package/build-module/components/header/index.js +81 -63
- package/build-module/components/header/index.js.map +7 -1
- package/build-module/components/inserter/index.js +59 -47
- package/build-module/components/inserter/index.js.map +7 -1
- package/build-module/components/inserter/use-inserter.js +28 -23
- package/build-module/components/inserter/use-inserter.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -103
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -50
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +44 -44
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/more-menu/index.js +129 -84
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/sidebar-block-editor/index.js +109 -96
- package/build-module/components/sidebar-block-editor/index.js.map +7 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js +54 -59
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +22 -25
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js +70 -70
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
- package/build-module/components/sidebar-controls/index.js +24 -25
- package/build-module/components/sidebar-controls/index.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +68 -52
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/controls/inserter-outer-section.js +31 -52
- package/build-module/controls/inserter-outer-section.js.map +7 -1
- package/build-module/controls/inspector-section.js +13 -32
- package/build-module/controls/inspector-section.js.map +7 -1
- package/build-module/controls/sidebar-control.js +22 -22
- package/build-module/controls/sidebar-control.js.map +7 -1
- package/build-module/controls/sidebar-section.js +43 -32
- package/build-module/controls/sidebar-section.js.map +7 -1
- package/build-module/filters/index.js +4 -7
- package/build-module/filters/index.js.map +7 -1
- package/build-module/filters/move-to-sidebar.js +83 -76
- package/build-module/filters/move-to-sidebar.js.map +7 -1
- package/build-module/filters/replace-media-upload.js +8 -7
- package/build-module/filters/replace-media-upload.js.map +7 -1
- package/build-module/filters/wide-widget-display.js +20 -22
- package/build-module/filters/wide-widget-display.js.map +7 -1
- package/build-module/index.js +53 -51
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/store/actions.js +6 -40
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -5
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +10 -30
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +7 -14
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +10 -40
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/utils.js +21 -66
- package/build-module/utils.js.map +7 -1
- package/build-style/style-rtl.css +14 -149
- package/build-style/style.css +14 -149
- package/package.json +30 -23
- package/src/components/block-inspector-button/style.scss +3 -0
- package/src/components/header/style.scss +5 -0
- package/src/components/inserter/style.scss +3 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
- package/src/components/more-menu/style.scss +2 -0
- package/src/components/sidebar-block-editor/style.scss +2 -0
- package/src/components/welcome-guide/style.scss +2 -0
- package/src/controls/style.scss +2 -0
- package/src/style.scss +10 -8
|
@@ -1,100 +1,121 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var use_sidebar_block_editor_exports = {};
|
|
29
|
+
__export(use_sidebar_block_editor_exports, {
|
|
30
|
+
default: () => useSidebarBlockEditor
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
/**
|
|
14
|
-
* External dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* WordPress dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
32
|
+
module.exports = __toCommonJS(use_sidebar_block_editor_exports);
|
|
33
|
+
var import_es6 = __toESM(require("fast-deep-equal/es6"));
|
|
34
|
+
var import_element = require("@wordpress/element");
|
|
35
|
+
var import_is_shallow_equal = __toESM(require("@wordpress/is-shallow-equal"));
|
|
36
|
+
var import_widgets = require("@wordpress/widgets");
|
|
37
|
+
var import_utils = require("../../utils");
|
|
25
38
|
function widgetsToBlocks(widgets) {
|
|
26
|
-
return widgets.map(widget => (0,
|
|
39
|
+
return widgets.map((widget) => (0, import_utils.widgetToBlock)(widget));
|
|
27
40
|
}
|
|
28
41
|
function useSidebarBlockEditor(sidebar) {
|
|
29
|
-
const [blocks, setBlocks] = (0,
|
|
30
|
-
|
|
42
|
+
const [blocks, setBlocks] = (0, import_element.useState)(
|
|
43
|
+
() => widgetsToBlocks(sidebar.getWidgets())
|
|
44
|
+
);
|
|
45
|
+
(0, import_element.useEffect)(() => {
|
|
31
46
|
return sidebar.subscribe((prevWidgets, nextWidgets) => {
|
|
32
|
-
setBlocks(prevBlocks => {
|
|
33
|
-
const prevWidgetsMap = new Map(
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
setBlocks((prevBlocks) => {
|
|
48
|
+
const prevWidgetsMap = new Map(
|
|
49
|
+
prevWidgets.map((widget) => [widget.id, widget])
|
|
50
|
+
);
|
|
51
|
+
const prevBlocksMap = new Map(
|
|
52
|
+
prevBlocks.map((block) => [
|
|
53
|
+
(0, import_widgets.getWidgetIdFromBlock)(block),
|
|
54
|
+
block
|
|
55
|
+
])
|
|
56
|
+
);
|
|
57
|
+
const nextBlocks = nextWidgets.map((nextWidget) => {
|
|
36
58
|
const prevWidget = prevWidgetsMap.get(nextWidget.id);
|
|
37
|
-
|
|
38
|
-
// Bail out updates.
|
|
39
59
|
if (prevWidget && prevWidget === nextWidget) {
|
|
40
60
|
return prevBlocksMap.get(nextWidget.id);
|
|
41
61
|
}
|
|
42
|
-
return (0,
|
|
62
|
+
return (0, import_utils.widgetToBlock)(nextWidget);
|
|
43
63
|
});
|
|
44
|
-
|
|
45
|
-
// Bail out updates.
|
|
46
|
-
if ((0, _isShallowEqual.default)(prevBlocks, nextBlocks)) {
|
|
64
|
+
if ((0, import_is_shallow_equal.default)(prevBlocks, nextBlocks)) {
|
|
47
65
|
return prevBlocks;
|
|
48
66
|
}
|
|
49
67
|
return nextBlocks;
|
|
50
68
|
});
|
|
51
69
|
});
|
|
52
70
|
}, [sidebar]);
|
|
53
|
-
const onChangeBlocks = (0,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const prevBlocksMap = new Map(prevBlocks.map(block => [(0, _widgets.getWidgetIdFromBlock)(block), block]));
|
|
59
|
-
const nextWidgets = nextBlocks.map(nextBlock => {
|
|
60
|
-
const widgetId = (0, _widgets.getWidgetIdFromBlock)(nextBlock);
|
|
61
|
-
|
|
62
|
-
// Update existing widgets.
|
|
63
|
-
if (widgetId && prevBlocksMap.has(widgetId)) {
|
|
64
|
-
const prevBlock = prevBlocksMap.get(widgetId);
|
|
65
|
-
const prevWidget = sidebar.getWidget(widgetId);
|
|
66
|
-
|
|
67
|
-
// Bail out updates by returning the previous widgets.
|
|
68
|
-
// Deep equality is necessary until the block editor's internals changes.
|
|
69
|
-
if ((0, _es.default)(nextBlock, prevBlock) && prevWidget) {
|
|
70
|
-
return prevWidget;
|
|
71
|
-
}
|
|
72
|
-
return (0, _utils.blockToWidget)(nextBlock, prevWidget);
|
|
71
|
+
const onChangeBlocks = (0, import_element.useCallback)(
|
|
72
|
+
(nextBlocks) => {
|
|
73
|
+
setBlocks((prevBlocks) => {
|
|
74
|
+
if ((0, import_is_shallow_equal.default)(prevBlocks, nextBlocks)) {
|
|
75
|
+
return prevBlocks;
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (updatedNextBlocks === nextBlocks) {
|
|
90
|
-
updatedNextBlocks = nextBlocks.slice();
|
|
77
|
+
const prevBlocksMap = new Map(
|
|
78
|
+
prevBlocks.map((block) => [
|
|
79
|
+
(0, import_widgets.getWidgetIdFromBlock)(block),
|
|
80
|
+
block
|
|
81
|
+
])
|
|
82
|
+
);
|
|
83
|
+
const nextWidgets = nextBlocks.map((nextBlock) => {
|
|
84
|
+
const widgetId = (0, import_widgets.getWidgetIdFromBlock)(nextBlock);
|
|
85
|
+
if (widgetId && prevBlocksMap.has(widgetId)) {
|
|
86
|
+
const prevBlock = prevBlocksMap.get(widgetId);
|
|
87
|
+
const prevWidget = sidebar.getWidget(widgetId);
|
|
88
|
+
if ((0, import_es6.default)(nextBlock, prevBlock) && prevWidget) {
|
|
89
|
+
return prevWidget;
|
|
90
|
+
}
|
|
91
|
+
return (0, import_utils.blockToWidget)(nextBlock, prevWidget);
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
return (0, import_utils.blockToWidget)(nextBlock);
|
|
94
|
+
});
|
|
95
|
+
if ((0, import_is_shallow_equal.default)(sidebar.getWidgets(), nextWidgets)) {
|
|
96
|
+
return prevBlocks;
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
const addedWidgetIds = sidebar.setWidgets(nextWidgets);
|
|
99
|
+
return nextBlocks.reduce(
|
|
100
|
+
(updatedNextBlocks, nextBlock, index) => {
|
|
101
|
+
const addedWidgetId = addedWidgetIds[index];
|
|
102
|
+
if (addedWidgetId !== null) {
|
|
103
|
+
if (updatedNextBlocks === nextBlocks) {
|
|
104
|
+
updatedNextBlocks = nextBlocks.slice();
|
|
105
|
+
}
|
|
106
|
+
updatedNextBlocks[index] = (0, import_widgets.addWidgetIdToBlock)(
|
|
107
|
+
nextBlock,
|
|
108
|
+
addedWidgetId
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return updatedNextBlocks;
|
|
112
|
+
},
|
|
113
|
+
nextBlocks
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
[sidebar]
|
|
118
|
+
);
|
|
98
119
|
return [blocks, onChangeBlocks, onChangeBlocks];
|
|
99
120
|
}
|
|
100
|
-
//# sourceMappingURL=use-sidebar-block-editor.js.map
|
|
121
|
+
//# sourceMappingURL=use-sidebar-block-editor.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/sidebar-block-editor/use-sidebar-block-editor.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { getWidgetIdFromBlock, addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { blockToWidget, widgetToBlock } from '../../utils';\n\nfunction widgetsToBlocks( widgets ) {\n\treturn widgets.map( ( widget ) => widgetToBlock( widget ) );\n}\n\nexport default function useSidebarBlockEditor( sidebar ) {\n\tconst [ blocks, setBlocks ] = useState( () =>\n\t\twidgetsToBlocks( sidebar.getWidgets() )\n\t);\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribe( ( prevWidgets, nextWidgets ) => {\n\t\t\tsetBlocks( ( prevBlocks ) => {\n\t\t\t\tconst prevWidgetsMap = new Map(\n\t\t\t\t\tprevWidgets.map( ( widget ) => [ widget.id, widget ] )\n\t\t\t\t);\n\t\t\t\tconst prevBlocksMap = new Map(\n\t\t\t\t\tprevBlocks.map( ( block ) => [\n\t\t\t\t\t\tgetWidgetIdFromBlock( block ),\n\t\t\t\t\t\tblock,\n\t\t\t\t\t] )\n\t\t\t\t);\n\n\t\t\t\tconst nextBlocks = nextWidgets.map( ( nextWidget ) => {\n\t\t\t\t\tconst prevWidget = prevWidgetsMap.get( nextWidget.id );\n\n\t\t\t\t\t// Bail out updates.\n\t\t\t\t\tif ( prevWidget && prevWidget === nextWidget ) {\n\t\t\t\t\t\treturn prevBlocksMap.get( nextWidget.id );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn widgetToBlock( nextWidget );\n\t\t\t\t} );\n\n\t\t\t\t// Bail out updates.\n\t\t\t\tif ( isShallowEqual( prevBlocks, nextBlocks ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\treturn nextBlocks;\n\t\t\t} );\n\t\t} );\n\t}, [ sidebar ] );\n\n\tconst onChangeBlocks = useCallback(\n\t\t( nextBlocks ) => {\n\t\t\tsetBlocks( ( prevBlocks ) => {\n\t\t\t\tif ( isShallowEqual( prevBlocks, nextBlocks ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\tconst prevBlocksMap = new Map(\n\t\t\t\t\tprevBlocks.map( ( block ) => [\n\t\t\t\t\t\tgetWidgetIdFromBlock( block ),\n\t\t\t\t\t\tblock,\n\t\t\t\t\t] )\n\t\t\t\t);\n\n\t\t\t\tconst nextWidgets = nextBlocks.map( ( nextBlock ) => {\n\t\t\t\t\tconst widgetId = getWidgetIdFromBlock( nextBlock );\n\n\t\t\t\t\t// Update existing widgets.\n\t\t\t\t\tif ( widgetId && prevBlocksMap.has( widgetId ) ) {\n\t\t\t\t\t\tconst prevBlock = prevBlocksMap.get( widgetId );\n\t\t\t\t\t\tconst prevWidget = sidebar.getWidget( widgetId );\n\n\t\t\t\t\t\t// Bail out updates by returning the previous widgets.\n\t\t\t\t\t\t// Deep equality is necessary until the block editor's internals changes.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tfastDeepEqual( nextBlock, prevBlock ) &&\n\t\t\t\t\t\t\tprevWidget\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn prevWidget;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn blockToWidget( nextBlock, prevWidget );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add a new widget.\n\t\t\t\t\treturn blockToWidget( nextBlock );\n\t\t\t\t} );\n\n\t\t\t\t// Bail out updates if the updated widgets are the same.\n\t\t\t\tif ( isShallowEqual( sidebar.getWidgets(), nextWidgets ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\tconst addedWidgetIds = sidebar.setWidgets( nextWidgets );\n\n\t\t\t\treturn nextBlocks.reduce(\n\t\t\t\t\t( updatedNextBlocks, nextBlock, index ) => {\n\t\t\t\t\t\tconst addedWidgetId = addedWidgetIds[ index ];\n\n\t\t\t\t\t\tif ( addedWidgetId !== null ) {\n\t\t\t\t\t\t\t// Only create a new instance if necessary to prevent\n\t\t\t\t\t\t\t// the whole editor from re-rendering on every edit.\n\t\t\t\t\t\t\tif ( updatedNextBlocks === nextBlocks ) {\n\t\t\t\t\t\t\t\tupdatedNextBlocks = nextBlocks.slice();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tupdatedNextBlocks[ index ] = addWidgetIdTo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AAQ;AAAA,EACX;AAEA,SAAO,CAAE,QAAQ,gBAAgB,cAAe;AACjD;",
|
|
6
|
+
"names": ["isShallowEqual", "fastDeepEqual"]
|
|
7
|
+
}
|
|
@@ -1,44 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sidebar_controls_exports = {};
|
|
19
|
+
__export(sidebar_controls_exports, {
|
|
20
|
+
SidebarControlsContext: () => SidebarControlsContext,
|
|
21
|
+
default: () => SidebarControls,
|
|
22
|
+
useActiveSidebarControl: () => useActiveSidebarControl,
|
|
23
|
+
useSidebarControls: () => useSidebarControls
|
|
5
24
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const SidebarControlsContext = exports.SidebarControlsContext = (0, _element.createContext)();
|
|
17
|
-
SidebarControlsContext.displayName = 'SidebarControlsContext';
|
|
25
|
+
module.exports = __toCommonJS(sidebar_controls_exports);
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var import_element = require("@wordpress/element");
|
|
28
|
+
const SidebarControlsContext = (0, import_element.createContext)();
|
|
29
|
+
SidebarControlsContext.displayName = "SidebarControlsContext";
|
|
18
30
|
function SidebarControls({
|
|
19
31
|
sidebarControls,
|
|
20
32
|
activeSidebarControl,
|
|
21
33
|
children
|
|
22
34
|
}) {
|
|
23
|
-
const context = (0,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
35
|
+
const context = (0, import_element.useMemo)(
|
|
36
|
+
() => ({
|
|
37
|
+
sidebarControls,
|
|
38
|
+
activeSidebarControl
|
|
39
|
+
}),
|
|
40
|
+
[sidebarControls, activeSidebarControl]
|
|
41
|
+
);
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarControlsContext.Provider, { value: context, children });
|
|
31
43
|
}
|
|
32
44
|
function useSidebarControls() {
|
|
33
|
-
const {
|
|
34
|
-
sidebarControls
|
|
35
|
-
} = (0, _element.useContext)(SidebarControlsContext);
|
|
45
|
+
const { sidebarControls } = (0, import_element.useContext)(SidebarControlsContext);
|
|
36
46
|
return sidebarControls;
|
|
37
47
|
}
|
|
38
48
|
function useActiveSidebarControl() {
|
|
39
|
-
const {
|
|
40
|
-
activeSidebarControl
|
|
41
|
-
} = (0, _element.useContext)(SidebarControlsContext);
|
|
49
|
+
const { activeSidebarControl } = (0, import_element.useContext)(SidebarControlsContext);
|
|
42
50
|
return activeSidebarControl;
|
|
43
51
|
}
|
|
44
|
-
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
SidebarControlsContext,
|
|
55
|
+
useActiveSidebarControl,
|
|
56
|
+
useSidebarControls
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/sidebar-controls/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext, useMemo, useContext } from '@wordpress/element';\n\nexport const SidebarControlsContext = createContext();\nSidebarControlsContext.displayName = 'SidebarControlsContext';\n\nexport default function SidebarControls( {\n\tsidebarControls,\n\tactiveSidebarControl,\n\tchildren,\n} ) {\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tsidebarControls,\n\t\t\tactiveSidebarControl,\n\t\t} ),\n\t\t[ sidebarControls, activeSidebarControl ]\n\t);\n\n\treturn (\n\t\t<SidebarControlsContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</SidebarControlsContext.Provider>\n\t);\n}\n\nexport function useSidebarControls() {\n\tconst { sidebarControls } = useContext( SidebarControlsContext );\n\n\treturn sidebarControls;\n}\n\nexport function useActiveSidebarControl() {\n\tconst { activeSidebarControl } = useContext( SidebarControlsContext );\n\n\treturn activeSidebarControl;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBE;AAnBF,qBAAmD;AAE5C,MAAM,6BAAyB,8BAAc;AACpD,uBAAuB,cAAc;AAEtB,SAAR,gBAAkC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,cAAU;AAAA,IACf,OAAQ;AAAA,MACP;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAE,iBAAiB,oBAAqB;AAAA,EACzC;AAEA,SACC,4CAAC,uBAAuB,UAAvB,EAAgC,OAAQ,SACtC,UACH;AAEF;AAEO,SAAS,qBAAqB;AACpC,QAAM,EAAE,gBAAgB,QAAI,2BAAY,sBAAuB;AAE/D,SAAO;AACR;AAEO,SAAS,0BAA0B;AACzC,QAAM,EAAE,qBAAqB,QAAI,2BAAY,sBAAuB;AAEpE,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,67 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var welcome_guide_exports = {};
|
|
19
|
+
__export(welcome_guide_exports, {
|
|
20
|
+
default: () => WelcomeGuide
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
toggle
|
|
21
|
-
} = (0, _data.useDispatch)(_preferences.store);
|
|
22
|
-
const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
|
|
23
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
24
|
-
className: "customize-widgets-welcome-guide",
|
|
25
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
26
|
-
className: "customize-widgets-welcome-guide__image__wrapper",
|
|
27
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("picture", {
|
|
28
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
22
|
+
module.exports = __toCommonJS(welcome_guide_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_i18n = require("@wordpress/i18n");
|
|
25
|
+
var import_components = require("@wordpress/components");
|
|
26
|
+
var import_data = require("@wordpress/data");
|
|
27
|
+
var import_preferences = require("@wordpress/preferences");
|
|
28
|
+
function WelcomeGuide({ sidebar }) {
|
|
29
|
+
const { toggle } = (0, import_data.useDispatch)(import_preferences.store);
|
|
30
|
+
const isEntirelyBlockWidgets = sidebar.getWidgets().every((widget) => widget.id.startsWith("block-"));
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "customize-widgets-welcome-guide", children: [
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "customize-widgets-welcome-guide__image__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("picture", { children: [
|
|
33
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
34
|
+
"source",
|
|
35
|
+
{
|
|
29
36
|
srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg",
|
|
30
37
|
media: "(prefers-reduced-motion: reduce)"
|
|
31
|
-
}
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
+
"img",
|
|
42
|
+
{
|
|
32
43
|
className: "customize-widgets-welcome-guide__image",
|
|
33
44
|
src: "https://s.w.org/images/block-editor/welcome-editor.gif",
|
|
34
45
|
width: "312",
|
|
35
46
|
height: "240",
|
|
36
47
|
alt: ""
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) }),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "customize-widgets-welcome-guide__heading", children: (0, import_i18n.__)("Welcome to block Widgets") }),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "customize-widgets-welcome-guide__text", children: isEntirelyBlockWidgets ? (0, import_i18n.__)(
|
|
53
|
+
"Your theme provides different \u201Cblock\u201D areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site."
|
|
54
|
+
) : (0, import_i18n.__)(
|
|
55
|
+
"You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly."
|
|
56
|
+
) }),
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
import_components.Button,
|
|
59
|
+
{
|
|
60
|
+
size: "compact",
|
|
61
|
+
variant: "primary",
|
|
62
|
+
onClick: () => toggle("core/customize-widgets", "welcomeGuide"),
|
|
63
|
+
children: (0, import_i18n.__)("Got it")
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("hr", { className: "customize-widgets-welcome-guide__separator" }),
|
|
67
|
+
!isEntirelyBlockWidgets && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [
|
|
68
|
+
(0, import_i18n.__)("Want to stick with the old widgets?"),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
import_components.ExternalLink,
|
|
72
|
+
{
|
|
73
|
+
href: (0, import_i18n.__)(
|
|
74
|
+
"https://wordpress.org/plugins/classic-widgets/"
|
|
75
|
+
),
|
|
76
|
+
children: (0, import_i18n.__)("Get the Classic Widgets plugin.")
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [
|
|
81
|
+
(0, import_i18n.__)("New to the block editor?"),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
import_components.ExternalLink,
|
|
85
|
+
{
|
|
86
|
+
href: (0, import_i18n.__)(
|
|
87
|
+
"https://wordpress.org/documentation/article/wordpress-block-editor/"
|
|
88
|
+
),
|
|
89
|
+
children: (0, import_i18n.__)("Here's a detailed guide.")
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] })
|
|
93
|
+
] });
|
|
66
94
|
}
|
|
67
|
-
//# sourceMappingURL=index.js.map
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/welcome-guide/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different \u201Cblock\u201D areas for you to add and edit content.\u00A0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBI;AAfJ,kBAAmB;AACnB,wBAAqC;AACrC,kBAA4B;AAC5B,yBAA0C;AAE3B,SAAR,aAA+B,EAAE,QAAQ,GAAI;AACnD,QAAM,EAAE,OAAO,QAAI,yBAAa,mBAAAA,KAAiB;AAEjD,QAAM,yBAAyB,QAC7B,WAAW,EACX,MAAO,CAAE,WAAY,OAAO,GAAG,WAAY,QAAS,CAAE;AAExD,SACC,6CAAC,SAAI,WAAU,mCACd;AAAA,gDAAC,SAAI,WAAU,mDACd,uDAAC,aACA;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,QAAO;AAAA,UACP,OAAM;AAAA;AAAA,MACP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