/
home
/
desid573
/
verdenaturopathy.com.au
/
site3
/
wp-includes
/
js
/
dist
/
/home/desid573/verdenaturopathy.com.au/site3/wp-includes/js/dist
mkdir
upload
Name
Size
Mode
Actions
development/
-
0777
rm
script-modules/
-
0755
rm
vendor/
-
0777
rm
a11y.js
5584
0644
edit
dl
rm
a11y.min.js
2503
0644
edit
dl
rm
annotations.js
15493
0644
edit
dl
rm
annotations.min.js
5753
0644
edit
dl
rm
api-fetch.js
17875
0644
edit
dl
rm
api-fetch.min.js
6472
0644
edit
dl
rm
autop.js
9962
0644
edit
dl
rm
autop.min.js
5637
0644
edit
dl
rm
base-styles.js
48
0644
edit
dl
rm
base-styles.min.js
75
0644
edit
dl
rm
blob.js
2355
0644
edit
dl
rm
blob.min.js
1188
0644
edit
dl
rm
block-directory.js
57006
0644
edit
dl
rm
block-directory.min.js
22482
0644
edit
dl
rm
block-editor.js
2832320
0644
edit
dl
rm
block-editor.min.js
1056002
0644
edit
dl
rm
block-library.js
2692845
0644
edit
dl
rm
block-library.min.js
1143976
0644
edit
dl
rm
block-serialization-default-parser.js
6695
0644
edit
dl
rm
block-serialization-default-parser.min.js
2451
0644
edit
dl
rm
block-serialization-spec-parser.js
51693
0644
edit
dl
rm
block-serialization-spec-parser.min.js
10625
0644
edit
dl
rm
blocks.js
390206
0644
edit
dl
rm
blocks.min.js
184952
0644
edit
dl
rm
commands.js
155346
0644
edit
dl
rm
commands.min.js
64653
0644
edit
dl
rm
components.js
4017464
0644
edit
dl
rm
components.min.js
805148
0644
edit
dl
rm
compose.js
82688
0644
edit
dl
rm
compose.min.js
28856
0644
edit
dl
rm
core-commands.js
29367
0644
edit
dl
rm
core-commands.min.js
12153
0644
edit
dl
rm
core-data.js
626718
0644
edit
dl
rm
core-data.min.js
215516
0644
edit
dl
rm
customize-widgets.js
93770
0644
edit
dl
rm
customize-widgets.min.js
37494
0644
edit
dl
rm
data-controls.js
4230
0644
edit
dl
rm
data-controls.min.js
1814
0644
edit
dl
rm
data.js
84771
0644
edit
dl
rm
data.min.js
26540
0644
edit
dl
rm
date.js
180576
0644
edit
dl
rm
date.min.js
144608
0644
edit
dl
rm
deprecated.js
3113
0644
edit
dl
rm
deprecated.min.js
1315
0644
edit
dl
rm
dom-ready.js
1508
0644
edit
dl
rm
dom-ready.min.js
818
0644
edit
dl
rm
dom.js
35445
0644
edit
dl
rm
dom.min.js
12954
0644
edit
dl
rm
edit-post.js
120213
0644
edit
dl
rm
edit-post.min.js
50284
0644
edit
dl
rm
edit-site.js
1767456
0644
edit
dl
rm
edit-site.min.js
700880
0644
edit
dl
rm
edit-widgets.js
164094
0644
edit
dl
rm
edit-widgets.min.js
63344
0644
edit
dl
rm
editor.js
2617702
0644
edit
dl
rm
editor.min.js
1046150
0644
edit
dl
rm
element.js
28602
0644
edit
dl
rm
element.min.js
12458
0644
edit
dl
rm
escape-html.js
2346
0644
edit
dl
rm
escape-html.min.js
1091
0644
edit
dl
rm
format-library.js
75099
0644
edit
dl
rm
format-library.min.js
29575
0644
edit
dl
rm
hooks.js
12242
0644
edit
dl
rm
hooks.min.js
5050
0644
edit
dl
rm
html-entities.js
1685
0644
edit
dl
rm
html-entities.min.js
879
0644
edit
dl
rm
i18n.js
15670
0644
edit
dl
rm
i18n.min.js
5732
0644
edit
dl
rm
is-shallow-equal.js
2758
0644
edit
dl
rm
is-shallow-equal.min.js
1122
0644
edit
dl
rm
keyboard-shortcuts.js
9913
0644
edit
dl
rm
keyboard-shortcuts.min.js
3527
0644
edit
dl
rm
keycodes.js
8501
0644
edit
dl
rm
keycodes.min.js
2975
0644
edit
dl
rm
list-reusable-blocks.js
13374
0644
edit
dl
rm
list-reusable-blocks.min.js
5367
0644
edit
dl
rm
media-utils.js
652438
0644
edit
dl
rm
media-utils.min.js
243343
0644
edit
dl
rm
notices.js
10356
0644
edit
dl
rm
notices.min.js
4489
0644
edit
dl
rm
nux.js
10572
0644
edit
dl
rm
nux.min.js
4048
0644
edit
dl
rm
patterns.js
59644
0644
edit
dl
rm
patterns.min.js
22152
0644
edit
dl
rm
plugins.js
11951
0644
edit
dl
rm
plugins.min.js
4870
0644
edit
dl
rm
preferences-persistence.js
17629
0644
edit
dl
rm
preferences-persistence.min.js
5622
0644
edit
dl
rm
preferences.js
21574
0644
edit
dl
rm
preferences.min.js
7899
0644
edit
dl
rm
primitives.js
5203
0644
edit
dl
rm
primitives.min.js
2026
0644
edit
dl
rm
priority-queue.js
10265
0644
edit
dl
rm
priority-queue.min.js
3432
0644
edit
dl
rm
private-apis.js
4192
0644
edit
dl
rm
private-apis.min.js
2723
0644
edit
dl
rm
react-i18n.js
3999
0644
edit
dl
rm
react-i18n.min.js
1562
0644
edit
dl
rm
redux-routine.js
25275
0644
edit
dl
rm
redux-routine.min.js
9881
0644
edit
dl
rm
reusable-blocks.js
21004
0644
edit
dl
rm
reusable-blocks.min.js
7396
0644
edit
dl
rm
rich-text.js
99366
0644
edit
dl
rm
rich-text.min.js
40847
0644
edit
dl
rm
router.js
36987
0644
edit
dl
rm
router.min.js
14470
0644
edit
dl
rm
server-side-render.js
11231
0644
edit
dl
rm
server-side-render.min.js
4035
0644
edit
dl
rm
shortcode.js
8150
0644
edit
dl
rm
shortcode.min.js
3361
0644
edit
dl
rm
style-engine.js
18040
0644
edit
dl
rm
style-engine.min.js
6569
0644
edit
dl
rm
theme.js
130711
0644
edit
dl
rm
theme.min.js
57465
0644
edit
dl
rm
token-list.js
6262
0644
edit
dl
rm
token-list.min.js
1658
0644
edit
dl
rm
undo-manager.js
5422
0644
edit
dl
rm
undo-manager.min.js
1739
0644
edit
dl
rm
upload-media.js
57002
0644
edit
dl
rm
upload-media.min.js
23606
0644
edit
dl
rm
url.js
23951
0644
edit
dl
rm
url.min.js
10370
0644
edit
dl
rm
viewport.js
6765
0644
edit
dl
rm
viewport.min.js
2297
0644
edit
dl
rm
warning.js
1559
0644
edit
dl
rm
warning.min.js
755
0644
edit
dl
rm
widgets.js
51282
0644
edit
dl
rm
widgets.min.js
21327
0644
edit
dl
rm
wordcount.js
7101
0644
edit
dl
rm
wordcount.min.js
2505
0644
edit
dl
rm
Edit:
/home/desid573/verdenaturopathy.com.au/site3/wp-includes/js/dist/widgets.js
(51282B)
var wp; (wp ||= {}).widgets = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name3 in all) __defProp(target, name3, { get: all[name3], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // package-external:@wordpress/blocks var require_blocks = __commonJS({ "package-external:@wordpress/blocks"(exports, module) { module.exports = window.wp.blocks; } }); // package-external:@wordpress/element var require_element = __commonJS({ "package-external:@wordpress/element"(exports, module) { module.exports = window.wp.element; } }); // package-external:@wordpress/primitives var require_primitives = __commonJS({ "package-external:@wordpress/primitives"(exports, module) { module.exports = window.wp.primitives; } }); // vendor-external:react/jsx-runtime var require_jsx_runtime = __commonJS({ "vendor-external:react/jsx-runtime"(exports, module) { module.exports = window.ReactJSXRuntime; } }); // package-external:@wordpress/block-editor var require_block_editor = __commonJS({ "package-external:@wordpress/block-editor"(exports, module) { module.exports = window.wp.blockEditor; } }); // package-external:@wordpress/components var require_components = __commonJS({ "package-external:@wordpress/components"(exports, module) { module.exports = window.wp.components; } }); // package-external:@wordpress/i18n var require_i18n = __commonJS({ "package-external:@wordpress/i18n"(exports, module) { module.exports = window.wp.i18n; } }); // package-external:@wordpress/core-data var require_core_data = __commonJS({ "package-external:@wordpress/core-data"(exports, module) { module.exports = window.wp.coreData; } }); // package-external:@wordpress/data var require_data = __commonJS({ "package-external:@wordpress/data"(exports, module) { module.exports = window.wp.data; } }); // package-external:@wordpress/notices var require_notices = __commonJS({ "package-external:@wordpress/notices"(exports, module) { module.exports = window.wp.notices; } }); // package-external:@wordpress/compose var require_compose = __commonJS({ "package-external:@wordpress/compose"(exports, module) { module.exports = window.wp.compose; } }); // package-external:@wordpress/api-fetch var require_api_fetch = __commonJS({ "package-external:@wordpress/api-fetch"(exports, module) { module.exports = window.wp.apiFetch; } }); // packages/widgets/build-module/index.mjs var index_exports = {}; __export(index_exports, { MoveToWidgetArea: () => MoveToWidgetArea, addWidgetIdToBlock: () => addWidgetIdToBlock, getWidgetIdFromBlock: () => getWidgetIdFromBlock, registerLegacyWidgetBlock: () => registerLegacyWidgetBlock, registerLegacyWidgetVariations: () => registerLegacyWidgetVariations, registerWidgetGroupBlock: () => registerWidgetGroupBlock }); var import_blocks5 = __toESM(require_blocks(), 1); // packages/widgets/build-module/blocks/legacy-widget/index.mjs var legacy_widget_exports = {}; __export(legacy_widget_exports, { metadata: () => block_default, name: () => name, settings: () => settings }); // packages/icons/build-module/library/brush.mjs var import_primitives = __toESM(require_primitives(), 1); var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); var brush_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" }) }); // packages/icons/build-module/library/group.mjs var import_primitives2 = __toESM(require_primitives(), 1); var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); var group_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" }) }); // packages/icons/build-module/library/move-to.mjs var import_primitives3 = __toESM(require_primitives(), 1); var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); var move_to_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" }) }); // packages/icons/build-module/library/widget.mjs var import_primitives4 = __toESM(require_primitives(), 1); var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); var widget_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z" }) }); // packages/widgets/build-module/blocks/legacy-widget/block.json var block_default = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/legacy-widget", title: "Legacy Widget", category: "widgets", description: "Display a legacy widget.", textdomain: "default", attributes: { id: { type: "string", default: null }, idBase: { type: "string", default: null }, instance: { type: "object", default: null } }, supports: { html: false, customClassName: false, reusable: false }, editorStyle: "wp-block-legacy-widget-editor" }; // node_modules/clsx/dist/clsx.mjs function r(e) { var t, f, n = ""; if ("string" == typeof e || "number" == typeof e) n += e; else if ("object" == typeof e) if (Array.isArray(e)) { var o = e.length; for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); } else for (f in e) e[f] && (n && (n += " "), n += f); return n; } function clsx() { for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); return n; } var clsx_default = clsx; // packages/widgets/build-module/blocks/legacy-widget/edit/index.mjs var import_block_editor3 = __toESM(require_block_editor(), 1); var import_components5 = __toESM(require_components(), 1); var import_i18n7 = __toESM(require_i18n(), 1); var import_element3 = __toESM(require_element(), 1); var import_core_data2 = __toESM(require_core_data(), 1); // packages/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.mjs var import_components = __toESM(require_components(), 1); var import_i18n = __toESM(require_i18n(), 1); var import_data = __toESM(require_data(), 1); var import_core_data = __toESM(require_core_data(), 1); var import_block_editor = __toESM(require_block_editor(), 1); var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); function WidgetTypeSelector({ selectedId, onSelect }) { const widgetTypes = (0, import_data.useSelect)((select2) => { const hiddenIds = select2(import_block_editor.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock ?? []; return select2(import_core_data.store).getWidgetTypes({ per_page: -1 })?.filter((widgetType) => !hiddenIds.includes(widgetType.id)); }, []); if (!widgetTypes) { return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_components.Spinner, {}); } if (widgetTypes.length === 0) { return (0, import_i18n.__)("There are no widgets available."); } return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)( import_components.SelectControl, { __next40pxDefaultSize: true, label: (0, import_i18n.__)("Legacy widget"), value: selectedId ?? "", options: [ { value: "", label: (0, import_i18n.__)("Select widget") }, ...widgetTypes.map((widgetType) => ({ value: widgetType.id, label: widgetType.name })) ], onChange: (value) => { if (value) { const selected = widgetTypes.find( (widgetType) => widgetType.id === value ); onSelect({ selectedId: selected.id, isMulti: selected.is_multi }); } else { onSelect({ selectedId: null }); } } } ); } // packages/widgets/build-module/blocks/legacy-widget/edit/inspector-card.mjs var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); function InspectorCard({ name: name3, description }) { return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "wp-block-legacy-widget-inspector-card", children: [ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "wp-block-legacy-widget-inspector-card__name", children: name3 }), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: description }) ] }); } // packages/widgets/build-module/blocks/legacy-widget/edit/form.mjs var import_element = __toESM(require_element(), 1); var import_data2 = __toESM(require_data(), 1); var import_notices = __toESM(require_notices(), 1); var import_i18n3 = __toESM(require_i18n(), 1); var import_components2 = __toESM(require_components(), 1); var import_compose2 = __toESM(require_compose(), 1); // packages/widgets/build-module/blocks/legacy-widget/edit/control.mjs var import_api_fetch = __toESM(require_api_fetch(), 1); var import_compose = __toESM(require_compose(), 1); var import_i18n2 = __toESM(require_i18n(), 1); var Control = class { /** * Creates and loads a new control. * * @access public * @param {Object} params * @param {string} params.id * @param {string} params.idBase * @param {Object} params.instance * @param {Function} params.onChangeInstance * @param {Function} params.onChangeHasPreview * @param {Function} params.onError */ constructor({ id, idBase, instance, onChangeInstance, onChangeHasPreview, onError }) { this.id = id; this.idBase = idBase; this._instance = instance; this._hasPreview = null; this.onChangeInstance = onChangeInstance; this.onChangeHasPreview = onChangeHasPreview; this.onError = onError; this.number = ++lastNumber; this.handleFormChange = (0, import_compose.debounce)( this.handleFormChange.bind(this), 200 ); this.handleFormSubmit = this.handleFormSubmit.bind(this); this.initDOM(); this.bindEvents(); this.loadContent(); } /** * Clean up the control so that it can be garbage collected. * * @access public */ destroy() { this.unbindEvents(); this.element.remove(); } /** * Creates the control's DOM structure. * * @access private */ initDOM() { this.element = el("div", { class: "widget open" }, [ el("div", { class: "widget-inside" }, [ this.form = el("form", { class: "form", method: "post" }, [ // These hidden form inputs are what most widgets' scripts // use to access data about the widget. el("input", { class: "widget-id", type: "hidden", name: "widget-id", value: this.id ?? `${this.idBase}-${this.number}` }), el("input", { class: "id_base", type: "hidden", name: "id_base", value: this.idBase ?? this.id }), el("input", { class: "widget-width", type: "hidden", name: "widget-width", value: "250" }), el("input", { class: "widget-height", type: "hidden", name: "widget-height", value: "200" }), el("input", { class: "widget_number", type: "hidden", name: "widget_number", value: this.idBase ? this.number.toString() : "" }), this.content = el("div", { class: "widget-content" }), // Non-multi widgets can be saved via a Save button. this.id && el( "button", { class: "button is-primary", type: "submit" }, (0, import_i18n2.__)("Save") ) ]) ]) ]); } /** * Adds the control's event listeners. * * @access private */ bindEvents() { if (window.jQuery) { const { jQuery: $ } = window; $(this.form).on("change", null, this.handleFormChange); $(this.form).on("input", null, this.handleFormChange); $(this.form).on("submit", this.handleFormSubmit); } else { this.form.addEventListener("change", this.handleFormChange); this.form.addEventListener("input", this.handleFormChange); this.form.addEventListener("submit", this.handleFormSubmit); } } /** * Removes the control's event listeners. * * @access private */ unbindEvents() { if (window.jQuery) { const { jQuery: $ } = window; $(this.form).off("change", null, this.handleFormChange); $(this.form).off("input", null, this.handleFormChange); $(this.form).off("submit", this.handleFormSubmit); } else { this.form.removeEventListener("change", this.handleFormChange); this.form.removeEventListener("input", this.handleFormChange); this.form.removeEventListener("submit", this.handleFormSubmit); } } /** * Fetches the widget's form HTML from the REST API and loads it into the * control's form. * * @access private */ async loadContent() { try { if (this.id) { const { form } = await saveWidget(this.id); this.content.innerHTML = form; } else if (this.idBase) { const { form, preview } = await encodeWidget({ idBase: this.idBase, instance: this.instance, number: this.number }); this.content.innerHTML = form; this.hasPreview = !isEmptyHTML(preview); if (!this.instance.hash) { const { instance } = await encodeWidget({ idBase: this.idBase, instance: this.instance, number: this.number, formData: serializeForm(this.form) }); this.instance = instance; } } if (window.jQuery) { const { jQuery: $ } = window; $(document).trigger("widget-added", [$(this.element)]); } } catch (error) { this.onError(error); } } /** * Perform a save when a multi widget's form is changed. Non-multi widgets * are saved manually. * * @access private */ handleFormChange() { if (this.idBase) { this.saveForm(); } } /** * Perform a save when the control's form is manually submitted. * * @access private * @param {Event} event */ handleFormSubmit(event) { event.preventDefault(); this.saveForm(); } /** * Serialize the control's form, send it to the REST API, and update the * instance with the encoded instance that the REST API returns. * * @access private */ async saveForm() { const formData = serializeForm(this.form); try { if (this.id) { const { form } = await saveWidget(this.id, formData); this.content.innerHTML = form; if (window.jQuery) { const { jQuery: $ } = window; $(document).trigger("widget-updated", [ $(this.element) ]); } } else if (this.idBase) { const { instance, preview } = await encodeWidget({ idBase: this.idBase, instance: this.instance, number: this.number, formData }); this.instance = instance; this.hasPreview = !isEmptyHTML(preview); } } catch (error) { this.onError(error); } } /** * The widget's instance object. * * @access private */ get instance() { return this._instance; } /** * The widget's instance object. * * @access private */ set instance(instance) { if (this._instance !== instance) { this._instance = instance; this.onChangeInstance(instance); } } /** * Whether or not the widget can be previewed. * * @access public */ get hasPreview() { return this._hasPreview; } /** * Whether or not the widget can be previewed. * * @access private */ set hasPreview(hasPreview) { if (this._hasPreview !== hasPreview) { this._hasPreview = hasPreview; this.onChangeHasPreview(hasPreview); } } }; var lastNumber = 0; function el(tagName, attributes = {}, content = null) { const element = document.createElement(tagName); for (const [attribute, value] of Object.entries(attributes)) { element.setAttribute(attribute, value); } if (Array.isArray(content)) { for (const child of content) { if (child) { element.appendChild(child); } } } else if (typeof content === "string") { element.innerText = content; } return element; } async function saveWidget(id, formData = null) { let widget; if (formData) { widget = await (0, import_api_fetch.default)({ path: `/wp/v2/widgets/${id}?context=edit`, method: "PUT", data: { form_data: formData } }); } else { widget = await (0, import_api_fetch.default)({ path: `/wp/v2/widgets/${id}?context=edit`, method: "GET" }); } return { form: widget.rendered_form }; } async function encodeWidget({ idBase, instance, number, formData = null }) { const response = await (0, import_api_fetch.default)({ path: `/wp/v2/widget-types/${idBase}/encode`, method: "POST", data: { instance, number, form_data: formData } }); return { instance: response.instance, form: response.form, preview: response.preview }; } function isEmptyHTML(html) { const element = document.createElement("div"); element.innerHTML = html; return isEmptyNode(element); } function isEmptyNode(node) { switch (node.nodeType) { case node.TEXT_NODE: return node.nodeValue.trim() === ""; case node.ELEMENT_NODE: if ([ "AUDIO", "CANVAS", "EMBED", "IFRAME", "IMG", "MATH", "OBJECT", "SVG", "VIDEO" ].includes(node.tagName)) { return false; } if (!node.hasChildNodes()) { return true; } return Array.from(node.childNodes).every(isEmptyNode); default: return true; } } function serializeForm(form) { return new window.URLSearchParams( Array.from(new window.FormData(form)) ).toString(); } // packages/widgets/build-module/blocks/legacy-widget/edit/form.mjs var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); function Form({ title, isVisible, id, idBase, instance, isWide, onChangeInstance, onChangeHasPreview }) { const ref = (0, import_element.useRef)(); const isMediumLargeViewport = (0, import_compose2.useViewportMatch)("small"); const outgoingInstances = (0, import_element.useRef)(/* @__PURE__ */ new Set()); const incomingInstances = (0, import_element.useRef)(/* @__PURE__ */ new Set()); const { createNotice } = (0, import_data2.useDispatch)(import_notices.store); (0, import_element.useEffect)(() => { if (incomingInstances.current.has(instance)) { incomingInstances.current.delete(instance); return; } const control = new Control({ id, idBase, instance, onChangeInstance(nextInstance) { outgoingInstances.current.add(instance); incomingInstances.current.add(nextInstance); onChangeInstance(nextInstance); }, onChangeHasPreview, onError(error) { window.console.error(error); createNotice( "error", (0, import_i18n3.sprintf)( /* translators: %s: the name of the affected block. */ (0, import_i18n3.__)( 'The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.' ), idBase || id ) ); } }); ref.current.appendChild(control.element); return () => { if (outgoingInstances.current.has(instance)) { outgoingInstances.current.delete(instance); return; } control.destroy(); }; }, [ id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport ]); if (isWide && isMediumLargeViewport) { return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)( "div", { className: clsx_default({ "wp-block-legacy-widget__container": isVisible }), children: [ isVisible && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "wp-block-legacy-widget__edit-form-title", children: title }), /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( import_components2.Popover, { focusOnMount: false, placement: "right", offset: 32, resize: false, flip: false, shift: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( "div", { ref, className: "wp-block-legacy-widget__edit-form", hidden: !isVisible } ) } ) ] } ); } return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( "div", { ref, className: "wp-block-legacy-widget__edit-form", hidden: !isVisible, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "wp-block-legacy-widget__edit-form-title", children: title }) } ); } // packages/widgets/build-module/blocks/legacy-widget/edit/preview.mjs var import_compose3 = __toESM(require_compose(), 1); var import_element2 = __toESM(require_element(), 1); var import_components3 = __toESM(require_components(), 1); var import_i18n4 = __toESM(require_i18n(), 1); var import_api_fetch2 = __toESM(require_api_fetch(), 1); var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); function Preview({ idBase, instance, isVisible }) { const [isLoaded, setIsLoaded] = (0, import_element2.useState)(false); const [srcDoc, setSrcDoc] = (0, import_element2.useState)(""); (0, import_element2.useEffect)(() => { const abortController = typeof window.AbortController === "undefined" ? void 0 : new window.AbortController(); async function fetchPreviewHTML() { const restRoute = `/wp/v2/widget-types/${idBase}/render`; return await (0, import_api_fetch2.default)({ path: restRoute, method: "POST", signal: abortController?.signal, data: instance ? { instance } : {} }); } fetchPreviewHTML().then((response) => { setSrcDoc(response.preview); }).catch((error) => { if ("AbortError" === error.name) { return; } throw error; }); return () => abortController?.abort(); }, [idBase, instance]); const ref = (0, import_compose3.useRefEffect)( (iframe) => { if (!isLoaded) { return; } function setHeight() { const height = Math.max( iframe.contentDocument.documentElement?.offsetHeight ?? 0, iframe.contentDocument.body?.offsetHeight ?? 0 ); iframe.style.height = `${height !== 0 ? height : 100}px`; } const { IntersectionObserver } = iframe.ownerDocument.defaultView; const intersectionObserver = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { setHeight(); } }, { threshold: 1 } ); intersectionObserver.observe(iframe); iframe.addEventListener("load", setHeight); return () => { intersectionObserver.disconnect(); iframe.removeEventListener("load", setHeight); }; }, [isLoaded] ); return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [ isVisible && !isLoaded && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components3.Placeholder, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components3.Spinner, {}) }), /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( "div", { className: clsx_default("wp-block-legacy-widget__edit-preview", { "is-offscreen": !isVisible || !isLoaded }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components3.Disabled, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( "iframe", { ref, className: "wp-block-legacy-widget__edit-preview-iframe", tabIndex: "-1", title: (0, import_i18n4.__)("Legacy Widget Preview"), srcDoc, onLoad: (event) => { event.target.contentDocument.body.style.overflow = "hidden"; setIsLoaded(true); }, height: 100 } ) }) } ) ] }); } // packages/widgets/build-module/blocks/legacy-widget/edit/no-preview.mjs var import_i18n5 = __toESM(require_i18n(), 1); var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); function NoPreview({ name: name3 }) { return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "wp-block-legacy-widget__edit-no-preview", children: [ name3 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: name3 }), /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: (0, import_i18n5.__)("No preview available.") }) ] }); } // packages/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.mjs var import_data3 = __toESM(require_data(), 1); var import_block_editor2 = __toESM(require_block_editor(), 1); var import_components4 = __toESM(require_components(), 1); var import_blocks = __toESM(require_blocks(), 1); var import_i18n6 = __toESM(require_i18n(), 1); var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); function ConvertToBlocksButton({ clientId, rawInstance }) { const { replaceBlocks } = (0, import_data3.useDispatch)(import_block_editor2.store); return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( import_components4.ToolbarButton, { onClick: () => { if (rawInstance.title) { replaceBlocks(clientId, [ (0, import_blocks.createBlock)("core/heading", { content: rawInstance.title }), ...(0, import_blocks.rawHandler)({ HTML: rawInstance.text }) ]); } else { replaceBlocks( clientId, (0, import_blocks.rawHandler)({ HTML: rawInstance.text }) ); } }, children: (0, import_i18n6.__)("Convert to blocks") } ); } // packages/widgets/build-module/blocks/legacy-widget/edit/index.mjs var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); function Edit(props) { const { id, idBase } = props.attributes; const { isWide = false } = props; const blockProps = (0, import_block_editor3.useBlockProps)({ className: clsx_default({ "is-wide-widget": isWide }) }); return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ...blockProps, children: !id && !idBase ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Empty, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NotEmpty, { ...props }) }); } function Empty({ attributes: { id, idBase }, setAttributes }) { return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( import_components5.Placeholder, { icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_block_editor3.BlockIcon, { icon: brush_default }), label: (0, import_i18n7.__)("Legacy Widget"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.Flex, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.FlexBlock, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( WidgetTypeSelector, { selectedId: id ?? idBase, onSelect: ({ selectedId, isMulti }) => { if (!selectedId) { setAttributes({ id: null, idBase: null, instance: null }); } else if (isMulti) { setAttributes({ id: null, idBase: selectedId, instance: {} }); } else { setAttributes({ id: selectedId, idBase: null, instance: null }); } } } ) }) }) } ); } function NotEmpty({ attributes: { id, idBase, instance }, setAttributes, clientId, isSelected, isWide = false }) { const [hasPreview, setHasPreview] = (0, import_element3.useState)(null); const widgetTypeId = id ?? idBase; const { record: widgetType, hasResolved: hasResolvedWidgetType } = (0, import_core_data2.useEntityRecord)("root", "widgetType", widgetTypeId); const setInstance = (0, import_element3.useCallback)((nextInstance) => { setAttributes({ instance: nextInstance }); }, []); if (!widgetType && hasResolvedWidgetType) { return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( import_components5.Placeholder, { icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_block_editor3.BlockIcon, { icon: brush_default }), label: (0, import_i18n7.__)("Legacy Widget"), children: (0, import_i18n7.__)("Widget is missing.") } ); } if (!hasResolvedWidgetType) { return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.Placeholder, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.Spinner, {}) }); } const mode = idBase && !isSelected ? "preview" : "edit"; return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [ idBase === "text" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_block_editor3.BlockControls, { group: "other", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( ConvertToBlocksButton, { clientId, rawInstance: instance.raw } ) }), /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_block_editor3.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( InspectorCard, { name: widgetType.name, description: widgetType.description } ) }), /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( Form, { title: widgetType.name, isVisible: mode === "edit", id, idBase, instance, isWide, onChangeInstance: setInstance, onChangeHasPreview: setHasPreview } ), idBase && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [ hasPreview === null && mode === "preview" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.Placeholder, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.Spinner, {}) }), hasPreview === true && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( Preview, { idBase, instance, isVisible: mode === "preview" } ), hasPreview === false && mode === "preview" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NoPreview, { name: widgetType.name }) ] }) ] }); } // packages/widgets/build-module/blocks/legacy-widget/transforms.mjs var import_blocks2 = __toESM(require_blocks(), 1); var legacyWidgetTransforms = [ { block: "core/calendar", widget: "calendar" }, { block: "core/search", widget: "search" }, { block: "core/html", widget: "custom_html", transform: ({ content }) => ({ content }) }, { block: "core/archives", widget: "archives", transform: ({ count, dropdown }) => { return { displayAsDropdown: !!dropdown, showPostCounts: !!count }; } }, { block: "core/latest-posts", widget: "recent-posts", transform: ({ show_date: displayPostDate, number }) => { return { displayPostDate: !!displayPostDate, postsToShow: number }; } }, { block: "core/latest-comments", widget: "recent-comments", transform: ({ number }) => { return { commentsToShow: number }; } }, { block: "core/tag-cloud", widget: "tag_cloud", transform: ({ taxonomy, count }) => { return { showTagCounts: !!count, taxonomy }; } }, { block: "core/categories", widget: "categories", transform: ({ count, dropdown, hierarchical }) => { return { displayAsDropdown: !!dropdown, showPostCounts: !!count, showHierarchy: !!hierarchical }; } }, { block: "core/audio", widget: "media_audio", transform: ({ url, preload, loop, attachment_id: id }) => { return { src: url, id, preload, loop }; } }, { block: "core/video", widget: "media_video", transform: ({ url, preload, loop, attachment_id: id }) => { return { src: url, id, preload, loop }; } }, { block: "core/image", widget: "media_image", transform: ({ alt, attachment_id: id, caption, height, link_classes: linkClass, link_rel: rel, link_target_blank: targetBlack, link_type: linkDestination, link_url: link, size: sizeSlug, url, width }) => { return { alt, caption, height, id, link, linkClass, linkDestination, linkTarget: targetBlack ? "_blank" : void 0, rel, sizeSlug, url, width }; } }, { block: "core/gallery", widget: "media_gallery", transform: ({ ids, link_type: linkTo, size, number }) => { return { ids, columns: number, linkTo, sizeSlug: size, images: ids.map((id) => ({ id })) }; } }, { block: "core/rss", widget: "rss", transform: ({ url, show_author: displayAuthor, show_date: displayDate, show_summary: displayExcerpt, items }) => { return { feedURL: url, displayAuthor: !!displayAuthor, displayDate: !!displayDate, displayExcerpt: !!displayExcerpt, itemsToShow: items }; } } ].map(({ block, widget, transform }) => { return { type: "block", blocks: [block], isMatch: ({ idBase, instance }) => { return idBase === widget && !!instance?.raw; }, transform: ({ instance }) => { const transformedBlock = (0, import_blocks2.createBlock)( block, transform ? transform(instance.raw) : void 0 ); if (!instance.raw?.title) { return transformedBlock; } return [ (0, import_blocks2.createBlock)("core/heading", { content: instance.raw.title }), transformedBlock ]; } }; }); var transforms = { to: legacyWidgetTransforms }; var transforms_default = transforms; // packages/widgets/build-module/blocks/legacy-widget/index.mjs var { name } = block_default; var settings = { icon: widget_default, edit: Edit, transforms: transforms_default }; // packages/widgets/build-module/blocks/widget-group/index.mjs var widget_group_exports = {}; __export(widget_group_exports, { metadata: () => block_default2, name: () => name2, settings: () => settings2 }); var import_i18n9 = __toESM(require_i18n(), 1); var import_blocks3 = __toESM(require_blocks(), 1); // packages/widgets/build-module/blocks/widget-group/block.json var block_default2 = { $schema: "https://schemas.wp.org/trunk/block.json", apiVersion: 3, name: "core/widget-group", title: "Widget Group", category: "widgets", attributes: { title: { type: "string" } }, supports: { html: false, inserter: true, customClassName: true, reusable: false }, editorStyle: "wp-block-widget-group-editor", style: "wp-block-widget-group" }; // packages/widgets/build-module/blocks/widget-group/edit.mjs var import_block_editor4 = __toESM(require_block_editor(), 1); var import_components6 = __toESM(require_components(), 1); var import_i18n8 = __toESM(require_i18n(), 1); var import_data4 = __toESM(require_data(), 1); var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); function Edit2(props) { const { clientId } = props; const hasInnerBlocks = (0, import_data4.useSelect)( (select2) => select2(import_block_editor4.store).getBlockCount(clientId) > 0, [clientId] ); return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ...(0, import_block_editor4.useBlockProps)({ className: "widget" }), children: !hasInnerBlocks ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PlaceholderContent, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PreviewContent, { ...props }) }); } function PlaceholderContent({ clientId }) { return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( import_components6.Placeholder, { className: "wp-block-widget-group__placeholder", icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_block_editor4.BlockIcon, { icon: group_default }), label: (0, import_i18n8.__)("Widget Group"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_block_editor4.ButtonBlockAppender, { rootClientId: clientId }) } ), /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_block_editor4.InnerBlocks, { renderAppender: false }) ] }); } function PreviewContent({ attributes, setAttributes }) { return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( import_block_editor4.RichText, { tagName: "h2", identifier: "title", className: "widget-title", allowedFormats: [], placeholder: (0, import_i18n8.__)("Title"), value: attributes.title ?? "", onChange: (title) => setAttributes({ title }) } ), /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_block_editor4.InnerBlocks, {}) ] }); } // packages/widgets/build-module/blocks/widget-group/save.mjs var import_block_editor5 = __toESM(require_block_editor(), 1); var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); function save({ attributes }) { return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( import_block_editor5.RichText.Content, { tagName: "h2", className: "widget-title", value: attributes.title } ), /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "wp-widget-group__inner-blocks", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_block_editor5.InnerBlocks.Content, {}) }) ] }); } // packages/widgets/build-module/blocks/widget-group/deprecated.mjs var import_block_editor6 = __toESM(require_block_editor(), 1); var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); var v1 = { attributes: { title: { type: "string" } }, supports: { html: false, inserter: true, customClassName: true, reusable: false }, save({ attributes }) { return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( import_block_editor6.RichText.Content, { tagName: "h2", className: "widget-title", value: attributes.title } ), /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_block_editor6.InnerBlocks.Content, {}) ] }); } }; var deprecated_default = [v1]; // packages/widgets/build-module/blocks/widget-group/index.mjs var { name: name2 } = block_default2; var settings2 = { title: (0, import_i18n9.__)("Widget Group"), description: (0, import_i18n9.__)( "Create a classic widget layout with a title that\u2019s styled by your theme for your widget areas." ), icon: group_default, __experimentalLabel: ({ name: label }) => label, edit: Edit2, save, transforms: { from: [ { type: "block", isMultiBlock: true, blocks: ["*"], isMatch(attributes, blocks) { return !blocks.some( (block) => block.name === "core/widget-group" ); }, __experimentalConvert(blocks) { let innerBlocks = [ ...blocks.map((block) => { return (0, import_blocks3.createBlock)( block.name, block.attributes, block.innerBlocks ); }) ]; const firstHeadingBlock = innerBlocks[0].name === "core/heading" ? innerBlocks[0] : null; innerBlocks = innerBlocks.filter( (block) => block !== firstHeadingBlock ); return (0, import_blocks3.createBlock)( "core/widget-group", { ...firstHeadingBlock && { title: firstHeadingBlock.attributes.content } }, innerBlocks ); } } ] }, deprecated: deprecated_default }; // packages/widgets/build-module/components/move-to-widget-area/index.mjs var import_components7 = __toESM(require_components(), 1); var import_i18n10 = __toESM(require_i18n(), 1); var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); function MoveToWidgetArea({ currentWidgetAreaId, widgetAreas, onSelect }) { return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components7.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components7.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( import_components7.DropdownMenu, { icon: move_to_default, label: (0, import_i18n10.__)("Move to widget area"), toggleProps, children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components7.MenuGroup, { label: (0, import_i18n10.__)("Move to"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( import_components7.MenuItemsChoice, { choices: widgetAreas.map( (widgetArea) => ({ value: widgetArea.id, label: widgetArea.name, info: widgetArea.description }) ), value: currentWidgetAreaId, onSelect: (value) => { onSelect(value); onClose(); } } ) }) } ) }) }); } // packages/widgets/build-module/utils.mjs function getWidgetIdFromBlock(block) { return block.attributes.__internalWidgetId; } function addWidgetIdToBlock(block, widgetId) { return { ...block, attributes: { ...block.attributes || {}, __internalWidgetId: widgetId } }; } // packages/widgets/build-module/register-legacy-widget-variations.mjs var import_data5 = __toESM(require_data(), 1); var import_core_data3 = __toESM(require_core_data(), 1); var import_blocks4 = __toESM(require_blocks(), 1); function registerLegacyWidgetVariations(settings3) { const unsubscribe = (0, import_data5.subscribe)(() => { const hiddenIds = settings3?.widgetTypesToHideFromLegacyWidgetBlock ?? []; const widgetTypes = (0, import_data5.select)(import_core_data3.store).getWidgetTypes({ per_page: -1 })?.filter((widgetType) => !hiddenIds.includes(widgetType.id)); if (widgetTypes) { unsubscribe(); (0, import_data5.dispatch)(import_blocks4.store).addBlockVariations( "core/legacy-widget", widgetTypes.map((widgetType) => ({ name: widgetType.id, title: widgetType.name, description: widgetType.description, attributes: widgetType.is_multi ? { idBase: widgetType.id, instance: {} } : { id: widgetType.id } })) ); } }); } // packages/widgets/build-module/index.mjs function registerLegacyWidgetBlock(supports = {}) { const { metadata, settings: settings3, name: name3 } = legacy_widget_exports; (0, import_blocks5.registerBlockType)( { name: name3, ...metadata }, { ...settings3, supports: { ...settings3.supports, ...supports } } ); } function registerWidgetGroupBlock(supports = {}) { const { metadata, settings: settings3, name: name3 } = widget_group_exports; (0, import_blocks5.registerBlockType)( { name: name3, ...metadata }, { ...settings3, supports: { ...settings3.supports, ...supports } } ); } return __toCommonJS(index_exports); })();
Save
cmd:
run