| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 66: 5 /***/ ((module) => { 6 7 "use strict"; 8 9 10 var isMergeableObject = function isMergeableObject(value) { 11 return isNonNullObject(value) 12 && !isSpecial(value) 13 }; 14 15 function isNonNullObject(value) { 16 return !!value && typeof value === 'object' 17 } 18 19 function isSpecial(value) { 20 var stringValue = Object.prototype.toString.call(value); 21 22 return stringValue === '[object RegExp]' 23 || stringValue === '[object Date]' 24 || isReactElement(value) 25 } 26 27 // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 28 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; 29 var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; 30 31 function isReactElement(value) { 32 return value.$$typeof === REACT_ELEMENT_TYPE 33 } 34 35 function emptyTarget(val) { 36 return Array.isArray(val) ? [] : {} 37 } 38 39 function cloneUnlessOtherwiseSpecified(value, options) { 40 return (options.clone !== false && options.isMergeableObject(value)) 41 ? deepmerge(emptyTarget(value), value, options) 42 : value 43 } 44 45 function defaultArrayMerge(target, source, options) { 46 return target.concat(source).map(function(element) { 47 return cloneUnlessOtherwiseSpecified(element, options) 48 }) 49 } 50 51 function getMergeFunction(key, options) { 52 if (!options.customMerge) { 53 return deepmerge 54 } 55 var customMerge = options.customMerge(key); 56 return typeof customMerge === 'function' ? customMerge : deepmerge 57 } 58 59 function getEnumerableOwnPropertySymbols(target) { 60 return Object.getOwnPropertySymbols 61 ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 62 return Object.propertyIsEnumerable.call(target, symbol) 63 }) 64 : [] 65 } 66 67 function getKeys(target) { 68 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) 69 } 70 71 function propertyIsOnObject(object, property) { 72 try { 73 return property in object 74 } catch(_) { 75 return false 76 } 77 } 78 79 // Protects from prototype poisoning and unexpected merging up the prototype chain. 80 function propertyIsUnsafe(target, key) { 81 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, 82 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, 83 && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. 84 } 85 86 function mergeObject(target, source, options) { 87 var destination = {}; 88 if (options.isMergeableObject(target)) { 89 getKeys(target).forEach(function(key) { 90 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 91 }); 92 } 93 getKeys(source).forEach(function(key) { 94 if (propertyIsUnsafe(target, key)) { 95 return 96 } 97 98 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 99 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 100 } else { 101 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 102 } 103 }); 104 return destination 105 } 106 107 function deepmerge(target, source, options) { 108 options = options || {}; 109 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 110 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 111 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() 112 // implementations can use it. The caller may not replace it. 113 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 114 115 var sourceIsArray = Array.isArray(source); 116 var targetIsArray = Array.isArray(target); 117 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 118 119 if (!sourceAndTargetTypesMatch) { 120 return cloneUnlessOtherwiseSpecified(source, options) 121 } else if (sourceIsArray) { 122 return options.arrayMerge(target, source, options) 123 } else { 124 return mergeObject(target, source, options) 125 } 126 } 127 128 deepmerge.all = function deepmergeAll(array, options) { 129 if (!Array.isArray(array)) { 130 throw new Error('first argument should be an array') 131 } 132 133 return array.reduce(function(prev, next) { 134 return deepmerge(prev, next, options) 135 }, {}) 136 }; 137 138 var deepmerge_1 = deepmerge; 139 140 module.exports = deepmerge_1; 141 142 143 /***/ }), 144 145 /***/ 461: 146 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 147 148 // Load in dependencies 149 var computedStyle = __webpack_require__(6109); 150 151 /** 152 * Calculate the `line-height` of a given node 153 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 154 * @returns {Number} `line-height` of the element in pixels 155 */ 156 function lineHeight(node) { 157 // Grab the line-height via style 158 var lnHeightStr = computedStyle(node, 'line-height'); 159 var lnHeight = parseFloat(lnHeightStr, 10); 160 161 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 162 if (lnHeightStr === lnHeight + '') { 163 // Save the old lineHeight style and update the em unit to the element 164 var _lnHeightStyle = node.style.lineHeight; 165 node.style.lineHeight = lnHeightStr + 'em'; 166 167 // Calculate the em based height 168 lnHeightStr = computedStyle(node, 'line-height'); 169 lnHeight = parseFloat(lnHeightStr, 10); 170 171 // Revert the lineHeight style 172 if (_lnHeightStyle) { 173 node.style.lineHeight = _lnHeightStyle; 174 } else { 175 delete node.style.lineHeight; 176 } 177 } 178 179 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 180 // DEV: `em` units are converted to `pt` in IE6 181 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 182 if (lnHeightStr.indexOf('pt') !== -1) { 183 lnHeight *= 4; 184 lnHeight /= 3; 185 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 186 } else if (lnHeightStr.indexOf('mm') !== -1) { 187 lnHeight *= 96; 188 lnHeight /= 25.4; 189 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 190 } else if (lnHeightStr.indexOf('cm') !== -1) { 191 lnHeight *= 96; 192 lnHeight /= 2.54; 193 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 194 } else if (lnHeightStr.indexOf('in') !== -1) { 195 lnHeight *= 96; 196 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 197 } else if (lnHeightStr.indexOf('pc') !== -1) { 198 lnHeight *= 16; 199 } 200 201 // Continue our computation 202 lnHeight = Math.round(lnHeight); 203 204 // If the line-height is "normal", calculate by font-size 205 if (lnHeightStr === 'normal') { 206 // Create a temporary node 207 var nodeName = node.nodeName; 208 var _node = document.createElement(nodeName); 209 _node.innerHTML = ' '; 210 211 // If we have a text area, reset it to only 1 row 212 // https://github.com/twolfson/line-height/issues/4 213 if (nodeName.toUpperCase() === 'TEXTAREA') { 214 _node.setAttribute('rows', '1'); 215 } 216 217 // Set the font-size of the element 218 var fontSizeStr = computedStyle(node, 'font-size'); 219 _node.style.fontSize = fontSizeStr; 220 221 // Remove default padding/border which can affect offset height 222 // https://github.com/twolfson/line-height/issues/4 223 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 224 _node.style.padding = '0px'; 225 _node.style.border = '0px'; 226 227 // Append it to the body 228 var body = document.body; 229 body.appendChild(_node); 230 231 // Assume the line height of the element is the height 232 var height = _node.offsetHeight; 233 lnHeight = height; 234 235 // Remove our child from the DOM 236 body.removeChild(_node); 237 } 238 239 // Return the calculated height 240 return lnHeight; 241 } 242 243 // Export lineHeight 244 module.exports = lineHeight; 245 246 247 /***/ }), 248 249 /***/ 628: 250 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 251 252 "use strict"; 253 /** 254 * Copyright (c) 2013-present, Facebook, Inc. 255 * 256 * This source code is licensed under the MIT license found in the 257 * LICENSE file in the root directory of this source tree. 258 */ 259 260 261 262 var ReactPropTypesSecret = __webpack_require__(4067); 263 264 function emptyFunction() {} 265 function emptyFunctionWithReset() {} 266 emptyFunctionWithReset.resetWarningCache = emptyFunction; 267 268 module.exports = function() { 269 function shim(props, propName, componentName, location, propFullName, secret) { 270 if (secret === ReactPropTypesSecret) { 271 // It is still safe when called from React. 272 return; 273 } 274 var err = new Error( 275 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 276 'Use PropTypes.checkPropTypes() to call them. ' + 277 'Read more at http://fb.me/use-check-prop-types' 278 ); 279 err.name = 'Invariant Violation'; 280 throw err; 281 }; 282 shim.isRequired = shim; 283 function getShim() { 284 return shim; 285 }; 286 // Important! 287 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 288 var ReactPropTypes = { 289 array: shim, 290 bigint: shim, 291 bool: shim, 292 func: shim, 293 number: shim, 294 object: shim, 295 string: shim, 296 symbol: shim, 297 298 any: shim, 299 arrayOf: getShim, 300 element: shim, 301 elementType: shim, 302 instanceOf: getShim, 303 node: shim, 304 objectOf: getShim, 305 oneOf: getShim, 306 oneOfType: getShim, 307 shape: getShim, 308 exact: getShim, 309 310 checkPropTypes: emptyFunctionWithReset, 311 resetWarningCache: emptyFunction 312 }; 313 314 ReactPropTypes.PropTypes = ReactPropTypes; 315 316 return ReactPropTypes; 317 }; 318 319 320 /***/ }), 321 322 /***/ 1609: 323 /***/ ((module) => { 324 325 "use strict"; 326 module.exports = window["React"]; 327 328 /***/ }), 329 330 /***/ 4067: 331 /***/ ((module) => { 332 333 "use strict"; 334 /** 335 * Copyright (c) 2013-present, Facebook, Inc. 336 * 337 * This source code is licensed under the MIT license found in the 338 * LICENSE file in the root directory of this source tree. 339 */ 340 341 342 343 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 344 345 module.exports = ReactPropTypesSecret; 346 347 348 /***/ }), 349 350 /***/ 4132: 351 /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 352 353 "use strict"; 354 var __webpack_unused_export__; 355 356 __webpack_unused_export__ = true; 357 var TextareaAutosize_1 = __webpack_require__(4462); 358 exports.A = TextareaAutosize_1.TextareaAutosize; 359 360 361 /***/ }), 362 363 /***/ 4306: 364 /***/ (function(module, exports) { 365 366 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 367 autosize 4.0.4 368 license: MIT 369 http://www.jacklmoore.com/autosize 370 */ 371 (function (global, factory) { 372 if (true) { 373 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 374 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 375 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 376 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 377 } else { var mod; } 378 })(this, function (module, exports) { 379 'use strict'; 380 381 var map = typeof Map === "function" ? new Map() : function () { 382 var keys = []; 383 var values = []; 384 385 return { 386 has: function has(key) { 387 return keys.indexOf(key) > -1; 388 }, 389 get: function get(key) { 390 return values[keys.indexOf(key)]; 391 }, 392 set: function set(key, value) { 393 if (keys.indexOf(key) === -1) { 394 keys.push(key); 395 values.push(value); 396 } 397 }, 398 delete: function _delete(key) { 399 var index = keys.indexOf(key); 400 if (index > -1) { 401 keys.splice(index, 1); 402 values.splice(index, 1); 403 } 404 } 405 }; 406 }(); 407 408 var createEvent = function createEvent(name) { 409 return new Event(name, { bubbles: true }); 410 }; 411 try { 412 new Event('test'); 413 } catch (e) { 414 // IE does not support `new Event()` 415 createEvent = function createEvent(name) { 416 var evt = document.createEvent('Event'); 417 evt.initEvent(name, true, false); 418 return evt; 419 }; 420 } 421 422 function assign(ta) { 423 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 424 425 var heightOffset = null; 426 var clientWidth = null; 427 var cachedHeight = null; 428 429 function init() { 430 var style = window.getComputedStyle(ta, null); 431 432 if (style.resize === 'vertical') { 433 ta.style.resize = 'none'; 434 } else if (style.resize === 'both') { 435 ta.style.resize = 'horizontal'; 436 } 437 438 if (style.boxSizing === 'content-box') { 439 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 440 } else { 441 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 442 } 443 // Fix when a textarea is not on document body and heightOffset is Not a Number 444 if (isNaN(heightOffset)) { 445 heightOffset = 0; 446 } 447 448 update(); 449 } 450 451 function changeOverflow(value) { 452 { 453 // Chrome/Safari-specific fix: 454 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 455 // made available by removing the scrollbar. The following forces the necessary text reflow. 456 var width = ta.style.width; 457 ta.style.width = '0px'; 458 // Force reflow: 459 /* jshint ignore:start */ 460 ta.offsetWidth; 461 /* jshint ignore:end */ 462 ta.style.width = width; 463 } 464 465 ta.style.overflowY = value; 466 } 467 468 function getParentOverflows(el) { 469 var arr = []; 470 471 while (el && el.parentNode && el.parentNode instanceof Element) { 472 if (el.parentNode.scrollTop) { 473 arr.push({ 474 node: el.parentNode, 475 scrollTop: el.parentNode.scrollTop 476 }); 477 } 478 el = el.parentNode; 479 } 480 481 return arr; 482 } 483 484 function resize() { 485 if (ta.scrollHeight === 0) { 486 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 487 return; 488 } 489 490 var overflows = getParentOverflows(ta); 491 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 492 493 ta.style.height = ''; 494 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 495 496 // used to check if an update is actually necessary on window.resize 497 clientWidth = ta.clientWidth; 498 499 // prevents scroll-position jumping 500 overflows.forEach(function (el) { 501 el.node.scrollTop = el.scrollTop; 502 }); 503 504 if (docTop) { 505 document.documentElement.scrollTop = docTop; 506 } 507 } 508 509 function update() { 510 resize(); 511 512 var styleHeight = Math.round(parseFloat(ta.style.height)); 513 var computed = window.getComputedStyle(ta, null); 514 515 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 516 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 517 518 // The actual height not matching the style height (set via the resize method) indicates that 519 // the max-height has been exceeded, in which case the overflow should be allowed. 520 if (actualHeight < styleHeight) { 521 if (computed.overflowY === 'hidden') { 522 changeOverflow('scroll'); 523 resize(); 524 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 525 } 526 } else { 527 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 528 if (computed.overflowY !== 'hidden') { 529 changeOverflow('hidden'); 530 resize(); 531 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 532 } 533 } 534 535 if (cachedHeight !== actualHeight) { 536 cachedHeight = actualHeight; 537 var evt = createEvent('autosize:resized'); 538 try { 539 ta.dispatchEvent(evt); 540 } catch (err) { 541 // Firefox will throw an error on dispatchEvent for a detached element 542 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 543 } 544 } 545 } 546 547 var pageResize = function pageResize() { 548 if (ta.clientWidth !== clientWidth) { 549 update(); 550 } 551 }; 552 553 var destroy = function (style) { 554 window.removeEventListener('resize', pageResize, false); 555 ta.removeEventListener('input', update, false); 556 ta.removeEventListener('keyup', update, false); 557 ta.removeEventListener('autosize:destroy', destroy, false); 558 ta.removeEventListener('autosize:update', update, false); 559 560 Object.keys(style).forEach(function (key) { 561 ta.style[key] = style[key]; 562 }); 563 564 map.delete(ta); 565 }.bind(ta, { 566 height: ta.style.height, 567 resize: ta.style.resize, 568 overflowY: ta.style.overflowY, 569 overflowX: ta.style.overflowX, 570 wordWrap: ta.style.wordWrap 571 }); 572 573 ta.addEventListener('autosize:destroy', destroy, false); 574 575 // IE9 does not fire onpropertychange or oninput for deletions, 576 // so binding to onkeyup to catch most of those events. 577 // There is no way that I know of to detect something like 'cut' in IE9. 578 if ('onpropertychange' in ta && 'oninput' in ta) { 579 ta.addEventListener('keyup', update, false); 580 } 581 582 window.addEventListener('resize', pageResize, false); 583 ta.addEventListener('input', update, false); 584 ta.addEventListener('autosize:update', update, false); 585 ta.style.overflowX = 'hidden'; 586 ta.style.wordWrap = 'break-word'; 587 588 map.set(ta, { 589 destroy: destroy, 590 update: update 591 }); 592 593 init(); 594 } 595 596 function destroy(ta) { 597 var methods = map.get(ta); 598 if (methods) { 599 methods.destroy(); 600 } 601 } 602 603 function update(ta) { 604 var methods = map.get(ta); 605 if (methods) { 606 methods.update(); 607 } 608 } 609 610 var autosize = null; 611 612 // Do nothing in Node.js environment and IE8 (or lower) 613 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 614 autosize = function autosize(el) { 615 return el; 616 }; 617 autosize.destroy = function (el) { 618 return el; 619 }; 620 autosize.update = function (el) { 621 return el; 622 }; 623 } else { 624 autosize = function autosize(el, options) { 625 if (el) { 626 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 627 return assign(x, options); 628 }); 629 } 630 return el; 631 }; 632 autosize.destroy = function (el) { 633 if (el) { 634 Array.prototype.forEach.call(el.length ? el : [el], destroy); 635 } 636 return el; 637 }; 638 autosize.update = function (el) { 639 if (el) { 640 Array.prototype.forEach.call(el.length ? el : [el], update); 641 } 642 return el; 643 }; 644 } 645 646 exports.default = autosize; 647 module.exports = exports['default']; 648 }); 649 650 /***/ }), 651 652 /***/ 4462: 653 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { 654 655 "use strict"; 656 657 var __extends = (this && this.__extends) || (function () { 658 var extendStatics = Object.setPrototypeOf || 659 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 660 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 661 return function (d, b) { 662 extendStatics(d, b); 663 function __() { this.constructor = d; } 664 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 665 }; 666 })(); 667 var __assign = (this && this.__assign) || Object.assign || function(t) { 668 for (var s, i = 1, n = arguments.length; i < n; i++) { 669 s = arguments[i]; 670 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 671 t[p] = s[p]; 672 } 673 return t; 674 }; 675 var __rest = (this && this.__rest) || function (s, e) { 676 var t = {}; 677 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 678 t[p] = s[p]; 679 if (s != null && typeof Object.getOwnPropertySymbols === "function") 680 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 681 t[p[i]] = s[p[i]]; 682 return t; 683 }; 684 exports.__esModule = true; 685 var React = __webpack_require__(1609); 686 var PropTypes = __webpack_require__(5826); 687 var autosize = __webpack_require__(4306); 688 var _getLineHeight = __webpack_require__(461); 689 var getLineHeight = _getLineHeight; 690 var RESIZED = "autosize:resized"; 691 /** 692 * A light replacement for built-in textarea component 693 * which automaticaly adjusts its height to match the content 694 */ 695 var TextareaAutosizeClass = /** @class */ (function (_super) { 696 __extends(TextareaAutosizeClass, _super); 697 function TextareaAutosizeClass() { 698 var _this = _super !== null && _super.apply(this, arguments) || this; 699 _this.state = { 700 lineHeight: null 701 }; 702 _this.textarea = null; 703 _this.onResize = function (e) { 704 if (_this.props.onResize) { 705 _this.props.onResize(e); 706 } 707 }; 708 _this.updateLineHeight = function () { 709 if (_this.textarea) { 710 _this.setState({ 711 lineHeight: getLineHeight(_this.textarea) 712 }); 713 } 714 }; 715 _this.onChange = function (e) { 716 var onChange = _this.props.onChange; 717 _this.currentValue = e.currentTarget.value; 718 onChange && onChange(e); 719 }; 720 return _this; 721 } 722 TextareaAutosizeClass.prototype.componentDidMount = function () { 723 var _this = this; 724 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 725 if (typeof maxRows === "number") { 726 this.updateLineHeight(); 727 } 728 if (typeof maxRows === "number" || async) { 729 /* 730 the defer is needed to: 731 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 732 - support StyledComponents (see #71) 733 */ 734 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 735 } 736 else { 737 this.textarea && autosize(this.textarea); 738 } 739 if (this.textarea) { 740 this.textarea.addEventListener(RESIZED, this.onResize); 741 } 742 }; 743 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 744 if (this.textarea) { 745 this.textarea.removeEventListener(RESIZED, this.onResize); 746 autosize.destroy(this.textarea); 747 } 748 }; 749 TextareaAutosizeClass.prototype.render = function () { 750 var _this = this; 751 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; 752 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 753 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 754 _this.textarea = element; 755 if (typeof _this.props.innerRef === 'function') { 756 _this.props.innerRef(element); 757 } 758 else if (_this.props.innerRef) { 759 _this.props.innerRef.current = element; 760 } 761 } }), children)); 762 }; 763 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 764 this.textarea && autosize.update(this.textarea); 765 }; 766 TextareaAutosizeClass.defaultProps = { 767 rows: 1, 768 async: false 769 }; 770 TextareaAutosizeClass.propTypes = { 771 rows: PropTypes.number, 772 maxRows: PropTypes.number, 773 onResize: PropTypes.func, 774 innerRef: PropTypes.any, 775 async: PropTypes.bool 776 }; 777 return TextareaAutosizeClass; 778 }(React.Component)); 779 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 780 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 781 }); 782 783 784 /***/ }), 785 786 /***/ 5215: 787 /***/ ((module) => { 788 789 "use strict"; 790 791 792 // do not edit .js files directly - edit src/index.jst 793 794 795 796 module.exports = function equal(a, b) { 797 if (a === b) return true; 798 799 if (a && b && typeof a == 'object' && typeof b == 'object') { 800 if (a.constructor !== b.constructor) return false; 801 802 var length, i, keys; 803 if (Array.isArray(a)) { 804 length = a.length; 805 if (length != b.length) return false; 806 for (i = length; i-- !== 0;) 807 if (!equal(a[i], b[i])) return false; 808 return true; 809 } 810 811 812 813 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 814 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 815 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 816 817 keys = Object.keys(a); 818 length = keys.length; 819 if (length !== Object.keys(b).length) return false; 820 821 for (i = length; i-- !== 0;) 822 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 823 824 for (i = length; i-- !== 0;) { 825 var key = keys[i]; 826 827 if (!equal(a[key], b[key])) return false; 828 } 829 830 return true; 831 } 832 833 // true if both NaN, false otherwise 834 return a!==a && b!==b; 835 }; 836 837 838 /***/ }), 839 840 /***/ 5826: 841 /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 842 843 /** 844 * Copyright (c) 2013-present, Facebook, Inc. 845 * 846 * This source code is licensed under the MIT license found in the 847 * LICENSE file in the root directory of this source tree. 848 */ 849 850 if (false) { var throwOnDirectAccess, ReactIs; } else { 851 // By explicitly using `prop-types` you are opting into new production behavior. 852 // http://fb.me/prop-types-in-prod 853 module.exports = __webpack_require__(628)(); 854 } 855 856 857 /***/ }), 858 859 /***/ 6109: 860 /***/ ((module) => { 861 862 // This code has been refactored for 140 bytes 863 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 864 var computedStyle = function (el, prop, getComputedStyle) { 865 getComputedStyle = window.getComputedStyle; 866 867 // In one fell swoop 868 return ( 869 // If we have getComputedStyle 870 getComputedStyle ? 871 // Query it 872 // TODO: From CSS-Query notes, we might need (node, null) for FF 873 getComputedStyle(el) : 874 875 // Otherwise, we are in IE and use currentStyle 876 el.currentStyle 877 )[ 878 // Switch to camelCase for CSSOM 879 // DEV: Grabbed from jQuery 880 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 881 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 882 prop.replace(/-(\w)/gi, function (word, letter) { 883 return letter.toUpperCase(); 884 }) 885 ]; 886 }; 887 888 module.exports = computedStyle; 889 890 891 /***/ }), 892 893 /***/ 9681: 894 /***/ ((module) => { 895 896 var characterMap = { 897 "À": "A", 898 "Á": "A", 899 "Â": "A", 900 "Ã": "A", 901 "Ä": "A", 902 "Å": "A", 903 "Ấ": "A", 904 "Ắ": "A", 905 "Ẳ": "A", 906 "Ẵ": "A", 907 "Ặ": "A", 908 "Æ": "AE", 909 "Ầ": "A", 910 "Ằ": "A", 911 "Ȃ": "A", 912 "Ả": "A", 913 "Ạ": "A", 914 "Ẩ": "A", 915 "Ẫ": "A", 916 "Ậ": "A", 917 "Ç": "C", 918 "Ḉ": "C", 919 "È": "E", 920 "É": "E", 921 "Ê": "E", 922 "Ë": "E", 923 "Ế": "E", 924 "Ḗ": "E", 925 "Ề": "E", 926 "Ḕ": "E", 927 "Ḝ": "E", 928 "Ȇ": "E", 929 "Ẻ": "E", 930 "Ẽ": "E", 931 "Ẹ": "E", 932 "Ể": "E", 933 "Ễ": "E", 934 "Ệ": "E", 935 "Ì": "I", 936 "Í": "I", 937 "Î": "I", 938 "Ï": "I", 939 "Ḯ": "I", 940 "Ȋ": "I", 941 "Ỉ": "I", 942 "Ị": "I", 943 "Ð": "D", 944 "Ñ": "N", 945 "Ò": "O", 946 "Ó": "O", 947 "Ô": "O", 948 "Õ": "O", 949 "Ö": "O", 950 "Ø": "O", 951 "Ố": "O", 952 "Ṍ": "O", 953 "Ṓ": "O", 954 "Ȏ": "O", 955 "Ỏ": "O", 956 "Ọ": "O", 957 "Ổ": "O", 958 "Ỗ": "O", 959 "Ộ": "O", 960 "Ờ": "O", 961 "Ở": "O", 962 "Ỡ": "O", 963 "Ớ": "O", 964 "Ợ": "O", 965 "Ù": "U", 966 "Ú": "U", 967 "Û": "U", 968 "Ü": "U", 969 "Ủ": "U", 970 "Ụ": "U", 971 "Ử": "U", 972 "Ữ": "U", 973 "Ự": "U", 974 "Ý": "Y", 975 "à": "a", 976 "á": "a", 977 "â": "a", 978 "ã": "a", 979 "ä": "a", 980 "å": "a", 981 "ấ": "a", 982 "ắ": "a", 983 "ẳ": "a", 984 "ẵ": "a", 985 "ặ": "a", 986 "æ": "ae", 987 "ầ": "a", 988 "ằ": "a", 989 "ȃ": "a", 990 "ả": "a", 991 "ạ": "a", 992 "ẩ": "a", 993 "ẫ": "a", 994 "ậ": "a", 995 "ç": "c", 996 "ḉ": "c", 997 "è": "e", 998 "é": "e", 999 "ê": "e", 1000 "ë": "e", 1001 "ế": "e", 1002 "ḗ": "e", 1003 "ề": "e", 1004 "ḕ": "e", 1005 "ḝ": "e", 1006 "ȇ": "e", 1007 "ẻ": "e", 1008 "ẽ": "e", 1009 "ẹ": "e", 1010 "ể": "e", 1011 "ễ": "e", 1012 "ệ": "e", 1013 "ì": "i", 1014 "í": "i", 1015 "î": "i", 1016 "ï": "i", 1017 "ḯ": "i", 1018 "ȋ": "i", 1019 "ỉ": "i", 1020 "ị": "i", 1021 "ð": "d", 1022 "ñ": "n", 1023 "ò": "o", 1024 "ó": "o", 1025 "ô": "o", 1026 "õ": "o", 1027 "ö": "o", 1028 "ø": "o", 1029 "ố": "o", 1030 "ṍ": "o", 1031 "ṓ": "o", 1032 "ȏ": "o", 1033 "ỏ": "o", 1034 "ọ": "o", 1035 "ổ": "o", 1036 "ỗ": "o", 1037 "ộ": "o", 1038 "ờ": "o", 1039 "ở": "o", 1040 "ỡ": "o", 1041 "ớ": "o", 1042 "ợ": "o", 1043 "ù": "u", 1044 "ú": "u", 1045 "û": "u", 1046 "ü": "u", 1047 "ủ": "u", 1048 "ụ": "u", 1049 "ử": "u", 1050 "ữ": "u", 1051 "ự": "u", 1052 "ý": "y", 1053 "ÿ": "y", 1054 "Ā": "A", 1055 "ā": "a", 1056 "Ă": "A", 1057 "ă": "a", 1058 "Ą": "A", 1059 "ą": "a", 1060 "Ć": "C", 1061 "ć": "c", 1062 "Ĉ": "C", 1063 "ĉ": "c", 1064 "Ċ": "C", 1065 "ċ": "c", 1066 "Č": "C", 1067 "č": "c", 1068 "C̆": "C", 1069 "c̆": "c", 1070 "Ď": "D", 1071 "ď": "d", 1072 "Đ": "D", 1073 "đ": "d", 1074 "Ē": "E", 1075 "ē": "e", 1076 "Ĕ": "E", 1077 "ĕ": "e", 1078 "Ė": "E", 1079 "ė": "e", 1080 "Ę": "E", 1081 "ę": "e", 1082 "Ě": "E", 1083 "ě": "e", 1084 "Ĝ": "G", 1085 "Ǵ": "G", 1086 "ĝ": "g", 1087 "ǵ": "g", 1088 "Ğ": "G", 1089 "ğ": "g", 1090 "Ġ": "G", 1091 "ġ": "g", 1092 "Ģ": "G", 1093 "ģ": "g", 1094 "Ĥ": "H", 1095 "ĥ": "h", 1096 "Ħ": "H", 1097 "ħ": "h", 1098 "Ḫ": "H", 1099 "ḫ": "h", 1100 "Ĩ": "I", 1101 "ĩ": "i", 1102 "Ī": "I", 1103 "ī": "i", 1104 "Ĭ": "I", 1105 "ĭ": "i", 1106 "Į": "I", 1107 "į": "i", 1108 "İ": "I", 1109 "ı": "i", 1110 "IJ": "IJ", 1111 "ij": "ij", 1112 "Ĵ": "J", 1113 "ĵ": "j", 1114 "Ķ": "K", 1115 "ķ": "k", 1116 "Ḱ": "K", 1117 "ḱ": "k", 1118 "K̆": "K", 1119 "k̆": "k", 1120 "Ĺ": "L", 1121 "ĺ": "l", 1122 "Ļ": "L", 1123 "ļ": "l", 1124 "Ľ": "L", 1125 "ľ": "l", 1126 "Ŀ": "L", 1127 "ŀ": "l", 1128 "Ł": "l", 1129 "ł": "l", 1130 "Ḿ": "M", 1131 "ḿ": "m", 1132 "M̆": "M", 1133 "m̆": "m", 1134 "Ń": "N", 1135 "ń": "n", 1136 "Ņ": "N", 1137 "ņ": "n", 1138 "Ň": "N", 1139 "ň": "n", 1140 "ʼn": "n", 1141 "N̆": "N", 1142 "n̆": "n", 1143 "Ō": "O", 1144 "ō": "o", 1145 "Ŏ": "O", 1146 "ŏ": "o", 1147 "Ő": "O", 1148 "ő": "o", 1149 "Œ": "OE", 1150 "œ": "oe", 1151 "P̆": "P", 1152 "p̆": "p", 1153 "Ŕ": "R", 1154 "ŕ": "r", 1155 "Ŗ": "R", 1156 "ŗ": "r", 1157 "Ř": "R", 1158 "ř": "r", 1159 "R̆": "R", 1160 "r̆": "r", 1161 "Ȓ": "R", 1162 "ȓ": "r", 1163 "Ś": "S", 1164 "ś": "s", 1165 "Ŝ": "S", 1166 "ŝ": "s", 1167 "Ş": "S", 1168 "Ș": "S", 1169 "ș": "s", 1170 "ş": "s", 1171 "Š": "S", 1172 "š": "s", 1173 "Ţ": "T", 1174 "ţ": "t", 1175 "ț": "t", 1176 "Ț": "T", 1177 "Ť": "T", 1178 "ť": "t", 1179 "Ŧ": "T", 1180 "ŧ": "t", 1181 "T̆": "T", 1182 "t̆": "t", 1183 "Ũ": "U", 1184 "ũ": "u", 1185 "Ū": "U", 1186 "ū": "u", 1187 "Ŭ": "U", 1188 "ŭ": "u", 1189 "Ů": "U", 1190 "ů": "u", 1191 "Ű": "U", 1192 "ű": "u", 1193 "Ų": "U", 1194 "ų": "u", 1195 "Ȗ": "U", 1196 "ȗ": "u", 1197 "V̆": "V", 1198 "v̆": "v", 1199 "Ŵ": "W", 1200 "ŵ": "w", 1201 "Ẃ": "W", 1202 "ẃ": "w", 1203 "X̆": "X", 1204 "x̆": "x", 1205 "Ŷ": "Y", 1206 "ŷ": "y", 1207 "Ÿ": "Y", 1208 "Y̆": "Y", 1209 "y̆": "y", 1210 "Ź": "Z", 1211 "ź": "z", 1212 "Ż": "Z", 1213 "ż": "z", 1214 "Ž": "Z", 1215 "ž": "z", 1216 "ſ": "s", 1217 "ƒ": "f", 1218 "Ơ": "O", 1219 "ơ": "o", 1220 "Ư": "U", 1221 "ư": "u", 1222 "Ǎ": "A", 1223 "ǎ": "a", 1224 "Ǐ": "I", 1225 "ǐ": "i", 1226 "Ǒ": "O", 1227 "ǒ": "o", 1228 "Ǔ": "U", 1229 "ǔ": "u", 1230 "Ǖ": "U", 1231 "ǖ": "u", 1232 "Ǘ": "U", 1233 "ǘ": "u", 1234 "Ǚ": "U", 1235 "ǚ": "u", 1236 "Ǜ": "U", 1237 "ǜ": "u", 1238 "Ứ": "U", 1239 "ứ": "u", 1240 "Ṹ": "U", 1241 "ṹ": "u", 1242 "Ǻ": "A", 1243 "ǻ": "a", 1244 "Ǽ": "AE", 1245 "ǽ": "ae", 1246 "Ǿ": "O", 1247 "ǿ": "o", 1248 "Þ": "TH", 1249 "þ": "th", 1250 "Ṕ": "P", 1251 "ṕ": "p", 1252 "Ṥ": "S", 1253 "ṥ": "s", 1254 "X́": "X", 1255 "x́": "x", 1256 "Ѓ": "Г", 1257 "ѓ": "г", 1258 "Ќ": "К", 1259 "ќ": "к", 1260 "A̋": "A", 1261 "a̋": "a", 1262 "E̋": "E", 1263 "e̋": "e", 1264 "I̋": "I", 1265 "i̋": "i", 1266 "Ǹ": "N", 1267 "ǹ": "n", 1268 "Ồ": "O", 1269 "ồ": "o", 1270 "Ṑ": "O", 1271 "ṑ": "o", 1272 "Ừ": "U", 1273 "ừ": "u", 1274 "Ẁ": "W", 1275 "ẁ": "w", 1276 "Ỳ": "Y", 1277 "ỳ": "y", 1278 "Ȁ": "A", 1279 "ȁ": "a", 1280 "Ȅ": "E", 1281 "ȅ": "e", 1282 "Ȉ": "I", 1283 "ȉ": "i", 1284 "Ȍ": "O", 1285 "ȍ": "o", 1286 "Ȑ": "R", 1287 "ȑ": "r", 1288 "Ȕ": "U", 1289 "ȕ": "u", 1290 "B̌": "B", 1291 "b̌": "b", 1292 "Č̣": "C", 1293 "č̣": "c", 1294 "Ê̌": "E", 1295 "ê̌": "e", 1296 "F̌": "F", 1297 "f̌": "f", 1298 "Ǧ": "G", 1299 "ǧ": "g", 1300 "Ȟ": "H", 1301 "ȟ": "h", 1302 "J̌": "J", 1303 "ǰ": "j", 1304 "Ǩ": "K", 1305 "ǩ": "k", 1306 "M̌": "M", 1307 "m̌": "m", 1308 "P̌": "P", 1309 "p̌": "p", 1310 "Q̌": "Q", 1311 "q̌": "q", 1312 "Ř̩": "R", 1313 "ř̩": "r", 1314 "Ṧ": "S", 1315 "ṧ": "s", 1316 "V̌": "V", 1317 "v̌": "v", 1318 "W̌": "W", 1319 "w̌": "w", 1320 "X̌": "X", 1321 "x̌": "x", 1322 "Y̌": "Y", 1323 "y̌": "y", 1324 "A̧": "A", 1325 "a̧": "a", 1326 "B̧": "B", 1327 "b̧": "b", 1328 "Ḑ": "D", 1329 "ḑ": "d", 1330 "Ȩ": "E", 1331 "ȩ": "e", 1332 "Ɛ̧": "E", 1333 "ɛ̧": "e", 1334 "Ḩ": "H", 1335 "ḩ": "h", 1336 "I̧": "I", 1337 "i̧": "i", 1338 "Ɨ̧": "I", 1339 "ɨ̧": "i", 1340 "M̧": "M", 1341 "m̧": "m", 1342 "O̧": "O", 1343 "o̧": "o", 1344 "Q̧": "Q", 1345 "q̧": "q", 1346 "U̧": "U", 1347 "u̧": "u", 1348 "X̧": "X", 1349 "x̧": "x", 1350 "Z̧": "Z", 1351 "z̧": "z", 1352 "й":"и", 1353 "Й":"И", 1354 "ё":"е", 1355 "Ё":"Е", 1356 }; 1357 1358 var chars = Object.keys(characterMap).join('|'); 1359 var allAccents = new RegExp(chars, 'g'); 1360 var firstAccent = new RegExp(chars, ''); 1361 1362 function matcher(match) { 1363 return characterMap[match]; 1364 } 1365 1366 var removeAccents = function(string) { 1367 return string.replace(allAccents, matcher); 1368 }; 1369 1370 var hasAccents = function(string) { 1371 return !!string.match(firstAccent); 1372 }; 1373 1374 module.exports = removeAccents; 1375 module.exports.has = hasAccents; 1376 module.exports.remove = removeAccents; 1377 1378 1379 /***/ }) 1380 1381 /******/ }); 1382 /************************************************************************/ 1383 /******/ // The module cache 1384 /******/ var __webpack_module_cache__ = {}; 1385 /******/ 1386 /******/ // The require function 1387 /******/ function __webpack_require__(moduleId) { 1388 /******/ // Check if module is in cache 1389 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 1390 /******/ if (cachedModule !== undefined) { 1391 /******/ return cachedModule.exports; 1392 /******/ } 1393 /******/ // Create a new module (and put it into the cache) 1394 /******/ var module = __webpack_module_cache__[moduleId] = { 1395 /******/ // no module.id needed 1396 /******/ // no module.loaded needed 1397 /******/ exports: {} 1398 /******/ }; 1399 /******/ 1400 /******/ // Execute the module function 1401 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 1402 /******/ 1403 /******/ // Return the exports of the module 1404 /******/ return module.exports; 1405 /******/ } 1406 /******/ 1407 /************************************************************************/ 1408 /******/ /* webpack/runtime/compat get default export */ 1409 /******/ (() => { 1410 /******/ // getDefaultExport function for compatibility with non-harmony modules 1411 /******/ __webpack_require__.n = (module) => { 1412 /******/ var getter = module && module.__esModule ? 1413 /******/ () => (module['default']) : 1414 /******/ () => (module); 1415 /******/ __webpack_require__.d(getter, { a: getter }); 1416 /******/ return getter; 1417 /******/ }; 1418 /******/ })(); 1419 /******/ 1420 /******/ /* webpack/runtime/define property getters */ 1421 /******/ (() => { 1422 /******/ // define getter functions for harmony exports 1423 /******/ __webpack_require__.d = (exports, definition) => { 1424 /******/ for(var key in definition) { 1425 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 1426 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 1427 /******/ } 1428 /******/ } 1429 /******/ }; 1430 /******/ })(); 1431 /******/ 1432 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 1433 /******/ (() => { 1434 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 1435 /******/ })(); 1436 /******/ 1437 /******/ /* webpack/runtime/make namespace object */ 1438 /******/ (() => { 1439 /******/ // define __esModule on exports 1440 /******/ __webpack_require__.r = (exports) => { 1441 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 1442 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 1443 /******/ } 1444 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 1445 /******/ }; 1446 /******/ })(); 1447 /******/ 1448 /************************************************************************/ 1449 var __webpack_exports__ = {}; 1450 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 1451 (() => { 1452 "use strict"; 1453 // ESM COMPAT FLAG 1454 __webpack_require__.r(__webpack_exports__); 1455 1456 // EXPORTS 1457 __webpack_require__.d(__webpack_exports__, { 1458 AlignmentToolbar: () => (/* reexport */ AlignmentToolbar), 1459 Autocomplete: () => (/* reexport */ Autocomplete), 1460 AutosaveMonitor: () => (/* reexport */ autosave_monitor_default), 1461 BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar), 1462 BlockControls: () => (/* reexport */ BlockControls), 1463 BlockEdit: () => (/* reexport */ BlockEdit), 1464 BlockEditorKeyboardShortcuts: () => (/* reexport */ BlockEditorKeyboardShortcuts), 1465 BlockFormatControls: () => (/* reexport */ BlockFormatControls), 1466 BlockIcon: () => (/* reexport */ BlockIcon), 1467 BlockInspector: () => (/* reexport */ BlockInspector), 1468 BlockList: () => (/* reexport */ BlockList), 1469 BlockMover: () => (/* reexport */ BlockMover), 1470 BlockNavigationDropdown: () => (/* reexport */ BlockNavigationDropdown), 1471 BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer), 1472 BlockSettingsMenu: () => (/* reexport */ BlockSettingsMenu), 1473 BlockTitle: () => (/* reexport */ BlockTitle), 1474 BlockToolbar: () => (/* reexport */ BlockToolbar), 1475 CharacterCount: () => (/* reexport */ CharacterCount), 1476 ColorPalette: () => (/* reexport */ ColorPalette), 1477 ContrastChecker: () => (/* reexport */ ContrastChecker), 1478 CopyHandler: () => (/* reexport */ CopyHandler), 1479 DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender), 1480 DocumentBar: () => (/* reexport */ DocumentBar), 1481 DocumentOutline: () => (/* reexport */ DocumentOutline), 1482 DocumentOutlineCheck: () => (/* reexport */ DocumentOutlineCheck), 1483 EditorHistoryRedo: () => (/* reexport */ redo_redo_default), 1484 EditorHistoryUndo: () => (/* reexport */ undo_undo_default), 1485 EditorKeyboardShortcuts: () => (/* reexport */ EditorKeyboardShortcuts), 1486 EditorKeyboardShortcutsRegister: () => (/* reexport */ register_shortcuts_default), 1487 EditorNotices: () => (/* reexport */ editor_notices_default), 1488 EditorProvider: () => (/* reexport */ provider_default), 1489 EditorSnackbars: () => (/* reexport */ EditorSnackbars), 1490 EntitiesSavedStates: () => (/* reexport */ EntitiesSavedStates), 1491 ErrorBoundary: () => (/* reexport */ error_boundary_default), 1492 FontSizePicker: () => (/* reexport */ FontSizePicker), 1493 InnerBlocks: () => (/* reexport */ InnerBlocks), 1494 Inserter: () => (/* reexport */ Inserter), 1495 InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls), 1496 InspectorControls: () => (/* reexport */ InspectorControls), 1497 LocalAutosaveMonitor: () => (/* reexport */ local_autosave_monitor_default), 1498 MediaPlaceholder: () => (/* reexport */ MediaPlaceholder), 1499 MediaUpload: () => (/* reexport */ MediaUpload), 1500 MediaUploadCheck: () => (/* reexport */ MediaUploadCheck), 1501 MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView), 1502 NavigableToolbar: () => (/* reexport */ NavigableToolbar), 1503 ObserveTyping: () => (/* reexport */ ObserveTyping), 1504 PageAttributesCheck: () => (/* reexport */ check_check_default), 1505 PageAttributesOrder: () => (/* reexport */ PageAttributesOrderWithChecks), 1506 PageAttributesPanel: () => (/* reexport */ PageAttributesPanel), 1507 PageAttributesParent: () => (/* reexport */ parent_parent_default), 1508 PageTemplate: () => (/* reexport */ classic_theme_default), 1509 PanelColorSettings: () => (/* reexport */ PanelColorSettings), 1510 PlainText: () => (/* reexport */ PlainText), 1511 PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item_default), 1512 PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel_default), 1513 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 1514 PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel_default), 1515 PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info_default), 1516 PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel_default), 1517 PluginPreviewMenuItem: () => (/* reexport */ PluginPreviewMenuItem), 1518 PluginSidebar: () => (/* reexport */ PluginSidebar), 1519 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 1520 PostAuthor: () => (/* reexport */ post_author_default), 1521 PostAuthorCheck: () => (/* reexport */ PostAuthorCheck), 1522 PostAuthorPanel: () => (/* reexport */ panel_default), 1523 PostComments: () => (/* reexport */ post_comments_default), 1524 PostDiscussionPanel: () => (/* reexport */ PostDiscussionPanel), 1525 PostExcerpt: () => (/* reexport */ PostExcerpt), 1526 PostExcerptCheck: () => (/* reexport */ post_excerpt_check_check_default), 1527 PostExcerptPanel: () => (/* reexport */ PostExcerptPanel), 1528 PostFeaturedImage: () => (/* reexport */ post_featured_image_default), 1529 PostFeaturedImageCheck: () => (/* reexport */ post_featured_image_check_check_default), 1530 PostFeaturedImagePanel: () => (/* reexport */ PostFeaturedImagePanel), 1531 PostFormat: () => (/* reexport */ PostFormat), 1532 PostFormatCheck: () => (/* reexport */ PostFormatCheck), 1533 PostLastRevision: () => (/* reexport */ post_last_revision_default), 1534 PostLastRevisionCheck: () => (/* reexport */ post_last_revision_check_check_default), 1535 PostLastRevisionPanel: () => (/* reexport */ panel_panel_default), 1536 PostLockedModal: () => (/* reexport */ post_locked_modal_default), 1537 PostPendingStatus: () => (/* reexport */ post_pending_status_default), 1538 PostPendingStatusCheck: () => (/* reexport */ post_pending_status_check_check_default), 1539 PostPingbacks: () => (/* reexport */ post_pingbacks_default), 1540 PostPreviewButton: () => (/* reexport */ PostPreviewButton), 1541 PostPublishButton: () => (/* reexport */ post_publish_button_default), 1542 PostPublishButtonLabel: () => (/* reexport */ PublishButtonLabel), 1543 PostPublishPanel: () => (/* reexport */ post_publish_panel_default), 1544 PostSavedState: () => (/* reexport */ PostSavedState), 1545 PostSchedule: () => (/* reexport */ PostSchedule), 1546 PostScheduleCheck: () => (/* reexport */ PostScheduleCheck), 1547 PostScheduleLabel: () => (/* reexport */ PostScheduleLabel), 1548 PostSchedulePanel: () => (/* reexport */ PostSchedulePanel), 1549 PostSticky: () => (/* reexport */ PostSticky), 1550 PostStickyCheck: () => (/* reexport */ PostStickyCheck), 1551 PostSwitchToDraftButton: () => (/* reexport */ PostSwitchToDraftButton), 1552 PostSyncStatus: () => (/* reexport */ PostSyncStatus), 1553 PostTaxonomies: () => (/* reexport */ post_taxonomies_default), 1554 PostTaxonomiesCheck: () => (/* reexport */ PostTaxonomiesCheck), 1555 PostTaxonomiesFlatTermSelector: () => (/* reexport */ FlatTermSelector), 1556 PostTaxonomiesHierarchicalTermSelector: () => (/* reexport */ HierarchicalTermSelector), 1557 PostTaxonomiesPanel: () => (/* reexport */ panel_PostTaxonomies), 1558 PostTemplatePanel: () => (/* reexport */ PostTemplatePanel), 1559 PostTextEditor: () => (/* reexport */ PostTextEditor), 1560 PostTitle: () => (/* reexport */ post_title_default), 1561 PostTitleRaw: () => (/* reexport */ post_title_raw_default), 1562 PostTrash: () => (/* reexport */ PostTrash), 1563 PostTrashCheck: () => (/* reexport */ PostTrashCheck), 1564 PostTypeSupportCheck: () => (/* reexport */ post_type_support_check_default), 1565 PostURL: () => (/* reexport */ PostURL), 1566 PostURLCheck: () => (/* reexport */ PostURLCheck), 1567 PostURLLabel: () => (/* reexport */ PostURLLabel), 1568 PostURLPanel: () => (/* reexport */ PostURLPanel), 1569 PostVisibility: () => (/* reexport */ PostVisibility), 1570 PostVisibilityCheck: () => (/* reexport */ PostVisibilityCheck), 1571 PostVisibilityLabel: () => (/* reexport */ PostVisibilityLabel), 1572 RichText: () => (/* reexport */ RichText), 1573 RichTextShortcut: () => (/* reexport */ RichTextShortcut), 1574 RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton), 1575 ServerSideRender: () => (/* reexport */ (external_wp_serverSideRender_default())), 1576 SkipToSelectedBlock: () => (/* reexport */ SkipToSelectedBlock), 1577 TableOfContents: () => (/* reexport */ table_of_contents_default), 1578 TextEditorGlobalKeyboardShortcuts: () => (/* reexport */ TextEditorGlobalKeyboardShortcuts), 1579 ThemeSupportCheck: () => (/* reexport */ ThemeSupportCheck), 1580 TimeToRead: () => (/* reexport */ TimeToRead), 1581 URLInput: () => (/* reexport */ URLInput), 1582 URLInputButton: () => (/* reexport */ URLInputButton), 1583 URLPopover: () => (/* reexport */ URLPopover), 1584 UnsavedChangesWarning: () => (/* reexport */ UnsavedChangesWarning), 1585 VisualEditorGlobalKeyboardShortcuts: () => (/* reexport */ VisualEditorGlobalKeyboardShortcuts), 1586 Warning: () => (/* reexport */ Warning), 1587 WordCount: () => (/* reexport */ WordCount), 1588 WritingFlow: () => (/* reexport */ WritingFlow), 1589 __unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent), 1590 cleanForSlug: () => (/* reexport */ cleanForSlug), 1591 createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC), 1592 getColorClassName: () => (/* reexport */ getColorClassName), 1593 getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues), 1594 getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue), 1595 getFontSize: () => (/* reexport */ getFontSize), 1596 getFontSizeClass: () => (/* reexport */ getFontSizeClass), 1597 getTemplatePartIcon: () => (/* reexport */ getTemplatePartIcon), 1598 mediaUpload: () => (/* reexport */ mediaUpload), 1599 privateApis: () => (/* reexport */ privateApis), 1600 registerEntityAction: () => (/* reexport */ api_registerEntityAction), 1601 registerEntityField: () => (/* reexport */ api_registerEntityField), 1602 store: () => (/* reexport */ store_store), 1603 storeConfig: () => (/* reexport */ storeConfig), 1604 transformStyles: () => (/* reexport */ external_wp_blockEditor_namespaceObject.transformStyles), 1605 unregisterEntityAction: () => (/* reexport */ api_unregisterEntityAction), 1606 unregisterEntityField: () => (/* reexport */ api_unregisterEntityField), 1607 useEntitiesSavedStatesIsDirty: () => (/* reexport */ useIsDirty), 1608 usePostScheduleLabel: () => (/* reexport */ usePostScheduleLabel), 1609 usePostURLLabel: () => (/* reexport */ usePostURLLabel), 1610 usePostVisibilityLabel: () => (/* reexport */ usePostVisibilityLabel), 1611 userAutocompleter: () => (/* reexport */ user_default), 1612 withColorContext: () => (/* reexport */ withColorContext), 1613 withColors: () => (/* reexport */ withColors), 1614 withFontSizes: () => (/* reexport */ withFontSizes) 1615 }); 1616 1617 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js 1618 var selectors_namespaceObject = {}; 1619 __webpack_require__.r(selectors_namespaceObject); 1620 __webpack_require__.d(selectors_namespaceObject, { 1621 __experimentalGetDefaultTemplatePartAreas: () => (__experimentalGetDefaultTemplatePartAreas), 1622 __experimentalGetDefaultTemplateType: () => (__experimentalGetDefaultTemplateType), 1623 __experimentalGetDefaultTemplateTypes: () => (__experimentalGetDefaultTemplateTypes), 1624 __experimentalGetTemplateInfo: () => (__experimentalGetTemplateInfo), 1625 __unstableIsEditorReady: () => (__unstableIsEditorReady), 1626 canInsertBlockType: () => (canInsertBlockType), 1627 canUserUseUnfilteredHTML: () => (canUserUseUnfilteredHTML), 1628 didPostSaveRequestFail: () => (didPostSaveRequestFail), 1629 didPostSaveRequestSucceed: () => (didPostSaveRequestSucceed), 1630 getActivePostLock: () => (getActivePostLock), 1631 getAdjacentBlockClientId: () => (getAdjacentBlockClientId), 1632 getAutosaveAttribute: () => (getAutosaveAttribute), 1633 getBlock: () => (getBlock), 1634 getBlockAttributes: () => (getBlockAttributes), 1635 getBlockCount: () => (getBlockCount), 1636 getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId), 1637 getBlockIndex: () => (getBlockIndex), 1638 getBlockInsertionPoint: () => (getBlockInsertionPoint), 1639 getBlockListSettings: () => (getBlockListSettings), 1640 getBlockMode: () => (getBlockMode), 1641 getBlockName: () => (getBlockName), 1642 getBlockOrder: () => (getBlockOrder), 1643 getBlockRootClientId: () => (getBlockRootClientId), 1644 getBlockSelectionEnd: () => (getBlockSelectionEnd), 1645 getBlockSelectionStart: () => (getBlockSelectionStart), 1646 getBlocks: () => (getBlocks), 1647 getBlocksByClientId: () => (getBlocksByClientId), 1648 getClientIdsOfDescendants: () => (getClientIdsOfDescendants), 1649 getClientIdsWithDescendants: () => (getClientIdsWithDescendants), 1650 getCurrentPost: () => (getCurrentPost), 1651 getCurrentPostAttribute: () => (getCurrentPostAttribute), 1652 getCurrentPostId: () => (getCurrentPostId), 1653 getCurrentPostLastRevisionId: () => (getCurrentPostLastRevisionId), 1654 getCurrentPostRevisionsCount: () => (getCurrentPostRevisionsCount), 1655 getCurrentPostType: () => (getCurrentPostType), 1656 getCurrentTemplateId: () => (getCurrentTemplateId), 1657 getDeviceType: () => (getDeviceType), 1658 getEditedPostAttribute: () => (getEditedPostAttribute), 1659 getEditedPostContent: () => (getEditedPostContent), 1660 getEditedPostPreviewLink: () => (getEditedPostPreviewLink), 1661 getEditedPostSlug: () => (getEditedPostSlug), 1662 getEditedPostVisibility: () => (getEditedPostVisibility), 1663 getEditorBlocks: () => (getEditorBlocks), 1664 getEditorMode: () => (getEditorMode), 1665 getEditorSelection: () => (getEditorSelection), 1666 getEditorSelectionEnd: () => (getEditorSelectionEnd), 1667 getEditorSelectionStart: () => (getEditorSelectionStart), 1668 getEditorSettings: () => (getEditorSettings), 1669 getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId), 1670 getGlobalBlockCount: () => (getGlobalBlockCount), 1671 getInserterItems: () => (getInserterItems), 1672 getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId), 1673 getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds), 1674 getMultiSelectedBlocks: () => (getMultiSelectedBlocks), 1675 getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId), 1676 getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId), 1677 getNextBlockClientId: () => (getNextBlockClientId), 1678 getPermalink: () => (getPermalink), 1679 getPermalinkParts: () => (getPermalinkParts), 1680 getPostEdits: () => (getPostEdits), 1681 getPostLockUser: () => (getPostLockUser), 1682 getPostTypeLabel: () => (getPostTypeLabel), 1683 getPreviousBlockClientId: () => (getPreviousBlockClientId), 1684 getRenderingMode: () => (getRenderingMode), 1685 getSelectedBlock: () => (getSelectedBlock), 1686 getSelectedBlockClientId: () => (getSelectedBlockClientId), 1687 getSelectedBlockCount: () => (getSelectedBlockCount), 1688 getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition), 1689 getStateBeforeOptimisticTransaction: () => (getStateBeforeOptimisticTransaction), 1690 getSuggestedPostFormat: () => (getSuggestedPostFormat), 1691 getTemplate: () => (getTemplate), 1692 getTemplateLock: () => (getTemplateLock), 1693 hasChangedContent: () => (hasChangedContent), 1694 hasEditorRedo: () => (hasEditorRedo), 1695 hasEditorUndo: () => (hasEditorUndo), 1696 hasInserterItems: () => (hasInserterItems), 1697 hasMultiSelection: () => (hasMultiSelection), 1698 hasNonPostEntityChanges: () => (hasNonPostEntityChanges), 1699 hasSelectedBlock: () => (hasSelectedBlock), 1700 hasSelectedInnerBlock: () => (hasSelectedInnerBlock), 1701 inSomeHistory: () => (inSomeHistory), 1702 isAncestorMultiSelected: () => (isAncestorMultiSelected), 1703 isAutosavingPost: () => (isAutosavingPost), 1704 isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible), 1705 isBlockMultiSelected: () => (isBlockMultiSelected), 1706 isBlockSelected: () => (isBlockSelected), 1707 isBlockValid: () => (isBlockValid), 1708 isBlockWithinSelection: () => (isBlockWithinSelection), 1709 isCaretWithinFormattedText: () => (isCaretWithinFormattedText), 1710 isCleanNewPost: () => (isCleanNewPost), 1711 isCurrentPostPending: () => (isCurrentPostPending), 1712 isCurrentPostPublished: () => (isCurrentPostPublished), 1713 isCurrentPostScheduled: () => (isCurrentPostScheduled), 1714 isDeletingPost: () => (isDeletingPost), 1715 isEditedPostAutosaveable: () => (isEditedPostAutosaveable), 1716 isEditedPostBeingScheduled: () => (isEditedPostBeingScheduled), 1717 isEditedPostDateFloating: () => (isEditedPostDateFloating), 1718 isEditedPostDirty: () => (isEditedPostDirty), 1719 isEditedPostEmpty: () => (isEditedPostEmpty), 1720 isEditedPostNew: () => (isEditedPostNew), 1721 isEditedPostPublishable: () => (isEditedPostPublishable), 1722 isEditedPostSaveable: () => (isEditedPostSaveable), 1723 isEditorPanelEnabled: () => (isEditorPanelEnabled), 1724 isEditorPanelOpened: () => (isEditorPanelOpened), 1725 isEditorPanelRemoved: () => (isEditorPanelRemoved), 1726 isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock), 1727 isInserterOpened: () => (isInserterOpened), 1728 isListViewOpened: () => (isListViewOpened), 1729 isMultiSelecting: () => (isMultiSelecting), 1730 isPermalinkEditable: () => (isPermalinkEditable), 1731 isPostAutosavingLocked: () => (isPostAutosavingLocked), 1732 isPostLockTakeover: () => (isPostLockTakeover), 1733 isPostLocked: () => (isPostLocked), 1734 isPostSavingLocked: () => (isPostSavingLocked), 1735 isPreviewingPost: () => (isPreviewingPost), 1736 isPublishSidebarEnabled: () => (isPublishSidebarEnabled), 1737 isPublishSidebarOpened: () => (isPublishSidebarOpened), 1738 isPublishingPost: () => (isPublishingPost), 1739 isSavingNonPostEntityChanges: () => (isSavingNonPostEntityChanges), 1740 isSavingPost: () => (isSavingPost), 1741 isSelectionEnabled: () => (isSelectionEnabled), 1742 isTyping: () => (isTyping), 1743 isValidTemplate: () => (isValidTemplate) 1744 }); 1745 1746 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js 1747 var actions_namespaceObject = {}; 1748 __webpack_require__.r(actions_namespaceObject); 1749 __webpack_require__.d(actions_namespaceObject, { 1750 __experimentalTearDownEditor: () => (__experimentalTearDownEditor), 1751 __unstableSaveForPreview: () => (__unstableSaveForPreview), 1752 autosave: () => (autosave), 1753 clearSelectedBlock: () => (clearSelectedBlock), 1754 closePublishSidebar: () => (closePublishSidebar), 1755 createUndoLevel: () => (createUndoLevel), 1756 disablePublishSidebar: () => (disablePublishSidebar), 1757 editPost: () => (editPost), 1758 enablePublishSidebar: () => (enablePublishSidebar), 1759 enterFormattedText: () => (enterFormattedText), 1760 exitFormattedText: () => (exitFormattedText), 1761 hideInsertionPoint: () => (hideInsertionPoint), 1762 insertBlock: () => (insertBlock), 1763 insertBlocks: () => (insertBlocks), 1764 insertDefaultBlock: () => (insertDefaultBlock), 1765 lockPostAutosaving: () => (lockPostAutosaving), 1766 lockPostSaving: () => (lockPostSaving), 1767 mergeBlocks: () => (mergeBlocks), 1768 moveBlockToPosition: () => (moveBlockToPosition), 1769 moveBlocksDown: () => (moveBlocksDown), 1770 moveBlocksUp: () => (moveBlocksUp), 1771 multiSelect: () => (multiSelect), 1772 openPublishSidebar: () => (openPublishSidebar), 1773 receiveBlocks: () => (receiveBlocks), 1774 redo: () => (redo), 1775 refreshPost: () => (refreshPost), 1776 removeBlock: () => (removeBlock), 1777 removeBlocks: () => (removeBlocks), 1778 removeEditorPanel: () => (removeEditorPanel), 1779 replaceBlock: () => (replaceBlock), 1780 replaceBlocks: () => (replaceBlocks), 1781 resetBlocks: () => (resetBlocks), 1782 resetEditorBlocks: () => (resetEditorBlocks), 1783 resetPost: () => (resetPost), 1784 savePost: () => (savePost), 1785 selectBlock: () => (selectBlock), 1786 setDeviceType: () => (setDeviceType), 1787 setEditedPost: () => (setEditedPost), 1788 setIsInserterOpened: () => (setIsInserterOpened), 1789 setIsListViewOpened: () => (setIsListViewOpened), 1790 setRenderingMode: () => (setRenderingMode), 1791 setTemplateValidity: () => (setTemplateValidity), 1792 setupEditor: () => (setupEditor), 1793 setupEditorState: () => (setupEditorState), 1794 showInsertionPoint: () => (showInsertionPoint), 1795 startMultiSelect: () => (startMultiSelect), 1796 startTyping: () => (startTyping), 1797 stopMultiSelect: () => (stopMultiSelect), 1798 stopTyping: () => (stopTyping), 1799 switchEditorMode: () => (switchEditorMode), 1800 synchronizeTemplate: () => (synchronizeTemplate), 1801 toggleBlockMode: () => (toggleBlockMode), 1802 toggleDistractionFree: () => (toggleDistractionFree), 1803 toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), 1804 toggleEditorPanelOpened: () => (toggleEditorPanelOpened), 1805 togglePublishSidebar: () => (togglePublishSidebar), 1806 toggleSelection: () => (toggleSelection), 1807 toggleSpotlightMode: () => (toggleSpotlightMode), 1808 toggleTopToolbar: () => (toggleTopToolbar), 1809 trashPost: () => (trashPost), 1810 undo: () => (undo), 1811 unlockPostAutosaving: () => (unlockPostAutosaving), 1812 unlockPostSaving: () => (unlockPostSaving), 1813 updateBlock: () => (updateBlock), 1814 updateBlockAttributes: () => (updateBlockAttributes), 1815 updateBlockListSettings: () => (updateBlockListSettings), 1816 updateEditorSettings: () => (updateEditorSettings), 1817 updatePost: () => (updatePost), 1818 updatePostLock: () => (updatePostLock) 1819 }); 1820 1821 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 1822 var store_actions_namespaceObject = {}; 1823 __webpack_require__.r(store_actions_namespaceObject); 1824 __webpack_require__.d(store_actions_namespaceObject, { 1825 closeModal: () => (closeModal), 1826 disableComplementaryArea: () => (disableComplementaryArea), 1827 enableComplementaryArea: () => (enableComplementaryArea), 1828 openModal: () => (openModal), 1829 pinItem: () => (pinItem), 1830 setDefaultComplementaryArea: () => (setDefaultComplementaryArea), 1831 setFeatureDefaults: () => (setFeatureDefaults), 1832 setFeatureValue: () => (setFeatureValue), 1833 toggleFeature: () => (toggleFeature), 1834 unpinItem: () => (unpinItem) 1835 }); 1836 1837 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 1838 var store_selectors_namespaceObject = {}; 1839 __webpack_require__.r(store_selectors_namespaceObject); 1840 __webpack_require__.d(store_selectors_namespaceObject, { 1841 getActiveComplementaryArea: () => (getActiveComplementaryArea), 1842 isComplementaryAreaLoading: () => (isComplementaryAreaLoading), 1843 isFeatureActive: () => (isFeatureActive), 1844 isItemPinned: () => (isItemPinned), 1845 isModalActive: () => (isModalActive) 1846 }); 1847 1848 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/index.js 1849 var build_module_namespaceObject = {}; 1850 __webpack_require__.r(build_module_namespaceObject); 1851 __webpack_require__.d(build_module_namespaceObject, { 1852 ActionItem: () => (action_item_default), 1853 ComplementaryArea: () => (complementary_area_default), 1854 ComplementaryAreaMoreMenuItem: () => (ComplementaryAreaMoreMenuItem), 1855 FullscreenMode: () => (fullscreen_mode_default), 1856 InterfaceSkeleton: () => (interface_skeleton_default), 1857 PinnedItems: () => (pinned_items_default), 1858 store: () => (store) 1859 }); 1860 1861 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-actions.js 1862 var store_private_actions_namespaceObject = {}; 1863 __webpack_require__.r(store_private_actions_namespaceObject); 1864 __webpack_require__.d(store_private_actions_namespaceObject, { 1865 createTemplate: () => (createTemplate), 1866 hideBlockTypes: () => (hideBlockTypes), 1867 registerEntityAction: () => (registerEntityAction), 1868 registerEntityField: () => (registerEntityField), 1869 registerPostTypeSchema: () => (registerPostTypeSchema), 1870 removeTemplates: () => (removeTemplates), 1871 revertTemplate: () => (private_actions_revertTemplate), 1872 saveDirtyEntities: () => (saveDirtyEntities), 1873 setCanvasMinHeight: () => (setCanvasMinHeight), 1874 setCurrentTemplateId: () => (setCurrentTemplateId), 1875 setDefaultRenderingMode: () => (setDefaultRenderingMode), 1876 setIsReady: () => (setIsReady), 1877 showBlockTypes: () => (showBlockTypes), 1878 unregisterEntityAction: () => (unregisterEntityAction), 1879 unregisterEntityField: () => (unregisterEntityField) 1880 }); 1881 1882 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 1883 var store_private_selectors_namespaceObject = {}; 1884 __webpack_require__.r(store_private_selectors_namespaceObject); 1885 __webpack_require__.d(store_private_selectors_namespaceObject, { 1886 getCanvasMinHeight: () => (getCanvasMinHeight), 1887 getDefaultRenderingMode: () => (getDefaultRenderingMode), 1888 getEntityActions: () => (private_selectors_getEntityActions), 1889 getEntityFields: () => (private_selectors_getEntityFields), 1890 getInserter: () => (getInserter), 1891 getInserterSidebarToggleRef: () => (getInserterSidebarToggleRef), 1892 getListViewToggleRef: () => (getListViewToggleRef), 1893 getPostBlocksByName: () => (getPostBlocksByName), 1894 getPostIcon: () => (getPostIcon), 1895 hasPostMetaChanges: () => (hasPostMetaChanges), 1896 isEntityReady: () => (private_selectors_isEntityReady) 1897 }); 1898 1899 ;// external "ReactJSXRuntime" 1900 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 1901 ;// external ["wp","data"] 1902 const external_wp_data_namespaceObject = window["wp"]["data"]; 1903 ;// external ["wp","coreData"] 1904 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 1905 ;// external ["wp","element"] 1906 const external_wp_element_namespaceObject = window["wp"]["element"]; 1907 ;// external ["wp","compose"] 1908 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 1909 ;// external ["wp","hooks"] 1910 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1911 ;// external ["wp","blockEditor"] 1912 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 1913 ;// ./node_modules/@wordpress/editor/build-module/store/defaults.js 1914 1915 const EDITOR_SETTINGS_DEFAULTS = { 1916 ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, 1917 richEditingEnabled: true, 1918 codeEditingEnabled: true, 1919 fontLibraryEnabled: true, 1920 enableCustomFields: void 0, 1921 defaultRenderingMode: "post-only" 1922 }; 1923 1924 1925 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/reducer.js 1926 1927 function isReady(state = {}, action) { 1928 switch (action.type) { 1929 case "SET_IS_READY": 1930 return { 1931 ...state, 1932 [action.kind]: { 1933 ...state[action.kind], 1934 [action.name]: true 1935 } 1936 }; 1937 } 1938 return state; 1939 } 1940 function actions(state = {}, action) { 1941 switch (action.type) { 1942 case "REGISTER_ENTITY_ACTION": 1943 return { 1944 ...state, 1945 [action.kind]: { 1946 ...state[action.kind], 1947 [action.name]: [ 1948 ...(state[action.kind]?.[action.name] ?? []).filter( 1949 (_action) => _action.id !== action.config.id 1950 ), 1951 action.config 1952 ] 1953 } 1954 }; 1955 case "UNREGISTER_ENTITY_ACTION": { 1956 return { 1957 ...state, 1958 [action.kind]: { 1959 ...state[action.kind], 1960 [action.name]: (state[action.kind]?.[action.name] ?? []).filter((_action) => _action.id !== action.actionId) 1961 } 1962 }; 1963 } 1964 } 1965 return state; 1966 } 1967 function fields(state = {}, action) { 1968 switch (action.type) { 1969 case "REGISTER_ENTITY_FIELD": 1970 return { 1971 ...state, 1972 [action.kind]: { 1973 ...state[action.kind], 1974 [action.name]: [ 1975 ...(state[action.kind]?.[action.name] ?? []).filter( 1976 (_field) => _field.id !== action.config.id 1977 ), 1978 action.config 1979 ] 1980 } 1981 }; 1982 case "UNREGISTER_ENTITY_FIELD": 1983 return { 1984 ...state, 1985 [action.kind]: { 1986 ...state[action.kind], 1987 [action.name]: (state[action.kind]?.[action.name] ?? []).filter((_field) => _field.id !== action.fieldId) 1988 } 1989 }; 1990 } 1991 return state; 1992 } 1993 var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ 1994 actions, 1995 fields, 1996 isReady 1997 }); 1998 1999 2000 ;// ./node_modules/@wordpress/editor/build-module/store/reducer.js 2001 2002 2003 2004 function getPostRawValue(value) { 2005 if (value && "object" === typeof value && "raw" in value) { 2006 return value.raw; 2007 } 2008 return value; 2009 } 2010 function hasSameKeys(a, b) { 2011 const keysA = Object.keys(a).sort(); 2012 const keysB = Object.keys(b).sort(); 2013 return keysA.length === keysB.length && keysA.every((key, index) => keysB[index] === key); 2014 } 2015 function isUpdatingSamePostProperty(action, previousAction) { 2016 return action.type === "EDIT_POST" && hasSameKeys(action.edits, previousAction.edits); 2017 } 2018 function shouldOverwriteState(action, previousAction) { 2019 if (action.type === "RESET_EDITOR_BLOCKS") { 2020 return !action.shouldCreateUndoLevel; 2021 } 2022 if (!previousAction || action.type !== previousAction.type) { 2023 return false; 2024 } 2025 return isUpdatingSamePostProperty(action, previousAction); 2026 } 2027 function postId(state = null, action) { 2028 switch (action.type) { 2029 case "SET_EDITED_POST": 2030 return action.postId; 2031 } 2032 return state; 2033 } 2034 function templateId(state = null, action) { 2035 switch (action.type) { 2036 case "SET_CURRENT_TEMPLATE_ID": 2037 return action.id; 2038 } 2039 return state; 2040 } 2041 function postType(state = null, action) { 2042 switch (action.type) { 2043 case "SET_EDITED_POST": 2044 return action.postType; 2045 } 2046 return state; 2047 } 2048 function template(state = { isValid: true }, action) { 2049 switch (action.type) { 2050 case "SET_TEMPLATE_VALIDITY": 2051 return { 2052 ...state, 2053 isValid: action.isValid 2054 }; 2055 } 2056 return state; 2057 } 2058 function saving(state = {}, action) { 2059 switch (action.type) { 2060 case "REQUEST_POST_UPDATE_START": 2061 case "REQUEST_POST_UPDATE_FINISH": 2062 return { 2063 pending: action.type === "REQUEST_POST_UPDATE_START", 2064 options: action.options || {} 2065 }; 2066 } 2067 return state; 2068 } 2069 function deleting(state = {}, action) { 2070 switch (action.type) { 2071 case "REQUEST_POST_DELETE_START": 2072 case "REQUEST_POST_DELETE_FINISH": 2073 return { 2074 pending: action.type === "REQUEST_POST_DELETE_START" 2075 }; 2076 } 2077 return state; 2078 } 2079 function postLock(state = { isLocked: false }, action) { 2080 switch (action.type) { 2081 case "UPDATE_POST_LOCK": 2082 return action.lock; 2083 } 2084 return state; 2085 } 2086 function postSavingLock(state = {}, action) { 2087 switch (action.type) { 2088 case "LOCK_POST_SAVING": 2089 return { ...state, [action.lockName]: true }; 2090 case "UNLOCK_POST_SAVING": { 2091 const { [action.lockName]: removedLockName, ...restState } = state; 2092 return restState; 2093 } 2094 } 2095 return state; 2096 } 2097 function postAutosavingLock(state = {}, action) { 2098 switch (action.type) { 2099 case "LOCK_POST_AUTOSAVING": 2100 return { ...state, [action.lockName]: true }; 2101 case "UNLOCK_POST_AUTOSAVING": { 2102 const { [action.lockName]: removedLockName, ...restState } = state; 2103 return restState; 2104 } 2105 } 2106 return state; 2107 } 2108 function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { 2109 switch (action.type) { 2110 case "UPDATE_EDITOR_SETTINGS": 2111 return { 2112 ...state, 2113 ...action.settings 2114 }; 2115 } 2116 return state; 2117 } 2118 function renderingMode(state = "post-only", action) { 2119 switch (action.type) { 2120 case "SET_RENDERING_MODE": 2121 return action.mode; 2122 } 2123 return state; 2124 } 2125 function deviceType(state = "Desktop", action) { 2126 switch (action.type) { 2127 case "SET_DEVICE_TYPE": 2128 return action.deviceType; 2129 } 2130 return state; 2131 } 2132 function removedPanels(state = [], action) { 2133 switch (action.type) { 2134 case "REMOVE_PANEL": 2135 if (!state.includes(action.panelName)) { 2136 return [...state, action.panelName]; 2137 } 2138 } 2139 return state; 2140 } 2141 function blockInserterPanel(state = false, action) { 2142 switch (action.type) { 2143 case "SET_IS_LIST_VIEW_OPENED": 2144 return action.isOpen ? false : state; 2145 case "SET_IS_INSERTER_OPENED": 2146 return action.value; 2147 } 2148 return state; 2149 } 2150 function listViewPanel(state = false, action) { 2151 switch (action.type) { 2152 case "SET_IS_INSERTER_OPENED": 2153 return action.value ? false : state; 2154 case "SET_IS_LIST_VIEW_OPENED": 2155 return action.isOpen; 2156 } 2157 return state; 2158 } 2159 function listViewToggleRef(state = { current: null }) { 2160 return state; 2161 } 2162 function inserterSidebarToggleRef(state = { current: null }) { 2163 return state; 2164 } 2165 function publishSidebarActive(state = false, action) { 2166 switch (action.type) { 2167 case "OPEN_PUBLISH_SIDEBAR": 2168 return true; 2169 case "CLOSE_PUBLISH_SIDEBAR": 2170 return false; 2171 case "TOGGLE_PUBLISH_SIDEBAR": 2172 return !state; 2173 } 2174 return state; 2175 } 2176 function canvasMinHeight(state = 0, action) { 2177 switch (action.type) { 2178 case "SET_CANVAS_MIN_HEIGHT": 2179 return action.minHeight; 2180 } 2181 return state; 2182 } 2183 var reducer_reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ 2184 postId, 2185 postType, 2186 templateId, 2187 saving, 2188 deleting, 2189 postLock, 2190 template, 2191 postSavingLock, 2192 editorSettings, 2193 postAutosavingLock, 2194 renderingMode, 2195 deviceType, 2196 removedPanels, 2197 blockInserterPanel, 2198 inserterSidebarToggleRef, 2199 listViewPanel, 2200 listViewToggleRef, 2201 publishSidebarActive, 2202 canvasMinHeight, 2203 dataviews: reducer_default 2204 }); 2205 2206 2207 ;// external ["wp","blocks"] 2208 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 2209 ;// external ["wp","date"] 2210 const external_wp_date_namespaceObject = window["wp"]["date"]; 2211 ;// external ["wp","url"] 2212 const external_wp_url_namespaceObject = window["wp"]["url"]; 2213 ;// external ["wp","deprecated"] 2214 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 2215 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 2216 ;// external ["wp","preferences"] 2217 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 2218 ;// ./node_modules/@wordpress/editor/build-module/store/constants.js 2219 const EDIT_MERGE_PROPERTIES = /* @__PURE__ */ new Set(["meta"]); 2220 const STORE_NAME = "core/editor"; 2221 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 2222 const ONE_MINUTE_IN_MS = 60 * 1e3; 2223 const AUTOSAVE_PROPERTIES = ["title", "excerpt", "content"]; 2224 const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized"; 2225 const TEMPLATE_POST_TYPE = "wp_template"; 2226 const TEMPLATE_PART_POST_TYPE = "wp_template_part"; 2227 const PATTERN_POST_TYPE = "wp_block"; 2228 const NAVIGATION_POST_TYPE = "wp_navigation"; 2229 const TEMPLATE_ORIGINS = { 2230 custom: "custom", 2231 theme: "theme", 2232 plugin: "plugin" 2233 }; 2234 const TEMPLATE_POST_TYPES = ["wp_template", "wp_template_part"]; 2235 const GLOBAL_POST_TYPES = [ 2236 ...TEMPLATE_POST_TYPES, 2237 "wp_block", 2238 "wp_navigation" 2239 ]; 2240 2241 2242 ;// external ["wp","primitives"] 2243 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 2244 ;// ./node_modules/@wordpress/icons/build-module/library/header.js 2245 2246 2247 var header_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 2248 2249 2250 ;// ./node_modules/@wordpress/icons/build-module/library/footer.js 2251 2252 2253 var footer_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 2254 external_wp_primitives_namespaceObject.Path, 2255 { 2256 fillRule: "evenodd", 2257 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" 2258 } 2259 ) }); 2260 2261 2262 ;// ./node_modules/@wordpress/icons/build-module/library/sidebar.js 2263 2264 2265 var sidebar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 2266 2267 2268 ;// ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js 2269 2270 2271 var symbol_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 2272 2273 2274 ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js 2275 2276 function getTemplatePartIcon(iconName) { 2277 if ("header" === iconName) { 2278 return header_default; 2279 } else if ("footer" === iconName) { 2280 return footer_default; 2281 } else if ("sidebar" === iconName) { 2282 return sidebar_default; 2283 } 2284 return symbol_filled_default; 2285 } 2286 2287 2288 ;// external ["wp","privateApis"] 2289 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 2290 ;// ./node_modules/@wordpress/editor/build-module/lock-unlock.js 2291 2292 const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 2293 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 2294 "@wordpress/editor" 2295 ); 2296 2297 2298 ;// ./node_modules/@wordpress/icons/build-module/library/layout.js 2299 2300 2301 var layout_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 2302 2303 2304 ;// ./node_modules/@wordpress/editor/build-module/utils/get-template-info.js 2305 2306 2307 const EMPTY_OBJECT = {}; 2308 const getTemplateInfo = (params) => { 2309 if (!params) { 2310 return EMPTY_OBJECT; 2311 } 2312 const { templateTypes, templateAreas, template } = params; 2313 const { description, slug, title, area } = template; 2314 const { title: defaultTitle, description: defaultDescription } = Object.values(templateTypes).find((type) => type.slug === slug) ?? EMPTY_OBJECT; 2315 const templateTitle = typeof title === "string" ? title : title?.rendered; 2316 const templateDescription = typeof description === "string" ? description : description?.raw; 2317 const templateAreasWithIcon = templateAreas?.map((item) => ({ 2318 ...item, 2319 icon: getTemplatePartIcon(item.icon) 2320 })); 2321 const templateIcon = templateAreasWithIcon?.find((item) => area === item.area)?.icon || layout_default; 2322 return { 2323 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, 2324 description: templateDescription || defaultDescription, 2325 icon: templateIcon 2326 }; 2327 }; 2328 2329 2330 ;// ./node_modules/@wordpress/editor/build-module/store/selectors.js 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 const selectors_EMPTY_OBJECT = {}; 2346 const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => () => { 2347 return select(external_wp_coreData_namespaceObject.store).hasUndo(); 2348 }); 2349 const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => () => { 2350 return select(external_wp_coreData_namespaceObject.store).hasRedo(); 2351 }); 2352 function isEditedPostNew(state) { 2353 return getCurrentPost(state).status === "auto-draft"; 2354 } 2355 function hasChangedContent(state) { 2356 const edits = getPostEdits(state); 2357 return "content" in edits; 2358 } 2359 const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2360 (select) => (state) => { 2361 const postType = getCurrentPostType(state); 2362 const postId = getCurrentPostId(state); 2363 return select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord( 2364 "postType", 2365 postType, 2366 postId 2367 ); 2368 } 2369 ); 2370 const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2371 (select) => (state) => { 2372 const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); 2373 const { type, id } = getCurrentPost(state); 2374 return dirtyEntityRecords.some( 2375 (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id 2376 ); 2377 } 2378 ); 2379 function isCleanNewPost(state) { 2380 return !isEditedPostDirty(state) && isEditedPostNew(state); 2381 } 2382 const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2383 (select) => (state) => { 2384 const postId = getCurrentPostId(state); 2385 const postType = getCurrentPostType(state); 2386 const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord( 2387 "postType", 2388 postType, 2389 postId 2390 ); 2391 if (post) { 2392 return post; 2393 } 2394 return selectors_EMPTY_OBJECT; 2395 } 2396 ); 2397 function getCurrentPostType(state) { 2398 return state.postType; 2399 } 2400 function getCurrentPostId(state) { 2401 return state.postId; 2402 } 2403 function getCurrentTemplateId(state) { 2404 return state.templateId; 2405 } 2406 function getCurrentPostRevisionsCount(state) { 2407 return getCurrentPost(state)._links?.["version-history"]?.[0]?.count ?? 0; 2408 } 2409 function getCurrentPostLastRevisionId(state) { 2410 return getCurrentPost(state)._links?.["predecessor-version"]?.[0]?.id ?? null; 2411 } 2412 const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => (state) => { 2413 const postType = getCurrentPostType(state); 2414 const postId = getCurrentPostId(state); 2415 return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits( 2416 "postType", 2417 postType, 2418 postId 2419 ) || selectors_EMPTY_OBJECT; 2420 }); 2421 function getCurrentPostAttribute(state, attributeName) { 2422 switch (attributeName) { 2423 case "type": 2424 return getCurrentPostType(state); 2425 case "id": 2426 return getCurrentPostId(state); 2427 default: 2428 const post = getCurrentPost(state); 2429 if (!post.hasOwnProperty(attributeName)) { 2430 break; 2431 } 2432 return getPostRawValue(post[attributeName]); 2433 } 2434 } 2435 const getNestedEditedPostProperty = (0,external_wp_data_namespaceObject.createSelector)( 2436 (state, attributeName) => { 2437 const edits = getPostEdits(state); 2438 if (!edits.hasOwnProperty(attributeName)) { 2439 return getCurrentPostAttribute(state, attributeName); 2440 } 2441 return { 2442 ...getCurrentPostAttribute(state, attributeName), 2443 ...edits[attributeName] 2444 }; 2445 }, 2446 (state, attributeName) => [ 2447 getCurrentPostAttribute(state, attributeName), 2448 getPostEdits(state)[attributeName] 2449 ] 2450 ); 2451 function getEditedPostAttribute(state, attributeName) { 2452 switch (attributeName) { 2453 case "content": 2454 return getEditedPostContent(state); 2455 } 2456 const edits = getPostEdits(state); 2457 if (!edits.hasOwnProperty(attributeName)) { 2458 return getCurrentPostAttribute(state, attributeName); 2459 } 2460 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { 2461 return getNestedEditedPostProperty(state, attributeName); 2462 } 2463 return edits[attributeName]; 2464 } 2465 const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2466 (select) => (state, attributeName) => { 2467 if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== "preview_link") { 2468 return; 2469 } 2470 const postType = getCurrentPostType(state); 2471 if (postType === "wp_template") { 2472 return false; 2473 } 2474 const postId = getCurrentPostId(state); 2475 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 2476 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave( 2477 postType, 2478 postId, 2479 currentUserId 2480 ); 2481 if (autosave) { 2482 return getPostRawValue(autosave[attributeName]); 2483 } 2484 } 2485 ); 2486 function getEditedPostVisibility(state) { 2487 const status = getEditedPostAttribute(state, "status"); 2488 if (status === "private") { 2489 return "private"; 2490 } 2491 const password = getEditedPostAttribute(state, "password"); 2492 if (password) { 2493 return "password"; 2494 } 2495 return "public"; 2496 } 2497 function isCurrentPostPending(state) { 2498 return getCurrentPost(state).status === "pending"; 2499 } 2500 function isCurrentPostPublished(state, currentPost) { 2501 const post = currentPost || getCurrentPost(state); 2502 return ["publish", "private"].indexOf(post.status) !== -1 || post.status === "future" && !(0,external_wp_date_namespaceObject.isInTheFuture)( 2503 new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS) 2504 ); 2505 } 2506 function isCurrentPostScheduled(state) { 2507 return getCurrentPost(state).status === "future" && !isCurrentPostPublished(state); 2508 } 2509 function isEditedPostPublishable(state) { 2510 const post = getCurrentPost(state); 2511 return isEditedPostDirty(state) || ["publish", "private", "future"].indexOf(post.status) === -1; 2512 } 2513 function isEditedPostSaveable(state) { 2514 if (isSavingPost(state)) { 2515 return false; 2516 } 2517 return !!getEditedPostAttribute(state, "title") || !!getEditedPostAttribute(state, "excerpt") || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === "native"; 2518 } 2519 const isEditedPostEmpty = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2520 (select) => (state) => { 2521 const postId = getCurrentPostId(state); 2522 const postType = getCurrentPostType(state); 2523 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( 2524 "postType", 2525 postType, 2526 postId 2527 ); 2528 if (typeof record.content !== "function") { 2529 return !record.content; 2530 } 2531 const blocks = getEditedPostAttribute(state, "blocks"); 2532 if (blocks.length === 0) { 2533 return true; 2534 } 2535 if (blocks.length > 1) { 2536 return false; 2537 } 2538 const blockName = blocks[0].name; 2539 if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { 2540 return false; 2541 } 2542 return !getEditedPostContent(state); 2543 } 2544 ); 2545 const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2546 (select) => (state) => { 2547 if (!isEditedPostSaveable(state)) { 2548 return false; 2549 } 2550 if (isPostAutosavingLocked(state)) { 2551 return false; 2552 } 2553 const postType = getCurrentPostType(state); 2554 const postTypeObject = select(external_wp_coreData_namespaceObject.store).getPostType(postType); 2555 if (postType === "wp_template" || !postTypeObject?.supports?.autosave) { 2556 return false; 2557 } 2558 const postId = getCurrentPostId(state); 2559 const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves( 2560 postType, 2561 postId 2562 ); 2563 const currentUserId = select(external_wp_coreData_namespaceObject.store).getCurrentUser()?.id; 2564 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave( 2565 postType, 2566 postId, 2567 currentUserId 2568 ); 2569 if (!hasFetchedAutosave) { 2570 return false; 2571 } 2572 if (!autosave) { 2573 return true; 2574 } 2575 if (hasChangedContent(state)) { 2576 return true; 2577 } 2578 return ["title", "excerpt", "meta"].some( 2579 (field) => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field) 2580 ); 2581 } 2582 ); 2583 function isEditedPostBeingScheduled(state) { 2584 const date = getEditedPostAttribute(state, "date"); 2585 const checkedDate = new Date( 2586 Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS 2587 ); 2588 return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); 2589 } 2590 function isEditedPostDateFloating(state) { 2591 const date = getEditedPostAttribute(state, "date"); 2592 const modified = getEditedPostAttribute(state, "modified"); 2593 const status = getCurrentPost(state).status; 2594 if (status === "draft" || status === "auto-draft" || status === "pending") { 2595 return date === modified || date === null; 2596 } 2597 return false; 2598 } 2599 function isDeletingPost(state) { 2600 return !!state.deleting.pending; 2601 } 2602 function isSavingPost(state) { 2603 return !!state.saving.pending; 2604 } 2605 const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2606 (select) => (state) => { 2607 const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); 2608 const { type, id } = getCurrentPost(state); 2609 return entitiesBeingSaved.some( 2610 (entityRecord) => entityRecord.kind !== "postType" || entityRecord.name !== type || entityRecord.key !== id 2611 ); 2612 } 2613 ); 2614 const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2615 (select) => (state) => { 2616 const postType = getCurrentPostType(state); 2617 const postId = getCurrentPostId(state); 2618 return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError( 2619 "postType", 2620 postType, 2621 postId 2622 ); 2623 } 2624 ); 2625 const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2626 (select) => (state) => { 2627 const postType = getCurrentPostType(state); 2628 const postId = getCurrentPostId(state); 2629 return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError( 2630 "postType", 2631 postType, 2632 postId 2633 ); 2634 } 2635 ); 2636 function isAutosavingPost(state) { 2637 return isSavingPost(state) && Boolean(state.saving.options?.isAutosave); 2638 } 2639 function isPreviewingPost(state) { 2640 return isSavingPost(state) && Boolean(state.saving.options?.isPreview); 2641 } 2642 function getEditedPostPreviewLink(state) { 2643 if (state.saving.pending || isSavingPost(state)) { 2644 return; 2645 } 2646 let previewLink = getAutosaveAttribute(state, "preview_link"); 2647 if (!previewLink || "draft" === getCurrentPost(state).status) { 2648 previewLink = getEditedPostAttribute(state, "link"); 2649 if (previewLink) { 2650 previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { preview: true }); 2651 } 2652 } 2653 const featuredImageId = getEditedPostAttribute(state, "featured_media"); 2654 if (previewLink && featuredImageId) { 2655 return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { _thumbnail_id: featuredImageId }); 2656 } 2657 return previewLink; 2658 } 2659 const getSuggestedPostFormat = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2660 (select) => () => { 2661 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); 2662 if (blocks.length > 2) { 2663 return null; 2664 } 2665 let name; 2666 if (blocks.length === 1) { 2667 name = blocks[0].name; 2668 if (name === "core/embed") { 2669 const provider = blocks[0].attributes?.providerNameSlug; 2670 if (["youtube", "vimeo"].includes(provider)) { 2671 name = "core/video"; 2672 } else if (["spotify", "soundcloud"].includes(provider)) { 2673 name = "core/audio"; 2674 } 2675 } 2676 } 2677 if (blocks.length === 2 && blocks[1].name === "core/paragraph") { 2678 name = blocks[0].name; 2679 } 2680 switch (name) { 2681 case "core/image": 2682 return "image"; 2683 case "core/quote": 2684 case "core/pullquote": 2685 return "quote"; 2686 case "core/gallery": 2687 return "gallery"; 2688 case "core/video": 2689 return "video"; 2690 case "core/audio": 2691 return "audio"; 2692 default: 2693 return null; 2694 } 2695 } 2696 ); 2697 const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2698 (select) => (state) => { 2699 const postId = getCurrentPostId(state); 2700 const postType = getCurrentPostType(state); 2701 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( 2702 "postType", 2703 postType, 2704 postId 2705 ); 2706 if (record) { 2707 if (typeof record.content === "function") { 2708 return record.content(record); 2709 } else if (record.blocks) { 2710 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 2711 } else if (record.content) { 2712 return record.content; 2713 } 2714 } 2715 return ""; 2716 } 2717 ); 2718 function isPublishingPost(state) { 2719 return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, "status") === "publish"; 2720 } 2721 function isPermalinkEditable(state) { 2722 const permalinkTemplate = getEditedPostAttribute( 2723 state, 2724 "permalink_template" 2725 ); 2726 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 2727 } 2728 function getPermalink(state) { 2729 const permalinkParts = getPermalinkParts(state); 2730 if (!permalinkParts) { 2731 return null; 2732 } 2733 const { prefix, postName, suffix } = permalinkParts; 2734 if (isPermalinkEditable(state)) { 2735 return prefix + postName + suffix; 2736 } 2737 return prefix; 2738 } 2739 function getEditedPostSlug(state) { 2740 return getEditedPostAttribute(state, "slug") || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, "title")) || getCurrentPostId(state); 2741 } 2742 function getPermalinkParts(state) { 2743 const permalinkTemplate = getEditedPostAttribute( 2744 state, 2745 "permalink_template" 2746 ); 2747 if (!permalinkTemplate) { 2748 return null; 2749 } 2750 const postName = getEditedPostAttribute(state, "slug") || getEditedPostAttribute(state, "generated_slug"); 2751 const [prefix, suffix] = permalinkTemplate.split( 2752 PERMALINK_POSTNAME_REGEX 2753 ); 2754 return { 2755 prefix, 2756 postName, 2757 suffix 2758 }; 2759 } 2760 function isPostLocked(state) { 2761 return state.postLock.isLocked; 2762 } 2763 function isPostSavingLocked(state) { 2764 return Object.keys(state.postSavingLock).length > 0; 2765 } 2766 function isPostAutosavingLocked(state) { 2767 return Object.keys(state.postAutosavingLock).length > 0; 2768 } 2769 function isPostLockTakeover(state) { 2770 return state.postLock.isTakeover; 2771 } 2772 function getPostLockUser(state) { 2773 return state.postLock.user; 2774 } 2775 function getActivePostLock(state) { 2776 return state.postLock.activePostLock; 2777 } 2778 function canUserUseUnfilteredHTML(state) { 2779 return Boolean( 2780 getCurrentPost(state)._links?.hasOwnProperty( 2781 "wp:action-unfiltered-html" 2782 ) 2783 ); 2784 } 2785 const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2786 (select) => () => !!select(external_wp_preferences_namespaceObject.store).get("core", "isPublishSidebarEnabled") 2787 ); 2788 const getEditorBlocks = (0,external_wp_data_namespaceObject.createSelector)( 2789 (state) => { 2790 return getEditedPostAttribute(state, "blocks") || (0,external_wp_blocks_namespaceObject.parse)(getEditedPostContent(state)); 2791 }, 2792 (state) => [ 2793 getEditedPostAttribute(state, "blocks"), 2794 getEditedPostContent(state) 2795 ] 2796 ); 2797 function isEditorPanelRemoved(state, panelName) { 2798 return state.removedPanels.includes(panelName); 2799 } 2800 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2801 (select) => (state, panelName) => { 2802 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get( 2803 "core", 2804 "inactivePanels" 2805 ); 2806 return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); 2807 } 2808 ); 2809 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2810 (select) => (state, panelName) => { 2811 const openPanels = select(external_wp_preferences_namespaceObject.store).get( 2812 "core", 2813 "openPanels" 2814 ); 2815 return !!openPanels?.includes(panelName); 2816 } 2817 ); 2818 function getEditorSelectionStart(state) { 2819 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 2820 since: "5.8", 2821 alternative: "select('core/editor').getEditorSelection" 2822 }); 2823 return getEditedPostAttribute(state, "selection")?.selectionStart; 2824 } 2825 function getEditorSelectionEnd(state) { 2826 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { 2827 since: "5.8", 2828 alternative: "select('core/editor').getEditorSelection" 2829 }); 2830 return getEditedPostAttribute(state, "selection")?.selectionEnd; 2831 } 2832 function getEditorSelection(state) { 2833 return getEditedPostAttribute(state, "selection"); 2834 } 2835 function __unstableIsEditorReady(state) { 2836 return !!state.postId; 2837 } 2838 function getEditorSettings(state) { 2839 return state.editorSettings; 2840 } 2841 function getRenderingMode(state) { 2842 return state.renderingMode; 2843 } 2844 const getDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2845 (select) => (state) => { 2846 const isZoomOut = unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(); 2847 if (isZoomOut) { 2848 return "Desktop"; 2849 } 2850 return state.deviceType; 2851 } 2852 ); 2853 function isListViewOpened(state) { 2854 return state.listViewPanel; 2855 } 2856 function isInserterOpened(state) { 2857 return !!state.blockInserterPanel; 2858 } 2859 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2860 (select) => () => select(external_wp_preferences_namespaceObject.store).get("core", "editorMode") ?? "visual" 2861 ); 2862 function getStateBeforeOptimisticTransaction() { 2863 external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", { 2864 since: "5.7", 2865 hint: "No state history is kept on this store anymore" 2866 }); 2867 return null; 2868 } 2869 function inSomeHistory() { 2870 external_wp_deprecated_default()("select('core/editor').inSomeHistory", { 2871 since: "5.7", 2872 hint: "No state history is kept on this store anymore" 2873 }); 2874 return false; 2875 } 2876 function getBlockEditorSelector(name) { 2877 return (0,external_wp_data_namespaceObject.createRegistrySelector)((select) => (state, ...args) => { 2878 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + "`", { 2879 since: "5.3", 2880 alternative: "`wp.data.select( 'core/block-editor' )." + name + "`", 2881 version: "6.2" 2882 }); 2883 return select(external_wp_blockEditor_namespaceObject.store)[name](...args); 2884 }); 2885 } 2886 const getBlockName = getBlockEditorSelector("getBlockName"); 2887 const isBlockValid = getBlockEditorSelector("isBlockValid"); 2888 const getBlockAttributes = getBlockEditorSelector("getBlockAttributes"); 2889 const getBlock = getBlockEditorSelector("getBlock"); 2890 const getBlocks = getBlockEditorSelector("getBlocks"); 2891 const getClientIdsOfDescendants = getBlockEditorSelector( 2892 "getClientIdsOfDescendants" 2893 ); 2894 const getClientIdsWithDescendants = getBlockEditorSelector( 2895 "getClientIdsWithDescendants" 2896 ); 2897 const getGlobalBlockCount = getBlockEditorSelector( 2898 "getGlobalBlockCount" 2899 ); 2900 const getBlocksByClientId = getBlockEditorSelector( 2901 "getBlocksByClientId" 2902 ); 2903 const getBlockCount = getBlockEditorSelector("getBlockCount"); 2904 const getBlockSelectionStart = getBlockEditorSelector( 2905 "getBlockSelectionStart" 2906 ); 2907 const getBlockSelectionEnd = getBlockEditorSelector( 2908 "getBlockSelectionEnd" 2909 ); 2910 const getSelectedBlockCount = getBlockEditorSelector( 2911 "getSelectedBlockCount" 2912 ); 2913 const hasSelectedBlock = getBlockEditorSelector("hasSelectedBlock"); 2914 const getSelectedBlockClientId = getBlockEditorSelector( 2915 "getSelectedBlockClientId" 2916 ); 2917 const getSelectedBlock = getBlockEditorSelector("getSelectedBlock"); 2918 const getBlockRootClientId = getBlockEditorSelector( 2919 "getBlockRootClientId" 2920 ); 2921 const getBlockHierarchyRootClientId = getBlockEditorSelector( 2922 "getBlockHierarchyRootClientId" 2923 ); 2924 const getAdjacentBlockClientId = getBlockEditorSelector( 2925 "getAdjacentBlockClientId" 2926 ); 2927 const getPreviousBlockClientId = getBlockEditorSelector( 2928 "getPreviousBlockClientId" 2929 ); 2930 const getNextBlockClientId = getBlockEditorSelector( 2931 "getNextBlockClientId" 2932 ); 2933 const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector( 2934 "getSelectedBlocksInitialCaretPosition" 2935 ); 2936 const getMultiSelectedBlockClientIds = getBlockEditorSelector( 2937 "getMultiSelectedBlockClientIds" 2938 ); 2939 const getMultiSelectedBlocks = getBlockEditorSelector( 2940 "getMultiSelectedBlocks" 2941 ); 2942 const getFirstMultiSelectedBlockClientId = getBlockEditorSelector( 2943 "getFirstMultiSelectedBlockClientId" 2944 ); 2945 const getLastMultiSelectedBlockClientId = getBlockEditorSelector( 2946 "getLastMultiSelectedBlockClientId" 2947 ); 2948 const isFirstMultiSelectedBlock = getBlockEditorSelector( 2949 "isFirstMultiSelectedBlock" 2950 ); 2951 const isBlockMultiSelected = getBlockEditorSelector( 2952 "isBlockMultiSelected" 2953 ); 2954 const isAncestorMultiSelected = getBlockEditorSelector( 2955 "isAncestorMultiSelected" 2956 ); 2957 const getMultiSelectedBlocksStartClientId = getBlockEditorSelector( 2958 "getMultiSelectedBlocksStartClientId" 2959 ); 2960 const getMultiSelectedBlocksEndClientId = getBlockEditorSelector( 2961 "getMultiSelectedBlocksEndClientId" 2962 ); 2963 const getBlockOrder = getBlockEditorSelector("getBlockOrder"); 2964 const getBlockIndex = getBlockEditorSelector("getBlockIndex"); 2965 const isBlockSelected = getBlockEditorSelector("isBlockSelected"); 2966 const hasSelectedInnerBlock = getBlockEditorSelector( 2967 "hasSelectedInnerBlock" 2968 ); 2969 const isBlockWithinSelection = getBlockEditorSelector( 2970 "isBlockWithinSelection" 2971 ); 2972 const hasMultiSelection = getBlockEditorSelector("hasMultiSelection"); 2973 const isMultiSelecting = getBlockEditorSelector("isMultiSelecting"); 2974 const isSelectionEnabled = getBlockEditorSelector("isSelectionEnabled"); 2975 const getBlockMode = getBlockEditorSelector("getBlockMode"); 2976 const isTyping = getBlockEditorSelector("isTyping"); 2977 const isCaretWithinFormattedText = getBlockEditorSelector( 2978 "isCaretWithinFormattedText" 2979 ); 2980 const getBlockInsertionPoint = getBlockEditorSelector( 2981 "getBlockInsertionPoint" 2982 ); 2983 const isBlockInsertionPointVisible = getBlockEditorSelector( 2984 "isBlockInsertionPointVisible" 2985 ); 2986 const isValidTemplate = getBlockEditorSelector("isValidTemplate"); 2987 const getTemplate = getBlockEditorSelector("getTemplate"); 2988 const getTemplateLock = getBlockEditorSelector("getTemplateLock"); 2989 const canInsertBlockType = getBlockEditorSelector("canInsertBlockType"); 2990 const getInserterItems = getBlockEditorSelector("getInserterItems"); 2991 const hasInserterItems = getBlockEditorSelector("hasInserterItems"); 2992 const getBlockListSettings = getBlockEditorSelector( 2993 "getBlockListSettings" 2994 ); 2995 const __experimentalGetDefaultTemplateTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)( 2996 (select) => () => { 2997 external_wp_deprecated_default()( 2998 "select('core/editor').__experimentalGetDefaultTemplateTypes", 2999 { 3000 since: "6.8", 3001 alternative: "select('core/core-data').getCurrentTheme()?.default_template_types" 3002 } 3003 ); 3004 return select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types; 3005 } 3006 ); 3007 const __experimentalGetDefaultTemplatePartAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)( 3008 (select) => (0,external_wp_data_namespaceObject.createSelector)(() => { 3009 external_wp_deprecated_default()( 3010 "select('core/editor').__experimentalGetDefaultTemplatePartAreas", 3011 { 3012 since: "6.8", 3013 alternative: "select('core/core-data').getCurrentTheme()?.default_template_part_areas" 3014 } 3015 ); 3016 const areas = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || []; 3017 return areas.map((item) => { 3018 return { ...item, icon: getTemplatePartIcon(item.icon) }; 3019 }); 3020 }) 3021 ); 3022 const __experimentalGetDefaultTemplateType = (0,external_wp_data_namespaceObject.createRegistrySelector)( 3023 (select) => (0,external_wp_data_namespaceObject.createSelector)((state, slug) => { 3024 external_wp_deprecated_default()( 3025 "select('core/editor').__experimentalGetDefaultTemplateType", 3026 { 3027 since: "6.8" 3028 } 3029 ); 3030 const templateTypes = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types; 3031 if (!templateTypes) { 3032 return selectors_EMPTY_OBJECT; 3033 } 3034 return Object.values(templateTypes).find( 3035 (type) => type.slug === slug 3036 ) ?? selectors_EMPTY_OBJECT; 3037 }) 3038 ); 3039 const __experimentalGetTemplateInfo = (0,external_wp_data_namespaceObject.createRegistrySelector)( 3040 (select) => (0,external_wp_data_namespaceObject.createSelector)((state, template) => { 3041 external_wp_deprecated_default()("select('core/editor').__experimentalGetTemplateInfo", { 3042 since: "6.8" 3043 }); 3044 if (!template) { 3045 return selectors_EMPTY_OBJECT; 3046 } 3047 const currentTheme = select(external_wp_coreData_namespaceObject.store).getCurrentTheme(); 3048 const templateTypes = currentTheme?.default_template_types || []; 3049 const templateAreas = currentTheme?.default_template_part_areas || []; 3050 return getTemplateInfo({ 3051 template, 3052 templateAreas, 3053 templateTypes 3054 }); 3055 }) 3056 ); 3057 const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)( 3058 (select) => (state) => { 3059 const currentPostType = getCurrentPostType(state); 3060 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); 3061 return postType?.labels?.singular_name; 3062 } 3063 ); 3064 function isPublishSidebarOpened(state) { 3065 return state.publishSidebarActive; 3066 } 3067 3068 3069 ;// external ["wp","a11y"] 3070 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 3071 ;// external ["wp","apiFetch"] 3072 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 3073 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 3074 ;// external ["wp","notices"] 3075 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 3076 ;// external ["wp","i18n"] 3077 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 3078 ;// ./node_modules/@wordpress/editor/build-module/store/local-autosave.js 3079 function postKey(postId, isPostNew) { 3080 return `wp-autosave-block-editor-post-$isPostNew ? "auto-draft" : postId}`; 3081 } 3082 function localAutosaveGet(postId, isPostNew) { 3083 return window.sessionStorage.getItem(postKey(postId, isPostNew)); 3084 } 3085 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { 3086 window.sessionStorage.setItem( 3087 postKey(postId, isPostNew), 3088 JSON.stringify({ 3089 post_title: title, 3090 content, 3091 excerpt 3092 }) 3093 ); 3094 } 3095 function localAutosaveClear(postId, isPostNew) { 3096 window.sessionStorage.removeItem(postKey(postId, isPostNew)); 3097 } 3098 3099 3100 ;// ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js 3101 3102 function getNotificationArgumentsForSaveSuccess(data) { 3103 const { previousPost, post, postType } = data; 3104 if (data.options?.isAutosave) { 3105 return []; 3106 } 3107 const publishStatus = ["publish", "private", "future"]; 3108 const isPublished = publishStatus.includes(previousPost.status); 3109 const willPublish = publishStatus.includes(post.status); 3110 const willTrash = post.status === "trash" && previousPost.status !== "trash"; 3111 let noticeMessage; 3112 let shouldShowLink = postType?.viewable ?? false; 3113 let isDraft; 3114 if (willTrash) { 3115 noticeMessage = postType.labels.item_trashed; 3116 shouldShowLink = false; 3117 } else if (!isPublished && !willPublish) { 3118 noticeMessage = (0,external_wp_i18n_namespaceObject.__)("Draft saved."); 3119 isDraft = true; 3120 } else if (isPublished && !willPublish) { 3121 noticeMessage = postType.labels.item_reverted_to_draft; 3122 shouldShowLink = false; 3123 } else if (!isPublished && willPublish) { 3124 noticeMessage = { 3125 publish: postType.labels.item_published, 3126 private: postType.labels.item_published_privately, 3127 future: postType.labels.item_scheduled 3128 }[post.status]; 3129 } else { 3130 noticeMessage = postType.labels.item_updated; 3131 } 3132 const actions = []; 3133 if (shouldShowLink) { 3134 actions.push({ 3135 label: isDraft ? (0,external_wp_i18n_namespaceObject.__)("View Preview") : postType.labels.view_item, 3136 url: post.link, 3137 openInNewTab: true 3138 }); 3139 } 3140 return [ 3141 noticeMessage, 3142 { 3143 id: "editor-save", 3144 type: "snackbar", 3145 actions 3146 } 3147 ]; 3148 } 3149 function getNotificationArgumentsForSaveFail(data) { 3150 const { post, edits, error } = data; 3151 if (error && "rest_autosave_no_changes" === error.code) { 3152 return []; 3153 } 3154 const publishStatus = ["publish", "private", "future"]; 3155 const isPublished = publishStatus.indexOf(post.status) !== -1; 3156 if (error.code === "offline_error") { 3157 const messages2 = { 3158 publish: (0,external_wp_i18n_namespaceObject.__)("Publishing failed because you were offline."), 3159 private: (0,external_wp_i18n_namespaceObject.__)("Publishing failed because you were offline."), 3160 future: (0,external_wp_i18n_namespaceObject.__)("Scheduling failed because you were offline."), 3161 default: (0,external_wp_i18n_namespaceObject.__)("Updating failed because you were offline.") 3162 }; 3163 const noticeMessage2 = !isPublished && edits.status in messages2 ? messages2[edits.status] : messages2.default; 3164 return [noticeMessage2, { id: "editor-save" }]; 3165 } 3166 const messages = { 3167 publish: (0,external_wp_i18n_namespaceObject.__)("Publishing failed."), 3168 private: (0,external_wp_i18n_namespaceObject.__)("Publishing failed."), 3169 future: (0,external_wp_i18n_namespaceObject.__)("Scheduling failed."), 3170 default: (0,external_wp_i18n_namespaceObject.__)("Updating failed.") 3171 }; 3172 let noticeMessage = !isPublished && edits.status in messages ? messages[edits.status] : messages.default; 3173 if (error.message && !/<\/?[^>]*>/.test(error.message)) { 3174 noticeMessage = [noticeMessage, error.message].join(" "); 3175 } 3176 return [ 3177 noticeMessage, 3178 { 3179 id: "editor-save" 3180 } 3181 ]; 3182 } 3183 function getNotificationArgumentsForTrashFail(data) { 3184 return [ 3185 data.error.message && data.error.code !== "unknown_error" ? data.error.message : (0,external_wp_i18n_namespaceObject.__)("Trashing failed"), 3186 { 3187 id: "editor-trash-fail" 3188 } 3189 ]; 3190 } 3191 3192 3193 ;// ./node_modules/@wordpress/editor/build-module/store/actions.js 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 const setupEditor = (post, edits, template) => ({ dispatch }) => { 3208 dispatch.setEditedPost(post.type, post.id); 3209 const isNewPost = post.status === "auto-draft"; 3210 if (isNewPost && template) { 3211 let content; 3212 if ("content" in edits) { 3213 content = edits.content; 3214 } else { 3215 content = post.content.raw; 3216 } 3217 let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); 3218 blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); 3219 dispatch.resetEditorBlocks(blocks, { 3220 __unstableShouldCreateUndoLevel: false 3221 }); 3222 } 3223 if (edits && Object.values(edits).some( 3224 ([key, edit]) => edit !== (post[key]?.raw ?? post[key]) 3225 )) { 3226 dispatch.editPost(edits); 3227 } 3228 }; 3229 function __experimentalTearDownEditor() { 3230 external_wp_deprecated_default()( 3231 "wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", 3232 { 3233 since: "6.5" 3234 } 3235 ); 3236 return { type: "DO_NOTHING" }; 3237 } 3238 function resetPost() { 3239 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { 3240 since: "6.0", 3241 version: "6.3", 3242 alternative: "Initialize the editor with the setupEditorState action" 3243 }); 3244 return { type: "DO_NOTHING" }; 3245 } 3246 function updatePost() { 3247 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { 3248 since: "5.7", 3249 alternative: "Use the core entities store instead" 3250 }); 3251 return { 3252 type: "DO_NOTHING" 3253 }; 3254 } 3255 function setupEditorState(post) { 3256 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).setupEditorState", { 3257 since: "6.5", 3258 alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost" 3259 }); 3260 return setEditedPost(post.type, post.id); 3261 } 3262 function setEditedPost(postType, postId) { 3263 return { 3264 type: "SET_EDITED_POST", 3265 postType, 3266 postId 3267 }; 3268 } 3269 const editPost = (edits, options) => ({ select, registry }) => { 3270 const { id, type } = select.getCurrentPost(); 3271 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord("postType", type, id, edits, options); 3272 }; 3273 const savePost = (options = {}) => async ({ select, dispatch, registry }) => { 3274 if (!select.isEditedPostSaveable()) { 3275 return; 3276 } 3277 const content = select.getEditedPostContent(); 3278 if (!options.isAutosave) { 3279 dispatch.editPost({ content }, { undoIgnore: true }); 3280 } 3281 const previousRecord = select.getCurrentPost(); 3282 let edits = { 3283 id: previousRecord.id, 3284 ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits( 3285 "postType", 3286 previousRecord.type, 3287 previousRecord.id 3288 ), 3289 content 3290 }; 3291 dispatch({ type: "REQUEST_POST_UPDATE_START", options }); 3292 let error = false; 3293 try { 3294 edits = await (0,external_wp_hooks_namespaceObject.applyFiltersAsync)( 3295 "editor.preSavePost", 3296 edits, 3297 options 3298 ); 3299 } catch (err) { 3300 error = err; 3301 } 3302 if (!error) { 3303 try { 3304 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord( 3305 "postType", 3306 previousRecord.type, 3307 edits, 3308 options 3309 ); 3310 } catch (err) { 3311 error = err.message && err.code !== "unknown_error" ? err.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while updating."); 3312 } 3313 } 3314 if (!error) { 3315 error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError( 3316 "postType", 3317 previousRecord.type, 3318 previousRecord.id 3319 ); 3320 } 3321 if (!error) { 3322 try { 3323 await (0,external_wp_hooks_namespaceObject.applyFilters)( 3324 "editor.__unstableSavePost", 3325 Promise.resolve(), 3326 options 3327 ); 3328 } catch (err) { 3329 error = err; 3330 } 3331 } 3332 if (!error) { 3333 try { 3334 await (0,external_wp_hooks_namespaceObject.doActionAsync)( 3335 "editor.savePost", 3336 { id: previousRecord.id, type: previousRecord.type }, 3337 options 3338 ); 3339 } catch (err) { 3340 error = err; 3341 } 3342 } 3343 dispatch({ type: "REQUEST_POST_UPDATE_FINISH", options }); 3344 if (!options.isAutosave && previousRecord.type === "wp_template" && (typeof previousRecord.id === "number" || /^\d+$/.test(previousRecord.id))) { 3345 templateActivationNotice({ select, dispatch, registry }); 3346 } 3347 if (error) { 3348 const args = getNotificationArgumentsForSaveFail({ 3349 post: previousRecord, 3350 edits, 3351 error 3352 }); 3353 if (args.length) { 3354 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); 3355 } 3356 } else { 3357 const updatedRecord = select.getCurrentPost(); 3358 const args = getNotificationArgumentsForSaveSuccess({ 3359 previousPost: previousRecord, 3360 post: updatedRecord, 3361 postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), 3362 options 3363 }); 3364 if (args.length) { 3365 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); 3366 } 3367 if (!options.isAutosave) { 3368 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 3369 } 3370 } 3371 }; 3372 async function templateActivationNotice({ select, registry }) { 3373 const editorSettings = select.getEditorSettings(); 3374 if (editorSettings.onNavigateToPreviousEntityRecord) { 3375 return; 3376 } 3377 const { id, slug } = select.getCurrentPost(); 3378 const site = await registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "site"); 3379 if (site.active_templates[slug] === id) { 3380 return; 3381 } 3382 const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme(); 3383 const templateType = currentTheme?.default_template_types.find( 3384 (type) => type.slug === slug 3385 ); 3386 await registry.dispatch(external_wp_notices_namespaceObject.store).createNotice( 3387 "info", 3388 (0,external_wp_i18n_namespaceObject.sprintf)( 3389 // translators: %s: The name (or slug) of the type of template. 3390 (0,external_wp_i18n_namespaceObject.__)('Do you want to activate this "%s" template?'), 3391 templateType?.title ?? slug 3392 ), 3393 { 3394 id: "template-activate-notice", 3395 actions: [ 3396 { 3397 label: (0,external_wp_i18n_namespaceObject.__)("Activate"), 3398 onClick: async () => { 3399 await registry.dispatch(external_wp_notices_namespaceObject.store).createNotice( 3400 "info", 3401 (0,external_wp_i18n_namespaceObject.__)("Activating template\u2026"), 3402 { id: "template-activate-notice" } 3403 ); 3404 try { 3405 const currentSite = await registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "site"); 3406 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord( 3407 "root", 3408 "site", 3409 { 3410 active_templates: { 3411 ...currentSite.active_templates, 3412 [slug]: id 3413 } 3414 }, 3415 { throwOnError: true } 3416 ); 3417 await registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice( 3418 (0,external_wp_i18n_namespaceObject.__)("Template activated."), 3419 { id: "template-activate-notice" } 3420 ); 3421 } catch (error) { 3422 await registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( 3423 (0,external_wp_i18n_namespaceObject.__)("Template activation failed."), 3424 { id: "template-activate-notice" } 3425 ); 3426 throw error; 3427 } 3428 } 3429 } 3430 ] 3431 } 3432 ); 3433 } 3434 function refreshPost() { 3435 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { 3436 since: "6.0", 3437 version: "6.3", 3438 alternative: "Use the core entities store instead" 3439 }); 3440 return { type: "DO_NOTHING" }; 3441 } 3442 const trashPost = () => async ({ select, dispatch, registry }) => { 3443 const postTypeSlug = select.getCurrentPostType(); 3444 const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 3445 const { rest_base: restBase, rest_namespace: restNamespace = "wp/v2" } = postType; 3446 dispatch({ type: "REQUEST_POST_DELETE_START" }); 3447 try { 3448 const post = select.getCurrentPost(); 3449 await external_wp_apiFetch_default()({ 3450 path: `/$restNamespace}/$restBase}/$post.id}`, 3451 method: "DELETE" 3452 }); 3453 await dispatch.savePost(); 3454 } catch (error) { 3455 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( 3456 ...getNotificationArgumentsForTrashFail({ error }) 3457 ); 3458 } 3459 dispatch({ type: "REQUEST_POST_DELETE_FINISH" }); 3460 }; 3461 const autosave = ({ local = false, ...options } = {}) => async ({ select, dispatch }) => { 3462 const post = select.getCurrentPost(); 3463 if (post.type === "wp_template") { 3464 return; 3465 } 3466 if (local) { 3467 const isPostNew = select.isEditedPostNew(); 3468 const title = select.getEditedPostAttribute("title"); 3469 const content = select.getEditedPostAttribute("content"); 3470 const excerpt = select.getEditedPostAttribute("excerpt"); 3471 localAutosaveSet(post.id, isPostNew, title, content, excerpt); 3472 } else { 3473 await dispatch.savePost({ isAutosave: true, ...options }); 3474 } 3475 }; 3476 const __unstableSaveForPreview = ({ forceIsAutosaveable } = {}) => async ({ select, dispatch }) => { 3477 if ((forceIsAutosaveable || select.isEditedPostAutosaveable()) && !select.isPostLocked()) { 3478 const isDraft = ["draft", "auto-draft"].includes( 3479 select.getEditedPostAttribute("status") 3480 ); 3481 if (isDraft) { 3482 await dispatch.savePost({ isPreview: true }); 3483 } else { 3484 await dispatch.autosave({ isPreview: true }); 3485 } 3486 } 3487 return select.getEditedPostPreviewLink(); 3488 }; 3489 const redo = () => ({ registry }) => { 3490 registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); 3491 }; 3492 const undo = () => ({ registry }) => { 3493 registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); 3494 }; 3495 function createUndoLevel() { 3496 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { 3497 since: "6.0", 3498 version: "6.3", 3499 alternative: "Use the core entities store instead" 3500 }); 3501 return { type: "DO_NOTHING" }; 3502 } 3503 function updatePostLock(lock) { 3504 return { 3505 type: "UPDATE_POST_LOCK", 3506 lock 3507 }; 3508 } 3509 const enablePublishSidebar = () => ({ registry }) => { 3510 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "isPublishSidebarEnabled", true); 3511 }; 3512 const disablePublishSidebar = () => ({ registry }) => { 3513 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "isPublishSidebarEnabled", false); 3514 }; 3515 function lockPostSaving(lockName) { 3516 return { 3517 type: "LOCK_POST_SAVING", 3518 lockName 3519 }; 3520 } 3521 function unlockPostSaving(lockName) { 3522 return { 3523 type: "UNLOCK_POST_SAVING", 3524 lockName 3525 }; 3526 } 3527 function lockPostAutosaving(lockName) { 3528 return { 3529 type: "LOCK_POST_AUTOSAVING", 3530 lockName 3531 }; 3532 } 3533 function unlockPostAutosaving(lockName) { 3534 return { 3535 type: "UNLOCK_POST_AUTOSAVING", 3536 lockName 3537 }; 3538 } 3539 const resetEditorBlocks = (blocks, options = {}) => ({ select, dispatch, registry }) => { 3540 const { __unstableShouldCreateUndoLevel, selection } = options; 3541 const edits = { blocks, selection }; 3542 if (__unstableShouldCreateUndoLevel !== false) { 3543 const { id, type } = select.getCurrentPost(); 3544 const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord("postType", type, id).blocks === edits.blocks; 3545 if (noChange) { 3546 registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel("postType", type, id); 3547 return; 3548 } 3549 edits.content = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 3550 } 3551 dispatch.editPost(edits); 3552 }; 3553 function updateEditorSettings(settings) { 3554 return { 3555 type: "UPDATE_EDITOR_SETTINGS", 3556 settings 3557 }; 3558 } 3559 const setRenderingMode = (mode) => ({ dispatch, registry, select }) => { 3560 if (select.__unstableIsEditorReady() && !select.getEditorSettings().isPreviewMode) { 3561 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 3562 dispatch.editPost({ selection: void 0 }, { undoIgnore: true }); 3563 } 3564 dispatch({ 3565 type: "SET_RENDERING_MODE", 3566 mode 3567 }); 3568 }; 3569 function setDeviceType(deviceType) { 3570 return { 3571 type: "SET_DEVICE_TYPE", 3572 deviceType 3573 }; 3574 } 3575 const toggleEditorPanelEnabled = (panelName) => ({ registry }) => { 3576 const inactivePanels = registry.select(external_wp_preferences_namespaceObject.store).get("core", "inactivePanels") ?? []; 3577 const isPanelInactive = !!inactivePanels?.includes(panelName); 3578 let updatedInactivePanels; 3579 if (isPanelInactive) { 3580 updatedInactivePanels = inactivePanels.filter( 3581 (invactivePanelName) => invactivePanelName !== panelName 3582 ); 3583 } else { 3584 updatedInactivePanels = [...inactivePanels, panelName]; 3585 } 3586 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "inactivePanels", updatedInactivePanels); 3587 }; 3588 const toggleEditorPanelOpened = (panelName) => ({ registry }) => { 3589 const openPanels = registry.select(external_wp_preferences_namespaceObject.store).get("core", "openPanels") ?? []; 3590 const isPanelOpen = !!openPanels?.includes(panelName); 3591 let updatedOpenPanels; 3592 if (isPanelOpen) { 3593 updatedOpenPanels = openPanels.filter( 3594 (openPanelName) => openPanelName !== panelName 3595 ); 3596 } else { 3597 updatedOpenPanels = [...openPanels, panelName]; 3598 } 3599 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "openPanels", updatedOpenPanels); 3600 }; 3601 function removeEditorPanel(panelName) { 3602 return { 3603 type: "REMOVE_PANEL", 3604 panelName 3605 }; 3606 } 3607 const setIsInserterOpened = (value) => ({ dispatch, registry }) => { 3608 if (typeof value === "object" && value.hasOwnProperty("rootClientId") && value.hasOwnProperty("insertionIndex")) { 3609 unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).setInsertionPoint({ 3610 rootClientId: value.rootClientId, 3611 index: value.insertionIndex 3612 }); 3613 } 3614 dispatch({ 3615 type: "SET_IS_INSERTER_OPENED", 3616 value 3617 }); 3618 }; 3619 function setIsListViewOpened(isOpen) { 3620 return { 3621 type: "SET_IS_LIST_VIEW_OPENED", 3622 isOpen 3623 }; 3624 } 3625 const toggleDistractionFree = ({ createNotice = true } = {}) => ({ dispatch, registry }) => { 3626 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get("core", "distractionFree"); 3627 if (isDistractionFree) { 3628 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "fixedToolbar", false); 3629 } 3630 if (!isDistractionFree) { 3631 registry.batch(() => { 3632 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "fixedToolbar", true); 3633 dispatch.setIsInserterOpened(false); 3634 dispatch.setIsListViewOpened(false); 3635 unlock( 3636 registry.dispatch(external_wp_blockEditor_namespaceObject.store) 3637 ).resetZoomLevel(); 3638 }); 3639 } 3640 registry.batch(() => { 3641 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "distractionFree", !isDistractionFree); 3642 if (createNotice) { 3643 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice( 3644 isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)("Distraction free mode deactivated.") : (0,external_wp_i18n_namespaceObject.__)("Distraction free mode activated."), 3645 { 3646 id: "core/editor/distraction-free-mode/notice", 3647 type: "snackbar", 3648 actions: [ 3649 { 3650 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 3651 onClick: () => { 3652 registry.batch(() => { 3653 registry.dispatch(external_wp_preferences_namespaceObject.store).set( 3654 "core", 3655 "fixedToolbar", 3656 isDistractionFree 3657 ); 3658 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle( 3659 "core", 3660 "distractionFree" 3661 ); 3662 }); 3663 } 3664 } 3665 ] 3666 } 3667 ); 3668 } 3669 }); 3670 }; 3671 const toggleSpotlightMode = () => ({ registry }) => { 3672 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "focusMode"); 3673 const isFocusMode = registry.select(external_wp_preferences_namespaceObject.store).get("core", "focusMode"); 3674 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice( 3675 isFocusMode ? (0,external_wp_i18n_namespaceObject.__)("Spotlight mode activated.") : (0,external_wp_i18n_namespaceObject.__)("Spotlight mode deactivated."), 3676 { 3677 id: "core/editor/toggle-spotlight-mode/notice", 3678 type: "snackbar", 3679 actions: [ 3680 { 3681 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 3682 onClick: () => { 3683 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "focusMode"); 3684 } 3685 } 3686 ] 3687 } 3688 ); 3689 }; 3690 const toggleTopToolbar = () => ({ registry }) => { 3691 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "fixedToolbar"); 3692 const isTopToolbar = registry.select(external_wp_preferences_namespaceObject.store).get("core", "fixedToolbar"); 3693 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice( 3694 isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)("Top toolbar activated.") : (0,external_wp_i18n_namespaceObject.__)("Top toolbar deactivated."), 3695 { 3696 id: "core/editor/toggle-top-toolbar/notice", 3697 type: "snackbar", 3698 actions: [ 3699 { 3700 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 3701 onClick: () => { 3702 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle("core", "fixedToolbar"); 3703 } 3704 } 3705 ] 3706 } 3707 ); 3708 }; 3709 const switchEditorMode = (mode) => ({ dispatch, registry }) => { 3710 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "editorMode", mode); 3711 if (mode !== "visual") { 3712 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 3713 unlock(registry.dispatch(external_wp_blockEditor_namespaceObject.store)).resetZoomLevel(); 3714 } 3715 if (mode === "visual") { 3716 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Visual editor selected"), "assertive"); 3717 } else if (mode === "text") { 3718 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get("core", "distractionFree"); 3719 if (isDistractionFree) { 3720 dispatch.toggleDistractionFree(); 3721 } 3722 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)("Code editor selected"), "assertive"); 3723 } 3724 }; 3725 function openPublishSidebar() { 3726 return { 3727 type: "OPEN_PUBLISH_SIDEBAR" 3728 }; 3729 } 3730 function closePublishSidebar() { 3731 return { 3732 type: "CLOSE_PUBLISH_SIDEBAR" 3733 }; 3734 } 3735 function togglePublishSidebar() { 3736 return { 3737 type: "TOGGLE_PUBLISH_SIDEBAR" 3738 }; 3739 } 3740 const getBlockEditorAction = (name) => (...args) => ({ registry }) => { 3741 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + "`", { 3742 since: "5.3", 3743 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + "`", 3744 version: "6.2" 3745 }); 3746 registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); 3747 }; 3748 const resetBlocks = getBlockEditorAction("resetBlocks"); 3749 const receiveBlocks = getBlockEditorAction("receiveBlocks"); 3750 const updateBlock = getBlockEditorAction("updateBlock"); 3751 const updateBlockAttributes = getBlockEditorAction( 3752 "updateBlockAttributes" 3753 ); 3754 const selectBlock = getBlockEditorAction("selectBlock"); 3755 const startMultiSelect = getBlockEditorAction("startMultiSelect"); 3756 const stopMultiSelect = getBlockEditorAction("stopMultiSelect"); 3757 const multiSelect = getBlockEditorAction("multiSelect"); 3758 const clearSelectedBlock = getBlockEditorAction("clearSelectedBlock"); 3759 const toggleSelection = getBlockEditorAction("toggleSelection"); 3760 const replaceBlocks = getBlockEditorAction("replaceBlocks"); 3761 const replaceBlock = getBlockEditorAction("replaceBlock"); 3762 const moveBlocksDown = getBlockEditorAction("moveBlocksDown"); 3763 const moveBlocksUp = getBlockEditorAction("moveBlocksUp"); 3764 const moveBlockToPosition = getBlockEditorAction( 3765 "moveBlockToPosition" 3766 ); 3767 const insertBlock = getBlockEditorAction("insertBlock"); 3768 const insertBlocks = getBlockEditorAction("insertBlocks"); 3769 const showInsertionPoint = getBlockEditorAction("showInsertionPoint"); 3770 const hideInsertionPoint = getBlockEditorAction("hideInsertionPoint"); 3771 const setTemplateValidity = getBlockEditorAction( 3772 "setTemplateValidity" 3773 ); 3774 const synchronizeTemplate = getBlockEditorAction( 3775 "synchronizeTemplate" 3776 ); 3777 const mergeBlocks = getBlockEditorAction("mergeBlocks"); 3778 const removeBlocks = getBlockEditorAction("removeBlocks"); 3779 const removeBlock = getBlockEditorAction("removeBlock"); 3780 const toggleBlockMode = getBlockEditorAction("toggleBlockMode"); 3781 const startTyping = getBlockEditorAction("startTyping"); 3782 const stopTyping = getBlockEditorAction("stopTyping"); 3783 const enterFormattedText = getBlockEditorAction("enterFormattedText"); 3784 const exitFormattedText = getBlockEditorAction("exitFormattedText"); 3785 const insertDefaultBlock = getBlockEditorAction("insertDefaultBlock"); 3786 const updateBlockListSettings = getBlockEditorAction( 3787 "updateBlockListSettings" 3788 ); 3789 3790 3791 ;// external ["wp","htmlEntities"] 3792 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 3793 ;// ./node_modules/@wordpress/editor/build-module/store/utils/is-template-revertable.js 3794 3795 function isTemplateRevertable(templateOrTemplatePart) { 3796 if (!templateOrTemplatePart) { 3797 return false; 3798 } 3799 return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 3800 } 3801 3802 3803 ;// external ["wp","components"] 3804 const external_wp_components_namespaceObject = window["wp"]["components"]; 3805 ;// ./node_modules/@wordpress/fields/build-module/actions/utils.js 3806 3807 3808 function isTemplate(post) { 3809 return post.type === "wp_template"; 3810 } 3811 function isTemplatePart(post) { 3812 return post.type === "wp_template_part"; 3813 } 3814 function isTemplateOrTemplatePart(p) { 3815 return p.type === "wp_template" || p.type === "wp_template_part"; 3816 } 3817 function getItemTitle(item, fallback = (0,external_wp_i18n_namespaceObject.__)("(no title)")) { 3818 let title = ""; 3819 if (typeof item.title === "string") { 3820 title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); 3821 } else if (item.title && "rendered" in item.title) { 3822 title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); 3823 } else if (item.title && "raw" in item.title) { 3824 title = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); 3825 } 3826 return title || fallback; 3827 } 3828 function isTemplateRemovable(template) { 3829 if (!template) { 3830 return false; 3831 } 3832 return [template.source, template.source].includes("custom") && !Boolean(template.type === "wp_template" && template?.plugin) && !template.has_theme_file; 3833 } 3834 3835 3836 ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-post.js 3837 3838 3839 3840 3841 3842 3843 3844 3845 const duplicatePost = { 3846 id: "duplicate-post", 3847 label: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), 3848 isEligible({ status }) { 3849 return status !== "trash"; 3850 }, 3851 modalFocusOnMount: "firstContentElement", 3852 RenderModal: ({ items, closeModal, onActionPerformed }) => { 3853 const [item, setItem] = (0,external_wp_element_namespaceObject.useState)({ 3854 ...items[0], 3855 title: (0,external_wp_i18n_namespaceObject.sprintf)( 3856 /* translators: %s: Existing post title */ 3857 (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "post"), 3858 getItemTitle(items[0]) 3859 ) 3860 }); 3861 const [isCreatingPage, setIsCreatingPage] = (0,external_wp_element_namespaceObject.useState)(false); 3862 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 3863 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 3864 async function createPage(event) { 3865 event.preventDefault(); 3866 if (isCreatingPage) { 3867 return; 3868 } 3869 const isTemplate = item.type === "wp_template"; 3870 const newItemObject = { 3871 status: isTemplate ? "publish" : "draft", 3872 title: item.title, 3873 slug: isTemplate ? item.slug : item.title || (0,external_wp_i18n_namespaceObject.__)("No title"), 3874 comment_status: item.comment_status, 3875 content: typeof item.content === "string" ? item.content : item.content.raw, 3876 excerpt: typeof item.excerpt === "string" ? item.excerpt : item.excerpt?.raw, 3877 meta: item.meta, 3878 parent: item.parent, 3879 password: item.password, 3880 template: item.template, 3881 format: item.format, 3882 featured_media: item.featured_media, 3883 menu_order: item.menu_order, 3884 ping_status: item.ping_status 3885 }; 3886 const assignablePropertiesPrefix = "wp:action-assign-"; 3887 const assignableProperties = Object.keys(item?._links || {}).filter( 3888 (property) => property.startsWith(assignablePropertiesPrefix) 3889 ).map( 3890 (property) => property.slice(assignablePropertiesPrefix.length) 3891 ); 3892 assignableProperties.forEach((property) => { 3893 if (item.hasOwnProperty(property)) { 3894 newItemObject[property] = item[property]; 3895 } 3896 }); 3897 setIsCreatingPage(true); 3898 try { 3899 const newItem = await saveEntityRecord( 3900 "postType", 3901 item.type, 3902 newItemObject, 3903 { throwOnError: true } 3904 ); 3905 createSuccessNotice( 3906 (0,external_wp_i18n_namespaceObject.sprintf)( 3907 // translators: %s: Title of the created post, e.g: "Hello world". 3908 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), 3909 getItemTitle(newItem) 3910 ), 3911 { 3912 id: "duplicate-post-action", 3913 type: "snackbar" 3914 } 3915 ); 3916 if (onActionPerformed) { 3917 onActionPerformed([newItem]); 3918 } 3919 } catch (error) { 3920 const typedError = error; 3921 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while duplicating the page."); 3922 createErrorNotice(errorMessage, { 3923 type: "snackbar" 3924 }); 3925 } finally { 3926 setIsCreatingPage(false); 3927 closeModal?.(); 3928 } 3929 } 3930 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: createPage, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 3931 typeof item.id === "string" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: (0,external_wp_i18n_namespaceObject.__)( 3932 "You are about to duplicate a bundled template. Changes will not be live until you activate the new template." 3933 ) }), 3934 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 3935 external_wp_components_namespaceObject.__experimentalInputControl, 3936 { 3937 __next40pxDefaultSize: true, 3938 label: (0,external_wp_i18n_namespaceObject.__)("Title"), 3939 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 3940 value: getItemTitle(item), 3941 onChange: (value) => setItem((prev) => ({ 3942 ...prev, 3943 title: value || (0,external_wp_i18n_namespaceObject.__)("No title") 3944 })) 3945 } 3946 ), 3947 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: 2, justify: "end", children: [ 3948 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 3949 external_wp_components_namespaceObject.Button, 3950 { 3951 variant: "tertiary", 3952 onClick: closeModal, 3953 __next40pxDefaultSize: true, 3954 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 3955 } 3956 ), 3957 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 3958 external_wp_components_namespaceObject.Button, 3959 { 3960 variant: "primary", 3961 type: "submit", 3962 isBusy: isCreatingPage, 3963 "aria-disabled": isCreatingPage, 3964 __next40pxDefaultSize: true, 3965 children: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label") 3966 } 3967 ) 3968 ] }) 3969 ] }) }); 3970 } 3971 }; 3972 var duplicate_post_default = duplicatePost; 3973 3974 3975 ;// ./node_modules/@wordpress/icons/build-module/library/external.js 3976 3977 3978 var external_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); 3979 3980 3981 ;// ./node_modules/@wordpress/fields/build-module/actions/view-post.js 3982 3983 3984 const viewPost = { 3985 id: "view-post", 3986 label: (0,external_wp_i18n_namespaceObject._x)("View", "verb"), 3987 isPrimary: true, 3988 icon: external_default, 3989 isEligible(post) { 3990 return post.status !== "trash"; 3991 }, 3992 callback(posts, { onActionPerformed }) { 3993 const post = posts[0]; 3994 window.open(post?.link, "_blank"); 3995 if (onActionPerformed) { 3996 onActionPerformed(posts); 3997 } 3998 } 3999 }; 4000 var view_post_default = viewPost; 4001 4002 4003 ;// ./node_modules/@wordpress/fields/build-module/actions/view-post-revisions.js 4004 4005 4006 const viewPostRevisions = { 4007 id: "view-post-revisions", 4008 context: "list", 4009 label(items) { 4010 const revisionsCount = items[0]._links?.["version-history"]?.[0]?.count ?? 0; 4011 return (0,external_wp_i18n_namespaceObject.sprintf)( 4012 /* translators: %d: number of revisions. */ 4013 (0,external_wp_i18n_namespaceObject.__)("View revisions (%d)"), 4014 revisionsCount 4015 ); 4016 }, 4017 isEligible(post) { 4018 if (post.status === "trash") { 4019 return false; 4020 } 4021 const lastRevisionId = post?._links?.["predecessor-version"]?.[0]?.id ?? null; 4022 const revisionsCount = post?._links?.["version-history"]?.[0]?.count ?? 0; 4023 return !!lastRevisionId && revisionsCount > 1; 4024 }, 4025 callback(posts, { onActionPerformed }) { 4026 const post = posts[0]; 4027 const href = (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { 4028 revision: post?._links?.["predecessor-version"]?.[0]?.id 4029 }); 4030 document.location.href = href; 4031 if (onActionPerformed) { 4032 onActionPerformed(posts); 4033 } 4034 } 4035 }; 4036 var view_post_revisions_default = viewPostRevisions; 4037 4038 4039 ;// ./node_modules/@wordpress/icons/build-module/library/check.js 4040 4041 4042 var check_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 4043 4044 4045 ;// ./node_modules/tslib/tslib.es6.mjs 4046 /****************************************************************************** 4047 Copyright (c) Microsoft Corporation. 4048 4049 Permission to use, copy, modify, and/or distribute this software for any 4050 purpose with or without fee is hereby granted. 4051 4052 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 4053 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 4054 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 4055 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 4056 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 4057 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 4058 PERFORMANCE OF THIS SOFTWARE. 4059 ***************************************************************************** */ 4060 /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ 4061 4062 var extendStatics = function(d, b) { 4063 extendStatics = Object.setPrototypeOf || 4064 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 4065 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 4066 return extendStatics(d, b); 4067 }; 4068 4069 function __extends(d, b) { 4070 if (typeof b !== "function" && b !== null) 4071 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 4072 extendStatics(d, b); 4073 function __() { this.constructor = d; } 4074 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 4075 } 4076 4077 var __assign = function() { 4078 __assign = Object.assign || function __assign(t) { 4079 for (var s, i = 1, n = arguments.length; i < n; i++) { 4080 s = arguments[i]; 4081 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 4082 } 4083 return t; 4084 } 4085 return __assign.apply(this, arguments); 4086 } 4087 4088 function __rest(s, e) { 4089 var t = {}; 4090 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 4091 t[p] = s[p]; 4092 if (s != null && typeof Object.getOwnPropertySymbols === "function") 4093 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 4094 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 4095 t[p[i]] = s[p[i]]; 4096 } 4097 return t; 4098 } 4099 4100 function __decorate(decorators, target, key, desc) { 4101 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4102 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 4103 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 4104 return c > 3 && r && Object.defineProperty(target, key, r), r; 4105 } 4106 4107 function __param(paramIndex, decorator) { 4108 return function (target, key) { decorator(target, key, paramIndex); } 4109 } 4110 4111 function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 4112 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 4113 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 4114 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 4115 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 4116 var _, done = false; 4117 for (var i = decorators.length - 1; i >= 0; i--) { 4118 var context = {}; 4119 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 4120 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 4121 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 4122 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 4123 if (kind === "accessor") { 4124 if (result === void 0) continue; 4125 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 4126 if (_ = accept(result.get)) descriptor.get = _; 4127 if (_ = accept(result.set)) descriptor.set = _; 4128 if (_ = accept(result.init)) initializers.unshift(_); 4129 } 4130 else if (_ = accept(result)) { 4131 if (kind === "field") initializers.unshift(_); 4132 else descriptor[key] = _; 4133 } 4134 } 4135 if (target) Object.defineProperty(target, contextIn.name, descriptor); 4136 done = true; 4137 }; 4138 4139 function __runInitializers(thisArg, initializers, value) { 4140 var useValue = arguments.length > 2; 4141 for (var i = 0; i < initializers.length; i++) { 4142 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 4143 } 4144 return useValue ? value : void 0; 4145 }; 4146 4147 function __propKey(x) { 4148 return typeof x === "symbol" ? x : "".concat(x); 4149 }; 4150 4151 function __setFunctionName(f, name, prefix) { 4152 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 4153 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 4154 }; 4155 4156 function __metadata(metadataKey, metadataValue) { 4157 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 4158 } 4159 4160 function __awaiter(thisArg, _arguments, P, generator) { 4161 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4162 return new (P || (P = Promise))(function (resolve, reject) { 4163 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 4164 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 4165 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 4166 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4167 }); 4168 } 4169 4170 function __generator(thisArg, body) { 4171 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 4172 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 4173 function verb(n) { return function (v) { return step([n, v]); }; } 4174 function step(op) { 4175 if (f) throw new TypeError("Generator is already executing."); 4176 while (g && (g = 0, op[0] && (_ = 0)), _) try { 4177 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 4178 if (y = 0, t) op = [op[0] & 2, t.value]; 4179 switch (op[0]) { 4180 case 0: case 1: t = op; break; 4181 case 4: _.label++; return { value: op[1], done: false }; 4182 case 5: _.label++; y = op[1]; op = [0]; continue; 4183 case 7: op = _.ops.pop(); _.trys.pop(); continue; 4184 default: 4185 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 4186 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 4187 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 4188 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 4189 if (t[2]) _.ops.pop(); 4190 _.trys.pop(); continue; 4191 } 4192 op = body.call(thisArg, _); 4193 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 4194 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 4195 } 4196 } 4197 4198 var __createBinding = Object.create ? (function(o, m, k, k2) { 4199 if (k2 === undefined) k2 = k; 4200 var desc = Object.getOwnPropertyDescriptor(m, k); 4201 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 4202 desc = { enumerable: true, get: function() { return m[k]; } }; 4203 } 4204 Object.defineProperty(o, k2, desc); 4205 }) : (function(o, m, k, k2) { 4206 if (k2 === undefined) k2 = k; 4207 o[k2] = m[k]; 4208 }); 4209 4210 function __exportStar(m, o) { 4211 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 4212 } 4213 4214 function __values(o) { 4215 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 4216 if (m) return m.call(o); 4217 if (o && typeof o.length === "number") return { 4218 next: function () { 4219 if (o && i >= o.length) o = void 0; 4220 return { value: o && o[i++], done: !o }; 4221 } 4222 }; 4223 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 4224 } 4225 4226 function __read(o, n) { 4227 var m = typeof Symbol === "function" && o[Symbol.iterator]; 4228 if (!m) return o; 4229 var i = m.call(o), r, ar = [], e; 4230 try { 4231 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 4232 } 4233 catch (error) { e = { error: error }; } 4234 finally { 4235 try { 4236 if (r && !r.done && (m = i["return"])) m.call(i); 4237 } 4238 finally { if (e) throw e.error; } 4239 } 4240 return ar; 4241 } 4242 4243 /** @deprecated */ 4244 function __spread() { 4245 for (var ar = [], i = 0; i < arguments.length; i++) 4246 ar = ar.concat(__read(arguments[i])); 4247 return ar; 4248 } 4249 4250 /** @deprecated */ 4251 function __spreadArrays() { 4252 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 4253 for (var r = Array(s), k = 0, i = 0; i < il; i++) 4254 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 4255 r[k] = a[j]; 4256 return r; 4257 } 4258 4259 function __spreadArray(to, from, pack) { 4260 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 4261 if (ar || !(i in from)) { 4262 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 4263 ar[i] = from[i]; 4264 } 4265 } 4266 return to.concat(ar || Array.prototype.slice.call(from)); 4267 } 4268 4269 function __await(v) { 4270 return this instanceof __await ? (this.v = v, this) : new __await(v); 4271 } 4272 4273 function __asyncGenerator(thisArg, _arguments, generator) { 4274 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 4275 var g = generator.apply(thisArg, _arguments || []), i, q = []; 4276 return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; 4277 function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } 4278 function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } 4279 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 4280 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 4281 function fulfill(value) { resume("next", value); } 4282 function reject(value) { resume("throw", value); } 4283 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 4284 } 4285 4286 function __asyncDelegator(o) { 4287 var i, p; 4288 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 4289 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } 4290 } 4291 4292 function __asyncValues(o) { 4293 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 4294 var m = o[Symbol.asyncIterator], i; 4295 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 4296 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 4297 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 4298 } 4299 4300 function __makeTemplateObject(cooked, raw) { 4301 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 4302 return cooked; 4303 }; 4304 4305 var __setModuleDefault = Object.create ? (function(o, v) { 4306 Object.defineProperty(o, "default", { enumerable: true, value: v }); 4307 }) : function(o, v) { 4308 o["default"] = v; 4309 }; 4310 4311 var ownKeys = function(o) { 4312 ownKeys = Object.getOwnPropertyNames || function (o) { 4313 var ar = []; 4314 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 4315 return ar; 4316 }; 4317 return ownKeys(o); 4318 }; 4319 4320 function __importStar(mod) { 4321 if (mod && mod.__esModule) return mod; 4322 var result = {}; 4323 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 4324 __setModuleDefault(result, mod); 4325 return result; 4326 } 4327 4328 function __importDefault(mod) { 4329 return (mod && mod.__esModule) ? mod : { default: mod }; 4330 } 4331 4332 function __classPrivateFieldGet(receiver, state, kind, f) { 4333 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 4334 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 4335 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 4336 } 4337 4338 function __classPrivateFieldSet(receiver, state, value, kind, f) { 4339 if (kind === "m") throw new TypeError("Private method is not writable"); 4340 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 4341 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 4342 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 4343 } 4344 4345 function __classPrivateFieldIn(state, receiver) { 4346 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 4347 return typeof state === "function" ? receiver === state : state.has(receiver); 4348 } 4349 4350 function __addDisposableResource(env, value, async) { 4351 if (value !== null && value !== void 0) { 4352 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 4353 var dispose, inner; 4354 if (async) { 4355 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 4356 dispose = value[Symbol.asyncDispose]; 4357 } 4358 if (dispose === void 0) { 4359 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 4360 dispose = value[Symbol.dispose]; 4361 if (async) inner = dispose; 4362 } 4363 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 4364 if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; 4365 env.stack.push({ value: value, dispose: dispose, async: async }); 4366 } 4367 else if (async) { 4368 env.stack.push({ async: true }); 4369 } 4370 return value; 4371 } 4372 4373 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 4374 var e = new Error(message); 4375 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 4376 }; 4377 4378 function __disposeResources(env) { 4379 function fail(e) { 4380 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 4381 env.hasError = true; 4382 } 4383 var r, s = 0; 4384 function next() { 4385 while (r = env.stack.pop()) { 4386 try { 4387 if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); 4388 if (r.dispose) { 4389 var result = r.dispose.call(r.value); 4390 if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 4391 } 4392 else s |= 1; 4393 } 4394 catch (e) { 4395 fail(e); 4396 } 4397 } 4398 if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); 4399 if (env.hasError) throw env.error; 4400 } 4401 return next(); 4402 } 4403 4404 function __rewriteRelativeImportExtension(path, preserveJsx) { 4405 if (typeof path === "string" && /^\.\.?\//.test(path)) { 4406 return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { 4407 return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); 4408 }); 4409 } 4410 return path; 4411 } 4412 4413 /* harmony default export */ const tslib_es6 = ({ 4414 __extends, 4415 __assign, 4416 __rest, 4417 __decorate, 4418 __param, 4419 __esDecorate, 4420 __runInitializers, 4421 __propKey, 4422 __setFunctionName, 4423 __metadata, 4424 __awaiter, 4425 __generator, 4426 __createBinding, 4427 __exportStar, 4428 __values, 4429 __read, 4430 __spread, 4431 __spreadArrays, 4432 __spreadArray, 4433 __await, 4434 __asyncGenerator, 4435 __asyncDelegator, 4436 __asyncValues, 4437 __makeTemplateObject, 4438 __importStar, 4439 __importDefault, 4440 __classPrivateFieldGet, 4441 __classPrivateFieldSet, 4442 __classPrivateFieldIn, 4443 __addDisposableResource, 4444 __disposeResources, 4445 __rewriteRelativeImportExtension, 4446 }); 4447 4448 ;// ./node_modules/lower-case/dist.es2015/index.js 4449 /** 4450 * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt 4451 */ 4452 var SUPPORTED_LOCALE = { 4453 tr: { 4454 regexp: /\u0130|\u0049|\u0049\u0307/g, 4455 map: { 4456 İ: "\u0069", 4457 I: "\u0131", 4458 İ: "\u0069", 4459 }, 4460 }, 4461 az: { 4462 regexp: /\u0130/g, 4463 map: { 4464 İ: "\u0069", 4465 I: "\u0131", 4466 İ: "\u0069", 4467 }, 4468 }, 4469 lt: { 4470 regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g, 4471 map: { 4472 I: "\u0069\u0307", 4473 J: "\u006A\u0307", 4474 Į: "\u012F\u0307", 4475 Ì: "\u0069\u0307\u0300", 4476 Í: "\u0069\u0307\u0301", 4477 Ĩ: "\u0069\u0307\u0303", 4478 }, 4479 }, 4480 }; 4481 /** 4482 * Localized lower case. 4483 */ 4484 function localeLowerCase(str, locale) { 4485 var lang = SUPPORTED_LOCALE[locale.toLowerCase()]; 4486 if (lang) 4487 return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; })); 4488 return lowerCase(str); 4489 } 4490 /** 4491 * Lower case as a function. 4492 */ 4493 function lowerCase(str) { 4494 return str.toLowerCase(); 4495 } 4496 4497 ;// ./node_modules/no-case/dist.es2015/index.js 4498 4499 // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case"). 4500 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 4501 // Remove all non-word characters. 4502 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 4503 /** 4504 * Normalize the string into something other libraries can manipulate easier. 4505 */ 4506 function noCase(input, options) { 4507 if (options === void 0) { options = {}; } 4508 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 4509 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 4510 var start = 0; 4511 var end = result.length; 4512 // Trim the delimiter from around the output string. 4513 while (result.charAt(start) === "\0") 4514 start++; 4515 while (result.charAt(end - 1) === "\0") 4516 end--; 4517 // Transform each token independently. 4518 return result.slice(start, end).split("\0").map(transform).join(delimiter); 4519 } 4520 /** 4521 * Replace `re` in the input string with the replacement value. 4522 */ 4523 function replace(input, re, value) { 4524 if (re instanceof RegExp) 4525 return input.replace(re, value); 4526 return re.reduce(function (input, re) { return input.replace(re, value); }, input); 4527 } 4528 4529 ;// ./node_modules/dot-case/dist.es2015/index.js 4530 4531 4532 function dotCase(input, options) { 4533 if (options === void 0) { options = {}; } 4534 return noCase(input, __assign({ delimiter: "." }, options)); 4535 } 4536 4537 ;// ./node_modules/param-case/dist.es2015/index.js 4538 4539 4540 function paramCase(input, options) { 4541 if (options === void 0) { options = {}; } 4542 return dotCase(input, __assign({ delimiter: "-" }, options)); 4543 } 4544 4545 ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/utils.js 4546 4547 4548 4549 const useExistingTemplateParts = () => { 4550 return (0,external_wp_data_namespaceObject.useSelect)( 4551 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords( 4552 "postType", 4553 "wp_template_part", 4554 { 4555 per_page: -1 4556 } 4557 ), 4558 [] 4559 ) ?? []; 4560 }; 4561 const getUniqueTemplatePartTitle = (title, templateParts) => { 4562 const lowercaseTitle = title.toLowerCase(); 4563 const existingTitles = templateParts.map( 4564 (templatePart) => templatePart.title.rendered.toLowerCase() 4565 ); 4566 if (!existingTitles.includes(lowercaseTitle)) { 4567 return title; 4568 } 4569 let suffix = 2; 4570 while (existingTitles.includes(`$lowercaseTitle} $suffix}`)) { 4571 suffix++; 4572 } 4573 return `$title} $suffix}`; 4574 }; 4575 const getCleanTemplatePartSlug = (title) => { 4576 return paramCase(title).replace(/[^\w-]+/g, "") || "wp-custom-part"; 4577 }; 4578 4579 4580 ;// ./node_modules/@wordpress/fields/build-module/components/create-template-part-modal/index.js 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 function getAreaRadioId(value, instanceId) { 4593 return `fields-create-template-part-modal__area-option-$value}-$instanceId}`; 4594 } 4595 function getAreaRadioDescriptionId(value, instanceId) { 4596 return `fields-create-template-part-modal__area-option-description-$value}-$instanceId}`; 4597 } 4598 function CreateTemplatePartModal({ 4599 modalTitle, 4600 ...restProps 4601 }) { 4602 const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)( 4603 (select) => select(external_wp_coreData_namespaceObject.store).getPostType("wp_template_part")?.labels?.add_new_item, 4604 [] 4605 ); 4606 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4607 external_wp_components_namespaceObject.Modal, 4608 { 4609 title: modalTitle || defaultModalTitle, 4610 onRequestClose: restProps.closeModal, 4611 overlayClassName: "fields-create-template-part-modal", 4612 focusOnMount: "firstContentElement", 4613 size: "medium", 4614 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateTemplatePartModalContents, { ...restProps }) 4615 } 4616 ); 4617 } 4618 const create_template_part_modal_getTemplatePartIcon = (iconName) => { 4619 if ("header" === iconName) { 4620 return header_default; 4621 } else if ("footer" === iconName) { 4622 return footer_default; 4623 } else if ("sidebar" === iconName) { 4624 return sidebar_default; 4625 } 4626 return symbol_filled_default; 4627 }; 4628 function CreateTemplatePartModalContents({ 4629 defaultArea = "uncategorized", 4630 blocks = [], 4631 confirmLabel = (0,external_wp_i18n_namespaceObject.__)("Add"), 4632 closeModal, 4633 onCreate, 4634 onError, 4635 defaultTitle = "" 4636 }) { 4637 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 4638 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 4639 const existingTemplateParts = useExistingTemplateParts(); 4640 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle); 4641 const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(defaultArea); 4642 const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false); 4643 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal); 4644 const defaultTemplatePartAreas = (0,external_wp_data_namespaceObject.useSelect)( 4645 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas, 4646 [] 4647 ); 4648 async function createTemplatePart() { 4649 if (!title || isSubmitting) { 4650 return; 4651 } 4652 try { 4653 setIsSubmitting(true); 4654 const uniqueTitle = getUniqueTemplatePartTitle( 4655 title, 4656 existingTemplateParts 4657 ); 4658 const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); 4659 const templatePart = await saveEntityRecord( 4660 "postType", 4661 "wp_template_part", 4662 { 4663 slug: cleanSlug, 4664 title: uniqueTitle, 4665 content: (0,external_wp_blocks_namespaceObject.serialize)(blocks), 4666 area 4667 }, 4668 { throwOnError: true } 4669 ); 4670 await onCreate(templatePart); 4671 } catch (error) { 4672 const errorMessage = error instanceof Error && "code" in error && error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)( 4673 "An error occurred while creating the template part." 4674 ); 4675 createErrorNotice(errorMessage, { type: "snackbar" }); 4676 onError?.(); 4677 } finally { 4678 setIsSubmitting(false); 4679 } 4680 } 4681 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4682 "form", 4683 { 4684 onSubmit: async (event) => { 4685 event.preventDefault(); 4686 await createTemplatePart(); 4687 }, 4688 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "4", children: [ 4689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4690 external_wp_components_namespaceObject.TextControl, 4691 { 4692 __next40pxDefaultSize: true, 4693 __nextHasNoMarginBottom: true, 4694 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 4695 value: title, 4696 onChange: setTitle, 4697 required: true 4698 } 4699 ), 4700 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-create-template-part-modal__area-fieldset", children: [ 4701 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, { as: "legend", children: (0,external_wp_i18n_namespaceObject.__)("Area") }), 4702 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-create-template-part-modal__area-radio-group", children: (defaultTemplatePartAreas ?? []).map( 4703 (item) => { 4704 const icon = create_template_part_modal_getTemplatePartIcon(item.icon); 4705 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 4706 "div", 4707 { 4708 className: "fields-create-template-part-modal__area-radio-wrapper", 4709 children: [ 4710 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4711 "input", 4712 { 4713 type: "radio", 4714 id: getAreaRadioId( 4715 item.area, 4716 instanceId 4717 ), 4718 name: `fields-create-template-part-modal__area-$instanceId}`, 4719 value: item.area, 4720 checked: area === item.area, 4721 onChange: () => { 4722 setArea(item.area); 4723 }, 4724 "aria-describedby": getAreaRadioDescriptionId( 4725 item.area, 4726 instanceId 4727 ) 4728 } 4729 ), 4730 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4731 external_wp_components_namespaceObject.Icon, 4732 { 4733 icon, 4734 className: "fields-create-template-part-modal__area-radio-icon" 4735 } 4736 ), 4737 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4738 "label", 4739 { 4740 htmlFor: getAreaRadioId( 4741 item.area, 4742 instanceId 4743 ), 4744 className: "fields-create-template-part-modal__area-radio-label", 4745 children: item.label 4746 } 4747 ), 4748 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4749 external_wp_components_namespaceObject.Icon, 4750 { 4751 icon: check_default, 4752 className: "fields-create-template-part-modal__area-radio-checkmark" 4753 } 4754 ), 4755 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4756 "p", 4757 { 4758 className: "fields-create-template-part-modal__area-radio-description", 4759 id: getAreaRadioDescriptionId( 4760 item.area, 4761 instanceId 4762 ), 4763 children: item.description 4764 } 4765 ) 4766 ] 4767 }, 4768 item.area 4769 ); 4770 } 4771 ) }) 4772 ] }), 4773 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 4774 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4775 external_wp_components_namespaceObject.Button, 4776 { 4777 __next40pxDefaultSize: true, 4778 variant: "tertiary", 4779 onClick: () => { 4780 closeModal(); 4781 }, 4782 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 4783 } 4784 ), 4785 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4786 external_wp_components_namespaceObject.Button, 4787 { 4788 __next40pxDefaultSize: true, 4789 variant: "primary", 4790 type: "submit", 4791 "aria-disabled": !title || isSubmitting, 4792 isBusy: isSubmitting, 4793 children: confirmLabel 4794 } 4795 ) 4796 ] }) 4797 ] }) 4798 } 4799 ); 4800 } 4801 4802 4803 ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-template-part.js 4804 4805 4806 4807 4808 4809 4810 4811 4812 const duplicateTemplatePart = { 4813 id: "duplicate-template-part", 4814 label: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), 4815 isEligible: (item) => item.type === "wp_template_part", 4816 modalHeader: (0,external_wp_i18n_namespaceObject._x)("Duplicate template part", "action label"), 4817 modalFocusOnMount: "firstContentElement", 4818 RenderModal: ({ items, closeModal }) => { 4819 const [item] = items; 4820 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 4821 return item.blocks ?? (0,external_wp_blocks_namespaceObject.parse)( 4822 typeof item.content === "string" ? item.content : item.content.raw, 4823 { 4824 __unstableSkipMigrationLogs: true 4825 } 4826 ); 4827 }, [item.content, item.blocks]); 4828 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 4829 function onTemplatePartSuccess(templatePart) { 4830 createSuccessNotice( 4831 (0,external_wp_i18n_namespaceObject.sprintf)( 4832 // translators: %s: The new template part's title e.g. 'Call to action (copy)'. 4833 (0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', "template part"), 4834 getItemTitle(templatePart) 4835 ), 4836 { type: "snackbar", id: "edit-site-patterns-success" } 4837 ); 4838 closeModal?.(); 4839 } 4840 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4841 CreateTemplatePartModalContents, 4842 { 4843 blocks, 4844 defaultArea: item.area, 4845 defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)( 4846 /* translators: %s: Existing template part title */ 4847 (0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "template part"), 4848 getItemTitle(item) 4849 ), 4850 onCreate: onTemplatePartSuccess, 4851 onError: closeModal, 4852 confirmLabel: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), 4853 closeModal: closeModal ?? (() => { 4854 }) 4855 } 4856 ); 4857 } 4858 }; 4859 var duplicate_template_part_default = duplicateTemplatePart; 4860 4861 4862 ;// external ["wp","patterns"] 4863 const external_wp_patterns_namespaceObject = window["wp"]["patterns"]; 4864 ;// ./node_modules/@wordpress/fields/build-module/lock-unlock.js 4865 4866 const { lock: lock_unlock_lock, unlock: lock_unlock_unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 4867 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 4868 "@wordpress/fields" 4869 ); 4870 4871 4872 ;// ./node_modules/@wordpress/fields/build-module/actions/duplicate-pattern.js 4873 4874 4875 4876 4877 const { CreatePatternModalContents, useDuplicatePatternProps } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 4878 const duplicatePattern = { 4879 id: "duplicate-pattern", 4880 label: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), 4881 isEligible: (item) => item.type !== "wp_template_part", 4882 modalHeader: (0,external_wp_i18n_namespaceObject._x)("Duplicate pattern", "action label"), 4883 modalFocusOnMount: "firstContentElement", 4884 RenderModal: ({ items, closeModal }) => { 4885 const [item] = items; 4886 const duplicatedProps = useDuplicatePatternProps({ 4887 pattern: item, 4888 onSuccess: () => closeModal?.() 4889 }); 4890 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4891 CreatePatternModalContents, 4892 { 4893 onClose: closeModal, 4894 confirmLabel: (0,external_wp_i18n_namespaceObject._x)("Duplicate", "action label"), 4895 ...duplicatedProps 4896 } 4897 ); 4898 } 4899 }; 4900 var duplicate_pattern_default = duplicatePattern; 4901 4902 4903 ;// ./node_modules/@wordpress/fields/build-module/actions/rename-post.js 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 const { PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 4915 const renamePost = { 4916 id: "rename-post", 4917 label: (0,external_wp_i18n_namespaceObject.__)("Rename"), 4918 modalFocusOnMount: "firstContentElement", 4919 isEligible(post) { 4920 if (post.status === "trash") { 4921 return false; 4922 } 4923 if (post.type === "wp_template" && typeof post.id === "string") { 4924 return false; 4925 } 4926 if (![ 4927 "wp_template_part", 4928 ...Object.values(PATTERN_TYPES) 4929 ].includes(post.type)) { 4930 return post.permissions?.update; 4931 } 4932 if (isTemplatePart(post)) { 4933 return post.source === "custom" && !post?.has_theme_file && post.permissions?.update; 4934 } 4935 return post.type === PATTERN_TYPES.user && post.permissions?.update; 4936 }, 4937 RenderModal: ({ items, closeModal, onActionPerformed }) => { 4938 const [item] = items; 4939 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => getItemTitle(item, "")); 4940 const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 4941 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 4942 async function onRename(event) { 4943 event.preventDefault(); 4944 try { 4945 await editEntityRecord("postType", item.type, item.id, { 4946 title 4947 }); 4948 setTitle(""); 4949 closeModal?.(); 4950 await saveEditedEntityRecord("postType", item.type, item.id, { 4951 throwOnError: true 4952 }); 4953 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Name updated"), { 4954 type: "snackbar" 4955 }); 4956 onActionPerformed?.(items); 4957 } catch (error) { 4958 const typedError = error; 4959 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while updating the name"); 4960 createErrorNotice(errorMessage, { type: "snackbar" }); 4961 } 4962 } 4963 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 4964 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4965 external_wp_components_namespaceObject.TextControl, 4966 { 4967 __nextHasNoMarginBottom: true, 4968 __next40pxDefaultSize: true, 4969 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 4970 value: title, 4971 onChange: setTitle, 4972 required: true 4973 } 4974 ), 4975 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 4976 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4977 external_wp_components_namespaceObject.Button, 4978 { 4979 __next40pxDefaultSize: true, 4980 variant: "tertiary", 4981 onClick: () => { 4982 closeModal?.(); 4983 }, 4984 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 4985 } 4986 ), 4987 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 4988 external_wp_components_namespaceObject.Button, 4989 { 4990 __next40pxDefaultSize: true, 4991 variant: "primary", 4992 type: "submit", 4993 children: (0,external_wp_i18n_namespaceObject.__)("Save") 4994 } 4995 ) 4996 ] }) 4997 ] }) }); 4998 } 4999 }; 5000 var rename_post_default = renamePost; 5001 5002 5003 ;// ./node_modules/@wordpress/fields/build-module/actions/reorder-page.js 5004 5005 5006 5007 5008 5009 5010 5011 function isItemValid(item) { 5012 return typeof item.menu_order === "number" && Number.isInteger(item.menu_order) && item.menu_order > 0; 5013 } 5014 function ReorderModal({ 5015 items, 5016 closeModal, 5017 onActionPerformed 5018 }) { 5019 const [item, setItem] = (0,external_wp_element_namespaceObject.useState)(items[0]); 5020 const { editEntityRecord, saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5021 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5022 const isValid = isItemValid(item); 5023 async function onOrder(event) { 5024 event.preventDefault(); 5025 if (!isValid) { 5026 return; 5027 } 5028 try { 5029 await editEntityRecord("postType", item.type, item.id, { 5030 menu_order: item.menu_order 5031 }); 5032 closeModal?.(); 5033 await saveEditedEntityRecord("postType", item.type, item.id, { 5034 throwOnError: true 5035 }); 5036 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Order updated."), { 5037 type: "snackbar" 5038 }); 5039 onActionPerformed?.(items); 5040 } catch (error) { 5041 const typedError = error; 5042 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while updating the order"); 5043 createErrorNotice(errorMessage, { 5044 type: "snackbar" 5045 }); 5046 } 5047 } 5048 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onOrder, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 5049 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: (0,external_wp_i18n_namespaceObject.__)( 5050 "Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported." 5051 ) }), 5052 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5053 external_wp_components_namespaceObject.__experimentalInputControl, 5054 { 5055 __next40pxDefaultSize: true, 5056 label: (0,external_wp_i18n_namespaceObject.__)("Order"), 5057 type: "number", 5058 value: typeof item.menu_order === "number" && Number.isInteger(item.menu_order) ? String(item.menu_order) : "", 5059 onChange: (value) => { 5060 const parsed = parseInt(value, 10); 5061 setItem({ 5062 ...item, 5063 menu_order: isNaN(parsed) ? void 0 : parsed 5064 }); 5065 } 5066 } 5067 ), 5068 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 5069 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5070 external_wp_components_namespaceObject.Button, 5071 { 5072 __next40pxDefaultSize: true, 5073 variant: "tertiary", 5074 onClick: () => { 5075 closeModal?.(); 5076 }, 5077 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 5078 } 5079 ), 5080 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5081 external_wp_components_namespaceObject.Button, 5082 { 5083 __next40pxDefaultSize: true, 5084 variant: "primary", 5085 type: "submit", 5086 accessibleWhenDisabled: true, 5087 disabled: !isValid, 5088 children: (0,external_wp_i18n_namespaceObject.__)("Save") 5089 } 5090 ) 5091 ] }) 5092 ] }) }); 5093 } 5094 const reorderPage = { 5095 id: "order-pages", 5096 label: (0,external_wp_i18n_namespaceObject.__)("Order"), 5097 isEligible({ status }) { 5098 return status !== "trash"; 5099 }, 5100 modalFocusOnMount: "firstContentElement", 5101 RenderModal: ReorderModal 5102 }; 5103 var reorder_page_default = reorderPage; 5104 5105 5106 ;// ./node_modules/client-zip/index.js 5107 "stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function o(e,i,r){void 0===i||i instanceof Date||(i=new Date(i));const o=void 0!==e;if(r||(r=o?436:509),e instanceof File)return{isFile:o,t:i||new Date(e.lastModified),bytes:e.stream(),mode:r};if(e instanceof Response)return{isFile:o,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),bytes:e.body,mode:r};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(!o)return{isFile:o,t:i,mode:r};if("string"==typeof e)return{isFile:o,t:i,bytes:t(e),mode:r};if(e instanceof Blob)return{isFile:o,t:i,bytes:e.stream(),mode:r};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:o,t:i,bytes:e,mode:r};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:o,t:i,bytes:n(e),mode:r};if(Symbol.asyncIterator in e)return{isFile:o,t:i,bytes:f(e[Symbol.asyncIterator]()),mode:r};throw new TypeError("Unsupported input format.")}function f(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[o,f]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{i:d(o||t(e.name)),o:BigInt(e.size),u:f};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{i:d(o||t(s)),o:BigInt(u),u:f}}return o=d(o,void 0!==e||void 0!==r),"string"==typeof e?{i:o,o:BigInt(t(e).length),u:f}:e instanceof Blob?{i:o,o:BigInt(e.size),u:f}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:o,o:BigInt(e.byteLength),u:f}:{i:o,o:u(e,r),u:f}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n=~n;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return~n>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({i:e,u:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.i.length,1),n(r)}async function*g(e){let{bytes:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.l=y(n,0),e.o=BigInt(n.length);else{e.o=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.l=y(n,e.l),e.o+=BigInt(n.length),yield n}}}function I(t,r){const o=e(16+(r?8:0));return o.setUint32(0,1347094280),o.setUint32(4,t.isFile?t.l:0,1),r?(o.setBigUint64(8,t.o,1),o.setBigUint64(16,t.o,1)):(o.setUint32(8,i(t.o),1),o.setUint32(12,i(t.o),1)),n(o)}function v(t,r,o=0,f=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|o),w(t.t,a,12),a.setUint32(16,t.isFile?t.l:0,1),a.setUint32(20,i(t.o),1),a.setUint32(24,i(t.o),1),a.setUint16(28,t.i.length,1),a.setUint16(30,f,1),a.setUint16(40,t.mode|(t.isFile?32768:16384),1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const o=e(r);return o.setUint16(0,1,1),o.setUint16(2,r-4,1),16&r&&(o.setBigUint64(4,t.o,1),o.setBigUint64(12,t.o,1)),o.setBigUint64(r-8,i,1),n(o)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified,e.mode]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.i)throw new Error("Every file must have a non-empty name.");if(void 0===r.o)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.i)}".`);const e=r.o>=0xffffffffn,o=t>=0xffffffffn;t+=BigInt(46+r.i.length+(e&&8))+r.o,n+=BigInt(r.i.length+46+(12*o|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(o(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return f(async function*(t,o){const f=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,o.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.i),e.isFile&&(yield*g(e));const t=e.o>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),f.push(v(e,a,n,i)),f.push(e.i),i&&f.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.i.length)+e.o,u||(u=t)}let d=0n;for(const e of f)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)} 5108 ;// external ["wp","blob"] 5109 const external_wp_blob_namespaceObject = window["wp"]["blob"]; 5110 ;// ./node_modules/@wordpress/icons/build-module/library/download.js 5111 5112 5113 var download_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" }) }); 5114 5115 5116 ;// ./node_modules/@wordpress/fields/build-module/actions/export-pattern.js 5117 5118 5119 5120 5121 5122 5123 function getJsonFromItem(item) { 5124 return JSON.stringify( 5125 { 5126 __file: item.type, 5127 title: getItemTitle(item), 5128 content: typeof item.content === "string" ? item.content : item.content?.raw, 5129 syncStatus: item.wp_pattern_sync_status 5130 }, 5131 null, 5132 2 5133 ); 5134 } 5135 const exportPattern = { 5136 id: "export-pattern", 5137 label: (0,external_wp_i18n_namespaceObject.__)("Export as JSON"), 5138 icon: download_default, 5139 supportsBulk: true, 5140 isEligible: (item) => item.type === "wp_block", 5141 callback: async (items) => { 5142 if (items.length === 1) { 5143 return (0,external_wp_blob_namespaceObject.downloadBlob)( 5144 `$paramCase( 5145 getItemTitle(items[0]) || items[0].slug 5146 )}.json`, 5147 getJsonFromItem(items[0]), 5148 "application/json" 5149 ); 5150 } 5151 const nameCount = {}; 5152 const filesToZip = items.map((item) => { 5153 const name = paramCase(getItemTitle(item) || item.slug); 5154 nameCount[name] = (nameCount[name] || 0) + 1; 5155 return { 5156 name: `$name + (nameCount[name] > 1 ? "-" + (nameCount[name] - 1) : "")}.json`, 5157 lastModified: /* @__PURE__ */ new Date(), 5158 input: getJsonFromItem(item) 5159 }; 5160 }); 5161 return (0,external_wp_blob_namespaceObject.downloadBlob)( 5162 (0,external_wp_i18n_namespaceObject.__)("patterns-export") + ".zip", 5163 await A(filesToZip).blob(), 5164 "application/zip" 5165 ); 5166 } 5167 }; 5168 var export_pattern_default = exportPattern; 5169 5170 5171 ;// ./node_modules/@wordpress/icons/build-module/library/backup.js 5172 5173 5174 var backup_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); 5175 5176 5177 ;// ./node_modules/@wordpress/fields/build-module/actions/restore-post.js 5178 5179 5180 5181 5182 5183 const restorePost = { 5184 id: "restore", 5185 label: (0,external_wp_i18n_namespaceObject.__)("Restore"), 5186 isPrimary: true, 5187 icon: backup_default, 5188 supportsBulk: true, 5189 isEligible(item) { 5190 return !isTemplateOrTemplatePart(item) && item.type !== "wp_block" && item.status === "trash" && item.permissions?.update; 5191 }, 5192 async callback(posts, { registry, onActionPerformed }) { 5193 const { createSuccessNotice, createErrorNotice } = registry.dispatch(external_wp_notices_namespaceObject.store); 5194 const { editEntityRecord, saveEditedEntityRecord } = registry.dispatch(external_wp_coreData_namespaceObject.store); 5195 await Promise.allSettled( 5196 posts.map((post) => { 5197 return editEntityRecord("postType", post.type, post.id, { 5198 status: "draft" 5199 }); 5200 }) 5201 ); 5202 const promiseResult = await Promise.allSettled( 5203 posts.map((post) => { 5204 return saveEditedEntityRecord("postType", post.type, post.id, { 5205 throwOnError: true 5206 }); 5207 }) 5208 ); 5209 if (promiseResult.every(({ status }) => status === "fulfilled")) { 5210 let successMessage; 5211 if (posts.length === 1) { 5212 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5213 /* translators: %s: The number of posts. */ 5214 (0,external_wp_i18n_namespaceObject.__)('"%s" has been restored.'), 5215 getItemTitle(posts[0]) 5216 ); 5217 } else if (posts[0].type === "page") { 5218 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5219 /* translators: %d: The number of posts. */ 5220 (0,external_wp_i18n_namespaceObject.__)("%d pages have been restored."), 5221 posts.length 5222 ); 5223 } else { 5224 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5225 /* translators: %d: The number of posts. */ 5226 (0,external_wp_i18n_namespaceObject.__)("%d posts have been restored."), 5227 posts.length 5228 ); 5229 } 5230 createSuccessNotice(successMessage, { 5231 type: "snackbar", 5232 id: "restore-post-action" 5233 }); 5234 if (onActionPerformed) { 5235 onActionPerformed(posts); 5236 } 5237 } else { 5238 let errorMessage; 5239 if (promiseResult.length === 1) { 5240 const typedError = promiseResult[0]; 5241 if (typedError.reason?.message) { 5242 errorMessage = typedError.reason.message; 5243 } else { 5244 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 5245 "An error occurred while restoring the post." 5246 ); 5247 } 5248 } else { 5249 const errorMessages = /* @__PURE__ */ new Set(); 5250 const failedPromises = promiseResult.filter( 5251 ({ status }) => status === "rejected" 5252 ); 5253 for (const failedPromise of failedPromises) { 5254 const typedError = failedPromise; 5255 if (typedError.reason?.message) { 5256 errorMessages.add(typedError.reason.message); 5257 } 5258 } 5259 if (errorMessages.size === 0) { 5260 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 5261 "An error occurred while restoring the posts." 5262 ); 5263 } else if (errorMessages.size === 1) { 5264 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5265 /* translators: %s: an error message */ 5266 (0,external_wp_i18n_namespaceObject.__)("An error occurred while restoring the posts: %s"), 5267 [...errorMessages][0] 5268 ); 5269 } else { 5270 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5271 /* translators: %s: a list of comma separated error messages */ 5272 (0,external_wp_i18n_namespaceObject.__)( 5273 "Some errors occurred while restoring the posts: %s" 5274 ), 5275 [...errorMessages].join(",") 5276 ); 5277 } 5278 } 5279 createErrorNotice(errorMessage, { 5280 type: "snackbar" 5281 }); 5282 } 5283 } 5284 }; 5285 var restore_post_default = restorePost; 5286 5287 5288 ;// ./node_modules/@wordpress/fields/build-module/actions/reset-post.js 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 const reset_post_isTemplateRevertable = (templateOrTemplatePart) => { 5302 if (!templateOrTemplatePart) { 5303 return false; 5304 } 5305 return templateOrTemplatePart.source === "custom" && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file); 5306 }; 5307 const revertTemplate = async (template, { allowUndo = true } = {}) => { 5308 const noticeId = "edit-site-template-reverted"; 5309 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).removeNotice(noticeId); 5310 if (!reset_post_isTemplateRevertable(template)) { 5311 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice( 5312 (0,external_wp_i18n_namespaceObject.__)("This template is not revertable."), 5313 { 5314 type: "snackbar" 5315 } 5316 ); 5317 return; 5318 } 5319 try { 5320 const templateEntityConfig = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEntityConfig( 5321 "postType", 5322 template.type 5323 ); 5324 if (!templateEntityConfig) { 5325 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice( 5326 (0,external_wp_i18n_namespaceObject.__)( 5327 "The editor has encountered an unexpected error. Please reload." 5328 ), 5329 { type: "snackbar" } 5330 ); 5331 return; 5332 } 5333 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)( 5334 `$templateEntityConfig.baseURL}/$template.id}`, 5335 { context: "edit", source: template.origin } 5336 ); 5337 const fileTemplate = await external_wp_apiFetch_default()({ 5338 path: fileTemplatePath 5339 }); 5340 if (!fileTemplate) { 5341 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice( 5342 (0,external_wp_i18n_namespaceObject.__)( 5343 "The editor has encountered an unexpected error. Please reload." 5344 ), 5345 { type: "snackbar" } 5346 ); 5347 return; 5348 } 5349 const serializeBlocks = ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 5350 const edited = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( 5351 "postType", 5352 template.type, 5353 template.id 5354 ); 5355 (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord( 5356 "postType", 5357 template.type, 5358 template.id, 5359 { 5360 content: serializeBlocks, 5361 // Required to make the `undo` behave correctly. 5362 blocks: edited.blocks, 5363 // Required to revert the blocks in the editor. 5364 source: "custom" 5365 // required to avoid turning the editor into a dirty state 5366 }, 5367 { 5368 undoIgnore: true 5369 // Required to merge this edit with the last undo level. 5370 } 5371 ); 5372 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); 5373 (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord( 5374 "postType", 5375 template.type, 5376 fileTemplate.id, 5377 { 5378 content: serializeBlocks, 5379 blocks, 5380 source: "theme" 5381 } 5382 ); 5383 if (allowUndo) { 5384 const undoRevert = () => { 5385 (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store).editEntityRecord( 5386 "postType", 5387 template.type, 5388 edited.id, 5389 { 5390 content: serializeBlocks, 5391 blocks: edited.blocks, 5392 source: "custom" 5393 } 5394 ); 5395 }; 5396 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createSuccessNotice( 5397 (0,external_wp_i18n_namespaceObject.__)("Template reset."), 5398 { 5399 type: "snackbar", 5400 id: noticeId, 5401 actions: [ 5402 { 5403 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 5404 onClick: undoRevert 5405 } 5406 ] 5407 } 5408 ); 5409 } 5410 } catch (error) { 5411 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("Template revert failed. Please reload."); 5412 (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { 5413 type: "snackbar" 5414 }); 5415 } 5416 }; 5417 const resetPostAction = { 5418 id: "reset-post", 5419 label: (0,external_wp_i18n_namespaceObject.__)("Reset"), 5420 isEligible: (item) => { 5421 return item.type === "wp_template_part" && item?.source === "custom" && item?.has_theme_file; 5422 }, 5423 icon: backup_default, 5424 supportsBulk: true, 5425 hideModalHeader: true, 5426 modalFocusOnMount: "firstContentElement", 5427 RenderModal: ({ items, closeModal, onActionPerformed }) => { 5428 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 5429 const { saveEditedEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5430 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5431 const onConfirm = async () => { 5432 try { 5433 for (const template of items) { 5434 await revertTemplate(template, { 5435 allowUndo: false 5436 }); 5437 await saveEditedEntityRecord( 5438 "postType", 5439 template.type, 5440 template.id 5441 ); 5442 } 5443 createSuccessNotice( 5444 items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 5445 /* translators: %d: The number of items. */ 5446 (0,external_wp_i18n_namespaceObject.__)("%d items reset."), 5447 items.length 5448 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 5449 /* translators: %s: The template/part's name. */ 5450 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), 5451 getItemTitle(items[0]) 5452 ), 5453 { 5454 type: "snackbar", 5455 id: "revert-template-action" 5456 } 5457 ); 5458 } catch (error) { 5459 const fallbackErrorMessage = items.length === 1 ? (0,external_wp_i18n_namespaceObject.__)( 5460 "An error occurred while reverting the template part." 5461 ) : (0,external_wp_i18n_namespaceObject.__)( 5462 "An error occurred while reverting the template parts." 5463 ); 5464 const typedError = error; 5465 const errorMessage = typedError.message && typedError.code !== "unknown_error" ? typedError.message : fallbackErrorMessage; 5466 createErrorNotice(errorMessage, { type: "snackbar" }); 5467 } 5468 }; 5469 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 5470 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Reset to default and clear all customizations?") }), 5471 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 5472 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5473 external_wp_components_namespaceObject.Button, 5474 { 5475 __next40pxDefaultSize: true, 5476 variant: "tertiary", 5477 onClick: closeModal, 5478 disabled: isBusy, 5479 accessibleWhenDisabled: true, 5480 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 5481 } 5482 ), 5483 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5484 external_wp_components_namespaceObject.Button, 5485 { 5486 __next40pxDefaultSize: true, 5487 variant: "primary", 5488 onClick: async () => { 5489 setIsBusy(true); 5490 await onConfirm(); 5491 onActionPerformed?.(items); 5492 setIsBusy(false); 5493 closeModal?.(); 5494 }, 5495 isBusy, 5496 disabled: isBusy, 5497 accessibleWhenDisabled: true, 5498 children: (0,external_wp_i18n_namespaceObject.__)("Reset") 5499 } 5500 ) 5501 ] }) 5502 ] }); 5503 } 5504 }; 5505 var reset_post_default = resetPostAction; 5506 5507 5508 ;// ./node_modules/@wordpress/icons/build-module/library/trash.js 5509 5510 5511 var trash_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5512 external_wp_primitives_namespaceObject.Path, 5513 { 5514 fillRule: "evenodd", 5515 clipRule: "evenodd", 5516 d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" 5517 } 5518 ) }); 5519 5520 5521 ;// ./node_modules/@wordpress/fields/build-module/mutation/index.js 5522 5523 5524 5525 function getErrorMessagesFromPromises(allSettledResults) { 5526 const errorMessages = /* @__PURE__ */ new Set(); 5527 if (allSettledResults.length === 1) { 5528 const typedError = allSettledResults[0]; 5529 if (typedError.reason?.message) { 5530 errorMessages.add(typedError.reason.message); 5531 } 5532 } else { 5533 const failedPromises = allSettledResults.filter( 5534 ({ status }) => status === "rejected" 5535 ); 5536 for (const failedPromise of failedPromises) { 5537 const typedError = failedPromise; 5538 if (typedError.reason?.message) { 5539 errorMessages.add(typedError.reason.message); 5540 } 5541 } 5542 } 5543 return errorMessages; 5544 } 5545 const deletePostWithNotices = async (posts, notice, callbacks) => { 5546 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store); 5547 const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store); 5548 const allSettledResults = await Promise.allSettled( 5549 posts.map((post) => { 5550 return deleteEntityRecord( 5551 "postType", 5552 post.type, 5553 post.id, 5554 { force: true }, 5555 { throwOnError: true } 5556 ); 5557 }) 5558 ); 5559 if (allSettledResults.every(({ status }) => status === "fulfilled")) { 5560 let successMessage; 5561 if (allSettledResults.length === 1) { 5562 successMessage = notice.success.messages.getMessage(posts[0]); 5563 } else { 5564 successMessage = notice.success.messages.getBatchMessage(posts); 5565 } 5566 createSuccessNotice(successMessage, { 5567 type: notice.success.type ?? "snackbar", 5568 id: notice.success.id 5569 }); 5570 callbacks.onActionPerformed?.(posts); 5571 } else { 5572 const errorMessages = getErrorMessagesFromPromises(allSettledResults); 5573 let errorMessage = ""; 5574 if (allSettledResults.length === 1) { 5575 errorMessage = notice.error.messages.getMessage(errorMessages); 5576 } else { 5577 errorMessage = notice.error.messages.getBatchMessage(errorMessages); 5578 } 5579 createErrorNotice(errorMessage, { 5580 type: notice.error.type ?? "snackbar", 5581 id: notice.error.id 5582 }); 5583 callbacks.onActionError?.(); 5584 } 5585 }; 5586 const editPostWithNotices = async (postsWithUpdates, notice, callbacks) => { 5587 const { createSuccessNotice, createErrorNotice } = dispatch(noticesStore); 5588 const { editEntityRecord, saveEditedEntityRecord } = dispatch(coreStore); 5589 await Promise.allSettled( 5590 postsWithUpdates.map((post) => { 5591 return editEntityRecord( 5592 "postType", 5593 post.originalPost.type, 5594 post.originalPost.id, 5595 { 5596 ...post.changes 5597 } 5598 ); 5599 }) 5600 ); 5601 const allSettledResults = await Promise.allSettled( 5602 postsWithUpdates.map((post) => { 5603 return saveEditedEntityRecord( 5604 "postType", 5605 post.originalPost.type, 5606 post.originalPost.id, 5607 { 5608 throwOnError: true 5609 } 5610 ); 5611 }) 5612 ); 5613 if (allSettledResults.every(({ status }) => status === "fulfilled")) { 5614 let successMessage; 5615 if (allSettledResults.length === 1) { 5616 successMessage = notice.success.messages.getMessage( 5617 postsWithUpdates[0].originalPost 5618 ); 5619 } else { 5620 successMessage = notice.success.messages.getBatchMessage( 5621 postsWithUpdates.map((post) => post.originalPost) 5622 ); 5623 } 5624 createSuccessNotice(successMessage, { 5625 type: notice.success.type ?? "snackbar", 5626 id: notice.success.id 5627 }); 5628 callbacks.onActionPerformed?.( 5629 postsWithUpdates.map((post) => post.originalPost) 5630 ); 5631 } else { 5632 const errorMessages = getErrorMessagesFromPromises(allSettledResults); 5633 let errorMessage = ""; 5634 if (allSettledResults.length === 1) { 5635 errorMessage = notice.error.messages.getMessage(errorMessages); 5636 } else { 5637 errorMessage = notice.error.messages.getBatchMessage(errorMessages); 5638 } 5639 createErrorNotice(errorMessage, { 5640 type: notice.error.type ?? "snackbar", 5641 id: notice.error.id 5642 }); 5643 callbacks.onActionError?.(); 5644 } 5645 }; 5646 5647 5648 ;// ./node_modules/@wordpress/fields/build-module/actions/delete-post.js 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 const { PATTERN_TYPES: delete_post_PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 5660 const deletePostAction = { 5661 id: "delete-post", 5662 label: (0,external_wp_i18n_namespaceObject.__)("Delete"), 5663 isPrimary: true, 5664 icon: trash_default, 5665 isEligible(post) { 5666 if (isTemplateOrTemplatePart(post)) { 5667 return isTemplateRemovable(post); 5668 } 5669 return post.type === delete_post_PATTERN_TYPES.user; 5670 }, 5671 supportsBulk: true, 5672 hideModalHeader: true, 5673 modalFocusOnMount: "firstContentElement", 5674 RenderModal: ({ items, closeModal, onActionPerformed }) => { 5675 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 5676 const isResetting = items.every( 5677 (item) => isTemplateOrTemplatePart(item) && item?.has_theme_file 5678 ); 5679 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 5680 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 5681 // translators: %d: number of items to delete. 5682 (0,external_wp_i18n_namespaceObject._n)( 5683 "Delete %d item?", 5684 "Delete %d items?", 5685 items.length 5686 ), 5687 items.length 5688 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 5689 // translators: %s: The template or template part's title 5690 (0,external_wp_i18n_namespaceObject._x)('Delete "%s"?', "template part"), 5691 getItemTitle(items[0]) 5692 ) }), 5693 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 5694 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5695 external_wp_components_namespaceObject.Button, 5696 { 5697 variant: "tertiary", 5698 onClick: closeModal, 5699 disabled: isBusy, 5700 accessibleWhenDisabled: true, 5701 __next40pxDefaultSize: true, 5702 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 5703 } 5704 ), 5705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5706 external_wp_components_namespaceObject.Button, 5707 { 5708 variant: "primary", 5709 onClick: async () => { 5710 setIsBusy(true); 5711 const notice = { 5712 success: { 5713 messages: { 5714 getMessage: (item) => { 5715 return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( 5716 /* translators: %s: The template/part's name. */ 5717 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), 5718 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)( 5719 getItemTitle(item) 5720 ) 5721 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 5722 /* translators: %s: The template/part's name. */ 5723 (0,external_wp_i18n_namespaceObject._x)( 5724 '"%s" deleted.', 5725 "template part" 5726 ), 5727 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)( 5728 getItemTitle(item) 5729 ) 5730 ); 5731 }, 5732 getBatchMessage: () => { 5733 return isResetting ? (0,external_wp_i18n_namespaceObject.__)("Items reset.") : (0,external_wp_i18n_namespaceObject.__)("Items deleted."); 5734 } 5735 } 5736 }, 5737 error: { 5738 messages: { 5739 getMessage: (error) => { 5740 if (error.size === 1) { 5741 return [...error][0]; 5742 } 5743 return isResetting ? (0,external_wp_i18n_namespaceObject.__)( 5744 "An error occurred while reverting the item." 5745 ) : (0,external_wp_i18n_namespaceObject.__)( 5746 "An error occurred while deleting the item." 5747 ); 5748 }, 5749 getBatchMessage: (errors) => { 5750 if (errors.size === 0) { 5751 return isResetting ? (0,external_wp_i18n_namespaceObject.__)( 5752 "An error occurred while reverting the items." 5753 ) : (0,external_wp_i18n_namespaceObject.__)( 5754 "An error occurred while deleting the items." 5755 ); 5756 } 5757 if (errors.size === 1) { 5758 return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( 5759 /* translators: %s: an error message */ 5760 (0,external_wp_i18n_namespaceObject.__)( 5761 "An error occurred while reverting the items: %s" 5762 ), 5763 [...errors][0] 5764 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 5765 /* translators: %s: an error message */ 5766 (0,external_wp_i18n_namespaceObject.__)( 5767 "An error occurred while deleting the items: %s" 5768 ), 5769 [...errors][0] 5770 ); 5771 } 5772 return isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( 5773 /* translators: %s: a list of comma separated error messages */ 5774 (0,external_wp_i18n_namespaceObject.__)( 5775 "Some errors occurred while reverting the items: %s" 5776 ), 5777 [...errors].join( 5778 "," 5779 ) 5780 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 5781 /* translators: %s: a list of comma separated error messages */ 5782 (0,external_wp_i18n_namespaceObject.__)( 5783 "Some errors occurred while deleting the items: %s" 5784 ), 5785 [...errors].join( 5786 "," 5787 ) 5788 ); 5789 } 5790 } 5791 } 5792 }; 5793 await deletePostWithNotices(items, notice, { 5794 onActionPerformed 5795 }); 5796 setIsBusy(false); 5797 closeModal?.(); 5798 }, 5799 isBusy, 5800 disabled: isBusy, 5801 accessibleWhenDisabled: true, 5802 __next40pxDefaultSize: true, 5803 children: (0,external_wp_i18n_namespaceObject.__)("Delete") 5804 } 5805 ) 5806 ] }) 5807 ] }); 5808 } 5809 }; 5810 var delete_post_default = deletePostAction; 5811 5812 5813 ;// ./node_modules/@wordpress/fields/build-module/actions/trash-post.js 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 const trash_post_trashPost = { 5824 id: "move-to-trash", 5825 label: (0,external_wp_i18n_namespaceObject.__)("Trash"), 5826 isPrimary: true, 5827 icon: trash_default, 5828 isEligible(item) { 5829 if (item.type === "wp_template_part" || item.type === "wp_block") { 5830 return false; 5831 } 5832 if (item.type === "wp_template" && typeof item.id === "string") { 5833 return false; 5834 } 5835 return !!item.status && !["auto-draft", "trash"].includes(item.status) && item.permissions?.delete; 5836 }, 5837 supportsBulk: true, 5838 hideModalHeader: true, 5839 modalFocusOnMount: "firstContentElement", 5840 RenderModal: ({ items, closeModal, onActionPerformed }) => { 5841 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 5842 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 5843 const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 5844 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 5845 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length === 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 5846 // translators: %s: The item's title. 5847 (0,external_wp_i18n_namespaceObject.__)( 5848 'Are you sure you want to move "%s" to the trash?' 5849 ), 5850 getItemTitle(items[0]) 5851 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 5852 // translators: %d: The number of items (2 or more). 5853 (0,external_wp_i18n_namespaceObject._n)( 5854 "Are you sure you want to move %d item to the trash ?", 5855 "Are you sure you want to move %d items to the trash ?", 5856 items.length 5857 ), 5858 items.length 5859 ) }), 5860 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 5861 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5862 external_wp_components_namespaceObject.Button, 5863 { 5864 __next40pxDefaultSize: true, 5865 variant: "tertiary", 5866 onClick: closeModal, 5867 disabled: isBusy, 5868 accessibleWhenDisabled: true, 5869 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 5870 } 5871 ), 5872 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 5873 external_wp_components_namespaceObject.Button, 5874 { 5875 __next40pxDefaultSize: true, 5876 variant: "primary", 5877 onClick: async () => { 5878 setIsBusy(true); 5879 const promiseResult = await Promise.allSettled( 5880 items.map( 5881 (item) => deleteEntityRecord( 5882 "postType", 5883 item.type, 5884 item.id.toString(), 5885 {}, 5886 { throwOnError: true } 5887 ) 5888 ) 5889 ); 5890 if (promiseResult.every( 5891 ({ status }) => status === "fulfilled" 5892 )) { 5893 let successMessage; 5894 if (promiseResult.length === 1) { 5895 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5896 /* translators: %s: The item's title. */ 5897 (0,external_wp_i18n_namespaceObject.__)('"%s" moved to the trash.'), 5898 getItemTitle(items[0]) 5899 ); 5900 } else { 5901 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5902 /* translators: %d: The number of items. */ 5903 (0,external_wp_i18n_namespaceObject._n)( 5904 "%d item moved to the trash.", 5905 "%d items moved to the trash.", 5906 items.length 5907 ), 5908 items.length 5909 ); 5910 } 5911 createSuccessNotice(successMessage, { 5912 type: "snackbar", 5913 id: "move-to-trash-action" 5914 }); 5915 } else { 5916 let errorMessage; 5917 if (promiseResult.length === 1) { 5918 const typedError = promiseResult[0]; 5919 if (typedError.reason?.message) { 5920 errorMessage = typedError.reason.message; 5921 } else { 5922 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 5923 "An error occurred while moving the item to the trash." 5924 ); 5925 } 5926 } else { 5927 const errorMessages = /* @__PURE__ */ new Set(); 5928 const failedPromises = promiseResult.filter( 5929 ({ status }) => status === "rejected" 5930 ); 5931 for (const failedPromise of failedPromises) { 5932 const typedError = failedPromise; 5933 if (typedError.reason?.message) { 5934 errorMessages.add( 5935 typedError.reason.message 5936 ); 5937 } 5938 } 5939 if (errorMessages.size === 0) { 5940 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 5941 "An error occurred while moving the items to the trash." 5942 ); 5943 } else if (errorMessages.size === 1) { 5944 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5945 /* translators: %s: an error message */ 5946 (0,external_wp_i18n_namespaceObject.__)( 5947 "An error occurred while moving the item to the trash: %s" 5948 ), 5949 [...errorMessages][0] 5950 ); 5951 } else { 5952 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 5953 /* translators: %s: a list of comma separated error messages */ 5954 (0,external_wp_i18n_namespaceObject.__)( 5955 "Some errors occurred while moving the items to the trash: %s" 5956 ), 5957 [...errorMessages].join(",") 5958 ); 5959 } 5960 } 5961 createErrorNotice(errorMessage, { 5962 type: "snackbar" 5963 }); 5964 } 5965 if (onActionPerformed) { 5966 onActionPerformed(items); 5967 } 5968 setIsBusy(false); 5969 closeModal?.(); 5970 }, 5971 isBusy, 5972 disabled: isBusy, 5973 accessibleWhenDisabled: true, 5974 children: (0,external_wp_i18n_namespaceObject._x)("Trash", "verb") 5975 } 5976 ) 5977 ] }) 5978 ] }); 5979 } 5980 }; 5981 var trash_post_default = trash_post_trashPost; 5982 5983 5984 ;// ./node_modules/@wordpress/fields/build-module/actions/permanently-delete-post.js 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 const permanentlyDeletePost = { 5996 id: "permanently-delete", 5997 label: (0,external_wp_i18n_namespaceObject.__)("Permanently delete"), 5998 supportsBulk: true, 5999 icon: trash_default, 6000 isEligible(item) { 6001 if (isTemplateOrTemplatePart(item) || item.type === "wp_block") { 6002 return false; 6003 } 6004 const { status, permissions } = item; 6005 return status === "trash" && permissions?.delete; 6006 }, 6007 hideModalHeader: true, 6008 modalFocusOnMount: "firstContentElement", 6009 RenderModal: ({ items, closeModal, onActionPerformed }) => { 6010 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 6011 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6012 const { deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 6013 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 6014 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: items.length > 1 ? (0,external_wp_i18n_namespaceObject.sprintf)( 6015 // translators: %d: number of items to delete. 6016 (0,external_wp_i18n_namespaceObject._n)( 6017 "Are you sure you want to permanently delete %d item?", 6018 "Are you sure you want to permanently delete %d items?", 6019 items.length 6020 ), 6021 items.length 6022 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 6023 // translators: %s: The post's title 6024 (0,external_wp_i18n_namespaceObject.__)( 6025 'Are you sure you want to permanently delete "%s"?' 6026 ), 6027 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getItemTitle(items[0])) 6028 ) }), 6029 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 6030 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6031 external_wp_components_namespaceObject.Button, 6032 { 6033 variant: "tertiary", 6034 onClick: closeModal, 6035 disabled: isBusy, 6036 accessibleWhenDisabled: true, 6037 __next40pxDefaultSize: true, 6038 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 6039 } 6040 ), 6041 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6042 external_wp_components_namespaceObject.Button, 6043 { 6044 variant: "primary", 6045 onClick: async () => { 6046 setIsBusy(true); 6047 const promiseResult = await Promise.allSettled( 6048 items.map( 6049 (post) => deleteEntityRecord( 6050 "postType", 6051 post.type, 6052 post.id, 6053 { force: true }, 6054 { throwOnError: true } 6055 ) 6056 ) 6057 ); 6058 if (promiseResult.every( 6059 ({ status }) => status === "fulfilled" 6060 )) { 6061 let successMessage; 6062 if (promiseResult.length === 1) { 6063 successMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 6064 /* translators: %s: The posts's title. */ 6065 (0,external_wp_i18n_namespaceObject.__)('"%s" permanently deleted.'), 6066 getItemTitle(items[0]) 6067 ); 6068 } else { 6069 successMessage = (0,external_wp_i18n_namespaceObject.__)( 6070 "The items were permanently deleted." 6071 ); 6072 } 6073 createSuccessNotice(successMessage, { 6074 type: "snackbar", 6075 id: "permanently-delete-post-action" 6076 }); 6077 onActionPerformed?.(items); 6078 } else { 6079 let errorMessage; 6080 if (promiseResult.length === 1) { 6081 const typedError = promiseResult[0]; 6082 if (typedError.reason?.message) { 6083 errorMessage = typedError.reason.message; 6084 } else { 6085 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 6086 "An error occurred while permanently deleting the item." 6087 ); 6088 } 6089 } else { 6090 const errorMessages = /* @__PURE__ */ new Set(); 6091 const failedPromises = promiseResult.filter( 6092 ({ status }) => status === "rejected" 6093 ); 6094 for (const failedPromise of failedPromises) { 6095 const typedError = failedPromise; 6096 if (typedError.reason?.message) { 6097 errorMessages.add( 6098 typedError.reason.message 6099 ); 6100 } 6101 } 6102 if (errorMessages.size === 0) { 6103 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 6104 "An error occurred while permanently deleting the items." 6105 ); 6106 } else if (errorMessages.size === 1) { 6107 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 6108 /* translators: %s: an error message */ 6109 (0,external_wp_i18n_namespaceObject.__)( 6110 "An error occurred while permanently deleting the items: %s" 6111 ), 6112 [...errorMessages][0] 6113 ); 6114 } else { 6115 errorMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 6116 /* translators: %s: a list of comma separated error messages */ 6117 (0,external_wp_i18n_namespaceObject.__)( 6118 "Some errors occurred while permanently deleting the items: %s" 6119 ), 6120 [...errorMessages].join(",") 6121 ); 6122 } 6123 } 6124 createErrorNotice(errorMessage, { 6125 type: "snackbar" 6126 }); 6127 } 6128 setIsBusy(false); 6129 closeModal?.(); 6130 }, 6131 isBusy, 6132 disabled: isBusy, 6133 accessibleWhenDisabled: true, 6134 __next40pxDefaultSize: true, 6135 children: (0,external_wp_i18n_namespaceObject.__)("Delete permanently") 6136 } 6137 ) 6138 ] }) 6139 ] }); 6140 } 6141 }; 6142 var permanently_delete_post_default = permanentlyDeletePost; 6143 6144 6145 ;// external ["wp","mediaUtils"] 6146 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 6147 ;// ./node_modules/@wordpress/icons/build-module/library/line-solid.js 6148 6149 6150 var line_solid_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M5 11.25h14v1.5H5z" }) }); 6151 6152 6153 ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-edit.js 6154 6155 6156 6157 6158 6159 6160 6161 6162 const FeaturedImageEdit = ({ 6163 data, 6164 field, 6165 onChange 6166 }) => { 6167 const { id } = field; 6168 const value = field.getValue({ item: data }); 6169 const media = (0,external_wp_data_namespaceObject.useSelect)( 6170 (select) => { 6171 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 6172 return getEntityRecord("postType", "attachment", value); 6173 }, 6174 [value] 6175 ); 6176 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( 6177 (newValue) => onChange({ 6178 [id]: newValue 6179 }), 6180 [id, onChange] 6181 ); 6182 const url = media?.source_url; 6183 const title = media?.title?.rendered; 6184 const ref = (0,external_wp_element_namespaceObject.useRef)(null); 6185 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "fields-controls__featured-image", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__featured-image-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6186 external_wp_mediaUtils_namespaceObject.MediaUpload, 6187 { 6188 onSelect: (selectedMedia) => { 6189 onChangeControl(selectedMedia.id); 6190 }, 6191 allowedTypes: ["image"], 6192 render: ({ open }) => { 6193 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6194 "div", 6195 { 6196 ref, 6197 role: "button", 6198 tabIndex: -1, 6199 onClick: () => { 6200 open(); 6201 }, 6202 onKeyDown: open, 6203 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 6204 external_wp_components_namespaceObject.__experimentalGrid, 6205 { 6206 rowGap: 0, 6207 columnGap: 8, 6208 templateColumns: "24px 1fr 24px", 6209 children: [ 6210 url && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 6211 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6212 "img", 6213 { 6214 className: "fields-controls__featured-image-image", 6215 alt: "", 6216 width: 24, 6217 height: 24, 6218 src: url 6219 } 6220 ), 6221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-title", children: title }) 6222 ] }), 6223 !url && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 6224 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6225 "span", 6226 { 6227 className: "fields-controls__featured-image-placeholder", 6228 style: { 6229 width: "24px", 6230 height: "24px" 6231 } 6232 } 6233 ), 6234 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-title", children: (0,external_wp_i18n_namespaceObject.__)("Choose an image\u2026") }) 6235 ] }), 6236 url && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6237 external_wp_components_namespaceObject.Button, 6238 { 6239 size: "small", 6240 className: "fields-controls__featured-image-remove-button", 6241 icon: line_solid_default, 6242 onClick: (event) => { 6243 event.stopPropagation(); 6244 onChangeControl(0); 6245 } 6246 } 6247 ) }) 6248 ] 6249 } 6250 ) 6251 } 6252 ); 6253 } 6254 } 6255 ) }) }); 6256 }; 6257 6258 6259 ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/featured-image-view.js 6260 6261 const FeaturedImageView = ({ 6262 item, 6263 config 6264 }) => { 6265 const media = item?._embedded?.["wp:featuredmedia"]?.[0]; 6266 const url = media?.source_url; 6267 if (url) { 6268 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6269 "img", 6270 { 6271 className: "fields-controls__featured-image-image", 6272 src: url, 6273 alt: "", 6274 srcSet: media?.media_details?.sizes ? Object.values(media.media_details.sizes).map( 6275 (size) => `$size.source_url} $size.width}w` 6276 ).join(", ") : void 0, 6277 sizes: config?.sizes || "100vw" 6278 } 6279 ); 6280 } 6281 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__featured-image-placeholder" }); 6282 }; 6283 6284 6285 ;// ./node_modules/@wordpress/fields/build-module/fields/featured-image/index.js 6286 6287 6288 6289 const featuredImageField = { 6290 id: "featured_media", 6291 type: "media", 6292 label: (0,external_wp_i18n_namespaceObject.__)("Featured Image"), 6293 Edit: FeaturedImageEdit, 6294 render: FeaturedImageView, 6295 enableSorting: false, 6296 filterBy: false 6297 }; 6298 var featured_image_default = featuredImageField; 6299 6300 6301 ;// ./node_modules/clsx/dist/clsx.mjs 6302 function clsx_r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=clsx_r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=clsx_r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 6303 ;// ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js 6304 6305 6306 var comment_author_avatar_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6307 external_wp_primitives_namespaceObject.Path, 6308 { 6309 fillRule: "evenodd", 6310 d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z", 6311 clipRule: "evenodd" 6312 } 6313 ) }); 6314 6315 6316 ;// ./node_modules/@wordpress/fields/build-module/fields/author/author-view.js 6317 6318 6319 6320 6321 6322 6323 function AuthorView({ item }) { 6324 const text = item?._embedded?.author?.[0]?.name; 6325 const imageUrl = item?._embedded?.author?.[0]?.avatar_urls?.[48]; 6326 const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false); 6327 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 6328 !!imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6329 "div", 6330 { 6331 className: dist_clsx("page-templates-author-field__avatar", { 6332 "is-loaded": isImageLoaded 6333 }), 6334 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6335 "img", 6336 { 6337 onLoad: () => setIsImageLoaded(true), 6338 alt: (0,external_wp_i18n_namespaceObject.__)("Author avatar"), 6339 src: imageUrl 6340 } 6341 ) 6342 } 6343 ), 6344 !imageUrl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: comment_author_avatar_default }) }), 6345 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "page-templates-author-field__name", children: text }) 6346 ] }); 6347 } 6348 var author_view_default = AuthorView; 6349 6350 6351 ;// ./node_modules/@wordpress/fields/build-module/fields/author/index.js 6352 6353 6354 6355 6356 const authorField = { 6357 label: (0,external_wp_i18n_namespaceObject.__)("Author"), 6358 id: "author", 6359 type: "integer", 6360 getElements: async () => { 6361 const authors = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getEntityRecords( 6362 "root", 6363 "user", 6364 { 6365 per_page: -1 6366 } 6367 ) ?? []; 6368 return authors.map(({ id, name }) => ({ 6369 value: id, 6370 label: name 6371 })); 6372 }, 6373 render: author_view_default, 6374 sort: (a, b, direction) => { 6375 const nameA = a._embedded?.author?.[0]?.name || ""; 6376 const nameB = b._embedded?.author?.[0]?.name || ""; 6377 return direction === "asc" ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA); 6378 }, 6379 filterBy: { 6380 operators: ["isAny", "isNone"] 6381 } 6382 }; 6383 var author_default = authorField; 6384 6385 6386 ;// ./node_modules/@wordpress/icons/build-module/library/drafts.js 6387 6388 6389 var drafts_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6390 external_wp_primitives_namespaceObject.Path, 6391 { 6392 fillRule: "evenodd", 6393 clipRule: "evenodd", 6394 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z" 6395 } 6396 ) }); 6397 6398 6399 ;// ./node_modules/@wordpress/icons/build-module/library/scheduled.js 6400 6401 6402 var scheduled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6403 external_wp_primitives_namespaceObject.Path, 6404 { 6405 fillRule: "evenodd", 6406 clipRule: "evenodd", 6407 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" 6408 } 6409 ) }); 6410 6411 6412 ;// ./node_modules/@wordpress/icons/build-module/library/pending.js 6413 6414 6415 var pending_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6416 external_wp_primitives_namespaceObject.Path, 6417 { 6418 fillRule: "evenodd", 6419 clipRule: "evenodd", 6420 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z" 6421 } 6422 ) }); 6423 6424 6425 ;// ./node_modules/@wordpress/icons/build-module/library/not-allowed.js 6426 6427 6428 var not_allowed_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6429 external_wp_primitives_namespaceObject.Path, 6430 { 6431 fillRule: "evenodd", 6432 clipRule: "evenodd", 6433 d: "M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z" 6434 } 6435 ) }); 6436 6437 6438 ;// ./node_modules/@wordpress/icons/build-module/library/published.js 6439 6440 6441 var published_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6442 external_wp_primitives_namespaceObject.Path, 6443 { 6444 fillRule: "evenodd", 6445 clipRule: "evenodd", 6446 d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" 6447 } 6448 ) }); 6449 6450 6451 ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-elements.js 6452 6453 6454 const STATUSES = [ 6455 { 6456 value: "draft", 6457 label: (0,external_wp_i18n_namespaceObject.__)("Draft"), 6458 icon: drafts_default, 6459 description: (0,external_wp_i18n_namespaceObject.__)("Not ready to publish.") 6460 }, 6461 { 6462 value: "future", 6463 label: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), 6464 icon: scheduled_default, 6465 description: (0,external_wp_i18n_namespaceObject.__)("Publish automatically on a chosen date.") 6466 }, 6467 { 6468 value: "pending", 6469 label: (0,external_wp_i18n_namespaceObject.__)("Pending Review"), 6470 icon: pending_default, 6471 description: (0,external_wp_i18n_namespaceObject.__)("Waiting for review before publishing.") 6472 }, 6473 { 6474 value: "private", 6475 label: (0,external_wp_i18n_namespaceObject.__)("Private"), 6476 icon: not_allowed_default, 6477 description: (0,external_wp_i18n_namespaceObject.__)("Only visible to site admins and editors.") 6478 }, 6479 { 6480 value: "publish", 6481 label: (0,external_wp_i18n_namespaceObject.__)("Published"), 6482 icon: published_default, 6483 description: (0,external_wp_i18n_namespaceObject.__)("Visible to everyone.") 6484 }, 6485 { value: "trash", label: (0,external_wp_i18n_namespaceObject.__)("Trash"), icon: trash_default } 6486 ]; 6487 var status_elements_default = STATUSES; 6488 6489 6490 ;// ./node_modules/@wordpress/fields/build-module/fields/status/status-view.js 6491 6492 6493 6494 function StatusView({ item }) { 6495 const status = status_elements_default.find(({ value }) => value === item.status); 6496 const label = status?.label || item.status; 6497 const icon = status?.icon; 6498 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 6499 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "edit-site-post-list__status-icon", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon }) }), 6500 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: label }) 6501 ] }); 6502 } 6503 var status_view_default = StatusView; 6504 6505 6506 ;// ./node_modules/@wordpress/fields/build-module/fields/status/index.js 6507 6508 6509 6510 const OPERATOR_IS_ANY = "isAny"; 6511 const statusField = { 6512 label: (0,external_wp_i18n_namespaceObject.__)("Status"), 6513 id: "status", 6514 type: "text", 6515 elements: status_elements_default, 6516 render: status_view_default, 6517 Edit: "radio", 6518 enableSorting: false, 6519 filterBy: { 6520 operators: [OPERATOR_IS_ANY] 6521 } 6522 }; 6523 var status_default = statusField; 6524 6525 6526 ;// ./node_modules/@wordpress/fields/build-module/fields/date/date-view.js 6527 6528 6529 6530 6531 const getFormattedDate = (dateToDisplay) => (0,external_wp_date_namespaceObject.dateI18n)( 6532 (0,external_wp_date_namespaceObject.getSettings)().formats.datetimeAbbreviated, 6533 (0,external_wp_date_namespaceObject.getDate)(dateToDisplay) 6534 ); 6535 const DateView = ({ item }) => { 6536 const isDraftOrPrivate = ["draft", "private"].includes( 6537 item.status ?? "" 6538 ); 6539 if (isDraftOrPrivate) { 6540 return (0,external_wp_element_namespaceObject.createInterpolateElement)( 6541 (0,external_wp_i18n_namespaceObject.sprintf)( 6542 /* translators: %s: page creation or modification date. */ 6543 (0,external_wp_i18n_namespaceObject.__)("<span>Modified: <time>%s</time></span>"), 6544 getFormattedDate(item.date ?? null) 6545 ), 6546 { 6547 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 6548 time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 6549 } 6550 ); 6551 } 6552 const isScheduled = item.status === "future"; 6553 if (isScheduled) { 6554 return (0,external_wp_element_namespaceObject.createInterpolateElement)( 6555 (0,external_wp_i18n_namespaceObject.sprintf)( 6556 /* translators: %s: page creation date */ 6557 (0,external_wp_i18n_namespaceObject.__)("<span>Scheduled: <time>%s</time></span>"), 6558 getFormattedDate(item.date ?? null) 6559 ), 6560 { 6561 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 6562 time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 6563 } 6564 ); 6565 } 6566 const isPublished = item.status === "publish"; 6567 if (isPublished) { 6568 return (0,external_wp_element_namespaceObject.createInterpolateElement)( 6569 (0,external_wp_i18n_namespaceObject.sprintf)( 6570 /* translators: %s: page creation time */ 6571 (0,external_wp_i18n_namespaceObject.__)("<span>Published: <time>%s</time></span>"), 6572 getFormattedDate(item.date ?? null) 6573 ), 6574 { 6575 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 6576 time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 6577 } 6578 ); 6579 } 6580 const dateToDisplay = (0,external_wp_date_namespaceObject.getDate)(item.modified ?? null) > (0,external_wp_date_namespaceObject.getDate)(item.date ?? null) ? item.modified : item.date; 6581 const isPending = item.status === "pending"; 6582 if (isPending) { 6583 return (0,external_wp_element_namespaceObject.createInterpolateElement)( 6584 (0,external_wp_i18n_namespaceObject.sprintf)( 6585 /* translators: %s: page creation or modification date. */ 6586 (0,external_wp_i18n_namespaceObject.__)("<span>Modified: <time>%s</time></span>"), 6587 getFormattedDate(dateToDisplay ?? null) 6588 ), 6589 { 6590 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}), 6591 time: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", {}) 6592 } 6593 ); 6594 } 6595 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("time", { children: getFormattedDate(item.date ?? null) }); 6596 }; 6597 var date_view_default = DateView; 6598 6599 6600 ;// ./node_modules/@wordpress/fields/build-module/fields/date/index.js 6601 6602 6603 const dateField = { 6604 id: "date", 6605 type: "datetime", 6606 label: (0,external_wp_i18n_namespaceObject.__)("Date"), 6607 render: date_view_default, 6608 filterBy: false 6609 }; 6610 var date_default = dateField; 6611 6612 6613 ;// ./node_modules/@wordpress/icons/build-module/library/copy-small.js 6614 6615 6616 var copy_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6617 external_wp_primitives_namespaceObject.Path, 6618 { 6619 fillRule: "evenodd", 6620 clipRule: "evenodd", 6621 d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z" 6622 } 6623 ) }); 6624 6625 6626 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/utils.js 6627 6628 6629 const getSlug = (item) => { 6630 if (typeof item !== "object") { 6631 return ""; 6632 } 6633 return item.slug || (0,external_wp_url_namespaceObject.cleanForSlug)(getItemTitle(item)) || item.id.toString(); 6634 }; 6635 6636 6637 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-edit.js 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 const SlugEdit = ({ 6649 field, 6650 onChange, 6651 data 6652 }) => { 6653 const { id } = field; 6654 const slug = field.getValue({ item: data }) || getSlug(data); 6655 const permalinkTemplate = data.permalink_template || ""; 6656 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; 6657 const [prefix, suffix] = permalinkTemplate.split( 6658 PERMALINK_POSTNAME_REGEX 6659 ); 6660 const permalinkPrefix = prefix; 6661 const permalinkSuffix = suffix; 6662 const isEditable = PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); 6663 const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); 6664 const slugToDisplay = slug || originalSlugRef.current; 6665 const permalink = isEditable ? `$permalinkPrefix}$slugToDisplay}$permalinkSuffix}` : (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(data.link || ""); 6666 (0,external_wp_element_namespaceObject.useEffect)(() => { 6667 if (slug && originalSlugRef.current === void 0) { 6668 originalSlugRef.current = slug; 6669 } 6670 }, [slug]); 6671 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( 6672 (newValue) => onChange({ 6673 [id]: newValue 6674 }), 6675 [id, onChange] 6676 ); 6677 const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6678 const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { 6679 createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Copied Permalink to clipboard."), { 6680 isDismissible: true, 6681 type: "snackbar" 6682 }); 6683 }); 6684 const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0,external_wp_compose_namespaceObject.useInstanceId)(SlugEdit); 6685 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-controls__slug", children: [ 6686 isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 6687 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "0px", children: [ 6688 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: (0,external_wp_i18n_namespaceObject.__)( 6689 "Customize the last part of the Permalink." 6690 ) }), 6691 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", children: (0,external_wp_i18n_namespaceObject.__)("Learn more") }) 6692 ] }), 6693 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6694 external_wp_components_namespaceObject.__experimentalInputControl, 6695 { 6696 __next40pxDefaultSize: true, 6697 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { children: "/" }), 6698 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6699 external_wp_components_namespaceObject.Button, 6700 { 6701 __next40pxDefaultSize: true, 6702 icon: copy_small_default, 6703 ref: copyButtonRef, 6704 label: (0,external_wp_i18n_namespaceObject.__)("Copy") 6705 } 6706 ), 6707 label: (0,external_wp_i18n_namespaceObject.__)("Link"), 6708 hideLabelFromVision: true, 6709 value: slug, 6710 autoComplete: "off", 6711 spellCheck: "false", 6712 type: "text", 6713 className: "fields-controls__slug-input", 6714 onChange: (newValue) => { 6715 onChangeControl(newValue); 6716 }, 6717 onBlur: () => { 6718 if (slug === "") { 6719 onChangeControl(originalSlugRef.current); 6720 } 6721 }, 6722 "aria-describedby": postUrlSlugDescriptionId 6723 } 6724 ), 6725 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "fields-controls__slug-help", children: [ 6726 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-visual-label", children: (0,external_wp_i18n_namespaceObject.__)("Permalink:") }), 6727 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 6728 external_wp_components_namespaceObject.ExternalLink, 6729 { 6730 className: "fields-controls__slug-help-link", 6731 href: permalink, 6732 children: [ 6733 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }), 6734 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }), 6735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix }) 6736 ] 6737 } 6738 ) 6739 ] }) 6740 ] }), 6741 !isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6742 external_wp_components_namespaceObject.ExternalLink, 6743 { 6744 className: "fields-controls__slug-help", 6745 href: permalink, 6746 children: permalink 6747 } 6748 ) 6749 ] }); 6750 }; 6751 var slug_edit_default = SlugEdit; 6752 6753 6754 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/slug-view.js 6755 6756 6757 const SlugView = ({ item }) => { 6758 const slug = getSlug(item); 6759 const originalSlugRef = (0,external_wp_element_namespaceObject.useRef)(slug); 6760 (0,external_wp_element_namespaceObject.useEffect)(() => { 6761 if (slug && originalSlugRef.current === void 0) { 6762 originalSlugRef.current = slug; 6763 } 6764 }, [slug]); 6765 const slugToDisplay = slug || originalSlugRef.current; 6766 return `$slugToDisplay}`; 6767 }; 6768 var slug_view_default = SlugView; 6769 6770 6771 ;// ./node_modules/@wordpress/fields/build-module/fields/slug/index.js 6772 6773 6774 6775 const slugField = { 6776 id: "slug", 6777 type: "text", 6778 label: (0,external_wp_i18n_namespaceObject.__)("Slug"), 6779 Edit: slug_edit_default, 6780 render: slug_view_default, 6781 filterBy: false 6782 }; 6783 var slug_default = slugField; 6784 6785 6786 // EXTERNAL MODULE: ./node_modules/remove-accents/index.js 6787 var remove_accents = __webpack_require__(9681); 6788 var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents); 6789 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/utils.js 6790 6791 6792 function getTitleWithFallbackName(post) { 6793 return typeof post.title === "object" && "rendered" in post.title && post.title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#$post?.id} (${(0,external_wp_i18n_namespaceObject.__)("no title")})`; 6794 } 6795 6796 6797 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-edit.js 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 function buildTermsTree(flatTerms) { 6810 const flatTermsWithParentAndChildren = flatTerms.map((term) => { 6811 return { 6812 children: [], 6813 ...term 6814 }; 6815 }); 6816 if (flatTermsWithParentAndChildren.some( 6817 ({ parent }) => parent === null || parent === void 0 6818 )) { 6819 return flatTermsWithParentAndChildren; 6820 } 6821 const termsByParent = flatTermsWithParentAndChildren.reduce( 6822 (acc, term) => { 6823 const { parent } = term; 6824 if (!acc[parent]) { 6825 acc[parent] = []; 6826 } 6827 acc[parent].push(term); 6828 return acc; 6829 }, 6830 {} 6831 ); 6832 const fillWithChildren = (terms) => { 6833 return terms.map((term) => { 6834 const children = termsByParent[term.id]; 6835 return { 6836 ...term, 6837 children: children && children.length ? fillWithChildren(children) : [] 6838 }; 6839 }); 6840 }; 6841 return fillWithChildren(termsByParent["0"] || []); 6842 } 6843 const getItemPriority = (name, searchValue) => { 6844 const normalizedName = remove_accents_default()(name || "").toLowerCase(); 6845 const normalizedSearch = remove_accents_default()(searchValue || "").toLowerCase(); 6846 if (normalizedName === normalizedSearch) { 6847 return 0; 6848 } 6849 if (normalizedName.startsWith(normalizedSearch)) { 6850 return normalizedName.length; 6851 } 6852 return Infinity; 6853 }; 6854 function PageAttributesParent({ 6855 data, 6856 onChangeControl 6857 }) { 6858 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(null); 6859 const pageId = data.parent; 6860 const postId = data.id; 6861 const postTypeSlug = data.type; 6862 const { parentPostTitle, pageItems, isHierarchical } = (0,external_wp_data_namespaceObject.useSelect)( 6863 (select) => { 6864 const { getEntityRecord, getEntityRecords, getPostType } = select(external_wp_coreData_namespaceObject.store); 6865 const postTypeInfo = getPostType(postTypeSlug); 6866 const postIsHierarchical = postTypeInfo?.hierarchical && postTypeInfo.viewable; 6867 const parentPost = pageId ? getEntityRecord( 6868 "postType", 6869 postTypeSlug, 6870 pageId 6871 ) : null; 6872 const query = { 6873 per_page: 100, 6874 exclude: postId, 6875 parent_exclude: postId, 6876 orderby: "menu_order", 6877 order: "asc", 6878 _fields: "id,title,parent", 6879 ...fieldValue !== null && { 6880 search: fieldValue 6881 } 6882 }; 6883 return { 6884 isHierarchical: postIsHierarchical, 6885 parentPostTitle: parentPost ? getTitleWithFallbackName(parentPost) : "", 6886 pageItems: postIsHierarchical ? getEntityRecords( 6887 "postType", 6888 postTypeSlug, 6889 query 6890 ) : null 6891 }; 6892 }, 6893 [fieldValue, pageId, postId, postTypeSlug] 6894 ); 6895 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 6896 const getOptionsFromTree = (tree2, level = 0) => { 6897 const mappedNodes = tree2.map((treeNode) => [ 6898 { 6899 value: treeNode.id, 6900 label: "\u2014 ".repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), 6901 rawName: treeNode.name 6902 }, 6903 ...getOptionsFromTree(treeNode.children || [], level + 1) 6904 ]); 6905 const sortedNodes = mappedNodes.sort(([a], [b]) => { 6906 const priorityA = getItemPriority( 6907 a.rawName, 6908 fieldValue ?? "" 6909 ); 6910 const priorityB = getItemPriority( 6911 b.rawName, 6912 fieldValue ?? "" 6913 ); 6914 return priorityA >= priorityB ? 1 : -1; 6915 }); 6916 return sortedNodes.flat(); 6917 }; 6918 if (!pageItems) { 6919 return []; 6920 } 6921 let tree = pageItems.map((item) => ({ 6922 id: item.id, 6923 parent: item.parent ?? null, 6924 name: getTitleWithFallbackName(item) 6925 })); 6926 if (!fieldValue) { 6927 tree = buildTermsTree(tree); 6928 } 6929 const opts = getOptionsFromTree(tree); 6930 const optsHasParent = opts.find((item) => item.value === pageId); 6931 if (pageId && parentPostTitle && !optsHasParent) { 6932 opts.unshift({ 6933 value: pageId, 6934 label: parentPostTitle, 6935 rawName: "" 6936 }); 6937 } 6938 return opts.map((option) => ({ 6939 ...option, 6940 value: option.value.toString() 6941 })); 6942 }, [pageItems, fieldValue, parentPostTitle, pageId]); 6943 if (!isHierarchical) { 6944 return null; 6945 } 6946 const handleKeydown = (inputValue) => { 6947 setFieldValue(inputValue); 6948 }; 6949 const handleChange = (selectedPostId) => { 6950 if (selectedPostId) { 6951 return onChangeControl(parseInt(selectedPostId, 10) ?? 0); 6952 } 6953 onChangeControl(0); 6954 }; 6955 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 6956 external_wp_components_namespaceObject.ComboboxControl, 6957 { 6958 __nextHasNoMarginBottom: true, 6959 __next40pxDefaultSize: true, 6960 label: (0,external_wp_i18n_namespaceObject.__)("Parent"), 6961 help: (0,external_wp_i18n_namespaceObject.__)("Choose a parent page."), 6962 value: pageId?.toString(), 6963 options: parentOptions, 6964 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)( 6965 (value) => handleKeydown(value), 6966 300 6967 ), 6968 onChange: handleChange, 6969 hideLabelFromVision: true 6970 } 6971 ); 6972 } 6973 const ParentEdit = ({ 6974 data, 6975 field, 6976 onChange 6977 }) => { 6978 const { id } = field; 6979 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)((select) => { 6980 return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; 6981 }, []); 6982 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( 6983 (newValue) => onChange({ 6984 [id]: newValue 6985 }), 6986 [id, onChange] 6987 ); 6988 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("fieldset", { className: "fields-controls__parent", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 6989 (0,external_wp_element_namespaceObject.createInterpolateElement)( 6990 (0,external_wp_i18n_namespaceObject.sprintf)( 6991 /* translators: %1$s The home URL of the WordPress installation without the scheme. */ 6992 (0,external_wp_i18n_namespaceObject.__)( 6993 'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.' 6994 ), 6995 (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace( 6996 /([/.])/g, 6997 "<wbr />$1" 6998 ) 6999 ), 7000 { 7001 wbr: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) 7002 } 7003 ), 7004 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( 7005 (0,external_wp_i18n_namespaceObject.__)( 7006 "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>" 7007 ), 7008 { 7009 a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7010 external_wp_components_namespaceObject.ExternalLink, 7011 { 7012 href: (0,external_wp_i18n_namespaceObject.__)( 7013 "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes" 7014 ), 7015 children: void 0 7016 } 7017 ) 7018 } 7019 ) }), 7020 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7021 PageAttributesParent, 7022 { 7023 data, 7024 onChangeControl 7025 } 7026 ) 7027 ] }) }); 7028 }; 7029 7030 7031 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/parent-view.js 7032 7033 7034 7035 7036 7037 const ParentView = ({ 7038 item 7039 }) => { 7040 const parent = (0,external_wp_data_namespaceObject.useSelect)( 7041 (select) => { 7042 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 7043 return item?.parent ? getEntityRecord("postType", item.type, item.parent) : null; 7044 }, 7045 [item.parent, item.type] 7046 ); 7047 if (parent) { 7048 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: getTitleWithFallbackName(parent) }); 7049 } 7050 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: (0,external_wp_i18n_namespaceObject.__)("None") }); 7051 }; 7052 7053 7054 ;// ./node_modules/@wordpress/fields/build-module/fields/parent/index.js 7055 7056 7057 7058 const parentField = { 7059 id: "parent", 7060 type: "text", 7061 label: (0,external_wp_i18n_namespaceObject.__)("Parent"), 7062 Edit: ParentEdit, 7063 render: ParentView, 7064 enableSorting: true, 7065 filterBy: false 7066 }; 7067 var parent_default = parentField; 7068 7069 7070 ;// ./node_modules/@wordpress/fields/build-module/fields/comment-status/index.js 7071 7072 const commentStatusField = { 7073 id: "comment_status", 7074 label: (0,external_wp_i18n_namespaceObject.__)("Comments"), 7075 type: "text", 7076 Edit: "radio", 7077 enableSorting: false, 7078 enableHiding: false, 7079 filterBy: false, 7080 elements: [ 7081 { 7082 value: "open", 7083 label: (0,external_wp_i18n_namespaceObject.__)("Open"), 7084 description: (0,external_wp_i18n_namespaceObject.__)("Visitors can add new comments and replies.") 7085 }, 7086 { 7087 value: "closed", 7088 label: (0,external_wp_i18n_namespaceObject.__)("Closed"), 7089 description: (0,external_wp_i18n_namespaceObject.__)( 7090 "Visitors cannot add new comments or replies. Existing comments remain visible." 7091 ) 7092 } 7093 ] 7094 }; 7095 var comment_status_default = commentStatusField; 7096 7097 7098 ;// ./node_modules/@wordpress/fields/build-module/fields/ping-status/index.js 7099 7100 7101 7102 function PingStatusEdit({ 7103 data, 7104 onChange 7105 }) { 7106 const pingStatus = data?.ping_status ?? "open"; 7107 const onTogglePingback = (checked) => { 7108 onChange({ 7109 ...data, 7110 ping_status: checked ? "open" : "closed" 7111 }); 7112 }; 7113 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7114 external_wp_components_namespaceObject.CheckboxControl, 7115 { 7116 __nextHasNoMarginBottom: true, 7117 label: (0,external_wp_i18n_namespaceObject.__)("Enable pingbacks & trackbacks"), 7118 checked: pingStatus === "open", 7119 onChange: onTogglePingback, 7120 help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7121 external_wp_components_namespaceObject.ExternalLink, 7122 { 7123 href: (0,external_wp_i18n_namespaceObject.__)( 7124 "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/" 7125 ), 7126 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about pingbacks & trackbacks") 7127 } 7128 ) 7129 } 7130 ); 7131 } 7132 const pingStatusField = { 7133 id: "ping_status", 7134 label: (0,external_wp_i18n_namespaceObject.__)("Trackbacks & Pingbacks"), 7135 type: "text", 7136 Edit: PingStatusEdit, 7137 enableSorting: false, 7138 enableHiding: false, 7139 filterBy: false, 7140 elements: [ 7141 { 7142 value: "open", 7143 label: (0,external_wp_i18n_namespaceObject.__)("Allow"), 7144 description: (0,external_wp_i18n_namespaceObject.__)( 7145 "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles." 7146 ) 7147 }, 7148 { 7149 value: "closed", 7150 label: (0,external_wp_i18n_namespaceObject.__)("Don't allow"), 7151 description: (0,external_wp_i18n_namespaceObject.__)( 7152 "Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles." 7153 ) 7154 } 7155 ] 7156 }; 7157 var ping_status_default = pingStatusField; 7158 7159 7160 ;// ./node_modules/@wordpress/fields/build-module/fields/discussion/index.js 7161 7162 const discussionField = { 7163 id: "discussion", 7164 label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), 7165 type: "text", 7166 render: ({ item }) => { 7167 const commentsOpen = item.comment_status === "open"; 7168 const pingsOpen = item.ping_status === "open"; 7169 if (commentsOpen && pingsOpen) { 7170 return (0,external_wp_i18n_namespaceObject.__)("Open"); 7171 } 7172 if (commentsOpen && !pingsOpen) { 7173 return (0,external_wp_i18n_namespaceObject.__)("Comments only"); 7174 } 7175 if (!commentsOpen && pingsOpen) { 7176 return (0,external_wp_i18n_namespaceObject.__)("Pings only"); 7177 } 7178 return (0,external_wp_i18n_namespaceObject.__)("Closed"); 7179 }, 7180 filterBy: false 7181 }; 7182 var discussion_default = discussionField; 7183 7184 7185 ;// ./node_modules/@wordpress/fields/build-module/fields/template/template-edit.js 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 const EMPTY_ARRAY = []; 7199 const TemplateEdit = ({ 7200 data, 7201 field, 7202 onChange 7203 }) => { 7204 const { id } = field; 7205 const postType = data.type; 7206 const postId = typeof data.id === "number" ? data.id : parseInt(data.id, 10); 7207 const slug = data.slug; 7208 const { canSwitchTemplate, templates } = (0,external_wp_data_namespaceObject.useSelect)( 7209 (select) => { 7210 const allTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords( 7211 "postType", 7212 "wp_template", 7213 { 7214 per_page: -1, 7215 post_type: postType 7216 } 7217 ) ?? EMPTY_ARRAY; 7218 const { getHomePage, getPostsPageId } = lock_unlock_unlock( 7219 select(external_wp_coreData_namespaceObject.store) 7220 ); 7221 const isPostsPage = getPostsPageId() === +postId; 7222 const isFrontPage = postType === "page" && getHomePage()?.postId === +postId; 7223 const allowSwitchingTemplate = !isPostsPage && !isFrontPage; 7224 return { 7225 templates: allTemplates, 7226 canSwitchTemplate: allowSwitchingTemplate 7227 }; 7228 }, 7229 [postId, postType] 7230 ); 7231 const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => { 7232 if (!canSwitchTemplate) { 7233 return []; 7234 } 7235 return templates.filter( 7236 (template) => template.is_custom && template.slug !== data.template && // Skip empty templates. 7237 !!template.content.raw 7238 ).map((template) => ({ 7239 name: template.slug, 7240 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), 7241 title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), 7242 id: template.id 7243 })); 7244 }, [canSwitchTemplate, data.template, templates]); 7245 const shownTemplates = (0,external_wp_compose_namespaceObject.useAsyncList)(templatesAsPatterns); 7246 const value = field.getValue({ item: data }); 7247 const foundTemplate = templates.find( 7248 (template) => template.slug === value 7249 ); 7250 const currentTemplate = (0,external_wp_data_namespaceObject.useSelect)( 7251 (select) => { 7252 if (foundTemplate) { 7253 return foundTemplate; 7254 } 7255 let slugToCheck; 7256 if (slug) { 7257 slugToCheck = postType === "page" ? `$postType}-$slug}` : `single-$postType}-$slug}`; 7258 } else { 7259 slugToCheck = postType === "page" ? "page" : `single-$postType}`; 7260 } 7261 if (postType) { 7262 const templateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ 7263 slug: slugToCheck 7264 }); 7265 return select(external_wp_coreData_namespaceObject.store).getEntityRecord( 7266 "postType", 7267 "wp_template", 7268 templateId 7269 ); 7270 } 7271 }, 7272 [foundTemplate, postType, slug] 7273 ); 7274 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 7275 const onChangeControl = (0,external_wp_element_namespaceObject.useCallback)( 7276 (newValue) => onChange({ 7277 [id]: newValue 7278 }), 7279 [id, onChange] 7280 ); 7281 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", { className: "fields-controls__template", children: [ 7282 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7283 external_wp_components_namespaceObject.Dropdown, 7284 { 7285 popoverProps: { placement: "bottom-start" }, 7286 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7287 external_wp_components_namespaceObject.Button, 7288 { 7289 __next40pxDefaultSize: true, 7290 variant: "tertiary", 7291 size: "compact", 7292 onClick: onToggle, 7293 children: currentTemplate ? getItemTitle(currentTemplate) : "" 7294 } 7295 ), 7296 renderContent: ({ onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 7297 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7298 external_wp_components_namespaceObject.MenuItem, 7299 { 7300 onClick: () => { 7301 setShowModal(true); 7302 onToggle(); 7303 }, 7304 children: (0,external_wp_i18n_namespaceObject.__)("Change template") 7305 } 7306 ), 7307 // The default template in a post is indicated by an empty string 7308 value !== "" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7309 external_wp_components_namespaceObject.MenuItem, 7310 { 7311 onClick: () => { 7312 onChangeControl(""); 7313 onToggle(); 7314 }, 7315 children: (0,external_wp_i18n_namespaceObject.__)("Use default template") 7316 } 7317 ) 7318 ] }) 7319 } 7320 ), 7321 showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7322 external_wp_components_namespaceObject.Modal, 7323 { 7324 title: (0,external_wp_i18n_namespaceObject.__)("Choose a template"), 7325 onRequestClose: () => setShowModal(false), 7326 overlayClassName: "fields-controls__template-modal", 7327 isFullScreen: true, 7328 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__template-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7329 external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, 7330 { 7331 label: (0,external_wp_i18n_namespaceObject.__)("Templates"), 7332 blockPatterns: templatesAsPatterns, 7333 shownPatterns: shownTemplates, 7334 onClickPattern: (template) => { 7335 onChangeControl(template.name); 7336 setShowModal(false); 7337 } 7338 } 7339 ) }) 7340 } 7341 ) 7342 ] }); 7343 }; 7344 7345 7346 ;// ./node_modules/@wordpress/fields/build-module/fields/template/index.js 7347 7348 7349 const templateField = { 7350 id: "template", 7351 type: "text", 7352 label: (0,external_wp_i18n_namespaceObject.__)("Template"), 7353 Edit: TemplateEdit, 7354 enableSorting: false, 7355 filterBy: false 7356 }; 7357 var template_default = templateField; 7358 7359 7360 ;// ./node_modules/@wordpress/fields/build-module/fields/password/edit.js 7361 7362 7363 7364 7365 function PasswordEdit({ 7366 data, 7367 onChange, 7368 field 7369 }) { 7370 const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)( 7371 !!field.getValue({ item: data }) 7372 ); 7373 const handleTogglePassword = (value) => { 7374 setShowPassword(value); 7375 if (!value) { 7376 onChange({ password: "" }); 7377 } 7378 }; 7379 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 7380 external_wp_components_namespaceObject.__experimentalVStack, 7381 { 7382 as: "fieldset", 7383 spacing: 4, 7384 className: "fields-controls__password", 7385 children: [ 7386 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7387 external_wp_components_namespaceObject.CheckboxControl, 7388 { 7389 __nextHasNoMarginBottom: true, 7390 label: (0,external_wp_i18n_namespaceObject.__)("Password protected"), 7391 help: (0,external_wp_i18n_namespaceObject.__)("Only visible to those who know the password"), 7392 checked: showPassword, 7393 onChange: handleTogglePassword 7394 } 7395 ), 7396 showPassword && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "fields-controls__password-input", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7397 external_wp_components_namespaceObject.TextControl, 7398 { 7399 label: (0,external_wp_i18n_namespaceObject.__)("Password"), 7400 onChange: (value) => onChange({ 7401 password: value 7402 }), 7403 value: field.getValue({ item: data }) || "", 7404 placeholder: (0,external_wp_i18n_namespaceObject.__)("Use a secure password"), 7405 type: "text", 7406 __next40pxDefaultSize: true, 7407 __nextHasNoMarginBottom: true, 7408 maxLength: 255 7409 } 7410 ) }) 7411 ] 7412 } 7413 ); 7414 } 7415 var edit_default = PasswordEdit; 7416 7417 7418 ;// ./node_modules/@wordpress/fields/build-module/fields/password/index.js 7419 7420 7421 const passwordField = { 7422 id: "password", 7423 type: "text", 7424 label: (0,external_wp_i18n_namespaceObject.__)("Password"), 7425 Edit: edit_default, 7426 enableSorting: false, 7427 enableHiding: false, 7428 isVisible: (item) => item.status !== "private", 7429 filterBy: false 7430 }; 7431 var password_default = passwordField; 7432 7433 7434 ;// ./node_modules/@wordpress/fields/build-module/fields/title/view.js 7435 7436 7437 7438 7439 7440 function BaseTitleView({ 7441 item, 7442 className, 7443 children 7444 }) { 7445 const renderedTitle = getItemTitle(item); 7446 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 7447 external_wp_components_namespaceObject.__experimentalHStack, 7448 { 7449 className: dist_clsx("fields-field__title", className), 7450 alignment: "center", 7451 justify: "flex-start", 7452 children: [ 7453 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { children: renderedTitle || (0,external_wp_i18n_namespaceObject.__)("(no title)") }), 7454 children 7455 ] 7456 } 7457 ); 7458 } 7459 function TitleView({ item }) { 7460 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item }); 7461 } 7462 7463 7464 ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/view.js 7465 7466 7467 7468 7469 7470 7471 7472 const { Badge } = lock_unlock_unlock(external_wp_components_namespaceObject.privateApis); 7473 function PageTitleView({ item }) { 7474 const { frontPageId, postsPageId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 7475 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 7476 const siteSettings = getEntityRecord( 7477 "root", 7478 "site" 7479 ); 7480 return { 7481 frontPageId: siteSettings?.page_on_front, 7482 postsPageId: siteSettings?.page_for_posts 7483 }; 7484 }, []); 7485 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Badge, { children: item.id === frontPageId ? (0,external_wp_i18n_namespaceObject.__)("Homepage") : (0,external_wp_i18n_namespaceObject.__)("Posts Page") }) }); 7486 } 7487 7488 7489 ;// ./node_modules/@wordpress/fields/build-module/fields/page-title/index.js 7490 7491 7492 7493 const pageTitleField = { 7494 type: "text", 7495 id: "title", 7496 label: (0,external_wp_i18n_namespaceObject.__)("Title"), 7497 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 7498 getValue: ({ item }) => getItemTitle(item), 7499 render: PageTitleView, 7500 enableHiding: false, 7501 enableGlobalSearch: true, 7502 filterBy: false 7503 }; 7504 var page_title_default = pageTitleField; 7505 7506 7507 ;// ./node_modules/@wordpress/fields/build-module/fields/template-title/index.js 7508 7509 7510 7511 const templateTitleField = { 7512 type: "text", 7513 label: (0,external_wp_i18n_namespaceObject.__)("Template"), 7514 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 7515 id: "title", 7516 getValue: ({ item }) => getItemTitle(item), 7517 render: TitleView, 7518 enableHiding: false, 7519 enableGlobalSearch: true, 7520 filterBy: false 7521 }; 7522 var template_title_default = templateTitleField; 7523 7524 7525 ;// ./node_modules/@wordpress/icons/build-module/icon/index.js 7526 7527 var icon_default = (0,external_wp_element_namespaceObject.forwardRef)( 7528 ({ icon, size = 24, ...props }, ref) => { 7529 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 7530 width: size, 7531 height: size, 7532 ...props, 7533 ref 7534 }); 7535 } 7536 ); 7537 7538 7539 ;// ./node_modules/@wordpress/icons/build-module/library/lock-small.js 7540 7541 7542 var lock_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7543 external_wp_primitives_namespaceObject.Path, 7544 { 7545 fillRule: "evenodd", 7546 clipRule: "evenodd", 7547 d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z" 7548 } 7549 ) }); 7550 7551 7552 ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/view.js 7553 7554 7555 7556 7557 7558 7559 7560 const { PATTERN_TYPES: view_PATTERN_TYPES } = lock_unlock_unlock(external_wp_patterns_namespaceObject.privateApis); 7561 function PatternTitleView({ item }) { 7562 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === view_PATTERN_TYPES.theme && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 7563 external_wp_components_namespaceObject.Tooltip, 7564 { 7565 placement: "top", 7566 text: (0,external_wp_i18n_namespaceObject.__)("This pattern cannot be edited."), 7567 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: lock_small_default, size: 24 }) 7568 } 7569 ) }); 7570 } 7571 7572 7573 ;// ./node_modules/@wordpress/fields/build-module/fields/pattern-title/index.js 7574 7575 7576 7577 const patternTitleField = { 7578 type: "text", 7579 id: "title", 7580 label: (0,external_wp_i18n_namespaceObject.__)("Title"), 7581 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 7582 getValue: ({ item }) => getItemTitle(item), 7583 render: PatternTitleView, 7584 enableHiding: false, 7585 enableGlobalSearch: true, 7586 filterBy: false 7587 }; 7588 var pattern_title_default = patternTitleField; 7589 7590 7591 ;// ./node_modules/@wordpress/fields/build-module/fields/title/index.js 7592 7593 7594 7595 const titleField = { 7596 type: "text", 7597 id: "title", 7598 label: (0,external_wp_i18n_namespaceObject.__)("Title"), 7599 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 7600 getValue: ({ item }) => getItemTitle(item), 7601 render: TitleView, 7602 enableHiding: true, 7603 enableGlobalSearch: true, 7604 filterBy: false 7605 }; 7606 var title_default = titleField; 7607 7608 7609 ;// ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js 7610 7611 7612 7613 7614 7615 7616 function getSubRegistry(subRegistries, registry, useSubRegistry) { 7617 if (!useSubRegistry) { 7618 return registry; 7619 } 7620 let subRegistry = subRegistries.get(registry); 7621 if (!subRegistry) { 7622 subRegistry = (0,external_wp_data_namespaceObject.createRegistry)( 7623 { 7624 "core/block-editor": external_wp_blockEditor_namespaceObject.storeConfig 7625 }, 7626 registry 7627 ); 7628 subRegistry.registerStore("core/editor", storeConfig); 7629 subRegistries.set(registry, subRegistry); 7630 } 7631 return subRegistry; 7632 } 7633 const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 7634 (WrappedComponent) => ({ useSubRegistry = true, ...props }) => { 7635 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 7636 const [subRegistries] = (0,external_wp_element_namespaceObject.useState)(() => /* @__PURE__ */ new WeakMap()); 7637 const subRegistry = getSubRegistry( 7638 subRegistries, 7639 registry, 7640 useSubRegistry 7641 ); 7642 if (subRegistry === registry) { 7643 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry, ...props }); 7644 } 7645 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_data_namespaceObject.RegistryProvider, { value: subRegistry, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, { registry: subRegistry, ...props }) }); 7646 }, 7647 "withRegistryProvider" 7648 ); 7649 var with_registry_provider_default = withRegistryProvider; 7650 7651 7652 ;// ./node_modules/@wordpress/editor/build-module/components/media-categories/index.js 7653 7654 7655 7656 7657 const getExternalLink = (url, text) => `<a $getExternalLinkAttributes(url)}>$text}</a>`; 7658 const getExternalLinkAttributes = (url) => `href="$url}" target="_blank" rel="noreferrer noopener"`; 7659 const getOpenverseLicense = (license, licenseVersion) => { 7660 let licenseName = license.trim(); 7661 if (license !== "pdm") { 7662 licenseName = license.toUpperCase().replace("SAMPLING", "Sampling"); 7663 } 7664 if (licenseVersion) { 7665 licenseName += ` $licenseVersion}`; 7666 } 7667 if (!["pdm", "cc0"].includes(license)) { 7668 licenseName = `CC $licenseName}`; 7669 } 7670 return licenseName; 7671 }; 7672 const getOpenverseCaption = (item) => { 7673 const { 7674 title, 7675 foreign_landing_url: foreignLandingUrl, 7676 creator, 7677 creator_url: creatorUrl, 7678 license, 7679 license_version: licenseVersion, 7680 license_url: licenseUrl 7681 } = item; 7682 const fullLicense = getOpenverseLicense(license, licenseVersion); 7683 const _creator = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(creator); 7684 let _caption; 7685 if (_creator) { 7686 _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( 7687 // translators: %1s: Title of a media work from Openverse; %2$s: Name of the work's creator; %3s: Work's licence e.g: "CC0 1.0". 7688 (0,external_wp_i18n_namespaceObject._x)('"%1$s" by %2$s/ %3$s', "caption"), 7689 getExternalLink( 7690 foreignLandingUrl, 7691 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) 7692 ), 7693 creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, 7694 licenseUrl ? getExternalLink( 7695 `$licenseUrl}?ref=openverse`, 7696 fullLicense 7697 ) : fullLicense 7698 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 7699 // 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". 7700 (0,external_wp_i18n_namespaceObject._x)("<a %1$s>Work</a> by %2$s/ %3$s", "caption"), 7701 getExternalLinkAttributes(foreignLandingUrl), 7702 creatorUrl ? getExternalLink(creatorUrl, _creator) : _creator, 7703 licenseUrl ? getExternalLink( 7704 `$licenseUrl}?ref=openverse`, 7705 fullLicense 7706 ) : fullLicense 7707 ); 7708 } else { 7709 _caption = title ? (0,external_wp_i18n_namespaceObject.sprintf)( 7710 // translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: "CC0 1.0". 7711 (0,external_wp_i18n_namespaceObject._x)('"%1$s"/ %2$s', "caption"), 7712 getExternalLink( 7713 foreignLandingUrl, 7714 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) 7715 ), 7716 licenseUrl ? getExternalLink( 7717 `$licenseUrl}?ref=openverse`, 7718 fullLicense 7719 ) : fullLicense 7720 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 7721 // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0". 7722 (0,external_wp_i18n_namespaceObject._x)("<a %1$s>Work</a>/ %2$s", "caption"), 7723 getExternalLinkAttributes(foreignLandingUrl), 7724 licenseUrl ? getExternalLink( 7725 `$licenseUrl}?ref=openverse`, 7726 fullLicense 7727 ) : fullLicense 7728 ); 7729 } 7730 return _caption.replace(/\s{2}/g, " "); 7731 }; 7732 const coreMediaFetch = async (query = {}) => { 7733 const mediaItems = await (0,external_wp_data_namespaceObject.resolveSelect)(external_wp_coreData_namespaceObject.store).getEntityRecords( 7734 "postType", 7735 "attachment", 7736 { 7737 ...query, 7738 orderBy: !!query?.search ? "relevance" : "date" 7739 } 7740 ); 7741 return mediaItems.map((mediaItem) => ({ 7742 ...mediaItem, 7743 alt: mediaItem.alt_text, 7744 url: mediaItem.source_url, 7745 previewUrl: mediaItem.media_details?.sizes?.medium?.source_url, 7746 caption: mediaItem.caption?.raw 7747 })); 7748 }; 7749 const inserterMediaCategories = [ 7750 { 7751 name: "images", 7752 labels: { 7753 name: (0,external_wp_i18n_namespaceObject.__)("Images"), 7754 search_items: (0,external_wp_i18n_namespaceObject.__)("Search images") 7755 }, 7756 mediaType: "image", 7757 async fetch(query = {}) { 7758 return coreMediaFetch({ ...query, media_type: "image" }); 7759 } 7760 }, 7761 { 7762 name: "videos", 7763 labels: { 7764 name: (0,external_wp_i18n_namespaceObject.__)("Videos"), 7765 search_items: (0,external_wp_i18n_namespaceObject.__)("Search videos") 7766 }, 7767 mediaType: "video", 7768 async fetch(query = {}) { 7769 return coreMediaFetch({ ...query, media_type: "video" }); 7770 } 7771 }, 7772 { 7773 name: "audio", 7774 labels: { 7775 name: (0,external_wp_i18n_namespaceObject.__)("Audio"), 7776 search_items: (0,external_wp_i18n_namespaceObject.__)("Search audio") 7777 }, 7778 mediaType: "audio", 7779 async fetch(query = {}) { 7780 return coreMediaFetch({ ...query, media_type: "audio" }); 7781 } 7782 }, 7783 { 7784 name: "openverse", 7785 labels: { 7786 name: (0,external_wp_i18n_namespaceObject.__)("Openverse"), 7787 search_items: (0,external_wp_i18n_namespaceObject.__)("Search Openverse") 7788 }, 7789 mediaType: "image", 7790 async fetch(query = {}) { 7791 const defaultArgs = { 7792 mature: false, 7793 excluded_source: "flickr,inaturalist,wikimedia", 7794 license: "pdm,cc0" 7795 }; 7796 const finalQuery = { ...query, ...defaultArgs }; 7797 const mapFromInserterMediaRequest = { 7798 per_page: "page_size", 7799 search: "q" 7800 }; 7801 const url = new URL("https://api.openverse.org/v1/images/"); 7802 Object.entries(finalQuery).forEach(([key, value]) => { 7803 const queryKey = mapFromInserterMediaRequest[key] || key; 7804 url.searchParams.set(queryKey, value); 7805 }); 7806 const response = await window.fetch(url, { 7807 headers: { 7808 "User-Agent": "WordPress/inserter-media-fetch" 7809 } 7810 }); 7811 const jsonResponse = await response.json(); 7812 const results = jsonResponse.results; 7813 return results.map((result) => ({ 7814 ...result, 7815 // This is a temp solution for better titles, until Openverse API 7816 // completes the cleaning up of some titles of their upstream data. 7817 title: result.title?.toLowerCase().startsWith("file:") ? result.title.slice(5) : result.title, 7818 sourceId: result.id, 7819 id: void 0, 7820 caption: getOpenverseCaption(result), 7821 previewUrl: result.thumbnail 7822 })); 7823 }, 7824 getReportUrl: ({ sourceId }) => `https://wordpress.org/openverse/image/$sourceId}/report/`, 7825 isExternalResource: true 7826 } 7827 ]; 7828 var media_categories_default = inserterMediaCategories; 7829 7830 7831 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/native.js 7832 const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); 7833 /* harmony default export */ const esm_browser_native = ({ 7834 randomUUID 7835 }); 7836 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/rng.js 7837 // Unique ID creation requires a high quality random # generator. In the browser we therefore 7838 // require the crypto API and do not support built-in fallback to lower quality random number 7839 // generators (like Math.random()). 7840 let getRandomValues; 7841 const rnds8 = new Uint8Array(16); 7842 function rng() { 7843 // lazy load so that environments that need to polyfill have a chance to do so 7844 if (!getRandomValues) { 7845 // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. 7846 getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); 7847 7848 if (!getRandomValues) { 7849 throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 7850 } 7851 } 7852 7853 return getRandomValues(rnds8); 7854 } 7855 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/stringify.js 7856 7857 /** 7858 * Convert array of 16 byte values to UUID string format of the form: 7859 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 7860 */ 7861 7862 const byteToHex = []; 7863 7864 for (let i = 0; i < 256; ++i) { 7865 byteToHex.push((i + 0x100).toString(16).slice(1)); 7866 } 7867 7868 function unsafeStringify(arr, offset = 0) { 7869 // Note: Be careful editing this code! It's been tuned for performance 7870 // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 7871 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; 7872 } 7873 7874 function stringify(arr, offset = 0) { 7875 const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one 7876 // of the following: 7877 // - One or more input array values don't map to a hex octet (leading to 7878 // "undefined" in the uuid) 7879 // - Invalid input values for the RFC `version` or `variant` fields 7880 7881 if (!validate(uuid)) { 7882 throw TypeError('Stringified UUID is invalid'); 7883 } 7884 7885 return uuid; 7886 } 7887 7888 /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify))); 7889 ;// ./node_modules/@wordpress/editor/node_modules/uuid/dist/esm-browser/v4.js 7890 7891 7892 7893 7894 function v4(options, buf, offset) { 7895 if (esm_browser_native.randomUUID && !buf && !options) { 7896 return esm_browser_native.randomUUID(); 7897 } 7898 7899 options = options || {}; 7900 const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 7901 7902 rnds[6] = rnds[6] & 0x0f | 0x40; 7903 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 7904 7905 if (buf) { 7906 offset = offset || 0; 7907 7908 for (let i = 0; i < 16; ++i) { 7909 buf[offset + i] = rnds[i]; 7910 } 7911 7912 return buf; 7913 } 7914 7915 return unsafeStringify(rnds); 7916 } 7917 7918 /* harmony default export */ const esm_browser_v4 = (v4); 7919 ;// ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js 7920 7921 7922 7923 7924 7925 const noop = () => { 7926 }; 7927 function mediaUpload({ 7928 additionalData = {}, 7929 allowedTypes, 7930 filesList, 7931 maxUploadFileSize, 7932 onError = noop, 7933 onFileChange, 7934 onSuccess, 7935 multiple = true 7936 }) { 7937 const { receiveEntityRecords } = (0,external_wp_data_namespaceObject.dispatch)(external_wp_coreData_namespaceObject.store); 7938 const { getCurrentPost, getEditorSettings } = (0,external_wp_data_namespaceObject.select)(store_store); 7939 const { 7940 lockPostAutosaving, 7941 unlockPostAutosaving, 7942 lockPostSaving, 7943 unlockPostSaving 7944 } = (0,external_wp_data_namespaceObject.dispatch)(store_store); 7945 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; 7946 const lockKey = `image-upload-$esm_browser_v4()}`; 7947 let imageIsUploading = false; 7948 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; 7949 const currentPost = getCurrentPost(); 7950 const currentPostId = typeof currentPost?.id === "number" ? currentPost.id : currentPost?.wp_id; 7951 const setSaveLock = () => { 7952 lockPostSaving(lockKey); 7953 lockPostAutosaving(lockKey); 7954 imageIsUploading = true; 7955 }; 7956 const postData = currentPostId ? { post: currentPostId } : {}; 7957 const clearSaveLock = () => { 7958 unlockPostSaving(lockKey); 7959 unlockPostAutosaving(lockKey); 7960 imageIsUploading = false; 7961 }; 7962 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ 7963 allowedTypes, 7964 filesList, 7965 onFileChange: (file) => { 7966 if (!imageIsUploading) { 7967 setSaveLock(); 7968 } else { 7969 clearSaveLock(); 7970 } 7971 onFileChange?.(file); 7972 const entityFiles = file.filter((_file) => _file?.id); 7973 if (entityFiles?.length) { 7974 const invalidateCache = true; 7975 receiveEntityRecords( 7976 "postType", 7977 "attachment", 7978 entityFiles, 7979 void 0, 7980 invalidateCache 7981 ); 7982 } 7983 }, 7984 onSuccess, 7985 additionalData: { 7986 ...postData, 7987 ...additionalData 7988 }, 7989 maxUploadFileSize, 7990 onError: ({ message }) => { 7991 clearSaveLock(); 7992 onError(message); 7993 }, 7994 wpAllowedMimeTypes, 7995 multiple 7996 }); 7997 } 7998 7999 8000 ;// ./node_modules/@wordpress/editor/build-module/utils/media-sideload/index.js 8001 8002 8003 const { sideloadMedia: mediaSideload } = unlock(external_wp_mediaUtils_namespaceObject.privateApis); 8004 var media_sideload_default = mediaSideload; 8005 8006 8007 // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js 8008 var cjs = __webpack_require__(66); 8009 var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); 8010 ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs 8011 /*! 8012 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 8013 * 8014 * Copyright (c) 2014-2017, Jon Schlinkert. 8015 * Released under the MIT License. 8016 */ 8017 8018 function isObject(o) { 8019 return Object.prototype.toString.call(o) === '[object Object]'; 8020 } 8021 8022 function isPlainObject(o) { 8023 var ctor,prot; 8024 8025 if (isObject(o) === false) return false; 8026 8027 // If has modified constructor 8028 ctor = o.constructor; 8029 if (ctor === undefined) return true; 8030 8031 // If has modified prototype 8032 prot = ctor.prototype; 8033 if (isObject(prot) === false) return false; 8034 8035 // If constructor does not have an Object-specific method 8036 if (prot.hasOwnProperty('isPrototypeOf') === false) { 8037 return false; 8038 } 8039 8040 // Most likely a plain Object 8041 return true; 8042 } 8043 8044 8045 8046 ;// ./node_modules/@wordpress/editor/build-module/components/global-styles-provider/index.js 8047 8048 8049 8050 8051 8052 8053 8054 8055 const { GlobalStylesContext, cleanEmptyObject } = unlock( 8056 external_wp_blockEditor_namespaceObject.privateApis 8057 ); 8058 function mergeBaseAndUserConfigs(base, user) { 8059 return cjs_default()(base, user, { 8060 /* 8061 * We only pass as arrays the presets, 8062 * in which case we want the new array of values 8063 * to override the old array (no merging). 8064 */ 8065 isMergeableObject: isPlainObject, 8066 /* 8067 * Exceptions to the above rule. 8068 * Background images should be replaced, not merged, 8069 * as they themselves are specific object definitions for the style. 8070 */ 8071 customMerge: (key) => { 8072 if (key === "backgroundImage") { 8073 return (baseConfig, userConfig) => userConfig; 8074 } 8075 return void 0; 8076 } 8077 }); 8078 } 8079 function useGlobalStylesUserConfig() { 8080 const { globalStylesId, isReady, settings, styles, _links } = (0,external_wp_data_namespaceObject.useSelect)( 8081 (select) => { 8082 const { 8083 getEntityRecord, 8084 getEditedEntityRecord: getEditedEntityRecord2, 8085 hasFinishedResolution, 8086 canUser 8087 } = select(external_wp_coreData_namespaceObject.store); 8088 const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId(); 8089 let record; 8090 const userCanEditGlobalStyles = _globalStylesId ? canUser("update", { 8091 kind: "root", 8092 name: "globalStyles", 8093 id: _globalStylesId 8094 }) : null; 8095 if (_globalStylesId && /* 8096 * Test that the OPTIONS request for user capabilities is complete 8097 * before fetching the global styles entity record. 8098 * This is to avoid fetching the global styles entity unnecessarily. 8099 */ 8100 typeof userCanEditGlobalStyles === "boolean") { 8101 if (userCanEditGlobalStyles) { 8102 record = getEditedEntityRecord2( 8103 "root", 8104 "globalStyles", 8105 _globalStylesId 8106 ); 8107 } else { 8108 record = getEntityRecord( 8109 "root", 8110 "globalStyles", 8111 _globalStylesId, 8112 { context: "view" } 8113 ); 8114 } 8115 } 8116 let hasResolved = false; 8117 if (hasFinishedResolution( 8118 "__experimentalGetCurrentGlobalStylesId" 8119 )) { 8120 if (_globalStylesId) { 8121 hasResolved = userCanEditGlobalStyles ? hasFinishedResolution("getEditedEntityRecord", [ 8122 "root", 8123 "globalStyles", 8124 _globalStylesId 8125 ]) : hasFinishedResolution("getEntityRecord", [ 8126 "root", 8127 "globalStyles", 8128 _globalStylesId, 8129 { context: "view" } 8130 ]); 8131 } else { 8132 hasResolved = true; 8133 } 8134 } 8135 return { 8136 globalStylesId: _globalStylesId, 8137 isReady: hasResolved, 8138 settings: record?.settings, 8139 styles: record?.styles, 8140 _links: record?._links 8141 }; 8142 }, 8143 [] 8144 ); 8145 const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 8146 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8147 const config = (0,external_wp_element_namespaceObject.useMemo)(() => { 8148 return { 8149 settings: settings ?? {}, 8150 styles: styles ?? {}, 8151 _links: _links ?? {} 8152 }; 8153 }, [settings, styles, _links]); 8154 const setConfig = (0,external_wp_element_namespaceObject.useCallback)( 8155 /** 8156 * Set the global styles config. 8157 * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values. 8158 * Otherwise, overwrite the current config with the incoming object. 8159 * @param {Object} options Options for editEntityRecord Core selector. 8160 */ 8161 (callbackOrObject, options = {}) => { 8162 const record = getEditedEntityRecord( 8163 "root", 8164 "globalStyles", 8165 globalStylesId 8166 ); 8167 const currentConfig = { 8168 styles: record?.styles ?? {}, 8169 settings: record?.settings ?? {}, 8170 _links: record?._links ?? {} 8171 }; 8172 const updatedConfig = typeof callbackOrObject === "function" ? callbackOrObject(currentConfig) : callbackOrObject; 8173 editEntityRecord( 8174 "root", 8175 "globalStyles", 8176 globalStylesId, 8177 { 8178 styles: cleanEmptyObject(updatedConfig.styles) || {}, 8179 settings: cleanEmptyObject(updatedConfig.settings) || {}, 8180 _links: cleanEmptyObject(updatedConfig._links) || {} 8181 }, 8182 options 8183 ); 8184 }, 8185 [globalStylesId, editEntityRecord, getEditedEntityRecord] 8186 ); 8187 return [isReady, config, setConfig]; 8188 } 8189 function useGlobalStylesBaseConfig() { 8190 const baseConfig = (0,external_wp_data_namespaceObject.useSelect)( 8191 (select) => select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles(), 8192 [] 8193 ); 8194 return [!!baseConfig, baseConfig]; 8195 } 8196 function useGlobalStylesContext() { 8197 const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig(); 8198 const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig(); 8199 const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => { 8200 if (!baseConfig || !userConfig) { 8201 return {}; 8202 } 8203 return mergeBaseAndUserConfigs(baseConfig, userConfig); 8204 }, [userConfig, baseConfig]); 8205 const context = (0,external_wp_element_namespaceObject.useMemo)(() => { 8206 return { 8207 isReady: isUserConfigReady && isBaseConfigReady, 8208 user: userConfig, 8209 base: baseConfig, 8210 merged: mergedConfig, 8211 setUserConfig 8212 }; 8213 }, [ 8214 mergedConfig, 8215 userConfig, 8216 baseConfig, 8217 setUserConfig, 8218 isUserConfigReady, 8219 isBaseConfigReady 8220 ]); 8221 return context; 8222 } 8223 function GlobalStylesProvider({ children }) { 8224 const context = useGlobalStylesContext(); 8225 if (!context.isReady) { 8226 return null; 8227 } 8228 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesContext.Provider, { value: context, children }); 8229 } 8230 8231 8232 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 const use_block_editor_settings_EMPTY_OBJECT = {}; 8248 function __experimentalReusableBlocksSelect(select) { 8249 const { RECEIVE_INTERMEDIATE_RESULTS } = unlock(external_wp_coreData_namespaceObject.privateApis); 8250 const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); 8251 return getEntityRecords("postType", "wp_block", { 8252 per_page: -1, 8253 [RECEIVE_INTERMEDIATE_RESULTS]: true 8254 }); 8255 } 8256 const BLOCK_EDITOR_SETTINGS = [ 8257 "__experimentalBlockBindingsSupportedAttributes", 8258 "__experimentalBlockDirectory", 8259 "__experimentalDiscussionSettings", 8260 "__experimentalFeatures", 8261 "__experimentalGlobalStylesBaseStyles", 8262 "alignWide", 8263 "blockInspectorTabs", 8264 "maxUploadFileSize", 8265 "allowedMimeTypes", 8266 "bodyPlaceholder", 8267 "canLockBlocks", 8268 "canUpdateBlockBindings", 8269 "capabilities", 8270 "clearBlockSelection", 8271 "codeEditingEnabled", 8272 "colors", 8273 "disableCustomColors", 8274 "disableCustomFontSizes", 8275 "disableCustomSpacingSizes", 8276 "disableCustomGradients", 8277 "disableLayoutStyles", 8278 "enableCustomLineHeight", 8279 "enableCustomSpacing", 8280 "enableCustomUnits", 8281 "enableOpenverseMediaCategory", 8282 "fontSizes", 8283 "gradients", 8284 "generateAnchors", 8285 "onNavigateToEntityRecord", 8286 "imageDefaultSize", 8287 "imageDimensions", 8288 "imageEditing", 8289 "imageSizes", 8290 "isPreviewMode", 8291 "isRTL", 8292 "locale", 8293 "maxWidth", 8294 "postContentAttributes", 8295 "postsPerPage", 8296 "readOnly", 8297 "styles", 8298 "titlePlaceholder", 8299 "supportsLayout", 8300 "widgetTypesToHideFromLegacyWidgetBlock", 8301 "__unstableHasCustomAppender", 8302 "__unstableResolvedAssets", 8303 "__unstableIsBlockBasedTheme" 8304 ]; 8305 const { 8306 globalStylesDataKey, 8307 globalStylesLinksDataKey, 8308 selectBlockPatternsKey, 8309 reusableBlocksSelectKey, 8310 sectionRootClientIdKey, 8311 mediaEditKey 8312 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 8313 function useBlockEditorSettings(settings, postType, postId, renderingMode) { 8314 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); 8315 const { 8316 allowRightClickOverrides, 8317 blockTypes, 8318 focusMode, 8319 hasFixedToolbar, 8320 isDistractionFree, 8321 keepCaretInsideBlock, 8322 hasUploadPermissions, 8323 hiddenBlockTypes, 8324 canUseUnfilteredHTML, 8325 userCanCreatePages, 8326 pageOnFront, 8327 pageForPosts, 8328 userPatternCategories, 8329 restBlockPatternCategories, 8330 sectionRootClientId 8331 } = (0,external_wp_data_namespaceObject.useSelect)( 8332 (select) => { 8333 const { 8334 canUser, 8335 getRawEntityRecord, 8336 getEntityRecord, 8337 getUserPatternCategories, 8338 getBlockPatternCategories 8339 } = select(external_wp_coreData_namespaceObject.store); 8340 const { get } = select(external_wp_preferences_namespaceObject.store); 8341 const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); 8342 const { getBlocksByName, getBlockAttributes } = select(external_wp_blockEditor_namespaceObject.store); 8343 const siteSettings = canUser("read", { 8344 kind: "root", 8345 name: "site" 8346 }) ? getEntityRecord("root", "site") : void 0; 8347 function getSectionRootBlock() { 8348 if (renderingMode === "template-locked") { 8349 return getBlocksByName("core/post-content")?.[0] ?? ""; 8350 } 8351 return getBlocksByName("core/group").find( 8352 (clientId) => getBlockAttributes(clientId)?.tagName === "main" 8353 ) ?? ""; 8354 } 8355 return { 8356 allowRightClickOverrides: get( 8357 "core", 8358 "allowRightClickOverrides" 8359 ), 8360 blockTypes: getBlockTypes(), 8361 canUseUnfilteredHTML: getRawEntityRecord( 8362 "postType", 8363 postType, 8364 postId 8365 )?._links?.hasOwnProperty("wp:action-unfiltered-html"), 8366 focusMode: get("core", "focusMode"), 8367 hasFixedToolbar: get("core", "fixedToolbar") || !isLargeViewport, 8368 hiddenBlockTypes: get("core", "hiddenBlockTypes"), 8369 isDistractionFree: get("core", "distractionFree"), 8370 keepCaretInsideBlock: get("core", "keepCaretInsideBlock"), 8371 hasUploadPermissions: canUser("create", { 8372 kind: "postType", 8373 name: "attachment" 8374 }) ?? true, 8375 userCanCreatePages: canUser("create", { 8376 kind: "postType", 8377 name: "page" 8378 }), 8379 pageOnFront: siteSettings?.page_on_front, 8380 pageForPosts: siteSettings?.page_for_posts, 8381 userPatternCategories: getUserPatternCategories(), 8382 restBlockPatternCategories: getBlockPatternCategories(), 8383 sectionRootClientId: getSectionRootBlock() 8384 }; 8385 }, 8386 [postType, postId, isLargeViewport, renderingMode] 8387 ); 8388 const { merged: mergedGlobalStyles } = useGlobalStylesContext(); 8389 const globalStylesData = mergedGlobalStyles.styles ?? use_block_editor_settings_EMPTY_OBJECT; 8390 const globalStylesLinksData = mergedGlobalStyles._links ?? use_block_editor_settings_EMPTY_OBJECT; 8391 const settingsBlockPatterns = settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 8392 settings.__experimentalBlockPatterns; 8393 const settingsBlockPatternCategories = settings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0 8394 settings.__experimentalBlockPatternCategories; 8395 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)( 8396 () => [...settingsBlockPatterns || []].filter( 8397 ({ postTypes }) => { 8398 return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType); 8399 } 8400 ), 8401 [settingsBlockPatterns, postType] 8402 ); 8403 const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)( 8404 () => [ 8405 ...settingsBlockPatternCategories || [], 8406 ...restBlockPatternCategories || [] 8407 ].filter( 8408 (x, index, arr) => index === arr.findIndex((y) => x.name === y.name) 8409 ), 8410 [settingsBlockPatternCategories, restBlockPatternCategories] 8411 ); 8412 const { undo, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 8413 const { editMediaEntity } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store)); 8414 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 8415 const createPageEntity = (0,external_wp_element_namespaceObject.useCallback)( 8416 (options) => { 8417 if (!userCanCreatePages) { 8418 return Promise.reject({ 8419 message: (0,external_wp_i18n_namespaceObject.__)( 8420 "You do not have permission to create Pages." 8421 ) 8422 }); 8423 } 8424 return saveEntityRecord("postType", "page", options); 8425 }, 8426 [saveEntityRecord, userCanCreatePages] 8427 ); 8428 const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 8429 if (hiddenBlockTypes && hiddenBlockTypes.length > 0) { 8430 const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ name }) => name) : settings.allowedBlockTypes || []; 8431 return defaultAllowedBlockTypes.filter( 8432 (type) => !hiddenBlockTypes.includes(type) 8433 ); 8434 } 8435 return settings.allowedBlockTypes; 8436 }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]); 8437 const forceDisableFocusMode = settings.focusMode === false; 8438 return (0,external_wp_element_namespaceObject.useMemo)(() => { 8439 const blockEditorSettings = { 8440 ...Object.fromEntries( 8441 Object.entries(settings).filter( 8442 ([key]) => BLOCK_EDITOR_SETTINGS.includes(key) 8443 ) 8444 ), 8445 [globalStylesDataKey]: globalStylesData, 8446 [globalStylesLinksDataKey]: globalStylesLinksData, 8447 allowedBlockTypes, 8448 allowRightClickOverrides, 8449 focusMode: focusMode && !forceDisableFocusMode, 8450 hasFixedToolbar, 8451 isDistractionFree, 8452 keepCaretInsideBlock, 8453 [mediaEditKey]: hasUploadPermissions ? editMediaEntity : void 0, 8454 mediaUpload: hasUploadPermissions ? mediaUpload : void 0, 8455 mediaSideload: hasUploadPermissions ? media_sideload_default : void 0, 8456 __experimentalBlockPatterns: blockPatterns, 8457 [selectBlockPatternsKey]: (select) => { 8458 const { hasFinishedResolution, getBlockPatternsForPostType } = unlock(select(external_wp_coreData_namespaceObject.store)); 8459 const patterns = getBlockPatternsForPostType(postType); 8460 return hasFinishedResolution("getBlockPatterns") ? patterns : void 0; 8461 }, 8462 [reusableBlocksSelectKey]: __experimentalReusableBlocksSelect, 8463 __experimentalBlockPatternCategories: blockPatternCategories, 8464 __experimentalUserPatternCategories: userPatternCategories, 8465 __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), 8466 inserterMediaCategories: media_categories_default, 8467 __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, 8468 // Todo: This only checks the top level post, not the post within a template or any other entity that can be edited. 8469 // This might be better as a generic "canUser" selector. 8470 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, 8471 //Todo: this is only needed for native and should probably be removed. 8472 __experimentalUndo: undo, 8473 // Check whether we want all site editor frames to have outlines 8474 // including the navigation / pattern / parts editors. 8475 outlineMode: !isDistractionFree && postType === "wp_template", 8476 // Check these two properties: they were not present in the site editor. 8477 __experimentalCreatePageEntity: createPageEntity, 8478 __experimentalUserCanCreatePages: userCanCreatePages, 8479 pageOnFront, 8480 pageForPosts, 8481 __experimentalPreferPatternsOnRoot: postType === "wp_template", 8482 templateLock: postType === "wp_navigation" ? "insert" : settings.templateLock, 8483 template: postType === "wp_navigation" ? [["core/navigation", {}, []]] : settings.template, 8484 __experimentalSetIsInserterOpened: setIsInserterOpened, 8485 [sectionRootClientIdKey]: sectionRootClientId, 8486 editorTool: renderingMode === "post-only" && postType !== "wp_template" ? "edit" : void 0 8487 }; 8488 return blockEditorSettings; 8489 }, [ 8490 allowedBlockTypes, 8491 allowRightClickOverrides, 8492 focusMode, 8493 forceDisableFocusMode, 8494 hasFixedToolbar, 8495 isDistractionFree, 8496 keepCaretInsideBlock, 8497 settings, 8498 hasUploadPermissions, 8499 userPatternCategories, 8500 blockPatterns, 8501 blockPatternCategories, 8502 canUseUnfilteredHTML, 8503 undo, 8504 createPageEntity, 8505 userCanCreatePages, 8506 pageOnFront, 8507 pageForPosts, 8508 postType, 8509 setIsInserterOpened, 8510 sectionRootClientId, 8511 globalStylesData, 8512 globalStylesLinksData, 8513 renderingMode, 8514 editMediaEntity 8515 ]); 8516 } 8517 var use_block_editor_settings_default = useBlockEditorSettings; 8518 8519 8520 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-post-content-blocks.js 8521 8522 8523 8524 8525 8526 const POST_CONTENT_BLOCK_TYPES = [ 8527 "core/post-title", 8528 "core/post-featured-image", 8529 "core/post-content" 8530 ]; 8531 function usePostContentBlocks() { 8532 const contentOnlyBlockTypes = (0,external_wp_element_namespaceObject.useMemo)( 8533 () => [ 8534 ...(0,external_wp_hooks_namespaceObject.applyFilters)( 8535 "editor.postContentBlockTypes", 8536 POST_CONTENT_BLOCK_TYPES 8537 ) 8538 ], 8539 [] 8540 ); 8541 const contentOnlyIds = (0,external_wp_data_namespaceObject.useSelect)( 8542 (select) => { 8543 const { getPostBlocksByName } = unlock(select(store_store)); 8544 return getPostBlocksByName(contentOnlyBlockTypes); 8545 }, 8546 [contentOnlyBlockTypes] 8547 ); 8548 return contentOnlyIds; 8549 } 8550 8551 8552 ;// ./node_modules/@wordpress/editor/build-module/components/provider/disable-non-page-content-blocks.js 8553 8554 8555 8556 8557 function DisableNonPageContentBlocks() { 8558 const contentOnlyIds = usePostContentBlocks(); 8559 const { templateParts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 8560 const { getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); 8561 return { 8562 templateParts: getBlocksByName("core/template-part") 8563 }; 8564 }, []); 8565 const disabledIds = (0,external_wp_data_namespaceObject.useSelect)( 8566 (select) => { 8567 const { getBlockOrder } = select(external_wp_blockEditor_namespaceObject.store); 8568 return templateParts.flatMap( 8569 (clientId) => getBlockOrder(clientId) 8570 ); 8571 }, 8572 [templateParts] 8573 ); 8574 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 8575 (0,external_wp_element_namespaceObject.useEffect)(() => { 8576 const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 8577 setBlockEditingMode("", "disabled"); 8578 return () => { 8579 unsetBlockEditingMode(""); 8580 }; 8581 }, [registry]); 8582 (0,external_wp_element_namespaceObject.useEffect)(() => { 8583 const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 8584 registry.batch(() => { 8585 for (const clientId of contentOnlyIds) { 8586 setBlockEditingMode(clientId, "contentOnly"); 8587 } 8588 }); 8589 return () => { 8590 registry.batch(() => { 8591 for (const clientId of contentOnlyIds) { 8592 unsetBlockEditingMode(clientId); 8593 } 8594 }); 8595 }; 8596 }, [contentOnlyIds, registry]); 8597 (0,external_wp_element_namespaceObject.useEffect)(() => { 8598 const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 8599 registry.batch(() => { 8600 for (const clientId of templateParts) { 8601 setBlockEditingMode(clientId, "contentOnly"); 8602 } 8603 }); 8604 return () => { 8605 registry.batch(() => { 8606 for (const clientId of templateParts) { 8607 unsetBlockEditingMode(clientId); 8608 } 8609 }); 8610 }; 8611 }, [templateParts, registry]); 8612 (0,external_wp_element_namespaceObject.useEffect)(() => { 8613 const { setBlockEditingMode, unsetBlockEditingMode } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 8614 registry.batch(() => { 8615 for (const clientId of disabledIds) { 8616 setBlockEditingMode(clientId, "disabled"); 8617 } 8618 }); 8619 return () => { 8620 registry.batch(() => { 8621 for (const clientId of disabledIds) { 8622 unsetBlockEditingMode(clientId); 8623 } 8624 }); 8625 }; 8626 }, [disabledIds, registry]); 8627 return null; 8628 } 8629 8630 8631 ;// ./node_modules/@wordpress/editor/build-module/components/provider/navigation-block-editing-mode.js 8632 8633 8634 8635 function NavigationBlockEditingMode() { 8636 const blockClientId = (0,external_wp_data_namespaceObject.useSelect)( 8637 (select) => select(external_wp_blockEditor_namespaceObject.store).getBlockOrder()?.[0], 8638 [] 8639 ); 8640 const { setBlockEditingMode, unsetBlockEditingMode } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 8641 (0,external_wp_element_namespaceObject.useEffect)(() => { 8642 if (!blockClientId) { 8643 return; 8644 } 8645 setBlockEditingMode(blockClientId, "contentOnly"); 8646 return () => { 8647 unsetBlockEditingMode(blockClientId); 8648 }; 8649 }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]); 8650 } 8651 8652 8653 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-hide-blocks-from-inserter.js 8654 8655 8656 const POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART = [ 8657 "wp_block", 8658 "wp_template", 8659 "wp_template_part" 8660 ]; 8661 function useHideBlocksFromInserter(postType, mode) { 8662 (0,external_wp_element_namespaceObject.useEffect)(() => { 8663 (0,external_wp_hooks_namespaceObject.addFilter)( 8664 "blockEditor.__unstableCanInsertBlockType", 8665 "removeTemplatePartsFromInserter", 8666 (canInsert, blockType) => { 8667 if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes( 8668 postType 8669 ) && blockType.name === "core/template-part" && mode === "post-only") { 8670 return false; 8671 } 8672 return canInsert; 8673 } 8674 ); 8675 (0,external_wp_hooks_namespaceObject.addFilter)( 8676 "blockEditor.__unstableCanInsertBlockType", 8677 "removePostContentFromInserter", 8678 (canInsert, blockType, rootClientId, { getBlockParentsByBlockName }) => { 8679 if (!POST_TYPES_ALLOWING_POST_CONTENT_TEMPLATE_PART.includes( 8680 postType 8681 ) && blockType.name === "core/post-content") { 8682 return getBlockParentsByBlockName(rootClientId, "core/query").length > 0; 8683 } 8684 return canInsert; 8685 } 8686 ); 8687 return () => { 8688 (0,external_wp_hooks_namespaceObject.removeFilter)( 8689 "blockEditor.__unstableCanInsertBlockType", 8690 "removeTemplatePartsFromInserter" 8691 ); 8692 (0,external_wp_hooks_namespaceObject.removeFilter)( 8693 "blockEditor.__unstableCanInsertBlockType", 8694 "removePostContentFromInserter" 8695 ); 8696 }; 8697 }, [postType, mode]); 8698 } 8699 8700 8701 ;// ./node_modules/@wordpress/icons/build-module/library/keyboard.js 8702 8703 8704 var keyboard_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 8705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" }), 8706 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" }) 8707 ] }); 8708 8709 8710 ;// ./node_modules/@wordpress/icons/build-module/library/list-view.js 8711 8712 8713 var list_view_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); 8714 8715 8716 ;// ./node_modules/@wordpress/icons/build-module/library/code.js 8717 8718 8719 var code_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) }); 8720 8721 8722 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-left.js 8723 8724 8725 var drawer_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8726 external_wp_primitives_namespaceObject.Path, 8727 { 8728 fillRule: "evenodd", 8729 clipRule: "evenodd", 8730 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" 8731 } 8732 ) }); 8733 8734 8735 ;// ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 8736 8737 8738 var drawer_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8739 external_wp_primitives_namespaceObject.Path, 8740 { 8741 fillRule: "evenodd", 8742 clipRule: "evenodd", 8743 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" 8744 } 8745 ) }); 8746 8747 8748 ;// ./node_modules/@wordpress/icons/build-module/library/block-default.js 8749 8750 8751 var block_default_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); 8752 8753 8754 ;// ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 8755 8756 8757 var format_list_bullets_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); 8758 8759 8760 ;// ./node_modules/@wordpress/icons/build-module/library/pencil.js 8761 8762 8763 var pencil_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 8764 8765 8766 ;// ./node_modules/@wordpress/icons/build-module/library/symbol.js 8767 8768 8769 var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) }); 8770 8771 8772 ;// ./node_modules/@wordpress/icons/build-module/library/page.js 8773 8774 8775 var page_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 8776 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), 8777 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" }) 8778 ] }); 8779 8780 8781 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-right.js 8782 8783 8784 var rotate_right_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" }) }); 8785 8786 8787 ;// ./node_modules/@wordpress/icons/build-module/library/rotate-left.js 8788 8789 8790 var rotate_left_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z" }) }); 8791 8792 8793 ;// external ["wp","commands"] 8794 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 8795 ;// ./node_modules/@wordpress/icons/build-module/library/star-filled.js 8796 8797 8798 var star_filled_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); 8799 8800 8801 ;// ./node_modules/@wordpress/icons/build-module/library/star-empty.js 8802 8803 8804 var star_empty_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 8805 external_wp_primitives_namespaceObject.Path, 8806 { 8807 fillRule: "evenodd", 8808 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", 8809 clipRule: "evenodd" 8810 } 8811 ) }); 8812 8813 8814 ;// external ["wp","viewport"] 8815 const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; 8816 ;// external ["wp","plugins"] 8817 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 8818 ;// ./node_modules/@wordpress/icons/build-module/library/close-small.js 8819 8820 8821 var close_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); 8822 8823 8824 ;// ./node_modules/@wordpress/interface/build-module/store/deprecated.js 8825 8826 function normalizeComplementaryAreaScope(scope) { 8827 if (["core/edit-post", "core/edit-site"].includes(scope)) { 8828 external_wp_deprecated_default()(`$scope} interface scope`, { 8829 alternative: "core interface scope", 8830 hint: "core/edit-post and core/edit-site are merging.", 8831 version: "6.6" 8832 }); 8833 return "core"; 8834 } 8835 return scope; 8836 } 8837 function normalizeComplementaryAreaName(scope, name) { 8838 if (scope === "core" && name === "edit-site/template") { 8839 external_wp_deprecated_default()(`edit-site/template sidebar`, { 8840 alternative: "edit-post/document", 8841 version: "6.6" 8842 }); 8843 return "edit-post/document"; 8844 } 8845 if (scope === "core" && name === "edit-site/block-inspector") { 8846 external_wp_deprecated_default()(`edit-site/block-inspector sidebar`, { 8847 alternative: "edit-post/block", 8848 version: "6.6" 8849 }); 8850 return "edit-post/block"; 8851 } 8852 return name; 8853 } 8854 8855 8856 ;// ./node_modules/@wordpress/interface/build-module/store/actions.js 8857 8858 8859 8860 const setDefaultComplementaryArea = (scope, area) => { 8861 scope = normalizeComplementaryAreaScope(scope); 8862 area = normalizeComplementaryAreaName(scope, area); 8863 return { 8864 type: "SET_DEFAULT_COMPLEMENTARY_AREA", 8865 scope, 8866 area 8867 }; 8868 }; 8869 const enableComplementaryArea = (scope, area) => ({ registry, dispatch }) => { 8870 if (!area) { 8871 return; 8872 } 8873 scope = normalizeComplementaryAreaScope(scope); 8874 area = normalizeComplementaryAreaName(scope, area); 8875 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "isComplementaryAreaVisible"); 8876 if (!isComplementaryAreaVisible) { 8877 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "isComplementaryAreaVisible", true); 8878 } 8879 dispatch({ 8880 type: "ENABLE_COMPLEMENTARY_AREA", 8881 scope, 8882 area 8883 }); 8884 }; 8885 const disableComplementaryArea = (scope) => ({ registry }) => { 8886 scope = normalizeComplementaryAreaScope(scope); 8887 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "isComplementaryAreaVisible"); 8888 if (isComplementaryAreaVisible) { 8889 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "isComplementaryAreaVisible", false); 8890 } 8891 }; 8892 const pinItem = (scope, item) => ({ registry }) => { 8893 if (!item) { 8894 return; 8895 } 8896 scope = normalizeComplementaryAreaScope(scope); 8897 item = normalizeComplementaryAreaName(scope, item); 8898 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "pinnedItems"); 8899 if (pinnedItems?.[item] === true) { 8900 return; 8901 } 8902 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "pinnedItems", { 8903 ...pinnedItems, 8904 [item]: true 8905 }); 8906 }; 8907 const unpinItem = (scope, item) => ({ registry }) => { 8908 if (!item) { 8909 return; 8910 } 8911 scope = normalizeComplementaryAreaScope(scope); 8912 item = normalizeComplementaryAreaName(scope, item); 8913 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, "pinnedItems"); 8914 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, "pinnedItems", { 8915 ...pinnedItems, 8916 [item]: false 8917 }); 8918 }; 8919 function toggleFeature(scope, featureName) { 8920 return function({ registry }) { 8921 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { 8922 since: "6.0", 8923 alternative: `dispatch( 'core/preferences' ).toggle` 8924 }); 8925 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 8926 }; 8927 } 8928 function setFeatureValue(scope, featureName, value) { 8929 return function({ registry }) { 8930 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { 8931 since: "6.0", 8932 alternative: `dispatch( 'core/preferences' ).set` 8933 }); 8934 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 8935 }; 8936 } 8937 function setFeatureDefaults(scope, defaults) { 8938 return function({ registry }) { 8939 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { 8940 since: "6.0", 8941 alternative: `dispatch( 'core/preferences' ).setDefaults` 8942 }); 8943 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 8944 }; 8945 } 8946 function openModal(name) { 8947 return { 8948 type: "OPEN_MODAL", 8949 name 8950 }; 8951 } 8952 function closeModal() { 8953 return { 8954 type: "CLOSE_MODAL" 8955 }; 8956 } 8957 8958 8959 ;// ./node_modules/@wordpress/interface/build-module/store/selectors.js 8960 8961 8962 8963 8964 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)( 8965 (select) => (state, scope) => { 8966 scope = normalizeComplementaryAreaScope(scope); 8967 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get( 8968 scope, 8969 "isComplementaryAreaVisible" 8970 ); 8971 if (isComplementaryAreaVisible === void 0) { 8972 return void 0; 8973 } 8974 if (isComplementaryAreaVisible === false) { 8975 return null; 8976 } 8977 return state?.complementaryAreas?.[scope]; 8978 } 8979 ); 8980 const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)( 8981 (select) => (state, scope) => { 8982 scope = normalizeComplementaryAreaScope(scope); 8983 const isVisible = select(external_wp_preferences_namespaceObject.store).get( 8984 scope, 8985 "isComplementaryAreaVisible" 8986 ); 8987 const identifier = state?.complementaryAreas?.[scope]; 8988 return isVisible && identifier === void 0; 8989 } 8990 ); 8991 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)( 8992 (select) => (state, scope, item) => { 8993 scope = normalizeComplementaryAreaScope(scope); 8994 item = normalizeComplementaryAreaName(scope, item); 8995 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get( 8996 scope, 8997 "pinnedItems" 8998 ); 8999 return pinnedItems?.[item] ?? true; 9000 } 9001 ); 9002 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)( 9003 (select) => (state, scope, featureName) => { 9004 external_wp_deprecated_default()( 9005 `select( 'core/interface' ).isFeatureActive( scope, featureName )`, 9006 { 9007 since: "6.0", 9008 alternative: `select( 'core/preferences' ).get( scope, featureName )` 9009 } 9010 ); 9011 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 9012 } 9013 ); 9014 function isModalActive(state, modalName) { 9015 return state.activeModal === modalName; 9016 } 9017 9018 9019 ;// ./node_modules/@wordpress/interface/build-module/store/reducer.js 9020 9021 function complementaryAreas(state = {}, action) { 9022 switch (action.type) { 9023 case "SET_DEFAULT_COMPLEMENTARY_AREA": { 9024 const { scope, area } = action; 9025 if (state[scope]) { 9026 return state; 9027 } 9028 return { 9029 ...state, 9030 [scope]: area 9031 }; 9032 } 9033 case "ENABLE_COMPLEMENTARY_AREA": { 9034 const { scope, area } = action; 9035 return { 9036 ...state, 9037 [scope]: area 9038 }; 9039 } 9040 } 9041 return state; 9042 } 9043 function activeModal(state = null, action) { 9044 switch (action.type) { 9045 case "OPEN_MODAL": 9046 return action.name; 9047 case "CLOSE_MODAL": 9048 return null; 9049 } 9050 return state; 9051 } 9052 var store_reducer_reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({ 9053 complementaryAreas, 9054 activeModal 9055 }); 9056 9057 9058 ;// ./node_modules/@wordpress/interface/build-module/store/constants.js 9059 const constants_STORE_NAME = "core/interface"; 9060 9061 9062 ;// ./node_modules/@wordpress/interface/build-module/store/index.js 9063 9064 9065 9066 9067 9068 const store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 9069 reducer: store_reducer_reducer_default, 9070 actions: store_actions_namespaceObject, 9071 selectors: store_selectors_namespaceObject 9072 }); 9073 (0,external_wp_data_namespaceObject.register)(store); 9074 9075 9076 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js 9077 9078 9079 9080 9081 9082 function roleSupportsCheckedState(role) { 9083 return [ 9084 "checkbox", 9085 "option", 9086 "radio", 9087 "switch", 9088 "menuitemcheckbox", 9089 "menuitemradio", 9090 "treeitem" 9091 ].includes(role); 9092 } 9093 function ComplementaryAreaToggle({ 9094 as = external_wp_components_namespaceObject.Button, 9095 scope, 9096 identifier: identifierProp, 9097 icon: iconProp, 9098 selectedIcon, 9099 name, 9100 shortcut, 9101 ...props 9102 }) { 9103 const ComponentToUse = as; 9104 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 9105 const icon = iconProp || context.icon; 9106 const identifier = identifierProp || `$context.name}/$name}`; 9107 const isSelected = (0,external_wp_data_namespaceObject.useSelect)( 9108 (select) => select(store).getActiveComplementaryArea(scope) === identifier, 9109 [identifier, scope] 9110 ); 9111 const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9112 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9113 ComponentToUse, 9114 { 9115 icon: selectedIcon && isSelected ? selectedIcon : icon, 9116 "aria-controls": identifier.replace("/", ":"), 9117 "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0, 9118 onClick: () => { 9119 if (isSelected) { 9120 disableComplementaryArea(scope); 9121 } else { 9122 enableComplementaryArea(scope, identifier); 9123 } 9124 }, 9125 shortcut, 9126 ...props 9127 } 9128 ); 9129 } 9130 9131 9132 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js 9133 9134 9135 9136 9137 const ComplementaryAreaHeader = ({ 9138 children, 9139 className, 9140 toggleButtonProps 9141 }) => { 9142 const toggleButton = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps }); 9143 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9144 "div", 9145 { 9146 className: dist_clsx( 9147 "components-panel__header", 9148 "interface-complementary-area-header", 9149 className 9150 ), 9151 tabIndex: -1, 9152 children: [ 9153 children, 9154 toggleButton 9155 ] 9156 } 9157 ); 9158 }; 9159 var complementary_area_header_default = ComplementaryAreaHeader; 9160 9161 9162 ;// ./node_modules/@wordpress/interface/build-module/components/action-item/index.js 9163 9164 9165 9166 const action_item_noop = () => { 9167 }; 9168 function ActionItemSlot({ 9169 name, 9170 as: Component = external_wp_components_namespaceObject.MenuGroup, 9171 fillProps = {}, 9172 bubblesVirtually, 9173 ...props 9174 }) { 9175 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9176 external_wp_components_namespaceObject.Slot, 9177 { 9178 name, 9179 bubblesVirtually, 9180 fillProps, 9181 children: (fills) => { 9182 if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { 9183 return null; 9184 } 9185 const initializedByPlugins = []; 9186 external_wp_element_namespaceObject.Children.forEach( 9187 fills, 9188 ({ 9189 props: { __unstableExplicitMenuItem, __unstableTarget } 9190 }) => { 9191 if (__unstableTarget && __unstableExplicitMenuItem) { 9192 initializedByPlugins.push(__unstableTarget); 9193 } 9194 } 9195 ); 9196 const children = external_wp_element_namespaceObject.Children.map(fills, (child) => { 9197 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes( 9198 child.props.__unstableTarget 9199 )) { 9200 return null; 9201 } 9202 return child; 9203 }); 9204 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, { ...props, children }); 9205 } 9206 } 9207 ); 9208 } 9209 function ActionItem({ name, as: Component = external_wp_components_namespaceObject.Button, onClick, ...props }) { 9210 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name, children: ({ onClick: fpOnClick }) => { 9211 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9212 Component, 9213 { 9214 onClick: onClick || fpOnClick ? (...args) => { 9215 (onClick || action_item_noop)(...args); 9216 (fpOnClick || action_item_noop)(...args); 9217 } : void 0, 9218 ...props 9219 } 9220 ); 9221 } }); 9222 } 9223 ActionItem.Slot = ActionItemSlot; 9224 var action_item_default = ActionItem; 9225 9226 9227 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js 9228 9229 9230 9231 9232 9233 const PluginsMenuItem = ({ 9234 // Menu item is marked with unstable prop for backward compatibility. 9235 // They are removed so they don't leak to DOM elements. 9236 // @see https://github.com/WordPress/gutenberg/issues/14457 9237 __unstableExplicitMenuItem, 9238 __unstableTarget, 9239 ...restProps 9240 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ...restProps }); 9241 function ComplementaryAreaMoreMenuItem({ 9242 scope, 9243 target, 9244 __unstableExplicitMenuItem, 9245 ...props 9246 }) { 9247 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9248 ComplementaryAreaToggle, 9249 { 9250 as: (toggleProps) => { 9251 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9252 action_item_default, 9253 { 9254 __unstableExplicitMenuItem, 9255 __unstableTarget: `$scope}/$target}`, 9256 as: PluginsMenuItem, 9257 name: `$scope}/plugin-more-menu`, 9258 ...toggleProps 9259 } 9260 ); 9261 }, 9262 role: "menuitemcheckbox", 9263 selectedIcon: check_default, 9264 name: target, 9265 scope, 9266 ...props 9267 } 9268 ); 9269 } 9270 9271 9272 ;// ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js 9273 9274 9275 9276 function PinnedItems({ scope, ...props }) { 9277 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `PinnedItems/$scope}`, ...props }); 9278 } 9279 function PinnedItemsSlot({ scope, className, ...props }) { 9280 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `PinnedItems/$scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9281 "div", 9282 { 9283 className: dist_clsx( 9284 className, 9285 "interface-pinned-items" 9286 ), 9287 children: fills 9288 } 9289 ) }); 9290 } 9291 PinnedItems.Slot = PinnedItemsSlot; 9292 var pinned_items_default = PinnedItems; 9293 9294 9295 ;// ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 const ANIMATION_DURATION = 0.3; 9313 function ComplementaryAreaSlot({ scope, ...props }) { 9314 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Slot, { name: `ComplementaryArea/$scope}`, ...props }); 9315 } 9316 const SIDEBAR_WIDTH = 280; 9317 const variants = { 9318 open: { width: SIDEBAR_WIDTH }, 9319 closed: { width: 0 }, 9320 mobileOpen: { width: "100vw" } 9321 }; 9322 function ComplementaryAreaFill({ 9323 activeArea, 9324 isActive, 9325 scope, 9326 children, 9327 className, 9328 id 9329 }) { 9330 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9331 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 9332 const previousActiveArea = (0,external_wp_compose_namespaceObject.usePrevious)(activeArea); 9333 const previousIsActive = (0,external_wp_compose_namespaceObject.usePrevious)(isActive); 9334 const [, setState] = (0,external_wp_element_namespaceObject.useState)({}); 9335 (0,external_wp_element_namespaceObject.useEffect)(() => { 9336 setState({}); 9337 }, [isActive]); 9338 const transition = { 9339 type: "tween", 9340 duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, 9341 ease: [0.6, 0, 0.4, 1] 9342 }; 9343 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Fill, { name: `ComplementaryArea/$scope}`, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9344 external_wp_components_namespaceObject.__unstableMotion.div, 9345 { 9346 variants, 9347 initial: "closed", 9348 animate: isMobileViewport ? "mobileOpen" : "open", 9349 exit: "closed", 9350 transition, 9351 className: "interface-complementary-area__fill", 9352 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9353 "div", 9354 { 9355 id, 9356 className, 9357 style: { 9358 width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH 9359 }, 9360 children 9361 } 9362 ) 9363 } 9364 ) }) }); 9365 } 9366 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 9367 const previousIsSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); 9368 const shouldOpenWhenNotSmallRef = (0,external_wp_element_namespaceObject.useRef)(false); 9369 const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9370 (0,external_wp_element_namespaceObject.useEffect)(() => { 9371 if (isActive && isSmall && !previousIsSmallRef.current) { 9372 disableComplementaryArea(scope); 9373 shouldOpenWhenNotSmallRef.current = true; 9374 } else if ( 9375 // If there is a flag indicating the complementary area should be 9376 // enabled when we go from small to big window size and we are going 9377 // from a small to big window size. 9378 shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current 9379 ) { 9380 shouldOpenWhenNotSmallRef.current = false; 9381 enableComplementaryArea(scope, identifier); 9382 } else if ( 9383 // If the flag is indicating the current complementary should be 9384 // reopened but another complementary area becomes active, remove 9385 // the flag. 9386 shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier 9387 ) { 9388 shouldOpenWhenNotSmallRef.current = false; 9389 } 9390 if (isSmall !== previousIsSmallRef.current) { 9391 previousIsSmallRef.current = isSmall; 9392 } 9393 }, [ 9394 isActive, 9395 isSmall, 9396 scope, 9397 identifier, 9398 activeArea, 9399 disableComplementaryArea, 9400 enableComplementaryArea 9401 ]); 9402 } 9403 function ComplementaryArea({ 9404 children, 9405 className, 9406 closeLabel = (0,external_wp_i18n_namespaceObject.__)("Close plugin"), 9407 identifier: identifierProp, 9408 header, 9409 headerClassName, 9410 icon: iconProp, 9411 isPinnable = true, 9412 panelClassName, 9413 scope, 9414 name, 9415 title, 9416 toggleShortcut, 9417 isActiveByDefault 9418 }) { 9419 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 9420 const icon = iconProp || context.icon; 9421 const identifier = identifierProp || `$context.name}/$name}`; 9422 const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false); 9423 const { 9424 isLoading, 9425 isActive, 9426 isPinned, 9427 activeArea, 9428 isSmall, 9429 isLarge, 9430 showIconLabels 9431 } = (0,external_wp_data_namespaceObject.useSelect)( 9432 (select) => { 9433 const { 9434 getActiveComplementaryArea, 9435 isComplementaryAreaLoading, 9436 isItemPinned 9437 } = select(store); 9438 const { get } = select(external_wp_preferences_namespaceObject.store); 9439 const _activeArea = getActiveComplementaryArea(scope); 9440 return { 9441 isLoading: isComplementaryAreaLoading(scope), 9442 isActive: _activeArea === identifier, 9443 isPinned: isItemPinned(scope, identifier), 9444 activeArea: _activeArea, 9445 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch("< medium"), 9446 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch("large"), 9447 showIconLabels: get("core", "showIconLabels") 9448 }; 9449 }, 9450 [identifier, scope] 9451 ); 9452 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 9453 useAdjustComplementaryListener( 9454 scope, 9455 identifier, 9456 activeArea, 9457 isActive, 9458 isSmall 9459 ); 9460 const { 9461 enableComplementaryArea, 9462 disableComplementaryArea, 9463 pinItem, 9464 unpinItem 9465 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9466 (0,external_wp_element_namespaceObject.useEffect)(() => { 9467 if (isActiveByDefault && activeArea === void 0 && !isSmall) { 9468 enableComplementaryArea(scope, identifier); 9469 } else if (activeArea === void 0 && isSmall) { 9470 disableComplementaryArea(scope, identifier); 9471 } 9472 setIsReady(true); 9473 }, [ 9474 activeArea, 9475 isActiveByDefault, 9476 scope, 9477 identifier, 9478 isSmall, 9479 enableComplementaryArea, 9480 disableComplementaryArea 9481 ]); 9482 if (!isReady) { 9483 return; 9484 } 9485 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 9486 isPinnable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9487 ComplementaryAreaToggle, 9488 { 9489 scope, 9490 identifier, 9491 isPressed: isActive && (!showIconLabels || isLarge), 9492 "aria-expanded": isActive, 9493 "aria-disabled": isLoading, 9494 label: title, 9495 icon: showIconLabels ? check_default : icon, 9496 showTooltip: !showIconLabels, 9497 variant: showIconLabels ? "tertiary" : void 0, 9498 size: "compact", 9499 shortcut: toggleShortcut 9500 } 9501 ) }), 9502 name && isPinnable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9503 ComplementaryAreaMoreMenuItem, 9504 { 9505 target: name, 9506 scope, 9507 icon, 9508 identifier, 9509 children: title 9510 } 9511 ), 9512 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9513 ComplementaryAreaFill, 9514 { 9515 activeArea, 9516 isActive, 9517 className: dist_clsx("interface-complementary-area", className), 9518 scope, 9519 id: identifier.replace("/", ":"), 9520 children: [ 9521 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9522 complementary_area_header_default, 9523 { 9524 className: headerClassName, 9525 closeLabel, 9526 onClose: () => disableComplementaryArea(scope), 9527 toggleButtonProps: { 9528 label: closeLabel, 9529 size: "compact", 9530 shortcut: toggleShortcut, 9531 scope, 9532 identifier 9533 }, 9534 children: header || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 9535 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), 9536 isPinnable && !isMobileViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9537 external_wp_components_namespaceObject.Button, 9538 { 9539 className: "interface-complementary-area__pin-unpin-item", 9540 icon: isPinned ? star_filled_default : star_empty_default, 9541 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)("Unpin from toolbar") : (0,external_wp_i18n_namespaceObject.__)("Pin to toolbar"), 9542 onClick: () => (isPinned ? unpinItem : pinItem)( 9543 scope, 9544 identifier 9545 ), 9546 isPressed: isPinned, 9547 "aria-expanded": isPinned, 9548 size: "compact" 9549 } 9550 ) 9551 ] }) 9552 } 9553 ), 9554 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Panel, { className: panelClassName, children }) 9555 ] 9556 } 9557 ) 9558 ] }); 9559 } 9560 ComplementaryArea.Slot = ComplementaryAreaSlot; 9561 var complementary_area_default = ComplementaryArea; 9562 9563 9564 ;// ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js 9565 9566 const FullscreenMode = ({ isActive }) => { 9567 (0,external_wp_element_namespaceObject.useEffect)(() => { 9568 let isSticky = false; 9569 if (document.body.classList.contains("sticky-menu")) { 9570 isSticky = true; 9571 document.body.classList.remove("sticky-menu"); 9572 } 9573 return () => { 9574 if (isSticky) { 9575 document.body.classList.add("sticky-menu"); 9576 } 9577 }; 9578 }, []); 9579 (0,external_wp_element_namespaceObject.useEffect)(() => { 9580 if (isActive) { 9581 document.body.classList.add("is-fullscreen-mode"); 9582 } else { 9583 document.body.classList.remove("is-fullscreen-mode"); 9584 } 9585 return () => { 9586 if (isActive) { 9587 document.body.classList.remove("is-fullscreen-mode"); 9588 } 9589 }; 9590 }, [isActive]); 9591 return null; 9592 }; 9593 var fullscreen_mode_default = FullscreenMode; 9594 9595 9596 ;// ./node_modules/@wordpress/admin-ui/build-module/navigable-region/index.js 9597 9598 9599 9600 const NavigableRegion = (0,external_wp_element_namespaceObject.forwardRef)( 9601 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 9602 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9603 Tag, 9604 { 9605 ref, 9606 className: dist_clsx("admin-ui-navigable-region", className), 9607 "aria-label": ariaLabel, 9608 role: "region", 9609 tabIndex: "-1", 9610 ...props, 9611 children 9612 } 9613 ); 9614 } 9615 ); 9616 NavigableRegion.displayName = "NavigableRegion"; 9617 var navigable_region_default = NavigableRegion; 9618 9619 9620 ;// ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js 9621 9622 9623 9624 9625 9626 9627 9628 const interface_skeleton_ANIMATION_DURATION = 0.25; 9629 const commonTransition = { 9630 type: "tween", 9631 duration: interface_skeleton_ANIMATION_DURATION, 9632 ease: [0.6, 0, 0.4, 1] 9633 }; 9634 function useHTMLClass(className) { 9635 (0,external_wp_element_namespaceObject.useEffect)(() => { 9636 const element = document && document.querySelector(`html:not(.$className})`); 9637 if (!element) { 9638 return; 9639 } 9640 element.classList.toggle(className); 9641 return () => { 9642 element.classList.toggle(className); 9643 }; 9644 }, [className]); 9645 } 9646 const headerVariants = { 9647 hidden: { opacity: 1, marginTop: -60 }, 9648 visible: { opacity: 1, marginTop: 0 }, 9649 distractionFreeHover: { 9650 opacity: 1, 9651 marginTop: 0, 9652 transition: { 9653 ...commonTransition, 9654 delay: 0.2, 9655 delayChildren: 0.2 9656 } 9657 }, 9658 distractionFreeHidden: { 9659 opacity: 0, 9660 marginTop: -60 9661 }, 9662 distractionFreeDisabled: { 9663 opacity: 0, 9664 marginTop: 0, 9665 transition: { 9666 ...commonTransition, 9667 delay: 0.8, 9668 delayChildren: 0.8 9669 } 9670 } 9671 }; 9672 function InterfaceSkeleton({ 9673 isDistractionFree, 9674 footer, 9675 header, 9676 editorNotices, 9677 sidebar, 9678 secondarySidebar, 9679 content, 9680 actions, 9681 labels, 9682 className 9683 }, ref) { 9684 const [secondarySidebarResizeListener, secondarySidebarSize] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); 9685 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 9686 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 9687 const defaultTransition = { 9688 type: "tween", 9689 duration: disableMotion ? 0 : interface_skeleton_ANIMATION_DURATION, 9690 ease: [0.6, 0, 0.4, 1] 9691 }; 9692 useHTMLClass("interface-interface-skeleton__html-container"); 9693 const defaultLabels = { 9694 /* translators: accessibility text for the top bar landmark region. */ 9695 header: (0,external_wp_i18n_namespaceObject._x)("Header", "header landmark area"), 9696 /* translators: accessibility text for the content landmark region. */ 9697 body: (0,external_wp_i18n_namespaceObject.__)("Content"), 9698 /* translators: accessibility text for the secondary sidebar landmark region. */ 9699 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)("Block Library"), 9700 /* translators: accessibility text for the settings landmark region. */ 9701 sidebar: (0,external_wp_i18n_namespaceObject._x)("Settings", "settings landmark area"), 9702 /* translators: accessibility text for the publish landmark region. */ 9703 actions: (0,external_wp_i18n_namespaceObject.__)("Publish"), 9704 /* translators: accessibility text for the footer landmark region. */ 9705 footer: (0,external_wp_i18n_namespaceObject.__)("Footer") 9706 }; 9707 const mergedLabels = { ...defaultLabels, ...labels }; 9708 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9709 "div", 9710 { 9711 ref, 9712 className: dist_clsx( 9713 className, 9714 "interface-interface-skeleton", 9715 !!footer && "has-footer" 9716 ), 9717 children: [ 9718 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [ 9719 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9720 navigable_region_default, 9721 { 9722 as: external_wp_components_namespaceObject.__unstableMotion.div, 9723 className: "interface-interface-skeleton__header", 9724 "aria-label": mergedLabels.header, 9725 initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", 9726 whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible", 9727 animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible", 9728 exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", 9729 variants: headerVariants, 9730 transition: defaultTransition, 9731 children: header 9732 } 9733 ) }), 9734 isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), 9735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "interface-interface-skeleton__body", children: [ 9736 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9737 navigable_region_default, 9738 { 9739 className: "interface-interface-skeleton__secondary-sidebar", 9740 ariaLabel: mergedLabels.secondarySidebar, 9741 as: external_wp_components_namespaceObject.__unstableMotion.div, 9742 initial: "closed", 9743 animate: "open", 9744 exit: "closed", 9745 variants: { 9746 open: { width: secondarySidebarSize.width }, 9747 closed: { width: 0 } 9748 }, 9749 transition: defaultTransition, 9750 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 9751 external_wp_components_namespaceObject.__unstableMotion.div, 9752 { 9753 style: { 9754 position: "absolute", 9755 width: isMobileViewport ? "100vw" : "fit-content", 9756 height: "100%", 9757 left: 0 9758 }, 9759 variants: { 9760 open: { x: 0 }, 9761 closed: { x: "-100%" } 9762 }, 9763 transition: defaultTransition, 9764 children: [ 9765 secondarySidebarResizeListener, 9766 secondarySidebar 9767 ] 9768 } 9769 ) 9770 } 9771 ) }), 9772 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9773 navigable_region_default, 9774 { 9775 className: "interface-interface-skeleton__content", 9776 ariaLabel: mergedLabels.body, 9777 children: content 9778 } 9779 ), 9780 !!sidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9781 navigable_region_default, 9782 { 9783 className: "interface-interface-skeleton__sidebar", 9784 ariaLabel: mergedLabels.sidebar, 9785 children: sidebar 9786 } 9787 ), 9788 !!actions && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9789 navigable_region_default, 9790 { 9791 className: "interface-interface-skeleton__actions", 9792 ariaLabel: mergedLabels.actions, 9793 children: actions 9794 } 9795 ) 9796 ] }) 9797 ] }), 9798 !!footer && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9799 navigable_region_default, 9800 { 9801 className: "interface-interface-skeleton__footer", 9802 ariaLabel: mergedLabels.footer, 9803 children: footer 9804 } 9805 ) 9806 ] 9807 } 9808 ); 9809 } 9810 var interface_skeleton_default = (0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton); 9811 9812 9813 ;// ./node_modules/@wordpress/interface/build-module/components/index.js 9814 9815 9816 9817 9818 9819 9820 9821 9822 ;// ./node_modules/@wordpress/interface/build-module/index.js 9823 9824 9825 9826 9827 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-rename-modal/index.js 9828 9829 9830 9831 9832 9833 9834 9835 9836 const { RenamePatternModal } = unlock(external_wp_patterns_namespaceObject.privateApis); 9837 const modalName = "editor/pattern-rename"; 9838 function PatternRenameModal() { 9839 const { record, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 9840 const { getCurrentPostType, getCurrentPostId } = select(store_store); 9841 const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 9842 const _postType = getCurrentPostType(); 9843 return { 9844 record: getEditedEntityRecord( 9845 "postType", 9846 _postType, 9847 getCurrentPostId() 9848 ), 9849 postType: _postType 9850 }; 9851 }, []); 9852 const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9853 const isActive = (0,external_wp_data_namespaceObject.useSelect)( 9854 (select) => select(store).isModalActive(modalName) 9855 ); 9856 if (!isActive || postType !== PATTERN_POST_TYPE) { 9857 return null; 9858 } 9859 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(RenamePatternModal, { onClose: closeModal, pattern: record }); 9860 } 9861 9862 9863 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-duplicate-modal/index.js 9864 9865 9866 9867 9868 9869 9870 9871 9872 const { DuplicatePatternModal } = unlock(external_wp_patterns_namespaceObject.privateApis); 9873 const pattern_duplicate_modal_modalName = "editor/pattern-duplicate"; 9874 function PatternDuplicateModal() { 9875 const { record, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 9876 const { getCurrentPostType, getCurrentPostId } = select(store_store); 9877 const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 9878 const _postType = getCurrentPostType(); 9879 return { 9880 record: getEditedEntityRecord( 9881 "postType", 9882 _postType, 9883 getCurrentPostId() 9884 ), 9885 postType: _postType 9886 }; 9887 }, []); 9888 const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9889 const isActive = (0,external_wp_data_namespaceObject.useSelect)( 9890 (select) => select(store).isModalActive(pattern_duplicate_modal_modalName) 9891 ); 9892 if (!isActive || postType !== PATTERN_POST_TYPE) { 9893 return null; 9894 } 9895 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 9896 DuplicatePatternModal, 9897 { 9898 onClose: closeModal, 9899 onSuccess: () => closeModal(), 9900 pattern: record 9901 } 9902 ); 9903 } 9904 9905 9906 ;// ./node_modules/@wordpress/editor/build-module/components/commands/index.js 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 const getEditorCommandLoader = () => function useEditorCommandLoader() { 9924 const { 9925 editorMode, 9926 isListViewOpen, 9927 showBlockBreadcrumbs, 9928 isDistractionFree, 9929 isFocusMode, 9930 isPreviewMode, 9931 isViewable, 9932 isCodeEditingEnabled, 9933 isRichEditingEnabled, 9934 isPublishSidebarEnabled 9935 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 9936 const { get } = select(external_wp_preferences_namespaceObject.store); 9937 const { isListViewOpened, getCurrentPostType, getEditorSettings } = select(store_store); 9938 const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); 9939 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 9940 return { 9941 editorMode: get("core", "editorMode") ?? "visual", 9942 isListViewOpen: isListViewOpened(), 9943 showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"), 9944 isDistractionFree: get("core", "distractionFree"), 9945 isFocusMode: get("core", "focusMode"), 9946 isPreviewMode: getSettings().isPreviewMode, 9947 isViewable: getPostType(getCurrentPostType())?.viewable ?? false, 9948 isCodeEditingEnabled: getEditorSettings().codeEditingEnabled, 9949 isRichEditingEnabled: getEditorSettings().richEditingEnabled, 9950 isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled() 9951 }; 9952 }, []); 9953 const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); 9954 const { toggle } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 9955 const { createInfoNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 9956 const { 9957 __unstableSaveForPreview, 9958 setIsListViewOpened, 9959 switchEditorMode, 9960 toggleDistractionFree, 9961 toggleSpotlightMode, 9962 toggleTopToolbar 9963 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 9964 const { openModal, enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 9965 const { getCurrentPostId } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 9966 const allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled; 9967 if (isPreviewMode) { 9968 return { commands: [], isLoading: false }; 9969 } 9970 const commands = []; 9971 commands.push({ 9972 name: "core/open-shortcut-help", 9973 label: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts"), 9974 icon: keyboard_default, 9975 callback: ({ close }) => { 9976 close(); 9977 openModal("editor/keyboard-shortcut-help"); 9978 } 9979 }); 9980 commands.push({ 9981 name: "core/toggle-distraction-free", 9982 label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)("Exit Distraction free") : (0,external_wp_i18n_namespaceObject.__)("Enter Distraction free"), 9983 callback: ({ close }) => { 9984 toggleDistractionFree(); 9985 close(); 9986 } 9987 }); 9988 commands.push({ 9989 name: "core/open-preferences", 9990 label: (0,external_wp_i18n_namespaceObject.__)("Editor preferences"), 9991 callback: ({ close }) => { 9992 close(); 9993 openModal("editor/preferences"); 9994 } 9995 }); 9996 commands.push({ 9997 name: "core/toggle-spotlight-mode", 9998 label: isFocusMode ? (0,external_wp_i18n_namespaceObject.__)("Exit Spotlight mode") : (0,external_wp_i18n_namespaceObject.__)("Enter Spotlight mode"), 9999 callback: ({ close }) => { 10000 toggleSpotlightMode(); 10001 close(); 10002 } 10003 }); 10004 commands.push({ 10005 name: "core/toggle-list-view", 10006 label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)("Close List View") : (0,external_wp_i18n_namespaceObject.__)("Open List View"), 10007 icon: list_view_default, 10008 callback: ({ close }) => { 10009 setIsListViewOpened(!isListViewOpen); 10010 close(); 10011 createInfoNotice( 10012 isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)("List View off.") : (0,external_wp_i18n_namespaceObject.__)("List View on."), 10013 { 10014 id: "core/editor/toggle-list-view/notice", 10015 type: "snackbar" 10016 } 10017 ); 10018 } 10019 }); 10020 commands.push({ 10021 name: "core/toggle-top-toolbar", 10022 label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar"), 10023 callback: ({ close }) => { 10024 toggleTopToolbar(); 10025 close(); 10026 } 10027 }); 10028 if (allowSwitchEditorMode) { 10029 commands.push({ 10030 name: "core/toggle-code-editor", 10031 label: editorMode === "visual" ? (0,external_wp_i18n_namespaceObject.__)("Open code editor") : (0,external_wp_i18n_namespaceObject.__)("Exit code editor"), 10032 icon: code_default, 10033 callback: ({ close }) => { 10034 switchEditorMode( 10035 editorMode === "visual" ? "text" : "visual" 10036 ); 10037 close(); 10038 } 10039 }); 10040 } 10041 commands.push({ 10042 name: "core/toggle-breadcrumbs", 10043 label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)("Hide block breadcrumbs") : (0,external_wp_i18n_namespaceObject.__)("Show block breadcrumbs"), 10044 callback: ({ close }) => { 10045 toggle("core", "showBlockBreadcrumbs"); 10046 close(); 10047 createInfoNotice( 10048 showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)("Breadcrumbs hidden.") : (0,external_wp_i18n_namespaceObject.__)("Breadcrumbs visible."), 10049 { 10050 id: "core/editor/toggle-breadcrumbs/notice", 10051 type: "snackbar" 10052 } 10053 ); 10054 } 10055 }); 10056 commands.push({ 10057 name: "core/open-settings-sidebar", 10058 label: (0,external_wp_i18n_namespaceObject.__)("Show or hide the Settings panel"), 10059 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left_default : drawer_right_default, 10060 callback: ({ close }) => { 10061 const activeSidebar = getActiveComplementaryArea("core"); 10062 close(); 10063 if (activeSidebar === "edit-post/document") { 10064 disableComplementaryArea("core"); 10065 } else { 10066 enableComplementaryArea("core", "edit-post/document"); 10067 } 10068 } 10069 }); 10070 commands.push({ 10071 name: "core/open-block-inspector", 10072 label: (0,external_wp_i18n_namespaceObject.__)("Show or hide the Block settings panel"), 10073 icon: block_default_default, 10074 callback: ({ close }) => { 10075 const activeSidebar = getActiveComplementaryArea("core"); 10076 close(); 10077 if (activeSidebar === "edit-post/block") { 10078 disableComplementaryArea("core"); 10079 } else { 10080 enableComplementaryArea("core", "edit-post/block"); 10081 } 10082 } 10083 }); 10084 commands.push({ 10085 name: "core/toggle-publish-sidebar", 10086 label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)("Disable pre-publish checks") : (0,external_wp_i18n_namespaceObject.__)("Enable pre-publish checks"), 10087 icon: format_list_bullets_default, 10088 callback: ({ close }) => { 10089 close(); 10090 toggle("core", "isPublishSidebarEnabled"); 10091 createInfoNotice( 10092 isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)("Pre-publish checks disabled.") : (0,external_wp_i18n_namespaceObject.__)("Pre-publish checks enabled."), 10093 { 10094 id: "core/editor/publish-sidebar/notice", 10095 type: "snackbar" 10096 } 10097 ); 10098 } 10099 }); 10100 if (isViewable) { 10101 commands.push({ 10102 name: "core/preview-link", 10103 label: (0,external_wp_i18n_namespaceObject.__)("Preview in a new tab"), 10104 icon: external_default, 10105 callback: async ({ close }) => { 10106 close(); 10107 const postId = getCurrentPostId(); 10108 const link = await __unstableSaveForPreview(); 10109 window.open(link, `wp-preview-$postId}`); 10110 } 10111 }); 10112 } 10113 return { 10114 commands, 10115 isLoading: false 10116 }; 10117 }; 10118 const getEditedEntityContextualCommands = () => function useEditedEntityContextualCommands() { 10119 const { postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 10120 const { getCurrentPostType } = select(store_store); 10121 return { 10122 postType: getCurrentPostType() 10123 }; 10124 }, []); 10125 const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10126 const commands = []; 10127 if (postType === PATTERN_POST_TYPE) { 10128 commands.push({ 10129 name: "core/rename-pattern", 10130 label: (0,external_wp_i18n_namespaceObject.__)("Rename pattern"), 10131 icon: pencil_default, 10132 callback: ({ close }) => { 10133 openModal(modalName); 10134 close(); 10135 } 10136 }); 10137 commands.push({ 10138 name: "core/duplicate-pattern", 10139 label: (0,external_wp_i18n_namespaceObject.__)("Duplicate pattern"), 10140 icon: symbol_default, 10141 callback: ({ close }) => { 10142 openModal(pattern_duplicate_modal_modalName); 10143 close(); 10144 } 10145 }); 10146 } 10147 return { isLoading: false, commands }; 10148 }; 10149 const getPageContentFocusCommands = () => function usePageContentFocusCommands() { 10150 const { onNavigateToEntityRecord, goBack, templateId, isPreviewMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 10151 const { 10152 getRenderingMode, 10153 getEditorSettings: _getEditorSettings, 10154 getCurrentTemplateId 10155 } = unlock(select(store_store)); 10156 const editorSettings = _getEditorSettings(); 10157 return { 10158 isTemplateHidden: getRenderingMode() === "post-only", 10159 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 10160 getEditorSettings: _getEditorSettings, 10161 goBack: editorSettings.onNavigateToPreviousEntityRecord, 10162 templateId: getCurrentTemplateId(), 10163 isPreviewMode: editorSettings.isPreviewMode 10164 }; 10165 }, []); 10166 const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( 10167 "postType", 10168 "wp_template", 10169 templateId 10170 ); 10171 if (isPreviewMode) { 10172 return { isLoading: false, commands: [] }; 10173 } 10174 const commands = []; 10175 if (templateId && hasResolved) { 10176 commands.push({ 10177 name: "core/switch-to-template-focus", 10178 label: (0,external_wp_i18n_namespaceObject.sprintf)( 10179 /* translators: %s: template title */ 10180 (0,external_wp_i18n_namespaceObject.__)("Edit template: %s"), 10181 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title) 10182 ), 10183 icon: layout_default, 10184 callback: ({ close }) => { 10185 onNavigateToEntityRecord({ 10186 postId: templateId, 10187 postType: "wp_template" 10188 }); 10189 close(); 10190 } 10191 }); 10192 } 10193 if (!!goBack) { 10194 commands.push({ 10195 name: "core/switch-to-previous-entity", 10196 label: (0,external_wp_i18n_namespaceObject.__)("Go back"), 10197 icon: page_default, 10198 callback: ({ close }) => { 10199 goBack(); 10200 close(); 10201 } 10202 }); 10203 } 10204 return { isLoading: false, commands }; 10205 }; 10206 const getManipulateDocumentCommands = () => function useManipulateDocumentCommands() { 10207 const { postType, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 10208 const { getCurrentPostId, getCurrentPostType } = select(store_store); 10209 return { 10210 postType: getCurrentPostType(), 10211 postId: getCurrentPostId() 10212 }; 10213 }, []); 10214 const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( 10215 "postType", 10216 postType, 10217 postId 10218 ); 10219 const { revertTemplate } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 10220 if (!hasResolved || ![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes( 10221 postType 10222 )) { 10223 return { isLoading: true, commands: [] }; 10224 } 10225 const commands = []; 10226 if (isTemplateRevertable(template)) { 10227 const label = template.type === TEMPLATE_POST_TYPE ? (0,external_wp_i18n_namespaceObject.sprintf)( 10228 /* translators: %s: template title */ 10229 (0,external_wp_i18n_namespaceObject.__)("Reset template: %s"), 10230 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title) 10231 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 10232 /* translators: %s: template part title */ 10233 (0,external_wp_i18n_namespaceObject.__)("Reset template part: %s"), 10234 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title) 10235 ); 10236 commands.push({ 10237 name: "core/reset-template", 10238 label, 10239 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? rotate_right_default : rotate_left_default, 10240 callback: ({ close }) => { 10241 revertTemplate(template); 10242 close(); 10243 } 10244 }); 10245 } 10246 return { 10247 isLoading: !hasResolved, 10248 commands 10249 }; 10250 }; 10251 function useCommands() { 10252 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 10253 name: "core/editor/edit-ui", 10254 hook: getEditorCommandLoader() 10255 }); 10256 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 10257 name: "core/editor/contextual-commands", 10258 hook: getEditedEntityContextualCommands(), 10259 context: "entity-edit" 10260 }); 10261 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 10262 name: "core/editor/page-content-focus", 10263 hook: getPageContentFocusCommands(), 10264 context: "entity-edit" 10265 }); 10266 (0,external_wp_commands_namespaceObject.useCommandLoader)({ 10267 name: "core/edit-site/manipulate-document", 10268 hook: getManipulateDocumentCommands() 10269 }); 10270 } 10271 10272 10273 ;// ./node_modules/@wordpress/editor/build-module/components/block-removal-warnings/index.js 10274 10275 10276 10277 10278 10279 10280 10281 const { BlockRemovalWarningModal } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 10282 const TEMPLATE_BLOCKS = [ 10283 "core/post-content", 10284 "core/post-template", 10285 "core/query" 10286 ]; 10287 const BLOCK_REMOVAL_RULES = [ 10288 { 10289 // Template blocks. 10290 // The warning is only shown when a user manipulates templates or template parts. 10291 postTypes: ["wp_template", "wp_template_part"], 10292 callback(removedBlocks) { 10293 const removedTemplateBlocks = removedBlocks.filter( 10294 ({ name }) => TEMPLATE_BLOCKS.includes(name) 10295 ); 10296 if (removedTemplateBlocks.length) { 10297 return (0,external_wp_i18n_namespaceObject._n)( 10298 "Deleting this block will stop your post or page content from displaying on this template. It is not recommended.", 10299 "Some of the deleted blocks will stop your post or page content from displaying on this template. It is not recommended.", 10300 removedBlocks.length 10301 ); 10302 } 10303 } 10304 }, 10305 { 10306 // Pattern overrides. 10307 // The warning is only shown when the user edits a pattern. 10308 postTypes: ["wp_block"], 10309 callback(removedBlocks) { 10310 const removedBlocksWithOverrides = removedBlocks.filter( 10311 ({ attributes }) => attributes?.metadata?.bindings && Object.values(attributes.metadata.bindings).some( 10312 (binding) => binding.source === "core/pattern-overrides" 10313 ) 10314 ); 10315 if (removedBlocksWithOverrides.length) { 10316 return (0,external_wp_i18n_namespaceObject._n)( 10317 "The deleted block allows instance overrides. Removing it may result in content not displaying where this pattern is used. Are you sure you want to proceed?", 10318 "Some of the deleted blocks allow instance overrides. Removing them may result in content not displaying where this pattern is used. Are you sure you want to proceed?", 10319 removedBlocks.length 10320 ); 10321 } 10322 } 10323 } 10324 ]; 10325 function BlockRemovalWarnings() { 10326 const currentPostType = (0,external_wp_data_namespaceObject.useSelect)( 10327 (select) => select(store_store).getCurrentPostType(), 10328 [] 10329 ); 10330 const removalRulesForPostType = (0,external_wp_element_namespaceObject.useMemo)( 10331 () => BLOCK_REMOVAL_RULES.filter( 10332 (rule) => rule.postTypes.includes(currentPostType) 10333 ), 10334 [currentPostType] 10335 ); 10336 if (!BlockRemovalWarningModal) { 10337 return null; 10338 } 10339 if (!removalRulesForPostType) { 10340 return null; 10341 } 10342 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarningModal, { rules: removalRulesForPostType }); 10343 } 10344 10345 10346 ;// ./node_modules/@wordpress/editor/build-module/components/start-page-options/index.js 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 function useStartPatterns() { 10360 const { blockPatternsWithPostContentBlockType, postType } = (0,external_wp_data_namespaceObject.useSelect)( 10361 (select) => { 10362 const { getPatternsByBlockTypes, getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); 10363 const { getCurrentPostType, getRenderingMode } = select(store_store); 10364 const rootClientId = getRenderingMode() === "post-only" ? "" : getBlocksByName("core/post-content")?.[0]; 10365 return { 10366 blockPatternsWithPostContentBlockType: getPatternsByBlockTypes( 10367 "core/post-content", 10368 rootClientId 10369 ), 10370 postType: getCurrentPostType() 10371 }; 10372 }, 10373 [] 10374 ); 10375 return (0,external_wp_element_namespaceObject.useMemo)(() => { 10376 if (!blockPatternsWithPostContentBlockType?.length) { 10377 return []; 10378 } 10379 return blockPatternsWithPostContentBlockType.filter((pattern) => { 10380 return postType === "page" && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType); 10381 }); 10382 }, [postType, blockPatternsWithPostContentBlockType]); 10383 } 10384 function PatternSelection({ blockPatterns, onChoosePattern }) { 10385 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 10386 const { postType, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 10387 const { getCurrentPostType, getCurrentPostId } = select(store_store); 10388 return { 10389 postType: getCurrentPostType(), 10390 postId: getCurrentPostId() 10391 }; 10392 }, []); 10393 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10394 external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, 10395 { 10396 blockPatterns, 10397 onClickPattern: (_pattern, blocks) => { 10398 editEntityRecord("postType", postType, postId, { 10399 blocks, 10400 content: ({ blocks: blocksForSerialization = [] }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization) 10401 }); 10402 onChoosePattern(); 10403 } 10404 } 10405 ); 10406 } 10407 function StartPageOptionsModal({ onClose }) { 10408 const [showStartPatterns, setShowStartPatterns] = (0,external_wp_element_namespaceObject.useState)(true); 10409 const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 10410 const startPatterns = useStartPatterns(); 10411 const hasStartPattern = startPatterns.length > 0; 10412 if (!hasStartPattern) { 10413 return null; 10414 } 10415 function handleClose() { 10416 onClose(); 10417 setPreference("core", "enableChoosePatternModal", showStartPatterns); 10418 } 10419 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 10420 external_wp_components_namespaceObject.Modal, 10421 { 10422 className: "editor-start-page-options__modal", 10423 title: (0,external_wp_i18n_namespaceObject.__)("Choose a pattern"), 10424 isFullScreen: true, 10425 onRequestClose: handleClose, 10426 children: [ 10427 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-start-page-options__modal-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10428 PatternSelection, 10429 { 10430 blockPatterns: startPatterns, 10431 onChoosePattern: handleClose 10432 } 10433 ) }), 10434 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10435 external_wp_components_namespaceObject.Flex, 10436 { 10437 className: "editor-start-page-options__modal__actions", 10438 justify: "flex-end", 10439 expanded: false, 10440 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10441 external_wp_components_namespaceObject.ToggleControl, 10442 { 10443 __nextHasNoMarginBottom: true, 10444 checked: showStartPatterns, 10445 label: (0,external_wp_i18n_namespaceObject.__)("Show starter patterns"), 10446 help: (0,external_wp_i18n_namespaceObject.__)( 10447 "Shows starter patterns when creating a new page." 10448 ), 10449 onChange: (newValue) => { 10450 setShowStartPatterns(newValue); 10451 } 10452 } 10453 ) }) 10454 } 10455 ) 10456 ] 10457 } 10458 ); 10459 } 10460 function StartPageOptions() { 10461 const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false); 10462 const { isEditedPostDirty, isEditedPostEmpty } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 10463 const { isModalActive } = (0,external_wp_data_namespaceObject.useSelect)(store); 10464 const { enabled, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 10465 const { getCurrentPostId, getCurrentPostType } = select(store_store); 10466 const choosePatternModalEnabled = select(external_wp_preferences_namespaceObject.store).get( 10467 "core", 10468 "enableChoosePatternModal" 10469 ); 10470 return { 10471 postId: getCurrentPostId(), 10472 enabled: choosePatternModalEnabled && TEMPLATE_POST_TYPE !== getCurrentPostType() 10473 }; 10474 }, []); 10475 (0,external_wp_element_namespaceObject.useEffect)(() => { 10476 const isFreshPage = !isEditedPostDirty() && isEditedPostEmpty(); 10477 const isPreferencesModalActive = isModalActive("editor/preferences"); 10478 if (!enabled || !isFreshPage || isPreferencesModalActive) { 10479 return; 10480 } 10481 setIsOpen(true); 10482 }, [ 10483 enabled, 10484 postId, 10485 isEditedPostDirty, 10486 isEditedPostEmpty, 10487 isModalActive 10488 ]); 10489 if (!isOpen) { 10490 return null; 10491 } 10492 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptionsModal, { onClose: () => setIsOpen(false) }); 10493 } 10494 10495 10496 ;// external ["wp","keyboardShortcuts"] 10497 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 10498 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/config.js 10499 10500 const textFormattingShortcuts = [ 10501 { 10502 keyCombination: { modifier: "primary", character: "b" }, 10503 description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text bold.") 10504 }, 10505 { 10506 keyCombination: { modifier: "primary", character: "i" }, 10507 description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text italic.") 10508 }, 10509 { 10510 keyCombination: { modifier: "primary", character: "k" }, 10511 description: (0,external_wp_i18n_namespaceObject.__)("Convert the selected text into a link.") 10512 }, 10513 { 10514 keyCombination: { modifier: "primaryShift", character: "k" }, 10515 description: (0,external_wp_i18n_namespaceObject.__)("Remove a link.") 10516 }, 10517 { 10518 keyCombination: { character: "[[" }, 10519 description: (0,external_wp_i18n_namespaceObject.__)("Insert a link to a post or page.") 10520 }, 10521 { 10522 keyCombination: { modifier: "primary", character: "u" }, 10523 description: (0,external_wp_i18n_namespaceObject.__)("Underline the selected text.") 10524 }, 10525 { 10526 keyCombination: { modifier: "access", character: "d" }, 10527 description: (0,external_wp_i18n_namespaceObject.__)("Strikethrough the selected text.") 10528 }, 10529 { 10530 keyCombination: { modifier: "access", character: "x" }, 10531 description: (0,external_wp_i18n_namespaceObject.__)("Make the selected text inline code.") 10532 }, 10533 { 10534 keyCombination: { 10535 modifier: "access", 10536 character: "0" 10537 }, 10538 aliases: [ 10539 { 10540 modifier: "access", 10541 character: "7" 10542 } 10543 ], 10544 description: (0,external_wp_i18n_namespaceObject.__)("Convert the current heading to a paragraph.") 10545 }, 10546 { 10547 keyCombination: { modifier: "access", character: "1-6" }, 10548 description: (0,external_wp_i18n_namespaceObject.__)( 10549 "Convert the current paragraph or heading to a heading of level 1 to 6." 10550 ) 10551 }, 10552 { 10553 keyCombination: { modifier: "primaryShift", character: "SPACE" }, 10554 description: (0,external_wp_i18n_namespaceObject.__)("Add non breaking space.") 10555 } 10556 ]; 10557 10558 10559 ;// external ["wp","keycodes"] 10560 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 10561 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/shortcut.js 10562 10563 10564 10565 function KeyCombination({ keyCombination, forceAriaLabel }) { 10566 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier]( 10567 keyCombination.character 10568 ) : keyCombination.character; 10569 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier]( 10570 keyCombination.character 10571 ) : keyCombination.character; 10572 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10573 "kbd", 10574 { 10575 className: "editor-keyboard-shortcut-help-modal__shortcut-key-combination", 10576 "aria-label": forceAriaLabel || ariaLabel, 10577 children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map( 10578 (character, index) => { 10579 if (character === "+") { 10580 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: character }, index); 10581 } 10582 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10583 "kbd", 10584 { 10585 className: "editor-keyboard-shortcut-help-modal__shortcut-key", 10586 children: character 10587 }, 10588 index 10589 ); 10590 } 10591 ) 10592 } 10593 ); 10594 } 10595 function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { 10596 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10597 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-description", children: description }), 10598 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-keyboard-shortcut-help-modal__shortcut-term", children: [ 10599 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10600 KeyCombination, 10601 { 10602 keyCombination, 10603 forceAriaLabel: ariaLabel 10604 } 10605 ), 10606 aliases.map((alias, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10607 KeyCombination, 10608 { 10609 keyCombination: alias, 10610 forceAriaLabel: ariaLabel 10611 }, 10612 index 10613 )) 10614 ] }) 10615 ] }); 10616 } 10617 var shortcut_default = Shortcut; 10618 10619 10620 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js 10621 10622 10623 10624 10625 function DynamicShortcut({ name }) { 10626 const { keyCombination, description, aliases } = (0,external_wp_data_namespaceObject.useSelect)( 10627 (select) => { 10628 const { 10629 getShortcutKeyCombination, 10630 getShortcutDescription, 10631 getShortcutAliases 10632 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 10633 return { 10634 keyCombination: getShortcutKeyCombination(name), 10635 aliases: getShortcutAliases(name), 10636 description: getShortcutDescription(name) 10637 }; 10638 }, 10639 [name] 10640 ); 10641 if (!keyCombination) { 10642 return null; 10643 } 10644 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10645 shortcut_default, 10646 { 10647 keyCombination, 10648 description, 10649 aliases 10650 } 10651 ); 10652 } 10653 var dynamic_shortcut_default = DynamicShortcut; 10654 10655 10656 ;// ./node_modules/@wordpress/editor/build-module/components/keyboard-shortcut-help-modal/index.js 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = "editor/keyboard-shortcut-help"; 10668 const ShortcutList = ({ shortcuts }) => ( 10669 /* 10670 * Disable reason: The `list` ARIA role is redundant but 10671 * Safari+VoiceOver won't announce the list otherwise. 10672 */ 10673 /* eslint-disable jsx-a11y/no-redundant-roles */ 10674 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10675 "ul", 10676 { 10677 className: "editor-keyboard-shortcut-help-modal__shortcut-list", 10678 role: "list", 10679 children: shortcuts.map((shortcut, index) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10680 "li", 10681 { 10682 className: "editor-keyboard-shortcut-help-modal__shortcut", 10683 children: typeof shortcut === "string" ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(shortcut_default, { ...shortcut }) 10684 }, 10685 index 10686 )) 10687 } 10688 ) 10689 ); 10690 const ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 10691 "section", 10692 { 10693 className: dist_clsx( 10694 "editor-keyboard-shortcut-help-modal__section", 10695 className 10696 ), 10697 children: [ 10698 !!title && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "editor-keyboard-shortcut-help-modal__section-title", children: title }), 10699 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ShortcutList, { shortcuts }) 10700 ] 10701 } 10702 ); 10703 const ShortcutCategorySection = ({ 10704 title, 10705 categoryName, 10706 additionalShortcuts = [] 10707 }) => { 10708 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)( 10709 (select) => { 10710 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts( 10711 categoryName 10712 ); 10713 }, 10714 [categoryName] 10715 ); 10716 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10717 ShortcutSection, 10718 { 10719 title, 10720 shortcuts: categoryShortcuts.concat(additionalShortcuts) 10721 } 10722 ); 10723 }; 10724 function KeyboardShortcutHelpModal() { 10725 const isModalActive = (0,external_wp_data_namespaceObject.useSelect)( 10726 (select) => select(store).isModalActive( 10727 KEYBOARD_SHORTCUT_HELP_MODAL_NAME 10728 ), 10729 [] 10730 ); 10731 const { openModal, closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); 10732 const toggleModal = () => { 10733 if (isModalActive) { 10734 closeModal(); 10735 } else { 10736 openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); 10737 } 10738 }; 10739 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/keyboard-shortcuts", toggleModal); 10740 if (!isModalActive) { 10741 return null; 10742 } 10743 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 10744 external_wp_components_namespaceObject.Modal, 10745 { 10746 className: "editor-keyboard-shortcut-help-modal", 10747 title: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts"), 10748 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close"), 10749 onRequestClose: toggleModal, 10750 children: [ 10751 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10752 ShortcutSection, 10753 { 10754 className: "editor-keyboard-shortcut-help-modal__main-shortcuts", 10755 shortcuts: ["core/editor/keyboard-shortcuts"] 10756 } 10757 ), 10758 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10759 ShortcutCategorySection, 10760 { 10761 title: (0,external_wp_i18n_namespaceObject.__)("Global shortcuts"), 10762 categoryName: "global" 10763 } 10764 ), 10765 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10766 ShortcutCategorySection, 10767 { 10768 title: (0,external_wp_i18n_namespaceObject.__)("Selection shortcuts"), 10769 categoryName: "selection" 10770 } 10771 ), 10772 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10773 ShortcutCategorySection, 10774 { 10775 title: (0,external_wp_i18n_namespaceObject.__)("Block shortcuts"), 10776 categoryName: "block", 10777 additionalShortcuts: [ 10778 { 10779 keyCombination: { character: "/" }, 10780 description: (0,external_wp_i18n_namespaceObject.__)( 10781 "Change the block type after adding a new paragraph." 10782 ), 10783 /* translators: The forward-slash character. e.g. '/'. */ 10784 ariaLabel: (0,external_wp_i18n_namespaceObject.__)("Forward-slash") 10785 } 10786 ] 10787 } 10788 ), 10789 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10790 ShortcutSection, 10791 { 10792 title: (0,external_wp_i18n_namespaceObject.__)("Text formatting"), 10793 shortcuts: textFormattingShortcuts 10794 } 10795 ), 10796 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10797 ShortcutCategorySection, 10798 { 10799 title: (0,external_wp_i18n_namespaceObject.__)("List View shortcuts"), 10800 categoryName: "list-view" 10801 } 10802 ) 10803 ] 10804 } 10805 ); 10806 } 10807 var keyboard_shortcut_help_modal_default = KeyboardShortcutHelpModal; 10808 10809 10810 ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/content-only-settings-menu.js 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 function ContentOnlySettingsMenuItems({ clientId, onClose }) { 10821 const postContentBlocks = usePostContentBlocks(); 10822 const { entity, onNavigateToEntityRecord, canEditTemplates } = (0,external_wp_data_namespaceObject.useSelect)( 10823 (select) => { 10824 const { 10825 getBlockParentsByBlockName, 10826 getSettings, 10827 getBlockAttributes, 10828 getBlockParents 10829 } = select(external_wp_blockEditor_namespaceObject.store); 10830 const { getCurrentTemplateId, getRenderingMode } = select(store_store); 10831 const patternParent = getBlockParentsByBlockName( 10832 clientId, 10833 "core/block", 10834 true 10835 )[0]; 10836 let record; 10837 if (patternParent) { 10838 record = select(external_wp_coreData_namespaceObject.store).getEntityRecord( 10839 "postType", 10840 "wp_block", 10841 getBlockAttributes(patternParent).ref 10842 ); 10843 } else if (getRenderingMode() === "template-locked" && !getBlockParents(clientId).some( 10844 (parent) => postContentBlocks.includes(parent) 10845 )) { 10846 record = select(external_wp_coreData_namespaceObject.store).getEntityRecord( 10847 "postType", 10848 "wp_template", 10849 getCurrentTemplateId() 10850 ); 10851 } 10852 if (!record) { 10853 return {}; 10854 } 10855 const _canEditTemplates = select(external_wp_coreData_namespaceObject.store).canUser("create", { 10856 kind: "postType", 10857 name: "wp_template" 10858 }); 10859 return { 10860 canEditTemplates: _canEditTemplates, 10861 entity: record, 10862 onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord 10863 }; 10864 }, 10865 [clientId, postContentBlocks] 10866 ); 10867 if (!entity) { 10868 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10869 TemplateLockContentOnlyMenuItems, 10870 { 10871 clientId, 10872 onClose 10873 } 10874 ); 10875 } 10876 const isPattern = entity.type === "wp_block"; 10877 let helpText = isPattern ? (0,external_wp_i18n_namespaceObject.__)( 10878 "Edit the pattern to move, delete, or make further changes to this block." 10879 ) : (0,external_wp_i18n_namespaceObject.__)( 10880 "Edit the template to move, delete, or make further changes to this block." 10881 ); 10882 if (!canEditTemplates) { 10883 helpText = (0,external_wp_i18n_namespaceObject.__)( 10884 "Only users with permissions to edit the template can move or delete this block" 10885 ); 10886 } 10887 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10888 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10889 external_wp_components_namespaceObject.MenuItem, 10890 { 10891 onClick: () => { 10892 onNavigateToEntityRecord({ 10893 postId: entity.id, 10894 postType: entity.type 10895 }); 10896 }, 10897 disabled: !canEditTemplates, 10898 children: isPattern ? (0,external_wp_i18n_namespaceObject.__)("Edit pattern") : (0,external_wp_i18n_namespaceObject.__)("Edit template") 10899 } 10900 ) }), 10901 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10902 external_wp_components_namespaceObject.__experimentalText, 10903 { 10904 variant: "muted", 10905 as: "p", 10906 className: "editor-content-only-settings-menu__description", 10907 children: helpText 10908 } 10909 ) 10910 ] }); 10911 } 10912 function TemplateLockContentOnlyMenuItems({ clientId, onClose }) { 10913 const { contentLockingParent } = (0,external_wp_data_namespaceObject.useSelect)( 10914 (select) => { 10915 const { getContentLockingParent } = unlock( 10916 select(external_wp_blockEditor_namespaceObject.store) 10917 ); 10918 return { 10919 contentLockingParent: getContentLockingParent(clientId) 10920 }; 10921 }, 10922 [clientId] 10923 ); 10924 const blockDisplayInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(contentLockingParent); 10925 const blockEditorActions = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 10926 if (!blockDisplayInformation?.title) { 10927 return null; 10928 } 10929 const { modifyContentLockBlock } = unlock(blockEditorActions); 10930 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 10931 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10932 external_wp_components_namespaceObject.MenuItem, 10933 { 10934 onClick: () => { 10935 modifyContentLockBlock(contentLockingParent); 10936 onClose(); 10937 }, 10938 children: (0,external_wp_i18n_namespaceObject._x)("Unlock", "Unlock content locked blocks") 10939 } 10940 ) }), 10941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10942 external_wp_components_namespaceObject.__experimentalText, 10943 { 10944 variant: "muted", 10945 as: "p", 10946 className: "editor-content-only-settings-menu__description", 10947 children: (0,external_wp_i18n_namespaceObject.__)( 10948 "Temporarily unlock the parent block to edit, delete or make further changes to this block." 10949 ) 10950 } 10951 ) 10952 ] }); 10953 } 10954 function ContentOnlySettingsMenu() { 10955 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 10956 ContentOnlySettingsMenuItems, 10957 { 10958 clientId: selectedClientIds[0], 10959 onClose 10960 } 10961 ) }); 10962 } 10963 10964 10965 ;// ./node_modules/@wordpress/editor/build-module/components/start-template-options/index.js 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 function useFallbackTemplateContent(slug, isCustom = false) { 10977 return (0,external_wp_data_namespaceObject.useSelect)( 10978 (select) => { 10979 const { getEntityRecord, getDefaultTemplateId } = select(external_wp_coreData_namespaceObject.store); 10980 const templateId = getDefaultTemplateId({ 10981 slug, 10982 is_custom: isCustom, 10983 ignore_empty: true 10984 }); 10985 return templateId ? getEntityRecord("postType", TEMPLATE_POST_TYPE, templateId)?.content?.raw : void 0; 10986 }, 10987 [slug, isCustom] 10988 ); 10989 } 10990 function start_template_options_useStartPatterns(fallbackContent) { 10991 const { slug, patterns } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 10992 const { getCurrentPostType, getCurrentPostId } = select(store_store); 10993 const { getEntityRecord, getBlockPatterns } = select(external_wp_coreData_namespaceObject.store); 10994 const postId = getCurrentPostId(); 10995 const postType = getCurrentPostType(); 10996 const record = getEntityRecord("postType", postType, postId); 10997 return { 10998 slug: record.slug, 10999 patterns: getBlockPatterns() 11000 }; 11001 }, []); 11002 const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)( 11003 (select) => select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet 11004 ); 11005 function injectThemeAttributeInBlockTemplateContent(block) { 11006 if (block.innerBlocks.find( 11007 (innerBlock) => innerBlock.name === "core/template-part" 11008 )) { 11009 block.innerBlocks = block.innerBlocks.map((innerBlock) => { 11010 if (innerBlock.name === "core/template-part" && innerBlock.attributes.theme === void 0) { 11011 innerBlock.attributes.theme = currentThemeStylesheet; 11012 } 11013 return innerBlock; 11014 }); 11015 } 11016 if (block.name === "core/template-part" && block.attributes.theme === void 0) { 11017 block.attributes.theme = currentThemeStylesheet; 11018 } 11019 return block; 11020 } 11021 return (0,external_wp_element_namespaceObject.useMemo)(() => { 11022 return [ 11023 { 11024 name: "fallback", 11025 blocks: (0,external_wp_blocks_namespaceObject.parse)(fallbackContent), 11026 title: (0,external_wp_i18n_namespaceObject.__)("Fallback content") 11027 }, 11028 ...patterns.filter((pattern) => { 11029 return Array.isArray(pattern.templateTypes) && pattern.templateTypes.some( 11030 (templateType) => slug.startsWith(templateType) 11031 ); 11032 }).map((pattern) => { 11033 return { 11034 ...pattern, 11035 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content).map( 11036 (block) => injectThemeAttributeInBlockTemplateContent(block) 11037 ) 11038 }; 11039 }) 11040 ]; 11041 }, [fallbackContent, slug, patterns]); 11042 } 11043 function start_template_options_PatternSelection({ fallbackContent, onChoosePattern, postType }) { 11044 const [, , onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)("postType", postType); 11045 const blockPatterns = start_template_options_useStartPatterns(fallbackContent); 11046 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11047 external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, 11048 { 11049 blockPatterns, 11050 onClickPattern: (pattern, blocks) => { 11051 onChange(blocks, { selection: void 0 }); 11052 onChoosePattern(); 11053 } 11054 } 11055 ); 11056 } 11057 function StartModal({ slug, isCustom, onClose, postType }) { 11058 const fallbackContent = useFallbackTemplateContent(slug, isCustom); 11059 if (!fallbackContent) { 11060 return null; 11061 } 11062 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 11063 external_wp_components_namespaceObject.Modal, 11064 { 11065 className: "editor-start-template-options__modal", 11066 title: (0,external_wp_i18n_namespaceObject.__)("Choose a pattern"), 11067 closeLabel: (0,external_wp_i18n_namespaceObject.__)("Cancel"), 11068 focusOnMount: "firstElement", 11069 onRequestClose: onClose, 11070 isFullScreen: true, 11071 children: [ 11072 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-start-template-options__modal-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11073 start_template_options_PatternSelection, 11074 { 11075 fallbackContent, 11076 slug, 11077 isCustom, 11078 postType, 11079 onChoosePattern: () => { 11080 onClose(); 11081 } 11082 } 11083 ) }), 11084 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11085 external_wp_components_namespaceObject.Flex, 11086 { 11087 className: "editor-start-template-options__modal__actions", 11088 justify: "flex-end", 11089 expanded: false, 11090 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11091 external_wp_components_namespaceObject.Button, 11092 { 11093 __next40pxDefaultSize: true, 11094 variant: "tertiary", 11095 onClick: onClose, 11096 children: (0,external_wp_i18n_namespaceObject.__)("Skip") 11097 } 11098 ) }) 11099 } 11100 ) 11101 ] 11102 } 11103 ); 11104 } 11105 function StartTemplateOptions() { 11106 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 11107 const { shouldOpenModal, slug, isCustom, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)( 11108 (select) => { 11109 const { getCurrentPostType, getCurrentPostId } = select(store_store); 11110 const _postType = getCurrentPostType(); 11111 const _postId = getCurrentPostId(); 11112 const { getEditedEntityRecord, hasEditsForEntityRecord } = select(external_wp_coreData_namespaceObject.store); 11113 const templateRecord = getEditedEntityRecord( 11114 "postType", 11115 _postType, 11116 _postId 11117 ); 11118 const hasEdits = hasEditsForEntityRecord( 11119 "postType", 11120 _postType, 11121 _postId 11122 ); 11123 return { 11124 shouldOpenModal: !hasEdits && "" === templateRecord.content && TEMPLATE_POST_TYPE === _postType, 11125 slug: templateRecord.slug, 11126 isCustom: templateRecord.is_custom, 11127 postType: _postType, 11128 postId: _postId 11129 }; 11130 }, 11131 [] 11132 ); 11133 (0,external_wp_element_namespaceObject.useEffect)(() => { 11134 setIsClosed(false); 11135 }, [postType, postId]); 11136 if (!shouldOpenModal || isClosed) { 11137 return null; 11138 } 11139 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11140 StartModal, 11141 { 11142 slug, 11143 isCustom, 11144 postType, 11145 onClose: () => setIsClosed(true) 11146 } 11147 ); 11148 } 11149 11150 11151 ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/index.js 11152 11153 11154 11155 11156 11157 function EditorKeyboardShortcuts() { 11158 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)((select) => { 11159 const { richEditingEnabled, codeEditingEnabled } = select(store_store).getEditorSettings(); 11160 return !richEditingEnabled || !codeEditingEnabled; 11161 }, []); 11162 const { getBlockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 11163 const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); 11164 const { enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 11165 const { 11166 redo, 11167 undo, 11168 savePost, 11169 setIsListViewOpened, 11170 switchEditorMode, 11171 toggleDistractionFree 11172 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 11173 const { 11174 isEditedPostDirty, 11175 isPostSavingLocked, 11176 isListViewOpened, 11177 getEditorMode 11178 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 11179 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)( 11180 "core/editor/toggle-mode", 11181 () => { 11182 switchEditorMode( 11183 getEditorMode() === "visual" ? "text" : "visual" 11184 ); 11185 }, 11186 { 11187 isDisabled: isModeToggleDisabled 11188 } 11189 ); 11190 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-distraction-free", () => { 11191 toggleDistractionFree(); 11192 }); 11193 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/undo", (event) => { 11194 undo(); 11195 event.preventDefault(); 11196 }); 11197 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/redo", (event) => { 11198 redo(); 11199 event.preventDefault(); 11200 }); 11201 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/save", (event) => { 11202 event.preventDefault(); 11203 if (isPostSavingLocked()) { 11204 return; 11205 } 11206 if (!isEditedPostDirty()) { 11207 return; 11208 } 11209 savePost(); 11210 }); 11211 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-list-view", (event) => { 11212 if (!isListViewOpened()) { 11213 event.preventDefault(); 11214 setIsListViewOpened(true); 11215 } 11216 }); 11217 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-sidebar", (event) => { 11218 event.preventDefault(); 11219 const isEditorSidebarOpened = [ 11220 "edit-post/document", 11221 "edit-post/block" 11222 ].includes(getActiveComplementaryArea("core")); 11223 if (isEditorSidebarOpened) { 11224 disableComplementaryArea("core"); 11225 } else { 11226 const sidebarToOpen = getBlockSelectionStart() ? "edit-post/block" : "edit-post/document"; 11227 enableComplementaryArea("core", sidebarToOpen); 11228 } 11229 }); 11230 return null; 11231 } 11232 11233 11234 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-regular.js 11235 11236 11237 11238 11239 11240 function ConvertToRegularBlocks({ clientId, onClose }) { 11241 const { getBlocks } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 11242 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 11243 const canRemove = (0,external_wp_data_namespaceObject.useSelect)( 11244 (select) => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), 11245 [clientId] 11246 ); 11247 if (!canRemove) { 11248 return null; 11249 } 11250 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11251 external_wp_components_namespaceObject.MenuItem, 11252 { 11253 onClick: () => { 11254 replaceBlocks(clientId, getBlocks(clientId)); 11255 onClose(); 11256 }, 11257 children: (0,external_wp_i18n_namespaceObject.__)("Detach") 11258 } 11259 ); 11260 } 11261 11262 11263 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/convert-to-template-part.js 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 function ConvertToTemplatePart({ clientIds, blocks }) { 11276 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 11277 const { replaceBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 11278 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 11279 const { isBlockBasedTheme, canCreate } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 11280 return { 11281 isBlockBasedTheme: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.is_block_theme, 11282 canCreate: select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType( 11283 "core/template-part" 11284 ) 11285 }; 11286 }, []); 11287 if (!isBlockBasedTheme || !canCreate) { 11288 return null; 11289 } 11290 const onConvert = async (templatePart) => { 11291 replaceBlocks( 11292 clientIds, 11293 (0,external_wp_blocks_namespaceObject.createBlock)("core/template-part", { 11294 slug: templatePart.slug, 11295 theme: templatePart.theme 11296 }) 11297 ); 11298 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Template part created."), { 11299 type: "snackbar" 11300 }); 11301 }; 11302 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 11303 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11304 external_wp_components_namespaceObject.MenuItem, 11305 { 11306 icon: symbol_filled_default, 11307 onClick: () => { 11308 setIsModalOpen(true); 11309 }, 11310 "aria-expanded": isModalOpen, 11311 "aria-haspopup": "dialog", 11312 children: (0,external_wp_i18n_namespaceObject.__)("Create template part") 11313 } 11314 ), 11315 isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11316 CreateTemplatePartModal, 11317 { 11318 closeModal: () => { 11319 setIsModalOpen(false); 11320 }, 11321 blocks, 11322 onCreate: onConvert 11323 } 11324 ) 11325 ] }); 11326 } 11327 11328 11329 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-menu-items/index.js 11330 11331 11332 11333 11334 11335 function TemplatePartMenuItems() { 11336 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11337 TemplatePartConverterMenuItem, 11338 { 11339 clientIds: selectedClientIds, 11340 onClose 11341 } 11342 ) }); 11343 } 11344 function TemplatePartConverterMenuItem({ clientIds, onClose }) { 11345 const { blocks } = (0,external_wp_data_namespaceObject.useSelect)( 11346 (select) => { 11347 const { getBlocksByClientId } = select(external_wp_blockEditor_namespaceObject.store); 11348 return { 11349 blocks: getBlocksByClientId(clientIds) 11350 }; 11351 }, 11352 [clientIds] 11353 ); 11354 if (blocks.length === 1 && blocks[0]?.name === "core/template-part") { 11355 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11356 ConvertToRegularBlocks, 11357 { 11358 clientId: clientIds[0], 11359 onClose 11360 } 11361 ); 11362 } 11363 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToTemplatePart, { clientIds, blocks }); 11364 } 11365 11366 11367 ;// ./node_modules/@wordpress/editor/build-module/components/provider/index.js 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 const { ExperimentalBlockEditorProvider } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11395 const { PatternsMenuItems } = unlock(external_wp_patterns_namespaceObject.privateApis); 11396 const provider_noop = () => { 11397 }; 11398 const NON_CONTEXTUAL_POST_TYPES = [ 11399 "wp_block", 11400 "wp_navigation", 11401 "wp_template_part" 11402 ]; 11403 function useBlockEditorProps(post, template, mode) { 11404 const rootLevelPost = mode === "template-locked" ? "template" : "post"; 11405 const [postBlocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)( 11406 "postType", 11407 post.type, 11408 { id: post.id } 11409 ); 11410 const [templateBlocks, onInputTemplate, onChangeTemplate] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)("postType", template?.type, { 11411 id: template?.id 11412 }); 11413 const maybeNavigationBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 11414 if (post.type === "wp_navigation") { 11415 return [ 11416 (0,external_wp_blocks_namespaceObject.createBlock)("core/navigation", { 11417 ref: post.id, 11418 // As the parent editor is locked with `templateLock`, the template locking 11419 // must be explicitly "unset" on the block itself to allow the user to modify 11420 // the block's content. 11421 templateLock: false 11422 }) 11423 ]; 11424 } 11425 }, [post.type, post.id]); 11426 const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => { 11427 if (maybeNavigationBlocks) { 11428 return maybeNavigationBlocks; 11429 } 11430 if (rootLevelPost === "template") { 11431 return templateBlocks; 11432 } 11433 return postBlocks; 11434 }, [maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks]); 11435 const disableRootLevelChanges = !!template && mode === "template-locked" || post.type === "wp_navigation"; 11436 if (disableRootLevelChanges) { 11437 return [blocks, provider_noop, provider_noop]; 11438 } 11439 return [ 11440 blocks, 11441 rootLevelPost === "post" ? onInput : onInputTemplate, 11442 rootLevelPost === "post" ? onChange : onChangeTemplate 11443 ]; 11444 } 11445 const ExperimentalEditorProvider = with_registry_provider_default( 11446 ({ 11447 post, 11448 settings, 11449 recovery, 11450 initialEdits, 11451 children, 11452 BlockEditorProviderComponent = ExperimentalBlockEditorProvider, 11453 __unstableTemplate: template 11454 }) => { 11455 const hasTemplate = !!template; 11456 const { 11457 editorSettings, 11458 selection, 11459 isReady, 11460 mode, 11461 defaultMode, 11462 postTypeEntities 11463 } = (0,external_wp_data_namespaceObject.useSelect)( 11464 (select) => { 11465 const { 11466 getEditorSettings, 11467 getEditorSelection, 11468 getRenderingMode, 11469 __unstableIsEditorReady, 11470 getDefaultRenderingMode 11471 } = unlock(select(store_store)); 11472 const { getEntitiesConfig } = select(external_wp_coreData_namespaceObject.store); 11473 const _mode = getRenderingMode(); 11474 const _defaultMode = getDefaultRenderingMode(post.type); 11475 const hasResolvedDefaultMode = _defaultMode === "template-locked" ? hasTemplate : _defaultMode !== void 0; 11476 const isRenderingModeReady = _defaultMode !== void 0; 11477 return { 11478 editorSettings: getEditorSettings(), 11479 isReady: __unstableIsEditorReady(), 11480 mode: isRenderingModeReady ? _mode : void 0, 11481 defaultMode: hasResolvedDefaultMode ? _defaultMode : void 0, 11482 selection: getEditorSelection(), 11483 postTypeEntities: post.type === "wp_template" ? getEntitiesConfig("postType") : null 11484 }; 11485 }, 11486 [post.type, hasTemplate] 11487 ); 11488 const shouldRenderTemplate = hasTemplate && mode !== "post-only"; 11489 const rootLevelPost = shouldRenderTemplate ? template : post; 11490 const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { 11491 const postContext = {}; 11492 if (post.type === "wp_template") { 11493 if (post.slug === "page") { 11494 postContext.postType = "page"; 11495 } else if (post.slug === "single") { 11496 postContext.postType = "post"; 11497 } else if (post.slug.split("-")[0] === "single") { 11498 const postTypeNames = postTypeEntities?.map((entity) => entity.name) || []; 11499 const match = post.slug.match( 11500 `^single-($postTypeNames.join("|")})(?:-.+)?$` 11501 ); 11502 if (match) { 11503 postContext.postType = match[1]; 11504 } 11505 } 11506 } else if (!NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate) { 11507 postContext.postId = post.id; 11508 postContext.postType = post.type; 11509 } 11510 return { 11511 ...postContext, 11512 templateSlug: rootLevelPost.type === "wp_template" ? rootLevelPost.slug : void 0 11513 }; 11514 }, [ 11515 shouldRenderTemplate, 11516 post.id, 11517 post.type, 11518 post.slug, 11519 rootLevelPost.type, 11520 rootLevelPost.slug, 11521 postTypeEntities 11522 ]); 11523 const { id, type } = rootLevelPost; 11524 const blockEditorSettings = use_block_editor_settings_default( 11525 editorSettings, 11526 type, 11527 id, 11528 mode 11529 ); 11530 const [blocks, onInput, onChange] = useBlockEditorProps( 11531 post, 11532 template, 11533 mode 11534 ); 11535 const { 11536 updatePostLock, 11537 setupEditor, 11538 updateEditorSettings, 11539 setCurrentTemplateId, 11540 setEditedPost, 11541 setRenderingMode 11542 } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 11543 const { createWarningNotice, removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 11544 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 11545 if (recovery) { 11546 return; 11547 } 11548 updatePostLock(settings.postLock); 11549 setupEditor(post, initialEdits, settings.template); 11550 if (settings.autosave) { 11551 createWarningNotice( 11552 (0,external_wp_i18n_namespaceObject.__)( 11553 "There is an autosave of this post that is more recent than the version below." 11554 ), 11555 { 11556 id: "autosave-exists", 11557 actions: [ 11558 { 11559 label: (0,external_wp_i18n_namespaceObject.__)("View the autosave"), 11560 url: settings.autosave.editLink 11561 } 11562 ] 11563 } 11564 ); 11565 } 11566 }, []); 11567 (0,external_wp_element_namespaceObject.useEffect)(() => { 11568 setEditedPost(post.type, post.id); 11569 removeNotice("template-activate-notice"); 11570 }, [post.type, post.id, setEditedPost, removeNotice]); 11571 (0,external_wp_element_namespaceObject.useEffect)(() => { 11572 updateEditorSettings(settings); 11573 }, [settings, updateEditorSettings]); 11574 (0,external_wp_element_namespaceObject.useEffect)(() => { 11575 setCurrentTemplateId(template?.id); 11576 }, [template?.id, setCurrentTemplateId]); 11577 (0,external_wp_element_namespaceObject.useEffect)(() => { 11578 if (defaultMode) { 11579 setRenderingMode(defaultMode); 11580 } 11581 }, [defaultMode, setRenderingMode]); 11582 useHideBlocksFromInserter(post.type, mode); 11583 useCommands(); 11584 if (!isReady || !mode) { 11585 return null; 11586 } 11587 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_coreData_namespaceObject.EntityProvider, { kind: "root", type: "site", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11588 external_wp_coreData_namespaceObject.EntityProvider, 11589 { 11590 kind: "postType", 11591 type: post.type, 11592 id: post.id, 11593 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { value: defaultBlockContext, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 11594 BlockEditorProviderComponent, 11595 { 11596 value: blocks, 11597 onChange, 11598 onInput, 11599 selection, 11600 settings: blockEditorSettings, 11601 useSubRegistry: false, 11602 children: [ 11603 children, 11604 !settings.isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 11605 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternsMenuItems, {}), 11606 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartMenuItems, {}), 11607 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ContentOnlySettingsMenu, {}), 11608 mode === "template-locked" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DisableNonPageContentBlocks, {}), 11609 type === "wp_navigation" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationBlockEditingMode, {}), 11610 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorKeyboardShortcuts, {}), 11611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcut_help_modal_default, {}), 11612 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockRemovalWarnings, {}), 11613 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StartPageOptions, {}), 11614 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(StartTemplateOptions, {}), 11615 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternRenameModal, {}), 11616 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternDuplicateModal, {}) 11617 ] }) 11618 ] 11619 } 11620 ) }) 11621 } 11622 ) }); 11623 } 11624 ); 11625 function EditorProvider(props) { 11626 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11627 ExperimentalEditorProvider, 11628 { 11629 ...props, 11630 BlockEditorProviderComponent: external_wp_blockEditor_namespaceObject.BlockEditorProvider, 11631 children: props.children 11632 } 11633 ); 11634 } 11635 var provider_default = EditorProvider; 11636 11637 11638 ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/content-preview-view.js 11639 11640 11641 11642 11643 11644 11645 11646 11647 const { useGlobalStyle } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 11648 function PostPreviewContainer({ 11649 template, 11650 post 11651 }) { 11652 const [backgroundColor = "white"] = useGlobalStyle("color.background"); 11653 const [postBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)("postType", post.type, { 11654 id: post.id 11655 }); 11656 const [templateBlocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)( 11657 "postType", 11658 template?.type, 11659 { 11660 id: template?.id 11661 } 11662 ); 11663 const blocks = template && templateBlocks ? templateBlocks : postBlocks; 11664 const isEmpty = !blocks?.length; 11665 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 11666 "div", 11667 { 11668 className: "editor-fields-content-preview", 11669 style: { 11670 backgroundColor 11671 }, 11672 children: [ 11673 isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-fields-content-preview__empty", children: (0,external_wp_i18n_namespaceObject.__)("Empty content") }), 11674 !isEmpty && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview.Async, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockPreview, { blocks }) }) 11675 ] 11676 } 11677 ); 11678 } 11679 function PostPreviewView({ item }) { 11680 const { settings, template } = (0,external_wp_data_namespaceObject.useSelect)( 11681 (select) => { 11682 const { canUser, getPostType, getTemplateId, getEntityRecord } = unlock(select(external_wp_coreData_namespaceObject.store)); 11683 const canViewTemplate = canUser("read", { 11684 kind: "postType", 11685 name: "wp_template" 11686 }); 11687 const _settings = select(store_store).getEditorSettings(); 11688 const supportsTemplateMode = _settings.supportsTemplateMode; 11689 const isViewable = getPostType(item.type)?.viewable ?? false; 11690 const templateId = supportsTemplateMode && isViewable && canViewTemplate ? getTemplateId(item.type, item.id) : null; 11691 return { 11692 settings: _settings, 11693 template: templateId ? getEntityRecord("postType", "wp_template", templateId) : void 0 11694 }; 11695 }, 11696 [item.type, item.id] 11697 ); 11698 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 11699 EditorProvider, 11700 { 11701 post: item, 11702 settings, 11703 __unstableTemplate: template, 11704 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPreviewContainer, { template, post: item }) 11705 } 11706 ); 11707 } 11708 11709 11710 ;// ./node_modules/@wordpress/editor/build-module/dataviews/fields/content-preview/index.js 11711 11712 11713 const postPreviewField = { 11714 type: "media", 11715 id: "content-preview", 11716 label: (0,external_wp_i18n_namespaceObject.__)("Content preview"), 11717 render: PostPreviewView, 11718 enableSorting: false 11719 }; 11720 var content_preview_default = postPreviewField; 11721 11722 11723 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-actions.js 11724 11725 11726 11727 11728 11729 11730 function registerEntityAction(kind, name, config) { 11731 return { 11732 type: "REGISTER_ENTITY_ACTION", 11733 kind, 11734 name, 11735 config 11736 }; 11737 } 11738 function unregisterEntityAction(kind, name, actionId) { 11739 return { 11740 type: "UNREGISTER_ENTITY_ACTION", 11741 kind, 11742 name, 11743 actionId 11744 }; 11745 } 11746 function registerEntityField(kind, name, config) { 11747 return { 11748 type: "REGISTER_ENTITY_FIELD", 11749 kind, 11750 name, 11751 config 11752 }; 11753 } 11754 function unregisterEntityField(kind, name, fieldId) { 11755 return { 11756 type: "UNREGISTER_ENTITY_FIELD", 11757 kind, 11758 name, 11759 fieldId 11760 }; 11761 } 11762 function setIsReady(kind, name) { 11763 return { 11764 type: "SET_IS_READY", 11765 kind, 11766 name 11767 }; 11768 } 11769 const registerPostTypeSchema = (postType) => async ({ registry }) => { 11770 const isReady = unlock(registry.select(store_store)).isEntityReady( 11771 "postType", 11772 postType 11773 ); 11774 if (isReady) { 11775 return; 11776 } 11777 unlock(registry.dispatch(store_store)).setIsReady( 11778 "postType", 11779 postType 11780 ); 11781 const postTypeConfig = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postType); 11782 const canCreate = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).canUser("create", { 11783 kind: "postType", 11784 name: postType 11785 }); 11786 const currentTheme = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getCurrentTheme(); 11787 let canDuplicate = !["wp_block", "wp_template_part"].includes( 11788 postTypeConfig.slug 11789 ) && canCreate && duplicate_post_default; 11790 if (true) { 11791 if ("wp_template" !== postTypeConfig.slug) { 11792 canDuplicate = void 0; 11793 } 11794 } 11795 const actions = [ 11796 postTypeConfig.viewable ? view_post_default : void 0, 11797 !!postTypeConfig.supports?.revisions ? view_post_revisions_default : void 0, 11798 // @ts-ignore 11799 canDuplicate, 11800 postTypeConfig.slug === "wp_template_part" && canCreate && currentTheme?.is_block_theme ? duplicate_template_part_default : void 0, 11801 canCreate && postTypeConfig.slug === "wp_block" ? duplicate_pattern_default : void 0, 11802 postTypeConfig.supports?.title ? rename_post_default : void 0, 11803 postTypeConfig.supports?.["page-attributes"] ? reorder_page_default : void 0, 11804 postTypeConfig.slug === "wp_block" ? export_pattern_default : void 0, 11805 restore_post_default, 11806 reset_post_default, 11807 delete_post_default, 11808 trash_post_default, 11809 permanently_delete_post_default 11810 ].filter(Boolean); 11811 const fields = [ 11812 postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.["post-thumbnails"] && featured_image_default, 11813 postTypeConfig.supports?.author && author_default, 11814 status_default, 11815 date_default, 11816 slug_default, 11817 postTypeConfig.supports?.["page-attributes"] && parent_default, 11818 postTypeConfig.supports?.comments && comment_status_default, 11819 postTypeConfig.supports?.trackbacks && ping_status_default, 11820 (postTypeConfig.supports?.comments || postTypeConfig.supports?.trackbacks) && discussion_default, 11821 template_default, 11822 password_default, 11823 postTypeConfig.supports?.editor && postTypeConfig.viewable && content_preview_default 11824 ].filter(Boolean); 11825 if (postTypeConfig.supports?.title) { 11826 let _titleField; 11827 if (postType === "page") { 11828 _titleField = page_title_default; 11829 } else if (postType === "wp_template") { 11830 _titleField = template_title_default; 11831 } else if (postType === "wp_block") { 11832 _titleField = pattern_title_default; 11833 } else { 11834 _titleField = title_default; 11835 } 11836 fields.push(_titleField); 11837 } 11838 registry.batch(() => { 11839 actions.forEach((action) => { 11840 unlock(registry.dispatch(store_store)).registerEntityAction( 11841 "postType", 11842 postType, 11843 action 11844 ); 11845 }); 11846 fields.forEach((field) => { 11847 unlock(registry.dispatch(store_store)).registerEntityField( 11848 "postType", 11849 postType, 11850 field 11851 ); 11852 }); 11853 }); 11854 (0,external_wp_hooks_namespaceObject.doAction)("core.registerPostTypeSchema", postType); 11855 }; 11856 11857 11858 ;// ./node_modules/@wordpress/editor/build-module/store/private-actions.js 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 function setCurrentTemplateId(id) { 11871 return { 11872 type: "SET_CURRENT_TEMPLATE_ID", 11873 id 11874 }; 11875 } 11876 const createTemplate = (template) => async ({ select, dispatch, registry }) => { 11877 const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", "wp_template", template); 11878 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( 11879 "postType", 11880 select.getCurrentPostType(), 11881 select.getCurrentPostId(), 11882 { 11883 template: savedTemplate.slug 11884 } 11885 ); 11886 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice( 11887 (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now."), 11888 { 11889 type: "snackbar", 11890 actions: [ 11891 { 11892 label: (0,external_wp_i18n_namespaceObject.__)("Go back"), 11893 onClick: () => dispatch.setRenderingMode( 11894 select.getEditorSettings().defaultRenderingMode 11895 ) 11896 } 11897 ] 11898 } 11899 ); 11900 return savedTemplate; 11901 }; 11902 const showBlockTypes = (blockNames) => ({ registry }) => { 11903 const existingBlockNames = registry.select(external_wp_preferences_namespaceObject.store).get("core", "hiddenBlockTypes") ?? []; 11904 const newBlockNames = existingBlockNames.filter( 11905 (type) => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type) 11906 ); 11907 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "hiddenBlockTypes", newBlockNames); 11908 }; 11909 const hideBlockTypes = (blockNames) => ({ registry }) => { 11910 const existingBlockNames = registry.select(external_wp_preferences_namespaceObject.store).get("core", "hiddenBlockTypes") ?? []; 11911 const mergedBlockNames = /* @__PURE__ */ new Set([ 11912 ...existingBlockNames, 11913 ...Array.isArray(blockNames) ? blockNames : [blockNames] 11914 ]); 11915 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "hiddenBlockTypes", [...mergedBlockNames]); 11916 }; 11917 const saveDirtyEntities = ({ onSave, dirtyEntityRecords = [], entitiesToSkip = [], close } = {}) => ({ registry }) => { 11918 const PUBLISH_ON_SAVE_ENTITIES = [ 11919 { kind: "postType", name: "wp_navigation" } 11920 ]; 11921 const saveNoticeId = "site-editor-save-success"; 11922 const homeUrl = registry.select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; 11923 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(saveNoticeId); 11924 const entitiesToSave = dirtyEntityRecords.filter( 11925 ({ kind, name, key, property }) => { 11926 return !entitiesToSkip.some( 11927 (elt) => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property 11928 ); 11929 } 11930 ); 11931 close?.(entitiesToSave); 11932 const siteItemsToSave = []; 11933 const pendingSavedRecords = []; 11934 entitiesToSave.forEach(({ kind, name, key, property }) => { 11935 if ("root" === kind && "site" === name) { 11936 siteItemsToSave.push(property); 11937 } else { 11938 if (PUBLISH_ON_SAVE_ENTITIES.some( 11939 (typeToPublish) => typeToPublish.kind === kind && typeToPublish.name === name 11940 )) { 11941 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(kind, name, key, { 11942 status: "publish" 11943 }); 11944 } 11945 pendingSavedRecords.push( 11946 registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(kind, name, key) 11947 ); 11948 } 11949 }); 11950 if (siteItemsToSave.length) { 11951 pendingSavedRecords.push( 11952 registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalSaveSpecifiedEntityEdits( 11953 "root", 11954 "site", 11955 void 0, 11956 siteItemsToSave 11957 ) 11958 ); 11959 } 11960 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); 11961 Promise.all(pendingSavedRecords).then((values) => { 11962 return onSave ? onSave(values) : values; 11963 }).then((values) => { 11964 if (values.some((value) => typeof value === "undefined")) { 11965 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)("Saving failed.")); 11966 } else { 11967 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Site updated."), { 11968 type: "snackbar", 11969 id: saveNoticeId, 11970 actions: [ 11971 { 11972 label: (0,external_wp_i18n_namespaceObject.__)("View site"), 11973 url: homeUrl, 11974 openInNewTab: true 11975 } 11976 ] 11977 }); 11978 } 11979 }).catch( 11980 (error) => registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( 11981 `${(0,external_wp_i18n_namespaceObject.__)("Saving failed.")} $error}` 11982 ) 11983 ); 11984 }; 11985 const private_actions_revertTemplate = (template, { allowUndo = true } = {}) => async ({ registry }) => { 11986 const noticeId = "edit-site-template-reverted"; 11987 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(noticeId); 11988 if (!isTemplateRevertable(template)) { 11989 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)("This template is not revertable."), { 11990 type: "snackbar" 11991 }); 11992 return; 11993 } 11994 try { 11995 const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig("postType", template.type); 11996 if (!templateEntityConfig) { 11997 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( 11998 (0,external_wp_i18n_namespaceObject.__)( 11999 "The editor has encountered an unexpected error. Please reload." 12000 ), 12001 { type: "snackbar" } 12002 ); 12003 return; 12004 } 12005 const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)( 12006 `$templateEntityConfig.baseURL}/$template.id}`, 12007 { context: "edit", source: template.origin } 12008 ); 12009 const fileTemplate = await external_wp_apiFetch_default()({ path: fileTemplatePath }); 12010 if (!fileTemplate) { 12011 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( 12012 (0,external_wp_i18n_namespaceObject.__)( 12013 "The editor has encountered an unexpected error. Please reload." 12014 ), 12015 { type: "snackbar" } 12016 ); 12017 return; 12018 } 12019 const serializeBlocks = ({ 12020 blocks: blocksForSerialization = [] 12021 }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); 12022 const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( 12023 "postType", 12024 template.type, 12025 template.id 12026 ); 12027 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( 12028 "postType", 12029 template.type, 12030 template.id, 12031 { 12032 content: serializeBlocks, 12033 // Required to make the `undo` behave correctly. 12034 blocks: edited.blocks, 12035 // Required to revert the blocks in the editor. 12036 source: "custom" 12037 // required to avoid turning the editor into a dirty state 12038 }, 12039 { 12040 undoIgnore: true 12041 // Required to merge this edit with the last undo level. 12042 } 12043 ); 12044 const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate?.content?.raw); 12045 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord("postType", template.type, fileTemplate.id, { 12046 content: serializeBlocks, 12047 blocks, 12048 source: "theme" 12049 }); 12050 if (allowUndo) { 12051 const undoRevert = () => { 12052 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( 12053 "postType", 12054 template.type, 12055 edited.id, 12056 { 12057 content: serializeBlocks, 12058 blocks: edited.blocks, 12059 source: "custom" 12060 } 12061 ); 12062 }; 12063 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Template reset."), { 12064 type: "snackbar", 12065 id: noticeId, 12066 actions: [ 12067 { 12068 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 12069 onClick: undoRevert 12070 } 12071 ] 12072 }); 12073 } 12074 } catch (error) { 12075 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("Template revert failed. Please reload."); 12076 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: "snackbar" }); 12077 } 12078 }; 12079 const removeTemplates = (items) => async ({ registry }) => { 12080 const isResetting = items.every((item) => item?.has_theme_file); 12081 const promiseResult = await Promise.allSettled( 12082 items.map((item) => { 12083 return registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord( 12084 "postType", 12085 item.type, 12086 item.id, 12087 { force: true }, 12088 { throwOnError: true } 12089 ); 12090 }) 12091 ); 12092 if (promiseResult.every(({ status }) => status === "fulfilled")) { 12093 let successMessage; 12094 if (items.length === 1) { 12095 let title; 12096 if (typeof items[0].title === "string") { 12097 title = items[0].title; 12098 } else if (typeof items[0].title?.rendered === "string") { 12099 title = items[0].title?.rendered; 12100 } else if (typeof items[0].title?.raw === "string") { 12101 title = items[0].title?.raw; 12102 } 12103 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( 12104 /* translators: %s: The template/part's name. */ 12105 (0,external_wp_i18n_namespaceObject.__)('"%s" reset.'), 12106 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) 12107 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 12108 /* translators: %s: The template/part's name. */ 12109 (0,external_wp_i18n_namespaceObject._x)('"%s" deleted.', "template part"), 12110 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) 12111 ); 12112 } else { 12113 successMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)("Items reset.") : (0,external_wp_i18n_namespaceObject.__)("Items deleted."); 12114 } 12115 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(successMessage, { 12116 type: "snackbar", 12117 id: "editor-template-deleted-success" 12118 }); 12119 } else { 12120 let errorMessage; 12121 if (promiseResult.length === 1) { 12122 if (promiseResult[0].reason?.message) { 12123 errorMessage = promiseResult[0].reason.message; 12124 } else { 12125 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.__)("An error occurred while reverting the item.") : (0,external_wp_i18n_namespaceObject.__)("An error occurred while deleting the item."); 12126 } 12127 } else { 12128 const errorMessages = /* @__PURE__ */ new Set(); 12129 const failedPromises = promiseResult.filter( 12130 ({ status }) => status === "rejected" 12131 ); 12132 for (const failedPromise of failedPromises) { 12133 if (failedPromise.reason?.message) { 12134 errorMessages.add(failedPromise.reason.message); 12135 } 12136 } 12137 if (errorMessages.size === 0) { 12138 errorMessage = (0,external_wp_i18n_namespaceObject.__)( 12139 "An error occurred while deleting the items." 12140 ); 12141 } else if (errorMessages.size === 1) { 12142 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( 12143 /* translators: %s: an error message */ 12144 (0,external_wp_i18n_namespaceObject.__)( 12145 "An error occurred while reverting the items: %s" 12146 ), 12147 [...errorMessages][0] 12148 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 12149 /* translators: %s: an error message */ 12150 (0,external_wp_i18n_namespaceObject.__)( 12151 "An error occurred while deleting the items: %s" 12152 ), 12153 [...errorMessages][0] 12154 ); 12155 } else { 12156 errorMessage = isResetting ? (0,external_wp_i18n_namespaceObject.sprintf)( 12157 /* translators: %s: a list of comma separated error messages */ 12158 (0,external_wp_i18n_namespaceObject.__)( 12159 "Some errors occurred while reverting the items: %s" 12160 ), 12161 [...errorMessages].join(",") 12162 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 12163 /* translators: %s: a list of comma separated error messages */ 12164 (0,external_wp_i18n_namespaceObject.__)( 12165 "Some errors occurred while deleting the items: %s" 12166 ), 12167 [...errorMessages].join(",") 12168 ); 12169 } 12170 } 12171 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, { type: "snackbar" }); 12172 } 12173 }; 12174 const setDefaultRenderingMode = (mode) => ({ select, registry }) => { 12175 const postType = select.getCurrentPostType(); 12176 const theme = registry.select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.stylesheet; 12177 const renderingModes = registry.select(external_wp_preferences_namespaceObject.store).get("core", "renderingModes")?.[theme] ?? {}; 12178 if (renderingModes[postType] === mode) { 12179 return; 12180 } 12181 const newModes = { 12182 [theme]: { 12183 ...renderingModes, 12184 [postType]: mode 12185 } 12186 }; 12187 registry.dispatch(external_wp_preferences_namespaceObject.store).set("core", "renderingModes", newModes); 12188 }; 12189 function setCanvasMinHeight(minHeight) { 12190 return { 12191 type: "SET_CANVAS_MIN_HEIGHT", 12192 minHeight 12193 }; 12194 } 12195 12196 12197 // EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js 12198 var fast_deep_equal = __webpack_require__(5215); 12199 var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal); 12200 ;// ./node_modules/@wordpress/icons/build-module/library/navigation.js 12201 12202 12203 var navigation_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" }) }); 12204 12205 12206 ;// ./node_modules/@wordpress/icons/build-module/library/verse.js 12207 12208 12209 var verse_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z" }) }); 12210 12211 12212 ;// ./node_modules/@wordpress/editor/build-module/dataviews/store/private-selectors.js 12213 const private_selectors_EMPTY_ARRAY = []; 12214 function getEntityActions(state, kind, name) { 12215 return state.actions[kind]?.[name] ?? private_selectors_EMPTY_ARRAY; 12216 } 12217 function getEntityFields(state, kind, name) { 12218 return state.fields[kind]?.[name] ?? private_selectors_EMPTY_ARRAY; 12219 } 12220 function isEntityReady(state, kind, name) { 12221 return state.isReady[kind]?.[name]; 12222 } 12223 12224 12225 ;// ./node_modules/@wordpress/editor/build-module/store/private-selectors.js 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 const EMPTY_INSERTION_POINT = { 12236 rootClientId: void 0, 12237 insertionIndex: void 0, 12238 filterValue: void 0 12239 }; 12240 const RENDERING_MODES = ["post-only", "template-locked"]; 12241 const getInserter = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12242 (select) => (0,external_wp_data_namespaceObject.createSelector)( 12243 (state) => { 12244 if (typeof state.blockInserterPanel === "object") { 12245 return state.blockInserterPanel; 12246 } 12247 if (getRenderingMode(state) === "template-locked") { 12248 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName( 12249 "core/post-content" 12250 ); 12251 if (postContentClientId) { 12252 return { 12253 rootClientId: postContentClientId, 12254 insertionIndex: void 0, 12255 filterValue: void 0 12256 }; 12257 } 12258 } 12259 return EMPTY_INSERTION_POINT; 12260 }, 12261 (state) => { 12262 const [postContentClientId] = select(external_wp_blockEditor_namespaceObject.store).getBlocksByName( 12263 "core/post-content" 12264 ); 12265 return [ 12266 state.blockInserterPanel, 12267 getRenderingMode(state), 12268 postContentClientId 12269 ]; 12270 } 12271 ) 12272 ); 12273 function getListViewToggleRef(state) { 12274 return state.listViewToggleRef; 12275 } 12276 function getInserterSidebarToggleRef(state) { 12277 return state.inserterSidebarToggleRef; 12278 } 12279 const CARD_ICONS = { 12280 wp_block: symbol_default, 12281 wp_navigation: navigation_default, 12282 page: page_default, 12283 post: verse_default 12284 }; 12285 const getPostIcon = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12286 (select) => (state, postType, options) => { 12287 { 12288 if (postType === "wp_template_part" || postType === "wp_template") { 12289 const templateAreas = select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_part_areas || []; 12290 const areaData = templateAreas.find( 12291 (item) => options.area === item.area 12292 ); 12293 if (areaData?.icon) { 12294 return getTemplatePartIcon(areaData.icon); 12295 } 12296 return layout_default; 12297 } 12298 if (CARD_ICONS[postType]) { 12299 return CARD_ICONS[postType]; 12300 } 12301 const postTypeEntity = select(external_wp_coreData_namespaceObject.store).getPostType(postType); 12302 if (typeof postTypeEntity?.icon === "string" && postTypeEntity.icon.startsWith("dashicons-")) { 12303 return postTypeEntity.icon.slice(10); 12304 } 12305 return page_default; 12306 } 12307 } 12308 ); 12309 const hasPostMetaChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12310 (select) => (state, postType, postId) => { 12311 const { type: currentPostType, id: currentPostId } = getCurrentPost(state); 12312 const edits = select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits( 12313 "postType", 12314 postType || currentPostType, 12315 postId || currentPostId 12316 ); 12317 if (!edits?.meta) { 12318 return false; 12319 } 12320 const originalPostMeta = select(external_wp_coreData_namespaceObject.store).getEntityRecord( 12321 "postType", 12322 postType || currentPostType, 12323 postId || currentPostId 12324 )?.meta; 12325 return !fast_deep_equal_default()( 12326 { ...originalPostMeta, footnotes: void 0 }, 12327 { ...edits.meta, footnotes: void 0 } 12328 ); 12329 } 12330 ); 12331 function private_selectors_getEntityActions(state, ...args) { 12332 return getEntityActions(state.dataviews, ...args); 12333 } 12334 function private_selectors_isEntityReady(state, ...args) { 12335 return isEntityReady(state.dataviews, ...args); 12336 } 12337 function private_selectors_getEntityFields(state, ...args) { 12338 return getEntityFields(state.dataviews, ...args); 12339 } 12340 const getPostBlocksByName = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12341 (select) => (0,external_wp_data_namespaceObject.createSelector)( 12342 (state, blockNames) => { 12343 blockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 12344 const { getBlocksByName, getBlockParents, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); 12345 return getBlocksByName(blockNames).filter( 12346 (clientId) => getBlockParents(clientId).every((parentClientId) => { 12347 const parentBlockName = getBlockName(parentClientId); 12348 return ( 12349 // Ignore descendents of the query block. 12350 parentBlockName !== "core/query" && // Enable only the top-most block. 12351 !blockNames.includes(parentBlockName) 12352 ); 12353 }) 12354 ); 12355 }, 12356 () => [select(external_wp_blockEditor_namespaceObject.store).getBlocks()] 12357 ) 12358 ); 12359 const getDefaultRenderingMode = (0,external_wp_data_namespaceObject.createRegistrySelector)( 12360 (select) => (state, postType) => { 12361 const { getPostType, getCurrentTheme, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); 12362 const currentTheme = getCurrentTheme(); 12363 const postTypeEntity = getPostType(postType); 12364 if (!hasFinishedResolution("getPostType", [postType]) || !hasFinishedResolution("getCurrentTheme")) { 12365 return void 0; 12366 } 12367 const theme = currentTheme?.stylesheet; 12368 const defaultModePreference = select(external_wp_preferences_namespaceObject.store).get( 12369 "core", 12370 "renderingModes" 12371 )?.[theme]?.[postType]; 12372 const postTypeDefaultMode = Array.isArray( 12373 postTypeEntity?.supports?.editor 12374 ) ? postTypeEntity.supports.editor.find( 12375 (features) => "default-mode" in features 12376 )?.["default-mode"] : void 0; 12377 const defaultMode = defaultModePreference || postTypeDefaultMode; 12378 if (!RENDERING_MODES.includes(defaultMode)) { 12379 return "post-only"; 12380 } 12381 return defaultMode; 12382 } 12383 ); 12384 function getCanvasMinHeight(state) { 12385 return state.canvasMinHeight; 12386 } 12387 12388 12389 ;// ./node_modules/@wordpress/editor/build-module/store/index.js 12390 12391 12392 12393 12394 12395 12396 12397 12398 const storeConfig = { 12399 reducer: reducer_reducer_default, 12400 selectors: selectors_namespaceObject, 12401 actions: actions_namespaceObject 12402 }; 12403 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 12404 ...storeConfig 12405 }); 12406 (0,external_wp_data_namespaceObject.register)(store_store); 12407 unlock(store_store).registerPrivateActions(store_private_actions_namespaceObject); 12408 unlock(store_store).registerPrivateSelectors(store_private_selectors_namespaceObject); 12409 12410 12411 ;// ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js 12412 12413 12414 12415 12416 12417 12418 12419 const createWithMetaAttributeSource = (metaAttributes) => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 12420 (BlockEdit) => ({ attributes, setAttributes, ...props }) => { 12421 const postType = (0,external_wp_data_namespaceObject.useSelect)( 12422 (select) => select(store_store).getCurrentPostType(), 12423 [] 12424 ); 12425 const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)( 12426 "postType", 12427 postType, 12428 "meta" 12429 ); 12430 const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)( 12431 () => ({ 12432 ...attributes, 12433 ...Object.fromEntries( 12434 Object.entries(metaAttributes).map( 12435 ([attributeKey, metaKey]) => [ 12436 attributeKey, 12437 meta[metaKey] 12438 ] 12439 ) 12440 ) 12441 }), 12442 [attributes, meta] 12443 ); 12444 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12445 BlockEdit, 12446 { 12447 attributes: mergedAttributes, 12448 setAttributes: (nextAttributes) => { 12449 const nextMeta = Object.fromEntries( 12450 Object.entries(nextAttributes ?? {}).filter( 12451 // Filter to intersection of keys between the updated 12452 // attributes and those with an associated meta key. 12453 ([key]) => key in metaAttributes 12454 ).map(([attributeKey, value]) => [ 12455 // Rename the keys to the expected meta key name. 12456 metaAttributes[attributeKey], 12457 value 12458 ]) 12459 ); 12460 if (Object.entries(nextMeta).length) { 12461 setMeta(nextMeta); 12462 } 12463 setAttributes(nextAttributes); 12464 }, 12465 ...props 12466 } 12467 ); 12468 }, 12469 "withMetaAttributeSource" 12470 ); 12471 function shimAttributeSource(settings) { 12472 const metaAttributes = Object.fromEntries( 12473 Object.entries(settings.attributes ?? {}).filter(([, { source }]) => source === "meta").map(([attributeKey, { meta }]) => [attributeKey, meta]) 12474 ); 12475 if (Object.entries(metaAttributes).length) { 12476 settings.edit = createWithMetaAttributeSource(metaAttributes)( 12477 settings.edit 12478 ); 12479 } 12480 return settings; 12481 } 12482 (0,external_wp_hooks_namespaceObject.addFilter)( 12483 "blocks.registerBlockType", 12484 "core/editor/custom-sources-backwards-compatibility/shim-attribute-source", 12485 shimAttributeSource 12486 ); 12487 12488 ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js 12489 12490 12491 12492 12493 function getUserLabel(user) { 12494 const avatar = user.avatar_urls && user.avatar_urls[24] ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12495 "img", 12496 { 12497 className: "editor-autocompleters__user-avatar", 12498 alt: "", 12499 src: user.avatar_urls[24] 12500 } 12501 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__no-avatar" }); 12502 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 12503 avatar, 12504 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__user-name", children: user.name }), 12505 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-autocompleters__user-slug", children: user.slug }) 12506 ] }); 12507 } 12508 var user_default = { 12509 name: "users", 12510 className: "editor-autocompleters__user", 12511 triggerPrefix: "@", 12512 useItems(filterValue) { 12513 const users = (0,external_wp_data_namespaceObject.useSelect)( 12514 (select) => { 12515 const { getUsers } = select(external_wp_coreData_namespaceObject.store); 12516 return getUsers({ 12517 context: "view", 12518 search: encodeURIComponent(filterValue) 12519 }); 12520 }, 12521 [filterValue] 12522 ); 12523 const options = (0,external_wp_element_namespaceObject.useMemo)( 12524 () => users ? users.map((user) => ({ 12525 key: `user-$user.slug}`, 12526 value: user, 12527 label: getUserLabel(user) 12528 })) : [], 12529 [users] 12530 ); 12531 return [options]; 12532 }, 12533 getOptionCompletion(user) { 12534 return `@$user.slug}`; 12535 } 12536 }; 12537 12538 12539 ;// ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js 12540 12541 12542 function setDefaultCompleters(completers = []) { 12543 completers.push({ ...user_default }); 12544 return completers; 12545 } 12546 (0,external_wp_hooks_namespaceObject.addFilter)( 12547 "editor.Autocomplete.completers", 12548 "editor/autocompleters/set-default-completers", 12549 setDefaultCompleters 12550 ); 12551 12552 ;// ./node_modules/@wordpress/editor/build-module/hooks/media-upload.js 12553 12554 12555 (0,external_wp_hooks_namespaceObject.addFilter)( 12556 "editor.MediaUpload", 12557 "core/editor/components/media-upload", 12558 () => external_wp_mediaUtils_namespaceObject.MediaUpload 12559 ); 12560 12561 ;// ./node_modules/@wordpress/editor/build-module/hooks/pattern-overrides.js 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 const { 12572 PatternOverridesControls, 12573 ResetOverridesControl, 12574 PatternOverridesBlockControls, 12575 PATTERN_TYPES: pattern_overrides_PATTERN_TYPES, 12576 PARTIAL_SYNCING_SUPPORTED_BLOCKS, 12577 PATTERN_SYNC_TYPES 12578 } = unlock(external_wp_patterns_namespaceObject.privateApis); 12579 const withPatternOverrideControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 12580 (BlockEdit) => (props) => { 12581 const isSupportedBlock = !!PARTIAL_SYNCING_SUPPORTED_BLOCKS[props.name]; 12582 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 12583 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), 12584 props.isSelected && isSupportedBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ControlsWithStoreSubscription, { ...props }), 12585 isSupportedBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesBlockControls, {}) 12586 ] }); 12587 }, 12588 "withPatternOverrideControls" 12589 ); 12590 function ControlsWithStoreSubscription(props) { 12591 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 12592 const { hasPatternOverridesSource, isEditingSyncedPattern } = (0,external_wp_data_namespaceObject.useSelect)( 12593 (select) => { 12594 const { getCurrentPostType, getEditedPostAttribute } = select(store_store); 12595 return { 12596 // For editing link to the site editor if the theme and user permissions support it. 12597 hasPatternOverridesSource: !!(0,external_wp_blocks_namespaceObject.getBlockBindingsSource)( 12598 "core/pattern-overrides" 12599 ), 12600 isEditingSyncedPattern: getCurrentPostType() === pattern_overrides_PATTERN_TYPES.user && getEditedPostAttribute("meta")?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute("wp_pattern_sync_status") !== PATTERN_SYNC_TYPES.unsynced 12601 }; 12602 }, 12603 [] 12604 ); 12605 const bindings = props.attributes.metadata?.bindings; 12606 const hasPatternBindings = !!bindings && Object.values(bindings).some( 12607 (binding) => binding.source === "core/pattern-overrides" 12608 ); 12609 const shouldShowPatternOverridesControls = isEditingSyncedPattern && blockEditingMode === "default"; 12610 const shouldShowResetOverridesControl = !isEditingSyncedPattern && !!props.attributes.metadata?.name && blockEditingMode !== "disabled" && hasPatternBindings; 12611 if (!hasPatternOverridesSource) { 12612 return null; 12613 } 12614 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 12615 shouldShowPatternOverridesControls && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesControls, { ...props }), 12616 shouldShowResetOverridesControl && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetOverridesControl, { ...props }) 12617 ] }); 12618 } 12619 (0,external_wp_hooks_namespaceObject.addFilter)( 12620 "editor.BlockEdit", 12621 "core/editor/with-pattern-override-controls", 12622 withPatternOverrideControls 12623 ); 12624 12625 ;// ./node_modules/@wordpress/editor/build-module/hooks/navigation-link-view-button.js 12626 12627 12628 12629 12630 12631 12632 12633 12634 const SUPPORTED_BLOCKS = ["core/navigation-link", "core/navigation-submenu"]; 12635 function NavigationViewButton({ attributes }) { 12636 const { kind, id, type } = attributes; 12637 const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)(); 12638 const onNavigateToEntityRecord = (0,external_wp_data_namespaceObject.useSelect)( 12639 (select) => select(external_wp_blockEditor_namespaceObject.store).getSettings().onNavigateToEntityRecord, 12640 [] 12641 ); 12642 const onViewPage = (0,external_wp_element_namespaceObject.useCallback)(() => { 12643 if (kind === "post-type" && type === "page" && id && onNavigateToEntityRecord) { 12644 onNavigateToEntityRecord({ 12645 postId: id, 12646 postType: type 12647 }); 12648 } 12649 }, [kind, id, type, onNavigateToEntityRecord]); 12650 if (kind !== "post-type" || type !== "page" || !id || !onNavigateToEntityRecord || blockEditingMode !== "contentOnly") { 12651 return null; 12652 } 12653 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12654 external_wp_components_namespaceObject.ToolbarButton, 12655 { 12656 name: "view", 12657 title: (0,external_wp_i18n_namespaceObject.__)("View"), 12658 onClick: onViewPage, 12659 children: (0,external_wp_i18n_namespaceObject.__)("View") 12660 } 12661 ) }) }); 12662 } 12663 const withNavigationViewButton = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 12664 (BlockEdit) => (props) => { 12665 const isSupportedBlock = SUPPORTED_BLOCKS.includes(props.name); 12666 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 12667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), 12668 props.isSelected && isSupportedBlock && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigationViewButton, { ...props }) 12669 ] }); 12670 }, 12671 "withNavigationViewButton" 12672 ); 12673 (0,external_wp_hooks_namespaceObject.addFilter)( 12674 "editor.BlockEdit", 12675 "core/editor/with-navigation-view-button", 12676 withNavigationViewButton 12677 ); 12678 12679 ;// ./node_modules/@wordpress/editor/build-module/hooks/template-part-navigation-edit-button.js 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 const NAVIGATION_BLOCK_NAME = "core/navigation"; 12690 const TEMPLATE_PART_BLOCK_NAME = "core/template-part"; 12691 const BLOCK_INSPECTOR_AREA = "edit-post/block"; 12692 function TemplatePartNavigationEditButton({ clientId }) { 12693 const { selectBlock, flashBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 12694 const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 12695 const { 12696 hasNavigationBlocks, 12697 firstNavigationBlockId, 12698 isNavigationEditable 12699 } = (0,external_wp_data_namespaceObject.useSelect)( 12700 (select) => { 12701 const { 12702 getClientIdsOfDescendants, 12703 getBlockName, 12704 getBlockEditingMode 12705 } = select(external_wp_blockEditor_namespaceObject.store); 12706 const descendants = getClientIdsOfDescendants(clientId); 12707 const navigationBlocksInTemplatePart = descendants.filter( 12708 (blockId) => getBlockName(blockId) === NAVIGATION_BLOCK_NAME 12709 ); 12710 const _hasNavigationBlocks = navigationBlocksInTemplatePart.length > 0; 12711 const _firstNavigationBlockId = _hasNavigationBlocks ? navigationBlocksInTemplatePart[0] : null; 12712 return { 12713 hasNavigationBlocks: _hasNavigationBlocks, 12714 firstNavigationBlockId: _firstNavigationBlockId, 12715 // We can't use the useBlockEditingMode hook here because the current 12716 // context is the template part, not the navigation block. 12717 isNavigationEditable: getBlockEditingMode(_firstNavigationBlockId) !== "disabled" 12718 }; 12719 }, 12720 [clientId] 12721 ); 12722 const onEditNavigation = (0,external_wp_element_namespaceObject.useCallback)(() => { 12723 if (firstNavigationBlockId) { 12724 selectBlock(firstNavigationBlockId); 12725 flashBlock(firstNavigationBlockId, 500); 12726 enableComplementaryArea("core", BLOCK_INSPECTOR_AREA); 12727 } 12728 }, [ 12729 firstNavigationBlockId, 12730 selectBlock, 12731 flashBlock, 12732 enableComplementaryArea 12733 ]); 12734 if (!hasNavigationBlocks || !isNavigationEditable) { 12735 return null; 12736 } 12737 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "other", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.ToolbarGroup, { children: [ 12738 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDivider, { orientation: "vertical", marginEnd: 3 }), 12739 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12740 external_wp_components_namespaceObject.ToolbarButton, 12741 { 12742 label: (0,external_wp_i18n_namespaceObject.__)("Edit navigation"), 12743 onClick: onEditNavigation, 12744 children: (0,external_wp_i18n_namespaceObject.__)("Edit navigation") 12745 } 12746 ) 12747 ] }) }); 12748 } 12749 const withTemplatePartNavigationEditButton = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)( 12750 (BlockEdit) => (props) => { 12751 const isTemplatePart = props.name === TEMPLATE_PART_BLOCK_NAME; 12752 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 12753 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, { ...props }, "edit"), 12754 props.isSelected && isTemplatePart && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 12755 TemplatePartNavigationEditButton, 12756 { 12757 clientId: props.clientId 12758 } 12759 ) 12760 ] }); 12761 }, 12762 "withTemplatePartNavigationEditButton" 12763 ); 12764 (0,external_wp_hooks_namespaceObject.addFilter)( 12765 "editor.BlockEdit", 12766 "core/editor/with-template-part-navigation-edit-button", 12767 withTemplatePartNavigationEditButton 12768 ); 12769 12770 ;// ./node_modules/@wordpress/editor/build-module/hooks/index.js 12771 12772 12773 12774 12775 12776 12777 12778 ;// ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js 12779 12780 12781 12782 ;// ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js 12783 12784 12785 12786 12787 12788 class AutosaveMonitor extends external_wp_element_namespaceObject.Component { 12789 constructor(props) { 12790 super(props); 12791 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); 12792 } 12793 componentDidMount() { 12794 if (!this.props.disableIntervalChecks) { 12795 this.setAutosaveTimer(); 12796 } 12797 } 12798 componentDidUpdate(prevProps) { 12799 if (this.props.disableIntervalChecks) { 12800 if (this.props.editsReference !== prevProps.editsReference) { 12801 this.props.autosave(); 12802 } 12803 return; 12804 } 12805 if (this.props.interval !== prevProps.interval) { 12806 clearTimeout(this.timerId); 12807 this.setAutosaveTimer(); 12808 } 12809 if (!this.props.isDirty) { 12810 this.needsAutosave = false; 12811 return; 12812 } 12813 if (this.props.isAutosaving && !prevProps.isAutosaving) { 12814 this.needsAutosave = false; 12815 return; 12816 } 12817 if (this.props.editsReference !== prevProps.editsReference) { 12818 this.needsAutosave = true; 12819 } 12820 } 12821 componentWillUnmount() { 12822 clearTimeout(this.timerId); 12823 } 12824 setAutosaveTimer(timeout = this.props.interval * 1e3) { 12825 this.timerId = setTimeout(() => { 12826 this.autosaveTimerHandler(); 12827 }, timeout); 12828 } 12829 autosaveTimerHandler() { 12830 if (!this.props.isAutosaveable) { 12831 this.setAutosaveTimer(1e3); 12832 return; 12833 } 12834 if (this.needsAutosave) { 12835 this.needsAutosave = false; 12836 this.props.autosave(); 12837 } 12838 this.setAutosaveTimer(); 12839 } 12840 render() { 12841 return null; 12842 } 12843 } 12844 var autosave_monitor_default = (0,external_wp_compose_namespaceObject.compose)([ 12845 (0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { 12846 const { getReferenceByDistinctEdits } = select(external_wp_coreData_namespaceObject.store); 12847 const { 12848 isEditedPostDirty, 12849 isEditedPostAutosaveable, 12850 isAutosavingPost, 12851 getEditorSettings 12852 } = select(store_store); 12853 const { interval = getEditorSettings().autosaveInterval } = ownProps; 12854 return { 12855 editsReference: getReferenceByDistinctEdits(), 12856 isDirty: isEditedPostDirty(), 12857 isAutosaveable: isEditedPostAutosaveable(), 12858 isAutosaving: isAutosavingPost(), 12859 interval 12860 }; 12861 }), 12862 (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ 12863 autosave() { 12864 const { autosave = dispatch(store_store).autosave } = ownProps; 12865 autosave(); 12866 } 12867 })) 12868 ])(AutosaveMonitor); 12869 12870 12871 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js 12872 12873 12874 var chevron_right_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); 12875 12876 12877 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js 12878 12879 12880 var chevron_left_small_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); 12881 12882 12883 ;// external ["wp","dom"] 12884 const external_wp_dom_namespaceObject = window["wp"]["dom"]; 12885 ;// ./node_modules/@wordpress/editor/build-module/utils/pageTypeBadge.js 12886 12887 12888 12889 function usePageTypeBadge(postId) { 12890 const { isFrontPage, isPostsPage } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 12891 const { canUser, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 12892 const siteSettings = canUser("read", { 12893 kind: "root", 12894 name: "site" 12895 }) ? getEditedEntityRecord("root", "site") : void 0; 12896 const _postId = parseInt(postId, 10); 12897 return { 12898 isFrontPage: siteSettings?.page_on_front === _postId, 12899 isPostsPage: siteSettings?.page_for_posts === _postId 12900 }; 12901 }); 12902 if (isFrontPage) { 12903 return (0,external_wp_i18n_namespaceObject.__)("Homepage"); 12904 } else if (isPostsPage) { 12905 return (0,external_wp_i18n_namespaceObject.__)("Posts Page"); 12906 } 12907 return false; 12908 } 12909 12910 12911 ;// ./node_modules/@wordpress/editor/build-module/components/document-bar/index.js 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 const MotionButton = external_wp_components_namespaceObject.__unstableMotion.create(external_wp_components_namespaceObject.Button); 12931 function DocumentBar(props) { 12932 const { 12933 postId, 12934 postType, 12935 postTypeLabel, 12936 documentTitle, 12937 isNotFound, 12938 templateTitle, 12939 onNavigateToPreviousEntityRecord, 12940 isTemplatePreview 12941 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 12942 const { 12943 getCurrentPostType, 12944 getCurrentPostId, 12945 getEditorSettings, 12946 getRenderingMode 12947 } = select(store_store); 12948 const { 12949 getEditedEntityRecord, 12950 getPostType, 12951 getCurrentTheme, 12952 isResolving: isResolvingSelector 12953 } = select(external_wp_coreData_namespaceObject.store); 12954 const _postType = getCurrentPostType(); 12955 const _postId = getCurrentPostId(); 12956 const _document = getEditedEntityRecord( 12957 "postType", 12958 _postType, 12959 _postId 12960 ); 12961 const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; 12962 const _templateInfo = getTemplateInfo({ 12963 templateTypes, 12964 template: _document 12965 }); 12966 const _postTypeLabel = getPostType(_postType)?.labels?.singular_name; 12967 return { 12968 postId: _postId, 12969 postType: _postType, 12970 postTypeLabel: _postTypeLabel, 12971 documentTitle: _document.title, 12972 isNotFound: !_document && !isResolvingSelector( 12973 "getEditedEntityRecord", 12974 "postType", 12975 _postType, 12976 _postId 12977 ), 12978 templateTitle: _templateInfo.title, 12979 onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord, 12980 isTemplatePreview: getRenderingMode() === "template-locked" 12981 }; 12982 }, []); 12983 const { open: openCommandCenter } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); 12984 const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 12985 const isTemplate = TEMPLATE_POST_TYPES.includes(postType); 12986 const hasBackButton = !!onNavigateToPreviousEntityRecord; 12987 const entityTitle = isTemplate ? templateTitle : documentTitle; 12988 const title = props.title || entityTitle; 12989 const icon = props.icon; 12990 const pageTypeBadge = usePageTypeBadge(postId); 12991 const mountedRef = (0,external_wp_element_namespaceObject.useRef)(false); 12992 (0,external_wp_element_namespaceObject.useEffect)(() => { 12993 mountedRef.current = true; 12994 }, []); 12995 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 12996 "div", 12997 { 12998 className: dist_clsx("editor-document-bar", { 12999 "has-back-button": hasBackButton 13000 }), 13001 children: [ 13002 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableAnimatePresence, { children: hasBackButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13003 MotionButton, 13004 { 13005 className: "editor-document-bar__back", 13006 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small_default : chevron_left_small_default, 13007 onClick: (event) => { 13008 event.stopPropagation(); 13009 onNavigateToPreviousEntityRecord(); 13010 }, 13011 size: "compact", 13012 initial: mountedRef.current ? { opacity: 0, transform: "translateX(15%)" } : false, 13013 animate: { opacity: 1, transform: "translateX(0%)" }, 13014 exit: { opacity: 0, transform: "translateX(15%)" }, 13015 transition: isReducedMotion ? { duration: 0 } : void 0, 13016 children: (0,external_wp_i18n_namespaceObject.__)("Back") 13017 } 13018 ) }), 13019 !isTemplate && isTemplatePreview && !hasBackButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13020 external_wp_blockEditor_namespaceObject.BlockIcon, 13021 { 13022 icon: layout_default, 13023 className: "editor-document-bar__icon-layout" 13024 } 13025 ), 13026 isNotFound ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Document not found") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13027 external_wp_components_namespaceObject.Button, 13028 { 13029 className: "editor-document-bar__command", 13030 onClick: () => openCommandCenter(), 13031 size: "compact", 13032 children: [ 13033 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13034 external_wp_components_namespaceObject.__unstableMotion.div, 13035 { 13036 className: "editor-document-bar__title", 13037 initial: mountedRef.current ? { 13038 opacity: 0, 13039 transform: hasBackButton ? "translateX(15%)" : "translateX(-15%)" 13040 } : false, 13041 animate: { 13042 opacity: 1, 13043 transform: "translateX(0%)" 13044 }, 13045 transition: isReducedMotion ? { duration: 0 } : void 0, 13046 children: [ 13047 icon && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { icon }), 13048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalText, { size: "body", as: "h1", children: [ 13049 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-title", children: title ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(title) : (0,external_wp_i18n_namespaceObject.__)("No title") }), 13050 pageTypeBadge && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-type-label", children: `\xB7 $pageTypeBadge}` }), 13051 postTypeLabel && !props.title && !pageTypeBadge && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__post-type-label", children: `\xB7 ${(0,external_wp_htmlEntities_namespaceObject.decodeEntities)( 13052 postTypeLabel 13053 )}` }) 13054 ] }) 13055 ] 13056 }, 13057 hasBackButton 13058 ), 13059 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-document-bar__shortcut", children: external_wp_keycodes_namespaceObject.displayShortcut.primary("k") }) 13060 ] 13061 } 13062 ) 13063 ] 13064 } 13065 ); 13066 } 13067 13068 13069 ;// external ["wp","richText"] 13070 const external_wp_richText_namespaceObject = window["wp"]["richText"]; 13071 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js 13072 13073 13074 const TableOfContentsItem = ({ 13075 children, 13076 isValid, 13077 isDisabled, 13078 level, 13079 href, 13080 onSelect 13081 }) => { 13082 function handleClick(event) { 13083 if (isDisabled) { 13084 event.preventDefault(); 13085 return; 13086 } 13087 onSelect(); 13088 } 13089 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13090 "li", 13091 { 13092 className: dist_clsx( 13093 "document-outline__item", 13094 `is-$level.toLowerCase()}`, 13095 { 13096 "is-invalid": !isValid, 13097 "is-disabled": isDisabled 13098 } 13099 ), 13100 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13101 "a", 13102 { 13103 href, 13104 className: "document-outline__button", 13105 "aria-disabled": isDisabled, 13106 onClick: handleClick, 13107 children: [ 13108 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13109 "span", 13110 { 13111 className: "document-outline__emdash", 13112 "aria-hidden": "true" 13113 } 13114 ), 13115 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { className: "document-outline__level", children: level }), 13116 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "document-outline__item-content", children }) 13117 ] 13118 } 13119 ) 13120 } 13121 ); 13122 }; 13123 var item_default = TableOfContentsItem; 13124 13125 13126 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 const emptyHeadingContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Empty heading)") }); 13138 const incorrectLevelContent = [ 13139 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break"), 13140 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Incorrect heading level)") }, "incorrect-message") 13141 ]; 13142 const singleH1Headings = [ 13143 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-h1"), 13144 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Your theme may already use a H1 for the post title)") }, "incorrect-message-h1") 13145 ]; 13146 const multipleH1Headings = [ 13147 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}, "incorrect-break-multiple-h1"), 13148 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("em", { children: (0,external_wp_i18n_namespaceObject.__)("(Multiple H1 headings are not recommended)") }, "incorrect-message-multiple-h1") 13149 ]; 13150 function EmptyOutlineIllustration() { 13151 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13152 external_wp_components_namespaceObject.SVG, 13153 { 13154 width: "138", 13155 height: "148", 13156 viewBox: "0 0 138 148", 13157 fill: "none", 13158 xmlns: "http://www.w3.org/2000/svg", 13159 children: [ 13160 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { width: "138", height: "148", rx: "4", fill: "#F0F6FC" }), 13161 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "44", y1: "28", x2: "24", y2: "28", stroke: "#DDDDDD" }), 13162 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "48", y: "16", width: "27", height: "23", rx: "4", fill: "#DDDDDD" }), 13163 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13164 external_wp_components_namespaceObject.Path, 13165 { 13166 d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z", 13167 fill: "black" 13168 } 13169 ), 13170 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "55", y1: "59", x2: "24", y2: "59", stroke: "#DDDDDD" }), 13171 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "59", y: "47", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }), 13172 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13173 external_wp_components_namespaceObject.Path, 13174 { 13175 d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z", 13176 fill: "black" 13177 } 13178 ), 13179 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "80", y1: "90", x2: "24", y2: "90", stroke: "#DDDDDD" }), 13180 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "84", y: "78", width: "30", height: "23", rx: "4", fill: "#F0B849" }), 13181 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13182 external_wp_components_namespaceObject.Path, 13183 { 13184 d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z", 13185 fill: "black" 13186 } 13187 ), 13188 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Line, { x1: "66", y1: "121", x2: "24", y2: "121", stroke: "#DDDDDD" }), 13189 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Rect, { x: "70", y: "109", width: "29", height: "23", rx: "4", fill: "#DDDDDD" }), 13190 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13191 external_wp_components_namespaceObject.Path, 13192 { 13193 d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z", 13194 fill: "black" 13195 } 13196 ) 13197 ] 13198 } 13199 ); 13200 } 13201 const computeOutlineHeadings = (blocks = []) => { 13202 return blocks.filter((block) => block.name === "core/heading").map((block) => ({ 13203 ...block, 13204 level: block.attributes.level, 13205 isEmpty: isEmptyHeading(block) 13206 })); 13207 }; 13208 const isEmptyHeading = (heading) => !heading.attributes.content || heading.attributes.content.trim().length === 0; 13209 function DocumentOutline({ 13210 onSelect, 13211 hasOutlineItemsDisabled 13212 }) { 13213 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 13214 const { title, isTitleSupported } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 13215 const { getEditedPostAttribute } = select(store_store); 13216 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 13217 const postType = getPostType(getEditedPostAttribute("type")); 13218 return { 13219 title: getEditedPostAttribute("title"), 13220 isTitleSupported: postType?.supports?.title ?? false 13221 }; 13222 }); 13223 const blocks = (0,external_wp_data_namespaceObject.useSelect)((select) => { 13224 const { getClientIdsWithDescendants, getBlock } = select(external_wp_blockEditor_namespaceObject.store); 13225 const clientIds = getClientIdsWithDescendants(); 13226 return clientIds.map((id) => getBlock(id)); 13227 }); 13228 const contentBlocks = (0,external_wp_data_namespaceObject.useSelect)((select) => { 13229 if (select(store_store).getRenderingMode() === "post-only") { 13230 return void 0; 13231 } 13232 const { getBlocksByName, getClientIdsOfDescendants } = select(external_wp_blockEditor_namespaceObject.store); 13233 const [postContentClientId] = getBlocksByName("core/post-content"); 13234 if (!postContentClientId) { 13235 return void 0; 13236 } 13237 return getClientIdsOfDescendants(postContentClientId); 13238 }, []); 13239 const prevHeadingLevelRef = (0,external_wp_element_namespaceObject.useRef)(1); 13240 const headings = (0,external_wp_element_namespaceObject.useMemo)( 13241 () => computeOutlineHeadings(blocks), 13242 [blocks] 13243 ); 13244 if (headings.length < 1) { 13245 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-document-outline has-no-headings", children: [ 13246 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EmptyOutlineIllustration, {}), 13247 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 13248 "Navigate the structure of your document and address issues like empty or incorrect heading levels." 13249 ) }) 13250 ] }); 13251 } 13252 const titleNode = document.querySelector(".editor-post-title__input"); 13253 const hasTitle = isTitleSupported && title && titleNode; 13254 const countByLevel = headings.reduce( 13255 (acc, heading) => ({ 13256 ...acc, 13257 [heading.level]: (acc[heading.level] || 0) + 1 13258 }), 13259 {} 13260 ); 13261 const hasMultipleH1 = countByLevel[1] > 1; 13262 function isContentBlock(clientId) { 13263 return Array.isArray(contentBlocks) ? contentBlocks.includes(clientId) : true; 13264 } 13265 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "document-outline", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { children: [ 13266 hasTitle && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13267 item_default, 13268 { 13269 level: (0,external_wp_i18n_namespaceObject.__)("Title"), 13270 isValid: true, 13271 onSelect, 13272 href: `#$titleNode.id}`, 13273 isDisabled: hasOutlineItemsDisabled, 13274 children: title 13275 } 13276 ), 13277 headings.map((item) => { 13278 const isIncorrectLevel = item.level > prevHeadingLevelRef.current + 1; 13279 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); 13280 prevHeadingLevelRef.current = item.level; 13281 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13282 item_default, 13283 { 13284 level: `H$item.level}`, 13285 isValid, 13286 isDisabled: hasOutlineItemsDisabled || !isContentBlock(item.clientId), 13287 href: `#block-$item.clientId}`, 13288 onSelect: () => { 13289 selectBlock(item.clientId); 13290 onSelect?.(); 13291 }, 13292 children: [ 13293 item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)( 13294 (0,external_wp_richText_namespaceObject.create)({ 13295 html: item.attributes.content 13296 }) 13297 ), 13298 isIncorrectLevel && incorrectLevelContent, 13299 item.level === 1 && hasMultipleH1 && multipleH1Headings, 13300 hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings 13301 ] 13302 }, 13303 item.clientId 13304 ); 13305 }) 13306 ] }) }); 13307 } 13308 13309 13310 ;// ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js 13311 13312 13313 function DocumentOutlineCheck({ children }) { 13314 const hasHeadings = (0,external_wp_data_namespaceObject.useSelect)((select) => { 13315 const { getGlobalBlockCount } = select(external_wp_blockEditor_namespaceObject.store); 13316 return getGlobalBlockCount("core/heading") > 0; 13317 }); 13318 if (!hasHeadings) { 13319 return null; 13320 } 13321 return children; 13322 } 13323 13324 13325 ;// ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js 13326 13327 13328 13329 13330 13331 13332 13333 function EditorKeyboardShortcutsRegister() { 13334 const { registerShortcut } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 13335 (0,external_wp_element_namespaceObject.useEffect)(() => { 13336 registerShortcut({ 13337 name: "core/editor/toggle-mode", 13338 category: "global", 13339 description: (0,external_wp_i18n_namespaceObject.__)("Switch between visual editor and code editor."), 13340 keyCombination: { 13341 modifier: "secondary", 13342 character: "m" 13343 } 13344 }); 13345 registerShortcut({ 13346 name: "core/editor/save", 13347 category: "global", 13348 description: (0,external_wp_i18n_namespaceObject.__)("Save your changes."), 13349 keyCombination: { 13350 modifier: "primary", 13351 character: "s" 13352 } 13353 }); 13354 registerShortcut({ 13355 name: "core/editor/undo", 13356 category: "global", 13357 description: (0,external_wp_i18n_namespaceObject.__)("Undo your last changes."), 13358 keyCombination: { 13359 modifier: "primary", 13360 character: "z" 13361 } 13362 }); 13363 registerShortcut({ 13364 name: "core/editor/redo", 13365 category: "global", 13366 description: (0,external_wp_i18n_namespaceObject.__)("Redo your last undo."), 13367 keyCombination: { 13368 modifier: "primaryShift", 13369 character: "z" 13370 }, 13371 // Disable on Apple OS because it conflicts with the browser's 13372 // history shortcut. It's a fine alias for both Windows and Linux. 13373 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 13374 // Linux, we keep it as the default for consistency. 13375 aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [ 13376 { 13377 modifier: "primary", 13378 character: "y" 13379 } 13380 ] 13381 }); 13382 registerShortcut({ 13383 name: "core/editor/toggle-list-view", 13384 category: "global", 13385 description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the List View."), 13386 keyCombination: { 13387 modifier: "access", 13388 character: "o" 13389 } 13390 }); 13391 registerShortcut({ 13392 name: "core/editor/toggle-distraction-free", 13393 category: "global", 13394 description: (0,external_wp_i18n_namespaceObject.__)("Enter or exit distraction free mode."), 13395 keyCombination: { 13396 modifier: "primaryShift", 13397 character: "\\" 13398 } 13399 }); 13400 registerShortcut({ 13401 name: "core/editor/toggle-sidebar", 13402 category: "global", 13403 description: (0,external_wp_i18n_namespaceObject.__)("Show or hide the Settings panel."), 13404 keyCombination: { 13405 modifier: "primaryShift", 13406 character: "," 13407 } 13408 }); 13409 registerShortcut({ 13410 name: "core/editor/keyboard-shortcuts", 13411 category: "main", 13412 description: (0,external_wp_i18n_namespaceObject.__)("Display these keyboard shortcuts."), 13413 keyCombination: { 13414 modifier: "access", 13415 character: "h" 13416 } 13417 }); 13418 registerShortcut({ 13419 name: "core/editor/next-region", 13420 category: "global", 13421 description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the next part of the editor."), 13422 keyCombination: { 13423 modifier: "ctrl", 13424 character: "`" 13425 }, 13426 aliases: [ 13427 { 13428 modifier: "access", 13429 character: "n" 13430 } 13431 ] 13432 }); 13433 registerShortcut({ 13434 name: "core/editor/previous-region", 13435 category: "global", 13436 description: (0,external_wp_i18n_namespaceObject.__)("Navigate to the previous part of the editor."), 13437 keyCombination: { 13438 modifier: "ctrlShift", 13439 character: "`" 13440 }, 13441 aliases: [ 13442 { 13443 modifier: "access", 13444 character: "p" 13445 }, 13446 { 13447 modifier: "ctrlShift", 13448 character: "~" 13449 } 13450 ] 13451 }); 13452 }, [registerShortcut]); 13453 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, {}); 13454 } 13455 var register_shortcuts_default = EditorKeyboardShortcutsRegister; 13456 13457 13458 ;// ./node_modules/@wordpress/icons/build-module/library/redo.js 13459 13460 13461 var redo_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); 13462 13463 13464 ;// ./node_modules/@wordpress/icons/build-module/library/undo.js 13465 13466 13467 var undo_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); 13468 13469 13470 ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js 13471 13472 13473 13474 13475 13476 13477 13478 13479 function EditorHistoryRedo(props, ref) { 13480 const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift("z") : external_wp_keycodes_namespaceObject.displayShortcut.primary("y"); 13481 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)( 13482 (select) => select(store_store).hasEditorRedo(), 13483 [] 13484 ); 13485 const { redo } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 13486 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13487 external_wp_components_namespaceObject.Button, 13488 { 13489 __next40pxDefaultSize: true, 13490 ...props, 13491 ref, 13492 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? redo_default : undo_default, 13493 label: (0,external_wp_i18n_namespaceObject.__)("Redo"), 13494 shortcut, 13495 "aria-disabled": !hasRedo, 13496 onClick: hasRedo ? redo : void 0, 13497 className: "editor-history__redo" 13498 } 13499 ); 13500 } 13501 var redo_redo_default = (0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo); 13502 13503 13504 ;// ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js 13505 13506 13507 13508 13509 13510 13511 13512 13513 function EditorHistoryUndo(props, ref) { 13514 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)( 13515 (select) => select(store_store).hasEditorUndo(), 13516 [] 13517 ); 13518 const { undo } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 13519 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13520 external_wp_components_namespaceObject.Button, 13521 { 13522 __next40pxDefaultSize: true, 13523 ...props, 13524 ref, 13525 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? undo_default : redo_default, 13526 label: (0,external_wp_i18n_namespaceObject.__)("Undo"), 13527 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary("z"), 13528 "aria-disabled": !hasUndo, 13529 onClick: hasUndo ? undo : void 0, 13530 className: "editor-history__undo" 13531 } 13532 ); 13533 } 13534 var undo_undo_default = (0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo); 13535 13536 13537 ;// ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js 13538 13539 13540 13541 13542 13543 13544 function TemplateValidationNotice() { 13545 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 13546 const isValid = (0,external_wp_data_namespaceObject.useSelect)((select) => { 13547 return select(external_wp_blockEditor_namespaceObject.store).isValidTemplate(); 13548 }, []); 13549 const { setTemplateValidity, synchronizeTemplate } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 13550 if (isValid) { 13551 return null; 13552 } 13553 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13554 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13555 external_wp_components_namespaceObject.Notice, 13556 { 13557 className: "editor-template-validation-notice", 13558 isDismissible: false, 13559 status: "warning", 13560 actions: [ 13561 { 13562 label: (0,external_wp_i18n_namespaceObject.__)("Keep it as is"), 13563 onClick: () => setTemplateValidity(true) 13564 }, 13565 { 13566 label: (0,external_wp_i18n_namespaceObject.__)("Reset the template"), 13567 onClick: () => setShowConfirmDialog(true) 13568 } 13569 ], 13570 children: (0,external_wp_i18n_namespaceObject.__)( 13571 "The content of your post doesn\u2019t match the template assigned to your post type." 13572 ) 13573 } 13574 ), 13575 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13576 external_wp_components_namespaceObject.__experimentalConfirmDialog, 13577 { 13578 isOpen: showConfirmDialog, 13579 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Reset"), 13580 onConfirm: () => { 13581 setShowConfirmDialog(false); 13582 synchronizeTemplate(); 13583 }, 13584 onCancel: () => setShowConfirmDialog(false), 13585 size: "medium", 13586 children: (0,external_wp_i18n_namespaceObject.__)( 13587 "Resetting the template may result in loss of content, do you want to continue?" 13588 ) 13589 } 13590 ) 13591 ] }); 13592 } 13593 13594 13595 ;// ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js 13596 13597 13598 13599 13600 13601 function EditorNotices() { 13602 const { notices } = (0,external_wp_data_namespaceObject.useSelect)( 13603 (select) => ({ 13604 notices: select(external_wp_notices_namespaceObject.store).getNotices() 13605 }), 13606 [] 13607 ); 13608 const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 13609 const dismissibleNotices = notices.filter( 13610 ({ isDismissible, type }) => isDismissible && type === "default" 13611 ); 13612 const nonDismissibleNotices = notices.filter( 13613 ({ isDismissible, type }) => !isDismissible && type === "default" 13614 ); 13615 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13616 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13617 external_wp_components_namespaceObject.NoticeList, 13618 { 13619 notices: nonDismissibleNotices, 13620 className: "components-editor-notices__pinned" 13621 } 13622 ), 13623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13624 external_wp_components_namespaceObject.NoticeList, 13625 { 13626 notices: dismissibleNotices, 13627 className: "components-editor-notices__dismissible", 13628 onRemove: removeNotice, 13629 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateValidationNotice, {}) 13630 } 13631 ) 13632 ] }); 13633 } 13634 var editor_notices_default = EditorNotices; 13635 13636 13637 ;// ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js 13638 13639 13640 13641 13642 const MAX_VISIBLE_NOTICES = -3; 13643 function EditorSnackbars() { 13644 const notices = (0,external_wp_data_namespaceObject.useSelect)( 13645 (select) => select(external_wp_notices_namespaceObject.store).getNotices(), 13646 [] 13647 ); 13648 const { removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 13649 const snackbarNotices = notices.filter(({ type }) => type === "snackbar").slice(MAX_VISIBLE_NOTICES); 13650 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13651 external_wp_components_namespaceObject.SnackbarList, 13652 { 13653 notices: snackbarNotices, 13654 className: "components-editor-notices__snackbar", 13655 onRemove: removeNotice 13656 } 13657 ); 13658 } 13659 13660 13661 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 function EntityRecordItem({ record, checked, onChange }) { 13672 const { name, kind, title, key } = record; 13673 const { entityRecordTitle, hasPostMetaChanges } = (0,external_wp_data_namespaceObject.useSelect)( 13674 (select) => { 13675 if ("postType" !== kind || "wp_template" !== name) { 13676 return { 13677 entityRecordTitle: title, 13678 hasPostMetaChanges: unlock( 13679 select(store_store) 13680 ).hasPostMetaChanges(name, key) 13681 }; 13682 } 13683 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( 13684 kind, 13685 name, 13686 key 13687 ); 13688 const { default_template_types: templateTypes = [] } = select(external_wp_coreData_namespaceObject.store).getCurrentTheme() ?? {}; 13689 return { 13690 entityRecordTitle: getTemplateInfo({ 13691 template, 13692 templateTypes 13693 }).title, 13694 hasPostMetaChanges: unlock( 13695 select(store_store) 13696 ).hasPostMetaChanges(name, key) 13697 }; 13698 }, 13699 [name, kind, title, key] 13700 ); 13701 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13702 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13703 external_wp_components_namespaceObject.CheckboxControl, 13704 { 13705 __nextHasNoMarginBottom: true, 13706 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)("Untitled"), 13707 checked, 13708 onChange, 13709 className: "entities-saved-states__change-control" 13710 } 13711 ) }), 13712 hasPostMetaChanges && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "entities-saved-states__changes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: (0,external_wp_i18n_namespaceObject.__)("Post Meta.") }) }) 13713 ] }); 13714 } 13715 13716 13717 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 const { getGlobalStylesChanges, GlobalStylesContext: entity_type_list_GlobalStylesContext } = unlock( 13728 external_wp_blockEditor_namespaceObject.privateApis 13729 ); 13730 function getEntityDescription(entity, count) { 13731 switch (entity) { 13732 case "site": 13733 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."); 13734 case "wp_template": 13735 return (0,external_wp_i18n_namespaceObject.__)( 13736 "This change will affect other parts of your site that use this template." 13737 ); 13738 case "page": 13739 case "post": 13740 return (0,external_wp_i18n_namespaceObject.__)("The following has been modified."); 13741 } 13742 } 13743 function GlobalStylesDescription({ record }) { 13744 const { user: currentEditorGlobalStyles } = (0,external_wp_element_namespaceObject.useContext)(entity_type_list_GlobalStylesContext); 13745 const savedRecord = (0,external_wp_data_namespaceObject.useSelect)( 13746 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecord( 13747 record.kind, 13748 record.name, 13749 record.key 13750 ), 13751 [record.kind, record.name, record.key] 13752 ); 13753 const globalStylesChanges = getGlobalStylesChanges( 13754 currentEditorGlobalStyles, 13755 savedRecord, 13756 { 13757 maxResults: 10 13758 } 13759 ); 13760 return globalStylesChanges.length ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", { className: "entities-saved-states__changes", children: globalStylesChanges.map((change) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: change }, change)) }) : null; 13761 } 13762 function EntityDescription({ record, count }) { 13763 if ("globalStyles" === record?.name) { 13764 return null; 13765 } 13766 const description = getEntityDescription(record?.name, count); 13767 return description ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { children: description }) : null; 13768 } 13769 function EntityTypeList({ 13770 list, 13771 unselectedEntities, 13772 setUnselectedEntities 13773 }) { 13774 const count = list.length; 13775 const firstRecord = list[0]; 13776 const entityConfig = (0,external_wp_data_namespaceObject.useSelect)( 13777 (select) => select(external_wp_coreData_namespaceObject.store).getEntityConfig( 13778 firstRecord.kind, 13779 firstRecord.name 13780 ), 13781 [firstRecord.kind, firstRecord.name] 13782 ); 13783 let entityLabel = entityConfig.label; 13784 if (firstRecord?.name === "wp_template_part") { 13785 entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)("Template Part") : (0,external_wp_i18n_namespaceObject.__)("Template Parts"); 13786 } 13787 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13788 external_wp_components_namespaceObject.PanelBody, 13789 { 13790 title: entityLabel, 13791 initialOpen: true, 13792 className: "entities-saved-states__panel-body", 13793 children: [ 13794 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, { record: firstRecord, count }), 13795 list.map((record) => { 13796 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13797 EntityRecordItem, 13798 { 13799 record, 13800 checked: !unselectedEntities.some( 13801 (elt) => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property 13802 ), 13803 onChange: (value) => setUnselectedEntities(record, value) 13804 }, 13805 record.key || record.property 13806 ); 13807 }), 13808 "globalStyles" === firstRecord?.name && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, { record: firstRecord }) 13809 ] 13810 } 13811 ); 13812 } 13813 13814 13815 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js 13816 13817 13818 13819 const useIsDirty = () => { 13820 const { editedEntities, siteEdits, siteEntityConfig } = (0,external_wp_data_namespaceObject.useSelect)( 13821 (select) => { 13822 const { 13823 __experimentalGetDirtyEntityRecords, 13824 getEntityRecordEdits, 13825 getEntityConfig 13826 } = select(external_wp_coreData_namespaceObject.store); 13827 return { 13828 editedEntities: __experimentalGetDirtyEntityRecords(), 13829 siteEdits: getEntityRecordEdits("root", "site"), 13830 siteEntityConfig: getEntityConfig("root", "site") 13831 }; 13832 }, 13833 [] 13834 ); 13835 const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => { 13836 const editedEntitiesWithoutSite = editedEntities.filter( 13837 (record) => !(record.kind === "root" && record.name === "site") 13838 ); 13839 const siteEntityLabels = siteEntityConfig?.meta?.labels ?? {}; 13840 const editedSiteEntities = []; 13841 for (const property in siteEdits) { 13842 editedSiteEntities.push({ 13843 kind: "root", 13844 name: "site", 13845 title: siteEntityLabels[property] || property, 13846 property 13847 }); 13848 } 13849 return [...editedEntitiesWithoutSite, ...editedSiteEntities]; 13850 }, [editedEntities, siteEdits, siteEntityConfig]); 13851 const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); 13852 const setUnselectedEntities = ({ kind, name, key, property }, checked) => { 13853 if (checked) { 13854 _setUnselectedEntities( 13855 unselectedEntities.filter( 13856 (elt) => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property 13857 ) 13858 ); 13859 } else { 13860 _setUnselectedEntities([ 13861 ...unselectedEntities, 13862 { kind, name, key, property } 13863 ]); 13864 } 13865 }; 13866 const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0; 13867 return { 13868 dirtyEntityRecords, 13869 isDirty, 13870 setUnselectedEntities, 13871 unselectedEntities 13872 }; 13873 }; 13874 13875 13876 ;// ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 function identity(values) { 13889 return values; 13890 } 13891 function EntitiesSavedStates({ 13892 close, 13893 renderDialog, 13894 variant 13895 }) { 13896 const isDirtyProps = useIsDirty(); 13897 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13898 EntitiesSavedStatesExtensible, 13899 { 13900 close, 13901 renderDialog, 13902 variant, 13903 ...isDirtyProps 13904 } 13905 ); 13906 } 13907 function EntitiesSavedStatesExtensible({ 13908 additionalPrompt = void 0, 13909 close, 13910 onSave = identity, 13911 saveEnabled: saveEnabledProp = void 0, 13912 saveLabel = (0,external_wp_i18n_namespaceObject.__)("Save"), 13913 renderDialog, 13914 dirtyEntityRecords, 13915 isDirty, 13916 setUnselectedEntities, 13917 unselectedEntities, 13918 variant = "default" 13919 }) { 13920 const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); 13921 const { saveDirtyEntities } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 13922 const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => { 13923 const { name } = record; 13924 if (!acc[name]) { 13925 acc[name] = []; 13926 } 13927 acc[name].push(record); 13928 return acc; 13929 }, {}); 13930 const { 13931 site: siteSavables, 13932 wp_template: templateSavables, 13933 wp_template_part: templatePartSavables, 13934 ...contentSavables 13935 } = partitionedSavables; 13936 const sortedPartitionedSavables = [ 13937 siteSavables, 13938 templateSavables, 13939 templatePartSavables, 13940 ...Object.values(contentSavables) 13941 ].filter(Array.isArray); 13942 const saveEnabled = saveEnabledProp ?? isDirty; 13943 const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); 13944 const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ 13945 onClose: () => dismissPanel() 13946 }); 13947 const dialogLabelId = (0,external_wp_compose_namespaceObject.useInstanceId)( 13948 EntitiesSavedStatesExtensible, 13949 "entities-saved-states__panel-label" 13950 ); 13951 const dialogDescriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)( 13952 EntitiesSavedStatesExtensible, 13953 "entities-saved-states__panel-description" 13954 ); 13955 const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? (0,external_wp_i18n_namespaceObject.__)("Select the items you want to save.") : void 0; 13956 const isInline = variant === "inline"; 13957 const actionButtons = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 13958 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13959 external_wp_components_namespaceObject.FlexItem, 13960 { 13961 isBlock: isInline ? false : true, 13962 as: external_wp_components_namespaceObject.Button, 13963 variant: isInline ? "tertiary" : "secondary", 13964 size: isInline ? void 0 : "compact", 13965 onClick: dismissPanel, 13966 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 13967 } 13968 ), 13969 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 13970 external_wp_components_namespaceObject.FlexItem, 13971 { 13972 isBlock: isInline ? false : true, 13973 as: external_wp_components_namespaceObject.Button, 13974 ref: saveButtonRef, 13975 variant: "primary", 13976 size: isInline ? void 0 : "compact", 13977 disabled: !saveEnabled, 13978 accessibleWhenDisabled: true, 13979 onClick: () => saveDirtyEntities({ 13980 onSave, 13981 dirtyEntityRecords, 13982 entitiesToSkip: unselectedEntities, 13983 close 13984 }), 13985 className: "editor-entities-saved-states__save-button", 13986 children: saveLabel 13987 } 13988 ) 13989 ] }); 13990 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 13991 "div", 13992 { 13993 ref: renderDialog ? saveDialogRef : void 0, 13994 ...renderDialog && saveDialogProps, 13995 className: dist_clsx("entities-saved-states__panel", { 13996 "is-inline": isInline 13997 }), 13998 role: renderDialog ? "dialog" : void 0, 13999 "aria-labelledby": renderDialog ? dialogLabelId : void 0, 14000 "aria-describedby": renderDialog ? dialogDescriptionId : void 0, 14001 children: [ 14002 !isInline && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { className: "entities-saved-states__panel-header", gap: 2, children: actionButtons }), 14003 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "entities-saved-states__text-prompt", children: [ 14004 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "entities-saved-states__text-prompt--header-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14005 "strong", 14006 { 14007 id: renderDialog ? dialogLabelId : void 0, 14008 className: "entities-saved-states__text-prompt--header", 14009 children: (0,external_wp_i18n_namespaceObject.__)("Are you ready to save?") 14010 } 14011 ) }), 14012 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { id: renderDialog ? dialogDescriptionId : void 0, children: [ 14013 additionalPrompt, 14014 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "entities-saved-states__text-prompt--changes-count", children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)( 14015 (0,external_wp_i18n_namespaceObject.sprintf)( 14016 /* translators: %d: number of site changes waiting to be saved. */ 14017 (0,external_wp_i18n_namespaceObject._n)( 14018 "There is <strong>%d site change</strong> waiting to be saved.", 14019 "There are <strong>%d site changes</strong> waiting to be saved.", 14020 dirtyEntityRecords.length 14021 ), 14022 dirtyEntityRecords.length 14023 ), 14024 { strong: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}) } 14025 ) : selectItemsToSaveDescription }) 14026 ] }) 14027 ] }), 14028 sortedPartitionedSavables.map((list) => { 14029 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14030 EntityTypeList, 14031 { 14032 list, 14033 unselectedEntities, 14034 setUnselectedEntities 14035 }, 14036 list[0].name 14037 ); 14038 }), 14039 isInline && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14040 external_wp_components_namespaceObject.Flex, 14041 { 14042 direction: "row", 14043 justify: "flex-end", 14044 className: "entities-saved-states__panel-footer", 14045 children: actionButtons 14046 } 14047 ) 14048 ] 14049 } 14050 ); 14051 } 14052 14053 14054 ;// ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js 14055 14056 14057 14058 14059 14060 14061 14062 14063 function getContent() { 14064 try { 14065 return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); 14066 } catch (error) { 14067 } 14068 } 14069 function CopyButton({ text, children, variant = "secondary" }) { 14070 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); 14071 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant, ref, children }); 14072 } 14073 class ErrorBoundary extends external_wp_element_namespaceObject.Component { 14074 constructor() { 14075 super(...arguments); 14076 this.state = { 14077 error: null 14078 }; 14079 } 14080 componentDidCatch(error) { 14081 (0,external_wp_hooks_namespaceObject.doAction)("editor.ErrorBoundary.errorLogged", error); 14082 } 14083 static getDerivedStateFromError(error) { 14084 return { error }; 14085 } 14086 render() { 14087 const { error } = this.state; 14088 const { canCopyContent = false } = this.props; 14089 if (!error) { 14090 return this.props.children; 14091 } 14092 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 14093 external_wp_components_namespaceObject.__experimentalHStack, 14094 { 14095 className: "editor-error-boundary", 14096 alignment: "baseline", 14097 spacing: 4, 14098 justify: "space-between", 14099 expanded: false, 14100 wrap: true, 14101 children: [ 14102 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", children: (0,external_wp_i18n_namespaceObject.__)("The editor has encountered an unexpected error.") }), 14103 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { expanded: false, children: [ 14104 canCopyContent && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { text: getContent, children: (0,external_wp_i18n_namespaceObject.__)("Copy contents") }), 14105 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, { variant: "primary", text: error?.stack, children: (0,external_wp_i18n_namespaceObject.__)("Copy error") }) 14106 ] }) 14107 ] 14108 } 14109 ); 14110 } 14111 } 14112 var error_boundary_default = ErrorBoundary; 14113 14114 14115 ;// ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; 14127 let hasStorageSupport; 14128 const hasSessionStorageSupport = () => { 14129 if (hasStorageSupport !== void 0) { 14130 return hasStorageSupport; 14131 } 14132 try { 14133 window.sessionStorage.setItem("__wpEditorTestSessionStorage", ""); 14134 window.sessionStorage.removeItem("__wpEditorTestSessionStorage"); 14135 hasStorageSupport = true; 14136 } catch { 14137 hasStorageSupport = false; 14138 } 14139 return hasStorageSupport; 14140 }; 14141 function useAutosaveNotice() { 14142 const { postId, isEditedPostNew, hasRemoteAutosave } = (0,external_wp_data_namespaceObject.useSelect)( 14143 (select) => ({ 14144 postId: select(store_store).getCurrentPostId(), 14145 isEditedPostNew: select(store_store).isEditedPostNew(), 14146 hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave 14147 }), 14148 [] 14149 ); 14150 const { getEditedPostAttribute } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 14151 const { createWarningNotice, removeNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 14152 const { editPost, resetEditorBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14153 (0,external_wp_element_namespaceObject.useEffect)(() => { 14154 let localAutosave = localAutosaveGet(postId, isEditedPostNew); 14155 if (!localAutosave) { 14156 return; 14157 } 14158 try { 14159 localAutosave = JSON.parse(localAutosave); 14160 } catch { 14161 return; 14162 } 14163 const { post_title: title, content, excerpt } = localAutosave; 14164 const edits = { title, content, excerpt }; 14165 { 14166 const hasDifference = Object.keys(edits).some((key) => { 14167 return edits[key] !== getEditedPostAttribute(key); 14168 }); 14169 if (!hasDifference) { 14170 localAutosaveClear(postId, isEditedPostNew); 14171 return; 14172 } 14173 } 14174 if (hasRemoteAutosave) { 14175 return; 14176 } 14177 const id = "wpEditorAutosaveRestore"; 14178 createWarningNotice( 14179 (0,external_wp_i18n_namespaceObject.__)( 14180 "The backup of this post in your browser is different from the version below." 14181 ), 14182 { 14183 id, 14184 actions: [ 14185 { 14186 label: (0,external_wp_i18n_namespaceObject.__)("Restore the backup"), 14187 onClick() { 14188 const { 14189 content: editsContent, 14190 ...editsWithoutContent 14191 } = edits; 14192 editPost(editsWithoutContent); 14193 resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); 14194 removeNotice(id); 14195 } 14196 } 14197 ] 14198 } 14199 ); 14200 }, [isEditedPostNew, postId]); 14201 } 14202 function useAutosavePurge() { 14203 const { postId, isEditedPostNew, isDirty, isAutosaving, didError } = (0,external_wp_data_namespaceObject.useSelect)( 14204 (select) => ({ 14205 postId: select(store_store).getCurrentPostId(), 14206 isEditedPostNew: select(store_store).isEditedPostNew(), 14207 isDirty: select(store_store).isEditedPostDirty(), 14208 isAutosaving: select(store_store).isAutosavingPost(), 14209 didError: select(store_store).didPostSaveRequestFail() 14210 }), 14211 [] 14212 ); 14213 const lastIsDirtyRef = (0,external_wp_element_namespaceObject.useRef)(isDirty); 14214 const lastIsAutosavingRef = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); 14215 (0,external_wp_element_namespaceObject.useEffect)(() => { 14216 if (!didError && (lastIsAutosavingRef.current && !isAutosaving || lastIsDirtyRef.current && !isDirty)) { 14217 localAutosaveClear(postId, isEditedPostNew); 14218 } 14219 lastIsDirtyRef.current = isDirty; 14220 lastIsAutosavingRef.current = isAutosaving; 14221 }, [isDirty, isAutosaving, didError]); 14222 const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); 14223 const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); 14224 (0,external_wp_element_namespaceObject.useEffect)(() => { 14225 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { 14226 localAutosaveClear(postId, true); 14227 } 14228 }, [isEditedPostNew, postId]); 14229 } 14230 function LocalAutosaveMonitor() { 14231 const { autosave } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14232 const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { 14233 requestIdleCallback(() => autosave({ local: true })); 14234 }, []); 14235 useAutosaveNotice(); 14236 useAutosavePurge(); 14237 const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)( 14238 (select) => select(store_store).getEditorSettings().localAutosaveInterval, 14239 [] 14240 ); 14241 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14242 autosave_monitor_default, 14243 { 14244 interval: localAutosaveInterval, 14245 autosave: deferredAutosave 14246 } 14247 ); 14248 } 14249 var local_autosave_monitor_default = (0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor); 14250 14251 14252 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js 14253 14254 14255 14256 function PageAttributesCheck({ children }) { 14257 const supportsPageAttributes = (0,external_wp_data_namespaceObject.useSelect)((select) => { 14258 const { getEditedPostAttribute } = select(store_store); 14259 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 14260 const postType = getPostType(getEditedPostAttribute("type")); 14261 return !!postType?.supports?.["page-attributes"]; 14262 }, []); 14263 if (!supportsPageAttributes) { 14264 return null; 14265 } 14266 return children; 14267 } 14268 var check_check_default = PageAttributesCheck; 14269 14270 14271 ;// ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js 14272 14273 14274 14275 function checkSupport(supports = {}, key) { 14276 if (supports[key] !== void 0) { 14277 return !!supports[key]; 14278 } 14279 const [topKey, subKey] = key.split("."); 14280 const [subProperties] = Array.isArray(supports[topKey]) ? supports[topKey] : []; 14281 return Array.isArray(subProperties) ? subProperties.includes(subKey) : !!subProperties?.[subKey]; 14282 } 14283 function PostTypeSupportCheck({ children, supportKeys }) { 14284 const postType = (0,external_wp_data_namespaceObject.useSelect)((select) => { 14285 const { getEditedPostAttribute } = select(store_store); 14286 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 14287 return getPostType(getEditedPostAttribute("type")); 14288 }, []); 14289 let isSupported = !!postType; 14290 if (postType) { 14291 isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some((key) => checkSupport(postType.supports, key)); 14292 } 14293 if (!isSupported) { 14294 return null; 14295 } 14296 return children; 14297 } 14298 var post_type_support_check_default = PostTypeSupportCheck; 14299 14300 14301 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js 14302 14303 14304 14305 14306 14307 14308 14309 function PageAttributesOrder() { 14310 const order = (0,external_wp_data_namespaceObject.useSelect)( 14311 (select) => select(store_store).getEditedPostAttribute("menu_order") ?? 0, 14312 [] 14313 ); 14314 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14315 const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); 14316 const setUpdatedOrder = (value2) => { 14317 setOrderInput(value2); 14318 const newOrder = Number(value2); 14319 if (Number.isInteger(newOrder) && value2.trim?.() !== "") { 14320 editPost({ menu_order: newOrder }); 14321 } 14322 }; 14323 const value = orderInput ?? order; 14324 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14325 external_wp_components_namespaceObject.__experimentalNumberControl, 14326 { 14327 __next40pxDefaultSize: true, 14328 label: (0,external_wp_i18n_namespaceObject.__)("Order"), 14329 help: (0,external_wp_i18n_namespaceObject.__)("Set the page order."), 14330 value, 14331 onChange: setUpdatedOrder, 14332 hideLabelFromVision: true, 14333 onBlur: () => { 14334 setOrderInput(null); 14335 } 14336 } 14337 ) }) }); 14338 } 14339 function PageAttributesOrderWithChecks() { 14340 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "page-attributes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesOrder, {}) }); 14341 } 14342 14343 14344 ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-row/index.js 14345 14346 14347 14348 14349 const PostPanelRow = (0,external_wp_element_namespaceObject.forwardRef)(({ className, label, children }, ref) => { 14350 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 14351 external_wp_components_namespaceObject.__experimentalHStack, 14352 { 14353 className: dist_clsx("editor-post-panel__row", className), 14354 ref, 14355 children: [ 14356 label && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-panel__row-label", children: label }), 14357 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-panel__row-control", children }) 14358 ] 14359 } 14360 ); 14361 }); 14362 var post_panel_row_default = PostPanelRow; 14363 14364 14365 ;// ./node_modules/@wordpress/editor/build-module/utils/terms.js 14366 14367 function terms_buildTermsTree(flatTerms) { 14368 const flatTermsWithParentAndChildren = flatTerms.map((term) => { 14369 return { 14370 children: [], 14371 parent: void 0, 14372 ...term 14373 }; 14374 }); 14375 if (flatTermsWithParentAndChildren.some( 14376 ({ parent }) => parent === void 0 14377 )) { 14378 return flatTermsWithParentAndChildren; 14379 } 14380 const termsByParent = flatTermsWithParentAndChildren.reduce( 14381 (acc, term) => { 14382 const { parent } = term; 14383 if (!acc[parent]) { 14384 acc[parent] = []; 14385 } 14386 acc[parent].push(term); 14387 return acc; 14388 }, 14389 {} 14390 ); 14391 const fillWithChildren = (terms) => { 14392 return terms.map((term) => { 14393 const children = termsByParent[term.id]; 14394 return { 14395 ...term, 14396 children: children && children.length ? fillWithChildren(children) : [] 14397 }; 14398 }); 14399 }; 14400 return fillWithChildren(termsByParent["0"] || []); 14401 } 14402 const unescapeString = (arg) => { 14403 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg); 14404 }; 14405 const unescapeTerm = (term) => { 14406 return { 14407 ...term, 14408 name: unescapeString(term.name) 14409 }; 14410 }; 14411 const unescapeTerms = (terms) => { 14412 return (terms ?? []).map(unescapeTerm); 14413 }; 14414 14415 14416 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 function getTitle(post) { 14432 return post?.title?.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#$post.id} (${(0,external_wp_i18n_namespaceObject.__)("no title")})`; 14433 } 14434 const parent_getItemPriority = (name, searchValue) => { 14435 const normalizedName = remove_accents_default()(name || "").toLowerCase(); 14436 const normalizedSearch = remove_accents_default()(searchValue || "").toLowerCase(); 14437 if (normalizedName === normalizedSearch) { 14438 return 0; 14439 } 14440 if (normalizedName.startsWith(normalizedSearch)) { 14441 return normalizedName.length; 14442 } 14443 return Infinity; 14444 }; 14445 function parent_PageAttributesParent() { 14446 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 14447 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); 14448 const { 14449 isHierarchical, 14450 parentPostId, 14451 parentPostTitle, 14452 pageItems, 14453 isLoading 14454 } = (0,external_wp_data_namespaceObject.useSelect)( 14455 (select) => { 14456 const { 14457 getPostType, 14458 getEntityRecords, 14459 getEntityRecord, 14460 isResolving 14461 } = select(external_wp_coreData_namespaceObject.store); 14462 const { getCurrentPostId, getEditedPostAttribute } = select(store_store); 14463 const postTypeSlug = getEditedPostAttribute("type"); 14464 const pageId = getEditedPostAttribute("parent"); 14465 const pType = getPostType(postTypeSlug); 14466 const postId = getCurrentPostId(); 14467 const postIsHierarchical = pType?.hierarchical ?? false; 14468 const query = { 14469 per_page: 100, 14470 exclude: postId, 14471 parent_exclude: postId, 14472 orderby: "menu_order", 14473 order: "asc", 14474 _fields: "id,title,parent" 14475 }; 14476 if (!!fieldValue) { 14477 query.search = fieldValue; 14478 } 14479 const parentPost = pageId ? getEntityRecord("postType", postTypeSlug, pageId) : null; 14480 return { 14481 isHierarchical: postIsHierarchical, 14482 parentPostId: pageId, 14483 parentPostTitle: parentPost ? getTitle(parentPost) : "", 14484 pageItems: postIsHierarchical ? getEntityRecords("postType", postTypeSlug, query) : null, 14485 isLoading: postIsHierarchical ? isResolving("getEntityRecords", [ 14486 "postType", 14487 postTypeSlug, 14488 query 14489 ]) : false 14490 }; 14491 }, 14492 [fieldValue] 14493 ); 14494 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 14495 const getOptionsFromTree = (tree2, level = 0) => { 14496 const mappedNodes = tree2.map((treeNode) => [ 14497 { 14498 value: treeNode.id, 14499 label: "\u2014 ".repeat(level) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name), 14500 rawName: treeNode.name 14501 }, 14502 ...getOptionsFromTree(treeNode.children || [], level + 1) 14503 ]); 14504 const sortedNodes = mappedNodes.sort(([a], [b]) => { 14505 const priorityA = parent_getItemPriority(a.rawName, fieldValue); 14506 const priorityB = parent_getItemPriority(b.rawName, fieldValue); 14507 return priorityA >= priorityB ? 1 : -1; 14508 }); 14509 return sortedNodes.flat(); 14510 }; 14511 if (!pageItems) { 14512 return []; 14513 } 14514 let tree = pageItems.map((item) => ({ 14515 id: item.id, 14516 parent: item.parent, 14517 name: getTitle(item) 14518 })); 14519 if (!fieldValue) { 14520 tree = terms_buildTermsTree(tree); 14521 } 14522 const opts = getOptionsFromTree(tree); 14523 const optsHasParent = opts.find( 14524 (item) => item.value === parentPostId 14525 ); 14526 if (parentPostTitle && !optsHasParent) { 14527 opts.unshift({ 14528 value: parentPostId, 14529 label: parentPostTitle 14530 }); 14531 } 14532 return opts; 14533 }, [pageItems, fieldValue, parentPostTitle, parentPostId]); 14534 if (!isHierarchical) { 14535 return null; 14536 } 14537 const handleKeydown = (inputValue) => { 14538 setFieldValue(inputValue); 14539 }; 14540 const handleChange = (selectedPostId) => { 14541 editPost({ parent: selectedPostId }); 14542 }; 14543 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14544 external_wp_components_namespaceObject.ComboboxControl, 14545 { 14546 __nextHasNoMarginBottom: true, 14547 __next40pxDefaultSize: true, 14548 className: "editor-page-attributes__parent", 14549 label: (0,external_wp_i18n_namespaceObject.__)("Parent"), 14550 help: (0,external_wp_i18n_namespaceObject.__)("Choose a parent page."), 14551 value: parentPostId, 14552 options: parentOptions, 14553 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(handleKeydown, 300), 14554 onChange: handleChange, 14555 hideLabelFromVision: true, 14556 isLoading 14557 } 14558 ); 14559 } 14560 function PostParentToggle({ isOpen, onClick }) { 14561 const parentPost = (0,external_wp_data_namespaceObject.useSelect)((select) => { 14562 const { getEditedPostAttribute } = select(store_store); 14563 const parentPostId = getEditedPostAttribute("parent"); 14564 if (!parentPostId) { 14565 return null; 14566 } 14567 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 14568 const postTypeSlug = getEditedPostAttribute("type"); 14569 return getEntityRecord("postType", postTypeSlug, parentPostId); 14570 }, []); 14571 const parentTitle = (0,external_wp_element_namespaceObject.useMemo)( 14572 () => !parentPost ? (0,external_wp_i18n_namespaceObject.__)("None") : getTitle(parentPost), 14573 [parentPost] 14574 ); 14575 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14576 external_wp_components_namespaceObject.Button, 14577 { 14578 size: "compact", 14579 className: "editor-post-parent__panel-toggle", 14580 variant: "tertiary", 14581 "aria-expanded": isOpen, 14582 "aria-label": ( 14583 // translators: %s: Current post parent. 14584 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Change parent: %s"), parentTitle) 14585 ), 14586 onClick, 14587 children: parentTitle 14588 } 14589 ); 14590 } 14591 function ParentRow() { 14592 const homeUrl = (0,external_wp_data_namespaceObject.useSelect)((select) => { 14593 return select(external_wp_coreData_namespaceObject.store).getEntityRecord("root", "__unstableBase")?.home; 14594 }, []); 14595 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 14596 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 14597 () => ({ 14598 // Anchor the popover to the middle of the entire row so that it doesn't 14599 // move around when the label changes. 14600 anchor: popoverAnchor, 14601 placement: "left-start", 14602 offset: 36, 14603 shift: true 14604 }), 14605 [popoverAnchor] 14606 ); 14607 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Parent"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14608 external_wp_components_namespaceObject.Dropdown, 14609 { 14610 popoverProps, 14611 className: "editor-post-parent__panel-dropdown", 14612 contentClassName: "editor-post-parent__panel-dialog", 14613 focusOnMount: true, 14614 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostParentToggle, { isOpen, onClick: onToggle }), 14615 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-parent", children: [ 14616 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14617 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 14618 { 14619 title: (0,external_wp_i18n_namespaceObject.__)("Parent"), 14620 onClose 14621 } 14622 ), 14623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 14624 (0,external_wp_element_namespaceObject.createInterpolateElement)( 14625 (0,external_wp_i18n_namespaceObject.sprintf)( 14626 /* translators: %s: The home URL of the WordPress installation without the scheme. */ 14627 (0,external_wp_i18n_namespaceObject.__)( 14628 'Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %s<wbr />/services<wbr />/pricing.' 14629 ), 14630 (0,external_wp_url_namespaceObject.filterURLForDisplay)(homeUrl).replace( 14631 /([/.])/g, 14632 "<wbr />$1" 14633 ) 14634 ), 14635 { 14636 wbr: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("wbr", {}) 14637 } 14638 ), 14639 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( 14640 (0,external_wp_i18n_namespaceObject.__)( 14641 "They also show up as sub-items in the default navigation menu. <a>Learn more.</a>" 14642 ), 14643 { 14644 a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14645 external_wp_components_namespaceObject.ExternalLink, 14646 { 14647 href: (0,external_wp_i18n_namespaceObject.__)( 14648 "https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes" 14649 ) 14650 } 14651 ) 14652 } 14653 ) }) 14654 ] }), 14655 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(parent_PageAttributesParent, {}) 14656 ] }) 14657 } 14658 ) }); 14659 } 14660 var parent_parent_default = parent_PageAttributesParent; 14661 14662 14663 ;// ./node_modules/@wordpress/editor/build-module/components/page-attributes/panel.js 14664 14665 14666 14667 14668 14669 14670 const PANEL_NAME = "page-attributes"; 14671 function AttributesPanel() { 14672 const { isEnabled, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 14673 const { getEditedPostAttribute, isEditorPanelEnabled } = select(store_store); 14674 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 14675 return { 14676 isEnabled: isEditorPanelEnabled(PANEL_NAME), 14677 postType: getPostType(getEditedPostAttribute("type")) 14678 }; 14679 }, []); 14680 if (!isEnabled || !postType) { 14681 return null; 14682 } 14683 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ParentRow, {}); 14684 } 14685 function PageAttributesPanel() { 14686 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(AttributesPanel, {}) }); 14687 } 14688 14689 14690 ;// ./node_modules/@wordpress/icons/build-module/library/add-template.js 14691 14692 14693 var add_template_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14694 external_wp_primitives_namespaceObject.Path, 14695 { 14696 fillRule: "evenodd", 14697 clipRule: "evenodd", 14698 d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z" 14699 } 14700 ) }); 14701 14702 14703 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template-modal.js 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)("Custom Template"); 14714 function CreateNewTemplateModal({ onClose }) { 14715 const { defaultBlockTemplate, onNavigateToEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)( 14716 (select) => { 14717 const { getEditorSettings, getCurrentTemplateId } = select(store_store); 14718 return { 14719 defaultBlockTemplate: getEditorSettings().defaultBlockTemplate, 14720 onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, 14721 getTemplateId: getCurrentTemplateId 14722 }; 14723 } 14724 ); 14725 const { createTemplate } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 14726 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(""); 14727 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); 14728 const cancel = () => { 14729 setTitle(""); 14730 onClose(); 14731 }; 14732 const submit = async (event) => { 14733 event.preventDefault(); 14734 if (isBusy) { 14735 return; 14736 } 14737 setIsBusy(true); 14738 const newTemplateContent = defaultBlockTemplate ?? (0,external_wp_blocks_namespaceObject.serialize)([ 14739 (0,external_wp_blocks_namespaceObject.createBlock)( 14740 "core/group", 14741 { 14742 tagName: "header", 14743 layout: { inherit: true } 14744 }, 14745 [ 14746 (0,external_wp_blocks_namespaceObject.createBlock)("core/site-title"), 14747 (0,external_wp_blocks_namespaceObject.createBlock)("core/site-tagline") 14748 ] 14749 ), 14750 (0,external_wp_blocks_namespaceObject.createBlock)("core/separator"), 14751 (0,external_wp_blocks_namespaceObject.createBlock)( 14752 "core/group", 14753 { 14754 tagName: "main" 14755 }, 14756 [ 14757 (0,external_wp_blocks_namespaceObject.createBlock)( 14758 "core/group", 14759 { 14760 layout: { inherit: true } 14761 }, 14762 [(0,external_wp_blocks_namespaceObject.createBlock)("core/post-title")] 14763 ), 14764 (0,external_wp_blocks_namespaceObject.createBlock)("core/post-content", { 14765 layout: { inherit: true } 14766 }) 14767 ] 14768 ) 14769 ]); 14770 const newTemplate = await createTemplate({ 14771 slug: paramCase(title || DEFAULT_TITLE) || "wp-custom-template", 14772 content: newTemplateContent, 14773 title: title || DEFAULT_TITLE, 14774 status: "publish" 14775 }); 14776 setIsBusy(false); 14777 onNavigateToEntityRecord({ 14778 postId: newTemplate.id, 14779 postType: "wp_template" 14780 }); 14781 cancel(); 14782 }; 14783 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14784 external_wp_components_namespaceObject.Modal, 14785 { 14786 title: (0,external_wp_i18n_namespaceObject.__)("Create custom template"), 14787 onRequestClose: cancel, 14788 focusOnMount: "firstContentElement", 14789 size: "small", 14790 overlayClassName: "editor-post-template__create-template-modal", 14791 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14792 "form", 14793 { 14794 className: "editor-post-template__create-form", 14795 onSubmit: submit, 14796 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "3", children: [ 14797 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14798 external_wp_components_namespaceObject.TextControl, 14799 { 14800 __next40pxDefaultSize: true, 14801 __nextHasNoMarginBottom: true, 14802 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 14803 value: title, 14804 onChange: setTitle, 14805 placeholder: DEFAULT_TITLE, 14806 disabled: isBusy, 14807 help: (0,external_wp_i18n_namespaceObject.__)( 14808 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 14809 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.' 14810 ) 14811 } 14812 ), 14813 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 14814 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14815 external_wp_components_namespaceObject.Button, 14816 { 14817 __next40pxDefaultSize: true, 14818 variant: "tertiary", 14819 onClick: cancel, 14820 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 14821 } 14822 ), 14823 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14824 external_wp_components_namespaceObject.Button, 14825 { 14826 __next40pxDefaultSize: true, 14827 variant: "primary", 14828 type: "submit", 14829 isBusy, 14830 "aria-disabled": isBusy, 14831 children: (0,external_wp_i18n_namespaceObject.__)("Create") 14832 } 14833 ) 14834 ] }) 14835 ] }) 14836 } 14837 ) 14838 } 14839 ); 14840 } 14841 14842 14843 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/hooks.js 14844 14845 14846 14847 14848 function useEditedPostContext() { 14849 return (0,external_wp_data_namespaceObject.useSelect)((select) => { 14850 const { getCurrentPostId, getCurrentPostType } = select(store_store); 14851 return { 14852 postId: getCurrentPostId(), 14853 postType: getCurrentPostType() 14854 }; 14855 }, []); 14856 } 14857 function useAllowSwitchingTemplates() { 14858 const { postType, postId } = useEditedPostContext(); 14859 return (0,external_wp_data_namespaceObject.useSelect)( 14860 (select) => { 14861 const { canUser, getEntityRecord, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); 14862 const siteSettings = canUser("read", { 14863 kind: "root", 14864 name: "site" 14865 }) ? getEntityRecord("root", "site") : void 0; 14866 const isPostsPage = +postId === siteSettings?.page_for_posts; 14867 const isFrontPage = postType === "page" && +postId === siteSettings?.page_on_front; 14868 const templates = isFrontPage ? getEntityRecords("postType", "wp_template", { 14869 per_page: -1 14870 }) : []; 14871 const hasFrontPage = isFrontPage && !!templates?.some(({ slug }) => slug === "front-page"); 14872 return !isPostsPage && !hasFrontPage; 14873 }, 14874 [postId, postType] 14875 ); 14876 } 14877 function useTemplates(postType) { 14878 return (0,external_wp_data_namespaceObject.useSelect)( 14879 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", "wp_template", { 14880 per_page: -1, 14881 post_type: postType 14882 // We look at the combined templates for now (old endpoint) 14883 // because posts only accept slugs for templates, not IDs. 14884 }), 14885 [postType] 14886 ); 14887 } 14888 function useAvailableTemplates(postType) { 14889 const currentTemplateSlug = useCurrentTemplateSlug(); 14890 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 14891 const templates = useTemplates(postType); 14892 return (0,external_wp_element_namespaceObject.useMemo)( 14893 () => allowSwitchingTemplate && templates?.filter( 14894 (template) => (template.is_custom || template.type === "wp_template") && template.slug !== currentTemplateSlug && !!template.content.raw 14895 // Skip empty templates. 14896 ), 14897 [templates, currentTemplateSlug, allowSwitchingTemplate] 14898 ); 14899 } 14900 function useCurrentTemplateSlug() { 14901 const { postType, postId } = useEditedPostContext(); 14902 const templates = useTemplates(postType); 14903 const entityTemplate = (0,external_wp_data_namespaceObject.useSelect)( 14904 (select) => { 14905 const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord( 14906 "postType", 14907 postType, 14908 postId 14909 ); 14910 return post?.template; 14911 }, 14912 [postType, postId] 14913 ); 14914 if (!entityTemplate) { 14915 return; 14916 } 14917 return templates?.find((template) => template.slug === entityTemplate)?.slug; 14918 } 14919 14920 14921 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/classic-theme.js 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 function PostTemplateToggle({ isOpen, onClick }) { 14936 const templateTitle = (0,external_wp_data_namespaceObject.useSelect)((select) => { 14937 const templateSlug = select(store_store).getEditedPostAttribute("template"); 14938 const { supportsTemplateMode, availableTemplates } = select(store_store).getEditorSettings(); 14939 if (!supportsTemplateMode && availableTemplates[templateSlug]) { 14940 return availableTemplates[templateSlug]; 14941 } 14942 const template = select(external_wp_coreData_namespaceObject.store).canUser("create", { 14943 kind: "postType", 14944 name: "wp_template" 14945 }) && select(store_store).getCurrentTemplateId(); 14946 return template?.title || template?.slug || availableTemplates?.[templateSlug]; 14947 }, []); 14948 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 14949 external_wp_components_namespaceObject.Button, 14950 { 14951 __next40pxDefaultSize: true, 14952 variant: "tertiary", 14953 "aria-expanded": isOpen, 14954 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Template options"), 14955 onClick, 14956 children: templateTitle ?? (0,external_wp_i18n_namespaceObject.__)("Default template") 14957 } 14958 ); 14959 } 14960 function PostTemplateDropdownContent({ onClose }) { 14961 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 14962 const { 14963 availableTemplates, 14964 fetchedTemplates, 14965 selectedTemplateSlug, 14966 canCreate, 14967 canEdit, 14968 currentTemplateId, 14969 onNavigateToEntityRecord, 14970 getEditorSettings 14971 } = (0,external_wp_data_namespaceObject.useSelect)( 14972 (select) => { 14973 const { canUser, getEntityRecords } = select(external_wp_coreData_namespaceObject.store); 14974 const editorSettings = select(store_store).getEditorSettings(); 14975 const canCreateTemplates = canUser("create", { 14976 kind: "postType", 14977 name: "wp_template" 14978 }); 14979 const _currentTemplateId = select(store_store).getCurrentTemplateId(); 14980 return { 14981 availableTemplates: editorSettings.availableTemplates, 14982 fetchedTemplates: canCreateTemplates ? getEntityRecords("postType", "wp_template", { 14983 post_type: select(store_store).getCurrentPostType(), 14984 per_page: -1 14985 }) : void 0, 14986 selectedTemplateSlug: select(store_store).getEditedPostAttribute("template"), 14987 canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode, 14988 canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId, 14989 currentTemplateId: _currentTemplateId, 14990 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 14991 getEditorSettings: select(store_store).getEditorSettings 14992 }; 14993 }, 14994 [allowSwitchingTemplate] 14995 ); 14996 const options = (0,external_wp_element_namespaceObject.useMemo)( 14997 () => Object.entries({ 14998 ...availableTemplates, 14999 ...Object.fromEntries( 15000 (fetchedTemplates ?? []).map(({ slug, title }) => [ 15001 slug, 15002 title.rendered 15003 ]) 15004 ) 15005 }).map(([slug, title]) => ({ value: slug, label: title })), 15006 [availableTemplates, fetchedTemplates] 15007 ); 15008 const selectedOption = options.find((option) => option.value === selectedTemplateSlug) ?? options.find((option) => !option.value); 15009 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15010 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 15011 const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 15012 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-template__classic-theme-dropdown", children: [ 15013 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15014 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 15015 { 15016 title: (0,external_wp_i18n_namespaceObject.__)("Template"), 15017 help: (0,external_wp_i18n_namespaceObject.__)( 15018 "Templates define the way content is displayed when viewing your site." 15019 ), 15020 actions: canCreate ? [ 15021 { 15022 icon: add_template_default, 15023 label: (0,external_wp_i18n_namespaceObject.__)("Add template"), 15024 onClick: () => setIsCreateModalOpen(true) 15025 } 15026 ] : [], 15027 onClose 15028 } 15029 ), 15030 !allowSwitchingTemplate ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, { status: "warning", isDismissible: false, children: (0,external_wp_i18n_namespaceObject.__)("The posts page template cannot be changed.") }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15031 external_wp_components_namespaceObject.SelectControl, 15032 { 15033 __next40pxDefaultSize: true, 15034 __nextHasNoMarginBottom: true, 15035 hideLabelFromVision: true, 15036 label: (0,external_wp_i18n_namespaceObject.__)("Template"), 15037 value: selectedOption?.value ?? "", 15038 options, 15039 onChange: (slug) => editPost({ template: slug || "" }) 15040 } 15041 ), 15042 canEdit && onNavigateToEntityRecord && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15043 external_wp_components_namespaceObject.Button, 15044 { 15045 __next40pxDefaultSize: true, 15046 variant: "link", 15047 onClick: () => { 15048 onNavigateToEntityRecord({ 15049 postId: currentTemplateId, 15050 postType: "wp_template" 15051 }); 15052 onClose(); 15053 createSuccessNotice( 15054 (0,external_wp_i18n_namespaceObject.__)( 15055 "Editing template. Changes made here affect all posts and pages that use the template." 15056 ), 15057 { 15058 type: "snackbar", 15059 actions: [ 15060 { 15061 label: (0,external_wp_i18n_namespaceObject.__)("Go back"), 15062 onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() 15063 } 15064 ] 15065 } 15066 ); 15067 }, 15068 children: (0,external_wp_i18n_namespaceObject.__)("Edit template") 15069 } 15070 ) }), 15071 isCreateModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15072 CreateNewTemplateModal, 15073 { 15074 onClose: () => setIsCreateModalOpen(false) 15075 } 15076 ) 15077 ] }); 15078 } 15079 function ClassicThemeControl() { 15080 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 15081 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 15082 () => ({ 15083 // Anchor the popover to the middle of the entire row so that it doesn't 15084 // move around when the label changes. 15085 anchor: popoverAnchor, 15086 className: "editor-post-template__dropdown", 15087 placement: "left-start", 15088 offset: 36, 15089 shift: true 15090 }), 15091 [popoverAnchor] 15092 ); 15093 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Template"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15094 external_wp_components_namespaceObject.Dropdown, 15095 { 15096 popoverProps, 15097 focusOnMount: true, 15098 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15099 PostTemplateToggle, 15100 { 15101 isOpen, 15102 onClick: onToggle 15103 } 15104 ), 15105 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplateDropdownContent, { onClose }) 15106 } 15107 ) }); 15108 } 15109 var classic_theme_default = ClassicThemeControl; 15110 15111 15112 ;// external ["wp","warning"] 15113 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 15114 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 15115 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-panel.js 15116 15117 15118 15119 15120 15121 const { PreferenceBaseOption } = unlock(external_wp_preferences_namespaceObject.privateApis); 15122 function EnablePanelOption(props) { 15123 const { toggleEditorPanelEnabled } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15124 const { isChecked, isRemoved } = (0,external_wp_data_namespaceObject.useSelect)( 15125 (select) => { 15126 const { isEditorPanelEnabled, isEditorPanelRemoved } = select(store_store); 15127 return { 15128 isChecked: isEditorPanelEnabled(props.panelName), 15129 isRemoved: isEditorPanelRemoved(props.panelName) 15130 }; 15131 }, 15132 [props.panelName] 15133 ); 15134 if (isRemoved) { 15135 return null; 15136 } 15137 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15138 PreferenceBaseOption, 15139 { 15140 isChecked, 15141 onChange: () => toggleEditorPanelEnabled(props.panelName), 15142 ...props 15143 } 15144 ); 15145 } 15146 15147 15148 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js 15149 15150 15151 15152 const { Fill, Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( 15153 "EnablePluginDocumentSettingPanelOption" 15154 ); 15155 const EnablePluginDocumentSettingPanelOption = ({ label, panelName }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EnablePanelOption, { label, panelName }) }); 15156 EnablePluginDocumentSettingPanelOption.Slot = Slot; 15157 var enable_plugin_document_setting_panel_default = EnablePluginDocumentSettingPanelOption; 15158 15159 15160 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-document-setting-panel/index.js 15161 15162 15163 15164 15165 15166 15167 15168 const { Fill: plugin_document_setting_panel_Fill, Slot: plugin_document_setting_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginDocumentSettingPanel"); 15169 const PluginDocumentSettingPanel = ({ 15170 name, 15171 className, 15172 title, 15173 icon, 15174 children 15175 }) => { 15176 const { name: pluginName } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 15177 const panelName = `$pluginName}/$name}`; 15178 const { opened, isEnabled } = (0,external_wp_data_namespaceObject.useSelect)( 15179 (select) => { 15180 const { isEditorPanelOpened, isEditorPanelEnabled } = select(store_store); 15181 return { 15182 opened: isEditorPanelOpened(panelName), 15183 isEnabled: isEditorPanelEnabled(panelName) 15184 }; 15185 }, 15186 [panelName] 15187 ); 15188 const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15189 if (void 0 === name) { 15190 external_wp_warning_default()("PluginDocumentSettingPanel requires a name property."); 15191 } 15192 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 15193 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15194 enable_plugin_document_setting_panel_default, 15195 { 15196 label: title, 15197 panelName 15198 } 15199 ), 15200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_Fill, { children: isEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15201 external_wp_components_namespaceObject.PanelBody, 15202 { 15203 className, 15204 title, 15205 icon, 15206 opened, 15207 onToggle: () => toggleEditorPanelOpened(panelName), 15208 children 15209 } 15210 ) }) 15211 ] }); 15212 }; 15213 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; 15214 var plugin_document_setting_panel_default = PluginDocumentSettingPanel; 15215 15216 15217 ;// ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js 15218 15219 15220 15221 15222 const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter((id) => !allowed.includes(id)).length === 0; 15223 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); 15224 const PluginBlockSettingsMenuItem = ({ 15225 allowedBlocks, 15226 icon, 15227 label, 15228 onClick, 15229 small, 15230 role 15231 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedBlocks, onClose }) => { 15232 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { 15233 return null; 15234 } 15235 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15236 external_wp_components_namespaceObject.MenuItem, 15237 { 15238 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), 15239 icon, 15240 label: small ? label : void 0, 15241 role, 15242 children: !small && label 15243 } 15244 ); 15245 } }); 15246 var plugin_block_settings_menu_item_default = PluginBlockSettingsMenuItem; 15247 15248 15249 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-more-menu-item/index.js 15250 15251 15252 15253 15254 function PluginMoreMenuItem(props) { 15255 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 15256 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15257 action_item_default, 15258 { 15259 name: "core/plugin-more-menu", 15260 as: props.as ?? external_wp_components_namespaceObject.MenuItem, 15261 icon: props.icon || context.icon, 15262 ...props 15263 } 15264 ); 15265 } 15266 15267 15268 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-publish-panel/index.js 15269 15270 15271 15272 const { Fill: plugin_post_publish_panel_Fill, Slot: plugin_post_publish_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPostPublishPanel"); 15273 const PluginPostPublishPanel = ({ 15274 children, 15275 className, 15276 title, 15277 initialOpen = false, 15278 icon 15279 }) => { 15280 const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 15281 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_publish_panel_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15282 external_wp_components_namespaceObject.PanelBody, 15283 { 15284 className, 15285 initialOpen: initialOpen || !title, 15286 title, 15287 icon: icon ?? pluginIcon, 15288 children 15289 } 15290 ) }); 15291 }; 15292 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; 15293 var plugin_post_publish_panel_default = PluginPostPublishPanel; 15294 15295 15296 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-post-status-info/index.js 15297 15298 15299 const { Fill: plugin_post_status_info_Fill, Slot: plugin_post_status_info_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPostStatusInfo"); 15300 const PluginPostStatusInfo = ({ children, className }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { className, children }) }); 15301 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; 15302 var plugin_post_status_info_default = PluginPostStatusInfo; 15303 15304 15305 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-pre-publish-panel/index.js 15306 15307 15308 15309 const { Fill: plugin_pre_publish_panel_Fill, Slot: plugin_pre_publish_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPrePublishPanel"); 15310 const PluginPrePublishPanel = ({ 15311 children, 15312 className, 15313 title, 15314 initialOpen = false, 15315 icon 15316 }) => { 15317 const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 15318 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_pre_publish_panel_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15319 external_wp_components_namespaceObject.PanelBody, 15320 { 15321 className, 15322 initialOpen: initialOpen || !title, 15323 title, 15324 icon: icon ?? pluginIcon, 15325 children 15326 } 15327 ) }); 15328 }; 15329 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; 15330 var plugin_pre_publish_panel_default = PluginPrePublishPanel; 15331 15332 15333 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-preview-menu-item/index.js 15334 15335 15336 15337 15338 function PluginPreviewMenuItem(props) { 15339 const context = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 15340 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15341 action_item_default, 15342 { 15343 name: "core/plugin-preview-menu", 15344 as: props.as ?? external_wp_components_namespaceObject.MenuItem, 15345 icon: props.icon || context.icon, 15346 ...props 15347 } 15348 ); 15349 } 15350 15351 15352 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar/index.js 15353 15354 15355 function PluginSidebar({ className, ...props }) { 15356 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15357 complementary_area_default, 15358 { 15359 panelClassName: className, 15360 className: "editor-sidebar", 15361 scope: "core", 15362 ...props 15363 } 15364 ); 15365 } 15366 15367 15368 ;// ./node_modules/@wordpress/editor/build-module/components/plugin-sidebar-more-menu-item/index.js 15369 15370 15371 function PluginSidebarMoreMenuItem(props) { 15372 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15373 ComplementaryAreaMoreMenuItem, 15374 { 15375 __unstableExplicitMenuItem: true, 15376 scope: "core", 15377 ...props 15378 } 15379 ); 15380 } 15381 15382 15383 ;// ./node_modules/@wordpress/editor/build-module/utils/search-templates.js 15384 15385 function normalizeSearchInput(input = "") { 15386 input = remove_accents_default()(input); 15387 input = input.trim().toLowerCase(); 15388 return input; 15389 } 15390 function getTemplateSearchRank(template, searchValue) { 15391 const normalizedSearchValue = normalizeSearchInput(searchValue); 15392 const normalizedTitle = normalizeSearchInput(template.title); 15393 let rank = 0; 15394 if (normalizedSearchValue === normalizedTitle) { 15395 rank += 30; 15396 } else if (normalizedTitle.startsWith(normalizedSearchValue)) { 15397 rank += 20; 15398 } else { 15399 const searchTerms = normalizedSearchValue.split(" "); 15400 const hasMatchedTerms = searchTerms.every( 15401 (searchTerm) => normalizedTitle.includes(searchTerm) 15402 ); 15403 if (hasMatchedTerms) { 15404 rank += 10; 15405 } 15406 } 15407 return rank; 15408 } 15409 function searchTemplates(templates = [], searchValue = "") { 15410 if (!searchValue) { 15411 return templates; 15412 } 15413 const rankedTemplates = templates.map((template) => { 15414 return [template, getTemplateSearchRank(template, searchValue)]; 15415 }).filter(([, rank]) => rank > 0); 15416 rankedTemplates.sort(([, rank1], [, rank2]) => rank2 - rank1); 15417 return rankedTemplates.map(([template]) => template); 15418 } 15419 15420 15421 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/swap-template-button.js 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 function SwapTemplateButton({ onClick }) { 15434 const [showModal, setShowModal] = (0,external_wp_element_namespaceObject.useState)(false); 15435 const { postType, postId } = useEditedPostContext(); 15436 const availableTemplates = useAvailableTemplates(postType); 15437 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 15438 const onTemplateSelect = async (template) => { 15439 editEntityRecord( 15440 "postType", 15441 postType, 15442 postId, 15443 { template: template.name }, 15444 { undoIgnore: true } 15445 ); 15446 setShowModal(false); 15447 onClick(); 15448 }; 15449 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 15450 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15451 external_wp_components_namespaceObject.MenuItem, 15452 { 15453 disabled: !availableTemplates?.length, 15454 accessibleWhenDisabled: true, 15455 onClick: () => setShowModal(true), 15456 children: (0,external_wp_i18n_namespaceObject.__)("Change template") 15457 } 15458 ), 15459 showModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15460 external_wp_components_namespaceObject.Modal, 15461 { 15462 title: (0,external_wp_i18n_namespaceObject.__)("Choose a template"), 15463 onRequestClose: () => setShowModal(false), 15464 overlayClassName: "editor-post-template__swap-template-modal", 15465 isFullScreen: true, 15466 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-template__swap-template-modal-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15467 TemplatesList, 15468 { 15469 postType, 15470 onSelect: onTemplateSelect 15471 } 15472 ) }) 15473 } 15474 ) 15475 ] }); 15476 } 15477 function TemplatesList({ postType, onSelect }) { 15478 const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)(""); 15479 const availableTemplates = useAvailableTemplates(postType); 15480 const templatesAsPatterns = (0,external_wp_element_namespaceObject.useMemo)( 15481 () => availableTemplates.map((template) => ({ 15482 name: template.slug, 15483 blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content.raw), 15484 title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title.rendered), 15485 id: template.id 15486 })), 15487 [availableTemplates] 15488 ); 15489 const filteredBlockTemplates = (0,external_wp_element_namespaceObject.useMemo)(() => { 15490 return searchTemplates(templatesAsPatterns, searchValue); 15491 }, [templatesAsPatterns, searchValue]); 15492 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 15493 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15494 external_wp_components_namespaceObject.SearchControl, 15495 { 15496 __nextHasNoMarginBottom: true, 15497 onChange: setSearchValue, 15498 value: searchValue, 15499 label: (0,external_wp_i18n_namespaceObject.__)("Search"), 15500 placeholder: (0,external_wp_i18n_namespaceObject.__)("Search"), 15501 className: "editor-post-template__swap-template-search" 15502 } 15503 ), 15504 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15505 external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, 15506 { 15507 label: (0,external_wp_i18n_namespaceObject.__)("Templates"), 15508 blockPatterns: filteredBlockTemplates, 15509 onClickPattern: onSelect 15510 } 15511 ) 15512 ] }); 15513 } 15514 15515 15516 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/reset-default-template.js 15517 15518 15519 15520 15521 15522 15523 function ResetDefaultTemplate({ onClick }) { 15524 const currentTemplateSlug = useCurrentTemplateSlug(); 15525 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 15526 const { postType, postId } = useEditedPostContext(); 15527 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 15528 if (!currentTemplateSlug || !allowSwitchingTemplate) { 15529 return null; 15530 } 15531 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15532 external_wp_components_namespaceObject.MenuItem, 15533 { 15534 onClick: () => { 15535 editEntityRecord( 15536 "postType", 15537 postType, 15538 postId, 15539 { template: "" }, 15540 { undoIgnore: true } 15541 ); 15542 onClick(); 15543 }, 15544 children: (0,external_wp_i18n_namespaceObject.__)("Use default template") 15545 } 15546 ); 15547 } 15548 15549 15550 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/create-new-template.js 15551 15552 15553 15554 15555 15556 15557 15558 15559 function CreateNewTemplate() { 15560 const { canCreateTemplates } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15561 const { canUser } = select(external_wp_coreData_namespaceObject.store); 15562 return { 15563 canCreateTemplates: canUser("create", { 15564 kind: "postType", 15565 name: "wp_template" 15566 }) 15567 }; 15568 }, []); 15569 const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 15570 const allowSwitchingTemplate = useAllowSwitchingTemplates(); 15571 if (!canCreateTemplates || !allowSwitchingTemplate) { 15572 return null; 15573 } 15574 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 15575 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15576 external_wp_components_namespaceObject.MenuItem, 15577 { 15578 onClick: () => { 15579 setIsCreateModalOpen(true); 15580 }, 15581 children: (0,external_wp_i18n_namespaceObject.__)("Create new template") 15582 } 15583 ), 15584 isCreateModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15585 CreateNewTemplateModal, 15586 { 15587 onClose: () => { 15588 setIsCreateModalOpen(false); 15589 } 15590 } 15591 ) 15592 ] }); 15593 } 15594 15595 15596 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/block-theme.js 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 function BlockThemeControl({ id }) { 15614 const { 15615 isTemplateHidden, 15616 onNavigateToEntityRecord, 15617 getEditorSettings, 15618 hasGoBack, 15619 hasSpecificTemplate 15620 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15621 const { 15622 getRenderingMode, 15623 getEditorSettings: _getEditorSettings, 15624 getCurrentPost 15625 } = unlock(select(store_store)); 15626 const editorSettings = _getEditorSettings(); 15627 const currentPost = getCurrentPost(); 15628 return { 15629 isTemplateHidden: getRenderingMode() === "post-only", 15630 onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord, 15631 getEditorSettings: _getEditorSettings, 15632 hasGoBack: editorSettings.hasOwnProperty( 15633 "onNavigateToPreviousEntityRecord" 15634 ), 15635 hasSpecificTemplate: !!currentPost.template 15636 }; 15637 }, []); 15638 const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 15639 const { editedRecord: template, hasResolved } = (0,external_wp_coreData_namespaceObject.useEntityRecord)( 15640 "postType", 15641 "wp_template", 15642 id 15643 ); 15644 const { getEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 15645 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 15646 const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 15647 const { setRenderingMode, setDefaultRenderingMode } = unlock( 15648 (0,external_wp_data_namespaceObject.useDispatch)(store_store) 15649 ); 15650 const canCreateTemplate = (0,external_wp_data_namespaceObject.useSelect)( 15651 (select) => !!select(external_wp_coreData_namespaceObject.store).canUser("create", { 15652 kind: "postType", 15653 name: "wp_template" 15654 }), 15655 [] 15656 ); 15657 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 15658 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 15659 () => ({ 15660 // Anchor the popover to the middle of the entire row so that it doesn't 15661 // move around when the label changes. 15662 anchor: popoverAnchor, 15663 className: "editor-post-template__dropdown", 15664 placement: "left-start", 15665 offset: 36, 15666 shift: true 15667 }), 15668 [popoverAnchor] 15669 ); 15670 if (!hasResolved) { 15671 return null; 15672 } 15673 const notificationAction = hasGoBack ? [ 15674 { 15675 label: (0,external_wp_i18n_namespaceObject.__)("Go back"), 15676 onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord() 15677 } 15678 ] : void 0; 15679 const mayShowTemplateEditNotice = () => { 15680 if (!getPreference("core/edit-site", "welcomeGuideTemplate")) { 15681 createSuccessNotice( 15682 (0,external_wp_i18n_namespaceObject.__)( 15683 "Editing template. Changes made here affect all posts and pages that use the template." 15684 ), 15685 { type: "snackbar", actions: notificationAction } 15686 ); 15687 } 15688 }; 15689 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Template"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15690 external_wp_components_namespaceObject.DropdownMenu, 15691 { 15692 popoverProps, 15693 focusOnMount: true, 15694 toggleProps: { 15695 size: "compact", 15696 variant: "tertiary", 15697 tooltipPosition: "middle left" 15698 }, 15699 label: (0,external_wp_i18n_namespaceObject.__)("Template options"), 15700 text: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(template.title), 15701 icon: null, 15702 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 15703 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { children: [ 15704 canCreateTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15705 external_wp_components_namespaceObject.MenuItem, 15706 { 15707 onClick: async () => { 15708 onNavigateToEntityRecord({ 15709 postId: template.id, 15710 postType: "wp_template" 15711 }); 15712 if (!hasSpecificTemplate) { 15713 const activeTemplates = await getEntityRecord( 15714 "root", 15715 "site" 15716 ).active_templates; 15717 if (activeTemplates[template.slug] !== template.id) { 15718 editEntityRecord( 15719 "root", 15720 "site", 15721 void 0, 15722 { 15723 active_templates: { 15724 ...activeTemplates, 15725 [template.slug]: template.id 15726 } 15727 } 15728 ); 15729 } 15730 } 15731 onClose(); 15732 mayShowTemplateEditNotice(); 15733 }, 15734 children: (0,external_wp_i18n_namespaceObject.__)("Edit template") 15735 } 15736 ), 15737 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SwapTemplateButton, { onClick: onClose }), 15738 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ResetDefaultTemplate, { onClick: onClose }), 15739 canCreateTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CreateNewTemplate, {}) 15740 ] }), 15741 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15742 external_wp_components_namespaceObject.MenuItem, 15743 { 15744 icon: !isTemplateHidden ? check_default : void 0, 15745 isSelected: !isTemplateHidden, 15746 role: "menuitemcheckbox", 15747 onClick: () => { 15748 const newRenderingMode = isTemplateHidden ? "template-locked" : "post-only"; 15749 setRenderingMode(newRenderingMode); 15750 setDefaultRenderingMode(newRenderingMode); 15751 }, 15752 children: (0,external_wp_i18n_namespaceObject.__)("Show template") 15753 } 15754 ) }) 15755 ] }) 15756 } 15757 ) }); 15758 } 15759 15760 15761 ;// ./node_modules/@wordpress/editor/build-module/components/post-template/panel.js 15762 15763 15764 15765 15766 15767 15768 function PostTemplatePanel() { 15769 const { templateId, isBlockTheme } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15770 const { getCurrentTemplateId, getEditorSettings } = select(store_store); 15771 return { 15772 templateId: getCurrentTemplateId(), 15773 isBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme 15774 }; 15775 }, []); 15776 const isVisible = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15777 const postTypeSlug = select(store_store).getCurrentPostType(); 15778 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 15779 if (!postType?.viewable) { 15780 return false; 15781 } 15782 const settings = select(store_store).getEditorSettings(); 15783 const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0; 15784 if (hasTemplates) { 15785 return true; 15786 } 15787 if (!settings.supportsTemplateMode) { 15788 return false; 15789 } 15790 const canCreateTemplates = select(external_wp_coreData_namespaceObject.store).canUser("create", { 15791 kind: "postType", 15792 name: "wp_template" 15793 }) ?? false; 15794 return canCreateTemplates; 15795 }, []); 15796 const canViewTemplates = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15797 return select(external_wp_coreData_namespaceObject.store).canUser("read", { 15798 kind: "postType", 15799 name: "wp_template" 15800 }) ?? false; 15801 }, []); 15802 if ((!isBlockTheme || !canViewTemplates) && isVisible) { 15803 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(classic_theme_default, {}); 15804 } 15805 if (isBlockTheme && !!templateId) { 15806 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockThemeControl, { id: templateId }); 15807 } 15808 return null; 15809 } 15810 15811 15812 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js 15813 const BASE_QUERY = { 15814 _fields: "id,name", 15815 context: "view" 15816 // Allows non-admins to perform requests. 15817 }; 15818 const AUTHORS_QUERY = { 15819 who: "authors", 15820 per_page: 100, 15821 ...BASE_QUERY 15822 }; 15823 15824 15825 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/hook.js 15826 15827 15828 15829 15830 15831 15832 15833 function useAuthorsQuery(search) { 15834 const { authorId, authors, postAuthor, isLoading } = (0,external_wp_data_namespaceObject.useSelect)( 15835 (select) => { 15836 const { getUser, getUsers, isResolving } = select(external_wp_coreData_namespaceObject.store); 15837 const { getEditedPostAttribute } = select(store_store); 15838 const _authorId = getEditedPostAttribute("author"); 15839 const query = { ...AUTHORS_QUERY }; 15840 if (search) { 15841 query.search = search; 15842 query.search_columns = ["name"]; 15843 } 15844 return { 15845 authorId: _authorId, 15846 authors: getUsers(query), 15847 postAuthor: getUser(_authorId, BASE_QUERY), 15848 isLoading: isResolving("getUsers", [query]) 15849 }; 15850 }, 15851 [search] 15852 ); 15853 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { 15854 const fetchedAuthors = (authors ?? []).map((author) => { 15855 return { 15856 value: author.id, 15857 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) 15858 }; 15859 }); 15860 const foundAuthor = fetchedAuthors.findIndex( 15861 ({ value }) => postAuthor?.id === value 15862 ); 15863 let currentAuthor = []; 15864 if (foundAuthor < 0 && postAuthor) { 15865 currentAuthor = [ 15866 { 15867 value: postAuthor.id, 15868 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) 15869 } 15870 ]; 15871 } else if (foundAuthor < 0 && !postAuthor) { 15872 currentAuthor = [ 15873 { 15874 value: 0, 15875 label: (0,external_wp_i18n_namespaceObject.__)("(No author)") 15876 } 15877 ]; 15878 } 15879 return [...currentAuthor, ...fetchedAuthors]; 15880 }, [authors, postAuthor]); 15881 return { authorId, authorOptions, postAuthor, isLoading }; 15882 } 15883 15884 15885 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js 15886 15887 15888 15889 15890 15891 15892 15893 15894 function PostAuthorCombobox() { 15895 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); 15896 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15897 const { authorId, authorOptions, isLoading } = useAuthorsQuery(fieldValue); 15898 const handleSelect = (postAuthorId) => { 15899 if (!postAuthorId) { 15900 return; 15901 } 15902 editPost({ author: postAuthorId }); 15903 }; 15904 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15905 external_wp_components_namespaceObject.ComboboxControl, 15906 { 15907 __nextHasNoMarginBottom: true, 15908 __next40pxDefaultSize: true, 15909 label: (0,external_wp_i18n_namespaceObject.__)("Author"), 15910 options: authorOptions, 15911 value: authorId, 15912 onFilterValueChange: (0,external_wp_compose_namespaceObject.debounce)(setFieldValue, 300), 15913 onChange: handleSelect, 15914 allowReset: false, 15915 hideLabelFromVision: true, 15916 isLoading 15917 } 15918 ); 15919 } 15920 15921 15922 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/select.js 15923 15924 15925 15926 15927 15928 15929 function PostAuthorSelect() { 15930 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 15931 const { authorId, authorOptions } = useAuthorsQuery(); 15932 const setAuthorId = (value) => { 15933 const author = Number(value); 15934 editPost({ author }); 15935 }; 15936 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 15937 external_wp_components_namespaceObject.SelectControl, 15938 { 15939 __next40pxDefaultSize: true, 15940 __nextHasNoMarginBottom: true, 15941 className: "post-author-selector", 15942 label: (0,external_wp_i18n_namespaceObject.__)("Author"), 15943 options: authorOptions, 15944 onChange: setAuthorId, 15945 value: authorId, 15946 hideLabelFromVision: true 15947 } 15948 ); 15949 } 15950 15951 15952 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/index.js 15953 15954 15955 15956 15957 15958 15959 const minimumUsersForCombobox = 25; 15960 function PostAuthor() { 15961 const showCombobox = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15962 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); 15963 return authors?.length >= minimumUsersForCombobox; 15964 }, []); 15965 if (showCombobox) { 15966 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCombobox, {}); 15967 } 15968 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorSelect, {}); 15969 } 15970 var post_author_default = PostAuthor; 15971 15972 15973 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/check.js 15974 15975 15976 15977 15978 function PostAuthorCheck({ children }) { 15979 const { hasAssignAuthorAction } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 15980 const post = select(store_store).getCurrentPost(); 15981 const canAssignAuthor = post?._links?.["wp:action-assign-author"] ? true : false; 15982 return { 15983 hasAssignAuthorAction: canAssignAuthor 15984 }; 15985 }, []); 15986 if (!hasAssignAuthorAction) { 15987 return null; 15988 } 15989 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "author", children }); 15990 } 15991 15992 15993 ;// ./node_modules/@wordpress/editor/build-module/components/post-author/panel.js 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 function PostAuthorToggle({ isOpen, onClick }) { 16008 const { postAuthor } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16009 const id = select(store_store).getEditedPostAttribute("author"); 16010 return { 16011 postAuthor: select(external_wp_coreData_namespaceObject.store).getUser(id, BASE_QUERY) 16012 }; 16013 }, []); 16014 const authorName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor?.name) || (0,external_wp_i18n_namespaceObject.__)("(No author)"); 16015 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16016 external_wp_components_namespaceObject.Button, 16017 { 16018 size: "compact", 16019 className: "editor-post-author__panel-toggle", 16020 variant: "tertiary", 16021 "aria-expanded": isOpen, 16022 "aria-label": ( 16023 // translators: %s: Author name. 16024 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Change author: %s"), authorName) 16025 ), 16026 onClick, 16027 children: authorName 16028 } 16029 ); 16030 } 16031 function panel_PostAuthor() { 16032 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 16033 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 16034 () => ({ 16035 // Anchor the popover to the middle of the entire row so that it doesn't 16036 // move around when the label changes. 16037 anchor: popoverAnchor, 16038 placement: "left-start", 16039 offset: 36, 16040 shift: true 16041 }), 16042 [popoverAnchor] 16043 ); 16044 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostAuthorCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Author"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16045 external_wp_components_namespaceObject.Dropdown, 16046 { 16047 popoverProps, 16048 contentClassName: "editor-post-author__panel-dialog", 16049 focusOnMount: true, 16050 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16051 PostAuthorToggle, 16052 { 16053 isOpen, 16054 onClick: onToggle 16055 } 16056 ), 16057 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-author", children: [ 16058 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16059 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 16060 { 16061 title: (0,external_wp_i18n_namespaceObject.__)("Author"), 16062 onClose 16063 } 16064 ), 16065 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_author_default, { onClose }) 16066 ] }) 16067 } 16068 ) }) }); 16069 } 16070 var panel_default = panel_PostAuthor; 16071 16072 16073 ;// ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js 16074 16075 16076 16077 16078 16079 const COMMENT_OPTIONS = [ 16080 { 16081 label: (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'), 16082 value: "open", 16083 description: (0,external_wp_i18n_namespaceObject.__)("Visitors can add new comments and replies.") 16084 }, 16085 { 16086 label: (0,external_wp_i18n_namespaceObject.__)("Closed"), 16087 value: "closed", 16088 description: [ 16089 (0,external_wp_i18n_namespaceObject.__)("Visitors cannot add new comments or replies."), 16090 (0,external_wp_i18n_namespaceObject.__)("Existing comments remain visible.") 16091 ].join(" ") 16092 } 16093 ]; 16094 function PostComments() { 16095 const commentStatus = (0,external_wp_data_namespaceObject.useSelect)( 16096 (select) => select(store_store).getEditedPostAttribute("comment_status") ?? "open", 16097 [] 16098 ); 16099 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16100 const handleStatus = (newCommentStatus) => editPost({ 16101 comment_status: newCommentStatus 16102 }); 16103 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16104 external_wp_components_namespaceObject.RadioControl, 16105 { 16106 className: "editor-change-status__options", 16107 hideLabelFromVision: true, 16108 label: (0,external_wp_i18n_namespaceObject.__)("Comment status"), 16109 options: COMMENT_OPTIONS, 16110 onChange: handleStatus, 16111 selected: commentStatus 16112 } 16113 ) }) }); 16114 } 16115 var post_comments_default = PostComments; 16116 16117 16118 ;// ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js 16119 16120 16121 16122 16123 16124 function PostPingbacks() { 16125 const pingStatus = (0,external_wp_data_namespaceObject.useSelect)( 16126 (select) => select(store_store).getEditedPostAttribute("ping_status") ?? "open", 16127 [] 16128 ); 16129 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16130 const onTogglePingback = () => editPost({ 16131 ping_status: pingStatus === "open" ? "closed" : "open" 16132 }); 16133 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16134 external_wp_components_namespaceObject.CheckboxControl, 16135 { 16136 __nextHasNoMarginBottom: true, 16137 label: (0,external_wp_i18n_namespaceObject.__)("Enable pingbacks & trackbacks"), 16138 checked: pingStatus === "open", 16139 onChange: onTogglePingback, 16140 help: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16141 external_wp_components_namespaceObject.ExternalLink, 16142 { 16143 href: (0,external_wp_i18n_namespaceObject.__)( 16144 "https://wordpress.org/documentation/article/trackbacks-and-pingbacks/" 16145 ), 16146 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about pingbacks & trackbacks") 16147 } 16148 ) 16149 } 16150 ); 16151 } 16152 var post_pingbacks_default = PostPingbacks; 16153 16154 16155 ;// ./node_modules/@wordpress/editor/build-module/components/post-discussion/panel.js 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 const panel_PANEL_NAME = "discussion-panel"; 16169 function ModalContents({ onClose }) { 16170 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-discussion", children: [ 16171 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16172 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 16173 { 16174 title: (0,external_wp_i18n_namespaceObject.__)("Discussion"), 16175 onClose 16176 } 16177 ), 16178 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 16179 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "comments", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_comments_default, {}) }), 16180 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "trackbacks", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pingbacks_default, {}) }) 16181 ] }) 16182 ] }); 16183 } 16184 function PostDiscussionToggle({ isOpen, onClick }) { 16185 const { 16186 commentStatus, 16187 pingStatus, 16188 commentsSupported, 16189 trackbacksSupported 16190 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16191 const { getEditedPostAttribute } = select(store_store); 16192 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 16193 const postType = getPostType(getEditedPostAttribute("type")); 16194 return { 16195 commentStatus: getEditedPostAttribute("comment_status") ?? "open", 16196 pingStatus: getEditedPostAttribute("ping_status") ?? "open", 16197 commentsSupported: !!postType.supports.comments, 16198 trackbacksSupported: !!postType.supports.trackbacks 16199 }; 16200 }, []); 16201 let label; 16202 if (commentStatus === "open") { 16203 if (pingStatus === "open") { 16204 label = (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'); 16205 } else { 16206 label = trackbacksSupported ? (0,external_wp_i18n_namespaceObject.__)("Comments only") : (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'); 16207 } 16208 } else if (pingStatus === "open") { 16209 label = commentsSupported ? (0,external_wp_i18n_namespaceObject.__)("Pings only") : (0,external_wp_i18n_namespaceObject.__)("Pings enabled"); 16210 } else { 16211 label = (0,external_wp_i18n_namespaceObject.__)("Closed"); 16212 } 16213 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16214 external_wp_components_namespaceObject.Button, 16215 { 16216 size: "compact", 16217 className: "editor-post-discussion__panel-toggle", 16218 variant: "tertiary", 16219 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change discussion options"), 16220 "aria-expanded": isOpen, 16221 onClick, 16222 children: label 16223 } 16224 ); 16225 } 16226 function PostDiscussionPanel() { 16227 const { isEnabled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16228 const { isEditorPanelEnabled } = select(store_store); 16229 return { 16230 isEnabled: isEditorPanelEnabled(panel_PANEL_NAME) 16231 }; 16232 }, []); 16233 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 16234 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 16235 () => ({ 16236 // Anchor the popover to the middle of the entire row so that it doesn't 16237 // move around when the label changes. 16238 anchor: popoverAnchor, 16239 placement: "left-start", 16240 offset: 36, 16241 shift: true 16242 }), 16243 [popoverAnchor] 16244 ); 16245 if (!isEnabled) { 16246 return null; 16247 } 16248 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: ["comments", "trackbacks"], children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16249 external_wp_components_namespaceObject.Dropdown, 16250 { 16251 popoverProps, 16252 className: "editor-post-discussion__panel-dropdown", 16253 contentClassName: "editor-post-discussion__panel-dialog", 16254 focusOnMount: true, 16255 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16256 PostDiscussionToggle, 16257 { 16258 isOpen, 16259 onClick: onToggle 16260 } 16261 ), 16262 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ModalContents, { onClose }) 16263 } 16264 ) }) }); 16265 } 16266 16267 16268 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js 16269 16270 16271 16272 16273 16274 16275 16276 function PostExcerpt({ 16277 hideLabelFromVision = false, 16278 updateOnBlur = false 16279 }) { 16280 const { excerpt, shouldUseDescriptionLabel, usedAttribute } = (0,external_wp_data_namespaceObject.useSelect)( 16281 (select) => { 16282 const { getCurrentPostType, getEditedPostAttribute } = select(store_store); 16283 const postType = getCurrentPostType(); 16284 const _usedAttribute = [ 16285 "wp_template", 16286 "wp_template_part" 16287 ].includes(postType) ? "description" : "excerpt"; 16288 return { 16289 excerpt: getEditedPostAttribute(_usedAttribute), 16290 // There are special cases where we want to label the excerpt as a description. 16291 shouldUseDescriptionLabel: [ 16292 "wp_template", 16293 "wp_template_part", 16294 "wp_block" 16295 ].includes(postType), 16296 usedAttribute: _usedAttribute 16297 }; 16298 }, 16299 [] 16300 ); 16301 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16302 const [localExcerpt, setLocalExcerpt] = (0,external_wp_element_namespaceObject.useState)( 16303 (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) 16304 ); 16305 const updatePost = (value) => { 16306 editPost({ [usedAttribute]: value }); 16307 }; 16308 const label = shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)("Write a description (optional)") : (0,external_wp_i18n_namespaceObject.__)("Write an excerpt (optional)"); 16309 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-excerpt", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16310 external_wp_components_namespaceObject.TextareaControl, 16311 { 16312 __nextHasNoMarginBottom: true, 16313 label, 16314 hideLabelFromVision, 16315 className: "editor-post-excerpt__textarea", 16316 onChange: updateOnBlur ? setLocalExcerpt : updatePost, 16317 onBlur: updateOnBlur ? () => updatePost(localExcerpt) : void 0, 16318 value: updateOnBlur ? localExcerpt : excerpt, 16319 help: !shouldUseDescriptionLabel ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16320 external_wp_components_namespaceObject.ExternalLink, 16321 { 16322 href: (0,external_wp_i18n_namespaceObject.__)( 16323 "https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt" 16324 ), 16325 children: (0,external_wp_i18n_namespaceObject.__)("Learn more about manual excerpts") 16326 } 16327 ) : (0,external_wp_i18n_namespaceObject.__)("Write a description") 16328 } 16329 ) }); 16330 } 16331 16332 16333 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js 16334 16335 16336 function PostExcerptCheck({ children }) { 16337 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "excerpt", children }); 16338 } 16339 var post_excerpt_check_check_default = PostExcerptCheck; 16340 16341 16342 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/plugin.js 16343 16344 16345 const { Fill: plugin_Fill, Slot: plugin_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("PluginPostExcerpt"); 16346 const PluginPostExcerpt = ({ children, className }) => { 16347 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelRow, { className, children }) }); 16348 }; 16349 PluginPostExcerpt.Slot = plugin_Slot; 16350 var plugin_default = PluginPostExcerpt; 16351 16352 16353 ;// ./node_modules/@wordpress/editor/build-module/components/post-excerpt/panel.js 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 const post_excerpt_panel_PANEL_NAME = "post-excerpt"; 16369 function ExcerptPanel() { 16370 const { isOpened, isEnabled, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16371 const { 16372 isEditorPanelOpened, 16373 isEditorPanelEnabled, 16374 getCurrentPostType 16375 } = select(store_store); 16376 return { 16377 isOpened: isEditorPanelOpened(post_excerpt_panel_PANEL_NAME), 16378 isEnabled: isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME), 16379 postType: getCurrentPostType() 16380 }; 16381 }, []); 16382 const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16383 const toggleExcerptPanel = () => toggleEditorPanelOpened(post_excerpt_panel_PANEL_NAME); 16384 if (!isEnabled) { 16385 return null; 16386 } 16387 const shouldUseDescriptionLabel = [ 16388 "wp_template", 16389 "wp_template_part", 16390 "wp_block" 16391 ].includes(postType); 16392 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16393 external_wp_components_namespaceObject.PanelBody, 16394 { 16395 title: shouldUseDescriptionLabel ? (0,external_wp_i18n_namespaceObject.__)("Description") : (0,external_wp_i18n_namespaceObject.__)("Excerpt"), 16396 opened: isOpened, 16397 onToggle: toggleExcerptPanel, 16398 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_default.Slot, { children: (fills) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 16399 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostExcerpt, {}), 16400 fills 16401 ] }) }) 16402 } 16403 ); 16404 } 16405 function PostExcerptPanel() { 16406 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ExcerptPanel, {}) }); 16407 } 16408 function PrivatePostExcerptPanel() { 16409 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivateExcerpt, {}) }); 16410 } 16411 function PrivateExcerpt() { 16412 const { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16413 const { 16414 getCurrentPostType, 16415 getCurrentPostId, 16416 getEditedPostAttribute, 16417 isEditorPanelEnabled 16418 } = select(store_store); 16419 const postType = getCurrentPostType(); 16420 const isTemplateOrTemplatePart = [ 16421 "wp_template", 16422 "wp_template_part" 16423 ].includes(postType); 16424 const isPattern = postType === "wp_block"; 16425 const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern; 16426 const _usedAttribute = isTemplateOrTemplatePart ? "description" : "excerpt"; 16427 const _excerpt = getEditedPostAttribute(_usedAttribute); 16428 const template = isTemplateOrTemplatePart && select(external_wp_coreData_namespaceObject.store).getEntityRecord( 16429 "postType", 16430 postType, 16431 getCurrentPostId() 16432 ); 16433 const fallback = !_excerpt && isTemplateOrTemplatePart ? getTemplateInfo({ 16434 template, 16435 templateTypes: select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.default_template_types 16436 })?.description : void 0; 16437 const _shouldRender = isEditorPanelEnabled(post_excerpt_panel_PANEL_NAME) || _shouldBeUsedAsDescription; 16438 return { 16439 excerpt: _excerpt ?? fallback, 16440 shouldRender: _shouldRender, 16441 shouldBeUsedAsDescription: _shouldBeUsedAsDescription, 16442 // If we should render, allow editing for all post types that are not used as description. 16443 // For the rest allow editing only for user generated entities. 16444 allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file && template.is_custom) 16445 }; 16446 }, []); 16447 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 16448 const label = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)("Description") : (0,external_wp_i18n_namespaceObject.__)("Excerpt"); 16449 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 16450 () => ({ 16451 // Anchor the popover to the middle of the entire row so that it doesn't 16452 // move around when the label changes. 16453 anchor: popoverAnchor, 16454 "aria-label": label, 16455 headerTitle: label, 16456 placement: "left-start", 16457 offset: 36, 16458 shift: true 16459 }), 16460 [popoverAnchor, label] 16461 ); 16462 if (!shouldRender) { 16463 return false; 16464 } 16465 const excerptText = !!excerpt && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { align: "left", numberOfLines: 4, truncate: allowEditing, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(excerpt) }); 16466 if (!allowEditing) { 16467 return excerptText; 16468 } 16469 const excerptPlaceholder = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)("Add a description\u2026") : (0,external_wp_i18n_namespaceObject.__)("Add an excerpt\u2026"); 16470 const triggerEditLabel = shouldBeUsedAsDescription ? (0,external_wp_i18n_namespaceObject.__)("Edit description") : (0,external_wp_i18n_namespaceObject.__)("Edit excerpt"); 16471 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { children: [ 16472 excerptText, 16473 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16474 external_wp_components_namespaceObject.Dropdown, 16475 { 16476 className: "editor-post-excerpt__dropdown", 16477 contentClassName: "editor-post-excerpt__dropdown__content", 16478 popoverProps, 16479 focusOnMount: true, 16480 ref: setPopoverAnchor, 16481 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16482 external_wp_components_namespaceObject.Button, 16483 { 16484 __next40pxDefaultSize: true, 16485 onClick: onToggle, 16486 variant: "link", 16487 children: excerptText ? triggerEditLabel : excerptPlaceholder 16488 } 16489 ), 16490 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 16491 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16492 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 16493 { 16494 title: label, 16495 onClose 16496 } 16497 ), 16498 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_default.Slot, { children: (fills) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 16499 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16500 PostExcerpt, 16501 { 16502 hideLabelFromVision: true, 16503 updateOnBlur: true 16504 } 16505 ), 16506 fills 16507 ] }) }) }) 16508 ] }) 16509 } 16510 ) 16511 ] }); 16512 } 16513 16514 16515 ;// ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js 16516 16517 16518 16519 function ThemeSupportCheck({ children, supportKeys }) { 16520 const { postType, themeSupports } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16521 return { 16522 postType: select(store_store).getEditedPostAttribute("type"), 16523 themeSupports: select(external_wp_coreData_namespaceObject.store).getThemeSupports() 16524 }; 16525 }, []); 16526 const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some((key) => { 16527 const supported = themeSupports?.[key] ?? false; 16528 if ("post-thumbnails" === key && Array.isArray(supported)) { 16529 return supported.includes(postType); 16530 } 16531 return supported; 16532 }); 16533 if (!isSupported) { 16534 return null; 16535 } 16536 return children; 16537 } 16538 16539 16540 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js 16541 16542 16543 16544 function PostFeaturedImageCheck({ children }) { 16545 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ThemeSupportCheck, { supportKeys: "post-thumbnails", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "thumbnail", children }) }); 16546 } 16547 var post_featured_image_check_check_default = PostFeaturedImageCheck; 16548 16549 16550 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 const ALLOWED_MEDIA_TYPES = ["image"]; 16565 const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)("Featured image"); 16566 const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)("Add a featured image"); 16567 const instructions = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 16568 "To edit the featured image, you need permission to upload media." 16569 ) }); 16570 function getMediaDetails(media, postId) { 16571 if (!media) { 16572 return {}; 16573 } 16574 const defaultSize = (0,external_wp_hooks_namespaceObject.applyFilters)( 16575 "editor.PostFeaturedImage.imageSize", 16576 "large", 16577 media.id, 16578 postId 16579 ); 16580 if (defaultSize in (media?.media_details?.sizes ?? {})) { 16581 return { 16582 mediaWidth: media.media_details.sizes[defaultSize].width, 16583 mediaHeight: media.media_details.sizes[defaultSize].height, 16584 mediaSourceUrl: media.media_details.sizes[defaultSize].source_url 16585 }; 16586 } 16587 const fallbackSize = (0,external_wp_hooks_namespaceObject.applyFilters)( 16588 "editor.PostFeaturedImage.imageSize", 16589 "thumbnail", 16590 media.id, 16591 postId 16592 ); 16593 if (fallbackSize in (media?.media_details?.sizes ?? {})) { 16594 return { 16595 mediaWidth: media.media_details.sizes[fallbackSize].width, 16596 mediaHeight: media.media_details.sizes[fallbackSize].height, 16597 mediaSourceUrl: media.media_details.sizes[fallbackSize].source_url 16598 }; 16599 } 16600 return { 16601 mediaWidth: media.media_details.width, 16602 mediaHeight: media.media_details.height, 16603 mediaSourceUrl: media.source_url 16604 }; 16605 } 16606 function PostFeaturedImage({ 16607 currentPostId, 16608 featuredImageId, 16609 onUpdateImage, 16610 onRemoveImage, 16611 media, 16612 postType, 16613 noticeUI, 16614 noticeOperations, 16615 isRequestingFeaturedImageMedia 16616 }) { 16617 const returnsFocusRef = (0,external_wp_element_namespaceObject.useRef)(false); 16618 const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false); 16619 const { getSettings } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 16620 const { mediaSourceUrl } = getMediaDetails(media, currentPostId); 16621 function onDropFiles(filesList) { 16622 getSettings().mediaUpload({ 16623 allowedTypes: ALLOWED_MEDIA_TYPES, 16624 filesList, 16625 onFileChange([image]) { 16626 if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) { 16627 setIsLoading(true); 16628 return; 16629 } 16630 if (image) { 16631 onUpdateImage(image); 16632 } 16633 setIsLoading(false); 16634 }, 16635 onError(message) { 16636 noticeOperations.removeAllNotices(); 16637 noticeOperations.createErrorNotice(message); 16638 }, 16639 multiple: false 16640 }); 16641 } 16642 function getImageDescription(imageMedia) { 16643 if (imageMedia.alt_text) { 16644 return (0,external_wp_i18n_namespaceObject.sprintf)( 16645 // Translators: %s: The selected image alt text. 16646 (0,external_wp_i18n_namespaceObject.__)("Current image: %s"), 16647 imageMedia.alt_text 16648 ); 16649 } 16650 return (0,external_wp_i18n_namespaceObject.sprintf)( 16651 // Translators: %s: The selected image filename. 16652 (0,external_wp_i18n_namespaceObject.__)( 16653 "The current image has no alternative text. The file name is: %s" 16654 ), 16655 imageMedia.media_details.sizes?.full?.file || imageMedia.slug 16656 ); 16657 } 16658 function returnFocus(node) { 16659 if (returnsFocusRef.current && node) { 16660 node.focus(); 16661 returnsFocusRef.current = false; 16662 } 16663 } 16664 const isMissingMedia = !isRequestingFeaturedImageMedia && !!featuredImageId && !media; 16665 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_featured_image_check_check_default, { children: [ 16666 noticeUI, 16667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-featured-image", children: [ 16668 media && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16669 "div", 16670 { 16671 id: `editor-post-featured-image-$featuredImageId}-describedby`, 16672 className: "hidden", 16673 children: getImageDescription(media) 16674 } 16675 ), 16676 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { fallback: instructions, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16677 external_wp_blockEditor_namespaceObject.MediaUpload, 16678 { 16679 title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, 16680 onSelect: onUpdateImage, 16681 unstableFeaturedImageFlow: true, 16682 allowedTypes: ALLOWED_MEDIA_TYPES, 16683 modalClass: "editor-post-featured-image__media-modal", 16684 render: ({ open }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-featured-image__container", children: [ 16685 isMissingMedia ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16686 external_wp_components_namespaceObject.Notice, 16687 { 16688 status: "warning", 16689 isDismissible: false, 16690 children: (0,external_wp_i18n_namespaceObject.__)( 16691 "Could not retrieve the featured image data." 16692 ) 16693 } 16694 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 16695 external_wp_components_namespaceObject.Button, 16696 { 16697 __next40pxDefaultSize: true, 16698 ref: returnFocus, 16699 className: !featuredImageId ? "editor-post-featured-image__toggle" : "editor-post-featured-image__preview", 16700 onClick: open, 16701 "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)( 16702 "Edit or replace the featured image" 16703 ), 16704 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-$featuredImageId}-describedby`, 16705 "aria-haspopup": "dialog", 16706 disabled: isLoading, 16707 accessibleWhenDisabled: true, 16708 children: [ 16709 !!featuredImageId && media && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16710 "img", 16711 { 16712 className: "editor-post-featured-image__preview-image", 16713 src: mediaSourceUrl, 16714 alt: getImageDescription( 16715 media 16716 ) 16717 } 16718 ), 16719 (isLoading || isRequestingFeaturedImageMedia) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), 16720 !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL) 16721 ] 16722 } 16723 ), 16724 !!featuredImageId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 16725 external_wp_components_namespaceObject.__experimentalHStack, 16726 { 16727 className: dist_clsx( 16728 "editor-post-featured-image__actions", 16729 { 16730 "editor-post-featured-image__actions-missing-image": isMissingMedia, 16731 "editor-post-featured-image__actions-is-requesting-image": isRequestingFeaturedImageMedia 16732 } 16733 ), 16734 children: [ 16735 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16736 external_wp_components_namespaceObject.Button, 16737 { 16738 __next40pxDefaultSize: true, 16739 className: "editor-post-featured-image__action", 16740 onClick: open, 16741 "aria-haspopup": "dialog", 16742 variant: isMissingMedia ? "secondary" : void 0, 16743 children: (0,external_wp_i18n_namespaceObject.__)("Replace") 16744 } 16745 ), 16746 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16747 external_wp_components_namespaceObject.Button, 16748 { 16749 __next40pxDefaultSize: true, 16750 className: "editor-post-featured-image__action", 16751 onClick: () => { 16752 onRemoveImage(); 16753 returnsFocusRef.current = true; 16754 }, 16755 variant: isMissingMedia ? "secondary" : void 0, 16756 isDestructive: isMissingMedia, 16757 children: (0,external_wp_i18n_namespaceObject.__)("Remove") 16758 } 16759 ) 16760 ] 16761 } 16762 ), 16763 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropZone, { onFilesDrop: onDropFiles }) 16764 ] }), 16765 value: featuredImageId 16766 } 16767 ) }) 16768 ] }) 16769 ] }); 16770 } 16771 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)((select) => { 16772 const { getEntityRecord, getPostType, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); 16773 const { getCurrentPostId, getEditedPostAttribute } = select(store_store); 16774 const featuredImageId = getEditedPostAttribute("featured_media"); 16775 return { 16776 media: featuredImageId ? getEntityRecord("postType", "attachment", featuredImageId, { 16777 context: "view" 16778 }) : null, 16779 currentPostId: getCurrentPostId(), 16780 postType: getPostType(getEditedPostAttribute("type")), 16781 featuredImageId, 16782 isRequestingFeaturedImageMedia: !!featuredImageId && !hasFinishedResolution("getEntityRecord", [ 16783 "postType", 16784 "attachment", 16785 featuredImageId, 16786 { context: "view" } 16787 ]) 16788 }; 16789 }); 16790 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)( 16791 (dispatch, { noticeOperations }, { select }) => { 16792 const { editPost } = dispatch(store_store); 16793 return { 16794 onUpdateImage(image) { 16795 editPost({ featured_media: image.id }); 16796 }, 16797 onDropImage(filesList) { 16798 select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ 16799 allowedTypes: ["image"], 16800 filesList, 16801 onFileChange([image]) { 16802 editPost({ featured_media: image.id }); 16803 }, 16804 onError(message) { 16805 noticeOperations.removeAllNotices(); 16806 noticeOperations.createErrorNotice(message); 16807 }, 16808 multiple: false 16809 }); 16810 }, 16811 onRemoveImage() { 16812 editPost({ featured_media: 0 }); 16813 } 16814 }; 16815 } 16816 ); 16817 var post_featured_image_default = (0,external_wp_compose_namespaceObject.compose)( 16818 external_wp_components_namespaceObject.withNotices, 16819 applyWithSelect, 16820 applyWithDispatch, 16821 (0,external_wp_components_namespaceObject.withFilters)("editor.PostFeaturedImage") 16822 )(PostFeaturedImage); 16823 16824 16825 ;// ./node_modules/@wordpress/editor/build-module/components/post-featured-image/panel.js 16826 16827 16828 16829 16830 16831 16832 16833 16834 const post_featured_image_panel_PANEL_NAME = "featured-image"; 16835 function PostFeaturedImagePanel({ withPanelBody = true }) { 16836 const { postType, isEnabled, isOpened } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16837 const { 16838 getEditedPostAttribute, 16839 isEditorPanelEnabled, 16840 isEditorPanelOpened 16841 } = select(store_store); 16842 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 16843 return { 16844 postType: getPostType(getEditedPostAttribute("type")), 16845 isEnabled: isEditorPanelEnabled(post_featured_image_panel_PANEL_NAME), 16846 isOpened: isEditorPanelOpened(post_featured_image_panel_PANEL_NAME) 16847 }; 16848 }, []); 16849 const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16850 if (!isEnabled) { 16851 return null; 16852 } 16853 if (!withPanelBody) { 16854 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_default, {}) }); 16855 } 16856 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16857 external_wp_components_namespaceObject.PanelBody, 16858 { 16859 title: postType?.labels?.featured_image ?? (0,external_wp_i18n_namespaceObject.__)("Featured image"), 16860 opened: isOpened, 16861 onToggle: () => toggleEditorPanelOpened(post_featured_image_panel_PANEL_NAME), 16862 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_default, {}) 16863 } 16864 ) }); 16865 } 16866 16867 16868 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/check.js 16869 16870 16871 16872 16873 function PostFormatCheck({ children }) { 16874 const disablePostFormats = (0,external_wp_data_namespaceObject.useSelect)( 16875 (select) => select(store_store).getEditorSettings().disablePostFormats, 16876 [] 16877 ); 16878 if (disablePostFormats) { 16879 return null; 16880 } 16881 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "post-formats", children }); 16882 } 16883 16884 16885 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/index.js 16886 16887 16888 16889 16890 16891 16892 16893 16894 const POST_FORMATS = [ 16895 { id: "aside", caption: (0,external_wp_i18n_namespaceObject.__)("Aside") }, 16896 { id: "audio", caption: (0,external_wp_i18n_namespaceObject.__)("Audio") }, 16897 { id: "chat", caption: (0,external_wp_i18n_namespaceObject.__)("Chat") }, 16898 { id: "gallery", caption: (0,external_wp_i18n_namespaceObject.__)("Gallery") }, 16899 { id: "image", caption: (0,external_wp_i18n_namespaceObject.__)("Image") }, 16900 { id: "link", caption: (0,external_wp_i18n_namespaceObject.__)("Link") }, 16901 { id: "quote", caption: (0,external_wp_i18n_namespaceObject.__)("Quote") }, 16902 { id: "standard", caption: (0,external_wp_i18n_namespaceObject.__)("Standard") }, 16903 { id: "status", caption: (0,external_wp_i18n_namespaceObject.__)("Status") }, 16904 { id: "video", caption: (0,external_wp_i18n_namespaceObject.__)("Video") } 16905 ].sort((a, b) => { 16906 const normalizedA = a.caption.toUpperCase(); 16907 const normalizedB = b.caption.toUpperCase(); 16908 if (normalizedA < normalizedB) { 16909 return -1; 16910 } 16911 if (normalizedA > normalizedB) { 16912 return 1; 16913 } 16914 return 0; 16915 }); 16916 function PostFormat() { 16917 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); 16918 const postFormatSelectorId = `post-format-selector-$instanceId}`; 16919 const { postFormat, suggestedFormat, supportedFormats } = (0,external_wp_data_namespaceObject.useSelect)( 16920 (select) => { 16921 const { getEditedPostAttribute, getSuggestedPostFormat } = select(store_store); 16922 const _postFormat = getEditedPostAttribute("format"); 16923 const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); 16924 return { 16925 postFormat: _postFormat ?? "standard", 16926 suggestedFormat: getSuggestedPostFormat(), 16927 supportedFormats: themeSupports.formats 16928 }; 16929 }, 16930 [] 16931 ); 16932 const formats = POST_FORMATS.filter((format) => { 16933 return supportedFormats?.includes(format.id) || postFormat === format.id; 16934 }); 16935 const suggestion = formats.find( 16936 (format) => format.id === suggestedFormat 16937 ); 16938 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 16939 const onUpdatePostFormat = (format) => editPost({ format }); 16940 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-format", children: [ 16941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16942 external_wp_components_namespaceObject.RadioControl, 16943 { 16944 className: "editor-post-format__options", 16945 label: (0,external_wp_i18n_namespaceObject.__)("Post Format"), 16946 selected: postFormat, 16947 onChange: (format) => onUpdatePostFormat(format), 16948 id: postFormatSelectorId, 16949 options: formats.map((format) => ({ 16950 label: format.caption, 16951 value: format.id 16952 })), 16953 hideLabelFromVision: true 16954 } 16955 ), 16956 suggestion && suggestion.id !== postFormat && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "editor-post-format__suggestion", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 16957 external_wp_components_namespaceObject.Button, 16958 { 16959 __next40pxDefaultSize: true, 16960 variant: "link", 16961 onClick: () => onUpdatePostFormat(suggestion.id), 16962 children: (0,external_wp_i18n_namespaceObject.sprintf)( 16963 /* translators: %s: post format */ 16964 (0,external_wp_i18n_namespaceObject.__)("Apply suggested format: %s"), 16965 suggestion.caption 16966 ) 16967 } 16968 ) }) 16969 ] }) }); 16970 } 16971 16972 16973 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js 16974 16975 16976 16977 16978 function PostLastRevisionCheck({ children }) { 16979 const { lastRevisionId, revisionsCount } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 16980 const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } = select(store_store); 16981 return { 16982 lastRevisionId: getCurrentPostLastRevisionId(), 16983 revisionsCount: getCurrentPostRevisionsCount() 16984 }; 16985 }, []); 16986 if (!lastRevisionId || revisionsCount < 2) { 16987 return null; 16988 } 16989 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "revisions", children }); 16990 } 16991 var post_last_revision_check_check_default = PostLastRevisionCheck; 16992 16993 16994 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 function usePostLastRevisionInfo() { 17005 return (0,external_wp_data_namespaceObject.useSelect)((select) => { 17006 const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } = select(store_store); 17007 return { 17008 lastRevisionId: getCurrentPostLastRevisionId(), 17009 revisionsCount: getCurrentPostRevisionsCount() 17010 }; 17011 }, []); 17012 } 17013 function PostLastRevision() { 17014 const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo(); 17015 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17016 external_wp_components_namespaceObject.Button, 17017 { 17018 __next40pxDefaultSize: true, 17019 href: (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { 17020 revision: lastRevisionId 17021 }), 17022 className: "editor-post-last-revision__title", 17023 icon: backup_default, 17024 iconPosition: "right", 17025 text: (0,external_wp_i18n_namespaceObject.sprintf)( 17026 /* translators: %s: number of revisions. */ 17027 (0,external_wp_i18n_namespaceObject.__)("Revisions (%s)"), 17028 revisionsCount 17029 ) 17030 } 17031 ) }); 17032 } 17033 function PrivatePostLastRevision() { 17034 const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo(); 17035 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Revisions"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17036 external_wp_components_namespaceObject.Button, 17037 { 17038 href: (0,external_wp_url_namespaceObject.addQueryArgs)("revision.php", { 17039 revision: lastRevisionId 17040 }), 17041 className: "editor-private-post-last-revision__button", 17042 text: revisionsCount, 17043 variant: "tertiary", 17044 size: "compact" 17045 } 17046 ) }) }); 17047 } 17048 var post_last_revision_default = PostLastRevision; 17049 17050 17051 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-revision/panel.js 17052 17053 17054 17055 17056 function PostLastRevisionPanel() { 17057 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { className: "editor-post-last-revision__panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_last_revision_default, {}) }) }); 17058 } 17059 var panel_panel_default = PostLastRevisionPanel; 17060 17061 17062 ;// ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 function PostLockedModal() { 17074 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); 17075 const hookName = "core/editor/post-locked-modal-" + instanceId; 17076 const { autosave, updatePostLock } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17077 const { 17078 isLocked, 17079 isTakeover, 17080 user, 17081 postId, 17082 postLockUtils, 17083 activePostLock, 17084 postType, 17085 previewLink 17086 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 17087 const { 17088 isPostLocked, 17089 isPostLockTakeover, 17090 getPostLockUser, 17091 getCurrentPostId, 17092 getActivePostLock, 17093 getEditedPostAttribute, 17094 getEditedPostPreviewLink, 17095 getEditorSettings 17096 } = select(store_store); 17097 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 17098 return { 17099 isLocked: isPostLocked(), 17100 isTakeover: isPostLockTakeover(), 17101 user: getPostLockUser(), 17102 postId: getCurrentPostId(), 17103 postLockUtils: getEditorSettings().postLockUtils, 17104 activePostLock: getActivePostLock(), 17105 postType: getPostType(getEditedPostAttribute("type")), 17106 previewLink: getEditedPostPreviewLink() 17107 }; 17108 }, []); 17109 (0,external_wp_element_namespaceObject.useEffect)(() => { 17110 function sendPostLock(data) { 17111 if (isLocked) { 17112 return; 17113 } 17114 data["wp-refresh-post-lock"] = { 17115 lock: activePostLock, 17116 post_id: postId 17117 }; 17118 } 17119 function receivePostLock(data) { 17120 if (!data["wp-refresh-post-lock"]) { 17121 return; 17122 } 17123 const received = data["wp-refresh-post-lock"]; 17124 if (received.lock_error) { 17125 autosave(); 17126 updatePostLock({ 17127 isLocked: true, 17128 isTakeover: true, 17129 user: { 17130 name: received.lock_error.name, 17131 avatar: received.lock_error.avatar_src_2x 17132 } 17133 }); 17134 } else if (received.new_lock) { 17135 updatePostLock({ 17136 isLocked: false, 17137 activePostLock: received.new_lock 17138 }); 17139 } 17140 } 17141 function releasePostLock() { 17142 if (isLocked || !activePostLock) { 17143 return; 17144 } 17145 const data = new window.FormData(); 17146 data.append("action", "wp-remove-post-lock"); 17147 data.append("_wpnonce", postLockUtils.unlockNonce); 17148 data.append("post_ID", postId); 17149 data.append("active_post_lock", activePostLock); 17150 if (window.navigator.sendBeacon) { 17151 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); 17152 } else { 17153 const xhr = new window.XMLHttpRequest(); 17154 xhr.open("POST", postLockUtils.ajaxUrl, false); 17155 xhr.send(data); 17156 } 17157 } 17158 (0,external_wp_hooks_namespaceObject.addAction)("heartbeat.send", hookName, sendPostLock); 17159 (0,external_wp_hooks_namespaceObject.addAction)("heartbeat.tick", hookName, receivePostLock); 17160 window.addEventListener("beforeunload", releasePostLock); 17161 return () => { 17162 (0,external_wp_hooks_namespaceObject.removeAction)("heartbeat.send", hookName); 17163 (0,external_wp_hooks_namespaceObject.removeAction)("heartbeat.tick", hookName); 17164 window.removeEventListener("beforeunload", releasePostLock); 17165 }; 17166 }, []); 17167 if (!isLocked) { 17168 return null; 17169 } 17170 const userDisplayName = user.name; 17171 const userAvatar = user.avatar; 17172 const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)("post.php", { 17173 "get-post-lock": "1", 17174 lockKey: true, 17175 post: postId, 17176 action: "edit", 17177 _wpnonce: postLockUtils.nonce 17178 }); 17179 const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)("edit.php", { 17180 post_type: postType?.slug 17181 }); 17182 const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)("Exit editor"); 17183 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17184 external_wp_components_namespaceObject.Modal, 17185 { 17186 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"), 17187 focusOnMount: true, 17188 shouldCloseOnClickOutside: false, 17189 shouldCloseOnEsc: false, 17190 isDismissible: false, 17191 className: "editor-post-locked-modal", 17192 size: "medium", 17193 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "top", spacing: 6, children: [ 17194 !!userAvatar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17195 "img", 17196 { 17197 src: userAvatar, 17198 alt: (0,external_wp_i18n_namespaceObject.__)("Avatar"), 17199 className: "editor-post-locked-modal__avatar", 17200 width: 64, 17201 height: 64 17202 } 17203 ), 17204 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 17205 !!isTakeover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( 17206 userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( 17207 /* translators: %s: user's display name */ 17208 (0,external_wp_i18n_namespaceObject.__)( 17209 "<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved." 17210 ), 17211 userDisplayName 17212 ) : (0,external_wp_i18n_namespaceObject.__)( 17213 "Another user now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved." 17214 ), 17215 { 17216 strong: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), 17217 PreviewLink: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: previewLink, children: (0,external_wp_i18n_namespaceObject.__)("preview") }) 17218 } 17219 ) }), 17220 !isTakeover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 17221 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_element_namespaceObject.createInterpolateElement)( 17222 userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( 17223 /* translators: %s: user's display name */ 17224 (0,external_wp_i18n_namespaceObject.__)( 17225 "<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over." 17226 ), 17227 userDisplayName 17228 ) : (0,external_wp_i18n_namespaceObject.__)( 17229 "Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over." 17230 ), 17231 { 17232 strong: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {}), 17233 PreviewLink: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { href: previewLink, children: (0,external_wp_i18n_namespaceObject.__)("preview") }) 17234 } 17235 ) }), 17236 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 17237 "If you take over, the other user will lose editing control to the post, but their changes will be saved." 17238 ) }) 17239 ] }), 17240 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 17241 external_wp_components_namespaceObject.__experimentalHStack, 17242 { 17243 className: "editor-post-locked-modal__buttons", 17244 justify: "flex-end", 17245 children: [ 17246 !isTakeover && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17247 external_wp_components_namespaceObject.Button, 17248 { 17249 __next40pxDefaultSize: true, 17250 variant: "tertiary", 17251 href: unlockUrl, 17252 children: (0,external_wp_i18n_namespaceObject.__)("Take over") 17253 } 17254 ), 17255 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17256 external_wp_components_namespaceObject.Button, 17257 { 17258 __next40pxDefaultSize: true, 17259 variant: "primary", 17260 href: allPostsUrl, 17261 children: allPostsLabel 17262 } 17263 ) 17264 ] 17265 } 17266 ) 17267 ] }) 17268 ] }) 17269 } 17270 ); 17271 } 17272 var post_locked_modal_default = false ? 0 : PostLockedModal; 17273 17274 17275 ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js 17276 17277 17278 function PostPendingStatusCheck({ children }) { 17279 const { hasPublishAction, isPublished } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 17280 const { isCurrentPostPublished, getCurrentPost } = select(store_store); 17281 return { 17282 hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, 17283 isPublished: isCurrentPostPublished() 17284 }; 17285 }, []); 17286 if (isPublished || !hasPublishAction) { 17287 return null; 17288 } 17289 return children; 17290 } 17291 var post_pending_status_check_check_default = PostPendingStatusCheck; 17292 17293 17294 ;// ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js 17295 17296 17297 17298 17299 17300 17301 function PostPendingStatus() { 17302 const status = (0,external_wp_data_namespaceObject.useSelect)( 17303 (select) => select(store_store).getEditedPostAttribute("status"), 17304 [] 17305 ); 17306 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17307 const togglePendingStatus = () => { 17308 const updatedStatus = status === "pending" ? "draft" : "pending"; 17309 editPost({ status: updatedStatus }); 17310 }; 17311 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_pending_status_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17312 external_wp_components_namespaceObject.CheckboxControl, 17313 { 17314 __nextHasNoMarginBottom: true, 17315 label: (0,external_wp_i18n_namespaceObject.__)("Pending review"), 17316 checked: status === "pending", 17317 onChange: togglePendingStatus 17318 } 17319 ) }); 17320 } 17321 var post_pending_status_default = PostPendingStatus; 17322 17323 17324 ;// ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js 17325 17326 17327 17328 17329 17330 17331 17332 17333 function writeInterstitialMessage(targetDocument) { 17334 let markup = (0,external_wp_element_namespaceObject.renderToString)( 17335 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-preview-button__interstitial-message", children: [ 17336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 96 96", children: [ 17337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17338 external_wp_components_namespaceObject.Path, 17339 { 17340 className: "outer", 17341 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", 17342 fill: "none" 17343 } 17344 ), 17345 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17346 external_wp_components_namespaceObject.Path, 17347 { 17348 className: "inner", 17349 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", 17350 fill: "none" 17351 } 17352 ) 17353 ] }), 17354 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Generating preview\u2026") }) 17355 ] }) 17356 ); 17357 markup += ` 17358 <style> 17359 body { 17360 margin: 0; 17361 } 17362 .editor-post-preview-button__interstitial-message { 17363 display: flex; 17364 flex-direction: column; 17365 align-items: center; 17366 justify-content: center; 17367 height: 100vh; 17368 width: 100vw; 17369 } 17370 @-webkit-keyframes paint { 17371 0% { 17372 stroke-dashoffset: 0; 17373 } 17374 } 17375 @-moz-keyframes paint { 17376 0% { 17377 stroke-dashoffset: 0; 17378 } 17379 } 17380 @-o-keyframes paint { 17381 0% { 17382 stroke-dashoffset: 0; 17383 } 17384 } 17385 @keyframes paint { 17386 0% { 17387 stroke-dashoffset: 0; 17388 } 17389 } 17390 .editor-post-preview-button__interstitial-message svg { 17391 width: 192px; 17392 height: 192px; 17393 stroke: #555d66; 17394 stroke-width: 0.75; 17395 } 17396 .editor-post-preview-button__interstitial-message svg .outer, 17397 .editor-post-preview-button__interstitial-message svg .inner { 17398 stroke-dasharray: 280; 17399 stroke-dashoffset: 280; 17400 -webkit-animation: paint 1.5s ease infinite alternate; 17401 -moz-animation: paint 1.5s ease infinite alternate; 17402 -o-animation: paint 1.5s ease infinite alternate; 17403 animation: paint 1.5s ease infinite alternate; 17404 } 17405 p { 17406 text-align: center; 17407 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 17408 } 17409 </style> 17410 `; 17411 markup = (0,external_wp_hooks_namespaceObject.applyFilters)("editor.PostPreview.interstitialMarkup", markup); 17412 targetDocument.write(markup); 17413 targetDocument.title = (0,external_wp_i18n_namespaceObject.__)("Generating preview\u2026"); 17414 targetDocument.close(); 17415 } 17416 function PostPreviewButton({ 17417 className, 17418 textContent, 17419 forceIsAutosaveable, 17420 role, 17421 onPreview 17422 }) { 17423 const { postId, currentPostLink, previewLink, isSaveable, isViewable } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 17424 const editor = select(store_store); 17425 const core = select(external_wp_coreData_namespaceObject.store); 17426 const postType = core.getPostType( 17427 editor.getCurrentPostType("type") 17428 ); 17429 const canView = postType?.viewable ?? false; 17430 if (!canView) { 17431 return { isViewable: canView }; 17432 } 17433 return { 17434 postId: editor.getCurrentPostId(), 17435 currentPostLink: editor.getCurrentPostAttribute("link"), 17436 previewLink: editor.getEditedPostPreviewLink(), 17437 isSaveable: editor.isEditedPostSaveable(), 17438 isViewable: canView 17439 }; 17440 }, []); 17441 const { __unstableSaveForPreview } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17442 if (!isViewable) { 17443 return null; 17444 } 17445 const targetId = `wp-preview-$postId}`; 17446 const openPreviewWindow = async (event) => { 17447 event.preventDefault(); 17448 const previewWindow = window.open("", targetId); 17449 previewWindow.focus(); 17450 writeInterstitialMessage(previewWindow.document); 17451 const link = await __unstableSaveForPreview({ forceIsAutosaveable }); 17452 previewWindow.location = link; 17453 onPreview?.(); 17454 }; 17455 const href = previewLink || currentPostLink; 17456 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17457 external_wp_components_namespaceObject.Button, 17458 { 17459 variant: !className ? "tertiary" : void 0, 17460 className: className || "editor-post-preview", 17461 href, 17462 target: targetId, 17463 accessibleWhenDisabled: true, 17464 disabled: !isSaveable, 17465 onClick: openPreviewWindow, 17466 role, 17467 size: "compact", 17468 children: textContent || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 17469 (0,external_wp_i18n_namespaceObject._x)("Preview", "imperative verb"), 17470 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 17471 as: "span", 17472 /* translators: accessibility text */ 17473 children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") 17474 }) 17475 ] }) 17476 } 17477 ); 17478 } 17479 17480 17481 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js 17482 17483 17484 17485 17486 function PublishButtonLabel() { 17487 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 17488 const { 17489 isPublished, 17490 isBeingScheduled, 17491 isSaving, 17492 isPublishing, 17493 hasPublishAction, 17494 isAutosaving, 17495 hasNonPostEntityChanges, 17496 postStatusHasChanged, 17497 postStatus 17498 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 17499 const { 17500 isCurrentPostPublished, 17501 isEditedPostBeingScheduled, 17502 isSavingPost, 17503 isPublishingPost, 17504 getCurrentPost, 17505 getCurrentPostType, 17506 isAutosavingPost, 17507 getPostEdits, 17508 getEditedPostAttribute 17509 } = select(store_store); 17510 return { 17511 isPublished: isCurrentPostPublished(), 17512 isBeingScheduled: isEditedPostBeingScheduled(), 17513 isSaving: isSavingPost(), 17514 isPublishing: isPublishingPost(), 17515 hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, 17516 postType: getCurrentPostType(), 17517 isAutosaving: isAutosavingPost(), 17518 hasNonPostEntityChanges: select(store_store).hasNonPostEntityChanges(), 17519 postStatusHasChanged: !!getPostEdits()?.status, 17520 postStatus: getEditedPostAttribute("status") 17521 }; 17522 }, []); 17523 if (isPublishing) { 17524 return (0,external_wp_i18n_namespaceObject.__)("Publishing\u2026"); 17525 } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) { 17526 return (0,external_wp_i18n_namespaceObject.__)("Saving\u2026"); 17527 } 17528 if (!hasPublishAction) { 17529 return isSmallerThanMediumViewport ? (0,external_wp_i18n_namespaceObject.__)("Publish") : (0,external_wp_i18n_namespaceObject.__)("Submit for Review"); 17530 } 17531 if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || !postStatusHasChanged && postStatus === "future") { 17532 return (0,external_wp_i18n_namespaceObject.__)("Save"); 17533 } 17534 if (isBeingScheduled) { 17535 return (0,external_wp_i18n_namespaceObject.__)("Schedule"); 17536 } 17537 return (0,external_wp_i18n_namespaceObject.__)("Publish"); 17538 } 17539 17540 17541 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js 17542 17543 17544 17545 17546 17547 17548 17549 const post_publish_button_noop = () => { 17550 }; 17551 class PostPublishButton extends external_wp_element_namespaceObject.Component { 17552 constructor(props) { 17553 super(props); 17554 this.createOnClick = this.createOnClick.bind(this); 17555 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); 17556 this.state = { 17557 entitiesSavedStatesCallback: false 17558 }; 17559 } 17560 createOnClick(callback) { 17561 return (...args) => { 17562 const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } = this.props; 17563 if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { 17564 this.setState({ 17565 entitiesSavedStatesCallback: () => callback(...args) 17566 }); 17567 setEntitiesSavedStatesCallback( 17568 () => this.closeEntitiesSavedStates 17569 ); 17570 return post_publish_button_noop; 17571 } 17572 return callback(...args); 17573 }; 17574 } 17575 closeEntitiesSavedStates(savedEntities) { 17576 const { postType, postId } = this.props; 17577 const { entitiesSavedStatesCallback } = this.state; 17578 this.setState({ entitiesSavedStatesCallback: false }, () => { 17579 if (savedEntities && savedEntities.some( 17580 (elt) => elt.kind === "postType" && elt.name === postType && elt.key === postId 17581 )) { 17582 entitiesSavedStatesCallback(); 17583 } 17584 }); 17585 } 17586 render() { 17587 const { 17588 forceIsDirty, 17589 hasPublishAction, 17590 isBeingScheduled, 17591 isOpen, 17592 isPostSavingLocked, 17593 isPublishable, 17594 isPublished, 17595 isSaveable, 17596 isSaving, 17597 isAutoSaving, 17598 isToggle, 17599 savePostStatus, 17600 onSubmit = post_publish_button_noop, 17601 onToggle, 17602 visibility, 17603 hasNonPostEntityChanges, 17604 isSavingNonPostEntityChanges, 17605 postStatus, 17606 postStatusHasChanged 17607 } = this.props; 17608 const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 17609 const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); 17610 let publishStatus = "publish"; 17611 if (postStatusHasChanged) { 17612 publishStatus = postStatus; 17613 } else if (!hasPublishAction) { 17614 publishStatus = "pending"; 17615 } else if (visibility === "private") { 17616 publishStatus = "private"; 17617 } else if (isBeingScheduled) { 17618 publishStatus = "future"; 17619 } 17620 const onClickButton = () => { 17621 if (isButtonDisabled) { 17622 return; 17623 } 17624 onSubmit(); 17625 savePostStatus(publishStatus); 17626 }; 17627 const onClickToggle = () => { 17628 if (isToggleDisabled) { 17629 return; 17630 } 17631 onToggle(); 17632 }; 17633 const buttonProps = { 17634 "aria-disabled": isButtonDisabled, 17635 className: "editor-post-publish-button", 17636 isBusy: !isAutoSaving && isSaving, 17637 variant: "primary", 17638 onClick: this.createOnClick(onClickButton), 17639 "aria-haspopup": hasNonPostEntityChanges ? "dialog" : void 0 17640 }; 17641 const toggleProps = { 17642 "aria-disabled": isToggleDisabled, 17643 "aria-expanded": isOpen, 17644 className: "editor-post-publish-panel__toggle", 17645 isBusy: isSaving && isPublished, 17646 variant: "primary", 17647 size: "compact", 17648 onClick: this.createOnClick(onClickToggle), 17649 "aria-haspopup": hasNonPostEntityChanges ? "dialog" : void 0 17650 }; 17651 const componentProps = isToggle ? toggleProps : buttonProps; 17652 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17653 external_wp_components_namespaceObject.Button, 17654 { 17655 ...componentProps, 17656 className: `$componentProps.className} editor-post-publish-button__button`, 17657 size: "compact", 17658 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PublishButtonLabel, {}) 17659 } 17660 ) }); 17661 } 17662 } 17663 var post_publish_button_default = (0,external_wp_compose_namespaceObject.compose)([ 17664 (0,external_wp_data_namespaceObject.withSelect)((select) => { 17665 const { 17666 isSavingPost, 17667 isAutosavingPost, 17668 isEditedPostBeingScheduled, 17669 getEditedPostVisibility, 17670 isCurrentPostPublished, 17671 isEditedPostSaveable, 17672 isEditedPostPublishable, 17673 isPostSavingLocked, 17674 getCurrentPost, 17675 getCurrentPostType, 17676 getCurrentPostId, 17677 hasNonPostEntityChanges, 17678 isSavingNonPostEntityChanges, 17679 getEditedPostAttribute, 17680 getPostEdits 17681 } = select(store_store); 17682 return { 17683 isSaving: isSavingPost(), 17684 isAutoSaving: isAutosavingPost(), 17685 isBeingScheduled: isEditedPostBeingScheduled(), 17686 visibility: getEditedPostVisibility(), 17687 isSaveable: isEditedPostSaveable(), 17688 isPostSavingLocked: isPostSavingLocked(), 17689 isPublishable: isEditedPostPublishable(), 17690 isPublished: isCurrentPostPublished(), 17691 hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, 17692 postType: getCurrentPostType(), 17693 postId: getCurrentPostId(), 17694 postStatus: getEditedPostAttribute("status"), 17695 postStatusHasChanged: getPostEdits()?.status, 17696 hasNonPostEntityChanges: hasNonPostEntityChanges(), 17697 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() 17698 }; 17699 }), 17700 (0,external_wp_data_namespaceObject.withDispatch)((dispatch) => { 17701 const { editPost, savePost } = dispatch(store_store); 17702 return { 17703 savePostStatus: (status) => { 17704 editPost({ status }, { undoIgnore: true }); 17705 savePost(); 17706 } 17707 }; 17708 }) 17709 ])(PostPublishButton); 17710 17711 17712 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 17713 17714 17715 var wordpress_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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-.06-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" }) }); 17716 17717 17718 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js 17719 17720 const VISIBILITY_OPTIONS = [ 17721 { 17722 label: (0,external_wp_i18n_namespaceObject.__)("Public"), 17723 value: "public", 17724 description: (0,external_wp_i18n_namespaceObject.__)("Visible to everyone.") 17725 }, 17726 { 17727 label: (0,external_wp_i18n_namespaceObject.__)("Private"), 17728 value: "private", 17729 description: (0,external_wp_i18n_namespaceObject.__)("Only visible to site admins and editors.") 17730 }, 17731 { 17732 label: (0,external_wp_i18n_namespaceObject.__)("Password protected"), 17733 value: "password", 17734 description: (0,external_wp_i18n_namespaceObject.__)("Only visible to those who know the password.") 17735 } 17736 ]; 17737 17738 17739 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 function PostVisibility({ onClose }) { 17750 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostVisibility); 17751 const { status, visibility, password } = (0,external_wp_data_namespaceObject.useSelect)((select) => ({ 17752 status: select(store_store).getEditedPostAttribute("status"), 17753 visibility: select(store_store).getEditedPostVisibility(), 17754 password: select(store_store).getEditedPostAttribute("password") 17755 })); 17756 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 17757 const [hasPassword, setHasPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); 17758 function updateVisibility(value) { 17759 const nextValues = { 17760 public: { 17761 status: visibility === "private" ? "draft" : status, 17762 password: "" 17763 }, 17764 private: { status: "private", password: "" }, 17765 password: { 17766 status: visibility === "private" ? "draft" : status, 17767 password: password || "" 17768 } 17769 }; 17770 editPost(nextValues[value]); 17771 setHasPassword(value === "password"); 17772 } 17773 const updatePassword = (value) => { 17774 editPost({ password: value }); 17775 }; 17776 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-visibility", children: [ 17777 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17778 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 17779 { 17780 title: (0,external_wp_i18n_namespaceObject.__)("Visibility"), 17781 help: (0,external_wp_i18n_namespaceObject.__)("Control how this post is viewed."), 17782 onClose 17783 } 17784 ), 17785 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 17786 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17787 external_wp_components_namespaceObject.RadioControl, 17788 { 17789 label: (0,external_wp_i18n_namespaceObject.__)("Visibility"), 17790 hideLabelFromVision: true, 17791 options: VISIBILITY_OPTIONS, 17792 selected: hasPassword ? "password" : visibility, 17793 onChange: updateVisibility 17794 } 17795 ), 17796 hasPassword && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 17797 external_wp_components_namespaceObject.TextControl, 17798 { 17799 label: (0,external_wp_i18n_namespaceObject.__)("Password"), 17800 onChange: updatePassword, 17801 value: password, 17802 placeholder: (0,external_wp_i18n_namespaceObject.__)("Use a secure password"), 17803 type: "text", 17804 id: `editor-post-visibility__password-input-$instanceId}`, 17805 __next40pxDefaultSize: true, 17806 __nextHasNoMarginBottom: true, 17807 maxLength: 255 17808 } 17809 ) 17810 ] }) 17811 ] }); 17812 } 17813 17814 17815 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js 17816 17817 17818 17819 function PostVisibilityLabel() { 17820 return usePostVisibilityLabel(); 17821 } 17822 function usePostVisibilityLabel() { 17823 const visibility = (0,external_wp_data_namespaceObject.useSelect)( 17824 (select) => select(store_store).getEditedPostVisibility(), 17825 [] 17826 ); 17827 return VISIBILITY_OPTIONS.find((option) => option.value === visibility)?.label; 17828 } 17829 17830 17831 ;// ./node_modules/date-fns/toDate.mjs 17832 /** 17833 * @name toDate 17834 * @category Common Helpers 17835 * @summary Convert the given argument to an instance of Date. 17836 * 17837 * @description 17838 * Convert the given argument to an instance of Date. 17839 * 17840 * If the argument is an instance of Date, the function returns its clone. 17841 * 17842 * If the argument is a number, it is treated as a timestamp. 17843 * 17844 * If the argument is none of the above, the function returns Invalid Date. 17845 * 17846 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. 17847 * 17848 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 17849 * 17850 * @param argument - The value to convert 17851 * 17852 * @returns The parsed date in the local time zone 17853 * 17854 * @example 17855 * // Clone the date: 17856 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) 17857 * //=> Tue Feb 11 2014 11:30:30 17858 * 17859 * @example 17860 * // Convert the timestamp to date: 17861 * const result = toDate(1392098430000) 17862 * //=> Tue Feb 11 2014 11:30:30 17863 */ 17864 function toDate(argument) { 17865 const argStr = Object.prototype.toString.call(argument); 17866 17867 // Clone the date 17868 if ( 17869 argument instanceof Date || 17870 (typeof argument === "object" && argStr === "[object Date]") 17871 ) { 17872 // Prevent the date to lose the milliseconds when passed to new Date() in IE10 17873 return new argument.constructor(+argument); 17874 } else if ( 17875 typeof argument === "number" || 17876 argStr === "[object Number]" || 17877 typeof argument === "string" || 17878 argStr === "[object String]" 17879 ) { 17880 // TODO: Can we get rid of as? 17881 return new Date(argument); 17882 } else { 17883 // TODO: Can we get rid of as? 17884 return new Date(NaN); 17885 } 17886 } 17887 17888 // Fallback for modularized imports: 17889 /* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate))); 17890 17891 ;// ./node_modules/date-fns/startOfMonth.mjs 17892 17893 17894 /** 17895 * @name startOfMonth 17896 * @category Month Helpers 17897 * @summary Return the start of a month for the given date. 17898 * 17899 * @description 17900 * Return the start of a month for the given date. 17901 * The result will be in the local timezone. 17902 * 17903 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 17904 * 17905 * @param date - The original date 17906 * 17907 * @returns The start of a month 17908 * 17909 * @example 17910 * // The start of a month for 2 September 2014 11:55:00: 17911 * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 17912 * //=> Mon Sep 01 2014 00:00:00 17913 */ 17914 function startOfMonth(date) { 17915 const _date = toDate(date); 17916 _date.setDate(1); 17917 _date.setHours(0, 0, 0, 0); 17918 return _date; 17919 } 17920 17921 // Fallback for modularized imports: 17922 /* harmony default export */ const date_fns_startOfMonth = ((/* unused pure expression or super */ null && (startOfMonth))); 17923 17924 ;// ./node_modules/date-fns/endOfMonth.mjs 17925 17926 17927 /** 17928 * @name endOfMonth 17929 * @category Month Helpers 17930 * @summary Return the end of a month for the given date. 17931 * 17932 * @description 17933 * Return the end of a month for the given date. 17934 * The result will be in the local timezone. 17935 * 17936 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 17937 * 17938 * @param date - The original date 17939 * 17940 * @returns The end of a month 17941 * 17942 * @example 17943 * // The end of a month for 2 September 2014 11:55:00: 17944 * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) 17945 * //=> Tue Sep 30 2014 23:59:59.999 17946 */ 17947 function endOfMonth(date) { 17948 const _date = toDate(date); 17949 const month = _date.getMonth(); 17950 _date.setFullYear(_date.getFullYear(), month + 1, 0); 17951 _date.setHours(23, 59, 59, 999); 17952 return _date; 17953 } 17954 17955 // Fallback for modularized imports: 17956 /* harmony default export */ const date_fns_endOfMonth = ((/* unused pure expression or super */ null && (endOfMonth))); 17957 17958 ;// ./node_modules/date-fns/constants.mjs 17959 /** 17960 * @module constants 17961 * @summary Useful constants 17962 * @description 17963 * Collection of useful date constants. 17964 * 17965 * The constants could be imported from `date-fns/constants`: 17966 * 17967 * ```ts 17968 * import { maxTime, minTime } from "./constants/date-fns/constants"; 17969 * 17970 * function isAllowedTime(time) { 17971 * return time <= maxTime && time >= minTime; 17972 * } 17973 * ``` 17974 */ 17975 17976 /** 17977 * @constant 17978 * @name daysInWeek 17979 * @summary Days in 1 week. 17980 */ 17981 const daysInWeek = 7; 17982 17983 /** 17984 * @constant 17985 * @name daysInYear 17986 * @summary Days in 1 year. 17987 * 17988 * @description 17989 * How many days in a year. 17990 * 17991 * One years equals 365.2425 days according to the formula: 17992 * 17993 * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400. 17994 * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days 17995 */ 17996 const daysInYear = 365.2425; 17997 17998 /** 17999 * @constant 18000 * @name maxTime 18001 * @summary Maximum allowed time. 18002 * 18003 * @example 18004 * import { maxTime } from "./constants/date-fns/constants"; 18005 * 18006 * const isValid = 8640000000000001 <= maxTime; 18007 * //=> false 18008 * 18009 * new Date(8640000000000001); 18010 * //=> Invalid Date 18011 */ 18012 const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000; 18013 18014 /** 18015 * @constant 18016 * @name minTime 18017 * @summary Minimum allowed time. 18018 * 18019 * @example 18020 * import { minTime } from "./constants/date-fns/constants"; 18021 * 18022 * const isValid = -8640000000000001 >= minTime; 18023 * //=> false 18024 * 18025 * new Date(-8640000000000001) 18026 * //=> Invalid Date 18027 */ 18028 const minTime = -maxTime; 18029 18030 /** 18031 * @constant 18032 * @name millisecondsInWeek 18033 * @summary Milliseconds in 1 week. 18034 */ 18035 const millisecondsInWeek = 604800000; 18036 18037 /** 18038 * @constant 18039 * @name millisecondsInDay 18040 * @summary Milliseconds in 1 day. 18041 */ 18042 const millisecondsInDay = 86400000; 18043 18044 /** 18045 * @constant 18046 * @name millisecondsInMinute 18047 * @summary Milliseconds in 1 minute 18048 */ 18049 const millisecondsInMinute = 60000; 18050 18051 /** 18052 * @constant 18053 * @name millisecondsInHour 18054 * @summary Milliseconds in 1 hour 18055 */ 18056 const millisecondsInHour = 3600000; 18057 18058 /** 18059 * @constant 18060 * @name millisecondsInSecond 18061 * @summary Milliseconds in 1 second 18062 */ 18063 const millisecondsInSecond = 1000; 18064 18065 /** 18066 * @constant 18067 * @name minutesInYear 18068 * @summary Minutes in 1 year. 18069 */ 18070 const minutesInYear = 525600; 18071 18072 /** 18073 * @constant 18074 * @name minutesInMonth 18075 * @summary Minutes in 1 month. 18076 */ 18077 const minutesInMonth = 43200; 18078 18079 /** 18080 * @constant 18081 * @name minutesInDay 18082 * @summary Minutes in 1 day. 18083 */ 18084 const minutesInDay = 1440; 18085 18086 /** 18087 * @constant 18088 * @name minutesInHour 18089 * @summary Minutes in 1 hour. 18090 */ 18091 const minutesInHour = 60; 18092 18093 /** 18094 * @constant 18095 * @name monthsInQuarter 18096 * @summary Months in 1 quarter. 18097 */ 18098 const monthsInQuarter = 3; 18099 18100 /** 18101 * @constant 18102 * @name monthsInYear 18103 * @summary Months in 1 year. 18104 */ 18105 const monthsInYear = 12; 18106 18107 /** 18108 * @constant 18109 * @name quartersInYear 18110 * @summary Quarters in 1 year 18111 */ 18112 const quartersInYear = 4; 18113 18114 /** 18115 * @constant 18116 * @name secondsInHour 18117 * @summary Seconds in 1 hour. 18118 */ 18119 const secondsInHour = 3600; 18120 18121 /** 18122 * @constant 18123 * @name secondsInMinute 18124 * @summary Seconds in 1 minute. 18125 */ 18126 const secondsInMinute = 60; 18127 18128 /** 18129 * @constant 18130 * @name secondsInDay 18131 * @summary Seconds in 1 day. 18132 */ 18133 const secondsInDay = secondsInHour * 24; 18134 18135 /** 18136 * @constant 18137 * @name secondsInWeek 18138 * @summary Seconds in 1 week. 18139 */ 18140 const secondsInWeek = secondsInDay * 7; 18141 18142 /** 18143 * @constant 18144 * @name secondsInYear 18145 * @summary Seconds in 1 year. 18146 */ 18147 const secondsInYear = secondsInDay * daysInYear; 18148 18149 /** 18150 * @constant 18151 * @name secondsInMonth 18152 * @summary Seconds in 1 month 18153 */ 18154 const secondsInMonth = secondsInYear / 12; 18155 18156 /** 18157 * @constant 18158 * @name secondsInQuarter 18159 * @summary Seconds in 1 quarter. 18160 */ 18161 const secondsInQuarter = secondsInMonth * 3; 18162 18163 ;// ./node_modules/date-fns/parseISO.mjs 18164 18165 18166 /** 18167 * The {@link parseISO} function options. 18168 */ 18169 18170 /** 18171 * @name parseISO 18172 * @category Common Helpers 18173 * @summary Parse ISO string 18174 * 18175 * @description 18176 * Parse the given string in ISO 8601 format and return an instance of Date. 18177 * 18178 * Function accepts complete ISO 8601 formats as well as partial implementations. 18179 * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 18180 * 18181 * If the argument isn't a string, the function cannot parse the string or 18182 * the values are invalid, it returns Invalid Date. 18183 * 18184 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). 18185 * 18186 * @param argument - The value to convert 18187 * @param options - An object with options 18188 * 18189 * @returns The parsed date in the local time zone 18190 * 18191 * @example 18192 * // Convert string '2014-02-11T11:30:30' to date: 18193 * const result = parseISO('2014-02-11T11:30:30') 18194 * //=> Tue Feb 11 2014 11:30:30 18195 * 18196 * @example 18197 * // Convert string '+02014101' to date, 18198 * // if the additional number of digits in the extended year format is 1: 18199 * const result = parseISO('+02014101', { additionalDigits: 1 }) 18200 * //=> Fri Apr 11 2014 00:00:00 18201 */ 18202 function parseISO(argument, options) { 18203 const additionalDigits = options?.additionalDigits ?? 2; 18204 const dateStrings = splitDateString(argument); 18205 18206 let date; 18207 if (dateStrings.date) { 18208 const parseYearResult = parseYear(dateStrings.date, additionalDigits); 18209 date = parseDate(parseYearResult.restDateString, parseYearResult.year); 18210 } 18211 18212 if (!date || isNaN(date.getTime())) { 18213 return new Date(NaN); 18214 } 18215 18216 const timestamp = date.getTime(); 18217 let time = 0; 18218 let offset; 18219 18220 if (dateStrings.time) { 18221 time = parseTime(dateStrings.time); 18222 if (isNaN(time)) { 18223 return new Date(NaN); 18224 } 18225 } 18226 18227 if (dateStrings.timezone) { 18228 offset = parseTimezone(dateStrings.timezone); 18229 if (isNaN(offset)) { 18230 return new Date(NaN); 18231 } 18232 } else { 18233 const dirtyDate = new Date(timestamp + time); 18234 // JS parsed string assuming it's in UTC timezone 18235 // but we need it to be parsed in our timezone 18236 // so we use utc values to build date in our timezone. 18237 // Year values from 0 to 99 map to the years 1900 to 1999 18238 // so set year explicitly with setFullYear. 18239 const result = new Date(0); 18240 result.setFullYear( 18241 dirtyDate.getUTCFullYear(), 18242 dirtyDate.getUTCMonth(), 18243 dirtyDate.getUTCDate(), 18244 ); 18245 result.setHours( 18246 dirtyDate.getUTCHours(), 18247 dirtyDate.getUTCMinutes(), 18248 dirtyDate.getUTCSeconds(), 18249 dirtyDate.getUTCMilliseconds(), 18250 ); 18251 return result; 18252 } 18253 18254 return new Date(timestamp + time + offset); 18255 } 18256 18257 const patterns = { 18258 dateTimeDelimiter: /[T ]/, 18259 timeZoneDelimiter: /[Z ]/i, 18260 timezone: /([Z+-].*)$/, 18261 }; 18262 18263 const dateRegex = 18264 /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; 18265 const timeRegex = 18266 /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; 18267 const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; 18268 18269 function splitDateString(dateString) { 18270 const dateStrings = {}; 18271 const array = dateString.split(patterns.dateTimeDelimiter); 18272 let timeString; 18273 18274 // The regex match should only return at maximum two array elements. 18275 // [date], [time], or [date, time]. 18276 if (array.length > 2) { 18277 return dateStrings; 18278 } 18279 18280 if (/:/.test(array[0])) { 18281 timeString = array[0]; 18282 } else { 18283 dateStrings.date = array[0]; 18284 timeString = array[1]; 18285 if (patterns.timeZoneDelimiter.test(dateStrings.date)) { 18286 dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; 18287 timeString = dateString.substr( 18288 dateStrings.date.length, 18289 dateString.length, 18290 ); 18291 } 18292 } 18293 18294 if (timeString) { 18295 const token = patterns.timezone.exec(timeString); 18296 if (token) { 18297 dateStrings.time = timeString.replace(token[1], ""); 18298 dateStrings.timezone = token[1]; 18299 } else { 18300 dateStrings.time = timeString; 18301 } 18302 } 18303 18304 return dateStrings; 18305 } 18306 18307 function parseYear(dateString, additionalDigits) { 18308 const regex = new RegExp( 18309 "^(?:(\\d{4}|[+-]\\d{" + 18310 (4 + additionalDigits) + 18311 "})|(\\d{2}|[+-]\\d{" + 18312 (2 + additionalDigits) + 18313 "})$)", 18314 ); 18315 18316 const captures = dateString.match(regex); 18317 // Invalid ISO-formatted year 18318 if (!captures) return { year: NaN, restDateString: "" }; 18319 18320 const year = captures[1] ? parseInt(captures[1]) : null; 18321 const century = captures[2] ? parseInt(captures[2]) : null; 18322 18323 // either year or century is null, not both 18324 return { 18325 year: century === null ? year : century * 100, 18326 restDateString: dateString.slice((captures[1] || captures[2]).length), 18327 }; 18328 } 18329 18330 function parseDate(dateString, year) { 18331 // Invalid ISO-formatted year 18332 if (year === null) return new Date(NaN); 18333 18334 const captures = dateString.match(dateRegex); 18335 // Invalid ISO-formatted string 18336 if (!captures) return new Date(NaN); 18337 18338 const isWeekDate = !!captures[4]; 18339 const dayOfYear = parseDateUnit(captures[1]); 18340 const month = parseDateUnit(captures[2]) - 1; 18341 const day = parseDateUnit(captures[3]); 18342 const week = parseDateUnit(captures[4]); 18343 const dayOfWeek = parseDateUnit(captures[5]) - 1; 18344 18345 if (isWeekDate) { 18346 if (!validateWeekDate(year, week, dayOfWeek)) { 18347 return new Date(NaN); 18348 } 18349 return dayOfISOWeekYear(year, week, dayOfWeek); 18350 } else { 18351 const date = new Date(0); 18352 if ( 18353 !validateDate(year, month, day) || 18354 !validateDayOfYearDate(year, dayOfYear) 18355 ) { 18356 return new Date(NaN); 18357 } 18358 date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); 18359 return date; 18360 } 18361 } 18362 18363 function parseDateUnit(value) { 18364 return value ? parseInt(value) : 1; 18365 } 18366 18367 function parseTime(timeString) { 18368 const captures = timeString.match(timeRegex); 18369 if (!captures) return NaN; // Invalid ISO-formatted time 18370 18371 const hours = parseTimeUnit(captures[1]); 18372 const minutes = parseTimeUnit(captures[2]); 18373 const seconds = parseTimeUnit(captures[3]); 18374 18375 if (!validateTime(hours, minutes, seconds)) { 18376 return NaN; 18377 } 18378 18379 return ( 18380 hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000 18381 ); 18382 } 18383 18384 function parseTimeUnit(value) { 18385 return (value && parseFloat(value.replace(",", "."))) || 0; 18386 } 18387 18388 function parseTimezone(timezoneString) { 18389 if (timezoneString === "Z") return 0; 18390 18391 const captures = timezoneString.match(timezoneRegex); 18392 if (!captures) return 0; 18393 18394 const sign = captures[1] === "+" ? -1 : 1; 18395 const hours = parseInt(captures[2]); 18396 const minutes = (captures[3] && parseInt(captures[3])) || 0; 18397 18398 if (!validateTimezone(hours, minutes)) { 18399 return NaN; 18400 } 18401 18402 return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); 18403 } 18404 18405 function dayOfISOWeekYear(isoWeekYear, week, day) { 18406 const date = new Date(0); 18407 date.setUTCFullYear(isoWeekYear, 0, 4); 18408 const fourthOfJanuaryDay = date.getUTCDay() || 7; 18409 const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; 18410 date.setUTCDate(date.getUTCDate() + diff); 18411 return date; 18412 } 18413 18414 // Validation functions 18415 18416 // February is null to handle the leap year (using ||) 18417 const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 18418 18419 function isLeapYearIndex(year) { 18420 return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0); 18421 } 18422 18423 function validateDate(year, month, date) { 18424 return ( 18425 month >= 0 && 18426 month <= 11 && 18427 date >= 1 && 18428 date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28)) 18429 ); 18430 } 18431 18432 function validateDayOfYearDate(year, dayOfYear) { 18433 return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365); 18434 } 18435 18436 function validateWeekDate(_year, week, day) { 18437 return week >= 1 && week <= 53 && day >= 0 && day <= 6; 18438 } 18439 18440 function validateTime(hours, minutes, seconds) { 18441 if (hours === 24) { 18442 return minutes === 0 && seconds === 0; 18443 } 18444 18445 return ( 18446 seconds >= 0 && 18447 seconds < 60 && 18448 minutes >= 0 && 18449 minutes < 60 && 18450 hours >= 0 && 18451 hours < 25 18452 ); 18453 } 18454 18455 function validateTimezone(_hours, minutes) { 18456 return minutes >= 0 && minutes <= 59; 18457 } 18458 18459 // Fallback for modularized imports: 18460 /* harmony default export */ const date_fns_parseISO = ((/* unused pure expression or super */ null && (parseISO))); 18461 18462 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 const { PrivatePublishDateTimePicker } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 18474 function PostSchedule(props) { 18475 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18476 PrivatePostSchedule, 18477 { 18478 ...props, 18479 showPopoverHeaderActions: true, 18480 isCompact: false 18481 } 18482 ); 18483 } 18484 function PrivatePostSchedule({ 18485 onClose, 18486 showPopoverHeaderActions, 18487 isCompact 18488 }) { 18489 const { postDate, postType } = (0,external_wp_data_namespaceObject.useSelect)( 18490 (select) => ({ 18491 postDate: select(store_store).getEditedPostAttribute("date"), 18492 postType: select(store_store).getCurrentPostType() 18493 }), 18494 [] 18495 ); 18496 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18497 const onUpdateDate = (date) => editPost({ date }); 18498 const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)( 18499 startOfMonth(new Date(postDate)) 18500 ); 18501 const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)( 18502 (select) => select(external_wp_coreData_namespaceObject.store).getEntityRecords("postType", postType, { 18503 status: "publish,future", 18504 after: startOfMonth(previewedMonth).toISOString(), 18505 before: endOfMonth(previewedMonth).toISOString(), 18506 exclude: [select(store_store).getCurrentPostId()], 18507 per_page: 100, 18508 _fields: "id,date" 18509 }), 18510 [previewedMonth, postType] 18511 ); 18512 const events = (0,external_wp_element_namespaceObject.useMemo)( 18513 () => (eventsByPostType || []).map(({ date: eventDate }) => ({ 18514 date: new Date(eventDate) 18515 })), 18516 [eventsByPostType] 18517 ); 18518 const settings = (0,external_wp_date_namespaceObject.getSettings)(); 18519 const is12HourTime = /a(?!\\)/i.test( 18520 settings.formats.time.toLowerCase().replace(/\\\\/g, "").split("").reverse().join("") 18521 // Reverse the string and test for "a" not followed by a slash. 18522 ); 18523 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18524 PrivatePublishDateTimePicker, 18525 { 18526 currentDate: postDate, 18527 onChange: onUpdateDate, 18528 is12Hour: is12HourTime, 18529 dateOrder: ( 18530 /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */ 18531 (0,external_wp_i18n_namespaceObject._x)("dmy", "date order") 18532 ), 18533 events, 18534 onMonthPreviewed: (date) => setPreviewedMonth(parseISO(date)), 18535 onClose, 18536 isCompact, 18537 showPopoverHeaderActions 18538 } 18539 ); 18540 } 18541 18542 18543 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js 18544 18545 18546 18547 18548 function PostScheduleLabel(props) { 18549 return usePostScheduleLabel(props); 18550 } 18551 function usePostScheduleLabel({ full = false } = {}) { 18552 const { date, isFloating } = (0,external_wp_data_namespaceObject.useSelect)( 18553 (select) => ({ 18554 date: select(store_store).getEditedPostAttribute("date"), 18555 isFloating: select(store_store).isEditedPostDateFloating() 18556 }), 18557 [] 18558 ); 18559 return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, { isFloating }); 18560 } 18561 function getFullPostScheduleLabel(dateAttribute) { 18562 const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); 18563 const timezoneAbbreviation = getTimezoneAbbreviation(); 18564 const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)( 18565 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 18566 (0,external_wp_i18n_namespaceObject._x)("F j, Y g:i\xA0a", "post schedule full date format"), 18567 date 18568 ); 18569 return (0,external_wp_i18n_namespaceObject.isRTL)() ? `$timezoneAbbreviation} $formattedDate}` : `$formattedDate} $timezoneAbbreviation}`; 18570 } 18571 function getPostScheduleLabel(dateAttribute, { isFloating = false, now = /* @__PURE__ */ new Date() } = {}) { 18572 if (!dateAttribute || isFloating) { 18573 return (0,external_wp_i18n_namespaceObject.__)("Immediately"); 18574 } 18575 if (!isTimezoneSameAsSiteTimezone(now)) { 18576 return getFullPostScheduleLabel(dateAttribute); 18577 } 18578 const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute); 18579 if (isSameDay(date, now)) { 18580 return (0,external_wp_i18n_namespaceObject.sprintf)( 18581 // translators: %s: Time of day the post is scheduled for. 18582 (0,external_wp_i18n_namespaceObject.__)("Today at %s"), 18583 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 18584 (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)("g:i\xA0a", "post schedule time format"), date) 18585 ); 18586 } 18587 const tomorrow = new Date(now); 18588 tomorrow.setDate(tomorrow.getDate() + 1); 18589 if (isSameDay(date, tomorrow)) { 18590 return (0,external_wp_i18n_namespaceObject.sprintf)( 18591 // translators: %s: Time of day the post is scheduled for. 18592 (0,external_wp_i18n_namespaceObject.__)("Tomorrow at %s"), 18593 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 18594 (0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)("g:i\xA0a", "post schedule time format"), date) 18595 ); 18596 } 18597 if (date.getFullYear() === now.getFullYear()) { 18598 return (0,external_wp_date_namespaceObject.dateI18n)( 18599 // translators: If using a space between 'g:i' and 'a', use a non-breaking space. 18600 (0,external_wp_i18n_namespaceObject._x)("F j g:i\xA0a", "post schedule date format without year"), 18601 date 18602 ); 18603 } 18604 return (0,external_wp_date_namespaceObject.dateI18n)( 18605 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 18606 (0,external_wp_i18n_namespaceObject._x)("F j, Y g:i\xA0a", "post schedule full date format"), 18607 date 18608 ); 18609 } 18610 function getTimezoneAbbreviation() { 18611 const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); 18612 if (timezone.abbr && isNaN(Number(timezone.abbr))) { 18613 return timezone.abbr; 18614 } 18615 const symbol = timezone.offset < 0 ? "" : "+"; 18616 return `UTC$symbol}$timezone.offsetFormatted}`; 18617 } 18618 function isTimezoneSameAsSiteTimezone(date) { 18619 const { timezone } = (0,external_wp_date_namespaceObject.getSettings)(); 18620 const siteOffset = Number(timezone.offset); 18621 const dateOffset = -1 * (date.getTimezoneOffset() / 60); 18622 return siteOffset === dateOffset; 18623 } 18624 function isSameDay(left, right) { 18625 return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear(); 18626 } 18627 18628 18629 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js 18630 18631 18632 18633 18634 18635 const MIN_MOST_USED_TERMS = 3; 18636 const DEFAULT_QUERY = { 18637 per_page: 10, 18638 orderby: "count", 18639 order: "desc", 18640 hide_empty: true, 18641 _fields: "id,name,count", 18642 context: "view" 18643 }; 18644 function MostUsedTerms({ onSelect, taxonomy }) { 18645 const { _terms, showTerms } = (0,external_wp_data_namespaceObject.useSelect)( 18646 (select) => { 18647 const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords( 18648 "taxonomy", 18649 taxonomy.slug, 18650 DEFAULT_QUERY 18651 ); 18652 return { 18653 _terms: mostUsedTerms, 18654 showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS 18655 }; 18656 }, 18657 [taxonomy.slug] 18658 ); 18659 if (!showTerms) { 18660 return null; 18661 } 18662 const terms = unescapeTerms(_terms); 18663 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-taxonomies__flat-term-most-used", children: [ 18664 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18665 external_wp_components_namespaceObject.BaseControl.VisualLabel, 18666 { 18667 as: "h3", 18668 className: "editor-post-taxonomies__flat-term-most-used-label", 18669 children: taxonomy.labels.most_used 18670 } 18671 ), 18672 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18673 "ul", 18674 { 18675 role: "list", 18676 className: "editor-post-taxonomies__flat-term-most-used-list", 18677 children: terms.map((term) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("li", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18678 external_wp_components_namespaceObject.Button, 18679 { 18680 __next40pxDefaultSize: true, 18681 variant: "link", 18682 onClick: () => onSelect(term), 18683 children: term.name 18684 } 18685 ) }, term.id)) 18686 } 18687 ) 18688 ] }); 18689 } 18690 18691 18692 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 const flat_term_selector_EMPTY_ARRAY = []; 18707 const MAX_TERMS_SUGGESTIONS = 100; 18708 const flat_term_selector_DEFAULT_QUERY = { 18709 per_page: MAX_TERMS_SUGGESTIONS, 18710 _fields: "id,name", 18711 context: "view" 18712 }; 18713 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); 18714 const termNamesToIds = (names, terms) => { 18715 return names.map( 18716 (termName) => terms.find((term) => isSameTermName(term.name, termName))?.id 18717 ).filter((id) => id !== void 0); 18718 }; 18719 const Wrapper = ({ children, __nextHasNoMarginBottom }) => __nextHasNoMarginBottom ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children }) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children }); 18720 function FlatTermSelector({ slug, __nextHasNoMarginBottom }) { 18721 const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); 18722 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(""); 18723 const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); 18724 if (!__nextHasNoMarginBottom) { 18725 external_wp_deprecated_default()( 18726 "Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector", 18727 { 18728 since: "6.7", 18729 version: "7.0", 18730 hint: "Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version." 18731 } 18732 ); 18733 } 18734 const { 18735 terms, 18736 termIds, 18737 taxonomy, 18738 hasAssignAction, 18739 hasCreateAction, 18740 hasResolvedTerms 18741 } = (0,external_wp_data_namespaceObject.useSelect)( 18742 (select) => { 18743 const { getCurrentPost, getEditedPostAttribute } = select(store_store); 18744 const { getEntityRecords, getEntityRecord, hasFinishedResolution } = select(external_wp_coreData_namespaceObject.store); 18745 const post = getCurrentPost(); 18746 const _taxonomy = getEntityRecord("root", "taxonomy", slug); 18747 const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; 18748 const query = { 18749 ...flat_term_selector_DEFAULT_QUERY, 18750 include: _termIds?.join(","), 18751 per_page: -1 18752 }; 18753 return { 18754 hasCreateAction: _taxonomy ? post._links?.["wp:action-create-" + _taxonomy.rest_base] ?? false : false, 18755 hasAssignAction: _taxonomy ? post._links?.["wp:action-assign-" + _taxonomy.rest_base] ?? false : false, 18756 taxonomy: _taxonomy, 18757 termIds: _termIds, 18758 terms: _termIds?.length ? getEntityRecords("taxonomy", slug, query) : flat_term_selector_EMPTY_ARRAY, 18759 hasResolvedTerms: hasFinishedResolution("getEntityRecords", [ 18760 "taxonomy", 18761 slug, 18762 query 18763 ]) 18764 }; 18765 }, 18766 [slug] 18767 ); 18768 const { searchResults } = (0,external_wp_data_namespaceObject.useSelect)( 18769 (select) => { 18770 const { getEntityRecords } = select(external_wp_coreData_namespaceObject.store); 18771 return { 18772 searchResults: !!search ? getEntityRecords("taxonomy", slug, { 18773 ...flat_term_selector_DEFAULT_QUERY, 18774 search 18775 }) : flat_term_selector_EMPTY_ARRAY 18776 }; 18777 }, 18778 [search, slug] 18779 ); 18780 (0,external_wp_element_namespaceObject.useEffect)(() => { 18781 if (hasResolvedTerms) { 18782 const newValues = (terms ?? []).map( 18783 (term) => unescapeString(term.name) 18784 ); 18785 setValues(newValues); 18786 } 18787 }, [terms, hasResolvedTerms]); 18788 const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { 18789 return (searchResults ?? []).map( 18790 (term) => unescapeString(term.name) 18791 ); 18792 }, [searchResults]); 18793 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 18794 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 18795 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 18796 if (!hasAssignAction) { 18797 return null; 18798 } 18799 async function findOrCreateTerm(term) { 18800 try { 18801 const newTerm = await saveEntityRecord("taxonomy", slug, term, { 18802 throwOnError: true 18803 }); 18804 return unescapeTerm(newTerm); 18805 } catch (error) { 18806 if (error.code !== "term_exists") { 18807 throw error; 18808 } 18809 return { 18810 id: error.data.term_id, 18811 name: term.name 18812 }; 18813 } 18814 } 18815 function onUpdateTerms(newTermIds) { 18816 editPost({ [taxonomy.rest_base]: newTermIds }); 18817 } 18818 function onChange(termNames) { 18819 const availableTerms = [ 18820 ...terms ?? [], 18821 ...searchResults ?? [] 18822 ]; 18823 const uniqueTerms = termNames.reduce((acc, name) => { 18824 if (!acc.some((n) => n.toLowerCase() === name.toLowerCase())) { 18825 acc.push(name); 18826 } 18827 return acc; 18828 }, []); 18829 const newTermNames = uniqueTerms.filter( 18830 (termName) => !availableTerms.find( 18831 (term) => isSameTermName(term.name, termName) 18832 ) 18833 ); 18834 setValues(uniqueTerms); 18835 if (newTermNames.length === 0) { 18836 onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 18837 return; 18838 } 18839 if (!hasCreateAction) { 18840 return; 18841 } 18842 Promise.all( 18843 newTermNames.map( 18844 (termName) => findOrCreateTerm({ name: termName }) 18845 ) 18846 ).then((newTerms) => { 18847 const newAvailableTerms = availableTerms.concat(newTerms); 18848 onUpdateTerms( 18849 termNamesToIds(uniqueTerms, newAvailableTerms) 18850 ); 18851 }).catch((error) => { 18852 createErrorNotice(error.message, { 18853 type: "snackbar" 18854 }); 18855 onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); 18856 }); 18857 } 18858 function appendTerm(newTerm) { 18859 if (termIds.includes(newTerm.id)) { 18860 return; 18861 } 18862 const newTermIds = [...termIds, newTerm.id]; 18863 const defaultName = slug === "post_tag" ? (0,external_wp_i18n_namespaceObject.__)("Tag") : (0,external_wp_i18n_namespaceObject.__)("Term"); 18864 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 18865 /* translators: %s: term name. */ 18866 (0,external_wp_i18n_namespaceObject._x)("%s added", "term"), 18867 taxonomy?.labels?.singular_name ?? defaultName 18868 ); 18869 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, "assertive"); 18870 onUpdateTerms(newTermIds); 18871 } 18872 const newTermLabel = taxonomy?.labels?.add_new_item ?? (slug === "post_tag" ? (0,external_wp_i18n_namespaceObject.__)("Add Tag") : (0,external_wp_i18n_namespaceObject.__)("Add Term")); 18873 const singularName = taxonomy?.labels?.singular_name ?? (slug === "post_tag" ? (0,external_wp_i18n_namespaceObject.__)("Tag") : (0,external_wp_i18n_namespaceObject.__)("Term")); 18874 const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 18875 /* translators: %s: term name. */ 18876 (0,external_wp_i18n_namespaceObject._x)("%s added", "term"), 18877 singularName 18878 ); 18879 const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 18880 /* translators: %s: term name. */ 18881 (0,external_wp_i18n_namespaceObject._x)("%s removed", "term"), 18882 singularName 18883 ); 18884 const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( 18885 /* translators: %s: term name. */ 18886 (0,external_wp_i18n_namespaceObject._x)("Remove %s", "term"), 18887 singularName 18888 ); 18889 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, { __nextHasNoMarginBottom, children: [ 18890 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 18891 external_wp_components_namespaceObject.FormTokenField, 18892 { 18893 __next40pxDefaultSize: true, 18894 value: values, 18895 suggestions, 18896 onChange, 18897 onInputChange: debouncedSearch, 18898 maxSuggestions: MAX_TERMS_SUGGESTIONS, 18899 label: newTermLabel, 18900 messages: { 18901 added: termAddedLabel, 18902 removed: termRemovedLabel, 18903 remove: removeTermLabel 18904 }, 18905 __nextHasNoMarginBottom 18906 } 18907 ), 18908 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, { taxonomy, onSelect: appendTerm }) 18909 ] }); 18910 } 18911 var flat_term_selector_default = (0,external_wp_components_namespaceObject.withFilters)("editor.PostTaxonomyType")(FlatTermSelector); 18912 18913 18914 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js 18915 18916 18917 18918 18919 18920 18921 18922 18923 const TagsPanel = () => { 18924 const tagLabels = (0,external_wp_data_namespaceObject.useSelect)((select) => { 18925 const taxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy("post_tag"); 18926 return taxonomy?.labels; 18927 }, []); 18928 const addNewItem = tagLabels?.add_new_item ?? (0,external_wp_i18n_namespaceObject.__)("Add tag"); 18929 const tagLabel = tagLabels?.name ?? (0,external_wp_i18n_namespaceObject.__)("Tags"); 18930 const panelBodyTitle = [ 18931 (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), 18932 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: addNewItem }, "label") 18933 ]; 18934 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [ 18935 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.sprintf)( 18936 // translators: %s is the taxonomy name (e.g., "Tags"). 18937 (0,external_wp_i18n_namespaceObject.__)( 18938 "%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post." 18939 ), 18940 tagLabel 18941 ) }), 18942 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(flat_term_selector_default, { slug: "post_tag", __nextHasNoMarginBottom: true }) 18943 ] }); 18944 }; 18945 const MaybeTagsPanel = () => { 18946 const { postHasTags, siteHasTags, isPostTypeSupported } = (0,external_wp_data_namespaceObject.useSelect)( 18947 (select) => { 18948 const postType = select(store_store).getCurrentPostType(); 18949 const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getEntityRecord( 18950 "root", 18951 "taxonomy", 18952 "post_tag" 18953 ); 18954 const _isPostTypeSupported = tagsTaxonomy?.types?.includes(postType); 18955 const areTagsFetched = tagsTaxonomy !== void 0; 18956 const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute( 18957 tagsTaxonomy.rest_base 18958 ); 18959 const siteTags = _isPostTypeSupported ? !!select(external_wp_coreData_namespaceObject.store).getEntityRecords( 18960 "taxonomy", 18961 "post_tag", 18962 { per_page: 1 } 18963 )?.length : false; 18964 return { 18965 postHasTags: !!tags?.length, 18966 siteHasTags: siteTags, 18967 isPostTypeSupported: areTagsFetched && _isPostTypeSupported 18968 }; 18969 }, 18970 [] 18971 ); 18972 const [hadTagsWhenOpeningThePanel] = (0,external_wp_element_namespaceObject.useState)(postHasTags); 18973 if (!isPostTypeSupported || !siteHasTags) { 18974 return null; 18975 } 18976 if (!hadTagsWhenOpeningThePanel) { 18977 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TagsPanel, {}); 18978 } 18979 return null; 18980 }; 18981 var maybe_tags_panel_default = MaybeTagsPanel; 18982 18983 18984 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js 18985 18986 18987 18988 18989 18990 18991 18992 const getSuggestion = (supportedFormats, suggestedPostFormat) => { 18993 const formats = POST_FORMATS.filter( 18994 (format) => supportedFormats?.includes(format.id) 18995 ); 18996 return formats.find((format) => format.id === suggestedPostFormat); 18997 }; 18998 const PostFormatSuggestion = ({ 18999 suggestedPostFormat, 19000 suggestionText, 19001 onUpdatePostFormat 19002 }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19003 external_wp_components_namespaceObject.Button, 19004 { 19005 __next40pxDefaultSize: true, 19006 variant: "link", 19007 onClick: () => onUpdatePostFormat(suggestedPostFormat), 19008 children: suggestionText 19009 } 19010 ); 19011 function PostFormatPanel() { 19012 const { currentPostFormat, suggestion } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 19013 const { getEditedPostAttribute, getSuggestedPostFormat } = select(store_store); 19014 const supportedFormats = select(external_wp_coreData_namespaceObject.store).getThemeSupports().formats ?? []; 19015 return { 19016 currentPostFormat: getEditedPostAttribute("format"), 19017 suggestion: getSuggestion( 19018 supportedFormats, 19019 getSuggestedPostFormat() 19020 ) 19021 }; 19022 }, []); 19023 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 19024 const onUpdatePostFormat = (format) => editPost({ format }); 19025 const panelBodyTitle = [ 19026 (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), 19027 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)("Use a post format") }, "label") 19028 ]; 19029 if (!suggestion || suggestion.id === currentPostFormat) { 19030 return null; 19031 } 19032 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [ 19033 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 19034 "Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling." 19035 ) }), 19036 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19037 PostFormatSuggestion, 19038 { 19039 onUpdatePostFormat, 19040 suggestedPostFormat: suggestion.id, 19041 suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( 19042 /* translators: %1s: post format */ 19043 (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), 19044 suggestion.caption 19045 ) 19046 } 19047 ) }) 19048 ] }); 19049 } 19050 19051 19052 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 const { normalizeTextString } = unlock(external_wp_components_namespaceObject.privateApis); 19067 const { RECEIVE_INTERMEDIATE_RESULTS } = unlock(external_wp_coreData_namespaceObject.privateApis); 19068 const hierarchical_term_selector_DEFAULT_QUERY = { 19069 per_page: -1, 19070 orderby: "name", 19071 order: "asc", 19072 _fields: "id,name,parent", 19073 context: "view", 19074 [RECEIVE_INTERMEDIATE_RESULTS]: true 19075 }; 19076 const MIN_TERMS_COUNT_FOR_FILTER = 8; 19077 const hierarchical_term_selector_EMPTY_ARRAY = []; 19078 function sortBySelected(termsTree, terms) { 19079 const treeHasSelection = (termTree) => { 19080 if (terms.indexOf(termTree.id) !== -1) { 19081 return true; 19082 } 19083 if (void 0 === termTree.children) { 19084 return false; 19085 } 19086 return termTree.children.map(treeHasSelection).filter((child) => child).length > 0; 19087 }; 19088 const termOrChildIsSelected = (termA, termB) => { 19089 const termASelected = treeHasSelection(termA); 19090 const termBSelected = treeHasSelection(termB); 19091 if (termASelected === termBSelected) { 19092 return 0; 19093 } 19094 if (termASelected && !termBSelected) { 19095 return -1; 19096 } 19097 if (!termASelected && termBSelected) { 19098 return 1; 19099 } 19100 return 0; 19101 }; 19102 const newTermTree = [...termsTree]; 19103 newTermTree.sort(termOrChildIsSelected); 19104 return newTermTree; 19105 } 19106 function findTerm(terms, parent, name) { 19107 return terms.find((term) => { 19108 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); 19109 }); 19110 } 19111 function getFilterMatcher(filterValue) { 19112 const matchTermsForFilter = (originalTerm) => { 19113 if ("" === filterValue) { 19114 return originalTerm; 19115 } 19116 const term = { ...originalTerm }; 19117 if (term.children.length > 0) { 19118 term.children = term.children.map(matchTermsForFilter).filter((child) => child); 19119 } 19120 if (-1 !== normalizeTextString(term.name).indexOf( 19121 normalizeTextString(filterValue) 19122 ) || term.children.length > 0) { 19123 return term; 19124 } 19125 return false; 19126 }; 19127 return matchTermsForFilter; 19128 } 19129 function HierarchicalTermSelector({ slug }) { 19130 const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); 19131 const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(""); 19132 const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(""); 19133 const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); 19134 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(""); 19135 const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); 19136 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); 19137 const { 19138 hasCreateAction, 19139 hasAssignAction, 19140 terms, 19141 loading, 19142 availableTerms, 19143 taxonomy 19144 } = (0,external_wp_data_namespaceObject.useSelect)( 19145 (select) => { 19146 const { getCurrentPost, getEditedPostAttribute } = select(store_store); 19147 const { getEntityRecord, getEntityRecords, isResolving } = select(external_wp_coreData_namespaceObject.store); 19148 const _taxonomy = getEntityRecord("root", "taxonomy", slug); 19149 const post = getCurrentPost(); 19150 return { 19151 hasCreateAction: _taxonomy ? !!post._links?.["wp:action-create-" + _taxonomy.rest_base] : false, 19152 hasAssignAction: _taxonomy ? !!post._links?.["wp:action-assign-" + _taxonomy.rest_base] : false, 19153 terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, 19154 loading: isResolving("getEntityRecords", [ 19155 "taxonomy", 19156 slug, 19157 hierarchical_term_selector_DEFAULT_QUERY 19158 ]), 19159 availableTerms: getEntityRecords("taxonomy", slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, 19160 taxonomy: _taxonomy 19161 }; 19162 }, 19163 [slug] 19164 ); 19165 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 19166 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 19167 const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)( 19168 () => sortBySelected(terms_buildTermsTree(availableTerms), terms), 19169 // Remove `terms` from the dependency list to avoid reordering every time 19170 // checking or unchecking a term. 19171 [availableTerms] 19172 ); 19173 const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 19174 if (!hasAssignAction) { 19175 return null; 19176 } 19177 const addTerm = (term) => { 19178 return saveEntityRecord("taxonomy", slug, term, { 19179 throwOnError: true 19180 }); 19181 }; 19182 const onUpdateTerms = (termIds) => { 19183 editPost({ [taxonomy.rest_base]: termIds }); 19184 }; 19185 const onChange = (termId) => { 19186 const hasTerm = terms.includes(termId); 19187 const newTerms = hasTerm ? terms.filter((id) => id !== termId) : [...terms, termId]; 19188 onUpdateTerms(newTerms); 19189 }; 19190 const onChangeFormName = (value) => { 19191 setFormName(value); 19192 }; 19193 const onChangeFormParent = (parentId) => { 19194 setFormParent(parentId); 19195 }; 19196 const onToggleForm = () => { 19197 setShowForm(!showForm); 19198 }; 19199 const onAddTerm = async (event) => { 19200 event.preventDefault(); 19201 if (formName === "" || adding) { 19202 return; 19203 } 19204 const existingTerm = findTerm(availableTerms, formParent, formName); 19205 if (existingTerm) { 19206 if (!terms.some((term) => term === existingTerm.id)) { 19207 onUpdateTerms([...terms, existingTerm.id]); 19208 } 19209 setFormName(""); 19210 setFormParent(""); 19211 return; 19212 } 19213 setAdding(true); 19214 let newTerm; 19215 try { 19216 newTerm = await addTerm({ 19217 name: formName, 19218 parent: formParent ? formParent : void 0 19219 }); 19220 } catch (error) { 19221 createErrorNotice(error.message, { 19222 type: "snackbar" 19223 }); 19224 return; 19225 } 19226 const defaultName = slug === "category" ? (0,external_wp_i18n_namespaceObject.__)("Category") : (0,external_wp_i18n_namespaceObject.__)("Term"); 19227 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 19228 /* translators: %s: term name. */ 19229 (0,external_wp_i18n_namespaceObject._x)("%s added", "term"), 19230 taxonomy?.labels?.singular_name ?? defaultName 19231 ); 19232 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, "assertive"); 19233 setAdding(false); 19234 setFormName(""); 19235 setFormParent(""); 19236 onUpdateTerms([...terms, newTerm.id]); 19237 }; 19238 const setFilter = (value) => { 19239 const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter((term) => term); 19240 const getResultCount = (termsTree) => { 19241 let count = 0; 19242 for (let i = 0; i < termsTree.length; i++) { 19243 count++; 19244 if (void 0 !== termsTree[i].children) { 19245 count += getResultCount(termsTree[i].children); 19246 } 19247 } 19248 return count; 19249 }; 19250 setFilterValue(value); 19251 setFilteredTermsTree(newFilteredTermsTree); 19252 const resultCount = getResultCount(newFilteredTermsTree); 19253 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( 19254 /* translators: %d: number of results. */ 19255 (0,external_wp_i18n_namespaceObject._n)("%d result found.", "%d results found.", resultCount), 19256 resultCount 19257 ); 19258 debouncedSpeak(resultsFoundMessage, "assertive"); 19259 }; 19260 const renderTerms = (renderedTerms) => { 19261 return renderedTerms.map((term) => { 19262 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19263 "div", 19264 { 19265 className: "editor-post-taxonomies__hierarchical-terms-choice", 19266 children: [ 19267 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19268 external_wp_components_namespaceObject.CheckboxControl, 19269 { 19270 __nextHasNoMarginBottom: true, 19271 checked: terms.indexOf(term.id) !== -1, 19272 onChange: () => { 19273 const termId = parseInt(term.id, 10); 19274 onChange(termId); 19275 }, 19276 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(term.name) 19277 } 19278 ), 19279 !!term.children.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-taxonomies__hierarchical-terms-subchoices", children: renderTerms(term.children) }) 19280 ] 19281 }, 19282 term.id 19283 ); 19284 }); 19285 }; 19286 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => taxonomy?.labels?.[labelProperty] ?? (slug === "category" ? fallbackIsCategory : fallbackIsNotCategory); 19287 const newTermButtonLabel = labelWithFallback( 19288 "add_new_item", 19289 (0,external_wp_i18n_namespaceObject.__)("Add Category"), 19290 (0,external_wp_i18n_namespaceObject.__)("Add Term") 19291 ); 19292 const newTermLabel = labelWithFallback( 19293 "new_item_name", 19294 (0,external_wp_i18n_namespaceObject.__)("Add Category"), 19295 (0,external_wp_i18n_namespaceObject.__)("Add Term") 19296 ); 19297 const parentSelectLabel = labelWithFallback( 19298 "parent_item", 19299 (0,external_wp_i18n_namespaceObject.__)("Parent Category"), 19300 (0,external_wp_i18n_namespaceObject.__)("Parent Term") 19301 ); 19302 const noParentOption = `\u2014 $parentSelectLabel} \u2014`; 19303 const newTermSubmitLabel = newTermButtonLabel; 19304 const filterLabel = taxonomy?.labels?.search_items ?? (0,external_wp_i18n_namespaceObject.__)("Search Terms"); 19305 const groupLabel = taxonomy?.name ?? (0,external_wp_i18n_namespaceObject.__)("Terms"); 19306 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; 19307 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "column", gap: "4", children: [ 19308 showFilter && !loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19309 external_wp_components_namespaceObject.SearchControl, 19310 { 19311 __next40pxDefaultSize: true, 19312 __nextHasNoMarginBottom: true, 19313 label: filterLabel, 19314 placeholder: filterLabel, 19315 value: filterValue, 19316 onChange: setFilter 19317 } 19318 ), 19319 loading && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19320 external_wp_components_namespaceObject.Flex, 19321 { 19322 justify: "center", 19323 style: { 19324 // Match SearchControl height to prevent layout shift. 19325 height: "40px" 19326 }, 19327 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) 19328 } 19329 ), 19330 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19331 "div", 19332 { 19333 className: "editor-post-taxonomies__hierarchical-terms-list", 19334 tabIndex: "0", 19335 role: "group", 19336 "aria-label": groupLabel, 19337 children: renderTerms( 19338 "" !== filterValue ? filteredTermsTree : availableTermsTree 19339 ) 19340 } 19341 ), 19342 !loading && hasCreateAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19343 external_wp_components_namespaceObject.Button, 19344 { 19345 __next40pxDefaultSize: true, 19346 onClick: onToggleForm, 19347 className: "editor-post-taxonomies__hierarchical-terms-add", 19348 "aria-expanded": showForm, 19349 variant: "link", 19350 children: newTermButtonLabel 19351 } 19352 ) }), 19353 showForm && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onAddTerm, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, { direction: "column", gap: "4", children: [ 19354 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19355 external_wp_components_namespaceObject.TextControl, 19356 { 19357 __next40pxDefaultSize: true, 19358 __nextHasNoMarginBottom: true, 19359 className: "editor-post-taxonomies__hierarchical-terms-input", 19360 label: newTermLabel, 19361 value: formName, 19362 onChange: onChangeFormName, 19363 required: true 19364 } 19365 ), 19366 !!availableTerms.length && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19367 external_wp_components_namespaceObject.TreeSelect, 19368 { 19369 __next40pxDefaultSize: true, 19370 __nextHasNoMarginBottom: true, 19371 label: parentSelectLabel, 19372 noOptionLabel: noParentOption, 19373 onChange: onChangeFormParent, 19374 selectedId: formParent, 19375 tree: availableTermsTree 19376 } 19377 ), 19378 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19379 external_wp_components_namespaceObject.Button, 19380 { 19381 __next40pxDefaultSize: true, 19382 variant: "secondary", 19383 type: "submit", 19384 className: "editor-post-taxonomies__hierarchical-terms-submit", 19385 children: newTermSubmitLabel 19386 } 19387 ) }) 19388 ] }) }) 19389 ] }); 19390 } 19391 var hierarchical_term_selector_default = (0,external_wp_components_namespaceObject.withFilters)("editor.PostTaxonomyType")( 19392 HierarchicalTermSelector 19393 ); 19394 19395 19396 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js 19397 19398 19399 19400 19401 19402 19403 19404 19405 function MaybeCategoryPanel() { 19406 const { hasNoCategory, hasSiteCategories } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 19407 const postType = select(store_store).getCurrentPostType(); 19408 const { canUser, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 19409 const categoriesTaxonomy = getEntityRecord( 19410 "root", 19411 "taxonomy", 19412 "category" 19413 ); 19414 const defaultCategoryId = canUser("read", { 19415 kind: "root", 19416 name: "site" 19417 }) ? getEntityRecord("root", "site")?.default_category : void 0; 19418 const defaultCategory = defaultCategoryId ? getEntityRecord("taxonomy", "category", defaultCategoryId) : void 0; 19419 const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some((type) => type === postType); 19420 const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute( 19421 categoriesTaxonomy.rest_base 19422 ); 19423 const siteCategories = postTypeSupportsCategories ? !!select(external_wp_coreData_namespaceObject.store).getEntityRecords("taxonomy", "category", { 19424 exclude: [defaultCategoryId], 19425 per_page: 1 19426 })?.length : false; 19427 const noCategory = !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]); 19428 return { 19429 hasNoCategory: noCategory, 19430 hasSiteCategories: siteCategories 19431 }; 19432 }, []); 19433 const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); 19434 (0,external_wp_element_namespaceObject.useEffect)(() => { 19435 if (hasNoCategory) { 19436 setShouldShowPanel(true); 19437 } 19438 }, [hasNoCategory]); 19439 if (!shouldShowPanel || !hasSiteCategories) { 19440 return null; 19441 } 19442 const panelBodyTitle = [ 19443 (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), 19444 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)("Assign a category") }, "label") 19445 ]; 19446 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: false, title: panelBodyTitle, children: [ 19447 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 19448 "Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about." 19449 ) }), 19450 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(hierarchical_term_selector_default, { slug: "category" }) 19451 ] }); 19452 } 19453 var maybe_category_panel_default = MaybeCategoryPanel; 19454 19455 19456 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/media-util.js 19457 19458 19459 function generateUniqueBasenames(urls) { 19460 const basenames = /* @__PURE__ */ new Set(); 19461 return Object.fromEntries( 19462 urls.map((url) => { 19463 const filename = (0,external_wp_url_namespaceObject.getFilename)(url); 19464 let basename = ""; 19465 if (filename) { 19466 const parts = filename.split("."); 19467 if (parts.length > 1) { 19468 parts.pop(); 19469 } 19470 basename = parts.join("."); 19471 } 19472 if (!basename) { 19473 basename = esm_browser_v4(); 19474 } 19475 if (basenames.has(basename)) { 19476 basename = `$basename}-$esm_browser_v4()}`; 19477 } 19478 basenames.add(basename); 19479 return [url, basename]; 19480 }) 19481 ); 19482 } 19483 function fetchMedia(urls) { 19484 return Object.fromEntries( 19485 Object.entries(generateUniqueBasenames(urls)).map( 19486 ([url, basename]) => { 19487 const filePromise = window.fetch(url.includes("?") ? url : url + "?").then((response) => response.blob()).then((blob) => { 19488 return new File([blob], `$basename}.png`, { 19489 type: blob.type 19490 }); 19491 }); 19492 return [url, filePromise]; 19493 } 19494 ) 19495 ); 19496 } 19497 19498 19499 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-upload-media.js 19500 19501 19502 19503 19504 19505 19506 19507 19508 function flattenBlocks(blocks) { 19509 const result = []; 19510 blocks.forEach((block) => { 19511 result.push(block); 19512 result.push(...flattenBlocks(block.innerBlocks)); 19513 }); 19514 return result; 19515 } 19516 function hasExternalMedia(block) { 19517 if (block.name === "core/image" || block.name === "core/cover") { 19518 return block.attributes.url && !block.attributes.id; 19519 } 19520 if (block.name === "core/media-text") { 19521 return block.attributes.mediaUrl && !block.attributes.mediaId; 19522 } 19523 return void 0; 19524 } 19525 function getMediaInfo(block) { 19526 if (block.name === "core/image" || block.name === "core/cover") { 19527 const { url, alt, id } = block.attributes; 19528 return { url, alt, id }; 19529 } 19530 if (block.name === "core/media-text") { 19531 const { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes; 19532 return { url, alt, id }; 19533 } 19534 return {}; 19535 } 19536 function Image({ clientId, alt, url }) { 19537 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 19538 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19539 external_wp_components_namespaceObject.__unstableMotion.img, 19540 { 19541 tabIndex: 0, 19542 role: "button", 19543 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Select image block."), 19544 onClick: () => { 19545 selectBlock(clientId); 19546 }, 19547 onKeyDown: (event) => { 19548 if (event.key === "Enter" || event.key === " ") { 19549 selectBlock(clientId); 19550 event.preventDefault(); 19551 } 19552 }, 19553 alt, 19554 src: url, 19555 animate: { opacity: 1 }, 19556 exit: { opacity: 0, scale: 0 }, 19557 style: { 19558 width: "32px", 19559 height: "32px", 19560 objectFit: "cover", 19561 borderRadius: "2px", 19562 cursor: "pointer" 19563 }, 19564 whileHover: { scale: 1.08 } 19565 }, 19566 clientId 19567 ); 19568 } 19569 function MaybeUploadMediaPanel() { 19570 const [isUploading, setIsUploading] = (0,external_wp_element_namespaceObject.useState)(false); 19571 const [isAnimating, setIsAnimating] = (0,external_wp_element_namespaceObject.useState)(false); 19572 const [hadUploadError, setHadUploadError] = (0,external_wp_element_namespaceObject.useState)(false); 19573 const { editorBlocks, mediaUpload } = (0,external_wp_data_namespaceObject.useSelect)( 19574 (select) => ({ 19575 editorBlocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks(), 19576 mediaUpload: select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload 19577 }), 19578 [] 19579 ); 19580 const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter( 19581 (block) => hasExternalMedia(block) 19582 ); 19583 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 19584 if (!mediaUpload || !blocksWithExternalMedia.length) { 19585 return null; 19586 } 19587 const panelBodyTitle = [ 19588 (0,external_wp_i18n_namespaceObject.__)("Suggestion:"), 19589 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-publish-panel__link", children: (0,external_wp_i18n_namespaceObject.__)("External media") }, "label") 19590 ]; 19591 function updateBlockWithUploadedMedia(block, media) { 19592 if (block.name === "core/image" || block.name === "core/cover") { 19593 updateBlockAttributes(block.clientId, { 19594 id: media.id, 19595 url: media.url 19596 }); 19597 } 19598 if (block.name === "core/media-text") { 19599 updateBlockAttributes(block.clientId, { 19600 mediaId: media.id, 19601 mediaUrl: media.url 19602 }); 19603 } 19604 } 19605 function uploadImages() { 19606 setIsUploading(true); 19607 setHadUploadError(false); 19608 const mediaUrls = new Set( 19609 blocksWithExternalMedia.map((block) => { 19610 const { url } = getMediaInfo(block); 19611 return url; 19612 }) 19613 ); 19614 const uploadPromises = Object.fromEntries( 19615 Object.entries(fetchMedia([...mediaUrls])).map( 19616 ([url, filePromise]) => { 19617 const uploadPromise = filePromise.then( 19618 (blob) => new Promise((resolve, reject) => { 19619 mediaUpload({ 19620 filesList: [blob], 19621 onFileChange: ([media]) => { 19622 if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) { 19623 return; 19624 } 19625 resolve(media); 19626 }, 19627 onError() { 19628 reject(); 19629 } 19630 }); 19631 }) 19632 ); 19633 return [url, uploadPromise]; 19634 } 19635 ) 19636 ); 19637 Promise.allSettled( 19638 blocksWithExternalMedia.map((block) => { 19639 const { url } = getMediaInfo(block); 19640 return uploadPromises[url].then( 19641 (media) => updateBlockWithUploadedMedia(block, media) 19642 ).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true)); 19643 }) 19644 ).finally(() => { 19645 setIsUploading(false); 19646 }); 19647 } 19648 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { initialOpen: true, title: panelBodyTitle, children: [ 19649 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)( 19650 "Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly." 19651 ) }), 19652 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19653 "div", 19654 { 19655 style: { 19656 display: "inline-flex", 19657 flexWrap: "wrap", 19658 gap: "8px" 19659 }, 19660 children: [ 19661 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19662 external_wp_components_namespaceObject.__unstableAnimatePresence, 19663 { 19664 onExitComplete: () => setIsAnimating(false), 19665 children: blocksWithExternalMedia.map((block) => { 19666 const { url, alt } = getMediaInfo(block); 19667 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19668 Image, 19669 { 19670 clientId: block.clientId, 19671 url, 19672 alt 19673 }, 19674 block.clientId 19675 ); 19676 }) 19677 } 19678 ), 19679 isUploading || isAnimating ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19680 external_wp_components_namespaceObject.Button, 19681 { 19682 size: "compact", 19683 variant: "primary", 19684 onClick: uploadImages, 19685 children: (0,external_wp_i18n_namespaceObject._x)("Upload", "verb") 19686 } 19687 ) 19688 ] 19689 } 19690 ), 19691 hadUploadError && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: (0,external_wp_i18n_namespaceObject.__)("Upload failed, try again.") }) 19692 ] }); 19693 } 19694 19695 19696 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 function PostPublishPanelPrepublish({ children }) { 19715 const { 19716 isBeingScheduled, 19717 isRequestingSiteIcon, 19718 hasPublishAction, 19719 siteIconUrl, 19720 siteTitle, 19721 siteHome 19722 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 19723 const { getCurrentPost, isEditedPostBeingScheduled } = select(store_store); 19724 const { getEntityRecord, isResolving } = select(external_wp_coreData_namespaceObject.store); 19725 const siteData = getEntityRecord("root", "__unstableBase", void 0) || {}; 19726 return { 19727 hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, 19728 isBeingScheduled: isEditedPostBeingScheduled(), 19729 isRequestingSiteIcon: isResolving("getEntityRecord", [ 19730 "root", 19731 "__unstableBase", 19732 void 0 19733 ]), 19734 siteIconUrl: siteData.site_icon_url, 19735 siteTitle: siteData.name, 19736 siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) 19737 }; 19738 }, []); 19739 let siteIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "components-site-icon", size: "36px", icon: wordpress_default }); 19740 if (siteIconUrl) { 19741 siteIcon = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19742 "img", 19743 { 19744 alt: (0,external_wp_i18n_namespaceObject.__)("Site Icon"), 19745 className: "components-site-icon", 19746 src: siteIconUrl 19747 } 19748 ); 19749 } 19750 if (isRequestingSiteIcon) { 19751 siteIcon = null; 19752 } 19753 let prePublishTitle, prePublishBodyText; 19754 if (!hasPublishAction) { 19755 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)("Are you ready to submit for review?"); 19756 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)( 19757 "Your work will be reviewed and then approved." 19758 ); 19759 } else if (isBeingScheduled) { 19760 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)("Are you ready to schedule?"); 19761 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)( 19762 "Your work will be published at the specified date and time." 19763 ); 19764 } else { 19765 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)("Are you ready to publish?"); 19766 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)( 19767 "Double-check your settings before publishing." 19768 ); 19769 } 19770 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel__prepublish", children: [ 19771 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: prePublishTitle }) }), 19772 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { children: prePublishBodyText }), 19773 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-site-card", children: [ 19774 siteIcon, 19775 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "components-site-info", children: [ 19776 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-site-name", children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)("(Untitled)") }), 19777 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "components-site-home", children: siteHome }) 19778 ] }) 19779 ] }), 19780 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MaybeUploadMediaPanel, {}), 19781 hasPublishAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19782 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19783 external_wp_components_namespaceObject.PanelBody, 19784 { 19785 initialOpen: false, 19786 title: [ 19787 (0,external_wp_i18n_namespaceObject.__)("Visibility:"), 19788 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19789 "span", 19790 { 19791 className: "editor-post-publish-panel__link", 19792 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibilityLabel, {}) 19793 }, 19794 "label" 19795 ) 19796 ], 19797 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostVisibility, {}) 19798 } 19799 ), 19800 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19801 external_wp_components_namespaceObject.PanelBody, 19802 { 19803 initialOpen: false, 19804 title: [ 19805 (0,external_wp_i18n_namespaceObject.__)("Publish:"), 19806 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19807 "span", 19808 { 19809 className: "editor-post-publish-panel__link", 19810 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}) 19811 }, 19812 "label" 19813 ) 19814 ], 19815 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, {}) 19816 } 19817 ) 19818 ] }), 19819 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatPanel, {}), 19820 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_tags_panel_default, {}), 19821 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(maybe_category_panel_default, {}), 19822 children 19823 ] }); 19824 } 19825 var prepublish_default = PostPublishPanelPrepublish; 19826 19827 19828 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 const POSTNAME = "%postname%"; 19842 const PAGENAME = "%pagename%"; 19843 const getFuturePostUrl = (post) => { 19844 const { slug } = post; 19845 if (post.permalink_template.includes(POSTNAME)) { 19846 return post.permalink_template.replace(POSTNAME, slug); 19847 } 19848 if (post.permalink_template.includes(PAGENAME)) { 19849 return post.permalink_template.replace(PAGENAME, slug); 19850 } 19851 return post.permalink_template; 19852 }; 19853 function postpublish_CopyButton({ text }) { 19854 const [showCopyConfirmation, setShowCopyConfirmation] = (0,external_wp_element_namespaceObject.useState)(false); 19855 const timeoutIdRef = (0,external_wp_element_namespaceObject.useRef)(); 19856 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => { 19857 setShowCopyConfirmation(true); 19858 if (timeoutIdRef.current) { 19859 clearTimeout(timeoutIdRef.current); 19860 } 19861 timeoutIdRef.current = setTimeout(() => { 19862 setShowCopyConfirmation(false); 19863 }, 4e3); 19864 }); 19865 (0,external_wp_element_namespaceObject.useEffect)(() => { 19866 return () => { 19867 if (timeoutIdRef.current) { 19868 clearTimeout(timeoutIdRef.current); 19869 } 19870 }; 19871 }, []); 19872 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children: showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)("Copied!") : (0,external_wp_i18n_namespaceObject.__)("Copy") }); 19873 } 19874 function PostPublishPanelPostpublish({ 19875 focusOnMount, 19876 children 19877 }) { 19878 const { post, postType, isScheduled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 19879 const { 19880 getEditedPostAttribute, 19881 getCurrentPost, 19882 isCurrentPostScheduled 19883 } = select(store_store); 19884 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 19885 return { 19886 post: getCurrentPost(), 19887 postType: getPostType(getEditedPostAttribute("type")), 19888 isScheduled: isCurrentPostScheduled() 19889 }; 19890 }, []); 19891 const postLabel = postType?.labels?.singular_name; 19892 const viewPostLabel = postType?.labels?.view_item; 19893 const addNewPostLabel = postType?.labels?.add_new_item; 19894 const link = post.status === "future" ? getFuturePostUrl(post) : post.link; 19895 const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)("post-new.php", { 19896 post_type: post.type 19897 }); 19898 const postLinkRef = (0,external_wp_element_namespaceObject.useCallback)( 19899 (node) => { 19900 if (focusOnMount && node) { 19901 node.focus(); 19902 } 19903 }, 19904 [focusOnMount] 19905 ); 19906 const postPublishNonLinkHeader = isScheduled ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 19907 (0,external_wp_i18n_namespaceObject.__)("is now scheduled. It will go live on"), 19908 " ", 19909 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleLabel, {}), 19910 "." 19911 ] }) : (0,external_wp_i18n_namespaceObject.__)("is now live."); 19912 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish", children: [ 19913 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { className: "post-publish-panel__postpublish-header", children: [ 19914 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { ref: postLinkRef, href: link, children: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)("(no title)") }), 19915 " ", 19916 postPublishNonLinkHeader 19917 ] }), 19918 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, { children: [ 19919 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "post-publish-panel__postpublish-subheader", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", { children: (0,external_wp_i18n_namespaceObject.__)("What\u2019s next?") }) }), 19920 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish-post-address-container", children: [ 19921 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19922 external_wp_components_namespaceObject.TextControl, 19923 { 19924 __next40pxDefaultSize: true, 19925 __nextHasNoMarginBottom: true, 19926 className: "post-publish-panel__postpublish-post-address", 19927 readOnly: true, 19928 label: (0,external_wp_i18n_namespaceObject.sprintf)( 19929 /* translators: %s: post type singular name */ 19930 (0,external_wp_i18n_namespaceObject.__)("%s address"), 19931 postLabel 19932 ), 19933 value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), 19934 onFocus: (event) => event.target.select() 19935 } 19936 ), 19937 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "post-publish-panel__postpublish-post-address__copy-button-wrap", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(postpublish_CopyButton, { text: link }) }) 19938 ] }), 19939 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "post-publish-panel__postpublish-buttons", children: [ 19940 !isScheduled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 19941 external_wp_components_namespaceObject.Button, 19942 { 19943 variant: "primary", 19944 href: link, 19945 __next40pxDefaultSize: true, 19946 icon: external_default, 19947 iconPosition: "right", 19948 target: "_blank", 19949 children: [ 19950 viewPostLabel, 19951 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 19952 as: "span", 19953 /* translators: accessibility text */ 19954 children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") 19955 }) 19956 ] 19957 } 19958 ), 19959 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 19960 external_wp_components_namespaceObject.Button, 19961 { 19962 variant: isScheduled ? "primary" : "secondary", 19963 __next40pxDefaultSize: true, 19964 href: addLink, 19965 children: addNewPostLabel 19966 } 19967 ) 19968 ] }) 19969 ] }), 19970 children 19971 ] }); 19972 } 19973 19974 19975 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 class PostPublishPanel extends external_wp_element_namespaceObject.Component { 19989 constructor() { 19990 super(...arguments); 19991 this.onSubmit = this.onSubmit.bind(this); 19992 this.cancelButtonNode = (0,external_wp_element_namespaceObject.createRef)(); 19993 } 19994 componentDidMount() { 19995 this.timeoutID = setTimeout(() => { 19996 this.cancelButtonNode.current.focus(); 19997 }, 0); 19998 } 19999 componentWillUnmount() { 20000 clearTimeout(this.timeoutID); 20001 } 20002 componentDidUpdate(prevProps) { 20003 if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty || this.props.currentPostId !== prevProps.currentPostId) { 20004 this.props.onClose(); 20005 } 20006 } 20007 onSubmit() { 20008 const { onClose, hasPublishAction, isPostTypeViewable } = this.props; 20009 if (!hasPublishAction || !isPostTypeViewable) { 20010 onClose(); 20011 } 20012 } 20013 render() { 20014 const { 20015 forceIsDirty, 20016 isBeingScheduled, 20017 isPublished, 20018 isPublishSidebarEnabled, 20019 isScheduled, 20020 isSaving, 20021 isSavingNonPostEntityChanges, 20022 onClose, 20023 onTogglePublishSidebar, 20024 PostPublishExtension, 20025 PrePublishExtension, 20026 currentPostId, 20027 ...additionalProps 20028 } = this.props; 20029 const { 20030 hasPublishAction, 20031 isDirty, 20032 isPostTypeViewable, 20033 ...propsForPanel 20034 } = additionalProps; 20035 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; 20036 const isPrePublish = !isPublishedOrScheduled && !isSaving; 20037 const isPostPublish = isPublishedOrScheduled && !isSaving; 20038 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel", ...propsForPanel, children: [ 20039 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header", children: isPostPublish ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20040 external_wp_components_namespaceObject.Button, 20041 { 20042 size: "compact", 20043 onClick: onClose, 20044 icon: close_small_default, 20045 label: (0,external_wp_i18n_namespaceObject.__)("Close panel") 20046 } 20047 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20048 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header-cancel-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20049 external_wp_components_namespaceObject.Button, 20050 { 20051 ref: this.cancelButtonNode, 20052 accessibleWhenDisabled: true, 20053 disabled: isSavingNonPostEntityChanges, 20054 onClick: onClose, 20055 variant: "secondary", 20056 size: "compact", 20057 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 20058 } 20059 ) }), 20060 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__header-publish-button", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20061 post_publish_button_default, 20062 { 20063 onSubmit: this.onSubmit, 20064 forceIsDirty 20065 } 20066 ) }) 20067 ] }) }), 20068 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-publish-panel__content", children: [ 20069 isPrePublish && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(prepublish_default, { children: PrePublishExtension && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrePublishExtension, {}) }), 20070 isPostPublish && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishPanelPostpublish, { focusOnMount: true, children: PostPublishExtension && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostPublishExtension, {}) }), 20071 isSaving && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) 20072 ] }), 20073 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-publish-panel__footer", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20074 external_wp_components_namespaceObject.CheckboxControl, 20075 { 20076 __nextHasNoMarginBottom: true, 20077 label: (0,external_wp_i18n_namespaceObject.__)("Always show pre-publish checks."), 20078 checked: isPublishSidebarEnabled, 20079 onChange: onTogglePublishSidebar 20080 } 20081 ) }) 20082 ] }); 20083 } 20084 } 20085 var post_publish_panel_default = (0,external_wp_compose_namespaceObject.compose)([ 20086 (0,external_wp_data_namespaceObject.withSelect)((select) => { 20087 const { getPostType } = select(external_wp_coreData_namespaceObject.store); 20088 const { 20089 getCurrentPost, 20090 getCurrentPostId, 20091 getEditedPostAttribute, 20092 isCurrentPostPublished, 20093 isCurrentPostScheduled, 20094 isEditedPostBeingScheduled, 20095 isEditedPostDirty, 20096 isAutosavingPost, 20097 isSavingPost, 20098 isSavingNonPostEntityChanges 20099 } = select(store_store); 20100 const { isPublishSidebarEnabled } = select(store_store); 20101 const postType = getPostType(getEditedPostAttribute("type")); 20102 return { 20103 hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false, 20104 isPostTypeViewable: postType?.viewable, 20105 isBeingScheduled: isEditedPostBeingScheduled(), 20106 isDirty: isEditedPostDirty(), 20107 isPublished: isCurrentPostPublished(), 20108 isPublishSidebarEnabled: isPublishSidebarEnabled(), 20109 isSaving: isSavingPost() && !isAutosavingPost(), 20110 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), 20111 isScheduled: isCurrentPostScheduled(), 20112 currentPostId: getCurrentPostId() 20113 }; 20114 }), 20115 (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { isPublishSidebarEnabled }) => { 20116 const { disablePublishSidebar, enablePublishSidebar } = dispatch(store_store); 20117 return { 20118 onTogglePublishSidebar: () => { 20119 if (isPublishSidebarEnabled) { 20120 disablePublishSidebar(); 20121 } else { 20122 enablePublishSidebar(); 20123 } 20124 } 20125 }; 20126 }), 20127 external_wp_components_namespaceObject.withFocusReturn, 20128 external_wp_components_namespaceObject.withConstrainedTabbing 20129 ])(PostPublishPanel); 20130 20131 20132 ;// ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js 20133 20134 20135 var cloud_upload_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17.3 10.1C17.3 7.60001 15.2 5.70001 12.5 5.70001C10.3 5.70001 8.4 7.10001 7.9 9.00001H7.7C5.7 9.00001 4 10.7 4 12.8C4 14.9 5.7 16.6 7.7 16.6H9.5V15.2H7.7C6.5 15.2 5.5 14.1 5.5 12.9C5.5 11.7 6.5 10.5 7.7 10.5H9L9.3 9.40001C9.7 8.10001 11 7.20001 12.5 7.20001C14.3 7.20001 15.8 8.50001 15.8 10.1V11.4L17.1 11.6C17.9 11.7 18.5 12.5 18.5 13.4C18.5 14.4 17.7 15.2 16.8 15.2H14.5V16.6H16.7C18.5 16.6 19.9 15.1 19.9 13.3C20 11.7 18.8 10.4 17.3 10.1Z M14.1245 14.2426L15.1852 13.182L12.0032 10L8.82007 13.1831L9.88072 14.2438L11.25 12.8745V18H12.75V12.8681L14.1245 14.2426Z" }) }); 20136 20137 20138 ;// ./node_modules/@wordpress/icons/build-module/library/cloud.js 20139 20140 20141 var cloud_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "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" }) }); 20142 20143 20144 ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js 20145 20146 20147 function PostStickyCheck({ children }) { 20148 const { hasStickyAction, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20149 const post = select(store_store).getCurrentPost(); 20150 return { 20151 hasStickyAction: post._links?.["wp:action-sticky"] ?? false, 20152 postType: select(store_store).getCurrentPostType() 20153 }; 20154 }, []); 20155 if (postType !== "post" || !hasStickyAction) { 20156 return null; 20157 } 20158 return children; 20159 } 20160 20161 20162 ;// ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js 20163 20164 20165 20166 20167 20168 20169 function PostSticky() { 20170 const postSticky = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20171 return select(store_store).getEditedPostAttribute("sticky") ?? false; 20172 }, []); 20173 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20174 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStickyCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20175 external_wp_components_namespaceObject.CheckboxControl, 20176 { 20177 className: "editor-post-sticky__checkbox-control", 20178 label: (0,external_wp_i18n_namespaceObject.__)("Sticky"), 20179 help: (0,external_wp_i18n_namespaceObject.__)("Pin this post to the top of the blog."), 20180 checked: postSticky, 20181 onChange: () => editPost({ sticky: !postSticky }), 20182 __nextHasNoMarginBottom: true 20183 } 20184 ) }); 20185 } 20186 20187 20188 ;// ./node_modules/@wordpress/editor/build-module/components/post-status/index.js 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 const postStatusesInfo = { 20204 "auto-draft": { label: (0,external_wp_i18n_namespaceObject.__)("Draft"), icon: drafts_default }, 20205 draft: { label: (0,external_wp_i18n_namespaceObject.__)("Draft"), icon: drafts_default }, 20206 pending: { label: (0,external_wp_i18n_namespaceObject.__)("Pending"), icon: pending_default }, 20207 private: { label: (0,external_wp_i18n_namespaceObject.__)("Private"), icon: not_allowed_default }, 20208 future: { label: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), icon: scheduled_default }, 20209 publish: { label: (0,external_wp_i18n_namespaceObject.__)("Published"), icon: published_default } 20210 }; 20211 const STATUS_OPTIONS = [ 20212 { 20213 label: (0,external_wp_i18n_namespaceObject.__)("Draft"), 20214 value: "draft", 20215 description: (0,external_wp_i18n_namespaceObject.__)("Not ready to publish.") 20216 }, 20217 { 20218 label: (0,external_wp_i18n_namespaceObject.__)("Pending"), 20219 value: "pending", 20220 description: (0,external_wp_i18n_namespaceObject.__)("Waiting for review before publishing.") 20221 }, 20222 { 20223 label: (0,external_wp_i18n_namespaceObject.__)("Private"), 20224 value: "private", 20225 description: (0,external_wp_i18n_namespaceObject.__)("Only visible to site admins and editors.") 20226 }, 20227 { 20228 label: (0,external_wp_i18n_namespaceObject.__)("Scheduled"), 20229 value: "future", 20230 description: (0,external_wp_i18n_namespaceObject.__)("Publish automatically on a chosen date.") 20231 }, 20232 { 20233 label: (0,external_wp_i18n_namespaceObject.__)("Published"), 20234 value: "publish", 20235 description: (0,external_wp_i18n_namespaceObject.__)("Visible to everyone.") 20236 } 20237 ]; 20238 const DESIGN_POST_TYPES = [ 20239 TEMPLATE_POST_TYPE, 20240 TEMPLATE_PART_POST_TYPE, 20241 PATTERN_POST_TYPE, 20242 NAVIGATION_POST_TYPE 20243 ]; 20244 function PostStatus() { 20245 const { status, date, password, postId, postType, canEdit } = (0,external_wp_data_namespaceObject.useSelect)( 20246 (select) => { 20247 const { 20248 getEditedPostAttribute, 20249 getCurrentPostId, 20250 getCurrentPostType, 20251 getCurrentPost 20252 } = select(store_store); 20253 return { 20254 status: getEditedPostAttribute("status"), 20255 date: getEditedPostAttribute("date"), 20256 password: getEditedPostAttribute("password"), 20257 postId: getCurrentPostId(), 20258 postType: getCurrentPostType(), 20259 canEdit: getCurrentPost()._links?.["wp:action-publish"] ?? false 20260 }; 20261 }, 20262 [] 20263 ); 20264 const [showPassword, setShowPassword] = (0,external_wp_element_namespaceObject.useState)(!!password); 20265 const passwordInputId = (0,external_wp_compose_namespaceObject.useInstanceId)( 20266 PostStatus, 20267 "editor-change-status__password-input" 20268 ); 20269 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 20270 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 20271 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 20272 () => ({ 20273 // Anchor the popover to the middle of the entire row so that it doesn't 20274 // move around when the label changes. 20275 anchor: popoverAnchor, 20276 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Status & visibility"), 20277 headerTitle: (0,external_wp_i18n_namespaceObject.__)("Status & visibility"), 20278 placement: "left-start", 20279 offset: 36, 20280 shift: true 20281 }), 20282 [popoverAnchor] 20283 ); 20284 if (DESIGN_POST_TYPES.includes(postType)) { 20285 return null; 20286 } 20287 const updatePost = ({ 20288 status: newStatus = status, 20289 password: newPassword = password, 20290 date: newDate = date 20291 }) => { 20292 editEntityRecord("postType", postType, postId, { 20293 status: newStatus, 20294 date: newDate, 20295 password: newPassword 20296 }); 20297 }; 20298 const handleTogglePassword = (value) => { 20299 setShowPassword(value); 20300 if (!value) { 20301 updatePost({ password: "" }); 20302 } 20303 }; 20304 const handleStatus = (value) => { 20305 let newDate = date; 20306 let newPassword = password; 20307 if (status === "future" && new Date(date) > /* @__PURE__ */ new Date()) { 20308 newDate = null; 20309 } 20310 if (value === "private" && password) { 20311 newPassword = ""; 20312 } 20313 updatePost({ 20314 status: value, 20315 date: newDate, 20316 password: newPassword 20317 }); 20318 }; 20319 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Status"), ref: setPopoverAnchor, children: canEdit ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20320 external_wp_components_namespaceObject.Dropdown, 20321 { 20322 className: "editor-post-status", 20323 contentClassName: "editor-change-status__content", 20324 popoverProps, 20325 focusOnMount: true, 20326 renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20327 external_wp_components_namespaceObject.Button, 20328 { 20329 className: "editor-post-status__toggle", 20330 variant: "tertiary", 20331 size: "compact", 20332 onClick: onToggle, 20333 icon: postStatusesInfo[status]?.icon, 20334 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 20335 // translators: %s: Current post status. 20336 (0,external_wp_i18n_namespaceObject.__)("Change status: %s"), 20337 postStatusesInfo[status]?.label 20338 ), 20339 "aria-expanded": isOpen, 20340 children: postStatusesInfo[status]?.label 20341 } 20342 ), 20343 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20344 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20345 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 20346 { 20347 title: (0,external_wp_i18n_namespaceObject.__)("Status & visibility"), 20348 onClose 20349 } 20350 ), 20351 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20352 "form", 20353 { 20354 onSubmit: (event) => { 20355 event.preventDefault(); 20356 onClose(); 20357 }, 20358 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 20359 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20360 external_wp_components_namespaceObject.RadioControl, 20361 { 20362 className: "editor-change-status__options", 20363 hideLabelFromVision: true, 20364 label: (0,external_wp_i18n_namespaceObject.__)("Status"), 20365 options: STATUS_OPTIONS, 20366 onChange: handleStatus, 20367 selected: status === "auto-draft" ? "draft" : status 20368 } 20369 ), 20370 status === "future" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-change-status__publish-date-wrapper", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20371 PrivatePostSchedule, 20372 { 20373 showPopoverHeaderActions: false, 20374 isCompact: true 20375 } 20376 ) }), 20377 status !== "private" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20378 external_wp_components_namespaceObject.__experimentalVStack, 20379 { 20380 as: "fieldset", 20381 spacing: 4, 20382 className: "editor-change-status__password-fieldset", 20383 children: [ 20384 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20385 external_wp_components_namespaceObject.CheckboxControl, 20386 { 20387 __nextHasNoMarginBottom: true, 20388 label: (0,external_wp_i18n_namespaceObject.__)( 20389 "Password protected" 20390 ), 20391 help: (0,external_wp_i18n_namespaceObject.__)( 20392 "Only visible to those who know the password." 20393 ), 20394 checked: showPassword, 20395 onChange: handleTogglePassword 20396 } 20397 ), 20398 showPassword && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-change-status__password-input", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20399 external_wp_components_namespaceObject.TextControl, 20400 { 20401 label: (0,external_wp_i18n_namespaceObject.__)( 20402 "Password" 20403 ), 20404 onChange: (value) => updatePost({ 20405 password: value 20406 }), 20407 value: password, 20408 placeholder: (0,external_wp_i18n_namespaceObject.__)( 20409 "Use a secure password" 20410 ), 20411 type: "text", 20412 id: passwordInputId, 20413 __next40pxDefaultSize: true, 20414 __nextHasNoMarginBottom: true, 20415 maxLength: 255 20416 } 20417 ) }) 20418 ] 20419 } 20420 ), 20421 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSticky, {}) 20422 ] }) 20423 } 20424 ) 20425 ] }) 20426 } 20427 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-status is-read-only", children: postStatusesInfo[status]?.label }) }); 20428 } 20429 20430 20431 ;// ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 function PostSavedState({ forceIsDirty }) { 20445 const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); 20446 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small"); 20447 const { 20448 isAutosaving, 20449 isDirty, 20450 isNew, 20451 isPublished, 20452 isSaveable, 20453 isSaving, 20454 isScheduled, 20455 hasPublishAction, 20456 showIconLabels, 20457 postStatus, 20458 postStatusHasChanged 20459 } = (0,external_wp_data_namespaceObject.useSelect)( 20460 (select) => { 20461 const { 20462 isEditedPostNew, 20463 isCurrentPostPublished, 20464 isCurrentPostScheduled, 20465 isEditedPostDirty, 20466 isSavingPost, 20467 isEditedPostSaveable, 20468 getCurrentPost, 20469 isAutosavingPost, 20470 getEditedPostAttribute, 20471 getPostEdits 20472 } = select(store_store); 20473 const { get } = select(external_wp_preferences_namespaceObject.store); 20474 return { 20475 isAutosaving: isAutosavingPost(), 20476 isDirty: forceIsDirty || isEditedPostDirty(), 20477 isNew: isEditedPostNew(), 20478 isPublished: isCurrentPostPublished(), 20479 isSaving: isSavingPost(), 20480 isSaveable: isEditedPostSaveable(), 20481 isScheduled: isCurrentPostScheduled(), 20482 hasPublishAction: getCurrentPost()?._links?.["wp:action-publish"] ?? false, 20483 showIconLabels: get("core", "showIconLabels"), 20484 postStatus: getEditedPostAttribute("status"), 20485 postStatusHasChanged: !!getPostEdits()?.status 20486 }; 20487 }, 20488 [forceIsDirty] 20489 ); 20490 const isPending = postStatus === "pending"; 20491 const { savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20492 const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); 20493 (0,external_wp_element_namespaceObject.useEffect)(() => { 20494 let timeoutId; 20495 if (wasSaving && !isSaving) { 20496 setForceSavedMessage(true); 20497 timeoutId = setTimeout(() => { 20498 setForceSavedMessage(false); 20499 }, 1e3); 20500 } 20501 return () => clearTimeout(timeoutId); 20502 }, [isSaving]); 20503 if (!hasPublishAction && isPending) { 20504 return null; 20505 } 20506 const isIneligibleStatus = !["pending", "draft", "auto-draft"].includes(postStatus) && STATUS_OPTIONS.map(({ value }) => value).includes(postStatus); 20507 if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ["pending", "draft"].includes(postStatus)) { 20508 return null; 20509 } 20510 const label = isPending ? (0,external_wp_i18n_namespaceObject.__)("Save as pending") : (0,external_wp_i18n_namespaceObject.__)("Save draft"); 20511 const shortLabel = (0,external_wp_i18n_namespaceObject.__)("Save"); 20512 const isSaved = forceSavedMessage || !isNew && !isDirty; 20513 const isSavedState = isSaving || isSaved; 20514 const isDisabled = isSaving || isSaved || !isSaveable; 20515 let text; 20516 if (isSaving) { 20517 text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)("Autosaving") : (0,external_wp_i18n_namespaceObject.__)("Saving"); 20518 } else if (isSaved) { 20519 text = (0,external_wp_i18n_namespaceObject.__)("Saved"); 20520 } else if (isLargeViewport) { 20521 text = label; 20522 } else if (showIconLabels) { 20523 text = shortLabel; 20524 } 20525 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 20526 external_wp_components_namespaceObject.Button, 20527 { 20528 className: isSaveable || isSaving ? dist_clsx({ 20529 "editor-post-save-draft": !isSavedState, 20530 "editor-post-saved-state": isSavedState, 20531 "is-saving": isSaving, 20532 "is-autosaving": isAutosaving, 20533 "is-saved": isSaved, 20534 [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ 20535 type: "loading" 20536 })]: isSaving 20537 }) : void 0, 20538 onClick: isDisabled ? void 0 : () => savePost(), 20539 shortcut: isDisabled ? void 0 : external_wp_keycodes_namespaceObject.displayShortcut.primary("s"), 20540 variant: "tertiary", 20541 size: "compact", 20542 icon: isLargeViewport ? void 0 : cloud_upload_default, 20543 label: text || label, 20544 "aria-disabled": isDisabled, 20545 children: [ 20546 isSavedState && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(icon_default, { icon: isSaved ? check_default : cloud_default }), 20547 text 20548 ] 20549 } 20550 ); 20551 } 20552 20553 20554 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js 20555 20556 20557 function PostScheduleCheck({ children }) { 20558 const hasPublishAction = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20559 return select(store_store).getCurrentPost()._links?.["wp:action-publish"] ?? false; 20560 }, []); 20561 if (!hasPublishAction) { 20562 return null; 20563 } 20564 return children; 20565 } 20566 20567 20568 ;// ./node_modules/@wordpress/editor/build-module/components/post-schedule/panel.js 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 const panel_DESIGN_POST_TYPES = [ 20581 TEMPLATE_POST_TYPE, 20582 TEMPLATE_PART_POST_TYPE, 20583 PATTERN_POST_TYPE, 20584 NAVIGATION_POST_TYPE 20585 ]; 20586 function PostSchedulePanel() { 20587 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 20588 const postType = (0,external_wp_data_namespaceObject.useSelect)( 20589 (select) => select(store_store).getCurrentPostType(), 20590 [] 20591 ); 20592 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 20593 () => ({ 20594 // Anchor the popover to the middle of the entire row so that it doesn't 20595 // move around when the label changes. 20596 anchor: popoverAnchor, 20597 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change publish date"), 20598 placement: "left-start", 20599 offset: 36, 20600 shift: true 20601 }), 20602 [popoverAnchor] 20603 ); 20604 const label = usePostScheduleLabel(); 20605 const fullLabel = usePostScheduleLabel({ full: true }); 20606 if (panel_DESIGN_POST_TYPES.includes(postType)) { 20607 return null; 20608 } 20609 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostScheduleCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Publish"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20610 external_wp_components_namespaceObject.Dropdown, 20611 { 20612 popoverProps, 20613 focusOnMount: true, 20614 className: "editor-post-schedule__panel-dropdown", 20615 contentClassName: "editor-post-schedule__dialog", 20616 renderToggle: ({ onToggle, isOpen }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20617 external_wp_components_namespaceObject.Button, 20618 { 20619 size: "compact", 20620 className: "editor-post-schedule__dialog-toggle", 20621 variant: "tertiary", 20622 tooltipPosition: "middle left", 20623 onClick: onToggle, 20624 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 20625 // translators: %s: Current post date. 20626 (0,external_wp_i18n_namespaceObject.__)("Change date: %s"), 20627 label 20628 ), 20629 label: fullLabel, 20630 showTooltip: label !== fullLabel, 20631 "aria-expanded": isOpen, 20632 children: label 20633 } 20634 ), 20635 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedule, { onClose }) 20636 } 20637 ) }) }); 20638 } 20639 20640 20641 ;// ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js 20642 20643 20644 20645 20646 20647 20648 20649 function PostSwitchToDraftButton() { 20650 external_wp_deprecated_default()("wp.editor.PostSwitchToDraftButton", { 20651 since: "6.7", 20652 version: "6.9" 20653 }); 20654 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 20655 const { editPost, savePost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20656 const { isSaving, isPublished, isScheduled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20657 const { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } = select(store_store); 20658 return { 20659 isSaving: isSavingPost(), 20660 isPublished: isCurrentPostPublished(), 20661 isScheduled: isCurrentPostScheduled() 20662 }; 20663 }, []); 20664 const isDisabled = isSaving || !isPublished && !isScheduled; 20665 let alertMessage; 20666 let confirmButtonText; 20667 if (isPublished) { 20668 alertMessage = (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to unpublish this post?"); 20669 confirmButtonText = (0,external_wp_i18n_namespaceObject.__)("Unpublish"); 20670 } else if (isScheduled) { 20671 alertMessage = (0,external_wp_i18n_namespaceObject.__)("Are you sure you want to unschedule this post?"); 20672 confirmButtonText = (0,external_wp_i18n_namespaceObject.__)("Unschedule"); 20673 } 20674 const handleConfirm = () => { 20675 setShowConfirmDialog(false); 20676 editPost({ status: "draft" }); 20677 savePost(); 20678 }; 20679 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20680 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20681 external_wp_components_namespaceObject.Button, 20682 { 20683 __next40pxDefaultSize: true, 20684 className: "editor-post-switch-to-draft", 20685 onClick: () => { 20686 if (!isDisabled) { 20687 setShowConfirmDialog(true); 20688 } 20689 }, 20690 "aria-disabled": isDisabled, 20691 variant: "secondary", 20692 style: { flexGrow: "1", justifyContent: "center" }, 20693 children: (0,external_wp_i18n_namespaceObject.__)("Switch to draft") 20694 } 20695 ), 20696 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20697 external_wp_components_namespaceObject.__experimentalConfirmDialog, 20698 { 20699 isOpen: showConfirmDialog, 20700 onConfirm: handleConfirm, 20701 onCancel: () => setShowConfirmDialog(false), 20702 confirmButtonText, 20703 children: alertMessage 20704 } 20705 ) 20706 ] }); 20707 } 20708 20709 20710 ;// ./node_modules/@wordpress/editor/build-module/components/post-sync-status/index.js 20711 20712 20713 20714 20715 20716 function PostSyncStatus() { 20717 const { syncStatus, postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20718 const { getEditedPostAttribute } = select(store_store); 20719 const meta = getEditedPostAttribute("meta"); 20720 const currentSyncStatus = meta?.wp_pattern_sync_status === "unsynced" ? "unsynced" : getEditedPostAttribute("wp_pattern_sync_status"); 20721 return { 20722 syncStatus: currentSyncStatus, 20723 postType: getEditedPostAttribute("type") 20724 }; 20725 }); 20726 if (postType !== "wp_block") { 20727 return null; 20728 } 20729 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Sync status"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-sync-status__value", children: syncStatus === "unsynced" ? (0,external_wp_i18n_namespaceObject._x)("Not synced", "pattern (singular)") : (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)") }) }); 20730 } 20731 20732 20733 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js 20734 20735 20736 20737 20738 20739 20740 20741 const post_taxonomies_identity = (x) => x; 20742 function PostTaxonomies({ taxonomyWrapper = post_taxonomies_identity }) { 20743 const { postType, taxonomies } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20744 return { 20745 postType: select(store_store).getCurrentPostType(), 20746 taxonomies: select(external_wp_coreData_namespaceObject.store).getEntityRecords( 20747 "root", 20748 "taxonomy", 20749 { per_page: -1 } 20750 ) 20751 }; 20752 }, []); 20753 const visibleTaxonomies = (taxonomies ?? []).filter( 20754 (taxonomy) => ( 20755 // In some circumstances .visibility can end up as undefined so optional chaining operator required. 20756 // https://github.com/WordPress/gutenberg/issues/40326 20757 taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui 20758 ) 20759 ); 20760 return visibleTaxonomies.map((taxonomy) => { 20761 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector_default : flat_term_selector_default; 20762 const taxonomyComponentProps = { 20763 slug: taxonomy.slug, 20764 ...taxonomy.hierarchical ? {} : { __nextHasNoMarginBottom: true } 20765 }; 20766 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.Fragment, { children: taxonomyWrapper( 20767 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyComponent, { ...taxonomyComponentProps }), 20768 taxonomy 20769 ) }, `taxonomy-$taxonomy.slug}`); 20770 }); 20771 } 20772 var post_taxonomies_default = PostTaxonomies; 20773 20774 20775 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js 20776 20777 20778 20779 function PostTaxonomiesCheck({ children }) { 20780 const hasTaxonomies = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20781 const postType = select(store_store).getCurrentPostType(); 20782 const taxonomies = select(external_wp_coreData_namespaceObject.store).getEntityRecords( 20783 "root", 20784 "taxonomy", 20785 { per_page: -1 } 20786 ); 20787 return taxonomies?.some( 20788 (taxonomy) => taxonomy.types.includes(postType) 20789 ); 20790 }, []); 20791 if (!hasTaxonomies) { 20792 return null; 20793 } 20794 return children; 20795 } 20796 20797 20798 ;// ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/panel.js 20799 20800 20801 20802 20803 20804 20805 function TaxonomyPanel({ taxonomy, children }) { 20806 const slug = taxonomy?.slug; 20807 const panelName = slug ? `taxonomy-panel-$slug}` : ""; 20808 const { isEnabled, isOpened } = (0,external_wp_data_namespaceObject.useSelect)( 20809 (select) => { 20810 const { isEditorPanelEnabled, isEditorPanelOpened } = select(store_store); 20811 return { 20812 isEnabled: slug ? isEditorPanelEnabled(panelName) : false, 20813 isOpened: slug ? isEditorPanelOpened(panelName) : false 20814 }; 20815 }, 20816 [panelName, slug] 20817 ); 20818 const { toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20819 if (!isEnabled) { 20820 return null; 20821 } 20822 const taxonomyMenuName = taxonomy?.labels?.menu_name; 20823 if (!taxonomyMenuName) { 20824 return null; 20825 } 20826 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20827 external_wp_components_namespaceObject.PanelBody, 20828 { 20829 title: taxonomyMenuName, 20830 opened: isOpened, 20831 onToggle: () => toggleEditorPanelOpened(panelName), 20832 children 20833 } 20834 ); 20835 } 20836 function panel_PostTaxonomies() { 20837 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTaxonomiesCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20838 post_taxonomies_default, 20839 { 20840 taxonomyWrapper: (content, taxonomy) => { 20841 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TaxonomyPanel, { taxonomy, children: content }); 20842 } 20843 } 20844 ) }); 20845 } 20846 20847 20848 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 20849 var lib = __webpack_require__(4132); 20850 ;// ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 function PostTextEditor() { 20862 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); 20863 const { content, blocks, type, id } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20864 const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 20865 const { getCurrentPostType, getCurrentPostId } = select(store_store); 20866 const _type = getCurrentPostType(); 20867 const _id = getCurrentPostId(); 20868 const editedRecord = getEditedEntityRecord("postType", _type, _id); 20869 return { 20870 content: editedRecord?.content, 20871 blocks: editedRecord?.blocks, 20872 type: _type, 20873 id: _id 20874 }; 20875 }, []); 20876 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 20877 const value = (0,external_wp_element_namespaceObject.useMemo)(() => { 20878 if (content instanceof Function) { 20879 return content({ blocks }); 20880 } else if (blocks) { 20881 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks); 20882 } 20883 return content; 20884 }, [content, blocks]); 20885 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 20886 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20887 external_wp_components_namespaceObject.VisuallyHidden, 20888 { 20889 as: "label", 20890 htmlFor: `post-content-$instanceId}`, 20891 children: (0,external_wp_i18n_namespaceObject.__)("Type text or HTML") 20892 } 20893 ), 20894 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 20895 lib/* default */.A, 20896 { 20897 autoComplete: "off", 20898 dir: "auto", 20899 value, 20900 onChange: (event) => { 20901 editEntityRecord("postType", type, id, { 20902 content: event.target.value, 20903 blocks: void 0, 20904 selection: void 0 20905 }); 20906 }, 20907 className: "editor-post-text-editor", 20908 id: `post-content-$instanceId}`, 20909 placeholder: (0,external_wp_i18n_namespaceObject.__)("Start writing with text or HTML") 20910 } 20911 ) 20912 ] }); 20913 } 20914 20915 20916 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/constants.js 20917 const DEFAULT_CLASSNAMES = "wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text"; 20918 const REGEXP_NEWLINES = /[\r\n]+/g; 20919 20920 20921 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title-focus.js 20922 20923 20924 20925 function usePostTitleFocus(forwardedRef) { 20926 const ref = (0,external_wp_element_namespaceObject.useRef)(); 20927 const { isCleanNewPost } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20928 const { isCleanNewPost: _isCleanNewPost } = select(store_store); 20929 return { 20930 isCleanNewPost: _isCleanNewPost() 20931 }; 20932 }, []); 20933 (0,external_wp_element_namespaceObject.useImperativeHandle)(forwardedRef, () => ({ 20934 focus: () => { 20935 ref?.current?.focus(); 20936 } 20937 })); 20938 (0,external_wp_element_namespaceObject.useEffect)(() => { 20939 if (!ref.current) { 20940 return; 20941 } 20942 const { defaultView } = ref.current.ownerDocument; 20943 const { name, parent } = defaultView; 20944 const ownerDocument = name === "editor-canvas" ? parent.document : defaultView.document; 20945 const { activeElement, body } = ownerDocument; 20946 if (isCleanNewPost && (!activeElement || body === activeElement)) { 20947 ref.current.focus(); 20948 } 20949 }, [isCleanNewPost]); 20950 return { ref }; 20951 } 20952 20953 20954 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/use-post-title.js 20955 20956 20957 function usePostTitle() { 20958 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 20959 const { title } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20960 const { getEditedPostAttribute } = select(store_store); 20961 return { 20962 title: getEditedPostAttribute("title") 20963 }; 20964 }, []); 20965 function updateTitle(newTitle) { 20966 editPost({ title: newTitle }); 20967 } 20968 return { title, setTitle: updateTitle }; 20969 } 20970 20971 20972 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/index.js 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 const PostTitle = (0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => { 20990 const { placeholder } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 20991 const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); 20992 const { titlePlaceholder } = getSettings(); 20993 return { 20994 placeholder: titlePlaceholder 20995 }; 20996 }, []); 20997 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 20998 const { ref: focusRef } = usePostTitleFocus(forwardedRef); 20999 const { title, setTitle: onUpdate } = usePostTitle(); 21000 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); 21001 const { clearSelectedBlock, insertBlocks, insertDefaultBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 21002 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Add title"); 21003 const { 21004 value, 21005 onChange, 21006 ref: richTextRef 21007 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ 21008 value: title, 21009 onChange(newValue) { 21010 onUpdate(newValue.replace(REGEXP_NEWLINES, " ")); 21011 }, 21012 placeholder: decodedPlaceholder, 21013 selectionStart: selection.start, 21014 selectionEnd: selection.end, 21015 onSelectionChange(newStart, newEnd) { 21016 setSelection((sel) => { 21017 const { start, end } = sel; 21018 if (start === newStart && end === newEnd) { 21019 return sel; 21020 } 21021 return { 21022 start: newStart, 21023 end: newEnd 21024 }; 21025 }); 21026 }, 21027 __unstableDisableFormats: false 21028 }); 21029 function onInsertBlockAfter(blocks) { 21030 insertBlocks(blocks, 0); 21031 } 21032 function onSelect() { 21033 setIsSelected(true); 21034 clearSelectedBlock(); 21035 } 21036 function onUnselect() { 21037 setIsSelected(false); 21038 setSelection({}); 21039 } 21040 function onEnterPress() { 21041 insertDefaultBlock(void 0, void 0, 0); 21042 } 21043 function onKeyDown(event) { 21044 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { 21045 event.preventDefault(); 21046 onEnterPress(); 21047 } 21048 } 21049 function onPaste(event) { 21050 const clipboardData = event.clipboardData; 21051 let plainText = ""; 21052 let html = ""; 21053 try { 21054 plainText = clipboardData.getData("text/plain"); 21055 html = clipboardData.getData("text/html"); 21056 } catch (error) { 21057 return; 21058 } 21059 window.console.log("Received HTML:\n\n", html); 21060 window.console.log("Received plain text:\n\n", plainText); 21061 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ 21062 HTML: html, 21063 plainText 21064 }); 21065 event.preventDefault(); 21066 if (!content.length) { 21067 return; 21068 } 21069 if (typeof content !== "string") { 21070 const [firstBlock] = content; 21071 if (!title && (firstBlock.name === "core/heading" || firstBlock.name === "core/paragraph")) { 21072 const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)( 21073 firstBlock.attributes.content 21074 ); 21075 onUpdate(contentNoHTML); 21076 onInsertBlockAfter(content.slice(1)); 21077 } else { 21078 onInsertBlockAfter(content); 21079 } 21080 } else { 21081 const contentNoHTML = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(content); 21082 onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({ html: contentNoHTML }))); 21083 } 21084 } 21085 const className = dist_clsx(DEFAULT_CLASSNAMES, { 21086 "is-selected": isSelected 21087 }); 21088 return ( 21089 /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ 21090 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21091 "h1", 21092 { 21093 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, focusRef]), 21094 contentEditable: true, 21095 className, 21096 "aria-label": decodedPlaceholder, 21097 role: "textbox", 21098 "aria-multiline": "true", 21099 onFocus: onSelect, 21100 onBlur: onUnselect, 21101 onKeyDown, 21102 onPaste 21103 } 21104 ) 21105 ); 21106 }); 21107 var post_title_default = (0,external_wp_element_namespaceObject.forwardRef)((_, forwardedRef) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "title", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTitle, { ref: forwardedRef }) })); 21108 21109 21110 ;// ./node_modules/@wordpress/editor/build-module/components/post-title/post-title-raw.js 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 function PostTitleRaw(_, forwardedRef) { 21123 const { placeholder } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21124 const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); 21125 const { titlePlaceholder } = getSettings(); 21126 return { 21127 placeholder: titlePlaceholder 21128 }; 21129 }, []); 21130 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); 21131 const { title, setTitle: onUpdate } = usePostTitle(); 21132 const { ref: focusRef } = usePostTitleFocus(forwardedRef); 21133 function onChange(value) { 21134 onUpdate(value.replace(REGEXP_NEWLINES, " ")); 21135 } 21136 function onSelect() { 21137 setIsSelected(true); 21138 } 21139 function onUnselect() { 21140 setIsSelected(false); 21141 } 21142 const className = dist_clsx(DEFAULT_CLASSNAMES, { 21143 "is-selected": isSelected, 21144 "is-raw-text": true 21145 }); 21146 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)("Add title"); 21147 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21148 external_wp_components_namespaceObject.TextareaControl, 21149 { 21150 ref: focusRef, 21151 value: title, 21152 onChange, 21153 onFocus: onSelect, 21154 onBlur: onUnselect, 21155 label: placeholder, 21156 className, 21157 placeholder: decodedPlaceholder, 21158 hideLabelFromVision: true, 21159 autoComplete: "off", 21160 dir: "auto", 21161 rows: 1, 21162 __nextHasNoMarginBottom: true 21163 } 21164 ); 21165 } 21166 var post_title_raw_default = (0,external_wp_element_namespaceObject.forwardRef)(PostTitleRaw); 21167 21168 21169 ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js 21170 21171 21172 21173 21174 function PostTrashCheck({ children }) { 21175 const { canTrashPost } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21176 const { isEditedPostNew, getCurrentPostId, getCurrentPostType } = select(store_store); 21177 const { canUser } = select(external_wp_coreData_namespaceObject.store); 21178 const postType = getCurrentPostType(); 21179 const postId = getCurrentPostId(); 21180 const isNew = isEditedPostNew(); 21181 const canUserDelete = !!postId ? canUser("delete", { 21182 kind: "postType", 21183 name: postType, 21184 id: postId 21185 }) : false; 21186 return { 21187 canTrashPost: (!isNew || postId) && canUserDelete && !GLOBAL_POST_TYPES.includes(postType) 21188 }; 21189 }, []); 21190 if (!canTrashPost) { 21191 return null; 21192 } 21193 return children; 21194 } 21195 21196 21197 ;// ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js 21198 21199 21200 21201 21202 21203 21204 21205 function PostTrash({ onActionPerformed }) { 21206 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 21207 const { isNew, isDeleting, postId, title } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21208 const store = select(store_store); 21209 return { 21210 isNew: store.isEditedPostNew(), 21211 isDeleting: store.isDeletingPost(), 21212 postId: store.getCurrentPostId(), 21213 title: store.getCurrentPostAttribute("title") 21214 }; 21215 }, []); 21216 const { trashPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21217 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 21218 if (isNew || !postId) { 21219 return null; 21220 } 21221 const handleConfirm = async () => { 21222 setShowConfirmDialog(false); 21223 await trashPost(); 21224 const item = await registry.resolveSelect(store_store).getCurrentPost(); 21225 onActionPerformed?.("move-to-trash", [item]); 21226 }; 21227 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(PostTrashCheck, { children: [ 21228 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21229 external_wp_components_namespaceObject.Button, 21230 { 21231 __next40pxDefaultSize: true, 21232 className: "editor-post-trash", 21233 isDestructive: true, 21234 variant: "secondary", 21235 isBusy: isDeleting, 21236 "aria-disabled": isDeleting, 21237 onClick: isDeleting ? void 0 : () => setShowConfirmDialog(true), 21238 children: (0,external_wp_i18n_namespaceObject.__)("Move to trash") 21239 } 21240 ), 21241 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21242 external_wp_components_namespaceObject.__experimentalConfirmDialog, 21243 { 21244 isOpen: showConfirmDialog, 21245 onConfirm: handleConfirm, 21246 onCancel: () => setShowConfirmDialog(false), 21247 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Move to trash"), 21248 size: "small", 21249 children: (0,external_wp_i18n_namespaceObject.sprintf)( 21250 // translators: %s: The item's title. 21251 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to move "%s" to the trash?'), 21252 title 21253 ) 21254 } 21255 ) 21256 ] }); 21257 } 21258 21259 21260 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/index.js 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 function PostURL({ onClose }) { 21274 const { 21275 isEditable, 21276 postSlug, 21277 postLink, 21278 permalinkPrefix, 21279 permalinkSuffix, 21280 permalink 21281 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21282 const post = select(store_store).getCurrentPost(); 21283 const postTypeSlug = select(store_store).getCurrentPostType(); 21284 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 21285 const permalinkParts = select(store_store).getPermalinkParts(); 21286 const hasPublishAction = post?._links?.["wp:action-publish"] ?? false; 21287 return { 21288 isEditable: select(store_store).isPermalinkEditable() && hasPublishAction, 21289 postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)( 21290 select(store_store).getEditedPostSlug() 21291 ), 21292 viewPostLabel: postType?.labels.view_item, 21293 postLink: post.link, 21294 permalinkPrefix: permalinkParts?.prefix, 21295 permalinkSuffix: permalinkParts?.suffix, 21296 permalink: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)( 21297 select(store_store).getPermalink() 21298 ) 21299 }; 21300 }, []); 21301 const { editPost } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 21302 const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 21303 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); 21304 const copyButtonRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(permalink, () => { 21305 createNotice("info", (0,external_wp_i18n_namespaceObject.__)("Copied Permalink to clipboard."), { 21306 isDismissible: true, 21307 type: "snackbar" 21308 }); 21309 }); 21310 const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + (0,external_wp_compose_namespaceObject.useInstanceId)(PostURL); 21311 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-url", children: [ 21312 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21313 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 21314 { 21315 title: (0,external_wp_i18n_namespaceObject.__)("Slug"), 21316 onClose 21317 } 21318 ), 21319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 21320 isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { className: "editor-post-url__intro", children: (0,external_wp_element_namespaceObject.createInterpolateElement)( 21321 (0,external_wp_i18n_namespaceObject.__)( 21322 "<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>" 21323 ), 21324 { 21325 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { id: postUrlSlugDescriptionId }), 21326 a: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21327 external_wp_components_namespaceObject.ExternalLink, 21328 { 21329 href: (0,external_wp_i18n_namespaceObject.__)( 21330 "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink" 21331 ) 21332 } 21333 ) 21334 } 21335 ) }), 21336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 21337 isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 21338 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21339 external_wp_components_namespaceObject.__experimentalInputControl, 21340 { 21341 __next40pxDefaultSize: true, 21342 prefix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlPrefixWrapper, { children: "/" }), 21343 suffix: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21344 external_wp_components_namespaceObject.Button, 21345 { 21346 icon: copy_small_default, 21347 ref: copyButtonRef, 21348 size: "small", 21349 label: "Copy" 21350 } 21351 ) }), 21352 label: (0,external_wp_i18n_namespaceObject.__)("Slug"), 21353 hideLabelFromVision: true, 21354 value: forceEmptyField ? "" : postSlug, 21355 autoComplete: "off", 21356 spellCheck: "false", 21357 type: "text", 21358 className: "editor-post-url__input", 21359 onChange: (newValue) => { 21360 editPost({ slug: newValue }); 21361 if (!newValue) { 21362 if (!forceEmptyField) { 21363 setForceEmptyField(true); 21364 } 21365 return; 21366 } 21367 if (forceEmptyField) { 21368 setForceEmptyField(false); 21369 } 21370 }, 21371 onBlur: (event) => { 21372 editPost({ 21373 slug: (0,external_wp_url_namespaceObject.cleanForSlug)( 21374 event.target.value 21375 ) 21376 }); 21377 if (forceEmptyField) { 21378 setForceEmptyField(false); 21379 } 21380 }, 21381 "aria-describedby": postUrlSlugDescriptionId 21382 } 21383 ), 21384 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { className: "editor-post-url__permalink", children: [ 21385 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__permalink-visual-label", children: (0,external_wp_i18n_namespaceObject.__)("Permalink:") }), 21386 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 21387 external_wp_components_namespaceObject.ExternalLink, 21388 { 21389 className: "editor-post-url__link", 21390 href: postLink, 21391 target: "_blank", 21392 children: [ 21393 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-prefix", children: permalinkPrefix }), 21394 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-slug", children: postSlug }), 21395 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-url__link-suffix", children: permalinkSuffix }) 21396 ] 21397 } 21398 ) 21399 ] }) 21400 ] }), 21401 !isEditable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21402 external_wp_components_namespaceObject.ExternalLink, 21403 { 21404 className: "editor-post-url__link", 21405 href: postLink, 21406 target: "_blank", 21407 children: postLink 21408 } 21409 ) 21410 ] }) 21411 ] }) 21412 ] }); 21413 } 21414 21415 21416 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/check.js 21417 21418 21419 21420 function PostURLCheck({ children }) { 21421 const isVisible = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21422 const postTypeSlug = select(store_store).getCurrentPostType(); 21423 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 21424 if (!postType?.viewable) { 21425 return false; 21426 } 21427 const post = select(store_store).getCurrentPost(); 21428 if (!post.link) { 21429 return false; 21430 } 21431 const permalinkParts = select(store_store).getPermalinkParts(); 21432 if (!permalinkParts) { 21433 return false; 21434 } 21435 return true; 21436 }, []); 21437 if (!isVisible) { 21438 return null; 21439 } 21440 return children; 21441 } 21442 21443 21444 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/label.js 21445 21446 21447 21448 function PostURLLabel() { 21449 return usePostURLLabel(); 21450 } 21451 function usePostURLLabel() { 21452 const postLink = (0,external_wp_data_namespaceObject.useSelect)( 21453 (select) => select(store_store).getPermalink(), 21454 [] 21455 ); 21456 return (0,external_wp_url_namespaceObject.filterURLForDisplay)((0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postLink)); 21457 } 21458 21459 21460 ;// ./node_modules/@wordpress/editor/build-module/components/post-url/panel.js 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 function PostURLPanel() { 21473 const { isFrontPage } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21474 const { getCurrentPostId } = select(store_store); 21475 const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 21476 const siteSettings = canUser("read", { 21477 kind: "root", 21478 name: "site" 21479 }) ? getEditedEntityRecord("root", "site") : void 0; 21480 const _id = getCurrentPostId(); 21481 return { 21482 isFrontPage: siteSettings?.page_on_front === _id 21483 }; 21484 }, []); 21485 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 21486 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 21487 () => ({ 21488 // Anchor the popover to the middle of the entire row so that it doesn't 21489 // move around when the label changes. 21490 anchor: popoverAnchor, 21491 placement: "left-start", 21492 offset: 36, 21493 shift: true 21494 }), 21495 [popoverAnchor] 21496 ); 21497 const label = isFrontPage ? (0,external_wp_i18n_namespaceObject.__)("Link") : (0,external_wp_i18n_namespaceObject.__)("Slug"); 21498 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(post_panel_row_default, { label, ref: setPopoverAnchor, children: [ 21499 !isFrontPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21500 external_wp_components_namespaceObject.Dropdown, 21501 { 21502 popoverProps, 21503 className: "editor-post-url__panel-dropdown", 21504 contentClassName: "editor-post-url__panel-dialog", 21505 focusOnMount: true, 21506 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21507 PostURLToggle, 21508 { 21509 isOpen, 21510 onClick: onToggle 21511 } 21512 ), 21513 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURL, { onClose }) 21514 } 21515 ), 21516 isFrontPage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(FrontPageLink, {}) 21517 ] }) }); 21518 } 21519 function PostURLToggle({ isOpen, onClick }) { 21520 const { slug } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21521 return { 21522 slug: select(store_store).getEditedPostSlug() 21523 }; 21524 }, []); 21525 const decodedSlug = (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(slug); 21526 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21527 external_wp_components_namespaceObject.Button, 21528 { 21529 size: "compact", 21530 className: "editor-post-url__panel-toggle", 21531 variant: "tertiary", 21532 "aria-expanded": isOpen, 21533 "aria-label": ( 21534 // translators: %s: Current post link. 21535 (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)("Change link: %s"), decodedSlug) 21536 ), 21537 onClick, 21538 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: decodedSlug }) 21539 } 21540 ); 21541 } 21542 function FrontPageLink() { 21543 const { postLink } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21544 const { getCurrentPost } = select(store_store); 21545 return { 21546 postLink: getCurrentPost()?.link 21547 }; 21548 }, []); 21549 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21550 external_wp_components_namespaceObject.ExternalLink, 21551 { 21552 className: "editor-post-url__front-page-link", 21553 href: postLink, 21554 target: "_blank", 21555 children: postLink 21556 } 21557 ); 21558 } 21559 21560 21561 ;// ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js 21562 21563 21564 function PostVisibilityCheck({ render }) { 21565 const canEdit = (0,external_wp_data_namespaceObject.useSelect)((select) => { 21566 return select(store_store).getCurrentPost()._links?.["wp:action-publish"] ?? false; 21567 }); 21568 return render({ canEdit }); 21569 } 21570 21571 21572 ;// ./node_modules/@wordpress/icons/build-module/library/info.js 21573 21574 21575 var info_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21576 external_wp_primitives_namespaceObject.Path, 21577 { 21578 fillRule: "evenodd", 21579 clipRule: "evenodd", 21580 d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" 21581 } 21582 ) }); 21583 21584 21585 ;// external ["wp","wordcount"] 21586 const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; 21587 ;// ./node_modules/@wordpress/editor/build-module/components/word-count/index.js 21588 21589 21590 21591 21592 21593 function WordCount() { 21594 const content = (0,external_wp_data_namespaceObject.useSelect)( 21595 (select) => select(store_store).getEditedPostAttribute("content"), 21596 [] 21597 ); 21598 const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); 21599 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "word-count", children: (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) }); 21600 } 21601 21602 21603 ;// ./node_modules/@wordpress/editor/build-module/components/time-to-read/index.js 21604 21605 21606 21607 21608 21609 21610 const AVERAGE_READING_RATE = 189; 21611 function TimeToRead() { 21612 const content = (0,external_wp_data_namespaceObject.useSelect)( 21613 (select) => select(store_store).getEditedPostAttribute("content"), 21614 [] 21615 ); 21616 const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); 21617 const minutesToRead = Math.round( 21618 (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE 21619 ); 21620 const minutesToReadString = minutesToRead === 0 ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)("<span>< 1</span> minute"), { 21621 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) 21622 }) : (0,external_wp_element_namespaceObject.createInterpolateElement)( 21623 (0,external_wp_i18n_namespaceObject.sprintf)( 21624 /* translators: %s: the number of minutes to read the post. */ 21625 (0,external_wp_i18n_namespaceObject._n)( 21626 "<span>%s</span> minute", 21627 "<span>%s</span> minutes", 21628 minutesToRead 21629 ), 21630 minutesToRead 21631 ), 21632 { 21633 span: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {}) 21634 } 21635 ); 21636 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "time-to-read", children: minutesToReadString }); 21637 } 21638 21639 21640 ;// ./node_modules/@wordpress/editor/build-module/components/character-count/index.js 21641 21642 21643 21644 function CharacterCount() { 21645 const content = (0,external_wp_data_namespaceObject.useSelect)( 21646 (select) => select(store_store).getEditedPostAttribute("content"), 21647 [] 21648 ); 21649 return (0,external_wp_wordcount_namespaceObject.count)(content, "characters_including_spaces"); 21650 } 21651 21652 21653 ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js 21654 21655 21656 21657 21658 21659 21660 21661 21662 function TableOfContentsPanel({ hasOutlineItemsDisabled, onRequestClose }) { 21663 const { headingCount, paragraphCount, numberOfBlocks } = (0,external_wp_data_namespaceObject.useSelect)( 21664 (select) => { 21665 const { getGlobalBlockCount } = select(external_wp_blockEditor_namespaceObject.store); 21666 return { 21667 headingCount: getGlobalBlockCount("core/heading"), 21668 paragraphCount: getGlobalBlockCount("core/paragraph"), 21669 numberOfBlocks: getGlobalBlockCount() 21670 }; 21671 }, 21672 [] 21673 ); 21674 return ( 21675 /* 21676 * Disable reason: The `list` ARIA role is redundant but 21677 * Safari+VoiceOver won't announce the list otherwise. 21678 */ 21679 /* eslint-disable jsx-a11y/no-redundant-roles */ 21680 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 21681 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21682 "div", 21683 { 21684 className: "table-of-contents__wrapper", 21685 role: "note", 21686 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Document Statistics"), 21687 tabIndex: "0", 21688 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("ul", { role: "list", className: "table-of-contents__counts", children: [ 21689 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ 21690 (0,external_wp_i18n_namespaceObject.__)("Words"), 21691 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {}) 21692 ] }), 21693 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ 21694 (0,external_wp_i18n_namespaceObject.__)("Characters"), 21695 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) }) 21696 ] }), 21697 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ 21698 (0,external_wp_i18n_namespaceObject.__)("Time to read"), 21699 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {}) 21700 ] }), 21701 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ 21702 (0,external_wp_i18n_namespaceObject.__)("Headings"), 21703 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: headingCount }) 21704 ] }), 21705 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ 21706 (0,external_wp_i18n_namespaceObject.__)("Paragraphs"), 21707 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: paragraphCount }) 21708 ] }), 21709 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("li", { className: "table-of-contents__count", children: [ 21710 (0,external_wp_i18n_namespaceObject.__)("Blocks"), 21711 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "table-of-contents__number", children: numberOfBlocks }) 21712 ] }) 21713 ] }) 21714 } 21715 ), 21716 headingCount > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 21717 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("hr", {}), 21718 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "table-of-contents__title", children: (0,external_wp_i18n_namespaceObject.__)("Document Outline") }), 21719 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21720 DocumentOutline, 21721 { 21722 onSelect: onRequestClose, 21723 hasOutlineItemsDisabled 21724 } 21725 ) 21726 ] }) 21727 ] }) 21728 ); 21729 } 21730 var table_of_contents_panel_panel_default = TableOfContentsPanel; 21731 21732 21733 ;// ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js 21734 21735 21736 21737 21738 21739 21740 21741 21742 function TableOfContents({ hasOutlineItemsDisabled, repositionDropdown, ...props }, ref) { 21743 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)( 21744 (select) => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), 21745 [] 21746 ); 21747 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21748 external_wp_components_namespaceObject.Dropdown, 21749 { 21750 popoverProps: { 21751 placement: repositionDropdown ? "right" : "bottom" 21752 }, 21753 className: "table-of-contents", 21754 contentClassName: "table-of-contents__popover", 21755 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21756 external_wp_components_namespaceObject.Button, 21757 { 21758 __next40pxDefaultSize: true, 21759 ...props, 21760 ref, 21761 onClick: hasBlocks ? onToggle : void 0, 21762 icon: info_default, 21763 "aria-expanded": isOpen, 21764 "aria-haspopup": "true", 21765 label: (0,external_wp_i18n_namespaceObject.__)("Details"), 21766 tooltipPosition: "bottom", 21767 "aria-disabled": !hasBlocks 21768 } 21769 ), 21770 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 21771 table_of_contents_panel_panel_default, 21772 { 21773 onRequestClose: onClose, 21774 hasOutlineItemsDisabled 21775 } 21776 ) 21777 } 21778 ); 21779 } 21780 var table_of_contents_default = (0,external_wp_element_namespaceObject.forwardRef)(TableOfContents); 21781 21782 21783 ;// ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js 21784 21785 21786 21787 21788 function UnsavedChangesWarning() { 21789 const { __experimentalGetDirtyEntityRecords } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 21790 (0,external_wp_element_namespaceObject.useEffect)(() => { 21791 const warnIfUnsavedChanges = (event) => { 21792 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 21793 if (dirtyEntityRecords.length > 0) { 21794 event.returnValue = (0,external_wp_i18n_namespaceObject.__)( 21795 "You have unsaved changes. If you proceed, they will be lost." 21796 ); 21797 return event.returnValue; 21798 } 21799 }; 21800 window.addEventListener("beforeunload", warnIfUnsavedChanges); 21801 return () => { 21802 window.removeEventListener("beforeunload", warnIfUnsavedChanges); 21803 }; 21804 }, [__experimentalGetDirtyEntityRecords]); 21805 return null; 21806 } 21807 21808 21809 ;// external ["wp","serverSideRender"] 21810 const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; 21811 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); 21812 ;// ./node_modules/@wordpress/editor/build-module/components/deprecated.js 21813 21814 21815 21816 21817 21818 function deprecateComponent(name, Wrapped, staticsToHoist = []) { 21819 const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { 21820 external_wp_deprecated_default()("wp.editor." + name, { 21821 since: "5.3", 21822 alternative: "wp.blockEditor." + name, 21823 version: "6.2" 21824 }); 21825 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapped, { ref, ...props }); 21826 }); 21827 staticsToHoist.forEach((staticName) => { 21828 Component[staticName] = deprecateComponent( 21829 name + "." + staticName, 21830 Wrapped[staticName] 21831 ); 21832 }); 21833 return Component; 21834 } 21835 function deprecateFunction(name, func) { 21836 return (...args) => { 21837 external_wp_deprecated_default()("wp.editor." + name, { 21838 since: "5.3", 21839 alternative: "wp.blockEditor." + name, 21840 version: "6.2" 21841 }); 21842 return func(...args); 21843 }; 21844 } 21845 const RichText = deprecateComponent("RichText", external_wp_blockEditor_namespaceObject.RichText, ["Content"]); 21846 RichText.isEmpty = deprecateFunction( 21847 "RichText.isEmpty", 21848 external_wp_blockEditor_namespaceObject.RichText.isEmpty 21849 ); 21850 const Autocomplete = deprecateComponent( 21851 "Autocomplete", 21852 external_wp_blockEditor_namespaceObject.Autocomplete 21853 ); 21854 const AlignmentToolbar = deprecateComponent( 21855 "AlignmentToolbar", 21856 external_wp_blockEditor_namespaceObject.AlignmentToolbar 21857 ); 21858 const BlockAlignmentToolbar = deprecateComponent( 21859 "BlockAlignmentToolbar", 21860 external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar 21861 ); 21862 const BlockControls = deprecateComponent( 21863 "BlockControls", 21864 external_wp_blockEditor_namespaceObject.BlockControls, 21865 ["Slot"] 21866 ); 21867 const BlockEdit = deprecateComponent("BlockEdit", external_wp_blockEditor_namespaceObject.BlockEdit); 21868 const BlockEditorKeyboardShortcuts = deprecateComponent( 21869 "BlockEditorKeyboardShortcuts", 21870 external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts 21871 ); 21872 const BlockFormatControls = deprecateComponent( 21873 "BlockFormatControls", 21874 external_wp_blockEditor_namespaceObject.BlockFormatControls, 21875 ["Slot"] 21876 ); 21877 const BlockIcon = deprecateComponent("BlockIcon", external_wp_blockEditor_namespaceObject.BlockIcon); 21878 const BlockInspector = deprecateComponent( 21879 "BlockInspector", 21880 external_wp_blockEditor_namespaceObject.BlockInspector 21881 ); 21882 const BlockList = deprecateComponent("BlockList", external_wp_blockEditor_namespaceObject.BlockList); 21883 const BlockMover = deprecateComponent("BlockMover", external_wp_blockEditor_namespaceObject.BlockMover); 21884 const BlockNavigationDropdown = deprecateComponent( 21885 "BlockNavigationDropdown", 21886 external_wp_blockEditor_namespaceObject.BlockNavigationDropdown 21887 ); 21888 const BlockSelectionClearer = deprecateComponent( 21889 "BlockSelectionClearer", 21890 external_wp_blockEditor_namespaceObject.BlockSelectionClearer 21891 ); 21892 const BlockSettingsMenu = deprecateComponent( 21893 "BlockSettingsMenu", 21894 external_wp_blockEditor_namespaceObject.BlockSettingsMenu 21895 ); 21896 const BlockTitle = deprecateComponent("BlockTitle", external_wp_blockEditor_namespaceObject.BlockTitle); 21897 const BlockToolbar = deprecateComponent( 21898 "BlockToolbar", 21899 external_wp_blockEditor_namespaceObject.BlockToolbar 21900 ); 21901 const ColorPalette = deprecateComponent( 21902 "ColorPalette", 21903 external_wp_blockEditor_namespaceObject.ColorPalette 21904 ); 21905 const ContrastChecker = deprecateComponent( 21906 "ContrastChecker", 21907 external_wp_blockEditor_namespaceObject.ContrastChecker 21908 ); 21909 const CopyHandler = deprecateComponent("CopyHandler", external_wp_blockEditor_namespaceObject.CopyHandler); 21910 const DefaultBlockAppender = deprecateComponent( 21911 "DefaultBlockAppender", 21912 external_wp_blockEditor_namespaceObject.DefaultBlockAppender 21913 ); 21914 const FontSizePicker = deprecateComponent( 21915 "FontSizePicker", 21916 external_wp_blockEditor_namespaceObject.FontSizePicker 21917 ); 21918 const Inserter = deprecateComponent("Inserter", external_wp_blockEditor_namespaceObject.Inserter); 21919 const InnerBlocks = deprecateComponent("InnerBlocks", external_wp_blockEditor_namespaceObject.InnerBlocks, [ 21920 "ButtonBlockAppender", 21921 "DefaultBlockAppender", 21922 "Content" 21923 ]); 21924 const InspectorAdvancedControls = deprecateComponent( 21925 "InspectorAdvancedControls", 21926 external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, 21927 ["Slot"] 21928 ); 21929 const InspectorControls = deprecateComponent( 21930 "InspectorControls", 21931 external_wp_blockEditor_namespaceObject.InspectorControls, 21932 ["Slot"] 21933 ); 21934 const PanelColorSettings = deprecateComponent( 21935 "PanelColorSettings", 21936 external_wp_blockEditor_namespaceObject.PanelColorSettings 21937 ); 21938 const PlainText = deprecateComponent("PlainText", external_wp_blockEditor_namespaceObject.PlainText); 21939 const RichTextShortcut = deprecateComponent( 21940 "RichTextShortcut", 21941 external_wp_blockEditor_namespaceObject.RichTextShortcut 21942 ); 21943 const RichTextToolbarButton = deprecateComponent( 21944 "RichTextToolbarButton", 21945 external_wp_blockEditor_namespaceObject.RichTextToolbarButton 21946 ); 21947 const __unstableRichTextInputEvent = deprecateComponent( 21948 "__unstableRichTextInputEvent", 21949 external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent 21950 ); 21951 const MediaPlaceholder = deprecateComponent( 21952 "MediaPlaceholder", 21953 external_wp_blockEditor_namespaceObject.MediaPlaceholder 21954 ); 21955 const MediaUpload = deprecateComponent("MediaUpload", external_wp_blockEditor_namespaceObject.MediaUpload); 21956 const MediaUploadCheck = deprecateComponent( 21957 "MediaUploadCheck", 21958 external_wp_blockEditor_namespaceObject.MediaUploadCheck 21959 ); 21960 const MultiSelectScrollIntoView = deprecateComponent( 21961 "MultiSelectScrollIntoView", 21962 external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView 21963 ); 21964 const NavigableToolbar = deprecateComponent( 21965 "NavigableToolbar", 21966 external_wp_blockEditor_namespaceObject.NavigableToolbar 21967 ); 21968 const ObserveTyping = deprecateComponent( 21969 "ObserveTyping", 21970 external_wp_blockEditor_namespaceObject.ObserveTyping 21971 ); 21972 const SkipToSelectedBlock = deprecateComponent( 21973 "SkipToSelectedBlock", 21974 external_wp_blockEditor_namespaceObject.SkipToSelectedBlock 21975 ); 21976 const URLInput = deprecateComponent("URLInput", external_wp_blockEditor_namespaceObject.URLInput); 21977 const URLInputButton = deprecateComponent( 21978 "URLInputButton", 21979 external_wp_blockEditor_namespaceObject.URLInputButton 21980 ); 21981 const URLPopover = deprecateComponent("URLPopover", external_wp_blockEditor_namespaceObject.URLPopover); 21982 const Warning = deprecateComponent("Warning", external_wp_blockEditor_namespaceObject.Warning); 21983 const WritingFlow = deprecateComponent("WritingFlow", external_wp_blockEditor_namespaceObject.WritingFlow); 21984 const createCustomColorsHOC = deprecateFunction( 21985 "createCustomColorsHOC", 21986 external_wp_blockEditor_namespaceObject.createCustomColorsHOC 21987 ); 21988 const getColorClassName = deprecateFunction( 21989 "getColorClassName", 21990 external_wp_blockEditor_namespaceObject.getColorClassName 21991 ); 21992 const getColorObjectByAttributeValues = deprecateFunction( 21993 "getColorObjectByAttributeValues", 21994 external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues 21995 ); 21996 const getColorObjectByColorValue = deprecateFunction( 21997 "getColorObjectByColorValue", 21998 external_wp_blockEditor_namespaceObject.getColorObjectByColorValue 21999 ); 22000 const getFontSize = deprecateFunction("getFontSize", external_wp_blockEditor_namespaceObject.getFontSize); 22001 const getFontSizeClass = deprecateFunction( 22002 "getFontSizeClass", 22003 external_wp_blockEditor_namespaceObject.getFontSizeClass 22004 ); 22005 const withColorContext = deprecateFunction( 22006 "withColorContext", 22007 external_wp_blockEditor_namespaceObject.withColorContext 22008 ); 22009 const withColors = deprecateFunction("withColors", external_wp_blockEditor_namespaceObject.withColors); 22010 const withFontSizes = deprecateFunction( 22011 "withFontSizes", 22012 external_wp_blockEditor_namespaceObject.withFontSizes 22013 ); 22014 22015 22016 ;// ./node_modules/@wordpress/editor/build-module/components/index.js 22017 22018 22019 22020 22021 22022 22023 22024 22025 22026 22027 22028 22029 22030 22031 22032 22033 22034 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 22065 22066 22067 22068 22069 22070 22071 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 22087 22088 22089 22090 22091 22092 22093 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; 22107 const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts; 22108 22109 22110 ;// ./node_modules/@wordpress/editor/build-module/utils/url.js 22111 22112 22113 function cleanForSlug(string) { 22114 external_wp_deprecated_default()("wp.editor.cleanForSlug", { 22115 since: "12.7", 22116 plugin: "Gutenberg", 22117 alternative: "wp.url.cleanForSlug" 22118 }); 22119 return (0,external_wp_url_namespaceObject.cleanForSlug)(string); 22120 } 22121 22122 22123 ;// ./node_modules/@wordpress/editor/build-module/utils/index.js 22124 22125 22126 22127 22128 22129 ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/content-slot-fill.js 22130 22131 const EditorContentSlotFill = (0,external_wp_components_namespaceObject.createSlotFill)( 22132 Symbol("EditCanvasContainerSlot") 22133 ); 22134 var content_slot_fill_default = EditorContentSlotFill; 22135 22136 22137 ;// ./node_modules/@wordpress/editor/build-module/components/header/back-button.js 22138 22139 22140 const slotName = "__experimentalMainDashboardButton"; 22141 const useHasBackButton = () => { 22142 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 22143 return Boolean(fills && fills.length); 22144 }; 22145 const { Fill: back_button_Fill, Slot: back_button_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); 22146 const BackButton = back_button_Fill; 22147 const BackButtonSlot = () => { 22148 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 22149 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22150 back_button_Slot, 22151 { 22152 bubblesVirtually: true, 22153 fillProps: { length: !fills ? 0 : fills.length } 22154 } 22155 ); 22156 }; 22157 BackButton.Slot = BackButtonSlot; 22158 var back_button_default = BackButton; 22159 22160 22161 ;// ./node_modules/@wordpress/icons/build-module/library/next.js 22162 22163 22164 var next_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); 22165 22166 22167 ;// ./node_modules/@wordpress/icons/build-module/library/previous.js 22168 22169 22170 var previous_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); 22171 22172 22173 ;// ./node_modules/@wordpress/editor/build-module/components/collapsible-block-toolbar/index.js 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 const { useHasBlockToolbar } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 22184 function CollapsibleBlockToolbar({ isCollapsed, onToggle }) { 22185 const { blockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 22186 return { 22187 blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 22188 }; 22189 }, []); 22190 const hasBlockToolbar = useHasBlockToolbar(); 22191 const hasBlockSelection = !!blockSelectionStart; 22192 (0,external_wp_element_namespaceObject.useEffect)(() => { 22193 if (blockSelectionStart) { 22194 onToggle(false); 22195 } 22196 }, [blockSelectionStart, onToggle]); 22197 if (!hasBlockToolbar) { 22198 return null; 22199 } 22200 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22202 "div", 22203 { 22204 className: dist_clsx("editor-collapsible-block-toolbar", { 22205 "is-collapsed": isCollapsed || !hasBlockSelection 22206 }), 22207 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }) 22208 } 22209 ), 22210 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover.Slot, { name: "block-toolbar" }), 22211 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22212 external_wp_components_namespaceObject.Button, 22213 { 22214 className: "editor-collapsible-block-toolbar__toggle", 22215 icon: isCollapsed ? next_default : previous_default, 22216 onClick: () => { 22217 onToggle(!isCollapsed); 22218 }, 22219 label: isCollapsed ? (0,external_wp_i18n_namespaceObject.__)("Show block tools") : (0,external_wp_i18n_namespaceObject.__)("Hide block tools"), 22220 size: "compact" 22221 } 22222 ) 22223 ] }); 22224 } 22225 22226 22227 ;// ./node_modules/@wordpress/icons/build-module/library/plus.js 22228 22229 22230 var plus_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 22231 22232 22233 ;// ./node_modules/@wordpress/editor/build-module/components/document-tools/index.js 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 function DocumentTools({ className, disableBlockTools = false }) { 22250 const { setIsInserterOpened, setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22251 const { 22252 isDistractionFree, 22253 isInserterOpened, 22254 isListViewOpen, 22255 listViewShortcut, 22256 inserterSidebarToggleRef, 22257 listViewToggleRef, 22258 showIconLabels 22259 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 22260 const { get } = select(external_wp_preferences_namespaceObject.store); 22261 const { 22262 isListViewOpened, 22263 getEditorMode, 22264 getInserterSidebarToggleRef, 22265 getListViewToggleRef 22266 } = unlock(select(store_store)); 22267 const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); 22268 return { 22269 isInserterOpened: select(store_store).isInserterOpened(), 22270 isListViewOpen: isListViewOpened(), 22271 listViewShortcut: getShortcutRepresentation( 22272 "core/editor/toggle-list-view" 22273 ), 22274 inserterSidebarToggleRef: getInserterSidebarToggleRef(), 22275 listViewToggleRef: getListViewToggleRef(), 22276 showIconLabels: get("core", "showIconLabels"), 22277 isDistractionFree: get("core", "distractionFree"), 22278 isVisualMode: getEditorMode() === "visual" 22279 }; 22280 }, []); 22281 const preventDefault = (event) => { 22282 if (isInserterOpened) { 22283 event.preventDefault(); 22284 } 22285 }; 22286 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("wide"); 22287 const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)("Document tools"); 22288 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)( 22289 () => setIsListViewOpened(!isListViewOpen), 22290 [setIsListViewOpened, isListViewOpen] 22291 ); 22292 const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)( 22293 () => setIsInserterOpened(!isInserterOpened), 22294 [isInserterOpened, setIsInserterOpened] 22295 ); 22296 const longLabel = (0,external_wp_i18n_namespaceObject._x)( 22297 "Block Inserter", 22298 "Generic label for block inserter button" 22299 ); 22300 const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)("Add") : (0,external_wp_i18n_namespaceObject.__)("Close"); 22301 return ( 22302 // Some plugins expect and use the `edit-post-header-toolbar` CSS class to 22303 // find the toolbar and inject UI elements into it. This is not officially 22304 // supported, but we're keeping it in the list of class names for backwards 22305 // compatibility. 22306 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22307 external_wp_blockEditor_namespaceObject.NavigableToolbar, 22308 { 22309 className: dist_clsx( 22310 "editor-document-tools", 22311 "edit-post-header-toolbar", 22312 className 22313 ), 22314 "aria-label": toolbarAriaLabel, 22315 variant: "unstyled", 22316 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-document-tools__left", children: [ 22317 !isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22318 external_wp_components_namespaceObject.ToolbarButton, 22319 { 22320 ref: inserterSidebarToggleRef, 22321 className: "editor-document-tools__inserter-toggle", 22322 variant: "primary", 22323 isPressed: isInserterOpened, 22324 onMouseDown: preventDefault, 22325 onClick: toggleInserter, 22326 disabled: disableBlockTools, 22327 icon: plus_default, 22328 label: showIconLabels ? shortLabel : longLabel, 22329 showTooltip: !showIconLabels, 22330 "aria-expanded": isInserterOpened 22331 } 22332 ), 22333 (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22334 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22335 external_wp_components_namespaceObject.ToolbarItem, 22336 { 22337 as: undo_undo_default, 22338 showTooltip: !showIconLabels, 22339 variant: showIconLabels ? "tertiary" : void 0, 22340 size: "compact" 22341 } 22342 ), 22343 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22344 external_wp_components_namespaceObject.ToolbarItem, 22345 { 22346 as: redo_redo_default, 22347 showTooltip: !showIconLabels, 22348 variant: showIconLabels ? "tertiary" : void 0, 22349 size: "compact" 22350 } 22351 ), 22352 !isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22353 external_wp_components_namespaceObject.ToolbarButton, 22354 { 22355 className: "editor-document-tools__document-overview-toggle", 22356 icon: list_view_default, 22357 disabled: disableBlockTools, 22358 isPressed: isListViewOpen, 22359 label: (0,external_wp_i18n_namespaceObject.__)("Document Overview"), 22360 onClick: toggleListView, 22361 shortcut: listViewShortcut, 22362 showTooltip: !showIconLabels, 22363 variant: showIconLabels ? "tertiary" : void 0, 22364 "aria-expanded": isListViewOpen, 22365 ref: listViewToggleRef 22366 } 22367 ) 22368 ] }) 22369 ] }) 22370 } 22371 ) 22372 ); 22373 } 22374 var document_tools_default = DocumentTools; 22375 22376 22377 ;// ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 22378 22379 22380 var more_vertical_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 22381 22382 22383 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/copy-content-menu-item.js 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 function CopyContentMenuItem() { 22394 const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 22395 const { getCurrentPostId, getCurrentPostType } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 22396 const { getEditedEntityRecord } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store); 22397 function getText() { 22398 const record = getEditedEntityRecord( 22399 "postType", 22400 getCurrentPostType(), 22401 getCurrentPostId() 22402 ); 22403 if (!record) { 22404 return ""; 22405 } 22406 if (typeof record.content === "function") { 22407 return record.content(record); 22408 } else if (record.blocks) { 22409 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); 22410 } else if (record.content) { 22411 return record.content; 22412 } 22413 } 22414 function onSuccess() { 22415 createNotice("info", (0,external_wp_i18n_namespaceObject.__)("All content copied."), { 22416 isDismissible: true, 22417 type: "snackbar" 22418 }); 22419 } 22420 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); 22421 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { ref, children: (0,external_wp_i18n_namespaceObject.__)("Copy all blocks") }); 22422 } 22423 22424 22425 ;// ./node_modules/@wordpress/editor/build-module/components/mode-switcher/index.js 22426 22427 22428 22429 22430 22431 22432 const MODES = [ 22433 { 22434 value: "visual", 22435 label: (0,external_wp_i18n_namespaceObject.__)("Visual editor") 22436 }, 22437 { 22438 value: "text", 22439 label: (0,external_wp_i18n_namespaceObject.__)("Code editor") 22440 } 22441 ]; 22442 function ModeSwitcher() { 22443 const { shortcut, isRichEditingEnabled, isCodeEditingEnabled, mode } = (0,external_wp_data_namespaceObject.useSelect)( 22444 (select) => ({ 22445 shortcut: select( 22446 external_wp_keyboardShortcuts_namespaceObject.store 22447 ).getShortcutRepresentation("core/editor/toggle-mode"), 22448 isRichEditingEnabled: select(store_store).getEditorSettings().richEditingEnabled, 22449 isCodeEditingEnabled: select(store_store).getEditorSettings().codeEditingEnabled, 22450 mode: select(store_store).getEditorMode() 22451 }), 22452 [] 22453 ); 22454 const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22455 let selectedMode = mode; 22456 if (!isRichEditingEnabled && mode === "visual") { 22457 selectedMode = "text"; 22458 } 22459 if (!isCodeEditingEnabled && mode === "text") { 22460 selectedMode = "visual"; 22461 } 22462 const choices = MODES.map((choice) => { 22463 if (!isCodeEditingEnabled && choice.value === "text") { 22464 choice = { 22465 ...choice, 22466 disabled: true 22467 }; 22468 } 22469 if (!isRichEditingEnabled && choice.value === "visual") { 22470 choice = { 22471 ...choice, 22472 disabled: true, 22473 info: (0,external_wp_i18n_namespaceObject.__)( 22474 "You can enable the visual editor in your profile settings." 22475 ) 22476 }; 22477 } 22478 if (choice.value !== selectedMode && !choice.disabled) { 22479 return { ...choice, shortcut }; 22480 } 22481 return choice; 22482 }); 22483 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Editor"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22484 external_wp_components_namespaceObject.MenuItemsChoice, 22485 { 22486 choices, 22487 value: selectedMode, 22488 onSelect: switchEditorMode 22489 } 22490 ) }); 22491 } 22492 var mode_switcher_default = ModeSwitcher; 22493 22494 22495 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/tools-more-menu-group.js 22496 22497 22498 const { Fill: ToolsMoreMenuGroup, Slot: tools_more_menu_group_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("ToolsMoreMenuGroup"); 22499 ToolsMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(tools_more_menu_group_Slot, { fillProps }); 22500 var tools_more_menu_group_default = ToolsMoreMenuGroup; 22501 22502 22503 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/view-more-menu-group.js 22504 22505 22506 22507 const { Fill: ViewMoreMenuGroup, Slot: view_more_menu_group_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)( 22508 external_wp_element_namespaceObject.Platform.OS === "web" ? Symbol("ViewMoreMenuGroup") : "ViewMoreMenuGroup" 22509 ); 22510 ViewMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_Slot, { fillProps }); 22511 var view_more_menu_group_default = ViewMoreMenuGroup; 22512 22513 22514 ;// ./node_modules/@wordpress/editor/build-module/components/more-menu/index.js 22515 22516 22517 22518 22519 22520 22521 22522 22523 22524 22525 22526 22527 22528 function MoreMenu() { 22529 const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); 22530 const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 22531 const { toggleDistractionFree } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22532 const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)( 22533 (select) => select(external_wp_preferences_namespaceObject.store).get("core", "showIconLabels"), 22534 [] 22535 ); 22536 const turnOffDistractionFree = () => { 22537 setPreference("core", "distractionFree", false); 22538 }; 22539 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22540 external_wp_components_namespaceObject.DropdownMenu, 22541 { 22542 icon: more_vertical_default, 22543 label: (0,external_wp_i18n_namespaceObject.__)("Options"), 22544 popoverProps: { 22545 placement: "bottom-end", 22546 className: "more-menu-dropdown__content" 22547 }, 22548 toggleProps: { 22549 showTooltip: !showIconLabels, 22550 ...showIconLabels && { variant: "tertiary" }, 22551 tooltipPosition: "bottom", 22552 size: "compact" 22553 }, 22554 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22555 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)("View", "noun"), children: [ 22556 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22557 external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, 22558 { 22559 scope: "core", 22560 name: "fixedToolbar", 22561 onToggle: turnOffDistractionFree, 22562 label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar"), 22563 info: (0,external_wp_i18n_namespaceObject.__)( 22564 "Access all block and document tools in a single place" 22565 ), 22566 messageActivated: (0,external_wp_i18n_namespaceObject.__)( 22567 "Top toolbar activated." 22568 ), 22569 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( 22570 "Top toolbar deactivated." 22571 ) 22572 } 22573 ), 22574 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22575 external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, 22576 { 22577 scope: "core", 22578 name: "distractionFree", 22579 label: (0,external_wp_i18n_namespaceObject.__)("Distraction free"), 22580 info: (0,external_wp_i18n_namespaceObject.__)("Write with calmness"), 22581 handleToggling: false, 22582 onToggle: () => toggleDistractionFree({ 22583 createNotice: false 22584 }), 22585 messageActivated: (0,external_wp_i18n_namespaceObject.__)( 22586 "Distraction free mode activated." 22587 ), 22588 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( 22589 "Distraction free mode deactivated." 22590 ), 22591 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift( 22592 "\\" 22593 ) 22594 } 22595 ), 22596 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22597 external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, 22598 { 22599 scope: "core", 22600 name: "focusMode", 22601 label: (0,external_wp_i18n_namespaceObject.__)("Spotlight mode"), 22602 info: (0,external_wp_i18n_namespaceObject.__)("Focus on one block at a time"), 22603 messageActivated: (0,external_wp_i18n_namespaceObject.__)( 22604 "Spotlight mode activated." 22605 ), 22606 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)( 22607 "Spotlight mode deactivated." 22608 ) 22609 } 22610 ), 22611 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(view_more_menu_group_default.Slot, { fillProps: { onClose } }) 22612 ] }), 22613 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(mode_switcher_default, {}), 22614 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22615 action_item_default.Slot, 22616 { 22617 name: "core/plugin-more-menu", 22618 label: (0,external_wp_i18n_namespaceObject.__)("Panels"), 22619 fillProps: { onClick: onClose } 22620 } 22621 ), 22622 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)("Tools"), children: [ 22623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22624 external_wp_components_namespaceObject.MenuItem, 22625 { 22626 onClick: () => openModal("editor/keyboard-shortcut-help"), 22627 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access("h"), 22628 children: (0,external_wp_i18n_namespaceObject.__)("Keyboard shortcuts") 22629 } 22630 ), 22631 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyContentMenuItem, {}), 22632 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22633 external_wp_components_namespaceObject.MenuItem, 22634 { 22635 icon: external_default, 22636 href: (0,external_wp_i18n_namespaceObject.__)( 22637 "https://wordpress.org/documentation/article/wordpress-block-editor/" 22638 ), 22639 target: "_blank", 22640 rel: "noopener noreferrer", 22641 children: [ 22642 (0,external_wp_i18n_namespaceObject.__)("Help"), 22643 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 22644 as: "span", 22645 /* translators: accessibility text */ 22646 children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") 22647 }) 22648 ] 22649 } 22650 ), 22651 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22652 tools_more_menu_group_default.Slot, 22653 { 22654 fillProps: { onClose } 22655 } 22656 ) 22657 ] }), 22658 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22659 external_wp_components_namespaceObject.MenuItem, 22660 { 22661 onClick: () => openModal("editor/preferences"), 22662 children: (0,external_wp_i18n_namespaceObject.__)("Preferences") 22663 } 22664 ) }) 22665 ] }) 22666 } 22667 ) }); 22668 } 22669 22670 22671 ;// ./node_modules/@wordpress/editor/build-module/components/post-publish-button/post-publish-button-or-toggle.js 22672 22673 22674 22675 22676 22677 const IS_TOGGLE = "toggle"; 22678 const IS_BUTTON = "button"; 22679 function PostPublishButtonOrToggle({ 22680 forceIsDirty, 22681 setEntitiesSavedStatesCallback 22682 }) { 22683 let component; 22684 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 22685 const { togglePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 22686 const { 22687 hasPublishAction, 22688 isBeingScheduled, 22689 isPending, 22690 isPublished, 22691 isPublishSidebarEnabled, 22692 isPublishSidebarOpened, 22693 isScheduled, 22694 postStatus, 22695 postStatusHasChanged 22696 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 22697 return { 22698 hasPublishAction: !!select(store_store).getCurrentPost()?._links?.["wp:action-publish"], 22699 isBeingScheduled: select(store_store).isEditedPostBeingScheduled(), 22700 isPending: select(store_store).isCurrentPostPending(), 22701 isPublished: select(store_store).isCurrentPostPublished(), 22702 isPublishSidebarEnabled: select(store_store).isPublishSidebarEnabled(), 22703 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), 22704 isScheduled: select(store_store).isCurrentPostScheduled(), 22705 postStatus: select(store_store).getEditedPostAttribute("status"), 22706 postStatusHasChanged: select(store_store).getPostEdits()?.status 22707 }; 22708 }, []); 22709 if (isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { 22710 component = IS_BUTTON; 22711 } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) { 22712 component = IS_TOGGLE; 22713 } else { 22714 component = IS_BUTTON; 22715 } 22716 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22717 post_publish_button_default, 22718 { 22719 forceIsDirty, 22720 isOpen: isPublishSidebarOpened, 22721 isToggle: component === IS_TOGGLE, 22722 onToggle: togglePublishSidebar, 22723 setEntitiesSavedStatesCallback 22724 } 22725 ); 22726 } 22727 22728 22729 ;// ./node_modules/@wordpress/editor/build-module/components/post-view-link/index.js 22730 22731 22732 22733 22734 22735 22736 22737 22738 function PostViewLink() { 22739 const { hasLoaded, permalink, isPublished, label, showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 22740 const postTypeSlug = select(store_store).getCurrentPostType(); 22741 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); 22742 const { get } = select(external_wp_preferences_namespaceObject.store); 22743 return { 22744 permalink: select(store_store).getPermalink(), 22745 isPublished: select(store_store).isCurrentPostPublished(), 22746 label: postType?.labels.view_item, 22747 hasLoaded: !!postType, 22748 showIconLabels: get("core", "showIconLabels") 22749 }; 22750 }, []); 22751 if (!isPublished || !permalink || !hasLoaded) { 22752 return null; 22753 } 22754 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22755 external_wp_components_namespaceObject.Button, 22756 { 22757 icon: external_default, 22758 label: label || (0,external_wp_i18n_namespaceObject.__)("View post"), 22759 href: permalink, 22760 target: "_blank", 22761 showTooltip: !showIconLabels, 22762 size: "compact" 22763 } 22764 ); 22765 } 22766 22767 22768 ;// ./node_modules/@wordpress/icons/build-module/library/desktop.js 22769 22770 22771 var desktop_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" }) }); 22772 22773 22774 ;// ./node_modules/@wordpress/icons/build-module/library/mobile.js 22775 22776 22777 var mobile_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); 22778 22779 22780 ;// ./node_modules/@wordpress/icons/build-module/library/tablet.js 22781 22782 22783 var tablet_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z" }) }); 22784 22785 22786 ;// ./node_modules/@wordpress/editor/build-module/components/preview-dropdown/index.js 22787 22788 22789 22790 22791 22792 22793 22794 22795 22796 22797 22798 22799 22800 22801 function PreviewDropdown({ forceIsAutosaveable, disabled }) { 22802 const { 22803 deviceType, 22804 homeUrl, 22805 isTemplate, 22806 isViewable, 22807 showIconLabels, 22808 isTemplateHidden, 22809 templateId 22810 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 22811 const { 22812 getDeviceType, 22813 getCurrentPostType, 22814 getCurrentTemplateId, 22815 getRenderingMode 22816 } = select(store_store); 22817 const { getEntityRecord, getPostType } = select(external_wp_coreData_namespaceObject.store); 22818 const { get } = select(external_wp_preferences_namespaceObject.store); 22819 const _currentPostType = getCurrentPostType(); 22820 return { 22821 deviceType: getDeviceType(), 22822 homeUrl: getEntityRecord("root", "__unstableBase")?.home, 22823 isTemplate: _currentPostType === "wp_template", 22824 isViewable: getPostType(_currentPostType)?.viewable ?? false, 22825 showIconLabels: get("core", "showIconLabels"), 22826 isTemplateHidden: getRenderingMode() === "post-only", 22827 templateId: getCurrentTemplateId() 22828 }; 22829 }, []); 22830 const { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock( 22831 (0,external_wp_data_namespaceObject.useDispatch)(store_store) 22832 ); 22833 const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 22834 const handleDevicePreviewChange = (newDeviceType) => { 22835 setDeviceType(newDeviceType); 22836 resetZoomLevel(); 22837 }; 22838 const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 22839 if (isMobile) { 22840 return null; 22841 } 22842 const popoverProps = { 22843 placement: "bottom-end" 22844 }; 22845 const toggleProps = { 22846 className: "editor-preview-dropdown__toggle", 22847 iconPosition: "right", 22848 size: "compact", 22849 showTooltip: !showIconLabels, 22850 disabled, 22851 accessibleWhenDisabled: disabled 22852 }; 22853 const menuProps = { 22854 "aria-label": (0,external_wp_i18n_namespaceObject.__)("View options") 22855 }; 22856 const deviceIcons = { 22857 desktop: desktop_default, 22858 mobile: mobile_default, 22859 tablet: tablet_default 22860 }; 22861 const choices = [ 22862 { 22863 value: "Desktop", 22864 label: (0,external_wp_i18n_namespaceObject.__)("Desktop"), 22865 icon: desktop_default 22866 }, 22867 { 22868 value: "Tablet", 22869 label: (0,external_wp_i18n_namespaceObject.__)("Tablet"), 22870 icon: tablet_default 22871 }, 22872 { 22873 value: "Mobile", 22874 label: (0,external_wp_i18n_namespaceObject.__)("Mobile"), 22875 icon: mobile_default 22876 } 22877 ]; 22878 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22879 external_wp_components_namespaceObject.DropdownMenu, 22880 { 22881 className: dist_clsx( 22882 "editor-preview-dropdown", 22883 `editor-preview-dropdown--$deviceType.toLowerCase()}` 22884 ), 22885 popoverProps, 22886 toggleProps, 22887 menuProps, 22888 icon: deviceIcons[deviceType.toLowerCase()], 22889 label: (0,external_wp_i18n_namespaceObject.__)("View"), 22890 disableOpenOnArrowDown: disabled, 22891 children: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22892 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22893 external_wp_components_namespaceObject.MenuItemsChoice, 22894 { 22895 choices, 22896 value: deviceType, 22897 onSelect: handleDevicePreviewChange 22898 } 22899 ) }), 22900 isTemplate && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 22901 external_wp_components_namespaceObject.MenuItem, 22902 { 22903 href: homeUrl, 22904 target: "_blank", 22905 icon: external_default, 22906 onClick: onClose, 22907 children: [ 22908 (0,external_wp_i18n_namespaceObject.__)("View site"), 22909 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 22910 as: "span", 22911 /* translators: accessibility text */ 22912 children: (0,external_wp_i18n_namespaceObject.__)("(opens in a new tab)") 22913 }) 22914 ] 22915 } 22916 ) }), 22917 !isTemplate && !!templateId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22918 external_wp_components_namespaceObject.MenuItem, 22919 { 22920 icon: !isTemplateHidden ? check_default : void 0, 22921 isSelected: !isTemplateHidden, 22922 role: "menuitemcheckbox", 22923 onClick: () => { 22924 const newRenderingMode = isTemplateHidden ? "template-locked" : "post-only"; 22925 setRenderingMode(newRenderingMode); 22926 setDefaultRenderingMode(newRenderingMode); 22927 resetZoomLevel(); 22928 }, 22929 children: (0,external_wp_i18n_namespaceObject.__)("Show template") 22930 } 22931 ) }), 22932 isViewable && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22933 PostPreviewButton, 22934 { 22935 className: "editor-preview-dropdown__button-external", 22936 role: "menuitem", 22937 forceIsAutosaveable, 22938 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Preview in new tab"), 22939 textContent: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 22940 (0,external_wp_i18n_namespaceObject.__)("Preview in new tab"), 22941 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { icon: external_default }) 22942 ] }), 22943 onPreview: onClose 22944 } 22945 ) }), 22946 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22947 action_item_default.Slot, 22948 { 22949 name: "core/plugin-preview-menu", 22950 fillProps: { onClick: onClose } 22951 } 22952 ) 22953 ] }) 22954 } 22955 ); 22956 } 22957 22958 22959 ;// ./node_modules/@wordpress/icons/build-module/library/square.js 22960 22961 22962 var square_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 22963 external_wp_primitives_namespaceObject.Path, 22964 { 22965 fill: "none", 22966 d: "M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25", 22967 stroke: "currentColor", 22968 strokeWidth: "1.5", 22969 strokeLinecap: "square" 22970 } 22971 ) }); 22972 22973 22974 ;// ./node_modules/@wordpress/editor/build-module/components/zoom-out-toggle/index.js 22975 22976 22977 22978 22979 22980 22981 22982 22983 22984 22985 22986 const ZoomOutToggle = ({ disabled }) => { 22987 const { isZoomOut, showIconLabels, isDistractionFree } = (0,external_wp_data_namespaceObject.useSelect)( 22988 (select) => ({ 22989 isZoomOut: unlock(select(external_wp_blockEditor_namespaceObject.store)).isZoomOut(), 22990 showIconLabels: select(external_wp_preferences_namespaceObject.store).get( 22991 "core", 22992 "showIconLabels" 22993 ), 22994 isDistractionFree: select(external_wp_preferences_namespaceObject.store).get( 22995 "core", 22996 "distractionFree" 22997 ) 22998 }) 22999 ); 23000 const { resetZoomLevel, setZoomLevel } = unlock( 23001 (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store) 23002 ); 23003 const { registerShortcut, unregisterShortcut } = (0,external_wp_data_namespaceObject.useDispatch)( 23004 external_wp_keyboardShortcuts_namespaceObject.store 23005 ); 23006 (0,external_wp_element_namespaceObject.useEffect)(() => { 23007 registerShortcut({ 23008 name: "core/editor/zoom", 23009 category: "global", 23010 description: (0,external_wp_i18n_namespaceObject.__)("Enter or exit zoom out."), 23011 keyCombination: { 23012 // `primaryShift+0` (`ctrl+shift+0`) is the shortcut for switching 23013 // to input mode in Windows, so apply a different key combination. 23014 modifier: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? "primaryShift" : "secondary", 23015 character: "0" 23016 } 23017 }); 23018 return () => { 23019 unregisterShortcut("core/editor/zoom"); 23020 }; 23021 }, [registerShortcut, unregisterShortcut]); 23022 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)( 23023 "core/editor/zoom", 23024 () => { 23025 if (isZoomOut) { 23026 resetZoomLevel(); 23027 } else { 23028 setZoomLevel("auto-scaled"); 23029 } 23030 }, 23031 { 23032 isDisabled: isDistractionFree 23033 } 23034 ); 23035 const handleZoomOut = () => { 23036 if (isZoomOut) { 23037 resetZoomLevel(); 23038 } else { 23039 setZoomLevel("auto-scaled"); 23040 } 23041 }; 23042 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23043 external_wp_components_namespaceObject.Button, 23044 { 23045 accessibleWhenDisabled: true, 23046 disabled, 23047 onClick: handleZoomOut, 23048 icon: square_default, 23049 label: (0,external_wp_i18n_namespaceObject.__)("Zoom Out"), 23050 isPressed: isZoomOut, 23051 size: "compact", 23052 showTooltip: !showIconLabels, 23053 className: "editor-zoom-out-toggle" 23054 } 23055 ); 23056 }; 23057 var zoom_out_toggle_default = ZoomOutToggle; 23058 23059 23060 ;// ./node_modules/@wordpress/editor/build-module/components/header/index.js 23061 23062 23063 23064 23065 23066 23067 23068 23069 23070 23071 23072 23073 23074 23075 23076 23077 23078 23079 23080 23081 23082 23083 const toolbarVariations = { 23084 distractionFreeDisabled: { y: "-50px" }, 23085 distractionFreeHover: { y: 0 }, 23086 distractionFreeHidden: { y: "-50px" }, 23087 visible: { y: 0 }, 23088 hidden: { y: 0 } 23089 }; 23090 const backButtonVariations = { 23091 distractionFreeDisabled: { x: "-100%" }, 23092 distractionFreeHover: { x: 0 }, 23093 distractionFreeHidden: { x: "-100%" }, 23094 visible: { x: 0 }, 23095 hidden: { x: 0 } 23096 }; 23097 function Header({ 23098 customSaveButton, 23099 forceIsDirty, 23100 forceDisableBlockTools, 23101 setEntitiesSavedStatesCallback, 23102 title 23103 }) { 23104 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("large"); 23105 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); 23106 const isTooNarrowForDocumentBar = (0,external_wp_compose_namespaceObject.useMediaQuery)("(max-width: 403px)"); 23107 const { 23108 postType, 23109 isTextEditor, 23110 isPublishSidebarOpened, 23111 showIconLabels, 23112 hasFixedToolbar, 23113 hasBlockSelection, 23114 hasSectionRootClientId 23115 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 23116 const { get: getPreference } = select(external_wp_preferences_namespaceObject.store); 23117 const { 23118 getEditorMode, 23119 getCurrentPostType, 23120 isPublishSidebarOpened: _isPublishSidebarOpened 23121 } = select(store_store); 23122 const { getBlockSelectionStart, getSectionRootClientId } = unlock( 23123 select(external_wp_blockEditor_namespaceObject.store) 23124 ); 23125 return { 23126 postType: getCurrentPostType(), 23127 isTextEditor: getEditorMode() === "text", 23128 isPublishSidebarOpened: _isPublishSidebarOpened(), 23129 showIconLabels: getPreference("core", "showIconLabels"), 23130 hasFixedToolbar: getPreference("core", "fixedToolbar"), 23131 hasBlockSelection: !!getBlockSelectionStart(), 23132 hasSectionRootClientId: !!getSectionRootClientId() 23133 }; 23134 }, []); 23135 const canBeZoomedOut = ["post", "page", "wp_template"].includes(postType) && hasSectionRootClientId; 23136 const disablePreviewOption = [ 23137 NAVIGATION_POST_TYPE, 23138 TEMPLATE_PART_POST_TYPE, 23139 PATTERN_POST_TYPE 23140 ].includes(postType) || forceDisableBlockTools; 23141 const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); 23142 const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed)); 23143 const hasBackButton = useHasBackButton(); 23144 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-header edit-post-header", children: [ 23145 hasBackButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23146 external_wp_components_namespaceObject.__unstableMotion.div, 23147 { 23148 className: "editor-header__back-button", 23149 variants: backButtonVariations, 23150 transition: { type: "tween" }, 23151 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button_default.Slot, {}) 23152 } 23153 ), 23154 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23155 external_wp_components_namespaceObject.__unstableMotion.div, 23156 { 23157 variants: toolbarVariations, 23158 className: "editor-header__toolbar", 23159 transition: { type: "tween" }, 23160 children: [ 23161 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23162 document_tools_default, 23163 { 23164 disableBlockTools: forceDisableBlockTools || isTextEditor 23165 } 23166 ), 23167 hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23168 CollapsibleBlockToolbar, 23169 { 23170 isCollapsed: isBlockToolsCollapsed, 23171 onToggle: setIsBlockToolsCollapsed 23172 } 23173 ) 23174 ] 23175 } 23176 ), 23177 hasCenter && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23178 external_wp_components_namespaceObject.__unstableMotion.div, 23179 { 23180 className: "editor-header__center", 23181 variants: toolbarVariations, 23182 transition: { type: "tween" }, 23183 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentBar, { title }) 23184 } 23185 ), 23186 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 23187 external_wp_components_namespaceObject.__unstableMotion.div, 23188 { 23189 variants: toolbarVariations, 23190 transition: { type: "tween" }, 23191 className: "editor-header__settings", 23192 children: [ 23193 !customSaveButton && !isPublishSidebarOpened && /* 23194 * This button isn't completely hidden by the publish sidebar. 23195 * We can't hide the whole toolbar when the publish sidebar is open because 23196 * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. 23197 * We track that DOM node to return focus to the PostPublishButtonOrToggle 23198 * when the publish sidebar has been closed. 23199 */ 23200 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSavedState, { forceIsDirty }), 23201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostViewLink, {}), 23202 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23203 PreviewDropdown, 23204 { 23205 forceIsAutosaveable: forceIsDirty, 23206 disabled: disablePreviewOption 23207 } 23208 ), 23209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23210 PostPreviewButton, 23211 { 23212 className: "editor-header__post-preview-button", 23213 forceIsAutosaveable: forceIsDirty 23214 } 23215 ), 23216 isWideViewport && canBeZoomedOut && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(zoom_out_toggle_default, { disabled: forceDisableBlockTools }), 23217 (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(pinned_items_default.Slot, { scope: "core" }), 23218 !customSaveButton && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23219 PostPublishButtonOrToggle, 23220 { 23221 forceIsDirty, 23222 setEntitiesSavedStatesCallback 23223 } 23224 ), 23225 customSaveButton, 23226 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(MoreMenu, {}) 23227 ] 23228 } 23229 ) 23230 ] }); 23231 } 23232 var header_header_default = Header; 23233 23234 23235 ;// ./node_modules/@wordpress/editor/build-module/components/inserter-sidebar/index.js 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 const { PrivateInserterLibrary } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23247 function InserterSidebar() { 23248 const { 23249 blockSectionRootClientId, 23250 inserterSidebarToggleRef, 23251 inserter, 23252 showMostUsedBlocks, 23253 sidebarIsOpened 23254 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 23255 const { 23256 getInserterSidebarToggleRef, 23257 getInserter, 23258 isPublishSidebarOpened 23259 } = unlock(select(store_store)); 23260 const { getBlockRootClientId, isZoomOut, getSectionRootClientId } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 23261 const { get } = select(external_wp_preferences_namespaceObject.store); 23262 const { getActiveComplementaryArea } = select(store); 23263 const getBlockSectionRootClientId = () => { 23264 if (isZoomOut()) { 23265 const sectionRootClientId = getSectionRootClientId(); 23266 if (sectionRootClientId) { 23267 return sectionRootClientId; 23268 } 23269 } 23270 return getBlockRootClientId(); 23271 }; 23272 return { 23273 inserterSidebarToggleRef: getInserterSidebarToggleRef(), 23274 inserter: getInserter(), 23275 showMostUsedBlocks: get("core", "mostUsedBlocks"), 23276 blockSectionRootClientId: getBlockSectionRootClientId(), 23277 sidebarIsOpened: !!(getActiveComplementaryArea("core") || isPublishSidebarOpened()) 23278 }; 23279 }, []); 23280 const { setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23281 const { disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 23282 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium", "<"); 23283 const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); 23284 const closeInserterSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => { 23285 setIsInserterOpened(false); 23286 inserterSidebarToggleRef.current?.focus(); 23287 }, [inserterSidebarToggleRef, setIsInserterOpened]); 23288 const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)( 23289 (event) => { 23290 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 23291 event.preventDefault(); 23292 closeInserterSidebar(); 23293 } 23294 }, 23295 [closeInserterSidebar] 23296 ); 23297 const inserterContents = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-inserter-sidebar__content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23298 PrivateInserterLibrary, 23299 { 23300 showMostUsedBlocks, 23301 showInserterHelpPanel: true, 23302 shouldFocusBlock: isMobileViewport, 23303 rootClientId: blockSectionRootClientId, 23304 onSelect: inserter.onSelect, 23305 __experimentalInitialTab: inserter.tab, 23306 __experimentalInitialCategory: inserter.category, 23307 __experimentalFilterValue: inserter.filterValue, 23308 onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea("core") : void 0, 23309 ref: libraryRef, 23310 onClose: closeInserterSidebar 23311 } 23312 ) }); 23313 return ( 23314 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 23315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { onKeyDown: closeOnEscape, className: "editor-inserter-sidebar", children: inserterContents }) 23316 ); 23317 } 23318 23319 23320 ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/list-view-outline.js 23321 23322 23323 23324 23325 23326 23327 23328 function ListViewOutline() { 23329 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23330 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-list-view-sidebar__outline", children: [ 23331 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 23332 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Characters:") }), 23333 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CharacterCount, {}) }) 23334 ] }), 23335 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 23336 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Words:") }), 23337 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(WordCount, {}) 23338 ] }), 23339 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { children: [ 23340 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)("Time to read:") }), 23341 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeToRead, {}) 23342 ] }) 23343 ] }), 23344 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(DocumentOutline, {}) 23345 ] }); 23346 } 23347 23348 23349 ;// ./node_modules/@wordpress/editor/build-module/components/list-view-sidebar/index.js 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 const { TabbedSidebar } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23363 function ListViewSidebar() { 23364 const { setIsListViewOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23365 const { getListViewToggleRef } = unlock((0,external_wp_data_namespaceObject.useSelect)(store_store)); 23366 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)("firstElement"); 23367 const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { 23368 setIsListViewOpened(false); 23369 getListViewToggleRef().current?.focus(); 23370 }, [getListViewToggleRef, setIsListViewOpened]); 23371 const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)( 23372 (event) => { 23373 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { 23374 event.preventDefault(); 23375 closeListView(); 23376 } 23377 }, 23378 [closeListView] 23379 ); 23380 const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); 23381 const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)("list-view"); 23382 const sidebarRef = (0,external_wp_element_namespaceObject.useRef)(); 23383 const tabsRef = (0,external_wp_element_namespaceObject.useRef)(); 23384 const listViewRef = (0,external_wp_element_namespaceObject.useRef)(); 23385 const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 23386 focusOnMountRef, 23387 listViewRef, 23388 setDropZoneElement 23389 ]); 23390 function handleSidebarFocus(currentTab) { 23391 const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabsRef.current)[0]; 23392 if (currentTab === "list-view") { 23393 const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find( 23394 listViewRef.current 23395 )[0]; 23396 const listViewFocusArea = sidebarRef.current.contains( 23397 listViewApplicationFocus 23398 ) ? listViewApplicationFocus : tabPanelFocus; 23399 listViewFocusArea.focus(); 23400 } else { 23401 tabPanelFocus.focus(); 23402 } 23403 } 23404 const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => { 23405 if (sidebarRef.current.contains( 23406 sidebarRef.current.ownerDocument.activeElement 23407 )) { 23408 closeListView(); 23409 } else { 23410 handleSidebarFocus(tab); 23411 } 23412 }, [closeListView, tab]); 23413 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)("core/editor/toggle-list-view", handleToggleListViewShortcut); 23414 return ( 23415 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 23416 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23417 "div", 23418 { 23419 className: "editor-list-view-sidebar", 23420 onKeyDown: closeOnEscape, 23421 ref: sidebarRef, 23422 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23423 TabbedSidebar, 23424 { 23425 tabs: [ 23426 { 23427 name: "list-view", 23428 title: (0,external_wp_i18n_namespaceObject._x)("List View", "Post overview"), 23429 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-panel-content", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23430 external_wp_blockEditor_namespaceObject.__experimentalListView, 23431 { 23432 dropZoneElement 23433 } 23434 ) }) }), 23435 panelRef: listViewContainerRef 23436 }, 23437 { 23438 name: "outline", 23439 title: (0,external_wp_i18n_namespaceObject._x)("Outline", "Post overview"), 23440 panel: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-list-view-sidebar__list-view-container", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewOutline, {}) }) 23441 } 23442 ], 23443 onClose: closeListView, 23444 onSelect: (tabName) => setTab(tabName), 23445 defaultTabId: "list-view", 23446 ref: tabsRef, 23447 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)("Close") 23448 } 23449 ) 23450 } 23451 ) 23452 ); 23453 } 23454 23455 23456 ;// ./node_modules/@wordpress/editor/build-module/components/save-publish-panels/index.js 23457 23458 23459 23460 23461 23462 23463 23464 23465 23466 23467 const { Fill: save_publish_panels_Fill, Slot: save_publish_panels_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)("ActionsPanel"); 23468 const ActionsPanelFill = (/* unused pure expression or super */ null && (save_publish_panels_Fill)); 23469 function SavePublishPanels({ 23470 setEntitiesSavedStatesCallback, 23471 closeEntitiesSavedStates, 23472 isEntitiesSavedStatesOpen, 23473 forceIsDirtyPublishPanel 23474 }) { 23475 const { closePublishSidebar, togglePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23476 const { 23477 publishSidebarOpened, 23478 isPublishable, 23479 isDirty, 23480 hasOtherEntitiesChanges 23481 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 23482 const { 23483 isPublishSidebarOpened, 23484 isEditedPostPublishable, 23485 isCurrentPostPublished, 23486 isEditedPostDirty, 23487 hasNonPostEntityChanges 23488 } = select(store_store); 23489 const _hasOtherEntitiesChanges = hasNonPostEntityChanges(); 23490 return { 23491 publishSidebarOpened: isPublishSidebarOpened(), 23492 isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(), 23493 isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(), 23494 hasOtherEntitiesChanges: _hasOtherEntitiesChanges 23495 }; 23496 }, []); 23497 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)( 23498 () => setEntitiesSavedStatesCallback(true), 23499 [] 23500 ); 23501 let unmountableContent; 23502 if (publishSidebarOpened) { 23503 unmountableContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23504 post_publish_panel_default, 23505 { 23506 onClose: closePublishSidebar, 23507 forceIsDirty: forceIsDirtyPublishPanel, 23508 PrePublishExtension: plugin_pre_publish_panel_default.Slot, 23509 PostPublishExtension: plugin_post_publish_panel_default.Slot 23510 } 23511 ); 23512 } else if (isPublishable && !hasOtherEntitiesChanges) { 23513 unmountableContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-layout__toggle-publish-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23514 external_wp_components_namespaceObject.Button, 23515 { 23516 __next40pxDefaultSize: true, 23517 variant: "secondary", 23518 onClick: togglePublishSidebar, 23519 "aria-expanded": false, 23520 children: (0,external_wp_i18n_namespaceObject.__)("Open publish panel") 23521 } 23522 ) }); 23523 } else { 23524 unmountableContent = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-layout__toggle-entities-saved-states-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23525 external_wp_components_namespaceObject.Button, 23526 { 23527 __next40pxDefaultSize: true, 23528 variant: "secondary", 23529 onClick: openEntitiesSavedStates, 23530 "aria-expanded": false, 23531 "aria-haspopup": "dialog", 23532 disabled: !isDirty, 23533 accessibleWhenDisabled: true, 23534 children: (0,external_wp_i18n_namespaceObject.__)("Open save panel") 23535 } 23536 ) }); 23537 } 23538 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23539 isEntitiesSavedStatesOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23540 EntitiesSavedStates, 23541 { 23542 close: closeEntitiesSavedStates, 23543 renderDialog: true 23544 } 23545 ), 23546 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(save_publish_panels_Slot, { bubblesVirtually: true }), 23547 !isEntitiesSavedStatesOpen && unmountableContent 23548 ] }); 23549 } 23550 23551 23552 ;// ./node_modules/@wordpress/editor/build-module/components/text-editor/index.js 23553 23554 23555 23556 23557 23558 23559 23560 23561 23562 function TextEditor({ autoFocus = false }) { 23563 const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 23564 const { shortcut, isRichEditingEnabled } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 23565 const { getEditorSettings } = select(store_store); 23566 const { getShortcutRepresentation } = select(external_wp_keyboardShortcuts_namespaceObject.store); 23567 return { 23568 shortcut: getShortcutRepresentation("core/editor/toggle-mode"), 23569 isRichEditingEnabled: getEditorSettings().richEditingEnabled 23570 }; 23571 }, []); 23572 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 23573 (0,external_wp_element_namespaceObject.useEffect)(() => { 23574 if (autoFocus) { 23575 return; 23576 } 23577 titleRef?.current?.focus(); 23578 }, [autoFocus]); 23579 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor", children: [ 23580 isRichEditingEnabled && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor__toolbar", children: [ 23581 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { children: (0,external_wp_i18n_namespaceObject.__)("Editing code") }), 23582 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23583 external_wp_components_namespaceObject.Button, 23584 { 23585 __next40pxDefaultSize: true, 23586 variant: "tertiary", 23587 onClick: () => switchEditorMode("visual"), 23588 shortcut, 23589 children: (0,external_wp_i18n_namespaceObject.__)("Exit code editor") 23590 } 23591 ) 23592 ] }), 23593 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-text-editor__body", children: [ 23594 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_raw_default, { ref: titleRef }), 23595 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTextEditor, {}) 23596 ] }) 23597 ] }); 23598 } 23599 23600 23601 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/edit-template-blocks-notification.js 23602 23603 23604 23605 23606 23607 23608 23609 function EditTemplateBlocksNotification({ contentRef }) { 23610 const { onNavigateToEntityRecord, templateId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 23611 const { getEditorSettings, getCurrentTemplateId } = select(store_store); 23612 return { 23613 onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord, 23614 templateId: getCurrentTemplateId() 23615 }; 23616 }, []); 23617 const canEditTemplate = (0,external_wp_data_namespaceObject.useSelect)( 23618 (select) => !!select(external_wp_coreData_namespaceObject.store).canUser("create", { 23619 kind: "postType", 23620 name: "wp_template" 23621 }), 23622 [] 23623 ); 23624 const [isDialogOpen, setIsDialogOpen] = (0,external_wp_element_namespaceObject.useState)(false); 23625 (0,external_wp_element_namespaceObject.useEffect)(() => { 23626 const handleDblClick = (event) => { 23627 if (!canEditTemplate) { 23628 return; 23629 } 23630 if (!event.target.classList.contains("is-root-container") || event.target.dataset?.type === "core/template-part") { 23631 return; 23632 } 23633 if (!event.defaultPrevented) { 23634 event.preventDefault(); 23635 setIsDialogOpen(true); 23636 } 23637 }; 23638 const canvas = contentRef.current; 23639 canvas?.addEventListener("dblclick", handleDblClick); 23640 return () => { 23641 canvas?.removeEventListener("dblclick", handleDblClick); 23642 }; 23643 }, [contentRef, canEditTemplate]); 23644 if (!canEditTemplate) { 23645 return null; 23646 } 23647 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23648 external_wp_components_namespaceObject.__experimentalConfirmDialog, 23649 { 23650 isOpen: isDialogOpen, 23651 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Edit template"), 23652 onConfirm: () => { 23653 setIsDialogOpen(false); 23654 onNavigateToEntityRecord({ 23655 postId: templateId, 23656 postType: "wp_template" 23657 }); 23658 }, 23659 onCancel: () => setIsDialogOpen(false), 23660 size: "medium", 23661 children: (0,external_wp_i18n_namespaceObject.__)( 23662 "You\u2019ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?" 23663 ) 23664 } 23665 ); 23666 } 23667 23668 23669 ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/resize-handle.js 23670 23671 23672 23673 23674 const DELTA_DISTANCE = 20; 23675 function ResizeHandle({ direction, resizeWidthBy }) { 23676 function handleKeyDown(event) { 23677 const { keyCode } = event; 23678 if (keyCode !== external_wp_keycodes_namespaceObject.LEFT && keyCode !== external_wp_keycodes_namespaceObject.RIGHT) { 23679 return; 23680 } 23681 event.preventDefault(); 23682 if (direction === "left" && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === "right" && keyCode === external_wp_keycodes_namespaceObject.RIGHT) { 23683 resizeWidthBy(DELTA_DISTANCE); 23684 } else if (direction === "left" && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === "right" && keyCode === external_wp_keycodes_namespaceObject.LEFT) { 23685 resizeWidthBy(-DELTA_DISTANCE); 23686 } 23687 } 23688 const resizeHandleVariants = { 23689 active: { 23690 opacity: 1, 23691 scaleY: 1.3 23692 } 23693 }; 23694 const resizableHandleHelpId = `resizable-editor__resize-help-$direction}`; 23695 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 23696 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23697 external_wp_components_namespaceObject.__unstableMotion.button, 23698 { 23699 className: `editor-resizable-editor__resize-handle is-$direction}`, 23700 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Drag to resize"), 23701 "aria-describedby": resizableHandleHelpId, 23702 onKeyDown: handleKeyDown, 23703 variants: resizeHandleVariants, 23704 whileFocus: "active", 23705 whileHover: "active", 23706 whileTap: "active", 23707 role: "separator", 23708 "aria-orientation": "vertical" 23709 }, 23710 "handle" 23711 ) }), 23712 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { id: resizableHandleHelpId, children: (0,external_wp_i18n_namespaceObject.__)("Use left and right arrow keys to resize the canvas.") }) 23713 ] }); 23714 } 23715 23716 23717 ;// ./node_modules/@wordpress/editor/build-module/components/resizable-editor/index.js 23718 23719 23720 23721 23722 23723 const HANDLE_STYLES_OVERRIDE = { 23724 position: void 0, 23725 userSelect: void 0, 23726 cursor: void 0, 23727 width: void 0, 23728 height: void 0, 23729 top: void 0, 23730 right: void 0, 23731 bottom: void 0, 23732 left: void 0 23733 }; 23734 function ResizableEditor({ className, enableResizing, height, children }) { 23735 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)("100%"); 23736 const resizableRef = (0,external_wp_element_namespaceObject.useRef)(); 23737 const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)((deltaPixels) => { 23738 if (resizableRef.current) { 23739 setWidth(resizableRef.current.offsetWidth + deltaPixels); 23740 } 23741 }, []); 23742 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23743 external_wp_components_namespaceObject.ResizableBox, 23744 { 23745 className: dist_clsx("editor-resizable-editor", className, { 23746 "is-resizable": enableResizing 23747 }), 23748 ref: (api) => { 23749 resizableRef.current = api?.resizable; 23750 }, 23751 size: { 23752 width: enableResizing ? width : "100%", 23753 height: enableResizing && height ? height : "100%" 23754 }, 23755 onResizeStop: (event, direction, element) => { 23756 setWidth(element.style.width); 23757 }, 23758 minWidth: 300, 23759 maxWidth: "100%", 23760 maxHeight: "100%", 23761 enable: { 23762 left: enableResizing, 23763 right: enableResizing 23764 }, 23765 showHandle: enableResizing, 23766 resizeRatio: 2, 23767 handleComponent: { 23768 left: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23769 ResizeHandle, 23770 { 23771 direction: "left", 23772 resizeWidthBy 23773 } 23774 ), 23775 right: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 23776 ResizeHandle, 23777 { 23778 direction: "right", 23779 resizeWidthBy 23780 } 23781 ) 23782 }, 23783 handleClasses: void 0, 23784 handleStyles: { 23785 left: HANDLE_STYLES_OVERRIDE, 23786 right: HANDLE_STYLES_OVERRIDE 23787 }, 23788 children 23789 } 23790 ); 23791 } 23792 var resizable_editor_default = ResizableEditor; 23793 23794 23795 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-select-nearest-editable-block.js 23796 23797 23798 23799 23800 const DISTANCE_THRESHOLD = 500; 23801 function use_select_nearest_editable_block_clamp(value, min, max) { 23802 return Math.min(Math.max(value, min), max); 23803 } 23804 function distanceFromRect(x, y, rect) { 23805 const dx = x - use_select_nearest_editable_block_clamp(x, rect.left, rect.right); 23806 const dy = y - use_select_nearest_editable_block_clamp(y, rect.top, rect.bottom); 23807 return Math.sqrt(dx * dx + dy * dy); 23808 } 23809 function useSelectNearestEditableBlock({ 23810 isEnabled = true 23811 } = {}) { 23812 const { getEnabledClientIdsTree, getBlockName, getBlockOrder } = unlock( 23813 (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store) 23814 ); 23815 const { selectBlock } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 23816 return (0,external_wp_compose_namespaceObject.useRefEffect)( 23817 (element) => { 23818 if (!isEnabled) { 23819 return; 23820 } 23821 const selectNearestEditableBlock = (x, y) => { 23822 const editableBlockClientIds = getEnabledClientIdsTree().flatMap(({ clientId }) => { 23823 const blockName = getBlockName(clientId); 23824 if (blockName === "core/template-part") { 23825 return []; 23826 } 23827 if (blockName === "core/post-content") { 23828 const innerBlocks = getBlockOrder(clientId); 23829 if (innerBlocks.length) { 23830 return innerBlocks; 23831 } 23832 } 23833 return [clientId]; 23834 }); 23835 let nearestDistance = Infinity, nearestClientId = null; 23836 for (const clientId of editableBlockClientIds) { 23837 const block = element.querySelector( 23838 `[data-block="$clientId}"]` 23839 ); 23840 if (!block) { 23841 continue; 23842 } 23843 const rect = block.getBoundingClientRect(); 23844 const distance = distanceFromRect(x, y, rect); 23845 if (distance < nearestDistance && distance < DISTANCE_THRESHOLD) { 23846 nearestDistance = distance; 23847 nearestClientId = clientId; 23848 } 23849 } 23850 if (nearestClientId) { 23851 selectBlock(nearestClientId); 23852 } 23853 }; 23854 const handleClick = (event) => { 23855 const shouldSelect = event.target === element || event.target.classList.contains("is-root-container"); 23856 if (shouldSelect) { 23857 selectNearestEditableBlock(event.clientX, event.clientY); 23858 } 23859 }; 23860 element.addEventListener("click", handleClick); 23861 return () => element.removeEventListener("click", handleClick); 23862 }, 23863 [isEnabled] 23864 ); 23865 } 23866 23867 23868 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/use-zoom-out-mode-exit.js 23869 23870 23871 23872 23873 function useZoomOutModeExit() { 23874 const { getSettings, isZoomOut } = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store)); 23875 const { resetZoomLevel } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 23876 return (0,external_wp_compose_namespaceObject.useRefEffect)( 23877 (node) => { 23878 function onDoubleClick(event) { 23879 if (!isZoomOut()) { 23880 return; 23881 } 23882 if (!event.defaultPrevented) { 23883 event.preventDefault(); 23884 const { __experimentalSetIsInserterOpened } = getSettings(); 23885 if (typeof __experimentalSetIsInserterOpened === "function") { 23886 __experimentalSetIsInserterOpened(false); 23887 } 23888 resetZoomLevel(); 23889 } 23890 } 23891 node.addEventListener("dblclick", onDoubleClick); 23892 return () => { 23893 node.removeEventListener("dblclick", onDoubleClick); 23894 }; 23895 }, 23896 [getSettings, isZoomOut, resetZoomLevel] 23897 ); 23898 } 23899 23900 23901 ;// ./node_modules/@wordpress/editor/build-module/components/visual-editor/index.js 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 const { 23919 LayoutStyle, 23920 useLayoutClasses, 23921 useLayoutStyles, 23922 ExperimentalBlockCanvas: BlockCanvas, 23923 useFlashEditableBlocks 23924 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 23925 const visual_editor_DESIGN_POST_TYPES = [ 23926 PATTERN_POST_TYPE, 23927 TEMPLATE_POST_TYPE, 23928 NAVIGATION_POST_TYPE, 23929 TEMPLATE_PART_POST_TYPE 23930 ]; 23931 function getPostContentAttributes(blocks) { 23932 for (let i = 0; i < blocks.length; i++) { 23933 if (blocks[i].name === "core/post-content") { 23934 return blocks[i].attributes; 23935 } 23936 if (blocks[i].innerBlocks.length) { 23937 const nestedPostContent = getPostContentAttributes( 23938 blocks[i].innerBlocks 23939 ); 23940 if (nestedPostContent) { 23941 return nestedPostContent; 23942 } 23943 } 23944 } 23945 } 23946 function checkForPostContentAtRootLevel(blocks) { 23947 for (let i = 0; i < blocks.length; i++) { 23948 if (blocks[i].name === "core/post-content") { 23949 return true; 23950 } 23951 } 23952 return false; 23953 } 23954 function VisualEditor({ 23955 // Ideally as we unify post and site editors, we won't need these props. 23956 autoFocus, 23957 styles, 23958 disableIframe = false, 23959 iframeProps, 23960 contentRef, 23961 className 23962 }) { 23963 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("small", "<"); 23964 const { 23965 renderingMode, 23966 postContentAttributes, 23967 editedPostTemplate = {}, 23968 wrapperBlockName, 23969 wrapperUniqueId, 23970 deviceType, 23971 isFocusedEntity, 23972 isDesignPostType, 23973 postType, 23974 isPreview, 23975 canvasMinHeight 23976 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 23977 const { 23978 getCurrentPostId, 23979 getCurrentPostType, 23980 getCurrentTemplateId, 23981 getEditorSettings, 23982 getRenderingMode, 23983 getDeviceType, 23984 getCanvasMinHeight 23985 } = unlock(select(store_store)); 23986 const { getPostType, getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 23987 const postTypeSlug = getCurrentPostType(); 23988 const _renderingMode = getRenderingMode(); 23989 let _wrapperBlockName; 23990 if (postTypeSlug === PATTERN_POST_TYPE) { 23991 _wrapperBlockName = "core/block"; 23992 } else if (_renderingMode === "post-only") { 23993 _wrapperBlockName = "core/post-content"; 23994 } 23995 const editorSettings = getEditorSettings(); 23996 const supportsTemplateMode = editorSettings.supportsTemplateMode; 23997 const postTypeObject = getPostType(postTypeSlug); 23998 const currentTemplateId = getCurrentTemplateId(); 23999 const template = currentTemplateId ? getEditedEntityRecord( 24000 "postType", 24001 TEMPLATE_POST_TYPE, 24002 currentTemplateId 24003 ) : void 0; 24004 return { 24005 renderingMode: _renderingMode, 24006 postContentAttributes: editorSettings.postContentAttributes, 24007 isDesignPostType: visual_editor_DESIGN_POST_TYPES.includes(postTypeSlug), 24008 // Post template fetch returns a 404 on classic themes, which 24009 // messes with e2e tests, so check it's a block theme first. 24010 editedPostTemplate: postTypeObject?.viewable && supportsTemplateMode ? template : void 0, 24011 wrapperBlockName: _wrapperBlockName, 24012 wrapperUniqueId: getCurrentPostId(), 24013 deviceType: getDeviceType(), 24014 isFocusedEntity: !!editorSettings.onNavigateToPreviousEntityRecord, 24015 postType: postTypeSlug, 24016 isPreview: editorSettings.isPreviewMode, 24017 canvasMinHeight: getCanvasMinHeight() 24018 }; 24019 }, []); 24020 const { isCleanNewPost } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 24021 const { 24022 hasRootPaddingAwareAlignments, 24023 themeHasDisabledLayoutStyles, 24024 themeSupportsLayout, 24025 isZoomedOut 24026 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 24027 const { getSettings, isZoomOut: _isZoomOut } = unlock( 24028 select(external_wp_blockEditor_namespaceObject.store) 24029 ); 24030 const _settings = getSettings(); 24031 return { 24032 themeHasDisabledLayoutStyles: _settings.disableLayoutStyles, 24033 themeSupportsLayout: _settings.supportsLayout, 24034 hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments, 24035 isZoomedOut: _isZoomOut() 24036 }; 24037 }, []); 24038 const localRef = (0,external_wp_element_namespaceObject.useRef)(); 24039 const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType); 24040 const [globalLayoutSettings] = (0,external_wp_blockEditor_namespaceObject.useSettings)("layout"); 24041 const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 24042 if (renderingMode !== "post-only" || isDesignPostType) { 24043 return { type: "default" }; 24044 } 24045 if (themeSupportsLayout) { 24046 return { ...globalLayoutSettings, type: "constrained" }; 24047 } 24048 return { type: "default" }; 24049 }, [ 24050 renderingMode, 24051 themeSupportsLayout, 24052 globalLayoutSettings, 24053 isDesignPostType 24054 ]); 24055 const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { 24056 if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) { 24057 return postContentAttributes; 24058 } 24059 if (editedPostTemplate?.blocks) { 24060 return getPostContentAttributes(editedPostTemplate?.blocks); 24061 } 24062 const parseableContent = typeof editedPostTemplate?.content === "string" ? editedPostTemplate?.content : ""; 24063 return getPostContentAttributes((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {}; 24064 }, [ 24065 editedPostTemplate?.content, 24066 editedPostTemplate?.blocks, 24067 postContentAttributes 24068 ]); 24069 const hasPostContentAtRootLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { 24070 if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { 24071 return false; 24072 } 24073 if (editedPostTemplate?.blocks) { 24074 return checkForPostContentAtRootLevel(editedPostTemplate?.blocks); 24075 } 24076 const parseableContent = typeof editedPostTemplate?.content === "string" ? editedPostTemplate?.content : ""; 24077 return checkForPostContentAtRootLevel((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || false; 24078 }, [editedPostTemplate?.content, editedPostTemplate?.blocks]); 24079 const { layout = {}, align = "" } = newestPostContentAttributes || {}; 24080 const postContentLayoutClasses = useLayoutClasses( 24081 newestPostContentAttributes, 24082 "core/post-content" 24083 ); 24084 const blockListLayoutClass = dist_clsx( 24085 { 24086 "is-layout-flow": !themeSupportsLayout 24087 }, 24088 themeSupportsLayout && postContentLayoutClasses, 24089 align && `align$align}` 24090 ); 24091 const postContentLayoutStyles = useLayoutStyles( 24092 newestPostContentAttributes, 24093 "core/post-content", 24094 ".block-editor-block-list__layout.is-root-container" 24095 ); 24096 const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { 24097 return layout && (layout?.type === "constrained" || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { ...globalLayoutSettings, ...layout, type: "constrained" } : { ...globalLayoutSettings, ...layout, type: "default" }; 24098 }, [ 24099 layout?.type, 24100 layout?.inherit, 24101 layout?.contentSize, 24102 layout?.wideSize, 24103 globalLayoutSettings 24104 ]); 24105 const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout; 24106 const postEditorLayout = blockListLayout?.type === "default" && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout; 24107 const observeTypingRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(); 24108 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 24109 (0,external_wp_element_namespaceObject.useEffect)(() => { 24110 if (!autoFocus || !isCleanNewPost()) { 24111 return; 24112 } 24113 titleRef?.current?.focus(); 24114 }, [autoFocus, isCleanNewPost]); 24115 const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;} 24116 .is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);} 24117 .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} 24118 .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; 24119 const enableResizing = [ 24120 NAVIGATION_POST_TYPE, 24121 TEMPLATE_PART_POST_TYPE, 24122 PATTERN_POST_TYPE 24123 ].includes(postType) && // Disable in previews / view mode. 24124 !isPreview && // Disable resizing in mobile viewport. 24125 !isMobileViewport && // Disable resizing in zoomed-out mode. 24126 !isZoomedOut; 24127 const calculatedMinHeight = (0,external_wp_element_namespaceObject.useMemo)(() => { 24128 if (!localRef.current) { 24129 return canvasMinHeight; 24130 } 24131 const { ownerDocument } = localRef.current; 24132 const scrollTop = ownerDocument.documentElement.scrollTop || ownerDocument.body.scrollTop; 24133 return canvasMinHeight + scrollTop; 24134 }, [canvasMinHeight]); 24135 const iframeStyles = (0,external_wp_element_namespaceObject.useMemo)(() => { 24136 return [ 24137 ...styles ?? [], 24138 { 24139 // Ensures margins of children are contained so that the body background paints behind them. 24140 // Otherwise, the background of html (when zoomed out) would show there and appear broken. It's 24141 // important mostly for post-only views yet conceivably an issue in templated views too. 24142 css: `:where(.block-editor-iframe__body){display:flow-root;$calculatedMinHeight ? `min-height:$calculatedMinHeight}px;` : ""}}.is-root-container{display:flow-root;${// Some themes will have `min-height: 100vh` for the root container, 24143 // which isn't a requirement in auto resize mode. 24144 enableResizing ? "min-height:0!important;" : ""}} 24145 $enableResizing ? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}` : ""}` 24146 // The CSS above centers the body content vertically when resizing is enabled and applies a background 24147 // color to the iframe HTML element to match the background color of the editor canvas. 24148 } 24149 ]; 24150 }, [styles, enableResizing, calculatedMinHeight]); 24151 const typewriterRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(); 24152 contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ 24153 localRef, 24154 contentRef, 24155 renderingMode === "post-only" ? typewriterRef : null, 24156 useFlashEditableBlocks({ 24157 isEnabled: renderingMode === "template-locked" 24158 }), 24159 useSelectNearestEditableBlock({ 24160 isEnabled: renderingMode === "template-locked" 24161 }), 24162 useZoomOutModeExit() 24163 ]); 24164 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24165 "div", 24166 { 24167 className: dist_clsx( 24168 "editor-visual-editor", 24169 // this class is here for backward compatibility reasons. 24170 "edit-post-visual-editor", 24171 className, 24172 { 24173 "has-padding": isFocusedEntity || enableResizing, 24174 "is-resizable": enableResizing, 24175 "is-iframed": !disableIframe 24176 } 24177 ), 24178 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(resizable_editor_default, { enableResizing, height: "100%", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 24179 BlockCanvas, 24180 { 24181 shouldIframe: !disableIframe, 24182 contentRef, 24183 styles: iframeStyles, 24184 height: "100%", 24185 iframeProps: { 24186 ...iframeProps, 24187 style: { 24188 ...iframeProps?.style, 24189 ...deviceStyles 24190 } 24191 }, 24192 children: [ 24193 themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === "post-only" && !isDesignPostType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24194 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24195 LayoutStyle, 24196 { 24197 selector: ".editor-visual-editor__post-title-wrapper", 24198 layout: fallbackLayout 24199 } 24200 ), 24201 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24202 LayoutStyle, 24203 { 24204 selector: ".block-editor-block-list__layout.is-root-container", 24205 layout: postEditorLayout 24206 } 24207 ), 24208 align && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(LayoutStyle, { css: alignCSS }), 24209 postContentLayoutStyles && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24210 LayoutStyle, 24211 { 24212 layout: postContentLayout, 24213 css: postContentLayoutStyles 24214 } 24215 ) 24216 ] }), 24217 renderingMode === "post-only" && !isDesignPostType && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24218 "div", 24219 { 24220 className: dist_clsx( 24221 "editor-visual-editor__post-title-wrapper", 24222 // The following class is only here for backward compatibility 24223 // some themes might be using it to style the post title. 24224 "edit-post-visual-editor__post-title-wrapper", 24225 { 24226 "has-global-padding": hasRootPaddingAwareAlignments 24227 } 24228 ), 24229 contentEditable: false, 24230 ref: observeTypingRef, 24231 style: { 24232 // This is using inline styles 24233 // so it's applied for both iframed and non iframed editors. 24234 marginTop: "4rem" 24235 }, 24236 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_title_default, { ref: titleRef }) 24237 } 24238 ), 24239 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 24240 external_wp_blockEditor_namespaceObject.RecursionProvider, 24241 { 24242 blockName: wrapperBlockName, 24243 uniqueId: wrapperUniqueId, 24244 children: [ 24245 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24246 external_wp_blockEditor_namespaceObject.BlockList, 24247 { 24248 className: dist_clsx( 24249 "is-" + deviceType.toLowerCase() + "-preview", 24250 renderingMode !== "post-only" || isDesignPostType ? "wp-site-blocks" : `$blockListLayoutClass} wp-block-post-content`, 24251 // Ensure root level blocks receive default/flow blockGap styling rules. 24252 { 24253 "has-global-padding": renderingMode === "post-only" && !isDesignPostType && hasRootPaddingAwareAlignments 24254 } 24255 ), 24256 layout: blockListLayout, 24257 dropZoneElement: ( 24258 // When iframed, pass in the html element of the iframe to 24259 // ensure the drop zone extends to the edges of the iframe. 24260 disableIframe ? localRef.current : localRef.current?.parentNode 24261 ), 24262 __unstableDisableDropZone: ( 24263 // In template preview mode, disable drop zones at the root of the template. 24264 renderingMode === "template-locked" ? true : false 24265 ) 24266 } 24267 ), 24268 renderingMode === "template-locked" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24269 EditTemplateBlocksNotification, 24270 { 24271 contentRef: localRef 24272 } 24273 ) 24274 ] 24275 } 24276 ) 24277 ] 24278 } 24279 ) }) 24280 } 24281 ); 24282 } 24283 var visual_editor_default = VisualEditor; 24284 24285 24286 ;// ./node_modules/@wordpress/editor/build-module/components/editor-interface/index.js 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 const interfaceLabels = { 24306 /* translators: accessibility text for the editor top bar landmark region. */ 24307 header: (0,external_wp_i18n_namespaceObject.__)("Editor top bar"), 24308 /* translators: accessibility text for the editor content landmark region. */ 24309 body: (0,external_wp_i18n_namespaceObject.__)("Editor content"), 24310 /* translators: accessibility text for the editor settings landmark region. */ 24311 sidebar: (0,external_wp_i18n_namespaceObject.__)("Editor settings"), 24312 /* translators: accessibility text for the editor publish landmark region. */ 24313 actions: (0,external_wp_i18n_namespaceObject.__)("Editor publish"), 24314 /* translators: accessibility text for the editor footer landmark region. */ 24315 footer: (0,external_wp_i18n_namespaceObject.__)("Editor footer") 24316 }; 24317 function EditorInterface({ 24318 className, 24319 styles, 24320 children, 24321 forceIsDirty, 24322 contentRef, 24323 disableIframe, 24324 autoFocus, 24325 customSaveButton, 24326 customSavePanel, 24327 forceDisableBlockTools, 24328 title, 24329 iframeProps 24330 }) { 24331 const { 24332 mode, 24333 isInserterOpened, 24334 isListViewOpened, 24335 isDistractionFree, 24336 isPreviewMode, 24337 showBlockBreadcrumbs, 24338 documentLabel 24339 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 24340 const { get } = select(external_wp_preferences_namespaceObject.store); 24341 const { getEditorSettings, getPostTypeLabel } = select(store_store); 24342 const editorSettings = getEditorSettings(); 24343 const postTypeLabel = getPostTypeLabel(); 24344 let _mode = select(store_store).getEditorMode(); 24345 if (!editorSettings.richEditingEnabled && _mode === "visual") { 24346 _mode = "text"; 24347 } 24348 if (!editorSettings.codeEditingEnabled && _mode === "text") { 24349 _mode = "visual"; 24350 } 24351 return { 24352 mode: _mode, 24353 isInserterOpened: select(store_store).isInserterOpened(), 24354 isListViewOpened: select(store_store).isListViewOpened(), 24355 isDistractionFree: get("core", "distractionFree"), 24356 isPreviewMode: editorSettings.isPreviewMode, 24357 showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"), 24358 documentLabel: ( 24359 // translators: Default label for the Document in the Block Breadcrumb. 24360 postTypeLabel || (0,external_wp_i18n_namespaceObject._x)("Document", "noun, breadcrumb") 24361 ) 24362 }; 24363 }, []); 24364 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); 24365 const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)("Document Overview") : (0,external_wp_i18n_namespaceObject.__)("Block Library"); 24366 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); 24367 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)( 24368 (arg) => { 24369 if (typeof entitiesSavedStatesCallback === "function") { 24370 entitiesSavedStatesCallback(arg); 24371 } 24372 setEntitiesSavedStatesCallback(false); 24373 }, 24374 [entitiesSavedStatesCallback] 24375 ); 24376 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24377 interface_skeleton_default, 24378 { 24379 isDistractionFree, 24380 className: dist_clsx("editor-editor-interface", className, { 24381 "is-entity-save-view-open": !!entitiesSavedStatesCallback, 24382 "is-distraction-free": isDistractionFree && !isPreviewMode 24383 }), 24384 labels: { 24385 ...interfaceLabels, 24386 secondarySidebar: secondarySidebarLabel 24387 }, 24388 header: !isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24389 header_header_default, 24390 { 24391 forceIsDirty, 24392 setEntitiesSavedStatesCallback, 24393 customSaveButton, 24394 forceDisableBlockTools, 24395 title 24396 } 24397 ), 24398 editorNotices: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices_default, {}), 24399 secondarySidebar: !isPreviewMode && mode === "visual" && (isInserterOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(InserterSidebar, {}) || isListViewOpened && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(ListViewSidebar, {})), 24400 sidebar: !isPreviewMode && !isDistractionFree && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(complementary_area_default.Slot, { scope: "core" }), 24401 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24402 !isDistractionFree && !isPreviewMode && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(editor_notices_default, {}), 24403 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(content_slot_fill_default.Slot, { children: ([editorCanvasView]) => editorCanvasView ? editorCanvasView : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24404 !isPreviewMode && mode === "text" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24405 TextEditor, 24406 { 24407 autoFocus 24408 } 24409 ), 24410 !isPreviewMode && !isLargeViewport && mode === "visual" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockToolbar, { hideDragHandle: true }), 24411 (isPreviewMode || mode === "visual") && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24412 visual_editor_default, 24413 { 24414 styles, 24415 contentRef, 24416 disableIframe, 24417 autoFocus, 24418 iframeProps 24419 } 24420 ), 24421 children 24422 ] }) }) 24423 ] }), 24424 footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && mode === "visual" && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { rootLabelText: documentLabel }), 24425 actions: !isPreviewMode ? customSavePanel || /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24426 SavePublishPanels, 24427 { 24428 closeEntitiesSavedStates, 24429 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, 24430 setEntitiesSavedStatesCallback, 24431 forceIsDirtyPublishPanel: forceIsDirty 24432 } 24433 ) : void 0 24434 } 24435 ); 24436 } 24437 24438 24439 ;// ./node_modules/@wordpress/editor/build-module/components/pattern-overrides-panel/index.js 24440 24441 24442 24443 24444 24445 const { OverridesPanel } = unlock(external_wp_patterns_namespaceObject.privateApis); 24446 function PatternOverridesPanel() { 24447 const supportsPatternOverridesPanel = (0,external_wp_data_namespaceObject.useSelect)( 24448 (select) => select(store_store).getCurrentPostType() === "wp_block", 24449 [] 24450 ); 24451 if (!supportsPatternOverridesPanel) { 24452 return null; 24453 } 24454 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(OverridesPanel, {}); 24455 } 24456 24457 24458 ;// ./node_modules/@wordpress/editor/build-module/utils/get-item-title.js 24459 24460 function get_item_title_getItemTitle(item) { 24461 if (typeof item.title === "string") { 24462 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title); 24463 } 24464 if (item.title && "rendered" in item.title) { 24465 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.rendered); 24466 } 24467 if (item.title && "raw" in item.title) { 24468 return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(item.title.raw); 24469 } 24470 return ""; 24471 } 24472 24473 24474 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-homepage.js 24475 24476 24477 24478 24479 24480 24481 24482 24483 const SetAsHomepageModal = ({ items, closeModal }) => { 24484 const [item] = items; 24485 const pageTitle = get_item_title_getItemTitle(item); 24486 const { showOnFront, currentHomePage, isSaving } = (0,external_wp_data_namespaceObject.useSelect)( 24487 (select) => { 24488 const { getEntityRecord, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); 24489 const siteSettings = getEntityRecord("root", "site"); 24490 const currentHomePageItem = getEntityRecord( 24491 "postType", 24492 "page", 24493 siteSettings?.page_on_front 24494 ); 24495 return { 24496 showOnFront: siteSettings?.show_on_front, 24497 currentHomePage: currentHomePageItem, 24498 isSaving: isSavingEntityRecord("root", "site") 24499 }; 24500 } 24501 ); 24502 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 24503 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24504 async function onSetPageAsHomepage(event) { 24505 event.preventDefault(); 24506 try { 24507 await saveEntityRecord("root", "site", { 24508 page_on_front: item.id, 24509 show_on_front: "page" 24510 }); 24511 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Homepage updated."), { 24512 type: "snackbar" 24513 }); 24514 } catch (error) { 24515 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while setting the homepage."); 24516 createErrorNotice(errorMessage, { type: "snackbar" }); 24517 } finally { 24518 closeModal?.(); 24519 } 24520 } 24521 let modalWarning = ""; 24522 if ("posts" === showOnFront) { 24523 modalWarning = (0,external_wp_i18n_namespaceObject.__)( 24524 "This will replace the current homepage which is set to display latest posts." 24525 ); 24526 } else if (currentHomePage) { 24527 modalWarning = (0,external_wp_i18n_namespaceObject.sprintf)( 24528 // translators: %s: title of the current home page. 24529 (0,external_wp_i18n_namespaceObject.__)('This will replace the current homepage: "%s"'), 24530 get_item_title_getItemTitle(currentHomePage) 24531 ); 24532 } 24533 const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( 24534 // translators: %1$s: title of the page to be set as the homepage, %2$s: homepage replacement warning message. 24535 (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the site homepage? %2$s'), 24536 pageTitle, 24537 modalWarning 24538 ).trim(); 24539 const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)("Set homepage"); 24540 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSetPageAsHomepage, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 24541 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: modalText }), 24542 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 24543 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24544 external_wp_components_namespaceObject.Button, 24545 { 24546 __next40pxDefaultSize: true, 24547 variant: "tertiary", 24548 onClick: () => { 24549 closeModal?.(); 24550 }, 24551 disabled: isSaving, 24552 accessibleWhenDisabled: true, 24553 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 24554 } 24555 ), 24556 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24557 external_wp_components_namespaceObject.Button, 24558 { 24559 __next40pxDefaultSize: true, 24560 variant: "primary", 24561 type: "submit", 24562 disabled: isSaving, 24563 accessibleWhenDisabled: true, 24564 children: modalButtonLabel 24565 } 24566 ) 24567 ] }) 24568 ] }) }); 24569 }; 24570 const useSetAsHomepageAction = () => { 24571 const { pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 24572 const { getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 24573 const siteSettings = canUser("read", { 24574 kind: "root", 24575 name: "site" 24576 }) ? getEntityRecord("root", "site") : void 0; 24577 return { 24578 pageOnFront: siteSettings?.page_on_front, 24579 pageForPosts: siteSettings?.page_for_posts 24580 }; 24581 }); 24582 return (0,external_wp_element_namespaceObject.useMemo)( 24583 () => ({ 24584 id: "set-as-homepage", 24585 label: (0,external_wp_i18n_namespaceObject.__)("Set as homepage"), 24586 isEligible(post) { 24587 if (post.status !== "publish") { 24588 return false; 24589 } 24590 if (post.type !== "page") { 24591 return false; 24592 } 24593 if (pageOnFront === post.id) { 24594 return false; 24595 } 24596 if (pageForPosts === post.id) { 24597 return false; 24598 } 24599 return true; 24600 }, 24601 modalFocusOnMount: "firstContentElement", 24602 RenderModal: SetAsHomepageModal 24603 }), 24604 [pageForPosts, pageOnFront] 24605 ); 24606 }; 24607 24608 24609 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/set-as-posts-page.js 24610 24611 24612 24613 24614 24615 24616 24617 24618 const SetAsPostsPageModal = ({ items, closeModal }) => { 24619 const [item] = items; 24620 const pageTitle = get_item_title_getItemTitle(item); 24621 const { currentPostsPage, isPageForPostsSet, isSaving } = (0,external_wp_data_namespaceObject.useSelect)( 24622 (select) => { 24623 const { getEntityRecord, isSavingEntityRecord } = select(external_wp_coreData_namespaceObject.store); 24624 const siteSettings = getEntityRecord("root", "site"); 24625 const currentPostsPageItem = getEntityRecord( 24626 "postType", 24627 "page", 24628 siteSettings?.page_for_posts 24629 ); 24630 return { 24631 currentPostsPage: currentPostsPageItem, 24632 isPageForPostsSet: siteSettings?.page_for_posts !== 0, 24633 isSaving: isSavingEntityRecord("root", "site") 24634 }; 24635 } 24636 ); 24637 const { saveEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 24638 const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 24639 async function onSetPageAsPostsPage(event) { 24640 event.preventDefault(); 24641 try { 24642 await saveEntityRecord("root", "site", { 24643 page_for_posts: item.id, 24644 show_on_front: "page" 24645 }); 24646 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Posts page updated."), { 24647 type: "snackbar" 24648 }); 24649 } catch (error) { 24650 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while setting the posts page."); 24651 createErrorNotice(errorMessage, { type: "snackbar" }); 24652 } finally { 24653 closeModal?.(); 24654 } 24655 } 24656 const modalWarning = isPageForPostsSet && currentPostsPage ? (0,external_wp_i18n_namespaceObject.sprintf)( 24657 // translators: %s: title of the current posts page. 24658 (0,external_wp_i18n_namespaceObject.__)('This will replace the current posts page: "%s"'), 24659 get_item_title_getItemTitle(currentPostsPage) 24660 ) : (0,external_wp_i18n_namespaceObject.__)("This page will show the latest posts."); 24661 const modalText = (0,external_wp_i18n_namespaceObject.sprintf)( 24662 // translators: %1$s: title of the page to be set as the posts page, %2$s: posts page replacement warning message. 24663 (0,external_wp_i18n_namespaceObject.__)('Set "%1$s" as the posts page? %2$s'), 24664 pageTitle, 24665 modalWarning 24666 ); 24667 const modalButtonLabel = (0,external_wp_i18n_namespaceObject.__)("Set posts page"); 24668 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSetPageAsPostsPage, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [ 24669 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: modalText }), 24670 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [ 24671 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24672 external_wp_components_namespaceObject.Button, 24673 { 24674 __next40pxDefaultSize: true, 24675 variant: "tertiary", 24676 onClick: () => { 24677 closeModal?.(); 24678 }, 24679 disabled: isSaving, 24680 accessibleWhenDisabled: true, 24681 children: (0,external_wp_i18n_namespaceObject.__)("Cancel") 24682 } 24683 ), 24684 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24685 external_wp_components_namespaceObject.Button, 24686 { 24687 __next40pxDefaultSize: true, 24688 variant: "primary", 24689 type: "submit", 24690 disabled: isSaving, 24691 accessibleWhenDisabled: true, 24692 children: modalButtonLabel 24693 } 24694 ) 24695 ] }) 24696 ] }) }); 24697 }; 24698 const useSetAsPostsPageAction = () => { 24699 const { pageOnFront, pageForPosts } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 24700 const { getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 24701 const siteSettings = canUser("read", { 24702 kind: "root", 24703 name: "site" 24704 }) ? getEntityRecord("root", "site") : void 0; 24705 return { 24706 pageOnFront: siteSettings?.page_on_front, 24707 pageForPosts: siteSettings?.page_for_posts 24708 }; 24709 }); 24710 return (0,external_wp_element_namespaceObject.useMemo)( 24711 () => ({ 24712 id: "set-as-posts-page", 24713 label: (0,external_wp_i18n_namespaceObject.__)("Set as posts page"), 24714 isEligible(post) { 24715 if (post.status !== "publish") { 24716 return false; 24717 } 24718 if (post.type !== "page") { 24719 return false; 24720 } 24721 if (pageOnFront === post.id) { 24722 return false; 24723 } 24724 if (pageForPosts === post.id) { 24725 return false; 24726 } 24727 return true; 24728 }, 24729 modalFocusOnMount: "firstContentElement", 24730 RenderModal: SetAsPostsPageModal 24731 }), 24732 [pageForPosts, pageOnFront] 24733 ); 24734 }; 24735 24736 24737 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/actions.js 24738 24739 24740 24741 24742 24743 24744 24745 24746 function usePostActions({ postType, onActionPerformed, context }) { 24747 const { defaultActions } = (0,external_wp_data_namespaceObject.useSelect)( 24748 (select) => { 24749 const { getEntityActions } = unlock(select(store_store)); 24750 return { 24751 defaultActions: getEntityActions("postType", postType) 24752 }; 24753 }, 24754 [postType] 24755 ); 24756 const shouldShowHomepageActions = (0,external_wp_data_namespaceObject.useSelect)( 24757 (select) => { 24758 if (postType !== "page") { 24759 return false; 24760 } 24761 const { getDefaultTemplateId, getEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 24762 const canUpdateSettings = canUser("update", { 24763 kind: "root", 24764 name: "site" 24765 }); 24766 if (!canUpdateSettings) { 24767 return false; 24768 } 24769 const frontPageTemplateId = getDefaultTemplateId({ 24770 slug: "front-page" 24771 }); 24772 if (!frontPageTemplateId) { 24773 return true; 24774 } 24775 const frontPageTemplate = getEntityRecord( 24776 "postType", 24777 "wp_template", 24778 frontPageTemplateId 24779 ); 24780 if (!frontPageTemplate) { 24781 return true; 24782 } 24783 return frontPageTemplate.slug !== "front-page"; 24784 }, 24785 [postType] 24786 ); 24787 const setAsHomepageAction = useSetAsHomepageAction(); 24788 const setAsPostsPageAction = useSetAsPostsPageAction(); 24789 const { registerPostTypeSchema } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 24790 (0,external_wp_element_namespaceObject.useEffect)(() => { 24791 registerPostTypeSchema(postType); 24792 }, [registerPostTypeSchema, postType]); 24793 return (0,external_wp_element_namespaceObject.useMemo)(() => { 24794 let actions = [...defaultActions]; 24795 if (shouldShowHomepageActions) { 24796 actions.push(setAsHomepageAction, setAsPostsPageAction); 24797 } 24798 actions = actions.sort( 24799 (a, b) => b.id === "move-to-trash" ? -1 : 0 24800 ); 24801 actions = actions.filter((action) => { 24802 if (!action.context) { 24803 return true; 24804 } 24805 return action.context === context; 24806 }); 24807 if (onActionPerformed) { 24808 for (let i = 0; i < actions.length; ++i) { 24809 if (actions[i].callback) { 24810 const existingCallback = actions[i].callback; 24811 actions[i] = { 24812 ...actions[i], 24813 callback: (items, argsObject) => { 24814 existingCallback(items, { 24815 ...argsObject, 24816 onActionPerformed: (_items) => { 24817 if (argsObject?.onActionPerformed) { 24818 argsObject.onActionPerformed(_items); 24819 } 24820 onActionPerformed( 24821 actions[i].id, 24822 _items 24823 ); 24824 } 24825 }); 24826 } 24827 }; 24828 } 24829 if (actions[i].RenderModal) { 24830 const ExistingRenderModal = actions[i].RenderModal; 24831 actions[i] = { 24832 ...actions[i], 24833 RenderModal: (props) => { 24834 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24835 ExistingRenderModal, 24836 { 24837 ...props, 24838 onActionPerformed: (_items) => { 24839 if (props.onActionPerformed) { 24840 props.onActionPerformed(_items); 24841 } 24842 onActionPerformed( 24843 actions[i].id, 24844 _items 24845 ); 24846 } 24847 } 24848 ); 24849 } 24850 }; 24851 } 24852 } 24853 } 24854 return actions; 24855 }, [ 24856 context, 24857 defaultActions, 24858 onActionPerformed, 24859 setAsHomepageAction, 24860 setAsPostsPageAction, 24861 shouldShowHomepageActions 24862 ]); 24863 } 24864 24865 24866 ;// ./node_modules/@wordpress/editor/build-module/components/post-actions/index.js 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 const { Menu, kebabCase } = unlock(external_wp_components_namespaceObject.privateApis); 24877 function PostActions({ postType, postId, onActionPerformed }) { 24878 const [activeModalAction, setActiveModalAction] = (0,external_wp_element_namespaceObject.useState)(null); 24879 const { item, permissions } = (0,external_wp_data_namespaceObject.useSelect)( 24880 (select) => { 24881 const { getEditedEntityRecord, getEntityRecordPermissions } = unlock(select(external_wp_coreData_namespaceObject.store)); 24882 return { 24883 item: getEditedEntityRecord("postType", postType, postId), 24884 permissions: getEntityRecordPermissions( 24885 "postType", 24886 postType, 24887 postId 24888 ) 24889 }; 24890 }, 24891 [postId, postType] 24892 ); 24893 const itemWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => { 24894 return { 24895 ...item, 24896 permissions 24897 }; 24898 }, [item, permissions]); 24899 const allActions = usePostActions({ postType, onActionPerformed }); 24900 const actions = (0,external_wp_element_namespaceObject.useMemo)(() => { 24901 return allActions.filter((action) => { 24902 return !action.isEligible || action.isEligible(itemWithPermissions); 24903 }); 24904 }, [allActions, itemWithPermissions]); 24905 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 24906 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Menu, { placement: "bottom-end", children: [ 24907 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24908 Menu.TriggerButton, 24909 { 24910 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24911 external_wp_components_namespaceObject.Button, 24912 { 24913 size: "small", 24914 icon: more_vertical_default, 24915 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 24916 disabled: !actions.length, 24917 accessibleWhenDisabled: true, 24918 className: "editor-all-actions-button" 24919 } 24920 ) 24921 } 24922 ), 24923 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24924 ActionsDropdownMenuGroup, 24925 { 24926 actions, 24927 items: [itemWithPermissions], 24928 setActiveModalAction 24929 } 24930 ) }) 24931 ] }), 24932 !!activeModalAction && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24933 ActionModal, 24934 { 24935 action: activeModalAction, 24936 items: [itemWithPermissions], 24937 closeModal: () => setActiveModalAction(null) 24938 } 24939 ) 24940 ] }); 24941 } 24942 function DropdownMenuItemTrigger({ action, onClick, items }) { 24943 const label = typeof action.label === "string" ? action.label : action.label(items); 24944 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Item, { onClick, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.ItemLabel, { children: label }) }); 24945 } 24946 function ActionModal({ action, items, closeModal }) { 24947 const label = typeof action.label === "string" ? action.label : action.label(items); 24948 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24949 external_wp_components_namespaceObject.Modal, 24950 { 24951 title: action.modalHeader || label, 24952 __experimentalHideHeader: !!action.hideModalHeader, 24953 onRequestClose: closeModal ?? (() => { 24954 }), 24955 focusOnMount: "firstContentElement", 24956 size: "medium", 24957 overlayClassName: `editor-action-modal editor-action-modal__$kebabCase( 24958 action.id 24959 )}`, 24960 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(action.RenderModal, { items, closeModal }) 24961 } 24962 ); 24963 } 24964 function ActionsDropdownMenuGroup({ actions, items, setActiveModalAction }) { 24965 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 24966 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(Menu.Group, { children: actions.map((action) => { 24967 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 24968 DropdownMenuItemTrigger, 24969 { 24970 action, 24971 onClick: () => { 24972 if ("RenderModal" in action) { 24973 setActiveModalAction(action); 24974 return; 24975 } 24976 action.callback(items, { registry }); 24977 }, 24978 items 24979 }, 24980 action.id 24981 ); 24982 }) }); 24983 } 24984 24985 24986 ;// ./node_modules/@wordpress/editor/build-module/components/post-card-panel/index.js 24987 24988 24989 24990 24991 24992 24993 24994 24995 24996 24997 24998 24999 25000 const { Badge: post_card_panel_Badge } = unlock(external_wp_components_namespaceObject.privateApis); 25001 function PostCardPanel({ 25002 postType, 25003 postId, 25004 onActionPerformed 25005 }) { 25006 const postIds = (0,external_wp_element_namespaceObject.useMemo)( 25007 () => Array.isArray(postId) ? postId : [postId], 25008 [postId] 25009 ); 25010 const { postTitle, icon, labels } = (0,external_wp_data_namespaceObject.useSelect)( 25011 (select) => { 25012 const { getEditedEntityRecord, getCurrentTheme, getPostType } = select(external_wp_coreData_namespaceObject.store); 25013 const { getPostIcon } = unlock(select(store_store)); 25014 let _title = ""; 25015 const _record = getEditedEntityRecord( 25016 "postType", 25017 postType, 25018 postIds[0] 25019 ); 25020 if (postIds.length === 1) { 25021 const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; 25022 const _templateInfo = [ 25023 TEMPLATE_POST_TYPE, 25024 TEMPLATE_PART_POST_TYPE 25025 ].includes(postType) ? getTemplateInfo({ 25026 template: _record, 25027 templateTypes 25028 }) : {}; 25029 _title = _templateInfo?.title || _record?.title; 25030 } 25031 return { 25032 postTitle: _title, 25033 icon: getPostIcon(postType, { 25034 area: _record?.area 25035 }), 25036 labels: getPostType(postType)?.labels 25037 }; 25038 }, 25039 [postIds, postType] 25040 ); 25041 const pageTypeBadge = usePageTypeBadge(postId); 25042 let title = (0,external_wp_i18n_namespaceObject.__)("No title"); 25043 if (labels?.name && postIds.length > 1) { 25044 title = (0,external_wp_i18n_namespaceObject.sprintf)( 25045 // translators: %1$d number of selected items %2$s: Name of the plural post type e.g: "Posts". 25046 (0,external_wp_i18n_namespaceObject.__)("%1$d %2$s"), 25047 postIds.length, 25048 labels?.name 25049 ); 25050 } else if (postTitle) { 25051 title = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(postTitle); 25052 } 25053 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, className: "editor-post-card-panel", children: [ 25054 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 25055 external_wp_components_namespaceObject.__experimentalHStack, 25056 { 25057 spacing: 2, 25058 className: "editor-post-card-panel__header", 25059 align: "flex-start", 25060 children: [ 25061 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { className: "editor-post-card-panel__icon", icon }), 25062 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 25063 external_wp_components_namespaceObject.__experimentalText, 25064 { 25065 numberOfLines: 2, 25066 truncate: true, 25067 className: "editor-post-card-panel__title", 25068 as: "h2", 25069 children: [ 25070 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-post-card-panel__title-name", children: title }), 25071 pageTypeBadge && postIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_card_panel_Badge, { children: pageTypeBadge }) 25072 ] 25073 } 25074 ), 25075 postIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25076 PostActions, 25077 { 25078 postType, 25079 postId: postIds[0], 25080 onActionPerformed 25081 } 25082 ) 25083 ] 25084 } 25085 ), 25086 postIds.length > 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { className: "editor-post-card-panel__description", children: (0,external_wp_i18n_namespaceObject.sprintf)( 25087 // translators: %s: Name of the plural post type e.g: "Posts". 25088 (0,external_wp_i18n_namespaceObject.__)("Changes will be applied to all selected %s."), 25089 labels?.name.toLowerCase() 25090 ) }) 25091 ] }); 25092 } 25093 25094 25095 ;// ./node_modules/@wordpress/editor/build-module/components/post-content-information/index.js 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 const post_content_information_AVERAGE_READING_RATE = 189; 25106 function PostContentInformation() { 25107 const { postContent } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25108 const { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } = select(store_store); 25109 const { canUser } = select(external_wp_coreData_namespaceObject.store); 25110 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 25111 const siteSettings = canUser("read", { 25112 kind: "root", 25113 name: "site" 25114 }) ? getEntityRecord("root", "site") : void 0; 25115 const postType = getCurrentPostType(); 25116 const _id = getCurrentPostId(); 25117 const isPostsPage = +_id === siteSettings?.page_for_posts; 25118 const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes( 25119 postType 25120 ); 25121 return { 25122 postContent: showPostContentInfo && getEditedPostAttribute("content") 25123 }; 25124 }, []); 25125 const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); 25126 const wordsCounted = (0,external_wp_element_namespaceObject.useMemo)( 25127 () => postContent ? (0,external_wp_wordcount_namespaceObject.count)(postContent, wordCountType) : 0, 25128 [postContent, wordCountType] 25129 ); 25130 if (!wordsCounted) { 25131 return null; 25132 } 25133 const readingTime = Math.round(wordsCounted / post_content_information_AVERAGE_READING_RATE); 25134 const wordsCountText = (0,external_wp_i18n_namespaceObject.sprintf)( 25135 // translators: %s: the number of words in the post. 25136 (0,external_wp_i18n_namespaceObject._n)("%s word", "%s words", wordsCounted), 25137 wordsCounted.toLocaleString() 25138 ); 25139 const minutesText = readingTime <= 1 ? (0,external_wp_i18n_namespaceObject.__)("1 minute") : (0,external_wp_i18n_namespaceObject.sprintf)( 25140 /* translators: %s: the number of minutes to read the post. */ 25141 (0,external_wp_i18n_namespaceObject._n)("%s minute", "%s minutes", readingTime), 25142 readingTime.toLocaleString() 25143 ); 25144 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-content-information", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.sprintf)( 25145 /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */ 25146 (0,external_wp_i18n_namespaceObject.__)("%1$s, %2$s read time."), 25147 wordsCountText, 25148 minutesText 25149 ) }) }); 25150 } 25151 25152 25153 ;// ./node_modules/@wordpress/editor/build-module/components/post-format/panel.js 25154 25155 25156 25157 25158 25159 25160 25161 25162 25163 25164 function panel_PostFormat() { 25165 const { postFormat } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25166 const { getEditedPostAttribute } = select(store_store); 25167 const _postFormat = getEditedPostAttribute("format"); 25168 return { 25169 postFormat: _postFormat ?? "standard" 25170 }; 25171 }, []); 25172 const activeFormat = POST_FORMATS.find( 25173 (format) => format.id === postFormat 25174 ); 25175 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 25176 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 25177 () => ({ 25178 // Anchor the popover to the middle of the entire row so that it doesn't 25179 // move around when the label changes. 25180 anchor: popoverAnchor, 25181 placement: "left-start", 25182 offset: 36, 25183 shift: true 25184 }), 25185 [popoverAnchor] 25186 ); 25187 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormatCheck, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Format"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25188 external_wp_components_namespaceObject.Dropdown, 25189 { 25190 popoverProps, 25191 contentClassName: "editor-post-format__dialog", 25192 focusOnMount: true, 25193 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25194 external_wp_components_namespaceObject.Button, 25195 { 25196 size: "compact", 25197 variant: "tertiary", 25198 "aria-expanded": isOpen, 25199 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 25200 // translators: %s: Current post format. 25201 (0,external_wp_i18n_namespaceObject.__)("Change format: %s"), 25202 activeFormat?.caption 25203 ), 25204 onClick: onToggle, 25205 children: activeFormat?.caption 25206 } 25207 ), 25208 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-post-format__dialog-content", children: [ 25209 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25210 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 25211 { 25212 title: (0,external_wp_i18n_namespaceObject.__)("Format"), 25213 onClose 25214 } 25215 ), 25216 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFormat, {}) 25217 ] }) 25218 } 25219 ) }) }); 25220 } 25221 var post_format_panel_panel_default = panel_PostFormat; 25222 25223 25224 ;// ./node_modules/@wordpress/editor/build-module/components/post-last-edited-panel/index.js 25225 25226 25227 25228 25229 25230 25231 function PostLastEditedPanel() { 25232 const modified = (0,external_wp_data_namespaceObject.useSelect)( 25233 (select) => select(store_store).getEditedPostAttribute("modified"), 25234 [] 25235 ); 25236 const lastEditedText = modified && (0,external_wp_i18n_namespaceObject.sprintf)( 25237 // translators: %s: Human-readable time difference, e.g. "2 days ago". 25238 (0,external_wp_i18n_namespaceObject.__)("Last edited %s."), 25239 (0,external_wp_date_namespaceObject.humanTimeDiff)(modified) 25240 ); 25241 if (!lastEditedText) { 25242 return null; 25243 } 25244 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { className: "editor-post-last-edited-panel", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: lastEditedText }) }); 25245 } 25246 25247 25248 ;// ./node_modules/@wordpress/editor/build-module/components/post-panel-section/index.js 25249 25250 25251 25252 function PostPanelSection({ className, children }) { 25253 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { className: dist_clsx("editor-post-panel__section", className), children }); 25254 } 25255 var post_panel_section_default = PostPanelSection; 25256 25257 25258 ;// ./node_modules/@wordpress/editor/build-module/components/blog-title/index.js 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 25270 25271 const blog_title_EMPTY_OBJECT = {}; 25272 function BlogTitle() { 25273 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 25274 const { postsPageTitle, postsPageId, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)( 25275 (select) => { 25276 const { getEntityRecord, getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 25277 const siteSettings = canUser("read", { 25278 kind: "root", 25279 name: "site" 25280 }) ? getEntityRecord("root", "site") : void 0; 25281 const _postsPageRecord = siteSettings?.page_for_posts ? getEditedEntityRecord( 25282 "postType", 25283 "page", 25284 siteSettings?.page_for_posts 25285 ) : blog_title_EMPTY_OBJECT; 25286 const { getEditedPostAttribute, getCurrentPostType } = select(store_store); 25287 return { 25288 postsPageId: _postsPageRecord?.id, 25289 postsPageTitle: _postsPageRecord?.title, 25290 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 25291 postSlug: getEditedPostAttribute("slug") 25292 }; 25293 }, 25294 [] 25295 ); 25296 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 25297 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 25298 () => ({ 25299 // Anchor the popover to the middle of the entire row so that it doesn't 25300 // move around when the label changes. 25301 anchor: popoverAnchor, 25302 placement: "left-start", 25303 offset: 36, 25304 shift: true 25305 }), 25306 [popoverAnchor] 25307 ); 25308 if (!isTemplate || !["home", "index"].includes(postSlug) || !postsPageId) { 25309 return null; 25310 } 25311 const setPostsPageTitle = (newValue) => { 25312 editEntityRecord("postType", "page", postsPageId, { 25313 title: newValue 25314 }); 25315 }; 25316 const decodedTitle = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postsPageTitle); 25317 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Blog title"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25318 external_wp_components_namespaceObject.Dropdown, 25319 { 25320 popoverProps, 25321 contentClassName: "editor-blog-title-dropdown__content", 25322 focusOnMount: true, 25323 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25324 external_wp_components_namespaceObject.Button, 25325 { 25326 size: "compact", 25327 variant: "tertiary", 25328 "aria-expanded": isOpen, 25329 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( 25330 // translators: %s: Current post link. 25331 (0,external_wp_i18n_namespaceObject.__)("Change blog title: %s"), 25332 decodedTitle 25333 ), 25334 onClick: onToggle, 25335 children: decodedTitle 25336 } 25337 ), 25338 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 25339 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25340 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 25341 { 25342 title: (0,external_wp_i18n_namespaceObject.__)("Blog title"), 25343 onClose 25344 } 25345 ), 25346 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25347 external_wp_components_namespaceObject.__experimentalInputControl, 25348 { 25349 placeholder: (0,external_wp_i18n_namespaceObject.__)("No title"), 25350 size: "__unstable-large", 25351 value: postsPageTitle, 25352 onChange: (0,external_wp_compose_namespaceObject.debounce)(setPostsPageTitle, 300), 25353 label: (0,external_wp_i18n_namespaceObject.__)("Blog title"), 25354 help: (0,external_wp_i18n_namespaceObject.__)( 25355 "Set the Posts Page title. Appears in search results, and when the page is shared on social media." 25356 ), 25357 hideLabelFromVision: true 25358 } 25359 ) 25360 ] }) 25361 } 25362 ) }); 25363 } 25364 25365 25366 ;// ./node_modules/@wordpress/editor/build-module/components/posts-per-page/index.js 25367 25368 25369 25370 25371 25372 25373 25374 25375 25376 25377 function PostsPerPage() { 25378 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 25379 const { postsPerPage, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25380 const { getEditedPostAttribute, getCurrentPostType } = select(store_store); 25381 const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 25382 const siteSettings = canUser("read", { 25383 kind: "root", 25384 name: "site" 25385 }) ? getEditedEntityRecord("root", "site") : void 0; 25386 return { 25387 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 25388 postSlug: getEditedPostAttribute("slug"), 25389 postsPerPage: siteSettings?.posts_per_page || 1 25390 }; 25391 }, []); 25392 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 25393 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 25394 () => ({ 25395 // Anchor the popover to the middle of the entire row so that it doesn't 25396 // move around when the label changes. 25397 anchor: popoverAnchor, 25398 placement: "left-start", 25399 offset: 36, 25400 shift: true 25401 }), 25402 [popoverAnchor] 25403 ); 25404 if (!isTemplate || !["home", "index"].includes(postSlug)) { 25405 return null; 25406 } 25407 const setPostsPerPage = (newValue) => { 25408 editEntityRecord("root", "site", void 0, { 25409 posts_per_page: newValue 25410 }); 25411 }; 25412 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Posts per page"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25413 external_wp_components_namespaceObject.Dropdown, 25414 { 25415 popoverProps, 25416 contentClassName: "editor-posts-per-page-dropdown__content", 25417 focusOnMount: true, 25418 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25419 external_wp_components_namespaceObject.Button, 25420 { 25421 size: "compact", 25422 variant: "tertiary", 25423 "aria-expanded": isOpen, 25424 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change posts per page"), 25425 onClick: onToggle, 25426 children: postsPerPage 25427 } 25428 ), 25429 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 25430 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25431 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 25432 { 25433 title: (0,external_wp_i18n_namespaceObject.__)("Posts per page"), 25434 onClose 25435 } 25436 ), 25437 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25438 external_wp_components_namespaceObject.__experimentalNumberControl, 25439 { 25440 placeholder: 0, 25441 value: postsPerPage, 25442 size: "__unstable-large", 25443 spinControls: "custom", 25444 step: "1", 25445 min: "1", 25446 onChange: setPostsPerPage, 25447 label: (0,external_wp_i18n_namespaceObject.__)("Posts per page"), 25448 help: (0,external_wp_i18n_namespaceObject.__)( 25449 "Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting." 25450 ), 25451 hideLabelFromVision: true 25452 } 25453 ) 25454 ] }) 25455 } 25456 ) }); 25457 } 25458 25459 25460 ;// ./node_modules/@wordpress/editor/build-module/components/site-discussion/index.js 25461 25462 25463 25464 25465 25466 25467 25468 25469 25470 25471 const site_discussion_COMMENT_OPTIONS = [ 25472 { 25473 label: (0,external_wp_i18n_namespaceObject._x)("Open", 'Adjective: e.g. "Comments are open"'), 25474 value: "open", 25475 description: (0,external_wp_i18n_namespaceObject.__)("Visitors can add new comments and replies.") 25476 }, 25477 { 25478 label: (0,external_wp_i18n_namespaceObject.__)("Closed"), 25479 value: "", 25480 description: [ 25481 (0,external_wp_i18n_namespaceObject.__)("Visitors cannot add new comments or replies."), 25482 (0,external_wp_i18n_namespaceObject.__)("Existing comments remain visible.") 25483 ].join(" ") 25484 } 25485 ]; 25486 function SiteDiscussion() { 25487 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 25488 const { allowCommentsOnNewPosts, isTemplate, postSlug } = (0,external_wp_data_namespaceObject.useSelect)( 25489 (select) => { 25490 const { getEditedPostAttribute, getCurrentPostType } = select(store_store); 25491 const { getEditedEntityRecord, canUser } = select(external_wp_coreData_namespaceObject.store); 25492 const siteSettings = canUser("read", { 25493 kind: "root", 25494 name: "site" 25495 }) ? getEditedEntityRecord("root", "site") : void 0; 25496 return { 25497 isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE, 25498 postSlug: getEditedPostAttribute("slug"), 25499 allowCommentsOnNewPosts: siteSettings?.default_comment_status || "" 25500 }; 25501 }, 25502 [] 25503 ); 25504 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 25505 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)( 25506 () => ({ 25507 // Anchor the popover to the middle of the entire row so that it doesn't 25508 // move around when the label changes. 25509 anchor: popoverAnchor, 25510 placement: "left-start", 25511 offset: 36, 25512 shift: true 25513 }), 25514 [popoverAnchor] 25515 ); 25516 if (!isTemplate || !["home", "index"].includes(postSlug)) { 25517 return null; 25518 } 25519 const setAllowCommentsOnNewPosts = (newValue) => { 25520 editEntityRecord("root", "site", void 0, { 25521 default_comment_status: newValue ? "open" : null 25522 }); 25523 }; 25524 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_row_default, { label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), ref: setPopoverAnchor, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25525 external_wp_components_namespaceObject.Dropdown, 25526 { 25527 popoverProps, 25528 contentClassName: "editor-site-discussion-dropdown__content", 25529 focusOnMount: true, 25530 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25531 external_wp_components_namespaceObject.Button, 25532 { 25533 size: "compact", 25534 variant: "tertiary", 25535 "aria-expanded": isOpen, 25536 "aria-label": (0,external_wp_i18n_namespaceObject.__)("Change discussion settings"), 25537 onClick: onToggle, 25538 children: allowCommentsOnNewPosts ? (0,external_wp_i18n_namespaceObject.__)("Comments open") : (0,external_wp_i18n_namespaceObject.__)("Comments closed") 25539 } 25540 ), 25541 renderContent: ({ onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 25542 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25543 external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, 25544 { 25545 title: (0,external_wp_i18n_namespaceObject.__)("Discussion"), 25546 onClose 25547 } 25548 ), 25549 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 3, children: [ 25550 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { children: (0,external_wp_i18n_namespaceObject.__)( 25551 "Changes will apply to new posts only. Individual posts may override these settings." 25552 ) }), 25553 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25554 external_wp_components_namespaceObject.RadioControl, 25555 { 25556 className: "editor-site-discussion__options", 25557 hideLabelFromVision: true, 25558 label: (0,external_wp_i18n_namespaceObject.__)("Comment status"), 25559 options: site_discussion_COMMENT_OPTIONS, 25560 onChange: setAllowCommentsOnNewPosts, 25561 selected: allowCommentsOnNewPosts 25562 } 25563 ) 25564 ] }) 25565 ] }) 25566 } 25567 ) }); 25568 } 25569 25570 25571 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/post-summary.js 25572 25573 25574 25575 25576 25577 25578 25579 25580 25581 25582 25583 25584 25585 25586 25587 25588 25589 25590 25591 25592 25593 25594 25595 25596 25597 const post_summary_PANEL_NAME = "post-status"; 25598 function PostSummary({ onActionPerformed }) { 25599 const { isRemovedPostStatusPanel, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)( 25600 (select) => { 25601 const { 25602 isEditorPanelRemoved, 25603 getCurrentPostType, 25604 getCurrentPostId 25605 } = select(store_store); 25606 return { 25607 isRemovedPostStatusPanel: isEditorPanelRemoved(post_summary_PANEL_NAME), 25608 postType: getCurrentPostType(), 25609 postId: getCurrentPostId() 25610 }; 25611 }, 25612 [] 25613 ); 25614 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_panel_section_default, { className: "editor-post-summary", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_post_status_info_default.Slot, { children: (fills) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 25615 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25616 PostCardPanel, 25617 { 25618 postType, 25619 postId, 25620 onActionPerformed 25621 } 25622 ), 25623 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostFeaturedImagePanel, { withPanelBody: false }), 25624 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostExcerptPanel, {}), 25625 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ 25626 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostContentInformation, {}), 25627 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostLastEditedPanel, {}) 25628 ] }), 25629 !isRemovedPostStatusPanel && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 4, children: [ 25630 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: 1, children: [ 25631 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostStatus, {}), 25632 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSchedulePanel, {}), 25633 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostURLPanel, {}), 25634 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_default, {}), 25635 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTemplatePanel, {}), 25636 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostDiscussionPanel, {}), 25637 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostLastRevision, {}), 25638 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PageAttributesPanel, {}), 25639 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSyncStatus, {}), 25640 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlogTitle, {}), 25641 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostsPerPage, {}), 25642 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(SiteDiscussion, {}), 25643 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_format_panel_panel_default, {}), 25644 fills 25645 ] }), 25646 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25647 PostTrash, 25648 { 25649 onActionPerformed 25650 } 25651 ) 25652 ] }) 25653 ] }) }) }) }); 25654 } 25655 25656 25657 ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/hooks.js 25658 25659 25660 25661 25662 25663 25664 25665 const { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES: hooks_PATTERN_TYPES } = unlock(external_wp_patterns_namespaceObject.privateApis); 25666 function injectThemeAttributeInBlockTemplateContent(block, currentThemeStylesheet) { 25667 block.innerBlocks = block.innerBlocks.map((innerBlock) => { 25668 return injectThemeAttributeInBlockTemplateContent( 25669 innerBlock, 25670 currentThemeStylesheet 25671 ); 25672 }); 25673 if (block.name === "core/template-part" && block.attributes.theme === void 0) { 25674 block.attributes.theme = currentThemeStylesheet; 25675 } 25676 return block; 25677 } 25678 function filterPatterns(patterns, template) { 25679 const filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name); 25680 const filterOutExcludedPatternSources = (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source); 25681 const filterCompatiblePatterns = (pattern) => pattern.templateTypes?.includes(template.slug) || pattern.blockTypes?.includes("core/template-part/" + template.area); 25682 return patterns.filter((pattern, index, items) => { 25683 return filterOutDuplicatesByName(pattern, index, items) && filterOutExcludedPatternSources(pattern) && filterCompatiblePatterns(pattern); 25684 }); 25685 } 25686 function preparePatterns(patterns, currentThemeStylesheet) { 25687 return patterns.map((pattern) => ({ 25688 ...pattern, 25689 keywords: pattern.keywords || [], 25690 type: hooks_PATTERN_TYPES.theme, 25691 blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, { 25692 __unstableSkipMigrationLogs: true 25693 }).map( 25694 (block) => injectThemeAttributeInBlockTemplateContent( 25695 block, 25696 currentThemeStylesheet 25697 ) 25698 ) 25699 })); 25700 } 25701 function useAvailablePatterns({ area, name, slug }) { 25702 const { blockPatterns, restBlockPatterns, currentThemeStylesheet } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25703 const { getEditorSettings } = select(store_store); 25704 const settings = getEditorSettings(); 25705 return { 25706 blockPatterns: settings.__experimentalAdditionalBlockPatterns ?? settings.__experimentalBlockPatterns, 25707 restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), 25708 currentThemeStylesheet: select(external_wp_coreData_namespaceObject.store).getCurrentTheme().stylesheet 25709 }; 25710 }, []); 25711 return (0,external_wp_element_namespaceObject.useMemo)(() => { 25712 const mergedPatterns = [ 25713 ...blockPatterns || [], 25714 ...restBlockPatterns || [] 25715 ]; 25716 const filteredPatterns = filterPatterns(mergedPatterns, { 25717 area, 25718 name, 25719 slug 25720 }); 25721 return preparePatterns(filteredPatterns, currentThemeStylesheet); 25722 }, [ 25723 area, 25724 name, 25725 slug, 25726 blockPatterns, 25727 restBlockPatterns, 25728 currentThemeStylesheet 25729 ]); 25730 } 25731 25732 25733 ;// ./node_modules/@wordpress/editor/build-module/components/post-transform-panel/index.js 25734 25735 25736 25737 25738 25739 25740 25741 25742 25743 25744 function post_transform_panel_TemplatesList({ availableTemplates, onSelect }) { 25745 if (!availableTemplates || availableTemplates?.length === 0) { 25746 return null; 25747 } 25748 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25749 external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, 25750 { 25751 label: (0,external_wp_i18n_namespaceObject.__)("Templates"), 25752 blockPatterns: availableTemplates, 25753 onClickPattern: onSelect, 25754 showTitlesAsTooltip: true 25755 } 25756 ); 25757 } 25758 function PostTransform() { 25759 const { area, name, slug, postType, postId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25760 const { getCurrentPostType, getCurrentPostId } = select(store_store); 25761 const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 25762 const type = getCurrentPostType(); 25763 const id = getCurrentPostId(); 25764 const record = getEditedEntityRecord("postType", type, id); 25765 return { 25766 area: record?.area, 25767 name: record?.name, 25768 slug: record?.slug, 25769 postType: type, 25770 postId: id 25771 }; 25772 }, []); 25773 const { editEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 25774 const availablePatterns = useAvailablePatterns({ area, name, slug }); 25775 const onTemplateSelect = async (selectedTemplate) => { 25776 await editEntityRecord("postType", postType, postId, { 25777 blocks: selectedTemplate.blocks, 25778 content: (0,external_wp_blocks_namespaceObject.serialize)(selectedTemplate.blocks) 25779 }); 25780 }; 25781 if (!availablePatterns?.length) { 25782 return null; 25783 } 25784 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25785 external_wp_components_namespaceObject.PanelBody, 25786 { 25787 title: (0,external_wp_i18n_namespaceObject.__)("Design"), 25788 initialOpen: postType === TEMPLATE_PART_POST_TYPE, 25789 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25790 post_transform_panel_TemplatesList, 25791 { 25792 availableTemplates: availablePatterns, 25793 onSelect: onTemplateSelect 25794 } 25795 ) 25796 } 25797 ); 25798 } 25799 function PostTransformPanel() { 25800 const { postType } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25801 const { getCurrentPostType } = select(store_store); 25802 return { 25803 postType: getCurrentPostType() 25804 }; 25805 }, []); 25806 if (![TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE].includes(postType)) { 25807 return null; 25808 } 25809 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransform, {}); 25810 } 25811 25812 25813 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/constants.js 25814 const sidebars = { 25815 document: "edit-post/document", 25816 block: "edit-post/block" 25817 }; 25818 25819 25820 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/header.js 25821 25822 25823 25824 25825 25826 25827 25828 25829 const { Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 25830 const SidebarHeader = (_, ref) => { 25831 const { documentLabel } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25832 const { getPostTypeLabel } = select(store_store); 25833 return { 25834 documentLabel: ( 25835 // translators: Default label for the Document sidebar tab, not selected. 25836 getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)("Document", "noun, panel") 25837 ) 25838 }; 25839 }, []); 25840 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs.TabList, { ref, children: [ 25841 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25842 Tabs.Tab, 25843 { 25844 tabId: sidebars.document, 25845 "data-tab-id": sidebars.document, 25846 children: documentLabel 25847 } 25848 ), 25849 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25850 Tabs.Tab, 25851 { 25852 tabId: sidebars.block, 25853 "data-tab-id": sidebars.block, 25854 children: (0,external_wp_i18n_namespaceObject.__)("Block") 25855 } 25856 ) 25857 ] }); 25858 }; 25859 var sidebar_header_header_default = (0,external_wp_element_namespaceObject.forwardRef)(SidebarHeader); 25860 25861 25862 ;// ./node_modules/@wordpress/editor/build-module/components/template-content-panel/index.js 25863 25864 25865 25866 25867 25868 25869 25870 25871 25872 25873 25874 const { BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 25875 const template_content_panel_POST_CONTENT_BLOCK_TYPES = [ 25876 "core/post-title", 25877 "core/post-featured-image", 25878 "core/post-content" 25879 ]; 25880 const TEMPLATE_PART_BLOCK = "core/template-part"; 25881 function TemplateContentPanel() { 25882 const postContentBlockTypes = (0,external_wp_element_namespaceObject.useMemo)( 25883 () => (0,external_wp_hooks_namespaceObject.applyFilters)( 25884 "editor.postContentBlockTypes", 25885 template_content_panel_POST_CONTENT_BLOCK_TYPES 25886 ), 25887 [] 25888 ); 25889 const { clientIds, postType, renderingMode } = (0,external_wp_data_namespaceObject.useSelect)( 25890 (select) => { 25891 const { 25892 getCurrentPostType, 25893 getPostBlocksByName, 25894 getRenderingMode 25895 } = unlock(select(store_store)); 25896 const _postType = getCurrentPostType(); 25897 return { 25898 postType: _postType, 25899 clientIds: getPostBlocksByName( 25900 TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes 25901 ), 25902 renderingMode: getRenderingMode() 25903 }; 25904 }, 25905 [postContentBlockTypes] 25906 ); 25907 const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 25908 if (renderingMode === "post-only" && postType !== TEMPLATE_POST_TYPE || clientIds.length === 0) { 25909 return null; 25910 } 25911 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Content"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 25912 BlockQuickNavigation, 25913 { 25914 clientIds, 25915 onSelect: () => { 25916 enableComplementaryArea("core", "edit-post/document"); 25917 } 25918 } 25919 ) }); 25920 } 25921 25922 25923 ;// ./node_modules/@wordpress/editor/build-module/components/template-part-content-panel/index.js 25924 25925 25926 25927 25928 25929 25930 25931 25932 25933 25934 const { BlockQuickNavigation: template_part_content_panel_BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 25935 function TemplatePartContentPanelInner() { 25936 const blockTypes = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25937 const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); 25938 return getBlockTypes(); 25939 }, []); 25940 const themeBlockNames = (0,external_wp_element_namespaceObject.useMemo)(() => { 25941 return blockTypes.filter((blockType) => { 25942 return blockType.category === "theme"; 25943 }).map(({ name }) => name); 25944 }, [blockTypes]); 25945 const themeBlocks = (0,external_wp_data_namespaceObject.useSelect)( 25946 (select) => { 25947 const { getBlocksByName } = select(external_wp_blockEditor_namespaceObject.store); 25948 return getBlocksByName(themeBlockNames); 25949 }, 25950 [themeBlockNames] 25951 ); 25952 if (themeBlocks.length === 0) { 25953 return null; 25954 } 25955 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Content"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(template_part_content_panel_BlockQuickNavigation, { clientIds: themeBlocks }) }); 25956 } 25957 function TemplatePartContentPanel() { 25958 const postType = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25959 const { getCurrentPostType } = select(store_store); 25960 return getCurrentPostType(); 25961 }, []); 25962 if (postType !== TEMPLATE_PART_POST_TYPE) { 25963 return null; 25964 } 25965 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanelInner, {}); 25966 } 25967 25968 25969 ;// ./node_modules/@wordpress/editor/build-module/components/provider/use-auto-switch-editor-sidebars.js 25970 25971 25972 25973 25974 25975 function useAutoSwitchEditorSidebars() { 25976 const { hasBlockSelection } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 25977 return { 25978 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart() 25979 }; 25980 }, []); 25981 const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); 25982 const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 25983 const { get: getPreference } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_preferences_namespaceObject.store); 25984 (0,external_wp_element_namespaceObject.useEffect)(() => { 25985 const activeGeneralSidebar = getActiveComplementaryArea("core"); 25986 const isEditorSidebarOpened = [ 25987 "edit-post/document", 25988 "edit-post/block" 25989 ].includes(activeGeneralSidebar); 25990 const isDistractionFree = getPreference("core", "distractionFree"); 25991 if (!isEditorSidebarOpened || isDistractionFree) { 25992 return; 25993 } 25994 if (hasBlockSelection) { 25995 enableComplementaryArea("core", "edit-post/block"); 25996 } else { 25997 enableComplementaryArea("core", "edit-post/document"); 25998 } 25999 }, [ 26000 hasBlockSelection, 26001 getActiveComplementaryArea, 26002 enableComplementaryArea, 26003 getPreference 26004 ]); 26005 } 26006 var use_auto_switch_editor_sidebars_default = useAutoSwitchEditorSidebars; 26007 26008 26009 ;// ./node_modules/@wordpress/editor/build-module/components/sidebar/index.js 26010 26011 26012 26013 26014 26015 26016 26017 26018 26019 26020 26021 26022 26023 26024 26025 26026 26027 26028 26029 26030 26031 26032 26033 const { Tabs: sidebar_Tabs } = unlock(external_wp_components_namespaceObject.privateApis); 26034 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ 26035 web: true, 26036 native: false 26037 }); 26038 const SidebarContent = ({ 26039 tabName, 26040 keyboardShortcut, 26041 onActionPerformed, 26042 extraPanels 26043 }) => { 26044 const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); 26045 const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(sidebar_Tabs.Context); 26046 (0,external_wp_element_namespaceObject.useEffect)(() => { 26047 const tabsElements = Array.from( 26048 tabListRef.current?.querySelectorAll('[role="tab"]') || [] 26049 ); 26050 const selectedTabElement = tabsElements.find( 26051 // We are purposefully using a custom `data-tab-id` attribute here 26052 // because we don't want rely on any assumptions about `Tabs` 26053 // component internals. 26054 (element) => element.getAttribute("data-tab-id") === tabName 26055 ); 26056 const activeElement = selectedTabElement?.ownerDocument.activeElement; 26057 const tabsHasFocus = tabsElements.some((element) => { 26058 return activeElement && activeElement.id === element.id; 26059 }); 26060 if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { 26061 selectedTabElement?.focus(); 26062 } 26063 }, [tabName]); 26064 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26065 PluginSidebar, 26066 { 26067 identifier: tabName, 26068 header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_header_header_default, { ref: tabListRef }) }), 26069 closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Settings"), 26070 className: "editor-sidebar__panel", 26071 headerClassName: "editor-sidebar__panel-tabs", 26072 title: ( 26073 /* translators: button label text should, if possible, be under 16 characters. */ 26074 (0,external_wp_i18n_namespaceObject._x)("Settings", "panel button label") 26075 ), 26076 toggleShortcut: keyboardShortcut, 26077 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left_default : drawer_right_default, 26078 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, 26079 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.Context.Provider, { value: tabsContextValue, children: [ 26080 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(sidebar_Tabs.TabPanel, { tabId: sidebars.document, focusable: false, children: [ 26081 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostSummary, { onActionPerformed }), 26082 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(plugin_document_setting_panel_default.Slot, {}), 26083 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplateContentPanel, {}), 26084 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(TemplatePartContentPanel, {}), 26085 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PostTransformPanel, {}), 26086 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(panel_PostTaxonomies, {}), 26087 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesPanel, {}), 26088 extraPanels 26089 ] }), 26090 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(sidebar_Tabs.TabPanel, { tabId: sidebars.block, focusable: false, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockInspector, {}) }) 26091 ] }) 26092 } 26093 ); 26094 }; 26095 const Sidebar = ({ extraPanels, onActionPerformed }) => { 26096 use_auto_switch_editor_sidebars_default(); 26097 const { tabName, keyboardShortcut, showSummary } = (0,external_wp_data_namespaceObject.useSelect)( 26098 (select) => { 26099 const shortcut = select( 26100 external_wp_keyboardShortcuts_namespaceObject.store 26101 ).getShortcutRepresentation("core/editor/toggle-sidebar"); 26102 const sidebar = select(store).getActiveComplementaryArea("core"); 26103 const _isEditorSidebarOpened = [ 26104 sidebars.block, 26105 sidebars.document 26106 ].includes(sidebar); 26107 let _tabName = sidebar; 26108 if (!_isEditorSidebarOpened) { 26109 _tabName = !!select( 26110 external_wp_blockEditor_namespaceObject.store 26111 ).getBlockSelectionStart() ? sidebars.block : sidebars.document; 26112 } 26113 return { 26114 tabName: _tabName, 26115 keyboardShortcut: shortcut, 26116 showSummary: ![ 26117 TEMPLATE_POST_TYPE, 26118 TEMPLATE_PART_POST_TYPE, 26119 NAVIGATION_POST_TYPE 26120 ].includes(select(store_store).getCurrentPostType()) 26121 }; 26122 }, 26123 [] 26124 ); 26125 const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 26126 const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)( 26127 (newSelectedTabId) => { 26128 if (!!newSelectedTabId) { 26129 enableComplementaryArea("core", newSelectedTabId); 26130 } 26131 }, 26132 [enableComplementaryArea] 26133 ); 26134 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26135 sidebar_Tabs, 26136 { 26137 selectedTabId: tabName, 26138 onSelect: onTabSelect, 26139 selectOnMove: false, 26140 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26141 SidebarContent, 26142 { 26143 tabName, 26144 keyboardShortcut, 26145 showSummary, 26146 onActionPerformed, 26147 extraPanels 26148 } 26149 ) 26150 } 26151 ); 26152 }; 26153 var sidebar_sidebar_default = Sidebar; 26154 26155 26156 ;// ./node_modules/@wordpress/icons/build-module/library/comment.js 26157 26158 26159 var comment_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" }) }); 26160 26161 26162 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/constants.js 26163 const collabHistorySidebarName = "edit-post/collab-history-sidebar"; 26164 const collabSidebarName = "edit-post/collab-sidebar"; 26165 const SIDEBARS = [collabHistorySidebarName, collabSidebarName]; 26166 26167 26168 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/utils.js 26169 26170 function sanitizeCommentString(str) { 26171 return str.trim(); 26172 } 26173 function utils_noop() { 26174 } 26175 const AVATAR_BORDER_COLORS = [ 26176 "#3858E9", 26177 // Blueberry 26178 "#9fB1FF", 26179 // Blueberry 2 26180 "#1D35B4", 26181 // Dark Blueberry 26182 "#1A1919", 26183 // Charcoal 0 26184 "#E26F56", 26185 // Pomegranate 26186 "#33F078", 26187 // Acid Green 26188 "#FFF972", 26189 // Lemon 26190 "#7A00DF" 26191 // Purple 26192 ]; 26193 function getAvatarBorderColor(userId) { 26194 return AVATAR_BORDER_COLORS[userId % AVATAR_BORDER_COLORS.length]; 26195 } 26196 function getCommentExcerpt(text, excerptLength = 10) { 26197 if (!text) { 26198 return ""; 26199 } 26200 const wordCountType = (0,external_wp_i18n_namespaceObject._x)("words", "Word count type. Do not translate!"); 26201 const rawText = text.trim(); 26202 let trimmedExcerpt = ""; 26203 if (wordCountType === "words") { 26204 trimmedExcerpt = rawText.split(" ", excerptLength).join(" "); 26205 } else if (wordCountType === "characters_excluding_spaces") { 26206 const textWithSpaces = rawText.split("", excerptLength).join(""); 26207 const numberOfSpaces = textWithSpaces.length - textWithSpaces.replaceAll(" ", "").length; 26208 trimmedExcerpt = rawText.split("", excerptLength + numberOfSpaces).join(""); 26209 } else if (wordCountType === "characters_including_spaces") { 26210 trimmedExcerpt = rawText.split("", excerptLength).join(""); 26211 } 26212 const isTrimmed = trimmedExcerpt !== rawText; 26213 return isTrimmed ? trimmedExcerpt + "\u2026" : trimmedExcerpt; 26214 } 26215 function focusCommentThread(commentId, threadContainer, additionalSelector) { 26216 if (!threadContainer) { 26217 return; 26218 } 26219 const threadSelector = commentId ? `[role=treeitem][id="comment-thread-$commentId}"]` : "[role=treeitem]:not([id])"; 26220 const selector = additionalSelector ? `$threadSelector} $additionalSelector}` : threadSelector; 26221 return new Promise((resolve) => { 26222 const container = threadContainer.closest( 26223 ".interface-interface-skeleton__sidebar" 26224 ); 26225 if (container.querySelector(selector)) { 26226 return resolve(container.querySelector(selector)); 26227 } 26228 let timer = null; 26229 const observer = new window.MutationObserver(() => { 26230 if (container.querySelector(selector)) { 26231 clearTimeout(timer); 26232 observer.disconnect(); 26233 resolve(container.querySelector(selector)); 26234 } 26235 }); 26236 observer.observe(container, { 26237 childList: true, 26238 subtree: true 26239 }); 26240 timer = setTimeout(() => { 26241 observer.disconnect(); 26242 resolve(null); 26243 }, 3e3); 26244 }).then((element) => element?.focus()); 26245 } 26246 26247 26248 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-author-info.js 26249 26250 26251 26252 26253 26254 26255 26256 26257 function CommentAuthorInfo({ avatar, name, date, userId }) { 26258 const hasAvatar = !!avatar; 26259 const dateSettings = (0,external_wp_date_namespaceObject.getSettings)(); 26260 const { 26261 currentUserAvatar, 26262 currentUserName, 26263 currentUserId, 26264 dateFormat = dateSettings.formats.date 26265 } = (0,external_wp_data_namespaceObject.useSelect)( 26266 (select) => { 26267 const { canUser, getCurrentUser, getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 26268 const siteSettings = canUser("read", { 26269 kind: "root", 26270 name: "site" 26271 }) ? getEntityRecord("root", "site") : void 0; 26272 if (hasAvatar) { 26273 return { 26274 dateFormat: siteSettings?.date_format 26275 }; 26276 } 26277 const { getSettings } = select(external_wp_blockEditor_namespaceObject.store); 26278 const { __experimentalDiscussionSettings } = getSettings(); 26279 const defaultAvatar = __experimentalDiscussionSettings?.avatarURL; 26280 const userData = getCurrentUser(); 26281 return { 26282 currentUserAvatar: userData?.avatar_urls?.[48] ?? defaultAvatar, 26283 currentUserName: userData?.name, 26284 currentUserId: userData?.id, 26285 dateFormat: siteSettings?.date_format 26286 }; 26287 }, 26288 [hasAvatar] 26289 ); 26290 const commentDate = (0,external_wp_date_namespaceObject.getDate)(date); 26291 const commentDateTime = (0,external_wp_date_namespaceObject.dateI18n)("c", commentDate); 26292 const shouldShowHumanTimeDiff = Math.floor((/* @__PURE__ */ new Date() - commentDate) / (1e3 * 60 * 60 * 24)) < 30; 26293 const commentDateText = shouldShowHumanTimeDiff ? (0,external_wp_date_namespaceObject.humanTimeDiff)(commentDate) : (0,external_wp_date_namespaceObject.dateI18n)(dateFormat, commentDate); 26294 const tooltipText = (0,external_wp_date_namespaceObject.dateI18n)( 26295 // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate. 26296 (0,external_wp_i18n_namespaceObject._x)("F j, Y g:i\xA0a", "Note date full date format"), 26297 date 26298 ); 26299 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 26300 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26301 "img", 26302 { 26303 src: avatar || currentUserAvatar, 26304 className: "editor-collab-sidebar-panel__user-avatar", 26305 alt: (0,external_wp_i18n_namespaceObject.__)("User avatar"), 26306 width: 32, 26307 height: 32, 26308 style: { 26309 borderColor: getAvatarBorderColor( 26310 userId ?? currentUserId 26311 ) 26312 } 26313 } 26314 ), 26315 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "0", children: [ 26316 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { className: "editor-collab-sidebar-panel__user-name", children: name ?? currentUserName }), 26317 date && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { text: tooltipText, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26318 "time", 26319 { 26320 dateTime: commentDateTime, 26321 className: "editor-collab-sidebar-panel__user-time", 26322 children: commentDateText 26323 } 26324 ) }) 26325 ] }) 26326 ] }); 26327 } 26328 var comment_author_info_default = CommentAuthorInfo; 26329 26330 26331 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-form.js 26332 26333 26334 26335 26336 26337 26338 26339 function CommentForm({ 26340 onSubmit, 26341 onCancel, 26342 thread, 26343 submitButtonText, 26344 labelText, 26345 reflowComments = utils_noop 26346 }) { 26347 const [inputComment, setInputComment] = (0,external_wp_element_namespaceObject.useState)( 26348 thread?.content?.raw ?? "" 26349 ); 26350 const debouncedCommentUpdated = (0,external_wp_compose_namespaceObject.useDebounce)(reflowComments, 100); 26351 const updateComment = (value) => { 26352 setInputComment(value); 26353 }; 26354 const inputId = (0,external_wp_compose_namespaceObject.useInstanceId)(CommentForm, "comment-input"); 26355 const isDisabled = inputComment === thread?.content?.raw || !sanitizeCommentString(inputComment).length; 26356 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 26357 external_wp_components_namespaceObject.__experimentalVStack, 26358 { 26359 className: "editor-collab-sidebar-panel__comment-form", 26360 spacing: "4", 26361 children: [ 26362 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { as: "label", htmlFor: inputId, children: labelText ?? (0,external_wp_i18n_namespaceObject.__)("Note") }), 26363 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26364 lib/* default */.A, 26365 { 26366 id: inputId, 26367 value: inputComment ?? "", 26368 onChange: (comment) => { 26369 updateComment(comment.target.value); 26370 debouncedCommentUpdated(); 26371 }, 26372 rows: 1, 26373 maxRows: 20 26374 } 26375 ), 26376 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: "2", justify: "flex-end", wrap: true, children: [ 26377 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { size: "compact", variant: "tertiary", onClick: onCancel, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: (0,external_wp_i18n_namespaceObject.__)("Cancel") }) }), 26378 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 26379 external_wp_components_namespaceObject.Button, 26380 { 26381 size: "compact", 26382 accessibleWhenDisabled: true, 26383 variant: "primary", 26384 onClick: () => { 26385 onSubmit(inputComment); 26386 setInputComment(""); 26387 }, 26388 disabled: isDisabled, 26389 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, { children: submitButtonText }) 26390 } 26391 ) 26392 ] }) 26393 ] 26394 } 26395 ); 26396 } 26397 var comment_form_default = CommentForm; 26398 26399 26400 ;// ./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 26401 const floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); 26402 const alignments = (/* unused pure expression or super */ null && (['start', 'end'])); 26403 const floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []))); 26404 const floating_ui_utils_min = Math.min; 26405 const floating_ui_utils_max = Math.max; 26406 const round = Math.round; 26407 const floor = Math.floor; 26408 const createCoords = v => ({ 26409 x: v, 26410 y: v 26411 }); 26412 const oppositeSideMap = { 26413 left: 'right', 26414 right: 'left', 26415 bottom: 'top', 26416 top: 'bottom' 26417 }; 26418 const oppositeAlignmentMap = { 26419 start: 'end', 26420 end: 'start' 26421 }; 26422 function floating_ui_utils_clamp(start, value, end) { 26423 return floating_ui_utils_max(start, floating_ui_utils_min(value, end)); 26424 } 26425 function floating_ui_utils_evaluate(value, param) { 26426 return typeof value === 'function' ? value(param) : value; 26427 } 26428 function floating_ui_utils_getSide(placement) { 26429 return placement.split('-')[0]; 26430 } 26431 function floating_ui_utils_getAlignment(placement) { 26432 return placement.split('-')[1]; 26433 } 26434 function floating_ui_utils_getOppositeAxis(axis) { 26435 return axis === 'x' ? 'y' : 'x'; 26436 } 26437 function floating_ui_utils_getAxisLength(axis) { 26438 return axis === 'y' ? 'height' : 'width'; 26439 } 26440 function floating_ui_utils_getSideAxis(placement) { 26441 return ['top', 'bottom'].includes(floating_ui_utils_getSide(placement)) ? 'y' : 'x'; 26442 } 26443 function floating_ui_utils_getAlignmentAxis(placement) { 26444 return floating_ui_utils_getOppositeAxis(floating_ui_utils_getSideAxis(placement)); 26445 } 26446 function floating_ui_utils_getAlignmentSides(placement, rects, rtl) { 26447 if (rtl === void 0) { 26448 rtl = false; 26449 } 26450 const alignment = floating_ui_utils_getAlignment(placement); 26451 const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement); 26452 const length = floating_ui_utils_getAxisLength(alignmentAxis); 26453 let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; 26454 if (rects.reference[length] > rects.floating[length]) { 26455 mainAlignmentSide = floating_ui_utils_getOppositePlacement(mainAlignmentSide); 26456 } 26457 return [mainAlignmentSide, floating_ui_utils_getOppositePlacement(mainAlignmentSide)]; 26458 } 26459 function floating_ui_utils_getExpandedPlacements(placement) { 26460 const oppositePlacement = floating_ui_utils_getOppositePlacement(placement); 26461 return [floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)]; 26462 } 26463 function floating_ui_utils_getOppositeAlignmentPlacement(placement) { 26464 return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]); 26465 } 26466 function getSideList(side, isStart, rtl) { 26467 const lr = ['left', 'right']; 26468 const rl = ['right', 'left']; 26469 const tb = ['top', 'bottom']; 26470 const bt = ['bottom', 'top']; 26471 switch (side) { 26472 case 'top': 26473 case 'bottom': 26474 if (rtl) return isStart ? rl : lr; 26475 return isStart ? lr : rl; 26476 case 'left': 26477 case 'right': 26478 return isStart ? tb : bt; 26479 default: 26480 return []; 26481 } 26482 } 26483 function floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 26484 const alignment = floating_ui_utils_getAlignment(placement); 26485 let list = getSideList(floating_ui_utils_getSide(placement), direction === 'start', rtl); 26486 if (alignment) { 26487 list = list.map(side => side + "-" + alignment); 26488 if (flipAlignment) { 26489 list = list.concat(list.map(floating_ui_utils_getOppositeAlignmentPlacement)); 26490 } 26491 } 26492 return list; 26493 } 26494 function floating_ui_utils_getOppositePlacement(placement) { 26495 return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]); 26496 } 26497 function expandPaddingObject(padding) { 26498 return { 26499 top: 0, 26500 right: 0, 26501 bottom: 0, 26502 left: 0, 26503 ...padding 26504 }; 26505 } 26506 function floating_ui_utils_getPaddingObject(padding) { 26507 return typeof padding !== 'number' ? expandPaddingObject(padding) : { 26508 top: padding, 26509 right: padding, 26510 bottom: padding, 26511 left: padding 26512 }; 26513 } 26514 function floating_ui_utils_rectToClientRect(rect) { 26515 return { 26516 ...rect, 26517 top: rect.y, 26518 left: rect.x, 26519 right: rect.x + rect.width, 26520 bottom: rect.y + rect.height 26521 }; 26522 } 26523 26524 26525 26526 ;// ./node_modules/@floating-ui/core/dist/floating-ui.core.mjs 26527 26528 26529 26530 function computeCoordsFromPlacement(_ref, placement, rtl) { 26531 let { 26532 reference, 26533 floating 26534 } = _ref; 26535 const sideAxis = floating_ui_utils_getSideAxis(placement); 26536 const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement); 26537 const alignLength = floating_ui_utils_getAxisLength(alignmentAxis); 26538 const side = floating_ui_utils_getSide(placement); 26539 const isVertical = sideAxis === 'y'; 26540 const commonX = reference.x + reference.width / 2 - floating.width / 2; 26541 const commonY = reference.y + reference.height / 2 - floating.height / 2; 26542 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 26543 let coords; 26544 switch (side) { 26545 case 'top': 26546 coords = { 26547 x: commonX, 26548 y: reference.y - floating.height 26549 }; 26550 break; 26551 case 'bottom': 26552 coords = { 26553 x: commonX, 26554 y: reference.y + reference.height 26555 }; 26556 break; 26557 case 'right': 26558 coords = { 26559 x: reference.x + reference.width, 26560 y: commonY 26561 }; 26562 break; 26563 case 'left': 26564 coords = { 26565 x: reference.x - floating.width, 26566 y: commonY 26567 }; 26568 break; 26569 default: 26570 coords = { 26571 x: reference.x, 26572 y: reference.y 26573 }; 26574 } 26575 switch (floating_ui_utils_getAlignment(placement)) { 26576 case 'start': 26577 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 26578 break; 26579 case 'end': 26580 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 26581 break; 26582 } 26583 return coords; 26584 } 26585 26586 /** 26587 * Computes the `x` and `y` coordinates that will place the floating element 26588 * next to a reference element when it is given a certain positioning strategy. 26589 * 26590 * This export does not have any `platform` interface logic. You will need to 26591 * write one for the platform you are using Floating UI with. 26592 */ 26593 const computePosition = async (reference, floating, config) => { 26594 const { 26595 placement = 'bottom', 26596 strategy = 'absolute', 26597 middleware = [], 26598 platform 26599 } = config; 26600 const validMiddleware = middleware.filter(Boolean); 26601 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); 26602 let rects = await platform.getElementRects({ 26603 reference, 26604 floating, 26605 strategy 26606 }); 26607 let { 26608 x, 26609 y 26610 } = computeCoordsFromPlacement(rects, placement, rtl); 26611 let statefulPlacement = placement; 26612 let middlewareData = {}; 26613 let resetCount = 0; 26614 for (let i = 0; i < validMiddleware.length; i++) { 26615 const { 26616 name, 26617 fn 26618 } = validMiddleware[i]; 26619 const { 26620 x: nextX, 26621 y: nextY, 26622 data, 26623 reset 26624 } = await fn({ 26625 x, 26626 y, 26627 initialPlacement: placement, 26628 placement: statefulPlacement, 26629 strategy, 26630 middlewareData, 26631 rects, 26632 platform, 26633 elements: { 26634 reference, 26635 floating 26636 } 26637 }); 26638 x = nextX != null ? nextX : x; 26639 y = nextY != null ? nextY : y; 26640 middlewareData = { 26641 ...middlewareData, 26642 [name]: { 26643 ...middlewareData[name], 26644 ...data 26645 } 26646 }; 26647 if (reset && resetCount <= 50) { 26648 resetCount++; 26649 if (typeof reset === 'object') { 26650 if (reset.placement) { 26651 statefulPlacement = reset.placement; 26652 } 26653 if (reset.rects) { 26654 rects = reset.rects === true ? await platform.getElementRects({ 26655 reference, 26656 floating, 26657 strategy 26658 }) : reset.rects; 26659 } 26660 ({ 26661 x, 26662 y 26663 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 26664 } 26665 i = -1; 26666 continue; 26667 } 26668 } 26669 return { 26670 x, 26671 y, 26672 placement: statefulPlacement, 26673 strategy, 26674 middlewareData 26675 }; 26676 }; 26677 26678 /** 26679 * Resolves with an object of overflow side offsets that determine how much the 26680 * element is overflowing a given clipping boundary on each side. 26681 * - positive = overflowing the boundary by that number of pixels 26682 * - negative = how many pixels left before it will overflow 26683 * - 0 = lies flush with the boundary 26684 * @see https://floating-ui.com/docs/detectOverflow 26685 */ 26686 async function detectOverflow(state, options) { 26687 var _await$platform$isEle; 26688 if (options === void 0) { 26689 options = {}; 26690 } 26691 const { 26692 x, 26693 y, 26694 platform, 26695 rects, 26696 elements, 26697 strategy 26698 } = state; 26699 const { 26700 boundary = 'clippingAncestors', 26701 rootBoundary = 'viewport', 26702 elementContext = 'floating', 26703 altBoundary = false, 26704 padding = 0 26705 } = evaluate(options, state); 26706 const paddingObject = getPaddingObject(padding); 26707 const altContext = elementContext === 'floating' ? 'reference' : 'floating'; 26708 const element = elements[altBoundary ? altContext : elementContext]; 26709 const clippingClientRect = rectToClientRect(await platform.getClippingRect({ 26710 element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))), 26711 boundary, 26712 rootBoundary, 26713 strategy 26714 })); 26715 const rect = elementContext === 'floating' ? { 26716 ...rects.floating, 26717 x, 26718 y 26719 } : rects.reference; 26720 const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); 26721 const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || { 26722 x: 1, 26723 y: 1 26724 } : { 26725 x: 1, 26726 y: 1 26727 }; 26728 const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ 26729 rect, 26730 offsetParent, 26731 strategy 26732 }) : rect); 26733 return { 26734 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 26735 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 26736 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 26737 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 26738 }; 26739 } 26740 26741 /** 26742 * Provides data to position an inner element of the floating element so that it 26743 * appears centered to the reference element. 26744 * @see https://floating-ui.com/docs/arrow 26745 */ 26746 const arrow = options => ({ 26747 name: 'arrow', 26748 options, 26749 async fn(state) { 26750 const { 26751 x, 26752 y, 26753 placement, 26754 rects, 26755 platform, 26756 elements, 26757 middlewareData 26758 } = state; 26759 // Since `element` is required, we don't Partial<> the type. 26760 const { 26761 element, 26762 padding = 0 26763 } = evaluate(options, state) || {}; 26764 if (element == null) { 26765 return {}; 26766 } 26767 const paddingObject = getPaddingObject(padding); 26768 const coords = { 26769 x, 26770 y 26771 }; 26772 const axis = getAlignmentAxis(placement); 26773 const length = getAxisLength(axis); 26774 const arrowDimensions = await platform.getDimensions(element); 26775 const isYAxis = axis === 'y'; 26776 const minProp = isYAxis ? 'top' : 'left'; 26777 const maxProp = isYAxis ? 'bottom' : 'right'; 26778 const clientProp = isYAxis ? 'clientHeight' : 'clientWidth'; 26779 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 26780 const startDiff = coords[axis] - rects.reference[axis]; 26781 const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); 26782 let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; 26783 26784 // DOM platform can return `window` as the `offsetParent`. 26785 if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) { 26786 clientSize = elements.floating[clientProp] || rects.floating[length]; 26787 } 26788 const centerToReference = endDiff / 2 - startDiff / 2; 26789 26790 // If the padding is large enough that it causes the arrow to no longer be 26791 // centered, modify the padding so that it is centered. 26792 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 26793 const minPadding = min(paddingObject[minProp], largestPossiblePadding); 26794 const maxPadding = min(paddingObject[maxProp], largestPossiblePadding); 26795 26796 // Make sure the arrow doesn't overflow the floating element if the center 26797 // point is outside the floating element's bounds. 26798 const min$1 = minPadding; 26799 const max = clientSize - arrowDimensions[length] - maxPadding; 26800 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 26801 const offset = clamp(min$1, center, max); 26802 26803 // If the reference is small enough that the arrow's padding causes it to 26804 // to point to nothing for an aligned placement, adjust the offset of the 26805 // floating element itself. To ensure `shift()` continues to take action, 26806 // a single reset is performed when this is true. 26807 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 26808 const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0; 26809 return { 26810 [axis]: coords[axis] + alignmentOffset, 26811 data: { 26812 [axis]: offset, 26813 centerOffset: center - offset - alignmentOffset, 26814 ...(shouldAddOffset && { 26815 alignmentOffset 26816 }) 26817 }, 26818 reset: shouldAddOffset 26819 }; 26820 } 26821 }); 26822 26823 function getPlacementList(alignment, autoAlignment, allowedPlacements) { 26824 const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement); 26825 return allowedPlacementsSortedByAlignment.filter(placement => { 26826 if (alignment) { 26827 return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false); 26828 } 26829 return true; 26830 }); 26831 } 26832 /** 26833 * Optimizes the visibility of the floating element by choosing the placement 26834 * that has the most space available automatically, without needing to specify a 26835 * preferred placement. Alternative to `flip`. 26836 * @see https://floating-ui.com/docs/autoPlacement 26837 */ 26838 const autoPlacement = function (options) { 26839 if (options === void 0) { 26840 options = {}; 26841 } 26842 return { 26843 name: 'autoPlacement', 26844 options, 26845 async fn(state) { 26846 var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE; 26847 const { 26848 rects, 26849 middlewareData, 26850 placement, 26851 platform, 26852 elements 26853 } = state; 26854 const { 26855 crossAxis = false, 26856 alignment, 26857 allowedPlacements = placements, 26858 autoAlignment = true, 26859 ...detectOverflowOptions 26860 } = evaluate(options, state); 26861 const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements; 26862 const overflow = await detectOverflow(state, detectOverflowOptions); 26863 const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0; 26864 const currentPlacement = placements$1[currentIndex]; 26865 if (currentPlacement == null) { 26866 return {}; 26867 } 26868 const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); 26869 26870 // Make `computeCoords` start from the right place. 26871 if (placement !== currentPlacement) { 26872 return { 26873 reset: { 26874 placement: placements$1[0] 26875 } 26876 }; 26877 } 26878 const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]]; 26879 const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), { 26880 placement: currentPlacement, 26881 overflows: currentOverflows 26882 }]; 26883 const nextPlacement = placements$1[currentIndex + 1]; 26884 26885 // There are more placements to check. 26886 if (nextPlacement) { 26887 return { 26888 data: { 26889 index: currentIndex + 1, 26890 overflows: allOverflows 26891 }, 26892 reset: { 26893 placement: nextPlacement 26894 } 26895 }; 26896 } 26897 const placementsSortedByMostSpace = allOverflows.map(d => { 26898 const alignment = getAlignment(d.placement); 26899 return [d.placement, alignment && crossAxis ? 26900 // Check along the mainAxis and main crossAxis side. 26901 d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : 26902 // Check only the mainAxis. 26903 d.overflows[0], d.overflows]; 26904 }).sort((a, b) => a[1] - b[1]); 26905 const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0, 26906 // Aligned placements should not check their opposite crossAxis 26907 // side. 26908 getAlignment(d[0]) ? 2 : 3).every(v => v <= 0)); 26909 const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0]; 26910 if (resetPlacement !== placement) { 26911 return { 26912 data: { 26913 index: currentIndex + 1, 26914 overflows: allOverflows 26915 }, 26916 reset: { 26917 placement: resetPlacement 26918 } 26919 }; 26920 } 26921 return {}; 26922 } 26923 }; 26924 }; 26925 26926 /** 26927 * Optimizes the visibility of the floating element by flipping the `placement` 26928 * in order to keep it in view when the preferred placement(s) will overflow the 26929 * clipping boundary. Alternative to `autoPlacement`. 26930 * @see https://floating-ui.com/docs/flip 26931 */ 26932 const flip = function (options) { 26933 if (options === void 0) { 26934 options = {}; 26935 } 26936 return { 26937 name: 'flip', 26938 options, 26939 async fn(state) { 26940 var _middlewareData$arrow, _middlewareData$flip; 26941 const { 26942 placement, 26943 middlewareData, 26944 rects, 26945 initialPlacement, 26946 platform, 26947 elements 26948 } = state; 26949 const { 26950 mainAxis: checkMainAxis = true, 26951 crossAxis: checkCrossAxis = true, 26952 fallbackPlacements: specifiedFallbackPlacements, 26953 fallbackStrategy = 'bestFit', 26954 fallbackAxisSideDirection = 'none', 26955 flipAlignment = true, 26956 ...detectOverflowOptions 26957 } = evaluate(options, state); 26958 26959 // If a reset by the arrow was caused due to an alignment offset being 26960 // added, we should skip any logic now since `flip()` has already done its 26961 // work. 26962 // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643 26963 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 26964 return {}; 26965 } 26966 const side = getSide(placement); 26967 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 26968 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 26969 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 26970 if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') { 26971 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 26972 } 26973 const placements = [initialPlacement, ...fallbackPlacements]; 26974 const overflow = await detectOverflow(state, detectOverflowOptions); 26975 const overflows = []; 26976 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 26977 if (checkMainAxis) { 26978 overflows.push(overflow[side]); 26979 } 26980 if (checkCrossAxis) { 26981 const sides = getAlignmentSides(placement, rects, rtl); 26982 overflows.push(overflow[sides[0]], overflow[sides[1]]); 26983 } 26984 overflowsData = [...overflowsData, { 26985 placement, 26986 overflows 26987 }]; 26988 26989 // One or more sides is overflowing. 26990 if (!overflows.every(side => side <= 0)) { 26991 var _middlewareData$flip2, _overflowsData$filter; 26992 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 26993 const nextPlacement = placements[nextIndex]; 26994 if (nextPlacement) { 26995 // Try next placement and re-run the lifecycle. 26996 return { 26997 data: { 26998 index: nextIndex, 26999 overflows: overflowsData 27000 }, 27001 reset: { 27002 placement: nextPlacement 27003 } 27004 }; 27005 } 27006 27007 // First, find the candidates that fit on the mainAxis side of overflow, 27008 // then find the placement that fits the best on the main crossAxis side. 27009 let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 27010 27011 // Otherwise fallback. 27012 if (!resetPlacement) { 27013 switch (fallbackStrategy) { 27014 case 'bestFit': 27015 { 27016 var _overflowsData$map$so; 27017 const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; 27018 if (placement) { 27019 resetPlacement = placement; 27020 } 27021 break; 27022 } 27023 case 'initialPlacement': 27024 resetPlacement = initialPlacement; 27025 break; 27026 } 27027 } 27028 if (placement !== resetPlacement) { 27029 return { 27030 reset: { 27031 placement: resetPlacement 27032 } 27033 }; 27034 } 27035 } 27036 return {}; 27037 } 27038 }; 27039 }; 27040 27041 function getSideOffsets(overflow, rect) { 27042 return { 27043 top: overflow.top - rect.height, 27044 right: overflow.right - rect.width, 27045 bottom: overflow.bottom - rect.height, 27046 left: overflow.left - rect.width 27047 }; 27048 } 27049 function isAnySideFullyClipped(overflow) { 27050 return sides.some(side => overflow[side] >= 0); 27051 } 27052 /** 27053 * Provides data to hide the floating element in applicable situations, such as 27054 * when it is not in the same clipping context as the reference element. 27055 * @see https://floating-ui.com/docs/hide 27056 */ 27057 const hide = function (options) { 27058 if (options === void 0) { 27059 options = {}; 27060 } 27061 return { 27062 name: 'hide', 27063 options, 27064 async fn(state) { 27065 const { 27066 rects 27067 } = state; 27068 const { 27069 strategy = 'referenceHidden', 27070 ...detectOverflowOptions 27071 } = evaluate(options, state); 27072 switch (strategy) { 27073 case 'referenceHidden': 27074 { 27075 const overflow = await detectOverflow(state, { 27076 ...detectOverflowOptions, 27077 elementContext: 'reference' 27078 }); 27079 const offsets = getSideOffsets(overflow, rects.reference); 27080 return { 27081 data: { 27082 referenceHiddenOffsets: offsets, 27083 referenceHidden: isAnySideFullyClipped(offsets) 27084 } 27085 }; 27086 } 27087 case 'escaped': 27088 { 27089 const overflow = await detectOverflow(state, { 27090 ...detectOverflowOptions, 27091 altBoundary: true 27092 }); 27093 const offsets = getSideOffsets(overflow, rects.floating); 27094 return { 27095 data: { 27096 escapedOffsets: offsets, 27097 escaped: isAnySideFullyClipped(offsets) 27098 } 27099 }; 27100 } 27101 default: 27102 { 27103 return {}; 27104 } 27105 } 27106 } 27107 }; 27108 }; 27109 27110 function getBoundingRect(rects) { 27111 const minX = min(...rects.map(rect => rect.left)); 27112 const minY = min(...rects.map(rect => rect.top)); 27113 const maxX = max(...rects.map(rect => rect.right)); 27114 const maxY = max(...rects.map(rect => rect.bottom)); 27115 return { 27116 x: minX, 27117 y: minY, 27118 width: maxX - minX, 27119 height: maxY - minY 27120 }; 27121 } 27122 function getRectsByLine(rects) { 27123 const sortedRects = rects.slice().sort((a, b) => a.y - b.y); 27124 const groups = []; 27125 let prevRect = null; 27126 for (let i = 0; i < sortedRects.length; i++) { 27127 const rect = sortedRects[i]; 27128 if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) { 27129 groups.push([rect]); 27130 } else { 27131 groups[groups.length - 1].push(rect); 27132 } 27133 prevRect = rect; 27134 } 27135 return groups.map(rect => rectToClientRect(getBoundingRect(rect))); 27136 } 27137 /** 27138 * Provides improved positioning for inline reference elements that can span 27139 * over multiple lines, such as hyperlinks or range selections. 27140 * @see https://floating-ui.com/docs/inline 27141 */ 27142 const inline = function (options) { 27143 if (options === void 0) { 27144 options = {}; 27145 } 27146 return { 27147 name: 'inline', 27148 options, 27149 async fn(state) { 27150 const { 27151 placement, 27152 elements, 27153 rects, 27154 platform, 27155 strategy 27156 } = state; 27157 // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a 27158 // ClientRect's bounds, despite the event listener being triggered. A 27159 // padding of 2 seems to handle this issue. 27160 const { 27161 padding = 2, 27162 x, 27163 y 27164 } = evaluate(options, state); 27165 const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []); 27166 const clientRects = getRectsByLine(nativeClientRects); 27167 const fallback = rectToClientRect(getBoundingRect(nativeClientRects)); 27168 const paddingObject = getPaddingObject(padding); 27169 function getBoundingClientRect() { 27170 // There are two rects and they are disjoined. 27171 if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) { 27172 // Find the first rect in which the point is fully inside. 27173 return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback; 27174 } 27175 27176 // There are 2 or more connected rects. 27177 if (clientRects.length >= 2) { 27178 if (getSideAxis(placement) === 'y') { 27179 const firstRect = clientRects[0]; 27180 const lastRect = clientRects[clientRects.length - 1]; 27181 const isTop = getSide(placement) === 'top'; 27182 const top = firstRect.top; 27183 const bottom = lastRect.bottom; 27184 const left = isTop ? firstRect.left : lastRect.left; 27185 const right = isTop ? firstRect.right : lastRect.right; 27186 const width = right - left; 27187 const height = bottom - top; 27188 return { 27189 top, 27190 bottom, 27191 left, 27192 right, 27193 width, 27194 height, 27195 x: left, 27196 y: top 27197 }; 27198 } 27199 const isLeftSide = getSide(placement) === 'left'; 27200 const maxRight = max(...clientRects.map(rect => rect.right)); 27201 const minLeft = min(...clientRects.map(rect => rect.left)); 27202 const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight); 27203 const top = measureRects[0].top; 27204 const bottom = measureRects[measureRects.length - 1].bottom; 27205 const left = minLeft; 27206 const right = maxRight; 27207 const width = right - left; 27208 const height = bottom - top; 27209 return { 27210 top, 27211 bottom, 27212 left, 27213 right, 27214 width, 27215 height, 27216 x: left, 27217 y: top 27218 }; 27219 } 27220 return fallback; 27221 } 27222 const resetRects = await platform.getElementRects({ 27223 reference: { 27224 getBoundingClientRect 27225 }, 27226 floating: elements.floating, 27227 strategy 27228 }); 27229 if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) { 27230 return { 27231 reset: { 27232 rects: resetRects 27233 } 27234 }; 27235 } 27236 return {}; 27237 } 27238 }; 27239 }; 27240 27241 // For type backwards-compatibility, the `OffsetOptions` type was also 27242 // Derivable. 27243 async function convertValueToCoords(state, options) { 27244 const { 27245 placement, 27246 platform, 27247 elements 27248 } = state; 27249 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 27250 const side = floating_ui_utils_getSide(placement); 27251 const alignment = floating_ui_utils_getAlignment(placement); 27252 const isVertical = floating_ui_utils_getSideAxis(placement) === 'y'; 27253 const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1; 27254 const crossAxisMulti = rtl && isVertical ? -1 : 1; 27255 const rawValue = floating_ui_utils_evaluate(options, state); 27256 27257 // eslint-disable-next-line prefer-const 27258 let { 27259 mainAxis, 27260 crossAxis, 27261 alignmentAxis 27262 } = typeof rawValue === 'number' ? { 27263 mainAxis: rawValue, 27264 crossAxis: 0, 27265 alignmentAxis: null 27266 } : { 27267 mainAxis: 0, 27268 crossAxis: 0, 27269 alignmentAxis: null, 27270 ...rawValue 27271 }; 27272 if (alignment && typeof alignmentAxis === 'number') { 27273 crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis; 27274 } 27275 return isVertical ? { 27276 x: crossAxis * crossAxisMulti, 27277 y: mainAxis * mainAxisMulti 27278 } : { 27279 x: mainAxis * mainAxisMulti, 27280 y: crossAxis * crossAxisMulti 27281 }; 27282 } 27283 27284 /** 27285 * Modifies the placement by translating the floating element along the 27286 * specified axes. 27287 * A number (shorthand for `mainAxis` or distance), or an axes configuration 27288 * object may be passed. 27289 * @see https://floating-ui.com/docs/offset 27290 */ 27291 const offset = function (options) { 27292 if (options === void 0) { 27293 options = 0; 27294 } 27295 return { 27296 name: 'offset', 27297 options, 27298 async fn(state) { 27299 const { 27300 x, 27301 y 27302 } = state; 27303 const diffCoords = await convertValueToCoords(state, options); 27304 return { 27305 x: x + diffCoords.x, 27306 y: y + diffCoords.y, 27307 data: diffCoords 27308 }; 27309 } 27310 }; 27311 }; 27312 27313 /** 27314 * Optimizes the visibility of the floating element by shifting it in order to 27315 * keep it in view when it will overflow the clipping boundary. 27316 * @see https://floating-ui.com/docs/shift 27317 */ 27318 const shift = function (options) { 27319 if (options === void 0) { 27320 options = {}; 27321 } 27322 return { 27323 name: 'shift', 27324 options, 27325 async fn(state) { 27326 const { 27327 x, 27328 y, 27329 placement 27330 } = state; 27331 const { 27332 mainAxis: checkMainAxis = true, 27333 crossAxis: checkCrossAxis = false, 27334 limiter = { 27335 fn: _ref => { 27336 let { 27337 x, 27338 y 27339 } = _ref; 27340 return { 27341 x, 27342 y 27343 }; 27344 } 27345 }, 27346 ...detectOverflowOptions 27347 } = evaluate(options, state); 27348 const coords = { 27349 x, 27350 y 27351 }; 27352 const overflow = await detectOverflow(state, detectOverflowOptions); 27353 const crossAxis = getSideAxis(getSide(placement)); 27354 const mainAxis = getOppositeAxis(crossAxis); 27355 let mainAxisCoord = coords[mainAxis]; 27356 let crossAxisCoord = coords[crossAxis]; 27357 if (checkMainAxis) { 27358 const minSide = mainAxis === 'y' ? 'top' : 'left'; 27359 const maxSide = mainAxis === 'y' ? 'bottom' : 'right'; 27360 const min = mainAxisCoord + overflow[minSide]; 27361 const max = mainAxisCoord - overflow[maxSide]; 27362 mainAxisCoord = clamp(min, mainAxisCoord, max); 27363 } 27364 if (checkCrossAxis) { 27365 const minSide = crossAxis === 'y' ? 'top' : 'left'; 27366 const maxSide = crossAxis === 'y' ? 'bottom' : 'right'; 27367 const min = crossAxisCoord + overflow[minSide]; 27368 const max = crossAxisCoord - overflow[maxSide]; 27369 crossAxisCoord = clamp(min, crossAxisCoord, max); 27370 } 27371 const limitedCoords = limiter.fn({ 27372 ...state, 27373 [mainAxis]: mainAxisCoord, 27374 [crossAxis]: crossAxisCoord 27375 }); 27376 return { 27377 ...limitedCoords, 27378 data: { 27379 x: limitedCoords.x - x, 27380 y: limitedCoords.y - y 27381 } 27382 }; 27383 } 27384 }; 27385 }; 27386 /** 27387 * Built-in `limiter` that will stop `shift()` at a certain point. 27388 */ 27389 const limitShift = function (options) { 27390 if (options === void 0) { 27391 options = {}; 27392 } 27393 return { 27394 options, 27395 fn(state) { 27396 const { 27397 x, 27398 y, 27399 placement, 27400 rects, 27401 middlewareData 27402 } = state; 27403 const { 27404 offset = 0, 27405 mainAxis: checkMainAxis = true, 27406 crossAxis: checkCrossAxis = true 27407 } = evaluate(options, state); 27408 const coords = { 27409 x, 27410 y 27411 }; 27412 const crossAxis = getSideAxis(placement); 27413 const mainAxis = getOppositeAxis(crossAxis); 27414 let mainAxisCoord = coords[mainAxis]; 27415 let crossAxisCoord = coords[crossAxis]; 27416 const rawOffset = evaluate(offset, state); 27417 const computedOffset = typeof rawOffset === 'number' ? { 27418 mainAxis: rawOffset, 27419 crossAxis: 0 27420 } : { 27421 mainAxis: 0, 27422 crossAxis: 0, 27423 ...rawOffset 27424 }; 27425 if (checkMainAxis) { 27426 const len = mainAxis === 'y' ? 'height' : 'width'; 27427 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 27428 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 27429 if (mainAxisCoord < limitMin) { 27430 mainAxisCoord = limitMin; 27431 } else if (mainAxisCoord > limitMax) { 27432 mainAxisCoord = limitMax; 27433 } 27434 } 27435 if (checkCrossAxis) { 27436 var _middlewareData$offse, _middlewareData$offse2; 27437 const len = mainAxis === 'y' ? 'width' : 'height'; 27438 const isOriginSide = ['top', 'left'].includes(getSide(placement)); 27439 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); 27440 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); 27441 if (crossAxisCoord < limitMin) { 27442 crossAxisCoord = limitMin; 27443 } else if (crossAxisCoord > limitMax) { 27444 crossAxisCoord = limitMax; 27445 } 27446 } 27447 return { 27448 [mainAxis]: mainAxisCoord, 27449 [crossAxis]: crossAxisCoord 27450 }; 27451 } 27452 }; 27453 }; 27454 27455 /** 27456 * Provides data that allows you to change the size of the floating element — 27457 * for instance, prevent it from overflowing the clipping boundary or match the 27458 * width of the reference element. 27459 * @see https://floating-ui.com/docs/size 27460 */ 27461 const size = function (options) { 27462 if (options === void 0) { 27463 options = {}; 27464 } 27465 return { 27466 name: 'size', 27467 options, 27468 async fn(state) { 27469 const { 27470 placement, 27471 rects, 27472 platform, 27473 elements 27474 } = state; 27475 const { 27476 apply = () => {}, 27477 ...detectOverflowOptions 27478 } = evaluate(options, state); 27479 const overflow = await detectOverflow(state, detectOverflowOptions); 27480 const side = getSide(placement); 27481 const alignment = getAlignment(placement); 27482 const isYAxis = getSideAxis(placement) === 'y'; 27483 const { 27484 width, 27485 height 27486 } = rects.floating; 27487 let heightSide; 27488 let widthSide; 27489 if (side === 'top' || side === 'bottom') { 27490 heightSide = side; 27491 widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right'; 27492 } else { 27493 widthSide = side; 27494 heightSide = alignment === 'end' ? 'top' : 'bottom'; 27495 } 27496 const overflowAvailableHeight = height - overflow[heightSide]; 27497 const overflowAvailableWidth = width - overflow[widthSide]; 27498 const noShift = !state.middlewareData.shift; 27499 let availableHeight = overflowAvailableHeight; 27500 let availableWidth = overflowAvailableWidth; 27501 if (isYAxis) { 27502 const maximumClippingWidth = width - overflow.left - overflow.right; 27503 availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth; 27504 } else { 27505 const maximumClippingHeight = height - overflow.top - overflow.bottom; 27506 availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight; 27507 } 27508 if (noShift && !alignment) { 27509 const xMin = max(overflow.left, 0); 27510 const xMax = max(overflow.right, 0); 27511 const yMin = max(overflow.top, 0); 27512 const yMax = max(overflow.bottom, 0); 27513 if (isYAxis) { 27514 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 27515 } else { 27516 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 27517 } 27518 } 27519 await apply({ 27520 ...state, 27521 availableWidth, 27522 availableHeight 27523 }); 27524 const nextDimensions = await platform.getDimensions(elements.floating); 27525 if (width !== nextDimensions.width || height !== nextDimensions.height) { 27526 return { 27527 reset: { 27528 rects: true 27529 } 27530 }; 27531 } 27532 return {}; 27533 } 27534 }; 27535 }; 27536 27537 27538 27539 ;// ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 27540 /** 27541 * Custom positioning reference element. 27542 * @see https://floating-ui.com/docs/virtual-elements 27543 */ 27544 27545 const dist_floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left'])); 27546 const floating_ui_utils_alignments = (/* unused pure expression or super */ null && (['start', 'end'])); 27547 const dist_floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (dist_floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + floating_ui_utils_alignments[0], side + "-" + floating_ui_utils_alignments[1]), []))); 27548 const dist_floating_ui_utils_min = Math.min; 27549 const dist_floating_ui_utils_max = Math.max; 27550 const floating_ui_utils_round = Math.round; 27551 const floating_ui_utils_floor = Math.floor; 27552 const floating_ui_utils_createCoords = v => ({ 27553 x: v, 27554 y: v 27555 }); 27556 const floating_ui_utils_oppositeSideMap = { 27557 left: 'right', 27558 right: 'left', 27559 bottom: 'top', 27560 top: 'bottom' 27561 }; 27562 const floating_ui_utils_oppositeAlignmentMap = { 27563 start: 'end', 27564 end: 'start' 27565 }; 27566 function dist_floating_ui_utils_clamp(start, value, end) { 27567 return dist_floating_ui_utils_max(start, dist_floating_ui_utils_min(value, end)); 27568 } 27569 function dist_floating_ui_utils_evaluate(value, param) { 27570 return typeof value === 'function' ? value(param) : value; 27571 } 27572 function dist_floating_ui_utils_getSide(placement) { 27573 return placement.split('-')[0]; 27574 } 27575 function dist_floating_ui_utils_getAlignment(placement) { 27576 return placement.split('-')[1]; 27577 } 27578 function dist_floating_ui_utils_getOppositeAxis(axis) { 27579 return axis === 'x' ? 'y' : 'x'; 27580 } 27581 function dist_floating_ui_utils_getAxisLength(axis) { 27582 return axis === 'y' ? 'height' : 'width'; 27583 } 27584 function dist_floating_ui_utils_getSideAxis(placement) { 27585 return ['top', 'bottom'].includes(dist_floating_ui_utils_getSide(placement)) ? 'y' : 'x'; 27586 } 27587 function dist_floating_ui_utils_getAlignmentAxis(placement) { 27588 return dist_floating_ui_utils_getOppositeAxis(dist_floating_ui_utils_getSideAxis(placement)); 27589 } 27590 function dist_floating_ui_utils_getAlignmentSides(placement, rects, rtl) { 27591 if (rtl === void 0) { 27592 rtl = false; 27593 } 27594 const alignment = dist_floating_ui_utils_getAlignment(placement); 27595 const alignmentAxis = dist_floating_ui_utils_getAlignmentAxis(placement); 27596 const length = dist_floating_ui_utils_getAxisLength(alignmentAxis); 27597 let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; 27598 if (rects.reference[length] > rects.floating[length]) { 27599 mainAlignmentSide = dist_floating_ui_utils_getOppositePlacement(mainAlignmentSide); 27600 } 27601 return [mainAlignmentSide, dist_floating_ui_utils_getOppositePlacement(mainAlignmentSide)]; 27602 } 27603 function dist_floating_ui_utils_getExpandedPlacements(placement) { 27604 const oppositePlacement = dist_floating_ui_utils_getOppositePlacement(placement); 27605 return [dist_floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, dist_floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)]; 27606 } 27607 function dist_floating_ui_utils_getOppositeAlignmentPlacement(placement) { 27608 return placement.replace(/start|end/g, alignment => floating_ui_utils_oppositeAlignmentMap[alignment]); 27609 } 27610 function floating_ui_utils_getSideList(side, isStart, rtl) { 27611 const lr = ['left', 'right']; 27612 const rl = ['right', 'left']; 27613 const tb = ['top', 'bottom']; 27614 const bt = ['bottom', 'top']; 27615 switch (side) { 27616 case 'top': 27617 case 'bottom': 27618 if (rtl) return isStart ? rl : lr; 27619 return isStart ? lr : rl; 27620 case 'left': 27621 case 'right': 27622 return isStart ? tb : bt; 27623 default: 27624 return []; 27625 } 27626 } 27627 function dist_floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 27628 const alignment = dist_floating_ui_utils_getAlignment(placement); 27629 let list = floating_ui_utils_getSideList(dist_floating_ui_utils_getSide(placement), direction === 'start', rtl); 27630 if (alignment) { 27631 list = list.map(side => side + "-" + alignment); 27632 if (flipAlignment) { 27633 list = list.concat(list.map(dist_floating_ui_utils_getOppositeAlignmentPlacement)); 27634 } 27635 } 27636 return list; 27637 } 27638 function dist_floating_ui_utils_getOppositePlacement(placement) { 27639 return placement.replace(/left|right|bottom|top/g, side => floating_ui_utils_oppositeSideMap[side]); 27640 } 27641 function floating_ui_utils_expandPaddingObject(padding) { 27642 return { 27643 top: 0, 27644 right: 0, 27645 bottom: 0, 27646 left: 0, 27647 ...padding 27648 }; 27649 } 27650 function dist_floating_ui_utils_getPaddingObject(padding) { 27651 return typeof padding !== 'number' ? floating_ui_utils_expandPaddingObject(padding) : { 27652 top: padding, 27653 right: padding, 27654 bottom: padding, 27655 left: padding 27656 }; 27657 } 27658 function dist_floating_ui_utils_rectToClientRect(rect) { 27659 const { 27660 x, 27661 y, 27662 width, 27663 height 27664 } = rect; 27665 return { 27666 width, 27667 height, 27668 top: y, 27669 left: x, 27670 right: x + width, 27671 bottom: y + height, 27672 x, 27673 y 27674 }; 27675 } 27676 27677 27678 27679 ;// ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 27680 function hasWindow() { 27681 return typeof window !== 'undefined'; 27682 } 27683 function getNodeName(node) { 27684 if (isNode(node)) { 27685 return (node.nodeName || '').toLowerCase(); 27686 } 27687 // Mocked nodes in testing environments may not be instances of Node. By 27688 // returning `#document` an infinite loop won't occur. 27689 // https://github.com/floating-ui/floating-ui/issues/2317 27690 return '#document'; 27691 } 27692 function getWindow(node) { 27693 var _node$ownerDocument; 27694 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 27695 } 27696 function getDocumentElement(node) { 27697 var _ref; 27698 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 27699 } 27700 function isNode(value) { 27701 if (!hasWindow()) { 27702 return false; 27703 } 27704 return value instanceof Node || value instanceof getWindow(value).Node; 27705 } 27706 function isElement(value) { 27707 if (!hasWindow()) { 27708 return false; 27709 } 27710 return value instanceof Element || value instanceof getWindow(value).Element; 27711 } 27712 function isHTMLElement(value) { 27713 if (!hasWindow()) { 27714 return false; 27715 } 27716 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 27717 } 27718 function isShadowRoot(value) { 27719 if (!hasWindow() || typeof ShadowRoot === 'undefined') { 27720 return false; 27721 } 27722 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 27723 } 27724 function isOverflowElement(element) { 27725 const { 27726 overflow, 27727 overflowX, 27728 overflowY, 27729 display 27730 } = getComputedStyle(element); 27731 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display); 27732 } 27733 function isTableElement(element) { 27734 return ['table', 'td', 'th'].includes(getNodeName(element)); 27735 } 27736 function isTopLayer(element) { 27737 return [':popover-open', ':modal'].some(selector => { 27738 try { 27739 return element.matches(selector); 27740 } catch (e) { 27741 return false; 27742 } 27743 }); 27744 } 27745 function isContainingBlock(elementOrCss) { 27746 const webkit = isWebKit(); 27747 const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; 27748 27749 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 27750 // https://drafts.csswg.org/css-transforms-2/#individual-transforms 27751 return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value)); 27752 } 27753 function getContainingBlock(element) { 27754 let currentNode = getParentNode(element); 27755 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 27756 if (isContainingBlock(currentNode)) { 27757 return currentNode; 27758 } else if (isTopLayer(currentNode)) { 27759 return null; 27760 } 27761 currentNode = getParentNode(currentNode); 27762 } 27763 return null; 27764 } 27765 function isWebKit() { 27766 if (typeof CSS === 'undefined' || !CSS.supports) return false; 27767 return CSS.supports('-webkit-backdrop-filter', 'none'); 27768 } 27769 function isLastTraversableNode(node) { 27770 return ['html', 'body', '#document'].includes(getNodeName(node)); 27771 } 27772 function getComputedStyle(element) { 27773 return getWindow(element).getComputedStyle(element); 27774 } 27775 function getNodeScroll(element) { 27776 if (isElement(element)) { 27777 return { 27778 scrollLeft: element.scrollLeft, 27779 scrollTop: element.scrollTop 27780 }; 27781 } 27782 return { 27783 scrollLeft: element.scrollX, 27784 scrollTop: element.scrollY 27785 }; 27786 } 27787 function getParentNode(node) { 27788 if (getNodeName(node) === 'html') { 27789 return node; 27790 } 27791 const result = 27792 // Step into the shadow DOM of the parent of a slotted node. 27793 node.assignedSlot || 27794 // DOM Element detected. 27795 node.parentNode || 27796 // ShadowRoot detected. 27797 isShadowRoot(node) && node.host || 27798 // Fallback. 27799 getDocumentElement(node); 27800 return isShadowRoot(result) ? result.host : result; 27801 } 27802 function getNearestOverflowAncestor(node) { 27803 const parentNode = getParentNode(node); 27804 if (isLastTraversableNode(parentNode)) { 27805 return node.ownerDocument ? node.ownerDocument.body : node.body; 27806 } 27807 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 27808 return parentNode; 27809 } 27810 return getNearestOverflowAncestor(parentNode); 27811 } 27812 function getOverflowAncestors(node, list, traverseIframes) { 27813 var _node$ownerDocument2; 27814 if (list === void 0) { 27815 list = []; 27816 } 27817 if (traverseIframes === void 0) { 27818 traverseIframes = true; 27819 } 27820 const scrollableAncestor = getNearestOverflowAncestor(node); 27821 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 27822 const win = getWindow(scrollableAncestor); 27823 if (isBody) { 27824 const frameElement = getFrameElement(win); 27825 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 27826 } 27827 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 27828 } 27829 function getFrameElement(win) { 27830 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 27831 } 27832 27833 27834 27835 ;// ./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 27836 27837 27838 27839 27840 27841 27842 function getCssDimensions(element) { 27843 const css = getComputedStyle(element); 27844 // In testing environments, the `width` and `height` properties are empty 27845 // strings for SVG elements, returning NaN. Fallback to `0` in this case. 27846 let width = parseFloat(css.width) || 0; 27847 let height = parseFloat(css.height) || 0; 27848 const hasOffset = isHTMLElement(element); 27849 const offsetWidth = hasOffset ? element.offsetWidth : width; 27850 const offsetHeight = hasOffset ? element.offsetHeight : height; 27851 const shouldFallback = floating_ui_utils_round(width) !== offsetWidth || floating_ui_utils_round(height) !== offsetHeight; 27852 if (shouldFallback) { 27853 width = offsetWidth; 27854 height = offsetHeight; 27855 } 27856 return { 27857 width, 27858 height, 27859 $: shouldFallback 27860 }; 27861 } 27862 27863 function unwrapElement(element) { 27864 return !isElement(element) ? element.contextElement : element; 27865 } 27866 27867 function getScale(element) { 27868 const domElement = unwrapElement(element); 27869 if (!isHTMLElement(domElement)) { 27870 return floating_ui_utils_createCoords(1); 27871 } 27872 const rect = domElement.getBoundingClientRect(); 27873 const { 27874 width, 27875 height, 27876 $ 27877 } = getCssDimensions(domElement); 27878 let x = ($ ? floating_ui_utils_round(rect.width) : rect.width) / width; 27879 let y = ($ ? floating_ui_utils_round(rect.height) : rect.height) / height; 27880 27881 // 0, NaN, or Infinity should always fallback to 1. 27882 27883 if (!x || !Number.isFinite(x)) { 27884 x = 1; 27885 } 27886 if (!y || !Number.isFinite(y)) { 27887 y = 1; 27888 } 27889 return { 27890 x, 27891 y 27892 }; 27893 } 27894 27895 const noOffsets = /*#__PURE__*/floating_ui_utils_createCoords(0); 27896 function getVisualOffsets(element) { 27897 const win = getWindow(element); 27898 if (!isWebKit() || !win.visualViewport) { 27899 return noOffsets; 27900 } 27901 return { 27902 x: win.visualViewport.offsetLeft, 27903 y: win.visualViewport.offsetTop 27904 }; 27905 } 27906 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 27907 if (isFixed === void 0) { 27908 isFixed = false; 27909 } 27910 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 27911 return false; 27912 } 27913 return isFixed; 27914 } 27915 27916 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 27917 if (includeScale === void 0) { 27918 includeScale = false; 27919 } 27920 if (isFixedStrategy === void 0) { 27921 isFixedStrategy = false; 27922 } 27923 const clientRect = element.getBoundingClientRect(); 27924 const domElement = unwrapElement(element); 27925 let scale = floating_ui_utils_createCoords(1); 27926 if (includeScale) { 27927 if (offsetParent) { 27928 if (isElement(offsetParent)) { 27929 scale = getScale(offsetParent); 27930 } 27931 } else { 27932 scale = getScale(element); 27933 } 27934 } 27935 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floating_ui_utils_createCoords(0); 27936 let x = (clientRect.left + visualOffsets.x) / scale.x; 27937 let y = (clientRect.top + visualOffsets.y) / scale.y; 27938 let width = clientRect.width / scale.x; 27939 let height = clientRect.height / scale.y; 27940 if (domElement) { 27941 const win = getWindow(domElement); 27942 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 27943 let currentWin = win; 27944 let currentIFrame = currentWin.frameElement; 27945 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 27946 const iframeScale = getScale(currentIFrame); 27947 const iframeRect = currentIFrame.getBoundingClientRect(); 27948 const css = getComputedStyle(currentIFrame); 27949 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 27950 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 27951 x *= iframeScale.x; 27952 y *= iframeScale.y; 27953 width *= iframeScale.x; 27954 height *= iframeScale.y; 27955 x += left; 27956 y += top; 27957 currentWin = getWindow(currentIFrame); 27958 currentIFrame = currentWin.frameElement; 27959 } 27960 } 27961 return floating_ui_utils_rectToClientRect({ 27962 width, 27963 height, 27964 x, 27965 y 27966 }); 27967 } 27968 27969 const topLayerSelectors = [':popover-open', ':modal']; 27970 function floating_ui_dom_isTopLayer(floating) { 27971 return topLayerSelectors.some(selector => { 27972 try { 27973 return floating.matches(selector); 27974 } catch (e) { 27975 return false; 27976 } 27977 }); 27978 } 27979 27980 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 27981 let { 27982 elements, 27983 rect, 27984 offsetParent, 27985 strategy 27986 } = _ref; 27987 const isFixed = strategy === 'fixed'; 27988 const documentElement = getDocumentElement(offsetParent); 27989 const topLayer = elements ? floating_ui_dom_isTopLayer(elements.floating) : false; 27990 if (offsetParent === documentElement || topLayer && isFixed) { 27991 return rect; 27992 } 27993 let scroll = { 27994 scrollLeft: 0, 27995 scrollTop: 0 27996 }; 27997 let scale = floating_ui_utils_createCoords(1); 27998 const offsets = floating_ui_utils_createCoords(0); 27999 const isOffsetParentAnElement = isHTMLElement(offsetParent); 28000 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 28001 if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { 28002 scroll = getNodeScroll(offsetParent); 28003 } 28004 if (isHTMLElement(offsetParent)) { 28005 const offsetRect = getBoundingClientRect(offsetParent); 28006 scale = getScale(offsetParent); 28007 offsets.x = offsetRect.x + offsetParent.clientLeft; 28008 offsets.y = offsetRect.y + offsetParent.clientTop; 28009 } 28010 } 28011 return { 28012 width: rect.width * scale.x, 28013 height: rect.height * scale.y, 28014 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, 28015 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y 28016 }; 28017 } 28018 28019 function getClientRects(element) { 28020 return Array.from(element.getClientRects()); 28021 } 28022 28023 function getWindowScrollBarX(element) { 28024 // If <html> has a CSS width greater than the viewport, then this will be 28025 // incorrect for RTL. 28026 return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; 28027 } 28028 28029 // Gets the entire size of the scrollable document area, even extending outside 28030 // of the `<html>` and `<body>` rect bounds if horizontally scrollable. 28031 function getDocumentRect(element) { 28032 const html = getDocumentElement(element); 28033 const scroll = getNodeScroll(element); 28034 const body = element.ownerDocument.body; 28035 const width = dist_floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 28036 const height = dist_floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 28037 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 28038 const y = -scroll.scrollTop; 28039 if (getComputedStyle(body).direction === 'rtl') { 28040 x += dist_floating_ui_utils_max(html.clientWidth, body.clientWidth) - width; 28041 } 28042 return { 28043 width, 28044 height, 28045 x, 28046 y 28047 }; 28048 } 28049 28050 function getViewportRect(element, strategy) { 28051 const win = getWindow(element); 28052 const html = getDocumentElement(element); 28053 const visualViewport = win.visualViewport; 28054 let width = html.clientWidth; 28055 let height = html.clientHeight; 28056 let x = 0; 28057 let y = 0; 28058 if (visualViewport) { 28059 width = visualViewport.width; 28060 height = visualViewport.height; 28061 const visualViewportBased = isWebKit(); 28062 if (!visualViewportBased || visualViewportBased && strategy === 'fixed') { 28063 x = visualViewport.offsetLeft; 28064 y = visualViewport.offsetTop; 28065 } 28066 } 28067 return { 28068 width, 28069 height, 28070 x, 28071 y 28072 }; 28073 } 28074 28075 // Returns the inner client rect, subtracting scrollbars if present. 28076 function getInnerBoundingClientRect(element, strategy) { 28077 const clientRect = getBoundingClientRect(element, true, strategy === 'fixed'); 28078 const top = clientRect.top + element.clientTop; 28079 const left = clientRect.left + element.clientLeft; 28080 const scale = isHTMLElement(element) ? getScale(element) : floating_ui_utils_createCoords(1); 28081 const width = element.clientWidth * scale.x; 28082 const height = element.clientHeight * scale.y; 28083 const x = left * scale.x; 28084 const y = top * scale.y; 28085 return { 28086 width, 28087 height, 28088 x, 28089 y 28090 }; 28091 } 28092 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 28093 let rect; 28094 if (clippingAncestor === 'viewport') { 28095 rect = getViewportRect(element, strategy); 28096 } else if (clippingAncestor === 'document') { 28097 rect = getDocumentRect(getDocumentElement(element)); 28098 } else if (isElement(clippingAncestor)) { 28099 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 28100 } else { 28101 const visualOffsets = getVisualOffsets(element); 28102 rect = { 28103 ...clippingAncestor, 28104 x: clippingAncestor.x - visualOffsets.x, 28105 y: clippingAncestor.y - visualOffsets.y 28106 }; 28107 } 28108 return floating_ui_utils_rectToClientRect(rect); 28109 } 28110 function hasFixedPositionAncestor(element, stopNode) { 28111 const parentNode = getParentNode(element); 28112 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 28113 return false; 28114 } 28115 return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode); 28116 } 28117 28118 // A "clipping ancestor" is an `overflow` element with the characteristic of 28119 // clipping (or hiding) child elements. This returns all clipping ancestors 28120 // of the given element up the tree. 28121 function getClippingElementAncestors(element, cache) { 28122 const cachedResult = cache.get(element); 28123 if (cachedResult) { 28124 return cachedResult; 28125 } 28126 let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body'); 28127 let currentContainingBlockComputedStyle = null; 28128 const elementIsFixed = getComputedStyle(element).position === 'fixed'; 28129 let currentNode = elementIsFixed ? getParentNode(element) : element; 28130 28131 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 28132 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 28133 const computedStyle = getComputedStyle(currentNode); 28134 const currentNodeIsContaining = isContainingBlock(currentNode); 28135 if (!currentNodeIsContaining && computedStyle.position === 'fixed') { 28136 currentContainingBlockComputedStyle = null; 28137 } 28138 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 28139 if (shouldDropCurrentNode) { 28140 // Drop non-containing blocks. 28141 result = result.filter(ancestor => ancestor !== currentNode); 28142 } else { 28143 // Record last containing block for next iteration. 28144 currentContainingBlockComputedStyle = computedStyle; 28145 } 28146 currentNode = getParentNode(currentNode); 28147 } 28148 cache.set(element, result); 28149 return result; 28150 } 28151 28152 // Gets the maximum area that the element is visible in due to any number of 28153 // clipping ancestors. 28154 function getClippingRect(_ref) { 28155 let { 28156 element, 28157 boundary, 28158 rootBoundary, 28159 strategy 28160 } = _ref; 28161 const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary); 28162 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 28163 const firstClippingAncestor = clippingAncestors[0]; 28164 const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { 28165 const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); 28166 accRect.top = dist_floating_ui_utils_max(rect.top, accRect.top); 28167 accRect.right = dist_floating_ui_utils_min(rect.right, accRect.right); 28168 accRect.bottom = dist_floating_ui_utils_min(rect.bottom, accRect.bottom); 28169 accRect.left = dist_floating_ui_utils_max(rect.left, accRect.left); 28170 return accRect; 28171 }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); 28172 return { 28173 width: clippingRect.right - clippingRect.left, 28174 height: clippingRect.bottom - clippingRect.top, 28175 x: clippingRect.left, 28176 y: clippingRect.top 28177 }; 28178 } 28179 28180 function getDimensions(element) { 28181 const { 28182 width, 28183 height 28184 } = getCssDimensions(element); 28185 return { 28186 width, 28187 height 28188 }; 28189 } 28190 28191 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 28192 const isOffsetParentAnElement = isHTMLElement(offsetParent); 28193 const documentElement = getDocumentElement(offsetParent); 28194 const isFixed = strategy === 'fixed'; 28195 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 28196 let scroll = { 28197 scrollLeft: 0, 28198 scrollTop: 0 28199 }; 28200 const offsets = floating_ui_utils_createCoords(0); 28201 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 28202 if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { 28203 scroll = getNodeScroll(offsetParent); 28204 } 28205 if (isOffsetParentAnElement) { 28206 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 28207 offsets.x = offsetRect.x + offsetParent.clientLeft; 28208 offsets.y = offsetRect.y + offsetParent.clientTop; 28209 } else if (documentElement) { 28210 offsets.x = getWindowScrollBarX(documentElement); 28211 } 28212 } 28213 const x = rect.left + scroll.scrollLeft - offsets.x; 28214 const y = rect.top + scroll.scrollTop - offsets.y; 28215 return { 28216 x, 28217 y, 28218 width: rect.width, 28219 height: rect.height 28220 }; 28221 } 28222 28223 function getTrueOffsetParent(element, polyfill) { 28224 if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') { 28225 return null; 28226 } 28227 if (polyfill) { 28228 return polyfill(element); 28229 } 28230 return element.offsetParent; 28231 } 28232 28233 // Gets the closest ancestor positioned element. Handles some edge cases, 28234 // such as table ancestors and cross browser bugs. 28235 function getOffsetParent(element, polyfill) { 28236 const window = getWindow(element); 28237 if (!isHTMLElement(element) || floating_ui_dom_isTopLayer(element)) { 28238 return window; 28239 } 28240 let offsetParent = getTrueOffsetParent(element, polyfill); 28241 while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') { 28242 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 28243 } 28244 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) { 28245 return window; 28246 } 28247 return offsetParent || getContainingBlock(element) || window; 28248 } 28249 28250 const getElementRects = async function (data) { 28251 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 28252 const getDimensionsFn = this.getDimensions; 28253 return { 28254 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 28255 floating: { 28256 x: 0, 28257 y: 0, 28258 ...(await getDimensionsFn(data.floating)) 28259 } 28260 }; 28261 }; 28262 28263 function isRTL(element) { 28264 return getComputedStyle(element).direction === 'rtl'; 28265 } 28266 28267 const platform = { 28268 convertOffsetParentRelativeRectToViewportRelativeRect, 28269 getDocumentElement: getDocumentElement, 28270 getClippingRect, 28271 getOffsetParent, 28272 getElementRects, 28273 getClientRects, 28274 getDimensions, 28275 getScale, 28276 isElement: isElement, 28277 isRTL 28278 }; 28279 28280 // https://samthor.au/2021/observing-dom/ 28281 function observeMove(element, onMove) { 28282 let io = null; 28283 let timeoutId; 28284 const root = getDocumentElement(element); 28285 function cleanup() { 28286 var _io; 28287 clearTimeout(timeoutId); 28288 (_io = io) == null || _io.disconnect(); 28289 io = null; 28290 } 28291 function refresh(skip, threshold) { 28292 if (skip === void 0) { 28293 skip = false; 28294 } 28295 if (threshold === void 0) { 28296 threshold = 1; 28297 } 28298 cleanup(); 28299 const { 28300 left, 28301 top, 28302 width, 28303 height 28304 } = element.getBoundingClientRect(); 28305 if (!skip) { 28306 onMove(); 28307 } 28308 if (!width || !height) { 28309 return; 28310 } 28311 const insetTop = floating_ui_utils_floor(top); 28312 const insetRight = floating_ui_utils_floor(root.clientWidth - (left + width)); 28313 const insetBottom = floating_ui_utils_floor(root.clientHeight - (top + height)); 28314 const insetLeft = floating_ui_utils_floor(left); 28315 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 28316 const options = { 28317 rootMargin, 28318 threshold: dist_floating_ui_utils_max(0, dist_floating_ui_utils_min(1, threshold)) || 1 28319 }; 28320 let isFirstUpdate = true; 28321 function handleObserve(entries) { 28322 const ratio = entries[0].intersectionRatio; 28323 if (ratio !== threshold) { 28324 if (!isFirstUpdate) { 28325 return refresh(); 28326 } 28327 if (!ratio) { 28328 timeoutId = setTimeout(() => { 28329 refresh(false, 1e-7); 28330 }, 100); 28331 } else { 28332 refresh(false, ratio); 28333 } 28334 } 28335 isFirstUpdate = false; 28336 } 28337 28338 // Older browsers don't support a `document` as the root and will throw an 28339 // error. 28340 try { 28341 io = new IntersectionObserver(handleObserve, { 28342 ...options, 28343 // Handle <iframe>s 28344 root: root.ownerDocument 28345 }); 28346 } catch (e) { 28347 io = new IntersectionObserver(handleObserve, options); 28348 } 28349 io.observe(element); 28350 } 28351 refresh(true); 28352 return cleanup; 28353 } 28354 28355 /** 28356 * Automatically updates the position of the floating element when necessary. 28357 * Should only be called when the floating element is mounted on the DOM or 28358 * visible on the screen. 28359 * @returns cleanup function that should be invoked when the floating element is 28360 * removed from the DOM or hidden from the screen. 28361 * @see https://floating-ui.com/docs/autoUpdate 28362 */ 28363 function autoUpdate(reference, floating, update, options) { 28364 if (options === void 0) { 28365 options = {}; 28366 } 28367 const { 28368 ancestorScroll = true, 28369 ancestorResize = true, 28370 elementResize = typeof ResizeObserver === 'function', 28371 layoutShift = typeof IntersectionObserver === 'function', 28372 animationFrame = false 28373 } = options; 28374 const referenceEl = unwrapElement(reference); 28375 const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : []; 28376 ancestors.forEach(ancestor => { 28377 ancestorScroll && ancestor.addEventListener('scroll', update, { 28378 passive: true 28379 }); 28380 ancestorResize && ancestor.addEventListener('resize', update); 28381 }); 28382 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 28383 let reobserveFrame = -1; 28384 let resizeObserver = null; 28385 if (elementResize) { 28386 resizeObserver = new ResizeObserver(_ref => { 28387 let [firstEntry] = _ref; 28388 if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { 28389 // Prevent update loops when using the `size` middleware. 28390 // https://github.com/floating-ui/floating-ui/issues/1740 28391 resizeObserver.unobserve(floating); 28392 cancelAnimationFrame(reobserveFrame); 28393 reobserveFrame = requestAnimationFrame(() => { 28394 var _resizeObserver; 28395 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 28396 }); 28397 } 28398 update(); 28399 }); 28400 if (referenceEl && !animationFrame) { 28401 resizeObserver.observe(referenceEl); 28402 } 28403 resizeObserver.observe(floating); 28404 } 28405 let frameId; 28406 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 28407 if (animationFrame) { 28408 frameLoop(); 28409 } 28410 function frameLoop() { 28411 const nextRefRect = getBoundingClientRect(reference); 28412 if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) { 28413 update(); 28414 } 28415 prevRefRect = nextRefRect; 28416 frameId = requestAnimationFrame(frameLoop); 28417 } 28418 update(); 28419 return () => { 28420 var _resizeObserver2; 28421 ancestors.forEach(ancestor => { 28422 ancestorScroll && ancestor.removeEventListener('scroll', update); 28423 ancestorResize && ancestor.removeEventListener('resize', update); 28424 }); 28425 cleanupIo == null || cleanupIo(); 28426 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 28427 resizeObserver = null; 28428 if (animationFrame) { 28429 cancelAnimationFrame(frameId); 28430 } 28431 }; 28432 } 28433 28434 /** 28435 * Optimizes the visibility of the floating element by choosing the placement 28436 * that has the most space available automatically, without needing to specify a 28437 * preferred placement. Alternative to `flip`. 28438 * @see https://floating-ui.com/docs/autoPlacement 28439 */ 28440 const floating_ui_dom_autoPlacement = (/* unused pure expression or super */ null && (autoPlacement$1)); 28441 28442 /** 28443 * Optimizes the visibility of the floating element by shifting it in order to 28444 * keep it in view when it will overflow the clipping boundary. 28445 * @see https://floating-ui.com/docs/shift 28446 */ 28447 const floating_ui_dom_shift = (/* unused pure expression or super */ null && (shift$1)); 28448 28449 /** 28450 * Optimizes the visibility of the floating element by flipping the `placement` 28451 * in order to keep it in view when the preferred placement(s) will overflow the 28452 * clipping boundary. Alternative to `autoPlacement`. 28453 * @see https://floating-ui.com/docs/flip 28454 */ 28455 const floating_ui_dom_flip = (/* unused pure expression or super */ null && (flip$1)); 28456 28457 /** 28458 * Provides data that allows you to change the size of the floating element — 28459 * for instance, prevent it from overflowing the clipping boundary or match the 28460 * width of the reference element. 28461 * @see https://floating-ui.com/docs/size 28462 */ 28463 const floating_ui_dom_size = (/* unused pure expression or super */ null && (size$1)); 28464 28465 /** 28466 * Provides data to hide the floating element in applicable situations, such as 28467 * when it is not in the same clipping context as the reference element. 28468 * @see https://floating-ui.com/docs/hide 28469 */ 28470 const floating_ui_dom_hide = (/* unused pure expression or super */ null && (hide$1)); 28471 28472 /** 28473 * Provides data to position an inner element of the floating element so that it 28474 * appears centered to the reference element. 28475 * @see https://floating-ui.com/docs/arrow 28476 */ 28477 const floating_ui_dom_arrow = (/* unused pure expression or super */ null && (arrow$1)); 28478 28479 /** 28480 * Provides improved positioning for inline reference elements that can span 28481 * over multiple lines, such as hyperlinks or range selections. 28482 * @see https://floating-ui.com/docs/inline 28483 */ 28484 const floating_ui_dom_inline = (/* unused pure expression or super */ null && (inline$1)); 28485 28486 /** 28487 * Built-in `limiter` that will stop `shift()` at a certain point. 28488 */ 28489 const floating_ui_dom_limitShift = (/* unused pure expression or super */ null && (limitShift$1)); 28490 28491 /** 28492 * Computes the `x` and `y` coordinates that will place the floating element 28493 * next to a given reference element. 28494 */ 28495 const floating_ui_dom_computePosition = (reference, floating, options) => { 28496 // This caches the expensive `getClippingElementAncestors` function so that 28497 // multiple lifecycle resets re-use the same result. It only lives for a 28498 // single call. If other functions become expensive, we can add them as well. 28499 const cache = new Map(); 28500 const mergedOptions = { 28501 platform, 28502 ...options 28503 }; 28504 const platformWithCache = { 28505 ...mergedOptions.platform, 28506 _c: cache 28507 }; 28508 return computePosition(reference, floating, { 28509 ...mergedOptions, 28510 platform: platformWithCache 28511 }); 28512 }; 28513 28514 28515 28516 // EXTERNAL MODULE: external "React" 28517 var external_React_ = __webpack_require__(1609); 28518 ;// external "ReactDOM" 28519 const external_ReactDOM_namespaceObject = window["ReactDOM"]; 28520 ;// ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 28521 28522 28523 28524 28525 28526 28527 /** 28528 * Provides data to position an inner element of the floating element so that it 28529 * appears centered to the reference element. 28530 * This wraps the core `arrow` middleware to allow React refs as the element. 28531 * @see https://floating-ui.com/docs/arrow 28532 */ 28533 const floating_ui_react_dom_arrow = options => { 28534 function isRef(value) { 28535 return {}.hasOwnProperty.call(value, 'current'); 28536 } 28537 return { 28538 name: 'arrow', 28539 options, 28540 fn(state) { 28541 const { 28542 element, 28543 padding 28544 } = typeof options === 'function' ? options(state) : options; 28545 if (element && isRef(element)) { 28546 if (element.current != null) { 28547 return arrow$1({ 28548 element: element.current, 28549 padding 28550 }).fn(state); 28551 } 28552 return {}; 28553 } 28554 if (element) { 28555 return arrow$1({ 28556 element, 28557 padding 28558 }).fn(state); 28559 } 28560 return {}; 28561 } 28562 }; 28563 }; 28564 28565 var index = typeof document !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect; 28566 28567 // Fork of `fast-deep-equal` that only does the comparisons we need and compares 28568 // functions 28569 function deepEqual(a, b) { 28570 if (a === b) { 28571 return true; 28572 } 28573 if (typeof a !== typeof b) { 28574 return false; 28575 } 28576 if (typeof a === 'function' && a.toString() === b.toString()) { 28577 return true; 28578 } 28579 let length; 28580 let i; 28581 let keys; 28582 if (a && b && typeof a === 'object') { 28583 if (Array.isArray(a)) { 28584 length = a.length; 28585 if (length !== b.length) return false; 28586 for (i = length; i-- !== 0;) { 28587 if (!deepEqual(a[i], b[i])) { 28588 return false; 28589 } 28590 } 28591 return true; 28592 } 28593 keys = Object.keys(a); 28594 length = keys.length; 28595 if (length !== Object.keys(b).length) { 28596 return false; 28597 } 28598 for (i = length; i-- !== 0;) { 28599 if (!{}.hasOwnProperty.call(b, keys[i])) { 28600 return false; 28601 } 28602 } 28603 for (i = length; i-- !== 0;) { 28604 const key = keys[i]; 28605 if (key === '_owner' && a.$$typeof) { 28606 continue; 28607 } 28608 if (!deepEqual(a[key], b[key])) { 28609 return false; 28610 } 28611 } 28612 return true; 28613 } 28614 28615 // biome-ignore lint/suspicious/noSelfCompare: in source 28616 return a !== a && b !== b; 28617 } 28618 28619 function getDPR(element) { 28620 if (typeof window === 'undefined') { 28621 return 1; 28622 } 28623 const win = element.ownerDocument.defaultView || window; 28624 return win.devicePixelRatio || 1; 28625 } 28626 28627 function roundByDPR(element, value) { 28628 const dpr = getDPR(element); 28629 return Math.round(value * dpr) / dpr; 28630 } 28631 28632 function useLatestRef(value) { 28633 const ref = external_React_.useRef(value); 28634 index(() => { 28635 ref.current = value; 28636 }); 28637 return ref; 28638 } 28639 28640 /** 28641 * Provides data to position a floating element. 28642 * @see https://floating-ui.com/docs/useFloating 28643 */ 28644 function useFloating(options) { 28645 if (options === void 0) { 28646 options = {}; 28647 } 28648 const { 28649 placement = 'bottom', 28650 strategy = 'absolute', 28651 middleware = [], 28652 platform, 28653 elements: { 28654 reference: externalReference, 28655 floating: externalFloating 28656 } = {}, 28657 transform = true, 28658 whileElementsMounted, 28659 open 28660 } = options; 28661 const [data, setData] = external_React_.useState({ 28662 x: 0, 28663 y: 0, 28664 strategy, 28665 placement, 28666 middlewareData: {}, 28667 isPositioned: false 28668 }); 28669 const [latestMiddleware, setLatestMiddleware] = external_React_.useState(middleware); 28670 if (!deepEqual(latestMiddleware, middleware)) { 28671 setLatestMiddleware(middleware); 28672 } 28673 const [_reference, _setReference] = external_React_.useState(null); 28674 const [_floating, _setFloating] = external_React_.useState(null); 28675 const setReference = external_React_.useCallback(node => { 28676 if (node !== referenceRef.current) { 28677 referenceRef.current = node; 28678 _setReference(node); 28679 } 28680 }, []); 28681 const setFloating = external_React_.useCallback(node => { 28682 if (node !== floatingRef.current) { 28683 floatingRef.current = node; 28684 _setFloating(node); 28685 } 28686 }, []); 28687 const referenceEl = externalReference || _reference; 28688 const floatingEl = externalFloating || _floating; 28689 const referenceRef = external_React_.useRef(null); 28690 const floatingRef = external_React_.useRef(null); 28691 const dataRef = external_React_.useRef(data); 28692 const hasWhileElementsMounted = whileElementsMounted != null; 28693 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 28694 const platformRef = useLatestRef(platform); 28695 const update = external_React_.useCallback(() => { 28696 if (!referenceRef.current || !floatingRef.current) { 28697 return; 28698 } 28699 const config = { 28700 placement, 28701 strategy, 28702 middleware: latestMiddleware 28703 }; 28704 if (platformRef.current) { 28705 config.platform = platformRef.current; 28706 } 28707 floating_ui_dom_computePosition(referenceRef.current, floatingRef.current, config).then(data => { 28708 const fullData = { 28709 ...data, 28710 isPositioned: true 28711 }; 28712 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 28713 dataRef.current = fullData; 28714 external_ReactDOM_namespaceObject.flushSync(() => { 28715 setData(fullData); 28716 }); 28717 } 28718 }); 28719 }, [latestMiddleware, placement, strategy, platformRef]); 28720 index(() => { 28721 if (open === false && dataRef.current.isPositioned) { 28722 dataRef.current.isPositioned = false; 28723 setData(data => ({ 28724 ...data, 28725 isPositioned: false 28726 })); 28727 } 28728 }, [open]); 28729 const isMountedRef = external_React_.useRef(false); 28730 index(() => { 28731 isMountedRef.current = true; 28732 return () => { 28733 isMountedRef.current = false; 28734 }; 28735 }, []); 28736 28737 // biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included. 28738 index(() => { 28739 if (referenceEl) referenceRef.current = referenceEl; 28740 if (floatingEl) floatingRef.current = floatingEl; 28741 if (referenceEl && floatingEl) { 28742 if (whileElementsMountedRef.current) { 28743 return whileElementsMountedRef.current(referenceEl, floatingEl, update); 28744 } 28745 update(); 28746 } 28747 }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]); 28748 const refs = external_React_.useMemo(() => ({ 28749 reference: referenceRef, 28750 floating: floatingRef, 28751 setReference, 28752 setFloating 28753 }), [setReference, setFloating]); 28754 const elements = external_React_.useMemo(() => ({ 28755 reference: referenceEl, 28756 floating: floatingEl 28757 }), [referenceEl, floatingEl]); 28758 const floatingStyles = external_React_.useMemo(() => { 28759 const initialStyles = { 28760 position: strategy, 28761 left: 0, 28762 top: 0 28763 }; 28764 if (!elements.floating) { 28765 return initialStyles; 28766 } 28767 const x = roundByDPR(elements.floating, data.x); 28768 const y = roundByDPR(elements.floating, data.y); 28769 if (transform) { 28770 return { 28771 ...initialStyles, 28772 transform: "translate(" + x + "px, " + y + "px)", 28773 ...(getDPR(elements.floating) >= 1.5 && { 28774 willChange: 'transform' 28775 }) 28776 }; 28777 } 28778 return { 28779 position: strategy, 28780 left: x, 28781 top: y 28782 }; 28783 }, [strategy, transform, elements.floating, data.x, data.y]); 28784 return external_React_.useMemo(() => ({ 28785 ...data, 28786 update, 28787 refs, 28788 elements, 28789 floatingStyles 28790 }), [data, update, refs, elements, floatingStyles]); 28791 } 28792 28793 28794 28795 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/hooks.js 28796 28797 28798 28799 28800 28801 28802 28803 28804 28805 28806 28807 28808 28809 const { useBlockElementRef, cleanEmptyObject: hooks_cleanEmptyObject } = unlock( 28810 external_wp_blockEditor_namespaceObject.privateApis 28811 ); 28812 function useBlockComments(postId) { 28813 const [commentLastUpdated, reflowComments] = (0,external_wp_element_namespaceObject.useReducer)( 28814 () => Date.now(), 28815 0 28816 ); 28817 const queryArgs = { 28818 post: postId, 28819 type: "note", 28820 status: "all", 28821 per_page: -1 28822 }; 28823 const { records: threads } = (0,external_wp_coreData_namespaceObject.useEntityRecords)( 28824 "root", 28825 "comment", 28826 queryArgs, 28827 { enabled: !!postId && typeof postId === "number" } 28828 ); 28829 const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 28830 const { clientIds } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 28831 const { getClientIdsWithDescendants } = select(external_wp_blockEditor_namespaceObject.store); 28832 return { 28833 clientIds: getClientIdsWithDescendants() 28834 }; 28835 }, []); 28836 const { resultComments, unresolvedSortedThreads } = (0,external_wp_element_namespaceObject.useMemo)(() => { 28837 if (!threads || threads.length === 0) { 28838 return { resultComments: [], unresolvedSortedThreads: [] }; 28839 } 28840 const blocksWithComments = clientIds.reduce((results, clientId) => { 28841 const commentId = getBlockAttributes(clientId)?.metadata?.noteId; 28842 if (commentId) { 28843 results[clientId] = commentId; 28844 } 28845 return results; 28846 }, {}); 28847 const compare = {}; 28848 const result = []; 28849 threads.forEach((item) => { 28850 const itemBlock = Object.keys(blocksWithComments).find( 28851 (key) => blocksWithComments[key] === item.id 28852 ); 28853 compare[item.id] = { 28854 ...item, 28855 reply: [], 28856 blockClientId: item.parent === 0 ? itemBlock : null 28857 }; 28858 }); 28859 threads.forEach((item) => { 28860 if (item.parent === 0) { 28861 result.push(compare[item.id]); 28862 } else if (compare[item.parent]) { 28863 compare[item.parent].reply.push(compare[item.id]); 28864 } 28865 }); 28866 if (0 === result?.length) { 28867 return { resultComments: [], unresolvedSortedThreads: [] }; 28868 } 28869 const updatedResult = result.map((item) => ({ 28870 ...item, 28871 reply: [...item.reply].reverse() 28872 })); 28873 const threadIdMap = new Map( 28874 updatedResult.map((thread) => [String(thread.id), thread]) 28875 ); 28876 const mappedIds = new Set( 28877 Object.values(blocksWithComments).map((id) => String(id)) 28878 ); 28879 const unresolvedSortedComments = Object.values(blocksWithComments).map((commentId) => threadIdMap.get(String(commentId))).filter( 28880 (thread) => thread !== void 0 && thread.status === "hold" 28881 ); 28882 const resolvedSortedComments = Object.values(blocksWithComments).map((commentId) => threadIdMap.get(String(commentId))).filter( 28883 (thread) => thread !== void 0 && thread.status === "approved" 28884 ); 28885 const orphanedComments = updatedResult.filter( 28886 (thread) => !mappedIds.has(String(thread.id)) 28887 ); 28888 const allSortedComments = [ 28889 ...unresolvedSortedComments, 28890 ...resolvedSortedComments, 28891 ...orphanedComments 28892 ]; 28893 return { 28894 resultComments: allSortedComments, 28895 unresolvedSortedThreads: unresolvedSortedComments 28896 }; 28897 }, [clientIds, threads, getBlockAttributes]); 28898 return { 28899 resultComments, 28900 unresolvedSortedThreads, 28901 reflowComments, 28902 commentLastUpdated 28903 }; 28904 } 28905 function useBlockCommentsActions(reflowComments = utils_noop) { 28906 const { createNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 28907 const { saveEntityRecord, deleteEntityRecord } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); 28908 const { getCurrentPostId } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 28909 const { getBlockAttributes, getSelectedBlockClientId } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 28910 const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 28911 const onError = (error) => { 28912 const errorMessage = error.message && error.code !== "unknown_error" ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(error.message) : (0,external_wp_i18n_namespaceObject.__)("An error occurred while performing an update."); 28913 createNotice("error", errorMessage, { 28914 type: "snackbar", 28915 isDismissible: true 28916 }); 28917 }; 28918 const onCreate = async ({ content, parent }) => { 28919 try { 28920 const savedRecord = await saveEntityRecord( 28921 "root", 28922 "comment", 28923 { 28924 post: getCurrentPostId(), 28925 content, 28926 status: "hold", 28927 type: "note", 28928 parent: parent || 0 28929 }, 28930 { throwOnError: true } 28931 ); 28932 if (!parent && savedRecord?.id) { 28933 const clientId = getSelectedBlockClientId(); 28934 const metadata = getBlockAttributes(clientId)?.metadata; 28935 updateBlockAttributes(clientId, { 28936 metadata: { 28937 ...metadata, 28938 noteId: savedRecord.id 28939 } 28940 }); 28941 } 28942 createNotice( 28943 "snackbar", 28944 parent ? (0,external_wp_i18n_namespaceObject.__)("Reply added.") : (0,external_wp_i18n_namespaceObject.__)("Note added."), 28945 { 28946 type: "snackbar", 28947 isDismissible: true 28948 } 28949 ); 28950 setTimeout(reflowComments, 300); 28951 return savedRecord; 28952 } catch (error) { 28953 reflowComments(); 28954 onError(error); 28955 } 28956 }; 28957 const onEdit = async ({ id, content, status }) => { 28958 const messageType = status ? status : "updated"; 28959 const messages = { 28960 approved: (0,external_wp_i18n_namespaceObject.__)("Note marked as resolved."), 28961 hold: (0,external_wp_i18n_namespaceObject.__)("Note reopened."), 28962 updated: (0,external_wp_i18n_namespaceObject.__)("Note updated.") 28963 }; 28964 try { 28965 if (status === "approved" || status === "hold") { 28966 await saveEntityRecord( 28967 "root", 28968 "comment", 28969 { 28970 id, 28971 status 28972 }, 28973 { 28974 throwOnError: true 28975 } 28976 ); 28977 const newCommentData = { 28978 post: getCurrentPostId(), 28979 content: content || "", 28980 // Empty content for resolve, content for reopen. 28981 type: "note", 28982 status, 28983 parent: id, 28984 meta: { 28985 _wp_note_status: status === "approved" ? "resolved" : "reopen" 28986 } 28987 }; 28988 await saveEntityRecord("root", "comment", newCommentData, { 28989 throwOnError: true 28990 }); 28991 } else { 28992 const updateData = { 28993 id, 28994 content, 28995 status 28996 }; 28997 await saveEntityRecord("root", "comment", updateData, { 28998 throwOnError: true 28999 }); 29000 } 29001 createNotice( 29002 "snackbar", 29003 messages[messageType] ?? (0,external_wp_i18n_namespaceObject.__)("Note updated."), 29004 { 29005 type: "snackbar", 29006 isDismissible: true 29007 } 29008 ); 29009 reflowComments(); 29010 } catch (error) { 29011 reflowComments(); 29012 onError(error); 29013 } 29014 }; 29015 const onDelete = async (comment) => { 29016 try { 29017 await deleteEntityRecord( 29018 "root", 29019 "comment", 29020 comment.id, 29021 void 0, 29022 { 29023 throwOnError: true 29024 } 29025 ); 29026 if (!comment.parent) { 29027 const clientId = getSelectedBlockClientId(); 29028 const metadata = getBlockAttributes(clientId)?.metadata; 29029 updateBlockAttributes(clientId, { 29030 metadata: hooks_cleanEmptyObject({ 29031 ...metadata, 29032 noteId: void 0 29033 }) 29034 }); 29035 } 29036 createNotice("snackbar", (0,external_wp_i18n_namespaceObject.__)("Note deleted."), { 29037 type: "snackbar", 29038 isDismissible: true 29039 }); 29040 reflowComments(); 29041 } catch (error) { 29042 reflowComments(); 29043 onError(error); 29044 } 29045 }; 29046 return { onCreate, onEdit, onDelete }; 29047 } 29048 function useEnableFloatingSidebar(enabled = false) { 29049 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 29050 (0,external_wp_element_namespaceObject.useEffect)(() => { 29051 if (!enabled) { 29052 return; 29053 } 29054 const { getActiveComplementaryArea } = registry.select(store); 29055 const { disableComplementaryArea, enableComplementaryArea } = registry.dispatch(store); 29056 const unsubscribe = registry.subscribe(() => { 29057 if (getActiveComplementaryArea("core") === null) { 29058 enableComplementaryArea("core", collabSidebarName); 29059 } 29060 }); 29061 return () => { 29062 unsubscribe(); 29063 if (getActiveComplementaryArea("core") === collabSidebarName) { 29064 disableComplementaryArea("core", collabSidebarName); 29065 } 29066 }; 29067 }, [enabled, registry]); 29068 } 29069 function useFloatingThread({ 29070 thread, 29071 calculatedOffset, 29072 setHeights, 29073 selectedThread, 29074 setBlockRef, 29075 commentLastUpdated 29076 }) { 29077 const blockRef = (0,external_wp_element_namespaceObject.useRef)(); 29078 useBlockElementRef(thread.blockClientId, blockRef); 29079 const updateHeight = (0,external_wp_element_namespaceObject.useCallback)( 29080 (id, newHeight) => { 29081 setHeights((prev) => { 29082 if (prev[id] !== newHeight) { 29083 return { ...prev, [id]: newHeight }; 29084 } 29085 return prev; 29086 }); 29087 }, 29088 [setHeights] 29089 ); 29090 const { y, refs } = useFloating({ 29091 placement: "right-start", 29092 middleware: [ 29093 offset({ 29094 crossAxis: calculatedOffset || -16 29095 }) 29096 ], 29097 whileElementsMounted: autoUpdate 29098 }); 29099 (0,external_wp_element_namespaceObject.useEffect)(() => { 29100 if (blockRef.current) { 29101 refs.setReference(blockRef.current); 29102 } 29103 }, [blockRef, refs, commentLastUpdated]); 29104 (0,external_wp_element_namespaceObject.useEffect)(() => { 29105 if (refs.floating?.current) { 29106 setBlockRef(thread.id, blockRef.current); 29107 } 29108 }, [thread.id, refs.floating, setBlockRef]); 29109 (0,external_wp_element_namespaceObject.useEffect)(() => { 29110 if (refs.floating?.current) { 29111 const newHeight = refs.floating.current.scrollHeight; 29112 updateHeight(thread.id, newHeight); 29113 } 29114 }, [ 29115 thread.id, 29116 updateHeight, 29117 refs.floating, 29118 selectedThread, 29119 commentLastUpdated 29120 ]); 29121 return { 29122 blockRef, 29123 y, 29124 refs 29125 }; 29126 } 29127 29128 29129 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/add-comment.js 29130 29131 29132 29133 29134 29135 29136 29137 29138 29139 29140 const { useBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 29141 function AddComment({ 29142 onSubmit, 29143 showCommentBoard, 29144 setShowCommentBoard, 29145 commentSidebarRef, 29146 reflowComments = utils_noop, 29147 isFloating = false, 29148 y, 29149 refs 29150 }) { 29151 const { clientId, blockCommentId } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 29152 const { getSelectedBlock } = select(external_wp_blockEditor_namespaceObject.store); 29153 const selectedBlock = getSelectedBlock(); 29154 return { 29155 clientId: selectedBlock?.clientId, 29156 blockCommentId: selectedBlock?.attributes?.metadata?.noteId 29157 }; 29158 }, []); 29159 const blockElement = useBlockElement(clientId); 29160 const { toggleBlockSpotlight } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 29161 const unselectThread = () => { 29162 setShowCommentBoard(false); 29163 blockElement?.focus(); 29164 toggleBlockSpotlight(clientId, false); 29165 }; 29166 if (!showCommentBoard || !clientId || void 0 !== blockCommentId) { 29167 return null; 29168 } 29169 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 29170 external_wp_components_namespaceObject.__experimentalVStack, 29171 { 29172 className: dist_clsx( 29173 "editor-collab-sidebar-panel__thread is-selected", 29174 { 29175 "is-floating": isFloating 29176 } 29177 ), 29178 spacing: "3", 29179 tabIndex: 0, 29180 "aria-label": (0,external_wp_i18n_namespaceObject.__)("New note"), 29181 role: "treeitem", 29182 ref: isFloating ? refs.setFloating : void 0, 29183 style: isFloating ? ( 29184 // Delay showing the floating note box until a Y position is known to prevent blink. 29185 { top: y, opacity: !y ? 0 : void 0 } 29186 ) : void 0, 29187 onBlur: (event) => { 29188 if (event.currentTarget.contains(event.relatedTarget)) { 29189 return; 29190 } 29191 toggleBlockSpotlight(clientId, false); 29192 setShowCommentBoard(false); 29193 }, 29194 children: [ 29195 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info_default, {}) }), 29196 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29197 comment_form_default, 29198 { 29199 onSubmit: async (inputComment) => { 29200 const { id } = await onSubmit({ content: inputComment }); 29201 focusCommentThread(id, commentSidebarRef.current); 29202 setShowCommentBoard(false); 29203 }, 29204 onCancel: unselectThread, 29205 reflowComments, 29206 submitButtonText: (0,external_wp_i18n_namespaceObject.__)("Add note"), 29207 labelText: (0,external_wp_i18n_namespaceObject.__)("New note") 29208 } 29209 ) 29210 ] 29211 } 29212 ); 29213 } 29214 29215 29216 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comments.js 29217 29218 29219 29220 29221 29222 29223 29224 29225 29226 29227 29228 29229 29230 29231 29232 29233 29234 const { useBlockElement: comments_useBlockElement } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 29235 const { Menu: comments_Menu } = unlock(external_wp_components_namespaceObject.privateApis); 29236 function Comments({ 29237 threads: noteThreads, 29238 onEditComment, 29239 onAddReply, 29240 onCommentDelete, 29241 showCommentBoard, 29242 setShowCommentBoard, 29243 commentSidebarRef, 29244 reflowComments, 29245 isFloating = false, 29246 commentLastUpdated 29247 }) { 29248 const [heights, setHeights] = (0,external_wp_element_namespaceObject.useState)({}); 29249 const [selectedThread, setSelectedThread] = (0,external_wp_element_namespaceObject.useState)(null); 29250 const [boardOffsets, setBoardOffsets] = (0,external_wp_element_namespaceObject.useState)({}); 29251 const [blockRefs, setBlockRefs] = (0,external_wp_element_namespaceObject.useState)({}); 29252 const { setCanvasMinHeight } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 29253 const { blockCommentId, selectedBlockClientId, orderedBlockIds } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 29254 const { getBlockAttributes, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); 29255 const clientId = getSelectedBlockClientId(); 29256 return { 29257 blockCommentId: clientId ? getBlockAttributes(clientId)?.metadata?.noteId : null, 29258 selectedBlockClientId: clientId, 29259 orderedBlockIds: select(external_wp_blockEditor_namespaceObject.store).getBlockOrder() 29260 }; 29261 }, []); 29262 const relatedBlockElement = comments_useBlockElement(selectedBlockClientId); 29263 const threads = (0,external_wp_element_namespaceObject.useMemo)(() => { 29264 const t = [...noteThreads]; 29265 const orderedThreads = []; 29266 if (isFloating && showCommentBoard && void 0 === blockCommentId) { 29267 const newNoteThread = { 29268 id: "new-note-thread", 29269 blockClientId: selectedBlockClientId, 29270 content: { rendered: "" } 29271 }; 29272 orderedBlockIds.forEach((blockId) => { 29273 if (blockId === selectedBlockClientId) { 29274 orderedThreads.push(newNoteThread); 29275 } else { 29276 const threadForBlock = t.find( 29277 (thread) => thread.blockClientId === blockId 29278 ); 29279 if (threadForBlock) { 29280 orderedThreads.push(threadForBlock); 29281 } 29282 } 29283 }); 29284 return orderedThreads; 29285 } 29286 return t; 29287 }, [ 29288 noteThreads, 29289 isFloating, 29290 showCommentBoard, 29291 blockCommentId, 29292 selectedBlockClientId, 29293 orderedBlockIds 29294 ]); 29295 const handleDelete = async (comment) => { 29296 const currentIndex = threads.findIndex((t) => t.id === comment.id); 29297 const nextThread = threads[currentIndex + 1]; 29298 const prevThread = threads[currentIndex - 1]; 29299 await onCommentDelete(comment); 29300 if (comment.parent !== 0) { 29301 setSelectedThread(comment.parent); 29302 focusCommentThread(comment.parent, commentSidebarRef.current); 29303 return; 29304 } 29305 if (nextThread) { 29306 setSelectedThread(nextThread.id); 29307 focusCommentThread(nextThread.id, commentSidebarRef.current); 29308 } else if (prevThread) { 29309 setSelectedThread(prevThread.id); 29310 focusCommentThread(prevThread.id, commentSidebarRef.current); 29311 } else { 29312 setSelectedThread(null); 29313 setShowCommentBoard(false); 29314 relatedBlockElement?.focus(); 29315 } 29316 }; 29317 (0,external_wp_element_namespaceObject.useEffect)(() => { 29318 const fallback = showCommentBoard ? "new-note-thread" : null; 29319 setSelectedThread(blockCommentId ?? fallback); 29320 }, [blockCommentId, showCommentBoard]); 29321 const setBlockRef = (0,external_wp_element_namespaceObject.useCallback)((id, blockRef) => { 29322 setBlockRefs((prev) => ({ ...prev, [id]: blockRef })); 29323 }, []); 29324 (0,external_wp_element_namespaceObject.useEffect)(() => { 29325 const calculateAllOffsets = () => { 29326 const offsets = {}; 29327 if (!isFloating) { 29328 return { offsets, minHeight: 0 }; 29329 } 29330 const selectedThreadIndex = threads.findIndex( 29331 (t) => t.id === selectedThread 29332 ); 29333 const breakIndex = selectedThreadIndex === -1 ? 0 : selectedThreadIndex; 29334 const selectedThreadData = threads[breakIndex]; 29335 if (!selectedThreadData || !blockRefs[selectedThreadData.id]) { 29336 return { offsets, minHeight: 0 }; 29337 } 29338 let blockElement = blockRefs[selectedThreadData.id]; 29339 let blockRect = blockElement?.getBoundingClientRect(); 29340 const selectedThreadTop = blockRect?.top || 0; 29341 const selectedThreadHeight = heights[selectedThreadData.id] || 0; 29342 offsets[selectedThreadData.id] = -16; 29343 let previousThreadData = { 29344 threadTop: selectedThreadTop - 16, 29345 threadHeight: selectedThreadHeight 29346 }; 29347 for (let i = breakIndex + 1; i < threads.length; i++) { 29348 const thread = threads[i]; 29349 if (!blockRefs[thread.id]) { 29350 continue; 29351 } 29352 blockElement = blockRefs[thread.id]; 29353 blockRect = blockElement?.getBoundingClientRect(); 29354 const threadTop = blockRect?.top || 0; 29355 const threadHeight = heights[thread.id] || 0; 29356 let additionalOffset = -16; 29357 const previousBottom = previousThreadData.threadTop + previousThreadData.threadHeight; 29358 if (threadTop < previousBottom + 16) { 29359 additionalOffset = previousBottom - threadTop + 20; 29360 } 29361 offsets[thread.id] = additionalOffset; 29362 previousThreadData = { 29363 threadTop: threadTop + additionalOffset, 29364 threadHeight 29365 }; 29366 } 29367 let nextThreadData = { 29368 threadTop: selectedThreadTop - 16 29369 }; 29370 for (let i = selectedThreadIndex - 1; i >= 0; i--) { 29371 const thread = threads[i]; 29372 if (!blockRefs[thread.id]) { 29373 continue; 29374 } 29375 blockElement = blockRefs[thread.id]; 29376 blockRect = blockElement?.getBoundingClientRect(); 29377 const threadTop = blockRect?.top || 0; 29378 const threadHeight = heights[thread.id] || 0; 29379 let additionalOffset = -16; 29380 const threadBottom = threadTop + threadHeight; 29381 if (threadBottom > nextThreadData.threadTop) { 29382 additionalOffset = nextThreadData.threadTop - threadTop - threadHeight - 20; 29383 } 29384 offsets[thread.id] = additionalOffset; 29385 nextThreadData = { 29386 threadTop: threadTop + additionalOffset 29387 }; 29388 } 29389 let editorMinHeight = 0; 29390 const lastThread = threads[threads.length - 1]; 29391 if (blockRefs[lastThread.id]) { 29392 const lastBlockElement = blockRefs[lastThread.id]; 29393 const lastBlockRect = lastBlockElement?.getBoundingClientRect(); 29394 const lastThreadTop = lastBlockRect?.top || 0; 29395 const lastThreadHeight = heights[lastThread.id] || 0; 29396 const lastThreadOffset = offsets[lastThread.id] || 0; 29397 editorMinHeight = lastThreadTop + lastThreadHeight + lastThreadOffset + 32; 29398 } 29399 return { offsets, minHeight: editorMinHeight }; 29400 }; 29401 const { offsets: newOffsets, minHeight } = calculateAllOffsets(); 29402 if (Object.keys(newOffsets).length > 0) { 29403 setBoardOffsets(newOffsets); 29404 } 29405 setCanvasMinHeight(minHeight); 29406 }, [ 29407 heights, 29408 blockRefs, 29409 isFloating, 29410 threads, 29411 selectedThread, 29412 setCanvasMinHeight 29413 ]); 29414 const hasThreads = Array.isArray(threads) && threads.length > 0; 29415 if (!hasThreads && !isFloating) { 29416 return null; 29417 } 29418 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 29419 !isFloating && showCommentBoard && void 0 === blockCommentId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29420 AddComment, 29421 { 29422 onSubmit: onAddReply, 29423 showCommentBoard, 29424 setShowCommentBoard, 29425 commentSidebarRef 29426 } 29427 ), 29428 threads.map((thread) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29429 Thread, 29430 { 29431 thread, 29432 onAddReply, 29433 onCommentDelete: handleDelete, 29434 onEditComment, 29435 isSelected: selectedThread === thread.id, 29436 setSelectedThread, 29437 setShowCommentBoard, 29438 commentSidebarRef, 29439 reflowComments, 29440 isFloating, 29441 calculatedOffset: boardOffsets[thread.id] ?? 0, 29442 setHeights, 29443 setBlockRef, 29444 selectedThread, 29445 commentLastUpdated, 29446 showCommentBoard 29447 }, 29448 thread.id 29449 )) 29450 ] }); 29451 } 29452 function Thread({ 29453 thread, 29454 onEditComment, 29455 onAddReply, 29456 onCommentDelete, 29457 isSelected, 29458 setShowCommentBoard, 29459 commentSidebarRef, 29460 reflowComments, 29461 isFloating, 29462 calculatedOffset, 29463 setHeights, 29464 setBlockRef, 29465 setSelectedThread, 29466 selectedThread, 29467 commentLastUpdated, 29468 showCommentBoard 29469 }) { 29470 const { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock( 29471 (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store) 29472 ); 29473 const relatedBlockElement = comments_useBlockElement(thread.blockClientId); 29474 const debouncedToggleBlockHighlight = (0,external_wp_compose_namespaceObject.useDebounce)( 29475 toggleBlockHighlight, 29476 50 29477 ); 29478 const { y, refs } = useFloatingThread({ 29479 thread, 29480 calculatedOffset, 29481 setHeights, 29482 setBlockRef, 29483 selectedThread, 29484 commentLastUpdated 29485 }); 29486 const onMouseEnter = () => { 29487 debouncedToggleBlockHighlight(thread.blockClientId, true); 29488 }; 29489 const onMouseLeave = () => { 29490 debouncedToggleBlockHighlight(thread.blockClientId, false); 29491 }; 29492 const handleCommentSelect = () => { 29493 setShowCommentBoard(false); 29494 setSelectedThread(thread.id); 29495 if (!!thread.blockClientId) { 29496 selectBlock(thread.blockClientId, null); 29497 toggleBlockSpotlight(thread.blockClientId, true); 29498 } 29499 }; 29500 const unselectThread = () => { 29501 setSelectedThread(null); 29502 setShowCommentBoard(false); 29503 toggleBlockSpotlight(thread.blockClientId, false); 29504 }; 29505 const allReplies = thread?.reply || []; 29506 const lastReply = allReplies.length > 0 ? allReplies[allReplies.length - 1] : void 0; 29507 const restReplies = allReplies.length > 0 ? allReplies.slice(0, -1) : []; 29508 const commentExcerpt = getCommentExcerpt( 29509 (0,external_wp_dom_namespaceObject.__unstableStripHTML)(thread.content?.rendered), 29510 10 29511 ); 29512 const ariaLabel = !!thread.blockClientId ? (0,external_wp_i18n_namespaceObject.sprintf)( 29513 // translators: %s: note excerpt 29514 (0,external_wp_i18n_namespaceObject.__)("Note: %s"), 29515 commentExcerpt 29516 ) : (0,external_wp_i18n_namespaceObject.sprintf)( 29517 // translators: %s: note excerpt 29518 (0,external_wp_i18n_namespaceObject.__)("Original block deleted. Note: %s"), 29519 commentExcerpt 29520 ); 29521 if ("new-note-thread" === thread.id && showCommentBoard && isFloating) { 29522 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29523 AddComment, 29524 { 29525 onSubmit: onAddReply, 29526 showCommentBoard, 29527 setShowCommentBoard, 29528 commentSidebarRef, 29529 reflowComments, 29530 isFloating, 29531 y, 29532 refs 29533 } 29534 ); 29535 } 29536 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 29537 external_wp_components_namespaceObject.__experimentalVStack, 29538 { 29539 className: dist_clsx("editor-collab-sidebar-panel__thread", { 29540 "is-selected": isSelected, 29541 "is-floating": isFloating 29542 }), 29543 id: `comment-thread-$thread.id}`, 29544 spacing: "3", 29545 onClick: handleCommentSelect, 29546 onMouseEnter, 29547 onMouseLeave, 29548 onFocus: onMouseEnter, 29549 onBlur: onMouseLeave, 29550 onKeyDown: (event) => { 29551 if (event.defaultPrevented) { 29552 return; 29553 } 29554 if (event.key === "Enter" && event.currentTarget === event.target) { 29555 if (isSelected) { 29556 unselectThread(); 29557 } else { 29558 handleCommentSelect(); 29559 } 29560 } 29561 if (event.key === "Escape") { 29562 unselectThread(); 29563 focusCommentThread(thread.id, commentSidebarRef.current); 29564 } 29565 }, 29566 tabIndex: 0, 29567 role: "treeitem", 29568 "aria-label": ariaLabel, 29569 "aria-expanded": isSelected, 29570 ref: isFloating ? refs.setFloating : void 0, 29571 style: isFloating ? { top: y } : void 0, 29572 children: [ 29573 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29574 external_wp_components_namespaceObject.Button, 29575 { 29576 className: "editor-collab-sidebar-panel__skip-to-comment", 29577 variant: "secondary", 29578 size: "compact", 29579 onClick: () => { 29580 focusCommentThread( 29581 thread.id, 29582 commentSidebarRef.current, 29583 "textarea" 29584 ); 29585 }, 29586 children: (0,external_wp_i18n_namespaceObject.__)("Add new note") 29587 } 29588 ), 29589 !thread.blockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { as: "p", weight: 500, variant: "muted", children: (0,external_wp_i18n_namespaceObject.__)("Original block deleted.") }), 29590 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29591 CommentBoard, 29592 { 29593 thread, 29594 isExpanded: isSelected, 29595 onEdit: (params = {}) => { 29596 const { status } = params; 29597 onEditComment(params); 29598 if (status === "approved") { 29599 unselectThread(); 29600 focusCommentThread( 29601 thread.id, 29602 commentSidebarRef.current 29603 ); 29604 } 29605 }, 29606 onDelete: onCommentDelete, 29607 reflowComments 29608 } 29609 ), 29610 isSelected && allReplies.map((reply) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29611 CommentBoard, 29612 { 29613 thread: reply, 29614 parent: thread, 29615 isExpanded: isSelected, 29616 onEdit: onEditComment, 29617 onDelete: onCommentDelete, 29618 reflowComments 29619 }, 29620 reply.id 29621 )), 29622 !isSelected && restReplies.length > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { className: "editor-collab-sidebar-panel__more-reply-separator", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29623 external_wp_components_namespaceObject.Button, 29624 { 29625 size: "compact", 29626 variant: "tertiary", 29627 className: "editor-collab-sidebar-panel__more-reply-button", 29628 onClick: () => { 29629 setSelectedThread(thread.id); 29630 focusCommentThread( 29631 thread.id, 29632 commentSidebarRef.current 29633 ); 29634 }, 29635 children: (0,external_wp_i18n_namespaceObject.sprintf)( 29636 // translators: %s: number of replies. 29637 (0,external_wp_i18n_namespaceObject._n)( 29638 "%s more reply", 29639 "%s more replies", 29640 restReplies.length 29641 ), 29642 restReplies.length 29643 ) 29644 } 29645 ) }), 29646 !isSelected && lastReply && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29647 CommentBoard, 29648 { 29649 thread: lastReply, 29650 parent: thread, 29651 isExpanded: isSelected, 29652 onEdit: onEditComment, 29653 onDelete: onCommentDelete, 29654 reflowComments 29655 } 29656 ), 29657 isSelected && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", role: "treeitem", children: [ 29658 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_author_info_default, {}) }), 29659 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29660 comment_form_default, 29661 { 29662 onSubmit: (inputComment) => { 29663 if ("approved" === thread.status) { 29664 onEditComment({ 29665 id: thread.id, 29666 status: "hold", 29667 content: inputComment 29668 }); 29669 } else { 29670 onAddReply({ 29671 content: inputComment, 29672 parent: thread.id 29673 }); 29674 } 29675 }, 29676 onCancel: (event) => { 29677 event.stopPropagation(); 29678 unselectThread(); 29679 focusCommentThread( 29680 thread.id, 29681 commentSidebarRef.current 29682 ); 29683 }, 29684 submitButtonText: "approved" === thread.status ? (0,external_wp_i18n_namespaceObject.__)("Reopen & Reply") : (0,external_wp_i18n_namespaceObject.__)("Reply"), 29685 rows: "approved" === thread.status ? 2 : 4, 29686 labelText: (0,external_wp_i18n_namespaceObject.sprintf)( 29687 // translators: %1$s: note identifier, %2$s: author name 29688 (0,external_wp_i18n_namespaceObject.__)("Reply to note %1$s by %2$s"), 29689 thread.id, 29690 thread.author_name 29691 ), 29692 reflowComments 29693 } 29694 ) }) 29695 ] }), 29696 !!thread.blockClientId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29697 external_wp_components_namespaceObject.Button, 29698 { 29699 className: "editor-collab-sidebar-panel__skip-to-block", 29700 variant: "secondary", 29701 size: "compact", 29702 onClick: (event) => { 29703 event.stopPropagation(); 29704 relatedBlockElement?.focus(); 29705 }, 29706 children: (0,external_wp_i18n_namespaceObject.__)("Back to block") 29707 } 29708 ) 29709 ] 29710 } 29711 ); 29712 } 29713 const CommentBoard = ({ 29714 thread, 29715 parent, 29716 isExpanded, 29717 onEdit, 29718 onDelete, 29719 reflowComments 29720 }) => { 29721 const [actionState, setActionState] = (0,external_wp_element_namespaceObject.useState)(false); 29722 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); 29723 const actionButtonRef = (0,external_wp_element_namespaceObject.useRef)(null); 29724 const handleConfirmDelete = () => { 29725 onDelete(thread); 29726 setActionState(false); 29727 setShowConfirmDialog(false); 29728 }; 29729 const handleCancel = () => { 29730 setActionState(false); 29731 setShowConfirmDialog(false); 29732 actionButtonRef.current?.focus(); 29733 }; 29734 const isResolutionComment = thread.type === "note" && thread.meta && (thread.meta._wp_note_status === "resolved" || thread.meta._wp_note_status === "reopen"); 29735 const actions = [ 29736 { 29737 id: "edit", 29738 title: (0,external_wp_i18n_namespaceObject.__)("Edit"), 29739 isEligible: ({ status }) => status !== "approved", 29740 onClick: () => { 29741 setActionState("edit"); 29742 } 29743 }, 29744 { 29745 id: "reopen", 29746 title: (0,external_wp_i18n_namespaceObject._x)("Reopen", "Reopen note"), 29747 isEligible: ({ status }) => status === "approved", 29748 onClick: () => { 29749 onEdit({ id: thread.id, status: "hold" }); 29750 } 29751 }, 29752 { 29753 id: "delete", 29754 title: (0,external_wp_i18n_namespaceObject.__)("Delete"), 29755 isEligible: () => true, 29756 onClick: () => { 29757 setActionState("delete"); 29758 setShowConfirmDialog(true); 29759 } 29760 } 29761 ]; 29762 const canResolve = thread.parent === 0; 29763 const moreActions = parent?.status !== "approved" ? actions.filter((item) => item.isEligible(thread)) : []; 29764 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 29765 external_wp_components_namespaceObject.__experimentalVStack, 29766 { 29767 spacing: "2", 29768 role: thread.parent !== 0 ? "treeitem" : void 0, 29769 children: [ 29770 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { alignment: "left", spacing: "3", justify: "flex-start", children: [ 29771 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29772 comment_author_info_default, 29773 { 29774 avatar: thread?.author_avatar_urls?.[48], 29775 name: thread?.author_name, 29776 date: thread?.date, 29777 userId: thread?.author 29778 } 29779 ), 29780 isExpanded && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29781 external_wp_components_namespaceObject.FlexItem, 29782 { 29783 className: "editor-collab-sidebar-panel__comment-status", 29784 onClick: (event) => { 29785 event.stopPropagation(); 29786 }, 29787 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: "0", children: [ 29788 canResolve && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29789 external_wp_components_namespaceObject.Button, 29790 { 29791 label: (0,external_wp_i18n_namespaceObject._x)( 29792 "Resolve", 29793 "Mark note as resolved" 29794 ), 29795 size: "small", 29796 icon: published_default, 29797 disabled: thread.status === "approved", 29798 accessibleWhenDisabled: thread.status === "approved", 29799 onClick: () => { 29800 onEdit({ 29801 id: thread.id, 29802 status: "approved" 29803 }); 29804 } 29805 } 29806 ), 29807 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(comments_Menu, { placement: "bottom-end", children: [ 29808 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29809 comments_Menu.TriggerButton, 29810 { 29811 render: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29812 external_wp_components_namespaceObject.Button, 29813 { 29814 ref: actionButtonRef, 29815 size: "small", 29816 icon: more_vertical_default, 29817 label: (0,external_wp_i18n_namespaceObject.__)("Actions"), 29818 disabled: !moreActions.length, 29819 accessibleWhenDisabled: true 29820 } 29821 ) 29822 } 29823 ), 29824 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comments_Menu.Popover, { children: moreActions.map((action) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29825 comments_Menu.Item, 29826 { 29827 onClick: () => action.onClick(), 29828 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comments_Menu.ItemLabel, { children: action.title }) 29829 }, 29830 action.id 29831 )) }) 29832 ] }) 29833 ] }) 29834 } 29835 ) 29836 ] }), 29837 "edit" === actionState ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29838 comment_form_default, 29839 { 29840 onSubmit: (value) => { 29841 onEdit({ 29842 id: thread.id, 29843 content: value 29844 }); 29845 setActionState(false); 29846 actionButtonRef.current?.focus(); 29847 }, 29848 onCancel: () => handleCancel(), 29849 thread, 29850 submitButtonText: (0,external_wp_i18n_namespaceObject._x)("Update", "verb"), 29851 labelText: (0,external_wp_i18n_namespaceObject.sprintf)( 29852 // translators: %1$s: note identifier, %2$s: author name. 29853 (0,external_wp_i18n_namespaceObject.__)("Edit note %1$s by %2$s"), 29854 thread.id, 29855 thread.author_name 29856 ), 29857 reflowComments 29858 } 29859 ) : /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29860 external_wp_element_namespaceObject.RawHTML, 29861 { 29862 className: dist_clsx( 29863 "editor-collab-sidebar-panel__user-comment", 29864 { 29865 "editor-collab-sidebar-panel__resolution-text": isResolutionComment 29866 } 29867 ), 29868 children: isResolutionComment ? (() => { 29869 const actionText = thread.meta._wp_note_status === "resolved" ? (0,external_wp_i18n_namespaceObject.__)("Marked as resolved") : (0,external_wp_i18n_namespaceObject.__)("Reopened"); 29870 const content = thread?.content?.raw; 29871 if (content && typeof content === "string" && content.trim() !== "") { 29872 return (0,external_wp_i18n_namespaceObject.sprintf)( 29873 // translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text. 29874 (0,external_wp_i18n_namespaceObject.__)("%1$s: %2$s"), 29875 actionText, 29876 content 29877 ); 29878 } 29879 return actionText; 29880 })() : thread?.content?.rendered 29881 } 29882 ), 29883 "delete" === actionState && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29884 external_wp_components_namespaceObject.__experimentalConfirmDialog, 29885 { 29886 isOpen: showConfirmDialog, 29887 onConfirm: handleConfirmDelete, 29888 onCancel: handleCancel, 29889 confirmButtonText: (0,external_wp_i18n_namespaceObject.__)("Delete"), 29890 children: (0,external_wp_i18n_namespaceObject.__)( 29891 "Are you sure you want to delete this note? This will also delete all of this note's replies." 29892 ) 29893 } 29894 ) 29895 ] 29896 } 29897 ); 29898 }; 29899 var comments_default = (/* unused pure expression or super */ null && (Comments)); 29900 29901 29902 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-menu-item.js 29903 29904 29905 29906 29907 29908 29909 29910 29911 const { CommentIconSlotFill } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 29912 const AddCommentMenuItem = ({ clientId, onClick, isDistractionFree }) => { 29913 const block = (0,external_wp_data_namespaceObject.useSelect)( 29914 (select) => { 29915 return select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId); 29916 }, 29917 [clientId] 29918 ); 29919 if (!block?.isValid || block?.name === (0,external_wp_blocks_namespaceObject.getUnregisteredTypeHandlerName)()) { 29920 return null; 29921 } 29922 const isDisabled = isDistractionFree || block?.name === "core/freeform"; 29923 let infoText; 29924 if (isDistractionFree) { 29925 infoText = (0,external_wp_i18n_namespaceObject.__)("Notes are disabled in distraction free mode."); 29926 } else if (block?.name === "core/freeform") { 29927 infoText = (0,external_wp_i18n_namespaceObject.__)("Convert to blocks to add notes."); 29928 } 29929 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29930 external_wp_components_namespaceObject.MenuItem, 29931 { 29932 icon: comment_default, 29933 onClick, 29934 "aria-haspopup": "dialog", 29935 disabled: isDisabled, 29936 info: infoText, 29937 children: (0,external_wp_i18n_namespaceObject.__)("Add note") 29938 } 29939 ); 29940 }; 29941 const AddCommentMenuItemFill = ({ onClick, isDistractionFree }) => { 29942 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconSlotFill.Fill, { children: ({ clientId, onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 29943 AddCommentMenuItem, 29944 { 29945 clientId, 29946 isDistractionFree, 29947 onClick: () => { 29948 onClick(); 29949 onClose(); 29950 } 29951 } 29952 ) }); 29953 }; 29954 var comment_menu_item_default = AddCommentMenuItemFill; 29955 29956 29957 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/comment-indicator-toolbar.js 29958 29959 29960 29961 29962 29963 29964 29965 const { CommentIconToolbarSlotFill } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 29966 const CommentAvatarIndicator = ({ onClick, thread }) => { 29967 const threadParticipants = (0,external_wp_element_namespaceObject.useMemo)(() => { 29968 if (!thread) { 29969 return []; 29970 } 29971 const participantsMap = /* @__PURE__ */ new Map(); 29972 const allComments = [thread, ...thread.reply]; 29973 allComments.sort((a, b) => new Date(a.date) - new Date(b.date)); 29974 allComments.forEach((comment) => { 29975 if (comment.author_name && comment.author_avatar_urls) { 29976 if (!participantsMap.has(comment.author)) { 29977 participantsMap.set(comment.author, { 29978 name: comment.author_name, 29979 avatar: comment.author_avatar_urls?.["48"] || comment.author_avatar_urls?.["96"], 29980 id: comment.author, 29981 date: comment.date 29982 }); 29983 } 29984 } 29985 }); 29986 return Array.from(participantsMap.values()); 29987 }, [thread]); 29988 if (!threadParticipants.length) { 29989 return null; 29990 } 29991 const maxAvatars = 3; 29992 const isOverflow = threadParticipants.length > maxAvatars; 29993 const visibleParticipants = isOverflow ? threadParticipants.slice(0, maxAvatars - 1) : threadParticipants; 29994 const overflowCount = Math.max( 29995 0, 29996 threadParticipants.length - visibleParticipants.length 29997 ); 29998 const threadHasMoreParticipants = threadParticipants.length > 100; 29999 const overflowText = threadHasMoreParticipants && overflowCount > 0 ? (0,external_wp_i18n_namespaceObject.__)("100+") : (0,external_wp_i18n_namespaceObject.sprintf)( 30000 // translators: %s: Number of participants. 30001 (0,external_wp_i18n_namespaceObject.__)("+%s"), 30002 overflowCount 30003 ); 30004 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CommentIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30005 external_wp_components_namespaceObject.ToolbarButton, 30006 { 30007 className: "comment-avatar-indicator", 30008 label: (0,external_wp_i18n_namespaceObject.__)("View notes"), 30009 onClick, 30010 showTooltip: true, 30011 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { spacing: "1", children: [ 30012 visibleParticipants.map((participant) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30013 "img", 30014 { 30015 src: participant.avatar, 30016 alt: participant.name, 30017 className: "comment-avatar", 30018 style: { 30019 borderColor: getAvatarBorderColor( 30020 participant.id 30021 ) 30022 } 30023 }, 30024 participant.id 30025 )), 30026 overflowCount > 0 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { weight: 500, children: overflowText }) 30027 ] }) 30028 } 30029 ) }); 30030 }; 30031 var comment_indicator_toolbar_default = CommentAvatarIndicator; 30032 30033 30034 ;// ./node_modules/@wordpress/editor/build-module/components/collab-sidebar/index.js 30035 30036 30037 30038 30039 30040 30041 30042 30043 30044 30045 30046 30047 30048 30049 30050 30051 30052 30053 30054 30055 function NotesSidebarContent({ 30056 showCommentBoard, 30057 setShowCommentBoard, 30058 styles, 30059 comments, 30060 commentSidebarRef, 30061 reflowComments, 30062 commentLastUpdated, 30063 isFloating = false 30064 }) { 30065 const { onCreate, onEdit, onDelete } = useBlockCommentsActions(reflowComments); 30066 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30067 external_wp_components_namespaceObject.__experimentalVStack, 30068 { 30069 className: "editor-collab-sidebar-panel", 30070 style: styles, 30071 role: "tree", 30072 spacing: "3", 30073 justify: "flex-start", 30074 ref: (node) => { 30075 if (node) { 30076 commentSidebarRef.current = node; 30077 } 30078 }, 30079 "aria-label": isFloating ? (0,external_wp_i18n_namespaceObject.__)("Unresolved notes") : (0,external_wp_i18n_namespaceObject.__)("All notes"), 30080 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30081 Comments, 30082 { 30083 threads: comments, 30084 onEditComment: onEdit, 30085 onAddReply: onCreate, 30086 onCommentDelete: onDelete, 30087 showCommentBoard, 30088 setShowCommentBoard, 30089 commentSidebarRef, 30090 reflowComments, 30091 commentLastUpdated, 30092 isFloating 30093 } 30094 ) 30095 } 30096 ); 30097 } 30098 function NotesSidebar({ postId, mode }) { 30099 const [showCommentBoard, setShowCommentBoard] = (0,external_wp_element_namespaceObject.useState)(false); 30100 const { getActiveComplementaryArea } = (0,external_wp_data_namespaceObject.useSelect)(store); 30101 const { enableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); 30102 const { toggleBlockSpotlight } = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store)); 30103 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); 30104 const commentSidebarRef = (0,external_wp_element_namespaceObject.useRef)(null); 30105 const showFloatingSidebar = isLargeViewport && mode === "post-only"; 30106 const { clientId, blockCommentId, isDistractionFree } = (0,external_wp_data_namespaceObject.useSelect)( 30107 (select) => { 30108 const { 30109 getBlockAttributes, 30110 getSelectedBlockClientId, 30111 getSettings 30112 } = select(external_wp_blockEditor_namespaceObject.store); 30113 const _clientId = getSelectedBlockClientId(); 30114 return { 30115 clientId: _clientId, 30116 blockCommentId: _clientId ? getBlockAttributes(_clientId)?.metadata?.noteId : null, 30117 isDistractionFree: getSettings().isDistractionFree 30118 }; 30119 }, 30120 [] 30121 ); 30122 const { 30123 resultComments, 30124 unresolvedSortedThreads, 30125 reflowComments, 30126 commentLastUpdated 30127 } = useBlockComments(postId); 30128 useEnableFloatingSidebar( 30129 showFloatingSidebar && (unresolvedSortedThreads.length > 0 || showCommentBoard) 30130 ); 30131 const { merged: GlobalStyles } = useGlobalStylesContext(); 30132 const backgroundColor = GlobalStyles?.styles?.color?.background; 30133 const currentThread = blockCommentId ? resultComments.find((thread) => thread.id === blockCommentId) : null; 30134 const showAllNotesSidebar = resultComments.length > 0 || !showFloatingSidebar; 30135 async function openTheSidebar() { 30136 const prevArea = await getActiveComplementaryArea("core"); 30137 const activeNotesArea = SIDEBARS.find((name) => name === prevArea); 30138 if (currentThread?.status === "approved") { 30139 enableComplementaryArea("core", collabHistorySidebarName); 30140 } else if (!activeNotesArea) { 30141 enableComplementaryArea( 30142 "core", 30143 showFloatingSidebar ? collabSidebarName : collabHistorySidebarName 30144 ); 30145 } 30146 const currentArea = await getActiveComplementaryArea("core"); 30147 if (!SIDEBARS.includes(currentArea)) { 30148 return; 30149 } 30150 setShowCommentBoard(!blockCommentId); 30151 focusCommentThread( 30152 blockCommentId, 30153 commentSidebarRef.current, 30154 // Focus a comment thread when there's a selected block with a comment. 30155 !blockCommentId ? "textarea" : void 0 30156 ); 30157 toggleBlockSpotlight(clientId, true); 30158 } 30159 if (isDistractionFree) { 30160 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_menu_item_default, { isDistractionFree: true }); 30161 } 30162 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 30163 blockCommentId && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30164 comment_indicator_toolbar_default, 30165 { 30166 thread: currentThread, 30167 onClick: openTheSidebar 30168 } 30169 ), 30170 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(comment_menu_item_default, { onClick: openTheSidebar }), 30171 showAllNotesSidebar && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30172 PluginSidebar, 30173 { 30174 identifier: collabHistorySidebarName, 30175 name: collabHistorySidebarName, 30176 title: (0,external_wp_i18n_namespaceObject.__)("All notes"), 30177 header: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", { className: "interface-complementary-area-header__title", children: (0,external_wp_i18n_namespaceObject.__)("All notes") }), 30178 icon: comment_default, 30179 closeLabel: (0,external_wp_i18n_namespaceObject.__)("Close Notes"), 30180 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30181 NotesSidebarContent, 30182 { 30183 comments: resultComments, 30184 showCommentBoard, 30185 setShowCommentBoard, 30186 commentSidebarRef, 30187 reflowComments, 30188 commentLastUpdated 30189 } 30190 ) 30191 } 30192 ), 30193 isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30194 PluginSidebar, 30195 { 30196 isPinnable: false, 30197 header: false, 30198 identifier: collabSidebarName, 30199 className: "editor-collab-sidebar", 30200 headerClassName: "editor-collab-sidebar__header", 30201 backgroundColor, 30202 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30203 NotesSidebarContent, 30204 { 30205 comments: unresolvedSortedThreads, 30206 showCommentBoard, 30207 setShowCommentBoard, 30208 commentSidebarRef, 30209 reflowComments, 30210 commentLastUpdated, 30211 styles: { 30212 backgroundColor 30213 }, 30214 isFloating: true 30215 } 30216 ) 30217 } 30218 ) 30219 ] }); 30220 } 30221 function NotesSidebarContainer() { 30222 const { postId, mode, editorMode } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 30223 const { getCurrentPostId, getRenderingMode, getEditorMode } = select(store_store); 30224 return { 30225 postId: getCurrentPostId(), 30226 mode: getRenderingMode(), 30227 editorMode: getEditorMode() 30228 }; 30229 }, []); 30230 if (!postId || typeof postId !== "number") { 30231 return null; 30232 } 30233 if (editorMode === "text") { 30234 return null; 30235 } 30236 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_type_support_check_default, { supportKeys: "editor.notes", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotesSidebar, { postId, mode }) }); 30237 } 30238 30239 30240 ;// ./node_modules/@wordpress/editor/build-module/components/editor/index.js 30241 30242 30243 30244 30245 30246 30247 30248 30249 30250 30251 function Editor({ 30252 postType, 30253 postId, 30254 templateId, 30255 settings, 30256 children, 30257 initialEdits, 30258 // This could be part of the settings. 30259 onActionPerformed, 30260 // The following abstractions are not ideal but necessary 30261 // to account for site editor and post editor differences for now. 30262 extraContent, 30263 extraSidebarPanels, 30264 ...props 30265 }) { 30266 const { post, template, hasLoadedPost, error } = (0,external_wp_data_namespaceObject.useSelect)( 30267 (select) => { 30268 const { 30269 getEntityRecord, 30270 getResolutionError, 30271 hasFinishedResolution 30272 } = select(external_wp_coreData_namespaceObject.store); 30273 const postArgs = ["postType", postType, postId]; 30274 return { 30275 post: getEntityRecord(...postArgs), 30276 template: templateId ? getEntityRecord( 30277 "postType", 30278 TEMPLATE_POST_TYPE, 30279 templateId 30280 ) : void 0, 30281 hasLoadedPost: hasFinishedResolution( 30282 "getEntityRecord", 30283 postArgs 30284 ), 30285 error: getResolutionError("getEntityRecord", postArgs)?.message 30286 }; 30287 }, 30288 [postType, postId, templateId] 30289 ); 30290 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 30291 hasLoadedPost && !post && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30292 external_wp_components_namespaceObject.Notice, 30293 { 30294 status: !!error ? "error" : "warning", 30295 isDismissible: false, 30296 children: !error ? (0,external_wp_i18n_namespaceObject.__)( 30297 "You attempted to edit an item that doesn't exist. Perhaps it was deleted?" 30298 ) : error 30299 } 30300 ), 30301 !!post && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 30302 ExperimentalEditorProvider, 30303 { 30304 post, 30305 __unstableTemplate: template, 30306 settings, 30307 initialEdits, 30308 useSubRegistry: false, 30309 children: [ 30310 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, { ...props, children: extraContent }), 30311 children, 30312 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30313 sidebar_sidebar_default, 30314 { 30315 onActionPerformed, 30316 extraPanels: extraSidebarPanels 30317 } 30318 ), 30319 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(NotesSidebarContainer, {}) 30320 ] 30321 } 30322 ) 30323 ] }); 30324 } 30325 var editor_default = Editor; 30326 30327 30328 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/enable-publish-sidebar.js 30329 30330 30331 30332 30333 30334 const { PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption } = unlock(external_wp_preferences_namespaceObject.privateApis); 30335 function EnablePublishSidebarOption(props) { 30336 const isChecked = (0,external_wp_data_namespaceObject.useSelect)((select) => { 30337 return select(store_store).isPublishSidebarEnabled(); 30338 }, []); 30339 const { enablePublishSidebar, disablePublishSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 30340 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30341 enable_publish_sidebar_PreferenceBaseOption, 30342 { 30343 isChecked, 30344 onChange: (isEnabled) => isEnabled ? enablePublishSidebar() : disablePublishSidebar(), 30345 ...props 30346 } 30347 ); 30348 } 30349 30350 30351 ;// ./node_modules/@wordpress/editor/build-module/components/block-visibility/index.js 30352 30353 30354 30355 30356 30357 30358 30359 30360 30361 30362 const { BlockManager } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 30363 const block_visibility_EMPTY_ARRAY = []; 30364 function BlockVisibility() { 30365 const { showBlockTypes, hideBlockTypes } = unlock( 30366 (0,external_wp_data_namespaceObject.useDispatch)(store_store) 30367 ); 30368 const { 30369 blockTypes, 30370 allowedBlockTypes: _allowedBlockTypes, 30371 hiddenBlockTypes: _hiddenBlockTypes 30372 } = (0,external_wp_data_namespaceObject.useSelect)((select) => { 30373 return { 30374 blockTypes: select(external_wp_blocks_namespaceObject.store).getBlockTypes(), 30375 allowedBlockTypes: select(store_store).getEditorSettings().allowedBlockTypes, 30376 hiddenBlockTypes: select(external_wp_preferences_namespaceObject.store).get("core", "hiddenBlockTypes") ?? block_visibility_EMPTY_ARRAY 30377 }; 30378 }, []); 30379 const allowedBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { 30380 if (_allowedBlockTypes === true) { 30381 return blockTypes; 30382 } 30383 return blockTypes.filter(({ name }) => { 30384 return _allowedBlockTypes?.includes(name); 30385 }); 30386 }, [_allowedBlockTypes, blockTypes]); 30387 const filteredBlockTypes = allowedBlockTypes.filter( 30388 (blockType) => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, "inserter", true) && (!blockType.parent || blockType.parent.includes("core/post-content")) 30389 ); 30390 const hiddenBlockTypes = _hiddenBlockTypes.filter((hiddenBlock) => { 30391 return filteredBlockTypes.some( 30392 (registeredBlock) => registeredBlock.name === hiddenBlock 30393 ); 30394 }); 30395 const selectedBlockTypes = filteredBlockTypes.filter( 30396 (blockType) => !hiddenBlockTypes.includes(blockType.name) 30397 ); 30398 const numberOfHiddenBlocks = filteredBlockTypes.length - selectedBlockTypes.length; 30399 function enableAllBlockTypes() { 30400 onChangeSelectedBlockTypes(filteredBlockTypes); 30401 } 30402 const onChangeSelectedBlockTypes = (newSelectedBlockTypes) => { 30403 if (selectedBlockTypes.length > newSelectedBlockTypes.length) { 30404 const blockTypesToHide = selectedBlockTypes.filter( 30405 (blockType) => !newSelectedBlockTypes.find( 30406 ({ name }) => name === blockType.name 30407 ) 30408 ); 30409 hideBlockTypes(blockTypesToHide.map(({ name }) => name)); 30410 } else if (selectedBlockTypes.length < newSelectedBlockTypes.length) { 30411 const blockTypesToShow = newSelectedBlockTypes.filter( 30412 (blockType) => !selectedBlockTypes.find( 30413 ({ name }) => name === blockType.name 30414 ) 30415 ); 30416 showBlockTypes(blockTypesToShow.map(({ name }) => name)); 30417 } 30418 }; 30419 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-block-visibility", children: [ 30420 !!numberOfHiddenBlocks && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { className: "editor-block-visibility__disabled-blocks-count", children: [ 30421 (0,external_wp_i18n_namespaceObject.sprintf)( 30422 /* translators: %d: number of blocks. */ 30423 (0,external_wp_i18n_namespaceObject._n)( 30424 "%d block is hidden.", 30425 "%d blocks are hidden.", 30426 numberOfHiddenBlocks 30427 ), 30428 numberOfHiddenBlocks 30429 ), 30430 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30431 external_wp_components_namespaceObject.Button, 30432 { 30433 __next40pxDefaultSize: true, 30434 variant: "link", 30435 onClick: enableAllBlockTypes, 30436 children: (0,external_wp_i18n_namespaceObject.__)("Reset") 30437 } 30438 ) 30439 ] }), 30440 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30441 BlockManager, 30442 { 30443 blockTypes: filteredBlockTypes, 30444 selectedBlockTypes, 30445 onChange: onChangeSelectedBlockTypes, 30446 showSelectAll: false 30447 } 30448 ) 30449 ] }); 30450 } 30451 30452 30453 ;// ./node_modules/@wordpress/editor/build-module/components/preferences-modal/index.js 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 30465 30466 30467 30468 30469 30470 30471 30472 const { 30473 PreferencesModal, 30474 PreferencesModalTabs, 30475 PreferencesModalSection, 30476 PreferenceToggleControl 30477 } = unlock(external_wp_preferences_namespaceObject.privateApis); 30478 function EditorPreferencesModal({ extraSections = {} }) { 30479 const isActive = (0,external_wp_data_namespaceObject.useSelect)((select) => { 30480 return select(store).isModalActive("editor/preferences"); 30481 }, []); 30482 const { closeModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); 30483 if (!isActive) { 30484 return null; 30485 } 30486 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { closeModal, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalContents, { extraSections }) }); 30487 } 30488 function PreferencesModalContents({ extraSections = {} }) { 30489 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)("medium"); 30490 const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)( 30491 (select) => { 30492 const { getEditorSettings } = select(store_store); 30493 const { get } = select(external_wp_preferences_namespaceObject.store); 30494 const isRichEditingEnabled = getEditorSettings().richEditingEnabled; 30495 const isDistractionFreeEnabled = get("core", "distractionFree"); 30496 return !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled; 30497 }, 30498 [isLargeViewport] 30499 ); 30500 const { setIsListViewOpened, setIsInserterOpened } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 30501 const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 30502 const sections = (0,external_wp_element_namespaceObject.useMemo)( 30503 () => [ 30504 { 30505 name: "general", 30506 tabLabel: (0,external_wp_i18n_namespaceObject.__)("General"), 30507 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 30508 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 30509 PreferencesModalSection, 30510 { 30511 title: (0,external_wp_i18n_namespaceObject.__)("Interface"), 30512 children: [ 30513 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30514 PreferenceToggleControl, 30515 { 30516 scope: "core", 30517 featureName: "showListViewByDefault", 30518 help: (0,external_wp_i18n_namespaceObject.__)( 30519 "Opens the List View panel by default." 30520 ), 30521 label: (0,external_wp_i18n_namespaceObject.__)("Always open List View") 30522 } 30523 ), 30524 showBlockBreadcrumbsOption && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30525 PreferenceToggleControl, 30526 { 30527 scope: "core", 30528 featureName: "showBlockBreadcrumbs", 30529 help: (0,external_wp_i18n_namespaceObject.__)( 30530 "Display the block hierarchy trail at the bottom of the editor." 30531 ), 30532 label: (0,external_wp_i18n_namespaceObject.__)("Show block breadcrumbs") 30533 } 30534 ), 30535 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30536 PreferenceToggleControl, 30537 { 30538 scope: "core", 30539 featureName: "allowRightClickOverrides", 30540 help: (0,external_wp_i18n_namespaceObject.__)( 30541 "Allows contextual List View menus via right-click, overriding browser defaults." 30542 ), 30543 label: (0,external_wp_i18n_namespaceObject.__)( 30544 "Allow right-click contextual menus" 30545 ) 30546 } 30547 ), 30548 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30549 PreferenceToggleControl, 30550 { 30551 scope: "core", 30552 featureName: "enableChoosePatternModal", 30553 help: (0,external_wp_i18n_namespaceObject.__)( 30554 "Shows starter patterns when creating a new page." 30555 ), 30556 label: (0,external_wp_i18n_namespaceObject.__)("Show starter patterns") 30557 } 30558 ) 30559 ] 30560 } 30561 ), 30562 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 30563 PreferencesModalSection, 30564 { 30565 title: (0,external_wp_i18n_namespaceObject.__)("Document settings"), 30566 description: (0,external_wp_i18n_namespaceObject.__)( 30567 "Select what settings are shown in the document panel." 30568 ), 30569 children: [ 30570 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_plugin_document_setting_panel_default.Slot, {}), 30571 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30572 post_taxonomies_default, 30573 { 30574 taxonomyWrapper: (content, taxonomy) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30575 EnablePanelOption, 30576 { 30577 label: taxonomy.labels.menu_name, 30578 panelName: `taxonomy-panel-$taxonomy.slug}` 30579 } 30580 ) 30581 } 30582 ), 30583 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_featured_image_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30584 EnablePanelOption, 30585 { 30586 label: (0,external_wp_i18n_namespaceObject.__)("Featured image"), 30587 panelName: "featured-image" 30588 } 30589 ) }), 30590 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(post_excerpt_check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30591 EnablePanelOption, 30592 { 30593 label: (0,external_wp_i18n_namespaceObject.__)("Excerpt"), 30594 panelName: "post-excerpt" 30595 } 30596 ) }), 30597 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30598 post_type_support_check_default, 30599 { 30600 supportKeys: ["comments", "trackbacks"], 30601 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30602 EnablePanelOption, 30603 { 30604 label: (0,external_wp_i18n_namespaceObject.__)("Discussion"), 30605 panelName: "discussion-panel" 30606 } 30607 ) 30608 } 30609 ), 30610 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(check_check_default, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30611 EnablePanelOption, 30612 { 30613 label: (0,external_wp_i18n_namespaceObject.__)("Page attributes"), 30614 panelName: "page-attributes" 30615 } 30616 ) }) 30617 ] 30618 } 30619 ), 30620 isLargeViewport && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30621 PreferencesModalSection, 30622 { 30623 title: (0,external_wp_i18n_namespaceObject.__)("Publishing"), 30624 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30625 EnablePublishSidebarOption, 30626 { 30627 help: (0,external_wp_i18n_namespaceObject.__)( 30628 "Review settings, such as visibility and tags." 30629 ), 30630 label: (0,external_wp_i18n_namespaceObject.__)( 30631 "Enable pre-publish checks" 30632 ) 30633 } 30634 ) 30635 } 30636 ), 30637 extraSections?.general 30638 ] }) 30639 }, 30640 { 30641 name: "appearance", 30642 tabLabel: (0,external_wp_i18n_namespaceObject.__)("Appearance"), 30643 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 30644 PreferencesModalSection, 30645 { 30646 title: (0,external_wp_i18n_namespaceObject.__)("Appearance"), 30647 description: (0,external_wp_i18n_namespaceObject.__)( 30648 "Customize the editor interface to suit your needs." 30649 ), 30650 children: [ 30651 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30652 PreferenceToggleControl, 30653 { 30654 scope: "core", 30655 featureName: "fixedToolbar", 30656 onToggle: () => setPreference( 30657 "core", 30658 "distractionFree", 30659 false 30660 ), 30661 help: (0,external_wp_i18n_namespaceObject.__)( 30662 "Access all block and document tools in a single place." 30663 ), 30664 label: (0,external_wp_i18n_namespaceObject.__)("Top toolbar") 30665 } 30666 ), 30667 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30668 PreferenceToggleControl, 30669 { 30670 scope: "core", 30671 featureName: "distractionFree", 30672 onToggle: () => { 30673 setPreference( 30674 "core", 30675 "fixedToolbar", 30676 true 30677 ); 30678 setIsInserterOpened(false); 30679 setIsListViewOpened(false); 30680 }, 30681 help: (0,external_wp_i18n_namespaceObject.__)( 30682 "Reduce visual distractions by hiding the toolbar and other elements to focus on writing." 30683 ), 30684 label: (0,external_wp_i18n_namespaceObject.__)("Distraction free") 30685 } 30686 ), 30687 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30688 PreferenceToggleControl, 30689 { 30690 scope: "core", 30691 featureName: "focusMode", 30692 help: (0,external_wp_i18n_namespaceObject.__)( 30693 "Highlights the current block and fades other content." 30694 ), 30695 label: (0,external_wp_i18n_namespaceObject.__)("Spotlight mode") 30696 } 30697 ), 30698 extraSections?.appearance 30699 ] 30700 } 30701 ) 30702 }, 30703 { 30704 name: "accessibility", 30705 tabLabel: (0,external_wp_i18n_namespaceObject.__)("Accessibility"), 30706 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 30707 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30708 PreferencesModalSection, 30709 { 30710 title: (0,external_wp_i18n_namespaceObject.__)("Navigation"), 30711 description: (0,external_wp_i18n_namespaceObject.__)( 30712 "Optimize the editing experience for enhanced control." 30713 ), 30714 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30715 PreferenceToggleControl, 30716 { 30717 scope: "core", 30718 featureName: "keepCaretInsideBlock", 30719 help: (0,external_wp_i18n_namespaceObject.__)( 30720 "Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users." 30721 ), 30722 label: (0,external_wp_i18n_namespaceObject.__)( 30723 "Contain text cursor inside block" 30724 ) 30725 } 30726 ) 30727 } 30728 ), 30729 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30730 PreferencesModalSection, 30731 { 30732 title: (0,external_wp_i18n_namespaceObject.__)("Interface"), 30733 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30734 PreferenceToggleControl, 30735 { 30736 scope: "core", 30737 featureName: "showIconLabels", 30738 label: (0,external_wp_i18n_namespaceObject.__)("Show button text labels"), 30739 help: (0,external_wp_i18n_namespaceObject.__)( 30740 "Show text instead of icons on buttons across the interface." 30741 ) 30742 } 30743 ) 30744 } 30745 ) 30746 ] }) 30747 }, 30748 { 30749 name: "blocks", 30750 tabLabel: (0,external_wp_i18n_namespaceObject.__)("Blocks"), 30751 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [ 30752 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalSection, { title: (0,external_wp_i18n_namespaceObject.__)("Inserter"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30753 PreferenceToggleControl, 30754 { 30755 scope: "core", 30756 featureName: "mostUsedBlocks", 30757 help: (0,external_wp_i18n_namespaceObject.__)( 30758 "Adds a category with the most frequently used blocks in the inserter." 30759 ), 30760 label: (0,external_wp_i18n_namespaceObject.__)("Show most used blocks") 30761 } 30762 ) }), 30763 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30764 PreferencesModalSection, 30765 { 30766 title: (0,external_wp_i18n_namespaceObject.__)("Manage block visibility"), 30767 description: (0,external_wp_i18n_namespaceObject.__)( 30768 "Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later." 30769 ), 30770 children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockVisibility, {}) 30771 } 30772 ) 30773 ] }) 30774 }, 30775 window.__experimentalMediaProcessing && { 30776 name: "media", 30777 tabLabel: (0,external_wp_i18n_namespaceObject.__)("Media"), 30778 content: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)( 30779 PreferencesModalSection, 30780 { 30781 title: (0,external_wp_i18n_namespaceObject.__)("General"), 30782 description: (0,external_wp_i18n_namespaceObject.__)( 30783 "Customize options related to the media upload flow." 30784 ), 30785 children: [ 30786 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30787 PreferenceToggleControl, 30788 { 30789 scope: "core/media", 30790 featureName: "optimizeOnUpload", 30791 help: (0,external_wp_i18n_namespaceObject.__)( 30792 "Compress media items before uploading to the server." 30793 ), 30794 label: (0,external_wp_i18n_namespaceObject.__)("Pre-upload compression") 30795 } 30796 ), 30797 /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)( 30798 PreferenceToggleControl, 30799 { 30800 scope: "core/media", 30801 featureName: "requireApproval", 30802 help: (0,external_wp_i18n_namespaceObject.__)( 30803 "Require approval step when optimizing existing media." 30804 ), 30805 label: (0,external_wp_i18n_namespaceObject.__)("Approval step") 30806 } 30807 ) 30808 ] 30809 } 30810 ) }) 30811 } 30812 ].filter(Boolean), 30813 [ 30814 showBlockBreadcrumbsOption, 30815 extraSections, 30816 setIsInserterOpened, 30817 setIsListViewOpened, 30818 setPreference, 30819 isLargeViewport 30820 ] 30821 ); 30822 return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModalTabs, { sections }); 30823 } 30824 30825 30826 ;// ./node_modules/@wordpress/editor/build-module/components/post-fields/index.js 30827 30828 30829 30830 30831 function usePostFields({ 30832 postType 30833 }) { 30834 const { registerPostTypeSchema } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store)); 30835 (0,external_wp_element_namespaceObject.useEffect)(() => { 30836 registerPostTypeSchema(postType); 30837 }, [registerPostTypeSchema, postType]); 30838 const { fields } = (0,external_wp_data_namespaceObject.useSelect)( 30839 (select) => { 30840 const { getEntityFields } = unlock(select(store_store)); 30841 return { 30842 fields: getEntityFields("postType", postType) 30843 }; 30844 }, 30845 [postType] 30846 ); 30847 return fields; 30848 } 30849 var post_fields_default = usePostFields; 30850 30851 30852 ;// ./node_modules/@wordpress/editor/build-module/bindings/pattern-overrides.js 30853 30854 const CONTENT = "content"; 30855 var pattern_overrides_default = { 30856 name: "core/pattern-overrides", 30857 getValues({ select, clientId, context, bindings }) { 30858 const patternOverridesContent = context["pattern/overrides"]; 30859 const { getBlockAttributes } = select(external_wp_blockEditor_namespaceObject.store); 30860 const currentBlockAttributes = getBlockAttributes(clientId); 30861 const overridesValues = {}; 30862 for (const attributeName of Object.keys(bindings)) { 30863 const overridableValue = patternOverridesContent?.[currentBlockAttributes?.metadata?.name]?.[attributeName]; 30864 if (overridableValue === void 0) { 30865 overridesValues[attributeName] = currentBlockAttributes[attributeName]; 30866 continue; 30867 } else { 30868 overridesValues[attributeName] = overridableValue === "" ? void 0 : overridableValue; 30869 } 30870 } 30871 return overridesValues; 30872 }, 30873 setValues({ select, dispatch, clientId, bindings }) { 30874 const { getBlockAttributes, getBlockParentsByBlockName, getBlocks } = select(external_wp_blockEditor_namespaceObject.store); 30875 const currentBlockAttributes = getBlockAttributes(clientId); 30876 const blockName = currentBlockAttributes?.metadata?.name; 30877 if (!blockName) { 30878 return; 30879 } 30880 const [patternClientId] = getBlockParentsByBlockName( 30881 clientId, 30882 "core/block", 30883 true 30884 ); 30885 const attributes = Object.entries(bindings).reduce( 30886 (attrs, [key, { newValue }]) => { 30887 attrs[key] = newValue; 30888 return attrs; 30889 }, 30890 {} 30891 ); 30892 if (!patternClientId) { 30893 const syncBlocksWithSameName = (blocks) => { 30894 for (const block of blocks) { 30895 if (block.attributes?.metadata?.name === blockName) { 30896 dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes( 30897 block.clientId, 30898 attributes 30899 ); 30900 } 30901 syncBlocksWithSameName(block.innerBlocks); 30902 } 30903 }; 30904 syncBlocksWithSameName(getBlocks()); 30905 return; 30906 } 30907 const currentBindingValue = getBlockAttributes(patternClientId)?.[CONTENT]; 30908 dispatch(external_wp_blockEditor_namespaceObject.store).updateBlockAttributes(patternClientId, { 30909 [CONTENT]: { 30910 ...currentBindingValue, 30911 [blockName]: { 30912 ...currentBindingValue?.[blockName], 30913 ...Object.entries(attributes).reduce( 30914 (acc, [key, value]) => { 30915 acc[key] = value === void 0 ? "" : value; 30916 return acc; 30917 }, 30918 {} 30919 ) 30920 } 30921 } 30922 }); 30923 }, 30924 canUserEditValue: () => true 30925 }; 30926 30927 30928 ;// ./node_modules/@wordpress/editor/build-module/bindings/post-data.js 30929 30930 30931 30932 const NAVIGATION_BLOCK_TYPES = [ 30933 "core/navigation-link", 30934 "core/navigation-submenu" 30935 ]; 30936 const postDataFields = [ 30937 { 30938 label: (0,external_wp_i18n_namespaceObject.__)("Post Date"), 30939 args: { field: "date" }, 30940 type: "string" 30941 }, 30942 { 30943 label: (0,external_wp_i18n_namespaceObject.__)("Post Modified Date"), 30944 args: { field: "modified" }, 30945 type: "string" 30946 }, 30947 { 30948 label: (0,external_wp_i18n_namespaceObject.__)("Post Link"), 30949 args: { field: "link" }, 30950 type: "string" 30951 } 30952 ]; 30953 var post_data_default = { 30954 name: "core/post-data", 30955 getValues({ select, context, bindings, clientId }) { 30956 const allowedFields = postDataFields.map( 30957 (field) => field.args.field 30958 ); 30959 const { getBlockAttributes, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); 30960 const blockName = getBlockName?.(clientId); 30961 const isNavigationBlock = NAVIGATION_BLOCK_TYPES.includes(blockName); 30962 let postId, postType; 30963 if (isNavigationBlock) { 30964 const blockAttributes = getBlockAttributes?.(clientId); 30965 postId = blockAttributes?.id; 30966 postType = blockAttributes?.type; 30967 } else { 30968 postId = context?.postId; 30969 postType = context?.postType; 30970 } 30971 const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 30972 const entityDataValues = getEditedEntityRecord( 30973 "postType", 30974 postType, 30975 postId 30976 ); 30977 const newValues = {}; 30978 for (const [attributeName, binding] of Object.entries(bindings)) { 30979 if (!allowedFields.includes(binding.args.field)) { 30980 newValues[attributeName] = {}; 30981 continue; 30982 } 30983 newValues[attributeName] = entityDataValues?.[binding.args.field] ?? postDataFields.find( 30984 (field) => field.args.field === binding.args.field 30985 ).label; 30986 } 30987 return newValues; 30988 }, 30989 setValues({ dispatch, context, bindings, clientId, select }) { 30990 const { getBlockName } = select(external_wp_blockEditor_namespaceObject.store); 30991 const blockName = getBlockName?.(clientId); 30992 if (NAVIGATION_BLOCK_TYPES.includes(blockName)) { 30993 return false; 30994 } 30995 const newData = {}; 30996 Object.values(bindings).forEach(({ args, newValue }) => { 30997 newData[args.field] = newValue; 30998 }); 30999 dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( 31000 "postType", 31001 context?.postType, 31002 context?.postId, 31003 newData 31004 ); 31005 }, 31006 canUserEditValue({ select, context }) { 31007 const { getBlockName, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); 31008 const clientId = getSelectedBlockClientId(); 31009 const blockName = getBlockName?.(clientId); 31010 if (NAVIGATION_BLOCK_TYPES.includes(blockName)) { 31011 return false; 31012 } 31013 if (context?.query || context?.queryId) { 31014 return false; 31015 } 31016 if (!context?.postType) { 31017 return false; 31018 } 31019 const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser("update", { 31020 kind: "postType", 31021 name: context?.postType, 31022 id: context?.postId 31023 }); 31024 if (!canUserEdit) { 31025 return false; 31026 } 31027 return true; 31028 }, 31029 getFieldsList({ select }) { 31030 const selectedBlock = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlock(); 31031 if (selectedBlock?.name !== "core/post-date") { 31032 return []; 31033 } 31034 if (NAVIGATION_BLOCK_TYPES.includes(selectedBlock?.name)) { 31035 return []; 31036 } 31037 return postDataFields; 31038 } 31039 }; 31040 31041 31042 ;// ./node_modules/@wordpress/editor/build-module/bindings/post-meta.js 31043 31044 31045 31046 function getPostMetaFields(select, context) { 31047 const { getRegisteredPostMeta } = unlock(select(external_wp_coreData_namespaceObject.store)); 31048 const registeredFields = getRegisteredPostMeta(context?.postType); 31049 const metaFields = []; 31050 Object.entries(registeredFields).forEach(([key, props]) => { 31051 if (key === "footnotes" || key.charAt(0) === "_") { 31052 return; 31053 } 31054 metaFields.push({ 31055 label: props.title || key, 31056 args: { key }, 31057 default: props.default, 31058 type: props.type 31059 }); 31060 }); 31061 return metaFields; 31062 } 31063 function getValue({ select, context, args }) { 31064 const metaFields = getPostMetaFields(select, context); 31065 const metaField = metaFields.find( 31066 (field) => field.args.key === args.key 31067 ); 31068 if (!metaField) { 31069 return args.key; 31070 } 31071 if (!context?.postId) { 31072 return metaField.default || metaField.label || args.key; 31073 } 31074 const { getEditedEntityRecord } = select(external_wp_coreData_namespaceObject.store); 31075 const entityMetaValues = getEditedEntityRecord( 31076 "postType", 31077 context?.postType, 31078 context?.postId 31079 ).meta; 31080 return entityMetaValues?.[args.key] ?? metaField?.label ?? args.key; 31081 } 31082 var post_meta_default = { 31083 name: "core/post-meta", 31084 getValues({ select, context, bindings }) { 31085 const newValues = {}; 31086 for (const [attributeName, binding] of Object.entries(bindings)) { 31087 newValues[attributeName] = getValue({ 31088 select, 31089 context, 31090 args: binding.args 31091 }); 31092 } 31093 return newValues; 31094 }, 31095 setValues({ dispatch, context, bindings }) { 31096 const newMeta = {}; 31097 Object.values(bindings).forEach(({ args, newValue }) => { 31098 newMeta[args.key] = newValue; 31099 }); 31100 dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord( 31101 "postType", 31102 context?.postType, 31103 context?.postId, 31104 { 31105 meta: newMeta 31106 } 31107 ); 31108 }, 31109 canUserEditValue({ select, context, args }) { 31110 if (context?.query || context?.queryId) { 31111 return false; 31112 } 31113 if (!context?.postType) { 31114 return false; 31115 } 31116 const metaFields = getPostMetaFields(select, context); 31117 const hasMatchingMetaField = metaFields.some( 31118 (field) => field.args.key === args.key 31119 ); 31120 if (!hasMatchingMetaField) { 31121 return false; 31122 } 31123 const areCustomFieldsEnabled = select(store_store).getEditorSettings().enableCustomFields; 31124 if (areCustomFieldsEnabled) { 31125 return false; 31126 } 31127 const canUserEdit = select(external_wp_coreData_namespaceObject.store).canUser("update", { 31128 kind: "postType", 31129 name: context?.postType, 31130 id: context?.postId 31131 }); 31132 if (!canUserEdit) { 31133 return false; 31134 } 31135 return true; 31136 }, 31137 getFieldsList({ select, context }) { 31138 const metaFields = getPostMetaFields(select, context); 31139 return metaFields.map( 31140 ({ default: defaultProp, ...otherProps }) => ({ 31141 ...otherProps 31142 }) 31143 ); 31144 } 31145 }; 31146 31147 31148 ;// ./node_modules/@wordpress/editor/build-module/bindings/term-data.js 31149 31150 31151 31152 const term_data_NAVIGATION_BLOCK_TYPES = [ 31153 "core/navigation-link", 31154 "core/navigation-submenu" 31155 ]; 31156 function createDataFields(termDataValues, idValue) { 31157 return { 31158 id: { 31159 label: (0,external_wp_i18n_namespaceObject.__)("Term ID"), 31160 value: idValue, 31161 type: "string" 31162 }, 31163 name: { 31164 label: (0,external_wp_i18n_namespaceObject.__)("Name"), 31165 value: termDataValues?.name, 31166 type: "string" 31167 }, 31168 slug: { 31169 label: (0,external_wp_i18n_namespaceObject.__)("Slug"), 31170 value: termDataValues?.slug, 31171 type: "string" 31172 }, 31173 link: { 31174 label: (0,external_wp_i18n_namespaceObject.__)("Link"), 31175 value: termDataValues?.link, 31176 type: "string" 31177 }, 31178 description: { 31179 label: (0,external_wp_i18n_namespaceObject.__)("Description"), 31180 value: termDataValues?.description, 31181 type: "string" 31182 }, 31183 parent: { 31184 label: (0,external_wp_i18n_namespaceObject.__)("Parent ID"), 31185 value: termDataValues?.parent, 31186 type: "string" 31187 }, 31188 count: { 31189 label: (0,external_wp_i18n_namespaceObject.__)("Count"), 31190 value: `($termDataValues?.count ?? 0})`, 31191 type: "string" 31192 } 31193 }; 31194 } 31195 function getTermDataFields(select, context, clientId) { 31196 const { getEntityRecord } = select(external_wp_coreData_namespaceObject.store); 31197 const { getBlockAttributes, getBlockName } = select(external_wp_blockEditor_namespaceObject.store); 31198 let termDataValues, dataFields; 31199 const blockName = getBlockName?.(clientId); 31200 const isNavigationBlock = term_data_NAVIGATION_BLOCK_TYPES.includes(blockName); 31201 let termId, taxonomy; 31202 if (isNavigationBlock) { 31203 const blockAttributes = getBlockAttributes?.(clientId); 31204 termId = blockAttributes?.id; 31205 const typeFromAttributes = blockAttributes?.type; 31206 taxonomy = typeFromAttributes === "tag" ? "post_tag" : typeFromAttributes; 31207 } else { 31208 termId = context?.termId; 31209 taxonomy = context?.taxonomy; 31210 } 31211 if (taxonomy && termId) { 31212 termDataValues = getEntityRecord("taxonomy", taxonomy, termId); 31213 if (!termDataValues && context?.termData) { 31214 termDataValues = context.termData; 31215 } 31216 if (termDataValues) { 31217 dataFields = createDataFields(termDataValues, termId); 31218 } 31219 } else if (context?.termData) { 31220 termDataValues = context.termData; 31221 dataFields = createDataFields( 31222 termDataValues, 31223 termDataValues?.term_id 31224 ); 31225 } 31226 if (!dataFields || !Object.keys(dataFields).length) { 31227 return null; 31228 } 31229 return dataFields; 31230 } 31231 var term_data_default = { 31232 name: "core/term-data", 31233 usesContext: ["taxonomy", "termId", "termData"], 31234 getValues({ select, context, bindings, clientId }) { 31235 const dataFields = getTermDataFields(select, context, clientId); 31236 const newValues = {}; 31237 for (const [attributeName, source] of Object.entries(bindings)) { 31238 const fieldKey = source.args.field; 31239 const { value: fieldValue, label: fieldLabel } = dataFields?.[fieldKey] || {}; 31240 newValues[attributeName] = fieldValue ?? fieldLabel ?? fieldKey; 31241 } 31242 return newValues; 31243 }, 31244 // eslint-disable-next-line no-unused-vars 31245 setValues({ dispatch, context, bindings }) { 31246 return false; 31247 }, 31248 canUserEditValue({ select, context, args }) { 31249 const { getBlockName, getSelectedBlockClientId } = select(external_wp_blockEditor_namespaceObject.store); 31250 const clientId = getSelectedBlockClientId(); 31251 const blockName = getBlockName?.(clientId); 31252 if (term_data_NAVIGATION_BLOCK_TYPES.includes(blockName)) { 31253 return false; 31254 } 31255 if (context?.termQuery) { 31256 return false; 31257 } 31258 if (!context?.taxonomy || !context?.termId) { 31259 return false; 31260 } 31261 const fieldValue = getTermDataFields(select, context, void 0)?.[args.field]?.value; 31262 if (fieldValue === void 0) { 31263 return false; 31264 } 31265 return false; 31266 }, 31267 getFieldsList({ select, context }) { 31268 const clientId = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(); 31269 const termDataFields = getTermDataFields(select, context, clientId); 31270 if (!termDataFields) { 31271 return []; 31272 } 31273 return Object.entries(termDataFields).map(([key, field]) => ({ 31274 label: field.label, 31275 type: field.type, 31276 args: { field: key } 31277 })); 31278 } 31279 }; 31280 31281 31282 ;// ./node_modules/@wordpress/editor/build-module/bindings/api.js 31283 31284 31285 31286 31287 31288 function registerCoreBlockBindingsSources() { 31289 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(pattern_overrides_default); 31290 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_data_default); 31291 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(post_meta_default); 31292 (0,external_wp_blocks_namespaceObject.registerBlockBindingsSource)(term_data_default); 31293 } 31294 31295 31296 ;// ./node_modules/@wordpress/editor/build-module/private-apis.js 31297 31298 31299 31300 31301 31302 31303 31304 31305 31306 31307 31308 31309 31310 31311 31312 31313 31314 31315 const { store: interfaceStore, ...remainingInterfaceApis } = build_module_namespaceObject; 31316 const privateApis = {}; 31317 lock(privateApis, { 31318 CreateTemplatePartModal: CreateTemplatePartModal, 31319 patternTitleField: pattern_title_default, 31320 templateTitleField: template_title_default, 31321 BackButton: back_button_default, 31322 EntitiesSavedStatesExtensible: EntitiesSavedStatesExtensible, 31323 Editor: editor_default, 31324 EditorContentSlotFill: content_slot_fill_default, 31325 GlobalStylesProvider: GlobalStylesProvider, 31326 mergeBaseAndUserConfigs: mergeBaseAndUserConfigs, 31327 PluginPostExcerpt: plugin_default, 31328 PostCardPanel: PostCardPanel, 31329 PreferencesModal: EditorPreferencesModal, 31330 usePostActions: usePostActions, 31331 usePostFields: post_fields_default, 31332 ToolsMoreMenuGroup: tools_more_menu_group_default, 31333 ViewMoreMenuGroup: view_more_menu_group_default, 31334 ResizableEditor: resizable_editor_default, 31335 registerCoreBlockBindingsSources: registerCoreBlockBindingsSources, 31336 getTemplateInfo: getTemplateInfo, 31337 // This is a temporary private API while we're updating the site editor to use EditorProvider. 31338 interfaceStore, 31339 ...remainingInterfaceApis 31340 }); 31341 31342 31343 ;// ./node_modules/@wordpress/editor/build-module/dataviews/api.js 31344 31345 31346 31347 function api_registerEntityAction(kind, name, config) { 31348 const { registerEntityAction: _registerEntityAction } = unlock( 31349 (0,external_wp_data_namespaceObject.dispatch)(store_store) 31350 ); 31351 if (false) {} 31352 } 31353 function api_unregisterEntityAction(kind, name, actionId) { 31354 const { unregisterEntityAction: _unregisterEntityAction } = unlock( 31355 (0,external_wp_data_namespaceObject.dispatch)(store_store) 31356 ); 31357 if (false) {} 31358 } 31359 function api_registerEntityField(kind, name, config) { 31360 const { registerEntityField: _registerEntityField } = unlock( 31361 (0,external_wp_data_namespaceObject.dispatch)(store_store) 31362 ); 31363 if (false) {} 31364 } 31365 function api_unregisterEntityField(kind, name, fieldId) { 31366 const { unregisterEntityField: _unregisterEntityField } = unlock( 31367 (0,external_wp_data_namespaceObject.dispatch)(store_store) 31368 ); 31369 if (false) {} 31370 } 31371 31372 31373 ;// ./node_modules/@wordpress/editor/build-module/index.js 31374 31375 31376 31377 31378 31379 31380 31381 31382 31383 })(); 31384 31385 (window.wp = window.wp || {}).editor = __webpack_exports__; 31386 /******/ })() 31387 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Thu Nov 6 08:20:07 2025 | Cross-referenced by PHPXref |