PageSourceSearch

https://www.tromso.kommune.no/modules/contrib/gutenberg/js/vendor/gutenberg/editor/index.js?tlu16d

js tromso.kommune.no collected 2026-09-24 18:30:47 UTC 424,122 bytes, 12,817 lines download raw bytes

vendor: 5,372 bytes, lines 1-178
1/******/ (() => { // webpackBootstrap
2/******/ 	var __webpack_modules__ = ({
3
4/***/ 6411:
5/***/ (function(module, exports) {
6
7var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
8	autosize 4.0.2
9	license: MIT
10	http://www.jacklmoore.com/autosize
11*/
12(function (global, factory) {
13	if (true) {
14		!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
15		__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
16		(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
17		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
18	} else { var mod; }
19})(this, function (module, exports) {
20	'use strict';
21
22	var map = typeof Map === "function" ? new Map() : function () {
23		var keys = [];
24		var values = [];
25
26		return {
27			has: function has(key) {
28				return keys.indexOf(key) > -1;
29			},
30			get: function get(key) {
31				return values[keys.indexOf(key)];
32			},
33			set: function set(key, value) {
34				if (keys.indexOf(key) === -1) {
35					keys.push(key);
36					values.push(value);
37				}
38			},
39			delete: function _delete(key) {
40				var index = keys.indexOf(key);
41				if (index > -1) {
42					keys.splice(index, 1);
43					values.splice(index, 1);
44				}
45			}
46		};
47	}();
48
49	var createEvent = function createEvent(name) {
50		return new Event(name, { bubbles: true });
51	};
52	try {
53		new Event('test');
54	} catch (e) {
55		// IE does not support `new Event()`
56		createEvent = function createEvent(name) {
57			var evt = document.createEvent('Event');
58			evt.initEvent(name, true, false);
59			return evt;
60		};
61	}
62
63	function assign(ta) {
64		if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
65
66		var heightOffset = null;
67		var clientWidth = null;
68		var cachedHeight = null;
69
70		function init() {
71			var style = window.getComputedStyle(ta, null);
72
73			if (style.resize === 'vertical') {
74				ta.style.resize = 'none';
75			} else if (style.resize === 'both') {
76				ta.style.resize = 'horizontal';
77			}
78
79			if (style.boxSizing === 'content-box') {
80				heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
81			} else {
82				heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
83			}
84			// Fix when a textarea is not on document body and heightOffset is Not a Number
85			if (isNaN(heightOffset)) {
86				heightOffset = 0;
87			}
88
89			update();
90		}
91
92		function changeOverflow(value) {
93			{
94				// Chrome/Safari-specific fix:
95				// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
96				// made available by removing the scrollbar. The following forces the necessary text reflow.
97				var width = ta.style.width;
98				ta.style.width = '0px';
99				// Force reflow:
100				/* jshint ignore:start */
101				ta.offsetWidth;
102				/* jshint ignore:end */
103				ta.style.width = width;
104			}
105
106			ta.style.overflowY = value;
107		}
108
109		function getParentOverflows(el) {
110			var arr = [];
111
112			while (el && el.parentNode && el.parentNode instanceof Element) {
113				if (el.parentNode.scrollTop) {
114					arr.push({
115						node: el.parentNode,
116						scrollTop: el.parentNode.scrollTop
117					});
118				}
119				el = el.parentNode;
120			}
121
122			return arr;
123		}
124
125		function resize() {
126			if (ta.scrollHeight === 0) {
127				// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
128				return;
129			}
130
131			var overflows = getParentOverflows(ta);
132			var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
133
134			ta.style.height = '';
135			ta.style.height = ta.scrollHeight + heightOffset + 'px';
136
137			// used to check if an update is actually necessary on window.resize
138			clientWidth = ta.clientWidth;
139
140			// prevents scroll-position jumping
141			overflows.forEach(function (el) {
142				el.node.scrollTop = el.scrollTop;
143			});
144
145			if (docTop) {
146				document.documentElement.scrollTop = docTop;
147			}
148		}
149
150		function update() {
151			resize();
152
153			var styleHeight = Math.round(parseFloat(ta.style.height));
154			var computed = window.getComputedStyle(ta, null);
155
156			// Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
157			var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
158
159			// The actual height not matching the style height (set via the resize method) indicates that 
160			// the max-height has been exceeded, in which case the overflow should be allowed.
161			if (actualHeight < styleHeight) {
162				if (computed.overflowY === 'hidden') {
163					changeOverflow('scroll');
164					resize();
165					actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
166				}
167			} else {
168				// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
169				if (computed.overflowY !== 'hidden') {
170					changeOverflow('hidden');
171					resize();
172					actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
173				}
174			}
175
176			if (cachedHeight !== actualHeight) {
177				cachedHeight = actualHeight;
178				var evt = createEvent('autosize:resized');
179				try {
180					ta.dispatchEvent(evt);
181				} catch (err) {
182					// Firefox will throw an error on dispatchEvent for a detached element
183					// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
184				}
185			}
186		}
187
188		var pageResize = function pageResize() {
189			if (ta.clientWidth !== clientWidth) {
190				update();
191			}
192		};
193
194		var destroy = function (style) {
195			window.removeEventListener('resize', pageResize, false);
196			ta.removeEventListener('input', update, false);
197			ta.removeEventListener('keyup', update, false);
198			ta.removeEventListener('autosize:destroy', destroy, false);
199			ta.removeEventListener('autosize:update', update, false);
200
201			Object.keys(style).forEach(function (key) {
202				ta.style[key] = style[key];
203			});
204
205			map.delete(ta);
206		}.bind(ta, {
207			height: ta.style.height,
208			resize: ta.style.resize,
209			overflowY: ta.style.overflowY,
210			overflowX: ta.style.overflowX,
211			wordWrap: ta.style.wordWrap
212		});
213
214		ta.addEventListener('autosize:destroy', destroy, false);
215
216		// IE9 does not fire onpropertychange or oninput for deletions,
217		// so binding to onkeyup to catch most of those events.
218		// There is no way that I know of to detect something like 'cut' in IE9.
219		if ('onpropertychange' in ta && 'oninput' in ta) {
220			ta.addEventListener('keyup', update, false);
221		}
222
223		window.addEventListener('resize', pageResize, false);
224		ta.addEventListener('input', update, false);
225		ta.addEventListener('autosize:update', update, false);
226		ta.style.overflowX = 'hidden';
227		ta.style.wordWrap = 'break-word';
228
229		map.set(ta, {
230			destroy: destroy,
231			update: update
232		});
233
234		init();
235	}
236
237	function destroy(ta) {
238		var methods = map.get(ta);
239		if (methods) {
240			methods.destroy();
241		}
242	}
243
244	function update(ta) {
245		var methods = map.get(ta);
246		if (methods) {
247			methods.update();
248		}
249	}
250
251	var autosize = null;
252
253	// Do nothing in Node.js environment and IE8 (or lower)
254	if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
255		autosize = function autosize(el) {
256			return el;
257		};
258		autosize.destroy = function (el) {
259			return el;
260		};
261		autosize.update = function (el) {
262			return el;
263		};
264	} else {
265		autosize = function autosize(el, options) {
266			if (el) {
267				Array.prototype.forEach.call(el.length ? el : [el], function (x) {
268					return assign(x, options);
269				});
270			}
271			return el;
272		};
273		autosize.destroy = function (el) {
274			if (el) {
275				Array.prototype.forEach.call(el.length ? el : [el], destroy);
276			}
277			return el;
278		};
279		autosize.update = function (el) {
280			if (el) {
281				Array.prototype.forEach.call(el.length ? el : [el], update);
282			}
283			return el;
284		};
285	}
286
287	exports.default = autosize;
288	module.exports = exports['default'];
289});
290
291/***/ }),
292
293/***/ 4403:
294/***/ ((module, exports) => {
295
296var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
297  Copyright (c) 2018 Jed Watson.
298  Licensed under the MIT License (MIT), see
299  http://jedwatson.github.io/classnames
300*/
301/* global define */
302
303(function () {
304	'use strict';
305
306	var hasOwn = {}.hasOwnProperty;
307
308	function classNames() {
309		var classes = [];
310
311		for (var i = 0; i < arguments.length; i++) {
312			var arg = arguments[i];
313			if (!arg) continue;
314
315			var argType = typeof arg;
316
317			if (argType === 'string' || argType === 'number') {
318				classes.push(arg);
319			} else if (Array.isArray(arg)) {
320				if (arg.length) {
321					var inner = classNames.apply(null, arg);
322					if (inner) {
323						classes.push(inner);
324					}
325				}
326			} else if (argType === 'object') {
327				if (arg.toString === Object.prototype.toString) {
328					for (var key in arg) {
329						if (hasOwn.call(arg, key) && arg[key]) {
330							classes.push(key);
331						}
332					}
333				} else {
334					classes.push(arg.toString());
335				}
336			}
337		}
338
339		return classes.join(' ');
340	}
341
342	if ( true && module.exports) {
343		classNames.default = classNames;
344		module.exports = classNames;
345	} else if (true) {
346		// register as 'classnames', consistent with npm package name
347		!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
348			return classNames;
349		}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
350		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
351	} else {}
352}());
353
354
355/***/ }),
356
357/***/ 4827:
358/***/ ((module) => {
359
360// This code has been refactored for 140 bytes
361// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
362var computedStyle = function (el, prop, getComputedStyle) {
363  getComputedStyle = window.getComputedStyle;
364
365  // In one fell swoop
366  return (
367    // If we have getComputedStyle
368    getComputedStyle ?
369      // Query it
370      // TODO: From CSS-Query notes, we might need (node, null) for FF
371      getComputedStyle(el) :
372
373    // Otherwise, we are in IE and use currentStyle
374      el.currentStyle
375  )[
376    // Switch to camelCase for CSSOM
377    // DEV: Grabbed from jQuery
378    // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
379    // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
380    prop.replace(/-(\w)/gi, function (word, letter) {
381      return letter.toUpperCase();
382    })
383  ];
384};
385
386module.exports = computedStyle;
387
388
389/***/ }),
390
391/***/ 9894:
392/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
393
394// Load in dependencies
395var computedStyle = __webpack_require__(4827);
396
397/**
398 * Calculate the `line-height` of a given node
399 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
400 * @returns {Number} `line-height` of the element in pixels
401 */
402function lineHeight(node) {
403  // Grab the line-height via style
404  var lnHeightStr = computedStyle(node, 'line-height');
405  var lnHeight = parseFloat(lnHeightStr, 10);
406
407  // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
408  if (lnHeightStr === lnHeight + '') {
409    // Save the old lineHeight style and update the em unit to the element
410    var _lnHeightStyle = node.style.lineHeight;
411    node.style.lineHeight = lnHeightStr + 'em';
412
413    // Calculate the em based height
414    lnHeightStr = computedStyle(node, 'line-height');
415    lnHeight = parseFloat(lnHeightStr, 10);
416
417    // Revert the lineHeight style
418    if (_lnHeightStyle) {
419      node.style.lineHeight = _lnHeightStyle;
420    } else {
421      delete node.style.lineHeight;
422    }
423  }
424
425  // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
426  // DEV: `em` units are converted to `pt` in IE6
427  // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
428  if (lnHeightStr.indexOf('pt') !== -1) {
429    lnHeight *= 4;
430    lnHeight /= 3;
431  // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
432  } else if (lnHeightStr.indexOf('mm') !== -1) {
433    lnHeight *= 96;
434    lnHeight /= 25.4;
435  // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
436  } else if (lnHeightStr.indexOf('cm') !== -1) {
437    lnHeight *= 96;
438    lnHeight /= 2.54;
439  // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
440  } else if (lnHeightStr.indexOf('in') !== -1) {
441    lnHeight *= 96;
442  // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
443  } else if (lnHeightStr.indexOf('pc') !== -1) {
444    lnHeight *= 16;
445  }
446
447  // Continue our computation
448  lnHeight = Math.round(lnHeight);
449
450  // If the line-height is "normal", calculate by font-size
451  if (lnHeightStr === 'normal') {
452    // Create a temporary node
453    var nodeName = node.nodeName;
454    var _node = document.createElement(nodeName);
455    _node.innerHTML = '&nbsp;';
456
457    // If we have a text area, reset it to only 1 row
458    // https://github.com/twolfson/line-height/issues/4
459    if (nodeName.toUpperCase() === 'TEXTAREA') {
460      _node.setAttribute('rows', '1');
461    }
462
463    // Set the font-size of the element
464    var fontSizeStr = computedStyle(node, 'font-size');
465    _node.style.fontSize = fontSizeStr;
466
467    // Remove default padding/border which can affect offset height
468    // https://github.com/twolfson/line-height/issues/4
469    // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
470    _node.style.padding = '0px';
471    _node.style.border = '0px';
472
473    // Append it to the body
474    var body = document.body;
475    body.appendChild(_node);
476
477    // Assume the line height of the element is the height
478    var height = _node.offsetHeight;
479    lnHeight = height;
480
481    // Remove our child from the DOM
482    body.removeChild(_node);
483  }
484
485  // Return the calculated height
486  return lnHeight;
487}
488
489// Export lineHeight
490module.exports = lineHeight;
491
492
493/***/ }),
494
495/***/ 5372:
496/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
497
498"use strict";
499/**
500 * Copyright (c) 2013-present, Facebook, Inc.
501 *
502 * This source code is licensed under the MIT license found in the
503 * LICENSE file in the root directory of this source tree.
504 */
505
506
507
508var ReactPropTypesSecret = __webpack_require__(9567);
509
510function emptyFunction() {}
511function emptyFunctionWithReset() {}
512emptyFunctionWithReset.resetWarningCache = emptyFunction;
513
514module.exports = function() {
515  function shim(props, propName, componentName, location, propFullName, secret) {
516    if (secret === ReactPropTypesSecret) {
517      // It is still safe when called from React.
518      return;
519    }
520    var err = new Error(
521      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
522      'Use PropTypes.checkPropTypes() to call them. ' +
523      'Read more at http://fb.me/use-check-prop-types'
524    );
525    err.name = 'Invariant Violation';
526    throw err;
527  };
528  shim.isRequired = shim;
529  function getShim() {
530    return shim;
531  };
532  // Important!
533  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
534  var ReactPropTypes = {
535    array: shim,
536    bool: shim,
537    func: shim,
538    number: shim,
539    object: shim,
540    string: shim,
541    symbol: shim,
542
543    any: shim,
544    arrayOf: getShim,
545    element: shim,
546    elementType: shim,
547    instanceOf: getShim,
548    node: shim,
549    objectOf: getShim,
550    oneOf: getShim,
551    oneOfType: getShim,
552    shape: getShim,
553    exact: getShim,
554
555    checkPropTypes: emptyFunctionWithReset,
556    resetWarningCache: emptyFunction
557  };
558
559  ReactPropTypes.PropTypes = ReactPropTypes;
560
561  return ReactPropTypes;
562};
563
564
565/***/ }),
566
567/***/ 2652:
568/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
569
570/**
571 * Copyright (c) 2013-present, Facebook, Inc.
572 *
573 * This source code is licensed under the MIT license found in the
574 * LICENSE file in the root directory of this source tree.
575 */
576
577if (false) { var throwOnDirectAccess, ReactIs; } else {
578  // By explicitly using `prop-types` you are opting into new production behavior.
579  // http://fb.me/prop-types-in-prod
580  module.exports = __webpack_require__(5372)();
581}
582
583
584/***/ }),
585
586/***/ 9567:
587/***/ ((module) => {
588
589"use strict";
590/**
591 * Copyright (c) 2013-present, Facebook, Inc.
592 *
593 * This source code is licensed under the MIT license found in the
594 * LICENSE file in the root directory of this source tree.
595 */
596
597
598
599var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
600
601module.exports = ReactPropTypesSecret;
602
603
604/***/ }),
605
606/***/ 5438:
607/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
608
609"use strict";
610
611var __extends = (this && this.__extends) || (function () {
612    var extendStatics = Object.setPrototypeOf ||
613        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
614        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
615    return function (d, b) {
616        extendStatics(d, b);
617        function __() { this.constructor = d; }
618        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
619    };
620})();
621var __assign = (this && this.__assign) || Object.assign || function(t) {
622    for (var s, i = 1, n = arguments.length; i < n; i++) {
623        s = arguments[i];
624        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
625            t[p] = s[p];
626    }
627    return t;
628};
629var __rest = (this && this.__rest) || function (s, e) {
630    var t = {};
631    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
632        t[p] = s[p];
633    if (s != null && typeof Object.getOwnPropertySymbols === "function")
634        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
635            t[p[i]] = s[p[i]];
636    return t;
637};
638exports.__esModule = true;
639var React = __webpack_require__(9196);
640var PropTypes = __webpack_require__(2652);
641var autosize = __webpack_require__(6411);
642var _getLineHeight = __webpack_require__(9894);
643var getLineHeight = _getLineHeight;
644var RESIZED = "autosize:resized";
645/**
646 * A light replacement for built-in textarea component
647 * which automaticaly adjusts its height to match the content
648 */
649var TextareaAutosizeClass = /** @class */ (function (_super) {
650    __extends(TextareaAutosizeClass, _super);
651    function TextareaAutosizeClass() {
652        var _this = _super !== null && _super.apply(this, arguments) || this;
653        _this.state = {
654            lineHeight: null
655        };
656        _this.textarea = null;
657        _this.onResize = function (e) {
658            if (_this.props.onResize) {
659                _this.props.onResize(e);
660            }
661        };
662        _this.updateLineHeight = function () {
663            if (_this.textarea) {
664                _this.setState({
665                    lineHeight: getLineHeight(_this.textarea)
666                });
667            }
668        };
669        _this.onChange = function (e) {
670            var onChange = _this.props.onChange;
671            _this.currentValue = e.currentTarget.value;
672            onChange && onChange(e);
673        };
674        return _this;
675    }
676    TextareaAutosizeClass.prototype.componentDidMount = function () {
677        var _this = this;
678        var _a = this.props, maxRows = _a.maxRows, async = _a.async;
679        if (typeof maxRows === "number") {
680            this.updateLineHeight();
681        }
682        if (typeof maxRows === "number" || async) {
683            /*
684              the defer is needed to:
685                - force "autosize" to activate the scrollbar when this.props.maxRows is passed
686                - support StyledComponents (see #71)
687            */
688            setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
689        }
690        else {
691            this.textarea && autosize(this.textarea);
692        }
693        if (this.textarea) {
694            this.textarea.addEventListener(RESIZED, this.onResize);
695        }
696    };
697    TextareaAutosizeClass.prototype.componentWillUnmount = function () {
698        if (this.textarea) {
699            this.textarea.removeEventListener(RESIZED, this.onResize);
700            autosize.destroy(this.textarea);
701        }
702    };
703    TextareaAutosizeClass.prototype.render = function () {
704        var _this = this;
705        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;
706        var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
707        return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
708                _this.textarea = element;
709                if (typeof _this.props.innerRef === 'function') {
710                    _this.props.innerRef(element);
711                }
712                else if (_this.props.innerRef) {
713                    _this.props.innerRef.current = element;
714                }
715            } }), children));
716    };
717    TextareaAutosizeClass.prototype.componentDidUpdate = function () {
718        this.textarea && autosize.update(this.textarea);
719    };
720    TextareaAutosizeClass.defaultProps = {
721        rows: 1,
722        async: false
723    };
724    TextareaAutosizeClass.propTypes = {
725        rows: PropTypes.number,
726        maxRows: PropTypes.number,
727        onResize: PropTypes.func,
728        innerRef: PropTypes.any,
729        async: PropTypes.bool
730    };
731    return TextareaAutosizeClass;
732}(React.Component));
733exports.TextareaAutosize = React.forwardRef(function (props, ref) {
734    return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
735});
736
737
738/***/ }),
739
740/***/ 773:
741/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
742
743"use strict";
744var __webpack_unused_export__;
745
746__webpack_unused_export__ = true;
747var TextareaAutosize_1 = __webpack_require__(5438);
748exports.Z = TextareaAutosize_1.TextareaAutosize;
749
750
751/***/ }),
752
753/***/ 4793:
754/***/ ((module) => {
755
756var characterMap = {
757	"À": "A",
758	"Á": "A",
759	"Â": "A",
760	"Ã": "A",
761	"Ä": "A",
762	"Å": "A",
763	"Ấ": "A",
764	"Ắ": "A",
765	"Ẳ": "A",
766	"Ẵ": "A",
767	"Ặ": "A",
768	"Æ": "AE",
769	"Ầ": "A",
770	"Ằ": "A",
771	"Ȃ": "A",
772	"Ả": "A",
773	"Ạ": "A",
774	"Ẩ": "A",
775	"Ẫ": "A",
776	"Ậ": "A",
777	"Ç": "C",
778	"Ḉ": "C",
779	"È": "E",
780	"É": "E",
781	"Ê": "E",
782	"Ë": "E",
783	"Ế": "E",
784	"Ḗ": "E",
785	"Ề": "E",
786	"Ḕ": "E",
787	"Ḝ": "E",
788	"Ȇ": "E",
789	"Ẻ": "E",
790	"Ẽ": "E",
791	"Ẹ": "E",
792	"Ể": "E",
793	"Ễ": "E",
794	"Ệ": "E",
795	"Ì": "I",
796	"Í": "I",
797	"Î": "I",
798	"Ï": "I",
799	"Ḯ": "I",
800	"Ȋ": "I",
801	"Ỉ": "I",
802	"Ị": "I",
803	"Ð": "D",
804	"Ñ": "N",
805	"Ò": "O",
806	"Ó": "O",
807	"Ô": "O",
808	"Õ": "O",
809	"Ö": "O",
810	"Ø": "O",
811	"Ố": "O",
812	"Ṍ": "O",
813	"Ṓ": "O",
814	"Ȏ": "O",
815	"Ỏ": "O",
816	"Ọ": "O",
817	"Ổ": "O",
818	"Ỗ": "O",
819	"Ộ": "O",
820	"Ờ": "O",
821	"Ở": "O",
822	"á» ": "O",
823	"Ớ": "O",
824	"Ợ": "O",
825	"Ù": "U",
826	"Ú": "U",
827	"Û": "U",
828	"Ü": "U",
829	"Ủ": "U",
830	"Ụ": "U",
831	"Ử": "U",
832	"á»®": "U",
833	"á»°": "U",
834	"Ý": "Y",
835	"à": "a",
836	"á": "a",
837	"â": "a",
838	"ã": "a",
839	"ä": "a",
840	"Ã¥": "a",
841	"ấ": "a",
842	"ắ": "a",
843	"ẳ": "a",
844	"ẵ": "a",
845	"ặ": "a",
846	"æ": "ae",
847	"ầ": "a",
848	"ằ": "a",
849	"ȃ": "a",
850	"ả": "a",
851	"ạ": "a",
852	"ẩ": "a",
853	"ẫ": "a",
854	"ậ": "a",
855	"ç": "c",
856	"ḉ": "c",
857	"è": "e",
858	"é": "e",
859	"ê": "e",
860	"ë": "e",
861	"ế": "e",
862	"ḗ": "e",
863	"ề": "e",
864	"ḕ": "e",
865	"ḝ": "e",
866	"ȇ": "e",
867	"ẻ": "e",
868	"ẽ": "e",
869	"ẹ": "e",
870	"ể": "e",
871	"ễ": "e",
872	"ệ": "e",
873	"ì": "i",
874	"í": "i",
875	"î": "i",
876	"ï": "i",
877	"ḯ": "i",
878	"ȋ": "i",
879	"ỉ": "i",
880	"ị": "i",
881	"ð": "d",
882	"ñ": "n",
883	"ò": "o",
884	"ó": "o",
885	"ô": "o",
886	"õ": "o",
887	"ö": "o",
888	"ø": "o",
889	"ố": "o",
890	"ṍ": "o",
891	"ṓ": "o",
892	"ȏ": "o",
893	"ỏ": "o",
894	"ọ": "o",
895	"ổ": "o",
896	"ỗ": "o",
897	"ộ": "o",
898	"ờ": "o",
899	"ở": "o",
900	"ỡ": "o",
901	"ớ": "o",
902	"ợ": "o",
903	"ù": "u",
904	"ú": "u",
905	"û": "u",
906	"ü": "u",
907	"á»§": "u",
908	"ụ": "u",
909	"á»­": "u",
910	"ữ": "u",
911	"á»±": "u",
912	"ý": "y",
913	"ÿ": "y",
914	"Ā": "A",
915	"ā": "a",
916	"Ă": "A",
917	"ă": "a",
918	"Ą": "A",
919	"ą": "a",
920	"Ć": "C",
921	"ć": "c",
922	"Ĉ": "C",
923	"ĉ": "c",
924	"Ċ": "C",
925	"ċ": "c",
926	"Č": "C",
927	"č": "c",
928	"C̆": "C",
929	"c̆": "c",
930	"Ď": "D",
931	"ď": "d",
932	"Đ": "D",
933	"đ": "d",
934	"Ē": "E",
935	"ē": "e",
936	"Ĕ": "E",
937	"ĕ": "e",
938	"Ė": "E",
939	"ė": "e",
940	"Ę": "E",
941	"ę": "e",
942	"Ě": "E",
943	"ě": "e",
944	"Ĝ": "G",
945	"Ç´": "G",
946	"ĝ": "g",
947	"ǵ": "g",
948	"Ğ": "G",
949	"ğ": "g",
950	"Ä ": "G",
951	"Ä¡": "g",
952	"Ä¢": "G",
953	"Ä£": "g",
954	"Ĥ": "H",
955	"Ä¥": "h",
956	"Ħ": "H",
957	"ħ": "h",
958	"Ḫ": "H",
959	"ḫ": "h",
960	"Ĩ": "I",
961	"Ä©": "i",
962	"Ī": "I",
963	"Ä«": "i",
964	"Ĭ": "I",
965	"Ä­": "i",
966	"Ä®": "I",
967	"į": "i",
968	"İ": "I",
969	"ı": "i",
970	"IJ": "IJ",
971	"ij": "ij",
972	"Ä´": "J",
973	"ĵ": "j",
974	"Ķ": "K",
975	"Ä·": "k",
976	"Ḱ": "K",
977	"ḱ": "k",
978	"K̆": "K",
979	"k̆": "k",
980	"Ĺ": "L",
981	"ĺ": "l",
982	"Ä»": "L",
983	"ļ": "l",
984	"Ľ": "L",
985	"ľ": "l",
986	"Ä¿": "L",
987	"ŀ": "l",
988	"Ł": "l",
989	"ł": "l",
990	"Ḿ": "M",
991	"ḿ": "m",
992	"M̆": "M",
993	"m̆": "m",
994	"Ń": "N",
995	"ń": "n",
996	"Ņ": "N",
997	"ņ": "n",
998	"Ň": "N",
999	"ň": "n",
1000	"ʼn": "n",
1001	"N̆": "N",
1002	"n̆": "n",
1003	"Ō": "O",
1004	"ō": "o",
1005	"Ŏ": "O",
1006	"ŏ": "o",
1007	"Ő": "O",
1008	"ő": "o",
1009	"Œ": "OE",
1010	"œ": "oe",
1011	"P̆": "P",
1012	"p̆": "p",
1013	"Ŕ": "R",
1014	"ŕ": "r",
1015	"Ŗ": "R",
1016	"ŗ": "r",
1017	"Ř": "R",
1018	"ř": "r",
1019	"R̆": "R",
1020	"r̆": "r",
1021	"Ȓ": "R",
1022	"ȓ": "r",
1023	"Ś": "S",
1024	"ś": "s",
1025	"Ŝ": "S",
1026	"ŝ": "s",
1027	"Ş": "S",
1028	"Ș": "S",
1029	"ș": "s",
1030	"ş": "s",
1031	"Å ": "S",
1032	"Å¡": "s",
1033	"Å¢": "T",
1034	"Å£": "t",
1035	"ț": "t",
1036	"Ț": "T",
1037	"Ť": "T",
1038	"Å¥": "t",
1039	"Ŧ": "T",
1040	"ŧ": "t",
1041	"T̆": "T",
1042	"t̆": "t",
1043	"Ũ": "U",
1044	"Å©": "u",
1045	"Ū": "U",
1046	"Å«": "u",
1047	"Ŭ": "U",
1048	"Å­": "u",
1049	"Å®": "U",
1050	"ů": "u",
1051	"Ű": "U",
1052	"ű": "u",
1053	"Ų": "U",
1054	"ų": "u",
1055	"Ȗ": "U",
1056	"ȗ": "u",
1057	"V̆": "V",
1058	"v̆": "v",
1059	"Å´": "W",
1060	"ŵ": "w",
1061	"Ẃ": "W",
1062	"ẃ": "w",
1063	"X̆": "X",
1064	"x̆": "x",
1065	"Ŷ": "Y",
1066	"Å·": "y",
1067	"Ÿ": "Y",
1068	"Y̆": "Y",
1069	"y̆": "y",
1070	"Ź": "Z",
1071	"ź": "z",
1072	"Å»": "Z",
1073	"ż": "z",
1074	"Ž": "Z",
1075	"ž": "z",
1076	"Å¿": "s",
1077	"ƒ": "f",
1078	"Æ ": "O",
1079	"Æ¡": "o",
1080	"Ư": "U",
1081	"ư": "u",
1082	"Ǎ": "A",
1083	"ǎ": "a",
1084	"Ǐ": "I",
1085	"ǐ": "i",
1086	"Ǒ": "O",
1087	"ǒ": "o",
1088	"Ǔ": "U",
1089	"ǔ": "u",
1090	"Ǖ": "U",
1091	"ǖ": "u",
1092	"Ǘ": "U",
1093	"ǘ": "u",
1094	"Ǚ": "U",
1095	"ǚ": "u",
1096	"Ǜ": "U",
1097	"ǜ": "u",
1098	"Ứ": "U",
1099	"ứ": "u",
1100	"Ṹ": "U",
1101	"á¹¹": "u",
1102	"Ǻ": "A",
1103	"Ç»": "a",
1104	"Ǽ": "AE",
1105	"ǽ": "ae",
1106	"Ǿ": "O",
1107	"Ç¿": "o",
1108	"Þ": "TH",
1109	"þ": "th",
1110	"Ṕ": "P",
1111	"ṕ": "p",
1112	"Ṥ": "S",
1113	"á¹¥": "s",
1114	"X́": "X",
1115	"x́": "x",
1116	"Ѓ": "Г",
1117	"ѓ": "г",
1118	"Ќ": "К",
1119	"ќ": "к",
1120	"A̋": "A",
1121	"a̋": "a",
1122	"E̋": "E",
1123	"e̋": "e",
1124	"I̋": "I",
1125	"i̋": "i",
1126	"Ǹ": "N",
1127	"ǹ": "n",
1128	"Ồ": "O",
1129	"ồ": "o",
1130	"Ṑ": "O",
1131	"ṑ": "o",
1132	"Ừ": "U",
1133	"ừ": "u",
1134	"Ẁ": "W",
1135	"ẁ": "w",
1136	"Ỳ": "Y",
1137	"ỳ": "y",
1138	"Ȁ": "A",
1139	"ȁ": "a",
1140	"Ȅ": "E",
1141	"ȅ": "e",
1142	"Ȉ": "I",
1143	"ȉ": "i",
1144	"Ȍ": "O",
1145	"ȍ": "o",
1146	"Ȑ": "R",
1147	"ȑ": "r",
1148	"Ȕ": "U",
1149	"ȕ": "u",
1150	"B̌": "B",
1151	"b̌": "b",
1152	"Č̣": "C",
1153	"č̣": "c",
1154	"Ê̌": "E",
1155	"ê̌": "e",
1156	"F̌": "F",
1157	"f̌": "f",
1158	"Ǧ": "G",
1159	"ǧ": "g",
1160	"Ȟ": "H",
1161	"ȟ": "h",
1162	"J̌": "J",
1163	"ǰ": "j",
1164	"Ǩ": "K",
1165	"Ç©": "k",
1166	"M̌": "M",
1167	"m̌": "m",
1168	"P̌": "P",
1169	"p̌": "p",
1170	"Q̌": "Q",
1171	"q̌": "q",
1172	"Ř̩": "R",
1173	"ř̩": "r",
1174	"Ṧ": "S",
1175	"á¹§": "s",
1176	"V̌": "V",
1177	"v̌": "v",
1178	"W̌": "W",
1179	"w̌": "w",
1180	"X̌": "X",
1181	"x̌": "x",
1182	"Y̌": "Y",
1183	"y̌": "y",
1184	"A̧": "A",
1185	"a̧": "a",
1186	"B̧": "B",
1187	"b̧": "b",
1188	"Ḑ": "D",
1189	"ḑ": "d",
1190	"Ȩ": "E",
1191	"È©": "e",
1192	"Ɛ̧": "E",
1193	"ɛ̧": "e",
1194	"Ḩ": "H",
1195	"ḩ": "h",
1196	"I̧": "I",
1197	"i̧": "i",
1198	"Ɨ̧": "I",
1199	"ɨ̧": "i",
1200	"M̧": "M",
1201	"m̧": "m",
1202	"O̧": "O",
1203	"o̧": "o",
1204	"Q̧": "Q",
1205	"q̧": "q",
1206	"U̧": "U",
1207	"u̧": "u",
1208	"X̧": "X",
1209	"x̧": "x",
1210	"Z̧": "Z",
1211	"z̧": "z",
1212	"й":"и",
1213	"Й":"И",
1214	"ё":"е",
1215	"Ё":"Е",
1216};
1217
1218var chars = Object.keys(characterMap).join('|');
1219var allAccents = new RegExp(chars, 'g');
1220var firstAccent = new RegExp(chars, '');
1221
1222function matcher(match) {
1223	return characterMap[match];
1224}
1225
1226var removeAccents = function(string) {
1227	return string.replace(allAccents, matcher);
1228};
1229
1230var hasAccents = function(string) {
1231	return !!string.match(firstAccent);
1232};
1233
1234module.exports = removeAccents;
1235module.exports.has = hasAccents;
1236module.exports.remove = removeAccents;
1237
1238
1239/***/ }),
1240
1241/***/ 9196:
1242/***/ ((module) => {
1243
1244"use strict";
1245module.exports = window["React"];
1246
1247/***/ })
1248
1249/******/ 	});
1250/************************************************************************/
1251/******/ 	// The module cache
1252/******/ 	var __webpack_module_cache__ = {};
1253/******/ 	
1254/******/ 	// The require function
1255/******/ 	function __webpack_require__(moduleId) {
1256/******/ 		// Check if module is in cache
1257/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
1258/******/ 		if (cachedModule !== undefined) {
1259/******/ 			return cachedModule.exports;
1260/******/ 		}
1261/******/ 		// Create a new module (and put it into the cache)
1262/******/ 		var module = __webpack_module_cache__[moduleId] = {
1263/******/ 			// no module.id needed
1264/******/ 			// no module.loaded needed
1265/******/ 			exports: {}
1266/******/ 		};
1267/******/ 	
1268/******/ 		// Execute the module function
1269/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1270/******/ 	
1271/******/ 		// Return the exports of the module
1272/******/ 		return module.exports;
1273/******/ 	}
1274/******/ 	
1275/************************************************************************/
1276/******/ 	/* webpack/runtime/compat get default export */
1277/******/ 	(() => {
1278/******/ 		// getDefaultExport function for compatibility with non-harmony modules
1279/******/ 		__webpack_require__.n = (module) => {
vendor: 1,615 bytes, lines 1280-1320
1280/******/ 			var getter = module && module.__esModule ?
1281/******/ 				() => (module['default']) :
1282/******/ 				() => (module);
1283/******/ 			__webpack_require__.d(getter, { a: getter });
1284/******/ 			return getter;
1285/******/ 		};
1286/******/ 	})();
1287/******/ 	
1288/******/ 	/* webpack/runtime/define property getters */
1289/******/ 	(() => {
1290/******/ 		// define getter functions for harmony exports
1291/******/ 		__webpack_require__.d = (exports, definition) => {
1292/******/ 			for(var key in definition) {
1293/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1294/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1295/******/ 				}
1296/******/ 			}
1297/******/ 		};
1298/******/ 	})();
1299/******/ 	
1300/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
1301/******/ 	(() => {
1302/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1303/******/ 	})();
1304/******/ 	
1305/******/ 	/* webpack/runtime/make namespace object */
1306/******/ 	(() => {
1307/******/ 		// define __esModule on exports
1308/******/ 		__webpack_require__.r = (exports) => {
1309/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1310/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1311/******/ 			}
1312/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
1313/******/ 		};
1314/******/ 	})();
1315/******/ 	
1316/************************************************************************/
1317var __webpack_exports__ = {};
1318// This entry need to be wrapped in an IIFE because it need to be in strict mode.
1319(() => {
1320"use strict";
1321// ESM COMPAT FLAG
1322__webpack_require__.r(__webpack_exports__);
1323
1324// EXPORTS
1325__webpack_require__.d(__webpack_exports__, {
1326  "AlignmentToolbar": () => (/* reexport */ AlignmentToolbar),
1327  "Autocomplete": () => (/* reexport */ Autocomplete),
1328  "AutosaveMonitor": () => (/* reexport */ autosave_monitor),
1329  "BlockAlignmentToolbar": () => (/* reexport */ BlockAlignmentToolbar),
1330  "BlockControls": () => (/* reexport */ BlockControls),
1331  "BlockEdit": () => (/* reexport */ BlockEdit),
1332  "BlockEditorKeyboardShortcuts": () => (/* reexport */ BlockEditorKeyboardShortcuts),
1333  "BlockFormatControls": () => (/* reexport */ BlockFormatControls),
1334  "BlockIcon": () => (/* reexport */ BlockIcon),
1335  "BlockInspector": () => (/* reexport */ BlockInspector),
1336  "BlockList": () => (/* reexport */ BlockList),
1337  "BlockMover": () => (/* reexport */ BlockMover),
1338  "BlockNavigationDropdown": () => (/* reexport */ BlockNavigationDropdown),
1339  "BlockSelectionClearer": () => (/* reexport */ BlockSelectionClearer),
1340  "BlockSettingsMenu": () => (/* reexport */ BlockSettingsMenu),
1341  "BlockTitle": () => (/* reexport */ BlockTitle),
1342  "BlockToolbar": () => (/* reexport */ BlockToolbar),
1343  "CharacterCount": () => (/* reexport */ CharacterCount),
1344  "ColorPalette": () => (/* reexport */ ColorPalette),
1345  "ContrastChecker": () => (/* reexport */ ContrastChecker),
1346  "CopyHandler": () => (/* reexport */ CopyHandler),
1347  "DefaultBlockAppender": () => (/* reexport */ DefaultBlockAppender),
1348  "DocumentOutline": () => (/* reexport */ document_outline),
1349  "DocumentOutlineCheck": () => (/* reexport */ check),
1350  "EditorHistoryRedo": () => (/* reexport */ editor_history_redo),
1351  "EditorHistoryUndo": () => (/* reexport */ editor_history_undo),
1352  "EditorKeyboardShortcuts": () => (/* reexport */ EditorKeyboardShortcuts),
1353  "EditorKeyboardShortcutsRegister": () => (/* reexport */ register_shortcuts),
1354  "EditorNotices": () => (/* reexport */ editor_notices),
1355  "EditorProvider": () => (/* reexport */ provider),
1356  "EditorSnackbars": () => (/* reexport */ EditorSnackbars),
1357  "EntitiesSavedStates": () => (/* reexport */ EntitiesSavedStates),
1358  "ErrorBoundary": () => (/* reexport */ error_boundary),
1359  "FontSizePicker": () => (/* reexport */ FontSizePicker),
1360  "InnerBlocks": () => (/* reexport */ InnerBlocks),
1361  "Inserter": () => (/* reexport */ Inserter),
1362  "InspectorAdvancedControls": () => (/* reexport */ InspectorAdvancedControls),
1363  "InspectorControls": () => (/* reexport */ InspectorControls),
1364  "LocalAutosaveMonitor": () => (/* reexport */ local_autosave_monitor),
1365  "MediaPlaceholder": () => (/* reexport */ MediaPlaceholder),
1366  "MediaUpload": () => (/* reexport */ MediaUpload),
1367  "MediaUploadCheck": () => (/* reexport */ MediaUploadCheck),
1368  "MultiSelectScrollIntoView": () => (/* reexport */ MultiSelectScrollIntoView),
1369  "NavigableToolbar": () => (/* reexport */ NavigableToolbar),
1370  "ObserveTyping": () => (/* reexport */ ObserveTyping),
1371  "PageAttributesCheck": () => (/* reexport */ page_attributes_check),
1372  "PageAttributesOrder": () => (/* reexport */ PageAttributesOrderWithChecks),
1373  "PageAttributesParent": () => (/* reexport */ page_attributes_parent),
1374  "PageTemplate": () => (/* reexport */ post_template),
1375  "PanelColorSettings": () => (/* reexport */ PanelColorSettings),
1376  "PlainText": () => (/* reexport */ PlainText),
1377  "PostAuthor": () => (/* reexport */ post_author),
1378  "PostAuthorCheck": () => (/* reexport */ PostAuthorCheck),
1379  "PostComments": () => (/* reexport */ post_comments),
1380  "PostExcerpt": () => (/* reexport */ post_excerpt),
1381  "PostExcerptCheck": () => (/* reexport */ post_excerpt_check),
1382  "PostFeaturedImage": () => (/* reexport */ post_featured_image),
1383  "PostFeaturedImageCheck": () => (/* reexport */ post_featured_image_check),
1384  "PostFormat": () => (/* reexport */ PostFormat),
1385  "PostFormatCheck": () => (/* reexport */ post_format_check),
1386  "PostLastRevision": () => (/* reexport */ post_last_revision),
1387  "PostLastRevisionCheck": () => (/* reexport */ post_last_revision_check),
1388  "PostLockedModal": () => (/* reexport */ PostLockedModal),
1389  "PostPendingStatus": () => (/* reexport */ post_pending_status),
1390  "PostPendingStatusCheck": () => (/* reexport */ post_pending_status_check),
1391  "PostPingbacks": () => (/* reexport */ post_pingbacks),
1392  "PostPreviewButton": () => (/* reexport */ PostPreviewButton),
1393  "PostPublishButton": () => (/* reexport */ post_publish_button),
1394  "PostPublishButtonLabel": () => (/* reexport */ label),
1395  "PostPublishPanel": () => (/* reexport */ post_publish_panel),
1396  "PostSavedState": () => (/* reexport */ PostSavedState),
1397  "PostSchedule": () => (/* reexport */ PostSchedule),
1398  "PostScheduleCheck": () => (/* reexport */ post_schedule_check),
1399  "PostScheduleLabel": () => (/* reexport */ PostScheduleLabel),
1400  "PostSlug": () => (/* reexport */ post_slug),
1401  "PostSlugCheck": () => (/* reexport */ PostSlugCheck),
1402  "PostSticky": () => (/* reexport */ post_sticky),
1403  "PostStickyCheck": () => (/* reexport */ post_sticky_check),
1404  "PostSwitchToDraftButton": () => (/* reexport */ post_switch_to_draft_button),
1405  "PostSyncStatus": () => (/* reexport */ PostSyncStatus),
1406  "PostSyncStatusModal": () => (/* reexport */ PostSyncStatusModal),
1407  "PostTaxonomies": () => (/* reexport */ post_taxonomies),
1408  "PostTaxonomiesCheck": () => (/* reexport */ post_taxonomies_check),
1409  "PostTaxonomiesFlatTermSelector": () => (/* reexport */ FlatTermSelector),
1410  "PostTaxonomiesHierarchicalTermSelector": () => (/* reexport */ HierarchicalTermSelector),
1411  "PostTextEditor": () => (/* reexport */ PostTextEditor),
1412  "PostTitle": () => (/* reexport */ post_title),
1413  "PostTrash": () => (/* reexport */ PostTrash),
1414  "PostTrashCheck": () => (/* reexport */ post_trash_check),
1415  "PostTypeSupportCheck": () => (/* reexport */ post_type_support_check),
1416  "PostURL": () => (/* reexport */ PostURL),
1417  "PostURLCheck": () => (/* reexport */ PostURLCheck),
1418  "PostURLLabel": () => (/* reexport */ PostURLLabel),
1419  "PostVisibility": () => (/* reexport */ PostVisibility),
1420  "PostVisibilityCheck": () => (/* reexport */ post_visibility_check),
1421  "PostVisibilityLabel": () => (/* reexport */ PostVisibilityLabel),
1422  "RichText": () => (/* reexport */ RichText),
1423  "RichTextShortcut": () => (/* reexport */ RichTextShortcut),
1424  "RichTextToolbarButton": () => (/* reexport */ RichTextToolbarButton),
1425  "ServerSideRender": () => (/* reexport */ (external_wp_serverSideRender_default())),
1426  "SkipToSelectedBlock": () => (/* reexport */ SkipToSelectedBlock),
1427  "TableOfContents": () => (/* reexport */ table_of_contents),
1428  "TextEditorGlobalKeyboardShortcuts": () => (/* reexport */ TextEditorGlobalKeyboardShortcuts),
1429  "ThemeSupportCheck": () => (/* reexport */ theme_support_check),
1430  "TimeToRead": () => (/* reexport */ TimeToRead),
1431  "URLInput": () => (/* reexport */ URLInput),
1432  "URLInputButton": () => (/* reexport */ URLInputButton),
1433  "URLPopover": () => (/* reexport */ URLPopover),
1434  "UnsavedChangesWarning": () => (/* reexport */ UnsavedChangesWarning),
1435  "VisualEditorGlobalKeyboardShortcuts": () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts),
1436  "Warning": () => (/* reexport */ Warning),
1437  "WordCount": () => (/* reexport */ WordCount),
1438  "WritingFlow": () => (/* reexport */ WritingFlow),
1439  "__unstableRichTextInputEvent": () => (/* reexport */ __unstableRichTextInputEvent),
1440  "cleanForSlug": () => (/* reexport */ cleanForSlug),
1441  "createCustomColorsHOC": () => (/* reexport */ createCustomColorsHOC),
1442  "getColorClassName": () => (/* reexport */ getColorClassName),
1443  "getColorObjectByAttributeValues": () => (/* reexport */ getColorObjectByAttributeValues),
1444  "getColorObjectByColorValue": () => (/* reexport */ getColorObjectByColorValue),
1445  "getFontSize": () => (/* reexport */ getFontSize),
1446  "getFontSizeClass": () => (/* reexport */ getFontSizeClass),
1447  "getTemplatePartIcon": () => (/* reexport */ getTemplatePartIcon),
1448  "mediaUpload": () => (/* reexport */ mediaUpload),
1449  "privateApis": () => (/* reexport */ privateApis),
1450  "store": () => (/* reexport */ store_store),
1451  "storeConfig": () => (/* reexport */ storeConfig),
1452  "transformStyles": () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles),
1453  "useEntitiesSavedStatesIsDirty": () => (/* reexport */ useIsDirty),
1454  "usePostScheduleLabel": () => (/* reexport */ usePostScheduleLabel),
1455  "usePostURLLabel": () => (/* reexport */ usePostURLLabel),
1456  "usePostVisibilityLabel": () => (/* reexport */ usePostVisibilityLabel),
1457  "userAutocompleter": () => (/* reexport */ user),
1458  "withColorContext": () => (/* reexport */ withColorContext),
1459  "withColors": () => (/* reexport */ withColors),
1460  "withFontSizes": () => (/* reexport */ withFontSizes)
1461});
1462
1463// NAMESPACE OBJECT: ./packages/editor/build-module/store/selectors.js
1464var selectors_namespaceObject = {};
1465__webpack_require__.r(selectors_namespaceObject);
1466__webpack_require__.d(selectors_namespaceObject, {
1467  "__experimentalGetDefaultTemplatePartAreas": () => (__experimentalGetDefaultTemplatePartAreas),
1468  "__experimentalGetDefaultTemplateType": () => (__experimentalGetDefaultTemplateType),
1469  "__experimentalGetDefaultTemplateTypes": () => (__experimentalGetDefaultTemplateTypes),
1470  "__experimentalGetTemplateInfo": () => (__experimentalGetTemplateInfo),
1471  "__unstableIsEditorReady": () => (__unstableIsEditorReady),
1472  "canInsertBlockType": () => (canInsertBlockType),
1473  "canUserUseUnfilteredHTML": () => (canUserUseUnfilteredHTML),
1474  "didPostSaveRequestFail": () => (didPostSaveRequestFail),
1475  "didPostSaveRequestSucceed": () => (didPostSaveRequestSucceed),
1476  "getActivePostLock": () => (getActivePostLock),
1477  "getAdjacentBlockClientId": () => (getAdjacentBlockClientId),
1478  "getAutosaveAttribute": () => (getAutosaveAttribute),
1479  "getBlock": () => (getBlock),
1480  "getBlockAttributes": () => (getBlockAttributes),
1481  "getBlockCount": () => (getBlockCount),
1482  "getBlockHierarchyRootClientId": () => (getBlockHierarchyRootClientId),
1483  "getBlockIndex": () => (getBlockIndex),
1484  "getBlockInsertionPoint": () => (getBlockInsertionPoint),
1485  "getBlockListSettings": () => (getBlockListSettings),
1486  "getBlockMode": () => (getBlockMode),
1487  "getBlockName": () => (getBlockName),
1488  "getBlockOrder": () => (getBlockOrder),
1489  "getBlockRootClientId": () => (getBlockRootClientId),
1490  "getBlockSelectionEnd": () => (getBlockSelectionEnd),
1491  "getBlockSelectionStart": () => (getBlockSelectionStart),
1492  "getBlocks": () => (getBlocks),
1493  "getBlocksByClientId": () => (getBlocksByClientId),
1494  "getClientIdsOfDescendants": () => (getClientIdsOfDescendants),
1495  "getClientIdsWithDescendants": () => (getClientIdsWithDescendants),
1496  "getCurrentPost": () => (getCurrentPost),
1497  "getCurrentPostAttribute": () => (getCurrentPostAttribute),
1498  "getCurrentPostId": () => (getCurrentPostId),
1499  "getCurrentPostLastRevisionId": () => (getCurrentPostLastRevisionId),
1500  "getCurrentPostRevisionsCount": () => (getCurrentPostRevisionsCount),
1501  "getCurrentPostType": () => (getCurrentPostType),
1502  "getEditedPostAttribute": () => (getEditedPostAttribute),
1503  "getEditedPostContent": () => (getEditedPostContent),
1504  "getEditedPostPreviewLink": () => (getEditedPostPreviewLink),
1505  "getEditedPostSlug": () => (getEditedPostSlug),
1506  "getEditedPostVisibility": () => (getEditedPostVisibility),
1507  "getEditorBlocks": () => (getEditorBlocks),
1508  "getEditorSelection": () => (getEditorSelection),
1509  "getEditorSelectionEnd": () => (getEditorSelectionEnd),
1510  "getEditorSelectionStart": () => (getEditorSelectionStart),
1511  "getEditorSettings": () => (getEditorSettings),
1512  "getFirstMultiSelectedBlockClientId": () => (getFirstMultiSelectedBlockClientId),
1513  "getGlobalBlockCount": () => (getGlobalBlockCount),
1514  "getInserterItems": () => (getInserterItems),
1515  "getLastMultiSelectedBlockClientId": () => (getLastMultiSelectedBlockClientId),
1516  "getMultiSelectedBlockClientIds": () => (getMultiSelectedBlockClientIds),
1517  "getMultiSelectedBlocks": () => (getMultiSelectedBlocks),
1518  "getMultiSelectedBlocksEndClientId": () => (getMultiSelectedBlocksEndClientId),
1519  "getMultiSelectedBlocksStartClientId": () => (getMultiSelectedBlocksStartClientId),
1520  "getNextBlockClientId": () => (getNextBlockClientId),
1521  "getPermalink": () => (getPermalink),
1522  "getPermalinkParts": () => (getPermalinkParts),
1523  "getPostEdits": () => (getPostEdits),
1524  "getPostLockUser": () => (getPostLockUser),
1525  "getPostTypeLabel": () => (getPostTypeLabel),
1526  "getPreviousBlockClientId": () => (getPreviousBlockClientId),
1527  "getSelectedBlock": () => (getSelectedBlock),
1528  "getSelectedBlockClientId": () => (getSelectedBlockClientId),
1529  "getSelectedBlockCount": () => (getSelectedBlockCount),
1530  "getSelectedBlocksInitialCaretPosition": () => (getSelectedBlocksInitialCaretPosition),
1531  "getStateBeforeOptimisticTransaction": () => (getStateBeforeOptimisticTransaction),
1532  "getSuggestedPostFormat": () => (getSuggestedPostFormat),
1533  "getTemplate": () => (getTemplate),
1534  "getTemplateLock": () => (getTemplateLock),
1535  "hasChangedContent": () => (hasChangedContent),
1536  "hasEditorRedo": () => (hasEditorRedo),
1537  "hasEditorUndo": () => (hasEditorUndo),
1538  "hasInserterItems": () => (hasInserterItems),
1539  "hasMultiSelection": () => (hasMultiSelection),
1540  "hasNonPostEntityChanges": () => (hasNonPostEntityChanges),
1541  "hasSelectedBlock": () => (hasSelectedBlock),
1542  "hasSelectedInnerBlock": () => (hasSelectedInnerBlock),
1543  "inSomeHistory": () => (inSomeHistory),
1544  "isAncestorMultiSelected": () => (isAncestorMultiSelected),
1545  "isAutosavingPost": () => (isAutosavingPost),
1546  "isBlockInsertionPointVisible": () => (isBlockInsertionPointVisible),
1547  "isBlockMultiSelected": () => (isBlockMultiSelected),
1548  "isBlockSelected": () => (isBlockSelected),
1549  "isBlockValid": () => (isBlockValid),
1550  "isBlockWithinSelection": () => (isBlockWithinSelection),
1551  "isCaretWithinFormattedText": () => (isCaretWithinFormattedText),
1552  "isCleanNewPost": () => (isCleanNewPost),
1553  "isCurrentPostPending": () => (isCurrentPostPending),
1554  "isCurrentPostPublished": () => (isCurrentPostPublished),
1555  "isCurrentPostScheduled": () => (isCurrentPostScheduled),
1556  "isDeletingPost": () => (isDeletingPost),
1557  "isEditedPostAutosaveable": () => (isEditedPostAutosaveable),
1558  "isEditedPostBeingScheduled": () => (isEditedPostBeingScheduled),
1559  "isEditedPostDateFloating": () => (isEditedPostDateFloating),
1560  "isEditedPostDirty": () => (isEditedPostDirty),
1561  "isEditedPostEmpty": () => (isEditedPostEmpty),
1562  "isEditedPostNew": () => (isEditedPostNew),
1563  "isEditedPostPublishable": () => (isEditedPostPublishable),
1564  "isEditedPostSaveable": () => (isEditedPostSaveable),
1565  "isFirstMultiSelectedBlock": () => (isFirstMultiSelectedBlock),
1566  "isMultiSelecting": () => (isMultiSelecting),
1567  "isPermalinkEditable": () => (isPermalinkEditable),
1568  "isPostAutosavingLocked": () => (isPostAutosavingLocked),
1569  "isPostLockTakeover": () => (isPostLockTakeover),
1570  "isPostLocked": () => (isPostLocked),
1571  "isPostSavingLocked": () => (isPostSavingLocked),
1572  "isPreviewingPost": () => (isPreviewingPost),
1573  "isPublishSidebarEnabled": () => (isPublishSidebarEnabled),
1574  "isPublishingPost": () => (isPublishingPost),
1575  "isSavingNonPostEntityChanges": () => (isSavingNonPostEntityChanges),
1576  "isSavingPost": () => (isSavingPost),
1577  "isSelectionEnabled": () => (isSelectionEnabled),
1578  "isTyping": () => (isTyping),
1579  "isValidTemplate": () => (isValidTemplate)
1580});
1581
1582// NAMESPACE OBJECT: ./packages/editor/build-module/store/actions.js
1583var actions_namespaceObject = {};
1584__webpack_require__.r(actions_namespaceObject);
1585__webpack_require__.d(actions_namespaceObject, {
1586  "__experimentalTearDownEditor": () => (__experimentalTearDownEditor),
1587  "__unstableSaveForPreview": () => (__unstableSaveForPreview),
1588  "autosave": () => (autosave),
1589  "clearSelectedBlock": () => (clearSelectedBlock),
1590  "createUndoLevel": () => (createUndoLevel),
1591  "disablePublishSidebar": () => (disablePublishSidebar),
1592  "editPost": () => (editPost),
1593  "enablePublishSidebar": () => (enablePublishSidebar),
1594  "enterFormattedText": () => (enterFormattedText),
1595  "exitFormattedText": () => (exitFormattedText),
1596  "hideInsertionPoint": () => (hideInsertionPoint),
1597  "insertBlock": () => (insertBlock),
1598  "insertBlocks": () => (insertBlocks),
1599  "insertDefaultBlock": () => (insertDefaultBlock),
1600  "lockPostAutosaving": () => (lockPostAutosaving),
1601  "lockPostSaving": () => (lockPostSaving),
1602  "mergeBlocks": () => (mergeBlocks),
1603  "moveBlockToPosition": () => (moveBlockToPosition),
1604  "moveBlocksDown": () => (moveBlocksDown),
1605  "moveBlocksUp": () => (moveBlocksUp),
1606  "multiSelect": () => (multiSelect),
1607  "receiveBlocks": () => (receiveBlocks),
1608  "redo": () => (redo),
1609  "refreshPost": () => (refreshPost),
1610  "removeBlock": () => (removeBlock),
1611  "removeBlocks": () => (removeBlocks),
1612  "replaceBlock": () => (replaceBlock),
1613  "replaceBlocks": () => (replaceBlocks),
1614  "resetBlocks": () => (resetBlocks),
1615  "resetEditorBlocks": () => (resetEditorBlocks),
1616  "resetPost": () => (resetPost),
1617  "savePost": () => (savePost),
1618  "selectBlock": () => (selectBlock),
1619  "setTemplateValidity": () => (setTemplateValidity),
1620  "setupEditor": () => (setupEditor),
1621  "setupEditorState": () => (setupEditorState),
1622  "showInsertionPoint": () => (showInsertionPoint),
1623  "startMultiSelect": () => (startMultiSelect),
1624  "startTyping": () => (startTyping),
1625  "stopMultiSelect": () => (stopMultiSelect),
1626  "stopTyping": () => (stopTyping),
1627  "synchronizeTemplate": () => (synchronizeTemplate),
1628  "toggleBlockMode": () => (toggleBlockMode),
1629  "toggleSelection": () => (toggleSelection),
1630  "trashPost": () => (trashPost),
1631  "undo": () => (undo),
1632  "unlockPostAutosaving": () => (unlockPostAutosaving),
1633  "unlockPostSaving": () => (unlockPostSaving),
1634  "updateBlock": () => (updateBlock),
1635  "updateBlockAttributes": () => (updateBlockAttributes),
1636  "updateBlockListSettings": () => (updateBlockListSettings),
1637  "updateEditorSettings": () => (updateEditorSettings),
1638  "updatePost": () => (updatePost),
1639  "updatePostLock": () => (updatePostLock)
1640});
1641
1642;// CONCATENATED MODULE: external ["wp","element"]
1643const external_wp_element_namespaceObject = window["wp"]["element"];
1644;// CONCATENATED MODULE: external ["wp","data"]
1645const external_wp_data_namespaceObject = window["wp"]["data"];
1646;// CONCATENATED MODULE: external ["wp","coreData"]
1647const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
1648;// CONCATENATED MODULE: external ["wp","compose"]
1649const external_wp_compose_namespaceObject = window["wp"]["compose"];
1650;// CONCATENATED MODULE: external ["wp","hooks"]
1651const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
1652;// CONCATENATED MODULE: external ["wp","blockEditor"]
1653const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
1654;// CONCATENATED MODULE: ./packages/editor/build-module/store/defaults.js
1655/**
1656 * WordPress dependencies
1657 */
1658
1659
1660/**
1661 * The default post editor settings.
1662 *
1663 * @property {boolean|Array} allowedBlockTypes     Allowed block types
1664 * @property {boolean}       richEditingEnabled    Whether rich editing is enabled or not
1665 * @property {boolean}       codeEditingEnabled    Whether code editing is enabled or not
1666 * @property {boolean}       enableCustomFields    Whether the WordPress custom fields are enabled or not.
1667 *                                                 true  = the user has opted to show the Custom Fields panel at the bottom of the editor.
1668 *                                                 false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
1669 *                                                 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.
1670 * @property {number}        autosaveInterval      How often in seconds the post will be auto-saved via the REST API.
1671 * @property {number}        localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.
1672 * @property {Array?}        availableTemplates    The available post templates
1673 * @property {boolean}       disablePostFormats    Whether or not the post formats are disabled
1674 * @property {Array?}        allowedMimeTypes      List of allowed mime types and file extensions
1675 * @property {number}        maxUploadFileSize     Maximum upload file size
1676 * @property {boolean}       supportsLayout        Whether the editor supports layouts.
1677 */
1678const EDITOR_SETTINGS_DEFAULTS = {
1679  ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS,
1680  richEditingEnabled: true,
1681  codeEditingEnabled: true,
1682  enableCustomFields: undefined
1683};
1684
1685;// CONCATENATED MODULE: ./packages/editor/build-module/store/reducer.js
1686/**
1687 * WordPress dependencies
1688 */
1689
1690
1691/**
1692 * Internal dependencies
1693 */
1694
1695
1696/**
1697 * Returns a post attribute value, flattening nested rendered content using its
1698 * raw value in place of its original object form.
1699 *
1700 * @param {*} value Original value.
1701 *
1702 * @return {*} Raw value.
1703 */
1704function getPostRawValue(value) {
1705  if (value && 'object' === typeof value && 'raw' in value) {
1706    return value.raw;
1707  }
1708  return value;
1709}
1710
1711/**
1712 * Returns true if the two object arguments have the same keys, or false
1713 * otherwise.
1714 *
1715 * @param {Object} a First object.
1716 * @param {Object} b Second object.
1717 *
1718 * @return {boolean} Whether the two objects have the same keys.
1719 */
1720function hasSameKeys(a, b) {
1721  const keysA = Object.keys(a).sort();
1722  const keysB = Object.keys(b).sort();
1723  return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key);
1724}
1725
1726/**
1727 * Returns true if, given the currently dispatching action and the previously
1728 * dispatched action, the two actions are editing the same post property, or
1729 * false otherwise.
1730 *
1731 * @param {Object} action         Currently dispatching action.
1732 * @param {Object} previousAction Previously dispatched action.
1733 *
1734 * @return {boolean} Whether actions are updating the same post property.
1735 */
1736function isUpdatingSamePostProperty(action, previousAction) {
1737  return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
1738}
1739
1740/**
1741 * Returns true if, given the currently dispatching action and the previously
1742 * dispatched action, the two actions are modifying the same property such that
1743 * undo history should be batched.
1744 *
1745 * @param {Object} action         Currently dispatching action.
1746 * @param {Object} previousAction Previously dispatched action.
1747 *
1748 * @return {boolean} Whether to overwrite present state.
1749 */
1750function shouldOverwriteState(action, previousAction) {
1751  if (action.type === 'RESET_EDITOR_BLOCKS') {
1752    return !action.shouldCreateUndoLevel;
1753  }
1754  if (!previousAction || action.type !== previousAction.type) {
1755    return false;
1756  }
1757  return isUpdatingSamePostProperty(action, previousAction);
1758}
1759function postId(state = null, action) {
1760  switch (action.type) {
1761    case 'SETUP_EDITOR_STATE':
1762      return action.post.id;
1763  }
1764  return state;
1765}
1766function postType(state = null, action) {
1767  switch (action.type) {
1768    case 'SETUP_EDITOR_STATE':
1769      return action.post.type;
1770  }
1771  return state;
1772}
1773
1774/**
1775 * Reducer returning whether the post blocks match the defined template or not.
1776 *
1777 * @param {Object} state  Current state.
1778 * @param {Object} action Dispatched action.
1779 *
1780 * @return {boolean} Updated state.
1781 */
1782function template(state = {
1783  isValid: true
1784}, action) {
1785  switch (action.type) {
1786    case 'SET_TEMPLATE_VALIDITY':
1787      return {
1788        ...state,
1789        isValid: action.isValid
1790      };
1791  }
1792  return state;
1793}
1794
1795/**
1796 * Reducer returning current network request state (whether a request to
1797 * the WP REST API is in progress, successful, or failed).
1798 *
1799 * @param {Object} state  Current state.
1800 * @param {Object} action Dispatched action.
1801 *
1802 * @return {Object} Updated state.
1803 */
1804function saving(state = {}, action) {
1805  switch (action.type) {
1806    case 'REQUEST_POST_UPDATE_START':
1807    case 'REQUEST_POST_UPDATE_FINISH':
1808      return {
1809        pending: action.type === 'REQUEST_POST_UPDATE_START',
1810        options: action.options || {}
1811      };
1812  }
1813  return state;
1814}
1815
1816/**
1817 * Reducer returning deleting post request state.
1818 *
1819 * @param {Object} state  Current state.
1820 * @param {Object} action Dispatched action.
1821 *
1822 * @return {Object} Updated state.
1823 */
1824function deleting(state = {}, action) {
1825  switch (action.type) {
1826    case 'REQUEST_POST_DELETE_START':
1827    case 'REQUEST_POST_DELETE_FINISH':
1828      return {
1829        pending: action.type === 'REQUEST_POST_DELETE_START'
1830      };
1831  }
1832  return state;
1833}
1834
1835/**
1836 * Post Lock State.
1837 *
1838 * @typedef {Object} PostLockState
1839 *
1840 * @property {boolean}  isLocked       Whether the post is locked.
1841 * @property {?boolean} isTakeover     Whether the post editing has been taken over.
1842 * @property {?boolean} activePostLock Active post lock value.
1843 * @property {?Object}  user           User that took over the post.
1844 */
1845
1846/**
1847 * Reducer returning the post lock status.
1848 *
1849 * @param {PostLockState} state  Current state.
1850 * @param {Object}        action Dispatched action.
1851 *
1852 * @return {PostLockState} Updated state.
1853 */
1854function postLock(state = {
1855  isLocked: false
1856}, action) {
1857  switch (action.type) {
1858    case 'UPDATE_POST_LOCK':
1859      return action.lock;
1860  }
1861  return state;
1862}
1863
1864/**
1865 * Post saving lock.
1866 *
1867 * When post saving is locked, the post cannot be published or updated.
1868 *
1869 * @param {PostLockState} state  Current state.
1870 * @param {Object}        action Dispatched action.
1871 *
1872 * @return {PostLockState} Updated state.
1873 */
1874function postSavingLock(state = {}, action) {
1875  switch (action.type) {
1876    case 'LOCK_POST_SAVING':
1877      return {
1878        ...state,
1879        [action.lockName]: true
1880      };
1881    case 'UNLOCK_POST_SAVING':
1882      {
1883        const {
1884          [action.lockName]: removedLockName,
1885          ...restState
1886        } = state;
1887        return restState;
1888      }
1889  }
1890  return state;
1891}
1892
1893/**
1894 * Post autosaving lock.
1895 *
1896 * When post autosaving is locked, the post will not autosave.
1897 *
1898 * @param {PostLockState} state  Current state.
1899 * @param {Object}
1899        action Dispatched action.
1900 *
1901 * @return {PostLockState} Updated state.
1902 */
1903function postAutosavingLock(state = {}, action) {
1904  switch (action.type) {
1905    case 'LOCK_POST_AUTOSAVING':
1906      return {
1907        ...state,
1908        [action.lockName]: true
1909      };
1910    case 'UNLOCK_POST_AUTOSAVING':
1911      {
1912        const {
1913          [action.lockName]: removedLockName,
1914          ...restState
1915        } = state;
1916        return restState;
1917      }
1918  }
1919  return state;
1920}
1921
1922/**
1923 * Reducer returning whether the editor is ready to be rendered.
1924 * The editor is considered ready to be rendered once
1925 * the post object is loaded properly and the initial blocks parsed.
1926 *
1927 * @param {boolean} state
1928 * @param {Object}  action
1929 *
1930 * @return {boolean} Updated state.
1931 */
1932function isReady(state = false, action) {
1933  switch (action.type) {
1934    case 'SETUP_EDITOR_STATE':
1935      return true;
1936    case 'TEAR_DOWN_EDITOR':
1937      return false;
1938  }
1939  return state;
1940}
1941
1942/**
1943 * Reducer returning the post editor setting.
1944 *
1945 * @param {Object} state  Current state.
1946 * @param {Object} action Dispatched action.
1947 *
1948 * @return {Object} Updated state.
1949 */
1950function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
1951  switch (action.type) {
1952    case 'UPDATE_EDITOR_SETTINGS':
1953      return {
1954        ...state,
1955        ...action.settings
1956      };
1957  }
1958  return state;
1959}
1960/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
1961  postId,
1962  postType,
1963  saving,
1964  deleting,
1965  postLock,
1966  template,
1967  postSavingLock,
1968  isReady,
1969  editorSettings,
1970  postAutosavingLock
1971}));
1972
1973;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
1974
1975
1976/** @typedef {(...args: any[]) => *[]} GetDependants */
1977
1978/** @typedef {() => void} Clear */
1979
1980/**
1981 * @typedef {{
1982 *   getDependants: GetDependants,
1983 *   clear: Clear
1984 * }} EnhancedSelector
1985 */
1986
1987/**
1988 * Internal cache entry.
1989 *
1990 * @typedef CacheNode
1991 *
1992 * @property {?CacheNode|undefined} [prev] Previous node.
1993 * @property {?CacheNode|undefined} [next] Next node.
1994 * @property {*[]} args Function arguments for cache entry.
1995 * @property {*} val Function result.
1996 */
1997
1998/**
1999 * @typedef Cache
2000 *
2001 * @property {Clear} clear Function to clear cache.
2002 * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
2003 * considering cache uniqueness. A cache is unique if dependents are all arrays
2004 * or objects.
2005 * @property {CacheNode?} [head] Cache head.
2006 * @property {*[]} [lastDependants] Dependants from previous invocation.
2007 */
2008
2009/**
2010 * Arbitrary value used as key for referencing cache object in WeakMap tree.
2011 *
2012 * @type {{}}
2013 */
2014var LEAF_KEY = {};
2015
2016/**
2017 * Returns the first argument as the sole entry in an array.
2018 *
2019 * @template T
2020 *
2021 * @param {T} value Value to return.
2022 *
2023 * @return {[T]} Value returned as entry in array.
2024 */
2025function arrayOf(value) {
2026	return [value];
2027}
2028
2029/**
2030 * Returns true if the value passed is object-like, or false otherwise. A value
2031 * is object-like if it can support property assignment, e.g. object or array.
2032 *
2033 * @param {*} value Value to test.
2034 *
2035 * @return {boolean} Whether value is object-like.
2036 */
2037function isObjectLike(value) {
2038	return !!value && 'object' === typeof value;
2039}
2040
2041/**
2042 * Creates and returns a new cache object.
2043 *
2044 * @return {Cache} Cache object.
2045 */
2046function createCache() {
2047	/** @type {Cache} */
2048	var cache = {
2049		clear: function () {
2050			cache.head = null;
2051		},
2052	};
2053
2054	return cache;
2055}
2056
2057/**
2058 * Returns true if entries within the two arrays are strictly equal by
2059 * reference from a starting index.
2060 *
2061 * @param {*[]} a First array.
2062 * @param {*[]} b Second array.
2063 * @param {number} fromIndex Index from which to start comparison.
2064 *
2065 * @return {boolean} Whether arrays are shallowly equal.
2066 */
2067function isShallowEqual(a, b, fromIndex) {
2068	var i;
2069
2070	if (a.length !== b.length) {
2071		return false;
2072	}
2073
2074	for (i = fromIndex; i < a.length; i++) {
2075		if (a[i] !== b[i]) {
2076			return false;
2077		}
2078	}
2079
2080	return true;
2081}
2082
2083/**
2084 * Returns a memoized selector function. The getDependants function argument is
2085 * called before the memoized selector and is expected to return an immutable
2086 * reference or array of references on which the selector depends for computing
2087 * its own return value. The memoize cache is preserved only as long as those
2088 * dependant references remain the same. If getDependants returns a different
2089 * reference(s), the cache is cleared and the selector value regenerated.
2090 *
2091 * @template {(...args: *[]) => *} S
2092 *
2093 * @param {S} selector Selector function.
2094 * @param {GetDependants=} getDependants Dependant getter returning an array of
2095 * references used in cache bust consideration.
2096 */
2097/* harmony default export */ function rememo(selector, getDependants) {
2098	/** @type {WeakMap<*,*>} */
2099	var rootCache;
2100
2101	/** @type {GetDependants} */
2102	var normalizedGetDependants = getDependants ? getDependants : arrayOf;
2103
2104	/**
2105	 * Returns the cache for a given dependants array. When possible, a WeakMap
2106	 * will be used to create a unique cache for each set of dependants. This
2107	 * is feasible due to the nature of WeakMap in allowing garbage collection
2108	 * to occur on entries where the key object is no longer referenced. Since
2109	 * WeakMap requires the key to be an object, this is only possible when the
2110	 * dependant is object-like. The root cache is created as a hierarchy where
2111	 * each top-level key is the first entry in a dependants set, the value a
2112	 * WeakMap where each key is the next dependant, and so on. This continues
2113	 * so long as the dependants are object-like. If no dependants are object-
2114	 * like, then the cache is shared across all invocations.
2115	 *
2116	 * @see isObjectLike
2117	 *
2118	 * @param {*[]}
2118 dependants Selector dependants.
2119	 *
2120	 * @return {Cache} Cache object.
2121	 */
2122	function getCache(dependants) {
2123		var caches = rootCache,
2124			isUniqueByDependants = true,
2125			i,
2126			dependant,
2127			map,
2128			cache;
2129
2130		for (i = 0; i < dependants.length; i++) {
2131			dependant = dependants[i];
2132
2133			// Can only compose WeakMap from object-like key.
2134			if (!isObjectLike(dependant)) {
2135				isUniqueByDependants = false;
2136				break;
2137			}
2138
2139			// Does current segment of cache already have a WeakMap?
2140			if (caches.has(dependant)) {
2141				// Traverse into nested WeakMap.
2142				caches = caches.get(dependant);
2143			} else {
2144				// Create, set, and traverse into a new one.
2145				map = new WeakMap();
2146				caches.set(dependant, map);
2147				caches = map;
2148			}
2149		}
2150
2151		// We use an arbitrary (but consistent) object as key for the last item
2152		// in the WeakMap to serve as our running cache.
2153		if (!caches.has(LEAF_KEY)) {
2154			cache = createCache();
2155			cache.isUniqueByDependants = isUniqueByDependants;
2156			caches.set(LEAF_KEY, cache);
2157		}
2158
2159		return caches.get(LEAF_KEY);
2160	}
2161
2162	/**
2163	 * Resets root memoization cache.
2164	 */
2165	function clear() {
2166		rootCache = new WeakMap();
2167	}
2168
2169	/* eslint-disable jsdoc/check-param-names */
2170	/**
2171	 * The augmented selector call, considering first whether dependants have
2172	 * changed before passing it to underlying memoize function.
2173	 *
2174	 * @param {*}    source    Source object for derivation.
2175	 * @param {...*} extraArgs Additional arguments to pass to selector.
2176	 *
2177	 * @return {*} Selector result.
2178	 */
2179	/* eslint-enable jsdoc/check-param-names */
2180	function callSelector(/* source, ...extraArgs */) {
2181		var len = arguments.length,
2182			cache,
2183			node,
2184			i,
2185			args,
2186			dependants;
2187
2188		// Create copy of arguments (avoid leaking deoptimization).
2189		args = new Array(len);
2190		for (i = 0; i < len; i++) {
2191			args[i] = arguments[i];
2192		}
2193
2194		dependants = normalizedGetDependants.apply(null, args);
2195		cache = getCache(dependants);
2196
2197		// If not guaranteed uniqueness by dependants (primitive type), shallow
2198		// compare against last dependants and, if references have changed,
2199		// destroy cache to recalculate result.
2200		if (!cache.isUniqueByDependants) {
2201			if (
2202				cache.lastDependants &&
2203				!isShallowEqual(dependants, cache.lastDependants, 0)
2204			) {
2205				cache.clear();
2206			}
2207
2208			cache.lastDependants = dependants;
2209		}
2210
2211		node = cache.head;
2212		while (node) {
2213			// Check whether node arguments match arguments
2214			if (!isShallowEqual(node.args, args, 1)) {
2215				node = node.next;
2216				continue;
2217			}
2218
2219			// At this point we can assume we've found a match
2220
2221			// Surface matched node to head if not already
2222			if (node !== cache.head) {
2223				// Adjust siblings to point to each other.
2224				/** @type {CacheNode} */ (node.prev).next = node.next;
2225				if (node.next) {
2226					node.next.prev = node.prev;
2227				}
2228
2229				node.next = cache.head;
2230				node.prev = null;
2231				/** @type {CacheNode} */ (cache.head).prev = node;
2232				cache.head = node;
2233			}
2234
2235			// Return immediately
2236			return node.val;
2237		}
2238
2239		// No cached value found. Continue to insertion phase:
2240
2241		node = /** @type {CacheNode} */ ({
2242			// Generate the result from original function
2243			val: selector.apply(null, args),
2244		});
2245
2246		// Avoid including the source object in the cache.
2247		args[0] = null;
2248		node.args = args;
2249
2250		// Don't need to check whether node is already head, since it would
2251		// have been returned above already if it was
2252
2253		// Shift existing head down list
2254		if (cache.head) {
2255			cache.head.prev = node;
2256			node.next = cache.head;
2257		}
2258
2259		cache.head = node;
2260
2261		return node.val;
2262	}
2263
2264	callSelector.getDependants = normalizedGetDependants;
2265	callSelector.clear = clear;
2266	clear();
2267
2268	return /** @type {S & EnhancedSelector} */ (callSelector);
2269}
2270
2271;// CONCATENATED MODULE: external ["wp","blocks"]
2272const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
2273;// CONCATENATED MODULE: external ["wp","date"]
2274const external_wp_date_namespaceObject = window["wp"]["date"];
2275;// CONCATENATED MODULE: external ["wp","url"]
2276const external_wp_url_namespaceObject = window["wp"]["url"];
2277;// CONCATENATED MODULE: external ["wp","deprecated"]
2278const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
2279var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
2280;
2280// CONCATENATED MODULE: external ["wp","primitives"]
2281const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
2282;// CONCATENATED MODULE: ./packages/icons/build-module/library/layout.js
2283
2284/**
2285 * WordPress dependencies
2286 */
2287
2288const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
2289  xmlns: "http://www.w3.org/2000/svg",
2290  viewBox: "0 0 24 24"
2291}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
2292  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"
2293}));
2294/* harmony default export */ const library_layout = (layout);
2295
2296;// CONCATENATED MODULE: external ["wp","preferences"]
2297const external_wp_preferences_namespaceObject = window["wp"]["preferences"];
2298;// CONCATENATED MODULE: ./packages/editor/build-module/store/constants.js
2299/**
2300 * Set of post properties for which edits should assume a merging behavior,
2301 * assuming an object value.
2302 *
2303 * @type {Set}
2304 */
2305const EDIT_MERGE_PROPERTIES = new Set(['meta']);
2306
2307/**
2308 * Constant for the store module (or reducer) key.
2309 *
2310 * @type {string}
2311 */
2312const STORE_NAME = 'core/editor';
2313const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
2314const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
2315const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
2316const ONE_MINUTE_IN_MS = 60 * 1000;
2317const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
2318
2319;// CONCATENATED MODULE: ./packages/icons/build-module/library/header.js
2320
2321/**
2322 * WordPress dependencies
2323 */
2324
2325const header = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
2326  xmlns: "http://www.w3.org/2000/svg",
2327  viewBox: "0 0 24 24"
2328}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
2329  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"
2330}));
2331/* harmony default export */ const library_header = (header);
2332
2333;// CONCATENATED MODULE: ./packages/icons/build-module/library/footer.js
2334
2335/**
2336 * WordPress dependencies
2337 */
2338
2339const footer = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
2340  xmlns: "http://www.w3.org/2000/svg",
2341  viewBox: "0 0 24 24"
2342}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
2343  fillRule: "evenodd",
2344  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"
2345}));
2346/* harmony default export */ const library_footer = (footer);
2347
2348;// CONCATENATED MODULE: ./packages/icons/build-module/library/sidebar.js
2349
2350/**
2351 * WordPress dependencies
2352 */
2353
2354const sidebar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
2355  xmlns: "http://www.w3.org/2000/svg",
2356  viewBox: "0 0 24 24"
2357}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
2358  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"
2359}));
2360/* harmony default export */ const library_sidebar = (sidebar);
2361
2362;// CONCATENATED MODULE: ./packages/icons/build-module/library/symbol-filled.js
2363
2364/**
2365 * WordPress dependencies
2366 */
2367
2368const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
2369  xmlns: "http://www.w3.org/2000/svg",
2370  viewBox: "0 0 24 24"
2371}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
2372  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"
2373}));
2374/* harmony default export */ const symbol_filled = (symbolFilled);
2375
2376;// CONCATENATED MODULE: ./packages/editor/build-module/utils/get-template-part-icon.js
2377/**
2378 * WordPress dependencies
2379 */
2380
2381/**
2382 * Helper function to retrieve the corresponding icon by name.
2383 *
2384 * @param {string} iconName The name of the icon.
2385 *
2386 * @return {Object} The corresponding icon.
2387 */
2388function getTemplatePartIcon(iconName) {
2389  if ('header' === iconName) {
2390    return library_header;
2391  } else if ('footer' === iconName) {
2392    return library_footer;
2393  } else if ('sidebar' === iconName) {
2394    return library_sidebar;
2395  }
2396  return symbol_filled;
2397}
2398
2399;// CONCATENATED MODULE: ./packages/editor/build-module/store/selectors.js
2400/**
2401 * External dependencies
2402 */
2403
2404
2405/**
2406 * WordPress dependencies
2407 */
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419/**
2420 * Internal dependencies
2421 */
2422
2423
2424
2425
2426/**
2427 * Shared reference to an empty object for cases where it is important to avoid
2428 * returning a new object reference on every invocation, as in a connected or
2429 * other pure component which performs `shouldComponentUpdate` check on props.
2430 * This should be used as a last resort, since the normalized data should be
2431 * maintained by the reducer result in state.
2432 */
2433const EMPTY_OBJECT = {};
2434
2435/**
2436 * Returns true if any past editor history snapshots exist, or false otherwise.
2437 *
2438 * @param {Object} state Global application state.
2439 *
2440 * @return {boolean} Whether undo history exists.
2441 */
2442const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2443  return select(external_wp_coreData_namespaceObject.store).hasUndo();
2444});
2445
2446/**
2447 * Returns true if any future editor history snapshots exist, or false
2448 * otherwise.
2449 *
2450 * @param {Object} state Global application state.
2451 *
2452 * @return {boolean} Whether redo history exists.
2453 */
2454const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2455  return select(external_wp_coreData_namespaceObject.store).hasRedo();
2456});
2457
2458/**
2459 * Returns true if the currently edited post is yet to be saved, or false if
2460 * the post has been saved.
2461 *
2462 * @param {Object} state Global application state.
2463 *
2464 * @return {boolean} Whether the post is new.
2465 */
2466function isEditedPostNew(state) {
2467  return getCurrentPost(state).status === 'auto-draft';
2468}
2469
2470/**
2471 * Returns true if content includes unsaved changes, or false otherwise.
2472 *
2473 * @param {Object} state Editor state.
2474 *
2475 * @return {boolean} Whether content includes unsaved changes.
2476 */
2477function hasChangedContent(state) {
2478  const edits = getPostEdits(state);
2479  return 'content' in edits;
2480}
2481
2482/**
2483 * Returns true if there are unsaved values for the current edit session, or
2484 * false if the editing state matches the saved or new post.
2485 *
2486 * @param {Object} state Global application state.
2487 *
2488 * @return {boolean} Whether unsaved values exist.
2489 */
2490const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2491  // Edits should contain only fields which differ from the saved post (reset
2492  // at initial load and save complete). Thus, a non-empty edits state can be
2493  // inferred to contain unsaved values.
2494  const postType = getCurrentPostType(state);
2495  const postId = getCurrentPostId(state);
2496  if (select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId)) {
2497    return true;
2498  }
2499  return false;
2500});
2501
2502/**
2503 * Returns true if there are unsaved edits for entities other than
2504 * the editor's post, and false otherwise.
2505 *
2506 * @param {Object} state Global application state.
2507 *
2508 * @return {boolean} Whether there are edits or not.
2509 */
2510const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2511  const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords();
2512  const {
2513    type,
2514    id
2515  } = getCurrentPost(state);
2516  return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
2517});
2518
2519/**
2520 * Returns true if there are no unsaved values for the current edit session and
2521 * if the currently edited post is new (has never been saved before).
2522 *
2523 * @param {Object} state Global application state.
2524 *
2525 * @return {boolean} Whether new post and unsaved values exist.
2526 */
2527function isCleanNewPost(state) {
2528  return !isEditedPostDirty(state) && isEditedPostNew(state);
2529}
2530
2531/**
2532 * Returns the post currently being edited in its last known saved state, not
2533 * including unsaved edits. Returns an object containing relevant default post
2534 * values if the post has not yet been saved.
2535 *
2536 * @param {Object} state Global application state.
2537 *
2538 * @return {Object} Post object.
2539 */
2540const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2541  const postId = getCurrentPostId(state);
2542  const postType = getCurrentPostType(state);
2543  const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId);
2544  if (post) {
2545    return post;
2546  }
2547
2548  // This exists for compatibility with the previous selector behavior
2549  // which would guarantee an object return based on the editor reducer's
2550  // default empty object state.
2551  return EMPTY_OBJECT;
2552});
2553
2554/**
2555 * Returns the post type of the post currently being edited.
2556 *
2557 * @param {Object} state Global application state.
2558 *
2559 * @return {string} Post type.
2560 */
2561function getCurrentPostType(state) {
2562  return state.postType;
2563}
2564
2565/**
2566 * Returns the ID of the post currently being edited, or null if the post has
2567 * not yet been saved.
2568 *
2569 * @param {Object} state Global application state.
2570 *
2571 * @return {?number} ID of current post.
2572 */
2573function getCurrentPostId(state) {
2574  return state.postId;
2575}
2576
2577/**
2578 * Returns the number of revisions of the post currently being edited.
2579 *
2580 * @param {Object} state Global application state.
2581 *
2582 * @return {number} Number of revisions.
2583 */
2584function getCurrentPostRevisionsCount(state) {
2585  var _getCurrentPost$_link;
2586  return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0;
2587}
2588
2589/**
2590 * Returns the last revision ID of the post currently being edited,
2591 * or null if the post has no revisions.
2592 *
2593 * @param {Object} state Global application state.
2594 *
2595 * @return {?number} ID of the last revision.
2596 */
2597function getCurrentPostLastRevisionId(state) {
2598  var _getCurrentPost$_link2;
2599  return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null;
2600}
2601
2602/**
2603 * Returns any post values which have been changed in the editor but not yet
2604 * been saved.
2605 *
2606 * @param {Object} state Global application state.
2607 *
2608 * @return {Object} Object of key value pairs comprising unsaved edits.
2609 */
2610const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2611  const postType = getCurrentPostType(state);
2612  const postId = getCurrentPostId(state);
2613  return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
2614});
2615
2616/**
2617 * Returns an attribute value of the saved post.
2618 *
2619 * @param {Object} state         Global application state.
2620 * @param {string} attributeName Post attribute name.
2621 *
2622 * @return {*} Post attribute value.
2623 */
2624function getCurrentPostAttribute(state, attributeName) {
2625  switch (attributeName) {
2626    case 'type':
2627      return getCurrentPostType(state);
2628    case 'id':
2629      return getCurrentPostId(state);
2630    default:
2631      const post = getCurrentPost(state);
2632      if (!post.hasOwnProperty(attributeName)) {
2633        break;
2634      }
2635      return getPostRawValue(post[attributeName]);
2636  }
2637}
2638
2639/**
2640 * Returns a single attribute of the post being edited, preferring the unsaved
2641 * edit if one exists, but merging with the attribute value for the last known
2642 * saved state of the post (this is needed for some nested attributes like meta).
2643 *
2644 * @param {Object} state         Global application state.
2645 * @param {string} attributeName Post attribute name.
2646 *
2647 * @return {*} Post attribute value.
2648 */
2649const getNestedEditedPostProperty = rememo((state, attributeName) => {
2650  const edits = getPostEdits(state);
2651  if (!edits.hasOwnProperty(attributeName)) {
2652    return getCurrentPostAttribute(state, attributeName);
2653  }
2654  return {
2655    ...getCurrentPostAttribute(state, attributeName),
2656    ...edits[attributeName]
2657  };
2658}, (state, attributeName) => [getCurrentPostAttribute(state, attributeName), getPostEdits(state)[attributeName]]);
2659
2660/**
2661 * Returns a single attribute of the post being edited, preferring the unsaved
2662 * edit if one exists, but falling back to the attribute for the last known
2663 * saved state of the post.
2664 *
2665 * @param {Object} state         Global application state.
2666 * @param {string} attributeName Post attribute name.
2667 *
2668 * @return {*} Post attribute value.
2669 */
2670function getEditedPostAttribute(state, attributeName) {
2671  // Special cases.
2672  switch (attributeName) {
2673    case 'content':
2674      return getEditedPostContent(state);
2675  }
2676
2677  // Fall back to saved post value if not edited.
2678  const edits = getPostEdits(state);
2679  if (!edits.hasOwnProperty(attributeName)) {
2680    return getCurrentPostAttribute(state, attributeName);
2681  }
2682
2683  // Merge properties are objects which contain only the patch edit in state,
2684  // and thus must be merged with the current post attribute.
2685  if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
2686    return getNestedEditedPostProperty(state, attributeName);
2687  }
2688  return edits[attributeName];
2689}
2690
2691/**
2692 * Returns an attribute value of the current autosave revision for a post, or
2693 * null if there is no autosave for the post.
2694 *
2695 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
2696 * 			   from the '@wordpress/core-data' package and access properties on the returned
2697 * 			   autosave object using getPostRawValue.
2698 *
2699 * @param {Object} state         Global application state.
2700 * @param {string} attributeName Autosave attribute name.
2701 *
2702 * @return {*} Autosave attribute value.
2703 */
2704const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => {
2705  if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') {
2706    return;
2707  }
2708  const postType = getCurrentPostType(state);
2709  const postId = getCurrentPostId(state);
2710  const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id;
2711  const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId);
2712  if (autosave) {
2713    return getPostRawValue(autosave[attributeName]);
2714  }
2715});
2716
2717/**
2718 * Returns the current visibility of the post being edited, preferring the
2719 * unsaved value if different than the saved post. The return value is one of
2720 * "private", "password", or "public".
2721 *
2722 * @param {Object} state Global application state.
2723 *
2724 * @return {string} Post visibility.
2725 */
2726function getEditedPostVisibility(state) {
2727  const status = getEditedPostAttribute(state, 'status');
2728  if (status === 'private') {
2729    return 'private';
2730  }
2731  const password = getEditedPostAttribute(state, 'password');
2732  if (password) {
2733    return 'password';
2734  }
2735  return 'public';
2736}
2737
2738/**
2739 * Returns true if post is pending review.
2740 *
2741 * @param {Object} state Global application state.
2742 *
2743 * @return {boolean} Whether current post is pending review.
2744 */
2745function isCurrentPostPending(state) {
2746  return getCurrentPost(state).status === 'pending';
2747}
2748
2749/**
2750 * Return true if the current post has already been published.
2751 *
2752 * @param {Object}  state       Global application state.
2753 * @param {Object?} currentPost Explicit current post for bypassing registry selector.
2754 *
2755 * @return {boolean} Whether the post has been published.
2756 */
2757function isCurrentPostPublished(state, currentPost) {
2758  const post = currentPost || getCurrentPost(state);
2759  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));
2760}
2761
2762/**
2763 * Returns true if post is already scheduled.
2764 *
2765 * @param {Object} state Global application state.
2766 *
2767 * @return {boolean} Whether current post is scheduled to be posted.
2768 */
2769function isCurrentPostScheduled(state) {
2770  return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state);
2771}
2772
2773/**
2774 * Return true if the post being edited can be published.
2775 *
2776 * @param {Object} state Global application state.
2777 *
2778 * @return {boolean} Whether the post can been published.
2779 */
2780function isEditedPostPublishable(state) {
2781  const post = getCurrentPost(state);
2782
2783  // TODO: Post being publishable should be superset of condition of post
2784  // being saveable. Currently this restriction is imposed at UI.
2785  //
2786  //  See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`).
2787
2788  return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
2789}
2790
2791/**
2792 * Returns true if the post can be saved, or false otherwise. A post must
2793 * contain a title, an excerpt, or non-empty content to be valid for save.
2794 *
2795 * @param {Object} state Global application state.
2796 *
2797 * @return {boolean} Whether the post can be saved.
2798 */
2799function isEditedPostSaveable(state) {
2800  if (isSavingPost(state)) {
2801    return false;
2802  }
2803
2804  // TODO: Post should not be saveable if not dirty. Cannot be added here at
2805  // this time since posts where meta boxes are present can be saved even if
2806  // the post is not dirty. Currently this restriction is imposed at UI, but
2807  // should be moved here.
2808  //
2809  //  See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
2810  //  See: <PostSavedState /> (`forceIsDirty` prop)
2811  //  See: <PostPublishButton /> (`forceIsDirty` prop)
2812  //  See: https://github.com/WordPress/gutenberg/pull/4184.
2813
2814  return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native';
2815}
2816
2817/**
2818 * Returns true if the edited post has content. A post has content if it has at
2819 * least one saveable block or otherwise has a non-empty content property
2820 * assigned.
2821 *
2822 * @param {Object} state Global application state.
2823 *
2824 * @return {boolean} Whether post has content.
2825 */
2826const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2827  // While the condition of truthy content string is sufficient to determine
2828  // emptiness, testing saveable blocks length is a trivial operation. Since
2829  // this function can be called frequently, optimize for the fast case as a
2830  // condition of the mere existence of blocks. Note that the value of edited
2831  // content takes precedent over block content, and must fall through to the
2832  // default logic.
2833  const postId = getCurrentPostId(state);
2834  const postType = getCurrentPostType(state);
2835  const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
2836  if (typeof record.content !== 'function') {
2837    return !record.content;
2838  }
2839  const blocks = getEditedPostAttribute(state, 'blocks');
2840  if (blocks.length === 0) {
2841    return true;
2842  }
2843
2844  // Pierce the abstraction of the serializer in knowing that blocks are
2845  // joined with newlines such that even if every individual block
2846  // produces an empty save result, the serialized content is non-empty.
2847  if (blocks.length > 1) {
2848    return false;
2849  }
2850
2851  // There are two conditions under which the optimization cannot be
2852  // assumed, and a fallthrough to getEditedPostContent must occur:
2853  //
2854  // 1. getBlocksForSerialization has special treatment in omitting a
2855  //    single unmodified default block.
2856  // 2. Comment delimiters are omitted for a freeform or unregistered
2857  //    block in its serialization. The freeform block specifically may
2858  //    produce an empty string in its saved output.
2859  //
2860  // For all other content, the single block is assumed to make a post
2861  // non-empty, if only by virtue of its own comment delimiters.
2862  const blockName = blocks[0].name;
2863  if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) {
2864    return false;
2865  }
2866  return !getEditedPostContent(state);
2867});
2868
2869/**
2870 * Returns true if the post can be autosaved, or false otherwise.
2871 *
2872 * @param {Object} state    Global application state.
2873 * @param {Object} autosave A raw autosave object from the REST API.
2874 *
2875 * @return {boolean} Whether the post can be autosaved.
2876 */
2877const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2878  // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
2879  if (!isEditedPostSaveable(state)) {
2880    return false;
2881  }
2882
2883  // A post is not autosavable when there is a post autosave lock.
2884  if (isPostAutosavingLocked(state)) {
2885    return false;
2886  }
2887  const postType = getCurrentPostType(state);
2888  const postId = getCurrentPostId(state);
2889  const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId);
2890  const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id;
2891
2892  // Disable reason - this line causes the side-effect of fetching the autosave
2893  // via a resolver, moving below the return would result in the autosave never
2894  // being fetched.
2895  // eslint-disable-next-line @wordpress/no-unused-vars-before-return
2896  const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId);
2897
2898  // If any existing autosaves have not yet been fetched, this function is
2899  // unable to determine if the post is autosaveable, so return false.
2900  if (!hasFetchedAutosave) {
2901    return false;
2902  }
2903
2904  // If we don't already have an autosave, the post is autosaveable.
2905  if (!autosave) {
2906    return true;
2907  }
2908
2909  // To avoid an expensive content serialization, use the content dirtiness
2910  // flag in place of content field comparison against the known autosave.
2911  // This is not strictly accurate, and relies on a tolerance toward autosave
2912  // request failures for unnecessary saves.
2913  if (hasChangedContent(state)) {
2914    return true;
2915  }
2916
2917  // If title, excerpt, or meta have changed, the post is autosaveable.
2918  return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field));
2919});
2920
2921/**
2922 * Return true if the post being edited is being scheduled. Preferring the
2923 * unsaved status values.
2924 *
2925 * @param {Object} state Global application state.
2926 *
2927 * @return {boolean} Whether the post has been published.
2928 */
2929function isEditedPostBeingScheduled(state) {
2930  const date = getEditedPostAttribute(state, 'date');
2931  // Offset the date by one minute (network latency).
2932  const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS);
2933  return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate);
2934}
2935
2936/**
2937 * Returns whether the current post should be considered to have a "floating"
2938 * date (i.e. that it would publish "Immediately" rather than at a set time).
2939 *
2940 * Unlike in the PHP backend, the REST API returns a full date string for posts
2941 * where the 0000-00-00T00:00:00 placeholder is present in the database. To
2942 * infer that a post is set to publish "Immediately" we check whether the date
2943 * and modified date are the same.
2944 *
2945 * @param {Object} state Editor state.
2946 *
2947 * @return {boolean} Whether the edited post has a floating date value.
2948 */
2949function isEditedPostDateFloating(state) {
2950  const date = getEditedPostAttribute(state, 'date');
2951  const modified = getEditedPostAttribute(state, 'modified');
2952
2953  // This should be the status of the persisted post
2954  // It shouldn't use the "edited" status otherwise it breaks the
2955  // inferred post data floating status
2956  // See https://github.com/WordPress/gutenberg/issues/28083.
2957  const status = getCurrentPost(state).status;
2958  if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
2959    return date === modified || date === null;
2960  }
2961  return false;
2962}
2963
2964/**
2965 * Returns true if the post is currently being deleted, or false otherwise.
2966 *
2967 * @param {Object} state Editor state.
2968 *
2969 * @return {boolean} Whether post is being deleted.
2970 */
2971function isDeletingPost(state) {
2972  return !!state.deleting.pending;
2973}
2974
2975/**
2976 * Returns true if the post is currently being saved, or false otherwise.
2977 *
2978 * @param {Object} state Global application state.
2979 *
2980 * @return {boolean} Whether post is being saved.
2981 */
2982function isSavingPost(state) {
2983  return !!state.saving.pending;
2984}
2985
2986/**
2987 * Returns true if non-post entities are currently being saved, or false otherwise.
2988 *
2989 * @param {Object} state Global application state.
2990 *
2991 * @return {boolean} Whether non-post entities are being saved.
2992 */
2993const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2994  const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved();
2995  const {
2996    type,
2997    id
2998  } = getCurrentPost(state);
2999  return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
3000});
3001
3002/**
3003 * Returns true if a previous post save was attempted successfully, or false
3004 * otherwise.
3005 *
3006 * @param {Object} state Global application state.
3007 *
3008 * @return {boolean} Whether the post was saved successfully.
3009 */
3010const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
3011  const postType = getCurrentPostType(state);
3012  const postId = getCurrentPostId(state);
3013  return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
3014});
3015
3016/**
3017 * Returns true if a previous post save was attempted but failed, or false
3018 * otherwise.
3019 *
3020 * @param {Object} state Global application state.
3021 *
3022 * @return {boolean} Whether the post save failed.
3023 */
3024const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
3025  const postType = getCurrentPostType(state);
3026  const postId = getCurrentPostId(state);
3027  return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
3028});
3029
3030/**
3031 * Returns true if the post is autosaving, or false otherwise.
3032 *
3033 * @param {Object} state Global application state.
3034 *
3035 * @return {boolean} Whether the post is autosaving.
3036 */
3037function isAutosavingPost(state) {
3038  return isSavingPost(state) && Boolean(state.saving.options?.isAutosave);
3039}
3040
3041/**
3042 * Returns true if the post is being previewed, or false otherwise.
3043 *
3044 * @param {Object} state Global application state.
3045 *
3046 * @return {boolean} Whether the post is being previewed.
3047 */
3048function isPreviewingPost(state) {
3049  return isSavingPost(state) && Boolean(state.saving.options?.isPreview);
3050}
3051
3052/**
3053 * Returns the post preview link
3054 *
3055 * @param {Object} state Global application state.
3056 *
3057 * @return {string | undefined} Preview Link.
3058 */
3059function getEditedPostPreviewLink(state) {
3060  if (state.saving.pending || isSavingPost(state)) {
3061    return;
3062  }
3063  let previewLink = getAutosaveAttribute(state, 'preview_link');
3064  // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
3065  // If the post is draft, ignore the preview link from the autosave record,
3066  // because the preview could be a stale autosave if the post was switched from
3067  // published to draft.
3068  // See: https://github.com/WordPress/gutenberg/pull/37952.
3069  if (!previewLink || 'draft' === getCurrentPost(state).status) {
3070    previewLink = getEditedPostAttribute(state, 'link');
3071    if (previewLink) {
3072      previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
3073        preview: true
3074      });
3075    }
3076  }
3077  const featuredImageId = getEditedPostAttribute(state, 'featured_media');
3078  if (previewLink && featuredImageId) {
3079    return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
3080      _thumbnail_id: featuredImageId
3081    });
3082  }
3083  return previewLink;
3084}
3085
3086/**
3087 * Returns a suggested post format for the current post, inferred only if there
3088 * is a single block within the post and it is of a type known to match a
3089 * default post format. Returns null if the format cannot be determined.
3090 *
3091 * @param {Object} state Global application state.
3092 *
3093 * @return {?string} Suggested post format.
3094 */
3095function getSuggestedPostFormat(state) {
3096  const blocks = getEditorBlocks(state);
3097  if (blocks.length > 2) return null;
3098  let name;
3099  // If there is only one block in the content of the post grab its name
3100  // so we can derive a suitable post format from it.
3101  if (blocks.length === 1) {
3102    name = blocks[0].name;
3103    // Check for core/embed `video` and `audio` eligible suggestions.
3104    if (name === 'core/embed') {
3105      const provider = blocks[0].attributes?.providerNameSlug;
3106      if (['youtube', 'vimeo'].includes(provider)) {
3107        name = 'core/video';
3108      } else if (['spotify', 'soundcloud'].includes(provider)) {
3109        name = 'core/audio';
3110      }
3111    }
3112  }
3113
3114  // If there are two blocks in the content and the last one is a text blocks
3115  // grab the name of the first one to also suggest a post format from it.
3116  if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
3117    name = blocks[0].name;
3118  }
3119
3120  // We only convert to default post formats in core.
3121  switch (name) {
3122    case 'core/image':
3123      return 'image';
3124    case 'core/quote':
3125    case 'core/pullquote':
3126      return 'quote';
3127    case 'core/gallery':
3128      return 'gallery';
3129    case 'core/video':
3130      return 'video';
3131    case 'core/audio':
3132      return 'audio';
3133    default:
3134      return null;
3135  }
3136}
3137
3138/**
3139 * Returns the content of the post being edited.
3140 *
3141 * @param {Object} state Global application state.
3142 *
3143 * @return {string} Post content.
3144 */
3145const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
3146  const postId = getCurrentPostId(state);
3147  const postType = getCurrentPostType(state);
3148  const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
3149  if (record) {
3150    if (typeof record.content === 'function') {
3151      return record.content(record);
3152    } else if (record.blocks) {
3153      return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
3154    } else if (record.content) {
3155      return record.content;
3156    }
3157  }
3158  return '';
3159});
3160
3161/**
3162 * Returns true if the post is being published, or false otherwise.
3163 *
3164 * @param {Object} state Global application state.
3165 *
3166 * @return {boolean} Whether post is being published.
3167 */
3168function isPublishingPost(state) {
3169  return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish';
3170}
3171
3172/**
3173 * Returns whether the permalink is editable or not.
3174 *
3175 * @param {Object} state Editor state.
3176 *
3177 * @return {boolean} Whether or not the permalink is editable.
3178 */
3179function isPermalinkEditable(state) {
3180  const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
3181  return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
3182}
3183
3184/**
3185 * Returns the permalink for the post.
3186 *
3187 * @param {Object} state Editor state.
3188 *
3189 * @return {?string} The permalink, or null if the post is not viewable.
3190 */
3191function getPermalink(state) {
3192  const permalinkParts = getPermalinkParts(state);
3193  if (!permalinkParts) {
3194    return null;
3195  }
3196  const {
3197    prefix,
3198    postName,
3199    suffix
3200  } = permalinkParts;
3201  if (isPermalinkEditable(state)) {
3202    return prefix + postName + suffix;
3203  }
3204  return prefix;
3205}
3206
3207/**
3208 * Returns the slug for the post being edited, preferring a manually edited
3209 * value if one exists, then a sanitized version of the current post title, and
3210 * finally the post ID.
3211 *
3212 * @param {Object} state Editor state.
3213 *
3214 * @return {string} The current slug to be displayed in the editor
3215 */
3216function getEditedPostSlug(state) {
3217  return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state);
3218}
3219
3220/**
3221 * Returns the permalink for a post, split into it's three parts: the prefix,
3222 * the postName, and the suffix.
3223 *
3224 * @param {Object} state Editor state.
3225 *
3226 * @return {Object} An object containing the prefix, postName, and suffix for
3227 *                  the permalink, or null if the post is not viewable.
3228 */
3229function getPermalinkParts(state) {
3230  const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
3231  if (!permalinkTemplate) {
3232    return null;
3233  }
3234  const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug');
3235  const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
3236  return {
3237    prefix,
3238    postName,
3239    suffix
3240  };
3241}
3242
3243/**
3244 * Returns whether the post is locked.
3245 *
3246 * @param {Object} state Global application state.
3247 *
3248 * @return {boolean} Is locked.
3249 */
3250function isPostLocked(state) {
3251  return state.postLock.isLocked;
3252}
3253
3254/**
3255 * Returns whether post saving is locked.
3256 *
3257 * @param {Object} state Global application state.
3258 *
3259 * @return {boolean} Is locked.
3260 */
3261function isPostSavingLocked(state) {
3262  return Object.keys(state.postSavingLock).length > 0;
3263}
3264
3265/**
3266 * Returns whether post autosaving is locked.
3267 *
3268 * @param {Object} state Global application state.
3269 *
3270 * @return {boolean} Is locked.
3271 */
3272function isPostAutosavingLocked(state) {
3273  return Object.keys(state.postAutosavingLock).length > 0;
3274}
3275
3276/**
3277 * Returns whether the edition of the post has been taken over.
3278 *
3279 * @param {Object} state Global application state.
3280 *
3281 * @return {boolean} Is post lock takeover.
3282 */
3283function isPostLockTakeover(state) {
3284  return state.postLock.isTakeover;
3285}
3286
3287/**
3288 * Returns details about the post lock user.
3289 *
3290 * @param {Object} state Global application state.
3291 *
3292 * @return {Object} A user object.
3293 */
3294function getPostLockUser(state) {
3295  return state.postLock.user;
3296}
3297
3298/**
3299 * Returns the active post lock.
3300 *
3301 * @param {Object} state Global application state.
3302 *
3303 * @return {Object} The lock object.
3304 */
3305function getActivePostLock(state) {
3306  return state.postLock.activePostLock;
3307}
3308
3309/**
3310 * Returns whether or not the user has the unfiltered_html capability.
3311 *
3312 * @param {Object} state Editor state.
3313 *
3314 * @return {boolean} Whether the user can or can't post unfiltered HTML.
3315 */
3316function canUserUseUnfilteredHTML(state) {
3317  return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html'));
3318}
3319
3320/**
3321 * Returns whether the pre-publish panel should be shown
3322 * or skipped when the user clicks the "publish" button.
3323 *
3324 * @return {boolean} Whether the pre-publish panel should be shown or not.
3325 */
3326const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'isPublishSidebarEnabled'));
3327
3328/**
3329 * Return the current block list.
3330 *
3331 * @param {Object} state
3332 * @return {Array} Block list.
3333 */
3334const getEditorBlocks = rememo(state => {
3335  return getEditedPostAttribute(state, 'blocks') || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state));
3336}, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]
3336);
3337
3338/**
3339 * A block selection object.
3340 *
3341 * @typedef {Object} WPBlockSelection
3342 *
3343 * @property {string} clientId     A block client ID.
3344 * @property {string} attributeKey A block attribute key.
3345 * @property {number} offset       An attribute value offset, based on the rich
3346 *                                 text value. See `wp.richText.create`.
3347 */
3348
3349/**
3350 * Returns the current selection start.
3351 *
3352 * @param {Object} state
3353 * @return {WPBlockSelection} The selection start.
3354 *
3355 * @deprecated since Gutenberg 10.0.0.
3356 */
3357function getEditorSelectionStart(state) {
3358  external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
3359    since: '5.8',
3360    alternative: "select('core/editor').getEditorSelection"
3361  });
3362  return getEditedPostAttribute(state, 'selection')?.selectionStart;
3363}
3364
3365/**
3366 * Returns the current selection end.
3367 *
3368 * @param {Object} state
3369 * @return {WPBlockSelection} The selection end.
3370 *
3371 * @deprecated since Gutenberg 10.0.0.
3372 */
3373function getEditorSelectionEnd(state) {
3374  external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
3375    since: '5.8',
3376    alternative: "select('core/editor').getEditorSelection"
3377  });
3378  return getEditedPostAttribute(state, 'selection')?.selectionEnd;
3379}
3380
3381/**
3382 * Returns the current selection.
3383 *
3384 * @param {Object} state
3385 * @return {WPBlockSelection} The selection end.
3386 */
3387function getEditorSelection(state) {
3388  return getEditedPostAttribute(state, 'selection');
3389}
3390
3391/**
3392 * Is the editor ready
3393 *
3394 * @param {Object} state
3395 * @return {boolean} is Ready.
3396 */
3397function __unstableIsEditorReady(state) {
3398  return state.isReady;
3399}
3400
3401/**
3402 * Returns the post editor settings.
3403 *
3404 * @param {Object} state Editor state.
3405 *
3406 * @return {Object} The editor settings object.
3407 */
3408function getEditorSettings(state) {
3409  return state.editorSettings;
3410}
3411
3412/*
3413 * Backward compatibility
3414 */
3415
3416/**
3417 * Returns state object prior to a specified optimist transaction ID, or `null`
3418 * if the transaction corresponding to the given ID cannot be found.
3419 *
3420 * @deprecated since Gutenberg 9.7.0.
3421 */
3422function getStateBeforeOptimisticTransaction() {
3423  external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", {
3424    since: '5.7',
3425    hint: 'No state history is kept on this store anymore'
3426  });
3427  return null;
3428}
3429/**
3430 * Returns true if an optimistic transaction is pending commit, for which the
3431 * before state satisfies the given predicate function.
3432 *
3433 * @deprecated since Gutenberg 9.7.0.
3434 */
3435function inSomeHistory() {
3436  external_wp_deprecated_default()("select('core/editor').inSomeHistory", {
3437    since: '5.7',
3438    hint: 'No state history is kept on this store anymore'
3439  });
3440  return false;
3441}
3442function getBlockEditorSelector(name) {
3443  return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ...args) => {
3444    external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', {
3445      since: '5.3',
3446      alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
3447      version: '6.2'
3448    });
3449    return select(external_wp_blockEditor_namespaceObject.store)[name](...args);
3450  });
3451}
3452
3453/**
3454 * @see getBlockName in core/block-editor store.
3455 */
3456const getBlockName = getBlockEditorSelector('getBlockName');
3457
3458/**
3459 * @see isBlockValid in core/block-editor store.
3460 */
3461const isBlockValid = getBlockEditorSelector('isBlockValid');
3462
3463/**
3464 * @see getBlockAttributes in core/block-editor store.
3465 */
3466const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
3467
3468/**
3469 * @see getBlock in core/block-editor store.
3470 */
3471const getBlock = getBlockEditorSelector('getBlock');
3472
3473/**
3474 * @see getBlocks in core/block-editor store.
3475 */
3476const getBlocks = getBlockEditorSelector('getBlocks');
3477
3478/**
3479 * @see getClientIdsOfDescendants in core/block-editor store.
3480 */
3481const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
3482
3483/**
3484 * @see getClientIdsWithDescendants in core/block-editor store.
3485 */
3486const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
3487
3488/**
3489 * @see getGlobalBlockCount in core/block-editor store.
3490 */
3491const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
3492
3493/**
3494 * @see getBlocksByClientId in core/block-editor store.
3495 */
3496const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
3497
3498/**
3499 * @see getBlockCount in core/block-editor store.
3500 */
3501const getBlockCount = getBlockEditorSelector('getBlockCount');
3502
3503/**
3504 * @see getBlockSelectionStart in core/block-editor store.
3505 */
3506const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
3507
3508/**
3509 * @see getBlockSelectionEnd in core/block-editor store.
3510 */
3511const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
3512
3513/**
3514 * @see getSelectedBlockCount in core/block-editor store.
3515 */
3516const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
3517
3518/**
3519 * @see hasSelectedBlock in core/block-editor store.
3520 */
3521const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
3522
3523/**
3524 * @see getSelectedBlockClientId in core/block-editor store.
3525 */
3526const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
3527
3528/**
3529 * @see getSelectedBlock in core/block-editor store.
3530 */
3531const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
3532
3533/**
3534 * @see getBlockRootClientId in core/block-editor store.
3535 */
3536const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
3537
3538/**
3539 * @see getBlockHierarchyRootClientId in core/block-editor store.
3540 */
3541const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
3542
3543/**
3544 * @see getAdjacentBlockClientId in core/block-editor store.
3545 */
3546const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
3547
3548/**
3549 * @see getPreviousBlockClientId in core/block-editor store.
3550 */
3551const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
3552
3553/**
3554 * @see getNextBlockClientId in core/block-editor store.
3555 */
3556const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
3557
3558/**
3559 * @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
3560 */
3561const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('get
3561SelectedBlocksInitialCaretPosition');
3562
3563/**
3564 * @see getMultiSelectedBlockClientIds in core/block-editor store.
3565 */
3566const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
3567
3568/**
3569 * @see getMultiSelectedBlocks in core/block-editor store.
3570 */
3571const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
3572
3573/**
3574 * @see getFirstMultiSelectedBlockClientId in core/block-editor store.
3575 */
3576const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
3577
3578/**
3579 * @see getLastMultiSelectedBlockClientId in core/block-editor store.
3580 */
3581const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
3582
3583/**
3584 * @see isFirstMultiSelectedBlock in core/block-editor store.
3585 */
3586const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
3587
3588/**
3589 * @see isBlockMultiSelected in core/block-editor store.
3590 */
3591const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
3592
3593/**
3594 * @see isAncestorMultiSelected in core/block-editor store.
3595 */
3596const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
3597
3598/**
3599 * @see getMultiSelectedBlocksStartClientId in core/block-editor store.
3600 */
3601const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
3602
3603/**
3604 * @see getMultiSelectedBlocksEndClientId in core/block-editor store.
3605 */
3606const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
3607
3608/**
3609 * @see getBlockOrder in core/block-editor store.
3610 */
3611const getBlockOrder = getBlockEditorSelector('getBlockOrder');
3612
3613/**
3614 * @see getBlockIndex in core/block-editor store.
3615 */
3616const getBlockIndex = getBlockEditorSelector('getBlockIndex');
3617
3618/**
3619 * @see isBlockSelected in core/block-editor store.
3620 */
3621const isBlockSelected = getBlockEditorSelector('isBlockSelected');
3622
3623/**
3624 * @see hasSelectedInnerBlock in core/block-editor store.
3625 */
3626const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
3627
3628/**
3629 * @see isBlockWithinSelection in core/block-editor store.
3630 */
3631const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
3632
3633/**
3634 * @see hasMultiSelection in core/block-editor store.
3635 */
3636const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
3637
3638/**
3639 * @see isMultiSelecting in core/block-editor store.
3640 */
3641const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
3642
3643/**
3644 * @see isSelectionEnabled in core/block-editor store.
3645 */
3646const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
3647
3648/**
3649 * @see getBlockMode in core/block-editor store.
3650 */
3651const getBlockMode = getBlockEditorSelector('getBlockMode');
3652
3653/**
3654 * @see isTyping in core/block-editor store.
3655 */
3656const isTyping = getBlockEditorSelector('isTyping');
3657
3658/**
3659 * @see isCaretWithinFormattedText in core/block-editor store.
3660 */
3661const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
3662
3663/**
3664 * @see getBlockInsertionPoint in core/block-editor store.
3665 */
3666const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
3667
3668/**
3669 * @see isBlockInsertionPointVisible in core/block-editor store.
3670 */
3671const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
3672
3673/**
3674 * @see isValidTemplate in core/block-editor store.
3675 */
3676const isValidTemplate = getBlockEditorSelector('isValidTemplate');
3677
3678/**
3679 * @see getTemplate in core/block-editor store.
3680 */
3681const getTemplate = getBlockEditorSelector('getTemplate');
3682
3683/**
3684 * @see getTemplateLock in core/block-editor store.
3685 */
3686const getTemplateLock = getBlockEditorSelector('getTemplateLock');
3687
3688/**
3689 * @see canInsertBlockType in core/block-editor store.
3690 */
3691const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
3692
3693/**
3694 * @see getInserterItems in core/block-editor store.
3695 */
3696const getInserterItems = getBlockEditorSelector('getInserterItems');
3697
3698/**
3699 * @see hasInserterItems in core/block-editor store.
3700 */
3701const hasInserterItems = getBlockEditorSelector('hasInserterItems');
3702
3703/**
3704 * @see getBlockListSettings in core/block-editor store.
3705 */
3706const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
3707
3708/**
3709 * Returns the default template types.
3710 *
3711 * @param {Object} state Global application state.
3712 *
3713 * @return {Object} The template types.
3714 */
3715function __experimentalGetDefaultTemplateTypes(state) {
3716  return getEditorSettings(state)?.defaultTemplateTypes;
3717}
3718
3719/**
3720 * Returns the default template part areas.
3721 *
3722 * @param {Object} state Global application state.
3723 *
3724 * @return {Array} The template part areas.
3725 */
3726const __experimentalGetDefaultTemplatePartAreas = rememo(state => {
3727  const areas = getEditorSettings(state)?.defaultTemplatePartAreas || [];
3728  return areas?.map(item => {
3729    return {
3730      ...item,
3731      icon: getTemplatePartIcon(item.icon)
3732    };
3733  });
3734}, state => [getEditorSettings(state)?.defaultTemplatePartAreas]);
3735
3736/**
3737 * Returns a default template type searched by slug.
3738 *
3739 * @param {Object} state Global application state.
3740 * @param {string} slug  The template type slug.
3741 *
3742 * @return {Object} The template type.
3743 */
3744const __experimentalGetDefaultTemplateType = rememo((state, slug) => {
3745  var _Object$values$find;
3746  const templateTypes = __experimentalGetDefaultTemplateTypes(state);
3747  if (!templateTypes) {
3748    return EMPTY_OBJECT;
3749  }
3750  return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT;
3751}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
3752
3753/**
3754 * Given a template entity, return information about it which is ready to be
3755 * rendered, such as the title, description, and icon.
3756 *
3757 * @param {Object} state    Global application state.
3758 * @param {Object} template The template for which we need information.
3759 * @return {Object} Information about the template, including title, description, and icon.
3760 */
3761function __experimentalGetTemplateInfo(state, template) {
3762  if (!template) {
3763    return EMPTY_OBJECT;
3764  }
3765  const {
3766    description,
3767    slug,
3768    title,
3769    area
3770  } = template;
3771  const {
3772    title: defaultTitle,
3773    description: defaultDescription
3774  } = __experimentalGetDefaultTemplateType(state, slug);
3775  const templateTitle = typeof title === 'string' ? title : title?.rendered;
3776  const templateDescription = typeof description === 'string' ? description : description?.raw;
3777  const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || library_layout;
3778  return {
3779    title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
3780    description: templateDescription || defaultDescription,
3781    icon: templateIcon
3782  };
3783}
3784
3785/**
3786 * Returns a post type label depending on the current post.
3787 *
3788 * @param {Object} state Global application state.
3789 *
3790 * @return {string|undefined} The post type label if available, otherwise undefined.
3791 */
3792const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
3793  const currentPostType = getCurrentPostType(state);
3794  const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType);
3795  // Disable reason: Post type labels object is shaped like this.
3796  // eslint-disable-next-line camelcase
3797  return postType?.labels?.singular_name;
3798});
3799
3800;
3800// CONCATENATED MODULE: external ["wp","apiFetch"]
3801const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
3802var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
3803;// CONCATENATED MODULE: external ["wp","notices"]
3804const external_wp_notices_namespaceObject = window["wp"]["notices"];
3805;// CONCATENATED MODULE: ./packages/editor/build-module/store/local-autosave.js
3806/**
3807 * Function returning a sessionStorage key to set or retrieve a given post's
3808 * automatic session backup.
3809 *
3810 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
3811 * `loggedout` handler can clear sessionStorage of any user-private content.
3812 *
3813 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
3814 *
3815 * @param {string}  postId    Post ID.
3816 * @param {boolean} isPostNew Whether post new.
3817 *
3818 * @return {string} sessionStorage key
3819 */
3820function postKey(postId, isPostNew) {
3821  return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
3822}
3823function localAutosaveGet(postId, isPostNew) {
3824  return window.sessionStorage.getItem(postKey(postId, isPostNew));
3825}
3826function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
3827  window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
3828    post_title: title,
3829    content,
3830    excerpt
3831  }));
3832}
3833function localAutosaveClear(postId, isPostNew) {
3834  window.sessionStorage.removeItem(postKey(postId, isPostNew));
3835}
3836
3837;// CONCATENATED MODULE: external ["wp","i18n"]
3838const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
3839;// CONCATENATED MODULE: ./packages/editor/build-module/store/utils/notice-builder.js
3840/**
3841 * WordPress dependencies
3842 */
3843
3844
3845/**
3846 * Internal dependencies
3847 */
3848
3849
3850/**
3851 * Builds the arguments for a success notification dispatch.
3852 *
3853 * @param {Object} data Incoming data to build the arguments from.
3854 *
3855 * @return {Array} Arguments for dispatch. An empty array signals no
3856 *                 notification should be sent.
3857 */
3858function getNotificationArgumentsForSaveSuccess(data) {
3859  var _postType$viewable;
3860  const {
3861    previousPost,
3862    post,
3863    postType
3864  } = data;
3865  // Autosaves are neither shown a notice nor redirected.
3866  if (data.options?.isAutosave) {
3867    return [];
3868  }
3869
3870  // No notice is shown after trashing a post
3871  if (post.status === 'trash' && previousPost.status !== 'trash') {
3872    return [];
3873  }
3874  const publishStatus = ['publish', 'private', 'future'];
3875  const isPublished = publishStatus.includes(previousPost.status);
3876  const willPublish = publishStatus.includes(post.status);
3877  let noticeMessage;
3878  let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
3879  let isDraft;
3880
3881  // Always should a notice, which will be spoken for accessibility.
3882  if (!isPublished && !willPublish) {
3883    // If saving a non-published post, don't show notice.
3884    noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.');
3885    isDraft = true;
3886  } else if (isPublished && !willPublish) {
3887    // If undoing publish status, show specific notice.
3888    noticeMessage = postType.labels.item_reverted_to_draft;
3889    shouldShowLink = false;
3890  } else if (!isPublished && willPublish) {
3891    // If publishing or scheduling a post, show the corresponding
3892    // publish message.
3893    noticeMessage = {
3894      publish: postType.labels.item_published,
3895      private: postType.labels.item_published_privately,
3896      future: postType.labels.item_scheduled
3897    }[post.status];
3898  } else {
3899    // Generic fallback notice.
3900    noticeMessage = postType.labels.item_updated;
3901  }
3902  const actions = [];
3903  if (shouldShowLink) {
3904    actions.push({
3905      label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item,
3906      url: post.link
3907    });
3908  }
3909  return [noticeMessage, {
3910    id: SAVE_POST_NOTICE_ID,
3911    type: 'snackbar',
3912    actions
3913  }];
3914}
3915
3916/**
3917 * Builds the fail notification arguments for dispatch.
3918 *
3919 * @param {Object} data Incoming data to build the arguments with.
3920 *
3921 * @return {Array} Arguments for dispatch. An empty array signals no
3922 *                 notification should be sent.
3923 */
3924function getNotificationArgumentsForSaveFail(data) {
3925  const {
3926    post,
3927    edits,
3928    error
3929  } = data;
3930  if (error && 'rest_autosave_no_changes' === error.code) {
3931    // Autosave requested a new autosave, but there were no changes. This shouldn't
3932    // result in an error notice for the user.
3933    return [];
3934  }
3935  const publishStatus = ['publish', 'private', 'future'];
3936  const isPublished = publishStatus.indexOf(post.status) !== -1;
3937  // If the post was being published, we show the corresponding publish error message
3938  // Unless we publish an "updating failed" message.
3939  const messages = {
3940    publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
3941    private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
3942    future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.')
3943  };
3944  let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.');
3945
3946  // Check if message string contains HTML. Notice text is currently only
3947  // supported as plaintext, and stripping the tags may muddle the meaning.
3948  if (error.message && !/<\/?[^>]*>/.test(error.message)) {
3949    noticeMessage = [noticeMessage, error.message].join(' ');
3950  }
3951  return [noticeMessage, {
3952    id: SAVE_POST_NOTICE_ID
3953  }];
3954}
3955
3956/**
3957 * Builds the trash fail notification arguments for dispatch.
3958 *
3959 * @param {Object} data
3960 *
3961 * @return {Array} Arguments for dispatch.
3962 */
3963function getNotificationArgumentsForTrashFail(data) {
3964  return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), {
3965    id: TRASH_POST_NOTICE_ID
3966  }];
3967}
3968
3969;// CONCATENATED MODULE: ./packages/editor/build-module/store/actions.js
3970/**
3971 * WordPress dependencies
3972 */
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982/**
3983 * Internal dependencies
3984 */
3985
3986
3987
3988
3989/**
3990 * Returns an action generator used in signalling that editor has initialized with
3991 * the specified post object and editor settings.
3992 *
3993 * @param {Object} post     Post object.
3994 * @param {Object} edits    Initial edited attributes object.
3995 * @param {Array?} template Block Template.
3996 */
3997const setupEditor = (post, edits, template) => ({
3998  dispatch
3999}) => {
4000  dispatch.setupEditorState(post);
4001  // Apply a template for new posts only, if exists.
4002  const isNewPost = post.status === 'auto-draft';
4003  if (isNewPost && template) {
4004    // In order to ensure maximum of a single parse during setup, edits are
4005    // included as part of editor setup action. Assume edited content as
4006    // canonical if provided, falling back to post.
4007    let content;
4008    if ('content' in edits) {
4009      content = edits.content;
4010    } else {
4011      content = post.content.raw;
4012    }
4013    let blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
4014    blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
4015    dispatch.resetEditorBlocks(blocks, {
4016      __unstableShouldCreateUndoLevel: false
4017    });
4018  }
4019  if (edits && Object.values(edits).some(([key, edit]) => {
4020    var _post$key$raw;
4021    return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
4022  })) {
4023    dispatch.editPost(edits);
4024  }
4025};
4026
4027/**
4028 * Returns an action object signalling that the editor is being destroyed and
4029 * that any necessary state or side-effect cleanup should occur.
4030 *
4031 * @return {Object} Action object.
4032 */
4033function __experimentalTearDownEditor() {
4034  return {
4035    type: 'TEAR_DOWN_EDITOR'
4036  };
4037}
4038
4039/**
4040 * Returns an action object used in signalling that the latest version of the
4041 * post has been received, either by initialization or save.
4042 *
4043 * @deprecated Since WordPress 6.0.
4044 */
4045function resetPost() {
4046  external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", {
4047    since: '6.0',
4048    version: '6.3',
4049    alternative: 'Initialize the editor with the setupEditorState action'
4050  });
4051  return {
4052    type: 'DO_NOTHING'
4053  };
4054}
4055
4056/**
4057 * Returns an action object used in signalling that a patch of updates for the
4058 * latest version of the post have been received.
4059 *
4060 * @return {Object} Action object.
4061 * @deprecated since Gutenberg 9.7.0.
4062 */
4063function updatePost() {
4064  external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
4065    since: '5.7',
4066    alternative: 'Use the core entities store instead'
4067  });
4068  return {
4069    type: 'DO_NOTHING'
4070  };
4071}
4072
4073/**
4074 * Returns an action object used to setup the editor state when first opening
4075 * an editor.
4076 *
4077 * @param {Object} post Post object.
4078 *
4079 * @return {Object} Action object.
4080 */
4081function setupEditorState(post) {
4082  return {
4083    type: 'SETUP_EDITOR_STATE',
4084    post
4085  };
4086}
4087
4088/**
4089 * Returns an action object used in signalling that attributes of the post have
4090 * been edited.
4091 *
4092 * @param {Object} edits   Post attributes to edit.
4093 * @param {Object} options Options for the edit.
4094 */
4095const editPost = (edits, options) => ({
4096  select,
4097  registry
4098}) => {
4099  const {
4100    id,
4101    type
4102  } = select.getCurrentPost();
4103  registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options);
4104};
4105
4106/**
4107 * Action for saving the current post in the editor.
4108 *
4109 * @param {Object} options
4110 */
4111const savePost = (options = {}) => async ({
4112  select,
4113  dispatch,
4114  registry
4115}) => {
4116  if (!select.isEditedPostSaveable()) {
4117    return;
4118  }
4119  const content = select.getEditedPostContent();
4120  if (!options.isAutosave) {
4121    dispatch.editPost({
4122      content
4123    }, {
4124      undoIgnore: true
4125    });
4126  }
4127  const previousRecord = select.getCurrentPost();
4128  const edits = {
4129    id: previousRecord.id,
4130    ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
4131    content
4132  };
4133  dispatch({
4134    type: 'REQUEST_POST_UPDATE_START',
4135    options
4136  });
4137  await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options);
4138  let error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
4139  if (!error) {
4140    await (0,external_wp_hooks_namespaceObject.applyFilters)('editor.__unstableSavePost', Promise.resolve(), options).catch(err => {
4141      error = err;
4142    });
4143  }
4144  dispatch({
4145    type: 'REQUEST_POST_UPDATE_FINISH',
4146    options
4147  });
4148  if (error) {
4149    const args = getNotificationArgumentsForSaveFail({
4150      post: previousRecord,
4151      edits,
4152      error
4153    });
4154    if (args.length) {
4155      registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args);
4156    }
4157  } else {
4158    const updatedRecord = select.getCurrentPost();
4159    const args = getNotificationArgumentsForSaveSuccess({
4160      previousPost: previousRecord,
4161      post: updatedRecord,
4162      postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type),
4163      options
4164    });
4165    if (args.length) {
4166      registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args);
4167    }
4168    // Make sure that any edits after saving create an undo level and are
4169    // considered for change detection.
4170    if (!options.isAutosave) {
4171      registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent
4171();
4172    }
4173  }
4174};
4175
4176/**
4177 * Action for refreshing the current post.
4178 *
4179 * @deprecated Since WordPress 6.0.
4180 */
4181function refreshPost() {
4182  external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", {
4183    since: '6.0',
4184    version: '6.3',
4185    alternative: 'Use the core entities store instead'
4186  });
4187  return {
4188    type: 'DO_NOTHING'
4189  };
4190}
4191
4192/**
4193 * Action for trashing the current post in the editor.
4194 */
4195const trashPost = () => async ({
4196  select,
4197  dispatch,
4198  registry
4199}) => {
4200  const postTypeSlug = select.getCurrentPostType();
4201  const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
4202  registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID);
4203  const {
4204    rest_base: restBase,
4205    rest_namespace: restNamespace = 'wp/v2'
4206  } = postType;
4207  dispatch({
4208    type: 'REQUEST_POST_DELETE_START'
4209  });
4210  try {
4211    const post = select.getCurrentPost();
4212    await external_wp_apiFetch_default()({
4213      path: `/${restNamespace}/${restBase}/${post.id}`,
4214      method: 'DELETE'
4215    });
4216    await dispatch.savePost();
4217  } catch (error) {
4218    registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({
4219      error
4220    }));
4221  }
4222  dispatch({
4223    type: 'REQUEST_POST_DELETE_FINISH'
4224  });
4225};
4226
4227/**
4228 * Action that autosaves the current post.  This
4229 * includes server-side autosaving (default) and client-side (a.k.a. local)
4230 * autosaving (e.g. on the Web, the post might be committed to Session
4231 * Storage).
4232 *
4233 * @param {Object?} options Extra flags to identify the autosave.
4234 */
4235const autosave = ({
4236  local = false,
4237  ...options
4238} = {}) => async ({
4239  select,
4240  dispatch
4241}) => {
4242  if (local) {
4243    const post = select.getCurrentPost();
4244    const isPostNew = select.isEditedPostNew();
4245    const title = select.getEditedPostAttribute('title');
4246    const content = select.getEditedPostAttribute('content');
4247    const excerpt = select.getEditedPostAttribute('excerpt');
4248    localAutosaveSet(post.id, isPostNew, title, content, excerpt);
4249  } else {
4250    await dispatch.savePost({
4251      isAutosave: true,
4252      ...options
4253    });
4254  }
4255};
4256const __unstableSaveForPreview = ({
4257  forceIsAutosaveable
4258} = {}) => async ({
4259  select,
4260  dispatch
4261}) => {
4262  if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) {
4263    const isDraft = ['draft', 'auto-draft'].includes(select.getEditedPostAttribute('status'));
4264    if (isDraft) {
4265      await dispatch.savePost({
4266        isPreview: true
4267      });
4268    } else {
4269      await dispatch.autosave({
4270        isPreview: true
4271      });
4272    }
4273  }
4274  return select.getEditedPostPreviewLink();
4275};
4276
4277/**
4278 * Action that restores last popped state in undo history.
4279 */
4280const redo = () => ({
4281  registry
4282}) => {
4283  registry.dispatch(external_wp_coreData_namespaceObject.store).redo();
4284};
4285
4286/**
4287 * Action that pops a record from undo history and undoes the edit.
4288 */
4289const undo = () => ({
4290  registry
4291}) => {
4292  registry.dispatch(external_wp_coreData_namespaceObject.store).undo();
4293};
4294
4295/**
4296 * Action that creates an undo history record.
4297 *
4298 * @deprecated Since WordPress 6.0
4299 */
4300function createUndoLevel() {
4301  external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", {
4302    since: '6.0',
4303    version: '6.3',
4304    alternative: 'Use the core entities store instead'
4305  });
4306  return {
4307    type: 'DO_NOTHING'
4308  };
4309}
4310
4311/**
4312 * Action that locks the editor.
4313 *
4314 * @param {Object}
4314 lock Details about the post lock status, user, and nonce.
4315 * @return {Object} Action object.
4316 */
4317function updatePostLock(lock) {
4318  return {
4319    type: 'UPDATE_POST_LOCK',
4320    lock
4321  };
4322}
4323
4324/**
4325 * Enable the publish sidebar.
4326 */
4327const enablePublishSidebar = () => ({
4328  registry
4329}) => {
4330  registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', true);
4331};
4332
4333/**
4334 * Disables the publish sidebar.
4335 */
4336const disablePublishSidebar = () => ({
4337  registry
4338}) => {
4339  registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', false);
4340};
4341
4342/**
4343 * Action that locks post saving.
4344 *
4345 * @param {string} lockName The lock name.
4346 *
4347 * @example
4348 * ```
4349 * const { subscribe } = wp.data;
4350 *
4351 * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
4352 *
4353 * // Only allow publishing posts that are set to a future date.
4354 * if ( 'publish' !== initialPostStatus ) {
4355 *
4356 * 	// Track locking.
4357 * 	let locked = false;
4358 *
4359 * 	// Watch for the publish event.
4360 * 	let unssubscribe = subscribe( () => {
4361 * 		const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
4362 * 		if ( 'publish' !== currentPostStatus ) {
4363 *
4364 * 			// Compare the post date to the current date, lock the post if the date isn't in the future.
4365 * 			const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
4366 * 			const currentDate = new Date();
4367 * 			if ( postDate.getTime() <= currentDate.getTime() ) {
4368 * 				if ( ! locked ) {
4369 * 					locked = true;
4370 * 					wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
4371 * 				}
4372 * 			} else {
4373 * 				if ( locked ) {
4374 * 					locked = false;
4375 * 					wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
4376 * 				}
4377 * 			}
4378 * 		}
4379 * 	} );
4380 * }
4381 * ```
4382 *
4383 * @return {Object} Action object
4384 */
4385function lockPostSaving(lockName) {
4386  return {
4387    type: 'LOCK_POST_SAVING',
4388    lockName
4389  };
4390}
4391
4392/**
4393 * Action that unlocks post saving.
4394 *
4395 * @param {string} lockName The lock name.
4396 *
4397 * @example
4398 * ```
4399 * // Unlock post saving with the lock key `mylock`:
4400 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
4401 * ```
4402 *
4403 * @return {Object} Action object
4404 */
4405function unlockPostSaving(lockName) {
4406  return {
4407    type: 'UNLOCK_POST_SAVING',
4408    lockName
4409  };
4410}
4411
4412/**
4413 * Action that locks post autosaving.
4414 *
4415 * @param {string} lockName The lock name.
4416 *
4417 * @example
4418 * ```
4419 * // Lock post autosaving with the lock key `mylock`:
4420 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );
4421 * ```
4422 *
4423 * @return {Object} Action object
4424 */
4425function lockPostAutosaving(lockName) {
4426  return {
4427    type: 'LOCK_POST_AUTOSAVING',
4428    lockName
4429  };
4430}
4431
4432/**
4433 * Action that unlocks post autosaving.
4434 *
4435 * @param {string} lockName The lock name.
4436 *
4437 * @example
4438 * ```
4439 * // Unlock post saving with the lock key `mylock`:
4440 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );
4441 * ```
4442 *
4443 * @return {Object} Action object
4444 */
4445function unlockPostAutosaving(lockName) {
4446  return {
4447    type: 'UNLOCK_POST_AUTOSAVING',
4448    lockName
4449  };
4450}
4451
4452/**
4453 * Returns an action object used to signal that the blocks have been updated.
4454 *
4455 * @param {Array}   blocks  Block Array.
4456 * @param {?Object} options Optional options.
4457 */
4458const resetEditorBlocks = (blocks, options = {}) => ({
4459  select,
4460  dispatch,
4461  registry
4462}) => {
4463  const {
4464    __unstableShouldCreateUndoLevel,
4465    selection
4466  } = options;
4467  const edits = {
4468    blocks,
4469    selection
4470  };
4471  if (__unstableShouldCreateUndoLevel !== false) {
4472    const {
4473      id,
4474      type
4475    } = select.getCurrentPost();
4476    const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
4477    if (noChange) {
4478      registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id);
4479      return;
4480    }
4481
4482    // We create a new function here on every persistent edit
4483    // to make sure the edit makes the post dirty and creates
4484    // a new undo level.
4485    edits.content = ({
4486      blocks: blocksForSerialization = []
4487    }) =>
4487 (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
4488  }
4489  dispatch.editPost(edits);
4490};
4491
4492/*
4493 * Returns an action object used in signalling that the post editor settings have been updated.
4494 *
4495 * @param {Object} settings Updated settings
4496 *
4497 * @return {Object} Action object
4498 */
4499function updateEditorSettings(settings) {
4500  return {
4501    type: 'UPDATE_EDITOR_SETTINGS',
4502    settings
4503  };
4504}
4505
4506/**
4507 * Backward compatibility
4508 */
4509
4510const getBlockEditorAction = name => (...args) => ({
4511  registry
4512}) => {
4513  external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', {
4514    since: '5.3',
4515    alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
4516    version: '6.2'
4517  });
4518  registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args);
4519};
4520
4521/**
4522 * @see resetBlocks in core/block-editor store.
4523 */
4524const resetBlocks = getBlockEditorAction('resetBlocks');
4525
4526/**
4527 * @see receiveBlocks in core/block-editor store.
4528 */
4529const receiveBlocks = getBlockEditorAction('receiveBlocks');
4530
4531/**
4532 * @see updateBlock in core/block-editor store.
4533 */
4534const updateBlock = getBlockEditorAction('updateBlock');
4535
4536/**
4537 * @see updateBlockAttributes in core/block-editor store.
4538 */
4539const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes');
4540
4541/**
4542 * @see selectBlock in core/block-editor store.
4543 */
4544const selectBlock = getBlockEditorAction('selectBlock');
4545
4546/**
4547 * @see startMultiSelect in core/block-editor store.
4548 */
4549const startMultiSelect = getBlockEditorAction('startMultiSelect');
4550
4551/**
4552 * @see stopMultiSelect in core/block-editor store.
4553 */
4554const stopMultiSelect = getBlockEditorAction('stopMultiSelect');
4555
4556/**
4557 * @see multiSelect in core/block-editor store.
4558 */
4559const multiSelect = getBlockEditorAction('multiSelect');
4560
4561/**
4562 * @see clearSelectedBlock in core/block-editor store.
4563 */
4564const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock');
4565
4566/**
4567 * @see toggleSelection in core/block-editor store.
4568 */
4569const toggleSelection = getBlockEditorAction('toggleSelection');
4570
4571/**
4572 * @see replaceBlocks in core/block-editor store.
4573 */
4574const replaceBlocks = getBlockEditorAction('replaceBlocks');
4575
4576/**
4577 * @see replaceBlock in core/block-editor store.
4578 */
4579const replaceBlock = getBlockEditorAction('replaceBlock');
4580
4581/**
4582 * @see moveBlocksDown in core/block-editor store.
4583 */
4584const moveBlocksDown = getBlockEditorAction('moveBlocksDown');
4585
4586/**
4587 * @see moveBlocksUp in core/block-editor store.
4588 */
4589const moveBlocksUp = getBlockEditorAction('moveBlocksUp');
4590
4591/**
4592 * @see moveBlockToPosition in core/block-editor store.
4593 */
4594const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition');
4595
4596/**
4597 * @see insertBlock in core/block-editor store.
4598 */
4599const insertBlock = getBlockEditorAction('insertBlock');
4600
4601/**
4602 * @see insertBlocks in core/block-editor store.
4603 */
4604const insertBlocks = getBlockEditorAction('insertBlocks');
4605
4606/**
4607 * @see showInsertionPoint in core/block-editor store.
4608 */
4609const showInsertionPoint = getBlockEditorAction('showInsertionPoint');
4610
4611/**
4612 * @see hideInsertionPoint in core/block-editor store.
4613 */
4614const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint');
4615
4616/**
4617 * @see setTemplateValidity in core/block-editor store.
4618 */
4619const setTemplateValidity = getBlockEditorAction('setTemplateValidity');
4620
4621/**
4622 * @see synchronizeTemplate in core/block-editor store.
4623 */
4624const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate');
4625
4626/**
4627 * @see mergeBlocks in core/block-editor store.
4628 */
4629const mergeBlocks = getBlockEditorAction('mergeBlocks');
4630
4631/**
4632 * @see removeBlocks in core/block-editor store.
4633 */
4634const removeBlocks = getBlockEditorAction('removeBlocks');
4635
4636/**
4637 * @see removeBlock in core/block-editor store.
4638 */
4639const removeBlock = getBlockEditorAction('removeBlock');
4640
4641/**
4642 * @see toggleBlockMode in core/block-editor store.
4643 */
4644const toggleBlockMode = getBlockEditorAction('toggleBlockMode');
4645
4646/**
4647 * @see startTyping in core/block-editor store.
4648 */
4649const startTyping = getBlockEditorAction('startTyping');
4650
4651/**
4652 * @see stopTyping in core/block-editor store.
4653 */
4654const stopTyping = getBlockEditorAction('stopTyping');
4655
4656/**
4657 * @see enterFormattedText in core/block-editor store.
4658 */
4659const enterFormattedText = getBlockEditorAction('enterFormattedText');
4660
4661/**
4662 * @see exitFormattedText in core/block-editor store.
4663 */
4664const exitFormattedText = getBlockEditorAction('exitFormattedText');
4665
4666/**
4667 * @see insertDefaultBlock in core/block-editor store.
4668 */
4669const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
4670
4671/**
4672 * @see updateBlockListSettings in core/block-editor store.
4673 */
4674const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
4675
4676;// CONCATENATED MODULE: ./packages/editor/build-module/store/index.js
4677/**
4678 * WordPress dependencies
4679 */
4680
4681
4682/**
4683 * Internal dependencies
4684 */
4685
4686
4687
4688
4689
4690/**
4691 * Post editor data store configuration.
4692 *
4693 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
4694 *
4695 * @type {Object}
4696 */
4697const storeConfig = {
4698  reducer: reducer,
4699  selectors: selectors_namespaceObject,
4700  actions: actions_namespaceObject
4701};
4702
4703/**
4704 * Store definition for the editor namespace.
4705 *
4706 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
4707 *
4708 * @type {Object}
4709 */
4710const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
4711  ...storeConfig
4712});
4713(0,external_wp_data_namespaceObject.register)(store_store);
4714
4715;// CONCATENATED MODULE: ./packages/editor/build-module/hooks/custom-sources-backwards-compatibility.js
4716
4717/**
4718 * WordPress dependencies
4719 */
4720
4721
4722
4723
4724
4725
4726/**
4727 * Internal dependencies
4728 */
4729
4730
4731/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
4732/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
4733
4734/**
4735 * Object whose keys are the names of block attributes, where each value
4736 * represents the meta key to which the block attribute is intended to save.
4737 *
4738 * @see https://developer.wordpress.org/reference/functions/register_meta/
4739 *
4740 * @typedef {Object<string,string>} WPMetaAttributeMapping
4741 */
4742
4743/**
4744 * Given a mapping of attribute names (meta source attributes) to their
4745 * associated meta key, returns a higher order component that overrides its
4746 * `attributes` and `setAttributes` props to sync any changes with the edited
4747 * post's meta keys.
4748 *
4749 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.
4750 *
4751 * @return {WPHigherOrderComponent} Higher-order component.
4752 */
4753const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => ({
4754  attributes,
4755  setAttributes,
4756  ...props
4757}) => {
4758  const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []);
4759  const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta');
4760  const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({
4761    ...attributes,
4762    ...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]]))
4763  }), [attributes, meta]);
4764  return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, {
4765    attributes: mergedAttributes,
4766    setAttributes: nextAttributes => {
4767      const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter(
4768      // Filter to intersection of keys between the updated
4769      // attributes and those with an associated meta key.
4770      ([key]) => key in metaAttributes).map(([attributeKey, value]) => [
4771      // Rename the keys to the expected meta key name.
4772      metaAttributes[attributeKey], value]));
4773      if (Object.entries(nextMeta).length) {
4774        setMeta(nextMeta);
4775      }
4776      setAttributes(nextAttributes);
4777    },
4778    ...props
4779  });
4780}, 'withMetaAttributeSource');
4781
4782/**
4783 * Filters a registered block's settings to enhance a block's `edit` component
4784 * to upgrade meta-sourced attributes to use the post's meta entity property.
4785 *
4786 * @param {WPBlockSettings} settings Registered block settings.
4787 *
4788 * @return {WPBlockSettings} Filtered block settings.
4789 */
4790function shimAttributeSource(settings) {
4791  var _settings$attributes;
4792  /** @type {WPMetaAttributeMapping} */
4793  const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, {
4794    source
4795  }]) => source === 'meta').map(([attributeKey, {
4796    meta
4797  }]) => [attributeKey, meta]));
4798  if (Object.entries(metaAttributes).length) {
4799    settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
4800  }
4801  return settings;
4802}
4803(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource);
4804
4805;// CONCATENATED MODULE: ./packages/editor/build-module/components/autocompleters/user.js
4806
4807/**
4808 * WordPress dependencies
4809 */
4810
4811
4812
4813
4814/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
4815
4816function getUserLabel(user) {
4817  const avatar = user.avatar_urls && user.avatar_urls[24] ? (0,external_wp_element_namespaceObject.createElement)("img", {
4818    className: "editor-autocompleters__user-avatar",
4819    alt: "",
4820    src: user.avatar_urls[24]
4821  }) : (0,external_wp_element_namespaceObject.createElement)("span", {
4822    className: "editor-autocompleters__no-avatar"
4823  });
4824  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, avatar, (0,external_wp_element_namespaceObject.createElement)("span", {
4825    className: "editor-autocompleters__user-name"
4826  }, user.name), (0,external_wp_element_namespaceObject.createElement)("span", {
4827    className: "editor-autocompleters__user-slug"
4828  }, user.slug));
4829}
4830
4831/**
4832 * A user mentions completer.
4833 *
4834 * @type {WPCompleter}
4835 */
4836/* harmony default export */ const user = ({
4837  name: 'users',
4838  className: 'editor-autocompleters__user',
4839  triggerPrefix: '@',
4840  useItems(filterValue) {
4841    const users = (0,external_wp_data_namespaceObject.useSelect)(select => {
4842      const {
4843        getUsers
4844      } = select(external_wp_coreData_namespaceObject.store);
4845      return getUsers({
4846        context: 'view',
4847        search: encodeURIComponent(filterValue)
4848      });
4849    }, [filterValue]);
4850    const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({
4851      key: `user-${user.slug}`,
4852      value: user,
4853      label: getUserLabel(user)
4854    })) : [], [users]);
4855    return [options];
4856  },
4857  getOptionCompletion(user) {
4858    return `@${user.slug}`;
4859  }
4860});
4861
4862;// CONCATENATED MODULE: ./packages/editor/build-module/hooks/default-autocompleters.js
4863/**
4864 * WordPress dependencies
4865 */
4866
4867
4868/**
4869 * Internal dependencies
4870 */
4871
4872function setDefaultCompleters(completers = []) {
4873  // Provide copies so filters may directly modify them.
4874  completers.push({
4875    ...user
4876  });
4877  return completers;
4878}
4879(0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
4880
4881;// CONCATENATED MODULE: ./packages/editor/build-module/hooks/index.js
4882/**
4883 * Internal dependencies
4884 */
4885
4886
4887
4888;
4888// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
4889const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
4890;// CONCATENATED MODULE: ./packages/editor/build-module/components/global-keyboard-shortcuts/index.js
4891/**
4892 * WordPress dependencies
4893 */
4894
4895
4896
4897/**
4898 * Internal dependencies
4899 */
4900
4901function EditorKeyboardShortcuts() {
4902  const {
4903    redo,
4904    undo,
4905    savePost
4906  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
4907  const {
4908    isEditedPostDirty,
4909    isPostSavingLocked
4910  } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
4911  (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => {
4912    undo();
4913    event.preventDefault();
4914  });
4915  (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => {
4916    redo();
4917    event.preventDefault();
4918  });
4919  (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => {
4920    event.preventDefault();
4921
4922    /**
4923     * Do not save the post if post saving is locked.
4924     */
4925    if (isPostSavingLocked()) {
4926      return;
4927    }
4928
4929    // TODO: This should be handled in the `savePost` effect in
4930    // considering `isSaveable`. See note on `isEditedPostSaveable`
4931    // selector about dirtiness and meta-boxes.
4932    //
4933    // See: `isEditedPostSaveable`
4934    if (!isEditedPostDirty()) {
4935      return;
4936    }
4937    savePost();
4938  });
4939  return null;
4940}
4941
4942;// CONCATENATED MODULE: ./packages/editor/build-module/components/autocompleters/index.js
4943
4944
4945;// CONCATENATED MODULE: ./packages/editor/build-module/components/autosave-monitor/index.js
4946/**
4947 * WordPress dependencies
4948 */
4949
4950
4951
4952
4953
4954/**
4955 * Internal dependencies
4956 */
4957
4958
4959/**
4960 * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected.
4961 *
4962 * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
4963 * 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
4964 * the specific way of detecting changes.
4965 *
4966 * There are two caveats:
4967 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
4968 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
4969 */
4970class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
4971  constructor(props) {
4972    super(props);
4973    this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
4974  }
4975  componentDidMount() {
4976    if (!this.props.disableIntervalChecks) {
4977      this.setAutosaveTimer();
4978    }
4979  }
4980  componentDidUpdate(prevProps) {
4981    if (this.props.disableIntervalChecks) {
4982      if (this.props.editsReference !== prevProps.editsReference) {
4983        this.props.autosave();
4984      }
4985      return;
4986    }
4987    if (this.props.interval !== prevProps.interval) {
4988      clearTimeout(this.timerId);
4989      this.setAutosaveTimer();
4990    }
4991    if (!this.props.isDirty) {
4992      this.needsAutosave = false;
4993      return;
4994    }
4995    if (this.props.isAutosaving && !prevProps.isAutosaving) {
4996      this.needsAutosave = false;
4997      return;
4998    }
4999    if (this.props.editsReference !== prevProps.editsReference) {
5000      this.needsAutosave = true;
5001    }
5002  }
5003  componentWillUnmount() {
5004    clearTimeout(this.timerId);
5005  }
5006  setAutosaveTimer(timeout = this.props.interval * 1000) {
5007    this.timerId = setTimeout(() => {
5008      this.autosaveTimerHandler();
5009    }, timeout);
5010  }
5011  autosaveTimerHandler() {
5012    if (!this.props.isAutosaveable) {
5013      this.setAutosaveTimer(1000);
5014      return;
5015    }
5016    if (this.needsAutosave) {
5017      this.needsAutosave = false;
5018      this.props.autosave();
5019    }
5020    this.setAutosaveTimer();
5021  }
5022  render() {
5023    return null;
5024  }
5025}
5026/* harmony default export */ const autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
5027  const {
5028    getReferenceByDistinctEdits
5029  } = select(external_wp_coreData_namespaceObject.store);
5030  const {
5031    isEditedPostDirty,
5032    isEditedPostAutosaveable,
5033    isAutosavingPost,
5034    getEditorSettings
5035  } = select(store_store);
5036  const {
5037    interval = getEditorSettings().autosaveInterval
5038  } = ownProps;
5039  return {
5040    editsReference: getReferenceByDistinctEdits(),
5041    isDirty: isEditedPostDirty(),
5042    isAutosaveable: isEditedPostAutosaveable(),
5043    isAutosaving: isAutosavingPost(),
5044    interval
5045  };
5046}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
5047  autosave() {
5048    const {
5049      autosave = dispatch(store_store).autosave
5050    } = ownProps;
5051    autosave();
5052  }
5053}))])(AutosaveMonitor));
5054
5055;
5055// CONCATENATED MODULE: external ["wp","richText"]
5056const external_wp_richText_namespaceObject = window["wp"]["richText"];
5057// EXTERNAL MODULE: ./node_modules/classnames/index.js
5058var classnames = __webpack_require__(4403);
5059var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
5060;// CONCATENATED MODULE: ./packages/editor/build-module/components/document-outline/item.js
5061
5062/**
5063 * External dependencies
5064 */
5065
5066const TableOfContentsItem = ({
5067  children,
5068  isValid,
5069  level,
5070  href,
5071  onSelect
5072}) => (0,external_wp_element_namespaceObject.createElement)("li", {
5073  className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, {
5074    'is-invalid': !isValid
5075  })
5076}, (0,external_wp_element_namespaceObject.createElement)("a", {
5077  href: href,
5078  className: "document-outline__button",
5079  onClick: onSelect
5080}, (0,external_wp_element_namespaceObject.createElement)("span", {
5081  className: "document-outline__emdash",
5082  "aria-hidden": "true"
5083}), (0,external_wp_element_namespaceObject.createElement)("strong", {
5084  className: "document-outline__level"
5085}, level), (0,external_wp_element_namespaceObject.createElement)("span", {
5086  className: "document-outline__item-content"
5087}, children)));
5088/* harmony default export */ const document_outline_item = (TableOfContentsItem);
5089
5090;// CONCATENATED MODULE: ./packages/editor/build-module/components/document-outline/index.js
5091
5092/**
5093 * WordPress dependencies
5094 */
5095
5096
5097
5098
5099
5100
5101
5102/**
5103 * Internal dependencies
5104 */
5105
5106
5107
5108/**
5109 * Module constants
5110 */
5111const emptyHeadingContent = (0,external_wp_element_namespaceObject.createElement)("em", null, (0,external_wp_i18n_namespaceObject.__)('(Empty heading)'));
5112const incorrectLevelContent = [(0,external_wp_element_namespaceObject.createElement)("br", {
5113  key: "incorrect-break"
5114}), (0,external_wp_element_namespaceObject.createElement)("em", {
5115  key: "incorrect-message"
5116}, (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)'))];
5117const singleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", {
5118  key: "incorrect-break-h1"
5119}), (0,external_wp_element_namespaceObject.createElement)("em", {
5120  key: "incorrect-message-h1"
5121}, (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)'))];
5122const multipleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", {
5123  key: "incorrect-break-multiple-h1"
5124}), (0,external_wp_element_namespaceObject.createElement)("em", {
5125  key: "incorrect-message-multiple-h1"
5126}, (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)'))];
5127
5128/**
5129 * Returns an array of heading blocks enhanced with the following properties:
5130 * level   - An integer with the heading level.
5131 * isEmpty - Flag indicating if the heading has no content.
5132 *
5133 * @param {?Array} blocks An array of blocks.
5134 *
5135 * @return {Array} An array of heading blocks enhanced with the properties described above.
5136 */
5137const computeOutlineHeadings = (blocks = []) => {
5138  return blocks.flatMap((block = {}) => {
5139    if (block.name === 'core/heading') {
5140      return {
5141        ...block,
5142        level: block.attributes.level,
5143        isEmpty: isEmptyHeading(block)
5144      };
5145    }
5146    return computeOutlineHeadings(block.innerBlocks);
5147  });
5148};
5149const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0;
5150const DocumentOutline = ({
5151  blocks = [],
5152  title,
5153  onSelect,
5154  isTitleSupported,
5155  hasOutlineItemsDisabled
5156}) => {
5157  const headings = computeOutlineHeadings(blocks);
5158  const {
5159    selectBlock
5160  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
5161  if (headings.length < 1) {
5162    return null;
5163  }
5164  let prevHeadingLevel = 1;
5165
5166  // Not great but it's the simplest way to locate the title right now.
5167  const titleNode = document.querySelector('.editor-post-title__input');
5168  const hasTitle = isTitleSupported && title && titleNode;
5169  const countByLevel = headings.reduce((acc, heading) => ({
5170    ...acc,
5171    [heading.level]: (acc[heading.level] || 0) + 1
5172  }), {});
5173  const hasMultipleH1 = countByLevel[1] > 1;
5174  return (0,external_wp_element_namespaceObject.createElement)("div", {
5175    className: "document-outline"
5176  }, (0,external_wp_element_namespaceObject.createElement)("ul", null, hasTitle && (0,external_wp_element_namespaceObject.createElement)(document_outline_item, {
5177    level: (0,external_wp_i18n_namespaceObject.__)('Title'),
5178    isValid: true,
5179    onSelect: onSelect,
5180    href: `#${titleNode.id}`,
5181    isDisabled: hasOutlineItemsDisabled
5182  }, title), headings.map((item, index) => {
5183    // Headings remain the same, go up by one, or down by any amount.
5184    // Otherwise there are missing levels.
5185    const isIncorrectLevel = item.level > prevHeadingLevel + 1;
5186    const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
5187    prevHeadingLevel = item.level;
5188    return (0,external_wp_element_namespaceObject.createElement)(document_outline_item, {
5189      key: index,
5190      level: `H${item.level}`,
5191      isValid: isValid,
5192      isDisabled: hasOutlineItemsDisabled,
5193      href: `#block-${item.clientId}`,
5194      onSelect: () => {
5195        selectBlock(item.clientId);
5196        onSelect?.();
5197      }
5198    }, item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({
5199      html: item.attributes.content
5200    })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
5201  })));
5202};
5203/* harmony default export */ const document_outline = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
5204  var _postType$supports$ti;
5205  const {
5206    getBlocks
5207  } = select(external_wp_blockEditor_namespaceObject.store);
5208  const {
5209    getEditedPostAttribute
5210  } = select(store_store);
5211  const {
5212    getPostType
5213  } = select(external_wp_coreData_namespaceObject.store);
5214  const postType = getPostType(getEditedPostAttribute('type'));
5215  return {
5216    title: getEditedPostAttribute('title'),
5217    blocks: getBlocks(),
5218    isTitleSupported: (_postType$supports$ti = postType?.supports?.title) !== null && _postType$supports$ti !== void 0 ? _postType$supports$ti : false
5219  };
5220}))(DocumentOutline));
5221
5222;// CONCATENATED MODULE: ./packages/editor/build-module/components/document-outline/check.js
5223/**
5224 * WordPress dependencies
5225 */
5226
5227
5228function DocumentOutlineCheck({
5229  blocks,
5230  children
5231}) {
5232  const headings = blocks.filter(block => block.name === 'core/heading');
5233  if (headings.length < 1) {
5234    return null;
5235  }
5236  return children;
5237}
5238/* harmony default export */ const check = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
5239  blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
5240}))(DocumentOutlineCheck));
5241
5242;// CONCATENATED MODULE: external ["wp","keycodes"]
5243const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
5244;// CONCATENATED MODULE: ./packages/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
5245
5246/**
5247 * WordPress dependencies
5248 */
5249
5250
5251
5252
5253
5254
5255function EditorKeyboardShortcutsRegister() {
5256  // Registering the shortcuts.
5257  const {
5258    registerShortcut
5259  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
5260  (0,external_wp_element_namespaceObject.useEffect)(() => {
5261    registerShortcut({
5262      name: 'core/editor/save',
5263      category: 'global',
5264      description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
5265      keyCombination: {
5266        modifier: 'primary',
5267        character: 's'
5268      }
5269    });
5270    registerShortcut({
5271      name: 'core/editor/undo',
5272      category: 'global',
5273      description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
5274      keyCombination: {
5275        modifier: 'primary',
5276        character: 'z'
5277      }
5278    });
5279    registerShortcut({
5280      name: 'core/editor/redo',
5281      category: 'global',
5282      description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
5283      keyCombination: {
5284        modifier: 'primaryShift',
5285        character: 'z'
5286      },
5287      // Disable on Apple OS because it conflicts with the browser's
5288      // history shortcut. It's a fine alias for both Windows and Linux.
5289      // Since there's no conflict for Ctrl+Shift+Z on both Windows and
5290      // Linux, we keep it as the default for consistency.
5291      aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{
5292        modifier: 'primary',
5293        character: 'y'
5294      }]
5295    });
5296  }, [registerShortcut]);
5297  return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null);
5298}
5299/* harmony default export */ const register_shortcuts = (EditorKeyboardShortcutsRegister);
5300
5301;// CONCATENATED MODULE: external ["wp","components"]
5302const external_wp_components_namespaceObject = window["wp"]["components"];
5303;// CONCATENATED MODULE: ./packages/icons/build-module/library/redo.js
5304
5305/**
5306 * WordPress dependencies
5307 */
5308
5309const redo_redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5310  xmlns: "http://www.w3.org/2000/svg",
5311  viewBox: "0 0 24 24"
5312}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5313  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"
5314}));
5315/* harmony default export */ const library_redo = (redo_redo);
5316
5317;// CONCATENATED MODULE: ./packages/icons/build-module/library/undo.js
5318
5319/**
5320 * WordPress dependencies
5321 */
5322
5323const undo_undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5324  xmlns: "http://www.w3.org/2000/svg",
5325  viewBox: "0 0 24 24"
5326}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5327  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"
5328}));
5329/* harmony default export */ const library_undo = (undo_undo);
5330
5331;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-history/redo.js
5332
5333/**
5334 * WordPress dependencies
5335 */
5336
5337
5338
5339
5340
5341
5342
5343/**
5344 * Internal dependencies
5345 */
5346
5347function EditorHistoryRedo(props, ref) {
5348  const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
5349  const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []);
5350  const {
5351    redo
5352  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5353  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5354    ...props,
5355    ref: ref,
5356    icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
5357    /* translators: button label text should, if possible, be under 16 characters. */,
5358    label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
5359    shortcut: shortcut
5360    // If there are no redo levels we don't want to actually disable this
5361    // button, because it will remove focus for keyboard users.
5362    // See: https://github.com/WordPress/gutenberg/issues/3486
5363    ,
5364    "aria-disabled": !hasRedo,
5365    onClick: hasRedo ? redo : undefined,
5366    className: "editor-history__redo"
5367  });
5368}
5369/* harmony default export */ const editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo));
5370
5371;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-history/undo.js
5372
5373/**
5374 * WordPress dependencies
5375 */
5376
5377
5378
5379
5380
5381
5382
5383/**
5384 * Internal dependencies
5385 */
5386
5387function EditorHistoryUndo(props, ref) {
5388  const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []);
5389  const {
5390    undo
5391  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5392  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5393    ...props,
5394    ref: ref,
5395    icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
5396    /* translators: button label text should, if possible, be under 16 characters. */,
5397    label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
5398    shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z')
5399    // If there are no undo levels we don't want to actually disable this
5400    // button, because it will remove focus for keyboard users.
5401    // See: https://github.com/WordPress/gutenberg/issues/3486
5402    ,
5403    "aria-disabled": !hasUndo,
5404    onClick: hasUndo ? undo : undefined,
5405    className: "editor-history__undo"
5406  });
5407}
5408/* harmony default export */ const editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo));
5409
5410;// CONCATENATED MODULE: ./packages/editor/build-module/components/template-validation-notice/index.js
5411
5412/**
5413 * WordPress dependencies
5414 */
5415
5416
5417
5418
5419
5420function TemplateValidationNotice({
5421  isValid,
5422  ...props
5423}) {
5424  if (isValid) {
5425    return null;
5426  }
5427  const confirmSynchronization = () => {
5428    if (
5429    // eslint-disable-next-line no-alert
5430    window.confirm((0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?'))) {
5431      props.synchronizeTemplate();
5432    }
5433  };
5434  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
5435    className: "editor-template-validation-notice",
5436    isDismissible: false,
5437    status: "warning",
5438    actions: [{
5439      label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'),
5440      onClick: props.resetTemplateValidity
5441    }, {
5442      label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'),
5443      onClick: confirmSynchronization
5444    }]
5445  }, (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.'));
5446}
5447/* harmony default export */ const template_validation_notice = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
5448  isValid: select(external_wp_blockEditor_namespaceObject.store).isValidTemplate()
5449})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
5450  const {
5451    setTemplateValidity,
5452    synchronizeTemplate
5453  } = dispatch(external_wp_blockEditor_namespaceObject.store);
5454  return {
5455    resetTemplateValidity: () => setTemplateValidity(true),
5456    synchronizeTemplate
5457  };
5458})])(TemplateValidationNotice));
5459
5460;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-notices/index.js
5461
5462/**
5463 * WordPress dependencies
5464 */
5465
5466
5467
5468
5469
5470/**
5471 * Internal dependencies
5472 */
5473
5474function EditorNotices({
5475  notices,
5476  onRemove
5477}) {
5478  const dismissibleNotices = notices.filter(({
5479    isDismissible,
5480    type
5481  }) => isDismissible && type === 'default');
5482  const nonDismissibleNotices = notices.filter(({
5483    isDismissible,
5484    type
5485  }) => !isDismissible && type === 'default');
5486  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
5487    notices: nonDismissibleNotices,
5488    className: "components-editor-notices__pinned"
5489  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
5490    notices: dismissibleNotices,
5491    className: "components-editor-notices__dismissible",
5492    onRemove: onRemove
5493  }, (0,external_wp_element_namespaceObject.createElement)(template_validation_notice, null)));
5494}
5495/* harmony default export */ const editor_notices = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
5496  notices: select(external_wp_notices_namespaceObject.store).getNotices()
5497})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
5498  onRemove: dispatch(external_wp_notices_namespaceObject.store).removeNotice
5499}))])(EditorNotices));
5500
5501;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-snackbars/index.js
5502
5503/**
5504 * WordPress dependencies
5505 */
5506
5507
5508
5509function EditorSnackbars() {
5510  const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []);
5511  const {
5512    removeNotice
5513  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
5514  const snackbarNotices = notices.filter(({
5515    type
5516  }) => type === 'snackbar');
5517  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, {
5518    notices: snackbarNotices,
5519    className: "components-editor-notices__snackbar",
5520    onRemove: removeNotice
5521  });
5522}
5523
5524;
5524// CONCATENATED MODULE: external ["wp","htmlEntities"]
5525const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
5526;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/entity-record-item.js
5527
5528/**
5529 * WordPress dependencies
5530 */
5531
5532
5533
5534
5535
5536
5537/**
5538 * Internal dependencies
5539 */
5540
5541function EntityRecordItem({
5542  record,
5543  checked,
5544  onChange
5545}) {
5546  const {
5547    name,
5548    kind,
5549    title,
5550    key
5551  } = record;
5552
5553  // Handle templates that might use default descriptive titles.
5554  const entityRecordTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
5555    if ('postType' !== kind || 'wp_template' !== name) {
5556      return title;
5557    }
5558    const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key);
5559    return select(store_store).__experimentalGetTemplateInfo(template).title;
5560  }, [name, kind, title, key]);
5561  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
5562    __nextHasNoMarginBottom: true,
5563    label: (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled')),
5564    checked: checked,
5565    onChange: onChange
5566  }));
5567}
5568
5569;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/entity-type-list.js
5570
5571/**
5572 * WordPress dependencies
5573 */
5574
5575
5576
5577
5578
5579/**
5580 * Internal dependencies
5581 */
5582
5583function getEntityDescription(entity, count) {
5584  switch (entity) {
5585    case 'site':
5586      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.');
5587    case 'wp_template':
5588      return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.');
5589    case 'page':
5590    case 'post':
5591      return (0,external_wp_i18n_namespaceObject.__)('The following content has been modified.');
5592  }
5593}
5594function EntityTypeList({
5595  list,
5596  unselectedEntities,
5597  setUnselectedEntities
5598}) {
5599  const count = list.length;
5600  const firstRecord = list[0];
5601  const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
5602  const {
5603    name
5604  } = firstRecord;
5605  let entityLabel = entityConfig.label;
5606  if (name === 'wp_template_part') {
5607    entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts');
5608  }
5609  // Set description based on type of entity.
5610  const description = getEntityDescription(name, count);
5611  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
5612    title: entityLabel,
5613    initialOpen: true
5614  }, description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, description), list.map(record => {
5615    return (0,external_wp_element_namespaceObject.createElement)(EntityRecordItem, {
5616      key: record.key || record.property,
5617      record: record,
5618      checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
5619      onChange: value => setUnselectedEntities(record, value)
5620    });
5621  }));
5622}
5623
5624;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js
5625/**
5626 * WordPress dependencies
5627 */
5628
5629
5630
5631
5632const TRANSLATED_SITE_PROPERTIES = {
5633  title: (0,external_wp_i18n_namespaceObject.__)('Title'),
5634  description: (0,external_wp_i18n_namespaceObject.__)('Tagline'),
5635  site_logo: (0,external_wp_i18n_namespaceObject.__)('Logo'),
5636  site_icon: (0,external_wp_i18n_namespaceObject.__)('Icon'),
5637  show_on_front: (0,external_wp_i18n_namespaceObject.__)('Show on front'),
5638  page_on_front: (0,external_wp_i18n_namespaceObject.__)('Page on front'),
5639  posts_per_page: (0,external_wp_i18n_namespaceObject.__)('Maximum posts per page'),
5640  default_comment_status: (0,external_wp_i18n_namespaceObject.__)('Allow comments on new posts')
5641};
5642const useIsDirty = () => {
5643  const {
5644    editedEntities,
5645    siteEdits
5646  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5647    const {
5648      __experimentalGetDirtyEntityRecords,
5649      getEntityRecordEdits
5650    } = select(external_wp_coreData_namespaceObject.store);
5651    return {
5652      editedEntities: __experimentalGetDirtyEntityRecords(),
5653      siteEdits: getEntityRecordEdits('root', 'site')
5654    };
5655  }, []);
5656  const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => {
5657    // Remove site object and decouple into its edited pieces.
5658    const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site'));
5659    const editedSiteEntities = [];
5660    for (const property in siteEdits) {
5661      editedSiteEntities.push({
5662        kind: 'root',
5663        name: 'site',
5664        title: TRANSLATED_SITE_PROPERTIES[property] || property,
5665        property
5666      });
5667    }
5668    return [...editedEntitiesWithoutSite, ...editedSiteEntities];
5669  }, [editedEntities, siteEdits]);
5670
5671  // Unchecked entities to be ignored by save function.
5672  const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]);
5673  const setUnselectedEntities = ({
5674    kind,
5675    name,
5676    key,
5677    property
5678  }, checked) => {
5679    if (checked) {
5680      _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
5681    } else {
5682      _setUnselectedEntities([...unselectedEntities, {
5683        kind,
5684        name,
5685        key,
5686        property
5687      }]);
5688    }
5689  };
5690  const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
5691  return {
5692    dirtyEntityRecords,
5693    isDirty,
5694    setUnselectedEntities,
5695    unselectedEntities
5696  };
5697};
5698
5699;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/index.js
5700
5701/**
5702 * WordPress dependencies
5703 */
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713/**
5714 * Internal dependencies
5715 */
5716
5717
5718const PUBLISH_ON_SAVE_ENTITIES = [{
5719  kind: 'postType',
5720  name: 'wp_navigation'
5721}];
5722function identity(values) {
5723  return values;
5724}
5725function EntitiesSavedStates({
5726  close
5727}) {
5728  const isDirtyProps = useIsDirty();
5729  return (0,external_wp_element_namespaceObject.createElement)(EntitiesSavedStatesExtensible, {
5730    close: close,
5731    ...isDirtyProps
5732  });
5733}
5734function EntitiesSavedStatesExtensible({
5735  additionalPrompt = undefined,
5736  close,
5737  onSave = identity,
5738  saveEnabled: saveEnabledProp = undefined,
5739  saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'),
5740  dirtyEntityRecords,
5741  isDirty,
5742  setUnselectedEntities,
5743  unselectedEntities
5744}) {
5745  const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)();
5746  const {
5747    editEntityRecord,
5748    saveEditedEntityRecord,
5749    __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
5750  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
5751  const {
5752    __unstableMarkLastChangeAsPersistent
5753  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
5754  const {
5755    createSuccessNotice,
5756    createErrorNotice,
5757    removeNotice
5758  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
5759
5760  // To group entities by type.
5761  const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => {
5762    const {
5763      name
5764    } = record;
5765    if (!acc[name]) {
5766      acc[name] = [];
5767    }
5768    acc[name].push(record);
5769    return acc;
5770  }, {});
5771
5772  // Sort entity groups.
5773  const {
5774    site: siteSavables,
5775    wp_template: templateSavables,
5776    wp_template_part: templatePartSavables,
5777    ...contentSavables
5778  } = partitionedSavables;
5779  const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
5780  const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty;
5781  const saveCheckedEntities = () => {
5782    const saveNoticeId = 'site-editor-save-success';
5783    removeNotice(saveNoticeId);
5784    const entitiesToSave = dirtyEntityRecords.filter(({
5785      kind,
5786      name,
5787      key,
5788      property
5789    }) => {
5790      return !unselectedEntities.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
5791    });
5792    close(entitiesToSave);
5793    const siteItemsToSave = [];
5794    const pendingSavedRecords = [];
5795    entitiesToSave.forEach(({
5796      kind,
5797      name,
5798      key,
5799      property
5800    }) => {
5801      if ('root' === kind && 'site' === name) {
5802        siteItemsToSave.push(property);
5803      } else {
5804        if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
5805          editEntityRecord(kind, name, key, {
5806            status: 'publish'
5807          });
5808        }
5809        pendingSavedRecords.push(saveEditedEntityRecord(kind, name, key));
5810      }
5811    });
5812    if (siteItemsToSave.length) {
5813      pendingSavedRecords.push(saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
5814    }
5815    __unstableMarkLastChangeAsPersistent();
5816    Promise.all(pendingSavedRecords).then(values => {
5817      return onSave(values);
5818    }).then(values => {
5819      if (values.some(value => typeof value === 'undefined')) {
5820        createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.'));
5821      } else {
5822        createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
5823          type: 'snackbar',
5824          id: saveNoticeId
5825        });
5826      }
5827    }).catch(error => createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`));
5828  };
5829
5830  // Explicitly define this with no argument passed.  Using `close` on
5831  // its own will use the event object in place of the expected saved entities.
5832  const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]);
5833  const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
5834    onClose: () => dismissPanel()
5835  });
5836  return (0,external_wp_element_namespaceObject.createElement)("div", {
5837    ref: saveDialogRef,
5838    ...saveDialogProps,
5839    className: "entities-saved-states__panel"
5840  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
5841    className: "entities-saved-states__panel-header",
5842    gap: 2
5843  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
5844    isBlock: true,
5845    as: external_wp_components_namespaceObject.Button,
5846    ref: saveButtonRef,
5847    variant: "primary",
5848    disabled: !saveEnabled,
5849    onClick: saveCheckedEntities,
5850    className: "editor-entities-saved-states__save-button"
5851  }, saveLabel), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
5852    isBlock: true,
5853    as: external_wp_components_namespaceObject.Button,
5854    variant: "secondary",
5855    onClick: dismissPanel
5856  }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)("div", {
5857    className: "entities-saved-states__text-prompt"
5858  }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')), additionalPrompt, isDirty && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
5859    return (0,external_wp_element_namespaceObject.createElement)(EntityTypeList, {
5860      key: list[0].name,
5861      list: list,
5862      unselectedEntities: unselectedEntities,
5863      setUnselectedEntities: setUnselectedEntities
5864    });
5865  }));
5866}
5867
5868;// CONCATENATED MODULE: ./packages/editor/build-module/components/error-boundary/index.js
5869
5870/**
5871 * WordPress dependencies
5872 */
5873
5874
5875
5876
5877
5878
5879
5880
5881/**
5882 * Internal dependencies
5883 */
5884
5885function getContent() {
5886  try {
5887    // While `select` in a component is generally discouraged, it is
5888    // used here because it (a) reduces the chance of data loss in the
5889    // case of additional errors by performing a direct retrieval and
5890    // (b) avoids the performance cost associated with unnecessary
5891    // content serialization throughout the lifetime of a non-erroring
5892    // application.
5893    return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent();
5894  } catch (error) {}
5895}
5896function CopyButton({
5897  text,
5898  children
5899}) {
5900  const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
5901  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5902    variant: "secondary",
5903    ref: ref
5904  }, children);
5905}
5906class ErrorBoundary extends external_wp_element_namespaceObject.Component {
5907  constructor() {
5908    super(...arguments);
5909    this.state = {
5910      error: null
5911    };
5912  }
5913  componentDidCatch(error) {
5914    (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
5915  }
5916  static getDerivedStateFromError(error) {
5917    return {
5918      error
5919    };
5920  }
5921  render() {
5922    const {
5923      error
5924    } = this.state;
5925    if (!error) {
5926      return this.props.children;
5927    }
5928    const actions = [(0,external_wp_element_namespaceObject.createElement)(CopyButton, {
5929      key: "copy-post",
5930      text: getContent
5931    }, (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
5932      key: "copy-error",
5933      text: error.stack
5934    }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))];
5935    return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
5936      className: "editor-error-boundary",
5937      actions: actions
5938    }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
5939  }
5940}
5941/* harmony default export */ const error_boundary = (ErrorBoundary);
5942
5943;// CONCATENATED MODULE: ./packages/editor/build-module/components/local-autosave-monitor/index.js
5944
5945/**
5946 * WordPress dependencies
5947 */
5948
5949
5950
5951
5952
5953
5954
5955/**
5956 * Internal dependencies
5957 */
5958
5959
5960
5961const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
5962let hasStorageSupport;
5963
5964/**
5965 * Function which returns true if the current environment supports browser
5966 * sessionStorage, or false otherwise. The result of this function is cached and
5967 * reused in subsequent invocations.
5968 */
5969const hasSessionStorageSupport = () => {
5970  if (hasStorageSupport !== undefined) {
5971    return hasStorageSupport;
5972  }
5973  try {
5974    // Private Browsing in Safari 10 and earlier will throw an error when
5975    // attempting to set into sessionStorage. The test here is intentional in
5976    // causing a thrown error as condition bailing from local autosave.
5977    window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
5978    window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
5979    hasStorageSupport = true;
5980  } catch {
5981    hasStorageSupport = false;
5982  }
5983  return hasStorageSupport;
5984};
5985
5986/**
5987 * Custom hook which manages the creation of a notice prompting the user to
5988 * restore a local autosave, if one exists.
5989 */
5990function useAutosaveNotice() {
5991  const {
5992    postId,
5993    isEditedPostNew,
5994    hasRemoteAutosave
5995  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5996    postId: select(store_store).getCurrentPostId(),
5997    isEditedPostNew: select(store_store).isEditedPostNew(),
5998    hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave
5999  }), []);
6000  const {
6001    getEditedPostAttribute
6002  } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
6003  const {
6004    createWarningNotice,
6005    removeNotice
6006  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
6007  const {
6008    editPost,
6009    resetEditorBlocks
6010  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6011  (0,external_wp_element_namespaceObject.useEffect)(() => {
6012    let localAutosave = localAutosaveGet(postId, isEditedPostNew);
6013    if (!localAutosave) {
6014      return;
6015    }
6016    try {
6017      localAutosave = JSON.parse(localAutosave);
6018    } catch {
6019      // Not usable if it can't be parsed.
6020      return;
6021    }
6022    const {
6023      post_title: title,
6024      content,
6025      excerpt
6026    } = localAutosave;
6027    const edits = {
6028      title,
6029      content,
6030      excerpt
6031    };
6032    {
6033      // Only display a notice if there is a difference between what has been
6034      // saved and that which is stored in sessionStorage.
6035      const hasDifference = Object.keys(edits).some(key => {
6036        return edits[key] !== getEditedPostAttribute(key);
6037      });
6038      if (!hasDifference) {
6039        // If there is no difference, it can be safely ejected from storage.
6040        localAutosaveClear(postId, isEditedPostNew);
6041        return;
6042      }
6043    }
6044    if (hasRemoteAutosave) {
6045      return;
6046    }
6047    const id = 'wpEditorAutosaveRestore';
6048    createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), {
6049      id,
6050      actions: [{
6051        label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'),
6052        onClick() {
6053          const {
6054            content: editsContent,
6055            ...editsWithoutContent
6056          } = edits;
6057          editPost(editsWithoutContent);
6058          resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content));
6059          removeNotice(id);
6060        }
6061      }]
6062    });
6063  }, [isEditedPostNew, postId]);
6064}
6065
6066/**
6067 * Custom hook which ejects a local autosave after a successful save occurs.
6068 */
6069function useAutosavePurge() {
6070  const {
6071    postId,
6072    isEditedPostNew,
6073    isDirty,
6074    isAutosaving,
6075    didError
6076  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
6077    postId: select(store_store).getCurrentPostId(),
6078    isEditedPostNew: select(store_store).isEditedPostNew(),
6079    isDirty: select(store_store).isEditedPostDirty(),
6080    isAutosaving: select(store_store).isAutosavingPost(),
6081    didError: select(store_store).didPostSaveRequestFail()
6082  }), []);
6083  const lastIsDirty = (0,external_wp_element_namespaceObject.useRef)(isDirty);
6084  const lastIsAutosaving = (0,external_wp_element_namespaceObject.useRef)(isAutosaving);
6085  (0,external_wp_element_namespaceObject.useEffect)(() => {
6086    if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
6087      localAutosaveClear(postId, isEditedPostNew);
6088    }
6089    lastIsDirty.current = isDirty;
6090    lastIsAutosaving.current = isAutosaving;
6091  }, [isDirty, isAutosaving, didError]);
6092
6093  // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
6094  const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew);
6095  const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId);
6096  (0,external_wp_element_namespaceObject.useEffect)(() => {
6097    if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
6098      localAutosaveClear(postId, true);
6099    }
6100  }, [isEditedPostNew, postId]);
6101}
6102function LocalAutosaveMonitor() {
6103  const {
6104    autosave
6105  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6106  const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => {
6107    requestIdleCallback(() => autosave({
6108      local: true
6109    }));
6110  }, []);
6111  useAutosaveNotice();
6112  useAutosavePurge();
6113  const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []);
6114  return (0,external_wp_element_namespaceObject.createElement)(autosave_monitor, {
6115    interval: localAutosaveInterval,
6116    autosave: deferredAutosave
6117  });
6118}
6119/* harmony default export */ const local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor));
6120
6121;// CONCATENATED MODULE: ./packages/editor/build-module/components/page-attributes/check.js
6122/**
6123 * WordPress dependencies
6124 */
6125
6126
6127
6128/**
6129 * Internal dependencies
6130 */
6131
6132function PageAttributesCheck({
6133  children
6134}) {
6135  const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)(select => {
6136    const {
6137      getEditedPostAttribute
6138    } = select(store_store);
6139    const {
6140      getPostType
6141    } = select(external_wp_coreData_namespaceObject.store);
6142    const postType = getPostType(getEditedPostAttribute('type'));
6143    return !!postType?.supports?.['page-attributes'];
6144  }, []);
6145
6146  // Only render fields if post type supports page attributes or available templates exist.
6147  if (!supportsPageAttributes) {
6148    return null;
6149  }
6150  return children;
6151}
6152/* harmony default export */ const page_attributes_check = (PageAttributesCheck);
6153
6154;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-type-support-check/index.js
6155/**
6156 * WordPress dependencies
6157 */
6158
6159
6160
6161/**
6162 * Internal dependencies
6163 */
6164
6165
6166/**
6167 * A component which renders its own children only if the current editor post
6168 * type supports one of the given `supportKeys` prop.
6169 *
6170 * @param {Object}            props             Props.
6171 * @param {WPElement}         props.children    Children to be rendered if post
6172 *                                              type supports.
6173 * @param {(string|string[])} props.supportKeys String or string array of keys
6174 *                                              to test.
6175 *
6176 * @return {WPComponent} The component to be rendered.
6177 */
6178function PostTypeSupportCheck({
6179  children,
6180  supportKeys
6181}) {
6182  const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
6183    const {
6184      getEditedPostAttribute
6185    } = select(store_store);
6186    const {
6187      getPostType
6188    } = select(external_wp_coreData_namespaceObject.store);
6189    return getPostType(getEditedPostAttribute('type'));
6190  }, []);
6191  let isSupported = true;
6192  if (postType) {
6193    isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => !!postType.supports[key]);
6194  }
6195  if (!isSupported) {
6196    return null;
6197  }
6198  return children;
6199}
6200/* harmony default export */ const post_type_support_check = (PostTypeSupportCheck);
6201
6202;// CONCATENATED MODULE: ./packages/editor/build-module/components/page-attributes/order.js
6203
6204/**
6205 * WordPress dependencies
6206 */
6207
6208
6209
6210
6211
6212/**
6213 * Internal dependencies
6214 */
6215
6216
6217function PageAttributesOrder() {
6218  const order = (0,external_wp_data_namespaceObject.useSelect)(select => {
6219    var _select$getEditedPost;
6220    return (_select$getEditedPost = select(store_store).getEditedPostAttribute('menu_order')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 0;
6221  }, []);
6222  const {
6223    editPost
6224  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6225  const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null);
6226  const setUpdatedOrder = value => {
6227    setOrderInput(value);
6228    const newOrder = Number(value);
6229    if (Number.isInteger(newOrder) && value.trim?.() !== '') {
6230      editPost({
6231        menu_order: newOrder
6232      });
6233    }
6234  };
6235  const value = orderInput !== null && orderInput !== void 0 ? orderInput : order;
6236  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
6237    label: (0,external_wp_i18n_namespaceObject.__)('Order'),
6238    value: value,
6239    onChange: setUpdatedOrder,
6240    labelPosition: "side",
6241    onBlur: () => {
6242      setOrderInput(null);
6243    }
6244  })));
6245}
6246function PageAttributesOrderWithChecks() {
6247  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
6248    supportKeys: "page-attributes"
6249  }, (0,external_wp_element_namespaceObject.createElement)(PageAttributesOrder, null));
6250}
6251
6252// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
6253var remove_accents = __webpack_require__(4793);
6254var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
6255;// CONCATENATED MODULE: ./packages/editor/build-module/utils/terms.js
6256/**
6257 * WordPress dependencies
6258 */
6259
6260
6261/**
6262 * Returns terms in a tree form.
6263 *
6264 * @param {Array} flatTerms Array of terms in flat format.
6265 *
6266 * @return {Array} Array of terms in tree format.
6267 */
6268function buildTermsTree(flatTerms) {
6269  const flatTermsWithParentAndChildren = flatTerms.map(term => {
6270    return {
6271      children: [],
6272      parent: null,
6273      ...term
6274    };
6275  });
6276
6277  // All terms should have a `parent` because we're about to index them by it.
6278  if (flatTermsWithParentAndChildren.some(({
6279    parent
6280  }) => parent === null)) {
6281    return flatTermsWithParentAndChildren;
6282  }
6283  const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
6284    const {
6285      parent
6286    } = term;
6287    if (!acc[parent]) {
6288      acc[parent] = [];
6289    }
6290    acc[parent].push(term);
6291    return acc;
6292  }, {});
6293  const fillWithChildren = terms => {
6294    return terms.map(term => {
6295      const children = termsByParent[term.id];
6296      return {
6297        ...term,
6298        children: children && children.length ? fillWithChildren(children) : []
6299      };
6300    });
6301  };
6302  return fillWithChildren(termsByParent['0'] || []);
6303}
6304const unescapeString = arg => {
6305  return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg);
6306};
6307
6308/**
6309 * Returns a term object with name unescaped.
6310 *
6311 * @param {Object} term The term object to unescape.
6312 *
6313 * @return {Object} Term object with name property unescaped.
6314 */
6315const unescapeTerm = term => {
6316  return {
6317    ...term,
6318    name: unescapeString(term.name)
6319  };
6320};
6321
6322/**
6323 * Returns an array of term objects with names unescaped.
6324 * The unescape of each term is performed using the unescapeTerm function.
6325 *
6326 * @param {Object[]} terms Array of term objects to unescape.
6327 *
6328 * @return {Object[]} Array of term objects unescaped.
6329 */
6330const unescapeTerms = terms => {
6331  return (terms !== null && terms !== void 0 ? terms : []).map(unescapeTerm);
6332};
6333
6334;// CONCATENATED MODULE: ./packages/editor/build-module/components/page-attributes/parent.js
6335
6336/**
6337 * External dependencies
6338 */
6339
6340
6341/**
6342 * WordPress dependencies
6343 */
6344
6345
6346
6347
6348
6349
6350
6351
6352/**
6353 * Internal dependencies
6354 */
6355
6356
6357function getTitle(post) {
6358  return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id}
6358 (${(0,external_wp_i18n_namespaceObject.__)('no title')})`;
6359}
6360const getItemPriority = (name, searchValue) => {
6361  const normalizedName = remove_accents_default()(name || '').toLowerCase();
6362  const normalizedSearch = remove_accents_default()(searchValue || '').toLowerCase();
6363  if (normalizedName === normalizedSearch) {
6364    return 0;
6365  }
6366  if (normalizedName.startsWith(normalizedSearch)) {
6367    return normalizedName.length;
6368  }
6369  return Infinity;
6370};
6371function PageAttributesParent() {
6372  const {
6373    editPost
6374  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6375  const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false);
6376  const {
6377    isHierarchical,
6378    parentPostId,
6379    parentPostTitle,
6380    pageItems
6381  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6382    var _pType$hierarchical;
6383    const {
6384      getPostType,
6385      getEntityRecords,
6386      getEntityRecord
6387    } = select(external_wp_coreData_namespaceObject.store);
6388    const {
6389      getCurrentPostId,
6390      getEditedPostAttribute
6391    } = select(store_store);
6392    const postTypeSlug = getEditedPostAttribute('type');
6393    const pageId = getEditedPostAttribute('parent');
6394    const pType = getPostType(postTypeSlug);
6395    const postId = getCurrentPostId();
6396    const postIsHierarchical = (_pType$hierarchical = pType?.hierarchical) !== null && _pType$hierarchical !== void 0 ? _pType$hierarchical : false;
6397    const query = {
6398      per_page: 100,
6399      exclude: postId,
6400      parent_exclude: postId,
6401      orderby: 'menu_order',
6402      order: 'asc',
6403      _fields: 'id,title,parent'
6404    };
6405
6406    // Perform a search when the field is changed.
6407    if (!!fieldValue) {
6408      query.search = fieldValue;
6409    }
6410    const parentPost = pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null;
6411    return {
6412      isHierarchical: postIsHierarchical,
6413      parentPostId: pageId,
6414      parentPostTitle: parentPost ? getTitle(parentPost) : '',
6415      pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null
6416    };
6417  }, [fieldValue]);
6418  const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
6419    const getOptionsFromTree = (tree, level = 0) => {
6420      const mappedNodes = tree.map(treeNode => [{
6421        value: treeNode.id,
6422        label: '— '.repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name),
6423        rawName: treeNode.name
6424      }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
6425      const sortedNodes = mappedNodes.sort(([a], [b]) => {
6426        const priorityA = getItemPriority(a.rawName, fieldValue);
6427        const priorityB = getItemPriority(b.rawName, fieldValue);
6428        return priorityA >= priorityB ? 1 : -1;
6429      });
6430      return sortedNodes.flat();
6431    };
6432    if (!pageItems) {
6433      return [];
6434    }
6435    let tree = pageItems.map(item => ({
6436      id: item.id,
6437      parent: item.parent,
6438      name: getTitle(item)
6439    }));
6440
6441    // Only build a hierarchical tree when not searching.
6442    if (!fieldValue) {
6443      tree = buildTermsTree(tree);
6444    }
6445    const opts = getOptionsFromTree(tree);
6446
6447    // Ensure the current parent is in the options list.
6448    const optsHasParent = opts.find(item => item.value === parentPostId);
6449    if (parentPostTitle && !optsHasParent) {
6450      opts.unshift({
6451        value: parentPostId,
6452        label: parentPostTitle
6453      });
6454    }
6455    return opts;
6456  }, [pageItems, fieldValue, parentPostTitle, parentPostId]);
6457  if (!isHierarchical) {
6458    return null;
6459  }
6460  /**
6461   * Handle user input.
6462   *
6463   * @param {string} inputValue The current value of the input field.
6464   */
6465  const handleKeydown = inputValue => {
6466    setFieldValue(inputValue);
6467  };
6468
6469  /**
6470   * Handle author selection.
6471   *
6472   * @param {Object} selectedPostId The selected Author.
6473   */
6474  const handleChange = selectedPostId => {
6475    editPost({
6476      parent: selectedPostId
6477    });
6478  };
6479  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
6480    __nextHasNoMarginBottom: true,
6481    __next40pxDefaultSize: true,
6482    className: "editor-page-attributes__parent",
6483    label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
6484    value: parentPostId,
6485    options: parentOptions,
6486    onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
6487    onChange: handleChange
6488  });
6489}
6490/* harmony default export */ const page_attributes_parent = (PageAttributesParent);
6491
6492;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-template/index.js
6493
6494/**
6495 * WordPress dependencies
6496 */
6497
6498
6499
6500
6501
6502/**
6503 * Internal dependencies
6504 */
6505
6506function PostTemplate() {
6507  const {
6508    availableTemplates,
6509    selectedTemplate,
6510    isViewable
6511  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6512    var _getPostType$viewable;
6513    const {
6514      getEditedPostAttribute,
6515      getEditorSettings,
6516      getCurrentPostType
6517    } = select(store_store);
6518    const {
6519      getPostType
6520    } = select(external_wp_coreData_namespaceObject.store);
6521    return {
6522      selectedTemplate: getEditedPostAttribute('template'),
6523      availableTemplates: getEditorSettings().availableTemplates,
6524      isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
6525    };
6526  }, []);
6527  const {
6528    editPost
6529  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6530  if (!isViewable || !availableTemplates || !Object.keys(availableTemplates).length) {
6531    return null;
6532  }
6533  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
6534    __nextHasNoMarginBottom: true,
6535    label: (0,external_wp_i18n_namespaceObject.__)('Template:'),
6536    value: selectedTemplate,
6537    onChange: templateSlug => {
6538      editPost({
6539        template: templateSlug || ''
6540      });
6541    },
6542    options: Object.entries(availableTemplates !== null && availableTemplates !== void 0 ? availableTemplates : {}).map(([templateSlug, templateName]) => ({
6543      value: templateSlug,
6544      label: templateName
6545    }))
6546  });
6547}
6548/* harmony default export */ const post_template = (PostTemplate);
6549
6550;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/constants.js
6551const AUTHORS_QUERY = {
6552  who: 'authors',
6553  per_page: 50,
6554  _fields: 'id,name',
6555  context: 'view' // Allows non-admins to perform requests.
6556};
6557
6558;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/combobox.js
6559
6560/**
6561 * WordPress dependencies
6562 */
6563
6564
6565
6566
6567
6568
6569
6570
6571/**
6572 * Internal dependencies
6573 */
6574
6575
6576function PostAuthorCombobox() {
6577  const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)();
6578  const {
6579    authorId,
6580    isLoading,
6581    authors,
6582    postAuthor
6583  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6584    const {
6585      getUser,
6586      getUsers,
6587      isResolving
6588    } = select(external_wp_coreData_namespaceObject.store);
6589    const {
6590      getEditedPostAttribute
6591    } = select(store_store);
6592    const author = getUser(getEditedPostAttribute('author'), {
6593      context: 'view'
6594    });
6595    const query = {
6596      ...AUTHORS_QUERY
6597    };
6598    if (fieldValue) {
6599      query.search = fieldValue;
6600    }
6601    return {
6602      authorId: getEditedPostAttribute('author'),
6603      postAuthor: author,
6604      authors: getUsers(query),
6605      isLoading: isResolving('core', 'getUsers', [query])
6606    };
6607  }, [fieldValue]);
6608  const {
6609    editPost
6610  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6611  const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
6612    const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
6613      return {
6614        value: author.id,
6615        label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
6616      };
6617    });
6618
6619    // Ensure the current author is included in the dropdown list.
6620    const foundAuthor = fetchedAuthors.findIndex(({
6621      value
6622    }) => postAuthor?.id === value);
6623    if (foundAuthor < 0 && postAuthor) {
6624      return [{
6625        value: postAuthor.id,
6626        label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name)
6627      }, ...fetchedAuthors];
6628    }
6629    return fetchedAuthors;
6630  }, [authors, postAuthor]);
6631
6632  /**
6633   * Handle author selection.
6634   *
6635   * @param {number} postAuthorId The selected Author.
6636   */
6637  const handleSelect = postAuthorId => {
6638    if (!postAuthorId) {
6639      return;
6640    }
6641    editPost({
6642      author: postAuthorId
6643    });
6644  };
6645
6646  /**
6647   * Handle user input.
6648   *
6649   * @param {string} inputValue The current value of the input field.
6650   */
6651  const handleKeydown = inputValue => {
6652    setFieldValue(inputValue);
6653  };
6654  if (!postAuthor) {
6655    return null;
6656  }
6657  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
6658    __nextHasNoMarginBottom: true,
6659    __next40pxDefaultSize: true,
6660    label: (0,external_wp_i18n_namespaceObject.__)('Author'),
6661    options: authorOptions,
6662    value: authorId,
6663    onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300),
6664    onChange: handleSelect,
6665    isLoading: isLoading,
6666    allowReset: false
6667  });
6668}
6669/* harmony default export */ const combobox = (PostAuthorCombobox);
6670
6671;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/select.js
6672
6673/**
6674 * WordPress dependencies
6675 */
6676
6677
6678
6679
6680
6681
6682
6683/**
6684 * Internal dependencies
6685 */
6686
6687
6688function PostAuthorSelect() {
6689  const {
6690    editPost
6691  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6692  const {
6693    postAuthor,
6694    authors
6695  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6696    return {
6697      postAuthor: select(store_store).getEditedPostAttribute('author'),
6698      authors: select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY)
6699    };
6700  }, []);
6701  const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
6702    return (authors !== null && authors !== void 0 ? authors : []).map(author => {
6703      return {
6704        value: author.id,
6705        label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
6706      };
6707    });
6708  }, [authors]);
6709  const setAuthorId = value => {
6710    const author = Number(value);
6711    editPost({
6712      author
6713    });
6714  };
6715  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
6716    __nextHasNoMarginBottom: true,
6717    className: "post-author-selector",
6718    label: (0,external_wp_i18n_namespaceObject.__)('Author'),
6719    options: authorOptions,
6720    onChange: setAuthorId,
6721    value: postAuthor
6722  });
6723}
6724/* harmony default export */ const post_author_select = (PostAuthorSelect);
6725
6726;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/index.js
6727
6728/**
6729 * WordPress dependencies
6730 */
6731
6732
6733
6734/**
6735 * Internal dependencies
6736 */
6737
6738
6739
6740const minimumUsersForCombobox = 25;
6741function PostAuthor() {
6742  const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => {
6743    const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
6744    return authors?.length >= minimumUsersForCombobox;
6745  }, []);
6746  if (showCombobox) {
6747    return (0,external_wp_element_namespaceObject.createElement)(combobox, null);
6748  }
6749  return (0,external_wp_element_namespaceObject.createElement)(post_author_select, null);
6750}
6751/* harmony default export */ const post_author = (PostAuthor);
6752
6753;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/check.js
6754
6755/**
6756 * WordPress dependencies
6757 */
6758
6759
6760
6761/**
6762 * Internal dependencies
6763 */
6764
6765
6766
6767function PostAuthorCheck({
6768  children
6769}) {
6770  const {
6771    hasAssignAuthorAction,
6772    hasAuthors
6773  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6774    var _post$_links$wpActio;
6775    const post = select(store_store).getCurrentPost();
6776    const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
6777    return {
6778      hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
6779      hasAuthors: authors?.length >= 1
6780    };
6781  }, []);
6782  if (!hasAssignAuthorAction || !hasAuthors) {
6783    return null;
6784  }
6785  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
6786    supportKeys: "author"
6787  }, children);
6788}
6789
6790;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-comments/index.js
6791
6792/**
6793 * WordPress dependencies
6794 */
6795
6796
6797
6798
6799/**
6800 * Internal dependencies
6801 */
6802
6803function PostComments() {
6804  const commentStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
6805    var _select$getEditedPost;
6806    return (_select$getEditedPost = select(store_store).getEditedPostAttribute('comment_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open';
6807  }, []);
6808  const {
6809    editPost
6810  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6811  const onToggleComments = () => editPost({
6812    comment_status: commentStatus === 'open' ? 'closed' : 'open'
6813  });
6814  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
6815    __nextHasNoMarginBottom: true,
6816    label: (0,external_wp_i18n_namespaceObject.__)('Allow comments'),
6817    checked: commentStatus === 'open',
6818    onChange: onToggleComments
6819  });
6820}
6821/* harmony default export */ const post_comments = (PostComments);
6822
6823;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-excerpt/index.js
6824
6825/**
6826 * WordPress dependencies
6827 */
6828
6829
6830
6831
6832/**
6833 * Internal dependencies
6834 */
6835
6836function PostExcerpt() {
6837  const excerpt = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('excerpt'), []);
6838  const {
6839    editPost
6840  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6841  return (0,external_wp_element_namespaceObject.createElement)("div", {
6842    className: "editor-post-excerpt"
6843  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
6844    __nextHasNoMarginBottom: true,
6845    label: (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (
6845optional)'),
6846    className: "editor-post-excerpt__textarea",
6847    onChange: value => editPost({
6848      excerpt: value
6849    }),
6850    value: excerpt
6851  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
6852    href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt')
6853  }, (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts')));
6854}
6855/* harmony default export */ const post_excerpt = (PostExcerpt);
6856
6857;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-excerpt/check.js
6858
6859/**
6860 * Internal dependencies
6861 */
6862
6863function PostExcerptCheck({
6864  children
6865}) {
6866  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
6867    supportKeys: "excerpt"
6868  }, children);
6869}
6870/* harmony default export */ const post_excerpt_check = (PostExcerptCheck);
6871
6872;// CONCATENATED MODULE: external ["wp","blob"]
6873const external_wp_blob_namespaceObject = window["wp"]["blob"];
6874;// CONCATENATED MODULE: ./packages/editor/build-module/components/theme-support-check/index.js
6875/**
6876 * WordPress dependencies
6877 */
6878
6879
6880
6881/**
6882 * Internal dependencies
6883 */
6884
6885function ThemeSupportCheck({
6886  themeSupports,
6887  children,
6888  postType,
6889  supportKeys
6890}) {
6891  const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
6892    var _themeSupports$key;
6893    const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false;
6894    // 'post-thumbnails' can be boolean or an array of post types.
6895    // In the latter case, we need to verify `postType` exists
6896    // within `supported`. If `postType` isn't passed, then the check
6897    // should fail.
6898    if ('post-thumbnails' === key && Array.isArray(supported)) {
6899      return supported.includes(postType);
6900    }
6901    return supported;
6902  });
6903  if (!isSupported) {
6904    return null;
6905  }
6906  return children;
6907}
6908/* harmony default export */ const theme_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
6909  const {
6910    getThemeSupports
6911  } = select(external_wp_coreData_namespaceObject.store);
6912  const {
6913    getEditedPostAttribute
6914  } = select(store_store);
6915  return {
6916    postType: getEditedPostAttribute('type'),
6917    themeSupports: getThemeSupports()
6918  };
6919})(ThemeSupportCheck));
6920
6921;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-featured-image/check.js
6922
6923/**
6924 * Internal dependencies
6925 */
6926
6927
6928function PostFeaturedImageCheck({
6929  children
6930}) {
6931  return (0,external_wp_element_namespaceObject.createElement)(theme_support_check, {
6932    supportKeys: "post-thumbnails"
6933  }, (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
6934    supportKeys: "thumbnail"
6935  }, children));
6936}
6937/* harmony default export */ const post_featured_image_check = (PostFeaturedImageCheck);
6938
6939;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-featured-image/index.js
6940
6941/**
6942 * WordPress dependencies
6943 */
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954/**
6955 * Internal dependencies
6956 */
6957
6958
6959const ALLOWED_MEDIA_TYPES = ['image'];
6960
6961// Used when labels from post type were not yet loaded or when they are not present.
6962const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image');
6963const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Set featured image');
6964const instructions = (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.'));
6965function getMediaDetails(media, postId) {
6966  var _media$media_details$, _media$media_details$2;
6967  if (!media) {
6968    return {};
6969  }
6970  const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'large', media.id, postId);
6971  if (defaultSize in ((_media$media_details$ = media?.media_details?.sizes) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : {})) {
6972    return {
6973      mediaWidth: media.media_details.sizes[defaultSize].width,
6974      mediaHeight: media.media_details.sizes[defaultSize].height,
6975      mediaSourceUrl: media.media_details.sizes[defaultSize].source_url
6976    };
6977  }
6978
6979  // Use fallbackSize when defaultSize is not available.
6980  const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, postId);
6981  if (fallbackSize in ((_media$media_details$2 = media?.media_details?.sizes) !== null && _media$media_details$2 !== void 0 ? _media$media_details$2 : {})) {
6982    return {
6983      mediaWidth: media.media_details.sizes[fallbackSize].width,
6984      mediaHeight: media.media_details.sizes[fallbackSize].height,
6985      mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url
6986    };
6987  }
6988
6989  // Use full image size when fallbackSize and defaultSize are not available.
6990  return {
6991    mediaWidth: media.media_details.width,
6992    mediaHeight: media.media_details.height,
6993    mediaSourceUrl: media.source_url
6994  };
6995}
6996function PostFeaturedImage({
6997  currentPostId,
6998  featuredImageId,
6999  onUpdateImage,
7000  onRemoveImage,
7001  media,
7002  postType,
7003  noticeUI,
7004  noticeOperations
7005}) {
7006  const toggleRef = (0,external_wp_element_namespaceObject.useRef)();
7007  const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
7008  const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => {
7009    return select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload;
7010  }, []);
7011  const {
7012    mediaWidth,
7013    mediaHeight,
7014    mediaSourceUrl
7015  } = getMediaDetails(media, currentPostId);
7016  function onDropFiles(filesList) {
7017    mediaUpload({
7018      allowedTypes: ['image'],
7019      filesList,
7020      onFileChange([image]) {
7021        if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) {
7022          setIsLoading(true);
7023          return;
7024        }
7025        onUpdateImage(image);
7026        setIsLoading(false);
7027      },
7028      onError(message) {
7029        noticeOperations.removeAllNotices();
7030        noticeOperations.createErrorNotice(message);
7031      }
7032    });
7033  }
7034  return (0,external_wp_element_namespaceObject.createElement)(post_featured_image_check, null, noticeUI, (0,external_wp_element_namespaceObject.createElement)("div", {
7035    className: "editor-post-featured-image"
7036  }, media && (0,external_wp_element_namespaceObject.createElement)("div", {
7037    id: `editor-post-featured-image-${featuredImageId}-describedby`,
7038    className: "hidden"
7039  }, media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
7040  // Translators: %s: The selected image alt text.
7041  (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)(
7042  // Translators: %s: The selected image filename.
7043  (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
7044    fallback: instructions
7045  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
7046    title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
7047    onSelect: onUpdateImage,
7048    unstableFeaturedImageFlow: true,
7049    allowedTypes: ALLOWED_MEDIA_TYPES,
7050    modalClass: "editor-post-featured-image__media-modal",
7051    render: ({
7052      open
7053    }) => (0,external_wp_element_namespaceObject.createElement)("div", {
7054      className: "editor-post-featured-image__container"
7055    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7056      ref: toggleRef,
7057      className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
7058      onClick: open,
7059      "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or replace the image'),
7060      "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
7061    }, !!featuredImageId && media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResponsiveWrapper, {
7062      naturalWidth: mediaWidth,
7063      naturalHeight: mediaHeight,
7064      isInline: true
7065    }, (0,external_wp_element_namespaceObject.createElement)("img", {
7066      src: mediaSourceUrl,
7067      alt: ""
7068    })), isLoading && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), !!featuredImageId && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
7069      className: "editor-post-featured-image__actions"
7070    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7071      className: "editor-post-featured-image__action",
7072      onClick: open
7073      // Prefer that screen readers use the .editor-post-featured-image__preview button.
7074      ,
7075      "aria-hidden": "true"
7076    }, (0,external_wp_i18n_namespaceObject.__)('Replace')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7077      className: "editor-post-featured-image__action",
7078      onClick: () => {
7079        onRemoveImage();
7080        toggleRef.current.focus();
7081      }
7082    }, (0,external_wp_i18n_namespaceObject.__)('Remove'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, {
7083      onFilesDrop: onDropFiles
7084    })),
7085    value: featuredImageId
7086  }))));
7087}
7088const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
7089  const {
7090    getMedia,
7091    getPostType
7092  } = select(external_wp_coreData_namespaceObject.store);
7093  const {
7094    getCurrentPostId,
7095    getEditedPostAttribute
7096  } = select(store_store);
7097  const featuredImageId = getEditedPostAttribute('featured_media');
7098  return {
7099    media: featuredImageId ? getMedia(featuredImageId, {
7100      context: 'view'
7101    }) : null,
7102    currentPostId: getCurrentPostId(),
7103    postType: getPostType(getEditedPostAttribute('type')),
7104    featuredImageId
7105  };
7106});
7107const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
7108  noticeOperations
7109}, {
7110  select
7111}) => {
7112  const {
7113    editPost
7114  } = dispatch(store_store);
7115  return {
7116    onUpdateImage(image) {
7117      editPost({
7118        featured_media: image.id
7119      });
7120    },
7121    onDropImage(filesList) {
7122      select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({
7123        allowedTypes: ['image'],
7124        filesList,
7125        onFileChange([image]) {
7126          editPost({
7127            featured_media: image.id
7128          });
7129        },
7130        onError(message) {
7131          noticeOperations.removeAllNotices();
7132          noticeOperations.createErrorNotice(message);
7133        }
7134      });
7135    },
7136    onRemoveImage() {
7137      editPost({
7138        featured_media: 0
7139      });
7140    }
7141  };
7142});
7143/* harmony default export */ const post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage));
7144
7145;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-format/check.js
7146
7147/**
7148 * WordPress dependencies
7149 */
7150
7151
7152/**
7153 * Internal dependencies
7154 */
7155
7156
7157function PostFormatCheck({
7158  children
7159}) {
7160  const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().disablePostFormats, []);
7161  if (disablePostFormats) {
7162    return null;
7163  }
7164  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
7165    supportKeys: "post-formats"
7166  }, children);
7167}
7168/* harmony default export */ const post_format_check = (PostFormatCheck);
7169
7170;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-format/index.js
7171
7172/**
7173 * WordPress dependencies
7174 */
7175
7176
7177
7178
7179
7180
7181/**
7182 * Internal dependencies
7183 */
7184
7185
7186
7187// All WP post formats, sorted alphabetically by translated name.
7188const POST_FORMATS = [{
7189  id: 'aside',
7190  caption: (0,external_wp_i18n_namespaceObject.__)('Aside')
7191}, {
7192  id: 'audio',
7193  caption: (0,external_wp_i18n_namespaceObject.__)('Audio')
7194}, {
7195  id: 'chat',
7196  caption: (0,external_wp_i18n_namespaceObject.__)('Chat')
7197}, {
7198  id: 'gallery',
7199  caption: (0,external_wp_i18n_namespaceObject.__)('Gallery')
7200}, {
7201  id: 'image',
7202  caption: (0,external_wp_i18n_namespaceObject.__)('Image')
7203}, {
7204  id: 'link',
7205  caption: (0,external_wp_i18n_namespaceObject.__)('Link')
7206}, {
7207  id: 'quote',
7208  caption: (0,external_wp_i18n_namespaceObject.__)('Quote')
7209}, {
7210  id: 'standard',
7211  caption: (0,external_wp_i18n_namespaceObject.__)('Standard')
7212}, {
7213  id: 'status',
7214  caption: (0,external_wp_i18n_namespaceObject.__)('Status')
7215}, {
7216  id: 'video',
7217  caption: (0,external_wp_i18n_namespaceObject.__)('Video')
7218}
7218].sort((a, b) => {
7219  const normalizedA = a.caption.toUpperCase();
7220  const normalizedB = b.caption.toUpperCase();
7221  if (normalizedA < normalizedB) {
7222    return -1;
7223  }
7224  if (normalizedA > normalizedB) {
7225    return 1;
7226  }
7227  return 0;
7228});
7229function PostFormat() {
7230  const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat);
7231  const postFormatSelectorId = `post-format-selector-${instanceId}`;
7232  const {
7233    postFormat,
7234    suggestedFormat,
7235    supportedFormats
7236  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7237    const {
7238      getEditedPostAttribute,
7239      getSuggestedPostFormat
7240    } = select(store_store);
7241    const _postFormat = getEditedPostAttribute('format');
7242    const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports();
7243    return {
7244      postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
7245      suggestedFormat: getSuggestedPostFormat(),
7246      supportedFormats: themeSupports.formats
7247    };
7248  }, []);
7249  const formats = POST_FORMATS.filter(format => {
7250    // Ensure current format is always in the set.
7251    // The current format may not be a format supported by the theme.
7252    return supportedFormats?.includes(format.id) || postFormat === format.id;
7253  });
7254  const suggestion = formats.find(format => format.id === suggestedFormat);
7255  const {
7256    editPost
7257  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7258  const onUpdatePostFormat = format => editPost({
7259    format
7260  });
7261  return (0,external_wp_element_namespaceObject.createElement)(post_format_check, null, (0,external_wp_element_namespaceObject.createElement)("div", {
7262    className: "editor-post-format"
7263  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
7264    __nextHasNoMarginBottom: true,
7265    label: (0,external_wp_i18n_namespaceObject.__)('Post Format'),
7266    value: postFormat,
7267    onChange: format => onUpdatePostFormat(format),
7268    id: postFormatSelectorId,
7269    options: formats.map(format => ({
7270      label: format.caption,
7271      value: format.id
7272    }))
7273  }), suggestion && suggestion.id !== postFormat && (0,external_wp_element_namespaceObject.createElement)("p", {
7274    className: "editor-post-format__suggestion"
7275  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7276    variant: "link",
7277    onClick: () => onUpdatePostFormat(suggestion.id)
7278  }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
7279  (0,external_wp_i18n_namespaceObject.__)('Apply suggested format: %s'), suggestion.caption)))));
7280}
7281
7282;// CONCATENATED MODULE: ./packages/icons/build-module/library/backup.js
7283
7284/**
7285 * WordPress dependencies
7286 */
7287
7288const backup = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
7289  xmlns: "http://www.w3.org/2000/svg",
7290  viewBox: "0 0 24 24"
7291}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
7292  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"
7293}));
7294/* harmony default export */ const library_backup = (backup);
7295
7296;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-last-revision/check.js
7297
7298/**
7299 * WordPress dependencies
7300 */
7301
7302
7303/**
7304 * Internal dependencies
7305 */
7306
7307
7308function PostLastRevisionCheck({
7309  children
7310}) {
7311  const {
7312    lastRevisionId,
7313    revisionsCount
7314  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7315    const {
7316      getCurrentPostLastRevisionId,
7317      getCurrentPostRevisionsCount
7318    } = select(store_store);
7319    return {
7320      lastRevisionId: getCurrentPostLastRevisionId(),
7321      revisionsCount: getCurrentPostRevisionsCount()
7322    };
7323  }, []);
7324  if (!lastRevisionId || revisionsCount < 2) {
7325    return null;
7326  }
7327  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
7328    supportKeys: "revisions"
7329  }, children);
7330}
7331/* harmony default export */ const post_last_revision_check = (PostLastRevisionCheck);
7332
7333;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-last-revision/index.js
7334
7335/**
7336 * WordPress dependencies
7337 */
7338
7339
7340
7341
7342
7343
7344/**
7345 * Internal dependencies
7346 */
7347
7348
7349function LastRevision() {
7350  const {
7351    lastRevisionId,
7352    revisionsCount
7353  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7354    const {
7355      getCurrentPostLastRevisionId,
7356      getCurrentPostRevisionsCount
7357    } = select(store_store);
7358    return {
7359      lastRevisionId: getCurrentPostLastRevisionId(),
7360      revisionsCount: getCurrentPostRevisionsCount()
7361    };
7362  }, []);
7363  return (0,external_wp_element_namespaceObject.createElement)(post_last_revision_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7364    href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', {
7365      revision: lastRevisionId
7366    }),
7367    className: "editor-post-last-revision__title",
7368    icon: library_backup
7369  }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of revisions */
7370  (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
7371}
7372/* harmony default export */ const post_last_revision = (LastRevision);
7373
7374;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-locked-modal/index.js
7375
7376/**
7377 * WordPress dependencies
7378 */
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388/**
7389 * Internal dependencies
7390 */
7391
7392function PostLockedModal() {
7393  const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal);
7394  const hookName = 'core/editor/post-locked-modal-' + instanceId;
7395  const {
7396    autosave,
7397    updatePostLock
7398  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7399  const {
7400    isLocked,
7401    isTakeover,
7402    user,
7403    postId,
7404    postLockUtils,
7405    activePostLock,
7406    postType,
7407    previewLink
7408  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7409    const {
7410      isPostLocked,
7411      isPostLockTakeover,
7412      getPostLockUser,
7413      getCurrentPostId,
7414      getActivePostLock,
7415      getEditedPostAttribute,
7416      getEditedPostPreviewLink,
7417      getEditorSettings
7418    } = select(store_store);
7419    const {
7420      getPostType
7421    } = select(external_wp_coreData_namespaceObject.store);
7422    return {
7423      isLocked: isPostLocked(),
7424      isTakeover: isPostLockTakeover(),
7425      user: getPostLockUser(),
7426      postId: getCurrentPostId(),
7427      postLockUtils: getEditorSettings().postLockUtils,
7428      activePostLock: getActivePostLock(),
7429      postType: getPostType(getEditedPostAttribute('type')),
7430      previewLink: getEditedPostPreviewLink()
7431    };
7432  }, []);
7433  (0,external_wp_element_namespaceObject.useEffect)(() => {
7434    /**
7435     * Keep the lock refreshed.
7436     *
7437     * When the user does not send a heartbeat in a heartbeat-tick
7438     * the user is no longer editing and another user can start editing.
7439     *
7440     * @param {Object} data Data to send in the heartbeat request.
7441     */
7442    function sendPostLock(data) {
7443      if (isLocked) {
7444        return;
7445      }
7446      data['wp-refresh-post-lock'] = {
7447        lock: activePostLock,
7448        post_id: postId
7449      };
7450    }
7451
7452    /**
7453     * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
7454     *
7455     * @param {Object} data Data received in the heartbeat request
7456     */
7457    function receivePostLock(data) {
7458      if (!data['wp-refresh-post-lock']) {
7459        return;
7460      }
7461      const received = data['wp-refresh-post-lock'];
7462      if (received.lock_error) {
7463        // Auto save and display the takeover modal.
7464        autosave();
7465        updatePostLock({
7466          isLocked: true,
7467          isTakeover: true,
7468          user: {
7469            name: received.lock_error.name,
7470            avatar: received.lock_error.avatar_src_2x
7471          }
7472        });
7473      } else if (received.new_lock) {
7474        updatePostLock({
7475          isLocked: false,
7476          activePostLock: received.new_lock
7477        });
7478      }
7479    }
7480
7481    /**
7482     * Unlock the post before the window is exited.
7483     */
7484    function releasePostLock() {
7485      if (isLocked || !activePostLock) {
7486        return;
7487      }
7488      const data = new window.FormData();
7489      data.append('action', 'wp-remove-post-lock');
7490      data.append('_wpnonce', postLockUtils.unlockNonce);
7491      data.append('post_ID', postId);
7492      data.append('active_post_lock', activePostLock);
7493      if (window.navigator.sendBeacon) {
7494        window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
7495      } else {
7496        const xhr = new window.XMLHttpRequest();
7497        xhr.open('POST', postLockUtils.ajaxUrl, false);
7498        xhr.send(data);
7499      }
7500    }
7501
7502    // Details on these events on the Heartbeat API docs
7503    // https://developer.wordpress.org/plugins/javascript/heartbeat-api/
7504    (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock);
7505    (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock);
7506    window.addEventListener('beforeunload', releasePostLock);
7507    return () => {
7508      (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName);
7509      (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName);
7510      window.removeEventListener('beforeunload', releasePostLock);
7511    };
7512  }, []);
7513  if (!isLocked) {
7514    return null;
7515  }
7516  const userDisplayName = user.name;
7517  const userAvatar = user.avatar;
7518  const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
7519    'get-post-lock': '1',
7520    lockKey: true,
7521    post: postId,
7522    action: 'edit',
7523    _wpnonce: postLockUtils.nonce
7524  });
7525  const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
7526    post_type: postType?.slug
7527  });
7528  const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor');
7529  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
7530    title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'),
7531    focusOnMount: true,
7532    shouldCloseOnClickOutside: false,
7533    shouldCloseOnEsc: false,
7534    isDismissible: false,
7535    className: "editor-post-locked-modal"
7536  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
7537    alignment: "top",
7538    spacing: 6
7539  }, !!userAvatar && (0,external_wp_element_namespaceObject.createElement)("img", {
7540    src: userAvatar,
7541    alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'),
7542    className: "editor-post-locked-modal__avatar",
7543    width: 64,
7544    height: 64
7545  }), (0,external_wp_element_namespaceObject.createElement)("div", null, !!isTakeover && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */
7546  (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
7547    strong: (0,external_wp_element_namespaceObject.createElement)("strong", null),
7548    PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7549      href: previewLink
7550    }, (0,external_wp_i18n_namespaceObject.__)('preview'))
7551  })), !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: user's display name */
7552  (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
7553    strong: (0,external_wp_element_namespaceObject.createElement)("strong", null),
7554    PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7555      href: previewLink
7556    }, (0,external_wp_i18n_namespaceObject.__)('preview'))
7557  })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
7558    className: "editor-post-locked-modal__buttons",
7559    justify: "flex-end"
7560  }, !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7561    variant: "tertiary",
7562    href: unlockUrl
7563  }, (0,external_wp_i18n_namespaceObject.__)('Take over')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7564    variant: "primary",
7565    href: allPostsUrl
7566  }, allPostsLabel)))));
7567}
7568
7569;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-pending-status/check.js
7570/**
7571 * WordPress dependencies
7572 */
7573
7574
7575/**
7576 * Internal dependencies
7577 */
7578
7579function PostPendingStatusCheck({
7580  children
7581}) {
7582  const {
7583    hasPublishAction,
7584    isPublished
7585  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7586    var _getCurrentPost$_link;
7587    const {
7588      isCurrentPostPublished,
7589      getCurrentPost
7590    } = select(store_store);
7591    return {
7592      hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
7593      isPublished: isCurrentPostPublished()
7594    };
7595  }, []);
7596  if (isPublished || !hasPublishAction) {
7597    return null;
7598  }
7599  return children;
7600}
7601/* harmony default export */ const post_pending_status_check = (PostPendingStatusCheck);
7602
7603;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-pending-status/index.js
7604
7605/**
7606 * WordPress dependencies
7607 */
7608
7609
7610
7611
7612/**
7613 * Internal dependencies
7614 */
7615
7616
7617function PostPendingStatus() {
7618  const status = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('status'), []);
7619  const {
7620    editPost
7621  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7622  const togglePendingStatus = () => {
7623    const updatedStatus = status === 'pending' ? 'draft' : 'pending';
7624    editPost({
7625      status: updatedStatus
7626    });
7627  };
7628  return (0,external_wp_element_namespaceObject.createElement)(post_pending_status_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
7629    __nextHasNoMarginBottom: true,
7630    label: (0,external_wp_i18n_namespaceObject.__)('Pending review'),
7631    checked: status === 'pending',
7632    onChange: togglePendingStatus
7633  }));
7634}
7635/* harmony default export */ const post_pending_status = (PostPendingStatus);
7636
7637;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-pingbacks/index.js
7638
7639/**
7640 * WordPress dependencies
7641 */
7642
7643
7644
7645
7646/**
7647 * Internal dependencies
7648 */
7649
7650function PostPingbacks() {
7651  const pingStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
7652    var _select$getEditedPost;
7653    return (_select$getEditedPost = select(store_store).getEditedPostAttribute('ping_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open';
7654  }, []);
7655  const {
7656    editPost
7657  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7658  const onTogglePingback = () => editPost({
7659    ping_status: pingStatus === 'open' ? 'closed' : 'open'
7660  });
7661  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
7662    __nextHasNoMarginBottom: true,
7663    label: (0,external_wp_i18n_namespaceObject.__)('Allow pingbacks & trackbacks'),
7664    checked: pingStatus === 'open',
7665    onChange: onTogglePingback
7666  });
7667}
7668/* harmony default export */ const post_pingbacks = (PostPingbacks);
7669
7670;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-preview-button/index.js
7671
7672/**
7673 * WordPress dependencies
7674 */
7675
7676
7677
7678
7679
7680
7681
7682/**
7683 * Internal dependencies
7684 */
7685
7686function writeInterstitialMessage(targetDocument) {
7687  let markup = (0,external_wp_element_namespaceObject.renderToString)((0,external_wp_element_namespaceObject.createElement)("div", {
7688    className: "editor-post-preview-button__interstitial-message"
7689  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
7690    xmlns: "http://www.w3.org/2000/svg",
7691    viewBox: "0 0 96 96"
7692  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
7693    className: "outer",
7694    d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
7695    fill: "none"
7696  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
7697    className: "inner",
7698    d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
7699    fill: "none"
7700  })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Generating preview…'))));
7701  markup += `
7702		<style>
7703			body {
7704				margin: 0;
7705			}
7706			.editor-post-preview-button__interstitial-message {
7707				display: flex;
7708				flex-direction: column;
7709				align-items: center;
7710				justify-content: center;
7711				height: 100vh;
7712				width: 100vw;
7713			}
7714			@-webkit-keyframes paint {
7715				0% {
7716					stroke-dashoffset: 0;
7717				}
7718			}
7719			@-moz-keyframes paint {
7720				0% {
7721					stroke-dashoffset: 0;
7722				}
7723			}
7724			@-o-keyframes paint {
7725				0% {
7726					stroke-dashoffset: 0;
7727				}
7728			}
7729			@keyframes paint {
7730				0% {
7731					stroke-dashoffset: 0;
7732				}
7733			}
7734			.editor-post-preview-button__interstitial-message svg {
7735				width: 192px;
7736				height: 192px;
7737				stroke: #555d66;
7738				stroke-width: 0.75;
7739			}
7740			.editor-post-preview-button__interstitial-message svg .outer,
7741			.editor-post-preview-button__interstitial-message svg .inner {
7742				stroke-dasharray: 280;
7743				stroke-dashoffset: 280;
7744				-webkit-animation: paint 1.5s ease infinite alternate;
7745				-moz-animation: paint 1.5s ease infinite alternate;
7746				-o-animation: paint 1.5s ease infinite alternate;
7747				animation: paint 1.5s ease infinite alternate;
7748			}
7749			p {
7750				text-align: center;
7751				font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
7752			}
7753		</style>
7754	`;
7755
7756  /**
7757   * Filters the interstitial message shown when generating previews.
7758   *
7759   * @param {string} markup The preview interstitial markup.
7760   */
7761  markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup);
7762  targetDocument.write(markup);
7763  targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…');
7764  targetDocument.close();
7765}
7766function PostPreviewButton({
7767  className,
7768  textContent,
7769  forceIsAutosaveable,
7770  role,
7771  onPreview
7772}) {
7773  const {
7774    postId,
7775    currentPostLink,
7776    previewLink,
7777    isSaveable,
7778    isViewable
7779  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7780    var _postType$viewable;
7781    const editor = select(store_store);
7782    const core = select(external_wp_coreData_namespaceObject.store);
7783    const postType = core.getPostType(editor.getCurrentPostType('type'));
7784    return {
7785      postId: editor.getCurrentPostId(),
7786      currentPostLink: editor.getCurrentPostAttribute('link'),
7787      previewLink: editor.getEditedPostPreviewLink(),
7788      isSaveable: editor.isEditedPostSaveable(),
7789      isViewable: (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false
7790    };
7791  }, []);
7792  const {
7793    __unstableSaveForPreview
7794  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7795  if (!isViewable) {
7796    return null;
7797  }
7798  const targetId = `wp-preview-${postId}`;
7799  const openPreviewWindow = async event => {
7800    // Our Preview button has its 'href' and 'target' set correctly for a11y
7801    // purposes. Unfortunately, though, we can't rely on the default 'click'
7802    // handler since sometimes it incorrectly opens a new tab instead of reusing
7803    // the existing one.
7804    // https://github.com/WordPress/gutenberg/pull/8330
7805    event.preventDefault();
7806
7807    // Open up a Preview tab if needed. This is where we'll show the preview.
7808    const previewWindow = window.open('', targetId);
7809
7810    // Focus the Preview tab. This might not do anything, depending on the browser's
7811    // and user's preferences.
7812    // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
7813    previewWindow.focus();
7814    writeInterstitialMessage(previewWindow.document);
7815    const link = await __unstableSaveForPreview({
7816      forceIsAutosaveable
7817    });
7818    previewWindow.location = link;
7819    onPreview?.();
7820  };
7821
7822  // Link to the `?preview=true` URL if we have it, since this lets us see
7823  // changes that were autosaved since the post was last published. Otherwise,
7824  // just link to the post's URL.
7825  const href = previewLink || currentPostLink;
7826  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7827    variant: !className ? 'tertiary' : undefined,
7828    className: className || 'editor-post-preview',
7829    href: href,
7830    target: targetId,
7831    disabled: !isSaveable,
7832    onClick: openPreviewWindow,
7833    role: role
7834  }, textContent || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
7835    as: "span"
7836  }, /* translators: accessibility text */
7837  (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
7838}
7839
7840;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-button/label.js
7841/**
7842 * WordPress dependencies
7843 */
7844
7845
7846
7847
7848/**
7849 * Internal dependencies
7850 */
7851
7852function PublishButtonLabel({
7853  isPublished,
7854  isBeingScheduled,
7855  isSaving,
7856  isPublishing,
7857  hasPublishAction,
7858  isAutosaving,
7859  hasNonPostEntityChanges
7860}) {
7861  if (isPublishing) {
7862    /* translators: button label text should, if possible, be under 16 characters. */
7863    return (0,external_wp_i18n_namespaceObject.__)('Publishing…');
7864  } else if (isPublished && isSaving && !isAutosaving) {
7865    /* translators: button label text should, if possible, be under 16 characters. */
7866    return (0,external_wp_i18n_namespaceObject.__)('Updating…');
7867  } else if (isBeingScheduled && isSaving && !isAutosaving) {
7868    /* translators: button label text should, if possible, be under 16 characters. */
7869    return (0,external_wp_i18n_namespaceObject.__)('Scheduling…');
7870  }
7871  if (!hasPublishAction) {
7872    return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Submit for Review…') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review');
7873  } else if (isPublished) {
7874    return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Update…') : (0,external_wp_i18n_namespaceObject.__)('Update');
7875  } else if (isBeingScheduled) {
7876    return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Schedule');
7877  }
7878  return (0,external_wp_i18n_namespaceObject.__)('Publish');
7879}
7880/* harmony default export */ const label = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7881  var _getCurrentPost$_link;
7882  const {
7883    isCurrentPostPublished,
7884    isEditedPostBeingScheduled,
7885    isSavingPost,
7886    isPublishingPost,
7887    getCurrentPost,
7888    getCurrentPostType,
7889    isAutosavingPost
7890  } = select(store_store);
7891  return {
7892    isPublished: isCurrentPostPublished(),
7893    isBeingScheduled: isEditedPostBeingScheduled(),
7894    isSaving: isSavingPost(),
7895    isPublishing: isPublishingPost(),
7896    hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
7897    postType: getCurrentPostType(),
7898    isAutosaving: isAutosavingPost()
7899  };
7900})])(PublishButtonLabel));
7901
7902;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-button/index.js
7903
7904/**
7905 * External dependencies
7906 */
7907
7908
7909/**
7910 * WordPress dependencies
7911 */
7912
7913
7914
7915
7916
7917
7918/**
7919 * Internal dependencies
7920 */
7921
7922
7923const noop = () => {};
7924class PostPublishButton extends external_wp_element_namespaceObject.Component {
7925  constructor(props) {
7926    super(props);
7927    this.buttonNode = (0,external_wp_element_namespaceObject.createRef)();
7928    this.createOnClick = this.createOnClick.bind(this);
7929    this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this);
7930    this.state = {
7931      entitiesSavedStatesCallback: false
7932    };
7933  }
7934  componentDidMount() {
7935    if (this.props.focusOnMount) {
7936      // This timeout is necessary to make sure the `useEffect` hook of
7937      // `useFocusReturn` gets the correct element (the button that opens the
7938      // PostPublishPanel) otherwise it will get this button.
7939      this.timeoutID = setTimeout(() => {
7940        this.buttonNode.current.focus();
7941      }, 0);
7942    }
7943  }
7944  componentWillUnmount() {
7945    clearTimeout(this.timeoutID);
7946  }
7947  createOnClick(callback) {
7948    return (...args) => {
7949      const {
7950        hasNonPostEntityChanges,
7951        setEntitiesSavedStatesCallback
7952      } = this.props;
7953      // If a post with non-post entities is published, but the user
7954      // elects to not save changes to the non-post entities, those
7955      // entities will still be dirty when the Publish button is clicked.
7956      // We also need to check that the `setEntitiesSavedStatesCallback`
7957      // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
7958      if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) {
7959        // The modal for multiple entity saving will open,
7960        // hold the callback for saving/publishing the post
7961        // so that we can call it if the post entity is checked.
7962        this.setState({
7963          entitiesSavedStatesCallback: () => callback(...args)
7964        });
7965
7966        // Open the save panel by setting its callback.
7967        // To set a function on the useState hook, we must set it
7968        // with another function (() => myFunction). Passing the
7969        // function on its own will cause an error when called.
7970        setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates);
7971        return noop;
7972      }
7973      return callback(...args);
7974    };
7975  }
7976  closeEntitiesSavedStates(savedEntities) {
7977    const {
7978      postType,
7979      postId
7980    } = this.props;
7981    const {
7982      entitiesSavedStatesCallback
7983    } = this.state;
7984    this.setState({
7985      entitiesSavedStatesCallback: false
7986    }, () => {
7987      if (savedEntities && savedEntities.some(elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) {
7988        // The post entity was checked, call the held callback from `createOnClick`.
7989        entitiesSavedStatesCallback();
7990      }
7991    });
7992  }
7993  render() {
7994    const {
7995      forceIsDirty,
7996      hasPublishAction,
7997      isBeingScheduled,
7998      isOpen,
7999      isPostSavingLocked,
8000      isPublishable,
8001      isPublished,
8002      isSaveable,
8003      isSaving,
8004      isAutoSaving,
8005      isToggle,
8006      onSave,
8007      onStatusChange,
8008      onSubmit = noop,
8009      onToggle,
8010      visibility,
8011      hasNonPostEntityChanges,
8012      isSavingNonPostEntityChanges
8013    } = this.props;
8014    const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
8015    const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
8016    let publishStatus;
8017    if (!hasPublishAction) {
8018      publishStatus = 'pending';
8019    } else if (visibility === 'private') {
8020      publishStatus = 'private';
8021    } else if (isBeingScheduled) {
8022      publishStatus = 'future';
8023    } else {
8024      publishStatus = 'publish';
8025    }
8026    const onClickButton = () => {
8027      if (isButtonDisabled) {
8028        return;
8029      }
8030      onSubmit();
8031      onStatusChange(publishStatus);
8032      onSave();
8033    };
8034    const onClickToggle = () => {
8035      if (isToggleDisabled) {
8036        return;
8037      }
8038      onToggle();
8039    };
8040    const buttonProps = {
8041      'aria-disabled': isButtonDisabled,
8042      className: 'editor-post-publish-button',
8043      isBusy: !isAutoSaving && isSaving,
8044      variant: 'primary',
8045      onClick: this.createOnClick(onClickButton)
8046    };
8047    const toggleProps = {
8048      'aria-disabled': isToggleDisabled,
8049      'aria-expanded': isOpen,
8050      className: 'editor-post-publish-panel__toggle',
8051      isBusy: isSaving && isPublished,
8052      variant: 'primary',
8053      onClick: this.createOnClick(onClickToggle)
8054    };
8055    const toggleChildren = isBeingScheduled ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Publish');
8056    const buttonChildren = (0,external_wp_element_namespaceObject.createElement)(label, {
8057      hasNonPostEntityChanges: hasNonPostEntityChanges
8058    });
8059    const componentProps = isToggle ? toggleProps : buttonProps;
8060    const componentChildren = isToggle ? toggleChildren : buttonChildren;
8061    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8062      ref: this.buttonNode,
8063      ...componentProps,
8064      className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', {
8065        'has-changes-dot': hasNonPostEntityChanges
8066      })
8067    }, componentChildren));
8068  }
8069}
8070/* harmony default export */ const post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
8071  var _getCurrentPost$_link;
8072  const {
8073    isSavingPost,
8074    isAutosavingPost,
8075    isEditedPostBeingScheduled,
8076    getEditedPostVisibility,
8077    isCurrentPostPublished,
8078    isEditedPostSaveable,
8079    isEditedPostPublishable,
8080    isPostSavingLocked,
8081    getCurrentPost,
8082    getCurrentPostType,
8083    getCurrentPostId,
8084    hasNonPostEntityChanges,
8085    isSavingNonPostEntityChanges
8086  } = select(store_store);
8087  return {
8088    isSaving: isSavingPost(),
8089    isAutoSaving: isAutosavingPost(),
8090    isBeingScheduled: isEditedPostBeingScheduled(),
8091    visibility: getEditedPostVisibility(),
8092    isSaveable: isEditedPostSaveable(),
8093    isPostSavingLocked: isPostSavingLocked(),
8094    isPublishable: isEditedPostPublishable(),
8095    isPublished: isCurrentPostPublished(),
8096    hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
8097    postType: getCurrentPostType(),
8098    postId: getCurrentPostId(),
8099    hasNonPostEntityChanges: hasNonPostEntityChanges(),
8100    isSavingNonPostEntityChanges: isSavingNonPostEntityChanges()
8101  };
8102}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
8103  const {
8104    editPost,
8105    savePost
8106  } = dispatch(store_store);
8107  return {
8108    onStatusChange: status => editPost({
8109      status
8110    }, {
8111      undoIgnore: true
8112    }),
8113    onSave: savePost
8114  };
8115})])(PostPublishButton));
8116
8117;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js
8118
8119/**
8120 * WordPress dependencies
8121 */
8122
8123const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
8124  xmlns: "http://www.w3.org/2000/svg",
8125  viewBox: "0 0 24 24"
8126}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
8127  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"
8128}));
8129/* harmony default export */ const close_small = (closeSmall);
8130
8131;// CONCATENATED MODULE: ./packages/icons/build-module/library/wordpress.js
8132
8133/**
8134 * WordPress dependencies
8135 */
8136
8137const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
8138  xmlns: "http://www.w3.org/2000/svg",
8139  viewBox: "-2 -2 24 24"
8140}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
8141  d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.
814106-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
8142}));
8143/* harmony default export */ const library_wordpress = (wordpress);
8144
8145;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/utils.js
8146/**
8147 * WordPress dependencies
8148 */
8149
8150const visibilityOptions = {
8151  public: {
8152    label: (0,external_wp_i18n_namespaceObject.__)('Public'),
8153    info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.')
8154  },
8155  private: {
8156    label: (0,external_wp_i18n_namespaceObject.__)('Private'),
8157    info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.')
8158  },
8159  password: {
8160    label: (0,external_wp_i18n_namespaceObject.__)('Password protected'),
8161    info: (0,external_wp_i18n_namespaceObject.__)('Only those with the password can view this post.')
8162  }
8163};
8164
8165;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/index.js
8166
8167/**
8168 * WordPress dependencies
8169 */
8170
8171
8172
8173
8174
8175
8176
8177/**
8178 * Internal dependencies
8179 */
8180
8181
8182function PostVisibility({
8183  onClose
8184}) {
8185  const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility);
8186  const {
8187    status,
8188    visibility,
8189    password
8190  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8191    status: select(store_store).getEditedPostAttribute('status'),
8192    visibility: select(store_store).getEditedPostVisibility(),
8193    password: select(store_store).getEditedPostAttribute('password')
8194  }));
8195  const {
8196    editPost,
8197    savePost
8198  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8199  const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password);
8200  const [showPrivateConfirmDialog, setShowPrivateConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
8201  const setPublic = () => {
8202    editPost({
8203      status: visibility === 'private' ? 'draft' : status,
8204      password: ''
8205    });
8206    setHasPassword(false);
8207  };
8208  const setPrivate = () => {
8209    setShowPrivateConfirmDialog(true);
8210  };
8211  const confirmPrivate = () => {
8212    editPost({
8213      status: 'private',
8214      password: ''
8215    });
8216    setHasPassword(false);
8217    setShowPrivateConfirmDialog(false);
8218    savePost();
8219  };
8220  const handleDialogCancel = () => {
8221    setShowPrivateConfirmDialog(false);
8222  };
8223  const setPasswordProtected = () => {
8224    editPost({
8225      status: visibility === 'private' ? 'draft' : status,
8226      password: password || ''
8227    });
8228    setHasPassword(true);
8229  };
8230  const updatePassword = event => {
8231    editPost({
8232      password: event.target.value
8233    });
8234  };
8235  return (0,external_wp_element_namespaceObject.createElement)("div", {
8236    className: "editor-post-visibility"
8237  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
8238    title: (0,external_wp_i18n_namespaceObject.__)('Visibility'),
8239    help: (0,external_wp_i18n_namespaceObject.__)('Control how this post is viewed.'),
8240    onClose: onClose
8241  }), (0,external_wp_element_namespaceObject.createElement)("fieldset", {
8242    className: "editor-post-visibility__fieldset"
8243  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
8244    as: "legend"
8245  }, (0,external_wp_i18n_namespaceObject.__)('Visibility')), (0,external_wp_element_namespaceObject.createElement)(PostVisibilityChoice, {
8246    instanceId: instanceId,
8247    value: "public",
8248    label: visibilityOptions["public"].label,
8249    info: visibilityOptions["public"].info,
8250    checked: visibility === 'public' && !hasPassword,
8251    onChange: setPublic
8252  }), (0,external_wp_element_namespaceObject.createElement)(PostVisibilityChoice, {
8253    instanceId: instanceId,
8254    value: "private",
8255    label: visibilityOptions["private"].label,
8256    info: visibilityOptions["private"].info,
8257    checked: visibility === 'private',
8258    onChange: setPrivate
8259  }), (0,external_wp_element_namespaceObject.createElement)(PostVisibilityChoice, {
8260    instanceId: instanceId,
8261    value: "password",
8262    label: visibilityOptions.password.label,
8263    info: visibilityOptions.password.info,
8264    checked: hasPassword,
8265    onChange: setPasswordProtected
8266  }), hasPassword && (0,external_wp_element_namespaceObject.createElement)("div", {
8267    className: "editor-post-visibility__password"
8268  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
8269    as: "label",
8270    htmlFor: `editor-post-visibility__password-input-${instanceId}`
8271  }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_wp_element_namespaceObject.createElement)("input", {
8272    className: "editor-post-visibility__password-input",
8273    id: `editor-post-visibility__password-input-${instanceId}`,
8274    type: "text",
8275    onChange: updatePassword,
8276    value: password,
8277    placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password')
8278  }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
8279    isOpen: showPrivateConfirmDialog,
8280    onConfirm: confirmPrivate,
8281    onCancel: handleDialogCancel
8282  }, (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?')));
8283}
8284function PostVisibilityChoice({
8285  instanceId,
8286  value,
8287  label,
8288  info,
8289  ...props
8290}) {
8291  return (0,external_wp_element_namespaceObject.createElement)("div", {
8292    className: "editor-post-visibility__choice"
8293  }, (0,external_wp_element_namespaceObject.createElement)("input", {
8294    type: "radio",
8295    name: `editor-post-visibility__setting-${instanceId}`,
8296    value: value,
8297    id: `editor-post-${value}-${instanceId}`,
8298    "aria-describedby": `editor-post-${value}-${instanceId}-description`,
8299    className: "editor-post-visibility__radio",
8300    ...props
8301  }), (0,external_wp_element_namespaceObject.createElement)("label", {
8302    htmlFor: `editor-post-${value}-${instanceId}`,
8303    className: "editor-post-visibility__label"
8304  }, label), (0,external_wp_element_namespaceObject.createElement)("p", {
8305    id: `editor-post-${value}-${instanceId}-description`,
8306    className: "editor-post-visibility__info"
8307  }, info));
8308}
8309
8310;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/label.js
8311/**
8312 * WordPress dependencies
8313 */
8314
8315
8316/**
8317 * Internal dependencies
8318 */
8319
8320
8321function PostVisibilityLabel() {
8322  return usePostVisibilityLabel();
8323}
8324function usePostVisibilityLabel() {
8325  const visibility = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostVisibility());
8326  return visibilityOptions[visibility]?.label;
8327}
8328
8329;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
8330function _typeof(obj) {
8331  "@babel/helpers - typeof";
8332
8333  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
8334    return typeof obj;
8335  } : function (obj) {
8336    return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8337  }, _typeof(obj);
8338}
8339;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/requiredArgs/index.js
8340function requiredArgs(required, args) {
8341  if (args.length < required) {
8342    throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
8343  }
8344}
8345;// CONCATENATED MODULE: ./node_modules/date-fns/esm/toDate/index.js
8346
8347
8348/**
8349 * @name toDate
8350 * @category Common Helpers
8351 * @summary Convert the given argument to an instance of Date.
8352 *
8353 * @description
8354 * Convert the given argument to an instance of Date.
8355 *
8356 * If the argument is an instance of Date, the function returns its clone.
8357 *
8358 * If the argument is a number, it is treated as a timestamp.
8359 *
8360 * If the argument is none of the above, the function returns Invalid Date.
8361 *
8362 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
8363 *
8364 * @param {Date|Number} argument - the value to convert
8365 * @returns {Date} the parsed date in the local time zone
8366 * @throws {TypeError} 1 argument required
8367 *
8368 * @example
8369 * // Clone the date:
8370 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
8371 * //=> Tue Feb 11 2014 11:30:30
8372 *
8373 * @example
8374 * // Convert the timestamp to date:
8375 * const result = toDate(1392098430000)
8376 * //=> Tue Feb 11 2014 11:30:30
8377 */
8378function toDate(argument) {
8379  requiredArgs(1, arguments);
8380  var argStr = Object.prototype.toString.call(argument);
8381
8382  // Clone the date
8383  if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
8384    // Prevent the date to lose the milliseconds when passed to 
8384new Date() in IE10
8385    return new Date(argument.getTime());
8386  } else if (typeof argument === 'number' || argStr === '[object Number]') {
8387    return new Date(argument);
8388  } else {
8389    if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
8390      // eslint-disable-next-line no-console
8391      console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
8392      // eslint-disable-next-line no-console
8393      console.warn(new Error().stack);
8394    }
8395    return new Date(NaN);
8396  }
8397}
8398;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfMonth/index.js
8399
8400
8401/**
8402 * @name startOfMonth
8403 * @category Month Helpers
8404 * @summary Return the start of a month for the given date.
8405 *
8406 * @description
8407 * Return the start of a month for the given date.
8408 * The result will be in the local timezone.
8409 *
8410 * @param {Date|Number} date - the original date
8411 * @returns {Date} the start of a month
8412 * @throws {TypeError} 1 argument required
8413 *
8414 * @example
8415 * // The start of a month for 2 September 2014 11:55:00:
8416 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
8417 * //=> Mon Sep 01 2014 00:00:00
8418 */
8419function startOfMonth(dirtyDate) {
8420  requiredArgs(1, arguments);
8421  var date = toDate(dirtyDate);
8422  date.setDate(1);
8423  date.setHours(0, 0, 0, 0);
8424  return date;
8425}
8426;// CONCATENATED MODULE: ./node_modules/date-fns/esm/endOfMonth/index.js
8427
8428
8429/**
8430 * @name endOfMonth
8431 * @category Month Helpers
8432 * @summary Return the end of a month for the given date.
8433 *
8434 * @description
8435 * Return the end of a month for the given date.
8436 * The result will be in the local timezone.
8437 *
8438 * @param {Date|Number} date - the original date
8439 * @returns {Date} the end of a month
8440 * @throws {TypeError} 1 argument required
8441 *
8442 * @example
8443 * // The end of a month for 2 September 2014 11:55:00:
8444 * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
8445 * //=> Tue Sep 30 2014 23:59:59.999
8446 */
8447function endOfMonth(dirtyDate) {
8448  requiredArgs(1, arguments);
8449  var date = toDate(dirtyDate);
8450  var month = date.getMonth();
8451  date.setFullYear(date.getFullYear(), month + 1, 0);
8452  date.setHours(23, 59, 59, 999);
8453  return date;
8454}
8455;// CONCATENATED MODULE: ./node_modules/date-fns/esm/constants/index.js
8456/**
8457 * Days in 1 week.
8458 *
8459 * @name daysInWeek
8460 * @constant
8461 * @type {number}
8462 * @default
8463 */
8464var daysInWeek = 7;
8465
8466/**
8467 * Days in 1 year
8468 * One years equals 365.2425 days according to the formula:
8469 *
8470 * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
8471 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
8472 *
8473 * @name daysInYear
8474 * @constant
8475 * @type {number}
8476 * @default
8477 */
8478var daysInYear = 365.2425;
8479
8480/**
8481 * Maximum allowed time.
8482 *
8483 * @name maxTime
8484 * @constant
8485 * @type {number}
8486 * @default
8487 */
8488var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
8489
8490/**
8491 * Milliseconds in 1 minute
8492 *
8493 * @name millisecondsInMinute
8494 * @constant
8495 * @type {number}
8496 * @default
8497 */
8498var millisecondsInMinute = 60000;
8499
8500/**
8501 * Milliseconds in 1 hour
8502 *
8503 * @name millisecondsInHour
8504 * @constant
8505 * @type {number}
8506 * @default
8507 */
8508var millisecondsInHour = 3600000;
8509
8510/**
8511 * Milliseconds in 1 second
8512 *
8513 * @name millisecondsInSecond
8514 * @constant
8515 * @type {number}
8516 * @default
8517 */
8518var millisecondsInSecond = 1000;
8519
8520/**
8521 * Minimum allowed time.
8522 *
8523 * @name minTime
8524 * @constant
8525 * @type {number}
8526 * @default
8527 */
8528var minTime = -maxTime;
8529
8530/**
8531 * Minutes in 1 hour
8532 *
8533 * @name minutesInHour
8534 * @constant
8535 * @type {number}
8536 * @default
8537 */
8538var minutesInHour = 60;
8539
8540/**
8541 * Months in 1 quarter
8542 *
8543 * @name monthsInQuarter
8544 * @constant
8545 * @type {number}
8546 * @default
8547 */
8548var monthsInQuarter = 3;
8549
8550/**
8551 * Months in 1 year
8552 *
8553 * @name monthsInYear
8554 * @constant
8555 * @type {number}
8556 * @default
8557 */
8558var monthsInYear = 12;
8559
8560/**
8561 * Quarters in 1 year
8562 *
8563 * @name quartersInYear
8564 * @constant
8565 * @type {number}
8566 * @default
8567 */
8568var quartersInYear = 4;
8569
8570/**
8571 * Seconds in 1 hour
8572 *
8573 * @name secondsInHour
8574 * @constant
8575 * @type {number}
8576 * @default
8577 */
8578var secondsInHour = 3600;
8579
8580/**
8581 * Seconds in 1 minute
8582 *
8583 * @name secondsInMinute
8584 * @constant
8585 * @type {number}
8586 * @default
8587 */
8588var secondsInMinute = 60;
8589
8590/**
8591 * Seconds in 1 day
8592 *
8593 * @name secondsInDay
8594 * @constant
8595 * @type {number}
8596 * @default
8597 */
8598var secondsInDay = secondsInHour * 24;
8599
8600/**
8601 * Seconds in 1 week
8602 *
8603 * @name secondsInWeek
8604 * @constant
8605 * @type {number}
8606 * @default
8607 */
8608var secondsInWeek = secondsInDay * 7;
8609
8610/**
8611 * Seconds in 1 year
8612 *
8613 * @name secondsInYear
8614 * @constant
8615 * @type {number}
8616 * @default
8617 */
8618var secondsInYear = secondsInDay * daysInYear;
8619
8620/**
8621 * Seconds in 1 month
8622 *
8623 * @name secondsInMonth
8624 * @constant
8625 * @type {number}
8626 * @default
8627 */
8628var secondsInMonth = secondsInYear / 12;
8629
8630/**
8631 * Seconds in 1 quarter
8632 *
8633 * @name secondsInQuarter
8634 * @constant
8635 * @type {number}
8636 * @default
8637 */
8638var secondsInQuarter = secondsInMonth * 3;
8639;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/toInteger/index.js
8640function toInteger(dirtyNumber) {
8641  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
8642    return NaN;
8643  }
8644  var number = Number(dirtyNumber);
8645  if (isNaN(number)) {
8646    return number;
8647  }
8648  return number < 0 ? Math.ceil(number) : Math.floor(number);
8649}
8650;// CONCATENATED MODULE: ./node_modules/date-fns/esm/parseISO/index.js
8651
vendor: 8,192 bytes, lines 8652-8878
8652
8653
8654/**
8655 * @name parseISO
8656 * @category Common Helpers
8657 * @summary Parse ISO string
8658 *
8659 * @description
8660 * Parse the given string in ISO 8601 format and return an instance of Date.
8661 *
8662 * Function accepts complete ISO 8601 formats as well as partial implementations.
8663 * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
8664 *
8665 * If the argument isn't a string, the function cannot parse the string or
8666 * the values are invalid, it returns Invalid Date.
8667 *
8668 * @param {String} argument - the value to convert
8669 * @param {Object} [options] - an object with options.
8670 * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
8671 * @returns {Date} the parsed date in the local time zone
8672 * @throws {TypeError} 1 argument required
8673 * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
8674 *
8675 * @example
8676 * // Convert string '2014-02-11T11:30:30' to date:
8677 * const result = parseISO('2014-02-11T11:30:30')
8678 * //=> Tue Feb 11 2014 11:30:30
8679 *
8680 * @example
8681 * // Convert string '+02014101' to date,
8682 * // if the additional number of digits in the extended year format is 1:
8683 * const result = parseISO('+02014101', { additionalDigits: 1 })
8684 * //=> Fri Apr 11 2014 00:00:00
8685 */
8686function parseISO(argument, options) {
8687  var _options$additionalDi;
8688  requiredArgs(1, arguments);
8689  var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
8690  if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
8691    throw new RangeError('additionalDigits must be 0, 1 or 2');
8692  }
8693  if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
8694    return new Date(NaN);
8695  }
8696  var dateStrings = splitDateString(argument);
8697  var date;
8698  if (dateStrings.date) {
8699    var parseYearResult = parseYear(dateStrings.date, additionalDigits);
8700    date = parseDate(parseYearResult.restDateString, parseYearResult.year);
8701  }
8702  if (!date || isNaN(date.getTime())) {
8703    return new Date(NaN);
8704  }
8705  var timestamp = date.getTime();
8706  var time = 0;
8707  var offset;
8708  if (dateStrings.time) {
8709    time = parseTime(dateStrings.time);
8710    if (isNaN(time)) {
8711      return new Date(NaN);
8712    }
8713  }
8714  if (dateStrings.timezone) {
8715    offset = parseTimezone(dateStrings.timezone);
8716    if (isNaN(offset)) {
8717      return new Date(NaN);
8718    }
8719  } else {
8720    var dirtyDate = new Date(timestamp + time);
8721    // js parsed string assuming it's in UTC timezone
8722    // but we need it to be parsed in our timezone
8723    // so we use utc values to build date in our timezone.
8724    // Year values from 0 to 99 map to the years 1900 to 1999
8725    // so set year explicitly with setFullYear.
8726    var result = new Date(0);
8727    result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
8728    result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
8729    return result;
8730  }
8731  return new Date(timestamp + time + offset);
8732}
8733var patterns = {
8734  dateTimeDelimiter: /[T ]/,
8735  timeZoneDelimiter: /[Z ]/i,
8736  timezone: /([Z+-].*)$/
8737};
8738var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
8739var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
8740var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
8741function splitDateString(dateString) {
8742  var dateStrings = {};
8743  var array = dateString.split(patterns.dateTimeDelimiter);
8744  var timeString;
8745
8746  // The regex match should only return at maximum two array elements.
8747  // [date], [time], or [date, time].
8748  if (array.length > 2) {
8749    return dateStrings;
8750  }
8751  if (/:/.test(array[0])) {
8752    timeString = array[0];
8753  } else {
8754    dateStrings.date = array[0];
8755    timeString = array[1];
8756    if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
8757      dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
8758      timeString = dateString.substr(dateStrings.date.length, dateString.length);
8759    }
8760  }
8761  if (timeString) {
8762    var token = patterns.timezone.exec(timeString);
8763    if (token) {
8764      dateStrings.time = timeString.replace(token[1], '');
8765      dateStrings.timezone = token[1];
8766    } else {
8767      dateStrings.time = timeString;
8768    }
8769  }
8770  return dateStrings;
8771}
8772function parseYear(dateString, additionalDigits) {
8773  var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
8774  var captures = dateString.match(regex);
8775  // Invalid ISO-formatted year
8776  if (!captures) return {
8777    year: NaN,
8778    restDateString: ''
8779  };
8780  var year = captures[1] ? parseInt(captures[1]) : null;
8781  var century = captures[2] ? parseInt(captures[2]) : null;
8782
8783  // either year or century is null, not both
8784  return {
8785    year: century === null ? year : century * 100,
8786    restDateString: dateString.slice((captures[1] || captures[2]).length)
8787  };
8788}
8789function parseDate(dateString, year) {
8790  // Invalid ISO-formatted year
8791  if (year === null) return new Date(NaN);
8792  var captures = dateString.match(dateRegex);
8793  // Invalid ISO-formatted string
8794  if (!captures) return new Date(NaN);
8795  var isWeekDate = !!captures[4];
8796  var dayOfYear = parseDateUnit(captures[1]);
8797  var month = parseDateUnit(captures[2]) - 1;
8798  var day = parseDateUnit(captures[3]);
8799  var week = parseDateUnit(captures[4]);
8800  var dayOfWeek = parseDateUnit(captures[5]) - 1;
8801  if (isWeekDate) {
8802    if (!validateWeekDate(year, week, dayOfWeek)) {
8803      return new Date(NaN);
8804    }
8805    return dayOfISOWeekYear(year, week, dayOfWeek);
8806  } else {
8807    var date = new Date(0);
8808    if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
8809      return new Date(NaN);
8810    }
8811    date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
8812    return date;
8813  }
8814}
8815function parseDateUnit(value) {
8816  return value ? parseInt(value) : 1;
8817}
8818function parseTime(timeString) {
8819  var captures = timeString.match(timeRegex);
8820  if (!captures) return NaN; // Invalid ISO-formatted time
8821
8822  var hours = parseTimeUnit(captures[1]);
8823  var minutes = parseTimeUnit(captures[2]);
8824  var seconds = parseTimeUnit(captures[3]);
8825  if (!validateTime(hours, minutes, seconds)) {
8826    return NaN;
8827  }
8828  return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
8829}
8830function parseTimeUnit(value) {
8831  return value && parseFloat(value.replace(',', '.')) || 0;
8832}
8833function parseTimezone(timezoneString) {
8834  if (timezoneString === 'Z') return 0;
8835  var captures = timezoneString.match(timezoneRegex);
8836  if (!captures) return 0;
8837  var sign = captures[1] === '+' ? -1 : 1;
8838  var hours = parseInt(captures[2]);
8839  var minutes = captures[3] && parseInt(captures[3]) || 0;
8840  if (!validateTimezone(hours, minutes)) {
8841    return NaN;
8842  }
8843  return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
8844}
8845function dayOfISOWeekYear(isoWeekYear, week, day) {
8846  var date = new Date(0);
8847  date.setUTCFullYear(isoWeekYear, 0, 4);
8848  var fourthOfJanuaryDay = date.getUTCDay() || 7;
8849  var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
8850  date.setUTCDate(date.getUTCDate() + diff);
8851  return date;
8852}
8853
8854// Validation functions
8855
8856// February is null to handle the leap year (using ||)
8857var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
8858function isLeapYearIndex(year) {
8859  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
8860}
8861function validateDate(year, month, date) {
8862  return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
8863}
8864function validateDayOfYearDate(year, dayOfYear) {
8865  return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
8866}
8867function validateWeekDate(_year, week, day) {
8868  return week >= 1 && week <= 53 && day >= 0 && day <= 6;
8869}
8870function validateTime(hours, minutes, seconds) {
8871  if (hours === 24) {
8872    return minutes === 0 && seconds === 0;
8873  }
8874  return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
8875}
8876function validateTimezone(_hours, minutes) {
8877  return minutes >= 0 && minutes <= 59;
8878}
8879;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-schedule/index.js
8880
8881/**
8882 * External dependencies
8883 */
8884
8885
8886/**
8887 * WordPress dependencies
8888 */
8889
8890
8891
8892
8893
8894
8895/**
8896 * Internal dependencies
8897 */
8898
8899function PostSchedule({
8900  onClose
8901}) {
8902  const {
8903    postDate,
8904    postType
8905  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8906    postDate: select(store_store).getEditedPostAttribute('date'),
8907    postType: select(store_store).getCurrentPostType()
8908  }), []);
8909  const {
8910    editPost
8911  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8912  const onUpdateDate = date => editPost({
8913    date
8914  });
8915  const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(startOfMonth(new Date(postDate)));
8916
8917  // Pick up published and schduled site posts.
8918  const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, {
8919    status: 'publish,future',
8920    after: startOfMonth(previewedMonth).toISOString(),
8921    before: endOfMonth(previewedMonth).toISOString(),
8922    exclude: [select(store_store).getCurrentPostId()],
8923    per_page: 100,
8924    _fields: 'id,date'
8925  }), [previewedMonth, postType]);
8926  const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(({
8927    date: eventDate
8928  }) => ({
8929    date: new Date(eventDate)
8930  })), [eventsByPostType]);
8931  const settings = (0,external_wp_date_namespaceObject.getSettings)();
8932
8933  // To know if the current timezone is a 12 hour time with look for "a" in the time format
8934  // We also make sure this a is not escaped by a "/"
8935  const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a.
8936  .replace(/\\\\/g, '') // Replace "//" with empty strings.
8937  .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
8938  );
8939
8940  return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPublishDateTimePicker, {
8941    currentDate: postDate,
8942    onChange: onUpdateDate,
8943    is12Hour: is12HourTime,
8944    events: events,
8945    onMonthPreviewed: date => setPreviewedMonth(parseISO(date)),
8946    onClose: onClose
8947  });
8948}
8949
8950;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-schedule/label.js
8951/**
8952 * WordPress dependencies
8953 */
8954
8955
8956
8957
8958/**
8959 * Internal dependencies
8960 */
8961
8962function PostScheduleLabel(props) {
8963  return usePostScheduleLabel(props);
8964}
8965function usePostScheduleLabel({
8966  full = false
8967} = {}) {
8968  const {
8969    date,
8970    isFloating
8971  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8972    date: select(store_store).getEditedPostAttribute('date'),
8973    isFloating: select(store_store).isEditedPostDateFloating()
8974  }), []);
8975  return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, {
8976    isFloating
8977  });
8978}
8979function getFullPostScheduleLabel(dateAttribute) {
8980  const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute);
8981  const timezoneAbbreviation = getTimezoneAbbreviation();
8982  const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)(
8983  // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
8984  (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
8985  return (0,external_wp_i18n_namespaceObject.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
8986}
8987function getPostScheduleLabel(dateAttribute, {
8988  isFloating = false,
8989  now = new Date()
8990} = {}) {
8991  if (!dateAttribute || isFloating) {
8992    return (0,external_wp_i18n_namespaceObject.__)('Immediately');
8993  }
8994
8995  // If the user timezone does not equal the site timezone then using words
8996  // like 'tomorrow' is confusing, so show the full date.
8997  if (!isTimezoneSameAsSiteTimezone(now)) {
8998    return getFullPostScheduleLabel(dateAttribute);
8999  }
9000  const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute);
9001  if (isSameDay(date, now)) {
9002    return (0,external_wp_i18n_namespaceObject.sprintf)(
9003    // translators: %s: Time of day the post is scheduled for.
9004    (0,external_wp_i18n_namespaceObject.__)('Today at %s'),
9005    // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
9006    (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date));
9007  }
9008  const tomorrow = new Date(now);
9009  tomorrow.setDate(tomorrow.getDate() + 1);
9010  if (isSameDay(date, tomorrow)) {
9011    return (0,external_wp_i18n_namespaceObject.sprintf)(
9012    // translators: %s: Time of day the post is scheduled for.
9013    (0,external_wp_i18n_namespaceObject.__)('Tomorrow at %s'),
9014    // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
9015    (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date));
9016  }
9017  if (date.getFullYear() === now.getFullYear()) {
9018    return (0,external_wp_date_namespaceObject.dateI18n)(
9019    // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
9020    (0,external_wp_i18n_namespaceObject._x)('F j g:i\xa0a', 'post schedule date format without year'), date);
9021  }
9022  return (0,external_wp_date_namespaceObject.dateI18n)(
9023  // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
9024  (0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
9025}
9026function getTimezoneAbbreviation() {
9027  const {
9028    timezone
9029  } = (0,external_wp_date_namespaceObject.getSettings)();
9030  if (timezone.abbr && isNaN(Number(timezone.abbr))) {
9031    return timezone.abbr;
9032  }
9033  const symbol = timezone.offset < 0 ? '' : '+';
9034  return `UTC${symbol}${timezone.offset}`;
9035}
9036function isTimezoneSameAsSiteTimezone(date) {
9037  const {
9038    timezone
9039  } = (0,external_wp_date_namespaceObject.getSettings)();
9040  const siteOffset = Number(timezone.offset);
9041  const dateOffset = -1 * (date.getTimezoneOffset() / 60);
9042  return siteOffset === dateOffset;
9043}
9044function isSameDay(left, right) {
9045  return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
9046}
9047
9048;
9048// CONCATENATED MODULE: external ["wp","a11y"]
9049const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
9050;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/most-used-terms.js
9051
9052/**
9053 * WordPress dependencies
9054 */
9055
9056
9057
9058
9059/**
9060 * Internal dependencies
9061 */
9062
9063const MIN_MOST_USED_TERMS = 3;
9064const DEFAULT_QUERY = {
9065  per_page: 10,
9066  orderby: 'count',
9067  order: 'desc',
9068  hide_empty: true,
9069  _fields: 'id,name,count',
9070  context: 'view'
9071};
9072function MostUsedTerms({
9073  onSelect,
9074  taxonomy
9075}) {
9076  const {
9077    _terms,
9078    showTerms
9079  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9080    const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY);
9081    return {
9082      _terms: mostUsedTerms,
9083      showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS
9084    };
9085  }, [taxonomy.slug]);
9086  if (!showTerms) {
9087    return null;
9088  }
9089  const terms = unescapeTerms(_terms);
9090  return (0,external_wp_element_namespaceObject.createElement)("div", {
9091    className: "editor-post-taxonomies__flat-term-most-used"
9092  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
9093    as: "h3",
9094    className: "editor-post-taxonomies__flat-term-most-used-label"
9095  }, taxonomy.labels.most_used), (0,external_wp_element_namespaceObject.createElement)("ul", {
9096    role: "list",
9097    className: "editor-post-taxonomies__flat-term-most-used-list"
9098  }, terms.map(term => (0,external_wp_element_namespaceObject.createElement)("li", {
9099    key: term.id
9100  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9101    variant: "link",
9102    onClick: () => onSelect(term)
9103  }, term.name)))));
9104}
9105
9106;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/flat-term-selector.js
9107
9108/**
9109 * WordPress dependencies
9110 */
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120/**
9121 * Internal dependencies
9122 */
9123
9124
9125
9126
9127/**
9128 * Shared reference to an empty array for cases where it is important to avoid
9129 * returning a new array reference on every invocation.
9130 *
9131 * @type {Array<any>}
9132 */
9133const EMPTY_ARRAY = [];
9134
9135/**
9136 * Module constants
9137 */
9138const MAX_TERMS_SUGGESTIONS = 20;
9139const flat_term_selector_DEFAULT_QUERY = {
9140  per_page: MAX_TERMS_SUGGESTIONS,
9141  _fields: 'id,name',
9142  context: 'view'
9143};
9144const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
9145const termNamesToIds = (names, terms) => {
9146  return names.map(termName => terms.find(term => isSameTermName(term.name, termName)).id);
9147};
9148function FlatTermSelector({
9149  slug
9150}) {
9151  var _taxonomy$labels$add_, _taxonomy$labels$sing2;
9152  const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]);
9153  const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
9154  const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500);
9155  const {
9156    terms,
9157    termIds,
9158    taxonomy,
9159    hasAssignAction,
9160    hasCreateAction,
9161    hasResolvedTerms
9162  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9163    var _post$_links, _post$_links2;
9164    const {
9165      getCurrentPost,
9166      getEditedPostAttribute
9167    } = select(store_store);
9168    const {
9169      getEntityRecords,
9170      getTaxonomy,
9171      hasFinishedResolution
9172    } = select(external_wp_coreData_namespaceObject.store);
9173    const post = getCurrentPost();
9174    const _taxonomy = getTaxonomy(slug);
9175    const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : EMPTY_ARRAY;
9176    const query = {
9177      ...flat_term_selector_DEFAULT_QUERY,
9178      include: _termIds.join(','),
9179      per_page: -1
9180    };
9181    return {
9182      hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
9183      hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
9184      taxonomy: _taxonomy,
9185      termIds: _termIds,
9186      terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
9187      hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
9188    };
9189  }, [slug]);
9190  const {
9191    searchResults
9192  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9193    const {
9194      getEntityRecords
9195    } = select(external_wp_coreData_namespaceObject.store);
9196    return {
9197      searchResults: !!search ? getEntityRecords('taxonomy', slug, {
9198        ...flat_term_selector_DEFAULT_QUERY,
9199        search
9200      }) : EMPTY_ARRAY
9201    };
9202  }, [search, slug]);
9203
9204  // Update terms state only after the selectors are resolved.
9205  // We're using this to avoid terms temporarily disappearing on slow networks
9206  // while core data makes REST API requests.
9207  (0,external_wp_element_namespaceObject.useEffect)(() => {
9208    if (hasResolvedTerms) {
9209      const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name));
9210      setValues(newValues);
9211    }
9212  }, [terms, hasResolvedTerms]);
9213  const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
9214    return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name));
9215  }, [searchResults]);
9216  const {
9217    editPost
9218  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
9219  const {
9220    saveEntityRecord
9221  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
9222  const {
9223    createErrorNotice
9224  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
9225  if (!hasAssignAction) {
9226    return null;
9227  }
9228  async function findOrCreateTerm(term) {
9229    try {
9230      const newTerm = await saveEntityRecord('taxonomy', slug, term, {
9231        throwOnError: true
9232      });
9233      return unescapeTerm(newTerm);
9234    } catch (error) {
9235      if (error.code !== 'term_exists') {
9236        throw error;
9237      }
9238      return {
9239        id: error.data.term_id,
9240        name: term.name
9241      };
9242    }
9243  }
9244  function onUpdateTerms(newTermIds) {
9245    editPost({
9246      [taxonomy.rest_base]: newTermIds
9247    });
9248  }
9249  function onChange(termNames) {
9250    const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
9251    const uniqueTerms = termNames.reduce((acc, name) => {
9252      if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
9253        acc.push(name);
9254      }
9255      return acc;
9256    }, []);
9257    const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName)));
9258
9259    // Optimistically update term values.
9260    // The selector will always re-fetch terms later.
9261    setValues(uniqueTerms);
9262    if (newTermNames.length === 0) {
9263      return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
9264    }
9265    if (!hasCreateAction) {
9266      return;
9267    }
9268    Promise.all(newTermNames.map(termName => findOrCreateTerm({
9269      name: termName
9270    }
9270))).then(newTerms => {
9271      const newAvailableTerms = availableTerms.concat(newTerms);
9272      return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
9273    }).catch(error => {
9274      createErrorNotice(error.message, {
9275        type: 'snackbar'
9276      });
9277    });
9278  }
9279  function appendTerm(newTerm) {
9280    var _taxonomy$labels$sing;
9281    if (termIds.includes(newTerm.id)) {
9282      return;
9283    }
9284    const newTermIds = [...termIds, newTerm.id];
9285    const defaultName = slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term');
9286    const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
9287    (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName);
9288    (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
9289    onUpdateTerms(newTermIds);
9290  }
9291  const newTermLabel = (_taxonomy$labels$add_ = taxonomy?.labels?.add_new_item) !== null && _taxonomy$labels$add_ !== void 0 ? _taxonomy$labels$add_ : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term');
9292  const singularName = (_taxonomy$labels$sing2 = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing2 !== void 0 ? _taxonomy$labels$sing2 : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term');
9293  const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
9294  (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName);
9295  const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
9296  (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName);
9297  const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
9298  (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName);
9299  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
9300    __next40pxDefaultSize: true,
9301    value: values,
9302    suggestions: suggestions,
9303    onChange: onChange,
9304    onInputChange: debouncedSearch,
9305    maxSuggestions: MAX_TERMS_SUGGESTIONS,
9306    label: newTermLabel,
9307    messages: {
9308      added: termAddedLabel,
9309      removed: termRemovedLabel,
9310      remove: removeTermLabel
9311    }
9312  }), (0,external_wp_element_namespaceObject.createElement)(MostUsedTerms, {
9313    taxonomy: taxonomy,
9314    onSelect: appendTerm
9315  }));
9316}
9317/* harmony default export */ const flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector));
9318
9319;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
9320
9321/**
9322 * WordPress dependencies
9323 */
9324
9325
9326
9327
9328
9329
9330
9331/**
9332 * Internal dependencies
9333 */
9334
9335
9336const TagsPanel = () => {
9337  const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9338    className: "editor-post-publish-panel__link",
9339    key: "label"
9340  }, (0,external_wp_i18n_namespaceObject.__)('Add tags'))];
9341  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9342    initialOpen: false,
9343    title: panelBodyTitle
9344  }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), (0,external_wp_element_namespaceObject.createElement)(flat_term_selector, {
9345    slug: 'post_tag'
9346  }));
9347};
9348class MaybeTagsPanel extends external_wp_element_namespaceObject.Component {
9349  constructor(props) {
9350    super(props);
9351    this.state = {
9352      hadTagsWhenOpeningThePanel: props.hasTags
9353    };
9354  }
9355
9356  /*
9357   * We only want to show the tag panel if the post didn't have
9358   * any tags when the user hit the Publish button.
9359   *
9360   * We can't use the prop.hasTags because it'll change to true
9361   * if the user adds a new tag within the pre-publish panel.
9362   * This would force a re-render and a new prop.hasTags check,
9363   * hiding this panel and keeping the user from adding
9364   * more than one tag.
9365   */
9366  render() {
9367    if (!this.state.hadTagsWhenOpeningThePanel) {
9368      return (0,external_wp_element_namespaceObject.createElement)(TagsPanel, null);
9369    }
9370    return null;
9371  }
9372}
9373/* harmony default export */ const maybe_tags_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
9374  const postType = select(store_store).getCurrentPostType();
9375  const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag');
9376  const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base);
9377  return {
9378    areTagsFetched: tagsTaxonomy !== undefined,
9379    isPostTypeSupported: tagsTaxonomy && tagsTaxonomy.types.some(type => type === postType),
9380    hasTags: tags && tags.length
9381  };
9382}), (0,external_wp_compose_namespaceObject.ifCondition)(({
9383  areTagsFetched,
9384  isPostTypeSupported
9385}) => isPostTypeSupported && areTagsFetched))(MaybeTagsPanel));
9386
9387;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
9388
9389/**
9390 * WordPress dependencies
9391 */
9392
9393
9394
9395
9396
9397/**
9398 * Internal dependencies
9399 */
9400
9401
9402const getSuggestion = (supportedFormats, suggestedPostFormat) => {
9403  const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id));
9404  return formats.find(format => format.id === suggestedPostFormat);
9405};
9406const PostFormatSuggestion = ({
9407  suggestedPostFormat,
9408  suggestionText,
9409  onUpdatePostFormat
9410}) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9411  variant: "link",
9412  onClick: () => onUpdatePostFormat(suggestedPostFormat)
9413}, suggestionText);
9414function PostFormatPanel() {
9415  const {
9416    currentPostFormat,
9417    suggestion
9418  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9419    var _select$getThemeSuppo;
9420    const {
9421      getEditedPostAttribute,
9422      getSuggestedPostFormat
9423    } = select(store_store);
9424    const supportedFormats = (_select$getThemeSuppo = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats) !== null && _select$getThemeSuppo !== void 0 ? _select$getThemeSuppo : [];
9425    return {
9426      currentPostFormat: getEditedPostAttribute('format'),
9427      suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat())
9428    };
9429  }, []);
9430  const {
9431    editPost
9432  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
9433  const onUpdatePostFormat = format => editPost({
9434    format
9435  });
9436  const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9437    className: "editor-post-publish-panel__link",
9438    key: "label"
9439  }, (0,external_wp_i18n_namespaceObject.__)('Use a post format'))];
9440  if (!suggestion || suggestion.id === currentPostFormat) {
9441    return null;
9442  }
9443  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9444    initialOpen: false,
9445    title: panelBodyTitle
9446  }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(PostFormatSuggestion, {
9447    onUpdatePostFormat: onUpdatePostFormat,
9448    suggestedPostFormat: suggestion.id,
9449    suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post format */
9450    (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption)
9451  })));
9452}
9453
9454;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
9455
9456/**
9457 * WordPress dependencies
9458 */
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469/**
9470 * Internal dependencies
9471 */
9472
9473
9474
9475/**
9476 * Module Constants
9477 */
9478const hierarchical_term_selector_DEFAULT_QUERY = {
9479  per_page: -1,
9480  orderby: 'name',
9481  order: 'asc',
9482  _fields: 'id,name,parent',
9483  context: 'view'
9484};
9485const MIN_TERMS_COUNT_FOR_FILTER = 8;
9486const hierarchical_term_selector_EMPTY_ARRAY = [];
9487
9488/**
9489 * Sort Terms by Selected.
9490 *
9491 * @param {Object[]} termsTree Array of terms in tree format.
9492 * @param {number[]} terms     Selected terms.
9493 *
9494 * @return {Object[]} Sorted array of terms.
9495 */
9496function sortBySelected(termsTree, terms) {
9497  const treeHasSelection = termTree => {
9498    if (terms.indexOf(termTree.id) !== -1) {
9499      return true;
9500    }
9501    if (undefined === termTree.children) {
9502      return false;
9503    }
9504    return termTree.children.map(treeHasSelection).filter(child => child).length > 0;
9505  };
9506  const termOrChildIsSelected = (termA, termB) => {
9507    const termASelected = treeHasSelection(termA);
9508    const termBSelected = treeHasSelection(termB);
9509    if (termASelected === termBSelected) {
9510      return 0;
9511    }
9512    if (termASelected && !termBSelected) {
9513      return -1;
9514    }
9515    if (!termASelected && termBSelected) {
9516      return 1;
9517    }
9518    return 0;
9519  };
9520  const newTermTree = [...termsTree];
9521  newTermTree.sort(termOrChildIsSelected);
9522  return newTermTree;
9523}
9524
9525/**
9526 * Find term by parent id or name.
9527 *
9528 * @param {Object[]}      terms  Array of Terms.
9529 * @param {number|string} parent id.
9530 * @param {string}        name   Term name.
9531 * @return {Object} Term object.
9532 */
9533function findTerm(terms, parent, name) {
9534  return terms.find(term => {
9535    return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
9536  });
9537}
9538
9539/**
9540 * Get filter matcher function.
9541 *
9542 * @param {string} filterValue Filter value.
9543 * @return {(function(Object): (Object|boolean))} Matcher function.
9544 */
9545function getFilterMatcher(filterValue) {
9546  const matchTermsForFilter = originalTerm => {
9547    if ('' === filterValue) {
9548      return originalTerm;
9549    }
9550
9551    // Shallow clone, because we'll be filtering the term's children and
9552    // don't want to modify the original term.
9553    const term = {
9554      ...originalTerm
9555    };
9556
9557    // Map and filter the children, recursive so we deal with grandchildren
9558    // and any deeper levels.
9559    if (term.children.length > 0) {
9560      term.children = term.children.map(matchTermsForFilter).filter(child => child);
9561    }
9562
9563    // If the term's name contains the filterValue, or it has children
9564    // (i.e. some child matched at some point in the tree) then return it.
9565    if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
9566      return term;
9567    }
9568
9569    // Otherwise, return false. After mapping, the list of terms will need
9570    // to have false values filtered out.
9571    return false;
9572  };
9573  return matchTermsForFilter;
9574}
9575
9576/**
9577 * Hierarchical term selector.
9578 *
9579 * @param {Object} props      Component props.
9580 * @param {string} props.slug Taxonomy slug.
9581 * @return {WPElement}        Hierarchical term selector component.
9582 */
9583function HierarchicalTermSelector({
9584  slug
9585}) {
9586  var _taxonomy$labels$sear, _taxonomy$name;
9587  const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false);
9588  const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)('');
9589  /**
9590   * @type {[number|'', Function]}
9591   */
9592  const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)('');
9593  const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false);
9594  const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
9595  const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]);
9596  const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
9597  const {
9598    hasCreateAction,
9599    hasAssignAction,
9600    terms,
9601    loading,
9602    availableTerms,
9603    taxonomy
9604  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9605    var _post$_links, _post$_links2;
9606    const {
9607      getCurrentPost,
9608      getEditedPostAttribute
9609    } = select(store_store);
9610    const {
9611      getTaxonomy,
9612      getEntityRecords,
9613      isResolving
9614    } = select(external_wp_coreData_namespaceObject.store);
9615    const _taxonomy = getTaxonomy(slug);
9616    const post = getCurrentPost();
9617    return {
9618      hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
9619      hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
9620      terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY,
9621      loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]),
9622      availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY,
9623      taxonomy: _taxonomy
9624    };
9625  }, [slug]);
9626  const {
9627    editPost
9628  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
9629  const {
9630    saveEntityRecord
9631  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
9632  const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms),
9633  // Remove `terms` from the dependency list to avoid reordering every time
9634  // checking or unchecking a term.
9635  [availableTerms]);
9636  const {
9637    createErrorNotice
9638  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
9639  if (!hasAssignAction) {
9640    return null;
9641  }
9642
9643  /**
9644   * Append new term.
9645   *
9646   * @param {Object} term Term object.
9647   * @return {Promise} A promise that resolves to save term object.
9648   */
9649  const addTerm = term => {
9650    return saveEntityRecord('taxonomy', slug, term, {
9651      throwOnError: true
9652    });
9653  };
9654
9655  /**
9656   * Update terms for post.
9657   *
9658   * @param {number[]} termIds Term ids.
9659   */
9660  const onUpdateTerms = termIds => {
9661    editPost({
9662      [taxonomy.rest_base]: termIds
9663    });
9664  };
9665
9666  /**
9667   * Handler for checking term.
9668   *
9669   * @param {number} termId
9670   */
9671  const onChange = termId => {
9672    const hasTerm = terms.includes(termId);
9673    const newTerms = hasTerm ? terms.filter(id => id !== termId) : [...terms, termId];
9674    onUpdateTerms(newTerms);
9675  };
9676  const onChangeFormName = value => {
9677    setFormName(value);
9678  };
9679
9680  /**
9681   * Handler for changing form parent.
9682   *
9683   * @param {number|''} parentId Parent post id.
9684   */
9685  const onChangeFormParent = parentId => {
9686    setFormParent(parentId);
9687  };
9688  const onToggleForm = () => {
9689    setShowForm(!showForm);
9690  };
9691  const onAddTerm = async event => {
9692    var _taxonomy$labels$sing;
9693    event.preventDefault();
9694    if (formName === '' || adding) {
9695      return;
9696    }
9697
9698    // Check if the term we are adding already exists.
9699    const existingTerm = findTerm(availableTerms, formParent, formName);
9700    if (existingTerm) {
9701      // If the term we are adding exists but is not selected select it.
9702      if (!terms.some(term => term === existingTerm.id)) {
9703        onUpdateTerms([...terms, existingTerm.id]);
9704      }
9705      setFormName('');
9706      setFormParent('');
9707      return;
9708    }
9709    setAdding(true);
9710    let newTerm;
9711    try {
9712      newTerm = await addTerm({
9713        name: formName,
9714        parent: formParent ? formParent : undefined
9715      });
9716    } catch (error) {
9717      createErrorNotice(error.message, {
9718        type: 'snackbar'
9719      });
9720      return;
9721    }
9722    const defaultName = slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term');
9723    const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: taxonomy name */
9724    (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName);
9725    (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
9726    setAdding(false);
9727    setFormName('');
9728    setFormParent('');
9729    onUpdateTerms([...terms, newTerm.id]);
9730  };
9731  const setFilter = value => {
9732    const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term);
9733    const getResultCount = termsTree => {
9734      let count = 0;
9735      for (let i = 0; i < termsTree.length; i++) {
9736        count++;
9737        if (undefined !== termsTree[i].children) {
9738          count += getResultCount(termsTree[i].children);
9739        }
9740      }
9741      return count;
9742    };
9743    setFilterValue(value);
9744    setFilteredTermsTree(newFilteredTermsTree);
9745    const resultCount = getResultCount(newFilteredTermsTree);
9746    const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results */
9747    (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount);
9748    debouncedSpeak(resultsFoundMessage, 'assertive');
9749  };
9750  const renderTerms = renderedTerms => {
9751    return renderedTerms.map(term => {
9752      return (0,external_wp_element_namespaceObject.createElement)("div", {
9753        key: term.id,
9754        className: "editor-post-taxonomies__hierarchical-terms-choice"
9755      }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
9756        __nextHasNoMarginBottom: true,
9757        checked: terms.indexOf(term.id) !== -1,
9758        onChange: () => {
9759          const termId = parseInt(term.id, 10);
9760          onChange(termId);
9761        },
9762        label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name)
9763      }), !!term.children.length && (0,external_wp_element_namespaceObject.createElement)("div", {
9764        className: "editor-post-taxonomies__hierarchical-terms-subchoices"
9765      }, renderTerms(term.children)));
9766    });
9767  };
9768  const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => {
9769    var _taxonomy$labels$labe;
9770    return (_taxonomy$labels$labe = taxonomy?.labels?.[labelProperty]) !== null && _taxonomy$labels$labe !== void 0 ? _taxonomy$labels$labe : slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory;
9771  };
9772  const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
9773  const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
9774  const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term'));
9775  const noParentOption = `— ${parentSelectLabel} —`;
9776  const newTermSubmitLabel = newTermButtonLabel;
9777  const filterLabel = (_taxonomy$labels$sear = taxonomy?.labels?.search_items) !== null && _taxonomy$labels$sear !== void 0 ? _taxonomy$labels$sear : (0,external_wp_i18n_namespaceObject.__)('Search Terms');
9778  const groupLabel = (_taxonomy$name = taxonomy?.name) !== null && _taxonomy$name !== void 0 ? _taxonomy$name : (0,external_wp_i18n_namespaceObject.__)('Terms');
9779  const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
9780  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
9781    direction: "column",
9782    gap: "4"
9783  }, showFilter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
9784    __nextHasNoMarginBottom: true,
9785    label: filterLabel,
9786    value: filterValue,
9787    onChange: setFilter
9788  }), (0,external_wp_element_namespaceObject.createElement)("div", {
9789    className: "editor-post-taxonomies__hierarchical-terms-list",
9790    tabIndex: "0",
9791    role: "group",
9792    "aria-label": groupLabel
9793  }, renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9794    onClick: onToggleForm,
9795    className: "editor-post-taxonomies__hierarchical-terms-add",
9796    "aria-expanded": showForm,
9797    variant: "link"
9798  }, newTermButtonLabel)), showForm && (0,external_wp_element_namespaceObject.createElement)("form", {
9799    onSubmit: onAddTerm
9800  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
9801    direction: "column",
9802    gap: "4"
9803  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
9804    __nextHasNoMarginBottom: true,
9805    className: "editor-post-taxonomies__hierarchical-terms-input",
9806    label: newTermLabel,
9807    value: formName,
9808    onChange: onChangeFormName,
9809    required: true
9810  }), !!availableTerms.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TreeSelect, {
9811    __nextHasNoMarginBottom: true,
9812    label: parentSelectLabel,
9813    noOptionLabel: noParentOption,
9814    onChange: onChangeFormParent,
9815    selectedId: formParent,
9816    tree: availableTermsTree
9817  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9818    variant: "secondary",
9819    type: "submit",
9820    className: "editor-post-taxonomies__hierarchical-terms-submit"
9821  }, newTermSubmitLabel)))));
9822}
9823/* harmony default export */ const hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector));
9824
9825;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-category-panel.js
9826
9827/**
9828 * WordPress dependencies
9829 */
9830
9831
9832
9833
9834
9835
9836/**
9837 * Internal dependencies
9838 */
9839
9840
9841function MaybeCategoryPanel() {
9842  const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => {
9843    const postType = select(store_store).getCurrentPostType();
9844    const {
9845      canUser,
9846      getEntityRecord,
9847      getTaxonomy
9848    } = select(external_wp_coreData_namespaceObject.store);
9849    const categoriesTaxonomy = getTaxonomy('category');
9850    const defaultCategoryId = canUser('read', 'settings') ? getEntityRecord('root', 'site')?.default_category : undefined;
9851    const defaultCategory = defaultCategoryId ? getEntityRecord('taxonomy', 'category', defaultCategoryId) : undefined;
9852    const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some(type => type === postType);
9853    const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base);
9854
9855    // This boolean should return true if everything is loaded
9856    // ( categoriesTaxonomy, defaultCategory )
9857    // and the post has not been assigned a category different than "uncategorized".
9858    return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]);
9859  }, []);
9860  const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false);
9861  (0,external_wp_element_namespaceObject.useEffect)(() => {
9862    // We use state to avoid hiding the panel if the user edits the categories
9863    // and adds one within the panel itself (while visible).
9864    if (hasNoCategory) {
9865      setShouldShowPanel(true);
9866    }
9867  }, [hasNoCategory]);
9868  if (!shouldShowPanel) {
9869    return null;
9870  }
9871  const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9872    className: "editor-post-publish-panel__link",
9873    key: "label"
9874  }, (0,external_wp_i18n_namespaceObject.__)('Assign a category'))];
9875  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9876    initialOpen: false,
9877    title: panelBodyTitle
9878  }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')), (0,external_wp_element_namespaceObject.createElement)(hierarchical_term_selector, {
9879    slug: "category"
9880  }));
9881}
9882/* harmony default export */ const maybe_category_panel = (MaybeCategoryPanel);
9883
9884;// CONCATENATED MODULE: ./packages/icons/build-module/library/upload.js
9885
9886/**
9887 * WordPress dependencies
9888 */
9889
9890const upload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
9891  xmlns: "http://www.w3.org/2000/svg",
9892  viewBox: "0 0 24 24"
9893}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
9894  d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
9895}));
9896/* harmony default export */ const library_upload = (upload);
9897
9898;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-upload-media.js
9899
9900/**
9901 * WordPress dependencies
9902 */
9903
9904
9905
9906
9907
9908
9909
9910
9911/**
9912 * Internal dependencies
9913 */
9914
9915function flattenBlocks(blocks) {
9916  const result = [];
9917  blocks.forEach(block => {
9918    result.push(block);
9919    result.push(...flattenBlocks(block.innerBlocks));
9920  });
9921  return result;
9922}
9923function Image(block) {
9924  const {
9925    selectBlock
9926  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
9927  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
9928    tabIndex: 0,
9929    role: "button",
9930    "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select image block.'),
9931    onClick: () => {
9932      selectBlock(block.clientId);
9933    },
9934    onKeyDown: event => {
9935      if (event.key === 'Enter' || event.key === ' ') {
9936        selectBlock(block.clientId);
9937        event.preventDefault();
9938      }
9939    },
9940    key: block.clientId,
9941    alt: block.attributes.alt,
9942    src: block.attributes.url,
9943    animate: {
9944      opacity: 1
9945    },
9946    exit: {
9947      opacity: 0,
9948      scale: 0
9949    },
9950    style: {
9951      width: '36px',
9952      height: '36px',
9953      objectFit: 'cover',
9954      borderRadius: '2px',
9955      cursor: 'pointer'
9956    },
9957    whileHover: {
9958      scale: 1.08
9959    }
9960  });
9961}
9962function maybe_upload_media_PostFormatPanel() {
9963  const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false);
9964  const {
9965    editorBlocks,
9966    mediaUpload
9967  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
9968    editorBlocks: select(store_store).getEditorBlocks(),
9969    mediaUpload: select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload
9970  }), []);
9971  const externalImages = flattenBlocks(editorBlocks).filter(block => block.name === 'core/image' && block.attributes.url && !block.attributes.id);
9972  const {
9973    updateBlockAttributes
9974  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
9975  if (!mediaUpload || !externalImages.length) {
9976    return null;
9977  }
9978  const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9979    className: "editor-post-publish-panel__link",
9980    key: "label"
9981  }, (0,external_wp_i18n_namespaceObject.__)('External media'))];
9982  function uploadImages() {
9983    setIsUploading(true);
9984    Promise.all(externalImages.map(image => window.fetch(image.attributes.url.includes('?') ? image.attributes.url : image.attributes.url + '?').then(response => response.blob()).then(blob => new Promise((resolve, reject) => {
9985      mediaUpload({
9986        filesList: [blob],
9987        onFileChange: ([media]) => {
9988          if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
9989            return;
9990          }
9991          updateBlockAttributes(image.clientId, {
9992            id: media.id,
9993            url: media.url
9994          });
9995          resolve();
9996        },
9997        onError() {
9998          reject();
9999        }
10000      });
10001    })))).finally(() => {
10002      setIsUploading(false);
10003    });
10004  }
10005  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
10006    initialOpen: true,
10007    title: panelBodyTitle
10008  }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('There are some external images in the post which can be uploaded to the media library. Images coming from different domains may not always display correctly, load slowly for visitors, or be removed unexpectedly.')), (0,external_wp_element_namespaceObject.createElement)("div", {
10009    style: {
10010      display: 'inline-flex',
10011      flexWrap: 'wrap',
10012      gap: '8px'
10013    }
10014  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableAnimatePresence, null, externalImages.map(image => {
10015    return (0,external_wp_element_namespaceObject.createElement)(Image, {
10016      key: image.clientId,
10017      ...image
10018    });
10019  })), isUploading ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10020    icon: library_upload,
10021    variant: "primary",
10022    onClick: uploadImages
10023  }, (0,external_wp_i18n_namespaceObject.__)('Upload all'))));
10024}
10025
10026;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/prepublish.js
10027
10028/**
10029 * WordPress dependencies
10030 */
10031
10032
10033
10034
10035
10036
10037
10038
10039/**
10040 * Internal dependencies
10041 */
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051function PostPublishPanelPrepublish({
10052  children
10053}) {
10054  const {
10055    isBeingScheduled,
10056    isRequestingSiteIcon,
10057    hasPublishAction,
10058    siteIconUrl,
10059    siteTitle,
10060    siteHome
10061  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
10062    var _getCurrentPost$_link;
10063    const {
10064      getCurrentPost,
10065      isEditedPostBeingScheduled
10066    } = select(store_store);
10067    const {
10068      getEntityRecord,
10069      isResolving
10070    } = select(external_wp_coreData_namespaceObject.store);
10071    const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
10072    return {
10073      hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
10074      isBeingScheduled: isEditedPostBeingScheduled(),
10075      isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
10076      siteIconUrl: siteData.site_icon_url,
10077      siteTitle: siteData.name,
10078      siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home)
10079    };
10080  }, []);
10081  let siteIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
10082    className: "components-site-icon",
10083    size: "36px",
10084    icon: library_wordpress
10085  });
10086  if (siteIconUrl) {
10087    siteIcon = (0,external_wp_element_namespaceObject.createElement)("img", {
10088      alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
10089      className: "components-site-icon",
10090      src: siteIconUrl
10091    });
10092  }
10093  if (isRequestingSiteIcon) {
10094    siteIcon = null;
10095  }
10096  let prePublishTitle, prePublishBodyText;
10097  if (!hasPublishAction) {
10098    prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?');
10099    prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.');
10100  } else if (isBeingScheduled) {
10101    prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?');
10102    prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.');
10103  } else {
10104    prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?');
10105    prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.');
10106  }
10107  return (0,external_wp_element_namespaceObject.createElement)("div", {
10108    className: "editor-post-publish-panel__prepublish"
10109  }, (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("strong", null, prePublishTitle)), (0,external_wp_element_namespaceObject.createElement)("p", null, prePublishBodyText), (0,external_wp_element_namespaceObject.createElement)("div", {
10110    className: "components-site-card"
10111  }, siteIcon, (0,external_wp_element_namespaceObject.createElement)("div", {
10112    className: "components-site-info"
10113  }, (0,external_wp_element_namespaceObject.createElement)("span", {
10114    className: "components-site-name"
10115  }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')), (0,external_wp_element_namespaceObject.createElement)("span", {
10116    className: "components-site-home"
10117  }, siteHome))), (0,external_wp_element_namespaceObject.createElement)(maybe_upload_media_PostFormatPanel, null), hasPublishAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
10118    initialOpen: false,
10119    title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), (0,external_wp_element_namespaceObject.createElement)("span", {
10120      className: "editor-post-publish-panel__link",
10121      key: "label"
10122    }, (0,external_wp_element_namespaceObject.createElement)(PostVisibilityLabel, null))]
10123  }, (0,external_wp_element_namespaceObject.createElement)(PostVisibility, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
10124    initialOpen: false,
10125    title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), (0,external_wp_element_namespaceObject.createElement)("span", {
10126      className: "editor-post-publish-panel__link",
10127      key: "label"
10128    }, (0,external_wp_element_namespaceObject.createElement)(PostScheduleLabel, null))]
10129  }, (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null))), (0,external_wp_element_namespaceObject.createElement)(PostFormatPanel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_tags_panel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_category_panel, null), children);
10130}
10131/* harmony default export */ const prepublish = (PostPublishPanelPrepublish);
10132
10133;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/postpublish.js
10134
10135/**
10136 * WordPress dependencies
10137 */
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147/**
10148 * Internal dependencies
10149 */
10150
10151
10152const POSTNAME = '%postname%';
10153const PAGENAME = '%pagename%';
10154
10155/**
10156 * Returns URL for a future post.
10157 *
10158 * @param {Object} post Post object.
10159 *
10160 * @return {string} PostPublish URL.
10161 */
10162
10163const getFuturePostUrl = post => {
10164  const {
10165    slug
10166  }
10166 = post;
10167  if (post.permalink_template.includes(POSTNAME)) {
10168    return post.permalink_template.replace(POSTNAME, slug);
10169  }
10170  if (post.permalink_template.includes(PAGENAME)) {
10171    return post.permalink_template.replace(PAGENAME, slug);
10172  }
10173  return post.permalink_template;
10174};
10175function postpublish_CopyButton({
10176  text,
10177  onCopy,
10178  children
10179}) {
10180  const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy);
10181  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10182    variant: "secondary",
10183    ref: ref
10184  }, children);
10185}
10186class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component {
10187  constructor() {
10188    super(...arguments);
10189    this.state = {
10190      showCopyConfirmation: false
10191    };
10192    this.onCopy = this.onCopy.bind(this);
10193    this.onSelectInput = this.onSelectInput.bind(this);
10194    this.postLink = (0,external_wp_element_namespaceObject.createRef)();
10195  }
10196  componentDidMount() {
10197    if (this.props.focusOnMount) {
10198      this.postLink.current.focus();
10199    }
10200  }
10201  componentWillUnmount() {
10202    clearTimeout(this.dismissCopyConfirmation);
10203  }
10204  onCopy() {
10205    this.setState({
10206      showCopyConfirmation: true
10207    });
10208    clearTimeout(this.dismissCopyConfirmation);
10209    this.dismissCopyConfirmation = setTimeout(() => {
10210      this.setState({
10211        showCopyConfirmation: false
10212      });
10213    }, 4000);
10214  }
10215  onSelectInput(event) {
10216    event.target.select();
10217  }
10218  render() {
10219    const {
10220      children,
10221      isScheduled,
10222      post,
10223      postType
10224    } = this.props;
10225    const postLabel = postType?.labels?.singular_name;
10226    const viewPostLabel = postType?.labels?.view_item;
10227    const addNewPostLabel = postType?.labels?.add_new_item;
10228    const link = post.status === 'future' ? getFuturePostUrl(post) : post.link;
10229    const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
10230      post_type: post.type
10231    });
10232    const postPublishNonLinkHeader = isScheduled ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', (0,external_wp_element_namespaceObject.createElement)(PostScheduleLabel, null), ".") : (0,external_wp_i18n_namespaceObject.__)('is now live.');
10233    return (0,external_wp_element_namespaceObject.createElement)("div", {
10234      className: "post-publish-panel__postpublish"
10235    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
10236      className: "post-publish-panel__postpublish-header"
10237    }, (0,external_wp_element_namespaceObject.createElement)("a", {
10238      ref: this.postLink,
10239      href: link
10240    }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')), ' ', postPublishNonLinkHeader), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)("p", {
10241      className: "post-publish-panel__postpublish-subheader"
10242    }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('What’s next?'))), (0,external_wp_element_namespaceObject.createElement)("div", {
10243      className: "post-publish-panel__postpublish-post-address-container"
10244    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
10245      __nextHasNoMarginBottom: true,
10246      className: "post-publish-panel__postpublish-post-address",
10247      readOnly: true,
10248      label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: post type singular name */
10249      (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel),
10250      value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link),
10251      onFocus: this.onSelectInput
10252    }), (0,external_wp_element_namespaceObject.createElement)("div", {
10253      className: "post-publish-panel__postpublish-post-address__copy-button-wrap"
10254    }, (0,external_wp_element_namespaceObject.createElement)(postpublish_CopyButton, {
10255      text: link,
10256      onCopy: this.onCopy
10257    }, this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')))), (0,external_wp_element_namespaceObject.createElement)("div", {
10258      className: "post-publish-panel__postpublish-buttons"
10259    }, !isScheduled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10260      variant: "primary",
10261      href: link
10262    }, viewPostLabel), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10263      variant: isScheduled ? 'primary' : 'secondary',
10264      href: addLink
10265    }, addNewPostLabel))), children);
10266  }
10267}
10268/* harmony default export */ const postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => {
10269  const {
10270    getEditedPostAttribute,
10271    getCurrentPost,
10272    isCurrentPostScheduled
10273  } = select(store_store);
10274  const {
10275    getPostType
10276  } = select(external_wp_coreData_namespaceObject.store);
10277  return {
10278    post: getCurrentPost(),
10279    postType: getPostType(getEditedPostAttribute('type')),
10280    isScheduled: isCurrentPostScheduled()
10281  };
10282})(PostPublishPanelPostpublish));
10283
10284;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/index.js
10285
10286/**
10287 * WordPress dependencies
10288 */
10289
10290
10291
10292
10293
10294
10295
10296
10297/**
10298 * Internal dependencies
10299 */
10300
10301
10302
10303
10304class PostPublishPanel extends external_wp_element_namespaceObject.Component {
10305  constructor() {
10306    super(...arguments);
10307    this.onSubmit = this.onSubmit.bind(this);
10308  }
10309  componentDidUpdate(prevProps) {
10310    // Automatically collapse the publish sidebar when a post
10311    // is published and the user makes an edit.
10312    if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) {
10313      this.props.onClose();
10314    }
10315  }
10316  onSubmit() {
10317    const {
10318      onClose,
10319      hasPublishAction,
10320      isPostTypeViewable
10321    } = this.props;
10322    if (!hasPublishAction || !isPostTypeViewable) {
10323      onClose();
10324    }
10325  }
10326  render() {
10327    const {
10328      forceIsDirty,
10329      isBeingScheduled,
10330      isPublished,
10331      isPublishSidebarEnabled,
10332      isScheduled,
10333      isSaving,
10334      isSavingNonPostEntityChanges,
10335      onClose,
10336      onTogglePublishSidebar,
10337      PostPublishExtension,
10338      PrePublishExtension,
10339      ...additionalProps
10340    } = this.props;
10341    const {
10342      hasPublishAction,
10343      isDirty,
10344      isPostTypeViewable,
10345      ...propsForPanel
10346    } = additionalProps;
10347    const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
10348    const isPrePublish = !isPublishedOrScheduled && !isSaving;
10349    const isPostPublish = isPublishedOrScheduled && !isSaving;
10350    return (0,external_wp_element_namespaceObject.createElement)("div", {
10351      className: "editor-post-publish-panel",
10352      ...propsForPanel
10353    }, (0,external_wp_element_namespaceObject.createElement)("div", {
10354      className: "editor-post-publish-panel__header"
10355    }, isPostPublish ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10356      onClick: onClose,
10357      icon: close_small,
10358      label: (0,external_wp_i18n_namespaceObject.__)('Close panel')
10359    }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
10360      className: "editor-post-publish-panel__header-publish-button"
10361    }, (0,external_wp_element_namespaceObject.createElement)(post_publish_button, {
10362      focusOnMount: true,
10363      onSubmit: this.onSubmit,
10364      forceIsDirty: forceIsDirty
10365    })), (0,external_wp_element_namespaceObject.createElement)("div", {
10366      className: "editor-post-publish-panel__header-cancel-button"
10367    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10368      disabled: isSavingNonPostEntityChanges,
10369      onClick: onClose,
10370      variant: "secondary"
10371    }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))))), (0,external_wp_element_namespaceObject.createElement)("div", {
10372      className: "editor-post-publish-panel__content"
10373    }, isPrePublish && (0,external_wp_element_namespaceObject.createElement)(prepublish, null, PrePublishExtension && (0,external_wp_element_namespaceObject.createElement)(PrePublishExtension, null)), isPostPublish && (0,external_wp_element_namespaceObject.createElement)(postpublish, {
10374      focusOnMount: true
10375    }, PostPublishExtension && (0,external_wp_element_namespaceObject.createElement)(PostPublishExtension, null)), isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
10376      className: "editor-post-publish-panel__footer"
10377    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
10378      __nextHasNoMarginBottom: true,
10379      label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'),
10380      checked: isPublishSidebarEnabled,
10381      onChange: onTogglePublishSidebar
10382    }
10382)));
10383  }
10384}
10385/* harmony default export */ const post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10386  var _getCurrentPost$_link;
10387  const {
10388    getPostType
10389  } = select(external_wp_coreData_namespaceObject.store);
10390  const {
10391    getCurrentPost,
10392    getEditedPostAttribute,
10393    isCurrentPostPublished,
10394    isCurrentPostScheduled,
10395    isEditedPostBeingScheduled,
10396    isEditedPostDirty,
10397    isAutosavingPost,
10398    isSavingPost,
10399    isSavingNonPostEntityChanges
10400  } = select(store_store);
10401  const {
10402    isPublishSidebarEnabled
10403  } = select(store_store);
10404  const postType = getPostType(getEditedPostAttribute('type'));
10405  return {
10406    hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
10407    isPostTypeViewable: postType?.viewable,
10408    isBeingScheduled: isEditedPostBeingScheduled(),
10409    isDirty: isEditedPostDirty(),
10410    isPublished: isCurrentPostPublished(),
10411    isPublishSidebarEnabled: isPublishSidebarEnabled(),
10412    isSaving: isSavingPost() && !isAutosavingPost(),
10413    isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
10414    isScheduled: isCurrentPostScheduled()
10415  };
10416}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
10417  isPublishSidebarEnabled
10418}) => {
10419  const {
10420    disablePublishSidebar,
10421    enablePublishSidebar
10422  } = dispatch(store_store);
10423  return {
10424    onTogglePublishSidebar: () => {
10425      if (isPublishSidebarEnabled) {
10426        disablePublishSidebar();
10427      } else {
10428        enablePublishSidebar();
10429      }
10430    }
10431  };
10432}
10432), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel));
10433
10434;// CONCATENATED MODULE: ./packages/icons/build-module/library/cloud-upload.js
10435
10436/**
10437 * WordPress dependencies
10438 */
10439
10440const cloudUpload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10441  xmlns: "http://www.w3.org/2000/svg",
10442  viewBox: "0 0 24 24"
10443}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10444  d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
10445}));
10446/* harmony default export */ const cloud_upload = (cloudUpload);
10447
10448;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
10449/**
10450 * WordPress dependencies
10451 */
10452
10453
10454/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
10455
10456/**
10457 * Return an SVG icon.
10458 *
10459 * @param {IconProps}                                 props icon is the SVG component to render
10460 *                                                          size is a number specifiying the icon size in pixels
10461 *                                                          Other props will be passed to wrapped SVG component
10462 * @param {import('react').ForwardedRef<HTMLElement>} ref   The forwarded ref to the SVG element.
10463 *
10464 * @return {JSX.Element}  Icon component
10465 */
10466function Icon({
10467  icon,
10468  size = 24,
10469  ...props
10470}, ref) {
10471  return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
10472    width: size,
10473    height: size,
10474    ...props,
10475    ref
10476  });
10477}
10478/* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
10479
10480;// CONCATENATED MODULE: ./packages/icons/build-module/library/check.js
10481
10482/**
10483 * WordPress dependencies
10484 */
10485
10486const check_check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10487  xmlns: "http://www.w3.org/2000/svg",
10488  viewBox: "0 0 24 24"
10489}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10490  d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
10491}));
10492/* harmony default export */ const library_check = (check_check);
10493
10494;// CONCATENATED MODULE: ./packages/icons/build-module/library/cloud.js
10495
10496/**
10497 * WordPress dependencies
10498 */
10499
10500const cloud = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10501  xmlns: "http://www.w3.org/2000/svg",
10502  viewBox: "0 0 24 24"
10503}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10504  d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
10505}));
10506/* harmony default export */ const library_cloud = (cloud);
10507
10508;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-saved-state/index.js
10509
10510/**
10511 * External dependencies
10512 */
10513
10514
10515/**
10516 * WordPress dependencies
10517 */
10518
10519
10520
10521
10522
10523
10524
10525
10526/**
10527 * Internal dependencies
10528 */
10529
10530
10531/**
10532 * Component showing whether the post is saved or not and providing save
10533 * buttons.
10534 *
10535 * @param {Object}   props                Component props.
10536 * @param {?boolean} props.forceIsDirty   Whether to force the post to be marked
10537 *                                        as dirty.
10538 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
10539 * @return {import('@wordpress/element').WPComponent} The component.
10540 */
10541function PostSavedState({
10542  forceIsDirty,
10543  showIconLabels = false
10544}) {
10545  const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false);
10546  const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small');
10547  const {
10548    isAutosaving,
10549    isDirty,
10550    isNew,
10551    isPending,
10552    isPublished,
10553    isSaveable,
10554    isSaving,
10555    isScheduled,
10556    hasPublishAction
10557  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
10558    var _getCurrentPost$_link;
10559    const {
10560      isEditedPostNew,
10561      isCurrentPostPublished,
10562      isCurrentPostScheduled,
10563      isEditedPostDirty,
10564      isSavingPost,
10565      isEditedPostSaveable,
10566      getCurrentPost,
10567      isAutosavingPost,
10568      getEditedPostAttribute
10569    } = select(store_store);
10570    return {
10571      isAutosaving: isAutosavingPost(),
10572      isDirty: forceIsDirty || isEditedPostDirty(),
10573      isNew: isEditedPostNew(),
10574      isPending: 'pending' === getEditedPostAttribute('status'),
10575      isPublished: isCurrentPostPublished(),
10576      isSaving: isSavingPost(),
10577      isSaveable: isEditedPostSaveable(),
10578      isScheduled: isCurrentPostScheduled(),
10579      hasPublishAction: (_getCurrentPost$_link = getCurrentPost()?._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
10580    };
10581  }, [forceIsDirty]);
10582  const {
10583    savePost
10584  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
10585  const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving);
10586  (0,external_wp_element_namespaceObject.useEffect)(() => {
10587    let timeoutId;
10588    if (wasSaving && !isSaving) {
10589      setForceSavedMessage(true);
10590      timeoutId = setTimeout(() => {
10591        setForceSavedMessage(false);
10592      }, 1000);
10593    }
10594    return () => clearTimeout(timeoutId);
10595  }, [isSaving]);
10596
10597  // Once the post has been submitted for review this button
10598  // is not needed for the contributor role.
10599  if (!hasPublishAction && isPending) {
10600    return null;
10601  }
10602  if (isPublished || isScheduled) {
10603    return null;
10604  }
10605
10606  /* translators: button label text should, if possible, be under 16 characters. */
10607  const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft');
10608
10609  /* translators: button label text should, if possible, be under 16 characters. */
10610  const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save');
10611  const isSaved = forceSavedMessage || !isNew && !isDirty;
10612  const isSavedState = isSaving || isSaved;
10613  const isDisabled = isSaving || isSaved || !isSaveable;
10614  let text;
10615  if (isSaving) {
10616    text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving');
10617  } else if (isSaved) {
10618    text = (0,external_wp_i18n_namespaceObject.__)('Saved');
10619  } else if (isLargeViewport) {
10620    text = label;
10621  } else if (showIconLabels) {
10622    text = shortLabel;
10623  }
10624
10625  // Use common Button instance for all saved states so that focus is not
10626  // lost.
10627  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10628    className: isSaveable || isSaving ? classnames_default()({
10629      'editor-post-save-draft': !isSavedState,
10630      'editor-post-saved-state': isSavedState,
10631      'is-saving': isSaving,
10632      'is-autosaving': isAutosaving,
10633      'is-saved': isSaved,
10634      [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({
10635        type: 'loading'
10636      })]: isSaving
10637    }) : undefined,
10638    onClick: isDisabled ? undefined : () => savePost()
10639    /*
10640     * We want the tooltip to show the keyboard shortcut only when the
10641     * button does something, i.e. when it's not disabled.
10642     */,
10643    shortcut: isDisabled ? undefined : external_wp_keycodes_namespaceObject.displayShortcut.primary('s')
10644    /*
10645     * Displaying the keyboard shortcut conditionally makes the tooltip
10646     * itself show conditionally. This would trigger a full-rerendering
10647     * of the button that we want to avoid. By setting `showTooltip`,
10648     & the tooltip is always rendered even when there's no keyboard shortcut.
10649     */,
10650    showTooltip: true,
10651    variant: "tertiary",
10652    icon: isLargeViewport ? undefined : cloud_upload
10653    // Make sure the aria-label has always a value, as the default `text` is undefined on small screens.
10654    ,
10655    label: text || label,
10656    "aria-disabled": isDisabled
10657  }, isSavedState && (0,external_wp_element_namespaceObject.createElement)(icon, {
10658    icon: isSaved ? library_check : library_cloud
10659  }), text);
10660}
10661
10662;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-schedule/check.js
10663/**
10664 * WordPress dependencies
10665 */
10666
10667
10668
10669/**
10670 * Internal dependencies
10671 */
10672
10673function PostScheduleCheck({
10674  hasPublishAction,
10675  children
10676}) {
10677  if (!hasPublishAction) {
10678    return null;
10679  }
10680  return children;
10681}
10682/* harmony default export */ const post_schedule_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10683  var _getCurrentPost$_link;
10684  const {
10685    getCurrentPost,
10686    getCurrentPostType
10687  } = select(store_store);
10688  return {
10689    hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
10690    postType: getCurrentPostType()
10691  };
10692})])(PostScheduleCheck));
10693
10694;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-slug/check.js
10695
10696/**
10697 * Internal dependencies
10698 */
10699
10700function PostSlugCheck({
10701  children
10702}) {
10703  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
10704    supportKeys: "slug"
10705  }, children);
10706}
10707
10708;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-slug/index.js
10709
10710/**
10711 * WordPress dependencies
10712 */
10713
10714
10715
10716
10717
10718
10719
10720/**
10721 * Internal dependencies
10722 */
10723
10724
10725class PostSlug extends external_wp_element_namespaceObject.Component {
10726  constructor({
10727    postSlug,
10728    postTitle,
10729    postID
10730  }) {
10731    super(...arguments);
10732    this.state = {
10733      editedSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postSlug) || (0,external_wp_url_namespaceObject.cleanForSlug)(postTitle) || postID
10734    };
10735    this.setSlug = this.setSlug.bind(this);
10736  }
10737  setSlug(event) {
10738    const {
10739      postSlug,
10740      onUpdateSlug
10741    } = this.props;
10742    const {
10743      value
10744    } = event.target;
10745    const editedSlug = (0,external_wp_url_namespaceObject.cleanForSlug)(value);
10746    if (editedSlug === postSlug) {
10747      return;
10748    }
10749    onUpdateSlug(editedSlug);
10750  }
10751  render() {
10752    const {
10753      editedSlug
10754    } = this.state;
10755    return (0,external_wp_element_namespaceObject.createElement)(PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
10756      __nextHasNoMarginBottom: true,
10757      label: (0,external_wp_i18n_namespaceObject.__)('Slug'),
10758      autoComplete: "off",
10759      spellCheck: "false",
10760      value: editedSlug,
10761      onChange: slug => this.setState({
10762        editedSlug: slug
10763      }),
10764      onBlur: this.setSlug,
10765      className: "editor-post-slug"
10766    }));
10767  }
10768}
10769/* harmony default export */ const post_slug = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10770  const {
10771    getCurrentPost,
10772    getEditedPostAttribute
10773  } = select(store_store);
10774  const {
10775    id
10776  } = getCurrentPost();
10777  return {
10778    postSlug: getEditedPostAttribute('slug'),
10779    postTitle: getEditedPostAttribute('title'),
10780    postID: id
10781  };
10782}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
10783  const {
10784    editPost
10785  } = dispatch(store_store);
10786  return {
10787    onUpdateSlug(slug) {
10788      editPost({
10789        slug
10790      });
10791    }
10792  };
10793})])(PostSlug));
10794
10795;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-sticky/check.js
10796/**
10797 * WordPress dependencies
10798 */
10799
10800
10801
10802/**
10803 * Internal dependencies
10804 */
10805
10806function PostStickyCheck({
10807  hasStickyAction,
10808  postType,
10809  children
10810}) {
10811  if (postType !== 'post' || !hasStickyAction) {
10812    return null;
10813  }
10814  return children;
10815}
10816/* harmony default export */ const post_sticky_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10817  var _post$_links$wpActio;
10818  const post = select(store_store).getCurrentPost();
10819  return {
10820    hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
10821    postType: select(store_store).getCurrentPostType()
10822  };
10823})])(PostStickyCheck));
10824
10825;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-sticky/index.js
10826
10827/**
10828 * WordPress dependencies
10829 */
10830
10831
10832
10833
10834
10835/**
10836 * Internal dependencies
10837 */
10838
10839
10840function PostSticky({
10841  onUpdateSticky,
10842  postSticky = false
10843}) {
10844  return (0,external_wp_element_namespaceObject.createElement)(post_sticky_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
10845    __nextHasNoMarginBottom: true,
10846    label: (0,external_wp_i18n_namespaceObject.__)('Stick to the top of the blog'),
10847    checked: postSticky,
10848    onChange: () => onUpdateSticky(!postSticky)
10849  }));
10850}
10851/* harmony default export */ const post_sticky = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10852  return {
10853    postSticky: select(store_store).getEditedPostAttribute('sticky')
10854  };
10855}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
10856  return {
10857    onUpdateSticky(postSticky) {
10858      dispatch(store_store).editPost({
10859        sticky: postSticky
10860      });
10861    }
10862  };
10863})])(PostSticky));
10864
10865;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-switch-to-draft-button/index.js
10866
10867/**
10868 * WordPress dependencies
10869 */
10870
10871
10872
10873
10874
10875
10876/**
10877 * Internal dependencies
10878 */
10879
10880function PostSwitchToDraftButton({
10881  isSaving,
10882  isPublished,
10883  isScheduled,
10884  onClick
10885}) {
10886  const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
10887  if (!isPublished && !isScheduled) {
10888    return null;
10889  }
10890  let alertMessage;
10891  if (isPublished) {
10892    alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?');
10893  } else if (isScheduled) {
10894    alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?');
10895  }
10896  const handleConfirm = () => {
10897    setShowConfirmDialog(false);
10898    onClick();
10899  };
10900  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10901    className: "editor-post-switch-to-draft",
10902    onClick: () => {
10903      setShowConfirmDialog(true);
10904    },
10905    disabled: isSaving,
10906    variant: "secondary",
10907    style: {
10908      flexGrow: '1',
10909      justifyContent: 'center'
10910    }
10911  }, (0,external_wp_i18n_namespaceObject.__)('Switch to draft')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
10912    isOpen: showConfirmDialog,
10913    onConfirm: handleConfirm,
10914    onCancel: () => setShowConfirmDialog(false)
10915  }, alertMessage));
10916}
10917/* harmony default export */ const post_switch_to_draft_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10918  const {
10919    isSavingPost,
10920    isCurrentPostPublished,
10921    isCurrentPostScheduled
10922  } = select(store_store);
10923  return {
10924    isSaving: isSavingPost(),
10925    isPublished: isCurrentPostPublished(),
10926    isScheduled: isCurrentPostScheduled()
10927  };
10928}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
10929  const {
10930    editPost,
10931    savePost
10932  } = dispatch(store_store);
10933  return {
10934    onClick: () => {
10935      editPost({
10936        status: 'draft'
10937      });
10938      savePost();
10939    }
10940  };
10941})])(PostSwitchToDraftButton));
10942
10943;// CONCATENATED MODULE: external ["wp","privateApis"]
10944const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
10945;// CONCATENATED MODULE: ./packages/editor/build-module/lock-unlock.js
10946/**
10947 * WordPress dependencies
10948 */
10949
10950const {
10951  lock,
10952  unlock
10953} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/editor');
10954
10955;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-sync-status/index.js
10956
10957/**
10958 * WordPress dependencies
10959 */
10960
10961
10962
10963
10964
10965
10966/**
10967 * Internal dependencies
10968 */
10969
10970
10971const {
10972  ReusableBlocksRenameHint
10973} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
10974function PostSyncStatus() {
10975  const {
10976    syncStatus,
10977    postType
10978  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
10979    const {
10980      getEditedPostAttribute
10981    } = select(store_store);
10982    const meta = getEditedPostAttribute('meta');
10983
10984    // When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
10985    const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : getEditedPostAttribute('wp_pattern_sync_status');
10986    return {
10987      syncStatus: currentSyncStatus,
10988      postType: getEditedPostAttribute('type')
10989    };
10990  });
10991  if (postType !== 'wp_block') {
10992    return null;
10993  }
10994  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
10995    className: "edit-post-sync-status"
10996  }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Sync status')), (0,external_wp_element_namespaceObject.createElement)("div", null, syncStatus === 'unsynced' ? (0,external_wp_i18n_namespaceObject.__)('Not synced') : (0,external_wp_i18n_namespaceObject.__)('Fully synced')));
10997}
10998function PostSyncStatusModal() {
10999  const {
11000    editPost
11001  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
11002  const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
11003  const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined);
11004  const {
11005    postType,
11006    isNewPost
11007  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11008    const {
11009      getEditedPostAttribute,
11010      isCleanNewPost
11011    } = select(store_store);
11012    return {
11013      postType: getEditedPostAttribute('type'),
11014      isNewPost: isCleanNewPost()
11015    };
11016  }, []);
11017  (0,external_wp_element_namespaceObject.useEffect)(() => {
11018    if (isNewPost && postType === 'wp_block') {
11019      setIsModalOpen(true);
11020    }
11021    // We only want the modal to open when the page is first loaded.
11022    // eslint-disable-next-line react-hooks/exhaustive-deps
11023  }, []);
11024  const setSyncStatus = () => {
11025    editPost({
11026      meta: {
11027        wp_pattern_sync_status: syncType
11028      }
11029    });
11030  };
11031  if (postType !== 'wp_block' || !isNewPost) {
11032    return null;
11033  }
11034  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
11035    title: (0,external_wp_i18n_namespaceObject.__)('Set pattern sync status'),
11036    onRequestClose: () => {
11037      setIsModalOpen(false);
11038    },
11039    overlayClassName: "reusable-blocks-menu-items__convert-modal"
11040  }, (0,external_wp_element_namespaceObject.createElement)("form", {
11041    onSubmit: event => {
11042      event.preventDefault();
11043      setIsModalOpen(false);
11044      setSyncStatus();
11045    }
11046  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
11047    spacing: "5"
11048  }, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksRenameHint, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
11049    label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that makes an individual pattern synchronized'),
11050    help: (0,external_wp_i18n_namespaceObject.__)('Editing the pattern will update it anywhere it is used.'),
11051    checked: !syncType,
11052    onChange: () => {
11053      setSyncType(!syncType ? 'unsynced' : undefined);
11054    }
11055  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
11056    justify: "right"
11057  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
11058    variant: "primary",
11059    type: "submit"
11060  }
11060, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
11061}
11062
11063;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/index.js
11064
11065/**
11066 * WordPress dependencies
11067 */
11068
11069
11070
11071
11072
11073/**
11074 * Internal dependencies
11075 */
11076
11077
11078
11079const post_taxonomies_identity = x => x;
11080function PostTaxonomies({
11081  postType,
11082  taxonomies,
11083  taxonomyWrapper = post_taxonomies_identity
11084}) {
11085  const availableTaxonomies = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(taxonomy => taxonomy.types.includes(postType));
11086  const visibleTaxonomies = availableTaxonomies.filter(
11087  // In some circumstances .visibility can end up as undefined so optional chaining operator required.
11088  // https://github.com/WordPress/gutenberg/issues/40326
11089  taxonomy => taxonomy.visibility?.show_ui);
11090  return visibleTaxonomies.map(taxonomy => {
11091    const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
11092    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
11093      key: `taxonomy-${taxonomy.slug}`
11094    }, taxonomyWrapper((0,external_wp_element_namespaceObject.createElement)(TaxonomyComponent, {
11095      slug: taxonomy.slug
11096    }), taxonomy));
11097  });
11098}
11099/* harmony default export */ const post_taxonomies = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
11100  return {
11101    postType: select(store_store).getCurrentPostType(),
11102    taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({
11103      per_page: -1
11104    })
11105  };
11106})])(PostTaxonomies));
11107
11108;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/check.js
11109/**
11110 * WordPress dependencies
11111 */
11112
11113
11114
11115
11116/**
11117 * Internal dependencies
11118 */
11119
11120function PostTaxonomiesCheck({
11121  postType,
11122  taxonomies,
11123  children
11124}) {
11125  const hasTaxonomies = taxonomies?.some(taxonomy => taxonomy.types.includes(postType));
11126  if (!hasTaxonomies) {
11127    return null;
11128  }
11129  return children;
11130}
11131/* harmony default export */ const post_taxonomies_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
11132  return {
11133    postType: select(store_store).getCurrentPostType(),
11134    taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({
11135      per_page: -1
11136    })
11137  };
11138})])(PostTaxonomiesCheck));
11139
11140// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
11141var lib = __webpack_require__(773);
11142;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-text-editor/index.js
11143
11144/**
11145 * External dependencies
11146 */
11147
11148
11149/**
11150 * WordPress dependencies
11151 */
11152
11153
11154
11155
11156
11157
11158
11159
11160/**
11161 * Internal dependencies
11162 */
11163
11164function PostTextEditor() {
11165  const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor);
11166  const {
11167    content,
11168    blocks,
11169    type,
11170    id
11171  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11172    const {
11173      getEditedEntityRecord
11174    } = select(external_wp_coreData_namespaceObject.store);
11175    const {
11176      getCurrentPostType,
11177      getCurrentPostId
11178    } = select(store_store);
11179    const _type = getCurrentPostType();
11180    const _id = getCurrentPostId();
11181    const editedRecord = getEditedEntityRecord('postType', _type, _id);
11182    return {
11183      content: editedRecord?.content,
11184      blocks: editedRecord?.blocks,
11185      type: _type,
11186      id: _id
11187    };
11188  }, []);
11189  const {
11190    editEntityRecord
11191  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
11192  // Replicates the logic found in getEditedPostContent().
11193  const value = (0,external_wp_element_namespaceObject.useMemo)(() => {
11194    if (content instanceof Function) {
11195      return content({
11196        blocks
11197      });
11198    } else if (blocks) {
11199      // If we have parsed blocks already, they should be our source of truth.
11200      // Parsing applies block deprecations and legacy block conversions that
11201      // unparsed content will not have.
11202      return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks);
11203    }
11204    return content;
11205  }, [content, blocks]);
11206  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
11207    as: "label",
11208    htmlFor: `post-content-${instanceId}`
11209  }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
11210    autoComplete: "off",
11211    dir: "auto",
11212    value: value,
11213    onChange: event => {
11214      editEntityRecord('postType', type, id, {
11215        content: event.target.value,
11216        blocks: undefined,
11217        selection: undefined
11218      });
11219    },
11220    className: "editor-post-text-editor",
11221    id: `post-content-${instanceId}`,
11222    placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
11223  }));
11224}
11225
11226;
11226// CONCATENATED MODULE: external ["wp","dom"]
11227const external_wp_dom_namespaceObject = window["wp"]["dom"];
11228;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-title/index.js
11229
11230/**
11231 * External dependencies
11232 */
11233
11234
11235/**
11236 * WordPress dependencies
11237 */
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249/**
11250 * Internal dependencies
11251 */
11252
11253
11254
11255/**
11256 * Constants
11257 */
11258const REGEXP_NEWLINES = /[\r\n]+/g;
11259function PostTitle(_, forwardedRef) {
11260  const ref = (0,external_wp_element_namespaceObject.useRef)();
11261  const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false);
11262  const {
11263    editPost
11264  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
11265  const {
11266    insertDefaultBlock,
11267    clearSelectedBlock,
11268    insertBlocks
11269  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
11270  const {
11271    isCleanNewPost,
11272    title,
11273    placeholder,
11274    hasFixedToolbar
11275  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11276    const {
11277      getEditedPostAttribute,
11278      isCleanNewPost: _isCleanNewPost
11279    } = select(store_store);
11280    const {
11281      getSettings
11282    } = select(external_wp_blockEditor_namespaceObject.store);
11283    const {
11284      titlePlaceholder,
11285      hasFixedToolbar: _hasFixedToolbar
11286    } = getSettings();
11287    return {
11288      isCleanNewPost: _isCleanNewPost(),
11289      title: getEditedPostAttribute('title'),
11290      placeholder: titlePlaceholder,
11291      hasFixedToolbar: _hasFixedToolbar
11292    };
11293  }, []);
11294  (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({
11295    focus: () => {
11296      ref?.current?.focus();
11297    }
11298  }));
11299  (0,external_wp_element_namespaceObject.useEffect)(() => {
11300    if (!ref.current) {
11301      return;
11302    }
11303    const {
11304      defaultView
11305    } = ref.current.ownerDocument;
11306    const {
11307      name,
11308      parent
11309    } = defaultView;
11310    const ownerDocument = name === 'editor-canvas' ? parent.document : defaultView.document;
11311    const {
11312      activeElement,
11313      body
11314    } = ownerDocument;
11315
11316    // Only autofocus the title when the post is entirely empty. This should
11317    // only happen for a new post, which means we focus the title on new
11318    // post so the author can start typing right away, without needing to
11319    // click anything.
11320    if (isCleanNewPost && (!activeElement || body === activeElement)) {
11321      ref.current.focus();
11322    }
11323  }, [isCleanNewPost]);
11324  function onEnterPress() {
11325    insertDefaultBlock(undefined, undefined, 0);
11326  }
11327  function onInsertBlockAfter(blocks) {
11328    insertBlocks(blocks, 0);
11329  }
11330  function onUpdate(newTitle) {
11331    editPost({
11332      title: newTitle
11333    });
11334  }
11335  const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({});
11336  function onSelect() {
11337    setIsSelected(true);
11338    clearSelectedBlock();
11339  }
11340  function onUnselect() {
11341    setIsSelected(false);
11342    setSelection({});
11343  }
11344  function onChange(value) {
11345    onUpdate(value.replace(REGEXP_NEWLINES, ' '));
11346  }
11347  function onKeyDown(event) {
11348    if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
11349      event.preventDefault();
11350      onEnterPress();
11351    }
11352  }
11353  function onPaste(event) {
11354    const clipboardData = event.clipboardData;
11355    let plainText = '';
11356    let html = '';
11357
11358    // IE11 only supports `Text` as an argument for `getData` and will
11359    // otherwise throw an invalid argument error, so we try the standard
11360    // arguments first, then fallback to `Text` if they fail.
11361    try {
11362      plainText = clipboardData.getData('text/plain');
11363      html = clipboardData.getData('text/html');
11364    } catch (error1) {
11365      try {
11366        html = clipboardData.getData('Text');
11367      } catch (error2) {
11368        // Some browsers like UC Browser paste plain text by default and
11369        // don't support clipboardData at all, so allow default
11370        // behaviour.
11371        return;
11372      }
11373    }
11374
11375    // Allows us to ask for this information when we get a report.
11376    window.console.log('Received HTML:\n\n', html);
11377    window.console.log('Received plain text:\n\n', plainText);
11378    const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({
11379      HTML: html,
11380      plainText
11381    });
11382    event.preventDefault();
11383    if (!content.length) {
11384      return;
11385    }
11386    if (typeof content !== 'string') {
11387      const [firstBlock] = content;
11388      if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) {
11389        onUpdate((0,external_wp_dom_namespaceObject.__unstableStripHTML)(firstBlock.attributes.content));
11390        onInsertBlockAfter(content.slice(1));
11391      } else {
11392        onInsertBlockAfter(content);
11393      }
11394    } else {
11395      const value = {
11396        ...(0,external_wp_richText_namespaceObject.create)({
11397          html: title
11398        }),
11399        ...selection
11400      };
11401      const newValue = (0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({
11402        html: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(content)
11403      }));
11404      onUpdate((0,external_wp_richText_namespaceObject.toHTMLString)({
11405        value: newValue
11406      }));
11407      setSelection({
11408        start: newValue.start,
11409        end: newValue.end
11410      });
11411    }
11412  }
11413
11414  // The wp-block className is important for editor styles.
11415  // This same block is used in both the visual and the code editor.
11416  const className = classnames_default()('wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text', {
11417    'is-selected': isSelected,
11418    'has-fixed-toolbar': hasFixedToolbar
11419  });
11420  const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title');
11421  const {
11422    ref: richTextRef
11423  } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({
11424    value: title,
11425    onChange,
11426    placeholder: decodedPlaceholder,
11427    selectionStart: selection.start,
11428    selectionEnd: selection.end,
11429    onSelectionChange(newStart, newEnd) {
11430      setSelection(sel => {
11431        const {
11432          start,
11433          end
11434        } = sel;
11435        if (start === newStart && end === newEnd) {
11436          return sel;
11437        }
11438        return {
11439          start: newStart,
11440          end: newEnd
11441        };
11442      });
11443    },
11444    __unstableDisableFormats: true,
11445    preserveWhiteSpace: true
11446  });
11447
11448  /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
11449  return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
11450    supportKeys: "title"
11451  }, (0,external_wp_element_namespaceObject.createElement)("h1", {
11452    ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, ref]),
11453    contentEditable: true,
11454    className: className,
11455    "aria-label": decodedPlaceholder,
11456    role: "textbox",
11457    "aria-multiline": "true",
11458    onFocus: onSelect,
11459    onBlur: onUnselect,
11460    onKeyDown: onKeyDown,
11461    onKeyPress: onUnselect,
11462    onPaste: onPaste
11463  }));
11464  /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
11465}
11466
11467/* harmony default export */ const post_title = ((0,external_wp_element_namespaceObject.forwardRef)(PostTitle));
11468
11469;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-trash/index.js
11470
11471/**
11472 * WordPress dependencies
11473 */
11474
11475
11476
11477
11478/**
11479 * Internal dependencies
11480 */
11481
11482function PostTrash() {
11483  const {
11484    isNew,
11485    isDeleting,
11486    postId
11487  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11488    const store = select(store_store);
11489    return {
11490      isNew: store.isEditedPostNew(),
11491      isDeleting: store.isDeletingPost(),
11492      postId: store.getCurrentPostId()
11493    };
11494  }, []);
11495  const {
11496    trashPost
11497  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
11498  if (isNew || !postId) {
11499    return null;
11500  }
11501  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
11502    className: "editor-post-trash",
11503    isDestructive: true,
11504    variant: "secondary",
11505    isBusy: isDeleting,
11506    "aria-disabled": isDeleting,
11507    onClick: isDeleting ? undefined : () => trashPost()
11508  }, (0,external_wp_i18n_namespaceObject.__)('Move to trash'));
11509}
11510
11511;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-trash/check.js
11512/**
11513 * WordPress dependencies
11514 */
11515
11516
11517
11518/**
11519 * Internal dependencies
11520 */
11521
11522function PostTrashCheck({
11523  isNew,
11524  postId,
11525  canUserDelete,
11526  children
11527}) {
11528  if (isNew || !postId || !canUserDelete) {
11529    return null;
11530  }
11531  return children;
11532}
11533/* harmony default export */ const post_trash_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
11534  const {
11535    isEditedPostNew,
11536    getCurrentPostId,
11537    getCurrentPostType
11538  } = select(store_store);
11539  const {
11540    getPostType,
11541    canUser
11542  } = select(external_wp_coreData_namespaceObject.store);
11543  const postId = getCurrentPostId();
11544  const postType = getPostType(getCurrentPostType());
11545  const resource = postType?.rest_base || ''; // eslint-disable-line camelcase
11546
11547  return {
11548    isNew: isEditedPostNew(),
11549    postId,
11550    canUserDelete: postId && resource ? canUser('delete', resource, postId) : false
11551  };
11552})(PostTrashCheck));
11553
11554;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-url/index.js
11555
11556/**
11557 * WordPress dependencies
11558 */
11559
11560
11561
11562
11563
11564
11565
11566
11567/**
11568 * Internal dependencies
11569 */
11570
11571function PostURL({
11572  onClose
11573}) {
11574  const {
11575    isEditable,
11576    postSlug,
11577    viewPostLabel,
11578    postLink,
11579    permalinkPrefix,
11580    permalinkSuffix
11581  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11582    var _post$_links$wpActio;
11583    const post = select(store_store).getCurrentPost();
11584    const postTypeSlug = select(store_store).getCurrentPostType();
11585    const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
11586    const permalinkParts = select(store_store).getPermalinkParts();
11587    const hasPublishAction = (_post$_links$wpActio = post?._links?.['wp:action-publish']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false;
11588    return {
11589      isEditable: select(store_store).isPermalinkEditable() && hasPublishAction,
11590      postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(select(store_store).getEditedPostSlug()),
11591      viewPostLabel: postType?.labels.view_item,
11592      postLink: post.link,
11593      permalinkPrefix: permalinkParts?.prefix,
11594      permalinkSuffix: permalinkParts?.suffix
11595    };
11596  }, []);
11597  const {
11598    editPost
11599  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
11600  const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
11601  return (0,external_wp_element_namespaceObject.createElement)("div", {
11602    className: "editor-post-url"
11603  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
11604    title: (0,external_wp_i18n_namespaceObject.__)('URL'),
11605    onClose: onClose
11606  }), isEditable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
11607    __nextHasNoMarginBottom: true,
11608    label: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
11609    value: forceEmptyField ? '' : postSlug,
11610    autoComplete: "off",
11611    spellCheck: "false",
11612    help: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('The last part of the URL.'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
11613      href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink')
11614    }, (0,external_wp_i18n_namespaceObject.__)('Learn more.'))),
11615    onChange: newValue => {
11616      editPost({
11617        slug: newValue
11618      });
11619      // When we delete the field the permalink gets
11620      // reverted to the original value.
11621      // The forceEmptyField logic allows the user to have
11622      // the field temporarily empty while typing.
11623      if (!newValue) {
11624        if (!forceEmptyField) {
11625          setForceEmptyField(true);
11626        }
11627        return;
11628      }
11629      if (forceEmptyField) {
11630        setForceEmptyField(false);
11631      }
11632    },
11633    onBlur: event => {
11634      editPost({
11635        slug: (0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value)
11636      });
11637      if (forceEmptyField) {
11638        setForceEmptyField(false);
11639      }
11640    }
11641  }), isEditable && (0,external_wp_element_namespaceObject.createElement)("h3", {
11642    className: "editor-post-url__link-label"
11643  }, viewPostLabel !== null && viewPostLabel !== void 0 ? viewPostLabel : (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
11644    className: "editor-post-url__link",
11645    href: postLink,
11646    target: "_blank"
11647  }, isEditable ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("span", {
11648    className: "editor-post-url__link-prefix"
11649  }, permalinkPrefix), (0,external_wp_element_namespaceObject.createElement)("span", {
11650    className: "editor-post-url__link-slug"
11651  }, postSlug), (0,external_wp_element_namespaceObject.createElement)("span", {
11652    className: "editor-post-url__link-suffix"
11653  }, permalinkSuffix)) : postLink)));
11654}
11655
11656;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-url/check.js
11657/**
11658 * WordPress dependencies
11659 */
11660
11661
11662
11663/**
11664 * Internal dependencies
11665 */
11666
11667function PostURLCheck({
11668  children
11669}) {
11670  const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
11671    const postTypeSlug = select(store_store).getCurrentPostType();
11672    const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
11673    if (!postType?.viewable) {
11674      return false;
11675    }
11676    const post = select(store_store).getCurrentPost();
11677    if (!post.link) {
11678      return false;
11679    }
11680    const permalinkParts = select(store_store).getPermalinkParts();
11681    if (!permalinkParts) {
11682      return false;
11683    }
11684    return true;
11685  }, []);
11686  if (!isVisible) {
11687    return null;
11688  }
11689  return children;
11690}
11691
11692;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-url/label.js
11693/**
11694 * WordPress dependencies
11695 */
11696
11697
11698
11699/**
11700 * Internal dependencies
11701 */
11702
11703function PostURLLabel() {
11704  return usePostURLLabel();
11705}
11706function usePostURLLabel() {
11707  const postLink = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getPermalink(), []);
11708  return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink));
11709}
11710
11711;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/check.js
11712/**
11713 * WordPress dependencies
11714 */
11715
11716
11717
11718/**
11719 * Internal dependencies
11720 */
11721
11722function PostVisibilityCheck({
11723  hasPublishAction,
11724  render
11725}) {
11726  const canEdit = hasPublishAction;
11727  return render({
11728    canEdit
11729  });
11730}
11731/* harmony default export */ const post_visibility_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
11732  var _getCurrentPost$_link;
11733  const {
11734    getCurrentPost,
11735    getCurrentPostType
11736  } = select(store_store);
11737  return {
11738    hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
11739    postType: getCurrentPostType()
11740  };
11741})])(PostVisibilityCheck));
11742
11743;// CONCATENATED MODULE: ./packages/icons/build-module/library/info.js
11744
11745/**
11746 * WordPress dependencies
11747 */
11748
11749const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
11750  xmlns: "http://www.w3.org/2000/svg",
11751  viewBox: "0 0 24 24"
11752}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
11753  d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
11754}));
11755/* harmony default export */ const library_info = (info);
11756
11757;// CONCATENATED MODULE: external ["wp","wordcount"]
11758const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
11759;// CONCATENATED MODULE: ./packages/editor/build-module/components/word-count/index.js
11760
11761/**
11762 * WordPress dependencies
11763 */
11764
11765
11766
11767
11768/**
11769 * Internal dependencies
11770 */
11771
11772function WordCount() {
11773  const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
11774
11775  /*
11776   * translators: If your word count is based on single characters (e.g. East Asian characters),
11777   * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
11778   * Do not translate into your own language.
11779   */
11780  const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
11781  return (0,external_wp_element_namespaceObject.createElement)("span", {
11782    className: "word-count"
11783  }, (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType));
11784}
11785
11786;// CONCATENATED MODULE: ./packages/editor/build-module/components/time-to-read/index.js
11787
11788/**
11789 * WordPress dependencies
11790 */
11791
11792
11793
11794
11795
11796/**
11797 * Internal dependencies
11798 */
11799
11800
11801/**
11802 * Average reading rate - based on average taken from
11803 * https://irisreading.com/average-reading-speed-in-various-languages/
11804 * (Characters/minute used for Chinese rather than words).
11805 *
11806 * @type {number} A rough estimate of the average reading rate across multiple languages.
11807 */
11808const AVERAGE_READING_RATE = 189;
11809function TimeToRead() {
11810  const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
11811
11812  /*
11813   * translators: If your word count is based on single characters (e.g. East Asian characters),
11814   * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
11815   * Do not translate into your own language.
11816   */
11817  const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
11818  const minutesToRead = Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE);
11819  const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<span>< 1</span> minute'), {
11820    span: (0,external_wp_element_namespaceObject.createElement)("span", null)
11821  }) : (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s is the number of minutes the post will take to read. */
11822  (0,external_wp_i18n_namespaceObject._n)('<span>%d</span> minute', '<span>%d</span> minutes', minutesToRead), minutesToRead), {
11823    span: (0,external_wp_element_namespaceObject.createElement)("span", null)
11824  });
11825  return (0,external_wp_element_namespaceObject.createElement)("span", {
11826    className: "time-to-read"
11827  }, minutesToReadString);
11828}
11829
11830;// CONCATENATED MODULE: ./packages/editor/build-module/components/character-count/index.js
11831/**
11832 * WordPress dependencies
11833 */
11834
11835
11836
11837/**
11838 * Internal dependencies
11839 */
11840
11841function CharacterCount() {
11842  const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []);
11843  return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces');
11844}
11845
11846;// CONCATENATED MODULE: ./packages/editor/build-module/components/table-of-contents/panel.js
11847
11848/**
11849 * WordPress dependencies
11850 */
11851
11852
11853
11854
11855/**
11856 * Internal dependencies
11857 */
11858
11859
11860
11861
11862function TableOfContentsPanel({
11863  hasOutlineItemsDisabled,
11864  onRequestClose
11865}) {
11866  const {
11867    headingCount,
11868    paragraphCount,
11869    numberOfBlocks
11870  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11871    const {
11872      getGlobalBlockCount
11873    } = select(external_wp_blockEditor_namespaceObject.store);
11874    return {
11875      headingCount: getGlobalBlockCount('core/heading'),
11876      paragraphCount: getGlobalBlockCount('core/paragraph'),
11877      numberOfBlocks: getGlobalBlockCount()
11878    };
11879  }, []);
11880  return (
11881    /*
11882     * Disable reason: The `list` ARIA role is redundant but
11883     * Safari+VoiceOver won't announce the list otherwise.
11884     */
11885    /* eslint-disable jsx-a11y/no-redundant-roles */
11886    (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
11887      className: "table-of-contents__wrapper",
11888      role: "note",
11889      "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'),
11890      tabIndex: "0"
11891    }, (0,external_wp_element_namespaceObject.createElement)("ul", {
11892      role: "list",
11893      className: "table-of-contents__counts"
11894    }, (0,external_wp_element_namespaceObject.createElement)("li", {
11895      className: "table-of-contents__count"
11896    }, (0,external_wp_i18n_namespaceObject.__)('Words'), (0,external_wp_element_namespaceObject.createElement)(WordCount, null)), (0,external_wp_element_namespaceObject.createElement)("li", {
11897      className: "table-of-contents__count"
11898    }, (0,external_wp_i18n_namespaceObject.__)('Characters'), (0,external_wp_element_namespaceObject.createElement)("span", {
11899      className: "table-of-contents__number"
11900    }, (0,external_wp_element_namespaceObject.createElement)(CharacterCount, null))), (0,external_wp_element_namespaceObject.createElement)("li", {
11901      className: "table-of-contents__count"
11902    }, (0,external_wp_i18n_namespaceObject.__)('Time to read'), (0,external_wp_element_namespaceObject.createElement)(TimeToRead, null)), (0,external_wp_element_namespaceObject.createElement)("li", {
11903      className: "table-of-contents__count"
11904    }, (0,external_wp_i18n_namespaceObject.__)('Headings'), (0,external_wp_element_namespaceObject.createElement)("span", {
11905      className: "table-of-contents__number"
11906    }, headingCount)), (0,external_wp_element_namespaceObject.createElement)("li", {
11907      className: "table-of-contents__count"
11908    }, (0,external_wp_i18n_namespaceObject.__)('Paragraphs'), (0,external_wp_element_namespaceObject.createElement)("span", {
11909      className: "table-of-contents__number"
11910    }, paragraphCount)), (0,external_wp_element_namespaceObject.createElement)("li", {
11911      className: "table-of-contents__count"
11912    }, (0,external_wp_i18n_namespaceObject.__)('Blocks'), (0,external_wp_element_namespaceObject.createElement)("span", {
11913      className: "table-of-contents__number"
11914    }, numberOfBlocks)))), headingCount > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("hr", null), (0,external_wp_element_namespaceObject.createElement)("h2", {
11915      className: "table-of-contents__title"
11916    }, (0,external_wp_i18n_namespaceObject.__)('Document Outline')), (0,external_wp_element_namespaceObject.createElement)(document_outline, {
11917      onSelect: onRequestClose,
11918      hasOutlineItemsDisabled: hasOutlineItemsDisabled
11919    })))
11920    /* eslint-enable jsx-a11y/no-redundant-roles */
11921  );
11922}
11923
11924/* harmony default export */ const panel = (TableOfContentsPanel);
11925
11926;// CONCATENATED MODULE: ./packages/editor/build-module/components/table-of-contents/index.js
11927
11928/**
11929 * WordPress dependencies
11930 */
11931
11932
11933
11934
11935
11936
11937
11938/**
11939 * Internal dependencies
11940 */
11941
11942function TableOfContents({
11943  hasOutlineItemsDisabled,
11944  repositionDropdown,
11945  ...props
11946}, ref) {
11947  const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []);
11948  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
11949    popoverProps: {
11950      placement: repositionDropdown ? 'right' : 'bottom'
11951    },
11952    className: "table-of-contents",
11953    contentClassName: "table-of-contents__popover",
11954    renderToggle: ({
11955      isOpen,
11956      onToggle
11957    }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
11958      ...props,
11959      ref: ref,
11960      onClick: hasBlocks ? onToggle : undefined,
11961      icon: library_info,
11962      "aria-expanded": isOpen,
11963      "aria-haspopup": "true"
11964      /* translators: button label text should, if possible, be under 16 characters. */,
11965      label: (0,external_wp_i18n_namespaceObject.__)('Details'),
11966      tooltipPosition: "bottom",
11967      "aria-disabled": !hasBlocks
11968    }),
11969    renderContent: ({
11970      onClose
11971    }) => (0,external_wp_element_namespaceObject.createElement)(panel, {
11972      onRequestClose: onClose,
11973      hasOutlineItemsDisabled: hasOutlineItemsDisabled
11974    })
11975  });
11976}
11977/* harmony default export */ const table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents));
11978
11979;// CONCATENATED MODULE: ./packages/editor/build-module/components/unsaved-changes-warning/index.js
11980/**
11981 * WordPress dependencies
11982 */
11983
11984
11985
11986
11987
11988/**
11989 * Warns the user if there are unsaved changes before leaving the editor.
11990 * Compatible with Post Editor and Site Editor.
11991 *
11992 * @return {WPComponent} The component.
11993 */
11994function UnsavedChangesWarning() {
11995  const {
11996    __experimentalGetDirtyEntityRecords
11997  } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
11998  (0,external_wp_element_namespaceObject.useEffect)(() => {
11999    /**
12000     * Warns the user if there are unsaved changes before leaving the editor.
12001     *
12002     * @param {Event} event `beforeunload` event.
12003     *
12004     * @return {string | undefined} Warning prompt message, if unsaved changes exist.
12005     */
12006    const warnIfUnsavedChanges = event => {
12007      // We need to call the selector directly in the listener to avoid race
12008      // conditions with `BrowserURL` where `componentDidUpdate` gets the
12009      // new value of `isEditedPostDirty` before this component does,
12010      // causing this component to incorrectly think a trashed post is still dirty.
12011      const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
12012      if (dirtyEntityRecords.length > 0) {
12013        event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.');
12014        return event.returnValue;
12015      }
12016    };
12017    window.addEventListener('beforeunload', warnIfUnsavedChanges);
12018    return () => {
12019      window.removeEventListener('beforeunload', warnIfUnsavedChanges);
12020    };
12021  }, [__experimentalGetDirtyEntityRecords]);
12022  return null;
12023}
12024
12025;// CONCATENATED MODULE: external ["wp","patterns"]
12026const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
12027;// CONCATENATED MODULE: ./packages/editor/build-module/components/provider/with-registry-provider.js
12028
12029/**
12030 * WordPress dependencies
12031 */
12032
12033
12034
12035
12036
12037/**
12038 * Internal dependencies
12039 */
12040
12041const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_data_namespaceObject.withRegistry)(props => {
12042  const {
12043    useSubRegistry = true,
12044    registry,
12045    ...additionalProps
12046  } = props;
12047  if (!useSubRegistry) {
12048    return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, {
12049      ...additionalProps
12050    });
12051  }
12052  const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null);
12053  (0,external_wp_element_namespaceObject.useEffect)(() => {
12054    const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({
12055      'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig
12056    }, registry);
12057    newRegistry.registerStore('core/editor', storeConfig);
12058    setSubRegistry(newRegistry);
12059  }, [registry]);
12060  if (!subRegistry) {
12061    return null;
12062  }
12063  return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
12064    value: subRegistry
12065  }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, {
12066    ...additionalProps
12067  }));
12068}), 'withRegistryProvider');
12069/* harmony default export */ const with_registry_provider = (withRegistryProvider);
12070
12071;// CONCATENATED MODULE: ./packages/editor/build-module/components/media-categories/index.js
12072/**
12073 * The `editor` settings here need to be in sync with the corresponding ones in `editor` package.
12074 * See `packages/editor/src/components/media-categories/index.js`.
12075 *
12076 * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.
12077 * The rest of the settings would still need to be in sync though.
12078 */
12079
12080/**
12081 * WordPress dependencies
12082 */
12083
12084
12085
12086
12087/**
12088 * Internal dependencies
12089 */
12090
12091
12092/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */
12093/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */
12094/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */
12095
12096const getExternalLink = (url, text) => `<a ${getExternalLinkAttributes(url)}>${text}</a>`;
12097const getExternalLinkAttributes = url => `href="${url}" target="_blank" rel="noreferrer noopener"`;
12098const getOpenverseLicense = (license, licenseVersion) => {
12099  let licenseName = license.trim();
12100  // PDM has no abbreviation
12101  if (license !== 'pdm') {
12102    licenseName = license.toUpperCase().replace('SAMPLING', 'Sampling');
12103  }
12104  // If version is known, append version to the name.
12105  // The license has to have a version to be valid. Only
12106  // PDM (public domain mark) doesn't have a version.
12107  if (licenseVersion) {
12108    licenseName += ` ${licenseVersion}`;
12109  }
12110  // For licenses other than public-domain marks, prepend 'CC' to the name.
12111  if (!['pdm', 'cc0'].includes(license)) {
12112    licenseName = `CC ${licenseName}`;
12113  }
12114  return licenseName;
12115};
12116const getOpenverseCaption = item => {
12117  const {
12118    title,
12119    foreign_landing_url: foreignLandingUrl,
12120    creator,
12121    creator_url: creatorUrl,
12122    license,
12123    license_version: licenseVersion,
12124    license_url: licenseUrl
12125  } = item;
12126  const fullLicense = getOpenverseLicense(license, licenseVersion);
12127  const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator);
12128  let _caption;
12129  if (_creator) {
12130    _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)(
12131    // translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0".
12132    (0,external_wp_i18n_namespaceObject._x)('"%1$s" by %2$s/ %3$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)(
12133    // translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: "CC0 1.0".
12134    (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a> by %2$s/ %3$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense);
12135  } else {
12136    _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)(
12137    // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0".
12138    (0,external_wp_i18n_namespaceObject._x)('"%1$s"/ %2$s', 'caption'), getExternalLink(foreignLandingUrl, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense) : (0,external_wp_i18n_namespaceObject.sprintf)(
12139    // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0".
12140    (0,external_wp_i18n_namespaceObject._x)('<a %1$s>Work</a>/ %2$s', 'caption'), getExternalLinkAttributes(foreignLandingUrl), licenseUrl ? getExternalLink(`${licenseUrl}?ref=openverse`, fullLicense) : fullLicense);
12141  }
12142  return _caption.replace(/\s{2}/g, ' ');
12143};
12144const coreMediaFetch = async (query = {}) => {
12145  const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getMediaItems({
12146    ...query,
12147    orderBy: !!query?.search ? 'relevance' : 'date'
12148  });
12149  return mediaItems.map(mediaItem => ({
12150    ...mediaItem,
12151    alt: mediaItem.alt_text,
12152    url: mediaItem.source_url,
12153    previewUrl: mediaItem.media_details?.sizes?.medium?.source_url,
12154    caption: mediaItem.caption?.raw
12155  }));
12156};
12157
12158/** @type {InserterMediaCategory[]} */
12159const inserterMediaCategories = [{
12160  name: 'images',
12161  labels: {
12162    name: (0,external_wp_i18n_namespaceObject.__)('Images'),
12163    search_items: (0,external_wp_i18n_namespaceObject.__)('Search images')
12164  },
12165  mediaType: 'image',
12166  async fetch(query = {}) {
12167    return coreMediaFetch({
12168      ...query,
12169      media_type: 'image'
12170    });
12171  }
12172}, {
12173  name: 'videos',
12174  labels: {
12175    name: (0,external_wp_i18n_namespaceObject.__)('Videos'),
12176    search_items: (0,external_wp_i18n_namespaceObject.__)('Search videos')
12177  },
12178  mediaType: 'video',
12179  async fetch(query = {}) {
12180    return coreMediaFetch({
12181      ...query,
12182      media_type: 'video'
12183    });
12184  }
12185}, {
12186  name: 'audio',
12187  labels: {
12188    name: (0,external_wp_i18n_namespaceObject.__)('Audio'),
12189    search_items: (0,external_wp_i18n_namespaceObject.__)('Search audio')
12190  },
12191  mediaType: 'audio',
12192  async fetch(query = {}) {
12193    return coreMediaFetch({
12194      ...query,
12195      media_type: 'audio'
12196    });
12197  }
12198}, {
12199  name: 'openverse',
12200  labels: {
12201    name: (0,external_wp_i18n_namespaceObject.__)('Openverse'),
12202    search_items: (0,external_wp_i18n_namespaceObject.__)('Search Openverse')
12203  },
12204  mediaType: 'image',
12205  async fetch(query = {}) {
12206    const defaultArgs = {
12207      mature: false,
12208      excluded_source: 'flickr,inaturalist,wikimedia',
12209      license: 'pdm,cc0'
12210    };
12211    const finalQuery = {
12212      ...query,
12213      ...defaultArgs
12214    };
12215    const mapFromInserterMediaRequest = {
12216      per_page: 'page_size',
12217      search: 'q'
12218    };
12219    const url = new URL('https://api.openverse.engineering/v1/images/');
12220    Object.entries(finalQuery).forEach(([key, value]) => {
12221      const queryKey = mapFromInserterMediaRequest[key] || key;
12222      url.searchParams.set(queryKey, value);
12223    });
12224    const response = await window.fetch(url, {
12225      headers: {
12226        'User-Agent': 'WordPress/inserter-media-fetch'
12227      }
12228    });
12229    const jsonResponse = await response.json();
12230    const results = jsonResponse.results;
12231    return results.map(result => ({
12232      ...result,
12233      // This is a temp solution for better titles, until Openverse API
12234      // completes the cleaning up of some titles of their upstream data.
12235      title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
12236      sourceId: result.id,
12237      id: undefined,
12238      caption: getOpenverseCaption(result),
12239      previewUrl: result.thumbnail
12240    }));
12241  },
12242  getReportUrl: ({
12243    sourceId
12244  }) => `https://wordpress.org/openverse/image/${sourceId}/report/`,
12245  isExternalResource: true
12246}];
12247/* harmony default export */ const media_categories = (inserterMediaCategories);
12248
12249;// CONCATENATED MODULE: external ["wp","mediaUtils"]
12250const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
12251;// CONCATENATED MODULE: ./packages/editor/build-module/utils/media-upload/index.js
12252/**
12253 * WordPress dependencies
12254 */
12255
12256
12257
12258/**
12259 * Internal dependencies
12260 */
12261
12262const media_upload_noop = () => {};
12263
12264/**
12265 * Upload a media file when the file upload button is activated.
12266 * Wrapper around mediaUpload() that injects the current post ID.
12267 *
12268 * @param {Object}   $0                   Parameters object passed to the function.
12269 * @param {?Object}  $0.additionalData    Additional data to include in the request.
12270 * @param {string}   $0.allowedTypes      Array with the types of media that can be uploaded, if unset all types are allowed.
12271 * @param {Array}    $0.filesList         List of files.
12272 * @param {?number}  $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
12273 * @param {Function} $0.onError           Function called when an error happens.
12274 * @param {Function} $0.onFileChange      Function called each time a file or a temporary representation of the file is available.
12275 */
12276function mediaUpload({
12277  additionalData = {},
12278  allowedTypes,
12279  filesList,
12280  maxUploadFileSize,
12281  onError = media_upload_noop,
12282  onFileChange
12283}) {
12284  const {
12285    getCurrentPostId,
12286    getEditorSettings
12287  } = (0,external_wp_data_namespaceObject.select)(store_store);
12288  const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
12289  maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
12290  (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
12291    allowedTypes,
12292    filesList,
12293    onFileChange,
12294    additionalData: {
12295      post: getCurrentPostId(),
12296      ...additionalData
12297    },
12298    maxUploadFileSize,
12299    onError: ({
12300      message
12301    }) => onError(message),
12302    wpAllowedMimeTypes
12303  });
12304}
12305
12306;// CONCATENATED MODULE: ./packages/editor/build-module/components/provider/use-block-editor-settings.js
12307/**
12308 * WordPress dependencies
12309 */
12310
12311
12312
12313
12314
12315/**
12316 * Internal dependencies
12317 */
12318
12319
12320
12321const EMPTY_BLOCKS_LIST = [];
12322const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'focusMode', 'distractionFree', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'hasInlineToolbar', 'isDistractionFree', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme'];
12323
12324/**
12325 * React hook used to compute the block editor settings to use for the post editor.
12326 *
12327 * @param {Object}  settings    EditorProvider settings prop.
12328 * @param {boolean} hasTemplate Whether template mode is enabled.
12329 *
12330 * @return {Object} Block Editor Settings.
12331 */
12332function useBlockEditorSettings(settings, hasTemplate) {
12333  var _settings$__experimen, _settings$__experimen2;
12334  const {
12335    reusableBlocks,
12336    hasUploadPermissions,
12337    canUseUnfilteredHTML,
12338    userCanCreatePages,
12339    pageOnFront,
12340    postType,
12341    userPatternCategories
12342  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
12343    var _canUser;
12344    const {
12345      canUserUseUnfilteredHTML,
12346      getCurrentPostType
12347    } = select(store_store);
12348    const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
12349    const {
12350      canUser,
12351      getEntityRecord,
12352      getUserPatternCategories
12353    } = select(external_wp_coreData_namespaceObject.store);
12354    const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
12355    return {
12356      canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
12357      reusableBlocks: isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
12358        per_page: -1
12359      }) : EMPTY_BLOCKS_LIST,
12360      // Reusable blocks are fetched in the native version of this hook.
12361      hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
12362      userCanCreatePages: canUser('create', 'pages'),
12363      pageOnFront: siteSettings?.page_on_front,
12364      postType: getCurrentPostType(),
12365      userPatternCategories: getUserPatternCategories()
12366    };
12367  }, []);
12368  const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen :
12369  // WP 6.0
12370  settings.__experimentalBlockPatterns; // WP 5.9
12371  const settingsBlockPatternCategories = (_settings$__experimen2 = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen2 !== void 0 ? _settings$__experimen2 :
12372  // WP 6.0
12373  settings.__experimentalBlockPatternCategories; // WP 5.9
12374
12375  const {
12376    restBlockPatterns,
12377    restBlockPatternCategories
12378  } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
12379    restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
12380    restBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()
12381  }), []);
12382  const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(({
12383    postTypes
12384  }) => {
12385    return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType);
12386  }), [settingsBlockPatterns, restBlockPatterns, postType]);
12387  const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
12388  const {
12389    undo
12390  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
12391  const {
12392    saveEntityRecord
12393  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
12394
12395  /**
12396   * Creates a Post entity.
12397   * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.
12398   *
12399   * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.
12400   * @return {Object} the post type object that was created.
12401   */
12402  const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)(options => {
12403    if (!userCanCreatePages) {
12404      return Promise.reject({
12405        message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.')
12406      });
12407    }
12408    return saveEntityRecord('postType', 'page', options);
12409  }, [saveEntityRecord, userCanCreatePages]);
12410  return (0,external_wp_element_namespaceObject.useMemo)(() => ({
12411    ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))),
12412    mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
12413    __experimentalReusableBlocks: reusableBlocks,
12414    __experimentalBlockPatterns: blockPatterns,
12415    __experimentalBlockPatternCategories: blockPatternCategories,
12416    __experimentalUserPatternCategories: userPatternCategories,
12417    __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
12418    inserterMediaCategories: media_categories,
12419    __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData,
12420    __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
12421    __experimentalUndo: undo,
12422    outlineMode: hasTemplate,
12423    __experimentalCreatePageEntity: createPageEntity,
12424    __experimentalUserCanCreatePages: userCanCreatePages,
12425    pageOnFront,
12426    __experimentalPreferPatternsOnRoot: hasTemplate
12427  }), [settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, createPageEntity, userCanCreatePages, pageOnFront]);
12428}
12429/* harmony default export */ const use_block_editor_settings = (useBlockEditorSettings);
12430
12431;// CONCATENATED MODULE: ./packages/editor/build-module/components/provider/index.js
12432
12433/**
12434 * WordPress dependencies
12435 */
12436
12437
12438
12439
12440
12441
12442
12443
12444/**
12445 * Internal dependencies
12446 */
12447
12448
12449
12450
12451const {
12452  ExperimentalBlockEditorProvider
12453} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
12454const {
12455  PatternsMenuItems
12456} = unlock(external_wp_patterns_namespaceObject.privateApis);
12457const ExperimentalEditorProvider = with_registry_provider(({
12458  __unstableTemplate,
12459  post,
12460  settings,
12461  recovery,
12462  initialEdits,
12463  children,
12464  BlockEditorProviderComponent = ExperimentalBlockEditorProvider
12465}) => {
12466  const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => {
12467    if (post.type === 'wp_template') {
12468      return {};
12469    }
12470    return {
12471      postId: post.id,
12472      postType: post.type
12473    };
12474  }, [post.id, post.type]);
12475  const {
12476    editorSettings,
12477    selection,
12478    isReady
12479  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
12480    const {
12481      getEditorSettings,
12482      getEditorSelection,
12483      __unstableIsEditorReady
12484    } = select(store_store);
12485    return {
12486      editorSettings: getEditorSettings(),
12487      isReady: __unstableIsEditorReady(),
12488      selection: getEditorSelection()
12489    };
12490  }, []);
12491  const {
12492    id,
12493    type
12494  } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post;
12495  const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', type, {
12496    id
12497  });
12498  const blockEditorSettings = use_block_editor_settings(editorSettings, !!__unstableTemplate);
12499  const {
12500    updatePostLock,
12501    setupEditor,
12502    updateEditorSettings,
12503    __experimentalTearDownEditor
12504  } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
12505  const {
12506    createWarningNotice
12507  } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
12508
12509  // Initialize and tear down the editor.
12510  // Ideally this should be synced on each change and not just something you do once.
12511  (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
12512    // Assume that we don't need to initialize in the case of an error recovery.
12513    if (recovery) {
12514      return;
12515    }
12516    updatePostLock(settings.postLock);
12517    setupEditor(post, initialEdits, settings.template);
12518    if (settings.autosave) {
12519      createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), {
12520        id: 'autosave-exists',
12521        actions: [{
12522          label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'),
12523          url: settings.autosave.editLink
12524        }]
12525      });
12526    }
12527    return () => {
12528      __experimentalTearDownEditor();
12529    };
12530  }, []);
12531
12532  // Synchronize the editor settings as they change.
12533  (0,external_wp_element_namespaceObject.useEffect)(() => {
12534    updateEditorSettings(settings);
12535  }, [settings]);
12536  if (!isReady) {
12537    return null;
12538  }
12539  return (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvi
12539der, {
12540    kind: "root",
12541    type: "site"
12542  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
12543    kind: "postType",
12544    type: post.type,
12545    id: post.id
12546  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
12547    value: defaultBlockContext
12548  }, (0,external_wp_element_namespaceObject.createElement)(BlockEditorProviderComponent, {
12549    value: blocks,
12550    onChange: onChange,
12551    onInput: onInput,
12552    selection: selection,
12553    settings: blockEditorSettings,
12554    useSubRegistry: false
12555  }, children, (0,external_wp_element_namespaceObject.createElement)(PatternsMenuItems, null)))));
12556});
12557function EditorProvider(props) {
12558  return (0,external_wp_element_namespaceObject.createElement)(ExperimentalEditorProvider, {
12559    ...props,
12560    BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider
12561  }, props.children);
12562}
12563/* harmony default export */ const provider = (EditorProvider);
12564
12565;// CONCATENATED MODULE: external ["wp","serverSideRender"]
12566const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"];
12567var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject);
12568;// CONCATENATED MODULE: ./packages/editor/build-module/components/deprecated.js
12569
12570// Block Creation Components.
12571/**
12572 * WordPress dependencies
12573 */
12574
12575
12576
12577
12578function deprecateComponent(name, Wrapped, staticsToHoist = []) {
12579  const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
12580    external_wp_deprecated_default()('wp.editor.' + name, {
12581      since: '5.3',
12582      alternative: 'wp.blockEditor.' + name,
12583      version: '6.2'
12584    });
12585    return (0,external_wp_element_namespaceObject.createElement)(Wrapped, {
12586      ref: ref,
12587      ...props
12588    });
12589  });
12590  staticsToHoist.forEach(staticName => {
12591    Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]);
12592  });
12593  return Component;
12594}
12595function deprecateFunction(name, func) {
12596  return (...args) => {
12597    external_wp_deprecated_default()('wp.editor.' + name, {
12598      since: '5.3',
12599      alternative: 'wp.blockEditor.' + name,
12600      version: '6.2'
12601    });
12602    return func(...args);
12603  };
12604}
12605const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']);
12606RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty);
12607
12608const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete);
12609const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar);
12610const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar);
12611const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']);
12612const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit);
12613const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts);
12614const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']);
12615const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon);
12616const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector);
12617const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList);
12618const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover);
12619const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown);
12620const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer);
12621const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu);
12622const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle);
12623const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar);
12624const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette);
12625const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker);
12626const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler);
12627const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender);
12628const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker);
12629const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter);
12630const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
12631const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']);
12632const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']);
12633const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings);
12634const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText);
12635const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut);
12636const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton);
12637const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent);
12638const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder);
12639const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload);
12640const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck);
12641const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView);
12642const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar);
12643const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping);
12644const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock);
12645const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput);
12646const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton);
12647const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover);
12648const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning);
12649const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow);
12650const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC);
12651const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName);
12652const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues);
12653const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue);
12654const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize);
12655const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass);
12656const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext);
12657const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors);
12658const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes);
12659
12660;// CONCATENATED MODULE: ./packages/editor/build-module/components/index.js
12661/**
12662 * Internal dependencies
12663 */
12664
12665
12666// Block Creation Components.
12667
12668
12669// Post Related Components.
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738// State Related Components.
12739
12740
12741const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;
12742const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;
12743
12744;// CONCATENATED MODULE: ./packages/editor/build-module/utils/url.js
12745/**
12746 * WordPress dependencies
12747 */
12748
12749
12750
12751/**
12752 * Performs some basic cleanup of a string for use as a post slug
12753 *
12754 * This replicates some of what sanitize_title() does in WordPress core, but
12755 * is only designed to approximate what the slug will be.
12756 *
12757 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters.
12758 * Removes combining diacritical marks. Converts whitespace, periods,
12759 * and forward slashes to hyphens. Removes any remaining non-word characters
12760 * except hyphens and underscores. Converts remaining string to lowercase.
12761 * It does not account for octets, HTML entities, or other encoded characters.
12762 *
12763 * @param {string} string Title or slug to be processed
12764 *
12765 * @return {string} Processed string
12766 */
12767function cleanForSlug(string) {
12768  external_wp_deprecated_default()('wp.editor.cleanForSlug', {
12769    since: '12.7',
12770    plugin: 'Gutenberg',
12771    alternative: 'wp.url.cleanForSlug'
12772  });
12773  return (0,external_wp_url_namespaceObject.cleanForSlug)(string);
12774}
12775
12776;// CONCATENATED MODULE: ./packages/editor/build-module/utils/index.js
12777/**
12778 * Internal dependencies
12779 */
12780
12781
12782
12783
12784
12785;// CONCATENATED MODULE: ./packages/editor/build-module/private-apis.js
12786/**
12787 * Internal dependencies
12788 */
12789
12790
12791
12792const privateApis = {};
12793lock(privateApis, {
12794  ExperimentalEditorProvider: ExperimentalEditorProvider,
12795  EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible
12796});
12797
12798;// CONCATENATED MODULE: ./packages/editor/build-module/index.js
12799/**
12800 * Internal dependencies
12801 */
12802
12803
12804
12805
12806
12807
12808/*
12809 * Backward compatibility
12810 */
12811
12812
12813})();
12814
12815(window.wp = window.wp || {}).editor = __webpack_exports__;
12816/******/ })()
12817;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.