Preview: editor.js
Size: 1.01 MB
/home/jambtst2015/public_html/qasandra.com/wp-includes/js/dist/editor.js
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 4306:
/***/ (function(module, exports) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
autosize 4.0.4
license: MIT
http://www.jacklmoore.com/autosize
*/
(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function (module, exports) {
'use strict';
var map = typeof Map === "function" ? new Map() : function () {
var keys = [];
var values = [];
return {
has: function has(key) {
return keys.indexOf(key) > -1;
},
get: function get(key) {
return values[keys.indexOf(key)];
},
set: function set(key, value) {
if (keys.indexOf(key) === -1) {
keys.push(key);
values.push(value);
}
},
delete: function _delete(key) {
var index = keys.indexOf(key);
if (index > -1) {
keys.splice(index, 1);
values.splice(index, 1);
}
}
};
}();
var createEvent = function createEvent(name) {
return new Event(name, { bubbles: true });
};
try {
new Event('test');
} catch (e) {
// IE does not support `new Event()`
createEvent = function createEvent(name) {
var evt = document.createEvent('Event');
evt.initEvent(name, true, false);
return evt;
};
}
function assign(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
var heightOffset = null;
var clientWidth = null;
var cachedHeight = null;
function init() {
var style = window.getComputedStyle(ta, null);
if (style.resize === 'vertical') {
ta.style.resize = 'none';
} else if (style.resize === 'both') {
ta.style.resize = 'horizontal';
}
if (style.boxSizing === 'content-box') {
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
// Fix when a textarea is not on document body and heightOffset is Not a Number
if (isNaN(heightOffset)) {
heightOffset = 0;
}
update();
}
function changeOverflow(value) {
{
// Chrome/Safari-specific fix:
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
// made available by removing the scrollbar. The following forces the necessary text reflow.
var width = ta.style.width;
ta.style.width = '0px';
// Force reflow:
/* jshint ignore:start */
ta.offsetWidth;
/* jshint ignore:end */
ta.style.width = width;
}
ta.style.overflowY = value;
}
function getParentOverflows(el) {
var arr = [];
while (el && el.parentNode && el.parentNode instanceof Element) {
if (el.parentNode.scrollTop) {
arr.push({
node: el.parentNode,
scrollTop: el.parentNode.scrollTop
});
}
el = el.parentNode;
}
return arr;
}
function resize() {
if (ta.scrollHeight === 0) {
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
return;
}
var overflows = getParentOverflows(ta);
var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
ta.style.height = '';
ta.style.height = ta.scrollHeight + heightOffset + 'px';
// used to check if an update is actually necessary on window.resize
clientWidth = ta.clientWidth;
// prevents scroll-position jumping
overflows.forEach(function (el) {
el.node.scrollTop = el.scrollTop;
});
if (docTop) {
document.documentElement.scrollTop = docTop;
}
}
function update() {
resize();
var styleHeight = Math.round(parseFloat(ta.style.height));
var computed = window.getComputedStyle(ta, null);
// Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be allowed.
if (actualHeight < styleHeight) {
if (computed.overflowY === 'hidden') {
changeOverflow('scroll');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
} else {
// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
if (computed.overflowY !== 'hidden') {
changeOverflow('hidden');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
}
if (cachedHeight !== actualHeight) {
cachedHeight = actualHeight;
var evt = createEvent('autosize:resized');
try {
ta.dispatchEvent(evt);
} catch (err) {
// Firefox will throw an error on dispatchEvent for a detached element
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
}
}
}
var pageResize = function pageResize() {
if (ta.clientWidth !== clientWidth) {
update();
}
};
var destroy = function (style) {
window.removeEventListener('resize', pageResize, false);
ta.removeEventListener('input', update, false);
ta.removeEventListener('keyup', update, false);
ta.removeEventListener('autosize:destroy', destroy, false);
ta.removeEventListener('autosize:update', update, false);
Object.keys(style).forEach(function (key) {
ta.style[key] = style[key];
});
map.delete(ta);
}.bind(ta, {
height: ta.style.height,
resize: ta.style.resize,
overflowY: ta.style.overflowY,
overflowX: ta.style.overflowX,
wordWrap: ta.style.wordWrap
});
ta.addEventListener('autosize:destroy', destroy, false);
// IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those events.
// There is no way that I know of to detect something like 'cut' in IE9.
if ('onpropertychange' in ta && 'oninput' in ta) {
ta.addEventListener('keyup', update, false);
}
window.addEventListener('resize', pageResize, false);
ta.addEventListener('input', update, false);
ta.addEventListener('autosize:update', update, false);
ta.style.overflowX = 'hidden';
ta.style.wordWrap = 'break-word';
map.set(ta, {
destroy: destroy,
update: update
});
init();
}
function destroy(ta) {
var methods = map.get(ta);
if (methods) {
methods.destroy();
}
}
function update(ta) {
var methods = map.get(ta);
if (methods) {
methods.update();
}
}
var autosize = null;
// Do nothing in Node.js environment and IE8 (or lower)
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
autosize = function autosize(el) {
return el;
};
autosize.destroy = function (el) {
return el;
};
autosize.update = function (el) {
return el;
};
} else {
autosize = function autosize(el, options) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
return assign(x, options);
});
}
return el;
};
autosize.destroy = function (el) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], destroy);
}
return el;
};
autosize.update = function (el) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], update);
}
return el;
};
}
exports.default = autosize;
module.exports = exports['default'];
});
/***/ }),
/***/ 6109:
/***/ ((module) => {
// This code has been refactored for 140 bytes
// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
var computedStyle = function (el, prop, getComputedStyle) {
getComputedStyle = window.getComputedStyle;
// In one fell swoop
return (
// If we have getComputedStyle
getComputedStyle ?
// Query it
// TODO: From CSS-Query notes, we might need (node, null) for FF
getComputedStyle(el) :
// Otherwise, we are in IE and use currentStyle
el.currentStyle
)[
// Switch to camelCase for CSSOM
// DEV: Grabbed from jQuery
// https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
// https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
prop.replace(/-(\w)/gi, function (word, letter) {
return letter.toUpperCase();
})
];
};
module.exports = computedStyle;
/***/ }),
/***/ 66:
/***/ ((module) => {
"use strict";
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]'
|| stringValue === '[object Date]'
|| isReactElement(value)
}
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneUnlessOtherwiseSpecified(value, options) {
return (options.clone !== false && options.isMergeableObject(value))
? deepmerge(emptyTarget(value), value, options)
: value
}
function defaultArrayMerge(target, source, options) {
return target.concat(source).map(function(element) {
return cloneUnlessOtherwiseSpecified(element, options)
})
}
function getMergeFunction(key, options) {
if (!options.customMerge) {
return deepmerge
}
var customMerge = options.customMerge(key);
return typeof customMerge === 'function' ? customMerge : deepmerge
}
function getEnumerableOwnPropertySymbols(target) {
return Object.getOwnPropertySymbols
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
return Object.propertyIsEnumerable.call(target, symbol)
})
: []
}
function getKeys(target) {
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
}
function propertyIsOnObject(object, property) {
try {
return property in object
} catch(_) {
return false
}
}
// Protects from prototype poisoning and unexpected merging up the prototype chain.
function propertyIsUnsafe(target, key) {
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
}
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
});
}
getKeys(source).forEach(function(key) {
if (propertyIsUnsafe(target, key)) {
return
}
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
} else {
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
}
});
return destination
}
function deepmerge(target, source, options) {
options = options || {};
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
// implementations can use it. The caller may not replace it.
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneUnlessOtherwiseSpecified(source, options)
} else if (sourceIsArray) {
return options.arrayMerge(target, source, options)
} else {
return mergeObject(target, source, options)
}
}
deepmerge.all = function deepmergeAll(array, options) {
if (!Array.isArray(array)) {
throw new Error('first argument should be an array')
}
return array.reduce(function(prev, next) {
return deepmerge(prev, next, options)
}, {})
};
var deepmerge_1 = deepmerge;
module.exports = deepmerge_1;
/***/ }),
/***/ 5215:
/***/ ((module) => {
"use strict";
// do not edit .js files directly - edit src/index.jst
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
/***/ }),
/***/ 461:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// Load in dependencies
var computedStyle = __webpack_require__(6109);
/**
* Calculate the `line-height` of a given node
* @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
* @returns {Number} `line-height` of the element in pixels
*/
function lineHeight(node) {
// Grab the line-height via style
var lnHeightStr = computedStyle(node, 'line-height');
var lnHeight = parseFloat(lnHeightStr, 10);
// If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
if (lnHeightStr === lnHeight + '') {
// Save the old lineHeight style and update the em unit to the element
var _lnHeightStyle = node.style.lineHeight;
node.style.lineHeight = lnHeightStr + 'em';
// Calculate the em based height
lnHeightStr = computedStyle(node, 'line-height');
lnHeight = parseFloat(lnHeightStr, 10);
// Revert the lineHeight style
if (_lnHeightStyle) {
node.style.lineHeight = _lnHeightStyle;
} else {
delete node.style.lineHeight;
}
}
// If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
// DEV: `em` units are converted to `pt` in IE6
// Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
if (lnHeightStr.indexOf('pt') !== -1) {
lnHeight *= 4;
lnHeight /= 3;
// Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
} else if (lnHeightStr.indexOf('mm') !== -1) {
lnHeight *= 96;
lnHeight /= 25.4;
// Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
} else if (lnHeightStr.indexOf('cm') !== -1) {
lnHeight *= 96;
lnHeight /= 2.54;
// Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
} else if (lnHeightStr.indexOf('in') !== -1) {
lnHeight *= 96;
// Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
} else if (lnHeightStr.indexOf('pc') !== -1) {
lnHeight *= 16;
}
// Continue our computation
lnHeight = Math.round(lnHeight);
// If the line-height is "normal", calculate by font-size
if (lnHeightStr === 'normal') {
// Create a temporary node
var nodeName = node.nodeName;
var _node = document.createElement(nodeName);
_node.innerHTML = ' ';
// If we have a text area, reset it to only 1 row
// https://github.com/twolfson/line-height/issues/4
if (nodeName.toUpperCase() === 'TEXTAREA') {
_node.setAttribute('rows', '1');
}
// Set the font-size of the element
var fontSizeStr = computedStyle(node, 'font-size');
_node.style.fontSize = fontSizeStr;
// Remove default padding/border which can affect offset height
// https://github.com/twolfson/line-height/issues/4
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
_node.style.padding = '0px';
_node.style.border = '0px';
// Append it to the body
var body = document.body;
body.appendChild(_node);
// Assume the line height of the element is the height
var height = _node.offsetHeight;
lnHeight = height;
// Remove our child from the DOM
body.removeChild(_node);
}
// Return the calculated height
return lnHeight;
}
// Export lineHeight
module.exports = lineHeight;
/***/ }),
/***/ 628:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = __webpack_require__(4067);
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module.exports = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
};
shim.isRequired = shim;
function getShim() {
return shim;
};
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bigint: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/***/ 5826:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (false) { var throwOnDirectAccess, ReactIs; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(628)();
}
/***/ }),
/***/ 4067:
/***/ ((module) => {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/***/ 4462:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
exports.__esModule = true;
var React = __webpack_require__(1609);
var PropTypes = __webpack_require__(5826);
var autosize = __webpack_require__(4306);
var _getLineHeight = __webpack_require__(461);
var getLineHeight = _getLineHeight;
var RESIZED = "autosize:resized";
/**
* A light replacement for built-in textarea component
* which automaticaly adjusts its height to match the content
*/
var TextareaAutosizeClass = /** @class */ (function (_super) {
__extends(TextareaAutosizeClass, _super);
function TextareaAutosizeClass() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
lineHeight: null
};
_this.textarea = null;
_this.onResize = function (e) {
if (_this.props.onResize) {
_this.props.onResize(e);
}
};
_this.updateLineHeight = function () {
if (_this.textarea) {
_this.setState({
lineHeight: getLineHeight(_this.textarea)
});
}
};
_this.onChange = function (e) {
var onChange = _this.props.onChange;
_this.currentValue = e.currentTarget.value;
onChange && onChange(e);
};
return _this;
}
TextareaAutosizeClass.prototype.componentDidMount = function () {
var _this = this;
var _a = this.props, maxRows = _a.maxRows, async = _a.async;
if (typeof maxRows === "number") {
this.updateLineHeight();
}
if (typeof maxRows === "number" || async) {
/*
the defer is needed to:
- force "autosize" to activate the scrollbar when this.props.maxRows is passed
- support StyledComponents (see #71)
*/
setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
}
else {
this.textarea && autosize(this.textarea);
}
if (this.textarea) {
this.textarea.addEventListener(RESIZED, this.onResize);
}
};
TextareaAutosizeClass.prototype.componentWillUnmount = function () {
if (this.textarea) {
this.textarea.removeEventListener(RESIZED, this.onResize);
autosize.destroy(this.textarea);
}
};
TextareaAutosizeClass.prototype.render = function () {
var _this = this;
var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
_this.textarea = element;
if (typeof _this.props.innerRef === 'function') {
_this.props.innerRef(element);
}
else if (_this.props.innerRef) {
_this.props.innerRef.current = element;
}
} }), children));
};
TextareaAutosizeClass.prototype.componentDidUpdate = function () {
this.textarea && autosize.update(this.textarea);
};
TextareaAutosizeClass.defaultProps = {
rows: 1,
async: false
};
TextareaAutosizeClass.propTypes = {
rows: PropTypes.number,
maxRows: PropTypes.number,
onResize: PropTypes.func,
innerRef: PropTypes.any,
async: PropTypes.bool
};
return TextareaAutosizeClass;
}(React.Component));
exports.TextareaAutosize = React.forwardRef(function (props, ref) {
return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
});
/***/ }),
/***/ 4132:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = true;
var TextareaAutosize_1 = __webpack_require__(4462);
exports.A = TextareaAutosize_1.TextareaAutosize;
/***/ }),
/***/ 9681:
/***/ ((module) => {
var characterMap = {
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Ấ": "A",
"Ắ": "A",
"Ẳ": "A",
"Ẵ": "A",
"Ặ": "A",
"Æ": "AE",
"Ầ": "A",
"Ằ": "A",
"Ȃ": "A",
"Ả": "A",
"Ạ": "A",
"Ẩ": "A",
"Ẫ": "A",
"Ậ": "A",
"Ç": "C",
"Ḉ": "C",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ế": "E",
"Ḗ": "E",
"Ề": "E",
"Ḕ": "E",
"Ḝ": "E",
"Ȇ": "E",
"Ẻ": "E",
"Ẽ": "E",
"Ẹ": "E",
"Ể": "E",
"Ễ": "E",
"Ệ": "E",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ḯ": "I",
"Ȋ": "I",
"Ỉ": "I",
"Ị": "I",
"Ð": "D",
"Ñ": "N",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"Ố": "O",
"Ṍ": "O",
"Ṓ": "O",
"Ȏ": "O",
"Ỏ": "O",
"Ọ": "O",
"Ổ": "O",
"Ỗ": "O",
"Ộ": "O",
"Ờ": "O",
"Ở": "O",
"Ỡ": "O",
"Ớ": "O",
"Ợ": "O",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ủ": "U",
"Ụ": "U",
"Ử": "U",
"Ữ": "U",
"Ự": "U",
"Ý": "Y",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"ấ": "a",
"ắ": "a",
"ẳ": "a",
"ẵ": "a",
"ặ": "a",
"æ": "ae",
"ầ": "a",
"ằ": "a",
"ȃ": "a",
"ả": "a",
"ạ": "a",
"ẩ": "a",
"ẫ": "a",
"ậ": "a",
"ç": "c",
"ḉ": "c",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ế": "e",
"ḗ": "e",
"ề": "e",
"ḕ": "e",
"ḝ": "e",
"ȇ": "e",
"ẻ": "e",
"ẽ": "e",
"ẹ": "e",
"ể": "e",
"ễ": "e",
"ệ": "e",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ḯ": "i",
"ȋ": "i",
"ỉ": "i",
"ị": "i",
"ð": "d",
"ñ": "n",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"ố": "o",
"ṍ": "o",
"ṓ": "o",
"ȏ": "o",
"ỏ": "o",
"ọ": "o",
"ổ": "o",
"ỗ": "o",
"ộ": "o",
"ờ": "o",
"ở": "o",
"ỡ": "o",
"ớ": "o",
"ợ": "o",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ủ": "u",
"ụ": "u",
"ử": "u",
"ữ": "u",
"ự": "u",
"ý": "y",
"ÿ": "y",
"Ā": "A",
"ā": "a",
"Ă": "A",
"ă": "a",
"Ą": "A",
"ą": "a",
"Ć": "C",
"ć": "c",
"Ĉ": "C",
"ĉ": "c",
"Ċ": "C",
"ċ": "c",
"Č": "C",
"č": "c",
"C̆": "C",
"c̆": "c",
"Ď": "D",
"ď": "d",
"Đ": "D",
"đ": "d",
"Ē": "E",
"ē": "e",
"Ĕ": "E",
"ĕ": "e",
"Ė": "E",
"ė": "e",
"Ę": "E",
"ę": "e",
"Ě": "E",
"ě": "e",
"Ĝ": "G",
"Ǵ": "G",
"ĝ": "g",
"ǵ": "g",
"Ğ": "G",
"ğ": "g",
"Ġ": "G",
"ġ": "g",
"Ģ": "G",
"ģ": "g",
"Ĥ": "H",
"ĥ": "h",
"Ħ": "H",
"ħ": "h",
"Ḫ": "H",
"ḫ": "h",
"Ĩ": "I",
"ĩ": "i",
"Ī": "I",
"ī": "i",
"Ĭ": "I",
"ĭ": "i",
"Į": "I",
"į": "i",
"İ": "I",
"ı": "i",
"IJ": "IJ",
"ij": "ij",
"Ĵ": "J",
"ĵ": "j",
"Ķ": "K",
"ķ": "k",
"Ḱ": "K",
"ḱ": "k",
"K̆": "K",
"k̆": "k",
"Ĺ": "L",
"ĺ": "l",
"Ļ": "L",
"ļ": "l",
"Ľ": "L",
"ľ": "l",
"Ŀ": "L",
"ŀ": "l",
"Ł": "l",
"ł": "l",
"Ḿ": "M",
"ḿ": "m",
"M̆": "M",
"m̆": "m",
"Ń": "N",
"ń": "n",
"Ņ": "N",
"ņ": "n",
"Ň": "N",
"ň": "n",
"ʼn": "n",
"N̆": "N",
"n̆": "n",
"Ō": "O",
"ō": "o",
"Ŏ": "O",
"ŏ": "o",
"Ő": "O",
"ő": "o",
"Œ": "OE",
"œ": "oe",
"P̆": "P",
"p̆": "p",
"Ŕ": "R",
"ŕ": "r",
"Ŗ": "R",
"ŗ": "r",
"Ř": "R",
"ř": "r",
"R̆": "R",
"r̆": "r",
"Ȓ": "R",
"ȓ": "r",
"Ś": "S",
"ś": "s",
"Ŝ": "S",
"ŝ": "s",
"Ş": "S",
"Ș": "S",
"ș": "s",
"ş": "s",
"Š": "S",
"š": "s",
"Ţ": "T",
"ţ": "t",
"ț": "t",
"Ț": "T",
"Ť": "T",
"ť": "t",
"Ŧ": "T",
"ŧ": "t",
"T̆": "T",
"t̆": "t",
"Ũ": "U",
"ũ": "u",
"Ū": "U",
"ū": "u",
"Ŭ": "U",
"ŭ": "u",
"Ů": "U",
"ů": "u",
"Ű": "U",
"ű": "u",
"Ų": "U",
"ų": "u",
"Ȗ": "U",
"ȗ": "u",
"V̆": "V",
"v̆": "v",
"Ŵ": "W",
"ŵ": "w",
"Ẃ": "W",
"ẃ": "w",
"X̆": "X",
"x̆": "x",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Y̆": "Y",
"y̆": "y",
"Ź": "Z",
"ź": "z",
"Ż": "Z",
"ż": "z",
"Ž": "Z",
"ž": "z",
"ſ": "s",
"ƒ": "f",
"Ơ": "O",
"ơ": "o",
"Ư": "U",
"ư": "u",
"Ǎ": "A",
"ǎ": "a",
"Ǐ": "I",
"ǐ": "i",
"Ǒ": "O",
"ǒ": "o",
"Ǔ": "U",
"ǔ": "u",
"Ǖ": "U",
"ǖ": "u",
"Ǘ": "U",
"ǘ": "u",
"Ǚ": "U",
"ǚ": "u",
"Ǜ": "U",
"ǜ": "u",
"Ứ": "U",
"ứ": "u",
"Ṹ": "U",
"ṹ": "u",
"Ǻ": "A",
"ǻ": "a",
"Ǽ": "AE",
"ǽ": "ae",
"Ǿ": "O",
"ǿ": "o",
"Þ": "TH",
"þ": "th",
"Ṕ": "P",
"ṕ": "p",
"Ṥ": "S",
"ṥ": "s",
"X́": "X",
"x́": "x",
"Ѓ": "Г",
"ѓ": "г",
"Ќ": "К",
"ќ": "к",
"A̋": "A",
"a̋": "a",
"E̋": "E",
"e̋": "e",
"I̋": "I",
"i̋": "i",
"Ǹ": "N",
"ǹ": "n",
"Ồ": "O",
"ồ": "o",
"Ṑ": "O",
"ṑ": "o",
"Ừ": "U",
"ừ": "u",
"Ẁ": "W",
"ẁ": "w",
"Ỳ": "Y",
"ỳ": "y",
"Ȁ": "A",
"ȁ": "a",
"Ȅ": "E",
"ȅ": "e",
"Ȉ": "I",
"ȉ": "i",
"Ȍ": "O",
"ȍ": "o",
"Ȑ": "R",
"ȑ": "r",
"Ȕ": "U",
"ȕ": "u",
"B̌": "B",
"b̌": "b",
"Č̣": "C",
"č̣": "c",
"Ê̌": "E",
"ê̌": "e",
"F̌": "F",
"f̌": "f",
"Ǧ": "G",
"ǧ": "g",
"Ȟ": "H",
"ȟ": "h",
"J̌": "J",
"ǰ": "j",
"Ǩ": "K",
"ǩ": "k",
"M̌": "M",
"m̌": "m",
"P̌": "P",
"p̌": "p",
"Q̌": "Q",
"q̌": "q",
"Ř̩": "R",
"ř̩": "r",
"Ṧ": "S",
"ṧ": "s",
"V̌": "V",
"v̌": "v",
"W̌": "W",
"w̌": "w",
"X̌": "X",
"x̌": "x",
"Y̌": "Y",
"y̌": "y",
"A̧": "A",
"a̧": "a",
"B̧": "B",
"b̧": "b",
"Ḑ": "D",
"ḑ": "d",
"Ȩ": "E",
"ȩ": "e",
"Ɛ̧": "E",
"ɛ̧": "e",
"Ḩ": "H",
"ḩ": "h",
"I̧": "I",
"i̧": "i",
"Ɨ̧": "I",
"ɨ̧": "i",
"M̧": "M",
"m̧": "m",
"O̧": "O",
"o̧": "o",
"Q̧": "Q",
"q̧": "q",
"U̧": "U",
"u̧": "u",
"X̧": "X",
"x̧": "x",
"Z̧": "Z",
"z̧": "z",
"й":"и",
"Й":"И",
"ё":"е",
"Ё":"Е",
};
var chars = Object.keys(characterMap).join('|');
var allAccents = new RegExp(chars, 'g');
var firstAccent = new RegExp(chars, '');
function matcher(match) {
return characterMap[match];
}
var removeAccents = function(string) {
return string.replace(allAccents, matcher);
};
var hasAccents = function(string) {
return !!string.match(firstAccent);
};
module.exports = removeAccents;
module.exports.has = hasAccents;
module.exports.remove = removeAccents;
/***/ }),
/***/ 1609:
/***/ ((module) => {
"use strict";
module.exports = window["React"];
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
AlignmentToolbar: () => (/* reexport */ AlignmentToolbar),
Autocomplete: () => (/* reexport */ Autocomplete),
AutosaveMonitor: () => (/* reexport */ autosave_monitor),
BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar),
BlockControls: () => (/* reexport */ BlockControls),
BlockEdit: () => (/* reexport */ BlockEdit),
BlockEditorKeyboardShortcuts: () => (/* reexport */ BlockEditorKeyboardShortcuts),
BlockFormatControls: () => (/* reexport */ BlockFormatControls),
BlockIcon: () => (/* reexport */ BlockIcon),
BlockInspector: () => (/* reexport */ BlockInspector),
BlockList: () => (/* reexport */ BlockList),
BlockMover: () => (/* reexport */ BlockMover),
BlockNavigationDropdown: () => (/* reexport */ BlockNavigationDropdown),
BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer),
BlockSettingsMenu: () => (/* reexport */ BlockSettingsMenu),
BlockTitle: () => (/* reexport */ BlockTitle),
BlockToolbar: () => (/* reexport */ BlockToolbar),
CharacterCount: () => (/* reexport */ CharacterCount),
ColorPalette: () => (/* reexport */ ColorPalette),
ContrastChecker: () => (/* reexport */ ContrastChecker),
CopyHandler: () => (/* reexport */ CopyHandler),
DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender),
DocumentBar: () => (/* reexport */ DocumentBar),
DocumentOutline: () => (/* reexport */ DocumentOutline),
DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck),
EditorHistoryRedo: () => (/* reexport */ editor_history_redo),
EditorHistoryUndo: () => (/* reexport */ editor_history_undo),
EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts),
EditorKeyboardShortcutsRegister: () => (/* reexport */ register_shortcuts),
EditorNotices: () => (/* reexport */ editor_notices),
EditorProvider: () => (/* reexport */ provider),
EditorSnackbars: () => (/* reexport */ EditorSnackbars),
EntitiesSavedStates: () => (/* reexport */ EntitiesSavedStates),
ErrorBoundary: () => (/* reexport */ error_boundary),
FontSizePicker: () => (/* reexport */ FontSizePicker),
InnerBlocks: () => (/* reexport */ InnerBlocks),
Inserter: () => (/* reexport */ Inserter),
InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls),
InspectorControls: () => (/* reexport */ InspectorControls),
LocalAutosaveMonitor: () => (/* reexport */ local_autosave_monitor),
MediaPlaceholder: () => (/* reexport */ MediaPlaceholder),
MediaUpload: () => (/* reexport */ MediaUpload),
MediaUploadCheck: () => (/* reexport */ MediaUploadCheck),
MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView),
NavigableToolbar: () => (/* reexport */ NavigableToolbar),
ObserveTyping: () => (/* reexport */ ObserveTyping),
PageAttributesCheck: () => (/* reexport */ page_attributes_check),
PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks),
PageAttributesPanel: () => (/* reexport */ PageAttributesPanel),
PageAttributesParent: () => (/* reexport */ page_attributes_parent),
PageTemplate: () => (/* reexport */ classic_theme),
PanelColorSettings: () => (/* reexport */ PanelColorSettings),
PlainText: () => (/* reexport */ PlainText),
PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item),
PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel),
PluginMoreMenuItem: () => (/* reexport */ plugin_more_menu_item),
PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel),
PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info),
PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel),
PluginPreviewMenuItem: () => (/* reexport */ plugin_preview_menu_item),
PluginSidebar: () => (/* reexport */ PluginSidebar),
PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem),
PostAuthor: () => (/* reexport */ post_author),
PostAuthorCheck: () => (/* reexport */ PostAuthorCheck),
PostAuthorPanel: () => (/* reexport */ panel),
PostComments: () => (/* reexport */ post_comments),
PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel),
PostExcerpt: () => (/* reexport */ PostExcerpt),
PostExcerptCheck: () => (/* reexport */ post_excerpt_check),
PostExcerptPanel: () => (/* reexport */ PostExcerptPanel),
PostFeaturedImage: () => (/* reexport */ post_featured_image),
PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check),
PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel),
PostFormat: () => (/* reexport */ PostFormat),
PostFormatCheck: () => (/* reexport */ post_format_check),
PostLastRevision: () => (/* reexport */ post_last_revision),
PostLastRevisionCheck: () => (/* reexport */ post_last_revision_check),
PostLastRevisionPanel: () => (/* reexport */ post_last_revision_panel),
PostLockedModal: () => (/* reexport */ PostLockedModal),
PostPendingStatus: () => (/* reexport */ post_pending_status),
PostPendingStatusCheck: () => (/* reexport */ post_pending_status_check),
PostPingbacks: () => (/* reexport */ post_pingbacks),
PostPreviewButton: () => (/* reexport */ PostPreviewButton),
PostPublishButton: () => (/* reexport */ post_publish_button),
PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel),
PostPublishPanel: () => (/* reexport */ post_publish_panel),
PostSavedState: () => (/* reexport */ PostSavedState),
PostSchedule: () => (/* reexport */ PostSchedule),
PostScheduleCheck: () => (/* reexport */ PostScheduleCheck),
PostScheduleLabel: () => (/* reexport */ PostScheduleLabel),
PostSchedulePanel: () => (/* reexport */ PostSchedulePanel),
PostSlug: () => (/* reexport */ PostSlug),
PostSlugCheck: () => (/* reexport */ PostSlugCheck),
PostSticky: () => (/* reexport */ PostSticky),
PostStickyCheck: () => (/* reexport */ PostStickyCheck),
PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton),
PostSyncStatus: () => (/* reexport */ PostSyncStatus),
PostTaxonomies: () => (/* reexport */ post_taxonomies),
PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck),
PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector),
PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector),
PostTaxonomiesPanel: () => (/* reexport */ post_taxonomies_panel),
PostTemplatePanel: () => (/* reexport */ PostTemplatePanel),
PostTextEditor: () => (/* reexport */ PostTextEditor),
PostTitle: () => (/* reexport */ post_title),
PostTitleRaw: () => (/* reexport */ post_title_raw),
PostTrash: () => (/* reexport */ PostTrash),
PostTrashCheck: () => (/* reexport */ PostTrashCheck),
PostTypeSupportCheck: () => (/* reexport */ post_type_support_check),
PostURL: () => (/* reexport */ PostURL),
PostURLCheck: () => (/* reexport */ PostURLCheck),
PostURLLabel: () => (/* reexport */ PostURLLabel),
PostURLPanel: () => (/* reexport */ PostURLPanel),
PostVisibility: () => (/* reexport */ PostVisibility),
PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck),
PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel),
RichText: () => (/* reexport */ RichText),
RichTextShortcut: () => (/* reexport */ RichTextShortcut),
RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton),
ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())),
SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock),
TableOfContents: () => (/* reexport */ table_of_contents),
TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts),
ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck),
TimeToRead: () => (/* reexport */ TimeToRead),
URLInput: () => (/* reexport */ URLInput),
URLInputButton: () => (/* reexport */ URLInputButton),
URLPopover: () => (/* reexport */ URLPopover),
UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning),
VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts),
Warning: () => (/* reexport */ Warning),
WordCount: () => (/* reexport */ WordCount),
WritingFlow: () => (/* reexport */ WritingFlow),
__unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent),
cleanForSlug: () => (/* reexport */ cleanForSlug),
createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC),
getColorClassName: () => (/* reexport */ getColorClassName),
getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues),
getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue),
getFontSize: () => (/* reexport */ getFontSize),
getFontSizeClass: () => (/* reexport */ getFontSizeClass),
getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon),
mediaUpload: () => (/* reexport */ mediaUpload),
privateApis: () => (/* reexport */ privateApis),
registerEntityAction: () => (/* reexport */ api_registerEntityAction),
store: () => (/* reexport */ store_store),
storeConfig: () => (/* reexport */ storeConfig),
transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles),
unregisterEntityAction: () => (/* reexport */ api_unregisterEntityAction),
useEntitiesSavedStatesIsDirty: () => (/* reexport */ useIsDirty),
usePostScheduleLabel: () => (/* reexport */ usePostScheduleLabel),
usePostURLLabel: () => (/* reexport */ usePostURLLabel),
usePostVisibilityLabel: () => (/* reexport */ usePostVisibilityLabel),
userAutocompleter: () => (/* reexport */ user),
withColorContext: () => (/* reexport */ withColorContext),
withColors: () => (/* reexport */ withColors),
withFontSizes: () => (/* reexport */ withFontSizes)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
__experimentalGetDefaultTemplatePartAreas: () => (__experimentalGetDefaultTemplatePartAreas),
__experimentalGetDefaultTemplateType: () => (__experimentalGetDefaultTemplateType),
__experimentalGetDefaultTemplateTypes: () => (__experimentalGetDefaultTemplateTypes),
__experimentalGetTemplateInfo: () => (__experimentalGetTemplateInfo),
__unstableIsEditorReady: () => (__unstableIsEditorReady),
canInsertBlockType: () => (canInsertBlockType),
canUserUseUnfilteredHTML: () => (canUserUseUnfilteredHTML),
didPostSaveRequestFail: () => (didPostSaveRequestFail),
didPostSaveRequestSucceed: () => (didPostSaveRequestSucceed),
getActivePostLock: () => (getActivePostLock),
getAdjacentBlockClientId: () => (getAdjacentBlockClientId),
getAutosaveAttribute: () => (getAutosaveAttribute),
getBlock: () => (getBlock),
getBlockAttributes: () => (getBlockAttributes),
getBlockCount: () => (getBlockCount),
getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId),
getBlockIndex: () => (getBlockIndex),
getBlockInsertionPoint: () => (getBlockInsertionPoint),
getBlockListSettings: () => (getBlockListSettings),
getBlockMode: () => (getBlockMode),
getBlockName: () => (getBlockName),
getBlockOrder: () => (getBlockOrder),
getBlockRootClientId: () => (getBlockRootClientId),
getBlockSelectionEnd: () => (getBlockSelectionEnd),
getBlockSelectionStart: () => (getBlockSelectionStart),
getBlocks: () => (getBlocks),
getBlocksByClientId: () => (getBlocksByClientId),
getClientIdsOfDescendants: () => (getClientIdsOfDescendants),
getClientIdsWithDescendants: () => (getClientIdsWithDescendants),
getCurrentPost: () => (getCurrentPost),
getCurrentPostAttribute: () => (getCurrentPostAttribute),
getCurrentPostId: () => (getCurrentPostId),
getCurrentPostLastRevisionId: () => (getCurrentPostLastRevisionId),
getCurrentPostRevisionsCount: () => (getCurrentPostRevisionsCount),
getCurrentPostType: () => (getCurrentPostType),
getCurrentTemplateId: () => (getCurrentTemplateId),
getDeviceType: () => (getDeviceType),
getEditedPostAttribute: () => (getEditedPostAttribute),
getEditedPostContent: () => (getEditedPostContent),
getEditedPostPreviewLink: () => (getEditedPostPreviewLink),
getEditedPostSlug: () => (getEditedPostSlug),
getEditedPostVisibility: () => (getEditedPostVisibility),
getEditorBlocks: () => (getEditorBlocks),
getEditorMode: () => (getEditorMode),
getEditorSelection: () => (getEditorSelection),
getEditorSelectionEnd: () => (getEditorSelectionEnd),
getEditorSelectionStart: () => (getEditorSelectionStart),
getEditorSettings: () => (getEditorSettings),
getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId),
getGlobalBlockCount: () => (getGlobalBlockCount),
getInserterItems: () => (getInserterItems),
getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId),
getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds),
getMultiSelectedBlocks: () => (getMultiSelectedBlocks),
getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId),
getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId),
getNextBlockClientId: () => (getNextBlockClientId),
getPermalink: () => (getPermalink),
getPermalinkParts: () => (getPermalinkParts),
getPostEdits: () => (getPostEdits),
getPostLockUser: () => (getPostLockUser),
getPostTypeLabel: () => (getPostTypeLabel),
getPreviousBlockClientId: () => (getPreviousBlockClientId),
getRenderingMode: () => (getRenderingMode),
getSelectedBlock: () => (getSelectedBlock),
getSelectedBlockClientId: () => (getSelectedBlockClientId),
getSelectedBlockCount: () => (getSelectedBlockCount),
getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition),
getStateBeforeOptimisticTransaction: () => (getStateBeforeOptimisticTransaction),
getSuggestedPostFormat: () => (getSuggestedPostFormat),
getTemplate: () => (getTemplate),
getTemplateLock: () => (getTemplateLock),
hasChangedContent: () => (hasChangedContent),
hasEditorRedo: () => (hasEditorRedo),
hasEditorUndo: () => (hasEditorUndo),
hasInserterItems: () => (hasInserterItems),
hasMultiSelection: () => (hasMultiSelection),
hasNonPostEntityChanges: () => (hasNonPostEntityChanges),
hasSelectedBlock: () => (hasSelectedBlock),
hasSelectedInnerBlock: () => (hasSelectedInnerBlock),
inSomeHistory: () => (inSomeHistory),
isAncestorMultiSelected: () => (isAncestorMultiSelected),
isAutosavingPost: () => (isAutosavingPost),
isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible),
isBlockMultiSelected: () => (isBlockMultiSelected),
isBlockSelected: () => (isBlockSelected),
isBlockValid: () => (isBlockValid),
isBlockWithinSelection: () => (isBlockWithinSelection),
isCaretWithinFormattedText: () => (isCaretWithinFormattedText),
isCleanNewPost: () => (isCleanNewPost),
isCurrentPostPending: () => (isCurrentPostPending),
isCurrentPostPublished: () => (isCurrentPostPublished),
isCurrentPostScheduled: () => (isCurrentPostScheduled),
isDeletingPost: () => (isDeletingPost),
isEditedPostAutosaveable: () => (isEditedPostAutosaveable),
isEditedPostBeingScheduled: () => (isEditedPostBeingScheduled),
isEditedPostDateFloating: () => (isEditedPostDateFloating),
isEditedPostDirty: () => (isEditedPostDirty),
isEditedPostEmpty: () => (isEditedPostEmpty),
isEditedPostNew: () => (isEditedPostNew),
isEditedPostPublishable: () => (isEditedPostPublishable),
isEditedPostSaveable: () => (isEditedPostSaveable),
isEditorPanelEnabled: () => (isEditorPanelEnabled),
isEditorPanelOpened: () => (isEditorPanelOpened),
isEditorPanelRemoved: () => (isEditorPanelRemoved),
isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock),
isInserterOpened: () => (isInserterOpened),
isListViewOpened: () => (isListViewOpened),
isMultiSelecting: () => (isMultiSelecting),
isPermalinkEditable: () => (isPermalinkEditable),
isPostAutosavingLocked: () => (isPostAutosavingLocked),
isPostLockTakeover: () => (isPostLockTakeover),
isPostLocked: () => (isPostLocked),
isPostSavingLocked: () => (isPostSavingLocked),
isPreviewingPost: () => (isPreviewingPost),
isPublishSidebarEnabled: () => (isPublishSidebarEnabled),
isPublishSidebarOpened: () => (isPublishSidebarOpened),
isPublishingPost: () => (isPublishingPost),
isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges),
isSavingPost: () => (isSavingPost),
isSelectionEnabled: () => (isSelectionEnabled),
isTyping: () => (isTyping),
isValidTemplate: () => (isValidTemplate)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
__experimentalTearDownEditor: () => (__experimentalTearDownEditor),
__unstableSaveForPreview: () => (__unstableSaveForPreview),
autosave: () => (autosave),
clearSelectedBlock: () => (clearSelectedBlock),
closePublishSidebar: () => (closePublishSidebar),
createUndoLevel: () => (createUndoLevel),
disablePublishSidebar: () => (disablePublishSidebar),
editPost: () => (editPost),
enablePublishSidebar: () => (enablePublishSidebar),
enterFormattedText: () => (enterFormattedText),
exitFormattedText: () => (exitFormattedText),
hideInsertionPoint: () => (hideInsertionPoint),
insertBlock: () => (insertBlock),
insertBlocks: () => (insertBlocks),
insertDefaultBlock: () => (insertDefaultBlock),
lockPostAutosaving: () => (lockPostAutosaving),
lockPostSaving: () => (lockPostSaving),
mergeBlocks: () => (mergeBlocks),
moveBlockToPosition: () => (moveBlockToPosition),
moveBlocksDown: () => (moveBlocksDown),
moveBlocksUp: () => (moveBlocksUp),
multiSelect: () => (multiSelect),
openPublishSidebar: () => (openPublishSidebar),
receiveBlocks: () => (receiveBlocks),
redo: () => (redo),
refreshPost: () => (refreshPost),
removeBlock: () => (removeBlock),
removeBlocks: () => (removeBlocks),
removeEditorPanel: () => (removeEditorPanel),
replaceBlock: () => (replaceBlock),
replaceBlocks: () => (replaceBlocks),
resetBlocks: () => (resetBlocks),
resetEditorBlocks: () => (resetEditorBlocks),
resetPost: () => (resetPost),
savePost: () => (savePost),
selectBlock: () => (selectBlock),
setDeviceType: () => (setDeviceType),
setEditedPost: () => (setEditedPost),
setIsInserterOpened: () => (setIsInserterOpened),
setIsListViewOpened: () => (setIsListViewOpened),
setRenderingMode: () => (setRenderingMode),
setTemplateValidity: () => (setTemplateValidity),
setupEditor: () => (setupEditor),
setupEditorState: () => (setupEditorState),
showInsertionPoint: () => (showInsertionPoint),
startMultiSelect: () => (startMultiSelect),
startTyping: () => (startTyping),
stopMultiSelect: () => (stopMultiSelect),
stopTyping: () => (stopTyping),
switchEditorMode: () => (switchEditorMode),
synchronizeTemplate: () => (synchronizeTemplate),
toggleBlockMode: () => (toggleBlockMode),
toggleDistractionFree: () => (toggleDistractionFree),
toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled),
toggleEditorPanelOpened: () => (toggleEditorPanelOpened),
togglePublishSidebar: () => (togglePublishSidebar),
toggleSelection: () => (toggleSelection),
trashPost: () => (trashPost),
undo: () => (undo),
unlockPostAutosaving: () => (unlockPostAutosaving),
unlockPostSaving: () => (unlockPostSaving),
updateBlock: () => (updateBlock),
updateBlockAttributes: () => (updateBlockAttributes),
updateBlockListSettings: () => (updateBlockListSettings),
updateEditorSettings: () => (updateEditorSettings),
updatePost: () => (updatePost),
updatePostLock: () => (updatePostLock)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js
var store_private_actions_namespaceObject = {};
__webpack_require__.r(store_private_actions_namespaceObject);
__webpack_require__.d(store_private_actions_namespaceObject, {
createTemplate: () => (createTemplate),
hideBlockTypes: () => (hideBlockTypes),
registerEntityAction: () => (registerEntityAction),
registerPostTypeActions: () => (registerPostTypeActions),
removeTemplates: () => (removeTemplates),
revertTemplate: () => (revertTemplate),
saveDirtyEntities: () => (saveDirtyEntities),
setCurrentTemplateId: () => (setCurrentTemplateId),
setIsReady: () => (setIsReady),
showBlockTypes: () => (showBlockTypes),
unregisterEntityAction: () => (unregisterEntityAction)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js
var store_private_selectors_namespaceObject = {};
__webpack_require__.r(store_private_selectors_namespaceObject);
__webpack_require__.d(store_private_selectors_namespaceObject, {
getEntityActions: () => (private_selectors_getEntityActions),
getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef),
getInsertionPoint: () => (getInsertionPoint),
getListViewToggleRef: () => (getListViewToggleRef),
getPostBlocksByName: () => (getPostBlocksByName),
getPostIcon: () => (getPostIcon),
hasPostMetaChanges: () => (hasPostMetaChanges),
isEntityReady: () => (private_selectors_isEntityReady)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
var store_actions_namespaceObject = {};
__webpack_require__.r(store_actions_namespaceObject);
__webpack_require__.d(store_actions_namespaceObject, {
closeModal: () => (closeModal),
disableComplementaryArea: () => (disableComplementaryArea),
enableComplementaryArea: () => (enableComplementaryArea),
openModal: () => (openModal),
pinItem: () => (pinItem),
setDefaultComplementaryArea: () => (setDefaultComplementaryArea),
setFeatureDefaults: () => (setFeatureDefaults),
setFeatureValue: () => (setFeatureValue),
toggleFeature: () => (toggleFeature),
unpinItem: () => (unpinItem)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
var store_selectors_namespaceObject = {};
__webpack_require__.r(store_selectors_namespaceObject);
__webpack_require__.d(store_selectors_namespaceObject, {
getActiveComplementaryArea: () => (getActiveComplementaryArea),
isComplementaryAreaLoading: () => (isComplementaryAreaLoading),
isFeatureActive: () => (isFeatureActive),
isItemPinned: () => (isItemPinned),
isModalActive: () => (isModalActive)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js
var build_module_namespaceObject = {};
__webpack_require__.r(build_module_namespaceObject);
__webpack_require__.d(build_module_namespaceObject, {
ActionItem: () => (action_item),
ComplementaryArea: () => (complementary_area),
ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem),
FullscreenMode: () => (fullscreen_mode),
InterfaceSkeleton: () => (interface_skeleton),
NavigableRegion: () => (navigable_region),
PinnedItems: () => (pinned_items),
store: () => (store)
});
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: external ["wp","blockEditor"]
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
/**
* WordPress dependencies
*/
/**
* The default post editor settings.
*
* @property {boolean|Array} allowedBlockTypes Allowed block types
* @property {boolean} richEditingEnabled Whether rich editing is enabled or not
* @property {boolean} codeEditingEnabled Whether code editing is enabled or not
* @property {boolean} fontLibraryEnabled Whether the font library is enabled or not.
* @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.
* true = the user has opted to show the Custom Fields panel at the bottom of the editor.
* false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
* undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.
* @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.
* @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.
* @property {Array?} availableTemplates The available post templates
* @property {boolean} disablePostFormats Whether or not the post formats are disabled
* @property {Array?} allowedMimeTypes List of allowed mime types and file extensions
* @property {number} maxUploadFileSize Maximum upload file size
* @property {boolean} supportsLayout Whether the editor supports layouts.
*/
const EDITOR_SETTINGS_DEFAULTS = {
...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS,
richEditingEnabled: true,
codeEditingEnabled: true,
fontLibraryEnabled: true,
enableCustomFields: undefined,
defaultRenderingMode: 'post-only'
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/store/reducer.js
/**
* WordPress dependencies
*/
function isReady(state = {}, action) {
switch (action.type) {
case 'SET_IS_READY':
return {
...state,
[action.kind]: {
...state[action.kind],
[action.name]: true
}
};
}
return state;
}
function actions(state = {}, action) {
var _state$action$kind$ac;
switch (action.type) {
case 'REGISTER_ENTITY_ACTION':
return {
...state,
[action.kind]: {
...state[action.kind],
[action.name]: [...((_state$action$kind$ac = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac !== void 0 ? _state$action$kind$ac : []).filter(_action => _action.id !== action.config.id), action.config]
}
};
case 'UNREGISTER_ENTITY_ACTION':
{
var _state$action$kind$ac2;
return {
...state,
[action.kind]: {
...state[action.kind],
[action.name]: ((_state$action$kind$ac2 = state[action.kind]?.[action.name]) !== null && _state$action$kind$ac2 !== void 0 ? _state$action$kind$ac2 : []).filter(_action => _action.id !== action.actionId)
}
};
}
}
return state;
}
/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
actions,
isReady
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns a post attribute value, flattening nested rendered content using its
* raw value in place of its original object form.
*
* @param {*} value Original value.
*
* @return {*} Raw value.
*/
function getPostRawValue(value) {
if (value && 'object' === typeof value && 'raw' in value) {
return value.raw;
}
return value;
}
/**
* Returns true if the two object arguments have the same keys, or false
* otherwise.
*
* @param {Object} a First object.
* @param {Object} b Second object.
*
* @return {boolean} Whether the two objects have the same keys.
*/
function hasSameKeys(a, b) {
const keysA = Object.keys(a).sort();
const keysB = Object.keys(b).sort();
return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key);
}
/**
* Returns true if, given the currently dispatching action and the previously
* dispatched action, the two actions are editing the same post property, or
* false otherwise.
*
* @param {Object} action Currently dispatching action.
* @param {Object} previousAction Previously dispatched action.
*
* @return {boolean} Whether actions are updating the same post property.
*/
function isUpdatingSamePostProperty(action, previousAction) {
return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
}
/**
* Returns true if, given the currently dispatching action and the previously
* dispatched action, the two actions are modifying the same property such that
* undo history should be batched.
*
* @param {Object} action Currently dispatching action.
* @param {Object} previousAction Previously dispatched action.
*
* @return {boolean} Whether to overwrite present state.
*/
function shouldOverwriteState(action, previousAction) {
if (action.type === 'RESET_EDITOR_BLOCKS') {
return !action.shouldCreateUndoLevel;
}
if (!previousAction || action.type !== previousAction.type) {
return false;
}
return isUpdatingSamePostProperty(action, previousAction);
}
function postId(state = null, action) {
switch (action.type) {
case 'SET_EDITED_POST':
return action.postId;
}
return state;
}
function templateId(state = null, action) {
switch (action.type) {
case 'SET_CURRENT_TEMPLATE_ID':
return action.id;
}
return state;
}
function postType(state = null, action) {
switch (action.type) {
case 'SET_EDITED_POST':
return action.postType;
}
return state;
}
/**
* Reducer returning whether the post blocks match the defined template or not.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function template(state = {
isValid: true
}, action) {
switch (action.type) {
case 'SET_TEMPLATE_VALIDITY':
return {
...state,
isValid: action.isValid
};
}
return state;
}
/**
* Reducer returning current network request state (whether a request to
* the WP REST API is in progress, successful, or failed).
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function saving(state = {}, action) {
switch (action.type) {
case 'REQUEST_POST_UPDATE_START':
case 'REQUEST_POST_UPDATE_FINISH':
return {
pending: action.type === 'REQUEST_POST_UPDATE_START',
options: action.options || {}
};
}
return state;
}
/**
* Reducer returning deleting post request state.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function deleting(state = {}, action) {
switch (action.type) {
case 'REQUEST_POST_DELETE_START':
case 'REQUEST_POST_DELETE_FINISH':
return {
pending: action.type === 'REQUEST_POST_DELETE_START'
};
}
return state;
}
/**
* Post Lock State.
*
* @typedef {Object} PostLockState
*
* @property {boolean} isLocked Whether the post is locked.
* @property {?boolean} isTakeover Whether the post editing has been taken over.
* @property {?boolean} activePostLock Active post lock value.
* @property {?Object} user User that took over the post.
*/
/**
* Reducer returning the post lock status.
*
* @param {PostLockState} state Current state.
* @param {Object} action Dispatched action.
*
* @return {PostLockState} Updated state.
*/
function postLock(state = {
isLocked: false
}, action) {
switch (action.type) {
case 'UPDATE_POST_LOCK':
return action.lock;
}
return state;
}
/**
* Post saving lock.
*
* When post saving is locked, the post cannot be published or updated.
*
* @param {PostLockState} state Current state.
* @param {Object} action Dispatched action.
*
* @return {PostLockState} Updated state.
*/
function postSavingLock(state = {}, action) {
switch (action.type) {
case 'LOCK_POST_SAVING':
return {
...state,
[action.lockName]: true
};
case 'UNLOCK_POST_SAVING':
{
const {
[action.lockName]: removedLockName,
...restState
} = state;
return restState;
}
}
return state;
}
/**
* Post autosaving lock.
*
* When post autosaving is locked, the post will not autosave.
*
* @param {PostLockState} state Current state.
* @param {Object} action Dispatched action.
*
* @return {PostLockState} Updated state.
*/
function postAutosavingLock(state = {}, action) {
switch (action.type) {
case 'LOCK_POST_AUTOSAVING':
return {
...state,
[action.lockName]: true
};
case 'UNLOCK_POST_AUTOSAVING':
{
const {
[action.lockName]: removedLockName,
...restState
} = state;
return restState;
}
}
return state;
}
/**
* Reducer returning the post editor setting.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
switch (action.type) {
case 'UPDATE_EDITOR_SETTINGS':
return {
...state,
...action.settings
};
}
return state;
}
function renderingMode(state = 'post-only', action) {
switch (action.type) {
case 'SET_RENDERING_MODE':
return action.mode;
}
return state;
}
/**
* Reducer returning the editing canvas device type.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function deviceType(state = 'Desktop', action) {
switch (action.type) {
case 'SET_DEVICE_TYPE':
return action.deviceType;
}
return state;
}
/**
* Reducer storing the list of all programmatically removed panels.
*
* @param {Array} state Current state.
* @param {Object} action Action object.
*
* @return {Array} Updated state.
*/
function removedPanels(state = [], action) {
switch (action.type) {
case 'REMOVE_PANEL':
if (!state.includes(action.panelName)) {
return [...state, action.panelName];
}
}
return state;
}
/**
* Reducer to set the block inserter panel open or closed.
*
* Note: this reducer interacts with the list view panel reducer
* to make sure that only one of the two panels is open at the same time.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*/
function blockInserterPanel(state = false, action) {
switch (action.type) {
case 'SET_IS_LIST_VIEW_OPENED':
return action.isOpen ? false : state;
case 'SET_IS_INSERTER_OPENED':
return action.value;
}
return state;
}
/**
* Reducer to set the list view panel open or closed.
*
* Note: this reducer interacts with the inserter panel reducer
* to make sure that only one of the two panels is open at the same time.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*/
function listViewPanel(state = false, action) {
switch (action.type) {
case 'SET_IS_INSERTER_OPENED':
return action.value ? false : state;
case 'SET_IS_LIST_VIEW_OPENED':
return action.isOpen;
}
return state;
}
/**
* This reducer does nothing aside initializing a ref to the list view toggle.
* We will have a unique ref per "editor" instance.
*
* @param {Object} state
* @return {Object} Reference to the list view toggle button.
*/
function listViewToggleRef(state = {
current: null
}) {
return state;
}
/**
* This reducer does nothing aside initializing a ref to the inserter sidebar toggle.
* We will have a unique ref per "editor" instance.
*
* @param {Object} state
* @return {Object} Reference to the inserter sidebar toggle button.
*/
function inserterSidebarToggleRef(state = {
current: null
}) {
return state;
}
function publishSidebarActive(state = false, action) {
switch (action.type) {
case 'OPEN_PUBLISH_SIDEBAR':
return true;
case 'CLOSE_PUBLISH_SIDEBAR':
return false;
case 'TOGGLE_PUBLISH_SIDEBAR':
return !state;
}
return state;
}
/* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
postId,
postType,
templateId,
saving,
deleting,
postLock,
template,
postSavingLock,
editorSettings,
postAutosavingLock,
renderingMode,
deviceType,
removedPanels,
blockInserterPanel,
inserterSidebarToggleRef,
listViewPanel,
listViewToggleRef,
publishSidebarActive,
dataviews: reducer
}));
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// CONCATENATED MODULE: external ["wp","date"]
const external_wp_date_namespaceObject = window["wp"]["date"];
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: external ["wp","deprecated"]
const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
;// CONCATENATED MODULE: external "ReactJSXRuntime"
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
/**
* WordPress dependencies
*/
const layout = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
})
});
/* harmony default export */ const library_layout = (layout);
;// CONCATENATED MODULE: external ["wp","preferences"]
const external_wp_preferences_namespaceObject = window["wp"]["preferences"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js
/**
* Set of post properties for which edits should assume a merging behavior,
* assuming an object value.
*
* @type {Set}
*/
const EDIT_MERGE_PROPERTIES = new Set(['meta']);
/**
* Constant for the store module (or reducer) key.
*
* @type {string}
*/
const STORE_NAME = 'core/editor';
const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
const ONE_MINUTE_IN_MS = 60 * 1000;
const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';
const TEMPLATE_POST_TYPE = 'wp_template';
const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
const PATTERN_POST_TYPE = 'wp_block';
const NAVIGATION_POST_TYPE = 'wp_navigation';
const TEMPLATE_ORIGINS = {
custom: 'custom',
theme: 'theme',
plugin: 'plugin'
};
const TEMPLATE_POST_TYPES = ['wp_template', 'wp_template_part'];
const GLOBAL_POST_TYPES = [...TEMPLATE_POST_TYPES, 'wp_block', 'wp_navigation'];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
/**
* WordPress dependencies
*/
const header = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
})
});
/* harmony default export */ const library_header = (header);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
/**
* WordPress dependencies
*/
const footer = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
})
});
/* harmony default export */ const library_footer = (footer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
/**
* WordPress dependencies
*/
const sidebar = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
})
});
/* harmony default export */ const library_sidebar = (sidebar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
/**
* WordPress dependencies
*/
const symbolFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
})
});
/* harmony default export */ const symbol_filled = (symbolFilled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js
/**
* WordPress dependencies
*/
/**
* Helper function to retrieve the corresponding icon by name.
*
* @param {string} iconName The name of the icon.
*
* @return {Object} The corresponding icon.
*/
function getTemplatePartIcon(iconName) {
if ('header' === iconName) {
return library_header;
} else if ('footer' === iconName) {
return library_footer;
} else if ('sidebar' === iconName) {
return library_sidebar;
}
return symbol_filled;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Shared reference to an empty object for cases where it is important to avoid
* returning a new object reference on every invocation, as in a connected or
* other pure component which performs `shouldComponentUpdate` check on props.
* This should be used as a last resort, since the normalized data should be
* maintained by the reducer result in state.
*/
const EMPTY_OBJECT = {};
/**
* Returns true if any past editor history snapshots exist, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether undo history exists.
*/
const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
return select(external_wp_coreData_namespaceObject.store).hasUndo();
});
/**
* Returns true if any future editor history snapshots exist, or false
* otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether redo history exists.
*/
const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
return select(external_wp_coreData_namespaceObject.store).hasRedo();
});
/**
* Returns true if the currently edited post is yet to be saved, or false if
* the post has been saved.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post is new.
*/
function isEditedPostNew(state) {
return getCurrentPost(state).status === 'auto-draft';
}
/**
* Returns true if content includes unsaved changes, or false otherwise.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether content includes unsaved changes.
*/
function hasChangedContent(state) {
const edits = getPostEdits(state);
return 'content' in edits;
}
/**
* Returns true if there are unsaved values for the current edit session, or
* false if the editing state matches the saved or new post.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether unsaved values exist.
*/
const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
// Edits should contain only fields which differ from the saved post (reset
// at initial load and save complete). Thus, a non-empty edits state can be
// inferred to contain unsaved values.
const postType = getCurrentPostType(state);
const postId = getCurrentPostId(state);
return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId);
});
/**
* Returns true if there are unsaved edits for entities other than
* the editor's post, and false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether there are edits or not.
*/
const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords();
const {
type,
id
} = getCurrentPost(state);
return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
});
/**
* Returns true if there are no unsaved values for the current edit session and
* if the currently edited post is new (has never been saved before).
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether new post and unsaved values exist.
*/
function isCleanNewPost(state) {
return !isEditedPostDirty(state) && isEditedPostNew(state);
}
/**
* Returns the post currently being edited in its last known saved state, not
* including unsaved edits. Returns an object containing relevant default post
* values if the post has not yet been saved.
*
* @param {Object} state Global application state.
*
* @return {Object} Post object.
*/
const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const postId = getCurrentPostId(state);
const postType = getCurrentPostType(state);
const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId);
if (post) {
return post;
}
// This exists for compatibility with the previous selector behavior
// which would guarantee an object return based on the editor reducer's
// default empty object state.
return EMPTY_OBJECT;
});
/**
* Returns the post type of the post currently being edited.
*
* @param {Object} state Global application state.
*
* @return {string} Post type.
*/
function getCurrentPostType(state) {
return state.postType;
}
/**
* Returns the ID of the post currently being edited, or null if the post has
* not yet been saved.
*
* @param {Object} state Global application state.
*
* @return {?number} ID of current post.
*/
function getCurrentPostId(state) {
return state.postId;
}
/**
* Returns the template ID currently being rendered/edited
*
* @param {Object} state Global application state.
*
* @return {string?} Template ID.
*/
function getCurrentTemplateId(state) {
return state.templateId;
}
/**
* Returns the number of revisions of the post currently being edited.
*
* @param {Object} state Global application state.
*
* @return {number} Number of revisions.
*/
function getCurrentPostRevisionsCount(state) {
var _getCurrentPost$_link;
return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0;
}
/**
* Returns the last revision ID of the post currently being edited,
* or null if the post has no revisions.
*
* @param {Object} state Global application state.
*
* @return {?number} ID of the last revision.
*/
function getCurrentPostLastRevisionId(state) {
var _getCurrentPost$_link2;
return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null;
}
/**
* Returns any post values which have been changed in the editor but not yet
* been saved.
*
* @param {Object} state Global application state.
*
* @return {Object} Object of key value pairs comprising unsaved edits.
*/
const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const postType = getCurrentPostType(state);
const postId = getCurrentPostId(state);
return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
});
/**
* Returns an attribute value of the saved post.
*
* @param {Object} state Global application state.
* @param {string} attributeName Post attribute name.
*
* @return {*} Post attribute value.
*/
function getCurrentPostAttribute(state, attributeName) {
switch (attributeName) {
case 'type':
return getCurrentPostType(state);
case 'id':
return getCurrentPostId(state);
default:
const post = getCurrentPost(state);
if (!post.hasOwnProperty(attributeName)) {
break;
}
return getPostRawValue(post[attributeName]);
}
}
/**
* Returns a single attribute of the post being edited, preferring the unsaved
* edit if one exists, but merging with the attribute value for the last known
* saved state of the post (this is needed for some nested attributes like meta).
*
* @param {Object} state Global application state.
* @param {string} attributeName Post attribute name.
*
* @return {*} Post attribute value.
*/
const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)((state, attributeName) => {
const edits = getPostEdits(state);
if (!edits.hasOwnProperty(attributeName)) {
return getCurrentPostAttribute(state, attributeName);
}
return {
...getCurrentPostAttribute(state, attributeName),
...edits[attributeName]
};
}, (state, attributeName) => [getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName]]);
/**
* Returns a single attribute of the post being edited, preferring the unsaved
* edit if one exists, but falling back to the attribute for the last known
* saved state of the post.
*
* @param {Object} state Global application state.
* @param {string} attributeName Post attribute name.
*
* @return {*} Post attribute value.
*/
function getEditedPostAttribute(state, attributeName) {
// Special cases.
switch (attributeName) {
case 'content':
return getEditedPostContent(state);
}
// Fall back to saved post value if not edited.
const edits = getPostEdits(state);
if (!edits.hasOwnProperty(attributeName)) {
return getCurrentPostAttribute(state, attributeName);
}
// Merge properties are objects which contain only the patch edit in state,
// and thus must be merged with the current post attribute.
if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
return getNestedEditedPostProperty(state, attributeName);
}
return edits[attributeName];
}
/**
* Returns an attribute value of the current autosave revision for a post, or
* null if there is no autosave for the post.
*
* @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
* from the '@wordpress/core-data' package and access properties on the returned
* autosave object using getPostRawValue.
*
* @param {Object} state Global application state.
* @param {string} attributeName Autosave attribute name.
*
* @return {*} Autosave attribute value.
*/
const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => {
if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') {
return;
}
const postType = getCurrentPostType(state);
// Currently template autosaving is not supported.
if (postType === 'wp_template') {
return false;
}
const postId = getCurrentPostId(state);
const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id;
const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId);
if (autosave) {
return getPostRawValue(autosave[attributeName]);
}
});
/**
* Returns the current visibility of the post being edited, preferring the
* unsaved value if different than the saved post. The return value is one of
* "private", "password", or "public".
*
* @param {Object} state Global application state.
*
* @return {string} Post visibility.
*/
function getEditedPostVisibility(state) {
const status = getEditedPostAttribute(state, 'status');
if (status === 'private') {
return 'private';
}
const password = getEditedPostAttribute(state, 'password');
if (password) {
return 'password';
}
return 'public';
}
/**
* Returns true if post is pending review.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether current post is pending review.
*/
function isCurrentPostPending(state) {
return getCurrentPost(state).status === 'pending';
}
/**
* Return true if the current post has already been published.
*
* @param {Object} state Global application state.
* @param {Object?} currentPost Explicit current post for bypassing registry selector.
*
* @return {boolean} Whether the post has been published.
*/
function isCurrentPostPublished(state, currentPost) {
const post = currentPost || getCurrentPost(state);
return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS));
}
/**
* Returns true if post is already scheduled.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether current post is scheduled to be posted.
*/
function isCurrentPostScheduled(state) {
return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state);
}
/**
* Return true if the post being edited can be published.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post can been published.
*/
function isEditedPostPublishable(state) {
const post = getCurrentPost(state);
// TODO: Post being publishable should be superset of condition of post
// being saveable. Currently this restriction is imposed at UI.
//
// See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`).
return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
}
/**
* Returns true if the post can be saved, or false otherwise. A post must
* contain a title, an excerpt, or non-empty content to be valid for save.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post can be saved.
*/
function isEditedPostSaveable(state) {
if (isSavingPost(state)) {
return false;
}
// TODO: Post should not be saveable if not dirty. Cannot be added here at
// this time since posts where meta boxes are present can be saved even if
// the post is not dirty. Currently this restriction is imposed at UI, but
// should be moved here.
//
// See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
// See: <PostSavedState /> (`forceIsDirty` prop)
// See: <PostPublishButton /> (`forceIsDirty` prop)
// See: https://github.com/WordPress/gutenberg/pull/4184.
return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native';
}
/**
* Returns true if the edited post has content. A post has content if it has at
* least one saveable block or otherwise has a non-empty content property
* assigned.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether post has content.
*/
const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
// While the condition of truthy content string is sufficient to determine
// emptiness, testing saveable blocks length is a trivial operation. Since
// this function can be called frequently, optimize for the fast case as a
// condition of the mere existence of blocks. Note that the value of edited
// content takes precedent over block content, and must fall through to the
// default logic.
const postId = getCurrentPostId(state);
const postType = getCurrentPostType(state);
const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
if (typeof record.content !== 'function') {
return !record.content;
}
const blocks = getEditedPostAttribute(state, 'blocks');
if (blocks.length === 0) {
return true;
}
// Pierce the abstraction of the serializer in knowing that blocks are
// joined with newlines such that even if every individual block
// produces an empty save result, the serialized content is non-empty.
if (blocks.length > 1) {
return false;
}
// There are two conditions under which the optimization cannot be
// assumed, and a fallthrough to getEditedPostContent must occur:
//
// 1. getBlocksForSerialization has special treatment in omitting a
// single unmodified default block.
// 2. Comment delimiters are omitted for a freeform or unregistered
// block in its serialization. The freeform block specifically may
// produce an empty string in its saved output.
//
// For all other content, the single block is assumed to make a post
// non-empty, if only by virtue of its own comment delimiters.
const blockName = blocks[0].name;
if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) {
return false;
}
return !getEditedPostContent(state);
});
/**
* Returns true if the post can be autosaved, or false otherwise.
*
* @param {Object} state Global application state.
* @param {Object} autosave A raw autosave object from the REST API.
*
* @return {boolean} Whether the post can be autosaved.
*/
const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
// A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
if (!isEditedPostSaveable(state)) {
return false;
}
// A post is not autosavable when there is a post autosave lock.
if (isPostAutosavingLocked(state)) {
return false;
}
const postType = getCurrentPostType(state);
// Currently template autosaving is not supported.
if (postType === 'wp_template') {
return false;
}
const postId = getCurrentPostId(state);
const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId);
const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id;
// Disable reason - this line causes the side-effect of fetching the autosave
// via a resolver, moving below the return would result in the autosave never
// being fetched.
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId);
// If any existing autosaves have not yet been fetched, this function is
// unable to determine if the post is autosaveable, so return false.
if (!hasFetchedAutosave) {
return false;
}
// If we don't already have an autosave, the post is autosaveable.
if (!autosave) {
return true;
}
// To avoid an expensive content serialization, use the content dirtiness
// flag in place of content field comparison against the known autosave.
// This is not strictly accurate, and relies on a tolerance toward autosave
// request failures for unnecessary saves.
if (hasChangedContent(state)) {
return true;
}
// If title, excerpt, or meta have changed, the post is autosaveable.
return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field));
});
/**
* Return true if the post being edited is being scheduled. Preferring the
* unsaved status values.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post has been published.
*/
function isEditedPostBeingScheduled(state) {
const date = getEditedPostAttribute(state, 'date');
// Offset the date by one minute (network latency).
const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS);
return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate);
}
/**
* Returns whether the current post should be considered to have a "floating"
* date (i.e. that it would publish "Immediately" rather than at a set time).
*
* Unlike in the PHP backend, the REST API returns a full date string for posts
* where the 0000-00-00T00:00:00 placeholder is present in the database. To
* infer that a post is set to publish "Immediately" we check whether the date
* and modified date are the same.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether the edited post has a floating date value.
*/
function isEditedPostDateFloating(state) {
const date = getEditedPostAttribute(state, 'date');
const modified = getEditedPostAttribute(state, 'modified');
// This should be the status of the persisted post
// It shouldn't use the "edited" status otherwise it breaks the
// inferred post data floating status
// See https://github.com/WordPress/gutenberg/issues/28083.
const status = getCurrentPost(state).status;
if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
return date === modified || date === null;
}
return false;
}
/**
* Returns true if the post is currently being deleted, or false otherwise.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether post is being deleted.
*/
function isDeletingPost(state) {
return !!state.deleting.pending;
}
/**
* Returns true if the post is currently being saved, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether post is being saved.
*/
function isSavingPost(state) {
return !!state.saving.pending;
}
/**
* Returns true if non-post entities are currently being saved, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether non-post entities are being saved.
*/
const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved();
const {
type,
id
} = getCurrentPost(state);
return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
});
/**
* Returns true if a previous post save was attempted successfully, or false
* otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post was saved successfully.
*/
const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const postType = getCurrentPostType(state);
const postId = getCurrentPostId(state);
return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
});
/**
* Returns true if a previous post save was attempted but failed, or false
* otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post save failed.
*/
const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const postType = getCurrentPostType(state);
const postId = getCurrentPostId(state);
return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
});
/**
* Returns true if the post is autosaving, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post is autosaving.
*/
function isAutosavingPost(state) {
return isSavingPost(state) && Boolean(state.saving.options?.isAutosave);
}
/**
* Returns true if the post is being previewed, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the post is being previewed.
*/
function isPreviewingPost(state) {
return isSavingPost(state) && Boolean(state.saving.options?.isPreview);
}
/**
* Returns the post preview link
*
* @param {Object} state Global application state.
*
* @return {string | undefined} Preview Link.
*/
function getEditedPostPreviewLink(state) {
if (state.saving.pending || isSavingPost(state)) {
return;
}
let previewLink = getAutosaveAttribute(state, 'preview_link');
// Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
// If the post is draft, ignore the preview link from the autosave record,
// because the preview could be a stale autosave if the post was switched from
// published to draft.
// See: https://github.com/WordPress/gutenberg/pull/37952.
if (!previewLink || 'draft' === getCurrentPost(state).status) {
previewLink = getEditedPostAttribute(state, 'link');
if (previewLink) {
previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
preview: true
});
}
}
const featuredImageId = getEditedPostAttribute(state, 'featured_media');
if (previewLink && featuredImageId) {
return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
_thumbnail_id: featuredImageId
});
}
return previewLink;
}
/**
* Returns a suggested post format for the current post, inferred only if there
* is a single block within the post and it is of a type known to match a
* default post format. Returns null if the format cannot be determined.
*
* @return {?string} Suggested post format.
*/
const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
if (blocks.length > 2) {
return null;
}
let name;
// If there is only one block in the content of the post grab its name
// so we can derive a suitable post format from it.
if (blocks.length === 1) {
name = blocks[0].name;
// Check for core/embed `video` and `audio` eligible suggestions.
if (name === 'core/embed') {
const provider = blocks[0].attributes?.providerNameSlug;
if (['youtube', 'vimeo'].includes(provider)) {
name = 'core/video';
} else if (['spotify', 'soundcloud'].includes(provider)) {
name = 'core/audio';
}
}
}
// If there are two blocks in the content and the last one is a text blocks
// grab the name of the first one to also suggest a post format from it.
if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
name = blocks[0].name;
}
// We only convert to default post formats in core.
switch (name) {
case 'core/image':
return 'image';
case 'core/quote':
case 'core/pullquote':
return 'quote';
case 'core/gallery':
return 'gallery';
case 'core/video':
return 'video';
case 'core/audio':
return 'audio';
default:
return null;
}
});
/**
* Returns the content of the post being edited.
*
* @param {Object} state Global application state.
*
* @return {string} Post content.
*/
const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const postId = getCurrentPostId(state);
const postType = getCurrentPostType(state);
const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
if (record) {
if (typeof record.content === 'function') {
return record.content(record);
} else if (record.blocks) {
return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
} else if (record.content) {
return record.content;
}
}
return '';
});
/**
* Returns true if the post is being published, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether post is being published.
*/
function isPublishingPost(state) {
return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish';
}
/**
* Returns whether the permalink is editable or not.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether or not the permalink is editable.
*/
function isPermalinkEditable(state) {
const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
}
/**
* Returns the permalink for the post.
*
* @param {Object} state Editor state.
*
* @return {?string} The permalink, or null if the post is not viewable.
*/
function getPermalink(state) {
const permalinkParts = getPermalinkParts(state);
if (!permalinkParts) {
return null;
}
const {
prefix,
postName,
suffix
} = permalinkParts;
if (isPermalinkEditable(state)) {
return prefix + postName + suffix;
}
return prefix;
}
/**
* Returns the slug for the post being edited, preferring a manually edited
* value if one exists, then a sanitized version of the current post title, and
* finally the post ID.
*
* @param {Object} state Editor state.
*
* @return {string} The current slug to be displayed in the editor
*/
function getEditedPostSlug(state) {
return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state);
}
/**
* Returns the permalink for a post, split into its three parts: the prefix,
* the postName, and the suffix.
*
* @param {Object} state Editor state.
*
* @return {Object} An object containing the prefix, postName, and suffix for
* the permalink, or null if the post is not viewable.
*/
function getPermalinkParts(state) {
const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
if (!permalinkTemplate) {
return null;
}
const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug');
const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
return {
prefix,
postName,
suffix
};
}
/**
* Returns whether the post is locked.
*
* @param {Object} state Global application state.
*
* @return {boolean} Is locked.
*/
function isPostLocked(state) {
return state.postLock.isLocked;
}
/**
* Returns whether post saving is locked.
*
* @param {Object} state Global application state.
*
* @return {boolean} Is locked.
*/
function isPostSavingLocked(state) {
return Object.keys(state.postSavingLock).length > 0;
}
/**
* Returns whether post autosaving is locked.
*
* @param {Object} state Global application state.
*
* @return {boolean} Is locked.
*/
function isPostAutosavingLocked(state) {
return Object.keys(state.postAutosavingLock).length > 0;
}
/**
* Returns whether the edition of the post has been taken over.
*
* @param {Object} state Global application state.
*
* @return {boolean} Is post lock takeover.
*/
function isPostLockTakeover(state) {
return state.postLock.isTakeover;
}
/**
* Returns details about the post lock user.
*
* @param {Object} state Global application state.
*
* @return {Object} A user object.
*/
function getPostLockUser(state) {
return state.postLock.user;
}
/**
* Returns the active post lock.
*
* @param {Object} state Global application state.
*
* @return {Object} The lock object.
*/
function getActivePostLock(state) {
return state.postLock.activePostLock;
}
/**
* Returns whether or not the user has the unfiltered_html capability.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether the user can or can't post unfiltered HTML.
*/
function canUserUseUnfilteredHTML(state) {
return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html'));
}
/**
* Returns whether the pre-publish panel should be shown
* or skipped when the user clicks the "publish" button.
*
* @return {boolean} Whether the pre-publish panel should be shown or not.
*/
const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core', 'isPublishSidebarEnabled'));
/**
* Return the current block list.
*
* @param {Object} state
* @return {Array} Block list.
*/
const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)(state => {
return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state));
}, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]);
/**
* Returns true if the given panel was programmatically removed, or false otherwise.
* All panels are not removed by default.
*
* @param {Object} state Global application state.
* @param {string} panelName A string that identifies the panel.
*
* @return {boolean} Whether or not the panel is removed.
*/
function isEditorPanelRemoved(state, panelName) {
return state.removedPanels.includes(panelName);
}
/**
* Returns true if the given panel is enabled, or false otherwise. Panels are
* enabled by default.
*
* @param {Object} state Global application state.
* @param {string} panelName A string that identifies the panel.
*
* @return {boolean} Whether or not the panel is enabled.
*/
const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => {
// For backward compatibility, we check edit-post
// even though now this is in "editor" package.
const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels');
return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName);
});
/**
* Returns true if the given panel is open, or false otherwise. Panels are
* closed by default.
*
* @param {Object} state Global application state.
* @param {string} panelName A string that identifies the panel.
*
* @return {boolean} Whether or not the panel is open.
*/
const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => {
// For backward compatibility, we check edit-post
// even though now this is in "editor" package.
const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels');
return !!openPanels?.includes(panelName);
});
/**
* A block selection object.
*
* @typedef {Object} WPBlockSelection
*
* @property {string} clientId A block client ID.
* @property {string} attributeKey A block attribute key.
* @property {number} offset An attribute value offset, based on the rich
* text value. See `wp.richText.create`.
*/
/**
* Returns the current selection start.
*
* @param {Object} state
* @return {WPBlockSelection} The selection start.
*
* @deprecated since Gutenberg 10.0.0.
*/
function getEditorSelectionStart(state) {
external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
since: '5.8',
alternative: "select('core/editor').getEditorSelection"
});
return getEditedPostAttribute(state, 'selection')?.selectionStart;
}
/**
* Returns the current selection end.
*
* @param {Object} state
* @return {WPBlockSelection} The selection end.
*
* @deprecated since Gutenberg 10.0.0.
*/
function getEditorSelectionEnd(state) {
external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
since: '5.8',
alternative: "select('core/editor').getEditorSelection"
});
return getEditedPostAttribute(state, 'selection')?.selectionEnd;
}
/**
* Returns the current selection.
*
* @param {Object} state
* @return {WPBlockSelection} The selection end.
*/
function getEditorSelection(state) {
return getEditedPostAttribute(state, 'selection');
}
/**
* Is the editor ready
*
* @param {Object} state
* @return {boolean} is Ready.
*/
function __unstableIsEditorReady(state) {
return !!state.postId;
}
/**
* Returns the post editor settings.
*
* @param {Object} state Editor state.
*
* @return {Object} The editor settings object.
*/
function getEditorSettings(state) {
return state.editorSettings;
}
/**
* Returns the post editor's rendering mode.
*
* @param {Object} state Editor state.
*
* @return {string} Rendering mode.
*/
function getRenderingMode(state) {
return state.renderingMode;
}
/**
* Returns the current editing canvas device type.
*
* @param {Object} state Global application state.
*
* @return {string} Device type.
*/
const getDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const editorMode = select(external_wp_blockEditor_namespaceObject.store).__unstableGetEditorMode();
if (editorMode === 'zoom-out') {
return 'Desktop';
}
return state.deviceType;
});
/**
* Returns true if the list view is opened.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the list view is opened.
*/
function isListViewOpened(state) {
return state.listViewPanel;
}
/**
* Returns true if the inserter is opened.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the inserter is opened.
*/
function isInserterOpened(state) {
return !!state.blockInserterPanel;
}
/**
* Returns the current editing mode.
*
* @param {Object} state Global application state.
*
* @return {string} Editing mode.
*/
const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
var _select$get;
return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
});
/*
* Backward compatibility
*/
/**
* Returns state object prior to a specified optimist transaction ID, or `null`
* if the transaction corresponding to the given ID cannot be found.
*
* @deprecated since Gutenberg 9.7.0.
*/
function getStateBeforeOptimisticTransaction() {
external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", {
since: '5.7',
hint: 'No state history is kept on this store anymore'
});
return null;
}
/**
* Returns true if an optimistic transaction is pending commit, for which the
* before state satisfies the given predicate function.
*
* @deprecated since Gutenberg 9.7.0.
*/
function inSomeHistory() {
external_wp_deprecated_default()("select('core/editor').inSomeHistory", {
since: '5.7',
hint: 'No state history is kept on this store anymore'
});
return false;
}
function getBlockEditorSelector(name) {
return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ...args) => {
external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', {
since: '5.3',
alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
version: '6.2'
});
return select(external_wp_blockEditor_namespaceObject.store)[name](...args);
});
}
/**
* @see getBlockName in core/block-editor store.
*/
const getBlockName = getBlockEditorSelector('getBlockName');
/**
* @see isBlockValid in core/block-editor store.
*/
const isBlockValid = getBlockEditorSelector('isBlockValid');
/**
* @see getBlockAttributes in core/block-editor store.
*/
const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
/**
* @see getBlock in core/block-editor store.
*/
const getBlock = getBlockEditorSelector('getBlock');
/**
* @see getBlocks in core/block-editor store.
*/
const getBlocks = getBlockEditorSelector('getBlocks');
/**
* @see getClientIdsOfDescendants in core/block-editor store.
*/
const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
/**
* @see getClientIdsWithDescendants in core/block-editor store.
*/
const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
/**
* @see getGlobalBlockCount in core/block-editor store.
*/
const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
/**
* @see getBlocksByClientId in core/block-editor store.
*/
const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
/**
* @see getBlockCount in core/block-editor store.
*/
const getBlockCount = getBlockEditorSelector('getBlockCount');
/**
* @see getBlockSelectionStart in core/block-editor store.
*/
const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
/**
* @see getBlockSelectionEnd in core/block-editor store.
*/
const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
/**
* @see getSelectedBlockCount in core/block-editor store.
*/
const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
/**
* @see hasSelectedBlock in core/block-editor store.
*/
const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
/**
* @see getSelectedBlockClientId in core/block-editor store.
*/
const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
/**
* @see getSelectedBlock in core/block-editor store.
*/
const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
/**
* @see getBlockRootClientId in core/block-editor store.
*/
const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
/**
* @see getBlockHierarchyRootClientId in core/block-editor store.
*/
const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
/**
* @see getAdjacentBlockClientId in core/block-editor store.
*/
const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
/**
* @see getPreviousBlockClientId in core/block-editor store.
*/
const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
/**
* @see getNextBlockClientId in core/block-editor store.
*/
const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
/**
* @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
*/
const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
/**
* @see getMultiSelectedBlockClientIds in core/block-editor store.
*/
const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
/**
* @see getMultiSelectedBlocks in core/block-editor store.
*/
const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
/**
* @see getFirstMultiSelectedBlockClientId in core/block-editor store.
*/
const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
/**
* @see getLastMultiSelectedBlockClientId in core/block-editor store.
*/
const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
/**
* @see isFirstMultiSelectedBlock in core/block-editor store.
*/
const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
/**
* @see isBlockMultiSelected in core/block-editor store.
*/
const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
/**
* @see isAncestorMultiSelected in core/block-editor store.
*/
const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
/**
* @see getMultiSelectedBlocksStartClientId in core/block-editor store.
*/
const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
/**
* @see getMultiSelectedBlocksEndClientId in core/block-editor store.
*/
const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
/**
* @see getBlockOrder in core/block-editor store.
*/
const getBlockOrder = getBlockEditorSelector('getBlockOrder');
/**
* @see getBlockIndex in core/block-editor store.
*/
const getBlockIndex = getBlockEditorSelector('getBlockIndex');
/**
* @see isBlockSelected in core/block-editor store.
*/
const isBlockSelected = getBlockEditorSelector('isBlockSelected');
/**
* @see hasSelectedInnerBlock in core/block-editor store.
*/
const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
/**
* @see isBlockWithinSelection in core/block-editor store.
*/
const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
/**
* @see hasMultiSelection in core/block-editor store.
*/
const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
/**
* @see isMultiSelecting in core/block-editor store.
*/
const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
/**
* @see isSelectionEnabled in core/block-editor store.
*/
const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
/**
* @see getBlockMode in core/block-editor store.
*/
const getBlockMode = getBlockEditorSelector('getBlockMode');
/**
* @see isTyping in core/block-editor store.
*/
const isTyping = getBlockEditorSelector('isTyping');
/**
* @see isCaretWithinFormattedText in core/block-editor store.
*/
const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
/**
* @see getBlockInsertionPoint in core/block-editor store.
*/
const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
/**
* @see isBlockInsertionPointVisible in core/block-editor store.
*/
const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
/**
* @see isValidTemplate in core/block-editor store.
*/
const isValidTemplate = getBlockEditorSelector('isValidTemplate');
/**
* @see getTemplate in core/block-editor store.
*/
const getTemplate = getBlockEditorSelector('getTemplate');
/**
* @see getTemplateLock in core/block-editor store.
*/
const getTemplateLock = getBlockEditorSelector('getTemplateLock');
/**
* @see canInsertBlockType in core/block-editor store.
*/
const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
/**
* @see getInserterItems in core/block-editor store.
*/
const getInserterItems = getBlockEditorSelector('getInserterItems');
/**
* @see hasInserterItems in core/block-editor store.
*/
const hasInserterItems = getBlockEditorSelector('hasInserterItems');
/**
* @see getBlockListSettings in core/block-editor store.
*/
const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
/**
* Returns the default template types.
*
* @param {Object} state Global application state.
*
* @return {Object} The template types.
*/
function __experimentalGetDefaultTemplateTypes(state) {
return getEditorSettings(state)?.defaultTemplateTypes;
}
/**
* Returns the default template part areas.
*
* @param {Object} state Global application state.
*
* @return {Array} The template part areas.
*/
const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createSelector)(state => {
var _getEditorSettings$de;
const areas = (_getEditorSettings$de = getEditorSettings(state)?.defaultTemplatePartAreas) !== null && _getEditorSettings$de !== void 0 ? _getEditorSettings$de : [];
return areas.map(item => {
return {
...item,
icon: getTemplatePartIcon(item.icon)
};
});
}, state => [getEditorSettings(state)?.defaultTemplatePartAreas]);
/**
* Returns a default template type searched by slug.
*
* @param {Object} state Global application state.
* @param {string} slug The template type slug.
*
* @return {Object} The template type.
*/
const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createSelector)((state, slug) => {
var _Object$values$find;
const templateTypes = __experimentalGetDefaultTemplateTypes(state);
if (!templateTypes) {
return EMPTY_OBJECT;
}
return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT;
}, state => [__experimentalGetDefaultTemplateTypes(state)]);
/**
* Given a template entity, return information about it which is ready to be
* rendered, such as the title, description, and icon.
*
* @param {Object} state Global application state.
* @param {Object} template The template for which we need information.
* @return {Object} Information about the template, including title, description, and icon.
*/
const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createSelector)((state, template) => {
if (!template) {
return EMPTY_OBJECT;
}
const {
description,
slug,
title,
area
} = template;
const {
title: defaultTitle,
description: defaultDescription
} = __experimentalGetDefaultTemplateType(state, slug);
const templateTitle = typeof title === 'string' ? title : title?.rendered;
const templateDescription = typeof description === 'string' ? description : description?.raw;
const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || library_layout;
return {
title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
description: templateDescription || defaultDescription,
icon: templateIcon
};
}, state => [__experimentalGetDefaultTemplateTypes(state), __experimentalGetDefaultTemplatePartAreas(state)]);
/**
* Returns a post type label depending on the current post.
*
* @param {Object} state Global application state.
*
* @return {string|undefined} The post type label if available, otherwise undefined.
*/
const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const currentPostType = getCurrentPostType(state);
const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType);
// Disable reason: Post type labels object is shaped like this.
// eslint-disable-next-line camelcase
return postType?.labels?.singular_name;
});
/**
* Returns true if the publish sidebar is opened.
*
* @param {Object} state Global application state
*
* @return {boolean} Whether the publish sidebar is open.
*/
function isPublishSidebarOpened(state) {
return state.publishSidebarActive;
}
;// CONCATENATED MODULE: external ["wp","a11y"]
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// CONCATENATED MODULE: external ["wp","apiFetch"]
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
;// CONCATENATED MODULE: external ["wp","notices"]
const external_wp_notices_namespaceObject = window["wp"]["notices"];
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js
/**
* Function returning a sessionStorage key to set or retrieve a given post's
* automatic session backup.
*
* Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
* `loggedout` handler can clear sessionStorage of any user-private content.
*
* @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
*
* @param {string} postId Post ID.
* @param {boolean} isPostNew Whether post new.
*
* @return {string} sessionStorage key
*/
function postKey(postId, isPostNew) {
return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
}
function localAutosaveGet(postId, isPostNew) {
return window.sessionStorage.getItem(postKey(postId, isPostNew));
}
function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
post_title: title,
content,
excerpt
}));
}
function localAutosaveClear(postId, isPostNew) {
window.sessionStorage.removeItem(postKey(postId, isPostNew));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Builds the arguments for a success notification dispatch.
*
* @param {Object} data Incoming data to build the arguments from.
*
* @return {Array} Arguments for dispatch. An empty array signals no
* notification should be sent.
*/
function getNotificationArgumentsForSaveSuccess(data) {
var _postType$viewable;
const {
previousPost,
post,
postType
} = data;
// Autosaves are neither shown a notice nor redirected.
if (data.options?.isAutosave) {
return [];
}
const publishStatus = ['publish', 'private', 'future'];
const isPublished = publishStatus.includes(previousPost.status);
const willPublish = publishStatus.includes(post.status);
const willTrash = post.status === 'trash' && previousPost.status !== 'trash';
let noticeMessage;
let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
let isDraft;
// Always should a notice, which will be spoken for accessibility.
if (willTrash) {
noticeMessage = postType.labels.item_trashed;
shouldShowLink = false;
} else if (!isPublished && !willPublish) {
// If saving a non-published post, don't show notice.
noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.');
isDraft = true;
} else if (isPublished && !willPublish) {
// If undoing publish status, show specific notice.
noticeMessage = postType.labels.item_reverted_to_draft;
shouldShowLink = false;
} else if (!isPublished && willPublish) {
// If publishing or scheduling a post, show the corresponding
// publish message.
noticeMessage = {
publish: postType.labels.item_published,
private: postType.labels.item_published_privately,
future: postType.labels.item_scheduled
}[post.status];
} else {
// Generic fallback notice.
noticeMessage = postType.labels.item_updated;
}
const actions = [];
if (shouldShowLink) {
actions.push({
label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item,
url: post.link
});
}
return [noticeMessage, {
id: SAVE_POST_NOTICE_ID,
type: 'snackbar',
actions
}];
}
/**
* Builds the fail notification arguments for dispatch.
*
* @param {Object} data Incoming data to build the arguments with.
*
* @return {Array} Arguments for dispatch. An empty array signals no
* notification should be sent.
*/
function getNotificationArgumentsForSaveFail(data) {
const {
post,
edits,
error
} = data;
if (error && 'rest_autosave_no_changes' === error.code) {
// Autosave requested a new autosave, but there were no changes. This shouldn't
// result in an error notice for the user.
return [];
}
const publishStatus = ['publish', 'private', 'future'];
const isPublished = publishStatus.indexOf(post.status) !== -1;
// If the post was being published, we show the corresponding publish error message
// Unless we publish an "updating failed" message.
const messages = {
publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.')
};
let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.');
// Check if message string contains HTML. Notice text is currently only
// supported as plaintext, and stripping the tags may muddle the meaning.
if (error.message && !/<\/?[^>]*>/.test(error.message)) {
noticeMessage = [noticeMessage, error.message].join(' ');
}
return [noticeMessage, {
id: SAVE_POST_NOTICE_ID
}];
}
/**
* Builds the trash fail notification arguments for dispatch.
*
* @param {Object} data
*
* @return {Array} Arguments for dispatch.
*/
function getNotificationArgumentsForTrashFail(data) {
return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), {
id: TRASH_POST_NOTICE_ID
}];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns an action generator used in signalling that editor has initialized with
* the specified post object and editor settings.
*
* @param {Object} post Post object.
* @param {Object} edits Initial edited attributes object.
* @param {Array?} template Block Template.
*/
const setupEditor = (post, edits, template) => ({
dispatch
}) => {
dispatch.setEditedPost(post.type, post.id);
// Apply a template for new posts only, if exists.
const isNewPost = post.status === 'auto-draft';
if (isNewPost && template) {
// In order to ensure maximum of a single parse during setup, edits are
// included as part of editor setup action. Assume edited content as
// canonical if provided, falling back to post.
let content;
if ('content' in edits) {
content = edits.content;
} else {
content = post.content.raw;
}
let blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
dispatch.resetEditorBlocks(blocks, {
__unstableShouldCreateUndoLevel: false
});
}
if (edits && Object.values(edits).some(([key, edit]) => {
var _post$key$raw;
return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
})) {
dispatch.editPost(edits);
}
};
/**
* Returns an action object signalling that the editor is being destroyed and
* that any necessary state or side-effect cleanup should occur.
*
* @deprecated
*
* @return {Object} Action object.
*/
function __experimentalTearDownEditor() {
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", {
since: '6.5'
});
return {
type: 'DO_NOTHING'
};
}
/**
* Returns an action object used in signalling that the latest version of the
* post has been received, either by initialization or save.
*
* @deprecated Since WordPress 6.0.
*/
function resetPost() {
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", {
since: '6.0',
version: '6.3',
alternative: 'Initialize the editor with the setupEditorState action'
});
return {
type: 'DO_NOTHING'
};
}
/**
* Returns an action object used in signalling that a patch of updates for the
* latest version of the post have been received.
*
* @return {Object} Action object.
* @deprecated since Gutenberg 9.7.0.
*/
function updatePost() {
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
since: '5.7',
alternative: 'Use the core entities store instead'
});
return {
type: 'DO_NOTHING'
};
}
/**
* Setup the editor state.
*
* @deprecated
*
* @param {Object} post Post object.
*/
function setupEditorState(post) {
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", {
since: '6.5',
alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost"
});
return setEditedPost(post.type, post.id);
}
/**
* Returns an action that sets the current post Type and post ID.
*
* @param {string} postType Post Type.
* @param {string} postId Post ID.
*
* @return {Object} Action object.
*/
function setEditedPost(postType, postId) {
return {
type: 'SET_EDITED_POST',
postType,
postId
};
}
/**
* Returns an action object used in signalling that attributes of the post have
* been edited.
*
* @param {Object} edits Post attributes to edit.
* @param {Object} options Options for the edit.
*/
const editPost = (edits, options) => ({
select,
registry
}) => {
const {
id,
type
} = select.getCurrentPost();
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options);
};
/**
* Action for saving the current post in the editor.
*
* @param {Object} options
*/
const savePost = (options = {}) => async ({
select,
dispatch,
registry
}) => {
if (!select.isEditedPostSaveable()) {
return;
}
const content = select.getEditedPostContent();
if (!options.isAutosave) {
dispatch.editPost({
content
}, {
undoIgnore: true
});
}
const previousRecord = select.getCurrentPost();
let edits = {
id: previousRecord.id,
...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
content
};
dispatch({
type: 'REQUEST_POST_UPDATE_START',
options
});
let error = false;
try {
edits = await (0,external_wp_hooks_namespaceObject.applyFiltersAsync)('editor.preSavePost', edits, options);
} catch (err) {
error = err;
}
if (!error) {
try {
await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options);
} catch (err) {
error = err.message && err.code !== 'unknown_error' ? err.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating.');
}
}
if (!error) {
error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
}
// Run the hook with legacy unstable name for backward compatibility
if (!error) {
try {
await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options);
} catch (err) {
error = err;
}
}
if (!error) {
try {
await (0,external_wp_hooks_namespaceObject.doActionAsync)('editor.savePost', {
id: previousRecord.id
}, options);
} catch (err) {
error = err;
}
}
dispatch({
type: 'REQUEST_POST_UPDATE_FINISH',
options
});
if (error) {
const args = getNotificationArgumentsForSaveFail({
post: previousRecord,
edits,
error
});
if (args.length) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args);
}
} else {
const updatedRecord = select.getCurrentPost();
const args = getNotificationArgumentsForSaveSuccess({
previousPost: previousRecord,
post: updatedRecord,
postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type),
options
});
if (args.length) {
registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args);
}
// Make sure that any edits after saving create an undo level and are
// considered for change detection.
if (!options.isAutosave) {
registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent();
}
}
};
/**
* Action for refreshing the current post.
*
* @deprecated Since WordPress 6.0.
*/
function refreshPost() {
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", {
since: '6.0',
version: '6.3',
alternative: 'Use the core entities store instead'
});
return {
type: 'DO_NOTHING'
};
}
/**
* Action for trashing the current post in the editor.
*/
const trashPost = () => async ({
select,
dispatch,
registry
}) => {
const postTypeSlug = select.getCurrentPostType();
const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID);
const {
rest_base: restBase,
rest_namespace: restNamespace = 'wp/v2'
} = postType;
dispatch({
type: 'REQUEST_POST_DELETE_START'
});
try {
const post = select.getCurrentPost();
await external_wp_apiFetch_default()({
path: `/${restNamespace}/${restBase}/${post.id}`,
method: 'DELETE'
});
await dispatch.savePost();
} catch (error) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({
error
}));
}
dispatch({
type: 'REQUEST_POST_DELETE_FINISH'
});
};
/**
* Action that autosaves the current post. This
* includes server-side autosaving (default) and client-side (a.k.a. local)
* autosaving (e.g. on the Web, the post might be committed to Session
* Storage).
*
* @param {Object?} options Extra flags to identify the autosave.
*/
const autosave = ({
local = false,
...options
} = {}) => async ({
select,
dispatch
}) => {
const post = select.getCurrentPost();
// Currently template autosaving is not supported.
if (post.type === 'wp_template') {
return;
}
if (local) {
const isPostNew = select.isEditedPostNew();
const title = select.getEditedPostAttribute('title');
const content = select.getEditedPostAttribute('content');
const excerpt = select.getEditedPostAttribute('excerpt');
localAutosaveSet(post.id, isPostNew, title, content, excerpt);
} else {
await dispatch.savePost({
isAutosave: true,
...options
});
}
};
const __unstableSaveForPreview = ({
forceIsAutosaveable
} = {}) => async ({
select,
dispatch
}) => {
if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) {
const isDraft = ['draft', 'auto-draft'].includes(select.getEditedPostAttribute('status'));
if (isDraft) {
await dispatch.savePost({
isPreview: true
});
} else {
await dispatch.autosave({
isPreview: true
});
}
}
return select.getEditedPostPreviewLink();
};
/**
* Action that restores last popped state in undo history.
*/
const redo = () => ({
registry
}) => {
registry.dispatch(external_wp_coreData_namespaceObject.store).redo();
};
/**
* Action that pops a record from undo history and undoes the edit.
*/
const undo = () => ({
registry
}) => {
registry.dispatch(external_wp_coreData_namespaceObject.store).undo();
};
/**
* Action that creates an undo history record.
*
* @deprecated Since WordPress 6.0
*/
function createUndoLevel() {
external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", {
since: '6.0',
version: '6.3',
alternative: 'Use the core entities store instead'
});
return {
type: 'DO_NOTHING'
};
}
/**
* Action that locks the editor.
*
* @param {Object} lock Details about the post lock status, user, and nonce.
* @return {Object} Action object.
*/
function updatePostLock(lock) {
return {
type: 'UPDATE_POST_LOCK',
lock
};
}
/**
* Enable the publish sidebar.
*/
const enablePublishSidebar = () => ({
registry
}) => {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', true);
};
/**
* Disables the publish sidebar.
*/
const disablePublishSidebar = () => ({
registry
}) => {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'isPublishSidebarEnabled', false);
};
/**
* Action that locks post saving.
*
* @param {string} lockName The lock name.
*
* @example
* ```
* const { subscribe } = wp.data;
*
* const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
*
* // Only allow publishing posts that are set to a future date.
* if ( 'publish' !== initialPostStatus ) {
*
* // Track locking.
* let locked = false;
*
* // Watch for the publish event.
* let unssubscribe = subscribe( () => {
* const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
* if ( 'publish' !== currentPostStatus ) {
*
* // Compare the post date to the current date, lock the post if the date isn't in the future.
* const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
* const currentDate = new Date();
* if ( postDate.getTime() <= currentDate.getTime() ) {
* if ( ! locked ) {
* locked = true;
* wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
* }
* } else {
* if ( locked ) {
* locked = false;
* wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
* }
* }
* }
* } );
* }
* ```
*
* @return {Object} Action object
*/
function lockPostSaving(lockName) {
return {
type: 'LOCK_POST_SAVING',
lockName
};
}
/**
* Action that unlocks post saving.
*
* @param {string} lockName The lock name.
*
* @example
* ```
* // Unlock post saving with the lock key `mylock`:
* wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
* ```
*
* @return {Object} Action object
*/
function unlockPostSaving(lockName) {
return {
type: 'UNLOCK_POST_SAVING',
lockName
};
}
/**
* Action that locks post autosaving.
*
* @param {string} lockName The lock name.
*
* @example
* ```
* // Lock post autosaving with the lock key `mylock`:
* wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );
* ```
*
* @return {Object} Action object
*/
function lockPostAutosaving(lockName) {
return {
type: 'LOCK_POST_AUTOSAVING',
lockName
};
}
/**
* Action that unlocks post autosaving.
*
* @param {string} lockName The lock name.
*
* @example
* ```
* // Unlock post saving with the lock key `mylock`:
* wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );
* ```
*
* @return {Object} Action object
*/
function unlockPostAutosaving(lockName) {
return {
type: 'UNLOCK_POST_AUTOSAVING',
lockName
};
}
/**
* Returns an action object used to signal that the blocks have been updated.
*
* @param {Array} blocks Block Array.
* @param {?Object} options Optional options.
*/
const resetEditorBlocks = (blocks, options = {}) => ({
select,
dispatch,
registry
}) => {
const {
__unstableShouldCreateUndoLevel,
selection
} = options;
const edits = {
blocks,
selection
};
if (__unstableShouldCreateUndoLevel !== false) {
const {
id,
type
} = select.getCurrentPost();
const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
if (noChange) {
registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id);
return;
}
// We create a new function here on every persistent edit
// to make sure the edit makes the post dirty and creates
// a new undo level.
edits.content = ({
blocks: blocksForSerialization = []
}) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
}
dispatch.editPost(edits);
};
/*
* Returns an action object used in signalling that the post editor settings have been updated.
*
* @param {Object} settings Updated settings
*
* @return {Object} Action object
*/
function updateEditorSettings(settings) {
return {
type: 'UPDATE_EDITOR_SETTINGS',
settings
};
}
/**
* Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes:
*
* - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template.
* - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable.
*
* @param {string} mode Mode (one of 'post-only' or 'template-locked').
*/
const setRenderingMode = mode => ({
dispatch,
registry,
select
}) => {
if (select.__unstableIsEditorReady()) {
// We clear the block selection but we also need to clear the selection from the core store.
registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
dispatch.editPost({
selection: undefined
}, {
undoIgnore: true
});
}
dispatch({
type: 'SET_RENDERING_MODE',
mode
});
};
/**
* Action that changes the width of the editing canvas.
*
* @param {string} deviceType
*
* @return {Object} Action object.
*/
function setDeviceType(deviceType) {
return {
type: 'SET_DEVICE_TYPE',
deviceType
};
}
/**
* Returns an action object used to enable or disable a panel in the editor.
*
* @param {string} panelName A string that identifies the panel to enable or disable.
*
* @return {Object} Action object.
*/
const toggleEditorPanelEnabled = panelName => ({
registry
}) => {
var _registry$select$get;
const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
const isPanelInactive = !!inactivePanels?.includes(panelName);
// If the panel is inactive, remove it to enable it, else add it to
// make it inactive.
let updatedInactivePanels;
if (isPanelInactive) {
updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
} else {
updatedInactivePanels = [...inactivePanels, panelName];
}
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'inactivePanels', updatedInactivePanels);
};
/**
* Opens a closed panel and closes an open panel.
*
* @param {string} panelName A string that identifies the panel to open or close.
*/
const toggleEditorPanelOpened = panelName => ({
registry
}) => {
var _registry$select$get2;
const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
const isPanelOpen = !!openPanels?.includes(panelName);
// If the panel is open, remove it to close it, else add it to
// make it open.
let updatedOpenPanels;
if (isPanelOpen) {
updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
} else {
updatedOpenPanels = [...openPanels, panelName];
}
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'openPanels', updatedOpenPanels);
};
/**
* Returns an action object used to remove a panel from the editor.
*
* @param {string} panelName A string that identifies the panel to remove.
*
* @return {Object} Action object.
*/
function removeEditorPanel(panelName) {
return {
type: 'REMOVE_PANEL',
panelName
};
}
/**
* Returns an action object used to open/close the inserter.
*
* @param {boolean|Object} value Whether the inserter should be
* opened (true) or closed (false).
* To specify an insertion point,
* use an object.
* @param {string} value.rootClientId The root client ID to insert at.
* @param {number} value.insertionIndex The index to insert at.
*
* @return {Object} Action object.
*/
function setIsInserterOpened(value) {
return {
type: 'SET_IS_INSERTER_OPENED',
value
};
}
/**
* Returns an action object used to open/close the list view.
*
* @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
* @return {Object} Action object.
*/
function setIsListViewOpened(isOpen) {
return {
type: 'SET_IS_LIST_VIEW_OPENED',
isOpen
};
}
/**
* Action that toggles Distraction free mode.
* Distraction free mode expects there are no sidebars, as due to the
* z-index values set, you can't close sidebars.
*/
const toggleDistractionFree = () => ({
dispatch,
registry
}) => {
const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
if (isDistractionFree) {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false);
}
if (!isDistractionFree) {
registry.batch(() => {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true);
dispatch.setIsInserterOpened(false);
dispatch.setIsListViewOpened(false);
});
}
registry.batch(() => {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree);
registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), {
id: 'core/editor/distraction-free-mode/notice',
type: 'snackbar',
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
onClick: () => {
registry.batch(() => {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false);
registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree');
});
}
}]
});
});
};
/**
* Triggers an action used to switch editor mode.
*
* @param {string} mode The editor mode.
*/
const switchEditorMode = mode => ({
dispatch,
registry
}) => {
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode);
// Unselect blocks when we switch to a non visual mode.
if (mode !== 'visual') {
registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
}
if (mode === 'visual') {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive');
} else if (mode === 'text') {
const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree');
if (isDistractionFree) {
dispatch.toggleDistractionFree();
}
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Code editor selected'), 'assertive');
}
};
/**
* Returns an action object used in signalling that the user opened the publish
* sidebar.
*
* @return {Object} Action object
*/
function openPublishSidebar() {
return {
type: 'OPEN_PUBLISH_SIDEBAR'
};
}
/**
* Returns an action object used in signalling that the user closed the
* publish sidebar.
*
* @return {Object} Action object.
*/
function closePublishSidebar() {
return {
type: 'CLOSE_PUBLISH_SIDEBAR'
};
}
/**
* Returns an action object used in signalling that the user toggles the publish sidebar.
*
* @return {Object} Action object
*/
function togglePublishSidebar() {
return {
type: 'TOGGLE_PUBLISH_SIDEBAR'
};
}
/**
* Backward compatibility
*/
const getBlockEditorAction = name => (...args) => ({
registry
}) => {
external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', {
since: '5.3',
alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
version: '6.2'
});
registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args);
};
/**
* @see resetBlocks in core/block-editor store.
*/
const resetBlocks = getBlockEditorAction('resetBlocks');
/**
* @see receiveBlocks in core/block-editor store.
*/
const receiveBlocks = getBlockEditorAction('receiveBlocks');
/**
* @see updateBlock in core/block-editor store.
*/
const updateBlock = getBlockEditorAction('updateBlock');
/**
* @see updateBlockAttributes in core/block-editor store.
*/
const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes');
/**
* @see selectBlock in core/block-editor store.
*/
const selectBlock = getBlockEditorAction('selectBlock');
/**
* @see startMultiSelect in core/block-editor store.
*/
const startMultiSelect = getBlockEditorAction('startMultiSelect');
/**
* @see stopMultiSelect in core/block-editor store.
*/
const stopMultiSelect = getBlockEditorAction('stopMultiSelect');
/**
* @see multiSelect in core/block-editor store.
*/
const multiSelect = getBlockEditorAction('multiSelect');
/**
* @see clearSelectedBlock in core/block-editor store.
*/
const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock');
/**
* @see toggleSelection in core/block-editor store.
*/
const toggleSelection = getBlockEditorAction('toggleSelection');
/**
* @see replaceBlocks in core/block-editor store.
*/
const replaceBlocks = getBlockEditorAction('replaceBlocks');
/**
* @see replaceBlock in core/block-editor store.
*/
const replaceBlock = getBlockEditorAction('replaceBlock');
/**
* @see moveBlocksDown in core/block-editor store.
*/
const moveBlocksDown = getBlockEditorAction('moveBlocksDown');
/**
* @see moveBlocksUp in core/block-editor store.
*/
const moveBlocksUp = getBlockEditorAction('moveBlocksUp');
/**
* @see moveBlockToPosition in core/block-editor store.
*/
const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition');
/**
* @see insertBlock in core/block-editor store.
*/
const insertBlock = getBlockEditorAction('insertBlock');
/**
* @see insertBlocks in core/block-editor store.
*/
const insertBlocks = getBlockEditorAction('insertBlocks');
/**
* @see showInsertionPoint in core/block-editor store.
*/
const showInsertionPoint = getBlockEditorAction('showInsertionPoint');
/**
* @see hideInsertionPoint in core/block-editor store.
*/
const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint');
/**
* @see setTemplateValidity in core/block-editor store.
*/
const setTemplateValidity = getBlockEditorAction('setTemplateValidity');
/**
* @see synchronizeTemplate in core/block-editor store.
*/
const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate');
/**
* @see mergeBlocks in core/block-editor store.
*/
const mergeBlocks = getBlockEditorAction('mergeBlocks');
/**
* @see removeBlocks in core/block-editor store.
*/
const removeBlocks = getBlockEditorAction('removeBlocks');
/**
* @see removeBlock in core/block-editor store.
*/
const removeBlock = getBlockEditorAction('removeBlock');
/**
* @see toggleBlockMode in core/block-editor store.
*/
const toggleBlockMode = getBlockEditorAction('toggleBlockMode');
/**
* @see startTyping in core/block-editor store.
*/
const startTyping = getBlockEditorAction('startTyping');
/**
* @see stopTyping in core/block-editor store.
*/
const stopTyping = getBlockEditorAction('stopTyping');
/**
* @see enterFormattedText in core/block-editor store.
*/
const enterFormattedText = getBlockEditorAction('enterFormattedText');
/**
* @see exitFormattedText in core/block-editor store.
*/
const exitFormattedText = getBlockEditorAction('exitFormattedText');
/**
* @see insertDefaultBlock in core/block-editor store.
*/
const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
/**
* @see updateBlockListSettings in core/block-editor store.
*/
const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js
/**
* Internal dependencies
*/
// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
/**
* Check if a template or template part is revertable to its original theme-provided file.
*
* @param {Object} templateOrTemplatePart The entity to check.
* @return {boolean} Whether the entity is revertable.
*/
function isTemplateRevertable(templateOrTemplatePart) {
if (!templateOrTemplatePart) {
return false;
}
return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file);
}
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
/**
* WordPress dependencies
*/
const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
})
});
/* harmony default export */ const library_check = (check);
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
/* harmony default export */ const tslib_es6 = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
});
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "\u0069\u0307",
J: "\u006A\u0307",
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303",
},
},
};
/**
* Localized lower case.
*/
function localeLowerCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return lowerCase(str);
}
/**
* Lower case as a function.
*/
function lowerCase(str) {
return str.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function noCase(input, options) {
if (options === void 0) { options = {}; }
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
var start = 0;
var end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
while (result.charAt(end - 1) === "\0")
end--;
// Transform each token independently.
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
* Replace `re` in the input string with the replacement value.
*/
function replace(input, re, value) {
if (re instanceof RegExp)
return input.replace(re, value);
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}
;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
function dotCase(input, options) {
if (options === void 0) { options = {}; }
return noCase(input, __assign({ delimiter: "." }, options));
}
;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
function paramCase(input, options) {
if (options === void 0) { options = {}; }
return dotCase(input, __assign({ delimiter: "-" }, options));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/create-template-part-modal/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useExistingTemplateParts = () => {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
per_page: -1
}), []);
};
/**
* Return a unique template part title based on
* the given title and existing template parts.
*
* @param {string} title The original template part title.
* @param {Object} templateParts The array of template part entities.
* @return {string} A unique template part title.
*/
const getUniqueTemplatePartTitle = (title, templateParts) => {
const lowercaseTitle = title.toLowerCase();
const existingTitles = templateParts.map(templatePart => templatePart.title.rendered.toLowerCase());
if (!existingTitles.includes(lowercaseTitle)) {
return title;
}
let suffix = 2;
while (existingTitles.includes(`${lowercaseTitle} ${suffix}`)) {
suffix++;
}
return `${title} ${suffix}`;
};
/**
* Get a valid slug for a template part.
* Currently template parts only allow latin chars.
* The fallback slug will receive suffix by default.
*
* @param {string} title The template part title.
* @return {string} A valid template part slug.
*/
const getCleanTemplatePartSlug = title => {
return paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/create-template-part-modal/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CreateTemplatePartModal({
modalTitle,
...restProps
}) {
const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: modalTitle || defaultModalTitle,
onRequestClose: restProps.closeModal,
overlayClassName: "editor-create-template-part-modal",
focusOnMount: "firstContentElement",
size: "medium",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, {
...restProps
})
});
}
function CreateTemplatePartModalContents({
defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
blocks = [],
confirmLabel = (0,external_wp_i18n_namespaceObject.__)('Add'),
closeModal,
onCreate,
onError,
defaultTitle = ''
}) {
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
saveEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const existingTemplateParts = useExistingTemplateParts();
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle);
const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea);
const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal);
const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetDefaultTemplatePartAreas(), []);
async function createTemplatePart() {
if (!title || isSubmitting) {
return;
}
try {
setIsSubmitting(true);
const uniqueTitle = getUniqueTemplatePartTitle(title, existingTemplateParts);
const cleanSlug = getCleanTemplatePartSlug(uniqueTitle);
const templatePart = await saveEntityRecord('postType', TEMPLATE_PART_POST_TYPE, {
slug: cleanSlug,
title: uniqueTitle,
content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
area
}, {
throwOnError: true
});
await onCreate(templatePart);
// TODO: Add a success notice?
} catch (error) {
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.');
createErrorNotice(errorMessage, {
type: 'snackbar'
});
onError?.();
} finally {
setIsSubmitting(false);
}
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
onSubmit: async event => {
event.preventDefault();
await createTemplatePart();
},
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "4",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
value: title,
onChange: setTitle,
required: true
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Area'),
id: `editor-create-template-part-modal__area-selection-${instanceId}`,
className: "editor-create-template-part-modal__area-base-control",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadioGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Area'),
className: "editor-create-template-part-modal__area-radio-group",
id: `editor-create-template-part-modal__area-selection-${instanceId}`,
onChange: setArea,
checked: area,
children: templatePartAreas.map(({
icon,
label,
area: value,
description
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalRadio, {
value: value,
className: "editor-create-template-part-modal__area-radio",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
align: "start",
justify: "start",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
icon: icon
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.FlexBlock, {
className: "editor-create-template-part-modal__option-label",
children: [label, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
children: description
})]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
className: "editor-create-template-part-modal__checkbox",
children: area === value && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
icon: library_check
})
})]
})
}, label))
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: () => {
closeModal();
},
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit",
"aria-disabled": !title || isSubmitting,
isBusy: isSubmitting,
children: confirmLabel
})]
})]
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function isTemplate(post) {
return post.type === TEMPLATE_POST_TYPE;
}
function isTemplatePart(post) {
return post.type === TEMPLATE_PART_POST_TYPE;
}
function isTemplateOrTemplatePart(p) {
return p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;
}
function getItemTitle(item) {
if (typeof item.title === 'string') {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title);
}
if ('rendered' in item.title) {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered);
}
if ('raw' in item.title) {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw);
}
return '';
}
/**
* Check if a template is removable.
*
* @param template The template entity to check.
* @return Whether the template is removable.
*/
function isTemplateRemovable(template) {
if (!template) {
return false;
}
// In patterns list page we map the templates parts to a different object
// than the one returned from the endpoint. This is why we need to check for
// two props whether is custom or has a theme file.
return [template.source, template.source].includes(TEMPLATE_ORIGINS.custom) && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/duplicate-template-part.js
/**
* WordPress dependencies
*/
// @ts-ignore
/**
* Internal dependencies
*/
const duplicateTemplatePart = {
id: 'duplicate-template-part',
label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
isEligible: item => item.type === TEMPLATE_PART_POST_TYPE,
modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate template part', 'action label'),
RenderModal: ({
items,
closeModal
}) => {
const [item] = items;
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _item$blocks;
return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0,external_wp_blocks_namespaceObject.parse)(typeof item.content === 'string' ? item.content : item.content.raw, {
__unstableSkipMigrationLogs: true
});
}, [item.content, item.blocks]);
const {
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
function onTemplatePartSuccess() {
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
(0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', 'template part'), getItemTitle(item)), {
type: 'snackbar',
id: 'edit-site-patterns-success'
});
closeModal?.();
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, {
blocks: blocks,
defaultArea: item.area,
defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Existing template part title */
(0,external_wp_i18n_namespaceObject._x)('%s (Copy)', 'template part'), getItemTitle(item)),
onCreate: onTemplatePartSuccess,
onError: closeModal,
confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
closeModal: closeModal
});
}
};
/* harmony default export */ const duplicate_template_part = (duplicateTemplatePart);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
/**
* WordPress dependencies
*/
const backup = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
})
});
/* harmony default export */ const library_backup = (backup);
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/editor');
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/reset-post.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const reset_post_resetPost = {
id: 'reset-post',
label: (0,external_wp_i18n_namespaceObject.__)('Reset'),
isEligible: item => {
return isTemplateOrTemplatePart(item) && item?.source === TEMPLATE_ORIGINS.custom && (Boolean(item.type === 'wp_template' && item?.plugin) || item?.has_theme_file);
},
icon: library_backup,
supportsBulk: true,
hideModalHeader: true,
RenderModal: ({
items,
closeModal,
onActionPerformed
}) => {
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
const {
revertTemplate
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
const {
saveEditedEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
createSuccessNotice,
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onConfirm = async () => {
try {
for (const template of items) {
await revertTemplate(template, {
allowUndo: false
});
await saveEditedEntityRecord('postType', template.type, template.id);
}
createSuccessNotice(items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */
(0,external_wp_i18n_namespaceObject.__)('%s items reset.'), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
(0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), getItemTitle(items[0])), {
type: 'snackbar',
id: 'revert-template-action'
});
} catch (error) {
let fallbackErrorMessage;
if (items[0].type === TEMPLATE_POST_TYPE) {
fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the templates.');
} else {
fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template part.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the template parts.');
}
const typedError = error;
const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : fallbackErrorMessage;
createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "5",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
children: (0,external_wp_i18n_namespaceObject.__)('Reset to default and clear all customizations?')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: closeModal,
disabled: isBusy,
accessibleWhenDisabled: true,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
onClick: async () => {
setIsBusy(true);
await onConfirm();
onActionPerformed?.(items);
setIsBusy(false);
closeModal?.();
},
isBusy: isBusy,
disabled: isBusy,
accessibleWhenDisabled: true,
children: (0,external_wp_i18n_namespaceObject.__)('Reset')
})]
})]
});
}
};
/* harmony default export */ const reset_post = (reset_post_resetPost);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js
/**
* WordPress dependencies
*/
const trash = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
})
});
/* harmony default export */ const library_trash = (trash);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/trash-post.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const trash_post_trashPost = {
id: 'move-to-trash',
label: (0,external_wp_i18n_namespaceObject.__)('Move to trash'),
isPrimary: true,
icon: library_trash,
isEligible(item) {
if (isTemplateOrTemplatePart(item) || item.type === 'wp_block') {
return false;
}
return !!item.status && !['auto-draft', 'trash'].includes(item.status) && item.permissions?.delete;
},
supportsBulk: true,
hideModalHeader: true,
RenderModal: ({
items,
closeModal,
onActionPerformed
}) => {
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
const {
createSuccessNotice,
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
deleteEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "5",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The item's title.
(0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), getItemTitle(items[0])) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %d: The number of items (2 or more).
(0,external_wp_i18n_namespaceObject._n)('Are you sure you want to move %d item to the trash ?', 'Are you sure you want to move %d items to the trash ?', items.length), items.length)
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: closeModal,
disabled: isBusy,
accessibleWhenDisabled: true,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
onClick: async () => {
setIsBusy(true);
const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id.toString(), {}, {
throwOnError: true
})));
// If all the promises were fulfilled with success.
if (promiseResult.every(({
status
}) => status === 'fulfilled')) {
let successMessage;
if (promiseResult.length === 1) {
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The item's title. */
(0,external_wp_i18n_namespaceObject.__)('"%s" moved to the trash.'), getItemTitle(items[0]));
} else {
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of items. */
(0,external_wp_i18n_namespaceObject._n)('%s item moved to the trash.', '%s items moved to the trash.', items.length), items.length);
}
createSuccessNotice(successMessage, {
type: 'snackbar',
id: 'move-to-trash-action'
});
} else {
// If there was at least one failure.
let errorMessage;
// If we were trying to delete a single item.
if (promiseResult.length === 1) {
const typedError = promiseResult[0];
if (typedError.reason?.message) {
errorMessage = typedError.reason.message;
} else {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash.');
}
// If we were trying to delete multiple items.
} else {
const errorMessages = new Set();
const failedPromises = promiseResult.filter(({
status
}) => status === 'rejected');
for (const failedPromise of failedPromises) {
const typedError = failedPromise;
if (typedError.reason?.message) {
errorMessages.add(typedError.reason.message);
}
}
if (errorMessages.size === 0) {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the items to the trash.');
} else if (errorMessages.size === 1) {
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
(0,external_wp_i18n_namespaceObject.__)('An error occurred while moving the item to the trash: %s'), [...errorMessages][0]);
} else {
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
(0,external_wp_i18n_namespaceObject.__)('Some errors occurred while moving the items to the trash: %s'), [...errorMessages].join(','));
}
}
createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
if (onActionPerformed) {
onActionPerformed(items);
}
setIsBusy(false);
closeModal?.();
},
isBusy: isBusy,
disabled: isBusy,
accessibleWhenDisabled: true,
children: (0,external_wp_i18n_namespaceObject._x)('Trash', 'verb')
})]
})]
});
}
};
/* harmony default export */ const trash_post = (trash_post_trashPost);
;// CONCATENATED MODULE: external ["wp","patterns"]
const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/rename-post.js
/**
* WordPress dependencies
*/
// @ts-ignore
/**
* Internal dependencies
*/
// Patterns.
const {
PATTERN_TYPES
} = unlock(external_wp_patterns_namespaceObject.privateApis);
const renamePost = {
id: 'rename-post',
label: (0,external_wp_i18n_namespaceObject.__)('Rename'),
isEligible(post) {
if (post.status === 'trash') {
return false;
}
// Templates, template parts and patterns have special checks for renaming.
if (![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, ...Object.values(PATTERN_TYPES)].includes(post.type)) {
return post.permissions?.update;
}
// In the case of templates, we can only rename custom templates.
if (isTemplate(post)) {
return isTemplateRemovable(post) && post.is_custom && post.permissions?.update;
}
if (isTemplatePart(post)) {
return post.source === TEMPLATE_ORIGINS.custom && !post?.has_theme_file && post.permissions?.update;
}
return post.type === PATTERN_TYPES.user && post.permissions?.update;
},
RenderModal: ({
items,
closeModal,
onActionPerformed
}) => {
const [item] = items;
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => getItemTitle(item));
const {
editEntityRecord,
saveEditedEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
createSuccessNotice,
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
async function onRename(event) {
event.preventDefault();
try {
await editEntityRecord('postType', item.type, item.id, {
title
});
// Update state before saving rerenders the list.
setTitle('');
closeModal?.();
// Persist edited entity.
await saveEditedEntityRecord('postType', item.type, item.id, {
throwOnError: true
});
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Name updated'), {
type: 'snackbar'
});
onActionPerformed?.(items);
} catch (error) {
const typedError = error;
const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the name');
createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
onSubmit: onRename,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "5",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
value: title,
onChange: setTitle,
required: true
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: () => {
closeModal?.();
},
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit",
children: (0,external_wp_i18n_namespaceObject.__)('Save')
})]
})]
})
});
}
};
/* harmony default export */ const rename_post = (renamePost);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/restore-post.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const restorePost = {
id: 'restore',
label: (0,external_wp_i18n_namespaceObject.__)('Restore'),
isPrimary: true,
icon: library_backup,
supportsBulk: true,
isEligible(item) {
return !isTemplateOrTemplatePart(item) && item.type !== 'wp_block' && item.status === 'trash' && item.permissions?.update;
},
async callback(posts, {
registry,
onActionPerformed
}) {
const {
createSuccessNotice,
createErrorNotice
} = registry.dispatch(external_wp_notices_namespaceObject.store);
const {
editEntityRecord,
saveEditedEntityRecord
} = registry.dispatch(external_wp_coreData_namespaceObject.store);
await Promise.allSettled(posts.map(post => {
return editEntityRecord('postType', post.type, post.id, {
status: 'draft'
});
}));
const promiseResult = await Promise.allSettled(posts.map(post => {
return saveEditedEntityRecord('postType', post.type, post.id, {
throwOnError: true
});
}));
if (promiseResult.every(({
status
}) => status === 'fulfilled')) {
let successMessage;
if (posts.length === 1) {
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
(0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), getItemTitle(posts[0]));
} else if (posts[0].type === 'page') {
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
(0,external_wp_i18n_namespaceObject.__)('%d pages have been restored.'), posts.length);
} else {
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The number of posts. */
(0,external_wp_i18n_namespaceObject.__)('%d posts have been restored.'), posts.length);
}
createSuccessNotice(successMessage, {
type: 'snackbar',
id: 'restore-post-action'
});
if (onActionPerformed) {
onActionPerformed(posts);
}
} else {
// If there was at lease one failure.
let errorMessage;
// If we were trying to move a single post to the trash.
if (promiseResult.length === 1) {
const typedError = promiseResult[0];
if (typedError.reason?.message) {
errorMessage = typedError.reason.message;
} else {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the post.');
}
// If we were trying to move multiple posts to the trash
} else {
const errorMessages = new Set();
const failedPromises = promiseResult.filter(({
status
}) => status === 'rejected');
for (const failedPromise of failedPromises) {
const typedError = failedPromise;
if (typedError.reason?.message) {
errorMessages.add(typedError.reason.message);
}
}
if (errorMessages.size === 0) {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts.');
} else if (errorMessages.size === 1) {
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
(0,external_wp_i18n_namespaceObject.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]);
} else {
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
(0,external_wp_i18n_namespaceObject.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(','));
}
}
createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
}
};
/* harmony default export */ const restore_post = (restorePost);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
/**
* WordPress dependencies
*/
const external = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
})
});
/* harmony default export */ const library_external = (external);
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/base-post/view-post.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const viewPost = {
id: 'view-post',
label: (0,external_wp_i18n_namespaceObject._x)('View', 'verb'),
isPrimary: true,
icon: library_external,
isEligible(post) {
return post.status !== 'trash';
},
callback(posts, {
onActionPerformed
}) {
const post = posts[0];
window.open(post?.link, '_blank');
if (onActionPerformed) {
onActionPerformed(posts);
}
}
};
/* harmony default export */ const view_post = (viewPost);
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/common/view-post-revisions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const viewPostRevisions = {
id: 'view-post-revisions',
context: 'list',
label(items) {
var _items$0$_links$versi;
const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of revisions. */
(0,external_wp_i18n_namespaceObject.__)('View revisions (%s)'), revisionsCount);
},
isEligible(post) {
var _post$_links$predeces, _post$_links$version;
if (post.status === 'trash') {
return false;
}
const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null;
const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
return !!lastRevisionId && revisionsCount > 1;
},
callback(posts, {
onActionPerformed
}) {
const post = posts[0];
const href = (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
revision: post?._links?.['predecessor-version']?.[0]?.id
});
document.location.href = href;
if (onActionPerformed) {
onActionPerformed(posts);
}
}
};
/* harmony default export */ const view_post_revisions = (viewPostRevisions);
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock: lock_unlock_lock,
unlock: lock_unlock_unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/fields');
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/pattern/duplicate-pattern.js
/**
* WordPress dependencies
*/
// @ts-ignore
/**
* Internal dependencies
*/
// Patterns.
const {
CreatePatternModalContents,
useDuplicatePatternProps
} = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis);
const duplicatePattern = {
id: 'duplicate-pattern',
label: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
isEligible: item => item.type !== 'wp_template_part',
modalHeader: (0,external_wp_i18n_namespaceObject._x)('Duplicate pattern', 'action label'),
RenderModal: ({
items,
closeModal
}) => {
const [item] = items;
const duplicatedProps = useDuplicatePatternProps({
pattern: item,
onSuccess: () => closeModal?.()
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, {
onClose: closeModal,
confirmLabel: (0,external_wp_i18n_namespaceObject._x)('Duplicate', 'action label'),
...duplicatedProps
});
}
};
/* harmony default export */ const duplicate_pattern = (duplicatePattern);
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/integer.js
/**
* Internal dependencies
*/
function sort(a, b, direction) {
return direction === 'asc' ? a - b : b - a;
}
function isValid(value, context) {
// TODO: this implicitely means the value is required.
if (value === '') {
return false;
}
if (!Number.isInteger(Number(value))) {
return false;
}
if (context?.elements) {
const validValues = context?.elements.map(f => f.value);
if (!validValues.includes(Number(value))) {
return false;
}
}
return true;
}
/* harmony default export */ const integer = ({
sort,
isValid,
Edit: 'integer'
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/text.js
/**
* Internal dependencies
*/
function text_sort(valueA, valueB, direction) {
return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
}
function text_isValid(value, context) {
if (context?.elements) {
const validValues = context?.elements?.map(f => f.value);
if (!validValues.includes(value)) {
return false;
}
}
return true;
}
/* harmony default export */ const field_types_text = ({
sort: text_sort,
isValid: text_isValid,
Edit: 'text'
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/datetime.js
/**
* Internal dependencies
*/
function datetime_sort(a, b, direction) {
const timeA = new Date(a).getTime();
const timeB = new Date(b).getTime();
return direction === 'asc' ? timeA - timeB : timeB - timeA;
}
function datetime_isValid(value, context) {
if (context?.elements) {
const validValues = context?.elements.map(f => f.value);
if (!validValues.includes(value)) {
return false;
}
}
return true;
}
/* harmony default export */ const datetime = ({
sort: datetime_sort,
isValid: datetime_isValid,
Edit: 'datetime'
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/field-types/index.js
/**
* Internal dependencies
*/
/**
*
* @param {FieldType} type The field type definition to get.
*
* @return A field type definition.
*/
function getFieldTypeDefinition(type) {
if ('integer' === type) {
return integer;
}
if ('text' === type) {
return field_types_text;
}
if ('datetime' === type) {
return datetime;
}
return {
sort: (a, b, direction) => {
if (typeof a === 'number' && typeof b === 'number') {
return direction === 'asc' ? a - b : b - a;
}
return direction === 'asc' ? a.localeCompare(b) : b.localeCompare(a);
},
isValid: (value, context) => {
if (context?.elements) {
const validValues = context?.elements?.map(f => f.value);
if (!validValues.includes(value)) {
return false;
}
}
return true;
},
Edit: () => null
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/datetime.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DateTime({
data,
field,
onChange,
hideLabelFromVision
}) {
const {
id,
label
} = field;
const value = field.getValue({
item: data
});
const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({
[id]: newValue
}), [id, onChange]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", {
className: "dataviews-controls__datetime",
children: [!hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend",
children: label
}), hideLabelFromVision && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "legend",
children: label
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TimePicker, {
currentTime: value,
onChange: onChangeControl,
hideLabelFromVision: true
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/integer.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Integer({
data,
field,
onChange,
hideLabelFromVision
}) {
var _field$getValue;
const {
id,
label,
description
} = field;
const value = (_field$getValue = field.getValue({
item: data
})) !== null && _field$getValue !== void 0 ? _field$getValue : '';
const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({
[id]: Number(newValue)
}), [id, onChange]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
label: label,
help: description,
value: value,
onChange: onChangeControl,
__next40pxDefaultSize: true,
hideLabelFromVision: hideLabelFromVision
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/radio.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Radio({
data,
field,
onChange,
hideLabelFromVision
}) {
const {
id,
label
} = field;
const value = field.getValue({
item: data
});
const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({
[id]: newValue
}), [id, onChange]);
if (field.elements) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
label: label,
onChange: onChangeControl,
options: field.elements,
selected: value,
hideLabelFromVision: hideLabelFromVision
});
}
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/select.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Select({
data,
field,
onChange,
hideLabelFromVision
}) {
var _field$getValue, _field$elements;
const {
id,
label
} = field;
const value = (_field$getValue = field.getValue({
item: data
})) !== null && _field$getValue !== void 0 ? _field$getValue : '';
const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({
[id]: newValue
}), [id, onChange]);
const elements = [
/*
* Value can be undefined when:
*
* - the field is not required
* - in bulk editing
*
*/
{
label: (0,external_wp_i18n_namespaceObject.__)('Select item'),
value: ''
}, ...((_field$elements = field?.elements) !== null && _field$elements !== void 0 ? _field$elements : [])];
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
label: label,
value: value,
options: elements,
onChange: onChangeControl,
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
hideLabelFromVision: hideLabelFromVision
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/text.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Text({
data,
field,
onChange,
hideLabelFromVision
}) {
const {
id,
label,
placeholder
} = field;
const value = field.getValue({
item: data
});
const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)(newValue => onChange({
[id]: newValue
}), [id, onChange]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
label: label,
placeholder: placeholder,
value: value !== null && value !== void 0 ? value : '',
onChange: onChangeControl,
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
hideLabelFromVision: hideLabelFromVision
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataform-controls/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const FORM_CONTROLS = {
datetime: DateTime,
integer: Integer,
radio: Radio,
select: Select,
text: Text
};
function getControl(field, fieldTypeDefinition) {
if (typeof field.Edit === 'function') {
return field.Edit;
}
if (typeof field.Edit === 'string') {
return getControlByType(field.Edit);
}
if (field.elements) {
return getControlByType('select');
}
if (typeof fieldTypeDefinition.Edit === 'string') {
return getControlByType(fieldTypeDefinition.Edit);
}
return fieldTypeDefinition.Edit;
}
function getControlByType(type) {
if (Object.keys(FORM_CONTROLS).includes(type)) {
return FORM_CONTROLS[type];
}
throw 'Control ' + type + ' not found';
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/normalize-fields.js
/**
* Internal dependencies
*/
/**
* Apply default values and normalize the fields config.
*
* @param fields Fields config.
* @return Normalized fields config.
*/
function normalizeFields(fields) {
return fields.map(field => {
var _field$sort, _field$isValid, _field$enableHiding, _field$enableSorting;
const fieldTypeDefinition = getFieldTypeDefinition(field.type);
const getValue = field.getValue || (({
item
}) => item[field.id]);
const sort = (_field$sort = field.sort) !== null && _field$sort !== void 0 ? _field$sort : function sort(a, b, direction) {
return fieldTypeDefinition.sort(getValue({
item: a
}), getValue({
item: b
}), direction);
};
const isValid = (_field$isValid = field.isValid) !== null && _field$isValid !== void 0 ? _field$isValid : function isValid(item, context) {
return fieldTypeDefinition.isValid(getValue({
item
}), context);
};
const Edit = getControl(field, fieldTypeDefinition);
const renderFromElements = ({
item
}) => {
const value = getValue({
item
});
return field?.elements?.find(element => element.value === value)?.label || getValue({
item
});
};
const render = field.render || (field.elements ? renderFromElements : getValue);
return {
...field,
label: field.label || field.id,
header: field.header || field.label || field.id,
getValue,
render,
sort,
isValid,
Edit,
enableHiding: (_field$enableHiding = field.enableHiding) !== null && _field$enableHiding !== void 0 ? _field$enableHiding : true,
enableSorting: (_field$enableSorting = field.enableSorting) !== null && _field$enableSorting !== void 0 ? _field$enableSorting : true
};
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/validation.js
/**
* Internal dependencies
*/
function isItemValid(item, fields, form) {
const _fields = normalizeFields(fields.filter(({
id
}) => !!form.fields?.includes(id)));
return _fields.every(field => {
return field.isValid(item, {
elements: field.elements
});
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/regular/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FormRegular({
data,
fields,
form,
onChange
}) {
const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _form$fields;
return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({
id
}) => id === fieldId)).filter(field => !!field));
}, [fields, form.fields]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4,
children: visibleFields.map(field => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, {
data: data,
field: field,
onChange: onChange
}, field.id);
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
/**
* WordPress dependencies
*/
const closeSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
})
});
/* harmony default export */ const close_small = (closeSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/panel/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DropdownHeader({
title,
onClose
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "dataforms-layouts-panel__dropdown-header",
spacing: 4,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "center",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHeading, {
level: 2,
size: 13,
children: title
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalSpacer, {}), onClose && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
label: (0,external_wp_i18n_namespaceObject.__)('Close'),
icon: close_small,
onClick: onClose,
size: "small"
})]
})
});
}
function FormField({
data,
field,
onChange
}) {
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
anchor: popoverAnchor,
placement: 'left-start',
offset: 36,
shift: true
}), [popoverAnchor]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
ref: setPopoverAnchor,
className: "dataforms-layouts-panel__field",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "dataforms-layouts-panel__field-label",
children: field.label
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
contentClassName: "dataforms-layouts-panel__field-dropdown",
popoverProps: popoverProps,
focusOnMount: true,
toggleProps: {
size: 'compact',
variant: 'tertiary',
tooltipPosition: 'middle left'
},
renderToggle: ({
isOpen,
onToggle
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "dataforms-layouts-panel__field-control",
size: "compact",
variant: "tertiary",
"aria-expanded": isOpen,
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Field name.
(0,external_wp_i18n_namespaceObject._x)('Edit %s', 'field'), field.label),
onClick: onToggle,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.render, {
item: data
})
}),
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DropdownHeader, {
title: field.label,
onClose: onClose
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(field.Edit, {
data: data,
field: field,
onChange: onChange,
hideLabelFromVision: true
}, field.id)]
})
})
})]
});
}
function FormPanel({
data,
fields,
form,
onChange
}) {
const visibleFields = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _form$fields;
return normalizeFields(((_form$fields = form.fields) !== null && _form$fields !== void 0 ? _form$fields : []).map(fieldId => fields.find(({
id
}) => id === fieldId)).filter(field => !!field));
}, [fields, form.fields]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 2,
children: visibleFields.map(field => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FormField, {
data: data,
field: field,
onChange: onChange
}, field.id);
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/dataforms-layouts/index.js
/**
* Internal dependencies
*/
const FORM_LAYOUTS = [{
type: 'regular',
component: FormRegular
}, {
type: 'panel',
component: FormPanel
}];
function getFormLayout(type) {
return FORM_LAYOUTS.find(layout => layout.type === type);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/dataviews/build-module/components/dataform/index.js
/**
* Internal dependencies
*/
function DataForm({
form,
...props
}) {
var _form$type;
const layout = getFormLayout((_form$type = form.type) !== null && _form$type !== void 0 ? _form$type : 'regular');
if (!layout) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout.component, {
form: form,
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/fields/order/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const orderField = {
type: 'integer',
id: 'menu_order',
label: (0,external_wp_i18n_namespaceObject.__)('Order'),
description: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages.')
};
/* harmony default export */ const order = (orderField);
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/base-post/reorder-page.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const fields = [order];
const formOrderAction = {
fields: ['menu_order']
};
function ReorderModal({
items,
closeModal,
onActionPerformed
}) {
const [item, setItem] = (0,external_wp_element_namespaceObject.useState)(items[0]);
const orderInput = item.menu_order;
const {
editEntityRecord,
saveEditedEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
createSuccessNotice,
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
async function onOrder(event) {
event.preventDefault();
if (!isItemValid(item, fields, formOrderAction)) {
return;
}
try {
await editEntityRecord('postType', item.type, item.id, {
menu_order: orderInput
});
closeModal?.();
// Persist edited entity.
await saveEditedEntityRecord('postType', item.type, item.id, {
throwOnError: true
});
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Order updated.'), {
type: 'snackbar'
});
onActionPerformed?.(items);
} catch (error) {
const typedError = error;
const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while updating the order');
createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
}
const isSaveDisabled = !isItemValid(item, fields, formOrderAction);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
onSubmit: onOrder,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "5",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
children: (0,external_wp_i18n_namespaceObject.__)('Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DataForm, {
data: item,
fields: fields,
form: formOrderAction,
onChange: changes => setItem({
...item,
...changes
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: () => {
closeModal?.();
},
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit",
accessibleWhenDisabled: true,
disabled: isSaveDisabled,
children: (0,external_wp_i18n_namespaceObject.__)('Save')
})]
})]
})
});
}
const reorderPage = {
id: 'order-pages',
label: (0,external_wp_i18n_namespaceObject.__)('Order'),
isEligible({
status
}) {
return status !== 'trash';
},
RenderModal: ReorderModal
};
/* harmony default export */ const reorder_page = (reorderPage);
;// CONCATENATED MODULE: ./node_modules/client-zip/index.js
"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function f(e,i){if(void 0===i||i instanceof Date||(i=new Date(i)),e instanceof File)return{isFile:1,t:i||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t:i};if("string"==typeof e)return{isFile:1,t:i,i:t(e)};if(e instanceof Blob)return{isFile:1,t:i,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t:i,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t:i,i:n(e)};if(Symbol.asyncIterator in e)return{isFile:1,t:i,i:o(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function o(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[f,o]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{o:d(f||t(e.name)),u:BigInt(e.size),l:o};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{o:d(f||t(s)),u:BigInt(u),l:o}}return f=d(f,void 0!==e||void 0!==r),"string"==typeof e?{o:f,u:BigInt(t(e).length),l:o}:e instanceof Blob?{o:f,u:BigInt(e.size),l:o}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o:f,u:BigInt(e.byteLength),l:o}:{o:f,u:u(e,r),l:o}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n^=-1;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return(-1^n)>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({o:e,l:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.o.length,1),n(r)}async function*g(e){let{i:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.m=y(n,0),e.u=BigInt(n.length);else{e.u=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.m=y(n,e.m),e.u+=BigInt(n.length),yield n}}}function I(t,r){const f=e(16+(r?8:0));return f.setUint32(0,1347094280),f.setUint32(4,t.isFile?t.m:0,1),r?(f.setBigUint64(8,t.u,1),f.setBigUint64(16,t.u,1)):(f.setUint32(8,i(t.u),1),f.setUint32(12,i(t.u),1)),n(f)}function v(t,r,f=0,o=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|f),w(t.t,a,12),a.setUint32(16,t.isFile?t.m:0,1),a.setUint32(20,i(t.u),1),a.setUint32(24,i(t.u),1),a.setUint16(28,t.o.length,1),a.setUint16(30,o,1),a.setUint16(40,t.isFile?33204:16893,1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const f=e(r);return f.setUint16(0,1,1),f.setUint16(2,r-4,1),16&r&&(f.setBigUint64(4,t.u,1),f.setBigUint64(12,t.u,1)),f.setBigUint64(r-8,i,1),n(f)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.o)throw new Error("Every file must have a non-empty name.");if(void 0===r.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.o)}".`);const e=r.u>=0xffffffffn,f=t>=0xffffffffn;t+=BigInt(46+r.o.length+(e&&8))+r.u,n+=BigInt(r.o.length+46+(12*f|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(f(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return o(async function*(t,f){const o=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,f.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.o),e.isFile&&(yield*g(e));const t=e.u>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),o.push(v(e,a,n,i)),o.push(e.o),i&&o.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.o.length)+e.u,u||(u=t)}let d=0n;for(const e of o)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)}
;// CONCATENATED MODULE: external ["wp","blob"]
const external_wp_blob_namespaceObject = window["wp"]["blob"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js
/**
* WordPress dependencies
*/
const download = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"
})
});
/* harmony default export */ const library_download = (download);
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const utils_TEMPLATE_POST_TYPE = 'wp_template';
const utils_TEMPLATE_PART_POST_TYPE = 'wp_template_part';
const utils_TEMPLATE_ORIGINS = {
custom: 'custom',
theme: 'theme',
plugin: 'plugin'
};
function utils_isTemplate(post) {
return post.type === utils_TEMPLATE_POST_TYPE;
}
function utils_isTemplatePart(post) {
return post.type === utils_TEMPLATE_PART_POST_TYPE;
}
function utils_isTemplateOrTemplatePart(p) {
return p.type === utils_TEMPLATE_POST_TYPE || p.type === utils_TEMPLATE_PART_POST_TYPE;
}
function utils_getItemTitle(item) {
if (typeof item.title === 'string') {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title);
}
if ('rendered' in item.title) {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered);
}
if ('raw' in item.title) {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw);
}
return '';
}
/**
* Check if a template is removable.
*
* @param template The template entity to check.
* @return Whether the template is removable.
*/
function utils_isTemplateRemovable(template) {
if (!template) {
return false;
}
// In patterns list page we map the templates parts to a different object
// than the one returned from the endpoint. This is why we need to check for
// two props whether is custom or has a theme file.
return [template.source, template.source].includes(utils_TEMPLATE_ORIGINS.custom) && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/pattern/export-pattern.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getJsonFromItem(item) {
return JSON.stringify({
__file: item.type,
title: utils_getItemTitle(item),
content: typeof item.content === 'string' ? item.content : item.content?.raw,
syncStatus: item.wp_pattern_sync_status
}, null, 2);
}
const exportPattern = {
id: 'export-pattern',
label: (0,external_wp_i18n_namespaceObject.__)('Export as JSON'),
icon: library_download,
supportsBulk: true,
isEligible: item => item.type === 'wp_block',
callback: async items => {
if (items.length === 1) {
return (0,external_wp_blob_namespaceObject.downloadBlob)(`${paramCase(utils_getItemTitle(items[0]) || items[0].slug)}.json`, getJsonFromItem(items[0]), 'application/json');
}
const nameCount = {};
const filesToZip = items.map(item => {
const name = paramCase(utils_getItemTitle(item) || item.slug);
nameCount[name] = (nameCount[name] || 0) + 1;
return {
name: `${name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`,
lastModified: new Date(),
input: getJsonFromItem(item)
};
});
return (0,external_wp_blob_namespaceObject.downloadBlob)((0,external_wp_i18n_namespaceObject.__)('patterns-export') + '.zip', await A(filesToZip).blob(), 'application/zip');
}
};
/* harmony default export */ const export_pattern = (exportPattern);
;// CONCATENATED MODULE: ./node_modules/@wordpress/fields/build-module/actions/common/permanently-delete-post.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const permanentlyDeletePost = {
id: 'permanently-delete',
label: (0,external_wp_i18n_namespaceObject.__)('Permanently delete'),
supportsBulk: true,
icon: library_trash,
isEligible(item) {
if (utils_isTemplateOrTemplatePart(item) || item.type === 'wp_block') {
return false;
}
const {
status,
permissions
} = item;
return status === 'trash' && permissions?.delete;
},
async callback(posts, {
registry,
onActionPerformed
}) {
const {
createSuccessNotice,
createErrorNotice
} = registry.dispatch(external_wp_notices_namespaceObject.store);
const {
deleteEntityRecord
} = registry.dispatch(external_wp_coreData_namespaceObject.store);
const promiseResult = await Promise.allSettled(posts.map(post => {
return deleteEntityRecord('postType', post.type, post.id, {
force: true
}, {
throwOnError: true
});
}));
// If all the promises were fulfilled with success.
if (promiseResult.every(({
status
}) => status === 'fulfilled')) {
let successMessage;
if (promiseResult.length === 1) {
successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The posts's title. */
(0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), utils_getItemTitle(posts[0]));
} else {
successMessage = (0,external_wp_i18n_namespaceObject.__)('The items were permanently deleted.');
}
createSuccessNotice(successMessage, {
type: 'snackbar',
id: 'permanently-delete-post-action'
});
onActionPerformed?.(posts);
} else {
// If there was at lease one failure.
let errorMessage;
// If we were trying to permanently delete a single post.
if (promiseResult.length === 1) {
const typedError = promiseResult[0];
if (typedError.reason?.message) {
errorMessage = typedError.reason.message;
} else {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the item.');
}
// If we were trying to permanently delete multiple posts
} else {
const errorMessages = new Set();
const failedPromises = promiseResult.filter(({
status
}) => status === 'rejected');
for (const failedPromise of failedPromises) {
const typedError = failedPromise;
if (typedError.reason?.message) {
errorMessages.add(typedError.reason.message);
}
}
if (errorMessages.size === 0) {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items.');
} else if (errorMessages.size === 1) {
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
(0,external_wp_i18n_namespaceObject.__)('An error occurred while permanently deleting the items: %s'), [...errorMessages][0]);
} else {
errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
(0,external_wp_i18n_namespaceObject.__)('Some errors occurred while permanently deleting the items: %s'), [...errorMessages].join(','));
}
}
createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
}
};
/* harmony default export */ const permanently_delete_post = (permanentlyDeletePost);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/actions/delete-post.js
/**
* WordPress dependencies
*/
// @ts-ignore
/**
* Internal dependencies
*/
// @ts-ignore
const {
PATTERN_TYPES: delete_post_PATTERN_TYPES
} = unlock(external_wp_patterns_namespaceObject.privateApis);
// This action is used for templates, patterns and template parts.
// Every other post type uses the similar `trashPostAction` which
// moves the post to trash.
const deletePostAction = {
id: 'delete-post',
label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
isPrimary: true,
icon: library_trash,
isEligible(post) {
if (isTemplateOrTemplatePart(post)) {
return isTemplateRemovable(post);
}
// We can only remove user patterns.
return post.type === delete_post_PATTERN_TYPES.user;
},
supportsBulk: true,
hideModalHeader: true,
RenderModal: ({
items,
closeModal,
onActionPerformed
}) => {
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
const {
removeTemplates
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "5",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %d: number of items to delete.
(0,external_wp_i18n_namespaceObject._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The template or template part's title
(0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', 'template part'), getItemTitle(items[0]))
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: closeModal,
disabled: isBusy,
accessibleWhenDisabled: true,
__next40pxDefaultSize: true,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: async () => {
setIsBusy(true);
await removeTemplates(items, {
allowUndo: false
});
onActionPerformed?.(items);
setIsBusy(false);
closeModal?.();
},
isBusy: isBusy,
disabled: isBusy,
accessibleWhenDisabled: true,
__next40pxDefaultSize: true,
children: (0,external_wp_i18n_namespaceObject.__)('Delete')
})]
})]
});
}
};
/* harmony default export */ const delete_post = (deletePostAction);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/store/private-actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function registerEntityAction(kind, name, config) {
return {
type: 'REGISTER_ENTITY_ACTION',
kind,
name,
config
};
}
function unregisterEntityAction(kind, name, actionId) {
return {
type: 'UNREGISTER_ENTITY_ACTION',
kind,
name,
actionId
};
}
function setIsReady(kind, name) {
return {
type: 'SET_IS_READY',
kind,
name
};
}
const registerPostTypeActions = postType => async ({
registry
}) => {
const isReady = unlock(registry.select(store_store)).isEntityReady('postType', postType);
if (isReady) {
return;
}
unlock(registry.dispatch(store_store)).setIsReady('postType', postType);
const postTypeConfig = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType);
const canCreate = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).canUser('create', {
kind: 'postType',
name: postType
});
const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme();
const actions = [postTypeConfig.viewable ? view_post : undefined, !!postTypeConfig?.supports?.revisions ? view_post_revisions : undefined,
// @ts-ignore
false ? 0 : undefined, postTypeConfig.slug === 'wp_template_part' && canCreate && currentTheme?.is_block_theme ? duplicate_template_part : undefined, canCreate && postTypeConfig.slug === 'wp_block' ? duplicate_pattern : undefined, postTypeConfig.supports?.title ? rename_post : undefined, postTypeConfig?.supports?.['page-attributes'] ? reorder_page : undefined, postTypeConfig.slug === 'wp_block' ? export_pattern : undefined, reset_post, restore_post, delete_post, trash_post, permanently_delete_post];
registry.batch(() => {
actions.forEach(action => {
if (!action) {
return;
}
unlock(registry.dispatch(store_store)).registerEntityAction('postType', postType, action);
});
});
(0,external_wp_hooks_namespaceObject.doAction)('core.registerPostTypeActions', postType);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/private-actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns an action object used to set which template is currently being used/edited.
*
* @param {string} id Template Id.
*
* @return {Object} Action object.
*/
function setCurrentTemplateId(id) {
return {
type: 'SET_CURRENT_TEMPLATE_ID',
id
};
}
/**
* Create a block based template.
*
* @param {Object?} template Template to create and assign.
*/
const createTemplate = template => async ({
select,
dispatch,
registry
}) => {
const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template);
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', select.getCurrentPostType(), select.getCurrentPostId(), {
template: savedTemplate.slug
});
registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), {
type: 'snackbar',
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Go back'),
onClick: () => dispatch.setRenderingMode(select.getEditorSettings().defaultRenderingMode)
}]
});
return savedTemplate;
};
/**
* Update the provided block types to be visible.
*
* @param {string[]} blockNames Names of block types to show.
*/
const showBlockTypes = blockNames => ({
registry
}) => {
var _registry$select$get;
const existingBlockNames = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type));
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', newBlockNames);
};
/**
* Update the provided block types to be hidden.
*
* @param {string[]} blockNames Names of block types to hide.
*/
const hideBlockTypes = blockNames => ({
registry
}) => {
var _registry$select$get2;
const existingBlockNames = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]);
registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'hiddenBlockTypes', [...mergedBlockNames]);
};
/**
* Save entity records marked as dirty.
*
* @param {Object} options Options for the action.
* @param {Function} [options.onSave] Callback when saving happens.
* @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.
* @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.
* @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.
*/
const saveDirtyEntities = ({
onSave,
dirtyEntityRecords = [],
entitiesToSkip = [],
close
} = {}) => ({
registry
}) => {
const PUBLISH_ON_SAVE_ENTITIES = [{
kind: 'postType',
name: 'wp_navigation'
}];
const saveNoticeId = 'site-editor-save-success';
const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home;
registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId);
const entitiesToSave = dirtyEntityRecords.filter(({
kind,
name,
key,
property
}) => {
return !entitiesToSkip.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
});
close?.(entitiesToSave);
const siteItemsToSave = [];
const pendingSavedRecords = [];
entitiesToSave.forEach(({
kind,
name,
key,
property
}) => {
if ('root' === kind && 'site' === name) {
siteItemsToSave.push(property);
} else {
if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, {
status: 'publish'
});
}
pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key));
}
});
if (siteItemsToSave.length) {
pendingSavedRecords.push(registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
}
registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent();
Promise.all(pendingSavedRecords).then(values => {
return onSave ? onSave(values) : values;
}).then(values => {
if (values.some(value => typeof value === 'undefined')) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.'));
} else {
registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
type: 'snackbar',
id: saveNoticeId,
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('View site'),
url: homeUrl
}]
});
}
}).catch(error => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`));
};
/**
* Reverts a template to its original theme-provided file.
*
* @param {Object} template The template to revert.
* @param {Object} [options]
* @param {boolean} [options.allowUndo] Whether to allow the user to undo
* reverting the template. Default true.
*/
const revertTemplate = (template, {
allowUndo = true
} = {}) => async ({
registry
}) => {
const noticeId = 'edit-site-template-reverted';
registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId);
if (!isTemplateRevertable(template)) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), {
type: 'snackbar'
});
return;
}
try {
const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type);
if (!templateEntityConfig) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
type: 'snackbar'
});
return;
}
const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
context: 'edit',
source: template.origin
});
const fileTemplate = await external_wp_apiFetch_default()({
path: fileTemplatePath
});
if (!fileTemplate) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
type: 'snackbar'
});
return;
}
const serializeBlocks = ({
blocks: blocksForSerialization = []
}) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id);
// We are fixing up the undo level here to make sure we can undo
// the revert in the header toolbar correctly.
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, {
content: serializeBlocks,
// Required to make the `undo` behave correctly.
blocks: edited.blocks,
// Required to revert the blocks in the editor.
source: 'custom' // required to avoid turning the editor into a dirty state
}, {
undoIgnore: true // Required to merge this edit with the last undo level.
});
const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw);
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, {
content: serializeBlocks,
blocks,
source: 'theme'
});
if (allowUndo) {
const undoRevert = () => {
registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, {
content: serializeBlocks,
blocks: edited.blocks,
source: 'custom'
});
};
registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reset.'), {
type: 'snackbar',
id: noticeId,
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
onClick: undoRevert
}]
});
}
} catch (error) {
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.');
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
};
/**
* Action that removes an array of templates, template parts or patterns.
*
* @param {Array} items An array of template,template part or pattern objects to remove.
*/
const removeTemplates = items => async ({
registry
}) => {
const isResetting = items.every(item => item?.has_theme_file);
const promiseResult = await Promise.allSettled(items.map(item => {
return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', item.type, item.id, {
force: true
}, {
throwOnError: true
});
}));
// If all the promises were fulfilled with sucess.
if (promiseResult.every(({
status
}) => status === 'fulfilled')) {
let successMessage;
if (items.length === 1) {
// Depending on how the entity was retrieved its title might be
// an object or simple string.
let title;
if (typeof items[0].title === 'string') {
title = items[0].title;
} else if (typeof items[0].title?.rendered === 'string') {
title = items[0].title?.rendered;
} else if (typeof items[0].title?.raw === 'string') {
title = items[0].title?.raw;
}
successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: The template/part's name. */
(0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The template/part's name. */
(0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', 'template part'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
} else {
successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('Items reset.') : (0,external_wp_i18n_namespaceObject.__)('Items deleted.');
}
registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, {
type: 'snackbar',
id: 'editor-template-deleted-success'
});
} else {
// If there was at lease one failure.
let errorMessage;
// If we were trying to delete a single template.
if (promiseResult.length === 1) {
if (promiseResult[0].reason?.message) {
errorMessage = promiseResult[0].reason.message;
} else {
errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the item.') : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the item.');
}
// If we were trying to delete a multiple templates
} else {
const errorMessages = new Set();
const failedPromises = promiseResult.filter(({
status
}) => status === 'rejected');
for (const failedPromise of failedPromises) {
if (failedPromise.reason?.message) {
errorMessages.add(failedPromise.reason.message);
}
}
if (errorMessages.size === 0) {
errorMessage = (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items.');
} else if (errorMessages.size === 1) {
errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
(0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the items: %s'), [...errorMessages][0]) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: an error message */
(0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the items: %s'), [...errorMessages][0]);
} else {
errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
(0,external_wp_i18n_namespaceObject.__)('Some errors occurred while reverting the items: %s'), [...errorMessages].join(',')) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: a list of comma separated error messages */
(0,external_wp_i18n_namespaceObject.__)('Some errors occurred while deleting the items: %s'), [...errorMessages].join(','));
}
}
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
type: 'snackbar'
});
}
};
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js
var fast_deep_equal = __webpack_require__(5215);
var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
/**
* WordPress dependencies
*/
const symbol = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
})
});
/* harmony default export */ const library_symbol = (symbol);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
/**
* WordPress dependencies
*/
const navigation = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"
})
});
/* harmony default export */ const library_navigation = (navigation);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
/**
* WordPress dependencies
*/
const page = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
})]
});
/* harmony default export */ const library_page = (page);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js
/**
* WordPress dependencies
*/
const verse = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"
})
});
/* harmony default export */ const library_verse = (verse);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/dataviews/store/private-selectors.js
/**
* Internal dependencies
*/
const EMPTY_ARRAY = [];
function getEntityActions(state, kind, name) {
var _state$actions$kind$n;
return (_state$actions$kind$n = state.actions[kind]?.[name]) !== null && _state$actions$kind$n !== void 0 ? _state$actions$kind$n : EMPTY_ARRAY;
}
function isEntityReady(state, kind, name) {
return state.isReady[kind]?.[name];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const EMPTY_INSERTION_POINT = {
rootClientId: undefined,
insertionIndex: undefined,
filterValue: undefined
};
/**
* Get the insertion point for the inserter.
*
* @param {Object} state Global application state.
*
* @return {Object} The root client ID, index to insert at and starting filter value.
*/
const getInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)(state => {
if (typeof state.blockInserterPanel === 'object') {
return state.blockInserterPanel;
}
if (getRenderingMode(state) === 'template-locked') {
const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content');
if (postContentClientId) {
return {
rootClientId: postContentClientId,
insertionIndex: undefined,
filterValue: undefined
};
}
}
return EMPTY_INSERTION_POINT;
}, state => {
const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName('core/post-content');
return [state.blockInserterPanel, getRenderingMode(state), postContentClientId];
}));
function getListViewToggleRef(state) {
return state.listViewToggleRef;
}
function getInserterSidebarToggleRef(state) {
return state.inserterSidebarToggleRef;
}
const CARD_ICONS = {
wp_block: library_symbol,
wp_navigation: library_navigation,
page: library_page,
post: library_verse
};
const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, options) => {
{
if (postType === 'wp_template_part' || postType === 'wp_template') {
return __experimentalGetDefaultTemplatePartAreas(state).find(item => options.area === item.area)?.icon || library_layout;
}
if (CARD_ICONS[postType]) {
return CARD_ICONS[postType];
}
const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType);
// `icon` is the `menu_icon` property of a post type. We
// only handle `dashicons` for now, even if the `menu_icon`
// also supports urls and svg as values.
if (typeof postTypeEntity?.icon === 'string' && postTypeEntity.icon.startsWith('dashicons-')) {
return postTypeEntity.icon.slice(10);
}
return library_page;
}
});
/**
* Returns true if there are unsaved changes to the
* post's meta fields, and false otherwise.
*
* @param {Object} state Global application state.
* @param {string} postType The post type of the post.
* @param {number} postId The ID of the post.
*
* @return {boolean} Whether there are edits or not in the meta fields of the relevant post.
*/
const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => {
const {
type: currentPostType,
id: currentPostId
} = getCurrentPost(state);
// If no postType or postId is passed, use the current post.
const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', postType || currentPostType, postId || currentPostId);
if (!edits?.meta) {
return false;
}
// Compare if anything apart from `footnotes` has changed.
const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType || currentPostType, postId || currentPostId)?.meta;
return !fast_deep_equal_default()({
...originalPostMeta,
footnotes: undefined
}, {
...edits.meta,
footnotes: undefined
});
});
function private_selectors_getEntityActions(state, ...args) {
return getEntityActions(state.dataviews, ...args);
}
function private_selectors_isEntityReady(state, ...args) {
return isEntityReady(state.dataviews, ...args);
}
/**
* Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most
* blocks that aren't descendants of the query block.
*
* @param {Object} state Global application state.
* @param {Array|string} blockNames Block names of the blocks to retrieve.
*
* @return {Array} Block client IDs.
*/
const getPostBlocksByName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, blockNames) => {
blockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
const {
getBlocksByName,
getBlockParents,
getBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
return getBlocksByName(blockNames).filter(clientId => getBlockParents(clientId).every(parentClientId => {
const parentBlockName = getBlockName(parentClientId);
return (
// Ignore descendents of the query block.
parentBlockName !== 'core/query' &&
// Enable only the top-most block.
!blockNames.includes(parentBlockName)
);
}));
}, () => [select(external_wp_blockEditor_namespaceObject.store).getBlocks()]));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Post editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
*
* @type {Object}
*/
const storeConfig = {
reducer: store_reducer,
selectors: selectors_namespaceObject,
actions: actions_namespaceObject
};
/**
* Store definition for the editor namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
...storeConfig
});
(0,external_wp_data_namespaceObject.register)(store_store);
unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject);
unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
/**
* Object whose keys are the names of block attributes, where each value
* represents the meta key to which the block attribute is intended to save.
*
* @see https://developer.wordpress.org/reference/functions/register_meta/
*
* @typedef {Object<string,string>} WPMetaAttributeMapping
*/
/**
* Given a mapping of attribute names (meta source attributes) to their
* associated meta key, returns a higher order component that overrides its
* `attributes` and `setAttributes` props to sync any changes with the edited
* post's meta keys.
*
* @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.
*
* @return {WPHigherOrderComponent} Higher-order component.
*/
const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({
attributes,
setAttributes,
...props
}) => {
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []);
const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta');
const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...attributes,
...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]]))
}), [attributes, meta]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
attributes: mergedAttributes,
setAttributes: nextAttributes => {
const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter(
// Filter to intersection of keys between the updated
// attributes and those with an associated meta key.
([key]) => key in metaAttributes).map(([attributeKey, value]) => [
// Rename the keys to the expected meta key name.
metaAttributes[attributeKey], value]));
if (Object.entries(nextMeta).length) {
setMeta(nextMeta);
}
setAttributes(nextAttributes);
},
...props
});
}, 'withMetaAttributeSource');
/**
* Filters a registered block's settings to enhance a block's `edit` component
* to upgrade meta-sourced attributes to use the post's meta entity property.
*
* @param {WPBlockSettings} settings Registered block settings.
*
* @return {WPBlockSettings} Filtered block settings.
*/
function shimAttributeSource(settings) {
var _settings$attributes;
/** @type {WPMetaAttributeMapping} */
const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, {
source
}]) => source === 'meta').map(([attributeKey, {
meta
}]) => [attributeKey, meta]));
if (Object.entries(metaAttributes).length) {
settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
}
return settings;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
/**
* WordPress dependencies
*/
/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
function getUserLabel(user) {
const avatar = user.avatar_urls && user.avatar_urls[24] ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
className: "editor-autocompleters__user-avatar",
alt: "",
src: user.avatar_urls[24]
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-autocompleters__no-avatar"
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [avatar, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-autocompleters__user-name",
children: user.name
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-autocompleters__user-slug",
children: user.slug
})]
});
}
/**
* A user mentions completer.
*
* @type {WPCompleter}
*/
/* harmony default export */ const user = ({
name: 'users',
className: 'editor-autocompleters__user',
triggerPrefix: '@',
useItems(filterValue) {
const users = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getUsers
} = select(external_wp_coreData_namespaceObject.store);
return getUsers({
context: 'view',
search: encodeURIComponent(filterValue)
});
}, [filterValue]);
const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({
key: `user-${user.slug}`,
value: user,
label: getUserLabel(user)
})) : [], [users]);
return [options];
},
getOptionCompletion(user) {
return `@${user.slug}`;
}
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function setDefaultCompleters(completers = []) {
// Provide copies so filters may directly modify them.
completers.push({
...user
});
return completers;
}
(0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
;// CONCATENATED MODULE: external ["wp","mediaUtils"]
const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js
/**
* WordPress dependencies
*/
(0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/editor/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
const {
PatternOverridesControls,
ResetOverridesControl,
PatternOverridesBlockControls,
PATTERN_TYPES: pattern_overrides_PATTERN_TYPES,
PARTIAL_SYNCING_SUPPORTED_BLOCKS,
PATTERN_SYNC_TYPES
} = unlock(external_wp_patterns_namespaceObject.privateApis);
/**
* Override the default edit UI to include a new block inspector control for
* assigning a partial syncing controls to supported blocks in the pattern editor.
* Currently, only the `core/paragraph` block is supported.
*
* @param {Component} BlockEdit Original component.
*
* @return {Component} Wrapped component.
*/
const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name];
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
...props
}, "edit"), props.isSelected && isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, {
...props
}), isSupportedBlock && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {})]
});
}, 'withPatternOverrideControls');
// Split into a separate component to avoid a store subscription
// on every block.
function ControlsWithStoreSubscription(props) {
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const {
hasPatternOverridesSource,
isEditingSyncedPattern
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostType,
getEditedPostAttribute
} = select(store_store);
return {
// For editing link to the site editor if the theme and user permissions support it.
hasPatternOverridesSource: !!(0,external_wp_blocks_namespaceObject.getBlockBindingsSource)('core/pattern-overrides'),
isEditingSyncedPattern: getCurrentPostType() === pattern_overrides_PATTERN_TYPES.user && getEditedPostAttribute('meta')?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute('wp_pattern_sync_status') !== PATTERN_SYNC_TYPES.unsynced
};
}, []);
const bindings = props.attributes.metadata?.bindings;
const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides');
const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === 'default';
const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings;
if (!hasPatternOverridesSource) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [shouldShowPatternOverridesControls && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, {
...props
}), shouldShowResetOverridesControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, {
...props
})]
});
}
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/with-pattern-override-controls', withPatternOverrideControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js
/**
* Internal dependencies
*/
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs
function clsx_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=clsx_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=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
/**
* WordPress dependencies
*/
const starFilled = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
})
});
/* harmony default export */ const star_filled = (starFilled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
/**
* WordPress dependencies
*/
const starEmpty = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
clipRule: "evenodd"
})
});
/* harmony default export */ const star_empty = (starEmpty);
;// CONCATENATED MODULE: external ["wp","viewport"]
const external_wp_viewport_namespaceObject = window["wp"]["viewport"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/deprecated.js
/**
* WordPress dependencies
*/
function normalizeComplementaryAreaScope(scope) {
if (['core/edit-post', 'core/edit-site'].includes(scope)) {
external_wp_deprecated_default()(`${scope} interface scope`, {
alternative: 'core interface scope',
hint: 'core/edit-post and core/edit-site are merging.',
version: '6.6'
});
return 'core';
}
return scope;
}
function normalizeComplementaryAreaName(scope, name) {
if (scope === 'core' && name === 'edit-site/template') {
external_wp_deprecated_default()(`edit-site/template sidebar`, {
alternative: 'edit-post/document',
version: '6.6'
});
return 'edit-post/document';
}
if (scope === 'core' && name === 'edit-site/block-inspector') {
external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, {
alternative: 'edit-post/block',
version: '6.6'
});
return 'edit-post/block';
}
return name;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Set a default complementary area.
*
* @param {string} scope Complementary area scope.
* @param {string} area Area identifier.
*
* @return {Object} Action object.
*/
const setDefaultComplementaryArea = (scope, area) => {
scope = normalizeComplementaryAreaScope(scope);
area = normalizeComplementaryAreaName(scope, area);
return {
type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
scope,
area
};
};
/**
* Enable the complementary area.
*
* @param {string} scope Complementary area scope.
* @param {string} area Area identifier.
*/
const enableComplementaryArea = (scope, area) => ({
registry,
dispatch
}) => {
// Return early if there's no area.
if (!area) {
return;
}
scope = normalizeComplementaryAreaScope(scope);
area = normalizeComplementaryAreaName(scope, area);
const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
if (!isComplementaryAreaVisible) {
registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
}
dispatch({
type: 'ENABLE_COMPLEMENTARY_AREA',
scope,
area
});
};
/**
* Disable the complementary area.
*
* @param {string} scope Complementary area scope.
*/
const disableComplementaryArea = scope => ({
registry
}) => {
scope = normalizeComplementaryAreaScope(scope);
const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
if (isComplementaryAreaVisible) {
registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
}
};
/**
* Pins an item.
*
* @param {string} scope Item scope.
* @param {string} item Item identifier.
*
* @return {Object} Action object.
*/
const pinItem = (scope, item) => ({
registry
}) => {
// Return early if there's no item.
if (!item) {
return;
}
scope = normalizeComplementaryAreaScope(scope);
item = normalizeComplementaryAreaName(scope, item);
const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
// The item is already pinned, there's nothing to do.
if (pinnedItems?.[item] === true) {
return;
}
registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
...pinnedItems,
[item]: true
});
};
/**
* Unpins an item.
*
* @param {string} scope Item scope.
* @param {string} item Item identifier.
*/
const unpinItem = (scope, item) => ({
registry
}) => {
// Return early if there's no item.
if (!item) {
return;
}
scope = normalizeComplementaryAreaScope(scope);
item = normalizeComplementaryAreaName(scope, item);
const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
...pinnedItems,
[item]: false
});
};
/**
* Returns an action object used in signalling that a feature should be toggled.
*
* @param {string} scope The feature scope (e.g. core/edit-post).
* @param {string} featureName The feature name.
*/
function toggleFeature(scope, featureName) {
return function ({
registry
}) {
external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
since: '6.0',
alternative: `dispatch( 'core/preferences' ).toggle`
});
registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
};
}
/**
* Returns an action object used in signalling that a feature should be set to
* a true or false value
*
* @param {string} scope The feature scope (e.g. core/edit-post).
* @param {string} featureName The feature name.
* @param {boolean} value The value to set.
*
* @return {Object} Action object.
*/
function setFeatureValue(scope, featureName, value) {
return function ({
registry
}) {
external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
since: '6.0',
alternative: `dispatch( 'core/preferences' ).set`
});
registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
};
}
/**
* Returns an action object used in signalling that defaults should be set for features.
*
* @param {string} scope The feature scope (e.g. core/edit-post).
* @param {Object<string, boolean>} defaults A key/value map of feature names to values.
*
* @return {Object} Action object.
*/
function setFeatureDefaults(scope, defaults) {
return function ({
registry
}) {
external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
since: '6.0',
alternative: `dispatch( 'core/preferences' ).setDefaults`
});
registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
};
}
/**
* Returns an action object used in signalling that the user opened a modal.
*
* @param {string} name A string that uniquely identifies the modal.
*
* @return {Object} Action object.
*/
function openModal(name) {
return {
type: 'OPEN_MODAL',
name
};
}
/**
* Returns an action object signalling that the user closed a modal.
*
* @return {Object} Action object.
*/
function closeModal() {
return {
type: 'CLOSE_MODAL'
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns the complementary area that is active in a given scope.
*
* @param {Object} state Global application state.
* @param {string} scope Item scope.
*
* @return {string | null | undefined} The complementary area that is active in the given scope.
*/
const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
scope = normalizeComplementaryAreaScope(scope);
const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
// Return `undefined` to indicate that the user has never toggled
// visibility, this is the vanilla default. Other code relies on this
// nuance in the return value.
if (isComplementaryAreaVisible === undefined) {
return undefined;
}
// Return `null` to indicate the user hid the complementary area.
if (isComplementaryAreaVisible === false) {
return null;
}
return state?.complementaryAreas?.[scope];
});
const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
scope = normalizeComplementaryAreaScope(scope);
const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
const identifier = state?.complementaryAreas?.[scope];
return isVisible && identifier === undefined;
});
/**
* Returns a boolean indicating if an item is pinned or not.
*
* @param {Object} state Global application state.
* @param {string} scope Scope.
* @param {string} item Item to check.
*
* @return {boolean} True if the item is pinned and false otherwise.
*/
const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
var _pinnedItems$item;
scope = normalizeComplementaryAreaScope(scope);
item = normalizeComplementaryAreaName(scope, item);
const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
});
/**
* Returns a boolean indicating whether a feature is active for a particular
* scope.
*
* @param {Object} state The store state.
* @param {string} scope The scope of the feature (e.g. core/edit-post).
* @param {string} featureName The name of the feature.
*
* @return {boolean} Is the feature enabled?
*/
const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
since: '6.0',
alternative: `select( 'core/preferences' ).get( scope, featureName )`
});
return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
});
/**
* Returns true if a modal is active, or false otherwise.
*
* @param {Object} state Global application state.
* @param {string} modalName A string that uniquely identifies the modal.
*
* @return {boolean} Whether the modal is active.
*/
function isModalActive(state, modalName) {
return state.activeModal === modalName;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
/**
* WordPress dependencies
*/
function complementaryAreas(state = {}, action) {
switch (action.type) {
case 'SET_DEFAULT_COMPLEMENTARY_AREA':
{
const {
scope,
area
} = action;
// If there's already an area, don't overwrite it.
if (state[scope]) {
return state;
}
return {
...state,
[scope]: area
};
}
case 'ENABLE_COMPLEMENTARY_AREA':
{
const {
scope,
area
} = action;
return {
...state,
[scope]: area
};
}
}
return state;
}
/**
* Reducer for storing the name of the open modal, or null if no modal is open.
*
* @param {Object} state Previous state.
* @param {Object} action Action object containing the `name` of the modal
*
* @return {Object} Updated state
*/
function activeModal(state = null, action) {
switch (action.type) {
case 'OPEN_MODAL':
return action.name;
case 'CLOSE_MODAL':
return null;
}
return state;
}
/* harmony default export */ const build_module_store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
complementaryAreas,
activeModal
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
/**
* The identifier for the data store.
*
* @type {string}
*/
const constants_STORE_NAME = 'core/interface';
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Store definition for the interface namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
reducer: build_module_store_reducer,
actions: store_actions_namespaceObject,
selectors: store_selectors_namespaceObject
});
// Once we build a more generic persistence plugin that works across types of stores
// we'd be able to replace this with a register call.
(0,external_wp_data_namespaceObject.register)(store);
;// CONCATENATED MODULE: external ["wp","plugins"]
const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
/**
* WordPress dependencies
*/
/* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
return {
icon: ownProps.icon || context.icon,
identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
};
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Whether the role supports checked state.
*
* @param {import('react').AriaRole} role Role.
* @return {boolean} Whether the role supports checked state.
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-checked
*/
function roleSupportsCheckedState(role) {
return ['checkbox', 'option', 'radio', 'switch', 'menuitemcheckbox', 'menuitemradio', 'treeitem'].includes(role);
}
function ComplementaryAreaToggle({
as = external_wp_components_namespaceObject.Button,
scope,
identifier,
icon,
selectedIcon,
name,
shortcut,
...props
}) {
const ComponentToUse = as;
const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]);
const {
enableComplementaryArea,
disableComplementaryArea
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComponentToUse, {
icon: selectedIcon && isSelected ? selectedIcon : icon,
"aria-controls": identifier.replace('/', ':')
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
,
"aria-checked": roleSupportsCheckedState(props.role) ? isSelected : undefined,
onClick: () => {
if (isSelected) {
disableComplementaryArea(scope);
} else {
enableComplementaryArea(scope, identifier);
}
},
shortcut: shortcut,
...props
});
}
/* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ComplementaryAreaHeader = ({
smallScreenTitle,
children,
className,
toggleButtonProps
}) => {
const toggleButton = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, {
icon: close_small,
...toggleButtonProps
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "components-panel__header interface-complementary-area-header__small",
children: [smallScreenTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
className: "interface-complementary-area-header__small-title",
children: smallScreenTitle
}), toggleButton]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: dist_clsx('components-panel__header', 'interface-complementary-area-header', className),
tabIndex: -1,
children: [children, toggleButton]
})]
});
};
/* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader);
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
/**
* WordPress dependencies
*/
const noop = () => {};
function ActionItemSlot({
name,
as: Component = external_wp_components_namespaceObject.ButtonGroup,
fillProps = {},
bubblesVirtually,
...props
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, {
name: name,
bubblesVirtually: bubblesVirtually,
fillProps: fillProps,
children: fills => {
if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
return null;
}
// Special handling exists for backward compatibility.
// It ensures that menu items created by plugin authors aren't
// duplicated with automatically injected menu items coming
// from pinnable plugin sidebars.
// @see https://github.com/WordPress/gutenberg/issues/14457
const initializedByPlugins = [];
external_wp_element_namespaceObject.Children.forEach(fills, ({
props: {
__unstableExplicitMenuItem,
__unstableTarget
}
}) => {
if (__unstableTarget && __unstableExplicitMenuItem) {
initializedByPlugins.push(__unstableTarget);
}
});
const children = external_wp_element_namespaceObject.Children.map(fills, child => {
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
return null;
}
return child;
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, {
...props,
children: children
});
}
});
}
function ActionItem({
name,
as: Component = external_wp_components_namespaceObject.Button,
onClick,
...props
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, {
name: name,
children: ({
onClick: fpOnClick
}) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, {
onClick: onClick || fpOnClick ? (...args) => {
(onClick || noop)(...args);
(fpOnClick || noop)(...args);
} : undefined,
...props
});
}
});
}
ActionItem.Slot = ActionItemSlot;
/* harmony default export */ const action_item = (ActionItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PluginsMenuItem = ({
// Menu item is marked with unstable prop for backward compatibility.
// They are removed so they don't leak to DOM elements.
// @see https://github.com/WordPress/gutenberg/issues/14457
__unstableExplicitMenuItem,
__unstableTarget,
...restProps
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
...restProps
});
function ComplementaryAreaMoreMenuItem({
scope,
target,
__unstableExplicitMenuItem,
...props
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, {
as: toggleProps => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(action_item, {
__unstableExplicitMenuItem: __unstableExplicitMenuItem,
__unstableTarget: `${scope}/${target}`,
as: PluginsMenuItem,
name: `${scope}/plugin-more-menu`,
...toggleProps
});
},
role: "menuitemcheckbox",
selectedIcon: library_check,
name: target,
scope: scope,
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PinnedItems({
scope,
...props
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, {
name: `PinnedItems/${scope}`,
...props
});
}
function PinnedItemsSlot({
scope,
className,
...props
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, {
name: `PinnedItems/${scope}`,
...props,
children: fills => fills?.length > 0 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: dist_clsx(className, 'interface-pinned-items'),
children: fills
})
});
}
PinnedItems.Slot = PinnedItemsSlot;
/* harmony default export */ const pinned_items = (PinnedItems);
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ANIMATION_DURATION = 0.3;
function ComplementaryAreaSlot({
scope,
...props
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, {
name: `ComplementaryArea/${scope}`,
...props
});
}
const SIDEBAR_WIDTH = 280;
const variants = {
open: {
width: SIDEBAR_WIDTH
},
closed: {
width: 0
},
mobileOpen: {
width: '100vw'
}
};
function ComplementaryAreaFill({
activeArea,
isActive,
scope,
children,
className,
id
}) {
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
// This is used to delay the exit animation to the next tick.
// The reason this is done is to allow us to apply the right transition properties
// When we switch from an open sidebar to another open sidebar.
// we don't want to animate in this case.
const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea);
const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive);
const [, setState] = (0,external_wp_element_namespaceObject.useState)({});
(0,external_wp_element_namespaceObject.useEffect)(() => {
setState({});
}, [isActive]);
const transition = {
type: 'tween',
duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION,
ease: [0.6, 0, 0.4, 1]
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, {
name: `ComplementaryArea/${scope}`,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
initial: false,
children: (previousIsActive || isActive) && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, {
variants: variants,
initial: "closed",
animate: isMobileViewport ? 'mobileOpen' : 'open',
exit: "closed",
transition: transition,
className: "interface-complementary-area__fill",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
id: id,
className: className,
style: {
width: isMobileViewport ? '100vw' : SIDEBAR_WIDTH
},
children: children
})
})
})
});
}
function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false);
const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false);
const {
enableComplementaryArea,
disableComplementaryArea
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// If the complementary area is active and the editor is switching from
// a big to a small window size.
if (isActive && isSmall && !previousIsSmallRef.current) {
disableComplementaryArea(scope);
// Flag the complementary area to be reopened when the window size
// goes from small to big.
shouldOpenWhenNotSmallRef.current = true;
} else if (
// If there is a flag indicating the complementary area should be
// enabled when we go from small to big window size and we are going
// from a small to big window size.
shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current) {
// Remove the flag indicating the complementary area should be
// enabled.
shouldOpenWhenNotSmallRef.current = false;
enableComplementaryArea(scope, identifier);
} else if (
// If the flag is indicating the current complementary should be
// reopened but another complementary area becomes active, remove
// the flag.
shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier) {
shouldOpenWhenNotSmallRef.current = false;
}
if (isSmall !== previousIsSmallRef.current) {
previousIsSmallRef.current = isSmall;
}
}, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]);
}
function ComplementaryArea({
children,
className,
closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
identifier,
header,
headerClassName,
icon,
isPinnable = true,
panelClassName,
scope,
name,
smallScreenTitle,
title,
toggleShortcut,
isActiveByDefault
}) {
// This state is used to delay the rendering of the Fill
// until the initial effect runs.
// This prevents the animation from running on mount if
// the complementary area is active by default.
const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false);
const {
isLoading,
isActive,
isPinned,
activeArea,
isSmall,
isLarge,
showIconLabels
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getActiveComplementaryArea,
isComplementaryAreaLoading,
isItemPinned
} = select(store);
const {
get
} = select(external_wp_preferences_namespaceObject.store);
const _activeArea = getActiveComplementaryArea(scope);
return {
isLoading: isComplementaryAreaLoading(scope),
isActive: _activeArea === identifier,
isPinned: isItemPinned(scope, identifier),
activeArea: _activeArea,
isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'),
showIconLabels: get('core', 'showIconLabels')
};
}, [identifier, scope]);
useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
const {
enableComplementaryArea,
disableComplementaryArea,
pinItem,
unpinItem
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Set initial visibility: For large screens, enable if it's active by
// default. For small screens, always initially disable.
if (isActiveByDefault && activeArea === undefined && !isSmall) {
enableComplementaryArea(scope, identifier);
} else if (activeArea === undefined && isSmall) {
disableComplementaryArea(scope, identifier);
}
setIsReady(true);
}, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]);
if (!isReady) {
return;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items, {
scope: scope,
children: isPinned && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_toggle, {
scope: scope,
identifier: identifier,
isPressed: isActive && (!showIconLabels || isLarge),
"aria-expanded": isActive,
"aria-disabled": isLoading,
label: title,
icon: showIconLabels ? library_check : icon,
showTooltip: !showIconLabels,
variant: showIconLabels ? 'tertiary' : undefined,
size: "compact",
shortcut: toggleShortcut
})
}), name && isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem, {
target: name,
scope: scope,
icon: icon,
children: title
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ComplementaryAreaFill, {
activeArea: activeArea,
isActive: isActive,
className: dist_clsx('interface-complementary-area', className),
scope: scope,
id: identifier.replace('/', ':'),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_header, {
className: headerClassName,
closeLabel: closeLabel,
onClose: () => disableComplementaryArea(scope),
smallScreenTitle: smallScreenTitle,
toggleButtonProps: {
label: closeLabel,
size: 'small',
shortcut: toggleShortcut,
scope,
identifier
},
children: header || /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
className: "interface-complementary-area-header__title",
children: title
}), isPinnable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
className: "interface-complementary-area__pin-unpin-item",
icon: isPinned ? star_filled : star_empty,
label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
isPressed: isPinned,
"aria-expanded": isPinned,
size: "compact"
})]
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, {
className: panelClassName,
children: children
})]
})]
});
}
const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
/* harmony default export */ const complementary_area = (ComplementaryAreaWrapped);
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js
/**
* WordPress dependencies
*/
const FullscreenMode = ({
isActive
}) => {
(0,external_wp_element_namespaceObject.useEffect)(() => {
let isSticky = false;
// `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
// `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
// even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
// a consequence of the FullscreenMode setup.
if (document.body.classList.contains('sticky-menu')) {
isSticky = true;
document.body.classList.remove('sticky-menu');
}
return () => {
if (isSticky) {
document.body.classList.add('sticky-menu');
}
};
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isActive) {
document.body.classList.add('is-fullscreen-mode');
} else {
document.body.classList.remove('is-fullscreen-mode');
}
return () => {
if (isActive) {
document.body.classList.remove('is-fullscreen-mode');
}
};
}, [isActive]);
return null;
};
/* harmony default export */ const fullscreen_mode = (FullscreenMode);
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)(({
children,
className,
ariaLabel,
as: Tag = 'div',
...props
}, ref) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tag, {
ref: ref,
className: dist_clsx('interface-navigable-region', className),
"aria-label": ariaLabel,
role: "region",
tabIndex: "-1",
...props,
children: children
});
});
NavigableRegion.displayName = 'NavigableRegion';
/* harmony default export */ const navigable_region = (NavigableRegion);
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const interface_skeleton_ANIMATION_DURATION = 0.25;
const commonTransition = {
type: 'tween',
duration: interface_skeleton_ANIMATION_DURATION,
ease: [0.6, 0, 0.4, 1]
};
function useHTMLClass(className) {
(0,external_wp_element_namespaceObject.useEffect)(() => {
const element = document && document.querySelector(`html:not(.${className})`);
if (!element) {
return;
}
element.classList.toggle(className);
return () => {
element.classList.toggle(className);
};
}, [className]);
}
const headerVariants = {
hidden: {
opacity: 1,
marginTop: -60
},
visible: {
opacity: 1,
marginTop: 0
},
distractionFreeHover: {
opacity: 1,
marginTop: 0,
transition: {
...commonTransition,
delay: 0.2,
delayChildren: 0.2
}
},
distractionFreeHidden: {
opacity: 0,
marginTop: -60
},
distractionFreeDisabled: {
opacity: 0,
marginTop: 0,
transition: {
...commonTransition,
delay: 0.8,
delayChildren: 0.8
}
}
};
function InterfaceSkeleton({
isDistractionFree,
footer,
header,
editorNotices,
sidebar,
secondarySidebar,
content,
actions,
labels,
className
}, ref) {
const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
const defaultTransition = {
type: 'tween',
duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION,
ease: [0.6, 0, 0.4, 1]
};
useHTMLClass('interface-interface-skeleton__html-container');
const defaultLabels = {
/* translators: accessibility text for the top bar landmark region. */
header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'),
/* translators: accessibility text for the content landmark region. */
body: (0,external_wp_i18n_namespaceObject.__)('Content'),
/* translators: accessibility text for the secondary sidebar landmark region. */
secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
/* translators: accessibility text for the settings landmark region. */
sidebar: (0,external_wp_i18n_namespaceObject._x)('Settings', 'settings landmark area'),
/* translators: accessibility text for the publish landmark region. */
actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
/* translators: accessibility text for the footer landmark region. */
footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
};
const mergedLabels = {
...defaultLabels,
...labels
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
ref: ref,
className: dist_clsx(className, 'interface-interface-skeleton', !!footer && 'has-footer'),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "interface-interface-skeleton__editor",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
initial: false,
children: !!header && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, {
as: external_wp_components_namespaceObject.__unstableMotion.div,
className: "interface-interface-skeleton__header",
"aria-label": mergedLabels.header,
initial: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden',
whileHover: isDistractionFree && !isMobileViewport ? 'distractionFreeHover' : 'visible',
animate: isDistractionFree && !isMobileViewport ? 'distractionFreeDisabled' : 'visible',
exit: isDistractionFree && !isMobileViewport ? 'distractionFreeHidden' : 'hidden',
variants: headerVariants,
transition: defaultTransition,
children: header
})
}), isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "interface-interface-skeleton__header",
children: editorNotices
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "interface-interface-skeleton__body",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
initial: false,
children: !!secondarySidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, {
className: "interface-interface-skeleton__secondary-sidebar",
ariaLabel: mergedLabels.secondarySidebar,
as: external_wp_components_namespaceObject.__unstableMotion.div,
initial: "closed",
animate: "open",
exit: "closed",
variants: {
open: {
width: secondarySidebarSize.width
},
closed: {
width: 0
}
},
transition: defaultTransition,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
style: {
position: 'absolute',
width: isMobileViewport ? '100vw' : 'fit-content',
height: '100%',
left: 0
},
variants: {
open: {
x: 0
},
closed: {
x: '-100%'
}
},
transition: defaultTransition,
children: [secondarySidebarResizeListener, secondarySidebar]
})
})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, {
className: "interface-interface-skeleton__content",
ariaLabel: mergedLabels.body,
children: content
}), !!sidebar && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, {
className: "interface-interface-skeleton__sidebar",
ariaLabel: mergedLabels.sidebar,
children: sidebar
}), !!actions && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, {
className: "interface-interface-skeleton__actions",
ariaLabel: mergedLabels.actions,
children: actions
})]
})]
}), !!footer && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(navigable_region, {
className: "interface-interface-skeleton__footer",
ariaLabel: mergedLabels.footer,
children: footer
})]
});
}
/* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Handles the keyboard shortcuts for the editor.
*
* It provides functionality for various keyboard shortcuts such as toggling editor mode,
* toggling distraction-free mode, undo/redo, saving the post, toggling list view,
* and toggling the sidebar.
*/
function EditorKeyboardShortcuts() {
const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
richEditingEnabled,
codeEditingEnabled
} = select(store_store).getEditorSettings();
return !richEditingEnabled || !codeEditingEnabled;
}, []);
const {
getBlockSelectionStart
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
getActiveComplementaryArea
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
enableComplementaryArea,
disableComplementaryArea
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
redo,
undo,
savePost,
setIsListViewOpened,
switchEditorMode,
toggleDistractionFree
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const {
isEditedPostDirty,
isPostSavingLocked,
isListViewOpened,
getEditorMode
} = (0,external_wp_data_namespaceObject.useSelect)(store_store);
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-mode', () => {
switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
}, {
isDisabled: isModeToggleDisabled
});
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-distraction-free', () => {
toggleDistractionFree();
});
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => {
undo();
event.preventDefault();
});
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => {
redo();
event.preventDefault();
});
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => {
event.preventDefault();
/**
* Do not save the post if post saving is locked.
*/
if (isPostSavingLocked()) {
return;
}
// TODO: This should be handled in the `savePost` effect in
// considering `isSaveable`. See note on `isEditedPostSaveable`
// selector about dirtiness and meta-boxes.
//
// See: `isEditedPostSaveable`
if (!isEditedPostDirty()) {
return;
}
savePost();
});
// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-list-view', event => {
if (!isListViewOpened()) {
event.preventDefault();
setIsListViewOpened(true);
}
});
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/toggle-sidebar', event => {
// This shortcut has no known clashes, but use preventDefault to prevent any
// obscure shortcuts from triggering.
event.preventDefault();
const isEditorSidebarOpened = ['edit-post/document', 'edit-post/block'].includes(getActiveComplementaryArea('core'));
if (isEditorSidebarOpened) {
disableComplementaryArea('core');
} else {
const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
enableComplementaryArea('core', sidebarToOpen);
}
});
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
}
componentDidMount() {
if (!this.props.disableIntervalChecks) {
this.setAutosaveTimer();
}
}
componentDidUpdate(prevProps) {
if (this.props.disableIntervalChecks) {
if (this.props.editsReference !== prevProps.editsReference) {
this.props.autosave();
}
return;
}
if (this.props.interval !== prevProps.interval) {
clearTimeout(this.timerId);
this.setAutosaveTimer();
}
if (!this.props.isDirty) {
this.needsAutosave = false;
return;
}
if (this.props.isAutosaving && !prevProps.isAutosaving) {
this.needsAutosave = false;
return;
}
if (this.props.editsReference !== prevProps.editsReference) {
this.needsAutosave = true;
}
}
componentWillUnmount() {
clearTimeout(this.timerId);
}
setAutosaveTimer(timeout = this.props.interval * 1000) {
this.timerId = setTimeout(() => {
this.autosaveTimerHandler();
}, timeout);
}
autosaveTimerHandler() {
if (!this.props.isAutosaveable) {
this.setAutosaveTimer(1000);
return;
}
if (this.needsAutosave) {
this.needsAutosave = false;
this.props.autosave();
}
this.setAutosaveTimer();
}
render() {
return null;
}
}
/**
* Monitors the changes made to the edited post and triggers autosave if necessary.
*
* The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
* The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
* the specific way of detecting changes.
*
* There are two caveats:
* * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
* * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
*
* @param {Object} props - The properties passed to the component.
* @param {Function} props.autosave - The function to call when changes need to be saved.
* @param {number} props.interval - The maximum time in seconds between an unsaved change and an autosave.
* @param {boolean} props.isAutosaveable - If false, the check for changes is retried every second.
* @param {boolean} props.disableIntervalChecks - If true, disables the timer and any change will immediately trigger `props.autosave()`.
* @param {boolean} props.isDirty - Indicates if there are unsaved changes.
*
* @example
* ```jsx
* <AutosaveMonitor interval={30000} />
* ```
*/
/* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
const {
getReferenceByDistinctEdits
} = select(external_wp_coreData_namespaceObject.store);
const {
isEditedPostDirty,
isEditedPostAutosaveable,
isAutosavingPost,
getEditorSettings
} = select(store_store);
const {
interval = getEditorSettings().autosaveInterval
} = ownProps;
return {
editsReference: getReferenceByDistinctEdits(),
isDirty: isEditedPostDirty(),
isAutosaveable: isEditedPostAutosaveable(),
isAutosaving: isAutosavingPost(),
interval
};
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
autosave() {
const {
autosave = dispatch(store_store).autosave
} = ownProps;
autosave();
}
}))])(AutosaveMonitor));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
/**
* WordPress dependencies
*/
const chevronRightSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"
})
});
/* harmony default export */ const chevron_right_small = (chevronRightSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
/**
* WordPress dependencies
*/
const chevronLeftSmall = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
})
});
/* harmony default export */ const chevron_left_small = (chevronLeftSmall);
;// CONCATENATED MODULE: external ["wp","keycodes"]
const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
;// CONCATENATED MODULE: external ["wp","commands"]
const external_wp_commands_namespaceObject = window["wp"]["commands"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import("@wordpress/components").IconType} IconType */
const MotionButton = (0,external_wp_components_namespaceObject.__unstableMotion)(external_wp_components_namespaceObject.Button);
/**
* This component renders a navigation bar at the top of the editor. It displays the title of the current document,
* a back button (if applicable), and a command center button. It also handles different states of the document,
* such as "not found" or "unsynced".
*
* @example
* ```jsx
* <DocumentBar />
* ```
* @param {Object} props The component props.
* @param {string} props.title A title for the document, defaulting to the document or
* template title currently being edited.
* @param {IconType} props.icon An icon for the document, no default.
* (A default icon indicating the document post type is no longer used.)
*
* @return {JSX.Element} The rendered DocumentBar component.
*/
function DocumentBar(props) {
const {
postType,
postTypeLabel,
documentTitle,
isNotFound,
isUnsyncedPattern,
templateTitle,
onNavigateToPreviousEntityRecord
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostType,
getCurrentPostId,
getEditorSettings,
__experimentalGetTemplateInfo: getTemplateInfo
} = select(store_store);
const {
getEditedEntityRecord,
getPostType,
isResolving: isResolvingSelector
} = select(external_wp_coreData_namespaceObject.store);
const _postType = getCurrentPostType();
const _postId = getCurrentPostId();
const _document = getEditedEntityRecord('postType', _postType, _postId);
const _templateInfo = getTemplateInfo(_document);
const _postTypeLabel = getPostType(_postType)?.labels?.singular_name;
return {
postType: _postType,
postTypeLabel: _postTypeLabel,
documentTitle: _document.title,
isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId),
isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',
templateTitle: _templateInfo.title,
onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord
};
}, []);
const {
open: openCommandCenter
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store);
const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
const isTemplate = TEMPLATE_POST_TYPES.includes(postType);
const isGlobalEntity = GLOBAL_POST_TYPES.includes(postType);
const hasBackButton = !!onNavigateToPreviousEntityRecord;
const entityTitle = isTemplate ? templateTitle : documentTitle;
const title = props.title || entityTitle;
const icon = props.icon;
const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
mountedRef.current = true;
}, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: dist_clsx('editor-document-bar', {
'has-back-button': hasBackButton,
'is-global': isGlobalEntity && !isUnsyncedPattern
}),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, {
children: hasBackButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MotionButton, {
className: "editor-document-bar__back",
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small,
onClick: event => {
event.stopPropagation();
onNavigateToPreviousEntityRecord();
},
size: "compact",
initial: mountedRef.current ? {
opacity: 0,
transform: 'translateX(15%)'
} : false // Don't show entry animation when DocumentBar mounts.
,
animate: {
opacity: 1,
transform: 'translateX(0%)'
},
exit: {
opacity: 0,
transform: 'translateX(15%)'
},
transition: isReducedMotion ? {
duration: 0
} : undefined,
children: (0,external_wp_i18n_namespaceObject.__)('Back')
})
}), isNotFound ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
children: (0,external_wp_i18n_namespaceObject.__)('Document not found')
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Button, {
className: "editor-document-bar__command",
onClick: () => openCommandCenter(),
size: "compact",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__unstableMotion.div, {
className: "editor-document-bar__title"
// Force entry animation when the back button is added or removed.
,
initial: mountedRef.current ? {
opacity: 0,
transform: hasBackButton ? 'translateX(15%)' : 'translateX(-15%)'
} : false // Don't show entry animation when DocumentBar mounts.
,
animate: {
opacity: 1,
transform: 'translateX(0%)'
},
transition: isReducedMotion ? {
duration: 0
} : undefined,
children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: icon
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, {
size: "body",
as: "h1",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-document-bar__post-title",
children: title ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) : (0,external_wp_i18n_namespaceObject.__)('No title')
}), postTypeLabel && !props.title && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-document-bar__post-type-label",
children: '· ' + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTypeLabel)
})]
})]
}, hasBackButton), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-document-bar__shortcut",
children: external_wp_keycodes_namespaceObject.displayShortcut.primary('k')
})]
})]
});
}
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
/**
* External dependencies
*/
const TableOfContentsItem = ({
children,
isValid,
level,
href,
onSelect
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
className: dist_clsx('document-outline__item', `is-${level.toLowerCase()}`, {
'is-invalid': !isValid
}),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("a", {
href: href,
className: "document-outline__button",
onClick: onSelect,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "document-outline__emdash",
"aria-hidden": "true"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
className: "document-outline__level",
children: level
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "document-outline__item-content",
children: children
})]
})
});
/* harmony default export */ const document_outline_item = (TableOfContentsItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module constants
*/
const emptyHeadingContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
children: (0,external_wp_i18n_namespaceObject.__)('(Empty heading)')
});
const incorrectLevelContent = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
children: (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)')
}, "incorrect-message")];
const singleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
children: (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)')
}, "incorrect-message-h1")];
const multipleH1Headings = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("em", {
children: (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)')
}, "incorrect-message-multiple-h1")];
function EmptyOutlineIllustration() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, {
width: "138",
height: "148",
viewBox: "0 0 138 148",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
width: "138",
height: "148",
rx: "4",
fill: "#F0F6FC"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
x1: "44",
y1: "28",
x2: "24",
y2: "28",
stroke: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
x: "48",
y: "16",
width: "27",
height: "23",
rx: "4",
fill: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",
fill: "black"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
x1: "55",
y1: "59",
x2: "24",
y2: "59",
stroke: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
x: "59",
y: "47",
width: "29",
height: "23",
rx: "4",
fill: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",
fill: "black"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
x1: "80",
y1: "90",
x2: "24",
y2: "90",
stroke: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
x: "84",
y: "78",
width: "30",
height: "23",
rx: "4",
fill: "#F0B849"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",
fill: "black"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, {
x1: "66",
y1: "121",
x2: "24",
y2: "121",
stroke: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, {
x: "70",
y: "109",
width: "29",
height: "23",
rx: "4",
fill: "#DDDDDD"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",
fill: "black"
})]
});
}
/**
* Returns an array of heading blocks enhanced with the following properties:
* level - An integer with the heading level.
* isEmpty - Flag indicating if the heading has no content.
*
* @param {?Array} blocks An array of blocks.
*
* @return {Array} An array of heading blocks enhanced with the properties described above.
*/
const computeOutlineHeadings = (blocks = []) => {
return blocks.flatMap((block = {}) => {
if (block.name === 'core/heading') {
return {
...block,
level: block.attributes.level,
isEmpty: isEmptyHeading(block)
};
}
return computeOutlineHeadings(block.innerBlocks);
});
};
const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.trim().length === 0;
/**
* Renders a document outline component.
*
* @param {Object} props Props.
* @param {Function} props.onSelect Function to be called when an outline item is selected.
* @param {boolean} props.isTitleSupported Indicates whether the title is supported.
* @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
*
* @return {Component} The component to be rendered.
*/
function DocumentOutline({
onSelect,
isTitleSupported,
hasOutlineItemsDisabled
}) {
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
blocks,
title
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _postType$supports$ti;
const {
getBlocks
} = select(external_wp_blockEditor_namespaceObject.store);
const {
getEditedPostAttribute
} = select(store_store);
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
const postType = getPostType(getEditedPostAttribute('type'));
return {
title: getEditedPostAttribute('title'),
blocks: getBlocks(),
isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false
};
});
const headings = computeOutlineHeadings(blocks);
if (headings.length < 1) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-document-outline has-no-headings",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.')
})]
});
}
let prevHeadingLevel = 1;
// Not great but it's the simplest way to locate the title right now.
const titleNode = document.querySelector('.editor-post-title__input');
const hasTitle = isTitleSupported && title && titleNode;
const countByLevel = headings.reduce((acc, heading) => ({
...acc,
[heading.level]: (acc[heading.level] || 0) + 1
}), {});
const hasMultipleH1 = countByLevel[1] > 1;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "document-outline",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", {
children: [hasTitle && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(document_outline_item, {
level: (0,external_wp_i18n_namespaceObject.__)('Title'),
isValid: true,
onSelect: onSelect,
href: `#${titleNode.id}`,
isDisabled: hasOutlineItemsDisabled,
children: title
}), headings.map((item, index) => {
// Headings remain the same, go up by one, or down by any amount.
// Otherwise there are missing levels.
const isIncorrectLevel = item.level > prevHeadingLevel + 1;
const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
prevHeadingLevel = item.level;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(document_outline_item, {
level: `H${item.level}`,
isValid: isValid,
isDisabled: hasOutlineItemsDisabled,
href: `#block-${item.clientId}`,
onSelect: () => {
selectBlock(item.clientId);
onSelect?.();
},
children: [item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({
html: item.attributes.content
})), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings]
}, index);
})]
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
/**
* WordPress dependencies
*/
/**
* Component check if there are any headings (core/heading blocks) present in the document.
*
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered.
*
* @return {Component|null} The component to be rendered or null if there are headings.
*/
function DocumentOutlineCheck({
children
}) {
const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getGlobalBlockCount
} = select(external_wp_blockEditor_namespaceObject.store);
return getGlobalBlockCount('core/heading') > 0;
});
if (hasHeadings) {
return null;
}
return children;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
/**
* WordPress dependencies
*/
/**
* Component for registering editor keyboard shortcuts.
*
* @return {Element} The component to be rendered.
*/
function EditorKeyboardShortcutsRegister() {
// Registering the shortcuts.
const {
registerShortcut
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
registerShortcut({
name: 'core/editor/toggle-mode',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
keyCombination: {
modifier: 'secondary',
character: 'm'
}
});
registerShortcut({
name: 'core/editor/save',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
keyCombination: {
modifier: 'primary',
character: 's'
}
});
registerShortcut({
name: 'core/editor/undo',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
keyCombination: {
modifier: 'primary',
character: 'z'
}
});
registerShortcut({
name: 'core/editor/redo',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
keyCombination: {
modifier: 'primaryShift',
character: 'z'
},
// Disable on Apple OS because it conflicts with the browser's
// history shortcut. It's a fine alias for both Windows and Linux.
// Since there's no conflict for Ctrl+Shift+Z on both Windows and
// Linux, we keep it as the default for consistency.
aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{
modifier: 'primary',
character: 'y'
}]
});
registerShortcut({
name: 'core/editor/toggle-list-view',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Open the List View.'),
keyCombination: {
modifier: 'access',
character: 'o'
}
});
registerShortcut({
name: 'core/editor/toggle-distraction-free',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free mode.'),
keyCombination: {
modifier: 'primaryShift',
character: '\\'
}
});
registerShortcut({
name: 'core/editor/toggle-sidebar',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'),
keyCombination: {
modifier: 'primaryShift',
character: ','
}
});
registerShortcut({
name: 'core/editor/keyboard-shortcuts',
category: 'main',
description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
keyCombination: {
modifier: 'access',
character: 'h'
}
});
registerShortcut({
name: 'core/editor/next-region',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
keyCombination: {
modifier: 'ctrl',
character: '`'
},
aliases: [{
modifier: 'access',
character: 'n'
}]
});
registerShortcut({
name: 'core/editor/previous-region',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
keyCombination: {
modifier: 'ctrlShift',
character: '`'
},
aliases: [{
modifier: 'access',
character: 'p'
}, {
modifier: 'ctrlShift',
character: '~'
}]
});
}, [registerShortcut]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {});
}
/* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
/**
* WordPress dependencies
*/
const redo_redo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
})
});
/* harmony default export */ const library_redo = (redo_redo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
/**
* WordPress dependencies
*/
const undo_undo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
})
});
/* harmony default export */ const library_undo = (undo_undo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function EditorHistoryRedo(props, ref) {
const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []);
const {
redo
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
...props,
ref: ref,
icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
/* translators: button label text should, if possible, be under 16 characters. */,
label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
shortcut: shortcut
// If there are no redo levels we don't want to actually disable this
// button, because it will remove focus for keyboard users.
// See: https://github.com/WordPress/gutenberg/issues/3486
,
"aria-disabled": !hasRedo,
onClick: hasRedo ? redo : undefined,
className: "editor-history__redo"
});
}
/** @typedef {import('react').Ref<HTMLElement>} Ref */
/**
* Renders the redo button for the editor history.
*
* @param {Object} props - Props.
* @param {Ref} ref - Forwarded ref.
*
* @return {Component} The component to be rendered.
*/
/* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function EditorHistoryUndo(props, ref) {
const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []);
const {
undo
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
...props,
ref: ref,
icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
/* translators: button label text should, if possible, be under 16 characters. */,
label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z')
// If there are no undo levels we don't want to actually disable this
// button, because it will remove focus for keyboard users.
// See: https://github.com/WordPress/gutenberg/issues/3486
,
"aria-disabled": !hasUndo,
onClick: hasUndo ? undo : undefined,
className: "editor-history__undo"
});
}
/** @typedef {import('react').Ref<HTMLElement>} Ref */
/**
* Renders the undo button for the editor history.
*
* @param {Object} props - Props.
* @param {Ref} ref - Forwarded ref.
*
* @return {Component} The component to be rendered.
*/
/* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
/**
* WordPress dependencies
*/
function TemplateValidationNotice() {
const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
const isValid = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate();
}, []);
const {
setTemplateValidity,
synchronizeTemplate
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
if (isValid) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
className: "editor-template-validation-notice",
isDismissible: false,
status: "warning",
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'),
onClick: () => setTemplateValidity(true)
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'),
onClick: () => setShowConfirmDialog(true)
}],
children: (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
isOpen: showConfirmDialog,
confirmButtonText: (0,external_wp_i18n_namespaceObject.__)('Reset'),
onConfirm: () => {
setShowConfirmDialog(false);
synchronizeTemplate();
},
onCancel: () => setShowConfirmDialog(false),
size: "medium",
children: (0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?')
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* This component renders the notices displayed in the editor. It displays pinned notices first, followed by dismissible
*
* @example
* ```jsx
* <EditorNotices />
* ```
*
* @return {JSX.Element} The rendered EditorNotices component.
*/
function EditorNotices() {
const {
notices
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
notices: select(external_wp_notices_namespaceObject.store).getNotices()
}), []);
const {
removeNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const dismissibleNotices = notices.filter(({
isDismissible,
type
}) => isDismissible && type === 'default');
const nonDismissibleNotices = notices.filter(({
isDismissible,
type
}) => !isDismissible && type === 'default');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, {
notices: nonDismissibleNotices,
className: "components-editor-notices__pinned"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.NoticeList, {
notices: dismissibleNotices,
className: "components-editor-notices__dismissible",
onRemove: removeNotice,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {})
})]
});
}
/* harmony default export */ const editor_notices = (EditorNotices);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
/**
* WordPress dependencies
*/
// Last three notices. Slices from the tail end of the list.
const MAX_VISIBLE_NOTICES = -3;
/**
* Renders the editor snackbars component.
*
* @return {JSX.Element} The rendered component.
*/
function EditorSnackbars() {
const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []);
const {
removeNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const snackbarNotices = notices.filter(({
type
}) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SnackbarList, {
notices: snackbarNotices,
className: "components-editor-notices__snackbar",
onRemove: removeNotice
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function EntityRecordItem({
record,
checked,
onChange
}) {
const {
name,
kind,
title,
key
} = record;
// Handle templates that might use default descriptive titles.
const {
entityRecordTitle,
hasPostMetaChanges
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if ('postType' !== kind || 'wp_template' !== name) {
return {
entityRecordTitle: title,
hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key)
};
}
const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key);
return {
entityRecordTitle: select(store_store).__experimentalGetTemplateInfo(template).title,
hasPostMetaChanges: unlock(select(store_store)).hasPostMetaChanges(name, key)
};
}, [name, kind, title, key]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled'),
checked: checked,
onChange: onChange
})
}), hasPostMetaChanges && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
className: "entities-saved-states__changes",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
children: (0,external_wp_i18n_namespaceObject.__)('Post Meta.')
})
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
getGlobalStylesChanges,
GlobalStylesContext
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function getEntityDescription(entity, count) {
switch (entity) {
case 'site':
return 1 === count ? (0,external_wp_i18n_namespaceObject.__)('This change will affect your whole site.') : (0,external_wp_i18n_namespaceObject.__)('These changes will affect your whole site.');
case 'wp_template':
return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.');
case 'page':
case 'post':
return (0,external_wp_i18n_namespaceObject.__)('The following has been modified.');
}
}
function GlobalStylesDescription({
record
}) {
const {
user: currentEditorGlobalStyles
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
const savedRecord = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecord(record.kind, record.name, record.key), [record.kind, record.name, record.key]);
const globalStylesChanges = getGlobalStylesChanges(currentEditorGlobalStyles, savedRecord, {
maxResults: 10
});
return globalStylesChanges.length ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
className: "entities-saved-states__changes",
children: globalStylesChanges.map(change => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
children: change
}, change))
}) : null;
}
function EntityDescription({
record,
count
}) {
if ('globalStyles' === record?.name) {
return null;
}
const description = getEntityDescription(record?.name, count);
return description ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
children: description
}) : null;
}
function EntityTypeList({
list,
unselectedEntities,
setUnselectedEntities
}) {
const count = list.length;
const firstRecord = list[0];
const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
let entityLabel = entityConfig.label;
if (firstRecord?.name === 'wp_template_part') {
entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts');
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
title: entityLabel,
initialOpen: true,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, {
record: firstRecord,
count: count
}), list.map(record => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityRecordItem, {
record: record,
checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
onChange: value => setUnselectedEntities(record, value)
}, record.key || record.property);
}), 'globalStyles' === firstRecord?.name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, {
record: firstRecord
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js
/**
* WordPress dependencies
*/
/**
* Custom hook that determines if any entities are dirty (edited) and provides a way to manage selected/unselected entities.
*
* @return {Object} An object containing the following properties:
* - dirtyEntityRecords: An array of dirty entity records.
* - isDirty: A boolean indicating if there are any dirty entity records.
* - setUnselectedEntities: A function to set the unselected entities.
* - unselectedEntities: An array of unselected entities.
*/
const useIsDirty = () => {
const {
editedEntities,
siteEdits,
siteEntityConfig
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
__experimentalGetDirtyEntityRecords,
getEntityRecordEdits,
getEntityConfig
} = select(external_wp_coreData_namespaceObject.store);
return {
editedEntities: __experimentalGetDirtyEntityRecords(),
siteEdits: getEntityRecordEdits('root', 'site'),
siteEntityConfig: getEntityConfig('root', 'site')
};
}, []);
const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _siteEntityConfig$met;
// Remove site object and decouple into its edited pieces.
const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site'));
const siteEntityLabels = (_siteEntityConfig$met = siteEntityConfig?.meta?.labels) !== null && _siteEntityConfig$met !== void 0 ? _siteEntityConfig$met : {};
const editedSiteEntities = [];
for (const property in siteEdits) {
editedSiteEntities.push({
kind: 'root',
name: 'site',
title: siteEntityLabels[property] || property,
property
});
}
return [...editedEntitiesWithoutSite, ...editedSiteEntities];
}, [editedEntities, siteEdits, siteEntityConfig]);
// Unchecked entities to be ignored by save function.
const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]);
const setUnselectedEntities = ({
kind,
name,
key,
property
}, checked) => {
if (checked) {
_setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
} else {
_setUnselectedEntities([...unselectedEntities, {
kind,
name,
key,
property
}]);
}
};
const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
return {
dirtyEntityRecords,
isDirty,
setUnselectedEntities,
unselectedEntities
};
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function identity(values) {
return values;
}
/**
* Renders the component for managing saved states of entities.
*
* @param {Object} props The component props.
* @param {Function} props.close The function to close the dialog.
* @param {Function} props.renderDialog The function to render the dialog.
*
* @return {JSX.Element} The rendered component.
*/
function EntitiesSavedStates({
close,
renderDialog = undefined
}) {
const isDirtyProps = useIsDirty();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, {
close: close,
renderDialog: renderDialog,
...isDirtyProps
});
}
/**
* Renders a panel for saving entities with dirty records.
*
* @param {Object} props The component props.
* @param {string} props.additionalPrompt Additional prompt to display.
* @param {Function} props.close Function to close the panel.
* @param {Function} props.onSave Function to call when saving entities.
* @param {boolean} props.saveEnabled Flag indicating if save is enabled.
* @param {string} props.saveLabel Label for the save button.
* @param {Function} props.renderDialog Function to render a custom dialog.
* @param {Array} props.dirtyEntityRecords Array of dirty entity records.
* @param {boolean} props.isDirty Flag indicating if there are dirty entities.
* @param {Function} props.setUnselectedEntities Function to set unselected entities.
* @param {Array} props.unselectedEntities Array of unselected entities.
*
* @return {JSX.Element} The rendered component.
*/
function EntitiesSavedStatesExtensible({
additionalPrompt = undefined,
close,
onSave = identity,
saveEnabled: saveEnabledProp = undefined,
saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'),
renderDialog = undefined,
dirtyEntityRecords,
isDirty,
setUnselectedEntities,
unselectedEntities
}) {
const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)();
const {
saveDirtyEntities
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
// To group entities by type.
const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => {
const {
name
} = record;
if (!acc[name]) {
acc[name] = [];
}
acc[name].push(record);
return acc;
}, {});
// Sort entity groups.
const {
site: siteSavables,
wp_template: templateSavables,
wp_template_part: templatePartSavables,
...contentSavables
} = partitionedSavables;
const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty;
// Explicitly define this with no argument passed. Using `close` on
// its own will use the event object in place of the expected saved entities.
const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]);
const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
onClose: () => dismissPanel()
});
const dialogLabel = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'label');
const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'description');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
ref: saveDialogRef,
...saveDialogProps,
className: "entities-saved-states__panel",
role: renderDialog ? 'dialog' : undefined,
"aria-labelledby": renderDialog ? dialogLabel : undefined,
"aria-describedby": renderDialog ? dialogDescription : undefined,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
className: "entities-saved-states__panel-header",
gap: 2,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true,
as: external_wp_components_namespaceObject.Button,
variant: "secondary",
size: "compact",
onClick: dismissPanel,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true,
as: external_wp_components_namespaceObject.Button,
ref: saveButtonRef,
variant: "primary",
size: "compact",
disabled: !saveEnabled,
accessibleWhenDisabled: true,
onClick: () => saveDirtyEntities({
onSave,
dirtyEntityRecords,
entitiesToSkip: unselectedEntities,
close
}),
className: "editor-entities-saved-states__save-button",
children: saveLabel
})]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "entities-saved-states__text-prompt",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "entities-saved-states__text-prompt--header-wrapper",
id: renderDialog ? dialogLabel : undefined,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
className: "entities-saved-states__text-prompt--header",
children: (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')
}), additionalPrompt]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
id: renderDialog ? dialogDescription : undefined,
children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of site changes waiting to be saved. */
(0,external_wp_i18n_namespaceObject._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', sortedPartitionedSavables.length), sortedPartitionedSavables.length), {
strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {})
}) : (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.')
})]
}), sortedPartitionedSavables.map(list => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityTypeList, {
list: list,
unselectedEntities: unselectedEntities,
setUnselectedEntities: setUnselectedEntities
}, list[0].name);
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getContent() {
try {
// While `select` in a component is generally discouraged, it is
// used here because it (a) reduces the chance of data loss in the
// case of additional errors by performing a direct retrieval and
// (b) avoids the performance cost associated with unnecessary
// content serialization throughout the lifetime of a non-erroring
// application.
return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent();
} catch (error) {}
}
function CopyButton({
text,
children
}) {
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "secondary",
ref: ref,
children: children
});
}
class ErrorBoundary extends external_wp_element_namespaceObject.Component {
constructor() {
super(...arguments);
this.state = {
error: null
};
}
componentDidCatch(error) {
(0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
}
static getDerivedStateFromError(error) {
return {
error
};
}
render() {
const {
error
} = this.state;
if (!error) {
return this.props.children;
}
const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
text: getContent,
children: (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')
}, "copy-post"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
text: error.stack,
children: (0,external_wp_i18n_namespaceObject.__)('Copy Error')
}, "copy-error")];
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, {
className: "editor-error-boundary",
actions: actions,
children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')
});
}
}
/**
* ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI.
*
* It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree.
*
* getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information.
*
* @class ErrorBoundary
* @augments Component
*/
/* harmony default export */ const error_boundary = (ErrorBoundary);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
let hasStorageSupport;
/**
* Function which returns true if the current environment supports browser
* sessionStorage, or false otherwise. The result of this function is cached and
* reused in subsequent invocations.
*/
const hasSessionStorageSupport = () => {
if (hasStorageSupport !== undefined) {
return hasStorageSupport;
}
try {
// Private Browsing in Safari 10 and earlier will throw an error when
// attempting to set into sessionStorage. The test here is intentional in
// causing a thrown error as condition bailing from local autosave.
window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
hasStorageSupport = true;
} catch {
hasStorageSupport = false;
}
return hasStorageSupport;
};
/**
* Custom hook which manages the creation of a notice prompting the user to
* restore a local autosave, if one exists.
*/
function useAutosaveNotice() {
const {
postId,
isEditedPostNew,
hasRemoteAutosave
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
postId: select(store_store).getCurrentPostId(),
isEditedPostNew: select(store_store).isEditedPostNew(),
hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave
}), []);
const {
getEditedPostAttribute
} = (0,external_wp_data_namespaceObject.useSelect)(store_store);
const {
createWarningNotice,
removeNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
editPost,
resetEditorBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
let localAutosave = localAutosaveGet(postId, isEditedPostNew);
if (!localAutosave) {
return;
}
try {
localAutosave = JSON.parse(localAutosave);
} catch {
// Not usable if it can't be parsed.
return;
}
const {
post_title: title,
content,
excerpt
} = localAutosave;
const edits = {
title,
content,
excerpt
};
{
// Only display a notice if there is a difference between what has been
// saved and that which is stored in sessionStorage.
const hasDifference = Object.keys(edits).some(key => {
return edits[key] !== getEditedPostAttribute(key);
});
if (!hasDifference) {
// If there is no difference, it can be safely ejected from storage.
localAutosaveClear(postId, isEditedPostNew);
return;
}
}
if (hasRemoteAutosave) {
return;
}
const id = 'wpEditorAutosaveRestore';
createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), {
id,
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'),
onClick() {
const {
content: editsContent,
...editsWithoutContent
} = edits;
editPost(editsWithoutContent);
resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content));
removeNotice(id);
}
}]
});
}, [isEditedPostNew, postId]);
}
/**
* Custom hook which ejects a local autosave after a successful save occurs.
*/
function useAutosavePurge() {
const {
postId,
isEditedPostNew,
isDirty,
isAutosaving,
didError
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
postId: select(store_store).getCurrentPostId(),
isEditedPostNew: select(store_store).isEditedPostNew(),
isDirty: select(store_store).isEditedPostDirty(),
isAutosaving: select(store_store).isAutosavingPost(),
didError: select(store_store).didPostSaveRequestFail()
}), []);
const lastIsDirtyRef = (0,external_wp_element_namespaceObject.useRef)(isDirty);
const lastIsAutosavingRef = (0,external_wp_element_namespaceObject.useRef)(isAutosaving);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) {
localAutosaveClear(postId, isEditedPostNew);
}
lastIsDirtyRef.current = isDirty;
lastIsAutosavingRef.current = isAutosaving;
}, [isDirty, isAutosaving, didError]);
// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew);
const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
localAutosaveClear(postId, true);
}
}, [isEditedPostNew, postId]);
}
function LocalAutosaveMonitor() {
const {
autosave
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => {
requestIdleCallback(() => autosave({
local: true
}));
}, []);
useAutosaveNotice();
useAutosavePurge();
const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(autosave_monitor, {
interval: localAutosaveInterval,
autosave: deferredAutosave
});
}
/**
* Monitors local autosaves of a post in the editor.
* It uses several hooks and functions to manage autosave behavior:
* - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.
* - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.
* - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.
* - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.
*
* The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.
*
* @module LocalAutosaveMonitor
*/
/* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Wrapper component that renders its children only if the post type supports page attributes.
*
* @param {Object} props - The component props.
* @param {Element} props.children - The child components to render.
*
* @return {Component|null} The rendered child components or null if page attributes are not supported.
*/
function PageAttributesCheck({
children
}) {
const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedPostAttribute
} = select(store_store);
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
const postType = getPostType(getEditedPostAttribute('type'));
return !!postType?.supports?.['page-attributes'];
}, []);
// Only render fields if post type supports page attributes or available templates exist.
if (!supportsPageAttributes) {
return null;
}
return children;
}
/* harmony default export */ const page_attributes_check = (PageAttributesCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A component which renders its own children only if the current editor post
* type supports one of the given `supportKeys` prop.
*
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered if post
* type supports.
* @param {(string|string[])} props.supportKeys String or string array of keys
* to test.
*
* @return {Component} The component to be rendered.
*/
function PostTypeSupportCheck({
children,
supportKeys
}) {
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedPostAttribute
} = select(store_store);
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
return getPostType(getEditedPostAttribute('type'));
}, []);
let isSupported = !!postType;
if (postType) {
isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]);
}
if (!isSupported) {
return null;
}
return children;
}
/* harmony default export */ const post_type_support_check = (PostTypeSupportCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PageAttributesOrder() {
const order = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
return (_select$getEditedPost = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 0;
}, []);
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null);
const setUpdatedOrder = value => {
setOrderInput(value);
const newOrder = Number(value);
if (Number.isInteger(newOrder) && value.trim?.() !== '') {
editPost({
menu_order: newOrder
});
}
};
const value = orderInput !== null && orderInput !== void 0 ? orderInput : order;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Order'),
help: (0,external_wp_i18n_namespaceObject.__)('Set the page order.'),
value: value,
onChange: setUpdatedOrder,
hideLabelFromVision: true,
onBlur: () => {
setOrderInput(null);
}
})
})
});
}
/**
* Renders the Page Attributes Order component. A number input in an editor interface
* for setting the order of a given page.
* The component is now not used in core but was kept for backward compatibility.
*
* @return {Component} The component to be rendered.
*/
function PageAttributesOrderWithChecks() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "page-attributes",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {})
});
}
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({
className,
label,
children
}, ref) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
className: dist_clsx('editor-post-panel__row', className),
ref: ref,
children: [label && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "editor-post-panel__row-label",
children: label
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "editor-post-panel__row-control",
children: children
})]
});
});
/* harmony default export */ const post_panel_row = (PostPanelRow);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
/**
* WordPress dependencies
*/
/**
* Returns terms in a tree form.
*
* @param {Array} flatTerms Array of terms in flat format.
*
* @return {Array} Array of terms in tree format.
*/
function buildTermsTree(flatTerms) {
const flatTermsWithParentAndChildren = flatTerms.map(term => {
return {
children: [],
parent: null,
...term
};
});
// All terms should have a `parent` because we're about to index them by it.
if (flatTermsWithParentAndChildren.some(({
parent
}) => parent === null)) {
return flatTermsWithParentAndChildren;
}
const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
const {
parent
} = term;
if (!acc[parent]) {
acc[parent] = [];
}
acc[parent].push(term);
return acc;
}, {});
const fillWithChildren = terms => {
return terms.map(term => {
const children = termsByParent[term.id];
return {
...term,
children: children && children.length ? fillWithChildren(children) : []
};
});
};
return fillWithChildren(termsByParent['0'] || []);
}
const unescapeString = arg => {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg);
};
/**
* Returns a term object with name unescaped.
*
* @param {Object} term The term object to unescape.
*
* @return {Object} Term object with name property unescaped.
*/
const unescapeTerm = term => {
return {
...term,
name: unescapeString(term.name)
};
};
/**
* Returns an array of term objects with names unescaped.
* The unescape of each term is performed using the unescapeTerm function.
*
* @param {Object[]} terms Array of term objects to unescape.
*
* @return {Object[]} Array of term objects unescaped.
*/
const unescapeTerms = terms => {
return (terms !== null && terms !== void 0 ? terms : []).map(unescapeTerm);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getTitle(post) {
return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`;
}
const getItemPriority = (name, searchValue) => {
const normalizedName = remove_accents_default()(name || '').toLowerCase();
const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase();
if (normalizedName === normalizedSearch) {
return 0;
}
if (normalizedName.startsWith(normalizedSearch)) {
return normalizedName.length;
}
return Infinity;
};
/**
* Renders the Page Attributes Parent component. A dropdown menu in an editor interface
* for selecting the parent page of a given page.
*
* @return {Component|null} The component to be rendered. Return null if post type is not hierarchical.
*/
function PageAttributesParent() {
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false);
const {
isHierarchical,
parentPostId,
parentPostTitle,
pageItems
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _pType$hierarchical;
const {
getPostType,
getEntityRecords,
getEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
const {
getCurrentPostId,
getEditedPostAttribute
} = select(store_store);
const postTypeSlug = getEditedPostAttribute('type');
const pageId = getEditedPostAttribute('parent');
const pType = getPostType(postTypeSlug);
const postId = getCurrentPostId();
const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false;
const query = {
per_page: 100,
exclude: postId,
parent_exclude: postId,
orderby: 'menu_order',
order: 'asc',
_fields: 'id,title,parent'
};
// Perform a search when the field is changed.
if (!!fieldValue) {
query.search = fieldValue;
}
const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null;
return {
isHierarchical: postIsHierarchical,
parentPostId: pageId,
parentPostTitle: parentPost ? getTitle(parentPost) : '',
pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null
};
}, [fieldValue]);
const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
const getOptionsFromTree = (tree, level = 0) => {
const mappedNodes = tree.map(treeNode => [{
value: treeNode.id,
label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name),
rawName: treeNode.name
}, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
const sortedNodes = mappedNodes.sort(([a], [b]) => {
const priorityA = getItemPriority(a.rawName, fieldValue);
const priorityB = getItemPriority(b.rawName, fieldValue);
return priorityA >= priorityB ? 1 : -1;
});
return sortedNodes.flat();
};
if (!pageItems) {
return [];
}
let tree = pageItems.map(item => ({
id: item.id,
parent: item.parent,
name: getTitle(item)
}));
// Only build a hierarchical tree when not searching.
if (!fieldValue) {
tree = buildTermsTree(tree);
}
const opts = getOptionsFromTree(tree);
// Ensure the current parent is in the options list.
const optsHasParent = opts.find(item => item.value === parentPostId);
if (parentPostTitle && !optsHasParent) {
opts.unshift({
value: parentPostId,
label: parentPostTitle
});
}
return opts;
}, [pageItems, fieldValue, parentPostTitle, parentPostId]);
if (!isHierarchical) {
return null;
}
/**
* Handle user input.
*
* @param {string} inputValue The current value of the input field.
*/
const handleKeydown = inputValue => {
setFieldValue(inputValue);
};
/**
* Handle author selection.
*
* @param {Object} selectedPostId The selected Author.
*/
const handleChange = selectedPostId => {
editPost({
parent: selectedPostId
});
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
className: "editor-page-attributes__parent",
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
help: (0,external_wp_i18n_namespaceObject.__)('Choose a parent page.'),
value: parentPostId,
options: parentOptions,
onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
onChange: handleChange,
hideLabelFromVision: true
});
}
function PostParentToggle({
isOpen,
onClick
}) {
const parentPost = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedPostAttribute
} = select(store_store);
const parentPostId = getEditedPostAttribute('parent');
if (!parentPostId) {
return null;
}
const {
getEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
const postTypeSlug = getEditedPostAttribute('type');
return getEntityRecord('postType', postTypeSlug, parentPostId);
}, []);
const parentTitle = (0,external_wp_element_namespaceObject.useMemo)(() => !parentPost ? (0,external_wp_i18n_namespaceObject.__)('None') : getTitle(parentPost), [parentPost]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
size: "compact",
className: "editor-post-parent__panel-toggle",
variant: "tertiary",
"aria-expanded": isOpen,
"aria-label":
// translators: %s: Current post parent.
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change parent: %s'), parentTitle),
onClick: onClick,
children: parentTitle
});
}
function ParentRow() {
const homeUrl = (0,external_wp_data_namespaceObject.useSelect)(select => {
// Site index.
return select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase')?.home;
}, []);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
anchor: popoverAnchor,
placement: 'left-start',
offset: 36,
shift: true
}), [popoverAnchor]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
ref: setPopoverAnchor,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
className: "editor-post-parent__panel-dropdown",
contentClassName: "editor-post-parent__panel-dialog",
focusOnMount: true,
renderToggle: ({
isOpen,
onToggle
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, {
isOpen: isOpen,
onClick: onToggle
}),
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-parent",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Parent'),
onClose: onClose
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
children: [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The home URL of the WordPress installation without the scheme. */
(0,external_wp_i18n_namespaceObject.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.'), (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), {
wbr: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'), {
a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes')
})
})
})]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesParent, {})]
})
})
});
}
/* harmony default export */ const page_attributes_parent = (PageAttributesParent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PANEL_NAME = 'page-attributes';
function AttributesPanel() {
const {
isEnabled,
postType
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedPostAttribute,
isEditorPanelEnabled
} = select(store_store);
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
return {
isEnabled: isEditorPanelEnabled(PANEL_NAME),
postType: getPostType(getEditedPostAttribute('type'))
};
}, []);
if (!isEnabled || !postType) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {});
}
/**
* Renders the Page Attributes Panel component.
*
* @return {Component} The component to be rendered.
*/
function PageAttributesPanel() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(page_attributes_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js
/**
* WordPress dependencies
*/
const addTemplate = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"
})
});
/* harmony default export */ const add_template = (addTemplate);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
function CreateNewTemplateModal({
onClose
}) {
const {
defaultBlockTemplate,
onNavigateToEntityRecord
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditorSettings,
getCurrentTemplateId
} = select(store_store);
return {
defaultBlockTemplate: getEditorSettings().defaultBlockTemplate,
onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord,
getTemplateId: getCurrentTemplateId
};
});
const {
createTemplate
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
const cancel = () => {
setTitle('');
onClose();
};
const submit = async event => {
event.preventDefault();
if (isBusy) {
return;
}
setIsBusy(true);
const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
tagName: 'header',
layout: {
inherit: true
}
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
tagName: 'main'
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
layout: {
inherit: true
}
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
layout: {
inherit: true
}
})])]);
const newTemplate = await createTemplate({
slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE),
content: newTemplateContent,
title: title || DEFAULT_TITLE
});
setIsBusy(false);
onNavigateToEntityRecord({
postId: newTemplate.id,
postType: 'wp_template'
});
cancel();
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
onRequestClose: cancel,
focusOnMount: "firstContentElement",
size: "small",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
className: "editor-post-template__create-form",
onSubmit: submit,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "3",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
value: title,
onChange: setTitle,
placeholder: DEFAULT_TITLE,
disabled: isBusy,
help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: cancel,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit",
isBusy: isBusy,
"aria-disabled": isBusy,
children: (0,external_wp_i18n_namespaceObject.__)('Create')
})]
})]
})
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useEditedPostContext() {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostId,
getCurrentPostType
} = select(store_store);
return {
postId: getCurrentPostId(),
postType: getCurrentPostType()
};
}, []);
}
function useAllowSwitchingTemplates() {
const {
postType,
postId
} = useEditedPostContext();
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser,
getEntityRecord,
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
const siteSettings = canUser('read', {
kind: 'root',
name: 'site'
}) ? getEntityRecord('root', 'site') : undefined;
const templates = getEntityRecords('postType', 'wp_template', {
per_page: -1
});
const isPostsPage = +postId === siteSettings?.page_for_posts;
// If current page is set front page or posts page, we also need
// to check if the current theme has a template for it. If not
const isFrontPage = postType === 'page' && +postId === siteSettings?.page_on_front && templates?.some(({
slug
}) => slug === 'front-page');
return !isPostsPage && !isFrontPage;
}, [postId, postType]);
}
function useTemplates(postType) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
per_page: -1,
post_type: postType
}), [postType]);
}
function useAvailableTemplates(postType) {
const currentTemplateSlug = useCurrentTemplateSlug();
const allowSwitchingTemplate = useAllowSwitchingTemplates();
const templates = useTemplates(postType);
return (0,external_wp_element_namespaceObject.useMemo)(() => allowSwitchingTemplate && templates?.filter(template => template.is_custom && template.slug !== currentTemplateSlug && !!template.content.raw // Skip empty templates.
), [templates, currentTemplateSlug, allowSwitchingTemplate]);
}
function useCurrentTemplateSlug() {
const {
postType,
postId
} = useEditedPostContext();
const templates = useTemplates(postType);
const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => {
const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
return post?.template;
}, [postType, postId]);
if (!entityTemplate) {
return;
}
// If a page has a `template` set and is not included in the list
// of the theme's templates, do not return it, in order to resolve
// to the current theme's default template.
return templates?.find(template => template.slug === entityTemplate)?.slug;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const POPOVER_PROPS = {
className: 'editor-post-template__dropdown',
placement: 'bottom-start'
};
function PostTemplateToggle({
isOpen,
onClick
}) {
const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
const templateSlug = select(store_store).getEditedPostAttribute('template');
const {
supportsTemplateMode,
availableTemplates
} = select(store_store).getEditorSettings();
if (!supportsTemplateMode && availableTemplates[templateSlug]) {
return availableTemplates[templateSlug];
}
const template = select(external_wp_coreData_namespaceObject.store).canUser('create', {
kind: 'postType',
name: 'wp_template'
}) && select(store_store).getCurrentTemplateId();
return template?.title || template?.slug || availableTemplates?.[templateSlug];
}, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
"aria-expanded": isOpen,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Template options'),
onClick: onClick,
children: templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template')
});
}
/**
* Renders the dropdown content for selecting a post template.
*
* @param {Object} props The component props.
* @param {Function} props.onClose The function to close the dropdown.
*
* @return {JSX.Element} The rendered dropdown content.
*/
function PostTemplateDropdownContent({
onClose
}) {
var _options$find, _selectedOption$value;
const allowSwitchingTemplate = useAllowSwitchingTemplates();
const {
availableTemplates,
fetchedTemplates,
selectedTemplateSlug,
canCreate,
canEdit,
currentTemplateId,
onNavigateToEntityRecord,
getEditorSettings
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser,
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
const editorSettings = select(store_store).getEditorSettings();
const canCreateTemplates = canUser('create', {
kind: 'postType',
name: 'wp_template'
});
const _currentTemplateId = select(store_store).getCurrentTemplateId();
return {
availableTemplates: editorSettings.availableTemplates,
fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', {
post_type: select(store_store).getCurrentPostType(),
per_page: -1
}) : undefined,
selectedTemplateSlug: select(store_store).getEditedPostAttribute('template'),
canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode,
canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId,
currentTemplateId: _currentTemplateId,
onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
getEditorSettings: select(store_store).getEditorSettings
};
}, [allowSwitchingTemplate]);
const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({
...availableTemplates,
...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({
slug,
title
}) => [slug, title.rendered]))
}).map(([slug, title]) => ({
value: slug,
label: title
})), [availableTemplates, fetchedTemplates]);
const selectedOption = (_options$find = options.find(option => option.value === selectedTemplateSlug)) !== null && _options$find !== void 0 ? _options$find : options.find(option => !option.value); // The default option has '' value.
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const {
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-template__classic-theme-dropdown",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Template'),
help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'),
actions: canCreate ? [{
icon: add_template,
label: (0,external_wp_i18n_namespaceObject.__)('Add template'),
onClick: () => setIsCreateModalOpen(true)
}] : [],
onClose: onClose
}), !allowSwitchingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
status: "warning",
isDismissible: false,
children: (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Template'),
value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
options: options,
onChange: slug => editPost({
template: slug || ''
})
}), canEdit && onNavigateToEntityRecord && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button
// TODO: Switch to `true` (40px size) if possible
, {
__next40pxDefaultSize: false,
variant: "link",
onClick: () => {
onNavigateToEntityRecord({
postId: currentTemplateId,
postType: 'wp_template'
});
onClose();
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
type: 'snackbar',
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Go back'),
onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
}]
});
},
children: (0,external_wp_i18n_namespaceObject.__)('Edit template')
})
}), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, {
onClose: () => setIsCreateModalOpen(false)
})]
});
}
function ClassicThemeControl() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: POPOVER_PROPS,
focusOnMount: true,
renderToggle: ({
isOpen,
onToggle
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateToggle, {
isOpen: isOpen,
onClick: onToggle
}),
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, {
onClose: onClose
})
});
}
/**
* Provides a dropdown menu for selecting and managing post templates.
*
* The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.
*
* @return {JSX.Element} The rendered ClassicThemeControl component.
*/
/* harmony default export */ const classic_theme = (ClassicThemeControl);
;// CONCATENATED MODULE: external ["wp","warning"]
const external_wp_warning_namespaceObject = window["wp"]["warning"];
var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
PreferenceBaseOption
} = unlock(external_wp_preferences_namespaceObject.privateApis);
/* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, {
panelName
}) => {
const {
isEditorPanelEnabled,
isEditorPanelRemoved
} = select(store_store);
return {
isRemoved: isEditorPanelRemoved(panelName),
isChecked: isEditorPanelEnabled(panelName)
};
}), (0,external_wp_compose_namespaceObject.ifCondition)(({
isRemoved
}) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
panelName
}) => ({
onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
})))(PreferenceBaseOption));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Fill,
Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
const EnablePluginDocumentSettingPanelOption = ({
label,
panelName
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, {
label: label,
panelName: panelName
})
});
EnablePluginDocumentSettingPanelOption.Slot = Slot;
/* harmony default export */ const enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Fill: plugin_document_setting_panel_Fill,
Slot: plugin_document_setting_panel_Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel');
/**
* Renders items below the Status & Availability panel in the Document Sidebar.
*
* @param {Object} props Component properties.
* @param {string} props.name Required. A machine-friendly name for the panel.
* @param {string} [props.className] An optional class name added to the row.
* @param {string} [props.title] The title of the panel
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
* @param {Element} props.children Children to be rendered
*
* @example
* ```js
* // Using ES5 syntax
* var el = React.createElement;
* var __ = wp.i18n.__;
* var registerPlugin = wp.plugins.registerPlugin;
* var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;
*
* function MyDocumentSettingPlugin() {
* return el(
* PluginDocumentSettingPanel,
* {
* className: 'my-document-setting-plugin',
* title: 'My Panel',
* name: 'my-panel',
* },
* __( 'My Document Setting Panel' )
* );
* }
*
* registerPlugin( 'my-document-setting-plugin', {
* render: MyDocumentSettingPlugin
* } );
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { registerPlugin } from '@wordpress/plugins';
* import { PluginDocumentSettingPanel } from '@wordpress/editor';
*
* const MyDocumentSettingTest = () => (
* <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel">
* <p>My Document Setting Panel</p>
* </PluginDocumentSettingPanel>
* );
*
* registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginDocumentSettingPanel = ({
name,
className,
title,
icon,
children
}) => {
const {
name: pluginName
} = (0,external_wp_plugins_namespaceObject.usePluginContext)();
const panelName = `${pluginName}/${name}`;
const {
opened,
isEnabled
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isEditorPanelOpened,
isEditorPanelEnabled
} = select(store_store);
return {
opened: isEditorPanelOpened(panelName),
isEnabled: isEditorPanelEnabled(panelName)
};
}, [panelName]);
const {
toggleEditorPanelOpened
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
if (undefined === name) {
true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel, {
label: title,
panelName: panelName
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, {
children: isEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
className: className,
title: title,
icon: icon,
opened: opened,
onToggle: () => toggleEditorPanelOpened(panelName),
children: children
})
})]
});
};
PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot;
/* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
/**
* WordPress dependencies
*/
const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
/**
* Plugins may want to add an item to the menu either for every block
* or only for the specific ones provided in the `allowedBlocks` component property.
*
* If there are multiple blocks selected the item will be rendered if every block
* is of one allowed type (not necessarily the same).
*
* @param {string[]} selectedBlocks Array containing the names of the blocks selected
* @param {string[]} allowedBlocks Array containing the names of the blocks allowed
* @return {boolean} Whether the item will be rendered or not.
*/
const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
/**
* Renders a new item in the block settings menu.
*
* @param {Object} props Component props.
* @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
* @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
* @param {string} props.label The menu item text.
* @param {Function} props.onClick Callback function to be executed when the user click the menu item.
* @param {boolean} [props.small] Whether to render the label or not.
* @param {string} [props.role] The ARIA role for the menu item.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginBlockSettingsMenuItem = wp.editor.PluginBlockSettingsMenuItem;
*
* function doOnClick(){
* // To be called when the user clicks the menu item.
* }
*
* function MyPluginBlockSettingsMenuItem() {
* return React.createElement(
* PluginBlockSettingsMenuItem,
* {
* allowedBlocks: [ 'core/paragraph' ],
* icon: 'dashicon-name',
* label: __( 'Menu item text' ),
* onClick: doOnClick,
* }
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginBlockSettingsMenuItem } from '@wordpress/editor';
*
* const doOnClick = ( ) => {
* // To be called when the user clicks the menu item.
* };
*
* const MyPluginBlockSettingsMenuItem = () => (
* <PluginBlockSettingsMenuItem
* allowedBlocks={ [ 'core/paragraph' ] }
* icon='dashicon-name'
* label={ __( 'Menu item text' ) }
* onClick={ doOnClick } />
* );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginBlockSettingsMenuItem = ({
allowedBlocks,
icon,
label,
onClick,
small,
role
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, {
children: ({
selectedBlocks,
onClose
}) => {
if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose),
icon: icon,
label: small ? label : undefined,
role: role,
children: !small && label
});
}
});
/* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
* The text within the component appears as the menu item label.
*
* @param {Object} props Component properties.
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
* @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem;
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
*
* function onButtonClick() {
* alert( 'Button clicked.' );
* }
*
* function MyButtonMoreMenuItem() {
* return wp.element.createElement(
* PluginMoreMenuItem,
* {
* icon: moreIcon,
* onClick: onButtonClick,
* },
* __( 'My button title' )
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginMoreMenuItem } from '@wordpress/editor';
* import { more } from '@wordpress/icons';
*
* function onButtonClick() {
* alert( 'Button clicked.' );
* }
*
* const MyButtonMoreMenuItem = () => (
* <PluginMoreMenuItem
* icon={ more }
* onClick={ onButtonClick }
* >
* { __( 'My button title' ) }
* </PluginMoreMenuItem>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
/* harmony default export */ const plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
var _ownProps$as;
return {
as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
icon: ownProps.icon || context.icon,
name: 'core/plugin-more-menu'
};
}))(action_item));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js
/**
* WordPress dependencies
*/
const {
Fill: plugin_post_publish_panel_Fill,
Slot: plugin_post_publish_panel_Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel');
/**
* Renders provided content to the post-publish panel in the publish flow
* (side panel that opens after a user publishes the post).
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the panel.
* @param {string} [props.title] Title displayed at the top of the panel.
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
* @param {Element} props.children Children to be rendered
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPostPublishPanel } from '@wordpress/editor';
*
* const MyPluginPostPublishPanel = () => (
* <PluginPostPublishPanel
* className="my-plugin-post-publish-panel"
* title={ __( 'My panel title' ) }
* initialOpen={ true }
* >
* { __( 'My panel content' ) }
* </PluginPostPublishPanel>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginPostPublishPanel = ({
children,
className,
title,
initialOpen = false,
icon
}) => {
const {
icon: pluginIcon
} = (0,external_wp_plugins_namespaceObject.usePluginContext)();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
className: className,
initialOpen: initialOpen || !title,
title: title,
icon: icon !== null && icon !== void 0 ? icon : pluginIcon,
children: children
})
});
};
PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
/* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js
/**
* Defines as extensibility slot for the Summary panel.
*/
/**
* WordPress dependencies
*/
const {
Fill: plugin_post_status_info_Fill,
Slot: plugin_post_status_info_Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo');
/**
* Renders a row in the Summary panel of the Document sidebar.
* It should be noted that this is named and implemented around the function it serves
* and not its location, which may change in future iterations.
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the row.
* @param {Element} props.children Children to be rendered.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPostStatusInfo = wp.editor.PluginPostStatusInfo;
*
* function MyPluginPostStatusInfo() {
* return React.createElement(
* PluginPostStatusInfo,
* {
* className: 'my-plugin-post-status-info',
* },
* __( 'My post status info' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPostStatusInfo } from '@wordpress/editor';
*
* const MyPluginPostStatusInfo = () => (
* <PluginPostStatusInfo
* className="my-plugin-post-status-info"
* >
* { __( 'My post status info' ) }
* </PluginPostStatusInfo>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginPostStatusInfo = ({
children,
className
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
className: className,
children: children
})
});
PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
/* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js
/**
* WordPress dependencies
*/
const {
Fill: plugin_pre_publish_panel_Fill,
Slot: plugin_pre_publish_panel_Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel');
/**
* Renders provided content to the pre-publish side panel in the publish flow
* (side panel that opens when a user first pushes "Publish" from the main editor).
*
* @param {Object} props Component props.
* @param {string} [props.className] An optional class name added to the panel.
* @param {string} [props.title] Title displayed at the top of the panel.
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
* When no title is provided it is always opened.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
* icon slug string, or an SVG WP element, to be rendered when
* the sidebar is pinned to toolbar.
* @param {Element} props.children Children to be rendered
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginPrePublishPanel } from '@wordpress/editor';
*
* const MyPluginPrePublishPanel = () => (
* <PluginPrePublishPanel
* className="my-plugin-pre-publish-panel"
* title={ __( 'My panel title' ) }
* initialOpen={ true }
* >
* { __( 'My panel content' ) }
* </PluginPrePublishPanel>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginPrePublishPanel = ({
children,
className,
title,
initialOpen = false,
icon
}) => {
const {
icon: pluginIcon
} = (0,external_wp_plugins_namespaceObject.usePluginContext)();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
className: className,
initialOpen: initialOpen || !title,
title: title,
icon: icon !== null && icon !== void 0 ? icon : pluginIcon,
children: children
})
});
};
PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
/* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-preview-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided.
* The text within the component appears as the menu item label.
*
* @param {Object} props Component properties.
* @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.
* @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item.
* @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component.
*
* @example
* ```jsx
* import { __ } from '@wordpress/i18n';
* import { PluginPreviewMenuItem } from '@wordpress/editor';
* import { external } from '@wordpress/icons';
*
* function onPreviewClick() {
* // Handle preview action
* }
*
* const ExternalPreviewMenuItem = () => (
* <PreviewDropdownMenuItem
* icon={ external }
* onClick={ onPreviewClick }
* >
* { __( 'Preview in new tab' ) }
* </PreviewDropdownMenuItem>
* );
* registerPlugin( 'external-preview-menu-item', {
* render: ExternalPreviewMenuItem,
* } );
* ```
*
* @return {Component} The rendered menu item component.
*/
/* harmony default export */ const plugin_preview_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
var _ownProps$as;
return {
as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
icon: ownProps.icon || context.icon,
name: 'core/plugin-preview-menu'
};
}))(action_item));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
*
* ```js
* wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
* ```
*
* @see PluginSidebarMoreMenuItem
*
* @param {Object} props Element props.
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
* @param {string} [props.className] An optional class name added to the sidebar body.
* @param {string} props.title Title displayed at the top of the sidebar.
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var el = React.createElement;
* var PanelBody = wp.components.PanelBody;
* var PluginSidebar = wp.editor.PluginSidebar;
* var moreIcon = React.createElement( 'svg' ); //... svg element.
*
* function MyPluginSidebar() {
* return el(
* PluginSidebar,
* {
* name: 'my-sidebar',
* title: 'My sidebar title',
* icon: moreIcon,
* },
* el(
* PanelBody,
* {},
* __( 'My sidebar content' )
* )
* );
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PanelBody } from '@wordpress/components';
* import { PluginSidebar } from '@wordpress/editor';
* import { more } from '@wordpress/icons';
*
* const MyPluginSidebar = () => (
* <PluginSidebar
* name="my-sidebar"
* title="My sidebar title"
* icon={ more }
* >
* <PanelBody>
* { __( 'My sidebar content' ) }
* </PanelBody>
* </PluginSidebar>
* );
* ```
*/
function PluginSidebar({
className,
...props
}) {
const {
postTitle
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
return {
postTitle: select(store_store).getEditedPostAttribute('title')
};
}, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area, {
panelClassName: className,
className: "editor-sidebar",
smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
scope: "core",
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js
/**
* WordPress dependencies
*/
/**
* Renders a menu item in `Plugins` group in `More Menu` drop down,
* and can be used to activate the corresponding `PluginSidebar` component.
* The text within the component appears as the menu item label.
*
* @param {Object} props Component props.
* @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem;
* var moreIcon = React.createElement( 'svg' ); //... svg element.
*
* function MySidebarMoreMenuItem() {
* return React.createElement(
* PluginSidebarMoreMenuItem,
* {
* target: 'my-sidebar',
* icon: moreIcon,
* },
* __( 'My sidebar title' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { PluginSidebarMoreMenuItem } from '@wordpress/editor';
* import { more } from '@wordpress/icons';
*
* const MySidebarMoreMenuItem = () => (
* <PluginSidebarMoreMenuItem
* target="my-sidebar"
* icon={ more }
* >
* { __( 'My sidebar title' ) }
* </PluginSidebarMoreMenuItem>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
function PluginSidebarMoreMenuItem(props) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaMoreMenuItem
// Menu item is marked with unstable prop for backward compatibility.
// @see https://github.com/WordPress/gutenberg/issues/14457
, {
__unstableExplicitMenuItem: true,
scope: "core",
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function SwapTemplateButton({
onClick
}) {
const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false);
const {
postType,
postId
} = useEditedPostContext();
const availableTemplates = useAvailableTemplates(postType);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
if (!availableTemplates?.length) {
return null;
}
const onTemplateSelect = async template => {
editEntityRecord('postType', postType, postId, {
template: template.name
}, {
undoIgnore: true
});
setShowModal(false); // Close the template suggestions modal first.
onClick();
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => setShowModal(true),
children: (0,external_wp_i18n_namespaceObject.__)('Swap template')
}), showModal && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Choose a template'),
onRequestClose: () => setShowModal(false),
overlayClassName: "editor-post-template__swap-template-modal",
isFullScreen: true,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "editor-post-template__swap-template-modal-content",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatesList, {
postType: postType,
onSelect: onTemplateSelect
})
})
})]
});
}
function TemplatesList({
postType,
onSelect
}) {
const availableTemplates = useAvailableTemplates(postType);
const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => availableTemplates.map(template => ({
name: template.slug,
blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw),
title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered),
id: template.id
})), [availableTemplates]);
const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
label: (0,external_wp_i18n_namespaceObject.__)('Templates'),
blockPatterns: templatesAsPatterns,
shownPatterns: shownTemplates,
onClickPattern: onSelect
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ResetDefaultTemplate({
onClick
}) {
const currentTemplateSlug = useCurrentTemplateSlug();
const allowSwitchingTemplate = useAllowSwitchingTemplates();
const {
postType,
postId
} = useEditedPostContext();
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
// The default template in a post is indicated by an empty string.
if (!currentTemplateSlug || !allowSwitchingTemplate) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
editEntityRecord('postType', postType, postId, {
template: ''
}, {
undoIgnore: true
});
onClick();
},
children: (0,external_wp_i18n_namespaceObject.__)('Use default template')
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CreateNewTemplate({
onClick
}) {
const {
canCreateTemplates
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser
} = select(external_wp_coreData_namespaceObject.store);
return {
canCreateTemplates: canUser('create', {
kind: 'postType',
name: 'wp_template'
})
};
}, []);
const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const allowSwitchingTemplate = useAllowSwitchingTemplates();
// The default template in a post is indicated by an empty string.
if (!canCreateTemplates || !allowSwitchingTemplate) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
setIsCreateModalOpen(true);
},
children: (0,external_wp_i18n_namespaceObject.__)('Create new template')
}), isCreateModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplateModal, {
onClose: () => {
setIsCreateModalOpen(false);
onClick();
}
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_theme_POPOVER_PROPS = {
className: 'editor-post-template__dropdown',
placement: 'bottom-start'
};
function BlockThemeControl({
id
}) {
const {
isTemplateHidden,
onNavigateToEntityRecord,
getEditorSettings,
hasGoBack
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getRenderingMode,
getEditorSettings: _getEditorSettings
} = unlock(select(store_store));
const editorSettings = _getEditorSettings();
return {
isTemplateHidden: getRenderingMode() === 'post-only',
onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
getEditorSettings: _getEditorSettings,
hasGoBack: editorSettings.hasOwnProperty('onNavigateToPreviousEntityRecord')
};
}, []);
const {
get: getPreference
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store);
const {
editedRecord: template,
hasResolved
} = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_template', id);
const {
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
setRenderingMode
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_coreData_namespaceObject.store).canUser('create', {
kind: 'postType',
name: 'wp_template'
}), []);
if (!hasResolved) {
return null;
}
// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing
// and assigns its own backlink to focusMode pages.
const notificationAction = hasGoBack ? [{
label: (0,external_wp_i18n_namespaceObject.__)('Go back'),
onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
}] : undefined;
const mayShowTemplateEditNotice = () => {
if (!getPreference('core/edit-site', 'welcomeGuideTemplate')) {
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
type: 'snackbar',
actions: notificationAction
});
}
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
popoverProps: block_theme_POPOVER_PROPS,
focusOnMount: true,
toggleProps: {
size: 'compact',
variant: 'tertiary',
tooltipPosition: 'middle left'
},
label: (0,external_wp_i18n_namespaceObject.__)('Template options'),
text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title),
icon: null,
children: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
children: [canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
onNavigateToEntityRecord({
postId: template.id,
postType: 'wp_template'
});
onClose();
mayShowTemplateEditNotice();
},
children: (0,external_wp_i18n_namespaceObject.__)('Edit template')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, {
onClick: onClose
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, {
onClick: onClose
}), canCreateTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, {
onClick: onClose
})]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
icon: !isTemplateHidden ? library_check : undefined,
isSelected: !isTemplateHidden,
role: "menuitemcheckbox",
onClick: () => {
setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only');
},
children: (0,external_wp_i18n_namespaceObject.__)('Show template')
})
})]
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Displays the template controls based on the current editor settings and user permissions.
*
* @return {JSX.Element|null} The rendered PostTemplatePanel component.
*/
function PostTemplatePanel() {
const {
templateId,
isBlockTheme
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentTemplateId,
getEditorSettings
} = select(store_store);
return {
templateId: getCurrentTemplateId(),
isBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme
};
}, []);
const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$canUser;
const postTypeSlug = select(store_store).getCurrentPostType();
const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
if (!postType?.viewable) {
return false;
}
const settings = select(store_store).getEditorSettings();
const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0;
if (hasTemplates) {
return true;
}
if (!settings.supportsTemplateMode) {
return false;
}
const canCreateTemplates = (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', {
kind: 'postType',
name: 'wp_template'
})) !== null && _select$canUser !== void 0 ? _select$canUser : false;
return canCreateTemplates;
}, []);
const canViewTemplates = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$canUser2;
return (_select$canUser2 = select(external_wp_coreData_namespaceObject.store).canUser('read', {
kind: 'postType',
name: 'wp_template'
})) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
}, []);
if ((!isBlockTheme || !canViewTemplates) && isVisible) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
label: (0,external_wp_i18n_namespaceObject.__)('Template'),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme, {})
});
}
if (isBlockTheme && !!templateId) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
label: (0,external_wp_i18n_namespaceObject.__)('Template'),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, {
id: templateId
})
});
}
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js
const BASE_QUERY = {
_fields: 'id,name',
context: 'view' // Allows non-admins to perform requests.
};
const AUTHORS_QUERY = {
who: 'authors',
per_page: 50,
...BASE_QUERY
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useAuthorsQuery(search) {
const {
authorId,
authors,
postAuthor
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getUser,
getUsers
} = select(external_wp_coreData_namespaceObject.store);
const {
getEditedPostAttribute
} = select(store_store);
const _authorId = getEditedPostAttribute('author');
const query = {
...AUTHORS_QUERY
};
if (search) {
query.search = search;
}
return {
authorId: _authorId,
authors: getUsers(query),
postAuthor: getUser(_authorId, BASE_QUERY)
};
}, [search]);
const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
return {
value: author.id,
label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
};
});
// Ensure the current author is included in the dropdown list.
const foundAuthor = fetchedAuthors.findIndex(({
value
}) => postAuthor?.id === value);
let currentAuthor = [];
if (foundAuthor < 0 && postAuthor) {
currentAuthor = [{
value: postAuthor.id,
label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name)
}];
} else if (foundAuthor < 0 && !postAuthor) {
currentAuthor = [{
value: 0,
label: (0,external_wp_i18n_namespaceObject.__)('(No author)')
}];
}
return [...currentAuthor, ...fetchedAuthors];
}, [authors, postAuthor]);
return {
authorId,
authorOptions,
postAuthor
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostAuthorCombobox() {
const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)();
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const {
authorId,
authorOptions
} = useAuthorsQuery(fieldValue);
/**
* Handle author selection.
*
* @param {number} postAuthorId The selected Author.
*/
const handleSelect = postAuthorId => {
if (!postAuthorId) {
return;
}
editPost({
author: postAuthorId
});
};
/**
* Handle user input.
*
* @param {string} inputValue The current value of the input field.
*/
const handleKeydown = inputValue => {
setFieldValue(inputValue);
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
options: authorOptions,
value: authorId,
onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
onChange: handleSelect,
allowReset: false,
hideLabelFromVision: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostAuthorSelect() {
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const {
authorId,
authorOptions
} = useAuthorsQuery();
const setAuthorId = value => {
const author = Number(value);
editPost({
author
});
};
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
className: "post-author-selector",
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
options: authorOptions,
onChange: setAuthorId,
value: authorId,
hideLabelFromVision: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const minimumUsersForCombobox = 25;
/**
* Renders the component for selecting the post author.
*
* @return {Component} The component to be rendered.
*/
function PostAuthor() {
const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => {
const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
return authors?.length >= minimumUsersForCombobox;
}, []);
if (showCombobox) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {});
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {});
}
/* harmony default export */ const post_author = (PostAuthor);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Wrapper component that renders its children only if the post type supports the author.
*
* @param {Object} props The component props.
* @param {Element} props.children Children to be rendered.
*
* @return {Component|null} The component to be rendered. Return `null` if the post type doesn't
* supports the author or if there are no authors available.
*/
function PostAuthorCheck({
children
}) {
const {
hasAssignAuthorAction,
hasAuthors
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _post$_links$wpActio;
const post = select(store_store).getCurrentPost();
const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
return {
hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
hasAuthors: authors?.length >= 1
};
}, []);
if (!hasAssignAuthorAction || !hasAuthors) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "author",
children: children
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostAuthorToggle({
isOpen,
onClick
}) {
const {
postAuthor
} = useAuthorsQuery();
const authorName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor?.name) || (0,external_wp_i18n_namespaceObject.__)('(No author)');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
size: "compact",
className: "editor-post-author__panel-toggle",
variant: "tertiary",
"aria-expanded": isOpen,
"aria-label":
// translators: %s: Author name.
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change author: %s'), authorName),
onClick: onClick,
children: authorName
});
}
/**
* Renders the Post Author Panel component.
*
* @return {Component} The component to be rendered.
*/
function panel_PostAuthor() {
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
anchor: popoverAnchor,
placement: 'left-start',
offset: 36,
shift: true
}), [popoverAnchor]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
ref: setPopoverAnchor,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
contentClassName: "editor-post-author__panel-dialog",
focusOnMount: true,
renderToggle: ({
isOpen,
onToggle
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorToggle, {
isOpen: isOpen,
onClick: onToggle
}),
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-author",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Author'),
onClose: onClose
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author, {
onClose: onClose
})]
})
})
})
});
}
/* harmony default export */ const panel = (panel_PostAuthor);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const COMMENT_OPTIONS = [{
label: (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"'),
value: 'open',
description: (0,external_wp_i18n_namespaceObject.__)('Visitors can add new comments and replies.')
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Closed'),
value: 'closed',
description: [(0,external_wp_i18n_namespaceObject.__)('Visitors cannot add new comments or replies.'), (0,external_wp_i18n_namespaceObject.__)('Existing comments remain visible.')].join(' ')
}];
function PostComments() {
const commentStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
return (_select$getEditedPost = select(store_store).getEditedPostAttribute('comment_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open';
}, []);
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const handleStatus = newCommentStatus => editPost({
comment_status: newCommentStatus
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RadioControl, {
className: "editor-change-status__options",
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Comment status'),
options: COMMENT_OPTIONS,
onChange: handleStatus,
selected: commentStatus
})
})
});
}
/**
* A form for managing comment status.
*
* @return {JSX.Element} The rendered PostComments component.
*/
/* harmony default export */ const post_comments = (PostComments);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostPingbacks() {
const pingStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getEditedPost;
return (_select$getEditedPost = select(store_store).getEditedPostAttribute('ping_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open';
}, []);
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const onTogglePingback = () => editPost({
ping_status: pingStatus === 'open' ? 'closed' : 'open'
});
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Enable pingbacks & trackbacks'),
checked: pingStatus === 'open',
onChange: onTogglePingback,
help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'),
children: (0,external_wp_i18n_namespaceObject.__)('Learn more about pingbacks & trackbacks')
})
});
}
/**
* Renders a control for enabling or disabling pingbacks and trackbacks
* in a WordPress post.
*
* @module PostPingbacks
*/
/* harmony default export */ const post_pingbacks = (PostPingbacks);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const panel_PANEL_NAME = 'discussion-panel';
function ModalContents({
onClose
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-discussion",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
onClose: onClose
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "comments",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments, {})
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "trackbacks",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks, {})
})]
})]
});
}
function PostDiscussionToggle({
isOpen,
onClick
}) {
const {
commentStatus,
pingStatus,
commentsSupported,
trackbacksSupported
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _getEditedPostAttribu, _getEditedPostAttribu2;
const {
getEditedPostAttribute
} = select(store_store);
const {
getPostType
} = select(external_wp_coreData_namespaceObject.store);
const postType = getPostType(getEditedPostAttribute('type'));
return {
commentStatus: (_getEditedPostAttribu = getEditedPostAttribute('comment_status')) !== null && _getEditedPostAttribu !== void 0 ? _getEditedPostAttribu : 'open',
pingStatus: (_getEditedPostAttribu2 = getEditedPostAttribute('ping_status')) !== null && _getEditedPostAttribu2 !== void 0 ? _getEditedPostAttribu2 : 'open',
commentsSupported: !!postType.supports.comments,
trackbacksSupported: !!postType.supports.trackbacks
};
}, []);
let label;
if (commentStatus === 'open') {
if (pingStatus === 'open') {
label = (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"');
} else {
label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)('Comments only') : (0,external_wp_i18n_namespaceObject._x)('Open', 'Adjective: e.g. "Comments are open"');
}
} else if (pingStatus === 'open') {
label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)('Pings only') : (0,external_wp_i18n_namespaceObject.__)('Pings enabled');
} else {
label = (0,external_wp_i18n_namespaceObject.__)('Closed');
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
size: "compact",
className: "editor-post-discussion__panel-toggle",
variant: "tertiary",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Change discussion options'),
"aria-expanded": isOpen,
onClick: onClick,
children: label
});
}
/**
* This component allows to update comment and pingback
* settings for the current post. Internally there are
* checks whether the current post has support for the
* above and if the `discussion-panel` panel is enabled.
*
* @return {JSX.Element|null} The rendered PostDiscussionPanel component.
*/
function PostDiscussionPanel() {
const {
isEnabled
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isEditorPanelEnabled
} = select(store_store);
return {
isEnabled: isEditorPanelEnabled(panel_PANEL_NAME)
};
}, []);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
anchor: popoverAnchor,
placement: 'left-start',
offset: 36,
shift: true
}), [popoverAnchor]);
if (!isEnabled) {
return null;
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: ['comments', 'trackbacks'],
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row, {
label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
ref: setPopoverAnchor,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
className: "editor-post-discussion__panel-dropdown",
contentClassName: "editor-post-discussion__panel-dialog",
focusOnMount: true,
renderToggle: ({
isOpen,
onToggle
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionToggle, {
isOpen: isOpen,
onClick: onToggle
}),
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, {
onClose: onClose
})
})
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders an editable textarea for the post excerpt.
* Templates, template parts and patterns use the `excerpt` field as a description semantically.
* Additionally templates and template parts override the `excerpt` field as `description` in
* REST API. So this component handles proper labeling and updating the edited entity.
*
* @param {Object} props - Component props.
* @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label.
* @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur.
*/
function PostExcerpt({
hideLabelFromVision = false,
updateOnBlur = false
}) {
const {
excerpt,
shouldUseDescriptionLabel,
usedAttribute
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostType,
getEditedPostAttribute
} = select(store_store);
const postType = getCurrentPostType();
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
// support the excerpt field throught the "description" field rather than "excerpt".
const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt';
return {
excerpt: getEditedPostAttribute(_usedAttribute),
// There are special cases where we want to label the excerpt as a description.
shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType),
usedAttribute: _usedAttribute
};
}, []);
const {
editPost
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt));
const updatePost = value => {
editPost({
[usedAttribute]: value
});
};
const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Write a description (optional)') : (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
className: "editor-post-excerpt",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, {
__nextHasNoMarginBottom: true,
label: label,
hideLabelFromVision: hideLabelFromVision,
className: "editor-post-excerpt__textarea",
onChange: updateOnBlur ? setLocalExcerpt : updatePost,
onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined,
value: updateOnBlur ? localExcerpt : excerpt,
help: !shouldUseDescriptionLabel ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'),
children: (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts')
}) : (0,external_wp_i18n_namespaceObject.__)('Write a description')
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
/**
* Internal dependencies
*/
/**
* Component for checking if the post type supports the excerpt field.
*
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered.
*
* @return {Component} The component to be rendered.
*/
function PostExcerptCheck({
children
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "excerpt",
children: children
});
}
/* harmony default export */ const post_excerpt_check = (PostExcerptCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js
/**
* Defines as extensibility slot for the Excerpt panel.
*/
/**
* WordPress dependencies
*/
const {
Fill: plugin_Fill,
Slot: plugin_Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostExcerpt');
/**
* Renders a post excerpt panel in the post sidebar.
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the row.
* @param {Element} props.children Children to be rendered.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt;
*
* function MyPluginPostExcerpt() {
* return React.createElement(
* PluginPostExcerpt,
* {
* className: 'my-plugin-post-excerpt',
* },
* __( 'Post excerpt custom content' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post';
*
* const MyPluginPostExcerpt = () => (
* <PluginPostExcerpt className="my-plugin-post-excerpt">
* { __( 'Post excerpt custom content' ) }
* </PluginPostExcerpt>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginPostExcerpt = ({
children,
className
}) => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, {
className: className,
children: children
})
});
};
PluginPostExcerpt.Slot = plugin_Slot;
/* harmony default export */ const post_excerpt_plugin = (PluginPostExcerpt);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const post_excerpt_panel_PANEL_NAME = 'post-excerpt';
function ExcerptPanel() {
const {
isOpened,
isEnabled,
postType
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isEditorPanelOpened,
isEditorPanelEnabled,
getCurrentPostType
} = select(store_store);
return {
isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME),
isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME),
postType: getCurrentPostType()
};
}, []);
const {
toggleEditorPanelOpened
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const toggleExcerptPanel = () => toggleEditorPanelOpened(post_excerpt_panel_PANEL_NAME);
if (!isEnabled) {
return null;
}
// There are special cases where we want to label the excerpt as a description.
const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
opened: isOpened,
onToggle: toggleExcerptPanel,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, {
children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), fills]
})
})
});
}
/**
* Is rendered if the post type supports excerpts and allows editing the excerpt.
*
* @return {JSX.Element} The rendered PostExcerptPanel component.
*/
function PostExcerptPanel() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {})
});
}
function PrivatePostExcerptPanel() {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {})
});
}
function PrivateExcerpt() {
const {
shouldRender,
excerpt,
shouldBeUsedAsDescription,
allowEditing
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCurrentPostType,
getCurrentPostId,
getEditedPostAttribute,
isEditorPanelEnabled
} = select(store_store);
const postType = getCurrentPostType();
const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType);
const isPattern = postType === 'wp_block';
// These post types use the `excerpt` field as a description semantically, so we need to
// handle proper labeling and some flows where we should always render them as text.
const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern;
const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt';
// We need to fetch the entity in this case to check if we'll allow editing.
const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, getCurrentPostId());
// For post types that use excerpt as description, we do not abide
// by the `isEnabled` panel flag in order to render them as text.
const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription;
return {
excerpt: getEditedPostAttribute(_usedAttribute),
shouldRender: _shouldRender,
shouldBeUsedAsDescription: _shouldBeUsedAsDescription,
// If we should render, allow editing for all post types that are not used as description.
// For the rest allow editing only for user generated entities.
allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file && template.is_custom)
};
}, []);
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Description') : (0,external_wp_i18n_namespaceObject.__)('Excerpt');
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Anchor the popover to the middle of the entire row so that it doesn't
// move around when the label changes.
anchor: popoverAnchor,
'aria-label': label,
headerTitle: label,
placement: 'left-start',
offset: 36,
shift: true
}), [popoverAnchor, label]);
if (!shouldRender) {
return false;
}
const excerptText = !!excerpt && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
align: "left",
numberOfLines: 4,
truncate: allowEditing,
children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt)
});
if (!allowEditing) {
return excerptText;
}
const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Add a description…') : (0,external_wp_i18n_namespaceObject.__)('Add an excerpt…');
const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)('Edit description') : (0,external_wp_i18n_namespaceObject.__)('Edit excerpt');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
children: [excerptText, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
className: "editor-post-excerpt__dropdown",
contentClassName: "editor-post-excerpt__dropdown__content",
popoverProps: popoverProps,
focusOnMount: true,
ref: setPopoverAnchor,
renderToggle: ({
onToggle
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
onClick: onToggle,
variant: "link",
children: excerptText ? triggerEditLabel : excerptPlaceholder
}),
renderContent: ({
onClose
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
title: label,
onClose: onClose
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_plugin.Slot, {
children: fills => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {
hideLabelFromVision: true,
updateOnBlur: true
}), fills]
})
})
})]
})
})]
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Checks if the current theme supports specific features and renders the children if supported.
*
* @param {Object} props The component props.
* @param {Element} props.children The children to render if the theme supports the specified features.
* @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.
*
* @return {JSX.Element|null} The rendered children if the theme supports the specified features, otherwise null.
*/
function ThemeSupportCheck({
children,
supportKeys
}) {
const {
postType,
themeSupports
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
return {
postType: select(store_store).getEditedPostAttribute('type'),
themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports()
};
}, []);
const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
var _themeSupports$key;
const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false;
// 'post-thumbnails' can be boolean or an array of post types.
// In the latter case, we need to verify `postType` exists
// within `supported`. If `postType` isn't passed, then the check
// should fail.
if ('post-thumbnails' === key && Array.isArray(supported)) {
return supported.includes(postType);
}
return supported;
});
if (!isSupported) {
return null;
}
return children;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
/**
* Internal dependencies
*/
/**
* Wrapper component that renders its children only if the post type supports a featured image
* and the theme supports post thumbnails.
*
* @param {Object} props Props.
* @param {Element} props.children Children to be rendered.
*
* @return {Component} The component to be rendered.
*/
function PostFeaturedImageCheck({
children
}) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, {
supportKeys: "post-thumbnails",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check, {
supportKeys: "thumbnail",
children: children
})
});
}
/* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ALLOWED_MEDIA_TYPES = ['image'];
// Used when labels from post type were not yet loaded or when they are not present.
const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image');
const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Add a featured image');
const instructions = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.')
});
function getMediaDetails(media, postId) {
var _media$media_details$, _media$media_details$2;
if (!media) {
return {};
}
const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
return {
mediaWidth: media.media_details.sizes[defaultSize].width,
mediaHeight: media.media_details.sizes[defaultSize].height,
mediaSourceUrl: media.media_details.sizes[defaultSize].source_url
};
}
// Use fallbackSize when defaultSize is not available.
const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
return {
mediaWidth: media.media_details.sizes[fallbackSize].width,
mediaHeight: media.media_details.sizes[fallbackSize].height,
mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url
};
}
// Use full image size when fallbackSize and defaultSize are not available.
return {
mediaWidth: media.media_details.width,
mediaHeight: media.media_details.height,
mediaSourceUrl: media.source_url
};
}
function PostFeaturedImage({
currentPostId,
featuredImageId,
onUpdateImage,
onRemoveImage,
media,
postType,
noticeUI,
noticeOperations
}) {
const toggleRef = (0,external_wp_element_namespaceObject.useRef)();
const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
const {
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
mediaSourceUrl
} = getMediaDetails(media, currentPostId);
function onDropFiles(filesList) {
getSettings().mediaUpload({
allowedTypes: ALLOWED_MEDIA_TYPES,
filesList,
onFileChange([image]) {
if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) {
setIsLoading(true);
return;
}
if (image) {
onUpdateImage(image);
}
setIsLoading(false);
},
onError(message) {
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice(message);
}
});
}
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check, {
children: [noticeUI, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-featured-image",
child
Showing 512.00 KB of 1.01 MB. Use Edit/Download for full content.
Directory Contents
Dirs: 3 × Files: 122