block-editor.js (1295366B)
1 this["wp"] = this["wp"] || {}; this["wp"]["blockEditor"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = "tr0p"); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ({ 89 90 /***/ "//Lo": 91 /***/ (function(module, __webpack_exports__, __webpack_require__) { 92 93 "use strict"; 94 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 95 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 96 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 97 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 98 99 100 /** 101 * WordPress dependencies 102 */ 103 104 const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 105 xmlns: "http://www.w3.org/2000/svg", 106 viewBox: "0 0 24 24" 107 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 108 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" 109 })); 110 /* harmony default export */ __webpack_exports__["a"] = (blockDefault); 111 112 113 /***/ }), 114 115 /***/ "16Al": 116 /***/ (function(module, exports, __webpack_require__) { 117 118 "use strict"; 119 /** 120 * Copyright (c) 2013-present, Facebook, Inc. 121 * 122 * This source code is licensed under the MIT license found in the 123 * LICENSE file in the root directory of this source tree. 124 */ 125 126 127 128 var ReactPropTypesSecret = __webpack_require__("WbBG"); 129 130 function emptyFunction() {} 131 function emptyFunctionWithReset() {} 132 emptyFunctionWithReset.resetWarningCache = emptyFunction; 133 134 module.exports = function() { 135 function shim(props, propName, componentName, location, propFullName, secret) { 136 if (secret === ReactPropTypesSecret) { 137 // It is still safe when called from React. 138 return; 139 } 140 var err = new Error( 141 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 142 'Use PropTypes.checkPropTypes() to call them. ' + 143 'Read more at http://fb.me/use-check-prop-types' 144 ); 145 err.name = 'Invariant Violation'; 146 throw err; 147 }; 148 shim.isRequired = shim; 149 function getShim() { 150 return shim; 151 }; 152 // Important! 153 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. 154 var ReactPropTypes = { 155 array: shim, 156 bool: shim, 157 func: shim, 158 number: shim, 159 object: shim, 160 string: shim, 161 symbol: shim, 162 163 any: shim, 164 arrayOf: getShim, 165 element: shim, 166 elementType: shim, 167 instanceOf: getShim, 168 node: shim, 169 objectOf: getShim, 170 oneOf: getShim, 171 oneOfType: getShim, 172 shape: getShim, 173 exact: getShim, 174 175 checkPropTypes: emptyFunctionWithReset, 176 resetWarningCache: emptyFunction 177 }; 178 179 ReactPropTypes.PropTypes = ReactPropTypes; 180 181 return ReactPropTypes; 182 }; 183 184 185 /***/ }), 186 187 /***/ "17x9": 188 /***/ (function(module, exports, __webpack_require__) { 189 190 /** 191 * Copyright (c) 2013-present, Facebook, Inc. 192 * 193 * This source code is licensed under the MIT license found in the 194 * LICENSE file in the root directory of this source tree. 195 */ 196 197 if (false) { var throwOnDirectAccess, ReactIs; } else { 198 // By explicitly using `prop-types` you are opting into new production behavior. 199 // http://fb.me/prop-types-in-prod 200 module.exports = __webpack_require__("16Al")(); 201 } 202 203 204 /***/ }), 205 206 /***/ "1CF3": 207 /***/ (function(module, exports) { 208 209 (function() { module.exports = window["wp"]["dom"]; }()); 210 211 /***/ }), 212 213 /***/ "1ZqX": 214 /***/ (function(module, exports) { 215 216 (function() { module.exports = window["wp"]["data"]; }()); 217 218 /***/ }), 219 220 /***/ "1iEr": 221 /***/ (function(module, __webpack_exports__, __webpack_require__) { 222 223 "use strict"; 224 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 225 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 226 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 227 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 228 229 230 /** 231 * WordPress dependencies 232 */ 233 234 const chevronRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 235 xmlns: "http://www.w3.org/2000/svg", 236 viewBox: "0 0 24 24" 237 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 238 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" 239 })); 240 /* harmony default export */ __webpack_exports__["a"] = (chevronRight); 241 242 243 /***/ }), 244 245 /***/ "2gm7": 246 /***/ (function(module, __webpack_exports__, __webpack_require__) { 247 248 "use strict"; 249 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 250 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 251 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 252 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 253 254 255 /** 256 * WordPress dependencies 257 */ 258 259 const chevronLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 260 xmlns: "http://www.w3.org/2000/svg", 261 viewBox: "0 0 24 24" 262 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 263 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" 264 })); 265 /* harmony default export */ __webpack_exports__["a"] = (chevronLeft); 266 267 268 /***/ }), 269 270 /***/ "4eJC": 271 /***/ (function(module, exports, __webpack_require__) { 272 273 /** 274 * Memize options object. 275 * 276 * @typedef MemizeOptions 277 * 278 * @property {number} [maxSize] Maximum size of the cache. 279 */ 280 281 /** 282 * Internal cache entry. 283 * 284 * @typedef MemizeCacheNode 285 * 286 * @property {?MemizeCacheNode|undefined} [prev] Previous node. 287 * @property {?MemizeCacheNode|undefined} [next] Next node. 288 * @property {Array<*>} args Function arguments for cache 289 * entry. 290 * @property {*} val Function result. 291 */ 292 293 /** 294 * Properties of the enhanced function for controlling cache. 295 * 296 * @typedef MemizeMemoizedFunction 297 * 298 * @property {()=>void} clear Clear the cache. 299 */ 300 301 /** 302 * Accepts a function to be memoized, and returns a new memoized function, with 303 * optional options. 304 * 305 * @template {Function} F 306 * 307 * @param {F} fn Function to memoize. 308 * @param {MemizeOptions} [options] Options object. 309 * 310 * @return {F & MemizeMemoizedFunction} Memoized function. 311 */ 312 function memize( fn, options ) { 313 var size = 0; 314 315 /** @type {?MemizeCacheNode|undefined} */ 316 var head; 317 318 /** @type {?MemizeCacheNode|undefined} */ 319 var tail; 320 321 options = options || {}; 322 323 function memoized( /* ...args */ ) { 324 var node = head, 325 len = arguments.length, 326 args, i; 327 328 searchCache: while ( node ) { 329 // Perform a shallow equality test to confirm that whether the node 330 // under test is a candidate for the arguments passed. Two arrays 331 // are shallowly equal if their length matches and each entry is 332 // strictly equal between the two sets. Avoid abstracting to a 333 // function which could incur an arguments leaking deoptimization. 334 335 // Check whether node arguments match arguments length 336 if ( node.args.length !== arguments.length ) { 337 node = node.next; 338 continue; 339 } 340 341 // Check whether node arguments match arguments values 342 for ( i = 0; i < len; i++ ) { 343 if ( node.args[ i ] !== arguments[ i ] ) { 344 node = node.next; 345 continue searchCache; 346 } 347 } 348 349 // At this point we can assume we've found a match 350 351 // Surface matched node to head if not already 352 if ( node !== head ) { 353 // As tail, shift to previous. Must only shift if not also 354 // head, since if both head and tail, there is no previous. 355 if ( node === tail ) { 356 tail = node.prev; 357 } 358 359 // Adjust siblings to point to each other. If node was tail, 360 // this also handles new tail's empty `next` assignment. 361 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; 362 if ( node.next ) { 363 node.next.prev = node.prev; 364 } 365 366 node.next = head; 367 node.prev = null; 368 /** @type {MemizeCacheNode} */ ( head ).prev = node; 369 head = node; 370 } 371 372 // Return immediately 373 return node.val; 374 } 375 376 // No cached value found. Continue to insertion phase: 377 378 // Create a copy of arguments (avoid leaking deoptimization) 379 args = new Array( len ); 380 for ( i = 0; i < len; i++ ) { 381 args[ i ] = arguments[ i ]; 382 } 383 384 node = { 385 args: args, 386 387 // Generate the result from original function 388 val: fn.apply( null, args ), 389 }; 390 391 // Don't need to check whether node is already head, since it would 392 // have been returned above already if it was 393 394 // Shift existing head down list 395 if ( head ) { 396 head.prev = node; 397 node.next = head; 398 } else { 399 // If no head, follows that there's no tail (at initial or reset) 400 tail = node; 401 } 402 403 // Trim tail if we're reached max size and are pending cache insertion 404 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { 405 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; 406 /** @type {MemizeCacheNode} */ ( tail ).next = null; 407 } else { 408 size++; 409 } 410 411 head = node; 412 413 return node.val; 414 } 415 416 memoized.clear = function() { 417 head = null; 418 tail = null; 419 size = 0; 420 }; 421 422 if ( false ) {} 423 424 // Ignore reason: There's not a clear solution to create an intersection of 425 // the function with additional properties, where the goal is to retain the 426 // function signature of the incoming argument and add control properties 427 // on the return value. 428 429 // @ts-ignore 430 return memoized; 431 } 432 433 module.exports = memize; 434 435 436 /***/ }), 437 438 /***/ "6fKw": 439 /***/ (function(module, exports, __webpack_require__) { 440 441 "use strict"; 442 /* 443 Copyright (c) 2014, Yahoo! Inc. All rights reserved. 444 Copyrights licensed under the New BSD License. 445 See the accompanying LICENSE file for terms. 446 */ 447 448 449 450 exports.match = matchQuery; 451 exports.parse = parseQuery; 452 453 // ----------------------------------------------------------------------------- 454 455 var RE_MEDIA_QUERY = /(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i, 456 RE_MQ_EXPRESSION = /\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/, 457 RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/, 458 RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/, 459 RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/; 460 461 function matchQuery(mediaQuery, values) { 462 return parseQuery(mediaQuery).some(function (query) { 463 var inverse = query.inverse; 464 465 // Either the parsed or specified `type` is "all", or the types must be 466 // equal for a match. 467 var typeMatch = query.type === 'all' || values.type === query.type; 468 469 // Quit early when `type` doesn't match, but take "not" into account. 470 if ((typeMatch && inverse) || !(typeMatch || inverse)) { 471 return false; 472 } 473 474 var expressionsMatch = query.expressions.every(function (expression) { 475 var feature = expression.feature, 476 modifier = expression.modifier, 477 expValue = expression.value, 478 value = values[feature]; 479 480 // Missing or falsy values don't match. 481 if (!value) { return false; } 482 483 switch (feature) { 484 case 'orientation': 485 case 'scan': 486 return value.toLowerCase() === expValue.toLowerCase(); 487 488 case 'width': 489 case 'height': 490 case 'device-width': 491 case 'device-height': 492 expValue = toPx(expValue); 493 value = toPx(value); 494 break; 495 496 case 'resolution': 497 expValue = toDpi(expValue); 498 value = toDpi(value); 499 break; 500 501 case 'aspect-ratio': 502 case 'device-aspect-ratio': 503 case /* Deprecated */ 'device-pixel-ratio': 504 expValue = toDecimal(expValue); 505 value = toDecimal(value); 506 break; 507 508 case 'grid': 509 case 'color': 510 case 'color-index': 511 case 'monochrome': 512 expValue = parseInt(expValue, 10) || 1; 513 value = parseInt(value, 10) || 0; 514 break; 515 } 516 517 switch (modifier) { 518 case 'min': return value >= expValue; 519 case 'max': return value <= expValue; 520 default : return value === expValue; 521 } 522 }); 523 524 return (expressionsMatch && !inverse) || (!expressionsMatch && inverse); 525 }); 526 } 527 528 function parseQuery(mediaQuery) { 529 return mediaQuery.split(',').map(function (query) { 530 query = query.trim(); 531 532 var captures = query.match(RE_MEDIA_QUERY), 533 modifier = captures[1], 534 type = captures[2], 535 expressions = captures[3] || '', 536 parsed = {}; 537 538 parsed.inverse = !!modifier && modifier.toLowerCase() === 'not'; 539 parsed.type = type ? type.toLowerCase() : 'all'; 540 541 // Split expressions into a list. 542 expressions = expressions.match(/\([^\)]+\)/g) || []; 543 544 parsed.expressions = expressions.map(function (expression) { 545 var captures = expression.match(RE_MQ_EXPRESSION), 546 feature = captures[1].toLowerCase().match(RE_MQ_FEATURE); 547 548 return { 549 modifier: feature[1], 550 feature : feature[2], 551 value : captures[2] 552 }; 553 }); 554 555 return parsed; 556 }); 557 } 558 559 // -- Utilities ---------------------------------------------------------------- 560 561 function toDecimal(ratio) { 562 var decimal = Number(ratio), 563 numbers; 564 565 if (!decimal) { 566 numbers = ratio.match(/^(\d+)\s*\/\s*(\d+)$/); 567 decimal = numbers[1] / numbers[2]; 568 } 569 570 return decimal; 571 } 572 573 function toDpi(resolution) { 574 var value = parseFloat(resolution), 575 units = String(resolution).match(RE_RESOLUTION_UNIT)[1]; 576 577 switch (units) { 578 case 'dpcm': return value / 2.54; 579 case 'dppx': return value * 96; 580 default : return value; 581 } 582 } 583 584 function toPx(length) { 585 var value = parseFloat(length), 586 units = String(length).match(RE_LENGTH_UNIT)[1]; 587 588 switch (units) { 589 case 'em' : return value * 16; 590 case 'rem': return value * 16; 591 case 'cm' : return value * 96 / 2.54; 592 case 'mm' : return value * 96 / 2.54 / 10; 593 case 'in' : return value * 96; 594 case 'pt' : return value * 72; 595 case 'pc' : return value * 72 / 12; 596 default : return value; 597 } 598 } 599 600 601 /***/ }), 602 603 /***/ "7fqt": 604 /***/ (function(module, exports) { 605 606 (function() { module.exports = window["wp"]["wordcount"]; }()); 607 608 /***/ }), 609 610 /***/ "8OQS": 611 /***/ (function(module, exports) { 612 613 function _objectWithoutPropertiesLoose(source, excluded) { 614 if (source == null) return {}; 615 var target = {}; 616 var sourceKeys = Object.keys(source); 617 var key, i; 618 619 for (i = 0; i < sourceKeys.length; i++) { 620 key = sourceKeys[i]; 621 if (excluded.indexOf(key) >= 0) continue; 622 target[key] = source[key]; 623 } 624 625 return target; 626 } 627 628 module.exports = _objectWithoutPropertiesLoose; 629 module.exports["default"] = module.exports, module.exports.__esModule = true; 630 631 /***/ }), 632 633 /***/ "9Do8": 634 /***/ (function(module, exports, __webpack_require__) { 635 636 "use strict"; 637 638 639 module.exports = __webpack_require__("zt9T"); 640 641 /***/ }), 642 643 /***/ "B9Az": 644 /***/ (function(module, __webpack_exports__, __webpack_require__) { 645 646 "use strict"; 647 648 // EXTERNAL MODULE: external ["wp","element"] 649 var external_wp_element_ = __webpack_require__("GRId"); 650 651 // EXTERNAL MODULE: external ["wp","primitives"] 652 var external_wp_primitives_ = __webpack_require__("Tqx9"); 653 654 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js 655 656 657 /** 658 * WordPress dependencies 659 */ 660 661 const pencil = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 662 xmlns: "http://www.w3.org/2000/svg", 663 viewBox: "0 0 24 24" 664 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 665 d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" 666 })); 667 /* harmony default export */ var library_pencil = (pencil); 668 669 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js 670 /** 671 * Internal dependencies 672 */ 673 674 /* harmony default export */ var edit = __webpack_exports__["a"] = (library_pencil); 675 676 677 /***/ }), 678 679 /***/ "BLeD": 680 /***/ (function(module, exports) { 681 682 (function() { module.exports = window["wp"]["tokenList"]; }()); 683 684 /***/ }), 685 686 /***/ "Bpkj": 687 /***/ (function(module, __webpack_exports__, __webpack_require__) { 688 689 "use strict"; 690 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 691 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 692 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 693 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 694 695 696 /** 697 * WordPress dependencies 698 */ 699 700 const link = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 701 xmlns: "http://www.w3.org/2000/svg", 702 viewBox: "0 0 24 24" 703 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 704 d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z" 705 })); 706 /* harmony default export */ __webpack_exports__["a"] = (link); 707 708 709 /***/ }), 710 711 /***/ "CNgt": 712 /***/ (function(module, exports, __webpack_require__) { 713 714 "use strict"; 715 716 var __extends = (this && this.__extends) || (function () { 717 var extendStatics = Object.setPrototypeOf || 718 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 719 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 720 return function (d, b) { 721 extendStatics(d, b); 722 function __() { this.constructor = d; } 723 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 724 }; 725 })(); 726 var __assign = (this && this.__assign) || Object.assign || function(t) { 727 for (var s, i = 1, n = arguments.length; i < n; i++) { 728 s = arguments[i]; 729 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 730 t[p] = s[p]; 731 } 732 return t; 733 }; 734 var __rest = (this && this.__rest) || function (s, e) { 735 var t = {}; 736 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 737 t[p] = s[p]; 738 if (s != null && typeof Object.getOwnPropertySymbols === "function") 739 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) 740 t[p[i]] = s[p[i]]; 741 return t; 742 }; 743 exports.__esModule = true; 744 var React = __webpack_require__("cDcd"); 745 var PropTypes = __webpack_require__("17x9"); 746 var autosize = __webpack_require__("GemG"); 747 var _getLineHeight = __webpack_require__("Rk8H"); 748 var getLineHeight = _getLineHeight; 749 var RESIZED = "autosize:resized"; 750 /** 751 * A light replacement for built-in textarea component 752 * which automaticaly adjusts its height to match the content 753 */ 754 var TextareaAutosizeClass = /** @class */ (function (_super) { 755 __extends(TextareaAutosizeClass, _super); 756 function TextareaAutosizeClass() { 757 var _this = _super !== null && _super.apply(this, arguments) || this; 758 _this.state = { 759 lineHeight: null 760 }; 761 _this.textarea = null; 762 _this.onResize = function (e) { 763 if (_this.props.onResize) { 764 _this.props.onResize(e); 765 } 766 }; 767 _this.updateLineHeight = function () { 768 if (_this.textarea) { 769 _this.setState({ 770 lineHeight: getLineHeight(_this.textarea) 771 }); 772 } 773 }; 774 _this.onChange = function (e) { 775 var onChange = _this.props.onChange; 776 _this.currentValue = e.currentTarget.value; 777 onChange && onChange(e); 778 }; 779 return _this; 780 } 781 TextareaAutosizeClass.prototype.componentDidMount = function () { 782 var _this = this; 783 var _a = this.props, maxRows = _a.maxRows, async = _a.async; 784 if (typeof maxRows === "number") { 785 this.updateLineHeight(); 786 } 787 if (typeof maxRows === "number" || async) { 788 /* 789 the defer is needed to: 790 - force "autosize" to activate the scrollbar when this.props.maxRows is passed 791 - support StyledComponents (see #71) 792 */ 793 setTimeout(function () { return _this.textarea && autosize(_this.textarea); }); 794 } 795 else { 796 this.textarea && autosize(this.textarea); 797 } 798 if (this.textarea) { 799 this.textarea.addEventListener(RESIZED, this.onResize); 800 } 801 }; 802 TextareaAutosizeClass.prototype.componentWillUnmount = function () { 803 if (this.textarea) { 804 this.textarea.removeEventListener(RESIZED, this.onResize); 805 autosize.destroy(this.textarea); 806 } 807 }; 808 TextareaAutosizeClass.prototype.render = function () { 809 var _this = this; 810 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; 811 var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; 812 return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) { 813 _this.textarea = element; 814 if (typeof _this.props.innerRef === 'function') { 815 _this.props.innerRef(element); 816 } 817 else if (_this.props.innerRef) { 818 _this.props.innerRef.current = element; 819 } 820 } }), children)); 821 }; 822 TextareaAutosizeClass.prototype.componentDidUpdate = function () { 823 this.textarea && autosize.update(this.textarea); 824 }; 825 TextareaAutosizeClass.defaultProps = { 826 rows: 1, 827 async: false 828 }; 829 TextareaAutosizeClass.propTypes = { 830 rows: PropTypes.number, 831 maxRows: PropTypes.number, 832 onResize: PropTypes.func, 833 innerRef: PropTypes.any, 834 async: PropTypes.bool 835 }; 836 return TextareaAutosizeClass; 837 }(React.Component)); 838 exports.TextareaAutosize = React.forwardRef(function (props, ref) { 839 return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref })); 840 }); 841 842 843 /***/ }), 844 845 /***/ "Civd": 846 /***/ (function(module, __webpack_exports__, __webpack_require__) { 847 848 "use strict"; 849 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 850 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 851 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 852 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 853 854 855 /** 856 * WordPress dependencies 857 */ 858 859 const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 860 xmlns: "http://www.w3.org/2000/svg", 861 viewBox: "0 0 24 24" 862 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 863 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" 864 })); 865 /* harmony default export */ __webpack_exports__["a"] = (layout); 866 867 868 /***/ }), 869 870 /***/ "Crq9": 871 /***/ (function(module, __webpack_exports__, __webpack_require__) { 872 873 "use strict"; 874 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 875 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 876 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 877 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 878 879 880 /** 881 * WordPress dependencies 882 */ 883 884 const formatStrikethrough = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 885 xmlns: "http://www.w3.org/2000/svg", 886 viewBox: "0 0 24 24" 887 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 888 d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" 889 })); 890 /* harmony default export */ __webpack_exports__["a"] = (formatStrikethrough); 891 892 893 /***/ }), 894 895 /***/ "GRId": 896 /***/ (function(module, exports) { 897 898 (function() { module.exports = window["wp"]["element"]; }()); 899 900 /***/ }), 901 902 /***/ "GemG": 903 /***/ (function(module, exports, __webpack_require__) { 904 905 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 906 autosize 4.0.4 907 license: MIT 908 http://www.jacklmoore.com/autosize 909 */ 910 (function (global, factory) { 911 if (true) { 912 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 913 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 914 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 915 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 916 } else { var mod; } 917 })(this, function (module, exports) { 918 'use strict'; 919 920 var map = typeof Map === "function" ? new Map() : function () { 921 var keys = []; 922 var values = []; 923 924 return { 925 has: function has(key) { 926 return keys.indexOf(key) > -1; 927 }, 928 get: function get(key) { 929 return values[keys.indexOf(key)]; 930 }, 931 set: function set(key, value) { 932 if (keys.indexOf(key) === -1) { 933 keys.push(key); 934 values.push(value); 935 } 936 }, 937 delete: function _delete(key) { 938 var index = keys.indexOf(key); 939 if (index > -1) { 940 keys.splice(index, 1); 941 values.splice(index, 1); 942 } 943 } 944 }; 945 }(); 946 947 var createEvent = function createEvent(name) { 948 return new Event(name, { bubbles: true }); 949 }; 950 try { 951 new Event('test'); 952 } catch (e) { 953 // IE does not support `new Event()` 954 createEvent = function createEvent(name) { 955 var evt = document.createEvent('Event'); 956 evt.initEvent(name, true, false); 957 return evt; 958 }; 959 } 960 961 function assign(ta) { 962 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; 963 964 var heightOffset = null; 965 var clientWidth = null; 966 var cachedHeight = null; 967 968 function init() { 969 var style = window.getComputedStyle(ta, null); 970 971 if (style.resize === 'vertical') { 972 ta.style.resize = 'none'; 973 } else if (style.resize === 'both') { 974 ta.style.resize = 'horizontal'; 975 } 976 977 if (style.boxSizing === 'content-box') { 978 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 979 } else { 980 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 981 } 982 // Fix when a textarea is not on document body and heightOffset is Not a Number 983 if (isNaN(heightOffset)) { 984 heightOffset = 0; 985 } 986 987 update(); 988 } 989 990 function changeOverflow(value) { 991 { 992 // Chrome/Safari-specific fix: 993 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 994 // made available by removing the scrollbar. The following forces the necessary text reflow. 995 var width = ta.style.width; 996 ta.style.width = '0px'; 997 // Force reflow: 998 /* jshint ignore:start */ 999 ta.offsetWidth; 1000 /* jshint ignore:end */ 1001 ta.style.width = width; 1002 } 1003 1004 ta.style.overflowY = value; 1005 } 1006 1007 function getParentOverflows(el) { 1008 var arr = []; 1009 1010 while (el && el.parentNode && el.parentNode instanceof Element) { 1011 if (el.parentNode.scrollTop) { 1012 arr.push({ 1013 node: el.parentNode, 1014 scrollTop: el.parentNode.scrollTop 1015 }); 1016 } 1017 el = el.parentNode; 1018 } 1019 1020 return arr; 1021 } 1022 1023 function resize() { 1024 if (ta.scrollHeight === 0) { 1025 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 1026 return; 1027 } 1028 1029 var overflows = getParentOverflows(ta); 1030 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) 1031 1032 ta.style.height = ''; 1033 ta.style.height = ta.scrollHeight + heightOffset + 'px'; 1034 1035 // used to check if an update is actually necessary on window.resize 1036 clientWidth = ta.clientWidth; 1037 1038 // prevents scroll-position jumping 1039 overflows.forEach(function (el) { 1040 el.node.scrollTop = el.scrollTop; 1041 }); 1042 1043 if (docTop) { 1044 document.documentElement.scrollTop = docTop; 1045 } 1046 } 1047 1048 function update() { 1049 resize(); 1050 1051 var styleHeight = Math.round(parseFloat(ta.style.height)); 1052 var computed = window.getComputedStyle(ta, null); 1053 1054 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box 1055 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; 1056 1057 // The actual height not matching the style height (set via the resize method) indicates that 1058 // the max-height has been exceeded, in which case the overflow should be allowed. 1059 if (actualHeight < styleHeight) { 1060 if (computed.overflowY === 'hidden') { 1061 changeOverflow('scroll'); 1062 resize(); 1063 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 1064 } 1065 } else { 1066 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. 1067 if (computed.overflowY !== 'hidden') { 1068 changeOverflow('hidden'); 1069 resize(); 1070 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; 1071 } 1072 } 1073 1074 if (cachedHeight !== actualHeight) { 1075 cachedHeight = actualHeight; 1076 var evt = createEvent('autosize:resized'); 1077 try { 1078 ta.dispatchEvent(evt); 1079 } catch (err) { 1080 // Firefox will throw an error on dispatchEvent for a detached element 1081 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 1082 } 1083 } 1084 } 1085 1086 var pageResize = function pageResize() { 1087 if (ta.clientWidth !== clientWidth) { 1088 update(); 1089 } 1090 }; 1091 1092 var destroy = function (style) { 1093 window.removeEventListener('resize', pageResize, false); 1094 ta.removeEventListener('input', update, false); 1095 ta.removeEventListener('keyup', update, false); 1096 ta.removeEventListener('autosize:destroy', destroy, false); 1097 ta.removeEventListener('autosize:update', update, false); 1098 1099 Object.keys(style).forEach(function (key) { 1100 ta.style[key] = style[key]; 1101 }); 1102 1103 map.delete(ta); 1104 }.bind(ta, { 1105 height: ta.style.height, 1106 resize: ta.style.resize, 1107 overflowY: ta.style.overflowY, 1108 overflowX: ta.style.overflowX, 1109 wordWrap: ta.style.wordWrap 1110 }); 1111 1112 ta.addEventListener('autosize:destroy', destroy, false); 1113 1114 // IE9 does not fire onpropertychange or oninput for deletions, 1115 // so binding to onkeyup to catch most of those events. 1116 // There is no way that I know of to detect something like 'cut' in IE9. 1117 if ('onpropertychange' in ta && 'oninput' in ta) { 1118 ta.addEventListener('keyup', update, false); 1119 } 1120 1121 window.addEventListener('resize', pageResize, false); 1122 ta.addEventListener('input', update, false); 1123 ta.addEventListener('autosize:update', update, false); 1124 ta.style.overflowX = 'hidden'; 1125 ta.style.wordWrap = 'break-word'; 1126 1127 map.set(ta, { 1128 destroy: destroy, 1129 update: update 1130 }); 1131 1132 init(); 1133 } 1134 1135 function destroy(ta) { 1136 var methods = map.get(ta); 1137 if (methods) { 1138 methods.destroy(); 1139 } 1140 } 1141 1142 function update(ta) { 1143 var methods = map.get(ta); 1144 if (methods) { 1145 methods.update(); 1146 } 1147 } 1148 1149 var autosize = null; 1150 1151 // Do nothing in Node.js environment and IE8 (or lower) 1152 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 1153 autosize = function autosize(el) { 1154 return el; 1155 }; 1156 autosize.destroy = function (el) { 1157 return el; 1158 }; 1159 autosize.update = function (el) { 1160 return el; 1161 }; 1162 } else { 1163 autosize = function autosize(el, options) { 1164 if (el) { 1165 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 1166 return assign(x, options); 1167 }); 1168 } 1169 return el; 1170 }; 1171 autosize.destroy = function (el) { 1172 if (el) { 1173 Array.prototype.forEach.call(el.length ? el : [el], destroy); 1174 } 1175 return el; 1176 }; 1177 autosize.update = function (el) { 1178 if (el) { 1179 Array.prototype.forEach.call(el.length ? el : [el], update); 1180 } 1181 return el; 1182 }; 1183 } 1184 1185 exports.default = autosize; 1186 module.exports = exports['default']; 1187 }); 1188 1189 /***/ }), 1190 1191 /***/ "HSyU": 1192 /***/ (function(module, exports) { 1193 1194 (function() { module.exports = window["wp"]["blocks"]; }()); 1195 1196 /***/ }), 1197 1198 /***/ "K9lf": 1199 /***/ (function(module, exports) { 1200 1201 (function() { module.exports = window["wp"]["compose"]; }()); 1202 1203 /***/ }), 1204 1205 /***/ "Mmq9": 1206 /***/ (function(module, exports) { 1207 1208 (function() { module.exports = window["wp"]["url"]; }()); 1209 1210 /***/ }), 1211 1212 /***/ "NMb1": 1213 /***/ (function(module, exports) { 1214 1215 (function() { module.exports = window["wp"]["deprecated"]; }()); 1216 1217 /***/ }), 1218 1219 /***/ "NTP4": 1220 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1221 1222 "use strict"; 1223 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1224 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1225 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1226 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1227 1228 1229 /** 1230 * WordPress dependencies 1231 */ 1232 1233 const upload = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1234 xmlns: "http://www.w3.org/2000/svg", 1235 viewBox: "0 0 24 24" 1236 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1237 d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" 1238 })); 1239 /* harmony default export */ __webpack_exports__["a"] = (upload); 1240 1241 1242 /***/ }), 1243 1244 /***/ "NWDH": 1245 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1246 1247 "use strict"; 1248 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1249 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1250 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1251 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1252 1253 1254 /** 1255 * WordPress dependencies 1256 */ 1257 1258 const chevronDown = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1259 viewBox: "0 0 24 24", 1260 xmlns: "http://www.w3.org/2000/svg" 1261 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1262 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 1263 })); 1264 /* harmony default export */ __webpack_exports__["a"] = (chevronDown); 1265 1266 1267 /***/ }), 1268 1269 /***/ "O6Fj": 1270 /***/ (function(module, exports, __webpack_require__) { 1271 1272 "use strict"; 1273 1274 exports.__esModule = true; 1275 var TextareaAutosize_1 = __webpack_require__("CNgt"); 1276 exports["default"] = TextareaAutosize_1.TextareaAutosize; 1277 1278 1279 /***/ }), 1280 1281 /***/ "OzlF": 1282 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1283 1284 "use strict"; 1285 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1286 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1287 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1288 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1289 1290 1291 /** 1292 * WordPress dependencies 1293 */ 1294 1295 const listView = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1296 viewBox: "0 0 24 24", 1297 xmlns: "http://www.w3.org/2000/svg" 1298 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1299 d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" 1300 })); 1301 /* harmony default export */ __webpack_exports__["a"] = (listView); 1302 1303 1304 /***/ }), 1305 1306 /***/ "P7XM": 1307 /***/ (function(module, exports) { 1308 1309 if (typeof Object.create === 'function') { 1310 // implementation from standard node.js 'util' module 1311 module.exports = function inherits(ctor, superCtor) { 1312 if (superCtor) { 1313 ctor.super_ = superCtor 1314 ctor.prototype = Object.create(superCtor.prototype, { 1315 constructor: { 1316 value: ctor, 1317 enumerable: false, 1318 writable: true, 1319 configurable: true 1320 } 1321 }) 1322 } 1323 }; 1324 } else { 1325 // old school shim for old browsers 1326 module.exports = function inherits(ctor, superCtor) { 1327 if (superCtor) { 1328 ctor.super_ = superCtor 1329 var TempCtor = function () {} 1330 TempCtor.prototype = superCtor.prototype 1331 ctor.prototype = new TempCtor() 1332 ctor.prototype.constructor = ctor 1333 } 1334 } 1335 } 1336 1337 1338 /***/ }), 1339 1340 /***/ "PJYZ": 1341 /***/ (function(module, exports) { 1342 1343 function _assertThisInitialized(self) { 1344 if (self === void 0) { 1345 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1346 } 1347 1348 return self; 1349 } 1350 1351 module.exports = _assertThisInitialized; 1352 module.exports["default"] = module.exports, module.exports.__esModule = true; 1353 1354 /***/ }), 1355 1356 /***/ "Q4Sy": 1357 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1358 1359 "use strict"; 1360 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1361 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1362 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1363 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1364 1365 1366 /** 1367 * WordPress dependencies 1368 */ 1369 1370 const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1371 xmlns: "http://www.w3.org/2000/svg", 1372 viewBox: "0 0 24 24" 1373 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1374 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" 1375 })); 1376 /* harmony default export */ __webpack_exports__["a"] = (plus); 1377 1378 1379 /***/ }), 1380 1381 /***/ "RMJe": 1382 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1383 1384 "use strict"; 1385 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1386 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1387 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1388 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1389 1390 1391 /** 1392 * WordPress dependencies 1393 */ 1394 1395 const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1396 xmlns: "http://www.w3.org/2000/svg", 1397 viewBox: "0 0 24 24" 1398 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1399 d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z" 1400 })); 1401 /* harmony default export */ __webpack_exports__["a"] = (check); 1402 1403 1404 /***/ }), 1405 1406 /***/ "Rk8H": 1407 /***/ (function(module, exports, __webpack_require__) { 1408 1409 // Load in dependencies 1410 var computedStyle = __webpack_require__("jTPX"); 1411 1412 /** 1413 * Calculate the `line-height` of a given node 1414 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. 1415 * @returns {Number} `line-height` of the element in pixels 1416 */ 1417 function lineHeight(node) { 1418 // Grab the line-height via style 1419 var lnHeightStr = computedStyle(node, 'line-height'); 1420 var lnHeight = parseFloat(lnHeightStr, 10); 1421 1422 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') 1423 if (lnHeightStr === lnHeight + '') { 1424 // Save the old lineHeight style and update the em unit to the element 1425 var _lnHeightStyle = node.style.lineHeight; 1426 node.style.lineHeight = lnHeightStr + 'em'; 1427 1428 // Calculate the em based height 1429 lnHeightStr = computedStyle(node, 'line-height'); 1430 lnHeight = parseFloat(lnHeightStr, 10); 1431 1432 // Revert the lineHeight style 1433 if (_lnHeightStyle) { 1434 node.style.lineHeight = _lnHeightStyle; 1435 } else { 1436 delete node.style.lineHeight; 1437 } 1438 } 1439 1440 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) 1441 // DEV: `em` units are converted to `pt` in IE6 1442 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length 1443 if (lnHeightStr.indexOf('pt') !== -1) { 1444 lnHeight *= 4; 1445 lnHeight /= 3; 1446 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) 1447 } else if (lnHeightStr.indexOf('mm') !== -1) { 1448 lnHeight *= 96; 1449 lnHeight /= 25.4; 1450 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) 1451 } else if (lnHeightStr.indexOf('cm') !== -1) { 1452 lnHeight *= 96; 1453 lnHeight /= 2.54; 1454 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) 1455 } else if (lnHeightStr.indexOf('in') !== -1) { 1456 lnHeight *= 96; 1457 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) 1458 } else if (lnHeightStr.indexOf('pc') !== -1) { 1459 lnHeight *= 16; 1460 } 1461 1462 // Continue our computation 1463 lnHeight = Math.round(lnHeight); 1464 1465 // If the line-height is "normal", calculate by font-size 1466 if (lnHeightStr === 'normal') { 1467 // Create a temporary node 1468 var nodeName = node.nodeName; 1469 var _node = document.createElement(nodeName); 1470 _node.innerHTML = ' '; 1471 1472 // If we have a text area, reset it to only 1 row 1473 // https://github.com/twolfson/line-height/issues/4 1474 if (nodeName.toUpperCase() === 'TEXTAREA') { 1475 _node.setAttribute('rows', '1'); 1476 } 1477 1478 // Set the font-size of the element 1479 var fontSizeStr = computedStyle(node, 'font-size'); 1480 _node.style.fontSize = fontSizeStr; 1481 1482 // Remove default padding/border which can affect offset height 1483 // https://github.com/twolfson/line-height/issues/4 1484 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight 1485 _node.style.padding = '0px'; 1486 _node.style.border = '0px'; 1487 1488 // Append it to the body 1489 var body = document.body; 1490 body.appendChild(_node); 1491 1492 // Assume the line height of the element is the height 1493 var height = _node.offsetHeight; 1494 lnHeight = height; 1495 1496 // Remove our child from the DOM 1497 body.removeChild(_node); 1498 } 1499 1500 // Return the calculated height 1501 return lnHeight; 1502 } 1503 1504 // Export lineHeight 1505 module.exports = lineHeight; 1506 1507 1508 /***/ }), 1509 1510 /***/ "RxS6": 1511 /***/ (function(module, exports) { 1512 1513 (function() { module.exports = window["wp"]["keycodes"]; }()); 1514 1515 /***/ }), 1516 1517 /***/ "SVSp": 1518 /***/ (function(module, exports) { 1519 1520 (function() { module.exports = window["wp"]["shortcode"]; }()); 1521 1522 /***/ }), 1523 1524 /***/ "SksO": 1525 /***/ (function(module, exports) { 1526 1527 function _setPrototypeOf(o, p) { 1528 module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 1529 o.__proto__ = p; 1530 return o; 1531 }; 1532 1533 module.exports["default"] = module.exports, module.exports.__esModule = true; 1534 return _setPrototypeOf(o, p); 1535 } 1536 1537 module.exports = _setPrototypeOf; 1538 module.exports["default"] = module.exports, module.exports.__esModule = true; 1539 1540 /***/ }), 1541 1542 /***/ "TSYQ": 1543 /***/ (function(module, exports, __webpack_require__) { 1544 1545 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 1546 Copyright (c) 2018 Jed Watson. 1547 Licensed under the MIT License (MIT), see 1548 http://jedwatson.github.io/classnames 1549 */ 1550 /* global define */ 1551 1552 (function () { 1553 'use strict'; 1554 1555 var hasOwn = {}.hasOwnProperty; 1556 1557 function classNames() { 1558 var classes = []; 1559 1560 for (var i = 0; i < arguments.length; i++) { 1561 var arg = arguments[i]; 1562 if (!arg) continue; 1563 1564 var argType = typeof arg; 1565 1566 if (argType === 'string' || argType === 'number') { 1567 classes.push(arg); 1568 } else if (Array.isArray(arg)) { 1569 if (arg.length) { 1570 var inner = classNames.apply(null, arg); 1571 if (inner) { 1572 classes.push(inner); 1573 } 1574 } 1575 } else if (argType === 'object') { 1576 if (arg.toString === Object.prototype.toString) { 1577 for (var key in arg) { 1578 if (hasOwn.call(arg, key) && arg[key]) { 1579 classes.push(key); 1580 } 1581 } 1582 } else { 1583 classes.push(arg.toString()); 1584 } 1585 } 1586 } 1587 1588 return classes.join(' '); 1589 } 1590 1591 if ( true && module.exports) { 1592 classNames.default = classNames; 1593 module.exports = classNames; 1594 } else if (true) { 1595 // register as 'classnames', consistent with npm package name 1596 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 1597 return classNames; 1598 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 1599 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 1600 } else {} 1601 }()); 1602 1603 1604 /***/ }), 1605 1606 /***/ "Tqx9": 1607 /***/ (function(module, exports) { 1608 1609 (function() { module.exports = window["wp"]["primitives"]; }()); 1610 1611 /***/ }), 1612 1613 /***/ "VKE3": 1614 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1615 1616 "use strict"; 1617 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1618 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1619 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1620 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1621 1622 1623 /** 1624 * WordPress dependencies 1625 */ 1626 1627 const moreVertical = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1628 xmlns: "http://www.w3.org/2000/svg", 1629 viewBox: "0 0 24 24" 1630 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1631 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 1632 })); 1633 /* harmony default export */ __webpack_exports__["a"] = (moreVertical); 1634 1635 1636 /***/ }), 1637 1638 /***/ "VbXa": 1639 /***/ (function(module, exports, __webpack_require__) { 1640 1641 var setPrototypeOf = __webpack_require__("SksO"); 1642 1643 function _inheritsLoose(subClass, superClass) { 1644 subClass.prototype = Object.create(superClass.prototype); 1645 subClass.prototype.constructor = subClass; 1646 setPrototypeOf(subClass, superClass); 1647 } 1648 1649 module.exports = _inheritsLoose; 1650 module.exports["default"] = module.exports, module.exports.__esModule = true; 1651 1652 /***/ }), 1653 1654 /***/ "WbBG": 1655 /***/ (function(module, exports, __webpack_require__) { 1656 1657 "use strict"; 1658 /** 1659 * Copyright (c) 2013-present, Facebook, Inc. 1660 * 1661 * This source code is licensed under the MIT license found in the 1662 * LICENSE file in the root directory of this source tree. 1663 */ 1664 1665 1666 1667 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 1668 1669 module.exports = ReactPropTypesSecret; 1670 1671 1672 /***/ }), 1673 1674 /***/ "XgzB": 1675 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1676 1677 "use strict"; 1678 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 1679 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1680 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 1681 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 1682 1683 1684 /** 1685 * WordPress dependencies 1686 */ 1687 1688 const chevronUp = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 1689 viewBox: "0 0 24 24", 1690 xmlns: "http://www.w3.org/2000/svg" 1691 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 1692 d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" 1693 })); 1694 /* harmony default export */ __webpack_exports__["a"] = (chevronUp); 1695 1696 1697 /***/ }), 1698 1699 /***/ "YLtl": 1700 /***/ (function(module, exports) { 1701 1702 (function() { module.exports = window["lodash"]; }()); 1703 1704 /***/ }), 1705 1706 /***/ "ZO3Q": 1707 /***/ (function(module, exports, __webpack_require__) { 1708 1709 "use strict"; 1710 1711 1712 Object.defineProperty(exports, '__esModule', { value: true }); 1713 1714 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 1715 1716 var _extends = _interopDefault(__webpack_require__("pVnL")); 1717 var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__("8OQS")); 1718 var React = __webpack_require__("cDcd"); 1719 var React__default = _interopDefault(React); 1720 var _inheritsLoose = _interopDefault(__webpack_require__("VbXa")); 1721 var _assertThisInitialized = _interopDefault(__webpack_require__("PJYZ")); 1722 1723 var is = { 1724 arr: Array.isArray, 1725 obj: function obj(a) { 1726 return Object.prototype.toString.call(a) === '[object Object]'; 1727 }, 1728 fun: function fun(a) { 1729 return typeof a === 'function'; 1730 }, 1731 str: function str(a) { 1732 return typeof a === 'string'; 1733 }, 1734 num: function num(a) { 1735 return typeof a === 'number'; 1736 }, 1737 und: function und(a) { 1738 return a === void 0; 1739 }, 1740 nul: function nul(a) { 1741 return a === null; 1742 }, 1743 set: function set(a) { 1744 return a instanceof Set; 1745 }, 1746 map: function map(a) { 1747 return a instanceof Map; 1748 }, 1749 equ: function equ(a, b) { 1750 if (typeof a !== typeof b) return false; 1751 if (is.str(a) || is.num(a)) return a === b; 1752 if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true; 1753 var i; 1754 1755 for (i in a) { 1756 if (!(i in b)) return false; 1757 } 1758 1759 for (i in b) { 1760 if (a[i] !== b[i]) return false; 1761 } 1762 1763 return is.und(i) ? a === b : true; 1764 } 1765 }; 1766 function merge(target, lowercase) { 1767 if (lowercase === void 0) { 1768 lowercase = true; 1769 } 1770 1771 return function (object) { 1772 return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) { 1773 var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element; 1774 acc[key] = target(key); 1775 return acc; 1776 }, target); 1777 }; 1778 } 1779 function useForceUpdate() { 1780 var _useState = React.useState(false), 1781 f = _useState[1]; 1782 1783 var forceUpdate = React.useCallback(function () { 1784 return f(function (v) { 1785 return !v; 1786 }); 1787 }, []); 1788 return forceUpdate; 1789 } 1790 function withDefault(value, defaultValue) { 1791 return is.und(value) || is.nul(value) ? defaultValue : value; 1792 } 1793 function toArray(a) { 1794 return !is.und(a) ? is.arr(a) ? a : [a] : []; 1795 } 1796 function callProp(obj) { 1797 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 1798 args[_key - 1] = arguments[_key]; 1799 } 1800 1801 return is.fun(obj) ? obj.apply(void 0, args) : obj; 1802 } 1803 1804 function getForwardProps(props) { 1805 var to = props.to, 1806 from = props.from, 1807 config = props.config, 1808 onStart = props.onStart, 1809 onRest = props.onRest, 1810 onFrame = props.onFrame, 1811 children = props.children, 1812 reset = props.reset, 1813 reverse = props.reverse, 1814 force = props.force, 1815 immediate = props.immediate, 1816 delay = props.delay, 1817 attach = props.attach, 1818 destroyed = props.destroyed, 1819 interpolateTo = props.interpolateTo, 1820 ref = props.ref, 1821 lazy = props.lazy, 1822 forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]); 1823 1824 return forward; 1825 } 1826 1827 function interpolateTo(props) { 1828 var forward = getForwardProps(props); 1829 if (is.und(forward)) return _extends({ 1830 to: forward 1831 }, props); 1832 var rest = Object.keys(props).reduce(function (a, k) { 1833 var _extends2; 1834 1835 return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2)); 1836 }, {}); 1837 return _extends({ 1838 to: forward 1839 }, rest); 1840 } 1841 function handleRef(ref, forward) { 1842 if (forward) { 1843 // If it's a function, assume it's a ref callback 1844 if (is.fun(forward)) forward(ref);else if (is.obj(forward)) { 1845 forward.current = ref; 1846 } 1847 } 1848 1849 return ref; 1850 } 1851 1852 var Animated = 1853 /*#__PURE__*/ 1854 function () { 1855 function Animated() { 1856 this.payload = void 0; 1857 this.children = []; 1858 } 1859 1860 var _proto = Animated.prototype; 1861 1862 _proto.getAnimatedValue = function getAnimatedValue() { 1863 return this.getValue(); 1864 }; 1865 1866 _proto.getPayload = function getPayload() { 1867 return this.payload || this; 1868 }; 1869 1870 _proto.attach = function attach() {}; 1871 1872 _proto.detach = function detach() {}; 1873 1874 _proto.getChildren = function getChildren() { 1875 return this.children; 1876 }; 1877 1878 _proto.addChild = function addChild(child) { 1879 if (this.children.length === 0) this.attach(); 1880 this.children.push(child); 1881 }; 1882 1883 _proto.removeChild = function removeChild(child) { 1884 var index = this.children.indexOf(child); 1885 this.children.splice(index, 1); 1886 if (this.children.length === 0) this.detach(); 1887 }; 1888 1889 return Animated; 1890 }(); 1891 var AnimatedArray = 1892 /*#__PURE__*/ 1893 function (_Animated) { 1894 _inheritsLoose(AnimatedArray, _Animated); 1895 1896 function AnimatedArray() { 1897 var _this; 1898 1899 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 1900 args[_key] = arguments[_key]; 1901 } 1902 1903 _this = _Animated.call.apply(_Animated, [this].concat(args)) || this; 1904 _this.payload = []; 1905 1906 _this.attach = function () { 1907 return _this.payload.forEach(function (p) { 1908 return p instanceof Animated && p.addChild(_assertThisInitialized(_this)); 1909 }); 1910 }; 1911 1912 _this.detach = function () { 1913 return _this.payload.forEach(function (p) { 1914 return p instanceof Animated && p.removeChild(_assertThisInitialized(_this)); 1915 }); 1916 }; 1917 1918 return _this; 1919 } 1920 1921 return AnimatedArray; 1922 }(Animated); 1923 var AnimatedObject = 1924 /*#__PURE__*/ 1925 function (_Animated2) { 1926 _inheritsLoose(AnimatedObject, _Animated2); 1927 1928 function AnimatedObject() { 1929 var _this2; 1930 1931 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 1932 args[_key3] = arguments[_key3]; 1933 } 1934 1935 _this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this; 1936 _this2.payload = {}; 1937 1938 _this2.attach = function () { 1939 return Object.values(_this2.payload).forEach(function (s) { 1940 return s instanceof Animated && s.addChild(_assertThisInitialized(_this2)); 1941 }); 1942 }; 1943 1944 _this2.detach = function () { 1945 return Object.values(_this2.payload).forEach(function (s) { 1946 return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2)); 1947 }); 1948 }; 1949 1950 return _this2; 1951 } 1952 1953 var _proto2 = AnimatedObject.prototype; 1954 1955 _proto2.getValue = function getValue(animated) { 1956 if (animated === void 0) { 1957 animated = false; 1958 } 1959 1960 var payload = {}; 1961 1962 for (var _key4 in this.payload) { 1963 var value = this.payload[_key4]; 1964 if (animated && !(value instanceof Animated)) continue; 1965 payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value; 1966 } 1967 1968 return payload; 1969 }; 1970 1971 _proto2.getAnimatedValue = function getAnimatedValue() { 1972 return this.getValue(true); 1973 }; 1974 1975 return AnimatedObject; 1976 }(Animated); 1977 1978 var applyAnimatedValues; 1979 function injectApplyAnimatedValues(fn, transform) { 1980 applyAnimatedValues = { 1981 fn: fn, 1982 transform: transform 1983 }; 1984 } 1985 var colorNames; 1986 function injectColorNames(names) { 1987 colorNames = names; 1988 } 1989 var requestFrame = function requestFrame(cb) { 1990 return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1; 1991 }; 1992 var cancelFrame = function cancelFrame(id) { 1993 typeof window !== 'undefined' && window.cancelAnimationFrame(id); 1994 }; 1995 function injectFrame(raf, caf) { 1996 requestFrame = raf; 1997 cancelFrame = caf; 1998 } 1999 var interpolation; 2000 function injectStringInterpolator(fn) { 2001 interpolation = fn; 2002 } 2003 var now = function now() { 2004 return Date.now(); 2005 }; 2006 function injectNow(nowFn) { 2007 now = nowFn; 2008 } 2009 var defaultElement; 2010 function injectDefaultElement(el) { 2011 defaultElement = el; 2012 } 2013 var animatedApi = function animatedApi(node) { 2014 return node.current; 2015 }; 2016 function injectAnimatedApi(fn) { 2017 animatedApi = fn; 2018 } 2019 var createAnimatedStyle; 2020 function injectCreateAnimatedStyle(factory) { 2021 createAnimatedStyle = factory; 2022 } 2023 var manualFrameloop; 2024 function injectManualFrameloop(callback) { 2025 manualFrameloop = callback; 2026 } 2027 2028 var Globals = /*#__PURE__*/Object.freeze({ 2029 get applyAnimatedValues () { return applyAnimatedValues; }, 2030 injectApplyAnimatedValues: injectApplyAnimatedValues, 2031 get colorNames () { return colorNames; }, 2032 injectColorNames: injectColorNames, 2033 get requestFrame () { return requestFrame; }, 2034 get cancelFrame () { return cancelFrame; }, 2035 injectFrame: injectFrame, 2036 get interpolation () { return interpolation; }, 2037 injectStringInterpolator: injectStringInterpolator, 2038 get now () { return now; }, 2039 injectNow: injectNow, 2040 get defaultElement () { return defaultElement; }, 2041 injectDefaultElement: injectDefaultElement, 2042 get animatedApi () { return animatedApi; }, 2043 injectAnimatedApi: injectAnimatedApi, 2044 get createAnimatedStyle () { return createAnimatedStyle; }, 2045 injectCreateAnimatedStyle: injectCreateAnimatedStyle, 2046 get manualFrameloop () { return manualFrameloop; }, 2047 injectManualFrameloop: injectManualFrameloop 2048 }); 2049 2050 /** 2051 * Wraps the `style` property with `AnimatedStyle`. 2052 */ 2053 2054 var AnimatedProps = 2055 /*#__PURE__*/ 2056 function (_AnimatedObject) { 2057 _inheritsLoose(AnimatedProps, _AnimatedObject); 2058 2059 function AnimatedProps(props, callback) { 2060 var _this; 2061 2062 _this = _AnimatedObject.call(this) || this; 2063 _this.update = void 0; 2064 _this.payload = !props.style ? props : _extends({}, props, { 2065 style: createAnimatedStyle(props.style) 2066 }); 2067 _this.update = callback; 2068 2069 _this.attach(); 2070 2071 return _this; 2072 } 2073 2074 return AnimatedProps; 2075 }(AnimatedObject); 2076 2077 var isFunctionComponent = function isFunctionComponent(val) { 2078 return is.fun(val) && !(val.prototype instanceof React__default.Component); 2079 }; 2080 2081 var createAnimatedComponent = function createAnimatedComponent(Component) { 2082 var AnimatedComponent = React.forwardRef(function (props, ref) { 2083 var forceUpdate = useForceUpdate(); 2084 var mounted = React.useRef(true); 2085 var propsAnimated = React.useRef(null); 2086 var node = React.useRef(null); 2087 var attachProps = React.useCallback(function (props) { 2088 var oldPropsAnimated = propsAnimated.current; 2089 2090 var callback = function callback() { 2091 var didUpdate = false; 2092 2093 if (node.current) { 2094 didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue()); 2095 } 2096 2097 if (!node.current || didUpdate === false) { 2098 // If no referenced node has been found, or the update target didn't have a 2099 // native-responder, then forceUpdate the animation ... 2100 forceUpdate(); 2101 } 2102 }; 2103 2104 propsAnimated.current = new AnimatedProps(props, callback); 2105 oldPropsAnimated && oldPropsAnimated.detach(); 2106 }, []); 2107 React.useEffect(function () { 2108 return function () { 2109 mounted.current = false; 2110 propsAnimated.current && propsAnimated.current.detach(); 2111 }; 2112 }, []); 2113 React.useImperativeHandle(ref, function () { 2114 return animatedApi(node, mounted, forceUpdate); 2115 }); 2116 attachProps(props); 2117 2118 var _getValue = propsAnimated.current.getValue(), 2119 scrollTop = _getValue.scrollTop, 2120 scrollLeft = _getValue.scrollLeft, 2121 animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]); // Functions cannot have refs, see: 2122 // See: https://github.com/react-spring/react-spring/issues/569 2123 2124 2125 var refFn = isFunctionComponent(Component) ? undefined : function (childRef) { 2126 return node.current = handleRef(childRef, ref); 2127 }; 2128 return React__default.createElement(Component, _extends({}, animatedProps, { 2129 ref: refFn 2130 })); 2131 }); 2132 return AnimatedComponent; 2133 }; 2134 2135 var active = false; 2136 var controllers = new Set(); 2137 2138 var update = function update() { 2139 if (!active) return false; 2140 var time = now(); 2141 2142 for (var _iterator = controllers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { 2143 var _ref; 2144 2145 if (_isArray) { 2146 if (_i >= _iterator.length) break; 2147 _ref = _iterator[_i++]; 2148 } else { 2149 _i = _iterator.next(); 2150 if (_i.done) break; 2151 _ref = _i.value; 2152 } 2153 2154 var controller = _ref; 2155 var isActive = false; 2156 2157 for (var configIdx = 0; configIdx < controller.configs.length; configIdx++) { 2158 var config = controller.configs[configIdx]; 2159 var endOfAnimation = void 0, 2160 lastTime = void 0; 2161 2162 for (var valIdx = 0; valIdx < config.animatedValues.length; valIdx++) { 2163 var animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude 2164 2165 if (animation.done) continue; 2166 var from = config.fromValues[valIdx]; 2167 var to = config.toValues[valIdx]; 2168 var position = animation.lastPosition; 2169 var isAnimated = to instanceof Animated; 2170 var velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity; 2171 if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state 2172 2173 if (config.immediate) { 2174 animation.setValue(to); 2175 animation.done = true; 2176 continue; 2177 } // Break animation when string values are involved 2178 2179 2180 if (typeof from === 'string' || typeof to === 'string') { 2181 animation.setValue(to); 2182 animation.done = true; 2183 continue; 2184 } 2185 2186 if (config.duration !== void 0) { 2187 /** Duration easing */ 2188 position = from + config.easing((time - animation.startTime) / config.duration) * (to - from); 2189 endOfAnimation = time >= animation.startTime + config.duration; 2190 } else if (config.decay) { 2191 /** Decay easing */ 2192 position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime))); 2193 endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1; 2194 if (endOfAnimation) to = position; 2195 } else { 2196 /** Spring easing */ 2197 lastTime = animation.lastTime !== void 0 ? animation.lastTime : time; 2198 velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end. 2199 2200 if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/ 2201 2202 var numSteps = Math.floor(time - lastTime); 2203 2204 for (var i = 0; i < numSteps; ++i) { 2205 var force = -config.tension * (position - to); 2206 var damping = -config.friction * velocity; 2207 var acceleration = (force + damping) / config.mass; 2208 velocity = velocity + acceleration * 1 / 1000; 2209 position = position + velocity * 1 / 1000; 2210 } // Conditions for stopping the spring animation 2211 2212 2213 var isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false; 2214 var isVelocity = Math.abs(velocity) <= config.precision; 2215 var isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true; 2216 endOfAnimation = isOvershooting || isVelocity && isDisplacement; 2217 animation.lastVelocity = velocity; 2218 animation.lastTime = time; 2219 } // Trails aren't done until their parents conclude 2220 2221 2222 if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false; 2223 2224 if (endOfAnimation) { 2225 // Ensure that we end up with a round value 2226 if (animation.value !== to) position = to; 2227 animation.done = true; 2228 } else isActive = true; 2229 2230 animation.setValue(position); 2231 animation.lastPosition = position; 2232 } // Keep track of updated values only when necessary 2233 2234 2235 if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue(); 2236 } // Update callbacks in the end of the frame 2237 2238 2239 if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame 2240 2241 if (!isActive) { 2242 controllers.delete(controller); 2243 controller.stop(true); 2244 } 2245 } // Loop over as long as there are controllers ... 2246 2247 2248 if (controllers.size) { 2249 if (manualFrameloop) manualFrameloop();else requestFrame(update); 2250 } else { 2251 active = false; 2252 } 2253 2254 return active; 2255 }; 2256 2257 var start = function start(controller) { 2258 if (!controllers.has(controller)) controllers.add(controller); 2259 2260 if (!active) { 2261 active = true; 2262 if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update); 2263 } 2264 }; 2265 2266 var stop = function stop(controller) { 2267 if (controllers.has(controller)) controllers.delete(controller); 2268 }; 2269 2270 function createInterpolator(range, output, extrapolate) { 2271 if (typeof range === 'function') { 2272 return range; 2273 } 2274 2275 if (Array.isArray(range)) { 2276 return createInterpolator({ 2277 range: range, 2278 output: output, 2279 extrapolate: extrapolate 2280 }); 2281 } 2282 2283 if (interpolation && typeof range.output[0] === 'string') { 2284 return interpolation(range); 2285 } 2286 2287 var config = range; 2288 var outputRange = config.output; 2289 var inputRange = config.range || [0, 1]; 2290 var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend'; 2291 var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend'; 2292 2293 var easing = config.easing || function (t) { 2294 return t; 2295 }; 2296 2297 return function (input) { 2298 var range = findRange(input, inputRange); 2299 return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map); 2300 }; 2301 } 2302 2303 function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { 2304 var result = map ? map(input) : input; // Extrapolate 2305 2306 if (result < inputMin) { 2307 if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin; 2308 } 2309 2310 if (result > inputMax) { 2311 if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax; 2312 } 2313 2314 if (outputMin === outputMax) return outputMin; 2315 if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range 2316 2317 if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing 2318 2319 result = easing(result); // Output Range 2320 2321 if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin; 2322 return result; 2323 } 2324 2325 function findRange(input, inputRange) { 2326 for (var i = 1; i < inputRange.length - 1; ++i) { 2327 if (inputRange[i] >= input) break; 2328 } 2329 2330 return i - 1; 2331 } 2332 2333 var AnimatedInterpolation = 2334 /*#__PURE__*/ 2335 function (_AnimatedArray) { 2336 _inheritsLoose(AnimatedInterpolation, _AnimatedArray); 2337 2338 function AnimatedInterpolation(parents, range, output, extrapolate) { 2339 var _this; 2340 2341 _this = _AnimatedArray.call(this) || this; 2342 _this.calc = void 0; 2343 _this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents]; 2344 _this.calc = createInterpolator(range, output, extrapolate); 2345 return _this; 2346 } 2347 2348 var _proto = AnimatedInterpolation.prototype; 2349 2350 _proto.getValue = function getValue() { 2351 return this.calc.apply(this, this.payload.map(function (value) { 2352 return value.getValue(); 2353 })); 2354 }; 2355 2356 _proto.updateConfig = function updateConfig(range, output, extrapolate) { 2357 this.calc = createInterpolator(range, output, extrapolate); 2358 }; 2359 2360 _proto.interpolate = function interpolate(range, output, extrapolate) { 2361 return new AnimatedInterpolation(this, range, output, extrapolate); 2362 }; 2363 2364 return AnimatedInterpolation; 2365 }(AnimatedArray); 2366 2367 var interpolate$1 = function interpolate(parents, range, output) { 2368 return parents && new AnimatedInterpolation(parents, range, output); 2369 }; 2370 2371 var config = { 2372 default: { 2373 tension: 170, 2374 friction: 26 2375 }, 2376 gentle: { 2377 tension: 120, 2378 friction: 14 2379 }, 2380 wobbly: { 2381 tension: 180, 2382 friction: 12 2383 }, 2384 stiff: { 2385 tension: 210, 2386 friction: 20 2387 }, 2388 slow: { 2389 tension: 280, 2390 friction: 60 2391 }, 2392 molasses: { 2393 tension: 280, 2394 friction: 120 2395 } 2396 }; 2397 2398 /** API 2399 * useChain(references, timeSteps, timeFrame) 2400 */ 2401 2402 function useChain(refs, timeSteps, timeFrame) { 2403 if (timeFrame === void 0) { 2404 timeFrame = 1000; 2405 } 2406 2407 var previous = React.useRef(); 2408 React.useEffect(function () { 2409 if (is.equ(refs, previous.current)) refs.forEach(function (_ref) { 2410 var current = _ref.current; 2411 return current && current.start(); 2412 });else if (timeSteps) { 2413 refs.forEach(function (_ref2, index) { 2414 var current = _ref2.current; 2415 2416 if (current) { 2417 var ctrls = current.controllers; 2418 2419 if (ctrls.length) { 2420 var t = timeFrame * timeSteps[index]; 2421 ctrls.forEach(function (ctrl) { 2422 ctrl.queue = ctrl.queue.map(function (e) { 2423 return _extends({}, e, { 2424 delay: e.delay + t 2425 }); 2426 }); 2427 ctrl.start(); 2428 }); 2429 } 2430 } 2431 }); 2432 } else refs.reduce(function (q, _ref3, rI) { 2433 var current = _ref3.current; 2434 return q = q.then(function () { 2435 return current.start(); 2436 }); 2437 }, Promise.resolve()); 2438 previous.current = refs; 2439 }); 2440 } 2441 2442 /** 2443 * Animated works by building a directed acyclic graph of dependencies 2444 * transparently when you render your Animated components. 2445 * 2446 * new Animated.Value(0) 2447 * .interpolate() .interpolate() new Animated.Value(1) 2448 * opacity translateY scale 2449 * style transform 2450 * View#234 style 2451 * View#123 2452 * 2453 * A) Top Down phase 2454 * When an AnimatedValue is updated, we recursively go down through this 2455 * graph in order to find leaf nodes: the views that we flag as needing 2456 * an update. 2457 * 2458 * B) Bottom Up phase 2459 * When a view is flagged as needing an update, we recursively go back up 2460 * in order to build the new value that it needs. The reason why we need 2461 * this two-phases process is to deal with composite props such as 2462 * transform which can receive values from multiple parents. 2463 */ 2464 function addAnimatedStyles(node, styles) { 2465 if ('update' in node) { 2466 styles.add(node); 2467 } else { 2468 node.getChildren().forEach(function (child) { 2469 return addAnimatedStyles(child, styles); 2470 }); 2471 } 2472 } 2473 2474 var AnimatedValue = 2475 /*#__PURE__*/ 2476 function (_Animated) { 2477 _inheritsLoose(AnimatedValue, _Animated); 2478 2479 function AnimatedValue(_value) { 2480 var _this; 2481 2482 _this = _Animated.call(this) || this; 2483 _this.animatedStyles = new Set(); 2484 _this.value = void 0; 2485 _this.startPosition = void 0; 2486 _this.lastPosition = void 0; 2487 _this.lastVelocity = void 0; 2488 _this.startTime = void 0; 2489 _this.lastTime = void 0; 2490 _this.done = false; 2491 2492 _this.setValue = function (value, flush) { 2493 if (flush === void 0) { 2494 flush = true; 2495 } 2496 2497 _this.value = value; 2498 if (flush) _this.flush(); 2499 }; 2500 2501 _this.value = _value; 2502 _this.startPosition = _value; 2503 _this.lastPosition = _value; 2504 return _this; 2505 } 2506 2507 var _proto = AnimatedValue.prototype; 2508 2509 _proto.flush = function flush() { 2510 if (this.animatedStyles.size === 0) { 2511 addAnimatedStyles(this, this.animatedStyles); 2512 } 2513 2514 this.animatedStyles.forEach(function (animatedStyle) { 2515 return animatedStyle.update(); 2516 }); 2517 }; 2518 2519 _proto.clearStyles = function clearStyles() { 2520 this.animatedStyles.clear(); 2521 }; 2522 2523 _proto.getValue = function getValue() { 2524 return this.value; 2525 }; 2526 2527 _proto.interpolate = function interpolate(range, output, extrapolate) { 2528 return new AnimatedInterpolation(this, range, output, extrapolate); 2529 }; 2530 2531 return AnimatedValue; 2532 }(Animated); 2533 2534 var AnimatedValueArray = 2535 /*#__PURE__*/ 2536 function (_AnimatedArray) { 2537 _inheritsLoose(AnimatedValueArray, _AnimatedArray); 2538 2539 function AnimatedValueArray(values) { 2540 var _this; 2541 2542 _this = _AnimatedArray.call(this) || this; 2543 _this.payload = values.map(function (n) { 2544 return new AnimatedValue(n); 2545 }); 2546 return _this; 2547 } 2548 2549 var _proto = AnimatedValueArray.prototype; 2550 2551 _proto.setValue = function setValue(value, flush) { 2552 var _this2 = this; 2553 2554 if (flush === void 0) { 2555 flush = true; 2556 } 2557 2558 if (Array.isArray(value)) { 2559 if (value.length === this.payload.length) { 2560 value.forEach(function (v, i) { 2561 return _this2.payload[i].setValue(v, flush); 2562 }); 2563 } 2564 } else { 2565 this.payload.forEach(function (p) { 2566 return p.setValue(value, flush); 2567 }); 2568 } 2569 }; 2570 2571 _proto.getValue = function getValue() { 2572 return this.payload.map(function (v) { 2573 return v.getValue(); 2574 }); 2575 }; 2576 2577 _proto.interpolate = function interpolate(range, output) { 2578 return new AnimatedInterpolation(this, range, output); 2579 }; 2580 2581 return AnimatedValueArray; 2582 }(AnimatedArray); 2583 2584 var G = 0; 2585 2586 var Controller = 2587 /*#__PURE__*/ 2588 function () { 2589 function Controller() { 2590 var _this = this; 2591 2592 this.id = void 0; 2593 this.idle = true; 2594 this.hasChanged = false; 2595 this.guid = 0; 2596 this.local = 0; 2597 this.props = {}; 2598 this.merged = {}; 2599 this.animations = {}; 2600 this.interpolations = {}; 2601 this.values = {}; 2602 this.configs = []; 2603 this.listeners = []; 2604 this.queue = []; 2605 this.localQueue = void 0; 2606 2607 this.getValues = function () { 2608 return _this.interpolations; 2609 }; 2610 2611 this.id = G++; 2612 } 2613 /** update(props) 2614 * This function filters input props and creates an array of tasks which are executed in .start() 2615 * Each task is allowed to carry a delay, which means it can execute asnychroneously */ 2616 2617 2618 var _proto = Controller.prototype; 2619 2620 _proto.update = function update$$1(args) { 2621 //this._id = n + this.id 2622 if (!args) return this; // Extract delay and the to-prop from props 2623 2624 var _ref = interpolateTo(args), 2625 _ref$delay = _ref.delay, 2626 delay = _ref$delay === void 0 ? 0 : _ref$delay, 2627 to = _ref.to, 2628 props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]); 2629 2630 if (is.arr(to) || is.fun(to)) { 2631 // If config is either a function or an array queue it up as is 2632 this.queue.push(_extends({}, props, { 2633 delay: delay, 2634 to: to 2635 })); 2636 } else if (to) { 2637 // Otherwise go through each key since it could be delayed individually 2638 var ops = {}; 2639 Object.entries(to).forEach(function (_ref2) { 2640 var _to; 2641 2642 var k = _ref2[0], 2643 v = _ref2[1]; 2644 2645 // Fetch delay and create an entry, consisting of the to-props, the delay, and basic props 2646 var entry = _extends({ 2647 to: (_to = {}, _to[k] = v, _to), 2648 delay: callProp(delay, k) 2649 }, props); 2650 2651 var previous = ops[entry.delay] && ops[entry.delay].to; 2652 ops[entry.delay] = _extends({}, ops[entry.delay], entry, { 2653 to: _extends({}, previous, entry.to) 2654 }); 2655 }); 2656 this.queue = Object.values(ops); 2657 } // Sort queue, so that async calls go last 2658 2659 2660 this.queue = this.queue.sort(function (a, b) { 2661 return a.delay - b.delay; 2662 }); // Diff the reduced props immediately (they'll contain the from-prop and some config) 2663 2664 this.diff(props); 2665 return this; 2666 } 2667 /** start(onEnd) 2668 * This function either executes a queue, if present, or starts the frameloop, which animates */ 2669 ; 2670 2671 _proto.start = function start$$1(onEnd) { 2672 var _this2 = this; 2673 2674 // If a queue is present we must excecute it 2675 if (this.queue.length) { 2676 this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values 2677 2678 if (this.localQueue) { 2679 this.localQueue.forEach(function (_ref3) { 2680 var _ref3$from = _ref3.from, 2681 from = _ref3$from === void 0 ? {} : _ref3$from, 2682 _ref3$to = _ref3.to, 2683 to = _ref3$to === void 0 ? {} : _ref3$to; 2684 if (is.obj(from)) _this2.merged = _extends({}, from, _this2.merged); 2685 if (is.obj(to)) _this2.merged = _extends({}, _this2.merged, to); 2686 }); 2687 } // The guid helps us tracking frames, a new queue over an old one means an override 2688 // We discard async calls in that caseÍ 2689 2690 2691 var local = this.local = ++this.guid; 2692 var queue = this.localQueue = this.queue; 2693 this.queue = []; // Go through each entry and execute it 2694 2695 queue.forEach(function (_ref4, index) { 2696 var delay = _ref4.delay, 2697 props = _objectWithoutPropertiesLoose(_ref4, ["delay"]); 2698 2699 var cb = function cb(finished) { 2700 if (index === queue.length - 1 && local === _this2.guid && finished) { 2701 _this2.idle = true; 2702 if (_this2.props.onRest) _this2.props.onRest(_this2.merged); 2703 } 2704 2705 if (onEnd) onEnd(); 2706 }; // Entries can be delayed, ansyc or immediate 2707 2708 2709 var async = is.arr(props.to) || is.fun(props.to); 2710 2711 if (delay) { 2712 setTimeout(function () { 2713 if (local === _this2.guid) { 2714 if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); 2715 } 2716 }, delay); 2717 } else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); 2718 }); 2719 } // Otherwise we kick of the frameloop 2720 else { 2721 if (is.fun(onEnd)) this.listeners.push(onEnd); 2722 if (this.props.onStart) this.props.onStart(); 2723 2724 start(this); 2725 } 2726 2727 return this; 2728 }; 2729 2730 _proto.stop = function stop$$1(finished) { 2731 this.listeners.forEach(function (onEnd) { 2732 return onEnd(finished); 2733 }); 2734 this.listeners = []; 2735 return this; 2736 } 2737 /** Pause sets onEnd listeners free, but also removes the controller from the frameloop */ 2738 ; 2739 2740 _proto.pause = function pause(finished) { 2741 this.stop(true); 2742 if (finished) stop(this); 2743 return this; 2744 }; 2745 2746 _proto.runAsync = function runAsync(_ref5, onEnd) { 2747 var _this3 = this; 2748 2749 var delay = _ref5.delay, 2750 props = _objectWithoutPropertiesLoose(_ref5, ["delay"]); 2751 2752 var local = this.local; // If "to" is either a function or an array it will be processed async, therefor "to" should be empty right now 2753 // If the view relies on certain values "from" has to be present 2754 2755 var queue = Promise.resolve(undefined); 2756 2757 if (is.arr(props.to)) { 2758 var _loop = function _loop(i) { 2759 var index = i; 2760 2761 var fresh = _extends({}, props, interpolateTo(props.to[index])); 2762 2763 if (is.arr(fresh.config)) fresh.config = fresh.config[index]; 2764 queue = queue.then(function () { 2765 //this.stop() 2766 if (local === _this3.guid) return new Promise(function (r) { 2767 return _this3.diff(fresh).start(r); 2768 }); 2769 }); 2770 }; 2771 2772 for (var i = 0; i < props.to.length; i++) { 2773 _loop(i); 2774 } 2775 } else if (is.fun(props.to)) { 2776 var index = 0; 2777 var last; 2778 queue = queue.then(function () { 2779 return props.to( // next(props) 2780 function (p) { 2781 var fresh = _extends({}, props, interpolateTo(p)); 2782 2783 if (is.arr(fresh.config)) fresh.config = fresh.config[index]; 2784 index++; //this.stop() 2785 2786 if (local === _this3.guid) return last = new Promise(function (r) { 2787 return _this3.diff(fresh).start(r); 2788 }); 2789 return; 2790 }, // cancel() 2791 function (finished) { 2792 if (finished === void 0) { 2793 finished = true; 2794 } 2795 2796 return _this3.stop(finished); 2797 }).then(function () { 2798 return last; 2799 }); 2800 }); 2801 } 2802 2803 queue.then(onEnd); 2804 }; 2805 2806 _proto.diff = function diff(props) { 2807 var _this4 = this; 2808 2809 this.props = _extends({}, this.props, props); 2810 var _this$props = this.props, 2811 _this$props$from = _this$props.from, 2812 from = _this$props$from === void 0 ? {} : _this$props$from, 2813 _this$props$to = _this$props.to, 2814 to = _this$props$to === void 0 ? {} : _this$props$to, 2815 _this$props$config = _this$props.config, 2816 config = _this$props$config === void 0 ? {} : _this$props$config, 2817 reverse = _this$props.reverse, 2818 attach = _this$props.attach, 2819 reset = _this$props.reset, 2820 immediate = _this$props.immediate; // Reverse values when requested 2821 2822 if (reverse) { 2823 var _ref6 = [to, from]; 2824 from = _ref6[0]; 2825 to = _ref6[1]; 2826 } // This will collect all props that were ever set, reset merged props when necessary 2827 2828 2829 this.merged = _extends({}, from, this.merged, to); 2830 this.hasChanged = false; // Attachment handling, trailed springs can "attach" themselves to a previous spring 2831 2832 var target = attach && attach(this); // Reduces input { name: value } pairs into animated values 2833 2834 this.animations = Object.entries(this.merged).reduce(function (acc, _ref7) { 2835 var name = _ref7[0], 2836 value = _ref7[1]; 2837 // Issue cached entries, except on reset 2838 var entry = acc[name] || {}; // Figure out what the value is supposed to be 2839 2840 var isNumber = is.num(value); 2841 var isString = is.str(value) && !value.startsWith('#') && !/\d/.test(value) && !colorNames[value]; 2842 var isArray = is.arr(value); 2843 var isInterpolation = !isNumber && !isArray && !isString; 2844 var fromValue = !is.und(from[name]) ? from[name] : value; 2845 var toValue = isNumber || isArray ? value : isString ? value : 1; 2846 var toConfig = callProp(config, name); 2847 if (target) toValue = target.animations[name].parent; 2848 var parent = entry.parent, 2849 interpolation$$1 = entry.interpolation, 2850 toValues = toArray(target ? toValue.getPayload() : toValue), 2851 animatedValues; 2852 var newValue = value; 2853 if (isInterpolation) newValue = interpolation({ 2854 range: [0, 1], 2855 output: [value, value] 2856 })(1); 2857 var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags 2858 2859 var isFirst = is.und(parent); 2860 var isActive = !isFirst && entry.animatedValues.some(function (v) { 2861 return !v.done; 2862 }); 2863 var currentValueDiffersFromGoal = !is.equ(newValue, currentValue); 2864 var hasNewGoal = !is.equ(newValue, entry.previous); 2865 var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one) 2866 // and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?) 2867 2868 if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) { 2869 var _extends2; 2870 2871 // Convert regular values into animated values, ALWAYS re-use if possible 2872 if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) { 2873 var prev = entry.interpolation && entry.interpolation.calc(entry.parent.value); 2874 prev = prev !== void 0 && !reset ? prev : fromValue; 2875 2876 if (entry.parent) { 2877 parent = entry.parent; 2878 parent.setValue(0, false); 2879 } else parent = new AnimatedValue(0); 2880 2881 var range = { 2882 output: [prev, value] 2883 }; 2884 2885 if (entry.interpolation) { 2886 interpolation$$1 = entry.interpolation; 2887 entry.interpolation.updateConfig(range); 2888 } else interpolation$$1 = parent.interpolate(range); 2889 } 2890 toValues = toArray(target ? toValue.getPayload() : toValue); 2891 animatedValues = toArray(parent.getPayload()); 2892 if (reset && !isInterpolation) parent.setValue(fromValue, false); 2893 _this4.hasChanged = true; // Reset animated values 2894 2895 animatedValues.forEach(function (value) { 2896 value.startPosition = value.value; 2897 value.lastPosition = value.value; 2898 value.lastVelocity = isActive ? value.lastVelocity : undefined; 2899 value.lastTime = isActive ? value.lastTime : undefined; 2900 value.startTime = now(); 2901 value.done = false; 2902 value.animatedStyles.clear(); 2903 }); // Set immediate values 2904 2905 if (callProp(immediate, name)) { 2906 parent.setValue(isInterpolation ? toValue : value, false); 2907 } 2908 2909 return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, entry, { 2910 name: name, 2911 parent: parent, 2912 interpolation: interpolation$$1, 2913 animatedValues: animatedValues, 2914 toValues: toValues, 2915 previous: newValue, 2916 config: toConfig, 2917 fromValues: toArray(parent.getValue()), 2918 immediate: callProp(immediate, name), 2919 initialVelocity: withDefault(toConfig.velocity, 0), 2920 clamp: withDefault(toConfig.clamp, false), 2921 precision: withDefault(toConfig.precision, 0.01), 2922 tension: withDefault(toConfig.tension, 170), 2923 friction: withDefault(toConfig.friction, 26), 2924 mass: withDefault(toConfig.mass, 1), 2925 duration: toConfig.duration, 2926 easing: withDefault(toConfig.easing, function (t) { 2927 return t; 2928 }), 2929 decay: toConfig.decay 2930 }), _extends2)); 2931 } else { 2932 if (!currentValueDiffersFromGoal) { 2933 var _extends3; 2934 2935 // So ... the current target value (newValue) appears to be different from the previous value, 2936 // which normally constitutes an update, but the actual value (currentValue) matches the target! 2937 // In order to resolve this without causing an animation update we silently flag the animation as done, 2938 // which it technically is. Interpolations also needs a config update with their target set to 1. 2939 if (isInterpolation) { 2940 parent.setValue(1, false); 2941 interpolation$$1.updateConfig({ 2942 output: [newValue, newValue] 2943 }); 2944 } 2945 2946 parent.done = true; 2947 _this4.hasChanged = true; 2948 return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], { 2949 previous: newValue 2950 }), _extends3)); 2951 } 2952 2953 return acc; 2954 } 2955 }, this.animations); 2956 2957 if (this.hasChanged) { 2958 // Make animations available to frameloop 2959 this.configs = Object.values(this.animations); 2960 this.values = {}; 2961 this.interpolations = {}; 2962 2963 for (var key in this.animations) { 2964 this.interpolations[key] = this.animations[key].interpolation; 2965 this.values[key] = this.animations[key].interpolation.getValue(); 2966 } 2967 } 2968 2969 return this; 2970 }; 2971 2972 _proto.destroy = function destroy() { 2973 this.stop(); 2974 this.props = {}; 2975 this.merged = {}; 2976 this.animations = {}; 2977 this.interpolations = {}; 2978 this.values = {}; 2979 this.configs = []; 2980 this.local = 0; 2981 }; 2982 2983 return Controller; 2984 }(); 2985 2986 /** API 2987 * const props = useSprings(number, [{ ... }, { ... }, ...]) 2988 * const [props, set] = useSprings(number, (i, controller) => ({ ... })) 2989 */ 2990 2991 var useSprings = function useSprings(length, props) { 2992 var mounted = React.useRef(false); 2993 var ctrl = React.useRef(); 2994 var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations 2995 2996 var _useMemo = React.useMemo(function () { 2997 // Remove old controllers 2998 if (ctrl.current) { 2999 ctrl.current.map(function (c) { 3000 return c.destroy(); 3001 }); 3002 ctrl.current = undefined; 3003 } 3004 3005 var ref; 3006 return [new Array(length).fill().map(function (_, i) { 3007 var ctrl = new Controller(); 3008 var newProps = isFn ? callProp(props, i, ctrl) : props[i]; 3009 if (i === 0) ref = newProps.ref; 3010 ctrl.update(newProps); 3011 if (!ref) ctrl.start(); 3012 return ctrl; 3013 }), ref]; 3014 }, [length]), 3015 controllers = _useMemo[0], 3016 ref = _useMemo[1]; 3017 3018 ctrl.current = controllers; // The hooks reference api gets defined here ... 3019 3020 var api = React.useImperativeHandle(ref, function () { 3021 return { 3022 start: function start() { 3023 return Promise.all(ctrl.current.map(function (c) { 3024 return new Promise(function (r) { 3025 return c.start(r); 3026 }); 3027 })); 3028 }, 3029 stop: function stop(finished) { 3030 return ctrl.current.forEach(function (c) { 3031 return c.stop(finished); 3032 }); 3033 }, 3034 3035 get controllers() { 3036 return ctrl.current; 3037 } 3038 3039 }; 3040 }); // This function updates the controllers 3041 3042 var updateCtrl = React.useMemo(function () { 3043 return function (updateProps) { 3044 return ctrl.current.map(function (c, i) { 3045 c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]); 3046 if (!ref) c.start(); 3047 }); 3048 }; 3049 }, [length]); // Update controller if props aren't functional 3050 3051 React.useEffect(function () { 3052 if (mounted.current) { 3053 if (!isFn) updateCtrl(props); 3054 } else if (!ref) ctrl.current.forEach(function (c) { 3055 return c.start(); 3056 }); 3057 }); // Update mounted flag and destroy controller on unmount 3058 3059 React.useEffect(function () { 3060 return mounted.current = true, function () { 3061 return ctrl.current.forEach(function (c) { 3062 return c.destroy(); 3063 }); 3064 }; 3065 }, []); // Return animated props, or, anim-props + the update-setter above 3066 3067 var propValues = ctrl.current.map(function (c) { 3068 return c.getValues(); 3069 }); 3070 return isFn ? [propValues, updateCtrl, function (finished) { 3071 return ctrl.current.forEach(function (c) { 3072 return c.pause(finished); 3073 }); 3074 }] : propValues; 3075 }; 3076 3077 /** API 3078 * const props = useSpring({ ... }) 3079 * const [props, set] = useSpring(() => ({ ... })) 3080 */ 3081 3082 var useSpring = function useSpring(props) { 3083 var isFn = is.fun(props); 3084 3085 var _useSprings = useSprings(1, isFn ? props : [props]), 3086 result = _useSprings[0], 3087 set = _useSprings[1], 3088 pause = _useSprings[2]; 3089 3090 return isFn ? [result[0], set, pause] : result; 3091 }; 3092 3093 /** API 3094 * const trails = useTrail(number, { ... }) 3095 * const [trails, set] = useTrail(number, () => ({ ... })) 3096 */ 3097 3098 var useTrail = function useTrail(length, props) { 3099 var mounted = React.useRef(false); 3100 var isFn = is.fun(props); 3101 var updateProps = callProp(props); 3102 var instances = React.useRef(); 3103 3104 var _useSprings = useSprings(length, function (i, ctrl) { 3105 if (i === 0) instances.current = []; 3106 instances.current.push(ctrl); 3107 return _extends({}, updateProps, { 3108 config: callProp(updateProps.config, i), 3109 attach: i > 0 && function () { 3110 return instances.current[i - 1]; 3111 } 3112 }); 3113 }), 3114 result = _useSprings[0], 3115 set = _useSprings[1], 3116 pause = _useSprings[2]; // Set up function to update controller 3117 3118 3119 var updateCtrl = React.useMemo(function () { 3120 return function (props) { 3121 return set(function (i, ctrl) { 3122 var last = props.reverse ? i === 0 : length - 1 === i; 3123 var attachIdx = props.reverse ? i + 1 : i - 1; 3124 var attachController = instances.current[attachIdx]; 3125 return _extends({}, props, { 3126 config: callProp(props.config || updateProps.config, i), 3127 attach: attachController && function () { 3128 return attachController; 3129 } 3130 }); 3131 }); 3132 }; 3133 }, [length, updateProps.reverse]); // Update controller if props aren't functional 3134 3135 React.useEffect(function () { 3136 return void (mounted.current && !isFn && updateCtrl(props)); 3137 }); // Update mounted flag and destroy controller on unmount 3138 3139 React.useEffect(function () { 3140 return void (mounted.current = true); 3141 }, []); 3142 return isFn ? [result, updateCtrl, pause] : result; 3143 }; 3144 3145 /** API 3146 * const transitions = useTransition(items, itemKeys, { ... }) 3147 * const [transitions, update] = useTransition(items, itemKeys, () => ({ ... })) 3148 */ 3149 3150 var guid = 0; 3151 var ENTER = 'enter'; 3152 var LEAVE = 'leave'; 3153 var UPDATE = 'update'; 3154 3155 var mapKeys = function mapKeys(items, keys) { 3156 return (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String); 3157 }; 3158 3159 var get = function get(props) { 3160 var items = props.items, 3161 _props$keys = props.keys, 3162 keys = _props$keys === void 0 ? function (item) { 3163 return item; 3164 } : _props$keys, 3165 rest = _objectWithoutPropertiesLoose(props, ["items", "keys"]); 3166 3167 items = toArray(items !== void 0 ? items : null); 3168 return _extends({ 3169 items: items, 3170 keys: mapKeys(items, keys) 3171 }, rest); 3172 }; 3173 3174 function useTransition(input, keyTransform, config) { 3175 var props = _extends({ 3176 items: input, 3177 keys: keyTransform || function (i) { 3178 return i; 3179 } 3180 }, config); 3181 3182 var _get = get(props), 3183 _get$lazy = _get.lazy, 3184 lazy = _get$lazy === void 0 ? false : _get$lazy, 3185 _get$unique = _get.unique, 3186 _get$reset = _get.reset, 3187 reset = _get$reset === void 0 ? false : _get$reset, 3188 enter = _get.enter, 3189 leave = _get.leave, 3190 update = _get.update, 3191 onDestroyed = _get.onDestroyed, 3192 keys = _get.keys, 3193 items = _get.items, 3194 onFrame = _get.onFrame, 3195 _onRest = _get.onRest, 3196 onStart = _get.onStart, 3197 ref = _get.ref, 3198 extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]); 3199 3200 var forceUpdate = useForceUpdate(); 3201 var mounted = React.useRef(false); 3202 var state = React.useRef({ 3203 mounted: false, 3204 first: true, 3205 deleted: [], 3206 current: {}, 3207 transitions: [], 3208 prevProps: {}, 3209 paused: !!props.ref, 3210 instances: !mounted.current && new Map(), 3211 forceUpdate: forceUpdate 3212 }); 3213 React.useImperativeHandle(props.ref, function () { 3214 return { 3215 start: function start() { 3216 return Promise.all(Array.from(state.current.instances).map(function (_ref) { 3217 var c = _ref[1]; 3218 return new Promise(function (r) { 3219 return c.start(r); 3220 }); 3221 })); 3222 }, 3223 stop: function stop(finished) { 3224 return Array.from(state.current.instances).forEach(function (_ref2) { 3225 var c = _ref2[1]; 3226 return c.stop(finished); 3227 }); 3228 }, 3229 3230 get controllers() { 3231 return Array.from(state.current.instances).map(function (_ref3) { 3232 var c = _ref3[1]; 3233 return c; 3234 }); 3235 } 3236 3237 }; 3238 }); // Update state 3239 3240 state.current = diffItems(state.current, props); 3241 3242 if (state.current.changed) { 3243 // Update state 3244 state.current.transitions.forEach(function (transition) { 3245 var slot = transition.slot, 3246 from = transition.from, 3247 to = transition.to, 3248 config = transition.config, 3249 trail = transition.trail, 3250 key = transition.key, 3251 item = transition.item; 3252 if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object 3253 3254 var ctrl = state.current.instances.get(key); 3255 3256 var newProps = _extends({}, extra, { 3257 to: to, 3258 from: from, 3259 config: config, 3260 ref: ref, 3261 onRest: function onRest(values) { 3262 if (state.current.mounted) { 3263 if (transition.destroyed) { 3264 // If no ref is given delete destroyed items immediately 3265 if (!ref && !lazy) cleanUp(state, key); 3266 if (onDestroyed) onDestroyed(item); 3267 } // A transition comes to rest once all its springs conclude 3268 3269 3270 var curInstances = Array.from(state.current.instances); 3271 var active = curInstances.some(function (_ref4) { 3272 var c = _ref4[1]; 3273 return !c.idle; 3274 }); 3275 if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state); 3276 if (_onRest) _onRest(item, slot, values); 3277 } 3278 }, 3279 onStart: onStart && function () { 3280 return onStart(item, slot); 3281 }, 3282 onFrame: onFrame && function (values) { 3283 return onFrame(item, slot, values); 3284 }, 3285 delay: trail, 3286 reset: reset && slot === ENTER // Update controller 3287 3288 }); 3289 3290 ctrl.update(newProps); 3291 if (!state.current.paused) ctrl.start(); 3292 }); 3293 } 3294 3295 React.useEffect(function () { 3296 state.current.mounted = mounted.current = true; 3297 return function () { 3298 state.current.mounted = mounted.current = false; 3299 Array.from(state.current.instances).map(function (_ref5) { 3300 var c = _ref5[1]; 3301 return c.destroy(); 3302 }); 3303 state.current.instances.clear(); 3304 }; 3305 }, []); 3306 return state.current.transitions.map(function (_ref6) { 3307 var item = _ref6.item, 3308 slot = _ref6.slot, 3309 key = _ref6.key; 3310 return { 3311 item: item, 3312 key: key, 3313 state: slot, 3314 props: state.current.instances.get(key).getValues() 3315 }; 3316 }); 3317 } 3318 3319 function cleanUp(state, filterKey) { 3320 var deleted = state.current.deleted; 3321 3322 var _loop = function _loop() { 3323 if (_isArray) { 3324 if (_i >= _iterator.length) return "break"; 3325 _ref8 = _iterator[_i++]; 3326 } else { 3327 _i = _iterator.next(); 3328 if (_i.done) return "break"; 3329 _ref8 = _i.value; 3330 } 3331 3332 var _ref7 = _ref8; 3333 var key = _ref7.key; 3334 3335 var filter = function filter(t) { 3336 return t.key !== key; 3337 }; 3338 3339 if (is.und(filterKey) || filterKey === key) { 3340 state.current.instances.delete(key); 3341 state.current.transitions = state.current.transitions.filter(filter); 3342 state.current.deleted = state.current.deleted.filter(filter); 3343 } 3344 }; 3345 3346 for (var _iterator = deleted, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { 3347 var _ref8; 3348 3349 var _ret = _loop(); 3350 3351 if (_ret === "break") break; 3352 } 3353 3354 state.current.forceUpdate(); 3355 } 3356 3357 function diffItems(_ref9, props) { 3358 var first = _ref9.first, 3359 prevProps = _ref9.prevProps, 3360 state = _objectWithoutPropertiesLoose(_ref9, ["first", "prevProps"]); 3361 3362 var _get2 = get(props), 3363 items = _get2.items, 3364 keys = _get2.keys, 3365 initial = _get2.initial, 3366 from = _get2.from, 3367 enter = _get2.enter, 3368 leave = _get2.leave, 3369 update = _get2.update, 3370 _get2$trail = _get2.trail, 3371 trail = _get2$trail === void 0 ? 0 : _get2$trail, 3372 unique = _get2.unique, 3373 config = _get2.config, 3374 _get2$order = _get2.order, 3375 order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order; 3376 3377 var _get3 = get(prevProps), 3378 _keys = _get3.keys, 3379 _items = _get3.items; 3380 3381 var current = _extends({}, state.current); 3382 3383 var deleted = [].concat(state.deleted); // Compare next keys with current keys 3384 3385 var currentKeys = Object.keys(current); 3386 var currentSet = new Set(currentKeys); 3387 var nextSet = new Set(keys); 3388 var added = keys.filter(function (item) { 3389 return !currentSet.has(item); 3390 }); 3391 var removed = state.transitions.filter(function (item) { 3392 return !item.destroyed && !nextSet.has(item.originalKey); 3393 }).map(function (i) { 3394 return i.originalKey; 3395 }); 3396 var updated = keys.filter(function (item) { 3397 return currentSet.has(item); 3398 }); 3399 var delay = -trail; 3400 3401 while (order.length) { 3402 var changeType = order.shift(); 3403 3404 switch (changeType) { 3405 case ENTER: 3406 { 3407 added.forEach(function (key, index) { 3408 // In unique mode, remove fading out transitions if their key comes in again 3409 if (unique && deleted.find(function (d) { 3410 return d.originalKey === key; 3411 })) deleted = deleted.filter(function (t) { 3412 return t.originalKey !== key; 3413 }); 3414 var keyIndex = keys.indexOf(key); 3415 var item = items[keyIndex]; 3416 var slot = first && initial !== void 0 ? 'initial' : ENTER; 3417 current[key] = { 3418 slot: slot, 3419 originalKey: key, 3420 key: unique ? String(key) : guid++, 3421 item: item, 3422 trail: delay = delay + trail, 3423 config: callProp(config, item, slot), 3424 from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item), 3425 to: callProp(enter, item) 3426 }; 3427 }); 3428 break; 3429 } 3430 3431 case LEAVE: 3432 { 3433 removed.forEach(function (key) { 3434 var keyIndex = _keys.indexOf(key); 3435 3436 var item = _items[keyIndex]; 3437 var slot = LEAVE; 3438 deleted.unshift(_extends({}, current[key], { 3439 slot: slot, 3440 destroyed: true, 3441 left: _keys[Math.max(0, keyIndex - 1)], 3442 right: _keys[Math.min(_keys.length, keyIndex + 1)], 3443 trail: delay = delay + trail, 3444 config: callProp(config, item, slot), 3445 to: callProp(leave, item) 3446 })); 3447 delete current[key]; 3448 }); 3449 break; 3450 } 3451 3452 case UPDATE: 3453 { 3454 updated.forEach(function (key) { 3455 var keyIndex = keys.indexOf(key); 3456 var item = items[keyIndex]; 3457 var slot = UPDATE; 3458 current[key] = _extends({}, current[key], { 3459 item: item, 3460 slot: slot, 3461 trail: delay = delay + trail, 3462 config: callProp(config, item, slot), 3463 to: callProp(update, item) 3464 }); 3465 }); 3466 break; 3467 } 3468 } 3469 } 3470 3471 var out = keys.map(function (key) { 3472 return current[key]; 3473 }); // This tries to restore order for deleted items by finding their last known siblings 3474 // only using the left sibling to keep order placement consistent for all deleted items 3475 3476 deleted.forEach(function (_ref10) { 3477 var left = _ref10.left, 3478 right = _ref10.right, 3479 item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]); 3480 3481 var pos; // Was it the element on the left, if yes, move there ... 3482 3483 if ((pos = out.findIndex(function (t) { 3484 return t.originalKey === left; 3485 })) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\_(ツ)_/¯ 3486 3487 pos = Math.max(0, pos); 3488 out = [].concat(out.slice(0, pos), [item], out.slice(pos)); 3489 }); 3490 return _extends({}, state, { 3491 changed: added.length || removed.length || updated.length, 3492 first: first && added.length === 0, 3493 transitions: out, 3494 current: current, 3495 deleted: deleted, 3496 prevProps: props 3497 }); 3498 } 3499 3500 var AnimatedStyle = 3501 /*#__PURE__*/ 3502 function (_AnimatedObject) { 3503 _inheritsLoose(AnimatedStyle, _AnimatedObject); 3504 3505 function AnimatedStyle(style) { 3506 var _this; 3507 3508 if (style === void 0) { 3509 style = {}; 3510 } 3511 3512 _this = _AnimatedObject.call(this) || this; 3513 3514 if (style.transform && !(style.transform instanceof Animated)) { 3515 style = applyAnimatedValues.transform(style); 3516 } 3517 3518 _this.payload = style; 3519 return _this; 3520 } 3521 3522 return AnimatedStyle; 3523 }(AnimatedObject); 3524 3525 // http://www.w3.org/TR/css3-color/#svg-color 3526 var colors = { 3527 transparent: 0x00000000, 3528 aliceblue: 0xf0f8ffff, 3529 antiquewhite: 0xfaebd7ff, 3530 aqua: 0x00ffffff, 3531 aquamarine: 0x7fffd4ff, 3532 azure: 0xf0ffffff, 3533 beige: 0xf5f5dcff, 3534 bisque: 0xffe4c4ff, 3535 black: 0x000000ff, 3536 blanchedalmond: 0xffebcdff, 3537 blue: 0x0000ffff, 3538 blueviolet: 0x8a2be2ff, 3539 brown: 0xa52a2aff, 3540 burlywood: 0xdeb887ff, 3541 burntsienna: 0xea7e5dff, 3542 cadetblue: 0x5f9ea0ff, 3543 chartreuse: 0x7fff00ff, 3544 chocolate: 0xd2691eff, 3545 coral: 0xff7f50ff, 3546 cornflowerblue: 0x6495edff, 3547 cornsilk: 0xfff8dcff, 3548 crimson: 0xdc143cff, 3549 cyan: 0x00ffffff, 3550 darkblue: 0x00008bff, 3551 darkcyan: 0x008b8bff, 3552 darkgoldenrod: 0xb8860bff, 3553 darkgray: 0xa9a9a9ff, 3554 darkgreen: 0x006400ff, 3555 darkgrey: 0xa9a9a9ff, 3556 darkkhaki: 0xbdb76bff, 3557 darkmagenta: 0x8b008bff, 3558 darkolivegreen: 0x556b2fff, 3559 darkorange: 0xff8c00ff, 3560 darkorchid: 0x9932ccff, 3561 darkred: 0x8b0000ff, 3562 darksalmon: 0xe9967aff, 3563 darkseagreen: 0x8fbc8fff, 3564 darkslateblue: 0x483d8bff, 3565 darkslategray: 0x2f4f4fff, 3566 darkslategrey: 0x2f4f4fff, 3567 darkturquoise: 0x00ced1ff, 3568 darkviolet: 0x9400d3ff, 3569 deeppink: 0xff1493ff, 3570 deepskyblue: 0x00bfffff, 3571 dimgray: 0x696969ff, 3572 dimgrey: 0x696969ff, 3573 dodgerblue: 0x1e90ffff, 3574 firebrick: 0xb22222ff, 3575 floralwhite: 0xfffaf0ff, 3576 forestgreen: 0x228b22ff, 3577 fuchsia: 0xff00ffff, 3578 gainsboro: 0xdcdcdcff, 3579 ghostwhite: 0xf8f8ffff, 3580 gold: 0xffd700ff, 3581 goldenrod: 0xdaa520ff, 3582 gray: 0x808080ff, 3583 green: 0x008000ff, 3584 greenyellow: 0xadff2fff, 3585 grey: 0x808080ff, 3586 honeydew: 0xf0fff0ff, 3587 hotpink: 0xff69b4ff, 3588 indianred: 0xcd5c5cff, 3589 indigo: 0x4b0082ff, 3590 ivory: 0xfffff0ff, 3591 khaki: 0xf0e68cff, 3592 lavender: 0xe6e6faff, 3593 lavenderblush: 0xfff0f5ff, 3594 lawngreen: 0x7cfc00ff, 3595 lemonchiffon: 0xfffacdff, 3596 lightblue: 0xadd8e6ff, 3597 lightcoral: 0xf08080ff, 3598 lightcyan: 0xe0ffffff, 3599 lightgoldenrodyellow: 0xfafad2ff, 3600 lightgray: 0xd3d3d3ff, 3601 lightgreen: 0x90ee90ff, 3602 lightgrey: 0xd3d3d3ff, 3603 lightpink: 0xffb6c1ff, 3604 lightsalmon: 0xffa07aff, 3605 lightseagreen: 0x20b2aaff, 3606 lightskyblue: 0x87cefaff, 3607 lightslategray: 0x778899ff, 3608 lightslategrey: 0x778899ff, 3609 lightsteelblue: 0xb0c4deff, 3610 lightyellow: 0xffffe0ff, 3611 lime: 0x00ff00ff, 3612 limegreen: 0x32cd32ff, 3613 linen: 0xfaf0e6ff, 3614 magenta: 0xff00ffff, 3615 maroon: 0x800000ff, 3616 mediumaquamarine: 0x66cdaaff, 3617 mediumblue: 0x0000cdff, 3618 mediumorchid: 0xba55d3ff, 3619 mediumpurple: 0x9370dbff, 3620 mediumseagreen: 0x3cb371ff, 3621 mediumslateblue: 0x7b68eeff, 3622 mediumspringgreen: 0x00fa9aff, 3623 mediumturquoise: 0x48d1ccff, 3624 mediumvioletred: 0xc71585ff, 3625 midnightblue: 0x191970ff, 3626 mintcream: 0xf5fffaff, 3627 mistyrose: 0xffe4e1ff, 3628 moccasin: 0xffe4b5ff, 3629 navajowhite: 0xffdeadff, 3630 navy: 0x000080ff, 3631 oldlace: 0xfdf5e6ff, 3632 olive: 0x808000ff, 3633 olivedrab: 0x6b8e23ff, 3634 orange: 0xffa500ff, 3635 orangered: 0xff4500ff, 3636 orchid: 0xda70d6ff, 3637 palegoldenrod: 0xeee8aaff, 3638 palegreen: 0x98fb98ff, 3639 paleturquoise: 0xafeeeeff, 3640 palevioletred: 0xdb7093ff, 3641 papayawhip: 0xffefd5ff, 3642 peachpuff: 0xffdab9ff, 3643 peru: 0xcd853fff, 3644 pink: 0xffc0cbff, 3645 plum: 0xdda0ddff, 3646 powderblue: 0xb0e0e6ff, 3647 purple: 0x800080ff, 3648 rebeccapurple: 0x663399ff, 3649 red: 0xff0000ff, 3650 rosybrown: 0xbc8f8fff, 3651 royalblue: 0x4169e1ff, 3652 saddlebrown: 0x8b4513ff, 3653 salmon: 0xfa8072ff, 3654 sandybrown: 0xf4a460ff, 3655 seagreen: 0x2e8b57ff, 3656 seashell: 0xfff5eeff, 3657 sienna: 0xa0522dff, 3658 silver: 0xc0c0c0ff, 3659 skyblue: 0x87ceebff, 3660 slateblue: 0x6a5acdff, 3661 slategray: 0x708090ff, 3662 slategrey: 0x708090ff, 3663 snow: 0xfffafaff, 3664 springgreen: 0x00ff7fff, 3665 steelblue: 0x4682b4ff, 3666 tan: 0xd2b48cff, 3667 teal: 0x008080ff, 3668 thistle: 0xd8bfd8ff, 3669 tomato: 0xff6347ff, 3670 turquoise: 0x40e0d0ff, 3671 violet: 0xee82eeff, 3672 wheat: 0xf5deb3ff, 3673 white: 0xffffffff, 3674 whitesmoke: 0xf5f5f5ff, 3675 yellow: 0xffff00ff, 3676 yellowgreen: 0x9acd32ff 3677 }; 3678 3679 // const INTEGER = '[-+]?\\d+'; 3680 var NUMBER = '[-+]?\\d*\\.?\\d+'; 3681 var PERCENTAGE = NUMBER + '%'; 3682 3683 function call() { 3684 for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) { 3685 parts[_key] = arguments[_key]; 3686 } 3687 3688 return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)'; 3689 } 3690 3691 var rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)); 3692 var rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)); 3693 var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)); 3694 var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); 3695 var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 3696 var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 3697 var hex6 = /^#([0-9a-fA-F]{6})$/; 3698 var hex8 = /^#([0-9a-fA-F]{8})$/; 3699 3700 /* 3701 https://github.com/react-community/normalize-css-color 3702 3703 BSD 3-Clause License 3704 3705 Copyright (c) 2016, React Community 3706 All rights reserved. 3707 3708 Redistribution and use in source and binary forms, with or without 3709 modification, are permitted provided that the following conditions are met: 3710 3711 * Redistributions of source code must retain the above copyright notice, this 3712 list of conditions and the following disclaimer. 3713 3714 * Redistributions in binary form must reproduce the above copyright notice, 3715 this list of conditions and the following disclaimer in the documentation 3716 and/or other materials provided with the distribution. 3717 3718 * Neither the name of the copyright holder nor the names of its 3719 contributors may be used to endorse or promote products derived from 3720 this software without specific prior written permission. 3721 3722 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 3723 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3724 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 3725 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 3726 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3727 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 3728 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 3729 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 3730 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3731 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3732 */ 3733 function normalizeColor(color) { 3734 var match; 3735 3736 if (typeof color === 'number') { 3737 return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null; 3738 } // Ordered based on occurrences on Facebook codebase 3739 3740 3741 if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0; 3742 if (colors.hasOwnProperty(color)) return colors[color]; 3743 3744 if (match = rgb.exec(color)) { 3745 return (parse255(match[1]) << 24 | // r 3746 parse255(match[2]) << 16 | // g 3747 parse255(match[3]) << 8 | // b 3748 0x000000ff) >>> // a 3749 0; 3750 } 3751 3752 if (match = rgba.exec(color)) { 3753 return (parse255(match[1]) << 24 | // r 3754 parse255(match[2]) << 16 | // g 3755 parse255(match[3]) << 8 | // b 3756 parse1(match[4])) >>> // a 3757 0; 3758 } 3759 3760 if (match = hex3.exec(color)) { 3761 return parseInt(match[1] + match[1] + // r 3762 match[2] + match[2] + // g 3763 match[3] + match[3] + // b 3764 'ff', // a 3765 16) >>> 0; 3766 } // https://drafts.csswg.org/css-color-4/#hex-notation 3767 3768 3769 if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0; 3770 3771 if (match = hex4.exec(color)) { 3772 return parseInt(match[1] + match[1] + // r 3773 match[2] + match[2] + // g 3774 match[3] + match[3] + // b 3775 match[4] + match[4], // a 3776 16) >>> 0; 3777 } 3778 3779 if (match = hsl.exec(color)) { 3780 return (hslToRgb(parse360(match[1]), // h 3781 parsePercentage(match[2]), // s 3782 parsePercentage(match[3]) // l 3783 ) | 0x000000ff) >>> // a 3784 0; 3785 } 3786 3787 if (match = hsla.exec(color)) { 3788 return (hslToRgb(parse360(match[1]), // h 3789 parsePercentage(match[2]), // s 3790 parsePercentage(match[3]) // l 3791 ) | parse1(match[4])) >>> // a 3792 0; 3793 } 3794 3795 return null; 3796 } 3797 3798 function hue2rgb(p, q, t) { 3799 if (t < 0) t += 1; 3800 if (t > 1) t -= 1; 3801 if (t < 1 / 6) return p + (q - p) * 6 * t; 3802 if (t < 1 / 2) return q; 3803 if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; 3804 return p; 3805 } 3806 3807 function hslToRgb(h, s, l) { 3808 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 3809 var p = 2 * l - q; 3810 var r = hue2rgb(p, q, h + 1 / 3); 3811 var g = hue2rgb(p, q, h); 3812 var b = hue2rgb(p, q, h - 1 / 3); 3813 return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8; 3814 } 3815 3816 function parse255(str) { 3817 var int = parseInt(str, 10); 3818 if (int < 0) return 0; 3819 if (int > 255) return 255; 3820 return int; 3821 } 3822 3823 function parse360(str) { 3824 var int = parseFloat(str); 3825 return (int % 360 + 360) % 360 / 360; 3826 } 3827 3828 function parse1(str) { 3829 var num = parseFloat(str); 3830 if (num < 0) return 0; 3831 if (num > 1) return 255; 3832 return Math.round(num * 255); 3833 } 3834 3835 function parsePercentage(str) { 3836 // parseFloat conveniently ignores the final % 3837 var int = parseFloat(str); 3838 if (int < 0) return 0; 3839 if (int > 100) return 1; 3840 return int / 100; 3841 } 3842 3843 function colorToRgba(input) { 3844 var int32Color = normalizeColor(input); 3845 if (int32Color === null) return input; 3846 int32Color = int32Color || 0; 3847 var r = (int32Color & 0xff000000) >>> 24; 3848 var g = (int32Color & 0x00ff0000) >>> 16; 3849 var b = (int32Color & 0x0000ff00) >>> 8; 3850 var a = (int32Color & 0x000000ff) / 255; 3851 return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")"; 3852 } // Problem: https://github.com/animatedjs/animated/pull/102 3853 // Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662 3854 3855 3856 var stringShapeRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; // Covers rgb, rgba, hsl, hsla 3857 // Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e 3858 3859 var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; // Covers color names (transparent, blue, etc.) 3860 3861 var colorNamesRegex = new RegExp("(" + Object.keys(colors).join('|') + ")", 'g'); 3862 /** 3863 * Supports string shapes by extracting numbers so new values can be computed, 3864 * and recombines those values into new strings of the same shape. Supports 3865 * things like: 3866 * 3867 * rgba(123, 42, 99, 0.36) // colors 3868 * -45deg // values with units 3869 * 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows 3870 */ 3871 3872 var createStringInterpolator = function createStringInterpolator(config) { 3873 // Replace colors with rgba 3874 var outputRange = config.output.map(function (rangeValue) { 3875 return rangeValue.replace(colorRegex, colorToRgba); 3876 }).map(function (rangeValue) { 3877 return rangeValue.replace(colorNamesRegex, colorToRgba); 3878 }); 3879 var outputRanges = outputRange[0].match(stringShapeRegex).map(function () { 3880 return []; 3881 }); 3882 outputRange.forEach(function (value) { 3883 value.match(stringShapeRegex).forEach(function (number, i) { 3884 return outputRanges[i].push(+number); 3885 }); 3886 }); 3887 var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) { 3888 return createInterpolator(_extends({}, config, { 3889 output: outputRanges[i] 3890 })); 3891 }); 3892 return function (input) { 3893 var i = 0; 3894 return outputRange[0] // 'rgba(0, 100, 200, 0)' 3895 // -> 3896 // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...' 3897 .replace(stringShapeRegex, function () { 3898 return interpolations[i++](input); 3899 }) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to 3900 // round the opacity (4th column). 3901 .replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) { 3902 return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")"; 3903 }); 3904 }; 3905 }; 3906 3907 var isUnitlessNumber = { 3908 animationIterationCount: true, 3909 borderImageOutset: true, 3910 borderImageSlice: true, 3911 borderImageWidth: true, 3912 boxFlex: true, 3913 boxFlexGroup: true, 3914 boxOrdinalGroup: true, 3915 columnCount: true, 3916 columns: true, 3917 flex: true, 3918 flexGrow: true, 3919 flexPositive: true, 3920 flexShrink: true, 3921 flexNegative: true, 3922 flexOrder: true, 3923 gridRow: true, 3924 gridRowEnd: true, 3925 gridRowSpan: true, 3926 gridRowStart: true, 3927 gridColumn: true, 3928 gridColumnEnd: true, 3929 gridColumnSpan: true, 3930 gridColumnStart: true, 3931 fontWeight: true, 3932 lineClamp: true, 3933 lineHeight: true, 3934 opacity: true, 3935 order: true, 3936 orphans: true, 3937 tabSize: true, 3938 widows: true, 3939 zIndex: true, 3940 zoom: true, 3941 // SVG-related properties 3942 fillOpacity: true, 3943 floodOpacity: true, 3944 stopOpacity: true, 3945 strokeDasharray: true, 3946 strokeDashoffset: true, 3947 strokeMiterlimit: true, 3948 strokeOpacity: true, 3949 strokeWidth: true 3950 }; 3951 3952 var prefixKey = function prefixKey(prefix, key) { 3953 return prefix + key.charAt(0).toUpperCase() + key.substring(1); 3954 }; 3955 3956 var prefixes = ['Webkit', 'Ms', 'Moz', 'O']; 3957 isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) { 3958 prefixes.forEach(function (prefix) { 3959 return acc[prefixKey(prefix, prop)] = acc[prop]; 3960 }); 3961 return acc; 3962 }, isUnitlessNumber); 3963 3964 function dangerousStyleValue(name, value, isCustomProperty) { 3965 if (value == null || typeof value === 'boolean' || value === '') return ''; 3966 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers 3967 3968 return ('' + value).trim(); 3969 } 3970 3971 var attributeCache = {}; 3972 injectCreateAnimatedStyle(function (style) { 3973 return new AnimatedStyle(style); 3974 }); 3975 injectDefaultElement('div'); 3976 injectStringInterpolator(createStringInterpolator); 3977 injectColorNames(colors); 3978 injectApplyAnimatedValues(function (instance, props) { 3979 if (instance.nodeType && instance.setAttribute !== undefined) { 3980 var style = props.style, 3981 children = props.children, 3982 scrollTop = props.scrollTop, 3983 scrollLeft = props.scrollLeft, 3984 attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]); 3985 3986 var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter'; 3987 if (scrollTop !== void 0) instance.scrollTop = scrollTop; 3988 if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value 3989 3990 if (children !== void 0) instance.textContent = children; // Set styles ... 3991 3992 for (var styleName in style) { 3993 if (!style.hasOwnProperty(styleName)) continue; 3994 var isCustomProperty = styleName.indexOf('--') === 0; 3995 var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty); 3996 if (styleName === 'float') styleName = 'cssFloat'; 3997 if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue; 3998 } // Set attributes ... 3999 4000 4001 for (var name in attributes) { 4002 // Attributes are written in dash case 4003 var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) { 4004 return '-' + n.toLowerCase(); 4005 })); 4006 if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]); 4007 } 4008 4009 return; 4010 } else return false; 4011 }, function (style) { 4012 return style; 4013 }); 4014 4015 var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG 4016 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; 4017 // Extend animated with all the available THREE elements 4018 var apply = merge(createAnimatedComponent, false); 4019 var extendedAnimated = apply(domElements); 4020 4021 exports.apply = apply; 4022 exports.config = config; 4023 exports.update = update; 4024 exports.animated = extendedAnimated; 4025 exports.a = extendedAnimated; 4026 exports.interpolate = interpolate$1; 4027 exports.Globals = Globals; 4028 exports.useSpring = useSpring; 4029 exports.useTrail = useTrail; 4030 exports.useTransition = useTransition; 4031 exports.useChain = useChain; 4032 exports.useSprings = useSprings; 4033 4034 4035 /***/ }), 4036 4037 /***/ "Zss7": 4038 /***/ (function(module, exports, __webpack_require__) { 4039 4040 var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2 4041 // https://github.com/bgrins/TinyColor 4042 // Brian Grinstead, MIT License 4043 4044 (function(Math) { 4045 4046 var trimLeft = /^\s+/, 4047 trimRight = /\s+$/, 4048 tinyCounter = 0, 4049 mathRound = Math.round, 4050 mathMin = Math.min, 4051 mathMax = Math.max, 4052 mathRandom = Math.random; 4053 4054 function tinycolor (color, opts) { 4055 4056 color = (color) ? color : ''; 4057 opts = opts || { }; 4058 4059 // If input is already a tinycolor, return itself 4060 if (color instanceof tinycolor) { 4061 return color; 4062 } 4063 // If we are called as a function, call using new instead 4064 if (!(this instanceof tinycolor)) { 4065 return new tinycolor(color, opts); 4066 } 4067 4068 var rgb = inputToRGB(color); 4069 this._originalInput = color, 4070 this._r = rgb.r, 4071 this._g = rgb.g, 4072 this._b = rgb.b, 4073 this._a = rgb.a, 4074 this._roundA = mathRound(100*this._a) / 100, 4075 this._format = opts.format || rgb.format; 4076 this._gradientType = opts.gradientType; 4077 4078 // Don't let the range of [0,255] come back in [0,1]. 4079 // Potentially lose a little bit of precision here, but will fix issues where 4080 // .5 gets interpreted as half of the total, instead of half of 1 4081 // If it was supposed to be 128, this was already taken care of by `inputToRgb` 4082 if (this._r < 1) { this._r = mathRound(this._r); } 4083 if (this._g < 1) { this._g = mathRound(this._g); } 4084 if (this._b < 1) { this._b = mathRound(this._b); } 4085 4086 this._ok = rgb.ok; 4087 this._tc_id = tinyCounter++; 4088 } 4089 4090 tinycolor.prototype = { 4091 isDark: function() { 4092 return this.getBrightness() < 128; 4093 }, 4094 isLight: function() { 4095 return !this.isDark(); 4096 }, 4097 isValid: function() { 4098 return this._ok; 4099 }, 4100 getOriginalInput: function() { 4101 return this._originalInput; 4102 }, 4103 getFormat: function() { 4104 return this._format; 4105 }, 4106 getAlpha: function() { 4107 return this._a; 4108 }, 4109 getBrightness: function() { 4110 //http://www.w3.org/TR/AERT#color-contrast 4111 var rgb = this.toRgb(); 4112 return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; 4113 }, 4114 getLuminance: function() { 4115 //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef 4116 var rgb = this.toRgb(); 4117 var RsRGB, GsRGB, BsRGB, R, G, B; 4118 RsRGB = rgb.r/255; 4119 GsRGB = rgb.g/255; 4120 BsRGB = rgb.b/255; 4121 4122 if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} 4123 if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} 4124 if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} 4125 return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); 4126 }, 4127 setAlpha: function(value) { 4128 this._a = boundAlpha(value); 4129 this._roundA = mathRound(100*this._a) / 100; 4130 return this; 4131 }, 4132 toHsv: function() { 4133 var hsv = rgbToHsv(this._r, this._g, this._b); 4134 return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; 4135 }, 4136 toHsvString: function() { 4137 var hsv = rgbToHsv(this._r, this._g, this._b); 4138 var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); 4139 return (this._a == 1) ? 4140 "hsv(" + h + ", " + s + "%, " + v + "%)" : 4141 "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; 4142 }, 4143 toHsl: function() { 4144 var hsl = rgbToHsl(this._r, this._g, this._b); 4145 return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; 4146 }, 4147 toHslString: function() { 4148 var hsl = rgbToHsl(this._r, this._g, this._b); 4149 var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); 4150 return (this._a == 1) ? 4151 "hsl(" + h + ", " + s + "%, " + l + "%)" : 4152 "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; 4153 }, 4154 toHex: function(allow3Char) { 4155 return rgbToHex(this._r, this._g, this._b, allow3Char); 4156 }, 4157 toHexString: function(allow3Char) { 4158 return '#' + this.toHex(allow3Char); 4159 }, 4160 toHex8: function(allow4Char) { 4161 return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); 4162 }, 4163 toHex8String: function(allow4Char) { 4164 return '#' + this.toHex8(allow4Char); 4165 }, 4166 toRgb: function() { 4167 return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; 4168 }, 4169 toRgbString: function() { 4170 return (this._a == 1) ? 4171 "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : 4172 "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; 4173 }, 4174 toPercentageRgb: function() { 4175 return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; 4176 }, 4177 toPercentageRgbString: function() { 4178 return (this._a == 1) ? 4179 "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : 4180 "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; 4181 }, 4182 toName: function() { 4183 if (this._a === 0) { 4184 return "transparent"; 4185 } 4186 4187 if (this._a < 1) { 4188 return false; 4189 } 4190 4191 return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; 4192 }, 4193 toFilter: function(secondColor) { 4194 var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); 4195 var secondHex8String = hex8String; 4196 var gradientType = this._gradientType ? "GradientType = 1, " : ""; 4197 4198 if (secondColor) { 4199 var s = tinycolor(secondColor); 4200 secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); 4201 } 4202 4203 return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; 4204 }, 4205 toString: function(format) { 4206 var formatSet = !!format; 4207 format = format || this._format; 4208 4209 var formattedString = false; 4210 var hasAlpha = this._a < 1 && this._a >= 0; 4211 var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); 4212 4213 if (needsAlphaFormat) { 4214 // Special case for "transparent", all other non-alpha formats 4215 // will return rgba when there is transparency. 4216 if (format === "name" && this._a === 0) { 4217 return this.toName(); 4218 } 4219 return this.toRgbString(); 4220 } 4221 if (format === "rgb") { 4222 formattedString = this.toRgbString(); 4223 } 4224 if (format === "prgb") { 4225 formattedString = this.toPercentageRgbString(); 4226 } 4227 if (format === "hex" || format === "hex6") { 4228 formattedString = this.toHexString(); 4229 } 4230 if (format === "hex3") { 4231 formattedString = this.toHexString(true); 4232 } 4233 if (format === "hex4") { 4234 formattedString = this.toHex8String(true); 4235 } 4236 if (format === "hex8") { 4237 formattedString = this.toHex8String(); 4238 } 4239 if (format === "name") { 4240 formattedString = this.toName(); 4241 } 4242 if (format === "hsl") { 4243 formattedString = this.toHslString(); 4244 } 4245 if (format === "hsv") { 4246 formattedString = this.toHsvString(); 4247 } 4248 4249 return formattedString || this.toHexString(); 4250 }, 4251 clone: function() { 4252 return tinycolor(this.toString()); 4253 }, 4254 4255 _applyModification: function(fn, args) { 4256 var color = fn.apply(null, [this].concat([].slice.call(args))); 4257 this._r = color._r; 4258 this._g = color._g; 4259 this._b = color._b; 4260 this.setAlpha(color._a); 4261 return this; 4262 }, 4263 lighten: function() { 4264 return this._applyModification(lighten, arguments); 4265 }, 4266 brighten: function() { 4267 return this._applyModification(brighten, arguments); 4268 }, 4269 darken: function() { 4270 return this._applyModification(darken, arguments); 4271 }, 4272 desaturate: function() { 4273 return this._applyModification(desaturate, arguments); 4274 }, 4275 saturate: function() { 4276 return this._applyModification(saturate, arguments); 4277 }, 4278 greyscale: function() { 4279 return this._applyModification(greyscale, arguments); 4280 }, 4281 spin: function() { 4282 return this._applyModification(spin, arguments); 4283 }, 4284 4285 _applyCombination: function(fn, args) { 4286 return fn.apply(null, [this].concat([].slice.call(args))); 4287 }, 4288 analogous: function() { 4289 return this._applyCombination(analogous, arguments); 4290 }, 4291 complement: function() { 4292 return this._applyCombination(complement, arguments); 4293 }, 4294 monochromatic: function() { 4295 return this._applyCombination(monochromatic, arguments); 4296 }, 4297 splitcomplement: function() { 4298 return this._applyCombination(splitcomplement, arguments); 4299 }, 4300 triad: function() { 4301 return this._applyCombination(triad, arguments); 4302 }, 4303 tetrad: function() { 4304 return this._applyCombination(tetrad, arguments); 4305 } 4306 }; 4307 4308 // If input is an object, force 1 into "1.0" to handle ratios properly 4309 // String input requires "1.0" as input, so 1 will be treated as 1 4310 tinycolor.fromRatio = function(color, opts) { 4311 if (typeof color == "object") { 4312 var newColor = {}; 4313 for (var i in color) { 4314 if (color.hasOwnProperty(i)) { 4315 if (i === "a") { 4316 newColor[i] = color[i]; 4317 } 4318 else { 4319 newColor[i] = convertToPercentage(color[i]); 4320 } 4321 } 4322 } 4323 color = newColor; 4324 } 4325 4326 return tinycolor(color, opts); 4327 }; 4328 4329 // Given a string or object, convert that input to RGB 4330 // Possible string inputs: 4331 // 4332 // "red" 4333 // "#f00" or "f00" 4334 // "#ff0000" or "ff0000" 4335 // "#ff000000" or "ff000000" 4336 // "rgb 255 0 0" or "rgb (255, 0, 0)" 4337 // "rgb 1.0 0 0" or "rgb (1, 0, 0)" 4338 // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" 4339 // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" 4340 // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" 4341 // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" 4342 // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" 4343 // 4344 function inputToRGB(color) { 4345 4346 var rgb = { r: 0, g: 0, b: 0 }; 4347 var a = 1; 4348 var s = null; 4349 var v = null; 4350 var l = null; 4351 var ok = false; 4352 var format = false; 4353 4354 if (typeof color == "string") { 4355 color = stringInputToObject(color); 4356 } 4357 4358 if (typeof color == "object") { 4359 if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { 4360 rgb = rgbToRgb(color.r, color.g, color.b); 4361 ok = true; 4362 format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; 4363 } 4364 else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { 4365 s = convertToPercentage(color.s); 4366 v = convertToPercentage(color.v); 4367 rgb = hsvToRgb(color.h, s, v); 4368 ok = true; 4369 format = "hsv"; 4370 } 4371 else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { 4372 s = convertToPercentage(color.s); 4373 l = convertToPercentage(color.l); 4374 rgb = hslToRgb(color.h, s, l); 4375 ok = true; 4376 format = "hsl"; 4377 } 4378 4379 if (color.hasOwnProperty("a")) { 4380 a = color.a; 4381 } 4382 } 4383 4384 a = boundAlpha(a); 4385 4386 return { 4387 ok: ok, 4388 format: color.format || format, 4389 r: mathMin(255, mathMax(rgb.r, 0)), 4390 g: mathMin(255, mathMax(rgb.g, 0)), 4391 b: mathMin(255, mathMax(rgb.b, 0)), 4392 a: a 4393 }; 4394 } 4395 4396 4397 // Conversion Functions 4398 // -------------------- 4399 4400 // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: 4401 // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript> 4402 4403 // `rgbToRgb` 4404 // Handle bounds / percentage checking to conform to CSS color spec 4405 // <http://www.w3.org/TR/css3-color/> 4406 // *Assumes:* r, g, b in [0, 255] or [0, 1] 4407 // *Returns:* { r, g, b } in [0, 255] 4408 function rgbToRgb(r, g, b){ 4409 return { 4410 r: bound01(r, 255) * 255, 4411 g: bound01(g, 255) * 255, 4412 b: bound01(b, 255) * 255 4413 }; 4414 } 4415 4416 // `rgbToHsl` 4417 // Converts an RGB color value to HSL. 4418 // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] 4419 // *Returns:* { h, s, l } in [0,1] 4420 function rgbToHsl(r, g, b) { 4421 4422 r = bound01(r, 255); 4423 g = bound01(g, 255); 4424 b = bound01(b, 255); 4425 4426 var max = mathMax(r, g, b), min = mathMin(r, g, b); 4427 var h, s, l = (max + min) / 2; 4428 4429 if(max == min) { 4430 h = s = 0; // achromatic 4431 } 4432 else { 4433 var d = max - min; 4434 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 4435 switch(max) { 4436 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 4437 case g: h = (b - r) / d + 2; break; 4438 case b: h = (r - g) / d + 4; break; 4439 } 4440 4441 h /= 6; 4442 } 4443 4444 return { h: h, s: s, l: l }; 4445 } 4446 4447 // `hslToRgb` 4448 // Converts an HSL color value to RGB. 4449 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] 4450 // *Returns:* { r, g, b } in the set [0, 255] 4451 function hslToRgb(h, s, l) { 4452 var r, g, b; 4453 4454 h = bound01(h, 360); 4455 s = bound01(s, 100); 4456 l = bound01(l, 100); 4457 4458 function hue2rgb(p, q, t) { 4459 if(t < 0) t += 1; 4460 if(t > 1) t -= 1; 4461 if(t < 1/6) return p + (q - p) * 6 * t; 4462 if(t < 1/2) return q; 4463 if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 4464 return p; 4465 } 4466 4467 if(s === 0) { 4468 r = g = b = l; // achromatic 4469 } 4470 else { 4471 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 4472 var p = 2 * l - q; 4473 r = hue2rgb(p, q, h + 1/3); 4474 g = hue2rgb(p, q, h); 4475 b = hue2rgb(p, q, h - 1/3); 4476 } 4477 4478 return { r: r * 255, g: g * 255, b: b * 255 }; 4479 } 4480 4481 // `rgbToHsv` 4482 // Converts an RGB color value to HSV 4483 // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] 4484 // *Returns:* { h, s, v } in [0,1] 4485 function rgbToHsv(r, g, b) { 4486 4487 r = bound01(r, 255); 4488 g = bound01(g, 255); 4489 b = bound01(b, 255); 4490 4491 var max = mathMax(r, g, b), min = mathMin(r, g, b); 4492 var h, s, v = max; 4493 4494 var d = max - min; 4495 s = max === 0 ? 0 : d / max; 4496 4497 if(max == min) { 4498 h = 0; // achromatic 4499 } 4500 else { 4501 switch(max) { 4502 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 4503 case g: h = (b - r) / d + 2; break; 4504 case b: h = (r - g) / d + 4; break; 4505 } 4506 h /= 6; 4507 } 4508 return { h: h, s: s, v: v }; 4509 } 4510 4511 // `hsvToRgb` 4512 // Converts an HSV color value to RGB. 4513 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] 4514 // *Returns:* { r, g, b } in the set [0, 255] 4515 function hsvToRgb(h, s, v) { 4516 4517 h = bound01(h, 360) * 6; 4518 s = bound01(s, 100); 4519 v = bound01(v, 100); 4520 4521 var i = Math.floor(h), 4522 f = h - i, 4523 p = v * (1 - s), 4524 q = v * (1 - f * s), 4525 t = v * (1 - (1 - f) * s), 4526 mod = i % 6, 4527 r = [v, q, p, p, t, v][mod], 4528 g = [t, v, v, q, p, p][mod], 4529 b = [p, p, t, v, v, q][mod]; 4530 4531 return { r: r * 255, g: g * 255, b: b * 255 }; 4532 } 4533 4534 // `rgbToHex` 4535 // Converts an RGB color to hex 4536 // Assumes r, g, and b are contained in the set [0, 255] 4537 // Returns a 3 or 6 character hex 4538 function rgbToHex(r, g, b, allow3Char) { 4539 4540 var hex = [ 4541 pad2(mathRound(r).toString(16)), 4542 pad2(mathRound(g).toString(16)), 4543 pad2(mathRound(b).toString(16)) 4544 ]; 4545 4546 // Return a 3 character hex if possible 4547 if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { 4548 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); 4549 } 4550 4551 return hex.join(""); 4552 } 4553 4554 // `rgbaToHex` 4555 // Converts an RGBA color plus alpha transparency to hex 4556 // Assumes r, g, b are contained in the set [0, 255] and 4557 // a in [0, 1]. Returns a 4 or 8 character rgba hex 4558 function rgbaToHex(r, g, b, a, allow4Char) { 4559 4560 var hex = [ 4561 pad2(mathRound(r).toString(16)), 4562 pad2(mathRound(g).toString(16)), 4563 pad2(mathRound(b).toString(16)), 4564 pad2(convertDecimalToHex(a)) 4565 ]; 4566 4567 // Return a 4 character hex if possible 4568 if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { 4569 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); 4570 } 4571 4572 return hex.join(""); 4573 } 4574 4575 // `rgbaToArgbHex` 4576 // Converts an RGBA color to an ARGB Hex8 string 4577 // Rarely used, but required for "toFilter()" 4578 function rgbaToArgbHex(r, g, b, a) { 4579 4580 var hex = [ 4581 pad2(convertDecimalToHex(a)), 4582 pad2(mathRound(r).toString(16)), 4583 pad2(mathRound(g).toString(16)), 4584 pad2(mathRound(b).toString(16)) 4585 ]; 4586 4587 return hex.join(""); 4588 } 4589 4590 // `equals` 4591 // Can be called with any tinycolor input 4592 tinycolor.equals = function (color1, color2) { 4593 if (!color1 || !color2) { return false; } 4594 return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); 4595 }; 4596 4597 tinycolor.random = function() { 4598 return tinycolor.fromRatio({ 4599 r: mathRandom(), 4600 g: mathRandom(), 4601 b: mathRandom() 4602 }); 4603 }; 4604 4605 4606 // Modification Functions 4607 // ---------------------- 4608 // Thanks to less.js for some of the basics here 4609 // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js> 4610 4611 function desaturate(color, amount) { 4612 amount = (amount === 0) ? 0 : (amount || 10); 4613 var hsl = tinycolor(color).toHsl(); 4614 hsl.s -= amount / 100; 4615 hsl.s = clamp01(hsl.s); 4616 return tinycolor(hsl); 4617 } 4618 4619 function saturate(color, amount) { 4620 amount = (amount === 0) ? 0 : (amount || 10); 4621 var hsl = tinycolor(color).toHsl(); 4622 hsl.s += amount / 100; 4623 hsl.s = clamp01(hsl.s); 4624 return tinycolor(hsl); 4625 } 4626 4627 function greyscale(color) { 4628 return tinycolor(color).desaturate(100); 4629 } 4630 4631 function lighten (color, amount) { 4632 amount = (amount === 0) ? 0 : (amount || 10); 4633 var hsl = tinycolor(color).toHsl(); 4634 hsl.l += amount / 100; 4635 hsl.l = clamp01(hsl.l); 4636 return tinycolor(hsl); 4637 } 4638 4639 function brighten(color, amount) { 4640 amount = (amount === 0) ? 0 : (amount || 10); 4641 var rgb = tinycolor(color).toRgb(); 4642 rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); 4643 rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); 4644 rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); 4645 return tinycolor(rgb); 4646 } 4647 4648 function darken (color, amount) { 4649 amount = (amount === 0) ? 0 : (amount || 10); 4650 var hsl = tinycolor(color).toHsl(); 4651 hsl.l -= amount / 100; 4652 hsl.l = clamp01(hsl.l); 4653 return tinycolor(hsl); 4654 } 4655 4656 // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. 4657 // Values outside of this range will be wrapped into this range. 4658 function spin(color, amount) { 4659 var hsl = tinycolor(color).toHsl(); 4660 var hue = (hsl.h + amount) % 360; 4661 hsl.h = hue < 0 ? 360 + hue : hue; 4662 return tinycolor(hsl); 4663 } 4664 4665 // Combination Functions 4666 // --------------------- 4667 // Thanks to jQuery xColor for some of the ideas behind these 4668 // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js> 4669 4670 function complement(color) { 4671 var hsl = tinycolor(color).toHsl(); 4672 hsl.h = (hsl.h + 180) % 360; 4673 return tinycolor(hsl); 4674 } 4675 4676 function triad(color) { 4677 var hsl = tinycolor(color).toHsl(); 4678 var h = hsl.h; 4679 return [ 4680 tinycolor(color), 4681 tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), 4682 tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) 4683 ]; 4684 } 4685 4686 function tetrad(color) { 4687 var hsl = tinycolor(color).toHsl(); 4688 var h = hsl.h; 4689 return [ 4690 tinycolor(color), 4691 tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), 4692 tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), 4693 tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) 4694 ]; 4695 } 4696 4697 function splitcomplement(color) { 4698 var hsl = tinycolor(color).toHsl(); 4699 var h = hsl.h; 4700 return [ 4701 tinycolor(color), 4702 tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), 4703 tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) 4704 ]; 4705 } 4706 4707 function analogous(color, results, slices) { 4708 results = results || 6; 4709 slices = slices || 30; 4710 4711 var hsl = tinycolor(color).toHsl(); 4712 var part = 360 / slices; 4713 var ret = [tinycolor(color)]; 4714 4715 for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { 4716 hsl.h = (hsl.h + part) % 360; 4717 ret.push(tinycolor(hsl)); 4718 } 4719 return ret; 4720 } 4721 4722 function monochromatic(color, results) { 4723 results = results || 6; 4724 var hsv = tinycolor(color).toHsv(); 4725 var h = hsv.h, s = hsv.s, v = hsv.v; 4726 var ret = []; 4727 var modification = 1 / results; 4728 4729 while (results--) { 4730 ret.push(tinycolor({ h: h, s: s, v: v})); 4731 v = (v + modification) % 1; 4732 } 4733 4734 return ret; 4735 } 4736 4737 // Utility Functions 4738 // --------------------- 4739 4740 tinycolor.mix = function(color1, color2, amount) { 4741 amount = (amount === 0) ? 0 : (amount || 50); 4742 4743 var rgb1 = tinycolor(color1).toRgb(); 4744 var rgb2 = tinycolor(color2).toRgb(); 4745 4746 var p = amount / 100; 4747 4748 var rgba = { 4749 r: ((rgb2.r - rgb1.r) * p) + rgb1.r, 4750 g: ((rgb2.g - rgb1.g) * p) + rgb1.g, 4751 b: ((rgb2.b - rgb1.b) * p) + rgb1.b, 4752 a: ((rgb2.a - rgb1.a) * p) + rgb1.a 4753 }; 4754 4755 return tinycolor(rgba); 4756 }; 4757 4758 4759 // Readability Functions 4760 // --------------------- 4761 // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2) 4762 4763 // `contrast` 4764 // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2) 4765 tinycolor.readability = function(color1, color2) { 4766 var c1 = tinycolor(color1); 4767 var c2 = tinycolor(color2); 4768 return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05); 4769 }; 4770 4771 // `isReadable` 4772 // Ensure that foreground and background color combinations meet WCAG2 guidelines. 4773 // The third argument is an optional Object. 4774 // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; 4775 // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. 4776 // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}. 4777 4778 // *Example* 4779 // tinycolor.isReadable("#000", "#111") => false 4780 // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false 4781 tinycolor.isReadable = function(color1, color2, wcag2) { 4782 var readability = tinycolor.readability(color1, color2); 4783 var wcag2Parms, out; 4784 4785 out = false; 4786 4787 wcag2Parms = validateWCAG2Parms(wcag2); 4788 switch (wcag2Parms.level + wcag2Parms.size) { 4789 case "AAsmall": 4790 case "AAAlarge": 4791 out = readability >= 4.5; 4792 break; 4793 case "AAlarge": 4794 out = readability >= 3; 4795 break; 4796 case "AAAsmall": 4797 out = readability >= 7; 4798 break; 4799 } 4800 return out; 4801 4802 }; 4803 4804 // `mostReadable` 4805 // Given a base color and a list of possible foreground or background 4806 // colors for that base, returns the most readable color. 4807 // Optionally returns Black or White if the most readable color is unreadable. 4808 // *Example* 4809 // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" 4810 // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" 4811 // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" 4812 // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" 4813 tinycolor.mostReadable = function(baseColor, colorList, args) { 4814 var bestColor = null; 4815 var bestScore = 0; 4816 var readability; 4817 var includeFallbackColors, level, size ; 4818 args = args || {}; 4819 includeFallbackColors = args.includeFallbackColors ; 4820 level = args.level; 4821 size = args.size; 4822 4823 for (var i= 0; i < colorList.length ; i++) { 4824 readability = tinycolor.readability(baseColor, colorList[i]); 4825 if (readability > bestScore) { 4826 bestScore = readability; 4827 bestColor = tinycolor(colorList[i]); 4828 } 4829 } 4830 4831 if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { 4832 return bestColor; 4833 } 4834 else { 4835 args.includeFallbackColors=false; 4836 return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); 4837 } 4838 }; 4839 4840 4841 // Big List of Colors 4842 // ------------------ 4843 // <http://www.w3.org/TR/css3-color/#svg-color> 4844 var names = tinycolor.names = { 4845 aliceblue: "f0f8ff", 4846 antiquewhite: "faebd7", 4847 aqua: "0ff", 4848 aquamarine: "7fffd4", 4849 azure: "f0ffff", 4850 beige: "f5f5dc", 4851 bisque: "ffe4c4", 4852 black: "000", 4853 blanchedalmond: "ffebcd", 4854 blue: "00f", 4855 blueviolet: "8a2be2", 4856 brown: "a52a2a", 4857 burlywood: "deb887", 4858 burntsienna: "ea7e5d", 4859 cadetblue: "5f9ea0", 4860 chartreuse: "7fff00", 4861 chocolate: "d2691e", 4862 coral: "ff7f50", 4863 cornflowerblue: "6495ed", 4864 cornsilk: "fff8dc", 4865 crimson: "dc143c", 4866 cyan: "0ff", 4867 darkblue: "00008b", 4868 darkcyan: "008b8b", 4869 darkgoldenrod: "b8860b", 4870 darkgray: "a9a9a9", 4871 darkgreen: "006400", 4872 darkgrey: "a9a9a9", 4873 darkkhaki: "bdb76b", 4874 darkmagenta: "8b008b", 4875 darkolivegreen: "556b2f", 4876 darkorange: "ff8c00", 4877 darkorchid: "9932cc", 4878 darkred: "8b0000", 4879 darksalmon: "e9967a", 4880 darkseagreen: "8fbc8f", 4881 darkslateblue: "483d8b", 4882 darkslategray: "2f4f4f", 4883 darkslategrey: "2f4f4f", 4884 darkturquoise: "00ced1", 4885 darkviolet: "9400d3", 4886 deeppink: "ff1493", 4887 deepskyblue: "00bfff", 4888 dimgray: "696969", 4889 dimgrey: "696969", 4890 dodgerblue: "1e90ff", 4891 firebrick: "b22222", 4892 floralwhite: "fffaf0", 4893 forestgreen: "228b22", 4894 fuchsia: "f0f", 4895 gainsboro: "dcdcdc", 4896 ghostwhite: "f8f8ff", 4897 gold: "ffd700", 4898 goldenrod: "daa520", 4899 gray: "808080", 4900 green: "008000", 4901 greenyellow: "adff2f", 4902 grey: "808080", 4903 honeydew: "f0fff0", 4904 hotpink: "ff69b4", 4905 indianred: "cd5c5c", 4906 indigo: "4b0082", 4907 ivory: "fffff0", 4908 khaki: "f0e68c", 4909 lavender: "e6e6fa", 4910 lavenderblush: "fff0f5", 4911 lawngreen: "7cfc00", 4912 lemonchiffon: "fffacd", 4913 lightblue: "add8e6", 4914 lightcoral: "f08080", 4915 lightcyan: "e0ffff", 4916 lightgoldenrodyellow: "fafad2", 4917 lightgray: "d3d3d3", 4918 lightgreen: "90ee90", 4919 lightgrey: "d3d3d3", 4920 lightpink: "ffb6c1", 4921 lightsalmon: "ffa07a", 4922 lightseagreen: "20b2aa", 4923 lightskyblue: "87cefa", 4924 lightslategray: "789", 4925 lightslategrey: "789", 4926 lightsteelblue: "b0c4de", 4927 lightyellow: "ffffe0", 4928 lime: "0f0", 4929 limegreen: "32cd32", 4930 linen: "faf0e6", 4931 magenta: "f0f", 4932 maroon: "800000", 4933 mediumaquamarine: "66cdaa", 4934 mediumblue: "0000cd", 4935 mediumorchid: "ba55d3", 4936 mediumpurple: "9370db", 4937 mediumseagreen: "3cb371", 4938 mediumslateblue: "7b68ee", 4939 mediumspringgreen: "00fa9a", 4940 mediumturquoise: "48d1cc", 4941 mediumvioletred: "c71585", 4942 midnightblue: "191970", 4943 mintcream: "f5fffa", 4944 mistyrose: "ffe4e1", 4945 moccasin: "ffe4b5", 4946 navajowhite: "ffdead", 4947 navy: "000080", 4948 oldlace: "fdf5e6", 4949 olive: "808000", 4950 olivedrab: "6b8e23", 4951 orange: "ffa500", 4952 orangered: "ff4500", 4953 orchid: "da70d6", 4954 palegoldenrod: "eee8aa", 4955 palegreen: "98fb98", 4956 paleturquoise: "afeeee", 4957 palevioletred: "db7093", 4958 papayawhip: "ffefd5", 4959 peachpuff: "ffdab9", 4960 peru: "cd853f", 4961 pink: "ffc0cb", 4962 plum: "dda0dd", 4963 powderblue: "b0e0e6", 4964 purple: "800080", 4965 rebeccapurple: "663399", 4966 red: "f00", 4967 rosybrown: "bc8f8f", 4968 royalblue: "4169e1", 4969 saddlebrown: "8b4513", 4970 salmon: "fa8072", 4971 sandybrown: "f4a460", 4972 seagreen: "2e8b57", 4973 seashell: "fff5ee", 4974 sienna: "a0522d", 4975 silver: "c0c0c0", 4976 skyblue: "87ceeb", 4977 slateblue: "6a5acd", 4978 slategray: "708090", 4979 slategrey: "708090", 4980 snow: "fffafa", 4981 springgreen: "00ff7f", 4982 steelblue: "4682b4", 4983 tan: "d2b48c", 4984 teal: "008080", 4985 thistle: "d8bfd8", 4986 tomato: "ff6347", 4987 turquoise: "40e0d0", 4988 violet: "ee82ee", 4989 wheat: "f5deb3", 4990 white: "fff", 4991 whitesmoke: "f5f5f5", 4992 yellow: "ff0", 4993 yellowgreen: "9acd32" 4994 }; 4995 4996 // Make it easy to access colors via `hexNames[hex]` 4997 var hexNames = tinycolor.hexNames = flip(names); 4998 4999 5000 // Utilities 5001 // --------- 5002 5003 // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` 5004 function flip(o) { 5005 var flipped = { }; 5006 for (var i in o) { 5007 if (o.hasOwnProperty(i)) { 5008 flipped[o[i]] = i; 5009 } 5010 } 5011 return flipped; 5012 } 5013 5014 // Return a valid alpha value [0,1] with all invalid values being set to 1 5015 function boundAlpha(a) { 5016 a = parseFloat(a); 5017 5018 if (isNaN(a) || a < 0 || a > 1) { 5019 a = 1; 5020 } 5021 5022 return a; 5023 } 5024 5025 // Take input from [0, n] and return it as [0, 1] 5026 function bound01(n, max) { 5027 if (isOnePointZero(n)) { n = "100%"; } 5028 5029 var processPercent = isPercentage(n); 5030 n = mathMin(max, mathMax(0, parseFloat(n))); 5031 5032 // Automatically convert percentage into number 5033 if (processPercent) { 5034 n = parseInt(n * max, 10) / 100; 5035 } 5036 5037 // Handle floating point rounding errors 5038 if ((Math.abs(n - max) < 0.000001)) { 5039 return 1; 5040 } 5041 5042 // Convert into [0, 1] range if it isn't already 5043 return (n % max) / parseFloat(max); 5044 } 5045 5046 // Force a number between 0 and 1 5047 function clamp01(val) { 5048 return mathMin(1, mathMax(0, val)); 5049 } 5050 5051 // Parse a base-16 hex value into a base-10 integer 5052 function parseIntFromHex(val) { 5053 return parseInt(val, 16); 5054 } 5055 5056 // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 5057 // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0> 5058 function isOnePointZero(n) { 5059 return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; 5060 } 5061 5062 // Check to see if string passed in is a percentage 5063 function isPercentage(n) { 5064 return typeof n === "string" && n.indexOf('%') != -1; 5065 } 5066 5067 // Force a hex value to have 2 characters 5068 function pad2(c) { 5069 return c.length == 1 ? '0' + c : '' + c; 5070 } 5071 5072 // Replace a decimal with it's percentage value 5073 function convertToPercentage(n) { 5074 if (n <= 1) { 5075 n = (n * 100) + "%"; 5076 } 5077 5078 return n; 5079 } 5080 5081 // Converts a decimal to a hex value 5082 function convertDecimalToHex(d) { 5083 return Math.round(parseFloat(d) * 255).toString(16); 5084 } 5085 // Converts a hex value to a decimal 5086 function convertHexToDecimal(h) { 5087 return (parseIntFromHex(h) / 255); 5088 } 5089 5090 var matchers = (function() { 5091 5092 // <http://www.w3.org/TR/css3-values/#integers> 5093 var CSS_INTEGER = "[-\\+]?\\d+%?"; 5094 5095 // <http://www.w3.org/TR/css3-values/#number-value> 5096 var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; 5097 5098 // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. 5099 var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; 5100 5101 // Actual matching. 5102 // Parentheses and commas are optional, but not required. 5103 // Whitespace can take the place of commas or opening paren 5104 var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 5105 var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 5106 5107 return { 5108 CSS_UNIT: new RegExp(CSS_UNIT), 5109 rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), 5110 rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), 5111 hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), 5112 hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), 5113 hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), 5114 hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), 5115 hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 5116 hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 5117 hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 5118 hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ 5119 }; 5120 })(); 5121 5122 // `isValidCSSUnit` 5123 // Take in a single string / number and check to see if it looks like a CSS unit 5124 // (see `matchers` above for definition). 5125 function isValidCSSUnit(color) { 5126 return !!matchers.CSS_UNIT.exec(color); 5127 } 5128 5129 // `stringInputToObject` 5130 // Permissive string parsing. Take in a number of formats, and output an object 5131 // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` 5132 function stringInputToObject(color) { 5133 5134 color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); 5135 var named = false; 5136 if (names[color]) { 5137 color = names[color]; 5138 named = true; 5139 } 5140 else if (color == 'transparent') { 5141 return { r: 0, g: 0, b: 0, a: 0, format: "name" }; 5142 } 5143 5144 // Try to match string input using regular expressions. 5145 // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] 5146 // Just return an object and let the conversion functions handle that. 5147 // This way the result will be the same whether the tinycolor is initialized with string or object. 5148 var match; 5149 if ((match = matchers.rgb.exec(color))) { 5150 return { r: match[1], g: match[2], b: match[3] }; 5151 } 5152 if ((match = matchers.rgba.exec(color))) { 5153 return { r: match[1], g: match[2], b: match[3], a: match[4] }; 5154 } 5155 if ((match = matchers.hsl.exec(color))) { 5156 return { h: match[1], s: match[2], l: match[3] }; 5157 } 5158 if ((match = matchers.hsla.exec(color))) { 5159 return { h: match[1], s: match[2], l: match[3], a: match[4] }; 5160 } 5161 if ((match = matchers.hsv.exec(color))) { 5162 return { h: match[1], s: match[2], v: match[3] }; 5163 } 5164 if ((match = matchers.hsva.exec(color))) { 5165 return { h: match[1], s: match[2], v: match[3], a: match[4] }; 5166 } 5167 if ((match = matchers.hex8.exec(color))) { 5168 return { 5169 r: parseIntFromHex(match[1]), 5170 g: parseIntFromHex(match[2]), 5171 b: parseIntFromHex(match[3]), 5172 a: convertHexToDecimal(match[4]), 5173 format: named ? "name" : "hex8" 5174 }; 5175 } 5176 if ((match = matchers.hex6.exec(color))) { 5177 return { 5178 r: parseIntFromHex(match[1]), 5179 g: parseIntFromHex(match[2]), 5180 b: parseIntFromHex(match[3]), 5181 format: named ? "name" : "hex" 5182 }; 5183 } 5184 if ((match = matchers.hex4.exec(color))) { 5185 return { 5186 r: parseIntFromHex(match[1] + '' + match[1]), 5187 g: parseIntFromHex(match[2] + '' + match[2]), 5188 b: parseIntFromHex(match[3] + '' + match[3]), 5189 a: convertHexToDecimal(match[4] + '' + match[4]), 5190 format: named ? "name" : "hex8" 5191 }; 5192 } 5193 if ((match = matchers.hex3.exec(color))) { 5194 return { 5195 r: parseIntFromHex(match[1] + '' + match[1]), 5196 g: parseIntFromHex(match[2] + '' + match[2]), 5197 b: parseIntFromHex(match[3] + '' + match[3]), 5198 format: named ? "name" : "hex" 5199 }; 5200 } 5201 5202 return false; 5203 } 5204 5205 function validateWCAG2Parms(parms) { 5206 // return valid WCAG2 parms for isReadable. 5207 // If input parms are invalid, return {"level":"AA", "size":"small"} 5208 var level, size; 5209 parms = parms || {"level":"AA", "size":"small"}; 5210 level = (parms.level || "AA").toUpperCase(); 5211 size = (parms.size || "small").toLowerCase(); 5212 if (level !== "AA" && level !== "AAA") { 5213 level = "AA"; 5214 } 5215 if (size !== "small" && size !== "large") { 5216 size = "small"; 5217 } 5218 return {"level":level, "size":size}; 5219 } 5220 5221 // Node: Export function 5222 if ( true && module.exports) { 5223 module.exports = tinycolor; 5224 } 5225 // AMD/requirejs: Define the module 5226 else if (true) { 5227 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module), 5228 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 5229 } 5230 // Browser: Expose to window 5231 else {} 5232 5233 })(Math); 5234 5235 5236 /***/ }), 5237 5238 /***/ "b2RC": 5239 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5240 5241 "use strict"; 5242 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5243 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5244 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 5245 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 5246 5247 5248 /** 5249 * WordPress dependencies 5250 */ 5251 5252 const grid = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 5253 xmlns: "http://www.w3.org/2000/svg", 5254 viewBox: "0 0 24 24" 5255 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 5256 d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z", 5257 fillRule: "evenodd", 5258 clipRule: "evenodd" 5259 })); 5260 /* harmony default export */ __webpack_exports__["a"] = (grid); 5261 5262 5263 /***/ }), 5264 5265 /***/ "bWcr": 5266 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5267 5268 "use strict"; 5269 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5270 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5271 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 5272 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 5273 5274 5275 /** 5276 * WordPress dependencies 5277 */ 5278 5279 const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 5280 xmlns: "http://www.w3.org/2000/svg", 5281 viewBox: "0 0 24 24" 5282 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 5283 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" 5284 })); 5285 /* harmony default export */ __webpack_exports__["a"] = (closeSmall); 5286 5287 5288 /***/ }), 5289 5290 /***/ "btIw": 5291 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5292 5293 "use strict"; 5294 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5295 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5296 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 5297 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 5298 5299 5300 /** 5301 * WordPress dependencies 5302 */ 5303 5304 const keyboardReturn = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 5305 xmlns: "http://www.w3.org/2000/svg", 5306 viewBox: "-2 -2 24 24" 5307 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 5308 d: "M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z" 5309 })); 5310 /* harmony default export */ __webpack_exports__["a"] = (keyboardReturn); 5311 5312 5313 /***/ }), 5314 5315 /***/ "cDcd": 5316 /***/ (function(module, exports) { 5317 5318 (function() { module.exports = window["React"]; }()); 5319 5320 /***/ }), 5321 5322 /***/ "cGtP": 5323 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5324 5325 "use strict"; 5326 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5327 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5328 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 5329 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 5330 5331 5332 /** 5333 * WordPress dependencies 5334 */ 5335 5336 const search = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 5337 xmlns: "http://www.w3.org/2000/svg", 5338 viewBox: "0 0 24 24" 5339 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 5340 d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" 5341 })); 5342 /* harmony default export */ __webpack_exports__["a"] = (search); 5343 5344 5345 /***/ }), 5346 5347 /***/ "cjQ8": 5348 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5349 5350 "use strict"; 5351 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5352 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5353 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 5354 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 5355 5356 5357 /** 5358 * WordPress dependencies 5359 */ 5360 5361 const arrowLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 5362 xmlns: "http://www.w3.org/2000/svg", 5363 viewBox: "0 0 24 24" 5364 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 5365 d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z" 5366 })); 5367 /* harmony default export */ __webpack_exports__["a"] = (arrowLeft); 5368 5369 5370 /***/ }), 5371 5372 /***/ "eGrx": 5373 /***/ (function(module, exports) { 5374 5375 var traverse = module.exports = function (obj) { 5376 return new Traverse(obj); 5377 }; 5378 5379 function Traverse (obj) { 5380 this.value = obj; 5381 } 5382 5383 Traverse.prototype.get = function (ps) { 5384 var node = this.value; 5385 for (var i = 0; i < ps.length; i ++) { 5386 var key = ps[i]; 5387 if (!node || !hasOwnProperty.call(node, key)) { 5388 node = undefined; 5389 break; 5390 } 5391 node = node[key]; 5392 } 5393 return node; 5394 }; 5395 5396 Traverse.prototype.has = function (ps) { 5397 var node = this.value; 5398 for (var i = 0; i < ps.length; i ++) { 5399 var key = ps[i]; 5400 if (!node || !hasOwnProperty.call(node, key)) { 5401 return false; 5402 } 5403 node = node[key]; 5404 } 5405 return true; 5406 }; 5407 5408 Traverse.prototype.set = function (ps, value) { 5409 var node = this.value; 5410 for (var i = 0; i < ps.length - 1; i ++) { 5411 var key = ps[i]; 5412 if (!hasOwnProperty.call(node, key)) node[key] = {}; 5413 node = node[key]; 5414 } 5415 node[ps[i]] = value; 5416 return value; 5417 }; 5418 5419 Traverse.prototype.map = function (cb) { 5420 return walk(this.value, cb, true); 5421 }; 5422 5423 Traverse.prototype.forEach = function (cb) { 5424 this.value = walk(this.value, cb, false); 5425 return this.value; 5426 }; 5427 5428 Traverse.prototype.reduce = function (cb, init) { 5429 var skip = arguments.length === 1; 5430 var acc = skip ? this.value : init; 5431 this.forEach(function (x) { 5432 if (!this.isRoot || !skip) { 5433 acc = cb.call(this, acc, x); 5434 } 5435 }); 5436 return acc; 5437 }; 5438 5439 Traverse.prototype.paths = function () { 5440 var acc = []; 5441 this.forEach(function (x) { 5442 acc.push(this.path); 5443 }); 5444 return acc; 5445 }; 5446 5447 Traverse.prototype.nodes = function () { 5448 var acc = []; 5449 this.forEach(function (x) { 5450 acc.push(this.node); 5451 }); 5452 return acc; 5453 }; 5454 5455 Traverse.prototype.clone = function () { 5456 var parents = [], nodes = []; 5457 5458 return (function clone (src) { 5459 for (var i = 0; i < parents.length; i++) { 5460 if (parents[i] === src) { 5461 return nodes[i]; 5462 } 5463 } 5464 5465 if (typeof src === 'object' && src !== null) { 5466 var dst = copy(src); 5467 5468 parents.push(src); 5469 nodes.push(dst); 5470 5471 forEach(objectKeys(src), function (key) { 5472 dst[key] = clone(src[key]); 5473 }); 5474 5475 parents.pop(); 5476 nodes.pop(); 5477 return dst; 5478 } 5479 else { 5480 return src; 5481 } 5482 })(this.value); 5483 }; 5484 5485 function walk (root, cb, immutable) { 5486 var path = []; 5487 var parents = []; 5488 var alive = true; 5489 5490 return (function walker (node_) { 5491 var node = immutable ? copy(node_) : node_; 5492 var modifiers = {}; 5493 5494 var keepGoing = true; 5495 5496 var state = { 5497 node : node, 5498 node_ : node_, 5499 path : [].concat(path), 5500 parent : parents[parents.length - 1], 5501 parents : parents, 5502 key : path.slice(-1)[0], 5503 isRoot : path.length === 0, 5504 level : path.length, 5505 circular : null, 5506 update : function (x, stopHere) { 5507 if (!state.isRoot) { 5508 state.parent.node[state.key] = x; 5509 } 5510 state.node = x; 5511 if (stopHere) keepGoing = false; 5512 }, 5513 'delete' : function (stopHere) { 5514 delete state.parent.node[state.key]; 5515 if (stopHere) keepGoing = false; 5516 }, 5517 remove : function (stopHere) { 5518 if (isArray(state.parent.node)) { 5519 state.parent.node.splice(state.key, 1); 5520 } 5521 else { 5522 delete state.parent.node[state.key]; 5523 } 5524 if (stopHere) keepGoing = false; 5525 }, 5526 keys : null, 5527 before : function (f) { modifiers.before = f }, 5528 after : function (f) { modifiers.after = f }, 5529 pre : function (f) { modifiers.pre = f }, 5530 post : function (f) { modifiers.post = f }, 5531 stop : function () { alive = false }, 5532 block : function () { keepGoing = false } 5533 }; 5534 5535 if (!alive) return state; 5536 5537 function updateState() { 5538 if (typeof state.node === 'object' && state.node !== null) { 5539 if (!state.keys || state.node_ !== state.node) { 5540 state.keys = objectKeys(state.node) 5541 } 5542 5543 state.isLeaf = state.keys.length == 0; 5544 5545 for (var i = 0; i < parents.length; i++) { 5546 if (parents[i].node_ === node_) { 5547 state.circular = parents[i]; 5548 break; 5549 } 5550 } 5551 } 5552 else { 5553 state.isLeaf = true; 5554 state.keys = null; 5555 } 5556 5557 state.notLeaf = !state.isLeaf; 5558 state.notRoot = !state.isRoot; 5559 } 5560 5561 updateState(); 5562 5563 // use return values to update if defined 5564 var ret = cb.call(state, state.node); 5565 if (ret !== undefined && state.update) state.update(ret); 5566 5567 if (modifiers.before) modifiers.before.call(state, state.node); 5568 5569 if (!keepGoing) return state; 5570 5571 if (typeof state.node == 'object' 5572 && state.node !== null && !state.circular) { 5573 parents.push(state); 5574 5575 updateState(); 5576 5577 forEach(state.keys, function (key, i) { 5578 path.push(key); 5579 5580 if (modifiers.pre) modifiers.pre.call(state, state.node[key], key); 5581 5582 var child = walker(state.node[key]); 5583 if (immutable && hasOwnProperty.call(state.node, key)) { 5584 state.node[key] = child.node; 5585 } 5586 5587 child.isLast = i == state.keys.length - 1; 5588 child.isFirst = i == 0; 5589 5590 if (modifiers.post) modifiers.post.call(state, child); 5591 5592 path.pop(); 5593 }); 5594 parents.pop(); 5595 } 5596 5597 if (modifiers.after) modifiers.after.call(state, state.node); 5598 5599 return state; 5600 })(root).node; 5601 } 5602 5603 function copy (src) { 5604 if (typeof src === 'object' && src !== null) { 5605 var dst; 5606 5607 if (isArray(src)) { 5608 dst = []; 5609 } 5610 else if (isDate(src)) { 5611 dst = new Date(src.getTime ? src.getTime() : src); 5612 } 5613 else if (isRegExp(src)) { 5614 dst = new RegExp(src); 5615 } 5616 else if (isError(src)) { 5617 dst = { message: src.message }; 5618 } 5619 else if (isBoolean(src)) { 5620 dst = new Boolean(src); 5621 } 5622 else if (isNumber(src)) { 5623 dst = new Number(src); 5624 } 5625 else if (isString(src)) { 5626 dst = new String(src); 5627 } 5628 else if (Object.create && Object.getPrototypeOf) { 5629 dst = Object.create(Object.getPrototypeOf(src)); 5630 } 5631 else if (src.constructor === Object) { 5632 dst = {}; 5633 } 5634 else { 5635 var proto = 5636 (src.constructor && src.constructor.prototype) 5637 || src.__proto__ 5638 || {} 5639 ; 5640 var T = function () {}; 5641 T.prototype = proto; 5642 dst = new T; 5643 } 5644 5645 forEach(objectKeys(src), function (key) { 5646 dst[key] = src[key]; 5647 }); 5648 return dst; 5649 } 5650 else return src; 5651 } 5652 5653 var objectKeys = Object.keys || function keys (obj) { 5654 var res = []; 5655 for (var key in obj) res.push(key) 5656 return res; 5657 }; 5658 5659 function toS (obj) { return Object.prototype.toString.call(obj) } 5660 function isDate (obj) { return toS(obj) === '[object Date]' } 5661 function isRegExp (obj) { return toS(obj) === '[object RegExp]' } 5662 function isError (obj) { return toS(obj) === '[object Error]' } 5663 function isBoolean (obj) { return toS(obj) === '[object Boolean]' } 5664 function isNumber (obj) { return toS(obj) === '[object Number]' } 5665 function isString (obj) { return toS(obj) === '[object String]' } 5666 5667 var isArray = Array.isArray || function isArray (xs) { 5668 return Object.prototype.toString.call(xs) === '[object Array]'; 5669 }; 5670 5671 var forEach = function (xs, fn) { 5672 if (xs.forEach) return xs.forEach(fn) 5673 else for (var i = 0; i < xs.length; i++) { 5674 fn(xs[i], i, xs); 5675 } 5676 }; 5677 5678 forEach(objectKeys(Traverse.prototype), function (key) { 5679 traverse[key] = function (obj) { 5680 var args = [].slice.call(arguments, 1); 5681 var t = new Traverse(obj); 5682 return t[key].apply(t, args); 5683 }; 5684 }); 5685 5686 var hasOwnProperty = Object.hasOwnProperty || function (obj, key) { 5687 return key in obj; 5688 }; 5689 5690 5691 /***/ }), 5692 5693 /***/ "fPbg": 5694 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5695 5696 "use strict"; 5697 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5698 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5699 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 5700 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 5701 5702 5703 /** 5704 * WordPress dependencies 5705 */ 5706 5707 const alignLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 5708 xmlns: "http://www.w3.org/2000/svg", 5709 viewBox: "0 0 24 24" 5710 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 5711 d: "M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z" 5712 })); 5713 /* harmony default export */ __webpack_exports__["a"] = (alignLeft); 5714 5715 5716 /***/ }), 5717 5718 /***/ "g56x": 5719 /***/ (function(module, exports) { 5720 5721 (function() { module.exports = window["wp"]["hooks"]; }()); 5722 5723 /***/ }), 5724 5725 /***/ "gdqT": 5726 /***/ (function(module, exports) { 5727 5728 (function() { module.exports = window["wp"]["a11y"]; }()); 5729 5730 /***/ }), 5731 5732 /***/ "hF7m": 5733 /***/ (function(module, exports) { 5734 5735 (function() { module.exports = window["wp"]["keyboardShortcuts"]; }()); 5736 5737 /***/ }), 5738 5739 /***/ "iA5R": 5740 /***/ (function(module, exports, __webpack_require__) { 5741 5742 "use strict"; 5743 /*istanbul ignore start*/ 5744 5745 5746 Object.defineProperty(exports, "__esModule", { 5747 value: true 5748 }); 5749 exports.diffChars = diffChars; 5750 exports.characterDiff = void 0; 5751 5752 /*istanbul ignore end*/ 5753 var 5754 /*istanbul ignore start*/ 5755 _base = _interopRequireDefault(__webpack_require__("smQA")) 5756 /*istanbul ignore end*/ 5757 ; 5758 5759 /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 5760 5761 /*istanbul ignore end*/ 5762 var characterDiff = new 5763 /*istanbul ignore start*/ 5764 _base 5765 /*istanbul ignore end*/ 5766 . 5767 /*istanbul ignore start*/ 5768 default 5769 /*istanbul ignore end*/ 5770 (); 5771 5772 /*istanbul ignore start*/ 5773 exports.characterDiff = characterDiff; 5774 5775 /*istanbul ignore end*/ 5776 function diffChars(oldStr, newStr, options) { 5777 return characterDiff.diff(oldStr, newStr, options); 5778 } 5779 5780 5781 /***/ }), 5782 5783 /***/ "iClF": 5784 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5785 5786 "use strict"; 5787 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 5788 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5789 /** 5790 * WordPress dependencies 5791 */ 5792 5793 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 5794 5795 /** 5796 * Return an SVG icon. 5797 * 5798 * @param {IconProps} props icon is the SVG component to render 5799 * size is a number specifiying the icon size in pixels 5800 * Other props will be passed to wrapped SVG component 5801 * 5802 * @return {JSX.Element} Icon component 5803 */ 5804 5805 function Icon({ 5806 icon, 5807 size = 24, 5808 ...props 5809 }) { 5810 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, { 5811 width: size, 5812 height: size, 5813 ...props 5814 }); 5815 } 5816 5817 /* harmony default export */ __webpack_exports__["a"] = (Icon); 5818 5819 5820 /***/ }), 5821 5822 /***/ "jB5C": 5823 /***/ (function(module, exports, __webpack_require__) { 5824 5825 "use strict"; 5826 5827 5828 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 5829 5830 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; 5831 5832 var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; 5833 5834 function getClientPosition(elem) { 5835 var box = undefined; 5836 var x = undefined; 5837 var y = undefined; 5838 var doc = elem.ownerDocument; 5839 var body = doc.body; 5840 var docElem = doc && doc.documentElement; 5841 // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 5842 box = elem.getBoundingClientRect(); 5843 5844 // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop 5845 // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 5846 // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin 5847 5848 x = box.left; 5849 y = box.top; 5850 5851 // In IE, most of the time, 2 extra pixels are added to the top and left 5852 // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and 5853 // IE6 standards mode, this border can be overridden by setting the 5854 // document element's border to zero -- thus, we cannot rely on the 5855 // offset always being 2 pixels. 5856 5857 // In quirks mode, the offset can be determined by querying the body's 5858 // clientLeft/clientTop, but in standards mode, it is found by querying 5859 // the document element's clientLeft/clientTop. Since we already called 5860 // getClientBoundingRect we have already forced a reflow, so it is not 5861 // too expensive just to query them all. 5862 5863 // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 5864 // 窗口边框标准是设 documentElement ,quirks 时设置 body 5865 // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 5866 // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 5867 // 标准 ie 下 docElem.clientTop 就是 border-top 5868 // ie7 html 即窗口边框改变不了。永远为 2 5869 // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 5870 5871 x -= docElem.clientLeft || body.clientLeft || 0; 5872 y -= docElem.clientTop || body.clientTop || 0; 5873 5874 return { 5875 left: x, 5876 top: y 5877 }; 5878 } 5879 5880 function getScroll(w, top) { 5881 var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; 5882 var method = 'scroll' + (top ? 'Top' : 'Left'); 5883 if (typeof ret !== 'number') { 5884 var d = w.document; 5885 // ie6,7,8 standard mode 5886 ret = d.documentElement[method]; 5887 if (typeof ret !== 'number') { 5888 // quirks mode 5889 ret = d.body[method]; 5890 } 5891 } 5892 return ret; 5893 } 5894 5895 function getScrollLeft(w) { 5896 return getScroll(w); 5897 } 5898 5899 function getScrollTop(w) { 5900 return getScroll(w, true); 5901 } 5902 5903 function getOffset(el) { 5904 var pos = getClientPosition(el); 5905 var doc = el.ownerDocument; 5906 var w = doc.defaultView || doc.parentWindow; 5907 pos.left += getScrollLeft(w); 5908 pos.top += getScrollTop(w); 5909 return pos; 5910 } 5911 function _getComputedStyle(elem, name, computedStyle_) { 5912 var val = ''; 5913 var d = elem.ownerDocument; 5914 var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null); 5915 5916 // https://github.com/kissyteam/kissy/issues/61 5917 if (computedStyle) { 5918 val = computedStyle.getPropertyValue(name) || computedStyle[name]; 5919 } 5920 5921 return val; 5922 } 5923 5924 var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); 5925 var RE_POS = /^(top|right|bottom|left)$/; 5926 var CURRENT_STYLE = 'currentStyle'; 5927 var RUNTIME_STYLE = 'runtimeStyle'; 5928 var LEFT = 'left'; 5929 var PX = 'px'; 5930 5931 function _getComputedStyleIE(elem, name) { 5932 // currentStyle maybe null 5933 // http://msdn.microsoft.com/en-us/library/ms535231.aspx 5934 var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; 5935 5936 // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 5937 // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 5938 // 在 ie 下不对,需要直接用 offset 方式 5939 // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 5940 5941 // From the awesome hack by Dean Edwards 5942 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 5943 // If we're not dealing with a regular pixel number 5944 // but a number that has a weird ending, we need to convert it to pixels 5945 // exclude left right for relativity 5946 if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { 5947 // Remember the original values 5948 var style = elem.style; 5949 var left = style[LEFT]; 5950 var rsLeft = elem[RUNTIME_STYLE][LEFT]; 5951 5952 // prevent flashing of content 5953 elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; 5954 5955 // Put in the new values to get a computed value out 5956 style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; 5957 ret = style.pixelLeft + PX; 5958 5959 // Revert the changed values 5960 style[LEFT] = left; 5961 5962 elem[RUNTIME_STYLE][LEFT] = rsLeft; 5963 } 5964 return ret === '' ? 'auto' : ret; 5965 } 5966 5967 var getComputedStyleX = undefined; 5968 if (typeof window !== 'undefined') { 5969 getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; 5970 } 5971 5972 function each(arr, fn) { 5973 for (var i = 0; i < arr.length; i++) { 5974 fn(arr[i]); 5975 } 5976 } 5977 5978 function isBorderBoxFn(elem) { 5979 return getComputedStyleX(elem, 'boxSizing') === 'border-box'; 5980 } 5981 5982 var BOX_MODELS = ['margin', 'border', 'padding']; 5983 var CONTENT_INDEX = -1; 5984 var PADDING_INDEX = 2; 5985 var BORDER_INDEX = 1; 5986 var MARGIN_INDEX = 0; 5987 5988 function swap(elem, options, callback) { 5989 var old = {}; 5990 var style = elem.style; 5991 var name = undefined; 5992 5993 // Remember the old values, and insert the new ones 5994 for (name in options) { 5995 if (options.hasOwnProperty(name)) { 5996 old[name] = style[name]; 5997 style[name] = options[name]; 5998 } 5999 } 6000 6001 callback.call(elem); 6002 6003 // Revert the old values 6004 for (name in options) { 6005 if (options.hasOwnProperty(name)) { 6006 style[name] = old[name]; 6007 } 6008 } 6009 } 6010 6011 function getPBMWidth(elem, props, which) { 6012 var value = 0; 6013 var prop = undefined; 6014 var j = undefined; 6015 var i = undefined; 6016 for (j = 0; j < props.length; j++) { 6017 prop = props[j]; 6018 if (prop) { 6019 for (i = 0; i < which.length; i++) { 6020 var cssProp = undefined; 6021 if (prop === 'border') { 6022 cssProp = prop + which[i] + 'Width'; 6023 } else { 6024 cssProp = prop + which[i]; 6025 } 6026 value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; 6027 } 6028 } 6029 } 6030 return value; 6031 } 6032 6033 /** 6034 * A crude way of determining if an object is a window 6035 * @member util 6036 */ 6037 function isWindow(obj) { 6038 // must use == for ie8 6039 /* eslint eqeqeq:0 */ 6040 return obj != null && obj == obj.window; 6041 } 6042 6043 var domUtils = {}; 6044 6045 each(['Width', 'Height'], function (name) { 6046 domUtils['doc' + name] = function (refWin) { 6047 var d = refWin.document; 6048 return Math.max( 6049 // firefox chrome documentElement.scrollHeight< body.scrollHeight 6050 // ie standard mode : documentElement.scrollHeight> body.scrollHeight 6051 d.documentElement['scroll' + name], 6052 // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? 6053 d.body['scroll' + name], domUtils['viewport' + name](d)); 6054 }; 6055 6056 domUtils['viewport' + name] = function (win) { 6057 // pc browser includes scrollbar in window.innerWidth 6058 var prop = 'client' + name; 6059 var doc = win.document; 6060 var body = doc.body; 6061 var documentElement = doc.documentElement; 6062 var documentElementProp = documentElement[prop]; 6063 // 标准模式取 documentElement 6064 // backcompat 取 body 6065 return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; 6066 }; 6067 }); 6068 6069 /* 6070 得到元素的大小信息 6071 @param elem 6072 @param name 6073 @param {String} [extra] 'padding' : (css width) + padding 6074 'border' : (css width) + padding + border 6075 'margin' : (css width) + padding + border + margin 6076 */ 6077 function getWH(elem, name, extra) { 6078 if (isWindow(elem)) { 6079 return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); 6080 } else if (elem.nodeType === 9) { 6081 return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); 6082 } 6083 var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; 6084 var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; 6085 var computedStyle = getComputedStyleX(elem); 6086 var isBorderBox = isBorderBoxFn(elem, computedStyle); 6087 var cssBoxValue = 0; 6088 if (borderBoxValue == null || borderBoxValue <= 0) { 6089 borderBoxValue = undefined; 6090 // Fall back to computed then un computed css if necessary 6091 cssBoxValue = getComputedStyleX(elem, name); 6092 if (cssBoxValue == null || Number(cssBoxValue) < 0) { 6093 cssBoxValue = elem.style[name] || 0; 6094 } 6095 // Normalize '', auto, and prepare for extra 6096 cssBoxValue = parseFloat(cssBoxValue) || 0; 6097 } 6098 if (extra === undefined) { 6099 extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; 6100 } 6101 var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; 6102 var val = borderBoxValue || cssBoxValue; 6103 if (extra === CONTENT_INDEX) { 6104 if (borderBoxValueOrIsBorderBox) { 6105 return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); 6106 } 6107 return cssBoxValue; 6108 } 6109 if (borderBoxValueOrIsBorderBox) { 6110 var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle); 6111 return val + (extra === BORDER_INDEX ? 0 : padding); 6112 } 6113 return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); 6114 } 6115 6116 var cssShow = { 6117 position: 'absolute', 6118 visibility: 'hidden', 6119 display: 'block' 6120 }; 6121 6122 // fix #119 : https://github.com/kissyteam/kissy/issues/119 6123 function getWHIgnoreDisplay(elem) { 6124 var val = undefined; 6125 var args = arguments; 6126 // in case elem is window 6127 // elem.offsetWidth === undefined 6128 if (elem.offsetWidth !== 0) { 6129 val = getWH.apply(undefined, args); 6130 } else { 6131 swap(elem, cssShow, function () { 6132 val = getWH.apply(undefined, args); 6133 }); 6134 } 6135 return val; 6136 } 6137 6138 function css(el, name, v) { 6139 var value = v; 6140 if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { 6141 for (var i in name) { 6142 if (name.hasOwnProperty(i)) { 6143 css(el, i, name[i]); 6144 } 6145 } 6146 return undefined; 6147 } 6148 if (typeof value !== 'undefined') { 6149 if (typeof value === 'number') { 6150 value += 'px'; 6151 } 6152 el.style[name] = value; 6153 return undefined; 6154 } 6155 return getComputedStyleX(el, name); 6156 } 6157 6158 each(['width', 'height'], function (name) { 6159 var first = name.charAt(0).toUpperCase() + name.slice(1); 6160 domUtils['outer' + first] = function (el, includeMargin) { 6161 return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); 6162 }; 6163 var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; 6164 6165 domUtils[name] = function (elem, val) { 6166 if (val !== undefined) { 6167 if (elem) { 6168 var computedStyle = getComputedStyleX(elem); 6169 var isBorderBox = isBorderBoxFn(elem); 6170 if (isBorderBox) { 6171 val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); 6172 } 6173 return css(elem, name, val); 6174 } 6175 return undefined; 6176 } 6177 return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); 6178 }; 6179 }); 6180 6181 // 设置 elem 相对 elem.ownerDocument 的坐标 6182 function setOffset(elem, offset) { 6183 // set position first, in-case top/left are set even on static elem 6184 if (css(elem, 'position') === 'static') { 6185 elem.style.position = 'relative'; 6186 } 6187 6188 var old = getOffset(elem); 6189 var ret = {}; 6190 var current = undefined; 6191 var key = undefined; 6192 6193 for (key in offset) { 6194 if (offset.hasOwnProperty(key)) { 6195 current = parseFloat(css(elem, key)) || 0; 6196 ret[key] = current + offset[key] - old[key]; 6197 } 6198 } 6199 css(elem, ret); 6200 } 6201 6202 module.exports = _extends({ 6203 getWindow: function getWindow(node) { 6204 var doc = node.ownerDocument || node; 6205 return doc.defaultView || doc.parentWindow; 6206 }, 6207 offset: function offset(el, value) { 6208 if (typeof value !== 'undefined') { 6209 setOffset(el, value); 6210 } else { 6211 return getOffset(el); 6212 } 6213 }, 6214 6215 isWindow: isWindow, 6216 each: each, 6217 css: css, 6218 clone: function clone(obj) { 6219 var ret = {}; 6220 for (var i in obj) { 6221 if (obj.hasOwnProperty(i)) { 6222 ret[i] = obj[i]; 6223 } 6224 } 6225 var overflow = obj.overflow; 6226 if (overflow) { 6227 for (var i in obj) { 6228 if (obj.hasOwnProperty(i)) { 6229 ret.overflow[i] = obj.overflow[i]; 6230 } 6231 } 6232 } 6233 return ret; 6234 }, 6235 scrollLeft: function scrollLeft(w, v) { 6236 if (isWindow(w)) { 6237 if (v === undefined) { 6238 return getScrollLeft(w); 6239 } 6240 window.scrollTo(v, getScrollTop(w)); 6241 } else { 6242 if (v === undefined) { 6243 return w.scrollLeft; 6244 } 6245 w.scrollLeft = v; 6246 } 6247 }, 6248 scrollTop: function scrollTop(w, v) { 6249 if (isWindow(w)) { 6250 if (v === undefined) { 6251 return getScrollTop(w); 6252 } 6253 window.scrollTo(getScrollLeft(w), v); 6254 } else { 6255 if (v === undefined) { 6256 return w.scrollTop; 6257 } 6258 w.scrollTop = v; 6259 } 6260 }, 6261 6262 viewportWidth: 0, 6263 viewportHeight: 0 6264 }, domUtils); 6265 6266 /***/ }), 6267 6268 /***/ "jTPX": 6269 /***/ (function(module, exports) { 6270 6271 // This code has been refactored for 140 bytes 6272 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js 6273 var computedStyle = function (el, prop, getComputedStyle) { 6274 getComputedStyle = window.getComputedStyle; 6275 6276 // In one fell swoop 6277 return ( 6278 // If we have getComputedStyle 6279 getComputedStyle ? 6280 // Query it 6281 // TODO: From CSS-Query notes, we might need (node, null) for FF 6282 getComputedStyle(el) : 6283 6284 // Otherwise, we are in IE and use currentStyle 6285 el.currentStyle 6286 )[ 6287 // Switch to camelCase for CSSOM 6288 // DEV: Grabbed from jQuery 6289 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 6290 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 6291 prop.replace(/-(\w)/gi, function (word, letter) { 6292 return letter.toUpperCase(); 6293 }) 6294 ]; 6295 }; 6296 6297 module.exports = computedStyle; 6298 6299 6300 /***/ }), 6301 6302 /***/ "l3Sj": 6303 /***/ (function(module, exports) { 6304 6305 (function() { module.exports = window["wp"]["i18n"]; }()); 6306 6307 /***/ }), 6308 6309 /***/ "onLe": 6310 /***/ (function(module, exports) { 6311 6312 (function() { module.exports = window["wp"]["notices"]; }()); 6313 6314 /***/ }), 6315 6316 /***/ "pPDe": 6317 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6318 6319 "use strict"; 6320 6321 6322 var LEAF_KEY, hasWeakMap; 6323 6324 /** 6325 * Arbitrary value used as key for referencing cache object in WeakMap tree. 6326 * 6327 * @type {Object} 6328 */ 6329 LEAF_KEY = {}; 6330 6331 /** 6332 * Whether environment supports WeakMap. 6333 * 6334 * @type {boolean} 6335 */ 6336 hasWeakMap = typeof WeakMap !== 'undefined'; 6337 6338 /** 6339 * Returns the first argument as the sole entry in an array. 6340 * 6341 * @param {*} value Value to return. 6342 * 6343 * @return {Array} Value returned as entry in array. 6344 */ 6345 function arrayOf( value ) { 6346 return [ value ]; 6347 } 6348 6349 /** 6350 * Returns true if the value passed is object-like, or false otherwise. A value 6351 * is object-like if it can support property assignment, e.g. object or array. 6352 * 6353 * @param {*} value Value to test. 6354 * 6355 * @return {boolean} Whether value is object-like. 6356 */ 6357 function isObjectLike( value ) { 6358 return !! value && 'object' === typeof value; 6359 } 6360 6361 /** 6362 * Creates and returns a new cache object. 6363 * 6364 * @return {Object} Cache object. 6365 */ 6366 function createCache() { 6367 var cache = { 6368 clear: function() { 6369 cache.head = null; 6370 }, 6371 }; 6372 6373 return cache; 6374 } 6375 6376 /** 6377 * Returns true if entries within the two arrays are strictly equal by 6378 * reference from a starting index. 6379 * 6380 * @param {Array} a First array. 6381 * @param {Array} b Second array. 6382 * @param {number} fromIndex Index from which to start comparison. 6383 * 6384 * @return {boolean} Whether arrays are shallowly equal. 6385 */ 6386 function isShallowEqual( a, b, fromIndex ) { 6387 var i; 6388 6389 if ( a.length !== b.length ) { 6390 return false; 6391 } 6392 6393 for ( i = fromIndex; i < a.length; i++ ) { 6394 if ( a[ i ] !== b[ i ] ) { 6395 return false; 6396 } 6397 } 6398 6399 return true; 6400 } 6401 6402 /** 6403 * Returns a memoized selector function. The getDependants function argument is 6404 * called before the memoized selector and is expected to return an immutable 6405 * reference or array of references on which the selector depends for computing 6406 * its own return value. The memoize cache is preserved only as long as those 6407 * dependant references remain the same. If getDependants returns a different 6408 * reference(s), the cache is cleared and the selector value regenerated. 6409 * 6410 * @param {Function} selector Selector function. 6411 * @param {Function} getDependants Dependant getter returning an immutable 6412 * reference or array of reference used in 6413 * cache bust consideration. 6414 * 6415 * @return {Function} Memoized selector. 6416 */ 6417 /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { 6418 var rootCache, getCache; 6419 6420 // Use object source as dependant if getter not provided 6421 if ( ! getDependants ) { 6422 getDependants = arrayOf; 6423 } 6424 6425 /** 6426 * Returns the root cache. If WeakMap is supported, this is assigned to the 6427 * root WeakMap cache set, otherwise it is a shared instance of the default 6428 * cache object. 6429 * 6430 * @return {(WeakMap|Object)} Root cache object. 6431 */ 6432 function getRootCache() { 6433 return rootCache; 6434 } 6435 6436 /** 6437 * Returns the cache for a given dependants array. When possible, a WeakMap 6438 * will be used to create a unique cache for each set of dependants. This 6439 * is feasible due to the nature of WeakMap in allowing garbage collection 6440 * to occur on entries where the key object is no longer referenced. Since 6441 * WeakMap requires the key to be an object, this is only possible when the 6442 * dependant is object-like. The root cache is created as a hierarchy where 6443 * each top-level key is the first entry in a dependants set, the value a 6444 * WeakMap where each key is the next dependant, and so on. This continues 6445 * so long as the dependants are object-like. If no dependants are object- 6446 * like, then the cache is shared across all invocations. 6447 * 6448 * @see isObjectLike 6449 * 6450 * @param {Array} dependants Selector dependants. 6451 * 6452 * @return {Object} Cache object. 6453 */ 6454 function getWeakMapCache( dependants ) { 6455 var caches = rootCache, 6456 isUniqueByDependants = true, 6457 i, dependant, map, cache; 6458 6459 for ( i = 0; i < dependants.length; i++ ) { 6460 dependant = dependants[ i ]; 6461 6462 // Can only compose WeakMap from object-like key. 6463 if ( ! isObjectLike( dependant ) ) { 6464 isUniqueByDependants = false; 6465 break; 6466 } 6467 6468 // Does current segment of cache already have a WeakMap? 6469 if ( caches.has( dependant ) ) { 6470 // Traverse into nested WeakMap. 6471 caches = caches.get( dependant ); 6472 } else { 6473 // Create, set, and traverse into a new one. 6474 map = new WeakMap(); 6475 caches.set( dependant, map ); 6476 caches = map; 6477 } 6478 } 6479 6480 // We use an arbitrary (but consistent) object as key for the last item 6481 // in the WeakMap to serve as our running cache. 6482 if ( ! caches.has( LEAF_KEY ) ) { 6483 cache = createCache(); 6484 cache.isUniqueByDependants = isUniqueByDependants; 6485 caches.set( LEAF_KEY, cache ); 6486 } 6487 6488 return caches.get( LEAF_KEY ); 6489 } 6490 6491 // Assign cache handler by availability of WeakMap 6492 getCache = hasWeakMap ? getWeakMapCache : getRootCache; 6493 6494 /** 6495 * Resets root memoization cache. 6496 */ 6497 function clear() { 6498 rootCache = hasWeakMap ? new WeakMap() : createCache(); 6499 } 6500 6501 // eslint-disable-next-line jsdoc/check-param-names 6502 /** 6503 * The augmented selector call, considering first whether dependants have 6504 * changed before passing it to underlying memoize function. 6505 * 6506 * @param {Object} source Source object for derivation. 6507 * @param {...*} extraArgs Additional arguments to pass to selector. 6508 * 6509 * @return {*} Selector result. 6510 */ 6511 function callSelector( /* source, ...extraArgs */ ) { 6512 var len = arguments.length, 6513 cache, node, i, args, dependants; 6514 6515 // Create copy of arguments (avoid leaking deoptimization). 6516 args = new Array( len ); 6517 for ( i = 0; i < len; i++ ) { 6518 args[ i ] = arguments[ i ]; 6519 } 6520 6521 dependants = getDependants.apply( null, args ); 6522 cache = getCache( dependants ); 6523 6524 // If not guaranteed uniqueness by dependants (primitive type or lack 6525 // of WeakMap support), shallow compare against last dependants and, if 6526 // references have changed, destroy cache to recalculate result. 6527 if ( ! cache.isUniqueByDependants ) { 6528 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { 6529 cache.clear(); 6530 } 6531 6532 cache.lastDependants = dependants; 6533 } 6534 6535 node = cache.head; 6536 while ( node ) { 6537 // Check whether node arguments match arguments 6538 if ( ! isShallowEqual( node.args, args, 1 ) ) { 6539 node = node.next; 6540 continue; 6541 } 6542 6543 // At this point we can assume we've found a match 6544 6545 // Surface matched node to head if not already 6546 if ( node !== cache.head ) { 6547 // Adjust siblings to point to each other. 6548 node.prev.next = node.next; 6549 if ( node.next ) { 6550 node.next.prev = node.prev; 6551 } 6552 6553 node.next = cache.head; 6554 node.prev = null; 6555 cache.head.prev = node; 6556 cache.head = node; 6557 } 6558 6559 // Return immediately 6560 return node.val; 6561 } 6562 6563 // No cached value found. Continue to insertion phase: 6564 6565 node = { 6566 // Generate the result from original function 6567 val: selector.apply( null, args ), 6568 }; 6569 6570 // Avoid including the source object in the cache. 6571 args[ 0 ] = null; 6572 node.args = args; 6573 6574 // Don't need to check whether node is already head, since it would 6575 // have been returned above already if it was 6576 6577 // Shift existing head down list 6578 if ( cache.head ) { 6579 cache.head.prev = node; 6580 node.next = cache.head; 6581 } 6582 6583 cache.head = node; 6584 6585 return node.val; 6586 } 6587 6588 callSelector.getDependants = getDependants; 6589 callSelector.clear = clear; 6590 clear(); 6591 6592 return callSelector; 6593 }); 6594 6595 6596 /***/ }), 6597 6598 /***/ "pVnL": 6599 /***/ (function(module, exports) { 6600 6601 function _extends() { 6602 module.exports = _extends = Object.assign || function (target) { 6603 for (var i = 1; i < arguments.length; i++) { 6604 var source = arguments[i]; 6605 6606 for (var key in source) { 6607 if (Object.prototype.hasOwnProperty.call(source, key)) { 6608 target[key] = source[key]; 6609 } 6610 } 6611 } 6612 6613 return target; 6614 }; 6615 6616 module.exports["default"] = module.exports, module.exports.__esModule = true; 6617 return _extends.apply(this, arguments); 6618 } 6619 6620 module.exports = _extends; 6621 module.exports["default"] = module.exports, module.exports.__esModule = true; 6622 6623 /***/ }), 6624 6625 /***/ "plpT": 6626 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6627 6628 "use strict"; 6629 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 6630 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 6631 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 6632 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 6633 6634 6635 /** 6636 * WordPress dependencies 6637 */ 6638 6639 const alignCenter = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 6640 xmlns: "http://www.w3.org/2000/svg", 6641 viewBox: "0 0 24 24" 6642 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 6643 d: "M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z" 6644 })); 6645 /* harmony default export */ __webpack_exports__["a"] = (alignCenter); 6646 6647 6648 /***/ }), 6649 6650 /***/ "qRz9": 6651 /***/ (function(module, exports) { 6652 6653 (function() { module.exports = window["wp"]["richText"]; }()); 6654 6655 /***/ }), 6656 6657 /***/ "rH4q": 6658 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6659 6660 "use strict"; 6661 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 6662 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 6663 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 6664 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 6665 6666 6667 /** 6668 * WordPress dependencies 6669 */ 6670 6671 const media = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 6672 xmlns: "http://www.w3.org/2000/svg", 6673 viewBox: "0 0 24 24" 6674 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 6675 d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z" 6676 })); 6677 /* harmony default export */ __webpack_exports__["a"] = (media); 6678 6679 6680 /***/ }), 6681 6682 /***/ "rl8x": 6683 /***/ (function(module, exports) { 6684 6685 (function() { module.exports = window["wp"]["isShallowEqual"]; }()); 6686 6687 /***/ }), 6688 6689 /***/ "rmEH": 6690 /***/ (function(module, exports) { 6691 6692 (function() { module.exports = window["wp"]["htmlEntities"]; }()); 6693 6694 /***/ }), 6695 6696 /***/ "smQA": 6697 /***/ (function(module, exports, __webpack_require__) { 6698 6699 "use strict"; 6700 /*istanbul ignore start*/ 6701 6702 6703 Object.defineProperty(exports, "__esModule", { 6704 value: true 6705 }); 6706 exports.default = Diff; 6707 6708 /*istanbul ignore end*/ 6709 function Diff() {} 6710 6711 Diff.prototype = { 6712 /*istanbul ignore start*/ 6713 6714 /*istanbul ignore end*/ 6715 diff: function diff(oldString, newString) { 6716 /*istanbul ignore start*/ 6717 var 6718 /*istanbul ignore end*/ 6719 options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 6720 var callback = options.callback; 6721 6722 if (typeof options === 'function') { 6723 callback = options; 6724 options = {}; 6725 } 6726 6727 this.options = options; 6728 var self = this; 6729 6730 function done(value) { 6731 if (callback) { 6732 setTimeout(function () { 6733 callback(undefined, value); 6734 }, 0); 6735 return true; 6736 } else { 6737 return value; 6738 } 6739 } // Allow subclasses to massage the input prior to running 6740 6741 6742 oldString = this.castInput(oldString); 6743 newString = this.castInput(newString); 6744 oldString = this.removeEmpty(this.tokenize(oldString)); 6745 newString = this.removeEmpty(this.tokenize(newString)); 6746 var newLen = newString.length, 6747 oldLen = oldString.length; 6748 var editLength = 1; 6749 var maxEditLength = newLen + oldLen; 6750 var bestPath = [{ 6751 newPos: -1, 6752 components: [] 6753 }]; // Seed editLength = 0, i.e. the content starts with the same values 6754 6755 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); 6756 6757 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { 6758 // Identity per the equality and tokenizer 6759 return done([{ 6760 value: this.join(newString), 6761 count: newString.length 6762 }]); 6763 } // Main worker method. checks all permutations of a given edit length for acceptance. 6764 6765 6766 function execEditLength() { 6767 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { 6768 var basePath = 6769 /*istanbul ignore start*/ 6770 void 0 6771 /*istanbul ignore end*/ 6772 ; 6773 6774 var addPath = bestPath[diagonalPath - 1], 6775 removePath = bestPath[diagonalPath + 1], 6776 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; 6777 6778 if (addPath) { 6779 // No one else is going to attempt to use this value, clear it 6780 bestPath[diagonalPath - 1] = undefined; 6781 } 6782 6783 var canAdd = addPath && addPath.newPos + 1 < newLen, 6784 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; 6785 6786 if (!canAdd && !canRemove) { 6787 // If this path is a terminal then prune 6788 bestPath[diagonalPath] = undefined; 6789 continue; 6790 } // Select the diagonal that we want to branch from. We select the prior 6791 // path whose position in the new string is the farthest from the origin 6792 // and does not pass the bounds of the diff graph 6793 6794 6795 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { 6796 basePath = clonePath(removePath); 6797 self.pushComponent(basePath.components, undefined, true); 6798 } else { 6799 basePath = addPath; // No need to clone, we've pulled it from the list 6800 6801 basePath.newPos++; 6802 self.pushComponent(basePath.components, true, undefined); 6803 } 6804 6805 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done 6806 6807 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { 6808 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); 6809 } else { 6810 // Otherwise track this path as a potential candidate and continue. 6811 bestPath[diagonalPath] = basePath; 6812 } 6813 } 6814 6815 editLength++; 6816 } // Performs the length of edit iteration. Is a bit fugly as this has to support the 6817 // sync and async mode which is never fun. Loops over execEditLength until a value 6818 // is produced. 6819 6820 6821 if (callback) { 6822 (function exec() { 6823 setTimeout(function () { 6824 // This should not happen, but we want to be safe. 6825 6826 /* istanbul ignore next */ 6827 if (editLength > maxEditLength) { 6828 return callback(); 6829 } 6830 6831 if (!execEditLength()) { 6832 exec(); 6833 } 6834 }, 0); 6835 })(); 6836 } else { 6837 while (editLength <= maxEditLength) { 6838 var ret = execEditLength(); 6839 6840 if (ret) { 6841 return ret; 6842 } 6843 } 6844 } 6845 }, 6846 6847 /*istanbul ignore start*/ 6848 6849 /*istanbul ignore end*/ 6850 pushComponent: function pushComponent(components, added, removed) { 6851 var last = components[components.length - 1]; 6852 6853 if (last && last.added === added && last.removed === removed) { 6854 // We need to clone here as the component clone operation is just 6855 // as shallow array clone 6856 components[components.length - 1] = { 6857 count: last.count + 1, 6858 added: added, 6859 removed: removed 6860 }; 6861 } else { 6862 components.push({ 6863 count: 1, 6864 added: added, 6865 removed: removed 6866 }); 6867 } 6868 }, 6869 6870 /*istanbul ignore start*/ 6871 6872 /*istanbul ignore end*/ 6873 extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { 6874 var newLen = newString.length, 6875 oldLen = oldString.length, 6876 newPos = basePath.newPos, 6877 oldPos = newPos - diagonalPath, 6878 commonCount = 0; 6879 6880 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { 6881 newPos++; 6882 oldPos++; 6883 commonCount++; 6884 } 6885 6886 if (commonCount) { 6887 basePath.components.push({ 6888 count: commonCount 6889 }); 6890 } 6891 6892 basePath.newPos = newPos; 6893 return oldPos; 6894 }, 6895 6896 /*istanbul ignore start*/ 6897 6898 /*istanbul ignore end*/ 6899 equals: function equals(left, right) { 6900 if (this.options.comparator) { 6901 return this.options.comparator(left, right); 6902 } else { 6903 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); 6904 } 6905 }, 6906 6907 /*istanbul ignore start*/ 6908 6909 /*istanbul ignore end*/ 6910 removeEmpty: function removeEmpty(array) { 6911 var ret = []; 6912 6913 for (var i = 0; i < array.length; i++) { 6914 if (array[i]) { 6915 ret.push(array[i]); 6916 } 6917 } 6918 6919 return ret; 6920 }, 6921 6922 /*istanbul ignore start*/ 6923 6924 /*istanbul ignore end*/ 6925 castInput: function castInput(value) { 6926 return value; 6927 }, 6928 6929 /*istanbul ignore start*/ 6930 6931 /*istanbul ignore end*/ 6932 tokenize: function tokenize(value) { 6933 return value.split(''); 6934 }, 6935 6936 /*istanbul ignore start*/ 6937 6938 /*istanbul ignore end*/ 6939 join: function join(chars) { 6940 return chars.join(''); 6941 } 6942 }; 6943 6944 function buildValues(diff, components, newString, oldString, useLongestToken) { 6945 var componentPos = 0, 6946 componentLen = components.length, 6947 newPos = 0, 6948 oldPos = 0; 6949 6950 for (; componentPos < componentLen; componentPos++) { 6951 var component = components[componentPos]; 6952 6953 if (!component.removed) { 6954 if (!component.added && useLongestToken) { 6955 var value = newString.slice(newPos, newPos + component.count); 6956 value = value.map(function (value, i) { 6957 var oldValue = oldString[oldPos + i]; 6958 return oldValue.length > value.length ? oldValue : value; 6959 }); 6960 component.value = diff.join(value); 6961 } else { 6962 component.value = diff.join(newString.slice(newPos, newPos + component.count)); 6963 } 6964 6965 newPos += component.count; // Common case 6966 6967 if (!component.added) { 6968 oldPos += component.count; 6969 } 6970 } else { 6971 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); 6972 oldPos += component.count; // Reverse add and remove so removes are output first to match common convention 6973 // The diffing algorithm is tied to add then remove output and this is the simplest 6974 // route to get the desired output with minimal overhead. 6975 6976 if (componentPos && components[componentPos - 1].added) { 6977 var tmp = components[componentPos - 1]; 6978 components[componentPos - 1] = components[componentPos]; 6979 components[componentPos] = tmp; 6980 } 6981 } 6982 } // Special case handle for when one terminal is ignored (i.e. whitespace). 6983 // For this case we merge the terminal into the prior string and drop the change. 6984 // This is only available for string mode. 6985 6986 6987 var lastComponent = components[componentLen - 1]; 6988 6989 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { 6990 components[componentLen - 2].value += lastComponent.value; 6991 components.pop(); 6992 } 6993 6994 return components; 6995 } 6996 6997 function clonePath(path) { 6998 return { 6999 newPos: path.newPos, 7000 components: path.components.slice(0) 7001 }; 7002 } 7003 7004 7005 /***/ }), 7006 7007 /***/ "tI+e": 7008 /***/ (function(module, exports) { 7009 7010 (function() { module.exports = window["wp"]["components"]; }()); 7011 7012 /***/ }), 7013 7014 /***/ "tr0p": 7015 /***/ (function(module, __webpack_exports__, __webpack_require__) { 7016 7017 "use strict"; 7018 // ESM COMPAT FLAG 7019 __webpack_require__.r(__webpack_exports__); 7020 7021 // EXPORTS 7022 __webpack_require__.d(__webpack_exports__, "__experimentalGetBorderClassesAndStyles", function() { return /* reexport */ getBorderClassesAndStyles; }); 7023 __webpack_require__.d(__webpack_exports__, "__experimentalUseBorderProps", function() { return /* reexport */ useBorderProps; }); 7024 __webpack_require__.d(__webpack_exports__, "__experimentalGetColorClassesAndStyles", function() { return /* reexport */ getColorClassesAndStyles; }); 7025 __webpack_require__.d(__webpack_exports__, "__experimentalUseColorProps", function() { return /* reexport */ useColorProps; }); 7026 __webpack_require__.d(__webpack_exports__, "__experimentalUseCustomSides", function() { return /* reexport */ useCustomSides; }); 7027 __webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; }); 7028 __webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; }); 7029 __webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; }); 7030 __webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; }); 7031 __webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; }); 7032 __webpack_require__.d(__webpack_exports__, "__experimentalUseColors", function() { return /* reexport */ __experimentalUseColors; }); 7033 __webpack_require__.d(__webpack_exports__, "__experimentalGetGradientClass", function() { return /* reexport */ __experimentalGetGradientClass; }); 7034 __webpack_require__.d(__webpack_exports__, "getGradientValueBySlug", function() { return /* reexport */ getGradientValueBySlug; }); 7035 __webpack_require__.d(__webpack_exports__, "__experimentalGetGradientObjectByGradientValue", function() { return /* reexport */ __experimentalGetGradientObjectByGradientValue; }); 7036 __webpack_require__.d(__webpack_exports__, "getGradientSlugByValue", function() { return /* reexport */ getGradientSlugByValue; }); 7037 __webpack_require__.d(__webpack_exports__, "__experimentalUseGradient", function() { return /* reexport */ __experimentalUseGradient; }); 7038 __webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; }); 7039 __webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; }); 7040 __webpack_require__.d(__webpack_exports__, "getFontSizeObjectByValue", function() { return /* reexport */ getFontSizeObjectByValue; }); 7041 __webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ font_size_picker; }); 7042 __webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ with_font_sizes; }); 7043 __webpack_require__.d(__webpack_exports__, "AlignmentControl", function() { return /* reexport */ AlignmentControl; }); 7044 __webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; }); 7045 __webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ autocomplete; }); 7046 __webpack_require__.d(__webpack_exports__, "BlockAlignmentControl", function() { return /* reexport */ BlockAlignmentControl; }); 7047 __webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; }); 7048 __webpack_require__.d(__webpack_exports__, "__experimentalBlockFullHeightAligmentControl", function() { return /* reexport */ block_full_height_alignment_control; }); 7049 __webpack_require__.d(__webpack_exports__, "__experimentalBlockAlignmentMatrixControl", function() { return /* reexport */ block_alignment_matrix_control; }); 7050 __webpack_require__.d(__webpack_exports__, "BlockBreadcrumb", function() { return /* reexport */ block_breadcrumb; }); 7051 __webpack_require__.d(__webpack_exports__, "BlockContextProvider", function() { return /* reexport */ BlockContextProvider; }); 7052 __webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ block_controls; }); 7053 __webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; }); 7054 __webpack_require__.d(__webpack_exports__, "BlockColorsStyleSelector", function() { return /* reexport */ color_style_selector; }); 7055 __webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ block_edit_BlockEdit; }); 7056 __webpack_require__.d(__webpack_exports__, "useBlockEditContext", function() { return /* reexport */ useBlockEditContext; }); 7057 __webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; }); 7058 __webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ dropdown; }); 7059 __webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationBlockFill", function() { return /* reexport */ BlockNavigationBlockFill; }); 7060 __webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationEditor", function() { return /* reexport */ BlockNavigationEditor; }); 7061 __webpack_require__.d(__webpack_exports__, "__experimentalBlockNavigationTree", function() { return /* reexport */ BlockNavigationTree; }); 7062 __webpack_require__.d(__webpack_exports__, "__experimentalBlockVariationPicker", function() { return /* reexport */ block_variation_picker; }); 7063 __webpack_require__.d(__webpack_exports__, "__experimentalBlockPatternSetup", function() { return /* reexport */ block_pattern_setup; }); 7064 __webpack_require__.d(__webpack_exports__, "__experimentalBlockVariationTransforms", function() { return /* reexport */ block_variation_transforms; }); 7065 __webpack_require__.d(__webpack_exports__, "BlockVerticalAlignmentToolbar", function() { return /* reexport */ BlockVerticalAlignmentToolbar; }); 7066 __webpack_require__.d(__webpack_exports__, "BlockVerticalAlignmentControl", function() { return /* reexport */ BlockVerticalAlignmentControl; }); 7067 __webpack_require__.d(__webpack_exports__, "__experimentalBorderStyleControl", function() { return /* reexport */ BorderStyleControl; }); 7068 __webpack_require__.d(__webpack_exports__, "ButtonBlockerAppender", function() { return /* reexport */ ButtonBlockerAppender; }); 7069 __webpack_require__.d(__webpack_exports__, "ButtonBlockAppender", function() { return /* reexport */ button_block_appender; }); 7070 __webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ color_palette; }); 7071 __webpack_require__.d(__webpack_exports__, "ColorPaletteControl", function() { return /* reexport */ ColorPaletteControl; }); 7072 __webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ contrast_checker; }); 7073 __webpack_require__.d(__webpack_exports__, "__experimentalDuotoneControl", function() { return /* reexport */ duotone_control; }); 7074 __webpack_require__.d(__webpack_exports__, "__experimentalGradientPicker", function() { return /* reexport */ gradient_picker; }); 7075 __webpack_require__.d(__webpack_exports__, "__experimentalGradientPickerControl", function() { return /* reexport */ GradientPickerControl; }); 7076 __webpack_require__.d(__webpack_exports__, "__experimentalGradientPickerPanel", function() { return /* reexport */ GradientPanel; }); 7077 __webpack_require__.d(__webpack_exports__, "__experimentalFontAppearanceControl", function() { return /* reexport */ FontAppearanceControl; }); 7078 __webpack_require__.d(__webpack_exports__, "__experimentalFontFamilyControl", function() { return /* reexport */ FontFamilyControl; }); 7079 __webpack_require__.d(__webpack_exports__, "__experimentalColorGradientControl", function() { return /* reexport */ control; }); 7080 __webpack_require__.d(__webpack_exports__, "__experimentalPanelColorGradientSettings", function() { return /* reexport */ panel_color_gradient_settings; }); 7081 __webpack_require__.d(__webpack_exports__, "__experimentalImageSizeControl", function() { return /* reexport */ ImageSizeControl; }); 7082 __webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ inner_blocks; }); 7083 __webpack_require__.d(__webpack_exports__, "__experimentalUseInnerBlocksProps", function() { return /* reexport */ useInnerBlocksProps; }); 7084 __webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ inspector_advanced_controls; }); 7085 __webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ inspector_controls; }); 7086 __webpack_require__.d(__webpack_exports__, "JustifyToolbar", function() { return /* reexport */ JustifyToolbar; }); 7087 __webpack_require__.d(__webpack_exports__, "JustifyContentControl", function() { return /* reexport */ JustifyContentControl; }); 7088 __webpack_require__.d(__webpack_exports__, "__experimentalLinkControl", function() { return /* reexport */ link_control; }); 7089 __webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchInput", function() { return /* reexport */ search_input; }); 7090 __webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchResults", function() { return /* reexport */ LinkControlSearchResults; }); 7091 __webpack_require__.d(__webpack_exports__, "__experimentalLinkControlSearchItem", function() { return /* reexport */ search_item; }); 7092 __webpack_require__.d(__webpack_exports__, "LineHeightControl", function() { return /* reexport */ LineHeightControl; }); 7093 __webpack_require__.d(__webpack_exports__, "MediaReplaceFlow", function() { return /* reexport */ media_replace_flow; }); 7094 __webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ media_placeholder; }); 7095 __webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ media_upload; }); 7096 __webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ check; }); 7097 __webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ panel_color_settings; }); 7098 __webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ plain_text; }); 7099 __webpack_require__.d(__webpack_exports__, "__experimentalResponsiveBlockControl", function() { return /* reexport */ responsive_block_control; }); 7100 __webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ rich_text; }); 7101 __webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; }); 7102 __webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; }); 7103 __webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ input_event_unstableRichTextInputEvent; }); 7104 __webpack_require__.d(__webpack_exports__, "ToolSelector", function() { return /* reexport */ tool_selector; }); 7105 __webpack_require__.d(__webpack_exports__, "__experimentalUnitControl", function() { return /* reexport */ UnitControl; }); 7106 __webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ url_input; }); 7107 __webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ url_input_button; }); 7108 __webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ url_popover; }); 7109 __webpack_require__.d(__webpack_exports__, "__experimentalImageURLInputUI", function() { return /* reexport */ ImageURLInputUI; }); 7110 __webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ with_color_context; }); 7111 __webpack_require__.d(__webpack_exports__, "__unstableBlockSettingsMenuFirstItem", function() { return /* reexport */ block_settings_menu_first_item; }); 7112 __webpack_require__.d(__webpack_exports__, "__unstableInserterMenuExtension", function() { return /* reexport */ inserter_menu_extension; }); 7113 __webpack_require__.d(__webpack_exports__, "__experimentalPreviewOptions", function() { return /* reexport */ PreviewOptions; }); 7114 __webpack_require__.d(__webpack_exports__, "__experimentalUseResizeCanvas", function() { return /* reexport */ useResizeCanvas; }); 7115 __webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ block_inspector; }); 7116 __webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; }); 7117 __webpack_require__.d(__webpack_exports__, "useBlockProps", function() { return /* reexport */ useBlockProps; }); 7118 __webpack_require__.d(__webpack_exports__, "__experimentalLayoutStyle", function() { return /* reexport */ LayoutStyle; }); 7119 __webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ block_mover; }); 7120 __webpack_require__.d(__webpack_exports__, "BlockPreview", function() { return /* reexport */ block_preview; }); 7121 __webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; }); 7122 __webpack_require__.d(__webpack_exports__, "__unstableUseBlockSelectionClearer", function() { return /* reexport */ useBlockSelectionClearer; }); 7123 __webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ block_settings_menu; }); 7124 __webpack_require__.d(__webpack_exports__, "BlockSettingsMenuControls", function() { return /* reexport */ block_settings_menu_controls; }); 7125 __webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; }); 7126 __webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; }); 7127 __webpack_require__.d(__webpack_exports__, "BlockTools", function() { return /* reexport */ BlockTools; }); 7128 __webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ copy_handler; }); 7129 __webpack_require__.d(__webpack_exports__, "__unstableUseClipboardHandler", function() { return /* reexport */ useClipboardHandler; }); 7130 __webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ default_block_appender; }); 7131 __webpack_require__.d(__webpack_exports__, "__unstableEditorStyles", function() { return /* reexport */ EditorStyles; }); 7132 __webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ inserter; }); 7133 __webpack_require__.d(__webpack_exports__, "__experimentalLibrary", function() { return /* reexport */ library; }); 7134 __webpack_require__.d(__webpack_exports__, "__experimentalSearchForm", function() { return /* reexport */ search_form; }); 7135 __webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ keyboard_shortcuts; }); 7136 __webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; }); 7137 __webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ navigable_toolbar; }); 7138 __webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ observe_typing; }); 7139 __webpack_require__.d(__webpack_exports__, "__unstableUseTypingObserver", function() { return /* reexport */ useTypingObserver; }); 7140 __webpack_require__.d(__webpack_exports__, "__unstableUseMouseMoveTypingReset", function() { return /* reexport */ useMouseMoveTypingReset; }); 7141 __webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; }); 7142 __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ skip_to_selected_block; }); 7143 __webpack_require__.d(__webpack_exports__, "Typewriter", function() { return /* reexport */ typewriter; }); 7144 __webpack_require__.d(__webpack_exports__, "__unstableUseTypewriter", function() { return /* reexport */ useTypewriter; }); 7145 __webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ warning; }); 7146 __webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ writing_flow; }); 7147 __webpack_require__.d(__webpack_exports__, "__unstableUseCanvasClickRedirect", function() { return /* reexport */ useCanvasClickRedirect; }); 7148 __webpack_require__.d(__webpack_exports__, "useBlockDisplayInformation", function() { return /* reexport */ useBlockDisplayInformation; }); 7149 __webpack_require__.d(__webpack_exports__, "__unstableIframe", function() { return /* reexport */ iframe; }); 7150 __webpack_require__.d(__webpack_exports__, "__experimentalUseNoRecursiveRenders", function() { return /* reexport */ useNoRecursiveRenders; }); 7151 __webpack_require__.d(__webpack_exports__, "BlockEditorProvider", function() { return /* reexport */ provider; }); 7152 __webpack_require__.d(__webpack_exports__, "__experimentalUseSimulatedMediaQuery", function() { return /* reexport */ useSimulatedMediaQuery; }); 7153 __webpack_require__.d(__webpack_exports__, "useSetting", function() { return /* reexport */ useSetting; }); 7154 __webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ transform_styles; }); 7155 __webpack_require__.d(__webpack_exports__, "validateThemeColors", function() { return /* reexport */ validateThemeColors; }); 7156 __webpack_require__.d(__webpack_exports__, "validateThemeGradients", function() { return /* reexport */ validateThemeGradients; }); 7157 __webpack_require__.d(__webpack_exports__, "__experimentalGetMatchingVariation", function() { return /* reexport */ __experimentalGetMatchingVariation; }); 7158 __webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; }); 7159 __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; }); 7160 __webpack_require__.d(__webpack_exports__, "SETTINGS_DEFAULTS", function() { return /* reexport */ SETTINGS_DEFAULTS; }); 7161 7162 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js 7163 var selectors_namespaceObject = {}; 7164 __webpack_require__.r(selectors_namespaceObject); 7165 __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return selectors_getBlockName; }); 7166 __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return selectors_isBlockValid; }); 7167 __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return selectors_getBlockAttributes; }); 7168 __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return selectors_getBlock; }); 7169 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return selectors_unstableGetBlockWithoutInnerBlocks; }); 7170 __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); 7171 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithBlockTree", function() { return __unstableGetBlockWithBlockTree; }); 7172 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockTree", function() { return __unstableGetBlockTree; }); 7173 __webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdWithClientIdsTree", function() { return selectors_unstableGetClientIdWithClientIdsTree; }); 7174 __webpack_require__.d(selectors_namespaceObject, "__unstableGetClientIdsTree", function() { return selectors_unstableGetClientIdsTree; }); 7175 __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return selectors_getClientIdsOfDescendants; }); 7176 __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; }); 7177 __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return selectors_getGlobalBlockCount; }); 7178 __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return selectors_getBlocksByClientId; }); 7179 __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return selectors_getBlockCount; }); 7180 __webpack_require__.d(selectors_namespaceObject, "getSelectionStart", function() { return selectors_getSelectionStart; }); 7181 __webpack_require__.d(selectors_namespaceObject, "getSelectionEnd", function() { return selectors_getSelectionEnd; }); 7182 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return selectors_getBlockSelectionStart; }); 7183 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return selectors_getBlockSelectionEnd; }); 7184 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return selectors_getSelectedBlockCount; }); 7185 __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return selectors_hasSelectedBlock; }); 7186 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return selectors_getSelectedBlockClientId; }); 7187 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return selectors_getSelectedBlock; }); 7188 __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return selectors_getBlockRootClientId; }); 7189 __webpack_require__.d(selectors_namespaceObject, "getBlockParents", function() { return selectors_getBlockParents; }); 7190 __webpack_require__.d(selectors_namespaceObject, "getBlockParentsByBlockName", function() { return getBlockParentsByBlockName; }); 7191 __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return selectors_getBlockHierarchyRootClientId; }); 7192 __webpack_require__.d(selectors_namespaceObject, "getLowestCommonAncestorWithSelectedBlock", function() { return getLowestCommonAncestorWithSelectedBlock; }); 7193 __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); 7194 __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return selectors_getPreviousBlockClientId; }); 7195 __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return selectors_getNextBlockClientId; }); 7196 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return selectors_getSelectedBlocksInitialCaretPosition; }); 7197 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientIds", function() { return selectors_getSelectedBlockClientIds; }); 7198 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return selectors_getMultiSelectedBlockClientIds; }); 7199 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return selectors_getMultiSelectedBlocks; }); 7200 __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return selectors_getFirstMultiSelectedBlockClientId; }); 7201 __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return selectors_getLastMultiSelectedBlockClientId; }); 7202 __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return selectors_isFirstMultiSelectedBlock; }); 7203 __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return selectors_isBlockMultiSelected; }); 7204 __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return selectors_isAncestorMultiSelected; }); 7205 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return selectors_getMultiSelectedBlocksStartClientId; }); 7206 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return selectors_getMultiSelectedBlocksEndClientId; }); 7207 __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return selectors_getBlockOrder; }); 7208 __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return selectors_getBlockIndex; }); 7209 __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return selectors_isBlockSelected; }); 7210 __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return selectors_hasSelectedInnerBlock; }); 7211 __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; }); 7212 __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return selectors_hasMultiSelection; }); 7213 __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return selectors_isMultiSelecting; }); 7214 __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return selectors_isSelectionEnabled; }); 7215 __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return selectors_getBlockMode; }); 7216 __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return selectors_isTyping; }); 7217 __webpack_require__.d(selectors_namespaceObject, "isDraggingBlocks", function() { return isDraggingBlocks; }); 7218 __webpack_require__.d(selectors_namespaceObject, "getDraggedBlockClientIds", function() { return selectors_getDraggedBlockClientIds; }); 7219 __webpack_require__.d(selectors_namespaceObject, "isBlockBeingDragged", function() { return selectors_isBlockBeingDragged; }); 7220 __webpack_require__.d(selectors_namespaceObject, "isAncestorBeingDragged", function() { return selectors_isAncestorBeingDragged; }); 7221 __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return selectors_isCaretWithinFormattedText; }); 7222 __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return selectors_getBlockInsertionPoint; }); 7223 __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return selectors_isBlockInsertionPointVisible; }); 7224 __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return selectors_isValidTemplate; }); 7225 __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; }); 7226 __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return selectors_getTemplateLock; }); 7227 __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return selectors_canInsertBlockType; }); 7228 __webpack_require__.d(selectors_namespaceObject, "canInsertBlocks", function() { return selectors_canInsertBlocks; }); 7229 __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; }); 7230 __webpack_require__.d(selectors_namespaceObject, "getBlockTransformItems", function() { return selectors_getBlockTransformItems; }); 7231 __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return selectors_hasInserterItems; }); 7232 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedBlocks", function() { return selectors_experimentalGetAllowedBlocks; }); 7233 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedPattern", function() { return __experimentalGetParsedPattern; }); 7234 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllowedPatterns", function() { return selectors_experimentalGetAllowedPatterns; }); 7235 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternsByBlockTypes", function() { return selectors_experimentalGetPatternsByBlockTypes; }); 7236 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetPatternTransformItems", function() { return selectors_experimentalGetPatternTransformItems; }); 7237 __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return selectors_getBlockListSettings; }); 7238 __webpack_require__.d(selectors_namespaceObject, "getSettings", function() { return selectors_getSettings; }); 7239 __webpack_require__.d(selectors_namespaceObject, "isLastBlockChangePersistent", function() { return selectors_isLastBlockChangePersistent; }); 7240 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetBlockListSettingsForBlocks", function() { return selectors_experimentalGetBlockListSettingsForBlocks; }); 7241 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetParsedReusableBlock", function() { return __experimentalGetParsedReusableBlock; }); 7242 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlockTitle", function() { return selectors_experimentalGetReusableBlockTitle; }); 7243 __webpack_require__.d(selectors_namespaceObject, "__unstableIsLastBlockChangeIgnored", function() { return selectors_unstableIsLastBlockChangeIgnored; }); 7244 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetLastBlockAttributeChanges", function() { return __experimentalGetLastBlockAttributeChanges; }); 7245 __webpack_require__.d(selectors_namespaceObject, "isNavigationMode", function() { return selectors_isNavigationMode; }); 7246 __webpack_require__.d(selectors_namespaceObject, "hasBlockMovingClientId", function() { return selectors_hasBlockMovingClientId; }); 7247 __webpack_require__.d(selectors_namespaceObject, "didAutomaticChange", function() { return selectors_didAutomaticChange; }); 7248 __webpack_require__.d(selectors_namespaceObject, "isBlockHighlighted", function() { return selectors_isBlockHighlighted; }); 7249 __webpack_require__.d(selectors_namespaceObject, "areInnerBlocksControlled", function() { return areInnerBlocksControlled; }); 7250 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetActiveBlockIdByBlockNames", function() { return __experimentalGetActiveBlockIdByBlockNames; }); 7251 __webpack_require__.d(selectors_namespaceObject, "wasBlockJustInserted", function() { return wasBlockJustInserted; }); 7252 7253 // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js 7254 var actions_namespaceObject = {}; 7255 __webpack_require__.r(actions_namespaceObject); 7256 __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return actions_resetBlocks; }); 7257 __webpack_require__.d(actions_namespaceObject, "validateBlocksToTemplate", function() { return validateBlocksToTemplate; }); 7258 __webpack_require__.d(actions_namespaceObject, "resetSelection", function() { return actions_resetSelection; }); 7259 __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); 7260 __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return actions_updateBlockAttributes; }); 7261 __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return actions_updateBlock; }); 7262 __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; }); 7263 __webpack_require__.d(actions_namespaceObject, "selectPreviousBlock", function() { return selectPreviousBlock; }); 7264 __webpack_require__.d(actions_namespaceObject, "selectNextBlock", function() { return selectNextBlock; }); 7265 __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return actions_startMultiSelect; }); 7266 __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return actions_stopMultiSelect; }); 7267 __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return actions_multiSelect; }); 7268 __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; }); 7269 __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return actions_toggleSelection; }); 7270 __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return actions_replaceBlocks; }); 7271 __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return actions_replaceBlock; }); 7272 __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return actions_moveBlocksDown; }); 7273 __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return actions_moveBlocksUp; }); 7274 __webpack_require__.d(actions_namespaceObject, "moveBlocksToPosition", function() { return actions_moveBlocksToPosition; }); 7275 __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return actions_moveBlockToPosition; }); 7276 __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return actions_insertBlock; }); 7277 __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; }); 7278 __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return actions_showInsertionPoint; }); 7279 __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return actions_hideInsertionPoint; }); 7280 __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return setTemplateValidity; }); 7281 __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return synchronizeTemplate; }); 7282 __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return actions_mergeBlocks; }); 7283 __webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return actions_removeBlocks; }); 7284 __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return actions_removeBlock; }); 7285 __webpack_require__.d(actions_namespaceObject, "replaceInnerBlocks", function() { return actions_replaceInnerBlocks; }); 7286 __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; }); 7287 __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return actions_startTyping; }); 7288 __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return actions_stopTyping; }); 7289 __webpack_require__.d(actions_namespaceObject, "startDraggingBlocks", function() { return actions_startDraggingBlocks; }); 7290 __webpack_require__.d(actions_namespaceObject, "stopDraggingBlocks", function() { return actions_stopDraggingBlocks; }); 7291 __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return actions_enterFormattedText; }); 7292 __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return actions_exitFormattedText; }); 7293 __webpack_require__.d(actions_namespaceObject, "selectionChange", function() { return actions_selectionChange; }); 7294 __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; }); 7295 __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return actions_updateBlockListSettings; }); 7296 __webpack_require__.d(actions_namespaceObject, "updateSettings", function() { return actions_updateSettings; }); 7297 __webpack_require__.d(actions_namespaceObject, "__unstableSaveReusableBlock", function() { return __unstableSaveReusableBlock; }); 7298 __webpack_require__.d(actions_namespaceObject, "__unstableMarkLastChangeAsPersistent", function() { return actions_unstableMarkLastChangeAsPersistent; }); 7299 __webpack_require__.d(actions_namespaceObject, "__unstableMarkNextChangeAsNotPersistent", function() { return actions_unstableMarkNextChangeAsNotPersistent; }); 7300 __webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChange", function() { return actions_unstableMarkAutomaticChange; }); 7301 __webpack_require__.d(actions_namespaceObject, "__unstableMarkAutomaticChangeFinal", function() { return __unstableMarkAutomaticChangeFinal; }); 7302 __webpack_require__.d(actions_namespaceObject, "setNavigationMode", function() { return actions_setNavigationMode; }); 7303 __webpack_require__.d(actions_namespaceObject, "setBlockMovingClientId", function() { return actions_setBlockMovingClientId; }); 7304 __webpack_require__.d(actions_namespaceObject, "duplicateBlocks", function() { return actions_duplicateBlocks; }); 7305 __webpack_require__.d(actions_namespaceObject, "insertBeforeBlock", function() { return actions_insertBeforeBlock; }); 7306 __webpack_require__.d(actions_namespaceObject, "insertAfterBlock", function() { return actions_insertAfterBlock; }); 7307 __webpack_require__.d(actions_namespaceObject, "toggleBlockHighlight", function() { return actions_toggleBlockHighlight; }); 7308 __webpack_require__.d(actions_namespaceObject, "flashBlock", function() { return actions_flashBlock; }); 7309 __webpack_require__.d(actions_namespaceObject, "setHasControlledInnerBlocks", function() { return actions_setHasControlledInnerBlocks; }); 7310 7311 // EXTERNAL MODULE: external ["wp","richText"] 7312 var external_wp_richText_ = __webpack_require__("qRz9"); 7313 7314 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 7315 var esm_extends = __webpack_require__("wx14"); 7316 7317 // EXTERNAL MODULE: external ["wp","element"] 7318 var external_wp_element_ = __webpack_require__("GRId"); 7319 7320 // EXTERNAL MODULE: ./node_modules/classnames/index.js 7321 var classnames = __webpack_require__("TSYQ"); 7322 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 7323 7324 // EXTERNAL MODULE: external "lodash" 7325 var external_lodash_ = __webpack_require__("YLtl"); 7326 7327 // EXTERNAL MODULE: external ["wp","compose"] 7328 var external_wp_compose_ = __webpack_require__("K9lf"); 7329 7330 // EXTERNAL MODULE: external ["wp","hooks"] 7331 var external_wp_hooks_ = __webpack_require__("g56x"); 7332 7333 // EXTERNAL MODULE: external ["wp","blocks"] 7334 var external_wp_blocks_ = __webpack_require__("HSyU"); 7335 7336 // EXTERNAL MODULE: external ["wp","components"] 7337 var external_wp_components_ = __webpack_require__("tI+e"); 7338 7339 // EXTERNAL MODULE: external ["wp","data"] 7340 var external_wp_data_ = __webpack_require__("1ZqX"); 7341 7342 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js 7343 /** 7344 * WordPress dependencies 7345 */ 7346 7347 const Context = Object(external_wp_element_["createContext"])({ 7348 name: '', 7349 isSelected: false, 7350 clientId: null 7351 }); 7352 const { 7353 Provider: context_Provider 7354 } = Context; 7355 7356 /** 7357 * A hook that returns the block edit context. 7358 * 7359 * @return {Object} Block edit context 7360 */ 7361 7362 function useBlockEditContext() { 7363 return Object(external_wp_element_["useContext"])(Context); 7364 } 7365 7366 // EXTERNAL MODULE: external ["wp","i18n"] 7367 var external_wp_i18n_ = __webpack_require__("l3Sj"); 7368 7369 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/defaults.js 7370 /** 7371 * WordPress dependencies 7372 */ 7373 7374 const PREFERENCES_DEFAULTS = { 7375 insertUsage: {} 7376 }; 7377 /** 7378 * The default editor settings 7379 * 7380 * @typedef {Object} SETTINGS_DEFAULT 7381 * @property {boolean} alignWide Enable/Disable Wide/Full Alignments 7382 * @property {boolean} supportsLayout Enable/disable layouts support in container blocks. 7383 * @property {boolean} imageEditing Image Editing settings set to false to disable. 7384 * @property {Array} imageSizes Available image sizes 7385 * @property {number} maxWidth Max width to constraint resizing 7386 * @property {boolean|Array} allowedBlockTypes Allowed block types 7387 * @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed 7388 * @property {boolean} focusMode Whether the focus mode is enabled or not 7389 * @property {Array} styles Editor Styles 7390 * @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode 7391 * @property {string} bodyPlaceholder Empty post placeholder 7392 * @property {string} titlePlaceholder Empty title placeholder 7393 * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor 7394 * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes. 7395 * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory 7396 * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns 7397 * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories 7398 */ 7399 7400 const SETTINGS_DEFAULTS = { 7401 alignWide: false, 7402 supportsLayout: true, 7403 // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. 7404 // The setting is only kept for backward compatibility purposes. 7405 colors: [{ 7406 name: Object(external_wp_i18n_["__"])('Black'), 7407 slug: 'black', 7408 color: '#000000' 7409 }, { 7410 name: Object(external_wp_i18n_["__"])('Cyan bluish gray'), 7411 slug: 'cyan-bluish-gray', 7412 color: '#abb8c3' 7413 }, { 7414 name: Object(external_wp_i18n_["__"])('White'), 7415 slug: 'white', 7416 color: '#ffffff' 7417 }, { 7418 name: Object(external_wp_i18n_["__"])('Pale pink'), 7419 slug: 'pale-pink', 7420 color: '#f78da7' 7421 }, { 7422 name: Object(external_wp_i18n_["__"])('Vivid red'), 7423 slug: 'vivid-red', 7424 color: '#cf2e2e' 7425 }, { 7426 name: Object(external_wp_i18n_["__"])('Luminous vivid orange'), 7427 slug: 'luminous-vivid-orange', 7428 color: '#ff6900' 7429 }, { 7430 name: Object(external_wp_i18n_["__"])('Luminous vivid amber'), 7431 slug: 'luminous-vivid-amber', 7432 color: '#fcb900' 7433 }, { 7434 name: Object(external_wp_i18n_["__"])('Light green cyan'), 7435 slug: 'light-green-cyan', 7436 color: '#7bdcb5' 7437 }, { 7438 name: Object(external_wp_i18n_["__"])('Vivid green cyan'), 7439 slug: 'vivid-green-cyan', 7440 color: '#00d084' 7441 }, { 7442 name: Object(external_wp_i18n_["__"])('Pale cyan blue'), 7443 slug: 'pale-cyan-blue', 7444 color: '#8ed1fc' 7445 }, { 7446 name: Object(external_wp_i18n_["__"])('Vivid cyan blue'), 7447 slug: 'vivid-cyan-blue', 7448 color: '#0693e3' 7449 }, { 7450 name: Object(external_wp_i18n_["__"])('Vivid purple'), 7451 slug: 'vivid-purple', 7452 color: '#9b51e0' 7453 }], 7454 // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. 7455 // The setting is only kept for backward compatibility purposes. 7456 fontSizes: [{ 7457 name: Object(external_wp_i18n_["_x"])('Small', 'font size name'), 7458 size: 13, 7459 slug: 'small' 7460 }, { 7461 name: Object(external_wp_i18n_["_x"])('Normal', 'font size name'), 7462 size: 16, 7463 slug: 'normal' 7464 }, { 7465 name: Object(external_wp_i18n_["_x"])('Medium', 'font size name'), 7466 size: 20, 7467 slug: 'medium' 7468 }, { 7469 name: Object(external_wp_i18n_["_x"])('Large', 'font size name'), 7470 size: 36, 7471 slug: 'large' 7472 }, { 7473 name: Object(external_wp_i18n_["_x"])('Huge', 'font size name'), 7474 size: 42, 7475 slug: 'huge' 7476 }], 7477 // Image default size slug. 7478 imageDefaultSize: 'large', 7479 imageSizes: [{ 7480 slug: 'thumbnail', 7481 name: Object(external_wp_i18n_["__"])('Thumbnail') 7482 }, { 7483 slug: 'medium', 7484 name: Object(external_wp_i18n_["__"])('Medium') 7485 }, { 7486 slug: 'large', 7487 name: Object(external_wp_i18n_["__"])('Large') 7488 }, { 7489 slug: 'full', 7490 name: Object(external_wp_i18n_["__"])('Full Size') 7491 }], 7492 // Allow plugin to disable Image Editor if need be 7493 imageEditing: true, 7494 // This is current max width of the block inner area 7495 // It's used to constraint image resizing and this value could be overridden later by themes 7496 maxWidth: 580, 7497 // Allowed block types for the editor, defaulting to true (all supported). 7498 allowedBlockTypes: true, 7499 // Maximum upload size in bytes allowed for the site. 7500 maxUploadFileSize: 0, 7501 // List of allowed mime types and file extensions. 7502 allowedMimeTypes: null, 7503 __experimentalCanUserUseUnfilteredHTML: false, 7504 __experimentalBlockDirectory: false, 7505 __mobileEnablePageTemplates: false, 7506 __experimentalBlockPatterns: [], 7507 __experimentalBlockPatternCategories: [], 7508 __experimentalSpotlightEntityBlocks: [], 7509 // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults. 7510 // The setting is only kept for backward compatibility purposes. 7511 gradients: [{ 7512 name: Object(external_wp_i18n_["__"])('Vivid cyan blue to vivid purple'), 7513 gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)', 7514 slug: 'vivid-cyan-blue-to-vivid-purple' 7515 }, { 7516 name: Object(external_wp_i18n_["__"])('Light green cyan to vivid green cyan'), 7517 gradient: 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)', 7518 slug: 'light-green-cyan-to-vivid-green-cyan' 7519 }, { 7520 name: Object(external_wp_i18n_["__"])('Luminous vivid amber to luminous vivid orange'), 7521 gradient: 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)', 7522 slug: 'luminous-vivid-amber-to-luminous-vivid-orange' 7523 }, { 7524 name: Object(external_wp_i18n_["__"])('Luminous vivid orange to vivid red'), 7525 gradient: 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)', 7526 slug: 'luminous-vivid-orange-to-vivid-red' 7527 }, { 7528 name: Object(external_wp_i18n_["__"])('Very light gray to cyan bluish gray'), 7529 gradient: 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)', 7530 slug: 'very-light-gray-to-cyan-bluish-gray' 7531 }, { 7532 name: Object(external_wp_i18n_["__"])('Cool to warm spectrum'), 7533 gradient: 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)', 7534 slug: 'cool-to-warm-spectrum' 7535 }, { 7536 name: Object(external_wp_i18n_["__"])('Blush light purple'), 7537 gradient: 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)', 7538 slug: 'blush-light-purple' 7539 }, { 7540 name: Object(external_wp_i18n_["__"])('Blush bordeaux'), 7541 gradient: 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)', 7542 slug: 'blush-bordeaux' 7543 }, { 7544 name: Object(external_wp_i18n_["__"])('Luminous dusk'), 7545 gradient: 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)', 7546 slug: 'luminous-dusk' 7547 }, { 7548 name: Object(external_wp_i18n_["__"])('Pale ocean'), 7549 gradient: 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)', 7550 slug: 'pale-ocean' 7551 }, { 7552 name: Object(external_wp_i18n_["__"])('Electric grass'), 7553 gradient: 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)', 7554 slug: 'electric-grass' 7555 }, { 7556 name: Object(external_wp_i18n_["__"])('Midnight'), 7557 gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)', 7558 slug: 'midnight' 7559 }] 7560 }; 7561 7562 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/array.js 7563 /** 7564 * External dependencies 7565 */ 7566 7567 /** 7568 * Insert one or multiple elements into a given position of an array. 7569 * 7570 * @param {Array} array Source array. 7571 * @param {*} elements Elements to insert. 7572 * @param {number} index Insert Position. 7573 * 7574 * @return {Array} Result. 7575 */ 7576 7577 function insertAt(array, elements, index) { 7578 return [...array.slice(0, index), ...Object(external_lodash_["castArray"])(elements), ...array.slice(index)]; 7579 } 7580 /** 7581 * Moves an element in an array. 7582 * 7583 * @param {Array} array Source array. 7584 * @param {number} from Source index. 7585 * @param {number} to Destination index. 7586 * @param {number} count Number of elements to move. 7587 * 7588 * @return {Array} Result. 7589 */ 7590 7591 function moveTo(array, from, to, count = 1) { 7592 const withoutMovedElements = [...array]; 7593 withoutMovedElements.splice(from, count); 7594 return insertAt(withoutMovedElements, array.slice(from, from + count), to); 7595 } 7596 7597 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/reducer.js 7598 /** 7599 * External dependencies 7600 */ 7601 7602 /** 7603 * WordPress dependencies 7604 */ 7605 7606 7607 7608 /** 7609 * Internal dependencies 7610 */ 7611 7612 7613 7614 /** 7615 * Given an array of blocks, returns an object where each key is a nesting 7616 * context, the value of which is an array of block client IDs existing within 7617 * that nesting context. 7618 * 7619 * @param {Array} blocks Blocks to map. 7620 * @param {?string} rootClientId Assumed root client ID. 7621 * 7622 * @return {Object} Block order map object. 7623 */ 7624 7625 function mapBlockOrder(blocks, rootClientId = '') { 7626 const result = { 7627 [rootClientId]: [] 7628 }; 7629 blocks.forEach(block => { 7630 const { 7631 clientId, 7632 innerBlocks 7633 } = block; 7634 result[rootClientId].push(clientId); 7635 Object.assign(result, mapBlockOrder(innerBlocks, clientId)); 7636 }); 7637 return result; 7638 } 7639 /** 7640 * Given an array of blocks, returns an object where each key contains 7641 * the clientId of the block and the value is the parent of the block. 7642 * 7643 * @param {Array} blocks Blocks to map. 7644 * @param {?string} rootClientId Assumed root client ID. 7645 * 7646 * @return {Object} Block order map object. 7647 */ 7648 7649 7650 function mapBlockParents(blocks, rootClientId = '') { 7651 return blocks.reduce((result, block) => Object.assign(result, { 7652 [block.clientId]: rootClientId 7653 }, mapBlockParents(block.innerBlocks, block.clientId)), {}); 7654 } 7655 /** 7656 * Helper method to iterate through all blocks, recursing into inner blocks, 7657 * applying a transformation function to each one. 7658 * Returns a flattened object with the transformed blocks. 7659 * 7660 * @param {Array} blocks Blocks to flatten. 7661 * @param {Function} transform Transforming function to be applied to each block. 7662 * 7663 * @return {Object} Flattened object. 7664 */ 7665 7666 7667 function flattenBlocks(blocks, transform = external_lodash_["identity"]) { 7668 const result = {}; 7669 const stack = [...blocks]; 7670 7671 while (stack.length) { 7672 const { 7673 innerBlocks, 7674 ...block 7675 } = stack.shift(); 7676 stack.push(...innerBlocks); 7677 result[block.clientId] = transform(block); 7678 } 7679 7680 return result; 7681 } 7682 /** 7683 * Given an array of blocks, returns an object containing all blocks, without 7684 * attributes, recursing into inner blocks. Keys correspond to the block client 7685 * ID, the value of which is the attributes object. 7686 * 7687 * @param {Array} blocks Blocks to flatten. 7688 * 7689 * @return {Object} Flattened block attributes object. 7690 */ 7691 7692 7693 function getFlattenedBlocksWithoutAttributes(blocks) { 7694 return flattenBlocks(blocks, block => Object(external_lodash_["omit"])(block, 'attributes')); 7695 } 7696 /** 7697 * Given an array of blocks, returns an object containing all block attributes, 7698 * recursing into inner blocks. Keys correspond to the block client ID, the 7699 * value of which is the attributes object. 7700 * 7701 * @param {Array} blocks Blocks to flatten. 7702 * 7703 * @return {Object} Flattened block attributes object. 7704 */ 7705 7706 7707 function getFlattenedBlockAttributes(blocks) { 7708 return flattenBlocks(blocks, block => block.attributes); 7709 } 7710 /** 7711 * Given a block order map object, returns *all* of the block client IDs that are 7712 * a descendant of the given root client ID. 7713 * 7714 * Calling this with `rootClientId` set to `''` results in a list of client IDs 7715 * that are in the post. That is, it excludes blocks like fetched reusable 7716 * blocks which are stored into state but not visible. It also excludes 7717 * InnerBlocks controllers, like template parts. 7718 * 7719 * It is important to exclude the full inner block controller and not just the 7720 * inner blocks because in many cases, we need to persist the previous value of 7721 * an inner block controller. To do so, it must be excluded from the list of 7722 * client IDs which are considered to be part of the top-level entity. 7723 * 7724 * @param {Object} blocksOrder Object that maps block client IDs to a list of 7725 * nested block client IDs. 7726 * @param {?string} rootClientId The root client ID to search. Defaults to ''. 7727 * @param {?Object} controlledInnerBlocks The InnerBlocks controller state. 7728 * 7729 * @return {Array} List of descendant client IDs. 7730 */ 7731 7732 7733 function getNestedBlockClientIds(blocksOrder, rootClientId = '', controlledInnerBlocks = {}) { 7734 return Object(external_lodash_["reduce"])(blocksOrder[rootClientId], (result, clientId) => { 7735 if (!!controlledInnerBlocks[clientId]) { 7736 return result; 7737 } 7738 7739 return [...result, clientId, ...getNestedBlockClientIds(blocksOrder, clientId)]; 7740 }, []); 7741 } 7742 /** 7743 * Returns an object against which it is safe to perform mutating operations, 7744 * given the original object and its current working copy. 7745 * 7746 * @param {Object} original Original object. 7747 * @param {Object} working Working object. 7748 * 7749 * @return {Object} Mutation-safe object. 7750 */ 7751 7752 7753 function getMutateSafeObject(original, working) { 7754 if (original === working) { 7755 return { ...original 7756 }; 7757 } 7758 7759 return working; 7760 } 7761 /** 7762 * Returns true if the two object arguments have the same keys, or false 7763 * otherwise. 7764 * 7765 * @param {Object} a First object. 7766 * @param {Object} b Second object. 7767 * 7768 * @return {boolean} Whether the two objects have the same keys. 7769 */ 7770 7771 7772 function hasSameKeys(a, b) { 7773 return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b)); 7774 } 7775 /** 7776 * Returns true if, given the currently dispatching action and the previously 7777 * dispatched action, the two actions are updating the same block attribute, or 7778 * false otherwise. 7779 * 7780 * @param {Object} action Currently dispatching action. 7781 * @param {Object} lastAction Previously dispatched action. 7782 * 7783 * @return {boolean} Whether actions are updating the same block attribute. 7784 */ 7785 7786 function isUpdatingSameBlockAttribute(action, lastAction) { 7787 return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && Object(external_lodash_["isEqual"])(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes); 7788 } 7789 /** 7790 * Utility returning an object with an empty object value for each key. 7791 * 7792 * @param {Array} objectKeys Keys to fill. 7793 * @return {Object} Object filled with empty object as values for each clientId. 7794 */ 7795 7796 const fillKeysWithEmptyObject = objectKeys => { 7797 return objectKeys.reduce((result, key) => { 7798 result[key] = {}; 7799 return result; 7800 }, {}); 7801 }; 7802 /** 7803 * Higher-order reducer intended to compute a cache key for each block in the post. 7804 * A new instance of the cache key (empty object) is created each time the block object 7805 * needs to be refreshed (for any change in the block or its children). 7806 * 7807 * @param {Function} reducer Original reducer function. 7808 * 7809 * @return {Function} Enhanced reducer function. 7810 */ 7811 7812 7813 const withBlockCache = reducer => (state = {}, action) => { 7814 const newState = reducer(state, action); 7815 7816 if (newState === state) { 7817 return state; 7818 } 7819 7820 newState.cache = state.cache ? state.cache : {}; 7821 /** 7822 * For each clientId provided, traverses up parents, adding the provided clientIds 7823 * and each parent's clientId to the returned array. 7824 * 7825 * When calling this function consider that it uses the old state, so any state 7826 * modifications made by the `reducer` will not be present. 7827 * 7828 * @param {Array} clientIds an Array of block clientIds. 7829 * 7830 * @return {Array} The provided clientIds and all of their parent clientIds. 7831 */ 7832 7833 const getBlocksWithParentsClientIds = clientIds => { 7834 return clientIds.reduce((result, clientId) => { 7835 let current = clientId; 7836 7837 do { 7838 result.push(current); 7839 current = state.parents[current]; 7840 } while (current && !state.controlledInnerBlocks[current]); 7841 7842 return result; 7843 }, []); 7844 }; 7845 7846 switch (action.type) { 7847 case 'RESET_BLOCKS': 7848 newState.cache = Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({})); 7849 break; 7850 7851 case 'RECEIVE_BLOCKS': 7852 case 'INSERT_BLOCKS': 7853 { 7854 const updatedBlockUids = Object(external_lodash_["keys"])(flattenBlocks(action.blocks)); 7855 7856 if (action.rootClientId && !state.controlledInnerBlocks[action.rootClientId]) { 7857 updatedBlockUids.push(action.rootClientId); 7858 } 7859 7860 newState.cache = { ...newState.cache, 7861 ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) 7862 }; 7863 break; 7864 } 7865 7866 case 'UPDATE_BLOCK': 7867 newState.cache = { ...newState.cache, 7868 ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds([action.clientId])) 7869 }; 7870 break; 7871 7872 case 'UPDATE_BLOCK_ATTRIBUTES': 7873 newState.cache = { ...newState.cache, 7874 ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.clientIds)) 7875 }; 7876 break; 7877 7878 case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': 7879 const parentClientIds = fillKeysWithEmptyObject(getBlocksWithParentsClientIds(action.replacedClientIds)); 7880 newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.replacedClientIds), 7881 ...Object(external_lodash_["omit"])(parentClientIds, action.replacedClientIds), 7882 ...fillKeysWithEmptyObject(Object(external_lodash_["keys"])(flattenBlocks(action.blocks))) 7883 }; 7884 break; 7885 7886 case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': 7887 newState.cache = { ...Object(external_lodash_["omit"])(newState.cache, action.removedClientIds), 7888 ...fillKeysWithEmptyObject(Object(external_lodash_["difference"])(getBlocksWithParentsClientIds(action.clientIds), action.clientIds)) 7889 }; 7890 break; 7891 7892 case 'MOVE_BLOCKS_TO_POSITION': 7893 { 7894 const updatedBlockUids = [...action.clientIds]; 7895 7896 if (action.fromRootClientId) { 7897 updatedBlockUids.push(action.fromRootClientId); 7898 } 7899 7900 if (action.toRootClientId) { 7901 updatedBlockUids.push(action.toRootClientId); 7902 } 7903 7904 newState.cache = { ...newState.cache, 7905 ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) 7906 }; 7907 break; 7908 } 7909 7910 case 'MOVE_BLOCKS_UP': 7911 case 'MOVE_BLOCKS_DOWN': 7912 { 7913 const updatedBlockUids = []; 7914 7915 if (action.rootClientId) { 7916 updatedBlockUids.push(action.rootClientId); 7917 } 7918 7919 newState.cache = { ...newState.cache, 7920 ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) 7921 }; 7922 break; 7923 } 7924 7925 case 'SAVE_REUSABLE_BLOCK_SUCCESS': 7926 { 7927 const updatedBlockUids = Object(external_lodash_["keys"])(Object(external_lodash_["omitBy"])(newState.attributes, (attributes, clientId) => { 7928 return newState.byClientId[clientId].name !== 'core/block' || attributes.ref !== action.updatedId; 7929 })); 7930 newState.cache = { ...newState.cache, 7931 ...fillKeysWithEmptyObject(getBlocksWithParentsClientIds(updatedBlockUids)) 7932 }; 7933 } 7934 } 7935 7936 return newState; 7937 }; 7938 /** 7939 * Higher-order reducer intended to augment the blocks reducer, assigning an 7940 * `isPersistentChange` property value corresponding to whether a change in 7941 * state can be considered as persistent. All changes are considered persistent 7942 * except when updating the same block attribute as in the previous action. 7943 * 7944 * @param {Function} reducer Original reducer function. 7945 * 7946 * @return {Function} Enhanced reducer function. 7947 */ 7948 7949 7950 function withPersistentBlockChange(reducer) { 7951 let lastAction; 7952 let markNextChangeAsNotPersistent = false; 7953 return (state, action) => { 7954 let nextState = reducer(state, action); 7955 const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent; // Defer to previous state value (or default) unless changing or 7956 // explicitly marking as persistent. 7957 7958 if (state === nextState && !isExplicitPersistentChange) { 7959 var _state$isPersistentCh; 7960 7961 markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT'; 7962 const nextIsPersistentChange = (_state$isPersistentCh = state === null || state === void 0 ? void 0 : state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true; 7963 7964 if (state.isPersistentChange === nextIsPersistentChange) { 7965 return state; 7966 } 7967 7968 return { ...nextState, 7969 isPersistentChange: nextIsPersistentChange 7970 }; 7971 } 7972 7973 nextState = { ...nextState, 7974 isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction) 7975 }; // In comparing against the previous action, consider only those which 7976 // would have qualified as one which would have been ignored or not 7977 // have resulted in a changed state. 7978 7979 lastAction = action; 7980 markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT'; 7981 return nextState; 7982 }; 7983 } 7984 /** 7985 * Higher-order reducer intended to augment the blocks reducer, assigning an 7986 * `isIgnoredChange` property value corresponding to whether a change in state 7987 * can be considered as ignored. A change is considered ignored when the result 7988 * of an action not incurred by direct user interaction. 7989 * 7990 * @param {Function} reducer Original reducer function. 7991 * 7992 * @return {Function} Enhanced reducer function. 7993 */ 7994 7995 7996 function withIgnoredBlockChange(reducer) { 7997 /** 7998 * Set of action types for which a blocks state change should be ignored. 7999 * 8000 * @type {Set} 8001 */ 8002 const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']); 8003 return (state, action) => { 8004 const nextState = reducer(state, action); 8005 8006 if (nextState !== state) { 8007 nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type); 8008 } 8009 8010 return nextState; 8011 }; 8012 } 8013 /** 8014 * Higher-order reducer targeting the combined blocks reducer, augmenting 8015 * block client IDs in remove action to include cascade of inner blocks. 8016 * 8017 * @param {Function} reducer Original reducer function. 8018 * 8019 * @return {Function} Enhanced reducer function. 8020 */ 8021 8022 8023 const withInnerBlocksRemoveCascade = reducer => (state, action) => { 8024 // Gets all children which need to be removed. 8025 const getAllChildren = clientIds => { 8026 let result = clientIds; 8027 8028 for (let i = 0; i < result.length; i++) { 8029 if (!state.order[result[i]] || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) { 8030 continue; 8031 } 8032 8033 if (result === clientIds) { 8034 result = [...result]; 8035 } 8036 8037 result.push(...state.order[result[i]]); 8038 } 8039 8040 return result; 8041 }; 8042 8043 if (state) { 8044 switch (action.type) { 8045 case 'REMOVE_BLOCKS': 8046 action = { ...action, 8047 type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN', 8048 removedClientIds: getAllChildren(action.clientIds) 8049 }; 8050 break; 8051 8052 case 'REPLACE_BLOCKS': 8053 action = { ...action, 8054 type: 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN', 8055 replacedClientIds: getAllChildren(action.clientIds) 8056 }; 8057 break; 8058 } 8059 } 8060 8061 return reducer(state, action); 8062 }; 8063 /** 8064 * Higher-order reducer which targets the combined blocks reducer and handles 8065 * the `RESET_BLOCKS` action. When dispatched, this action will replace all 8066 * blocks that exist in the post, leaving blocks that exist only in state (e.g. 8067 * reusable blocks and blocks controlled by inner blocks controllers) alone. 8068 * 8069 * @param {Function} reducer Original reducer function. 8070 * 8071 * @return {Function} Enhanced reducer function. 8072 */ 8073 8074 8075 const withBlockReset = reducer => (state, action) => { 8076 if (state && action.type === 'RESET_BLOCKS') { 8077 /** 8078 * A list of client IDs associated with the top level entity (like a 8079 * post or template). It excludes the client IDs of blocks associated 8080 * with other entities, like inner block controllers or reusable blocks. 8081 */ 8082 const visibleClientIds = getNestedBlockClientIds(state.order, '', state.controlledInnerBlocks); // pickBy returns only the truthy values from controlledInnerBlocks 8083 8084 const controlledInnerBlocks = Object.keys(Object(external_lodash_["pickBy"])(state.controlledInnerBlocks)); 8085 /** 8086 * Each update operation consists of a few parts: 8087 * 1. First, the client IDs associated with the top level entity are 8088 * removed from the existing state key, leaving in place controlled 8089 * blocks (like reusable blocks and inner block controllers). 8090 * 2. Second, the blocks from the reset action are used to calculate the 8091 * individual state keys. This will re-populate the clientIDs which 8092 * were removed in step 1. 8093 * 3. In some cases, we remove the recalculated inner block controllers, 8094 * letting their old values persist. We need to do this because the 8095 * reset block action from a top-level entity is not aware of any 8096 * inner blocks inside InnerBlock controllers. So if the new values 8097 * were used, it would not take into account the existing InnerBlocks 8098 * which already exist in the state for inner block controllers. For 8099 * example, `attributes` uses the newly computed value for controllers 8100 * since attributes are stored in the top-level entity. But `order` 8101 * uses the previous value for the controllers since the new value 8102 * does not include the order of controlled inner blocks. So if the 8103 * new value was used, template parts would disappear from the editor 8104 * whenever you try to undo a change in the top level entity. 8105 */ 8106 8107 return { ...state, 8108 byClientId: { ...Object(external_lodash_["omit"])(state.byClientId, visibleClientIds), 8109 ...getFlattenedBlocksWithoutAttributes(action.blocks) 8110 }, 8111 attributes: { ...Object(external_lodash_["omit"])(state.attributes, visibleClientIds), 8112 ...getFlattenedBlockAttributes(action.blocks) 8113 }, 8114 order: { ...Object(external_lodash_["omit"])(state.order, visibleClientIds), 8115 ...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), controlledInnerBlocks) 8116 }, 8117 parents: { ...Object(external_lodash_["omit"])(state.parents, visibleClientIds), 8118 ...mapBlockParents(action.blocks) 8119 }, 8120 cache: { ...Object(external_lodash_["omit"])(state.cache, visibleClientIds), 8121 ...Object(external_lodash_["omit"])(Object(external_lodash_["mapValues"])(flattenBlocks(action.blocks), () => ({})), controlledInnerBlocks) 8122 } 8123 }; 8124 } 8125 8126 return reducer(state, action); 8127 }; 8128 /** 8129 * Higher-order reducer which targets the combined blocks reducer and handles 8130 * the `REPLACE_INNER_BLOCKS` action. When dispatched, this action the state 8131 * should become equivalent to the execution of a `REMOVE_BLOCKS` action 8132 * containing all the child's of the root block followed by the execution of 8133 * `INSERT_BLOCKS` with the new blocks. 8134 * 8135 * @param {Function} reducer Original reducer function. 8136 * 8137 * @return {Function} Enhanced reducer function. 8138 */ 8139 8140 8141 const withReplaceInnerBlocks = reducer => (state, action) => { 8142 if (action.type !== 'REPLACE_INNER_BLOCKS') { 8143 return reducer(state, action); 8144 } // Finds every nested inner block controller. We must check the action blocks 8145 // and not just the block parent state because some inner block controllers 8146 // should be deleted if specified, whereas others should not be deleted. If 8147 // a controlled should not be deleted, then we need to avoid deleting its 8148 // inner blocks from the block state because its inner blocks will not be 8149 // attached to the block in the action. 8150 8151 8152 const nestedControllers = {}; 8153 8154 if (Object.keys(state.controlledInnerBlocks).length) { 8155 const stack = [...action.blocks]; 8156 8157 while (stack.length) { 8158 const { 8159 innerBlocks, 8160 ...block 8161 } = stack.shift(); 8162 stack.push(...innerBlocks); 8163 8164 if (!!state.controlledInnerBlocks[block.clientId]) { 8165 nestedControllers[block.clientId] = true; 8166 } 8167 } 8168 } // The `keepControlledInnerBlocks` prop will keep the inner blocks of the 8169 // marked block in the block state so that they can be reattached to the 8170 // marked block when we re-insert everything a few lines below. 8171 8172 8173 let stateAfterBlocksRemoval = state; 8174 8175 if (state.order[action.rootClientId]) { 8176 stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, { 8177 type: 'REMOVE_BLOCKS', 8178 keepControlledInnerBlocks: nestedControllers, 8179 clientIds: state.order[action.rootClientId] 8180 }); 8181 } 8182 8183 let stateAfterInsert = stateAfterBlocksRemoval; 8184 8185 if (action.blocks.length) { 8186 stateAfterInsert = reducer(stateAfterInsert, { ...action, 8187 type: 'INSERT_BLOCKS', 8188 index: 0 8189 }); // We need to re-attach the block order of the controlled inner blocks. 8190 // Otherwise, an inner block controller's blocks will be deleted entirely 8191 // from its entity.. 8192 8193 stateAfterInsert.order = { ...stateAfterInsert.order, 8194 ...Object(external_lodash_["reduce"])(nestedControllers, (result, value, key) => { 8195 if (state.order[key]) { 8196 result[key] = state.order[key]; 8197 } 8198 8199 return result; 8200 }, {}) 8201 }; 8202 } 8203 8204 return stateAfterInsert; 8205 }; 8206 /** 8207 * Higher-order reducer which targets the combined blocks reducer and handles 8208 * the `SAVE_REUSABLE_BLOCK_SUCCESS` action. This action can't be handled by 8209 * regular reducers and needs a higher-order reducer since it needs access to 8210 * both `byClientId` and `attributes` simultaneously. 8211 * 8212 * @param {Function} reducer Original reducer function. 8213 * 8214 * @return {Function} Enhanced reducer function. 8215 */ 8216 8217 8218 const withSaveReusableBlock = reducer => (state, action) => { 8219 if (state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS') { 8220 const { 8221 id, 8222 updatedId 8223 } = action; // If a temporary reusable block is saved, we swap the temporary id with the final one 8224 8225 if (id === updatedId) { 8226 return state; 8227 } 8228 8229 state = { ...state 8230 }; 8231 state.attributes = Object(external_lodash_["mapValues"])(state.attributes, (attributes, clientId) => { 8232 const { 8233 name 8234 } = state.byClientId[clientId]; 8235 8236 if (name === 'core/block' && attributes.ref === id) { 8237 return { ...attributes, 8238 ref: updatedId 8239 }; 8240 } 8241 8242 return attributes; 8243 }); 8244 } 8245 8246 return reducer(state, action); 8247 }; 8248 /** 8249 * Reducer returning the blocks state. 8250 * 8251 * @param {Object} state Current state. 8252 * @param {Object} action Dispatched action. 8253 * 8254 * @return {Object} Updated state. 8255 */ 8256 8257 8258 const reducer_blocks = Object(external_lodash_["flow"])(external_wp_data_["combineReducers"], withSaveReusableBlock, // needs to be before withBlockCache 8259 withBlockCache, // needs to be before withInnerBlocksRemoveCascade 8260 withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // needs to be after withInnerBlocksRemoveCascade 8261 withBlockReset, withPersistentBlockChange, withIgnoredBlockChange)({ 8262 byClientId(state = {}, action) { 8263 switch (action.type) { 8264 case 'RESET_BLOCKS': 8265 return getFlattenedBlocksWithoutAttributes(action.blocks); 8266 8267 case 'RECEIVE_BLOCKS': 8268 case 'INSERT_BLOCKS': 8269 return { ...state, 8270 ...getFlattenedBlocksWithoutAttributes(action.blocks) 8271 }; 8272 8273 case 'UPDATE_BLOCK': 8274 // Ignore updates if block isn't known 8275 if (!state[action.clientId]) { 8276 return state; 8277 } // Do nothing if only attributes change. 8278 8279 8280 const changes = Object(external_lodash_["omit"])(action.updates, 'attributes'); 8281 8282 if (Object(external_lodash_["isEmpty"])(changes)) { 8283 return state; 8284 } 8285 8286 return { ...state, 8287 [action.clientId]: { ...state[action.clientId], 8288 ...changes 8289 } 8290 }; 8291 8292 case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8293 if (!action.blocks) { 8294 return state; 8295 } 8296 8297 return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds), 8298 ...getFlattenedBlocksWithoutAttributes(action.blocks) 8299 }; 8300 8301 case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8302 return Object(external_lodash_["omit"])(state, action.removedClientIds); 8303 } 8304 8305 return state; 8306 }, 8307 8308 attributes(state = {}, action) { 8309 switch (action.type) { 8310 case 'RESET_BLOCKS': 8311 return getFlattenedBlockAttributes(action.blocks); 8312 8313 case 'RECEIVE_BLOCKS': 8314 case 'INSERT_BLOCKS': 8315 return { ...state, 8316 ...getFlattenedBlockAttributes(action.blocks) 8317 }; 8318 8319 case 'UPDATE_BLOCK': 8320 // Ignore updates if block isn't known or there are no attribute changes. 8321 if (!state[action.clientId] || !action.updates.attributes) { 8322 return state; 8323 } 8324 8325 return { ...state, 8326 [action.clientId]: { ...state[action.clientId], 8327 ...action.updates.attributes 8328 } 8329 }; 8330 8331 case 'UPDATE_BLOCK_ATTRIBUTES': 8332 { 8333 // Avoid a state change if none of the block IDs are known. 8334 if (action.clientIds.every(id => !state[id])) { 8335 return state; 8336 } 8337 8338 const next = action.clientIds.reduce((accumulator, id) => ({ ...accumulator, 8339 [id]: Object(external_lodash_["reduce"])(action.uniqueByBlock ? action.attributes[id] : action.attributes, (result, value, key) => { 8340 // Consider as updates only changed values. 8341 if (value !== result[key]) { 8342 result = getMutateSafeObject(state[id], result); 8343 result[key] = value; 8344 } 8345 8346 return result; 8347 }, state[id]) 8348 }), {}); 8349 8350 if (action.clientIds.every(id => next[id] === state[id])) { 8351 return state; 8352 } 8353 8354 return { ...state, 8355 ...next 8356 }; 8357 } 8358 8359 case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8360 if (!action.blocks) { 8361 return state; 8362 } 8363 8364 return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds), 8365 ...getFlattenedBlockAttributes(action.blocks) 8366 }; 8367 8368 case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8369 return Object(external_lodash_["omit"])(state, action.removedClientIds); 8370 } 8371 8372 return state; 8373 }, 8374 8375 order(state = {}, action) { 8376 switch (action.type) { 8377 case 'RESET_BLOCKS': 8378 return mapBlockOrder(action.blocks); 8379 8380 case 'RECEIVE_BLOCKS': 8381 return { ...state, 8382 ...Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), '') 8383 }; 8384 8385 case 'INSERT_BLOCKS': 8386 { 8387 const { 8388 rootClientId = '' 8389 } = action; 8390 const subState = state[rootClientId] || []; 8391 const mappedBlocks = mapBlockOrder(action.blocks, rootClientId); 8392 const { 8393 index = subState.length 8394 } = action; 8395 return { ...state, 8396 ...mappedBlocks, 8397 [rootClientId]: insertAt(subState, mappedBlocks[rootClientId], index) 8398 }; 8399 } 8400 8401 case 'MOVE_BLOCKS_TO_POSITION': 8402 { 8403 const { 8404 fromRootClientId = '', 8405 toRootClientId = '', 8406 clientIds 8407 } = action; 8408 const { 8409 index = state[toRootClientId].length 8410 } = action; // Moving inside the same parent block 8411 8412 if (fromRootClientId === toRootClientId) { 8413 const subState = state[toRootClientId]; 8414 const fromIndex = subState.indexOf(clientIds[0]); 8415 return { ...state, 8416 [toRootClientId]: moveTo(state[toRootClientId], fromIndex, index, clientIds.length) 8417 }; 8418 } // Moving from a parent block to another 8419 8420 8421 return { ...state, 8422 [fromRootClientId]: Object(external_lodash_["without"])(state[fromRootClientId], ...clientIds), 8423 [toRootClientId]: insertAt(state[toRootClientId], clientIds, index) 8424 }; 8425 } 8426 8427 case 'MOVE_BLOCKS_UP': 8428 { 8429 const { 8430 clientIds, 8431 rootClientId = '' 8432 } = action; 8433 const firstClientId = Object(external_lodash_["first"])(clientIds); 8434 const subState = state[rootClientId]; 8435 8436 if (!subState.length || firstClientId === Object(external_lodash_["first"])(subState)) { 8437 return state; 8438 } 8439 8440 const firstIndex = subState.indexOf(firstClientId); 8441 return { ...state, 8442 [rootClientId]: moveTo(subState, firstIndex, firstIndex - 1, clientIds.length) 8443 }; 8444 } 8445 8446 case 'MOVE_BLOCKS_DOWN': 8447 { 8448 const { 8449 clientIds, 8450 rootClientId = '' 8451 } = action; 8452 const firstClientId = Object(external_lodash_["first"])(clientIds); 8453 const lastClientId = Object(external_lodash_["last"])(clientIds); 8454 const subState = state[rootClientId]; 8455 8456 if (!subState.length || lastClientId === Object(external_lodash_["last"])(subState)) { 8457 return state; 8458 } 8459 8460 const firstIndex = subState.indexOf(firstClientId); 8461 return { ...state, 8462 [rootClientId]: moveTo(subState, firstIndex, firstIndex + 1, clientIds.length) 8463 }; 8464 } 8465 8466 case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8467 { 8468 const { 8469 clientIds 8470 } = action; 8471 8472 if (!action.blocks) { 8473 return state; 8474 } 8475 8476 const mappedBlocks = mapBlockOrder(action.blocks); 8477 return Object(external_lodash_["flow"])([nextState => Object(external_lodash_["omit"])(nextState, action.replacedClientIds), nextState => ({ ...nextState, 8478 ...Object(external_lodash_["omit"])(mappedBlocks, '') 8479 }), nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["reduce"])(subState, (result, clientId) => { 8480 if (clientId === clientIds[0]) { 8481 return [...result, ...mappedBlocks['']]; 8482 } 8483 8484 if (clientIds.indexOf(clientId) === -1) { 8485 result.push(clientId); 8486 } 8487 8488 return result; 8489 }, []))])(state); 8490 } 8491 8492 case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8493 return Object(external_lodash_["flow"])([// Remove inner block ordering for removed blocks 8494 nextState => Object(external_lodash_["omit"])(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings 8495 nextState => Object(external_lodash_["mapValues"])(nextState, subState => Object(external_lodash_["without"])(subState, ...action.removedClientIds))])(state); 8496 } 8497 8498 return state; 8499 }, 8500 8501 // While technically redundant data as the inverse of `order`, it serves as 8502 // an optimization for the selectors which derive the ancestry of a block. 8503 parents(state = {}, action) { 8504 switch (action.type) { 8505 case 'RESET_BLOCKS': 8506 return mapBlockParents(action.blocks); 8507 8508 case 'RECEIVE_BLOCKS': 8509 return { ...state, 8510 ...mapBlockParents(action.blocks) 8511 }; 8512 8513 case 'INSERT_BLOCKS': 8514 return { ...state, 8515 ...mapBlockParents(action.blocks, action.rootClientId || '') 8516 }; 8517 8518 case 'MOVE_BLOCKS_TO_POSITION': 8519 { 8520 return { ...state, 8521 ...action.clientIds.reduce((accumulator, id) => { 8522 accumulator[id] = action.toRootClientId || ''; 8523 return accumulator; 8524 }, {}) 8525 }; 8526 } 8527 8528 case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8529 return { ...Object(external_lodash_["omit"])(state, action.replacedClientIds), 8530 ...mapBlockParents(action.blocks, state[action.clientIds[0]]) 8531 }; 8532 8533 case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN': 8534 return Object(external_lodash_["omit"])(state, action.removedClientIds); 8535 } 8536 8537 return state; 8538 }, 8539 8540 controlledInnerBlocks(state = {}, { 8541 type, 8542 clientId, 8543 hasControlledInnerBlocks 8544 }) { 8545 if (type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') { 8546 return { ...state, 8547 [clientId]: hasControlledInnerBlocks 8548 }; 8549 } 8550 8551 return state; 8552 } 8553 8554 }); 8555 /** 8556 * Reducer returning typing state. 8557 * 8558 * @param {boolean} state Current state. 8559 * @param {Object} action Dispatched action. 8560 * 8561 * @return {boolean} Updated state. 8562 */ 8563 8564 function reducer_isTyping(state = false, action) { 8565 switch (action.type) { 8566 case 'START_TYPING': 8567 return true; 8568 8569 case 'STOP_TYPING': 8570 return false; 8571 } 8572 8573 return state; 8574 } 8575 /** 8576 * Reducer returning dragged block client id. 8577 * 8578 * @param {string[]} state Current state. 8579 * @param {Object} action Dispatched action. 8580 * 8581 * @return {string[]} Updated state. 8582 */ 8583 8584 function draggedBlocks(state = [], action) { 8585 switch (action.type) { 8586 case 'START_DRAGGING_BLOCKS': 8587 return action.clientIds; 8588 8589 case 'STOP_DRAGGING_BLOCKS': 8590 return []; 8591 } 8592 8593 return state; 8594 } 8595 /** 8596 * Reducer returning whether the caret is within formatted text. 8597 * 8598 * @param {boolean} state Current state. 8599 * @param {Object} action Dispatched action. 8600 * 8601 * @return {boolean} Updated state. 8602 */ 8603 8604 function reducer_isCaretWithinFormattedText(state = false, action) { 8605 switch (action.type) { 8606 case 'ENTER_FORMATTED_TEXT': 8607 return true; 8608 8609 case 'EXIT_FORMATTED_TEXT': 8610 return false; 8611 } 8612 8613 return state; 8614 } 8615 /** 8616 * Internal helper reducer for selectionStart and selectionEnd. Can hold a block 8617 * selection, represented by an object with property clientId. 8618 * 8619 * @param {Object} state Current state. 8620 * @param {Object} action Dispatched action. 8621 * 8622 * @return {Object} Updated state. 8623 */ 8624 8625 function selectionHelper(state = {}, action) { 8626 switch (action.type) { 8627 case 'CLEAR_SELECTED_BLOCK': 8628 { 8629 if (state.clientId) { 8630 return {}; 8631 } 8632 8633 return state; 8634 } 8635 8636 case 'SELECT_BLOCK': 8637 if (action.clientId === state.clientId) { 8638 return state; 8639 } 8640 8641 return { 8642 clientId: action.clientId 8643 }; 8644 8645 case 'REPLACE_INNER_BLOCKS': 8646 case 'INSERT_BLOCKS': 8647 { 8648 if (!action.updateSelection || !action.blocks.length) { 8649 return state; 8650 } 8651 8652 return { 8653 clientId: action.blocks[0].clientId 8654 }; 8655 } 8656 8657 case 'REMOVE_BLOCKS': 8658 if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) { 8659 return state; 8660 } 8661 8662 return {}; 8663 8664 case 'REPLACE_BLOCKS': 8665 { 8666 if (action.clientIds.indexOf(state.clientId) === -1) { 8667 return state; 8668 } 8669 8670 const indexToSelect = action.indexToSelect || action.blocks.length - 1; 8671 const blockToSelect = action.blocks[indexToSelect]; 8672 8673 if (!blockToSelect) { 8674 return {}; 8675 } 8676 8677 if (blockToSelect.clientId === state.clientId) { 8678 return state; 8679 } 8680 8681 return { 8682 clientId: blockToSelect.clientId 8683 }; 8684 } 8685 } 8686 8687 return state; 8688 } 8689 /** 8690 * Reducer returning the selection state. 8691 * 8692 * @param {boolean} state Current state. 8693 * @param {Object} action Dispatched action. 8694 * 8695 * @return {boolean} Updated state. 8696 */ 8697 8698 8699 function reducer_selection(state = {}, action) { 8700 var _state$selectionStart, _state$selectionEnd; 8701 8702 switch (action.type) { 8703 case 'SELECTION_CHANGE': 8704 return { 8705 selectionStart: { 8706 clientId: action.clientId, 8707 attributeKey: action.attributeKey, 8708 offset: action.startOffset 8709 }, 8710 selectionEnd: { 8711 clientId: action.clientId, 8712 attributeKey: action.attributeKey, 8713 offset: action.endOffset 8714 } 8715 }; 8716 8717 case 'RESET_SELECTION': 8718 const { 8719 selectionStart, 8720 selectionEnd 8721 } = action; 8722 return { 8723 selectionStart, 8724 selectionEnd 8725 }; 8726 8727 case 'MULTI_SELECT': 8728 const { 8729 start, 8730 end 8731 } = action; 8732 return { 8733 selectionStart: { 8734 clientId: start 8735 }, 8736 selectionEnd: { 8737 clientId: end 8738 } 8739 }; 8740 8741 case 'RESET_BLOCKS': 8742 const startClientId = state === null || state === void 0 ? void 0 : (_state$selectionStart = state.selectionStart) === null || _state$selectionStart === void 0 ? void 0 : _state$selectionStart.clientId; 8743 const endClientId = state === null || state === void 0 ? void 0 : (_state$selectionEnd = state.selectionEnd) === null || _state$selectionEnd === void 0 ? void 0 : _state$selectionEnd.clientId; // Do nothing if there's no selected block. 8744 8745 if (!startClientId && !endClientId) { 8746 return state; 8747 } // If the start of the selection won't exist after reset, remove selection. 8748 8749 8750 if (!action.blocks.some(block => block.clientId === startClientId)) { 8751 return { 8752 selectionStart: {}, 8753 selectionEnd: {} 8754 }; 8755 } // If the end of the selection won't exist after reset, collapse selection. 8756 8757 8758 if (!action.blocks.some(block => block.clientId === endClientId)) { 8759 return { ...state, 8760 selectionEnd: state.selectionStart 8761 }; 8762 } 8763 8764 } 8765 8766 return { 8767 selectionStart: selectionHelper(state.selectionStart, action), 8768 selectionEnd: selectionHelper(state.selectionEnd, action) 8769 }; 8770 } 8771 /** 8772 * Reducer returning whether the user is multi-selecting. 8773 * 8774 * @param {boolean} state Current state. 8775 * @param {Object} action Dispatched action. 8776 * 8777 * @return {boolean} Updated state. 8778 */ 8779 8780 function reducer_isMultiSelecting(state = false, action) { 8781 switch (action.type) { 8782 case 'START_MULTI_SELECT': 8783 return true; 8784 8785 case 'STOP_MULTI_SELECT': 8786 return false; 8787 } 8788 8789 return state; 8790 } 8791 /** 8792 * Reducer returning whether selection is enabled. 8793 * 8794 * @param {boolean} state Current state. 8795 * @param {Object} action Dispatched action. 8796 * 8797 * @return {boolean} Updated state. 8798 */ 8799 8800 function reducer_isSelectionEnabled(state = true, action) { 8801 switch (action.type) { 8802 case 'TOGGLE_SELECTION': 8803 return action.isSelectionEnabled; 8804 } 8805 8806 return state; 8807 } 8808 /** 8809 * Reducer returning the intial block selection. 8810 * 8811 * Currently this in only used to restore the selection after block deletion and 8812 * pasting new content.This reducer should eventually be removed in favour of setting 8813 * selection directly. 8814 * 8815 * @param {boolean} state Current state. 8816 * @param {Object} action Dispatched action. 8817 * 8818 * @return {number|null} Initial position: 0, -1 or null. 8819 */ 8820 8821 function reducer_initialPosition(state = null, action) { 8822 if (action.type === 'REPLACE_BLOCKS' && action.initialPosition !== undefined) { 8823 return action.initialPosition; 8824 } else if (['SELECT_BLOCK', 'RESET_SELECTION', 'INSERT_BLOCKS', 'REPLACE_INNER_BLOCKS'].includes(action.type)) { 8825 return action.initialPosition; 8826 } 8827 8828 return state; 8829 } 8830 function blocksMode(state = {}, action) { 8831 if (action.type === 'TOGGLE_BLOCK_MODE') { 8832 const { 8833 clientId 8834 } = action; 8835 return { ...state, 8836 [clientId]: state[clientId] && state[clientId] === 'html' ? 'visual' : 'html' 8837 }; 8838 } 8839 8840 return state; 8841 } 8842 /** 8843 * Reducer returning the block insertion point visibility, either null if there 8844 * is not an explicit insertion point assigned, or an object of its `index` and 8845 * `rootClientId`. 8846 * 8847 * @param {Object} state Current state. 8848 * @param {Object} action Dispatched action. 8849 * 8850 * @return {Object} Updated state. 8851 */ 8852 8853 function reducer_insertionPoint(state = null, action) { 8854 switch (action.type) { 8855 case 'SHOW_INSERTION_POINT': 8856 const { 8857 rootClientId, 8858 index, 8859 __unstableWithInserter 8860 } = action; 8861 return { 8862 rootClientId, 8863 index, 8864 __unstableWithInserter 8865 }; 8866 8867 case 'HIDE_INSERTION_POINT': 8868 return null; 8869 } 8870 8871 return state; 8872 } 8873 /** 8874 * Reducer returning whether the post blocks match the defined template or not. 8875 * 8876 * @param {Object} state Current state. 8877 * @param {Object} action Dispatched action. 8878 * 8879 * @return {boolean} Updated state. 8880 */ 8881 8882 function reducer_template(state = { 8883 isValid: true 8884 }, action) { 8885 switch (action.type) { 8886 case 'SET_TEMPLATE_VALIDITY': 8887 return { ...state, 8888 isValid: action.isValid 8889 }; 8890 } 8891 8892 return state; 8893 } 8894 /** 8895 * Reducer returning the editor setting. 8896 * 8897 * @param {Object} state Current state. 8898 * @param {Object} action Dispatched action. 8899 * 8900 * @return {Object} Updated state. 8901 */ 8902 8903 function reducer_settings(state = SETTINGS_DEFAULTS, action) { 8904 switch (action.type) { 8905 case 'UPDATE_SETTINGS': 8906 return { ...state, 8907 ...action.settings 8908 }; 8909 } 8910 8911 return state; 8912 } 8913 /** 8914 * Reducer returning the user preferences. 8915 * 8916 * @param {Object} state Current state. 8917 * @param {Object} action Dispatched action. 8918 * 8919 * @return {string} Updated state. 8920 */ 8921 8922 function preferences(state = PREFERENCES_DEFAULTS, action) { 8923 switch (action.type) { 8924 case 'INSERT_BLOCKS': 8925 case 'REPLACE_BLOCKS': 8926 return action.blocks.reduce((prevState, block) => { 8927 const { 8928 attributes, 8929 name: blockName 8930 } = block; 8931 const match = Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getActiveBlockVariation(blockName, attributes); // If a block variation match is found change the name to be the same with the 8932 // one that is used for block variations in the Inserter (`getItemFromVariation`). 8933 8934 let id = match !== null && match !== void 0 && match.name ? `${blockName}/${match.name}` : blockName; 8935 const insert = { 8936 name: id 8937 }; 8938 8939 if (blockName === 'core/block') { 8940 insert.ref = attributes.ref; 8941 id += '/' + attributes.ref; 8942 } 8943 8944 return { ...prevState, 8945 insertUsage: { ...prevState.insertUsage, 8946 [id]: { 8947 time: action.time, 8948 count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1, 8949 insert 8950 } 8951 } 8952 }; 8953 }, state); 8954 } 8955 8956 return state; 8957 } 8958 /** 8959 * Reducer returning an object where each key is a block client ID, its value 8960 * representing the settings for its nested blocks. 8961 * 8962 * @param {Object} state Current state. 8963 * @param {Object} action Dispatched action. 8964 * 8965 * @return {Object} Updated state. 8966 */ 8967 8968 const reducer_blockListSettings = (state = {}, action) => { 8969 switch (action.type) { 8970 // Even if the replaced blocks have the same client ID, our logic 8971 // should correct the state. 8972 case 'REPLACE_BLOCKS': 8973 case 'REMOVE_BLOCKS': 8974 { 8975 return Object(external_lodash_["omit"])(state, action.clientIds); 8976 } 8977 8978 case 'UPDATE_BLOCK_LIST_SETTINGS': 8979 { 8980 const { 8981 clientId 8982 } = action; 8983 8984 if (!action.settings) { 8985 if (state.hasOwnProperty(clientId)) { 8986 return Object(external_lodash_["omit"])(state, clientId); 8987 } 8988 8989 return state; 8990 } 8991 8992 if (Object(external_lodash_["isEqual"])(state[clientId], action.settings)) { 8993 return state; 8994 } 8995 8996 return { ...state, 8997 [clientId]: action.settings 8998 }; 8999 } 9000 } 9001 9002 return state; 9003 }; 9004 /** 9005 * Reducer returning whether the navigation mode is enabled or not. 9006 * 9007 * @param {string} state Current state. 9008 * @param {Object} action Dispatched action. 9009 * 9010 * @return {string} Updated state. 9011 */ 9012 9013 function reducer_isNavigationMode(state = false, action) { 9014 // Let inserting block always trigger Edit mode. 9015 if (action.type === 'INSERT_BLOCKS') { 9016 return false; 9017 } 9018 9019 if (action.type === 'SET_NAVIGATION_MODE') { 9020 return action.isNavigationMode; 9021 } 9022 9023 return state; 9024 } 9025 /** 9026 * Reducer returning whether the block moving mode is enabled or not. 9027 * 9028 * @param {string|null} state Current state. 9029 * @param {Object} action Dispatched action. 9030 * 9031 * @return {string|null} Updated state. 9032 */ 9033 9034 function reducer_hasBlockMovingClientId(state = null, action) { 9035 // Let inserting block always trigger Edit mode. 9036 if (action.type === 'SET_BLOCK_MOVING_MODE') { 9037 return action.hasBlockMovingClientId; 9038 } 9039 9040 if (action.type === 'SET_NAVIGATION_MODE') { 9041 return null; 9042 } 9043 9044 return state; 9045 } 9046 /** 9047 * Reducer return an updated state representing the most recent block attribute 9048 * update. The state is structured as an object where the keys represent the 9049 * client IDs of blocks, the values a subset of attributes from the most recent 9050 * block update. The state is always reset to null if the last action is 9051 * anything other than an attributes update. 9052 * 9053 * @param {Object<string,Object>} state Current state. 9054 * @param {Object} action Action object. 9055 * 9056 * @return {[string,Object]} Updated state. 9057 */ 9058 9059 function lastBlockAttributesChange(state, action) { 9060 switch (action.type) { 9061 case 'UPDATE_BLOCK': 9062 if (!action.updates.attributes) { 9063 break; 9064 } 9065 9066 return { 9067 [action.clientId]: action.updates.attributes 9068 }; 9069 9070 case 'UPDATE_BLOCK_ATTRIBUTES': 9071 return action.clientIds.reduce((accumulator, id) => ({ ...accumulator, 9072 [id]: action.uniqueByBlock ? action.attributes[id] : action.attributes 9073 }), {}); 9074 } 9075 9076 return null; 9077 } 9078 /** 9079 * Reducer returning automatic change state. 9080 * 9081 * @param {boolean} state Current state. 9082 * @param {Object} action Dispatched action. 9083 * 9084 * @return {string} Updated state. 9085 */ 9086 9087 function automaticChangeStatus(state, action) { 9088 switch (action.type) { 9089 case 'MARK_AUTOMATIC_CHANGE': 9090 return 'pending'; 9091 9092 case 'MARK_AUTOMATIC_CHANGE_FINAL': 9093 if (state === 'pending') { 9094 return 'final'; 9095 } 9096 9097 return; 9098 9099 case 'SELECTION_CHANGE': 9100 // As long as the state is not final, ignore any selection changes. 9101 if (state !== 'final') { 9102 return state; 9103 } 9104 9105 return; 9106 // Undoing an automatic change should still be possible after mouse 9107 // move. 9108 9109 case 'START_TYPING': 9110 case 'STOP_TYPING': 9111 return state; 9112 } // Reset the state by default (for any action not handled). 9113 9114 } 9115 /** 9116 * Reducer returning current highlighted block. 9117 * 9118 * @param {boolean} state Current highlighted block. 9119 * @param {Object} action Dispatched action. 9120 * 9121 * @return {string} Updated state. 9122 */ 9123 9124 function highlightedBlock(state, action) { 9125 switch (action.type) { 9126 case 'TOGGLE_BLOCK_HIGHLIGHT': 9127 const { 9128 clientId, 9129 isHighlighted 9130 } = action; 9131 9132 if (isHighlighted) { 9133 return clientId; 9134 } else if (state === clientId) { 9135 return null; 9136 } 9137 9138 return state; 9139 9140 case 'SELECT_BLOCK': 9141 if (action.clientId !== state) { 9142 return null; 9143 } 9144 9145 } 9146 9147 return state; 9148 } 9149 /** 9150 * Reducer returning the block insertion event list state. 9151 * 9152 * @param {Object} state Current state. 9153 * @param {Object} action Dispatched action. 9154 * 9155 * @return {Object} Updated state. 9156 */ 9157 9158 function lastBlockInserted(state = {}, action) { 9159 var _action$meta; 9160 9161 switch (action.type) { 9162 case 'INSERT_BLOCKS': 9163 if (!action.blocks.length) { 9164 return state; 9165 } 9166 9167 const clientId = action.blocks[0].clientId; 9168 const source = (_action$meta = action.meta) === null || _action$meta === void 0 ? void 0 : _action$meta.source; 9169 return { 9170 clientId, 9171 source 9172 }; 9173 9174 case 'RESET_BLOCKS': 9175 return {}; 9176 } 9177 9178 return state; 9179 } 9180 /* harmony default export */ var store_reducer = (Object(external_wp_data_["combineReducers"])({ 9181 blocks: reducer_blocks, 9182 isTyping: reducer_isTyping, 9183 draggedBlocks, 9184 isCaretWithinFormattedText: reducer_isCaretWithinFormattedText, 9185 selection: reducer_selection, 9186 isMultiSelecting: reducer_isMultiSelecting, 9187 isSelectionEnabled: reducer_isSelectionEnabled, 9188 initialPosition: reducer_initialPosition, 9189 blocksMode, 9190 blockListSettings: reducer_blockListSettings, 9191 insertionPoint: reducer_insertionPoint, 9192 template: reducer_template, 9193 settings: reducer_settings, 9194 preferences, 9195 lastBlockAttributesChange, 9196 isNavigationMode: reducer_isNavigationMode, 9197 hasBlockMovingClientId: reducer_hasBlockMovingClientId, 9198 automaticChangeStatus, 9199 highlightedBlock, 9200 lastBlockInserted 9201 })); 9202 9203 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js 9204 var rememo = __webpack_require__("pPDe"); 9205 9206 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js 9207 9208 9209 /** 9210 * External dependencies 9211 */ 9212 9213 9214 /** 9215 * WordPress dependencies 9216 */ 9217 9218 9219 9220 9221 /** 9222 * A block selection object. 9223 * 9224 * @typedef {Object} WPBlockSelection 9225 * 9226 * @property {string} clientId A block client ID. 9227 * @property {string} attributeKey A block attribute key. 9228 * @property {number} offset An attribute value offset, based on the rich 9229 * text value. See `wp.richText.create`. 9230 */ 9231 // Module constants 9232 9233 const MILLISECONDS_PER_HOUR = 3600 * 1000; 9234 const MILLISECONDS_PER_DAY = 24 * 3600 * 1000; 9235 const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000; 9236 const templateIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 9237 xmlns: "http://www.w3.org/2000/svg", 9238 viewBox: "0 0 24 24" 9239 }, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { 9240 x: "0", 9241 fill: "none", 9242 width: "24", 9243 height: "24" 9244 }), Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 9245 d: "M19 3H5c-1.105 0-2 .895-2 2v14c0 1.105.895 2 2 2h14c1.105 0 2-.895 2-2V5c0-1.105-.895-2-2-2zM6 6h5v5H6V6zm4.5 13C9.12 19 8 17.88 8 16.5S9.12 14 10.5 14s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm3-6l3-5 3 5h-6z" 9246 }))); 9247 /** 9248 * Shared reference to an empty array for cases where it is important to avoid 9249 * returning a new array reference on every invocation, as in a connected or 9250 * other pure component which performs `shouldComponentUpdate` check on props. 9251 * This should be used as a last resort, since the normalized data should be 9252 * maintained by the reducer result in state. 9253 * 9254 * @type {Array} 9255 */ 9256 9257 const EMPTY_ARRAY = []; 9258 /** 9259 * Returns a block's name given its client ID, or null if no block exists with 9260 * the client ID. 9261 * 9262 * @param {Object} state Editor state. 9263 * @param {string} clientId Block client ID. 9264 * 9265 * @return {string} Block name. 9266 */ 9267 9268 function selectors_getBlockName(state, clientId) { 9269 const block = state.blocks.byClientId[clientId]; 9270 const socialLinkName = 'core/social-link'; 9271 9272 if (external_wp_element_["Platform"].OS !== 'web' && (block === null || block === void 0 ? void 0 : block.name) === socialLinkName) { 9273 const attributes = state.blocks.attributes[clientId]; 9274 const { 9275 service 9276 } = attributes; 9277 return service ? `${socialLinkName}-${service}` : socialLinkName; 9278 } 9279 9280 return block ? block.name : null; 9281 } 9282 /** 9283 * Returns whether a block is valid or not. 9284 * 9285 * @param {Object} state Editor state. 9286 * @param {string} clientId Block client ID. 9287 * 9288 * @return {boolean} Is Valid. 9289 */ 9290 9291 function selectors_isBlockValid(state, clientId) { 9292 const block = state.blocks.byClientId[clientId]; 9293 return !!block && block.isValid; 9294 } 9295 /** 9296 * Returns a block's attributes given its client ID, or null if no block exists with 9297 * the client ID. 9298 * 9299 * @param {Object} state Editor state. 9300 * @param {string} clientId Block client ID. 9301 * 9302 * @return {Object?} Block attributes. 9303 */ 9304 9305 function selectors_getBlockAttributes(state, clientId) { 9306 const block = state.blocks.byClientId[clientId]; 9307 9308 if (!block) { 9309 return null; 9310 } 9311 9312 return state.blocks.attributes[clientId]; 9313 } 9314 /** 9315 * Returns a block given its client ID. This is a parsed copy of the block, 9316 * containing its `blockName`, `clientId`, and current `attributes` state. This 9317 * is not the block's registration settings, which must be retrieved from the 9318 * blocks module registration store. 9319 * 9320 * getBlock recurses through its inner blocks until all its children blocks have 9321 * been retrieved. Note that getBlock will not return the child inner blocks of 9322 * an inner block controller. This is because an inner block controller syncs 9323 * itself with its own entity, and should therefore not be included with the 9324 * blocks of a different entity. For example, say you call `getBlocks( TP )` to 9325 * get the blocks of a template part. If another template part is a child of TP, 9326 * then the nested template part's child blocks will not be returned. This way, 9327 * the template block itself is considered part of the parent, but the children 9328 * are not. 9329 * 9330 * @param {Object} state Editor state. 9331 * @param {string} clientId Block client ID. 9332 * 9333 * @return {Object} Parsed block object. 9334 */ 9335 9336 const selectors_getBlock = Object(rememo["a" /* default */])((state, clientId) => { 9337 const block = state.blocks.byClientId[clientId]; 9338 9339 if (!block) { 9340 return null; 9341 } 9342 9343 return { ...block, 9344 attributes: selectors_getBlockAttributes(state, clientId), 9345 innerBlocks: areInnerBlocksControlled(state, clientId) ? EMPTY_ARRAY : selectors_getBlocks(state, clientId) 9346 }; 9347 }, (state, clientId) => [// Normally, we'd have both `getBlockAttributes` dependencies and 9348 // `getBlocks` (children) dependencies here but for performance reasons 9349 // we use a denormalized cache key computed in the reducer that takes both 9350 // the attributes and inner blocks into account. The value of the cache key 9351 // is being changed whenever one of these dependencies is out of date. 9352 state.blocks.cache[clientId]]); 9353 const selectors_unstableGetBlockWithoutInnerBlocks = Object(rememo["a" /* default */])((state, clientId) => { 9354 const block = state.blocks.byClientId[clientId]; 9355 9356 if (!block) { 9357 return null; 9358 } 9359 9360 return { ...block, 9361 attributes: selectors_getBlockAttributes(state, clientId) 9362 }; 9363 }, (state, clientId) => [state.blocks.byClientId[clientId], state.blocks.attributes[clientId]]); 9364 /** 9365 * Returns all block objects for the current post being edited as an array in 9366 * the order they appear in the post. Note that this will exclude child blocks 9367 * of nested inner block controllers. 9368 * 9369 * Note: It's important to memoize this selector to avoid return a new instance 9370 * on each call. We use the block cache state for each top-level block of the 9371 * given clientID. This way, the selector only refreshes on changes to blocks 9372 * associated with the given entity, and does not refresh when changes are made 9373 * to blocks which are part of different inner block controllers. 9374 * 9375 * @param {Object} state Editor state. 9376 * @param {?string} rootClientId Optional root client ID of block list. 9377 * 9378 * @return {Object[]} Post blocks. 9379 */ 9380 9381 const selectors_getBlocks = Object(rememo["a" /* default */])((state, rootClientId) => { 9382 return Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => selectors_getBlock(state, clientId)); 9383 }, (state, rootClientId) => Object(external_lodash_["map"])(state.blocks.order[rootClientId || ''], id => state.blocks.cache[id])); 9384 /** 9385 * Similar to getBlock, except it will include the entire nested block tree as 9386 * inner blocks. The normal getBlock selector will exclude sections of the block 9387 * tree which belong to different entities. 9388 * 9389 * @param {Object} state Editor state. 9390 * @param {string} clientId Client ID of the block to get. 9391 * 9392 * @return {Object} The block with all 9393 */ 9394 9395 const __unstableGetBlockWithBlockTree = Object(rememo["a" /* default */])((state, clientId) => { 9396 const block = state.blocks.byClientId[clientId]; 9397 9398 if (!block) { 9399 return null; 9400 } 9401 9402 return { ...block, 9403 attributes: selectors_getBlockAttributes(state, clientId), 9404 innerBlocks: __unstableGetBlockTree(state, clientId) 9405 }; 9406 }, state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); 9407 /** 9408 * Similar to getBlocks, except this selector returns the entire block tree 9409 * represented in the block-editor store from the given root regardless of any 9410 * inner block controllers. 9411 * 9412 * @param {Object} state Editor state. 9413 * @param {?string} rootClientId Optional root client ID of block list. 9414 * 9415 * @return {Object[]} Post blocks. 9416 */ 9417 9418 const __unstableGetBlockTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => __unstableGetBlockWithBlockTree(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); 9419 /** 9420 * Returns a stripped down block object containing only its client ID, 9421 * and its inner blocks' client IDs. 9422 * 9423 * @param {Object} state Editor state. 9424 * @param {string} clientId Client ID of the block to get. 9425 * 9426 * @return {Object} Client IDs of the post blocks. 9427 */ 9428 9429 const selectors_unstableGetClientIdWithClientIdsTree = Object(rememo["a" /* default */])((state, clientId) => ({ 9430 clientId, 9431 innerBlocks: selectors_unstableGetClientIdsTree(state, clientId) 9432 }), state => [state.blocks.order]); 9433 /** 9434 * Returns the block tree represented in the block-editor store from the 9435 * given root, consisting of stripped down block objects containing only 9436 * their client IDs, and their inner blocks' client IDs. 9437 * 9438 * @param {Object} state Editor state. 9439 * @param {?string} rootClientId Optional root client ID of block list. 9440 * 9441 * @return {Object[]} Client IDs of the post blocks. 9442 */ 9443 9444 const selectors_unstableGetClientIdsTree = Object(rememo["a" /* default */])((state, rootClientId = '') => Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), clientId => selectors_unstableGetClientIdWithClientIdsTree(state, clientId)), state => [state.blocks.order]); 9445 /** 9446 * Returns an array containing the clientIds of all descendants 9447 * of the blocks given. 9448 * 9449 * @param {Object} state Global application state. 9450 * @param {Array} clientIds Array of blocks to inspect. 9451 * 9452 * @return {Array} ids of descendants. 9453 */ 9454 9455 const selectors_getClientIdsOfDescendants = (state, clientIds) => Object(external_lodash_["flatMap"])(clientIds, clientId => { 9456 const descendants = selectors_getBlockOrder(state, clientId); 9457 return [...descendants, ...selectors_getClientIdsOfDescendants(state, descendants)]; 9458 }); 9459 /** 9460 * Returns an array containing the clientIds of the top-level blocks 9461 * and their descendants of any depth (for nested blocks). 9462 * 9463 * @param {Object} state Global application state. 9464 * 9465 * @return {Array} ids of top-level and descendant blocks. 9466 */ 9467 9468 const getClientIdsWithDescendants = Object(rememo["a" /* default */])(state => { 9469 const topLevelIds = selectors_getBlockOrder(state); 9470 return [...topLevelIds, ...selectors_getClientIdsOfDescendants(state, topLevelIds)]; 9471 }, state => [state.blocks.order]); 9472 /** 9473 * Returns the total number of blocks, or the total number of blocks with a specific name in a post. 9474 * The number returned includes nested blocks. 9475 * 9476 * @param {Object} state Global application state. 9477 * @param {?string} blockName Optional block name, if specified only blocks of that type will be counted. 9478 * 9479 * @return {number} Number of blocks in the post, or number of blocks with name equal to blockName. 9480 */ 9481 9482 const selectors_getGlobalBlockCount = Object(rememo["a" /* default */])((state, blockName) => { 9483 const clientIds = getClientIdsWithDescendants(state); 9484 9485 if (!blockName) { 9486 return clientIds.length; 9487 } 9488 9489 return Object(external_lodash_["reduce"])(clientIds, (accumulator, clientId) => { 9490 const block = state.blocks.byClientId[clientId]; 9491 return block.name === blockName ? accumulator + 1 : accumulator; 9492 }, 0); 9493 }, state => [state.blocks.order, state.blocks.byClientId]); 9494 /** 9495 * Given an array of block client IDs, returns the corresponding array of block 9496 * objects. 9497 * 9498 * @param {Object} state Editor state. 9499 * @param {string[]} clientIds Client IDs for which blocks are to be returned. 9500 * 9501 * @return {WPBlock[]} Block objects. 9502 */ 9503 9504 const selectors_getBlocksByClientId = Object(rememo["a" /* default */])((state, clientIds) => Object(external_lodash_["map"])(Object(external_lodash_["castArray"])(clientIds), clientId => selectors_getBlock(state, clientId)), state => [state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); 9505 /** 9506 * Returns the number of blocks currently present in the post. 9507 * 9508 * @param {Object} state Editor state. 9509 * @param {?string} rootClientId Optional root client ID of block list. 9510 * 9511 * @return {number} Number of blocks in the post. 9512 */ 9513 9514 function selectors_getBlockCount(state, rootClientId) { 9515 return selectors_getBlockOrder(state, rootClientId).length; 9516 } 9517 /** 9518 * Returns the current selection start block client ID, attribute key and text 9519 * offset. 9520 * 9521 * @param {Object} state Block editor state. 9522 * 9523 * @return {WPBlockSelection} Selection start information. 9524 */ 9525 9526 function selectors_getSelectionStart(state) { 9527 return state.selection.selectionStart; 9528 } 9529 /** 9530 * Returns the current selection end block client ID, attribute key and text 9531 * offset. 9532 * 9533 * @param {Object} state Block editor state. 9534 * 9535 * @return {WPBlockSelection} Selection end information. 9536 */ 9537 9538 function selectors_getSelectionEnd(state) { 9539 return state.selection.selectionEnd; 9540 } 9541 /** 9542 * Returns the current block selection start. This value may be null, and it 9543 * may represent either a singular block selection or multi-selection start. 9544 * A selection is singular if its start and end match. 9545 * 9546 * @param {Object} state Global application state. 9547 * 9548 * @return {?string} Client ID of block selection start. 9549 */ 9550 9551 function selectors_getBlockSelectionStart(state) { 9552 return state.selection.selectionStart.clientId; 9553 } 9554 /** 9555 * Returns the current block selection end. This value may be null, and it 9556 * may represent either a singular block selection or multi-selection end. 9557 * A selection is singular if its start and end match. 9558 * 9559 * @param {Object} state Global application state. 9560 * 9561 * @return {?string} Client ID of block selection end. 9562 */ 9563 9564 function selectors_getBlockSelectionEnd(state) { 9565 return state.selection.selectionEnd.clientId; 9566 } 9567 /** 9568 * Returns the number of blocks currently selected in the post. 9569 * 9570 * @param {Object} state Global application state. 9571 * 9572 * @return {number} Number of blocks selected in the post. 9573 */ 9574 9575 function selectors_getSelectedBlockCount(state) { 9576 const multiSelectedBlockCount = selectors_getMultiSelectedBlockClientIds(state).length; 9577 9578 if (multiSelectedBlockCount) { 9579 return multiSelectedBlockCount; 9580 } 9581 9582 return state.selection.selectionStart.clientId ? 1 : 0; 9583 } 9584 /** 9585 * Returns true if there is a single selected block, or false otherwise. 9586 * 9587 * @param {Object} state Editor state. 9588 * 9589 * @return {boolean} Whether a single block is selected. 9590 */ 9591 9592 function selectors_hasSelectedBlock(state) { 9593 const { 9594 selectionStart, 9595 selectionEnd 9596 } = state.selection; 9597 return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId; 9598 } 9599 /** 9600 * Returns the currently selected block client ID, or null if there is no 9601 * selected block. 9602 * 9603 * @param {Object} state Editor state. 9604 * 9605 * @return {?string} Selected block client ID. 9606 */ 9607 9608 function selectors_getSelectedBlockClientId(state) { 9609 const { 9610 selectionStart, 9611 selectionEnd 9612 } = state.selection; 9613 const { 9614 clientId 9615 } = selectionStart; 9616 9617 if (!clientId || clientId !== selectionEnd.clientId) { 9618 return null; 9619 } 9620 9621 return clientId; 9622 } 9623 /** 9624 * Returns the currently selected block, or null if there is no selected block. 9625 * 9626 * @param {Object} state Global application state. 9627 * 9628 * @return {?Object} Selected block. 9629 */ 9630 9631 function selectors_getSelectedBlock(state) { 9632 const clientId = selectors_getSelectedBlockClientId(state); 9633 return clientId ? selectors_getBlock(state, clientId) : null; 9634 } 9635 /** 9636 * Given a block client ID, returns the root block from which the block is 9637 * nested, an empty string for top-level blocks, or null if the block does not 9638 * exist. 9639 * 9640 * @param {Object} state Editor state. 9641 * @param {string} clientId Block from which to find root client ID. 9642 * 9643 * @return {?string} Root client ID, if exists 9644 */ 9645 9646 function selectors_getBlockRootClientId(state, clientId) { 9647 return state.blocks.parents[clientId] !== undefined ? state.blocks.parents[clientId] : null; 9648 } 9649 /** 9650 * Given a block client ID, returns the list of all its parents from top to bottom. 9651 * 9652 * @param {Object} state Editor state. 9653 * @param {string} clientId Block from which to find root client ID. 9654 * @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false). 9655 * 9656 * @return {Array} ClientIDs of the parent blocks. 9657 */ 9658 9659 const selectors_getBlockParents = Object(rememo["a" /* default */])((state, clientId, ascending = false) => { 9660 const parents = []; 9661 let current = clientId; 9662 9663 while (!!state.blocks.parents[current]) { 9664 current = state.blocks.parents[current]; 9665 parents.push(current); 9666 } 9667 9668 return ascending ? parents : parents.reverse(); 9669 }, state => [state.blocks.parents]); 9670 /** 9671 * Given a block client ID and a block name, returns the list of all its parents 9672 * from top to bottom, filtered by the given name(s). For example, if passed 9673 * 'core/group' as the blockName, it will only return parents which are group 9674 * blocks. If passed `[ 'core/group', 'core/cover']`, as the blockName, it will 9675 * return parents which are group blocks and parents which are cover blocks. 9676 * 9677 * @param {Object} state Editor state. 9678 * @param {string} clientId Block from which to find root client ID. 9679 * @param {string|string[]} blockName Block name(s) to filter. 9680 * @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false). 9681 * 9682 * @return {Array} ClientIDs of the parent blocks. 9683 */ 9684 9685 const getBlockParentsByBlockName = Object(rememo["a" /* default */])((state, clientId, blockName, ascending = false) => { 9686 const parents = selectors_getBlockParents(state, clientId, ascending); 9687 return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(Object(external_lodash_["map"])(parents, id => ({ 9688 id, 9689 name: selectors_getBlockName(state, id) 9690 })), ({ 9691 name 9692 }) => { 9693 if (Array.isArray(blockName)) { 9694 return blockName.includes(name); 9695 } 9696 9697 return name === blockName; 9698 }), ({ 9699 id 9700 }) => id); 9701 }, state => [state.blocks.parents]); 9702 /** 9703 * Given a block client ID, returns the root of the hierarchy from which the block is nested, return the block itself for root level blocks. 9704 * 9705 * @param {Object} state Editor state. 9706 * @param {string} clientId Block from which to find root client ID. 9707 * 9708 * @return {string} Root client ID 9709 */ 9710 9711 function selectors_getBlockHierarchyRootClientId(state, clientId) { 9712 let current = clientId; 9713 let parent; 9714 9715 do { 9716 parent = current; 9717 current = state.blocks.parents[current]; 9718 } while (current); 9719 9720 return parent; 9721 } 9722 /** 9723 * Given a block client ID, returns the lowest common ancestor with selected client ID. 9724 * 9725 * @param {Object} state Editor state. 9726 * @param {string} clientId Block from which to find common ancestor client ID. 9727 * 9728 * @return {string} Common ancestor client ID or undefined 9729 */ 9730 9731 function getLowestCommonAncestorWithSelectedBlock(state, clientId) { 9732 const selectedId = selectors_getSelectedBlockClientId(state); 9733 const clientParents = [...selectors_getBlockParents(state, clientId), clientId]; 9734 const selectedParents = [...selectors_getBlockParents(state, selectedId), selectedId]; 9735 let lowestCommonAncestor; 9736 const maxDepth = Math.min(clientParents.length, selectedParents.length); 9737 9738 for (let index = 0; index < maxDepth; index++) { 9739 if (clientParents[index] === selectedParents[index]) { 9740 lowestCommonAncestor = clientParents[index]; 9741 } else { 9742 break; 9743 } 9744 } 9745 9746 return lowestCommonAncestor; 9747 } 9748 /** 9749 * Returns the client ID of the block adjacent one at the given reference 9750 * startClientId and modifier directionality. Defaults start startClientId to 9751 * the selected block, and direction as next block. Returns null if there is no 9752 * adjacent block. 9753 * 9754 * @param {Object} state Editor state. 9755 * @param {?string} startClientId Optional client ID of block from which to 9756 * search. 9757 * @param {?number} modifier Directionality multiplier (1 next, -1 9758 * previous). 9759 * 9760 * @return {?string} Return the client ID of the block, or null if none exists. 9761 */ 9762 9763 function getAdjacentBlockClientId(state, startClientId, modifier = 1) { 9764 // Default to selected block. 9765 if (startClientId === undefined) { 9766 startClientId = selectors_getSelectedBlockClientId(state); 9767 } // Try multi-selection starting at extent based on modifier. 9768 9769 9770 if (startClientId === undefined) { 9771 if (modifier < 0) { 9772 startClientId = selectors_getFirstMultiSelectedBlockClientId(state); 9773 } else { 9774 startClientId = selectors_getLastMultiSelectedBlockClientId(state); 9775 } 9776 } // Validate working start client ID. 9777 9778 9779 if (!startClientId) { 9780 return null; 9781 } // Retrieve start block root client ID, being careful to allow the falsey 9782 // empty string top-level root by explicitly testing against null. 9783 9784 9785 const rootClientId = selectors_getBlockRootClientId(state, startClientId); 9786 9787 if (rootClientId === null) { 9788 return null; 9789 } 9790 9791 const { 9792 order 9793 } = state.blocks; 9794 const orderSet = order[rootClientId]; 9795 const index = orderSet.indexOf(startClientId); 9796 const nextIndex = index + 1 * modifier; // Block was first in set and we're attempting to get previous. 9797 9798 if (nextIndex < 0) { 9799 return null; 9800 } // Block was last in set and we're attempting to get next. 9801 9802 9803 if (nextIndex === orderSet.length) { 9804 return null; 9805 } // Assume incremented index is within the set. 9806 9807 9808 return orderSet[nextIndex]; 9809 } 9810 /** 9811 * Returns the previous block's client ID from the given reference start ID. 9812 * Defaults start to the selected block. Returns null if there is no previous 9813 * block. 9814 * 9815 * @param {Object} state Editor state. 9816 * @param {?string} startClientId Optional client ID of block from which to 9817 * search. 9818 * 9819 * @return {?string} Adjacent block's client ID, or null if none exists. 9820 */ 9821 9822 function selectors_getPreviousBlockClientId(state, startClientId) { 9823 return getAdjacentBlockClientId(state, startClientId, -1); 9824 } 9825 /** 9826 * Returns the next block's client ID from the given reference start ID. 9827 * Defaults start to the selected block. Returns null if there is no next 9828 * block. 9829 * 9830 * @param {Object} state Editor state. 9831 * @param {?string} startClientId Optional client ID of block from which to 9832 * search. 9833 * 9834 * @return {?string} Adjacent block's client ID, or null if none exists. 9835 */ 9836 9837 function selectors_getNextBlockClientId(state, startClientId) { 9838 return getAdjacentBlockClientId(state, startClientId, 1); 9839 } 9840 /** 9841 * Returns the initial caret position for the selected block. 9842 * This position is to used to position the caret properly when the selected block changes. 9843 * If the current block is not a RichText, having initial position set to 0 means "focus block" 9844 * 9845 * @param {Object} state Global application state. 9846 * 9847 * @return {0|-1|null} Initial position. 9848 */ 9849 9850 function selectors_getSelectedBlocksInitialCaretPosition(state) { 9851 return state.initialPosition; 9852 } 9853 /** 9854 * Returns the current selection set of block client IDs (multiselection or single selection). 9855 * 9856 * @param {Object} state Editor state. 9857 * 9858 * @return {Array} Multi-selected block client IDs. 9859 */ 9860 9861 const selectors_getSelectedBlockClientIds = Object(rememo["a" /* default */])(state => { 9862 const { 9863 selectionStart, 9864 selectionEnd 9865 } = state.selection; 9866 9867 if (selectionStart.clientId === undefined || selectionEnd.clientId === undefined) { 9868 return EMPTY_ARRAY; 9869 } 9870 9871 if (selectionStart.clientId === selectionEnd.clientId) { 9872 return [selectionStart.clientId]; 9873 } // Retrieve root client ID to aid in retrieving relevant nested block 9874 // order, being careful to allow the falsey empty string top-level root 9875 // by explicitly testing against null. 9876 9877 9878 const rootClientId = selectors_getBlockRootClientId(state, selectionStart.clientId); 9879 9880 if (rootClientId === null) { 9881 return EMPTY_ARRAY; 9882 } 9883 9884 const blockOrder = selectors_getBlockOrder(state, rootClientId); 9885 const startIndex = blockOrder.indexOf(selectionStart.clientId); 9886 const endIndex = blockOrder.indexOf(selectionEnd.clientId); 9887 9888 if (startIndex > endIndex) { 9889 return blockOrder.slice(endIndex, startIndex + 1); 9890 } 9891 9892 return blockOrder.slice(startIndex, endIndex + 1); 9893 }, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]); 9894 /** 9895 * Returns the current multi-selection set of block client IDs, or an empty 9896 * array if there is no multi-selection. 9897 * 9898 * @param {Object} state Editor state. 9899 * 9900 * @return {Array} Multi-selected block client IDs. 9901 */ 9902 9903 function selectors_getMultiSelectedBlockClientIds(state) { 9904 const { 9905 selectionStart, 9906 selectionEnd 9907 } = state.selection; 9908 9909 if (selectionStart.clientId === selectionEnd.clientId) { 9910 return EMPTY_ARRAY; 9911 } 9912 9913 return selectors_getSelectedBlockClientIds(state); 9914 } 9915 /** 9916 * Returns the current multi-selection set of blocks, or an empty array if 9917 * there is no multi-selection. 9918 * 9919 * @param {Object} state Editor state. 9920 * 9921 * @return {Array} Multi-selected block objects. 9922 */ 9923 9924 const selectors_getMultiSelectedBlocks = Object(rememo["a" /* default */])(state => { 9925 const multiSelectedBlockClientIds = selectors_getMultiSelectedBlockClientIds(state); 9926 9927 if (!multiSelectedBlockClientIds.length) { 9928 return EMPTY_ARRAY; 9929 } 9930 9931 return multiSelectedBlockClientIds.map(clientId => selectors_getBlock(state, clientId)); 9932 }, state => [...selectors_getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]); 9933 /** 9934 * Returns the client ID of the first block in the multi-selection set, or null 9935 * if there is no multi-selection. 9936 * 9937 * @param {Object} state Editor state. 9938 * 9939 * @return {?string} First block client ID in the multi-selection set. 9940 */ 9941 9942 function selectors_getFirstMultiSelectedBlockClientId(state) { 9943 return Object(external_lodash_["first"])(selectors_getMultiSelectedBlockClientIds(state)) || null; 9944 } 9945 /** 9946 * Returns the client ID of the last block in the multi-selection set, or null 9947 * if there is no multi-selection. 9948 * 9949 * @param {Object} state Editor state. 9950 * 9951 * @return {?string} Last block client ID in the multi-selection set. 9952 */ 9953 9954 function selectors_getLastMultiSelectedBlockClientId(state) { 9955 return Object(external_lodash_["last"])(selectors_getMultiSelectedBlockClientIds(state)) || null; 9956 } 9957 /** 9958 * Returns true if a multi-selection exists, and the block corresponding to the 9959 * specified client ID is the first block of the multi-selection set, or false 9960 * otherwise. 9961 * 9962 * @param {Object} state Editor state. 9963 * @param {string} clientId Block client ID. 9964 * 9965 * @return {boolean} Whether block is first in multi-selection. 9966 */ 9967 9968 function selectors_isFirstMultiSelectedBlock(state, clientId) { 9969 return selectors_getFirstMultiSelectedBlockClientId(state) === clientId; 9970 } 9971 /** 9972 * Returns true if the client ID occurs within the block multi-selection, or 9973 * false otherwise. 9974 * 9975 * @param {Object} state Editor state. 9976 * @param {string} clientId Block client ID. 9977 * 9978 * @return {boolean} Whether block is in multi-selection set. 9979 */ 9980 9981 function selectors_isBlockMultiSelected(state, clientId) { 9982 return selectors_getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; 9983 } 9984 /** 9985 * Returns true if an ancestor of the block is multi-selected, or false 9986 * otherwise. 9987 * 9988 * @param {Object} state Editor state. 9989 * @param {string} clientId Block client ID. 9990 * 9991 * @return {boolean} Whether an ancestor of the block is in multi-selection 9992 * set. 9993 */ 9994 9995 const selectors_isAncestorMultiSelected = Object(rememo["a" /* default */])((state, clientId) => { 9996 let ancestorClientId = clientId; 9997 let isMultiSelected = false; 9998 9999 while (ancestorClientId && !isMultiSelected) { 10000 ancestorClientId = selectors_getBlockRootClientId(state, ancestorClientId); 10001 isMultiSelected = selectors_isBlockMultiSelected(state, ancestorClientId); 10002 } 10003 10004 return isMultiSelected; 10005 }, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]); 10006 /** 10007 * Returns the client ID of the block which begins the multi-selection set, or 10008 * null if there is no multi-selection. 10009 * 10010 * This is not necessarily the first client ID in the selection. 10011 * 10012 * @see getFirstMultiSelectedBlockClientId 10013 * 10014 * @param {Object} state Editor state. 10015 * 10016 * @return {?string} Client ID of block beginning multi-selection. 10017 */ 10018 10019 function selectors_getMultiSelectedBlocksStartClientId(state) { 10020 const { 10021 selectionStart, 10022 selectionEnd 10023 } = state.selection; 10024 10025 if (selectionStart.clientId === selectionEnd.clientId) { 10026 return null; 10027 } 10028 10029 return selectionStart.clientId || null; 10030 } 10031 /** 10032 * Returns the client ID of the block which ends the multi-selection set, or 10033 * null if there is no multi-selection. 10034 * 10035 * This is not necessarily the last client ID in the selection. 10036 * 10037 * @see getLastMultiSelectedBlockClientId 10038 * 10039 * @param {Object} state Editor state. 10040 * 10041 * @return {?string} Client ID of block ending multi-selection. 10042 */ 10043 10044 function selectors_getMultiSelectedBlocksEndClientId(state) { 10045 const { 10046 selectionStart, 10047 selectionEnd 10048 } = state.selection; 10049 10050 if (selectionStart.clientId === selectionEnd.clientId) { 10051 return null; 10052 } 10053 10054 return selectionEnd.clientId || null; 10055 } 10056 /** 10057 * Returns an array containing all block client IDs in the editor in the order 10058 * they appear. Optionally accepts a root client ID of the block list for which 10059 * the order should be returned, defaulting to the top-level block order. 10060 * 10061 * @param {Object} state Editor state. 10062 * @param {?string} rootClientId Optional root client ID of block list. 10063 * 10064 * @return {Array} Ordered client IDs of editor blocks. 10065 */ 10066 10067 function selectors_getBlockOrder(state, rootClientId) { 10068 return state.blocks.order[rootClientId || ''] || EMPTY_ARRAY; 10069 } 10070 /** 10071 * Returns the index at which the block corresponding to the specified client 10072 * ID occurs within the block order, or `-1` if the block does not exist. 10073 * 10074 * @param {Object} state Editor state. 10075 * @param {string} clientId Block client ID. 10076 * @param {?string} rootClientId Optional root client ID of block list. 10077 * 10078 * @return {number} Index at which block exists in order. 10079 */ 10080 10081 function selectors_getBlockIndex(state, clientId, rootClientId) { 10082 return selectors_getBlockOrder(state, rootClientId).indexOf(clientId); 10083 } 10084 /** 10085 * Returns true if the block corresponding to the specified client ID is 10086 * currently selected and no multi-selection exists, or false otherwise. 10087 * 10088 * @param {Object} state Editor state. 10089 * @param {string} clientId Block client ID. 10090 * 10091 * @return {boolean} Whether block is selected and multi-selection exists. 10092 */ 10093 10094 function selectors_isBlockSelected(state, clientId) { 10095 const { 10096 selectionStart, 10097 selectionEnd 10098 } = state.selection; 10099 10100 if (selectionStart.clientId !== selectionEnd.clientId) { 10101 return false; 10102 } 10103 10104 return selectionStart.clientId === clientId; 10105 } 10106 /** 10107 * Returns true if one of the block's inner blocks is selected. 10108 * 10109 * @param {Object} state Editor state. 10110 * @param {string} clientId Block client ID. 10111 * @param {boolean} deep Perform a deep check. 10112 * 10113 * @return {boolean} Whether the block as an inner block selected 10114 */ 10115 10116 function selectors_hasSelectedInnerBlock(state, clientId, deep = false) { 10117 return Object(external_lodash_["some"])(selectors_getBlockOrder(state, clientId), innerClientId => selectors_isBlockSelected(state, innerClientId) || selectors_isBlockMultiSelected(state, innerClientId) || deep && selectors_hasSelectedInnerBlock(state, innerClientId, deep)); 10118 } 10119 /** 10120 * Returns true if the block corresponding to the specified client ID is 10121 * currently selected but isn't the last of the selected blocks. Here "last" 10122 * refers to the block sequence in the document, _not_ the sequence of 10123 * multi-selection, which is why `state.selectionEnd` isn't used. 10124 * 10125 * @param {Object} state Editor state. 10126 * @param {string} clientId Block client ID. 10127 * 10128 * @return {boolean} Whether block is selected and not the last in the 10129 * selection. 10130 */ 10131 10132 function isBlockWithinSelection(state, clientId) { 10133 if (!clientId) { 10134 return false; 10135 } 10136 10137 const clientIds = selectors_getMultiSelectedBlockClientIds(state); 10138 const index = clientIds.indexOf(clientId); 10139 return index > -1 && index < clientIds.length - 1; 10140 } 10141 /** 10142 * Returns true if a multi-selection has been made, or false otherwise. 10143 * 10144 * @param {Object} state Editor state. 10145 * 10146 * @return {boolean} Whether multi-selection has been made. 10147 */ 10148 10149 function selectors_hasMultiSelection(state) { 10150 const { 10151 selectionStart, 10152 selectionEnd 10153 } = state.selection; 10154 return selectionStart.clientId !== selectionEnd.clientId; 10155 } 10156 /** 10157 * Whether in the process of multi-selecting or not. This flag is only true 10158 * while the multi-selection is being selected (by mouse move), and is false 10159 * once the multi-selection has been settled. 10160 * 10161 * @see hasMultiSelection 10162 * 10163 * @param {Object} state Global application state. 10164 * 10165 * @return {boolean} True if multi-selecting, false if not. 10166 */ 10167 10168 function selectors_isMultiSelecting(state) { 10169 return state.isMultiSelecting; 10170 } 10171 /** 10172 * Selector that returns if multi-selection is enabled or not. 10173 * 10174 * @param {Object} state Global application state. 10175 * 10176 * @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled. 10177 */ 10178 10179 function selectors_isSelectionEnabled(state) { 10180 return state.isSelectionEnabled; 10181 } 10182 /** 10183 * Returns the block's editing mode, defaulting to "visual" if not explicitly 10184 * assigned. 10185 * 10186 * @param {Object} state Editor state. 10187 * @param {string} clientId Block client ID. 10188 * 10189 * @return {Object} Block editing mode. 10190 */ 10191 10192 function selectors_getBlockMode(state, clientId) { 10193 return state.blocksMode[clientId] || 'visual'; 10194 } 10195 /** 10196 * Returns true if the user is typing, or false otherwise. 10197 * 10198 * @param {Object} state Global application state. 10199 * 10200 * @return {boolean} Whether user is typing. 10201 */ 10202 10203 function selectors_isTyping(state) { 10204 return state.isTyping; 10205 } 10206 /** 10207 * Returns true if the user is dragging blocks, or false otherwise. 10208 * 10209 * @param {Object} state Global application state. 10210 * 10211 * @return {boolean} Whether user is dragging blocks. 10212 */ 10213 10214 function isDraggingBlocks(state) { 10215 return !!state.draggedBlocks.length; 10216 } 10217 /** 10218 * Returns the client ids of any blocks being directly dragged. 10219 * 10220 * This does not include children of a parent being dragged. 10221 * 10222 * @param {Object} state Global application state. 10223 * 10224 * @return {string[]} Array of dragged block client ids. 10225 */ 10226 10227 function selectors_getDraggedBlockClientIds(state) { 10228 return state.draggedBlocks; 10229 } 10230 /** 10231 * Returns whether the block is being dragged. 10232 * 10233 * Only returns true if the block is being directly dragged, 10234 * not if the block is a child of a parent being dragged. 10235 * See `isAncestorBeingDragged` for child blocks. 10236 * 10237 * @param {Object} state Global application state. 10238 * @param {string} clientId Client id for block to check. 10239 * 10240 * @return {boolean} Whether the block is being dragged. 10241 */ 10242 10243 function selectors_isBlockBeingDragged(state, clientId) { 10244 return state.draggedBlocks.includes(clientId); 10245 } 10246 /** 10247 * Returns whether a parent/ancestor of the block is being dragged. 10248 * 10249 * @param {Object} state Global application state. 10250 * @param {string} clientId Client id for block to check. 10251 * 10252 * @return {boolean} Whether the block's ancestor is being dragged. 10253 */ 10254 10255 function selectors_isAncestorBeingDragged(state, clientId) { 10256 // Return early if no blocks are being dragged rather than 10257 // the more expensive check for parents. 10258 if (!isDraggingBlocks(state)) { 10259 return false; 10260 } 10261 10262 const parents = selectors_getBlockParents(state, clientId); 10263 return Object(external_lodash_["some"])(parents, parentClientId => selectors_isBlockBeingDragged(state, parentClientId)); 10264 } 10265 /** 10266 * Returns true if the caret is within formatted text, or false otherwise. 10267 * 10268 * @param {Object} state Global application state. 10269 * 10270 * @return {boolean} Whether the caret is within formatted text. 10271 */ 10272 10273 function selectors_isCaretWithinFormattedText(state) { 10274 return state.isCaretWithinFormattedText; 10275 } 10276 /** 10277 * Returns the insertion point, the index at which the new inserted block would 10278 * be placed. Defaults to the last index. 10279 * 10280 * @param {Object} state Editor state. 10281 * 10282 * @return {Object} Insertion point object with `rootClientId`, `index`. 10283 */ 10284 10285 function selectors_getBlockInsertionPoint(state) { 10286 let rootClientId, index; 10287 const { 10288 insertionPoint, 10289 selection: { 10290 selectionEnd 10291 } 10292 } = state; 10293 10294 if (insertionPoint !== null) { 10295 return insertionPoint; 10296 } 10297 10298 const { 10299 clientId 10300 } = selectionEnd; 10301 10302 if (clientId) { 10303 rootClientId = selectors_getBlockRootClientId(state, clientId) || undefined; 10304 index = selectors_getBlockIndex(state, selectionEnd.clientId, rootClientId) + 1; 10305 } else { 10306 index = selectors_getBlockOrder(state).length; 10307 } 10308 10309 return { 10310 rootClientId, 10311 index 10312 }; 10313 } 10314 /** 10315 * Returns true if we should show the block insertion point. 10316 * 10317 * @param {Object} state Global application state. 10318 * 10319 * @return {?boolean} Whether the insertion point is visible or not. 10320 */ 10321 10322 function selectors_isBlockInsertionPointVisible(state) { 10323 return state.insertionPoint !== null; 10324 } 10325 /** 10326 * Returns whether the blocks matches the template or not. 10327 * 10328 * @param {boolean} state 10329 * @return {?boolean} Whether the template is valid or not. 10330 */ 10331 10332 function selectors_isValidTemplate(state) { 10333 return state.template.isValid; 10334 } 10335 /** 10336 * Returns the defined block template 10337 * 10338 * @param {boolean} state 10339 * @return {?Array} Block Template 10340 */ 10341 10342 function getTemplate(state) { 10343 return state.settings.template; 10344 } 10345 /** 10346 * Returns the defined block template lock. Optionally accepts a root block 10347 * client ID as context, otherwise defaulting to the global context. 10348 * 10349 * @param {Object} state Editor state. 10350 * @param {?string} rootClientId Optional block root client ID. 10351 * 10352 * @return {?string} Block Template Lock 10353 */ 10354 10355 function selectors_getTemplateLock(state, rootClientId) { 10356 if (!rootClientId) { 10357 return state.settings.templateLock; 10358 } 10359 10360 const blockListSettings = selectors_getBlockListSettings(state, rootClientId); 10361 10362 if (!blockListSettings) { 10363 return null; 10364 } 10365 10366 return blockListSettings.templateLock; 10367 } 10368 10369 const checkAllowList = (list, item, defaultResult = null) => { 10370 if (Object(external_lodash_["isBoolean"])(list)) { 10371 return list; 10372 } 10373 10374 if (Object(external_lodash_["isArray"])(list)) { 10375 // TODO: when there is a canonical way to detect that we are editing a post 10376 // the following check should be changed to something like: 10377 // if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null ) 10378 if (list.includes('core/post-content') && item === null) { 10379 return true; 10380 } 10381 10382 return list.includes(item); 10383 } 10384 10385 return defaultResult; 10386 }; 10387 /** 10388 * Determines if the given block type is allowed to be inserted into the block list. 10389 * This function is not exported and not memoized because using a memoized selector 10390 * inside another memoized selector is just a waste of time. 10391 * 10392 * @param {Object} state Editor state. 10393 * @param {string|Object} blockName The block type object, e.g., the response 10394 * from the block directory; or a string name of 10395 * an installed block type, e.g.' core/paragraph'. 10396 * @param {?string} rootClientId Optional root client ID of block list. 10397 * 10398 * @return {boolean} Whether the given block type is allowed to be inserted. 10399 */ 10400 10401 10402 const canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => { 10403 let blockType; 10404 10405 if (blockName && 'object' === typeof blockName) { 10406 blockType = blockName; 10407 blockName = blockType.name; 10408 } else { 10409 blockType = Object(external_wp_blocks_["getBlockType"])(blockName); 10410 } 10411 10412 if (!blockType) { 10413 return false; 10414 } 10415 10416 const { 10417 allowedBlockTypes 10418 } = selectors_getSettings(state); 10419 const isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true); 10420 10421 if (!isBlockAllowedInEditor) { 10422 return false; 10423 } 10424 10425 const isLocked = !!selectors_getTemplateLock(state, rootClientId); 10426 10427 if (isLocked) { 10428 return false; 10429 } 10430 10431 const parentBlockListSettings = selectors_getBlockListSettings(state, rootClientId); // The parent block doesn't have settings indicating it doesn't support 10432 // inner blocks, return false. 10433 10434 if (rootClientId && parentBlockListSettings === undefined) { 10435 return false; 10436 } 10437 10438 const parentAllowedBlocks = parentBlockListSettings === null || parentBlockListSettings === void 0 ? void 0 : parentBlockListSettings.allowedBlocks; 10439 const hasParentAllowedBlock = checkAllowList(parentAllowedBlocks, blockName); 10440 const blockAllowedParentBlocks = blockType.parent; 10441 const parentName = selectors_getBlockName(state, rootClientId); 10442 const hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName); 10443 10444 if (hasParentAllowedBlock !== null && hasBlockAllowedParent !== null) { 10445 return hasParentAllowedBlock || hasBlockAllowedParent; 10446 } else if (hasParentAllowedBlock !== null) { 10447 return hasParentAllowedBlock; 10448 } else if (hasBlockAllowedParent !== null) { 10449 return hasBlockAllowedParent; 10450 } 10451 10452 return true; 10453 }; 10454 /** 10455 * Determines if the given block type is allowed to be inserted into the block list. 10456 * 10457 * @param {Object} state Editor state. 10458 * @param {string} blockName The name of the block type, e.g.' core/paragraph'. 10459 * @param {?string} rootClientId Optional root client ID of block list. 10460 * 10461 * @return {boolean} Whether the given block type is allowed to be inserted. 10462 */ 10463 10464 10465 const selectors_canInsertBlockType = Object(rememo["a" /* default */])(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId], state.settings.allowedBlockTypes, state.settings.templateLock]); 10466 /** 10467 * Determines if the given blocks are allowed to be inserted into the block 10468 * list. 10469 * 10470 * @param {Object} state Editor state. 10471 * @param {string} clientIds The block client IDs to be inserted. 10472 * @param {?string} rootClientId Optional root client ID of block list. 10473 * 10474 * @return {boolean} Whether the given blocks are allowed to be inserted. 10475 */ 10476 10477 function selectors_canInsertBlocks(state, clientIds, rootClientId = null) { 10478 return clientIds.every(id => selectors_canInsertBlockType(state, selectors_getBlockName(state, id), rootClientId)); 10479 } 10480 /** 10481 * Returns information about how recently and frequently a block has been inserted. 10482 * 10483 * @param {Object} state Global application state. 10484 * @param {string} id A string which identifies the insert, e.g. 'core/block/12' 10485 * 10486 * @return {?{ time: number, count: number }} An object containing `time` which is when the last 10487 * insert occurred as a UNIX epoch, and `count` which is 10488 * the number of inserts that have occurred. 10489 */ 10490 10491 function getInsertUsage(state, id) { 10492 var _state$preferences$in, _state$preferences$in2; 10493 10494 return (_state$preferences$in = (_state$preferences$in2 = state.preferences.insertUsage) === null || _state$preferences$in2 === void 0 ? void 0 : _state$preferences$in2[id]) !== null && _state$preferences$in !== void 0 ? _state$preferences$in : null; 10495 } 10496 /** 10497 * Returns whether we can show a block type in the inserter 10498 * 10499 * @param {Object} state Global State 10500 * @param {Object} blockType BlockType 10501 * @param {?string} rootClientId Optional root client ID of block list. 10502 * 10503 * @return {boolean} Whether the given block type is allowed to be shown in the inserter. 10504 */ 10505 10506 10507 const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => { 10508 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'inserter', true)) { 10509 return false; 10510 } 10511 10512 return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId); 10513 }; 10514 /** 10515 * Return a function to be used to tranform a block variation to an inserter item 10516 * 10517 * @param {Object} state Global State 10518 * @param {Object} item Denormalized inserter item 10519 * @return {Function} Function to transform a block variation to inserter item 10520 */ 10521 10522 10523 const getItemFromVariation = (state, item) => variation => { 10524 const variationId = `${item.id}/${variation.name}`; 10525 const { 10526 time, 10527 count = 0 10528 } = getInsertUsage(state, variationId) || {}; 10529 return { ...item, 10530 id: variationId, 10531 icon: variation.icon || item.icon, 10532 title: variation.title || item.title, 10533 description: variation.description || item.description, 10534 category: variation.category || item.category, 10535 // If `example` is explicitly undefined for the variation, the preview will not be shown. 10536 example: variation.hasOwnProperty('example') ? variation.example : item.example, 10537 initialAttributes: { ...item.initialAttributes, 10538 ...variation.attributes 10539 }, 10540 innerBlocks: variation.innerBlocks, 10541 keywords: variation.keywords || item.keywords, 10542 frecency: calculateFrecency(time, count) 10543 }; 10544 }; 10545 /** 10546 * Returns the calculated frecency. 10547 * 10548 * 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency) 10549 * that combines block usage frequenty and recency. 10550 * 10551 * @param {number} time When the last insert occurred as a UNIX epoch 10552 * @param {number} count The number of inserts that have occurred. 10553 * 10554 * @return {number} The calculated frecency. 10555 */ 10556 10557 10558 const calculateFrecency = (time, count) => { 10559 if (!time) { 10560 return count; 10561 } // The selector is cached, which means Date.now() is the last time that the 10562 // relevant state changed. This suits our needs. 10563 10564 10565 const duration = Date.now() - time; 10566 10567 switch (true) { 10568 case duration < MILLISECONDS_PER_HOUR: 10569 return count * 4; 10570 10571 case duration < MILLISECONDS_PER_DAY: 10572 return count * 2; 10573 10574 case duration < MILLISECONDS_PER_WEEK: 10575 return count / 2; 10576 10577 default: 10578 return count / 4; 10579 } 10580 }; 10581 /** 10582 * Returns a function that accepts a block type and builds an item to be shown 10583 * in a specific context. It's used for building items for Inserter and available 10584 * block Transfroms list. 10585 * 10586 * @param {Object} state Editor state. 10587 * @param {Object} options Options object for handling the building of a block type. 10588 * @param {string} options.buildScope The scope for which the item is going to be used. 10589 * @return {Function} Function returns an item to be shown in a specific context (Inserter|Transforms list). 10590 */ 10591 10592 10593 const buildBlockTypeItem = (state, { 10594 buildScope = 'inserter' 10595 }) => blockType => { 10596 const id = blockType.name; 10597 let isDisabled = false; 10598 10599 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType.name, 'multiple', true)) { 10600 isDisabled = Object(external_lodash_["some"])(selectors_getBlocksByClientId(state, getClientIdsWithDescendants(state)), { 10601 name: blockType.name 10602 }); 10603 } 10604 10605 const { 10606 time, 10607 count = 0 10608 } = getInsertUsage(state, id) || {}; 10609 const blockItemBase = { 10610 id, 10611 name: blockType.name, 10612 title: blockType.title, 10613 icon: blockType.icon, 10614 isDisabled, 10615 frecency: calculateFrecency(time, count) 10616 }; 10617 if (buildScope === 'transform') return blockItemBase; 10618 const inserterVariations = blockType.variations.filter(({ 10619 scope 10620 }) => !scope || scope.includes('inserter')); 10621 return { ...blockItemBase, 10622 initialAttributes: {}, 10623 description: blockType.description, 10624 category: blockType.category, 10625 keywords: blockType.keywords, 10626 variations: inserterVariations, 10627 example: blockType.example, 10628 utility: 1 // deprecated 10629 10630 }; 10631 }; 10632 /** 10633 * Determines the items that appear in the inserter. Includes both static 10634 * items (e.g. a regular block type) and dynamic items (e.g. a reusable block). 10635 * 10636 * Each item object contains what's necessary to display a button in the 10637 * inserter and handle its selection. 10638 * 10639 * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency) 10640 * that combines block usage frequenty and recency. 10641 * 10642 * Items are returned ordered descendingly by their 'utility' and 'frecency'. 10643 * 10644 * @param {Object} state Editor state. 10645 * @param {?string} rootClientId Optional root client ID of block list. 10646 * 10647 * @return {WPEditorInserterItem[]} Items that appear in inserter. 10648 * 10649 * @typedef {Object} WPEditorInserterItem 10650 * @property {string} id Unique identifier for the item. 10651 * @property {string} name The type of block to create. 10652 * @property {Object} initialAttributes Attributes to pass to the newly created block. 10653 * @property {string} title Title of the item, as it appears in the inserter. 10654 * @property {string} icon Dashicon for the item, as it appears in the inserter. 10655 * @property {string} category Block category that the item is associated with. 10656 * @property {string[]} keywords Keywords that can be searched to find this item. 10657 * @property {boolean} isDisabled Whether or not the user should be prevented from inserting 10658 * this item. 10659 * @property {number} frecency Heuristic that combines frequency and recency. 10660 */ 10661 10662 10663 const selectors_getInserterItems = Object(rememo["a" /* default */])((state, rootClientId = null) => { 10664 const buildBlockTypeInserterItem = buildBlockTypeItem(state, { 10665 buildScope: 'inserter' 10666 }); 10667 10668 const buildReusableBlockInserterItem = reusableBlock => { 10669 const id = `core/block/${reusableBlock.id}`; 10670 10671 const referencedBlocks = __experimentalGetParsedReusableBlock(state, reusableBlock.id); 10672 10673 let referencedBlockType; 10674 10675 if (referencedBlocks.length === 1) { 10676 referencedBlockType = Object(external_wp_blocks_["getBlockType"])(referencedBlocks[0].name); 10677 } 10678 10679 const { 10680 time, 10681 count = 0 10682 } = getInsertUsage(state, id) || {}; 10683 const frecency = calculateFrecency(time, count); 10684 return { 10685 id, 10686 name: 'core/block', 10687 initialAttributes: { 10688 ref: reusableBlock.id 10689 }, 10690 title: reusableBlock.title.raw, 10691 icon: referencedBlockType ? referencedBlockType.icon : templateIcon, 10692 category: 'reusable', 10693 keywords: [], 10694 isDisabled: false, 10695 utility: 1, 10696 // deprecated 10697 frecency 10698 }; 10699 }; 10700 10701 const blockTypeInserterItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem); 10702 const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : []; // Exclude any block type item that is to be replaced by a default 10703 // variation. 10704 10705 const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(({ 10706 variations = [] 10707 }) => !variations.some(({ 10708 isDefault 10709 }) => isDefault)); 10710 const blockVariations = []; // Show all available blocks with variations 10711 10712 for (const item of blockTypeInserterItems) { 10713 const { 10714 variations = [] 10715 } = item; 10716 10717 if (variations.length) { 10718 const variationMapper = getItemFromVariation(state, item); 10719 blockVariations.push(...variations.map(variationMapper)); 10720 } 10721 } // Prioritize core blocks's display in inserter. 10722 10723 10724 const prioritizeCoreBlocks = (a, b) => { 10725 const coreBlockNamePrefix = 'core/'; 10726 const firstIsCoreBlock = a.name.startsWith(coreBlockNamePrefix); 10727 const secondIsCoreBlock = b.name.startsWith(coreBlockNamePrefix); 10728 10729 if (firstIsCoreBlock && secondIsCoreBlock) { 10730 return 0; 10731 } 10732 10733 return firstIsCoreBlock && !secondIsCoreBlock ? -1 : 1; 10734 }; // Ensure core blocks are prioritized in the returned results, 10735 // because third party blocks can be registered earlier than 10736 // the core blocks (usually by using the `init` action), 10737 // thus affecting the display order. 10738 // We don't sort reusable blocks as they are handled differently. 10739 10740 10741 const sortedBlockTypes = [...visibleBlockTypeInserterItems, ...blockVariations].sort(prioritizeCoreBlocks); 10742 return [...sortedBlockTypes, ...reusableBlockInserterItems]; 10743 }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]); 10744 /** 10745 * Determines the items that appear in the available block transforms list. 10746 * 10747 * Each item object contains what's necessary to display a menu item in the 10748 * transform list and handle its selection. 10749 * 10750 * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency) 10751 * that combines block usage frequenty and recency. 10752 * 10753 * Items are returned ordered descendingly by their 'frecency'. 10754 * 10755 * @param {Object} state Editor state. 10756 * @param {?string} rootClientId Optional root client ID of block list. 10757 * 10758 * @return {WPEditorTransformItem[]} Items that appear in inserter. 10759 * 10760 * @typedef {Object} WPEditorTransformItem 10761 * @property {string} id Unique identifier for the item. 10762 * @property {string} name The type of block to create. 10763 * @property {string} title Title of the item, as it appears in the inserter. 10764 * @property {string} icon Dashicon for the item, as it appears in the inserter. 10765 * @property {boolean} isDisabled Whether or not the user should be prevented from inserting 10766 * this item. 10767 * @property {number} frecency Heuristic that combines frequency and recency. 10768 */ 10769 10770 const selectors_getBlockTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => { 10771 const buildBlockTypeTransformItem = buildBlockTypeItem(state, { 10772 buildScope: 'transform' 10773 }); 10774 const blockTypeTransformItems = Object(external_wp_blocks_["getBlockTypes"])().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem); 10775 const itemsByName = Object(external_lodash_["mapKeys"])(blockTypeTransformItems, ({ 10776 name 10777 }) => name); 10778 const possibleTransforms = Object(external_wp_blocks_["getPossibleBlockTransformations"])(blocks).reduce((accumulator, block) => { 10779 if (itemsByName[block === null || block === void 0 ? void 0 : block.name]) { 10780 accumulator.push(itemsByName[block.name]); 10781 } 10782 10783 return accumulator; 10784 }, []); 10785 const possibleBlockTransformations = Object(external_lodash_["orderBy"])(possibleTransforms, block => itemsByName[block.name].frecency, 'desc'); 10786 return possibleBlockTransformations; 10787 }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, Object(external_wp_blocks_["getBlockTypes"])()]); 10788 /** 10789 * Determines whether there are items to show in the inserter. 10790 * 10791 * @param {Object} state Editor state. 10792 * @param {?string} rootClientId Optional root client ID of block list. 10793 * 10794 * @return {boolean} Items that appear in inserter. 10795 */ 10796 10797 const selectors_hasInserterItems = Object(rememo["a" /* default */])((state, rootClientId = null) => { 10798 const hasBlockType = Object(external_lodash_["some"])(Object(external_wp_blocks_["getBlockTypes"])(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); 10799 10800 if (hasBlockType) { 10801 return true; 10802 } 10803 10804 const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0; 10805 return hasReusableBlock; 10806 }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), Object(external_wp_blocks_["getBlockTypes"])()]); 10807 /** 10808 * Returns the list of allowed inserter blocks for inner blocks children 10809 * 10810 * @param {Object} state Editor state. 10811 * @param {?string} rootClientId Optional root client ID of block list. 10812 * 10813 * @return {Array?} The list of allowed block types. 10814 */ 10815 10816 const selectors_experimentalGetAllowedBlocks = Object(rememo["a" /* default */])((state, rootClientId = null) => { 10817 if (!rootClientId) { 10818 return; 10819 } 10820 10821 return Object(external_lodash_["filter"])(Object(external_wp_blocks_["getBlockTypes"])(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)); 10822 }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, Object(external_wp_blocks_["getBlockTypes"])()]); 10823 10824 const checkAllowListRecursive = (blocks, allowedBlockTypes) => { 10825 if (Object(external_lodash_["isBoolean"])(allowedBlockTypes)) { 10826 return allowedBlockTypes; 10827 } 10828 10829 const blocksQueue = [...blocks]; 10830 10831 while (blocksQueue.length > 0) { 10832 var _block$innerBlocks; 10833 10834 const block = blocksQueue.shift(); 10835 const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true); 10836 10837 if (!isAllowed) { 10838 return false; 10839 } 10840 10841 (_block$innerBlocks = block.innerBlocks) === null || _block$innerBlocks === void 0 ? void 0 : _block$innerBlocks.forEach(innerBlock => { 10842 blocksQueue.push(innerBlock); 10843 }); 10844 } 10845 10846 return true; 10847 }; 10848 10849 const __experimentalGetParsedPattern = Object(rememo["a" /* default */])((state, patternName) => { 10850 const patterns = state.settings.__experimentalBlockPatterns; 10851 const pattern = patterns.find(({ 10852 name 10853 }) => name === patternName); 10854 10855 if (!pattern) { 10856 return null; 10857 } 10858 10859 return { ...pattern, 10860 blocks: Object(external_wp_blocks_["parse"])(pattern.content) 10861 }; 10862 }, state => [state.settings.__experimentalBlockPatterns]); 10863 const getAllAllowedPatterns = Object(rememo["a" /* default */])(state => { 10864 const patterns = state.settings.__experimentalBlockPatterns; 10865 const { 10866 allowedBlockTypes 10867 } = selectors_getSettings(state); 10868 const parsedPatterns = patterns.map(({ 10869 name 10870 }) => __experimentalGetParsedPattern(state, name)); 10871 const allowedPatterns = parsedPatterns.filter(({ 10872 blocks 10873 }) => checkAllowListRecursive(blocks, allowedBlockTypes)); 10874 return allowedPatterns; 10875 }, state => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes]); 10876 /** 10877 * Returns the list of allowed patterns for inner blocks children. 10878 * 10879 * @param {Object} state Editor state. 10880 * @param {?string} rootClientId Optional target root client ID. 10881 * 10882 * @return {Array?} The list of allowed patterns. 10883 */ 10884 10885 const selectors_experimentalGetAllowedPatterns = Object(rememo["a" /* default */])((state, rootClientId = null) => { 10886 const availableParsedPatterns = getAllAllowedPatterns(state); 10887 const patternsAllowed = Object(external_lodash_["filter"])(availableParsedPatterns, ({ 10888 blocks 10889 }) => blocks.every(({ 10890 name 10891 }) => selectors_canInsertBlockType(state, name, rootClientId))); 10892 return patternsAllowed; 10893 }, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId]]); 10894 /** 10895 * Returns the list of patterns based on their declared `blockTypes` 10896 * and a block's name. 10897 * Patterns can use `blockTypes` to integrate in work flows like 10898 * suggesting appropriate patterns in a Placeholder state(during insertion) 10899 * or blocks transformations. 10900 * 10901 * @param {Object} state Editor state. 10902 * @param {string|string[]} blockNames Block's name or array of block names to find matching pattens. 10903 * @param {?string} rootClientId Optional target root client ID. 10904 * 10905 * @return {Array} The list of matched block patterns based on declared `blockTypes` and block name. 10906 */ 10907 10908 const selectors_experimentalGetPatternsByBlockTypes = Object(rememo["a" /* default */])((state, blockNames, rootClientId = null) => { 10909 if (!blockNames) return EMPTY_ARRAY; 10910 10911 const patterns = selectors_experimentalGetAllowedPatterns(state, rootClientId); 10912 10913 const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames]; 10914 return patterns.filter(pattern => { 10915 var _pattern$blockTypes, _pattern$blockTypes$s; 10916 10917 return pattern === null || pattern === void 0 ? void 0 : (_pattern$blockTypes = pattern.blockTypes) === null || _pattern$blockTypes === void 0 ? void 0 : (_pattern$blockTypes$s = _pattern$blockTypes.some) === null || _pattern$blockTypes$s === void 0 ? void 0 : _pattern$blockTypes$s.call(_pattern$blockTypes, blockName => normalizedBlockNames.includes(blockName)); 10918 }); 10919 }, (state, rootClientId) => [...selectors_experimentalGetAllowedPatterns.getDependants(state, rootClientId)]); 10920 /** 10921 * Determines the items that appear in the available pattern transforms list. 10922 * 10923 * For now we only handle blocks without InnerBlocks and take into account 10924 * the `__experimentalRole` property of blocks' attributes for the transformation. 10925 * 10926 * We return the first set of possible eligible block patterns, 10927 * by checking the `blockTypes` property. We still have to recurse through 10928 * block pattern's blocks and try to find matches from the selected blocks. 10929 * Now this happens in the consumer to avoid heavy operations in the selector. 10930 * 10931 * @param {Object} state Editor state. 10932 * @param {Object[]} blocks The selected blocks. 10933 * @param {?string} rootClientId Optional root client ID of block list. 10934 * 10935 * @return {WPBlockPattern[]} Items that are eligible for a pattern transformation. 10936 */ 10937 10938 const selectors_experimentalGetPatternTransformItems = Object(rememo["a" /* default */])((state, blocks, rootClientId = null) => { 10939 if (!blocks) return EMPTY_ARRAY; 10940 /** 10941 * For now we only handle blocks without InnerBlocks and take into account 10942 * the `__experimentalRole` property of blocks' attributes for the transformation. 10943 * Note that the blocks have been retrieved through `getBlock`, which doesn't 10944 * return the inner blocks of an inner block controller, so we still need 10945 * to check for this case too. 10946 */ 10947 10948 if (blocks.some(({ 10949 clientId, 10950 innerBlocks 10951 }) => innerBlocks.length || areInnerBlocksControlled(state, clientId))) { 10952 return EMPTY_ARRAY; 10953 } // Create a Set of the selected block names that is used in patterns filtering. 10954 10955 10956 const selectedBlockNames = Array.from(new Set(blocks.map(({ 10957 name 10958 }) => name))); 10959 /** 10960 * Here we will return first set of possible eligible block patterns, 10961 * by checking the `blockTypes` property. We still have to recurse through 10962 * block pattern's blocks and try to find matches from the selected blocks. 10963 * Now this happens in the consumer to avoid heavy operations in the selector. 10964 */ 10965 10966 return selectors_experimentalGetPatternsByBlockTypes(state, selectedBlockNames, rootClientId); 10967 }, (state, rootClientId) => [...selectors_experimentalGetPatternsByBlockTypes.getDependants(state, rootClientId)]); 10968 /** 10969 * Returns the Block List settings of a block, if any exist. 10970 * 10971 * @param {Object} state Editor state. 10972 * @param {?string} clientId Block client ID. 10973 * 10974 * @return {?Object} Block settings of the block if set. 10975 */ 10976 10977 function selectors_getBlockListSettings(state, clientId) { 10978 return state.blockListSettings[clientId]; 10979 } 10980 /** 10981 * Returns the editor settings. 10982 * 10983 * @param {Object} state Editor state. 10984 * 10985 * @return {Object} The editor settings object. 10986 */ 10987 10988 function selectors_getSettings(state) { 10989 return state.settings; 10990 } 10991 /** 10992 * Returns true if the most recent block change is be considered persistent, or 10993 * false otherwise. A persistent change is one committed by BlockEditorProvider 10994 * via its `onChange` callback, in addition to `onInput`. 10995 * 10996 * @param {Object} state Block editor state. 10997 * 10998 * @return {boolean} Whether the most recent block change was persistent. 10999 */ 11000 11001 function selectors_isLastBlockChangePersistent(state) { 11002 return state.blocks.isPersistentChange; 11003 } 11004 /** 11005 * Returns the block list settings for an array of blocks, if any exist. 11006 * 11007 * @param {Object} state Editor state. 11008 * @param {Array} clientIds Block client IDs. 11009 * 11010 * @return {Object} An object where the keys are client ids and the values are 11011 * a block list setting object. 11012 */ 11013 11014 const selectors_experimentalGetBlockListSettingsForBlocks = Object(rememo["a" /* default */])((state, clientIds = []) => { 11015 return clientIds.reduce((blockListSettingsForBlocks, clientId) => { 11016 if (!state.blockListSettings[clientId]) { 11017 return blockListSettingsForBlocks; 11018 } 11019 11020 return { ...blockListSettingsForBlocks, 11021 [clientId]: state.blockListSettings[clientId] 11022 }; 11023 }, {}); 11024 }, state => [state.blockListSettings]); 11025 /** 11026 * Returns the parsed block saved as shared block with the given ID. 11027 * 11028 * @param {Object} state Global application state. 11029 * @param {number|string} ref The shared block's ID. 11030 * 11031 * @return {Object} The parsed block. 11032 */ 11033 11034 const __experimentalGetParsedReusableBlock = Object(rememo["a" /* default */])((state, ref) => { 11035 const reusableBlock = Object(external_lodash_["find"])(getReusableBlocks(state), block => block.id === ref); 11036 11037 if (!reusableBlock) { 11038 return null; 11039 } // Only reusableBlock.content.raw should be used here, `reusableBlock.content` is a 11040 // workaround until #22127 is fixed. 11041 11042 11043 return Object(external_wp_blocks_["parse"])(typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content); 11044 }, state => [getReusableBlocks(state)]); 11045 /** 11046 * Returns the title of a given reusable block 11047 * 11048 * @param {Object} state Global application state. 11049 * @param {number|string} ref The shared block's ID. 11050 * 11051 * @return {string} The reusable block saved title. 11052 */ 11053 11054 const selectors_experimentalGetReusableBlockTitle = Object(rememo["a" /* default */])((state, ref) => { 11055 var _reusableBlock$title; 11056 11057 const reusableBlock = Object(external_lodash_["find"])(getReusableBlocks(state), block => block.id === ref); 11058 11059 if (!reusableBlock) { 11060 return null; 11061 } 11062 11063 return (_reusableBlock$title = reusableBlock.title) === null || _reusableBlock$title === void 0 ? void 0 : _reusableBlock$title.raw; 11064 }, state => [getReusableBlocks(state)]); 11065 /** 11066 * Returns true if the most recent block change is be considered ignored, or 11067 * false otherwise. An ignored change is one not to be committed by 11068 * BlockEditorProvider, neither via `onChange` nor `onInput`. 11069 * 11070 * @param {Object} state Block editor state. 11071 * 11072 * @return {boolean} Whether the most recent block change was ignored. 11073 */ 11074 11075 function selectors_unstableIsLastBlockChangeIgnored(state) { 11076 // TODO: Removal Plan: Changes incurred by RECEIVE_BLOCKS should not be 11077 // ignored if in-fact they result in a change in blocks state. The current 11078 // need to ignore changes not a result of user interaction should be 11079 // accounted for in the refactoring of reusable blocks as occurring within 11080 // their own separate block editor / state (#7119). 11081 return state.blocks.isIgnoredChange; 11082 } 11083 /** 11084 * Returns the block attributes changed as a result of the last dispatched 11085 * action. 11086 * 11087 * @param {Object} state Block editor state. 11088 * 11089 * @return {Object<string,Object>} Subsets of block attributes changed, keyed 11090 * by block client ID. 11091 */ 11092 11093 function __experimentalGetLastBlockAttributeChanges(state) { 11094 return state.lastBlockAttributesChange; 11095 } 11096 /** 11097 * Returns the available reusable blocks 11098 * 11099 * @param {Object} state Global application state. 11100 * 11101 * @return {Array} Reusable blocks 11102 */ 11103 11104 function getReusableBlocks(state) { 11105 var _state$settings$__exp, _state$settings; 11106 11107 return (_state$settings$__exp = state === null || state === void 0 ? void 0 : (_state$settings = state.settings) === null || _state$settings === void 0 ? void 0 : _state$settings.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY; 11108 } 11109 /** 11110 * Returns whether the navigation mode is enabled. 11111 * 11112 * @param {Object} state Editor state. 11113 * 11114 * @return {boolean} Is navigation mode enabled. 11115 */ 11116 11117 11118 function selectors_isNavigationMode(state) { 11119 return state.isNavigationMode; 11120 } 11121 /** 11122 * Returns whether block moving mode is enabled. 11123 * 11124 * @param {Object} state Editor state. 11125 * 11126 * @return {string} Client Id of moving block. 11127 */ 11128 11129 function selectors_hasBlockMovingClientId(state) { 11130 return state.hasBlockMovingClientId; 11131 } 11132 /** 11133 * Returns true if the last change was an automatic change, false otherwise. 11134 * 11135 * @param {Object} state Global application state. 11136 * 11137 * @return {boolean} Whether the last change was automatic. 11138 */ 11139 11140 function selectors_didAutomaticChange(state) { 11141 return !!state.automaticChangeStatus; 11142 } 11143 /** 11144 * Returns true if the current highlighted block matches the block clientId. 11145 * 11146 * @param {Object} state Global application state. 11147 * @param {string} clientId The block to check. 11148 * 11149 * @return {boolean} Whether the block is currently highlighted. 11150 */ 11151 11152 function selectors_isBlockHighlighted(state, clientId) { 11153 return state.highlightedBlock === clientId; 11154 } 11155 /** 11156 * Checks if a given block has controlled inner blocks. 11157 * 11158 * @param {Object} state Global application state. 11159 * @param {string} clientId The block to check. 11160 * 11161 * @return {boolean} True if the block has controlled inner blocks. 11162 */ 11163 11164 function areInnerBlocksControlled(state, clientId) { 11165 return !!state.blocks.controlledInnerBlocks[clientId]; 11166 } 11167 /** 11168 * Returns the clientId for the first 'active' block of a given array of block names. 11169 * A block is 'active' if it (or a child) is the selected block. 11170 * Returns the first match moving up the DOM from the selected block. 11171 * 11172 * @param {Object} state Global application state. 11173 * @param {string[]} validBlocksNames The names of block types to check for. 11174 * 11175 * @return {string} The matching block's clientId. 11176 */ 11177 11178 const __experimentalGetActiveBlockIdByBlockNames = Object(rememo["a" /* default */])((state, validBlockNames) => { 11179 if (!validBlockNames.length) { 11180 return null; 11181 } // Check if selected block is a valid entity area. 11182 11183 11184 const selectedBlockClientId = selectors_getSelectedBlockClientId(state); 11185 11186 if (validBlockNames.includes(selectors_getBlockName(state, selectedBlockClientId))) { 11187 return selectedBlockClientId; 11188 } // Check if first selected block is a child of a valid entity area. 11189 11190 11191 const multiSelectedBlockClientIds = selectors_getMultiSelectedBlockClientIds(state); 11192 const entityAreaParents = getBlockParentsByBlockName(state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames); 11193 11194 if (entityAreaParents) { 11195 // Last parent closest/most interior. 11196 return Object(external_lodash_["last"])(entityAreaParents); 11197 } 11198 11199 return null; 11200 }, (state, validBlockNames) => [state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId, validBlockNames]); 11201 /** 11202 * Tells if the block with the passed clientId was just inserted. 11203 * 11204 * @param {Object} state Global application state. 11205 * @param {Object} clientId Client Id of the block. 11206 * @param {?string} source Optional insertion source of the block. 11207 * @return {boolean} True if the block matches the last block inserted from the specified source. 11208 */ 11209 11210 function wasBlockJustInserted(state, clientId, source) { 11211 const { 11212 lastBlockInserted 11213 } = state; 11214 return lastBlockInserted.clientId === clientId && lastBlockInserted.source === source; 11215 } 11216 11217 // EXTERNAL MODULE: external ["wp","a11y"] 11218 var external_wp_a11y_ = __webpack_require__("gdqT"); 11219 11220 // EXTERNAL MODULE: external ["wp","deprecated"] 11221 var external_wp_deprecated_ = __webpack_require__("NMb1"); 11222 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); 11223 11224 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/controls.js 11225 /** 11226 * WordPress dependencies 11227 */ 11228 11229 /** 11230 * Internal dependencies 11231 */ 11232 11233 11234 const __unstableMarkAutomaticChangeFinalControl = function () { 11235 return { 11236 type: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL' 11237 }; 11238 }; 11239 const controls_controls = { 11240 SLEEP({ 11241 duration 11242 }) { 11243 return new Promise(resolve => { 11244 setTimeout(resolve, duration); 11245 }); 11246 }, 11247 11248 MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: Object(external_wp_data_["createRegistryControl"])(registry => () => { 11249 const { 11250 requestIdleCallback = callback => setTimeout(callback, 100) 11251 } = window; 11252 requestIdleCallback(() => registry.dispatch(store).__unstableMarkAutomaticChangeFinal()); 11253 }) 11254 }; 11255 /* harmony default export */ var store_controls = (controls_controls); 11256 11257 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js 11258 const STORE_NAME = 'core/block-editor'; 11259 11260 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js 11261 /** 11262 * External dependencies 11263 */ 11264 11265 /** 11266 * WordPress dependencies 11267 */ 11268 11269 11270 11271 11272 11273 11274 11275 /** 11276 * Internal dependencies 11277 */ 11278 11279 11280 11281 /** 11282 * Generator which will yield a default block insert action if there 11283 * are no other blocks at the root of the editor. This generator should be used 11284 * in actions which may result in no blocks remaining in the editor (removal, 11285 * replacement, etc). 11286 */ 11287 11288 function* ensureDefaultBlock() { 11289 const count = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockCount'); // To avoid a focus loss when removing the last block, assure there is 11290 // always a default block if the last of the blocks have been removed. 11291 11292 if (count === 0) { 11293 const { 11294 __unstableHasCustomAppender 11295 } = yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings'); // If there's an custom appender, don't insert default block. 11296 // We have to remember to manually move the focus elsewhere to 11297 // prevent it from being lost though. 11298 11299 if (__unstableHasCustomAppender) { 11300 return; 11301 } 11302 11303 return yield actions_insertDefaultBlock(); 11304 } 11305 } 11306 /** 11307 * Returns an action object used in signalling that blocks state should be 11308 * reset to the specified array of blocks, taking precedence over any other 11309 * content reflected as an edit in state. 11310 * 11311 * @param {Array} blocks Array of blocks. 11312 */ 11313 11314 11315 function* actions_resetBlocks(blocks) { 11316 yield { 11317 type: 'RESET_BLOCKS', 11318 blocks 11319 }; 11320 return yield* validateBlocksToTemplate(blocks); 11321 } 11322 /** 11323 * Block validity is a function of blocks state (at the point of a 11324 * reset) and the template setting. As a compromise to its placement 11325 * across distinct parts of state, it is implemented here as a side- 11326 * effect of the block reset action. 11327 * 11328 * @param {Array} blocks Array of blocks. 11329 */ 11330 11331 function* validateBlocksToTemplate(blocks) { 11332 const template = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplate'); 11333 const templateLock = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock'); // Unlocked templates are considered always valid because they act 11334 // as default values only. 11335 11336 const isBlocksValidToTemplate = !template || templateLock !== 'all' || Object(external_wp_blocks_["doBlocksMatchTemplate"])(blocks, template); // Update if validity has changed. 11337 11338 const isValidTemplate = yield external_wp_data_["controls"].select(STORE_NAME, 'isValidTemplate'); 11339 11340 if (isBlocksValidToTemplate !== isValidTemplate) { 11341 yield setTemplateValidity(isBlocksValidToTemplate); 11342 return isBlocksValidToTemplate; 11343 } 11344 } 11345 /** 11346 * A block selection object. 11347 * 11348 * @typedef {Object} WPBlockSelection 11349 * 11350 * @property {string} clientId A block client ID. 11351 * @property {string} attributeKey A block attribute key. 11352 * @property {number} offset An attribute value offset, based on the rich 11353 * text value. See `wp.richText.create`. 11354 */ 11355 11356 /** 11357 * Returns an action object used in signalling that selection state should be 11358 * reset to the specified selection. 11359 * 11360 * @param {WPBlockSelection} selectionStart The selection start. 11361 * @param {WPBlockSelection} selectionEnd The selection end. 11362 * @param {0|-1|null} initialPosition Initial block position. 11363 * 11364 * @return {Object} Action object. 11365 */ 11366 11367 function actions_resetSelection(selectionStart, selectionEnd, initialPosition) { 11368 return { 11369 type: 'RESET_SELECTION', 11370 selectionStart, 11371 selectionEnd, 11372 initialPosition 11373 }; 11374 } 11375 /** 11376 * Returns an action object used in signalling that blocks have been received. 11377 * Unlike resetBlocks, these should be appended to the existing known set, not 11378 * replacing. 11379 * 11380 * @param {Object[]} blocks Array of block objects. 11381 * 11382 * @return {Object} Action object. 11383 */ 11384 11385 function receiveBlocks(blocks) { 11386 return { 11387 type: 'RECEIVE_BLOCKS', 11388 blocks 11389 }; 11390 } 11391 /** 11392 * Returns an action object used in signalling that the multiple blocks' 11393 * attributes with the specified client IDs have been updated. 11394 * 11395 * @param {string|string[]} clientIds Block client IDs. 11396 * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if 11397 * uniqueByBlock is true. 11398 * @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes 11399 * @return {Object} Action object. 11400 */ 11401 11402 function actions_updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) { 11403 return { 11404 type: 'UPDATE_BLOCK_ATTRIBUTES', 11405 clientIds: Object(external_lodash_["castArray"])(clientIds), 11406 attributes, 11407 uniqueByBlock 11408 }; 11409 } 11410 /** 11411 * Returns an action object used in signalling that the block with the 11412 * specified client ID has been updated. 11413 * 11414 * @param {string} clientId Block client ID. 11415 * @param {Object} updates Block attributes to be merged. 11416 * 11417 * @return {Object} Action object. 11418 */ 11419 11420 function actions_updateBlock(clientId, updates) { 11421 return { 11422 type: 'UPDATE_BLOCK', 11423 clientId, 11424 updates 11425 }; 11426 } 11427 /** 11428 * Returns an action object used in signalling that the block with the 11429 * specified client ID has been selected, optionally accepting a position 11430 * value reflecting its selection directionality. An initialPosition of -1 11431 * reflects a reverse selection. 11432 * 11433 * @param {string} clientId Block client ID. 11434 * @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to 11435 * reflect reverse selection. 11436 * 11437 * @return {Object} Action object. 11438 */ 11439 11440 function actions_selectBlock(clientId, initialPosition = 0) { 11441 return { 11442 type: 'SELECT_BLOCK', 11443 initialPosition, 11444 clientId 11445 }; 11446 } 11447 /** 11448 * Yields action objects used in signalling that the block preceding the given 11449 * clientId should be selected. 11450 * 11451 * @param {string} clientId Block client ID. 11452 */ 11453 11454 function* selectPreviousBlock(clientId) { 11455 const previousBlockClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getPreviousBlockClientId', clientId); 11456 11457 if (previousBlockClientId) { 11458 yield actions_selectBlock(previousBlockClientId, -1); 11459 return [previousBlockClientId]; 11460 } 11461 } 11462 /** 11463 * Yields action objects used in signalling that the block following the given 11464 * clientId should be selected. 11465 * 11466 * @param {string} clientId Block client ID. 11467 */ 11468 11469 function* selectNextBlock(clientId) { 11470 const nextBlockClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getNextBlockClientId', clientId); 11471 11472 if (nextBlockClientId) { 11473 yield actions_selectBlock(nextBlockClientId); 11474 return [nextBlockClientId]; 11475 } 11476 } 11477 /** 11478 * Returns an action object used in signalling that a block multi-selection has started. 11479 * 11480 * @return {Object} Action object. 11481 */ 11482 11483 function actions_startMultiSelect() { 11484 return { 11485 type: 'START_MULTI_SELECT' 11486 }; 11487 } 11488 /** 11489 * Returns an action object used in signalling that block multi-selection stopped. 11490 * 11491 * @return {Object} Action object. 11492 */ 11493 11494 function actions_stopMultiSelect() { 11495 return { 11496 type: 'STOP_MULTI_SELECT' 11497 }; 11498 } 11499 /** 11500 * Returns an action object used in signalling that block multi-selection changed. 11501 * 11502 * @param {string} start First block of the multi selection. 11503 * @param {string} end Last block of the multiselection. 11504 */ 11505 11506 function* actions_multiSelect(start, end) { 11507 const startBlockRootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', start); 11508 const endBlockRootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', end); // Only allow block multi-selections at the same level. 11509 11510 if (startBlockRootClientId !== endBlockRootClientId) { 11511 return; 11512 } 11513 11514 yield { 11515 type: 'MULTI_SELECT', 11516 start, 11517 end 11518 }; 11519 const blockCount = yield external_wp_data_["controls"].select(STORE_NAME, 'getSelectedBlockCount'); 11520 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["sprintf"])( 11521 /* translators: %s: number of selected blocks */ 11522 Object(external_wp_i18n_["_n"])('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive'); 11523 } 11524 /** 11525 * Returns an action object used in signalling that the block selection is cleared. 11526 * 11527 * @return {Object} Action object. 11528 */ 11529 11530 function actions_clearSelectedBlock() { 11531 return { 11532 type: 'CLEAR_SELECTED_BLOCK' 11533 }; 11534 } 11535 /** 11536 * Returns an action object that enables or disables block selection. 11537 * 11538 * @param {boolean} [isSelectionEnabled=true] Whether block selection should 11539 * be enabled. 11540 * 11541 * @return {Object} Action object. 11542 */ 11543 11544 function actions_toggleSelection(isSelectionEnabled = true) { 11545 return { 11546 type: 'TOGGLE_SELECTION', 11547 isSelectionEnabled 11548 }; 11549 } 11550 11551 function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) { 11552 var _blockEditorSettings$, _blockEditorSettings$2; 11553 11554 const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings === null || blockEditorSettings === void 0 ? void 0 : (_blockEditorSettings$2 = blockEditorSettings.__experimentalPreferredStyleVariations) === null || _blockEditorSettings$2 === void 0 ? void 0 : _blockEditorSettings$2.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {}; 11555 return blocks.map(block => { 11556 var _block$attributes; 11557 11558 const blockName = block.name; 11559 11560 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'defaultStylePicker', true)) { 11561 return block; 11562 } 11563 11564 if (!preferredStyleVariations[blockName]) { 11565 return block; 11566 } 11567 11568 const className = (_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.className; 11569 11570 if (className !== null && className !== void 0 && className.includes('is-style-')) { 11571 return block; 11572 } 11573 11574 const { 11575 attributes = {} 11576 } = block; 11577 const blockStyle = preferredStyleVariations[blockName]; 11578 return { ...block, 11579 attributes: { ...attributes, 11580 className: `${className || ''} is-style-${blockStyle}`.trim() 11581 } 11582 }; 11583 }); 11584 } 11585 /** 11586 * Returns an action object signalling that a blocks should be replaced with 11587 * one or more replacement blocks. 11588 * 11589 * @param {(string|string[])} clientIds Block client ID(s) to replace. 11590 * @param {(Object|Object[])} blocks Replacement block(s). 11591 * @param {number} indexToSelect Index of replacement block to select. 11592 * @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation. 11593 * @param {?Object} meta Optional Meta values to be passed to the action object. 11594 * 11595 * @yield {Object} Action object. 11596 */ 11597 11598 11599 function* actions_replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, meta) { 11600 clientIds = Object(external_lodash_["castArray"])(clientIds); 11601 blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings')); 11602 const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', Object(external_lodash_["first"])(clientIds)); // Replace is valid if the new blocks can be inserted in the root block. 11603 11604 for (let index = 0; index < blocks.length; index++) { 11605 const block = blocks[index]; 11606 const canInsertBlock = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlockType', block.name, rootClientId); 11607 11608 if (!canInsertBlock) { 11609 return; 11610 } 11611 } 11612 11613 yield { 11614 type: 'REPLACE_BLOCKS', 11615 clientIds, 11616 blocks, 11617 time: Date.now(), 11618 indexToSelect, 11619 initialPosition, 11620 meta 11621 }; 11622 yield* ensureDefaultBlock(); 11623 } 11624 /** 11625 * Returns an action object signalling that a single block should be replaced 11626 * with one or more replacement blocks. 11627 * 11628 * @param {(string|string[])} clientId Block client ID to replace. 11629 * @param {(Object|Object[])} block Replacement block(s). 11630 * 11631 * @return {Object} Action object. 11632 */ 11633 11634 function actions_replaceBlock(clientId, block) { 11635 return actions_replaceBlocks(clientId, block); 11636 } 11637 /** 11638 * Higher-order action creator which, given the action type to dispatch creates 11639 * an action creator for managing block movement. 11640 * 11641 * @param {string} type Action type to dispatch. 11642 * 11643 * @return {Function} Action creator. 11644 */ 11645 11646 function createOnMove(type) { 11647 return (clientIds, rootClientId) => { 11648 return { 11649 clientIds: Object(external_lodash_["castArray"])(clientIds), 11650 type, 11651 rootClientId 11652 }; 11653 }; 11654 } 11655 11656 const actions_moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN'); 11657 const actions_moveBlocksUp = createOnMove('MOVE_BLOCKS_UP'); 11658 /** 11659 * Returns an action object signalling that the given blocks should be moved to 11660 * a new position. 11661 * 11662 * @param {?string} clientIds The client IDs of the blocks. 11663 * @param {?string} fromRootClientId Root client ID source. 11664 * @param {?string} toRootClientId Root client ID destination. 11665 * @param {number} index The index to move the blocks to. 11666 * 11667 * @yield {Object} Action object. 11668 */ 11669 11670 function* actions_moveBlocksToPosition(clientIds, fromRootClientId = '', toRootClientId = '', index) { 11671 const templateLock = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', fromRootClientId); // If locking is equal to all on the original clientId (fromRootClientId), 11672 // it is not possible to move the block to any other position. 11673 11674 if (templateLock === 'all') { 11675 return; 11676 } 11677 11678 const action = { 11679 type: 'MOVE_BLOCKS_TO_POSITION', 11680 fromRootClientId, 11681 toRootClientId, 11682 clientIds, 11683 index 11684 }; // If moving inside the same root block the move is always possible. 11685 11686 if (fromRootClientId === toRootClientId) { 11687 yield action; 11688 return; 11689 } // If templateLock is insert we can not remove the block from the parent. 11690 // Given that here we know that we are moving the block to a different 11691 // parent, the move should not be possible if the condition is true. 11692 11693 11694 if (templateLock === 'insert') { 11695 return; 11696 } 11697 11698 const canInsertBlocks = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlocks', clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block. 11699 11700 if (canInsertBlocks) { 11701 yield action; 11702 } 11703 } 11704 /** 11705 * Returns an action object signalling that the given block should be moved to a 11706 * new position. 11707 * 11708 * @param {?string} clientId The client ID of the block. 11709 * @param {?string} fromRootClientId Root client ID source. 11710 * @param {?string} toRootClientId Root client ID destination. 11711 * @param {number} index The index to move the block to. 11712 * 11713 * @yield {Object} Action object. 11714 */ 11715 11716 function* actions_moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) { 11717 yield actions_moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index); 11718 } 11719 /** 11720 * Returns an action object used in signalling that a single block should be 11721 * inserted, optionally at a specific index respective a root block list. 11722 * 11723 * @param {Object} block Block object to insert. 11724 * @param {?number} index Index at which block should be inserted. 11725 * @param {?string} rootClientId Optional root client ID of block list on which to insert. 11726 * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true. 11727 * @param {?Object} meta Optional Meta values to be passed to the action object. 11728 * 11729 * @return {Object} Action object. 11730 */ 11731 11732 function actions_insertBlock(block, index, rootClientId, updateSelection = true, meta) { 11733 return actions_insertBlocks([block], index, rootClientId, updateSelection, 0, meta); 11734 } 11735 /** 11736 * Returns an action object used in signalling that an array of blocks should 11737 * be inserted, optionally at a specific index respective a root block list. 11738 * 11739 * @param {Object[]} blocks Block objects to insert. 11740 * @param {?number} index Index at which block should be inserted. 11741 * @param {?string} rootClientId Optional root client ID of block list on which to insert. 11742 * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true. 11743 * @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block. 11744 * @param {?Object} meta Optional Meta values to be passed to the action object. 11745 * @return {Object} Action object. 11746 */ 11747 11748 function* actions_insertBlocks(blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) { 11749 if (Object(external_lodash_["isObject"])(initialPosition)) { 11750 meta = initialPosition; 11751 initialPosition = 0; 11752 external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", { 11753 since: '10.1', 11754 plugin: 'Gutenberg', 11755 hint: 'The meta argument is now the 6th argument of the function' 11756 }); 11757 } 11758 11759 blocks = getBlocksWithDefaultStylesApplied(Object(external_lodash_["castArray"])(blocks), yield external_wp_data_["controls"].select(STORE_NAME, 'getSettings')); 11760 const allowedBlocks = []; 11761 11762 for (const block of blocks) { 11763 const isValid = yield external_wp_data_["controls"].select(STORE_NAME, 'canInsertBlockType', block.name, rootClientId); 11764 11765 if (isValid) { 11766 allowedBlocks.push(block); 11767 } 11768 } 11769 11770 if (allowedBlocks.length) { 11771 return { 11772 type: 'INSERT_BLOCKS', 11773 blocks: allowedBlocks, 11774 index, 11775 rootClientId, 11776 time: Date.now(), 11777 updateSelection, 11778 initialPosition: updateSelection ? initialPosition : null, 11779 meta 11780 }; 11781 } 11782 } 11783 /** 11784 * Returns an action object used in signalling that the insertion point should 11785 * be shown. 11786 * 11787 * @param {?string} rootClientId Optional root client ID of block list on 11788 * which to insert. 11789 * @param {?number} index Index at which block should be inserted. 11790 * @param {Object} __unstableOptions Wether or not to show an inserter button. 11791 * 11792 * @return {Object} Action object. 11793 */ 11794 11795 function actions_showInsertionPoint(rootClientId, index, __unstableOptions = {}) { 11796 const { 11797 __unstableWithInserter 11798 } = __unstableOptions; 11799 return { 11800 type: 'SHOW_INSERTION_POINT', 11801 rootClientId, 11802 index, 11803 __unstableWithInserter 11804 }; 11805 } 11806 /** 11807 * Returns an action object hiding the insertion point. 11808 * 11809 * @return {Object} Action object. 11810 */ 11811 11812 function actions_hideInsertionPoint() { 11813 return { 11814 type: 'HIDE_INSERTION_POINT' 11815 }; 11816 } 11817 /** 11818 * Returns an action object resetting the template validity. 11819 * 11820 * @param {boolean} isValid template validity flag. 11821 * 11822 * @return {Object} Action object. 11823 */ 11824 11825 function setTemplateValidity(isValid) { 11826 return { 11827 type: 'SET_TEMPLATE_VALIDITY', 11828 isValid 11829 }; 11830 } 11831 /** 11832 * Returns an action object synchronize the template with the list of blocks 11833 * 11834 * @return {Object} Action object. 11835 */ 11836 11837 function* synchronizeTemplate() { 11838 yield { 11839 type: 'SYNCHRONIZE_TEMPLATE' 11840 }; 11841 const blocks = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlocks'); 11842 const template = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplate'); 11843 const updatedBlockList = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); 11844 return yield actions_resetBlocks(updatedBlockList); 11845 } 11846 /** 11847 * Returns an action object used in signalling that two blocks should be merged 11848 * 11849 * @param {string} firstBlockClientId Client ID of the first block to merge. 11850 * @param {string} secondBlockClientId Client ID of the second block to merge. 11851 */ 11852 11853 function* actions_mergeBlocks(firstBlockClientId, secondBlockClientId) { 11854 const blocks = [firstBlockClientId, secondBlockClientId]; 11855 yield { 11856 type: 'MERGE_BLOCKS', 11857 blocks 11858 }; 11859 const [clientIdA, clientIdB] = blocks; 11860 const blockA = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlock', clientIdA); 11861 const blockAType = Object(external_wp_blocks_["getBlockType"])(blockA.name); // Only focus the previous block if it's not mergeable 11862 11863 if (!blockAType.merge) { 11864 yield actions_selectBlock(blockA.clientId); 11865 return; 11866 } 11867 11868 const blockB = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlock', clientIdB); 11869 const blockBType = Object(external_wp_blocks_["getBlockType"])(blockB.name); 11870 const { 11871 clientId, 11872 attributeKey, 11873 offset 11874 } = yield external_wp_data_["controls"].select(STORE_NAME, 'getSelectionStart'); 11875 const selectedBlockType = clientId === clientIdA ? blockAType : blockBType; 11876 const attributeDefinition = selectedBlockType.attributes[attributeKey]; 11877 const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier 11878 // is not a defined block attribute key. This can be the case if the 11879 // fallback intance ID is used to store selection (and no RichText 11880 // identifier is set), or when the identifier is wrong. 11881 !!attributeDefinition; 11882 11883 if (!attributeDefinition) { 11884 if (typeof attributeKey === 'number') { 11885 window.console.error(`RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was ${typeof attributeKey}`); 11886 } else { 11887 window.console.error('The RichText identifier prop does not match any attributes defined by the block.'); 11888 } 11889 } // A robust way to retain selection position through various transforms 11890 // is to insert a special character at the position and then recover it. 11891 11892 11893 const START_OF_SELECTED_AREA = '\u0086'; // Clone the blocks so we don't insert the character in a "live" block. 11894 11895 const cloneA = Object(external_wp_blocks_["cloneBlock"])(blockA); 11896 const cloneB = Object(external_wp_blocks_["cloneBlock"])(blockB); 11897 11898 if (canRestoreTextSelection) { 11899 const selectedBlock = clientId === clientIdA ? cloneA : cloneB; 11900 const html = selectedBlock.attributes[attributeKey]; 11901 const { 11902 multiline: multilineTag, 11903 __unstableMultilineWrapperTags: multilineWrapperTags, 11904 __unstablePreserveWhiteSpace: preserveWhiteSpace 11905 } = attributeDefinition; 11906 const value = Object(external_wp_richText_["insert"])(Object(external_wp_richText_["create"])({ 11907 html, 11908 multilineTag, 11909 multilineWrapperTags, 11910 preserveWhiteSpace 11911 }), START_OF_SELECTED_AREA, offset, offset); 11912 selectedBlock.attributes[attributeKey] = Object(external_wp_richText_["toHTMLString"])({ 11913 value, 11914 multilineTag, 11915 preserveWhiteSpace 11916 }); 11917 } // We can only merge blocks with similar types 11918 // thus, we transform the block to merge first 11919 11920 11921 const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : Object(external_wp_blocks_["switchToBlockType"])(cloneB, blockA.name); // If the block types can not match, do nothing 11922 11923 if (!blocksWithTheSameType || !blocksWithTheSameType.length) { 11924 return; 11925 } // Calling the merge to update the attributes and remove the block to be merged 11926 11927 11928 const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes); 11929 11930 if (canRestoreTextSelection) { 11931 const newAttributeKey = Object(external_lodash_["findKey"])(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1); 11932 const convertedHtml = updatedAttributes[newAttributeKey]; 11933 const { 11934 multiline: multilineTag, 11935 __unstableMultilineWrapperTags: multilineWrapperTags, 11936 __unstablePreserveWhiteSpace: preserveWhiteSpace 11937 } = blockAType.attributes[newAttributeKey]; 11938 const convertedValue = Object(external_wp_richText_["create"])({ 11939 html: convertedHtml, 11940 multilineTag, 11941 multilineWrapperTags, 11942 preserveWhiteSpace 11943 }); 11944 const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA); 11945 const newValue = Object(external_wp_richText_["remove"])(convertedValue, newOffset, newOffset + 1); 11946 const newHtml = Object(external_wp_richText_["toHTMLString"])({ 11947 value: newValue, 11948 multilineTag, 11949 preserveWhiteSpace 11950 }); 11951 updatedAttributes[newAttributeKey] = newHtml; 11952 yield actions_selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset); 11953 } 11954 11955 yield* actions_replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA, 11956 attributes: { ...blockA.attributes, 11957 ...updatedAttributes 11958 } 11959 }, ...blocksWithTheSameType.slice(1)]); 11960 } 11961 /** 11962 * Yields action objects used in signalling that the blocks corresponding to 11963 * the set of specified client IDs are to be removed. 11964 * 11965 * @param {string|string[]} clientIds Client IDs of blocks to remove. 11966 * @param {boolean} selectPrevious True if the previous block should be 11967 * selected when a block is removed. 11968 */ 11969 11970 function* actions_removeBlocks(clientIds, selectPrevious = true) { 11971 if (!clientIds || !clientIds.length) { 11972 return; 11973 } 11974 11975 clientIds = Object(external_lodash_["castArray"])(clientIds); 11976 const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientIds[0]); 11977 const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId); 11978 11979 if (isLocked) { 11980 return; 11981 } 11982 11983 let previousBlockId; 11984 11985 if (selectPrevious) { 11986 previousBlockId = yield selectPreviousBlock(clientIds[0]); 11987 } else { 11988 previousBlockId = yield external_wp_data_["controls"].select(STORE_NAME, 'getPreviousBlockClientId', clientIds[0]); 11989 } 11990 11991 yield { 11992 type: 'REMOVE_BLOCKS', 11993 clientIds 11994 }; // To avoid a focus loss when removing the last block, assure there is 11995 // always a default block if the last of the blocks have been removed. 11996 11997 const defaultBlockId = yield* ensureDefaultBlock(); 11998 return [previousBlockId || defaultBlockId]; 11999 } 12000 /** 12001 * Returns an action object used in signalling that the block with the 12002 * specified client ID is to be removed. 12003 * 12004 * @param {string} clientId Client ID of block to remove. 12005 * @param {boolean} selectPrevious True if the previous block should be 12006 * selected when a block is removed. 12007 * 12008 * @return {Object} Action object. 12009 */ 12010 12011 function actions_removeBlock(clientId, selectPrevious) { 12012 return actions_removeBlocks([clientId], selectPrevious); 12013 } 12014 /** 12015 * Returns an action object used in signalling that the inner blocks with the 12016 * specified client ID should be replaced. 12017 * 12018 * @param {string} rootClientId Client ID of the block whose InnerBlocks will re replaced. 12019 * @param {Object[]} blocks Block objects to insert as new InnerBlocks 12020 * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to false. 12021 * @param {0|-1|null} initialPosition Initial block position. 12022 * @return {Object} Action object. 12023 */ 12024 12025 function actions_replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) { 12026 return { 12027 type: 'REPLACE_INNER_BLOCKS', 12028 rootClientId, 12029 blocks, 12030 updateSelection, 12031 initialPosition: updateSelection ? initialPosition : null, 12032 time: Date.now() 12033 }; 12034 } 12035 /** 12036 * Returns an action object used to toggle the block editing mode between 12037 * visual and HTML modes. 12038 * 12039 * @param {string} clientId Block client ID. 12040 * 12041 * @return {Object} Action object. 12042 */ 12043 12044 function toggleBlockMode(clientId) { 12045 return { 12046 type: 'TOGGLE_BLOCK_MODE', 12047 clientId 12048 }; 12049 } 12050 /** 12051 * Returns an action object used in signalling that the user has begun to type. 12052 * 12053 * @return {Object} Action object. 12054 */ 12055 12056 function actions_startTyping() { 12057 return { 12058 type: 'START_TYPING' 12059 }; 12060 } 12061 /** 12062 * Returns an action object used in signalling that the user has stopped typing. 12063 * 12064 * @return {Object} Action object. 12065 */ 12066 12067 function actions_stopTyping() { 12068 return { 12069 type: 'STOP_TYPING' 12070 }; 12071 } 12072 /** 12073 * Returns an action object used in signalling that the user has begun to drag blocks. 12074 * 12075 * @param {string[]} clientIds An array of client ids being dragged 12076 * 12077 * @return {Object} Action object. 12078 */ 12079 12080 function actions_startDraggingBlocks(clientIds = []) { 12081 return { 12082 type: 'START_DRAGGING_BLOCKS', 12083 clientIds 12084 }; 12085 } 12086 /** 12087 * Returns an action object used in signalling that the user has stopped dragging blocks. 12088 * 12089 * @return {Object} Action object. 12090 */ 12091 12092 function actions_stopDraggingBlocks() { 12093 return { 12094 type: 'STOP_DRAGGING_BLOCKS' 12095 }; 12096 } 12097 /** 12098 * Returns an action object used in signalling that the caret has entered formatted text. 12099 * 12100 * @return {Object} Action object. 12101 */ 12102 12103 function actions_enterFormattedText() { 12104 return { 12105 type: 'ENTER_FORMATTED_TEXT' 12106 }; 12107 } 12108 /** 12109 * Returns an action object used in signalling that the user caret has exited formatted text. 12110 * 12111 * @return {Object} Action object. 12112 */ 12113 12114 function actions_exitFormattedText() { 12115 return { 12116 type: 'EXIT_FORMATTED_TEXT' 12117 }; 12118 } 12119 /** 12120 * Returns an action object used in signalling that the user caret has changed 12121 * position. 12122 * 12123 * @param {string} clientId The selected block client ID. 12124 * @param {string} attributeKey The selected block attribute key. 12125 * @param {number} startOffset The start offset. 12126 * @param {number} endOffset The end offset. 12127 * 12128 * @return {Object} Action object. 12129 */ 12130 12131 function actions_selectionChange(clientId, attributeKey, startOffset, endOffset) { 12132 return { 12133 type: 'SELECTION_CHANGE', 12134 clientId, 12135 attributeKey, 12136 startOffset, 12137 endOffset 12138 }; 12139 } 12140 /** 12141 * Returns an action object used in signalling that a new block of the default 12142 * type should be added to the block list. 12143 * 12144 * @param {?Object} attributes Optional attributes of the block to assign. 12145 * @param {?string} rootClientId Optional root client ID of block list on which 12146 * to append. 12147 * @param {?number} index Optional index where to insert the default block 12148 * 12149 * @return {Object} Action object 12150 */ 12151 12152 function actions_insertDefaultBlock(attributes, rootClientId, index) { 12153 // Abort if there is no default block type (if it has been unregistered). 12154 const defaultBlockName = Object(external_wp_blocks_["getDefaultBlockName"])(); 12155 12156 if (!defaultBlockName) { 12157 return; 12158 } 12159 12160 const block = Object(external_wp_blocks_["createBlock"])(defaultBlockName, attributes); 12161 return actions_insertBlock(block, index, rootClientId); 12162 } 12163 /** 12164 * Returns an action object that changes the nested settings of a given block. 12165 * 12166 * @param {string} clientId Client ID of the block whose nested setting are 12167 * being received. 12168 * @param {Object} settings Object with the new settings for the nested block. 12169 * 12170 * @return {Object} Action object 12171 */ 12172 12173 function actions_updateBlockListSettings(clientId, settings) { 12174 return { 12175 type: 'UPDATE_BLOCK_LIST_SETTINGS', 12176 clientId, 12177 settings 12178 }; 12179 } 12180 /** 12181 * Returns an action object used in signalling that the block editor settings have been updated. 12182 * 12183 * @param {Object} settings Updated settings 12184 * 12185 * @return {Object} Action object 12186 */ 12187 12188 function actions_updateSettings(settings) { 12189 return { 12190 type: 'UPDATE_SETTINGS', 12191 settings 12192 }; 12193 } 12194 /** 12195 * Returns an action object used in signalling that a temporary reusable blocks have been saved 12196 * in order to switch its temporary id with the real id. 12197 * 12198 * @param {string} id Reusable block's id. 12199 * @param {string} updatedId Updated block's id. 12200 * 12201 * @return {Object} Action object. 12202 */ 12203 12204 function __unstableSaveReusableBlock(id, updatedId) { 12205 return { 12206 type: 'SAVE_REUSABLE_BLOCK_SUCCESS', 12207 id, 12208 updatedId 12209 }; 12210 } 12211 /** 12212 * Returns an action object used in signalling that the last block change should be marked explicitly as persistent. 12213 * 12214 * @return {Object} Action object. 12215 */ 12216 12217 function actions_unstableMarkLastChangeAsPersistent() { 12218 return { 12219 type: 'MARK_LAST_CHANGE_AS_PERSISTENT' 12220 }; 12221 } 12222 /** 12223 * Returns an action object used in signalling that the next block change should be marked explicitly as not persistent. 12224 * 12225 * @return {Object} Action object. 12226 */ 12227 12228 function actions_unstableMarkNextChangeAsNotPersistent() { 12229 return { 12230 type: 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT' 12231 }; 12232 } 12233 /** 12234 * Returns an action object used in signalling that the last block change is 12235 * an automatic change, meaning it was not performed by the user, and can be 12236 * undone using the `Escape` and `Backspace` keys. This action must be called 12237 * after the change was made, and any actions that are a consequence of it, so 12238 * it is recommended to be called at the next idle period to ensure all 12239 * selection changes have been recorded. 12240 */ 12241 12242 function* actions_unstableMarkAutomaticChange() { 12243 yield { 12244 type: 'MARK_AUTOMATIC_CHANGE' 12245 }; 12246 yield __unstableMarkAutomaticChangeFinalControl(); 12247 } 12248 function __unstableMarkAutomaticChangeFinal() { 12249 return { 12250 type: 'MARK_AUTOMATIC_CHANGE_FINAL' 12251 }; 12252 } 12253 /** 12254 * Generators that triggers an action used to enable or disable the navigation mode. 12255 * 12256 * @param {string} isNavigationMode Enable/Disable navigation mode. 12257 */ 12258 12259 function* actions_setNavigationMode(isNavigationMode = true) { 12260 yield { 12261 type: 'SET_NAVIGATION_MODE', 12262 isNavigationMode 12263 }; 12264 12265 if (isNavigationMode) { 12266 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.')); 12267 } else { 12268 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('You are currently in edit mode. To return to the navigation mode, press Escape.')); 12269 } 12270 } 12271 /** 12272 * Generator that triggers an action used to enable or disable the block moving mode. 12273 * 12274 * @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode. 12275 */ 12276 12277 function* actions_setBlockMovingClientId(hasBlockMovingClientId = null) { 12278 yield { 12279 type: 'SET_BLOCK_MOVING_MODE', 12280 hasBlockMovingClientId 12281 }; 12282 12283 if (hasBlockMovingClientId) { 12284 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block.')); 12285 } 12286 } 12287 /** 12288 * Generator that triggers an action used to duplicate a list of blocks. 12289 * 12290 * @param {string[]} clientIds 12291 * @param {boolean} updateSelection 12292 */ 12293 12294 function* actions_duplicateBlocks(clientIds, updateSelection = true) { 12295 if (!clientIds && !clientIds.length) { 12296 return; 12297 } 12298 12299 const blocks = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlocksByClientId', clientIds); 12300 const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist. 12301 12302 if (Object(external_lodash_["some"])(blocks, block => !block)) { 12303 return; 12304 } 12305 12306 const blockNames = blocks.map(block => block.name); // Return early if blocks don't support multiple usage. 12307 12308 if (Object(external_lodash_["some"])(blockNames, blockName => !Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'multiple', true))) { 12309 return; 12310 } 12311 12312 const lastSelectedIndex = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockIndex', Object(external_lodash_["last"])(Object(external_lodash_["castArray"])(clientIds)), rootClientId); 12313 const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["__experimentalCloneSanitizedBlock"])(block)); 12314 yield actions_insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection); 12315 12316 if (clonedBlocks.length > 1 && updateSelection) { 12317 yield actions_multiSelect(Object(external_lodash_["first"])(clonedBlocks).clientId, Object(external_lodash_["last"])(clonedBlocks).clientId); 12318 } 12319 12320 return clonedBlocks.map(block => block.clientId); 12321 } 12322 /** 12323 * Generator used to insert an empty block after a given block. 12324 * 12325 * @param {string} clientId 12326 */ 12327 12328 function* actions_insertBeforeBlock(clientId) { 12329 if (!clientId) { 12330 return; 12331 } 12332 12333 const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientId); 12334 const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId); 12335 12336 if (isLocked) { 12337 return; 12338 } 12339 12340 const firstSelectedIndex = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockIndex', clientId, rootClientId); 12341 return yield actions_insertDefaultBlock({}, rootClientId, firstSelectedIndex); 12342 } 12343 /** 12344 * Generator used to insert an empty block before a given block. 12345 * 12346 * @param {string} clientId 12347 */ 12348 12349 function* actions_insertAfterBlock(clientId) { 12350 if (!clientId) { 12351 return; 12352 } 12353 12354 const rootClientId = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockRootClientId', clientId); 12355 const isLocked = yield external_wp_data_["controls"].select(STORE_NAME, 'getTemplateLock', rootClientId); 12356 12357 if (isLocked) { 12358 return; 12359 } 12360 12361 const firstSelectedIndex = yield external_wp_data_["controls"].select(STORE_NAME, 'getBlockIndex', clientId, rootClientId); 12362 return yield actions_insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1); 12363 } 12364 /** 12365 * Returns an action object that toggles the highlighted block state. 12366 * 12367 * @param {string} clientId The block's clientId. 12368 * @param {boolean} isHighlighted The highlight state. 12369 */ 12370 12371 function actions_toggleBlockHighlight(clientId, isHighlighted) { 12372 return { 12373 type: 'TOGGLE_BLOCK_HIGHLIGHT', 12374 clientId, 12375 isHighlighted 12376 }; 12377 } 12378 /** 12379 * Yields action objects used in signalling that the block corresponding to the 12380 * given clientId should appear to "flash" by rhythmically highlighting it. 12381 * 12382 * @param {string} clientId Target block client ID. 12383 */ 12384 12385 function* actions_flashBlock(clientId) { 12386 yield actions_toggleBlockHighlight(clientId, true); 12387 yield { 12388 type: 'SLEEP', 12389 duration: 150 12390 }; 12391 yield actions_toggleBlockHighlight(clientId, false); 12392 } 12393 /** 12394 * Returns an action object that sets whether the block has controlled innerblocks. 12395 * 12396 * @param {string} clientId The block's clientId. 12397 * @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled. 12398 */ 12399 12400 function actions_setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) { 12401 return { 12402 type: 'SET_HAS_CONTROLLED_INNER_BLOCKS', 12403 hasControlledInnerBlocks, 12404 clientId 12405 }; 12406 } 12407 12408 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js 12409 /** 12410 * WordPress dependencies 12411 */ 12412 12413 /** 12414 * Internal dependencies 12415 */ 12416 12417 12418 12419 12420 12421 12422 /** 12423 * Block editor data store configuration. 12424 * 12425 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore 12426 * 12427 * @type {Object} 12428 */ 12429 12430 const storeConfig = { 12431 reducer: store_reducer, 12432 selectors: selectors_namespaceObject, 12433 actions: actions_namespaceObject, 12434 controls: store_controls 12435 }; 12436 /** 12437 * Store definition for the block editor namespace. 12438 * 12439 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 12440 * 12441 * @type {Object} 12442 */ 12443 12444 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { ...storeConfig, 12445 persist: ['preferences'] 12446 }); // Ideally we'd use register instead of register stores. 12447 12448 Object(external_wp_data_["registerStore"])(STORE_NAME, { ...storeConfig, 12449 persist: ['preferences'] 12450 }); 12451 12452 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-display-block-controls/index.js 12453 /** 12454 * WordPress dependencies 12455 */ 12456 12457 /** 12458 * Internal dependencies 12459 */ 12460 12461 12462 12463 function useDisplayBlockControls() { 12464 const { 12465 isSelected, 12466 clientId, 12467 name 12468 } = useBlockEditContext(); 12469 const isFirstAndSameTypeMultiSelected = Object(external_wp_data_["useSelect"])(select => { 12470 // Don't bother checking, see OR statement below. 12471 if (isSelected) { 12472 return; 12473 } 12474 12475 const { 12476 getBlockName, 12477 isFirstMultiSelectedBlock, 12478 getMultiSelectedBlockClientIds 12479 } = select(store); 12480 12481 if (!isFirstMultiSelectedBlock(clientId)) { 12482 return false; 12483 } 12484 12485 return getMultiSelectedBlockClientIds().every(id => getBlockName(id) === name); 12486 }, [clientId, isSelected, name]); 12487 return isSelected || isFirstAndSameTypeMultiSelected; 12488 } 12489 12490 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js 12491 /** 12492 * WordPress dependencies 12493 */ 12494 12495 const BlockControlsDefault = Object(external_wp_components_["createSlotFill"])('BlockControls'); 12496 const BlockControlsBlock = Object(external_wp_components_["createSlotFill"])('BlockControlsBlock'); 12497 const BlockControlsInline = Object(external_wp_components_["createSlotFill"])('BlockFormatControls'); 12498 const BlockControlsOther = Object(external_wp_components_["createSlotFill"])('BlockControlsOther'); 12499 const groups = { 12500 default: BlockControlsDefault, 12501 block: BlockControlsBlock, 12502 inline: BlockControlsInline, 12503 other: BlockControlsOther 12504 }; 12505 /* harmony default export */ var block_controls_groups = (groups); 12506 12507 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js 12508 12509 12510 /** 12511 * External dependencies 12512 */ 12513 12514 /** 12515 * WordPress dependencies 12516 */ 12517 12518 12519 /** 12520 * Internal dependencies 12521 */ 12522 12523 12524 12525 function BlockControlsFill({ 12526 group = 'default', 12527 controls, 12528 children 12529 }) { 12530 if (!useDisplayBlockControls()) { 12531 return null; 12532 } 12533 12534 const Fill = block_controls_groups[group].Fill; 12535 return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { 12536 document: document 12537 }, Object(external_wp_element_["createElement"])(Fill, null, fillProps => { 12538 // Children passed to BlockControlsFill will not have access to any 12539 // React Context whose Provider is part of the BlockControlsSlot tree. 12540 // So we re-create the Provider in this subtree. 12541 const value = !Object(external_lodash_["isEmpty"])(fillProps) ? fillProps : null; 12542 return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalToolbarContext"].Provider, { 12543 value: value 12544 }, group === 'default' && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { 12545 controls: controls 12546 }), children); 12547 })); 12548 } 12549 12550 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js 12551 12552 12553 12554 /** 12555 * WordPress dependencies 12556 */ 12557 12558 12559 /** 12560 * Internal dependencies 12561 */ 12562 12563 12564 function BlockControlsSlot({ 12565 group = 'default', 12566 ...props 12567 }) { 12568 const accessibleToolbarState = Object(external_wp_element_["useContext"])(external_wp_components_["__experimentalToolbarContext"]); 12569 const Slot = block_controls_groups[group].Slot; 12570 const slot = Object(external_wp_components_["__experimentalUseSlot"])(Slot.__unstableName); 12571 const hasFills = Boolean(slot.fills && slot.fills.length); 12572 12573 if (!hasFills) { 12574 return null; 12575 } 12576 12577 if (group === 'default') { 12578 return Object(external_wp_element_["createElement"])(Slot, Object(esm_extends["a" /* default */])({}, props, { 12579 bubblesVirtually: true, 12580 fillProps: accessibleToolbarState 12581 })); 12582 } 12583 12584 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(Slot, Object(esm_extends["a" /* default */])({}, props, { 12585 bubblesVirtually: true, 12586 fillProps: accessibleToolbarState 12587 }))); 12588 } 12589 12590 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js 12591 12592 12593 12594 /** 12595 * Internal dependencies 12596 */ 12597 12598 12599 const BlockControls = BlockControlsFill; 12600 BlockControls.Slot = BlockControlsSlot; // This is just here for backward compatibility 12601 12602 const BlockFormatControls = props => { 12603 return Object(external_wp_element_["createElement"])(BlockControlsFill, Object(esm_extends["a" /* default */])({ 12604 group: "inline" 12605 }, props)); 12606 }; 12607 12608 BlockFormatControls.Slot = props => { 12609 return Object(external_wp_element_["createElement"])(BlockControlsSlot, Object(esm_extends["a" /* default */])({ 12610 group: "inline" 12611 }, props)); 12612 }; 12613 12614 /* harmony default export */ var block_controls = (BlockControls); 12615 12616 // EXTERNAL MODULE: external ["wp","primitives"] 12617 var external_wp_primitives_ = __webpack_require__("Tqx9"); 12618 12619 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-left.js 12620 12621 12622 /** 12623 * WordPress dependencies 12624 */ 12625 12626 const positionLeft = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 12627 xmlns: "http://www.w3.org/2000/svg", 12628 viewBox: "0 0 24 24" 12629 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 12630 d: "M4 9v6h14V9H4zm8-4.8H4v1.5h8V4.2zM4 19.8h8v-1.5H4v1.5z" 12631 })); 12632 /* harmony default export */ var position_left = (positionLeft); 12633 12634 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-center.js 12635 12636 12637 /** 12638 * WordPress dependencies 12639 */ 12640 12641 const positionCenter = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 12642 xmlns: "http://www.w3.org/2000/svg", 12643 viewBox: "0 0 24 24" 12644 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 12645 d: "M5 15h14V9H5v6zm0 4.8h14v-1.5H5v1.5zM5 4.2v1.5h14V4.2H5z" 12646 })); 12647 /* harmony default export */ var position_center = (positionCenter); 12648 12649 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-right.js 12650 12651 12652 /** 12653 * WordPress dependencies 12654 */ 12655 12656 const positionRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 12657 xmlns: "http://www.w3.org/2000/svg", 12658 viewBox: "0 0 24 24" 12659 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 12660 d: "M6 15h14V9H6v6zm6-10.8v1.5h8V4.2h-8zm0 15.6h8v-1.5h-8v1.5z" 12661 })); 12662 /* harmony default export */ var position_right = (positionRight); 12663 12664 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js 12665 12666 12667 /** 12668 * WordPress dependencies 12669 */ 12670 12671 const stretchWide = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 12672 xmlns: "http://www.w3.org/2000/svg", 12673 viewBox: "0 0 24 24" 12674 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 12675 d: "M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z" 12676 })); 12677 /* harmony default export */ var stretch_wide = (stretchWide); 12678 12679 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js 12680 12681 12682 /** 12683 * WordPress dependencies 12684 */ 12685 12686 const stretchFullWidth = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 12687 xmlns: "http://www.w3.org/2000/svg", 12688 viewBox: "0 0 24 24" 12689 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 12690 d: "M5 4v11h14V4H5zm3 15.8h8v-1.5H8v1.5z" 12691 })); 12692 /* harmony default export */ var stretch_full_width = (stretchFullWidth); 12693 12694 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/layout.js 12695 12696 12697 /** 12698 * WordPress dependencies 12699 */ 12700 12701 const layout_defaultLayout = { 12702 type: 'default' 12703 }; 12704 const Layout = Object(external_wp_element_["createContext"])(layout_defaultLayout); 12705 12706 function appendSelectors(selectors, append) { 12707 // Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here 12708 // The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style 12709 // it's used to reset the default margin added by wp-admin to paragraphs 12710 // so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers 12711 // When the post editor is fully iframed, this extra classname could be removed. 12712 return selectors.split(',').map(subselector => `.editor-styles-wrapper ${subselector} ${append}`).join(','); 12713 } 12714 /** 12715 * Allows to define the layout. 12716 */ 12717 12718 12719 const LayoutProvider = Layout.Provider; 12720 /** 12721 * React hook used to retrieve the layout config. 12722 */ 12723 12724 function useLayout() { 12725 return Object(external_wp_element_["useContext"])(Layout); 12726 } 12727 function LayoutStyle({ 12728 selector, 12729 layout = {} 12730 }) { 12731 const { 12732 contentSize, 12733 wideSize 12734 } = layout; 12735 let style = !!contentSize || !!wideSize ? ` 12736 ${appendSelectors(selector, '> *')} { 12737 max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize}; 12738 margin-left: auto !important; 12739 margin-right: auto !important; 12740 } 12741 12742 ${appendSelectors(selector, '> [data-align="wide"]')} { 12743 max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize}; 12744 } 12745 12746 ${appendSelectors(selector, '> [data-align="full"]')} { 12747 max-width: none; 12748 } 12749 ` : ''; 12750 style += ` 12751 ${appendSelectors(selector, '> [data-align="left"]')} { 12752 float: left; 12753 margin-right: 2em; 12754 } 12755 12756 ${appendSelectors(selector, '> [data-align="right"]')} { 12757 float: right; 12758 margin-left: 2em; 12759 } 12760 `; 12761 return Object(external_wp_element_["createElement"])("style", null, style); 12762 } 12763 12764 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/use-available-alignments.js 12765 /** 12766 * WordPress dependencies 12767 */ 12768 12769 /** 12770 * Internal dependencies 12771 */ 12772 12773 12774 12775 const DEFAULT_CONTROLS = ['left', 'center', 'right', 'wide', 'full']; 12776 const WIDE_CONTROLS = ['wide', 'full']; 12777 function useAvailableAlignments(controls = DEFAULT_CONTROLS) { 12778 const { 12779 wideControlsEnabled = false 12780 } = Object(external_wp_data_["useSelect"])(select => { 12781 const { 12782 getSettings 12783 } = select(store); 12784 const settings = getSettings(); 12785 return { 12786 wideControlsEnabled: settings.alignWide 12787 }; 12788 }, []); 12789 const layout = useLayout(); 12790 const supportsAlignments = layout.type === 'default'; 12791 12792 if (!supportsAlignments) { 12793 return []; 12794 } 12795 12796 const { 12797 alignments: availableAlignments = DEFAULT_CONTROLS 12798 } = layout; 12799 const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments. 12800 wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control)); 12801 return enabledControls; 12802 } 12803 12804 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js 12805 12806 12807 12808 /** 12809 * WordPress dependencies 12810 */ 12811 12812 12813 12814 /** 12815 * Internal dependencies 12816 */ 12817 12818 12819 const BLOCK_ALIGNMENTS_CONTROLS = { 12820 left: { 12821 icon: position_left, 12822 title: Object(external_wp_i18n_["__"])('Align left') 12823 }, 12824 center: { 12825 icon: position_center, 12826 title: Object(external_wp_i18n_["__"])('Align center') 12827 }, 12828 right: { 12829 icon: position_right, 12830 title: Object(external_wp_i18n_["__"])('Align right') 12831 }, 12832 wide: { 12833 icon: stretch_wide, 12834 title: Object(external_wp_i18n_["__"])('Wide width') 12835 }, 12836 full: { 12837 icon: stretch_full_width, 12838 title: Object(external_wp_i18n_["__"])('Full width') 12839 } 12840 }; 12841 const DEFAULT_CONTROL = 'center'; 12842 const ui_POPOVER_PROPS = { 12843 isAlternate: true 12844 }; 12845 12846 function BlockAlignmentUI({ 12847 value, 12848 onChange, 12849 controls, 12850 isToolbar, 12851 isCollapsed = true 12852 }) { 12853 const enabledControls = useAvailableAlignments(controls); 12854 12855 if (enabledControls.length === 0) { 12856 return null; 12857 } 12858 12859 function applyOrUnset(align) { 12860 return () => onChange(value === align ? undefined : align); 12861 } 12862 12863 const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[value]; 12864 const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL]; 12865 const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; 12866 const extraProps = isToolbar ? { 12867 isCollapsed 12868 } : {}; 12869 return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ 12870 popoverProps: ui_POPOVER_PROPS, 12871 icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon, 12872 label: Object(external_wp_i18n_["__"])('Align'), 12873 toggleProps: { 12874 describedBy: Object(external_wp_i18n_["__"])('Change alignment') 12875 }, 12876 controls: enabledControls.map(control => { 12877 return { ...BLOCK_ALIGNMENTS_CONTROLS[control], 12878 isActive: value === control, 12879 role: isCollapsed ? 'menuitemradio' : undefined, 12880 onClick: applyOrUnset(control) 12881 }; 12882 }) 12883 }, extraProps)); 12884 } 12885 12886 /* harmony default export */ var ui = (BlockAlignmentUI); 12887 12888 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/index.js 12889 12890 12891 12892 /** 12893 * Internal dependencies 12894 */ 12895 12896 function BlockAlignmentControl(props) { 12897 return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { 12898 isToolbar: false 12899 })); 12900 } 12901 function BlockAlignmentToolbar(props) { 12902 return Object(external_wp_element_["createElement"])(ui, Object(esm_extends["a" /* default */])({}, props, { 12903 isToolbar: true 12904 })); 12905 } 12906 12907 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/align.js 12908 12909 12910 12911 /** 12912 * External dependencies 12913 */ 12914 12915 12916 /** 12917 * WordPress dependencies 12918 */ 12919 12920 12921 12922 12923 /** 12924 * Internal dependencies 12925 */ 12926 12927 12928 12929 /** 12930 * An array which includes all possible valid alignments, 12931 * used to validate if an alignment is valid or not. 12932 * 12933 * @constant 12934 * @type {string[]} 12935 */ 12936 12937 const ALL_ALIGNMENTS = ['left', 'center', 'right', 'wide', 'full']; 12938 /** 12939 * An array which includes all wide alignments. 12940 * In order for this alignments to be valid they need to be supported by the block, 12941 * and by the theme. 12942 * 12943 * @constant 12944 * @type {string[]} 12945 */ 12946 12947 const WIDE_ALIGNMENTS = ['wide', 'full']; 12948 /** 12949 * Returns the valid alignments. 12950 * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not. 12951 * Exported just for testing purposes, not exported outside the module. 12952 * 12953 * @param {?boolean|string[]} blockAlign Aligns supported by the block. 12954 * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise. 12955 * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise. 12956 * 12957 * @return {string[]} Valid alignments. 12958 */ 12959 12960 function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = true) { 12961 let validAlignments; 12962 12963 if (Array.isArray(blockAlign)) { 12964 validAlignments = ALL_ALIGNMENTS.filter(value => blockAlign.includes(value)); 12965 } else if (blockAlign === true) { 12966 // `true` includes all alignments... 12967 validAlignments = ALL_ALIGNMENTS; 12968 } else { 12969 validAlignments = []; 12970 } 12971 12972 if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) { 12973 return Object(external_lodash_["without"])(validAlignments, ...WIDE_ALIGNMENTS); 12974 } 12975 12976 return validAlignments; 12977 } 12978 /** 12979 * Filters registered block settings, extending attributes to include `align`. 12980 * 12981 * @param {Object} settings Original block settings 12982 * @return {Object} Filtered block settings 12983 */ 12984 12985 function addAttribute(settings) { 12986 // allow blocks to specify their own attribute definition with default values if needed. 12987 if (Object(external_lodash_["has"])(settings.attributes, ['align', 'type'])) { 12988 return settings; 12989 } 12990 12991 if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'align')) { 12992 // Gracefully handle if settings.attributes is undefined. 12993 settings.attributes = { ...settings.attributes, 12994 align: { 12995 type: 'string', 12996 // Allow for '' since it is used by updateAlignment function 12997 // in withToolbarControls for special cases with defined default values. 12998 enum: [...ALL_ALIGNMENTS, ''] 12999 } 13000 }; 13001 } 13002 13003 return settings; 13004 } 13005 /** 13006 * Override the default edit UI to include new toolbar controls for block 13007 * alignment, if block defines support. 13008 * 13009 * @param {Function} BlockEdit Original component 13010 * @return {Function} Wrapped component 13011 */ 13012 13013 const withToolbarControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { 13014 const { 13015 name: blockName 13016 } = props; // Compute the block allowed alignments without taking into account, 13017 // if the theme supports wide alignments or not 13018 // and without checking the layout for availble alignments. 13019 // BlockAlignmentToolbar takes both of these into account. 13020 13021 const blockAllowedAlignments = getValidAlignments(Object(external_wp_blocks_["getBlockSupport"])(blockName, 'align'), Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'alignWide', true)); 13022 const validAlignments = useAvailableAlignments(blockAllowedAlignments); 13023 13024 const updateAlignment = nextAlign => { 13025 if (!nextAlign) { 13026 var _blockType$attributes, _blockType$attributes2; 13027 13028 const blockType = Object(external_wp_blocks_["getBlockType"])(props.name); 13029 const blockDefaultAlign = (_blockType$attributes = blockType.attributes) === null || _blockType$attributes === void 0 ? void 0 : (_blockType$attributes2 = _blockType$attributes.align) === null || _blockType$attributes2 === void 0 ? void 0 : _blockType$attributes2.default; 13030 13031 if (blockDefaultAlign) { 13032 nextAlign = ''; 13033 } 13034 } 13035 13036 props.setAttributes({ 13037 align: nextAlign 13038 }); 13039 }; 13040 13041 return [validAlignments.length > 0 && props.isSelected && Object(external_wp_element_["createElement"])(block_controls, { 13042 key: "align-controls", 13043 group: "block" 13044 }, Object(external_wp_element_["createElement"])(BlockAlignmentControl, { 13045 value: props.attributes.align, 13046 onChange: updateAlignment, 13047 controls: validAlignments 13048 })), Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ 13049 key: "edit" 13050 }, props))]; 13051 }, 'withToolbarControls'); 13052 /** 13053 * Override the default block element to add alignment wrapper props. 13054 * 13055 * @param {Function} BlockListBlock Original component 13056 * @return {Function} Wrapped component 13057 */ 13058 13059 const withDataAlign = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 13060 const { 13061 name, 13062 attributes 13063 } = props; 13064 const { 13065 align 13066 } = attributes; 13067 const blockAllowedAlignments = getValidAlignments(Object(external_wp_blocks_["getBlockSupport"])(name, 'align'), Object(external_wp_blocks_["hasBlockSupport"])(name, 'alignWide', true)); 13068 const validAlignments = useAvailableAlignments(blockAllowedAlignments); // If an alignment is not assigned, there's no need to go through the 13069 // effort to validate or assign its value. 13070 13071 if (align === undefined) { 13072 return Object(external_wp_element_["createElement"])(BlockListBlock, props); 13073 } 13074 13075 let wrapperProps = props.wrapperProps; 13076 13077 if (validAlignments.includes(align)) { 13078 wrapperProps = { ...wrapperProps, 13079 'data-align': align 13080 }; 13081 } 13082 13083 return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { 13084 wrapperProps: wrapperProps 13085 })); 13086 }); 13087 /** 13088 * Override props assigned to save component to inject alignment class name if 13089 * block supports it. 13090 * 13091 * @param {Object} props Additional props applied to save element 13092 * @param {Object} blockType Block type 13093 * @param {Object} attributes Block attributes 13094 * @return {Object} Filtered props applied to save element 13095 */ 13096 13097 function addAssignedAlign(props, blockType, attributes) { 13098 const { 13099 align 13100 } = attributes; 13101 const blockAlign = Object(external_wp_blocks_["getBlockSupport"])(blockType, 'align'); 13102 const hasWideBlockSupport = Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'alignWide', true); // Compute valid alignments without taking into account if 13103 // the theme supports wide alignments or not. 13104 // This way changing themes does not impact the block save. 13105 13106 const isAlignValid = getValidAlignments(blockAlign, hasWideBlockSupport).includes(align); 13107 13108 if (isAlignValid) { 13109 props.className = classnames_default()(`align${align}`, props.className); 13110 } 13111 13112 return props; 13113 } 13114 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/align/addAttribute', addAttribute); 13115 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/align/with-data-align', withDataAlign); 13116 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/align/with-toolbar-controls', withToolbarControls); 13117 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/align/addAssignedAlign', addAssignedAlign); 13118 13119 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-advanced-controls/index.js 13120 13121 13122 /** 13123 * WordPress dependencies 13124 */ 13125 13126 /** 13127 * Internal dependencies 13128 */ 13129 13130 13131 const inspector_advanced_controls_name = 'InspectorAdvancedControls'; 13132 const { 13133 Fill: inspector_advanced_controls_Fill, 13134 Slot: inspector_advanced_controls_Slot 13135 } = Object(external_wp_components_["createSlotFill"])(inspector_advanced_controls_name); 13136 13137 function InspectorAdvancedControls({ 13138 children 13139 }) { 13140 const { 13141 isSelected 13142 } = useBlockEditContext(); 13143 return isSelected ? Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { 13144 document: document 13145 }, Object(external_wp_element_["createElement"])(inspector_advanced_controls_Fill, null, children)) : null; 13146 } 13147 13148 InspectorAdvancedControls.slotName = inspector_advanced_controls_name; 13149 InspectorAdvancedControls.Slot = inspector_advanced_controls_Slot; 13150 /** 13151 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-advanced-controls/README.md 13152 */ 13153 13154 /* harmony default export */ var inspector_advanced_controls = (InspectorAdvancedControls); 13155 13156 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/index.js 13157 13158 13159 /** 13160 * WordPress dependencies 13161 */ 13162 13163 /** 13164 * Internal dependencies 13165 */ 13166 13167 13168 const { 13169 Fill: inspector_controls_Fill, 13170 Slot: inspector_controls_Slot 13171 } = Object(external_wp_components_["createSlotFill"])('InspectorControls'); 13172 13173 function InspectorControls({ 13174 children 13175 }) { 13176 return useDisplayBlockControls() ? Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { 13177 document: document 13178 }, Object(external_wp_element_["createElement"])(inspector_controls_Fill, null, children)) : null; 13179 } 13180 13181 InspectorControls.Slot = inspector_controls_Slot; 13182 /** 13183 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md 13184 */ 13185 13186 /* harmony default export */ var inspector_controls = (InspectorControls); 13187 13188 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js 13189 13190 13191 /** 13192 * External dependencies 13193 */ 13194 13195 /** 13196 * WordPress dependencies 13197 */ 13198 13199 13200 13201 13202 13203 13204 13205 /** 13206 * Internal dependencies 13207 */ 13208 13209 13210 /** 13211 * Regular expression matching invalid anchor characters for replacement. 13212 * 13213 * @type {RegExp} 13214 */ 13215 13216 const ANCHOR_REGEX = /[\s#]/g; 13217 /** 13218 * Filters registered block settings, extending attributes with anchor using ID 13219 * of the first node. 13220 * 13221 * @param {Object} settings Original block settings. 13222 * 13223 * @return {Object} Filtered block settings. 13224 */ 13225 13226 function anchor_addAttribute(settings) { 13227 // allow blocks to specify their own attribute definition with default values if needed. 13228 if (Object(external_lodash_["has"])(settings.attributes, ['anchor', 'type'])) { 13229 return settings; 13230 } 13231 13232 if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'anchor')) { 13233 // Gracefully handle if settings.attributes is undefined. 13234 settings.attributes = { ...settings.attributes, 13235 anchor: { 13236 type: 'string', 13237 source: 'attribute', 13238 attribute: 'id', 13239 selector: '*' 13240 } 13241 }; 13242 } 13243 13244 return settings; 13245 } 13246 /** 13247 * Override the default edit UI to include a new block inspector control for 13248 * assigning the anchor ID, if block supports anchor. 13249 * 13250 * @param {WPComponent} BlockEdit Original component. 13251 * 13252 * @return {WPComponent} Wrapped component. 13253 */ 13254 13255 const withInspectorControl = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => { 13256 return props => { 13257 const hasAnchor = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'anchor'); 13258 13259 if (hasAnchor && props.isSelected) { 13260 const isWeb = external_wp_element_["Platform"].OS === 'web'; 13261 const textControl = Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 13262 className: "html-anchor-control", 13263 label: Object(external_wp_i18n_["__"])('HTML anchor'), 13264 help: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { 13265 href: 'https://wordpress.org/support/article/page-jumps/' 13266 }, Object(external_wp_i18n_["__"])('Learn more about anchors'))), 13267 value: props.attributes.anchor || '', 13268 placeholder: !isWeb ? Object(external_wp_i18n_["__"])('Add an anchor') : null, 13269 onChange: nextValue => { 13270 nextValue = nextValue.replace(ANCHOR_REGEX, '-'); 13271 props.setAttributes({ 13272 anchor: nextValue 13273 }); 13274 }, 13275 autoCapitalize: "none", 13276 autoComplete: "off" 13277 }); 13278 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), isWeb && Object(external_wp_element_["createElement"])(inspector_advanced_controls, null, textControl), !isWeb && props.name === 'core/heading' && Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 13279 title: Object(external_wp_i18n_["__"])('Heading settings') 13280 }, textControl))); 13281 } 13282 13283 return Object(external_wp_element_["createElement"])(BlockEdit, props); 13284 }; 13285 }, 'withInspectorControl'); 13286 /** 13287 * Override props assigned to save component to inject anchor ID, if block 13288 * supports anchor. This is only applied if the block's save result is an 13289 * element and not a markup string. 13290 * 13291 * @param {Object} extraProps Additional props applied to save element. 13292 * @param {Object} blockType Block type. 13293 * @param {Object} attributes Current block attributes. 13294 * 13295 * @return {Object} Filtered props applied to save element. 13296 */ 13297 13298 function addSaveProps(extraProps, blockType, attributes) { 13299 if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'anchor')) { 13300 extraProps.id = attributes.anchor === '' ? null : attributes.anchor; 13301 } 13302 13303 return extraProps; 13304 } 13305 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); 13306 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/anchor/with-inspector-control', withInspectorControl); 13307 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/anchor/save-props', addSaveProps); 13308 13309 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js 13310 13311 13312 /** 13313 * External dependencies 13314 */ 13315 13316 13317 /** 13318 * WordPress dependencies 13319 */ 13320 13321 13322 13323 13324 13325 13326 /** 13327 * Internal dependencies 13328 */ 13329 13330 13331 /** 13332 * Filters registered block settings, extending attributes with anchor using ID 13333 * of the first node. 13334 * 13335 * @param {Object} settings Original block settings. 13336 * 13337 * @return {Object} Filtered block settings. 13338 */ 13339 13340 function custom_class_name_addAttribute(settings) { 13341 if (Object(external_wp_blocks_["hasBlockSupport"])(settings, 'customClassName', true)) { 13342 // Gracefully handle if settings.attributes is undefined. 13343 settings.attributes = { ...settings.attributes, 13344 className: { 13345 type: 'string' 13346 } 13347 }; 13348 } 13349 13350 return settings; 13351 } 13352 /** 13353 * Override the default edit UI to include a new block inspector control for 13354 * assigning the custom class name, if block supports custom class name. 13355 * 13356 * @param {WPComponent} BlockEdit Original component. 13357 * 13358 * @return {WPComponent} Wrapped component. 13359 */ 13360 13361 const custom_class_name_withInspectorControl = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => { 13362 return props => { 13363 const hasCustomClassName = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'customClassName', true); 13364 13365 if (hasCustomClassName && props.isSelected) { 13366 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), Object(external_wp_element_["createElement"])(inspector_advanced_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 13367 autoComplete: "off", 13368 label: Object(external_wp_i18n_["__"])('Additional CSS class(es)'), 13369 value: props.attributes.className || '', 13370 onChange: nextValue => { 13371 props.setAttributes({ 13372 className: nextValue !== '' ? nextValue : undefined 13373 }); 13374 }, 13375 help: Object(external_wp_i18n_["__"])('Separate multiple classes with spaces.') 13376 }))); 13377 } 13378 13379 return Object(external_wp_element_["createElement"])(BlockEdit, props); 13380 }; 13381 }, 'withInspectorControl'); 13382 /** 13383 * Override props assigned to save component to inject anchor ID, if block 13384 * supports anchor. This is only applied if the block's save result is an 13385 * element and not a markup string. 13386 * 13387 * @param {Object} extraProps Additional props applied to save element. 13388 * @param {Object} blockType Block type. 13389 * @param {Object} attributes Current block attributes. 13390 * 13391 * @return {Object} Filtered props applied to save element. 13392 */ 13393 13394 function custom_class_name_addSaveProps(extraProps, blockType, attributes) { 13395 if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'customClassName', true) && attributes.className) { 13396 extraProps.className = classnames_default()(extraProps.className, attributes.className); 13397 } 13398 13399 return extraProps; 13400 } 13401 /** 13402 * Given an HTML string, returns an array of class names assigned to the root 13403 * element in the markup. 13404 * 13405 * @param {string} innerHTML Markup string from which to extract classes. 13406 * 13407 * @return {string[]} Array of class names assigned to the root element. 13408 */ 13409 13410 function getHTMLRootElementClasses(innerHTML) { 13411 innerHTML = `<div data-custom-class-name>${innerHTML}</div>`; 13412 const parsed = Object(external_wp_blocks_["parseWithAttributeSchema"])(innerHTML, { 13413 type: 'string', 13414 source: 'attribute', 13415 selector: '[data-custom-class-name] > *', 13416 attribute: 'class' 13417 }); 13418 return parsed ? parsed.trim().split(/\s+/) : []; 13419 } 13420 /** 13421 * Given a parsed set of block attributes, if the block supports custom class 13422 * names and an unknown class (per the block's serialization behavior) is 13423 * found, the unknown classes are treated as custom classes. This prevents the 13424 * block from being considered as invalid. 13425 * 13426 * @param {Object} blockAttributes Original block attributes. 13427 * @param {Object} blockType Block type settings. 13428 * @param {string} innerHTML Original block markup. 13429 * 13430 * @return {Object} Filtered block attributes. 13431 */ 13432 13433 function addParsedDifference(blockAttributes, blockType, innerHTML) { 13434 if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'customClassName', true)) { 13435 // To determine difference, serialize block given the known set of 13436 // attributes, with the exception of `className`. This will determine 13437 // the default set of classes. From there, any difference in innerHTML 13438 // can be considered as custom classes. 13439 const attributesSansClassName = Object(external_lodash_["omit"])(blockAttributes, ['className']); 13440 const serialized = Object(external_wp_blocks_["getSaveContent"])(blockType, attributesSansClassName); 13441 const defaultClasses = getHTMLRootElementClasses(serialized); 13442 const actualClasses = getHTMLRootElementClasses(innerHTML); 13443 const customClasses = Object(external_lodash_["difference"])(actualClasses, defaultClasses); 13444 13445 if (customClasses.length) { 13446 blockAttributes.className = customClasses.join(' '); 13447 } else if (serialized) { 13448 delete blockAttributes.className; 13449 } 13450 } 13451 13452 return blockAttributes; 13453 } 13454 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/custom-class-name/attribute', custom_class_name_addAttribute); 13455 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/custom-class-name/with-inspector-control', custom_class_name_withInspectorControl); 13456 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/custom-class-name/save-props', custom_class_name_addSaveProps); 13457 Object(external_wp_hooks_["addFilter"])('blocks.getBlockAttributes', 'core/custom-class-name/addParsedDifference', addParsedDifference); 13458 13459 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/generated-class-name.js 13460 /** 13461 * External dependencies 13462 */ 13463 13464 /** 13465 * WordPress dependencies 13466 */ 13467 13468 13469 13470 /** 13471 * Override props assigned to save component to inject generated className if 13472 * block supports it. This is only applied if the block's save result is an 13473 * element and not a markup string. 13474 * 13475 * @param {Object} extraProps Additional props applied to save element. 13476 * @param {Object} blockType Block type. 13477 * 13478 * @return {Object} Filtered props applied to save element. 13479 */ 13480 13481 function addGeneratedClassName(extraProps, blockType) { 13482 // Adding the generated className 13483 if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'className', true)) { 13484 if (typeof extraProps.className === 'string') { 13485 // We have some extra classes and want to add the default classname 13486 // We use uniq to prevent duplicate classnames 13487 extraProps.className = Object(external_lodash_["uniq"])([Object(external_wp_blocks_["getBlockDefaultClassName"])(blockType.name), ...extraProps.className.split(' ')]).join(' ').trim(); 13488 } else { 13489 // There is no string in the className variable, 13490 // so we just dump the default name in there 13491 extraProps.className = Object(external_wp_blocks_["getBlockDefaultClassName"])(blockType.name); 13492 } 13493 } 13494 13495 return extraProps; 13496 } 13497 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); 13498 13499 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-setting/index.js 13500 /** 13501 * External dependencies 13502 */ 13503 13504 /** 13505 * WordPress dependencies 13506 */ 13507 13508 13509 /** 13510 * Internal dependencies 13511 */ 13512 13513 13514 13515 const deprecatedFlags = { 13516 'color.palette': settings => settings.colors === undefined ? undefined : settings.colors, 13517 'color.gradients': settings => settings.gradients === undefined ? undefined : settings.gradients, 13518 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors, 13519 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients, 13520 'typography.fontSizes': settings => settings.fontSizes === undefined ? undefined : settings.fontSizes, 13521 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes, 13522 'typography.customLineHeight': settings => settings.enableCustomLineHeight, 13523 'spacing.units': settings => { 13524 if (settings.enableCustomUnits === undefined) { 13525 return; 13526 } 13527 13528 if (settings.enableCustomUnits === true) { 13529 return ['px', 'em', 'rem', 'vh', 'vw', '%']; 13530 } 13531 13532 return settings.enableCustomUnits; 13533 }, 13534 'spacing.customPadding': settings => settings.enableCustomSpacing 13535 }; 13536 const PATHS_WITH_MERGE = { 13537 'color.gradients': true, 13538 'color.palette': true, 13539 'typography.fontFamilies': true, 13540 'typography.fontSizes': true 13541 }; 13542 /** 13543 * Hook that retrieves the editor setting. 13544 * It works with nested objects using by finding the value at path. 13545 * 13546 * @param {string} path The path to the setting. 13547 * 13548 * @return {any} Returns the value defined for the setting. 13549 * 13550 * @example 13551 * ```js 13552 * const isEnabled = useSetting( 'typography.dropCap' ); 13553 * ``` 13554 */ 13555 13556 function useSetting(path) { 13557 const { 13558 name: blockName 13559 } = useBlockEditContext(); 13560 const setting = Object(external_wp_data_["useSelect"])(select => { 13561 var _get; 13562 13563 const settings = select(store).getSettings(); // 1 - Use __experimental features, if available. 13564 // We cascade to the all value if the block one is not available. 13565 13566 const defaultsPath = `__experimentalFeatures.${path}`; 13567 const blockPath = `__experimentalFeatures.blocks.${blockName}.${path}`; 13568 const experimentalFeaturesResult = (_get = Object(external_lodash_["get"])(settings, blockPath)) !== null && _get !== void 0 ? _get : Object(external_lodash_["get"])(settings, defaultsPath); 13569 13570 if (experimentalFeaturesResult !== undefined) { 13571 if (PATHS_WITH_MERGE[path]) { 13572 var _ref, _experimentalFeatures; 13573 13574 return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.core; 13575 } 13576 13577 return experimentalFeaturesResult; 13578 } // 2 - Use deprecated settings, otherwise. 13579 13580 13581 const deprecatedSettingsValue = deprecatedFlags[path] ? deprecatedFlags[path](settings) : undefined; 13582 13583 if (deprecatedSettingsValue !== undefined) { 13584 return deprecatedSettingsValue; 13585 } // 3 - Fall back for typography.dropCap: 13586 // This is only necessary to support typography.dropCap. 13587 // when __experimentalFeatures are not present (core without plugin). 13588 // To remove when __experimentalFeatures are ported to core. 13589 13590 13591 return path === 'typography.dropCap' ? true : undefined; 13592 }, [blockName, path]); 13593 return setting; 13594 } 13595 13596 // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js 13597 var tinycolor = __webpack_require__("Zss7"); 13598 var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor); 13599 13600 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js 13601 /** 13602 * External dependencies 13603 */ 13604 13605 13606 /** 13607 * Provided an array of color objects as set by the theme or by the editor defaults, 13608 * and the values of the defined color or custom color returns a color object describing the color. 13609 * 13610 * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. 13611 * @param {?string} definedColor A string containing the color slug. 13612 * @param {?string} customColor A string containing the customColor value. 13613 * 13614 * @return {?Object} If definedColor is passed and the name is found in colors, 13615 * the color object exactly as set by the theme or editor defaults is returned. 13616 * Otherwise, an object that just sets the color is defined. 13617 */ 13618 13619 const getColorObjectByAttributeValues = (colors, definedColor, customColor) => { 13620 if (definedColor) { 13621 const colorObj = Object(external_lodash_["find"])(colors, { 13622 slug: definedColor 13623 }); 13624 13625 if (colorObj) { 13626 return colorObj; 13627 } 13628 } 13629 13630 return { 13631 color: customColor 13632 }; 13633 }; 13634 /** 13635 * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined. 13636 * 13637 * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. 13638 * @param {?string} colorValue A string containing the color value. 13639 * 13640 * @return {?Object} Color object included in the colors array whose color property equals colorValue. 13641 * Returns undefined if no color object matches this requirement. 13642 */ 13643 13644 const getColorObjectByColorValue = (colors, colorValue) => { 13645 return Object(external_lodash_["find"])(colors, { 13646 color: colorValue 13647 }); 13648 }; 13649 /** 13650 * Returns a class based on the context a color is being used and its slug. 13651 * 13652 * @param {string} colorContextName Context/place where color is being used e.g: background, text etc... 13653 * @param {string} colorSlug Slug of the color. 13654 * 13655 * @return {?string} String with the class corresponding to the color in the provided context. 13656 * Returns undefined if either colorContextName or colorSlug are not provided. 13657 */ 13658 13659 function getColorClassName(colorContextName, colorSlug) { 13660 if (!colorContextName || !colorSlug) { 13661 return undefined; 13662 } 13663 13664 return `has-${Object(external_lodash_["kebabCase"])(colorSlug)}-${colorContextName}`; 13665 } 13666 /** 13667 * Given an array of color objects and a color value returns the color value of the most readable color in the array. 13668 * 13669 * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. 13670 * @param {?string} colorValue A string containing the color value. 13671 * 13672 * @return {string} String with the color value of the most readable color. 13673 */ 13674 13675 function getMostReadableColor(colors, colorValue) { 13676 return tinycolor_default.a.mostReadable(colorValue, Object(external_lodash_["map"])(colors, 'color')).toHexString(); 13677 } 13678 13679 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js 13680 /** 13681 * External dependencies 13682 */ 13683 13684 /** 13685 * WordPress dependencies 13686 */ 13687 13688 13689 13690 /** 13691 * Internal dependencies 13692 */ 13693 13694 13695 13696 13697 const use_gradient_EMPTY_ARRAY = []; 13698 function __experimentalGetGradientClass(gradientSlug) { 13699 if (!gradientSlug) { 13700 return undefined; 13701 } 13702 13703 return `has-${gradientSlug}-gradient-background`; 13704 } 13705 /** 13706 * Retrieves the gradient value per slug. 13707 * 13708 * @param {Array} gradients Gradient Palette 13709 * @param {string} slug Gradient slug 13710 * 13711 * @return {string} Gradient value. 13712 */ 13713 13714 function getGradientValueBySlug(gradients, slug) { 13715 const gradient = Object(external_lodash_["find"])(gradients, ['slug', slug]); 13716 return gradient && gradient.gradient; 13717 } 13718 function __experimentalGetGradientObjectByGradientValue(gradients, value) { 13719 const gradient = Object(external_lodash_["find"])(gradients, ['gradient', value]); 13720 return gradient; 13721 } 13722 /** 13723 * Retrieves the gradient slug per slug. 13724 * 13725 * @param {Array} gradients Gradient Palette 13726 * @param {string} value Gradient value 13727 * @return {string} Gradient slug. 13728 */ 13729 13730 function getGradientSlugByValue(gradients, value) { 13731 const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value); 13732 13733 return gradient && gradient.slug; 13734 } 13735 function __experimentalUseGradient({ 13736 gradientAttribute = 'gradient', 13737 customGradientAttribute = 'customGradient' 13738 } = {}) { 13739 const { 13740 clientId 13741 } = useBlockEditContext(); 13742 const gradients = useSetting('color.gradients') || use_gradient_EMPTY_ARRAY; 13743 const { 13744 gradient, 13745 customGradient 13746 } = Object(external_wp_data_["useSelect"])(select => { 13747 const { 13748 getBlockAttributes 13749 } = select(store); 13750 const attributes = getBlockAttributes(clientId) || {}; 13751 return { 13752 customGradient: attributes[customGradientAttribute], 13753 gradient: attributes[gradientAttribute] 13754 }; 13755 }, [clientId, gradientAttribute, customGradientAttribute]); 13756 const { 13757 updateBlockAttributes 13758 } = Object(external_wp_data_["useDispatch"])(store); 13759 const setGradient = Object(external_wp_element_["useCallback"])(newGradientValue => { 13760 const slug = getGradientSlugByValue(gradients, newGradientValue); 13761 13762 if (slug) { 13763 updateBlockAttributes(clientId, { 13764 [gradientAttribute]: slug, 13765 [customGradientAttribute]: undefined 13766 }); 13767 return; 13768 } 13769 13770 updateBlockAttributes(clientId, { 13771 [gradientAttribute]: undefined, 13772 [customGradientAttribute]: newGradientValue 13773 }); 13774 }, [gradients, clientId, updateBlockAttributes]); 13775 13776 const gradientClass = __experimentalGetGradientClass(gradient); 13777 13778 let gradientValue; 13779 13780 if (gradient) { 13781 gradientValue = getGradientValueBySlug(gradients, gradient); 13782 } else { 13783 gradientValue = customGradient; 13784 } 13785 13786 return { 13787 gradientClass, 13788 gradientValue, 13789 setGradient 13790 }; 13791 } 13792 13793 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/control.js 13794 13795 13796 13797 /** 13798 * External dependencies 13799 */ 13800 13801 13802 /** 13803 * WordPress dependencies 13804 */ 13805 13806 13807 13808 13809 /** 13810 * Internal dependencies 13811 */ 13812 13813 13814 13815 // translators: first %s: the color name or value (e.g. red or #ff0000) 13816 13817 const colorIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(Color: %s)'); // translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%) 13818 13819 13820 const gradientIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(Gradient: %s)'); 13821 13822 const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; 13823 13824 function VisualLabel({ 13825 colors, 13826 gradients, 13827 label, 13828 currentTab, 13829 colorValue, 13830 gradientValue 13831 }) { 13832 let value, ariaLabel; 13833 13834 if (currentTab === 'color') { 13835 if (colorValue) { 13836 value = colorValue; 13837 const colorObject = getColorObjectByColorValue(colors, value); 13838 const colorName = colorObject && colorObject.name; 13839 ariaLabel = Object(external_wp_i18n_["sprintf"])(colorIndicatorAriaLabel, colorName || value); 13840 } 13841 } else if (currentTab === 'gradient' && gradientValue) { 13842 value = gradientValue; 13843 13844 const gradientObject = __experimentalGetGradientObjectByGradientValue(gradients, value); 13845 13846 const gradientName = gradientObject && gradientObject.name; 13847 ariaLabel = Object(external_wp_i18n_["sprintf"])(gradientIndicatorAriaLabel, gradientName || value); 13848 } 13849 13850 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, label, !!value && Object(external_wp_element_["createElement"])(external_wp_components_["ColorIndicator"], { 13851 colorValue: value, 13852 "aria-label": ariaLabel 13853 })); 13854 } 13855 13856 function ColorGradientControlInner({ 13857 colors, 13858 gradients, 13859 disableCustomColors, 13860 disableCustomGradients, 13861 className, 13862 label, 13863 onColorChange, 13864 onGradientChange, 13865 colorValue, 13866 gradientValue, 13867 clearable 13868 }) { 13869 const canChooseAColor = onColorChange && (!Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors); 13870 const canChooseAGradient = onGradientChange && (!Object(external_lodash_["isEmpty"])(gradients) || !disableCustomGradients); 13871 const [currentTab, setCurrentTab] = Object(external_wp_element_["useState"])(gradientValue ? 'gradient' : !!canChooseAColor && 'color'); 13872 13873 if (!canChooseAColor && !canChooseAGradient) { 13874 return null; 13875 } 13876 13877 return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { 13878 className: classnames_default()('block-editor-color-gradient-control', className) 13879 }, Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_element_["createElement"])("div", { 13880 className: "block-editor-color-gradient-control__color-indicator" 13881 }, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"].VisualLabel, null, Object(external_wp_element_["createElement"])(VisualLabel, { 13882 currentTab: currentTab, 13883 label: label, 13884 colorValue: colorValue, 13885 gradientValue: gradientValue 13886 })))), canChooseAColor && canChooseAGradient && Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { 13887 className: "block-editor-color-gradient-control__button-tabs" 13888 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 13889 isSmall: true, 13890 isPressed: currentTab === 'color', 13891 onClick: () => setCurrentTab('color') 13892 }, Object(external_wp_i18n_["__"])('Solid')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 13893 isSmall: true, 13894 isPressed: currentTab === 'gradient', 13895 onClick: () => setCurrentTab('gradient') 13896 }, Object(external_wp_i18n_["__"])('Gradient'))), (currentTab === 'color' || !canChooseAGradient) && Object(external_wp_element_["createElement"])(external_wp_components_["ColorPalette"], { 13897 value: colorValue, 13898 onChange: canChooseAGradient ? newColor => { 13899 onColorChange(newColor); 13900 onGradientChange(); 13901 } : onColorChange, 13902 colors, 13903 disableCustomColors, 13904 clearable: clearable 13905 }), (currentTab === 'gradient' || !canChooseAColor) && Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalGradientPicker"], { 13906 value: gradientValue, 13907 onChange: canChooseAColor ? newGradient => { 13908 onGradientChange(newGradient); 13909 onColorChange(); 13910 } : onGradientChange, 13911 gradients, 13912 disableCustomGradients, 13913 clearable: clearable 13914 }))); 13915 } 13916 13917 function ColorGradientControlSelect(props) { 13918 const colorGradientSettings = {}; 13919 colorGradientSettings.colors = useSetting('color.palette'); 13920 colorGradientSettings.gradients = useSetting('color.gradients'); 13921 colorGradientSettings.disableCustomColors = !useSetting('color.custom'); 13922 colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient'); 13923 return Object(external_wp_element_["createElement"])(ColorGradientControlInner, Object(esm_extends["a" /* default */])({}, colorGradientSettings, props)); 13924 } 13925 13926 function ColorGradientControl(props) { 13927 if (Object(external_lodash_["every"])(colorsAndGradientKeys, key => props.hasOwnProperty(key))) { 13928 return Object(external_wp_element_["createElement"])(ColorGradientControlInner, props); 13929 } 13930 13931 return Object(external_wp_element_["createElement"])(ColorGradientControlSelect, props); 13932 } 13933 13934 /* harmony default export */ var control = (ColorGradientControl); 13935 13936 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js 13937 /** 13938 * External dependencies 13939 */ 13940 13941 /** 13942 * Removed falsy values from nested object. 13943 * 13944 * @param {*} object 13945 * @return {*} Object cleaned from falsy values 13946 */ 13947 13948 const cleanEmptyObject = object => { 13949 if (!Object(external_lodash_["isObject"])(object) || Array.isArray(object)) { 13950 return object; 13951 } 13952 13953 const cleanedNestedObjects = Object(external_lodash_["pickBy"])(Object(external_lodash_["mapValues"])(object, cleanEmptyObject), external_lodash_["identity"]); 13954 return Object(external_lodash_["isEmpty"])(cleanedNestedObjects) ? undefined : cleanedNestedObjects; 13955 }; 13956 13957 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-color.js 13958 13959 13960 13961 /** 13962 * External dependencies 13963 */ 13964 13965 /** 13966 * WordPress dependencies 13967 */ 13968 13969 13970 13971 13972 /** 13973 * Internal dependencies 13974 */ 13975 13976 13977 13978 13979 13980 // Defining empty array here instead of inline avoids unnecessary re-renders of 13981 // color control. 13982 13983 const border_color_EMPTY_ARRAY = []; 13984 /** 13985 * Inspector control panel containing the border color related configuration. 13986 * 13987 * There is deliberate overlap between the colors and borders block supports 13988 * relating to border color. It can be argued the border color controls could 13989 * be included within either, or both, the colors and borders panels in the 13990 * inspector controls. If they share the same block attributes it should not 13991 * matter. 13992 * 13993 * @param {Object} props Block properties. 13994 * @return {WPElement} Border color edit element. 13995 */ 13996 13997 function BorderColorEdit(props) { 13998 var _style$border; 13999 14000 const { 14001 attributes: { 14002 borderColor, 14003 style 14004 }, 14005 setAttributes 14006 } = props; 14007 const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY; 14008 const disableCustomColors = !useSetting('color.custom'); 14009 const disableCustomGradients = !useSetting('color.customGradient'); 14010 14011 const onChangeColor = value => { 14012 const colorObject = getColorObjectByColorValue(colors, value); 14013 const newStyle = { ...style, 14014 border: { ...(style === null || style === void 0 ? void 0 : style.border), 14015 color: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value 14016 } 14017 }; // If empty slug, ensure undefined to remove attribute. 14018 14019 const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined; 14020 setAttributes({ 14021 style: cleanEmptyObject(newStyle), 14022 borderColor: newNamedColor 14023 }); 14024 }; 14025 14026 return Object(external_wp_element_["createElement"])(control, { 14027 label: Object(external_wp_i18n_["__"])('Border color'), 14028 value: borderColor || (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color), 14029 colors: colors, 14030 gradients: undefined, 14031 disableCustomColors: disableCustomColors, 14032 disableCustomGradients: disableCustomGradients, 14033 onColorChange: onChangeColor 14034 }); 14035 } 14036 /** 14037 * Filters registered block settings, extending attributes to include 14038 * `borderColor` if needed. 14039 * 14040 * @param {Object} settings Original block settings. 14041 * @return {Object} Updated block settings. 14042 */ 14043 14044 function addAttributes(settings) { 14045 if (!hasBorderSupport(settings, 'color')) { 14046 return settings; 14047 } // Allow blocks to specify default value if needed. 14048 14049 14050 if (settings.attributes.borderColor) { 14051 return settings; 14052 } // Add new borderColor attribute to block settings. 14053 14054 14055 return { ...settings, 14056 attributes: { ...settings.attributes, 14057 borderColor: { 14058 type: 'string' 14059 } 14060 } 14061 }; 14062 } 14063 /** 14064 * Override props assigned to save component to inject border color. 14065 * 14066 * @param {Object} props Additional props applied to save element. 14067 * @param {Object} blockType Block type definition. 14068 * @param {Object} attributes Block's attributes 14069 * @return {Object} Filtered props to apply to save element. 14070 */ 14071 14072 14073 function border_color_addSaveProps(props, blockType, attributes) { 14074 var _style$border2; 14075 14076 if (!hasBorderSupport(blockType, 'color') || shouldSkipSerialization(blockType)) { 14077 return props; 14078 } 14079 14080 const { 14081 borderColor, 14082 style 14083 } = attributes; 14084 const borderColorClass = getColorClassName('border-color', borderColor); 14085 const newClassName = classnames_default()(props.className, { 14086 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.color), 14087 [borderColorClass]: !!borderColorClass 14088 }); // If we are clearing the last of the previous classes in `className` 14089 // set it to `undefined` to avoid rendering empty DOM attributes. 14090 14091 props.className = newClassName ? newClassName : undefined; 14092 return props; 14093 } 14094 /** 14095 * Filters the registered block settings to apply border color styles and 14096 * classnames to the block edit wrapper. 14097 * 14098 * @param {Object} settings Original block settings. 14099 * @return {Object} Filtered block settings. 14100 */ 14101 14102 14103 function addEditProps(settings) { 14104 if (!hasBorderSupport(settings, 'color') || shouldSkipSerialization(settings)) { 14105 return settings; 14106 } 14107 14108 const existingGetEditWrapperProps = settings.getEditWrapperProps; 14109 14110 settings.getEditWrapperProps = attributes => { 14111 let props = {}; 14112 14113 if (existingGetEditWrapperProps) { 14114 props = existingGetEditWrapperProps(attributes); 14115 } 14116 14117 return border_color_addSaveProps(props, settings, attributes); 14118 }; 14119 14120 return settings; 14121 } 14122 /** 14123 * This adds inline styles for color palette colors. 14124 * Ideally, this is not needed and themes should load their palettes on the editor. 14125 * 14126 * @param {Function} BlockListBlock Original component 14127 * @return {Function} Wrapped component 14128 */ 14129 14130 14131 const withBorderColorPaletteStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 14132 var _getColorObjectByAttr, _props$wrapperProps; 14133 14134 const { 14135 name, 14136 attributes 14137 } = props; 14138 const { 14139 borderColor 14140 } = attributes; 14141 const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY; 14142 14143 if (!hasBorderSupport(name, 'color') || shouldSkipSerialization(name)) { 14144 return Object(external_wp_element_["createElement"])(BlockListBlock, props); 14145 } 14146 14147 const extraStyles = { 14148 borderColor: borderColor ? (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, borderColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color : undefined 14149 }; 14150 let wrapperProps = props.wrapperProps; 14151 wrapperProps = { ...props.wrapperProps, 14152 style: { ...extraStyles, 14153 ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style) 14154 } 14155 }; 14156 return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { 14157 wrapperProps: wrapperProps 14158 })); 14159 }); 14160 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/border/addAttributes', addAttributes); 14161 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/border/addSaveProps', border_color_addSaveProps); 14162 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/border/addEditProps', addEditProps); 14163 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/border/with-border-color-palette-styles', withBorderColorPaletteStyles); 14164 14165 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-radius.js 14166 14167 14168 /** 14169 * WordPress dependencies 14170 */ 14171 14172 14173 /** 14174 * Internal dependencies 14175 */ 14176 14177 14178 const MIN_BORDER_RADIUS_VALUE = 0; 14179 const MAX_BORDER_RADIUS_VALUE = 50; 14180 /** 14181 * Inspector control panel containing the border radius related configuration. 14182 * 14183 * @param {Object} props Block properties. 14184 * @return {WPElement} Border radius edit element. 14185 */ 14186 14187 function BorderRadiusEdit(props) { 14188 var _style$border; 14189 14190 const { 14191 attributes: { 14192 style 14193 }, 14194 setAttributes 14195 } = props; 14196 14197 const onChange = newRadius => { 14198 let newStyle = { ...style, 14199 border: { ...(style === null || style === void 0 ? void 0 : style.border), 14200 radius: newRadius 14201 } 14202 }; 14203 14204 if (newRadius === undefined) { 14205 newStyle = cleanEmptyObject(newStyle); 14206 } 14207 14208 setAttributes({ 14209 style: newStyle 14210 }); 14211 }; 14212 14213 return Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { 14214 value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius, 14215 label: Object(external_wp_i18n_["__"])('Border radius'), 14216 min: MIN_BORDER_RADIUS_VALUE, 14217 max: MAX_BORDER_RADIUS_VALUE, 14218 initialPosition: 0, 14219 allowReset: true, 14220 onChange: onChange 14221 }); 14222 } 14223 14224 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-style-control/index.js 14225 14226 14227 /** 14228 * WordPress dependencies 14229 */ 14230 14231 14232 const DEFAULT_STYLE = { 14233 key: 'default', 14234 name: Object(external_wp_i18n_["__"])('Default'), 14235 style: { 14236 borderStyle: undefined 14237 } 14238 }; 14239 const BORDER_STYLES = [DEFAULT_STYLE, { 14240 key: 'none', 14241 name: Object(external_wp_i18n_["__"])('None'), 14242 style: { 14243 borderStyle: 'none' 14244 } 14245 }, { 14246 key: 'solid', 14247 name: Object(external_wp_i18n_["__"])('Solid'), 14248 style: { 14249 borderStyle: 'solid' 14250 } 14251 }, { 14252 key: 'dashed', 14253 name: Object(external_wp_i18n_["__"])('Dashed'), 14254 style: { 14255 borderStyle: 'dashed' 14256 } 14257 }, { 14258 key: 'dotted', 14259 name: Object(external_wp_i18n_["__"])('Dotted'), 14260 style: { 14261 borderStyle: 'dotted' 14262 } 14263 }]; 14264 /** 14265 * Control to display border style options. 14266 * 14267 * @param {Object} props Component props. 14268 * @param {Object} props.onChange Handler for changing border style selection. 14269 * @param {Object} props.value Currently selected border style value. 14270 * 14271 * @return {WPElement} Custom border style select control. 14272 */ 14273 14274 function BorderStyleControl({ 14275 onChange, 14276 value 14277 }) { 14278 const style = BORDER_STYLES.find(option => option.key === value); 14279 return Object(external_wp_element_["createElement"])("fieldset", { 14280 className: "components-border-style-control" 14281 }, Object(external_wp_element_["createElement"])(external_wp_components_["CustomSelectControl"], { 14282 className: "components-border-style-control__select", 14283 label: Object(external_wp_i18n_["__"])('Border style'), 14284 options: BORDER_STYLES, 14285 value: style || DEFAULT_STYLE, 14286 onChange: ({ 14287 selectedItem 14288 }) => selectedItem.key === 'default' ? onChange(undefined) : onChange(selectedItem.key) 14289 })); 14290 } 14291 14292 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-style.js 14293 14294 14295 /** 14296 * Internal dependencies 14297 */ 14298 14299 14300 /** 14301 * Inspector control for configuring border style property. 14302 * 14303 * @param {Object} props Block properties. 14304 * @return {WPElement} Border style edit element. 14305 */ 14306 14307 const BorderStyleEdit = props => { 14308 var _style$border; 14309 14310 const { 14311 attributes: { 14312 style 14313 }, 14314 setAttributes 14315 } = props; 14316 14317 const onChange = newBorderStyle => { 14318 const newStyleAttributes = { ...style, 14319 border: { ...(style === null || style === void 0 ? void 0 : style.border), 14320 style: newBorderStyle 14321 } 14322 }; 14323 setAttributes({ 14324 style: cleanEmptyObject(newStyleAttributes) 14325 }); 14326 }; 14327 14328 return Object(external_wp_element_["createElement"])(BorderStyleControl, { 14329 value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.style, 14330 onChange: onChange 14331 }); 14332 }; 14333 14334 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border-width.js 14335 14336 14337 /** 14338 * WordPress dependencies 14339 */ 14340 14341 14342 /** 14343 * Internal dependencies 14344 */ 14345 14346 14347 const MIN_BORDER_WIDTH = 0; 14348 const MAX_BORDER_WIDTH = 50; 14349 /** 14350 * Inspector control for configuring border width property. 14351 * 14352 * @param {Object} props Block properties. 14353 * @return {WPElement} Border width edit element. 14354 */ 14355 14356 const BorderWidthEdit = props => { 14357 var _style$border; 14358 14359 const { 14360 attributes: { 14361 style 14362 }, 14363 setAttributes 14364 } = props; 14365 14366 const onChange = newWidth => { 14367 const newStyle = { ...style, 14368 border: { ...(style === null || style === void 0 ? void 0 : style.border), 14369 width: newWidth 14370 } 14371 }; 14372 setAttributes({ 14373 style: cleanEmptyObject(newStyle) 14374 }); 14375 }; 14376 14377 return Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { 14378 value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.width, 14379 label: Object(external_wp_i18n_["__"])('Border width'), 14380 min: MIN_BORDER_WIDTH, 14381 max: MAX_BORDER_WIDTH, 14382 initialPosition: 0, 14383 allowReset: true, 14384 onChange: onChange 14385 }); 14386 }; 14387 14388 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border.js 14389 14390 14391 /** 14392 * WordPress dependencies 14393 */ 14394 14395 14396 14397 14398 /** 14399 * Internal dependencies 14400 */ 14401 14402 14403 14404 14405 14406 14407 14408 const BORDER_SUPPORT_KEY = '__experimentalBorder'; 14409 function BorderPanel(props) { 14410 const isDisabled = useIsBorderDisabled(props); 14411 const isSupported = hasBorderSupport(props.name); 14412 const isColorSupported = useSetting('border.customColor') && hasBorderSupport(props.name, 'color'); 14413 const isRadiusSupported = useSetting('border.customRadius') && hasBorderSupport(props.name, 'radius'); 14414 const isStyleSupported = useSetting('border.customStyle') && hasBorderSupport(props.name, 'style'); 14415 const isWidthSupported = useSetting('border.customWidth') && hasBorderSupport(props.name, 'width'); 14416 14417 if (isDisabled || !isSupported) { 14418 return null; 14419 } 14420 14421 return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 14422 title: Object(external_wp_i18n_["__"])('Border settings'), 14423 initialOpen: false 14424 }, isStyleSupported && Object(external_wp_element_["createElement"])(BorderStyleEdit, props), isWidthSupported && Object(external_wp_element_["createElement"])(BorderWidthEdit, props), isRadiusSupported && Object(external_wp_element_["createElement"])(BorderRadiusEdit, props), isColorSupported && Object(external_wp_element_["createElement"])(BorderColorEdit, props))); 14425 } 14426 /** 14427 * Determine whether there is block support for border properties. 14428 * 14429 * @param {string} blockName Block name. 14430 * @param {string} feature Border feature to check support for. 14431 * @return {boolean} Whether there is support. 14432 */ 14433 14434 function hasBorderSupport(blockName, feature = 'any') { 14435 if (external_wp_element_["Platform"].OS !== 'web') { 14436 return false; 14437 } 14438 14439 const support = Object(external_wp_blocks_["getBlockSupport"])(blockName, BORDER_SUPPORT_KEY); 14440 14441 if (support === true) { 14442 return true; 14443 } 14444 14445 if (feature === 'any') { 14446 return !!(support !== null && support !== void 0 && support.color || support !== null && support !== void 0 && support.radius || support !== null && support !== void 0 && support.width || support !== null && support !== void 0 && support.style); 14447 } 14448 14449 return !!(support !== null && support !== void 0 && support[feature]); 14450 } 14451 /** 14452 * Check whether serialization of border classes and styles should be skipped. 14453 * 14454 * @param {string|Object} blockType Block name or block type object. 14455 * @return {boolean} Whether serialization of border properties should occur. 14456 */ 14457 14458 function shouldSkipSerialization(blockType) { 14459 const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, BORDER_SUPPORT_KEY); 14460 return support === null || support === void 0 ? void 0 : support.__experimentalSkipSerialization; 14461 } 14462 /** 14463 * Determines if all border support features have been disabled. 14464 * 14465 * @return {boolean} If border support is completely disabled. 14466 */ 14467 14468 const useIsBorderDisabled = () => { 14469 const configs = [!useSetting('border.customColor'), !useSetting('border.customRadius'), !useSetting('border.customStyle'), !useSetting('border.customWidth')]; 14470 return configs.every(Boolean); 14471 }; 14472 14473 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js 14474 14475 14476 14477 /** 14478 * External dependencies 14479 */ 14480 14481 14482 /** 14483 * WordPress dependencies 14484 */ 14485 14486 14487 14488 /** 14489 * Internal dependencies 14490 */ 14491 14492 14493 14494 14495 // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000) 14496 14497 const panel_color_gradient_settings_colorIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(%s: color %s)'); // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000) 14498 14499 14500 const panel_color_gradient_settings_gradientIndicatorAriaLabel = Object(external_wp_i18n_["__"])('(%s: gradient %s)'); 14501 14502 const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients']; 14503 14504 const Indicators = ({ 14505 colors, 14506 gradients, 14507 settings 14508 }) => { 14509 return settings.map(({ 14510 colorValue, 14511 gradientValue, 14512 label, 14513 colors: availableColors, 14514 gradients: availableGradients 14515 }, index) => { 14516 if (!colorValue && !gradientValue) { 14517 return null; 14518 } 14519 14520 let ariaLabel; 14521 14522 if (colorValue) { 14523 const colorObject = getColorObjectByColorValue(availableColors || colors, colorValue); 14524 ariaLabel = Object(external_wp_i18n_["sprintf"])(panel_color_gradient_settings_colorIndicatorAriaLabel, label.toLowerCase(), colorObject && colorObject.name || colorValue); 14525 } else { 14526 const gradientObject = __experimentalGetGradientObjectByGradientValue(availableGradients || gradients, colorValue); 14527 14528 ariaLabel = Object(external_wp_i18n_["sprintf"])(panel_color_gradient_settings_gradientIndicatorAriaLabel, label.toLowerCase(), gradientObject && gradientObject.name || gradientValue); 14529 } 14530 14531 return Object(external_wp_element_["createElement"])(external_wp_components_["ColorIndicator"], { 14532 key: index, 14533 colorValue: colorValue || gradientValue, 14534 "aria-label": ariaLabel 14535 }); 14536 }); 14537 }; 14538 14539 const PanelColorGradientSettingsInner = ({ 14540 className, 14541 colors, 14542 gradients, 14543 disableCustomColors, 14544 disableCustomGradients, 14545 children, 14546 settings, 14547 title, 14548 ...props 14549 }) => { 14550 if (Object(external_lodash_["isEmpty"])(colors) && Object(external_lodash_["isEmpty"])(gradients) && disableCustomColors && disableCustomGradients && Object(external_lodash_["every"])(settings, setting => Object(external_lodash_["isEmpty"])(setting.colors) && Object(external_lodash_["isEmpty"])(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) { 14551 return null; 14552 } 14553 14554 const titleElement = Object(external_wp_element_["createElement"])("span", { 14555 className: "block-editor-panel-color-gradient-settings__panel-title" 14556 }, title, Object(external_wp_element_["createElement"])(Indicators, { 14557 colors: colors, 14558 gradients: gradients, 14559 settings: settings 14560 })); 14561 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], Object(esm_extends["a" /* default */])({ 14562 className: classnames_default()('block-editor-panel-color-gradient-settings', className), 14563 title: titleElement 14564 }, props), settings.map((setting, index) => Object(external_wp_element_["createElement"])(control, Object(esm_extends["a" /* default */])({ 14565 key: index, 14566 colors, 14567 gradients, 14568 disableCustomColors, 14569 disableCustomGradients 14570 }, setting))), children); 14571 }; 14572 14573 const PanelColorGradientSettingsSelect = props => { 14574 const colorGradientSettings = {}; 14575 colorGradientSettings.colors = useSetting('color.palette'); 14576 colorGradientSettings.gradients = useSetting('color.gradients'); 14577 colorGradientSettings.disableCustomColors = !useSetting('color.custom'); 14578 colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient'); 14579 return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsInner, Object(esm_extends["a" /* default */])({}, colorGradientSettings, props)); 14580 }; 14581 14582 const PanelColorGradientSettings = props => { 14583 if (Object(external_lodash_["every"])(panel_color_gradient_settings_colorsAndGradientKeys, key => props.hasOwnProperty(key))) { 14584 return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsInner, props); 14585 } 14586 14587 return Object(external_wp_element_["createElement"])(PanelColorGradientSettingsSelect, props); 14588 }; 14589 14590 /* harmony default export */ var panel_color_gradient_settings = (PanelColorGradientSettings); 14591 14592 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js 14593 14594 14595 /** 14596 * External dependencies 14597 */ 14598 14599 /** 14600 * WordPress dependencies 14601 */ 14602 14603 14604 14605 14606 14607 14608 function ContrastCheckerMessage({ 14609 tinyBackgroundColor, 14610 tinyTextColor, 14611 backgroundColor, 14612 textColor 14613 }) { 14614 const msg = tinyBackgroundColor.getBrightness() < tinyTextColor.getBrightness() ? Object(external_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : Object(external_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage` 14615 // prop, but the contrast checker requires granular control over when the 14616 // announcements are made. Notably, the message will be re-announced if a 14617 // new color combination is selected and the contrast is still insufficient. 14618 14619 Object(external_wp_element_["useEffect"])(() => { 14620 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('This color combination may be hard for people to read.')); 14621 }, [backgroundColor, textColor]); 14622 return Object(external_wp_element_["createElement"])("div", { 14623 className: "block-editor-contrast-checker" 14624 }, Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { 14625 spokenMessage: null, 14626 status: "warning", 14627 isDismissible: false 14628 }, msg)); 14629 } 14630 14631 function ContrastChecker({ 14632 backgroundColor, 14633 fallbackBackgroundColor, 14634 fallbackTextColor, 14635 fontSize, 14636 // font size value in pixels 14637 isLargeText, 14638 textColor 14639 }) { 14640 if (!(backgroundColor || fallbackBackgroundColor) || !(textColor || fallbackTextColor)) { 14641 return null; 14642 } 14643 14644 const tinyBackgroundColor = tinycolor_default()(backgroundColor || fallbackBackgroundColor); 14645 const tinyTextColor = tinycolor_default()(textColor || fallbackTextColor); 14646 const hasTransparency = tinyBackgroundColor.getAlpha() !== 1 || tinyTextColor.getAlpha() !== 1; 14647 14648 if (hasTransparency || tinycolor_default.a.isReadable(tinyBackgroundColor, tinyTextColor, { 14649 level: 'AA', 14650 size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small' 14651 })) { 14652 return null; 14653 } 14654 14655 return Object(external_wp_element_["createElement"])(ContrastCheckerMessage, { 14656 backgroundColor: backgroundColor, 14657 textColor: textColor, 14658 tinyBackgroundColor: tinyBackgroundColor, 14659 tinyTextColor: tinyTextColor 14660 }); 14661 } 14662 14663 /* harmony default export */ var contrast_checker = (ContrastChecker); 14664 14665 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/block-refs-provider.js 14666 14667 14668 /** 14669 * WordPress dependencies 14670 */ 14671 14672 const BlockRefs = Object(external_wp_element_["createContext"])(); 14673 function BlockRefsProvider({ 14674 children 14675 }) { 14676 const value = Object(external_wp_element_["useMemo"])(() => ({ 14677 refs: new Map(), 14678 callbacks: new Map() 14679 }), []); 14680 return Object(external_wp_element_["createElement"])(BlockRefs.Provider, { 14681 value: value 14682 }, children); 14683 } 14684 14685 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js 14686 /** 14687 * WordPress dependencies 14688 */ 14689 14690 14691 /** 14692 * Internal dependencies 14693 */ 14694 14695 14696 /** @typedef {import('@wordpress/element').RefCallback} RefCallback */ 14697 14698 /** @typedef {import('@wordpress/element').RefObject} RefObject */ 14699 14700 /** 14701 * Provides a ref to the BlockRefs context. 14702 * 14703 * @param {string} clientId The client ID of the element ref. 14704 * 14705 * @return {RefCallback} Ref callback. 14706 */ 14707 14708 function useBlockRefProvider(clientId) { 14709 const { 14710 refs, 14711 callbacks 14712 } = Object(external_wp_element_["useContext"])(BlockRefs); 14713 const ref = Object(external_wp_element_["useRef"])(); 14714 Object(external_wp_element_["useLayoutEffect"])(() => { 14715 refs.set(ref, clientId); 14716 return () => { 14717 refs.delete(ref); 14718 }; 14719 }, [clientId]); 14720 return Object(external_wp_compose_["useRefEffect"])(element => { 14721 // Update the ref in the provider. 14722 ref.current = element; // Call any update functions. 14723 14724 callbacks.forEach((id, setElement) => { 14725 if (clientId === id) { 14726 setElement(element); 14727 } 14728 }); 14729 }, [clientId]); 14730 } 14731 /** 14732 * Gets a ref pointing to the current block element. Continues to return a 14733 * stable ref even if the block client ID changes. 14734 * 14735 * @param {string} clientId The client ID to get a ref for. 14736 * 14737 * @return {RefObject} A ref containing the element. 14738 */ 14739 14740 function useBlockRef(clientId) { 14741 const { 14742 refs 14743 } = Object(external_wp_element_["useContext"])(BlockRefs); 14744 const freshClientId = Object(external_wp_element_["useRef"])(); 14745 freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so 14746 // that `current` works at a later point. 14747 14748 return Object(external_wp_element_["useMemo"])(() => ({ 14749 get current() { 14750 let element = null; // Multiple refs may be created for a single block. Find the 14751 // first that has an element set. 14752 14753 for (const [ref, id] of refs.entries()) { 14754 if (id === freshClientId.current && ref.current) { 14755 element = ref.current; 14756 } 14757 } 14758 14759 return element; 14760 } 14761 14762 }), []); 14763 } 14764 /** 14765 * Return the element for a given client ID. Updates whenever the element 14766 * changes, becomes available, or disappears. 14767 * 14768 * @param {string} clientId The client ID to an element for. 14769 * 14770 * @return {Element|null} The block's wrapper element. 14771 */ 14772 14773 14774 function useBlockElement(clientId) { 14775 const { 14776 callbacks 14777 } = Object(external_wp_element_["useContext"])(BlockRefs); 14778 const ref = useBlockRef(clientId); 14779 const [element, setElement] = Object(external_wp_element_["useState"])(null); 14780 Object(external_wp_element_["useLayoutEffect"])(() => { 14781 if (!clientId) { 14782 return; 14783 } 14784 14785 callbacks.set(setElement, clientId); 14786 return () => { 14787 callbacks.delete(setElement); 14788 }; 14789 }, [clientId]); 14790 return ref.current || element; 14791 } 14792 14793 14794 14795 14796 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color-panel.js 14797 14798 14799 /** 14800 * WordPress dependencies 14801 */ 14802 14803 14804 /** 14805 * Internal dependencies 14806 */ 14807 14808 14809 14810 14811 14812 14813 function getComputedStyle(node) { 14814 return node.ownerDocument.defaultView.getComputedStyle(node); 14815 } 14816 14817 function ColorPanel({ 14818 settings, 14819 clientId, 14820 enableContrastChecking = true 14821 }) { 14822 const [detectedBackgroundColor, setDetectedBackgroundColor] = Object(external_wp_element_["useState"])(); 14823 const [detectedColor, setDetectedColor] = Object(external_wp_element_["useState"])(); 14824 const ref = useBlockRef(clientId); 14825 Object(external_wp_element_["useEffect"])(() => { 14826 if (!enableContrastChecking) { 14827 return; 14828 } 14829 14830 if (!ref.current) { 14831 return; 14832 } 14833 14834 setDetectedColor(getComputedStyle(ref.current).color); 14835 let backgroundColorNode = ref.current; 14836 let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; 14837 14838 while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { 14839 backgroundColorNode = backgroundColorNode.parentNode; 14840 backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; 14841 } 14842 14843 setDetectedBackgroundColor(backgroundColor); 14844 }); 14845 return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(panel_color_gradient_settings, { 14846 title: Object(external_wp_i18n_["__"])('Color'), 14847 initialOpen: false, 14848 settings: settings 14849 }, enableContrastChecking && Object(external_wp_element_["createElement"])(contrast_checker, { 14850 backgroundColor: detectedBackgroundColor, 14851 textColor: detectedColor 14852 }))); 14853 } 14854 14855 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color.js 14856 14857 14858 14859 /** 14860 * External dependencies 14861 */ 14862 14863 14864 /** 14865 * WordPress dependencies 14866 */ 14867 14868 14869 14870 14871 14872 14873 /** 14874 * Internal dependencies 14875 */ 14876 14877 14878 14879 14880 14881 14882 const COLOR_SUPPORT_KEY = 'color'; 14883 const color_EMPTY_ARRAY = []; 14884 14885 const hasColorSupport = blockType => { 14886 const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); 14887 return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false); 14888 }; 14889 14890 const color_shouldSkipSerialization = blockType => { 14891 const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); 14892 return colorSupport === null || colorSupport === void 0 ? void 0 : colorSupport.__experimentalSkipSerialization; 14893 }; 14894 14895 const hasLinkColorSupport = blockType => { 14896 if (external_wp_element_["Platform"].OS !== 'web') { 14897 return false; 14898 } 14899 14900 const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); 14901 return Object(external_lodash_["isObject"])(colorSupport) && !!colorSupport.link; 14902 }; 14903 14904 const hasGradientSupport = blockType => { 14905 if (external_wp_element_["Platform"].OS !== 'web') { 14906 return false; 14907 } 14908 14909 const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); 14910 return Object(external_lodash_["isObject"])(colorSupport) && !!colorSupport.gradients; 14911 }; 14912 14913 const hasBackgroundColorSupport = blockType => { 14914 const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); 14915 return colorSupport && colorSupport.background !== false; 14916 }; 14917 14918 const hasTextColorSupport = blockType => { 14919 const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY); 14920 return colorSupport && colorSupport.text !== false; 14921 }; 14922 /** 14923 * Filters registered block settings, extending attributes to include 14924 * `backgroundColor` and `textColor` attribute. 14925 * 14926 * @param {Object} settings Original block settings 14927 * @return {Object} Filtered block settings 14928 */ 14929 14930 14931 function color_addAttributes(settings) { 14932 if (!hasColorSupport(settings)) { 14933 return settings; 14934 } // allow blocks to specify their own attribute definition with default values if needed. 14935 14936 14937 if (!settings.attributes.backgroundColor) { 14938 Object.assign(settings.attributes, { 14939 backgroundColor: { 14940 type: 'string' 14941 } 14942 }); 14943 } 14944 14945 if (!settings.attributes.textColor) { 14946 Object.assign(settings.attributes, { 14947 textColor: { 14948 type: 'string' 14949 } 14950 }); 14951 } 14952 14953 if (hasGradientSupport(settings) && !settings.attributes.gradient) { 14954 Object.assign(settings.attributes, { 14955 gradient: { 14956 type: 'string' 14957 } 14958 }); 14959 } 14960 14961 return settings; 14962 } 14963 /** 14964 * Override props assigned to save component to inject colors classnames. 14965 * 14966 * @param {Object} props Additional props applied to save element 14967 * @param {Object} blockType Block type 14968 * @param {Object} attributes Block attributes 14969 * @return {Object} Filtered props applied to save element 14970 */ 14971 14972 14973 function color_addSaveProps(props, blockType, attributes) { 14974 var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link; 14975 14976 if (!hasColorSupport(blockType) || color_shouldSkipSerialization(blockType)) { 14977 return props; 14978 } 14979 14980 const hasGradient = hasGradientSupport(blockType); // I'd have prefered to avoid the "style" attribute usage here 14981 14982 const { 14983 backgroundColor, 14984 textColor, 14985 gradient, 14986 style 14987 } = attributes; 14988 const backgroundClass = getColorClassName('background-color', backgroundColor); 14989 14990 const gradientClass = __experimentalGetGradientClass(gradient); 14991 14992 const textClass = getColorClassName('color', textColor); 14993 const newClassName = classnames_default()(props.className, textClass, gradientClass, { 14994 // Don't apply the background class if there's a custom gradient 14995 [backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.gradient)) && !!backgroundClass, 14996 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text), 14997 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient)), 14998 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color 14999 }); 15000 props.className = newClassName ? newClassName : undefined; 15001 return props; 15002 } 15003 /** 15004 * Filters registered block settings to extand the block edit wrapper 15005 * to apply the desired styles and classnames properly. 15006 * 15007 * @param {Object} settings Original block settings 15008 * @return {Object} Filtered block settings 15009 */ 15010 15011 function color_addEditProps(settings) { 15012 if (!hasColorSupport(settings) || color_shouldSkipSerialization(settings)) { 15013 return settings; 15014 } 15015 15016 const existingGetEditWrapperProps = settings.getEditWrapperProps; 15017 15018 settings.getEditWrapperProps = attributes => { 15019 let props = {}; 15020 15021 if (existingGetEditWrapperProps) { 15022 props = existingGetEditWrapperProps(attributes); 15023 } 15024 15025 return color_addSaveProps(props, settings, attributes); 15026 }; 15027 15028 return settings; 15029 } 15030 15031 const getLinkColorFromAttributeValue = (colors, value) => { 15032 const attributeParsed = /var:preset\|color\|(.+)/.exec(value); 15033 15034 if (attributeParsed && attributeParsed[1]) { 15035 return getColorObjectByAttributeValues(colors, attributeParsed[1]).color; 15036 } 15037 15038 return value; 15039 }; 15040 15041 function immutableSet(object, path, value) { 15042 return Object(external_lodash_["setWith"])(object ? Object(external_lodash_["clone"])(object) : {}, path, value, external_lodash_["clone"]); 15043 } 15044 /** 15045 * Inspector control panel containing the color related configuration 15046 * 15047 * @param {Object} props 15048 * 15049 * @return {WPElement} Color edit element. 15050 */ 15051 15052 15053 function ColorEdit(props) { 15054 var _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2; 15055 15056 const { 15057 name: blockName, 15058 attributes 15059 } = props; 15060 const solids = useSetting('color.palette') || color_EMPTY_ARRAY; 15061 const gradients = useSetting('color.gradients') || color_EMPTY_ARRAY; 15062 const areCustomSolidsEnabled = useSetting('color.custom'); 15063 const areCustomGradientsEnabled = useSetting('color.customGradient'); 15064 const isLinkEnabled = useSetting('color.link'); // Shouldn't be needed but right now the ColorGradientsPanel 15065 // can trigger both onChangeColor and onChangeBackground 15066 // synchronously causing our two callbacks to override changes 15067 // from each other. 15068 15069 const localAttributes = Object(external_wp_element_["useRef"])(attributes); 15070 Object(external_wp_element_["useEffect"])(() => { 15071 localAttributes.current = attributes; 15072 }, [attributes]); 15073 15074 if (!hasColorSupport(blockName) || external_wp_element_["Platform"].OS !== 'web') { 15075 return null; 15076 } 15077 15078 const hasLinkColor = hasLinkColorSupport(blockName) && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled); 15079 const hasTextColor = hasTextColorSupport(blockName) && (solids.length > 0 || areCustomSolidsEnabled); 15080 const hasBackgroundColor = hasBackgroundColorSupport(blockName) && (solids.length > 0 || areCustomSolidsEnabled); 15081 const hasGradientColor = hasGradientSupport(blockName) && (gradients.length > 0 || areCustomGradientsEnabled); 15082 15083 if (!hasLinkColor && !hasTextColor && !hasBackgroundColor && !hasGradientColor) { 15084 return null; 15085 } 15086 15087 const { 15088 style, 15089 textColor, 15090 backgroundColor, 15091 gradient 15092 } = attributes; 15093 let gradientValue; 15094 15095 if (hasGradientColor && gradient) { 15096 gradientValue = getGradientValueBySlug(gradients, gradient); 15097 } else if (hasGradientColor) { 15098 var _style$color5; 15099 15100 gradientValue = style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.gradient; 15101 } 15102 15103 const onChangeColor = name => value => { 15104 var _localAttributes$curr, _localAttributes$curr2; 15105 15106 const colorObject = getColorObjectByColorValue(solids, value); 15107 const attributeName = name + 'Color'; 15108 const newStyle = { ...localAttributes.current.style, 15109 color: { ...((_localAttributes$curr = localAttributes.current) === null || _localAttributes$curr === void 0 ? void 0 : (_localAttributes$curr2 = _localAttributes$curr.style) === null || _localAttributes$curr2 === void 0 ? void 0 : _localAttributes$curr2.color), 15110 [name]: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value 15111 } 15112 }; 15113 const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined; 15114 const newAttributes = { 15115 style: cleanEmptyObject(newStyle), 15116 [attributeName]: newNamedColor 15117 }; 15118 props.setAttributes(newAttributes); 15119 localAttributes.current = { ...localAttributes.current, 15120 ...newAttributes 15121 }; 15122 }; 15123 15124 const onChangeGradient = value => { 15125 const slug = getGradientSlugByValue(gradients, value); 15126 let newAttributes; 15127 15128 if (slug) { 15129 var _localAttributes$curr3, _localAttributes$curr4, _localAttributes$curr5; 15130 15131 const newStyle = { ...((_localAttributes$curr3 = localAttributes.current) === null || _localAttributes$curr3 === void 0 ? void 0 : _localAttributes$curr3.style), 15132 color: { ...((_localAttributes$curr4 = localAttributes.current) === null || _localAttributes$curr4 === void 0 ? void 0 : (_localAttributes$curr5 = _localAttributes$curr4.style) === null || _localAttributes$curr5 === void 0 ? void 0 : _localAttributes$curr5.color), 15133 gradient: undefined 15134 } 15135 }; 15136 newAttributes = { 15137 style: cleanEmptyObject(newStyle), 15138 gradient: slug 15139 }; 15140 } else { 15141 var _localAttributes$curr6, _localAttributes$curr7, _localAttributes$curr8; 15142 15143 const newStyle = { ...((_localAttributes$curr6 = localAttributes.current) === null || _localAttributes$curr6 === void 0 ? void 0 : _localAttributes$curr6.style), 15144 color: { ...((_localAttributes$curr7 = localAttributes.current) === null || _localAttributes$curr7 === void 0 ? void 0 : (_localAttributes$curr8 = _localAttributes$curr7.style) === null || _localAttributes$curr8 === void 0 ? void 0 : _localAttributes$curr8.color), 15145 gradient: value 15146 } 15147 }; 15148 newAttributes = { 15149 style: cleanEmptyObject(newStyle), 15150 gradient: undefined 15151 }; 15152 } 15153 15154 props.setAttributes(newAttributes); 15155 localAttributes.current = { ...localAttributes.current, 15156 ...newAttributes 15157 }; 15158 }; 15159 15160 const onChangeLinkColor = value => { 15161 const colorObject = getColorObjectByColorValue(solids, value); 15162 const newLinkColorValue = colorObject !== null && colorObject !== void 0 && colorObject.slug ? `var:preset|color|${colorObject.slug}` : value; 15163 const newStyle = immutableSet(style, ['elements', 'link', 'color', 'text'], newLinkColorValue); 15164 props.setAttributes({ 15165 style: newStyle 15166 }); 15167 }; 15168 15169 return Object(external_wp_element_["createElement"])(ColorPanel, { 15170 enableContrastChecking: // Turn on contrast checker for web only since it's not supported on mobile yet. 15171 external_wp_element_["Platform"].OS === 'web' && !gradient && !(style !== null && style !== void 0 && (_style$color6 = style.color) !== null && _style$color6 !== void 0 && _style$color6.gradient), 15172 clientId: props.clientId, 15173 settings: [...(hasTextColor ? [{ 15174 label: Object(external_wp_i18n_["__"])('Text color'), 15175 onColorChange: onChangeColor('text'), 15176 colorValue: getColorObjectByAttributeValues(solids, textColor, style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.text).color 15177 }] : []), ...(hasBackgroundColor || hasGradientColor ? [{ 15178 label: Object(external_wp_i18n_["__"])('Background color'), 15179 onColorChange: hasBackgroundColor ? onChangeColor('background') : undefined, 15180 colorValue: getColorObjectByAttributeValues(solids, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.background).color, 15181 gradientValue, 15182 onGradientChange: hasGradientColor ? onChangeGradient : undefined 15183 }] : []), ...(hasLinkColor ? [{ 15184 label: Object(external_wp_i18n_["__"])('Link Color'), 15185 onColorChange: onChangeLinkColor, 15186 colorValue: getLinkColorFromAttributeValue(solids, style === null || style === void 0 ? void 0 : (_style$elements2 = style.elements) === null || _style$elements2 === void 0 ? void 0 : (_style$elements2$link = _style$elements2.link) === null || _style$elements2$link === void 0 ? void 0 : (_style$elements2$link2 = _style$elements2$link.color) === null || _style$elements2$link2 === void 0 ? void 0 : _style$elements2$link2.text), 15187 clearable: !!(style !== null && style !== void 0 && (_style$elements3 = style.elements) !== null && _style$elements3 !== void 0 && (_style$elements3$link = _style$elements3.link) !== null && _style$elements3$link !== void 0 && (_style$elements3$link2 = _style$elements3$link.color) !== null && _style$elements3$link2 !== void 0 && _style$elements3$link2.text) 15188 }] : [])] 15189 }); 15190 } 15191 /** 15192 * This adds inline styles for color palette colors. 15193 * Ideally, this is not needed and themes should load their palettes on the editor. 15194 * 15195 * @param {Function} BlockListBlock Original component 15196 * @return {Function} Wrapped component 15197 */ 15198 15199 const withColorPaletteStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 15200 var _getColorObjectByAttr, _getColorObjectByAttr2, _props$wrapperProps; 15201 15202 const { 15203 name, 15204 attributes 15205 } = props; 15206 const { 15207 backgroundColor, 15208 textColor 15209 } = attributes; 15210 const colors = useSetting('color.palette') || color_EMPTY_ARRAY; 15211 15212 if (!hasColorSupport(name) || color_shouldSkipSerialization(name)) { 15213 return Object(external_wp_element_["createElement"])(BlockListBlock, props); 15214 } 15215 15216 const extraStyles = { 15217 color: textColor ? (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color : undefined, 15218 backgroundColor: backgroundColor ? (_getColorObjectByAttr2 = getColorObjectByAttributeValues(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color : undefined 15219 }; 15220 let wrapperProps = props.wrapperProps; 15221 wrapperProps = { ...props.wrapperProps, 15222 style: { ...extraStyles, 15223 ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style) 15224 } 15225 }; 15226 return Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { 15227 wrapperProps: wrapperProps 15228 })); 15229 }); 15230 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/color/addAttribute', color_addAttributes); 15231 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/color/addSaveProps', color_addSaveProps); 15232 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/color/addEditProps', color_addEditProps); 15233 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/color/with-color-palette-styles', withColorPaletteStyles); 15234 15235 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-underline.js 15236 15237 15238 /** 15239 * WordPress dependencies 15240 */ 15241 15242 const formatUnderline = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 15243 xmlns: "http://www.w3.org/2000/svg", 15244 viewBox: "0 0 24 24" 15245 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 15246 d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z" 15247 })); 15248 /* harmony default export */ var format_underline = (formatUnderline); 15249 15250 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js 15251 var format_strikethrough = __webpack_require__("Crq9"); 15252 15253 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js 15254 15255 15256 /** 15257 * WordPress dependencies 15258 */ 15259 15260 15261 15262 const TEXT_DECORATIONS = [{ 15263 name: Object(external_wp_i18n_["__"])('Underline'), 15264 value: 'underline', 15265 icon: format_underline 15266 }, { 15267 name: Object(external_wp_i18n_["__"])('Strikethrough'), 15268 value: 'line-through', 15269 icon: format_strikethrough["a" /* default */] 15270 }]; 15271 /** 15272 * Control to facilitate text decoration selections. 15273 * 15274 * @param {Object} props Component props. 15275 * @param {string} props.value Currently selected text decoration. 15276 * @param {Function} props.onChange Handles change in text decoration selection. 15277 * @return {WPElement} Text decoration control. 15278 */ 15279 15280 function TextDecorationControl({ 15281 value, 15282 onChange 15283 }) { 15284 return Object(external_wp_element_["createElement"])("fieldset", { 15285 className: "block-editor-text-decoration-control" 15286 }, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_i18n_["__"])('Decoration')), Object(external_wp_element_["createElement"])("div", { 15287 className: "block-editor-text-decoration-control__buttons" 15288 }, TEXT_DECORATIONS.map(textDecoration => { 15289 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 15290 key: textDecoration.value, 15291 icon: textDecoration.icon, 15292 isSmall: true, 15293 isPressed: textDecoration.value === value, 15294 onClick: () => onChange(textDecoration.value === value ? undefined : textDecoration.value), 15295 "aria-label": textDecoration.name 15296 }); 15297 }))); 15298 } 15299 15300 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-decoration.js 15301 15302 15303 /** 15304 * WordPress dependencies 15305 */ 15306 15307 /** 15308 * Internal dependencies 15309 */ 15310 15311 15312 15313 15314 /** 15315 * Key within block settings' supports array indicating support for text 15316 * decorations e.g. settings found in `block.json`. 15317 */ 15318 15319 const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration'; 15320 /** 15321 * Inspector control panel containing the text decoration options. 15322 * 15323 * @param {Object} props Block properties. 15324 * @return {WPElement} Text decoration edit element. 15325 */ 15326 15327 function TextDecorationEdit(props) { 15328 var _style$typography; 15329 15330 const { 15331 attributes: { 15332 style 15333 }, 15334 setAttributes 15335 } = props; 15336 const isDisabled = useIsTextDecorationDisabled(props); 15337 15338 if (isDisabled) { 15339 return null; 15340 } 15341 15342 function onChange(newDecoration) { 15343 setAttributes({ 15344 style: cleanEmptyObject({ ...style, 15345 typography: { ...(style === null || style === void 0 ? void 0 : style.typography), 15346 textDecoration: newDecoration 15347 } 15348 }) 15349 }); 15350 } 15351 15352 return Object(external_wp_element_["createElement"])(TextDecorationControl, { 15353 value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textDecoration, 15354 onChange: onChange 15355 }); 15356 } 15357 /** 15358 * Checks if text-decoration settings have been disabled. 15359 * 15360 * @param {string} name Name of the block. 15361 * @return {boolean} Whether or not the setting is disabled. 15362 */ 15363 15364 function useIsTextDecorationDisabled({ 15365 name: blockName 15366 } = {}) { 15367 const notSupported = !Object(external_wp_blocks_["hasBlockSupport"])(blockName, TEXT_DECORATION_SUPPORT_KEY); 15368 const hasTextDecoration = useSetting('typography.customTextDecorations'); 15369 return notSupported || !hasTextDecoration; 15370 } 15371 15372 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js 15373 15374 15375 /** 15376 * WordPress dependencies 15377 */ 15378 15379 const formatUppercase = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 15380 xmlns: "http://www.w3.org/2000/svg", 15381 viewBox: "0 0 24 24" 15382 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 15383 d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z" 15384 })); 15385 /* harmony default export */ var format_uppercase = (formatUppercase); 15386 15387 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js 15388 15389 15390 /** 15391 * WordPress dependencies 15392 */ 15393 15394 const formatLowercase = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 15395 xmlns: "http://www.w3.org/2000/svg", 15396 viewBox: "0 0 24 24" 15397 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 15398 d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z" 15399 })); 15400 /* harmony default export */ var format_lowercase = (formatLowercase); 15401 15402 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js 15403 15404 15405 /** 15406 * WordPress dependencies 15407 */ 15408 15409 const formatCapitalize = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 15410 xmlns: "http://www.w3.org/2000/svg", 15411 viewBox: "0 0 24 24" 15412 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 15413 d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z" 15414 })); 15415 /* harmony default export */ var format_capitalize = (formatCapitalize); 15416 15417 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js 15418 15419 15420 /** 15421 * WordPress dependencies 15422 */ 15423 15424 15425 15426 const TEXT_TRANSFORMS = [{ 15427 name: Object(external_wp_i18n_["__"])('Uppercase'), 15428 value: 'uppercase', 15429 icon: format_uppercase 15430 }, { 15431 name: Object(external_wp_i18n_["__"])('Lowercase'), 15432 value: 'lowercase', 15433 icon: format_lowercase 15434 }, { 15435 name: Object(external_wp_i18n_["__"])('Capitalize'), 15436 value: 'capitalize', 15437 icon: format_capitalize 15438 }]; 15439 /** 15440 * Control to facilitate text transform selections. 15441 * 15442 * @param {Object} props Component props. 15443 * @param {string} props.value Currently selected text transform. 15444 * @param {Function} props.onChange Handles change in text transform selection. 15445 * @return {WPElement} Text transform control. 15446 */ 15447 15448 function TextTransformControl({ 15449 value, 15450 onChange 15451 }) { 15452 return Object(external_wp_element_["createElement"])("fieldset", { 15453 className: "block-editor-text-transform-control" 15454 }, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_i18n_["__"])('Letter case')), Object(external_wp_element_["createElement"])("div", { 15455 className: "block-editor-text-transform-control__buttons" 15456 }, TEXT_TRANSFORMS.map(textTransform => { 15457 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 15458 key: textTransform.value, 15459 icon: textTransform.icon, 15460 isSmall: true, 15461 isPressed: value === textTransform.value, 15462 "aria-label": textTransform.name, 15463 onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value) 15464 }); 15465 }))); 15466 } 15467 15468 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/text-transform.js 15469 15470 15471 /** 15472 * WordPress dependencies 15473 */ 15474 15475 /** 15476 * Internal dependencies 15477 */ 15478 15479 15480 15481 15482 /** 15483 * Key within block settings' supports array indicating support for text 15484 * transforms e.g. settings found in `block.json`. 15485 */ 15486 15487 const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; 15488 /** 15489 * Inspector control panel containing the text transform options. 15490 * 15491 * @param {Object} props Block properties. 15492 * @return {WPElement} Text transform edit element. 15493 */ 15494 15495 function TextTransformEdit(props) { 15496 var _style$typography; 15497 15498 const { 15499 attributes: { 15500 style 15501 }, 15502 setAttributes 15503 } = props; 15504 const isDisabled = useIsTextTransformDisabled(props); 15505 15506 if (isDisabled) { 15507 return null; 15508 } 15509 15510 function onChange(newTransform) { 15511 setAttributes({ 15512 style: cleanEmptyObject({ ...style, 15513 typography: { ...(style === null || style === void 0 ? void 0 : style.typography), 15514 textTransform: newTransform 15515 } 15516 }) 15517 }); 15518 } 15519 15520 return Object(external_wp_element_["createElement"])(TextTransformControl, { 15521 value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform, 15522 onChange: onChange 15523 }); 15524 } 15525 /** 15526 * Checks if text-transform settings have been disabled. 15527 * 15528 * @param {string} name Name of the block. 15529 * @return {boolean} Whether or not the setting is disabled. 15530 */ 15531 15532 function useIsTextTransformDisabled({ 15533 name: blockName 15534 } = {}) { 15535 const notSupported = !Object(external_wp_blocks_["hasBlockSupport"])(blockName, TEXT_TRANSFORM_SUPPORT_KEY); 15536 const hasTextTransforms = useSetting('typography.customTextTransforms'); 15537 return notSupported || !hasTextTransforms; 15538 } 15539 15540 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-and-transform/index.js 15541 15542 15543 /** 15544 * Internal dependencies 15545 */ 15546 15547 15548 /** 15549 * Handles grouping related text decoration and text transform edit components 15550 * so they can be laid out in a more flexible manner within the Typography 15551 * InspectorControls panel. 15552 * 15553 * @param {Object} props Block props to be passed on to individual controls. 15554 * @return {WPElement} Component containing text decoration or transform controls. 15555 */ 15556 15557 function TextDecorationAndTransformEdit(props) { 15558 const decorationAvailable = !useIsTextDecorationDisabled(props); 15559 const transformAvailable = !useIsTextTransformDisabled(props); 15560 15561 if (!decorationAvailable && !transformAvailable) { 15562 return null; 15563 } 15564 15565 return Object(external_wp_element_["createElement"])("div", { 15566 className: "block-editor-text-decoration-and-transform" 15567 }, decorationAvailable && Object(external_wp_element_["createElement"])(TextDecorationEdit, props), transformAvailable && Object(external_wp_element_["createElement"])(TextTransformEdit, props)); 15568 } 15569 15570 // EXTERNAL MODULE: external ["wp","keycodes"] 15571 var external_wp_keycodes_ = __webpack_require__("RxS6"); 15572 15573 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js 15574 const BASE_DEFAULT_VALUE = 1.5; 15575 const STEP = 0.1; 15576 /** 15577 * There are varying value types within LineHeightControl: 15578 * 15579 * {undefined} Initial value. No changes from the user. 15580 * {string} Input value. Value consumed/outputted by the input. Empty would be ''. 15581 * {number} Block attribute type. Input value needs to be converted for attribute setting. 15582 * 15583 * Note: If the value is undefined, the input requires it to be an empty string ('') 15584 * in order to be considered "controlled" by props (rather than internal state). 15585 */ 15586 15587 const RESET_VALUE = ''; 15588 /** 15589 * Determines if the lineHeight attribute has been properly defined. 15590 * 15591 * @param {any} lineHeight The value to check. 15592 * 15593 * @return {boolean} Whether the lineHeight attribute is valid. 15594 */ 15595 15596 function isLineHeightDefined(lineHeight) { 15597 return lineHeight !== undefined && lineHeight !== RESET_VALUE; 15598 } 15599 15600 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/index.js 15601 15602 15603 /** 15604 * WordPress dependencies 15605 */ 15606 15607 15608 15609 /** 15610 * Internal dependencies 15611 */ 15612 15613 15614 function LineHeightControl({ 15615 value: lineHeight, 15616 onChange 15617 }) { 15618 const isDefined = isLineHeightDefined(lineHeight); 15619 15620 const handleOnKeyDown = event => { 15621 const { 15622 keyCode 15623 } = event; 15624 15625 if (keyCode === external_wp_keycodes_["ZERO"] && !isDefined) { 15626 /** 15627 * Prevents the onChange callback from firing, which prevents 15628 * the logic from assuming the change was triggered from 15629 * an input arrow CLICK. 15630 */ 15631 event.preventDefault(); 15632 onChange('0'); 15633 } 15634 }; 15635 15636 const handleOnChange = nextValue => { 15637 // Set the next value without modification if lineHeight has been defined 15638 if (isDefined) { 15639 onChange(nextValue); 15640 return; 15641 } // Otherwise... 15642 15643 /** 15644 * The following logic handles the initial up/down arrow CLICK of the 15645 * input element. This is so that the next values (from an undefined value state) 15646 * are more better suited for line-height rendering. 15647 */ 15648 15649 15650 let adjustedNextValue = nextValue; 15651 15652 switch (nextValue) { 15653 case `${STEP}`: 15654 // Increment by step value 15655 adjustedNextValue = BASE_DEFAULT_VALUE + STEP; 15656 break; 15657 15658 case '0': 15659 // Decrement by step value 15660 adjustedNextValue = BASE_DEFAULT_VALUE - STEP; 15661 break; 15662 } 15663 15664 onChange(adjustedNextValue); 15665 }; 15666 15667 const value = isDefined ? lineHeight : RESET_VALUE; 15668 return Object(external_wp_element_["createElement"])("div", { 15669 className: "block-editor-line-height-control" 15670 }, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 15671 autoComplete: "off", 15672 onKeyDown: handleOnKeyDown, 15673 onChange: handleOnChange, 15674 label: Object(external_wp_i18n_["__"])('Line height'), 15675 placeholder: BASE_DEFAULT_VALUE, 15676 step: STEP, 15677 type: "number", 15678 value: value, 15679 min: 0 15680 })); 15681 } 15682 15683 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/line-height.js 15684 15685 15686 /** 15687 * WordPress dependencies 15688 */ 15689 15690 /** 15691 * Internal dependencies 15692 */ 15693 15694 15695 15696 15697 const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight'; 15698 /** 15699 * Inspector control panel containing the line height related configuration 15700 * 15701 * @param {Object} props 15702 * 15703 * @return {WPElement} Line height edit element. 15704 */ 15705 15706 function LineHeightEdit(props) { 15707 var _style$typography; 15708 15709 const { 15710 attributes: { 15711 style 15712 } 15713 } = props; 15714 const isDisabled = useIsLineHeightDisabled(props); 15715 15716 if (isDisabled) { 15717 return null; 15718 } 15719 15720 const onChange = newLineHeightValue => { 15721 const newStyle = { ...style, 15722 typography: { ...(style === null || style === void 0 ? void 0 : style.typography), 15723 lineHeight: newLineHeightValue 15724 } 15725 }; 15726 props.setAttributes({ 15727 style: cleanEmptyObject(newStyle) 15728 }); 15729 }; 15730 15731 return Object(external_wp_element_["createElement"])(LineHeightControl, { 15732 value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.lineHeight, 15733 onChange: onChange 15734 }); 15735 } 15736 /** 15737 * Custom hook that checks if line-height settings have been disabled. 15738 * 15739 * @param {string} name The name of the block. 15740 * @return {boolean} Whether setting is disabled. 15741 */ 15742 15743 function useIsLineHeightDisabled({ 15744 name: blockName 15745 } = {}) { 15746 const isDisabled = !useSetting('typography.customLineHeight'); 15747 return !Object(external_wp_blocks_["hasBlockSupport"])(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled; 15748 } 15749 15750 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js 15751 15752 15753 /** 15754 * WordPress dependencies 15755 */ 15756 15757 15758 15759 const FONT_STYLES = [{ 15760 name: Object(external_wp_i18n_["__"])('Regular'), 15761 value: 'normal' 15762 }, { 15763 name: Object(external_wp_i18n_["__"])('Italic'), 15764 value: 'italic' 15765 }]; 15766 const FONT_WEIGHTS = [{ 15767 name: Object(external_wp_i18n_["__"])('Thin'), 15768 value: '100' 15769 }, { 15770 name: Object(external_wp_i18n_["__"])('Extra Light'), 15771 value: '200' 15772 }, { 15773 name: Object(external_wp_i18n_["__"])('Light'), 15774 value: '300' 15775 }, { 15776 name: Object(external_wp_i18n_["__"])('Regular'), 15777 value: '400' 15778 }, { 15779 name: Object(external_wp_i18n_["__"])('Medium'), 15780 value: '500' 15781 }, { 15782 name: Object(external_wp_i18n_["__"])('Semi Bold'), 15783 value: '600' 15784 }, { 15785 name: Object(external_wp_i18n_["__"])('Bold'), 15786 value: '700' 15787 }, { 15788 name: Object(external_wp_i18n_["__"])('Extra Bold'), 15789 value: '800' 15790 }, { 15791 name: Object(external_wp_i18n_["__"])('Black'), 15792 value: '900' 15793 }]; 15794 /** 15795 * Control to display unified font style and weight options. 15796 * 15797 * @param {Object} props Component props. 15798 * @return {WPElement} Font appearance control. 15799 */ 15800 15801 function FontAppearanceControl(props) { 15802 const { 15803 onChange, 15804 hasFontStyles = true, 15805 hasFontWeights = true, 15806 value: { 15807 fontStyle, 15808 fontWeight 15809 } 15810 } = props; 15811 const hasStylesOrWeights = hasFontStyles || hasFontWeights; 15812 const defaultOption = { 15813 key: 'default', 15814 name: Object(external_wp_i18n_["__"])('Default'), 15815 style: { 15816 fontStyle: undefined, 15817 fontWeight: undefined 15818 } 15819 }; // Combines both font style and weight options into a single dropdown. 15820 15821 const combineOptions = () => { 15822 const combinedOptions = [defaultOption]; 15823 FONT_STYLES.forEach(({ 15824 name: styleName, 15825 value: styleValue 15826 }) => { 15827 FONT_WEIGHTS.forEach(({ 15828 name: weightName, 15829 value: weightValue 15830 }) => { 15831 const optionName = styleValue === 'normal' ? weightName : Object(external_wp_i18n_["sprintf"])( 15832 /* translators: 1: Font weight name. 2: Font style name. */ 15833 Object(external_wp_i18n_["__"])('%1$s %2$s'), weightName, styleName); 15834 combinedOptions.push({ 15835 key: `${styleValue}-${weightValue}`, 15836 name: optionName, 15837 style: { 15838 fontStyle: styleValue, 15839 fontWeight: weightValue 15840 } 15841 }); 15842 }); 15843 }); 15844 return combinedOptions; 15845 }; // Generates select options for font styles only. 15846 15847 15848 const styleOptions = () => { 15849 const combinedOptions = [defaultOption]; 15850 FONT_STYLES.forEach(({ 15851 name, 15852 value 15853 }) => { 15854 combinedOptions.push({ 15855 key: value, 15856 name, 15857 style: { 15858 fontStyle: value, 15859 fontWeight: undefined 15860 } 15861 }); 15862 }); 15863 return combinedOptions; 15864 }; // Generates select options for font weights only. 15865 15866 15867 const weightOptions = () => { 15868 const combinedOptions = [defaultOption]; 15869 FONT_WEIGHTS.forEach(({ 15870 name, 15871 value 15872 }) => { 15873 combinedOptions.push({ 15874 key: value, 15875 name, 15876 style: { 15877 fontStyle: undefined, 15878 fontWeight: value 15879 } 15880 }); 15881 }); 15882 return combinedOptions; 15883 }; // Map font styles and weights to select options. 15884 15885 15886 const selectOptions = Object(external_wp_element_["useMemo"])(() => { 15887 if (hasFontStyles && hasFontWeights) { 15888 return combineOptions(); 15889 } 15890 15891 return hasFontStyles ? styleOptions() : weightOptions(); 15892 }, [props.options]); // Find current selection by comparing font style & weight against options. 15893 15894 const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight); // Adjusts field label in case either styles or weights are disabled. 15895 15896 const getLabel = () => { 15897 if (!hasFontStyles) { 15898 return Object(external_wp_i18n_["__"])('Font weight'); 15899 } 15900 15901 if (!hasFontWeights) { 15902 return Object(external_wp_i18n_["__"])('Font style'); 15903 } 15904 15905 return Object(external_wp_i18n_["__"])('Appearance'); 15906 }; 15907 15908 return Object(external_wp_element_["createElement"])("fieldset", { 15909 className: "components-font-appearance-control" 15910 }, hasStylesOrWeights && Object(external_wp_element_["createElement"])(external_wp_components_["CustomSelectControl"], { 15911 className: "components-font-appearance-control__select", 15912 label: getLabel(), 15913 options: selectOptions, 15914 value: currentSelection, 15915 onChange: ({ 15916 selectedItem 15917 }) => onChange(selectedItem.style) 15918 })); 15919 } 15920 15921 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-appearance.js 15922 15923 15924 /** 15925 * WordPress dependencies 15926 */ 15927 15928 /** 15929 * Internal dependencies 15930 */ 15931 15932 15933 15934 15935 /** 15936 * Key within block settings' support array indicating support for font style. 15937 */ 15938 15939 const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle'; 15940 /** 15941 * Key within block settings' support array indicating support for font weight. 15942 */ 15943 15944 const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight'; 15945 /** 15946 * Inspector control panel containing the font appearance options. 15947 * 15948 * @param {Object} props Block properties. 15949 * @return {WPElement} Font appearance edit element. 15950 */ 15951 15952 function FontAppearanceEdit(props) { 15953 var _style$typography, _style$typography2; 15954 15955 const { 15956 attributes: { 15957 style 15958 }, 15959 setAttributes 15960 } = props; 15961 const hasFontStyles = !useIsFontStyleDisabled(props); 15962 const hasFontWeights = !useIsFontWeightDisabled(props); 15963 15964 if (!hasFontStyles && !hasFontWeights) { 15965 return null; 15966 } 15967 15968 const onChange = newStyles => { 15969 setAttributes({ 15970 style: cleanEmptyObject({ ...style, 15971 typography: { ...(style === null || style === void 0 ? void 0 : style.typography), 15972 fontStyle: newStyles.fontStyle, 15973 fontWeight: newStyles.fontWeight 15974 } 15975 }) 15976 }); 15977 }; 15978 15979 const fontStyle = style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontStyle; 15980 const fontWeight = style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontWeight; 15981 return Object(external_wp_element_["createElement"])(FontAppearanceControl, { 15982 onChange: onChange, 15983 hasFontStyles: hasFontStyles, 15984 hasFontWeights: hasFontWeights, 15985 value: { 15986 fontStyle, 15987 fontWeight 15988 } 15989 }); 15990 } 15991 /** 15992 * Checks if font style support has been disabled either by not opting in for 15993 * support or by failing to provide preset styles. 15994 * 15995 * @param {Object} props Block properties. 15996 * @param {string} props.name Name for the block type. 15997 * @return {boolean} Whether font style support has been disabled. 15998 */ 15999 16000 function useIsFontStyleDisabled({ 16001 name: blockName 16002 } = {}) { 16003 const styleSupport = Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_STYLE_SUPPORT_KEY); 16004 const hasFontStyles = useSetting('typography.customFontStyle'); 16005 return !styleSupport || !hasFontStyles; 16006 } 16007 /** 16008 * Checks if font weight support has been disabled either by not opting in for 16009 * support or by failing to provide preset weights. 16010 * 16011 * @param {Object} props Block properties. 16012 * @param {string} props.name Name for the block type. 16013 * @return {boolean} Whether font weight support has been disabled. 16014 */ 16015 16016 function useIsFontWeightDisabled({ 16017 name: blockName 16018 } = {}) { 16019 const weightSupport = Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_WEIGHT_SUPPORT_KEY); 16020 const hasFontWeights = useSetting('typography.customFontWeight'); 16021 return !weightSupport || !hasFontWeights; 16022 } 16023 /** 16024 * Checks if font appearance support has been disabled. 16025 * 16026 * @param {Object} props Block properties. 16027 * @return {boolean} Whether font appearance support has been disabled. 16028 */ 16029 16030 function useIsFontAppearanceDisabled(props) { 16031 const stylesDisabled = useIsFontStyleDisabled(props); 16032 const weightsDisabled = useIsFontWeightDisabled(props); 16033 return stylesDisabled && weightsDisabled; 16034 } 16035 16036 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js 16037 16038 16039 16040 /** 16041 * External dependencies 16042 */ 16043 16044 /** 16045 * WordPress dependencies 16046 */ 16047 16048 16049 16050 /** 16051 * Internal dependencies 16052 */ 16053 16054 16055 function FontFamilyControl({ 16056 value = '', 16057 onChange, 16058 fontFamilies, 16059 ...props 16060 }) { 16061 const blockLevelFontFamilies = useSetting('typography.fontFamilies'); 16062 16063 if (!fontFamilies) { 16064 fontFamilies = blockLevelFontFamilies; 16065 } 16066 16067 if (Object(external_lodash_["isEmpty"])(fontFamilies)) { 16068 return null; 16069 } 16070 16071 const options = [{ 16072 value: '', 16073 label: Object(external_wp_i18n_["__"])('Default') 16074 }, ...fontFamilies.map(({ 16075 fontFamily, 16076 name 16077 }) => { 16078 return { 16079 value: fontFamily, 16080 label: name || fontFamily 16081 }; 16082 })]; 16083 return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], Object(esm_extends["a" /* default */])({ 16084 label: Object(external_wp_i18n_["__"])('Font family'), 16085 options: options, 16086 value: value, 16087 onChange: onChange, 16088 labelPosition: "top" 16089 }, props)); 16090 } 16091 16092 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-family.js 16093 16094 16095 /** 16096 * External dependencies 16097 */ 16098 16099 /** 16100 * WordPress dependencies 16101 */ 16102 16103 16104 /** 16105 * Internal dependencies 16106 */ 16107 16108 16109 16110 16111 const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily'; 16112 16113 const getFontFamilyFromAttributeValue = (fontFamilies, value) => { 16114 const attributeParsed = /var:preset\|font-family\|(.+)/.exec(value); 16115 16116 if (attributeParsed && attributeParsed[1]) { 16117 const fontFamilyObject = Object(external_lodash_["find"])(fontFamilies, ({ 16118 slug 16119 }) => { 16120 return slug === attributeParsed[1]; 16121 }); 16122 16123 if (fontFamilyObject) { 16124 return fontFamilyObject.fontFamily; 16125 } 16126 } 16127 16128 return value; 16129 }; 16130 16131 function FontFamilyEdit({ 16132 name, 16133 setAttributes, 16134 attributes: { 16135 style = {} 16136 } 16137 }) { 16138 var _style$typography; 16139 16140 const fontFamilies = useSetting('typography.fontFamilies'); 16141 const isDisable = useIsFontFamilyDisabled({ 16142 name 16143 }); 16144 16145 if (isDisable) { 16146 return null; 16147 } 16148 16149 const value = getFontFamilyFromAttributeValue(fontFamilies, (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontFamily); 16150 16151 function onChange(newValue) { 16152 const predefinedFontFamily = Object(external_lodash_["find"])(fontFamilies, ({ 16153 fontFamily 16154 }) => fontFamily === newValue); 16155 setAttributes({ 16156 style: cleanEmptyObject({ ...style, 16157 typography: { ...(style.typography || {}), 16158 fontFamily: predefinedFontFamily ? `var:preset|font-family|${predefinedFontFamily.slug}` : newValue || undefined 16159 } 16160 }) 16161 }); 16162 } 16163 16164 return Object(external_wp_element_["createElement"])(FontFamilyControl, { 16165 className: "block-editor-hooks-font-family-control", 16166 fontFamilies: fontFamilies, 16167 value: value, 16168 onChange: onChange 16169 }); 16170 } 16171 /** 16172 * Custom hook that checks if font-family functionality is disabled. 16173 * 16174 * @param {string} name The name of the block. 16175 * @return {boolean} Whether setting is disabled. 16176 */ 16177 16178 function useIsFontFamilyDisabled({ 16179 name 16180 }) { 16181 const fontFamilies = useSetting('typography.fontFamilies'); 16182 return !fontFamilies || fontFamilies.length === 0 || !Object(external_wp_blocks_["hasBlockSupport"])(name, FONT_FAMILY_SUPPORT_KEY); 16183 } 16184 16185 // EXTERNAL MODULE: external ["wp","tokenList"] 16186 var external_wp_tokenList_ = __webpack_require__("BLeD"); 16187 var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_); 16188 16189 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/utils.js 16190 /** 16191 * External dependencies 16192 */ 16193 16194 /** 16195 * Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values. 16196 * If namedFontSize is undefined or not found in fontSizes an object with just the size value based on customFontSize is returned. 16197 * 16198 * @param {Array} fontSizes Array of font size objects containing at least the "name" and "size" values as properties. 16199 * @param {?string} fontSizeAttribute Content of the font size attribute (slug). 16200 * @param {?number} customFontSizeAttribute Contents of the custom font size attribute (value). 16201 * 16202 * @return {?Object} If fontSizeAttribute is set and an equal slug is found in fontSizes it returns the font size object for that slug. 16203 * Otherwise, an object with just the size value based on customFontSize is returned. 16204 */ 16205 16206 const getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => { 16207 if (fontSizeAttribute) { 16208 const fontSizeObject = Object(external_lodash_["find"])(fontSizes, { 16209 slug: fontSizeAttribute 16210 }); 16211 16212 if (fontSizeObject) { 16213 return fontSizeObject; 16214 } 16215 } 16216 16217 return { 16218 size: customFontSizeAttribute 16219 }; 16220 }; 16221 /** 16222 * Returns the corresponding font size object for a given value. 16223 * 16224 * @param {Array} fontSizes Array of font size objects. 16225 * @param {number} value Font size value. 16226 * 16227 * @return {Object} Font size object. 16228 */ 16229 16230 function getFontSizeObjectByValue(fontSizes, value) { 16231 const fontSizeObject = Object(external_lodash_["find"])(fontSizes, { 16232 size: value 16233 }); 16234 16235 if (fontSizeObject) { 16236 return fontSizeObject; 16237 } 16238 16239 return { 16240 size: value 16241 }; 16242 } 16243 /** 16244 * Returns a class based on fontSizeName. 16245 * 16246 * @param {string} fontSizeSlug Slug of the fontSize. 16247 * 16248 * @return {string} String with the class corresponding to the fontSize passed. 16249 * The class is generated by appending 'has-' followed by fontSizeSlug in kebabCase and ending with '-font-size'. 16250 */ 16251 16252 function getFontSizeClass(fontSizeSlug) { 16253 if (!fontSizeSlug) { 16254 return; 16255 } 16256 16257 return `has-${Object(external_lodash_["kebabCase"])(fontSizeSlug)}-font-size`; 16258 } 16259 16260 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js 16261 16262 16263 16264 /** 16265 * WordPress dependencies 16266 */ 16267 16268 /** 16269 * Internal dependencies 16270 */ 16271 16272 16273 16274 function FontSizePicker(props) { 16275 const fontSizes = useSetting('typography.fontSizes'); 16276 const disableCustomFontSizes = !useSetting('typography.customFontSize'); 16277 return Object(external_wp_element_["createElement"])(external_wp_components_["FontSizePicker"], Object(esm_extends["a" /* default */])({}, props, { 16278 fontSizes: fontSizes, 16279 disableCustomFontSizes: disableCustomFontSizes 16280 })); 16281 } 16282 16283 /* harmony default export */ var font_size_picker = (FontSizePicker); 16284 16285 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/font-size.js 16286 16287 16288 /** 16289 * WordPress dependencies 16290 */ 16291 16292 16293 16294 16295 /** 16296 * Internal dependencies 16297 */ 16298 16299 16300 16301 16302 const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; 16303 /** 16304 * Filters registered block settings, extending attributes to include 16305 * `fontSize` and `fontWeight` attributes. 16306 * 16307 * @param {Object} settings Original block settings 16308 * @return {Object} Filtered block settings 16309 */ 16310 16311 function font_size_addAttributes(settings) { 16312 if (!Object(external_wp_blocks_["hasBlockSupport"])(settings, FONT_SIZE_SUPPORT_KEY)) { 16313 return settings; 16314 } // Allow blocks to specify a default value if needed. 16315 16316 16317 if (!settings.attributes.fontSize) { 16318 Object.assign(settings.attributes, { 16319 fontSize: { 16320 type: 'string' 16321 } 16322 }); 16323 } 16324 16325 return settings; 16326 } 16327 /** 16328 * Override props assigned to save component to inject font size. 16329 * 16330 * @param {Object} props Additional props applied to save element 16331 * @param {Object} blockType Block type 16332 * @param {Object} attributes Block attributes 16333 * @return {Object} Filtered props applied to save element 16334 */ 16335 16336 16337 function font_size_addSaveProps(props, blockType, attributes) { 16338 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, FONT_SIZE_SUPPORT_KEY)) { 16339 return props; 16340 } 16341 16342 if (Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'typography.__experimentalSkipSerialization')) { 16343 return props; 16344 } // Use TokenList to dedupe classes. 16345 16346 16347 const classes = new external_wp_tokenList_default.a(props.className); 16348 classes.add(getFontSizeClass(attributes.fontSize)); 16349 const newClassName = classes.value; 16350 props.className = newClassName ? newClassName : undefined; 16351 return props; 16352 } 16353 /** 16354 * Filters registered block settings to expand the block edit wrapper 16355 * by applying the desired styles and classnames. 16356 * 16357 * @param {Object} settings Original block settings 16358 * @return {Object} Filtered block settings 16359 */ 16360 16361 16362 function font_size_addEditProps(settings) { 16363 if (!Object(external_wp_blocks_["hasBlockSupport"])(settings, FONT_SIZE_SUPPORT_KEY)) { 16364 return settings; 16365 } 16366 16367 const existingGetEditWrapperProps = settings.getEditWrapperProps; 16368 16369 settings.getEditWrapperProps = attributes => { 16370 let props = {}; 16371 16372 if (existingGetEditWrapperProps) { 16373 props = existingGetEditWrapperProps(attributes); 16374 } 16375 16376 return font_size_addSaveProps(props, settings, attributes); 16377 }; 16378 16379 return settings; 16380 } 16381 /** 16382 * Inspector control panel containing the font size related configuration 16383 * 16384 * @param {Object} props 16385 * 16386 * @return {WPElement} Font size edit element. 16387 */ 16388 16389 16390 function FontSizeEdit(props) { 16391 var _style$typography, _style$typography2; 16392 16393 const { 16394 attributes: { 16395 fontSize, 16396 style 16397 }, 16398 setAttributes 16399 } = props; 16400 const isDisabled = useIsFontSizeDisabled(props); 16401 const fontSizes = useSetting('typography.fontSizes'); 16402 16403 const onChange = value => { 16404 const fontSizeSlug = getFontSizeObjectByValue(fontSizes, value).slug; 16405 setAttributes({ 16406 style: cleanEmptyObject({ ...style, 16407 typography: { ...(style === null || style === void 0 ? void 0 : style.typography), 16408 fontSize: fontSizeSlug ? undefined : value 16409 } 16410 }), 16411 fontSize: fontSizeSlug 16412 }); 16413 }; 16414 16415 if (isDisabled) { 16416 return null; 16417 } 16418 16419 const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize); 16420 const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize; 16421 return Object(external_wp_element_["createElement"])(font_size_picker, { 16422 onChange: onChange, 16423 value: fontSizeValue 16424 }); 16425 } 16426 /** 16427 * Custom hook that checks if font-size settings have been disabled. 16428 * 16429 * @param {string} name The name of the block. 16430 * @return {boolean} Whether setting is disabled. 16431 */ 16432 16433 function useIsFontSizeDisabled({ 16434 name: blockName 16435 } = {}) { 16436 const fontSizes = useSetting('typography.fontSizes'); 16437 const hasFontSizes = !!(fontSizes !== null && fontSizes !== void 0 && fontSizes.length); 16438 return !Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes; 16439 } 16440 /** 16441 * Add inline styles for font sizes. 16442 * Ideally, this is not needed and themes load the font-size classes on the 16443 * editor. 16444 * 16445 * @param {Function} BlockListBlock Original component 16446 * @return {Function} Wrapped component 16447 */ 16448 16449 const withFontSizeInlineStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 16450 var _style$typography3, _style$typography4; 16451 16452 const fontSizes = useSetting('typography.fontSizes'); 16453 const { 16454 name: blockName, 16455 attributes: { 16456 fontSize, 16457 style 16458 }, 16459 wrapperProps 16460 } = props; // Only add inline styles if the block supports font sizes, 16461 // doesn't skip serialization of font sizes, 16462 // doesn't already have an inline font size, 16463 // and does have a class to extract the font size from. 16464 16465 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockName, FONT_SIZE_SUPPORT_KEY) || Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize) { 16466 return Object(external_wp_element_["createElement"])(BlockListBlock, props); 16467 } 16468 16469 const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography4 = style.typography) === null || _style$typography4 === void 0 ? void 0 : _style$typography4.fontSize).size; 16470 const newProps = { ...props, 16471 wrapperProps: { ...wrapperProps, 16472 style: { 16473 fontSize: fontSizeValue, 16474 ...(wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style) 16475 } 16476 } 16477 }; 16478 return Object(external_wp_element_["createElement"])(BlockListBlock, newProps); 16479 }, 'withFontSizeInlineStyles'); 16480 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/font/addAttribute', font_size_addAttributes); 16481 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/font/addSaveProps', font_size_addSaveProps); 16482 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/font/addEditProps', font_size_addEditProps); 16483 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/font-size/with-font-size-inline-styles', withFontSizeInlineStyles); 16484 16485 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js 16486 16487 16488 /** 16489 * WordPress dependencies 16490 */ 16491 16492 /** 16493 * External dependencies 16494 */ 16495 16496 16497 16498 16499 /** 16500 * Internal dependencies 16501 */ 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 const TYPOGRAPHY_SUPPORT_KEY = 'typography'; 16512 const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY]; 16513 function TypographyPanel(props) { 16514 const isDisabled = useIsTypographyDisabled(props); 16515 const isSupported = hasTypographySupport(props.name); 16516 if (isDisabled || !isSupported) return null; 16517 return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 16518 title: Object(external_wp_i18n_["__"])('Typography') 16519 }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComponentSystemProvider"], { 16520 __unstableNextInclude: ['WPComponentsFontSizePicker'] 16521 }, Object(external_wp_element_["createElement"])(FontFamilyEdit, props), Object(external_wp_element_["createElement"])(FontSizeEdit, props), Object(external_wp_element_["createElement"])(FontAppearanceEdit, props), Object(external_wp_element_["createElement"])(LineHeightEdit, props), Object(external_wp_element_["createElement"])(TextDecorationAndTransformEdit, props)))); 16522 } 16523 16524 const hasTypographySupport = blockName => { 16525 return external_wp_element_["Platform"].OS === 'web' && TYPOGRAPHY_SUPPORT_KEYS.some(key => Object(external_wp_blocks_["hasBlockSupport"])(blockName, key)); 16526 }; 16527 16528 function useIsTypographyDisabled(props = {}) { 16529 const configs = [useIsFontAppearanceDisabled(props), useIsFontSizeDisabled(props), useIsLineHeightDisabled(props), useIsFontFamilyDisabled(props), useIsTextDecorationDisabled(props), useIsTextTransformDisabled(props)]; 16530 return configs.filter(Boolean).length === configs.length; 16531 } 16532 16533 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/margin.js 16534 16535 16536 /** 16537 * WordPress dependencies 16538 */ 16539 16540 16541 16542 16543 /** 16544 * Internal dependencies 16545 */ 16546 16547 16548 16549 16550 /** 16551 * Determines if there is margin support. 16552 * 16553 * @param {string|Object} blockType Block name or Block Type object. 16554 * @return {boolean} Whether there is support. 16555 */ 16556 16557 function hasMarginSupport(blockType) { 16558 const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, SPACING_SUPPORT_KEY); 16559 return !!(true === support || support !== null && support !== void 0 && support.margin); 16560 } 16561 /** 16562 * Custom hook that checks if margin settings have been disabled. 16563 * 16564 * @param {string} name The name of the block. 16565 * @return {boolean} Whether margin setting is disabled. 16566 */ 16567 16568 function useIsMarginDisabled({ 16569 name: blockName 16570 } = {}) { 16571 const isDisabled = !useSetting('spacing.customMargin'); 16572 return !hasMarginSupport(blockName) || isDisabled; 16573 } 16574 /** 16575 * Inspector control panel containing the margin related configuration 16576 * 16577 * @param {Object} props Block props. 16578 * @return {WPElement} Margin edit element. 16579 */ 16580 16581 function MarginEdit(props) { 16582 var _style$spacing; 16583 16584 const { 16585 name: blockName, 16586 attributes: { 16587 style 16588 }, 16589 setAttributes 16590 } = props; 16591 const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ 16592 availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] 16593 }); 16594 const sides = useCustomSides(blockName, 'margin'); 16595 16596 if (useIsMarginDisabled(props)) { 16597 return null; 16598 } 16599 16600 const onChange = next => { 16601 const newStyle = { ...style, 16602 spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), 16603 margin: next 16604 } 16605 }; 16606 setAttributes({ 16607 style: cleanEmptyObject(newStyle) 16608 }); 16609 }; 16610 16611 const onChangeShowVisualizer = next => { 16612 const newStyle = { ...style, 16613 visualizers: { 16614 margin: next 16615 } 16616 }; 16617 setAttributes({ 16618 style: cleanEmptyObject(newStyle) 16619 }); 16620 }; 16621 16622 return external_wp_element_["Platform"].select({ 16623 web: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalBoxControl"], { 16624 values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.margin, 16625 onChange: onChange, 16626 onChangeShowVisualizer: onChangeShowVisualizer, 16627 label: Object(external_wp_i18n_["__"])('Margin'), 16628 sides: sides, 16629 units: units 16630 })), 16631 native: null 16632 }); 16633 } 16634 16635 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/padding.js 16636 16637 16638 /** 16639 * WordPress dependencies 16640 */ 16641 16642 16643 16644 16645 /** 16646 * Internal dependencies 16647 */ 16648 16649 16650 16651 16652 /** 16653 * Determines if there is padding support. 16654 * 16655 * @param {string|Object} blockType Block name or Block Type object. 16656 * @return {boolean} Whether there is support. 16657 */ 16658 16659 function hasPaddingSupport(blockType) { 16660 const support = Object(external_wp_blocks_["getBlockSupport"])(blockType, SPACING_SUPPORT_KEY); 16661 return !!(true === support || support !== null && support !== void 0 && support.padding); 16662 } 16663 /** 16664 * Custom hook that checks if padding settings have been disabled. 16665 * 16666 * @param {string} name The name of the block. 16667 * @return {boolean} Whether padding setting is disabled. 16668 */ 16669 16670 function useIsPaddingDisabled({ 16671 name: blockName 16672 } = {}) { 16673 const isDisabled = !useSetting('spacing.customPadding'); 16674 return !hasPaddingSupport(blockName) || isDisabled; 16675 } 16676 /** 16677 * Inspector control panel containing the padding related configuration 16678 * 16679 * @param {Object} props 16680 * 16681 * @return {WPElement} Padding edit element. 16682 */ 16683 16684 function PaddingEdit(props) { 16685 var _style$spacing; 16686 16687 const { 16688 name: blockName, 16689 attributes: { 16690 style 16691 }, 16692 setAttributes 16693 } = props; 16694 const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ 16695 availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] 16696 }); 16697 const sides = useCustomSides(blockName, 'padding'); 16698 16699 if (useIsPaddingDisabled(props)) { 16700 return null; 16701 } 16702 16703 const onChange = next => { 16704 const newStyle = { ...style, 16705 spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing), 16706 padding: next 16707 } 16708 }; 16709 setAttributes({ 16710 style: cleanEmptyObject(newStyle) 16711 }); 16712 }; 16713 16714 const onChangeShowVisualizer = next => { 16715 const newStyle = { ...style, 16716 visualizers: { 16717 padding: next 16718 } 16719 }; 16720 setAttributes({ 16721 style: cleanEmptyObject(newStyle) 16722 }); 16723 }; 16724 16725 return external_wp_element_["Platform"].select({ 16726 web: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalBoxControl"], { 16727 values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.padding, 16728 onChange: onChange, 16729 onChangeShowVisualizer: onChangeShowVisualizer, 16730 label: Object(external_wp_i18n_["__"])('Padding'), 16731 sides: sides, 16732 units: units 16733 })), 16734 native: null 16735 }); 16736 } 16737 16738 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/spacing.js 16739 16740 16741 /** 16742 * WordPress dependencies 16743 */ 16744 16745 16746 16747 16748 /** 16749 * Internal dependencies 16750 */ 16751 16752 16753 16754 16755 const SPACING_SUPPORT_KEY = 'spacing'; 16756 /** 16757 * Inspector controls for spacing support. 16758 * 16759 * @param {Object} props Block props. 16760 * @return {WPElement} Inspector controls for spacing support features. 16761 */ 16762 16763 function SpacingPanel(props) { 16764 const isDisabled = useIsSpacingDisabled(props); 16765 const isSupported = hasSpacingSupport(props.name); 16766 16767 if (isDisabled || !isSupported) { 16768 return null; 16769 } 16770 16771 return Object(external_wp_element_["createElement"])(inspector_controls, { 16772 key: "spacing" 16773 }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 16774 title: Object(external_wp_i18n_["__"])('Spacing') 16775 }, Object(external_wp_element_["createElement"])(PaddingEdit, props), Object(external_wp_element_["createElement"])(MarginEdit, props))); 16776 } 16777 /** 16778 * Determine whether there is block support for padding or margins. 16779 * 16780 * @param {string} blockName Block name. 16781 * @return {boolean} Whether there is support. 16782 */ 16783 16784 function hasSpacingSupport(blockName) { 16785 if (external_wp_element_["Platform"].OS !== 'web') { 16786 return false; 16787 } 16788 16789 return hasPaddingSupport(blockName) || hasMarginSupport(blockName); 16790 } 16791 /** 16792 * Determines whether spacing support has been disabled. 16793 * 16794 * @param {Object} props Block properties. 16795 * @return {boolean} If spacing support is completely disabled. 16796 */ 16797 16798 const useIsSpacingDisabled = (props = {}) => { 16799 const paddingDisabled = useIsPaddingDisabled(props); 16800 const marginDisabled = useIsMarginDisabled(props); 16801 return paddingDisabled && marginDisabled; 16802 }; 16803 /** 16804 * Custom hook to retrieve which padding/margin is supported 16805 * e.g. top, right, bottom or left. 16806 * 16807 * Sides are opted into by default. It is only if a specific side is set to 16808 * false that it is omitted. 16809 * 16810 * @param {string} blockName Block name. 16811 * @param {string} feature The feature custom sides relate to e.g. padding or margins. 16812 * @return {Object} Sides supporting custom margin. 16813 */ 16814 16815 16816 function useCustomSides(blockName, feature) { 16817 const support = Object(external_wp_blocks_["getBlockSupport"])(blockName, SPACING_SUPPORT_KEY); // Skip when setting is boolean as theme isn't setting arbitrary sides. 16818 16819 if (typeof support[feature] === 'boolean') { 16820 return; 16821 } 16822 16823 return support[feature]; 16824 } 16825 16826 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/style.js 16827 16828 16829 16830 /** 16831 * External dependencies 16832 */ 16833 16834 16835 /** 16836 * WordPress dependencies 16837 */ 16838 16839 16840 16841 16842 /** 16843 * Internal dependencies 16844 */ 16845 16846 16847 16848 16849 16850 16851 const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY]; 16852 16853 const hasStyleSupport = blockType => styleSupportKeys.some(key => Object(external_wp_blocks_["hasBlockSupport"])(blockType, key)); 16854 16855 const VARIABLE_REFERENCE_PREFIX = 'var:'; 16856 const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; 16857 const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; 16858 16859 function compileStyleValue(uncompiledValue) { 16860 if (Object(external_lodash_["startsWith"])(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) { 16861 const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE); 16862 return `var(--wp--${variable})`; 16863 } 16864 16865 return uncompiledValue; 16866 } 16867 /** 16868 * Returns the inline styles to add depending on the style object 16869 * 16870 * @param {Object} styles Styles configuration 16871 * @return {Object} Flattened CSS variables declaration 16872 */ 16873 16874 16875 function getInlineStyles(styles = {}) { 16876 const output = {}; 16877 Object.keys(external_wp_blocks_["__EXPERIMENTAL_STYLE_PROPERTY"]).forEach(propKey => { 16878 const path = external_wp_blocks_["__EXPERIMENTAL_STYLE_PROPERTY"][propKey].value; 16879 const subPaths = external_wp_blocks_["__EXPERIMENTAL_STYLE_PROPERTY"][propKey].properties; // Ignore styles on elements because they are handled on the server. 16880 16881 if (Object(external_lodash_["has"])(styles, path) && 'elements' !== Object(external_lodash_["first"])(path)) { 16882 if (!!subPaths) { 16883 subPaths.forEach(suffix => { 16884 output[propKey + Object(external_lodash_["capitalize"])(suffix)] = compileStyleValue(Object(external_lodash_["get"])(styles, [...path, suffix])); 16885 }); 16886 } else { 16887 output[propKey] = compileStyleValue(Object(external_lodash_["get"])(styles, path)); 16888 } 16889 } 16890 }); 16891 return output; 16892 } 16893 16894 function compileElementsStyles(selector, elements = {}) { 16895 return Object(external_lodash_["map"])(elements, (styles, element) => { 16896 const elementStyles = getInlineStyles(styles); 16897 16898 if (!Object(external_lodash_["isEmpty"])(elementStyles)) { 16899 return [`.${selector} ${external_wp_blocks_["__EXPERIMENTAL_ELEMENTS"][element]}{`, ...Object(external_lodash_["map"])(elementStyles, (value, property) => `\t${Object(external_lodash_["kebabCase"])(property)}: ${value}${element === 'link' ? '!important' : ''};`), '}'].join('\n'); 16900 } 16901 16902 return ''; 16903 }).join('\n'); 16904 } 16905 /** 16906 * Filters registered block settings, extending attributes to include `style` attribute. 16907 * 16908 * @param {Object} settings Original block settings 16909 * @return {Object} Filtered block settings 16910 */ 16911 16912 16913 function style_addAttribute(settings) { 16914 if (!hasStyleSupport(settings)) { 16915 return settings; 16916 } // allow blocks to specify their own attribute definition with default values if needed. 16917 16918 16919 if (!settings.attributes.style) { 16920 Object.assign(settings.attributes, { 16921 style: { 16922 type: 'object' 16923 } 16924 }); 16925 } 16926 16927 return settings; 16928 } 16929 16930 const skipSerializationPaths = { 16931 [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['border'], 16932 [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [COLOR_SUPPORT_KEY], 16933 [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [TYPOGRAPHY_SUPPORT_KEY] 16934 }; 16935 /** 16936 * Override props assigned to save component to inject the CSS variables definition. 16937 * 16938 * @param {Object} props Additional props applied to save element 16939 * @param {Object} blockType Block type 16940 * @param {Object} attributes Block attributes 16941 * @return {Object} Filtered props applied to save element 16942 */ 16943 16944 function style_addSaveProps(props, blockType, attributes) { 16945 if (!hasStyleSupport(blockType)) { 16946 return props; 16947 } 16948 16949 let { 16950 style 16951 } = attributes; 16952 Object(external_lodash_["forEach"])(skipSerializationPaths, (path, indicator) => { 16953 if (Object(external_wp_blocks_["getBlockSupport"])(blockType, indicator)) { 16954 style = Object(external_lodash_["omit"])(style, path); 16955 } 16956 }); 16957 props.style = { ...getInlineStyles(style), 16958 ...props.style 16959 }; 16960 return props; 16961 } 16962 /** 16963 * Filters registered block settings to extend the block edit wrapper 16964 * to apply the desired styles and classnames properly. 16965 * 16966 * @param {Object} settings Original block settings 16967 * @return {Object} Filtered block settings 16968 */ 16969 16970 function style_addEditProps(settings) { 16971 if (!hasStyleSupport(settings)) { 16972 return settings; 16973 } 16974 16975 const existingGetEditWrapperProps = settings.getEditWrapperProps; 16976 16977 settings.getEditWrapperProps = attributes => { 16978 let props = {}; 16979 16980 if (existingGetEditWrapperProps) { 16981 props = existingGetEditWrapperProps(attributes); 16982 } 16983 16984 return style_addSaveProps(props, settings, attributes); 16985 }; 16986 16987 return settings; 16988 } 16989 /** 16990 * Override the default edit UI to include new inspector controls for 16991 * all the custom styles configs. 16992 * 16993 * @param {Function} BlockEdit Original component 16994 * @return {Function} Wrapped component 16995 */ 16996 16997 const withBlockControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { 16998 const shouldDisplayControls = useDisplayBlockControls(); 16999 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, shouldDisplayControls && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(TypographyPanel, props), Object(external_wp_element_["createElement"])(BorderPanel, props), Object(external_wp_element_["createElement"])(ColorEdit, props), Object(external_wp_element_["createElement"])(SpacingPanel, props)), Object(external_wp_element_["createElement"])(BlockEdit, props)); 17000 }, 'withToolbarControls'); 17001 /** 17002 * Override the default block element to include duotone styles. 17003 * 17004 * @param {Function} BlockListBlock Original component 17005 * @return {Function} Wrapped component 17006 */ 17007 17008 const withElementsStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 17009 var _props$attributes$sty, _props$attributes$sty2; 17010 17011 const elements = (_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : _props$attributes$sty.elements; 17012 const blockElementsContainerIdentifier = `wp-elements-${Object(external_wp_compose_["useInstanceId"])(BlockListBlock)}`; 17013 const styles = compileElementsStyles(blockElementsContainerIdentifier, (_props$attributes$sty2 = props.attributes.style) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.elements); 17014 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, elements && Object(external_wp_element_["createElement"])("style", { 17015 dangerouslySetInnerHTML: { 17016 __html: styles 17017 } 17018 }), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { 17019 className: elements ? classnames_default()(props.className, blockElementsContainerIdentifier) : props.className 17020 }))); 17021 }); 17022 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/style/addAttribute', style_addAttribute); 17023 Object(external_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/style/addSaveProps', style_addSaveProps); 17024 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/style/addEditProps', style_addEditProps); 17025 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls); 17026 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/with-elements-styles', withElementsStyles); 17027 17028 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/duotone-picker-popover.js 17029 17030 17031 /** 17032 * WordPress dependencies 17033 */ 17034 17035 17036 17037 function DuotonePickerPopover({ 17038 value, 17039 onChange, 17040 onToggle, 17041 duotonePalette, 17042 colorPalette, 17043 disableCustomColors, 17044 disableCustomDuotone 17045 }) { 17046 return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 17047 className: "block-editor-duotone-control__popover", 17048 headerTitle: Object(external_wp_i18n_["__"])('Duotone'), 17049 onFocusOutside: onToggle 17050 }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { 17051 label: Object(external_wp_i18n_["__"])('Duotone') 17052 }, Object(external_wp_element_["createElement"])(external_wp_components_["DuotonePicker"], { 17053 colorPalette: colorPalette, 17054 duotonePalette: duotonePalette, 17055 disableCustomColors: disableCustomColors, 17056 disableCustomDuotone: disableCustomDuotone, 17057 value: value, 17058 onChange: onChange 17059 }))); 17060 } 17061 17062 /* harmony default export */ var duotone_picker_popover = (DuotonePickerPopover); 17063 17064 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js 17065 17066 17067 /** 17068 * WordPress dependencies 17069 */ 17070 17071 17072 17073 17074 /** 17075 * Internal dependencies 17076 */ 17077 17078 17079 17080 function DuotoneControl({ 17081 colorPalette, 17082 duotonePalette, 17083 disableCustomColors, 17084 disableCustomDuotone, 17085 value, 17086 onChange 17087 }) { 17088 const [isOpen, setIsOpen] = Object(external_wp_element_["useState"])(false); 17089 17090 const onToggle = () => { 17091 setIsOpen(prev => !prev); 17092 }; 17093 17094 const openOnArrowDown = event => { 17095 if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { 17096 event.preventDefault(); 17097 event.stopPropagation(); 17098 onToggle(); 17099 } 17100 }; 17101 17102 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 17103 showTooltip: true, 17104 onClick: onToggle, 17105 "aria-haspopup": "true", 17106 "aria-expanded": isOpen, 17107 onKeyDown: openOnArrowDown, 17108 label: Object(external_wp_i18n_["__"])('Apply duotone filter'), 17109 icon: Object(external_wp_element_["createElement"])(external_wp_components_["DuotoneSwatch"], { 17110 values: value 17111 }) 17112 }), isOpen && Object(external_wp_element_["createElement"])(duotone_picker_popover, { 17113 value: value, 17114 onChange: onChange, 17115 onToggle: onToggle, 17116 duotonePalette: duotonePalette, 17117 colorPalette: colorPalette, 17118 disableCustomColors: disableCustomColors, 17119 disableCustomDuotone: disableCustomDuotone 17120 })); 17121 } 17122 17123 /* harmony default export */ var duotone_control = (DuotoneControl); 17124 17125 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/head.js 17126 17127 17128 /** 17129 * WordPress dependencies 17130 */ 17131 17132 const head_context = Object(external_wp_element_["createContext"])(); 17133 function Head({ 17134 children 17135 }) { 17136 const [element, setElement] = Object(external_wp_element_["useState"])(); 17137 return Object(external_wp_element_["createElement"])(head_context.Provider, { 17138 value: element 17139 }, Object(external_wp_element_["createElement"])("div", { 17140 ref: setElement 17141 }), children); 17142 } 17143 Head.context = head_context; 17144 17145 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js 17146 17147 17148 17149 /** 17150 * External dependencies 17151 */ 17152 17153 17154 /** 17155 * WordPress dependencies 17156 */ 17157 17158 17159 17160 17161 17162 17163 /** 17164 * Internal dependencies 17165 */ 17166 17167 17168 17169 const duotone_EMPTY_ARRAY = []; 17170 /** 17171 * Convert a list of colors to an object of R, G, and B values. 17172 * 17173 * @param {string[]} colors Array of RBG color strings. 17174 * 17175 * @return {Object} R, G, and B values. 17176 */ 17177 17178 function getValuesFromColors(colors = []) { 17179 const values = { 17180 r: [], 17181 g: [], 17182 b: [] 17183 }; 17184 colors.forEach(color => { 17185 // Access values directly to skip extra rounding that tinycolor.toRgb() does. 17186 const tcolor = tinycolor_default()(color); 17187 values.r.push(tcolor._r / 255); 17188 values.g.push(tcolor._g / 255); 17189 values.b.push(tcolor._b / 255); 17190 }); 17191 return values; 17192 } 17193 /** 17194 * Values for the SVG `feComponentTransfer`. 17195 * 17196 * @typedef Values {Object} 17197 * @property {number[]} r Red values. 17198 * @property {number[]} g Green values. 17199 * @property {number[]} b Blue values. 17200 */ 17201 17202 /** 17203 * SVG and stylesheet needed for rendering the duotone filter. 17204 * 17205 * @param {Object} props Duotone props. 17206 * @param {string} props.selector Selector to apply the filter to. 17207 * @param {string} props.id Unique id for this duotone filter. 17208 * @param {Values} props.values R, G, and B values to filter with. 17209 * @return {WPElement} Duotone element. 17210 */ 17211 17212 function DuotoneFilter({ 17213 selector, 17214 id, 17215 values 17216 }) { 17217 const stylesheet = ` 17218 ${selector} { 17219 filter: url( #${id} ); 17220 } 17221 `; 17222 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 17223 xmlnsXlink: "http://www.w3.org/1999/xlink", 17224 viewBox: "0 0 0 0", 17225 width: "0", 17226 height: "0", 17227 focusable: "false", 17228 role: "none", 17229 style: { 17230 visibility: 'hidden', 17231 position: 'absolute', 17232 left: '-9999px', 17233 overflow: 'hidden' 17234 } 17235 }, Object(external_wp_element_["createElement"])("defs", null, Object(external_wp_element_["createElement"])("filter", { 17236 id: id 17237 }, Object(external_wp_element_["createElement"])("feColorMatrix", { 17238 type: "matrix" // Use perceptual brightness to convert to grayscale. 17239 // prettier-ignore 17240 , 17241 values: ".299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 0 0 0 1 0" 17242 }), Object(external_wp_element_["createElement"])("feComponentTransfer", { 17243 // Use sRGB instead of linearRGB to be consistent with how CSS gradients work. 17244 colorInterpolationFilters: "sRGB" 17245 }, Object(external_wp_element_["createElement"])("feFuncR", { 17246 type: "table", 17247 tableValues: values.r.join(' ') 17248 }), Object(external_wp_element_["createElement"])("feFuncG", { 17249 type: "table", 17250 tableValues: values.g.join(' ') 17251 }), Object(external_wp_element_["createElement"])("feFuncB", { 17252 type: "table", 17253 tableValues: values.b.join(' ') 17254 }))))), Object(external_wp_element_["createElement"])("style", { 17255 dangerouslySetInnerHTML: { 17256 __html: stylesheet 17257 } 17258 })); 17259 } 17260 17261 function DuotonePanel({ 17262 attributes, 17263 setAttributes 17264 }) { 17265 var _style$color; 17266 17267 const style = attributes === null || attributes === void 0 ? void 0 : attributes.style; 17268 const duotone = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.duotone; 17269 const duotonePalette = useSetting('color.duotone') || duotone_EMPTY_ARRAY; 17270 const colorPalette = useSetting('color.palette') || duotone_EMPTY_ARRAY; 17271 const disableCustomColors = !useSetting('color.custom'); 17272 const disableCustomDuotone = !useSetting('color.customDuotone') || (colorPalette === null || colorPalette === void 0 ? void 0 : colorPalette.length) === 0 && disableCustomColors; 17273 17274 if ((duotonePalette === null || duotonePalette === void 0 ? void 0 : duotonePalette.length) === 0 && disableCustomDuotone) { 17275 return null; 17276 } 17277 17278 return Object(external_wp_element_["createElement"])(block_controls, { 17279 group: "block" 17280 }, Object(external_wp_element_["createElement"])(duotone_control, { 17281 duotonePalette: duotonePalette, 17282 colorPalette: colorPalette, 17283 disableCustomDuotone: disableCustomDuotone, 17284 disableCustomColors: disableCustomColors, 17285 value: duotone, 17286 onChange: newDuotone => { 17287 const newStyle = { ...style, 17288 color: { ...(style === null || style === void 0 ? void 0 : style.color), 17289 duotone: newDuotone 17290 } 17291 }; 17292 setAttributes({ 17293 style: newStyle 17294 }); 17295 } 17296 })); 17297 } 17298 /** 17299 * Filters registered block settings, extending attributes to include 17300 * the `duotone` attribute. 17301 * 17302 * @param {Object} settings Original block settings 17303 * @return {Object} Filtered block settings 17304 */ 17305 17306 17307 function addDuotoneAttributes(settings) { 17308 if (!Object(external_wp_blocks_["hasBlockSupport"])(settings, 'color.__experimentalDuotone')) { 17309 return settings; 17310 } // Allow blocks to specify their own attribute definition with default 17311 // values if needed. 17312 17313 17314 if (!settings.attributes.style) { 17315 Object.assign(settings.attributes, { 17316 style: { 17317 type: 'object' 17318 } 17319 }); 17320 } 17321 17322 return settings; 17323 } 17324 /** 17325 * Override the default edit UI to include toolbar controls for duotone if the 17326 * block supports duotone. 17327 * 17328 * @param {Function} BlockEdit Original component 17329 * @return {Function} Wrapped component 17330 */ 17331 17332 17333 const withDuotoneControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { 17334 const hasDuotoneSupport = Object(external_wp_blocks_["hasBlockSupport"])(props.name, 'color.__experimentalDuotone'); 17335 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), hasDuotoneSupport && Object(external_wp_element_["createElement"])(DuotonePanel, props)); 17336 }, 'withDuotoneControls'); 17337 /** 17338 * Override the default block element to include duotone styles. 17339 * 17340 * @param {Function} BlockListBlock Original component 17341 * @return {Function} Wrapped component 17342 */ 17343 17344 const withDuotoneStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 17345 var _props$attributes, _props$attributes$sty, _props$attributes$sty2; 17346 17347 const duotoneSupport = Object(external_wp_blocks_["getBlockSupport"])(props.name, 'color.__experimentalDuotone'); 17348 const values = props === null || props === void 0 ? void 0 : (_props$attributes = props.attributes) === null || _props$attributes === void 0 ? void 0 : (_props$attributes$sty = _props$attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.color) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.duotone; 17349 17350 if (!duotoneSupport || !values) { 17351 return Object(external_wp_element_["createElement"])(BlockListBlock, props); 17352 } 17353 17354 const id = `wp-duotone-filter-${Object(external_wp_compose_["useInstanceId"])(BlockListBlock)}`; 17355 const selectors = duotoneSupport.split(','); 17356 const selectorsScoped = selectors.map(selector => `.${id} ${selector.trim()}`); 17357 const selectorsGroup = selectorsScoped.join(', '); 17358 const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, id); 17359 const element = Object(external_wp_element_["useContext"])(Head.context); 17360 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, element && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(DuotoneFilter, { 17361 selector: selectorsGroup, 17362 id: id, 17363 values: getValuesFromColors(values) 17364 }), element), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { 17365 className: className 17366 }))); 17367 }, 'withDuotoneStyles'); 17368 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes); 17369 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/duotone/with-editor-controls', withDuotoneControls); 17370 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/duotone/with-styles', withDuotoneStyles); 17371 17372 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 17373 var build_module_icon = __webpack_require__("iClF"); 17374 17375 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js 17376 17377 17378 17379 /** 17380 * External dependencies 17381 */ 17382 17383 17384 /** 17385 * WordPress dependencies 17386 */ 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 /** 17397 * Internal dependencies 17398 */ 17399 17400 17401 17402 17403 17404 17405 17406 function LayoutPanel({ 17407 setAttributes, 17408 attributes 17409 }) { 17410 const { 17411 layout = {} 17412 } = attributes; 17413 const { 17414 wideSize, 17415 contentSize, 17416 inherit = false 17417 } = layout; 17418 const defaultLayout = useSetting('layout'); 17419 const themeSupportsLayout = Object(external_wp_data_["useSelect"])(select => { 17420 const { 17421 getSettings 17422 } = select(store); 17423 return getSettings().supportsLayout; 17424 }, []); 17425 const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ 17426 availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] 17427 }); 17428 17429 if (!themeSupportsLayout) { 17430 return null; 17431 } 17432 17433 return Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 17434 title: Object(external_wp_i18n_["__"])('Layout') 17435 }, !!defaultLayout && Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { 17436 label: Object(external_wp_i18n_["__"])('Inherit default layout'), 17437 checked: !!inherit, 17438 onChange: () => setAttributes({ 17439 layout: { 17440 inherit: !inherit 17441 } 17442 }) 17443 }), !inherit && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 17444 className: "block-editor-hooks__layout-controls" 17445 }, Object(external_wp_element_["createElement"])("div", { 17446 className: "block-editor-hooks__layout-controls-unit" 17447 }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], { 17448 label: Object(external_wp_i18n_["__"])('Content'), 17449 labelPosition: "top", 17450 __unstableInputWidth: "80px", 17451 value: contentSize || wideSize || '', 17452 onChange: nextWidth => { 17453 nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; 17454 setAttributes({ 17455 layout: { ...layout, 17456 contentSize: nextWidth 17457 } 17458 }); 17459 }, 17460 units: units 17461 }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 17462 icon: position_center 17463 })), Object(external_wp_element_["createElement"])("div", { 17464 className: "block-editor-hooks__layout-controls-unit" 17465 }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], { 17466 label: Object(external_wp_i18n_["__"])('Wide'), 17467 labelPosition: "top", 17468 __unstableInputWidth: "80px", 17469 value: wideSize || contentSize || '', 17470 onChange: nextWidth => { 17471 nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; 17472 setAttributes({ 17473 layout: { ...layout, 17474 wideSize: nextWidth 17475 } 17476 }); 17477 }, 17478 units: units 17479 }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 17480 icon: stretch_wide 17481 }))), Object(external_wp_element_["createElement"])("div", { 17482 className: "block-editor-hooks__layout-controls-reset" 17483 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 17484 isSecondary: true, 17485 isSmall: true, 17486 disabled: !contentSize && !wideSize, 17487 onClick: () => setAttributes({ 17488 layout: { 17489 contentSize: undefined, 17490 wideSize: undefined, 17491 inherit: false 17492 } 17493 }) 17494 }, Object(external_wp_i18n_["__"])('Reset')))), Object(external_wp_element_["createElement"])("p", { 17495 className: "block-editor-hooks__layout-controls-helptext" 17496 }, Object(external_wp_i18n_["__"])('Customize the width for all elements that are assigned to the center or wide columns.')))); 17497 } 17498 /** 17499 * Filters registered block settings, extending attributes to include `layout`. 17500 * 17501 * @param {Object} settings Original block settings 17502 * @return {Object} Filtered block settings 17503 */ 17504 17505 17506 function layout_addAttribute(settings) { 17507 if (Object(external_lodash_["has"])(settings.attributes, ['layout', 'type'])) { 17508 return settings; 17509 } 17510 17511 if (Object(external_wp_blocks_["hasBlockSupport"])(settings, '__experimentalLayout')) { 17512 settings.attributes = { ...settings.attributes, 17513 layout: { 17514 type: 'object' 17515 } 17516 }; 17517 } 17518 17519 return settings; 17520 } 17521 /** 17522 * Override the default edit UI to include layout controls 17523 * 17524 * @param {Function} BlockEdit Original component 17525 * @return {Function} Wrapped component 17526 */ 17527 17528 const withInspectorControls = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { 17529 const { 17530 name: blockName 17531 } = props; 17532 const supportLayout = Object(external_wp_blocks_["hasBlockSupport"])(blockName, '__experimentalLayout'); 17533 return [supportLayout && Object(external_wp_element_["createElement"])(LayoutPanel, Object(esm_extends["a" /* default */])({ 17534 key: "layout" 17535 }, props)), Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ 17536 key: "edit" 17537 }, props))]; 17538 }, 'withInspectorControls'); 17539 /** 17540 * Override the default block element to add the layout styles. 17541 * 17542 * @param {Function} BlockListBlock Original component 17543 * @return {Function} Wrapped component 17544 */ 17545 17546 const withLayoutStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => { 17547 const { 17548 name, 17549 attributes 17550 } = props; 17551 const supportLayout = Object(external_wp_blocks_["hasBlockSupport"])(name, '__experimentalLayout'); 17552 const id = Object(external_wp_compose_["useInstanceId"])(BlockListBlock); 17553 const defaultLayout = useSetting('layout') || {}; 17554 17555 if (!supportLayout) { 17556 return Object(external_wp_element_["createElement"])(BlockListBlock, props); 17557 } 17558 17559 const { 17560 layout = {} 17561 } = attributes; 17562 const usedLayout = !!layout && layout.inherit ? defaultLayout : layout; 17563 const className = classnames_default()(props === null || props === void 0 ? void 0 : props.className, `wp-container-${id}`); 17564 const element = Object(external_wp_element_["useContext"])(Head.context); 17565 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, element && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(LayoutStyle, { 17566 selector: `.wp-container-${id}`, 17567 layout: usedLayout 17568 }), element), Object(external_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { 17569 className: className 17570 }))); 17571 }); 17572 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/layout/addAttribute', layout_addAttribute); 17573 Object(external_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles); 17574 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/layout/with-inspector-controls', withInspectorControls); 17575 17576 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js 17577 /** 17578 * External dependencies 17579 */ 17580 17581 /** 17582 * Internal dependencies 17583 */ 17584 17585 17586 17587 // This utility is intended to assist where the serialization of the border 17588 // block support is being skipped for a block but the border related CSS classes 17589 // & styles still need to be generated so they can be applied to inner elements. 17590 17591 const use_border_props_EMPTY_ARRAY = []; 17592 /** 17593 * Provides the CSS class names and inline styles for a block's border support 17594 * attributes. 17595 * 17596 * @param {Object} attributes Block attributes. 17597 * @param {string} attributes.borderColor Selected named border color. 17598 * @param {Object} attributes.style Block's styles attribute. 17599 * 17600 * @return {Object} Border block support derived CSS classes & styles. 17601 */ 17602 17603 function getBorderClassesAndStyles({ 17604 borderColor, 17605 style 17606 }) { 17607 var _style$border; 17608 17609 const borderStyles = (style === null || style === void 0 ? void 0 : style.border) || {}; 17610 const borderClass = getColorClassName('border-color', borderColor); 17611 const className = classnames_default()({ 17612 [borderClass]: !!borderClass, 17613 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color) 17614 }); 17615 return { 17616 className: className || undefined, 17617 style: getInlineStyles({ 17618 border: borderStyles 17619 }) 17620 }; 17621 } 17622 /** 17623 * Derives the border related props for a block from its border block support 17624 * attributes. 17625 * 17626 * Inline styles are forced for named colors to ensure these selections are 17627 * reflected when themes do not load their color stylesheets in the editor. 17628 * 17629 * @param {Object} attributes Block attributes. 17630 * @return {Object} ClassName & style props from border block support. 17631 */ 17632 17633 function useBorderProps(attributes) { 17634 const colors = useSetting('color.palette') || use_border_props_EMPTY_ARRAY; 17635 const borderProps = getBorderClassesAndStyles(attributes); // Force inline style to apply border color when themes do not load their 17636 // color stylesheets in the editor. 17637 17638 if (attributes.borderColor) { 17639 const borderColorObject = getColorObjectByAttributeValues(colors, attributes.borderColor); 17640 borderProps.style.borderColor = borderColorObject.color; 17641 } 17642 17643 return borderProps; 17644 } 17645 17646 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js 17647 /** 17648 * External dependencies 17649 */ 17650 17651 /** 17652 * Internal dependencies 17653 */ 17654 17655 17656 17657 17658 // The code in this file has largely been lifted from the color block support 17659 // hook. 17660 // 17661 // This utility is intended to assist where the serialization of the colors 17662 // block support is being skipped for a block but the color related CSS classes 17663 // & styles still need to be generated so they can be applied to inner elements. 17664 17665 const use_color_props_EMPTY_ARRAY = []; 17666 /** 17667 * Provides the CSS class names and inline styles for a block's color support 17668 * attributes. 17669 * 17670 * @param {Object} attributes Block attributes. 17671 * @return {Object} Color block support derived CSS classes & styles. 17672 */ 17673 17674 function getColorClassesAndStyles(attributes) { 17675 var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link; 17676 17677 const { 17678 backgroundColor, 17679 textColor, 17680 gradient, 17681 style 17682 } = attributes; // Collect color CSS classes. 17683 17684 const backgroundClass = getColorClassName('background-color', backgroundColor); 17685 const textClass = getColorClassName('color', textColor); 17686 17687 const gradientClass = __experimentalGetGradientClass(gradient); 17688 17689 const hasGradient = gradientClass || (style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.gradient); // Determine color CSS class name list. 17690 17691 const className = classnames_default()(textClass, gradientClass, { 17692 // Don't apply the background class if there's a gradient. 17693 [backgroundClass]: !hasGradient && !!backgroundClass, 17694 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text), 17695 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient), 17696 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color 17697 }); // Collect inline styles for colors. 17698 17699 const colorStyles = (style === null || style === void 0 ? void 0 : style.color) || {}; 17700 const styleProp = getInlineStyles({ 17701 color: colorStyles 17702 }); 17703 return { 17704 className: className || undefined, 17705 style: styleProp 17706 }; 17707 } 17708 /** 17709 * Determines the color related props for a block derived from its color block 17710 * support attributes. 17711 * 17712 * Inline styles are forced for named colors to ensure these selections are 17713 * reflected when themes do not load their color stylesheets in the editor. 17714 * 17715 * @param {Object} attributes Block attributes. 17716 * @return {Object} ClassName & style props from colors block support. 17717 */ 17718 17719 function useColorProps(attributes) { 17720 const { 17721 backgroundColor, 17722 textColor, 17723 gradient 17724 } = attributes; 17725 const colors = useSetting('color.palette') || use_color_props_EMPTY_ARRAY; 17726 const gradients = useSetting('color.gradients') || use_color_props_EMPTY_ARRAY; 17727 const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color 17728 // stylesheets in the editor. 17729 17730 if (backgroundColor) { 17731 const backgroundColorObject = getColorObjectByAttributeValues(colors, backgroundColor); 17732 colorProps.style.backgroundColor = backgroundColorObject.color; 17733 } 17734 17735 if (gradient) { 17736 colorProps.style.background = getGradientValueBySlug(gradients, gradient); 17737 } 17738 17739 if (textColor) { 17740 const textColorObject = getColorObjectByAttributeValues(colors, textColor); 17741 colorProps.style.color = textColorObject.color; 17742 } 17743 17744 return colorProps; 17745 } 17746 17747 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/index.js 17748 /** 17749 * Internal dependencies 17750 */ 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js 17766 17767 17768 17769 /** 17770 * External dependencies 17771 */ 17772 17773 /** 17774 * WordPress dependencies 17775 */ 17776 17777 17778 17779 /** 17780 * Internal dependencies 17781 */ 17782 17783 17784 17785 const DEFAULT_COLORS = []; 17786 /** 17787 * Higher order component factory for injecting the `colorsArray` argument as 17788 * the colors prop in the `withCustomColors` HOC. 17789 * 17790 * @param {Array} colorsArray An array of color objects. 17791 * 17792 * @return {Function} The higher order component. 17793 */ 17794 17795 const withCustomColorPalette = colorsArray => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { 17796 colors: colorsArray 17797 })), 'withCustomColorPalette'); 17798 /** 17799 * Higher order component factory for injecting the editor colors as the 17800 * `colors` prop in the `withColors` HOC. 17801 * 17802 * @return {Function} The higher order component. 17803 */ 17804 17805 17806 const withEditorColorPalette = () => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => { 17807 const colors = useSetting('color.palette') || DEFAULT_COLORS; 17808 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { 17809 colors: colors 17810 })); 17811 }, 'withEditorColorPalette'); 17812 /** 17813 * Helper function used with `createHigherOrderComponent` to create 17814 * higher order components for managing color logic. 17815 * 17816 * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor). 17817 * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent. 17818 * 17819 * @return {WPComponent} The component that can be used as a HOC. 17820 */ 17821 17822 17823 function createColorHOC(colorTypes, withColorPalette) { 17824 const colorMap = Object(external_lodash_["reduce"])(colorTypes, (colorObject, colorType) => { 17825 return { ...colorObject, 17826 ...(Object(external_lodash_["isString"])(colorType) ? { 17827 [colorType]: Object(external_lodash_["kebabCase"])(colorType) 17828 } : colorType) 17829 }; 17830 }, {}); 17831 return Object(external_wp_compose_["compose"])([withColorPalette, WrappedComponent => { 17832 return class extends external_wp_element_["Component"] { 17833 constructor(props) { 17834 super(props); 17835 this.setters = this.createSetters(); 17836 this.colorUtils = { 17837 getMostReadableColor: this.getMostReadableColor.bind(this) 17838 }; 17839 this.state = {}; 17840 } 17841 17842 getMostReadableColor(colorValue) { 17843 const { 17844 colors 17845 } = this.props; 17846 return getMostReadableColor(colors, colorValue); 17847 } 17848 17849 createSetters() { 17850 return Object(external_lodash_["reduce"])(colorMap, (settersAccumulator, colorContext, colorAttributeName) => { 17851 const upperFirstColorAttributeName = Object(external_lodash_["upperFirst"])(colorAttributeName); 17852 const customColorAttributeName = `custom${upperFirstColorAttributeName}`; 17853 settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor(colorAttributeName, customColorAttributeName); 17854 return settersAccumulator; 17855 }, {}); 17856 } 17857 17858 createSetColor(colorAttributeName, customColorAttributeName) { 17859 return colorValue => { 17860 const colorObject = getColorObjectByColorValue(this.props.colors, colorValue); 17861 this.props.setAttributes({ 17862 [colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : undefined, 17863 [customColorAttributeName]: colorObject && colorObject.slug ? undefined : colorValue 17864 }); 17865 }; 17866 } 17867 17868 static getDerivedStateFromProps({ 17869 attributes, 17870 colors 17871 }, previousState) { 17872 return Object(external_lodash_["reduce"])(colorMap, (newState, colorContext, colorAttributeName) => { 17873 const colorObject = getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes[`custom${Object(external_lodash_["upperFirst"])(colorAttributeName)}`]); 17874 const previousColorObject = previousState[colorAttributeName]; 17875 const previousColor = previousColorObject === null || previousColorObject === void 0 ? void 0 : previousColorObject.color; 17876 /** 17877 * The "and previousColorObject" condition checks that a previous color object was already computed. 17878 * At the start previousColorObject and colorValue are both equal to undefined 17879 * bus as previousColorObject does not exist we should compute the object. 17880 */ 17881 17882 if (previousColor === colorObject.color && previousColorObject) { 17883 newState[colorAttributeName] = previousColorObject; 17884 } else { 17885 newState[colorAttributeName] = { ...colorObject, 17886 class: getColorClassName(colorContext, colorObject.slug) 17887 }; 17888 } 17889 17890 return newState; 17891 }, {}); 17892 } 17893 17894 render() { 17895 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props, { 17896 colors: undefined 17897 }, this.state, this.setters, { 17898 colorUtils: this.colorUtils 17899 })); 17900 } 17901 17902 }; 17903 }]); 17904 } 17905 /** 17906 * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic 17907 * for class generation color value, retrieval and color attribute setting. 17908 * 17909 * Use this higher-order component to work with a custom set of colors. 17910 * 17911 * @example 17912 * 17913 * ```jsx 17914 * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ]; 17915 * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS ); 17916 * // ... 17917 * export default compose( 17918 * withCustomColors( 'backgroundColor', 'borderColor' ), 17919 * MyColorfulComponent, 17920 * ); 17921 * ``` 17922 * 17923 * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ). 17924 * 17925 * @return {Function} Higher-order component. 17926 */ 17927 17928 17929 function createCustomColorsHOC(colorsArray) { 17930 return (...colorTypes) => { 17931 const withColorPalette = withCustomColorPalette(colorsArray); 17932 return Object(external_wp_compose_["createHigherOrderComponent"])(createColorHOC(colorTypes, withColorPalette), 'withCustomColors'); 17933 }; 17934 } 17935 /** 17936 * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting. 17937 * 17938 * For use with the default editor/theme color palette. 17939 * 17940 * @example 17941 * 17942 * ```jsx 17943 * export default compose( 17944 * withColors( 'backgroundColor', { textColor: 'color' } ), 17945 * MyColorfulComponent, 17946 * ); 17947 * ``` 17948 * 17949 * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object, 17950 * it should contain the color attribute name as key and the color context as value. 17951 * If the argument is a string the value should be the color attribute name, 17952 * the color context is computed by applying a kebab case transform to the value. 17953 * Color context represents the context/place where the color is going to be used. 17954 * The class name of the color is generated using 'has' followed by the color name 17955 * and ending with the color context all in kebab case e.g: has-green-background-color. 17956 * 17957 * @return {Function} Higher-order component. 17958 */ 17959 17960 function withColors(...colorTypes) { 17961 const withColorPalette = withEditorColorPalette(); 17962 return Object(external_wp_compose_["createHigherOrderComponent"])(createColorHOC(colorTypes, withColorPalette), 'withColors'); 17963 } 17964 17965 // EXTERNAL MODULE: ./node_modules/memize/index.js 17966 var memize = __webpack_require__("4eJC"); 17967 var memize_default = /*#__PURE__*/__webpack_require__.n(memize); 17968 17969 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/panel-color-settings/index.js 17970 17971 17972 17973 /** 17974 * Internal dependencies 17975 */ 17976 17977 17978 const PanelColorSettings = ({ 17979 colorSettings, 17980 ...props 17981 }) => { 17982 const settings = colorSettings.map(({ 17983 value, 17984 onChange, 17985 ...otherSettings 17986 }) => ({ ...otherSettings, 17987 colorValue: value, 17988 onColorChange: onChange 17989 })); 17990 return Object(external_wp_element_["createElement"])(panel_color_gradient_settings, Object(esm_extends["a" /* default */])({ 17991 settings: settings, 17992 gradients: [], 17993 disableCustomGradients: true 17994 }, props)); 17995 }; 17996 17997 /* harmony default export */ var panel_color_settings = (PanelColorSettings); 17998 17999 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/color-panel.js 18000 18001 18002 18003 /** 18004 * External dependencies 18005 */ 18006 18007 /** 18008 * Internal dependencies 18009 */ 18010 18011 18012 18013 18014 const resolveContrastCheckerColor = (color, colorSettings, detectedColor) => { 18015 if (typeof color === 'function') { 18016 return color(colorSettings); 18017 } else if (color === true) { 18018 return detectedColor; 18019 } 18020 18021 return color; 18022 }; 18023 18024 function color_panel_ColorPanel({ 18025 title, 18026 colorSettings, 18027 colorPanelProps, 18028 contrastCheckers, 18029 detectedBackgroundColor, 18030 detectedColor, 18031 panelChildren, 18032 initialOpen 18033 }) { 18034 return Object(external_wp_element_["createElement"])(panel_color_settings, Object(esm_extends["a" /* default */])({ 18035 title: title, 18036 initialOpen: initialOpen, 18037 colorSettings: Object.values(colorSettings) 18038 }, colorPanelProps), contrastCheckers && (Array.isArray(contrastCheckers) ? contrastCheckers.map(({ 18039 backgroundColor, 18040 textColor, 18041 ...rest 18042 }) => { 18043 backgroundColor = resolveContrastCheckerColor(backgroundColor, colorSettings, detectedBackgroundColor); 18044 textColor = resolveContrastCheckerColor(textColor, colorSettings, detectedColor); 18045 return Object(external_wp_element_["createElement"])(contrast_checker, Object(esm_extends["a" /* default */])({ 18046 key: `${backgroundColor}-${textColor}`, 18047 backgroundColor: backgroundColor, 18048 textColor: textColor 18049 }, rest)); 18050 }) : Object(external_lodash_["map"])(colorSettings, ({ 18051 value 18052 }) => { 18053 let { 18054 backgroundColor, 18055 textColor 18056 } = contrastCheckers; 18057 backgroundColor = resolveContrastCheckerColor(backgroundColor || value, colorSettings, detectedBackgroundColor); 18058 textColor = resolveContrastCheckerColor(textColor || value, colorSettings, detectedColor); 18059 return Object(external_wp_element_["createElement"])(contrast_checker, Object(esm_extends["a" /* default */])({}, contrastCheckers, { 18060 key: `${backgroundColor}-${textColor}`, 18061 backgroundColor: backgroundColor, 18062 textColor: textColor 18063 })); 18064 })), typeof panelChildren === 'function' ? panelChildren(colorSettings) : panelChildren); 18065 } 18066 18067 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/use-colors.js 18068 18069 18070 /** 18071 * External dependencies 18072 */ 18073 18074 18075 18076 /** 18077 * WordPress dependencies 18078 */ 18079 18080 18081 18082 18083 /** 18084 * Internal dependencies 18085 */ 18086 18087 18088 18089 18090 18091 18092 18093 function use_colors_getComputedStyle(node) { 18094 return node.ownerDocument.defaultView.getComputedStyle(node); 18095 } 18096 18097 const use_colors_DEFAULT_COLORS = []; 18098 const COMMON_COLOR_LABELS = { 18099 textColor: Object(external_wp_i18n_["__"])('Text color'), 18100 backgroundColor: Object(external_wp_i18n_["__"])('Background color') 18101 }; 18102 18103 const InspectorControlsColorPanel = props => Object(external_wp_element_["createElement"])(inspector_controls, null, Object(external_wp_element_["createElement"])(color_panel_ColorPanel, props)); 18104 18105 function __experimentalUseColors(colorConfigs, { 18106 panelTitle = Object(external_wp_i18n_["__"])('Color'), 18107 colorPanelProps, 18108 contrastCheckers, 18109 panelChildren, 18110 colorDetector: { 18111 targetRef, 18112 backgroundColorTargetRef = targetRef, 18113 textColorTargetRef = targetRef 18114 } = {} 18115 } = { 18116 panelTitle: Object(external_wp_i18n_["__"])('Color') 18117 }, deps = []) { 18118 const { 18119 clientId 18120 } = useBlockEditContext(); 18121 const settingsColors = useSetting('color.palette') || use_colors_DEFAULT_COLORS; 18122 const { 18123 attributes 18124 } = Object(external_wp_data_["useSelect"])(select => { 18125 const { 18126 getBlockAttributes 18127 } = select(store); 18128 return { 18129 attributes: getBlockAttributes(clientId) 18130 }; 18131 }, [clientId]); 18132 const { 18133 updateBlockAttributes 18134 } = Object(external_wp_data_["useDispatch"])(store); 18135 const setAttributes = Object(external_wp_element_["useCallback"])(newAttributes => updateBlockAttributes(clientId, newAttributes), [updateBlockAttributes, clientId]); 18136 const createComponent = Object(external_wp_element_["useMemo"])(() => memize_default()((name, property, className, color, colorValue, customColor) => ({ 18137 children, 18138 className: componentClassName = '', 18139 style: componentStyle = {} 18140 }) => { 18141 let colorStyle = {}; 18142 18143 if (color) { 18144 colorStyle = { 18145 [property]: colorValue 18146 }; 18147 } else if (customColor) { 18148 colorStyle = { 18149 [property]: customColor 18150 }; 18151 } 18152 18153 const extraProps = { 18154 className: classnames_default()(componentClassName, { 18155 [`has-${Object(external_lodash_["kebabCase"])(color)}-${Object(external_lodash_["kebabCase"])(property)}`]: color, 18156 [className || `has-${Object(external_lodash_["kebabCase"])(name)}`]: color || customColor 18157 }), 18158 style: { ...colorStyle, 18159 ...componentStyle 18160 } 18161 }; 18162 18163 if (Object(external_lodash_["isFunction"])(children)) { 18164 return children(extraProps); 18165 } 18166 18167 return (// Clone children, setting the style property from the color configuration, 18168 // if not already set explicitly through props. 18169 external_wp_element_["Children"].map(children, child => { 18170 return Object(external_wp_element_["cloneElement"])(child, { 18171 className: classnames_default()(child.props.className, extraProps.className), 18172 style: { ...extraProps.style, 18173 ...(child.props.style || {}) 18174 } 18175 }); 18176 }) 18177 ); 18178 }, { 18179 maxSize: colorConfigs.length 18180 }), [colorConfigs.length]); 18181 const createSetColor = Object(external_wp_element_["useMemo"])(() => memize_default()((name, colors) => newColor => { 18182 const color = colors.find(_color => _color.color === newColor); 18183 setAttributes({ 18184 [color ? Object(external_lodash_["camelCase"])(`custom ${name}`) : name]: undefined 18185 }); 18186 setAttributes({ 18187 [color ? name : Object(external_lodash_["camelCase"])(`custom ${name}`)]: color ? color.slug : newColor 18188 }); 18189 }, { 18190 maxSize: colorConfigs.length 18191 }), [setAttributes, colorConfigs.length]); 18192 const [detectedBackgroundColor, setDetectedBackgroundColor] = Object(external_wp_element_["useState"])(); 18193 const [detectedColor, setDetectedColor] = Object(external_wp_element_["useState"])(); 18194 Object(external_wp_element_["useEffect"])(() => { 18195 if (!contrastCheckers) { 18196 return undefined; 18197 } 18198 18199 let needsBackgroundColor = false; 18200 let needsColor = false; 18201 18202 for (const { 18203 backgroundColor, 18204 textColor 18205 } of Object(external_lodash_["castArray"])(contrastCheckers)) { 18206 if (!needsBackgroundColor) { 18207 needsBackgroundColor = backgroundColor === true; 18208 } 18209 18210 if (!needsColor) { 18211 needsColor = textColor === true; 18212 } 18213 18214 if (needsBackgroundColor && needsColor) { 18215 break; 18216 } 18217 } 18218 18219 if (needsColor) { 18220 setDetectedColor(use_colors_getComputedStyle(textColorTargetRef.current).color); 18221 } 18222 18223 if (needsBackgroundColor) { 18224 let backgroundColorNode = backgroundColorTargetRef.current; 18225 let backgroundColor = use_colors_getComputedStyle(backgroundColorNode).backgroundColor; 18226 18227 while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) { 18228 backgroundColorNode = backgroundColorNode.parentNode; 18229 backgroundColor = use_colors_getComputedStyle(backgroundColorNode).backgroundColor; 18230 } 18231 18232 setDetectedBackgroundColor(backgroundColor); 18233 } 18234 }, [colorConfigs.reduce((acc, colorConfig) => `${acc} | ${attributes[colorConfig.name]} | ${attributes[Object(external_lodash_["camelCase"])(`custom ${colorConfig.name}`)]}`, ''), ...deps]); 18235 return Object(external_wp_element_["useMemo"])(() => { 18236 const colorSettings = {}; 18237 const components = colorConfigs.reduce((acc, colorConfig) => { 18238 if (typeof colorConfig === 'string') { 18239 colorConfig = { 18240 name: colorConfig 18241 }; 18242 } 18243 18244 const { 18245 name, 18246 // E.g. 'backgroundColor'. 18247 property = name, 18248 // E.g. 'backgroundColor'. 18249 className, 18250 panelLabel = colorConfig.label || COMMON_COLOR_LABELS[name] || Object(external_lodash_["startCase"])(name), 18251 // E.g. 'Background color'. 18252 componentName = Object(external_lodash_["startCase"])(name).replace(/\s/g, ''), 18253 // E.g. 'BackgroundColor'. 18254 color = colorConfig.color, 18255 colors = settingsColors 18256 } = { ...colorConfig, 18257 color: attributes[colorConfig.name] 18258 }; 18259 const customColor = attributes[Object(external_lodash_["camelCase"])(`custom ${name}`)]; // We memoize the non-primitives to avoid unnecessary updates 18260 // when they are used as props for other components. 18261 18262 const _color = customColor ? undefined : colors.find(__color => __color.slug === color); 18263 18264 acc[componentName] = createComponent(name, property, className, color, _color && _color.color, customColor); 18265 acc[componentName].displayName = componentName; 18266 acc[componentName].color = customColor ? customColor : _color && _color.color; 18267 acc[componentName].slug = color; 18268 acc[componentName].setColor = createSetColor(name, colors); 18269 colorSettings[componentName] = { 18270 value: _color ? _color.color : attributes[Object(external_lodash_["camelCase"])(`custom ${name}`)], 18271 onChange: acc[componentName].setColor, 18272 label: panelLabel, 18273 colors 18274 }; // These settings will be spread over the `colors` in 18275 // `colorPanelProps`, so we need to unset the key here, 18276 // if not set to an actual value, to avoid overwriting 18277 // an actual value in `colorPanelProps`. 18278 18279 if (!colors) { 18280 delete colorSettings[componentName].colors; 18281 } 18282 18283 return acc; 18284 }, {}); 18285 const wrappedColorPanelProps = { 18286 title: panelTitle, 18287 initialOpen: false, 18288 colorSettings, 18289 colorPanelProps, 18290 contrastCheckers, 18291 detectedBackgroundColor, 18292 detectedColor, 18293 panelChildren 18294 }; 18295 return { ...components, 18296 ColorPanel: Object(external_wp_element_["createElement"])(color_panel_ColorPanel, wrappedColorPanelProps), 18297 InspectorControlsColorPanel: Object(external_wp_element_["createElement"])(InspectorControlsColorPanel, wrappedColorPanelProps) 18298 }; 18299 }, [attributes, setAttributes, detectedColor, detectedBackgroundColor, ...deps]); 18300 } 18301 18302 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js 18303 18304 18305 18306 18307 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js 18308 18309 18310 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js 18311 18312 18313 18314 /** 18315 * External dependencies 18316 */ 18317 18318 /** 18319 * WordPress dependencies 18320 */ 18321 18322 18323 18324 /** 18325 * Internal dependencies 18326 */ 18327 18328 18329 18330 const DEFAULT_FONT_SIZES = []; 18331 /** 18332 * Higher-order component, which handles font size logic for class generation, 18333 * font size value retrieval, and font size change handling. 18334 * 18335 * @param {...(Object|string)} fontSizeNames The arguments should all be strings. 18336 * Each string contains the font size 18337 * attribute name e.g: 'fontSize'. 18338 * 18339 * @return {Function} Higher-order component. 18340 */ 18341 18342 /* harmony default export */ var with_font_sizes = ((...fontSizeNames) => { 18343 /* 18344 * Computes an object whose key is the font size attribute name as passed in the array, 18345 * and the value is the custom font size attribute name. 18346 * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized. 18347 */ 18348 const fontSizeAttributeNames = Object(external_lodash_["reduce"])(fontSizeNames, (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => { 18349 fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${Object(external_lodash_["upperFirst"])(fontSizeAttributeName)}`; 18350 return fontSizeAttributeNamesAccumulator; 18351 }, {}); 18352 return Object(external_wp_compose_["createHigherOrderComponent"])(Object(external_wp_compose_["compose"])([Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => { 18353 const fontSizes = useSetting('typography.fontSizes') || DEFAULT_FONT_SIZES; 18354 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { 18355 fontSizes: fontSizes 18356 })); 18357 }, 'withFontSizes'), WrappedComponent => { 18358 return class extends external_wp_element_["Component"] { 18359 constructor(props) { 18360 super(props); 18361 this.setters = this.createSetters(); 18362 this.state = {}; 18363 } 18364 18365 createSetters() { 18366 return Object(external_lodash_["reduce"])(fontSizeAttributeNames, (settersAccumulator, customFontSizeAttributeName, fontSizeAttributeName) => { 18367 const upperFirstFontSizeAttributeName = Object(external_lodash_["upperFirst"])(fontSizeAttributeName); 18368 settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName); 18369 return settersAccumulator; 18370 }, {}); 18371 } 18372 18373 createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { 18374 return fontSizeValue => { 18375 const fontSizeObject = Object(external_lodash_["find"])(this.props.fontSizes, { 18376 size: Number(fontSizeValue) 18377 }); 18378 this.props.setAttributes({ 18379 [fontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : undefined, 18380 [customFontSizeAttributeName]: fontSizeObject && fontSizeObject.slug ? undefined : fontSizeValue 18381 }); 18382 }; 18383 } 18384 18385 static getDerivedStateFromProps({ 18386 attributes, 18387 fontSizes 18388 }, previousState) { 18389 const didAttributesChange = (customFontSizeAttributeName, fontSizeAttributeName) => { 18390 if (previousState[fontSizeAttributeName]) { 18391 // if new font size is name compare with the previous slug 18392 if (attributes[fontSizeAttributeName]) { 18393 return attributes[fontSizeAttributeName] !== previousState[fontSizeAttributeName].slug; 18394 } // if font size is not named, update when the font size value changes. 18395 18396 18397 return previousState[fontSizeAttributeName].size !== attributes[customFontSizeAttributeName]; 18398 } // in this case we need to build the font size object 18399 18400 18401 return true; 18402 }; 18403 18404 if (!Object(external_lodash_["some"])(fontSizeAttributeNames, didAttributesChange)) { 18405 return null; 18406 } 18407 18408 const newState = Object(external_lodash_["reduce"])(Object(external_lodash_["pickBy"])(fontSizeAttributeNames, didAttributesChange), (newStateAccumulator, customFontSizeAttributeName, fontSizeAttributeName) => { 18409 const fontSizeAttributeValue = attributes[fontSizeAttributeName]; 18410 const fontSizeObject = getFontSize(fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName]); 18411 newStateAccumulator[fontSizeAttributeName] = { ...fontSizeObject, 18412 class: getFontSizeClass(fontSizeAttributeValue) 18413 }; 18414 return newStateAccumulator; 18415 }, {}); 18416 return { ...previousState, 18417 ...newState 18418 }; 18419 } 18420 18421 render() { 18422 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props, { 18423 fontSizes: undefined 18424 }, this.state, this.setters)); 18425 } 18426 18427 }; 18428 }]), 'withFontSizes'); 18429 }); 18430 18431 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/index.js 18432 18433 18434 18435 18436 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js 18437 var align_left = __webpack_require__("fPbg"); 18438 18439 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js 18440 var align_center = __webpack_require__("plpT"); 18441 18442 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js 18443 var align_right = __webpack_require__("ziDm"); 18444 18445 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js 18446 18447 18448 18449 /** 18450 * External dependencies 18451 */ 18452 18453 /** 18454 * WordPress dependencies 18455 */ 18456 18457 18458 18459 18460 const DEFAULT_ALIGNMENT_CONTROLS = [{ 18461 icon: align_left["a" /* default */], 18462 title: Object(external_wp_i18n_["__"])('Align text left'), 18463 align: 'left' 18464 }, { 18465 icon: align_center["a" /* default */], 18466 title: Object(external_wp_i18n_["__"])('Align text center'), 18467 align: 'center' 18468 }, { 18469 icon: align_right["a" /* default */], 18470 title: Object(external_wp_i18n_["__"])('Align text right'), 18471 align: 'right' 18472 }]; 18473 const alignment_control_ui_POPOVER_PROPS = { 18474 position: 'bottom right', 18475 isAlternate: true 18476 }; 18477 18478 function AlignmentUI({ 18479 value, 18480 onChange, 18481 alignmentControls = DEFAULT_ALIGNMENT_CONTROLS, 18482 label = Object(external_wp_i18n_["__"])('Align'), 18483 describedBy = Object(external_wp_i18n_["__"])('Change text alignment'), 18484 isCollapsed = true, 18485 isToolbar 18486 }) { 18487 function applyOrUnset(align) { 18488 return () => onChange(value === align ? undefined : align); 18489 } 18490 18491 const activeAlignment = Object(external_lodash_["find"])(alignmentControls, control => control.align === value); 18492 18493 function setIcon() { 18494 if (activeAlignment) return activeAlignment.icon; 18495 return Object(external_wp_i18n_["isRTL"])() ? align_right["a" /* default */] : align_left["a" /* default */]; 18496 } 18497 18498 const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; 18499 const extraProps = isToolbar ? { 18500 isCollapsed 18501 } : {}; 18502 return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ 18503 icon: setIcon(), 18504 label: label, 18505 toggleProps: { 18506 describedBy 18507 }, 18508 popoverProps: alignment_control_ui_POPOVER_PROPS, 18509 controls: alignmentControls.map(control => { 18510 const { 18511 align 18512 } = control; 18513 const isActive = value === align; 18514 return { ...control, 18515 isActive, 18516 role: isCollapsed ? 'menuitemradio' : undefined, 18517 onClick: applyOrUnset(align) 18518 }; 18519 }) 18520 }, extraProps)); 18521 } 18522 18523 /* harmony default export */ var alignment_control_ui = (AlignmentUI); 18524 18525 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/index.js 18526 18527 18528 18529 /** 18530 * Internal dependencies 18531 */ 18532 18533 function AlignmentControl(props) { 18534 return Object(external_wp_element_["createElement"])(alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { 18535 isToolbar: false 18536 })); 18537 } 18538 function AlignmentToolbar(props) { 18539 return Object(external_wp_element_["createElement"])(alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { 18540 isToolbar: true 18541 })); 18542 } 18543 18544 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-items.js 18545 /** 18546 * External dependencies 18547 */ 18548 // Default search helpers 18549 18550 const defaultGetName = item => item.name || ''; 18551 18552 const defaultGetTitle = item => item.title; 18553 18554 const defaultGetDescription = item => item.description || ''; 18555 18556 const defaultGetKeywords = item => item.keywords || []; 18557 18558 const defaultGetCategory = item => item.category; 18559 18560 const defaultGetCollection = () => null; 18561 /** 18562 * Sanitizes the search input string. 18563 * 18564 * @param {string} input The search input to normalize. 18565 * 18566 * @return {string} The normalized search input. 18567 */ 18568 18569 18570 function normalizeSearchInput(input = '') { 18571 // Disregard diacritics. 18572 // Input: "média" 18573 input = Object(external_lodash_["deburr"])(input); // Accommodate leading slash, matching autocomplete expectations. 18574 // Input: "/media" 18575 18576 input = input.replace(/^\//, ''); // Lowercase. 18577 // Input: "MEDIA" 18578 18579 input = input.toLowerCase(); 18580 return input; 18581 } 18582 /** 18583 * Converts the search term into a list of normalized terms. 18584 * 18585 * @param {string} input The search term to normalize. 18586 * 18587 * @return {string[]} The normalized list of search terms. 18588 */ 18589 18590 18591 const getNormalizedSearchTerms = (input = '') => { 18592 // Extract words. 18593 return Object(external_lodash_["words"])(normalizeSearchInput(input)); 18594 }; 18595 18596 const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 18597 return Object(external_lodash_["differenceWith"])(unmatchedTerms, getNormalizedSearchTerms(unprocessedTerms), (unmatchedTerm, unprocessedTerm) => unprocessedTerm.includes(unmatchedTerm)); 18598 }; 18599 18600 const searchBlockItems = (items, categories, collections, searchInput) => { 18601 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 18602 18603 if (normalizedSearchTerms.length === 0) { 18604 return items; 18605 } 18606 18607 const config = { 18608 getCategory: item => { 18609 var _find; 18610 18611 return (_find = Object(external_lodash_["find"])(categories, { 18612 slug: item.category 18613 })) === null || _find === void 0 ? void 0 : _find.title; 18614 }, 18615 getCollection: item => { 18616 var _collections$item$nam; 18617 18618 return (_collections$item$nam = collections[item.name.split('/')[0]]) === null || _collections$item$nam === void 0 ? void 0 : _collections$item$nam.title; 18619 } 18620 }; 18621 return searchItems(items, searchInput, config); 18622 }; 18623 /** 18624 * Filters an item list given a search term. 18625 * 18626 * @param {Array} items Item list 18627 * @param {string} searchInput Search input. 18628 * @param {Object} config Search Config. 18629 * @return {Array} Filtered item list. 18630 */ 18631 18632 const searchItems = (items = [], searchInput = '', config = {}) => { 18633 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 18634 18635 if (normalizedSearchTerms.length === 0) { 18636 return items; 18637 } 18638 18639 const rankedItems = items.map(item => { 18640 return [item, getItemSearchRank(item, searchInput, config)]; 18641 }).filter(([, rank]) => rank > 0); 18642 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 18643 return rankedItems.map(([item]) => item); 18644 }; 18645 /** 18646 * Get the search rank for a given item and a specific search term. 18647 * The better the match, the higher the rank. 18648 * If the rank equals 0, it should be excluded from the results. 18649 * 18650 * @param {Object} item Item to filter. 18651 * @param {string} searchTerm Search term. 18652 * @param {Object} config Search Config. 18653 * @return {number} Search Rank. 18654 */ 18655 18656 function getItemSearchRank(item, searchTerm, config = {}) { 18657 const { 18658 getName = defaultGetName, 18659 getTitle = defaultGetTitle, 18660 getDescription = defaultGetDescription, 18661 getKeywords = defaultGetKeywords, 18662 getCategory = defaultGetCategory, 18663 getCollection = defaultGetCollection 18664 } = config; 18665 const name = getName(item); 18666 const title = getTitle(item); 18667 const description = getDescription(item); 18668 const keywords = getKeywords(item); 18669 const category = getCategory(item); 18670 const collection = getCollection(item); 18671 const normalizedSearchInput = normalizeSearchInput(searchTerm); 18672 const normalizedTitle = normalizeSearchInput(title); 18673 let rank = 0; // Prefers exact matches 18674 // Then prefers if the beginning of the title matches the search term 18675 // name, keywords, categories, collection, variations match come later. 18676 18677 if (normalizedSearchInput === normalizedTitle) { 18678 rank += 30; 18679 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 18680 rank += 20; 18681 } else { 18682 const terms = [name, title, description, ...keywords, category, collection].join(' '); 18683 const normalizedSearchTerms = Object(external_lodash_["words"])(normalizedSearchInput); 18684 const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms); 18685 18686 if (unmatchedTerms.length === 0) { 18687 rank += 10; 18688 } 18689 } // Give a better rank to "core" namespaced items. 18690 18691 18692 if (rank !== 0 && name.startsWith('core/')) { 18693 rank++; 18694 } 18695 18696 return rank; 18697 } 18698 18699 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-block-types-state.js 18700 /** 18701 * WordPress dependencies 18702 */ 18703 18704 18705 18706 /** 18707 * Internal dependencies 18708 */ 18709 18710 18711 /** 18712 * Retrieves the block types inserter state. 18713 * 18714 * @param {string=} rootClientId Insertion's root client ID. 18715 * @param {Function} onInsert function called when inserter a list of blocks. 18716 * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler) 18717 */ 18718 18719 const useBlockTypesState = (rootClientId, onInsert) => { 18720 const { 18721 categories, 18722 collections, 18723 items 18724 } = Object(external_wp_data_["useSelect"])(select => { 18725 const { 18726 getInserterItems 18727 } = select(store); 18728 const { 18729 getCategories, 18730 getCollections 18731 } = select(external_wp_blocks_["store"]); 18732 return { 18733 categories: getCategories(), 18734 collections: getCollections(), 18735 items: getInserterItems(rootClientId) 18736 }; 18737 }, [rootClientId]); 18738 const onSelectItem = Object(external_wp_element_["useCallback"])(({ 18739 name, 18740 initialAttributes, 18741 innerBlocks 18742 }, shouldFocusBlock) => { 18743 const insertedBlock = Object(external_wp_blocks_["createBlock"])(name, initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocks)); 18744 onInsert(insertedBlock, undefined, shouldFocusBlock); 18745 }, [onInsert]); 18746 return [items, categories, collections, onSelectItem]; 18747 }; 18748 18749 /* harmony default export */ var use_block_types_state = (useBlockTypesState); 18750 18751 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js 18752 var block_default = __webpack_require__("//Lo"); 18753 18754 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js 18755 18756 18757 /** 18758 * External dependencies 18759 */ 18760 18761 /** 18762 * WordPress dependencies 18763 */ 18764 18765 18766 18767 function BlockIcon({ 18768 icon, 18769 showColors = false, 18770 className 18771 }) { 18772 var _icon; 18773 18774 if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') { 18775 icon = { 18776 src: block_default["a" /* default */] 18777 }; 18778 } 18779 18780 const renderedIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], { 18781 icon: icon && icon.src ? icon.src : icon 18782 }); 18783 const style = showColors ? { 18784 backgroundColor: icon && icon.background, 18785 color: icon && icon.foreground 18786 } : {}; 18787 return Object(external_wp_element_["createElement"])("span", { 18788 style: style, 18789 className: classnames_default()('block-editor-block-icon', className, { 18790 'has-colors': showColors 18791 }) 18792 }, renderedIcon); 18793 } 18794 18795 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js 18796 18797 18798 /** 18799 * External dependencies 18800 */ 18801 18802 /** 18803 * WordPress dependencies 18804 */ 18805 18806 18807 18808 18809 /** 18810 * Internal dependencies 18811 */ 18812 18813 18814 18815 18816 18817 const SHOWN_BLOCK_TYPES = 9; 18818 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ 18819 18820 /** 18821 * Creates a blocks repeater for replacing the current block with a selected block type. 18822 * 18823 * @return {WPCompleter} A blocks completer. 18824 */ 18825 18826 function createBlockCompleter() { 18827 return { 18828 name: 'blocks', 18829 className: 'block-editor-autocompleters__block', 18830 triggerPrefix: '/', 18831 18832 useItems(filterValue) { 18833 const { 18834 rootClientId, 18835 selectedBlockName 18836 } = Object(external_wp_data_["useSelect"])(select => { 18837 const { 18838 getSelectedBlockClientId, 18839 getBlockName, 18840 getBlockInsertionPoint 18841 } = select(store); 18842 const selectedBlockClientId = getSelectedBlockClientId(); 18843 return { 18844 selectedBlockName: selectedBlockClientId ? getBlockName(selectedBlockClientId) : null, 18845 rootClientId: getBlockInsertionPoint().rootClientId 18846 }; 18847 }, []); 18848 const [items, categories, collections] = use_block_types_state(rootClientId, external_lodash_["noop"]); 18849 const filteredItems = Object(external_wp_element_["useMemo"])(() => { 18850 const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(items, categories, collections, filterValue) : Object(external_lodash_["orderBy"])(items, ['frecency'], ['desc']); 18851 return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, SHOWN_BLOCK_TYPES); 18852 }, [filterValue, selectedBlockName, items, categories, collections]); 18853 const options = Object(external_wp_element_["useMemo"])(() => filteredItems.map(blockItem => { 18854 const { 18855 title, 18856 icon, 18857 isDisabled 18858 } = blockItem; 18859 return { 18860 key: `block-${blockItem.id}`, 18861 value: blockItem, 18862 label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockIcon, { 18863 key: "icon", 18864 icon: icon, 18865 showColors: true 18866 }), title), 18867 isDisabled 18868 }; 18869 }), [filteredItems]); 18870 return [options]; 18871 }, 18872 18873 allowContext(before, after) { 18874 return !(/\S/.test(before) || /\S/.test(after)); 18875 }, 18876 18877 getOptionCompletion(inserterItem) { 18878 const { 18879 name, 18880 initialAttributes, 18881 innerBlocks 18882 } = inserterItem; 18883 return { 18884 action: 'replace', 18885 value: Object(external_wp_blocks_["createBlock"])(name, initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocks)) 18886 }; 18887 } 18888 18889 }; 18890 } 18891 /** 18892 * Creates a blocks repeater for replacing the current block with a selected block type. 18893 * 18894 * @return {WPCompleter} A blocks completer. 18895 */ 18896 18897 18898 /* harmony default export */ var autocompleters_block = (createBlockCompleter()); 18899 18900 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js 18901 18902 18903 18904 /** 18905 * External dependencies 18906 */ 18907 18908 /** 18909 * WordPress dependencies 18910 */ 18911 18912 18913 18914 18915 18916 /** 18917 * Internal dependencies 18918 */ 18919 18920 18921 18922 /** 18923 * Shared reference to an empty array for cases where it is important to avoid 18924 * returning a new array reference on every invocation. 18925 * 18926 * @type {Array} 18927 */ 18928 18929 const autocomplete_EMPTY_ARRAY = []; 18930 18931 function useCompleters({ 18932 completers = autocomplete_EMPTY_ARRAY 18933 }) { 18934 const { 18935 name 18936 } = useBlockEditContext(); 18937 return Object(external_wp_element_["useMemo"])(() => { 18938 let filteredCompleters = completers; 18939 18940 if (name === Object(external_wp_blocks_["getDefaultBlockName"])()) { 18941 filteredCompleters = filteredCompleters.concat([autocompleters_block]); 18942 } 18943 18944 if (Object(external_wp_hooks_["hasFilter"])('editor.Autocomplete.completers')) { 18945 // Provide copies so filters may directly modify them. 18946 if (filteredCompleters === completers) { 18947 filteredCompleters = filteredCompleters.map(external_lodash_["clone"]); 18948 } 18949 18950 filteredCompleters = Object(external_wp_hooks_["applyFilters"])('editor.Autocomplete.completers', filteredCompleters, name); 18951 } 18952 18953 return filteredCompleters; 18954 }, [completers, name]); 18955 } 18956 18957 function useBlockEditorAutocompleteProps(props) { 18958 return Object(external_wp_components_["__unstableUseAutocompleteProps"])({ ...props, 18959 completers: useCompleters(props) 18960 }); 18961 } 18962 /** 18963 * Wrap the default Autocomplete component with one that supports a filter hook 18964 * for customizing its list of autocompleters. 18965 * 18966 * @type {import('react').FC} 18967 */ 18968 18969 function BlockEditorAutocomplete(props) { 18970 return Object(external_wp_element_["createElement"])(external_wp_components_["Autocomplete"], Object(esm_extends["a" /* default */])({}, props, { 18971 completers: useCompleters(props) 18972 })); 18973 } 18974 /** 18975 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/autocomplete/README.md 18976 */ 18977 18978 18979 /* harmony default export */ var autocomplete = (BlockEditorAutocomplete); 18980 18981 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js 18982 18983 18984 /** 18985 * WordPress dependencies 18986 */ 18987 18988 const fullscreen = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 18989 xmlns: "http://www.w3.org/2000/svg", 18990 viewBox: "0 0 24 24" 18991 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 18992 d: "M4.2 9h1.5V5.8H9V4.2H4.2V9zm14 9.2H15v1.5h4.8V15h-1.5v3.2zM15 4.2v1.5h3.2V9h1.5V4.2H15zM5.8 15H4.2v4.8H9v-1.5H5.8V15z" 18993 })); 18994 /* harmony default export */ var library_fullscreen = (fullscreen); 18995 18996 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-full-height-alignment-control/index.js 18997 18998 18999 /** 19000 * WordPress dependencies 19001 */ 19002 19003 19004 19005 19006 function BlockFullHeightAlignmentControl({ 19007 isActive, 19008 label = Object(external_wp_i18n_["__"])('Toggle full height'), 19009 onToggle, 19010 isDisabled 19011 }) { 19012 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 19013 isActive: isActive, 19014 icon: library_fullscreen, 19015 label: label, 19016 onClick: () => onToggle(!isActive), 19017 disabled: isDisabled 19018 }); 19019 } 19020 19021 /* harmony default export */ var block_full_height_alignment_control = (BlockFullHeightAlignmentControl); 19022 19023 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js 19024 19025 19026 /** 19027 * External dependencies 19028 */ 19029 19030 /** 19031 * WordPress dependencies 19032 */ 19033 19034 19035 19036 19037 19038 function BlockAlignmentMatrixControl(props) { 19039 const { 19040 label = Object(external_wp_i18n_["__"])('Change matrix alignment'), 19041 onChange = external_lodash_["noop"], 19042 value = 'center', 19043 isDisabled 19044 } = props; 19045 const icon = Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalAlignmentMatrixControl"].Icon, { 19046 value: value 19047 }); 19048 const className = 'block-editor-block-alignment-matrix-control'; 19049 const popoverClassName = `${className}__popover`; 19050 const isAlternate = true; 19051 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 19052 position: "bottom right", 19053 className: className, 19054 popoverProps: { 19055 className: popoverClassName, 19056 isAlternate 19057 }, 19058 renderToggle: ({ 19059 onToggle, 19060 isOpen 19061 }) => { 19062 const openOnArrowDown = event => { 19063 if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { 19064 event.preventDefault(); 19065 event.stopPropagation(); 19066 onToggle(); 19067 } 19068 }; 19069 19070 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 19071 onClick: onToggle, 19072 "aria-haspopup": "true", 19073 "aria-expanded": isOpen, 19074 onKeyDown: openOnArrowDown, 19075 label: label, 19076 icon: icon, 19077 showTooltip: true, 19078 disabled: isDisabled 19079 }); 19080 }, 19081 renderContent: () => Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalAlignmentMatrixControl"], { 19082 hasFocusBorder: false, 19083 onChange: onChange, 19084 value: value 19085 }) 19086 }); 19087 } 19088 19089 /* harmony default export */ var block_alignment_matrix_control = (BlockAlignmentMatrixControl); 19090 19091 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js 19092 /** 19093 * WordPress dependencies 19094 */ 19095 19096 19097 /** 19098 * Internal dependencies 19099 */ 19100 19101 19102 /** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */ 19103 19104 /** 19105 * Contains basic block's information for display reasons. 19106 * 19107 * @typedef {Object} WPBlockDisplayInformation 19108 * 19109 * @property {string} title Human-readable block type label. 19110 * @property {WPIcon} icon Block type icon. 19111 * @property {string} description A detailed block type description. 19112 */ 19113 19114 /** 19115 * Hook used to try to find a matching block variation and return 19116 * the appropriate information for display reasons. In order to 19117 * to try to find a match we need to things: 19118 * 1. Block's client id to extract it's current attributes. 19119 * 2. A block variation should have set `isActive` prop to a proper function. 19120 * 19121 * If for any reason a block variaton match cannot be found, 19122 * the returned information come from the Block Type. 19123 * If no blockType is found with the provided clientId, returns null. 19124 * 19125 * @param {string} clientId Block's client id. 19126 * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found. 19127 */ 19128 19129 function useBlockDisplayInformation(clientId) { 19130 return Object(external_wp_data_["useSelect"])(select => { 19131 if (!clientId) return null; 19132 const { 19133 getBlockName, 19134 getBlockAttributes 19135 } = select(store); 19136 const { 19137 getBlockType, 19138 getActiveBlockVariation 19139 } = select(external_wp_blocks_["store"]); 19140 const blockName = getBlockName(clientId); 19141 const blockType = getBlockType(blockName); 19142 if (!blockType) return null; 19143 const attributes = getBlockAttributes(clientId); 19144 const match = getActiveBlockVariation(blockName, attributes); 19145 const blockTypeInfo = { 19146 title: blockType.title, 19147 icon: blockType.icon, 19148 description: blockType.description, 19149 anchor: attributes === null || attributes === void 0 ? void 0 : attributes.anchor 19150 }; 19151 if (!match) return blockTypeInfo; 19152 return { 19153 title: match.title || blockType.title, 19154 icon: match.icon || blockType.icon, 19155 description: match.description || blockType.description 19156 }; 19157 }, [clientId]); 19158 } 19159 19160 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/index.js 19161 /** 19162 * External dependencies 19163 */ 19164 19165 /** 19166 * WordPress dependencies 19167 */ 19168 19169 19170 19171 /** 19172 * Internal dependencies 19173 */ 19174 19175 19176 19177 /** 19178 * Renders the block's configured title as a string, or empty if the title 19179 * cannot be determined. 19180 * 19181 * @example 19182 * 19183 * ```jsx 19184 * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" /> 19185 * ``` 19186 * 19187 * @param {Object} props 19188 * @param {string} props.clientId Client ID of block. 19189 * 19190 * @return {?string} Block title. 19191 */ 19192 19193 function BlockTitle({ 19194 clientId 19195 }) { 19196 const { 19197 attributes, 19198 name, 19199 reusableBlockTitle 19200 } = Object(external_wp_data_["useSelect"])(select => { 19201 if (!clientId) { 19202 return {}; 19203 } 19204 19205 const { 19206 getBlockName, 19207 getBlockAttributes, 19208 __experimentalGetReusableBlockTitle 19209 } = select(store); 19210 const blockName = getBlockName(clientId); 19211 19212 if (!blockName) { 19213 return {}; 19214 } 19215 19216 const isReusable = Object(external_wp_blocks_["isReusableBlock"])(Object(external_wp_blocks_["getBlockType"])(blockName)); 19217 return { 19218 attributes: getBlockAttributes(clientId), 19219 name: blockName, 19220 reusableBlockTitle: isReusable && __experimentalGetReusableBlockTitle(getBlockAttributes(clientId).ref) 19221 }; 19222 }, [clientId]); 19223 const blockInformation = useBlockDisplayInformation(clientId); 19224 if (!name || !blockInformation) return null; 19225 const blockType = Object(external_wp_blocks_["getBlockType"])(name); 19226 const label = reusableBlockTitle || Object(external_wp_blocks_["__experimentalGetBlockLabel"])(blockType, attributes); // Label will fallback to the title if no label is defined for the current 19227 // label context. If the label is defined we prioritize it over possible 19228 // possible block variation title match. 19229 19230 if (label !== blockType.title) { 19231 return Object(external_lodash_["truncate"])(label, { 19232 length: 35 19233 }); 19234 } 19235 19236 return blockInformation.title; 19237 } 19238 19239 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-breadcrumb/index.js 19240 19241 19242 /** 19243 * WordPress dependencies 19244 */ 19245 19246 19247 19248 /** 19249 * Internal dependencies 19250 */ 19251 19252 19253 19254 /** 19255 * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb. 19256 * 19257 * @param {Object} props Component props. 19258 * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail. 19259 * @return {WPElement} Block Breadcrumb. 19260 */ 19261 19262 function BlockBreadcrumb({ 19263 rootLabelText 19264 }) { 19265 const { 19266 selectBlock, 19267 clearSelectedBlock 19268 } = Object(external_wp_data_["useDispatch"])(store); 19269 const { 19270 clientId, 19271 parents, 19272 hasSelection 19273 } = Object(external_wp_data_["useSelect"])(select => { 19274 const { 19275 getSelectionStart, 19276 getSelectedBlockClientId, 19277 getBlockParents 19278 } = select(store); 19279 const selectedBlockClientId = getSelectedBlockClientId(); 19280 return { 19281 parents: getBlockParents(selectedBlockClientId), 19282 clientId: selectedBlockClientId, 19283 hasSelection: !!getSelectionStart().clientId 19284 }; 19285 }, []); 19286 19287 const rootLabel = rootLabelText || Object(external_wp_i18n_["__"])('Document'); 19288 /* 19289 * Disable reason: The `list` ARIA role is redundant but 19290 * Safari+VoiceOver won't announce the list otherwise. 19291 */ 19292 19293 /* eslint-disable jsx-a11y/no-redundant-roles */ 19294 19295 19296 return Object(external_wp_element_["createElement"])("ul", { 19297 className: "block-editor-block-breadcrumb", 19298 role: "list", 19299 "aria-label": Object(external_wp_i18n_["__"])('Block breadcrumb') 19300 }, Object(external_wp_element_["createElement"])("li", { 19301 className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined, 19302 "aria-current": !hasSelection ? 'true' : undefined 19303 }, hasSelection && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 19304 className: "block-editor-block-breadcrumb__button", 19305 isTertiary: true, 19306 onClick: clearSelectedBlock 19307 }, rootLabel), !hasSelection && rootLabel), parents.map(parentClientId => Object(external_wp_element_["createElement"])("li", { 19308 key: parentClientId 19309 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 19310 className: "block-editor-block-breadcrumb__button", 19311 isTertiary: true, 19312 onClick: () => selectBlock(parentClientId) 19313 }, Object(external_wp_element_["createElement"])(BlockTitle, { 19314 clientId: parentClientId 19315 })))), !!clientId && Object(external_wp_element_["createElement"])("li", { 19316 className: "block-editor-block-breadcrumb__current", 19317 "aria-current": "true" 19318 }, Object(external_wp_element_["createElement"])(BlockTitle, { 19319 clientId: clientId 19320 }))) 19321 /* eslint-enable jsx-a11y/no-redundant-roles */ 19322 ; 19323 } 19324 19325 /* harmony default export */ var block_breadcrumb = (BlockBreadcrumb); 19326 19327 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js 19328 19329 19330 /** 19331 * WordPress dependencies 19332 */ 19333 19334 /** @typedef {import('react').ReactNode} ReactNode */ 19335 19336 /** 19337 * @typedef BlockContextProviderProps 19338 * 19339 * @property {Record<string,*>} value Context value to merge with current 19340 * value. 19341 * @property {ReactNode} children Component children. 19342 */ 19343 19344 /** @type {import('react').Context<Record<string,*>>} */ 19345 19346 const block_context_Context = Object(external_wp_element_["createContext"])({}); 19347 /** 19348 * Component which merges passed value with current consumed block context. 19349 * 19350 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md 19351 * 19352 * @param {BlockContextProviderProps} props 19353 */ 19354 19355 function BlockContextProvider({ 19356 value, 19357 children 19358 }) { 19359 const context = Object(external_wp_element_["useContext"])(block_context_Context); 19360 const nextValue = Object(external_wp_element_["useMemo"])(() => ({ ...context, 19361 ...value 19362 }), [context, value]); 19363 return Object(external_wp_element_["createElement"])(block_context_Context.Provider, { 19364 value: nextValue, 19365 children: children 19366 }); 19367 } 19368 /* harmony default export */ var block_context = (block_context_Context); 19369 19370 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js 19371 19372 19373 /** 19374 * WordPress dependencies 19375 */ 19376 19377 19378 19379 19380 const ColorSelectorSVGIcon = () => Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 19381 xmlns: "https://www.w3.org/2000/svg", 19382 viewBox: "0 0 20 20" 19383 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 19384 d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z" 19385 })); 19386 /** 19387 * Color Selector Icon component. 19388 * 19389 * @param {Object} props Component properties. 19390 * @param {Object} props.style Style object. 19391 * @param {string} props.className Class name for component. 19392 * 19393 * @return {*} React Icon component. 19394 */ 19395 19396 19397 const ColorSelectorIcon = ({ 19398 style, 19399 className 19400 }) => { 19401 return Object(external_wp_element_["createElement"])("div", { 19402 className: "block-library-colors-selector__icon-container" 19403 }, Object(external_wp_element_["createElement"])("div", { 19404 className: `${className} block-library-colors-selector__state-selection`, 19405 style: style 19406 }, Object(external_wp_element_["createElement"])(ColorSelectorSVGIcon, null))); 19407 }; 19408 /** 19409 * Renders the Colors Selector Toolbar with the icon button. 19410 * 19411 * @param {Object} props Component properties. 19412 * @param {Object} props.TextColor Text color component that wraps icon. 19413 * @param {Object} props.BackgroundColor Background color component that wraps icon. 19414 * 19415 * @return {*} React toggle button component. 19416 */ 19417 19418 19419 const renderToggleComponent = ({ 19420 TextColor, 19421 BackgroundColor 19422 }) => ({ 19423 onToggle, 19424 isOpen 19425 }) => { 19426 const openOnArrowDown = event => { 19427 if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { 19428 event.preventDefault(); 19429 event.stopPropagation(); 19430 onToggle(); 19431 } 19432 }; 19433 19434 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 19435 className: "components-toolbar__control block-library-colors-selector__toggle", 19436 label: Object(external_wp_i18n_["__"])('Open Colors Selector'), 19437 onClick: onToggle, 19438 onKeyDown: openOnArrowDown, 19439 icon: Object(external_wp_element_["createElement"])(BackgroundColor, null, Object(external_wp_element_["createElement"])(TextColor, null, Object(external_wp_element_["createElement"])(ColorSelectorIcon, null))) 19440 })); 19441 }; 19442 19443 const BlockColorsStyleSelector = ({ 19444 children, 19445 ...other 19446 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 19447 position: "bottom right", 19448 className: "block-library-colors-selector", 19449 contentClassName: "block-library-colors-selector__popover", 19450 renderToggle: renderToggleComponent(other), 19451 renderContent: () => children 19452 }); 19453 19454 /* harmony default export */ var color_style_selector = (BlockColorsStyleSelector); 19455 19456 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js 19457 19458 19459 19460 /** 19461 * External dependencies 19462 */ 19463 19464 19465 /** 19466 * WordPress dependencies 19467 */ 19468 19469 19470 19471 19472 /** 19473 * Internal dependencies 19474 */ 19475 19476 19477 /** 19478 * Default value used for blocks which do not define their own context needs, 19479 * used to guarantee that a block's `context` prop will always be an object. It 19480 * is assigned as a constant since it is always expected to be an empty object, 19481 * and in order to avoid unnecessary React reconciliations of a changing object. 19482 * 19483 * @type {{}} 19484 */ 19485 19486 const DEFAULT_BLOCK_CONTEXT = {}; 19487 const edit_Edit = props => { 19488 const { 19489 attributes = {}, 19490 name 19491 } = props; 19492 const blockType = Object(external_wp_blocks_["getBlockType"])(name); 19493 const blockContext = Object(external_wp_element_["useContext"])(block_context); // Assign context values using the block type's declared context needs. 19494 19495 const context = Object(external_wp_element_["useMemo"])(() => { 19496 return blockType && blockType.usesContext ? Object(external_lodash_["pick"])(blockContext, blockType.usesContext) : DEFAULT_BLOCK_CONTEXT; 19497 }, [blockType, blockContext]); 19498 19499 if (!blockType) { 19500 return null; 19501 } // `edit` and `save` are functions or components describing the markup 19502 // with which a block is displayed. If `blockType` is valid, assign 19503 // them preferentially as the render value for the block. 19504 19505 19506 const Component = blockType.edit || blockType.save; 19507 19508 if (blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false)) { 19509 return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, { 19510 context: context 19511 })); 19512 } // Generate a class name for the block's editable form 19513 19514 19515 const generatedClassName = Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'className', true) ? Object(external_wp_blocks_["getBlockDefaultClassName"])(name) : null; 19516 const className = classnames_default()(generatedClassName, attributes.className); 19517 return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, { 19518 context: context, 19519 className: className 19520 })); 19521 }; 19522 /* harmony default export */ var edit = (Object(external_wp_components_["withFilters"])('editor.BlockEdit')(edit_Edit)); 19523 19524 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/index.js 19525 19526 19527 /** 19528 * WordPress dependencies 19529 */ 19530 19531 /** 19532 * Internal dependencies 19533 */ 19534 19535 19536 19537 19538 function block_edit_BlockEdit(props) { 19539 const { 19540 name, 19541 isSelected, 19542 clientId 19543 } = props; 19544 const context = { 19545 name, 19546 isSelected, 19547 clientId 19548 }; 19549 return Object(external_wp_element_["createElement"])(context_Provider // It is important to return the same object if props haven't 19550 // changed to avoid unnecessary rerenders. 19551 // See https://reactjs.org/docs/context.html#caveats. 19552 , { 19553 value: Object(external_wp_element_["useMemo"])(() => context, Object.values(context)) 19554 }, Object(external_wp_element_["createElement"])(edit, props)); 19555 } 19556 19557 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js 19558 var list_view = __webpack_require__("OzlF"); 19559 19560 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 19561 var more_vertical = __webpack_require__("VKE3"); 19562 19563 // EXTERNAL MODULE: ./node_modules/react-spring/web.cjs.js 19564 var web_cjs = __webpack_require__("ZO3Q"); 19565 19566 // EXTERNAL MODULE: external ["wp","dom"] 19567 var external_wp_dom_ = __webpack_require__("1CF3"); 19568 19569 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/index.js 19570 /** 19571 * External dependencies 19572 */ 19573 19574 /** 19575 * WordPress dependencies 19576 */ 19577 19578 19579 19580 19581 /** 19582 * Simple reducer used to increment a counter. 19583 * 19584 * @param {number} state Previous counter value. 19585 * @return {number} New state value. 19586 */ 19587 19588 const counterReducer = state => state + 1; 19589 19590 const getAbsolutePosition = element => { 19591 return { 19592 top: element.offsetTop, 19593 left: element.offsetLeft 19594 }; 19595 }; 19596 /** 19597 * Hook used to compute the styles required to move a div into a new position. 19598 * 19599 * The way this animation works is the following: 19600 * - It first renders the element as if there was no animation. 19601 * - It takes a snapshot of the position of the block to use it 19602 * as a destination point for the animation. 19603 * - It restores the element to the previous position using a CSS transform 19604 * - It uses the "resetAnimation" flag to reset the animation 19605 * from the beginning in order to animate to the new destination point. 19606 * 19607 * @param {Object} $1 Options 19608 * @param {boolean} $1.isSelected Whether it's the current block or not. 19609 * @param {boolean} $1.adjustScrolling Adjust the scroll position to the current block. 19610 * @param {boolean} $1.enableAnimation Enable/Disable animation. 19611 * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes. 19612 */ 19613 19614 19615 function useMovingAnimation({ 19616 isSelected, 19617 adjustScrolling, 19618 enableAnimation, 19619 triggerAnimationOnChange 19620 }) { 19621 const ref = Object(external_wp_element_["useRef"])(); 19622 const prefersReducedMotion = Object(external_wp_compose_["useReducedMotion"])() || !enableAnimation; 19623 const [triggeredAnimation, triggerAnimation] = Object(external_wp_element_["useReducer"])(counterReducer, 0); 19624 const [finishedAnimation, endAnimation] = Object(external_wp_element_["useReducer"])(counterReducer, 0); 19625 const [transform, setTransform] = Object(external_wp_element_["useState"])({ 19626 x: 0, 19627 y: 0 19628 }); 19629 const previous = Object(external_wp_element_["useMemo"])(() => ref.current ? getAbsolutePosition(ref.current) : null, [triggerAnimationOnChange]); // Calculate the previous position of the block relative to the viewport and 19630 // return a function to maintain that position by scrolling. 19631 19632 const preserveScrollPosition = Object(external_wp_element_["useMemo"])(() => { 19633 if (!adjustScrolling || !ref.current) { 19634 return () => {}; 19635 } 19636 19637 const scrollContainer = Object(external_wp_dom_["getScrollContainer"])(ref.current); 19638 19639 if (!scrollContainer) { 19640 return () => {}; 19641 } 19642 19643 const prevRect = ref.current.getBoundingClientRect(); 19644 return () => { 19645 const blockRect = ref.current.getBoundingClientRect(); 19646 const diff = blockRect.top - prevRect.top; 19647 19648 if (diff) { 19649 scrollContainer.scrollTop += diff; 19650 } 19651 }; 19652 }, [triggerAnimationOnChange, adjustScrolling]); 19653 Object(external_wp_element_["useLayoutEffect"])(() => { 19654 if (triggeredAnimation) { 19655 endAnimation(); 19656 } 19657 }, [triggeredAnimation]); 19658 Object(external_wp_element_["useLayoutEffect"])(() => { 19659 if (!previous) { 19660 return; 19661 } 19662 19663 if (prefersReducedMotion) { 19664 // if the animation is disabled and the scroll needs to be adjusted, 19665 // just move directly to the final scroll position. 19666 preserveScrollPosition(); 19667 return; 19668 } 19669 19670 ref.current.style.transform = ''; 19671 const destination = getAbsolutePosition(ref.current); 19672 triggerAnimation(); 19673 setTransform({ 19674 x: Math.round(previous.left - destination.left), 19675 y: Math.round(previous.top - destination.top) 19676 }); 19677 }, [triggerAnimationOnChange]); // Only called when either the x or y value changes. 19678 19679 function onFrameChange({ 19680 x, 19681 y 19682 }) { 19683 if (!ref.current) { 19684 return; 19685 } 19686 19687 const isMoving = x === 0 && y === 0; 19688 ref.current.style.transformOrigin = isMoving ? '' : 'center'; 19689 ref.current.style.transform = isMoving ? '' : `translate3d(${x}px,${y}px,0)`; 19690 ref.current.style.zIndex = !isSelected || isMoving ? '' : '1'; 19691 preserveScrollPosition(); 19692 } // Called for every frame computed by useSpring. 19693 19694 19695 function onFrame({ 19696 x, 19697 y 19698 }) { 19699 x = Math.round(x); 19700 y = Math.round(y); 19701 19702 if (x !== onFrame.x || y !== onFrame.y) { 19703 onFrameChange({ 19704 x, 19705 y 19706 }); 19707 onFrame.x = x; 19708 onFrame.y = y; 19709 } 19710 } 19711 19712 onFrame.x = 0; 19713 onFrame.y = 0; 19714 Object(web_cjs["useSpring"])({ 19715 from: { 19716 x: transform.x, 19717 y: transform.y 19718 }, 19719 to: { 19720 x: 0, 19721 y: 0 19722 }, 19723 reset: triggeredAnimation !== finishedAnimation, 19724 config: { 19725 mass: 5, 19726 tension: 2000, 19727 friction: 200 19728 }, 19729 immediate: prefersReducedMotion, 19730 onFrame 19731 }); 19732 return ref; 19733 } 19734 19735 /* harmony default export */ var use_moving_animation = (useMovingAnimation); 19736 19737 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/leaf.js 19738 19739 19740 19741 /** 19742 * External dependencies 19743 */ 19744 19745 19746 /** 19747 * WordPress dependencies 19748 */ 19749 19750 19751 /** 19752 * Internal dependencies 19753 */ 19754 19755 19756 const AnimatedTreeGridRow = Object(web_cjs["animated"])(external_wp_components_["__experimentalTreeGridRow"]); 19757 function BlockNavigationLeaf({ 19758 isSelected, 19759 position, 19760 level, 19761 rowCount, 19762 children, 19763 className, 19764 path, 19765 ...props 19766 }) { 19767 const ref = use_moving_animation({ 19768 isSelected, 19769 adjustScrolling: false, 19770 enableAnimation: true, 19771 triggerAnimationOnChange: path.join('_') 19772 }); 19773 return Object(external_wp_element_["createElement"])(AnimatedTreeGridRow, Object(esm_extends["a" /* default */])({ 19774 ref: ref, 19775 className: classnames_default()('block-editor-block-navigation-leaf', className), 19776 level: level, 19777 positionInSet: position, 19778 setSize: rowCount 19779 }, props), children); 19780 } 19781 19782 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js 19783 var chevron_right = __webpack_require__("1iEr"); 19784 19785 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js 19786 var chevron_left = __webpack_require__("2gm7"); 19787 19788 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 19789 var chevron_up = __webpack_require__("XgzB"); 19790 19791 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 19792 var chevron_down = __webpack_require__("NWDH"); 19793 19794 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js 19795 /** 19796 * WordPress dependencies 19797 */ 19798 19799 /** 19800 * Return a label for the block movement controls depending on block position. 19801 * 19802 * @param {number} selectedCount Number of blocks selected. 19803 * @param {string} type Block type - in the case of a single block, should 19804 * define its 'type'. I.e. 'Text', 'Heading', 'Image' etc. 19805 * @param {number} firstIndex The index (position - 1) of the first block selected. 19806 * @param {boolean} isFirst This is the first block. 19807 * @param {boolean} isLast This is the last block. 19808 * @param {number} dir Direction of movement (> 0 is considered to be going 19809 * down, < 0 is up). 19810 * @param {string} orientation The orientation of the block movers, vertical or 19811 * horizontal. 19812 * 19813 * @return {string} Label for the block movement controls. 19814 */ 19815 19816 function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) { 19817 const position = firstIndex + 1; 19818 19819 const getMovementDirection = moveDirection => { 19820 if (moveDirection === 'up') { 19821 if (orientation === 'horizontal') { 19822 return Object(external_wp_i18n_["isRTL"])() ? 'right' : 'left'; 19823 } 19824 19825 return 'up'; 19826 } else if (moveDirection === 'down') { 19827 if (orientation === 'horizontal') { 19828 return Object(external_wp_i18n_["isRTL"])() ? 'left' : 'right'; 19829 } 19830 19831 return 'down'; 19832 } 19833 19834 return null; 19835 }; 19836 19837 if (selectedCount > 1) { 19838 return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir); 19839 } 19840 19841 if (isFirst && isLast) { 19842 return Object(external_wp_i18n_["sprintf"])( // translators: %s: Type of block (i.e. Text, Image etc) 19843 Object(external_wp_i18n_["__"])('Block %s is the only block, and cannot be moved'), type); 19844 } 19845 19846 if (dir > 0 && !isLast) { 19847 // moving down 19848 const movementDirection = getMovementDirection('down'); 19849 19850 if (movementDirection === 'down') { 19851 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 19852 Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1); 19853 } 19854 19855 if (movementDirection === 'left') { 19856 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 19857 Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d left to position %3$d'), type, position, position + 1); 19858 } 19859 19860 if (movementDirection === 'right') { 19861 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 19862 Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d right to position %3$d'), type, position, position + 1); 19863 } 19864 } 19865 19866 if (dir > 0 && isLast) { 19867 // moving down, and is the last item 19868 const movementDirection = getMovementDirection('down'); 19869 19870 if (movementDirection === 'down') { 19871 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) 19872 Object(external_wp_i18n_["__"])('Block %1$s is at the end of the content and can’t be moved down'), type); 19873 } 19874 19875 if (movementDirection === 'left') { 19876 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) 19877 Object(external_wp_i18n_["__"])('Block %1$s is at the end of the content and can’t be moved left'), type); 19878 } 19879 19880 if (movementDirection === 'right') { 19881 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) 19882 Object(external_wp_i18n_["__"])('Block %1$s is at the end of the content and can’t be moved right'), type); 19883 } 19884 } 19885 19886 if (dir < 0 && !isFirst) { 19887 // moving up 19888 const movementDirection = getMovementDirection('up'); 19889 19890 if (movementDirection === 'up') { 19891 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 19892 Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1); 19893 } 19894 19895 if (movementDirection === 'left') { 19896 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 19897 Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d left to position %3$d'), type, position, position - 1); 19898 } 19899 19900 if (movementDirection === 'right') { 19901 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position 19902 Object(external_wp_i18n_["__"])('Move %1$s block from position %2$d right to position %3$d'), type, position, position - 1); 19903 } 19904 } 19905 19906 if (dir < 0 && isFirst) { 19907 // moving up, and is the first item 19908 const movementDirection = getMovementDirection('up'); 19909 19910 if (movementDirection === 'up') { 19911 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) 19912 Object(external_wp_i18n_["__"])('Block %1$s is at the beginning of the content and can’t be moved up'), type); 19913 } 19914 19915 if (movementDirection === 'left') { 19916 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) 19917 Object(external_wp_i18n_["__"])('Block %1$s is at the beginning of the content and can’t be moved left'), type); 19918 } 19919 19920 if (movementDirection === 'right') { 19921 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc) 19922 Object(external_wp_i18n_["__"])('Block %1$s is at the beginning of the content and can’t be moved right'), type); 19923 } 19924 } 19925 } 19926 /** 19927 * Return a label for the block movement controls depending on block position. 19928 * 19929 * @param {number} selectedCount Number of blocks selected. 19930 * @param {number} firstIndex The index (position - 1) of the first block selected. 19931 * @param {boolean} isFirst This is the first block. 19932 * @param {boolean} isLast This is the last block. 19933 * @param {number} dir Direction of movement (> 0 is considered to be going 19934 * down, < 0 is up). 19935 * 19936 * @return {string} Label for the block movement controls. 19937 */ 19938 19939 function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir) { 19940 const position = firstIndex + 1; 19941 19942 if (dir < 0 && isFirst) { 19943 return Object(external_wp_i18n_["__"])('Blocks cannot be moved up as they are already at the top'); 19944 } 19945 19946 if (dir > 0 && isLast) { 19947 return Object(external_wp_i18n_["__"])('Blocks cannot be moved down as they are already at the bottom'); 19948 } 19949 19950 if (dir < 0 && !isFirst) { 19951 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Number of selected blocks, 2: Position of selected blocks 19952 Object(external_wp_i18n_["_n"])('Move %1$d block from position %2$d up by one place', 'Move %1$d blocks from position %2$d up by one place', selectedCount), selectedCount, position); 19953 } 19954 19955 if (dir > 0 && !isLast) { 19956 return Object(external_wp_i18n_["sprintf"])( // translators: 1: Number of selected blocks, 2: Position of selected blocks 19957 Object(external_wp_i18n_["_n"])('Move %1$d block from position %2$d down by one place', 'Move %1$d blocks from position %2$d down by one place', selectedCount), selectedCount, position); 19958 } 19959 } 19960 19961 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/button.js 19962 19963 19964 19965 /** 19966 * External dependencies 19967 */ 19968 19969 19970 /** 19971 * WordPress dependencies 19972 */ 19973 19974 19975 19976 19977 19978 19979 19980 /** 19981 * Internal dependencies 19982 */ 19983 19984 19985 19986 19987 19988 const getArrowIcon = (direction, orientation) => { 19989 if (direction === 'up') { 19990 if (orientation === 'horizontal') { 19991 return Object(external_wp_i18n_["isRTL"])() ? chevron_right["a" /* default */] : chevron_left["a" /* default */]; 19992 } 19993 19994 return chevron_up["a" /* default */]; 19995 } else if (direction === 'down') { 19996 if (orientation === 'horizontal') { 19997 return Object(external_wp_i18n_["isRTL"])() ? chevron_left["a" /* default */] : chevron_right["a" /* default */]; 19998 } 19999 20000 return chevron_down["a" /* default */]; 20001 } 20002 20003 return null; 20004 }; 20005 20006 const getMovementDirectionLabel = (moveDirection, orientation) => { 20007 if (moveDirection === 'up') { 20008 if (orientation === 'horizontal') { 20009 return Object(external_wp_i18n_["isRTL"])() ? Object(external_wp_i18n_["__"])('Move right') : Object(external_wp_i18n_["__"])('Move left'); 20010 } 20011 20012 return Object(external_wp_i18n_["__"])('Move up'); 20013 } else if (moveDirection === 'down') { 20014 if (orientation === 'horizontal') { 20015 return Object(external_wp_i18n_["isRTL"])() ? Object(external_wp_i18n_["__"])('Move left') : Object(external_wp_i18n_["__"])('Move right'); 20016 } 20017 20018 return Object(external_wp_i18n_["__"])('Move down'); 20019 } 20020 20021 return null; 20022 }; 20023 20024 const BlockMoverButton = Object(external_wp_element_["forwardRef"])(({ 20025 clientIds, 20026 direction, 20027 orientation: moverOrientation, 20028 ...props 20029 }, ref) => { 20030 const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockMoverButton); 20031 const blocksCount = Object(external_lodash_["castArray"])(clientIds).length; 20032 const { 20033 blockType, 20034 isDisabled, 20035 rootClientId, 20036 isFirst, 20037 isLast, 20038 firstIndex, 20039 orientation = 'vertical' 20040 } = Object(external_wp_data_["useSelect"])(select => { 20041 const { 20042 getBlockIndex, 20043 getBlockRootClientId, 20044 getBlockOrder, 20045 getBlock, 20046 getBlockListSettings 20047 } = select(store); 20048 const normalizedClientIds = Object(external_lodash_["castArray"])(clientIds); 20049 const firstClientId = Object(external_lodash_["first"])(normalizedClientIds); 20050 const blockRootClientId = getBlockRootClientId(firstClientId); 20051 const firstBlockIndex = getBlockIndex(firstClientId, blockRootClientId); 20052 const lastBlockIndex = getBlockIndex(Object(external_lodash_["last"])(normalizedClientIds), blockRootClientId); 20053 const blockOrder = getBlockOrder(blockRootClientId); 20054 const block = getBlock(firstClientId); 20055 const isFirstBlock = firstBlockIndex === 0; 20056 const isLastBlock = lastBlockIndex === blockOrder.length - 1; 20057 const { 20058 orientation: blockListOrientation 20059 } = getBlockListSettings(blockRootClientId) || {}; 20060 return { 20061 blockType: block ? Object(external_wp_blocks_["getBlockType"])(block.name) : null, 20062 isDisabled: direction === 'up' ? isFirstBlock : isLastBlock, 20063 rootClientId: blockRootClientId, 20064 firstIndex: firstBlockIndex, 20065 isFirst: isFirstBlock, 20066 isLast: isLastBlock, 20067 orientation: moverOrientation || blockListOrientation 20068 }; 20069 }, [clientIds, direction]); 20070 const { 20071 moveBlocksDown, 20072 moveBlocksUp 20073 } = Object(external_wp_data_["useDispatch"])(store); 20074 const moverFunction = direction === 'up' ? moveBlocksUp : moveBlocksDown; 20075 20076 const onClick = event => { 20077 moverFunction(clientIds, rootClientId); 20078 20079 if (props.onClick) { 20080 props.onClick(event); 20081 } 20082 }; 20083 20084 const descriptionId = `block-editor-block-mover-button__description-${instanceId}`; 20085 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ 20086 ref: ref, 20087 className: classnames_default()('block-editor-block-mover-button', `is-${direction}-button`), 20088 icon: getArrowIcon(direction, orientation), 20089 label: getMovementDirectionLabel(direction, orientation), 20090 "aria-describedby": descriptionId 20091 }, props, { 20092 onClick: isDisabled ? null : onClick, 20093 "aria-disabled": isDisabled 20094 })), Object(external_wp_element_["createElement"])("span", { 20095 id: descriptionId, 20096 className: "block-editor-block-mover-button__description" 20097 }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation))); 20098 }); 20099 const BlockMoverUpButton = Object(external_wp_element_["forwardRef"])((props, ref) => { 20100 return Object(external_wp_element_["createElement"])(BlockMoverButton, Object(esm_extends["a" /* default */])({ 20101 direction: "up", 20102 ref: ref 20103 }, props)); 20104 }); 20105 const BlockMoverDownButton = Object(external_wp_element_["forwardRef"])((props, ref) => { 20106 return Object(external_wp_element_["createElement"])(BlockMoverButton, Object(esm_extends["a" /* default */])({ 20107 direction: "down", 20108 ref: ref 20109 }, props)); 20110 }); 20111 20112 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/context.js 20113 /** 20114 * WordPress dependencies 20115 */ 20116 20117 const BlockNavigationContext = Object(external_wp_element_["createContext"])({ 20118 __experimentalFeatures: false, 20119 __experimentalPersistentListViewFeatures: false 20120 }); 20121 const useBlockNavigationContext = () => Object(external_wp_element_["useContext"])(BlockNavigationContext); 20122 20123 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-horizontal.js 20124 20125 20126 /** 20127 * WordPress dependencies 20128 */ 20129 20130 const moreHorizontal = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 20131 xmlns: "http://www.w3.org/2000/svg", 20132 viewBox: "0 0 24 24" 20133 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 20134 d: "M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" 20135 })); 20136 /* harmony default export */ var more_horizontal = (moreHorizontal); 20137 20138 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js 20139 20140 20141 /** 20142 * External dependencies 20143 */ 20144 20145 /** 20146 * WordPress dependencies 20147 */ 20148 20149 20150 20151 20152 20153 20154 function Warning({ 20155 className, 20156 actions, 20157 children, 20158 secondaryActions 20159 }) { 20160 return Object(external_wp_element_["createElement"])("div", { 20161 className: classnames_default()(className, 'block-editor-warning') 20162 }, Object(external_wp_element_["createElement"])("div", { 20163 className: "block-editor-warning__contents" 20164 }, Object(external_wp_element_["createElement"])("p", { 20165 className: "block-editor-warning__message" 20166 }, children), (external_wp_element_["Children"].count(actions) > 0 || secondaryActions) && Object(external_wp_element_["createElement"])("div", { 20167 className: "block-editor-warning__actions" 20168 }, external_wp_element_["Children"].count(actions) > 0 && external_wp_element_["Children"].map(actions, (action, i) => Object(external_wp_element_["createElement"])("span", { 20169 key: i, 20170 className: "block-editor-warning__action" 20171 }, action)), secondaryActions && Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { 20172 className: "block-editor-warning__secondary", 20173 icon: more_horizontal, 20174 label: Object(external_wp_i18n_["__"])('More options'), 20175 popoverProps: { 20176 position: 'bottom left', 20177 className: 'block-editor-warning__dropdown' 20178 }, 20179 noIcons: true 20180 }, () => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, secondaryActions.map((item, pos) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 20181 onClick: item.onClick, 20182 key: pos 20183 }, item.title))))))); 20184 } 20185 /** 20186 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md 20187 */ 20188 20189 20190 /* harmony default export */ var warning = (Warning); 20191 20192 // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js 20193 var diff_character = __webpack_require__("iA5R"); 20194 20195 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/block-view.js 20196 20197 20198 /** 20199 * WordPress dependencies 20200 */ 20201 20202 20203 20204 function BlockView({ 20205 title, 20206 rawContent, 20207 renderedContent, 20208 action, 20209 actionText, 20210 className 20211 }) { 20212 return Object(external_wp_element_["createElement"])("div", { 20213 className: className 20214 }, Object(external_wp_element_["createElement"])("div", { 20215 className: "block-editor-block-compare__content" 20216 }, Object(external_wp_element_["createElement"])("h2", { 20217 className: "block-editor-block-compare__heading" 20218 }, title), Object(external_wp_element_["createElement"])("div", { 20219 className: "block-editor-block-compare__html" 20220 }, rawContent), Object(external_wp_element_["createElement"])("div", { 20221 className: "block-editor-block-compare__preview edit-post-visual-editor" 20222 }, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(renderedContent)))), Object(external_wp_element_["createElement"])("div", { 20223 className: "block-editor-block-compare__action" 20224 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 20225 isSecondary: true, 20226 tabIndex: "0", 20227 onClick: action 20228 }, actionText))); 20229 } 20230 20231 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js 20232 20233 20234 /** 20235 * External dependencies 20236 */ 20237 20238 // diff doesn't tree-shake correctly, so we import from the individual 20239 // module here, to avoid including too much of the library 20240 20241 20242 /** 20243 * WordPress dependencies 20244 */ 20245 20246 20247 20248 /** 20249 * Internal dependencies 20250 */ 20251 20252 20253 20254 function BlockCompare({ 20255 block, 20256 onKeep, 20257 onConvert, 20258 convertor, 20259 convertButtonText 20260 }) { 20261 function getDifference(originalContent, newContent) { 20262 const difference = Object(diff_character["diffChars"])(originalContent, newContent); 20263 return difference.map((item, pos) => { 20264 const classes = classnames_default()({ 20265 'block-editor-block-compare__added': item.added, 20266 'block-editor-block-compare__removed': item.removed 20267 }); 20268 return Object(external_wp_element_["createElement"])("span", { 20269 key: pos, 20270 className: classes 20271 }, item.value); 20272 }); 20273 } 20274 20275 function getConvertedContent(convertedBlock) { 20276 // The convertor may return an array of items or a single item 20277 const newBlocks = Object(external_lodash_["castArray"])(convertedBlock); // Get converted block details 20278 20279 const newContent = newBlocks.map(item => Object(external_wp_blocks_["getSaveContent"])(item.name, item.attributes, item.innerBlocks)); 20280 return newContent.join(''); 20281 } 20282 20283 const converted = getConvertedContent(convertor(block)); 20284 const difference = getDifference(block.originalContent, converted); 20285 return Object(external_wp_element_["createElement"])("div", { 20286 className: "block-editor-block-compare__wrapper" 20287 }, Object(external_wp_element_["createElement"])(BlockView, { 20288 title: Object(external_wp_i18n_["__"])('Current'), 20289 className: "block-editor-block-compare__current", 20290 action: onKeep, 20291 actionText: Object(external_wp_i18n_["__"])('Convert to HTML'), 20292 rawContent: block.originalContent, 20293 renderedContent: block.originalContent 20294 }), Object(external_wp_element_["createElement"])(BlockView, { 20295 title: Object(external_wp_i18n_["__"])('After Conversion'), 20296 className: "block-editor-block-compare__converted", 20297 action: onConvert, 20298 actionText: convertButtonText, 20299 rawContent: difference, 20300 renderedContent: converted 20301 })); 20302 } 20303 20304 /* harmony default export */ var block_compare = (BlockCompare); 20305 20306 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js 20307 20308 20309 /** 20310 * WordPress dependencies 20311 */ 20312 20313 20314 20315 20316 20317 20318 /** 20319 * Internal dependencies 20320 */ 20321 20322 20323 20324 20325 function BlockInvalidWarning({ 20326 convertToHTML, 20327 convertToBlocks, 20328 convertToClassic, 20329 attemptBlockRecovery, 20330 block 20331 }) { 20332 const hasHTMLBlock = !!Object(external_wp_blocks_["getBlockType"])('core/html'); 20333 const [compare, setCompare] = Object(external_wp_element_["useState"])(false); 20334 const onCompare = Object(external_wp_element_["useCallback"])(() => setCompare(true), []); 20335 const onCompareClose = Object(external_wp_element_["useCallback"])(() => setCompare(false), []); // We memo the array here to prevent the children components from being updated unexpectedly 20336 20337 const hiddenActions = Object(external_wp_element_["useMemo"])(() => [{ 20338 // translators: Button to fix block content 20339 title: Object(external_wp_i18n_["_x"])('Resolve', 'imperative verb'), 20340 onClick: onCompare 20341 }, hasHTMLBlock && { 20342 title: Object(external_wp_i18n_["__"])('Convert to HTML'), 20343 onClick: convertToHTML 20344 }, { 20345 title: Object(external_wp_i18n_["__"])('Convert to Classic Block'), 20346 onClick: convertToClassic 20347 }].filter(Boolean), [onCompare, convertToHTML, convertToClassic]); 20348 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(warning, { 20349 actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 20350 key: "recover", 20351 onClick: attemptBlockRecovery, 20352 isPrimary: true 20353 }, Object(external_wp_i18n_["__"])('Attempt Block Recovery'))], 20354 secondaryActions: hiddenActions 20355 }, Object(external_wp_i18n_["__"])('This block contains unexpected or invalid content.')), compare && Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], { 20356 title: // translators: Dialog title to fix block content 20357 Object(external_wp_i18n_["__"])('Resolve Block'), 20358 onRequestClose: onCompareClose, 20359 className: "block-editor-block-compare" 20360 }, Object(external_wp_element_["createElement"])(block_compare, { 20361 block: block, 20362 onKeep: convertToHTML, 20363 onConvert: convertToBlocks, 20364 convertor: blockToBlocks, 20365 convertButtonText: Object(external_wp_i18n_["__"])('Convert to Blocks') 20366 }))); 20367 } 20368 20369 const blockToClassic = block => Object(external_wp_blocks_["createBlock"])('core/freeform', { 20370 content: block.originalContent 20371 }); 20372 20373 const blockToHTML = block => Object(external_wp_blocks_["createBlock"])('core/html', { 20374 content: block.originalContent 20375 }); 20376 20377 const blockToBlocks = block => Object(external_wp_blocks_["rawHandler"])({ 20378 HTML: block.originalContent 20379 }); 20380 20381 const recoverBlock = ({ 20382 name, 20383 attributes, 20384 innerBlocks 20385 }) => Object(external_wp_blocks_["createBlock"])(name, attributes, innerBlocks); 20386 20387 /* harmony default export */ var block_invalid_warning = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { 20388 clientId 20389 }) => ({ 20390 block: select(store).getBlock(clientId) 20391 })), Object(external_wp_data_["withDispatch"])((dispatch, { 20392 block 20393 }) => { 20394 const { 20395 replaceBlock 20396 } = dispatch(store); 20397 return { 20398 convertToClassic() { 20399 replaceBlock(block.clientId, blockToClassic(block)); 20400 }, 20401 20402 convertToHTML() { 20403 replaceBlock(block.clientId, blockToHTML(block)); 20404 }, 20405 20406 convertToBlocks() { 20407 replaceBlock(block.clientId, blockToBlocks(block)); 20408 }, 20409 20410 attemptBlockRecovery() { 20411 replaceBlock(block.clientId, recoverBlock(block)); 20412 } 20413 20414 }; 20415 })])(BlockInvalidWarning)); 20416 20417 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-warning.js 20418 20419 20420 /** 20421 * WordPress dependencies 20422 */ 20423 20424 /** 20425 * Internal dependencies 20426 */ 20427 20428 20429 const block_crash_warning_warning = Object(external_wp_element_["createElement"])(warning, { 20430 className: "block-editor-block-list__block-crash-warning" 20431 }, Object(external_wp_i18n_["__"])('This block has encountered an error and cannot be previewed.')); 20432 /* harmony default export */ var block_crash_warning = (() => block_crash_warning_warning); 20433 20434 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-crash-boundary.js 20435 /** 20436 * WordPress dependencies 20437 */ 20438 20439 20440 class block_crash_boundary_BlockCrashBoundary extends external_wp_element_["Component"] { 20441 constructor() { 20442 super(...arguments); 20443 this.state = { 20444 hasError: false 20445 }; 20446 } 20447 20448 componentDidCatch() { 20449 this.setState({ 20450 hasError: true 20451 }); 20452 } 20453 20454 render() { 20455 if (this.state.hasError) { 20456 return this.props.fallback; 20457 } 20458 20459 return this.props.children; 20460 } 20461 20462 } 20463 20464 /* harmony default export */ var block_crash_boundary = (block_crash_boundary_BlockCrashBoundary); 20465 20466 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js 20467 var lib = __webpack_require__("O6Fj"); 20468 var lib_default = /*#__PURE__*/__webpack_require__.n(lib); 20469 20470 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-html.js 20471 20472 20473 /** 20474 * External dependencies 20475 */ 20476 20477 /** 20478 * WordPress dependencies 20479 */ 20480 20481 20482 20483 20484 /** 20485 * Internal dependencies 20486 */ 20487 20488 20489 20490 function BlockHTML({ 20491 clientId 20492 }) { 20493 const [html, setHtml] = Object(external_wp_element_["useState"])(''); 20494 const block = Object(external_wp_data_["useSelect"])(select => select(store).getBlock(clientId), [clientId]); 20495 const { 20496 updateBlock 20497 } = Object(external_wp_data_["useDispatch"])(store); 20498 20499 const onChange = () => { 20500 const blockType = Object(external_wp_blocks_["getBlockType"])(block.name); 20501 const attributes = Object(external_wp_blocks_["getBlockAttributes"])(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error 20502 20503 const content = html ? html : Object(external_wp_blocks_["getSaveContent"])(blockType, attributes); 20504 const isValid = html ? Object(external_wp_blocks_["isValidBlockContent"])(blockType, attributes, content) : true; 20505 updateBlock(clientId, { 20506 attributes, 20507 originalContent: content, 20508 isValid 20509 }); // Ensure the state is updated if we reset so it displays the default content 20510 20511 if (!html) { 20512 setHtml({ 20513 content 20514 }); 20515 } 20516 }; 20517 20518 Object(external_wp_element_["useEffect"])(() => { 20519 setHtml(Object(external_wp_blocks_["getBlockContent"])(block)); 20520 }, [block]); 20521 return Object(external_wp_element_["createElement"])(lib_default.a, { 20522 className: "block-editor-block-list__block-html-textarea", 20523 value: html, 20524 onBlur: onChange, 20525 onChange: event => setHtml(event.target.value) 20526 }); 20527 } 20528 20529 /* harmony default export */ var block_html = (BlockHTML); 20530 20531 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/dom.js 20532 const BLOCK_SELECTOR = '.block-editor-block-list__block'; 20533 /** 20534 * Returns true if two elements are contained within the same block. 20535 * 20536 * @param {Element} a First element. 20537 * @param {Element} b Second element. 20538 * 20539 * @return {boolean} Whether elements are in the same block. 20540 */ 20541 20542 function isInSameBlock(a, b) { 20543 return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR); 20544 } 20545 /** 20546 * Returns true if an element is considered part of the block and not its 20547 * children. 20548 * 20549 * @param {Element} blockElement Block container element. 20550 * @param {Element} element Element. 20551 * 20552 * @return {boolean} Whether element is in the block Element but not its 20553 * children. 20554 */ 20555 20556 function isInsideRootBlock(blockElement, element) { 20557 const parentBlock = element.closest(BLOCK_SELECTOR); 20558 return parentBlock === blockElement; 20559 } 20560 /** 20561 * Finds the block client ID given any DOM node inside the block. 20562 * 20563 * @param {Node?} node DOM node. 20564 * 20565 * @return {string|undefined} Client ID or undefined if the node is not part of 20566 * a block. 20567 */ 20568 20569 function getBlockClientId(node) { 20570 while (node && node.nodeType !== node.ELEMENT_NODE) { 20571 node = node.parentNode; 20572 } 20573 20574 if (!node) { 20575 return; 20576 } 20577 20578 const elementNode = 20579 /** @type {Element} */ 20580 node; 20581 const blockNode = elementNode.closest(BLOCK_SELECTOR); 20582 20583 if (!blockNode) { 20584 return; 20585 } 20586 20587 return blockNode.id.slice('block-'.length); 20588 } 20589 20590 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js 20591 /** 20592 * External dependencies 20593 */ 20594 20595 /** 20596 * WordPress dependencies 20597 */ 20598 20599 20600 20601 20602 /** 20603 * Internal dependencies 20604 */ 20605 20606 20607 20608 /** @typedef {import('@wordpress/element').RefObject} RefObject */ 20609 20610 /** 20611 * Returns the initial position if the block needs to be focussed, `undefined` 20612 * otherwise. The initial position is either 0 (start) or -1 (end). 20613 * 20614 * @param {string} clientId Block client ID. 20615 * 20616 * @return {number} The initial position, either 0 (start) or -1 (end). 20617 */ 20618 20619 function useInitialPosition(clientId) { 20620 return Object(external_wp_data_["useSelect"])(select => { 20621 const { 20622 getSelectedBlocksInitialCaretPosition, 20623 isMultiSelecting, 20624 isNavigationMode, 20625 isBlockSelected 20626 } = select(store); 20627 20628 if (!isBlockSelected(clientId)) { 20629 return; 20630 } 20631 20632 if (isMultiSelecting() || isNavigationMode()) { 20633 return; 20634 } // If there's no initial position, return 0 to focus the start. 20635 20636 20637 return getSelectedBlocksInitialCaretPosition(); 20638 }, [clientId]); 20639 } 20640 /** 20641 * Transitions focus to the block or inner tabbable when the block becomes 20642 * selected and an initial position is set. 20643 * 20644 * @param {string} clientId Block client ID. 20645 * 20646 * @return {RefObject} React ref with the block element. 20647 */ 20648 20649 20650 function useFocusFirstElement(clientId) { 20651 const ref = Object(external_wp_element_["useRef"])(); 20652 const initialPosition = useInitialPosition(clientId); 20653 Object(external_wp_element_["useEffect"])(() => { 20654 if (initialPosition === undefined || initialPosition === null) { 20655 return; 20656 } 20657 20658 if (!ref.current) { 20659 return; 20660 } 20661 20662 const { 20663 ownerDocument 20664 } = ref.current; // Do not focus the block if it already contains the active element. 20665 20666 if (ref.current.contains(ownerDocument.activeElement)) { 20667 return; 20668 } // Find all tabbables within node. 20669 20670 20671 const textInputs = external_wp_dom_["focus"].tabbable.find(ref.current).filter(node => Object(external_wp_dom_["isTextField"])(node)); // If reversed (e.g. merge via backspace), use the last in the set of 20672 // tabbables. 20673 20674 const isReverse = -1 === initialPosition; 20675 const target = (isReverse ? external_lodash_["last"] : external_lodash_["first"])(textInputs) || ref.current; 20676 20677 if ( // Don't focus inner block or block appenders. 20678 !isInsideRootBlock(ref.current, target) || target.closest('.block-list-appender')) { 20679 ref.current.focus(); 20680 return; 20681 } 20682 20683 Object(external_wp_dom_["placeCaretAtHorizontalEdge"])(target, isReverse); 20684 }, [initialPosition]); 20685 return ref; 20686 } 20687 20688 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js 20689 /** 20690 * WordPress dependencies 20691 */ 20692 20693 20694 /** 20695 * Internal dependencies 20696 */ 20697 20698 20699 20700 function listener(event) { 20701 if (event.defaultPrevented) { 20702 return; 20703 } 20704 20705 const action = event.type === 'mouseover' ? 'add' : 'remove'; 20706 event.preventDefault(); 20707 event.currentTarget.classList[action]('is-hovered'); 20708 } 20709 /** 20710 * Adds `is-hovered` class when the block is hovered and in navigation or 20711 * outline mode. 20712 */ 20713 20714 20715 function useIsHovered() { 20716 const isEnabled = Object(external_wp_data_["useSelect"])(select => { 20717 const { 20718 isNavigationMode, 20719 getSettings 20720 } = select(store); 20721 return isNavigationMode() || getSettings().outlineMode; 20722 }, []); 20723 return Object(external_wp_compose_["useRefEffect"])(node => { 20724 if (isEnabled) { 20725 node.addEventListener('mouseout', listener); 20726 node.addEventListener('mouseover', listener); 20727 return () => { 20728 node.removeEventListener('mouseout', listener); 20729 node.removeEventListener('mouseover', listener); // Remove class in case it lingers. 20730 20731 node.classList.remove('is-hovered'); 20732 }; 20733 } 20734 }, [isEnabled]); 20735 } 20736 20737 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-class-names.js 20738 /** 20739 * External dependencies 20740 */ 20741 20742 /** 20743 * WordPress dependencies 20744 */ 20745 20746 20747 20748 /** 20749 * Internal dependencies 20750 */ 20751 20752 20753 /** 20754 * Returns the class names used for the different states of the block. 20755 * 20756 * @param {string} clientId The block client ID. 20757 * 20758 * @return {string} The class names. 20759 */ 20760 20761 function useBlockClassNames(clientId) { 20762 return Object(external_wp_data_["useSelect"])(select => { 20763 const { 20764 isBlockBeingDragged, 20765 isBlockHighlighted, 20766 isBlockSelected, 20767 isBlockMultiSelected, 20768 getBlockName, 20769 getSettings, 20770 hasSelectedInnerBlock, 20771 isTyping, 20772 __experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames 20773 } = select(store); 20774 const { 20775 __experimentalSpotlightEntityBlocks: spotlightEntityBlocks, 20776 outlineMode 20777 } = getSettings(); 20778 const isDragging = isBlockBeingDragged(clientId); 20779 const isSelected = isBlockSelected(clientId); 20780 const name = getBlockName(clientId); 20781 const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check 20782 20783 const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep); 20784 const activeEntityBlockId = getActiveBlockIdByBlockNames(spotlightEntityBlocks); 20785 return classnames_default()({ 20786 'is-selected': isSelected, 20787 'is-highlighted': isBlockHighlighted(clientId), 20788 'is-multi-selected': isBlockMultiSelected(clientId), 20789 'is-reusable': Object(external_wp_blocks_["isReusableBlock"])(Object(external_wp_blocks_["getBlockType"])(name)), 20790 'is-dragging': isDragging, 20791 'has-child-selected': isAncestorOfSelectedBlock, 20792 'has-active-entity': activeEntityBlockId, 20793 // Determine if there is an active entity area to spotlight. 20794 'is-active-entity': activeEntityBlockId === clientId, 20795 'remove-outline': isSelected && outlineMode && isTyping() 20796 }); 20797 }, [clientId]); 20798 } 20799 20800 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-default-class-name.js 20801 /** 20802 * WordPress dependencies 20803 */ 20804 20805 20806 /** 20807 * Internal dependencies 20808 */ 20809 20810 20811 /** 20812 * Returns the default class name if the block is a light block and it supports 20813 * `className`. 20814 * 20815 * @param {string} clientId The block client ID. 20816 * 20817 * @return {string} The class name, e.g. `wp-block-paragraph`. 20818 */ 20819 20820 function useBlockDefaultClassName(clientId) { 20821 return Object(external_wp_data_["useSelect"])(select => { 20822 const name = select(store).getBlockName(clientId); 20823 const blockType = Object(external_wp_blocks_["getBlockType"])(name); 20824 const hasLightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); 20825 20826 if (!hasLightBlockWrapper) { 20827 return; 20828 } 20829 20830 return Object(external_wp_blocks_["getBlockDefaultClassName"])(name); 20831 }, [clientId]); 20832 } 20833 20834 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-custom-class-name.js 20835 /** 20836 * WordPress dependencies 20837 */ 20838 20839 20840 /** 20841 * Internal dependencies 20842 */ 20843 20844 20845 /** 20846 * Returns the custom class name if the block is a light block. 20847 * 20848 * @param {string} clientId The block client ID. 20849 * 20850 * @return {string} The custom class name. 20851 */ 20852 20853 function useBlockCustomClassName(clientId) { 20854 // It's good for this to be a separate selector because it will be executed 20855 // on every attribute change, while the other selectors are not re-evaluated 20856 // as much. 20857 return Object(external_wp_data_["useSelect"])(select => { 20858 const { 20859 getBlockName, 20860 getBlockAttributes 20861 } = select(store); 20862 const { 20863 className 20864 } = getBlockAttributes(clientId); 20865 20866 if (!className) { 20867 return; 20868 } 20869 20870 const blockType = Object(external_wp_blocks_["getBlockType"])(getBlockName(clientId)); 20871 const hasLightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); 20872 20873 if (!hasLightBlockWrapper) { 20874 return; 20875 } 20876 20877 return className; 20878 }, [clientId]); 20879 } 20880 20881 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js 20882 /** 20883 * External dependencies 20884 */ 20885 20886 /** 20887 * WordPress dependencies 20888 */ 20889 20890 20891 /** 20892 * Internal dependencies 20893 */ 20894 20895 20896 /** 20897 * Returns the class names used for block moving mode. 20898 * 20899 * @param {string} clientId The block client ID to insert above. 20900 * 20901 * @return {string} The class names. 20902 */ 20903 20904 function useBlockMovingModeClassNames(clientId) { 20905 return Object(external_wp_data_["useSelect"])(select => { 20906 const { 20907 hasBlockMovingClientId, 20908 canInsertBlockType, 20909 getBlockName, 20910 getBlockRootClientId, 20911 isBlockSelected 20912 } = select(store); // The classes are only relevant for the selected block. Avoid 20913 // re-rendering all blocks! 20914 20915 if (!isBlockSelected(clientId)) { 20916 return; 20917 } 20918 20919 const movingClientId = hasBlockMovingClientId(); 20920 20921 if (!movingClientId) { 20922 return; 20923 } 20924 20925 return classnames_default()('is-block-moving-mode', { 20926 'can-insert-moving-block': canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId)) 20927 }); 20928 }, [clientId]); 20929 } 20930 20931 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js 20932 /** 20933 * WordPress dependencies 20934 */ 20935 20936 20937 /** 20938 * Internal dependencies 20939 */ 20940 20941 20942 20943 /** 20944 * Selects the block if it receives focus. 20945 * 20946 * @param {string} clientId Block client ID. 20947 */ 20948 20949 function useFocusHandler(clientId) { 20950 const { 20951 isBlockSelected 20952 } = Object(external_wp_data_["useSelect"])(store); 20953 const { 20954 selectBlock, 20955 selectionChange 20956 } = Object(external_wp_data_["useDispatch"])(store); 20957 return Object(external_wp_compose_["useRefEffect"])(node => { 20958 /** 20959 * Marks the block as selected when focused and not already 20960 * selected. This specifically handles the case where block does not 20961 * set focus on its own (via `setFocus`), typically if there is no 20962 * focusable input in the block. 20963 * 20964 * @param {FocusEvent} event Focus event. 20965 */ 20966 function onFocus(event) { 20967 // Check synchronously because a non-selected block might be 20968 // getting data through `useSelect` asynchronously. 20969 if (isBlockSelected(clientId)) { 20970 // Potentially change selection away from rich text. 20971 if (!event.target.isContentEditable) { 20972 selectionChange(clientId); 20973 } 20974 20975 return; 20976 } // If an inner block is focussed, that block is resposible for 20977 // setting the selected block. 20978 20979 20980 if (!isInsideRootBlock(node, event.target)) { 20981 return; 20982 } 20983 20984 selectBlock(clientId); 20985 } 20986 20987 node.addEventListener('focusin', onFocus); 20988 return () => { 20989 node.removeEventListener('focusin', onFocus); 20990 }; 20991 }, [isBlockSelected, selectBlock]); 20992 } 20993 20994 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js 20995 /** 20996 * WordPress dependencies 20997 */ 20998 20999 21000 21001 21002 /** 21003 * Internal dependencies 21004 */ 21005 21006 21007 /** 21008 * Adds block behaviour: 21009 * - Removes the block on BACKSPACE. 21010 * - Inserts a default block on ENTER. 21011 * - Disables dragging of block contents. 21012 * 21013 * @param {string} clientId Block client ID. 21014 */ 21015 21016 function useEventHandlers(clientId) { 21017 const isSelected = Object(external_wp_data_["useSelect"])(select => select(store).isBlockSelected(clientId), [clientId]); 21018 const { 21019 getBlockRootClientId, 21020 getBlockIndex 21021 } = Object(external_wp_data_["useSelect"])(store); 21022 const { 21023 insertDefaultBlock, 21024 removeBlock 21025 } = Object(external_wp_data_["useDispatch"])(store); 21026 return Object(external_wp_compose_["useRefEffect"])(node => { 21027 if (!isSelected) { 21028 return; 21029 } 21030 /** 21031 * Interprets keydown event intent to remove or insert after block if 21032 * key event occurs on wrapper node. This can occur when the block has 21033 * no text fields of its own, particularly after initial insertion, to 21034 * allow for easy deletion and continuous writing flow to add additional 21035 * content. 21036 * 21037 * @param {KeyboardEvent} event Keydown event. 21038 */ 21039 21040 21041 function onKeyDown(event) { 21042 const { 21043 keyCode, 21044 target 21045 } = event; 21046 21047 if (keyCode !== external_wp_keycodes_["ENTER"] && keyCode !== external_wp_keycodes_["BACKSPACE"] && keyCode !== external_wp_keycodes_["DELETE"]) { 21048 return; 21049 } 21050 21051 if (target !== node || Object(external_wp_dom_["isTextField"])(target)) { 21052 return; 21053 } 21054 21055 event.preventDefault(); 21056 21057 if (keyCode === external_wp_keycodes_["ENTER"]) { 21058 insertDefaultBlock({}, getBlockRootClientId(clientId), getBlockIndex(clientId) + 1); 21059 } else { 21060 removeBlock(clientId); 21061 } 21062 } 21063 /** 21064 * Prevents default dragging behavior within a block. To do: we must 21065 * handle this in the future and clean up the drag target. 21066 * 21067 * @param {DragEvent} event Drag event. 21068 */ 21069 21070 21071 function onDragStart(event) { 21072 event.preventDefault(); 21073 } 21074 21075 node.addEventListener('keydown', onKeyDown); 21076 node.addEventListener('dragstart', onDragStart); 21077 return () => { 21078 node.removeEventListener('keydown', onKeyDown); 21079 node.removeEventListener('dragstart', onDragStart); 21080 }; 21081 }, [clientId, isSelected, getBlockRootClientId, getBlockIndex, insertDefaultBlock, removeBlock]); 21082 } 21083 21084 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-nav-mode-exit.js 21085 /** 21086 * WordPress dependencies 21087 */ 21088 21089 21090 /** 21091 * Internal dependencies 21092 */ 21093 21094 21095 /** 21096 * Allows navigation mode to be exited by clicking in the selected block. 21097 * 21098 * @param {string} clientId Block client ID. 21099 */ 21100 21101 function useNavModeExit(clientId) { 21102 const { 21103 isNavigationMode, 21104 isBlockSelected 21105 } = Object(external_wp_data_["useSelect"])(store); 21106 const { 21107 setNavigationMode, 21108 selectBlock 21109 } = Object(external_wp_data_["useDispatch"])(store); 21110 return Object(external_wp_compose_["useRefEffect"])(node => { 21111 function onMouseDown(event) { 21112 // Don't select a block if it's already handled by a child 21113 // block. 21114 if (isNavigationMode() && !event.defaultPrevented) { 21115 // Prevent focus from moving to the block. 21116 event.preventDefault(); // When clicking on a selected block, exit navigation mode. 21117 21118 if (isBlockSelected(clientId)) { 21119 setNavigationMode(false); 21120 } else { 21121 selectBlock(clientId); 21122 } 21123 } 21124 } 21125 21126 node.addEventListener('mousedown', onMouseDown); 21127 return () => { 21128 node.addEventListener('mousedown', onMouseDown); 21129 }; 21130 }, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]); 21131 } 21132 21133 // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js 21134 var dom_scroll_into_view_lib = __webpack_require__("9Do8"); 21135 var dom_scroll_into_view_lib_default = /*#__PURE__*/__webpack_require__.n(dom_scroll_into_view_lib); 21136 21137 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js 21138 /** 21139 * External dependencies 21140 */ 21141 21142 /** 21143 * WordPress dependencies 21144 */ 21145 21146 /** 21147 * WordPress dependencies 21148 */ 21149 21150 21151 21152 21153 /** 21154 * Internal dependencies 21155 */ 21156 21157 21158 function useScrollIntoView(clientId) { 21159 const ref = Object(external_wp_element_["useRef"])(); 21160 const isSelectionEnd = Object(external_wp_data_["useSelect"])(select => { 21161 const { 21162 isBlockSelected, 21163 getBlockSelectionEnd 21164 } = select(store); 21165 return isBlockSelected(clientId) || getBlockSelectionEnd() === clientId; 21166 }, [clientId]); // Note that we can't use `useRefEffect` here, since an element change does 21167 // not mean we can scroll. `isSelectionEnd` should be the sole dependency, 21168 // while with `useRefEffect`, the element is a dependency as well. 21169 21170 Object(external_wp_element_["useEffect"])(() => { 21171 if (!isSelectionEnd) { 21172 return; 21173 } 21174 21175 const extentNode = ref.current; 21176 21177 if (!extentNode) { 21178 return; 21179 } // If the block is focused, the browser will already have scrolled into 21180 // view if necessary. 21181 21182 21183 if (extentNode.contains(extentNode.ownerDocument.activeElement)) { 21184 return; 21185 } 21186 21187 const scrollContainer = Object(external_wp_dom_["getScrollContainer"])(extentNode) || extentNode.ownerDocument.defaultView; // If there's no scroll container, it follows that there's no scrollbar 21188 // and thus there's no need to try to scroll into view. 21189 21190 if (!scrollContainer) { 21191 return; 21192 } 21193 21194 dom_scroll_into_view_lib_default()(extentNode, scrollContainer, { 21195 onlyScrollIfNeeded: true 21196 }); 21197 }, [isSelectionEnd]); 21198 return ref; 21199 } 21200 21201 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-multi-selection.js 21202 /** 21203 * WordPress dependencies 21204 */ 21205 21206 21207 /** 21208 * Internal dependencies 21209 */ 21210 21211 21212 21213 21214 function toggleRichText(container, toggle) { 21215 Array.from(container.closest('.is-root-container').querySelectorAll('.rich-text')).forEach(node => { 21216 if (toggle) { 21217 node.setAttribute('contenteditable', true); 21218 } else { 21219 node.removeAttribute('contenteditable'); 21220 } 21221 }); 21222 } 21223 /** 21224 * Sets a multi-selection based on the native selection across blocks. 21225 * 21226 * @param {string} clientId Block client ID. 21227 */ 21228 21229 21230 function useMultiSelection(clientId) { 21231 const { 21232 startMultiSelect, 21233 stopMultiSelect, 21234 multiSelect, 21235 selectBlock 21236 } = Object(external_wp_data_["useDispatch"])(store); 21237 const { 21238 isSelectionEnabled, 21239 isBlockSelected, 21240 getBlockParents, 21241 getBlockSelectionStart, 21242 hasMultiSelection 21243 } = Object(external_wp_data_["useSelect"])(store); 21244 return Object(external_wp_compose_["useRefEffect"])(node => { 21245 const { 21246 ownerDocument 21247 } = node; 21248 const { 21249 defaultView 21250 } = ownerDocument; 21251 let anchorElement; 21252 let rafId; 21253 21254 function onSelectionChange({ 21255 isSelectionEnd 21256 }) { 21257 const selection = defaultView.getSelection(); // If no selection is found, end multi selection and enable all rich 21258 // text areas. 21259 21260 if (!selection.rangeCount || selection.isCollapsed) { 21261 toggleRichText(node, true); 21262 return; 21263 } 21264 21265 const endClientId = getBlockClientId(selection.focusNode); 21266 const isSingularSelection = clientId === endClientId; 21267 21268 if (isSingularSelection) { 21269 selectBlock(clientId); // If the selection is complete (on mouse up), and no 21270 // multiple blocks have been selected, set focus back to the 21271 // anchor element. if the anchor element contains the 21272 // selection. Additionally, rich text elements that were 21273 // previously disabled can now be enabled again. 21274 21275 if (isSelectionEnd) { 21276 toggleRichText(node, true); 21277 21278 if (selection.rangeCount) { 21279 const { 21280 commonAncestorContainer 21281 } = selection.getRangeAt(0); 21282 21283 if (anchorElement.contains(commonAncestorContainer)) { 21284 anchorElement.focus(); 21285 } 21286 } 21287 } 21288 } else { 21289 const startPath = [...getBlockParents(clientId), clientId]; 21290 const endPath = [...getBlockParents(endClientId), endClientId]; 21291 const depth = Math.min(startPath.length, endPath.length) - 1; 21292 multiSelect(startPath[depth], endPath[depth]); 21293 } 21294 } 21295 21296 function onSelectionEnd() { 21297 ownerDocument.removeEventListener('selectionchange', onSelectionChange); // Equivalent to attaching the listener once. 21298 21299 defaultView.removeEventListener('mouseup', onSelectionEnd); // The browser selection won't have updated yet at this point, 21300 // so wait until the next animation frame to get the browser 21301 // selection. 21302 21303 rafId = defaultView.requestAnimationFrame(() => { 21304 onSelectionChange({ 21305 isSelectionEnd: true 21306 }); 21307 stopMultiSelect(); 21308 }); 21309 } 21310 21311 function onMouseLeave({ 21312 buttons 21313 }) { 21314 // The primary button must be pressed to initiate selection. 21315 // See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons 21316 if (buttons !== 1) { 21317 return; 21318 } 21319 21320 if (!isSelectionEnabled() || !isBlockSelected(clientId)) { 21321 return; 21322 } 21323 21324 anchorElement = ownerDocument.activeElement; 21325 startMultiSelect(); // `onSelectionStart` is called after `mousedown` and 21326 // `mouseleave` (from a block). The selection ends when 21327 // `mouseup` happens anywhere in the window. 21328 21329 ownerDocument.addEventListener('selectionchange', onSelectionChange); 21330 defaultView.addEventListener('mouseup', onSelectionEnd); // Removing the contenteditable attributes within the block 21331 // editor is essential for selection to work across editable 21332 // areas. The edible hosts are removed, allowing selection to be 21333 // extended outside the DOM element. `startMultiSelect` sets a 21334 // flag in the store so the rich text components are updated, 21335 // but the rerender may happen very slowly, especially in Safari 21336 // for the blocks that are asynchonously rendered. To ensure the 21337 // browser instantly removes the selection boundaries, we remove 21338 // the contenteditable attributes manually. 21339 21340 toggleRichText(node, false); 21341 } 21342 21343 function onMouseDown(event) { 21344 // The main button. 21345 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button 21346 if (!isSelectionEnabled() || event.button !== 0) { 21347 return; 21348 } 21349 21350 if (event.shiftKey) { 21351 const blockSelectionStart = getBlockSelectionStart(); 21352 21353 if (blockSelectionStart !== clientId) { 21354 toggleRichText(node, false); 21355 multiSelect(blockSelectionStart, clientId); 21356 event.preventDefault(); 21357 } 21358 } else if (hasMultiSelection()) { 21359 // Allow user to escape out of a multi-selection to a 21360 // singular selection of a block via click. This is handled 21361 // here since focus handling excludes blocks when there is 21362 // multiselection, as focus can be incurred by starting a 21363 // multiselection (focus moved to first block's multi- 21364 // controls). 21365 selectBlock(clientId); 21366 } 21367 } 21368 21369 node.addEventListener('mousedown', onMouseDown); 21370 node.addEventListener('mouseleave', onMouseLeave); 21371 return () => { 21372 node.removeEventListener('mousedown', onMouseDown); 21373 node.removeEventListener('mouseleave', onMouseLeave); 21374 ownerDocument.removeEventListener('selectionchange', onSelectionChange); 21375 defaultView.removeEventListener('mouseup', onSelectionEnd); 21376 defaultView.cancelAnimationFrame(rafId); 21377 }; 21378 }, [clientId, startMultiSelect, stopMultiSelect, multiSelect, selectBlock, isSelectionEnabled, isBlockSelected, getBlockParents]); 21379 } 21380 21381 // EXTERNAL MODULE: external ["wp","htmlEntities"] 21382 var external_wp_htmlEntities_ = __webpack_require__("rmEH"); 21383 21384 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js 21385 var plus = __webpack_require__("Q4Sy"); 21386 21387 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tips.js 21388 21389 21390 /** 21391 * WordPress dependencies 21392 */ 21393 21394 21395 21396 const globalTips = [Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('While writing, you can press <kbd>/</kbd> to quickly insert new blocks.'), { 21397 kbd: Object(external_wp_element_["createElement"])("kbd", null) 21398 }), Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('Indent a list by pressing <kbd>space</kbd> at the beginning of a line.'), { 21399 kbd: Object(external_wp_element_["createElement"])("kbd", null) 21400 }), Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line.'), { 21401 kbd: Object(external_wp_element_["createElement"])("kbd", null) 21402 }), Object(external_wp_i18n_["__"])('Drag files into the editor to automatically insert media blocks.'), Object(external_wp_i18n_["__"])("Change a block's type by pressing the block icon on the toolbar.")]; 21403 21404 function Tips() { 21405 const [randomIndex] = Object(external_wp_element_["useState"])( // Disable Reason: I'm not generating an HTML id. 21406 // eslint-disable-next-line no-restricted-syntax 21407 Math.floor(Math.random() * globalTips.length)); 21408 return Object(external_wp_element_["createElement"])(external_wp_components_["Tip"], null, globalTips[randomIndex]); 21409 } 21410 21411 /* harmony default export */ var tips = (Tips); 21412 21413 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 21414 var close_small = __webpack_require__("bWcr"); 21415 21416 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js 21417 var search = __webpack_require__("cGtP"); 21418 21419 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-form.js 21420 21421 21422 /** 21423 * External dependencies 21424 */ 21425 21426 /** 21427 * WordPress dependencies 21428 */ 21429 21430 21431 21432 21433 21434 21435 21436 function InserterSearchForm({ 21437 className, 21438 onChange, 21439 value, 21440 label, 21441 placeholder 21442 }) { 21443 const instanceId = Object(external_wp_compose_["useInstanceId"])(InserterSearchForm); 21444 const searchInput = Object(external_wp_element_["useRef"])(); 21445 return Object(external_wp_element_["createElement"])("div", { 21446 className: classnames_default()('block-editor-inserter__search', className) 21447 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 21448 as: "label", 21449 htmlFor: `block-editor-inserter__search-${instanceId}` 21450 }, label || placeholder), Object(external_wp_element_["createElement"])("input", { 21451 ref: searchInput, 21452 className: "block-editor-inserter__search-input", 21453 id: `block-editor-inserter__search-${instanceId}`, 21454 type: "search", 21455 placeholder: placeholder, 21456 onChange: event => onChange(event.target.value), 21457 autoComplete: "off", 21458 value: value || '' 21459 }), Object(external_wp_element_["createElement"])("div", { 21460 className: "block-editor-inserter__search-icon" 21461 }, !!value && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 21462 icon: close_small["a" /* default */], 21463 label: Object(external_wp_i18n_["__"])('Reset search'), 21464 onClick: () => { 21465 onChange(''); 21466 searchInput.current.focus(); 21467 } 21468 }), !value && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 21469 icon: search["a" /* default */] 21470 }))); 21471 } 21472 21473 /* harmony default export */ var search_form = (InserterSearchForm); 21474 21475 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js 21476 21477 21478 /** 21479 * WordPress dependencies 21480 */ 21481 21482 /** 21483 * Internal dependencies 21484 */ 21485 21486 21487 21488 function BlockCard({ 21489 title, 21490 icon, 21491 description, 21492 blockType 21493 }) { 21494 if (blockType) { 21495 external_wp_deprecated_default()('`blockType` property in `BlockCard component`', { 21496 since: '5.7', 21497 alternative: '`title, icon and description` properties' 21498 }); 21499 ({ 21500 title, 21501 icon, 21502 description 21503 } = blockType); 21504 } 21505 21506 return Object(external_wp_element_["createElement"])("div", { 21507 className: "block-editor-block-card" 21508 }, Object(external_wp_element_["createElement"])(BlockIcon, { 21509 icon: icon, 21510 showColors: true 21511 }), Object(external_wp_element_["createElement"])("div", { 21512 className: "block-editor-block-card__content" 21513 }, Object(external_wp_element_["createElement"])("h2", { 21514 className: "block-editor-block-card__title" 21515 }, title), Object(external_wp_element_["createElement"])("span", { 21516 className: "block-editor-block-card__description" 21517 }, description))); 21518 } 21519 21520 /* harmony default export */ var block_card = (BlockCard); 21521 21522 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/with-registry-provider.js 21523 21524 21525 21526 /** 21527 * WordPress dependencies 21528 */ 21529 21530 21531 21532 /** 21533 * Internal dependencies 21534 */ 21535 21536 21537 21538 const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => { 21539 return Object(external_wp_data_["withRegistry"])(({ 21540 useSubRegistry = true, 21541 registry, 21542 ...props 21543 }) => { 21544 if (!useSubRegistry) { 21545 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({ 21546 registry: registry 21547 }, props)); 21548 } 21549 21550 const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null); 21551 Object(external_wp_element_["useEffect"])(() => { 21552 const newRegistry = Object(external_wp_data_["createRegistry"])({}, registry); 21553 newRegistry.registerStore(STORE_NAME, storeConfig); 21554 setSubRegistry(newRegistry); 21555 }, [registry]); 21556 21557 if (!subRegistry) { 21558 return null; 21559 } 21560 21561 return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], { 21562 value: subRegistry 21563 }, Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({ 21564 registry: subRegistry 21565 }, props))); 21566 }); 21567 }, 'withRegistryProvider'); 21568 /* harmony default export */ var with_registry_provider = (withRegistryProvider); 21569 21570 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js 21571 /** 21572 * External dependencies 21573 */ 21574 21575 /** 21576 * WordPress dependencies 21577 */ 21578 21579 21580 21581 21582 /** 21583 * Internal dependencies 21584 */ 21585 21586 21587 /** 21588 * A function to call when the block value has been updated in the block-editor 21589 * store. 21590 * 21591 * @callback onBlockUpdate 21592 * @param {Object[]} blocks The updated blocks. 21593 * @param {Object} options The updated block options, such as selectionStart 21594 * and selectionEnd. 21595 */ 21596 21597 /** 21598 * useBlockSync is a side effect which handles bidirectional sync between the 21599 * block-editor store and a controlling data source which provides blocks. This 21600 * is most commonly used by the BlockEditorProvider to synchronize the contents 21601 * of the block-editor store with the root entity, like a post. 21602 * 21603 * Another example would be the template part block, which provides blocks from 21604 * a separate entity data source than a root entity. This hook syncs edits to 21605 * the template part in the block editor back to the entity and vice-versa. 21606 * 21607 * Here are some of its basic functions: 21608 * - Initalizes the block-editor store for the given clientID to the blocks 21609 * given via props. 21610 * - Adds incoming changes (like undo) to the block-editor store. 21611 * - Adds outgoing changes (like editing content) to the controlling entity, 21612 * determining if a change should be considered persistent or not. 21613 * - Handles edge cases and race conditions which occur in those operations. 21614 * - Ignores changes which happen to other entities (like nested inner block 21615 * controllers. 21616 * - Passes selection state from the block-editor store to the controlling entity. 21617 * 21618 * @param {Object} props Props for the block sync hook 21619 * @param {string} props.clientId The client ID of the inner block controller. 21620 * If none is passed, then it is assumed to be a 21621 * root controller rather than an inner block 21622 * controller. 21623 * @param {Object[]} props.value The control value for the blocks. This value 21624 * is used to initalize the block-editor store 21625 * and for resetting the blocks to incoming 21626 * changes like undo. 21627 * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo. 21628 * @param {onBlockUpdate} props.onChange Function to call when a persistent 21629 * change has been made in the block-editor blocks 21630 * for the given clientId. For example, after 21631 * this function is called, an entity is marked 21632 * dirty because it has changes to save. 21633 * @param {onBlockUpdate} props.onInput Function to call when a non-persistent 21634 * change has been made in the block-editor blocks 21635 * for the given clientId. When this is called, 21636 * controlling sources do not become dirty. 21637 */ 21638 21639 function useBlockSync({ 21640 clientId = null, 21641 value: controlledBlocks, 21642 selection: controlledSelection, 21643 onChange = external_lodash_["noop"], 21644 onInput = external_lodash_["noop"] 21645 }) { 21646 const registry = Object(external_wp_data_["useRegistry"])(); 21647 const { 21648 resetBlocks, 21649 resetSelection, 21650 replaceInnerBlocks, 21651 setHasControlledInnerBlocks, 21652 __unstableMarkNextChangeAsNotPersistent 21653 } = registry.dispatch(store); 21654 const { 21655 getBlockName, 21656 getBlocks 21657 } = registry.select(store); 21658 const pendingChanges = Object(external_wp_element_["useRef"])({ 21659 incoming: null, 21660 outgoing: [] 21661 }); 21662 const subscribed = Object(external_wp_element_["useRef"])(false); 21663 21664 const setControlledBlocks = () => { 21665 if (!controlledBlocks) { 21666 return; 21667 } // We don't need to persist this change because we only replace 21668 // controlled inner blocks when the change was caused by an entity, 21669 // and so it would already be persisted. 21670 21671 21672 __unstableMarkNextChangeAsNotPersistent(); 21673 21674 if (clientId) { 21675 setHasControlledInnerBlocks(clientId, true); 21676 21677 __unstableMarkNextChangeAsNotPersistent(); 21678 21679 const storeBlocks = controlledBlocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); 21680 21681 if (subscribed.current) { 21682 pendingChanges.current.incoming = storeBlocks; 21683 } 21684 21685 replaceInnerBlocks(clientId, storeBlocks); 21686 } else { 21687 if (subscribed.current) { 21688 pendingChanges.current.incoming = controlledBlocks; 21689 } 21690 21691 resetBlocks(controlledBlocks); 21692 } 21693 }; // Add a subscription to the block-editor registry to detect when changes 21694 // have been made. This lets us inform the data source of changes. This 21695 // is an effect so that the subscriber can run synchronously without 21696 // waiting for React renders for changes. 21697 21698 21699 const onInputRef = Object(external_wp_element_["useRef"])(onInput); 21700 const onChangeRef = Object(external_wp_element_["useRef"])(onChange); 21701 Object(external_wp_element_["useEffect"])(() => { 21702 onInputRef.current = onInput; 21703 onChangeRef.current = onChange; 21704 }, [onInput, onChange]); // Determine if blocks need to be reset when they change. 21705 21706 Object(external_wp_element_["useEffect"])(() => { 21707 if (pendingChanges.current.outgoing.includes(controlledBlocks)) { 21708 // Skip block reset if the value matches expected outbound sync 21709 // triggered by this component by a preceding change detection. 21710 // Only skip if the value matches expectation, since a reset should 21711 // still occur if the value is modified (not equal by reference), 21712 // to allow that the consumer may apply modifications to reflect 21713 // back on the editor. 21714 if (Object(external_lodash_["last"])(pendingChanges.current.outgoing) === controlledBlocks) { 21715 pendingChanges.current.outgoing = []; 21716 } 21717 } else if (getBlocks(clientId) !== controlledBlocks) { 21718 // Reset changing value in all other cases than the sync described 21719 // above. Since this can be reached in an update following an out- 21720 // bound sync, unset the outbound value to avoid considering it in 21721 // subsequent renders. 21722 pendingChanges.current.outgoing = []; 21723 setControlledBlocks(); 21724 21725 if (controlledSelection) { 21726 resetSelection(controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition); 21727 } 21728 } 21729 }, [controlledBlocks, clientId]); 21730 Object(external_wp_element_["useEffect"])(() => { 21731 const { 21732 getSelectionStart, 21733 getSelectionEnd, 21734 getSelectedBlocksInitialCaretPosition, 21735 isLastBlockChangePersistent, 21736 __unstableIsLastBlockChangeIgnored 21737 } = registry.select(store); 21738 let blocks = getBlocks(clientId); 21739 let isPersistent = isLastBlockChangePersistent(); 21740 let previousAreBlocksDifferent = false; 21741 subscribed.current = true; 21742 const unsubscribe = registry.subscribe(() => { 21743 // Sometimes, when changing block lists, lingering subscriptions 21744 // might trigger before they are cleaned up. If the block for which 21745 // the subscription runs is no longer in the store, this would clear 21746 // its parent entity's block list. To avoid this, we bail out if 21747 // the subscription is triggering for a block (`clientId !== null`) 21748 // and its block name can't be found because it's not on the list. 21749 // (`getBlockName( clientId ) === null`). 21750 if (clientId !== null && getBlockName(clientId) === null) return; 21751 const newIsPersistent = isLastBlockChangePersistent(); 21752 const newBlocks = getBlocks(clientId); 21753 const areBlocksDifferent = newBlocks !== blocks; 21754 blocks = newBlocks; 21755 21756 if (areBlocksDifferent && (pendingChanges.current.incoming || __unstableIsLastBlockChangeIgnored())) { 21757 pendingChanges.current.incoming = null; 21758 isPersistent = newIsPersistent; 21759 return; 21760 } // Since we often dispatch an action to mark the previous action as 21761 // persistent, we need to make sure that the blocks changed on the 21762 // previous action before committing the change. 21763 21764 21765 const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent; 21766 21767 if (areBlocksDifferent || didPersistenceChange) { 21768 isPersistent = newIsPersistent; // We know that onChange/onInput will update controlledBlocks. 21769 // We need to be aware that it was caused by an outgoing change 21770 // so that we do not treat it as an incoming change later on, 21771 // which would cause a block reset. 21772 21773 pendingChanges.current.outgoing.push(blocks); // Inform the controlling entity that changes have been made to 21774 // the block-editor store they should be aware about. 21775 21776 const updateParent = isPersistent ? onChangeRef.current : onInputRef.current; 21777 updateParent(blocks, { 21778 selection: { 21779 selectionStart: getSelectionStart(), 21780 selectionEnd: getSelectionEnd(), 21781 initialPosition: getSelectedBlocksInitialCaretPosition() 21782 } 21783 }); 21784 } 21785 21786 previousAreBlocksDifferent = areBlocksDifferent; 21787 }); 21788 return () => unsubscribe(); 21789 }, [registry, clientId]); 21790 } 21791 21792 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js 21793 21794 21795 /** 21796 * WordPress dependencies 21797 */ 21798 21799 21800 /** 21801 * Internal dependencies 21802 */ 21803 21804 21805 21806 21807 21808 /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */ 21809 21810 function BlockEditorProvider(props) { 21811 const { 21812 children, 21813 settings 21814 } = props; 21815 const { 21816 updateSettings 21817 } = Object(external_wp_data_["useDispatch"])(store); 21818 Object(external_wp_element_["useEffect"])(() => { 21819 updateSettings(settings); 21820 }, [settings]); // Syncs the entity provider with changes in the block-editor store. 21821 21822 useBlockSync(props); 21823 return Object(external_wp_element_["createElement"])(BlockRefsProvider, null, children); 21824 } 21825 21826 /* harmony default export */ var provider = (with_registry_provider(BlockEditorProvider)); 21827 21828 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/live.js 21829 21830 21831 /** 21832 * WordPress dependencies 21833 */ 21834 21835 /** 21836 * Internal dependencies 21837 */ 21838 21839 21840 function LiveBlockPreview({ 21841 onClick 21842 }) { 21843 return Object(external_wp_element_["createElement"])("div", { 21844 tabIndex: 0, 21845 role: "button", 21846 onClick: onClick, 21847 onKeyPress: onClick 21848 }, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(BlockList, null))); 21849 } 21850 21851 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/auto.js 21852 21853 21854 /** 21855 * WordPress dependencies 21856 */ 21857 21858 21859 /** 21860 * Internal dependencies 21861 */ 21862 21863 // This is used to avoid rendering the block list if the sizes change. 21864 21865 let MemoizedBlockList; 21866 21867 function AutoBlockPreview({ 21868 viewportWidth, 21869 __experimentalPadding 21870 }) { 21871 const [containerResizeListener, { 21872 width: containerWidth 21873 }] = Object(external_wp_compose_["useResizeObserver"])(); 21874 const [containtResizeListener, { 21875 height: contentHeight 21876 }] = Object(external_wp_compose_["useResizeObserver"])(); // Initialize on render instead of module top level, to avoid circular dependency issues. 21877 21878 MemoizedBlockList = MemoizedBlockList || Object(external_wp_compose_["pure"])(BlockList); 21879 const scale = (containerWidth - 2 * __experimentalPadding) / viewportWidth; 21880 return Object(external_wp_element_["createElement"])("div", { 21881 className: "block-editor-block-preview__container editor-styles-wrapper", 21882 "aria-hidden": true, 21883 style: { 21884 height: contentHeight * scale + 2 * __experimentalPadding 21885 } 21886 }, containerResizeListener, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], { 21887 style: { 21888 transform: `scale(${scale})`, 21889 width: viewportWidth, 21890 left: __experimentalPadding, 21891 right: __experimentalPadding, 21892 top: __experimentalPadding 21893 }, 21894 className: "block-editor-block-preview__content" 21895 }, containtResizeListener, Object(external_wp_element_["createElement"])(MemoizedBlockList, null))); 21896 } 21897 21898 /* harmony default export */ var auto = (AutoBlockPreview); 21899 21900 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js 21901 21902 21903 /** 21904 * External dependencies 21905 */ 21906 21907 /** 21908 * WordPress dependencies 21909 */ 21910 21911 21912 21913 /** 21914 * Internal dependencies 21915 */ 21916 21917 21918 21919 21920 21921 function BlockPreview({ 21922 blocks, 21923 __experimentalPadding = 0, 21924 viewportWidth = 1200, 21925 __experimentalLive = false, 21926 __experimentalOnClick 21927 }) { 21928 const originalSettings = Object(external_wp_data_["useSelect"])(select => select(store).getSettings(), []); 21929 const settings = Object(external_wp_element_["useMemo"])(() => { 21930 const _settings = { ...originalSettings 21931 }; 21932 _settings.__experimentalBlockPatterns = []; 21933 return _settings; 21934 }, [originalSettings]); 21935 const renderedBlocks = Object(external_wp_element_["useMemo"])(() => Object(external_lodash_["castArray"])(blocks), [blocks]); 21936 21937 if (!blocks || blocks.length === 0) { 21938 return null; 21939 } 21940 21941 return Object(external_wp_element_["createElement"])(provider, { 21942 value: renderedBlocks, 21943 settings: settings 21944 }, __experimentalLive ? Object(external_wp_element_["createElement"])(LiveBlockPreview, { 21945 onClick: __experimentalOnClick 21946 }) : Object(external_wp_element_["createElement"])(auto, { 21947 viewportWidth: viewportWidth, 21948 __experimentalPadding: __experimentalPadding 21949 })); 21950 } 21951 /** 21952 * BlockPreview renders a preview of a block or array of blocks. 21953 * 21954 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md 21955 * 21956 * @param {Object} preview options for how the preview should be shown 21957 * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed. 21958 * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700. 21959 * 21960 * @return {WPComponent} The component to be rendered. 21961 */ 21962 21963 /* harmony default export */ var block_preview = (Object(external_wp_element_["memo"])(BlockPreview)); 21964 21965 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js 21966 21967 21968 /** 21969 * WordPress dependencies 21970 */ 21971 21972 21973 /** 21974 * Internal dependencies 21975 */ 21976 21977 21978 21979 21980 function InserterPreviewPanel({ 21981 item 21982 }) { 21983 var _hoveredItemBlockType, _hoveredItemBlockType2; 21984 21985 const { 21986 name, 21987 title, 21988 icon, 21989 description, 21990 initialAttributes 21991 } = item; 21992 const hoveredItemBlockType = Object(external_wp_blocks_["getBlockType"])(name); 21993 const isReusable = Object(external_wp_blocks_["isReusableBlock"])(item); 21994 return Object(external_wp_element_["createElement"])("div", { 21995 className: "block-editor-inserter__preview-container" 21996 }, Object(external_wp_element_["createElement"])("div", { 21997 className: "block-editor-inserter__preview" 21998 }, isReusable || hoveredItemBlockType.example ? Object(external_wp_element_["createElement"])("div", { 21999 className: "block-editor-inserter__preview-content" 22000 }, Object(external_wp_element_["createElement"])(block_preview, { 22001 __experimentalPadding: 16, 22002 viewportWidth: (_hoveredItemBlockType = (_hoveredItemBlockType2 = hoveredItemBlockType.example) === null || _hoveredItemBlockType2 === void 0 ? void 0 : _hoveredItemBlockType2.viewportWidth) !== null && _hoveredItemBlockType !== void 0 ? _hoveredItemBlockType : 500, 22003 blocks: hoveredItemBlockType.example ? Object(external_wp_blocks_["getBlockFromExample"])(item.name, { 22004 attributes: { ...hoveredItemBlockType.example.attributes, 22005 ...initialAttributes 22006 }, 22007 innerBlocks: hoveredItemBlockType.example.innerBlocks 22008 }) : Object(external_wp_blocks_["createBlock"])(name, initialAttributes) 22009 })) : Object(external_wp_element_["createElement"])("div", { 22010 className: "block-editor-inserter__preview-content-missing" 22011 }, Object(external_wp_i18n_["__"])('No Preview Available.'))), !isReusable && Object(external_wp_element_["createElement"])(block_card, { 22012 title: title, 22013 icon: icon, 22014 description: description 22015 })); 22016 } 22017 22018 /* harmony default export */ var preview_panel = (InserterPreviewPanel); 22019 22020 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/context.js 22021 /** 22022 * WordPress dependencies 22023 */ 22024 22025 const InserterListboxContext = Object(external_wp_element_["createContext"])(); 22026 /* harmony default export */ var inserter_listbox_context = (InserterListboxContext); 22027 22028 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js 22029 22030 22031 22032 /** 22033 * WordPress dependencies 22034 */ 22035 22036 22037 /** 22038 * Internal dependencies 22039 */ 22040 22041 22042 22043 function InserterListboxItem({ 22044 isFirst, 22045 as: Component, 22046 children, 22047 ...props 22048 }, ref) { 22049 const state = Object(external_wp_element_["useContext"])(inserter_listbox_context); 22050 return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ 22051 ref: ref, 22052 state: state, 22053 role: "option" // Use the CompositeItem `focusable` prop over Button's 22054 // isFocusable. The latter was shown to cause an issue 22055 // with tab order in the inserter list. 22056 , 22057 focusable: true 22058 }, props), htmlProps => { 22059 const propsWithTabIndex = { ...htmlProps, 22060 tabIndex: isFirst ? 0 : htmlProps.tabIndex 22061 }; 22062 22063 if (Component) { 22064 return Object(external_wp_element_["createElement"])(Component, propsWithTabIndex, children); 22065 } 22066 22067 if (typeof children === 'function') { 22068 return children(propsWithTabIndex); 22069 } 22070 22071 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], propsWithTabIndex, children); 22072 }); 22073 } 22074 22075 /* harmony default export */ var inserter_listbox_item = (Object(external_wp_element_["forwardRef"])(InserterListboxItem)); 22076 22077 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drag-handle.js 22078 22079 22080 /** 22081 * WordPress dependencies 22082 */ 22083 22084 const dragHandle = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 22085 width: "18", 22086 height: "18", 22087 xmlns: "http://www.w3.org/2000/svg", 22088 viewBox: "0 0 18 18" 22089 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 22090 d: "M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z" 22091 })); 22092 /* harmony default export */ var drag_handle = (dragHandle); 22093 22094 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/draggable-chip.js 22095 22096 22097 /** 22098 * WordPress dependencies 22099 */ 22100 22101 22102 22103 /** 22104 * Internal dependencies 22105 */ 22106 22107 22108 function BlockDraggableChip({ 22109 count, 22110 icon 22111 }) { 22112 return Object(external_wp_element_["createElement"])("div", { 22113 className: "block-editor-block-draggable-chip-wrapper" 22114 }, Object(external_wp_element_["createElement"])("div", { 22115 className: "block-editor-block-draggable-chip" 22116 }, Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], { 22117 justify: "center", 22118 className: "block-editor-block-draggable-chip__content" 22119 }, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, icon ? Object(external_wp_element_["createElement"])(BlockIcon, { 22120 icon: icon 22121 }) : Object(external_wp_i18n_["sprintf"])( 22122 /* translators: %d: Number of blocks. */ 22123 Object(external_wp_i18n_["_n"])('%d block', '%d blocks', count), count)), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(BlockIcon, { 22124 icon: drag_handle 22125 }))))); 22126 } 22127 22128 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-draggable-blocks/index.js 22129 22130 22131 /** 22132 * WordPress dependencies 22133 */ 22134 22135 /** 22136 * Internal dependencies 22137 */ 22138 22139 22140 22141 const InserterDraggableBlocks = ({ 22142 isEnabled, 22143 blocks, 22144 icon, 22145 children 22146 }) => { 22147 const transferData = { 22148 type: 'inserter', 22149 blocks 22150 }; 22151 return Object(external_wp_element_["createElement"])(external_wp_components_["Draggable"], { 22152 __experimentalTransferDataType: "wp-blocks", 22153 transferData: transferData, 22154 __experimentalDragComponent: Object(external_wp_element_["createElement"])(BlockDraggableChip, { 22155 count: blocks.length, 22156 icon: icon 22157 }) 22158 }, ({ 22159 onDraggableStart, 22160 onDraggableEnd 22161 }) => { 22162 return children({ 22163 draggable: isEnabled, 22164 onDragStart: isEnabled ? onDraggableStart : undefined, 22165 onDragEnd: isEnabled ? onDraggableEnd : undefined 22166 }); 22167 }); 22168 }; 22169 22170 /* harmony default export */ var inserter_draggable_blocks = (InserterDraggableBlocks); 22171 22172 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-list-item/index.js 22173 22174 22175 22176 /** 22177 * External dependencies 22178 */ 22179 22180 /** 22181 * WordPress dependencies 22182 */ 22183 22184 22185 22186 22187 /** 22188 * Internal dependencies 22189 */ 22190 22191 22192 22193 22194 /** 22195 * Return true if platform is MacOS. 22196 * 22197 * @param {Object} _window window object by default; used for DI testing. 22198 * 22199 * @return {boolean} True if MacOS; false otherwise. 22200 */ 22201 22202 function isAppleOS(_window = window) { 22203 const { 22204 platform 22205 } = _window.navigator; 22206 return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform); 22207 } 22208 22209 function InserterListItem({ 22210 className, 22211 isFirst, 22212 item, 22213 onSelect, 22214 onHover, 22215 isDraggable, 22216 ...props 22217 }) { 22218 const isDragging = Object(external_wp_element_["useRef"])(false); 22219 const itemIconStyle = item.icon ? { 22220 backgroundColor: item.icon.background, 22221 color: item.icon.foreground 22222 } : {}; 22223 const blocks = Object(external_wp_element_["useMemo"])(() => { 22224 return [Object(external_wp_blocks_["createBlock"])(item.name, item.initialAttributes, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(item.innerBlocks))]; 22225 }, [item.name, item.initialAttributes, item.initialAttributes]); 22226 return Object(external_wp_element_["createElement"])(inserter_draggable_blocks, { 22227 isEnabled: isDraggable && !item.disabled, 22228 blocks: blocks, 22229 icon: item.icon 22230 }, ({ 22231 draggable, 22232 onDragStart, 22233 onDragEnd 22234 }) => Object(external_wp_element_["createElement"])("div", { 22235 className: "block-editor-block-types-list__list-item", 22236 draggable: draggable, 22237 onDragStart: event => { 22238 isDragging.current = true; 22239 22240 if (onDragStart) { 22241 onHover(null); 22242 onDragStart(event); 22243 } 22244 }, 22245 onDragEnd: event => { 22246 isDragging.current = false; 22247 22248 if (onDragEnd) { 22249 onDragEnd(event); 22250 } 22251 } 22252 }, Object(external_wp_element_["createElement"])(inserter_listbox_item, Object(esm_extends["a" /* default */])({ 22253 isFirst: isFirst, 22254 className: classnames_default()('block-editor-block-types-list__item', className), 22255 disabled: item.isDisabled, 22256 onClick: event => { 22257 event.preventDefault(); 22258 onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey); 22259 onHover(null); 22260 }, 22261 onKeyDown: event => { 22262 const { 22263 keyCode 22264 } = event; 22265 22266 if (keyCode === external_wp_keycodes_["ENTER"]) { 22267 event.preventDefault(); 22268 onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey); 22269 onHover(null); 22270 } 22271 }, 22272 onFocus: () => { 22273 if (isDragging.current) { 22274 return; 22275 } 22276 22277 onHover(item); 22278 }, 22279 onMouseEnter: () => { 22280 if (isDragging.current) { 22281 return; 22282 } 22283 22284 onHover(item); 22285 }, 22286 onMouseLeave: () => onHover(null), 22287 onBlur: () => onHover(null) 22288 }, props), Object(external_wp_element_["createElement"])("span", { 22289 className: "block-editor-block-types-list__item-icon", 22290 style: itemIconStyle 22291 }, Object(external_wp_element_["createElement"])(BlockIcon, { 22292 icon: item.icon, 22293 showColors: true 22294 })), Object(external_wp_element_["createElement"])("span", { 22295 className: "block-editor-block-types-list__item-title" 22296 }, item.title)))); 22297 } 22298 22299 /* harmony default export */ var inserter_list_item = (Object(external_wp_element_["memo"])(InserterListItem)); 22300 22301 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/group.js 22302 22303 22304 22305 /** 22306 * WordPress dependencies 22307 */ 22308 22309 22310 22311 22312 function InserterListboxGroup(props, ref) { 22313 const [shouldSpeak, setShouldSpeak] = Object(external_wp_element_["useState"])(false); 22314 Object(external_wp_element_["useEffect"])(() => { 22315 if (shouldSpeak) { 22316 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Use left and right arrow keys to move through blocks')); 22317 } 22318 }, [shouldSpeak]); 22319 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 22320 ref: ref, 22321 role: "listbox", 22322 "aria-orientation": "horizontal", 22323 onFocus: () => { 22324 setShouldSpeak(true); 22325 }, 22326 onBlur: event => { 22327 const focusingOutsideGroup = !event.currentTarget.contains(event.relatedTarget); 22328 22329 if (focusingOutsideGroup) { 22330 setShouldSpeak(false); 22331 } 22332 } 22333 }, props)); 22334 } 22335 22336 /* harmony default export */ var inserter_listbox_group = (Object(external_wp_element_["forwardRef"])(InserterListboxGroup)); 22337 22338 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/row.js 22339 22340 22341 22342 /** 22343 * WordPress dependencies 22344 */ 22345 22346 22347 /** 22348 * Internal dependencies 22349 */ 22350 22351 22352 22353 function InserterListboxRow(props, ref) { 22354 const state = Object(external_wp_element_["useContext"])(inserter_listbox_context); 22355 return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeGroup"], Object(esm_extends["a" /* default */])({ 22356 state: state, 22357 role: "presentation", 22358 ref: ref 22359 }, props)); 22360 } 22361 22362 /* harmony default export */ var inserter_listbox_row = (Object(external_wp_element_["forwardRef"])(InserterListboxRow)); 22363 22364 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-types-list/index.js 22365 22366 22367 /** 22368 * WordPress dependencies 22369 */ 22370 22371 /** 22372 * Internal dependencies 22373 */ 22374 22375 22376 22377 22378 function chunk(array, size) { 22379 const chunks = []; 22380 22381 for (let i = 0, j = array.length; i < j; i += size) { 22382 chunks.push(array.slice(i, i + size)); 22383 } 22384 22385 return chunks; 22386 } 22387 22388 function BlockTypesList({ 22389 items = [], 22390 onSelect, 22391 onHover = () => {}, 22392 children, 22393 label, 22394 isDraggable = true 22395 }) { 22396 return Object(external_wp_element_["createElement"])(inserter_listbox_group, { 22397 className: "block-editor-block-types-list", 22398 "aria-label": label 22399 }, chunk(items, 3).map((row, i) => Object(external_wp_element_["createElement"])(inserter_listbox_row, { 22400 key: i 22401 }, row.map((item, j) => Object(external_wp_element_["createElement"])(inserter_list_item, { 22402 key: item.id, 22403 item: item, 22404 className: Object(external_wp_blocks_["getBlockMenuDefaultClassName"])(item.id), 22405 onSelect: onSelect, 22406 onHover: onHover, 22407 isDraggable: isDraggable, 22408 isFirst: i === 0 && j === 0 22409 })))), children); 22410 } 22411 22412 /* harmony default export */ var block_types_list = (BlockTypesList); 22413 22414 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/panel.js 22415 22416 22417 /** 22418 * WordPress dependencies 22419 */ 22420 22421 22422 function InserterPanel({ 22423 title, 22424 icon, 22425 children 22426 }) { 22427 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 22428 className: "block-editor-inserter__panel-header" 22429 }, Object(external_wp_element_["createElement"])("h2", { 22430 className: "block-editor-inserter__panel-title" 22431 }, title), Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], { 22432 icon: icon 22433 })), Object(external_wp_element_["createElement"])("div", { 22434 className: "block-editor-inserter__panel-content" 22435 }, children)); 22436 } 22437 22438 /* harmony default export */ var panel = (InserterPanel); 22439 22440 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js 22441 22442 22443 /** 22444 * WordPress dependencies 22445 */ 22446 22447 /** 22448 * Internal dependencies 22449 */ 22450 22451 22452 22453 22454 22455 22456 function InserterListbox({ 22457 children 22458 }) { 22459 const compositeState = Object(external_wp_components_["__unstableUseCompositeState"])({ 22460 shift: true, 22461 wrap: 'horizontal' 22462 }); 22463 return Object(external_wp_element_["createElement"])(inserter_listbox_context.Provider, { 22464 value: compositeState 22465 }, children); 22466 } 22467 22468 /* harmony default export */ var inserter_listbox = (InserterListbox); 22469 22470 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js 22471 22472 22473 /** 22474 * External dependencies 22475 */ 22476 22477 /** 22478 * WordPress dependencies 22479 */ 22480 22481 22482 22483 /** 22484 * Internal dependencies 22485 */ 22486 22487 22488 22489 22490 22491 22492 const getBlockNamespace = item => item.name.split('/')[0]; 22493 22494 const MAX_SUGGESTED_ITEMS = 6; 22495 function BlockTypesTab({ 22496 rootClientId, 22497 onInsert, 22498 onHover, 22499 showMostUsedBlocks 22500 }) { 22501 const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert); 22502 const suggestedItems = Object(external_wp_element_["useMemo"])(() => { 22503 return Object(external_lodash_["orderBy"])(items, ['frecency'], ['desc']).slice(0, MAX_SUGGESTED_ITEMS); 22504 }, [items]); 22505 const uncategorizedItems = Object(external_wp_element_["useMemo"])(() => { 22506 return items.filter(item => !item.category); 22507 }, [items]); 22508 const itemsPerCategory = Object(external_wp_element_["useMemo"])(() => { 22509 return Object(external_lodash_["flow"])(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => Object(external_lodash_["groupBy"])(itemList, 'category'))(items); 22510 }, [items]); 22511 const itemsPerCollection = Object(external_wp_element_["useMemo"])(() => { 22512 // Create a new Object to avoid mutating collection. 22513 const result = { ...collections 22514 }; 22515 Object.keys(collections).forEach(namespace => { 22516 result[namespace] = items.filter(item => getBlockNamespace(item) === namespace); 22517 22518 if (result[namespace].length === 0) { 22519 delete result[namespace]; 22520 } 22521 }); 22522 return result; 22523 }, [items, collections]); // Hide block preview on unmount. 22524 22525 Object(external_wp_element_["useEffect"])(() => () => onHover(null), []); 22526 return Object(external_wp_element_["createElement"])(inserter_listbox, null, Object(external_wp_element_["createElement"])("div", null, showMostUsedBlocks && !!suggestedItems.length && Object(external_wp_element_["createElement"])(panel, { 22527 title: Object(external_wp_i18n_["_x"])('Most used', 'blocks') 22528 }, Object(external_wp_element_["createElement"])(block_types_list, { 22529 items: suggestedItems, 22530 onSelect: onSelectItem, 22531 onHover: onHover, 22532 label: Object(external_wp_i18n_["_x"])('Most used', 'blocks') 22533 })), Object(external_lodash_["map"])(categories, category => { 22534 const categoryItems = itemsPerCategory[category.slug]; 22535 22536 if (!categoryItems || !categoryItems.length) { 22537 return null; 22538 } 22539 22540 return Object(external_wp_element_["createElement"])(panel, { 22541 key: category.slug, 22542 title: category.title, 22543 icon: category.icon 22544 }, Object(external_wp_element_["createElement"])(block_types_list, { 22545 items: categoryItems, 22546 onSelect: onSelectItem, 22547 onHover: onHover, 22548 label: category.title 22549 })); 22550 }), uncategorizedItems.length > 0 && Object(external_wp_element_["createElement"])(panel, { 22551 className: "block-editor-inserter__uncategorized-blocks-panel", 22552 title: Object(external_wp_i18n_["__"])('Uncategorized') 22553 }, Object(external_wp_element_["createElement"])(block_types_list, { 22554 items: uncategorizedItems, 22555 onSelect: onSelectItem, 22556 onHover: onHover, 22557 label: Object(external_wp_i18n_["__"])('Uncategorized') 22558 })), Object(external_lodash_["map"])(collections, (collection, namespace) => { 22559 const collectionItems = itemsPerCollection[namespace]; 22560 22561 if (!collectionItems || !collectionItems.length) { 22562 return null; 22563 } 22564 22565 return Object(external_wp_element_["createElement"])(panel, { 22566 key: namespace, 22567 title: collection.title, 22568 icon: collection.icon 22569 }, Object(external_wp_element_["createElement"])(block_types_list, { 22570 items: collectionItems, 22571 onSelect: onSelectItem, 22572 onHover: onHover, 22573 label: collection.title 22574 })); 22575 }))); 22576 } 22577 /* harmony default export */ var block_types_tab = (BlockTypesTab); 22578 22579 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/pattern-panel.js 22580 22581 22582 /** 22583 * External dependencies 22584 */ 22585 22586 /** 22587 * WordPress dependencies 22588 */ 22589 22590 22591 22592 22593 function PatternInserterPanel({ 22594 selectedCategory, 22595 patternCategories, 22596 onClickCategory, 22597 children 22598 }) { 22599 const categoryOptions = () => { 22600 const options = []; 22601 patternCategories.map(patternCategory => { 22602 return options.push({ 22603 value: patternCategory.name, 22604 label: patternCategory.label 22605 }); 22606 }); 22607 return options; 22608 }; 22609 22610 const onChangeSelect = selected => { 22611 onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name)); 22612 }; 22613 22614 const getPanelHeaderClassName = () => { 22615 return classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns'); 22616 }; // In iOS-based mobile devices, the onBlur will fire when selecting an option 22617 // from a Select element. To prevent closing the useDialog on iOS devices, we 22618 // stop propagating the onBlur event if there is no relatedTarget, which means 22619 // that the user most likely did not click on an element within the editor canvas. 22620 22621 22622 const onBlur = event => { 22623 if (!(event !== null && event !== void 0 && event.relatedTarget)) { 22624 event.stopPropagation(); 22625 } 22626 }; 22627 22628 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 22629 className: getPanelHeaderClassName() 22630 }, Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { 22631 className: "block-editor-inserter__panel-dropdown", 22632 label: Object(external_wp_i18n_["__"])('Filter patterns'), 22633 hideLabelFromVision: true, 22634 value: selectedCategory.name, 22635 onChange: onChangeSelect, 22636 onBlur: onBlur, 22637 options: categoryOptions() 22638 })), Object(external_wp_element_["createElement"])("div", { 22639 className: "block-editor-inserter__panel-content" 22640 }, children)); 22641 } 22642 22643 /* harmony default export */ var pattern_panel = (PatternInserterPanel); 22644 22645 // EXTERNAL MODULE: external ["wp","notices"] 22646 var external_wp_notices_ = __webpack_require__("onLe"); 22647 22648 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js 22649 /** 22650 * External dependencies 22651 */ 22652 22653 /** 22654 * WordPress dependencies 22655 */ 22656 22657 22658 22659 22660 22661 22662 /** 22663 * Internal dependencies 22664 */ 22665 22666 22667 /** 22668 * Retrieves the block patterns inserter state. 22669 * 22670 * @param {Function} onInsert function called when inserter a list of blocks. 22671 * @param {string=} rootClientId Insertion's root client ID. 22672 * 22673 * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler) 22674 */ 22675 22676 const usePatternsState = (onInsert, rootClientId) => { 22677 const { 22678 patternCategories, 22679 patterns 22680 } = Object(external_wp_data_["useSelect"])(select => { 22681 const { 22682 __experimentalGetAllowedPatterns, 22683 getSettings 22684 } = select(store); 22685 return { 22686 patterns: __experimentalGetAllowedPatterns(rootClientId), 22687 patternCategories: getSettings().__experimentalBlockPatternCategories 22688 }; 22689 }, [rootClientId]); 22690 const { 22691 createSuccessNotice 22692 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); 22693 const onClickPattern = Object(external_wp_element_["useCallback"])((pattern, blocks) => { 22694 onInsert(Object(external_lodash_["map"])(blocks, block => Object(external_wp_blocks_["cloneBlock"])(block)), pattern.name); 22695 createSuccessNotice(Object(external_wp_i18n_["sprintf"])( 22696 /* translators: %s: block pattern title. */ 22697 Object(external_wp_i18n_["__"])('Block pattern "%s" inserted.'), pattern.title), { 22698 type: 'snackbar' 22699 }); 22700 }, []); 22701 return [patterns, patternCategories, onClickPattern]; 22702 }; 22703 22704 /* harmony default export */ var use_patterns_state = (usePatternsState); 22705 22706 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js 22707 22708 22709 22710 /** 22711 * WordPress dependencies 22712 */ 22713 22714 22715 22716 22717 /** 22718 * Internal dependencies 22719 */ 22720 22721 22722 22723 22724 22725 function BlockPattern({ 22726 isDraggable, 22727 pattern, 22728 onClick, 22729 composite 22730 }) { 22731 const { 22732 name, 22733 viewportWidth 22734 } = pattern; 22735 const { 22736 blocks 22737 } = Object(external_wp_data_["useSelect"])(select => select(store).__experimentalGetParsedPattern(name), [name]); 22738 const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockPattern); 22739 const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`; 22740 return Object(external_wp_element_["createElement"])(inserter_draggable_blocks, { 22741 isEnabled: isDraggable, 22742 blocks: blocks 22743 }, ({ 22744 draggable, 22745 onDragStart, 22746 onDragEnd 22747 }) => Object(external_wp_element_["createElement"])("div", { 22748 className: "block-editor-block-patterns-list__list-item", 22749 "aria-label": pattern.title, 22750 "aria-describedby": pattern.description ? descriptionId : undefined, 22751 draggable: draggable, 22752 onDragStart: onDragStart, 22753 onDragEnd: onDragEnd 22754 }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ 22755 role: "option", 22756 as: "div" 22757 }, composite, { 22758 className: "block-editor-block-patterns-list__item", 22759 onClick: () => onClick(pattern, blocks) 22760 }), Object(external_wp_element_["createElement"])(block_preview, { 22761 blocks: blocks, 22762 viewportWidth: viewportWidth 22763 }), Object(external_wp_element_["createElement"])("div", { 22764 className: "block-editor-block-patterns-list__item-title" 22765 }, pattern.title), !!pattern.description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 22766 id: descriptionId 22767 }, pattern.description)))); 22768 } 22769 22770 function BlockPatternPlaceholder() { 22771 return Object(external_wp_element_["createElement"])("div", { 22772 className: "block-editor-block-patterns-list__item is-placeholder" 22773 }); 22774 } 22775 22776 function BlockPatternList({ 22777 isDraggable, 22778 blockPatterns, 22779 shownPatterns, 22780 onClickPattern, 22781 orientation, 22782 label = Object(external_wp_i18n_["__"])('Block Patterns') 22783 }) { 22784 const composite = Object(external_wp_components_["__unstableUseCompositeState"])({ 22785 orientation 22786 }); 22787 return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { 22788 role: "listbox", 22789 className: "block-editor-block-patterns-list", 22790 "aria-label": label 22791 }), blockPatterns.map(pattern => { 22792 const isShown = shownPatterns.includes(pattern); 22793 return isShown ? Object(external_wp_element_["createElement"])(BlockPattern, { 22794 key: pattern.name, 22795 pattern: pattern, 22796 onClick: onClickPattern, 22797 isDraggable: isDraggable, 22798 composite: composite 22799 }) : Object(external_wp_element_["createElement"])(BlockPatternPlaceholder, { 22800 key: pattern.name 22801 }); 22802 })); 22803 } 22804 22805 /* harmony default export */ var block_patterns_list = (BlockPatternList); 22806 22807 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab.js 22808 22809 22810 /** 22811 * External dependencies 22812 */ 22813 22814 /** 22815 * WordPress dependencies 22816 */ 22817 22818 22819 22820 22821 /** 22822 * Internal dependencies 22823 */ 22824 22825 22826 22827 22828 22829 function BlockPatternsCategory({ 22830 rootClientId, 22831 onInsert, 22832 selectedCategory, 22833 onClickCategory 22834 }) { 22835 const [allPatterns, allCategories, onClick] = use_patterns_state(onInsert, rootClientId); // Remove any empty categories 22836 22837 const populatedCategories = Object(external_wp_element_["useMemo"])(() => allCategories.filter(category => allPatterns.some(pattern => { 22838 var _pattern$categories; 22839 22840 return (_pattern$categories = pattern.categories) === null || _pattern$categories === void 0 ? void 0 : _pattern$categories.includes(category.name); 22841 })), [allPatterns, allCategories]); 22842 const patternCategory = selectedCategory ? selectedCategory : populatedCategories[0]; 22843 Object(external_wp_element_["useEffect"])(() => { 22844 if (allPatterns.some(pattern => getPatternIndex(pattern) === Infinity) && !populatedCategories.find(category => category.name === 'uncategorized')) { 22845 populatedCategories.push({ 22846 name: 'uncategorized', 22847 label: Object(external_wp_i18n_["_x"])('Uncategorized') 22848 }); 22849 } 22850 }, [populatedCategories, allPatterns]); 22851 const getPatternIndex = Object(external_wp_element_["useCallback"])(pattern => { 22852 if (!pattern.categories || !pattern.categories.length) { 22853 return Infinity; 22854 } 22855 22856 const indexedCategories = Object(external_lodash_["fromPairs"])(populatedCategories.map(({ 22857 name 22858 }, index) => [name, index])); 22859 return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity)); 22860 }, [populatedCategories]); 22861 const currentCategoryPatterns = Object(external_wp_element_["useMemo"])(() => allPatterns.filter(pattern => patternCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : pattern.categories && pattern.categories.includes(patternCategory.name)), [allPatterns, patternCategory]); // Ordering the patterns is important for the async rendering. 22862 22863 const orderedPatterns = Object(external_wp_element_["useMemo"])(() => { 22864 return currentCategoryPatterns.sort((a, b) => { 22865 return getPatternIndex(a) - getPatternIndex(b); 22866 }); 22867 }, [currentCategoryPatterns, getPatternIndex]); 22868 const currentShownPatterns = Object(external_wp_compose_["useAsyncList"])(orderedPatterns); 22869 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !!currentCategoryPatterns.length && Object(external_wp_element_["createElement"])(pattern_panel, { 22870 selectedCategory: patternCategory, 22871 patternCategories: populatedCategories, 22872 onClickCategory: onClickCategory 22873 }, Object(external_wp_element_["createElement"])(block_patterns_list, { 22874 shownPatterns: currentShownPatterns, 22875 blockPatterns: currentCategoryPatterns, 22876 onClickPattern: onClick, 22877 label: patternCategory.label, 22878 orientation: "vertical", 22879 isDraggable: true 22880 }))); 22881 } 22882 22883 function BlockPatternsTabs({ 22884 rootClientId, 22885 onInsert, 22886 onClickCategory, 22887 selectedCategory 22888 }) { 22889 return Object(external_wp_element_["createElement"])(BlockPatternsCategory, { 22890 rootClientId: rootClientId, 22891 selectedCategory: selectedCategory, 22892 onInsert: onInsert, 22893 onClickCategory: onClickCategory 22894 }); 22895 } 22896 22897 /* harmony default export */ var block_patterns_tab = (BlockPatternsTabs); 22898 22899 // EXTERNAL MODULE: external ["wp","url"] 22900 var external_wp_url_ = __webpack_require__("Mmq9"); 22901 22902 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js 22903 22904 22905 /** 22906 * WordPress dependencies 22907 */ 22908 22909 22910 22911 function InserterNoResults() { 22912 return Object(external_wp_element_["createElement"])("div", { 22913 className: "block-editor-inserter__no-results" 22914 }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 22915 className: "block-editor-inserter__no-results-icon", 22916 icon: block_default["a" /* default */] 22917 }), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('No results found.'))); 22918 } 22919 22920 /* harmony default export */ var no_results = (InserterNoResults); 22921 22922 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/reusable-blocks-tab.js 22923 22924 22925 /** 22926 * WordPress dependencies 22927 */ 22928 22929 22930 22931 /** 22932 * Internal dependencies 22933 */ 22934 22935 22936 22937 22938 22939 22940 function ReusableBlocksList({ 22941 onHover, 22942 onInsert, 22943 rootClientId 22944 }) { 22945 const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert); 22946 const filteredItems = Object(external_wp_element_["useMemo"])(() => { 22947 return items.filter(({ 22948 category 22949 }) => category === 'reusable'); 22950 }, [items]); 22951 22952 if (filteredItems.length === 0) { 22953 return Object(external_wp_element_["createElement"])(no_results, null); 22954 } 22955 22956 return Object(external_wp_element_["createElement"])(panel, { 22957 title: Object(external_wp_i18n_["__"])('Reusable blocks') 22958 }, Object(external_wp_element_["createElement"])(block_types_list, { 22959 items: filteredItems, 22960 onSelect: onSelectItem, 22961 onHover: onHover, 22962 label: Object(external_wp_i18n_["__"])('Reusable blocks') 22963 })); 22964 } // The unwrapped component is only exported for use by unit tests. 22965 22966 /** 22967 * List of reusable blocks shown in the "Reusable" tab of the inserter. 22968 * 22969 * @param {Object} props Component props. 22970 * @param {?string} props.rootClientId Client id of block to insert into. 22971 * @param {Function} props.onInsert Callback to run when item is inserted. 22972 * @param {Function} props.onHover Callback to run when item is hovered. 22973 * 22974 * @return {WPComponent} The component. 22975 */ 22976 22977 22978 function ReusableBlocksTab({ 22979 rootClientId, 22980 onInsert, 22981 onHover 22982 }) { 22983 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(ReusableBlocksList, { 22984 onHover: onHover, 22985 onInsert: onInsert, 22986 rootClientId: rootClientId 22987 }), Object(external_wp_element_["createElement"])("div", { 22988 className: "block-editor-inserter__manage-reusable-blocks-container" 22989 }, Object(external_wp_element_["createElement"])("a", { 22990 className: "block-editor-inserter__manage-reusable-blocks", 22991 href: Object(external_wp_url_["addQueryArgs"])('edit.php', { 22992 post_type: 'wp_block' 22993 }) 22994 }, Object(external_wp_i18n_["__"])('Manage Reusable blocks')))); 22995 } 22996 /* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab); 22997 22998 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-menu-extension/index.js 22999 /** 23000 * WordPress dependencies 23001 */ 23002 23003 const { 23004 Fill: __unstableInserterMenuExtension, 23005 Slot: inserter_menu_extension_Slot 23006 } = Object(external_wp_components_["createSlotFill"])('__unstableInserterMenuExtension'); 23007 __unstableInserterMenuExtension.Slot = inserter_menu_extension_Slot; 23008 /* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension); 23009 23010 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js 23011 /** 23012 * External dependencies 23013 */ 23014 23015 /** 23016 * WordPress dependencies 23017 */ 23018 23019 23020 23021 23022 23023 23024 /** 23025 * Internal dependencies 23026 */ 23027 23028 23029 /** 23030 * @typedef WPInserterConfig 23031 * 23032 * @property {string=} rootClientId If set, insertion will be into the 23033 * block with this ID. 23034 * @property {number=} insertionIndex If set, insertion will be into this 23035 * explicit position. 23036 * @property {string=} clientId If set, insertion will be after the 23037 * block with this ID. 23038 * @property {boolean=} isAppender Whether the inserter is an appender 23039 * or not. 23040 * @property {Function=} onSelect Called after insertion. 23041 */ 23042 23043 /** 23044 * Returns the insertion point state given the inserter config. 23045 * 23046 * @param {WPInserterConfig} config Inserter Config. 23047 * @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle). 23048 */ 23049 23050 function useInsertionPoint({ 23051 rootClientId = '', 23052 insertionIndex, 23053 clientId, 23054 isAppender, 23055 onSelect, 23056 shouldFocusBlock = true 23057 }) { 23058 const { 23059 getSelectedBlock 23060 } = Object(external_wp_data_["useSelect"])(store); 23061 const { 23062 destinationRootClientId, 23063 destinationIndex 23064 } = Object(external_wp_data_["useSelect"])(select => { 23065 const { 23066 getSelectedBlockClientId, 23067 getBlockRootClientId, 23068 getBlockIndex, 23069 getBlockOrder 23070 } = select(store); 23071 const selectedBlockClientId = getSelectedBlockClientId(); 23072 let _destinationRootClientId = rootClientId; 23073 23074 let _destinationIndex; 23075 23076 if (insertionIndex !== undefined) { 23077 // Insert into a specific index. 23078 _destinationIndex = insertionIndex; 23079 } else if (clientId) { 23080 // Insert after a specific client ID. 23081 _destinationIndex = getBlockIndex(clientId, _destinationRootClientId); 23082 } else if (!isAppender && selectedBlockClientId) { 23083 _destinationRootClientId = getBlockRootClientId(selectedBlockClientId); 23084 _destinationIndex = getBlockIndex(selectedBlockClientId, _destinationRootClientId) + 1; 23085 } else { 23086 // Insert at the end of the list. 23087 _destinationIndex = getBlockOrder(_destinationRootClientId).length; 23088 } 23089 23090 return { 23091 destinationRootClientId: _destinationRootClientId, 23092 destinationIndex: _destinationIndex 23093 }; 23094 }, [rootClientId, insertionIndex, clientId, isAppender]); 23095 const { 23096 replaceBlocks, 23097 insertBlocks, 23098 showInsertionPoint, 23099 hideInsertionPoint 23100 } = Object(external_wp_data_["useDispatch"])(store); 23101 const onInsertBlocks = Object(external_wp_element_["useCallback"])((blocks, meta, shouldForceFocusBlock = false) => { 23102 const selectedBlock = getSelectedBlock(); 23103 23104 if (!isAppender && selectedBlock && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(selectedBlock)) { 23105 replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); 23106 } else { 23107 insertBlocks(blocks, destinationIndex, destinationRootClientId, true, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta); 23108 } 23109 23110 const message = Object(external_wp_i18n_["sprintf"])( // translators: %d: the name of the block that has been added 23111 Object(external_wp_i18n_["_n"])('%d block added.', '%d blocks added.', Object(external_lodash_["castArray"])(blocks).length), Object(external_lodash_["castArray"])(blocks).length); 23112 Object(external_wp_a11y_["speak"])(message); 23113 23114 if (onSelect) { 23115 onSelect(); 23116 } 23117 }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock]); 23118 const onToggleInsertionPoint = Object(external_wp_element_["useCallback"])(show => { 23119 if (show) { 23120 showInsertionPoint(destinationRootClientId, destinationIndex); 23121 } else { 23122 hideInsertionPoint(); 23123 } 23124 }, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]); 23125 return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint]; 23126 } 23127 23128 /* harmony default export */ var use_insertion_point = (useInsertionPoint); 23129 23130 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js 23131 23132 23133 /** 23134 * External dependencies 23135 */ 23136 23137 /** 23138 * WordPress dependencies 23139 */ 23140 23141 23142 23143 23144 23145 23146 /** 23147 * Internal dependencies 23148 */ 23149 23150 23151 23152 23153 23154 23155 23156 23157 23158 23159 23160 23161 function InserterSearchResults({ 23162 filterValue, 23163 onSelect, 23164 onHover, 23165 rootClientId, 23166 clientId, 23167 isAppender, 23168 __experimentalInsertionIndex, 23169 maxBlockPatterns, 23170 maxBlockTypes, 23171 showBlockDirectory = false, 23172 isDraggable = true, 23173 shouldFocusBlock = true 23174 }) { 23175 const debouncedSpeak = Object(external_wp_compose_["useDebounce"])(external_wp_a11y_["speak"], 500); 23176 const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ 23177 onSelect, 23178 rootClientId, 23179 clientId, 23180 isAppender, 23181 insertionIndex: __experimentalInsertionIndex, 23182 shouldFocusBlock 23183 }); 23184 const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks); 23185 const [patterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId); 23186 const filteredBlockTypes = Object(external_wp_element_["useMemo"])(() => { 23187 const results = searchBlockItems(Object(external_lodash_["orderBy"])(blockTypes, ['frecency'], ['desc']), blockTypeCategories, blockTypeCollections, filterValue); 23188 return maxBlockTypes !== undefined ? results.slice(0, maxBlockTypes) : results; 23189 }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]); 23190 const filteredBlockPatterns = Object(external_wp_element_["useMemo"])(() => { 23191 const results = searchItems(patterns, filterValue); 23192 return maxBlockPatterns !== undefined ? results.slice(0, maxBlockPatterns) : results; 23193 }, [filterValue, patterns, maxBlockPatterns]); // Announce search results on change 23194 23195 Object(external_wp_element_["useEffect"])(() => { 23196 if (!filterValue) { 23197 return; 23198 } 23199 23200 const count = filteredBlockTypes.length + filteredBlockPatterns.length; 23201 const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])( 23202 /* translators: %d: number of results. */ 23203 Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', count), count); 23204 debouncedSpeak(resultsFoundMessage); 23205 }, [filterValue, debouncedSpeak]); 23206 const currentShownPatterns = Object(external_wp_compose_["useAsyncList"])(filteredBlockPatterns); 23207 const hasItems = !Object(external_lodash_["isEmpty"])(filteredBlockTypes) || !Object(external_lodash_["isEmpty"])(filteredBlockPatterns); 23208 return Object(external_wp_element_["createElement"])(inserter_listbox, null, !showBlockDirectory && !hasItems && Object(external_wp_element_["createElement"])(no_results, null), !!filteredBlockTypes.length && Object(external_wp_element_["createElement"])(panel, { 23209 title: Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Blocks')) 23210 }, Object(external_wp_element_["createElement"])(block_types_list, { 23211 items: filteredBlockTypes, 23212 onSelect: onSelectBlockType, 23213 onHover: onHover, 23214 label: Object(external_wp_i18n_["__"])('Blocks'), 23215 isDraggable: isDraggable 23216 })), !!filteredBlockTypes.length && !!filteredBlockPatterns.length && Object(external_wp_element_["createElement"])("div", { 23217 className: "block-editor-inserter__quick-inserter-separator" 23218 }), !!filteredBlockPatterns.length && Object(external_wp_element_["createElement"])(panel, { 23219 title: Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Block Patterns')) 23220 }, Object(external_wp_element_["createElement"])("div", { 23221 className: "block-editor-inserter__quick-inserter-patterns" 23222 }, Object(external_wp_element_["createElement"])(block_patterns_list, { 23223 shownPatterns: currentShownPatterns, 23224 blockPatterns: filteredBlockPatterns, 23225 onClickPattern: onSelectBlockPattern, 23226 isDraggable: isDraggable 23227 }))), showBlockDirectory && Object(external_wp_element_["createElement"])(inserter_menu_extension.Slot, { 23228 fillProps: { 23229 onSelect: onSelectBlockType, 23230 onHover, 23231 filterValue, 23232 hasItems, 23233 rootClientId: destinationRootClientId 23234 } 23235 }, fills => { 23236 if (fills.length) { 23237 return fills; 23238 } 23239 23240 if (!hasItems) { 23241 return Object(external_wp_element_["createElement"])(no_results, null); 23242 } 23243 23244 return null; 23245 })); 23246 } 23247 23248 /* harmony default export */ var search_results = (InserterSearchResults); 23249 23250 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tabs.js 23251 23252 23253 /** 23254 * WordPress dependencies 23255 */ 23256 23257 23258 23259 const tabs_blocksTab = { 23260 name: 'blocks', 23261 23262 /* translators: Blocks tab title in the block inserter. */ 23263 title: Object(external_wp_i18n_["__"])('Blocks') 23264 }; 23265 const tabs_patternsTab = { 23266 name: 'patterns', 23267 23268 /* translators: Patterns tab title in the block inserter. */ 23269 title: Object(external_wp_i18n_["__"])('Patterns') 23270 }; 23271 const tabs_reusableBlocksTab = { 23272 name: 'reusable', 23273 23274 /* translators: Reusable blocks tab title in the block inserter. */ 23275 title: Object(external_wp_i18n_["__"])('Reusable') 23276 }; 23277 23278 function InserterTabs({ 23279 children, 23280 showPatterns = false, 23281 showReusableBlocks = false, 23282 onSelect 23283 }) { 23284 const tabs = Object(external_wp_element_["useMemo"])(() => { 23285 const tempTabs = [tabs_blocksTab]; 23286 23287 if (showPatterns) { 23288 tempTabs.push(tabs_patternsTab); 23289 } 23290 23291 if (showReusableBlocks) { 23292 tempTabs.push(tabs_reusableBlocksTab); 23293 } 23294 23295 return tempTabs; 23296 }, [tabs_blocksTab, showPatterns, tabs_patternsTab, showReusableBlocks, tabs_reusableBlocksTab]); 23297 return Object(external_wp_element_["createElement"])(external_wp_components_["TabPanel"], { 23298 className: "block-editor-inserter__tabs", 23299 tabs: tabs, 23300 onSelect: onSelect 23301 }, children); 23302 } 23303 23304 /* harmony default export */ var inserter_tabs = (InserterTabs); 23305 23306 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js 23307 23308 23309 /** 23310 * WordPress dependencies 23311 */ 23312 23313 23314 23315 23316 /** 23317 * Internal dependencies 23318 */ 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 function InserterMenu({ 23332 rootClientId, 23333 clientId, 23334 isAppender, 23335 __experimentalInsertionIndex, 23336 onSelect, 23337 showInserterHelpPanel, 23338 showMostUsedBlocks, 23339 shouldFocusBlock = true 23340 }) { 23341 const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])(''); 23342 const [hoveredItem, setHoveredItem] = Object(external_wp_element_["useState"])(null); 23343 const [selectedPatternCategory, setSelectedPatternCategory] = Object(external_wp_element_["useState"])(null); 23344 const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({ 23345 rootClientId, 23346 clientId, 23347 isAppender, 23348 insertionIndex: __experimentalInsertionIndex, 23349 shouldFocusBlock 23350 }); 23351 const { 23352 showPatterns, 23353 hasReusableBlocks 23354 } = Object(external_wp_data_["useSelect"])(select => { 23355 var _getSettings$__experi; 23356 23357 const { 23358 __experimentalGetAllowedPatterns, 23359 getSettings 23360 } = select(store); 23361 return { 23362 showPatterns: !!__experimentalGetAllowedPatterns(destinationRootClientId).length, 23363 hasReusableBlocks: !!((_getSettings$__experi = getSettings().__experimentalReusableBlocks) !== null && _getSettings$__experi !== void 0 && _getSettings$__experi.length) 23364 }; 23365 }, [destinationRootClientId]); 23366 const onInsert = Object(external_wp_element_["useCallback"])((blocks, meta, shouldForceFocusBlock) => { 23367 onInsertBlocks(blocks, meta, shouldForceFocusBlock); 23368 onSelect(); 23369 }, [onInsertBlocks, onSelect]); 23370 const onInsertPattern = Object(external_wp_element_["useCallback"])((blocks, patternName) => { 23371 onInsertBlocks(blocks, { 23372 patternName 23373 }); 23374 onSelect(); 23375 }, [onInsertBlocks, onSelect]); 23376 const onHover = Object(external_wp_element_["useCallback"])(item => { 23377 onToggleInsertionPoint(!!item); 23378 setHoveredItem(item); 23379 }, [onToggleInsertionPoint, setHoveredItem]); 23380 const onClickPatternCategory = Object(external_wp_element_["useCallback"])(patternCategory => { 23381 setSelectedPatternCategory(patternCategory); 23382 }, [setSelectedPatternCategory]); 23383 const blocksTab = Object(external_wp_element_["useMemo"])(() => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 23384 className: "block-editor-inserter__block-list" 23385 }, Object(external_wp_element_["createElement"])(block_types_tab, { 23386 rootClientId: destinationRootClientId, 23387 onInsert: onInsert, 23388 onHover: onHover, 23389 showMostUsedBlocks: showMostUsedBlocks 23390 })), showInserterHelpPanel && Object(external_wp_element_["createElement"])("div", { 23391 className: "block-editor-inserter__tips" 23392 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 23393 as: "h2" 23394 }, Object(external_wp_i18n_["__"])('A tip for using the block editor')), Object(external_wp_element_["createElement"])(tips, null))), [destinationRootClientId, onInsert, onHover, filterValue, showMostUsedBlocks, showInserterHelpPanel]); 23395 const patternsTab = Object(external_wp_element_["useMemo"])(() => Object(external_wp_element_["createElement"])(block_patterns_tab, { 23396 rootClientId: destinationRootClientId, 23397 onInsert: onInsertPattern, 23398 onClickCategory: onClickPatternCategory, 23399 selectedCategory: selectedPatternCategory 23400 }), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]); 23401 const reusableBlocksTab = Object(external_wp_element_["useMemo"])(() => Object(external_wp_element_["createElement"])(reusable_blocks_tab, { 23402 rootClientId: destinationRootClientId, 23403 onInsert: onInsert, 23404 onHover: onHover 23405 }), [destinationRootClientId, onInsert, onHover]); 23406 const getCurrentTab = Object(external_wp_element_["useCallback"])(tab => { 23407 if (tab.name === 'blocks') { 23408 return blocksTab; 23409 } else if (tab.name === 'patterns') { 23410 return patternsTab; 23411 } 23412 23413 return reusableBlocksTab; 23414 }, [blocksTab, patternsTab, reusableBlocksTab]); 23415 return Object(external_wp_element_["createElement"])("div", { 23416 className: "block-editor-inserter__menu" 23417 }, Object(external_wp_element_["createElement"])("div", { 23418 className: "block-editor-inserter__main-area" 23419 }, Object(external_wp_element_["createElement"])("div", { 23420 className: "block-editor-inserter__content" 23421 }, Object(external_wp_element_["createElement"])(search_form, { 23422 onChange: value => { 23423 if (hoveredItem) setHoveredItem(null); 23424 setFilterValue(value); 23425 }, 23426 value: filterValue, 23427 label: Object(external_wp_i18n_["__"])('Search for blocks and patterns'), 23428 placeholder: Object(external_wp_i18n_["__"])('Search') 23429 }), !!filterValue && Object(external_wp_element_["createElement"])(search_results, { 23430 filterValue: filterValue, 23431 onSelect: onSelect, 23432 onHover: onHover, 23433 rootClientId: rootClientId, 23434 clientId: clientId, 23435 isAppender: isAppender, 23436 __experimentalInsertionIndex: __experimentalInsertionIndex, 23437 showBlockDirectory: true, 23438 shouldFocusBlock: shouldFocusBlock 23439 }), !filterValue && (showPatterns || hasReusableBlocks) && Object(external_wp_element_["createElement"])(inserter_tabs, { 23440 showPatterns: showPatterns, 23441 showReusableBlocks: hasReusableBlocks 23442 }, getCurrentTab), !filterValue && !showPatterns && !hasReusableBlocks && blocksTab)), showInserterHelpPanel && hoveredItem && Object(external_wp_element_["createElement"])(preview_panel, { 23443 item: hoveredItem 23444 })); 23445 } 23446 23447 /* harmony default export */ var menu = (InserterMenu); 23448 23449 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/quick-inserter.js 23450 23451 23452 /** 23453 * External dependencies 23454 */ 23455 23456 /** 23457 * WordPress dependencies 23458 */ 23459 23460 23461 23462 23463 23464 /** 23465 * Internal dependencies 23466 */ 23467 23468 23469 23470 23471 23472 23473 23474 const SEARCH_THRESHOLD = 6; 23475 const quick_inserter_SHOWN_BLOCK_TYPES = 6; 23476 const SHOWN_BLOCK_PATTERNS = 2; 23477 function QuickInserter({ 23478 onSelect, 23479 rootClientId, 23480 clientId, 23481 isAppender 23482 }) { 23483 const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])(''); 23484 const [destinationRootClientId, onInsertBlocks] = use_insertion_point({ 23485 onSelect, 23486 rootClientId, 23487 clientId, 23488 isAppender 23489 }); 23490 const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks); 23491 const [patterns] = use_patterns_state(onInsertBlocks, destinationRootClientId); 23492 const showPatterns = patterns.length && !!filterValue; 23493 const showSearch = showPatterns && patterns.length > SEARCH_THRESHOLD || blockTypes.length > SEARCH_THRESHOLD; 23494 const { 23495 setInserterIsOpened, 23496 insertionIndex 23497 } = Object(external_wp_data_["useSelect"])(select => { 23498 const { 23499 getSettings, 23500 getBlockIndex, 23501 getBlockCount 23502 } = select(store); 23503 const index = getBlockIndex(clientId, rootClientId); 23504 return { 23505 setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened, 23506 insertionIndex: index === -1 ? getBlockCount() : index 23507 }; 23508 }, [clientId, rootClientId]); 23509 Object(external_wp_element_["useEffect"])(() => { 23510 if (setInserterIsOpened) { 23511 setInserterIsOpened(false); 23512 } 23513 }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as 23514 // the insertion point can work as expected 23515 23516 const onBrowseAll = () => { 23517 setInserterIsOpened({ 23518 rootClientId, 23519 insertionIndex 23520 }); 23521 }; 23522 23523 return Object(external_wp_element_["createElement"])("div", { 23524 className: classnames_default()('block-editor-inserter__quick-inserter', { 23525 'has-search': showSearch, 23526 'has-expand': setInserterIsOpened 23527 }) 23528 }, showSearch && Object(external_wp_element_["createElement"])(search_form, { 23529 value: filterValue, 23530 onChange: value => { 23531 setFilterValue(value); 23532 }, 23533 label: Object(external_wp_i18n_["__"])('Search for blocks and patterns'), 23534 placeholder: Object(external_wp_i18n_["__"])('Search') 23535 }), Object(external_wp_element_["createElement"])("div", { 23536 className: "block-editor-inserter__quick-inserter-results" 23537 }, Object(external_wp_element_["createElement"])(search_results, { 23538 filterValue: filterValue, 23539 onSelect: onSelect, 23540 rootClientId: rootClientId, 23541 clientId: clientId, 23542 isAppender: isAppender, 23543 maxBlockPatterns: showPatterns ? SHOWN_BLOCK_PATTERNS : 0, 23544 maxBlockTypes: quick_inserter_SHOWN_BLOCK_TYPES, 23545 isDraggable: false 23546 })), setInserterIsOpened && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 23547 className: "block-editor-inserter__quick-inserter-expand", 23548 onClick: onBrowseAll, 23549 "aria-label": Object(external_wp_i18n_["__"])('Browse all. This will open the main inserter panel in the editor toolbar.') 23550 }, Object(external_wp_i18n_["__"])('Browse all'))); 23551 } 23552 23553 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/index.js 23554 23555 23556 23557 /** 23558 * External dependencies 23559 */ 23560 23561 23562 /** 23563 * WordPress dependencies 23564 */ 23565 23566 23567 23568 23569 23570 23571 23572 23573 23574 /** 23575 * Internal dependencies 23576 */ 23577 23578 23579 23580 23581 23582 const defaultRenderToggle = ({ 23583 onToggle, 23584 disabled, 23585 isOpen, 23586 blockTitle, 23587 hasSingleBlockType, 23588 toggleProps = {} 23589 }) => { 23590 let label; 23591 23592 if (hasSingleBlockType) { 23593 label = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block when there is only one 23594 Object(external_wp_i18n_["_x"])('Add %s', 'directly add the only allowed block'), blockTitle); 23595 } else { 23596 label = Object(external_wp_i18n_["_x"])('Add block', 'Generic label for block inserter button'); 23597 } 23598 23599 const { 23600 onClick, 23601 ...rest 23602 } = toggleProps; // Handle both onClick functions from the toggle and the parent component 23603 23604 function handleClick(event) { 23605 if (onToggle) { 23606 onToggle(event); 23607 } 23608 23609 if (onClick) { 23610 onClick(event); 23611 } 23612 } 23613 23614 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ 23615 icon: plus["a" /* default */], 23616 label: label, 23617 tooltipPosition: "bottom", 23618 onClick: handleClick, 23619 className: "block-editor-inserter__toggle", 23620 "aria-haspopup": !hasSingleBlockType ? 'true' : false, 23621 "aria-expanded": !hasSingleBlockType ? isOpen : false, 23622 disabled: disabled 23623 }, rest)); 23624 }; 23625 23626 class inserter_Inserter extends external_wp_element_["Component"] { 23627 constructor() { 23628 super(...arguments); 23629 this.onToggle = this.onToggle.bind(this); 23630 this.renderToggle = this.renderToggle.bind(this); 23631 this.renderContent = this.renderContent.bind(this); 23632 } 23633 23634 onToggle(isOpen) { 23635 const { 23636 onToggle 23637 } = this.props; // Surface toggle callback to parent component 23638 23639 if (onToggle) { 23640 onToggle(isOpen); 23641 } 23642 } 23643 /** 23644 * Render callback to display Dropdown toggle element. 23645 * 23646 * @param {Object} options 23647 * @param {Function} options.onToggle Callback to invoke when toggle is 23648 * pressed. 23649 * @param {boolean} options.isOpen Whether dropdown is currently open. 23650 * 23651 * @return {WPElement} Dropdown toggle element. 23652 */ 23653 23654 23655 renderToggle({ 23656 onToggle, 23657 isOpen 23658 }) { 23659 const { 23660 disabled, 23661 blockTitle, 23662 hasSingleBlockType, 23663 toggleProps, 23664 hasItems, 23665 renderToggle = defaultRenderToggle 23666 } = this.props; 23667 return renderToggle({ 23668 onToggle, 23669 isOpen, 23670 disabled: disabled || !hasItems, 23671 blockTitle, 23672 hasSingleBlockType, 23673 toggleProps 23674 }); 23675 } 23676 /** 23677 * Render callback to display Dropdown content element. 23678 * 23679 * @param {Object} options 23680 * @param {Function} options.onClose Callback to invoke when dropdown is 23681 * closed. 23682 * 23683 * @return {WPElement} Dropdown content element. 23684 */ 23685 23686 23687 renderContent({ 23688 onClose 23689 }) { 23690 const { 23691 rootClientId, 23692 clientId, 23693 isAppender, 23694 showInserterHelpPanel, 23695 // This prop is experimental to give some time for the quick inserter to mature 23696 // Feel free to make them stable after a few releases. 23697 __experimentalIsQuick: isQuick 23698 } = this.props; 23699 23700 if (isQuick) { 23701 return Object(external_wp_element_["createElement"])(QuickInserter, { 23702 onSelect: () => { 23703 onClose(); 23704 }, 23705 rootClientId: rootClientId, 23706 clientId: clientId, 23707 isAppender: isAppender 23708 }); 23709 } 23710 23711 return Object(external_wp_element_["createElement"])(menu, { 23712 onSelect: () => { 23713 onClose(); 23714 }, 23715 rootClientId: rootClientId, 23716 clientId: clientId, 23717 isAppender: isAppender, 23718 showInserterHelpPanel: showInserterHelpPanel 23719 }); 23720 } 23721 23722 render() { 23723 const { 23724 position, 23725 hasSingleBlockType, 23726 insertOnlyAllowedBlock, 23727 __experimentalIsQuick: isQuick, 23728 onSelectOrClose 23729 } = this.props; 23730 23731 if (hasSingleBlockType) { 23732 return this.renderToggle({ 23733 onToggle: insertOnlyAllowedBlock 23734 }); 23735 } 23736 23737 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 23738 className: "block-editor-inserter", 23739 contentClassName: classnames_default()('block-editor-inserter__popover', { 23740 'is-quick': isQuick 23741 }), 23742 position: position, 23743 onToggle: this.onToggle, 23744 expandOnMobile: true, 23745 headerTitle: Object(external_wp_i18n_["__"])('Add a block'), 23746 renderToggle: this.renderToggle, 23747 renderContent: this.renderContent, 23748 onClose: onSelectOrClose 23749 }); 23750 } 23751 23752 } 23753 23754 /* harmony default export */ var inserter = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { 23755 clientId, 23756 rootClientId 23757 }) => { 23758 const { 23759 getBlockRootClientId, 23760 hasInserterItems, 23761 __experimentalGetAllowedBlocks 23762 } = select(store); 23763 const { 23764 getBlockVariations 23765 } = select(external_wp_blocks_["store"]); 23766 rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined; 23767 23768 const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId); 23769 23770 const hasSingleBlockType = Object(external_lodash_["size"])(allowedBlocks) === 1 && Object(external_lodash_["size"])(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0; 23771 let allowedBlockType = false; 23772 23773 if (hasSingleBlockType) { 23774 allowedBlockType = allowedBlocks[0]; 23775 } 23776 23777 return { 23778 hasItems: hasInserterItems(rootClientId), 23779 hasSingleBlockType, 23780 blockTitle: allowedBlockType ? allowedBlockType.title : '', 23781 allowedBlockType, 23782 rootClientId 23783 }; 23784 }), Object(external_wp_data_["withDispatch"])((dispatch, ownProps, { 23785 select 23786 }) => { 23787 return { 23788 insertOnlyAllowedBlock() { 23789 const { 23790 rootClientId, 23791 clientId, 23792 isAppender, 23793 hasSingleBlockType, 23794 allowedBlockType, 23795 onSelectOrClose 23796 } = ownProps; 23797 23798 if (!hasSingleBlockType) { 23799 return; 23800 } 23801 23802 function getInsertionIndex() { 23803 const { 23804 getBlockIndex, 23805 getBlockSelectionEnd, 23806 getBlockOrder, 23807 getBlockRootClientId 23808 } = select(store); // If the clientId is defined, we insert at the position of the block. 23809 23810 if (clientId) { 23811 return getBlockIndex(clientId, rootClientId); 23812 } // If there a selected block, we insert after the selected block. 23813 23814 23815 const end = getBlockSelectionEnd(); 23816 23817 if (!isAppender && end && getBlockRootClientId(end) === rootClientId) { 23818 return getBlockIndex(end, rootClientId) + 1; 23819 } // Otherwise, we insert at the end of the current rootClientId 23820 23821 23822 return getBlockOrder(rootClientId).length; 23823 } 23824 23825 const { 23826 insertBlock 23827 } = dispatch(store); 23828 const blockToInsert = Object(external_wp_blocks_["createBlock"])(allowedBlockType.name); 23829 insertBlock(blockToInsert, getInsertionIndex(), rootClientId); 23830 23831 if (onSelectOrClose) { 23832 onSelectOrClose(); 23833 } 23834 23835 const message = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block that has been added 23836 Object(external_wp_i18n_["__"])('%s block added'), allowedBlockType.title); 23837 Object(external_wp_a11y_["speak"])(message); 23838 } 23839 23840 }; 23841 }), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as 23842 // a way to detect the global Inserter. 23843 Object(external_wp_compose_["ifCondition"])(({ 23844 hasItems, 23845 isAppender, 23846 rootClientId, 23847 clientId 23848 }) => hasItems || !isAppender && !rootClientId && !clientId)])(inserter_Inserter)); 23849 23850 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-block-appender/index.js 23851 23852 23853 /** 23854 * WordPress dependencies 23855 */ 23856 23857 23858 23859 23860 23861 /** 23862 * Internal dependencies 23863 */ 23864 23865 23866 23867 /** 23868 * Zero width non-breaking space, used as padding for the paragraph when it is 23869 * empty. 23870 */ 23871 23872 const ZWNBSP = '\ufeff'; 23873 function DefaultBlockAppender({ 23874 isLocked, 23875 isVisible, 23876 onAppend, 23877 showPrompt, 23878 placeholder, 23879 rootClientId 23880 }) { 23881 if (isLocked || !isVisible) { 23882 return null; 23883 } 23884 23885 const value = Object(external_wp_htmlEntities_["decodeEntities"])(placeholder) || Object(external_wp_i18n_["__"])('Type / to choose a block'); 23886 23887 return Object(external_wp_element_["createElement"])("div", { 23888 "data-root-client-id": rootClientId || '', 23889 className: "block-editor-default-block-appender" 23890 }, Object(external_wp_element_["createElement"])("p", { 23891 tabIndex: "0" // Only necessary for `useCanvasClickRedirect` to consider it 23892 // as a target. Ideally it should consider any tabbable target, 23893 // but the inserter is rendered in place while it should be 23894 // rendered in a popover, just like it does for an empty 23895 // paragraph block. 23896 , 23897 contentEditable: true, 23898 suppressContentEditableWarning: true // We want this element to be styled as a paragraph by themes. 23899 // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role 23900 , 23901 role: "button", 23902 "aria-label": Object(external_wp_i18n_["__"])('Add block') // The wp-block className is important for editor styles. 23903 , 23904 className: "wp-block block-editor-default-block-appender__content", 23905 onFocus: onAppend 23906 }, showPrompt ? value : ZWNBSP), Object(external_wp_element_["createElement"])(inserter, { 23907 rootClientId: rootClientId, 23908 position: "bottom right", 23909 isAppender: true, 23910 __experimentalIsQuick: true 23911 })); 23912 } 23913 /* harmony default export */ var default_block_appender = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, ownProps) => { 23914 const { 23915 getBlockCount, 23916 getBlockName, 23917 isBlockValid, 23918 getSettings, 23919 getTemplateLock 23920 } = select(store); 23921 const isEmpty = !getBlockCount(ownProps.rootClientId); 23922 const isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === Object(external_wp_blocks_["getDefaultBlockName"])(); 23923 const isLastBlockValid = isBlockValid(ownProps.lastBlockClientId); 23924 const { 23925 bodyPlaceholder 23926 } = getSettings(); 23927 return { 23928 isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid, 23929 showPrompt: isEmpty, 23930 isLocked: !!getTemplateLock(ownProps.rootClientId), 23931 placeholder: bodyPlaceholder 23932 }; 23933 }), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => { 23934 const { 23935 insertDefaultBlock, 23936 startTyping 23937 } = dispatch(store); 23938 return { 23939 onAppend() { 23940 const { 23941 rootClientId 23942 } = ownProps; 23943 insertDefaultBlock(undefined, rootClientId); 23944 startTyping(); 23945 } 23946 23947 }; 23948 }))(DefaultBlockAppender)); 23949 23950 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/button-block-appender/index.js 23951 23952 23953 /** 23954 * External dependencies 23955 */ 23956 23957 /** 23958 * WordPress dependencies 23959 */ 23960 23961 23962 23963 23964 23965 23966 /** 23967 * Internal dependencies 23968 */ 23969 23970 23971 23972 function ButtonBlockAppender({ 23973 rootClientId, 23974 className, 23975 onFocus, 23976 tabIndex 23977 }, ref) { 23978 return Object(external_wp_element_["createElement"])(inserter, { 23979 position: "bottom center", 23980 rootClientId: rootClientId, 23981 __experimentalIsQuick: true, 23982 renderToggle: ({ 23983 onToggle, 23984 disabled, 23985 isOpen, 23986 blockTitle, 23987 hasSingleBlockType 23988 }) => { 23989 let label; 23990 23991 if (hasSingleBlockType) { 23992 label = Object(external_wp_i18n_["sprintf"])( // translators: %s: the name of the block when there is only one 23993 Object(external_wp_i18n_["_x"])('Add %s', 'directly add the only allowed block'), blockTitle); 23994 } else { 23995 label = Object(external_wp_i18n_["_x"])('Add block', 'Generic label for block inserter button'); 23996 } 23997 23998 const isToggleButton = !hasSingleBlockType; 23999 let inserterButton = Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 24000 ref: ref, 24001 onFocus: onFocus, 24002 tabIndex: tabIndex, 24003 className: classnames_default()(className, 'block-editor-button-block-appender'), 24004 onClick: onToggle, 24005 "aria-haspopup": isToggleButton ? 'true' : undefined, 24006 "aria-expanded": isToggleButton ? isOpen : undefined, 24007 disabled: disabled, 24008 label: label 24009 }, !hasSingleBlockType && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 24010 as: "span" 24011 }, label), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 24012 icon: plus["a" /* default */] 24013 })); 24014 24015 if (isToggleButton || hasSingleBlockType) { 24016 inserterButton = Object(external_wp_element_["createElement"])(external_wp_components_["Tooltip"], { 24017 text: label 24018 }, inserterButton); 24019 } 24020 24021 return inserterButton; 24022 }, 24023 isAppender: true 24024 }); 24025 } 24026 /** 24027 * Use `ButtonBlockAppender` instead. 24028 * 24029 * @deprecated 24030 */ 24031 24032 24033 const ButtonBlockerAppender = Object(external_wp_element_["forwardRef"])((props, ref) => { 24034 external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, { 24035 alternative: 'wp.blockEditor.ButtonBlockAppender' 24036 }); 24037 return ButtonBlockAppender(props, ref); 24038 }); 24039 /** 24040 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md 24041 */ 24042 24043 /* harmony default export */ var button_block_appender = (Object(external_wp_element_["forwardRef"])(ButtonBlockAppender)); 24044 24045 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list-appender/index.js 24046 24047 24048 /** 24049 * External dependencies 24050 */ 24051 24052 24053 /** 24054 * WordPress dependencies 24055 */ 24056 24057 24058 24059 24060 /** 24061 * Internal dependencies 24062 */ 24063 24064 24065 24066 // A Context to store the map of the appender map. 24067 24068 const AppenderNodesContext = Object(external_wp_element_["createContext"])(); 24069 24070 function stopPropagation(event) { 24071 event.stopPropagation(); 24072 } 24073 24074 function BlockListAppender({ 24075 blockClientIds, 24076 rootClientId, 24077 canInsertDefaultBlock, 24078 isLocked, 24079 renderAppender: CustomAppender, 24080 className, 24081 selectedBlockClientId, 24082 tagName: TagName = 'div' 24083 }) { 24084 if (isLocked || CustomAppender === false) { 24085 return null; 24086 } 24087 24088 let appender; 24089 24090 if (CustomAppender) { 24091 // Prefer custom render prop if provided. 24092 appender = Object(external_wp_element_["createElement"])(CustomAppender, null); 24093 } else { 24094 const isDocumentAppender = !rootClientId; 24095 const isParentSelected = selectedBlockClientId === rootClientId; 24096 const isAnotherDefaultAppenderAlreadyDisplayed = selectedBlockClientId && !blockClientIds.includes(selectedBlockClientId); 24097 24098 if (!isDocumentAppender && !isParentSelected && (!selectedBlockClientId || isAnotherDefaultAppenderAlreadyDisplayed)) { 24099 return null; 24100 } 24101 24102 if (canInsertDefaultBlock) { 24103 // Render the default block appender when renderAppender has not been 24104 // provided and the context supports use of the default appender. 24105 appender = Object(external_wp_element_["createElement"])(default_block_appender, { 24106 rootClientId: rootClientId, 24107 lastBlockClientId: Object(external_lodash_["last"])(blockClientIds) 24108 }); 24109 } else { 24110 // Fallback in the case no renderAppender has been provided and the 24111 // default block can't be inserted. 24112 appender = Object(external_wp_element_["createElement"])(button_block_appender, { 24113 rootClientId: rootClientId, 24114 className: "block-list-appender__toggle" 24115 }); 24116 } 24117 } 24118 24119 return Object(external_wp_element_["createElement"])(TagName // A `tabIndex` is used on the wrapping `div` element in order to 24120 // force a focus event to occur when an appender `button` element 24121 // is clicked. In some browsers (Firefox, Safari), button clicks do 24122 // not emit a focus event, which could cause this event to propagate 24123 // unexpectedly. The `tabIndex` ensures that the interaction is 24124 // captured as a focus, without also adding an extra tab stop. 24125 // 24126 // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus 24127 , { 24128 tabIndex: -1 // Prevent the block from being selected when the appender is 24129 // clicked. 24130 , 24131 onFocus: stopPropagation, 24132 className: classnames_default()('block-list-appender', className) 24133 }, appender); 24134 } 24135 24136 /* harmony default export */ var block_list_appender = (Object(external_wp_data_["withSelect"])((select, { 24137 rootClientId 24138 }) => { 24139 const { 24140 getBlockOrder, 24141 canInsertBlockType, 24142 getTemplateLock, 24143 getSelectedBlockClientId 24144 } = select(store); 24145 return { 24146 isLocked: !!getTemplateLock(rootClientId), 24147 blockClientIds: getBlockOrder(rootClientId), 24148 canInsertDefaultBlock: canInsertBlockType(Object(external_wp_blocks_["getDefaultBlockName"])(), rootClientId), 24149 selectedBlockClientId: getSelectedBlockClientId() 24150 }; 24151 })(BlockListAppender)); 24152 24153 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js 24154 /** 24155 * WordPress dependencies 24156 */ 24157 24158 24159 24160 /** 24161 * Internal dependencies 24162 */ 24163 24164 24165 /** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */ 24166 24167 /** 24168 * Retrieve the data for a block drop event. 24169 * 24170 * @param {WPSyntheticEvent} event The drop event. 24171 * 24172 * @return {Object} An object with block drag and drop data. 24173 */ 24174 24175 function parseDropEvent(event) { 24176 let result = { 24177 srcRootClientId: null, 24178 srcClientIds: null, 24179 srcIndex: null, 24180 type: null, 24181 blocks: null 24182 }; 24183 24184 if (!event.dataTransfer) { 24185 return result; 24186 } 24187 24188 try { 24189 result = Object.assign(result, JSON.parse(event.dataTransfer.getData('wp-blocks'))); 24190 } catch (err) { 24191 return result; 24192 } 24193 24194 return result; 24195 } 24196 /** 24197 * A function that returns an event handler function for block drop events. 24198 * 24199 * @param {string} targetRootClientId The root client id where the block(s) will be inserted. 24200 * @param {number} targetBlockIndex The index where the block(s) will be inserted. 24201 * @param {Function} getBlockIndex A function that gets the index of a block. 24202 * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks. 24203 * @param {Function} moveBlocksToPosition A function that moves blocks. 24204 * @param {Function} insertBlocks A function that inserts blocks. 24205 * @param {Function} clearSelectedBlock A function that clears block selection. 24206 * @return {Function} The event handler for a block drop event. 24207 */ 24208 24209 function use_on_block_drop_onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock) { 24210 return event => { 24211 const { 24212 srcRootClientId: sourceRootClientId, 24213 srcClientIds: sourceClientIds, 24214 type: dropType, 24215 blocks 24216 } = parseDropEvent(event); // If the user is inserting a block 24217 24218 if (dropType === 'inserter') { 24219 clearSelectedBlock(); 24220 insertBlocks(blocks, targetBlockIndex, targetRootClientId, true, null); 24221 } // If the user is moving a block 24222 24223 24224 if (dropType === 'block') { 24225 const sourceBlockIndex = getBlockIndex(sourceClientIds[0], sourceRootClientId); // If the user is dropping to the same position, return early. 24226 24227 if (sourceRootClientId === targetRootClientId && sourceBlockIndex === targetBlockIndex) { 24228 return; 24229 } // If the user is attempting to drop a block within its own 24230 // nested blocks, return early as this would create infinite 24231 // recursion. 24232 24233 24234 if (sourceClientIds.includes(targetRootClientId) || getClientIdsOfDescendants(sourceClientIds).some(id => id === targetRootClientId)) { 24235 return; 24236 } 24237 24238 const isAtSameLevel = sourceRootClientId === targetRootClientId; 24239 const draggedBlockCount = sourceClientIds.length; // If the block is kept at the same level and moved downwards, 24240 // subtract to take into account that the blocks being dragged 24241 // were removed from the block list above the insertion point. 24242 24243 const insertIndex = isAtSameLevel && sourceBlockIndex < targetBlockIndex ? targetBlockIndex - draggedBlockCount : targetBlockIndex; 24244 moveBlocksToPosition(sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex); 24245 } 24246 }; 24247 } 24248 /** 24249 * A function that returns an event handler function for block-related file drop events. 24250 * 24251 * @param {string} targetRootClientId The root client id where the block(s) will be inserted. 24252 * @param {number} targetBlockIndex The index where the block(s) will be inserted. 24253 * @param {boolean} hasUploadPermissions Whether the user has upload permissions. 24254 * @param {Function} updateBlockAttributes A function that updates a block's attributes. 24255 * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted. 24256 * @param {Function} insertBlocks A function that inserts blocks. 24257 * 24258 * @return {Function} The event handler for a block-related file drop event. 24259 */ 24260 24261 function onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks) { 24262 return files => { 24263 if (!hasUploadPermissions) { 24264 return; 24265 } 24266 24267 const transformation = Object(external_wp_blocks_["findTransform"])(Object(external_wp_blocks_["getBlockTransforms"])('from'), transform => transform.type === 'files' && canInsertBlockType(transform.blockName, targetRootClientId) && transform.isMatch(files)); 24268 24269 if (transformation) { 24270 const blocks = transformation.transform(files, updateBlockAttributes); 24271 insertBlocks(blocks, targetBlockIndex, targetRootClientId); 24272 } 24273 }; 24274 } 24275 /** 24276 * A function that returns an event handler function for block-related HTML drop events. 24277 * 24278 * @param {string} targetRootClientId The root client id where the block(s) will be inserted. 24279 * @param {number} targetBlockIndex The index where the block(s) will be inserted. 24280 * @param {Function} insertBlocks A function that inserts blocks. 24281 * 24282 * @return {Function} The event handler for a block-related HTML drop event. 24283 */ 24284 24285 function use_on_block_drop_onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks) { 24286 return HTML => { 24287 const blocks = Object(external_wp_blocks_["pasteHandler"])({ 24288 HTML, 24289 mode: 'BLOCKS' 24290 }); 24291 24292 if (blocks.length) { 24293 insertBlocks(blocks, targetBlockIndex, targetRootClientId); 24294 } 24295 }; 24296 } 24297 /** 24298 * A React hook for handling block drop events. 24299 * 24300 * @param {string} targetRootClientId The root client id where the block(s) will be inserted. 24301 * @param {number} targetBlockIndex The index where the block(s) will be inserted. 24302 * 24303 * @return {Object} An object that contains the event handlers `onDrop`, `onFilesDrop` and `onHTMLDrop`. 24304 */ 24305 24306 function useOnBlockDrop(targetRootClientId, targetBlockIndex) { 24307 const hasUploadPermissions = Object(external_wp_data_["useSelect"])(select => select(store).getSettings().mediaUpload, []); 24308 const { 24309 canInsertBlockType, 24310 getBlockIndex, 24311 getClientIdsOfDescendants 24312 } = Object(external_wp_data_["useSelect"])(store); 24313 const { 24314 insertBlocks, 24315 moveBlocksToPosition, 24316 updateBlockAttributes, 24317 clearSelectedBlock 24318 } = Object(external_wp_data_["useDispatch"])(store); 24319 24320 const _onDrop = use_on_block_drop_onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocksToPosition, insertBlocks, clearSelectedBlock); 24321 24322 const _onFilesDrop = onFilesDrop(targetRootClientId, targetBlockIndex, hasUploadPermissions, updateBlockAttributes, canInsertBlockType, insertBlocks); 24323 24324 const _onHTMLDrop = use_on_block_drop_onHTMLDrop(targetRootClientId, targetBlockIndex, insertBlocks); 24325 24326 return event => { 24327 const files = Object(external_wp_dom_["getFilesFromDataTransfer"])(event.dataTransfer); 24328 const html = event.dataTransfer.getData('text/html'); 24329 24330 if (files.length) { 24331 _onFilesDrop(files); 24332 } else if (html) { 24333 _onHTMLDrop(html); 24334 } else { 24335 _onDrop(event); 24336 } 24337 }; 24338 } 24339 24340 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/math.js 24341 /** 24342 * A string representing the name of an edge. 24343 * 24344 * @typedef {'top'|'right'|'bottom'|'left'} WPEdgeName 24345 */ 24346 24347 /** 24348 * @typedef {Object} WPPoint 24349 * @property {number} x The horizontal position. 24350 * @property {number} y The vertical position. 24351 */ 24352 24353 /** 24354 * Given a point, a DOMRect and the name of an edge, returns the distance to 24355 * that edge of the rect. 24356 * 24357 * This function works for edges that are horizontal or vertical (e.g. not 24358 * rotated), the following terms are used so that the function works in both 24359 * orientations: 24360 * 24361 * - Forward, meaning the axis running horizontally when an edge is vertical 24362 * and vertically when an edge is horizontal. 24363 * - Lateral, meaning the axis running vertically when an edge is vertical 24364 * and horizontally when an edge is horizontal. 24365 * 24366 * @param {WPPoint} point The point to measure distance from. 24367 * @param {DOMRect} rect A DOM Rect containing edge positions. 24368 * @param {WPEdgeName} edge The edge to measure to. 24369 */ 24370 function getDistanceFromPointToEdge(point, rect, edge) { 24371 const isHorizontal = edge === 'top' || edge === 'bottom'; 24372 const { 24373 x, 24374 y 24375 } = point; 24376 const pointLateralPosition = isHorizontal ? x : y; 24377 const pointForwardPosition = isHorizontal ? y : x; 24378 const edgeStart = isHorizontal ? rect.left : rect.top; 24379 const edgeEnd = isHorizontal ? rect.right : rect.bottom; 24380 const edgeForwardPosition = rect[edge]; // Measure the straight line distance to the edge of the rect, when the 24381 // point is adjacent to the edge. 24382 // Else, if the point is positioned diagonally to the edge of the rect, 24383 // measure diagonally to the nearest corner that the edge meets. 24384 24385 let edgeLateralPosition; 24386 24387 if (pointLateralPosition >= edgeStart && pointLateralPosition <= edgeEnd) { 24388 edgeLateralPosition = pointLateralPosition; 24389 } else if (pointLateralPosition < edgeEnd) { 24390 edgeLateralPosition = edgeStart; 24391 } else { 24392 edgeLateralPosition = edgeEnd; 24393 } 24394 24395 return Math.sqrt((pointLateralPosition - edgeLateralPosition) ** 2 + (pointForwardPosition - edgeForwardPosition) ** 2); 24396 } 24397 /** 24398 * Given a point, a DOMRect and a list of allowed edges returns the name of and 24399 * distance to the nearest edge. 24400 * 24401 * @param {WPPoint} point The point to measure distance from. 24402 * @param {DOMRect} rect A DOM Rect containing edge positions. 24403 * @param {WPEdgeName[]} allowedEdges A list of the edges included in the 24404 * calculation. Defaults to all edges. 24405 * 24406 * @return {[number, string]} An array where the first value is the distance 24407 * and a second is the edge name. 24408 */ 24409 24410 function getDistanceToNearestEdge(point, rect, allowedEdges = ['top', 'bottom', 'left', 'right']) { 24411 let candidateDistance; 24412 let candidateEdge; 24413 allowedEdges.forEach(edge => { 24414 const distance = getDistanceFromPointToEdge(point, rect, edge); 24415 24416 if (candidateDistance === undefined || distance < candidateDistance) { 24417 candidateDistance = distance; 24418 candidateEdge = edge; 24419 } 24420 }); 24421 return [candidateDistance, candidateEdge]; 24422 } 24423 24424 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js 24425 /** 24426 * WordPress dependencies 24427 */ 24428 24429 24430 24431 24432 /** 24433 * Internal dependencies 24434 */ 24435 24436 24437 24438 24439 /** @typedef {import('../../utils/math').WPPoint} WPPoint */ 24440 24441 /** 24442 * The orientation of a block list. 24443 * 24444 * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation 24445 */ 24446 24447 /** 24448 * Given a list of block DOM elements finds the index that a block should be dropped 24449 * at. 24450 * 24451 * @param {Element[]} elements Array of DOM elements that represent each block in a block list. 24452 * @param {WPPoint} position The position of the item being dragged. 24453 * @param {WPBlockListOrientation} orientation The orientation of a block list. 24454 * 24455 * @return {number|undefined} The block index that's closest to the drag position. 24456 */ 24457 24458 function getNearestBlockIndex(elements, position, orientation) { 24459 const allowedEdges = orientation === 'horizontal' ? ['left', 'right'] : ['top', 'bottom']; 24460 const isRightToLeft = Object(external_wp_i18n_["isRTL"])(); 24461 let candidateIndex; 24462 let candidateDistance; 24463 elements.forEach((element, index) => { 24464 const rect = element.getBoundingClientRect(); 24465 const [distance, edge] = getDistanceToNearestEdge(position, rect, allowedEdges); 24466 24467 if (candidateDistance === undefined || distance < candidateDistance) { 24468 // If the user is dropping to the trailing edge of the block 24469 // add 1 to the index to represent dragging after. 24470 // Take RTL languages into account where the left edge is 24471 // the trailing edge. 24472 const isTrailingEdge = edge === 'bottom' || !isRightToLeft && edge === 'right' || isRightToLeft && edge === 'left'; 24473 const offset = isTrailingEdge ? 1 : 0; // Update the currently known best candidate. 24474 24475 candidateDistance = distance; 24476 candidateIndex = index + offset; 24477 } 24478 }); 24479 return candidateIndex; 24480 } 24481 /** 24482 * @typedef {Object} WPBlockDropZoneConfig 24483 * @property {string} rootClientId The root client id for the block list. 24484 */ 24485 24486 /** 24487 * A React hook that can be used to make a block list handle drag and drop. 24488 * 24489 * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone. 24490 */ 24491 24492 function useBlockDropZone({ 24493 // An undefined value represents a top-level block. Default to an empty 24494 // string for this so that `targetRootClientId` can be easily compared to 24495 // values returned by the `getRootBlockClientId` selector, which also uses 24496 // an empty string to represent top-level blocks. 24497 rootClientId: targetRootClientId = '' 24498 } = {}) { 24499 const [targetBlockIndex, setTargetBlockIndex] = Object(external_wp_element_["useState"])(null); 24500 const isLockedAll = Object(external_wp_data_["useSelect"])(select => { 24501 const { 24502 getTemplateLock 24503 } = select(store); 24504 return getTemplateLock(targetRootClientId) === 'all'; 24505 }, [targetRootClientId]); 24506 const { 24507 getBlockListSettings 24508 } = Object(external_wp_data_["useSelect"])(store); 24509 const { 24510 showInsertionPoint, 24511 hideInsertionPoint 24512 } = Object(external_wp_data_["useDispatch"])(store); 24513 const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); 24514 const throttled = Object(external_wp_compose_["useThrottle"])(Object(external_wp_element_["useCallback"])((event, currentTarget) => { 24515 var _getBlockListSettings; 24516 24517 const blockElements = Array.from(currentTarget.children).filter( // Ensure the element is a block. It should have the `wp-block` class. 24518 element => element.classList.contains('wp-block')); 24519 const targetIndex = getNearestBlockIndex(blockElements, { 24520 x: event.clientX, 24521 y: event.clientY 24522 }, (_getBlockListSettings = getBlockListSettings(targetRootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation); 24523 setTargetBlockIndex(targetIndex === undefined ? 0 : targetIndex); 24524 24525 if (targetIndex !== null) { 24526 showInsertionPoint(targetRootClientId, targetIndex); 24527 } 24528 }, []), 200); 24529 return Object(external_wp_compose_["__experimentalUseDropZone"])({ 24530 isDisabled: isLockedAll, 24531 onDrop: onBlockDrop, 24532 24533 onDragOver(event) { 24534 // `currentTarget` is only available while the event is being 24535 // handled, so get it now and pass it to the thottled function. 24536 // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget 24537 throttled(event, event.currentTarget); 24538 }, 24539 24540 onDragLeave() { 24541 throttled.cancel(); 24542 hideInsertionPoint(); 24543 setTargetBlockIndex(null); 24544 }, 24545 24546 onDragEnd() { 24547 throttled.cancel(); 24548 hideInsertionPoint(); 24549 setTargetBlockIndex(null); 24550 } 24551 24552 }); 24553 } 24554 24555 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-popover-scroll.js 24556 /** 24557 * WordPress dependencies 24558 */ 24559 24560 /** 24561 * Allow scrolling "through" popovers over the canvas. This is only called for 24562 * as long as the pointer is over a popover. Do not use React events because it 24563 * will bubble through portals. 24564 * 24565 * @param {Object} scrollableRef 24566 */ 24567 24568 function usePopoverScroll(scrollableRef) { 24569 return Object(external_wp_compose_["useRefEffect"])(node => { 24570 if (!scrollableRef) { 24571 return; 24572 } 24573 24574 function onWheel(event) { 24575 const { 24576 deltaX, 24577 deltaY 24578 } = event; 24579 scrollableRef.current.scrollBy(deltaX, deltaY); 24580 } 24581 24582 node.addEventListener('wheel', onWheel); 24583 return () => { 24584 node.removeEventListener('wheel', onWheel); 24585 }; 24586 }, [scrollableRef]); 24587 } 24588 24589 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js 24590 24591 24592 /** 24593 * External dependencies 24594 */ 24595 24596 /** 24597 * WordPress dependencies 24598 */ 24599 24600 24601 24602 24603 24604 /** 24605 * Internal dependencies 24606 */ 24607 24608 24609 24610 24611 24612 const InsertionPointOpenRef = Object(external_wp_element_["createContext"])(); 24613 24614 function InsertionPointPopover({ 24615 __unstablePopoverSlot, 24616 __unstableContentRef 24617 }) { 24618 const { 24619 selectBlock 24620 } = Object(external_wp_data_["useDispatch"])(store); 24621 const openRef = Object(external_wp_element_["useContext"])(InsertionPointOpenRef); 24622 const ref = Object(external_wp_element_["useRef"])(); 24623 const { 24624 orientation, 24625 previousClientId, 24626 nextClientId, 24627 rootClientId, 24628 isInserterShown 24629 } = Object(external_wp_data_["useSelect"])(select => { 24630 var _getBlockListSettings; 24631 24632 const { 24633 getBlockOrder, 24634 getBlockListSettings, 24635 getBlockInsertionPoint, 24636 isBlockBeingDragged, 24637 getPreviousBlockClientId, 24638 getNextBlockClientId 24639 } = select(store); 24640 const insertionPoint = getBlockInsertionPoint(); 24641 const order = getBlockOrder(insertionPoint.rootClientId); 24642 24643 if (!order.length) { 24644 return {}; 24645 } 24646 24647 let _previousClientId = order[insertionPoint.index - 1]; 24648 let _nextClientId = order[insertionPoint.index]; 24649 24650 while (isBlockBeingDragged(_previousClientId)) { 24651 _previousClientId = getPreviousBlockClientId(_previousClientId); 24652 } 24653 24654 while (isBlockBeingDragged(_nextClientId)) { 24655 _nextClientId = getNextBlockClientId(_nextClientId); 24656 } 24657 24658 return { 24659 previousClientId: _previousClientId, 24660 nextClientId: _nextClientId, 24661 orientation: ((_getBlockListSettings = getBlockListSettings(insertionPoint.rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical', 24662 rootClientId: insertionPoint.rootClientId, 24663 isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter 24664 }; 24665 }, []); 24666 const previousElement = useBlockElement(previousClientId); 24667 const nextElement = useBlockElement(nextClientId); 24668 const style = Object(external_wp_element_["useMemo"])(() => { 24669 if (!previousElement && !nextElement) { 24670 return {}; 24671 } 24672 24673 const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; 24674 const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; 24675 24676 if (orientation === 'vertical') { 24677 return { 24678 width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth, 24679 height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0 24680 }; 24681 } 24682 24683 let width = 0; 24684 24685 if (previousRect && nextRect) { 24686 width = Object(external_wp_i18n_["isRTL"])() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right; 24687 } 24688 24689 return { 24690 width, 24691 height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight 24692 }; 24693 }, [previousElement, nextElement]); 24694 const getAnchorRect = Object(external_wp_element_["useCallback"])(() => { 24695 if (!previousElement && !nextElement) { 24696 return {}; 24697 } 24698 24699 const { 24700 ownerDocument 24701 } = previousElement || nextElement; 24702 const previousRect = previousElement ? previousElement.getBoundingClientRect() : null; 24703 const nextRect = nextElement ? nextElement.getBoundingClientRect() : null; 24704 24705 if (orientation === 'vertical') { 24706 if (Object(external_wp_i18n_["isRTL"])()) { 24707 return { 24708 top: previousRect ? previousRect.bottom : nextRect.top, 24709 left: previousRect ? previousRect.right : nextRect.right, 24710 right: previousRect ? previousRect.left : nextRect.left, 24711 bottom: nextRect ? nextRect.top : previousRect.bottom, 24712 ownerDocument 24713 }; 24714 } 24715 24716 return { 24717 top: previousRect ? previousRect.bottom : nextRect.top, 24718 left: previousRect ? previousRect.left : nextRect.left, 24719 right: previousRect ? previousRect.right : nextRect.right, 24720 bottom: nextRect ? nextRect.top : previousRect.bottom, 24721 ownerDocument 24722 }; 24723 } 24724 24725 if (Object(external_wp_i18n_["isRTL"])()) { 24726 return { 24727 top: previousRect ? previousRect.top : nextRect.top, 24728 left: previousRect ? previousRect.left : nextRect.right, 24729 right: nextRect ? nextRect.right : previousRect.left, 24730 bottom: previousRect ? previousRect.bottom : nextRect.bottom, 24731 ownerDocument 24732 }; 24733 } 24734 24735 return { 24736 top: previousRect ? previousRect.top : nextRect.top, 24737 left: previousRect ? previousRect.right : nextRect.left, 24738 right: nextRect ? nextRect.left : previousRect.right, 24739 bottom: previousRect ? previousRect.bottom : nextRect.bottom, 24740 ownerDocument 24741 }; 24742 }, [previousElement, nextElement]); 24743 const popoverScrollRef = usePopoverScroll(__unstableContentRef); 24744 const className = classnames_default()('block-editor-block-list__insertion-point', 'is-' + orientation); 24745 24746 function onClick(event) { 24747 if (event.target === ref.current && nextClientId) { 24748 selectBlock(nextClientId, -1); 24749 } 24750 } 24751 24752 function onFocus(event) { 24753 // Only handle click on the wrapper specifically, and not an event 24754 // bubbled from the inserter itself. 24755 if (event.target !== ref.current) { 24756 openRef.current = true; 24757 } 24758 } // Only show the in-between inserter between blocks, so when there's a 24759 // previous and a next element. 24760 24761 24762 const showInsertionPointInserter = previousElement && nextElement && isInserterShown; 24763 /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ 24764 // While ideally it would be enough to capture the 24765 // bubbling focus event from the Inserter, due to the 24766 // characteristics of click focusing of `button`s in 24767 // Firefox and Safari, it is not reliable. 24768 // 24769 // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus 24770 24771 return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 24772 ref: popoverScrollRef, 24773 noArrow: true, 24774 animate: false, 24775 getAnchorRect: getAnchorRect, 24776 focusOnMount: false, 24777 className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility, 24778 // otherwise render in place (not in the the default popover slot). 24779 , 24780 __unstableSlotName: __unstablePopoverSlot || null 24781 }, Object(external_wp_element_["createElement"])("div", { 24782 ref: ref, 24783 tabIndex: -1, 24784 onClick: onClick, 24785 onFocus: onFocus, 24786 className: classnames_default()(className, { 24787 'is-with-inserter': showInsertionPointInserter 24788 }), 24789 style: style 24790 }, Object(external_wp_element_["createElement"])("div", { 24791 className: "block-editor-block-list__insertion-point-indicator" 24792 }), showInsertionPointInserter && Object(external_wp_element_["createElement"])("div", { 24793 className: classnames_default()('block-editor-block-list__insertion-point-inserter') 24794 }, Object(external_wp_element_["createElement"])(inserter, { 24795 position: "bottom center", 24796 clientId: nextClientId, 24797 rootClientId: rootClientId, 24798 __experimentalIsQuick: true, 24799 onToggle: isOpen => { 24800 openRef.current = isOpen; 24801 }, 24802 onSelectOrClose: () => { 24803 openRef.current = false; 24804 } 24805 })))); 24806 /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ 24807 } 24808 24809 function InsertionPoint({ 24810 children, 24811 __unstablePopoverSlot, 24812 __unstableContentRef 24813 }) { 24814 const isVisible = Object(external_wp_data_["useSelect"])(select => { 24815 return select(store).isBlockInsertionPointVisible(); 24816 }, []); 24817 return Object(external_wp_element_["createElement"])(InsertionPointOpenRef.Provider, { 24818 value: Object(external_wp_element_["useRef"])(false) 24819 }, isVisible && Object(external_wp_element_["createElement"])(InsertionPointPopover, { 24820 __unstablePopoverSlot: __unstablePopoverSlot, 24821 __unstableContentRef: __unstableContentRef 24822 }), children); 24823 } 24824 24825 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-in-between-inserter.js 24826 /** 24827 * WordPress dependencies 24828 */ 24829 24830 24831 24832 /** 24833 * Internal dependencies 24834 */ 24835 24836 24837 24838 function useInBetweenInserter() { 24839 const openRef = Object(external_wp_element_["useContext"])(InsertionPointOpenRef); 24840 const hasReducedUI = Object(external_wp_data_["useSelect"])(select => select(store).getSettings().hasReducedUI, []); 24841 const { 24842 getBlockListSettings, 24843 getBlockRootClientId, 24844 getBlockIndex, 24845 isBlockInsertionPointVisible, 24846 isMultiSelecting, 24847 getSelectedBlockClientIds, 24848 getTemplateLock 24849 } = Object(external_wp_data_["useSelect"])(store); 24850 const { 24851 showInsertionPoint, 24852 hideInsertionPoint 24853 } = Object(external_wp_data_["useDispatch"])(store); 24854 return Object(external_wp_compose_["useRefEffect"])(node => { 24855 if (hasReducedUI) { 24856 return; 24857 } 24858 24859 function onMouseMove(event) { 24860 var _getBlockListSettings; 24861 24862 if (openRef.current) { 24863 return; 24864 } 24865 24866 if (isMultiSelecting()) { 24867 return; 24868 } 24869 24870 if (!event.target.classList.contains('block-editor-block-list__layout')) { 24871 if (isBlockInsertionPointVisible()) { 24872 hideInsertionPoint(); 24873 } 24874 24875 return; 24876 } 24877 24878 let rootClientId; 24879 24880 if (!event.target.classList.contains('is-root-container')) { 24881 const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]'); 24882 rootClientId = blockElement.getAttribute('data-block'); 24883 } // Don't set the insertion point if the template is locked. 24884 24885 24886 if (getTemplateLock(rootClientId)) { 24887 return; 24888 } 24889 24890 const orientation = ((_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical'; 24891 const rect = event.target.getBoundingClientRect(); 24892 const offsetTop = event.clientY - rect.top; 24893 const offsetLeft = event.clientX - rect.left; 24894 const children = Array.from(event.target.children); 24895 let element = children.find(blockEl => { 24896 return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockEl.offsetTop > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && blockEl.offsetLeft > offsetLeft; 24897 }); 24898 24899 if (!element) { 24900 return; 24901 } // The block may be in an alignment wrapper, so check the first direct 24902 // child if the element has no ID. 24903 24904 24905 if (!element.id) { 24906 element = element.firstElementChild; 24907 24908 if (!element) { 24909 return; 24910 } 24911 } 24912 24913 const clientId = element.id.slice('block-'.length); 24914 24915 if (!clientId) { 24916 return; 24917 } // Don't show the inserter when hovering above (conflicts with 24918 // block toolbar) or inside selected block(s). 24919 24920 24921 if (getSelectedBlockClientIds().includes(clientId)) { 24922 return; 24923 } 24924 24925 const elementRect = element.getBoundingClientRect(); 24926 24927 if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) { 24928 if (isBlockInsertionPointVisible()) { 24929 hideInsertionPoint(); 24930 } 24931 24932 return; 24933 } 24934 24935 const index = getBlockIndex(clientId, rootClientId); // Don't show the in-between inserter before the first block in 24936 // the list (preserves the original behaviour). 24937 24938 if (index === 0) { 24939 if (isBlockInsertionPointVisible()) { 24940 hideInsertionPoint(); 24941 } 24942 24943 return; 24944 } 24945 24946 showInsertionPoint(rootClientId, index, { 24947 __unstableWithInserter: true 24948 }); 24949 } 24950 24951 node.addEventListener('mousemove', onMouseMove); 24952 return () => { 24953 node.removeEventListener('mousemove', onMouseMove); 24954 }; 24955 }, [openRef, getBlockListSettings, getBlockRootClientId, getBlockIndex, isBlockInsertionPointVisible, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds]); 24956 } 24957 24958 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/pre-parse-patterns.js 24959 /** 24960 * WordPress dependencies 24961 */ 24962 24963 24964 /** 24965 * Internal dependencies 24966 */ 24967 24968 24969 24970 const pre_parse_patterns_requestIdleCallback = (() => { 24971 if (typeof window === 'undefined') { 24972 return callback => { 24973 setTimeout(() => callback(Date.now()), 0); 24974 }; 24975 } 24976 24977 return window.requestIdleCallback || window.requestAnimationFrame; 24978 })(); 24979 24980 const cancelIdleCallback = (() => { 24981 if (typeof window === 'undefined') { 24982 return clearTimeout; 24983 } 24984 24985 return window.cancelIdleCallback || window.cancelAnimationFrame; 24986 })(); 24987 24988 function usePreParsePatterns() { 24989 const patterns = Object(external_wp_data_["useSelect"])(_select => _select(store).getSettings().__experimentalBlockPatterns, []); 24990 Object(external_wp_element_["useEffect"])(() => { 24991 if (!(patterns !== null && patterns !== void 0 && patterns.length)) { 24992 return; 24993 } 24994 24995 let handle; 24996 let index = -1; 24997 24998 const callback = () => { 24999 index++; 25000 25001 if (index >= patterns.length) { 25002 return; 25003 } 25004 25005 Object(external_wp_data_["select"])(store).__experimentalGetParsedPattern(patterns[index].name); 25006 25007 handle = pre_parse_patterns_requestIdleCallback(callback); 25008 }; 25009 25010 handle = pre_parse_patterns_requestIdleCallback(callback); 25011 return () => cancelIdleCallback(handle); 25012 }, [patterns]); 25013 return null; 25014 } 25015 25016 // EXTERNAL MODULE: external ["wp","keyboardShortcuts"] 25017 var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m"); 25018 25019 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js 25020 /** 25021 * WordPress dependencies 25022 */ 25023 25024 25025 const SCROLL_INACTIVE_DISTANCE_PX = 50; 25026 const SCROLL_INTERVAL_MS = 25; 25027 const PIXELS_PER_SECOND_PER_PERCENTAGE = 1000; 25028 const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1000); 25029 /** 25030 * React hook that scrolls the scroll container when a block is being dragged. 25031 * 25032 * @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling` 25033 * functions to be called in `onDragStart`, `onDragOver` 25034 * and `onDragEnd` events respectively. 25035 */ 25036 25037 function useScrollWhenDragging() { 25038 const dragStartY = Object(external_wp_element_["useRef"])(null); 25039 const velocityY = Object(external_wp_element_["useRef"])(null); 25040 const scrollParentY = Object(external_wp_element_["useRef"])(null); 25041 const scrollEditorInterval = Object(external_wp_element_["useRef"])(null); // Clear interval when unmounting. 25042 25043 Object(external_wp_element_["useEffect"])(() => () => { 25044 if (scrollEditorInterval.current) { 25045 clearInterval(scrollEditorInterval.current); 25046 scrollEditorInterval.current = null; 25047 } 25048 }, []); 25049 const startScrolling = Object(external_wp_element_["useCallback"])(event => { 25050 dragStartY.current = event.clientY; // Find nearest parent(s) to scroll. 25051 25052 scrollParentY.current = Object(external_wp_dom_["getScrollContainer"])(event.target); 25053 scrollEditorInterval.current = setInterval(() => { 25054 if (scrollParentY.current && velocityY.current) { 25055 const newTop = scrollParentY.current.scrollTop + velocityY.current; // Setting `behavior: 'smooth'` as a scroll property seems to hurt performance. 25056 // Better to use a small scroll interval. 25057 25058 scrollParentY.current.scroll({ 25059 top: newTop 25060 }); 25061 } 25062 }, SCROLL_INTERVAL_MS); 25063 }, []); 25064 const scrollOnDragOver = Object(external_wp_element_["useCallback"])(event => { 25065 if (!scrollParentY.current) { 25066 return; 25067 } 25068 25069 const scrollParentHeight = scrollParentY.current.offsetHeight; 25070 const offsetDragStartPosition = dragStartY.current - scrollParentY.current.offsetTop; 25071 const offsetDragPosition = event.clientY - scrollParentY.current.offsetTop; 25072 25073 if (event.clientY > offsetDragStartPosition) { 25074 // User is dragging downwards. 25075 const moveableDistance = Math.max(scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); 25076 const dragDistance = Math.max(offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); 25077 const distancePercentage = dragDistance / moveableDistance; 25078 velocityY.current = VELOCITY_MULTIPLIER * distancePercentage; 25079 } else if (event.clientY < offsetDragStartPosition) { 25080 // User is dragging upwards. 25081 const moveableDistance = Math.max(offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); 25082 const dragDistance = Math.max(offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0); 25083 const distancePercentage = dragDistance / moveableDistance; 25084 velocityY.current = -VELOCITY_MULTIPLIER * distancePercentage; 25085 } else { 25086 velocityY.current = 0; 25087 } 25088 }, []); 25089 25090 const stopScrolling = () => { 25091 dragStartY.current = null; 25092 scrollParentY.current = null; 25093 25094 if (scrollEditorInterval.current) { 25095 clearInterval(scrollEditorInterval.current); 25096 scrollEditorInterval.current = null; 25097 } 25098 }; 25099 25100 return [startScrolling, scrollOnDragOver, stopScrolling]; 25101 } 25102 25103 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-draggable/index.js 25104 25105 25106 /** 25107 * WordPress dependencies 25108 */ 25109 25110 25111 25112 25113 /** 25114 * Internal dependencies 25115 */ 25116 25117 25118 25119 25120 25121 const BlockDraggable = ({ 25122 children, 25123 clientIds, 25124 cloneClassname, 25125 onDragStart, 25126 onDragEnd, 25127 elementId 25128 }) => { 25129 const { 25130 srcRootClientId, 25131 isDraggable, 25132 icon 25133 } = Object(external_wp_data_["useSelect"])(select => { 25134 var _getBlockType; 25135 25136 const { 25137 getBlockRootClientId, 25138 getTemplateLock, 25139 getBlockName 25140 } = select(store); 25141 const rootClientId = getBlockRootClientId(clientIds[0]); 25142 const templateLock = rootClientId ? getTemplateLock(rootClientId) : null; 25143 const blockName = getBlockName(clientIds[0]); 25144 return { 25145 srcRootClientId: rootClientId, 25146 isDraggable: 'all' !== templateLock, 25147 icon: (_getBlockType = Object(external_wp_blocks_["getBlockType"])(blockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon 25148 }; 25149 }, [clientIds]); 25150 const isDragging = Object(external_wp_element_["useRef"])(false); 25151 const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging(); 25152 const { 25153 startDraggingBlocks, 25154 stopDraggingBlocks 25155 } = Object(external_wp_data_["useDispatch"])(store); // Stop dragging blocks if the block draggable is unmounted 25156 25157 Object(external_wp_element_["useEffect"])(() => { 25158 return () => { 25159 if (isDragging.current) { 25160 stopDraggingBlocks(); 25161 } 25162 }; 25163 }, []); 25164 25165 if (!isDraggable) { 25166 return children({ 25167 isDraggable: false 25168 }); 25169 } 25170 25171 const transferData = { 25172 type: 'block', 25173 srcClientIds: clientIds, 25174 srcRootClientId 25175 }; 25176 return Object(external_wp_element_["createElement"])(external_wp_components_["Draggable"], { 25177 cloneClassname: cloneClassname, 25178 elementId: elementId, 25179 __experimentalTransferDataType: "wp-blocks", 25180 transferData: transferData, 25181 onDragStart: event => { 25182 startDraggingBlocks(clientIds); 25183 isDragging.current = true; 25184 startScrolling(event); 25185 25186 if (onDragStart) { 25187 onDragStart(); 25188 } 25189 }, 25190 onDragOver: scrollOnDragOver, 25191 onDragEnd: () => { 25192 stopDraggingBlocks(); 25193 isDragging.current = false; 25194 stopScrolling(); 25195 25196 if (onDragEnd) { 25197 onDragEnd(); 25198 } 25199 }, 25200 __experimentalDragComponent: Object(external_wp_element_["createElement"])(BlockDraggableChip, { 25201 count: clientIds.length, 25202 icon: icon 25203 }) 25204 }, ({ 25205 onDraggableStart, 25206 onDraggableEnd 25207 }) => { 25208 return children({ 25209 draggable: true, 25210 onDragStart: onDraggableStart, 25211 onDragEnd: onDraggableEnd 25212 }); 25213 }); 25214 }; 25215 25216 /* harmony default export */ var block_draggable = (BlockDraggable); 25217 25218 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-selection-button.js 25219 25220 25221 25222 /** 25223 * External dependencies 25224 */ 25225 25226 /** 25227 * WordPress dependencies 25228 */ 25229 25230 25231 25232 25233 25234 25235 25236 25237 25238 25239 /** 25240 * Internal dependencies 25241 */ 25242 25243 25244 25245 25246 25247 25248 /** 25249 * Returns true if the user is using windows. 25250 * 25251 * @return {boolean} Whether the user is using Windows. 25252 */ 25253 25254 function isWindows() { 25255 return window.navigator.platform.indexOf('Win') > -1; 25256 } 25257 /** 25258 * Block selection button component, displaying the label of the block. If the block 25259 * descends from a root block, a button is displayed enabling the user to select 25260 * the root block. 25261 * 25262 * @param {string} props Component props. 25263 * @param {string} props.clientId Client ID of block. 25264 * 25265 * @return {WPComponent} The component to be rendered. 25266 */ 25267 25268 25269 function BlockSelectionButton({ 25270 clientId, 25271 rootClientId, 25272 blockElement 25273 }) { 25274 const blockInformation = useBlockDisplayInformation(clientId); 25275 const selected = Object(external_wp_data_["useSelect"])(select => { 25276 var _getBlockListSettings; 25277 25278 const { 25279 __unstableGetBlockWithoutInnerBlocks, 25280 getBlockIndex, 25281 hasBlockMovingClientId, 25282 getBlockListSettings 25283 } = select(store); 25284 const index = getBlockIndex(clientId, rootClientId); 25285 25286 const { 25287 name, 25288 attributes 25289 } = __unstableGetBlockWithoutInnerBlocks(clientId); 25290 25291 const blockMovingMode = hasBlockMovingClientId(); 25292 return { 25293 index, 25294 name, 25295 attributes, 25296 blockMovingMode, 25297 orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation 25298 }; 25299 }, [clientId, rootClientId]); 25300 const { 25301 index, 25302 name, 25303 attributes, 25304 blockMovingMode, 25305 orientation 25306 } = selected; 25307 const { 25308 setNavigationMode, 25309 removeBlock 25310 } = Object(external_wp_data_["useDispatch"])(store); 25311 const ref = Object(external_wp_element_["useRef"])(); // Focus the breadcrumb in navigation mode. 25312 25313 Object(external_wp_element_["useEffect"])(() => { 25314 ref.current.focus(); // NVDA on windows suffers from a bug where focus changes are not announced properly 25315 // See WordPress/gutenberg#24121 and nvaccess/nvda#5825 for more details 25316 // To solve it we announce the focus change manually. 25317 25318 if (isWindows()) { 25319 Object(external_wp_a11y_["speak"])(label); 25320 } 25321 }, []); 25322 const { 25323 hasBlockMovingClientId, 25324 getBlockIndex, 25325 getBlockRootClientId, 25326 getClientIdsOfDescendants, 25327 getSelectedBlockClientId, 25328 getMultiSelectedBlocksEndClientId, 25329 getPreviousBlockClientId, 25330 getNextBlockClientId 25331 } = Object(external_wp_data_["useSelect"])(store); 25332 const { 25333 selectBlock, 25334 clearSelectedBlock, 25335 setBlockMovingClientId, 25336 moveBlockToPosition 25337 } = Object(external_wp_data_["useDispatch"])(store); 25338 25339 function onKeyDown(event) { 25340 const { 25341 keyCode 25342 } = event; 25343 const isUp = keyCode === external_wp_keycodes_["UP"]; 25344 const isDown = keyCode === external_wp_keycodes_["DOWN"]; 25345 const isLeft = keyCode === external_wp_keycodes_["LEFT"]; 25346 const isRight = keyCode === external_wp_keycodes_["RIGHT"]; 25347 const isTab = keyCode === external_wp_keycodes_["TAB"]; 25348 const isEscape = keyCode === external_wp_keycodes_["ESCAPE"]; 25349 const isEnter = keyCode === external_wp_keycodes_["ENTER"]; 25350 const isSpace = keyCode === external_wp_keycodes_["SPACE"]; 25351 const isShift = event.shiftKey; 25352 25353 if (keyCode === external_wp_keycodes_["BACKSPACE"] || keyCode === external_wp_keycodes_["DELETE"]) { 25354 removeBlock(clientId); 25355 event.preventDefault(); 25356 return; 25357 } 25358 25359 const selectedBlockClientId = getSelectedBlockClientId(); 25360 const selectionEndClientId = getMultiSelectedBlocksEndClientId(); 25361 const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); 25362 const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); 25363 const navigateUp = isTab && isShift || isUp; 25364 const navigateDown = isTab && !isShift || isDown; // Move out of current nesting level (no effect if at root level). 25365 25366 const navigateOut = isLeft; // Move into next nesting level (no effect if the current block has no innerBlocks). 25367 25368 const navigateIn = isRight; 25369 let focusedBlockUid; 25370 25371 if (navigateUp) { 25372 focusedBlockUid = selectionBeforeEndClientId; 25373 } else if (navigateDown) { 25374 focusedBlockUid = selectionAfterEndClientId; 25375 } else if (navigateOut) { 25376 var _getBlockRootClientId; 25377 25378 focusedBlockUid = (_getBlockRootClientId = getBlockRootClientId(selectedBlockClientId)) !== null && _getBlockRootClientId !== void 0 ? _getBlockRootClientId : selectedBlockClientId; 25379 } else if (navigateIn) { 25380 var _getClientIdsOfDescen; 25381 25382 focusedBlockUid = (_getClientIdsOfDescen = getClientIdsOfDescendants([selectedBlockClientId])[0]) !== null && _getClientIdsOfDescen !== void 0 ? _getClientIdsOfDescen : selectedBlockClientId; 25383 } 25384 25385 const startingBlockClientId = hasBlockMovingClientId(); 25386 25387 if (isEscape && startingBlockClientId) { 25388 setBlockMovingClientId(null); 25389 } 25390 25391 if ((isEnter || isSpace) && startingBlockClientId) { 25392 const sourceRoot = getBlockRootClientId(startingBlockClientId); 25393 const destRoot = getBlockRootClientId(selectedBlockClientId); 25394 const sourceBlockIndex = getBlockIndex(startingBlockClientId, sourceRoot); 25395 let destinationBlockIndex = getBlockIndex(selectedBlockClientId, destRoot); 25396 25397 if (sourceBlockIndex < destinationBlockIndex && sourceRoot === destRoot) { 25398 destinationBlockIndex -= 1; 25399 } 25400 25401 moveBlockToPosition(startingBlockClientId, sourceRoot, destRoot, destinationBlockIndex); 25402 selectBlock(startingBlockClientId); 25403 setBlockMovingClientId(null); 25404 } 25405 25406 if (navigateDown || navigateUp || navigateOut || navigateIn) { 25407 if (focusedBlockUid) { 25408 event.preventDefault(); 25409 selectBlock(focusedBlockUid); 25410 } else if (isTab && selectedBlockClientId) { 25411 let nextTabbable; 25412 25413 if (navigateDown) { 25414 nextTabbable = external_wp_dom_["focus"].tabbable.findNext(blockElement); 25415 25416 if (!nextTabbable) { 25417 nextTabbable = blockElement.ownerDocument.defaultView.frameElement; 25418 nextTabbable = external_wp_dom_["focus"].tabbable.findNext(nextTabbable); 25419 } 25420 } else { 25421 nextTabbable = external_wp_dom_["focus"].tabbable.findPrevious(blockElement); 25422 } 25423 25424 if (nextTabbable) { 25425 event.preventDefault(); 25426 nextTabbable.focus(); 25427 clearSelectedBlock(); 25428 } 25429 } 25430 } 25431 } 25432 25433 const blockType = Object(external_wp_blocks_["getBlockType"])(name); 25434 const label = Object(external_wp_blocks_["__experimentalGetAccessibleBlockLabel"])(blockType, attributes, index + 1, orientation); 25435 const classNames = classnames_default()('block-editor-block-list__block-selection-button', { 25436 'is-block-moving-mode': !!blockMovingMode 25437 }); 25438 25439 const dragHandleLabel = Object(external_wp_i18n_["__"])('Drag'); 25440 25441 return Object(external_wp_element_["createElement"])("div", { 25442 className: classNames 25443 }, Object(external_wp_element_["createElement"])(external_wp_components_["Flex"], { 25444 justify: "center", 25445 className: "block-editor-block-list__block-selection-button__content" 25446 }, Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(BlockIcon, { 25447 icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, 25448 showColors: true 25449 })), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(block_draggable, { 25450 clientIds: [clientId] 25451 }, draggableProps => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ 25452 icon: drag_handle, 25453 className: "block-selection-button_drag-handle", 25454 "aria-hidden": "true", 25455 label: dragHandleLabel // Should not be able to tab to drag handle as this 25456 // button can only be used with a pointer device. 25457 , 25458 tabIndex: "-1" 25459 }, draggableProps)))), Object(external_wp_element_["createElement"])(external_wp_components_["FlexItem"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 25460 ref: ref, 25461 onClick: () => setNavigationMode(false), 25462 onKeyDown: onKeyDown, 25463 label: label, 25464 className: "block-selection-button_select-button" 25465 }, Object(external_wp_element_["createElement"])(BlockTitle, { 25466 clientId: clientId 25467 }))))); 25468 } 25469 25470 /* harmony default export */ var block_selection_button = (BlockSelectionButton); 25471 25472 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js 25473 25474 25475 25476 /** 25477 * WordPress dependencies 25478 */ 25479 25480 25481 25482 25483 25484 25485 function hasOnlyToolbarItem(elements) { 25486 const dataProp = 'toolbarItem'; 25487 return !elements.some(element => !(dataProp in element.dataset)); 25488 } 25489 25490 function getAllToolbarItemsIn(container) { 25491 return Array.from(container.querySelectorAll('[data-toolbar-item]')); 25492 } 25493 25494 function hasFocusWithin(container) { 25495 return container.contains(container.ownerDocument.activeElement); 25496 } 25497 25498 function focusFirstTabbableIn(container) { 25499 const [firstTabbable] = external_wp_dom_["focus"].tabbable.find(container); 25500 25501 if (firstTabbable) { 25502 firstTabbable.focus(); 25503 } 25504 } 25505 25506 function useIsAccessibleToolbar(ref) { 25507 /* 25508 * By default, we'll assume the starting accessible state of the Toolbar 25509 * is true, as it seems to be the most common case. 25510 * 25511 * Transitioning from an (initial) false to true state causes the 25512 * <Toolbar /> component to mount twice, which is causing undesired 25513 * side-effects. These side-effects appear to only affect certain 25514 * E2E tests. 25515 * 25516 * This was initial discovered in this pull-request: 25517 * https://github.com/WordPress/gutenberg/pull/23425 25518 */ 25519 const initialAccessibleToolbarState = true; // By default, it's gonna render NavigableMenu. If all the tabbable elements 25520 // inside the toolbar are ToolbarItem components (or derived components like 25521 // ToolbarButton), then we can wrap them with the accessible Toolbar 25522 // component. 25523 25524 const [isAccessibleToolbar, setIsAccessibleToolbar] = Object(external_wp_element_["useState"])(initialAccessibleToolbarState); 25525 const determineIsAccessibleToolbar = Object(external_wp_element_["useCallback"])(() => { 25526 const tabbables = external_wp_dom_["focus"].tabbable.find(ref.current); 25527 const onlyToolbarItem = hasOnlyToolbarItem(tabbables); 25528 25529 if (!onlyToolbarItem) { 25530 external_wp_deprecated_default()('Using custom components as toolbar controls', { 25531 since: '5.6', 25532 alternative: 'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components', 25533 link: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols' 25534 }); 25535 } 25536 25537 setIsAccessibleToolbar(onlyToolbarItem); 25538 }, []); 25539 Object(external_wp_element_["useLayoutEffect"])(() => { 25540 // Toolbar buttons may be rendered asynchronously, so we use 25541 // MutationObserver to check if the toolbar subtree has been modified 25542 const observer = new window.MutationObserver(determineIsAccessibleToolbar); 25543 observer.observe(ref.current, { 25544 childList: true, 25545 subtree: true 25546 }); 25547 return () => observer.disconnect(); 25548 }, [isAccessibleToolbar]); 25549 return isAccessibleToolbar; 25550 } 25551 25552 function useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, defaultIndex, onIndexChange) { 25553 // Make sure we don't use modified versions of this prop 25554 const [initialFocusOnMount] = Object(external_wp_element_["useState"])(focusOnMount); 25555 const [initialIndex] = Object(external_wp_element_["useState"])(defaultIndex); 25556 const focusToolbar = Object(external_wp_element_["useCallback"])(() => { 25557 focusFirstTabbableIn(ref.current); 25558 }, []); // Focus on toolbar when pressing alt+F10 when the toolbar is visible 25559 25560 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/focus-toolbar', focusToolbar, { 25561 bindGlobal: true, 25562 eventName: 'keydown' 25563 }); 25564 Object(external_wp_element_["useEffect"])(() => { 25565 if (initialFocusOnMount) { 25566 focusToolbar(); 25567 } 25568 }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]); 25569 Object(external_wp_element_["useEffect"])(() => { 25570 // If initialIndex is passed, we focus on that toolbar item when the 25571 // toolbar gets mounted and initial focus is not forced. 25572 // We have to wait for the next browser paint because block controls aren't 25573 // rendered right away when the toolbar gets mounted. 25574 let raf = 0; 25575 25576 if (initialIndex && !initialFocusOnMount) { 25577 raf = window.requestAnimationFrame(() => { 25578 const items = getAllToolbarItemsIn(ref.current); 25579 const index = initialIndex || 0; 25580 25581 if (items[index] && hasFocusWithin(ref.current)) { 25582 items[index].focus(); 25583 } 25584 }); 25585 } 25586 25587 return () => { 25588 window.cancelAnimationFrame(raf); 25589 if (!onIndexChange) return; // When the toolbar element is unmounted and onIndexChange is passed, we 25590 // pass the focused toolbar item index so it can be hydrated later. 25591 25592 const items = getAllToolbarItemsIn(ref.current); 25593 const index = items.findIndex(item => item.tabIndex === 0); 25594 onIndexChange(index); 25595 }; 25596 }, [initialIndex, initialFocusOnMount]); 25597 } 25598 25599 function NavigableToolbar({ 25600 children, 25601 focusOnMount, 25602 __experimentalInitialIndex: initialIndex, 25603 __experimentalOnIndexChange: onIndexChange, 25604 ...props 25605 }) { 25606 const ref = Object(external_wp_element_["useRef"])(); 25607 const isAccessibleToolbar = useIsAccessibleToolbar(ref); 25608 useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, initialIndex, onIndexChange); 25609 25610 if (isAccessibleToolbar) { 25611 return Object(external_wp_element_["createElement"])(external_wp_components_["Toolbar"], Object(esm_extends["a" /* default */])({ 25612 label: props['aria-label'], 25613 ref: ref 25614 }, props), children); 25615 } 25616 25617 return Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], Object(esm_extends["a" /* default */])({ 25618 orientation: "horizontal", 25619 role: "toolbar", 25620 ref: ref 25621 }, props), children); 25622 } 25623 25624 /* harmony default export */ var navigable_toolbar = (NavigableToolbar); 25625 25626 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/index.js 25627 25628 25629 25630 /** 25631 * External dependencies 25632 */ 25633 25634 25635 /** 25636 * WordPress dependencies 25637 */ 25638 25639 25640 25641 25642 25643 25644 25645 /** 25646 * Internal dependencies 25647 */ 25648 25649 25650 25651 25652 25653 function BlockMover({ 25654 isFirst, 25655 isLast, 25656 clientIds, 25657 isLocked, 25658 isHidden, 25659 rootClientId, 25660 orientation, 25661 hideDragHandle 25662 }) { 25663 const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false); 25664 25665 const onFocus = () => setIsFocused(true); 25666 25667 const onBlur = () => setIsFocused(false); 25668 25669 if (isLocked || isFirst && isLast && !rootClientId) { 25670 return null; 25671 } 25672 25673 const dragHandleLabel = Object(external_wp_i18n_["__"])('Drag'); // We emulate a disabled state because forcefully applying the `disabled` 25674 // attribute on the buttons while it has focus causes the screen to change 25675 // to an unfocused state (body as active element) without firing blur on, 25676 // the rendering parent, leaving it unable to react to focus out. 25677 25678 25679 return Object(external_wp_element_["createElement"])("div", { 25680 className: classnames_default()('block-editor-block-mover', { 25681 'is-visible': isFocused || !isHidden, 25682 'is-horizontal': orientation === 'horizontal' 25683 }) 25684 }, !hideDragHandle && Object(external_wp_element_["createElement"])(block_draggable, { 25685 clientIds: clientIds, 25686 cloneClassname: "block-editor-block-mover__drag-clone" 25687 }, draggableProps => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ 25688 icon: drag_handle, 25689 className: "block-editor-block-mover__drag-handle", 25690 "aria-hidden": "true", 25691 label: dragHandleLabel // Should not be able to tab to drag handle as this 25692 // button can only be used with a pointer device. 25693 , 25694 tabIndex: "-1" 25695 }, draggableProps))), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { 25696 className: "block-editor-block-mover__move-button-container" 25697 }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], { 25698 onFocus: onFocus, 25699 onBlur: onBlur 25700 }, itemProps => Object(external_wp_element_["createElement"])(BlockMoverUpButton, Object(esm_extends["a" /* default */])({ 25701 clientIds: clientIds 25702 }, itemProps))), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], { 25703 onFocus: onFocus, 25704 onBlur: onBlur 25705 }, itemProps => Object(external_wp_element_["createElement"])(BlockMoverDownButton, Object(esm_extends["a" /* default */])({ 25706 clientIds: clientIds 25707 }, itemProps))))); 25708 } 25709 25710 /* harmony default export */ var block_mover = (Object(external_wp_data_["withSelect"])((select, { 25711 clientIds 25712 }) => { 25713 var _getBlockListSettings; 25714 25715 const { 25716 getBlock, 25717 getBlockIndex, 25718 getBlockListSettings, 25719 getTemplateLock, 25720 getBlockOrder, 25721 getBlockRootClientId 25722 } = select(store); 25723 const normalizedClientIds = Object(external_lodash_["castArray"])(clientIds); 25724 const firstClientId = Object(external_lodash_["first"])(normalizedClientIds); 25725 const block = getBlock(firstClientId); 25726 const rootClientId = getBlockRootClientId(Object(external_lodash_["first"])(normalizedClientIds)); 25727 const firstIndex = getBlockIndex(firstClientId, rootClientId); 25728 const lastIndex = getBlockIndex(Object(external_lodash_["last"])(normalizedClientIds), rootClientId); 25729 const blockOrder = getBlockOrder(rootClientId); 25730 const isFirst = firstIndex === 0; 25731 const isLast = lastIndex === blockOrder.length - 1; 25732 return { 25733 blockType: block ? Object(external_wp_blocks_["getBlockType"])(block.name) : null, 25734 isLocked: getTemplateLock(rootClientId) === 'all', 25735 rootClientId, 25736 firstIndex, 25737 isFirst, 25738 isLast, 25739 orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation 25740 }; 25741 })(BlockMover)); 25742 25743 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js 25744 /** 25745 * External dependencies 25746 */ 25747 25748 /** 25749 * WordPress dependencies 25750 */ 25751 25752 25753 const { 25754 clearTimeout: utils_clearTimeout, 25755 setTimeout: utils_setTimeout 25756 } = window; 25757 const DEBOUNCE_TIMEOUT = 200; 25758 /** 25759 * Hook that creates a showMover state, as well as debounced show/hide callbacks. 25760 * 25761 * @param {Object} props Component props. 25762 * @param {Object} props.ref Element reference. 25763 * @param {boolean} props.isFocused Whether the component has current focus. 25764 * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. 25765 * @param {Function} [props.onChange=noop] Callback function. 25766 */ 25767 25768 function useDebouncedShowMovers({ 25769 ref, 25770 isFocused, 25771 debounceTimeout = DEBOUNCE_TIMEOUT, 25772 onChange = external_lodash_["noop"] 25773 }) { 25774 const [showMovers, setShowMovers] = Object(external_wp_element_["useState"])(false); 25775 const timeoutRef = Object(external_wp_element_["useRef"])(); 25776 25777 const handleOnChange = nextIsFocused => { 25778 if (ref !== null && ref !== void 0 && ref.current) { 25779 setShowMovers(nextIsFocused); 25780 } 25781 25782 onChange(nextIsFocused); 25783 }; 25784 25785 const getIsHovered = () => { 25786 return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.matches(':hover'); 25787 }; 25788 25789 const shouldHideMovers = () => { 25790 const isHovered = getIsHovered(); 25791 return !isFocused && !isHovered; 25792 }; 25793 25794 const clearTimeoutRef = () => { 25795 const timeout = timeoutRef.current; 25796 25797 if (timeout && utils_clearTimeout) { 25798 utils_clearTimeout(timeout); 25799 } 25800 }; 25801 25802 const debouncedShowMovers = event => { 25803 if (event) { 25804 event.stopPropagation(); 25805 } 25806 25807 clearTimeoutRef(); 25808 25809 if (!showMovers) { 25810 handleOnChange(true); 25811 } 25812 }; 25813 25814 const debouncedHideMovers = event => { 25815 if (event) { 25816 event.stopPropagation(); 25817 } 25818 25819 clearTimeoutRef(); 25820 timeoutRef.current = utils_setTimeout(() => { 25821 if (shouldHideMovers()) { 25822 handleOnChange(false); 25823 } 25824 }, debounceTimeout); 25825 }; 25826 25827 Object(external_wp_element_["useEffect"])(() => () => clearTimeoutRef(), []); 25828 return { 25829 showMovers, 25830 debouncedShowMovers, 25831 debouncedHideMovers 25832 }; 25833 } 25834 /** 25835 * Hook that provides a showMovers state and gesture events for DOM elements 25836 * that interact with the showMovers state. 25837 * 25838 * @param {Object} props Component props. 25839 * @param {Object} props.ref Element reference. 25840 * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds. 25841 * @param {Function} [props.onChange=noop] Callback function. 25842 */ 25843 25844 function useShowMoversGestures({ 25845 ref, 25846 debounceTimeout = DEBOUNCE_TIMEOUT, 25847 onChange = external_lodash_["noop"] 25848 }) { 25849 const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false); 25850 const { 25851 showMovers, 25852 debouncedShowMovers, 25853 debouncedHideMovers 25854 } = useDebouncedShowMovers({ 25855 ref, 25856 debounceTimeout, 25857 isFocused, 25858 onChange 25859 }); 25860 const registerRef = Object(external_wp_element_["useRef"])(false); 25861 25862 const isFocusedWithin = () => { 25863 return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(ref.current.ownerDocument.activeElement); 25864 }; 25865 25866 Object(external_wp_element_["useEffect"])(() => { 25867 const node = ref.current; 25868 25869 const handleOnFocus = () => { 25870 if (isFocusedWithin()) { 25871 setIsFocused(true); 25872 debouncedShowMovers(); 25873 } 25874 }; 25875 25876 const handleOnBlur = () => { 25877 if (!isFocusedWithin()) { 25878 setIsFocused(false); 25879 debouncedHideMovers(); 25880 } 25881 }; 25882 /** 25883 * Events are added via DOM events (vs. React synthetic events), 25884 * as the child React components swallow mouse events. 25885 */ 25886 25887 25888 if (node && !registerRef.current) { 25889 node.addEventListener('focus', handleOnFocus, true); 25890 node.addEventListener('blur', handleOnBlur, true); 25891 registerRef.current = true; 25892 } 25893 25894 return () => { 25895 if (node) { 25896 node.removeEventListener('focus', handleOnFocus); 25897 node.removeEventListener('blur', handleOnBlur); 25898 } 25899 }; 25900 }, [ref, registerRef, setIsFocused, debouncedShowMovers, debouncedHideMovers]); 25901 return { 25902 showMovers, 25903 gestures: { 25904 onMouseMove: debouncedShowMovers, 25905 onMouseLeave: debouncedHideMovers 25906 } 25907 }; 25908 } 25909 25910 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-parent-selector/index.js 25911 25912 25913 25914 /** 25915 * WordPress dependencies 25916 */ 25917 25918 25919 25920 25921 25922 /** 25923 * Internal dependencies 25924 */ 25925 25926 25927 25928 25929 25930 /** 25931 * Block parent selector component, displaying the hierarchy of the 25932 * current block selection as a single icon to "go up" a level. 25933 * 25934 * @return {WPComponent} Parent block selector. 25935 */ 25936 25937 function BlockParentSelector() { 25938 const { 25939 selectBlock, 25940 toggleBlockHighlight 25941 } = Object(external_wp_data_["useDispatch"])(store); 25942 const { 25943 firstParentClientId, 25944 shouldHide, 25945 hasReducedUI 25946 } = Object(external_wp_data_["useSelect"])(select => { 25947 const { 25948 getBlockName, 25949 getBlockParents, 25950 getSelectedBlockClientId, 25951 getSettings 25952 } = select(store); 25953 const { 25954 hasBlockSupport 25955 } = select(external_wp_blocks_["store"]); 25956 const selectedBlockClientId = getSelectedBlockClientId(); 25957 const parents = getBlockParents(selectedBlockClientId); 25958 const _firstParentClientId = parents[parents.length - 1]; 25959 const parentBlockName = getBlockName(_firstParentClientId); 25960 25961 const _parentBlockType = Object(external_wp_blocks_["getBlockType"])(parentBlockName); 25962 25963 const settings = getSettings(); 25964 return { 25965 firstParentClientId: _firstParentClientId, 25966 shouldHide: !hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true), 25967 hasReducedUI: settings.hasReducedUI 25968 }; 25969 }, []); 25970 const blockInformation = useBlockDisplayInformation(firstParentClientId); // Allows highlighting the parent block outline when focusing or hovering 25971 // the parent block selector within the child. 25972 25973 const nodeRef = Object(external_wp_element_["useRef"])(); 25974 const { 25975 gestures: showMoversGestures 25976 } = useShowMoversGestures({ 25977 ref: nodeRef, 25978 25979 onChange(isFocused) { 25980 if (isFocused && hasReducedUI) { 25981 return; 25982 } 25983 25984 toggleBlockHighlight(firstParentClientId, isFocused); 25985 } 25986 25987 }); 25988 25989 if (shouldHide || firstParentClientId === undefined) { 25990 return null; 25991 } 25992 25993 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 25994 className: "block-editor-block-parent-selector", 25995 key: firstParentClientId, 25996 ref: nodeRef 25997 }, showMoversGestures), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 25998 className: "block-editor-block-parent-selector__button", 25999 onClick: () => selectBlock(firstParentClientId), 26000 label: Object(external_wp_i18n_["sprintf"])( 26001 /* translators: %s: Name of the block's parent. */ 26002 Object(external_wp_i18n_["__"])('Select %s'), blockInformation.title), 26003 showTooltip: true, 26004 icon: Object(external_wp_element_["createElement"])(BlockIcon, { 26005 icon: blockInformation.icon 26006 }) 26007 })); 26008 } 26009 26010 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js 26011 26012 26013 /** 26014 * WordPress dependencies 26015 */ 26016 26017 const stack_stack = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 26018 xmlns: "http://www.w3.org/2000/svg", 26019 viewBox: "0 0 24 24" 26020 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 26021 d: "M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z" 26022 })); 26023 /* harmony default export */ var library_stack = (stack_stack); 26024 26025 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js 26026 26027 26028 /** 26029 * WordPress dependencies 26030 */ 26031 26032 26033 /** 26034 * Internal dependencies 26035 */ 26036 26037 26038 function PreviewBlockPopover({ 26039 blocks 26040 }) { 26041 return Object(external_wp_element_["createElement"])("div", { 26042 className: "block-editor-block-switcher__popover__preview__parent" 26043 }, Object(external_wp_element_["createElement"])("div", { 26044 className: "block-editor-block-switcher__popover__preview__container" 26045 }, Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 26046 className: "block-editor-block-switcher__preview__popover", 26047 position: "bottom right", 26048 focusOnMount: false 26049 }, Object(external_wp_element_["createElement"])("div", { 26050 className: "block-editor-block-switcher__preview" 26051 }, Object(external_wp_element_["createElement"])("div", { 26052 className: "block-editor-block-switcher__preview-title" 26053 }, Object(external_wp_i18n_["__"])('Preview')), Object(external_wp_element_["createElement"])(block_preview, { 26054 viewportWidth: 500, 26055 blocks: blocks 26056 }))))); 26057 } 26058 26059 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js 26060 26061 26062 /** 26063 * WordPress dependencies 26064 */ 26065 26066 26067 26068 26069 /** 26070 * Internal dependencies 26071 */ 26072 26073 26074 26075 26076 const BlockTransformationsMenu = ({ 26077 className, 26078 possibleBlockTransformations, 26079 onSelect, 26080 blocks 26081 }) => { 26082 const [hoveredTransformItemName, setHoveredTransformItemName] = Object(external_wp_element_["useState"])(); 26083 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { 26084 label: Object(external_wp_i18n_["__"])('Transform to'), 26085 className: className 26086 }, hoveredTransformItemName && Object(external_wp_element_["createElement"])(PreviewBlockPopover, { 26087 blocks: Object(external_wp_blocks_["switchToBlockType"])(blocks, hoveredTransformItemName) 26088 }), possibleBlockTransformations.map(item => { 26089 const { 26090 name, 26091 icon, 26092 title, 26093 isDisabled 26094 } = item; 26095 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 26096 key: name, 26097 className: Object(external_wp_blocks_["getBlockMenuDefaultClassName"])(name), 26098 onClick: event => { 26099 event.preventDefault(); 26100 onSelect(name); 26101 }, 26102 disabled: isDisabled, 26103 onMouseLeave: () => setHoveredTransformItemName(null), 26104 onMouseEnter: () => setHoveredTransformItemName(name) 26105 }, Object(external_wp_element_["createElement"])(BlockIcon, { 26106 icon: icon, 26107 showColors: true 26108 }), title); 26109 })); 26110 }; 26111 26112 /* harmony default export */ var block_transformations_menu = (BlockTransformationsMenu); 26113 26114 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js 26115 /** 26116 * External dependencies 26117 */ 26118 26119 /** 26120 * WordPress dependencies 26121 */ 26122 26123 26124 /** 26125 * Returns the active style from the given className. 26126 * 26127 * @param {Array} styles Block style variations. 26128 * @param {string} className Class name 26129 * 26130 * @return {Object?} The active style. 26131 */ 26132 26133 function getActiveStyle(styles, className) { 26134 for (const style of new external_wp_tokenList_default.a(className).values()) { 26135 if (style.indexOf('is-style-') === -1) { 26136 continue; 26137 } 26138 26139 const potentialStyleName = style.substring(9); 26140 const activeStyle = Object(external_lodash_["find"])(styles, { 26141 name: potentialStyleName 26142 }); 26143 26144 if (activeStyle) { 26145 return activeStyle; 26146 } 26147 } 26148 26149 return Object(external_lodash_["find"])(styles, 'isDefault'); 26150 } 26151 /** 26152 * Replaces the active style in the block's className. 26153 * 26154 * @param {string} className Class name. 26155 * @param {Object?} activeStyle The replaced style. 26156 * @param {Object} newStyle The replacing style. 26157 * 26158 * @return {string} The updated className. 26159 */ 26160 26161 function replaceActiveStyle(className, activeStyle, newStyle) { 26162 const list = new external_wp_tokenList_default.a(className); 26163 26164 if (activeStyle) { 26165 list.remove('is-style-' + activeStyle.name); 26166 } 26167 26168 list.add('is-style-' + newStyle.name); 26169 return list.value; 26170 } 26171 26172 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js 26173 26174 26175 /** 26176 * External dependencies 26177 */ 26178 26179 26180 /** 26181 * WordPress dependencies 26182 */ 26183 26184 26185 26186 26187 26188 26189 /** 26190 * Internal dependencies 26191 */ 26192 26193 26194 26195 26196 const EMPTY_OBJECT = {}; 26197 26198 function useGenericPreviewBlock(block, type) { 26199 return Object(external_wp_element_["useMemo"])(() => { 26200 const example = type === null || type === void 0 ? void 0 : type.example; 26201 const blockName = type === null || type === void 0 ? void 0 : type.name; 26202 26203 if (example && blockName) { 26204 return Object(external_wp_blocks_["getBlockFromExample"])(blockName, { 26205 attributes: example.attributes, 26206 innerBlocks: example.innerBlocks 26207 }); 26208 } 26209 26210 if (block) { 26211 return Object(external_wp_blocks_["cloneBlock"])(block); 26212 } 26213 }, [type !== null && type !== void 0 && type.example ? block === null || block === void 0 ? void 0 : block.name : block, type]); 26214 } 26215 26216 function BlockStyles({ 26217 clientId, 26218 onSwitch = external_lodash_["noop"], 26219 onHoverClassName = external_lodash_["noop"], 26220 itemRole 26221 }) { 26222 const selector = select => { 26223 const { 26224 getBlock 26225 } = select(store); 26226 const block = getBlock(clientId); 26227 26228 if (!block) { 26229 return EMPTY_OBJECT; 26230 } 26231 26232 const blockType = Object(external_wp_blocks_["getBlockType"])(block.name); 26233 const { 26234 getBlockStyles 26235 } = select(external_wp_blocks_["store"]); 26236 return { 26237 block, 26238 type: blockType, 26239 styles: getBlockStyles(block.name), 26240 className: block.attributes.className || '' 26241 }; 26242 }; 26243 26244 const { 26245 styles, 26246 block, 26247 type, 26248 className 26249 } = Object(external_wp_data_["useSelect"])(selector, [clientId]); 26250 const { 26251 updateBlockAttributes 26252 } = Object(external_wp_data_["useDispatch"])(store); 26253 const genericPreviewBlock = useGenericPreviewBlock(block, type); 26254 26255 if (!styles || styles.length === 0) { 26256 return null; 26257 } 26258 26259 const renderedStyles = Object(external_lodash_["find"])(styles, 'isDefault') ? styles : [{ 26260 name: 'default', 26261 label: Object(external_wp_i18n_["_x"])('Default', 'block style'), 26262 isDefault: true 26263 }, ...styles]; 26264 const activeStyle = getActiveStyle(renderedStyles, className); 26265 return Object(external_wp_element_["createElement"])("div", { 26266 className: "block-editor-block-styles" 26267 }, renderedStyles.map(style => { 26268 const styleClassName = replaceActiveStyle(className, activeStyle, style); 26269 return Object(external_wp_element_["createElement"])(BlockStyleItem, { 26270 genericPreviewBlock: genericPreviewBlock, 26271 className: className, 26272 isActive: activeStyle === style, 26273 key: style.name, 26274 onSelect: () => { 26275 updateBlockAttributes(clientId, { 26276 className: styleClassName 26277 }); 26278 onHoverClassName(null); 26279 onSwitch(); 26280 }, 26281 onBlur: () => onHoverClassName(null), 26282 onHover: () => onHoverClassName(styleClassName), 26283 style: style, 26284 styleClassName: styleClassName, 26285 itemRole: itemRole 26286 }); 26287 })); 26288 } 26289 26290 function BlockStyleItem({ 26291 genericPreviewBlock, 26292 style, 26293 isActive, 26294 onBlur, 26295 onHover, 26296 onSelect, 26297 styleClassName, 26298 itemRole 26299 }) { 26300 const previewBlocks = Object(external_wp_element_["useMemo"])(() => { 26301 return { ...genericPreviewBlock, 26302 attributes: { ...genericPreviewBlock.attributes, 26303 className: styleClassName 26304 } 26305 }; 26306 }, [genericPreviewBlock, styleClassName]); 26307 return Object(external_wp_element_["createElement"])("div", { 26308 key: style.name, 26309 className: classnames_default()('block-editor-block-styles__item', { 26310 'is-active': isActive 26311 }), 26312 onClick: () => onSelect(), 26313 onKeyDown: event => { 26314 if (external_wp_keycodes_["ENTER"] === event.keyCode || external_wp_keycodes_["SPACE"] === event.keyCode) { 26315 event.preventDefault(); 26316 onSelect(); 26317 } 26318 }, 26319 onMouseEnter: onHover, 26320 onMouseLeave: onBlur, 26321 role: itemRole || 'button', 26322 tabIndex: "0", 26323 "aria-label": style.label || style.name 26324 }, Object(external_wp_element_["createElement"])("div", { 26325 className: "block-editor-block-styles__item-preview" 26326 }, Object(external_wp_element_["createElement"])(block_preview, { 26327 viewportWidth: 500, 26328 blocks: previewBlocks 26329 })), Object(external_wp_element_["createElement"])("div", { 26330 className: "block-editor-block-styles__item-label" 26331 }, style.label || style.name)); 26332 } 26333 26334 /* harmony default export */ var block_styles = (BlockStyles); 26335 26336 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-styles-menu.js 26337 26338 26339 /** 26340 * WordPress dependencies 26341 */ 26342 26343 26344 26345 26346 26347 /** 26348 * Internal dependencies 26349 */ 26350 26351 26352 26353 function BlockStylesMenu({ 26354 hoveredBlock, 26355 onSwitch 26356 }) { 26357 const { 26358 name, 26359 clientId 26360 } = hoveredBlock; 26361 const [hoveredClassName, setHoveredClassName] = Object(external_wp_element_["useState"])(); 26362 const blockType = Object(external_wp_data_["useSelect"])(select => select(external_wp_blocks_["store"]).getBlockType(name), [name]); 26363 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { 26364 label: Object(external_wp_i18n_["__"])('Styles'), 26365 className: "block-editor-block-switcher__styles__menugroup" 26366 }, hoveredClassName && Object(external_wp_element_["createElement"])(PreviewBlockPopover, { 26367 blocks: blockType.example ? Object(external_wp_blocks_["getBlockFromExample"])(blockType.name, { 26368 attributes: { ...blockType.example.attributes, 26369 className: hoveredClassName 26370 }, 26371 innerBlocks: blockType.example.innerBlocks 26372 }) : Object(external_wp_blocks_["cloneBlock"])(hoveredBlock, { 26373 className: hoveredClassName 26374 }) 26375 }), Object(external_wp_element_["createElement"])(block_styles, { 26376 clientId: clientId, 26377 onSwitch: onSwitch, 26378 onHoverClassName: setHoveredClassName, 26379 itemRole: "menuitem" 26380 })); 26381 } 26382 26383 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/utils.js 26384 /** 26385 * WordPress dependencies 26386 */ 26387 26388 /** 26389 * Try to find a matching block by a block's name in a provided 26390 * block. We recurse through InnerBlocks and return the reference 26391 * of the matched block (it could be an InnerBlock). 26392 * If no match is found return nothing. 26393 * 26394 * @param {WPBlock} block The block to try to find a match. 26395 * @param {string} selectedBlockName The block's name to use for matching condition. 26396 * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks. 26397 * 26398 * @return {WPBlock?} The matched block if found or nothing(`undefined`). 26399 */ 26400 26401 const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new Set()) => { 26402 const { 26403 clientId, 26404 name, 26405 innerBlocks = [] 26406 } = block; // Check if block has been consumed already. 26407 26408 if (consumedBlocks.has(clientId)) return; 26409 if (name === selectedBlockName) return block; // Try to find a matching block from InnerBlocks recursively. 26410 26411 for (const innerBlock of innerBlocks) { 26412 const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks); 26413 if (match) return match; 26414 } 26415 }; 26416 /** 26417 * Find and return the block attributes to retain through 26418 * the transformation, based on Block Type's `role:content` 26419 * attributes. If no `role:content` attributes exist, 26420 * return selected block's attributes. 26421 * 26422 * @param {string} name Block type's namespaced name. 26423 * @param {Object} attributes Selected block's attributes. 26424 * @return {Object} The block's attributes to retain. 26425 */ 26426 26427 const getRetainedBlockAttributes = (name, attributes) => { 26428 const contentAttributes = Object(external_wp_blocks_["__experimentalGetBlockAttributesNamesByRole"])(name, 'content'); 26429 if (!(contentAttributes !== null && contentAttributes !== void 0 && contentAttributes.length)) return attributes; 26430 return contentAttributes.reduce((_accumulator, attribute) => { 26431 if (attributes[attribute]) _accumulator[attribute] = attributes[attribute]; 26432 return _accumulator; 26433 }, {}); 26434 }; 26435 26436 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/use-transformed-patterns.js 26437 /** 26438 * WordPress dependencies 26439 */ 26440 26441 26442 /** 26443 * Internal dependencies 26444 */ 26445 26446 26447 /** 26448 * Mutate the matched block's attributes by getting 26449 * which block type's attributes to retain and prioritize 26450 * them in the merging of the attributes. 26451 * 26452 * @param {WPBlock} match The matched block. 26453 * @param {WPBlock} selectedBlock The selected block. 26454 * @return {void} 26455 */ 26456 26457 const transformMatchingBlock = (match, selectedBlock) => { 26458 // Get the block attributes to retain through the transformation. 26459 const retainedBlockAttributes = getRetainedBlockAttributes(selectedBlock.name, selectedBlock.attributes); 26460 match.attributes = { ...match.attributes, 26461 ...retainedBlockAttributes 26462 }; 26463 }; 26464 /** 26465 * By providing the selected blocks and pattern's blocks 26466 * find the matching blocks, transform them and return them. 26467 * If not all selected blocks are matched, return nothing. 26468 * 26469 * @param {WPBlock[]} selectedBlocks The selected blocks. 26470 * @param {WPBlock[]} patternBlocks The pattern's blocks. 26471 * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched. 26472 */ 26473 26474 const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => { 26475 // Clone Pattern's blocks to produce new clientIds and be able to mutate the matches. 26476 const _patternBlocks = patternBlocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); 26477 /** 26478 * Keep track of the consumed pattern blocks. 26479 * This is needed because we loop the selected blocks 26480 * and for example we may have selected two paragraphs and 26481 * the pattern's blocks could have more `paragraphs`. 26482 */ 26483 26484 26485 const consumedBlocks = new Set(); 26486 26487 for (const selectedBlock of selectedBlocks) { 26488 let isMatch = false; 26489 26490 for (const patternBlock of _patternBlocks) { 26491 const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks); 26492 if (!match) continue; 26493 isMatch = true; 26494 consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block. 26495 26496 transformMatchingBlock(match, selectedBlock); // No need to loop through other pattern's blocks. 26497 26498 break; 26499 } // Bail eary if a selected block has not been matched. 26500 26501 26502 if (!isMatch) return; 26503 } 26504 26505 return _patternBlocks; 26506 }; 26507 /** 26508 * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern 26509 */ 26510 26511 /** 26512 * Custom hook that accepts patterns from state and the selected 26513 * blocks and tries to match these with the pattern's blocks. 26514 * If all selected blocks are matched with a Pattern's block, 26515 * we transform them by retaining block's attributes with `role:content`. 26516 * The transformed pattern's blocks are set to a new pattern 26517 * property `transformedBlocks`. 26518 * 26519 * @param {WPBlockPattern[]} patterns Patterns from state. 26520 * @param {WPBlock[]} selectedBlocks The currently selected blocks. 26521 * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks. 26522 */ 26523 // TODO tests 26524 26525 const useTransformedPatterns = (patterns, selectedBlocks) => { 26526 return Object(external_wp_element_["useMemo"])(() => patterns.reduce((accumulator, _pattern) => { 26527 const transformedBlocks = getPatternTransformedBlocks(selectedBlocks, _pattern.blocks); 26528 26529 if (transformedBlocks) { 26530 accumulator.push({ ..._pattern, 26531 transformedBlocks 26532 }); 26533 } 26534 26535 return accumulator; 26536 }, []), [patterns, selectedBlocks]); 26537 }; 26538 26539 /* harmony default export */ var use_transformed_patterns = (useTransformedPatterns); 26540 26541 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js 26542 26543 26544 26545 /** 26546 * WordPress dependencies 26547 */ 26548 26549 26550 26551 26552 26553 /** 26554 * Internal dependencies 26555 */ 26556 26557 26558 26559 26560 function PatternTransformationsMenu({ 26561 blocks, 26562 patterns: statePatterns, 26563 onSelect 26564 }) { 26565 const [showTransforms, setShowTransforms] = Object(external_wp_element_["useState"])(false); 26566 const patterns = use_transformed_patterns(statePatterns, blocks); 26567 if (!patterns.length) return null; 26568 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { 26569 className: "block-editor-block-switcher__pattern__transforms__menugroup" 26570 }, showTransforms && Object(external_wp_element_["createElement"])(PreviewPatternsPopover, { 26571 patterns: patterns, 26572 onSelect: onSelect 26573 }), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 26574 onClick: event => { 26575 event.preventDefault(); 26576 setShowTransforms(!showTransforms); 26577 }, 26578 icon: chevron_right["a" /* default */] 26579 }, Object(external_wp_i18n_["__"])('Patterns'))); 26580 } 26581 26582 function PreviewPatternsPopover({ 26583 patterns, 26584 onSelect 26585 }) { 26586 return Object(external_wp_element_["createElement"])("div", { 26587 className: "block-editor-block-switcher__popover__preview__parent" 26588 }, Object(external_wp_element_["createElement"])("div", { 26589 className: "block-editor-block-switcher__popover__preview__container" 26590 }, Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 26591 className: "block-editor-block-switcher__preview__popover", 26592 position: "bottom right" 26593 }, Object(external_wp_element_["createElement"])("div", { 26594 className: "block-editor-block-switcher__preview" 26595 }, Object(external_wp_element_["createElement"])("div", { 26596 className: "block-editor-block-switcher__preview-title" 26597 }, Object(external_wp_i18n_["__"])('Preview')), Object(external_wp_element_["createElement"])(BlockPatternsList, { 26598 patterns: patterns, 26599 onSelect: onSelect 26600 }))))); 26601 } 26602 26603 function BlockPatternsList({ 26604 patterns, 26605 onSelect 26606 }) { 26607 const composite = Object(external_wp_components_["__unstableUseCompositeState"])(); 26608 return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { 26609 role: "listbox", 26610 className: "block-editor-block-switcher__preview-patterns-container", 26611 "aria-label": Object(external_wp_i18n_["__"])('Patterns list') 26612 }), patterns.map(pattern => Object(external_wp_element_["createElement"])(pattern_transformations_menu_BlockPattern, { 26613 key: pattern.name, 26614 pattern: pattern, 26615 onSelect: onSelect, 26616 composite: composite 26617 }))); 26618 } 26619 26620 function pattern_transformations_menu_BlockPattern({ 26621 pattern, 26622 onSelect, 26623 composite 26624 }) { 26625 // TODO check pattern/preview width... 26626 const baseClassName = 'block-editor-block-switcher__preview-patterns-container'; 26627 const descriptionId = Object(external_wp_compose_["useInstanceId"])(pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description`); 26628 return Object(external_wp_element_["createElement"])("div", { 26629 className: `${baseClassName}-list__list-item`, 26630 "aria-label": pattern.title, 26631 "aria-describedby": pattern.description ? descriptionId : undefined 26632 }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ 26633 role: "option", 26634 as: "div" 26635 }, composite, { 26636 className: `${baseClassName}-list__item`, 26637 onClick: () => onSelect(pattern.transformedBlocks) 26638 }), Object(external_wp_element_["createElement"])(block_preview, { 26639 blocks: pattern.transformedBlocks, 26640 viewportWidth: pattern.viewportWidth || 500 26641 }), Object(external_wp_element_["createElement"])("div", { 26642 className: `${baseClassName}-list__item-title` 26643 }, pattern.title)), !!pattern.description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 26644 id: descriptionId 26645 }, pattern.description)); 26646 } 26647 26648 /* harmony default export */ var pattern_transformations_menu = (PatternTransformationsMenu); 26649 26650 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js 26651 26652 26653 /** 26654 * External dependencies 26655 */ 26656 26657 /** 26658 * WordPress dependencies 26659 */ 26660 26661 26662 26663 26664 26665 26666 /** 26667 * Internal dependencies 26668 */ 26669 26670 26671 26672 26673 26674 26675 26676 26677 const BlockSwitcherDropdownMenu = ({ 26678 clientIds, 26679 blocks 26680 }) => { 26681 const { 26682 replaceBlocks 26683 } = Object(external_wp_data_["useDispatch"])(store); 26684 const blockInformation = useBlockDisplayInformation(blocks[0].clientId); 26685 const { 26686 possibleBlockTransformations, 26687 hasBlockStyles, 26688 icon, 26689 blockTitle, 26690 patterns 26691 } = Object(external_wp_data_["useSelect"])(select => { 26692 const { 26693 getBlockRootClientId, 26694 getBlockTransformItems, 26695 __experimentalGetPatternTransformItems 26696 } = select(store); 26697 const { 26698 getBlockStyles, 26699 getBlockType 26700 } = select(external_wp_blocks_["store"]); 26701 const rootClientId = getBlockRootClientId(Object(external_lodash_["castArray"])(clientIds)[0]); 26702 const [{ 26703 name: firstBlockName 26704 }] = blocks; 26705 26706 const _isSingleBlockSelected = blocks.length === 1; 26707 26708 const styles = _isSingleBlockSelected && getBlockStyles(firstBlockName); 26709 26710 let _icon; 26711 26712 if (_isSingleBlockSelected) { 26713 _icon = blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon; // Take into account active block variations. 26714 } else { 26715 var _getBlockType; 26716 26717 const isSelectionOfSameType = Object(external_lodash_["uniq"])(blocks.map(({ 26718 name 26719 }) => name)).length === 1; // When selection consists of blocks of multiple types, display an 26720 // appropriate icon to communicate the non-uniformity. 26721 26722 _icon = isSelectionOfSameType ? (_getBlockType = getBlockType(firstBlockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon : library_stack; 26723 } 26724 26725 return { 26726 possibleBlockTransformations: getBlockTransformItems(blocks, rootClientId), 26727 hasBlockStyles: !!(styles !== null && styles !== void 0 && styles.length), 26728 icon: _icon, 26729 blockTitle: getBlockType(firstBlockName).title, 26730 patterns: __experimentalGetPatternTransformItems(blocks, rootClientId) 26731 }; 26732 }, [clientIds, blocks, blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon]); 26733 const isReusable = blocks.length === 1 && Object(external_wp_blocks_["isReusableBlock"])(blocks[0]); 26734 const isTemplate = blocks.length === 1 && Object(external_wp_blocks_["isTemplatePart"])(blocks[0]); // Simple block tranformation based on the `Block Transforms` API. 26735 26736 const onBlockTransform = name => replaceBlocks(clientIds, Object(external_wp_blocks_["switchToBlockType"])(blocks, name)); // Pattern transformation through the `Patterns` API. 26737 26738 26739 const onPatternTransform = transformedBlocks => replaceBlocks(clientIds, transformedBlocks); 26740 26741 const hasPossibleBlockTransformations = !!possibleBlockTransformations.length; 26742 const hasPatternTransformation = !!(patterns !== null && patterns !== void 0 && patterns.length); 26743 26744 if (!hasBlockStyles && !hasPossibleBlockTransformations) { 26745 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 26746 disabled: true, 26747 className: "block-editor-block-switcher__no-switcher-icon", 26748 title: blockTitle, 26749 icon: Object(external_wp_element_["createElement"])(BlockIcon, { 26750 icon: icon, 26751 showColors: true 26752 }) 26753 })); 26754 } 26755 26756 const blockSwitcherLabel = blockTitle; 26757 const blockSwitcherDescription = 1 === blocks.length ? Object(external_wp_i18n_["sprintf"])( 26758 /* translators: %s: block title. */ 26759 Object(external_wp_i18n_["__"])('%s: Change block type or style'), blockTitle) : Object(external_wp_i18n_["sprintf"])( 26760 /* translators: %d: number of blocks. */ 26761 Object(external_wp_i18n_["_n"])('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length); 26762 const showDropDown = hasBlockStyles || hasPossibleBlockTransformations || hasPatternTransformation; 26763 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { 26764 className: "block-editor-block-switcher", 26765 label: blockSwitcherLabel, 26766 popoverProps: { 26767 position: 'bottom right', 26768 isAlternate: true, 26769 className: 'block-editor-block-switcher__popover' 26770 }, 26771 icon: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockIcon, { 26772 icon: icon, 26773 className: "block-editor-block-switcher__toggle", 26774 showColors: true 26775 }), (isReusable || isTemplate) && Object(external_wp_element_["createElement"])("span", { 26776 className: "block-editor-block-switcher__toggle-text" 26777 }, Object(external_wp_element_["createElement"])(BlockTitle, { 26778 clientId: clientIds 26779 }))), 26780 toggleProps: { 26781 describedBy: blockSwitcherDescription, 26782 ...toggleProps 26783 }, 26784 menuProps: { 26785 orientation: 'both' 26786 } 26787 }, ({ 26788 onClose 26789 }) => showDropDown && Object(external_wp_element_["createElement"])("div", { 26790 className: "block-editor-block-switcher__container" 26791 }, hasPatternTransformation && Object(external_wp_element_["createElement"])(pattern_transformations_menu, { 26792 blocks: blocks, 26793 patterns: patterns, 26794 onSelect: transformedBlocks => { 26795 onPatternTransform(transformedBlocks); 26796 onClose(); 26797 } 26798 }), hasPossibleBlockTransformations && Object(external_wp_element_["createElement"])(block_transformations_menu, { 26799 className: "block-editor-block-switcher__transforms__menugroup", 26800 possibleBlockTransformations: possibleBlockTransformations, 26801 blocks: blocks, 26802 onSelect: name => { 26803 onBlockTransform(name); 26804 onClose(); 26805 } 26806 }), hasBlockStyles && Object(external_wp_element_["createElement"])(BlockStylesMenu, { 26807 hoveredBlock: blocks[0], 26808 onSwitch: onClose 26809 }))))); 26810 }; 26811 const BlockSwitcher = ({ 26812 clientIds 26813 }) => { 26814 const blocks = Object(external_wp_data_["useSelect"])(select => select(store).getBlocksByClientId(clientIds), [clientIds]); 26815 26816 if (!blocks.length || blocks.some(block => !block)) { 26817 return null; 26818 } 26819 26820 return Object(external_wp_element_["createElement"])(BlockSwitcherDropdownMenu, { 26821 clientIds: clientIds, 26822 blocks: blocks 26823 }); 26824 }; 26825 /* harmony default export */ var block_switcher = (BlockSwitcher); 26826 26827 // EXTERNAL MODULE: external ["wp","blob"] 26828 var external_wp_blob_ = __webpack_require__("xTGt"); 26829 26830 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/get-paste-event-data.js 26831 /** 26832 * WordPress dependencies 26833 */ 26834 26835 26836 function getPasteEventData({ 26837 clipboardData 26838 }) { 26839 let plainText = ''; 26840 let html = ''; // IE11 only supports `Text` as an argument for `getData` and will 26841 // otherwise throw an invalid argument error, so we try the standard 26842 // arguments first, then fallback to `Text` if they fail. 26843 26844 try { 26845 plainText = clipboardData.getData('text/plain'); 26846 html = clipboardData.getData('text/html'); 26847 } catch (error1) { 26848 try { 26849 html = clipboardData.getData('Text'); 26850 } catch (error2) { 26851 // Some browsers like UC Browser paste plain text by default and 26852 // don't support clipboardData at all, so allow default 26853 // behaviour. 26854 return; 26855 } 26856 } 26857 26858 const files = Object(external_wp_dom_["getFilesFromDataTransfer"])(clipboardData).filter(({ 26859 type 26860 }) => /^image\/(?:jpe?g|png|gif)$/.test(type)); // Only process files if no HTML is present. 26861 // A pasted file may have the URL as plain text. 26862 26863 if (files.length && !html) { 26864 html = files.map(file => `<img src="${Object(external_wp_blob_["createBlobURL"])(file)}">`).join(''); 26865 plainText = ''; 26866 } 26867 26868 return { 26869 html, 26870 plainText 26871 }; 26872 } 26873 26874 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js 26875 26876 26877 /** 26878 * WordPress dependencies 26879 */ 26880 26881 26882 26883 26884 26885 26886 26887 /** 26888 * Internal dependencies 26889 */ 26890 26891 26892 26893 function useNotifyCopy() { 26894 const { 26895 getBlockName 26896 } = Object(external_wp_data_["useSelect"])(store); 26897 const { 26898 getBlockType 26899 } = Object(external_wp_data_["useSelect"])(external_wp_blocks_["store"]); 26900 const { 26901 createSuccessNotice 26902 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); 26903 return Object(external_wp_element_["useCallback"])((eventType, selectedBlockClientIds) => { 26904 let notice = ''; 26905 26906 if (selectedBlockClientIds.length === 1) { 26907 const clientId = selectedBlockClientIds[0]; 26908 const { 26909 title 26910 } = getBlockType(getBlockName(clientId)); 26911 notice = eventType === 'copy' ? Object(external_wp_i18n_["sprintf"])( // Translators: Name of the block being copied, e.g. "Paragraph". 26912 Object(external_wp_i18n_["__"])('Copied "%s" to clipboard.'), title) : Object(external_wp_i18n_["sprintf"])( // Translators: Name of the block being cut, e.g. "Paragraph". 26913 Object(external_wp_i18n_["__"])('Moved "%s" to clipboard.'), title); 26914 } else { 26915 notice = eventType === 'copy' ? Object(external_wp_i18n_["sprintf"])( // Translators: %d: Number of blocks being copied. 26916 Object(external_wp_i18n_["_n"])('Copied %d block to clipboard.', 'Copied %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length) : Object(external_wp_i18n_["sprintf"])( // Translators: %d: Number of blocks being cut. 26917 Object(external_wp_i18n_["_n"])('Moved %d block to clipboard.', 'Moved %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length); 26918 } 26919 26920 createSuccessNotice(notice, { 26921 type: 'snackbar' 26922 }); 26923 }, []); 26924 } 26925 function useClipboardHandler() { 26926 const { 26927 getBlocksByClientId, 26928 getSelectedBlockClientIds, 26929 hasMultiSelection, 26930 getSettings 26931 } = Object(external_wp_data_["useSelect"])(store); 26932 const { 26933 flashBlock, 26934 removeBlocks, 26935 replaceBlocks 26936 } = Object(external_wp_data_["useDispatch"])(store); 26937 const notifyCopy = useNotifyCopy(); 26938 return Object(external_wp_compose_["useRefEffect"])(node => { 26939 function handler(event) { 26940 const selectedBlockClientIds = getSelectedBlockClientIds(); 26941 26942 if (selectedBlockClientIds.length === 0) { 26943 return; 26944 } // Always handle multiple selected blocks. 26945 26946 26947 if (!hasMultiSelection()) { 26948 const { 26949 target 26950 } = event; 26951 const { 26952 ownerDocument 26953 } = target; // If copying, only consider actual text selection as selection. 26954 // Otherwise, any focus on an input field is considered. 26955 26956 const hasSelection = event.type === 'copy' || event.type === 'cut' ? Object(external_wp_dom_["documentHasUncollapsedSelection"])(ownerDocument) : Object(external_wp_dom_["documentHasSelection"])(ownerDocument); // Let native copy behaviour take over in input fields. 26957 26958 if (hasSelection) { 26959 return; 26960 } 26961 } 26962 26963 if (!node.contains(event.target.ownerDocument.activeElement)) { 26964 return; 26965 } 26966 26967 event.preventDefault(); 26968 26969 if (event.type === 'copy' || event.type === 'cut') { 26970 if (selectedBlockClientIds.length === 1) { 26971 flashBlock(selectedBlockClientIds[0]); 26972 } 26973 26974 notifyCopy(event.type, selectedBlockClientIds); 26975 const blocks = getBlocksByClientId(selectedBlockClientIds); 26976 const serialized = Object(external_wp_blocks_["serialize"])(blocks); 26977 event.clipboardData.setData('text/plain', serialized); 26978 event.clipboardData.setData('text/html', serialized); 26979 } 26980 26981 if (event.type === 'cut') { 26982 removeBlocks(selectedBlockClientIds); 26983 } else if (event.type === 'paste') { 26984 const { 26985 __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML 26986 } = getSettings(); 26987 const { 26988 plainText, 26989 html 26990 } = getPasteEventData(event); 26991 const blocks = Object(external_wp_blocks_["pasteHandler"])({ 26992 HTML: html, 26993 plainText, 26994 mode: 'BLOCKS', 26995 canUserUseUnfilteredHTML 26996 }); 26997 replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1); 26998 } 26999 } 27000 27001 node.ownerDocument.addEventListener('copy', handler); 27002 node.ownerDocument.addEventListener('cut', handler); 27003 node.ownerDocument.addEventListener('paste', handler); 27004 return () => { 27005 node.ownerDocument.removeEventListener('copy', handler); 27006 node.ownerDocument.removeEventListener('cut', handler); 27007 node.ownerDocument.removeEventListener('paste', handler); 27008 }; 27009 }, []); 27010 } 27011 27012 function CopyHandler({ 27013 children 27014 }) { 27015 return Object(external_wp_element_["createElement"])("div", { 27016 ref: useClipboardHandler() 27017 }, children); 27018 } 27019 27020 /* harmony default export */ var copy_handler = (CopyHandler); 27021 27022 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js 27023 /** 27024 * External dependencies 27025 */ 27026 27027 /** 27028 * WordPress dependencies 27029 */ 27030 27031 27032 27033 /** 27034 * Internal dependencies 27035 */ 27036 27037 27038 27039 function BlockActions({ 27040 clientIds, 27041 children, 27042 __experimentalUpdateSelection: updateSelection 27043 }) { 27044 const { 27045 canInsertBlockType, 27046 getBlockRootClientId, 27047 getBlocksByClientId, 27048 getTemplateLock 27049 } = Object(external_wp_data_["useSelect"])(select => select(store), []); 27050 const { 27051 getDefaultBlockName, 27052 getGroupingBlockName 27053 } = Object(external_wp_data_["useSelect"])(select => select(external_wp_blocks_["store"]), []); 27054 const blocks = getBlocksByClientId(clientIds); 27055 const rootClientId = getBlockRootClientId(clientIds[0]); 27056 const canDuplicate = Object(external_lodash_["every"])(blocks, block => { 27057 return !!block && Object(external_wp_blocks_["hasBlockSupport"])(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId); 27058 }); 27059 const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId); 27060 const { 27061 removeBlocks, 27062 replaceBlocks, 27063 duplicateBlocks, 27064 insertAfterBlock, 27065 insertBeforeBlock, 27066 flashBlock, 27067 setBlockMovingClientId, 27068 setNavigationMode, 27069 selectBlock 27070 } = Object(external_wp_data_["useDispatch"])(store); 27071 const notifyCopy = useNotifyCopy(); 27072 return children({ 27073 canDuplicate, 27074 canInsertDefaultBlock, 27075 isLocked: !!getTemplateLock(rootClientId), 27076 rootClientId, 27077 blocks, 27078 27079 onDuplicate() { 27080 return duplicateBlocks(clientIds, updateSelection); 27081 }, 27082 27083 onRemove() { 27084 return removeBlocks(clientIds, updateSelection); 27085 }, 27086 27087 onInsertBefore() { 27088 insertBeforeBlock(Object(external_lodash_["first"])(Object(external_lodash_["castArray"])(clientIds))); 27089 }, 27090 27091 onInsertAfter() { 27092 insertAfterBlock(Object(external_lodash_["last"])(Object(external_lodash_["castArray"])(clientIds))); 27093 }, 27094 27095 onMoveTo() { 27096 setNavigationMode(true); 27097 selectBlock(clientIds[0]); 27098 setBlockMovingClientId(clientIds[0]); 27099 }, 27100 27101 onGroup() { 27102 if (!blocks.length) { 27103 return; 27104 } 27105 27106 const groupingBlockName = getGroupingBlockName(); // Activate the `transform` on `core/group` which does the conversion 27107 27108 const newBlocks = Object(external_wp_blocks_["switchToBlockType"])(blocks, groupingBlockName); 27109 27110 if (!newBlocks) { 27111 return; 27112 } 27113 27114 replaceBlocks(clientIds, newBlocks); 27115 }, 27116 27117 onUngroup() { 27118 if (!blocks.length) { 27119 return; 27120 } 27121 27122 const innerBlocks = blocks[0].innerBlocks; 27123 27124 if (!innerBlocks.length) { 27125 return; 27126 } 27127 27128 replaceBlocks(clientIds, innerBlocks); 27129 }, 27130 27131 onCopy() { 27132 const selectedBlockClientIds = blocks.map(({ 27133 clientId 27134 }) => clientId); 27135 27136 if (blocks.length === 1) { 27137 flashBlock(selectedBlockClientIds[0]); 27138 } 27139 27140 notifyCopy('copy', selectedBlockClientIds); 27141 } 27142 27143 }); 27144 } 27145 27146 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js 27147 27148 27149 /** 27150 * External dependencies 27151 */ 27152 27153 /** 27154 * WordPress dependencies 27155 */ 27156 27157 27158 27159 27160 27161 27162 /** 27163 * Internal dependencies 27164 */ 27165 27166 27167 function BlockModeToggle({ 27168 blockType, 27169 mode, 27170 onToggleMode, 27171 small = false, 27172 isCodeEditingEnabled = true 27173 }) { 27174 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'html', true) || !isCodeEditingEnabled) { 27175 return null; 27176 } 27177 27178 const label = mode === 'visual' ? Object(external_wp_i18n_["__"])('Edit as HTML') : Object(external_wp_i18n_["__"])('Edit visually'); 27179 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27180 onClick: onToggleMode 27181 }, !small && label); 27182 } 27183 /* harmony default export */ var block_mode_toggle = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { 27184 clientId 27185 }) => { 27186 const { 27187 getBlock, 27188 getBlockMode, 27189 getSettings 27190 } = select(store); 27191 const block = getBlock(clientId); 27192 const isCodeEditingEnabled = getSettings().codeEditingEnabled; 27193 return { 27194 mode: getBlockMode(clientId), 27195 blockType: block ? Object(external_wp_blocks_["getBlockType"])(block.name) : null, 27196 isCodeEditingEnabled 27197 }; 27198 }), Object(external_wp_data_["withDispatch"])((dispatch, { 27199 onToggle = external_lodash_["noop"], 27200 clientId 27201 }) => ({ 27202 onToggleMode() { 27203 dispatch(store).toggleBlockMode(clientId); 27204 onToggle(); 27205 } 27206 27207 }))])(BlockModeToggle)); 27208 27209 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-convert-button.js 27210 27211 27212 /** 27213 * WordPress dependencies 27214 */ 27215 27216 27217 function BlockConvertButton({ 27218 shouldRender, 27219 onClick, 27220 small 27221 }) { 27222 if (!shouldRender) { 27223 return null; 27224 } 27225 27226 const label = Object(external_wp_i18n_["__"])('Convert to Blocks'); 27227 27228 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27229 onClick: onClick 27230 }, !small && label); 27231 } 27232 27233 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js 27234 /** 27235 * WordPress dependencies 27236 */ 27237 27238 27239 27240 /** 27241 * Internal dependencies 27242 */ 27243 27244 27245 27246 /* harmony default export */ var block_html_convert_button = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, { 27247 clientId 27248 }) => { 27249 const block = select(store).getBlock(clientId); 27250 return { 27251 block, 27252 shouldRender: block && block.name === 'core/html' 27253 }; 27254 }), Object(external_wp_data_["withDispatch"])((dispatch, { 27255 block 27256 }) => ({ 27257 onClick: () => dispatch(store).replaceBlocks(block.clientId, Object(external_wp_blocks_["rawHandler"])({ 27258 HTML: Object(external_wp_blocks_["getBlockContent"])(block) 27259 })) 27260 })))(BlockConvertButton)); 27261 27262 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js 27263 /** 27264 * WordPress dependencies 27265 */ 27266 27267 const { 27268 Fill: __unstableBlockSettingsMenuFirstItem, 27269 Slot: block_settings_menu_first_item_Slot 27270 } = Object(external_wp_components_["createSlotFill"])('__unstableBlockSettingsMenuFirstItem'); 27271 __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; 27272 /* harmony default export */ var block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem); 27273 27274 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js 27275 /** 27276 * WordPress dependencies 27277 */ 27278 27279 27280 /** 27281 * Internal dependencies 27282 */ 27283 27284 27285 /** 27286 * Contains the properties `ConvertToGroupButton` component needs. 27287 * 27288 * @typedef {Object} ConvertToGroupButtonProps 27289 * @property {string[]} clientIds An array of the selected client ids. 27290 * @property {boolean} isGroupable Indicates if the selected blocks can be grouped. 27291 * @property {boolean} isUngroupable Indicates if the selected blocks can be ungrouped. 27292 * @property {WPBlock[]} blocksSelection An array of the selected blocks. 27293 * @property {string} groupingBlockName The name of block used for handling grouping interactions. 27294 */ 27295 27296 /** 27297 * Returns the properties `ConvertToGroupButton` component needs to work properly. 27298 * It is used in `BlockSettingsMenuControls` to know if `ConvertToGroupButton` 27299 * should be rendered, to avoid ending up with an empty MenuGroup. 27300 * 27301 * @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`. 27302 */ 27303 27304 function useConvertToGroupButtonProps() { 27305 const { 27306 clientIds, 27307 isGroupable, 27308 isUngroupable, 27309 blocksSelection, 27310 groupingBlockName 27311 } = Object(external_wp_data_["useSelect"])(select => { 27312 var _blocksSelection$; 27313 27314 const { 27315 getBlockRootClientId, 27316 getBlocksByClientId, 27317 canInsertBlockType, 27318 getSelectedBlockClientIds 27319 } = select(store); 27320 const { 27321 getGroupingBlockName 27322 } = select(external_wp_blocks_["store"]); 27323 27324 const _clientIds = getSelectedBlockClientIds(); 27325 27326 const _groupingBlockName = getGroupingBlockName(); 27327 27328 const rootClientId = !!(_clientIds !== null && _clientIds !== void 0 && _clientIds.length) ? getBlockRootClientId(_clientIds[0]) : undefined; 27329 const groupingBlockAvailable = canInsertBlockType(_groupingBlockName, rootClientId); 27330 27331 const _blocksSelection = getBlocksByClientId(_clientIds); 27332 27333 const isSingleGroupingBlock = _blocksSelection.length === 1 && ((_blocksSelection$ = _blocksSelection[0]) === null || _blocksSelection$ === void 0 ? void 0 : _blocksSelection$.name) === _groupingBlockName; // Do we have 27334 // 1. Grouping block available to be inserted? 27335 // 2. One or more blocks selected 27336 // (we allow single Blocks to become groups unless 27337 // they are a soltiary group block themselves) 27338 27339 const _isGroupable = groupingBlockAvailable && _blocksSelection.length && !isSingleGroupingBlock; // Do we have a single Group Block selected and does that group have inner blocks? 27340 27341 27342 const _isUngroupable = isSingleGroupingBlock && !!_blocksSelection[0].innerBlocks.length; 27343 27344 return { 27345 clientIds: _clientIds, 27346 isGroupable: _isGroupable, 27347 isUngroupable: _isUngroupable, 27348 blocksSelection: _blocksSelection, 27349 groupingBlockName: _groupingBlockName 27350 }; 27351 }, []); 27352 return { 27353 clientIds, 27354 isGroupable, 27355 isUngroupable, 27356 blocksSelection, 27357 groupingBlockName 27358 }; 27359 } 27360 27361 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/convert-to-group-buttons/index.js 27362 27363 27364 /** 27365 * WordPress dependencies 27366 */ 27367 27368 27369 27370 27371 /** 27372 * Internal dependencies 27373 */ 27374 27375 27376 27377 27378 function ConvertToGroupButton({ 27379 clientIds, 27380 isGroupable, 27381 isUngroupable, 27382 blocksSelection, 27383 groupingBlockName, 27384 onClose = () => {} 27385 }) { 27386 const { 27387 replaceBlocks 27388 } = Object(external_wp_data_["useDispatch"])(store); 27389 27390 const onConvertToGroup = () => { 27391 // Activate the `transform` on the Grouping Block which does the conversion 27392 const newBlocks = Object(external_wp_blocks_["switchToBlockType"])(blocksSelection, groupingBlockName); 27393 27394 if (newBlocks) { 27395 replaceBlocks(clientIds, newBlocks); 27396 } 27397 }; 27398 27399 const onConvertFromGroup = () => { 27400 const innerBlocks = blocksSelection[0].innerBlocks; 27401 27402 if (!innerBlocks.length) { 27403 return; 27404 } 27405 27406 replaceBlocks(clientIds, innerBlocks); 27407 }; 27408 27409 if (!isGroupable && !isUngroupable) { 27410 return null; 27411 } 27412 27413 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isGroupable && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27414 onClick: () => { 27415 onConvertToGroup(); 27416 onClose(); 27417 } 27418 }, Object(external_wp_i18n_["_x"])('Group', 'verb')), isUngroupable && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27419 onClick: () => { 27420 onConvertFromGroup(); 27421 onClose(); 27422 } 27423 }, Object(external_wp_i18n_["_x"])('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor '))); 27424 } 27425 27426 27427 27428 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js 27429 27430 27431 27432 /** 27433 * External dependencies 27434 */ 27435 27436 /** 27437 * WordPress dependencies 27438 */ 27439 27440 27441 27442 /** 27443 * Internal dependencies 27444 */ 27445 27446 27447 27448 const { 27449 Fill: block_settings_menu_controls_Fill, 27450 Slot: block_settings_menu_controls_Slot 27451 } = Object(external_wp_components_["createSlotFill"])('BlockSettingsMenuControls'); 27452 27453 const BlockSettingsMenuControlsSlot = ({ 27454 fillProps, 27455 clientIds = null 27456 }) => { 27457 const selectedBlocks = Object(external_wp_data_["useSelect"])(select => { 27458 const { 27459 getBlocksByClientId, 27460 getSelectedBlockClientIds 27461 } = select(store); 27462 const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); 27463 return Object(external_lodash_["map"])(Object(external_lodash_["compact"])(getBlocksByClientId(ids)), block => block.name); 27464 }, [clientIds]); // Check if current selection of blocks is Groupable or Ungroupable 27465 // and pass this props down to ConvertToGroupButton. 27466 27467 const convertToGroupButtonProps = useConvertToGroupButtonProps(); 27468 const { 27469 isGroupable, 27470 isUngroupable 27471 } = convertToGroupButtonProps; 27472 const showConvertToGroupButton = isGroupable || isUngroupable; 27473 return Object(external_wp_element_["createElement"])(block_settings_menu_controls_Slot, { 27474 fillProps: { ...fillProps, 27475 selectedBlocks 27476 } 27477 }, fills => { 27478 if ((fills === null || fills === void 0 ? void 0 : fills.length) > 0 || showConvertToGroupButton) { 27479 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, fills, Object(external_wp_element_["createElement"])(ConvertToGroupButton, Object(esm_extends["a" /* default */])({}, convertToGroupButtonProps, { 27480 onClose: fillProps === null || fillProps === void 0 ? void 0 : fillProps.onClose 27481 }))); 27482 } 27483 }); 27484 }; 27485 /** 27486 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md 27487 * 27488 * @param {Object} props Fill props. 27489 * @return {WPElement} Element. 27490 */ 27491 27492 27493 function BlockSettingsMenuControls({ ...props 27494 }) { 27495 return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { 27496 document: document 27497 }, Object(external_wp_element_["createElement"])(block_settings_menu_controls_Fill, props)); 27498 } 27499 27500 BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot; 27501 /* harmony default export */ var block_settings_menu_controls = (BlockSettingsMenuControls); 27502 27503 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js 27504 27505 27506 27507 /** 27508 * External dependencies 27509 */ 27510 27511 /** 27512 * WordPress dependencies 27513 */ 27514 27515 27516 27517 27518 27519 27520 27521 27522 27523 /** 27524 * Internal dependencies 27525 */ 27526 27527 27528 27529 27530 27531 27532 const block_settings_dropdown_POPOVER_PROPS = { 27533 className: 'block-editor-block-settings-menu__popover', 27534 position: 'bottom right', 27535 isAlternate: true 27536 }; 27537 27538 function CopyMenuItem({ 27539 blocks, 27540 onCopy 27541 }) { 27542 const ref = Object(external_wp_compose_["useCopyToClipboard"])(() => Object(external_wp_blocks_["serialize"])(blocks), onCopy); 27543 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27544 ref: ref 27545 }, Object(external_wp_i18n_["__"])('Copy')); 27546 } 27547 27548 function BlockSettingsDropdown({ 27549 clientIds, 27550 __experimentalSelectBlock, 27551 children, 27552 ...props 27553 }) { 27554 const blockClientIds = Object(external_lodash_["castArray"])(clientIds); 27555 const count = blockClientIds.length; 27556 const firstBlockClientId = blockClientIds[0]; 27557 const shortcuts = Object(external_wp_data_["useSelect"])(select => { 27558 const { 27559 getShortcutRepresentation 27560 } = select(external_wp_keyboardShortcuts_["store"]); 27561 return { 27562 duplicate: getShortcutRepresentation('core/block-editor/duplicate'), 27563 remove: getShortcutRepresentation('core/block-editor/remove'), 27564 insertAfter: getShortcutRepresentation('core/block-editor/insert-after'), 27565 insertBefore: getShortcutRepresentation('core/block-editor/insert-before') 27566 }; 27567 }, []); 27568 const updateSelection = Object(external_wp_element_["useCallback"])(__experimentalSelectBlock ? async clientIdsPromise => { 27569 const ids = await clientIdsPromise; 27570 27571 if (ids && ids[0]) { 27572 __experimentalSelectBlock(ids[0]); 27573 } 27574 } : external_lodash_["noop"], [__experimentalSelectBlock]); 27575 const removeBlockLabel = count === 1 ? Object(external_wp_i18n_["__"])('Remove block') : Object(external_wp_i18n_["__"])('Remove blocks'); 27576 return Object(external_wp_element_["createElement"])(BlockActions, { 27577 clientIds: clientIds, 27578 __experimentalUpdateSelection: !__experimentalSelectBlock 27579 }, ({ 27580 canDuplicate, 27581 canInsertDefaultBlock, 27582 isLocked, 27583 onDuplicate, 27584 onInsertAfter, 27585 onInsertBefore, 27586 onRemove, 27587 onCopy, 27588 onMoveTo, 27589 blocks 27590 }) => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], Object(esm_extends["a" /* default */])({ 27591 icon: more_vertical["a" /* default */], 27592 label: Object(external_wp_i18n_["__"])('Options'), 27593 className: "block-editor-block-settings-menu", 27594 popoverProps: block_settings_dropdown_POPOVER_PROPS, 27595 noIcons: true 27596 }, props), ({ 27597 onClose 27598 }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(block_settings_menu_first_item.Slot, { 27599 fillProps: { 27600 onClose 27601 } 27602 }), count === 1 && Object(external_wp_element_["createElement"])(block_html_convert_button, { 27603 clientId: firstBlockClientId 27604 }), Object(external_wp_element_["createElement"])(CopyMenuItem, { 27605 blocks: blocks, 27606 onCopy: onCopy 27607 }), canDuplicate && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27608 onClick: Object(external_lodash_["flow"])(onClose, onDuplicate, updateSelection), 27609 shortcut: shortcuts.duplicate 27610 }, Object(external_wp_i18n_["__"])('Duplicate')), canInsertDefaultBlock && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27611 onClick: Object(external_lodash_["flow"])(onClose, onInsertBefore), 27612 shortcut: shortcuts.insertBefore 27613 }, Object(external_wp_i18n_["__"])('Insert before')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27614 onClick: Object(external_lodash_["flow"])(onClose, onInsertAfter), 27615 shortcut: shortcuts.insertAfter 27616 }, Object(external_wp_i18n_["__"])('Insert after'))), !isLocked && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27617 onClick: Object(external_lodash_["flow"])(onClose, onMoveTo) 27618 }, Object(external_wp_i18n_["__"])('Move to')), count === 1 && Object(external_wp_element_["createElement"])(block_mode_toggle, { 27619 clientId: firstBlockClientId, 27620 onToggle: onClose 27621 })), Object(external_wp_element_["createElement"])(block_settings_menu_controls.Slot, { 27622 fillProps: { 27623 onClose 27624 }, 27625 clientIds: clientIds 27626 }), typeof children === 'function' ? children({ 27627 onClose 27628 }) : external_wp_element_["Children"].map(child => Object(external_wp_element_["cloneElement"])(child, { 27629 onClose 27630 })), Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, !isLocked && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 27631 onClick: Object(external_lodash_["flow"])(onClose, onRemove, updateSelection), 27632 shortcut: shortcuts.remove 27633 }, removeBlockLabel))))); 27634 } 27635 /* harmony default export */ var block_settings_dropdown = (BlockSettingsDropdown); 27636 27637 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/index.js 27638 27639 27640 27641 /** 27642 * WordPress dependencies 27643 */ 27644 27645 /** 27646 * Internal dependencies 27647 */ 27648 27649 27650 function BlockSettingsMenu({ 27651 clientIds, 27652 ...props 27653 }) { 27654 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(block_settings_dropdown, Object(esm_extends["a" /* default */])({ 27655 clientIds: clientIds, 27656 toggleProps: toggleProps 27657 }, props)))); 27658 } 27659 /* harmony default export */ var block_settings_menu = (BlockSettingsMenu); 27660 27661 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js 27662 27663 27664 27665 /** 27666 * External dependencies 27667 */ 27668 27669 /** 27670 * WordPress dependencies 27671 */ 27672 27673 27674 27675 27676 27677 27678 /** 27679 * Internal dependencies 27680 */ 27681 27682 27683 27684 27685 27686 27687 27688 27689 function BlockToolbar({ 27690 hideDragHandle 27691 }) { 27692 const { 27693 blockClientIds, 27694 blockClientId, 27695 blockType, 27696 hasFixedToolbar, 27697 hasReducedUI, 27698 isValid, 27699 isVisual 27700 } = Object(external_wp_data_["useSelect"])(select => { 27701 const { 27702 getBlockName, 27703 getBlockMode, 27704 getSelectedBlockClientIds, 27705 isBlockValid, 27706 getBlockRootClientId, 27707 getSettings 27708 } = select(store); 27709 const selectedBlockClientIds = getSelectedBlockClientIds(); 27710 const selectedBlockClientId = selectedBlockClientIds[0]; 27711 const blockRootClientId = getBlockRootClientId(selectedBlockClientId); 27712 const settings = getSettings(); 27713 return { 27714 blockClientIds: selectedBlockClientIds, 27715 blockClientId: selectedBlockClientId, 27716 blockType: selectedBlockClientId && Object(external_wp_blocks_["getBlockType"])(getBlockName(selectedBlockClientId)), 27717 hasFixedToolbar: settings.hasFixedToolbar, 27718 hasReducedUI: settings.hasReducedUI, 27719 rootClientId: blockRootClientId, 27720 isValid: selectedBlockClientIds.every(id => isBlockValid(id)), 27721 isVisual: selectedBlockClientIds.every(id => getBlockMode(id) === 'visual') 27722 }; 27723 }, []); // Handles highlighting the current block outline on hover or focus of the 27724 // block type toolbar area. 27725 27726 const { 27727 toggleBlockHighlight 27728 } = Object(external_wp_data_["useDispatch"])(store); 27729 const nodeRef = Object(external_wp_element_["useRef"])(); 27730 const { 27731 showMovers, 27732 gestures: showMoversGestures 27733 } = useShowMoversGestures({ 27734 ref: nodeRef, 27735 27736 onChange(isFocused) { 27737 if (isFocused && hasReducedUI) { 27738 return; 27739 } 27740 27741 toggleBlockHighlight(blockClientId, isFocused); 27742 } 27743 27744 }); // Account for the cases where the block toolbar is rendered within the 27745 // header area and not contextually to the block. 27746 27747 const displayHeaderToolbar = Object(external_wp_compose_["useViewportMatch"])('medium', '<') || hasFixedToolbar; 27748 27749 if (blockType) { 27750 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, '__experimentalToolbar', true)) { 27751 return null; 27752 } 27753 } 27754 27755 const shouldShowMovers = displayHeaderToolbar || showMovers; 27756 27757 if (blockClientIds.length === 0) { 27758 return null; 27759 } 27760 27761 const shouldShowVisualToolbar = isValid && isVisual; 27762 const isMultiToolbar = blockClientIds.length > 1; 27763 const classes = classnames_default()('block-editor-block-toolbar', shouldShowMovers && 'is-showing-movers'); 27764 return Object(external_wp_element_["createElement"])("div", { 27765 className: classes 27766 }, !isMultiToolbar && !displayHeaderToolbar && Object(external_wp_element_["createElement"])(BlockParentSelector, { 27767 clientIds: blockClientIds 27768 }), Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 27769 ref: nodeRef 27770 }, showMoversGestures), (shouldShowVisualToolbar || isMultiToolbar) && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { 27771 className: "block-editor-block-toolbar__block-controls" 27772 }, Object(external_wp_element_["createElement"])(block_switcher, { 27773 clientIds: blockClientIds 27774 }), Object(external_wp_element_["createElement"])(block_mover, { 27775 clientIds: blockClientIds, 27776 hideDragHandle: hideDragHandle || hasReducedUI 27777 }))), shouldShowVisualToolbar && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(block_controls.Slot, { 27778 group: "block", 27779 className: "block-editor-block-toolbar__slot" 27780 }), Object(external_wp_element_["createElement"])(block_controls.Slot, { 27781 className: "block-editor-block-toolbar__slot" 27782 }), Object(external_wp_element_["createElement"])(block_controls.Slot, { 27783 group: "inline", 27784 className: "block-editor-block-toolbar__slot" 27785 }), Object(external_wp_element_["createElement"])(block_controls.Slot, { 27786 group: "other", 27787 className: "block-editor-block-toolbar__slot" 27788 })), Object(external_wp_element_["createElement"])(block_settings_menu, { 27789 clientIds: blockClientIds 27790 })); 27791 } 27792 27793 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-contextual-toolbar.js 27794 27795 27796 27797 /** 27798 * External dependencies 27799 */ 27800 27801 /** 27802 * WordPress dependencies 27803 */ 27804 27805 27806 27807 27808 /** 27809 * Internal dependencies 27810 */ 27811 27812 27813 27814 27815 27816 function BlockContextualToolbar({ 27817 focusOnMount, 27818 isFixed, 27819 ...props 27820 }) { 27821 const { 27822 blockType, 27823 hasParents, 27824 showParentSelector 27825 } = Object(external_wp_data_["useSelect"])(select => { 27826 const { 27827 getBlockName, 27828 getBlockParents, 27829 getSelectedBlockClientIds 27830 } = select(store); 27831 const { 27832 getBlockType 27833 } = select(external_wp_blocks_["store"]); 27834 const selectedBlockClientIds = getSelectedBlockClientIds(); 27835 const selectedBlockClientId = selectedBlockClientIds[0]; 27836 const parents = getBlockParents(selectedBlockClientId); 27837 const firstParentClientId = parents[parents.length - 1]; 27838 const parentBlockName = getBlockName(firstParentClientId); 27839 const parentBlockType = getBlockType(parentBlockName); 27840 return { 27841 blockType: selectedBlockClientId && getBlockType(getBlockName(selectedBlockClientId)), 27842 hasParents: parents.length, 27843 showParentSelector: Object(external_wp_blocks_["hasBlockSupport"])(parentBlockType, '__experimentalParentSelector', true) 27844 }; 27845 }, []); 27846 27847 if (blockType) { 27848 if (!Object(external_wp_blocks_["hasBlockSupport"])(blockType, '__experimentalToolbar', true)) { 27849 return null; 27850 } 27851 } // Shifts the toolbar to make room for the parent block selector. 27852 27853 27854 const classes = classnames_default()('block-editor-block-contextual-toolbar', { 27855 'has-parent': hasParents && showParentSelector, 27856 'is-fixed': isFixed 27857 }); 27858 return Object(external_wp_element_["createElement"])(navigable_toolbar, Object(esm_extends["a" /* default */])({ 27859 focusOnMount: focusOnMount, 27860 className: classes 27861 /* translators: accessibility text for the block toolbar */ 27862 , 27863 "aria-label": Object(external_wp_i18n_["__"])('Block tools') 27864 }, props), Object(external_wp_element_["createElement"])(BlockToolbar, { 27865 hideDragHandle: isFixed 27866 })); 27867 } 27868 27869 /* harmony default export */ var block_contextual_toolbar = (BlockContextualToolbar); 27870 27871 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-popover.js 27872 27873 27874 /** 27875 * External dependencies 27876 */ 27877 27878 27879 /** 27880 * WordPress dependencies 27881 */ 27882 27883 27884 27885 27886 27887 27888 27889 27890 /** 27891 * Internal dependencies 27892 */ 27893 27894 27895 27896 27897 27898 27899 27900 27901 function block_popover_selector(select) { 27902 const { 27903 isNavigationMode, 27904 isMultiSelecting, 27905 hasMultiSelection, 27906 isTyping, 27907 isCaretWithinFormattedText, 27908 getSettings, 27909 getLastMultiSelectedBlockClientId 27910 } = select(store); 27911 return { 27912 isNavigationMode: isNavigationMode(), 27913 isMultiSelecting: isMultiSelecting(), 27914 isTyping: isTyping(), 27915 isCaretWithinFormattedText: isCaretWithinFormattedText(), 27916 hasMultiSelection: hasMultiSelection(), 27917 hasFixedToolbar: getSettings().hasFixedToolbar, 27918 lastClientId: getLastMultiSelectedBlockClientId() 27919 }; 27920 } 27921 27922 function BlockPopover({ 27923 clientId, 27924 rootClientId, 27925 isValid, 27926 isEmptyDefaultBlock, 27927 capturingClientId, 27928 __unstablePopoverSlot, 27929 __unstableContentRef 27930 }) { 27931 const { 27932 isNavigationMode, 27933 isMultiSelecting, 27934 isTyping, 27935 isCaretWithinFormattedText, 27936 hasMultiSelection, 27937 hasFixedToolbar, 27938 lastClientId 27939 } = Object(external_wp_data_["useSelect"])(block_popover_selector, []); 27940 const isInsertionPointVisible = Object(external_wp_data_["useSelect"])(select => { 27941 const { 27942 isBlockInsertionPointVisible, 27943 getBlockInsertionPoint, 27944 getBlockOrder 27945 } = select(store); 27946 27947 if (!isBlockInsertionPointVisible()) { 27948 return false; 27949 } 27950 27951 const insertionPoint = getBlockInsertionPoint(); 27952 const order = getBlockOrder(insertionPoint.rootClientId); 27953 return order[insertionPoint.index] === clientId; 27954 }, [clientId]); 27955 const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); 27956 const [isToolbarForced, setIsToolbarForced] = Object(external_wp_element_["useState"])(false); 27957 const [isInserterShown, setIsInserterShown] = Object(external_wp_element_["useState"])(false); 27958 const { 27959 stopTyping 27960 } = Object(external_wp_data_["useDispatch"])(store); // Controls when the side inserter on empty lines should 27961 // be shown, including writing and selection modes. 27962 27963 const showEmptyBlockSideInserter = !isTyping && !isNavigationMode && isEmptyDefaultBlock && isValid; 27964 const shouldShowBreadcrumb = isNavigationMode; 27965 const shouldShowContextualToolbar = !isNavigationMode && !hasFixedToolbar && isLargeViewport && !showEmptyBlockSideInserter && !isMultiSelecting && (!isTyping || isCaretWithinFormattedText); 27966 const canFocusHiddenToolbar = !isNavigationMode && !shouldShowContextualToolbar && !hasFixedToolbar && !isEmptyDefaultBlock; 27967 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/focus-toolbar', Object(external_wp_element_["useCallback"])(() => { 27968 setIsToolbarForced(true); 27969 stopTyping(true); 27970 }, []), { 27971 bindGlobal: true, 27972 eventName: 'keydown', 27973 isDisabled: !canFocusHiddenToolbar 27974 }); 27975 Object(external_wp_element_["useEffect"])(() => { 27976 if (!shouldShowContextualToolbar) { 27977 setIsToolbarForced(false); 27978 } 27979 }, [shouldShowContextualToolbar]); // Stores the active toolbar item index so the block toolbar can return focus 27980 // to it when re-mounting. 27981 27982 const initialToolbarItemIndexRef = Object(external_wp_element_["useRef"])(); 27983 const selectedElement = useBlockElement(clientId); 27984 const lastSelectedElement = useBlockElement(lastClientId); 27985 const capturingElement = useBlockElement(capturingClientId); 27986 const popoverScrollRef = usePopoverScroll(__unstableContentRef); 27987 27988 if (!shouldShowBreadcrumb && !shouldShowContextualToolbar && !isToolbarForced && !showEmptyBlockSideInserter) { 27989 return null; 27990 } 27991 27992 let node = selectedElement; 27993 27994 if (!node) { 27995 return null; 27996 } 27997 27998 if (capturingClientId) { 27999 node = capturingElement; 28000 } 28001 28002 let anchorRef = node; 28003 28004 if (hasMultiSelection) { 28005 // Wait to render the popover until the bottom reference is available 28006 // as well. 28007 if (!lastSelectedElement) { 28008 return null; 28009 } 28010 28011 anchorRef = { 28012 top: node, 28013 bottom: lastSelectedElement 28014 }; 28015 } 28016 28017 function onFocus() { 28018 setIsInserterShown(true); 28019 } 28020 28021 function onBlur() { 28022 setIsInserterShown(false); 28023 } // Position above the anchor, pop out towards the right, and position in the 28024 // left corner. For the side inserter, pop out towards the left, and 28025 // position in the right corner. 28026 // To do: refactor `Popover` to make this prop clearer. 28027 28028 28029 const popoverPosition = showEmptyBlockSideInserter ? 'top left right' : 'top right left'; 28030 const { 28031 ownerDocument 28032 } = node; 28033 const stickyBoundaryElement = showEmptyBlockSideInserter ? undefined : // The sticky boundary element should be the boundary at which the 28034 // the block toolbar becomes sticky when the block scolls out of view. 28035 // In case of an iframe, this should be the iframe boundary, otherwise 28036 // the scroll container. 28037 ownerDocument.defaultView.frameElement || Object(external_wp_dom_["getScrollContainer"])(node) || ownerDocument.body; 28038 return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 28039 ref: popoverScrollRef, 28040 noArrow: true, 28041 animate: false, 28042 position: popoverPosition, 28043 focusOnMount: false, 28044 anchorRef: anchorRef, 28045 className: classnames_default()('block-editor-block-list__block-popover', { 28046 'is-insertion-point-visible': isInsertionPointVisible 28047 }), 28048 __unstableStickyBoundaryElement: stickyBoundaryElement // Render in the old slot if needed for backward compatibility, 28049 // otherwise render in place (not in the the default popover slot). 28050 , 28051 __unstableSlotName: __unstablePopoverSlot || null, 28052 __unstableBoundaryParent: true // Observe movement for block animations (especially horizontal). 28053 , 28054 __unstableObserveElement: node, 28055 shouldAnchorIncludePadding: true 28056 }, (shouldShowContextualToolbar || isToolbarForced) && Object(external_wp_element_["createElement"])("div", { 28057 onFocus: onFocus, 28058 onBlur: onBlur // While ideally it would be enough to capture the 28059 // bubbling focus event from the Inserter, due to the 28060 // characteristics of click focusing of `button`s in 28061 // Firefox and Safari, it is not reliable. 28062 // 28063 // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus 28064 , 28065 tabIndex: -1, 28066 className: classnames_default()('block-editor-block-list__block-popover-inserter', { 28067 'is-visible': isInserterShown 28068 }) 28069 }, Object(external_wp_element_["createElement"])(inserter, { 28070 clientId: clientId, 28071 rootClientId: rootClientId, 28072 __experimentalIsQuick: true 28073 })), (shouldShowContextualToolbar || isToolbarForced) && Object(external_wp_element_["createElement"])(block_contextual_toolbar // If the toolbar is being shown because of being forced 28074 // it should focus the toolbar right after the mount. 28075 , { 28076 focusOnMount: isToolbarForced, 28077 __experimentalInitialIndex: initialToolbarItemIndexRef.current, 28078 __experimentalOnIndexChange: index => { 28079 initialToolbarItemIndexRef.current = index; 28080 } // Resets the index whenever the active block changes so 28081 // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 28082 , 28083 key: clientId 28084 }), shouldShowBreadcrumb && Object(external_wp_element_["createElement"])(block_selection_button, { 28085 clientId: clientId, 28086 rootClientId: rootClientId, 28087 blockElement: node 28088 }), showEmptyBlockSideInserter && Object(external_wp_element_["createElement"])("div", { 28089 className: "block-editor-block-list__empty-block-inserter" 28090 }, Object(external_wp_element_["createElement"])(inserter, { 28091 position: "bottom right", 28092 rootClientId: rootClientId, 28093 clientId: clientId, 28094 __experimentalIsQuick: true 28095 }))); 28096 } 28097 28098 function wrapperSelector(select) { 28099 const { 28100 getSelectedBlockClientId, 28101 getFirstMultiSelectedBlockClientId, 28102 getBlockRootClientId, 28103 __unstableGetBlockWithoutInnerBlocks, 28104 getBlockParents, 28105 __experimentalGetBlockListSettingsForBlocks 28106 } = select(store); 28107 const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId(); 28108 28109 if (!clientId) { 28110 return; 28111 } 28112 28113 const { 28114 name, 28115 attributes = {}, 28116 isValid 28117 } = __unstableGetBlockWithoutInnerBlocks(clientId) || {}; 28118 const blockParentsClientIds = getBlockParents(clientId); // Get Block List Settings for all ancestors of the current Block clientId 28119 28120 const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting. 28121 28122 28123 const capturingClientId = Object(external_lodash_["find"])(blockParentsClientIds, parentClientId => { 28124 var _parentBlockListSetti; 28125 28126 return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars; 28127 }); 28128 return { 28129 clientId, 28130 rootClientId: getBlockRootClientId(clientId), 28131 name, 28132 isValid, 28133 isEmptyDefaultBlock: name && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])({ 28134 name, 28135 attributes 28136 }), 28137 capturingClientId 28138 }; 28139 } 28140 28141 function WrappedBlockPopover({ 28142 __unstablePopoverSlot, 28143 __unstableContentRef 28144 }) { 28145 const selected = Object(external_wp_data_["useSelect"])(wrapperSelector, []); 28146 28147 if (!selected) { 28148 return null; 28149 } 28150 28151 const { 28152 clientId, 28153 rootClientId, 28154 name, 28155 isValid, 28156 isEmptyDefaultBlock, 28157 capturingClientId 28158 } = selected; 28159 28160 if (!name) { 28161 return null; 28162 } 28163 28164 return Object(external_wp_element_["createElement"])(BlockPopover, { 28165 clientId: clientId, 28166 rootClientId: rootClientId, 28167 isValid: isValid, 28168 isEmptyDefaultBlock: isEmptyDefaultBlock, 28169 capturingClientId: capturingClientId, 28170 __unstablePopoverSlot: __unstablePopoverSlot, 28171 __unstableContentRef: __unstableContentRef 28172 }); 28173 } 28174 28175 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/back-compat.js 28176 28177 28178 /** 28179 * WordPress dependencies 28180 */ 28181 28182 28183 28184 /** 28185 * Internal dependencies 28186 */ 28187 28188 28189 28190 function BlockToolsBackCompat({ 28191 children 28192 }) { 28193 const openRef = Object(external_wp_element_["useContext"])(InsertionPointOpenRef); 28194 const isDisabled = Object(external_wp_element_["useContext"])(external_wp_components_["Disabled"].Context); // If context is set, `BlockTools` is a parent component. 28195 28196 if (openRef || isDisabled) { 28197 return children; 28198 } 28199 28200 external_wp_deprecated_default()('wp.components.Popover.Slot name="block-toolbar"', { 28201 alternative: 'wp.blockEditor.BlockTools' 28202 }); 28203 return Object(external_wp_element_["createElement"])(InsertionPoint, { 28204 __unstablePopoverSlot: "block-toolbar" 28205 }, Object(external_wp_element_["createElement"])(WrappedBlockPopover, { 28206 __unstablePopoverSlot: "block-toolbar" 28207 }), children); 28208 } 28209 28210 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js 28211 28212 28213 28214 /** 28215 * WordPress dependencies 28216 */ 28217 28218 28219 /** 28220 * Internal dependencies 28221 */ 28222 28223 28224 /** 28225 * Pass the returned ref callback to an element that should clear block 28226 * selection. Selection will only be cleared if the element is clicked directly, 28227 * not if a child element is clicked. 28228 * 28229 * @return {import('react').RefCallback} Ref callback. 28230 */ 28231 28232 function useBlockSelectionClearer() { 28233 const { 28234 hasSelectedBlock, 28235 hasMultiSelection 28236 } = Object(external_wp_data_["useSelect"])(store); 28237 const { 28238 clearSelectedBlock 28239 } = Object(external_wp_data_["useDispatch"])(store); 28240 return Object(external_wp_compose_["useRefEffect"])(node => { 28241 function onMouseDown(event) { 28242 if (!hasSelectedBlock() && !hasMultiSelection()) { 28243 return; 28244 } // Only handle clicks on the element, not the children. 28245 28246 28247 if (event.target !== node) { 28248 return; 28249 } 28250 28251 clearSelectedBlock(); 28252 } 28253 28254 node.addEventListener('mousedown', onMouseDown); 28255 return () => { 28256 node.removeEventListener('mousedown', onMouseDown); 28257 }; 28258 }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock]); 28259 } 28260 function BlockSelectionClearer(props) { 28261 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 28262 ref: useBlockSelectionClearer() 28263 }, props)); 28264 } 28265 28266 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js 28267 28268 28269 /** 28270 * External dependencies 28271 */ 28272 28273 /** 28274 * WordPress dependencies 28275 */ 28276 28277 28278 28279 28280 /** 28281 * Internal dependencies 28282 */ 28283 28284 28285 28286 28287 28288 28289 28290 28291 28292 28293 28294 const IntersectionObserver = Object(external_wp_element_["createContext"])(); 28295 28296 function Root({ 28297 className, 28298 children 28299 }) { 28300 const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); 28301 const { 28302 isOutlineMode, 28303 isFocusMode, 28304 isNavigationMode 28305 } = Object(external_wp_data_["useSelect"])(select => { 28306 const { 28307 getSettings, 28308 isNavigationMode: _isNavigationMode 28309 } = select(store); 28310 const { 28311 outlineMode, 28312 focusMode 28313 } = getSettings(); 28314 return { 28315 isOutlineMode: outlineMode, 28316 isFocusMode: focusMode, 28317 isNavigationMode: _isNavigationMode() 28318 }; 28319 }, []); 28320 return Object(external_wp_element_["createElement"])(Head, null, Object(external_wp_element_["createElement"])("div", { 28321 ref: Object(external_wp_compose_["useMergeRefs"])([useBlockSelectionClearer(), useBlockDropZone(), useInBetweenInserter()]), 28322 className: classnames_default()('block-editor-block-list__layout is-root-container', className, { 28323 'is-outline-mode': isOutlineMode, 28324 'is-focus-mode': isFocusMode && isLargeViewport, 28325 'is-navigate-mode': isNavigationMode 28326 }) 28327 }, children)); 28328 } 28329 28330 function BlockList({ 28331 className, 28332 ...props 28333 }) { 28334 usePreParsePatterns(); 28335 return Object(external_wp_element_["createElement"])(BlockToolsBackCompat, null, Object(external_wp_element_["createElement"])(Root, { 28336 className: className 28337 }, Object(external_wp_element_["createElement"])(BlockListItems, props))); 28338 } 28339 28340 function Items({ 28341 placeholder, 28342 rootClientId, 28343 renderAppender, 28344 __experimentalAppenderTagName, 28345 __experimentalLayout: layout = layout_defaultLayout 28346 }) { 28347 const [intersectingBlocks, setIntersectingBlocks] = Object(external_wp_element_["useState"])(new Set()); 28348 const intersectionObserver = Object(external_wp_element_["useMemo"])(() => { 28349 const { 28350 IntersectionObserver: Observer 28351 } = window; 28352 28353 if (!Observer) { 28354 return; 28355 } 28356 28357 return new Observer(entries => { 28358 setIntersectingBlocks(oldIntersectingBlocks => { 28359 const newIntersectingBlocks = new Set(oldIntersectingBlocks); 28360 28361 for (const entry of entries) { 28362 const clientId = entry.target.getAttribute('data-block'); 28363 const action = entry.isIntersecting ? 'add' : 'delete'; 28364 newIntersectingBlocks[action](clientId); 28365 } 28366 28367 return newIntersectingBlocks; 28368 }); 28369 }); 28370 }, [setIntersectingBlocks]); 28371 const { 28372 order, 28373 selectedBlocks 28374 } = Object(external_wp_data_["useSelect"])(select => { 28375 const { 28376 getBlockOrder, 28377 getSelectedBlockClientIds 28378 } = select(store); 28379 return { 28380 order: getBlockOrder(rootClientId), 28381 selectedBlocks: getSelectedBlockClientIds() 28382 }; 28383 }, [rootClientId]); 28384 return Object(external_wp_element_["createElement"])(LayoutProvider, { 28385 value: layout 28386 }, Object(external_wp_element_["createElement"])(IntersectionObserver.Provider, { 28387 value: intersectionObserver 28388 }, order.map(clientId => Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], { 28389 key: clientId, 28390 value: // Only provide data asynchronously if the block is 28391 // not visible and not selected. 28392 !intersectingBlocks.has(clientId) && !selectedBlocks.includes(clientId) 28393 }, Object(external_wp_element_["createElement"])(block_list_block, { 28394 rootClientId: rootClientId, 28395 clientId: clientId 28396 })))), order.length < 1 && placeholder, Object(external_wp_element_["createElement"])(block_list_appender, { 28397 tagName: __experimentalAppenderTagName, 28398 rootClientId: rootClientId, 28399 renderAppender: renderAppender 28400 })); 28401 } 28402 28403 function BlockListItems(props) { 28404 // This component needs to always be synchronous as it's the one changing 28405 // the async mode depending on the block selection. 28406 return Object(external_wp_element_["createElement"])(external_wp_data_["AsyncModeProvider"], { 28407 value: false 28408 }, Object(external_wp_element_["createElement"])(Items, props)); 28409 } 28410 28411 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js 28412 /** 28413 * WordPress dependencies 28414 */ 28415 28416 28417 /** 28418 * Internal dependencies 28419 */ 28420 28421 28422 function useIntersectionObserver() { 28423 const observer = Object(external_wp_element_["useContext"])(IntersectionObserver); 28424 return Object(external_wp_compose_["useRefEffect"])(node => { 28425 if (observer) { 28426 observer.observe(node); 28427 return () => { 28428 observer.unobserve(node); 28429 }; 28430 } 28431 }, [observer]); 28432 } 28433 28434 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js 28435 /** 28436 * External dependencies 28437 */ 28438 28439 /** 28440 * WordPress dependencies 28441 */ 28442 28443 28444 28445 28446 28447 28448 /** 28449 * Internal dependencies 28450 */ 28451 28452 28453 28454 28455 28456 28457 28458 28459 28460 28461 28462 28463 28464 28465 28466 28467 28468 /** 28469 * If the block count exceeds the threshold, we disable the reordering animation 28470 * to avoid laginess. 28471 */ 28472 28473 const BLOCK_ANIMATION_THRESHOLD = 200; 28474 /** 28475 * This hook is used to lightly mark an element as a block element. The element 28476 * should be the outermost element of a block. Call this hook and pass the 28477 * returned props to the element to mark as a block. If you define a ref for the 28478 * element, it is important to pass the ref to this hook, which the hook in turn 28479 * will pass to the component through the props it returns. Optionally, you can 28480 * also pass any other props through this hook, and they will be merged and 28481 * returned. 28482 * 28483 * @param {Object} props Optional. Props to pass to the element. Must contain 28484 * the ref if one is defined. 28485 * @param {Object} options Options for internal use only. 28486 * @param {boolean} options.__unstableIsHtml 28487 * 28488 * @return {Object} Props to pass to the element to mark as a block. 28489 */ 28490 28491 function useBlockProps(props = {}, { 28492 __unstableIsHtml 28493 } = {}) { 28494 const { 28495 clientId, 28496 className, 28497 wrapperProps = {}, 28498 isAligned 28499 } = Object(external_wp_element_["useContext"])(BlockListBlockContext); 28500 const { 28501 index, 28502 mode, 28503 name, 28504 blockTitle, 28505 isPartOfSelection, 28506 adjustScrolling, 28507 enableAnimation 28508 } = Object(external_wp_data_["useSelect"])(select => { 28509 const { 28510 getBlockRootClientId, 28511 getBlockIndex, 28512 getBlockMode, 28513 getBlockName, 28514 isTyping, 28515 getGlobalBlockCount, 28516 isBlockSelected, 28517 isBlockMultiSelected, 28518 isAncestorMultiSelected, 28519 isFirstMultiSelectedBlock 28520 } = select(store); 28521 const isSelected = isBlockSelected(clientId); 28522 const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId); 28523 const blockName = getBlockName(clientId); 28524 const rootClientId = getBlockRootClientId(clientId); 28525 return { 28526 index: getBlockIndex(clientId, rootClientId), 28527 mode: getBlockMode(clientId), 28528 name: blockName, 28529 blockTitle: Object(external_wp_blocks_["getBlockType"])(blockName).title, 28530 isPartOfSelection: isSelected || isPartOfMultiSelection, 28531 adjustScrolling: isSelected || isFirstMultiSelectedBlock(clientId), 28532 enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD 28533 }; 28534 }, [clientId]); // translators: %s: Type of block (i.e. Text, Image etc) 28535 28536 const blockLabel = Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Block: %s'), blockTitle); 28537 const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : ''; 28538 const mergedRefs = Object(external_wp_compose_["useMergeRefs"])([props.ref, useFocusFirstElement(clientId), // Must happen after focus because we check for focus in the block. 28539 useScrollIntoView(clientId), useBlockRefProvider(clientId), useFocusHandler(clientId), useMultiSelection(clientId), useEventHandlers(clientId), useNavModeExit(clientId), useIsHovered(), useIntersectionObserver(), use_moving_animation({ 28540 isSelected: isPartOfSelection, 28541 adjustScrolling, 28542 enableAnimation, 28543 triggerAnimationOnChange: index 28544 })]); 28545 return { ...wrapperProps, 28546 ...props, 28547 ref: mergedRefs, 28548 id: `block-${clientId}${htmlSuffix}`, 28549 tabIndex: 0, 28550 role: 'group', 28551 'aria-label': blockLabel, 28552 'data-block': clientId, 28553 'data-type': name, 28554 'data-title': blockTitle, 28555 className: classnames_default()( // The wp-block className is important for editor styles. 28556 classnames_default()('block-editor-block-list__block', { 28557 'wp-block': !isAligned 28558 }), className, props.className, wrapperProps.className, useBlockClassNames(clientId), useBlockDefaultClassName(clientId), useBlockCustomClassName(clientId), useBlockMovingModeClassNames(clientId)), 28559 style: { ...wrapperProps.style, 28560 ...props.style 28561 } 28562 }; 28563 } 28564 /** 28565 * Call within a save function to get the props for the block wrapper. 28566 * 28567 * @param {Object} props Optional. Props to pass to the element. 28568 */ 28569 28570 useBlockProps.save = external_wp_blocks_["__unstableGetBlockProps"]; 28571 28572 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block.js 28573 28574 28575 /** 28576 * External dependencies 28577 */ 28578 28579 28580 /** 28581 * WordPress dependencies 28582 */ 28583 28584 28585 28586 28587 28588 28589 28590 /** 28591 * Internal dependencies 28592 */ 28593 28594 28595 28596 28597 28598 28599 28600 28601 const BlockListBlockContext = Object(external_wp_element_["createContext"])(); 28602 /** 28603 * Merges wrapper props with special handling for classNames and styles. 28604 * 28605 * @param {Object} propsA 28606 * @param {Object} propsB 28607 * 28608 * @return {Object} Merged props. 28609 */ 28610 28611 function mergeWrapperProps(propsA, propsB) { 28612 const newProps = { ...propsA, 28613 ...propsB 28614 }; 28615 28616 if (propsA && propsB && propsA.className && propsB.className) { 28617 newProps.className = classnames_default()(propsA.className, propsB.className); 28618 } 28619 28620 if (propsA && propsB && propsA.style && propsB.style) { 28621 newProps.style = { ...propsA.style, 28622 ...propsB.style 28623 }; 28624 } 28625 28626 return newProps; 28627 } 28628 28629 function Block({ 28630 children, 28631 isHtml, 28632 ...props 28633 }) { 28634 return Object(external_wp_element_["createElement"])("div", useBlockProps(props, { 28635 __unstableIsHtml: isHtml 28636 }), children); 28637 } 28638 28639 function block_BlockListBlock({ 28640 mode, 28641 isLocked, 28642 clientId, 28643 isSelected, 28644 isSelectionEnabled, 28645 className, 28646 name, 28647 isValid, 28648 attributes, 28649 wrapperProps, 28650 setAttributes, 28651 onReplace, 28652 onInsertBlocksAfter, 28653 onMerge, 28654 toggleSelection 28655 }) { 28656 const { 28657 removeBlock 28658 } = Object(external_wp_data_["useDispatch"])(store); 28659 const onRemove = Object(external_wp_element_["useCallback"])(() => removeBlock(clientId), [clientId]); // We wrap the BlockEdit component in a div that hides it when editing in 28660 // HTML mode. This allows us to render all of the ancillary pieces 28661 // (InspectorControls, etc.) which are inside `BlockEdit` but not 28662 // `BlockHTML`, even in HTML mode. 28663 28664 let blockEdit = Object(external_wp_element_["createElement"])(block_edit_BlockEdit, { 28665 name: name, 28666 isSelected: isSelected, 28667 attributes: attributes, 28668 setAttributes: setAttributes, 28669 insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter, 28670 onReplace: isLocked ? undefined : onReplace, 28671 onRemove: isLocked ? undefined : onRemove, 28672 mergeBlocks: isLocked ? undefined : onMerge, 28673 clientId: clientId, 28674 isSelectionEnabled: isSelectionEnabled, 28675 toggleSelection: toggleSelection 28676 }); 28677 const blockType = Object(external_wp_blocks_["getBlockType"])(name); 28678 const lightBlockWrapper = blockType.apiVersion > 1 || Object(external_wp_blocks_["hasBlockSupport"])(blockType, 'lightBlockWrapper', false); // Determine whether the block has props to apply to the wrapper. 28679 28680 if (blockType.getEditWrapperProps) { 28681 wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes)); 28682 } 28683 28684 const isAligned = wrapperProps && !!wrapperProps['data-align']; // For aligned blocks, provide a wrapper element so the block can be 28685 // positioned relative to the block column. 28686 28687 if (isAligned) { 28688 blockEdit = Object(external_wp_element_["createElement"])("div", { 28689 className: "wp-block", 28690 "data-align": wrapperProps['data-align'] 28691 }, blockEdit); 28692 } 28693 28694 let block; 28695 28696 if (!isValid) { 28697 const saveContent = Object(external_wp_blocks_["getSaveContent"])(blockType, attributes); 28698 block = Object(external_wp_element_["createElement"])(Block, { 28699 className: "has-warning" 28700 }, Object(external_wp_element_["createElement"])(block_invalid_warning, { 28701 clientId: clientId 28702 }), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(saveContent))); 28703 } else if (mode === 'html') { 28704 // Render blockEdit so the inspector controls don't disappear. 28705 // See #8969. 28706 block = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 28707 style: { 28708 display: 'none' 28709 } 28710 }, blockEdit), Object(external_wp_element_["createElement"])(Block, { 28711 isHtml: true 28712 }, Object(external_wp_element_["createElement"])(block_html, { 28713 clientId: clientId 28714 }))); 28715 } else if (lightBlockWrapper) { 28716 block = blockEdit; 28717 } else { 28718 block = Object(external_wp_element_["createElement"])(Block, wrapperProps, blockEdit); 28719 } 28720 28721 const value = { 28722 clientId, 28723 className, 28724 wrapperProps: Object(external_lodash_["omit"])(wrapperProps, ['data-align']), 28725 isAligned 28726 }; 28727 const memoizedValue = Object(external_wp_element_["useMemo"])(() => value, Object.values(value)); 28728 return Object(external_wp_element_["createElement"])(BlockListBlockContext.Provider, { 28729 value: memoizedValue 28730 }, Object(external_wp_element_["createElement"])(block_crash_boundary, { 28731 fallback: Object(external_wp_element_["createElement"])(Block, { 28732 className: "has-warning" 28733 }, Object(external_wp_element_["createElement"])(block_crash_warning, null)) 28734 }, block)); 28735 } 28736 28737 const applyWithSelect = Object(external_wp_data_["withSelect"])((select, { 28738 clientId, 28739 rootClientId 28740 }) => { 28741 const { 28742 isBlockSelected, 28743 getBlockMode, 28744 isSelectionEnabled, 28745 getTemplateLock, 28746 __unstableGetBlockWithoutInnerBlocks 28747 } = select(store); 28748 28749 const block = __unstableGetBlockWithoutInnerBlocks(clientId); 28750 28751 const isSelected = isBlockSelected(clientId); 28752 const templateLock = getTemplateLock(rootClientId); // The fallback to `{}` is a temporary fix. 28753 // This function should never be called when a block is not present in 28754 // the state. It happens now because the order in withSelect rendering 28755 // is not correct. 28756 28757 const { 28758 name, 28759 attributes, 28760 isValid 28761 } = block || {}; // Do not add new properties here, use `useSelect` instead to avoid 28762 // leaking new props to the public API (editor.BlockListBlock filter). 28763 28764 return { 28765 mode: getBlockMode(clientId), 28766 isSelectionEnabled: isSelectionEnabled(), 28767 isLocked: !!templateLock, 28768 // Users of the editor.BlockListBlock filter used to be able to 28769 // access the block prop. 28770 // Ideally these blocks would rely on the clientId prop only. 28771 // This is kept for backward compatibility reasons. 28772 block, 28773 name, 28774 attributes, 28775 isValid, 28776 isSelected 28777 }; 28778 }); 28779 const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, ownProps, { 28780 select 28781 }) => { 28782 const { 28783 updateBlockAttributes, 28784 insertBlocks, 28785 mergeBlocks, 28786 replaceBlocks, 28787 toggleSelection, 28788 __unstableMarkLastChangeAsPersistent 28789 } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid 28790 // leaking new props to the public API (editor.BlockListBlock filter). 28791 28792 return { 28793 setAttributes(newAttributes) { 28794 const { 28795 getMultiSelectedBlockClientIds 28796 } = select(store); 28797 const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(); 28798 const { 28799 clientId 28800 } = ownProps; 28801 const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId]; 28802 updateBlockAttributes(clientIds, newAttributes); 28803 }, 28804 28805 onInsertBlocks(blocks, index) { 28806 const { 28807 rootClientId 28808 } = ownProps; 28809 insertBlocks(blocks, index, rootClientId); 28810 }, 28811 28812 onInsertBlocksAfter(blocks) { 28813 const { 28814 clientId, 28815 rootClientId 28816 } = ownProps; 28817 const { 28818 getBlockIndex 28819 } = select(store); 28820 const index = getBlockIndex(clientId, rootClientId); 28821 insertBlocks(blocks, index + 1, rootClientId); 28822 }, 28823 28824 onMerge(forward) { 28825 const { 28826 clientId 28827 } = ownProps; 28828 const { 28829 getPreviousBlockClientId, 28830 getNextBlockClientId 28831 } = select(store); 28832 28833 if (forward) { 28834 const nextBlockClientId = getNextBlockClientId(clientId); 28835 28836 if (nextBlockClientId) { 28837 mergeBlocks(clientId, nextBlockClientId); 28838 } 28839 } else { 28840 const previousBlockClientId = getPreviousBlockClientId(clientId); 28841 28842 if (previousBlockClientId) { 28843 mergeBlocks(previousBlockClientId, clientId); 28844 } 28845 } 28846 }, 28847 28848 onReplace(blocks, indexToSelect, initialPosition) { 28849 if (blocks.length && !Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[blocks.length - 1])) { 28850 __unstableMarkLastChangeAsPersistent(); 28851 } 28852 28853 replaceBlocks([ownProps.clientId], blocks, indexToSelect, initialPosition); 28854 }, 28855 28856 toggleSelection(selectionEnabled) { 28857 toggleSelection(selectionEnabled); 28858 } 28859 28860 }; 28861 }); 28862 /* harmony default export */ var block_list_block = (Object(external_wp_compose_["compose"])(external_wp_compose_["pure"], applyWithSelect, applyWithDispatch, // block is sometimes not mounted at the right time, causing it be undefined 28863 // see issue for more info 28864 // https://github.com/WordPress/gutenberg/issues/17013 28865 Object(external_wp_compose_["ifCondition"])(({ 28866 block 28867 }) => !!block), Object(external_wp_components_["withFilters"])('editor.BlockListBlock'))(block_BlockListBlock)); 28868 28869 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/utils.js 28870 /** 28871 * External dependencies 28872 */ 28873 28874 /** 28875 * WordPress dependencies 28876 */ 28877 28878 28879 const getBlockPositionDescription = (position, siblingCount, level) => Object(external_wp_i18n_["sprintf"])( 28880 /* translators: 1: The numerical position of the block. 2: The total number of blocks. 3. The level of nesting for the block. */ 28881 Object(external_wp_i18n_["__"])('Block %1$d of %2$d, Level %3$d'), position, siblingCount, level); 28882 /** 28883 * Returns true if the client ID occurs within the block selection or multi-selection, 28884 * or false otherwise. 28885 * 28886 * @param {string} clientId Block client ID. 28887 * @param {string|string[]} selectedBlockClientIds Selected block client ID, or an array of multi-selected blocks client IDs. 28888 * 28889 * @return {boolean} Whether the block is in multi-selection set. 28890 */ 28891 28892 const isClientIdSelected = (clientId, selectedBlockClientIds) => Object(external_lodash_["isArray"])(selectedBlockClientIds) && selectedBlockClientIds.length ? selectedBlockClientIds.indexOf(clientId) !== -1 : selectedBlockClientIds === clientId; 28893 28894 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block-select-button.js 28895 28896 28897 /** 28898 * External dependencies 28899 */ 28900 28901 /** 28902 * WordPress dependencies 28903 */ 28904 28905 28906 28907 28908 28909 /** 28910 * Internal dependencies 28911 */ 28912 28913 28914 28915 28916 28917 28918 function BlockNavigationBlockSelectButton({ 28919 className, 28920 block: { 28921 clientId 28922 }, 28923 isSelected, 28924 onClick, 28925 position, 28926 siblingBlockCount, 28927 level, 28928 tabIndex, 28929 onFocus, 28930 onDragStart, 28931 onDragEnd, 28932 draggable 28933 }, ref) { 28934 const blockInformation = useBlockDisplayInformation(clientId); 28935 const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockNavigationBlockSelectButton); 28936 const descriptionId = `block-navigation-block-select-button__${instanceId}`; 28937 const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); 28938 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 28939 className: classnames_default()('block-editor-block-navigation-block-select-button', className), 28940 onClick: onClick, 28941 "aria-describedby": descriptionId, 28942 ref: ref, 28943 tabIndex: tabIndex, 28944 onFocus: onFocus, 28945 onDragStart: onDragStart, 28946 onDragEnd: onDragEnd, 28947 draggable: draggable 28948 }, Object(external_wp_element_["createElement"])(BlockIcon, { 28949 icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon, 28950 showColors: true 28951 }), Object(external_wp_element_["createElement"])(BlockTitle, { 28952 clientId: clientId 28953 }), (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.anchor) && Object(external_wp_element_["createElement"])("span", { 28954 className: "block-editor-block-navigation-block-select-button__anchor" 28955 }, blockInformation.anchor), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('(selected block)'))), Object(external_wp_element_["createElement"])("div", { 28956 className: "block-editor-block-navigation-block-select-button__description", 28957 id: descriptionId 28958 }, blockPositionDescription)); 28959 } 28960 28961 /* harmony default export */ var block_select_button = (Object(external_wp_element_["forwardRef"])(BlockNavigationBlockSelectButton)); 28962 28963 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block-slot.js 28964 28965 28966 28967 /** 28968 * External dependencies 28969 */ 28970 28971 /** 28972 * WordPress dependencies 28973 */ 28974 28975 28976 28977 28978 28979 28980 28981 /** 28982 * Internal dependencies 28983 */ 28984 28985 28986 28987 28988 28989 28990 28991 const getSlotName = clientId => `BlockNavigationBlock-${clientId}`; 28992 28993 function BlockNavigationBlockSlot(props, ref) { 28994 const { 28995 clientId 28996 } = props.block; 28997 const { 28998 name 28999 } = Object(external_wp_data_["useSelect"])(select => select(store).getBlockName(clientId), [clientId]); 29000 const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockNavigationBlockSlot); 29001 return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { 29002 name: getSlotName(clientId) 29003 }, fills => { 29004 if (!fills.length) { 29005 return Object(external_wp_element_["createElement"])(block_select_button, Object(esm_extends["a" /* default */])({ 29006 ref: ref 29007 }, props)); 29008 } 29009 29010 const { 29011 className, 29012 isSelected, 29013 position, 29014 siblingBlockCount, 29015 level, 29016 tabIndex, 29017 onFocus 29018 } = props; 29019 const blockType = Object(external_wp_blocks_["getBlockType"])(name); 29020 const descriptionId = `block-navigation-block-slot__${instanceId}`; 29021 const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level); 29022 const forwardedFillProps = { 29023 // Ensure that the component in the slot can receive 29024 // keyboard navigation. 29025 tabIndex, 29026 onFocus, 29027 ref, 29028 // Give the element rendered in the slot a description 29029 // that describes its position. 29030 'aria-describedby': descriptionId 29031 }; 29032 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 29033 className: classnames_default()('block-editor-block-navigation-block-slot', className) 29034 }, Object(external_wp_element_["createElement"])(BlockIcon, { 29035 icon: blockType.icon, 29036 showColors: true 29037 }), external_wp_element_["Children"].map(fills, fill => Object(external_wp_element_["cloneElement"])(fill, { ...fill.props, 29038 ...forwardedFillProps 29039 })), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('(selected block)')), Object(external_wp_element_["createElement"])("div", { 29040 className: "block-editor-block-navigation-block-slot__description", 29041 id: descriptionId 29042 }, blockPositionDescription))); 29043 }); 29044 } 29045 29046 /* harmony default export */ var block_slot = (Object(external_wp_element_["forwardRef"])(BlockNavigationBlockSlot)); 29047 const BlockNavigationBlockFill = props => { 29048 const { 29049 clientId 29050 } = Object(external_wp_element_["useContext"])(BlockListBlockContext); 29051 return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], Object(esm_extends["a" /* default */])({}, props, { 29052 name: getSlotName(clientId) 29053 })); 29054 }; 29055 29056 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block-contents.js 29057 29058 29059 29060 /** 29061 * External dependencies 29062 */ 29063 29064 /** 29065 * WordPress dependencies 29066 */ 29067 29068 29069 29070 /** 29071 * Internal dependencies 29072 */ 29073 29074 29075 29076 29077 29078 29079 const BlockNavigationBlockContents = Object(external_wp_element_["forwardRef"])(({ 29080 onClick, 29081 block, 29082 isSelected, 29083 position, 29084 siblingBlockCount, 29085 level, 29086 ...props 29087 }, ref) => { 29088 const { 29089 __experimentalFeatures, 29090 blockDropTarget = {} 29091 } = useBlockNavigationContext(); 29092 const { 29093 clientId 29094 } = block; 29095 const { 29096 rootClientId, 29097 blockMovingClientId, 29098 selectedBlockInBlockEditor 29099 } = Object(external_wp_data_["useSelect"])(select => { 29100 const { 29101 getBlockRootClientId, 29102 hasBlockMovingClientId, 29103 getSelectedBlockClientId 29104 } = select(store); 29105 return { 29106 rootClientId: getBlockRootClientId(clientId) || '', 29107 blockMovingClientId: hasBlockMovingClientId(), 29108 selectedBlockInBlockEditor: getSelectedBlockClientId() 29109 }; 29110 }, [clientId]); 29111 const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId; 29112 const { 29113 rootClientId: dropTargetRootClientId, 29114 clientId: dropTargetClientId, 29115 dropPosition 29116 } = blockDropTarget; 29117 const isDroppingBefore = dropTargetRootClientId === rootClientId && dropTargetClientId === clientId && dropPosition === 'top'; 29118 const isDroppingAfter = dropTargetRootClientId === rootClientId && dropTargetClientId === clientId && dropPosition === 'bottom'; 29119 const isDroppingToInnerBlocks = dropTargetRootClientId === clientId && dropPosition === 'inside'; 29120 const className = classnames_default()('block-editor-block-navigation-block-contents', { 29121 'is-dropping-before': isDroppingBefore || isBlockMoveTarget, 29122 'is-dropping-after': isDroppingAfter, 29123 'is-dropping-to-inner-blocks': isDroppingToInnerBlocks 29124 }); 29125 return Object(external_wp_element_["createElement"])(block_draggable, { 29126 clientIds: [block.clientId], 29127 elementId: `block-navigation-block-${block.clientId}` 29128 }, ({ 29129 draggable, 29130 onDragStart, 29131 onDragEnd 29132 }) => __experimentalFeatures ? Object(external_wp_element_["createElement"])(block_slot, Object(esm_extends["a" /* default */])({ 29133 ref: ref, 29134 className: className, 29135 block: block, 29136 onClick: onClick, 29137 isSelected: isSelected, 29138 position: position, 29139 siblingBlockCount: siblingBlockCount, 29140 level: level, 29141 draggable: draggable && __experimentalFeatures, 29142 onDragStart: onDragStart, 29143 onDragEnd: onDragEnd 29144 }, props)) : Object(external_wp_element_["createElement"])(block_select_button, Object(esm_extends["a" /* default */])({ 29145 ref: ref, 29146 className: className, 29147 block: block, 29148 onClick: onClick, 29149 isSelected: isSelected, 29150 position: position, 29151 siblingBlockCount: siblingBlockCount, 29152 level: level, 29153 draggable: draggable && __experimentalFeatures, 29154 onDragStart: onDragStart, 29155 onDragEnd: onDragEnd 29156 }, props))); 29157 }); 29158 /* harmony default export */ var block_contents = (BlockNavigationBlockContents); 29159 29160 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/block.js 29161 29162 29163 /** 29164 * External dependencies 29165 */ 29166 29167 /** 29168 * WordPress dependencies 29169 */ 29170 29171 29172 29173 29174 29175 29176 /** 29177 * Internal dependencies 29178 */ 29179 29180 29181 29182 29183 29184 29185 29186 function BlockNavigationBlock({ 29187 block, 29188 isSelected, 29189 isBranchSelected, 29190 isLastOfSelectedBranch, 29191 onClick, 29192 position, 29193 level, 29194 rowCount, 29195 siblingBlockCount, 29196 showBlockMovers, 29197 path 29198 }) { 29199 const cellRef = Object(external_wp_element_["useRef"])(null); 29200 const [isHovered, setIsHovered] = Object(external_wp_element_["useState"])(false); 29201 const { 29202 clientId 29203 } = block; 29204 const { 29205 isDragging, 29206 blockParents 29207 } = Object(external_wp_data_["useSelect"])(select => { 29208 const { 29209 isBlockBeingDragged, 29210 isAncestorBeingDragged, 29211 getBlockParents 29212 } = select(store); 29213 return { 29214 isDragging: isBlockBeingDragged(clientId) || isAncestorBeingDragged(clientId), 29215 blockParents: getBlockParents(clientId) 29216 }; 29217 }, [clientId]); 29218 const { 29219 selectBlock: selectEditorBlock, 29220 toggleBlockHighlight 29221 } = Object(external_wp_data_["useDispatch"])(store); 29222 const hasSiblings = siblingBlockCount > 0; 29223 const hasRenderedMovers = showBlockMovers && hasSiblings; 29224 const moverCellClassName = classnames_default()('block-editor-block-navigation-block__mover-cell', { 29225 'is-visible': isHovered 29226 }); 29227 const { 29228 __experimentalFeatures: withExperimentalFeatures, 29229 __experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures, 29230 isTreeGridMounted 29231 } = useBlockNavigationContext(); 29232 const blockNavigationBlockSettingsClassName = classnames_default()('block-editor-block-navigation-block__menu-cell', { 29233 'is-visible': isHovered 29234 }); // If BlockNavigation has experimental features related to the Persistent List View, 29235 // only focus the selected list item on mount; otherwise the list would always 29236 // try to steal the focus from the editor canvas. 29237 29238 Object(external_wp_element_["useEffect"])(() => { 29239 if (withExperimentalPersistentListViewFeatures && !isTreeGridMounted && isSelected) { 29240 cellRef.current.focus(); 29241 } 29242 }, []); // If BlockNavigation has experimental features (such as drag and drop) enabled, 29243 // leave the focus handling as it was before, to avoid accidental regressions. 29244 29245 Object(external_wp_element_["useEffect"])(() => { 29246 if (withExperimentalFeatures && isSelected) { 29247 cellRef.current.focus(); 29248 } 29249 }, [withExperimentalFeatures, isSelected]); 29250 const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {}; 29251 29252 const onMouseEnter = () => { 29253 setIsHovered(true); 29254 highlightBlock(clientId, true); 29255 }; 29256 29257 const onMouseLeave = () => { 29258 setIsHovered(false); 29259 highlightBlock(clientId, false); 29260 }; 29261 29262 const classes = classnames_default()({ 29263 'is-selected': isSelected, 29264 'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected, 29265 'is-last-of-selected-branch': withExperimentalPersistentListViewFeatures && isLastOfSelectedBranch, 29266 'is-dragging': isDragging 29267 }); 29268 return Object(external_wp_element_["createElement"])(BlockNavigationLeaf, { 29269 className: classes, 29270 onMouseEnter: onMouseEnter, 29271 onMouseLeave: onMouseLeave, 29272 onFocus: onMouseEnter, 29273 onBlur: onMouseLeave, 29274 level: level, 29275 position: position, 29276 rowCount: rowCount, 29277 path: path, 29278 id: `block-navigation-block-${clientId}`, 29279 "data-block": clientId 29280 }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { 29281 className: "block-editor-block-navigation-block__contents-cell", 29282 colSpan: hasRenderedMovers ? undefined : 2, 29283 ref: cellRef 29284 }, ({ 29285 ref, 29286 tabIndex, 29287 onFocus 29288 }) => Object(external_wp_element_["createElement"])("div", { 29289 className: "block-editor-block-navigation-block__contents-container" 29290 }, Object(external_wp_element_["createElement"])(block_contents, { 29291 block: block, 29292 onClick: () => onClick(block.clientId), 29293 isSelected: isSelected, 29294 position: position, 29295 siblingBlockCount: siblingBlockCount, 29296 level: level, 29297 ref: ref, 29298 tabIndex: tabIndex, 29299 onFocus: onFocus 29300 }))), hasRenderedMovers && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { 29301 className: moverCellClassName, 29302 withoutGridItem: true 29303 }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridItem"], null, ({ 29304 ref, 29305 tabIndex, 29306 onFocus 29307 }) => Object(external_wp_element_["createElement"])(BlockMoverUpButton, { 29308 orientation: "vertical", 29309 clientIds: [clientId], 29310 ref: ref, 29311 tabIndex: tabIndex, 29312 onFocus: onFocus 29313 })), Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridItem"], null, ({ 29314 ref, 29315 tabIndex, 29316 onFocus 29317 }) => Object(external_wp_element_["createElement"])(BlockMoverDownButton, { 29318 orientation: "vertical", 29319 clientIds: [clientId], 29320 ref: ref, 29321 tabIndex: tabIndex, 29322 onFocus: onFocus 29323 })))), withExperimentalFeatures && Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { 29324 className: blockNavigationBlockSettingsClassName 29325 }, ({ 29326 ref, 29327 tabIndex, 29328 onFocus 29329 }) => Object(external_wp_element_["createElement"])(block_settings_dropdown, { 29330 clientIds: [clientId], 29331 icon: more_vertical["a" /* default */], 29332 toggleProps: { 29333 ref, 29334 tabIndex, 29335 onFocus 29336 }, 29337 disableOpenOnArrowDown: true, 29338 __experimentalSelectBlock: onClick 29339 }, ({ 29340 onClose 29341 }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 29342 onClick: async () => { 29343 if (blockParents.length) { 29344 // If the block to select is inside a dropdown, we need to open the dropdown. 29345 // Otherwise focus won't transfer to the block. 29346 for (const parent of blockParents) { 29347 await selectEditorBlock(parent); 29348 } 29349 } else { 29350 // If clientId is already selected, it won't be focused (see block-wrapper.js) 29351 // This removes the selection first to ensure the focus will always switch. 29352 await selectEditorBlock(null); 29353 } 29354 29355 await selectEditorBlock(clientId); 29356 onClose(); 29357 } 29358 }, Object(external_wp_i18n_["__"])('Go to block')))))); 29359 } 29360 29361 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/appender.js 29362 29363 29364 /** 29365 * External dependencies 29366 */ 29367 29368 /** 29369 * WordPress dependencies 29370 */ 29371 29372 29373 29374 29375 29376 /** 29377 * Internal dependencies 29378 */ 29379 29380 29381 29382 29383 function BlockNavigationAppender({ 29384 parentBlockClientId, 29385 position, 29386 level, 29387 rowCount, 29388 path 29389 }) { 29390 const isDragging = Object(external_wp_data_["useSelect"])(select => { 29391 const { 29392 isBlockBeingDragged, 29393 isAncestorBeingDragged 29394 } = select(store); 29395 return isBlockBeingDragged(parentBlockClientId) || isAncestorBeingDragged(parentBlockClientId); 29396 }, [parentBlockClientId]); 29397 const instanceId = Object(external_wp_compose_["useInstanceId"])(BlockNavigationAppender); 29398 const descriptionId = `block-navigation-appender-row__description_${instanceId}`; 29399 const appenderPositionDescription = Object(external_wp_i18n_["sprintf"])( 29400 /* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */ 29401 Object(external_wp_i18n_["__"])('Add block at position %1$d, Level %2$d'), position, level); 29402 return Object(external_wp_element_["createElement"])(BlockNavigationLeaf, { 29403 className: classnames_default()({ 29404 'is-dragging': isDragging 29405 }), 29406 level: level, 29407 position: position, 29408 rowCount: rowCount, 29409 path: path 29410 }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGridCell"], { 29411 className: "block-editor-block-navigation-appender__cell", 29412 colSpan: "3" 29413 }, ({ 29414 ref, 29415 tabIndex, 29416 onFocus 29417 }) => Object(external_wp_element_["createElement"])("div", { 29418 className: "block-editor-block-navigation-appender__container" 29419 }, Object(external_wp_element_["createElement"])(inserter, { 29420 rootClientId: parentBlockClientId, 29421 __experimentalIsQuick: true, 29422 "aria-describedby": descriptionId, 29423 toggleProps: { 29424 ref, 29425 tabIndex, 29426 onFocus 29427 } 29428 }), Object(external_wp_element_["createElement"])("div", { 29429 className: "block-editor-block-navigation-appender__description", 29430 id: descriptionId 29431 }, appenderPositionDescription)))); 29432 } 29433 29434 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/branch.js 29435 29436 29437 /** 29438 * External dependencies 29439 */ 29440 29441 /** 29442 * WordPress dependencies 29443 */ 29444 29445 29446 /** 29447 * Internal dependencies 29448 */ 29449 29450 29451 29452 29453 function BlockNavigationBranch(props) { 29454 const { 29455 blocks, 29456 selectBlock, 29457 selectedBlockClientIds, 29458 showAppender, 29459 showBlockMovers, 29460 showNestedBlocks, 29461 parentBlockClientId, 29462 level = 1, 29463 terminatedLevels = [], 29464 path = [], 29465 isBranchSelected = false, 29466 isLastOfBranch = false 29467 } = props; 29468 const isTreeRoot = !parentBlockClientId; 29469 const filteredBlocks = Object(external_lodash_["compact"])(blocks); 29470 29471 const itemHasAppender = parentClientId => showAppender && !isTreeRoot && isClientIdSelected(parentClientId, selectedBlockClientIds); 29472 29473 const hasAppender = itemHasAppender(parentBlockClientId); // Add +1 to the rowCount to take the block appender into account. 29474 29475 const blockCount = filteredBlocks.length; 29476 const rowCount = hasAppender ? blockCount + 1 : blockCount; 29477 const appenderPosition = rowCount; 29478 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_lodash_["map"])(filteredBlocks, (block, index) => { 29479 const { 29480 clientId, 29481 innerBlocks 29482 } = block; 29483 const position = index + 1; 29484 const isLastRowAtLevel = rowCount === position; 29485 const updatedTerminatedLevels = isLastRowAtLevel ? [...terminatedLevels, level] : terminatedLevels; 29486 const updatedPath = [...path, position]; 29487 const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length; 29488 const hasNestedAppender = itemHasAppender(clientId); 29489 const hasNestedBranch = hasNestedBlocks || hasNestedAppender; 29490 const isSelected = isClientIdSelected(clientId, selectedBlockClientIds); 29491 const isSelectedBranch = isBranchSelected || isSelected && hasNestedBranch; // Logic needed to target the last item of a selected branch which might be deeply nested. 29492 // This is currently only needed for styling purposes. See: `.is-last-of-selected-branch`. 29493 29494 const isLastBlock = index === blockCount - 1; 29495 const isLast = isSelected || isLastOfBranch && isLastBlock; 29496 const isLastOfSelectedBranch = isLastOfBranch && !hasNestedBranch && isLastBlock; 29497 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { 29498 key: clientId 29499 }, Object(external_wp_element_["createElement"])(BlockNavigationBlock, { 29500 block: block, 29501 onClick: selectBlock, 29502 isSelected: isSelected, 29503 isBranchSelected: isSelectedBranch, 29504 isLastOfSelectedBranch: isLastOfSelectedBranch, 29505 level: level, 29506 position: position, 29507 rowCount: rowCount, 29508 siblingBlockCount: blockCount, 29509 showBlockMovers: showBlockMovers, 29510 terminatedLevels: terminatedLevels, 29511 path: updatedPath 29512 }), hasNestedBranch && Object(external_wp_element_["createElement"])(BlockNavigationBranch, { 29513 blocks: innerBlocks, 29514 selectedBlockClientIds: selectedBlockClientIds, 29515 selectBlock: selectBlock, 29516 isBranchSelected: isSelectedBranch, 29517 isLastOfBranch: isLast, 29518 showAppender: showAppender, 29519 showBlockMovers: showBlockMovers, 29520 showNestedBlocks: showNestedBlocks, 29521 parentBlockClientId: clientId, 29522 level: level + 1, 29523 terminatedLevels: updatedTerminatedLevels, 29524 path: updatedPath 29525 })); 29526 }), hasAppender && Object(external_wp_element_["createElement"])(BlockNavigationAppender, { 29527 parentBlockClientId: parentBlockClientId, 29528 position: rowCount, 29529 rowCount: appenderPosition, 29530 level: level, 29531 terminatedLevels: terminatedLevels, 29532 path: [...path, appenderPosition] 29533 })); 29534 } 29535 BlockNavigationBranch.defaultProps = { 29536 selectBlock: () => {} 29537 }; 29538 29539 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/use-block-navigation-client-ids.js 29540 /** 29541 * WordPress dependencies 29542 */ 29543 29544 /** 29545 * Internal dependencies 29546 */ 29547 29548 29549 29550 29551 const useBlockNavigationSelectedClientIds = __experimentalPersistentListViewFeatures => Object(external_wp_data_["useSelect"])(select => { 29552 const { 29553 getSelectedBlockClientId, 29554 getSelectedBlockClientIds 29555 } = select(store); 29556 29557 if (__experimentalPersistentListViewFeatures) { 29558 return getSelectedBlockClientIds(); 29559 } 29560 29561 return getSelectedBlockClientId(); 29562 }, [__experimentalPersistentListViewFeatures]); 29563 29564 const useBlockNavigationClientIdsTree = (blocks, selectedClientIds, showOnlyCurrentHierarchy) => Object(external_wp_data_["useSelect"])(select => { 29565 const { 29566 getBlockHierarchyRootClientId, 29567 __unstableGetClientIdsTree, 29568 __unstableGetClientIdWithClientIdsTree 29569 } = select(store); 29570 29571 if (blocks) { 29572 return blocks; 29573 } 29574 29575 const isSingleBlockSelected = selectedClientIds && !Array.isArray(selectedClientIds); 29576 29577 if (!showOnlyCurrentHierarchy || !isSingleBlockSelected) { 29578 return __unstableGetClientIdsTree(); 29579 } 29580 29581 const rootBlock = __unstableGetClientIdWithClientIdsTree(getBlockHierarchyRootClientId(selectedClientIds)); 29582 29583 if (!rootBlock) { 29584 return __unstableGetClientIdsTree(); 29585 } 29586 29587 const hasHierarchy = !isClientIdSelected(rootBlock.clientId, selectedClientIds) || rootBlock.innerBlocks && rootBlock.innerBlocks.length !== 0; 29588 29589 if (hasHierarchy) { 29590 return [rootBlock]; 29591 } 29592 29593 return __unstableGetClientIdsTree(); 29594 }, [blocks, selectedClientIds, showOnlyCurrentHierarchy]); 29595 29596 function useBlockNavigationClientIds(blocks, showOnlyCurrentHierarchy, __experimentalPersistentListViewFeatures) { 29597 const selectedClientIds = useBlockNavigationSelectedClientIds(__experimentalPersistentListViewFeatures); 29598 const clientIdsTree = useBlockNavigationClientIdsTree(blocks, selectedClientIds, showOnlyCurrentHierarchy); 29599 return { 29600 clientIdsTree, 29601 selectedClientIds 29602 }; 29603 } 29604 29605 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/use-block-navigation-drop-zone.js 29606 /** 29607 * WordPress dependencies 29608 */ 29609 29610 29611 29612 /** 29613 * Internal dependencies 29614 */ 29615 29616 29617 29618 29619 /** @typedef {import('../../utils/math').WPPoint} WPPoint */ 29620 29621 /** 29622 * The type of a drag event. 29623 * 29624 * @typedef {'default'|'file'|'html'} WPDragEventType 29625 */ 29626 29627 /** 29628 * An array representing data for blocks in the DOM used by drag and drop. 29629 * 29630 * @typedef {Object} WPBlockNavigationDropZoneBlocks 29631 * @property {string} clientId The client id for the block. 29632 * @property {string} rootClientId The root client id for the block. 29633 * @property {number} blockIndex The block's index. 29634 * @property {Element} element The DOM element representing the block. 29635 * @property {number} innerBlockCount The number of inner blocks the block has. 29636 * @property {boolean} isDraggedBlock Whether the block is currently being dragged. 29637 * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block. 29638 * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block. 29639 */ 29640 29641 /** 29642 * An object containing details of a drop target. 29643 * 29644 * @typedef {Object} WPBlockNavigationDropZoneTarget 29645 * @property {string} blockIndex The insertion index. 29646 * @property {string} rootClientId The root client id for the block. 29647 * @property {string|undefined} clientId The client id for the block. 29648 * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to. 29649 * 'inside' refers to nesting as an inner block. 29650 */ 29651 29652 /** 29653 * Is the point contained by the rectangle. 29654 * 29655 * @param {WPPoint} point The point. 29656 * @param {DOMRect} rect The rectangle. 29657 * 29658 * @return {boolean} True if the point is contained by the rectangle, false otherwise. 29659 */ 29660 29661 function isPointContainedByRect(point, rect) { 29662 return rect.left <= point.x && rect.right >= point.x && rect.top <= point.y && rect.bottom >= point.y; 29663 } 29664 /** 29665 * Determines whether the user positioning the dragged block to nest as an 29666 * inner block. 29667 * 29668 * Presently this is determined by whether the cursor is on the right hand side 29669 * of the block. 29670 * 29671 * @param {WPPoint} point The point representing the cursor position when dragging. 29672 * @param {DOMRect} rect The rectangle. 29673 */ 29674 29675 29676 function isNestingGesture(point, rect) { 29677 const blockCenterX = rect.left + rect.width / 2; 29678 return point.x > blockCenterX; 29679 } // Block navigation is always a vertical list, so only allow dropping 29680 // to the above or below a block. 29681 29682 29683 const ALLOWED_DROP_EDGES = ['top', 'bottom']; 29684 /** 29685 * Given blocks data and the cursor position, compute the drop target. 29686 * 29687 * @param {WPBlockNavigationDropZoneBlocks} blocksData Data about the blocks in block navigation. 29688 * @param {WPPoint} position The point representing the cursor position when dragging. 29689 * 29690 * @return {WPBlockNavigationDropZoneTarget} An object containing data about the drop target. 29691 */ 29692 29693 function getBlockNavigationDropTarget(blocksData, position) { 29694 let candidateEdge; 29695 let candidateBlockData; 29696 let candidateDistance; 29697 let candidateRect; 29698 29699 for (const blockData of blocksData) { 29700 if (blockData.isDraggedBlock) { 29701 continue; 29702 } 29703 29704 const rect = blockData.element.getBoundingClientRect(); 29705 const [distance, edge] = getDistanceToNearestEdge(position, rect, ALLOWED_DROP_EDGES); 29706 const isCursorWithinBlock = isPointContainedByRect(position, rect); 29707 29708 if (candidateDistance === undefined || distance < candidateDistance || isCursorWithinBlock) { 29709 candidateDistance = distance; 29710 const index = blocksData.indexOf(blockData); 29711 const previousBlockData = blocksData[index - 1]; // If dragging near the top of a block and the preceding block 29712 // is at the same level, use the preceding block as the candidate 29713 // instead, as later it makes determining a nesting drop easier. 29714 29715 if (edge === 'top' && previousBlockData && previousBlockData.rootClientId === blockData.rootClientId && !previousBlockData.isDraggedBlock) { 29716 candidateBlockData = previousBlockData; 29717 candidateEdge = 'bottom'; 29718 candidateRect = previousBlockData.element.getBoundingClientRect(); 29719 } else { 29720 candidateBlockData = blockData; 29721 candidateEdge = edge; 29722 candidateRect = rect; 29723 } // If the mouse position is within the block, break early 29724 // as the user would intend to drop either before or after 29725 // this block. 29726 // 29727 // This solves an issue where some rows in the block navigation 29728 // tree overlap slightly due to sub-pixel rendering. 29729 29730 29731 if (isCursorWithinBlock) { 29732 break; 29733 } 29734 } 29735 } 29736 29737 if (!candidateBlockData) { 29738 return; 29739 } 29740 29741 const isDraggingBelow = candidateEdge === 'bottom'; // If the user is dragging towards the bottom of the block check whether 29742 // they might be trying to nest the block as a child. 29743 // If the block already has inner blocks, this should always be treated 29744 // as nesting since the next block in the tree will be the first child. 29745 29746 if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 || isNestingGesture(position, candidateRect))) { 29747 return { 29748 rootClientId: candidateBlockData.clientId, 29749 blockIndex: 0, 29750 dropPosition: 'inside' 29751 }; 29752 } // If dropping as a sibling, but block cannot be inserted in 29753 // this context, return early. 29754 29755 29756 if (!candidateBlockData.canInsertDraggedBlocksAsSibling) { 29757 return; 29758 } 29759 29760 const offset = isDraggingBelow ? 1 : 0; 29761 return { 29762 rootClientId: candidateBlockData.rootClientId, 29763 clientId: candidateBlockData.clientId, 29764 blockIndex: candidateBlockData.blockIndex + offset, 29765 dropPosition: candidateEdge 29766 }; 29767 } 29768 /** 29769 * A react hook for implementing a drop zone in block navigation. 29770 * 29771 * @return {WPBlockNavigationDropZoneTarget} The drop target. 29772 */ 29773 29774 29775 function useBlockNavigationDropZone() { 29776 const { 29777 getBlockRootClientId, 29778 getBlockIndex, 29779 getBlockCount, 29780 getDraggedBlockClientIds, 29781 canInsertBlocks 29782 } = Object(external_wp_data_["useSelect"])(store); 29783 const [target, setTarget] = Object(external_wp_element_["useState"])(); 29784 const { 29785 rootClientId: targetRootClientId, 29786 blockIndex: targetBlockIndex 29787 } = target || {}; 29788 const onBlockDrop = useOnBlockDrop(targetRootClientId, targetBlockIndex); 29789 const throttled = Object(external_wp_compose_["useThrottle"])(Object(external_wp_element_["useCallback"])((event, currentTarget) => { 29790 const position = { 29791 x: event.clientX, 29792 y: event.clientY 29793 }; 29794 const isBlockDrag = !!event.dataTransfer.getData('wp-blocks'); 29795 const draggedBlockClientIds = isBlockDrag ? getDraggedBlockClientIds() : undefined; 29796 const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]')); 29797 const blocksData = blockElements.map(blockElement => { 29798 const clientId = blockElement.dataset.block; 29799 const rootClientId = getBlockRootClientId(clientId); 29800 return { 29801 clientId, 29802 rootClientId, 29803 blockIndex: getBlockIndex(clientId, rootClientId), 29804 element: blockElement, 29805 isDraggedBlock: isBlockDrag ? draggedBlockClientIds.includes(clientId) : false, 29806 innerBlockCount: getBlockCount(clientId), 29807 canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true, 29808 canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true 29809 }; 29810 }); 29811 const newTarget = getBlockNavigationDropTarget(blocksData, position); 29812 29813 if (newTarget) { 29814 setTarget(newTarget); 29815 } 29816 }, []), 200); 29817 const ref = Object(external_wp_compose_["__experimentalUseDropZone"])({ 29818 onDrop: onBlockDrop, 29819 29820 onDragOver(event) { 29821 // `currentTarget` is only available while the event is being 29822 // handled, so get it now and pass it to the thottled function. 29823 // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget 29824 throttled(event, event.currentTarget); 29825 }, 29826 29827 onDragEnd() { 29828 throttled.cancel(); 29829 setTarget(null); 29830 } 29831 29832 }); 29833 return { 29834 ref, 29835 target 29836 }; 29837 } 29838 29839 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/tree.js 29840 29841 29842 29843 /** 29844 * WordPress dependencies 29845 */ 29846 29847 29848 29849 29850 /** 29851 * Internal dependencies 29852 */ 29853 29854 29855 29856 29857 29858 29859 29860 const noop = () => {}; 29861 /** 29862 * Wrap `BlockNavigationRows` with `TreeGrid`. BlockNavigationRows is a 29863 * recursive component (it renders itself), so this ensures TreeGrid is only 29864 * present at the very top of the navigation grid. 29865 * 29866 * @param {Object} props Components props. 29867 * @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy. 29868 * @param {Function} props.onSelect Block selection callback. 29869 * @param {boolean} props.showNestedBlocks Flag to enable displaying nested blocks. 29870 * @param {boolean} props.showOnlyCurrentHierarchy Flag to limit the list to the current hierarchy of blocks. 29871 * @param {boolean} props.__experimentalFeatures Flag to enable experimental features. 29872 * @param {boolean} props.__experimentalPersistentListViewFeatures Flag to enable features for the Persistent List View experiment. 29873 */ 29874 29875 29876 function BlockNavigationTree({ 29877 blocks, 29878 showOnlyCurrentHierarchy, 29879 onSelect = noop, 29880 __experimentalFeatures, 29881 __experimentalPersistentListViewFeatures, 29882 ...props 29883 }) { 29884 const { 29885 clientIdsTree, 29886 selectedClientIds 29887 } = useBlockNavigationClientIds(blocks, showOnlyCurrentHierarchy, __experimentalPersistentListViewFeatures); 29888 const { 29889 selectBlock 29890 } = Object(external_wp_data_["useDispatch"])(store); 29891 const selectEditorBlock = Object(external_wp_element_["useCallback"])(clientId => { 29892 selectBlock(clientId); 29893 onSelect(clientId); 29894 }, [selectBlock, onSelect]); 29895 let { 29896 ref: treeGridRef, 29897 target: blockDropTarget 29898 } = useBlockNavigationDropZone(); 29899 const isMounted = Object(external_wp_element_["useRef"])(false); 29900 Object(external_wp_element_["useEffect"])(() => { 29901 isMounted.current = true; 29902 }, []); 29903 29904 if (!__experimentalFeatures) { 29905 blockDropTarget = undefined; 29906 } 29907 29908 const contextValue = Object(external_wp_element_["useMemo"])(() => ({ 29909 __experimentalFeatures, 29910 __experimentalPersistentListViewFeatures, 29911 blockDropTarget, 29912 isTreeGridMounted: isMounted.current 29913 }), [__experimentalFeatures, __experimentalPersistentListViewFeatures, blockDropTarget, isMounted.current]); 29914 return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalTreeGrid"], { 29915 className: "block-editor-block-navigation-tree", 29916 "aria-label": Object(external_wp_i18n_["__"])('Block navigation structure'), 29917 ref: treeGridRef 29918 }, Object(external_wp_element_["createElement"])(BlockNavigationContext.Provider, { 29919 value: contextValue 29920 }, Object(external_wp_element_["createElement"])(BlockNavigationBranch, Object(esm_extends["a" /* default */])({ 29921 blocks: clientIdsTree, 29922 selectBlock: selectEditorBlock, 29923 selectedBlockClientIds: selectedClientIds 29924 }, props)))); 29925 } 29926 29927 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js 29928 29929 29930 29931 /** 29932 * WordPress dependencies 29933 */ 29934 29935 29936 29937 29938 29939 /** 29940 * Internal dependencies 29941 */ 29942 29943 29944 29945 29946 function BlockNavigationDropdownToggle({ 29947 isEnabled, 29948 onToggle, 29949 isOpen, 29950 innerRef, 29951 ...props 29952 }) { 29953 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { 29954 ref: innerRef, 29955 icon: list_view["a" /* default */], 29956 "aria-expanded": isOpen, 29957 "aria-haspopup": "true", 29958 onClick: isEnabled ? onToggle : undefined 29959 /* translators: button label text should, if possible, be under 16 characters. */ 29960 , 29961 label: Object(external_wp_i18n_["__"])('List view'), 29962 className: "block-editor-block-navigation", 29963 "aria-disabled": !isEnabled 29964 })); 29965 } 29966 29967 function BlockNavigationDropdown({ 29968 isDisabled, 29969 __experimentalFeatures, 29970 ...props 29971 }, ref) { 29972 const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(store).getBlockCount(), []); 29973 const isEnabled = hasBlocks && !isDisabled; 29974 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 29975 contentClassName: "block-editor-block-navigation__popover", 29976 position: "bottom right", 29977 renderToggle: ({ 29978 isOpen, 29979 onToggle 29980 }) => Object(external_wp_element_["createElement"])(BlockNavigationDropdownToggle, Object(esm_extends["a" /* default */])({}, props, { 29981 innerRef: ref, 29982 isOpen: isOpen, 29983 onToggle: onToggle, 29984 isEnabled: isEnabled 29985 })), 29986 renderContent: () => Object(external_wp_element_["createElement"])("div", { 29987 className: "block-editor-block-navigation__container" 29988 }, Object(external_wp_element_["createElement"])("p", { 29989 className: "block-editor-block-navigation__label" 29990 }, Object(external_wp_i18n_["__"])('List view')), Object(external_wp_element_["createElement"])(BlockNavigationTree, { 29991 showNestedBlocks: true, 29992 showOnlyCurrentHierarchy: true, 29993 __experimentalFeatures: __experimentalFeatures 29994 })) 29995 }); 29996 } 29997 29998 /* harmony default export */ var dropdown = (Object(external_wp_element_["forwardRef"])(BlockNavigationDropdown)); 29999 30000 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/remove-browser-shortcuts.js 30001 30002 30003 /** 30004 * External dependencies 30005 */ 30006 30007 /** 30008 * WordPress dependencies 30009 */ 30010 30011 30012 30013 /** 30014 * Set of keyboard shortcuts handled internally by RichText. 30015 * 30016 * @type {Array} 30017 */ 30018 30019 const HANDLED_SHORTCUTS = [external_wp_keycodes_["rawShortcut"].primary('z'), external_wp_keycodes_["rawShortcut"].primaryShift('z'), external_wp_keycodes_["rawShortcut"].primary('y')]; 30020 /** 30021 * An instance of a KeyboardShortcuts element pre-bound for the handled 30022 * shortcuts. Since shortcuts never change, the element can be considered 30023 * static, and can be skipped in reconciliation. 30024 * 30025 * @type {WPElement} 30026 */ 30027 30028 const SHORTCUTS_ELEMENT = Object(external_wp_element_["createElement"])(external_wp_components_["KeyboardShortcuts"], { 30029 bindGlobal: true, 30030 shortcuts: Object(external_lodash_["fromPairs"])(HANDLED_SHORTCUTS.map(shortcut => { 30031 return [shortcut, event => event.preventDefault()]; 30032 })) 30033 }); 30034 /** 30035 * Component which registered keyboard event handlers to prevent default 30036 * behaviors for key combinations otherwise handled internally by RichText. 30037 * 30038 * @return {WPComponent} The component to be rendered. 30039 */ 30040 30041 const RemoveBrowserShortcuts = () => SHORTCUTS_ELEMENT; 30042 30043 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js 30044 30045 30046 /** 30047 * External dependencies 30048 */ 30049 30050 /** 30051 * WordPress dependencies 30052 */ 30053 30054 30055 30056 30057 const format_toolbar_POPOVER_PROPS = { 30058 position: 'bottom right', 30059 isAlternate: true 30060 }; 30061 30062 const FormatToolbar = () => { 30063 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, ['bold', 'italic', 'link', 'text-color'].map(format => Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { 30064 name: `RichText.ToolbarControls.${format}`, 30065 key: format 30066 })), Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { 30067 name: "RichText.ToolbarControls" 30068 }, fills => fills.length !== 0 && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { 30069 icon: chevron_down["a" /* default */] 30070 /* translators: button label text should, if possible, be under 16 characters. */ 30071 , 30072 label: Object(external_wp_i18n_["__"])('More'), 30073 toggleProps: toggleProps, 30074 controls: Object(external_lodash_["orderBy"])(fills.map(([{ 30075 props 30076 }]) => props), 'title'), 30077 popoverProps: format_toolbar_POPOVER_PROPS 30078 })))); 30079 }; 30080 30081 /* harmony default export */ var format_toolbar = (FormatToolbar); 30082 30083 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js 30084 30085 30086 /** 30087 * WordPress dependencies 30088 */ 30089 30090 /** 30091 * Internal dependencies 30092 */ 30093 30094 30095 30096 30097 const FormatToolbarContainer = ({ 30098 inline, 30099 anchorRef 30100 }) => { 30101 if (inline) { 30102 // Render in popover 30103 return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 30104 noArrow: true, 30105 position: "top center", 30106 focusOnMount: false, 30107 anchorRef: anchorRef, 30108 className: "block-editor-rich-text__inline-format-toolbar", 30109 __unstableSlotName: "block-toolbar" 30110 }, Object(external_wp_element_["createElement"])("div", { 30111 className: "block-editor-rich-text__inline-format-toolbar-group" 30112 }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(format_toolbar, null)))); 30113 } // Render regular toolbar 30114 30115 30116 return Object(external_wp_element_["createElement"])(block_controls, { 30117 group: "inline" 30118 }, Object(external_wp_element_["createElement"])(format_toolbar, null)); 30119 }; 30120 30121 /* harmony default export */ var format_toolbar_container = (FormatToolbarContainer); 30122 30123 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-undo-automatic-change.js 30124 /** 30125 * WordPress dependencies 30126 */ 30127 30128 30129 30130 /** 30131 * Internal dependencies 30132 */ 30133 30134 30135 function useUndoAutomaticChange() { 30136 const { 30137 didAutomaticChange, 30138 getSettings 30139 } = Object(external_wp_data_["useSelect"])(store); 30140 return Object(external_wp_compose_["useRefEffect"])(element => { 30141 function onKeyDown(event) { 30142 const { 30143 keyCode 30144 } = event; 30145 30146 if (keyCode !== external_wp_keycodes_["DELETE"] && keyCode !== external_wp_keycodes_["BACKSPACE"] && keyCode !== external_wp_keycodes_["ESCAPE"]) { 30147 return; 30148 } 30149 30150 if (!didAutomaticChange()) { 30151 return; 30152 } 30153 30154 event.preventDefault(); 30155 30156 getSettings().__experimentalUndo(); 30157 } 30158 30159 element.addEventListener('keydown', onKeyDown); 30160 return () => { 30161 element.removeEventListener('keydown', onKeyDown); 30162 }; 30163 }, []); 30164 } 30165 30166 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-caret-in-format.js 30167 /** 30168 * WordPress dependencies 30169 */ 30170 30171 30172 /** 30173 * Internal dependencies 30174 */ 30175 30176 30177 function useCaretInFormat({ 30178 value 30179 }) { 30180 const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; 30181 const { 30182 isCaretWithinFormattedText 30183 } = Object(external_wp_data_["useSelect"])(store); 30184 const { 30185 enterFormattedText, 30186 exitFormattedText 30187 } = Object(external_wp_data_["useDispatch"])(store); 30188 Object(external_wp_element_["useEffect"])(() => { 30189 if (hasActiveFormats) { 30190 if (!isCaretWithinFormattedText()) { 30191 enterFormattedText(); 30192 } 30193 } else if (isCaretWithinFormattedText()) { 30194 exitFormattedText(); 30195 } 30196 }, [hasActiveFormats]); 30197 } 30198 30199 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-mark-persistent.js 30200 /** 30201 * WordPress dependencies 30202 */ 30203 30204 30205 /** 30206 * Internal dependencies 30207 */ 30208 30209 30210 function useMarkPersistent({ 30211 html, 30212 value 30213 }) { 30214 const previousText = Object(external_wp_element_["useRef"])(); 30215 const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; 30216 const { 30217 __unstableMarkLastChangeAsPersistent 30218 } = Object(external_wp_data_["useDispatch"])(store); // Must be set synchronously to make sure it applies to the last change. 30219 30220 Object(external_wp_element_["useLayoutEffect"])(() => { 30221 // Ignore mount. 30222 if (!previousText.current) { 30223 previousText.current = value.text; 30224 return; 30225 } // Text input, so don't create an undo level for every character. 30226 // Create an undo level after 1 second of no input. 30227 30228 30229 if (previousText.current !== value.text) { 30230 const timeout = window.setTimeout(() => { 30231 __unstableMarkLastChangeAsPersistent(); 30232 }, 1000); 30233 previousText.current = value.text; 30234 return () => { 30235 window.clearTimeout(timeout); 30236 }; 30237 } 30238 30239 __unstableMarkLastChangeAsPersistent(); 30240 }, [html, hasActiveFormats]); 30241 } 30242 30243 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/file-paste-handler.js 30244 /** 30245 * WordPress dependencies 30246 */ 30247 30248 function filePasteHandler(files) { 30249 return files.filter(({ 30250 type 30251 }) => /^image\/(?:jpe?g|png|gif)$/.test(type)).map(file => `<img src="${Object(external_wp_blob_["createBlobURL"])(file)}">`).join(''); 30252 } 30253 30254 // EXTERNAL MODULE: external ["wp","shortcode"] 30255 var external_wp_shortcode_ = __webpack_require__("SVSp"); 30256 30257 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/utils.js 30258 /** 30259 * WordPress dependencies 30260 */ 30261 30262 30263 function addActiveFormats(value, activeFormats) { 30264 if (activeFormats !== null && activeFormats !== void 0 && activeFormats.length) { 30265 let index = value.formats.length; 30266 30267 while (index--) { 30268 value.formats[index] = [...activeFormats, ...(value.formats[index] || [])]; 30269 } 30270 } 30271 } 30272 /** 30273 * Get the multiline tag based on the multiline prop. 30274 * 30275 * @param {?(string|boolean)} multiline The multiline prop. 30276 * 30277 * @return {?string} The multiline tag. 30278 */ 30279 30280 function getMultilineTag(multiline) { 30281 if (multiline !== true && multiline !== 'p' && multiline !== 'li') { 30282 return; 30283 } 30284 30285 return multiline === true ? 'p' : multiline; 30286 } 30287 function getAllowedFormats({ 30288 allowedFormats, 30289 formattingControls, 30290 disableFormats 30291 }) { 30292 if (disableFormats) { 30293 return getAllowedFormats.EMPTY_ARRAY; 30294 } 30295 30296 if (!allowedFormats && !formattingControls) { 30297 return; 30298 } 30299 30300 if (allowedFormats) { 30301 return allowedFormats; 30302 } 30303 30304 external_wp_deprecated_default()('wp.blockEditor.RichText formattingControls prop', { 30305 since: '5.4', 30306 alternative: 'allowedFormats' 30307 }); 30308 return formattingControls.map(name => `core/${name}`); 30309 } 30310 getAllowedFormats.EMPTY_ARRAY = []; 30311 const isShortcode = text => Object(external_wp_shortcode_["regexp"])('.*').test(text); 30312 30313 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/split-value.js 30314 /** 30315 * WordPress dependencies 30316 */ 30317 30318 /* 30319 * Signals to the RichText owner that the block can be replaced with two blocks 30320 * as a result of splitting the block by pressing enter, or with blocks as a 30321 * result of splitting the block by pasting block content in the instance. 30322 */ 30323 30324 function splitValue({ 30325 value, 30326 pastedBlocks = [], 30327 onReplace, 30328 onSplit, 30329 onSplitMiddle, 30330 multilineTag 30331 }) { 30332 if (!onReplace || !onSplit) { 30333 return; 30334 } 30335 30336 const blocks = []; 30337 const [before, after] = Object(external_wp_richText_["split"])(value); 30338 const hasPastedBlocks = pastedBlocks.length > 0; 30339 let lastPastedBlockIndex = -1; // Consider the after value to be the original it is not empty and the 30340 // before value *is* empty. 30341 30342 const isAfterOriginal = Object(external_wp_richText_["isEmpty"])(before) && !Object(external_wp_richText_["isEmpty"])(after); // Create a block with the content before the caret if there's no pasted 30343 // blocks, or if there are pasted blocks and the value is not empty. We do 30344 // not want a leading empty block on paste, but we do if split with e.g. the 30345 // enter key. 30346 30347 if (!hasPastedBlocks || !Object(external_wp_richText_["isEmpty"])(before)) { 30348 blocks.push(onSplit(Object(external_wp_richText_["toHTMLString"])({ 30349 value: before, 30350 multilineTag 30351 }), !isAfterOriginal)); 30352 lastPastedBlockIndex += 1; 30353 } 30354 30355 if (hasPastedBlocks) { 30356 blocks.push(...pastedBlocks); 30357 lastPastedBlockIndex += pastedBlocks.length; 30358 } else if (onSplitMiddle) { 30359 blocks.push(onSplitMiddle()); 30360 } // If there's pasted blocks, append a block with non empty content / after 30361 // the caret. Otherwise, do append an empty block if there is no 30362 // `onSplitMiddle` prop, but if there is and the content is empty, the 30363 // middle block is enough to set focus in. 30364 30365 30366 if (hasPastedBlocks ? !Object(external_wp_richText_["isEmpty"])(after) : !onSplitMiddle || !Object(external_wp_richText_["isEmpty"])(after)) { 30367 blocks.push(onSplit(Object(external_wp_richText_["toHTMLString"])({ 30368 value: after, 30369 multilineTag 30370 }), isAfterOriginal)); 30371 } // If there are pasted blocks, set the selection to the last one. Otherwise, 30372 // set the selection to the second block. 30373 30374 30375 const indexToSelect = hasPastedBlocks ? lastPastedBlockIndex : 1; // If there are pasted blocks, move the caret to the end of the selected 30376 // block Otherwise, retain the default value. 30377 30378 const initialPosition = hasPastedBlocks ? -1 : 0; 30379 onReplace(blocks, indexToSelect, initialPosition); 30380 } 30381 30382 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-paste-handler.js 30383 /** 30384 * WordPress dependencies 30385 */ 30386 30387 30388 30389 30390 30391 30392 /** 30393 * Internal dependencies 30394 */ 30395 30396 30397 30398 30399 function usePasteHandler(props) { 30400 const propsRef = Object(external_wp_element_["useRef"])(props); 30401 propsRef.current = props; 30402 return Object(external_wp_compose_["useRefEffect"])(element => { 30403 function _onPaste(event) { 30404 const { 30405 isSelected, 30406 disableFormats, 30407 onChange, 30408 value, 30409 formatTypes, 30410 tagName, 30411 onReplace, 30412 onSplit, 30413 onSplitMiddle, 30414 __unstableEmbedURLOnPaste, 30415 multilineTag, 30416 preserveWhiteSpace, 30417 pastePlainText 30418 } = propsRef.current; 30419 30420 if (!isSelected) { 30421 event.preventDefault(); 30422 return; 30423 } 30424 30425 const { 30426 clipboardData 30427 } = event; 30428 let plainText = ''; 30429 let html = ''; // IE11 only supports `Text` as an argument for `getData` and will 30430 // otherwise throw an invalid argument error, so we try the standard 30431 // arguments first, then fallback to `Text` if they fail. 30432 30433 try { 30434 plainText = clipboardData.getData('text/plain'); 30435 html = clipboardData.getData('text/html'); 30436 } catch (error1) { 30437 try { 30438 html = clipboardData.getData('Text'); 30439 } catch (error2) { 30440 // Some browsers like UC Browser paste plain text by default and 30441 // don't support clipboardData at all, so allow default 30442 // behaviour. 30443 return; 30444 } 30445 } 30446 30447 event.preventDefault(); // Allows us to ask for this information when we get a report. 30448 30449 window.console.log('Received HTML:\n\n', html); 30450 window.console.log('Received plain text:\n\n', plainText); 30451 30452 if (disableFormats) { 30453 onChange(Object(external_wp_richText_["insert"])(value, plainText)); 30454 return; 30455 } 30456 30457 const transformed = formatTypes.reduce((accumlator, { 30458 __unstablePasteRule 30459 }) => { 30460 // Only allow one transform. 30461 if (__unstablePasteRule && accumlator === value) { 30462 accumlator = __unstablePasteRule(value, { 30463 html, 30464 plainText 30465 }); 30466 } 30467 30468 return accumlator; 30469 }, value); 30470 30471 if (transformed !== value) { 30472 onChange(transformed); 30473 return; 30474 } 30475 30476 const files = [...Object(external_wp_dom_["getFilesFromDataTransfer"])(clipboardData)]; 30477 const isInternal = clipboardData.getData('rich-text') === 'true'; // If the data comes from a rich text instance, we can directly use it 30478 // without filtering the data. The filters are only meant for externally 30479 // pasted content and remove inline styles. 30480 30481 if (isInternal) { 30482 const pastedValue = Object(external_wp_richText_["create"])({ 30483 html, 30484 multilineTag, 30485 multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined, 30486 preserveWhiteSpace 30487 }); 30488 addActiveFormats(pastedValue, value.activeFormats); 30489 onChange(Object(external_wp_richText_["insert"])(value, pastedValue)); 30490 return; 30491 } 30492 30493 if (pastePlainText) { 30494 onChange(Object(external_wp_richText_["insert"])(value, Object(external_wp_richText_["create"])({ 30495 text: plainText 30496 }))); 30497 return; 30498 } // Only process file if no HTML is present. 30499 // Note: a pasted file may have the URL as plain text. 30500 30501 30502 if (files && files.length && !html) { 30503 const content = Object(external_wp_blocks_["pasteHandler"])({ 30504 HTML: filePasteHandler(files), 30505 mode: 'BLOCKS', 30506 tagName, 30507 preserveWhiteSpace 30508 }); // Allows us to ask for this information when we get a report. 30509 // eslint-disable-next-line no-console 30510 30511 window.console.log('Received items:\n\n', files); 30512 30513 if (onReplace && Object(external_wp_richText_["isEmpty"])(value)) { 30514 onReplace(content); 30515 } else { 30516 splitValue({ 30517 value, 30518 pastedBlocks: content, 30519 onReplace, 30520 onSplit, 30521 onSplitMiddle, 30522 multilineTag 30523 }); 30524 } 30525 30526 return; 30527 } 30528 30529 let mode = onReplace && onSplit ? 'AUTO' : 'INLINE'; // Force the blocks mode when the user is pasting 30530 // on a new line & the content resembles a shortcode. 30531 // Otherwise it's going to be detected as inline 30532 // and the shortcode won't be replaced. 30533 30534 if (mode === 'AUTO' && Object(external_wp_richText_["isEmpty"])(value) && isShortcode(plainText)) { 30535 mode = 'BLOCKS'; 30536 } 30537 30538 if (__unstableEmbedURLOnPaste && Object(external_wp_richText_["isEmpty"])(value) && Object(external_wp_url_["isURL"])(plainText.trim())) { 30539 mode = 'BLOCKS'; 30540 } 30541 30542 const content = Object(external_wp_blocks_["pasteHandler"])({ 30543 HTML: html, 30544 plainText, 30545 mode, 30546 tagName, 30547 preserveWhiteSpace 30548 }); 30549 30550 if (typeof content === 'string') { 30551 let valueToInsert = Object(external_wp_richText_["create"])({ 30552 html: content 30553 }); 30554 addActiveFormats(valueToInsert, value.activeFormats); // If the content should be multiline, we should process text 30555 // separated by a line break as separate lines. 30556 30557 if (multilineTag) { 30558 valueToInsert = Object(external_wp_richText_["replace"])(valueToInsert, /\n+/g, external_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]); 30559 } 30560 30561 onChange(Object(external_wp_richText_["insert"])(value, valueToInsert)); 30562 } else if (content.length > 0) { 30563 if (onReplace && Object(external_wp_richText_["isEmpty"])(value)) { 30564 onReplace(content, content.length - 1, -1); 30565 } else { 30566 splitValue({ 30567 value, 30568 pastedBlocks: content, 30569 onReplace, 30570 onSplit, 30571 onSplitMiddle, 30572 multilineTag 30573 }); 30574 } 30575 } 30576 } 30577 30578 element.addEventListener('paste', _onPaste); 30579 return () => { 30580 element.removeEventListener('paste', _onPaste); 30581 }; 30582 }, []); 30583 } 30584 30585 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-input-rules.js 30586 /** 30587 * WordPress dependencies 30588 */ 30589 30590 30591 30592 30593 30594 /** 30595 * Internal dependencies 30596 */ 30597 30598 30599 function useInputRules(props) { 30600 const { 30601 __unstableMarkLastChangeAsPersistent, 30602 __unstableMarkAutomaticChange 30603 } = Object(external_wp_data_["useDispatch"])(store); 30604 const propsRef = Object(external_wp_element_["useRef"])(props); 30605 propsRef.current = props; 30606 return Object(external_wp_compose_["useRefEffect"])(element => { 30607 function inputRule() { 30608 const { 30609 value, 30610 onReplace 30611 } = propsRef.current; 30612 30613 if (!onReplace) { 30614 return; 30615 } 30616 30617 const { 30618 start, 30619 text 30620 } = value; 30621 const characterBefore = text.slice(start - 1, start); // The character right before the caret must be a plain space. 30622 30623 if (characterBefore !== ' ') { 30624 return; 30625 } 30626 30627 const trimmedTextBefore = text.slice(0, start).trim(); 30628 const prefixTransforms = Object(external_wp_blocks_["getBlockTransforms"])('from').filter(({ 30629 type 30630 }) => type === 'prefix'); 30631 const transformation = Object(external_wp_blocks_["findTransform"])(prefixTransforms, ({ 30632 prefix 30633 }) => { 30634 return trimmedTextBefore === prefix; 30635 }); 30636 30637 if (!transformation) { 30638 return; 30639 } 30640 30641 const content = Object(external_wp_richText_["toHTMLString"])({ 30642 value: Object(external_wp_richText_["slice"])(value, start, text.length) 30643 }); 30644 const block = transformation.transform(content); 30645 onReplace([block]); 30646 30647 __unstableMarkAutomaticChange(); 30648 } 30649 30650 function onInput(event) { 30651 const { 30652 inputType, 30653 type 30654 } = event; 30655 const { 30656 value, 30657 onChange, 30658 __unstableAllowPrefixTransformations, 30659 formatTypes 30660 } = propsRef.current; // Only run input rules when inserting text. 30661 30662 if (inputType !== 'insertText' && type !== 'compositionend') { 30663 return; 30664 } 30665 30666 if (__unstableAllowPrefixTransformations && inputRule) { 30667 inputRule(); 30668 } 30669 30670 const transformed = formatTypes.reduce((accumlator, { 30671 __unstableInputRule 30672 }) => { 30673 if (__unstableInputRule) { 30674 accumlator = __unstableInputRule(accumlator); 30675 } 30676 30677 return accumlator; 30678 }, value); 30679 30680 if (transformed !== value) { 30681 __unstableMarkLastChangeAsPersistent(); 30682 30683 onChange({ ...transformed, 30684 activeFormats: value.activeFormats 30685 }); 30686 30687 __unstableMarkAutomaticChange(); 30688 } 30689 } 30690 30691 element.addEventListener('input', onInput); 30692 element.addEventListener('compositionend', onInput); 30693 return () => { 30694 element.removeEventListener('input', onInput); 30695 element.removeEventListener('compositionend', onInput); 30696 }; 30697 }, []); 30698 } 30699 30700 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-enter.js 30701 /** 30702 * WordPress dependencies 30703 */ 30704 30705 /** 30706 * WordPress dependencies 30707 */ 30708 30709 30710 30711 30712 30713 30714 /** 30715 * Internal dependencies 30716 */ 30717 30718 30719 30720 function useEnter(props) { 30721 const { 30722 __unstableMarkAutomaticChange 30723 } = Object(external_wp_data_["useDispatch"])(store); 30724 const propsRef = Object(external_wp_element_["useRef"])(props); 30725 propsRef.current = props; 30726 return Object(external_wp_compose_["useRefEffect"])(element => { 30727 function onKeyDown(event) { 30728 if (event.defaultPrevented) { 30729 return; 30730 } 30731 30732 const { 30733 removeEditorOnlyFormats, 30734 value, 30735 onReplace, 30736 onSplit, 30737 onSplitMiddle, 30738 multilineTag, 30739 onChange, 30740 disableLineBreaks, 30741 onSplitAtEnd 30742 } = propsRef.current; 30743 30744 if (event.keyCode !== external_wp_keycodes_["ENTER"]) { 30745 return; 30746 } 30747 30748 event.preventDefault(); 30749 const _value = { ...value 30750 }; 30751 _value.formats = removeEditorOnlyFormats(value); 30752 const canSplit = onReplace && onSplit; 30753 30754 if (onReplace) { 30755 const transforms = Object(external_wp_blocks_["getBlockTransforms"])('from').filter(({ 30756 type 30757 }) => type === 'enter'); 30758 const transformation = Object(external_wp_blocks_["findTransform"])(transforms, item => { 30759 return item.regExp.test(_value.text); 30760 }); 30761 30762 if (transformation) { 30763 onReplace([transformation.transform({ 30764 content: _value.text 30765 })]); 30766 30767 __unstableMarkAutomaticChange(); 30768 } 30769 } 30770 30771 if (multilineTag) { 30772 if (event.shiftKey) { 30773 if (!disableLineBreaks) { 30774 onChange(Object(external_wp_richText_["insert"])(_value, '\n')); 30775 } 30776 } else if (canSplit && Object(external_wp_richText_["__unstableIsEmptyLine"])(_value)) { 30777 splitValue({ 30778 value: _value, 30779 onReplace, 30780 onSplit, 30781 onSplitMiddle, 30782 multilineTag 30783 }); 30784 } else { 30785 onChange(Object(external_wp_richText_["__unstableInsertLineSeparator"])(_value)); 30786 } 30787 } else { 30788 const { 30789 text, 30790 start, 30791 end 30792 } = _value; 30793 const canSplitAtEnd = onSplitAtEnd && start === end && end === text.length; 30794 30795 if (event.shiftKey || !canSplit && !canSplitAtEnd) { 30796 if (!disableLineBreaks) { 30797 onChange(Object(external_wp_richText_["insert"])(_value, '\n')); 30798 } 30799 } else if (!canSplit && canSplitAtEnd) { 30800 onSplitAtEnd(); 30801 } else if (canSplit) { 30802 splitValue({ 30803 value: _value, 30804 onReplace, 30805 onSplit, 30806 onSplitMiddle, 30807 multilineTag 30808 }); 30809 } 30810 } 30811 } 30812 30813 element.addEventListener('keydown', onKeyDown); 30814 return () => { 30815 element.removeEventListener('keydown', onKeyDown); 30816 }; 30817 }, []); 30818 } 30819 30820 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-format-types.js 30821 /** 30822 * WordPress dependencies 30823 */ 30824 30825 30826 /** 30827 * Internal dependencies 30828 */ 30829 30830 30831 30832 function formatTypesSelector(select) { 30833 return select(external_wp_richText_["store"]).getFormatTypes(); 30834 } 30835 /** 30836 * Set of all interactive content tags. 30837 * 30838 * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content 30839 */ 30840 30841 30842 const interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']); 30843 /** 30844 * This hook provides RichText with the `formatTypes` and its derived props from 30845 * experimental format type settings. 30846 * 30847 * @param {Object} $0 Options 30848 * @param {string} $0.clientId Block client ID. 30849 * @param {string} $0.identifier Block attribute. 30850 * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formattings or not. 30851 * @param {Array} $0.allowedFormats Allowed formats 30852 */ 30853 30854 function useFormatTypes({ 30855 clientId, 30856 identifier, 30857 withoutInteractiveFormatting, 30858 allowedFormats 30859 }) { 30860 const allFormatTypes = Object(external_wp_data_["useSelect"])(formatTypesSelector, []); 30861 const formatTypes = Object(external_wp_element_["useMemo"])(() => { 30862 return allFormatTypes.filter(({ 30863 name, 30864 tagName 30865 }) => { 30866 if (allowedFormats && !allowedFormats.includes(name)) { 30867 return false; 30868 } 30869 30870 if (withoutInteractiveFormatting && interactiveContentTags.has(tagName)) { 30871 return false; 30872 } 30873 30874 return true; 30875 }); 30876 }, [allFormatTypes, allowedFormats, interactiveContentTags]); 30877 const keyedSelected = Object(external_wp_data_["useSelect"])(select => formatTypes.reduce((accumulator, type) => { 30878 if (type.__experimentalGetPropsForEditableTreePreparation) { 30879 accumulator[type.name] = type.__experimentalGetPropsForEditableTreePreparation(select, { 30880 richTextIdentifier: identifier, 30881 blockClientId: clientId 30882 }); 30883 } 30884 30885 return accumulator; 30886 }, {}), [formatTypes, clientId, identifier]); 30887 const dispatch = Object(external_wp_data_["useDispatch"])(); 30888 const prepareHandlers = []; 30889 const valueHandlers = []; 30890 const changeHandlers = []; 30891 const dependencies = []; 30892 formatTypes.forEach(type => { 30893 if (type.__experimentalCreatePrepareEditableTree) { 30894 const selected = keyedSelected[type.name]; 30895 30896 const handler = type.__experimentalCreatePrepareEditableTree(selected, { 30897 richTextIdentifier: identifier, 30898 blockClientId: clientId 30899 }); 30900 30901 if (type.__experimentalCreateOnChangeEditableValue) { 30902 valueHandlers.push(handler); 30903 } else { 30904 prepareHandlers.push(handler); 30905 } 30906 30907 for (const key in selected) { 30908 dependencies.push(selected[key]); 30909 } 30910 } 30911 30912 if (type.__experimentalCreateOnChangeEditableValue) { 30913 let dispatchers = {}; 30914 30915 if (type.__experimentalGetPropsForEditableTreeChangeHandler) { 30916 dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, { 30917 richTextIdentifier: identifier, 30918 blockClientId: clientId 30919 }); 30920 } 30921 30922 changeHandlers.push(type.__experimentalCreateOnChangeEditableValue({ ...(keyedSelected[type.name] || {}), 30923 ...dispatchers 30924 }, { 30925 richTextIdentifier: identifier, 30926 blockClientId: clientId 30927 })); 30928 } 30929 }); 30930 return { 30931 formatTypes, 30932 prepareHandlers, 30933 valueHandlers, 30934 changeHandlers, 30935 dependencies 30936 }; 30937 } 30938 30939 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-edit.js 30940 30941 30942 /** 30943 * WordPress dependencies 30944 */ 30945 30946 function FormatEdit({ 30947 formatTypes, 30948 onChange, 30949 onFocus, 30950 value, 30951 forwardedRef 30952 }) { 30953 return formatTypes.map(settings => { 30954 const { 30955 name, 30956 edit: Edit 30957 } = settings; 30958 30959 if (!Edit) { 30960 return null; 30961 } 30962 30963 const activeFormat = Object(external_wp_richText_["getActiveFormat"])(value, name); 30964 const isActive = activeFormat !== undefined; 30965 const activeObject = Object(external_wp_richText_["getActiveObject"])(value); 30966 const isObjectActive = activeObject !== undefined && activeObject.type === name; 30967 return Object(external_wp_element_["createElement"])(Edit, { 30968 key: name, 30969 isActive: isActive, 30970 activeAttributes: isActive ? activeFormat.attributes || {} : {}, 30971 isObjectActive: isObjectActive, 30972 activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {}, 30973 value: value, 30974 onChange: onChange, 30975 onFocus: onFocus, 30976 contentRef: forwardedRef 30977 }); 30978 }); 30979 } 30980 30981 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/index.js 30982 30983 30984 30985 /** 30986 * External dependencies 30987 */ 30988 30989 30990 /** 30991 * WordPress dependencies 30992 */ 30993 30994 30995 30996 30997 30998 30999 31000 31001 /** 31002 * Internal dependencies 31003 */ 31004 31005 31006 31007 31008 31009 31010 31011 31012 31013 31014 31015 31016 31017 31018 31019 /** 31020 * Removes props used for the native version of RichText so that they are not 31021 * passed to the DOM element and log warnings. 31022 * 31023 * @param {Object} props Props to filter. 31024 * 31025 * @return {Object} Filtered props. 31026 */ 31027 31028 function removeNativeProps(props) { 31029 return Object(external_lodash_["omit"])(props, ['__unstableMobileNoFocusOnMount', 'deleteEnter', 'placeholderTextColor', 'textAlign', 'selectionColor', 'tagsToEliminate', 'rootTagsToEliminate', 'disableEditingMenu', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'minWidth', 'maxWidth', 'setRef']); 31030 } 31031 31032 function RichTextWrapper({ 31033 children, 31034 tagName = 'div', 31035 value: originalValue = '', 31036 onChange: originalOnChange, 31037 isSelected: originalIsSelected, 31038 multiline, 31039 inlineToolbar, 31040 wrapperClassName, 31041 autocompleters, 31042 onReplace, 31043 placeholder, 31044 allowedFormats, 31045 formattingControls, 31046 withoutInteractiveFormatting, 31047 onRemove, 31048 onMerge, 31049 onSplit, 31050 __unstableOnSplitAtEnd: onSplitAtEnd, 31051 __unstableOnSplitMiddle: onSplitMiddle, 31052 identifier, 31053 preserveWhiteSpace, 31054 __unstablePastePlainText: pastePlainText, 31055 __unstableEmbedURLOnPaste, 31056 __unstableDisableFormats: disableFormats, 31057 disableLineBreaks, 31058 unstableOnFocus, 31059 __unstableAllowPrefixTransformations, 31060 ...props 31061 }, forwardedRef) { 31062 const instanceId = Object(external_wp_compose_["useInstanceId"])(RichTextWrapper); 31063 identifier = identifier || instanceId; 31064 props = removeNativeProps(props); 31065 const anchorRef = Object(external_wp_element_["useRef"])(); 31066 const { 31067 clientId 31068 } = useBlockEditContext(); 31069 31070 const selector = select => { 31071 const { 31072 getSelectionStart, 31073 getSelectionEnd, 31074 isMultiSelecting, 31075 hasMultiSelection 31076 } = select(store); 31077 const selectionStart = getSelectionStart(); 31078 const selectionEnd = getSelectionEnd(); 31079 let isSelected; 31080 31081 if (originalIsSelected === undefined) { 31082 isSelected = selectionStart.clientId === clientId && selectionStart.attributeKey === identifier; 31083 } else if (originalIsSelected) { 31084 isSelected = selectionStart.clientId === clientId; 31085 } 31086 31087 return { 31088 selectionStart: isSelected ? selectionStart.offset : undefined, 31089 selectionEnd: isSelected ? selectionEnd.offset : undefined, 31090 isSelected, 31091 disabled: isMultiSelecting() || hasMultiSelection() 31092 }; 31093 }; // This selector must run on every render so the right selection state is 31094 // retreived from the store on merge. 31095 // To do: fix this somehow. 31096 31097 31098 const { 31099 selectionStart, 31100 selectionEnd, 31101 isSelected, 31102 disabled 31103 } = Object(external_wp_data_["useSelect"])(selector); 31104 const { 31105 selectionChange 31106 } = Object(external_wp_data_["useDispatch"])(store); 31107 const multilineTag = getMultilineTag(multiline); 31108 const adjustedAllowedFormats = getAllowedFormats({ 31109 allowedFormats, 31110 formattingControls, 31111 disableFormats 31112 }); 31113 const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0; 31114 let adjustedValue = originalValue; 31115 let adjustedOnChange = originalOnChange; // Handle deprecated format. 31116 31117 if (Array.isArray(originalValue)) { 31118 adjustedValue = external_wp_blocks_["children"].toHTML(originalValue); 31119 31120 adjustedOnChange = newValue => originalOnChange(external_wp_blocks_["children"].fromDOM(Object(external_wp_richText_["__unstableCreateElement"])(document, newValue).childNodes)); 31121 } 31122 31123 const onSelectionChange = Object(external_wp_element_["useCallback"])((start, end) => { 31124 selectionChange(clientId, identifier, start, end); 31125 }, [clientId, identifier]); 31126 const { 31127 formatTypes, 31128 prepareHandlers, 31129 valueHandlers, 31130 changeHandlers, 31131 dependencies 31132 } = useFormatTypes({ 31133 clientId, 31134 identifier, 31135 withoutInteractiveFormatting, 31136 allowedFormats: adjustedAllowedFormats 31137 }); 31138 31139 function addEditorOnlyFormats(value) { 31140 return valueHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); 31141 } 31142 31143 function removeEditorOnlyFormats(value) { 31144 formatTypes.forEach(formatType => { 31145 // Remove formats created by prepareEditableTree, because they are editor only. 31146 if (formatType.__experimentalCreatePrepareEditableTree) { 31147 value = Object(external_wp_richText_["removeFormat"])(value, formatType.name, 0, value.text.length); 31148 } 31149 }); 31150 return value.formats; 31151 } 31152 31153 function addInvisibleFormats(value) { 31154 return prepareHandlers.reduce((accumulator, fn) => fn(accumulator, value.text), value.formats); 31155 } 31156 31157 const { 31158 value, 31159 onChange, 31160 onFocus, 31161 ref: richTextRef 31162 } = Object(external_wp_richText_["__unstableUseRichText"])({ 31163 value: adjustedValue, 31164 31165 onChange(html, { 31166 __unstableFormats, 31167 __unstableText 31168 }) { 31169 adjustedOnChange(html); 31170 Object.values(changeHandlers).forEach(changeHandler => { 31171 changeHandler(__unstableFormats, __unstableText); 31172 }); 31173 }, 31174 31175 selectionStart, 31176 selectionEnd, 31177 onSelectionChange, 31178 placeholder, 31179 __unstableIsSelected: isSelected, 31180 __unstableMultilineTag: multilineTag, 31181 __unstableDisableFormats: disableFormats, 31182 preserveWhiteSpace, 31183 __unstableDependencies: [...dependencies, tagName], 31184 __unstableAfterParse: addEditorOnlyFormats, 31185 __unstableBeforeSerialize: removeEditorOnlyFormats, 31186 __unstableAddInvisibleFormats: addInvisibleFormats 31187 }); 31188 const autocompleteProps = useBlockEditorAutocompleteProps({ 31189 onReplace, 31190 completers: autocompleters, 31191 record: value, 31192 onChange 31193 }); 31194 useCaretInFormat({ 31195 value 31196 }); 31197 useMarkPersistent({ 31198 html: adjustedValue, 31199 value 31200 }); 31201 31202 function onKeyDown(event) { 31203 const { 31204 keyCode 31205 } = event; 31206 31207 if (event.defaultPrevented) { 31208 return; 31209 } 31210 31211 if (keyCode === external_wp_keycodes_["DELETE"] || keyCode === external_wp_keycodes_["BACKSPACE"]) { 31212 const { 31213 start, 31214 end, 31215 text 31216 } = value; 31217 const isReverse = keyCode === external_wp_keycodes_["BACKSPACE"]; 31218 const hasActiveFormats = value.activeFormats && !!value.activeFormats.length; // Only process delete if the key press occurs at an uncollapsed edge. 31219 31220 if (!Object(external_wp_richText_["isCollapsed"])(value) || hasActiveFormats || isReverse && start !== 0 || !isReverse && end !== text.length) { 31221 return; 31222 } 31223 31224 if (onMerge) { 31225 onMerge(!isReverse); 31226 } // Only handle remove on Backspace. This serves dual-purpose of being 31227 // an intentional user interaction distinguishing between Backspace and 31228 // Delete to remove the empty field, but also to avoid merge & remove 31229 // causing destruction of two fields (merge, then removed merged). 31230 31231 31232 if (onRemove && Object(external_wp_richText_["isEmpty"])(value) && isReverse) { 31233 onRemove(!isReverse); 31234 } 31235 31236 event.preventDefault(); 31237 } 31238 } 31239 31240 const TagName = tagName; 31241 const content = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isSelected && children && children({ 31242 value, 31243 onChange, 31244 onFocus 31245 }), isSelected && Object(external_wp_element_["createElement"])(RemoveBrowserShortcuts, null), isSelected && Object(external_wp_element_["createElement"])(FormatEdit, { 31246 value: value, 31247 onChange: onChange, 31248 onFocus: onFocus, 31249 formatTypes: formatTypes, 31250 forwardedRef: anchorRef 31251 }), isSelected && hasFormats && Object(external_wp_element_["createElement"])(format_toolbar_container, { 31252 inline: inlineToolbar, 31253 anchorRef: anchorRef.current 31254 }), Object(external_wp_element_["createElement"])(TagName // Overridable props. 31255 , Object(esm_extends["a" /* default */])({ 31256 role: "textbox", 31257 "aria-multiline": true, 31258 "aria-label": placeholder 31259 }, props, autocompleteProps, { 31260 ref: Object(external_wp_compose_["useMergeRefs"])([autocompleteProps.ref, props.ref, richTextRef, useInputRules({ 31261 value, 31262 onChange, 31263 __unstableAllowPrefixTransformations, 31264 formatTypes, 31265 onReplace 31266 }), useUndoAutomaticChange(), usePasteHandler({ 31267 isSelected, 31268 disableFormats, 31269 onChange, 31270 value, 31271 formatTypes, 31272 tagName, 31273 onReplace, 31274 onSplit, 31275 onSplitMiddle, 31276 __unstableEmbedURLOnPaste, 31277 multilineTag, 31278 preserveWhiteSpace, 31279 pastePlainText 31280 }), useEnter({ 31281 removeEditorOnlyFormats, 31282 value, 31283 onReplace, 31284 onSplit, 31285 onSplitMiddle, 31286 multilineTag, 31287 onChange, 31288 disableLineBreaks, 31289 onSplitAtEnd 31290 }), anchorRef, forwardedRef]) // Do not set the attribute if disabled. 31291 , 31292 contentEditable: disabled ? undefined : true, 31293 suppressContentEditableWarning: !disabled, 31294 className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text'), 31295 onFocus: unstableOnFocus, 31296 onKeyDown: onKeyDown 31297 }))); 31298 31299 if (!wrapperClassName) { 31300 return content; 31301 } 31302 31303 external_wp_deprecated_default()('wp.blockEditor.RichText wrapperClassName prop', { 31304 since: '5.4', 31305 alternative: 'className prop or create your own wrapper div' 31306 }); 31307 const className = classnames_default()('block-editor-rich-text', wrapperClassName); 31308 return Object(external_wp_element_["createElement"])("div", { 31309 className: className 31310 }, content); 31311 } 31312 31313 const ForwardedRichTextContainer = Object(external_wp_element_["forwardRef"])(RichTextWrapper); 31314 31315 ForwardedRichTextContainer.Content = ({ 31316 value, 31317 tagName: Tag, 31318 multiline, 31319 ...props 31320 }) => { 31321 // Handle deprecated `children` and `node` sources. 31322 if (Array.isArray(value)) { 31323 value = external_wp_blocks_["children"].toHTML(value); 31324 } 31325 31326 const MultilineTag = getMultilineTag(multiline); 31327 31328 if (!value && MultilineTag) { 31329 value = `<${MultilineTag}></${MultilineTag}>`; 31330 } 31331 31332 const content = Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, value); 31333 31334 if (Tag) { 31335 return Object(external_wp_element_["createElement"])(Tag, Object(external_lodash_["omit"])(props, ['format']), content); 31336 } 31337 31338 return content; 31339 }; 31340 31341 ForwardedRichTextContainer.isEmpty = value => { 31342 return !value || value.length === 0; 31343 }; 31344 /** 31345 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md 31346 */ 31347 31348 31349 /* harmony default export */ var rich_text = (ForwardedRichTextContainer); 31350 31351 31352 31353 31354 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/editor.js 31355 31356 31357 /** 31358 * WordPress dependencies 31359 */ 31360 31361 /** 31362 * Internal dependencies 31363 */ 31364 31365 31366 31367 function BlockNavigationEditor({ 31368 value, 31369 onChange 31370 }) { 31371 return Object(external_wp_element_["createElement"])(BlockNavigationBlockFill, null, Object(external_wp_element_["createElement"])(rich_text, { 31372 value: value, 31373 onChange: onChange, 31374 placeholder: Object(external_wp_i18n_["__"])('Navigation item'), 31375 withoutInteractiveFormatting: true, 31376 allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'] 31377 })); 31378 } 31379 31380 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 31381 var library_layout = __webpack_require__("Civd"); 31382 31383 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js 31384 31385 31386 /** 31387 * External dependencies 31388 */ 31389 31390 /** 31391 * WordPress dependencies 31392 */ 31393 31394 31395 31396 31397 31398 function BlockVariationPicker({ 31399 icon = library_layout["a" /* default */], 31400 label = Object(external_wp_i18n_["__"])('Choose variation'), 31401 instructions = Object(external_wp_i18n_["__"])('Select a variation to start with.'), 31402 variations, 31403 onSelect, 31404 allowSkip 31405 }) { 31406 const classes = classnames_default()('block-editor-block-variation-picker', { 31407 'has-many-variations': variations.length > 4 31408 }); 31409 return Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { 31410 icon: icon, 31411 label: label, 31412 instructions: instructions, 31413 className: classes 31414 }, Object(external_wp_element_["createElement"])("ul", { 31415 className: "block-editor-block-variation-picker__variations", 31416 role: "list", 31417 "aria-label": Object(external_wp_i18n_["__"])('Block variations') 31418 }, variations.map(variation => Object(external_wp_element_["createElement"])("li", { 31419 key: variation.name 31420 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31421 isSecondary: true, 31422 icon: variation.icon, 31423 iconSize: 48, 31424 onClick: () => onSelect(variation), 31425 className: "block-editor-block-variation-picker__variation", 31426 label: variation.description || variation.title 31427 }), Object(external_wp_element_["createElement"])("span", { 31428 className: "block-editor-block-variation-picker__variation-label", 31429 role: "presentation" 31430 }, variation.title)))), allowSkip && Object(external_wp_element_["createElement"])("div", { 31431 className: "block-editor-block-variation-picker__skip" 31432 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31433 isLink: true, 31434 onClick: () => onSelect() 31435 }, Object(external_wp_i18n_["__"])('Skip')))); 31436 } 31437 31438 /* harmony default export */ var block_variation_picker = (BlockVariationPicker); 31439 31440 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js 31441 var grid = __webpack_require__("b2RC"); 31442 31443 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/constants.js 31444 const VIEWMODES = { 31445 carousel: 'carousel', 31446 grid: 'grid' 31447 }; 31448 31449 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/setup-toolbar.js 31450 31451 31452 /** 31453 * WordPress dependencies 31454 */ 31455 31456 31457 31458 /** 31459 * Internal dependencies 31460 */ 31461 31462 31463 31464 const Actions = ({ 31465 onStartBlank, 31466 onBlockPatternSelect 31467 }) => Object(external_wp_element_["createElement"])("div", { 31468 className: "block-editor-block-pattern-setup__actions" 31469 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31470 onClick: onStartBlank 31471 }, Object(external_wp_i18n_["__"])('Start blank')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31472 isPrimary: true, 31473 onClick: onBlockPatternSelect 31474 }, Object(external_wp_i18n_["__"])('Choose'))); 31475 31476 const CarouselNavigation = ({ 31477 handlePrevious, 31478 handleNext, 31479 activeSlide, 31480 totalSlides 31481 }) => Object(external_wp_element_["createElement"])("div", { 31482 className: "block-editor-block-pattern-setup__navigation" 31483 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31484 icon: chevron_left["a" /* default */], 31485 label: Object(external_wp_i18n_["__"])('Previous pattern'), 31486 onClick: handlePrevious, 31487 disabled: activeSlide === 0 31488 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31489 icon: chevron_right["a" /* default */], 31490 label: Object(external_wp_i18n_["__"])('Next pattern'), 31491 onClick: handleNext, 31492 disabled: activeSlide === totalSlides - 1 31493 })); 31494 31495 const SetupToolbar = ({ 31496 viewMode, 31497 setViewMode, 31498 handlePrevious, 31499 handleNext, 31500 activeSlide, 31501 totalSlides, 31502 onBlockPatternSelect, 31503 onStartBlank 31504 }) => { 31505 const isCarouselView = viewMode === VIEWMODES.carousel; 31506 const displayControls = Object(external_wp_element_["createElement"])("div", { 31507 className: "block-editor-block-pattern-setup__display-controls" 31508 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31509 icon: stretch_full_width, 31510 label: Object(external_wp_i18n_["__"])('Carousel view'), 31511 onClick: () => setViewMode(VIEWMODES.carousel), 31512 isPressed: isCarouselView 31513 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 31514 icon: grid["a" /* default */], 31515 label: Object(external_wp_i18n_["__"])('Grid view'), 31516 onClick: () => setViewMode(VIEWMODES.grid), 31517 isPressed: viewMode === VIEWMODES.grid 31518 })); 31519 return Object(external_wp_element_["createElement"])("div", { 31520 className: "block-editor-block-pattern-setup__toolbar" 31521 }, isCarouselView && Object(external_wp_element_["createElement"])(CarouselNavigation, { 31522 handlePrevious: handlePrevious, 31523 handleNext: handleNext, 31524 activeSlide: activeSlide, 31525 totalSlides: totalSlides 31526 }), displayControls, isCarouselView && Object(external_wp_element_["createElement"])(Actions, { 31527 onBlockPatternSelect: onBlockPatternSelect, 31528 onStartBlank: onStartBlank 31529 })); 31530 }; 31531 31532 /* harmony default export */ var setup_toolbar = (SetupToolbar); 31533 31534 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/use-patterns-setup.js 31535 /** 31536 * WordPress dependencies 31537 */ 31538 31539 /** 31540 * Internal dependencies 31541 */ 31542 31543 31544 31545 function usePatternsSetup(clientId, blockName, filterPatternsFn) { 31546 return Object(external_wp_data_["useSelect"])(select => { 31547 const { 31548 getBlockRootClientId, 31549 __experimentalGetPatternsByBlockTypes, 31550 __experimentalGetAllowedPatterns 31551 } = select(store); 31552 const rootClientId = getBlockRootClientId(clientId); 31553 31554 if (filterPatternsFn) { 31555 return __experimentalGetAllowedPatterns(rootClientId).filter(filterPatternsFn); 31556 } 31557 31558 return __experimentalGetPatternsByBlockTypes(blockName, rootClientId); 31559 }, [clientId, blockName, filterPatternsFn]); 31560 } 31561 31562 /* harmony default export */ var use_patterns_setup = (usePatternsSetup); 31563 31564 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js 31565 31566 31567 31568 /** 31569 * WordPress dependencies 31570 */ 31571 31572 31573 31574 31575 31576 31577 /** 31578 * Internal dependencies 31579 */ 31580 31581 31582 31583 31584 31585 31586 31587 const SetupContent = ({ 31588 viewMode, 31589 activeSlide, 31590 patterns, 31591 onBlockPatternSelect 31592 }) => { 31593 const composite = Object(external_wp_components_["__unstableUseCompositeState"])(); 31594 const containerClass = 'block-editor-block-pattern-setup__container'; 31595 31596 if (viewMode === VIEWMODES.carousel) { 31597 const slideClass = new Map([[activeSlide, 'active-slide'], [activeSlide - 1, 'previous-slide'], [activeSlide + 1, 'next-slide']]); 31598 return Object(external_wp_element_["createElement"])("div", { 31599 className: containerClass 31600 }, Object(external_wp_element_["createElement"])("ul", { 31601 className: "carousel-container" 31602 }, patterns.map((pattern, index) => Object(external_wp_element_["createElement"])(BlockPatternSlide, { 31603 className: slideClass.get(index) || '', 31604 key: pattern.name, 31605 pattern: pattern 31606 })))); 31607 } 31608 31609 return Object(external_wp_element_["createElement"])(external_wp_components_["__unstableComposite"], Object(esm_extends["a" /* default */])({}, composite, { 31610 role: "listbox", 31611 className: containerClass, 31612 "aria-label": Object(external_wp_i18n_["__"])('Patterns list') 31613 }), patterns.map(pattern => Object(external_wp_element_["createElement"])(block_pattern_setup_BlockPattern, { 31614 key: pattern.name, 31615 pattern: pattern, 31616 onSelect: onBlockPatternSelect, 31617 composite: composite 31618 }))); 31619 }; 31620 31621 function block_pattern_setup_BlockPattern({ 31622 pattern, 31623 onSelect, 31624 composite 31625 }) { 31626 const baseClassName = 'block-editor-block-pattern-setup-list'; 31627 const { 31628 blocks, 31629 title, 31630 description, 31631 viewportWidth = 700 31632 } = pattern; 31633 const descriptionId = Object(external_wp_compose_["useInstanceId"])(block_pattern_setup_BlockPattern, `${baseClassName}__item-description`); 31634 return Object(external_wp_element_["createElement"])("div", { 31635 className: `${baseClassName}__list-item`, 31636 "aria-label": pattern.title, 31637 "aria-describedby": pattern.description ? descriptionId : undefined 31638 }, Object(external_wp_element_["createElement"])(external_wp_components_["__unstableCompositeItem"], Object(esm_extends["a" /* default */])({ 31639 role: "option", 31640 as: "div" 31641 }, composite, { 31642 className: `${baseClassName}__item`, 31643 onClick: () => onSelect(blocks) 31644 }), Object(external_wp_element_["createElement"])(block_preview, { 31645 blocks: blocks, 31646 viewportWidth: viewportWidth 31647 }), Object(external_wp_element_["createElement"])("div", { 31648 className: `${baseClassName}__item-title` 31649 }, title)), !!description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 31650 id: descriptionId 31651 }, description)); 31652 } 31653 31654 function BlockPatternSlide({ 31655 className, 31656 pattern 31657 }) { 31658 const { 31659 blocks, 31660 title, 31661 description 31662 } = pattern; 31663 const descriptionId = Object(external_wp_compose_["useInstanceId"])(BlockPatternSlide, 'block-editor-block-pattern-setup-list__item-description'); 31664 return Object(external_wp_element_["createElement"])("li", { 31665 className: `pattern-slide ${className}`, 31666 "aria-label": title, 31667 "aria-describedby": description ? descriptionId : undefined 31668 }, Object(external_wp_element_["createElement"])(block_preview, { 31669 blocks: blocks, 31670 __experimentalLive: true 31671 }), !!description && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 31672 id: descriptionId 31673 }, description)); 31674 } 31675 31676 const BlockPatternSetup = ({ 31677 clientId, 31678 blockName, 31679 filterPatternsFn, 31680 startBlankComponent, 31681 onBlockPatternSelect 31682 }) => { 31683 const [viewMode, setViewMode] = Object(external_wp_element_["useState"])(VIEWMODES.carousel); 31684 const [activeSlide, setActiveSlide] = Object(external_wp_element_["useState"])(0); 31685 const [showBlank, setShowBlank] = Object(external_wp_element_["useState"])(false); 31686 const { 31687 replaceBlock 31688 } = Object(external_wp_data_["useDispatch"])(store); 31689 const patterns = use_patterns_setup(clientId, blockName, filterPatternsFn); 31690 31691 if (!(patterns !== null && patterns !== void 0 && patterns.length) || showBlank) { 31692 return startBlankComponent; 31693 } 31694 31695 const onBlockPatternSelectDefault = blocks => { 31696 const clonedBlocks = blocks.map(block => Object(external_wp_blocks_["cloneBlock"])(block)); 31697 replaceBlock(clientId, clonedBlocks); 31698 }; 31699 31700 const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault; 31701 return Object(external_wp_element_["createElement"])("div", { 31702 className: `block-editor-block-pattern-setup view-mode-${viewMode}` 31703 }, Object(external_wp_element_["createElement"])(setup_toolbar, { 31704 viewMode: viewMode, 31705 setViewMode: setViewMode, 31706 activeSlide: activeSlide, 31707 totalSlides: patterns.length, 31708 handleNext: () => { 31709 setActiveSlide(active => active + 1); 31710 }, 31711 handlePrevious: () => { 31712 setActiveSlide(active => active - 1); 31713 }, 31714 onBlockPatternSelect: () => { 31715 onPatternSelectCallback(patterns[activeSlide].blocks); 31716 }, 31717 onStartBlank: () => { 31718 setShowBlank(true); 31719 } 31720 }), Object(external_wp_element_["createElement"])(SetupContent, { 31721 viewMode: viewMode, 31722 activeSlide: activeSlide, 31723 patterns: patterns, 31724 onBlockPatternSelect: onPatternSelectCallback 31725 })); 31726 }; 31727 31728 /* harmony default export */ var block_pattern_setup = (BlockPatternSetup); 31729 31730 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/block-variation-transforms.js 31731 /** 31732 * External dependencies 31733 */ 31734 31735 /** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */ 31736 31737 /** 31738 * Matches the provided block variations with a block's attributes. If no match 31739 * or more than one matches are found it returns `undefined`. If a single match is 31740 * found it returns it. 31741 * 31742 * This is a simple implementation for now as it takes into account only the attributes 31743 * of a block variation and not `InnerBlocks`. 31744 * 31745 * @param {Object} blockAttributes - The block attributes to try to find a match. 31746 * @param {WPBlockVariation[]} variations - A list of block variations to test for a match. 31747 * @return {?WPBlockVariation} - If a match is found returns it. If not or more than one matches are found returns `undefined`. 31748 */ 31749 31750 const __experimentalGetMatchingVariation = (blockAttributes, variations) => { 31751 if (!variations || !blockAttributes) return; 31752 const matches = variations.filter(({ 31753 attributes 31754 }) => { 31755 if (!attributes || !Object.keys(attributes).length) return false; 31756 return Object(external_lodash_["isMatch"])(blockAttributes, attributes); 31757 }); 31758 if (matches.length !== 1) return; 31759 return matches[0]; 31760 }; 31761 31762 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-transforms/index.js 31763 31764 31765 /** 31766 * WordPress dependencies 31767 */ 31768 31769 31770 31771 31772 31773 31774 /** 31775 * Internal dependencies 31776 */ 31777 31778 31779 31780 31781 function __experimentalBlockVariationTransforms({ 31782 blockClientId 31783 }) { 31784 const [selectedValue, setSelectedValue] = Object(external_wp_element_["useState"])(); 31785 const { 31786 updateBlockAttributes 31787 } = Object(external_wp_data_["useDispatch"])(store); 31788 const { 31789 variations, 31790 blockAttributes 31791 } = Object(external_wp_data_["useSelect"])(select => { 31792 const { 31793 getBlockVariations 31794 } = select(external_wp_blocks_["store"]); 31795 const { 31796 getBlockName, 31797 getBlockAttributes 31798 } = select(store); 31799 const blockName = blockClientId && getBlockName(blockClientId); 31800 return { 31801 variations: blockName && getBlockVariations(blockName, 'transform'), 31802 blockAttributes: getBlockAttributes(blockClientId) 31803 }; 31804 }, [blockClientId]); 31805 Object(external_wp_element_["useEffect"])(() => { 31806 var _getMatchingVariation; 31807 31808 setSelectedValue((_getMatchingVariation = __experimentalGetMatchingVariation(blockAttributes, variations)) === null || _getMatchingVariation === void 0 ? void 0 : _getMatchingVariation.name); 31809 }, [blockAttributes, variations]); 31810 if (!(variations !== null && variations !== void 0 && variations.length)) return null; 31811 const selectOptions = variations.map(({ 31812 name, 31813 title, 31814 description 31815 }) => ({ 31816 value: name, 31817 label: title, 31818 info: description 31819 })); 31820 31821 const onSelectVariation = variationName => { 31822 updateBlockAttributes(blockClientId, { ...variations.find(({ 31823 name 31824 }) => name === variationName).attributes 31825 }); 31826 }; 31827 31828 const baseClass = 'block-editor-block-variation-transforms'; 31829 return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { 31830 className: baseClass, 31831 label: Object(external_wp_i18n_["__"])('Transform to variation'), 31832 text: Object(external_wp_i18n_["__"])('Transform to variation'), 31833 popoverProps: { 31834 position: 'bottom center', 31835 className: `${baseClass}__popover` 31836 }, 31837 icon: chevron_down["a" /* default */], 31838 toggleProps: { 31839 iconPosition: 'right' 31840 } 31841 }, () => Object(external_wp_element_["createElement"])("div", { 31842 className: `${baseClass}__container` 31843 }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], { 31844 choices: selectOptions, 31845 value: selectedValue, 31846 onSelect: onSelectVariation 31847 })))); 31848 } 31849 31850 /* harmony default export */ var block_variation_transforms = (__experimentalBlockVariationTransforms); 31851 31852 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/icons.js 31853 31854 31855 /** 31856 * WordPress dependencies 31857 */ 31858 31859 const alignBottom = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 31860 xmlns: "http://www.w3.org/2000/svg", 31861 viewBox: "0 0 24 24" 31862 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 31863 d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z" 31864 })); 31865 const alignCenter = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 31866 xmlns: "http://www.w3.org/2000/svg", 31867 viewBox: "0 0 24 24" 31868 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 31869 d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z" 31870 })); 31871 const alignTop = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 31872 xmlns: "http://www.w3.org/2000/svg", 31873 viewBox: "0 0 24 24" 31874 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 31875 d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z" 31876 })); 31877 31878 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js 31879 31880 31881 31882 /** 31883 * WordPress dependencies 31884 */ 31885 31886 31887 /** 31888 * Internal dependencies 31889 */ 31890 31891 31892 const ui_BLOCK_ALIGNMENTS_CONTROLS = { 31893 top: { 31894 icon: alignTop, 31895 title: Object(external_wp_i18n_["_x"])('Align top', 'Block vertical alignment setting') 31896 }, 31897 center: { 31898 icon: alignCenter, 31899 title: Object(external_wp_i18n_["_x"])('Align middle', 'Block vertical alignment setting') 31900 }, 31901 bottom: { 31902 icon: alignBottom, 31903 title: Object(external_wp_i18n_["_x"])('Align bottom', 'Block vertical alignment setting') 31904 } 31905 }; 31906 const ui_DEFAULT_CONTROLS = ['top', 'center', 'bottom']; 31907 const ui_DEFAULT_CONTROL = 'top'; 31908 const block_vertical_alignment_control_ui_POPOVER_PROPS = { 31909 isAlternate: true 31910 }; 31911 31912 function BlockVerticalAlignmentUI({ 31913 value, 31914 onChange, 31915 controls = ui_DEFAULT_CONTROLS, 31916 isCollapsed = true, 31917 isToolbar 31918 }) { 31919 function applyOrUnset(align) { 31920 return () => onChange(value === align ? undefined : align); 31921 } 31922 31923 const activeAlignment = ui_BLOCK_ALIGNMENTS_CONTROLS[value]; 31924 const defaultAlignmentControl = ui_BLOCK_ALIGNMENTS_CONTROLS[ui_DEFAULT_CONTROL]; 31925 const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; 31926 const extraProps = isToolbar ? { 31927 isCollapsed 31928 } : {}; 31929 return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ 31930 popoverProps: block_vertical_alignment_control_ui_POPOVER_PROPS, 31931 icon: activeAlignment ? activeAlignment.icon : defaultAlignmentControl.icon, 31932 label: Object(external_wp_i18n_["_x"])('Change vertical alignment', 'Block vertical alignment setting label'), 31933 controls: controls.map(control => { 31934 return { ...ui_BLOCK_ALIGNMENTS_CONTROLS[control], 31935 isActive: value === control, 31936 role: isCollapsed ? 'menuitemradio' : undefined, 31937 onClick: applyOrUnset(control) 31938 }; 31939 }) 31940 }, extraProps)); 31941 } 31942 /** 31943 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-vertical-alignment-toolbar/README.md 31944 */ 31945 31946 31947 /* harmony default export */ var block_vertical_alignment_control_ui = (BlockVerticalAlignmentUI); 31948 31949 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/index.js 31950 31951 31952 31953 /** 31954 * Internal dependencies 31955 */ 31956 31957 function BlockVerticalAlignmentControl(props) { 31958 return Object(external_wp_element_["createElement"])(block_vertical_alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { 31959 isToolbar: false 31960 })); 31961 } 31962 function BlockVerticalAlignmentToolbar(props) { 31963 return Object(external_wp_element_["createElement"])(block_vertical_alignment_control_ui, Object(esm_extends["a" /* default */])({}, props, { 31964 isToolbar: true 31965 })); 31966 } 31967 31968 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js 31969 31970 31971 31972 /** 31973 * External dependencies 31974 */ 31975 31976 /** 31977 * WordPress dependencies 31978 */ 31979 31980 31981 /** 31982 * Internal dependencies 31983 */ 31984 31985 31986 /* harmony default export */ var with_color_context = (Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => { 31987 return props => { 31988 const colorsFeature = useSetting('color.palette'); 31989 const disableCustomColorsFeature = !useSetting('color.custom'); 31990 const colors = props.colors === undefined ? colorsFeature : props.colors; 31991 const disableCustomColors = props.disableCustomColors === undefined ? disableCustomColorsFeature : props.disableCustomColors; 31992 const hasColorsToChoose = !Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors; 31993 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { 31994 colors, 31995 disableCustomColors, 31996 hasColorsToChoose 31997 })); 31998 }; 31999 }, 'withColorContext')); 32000 32001 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/index.js 32002 /** 32003 * WordPress dependencies 32004 */ 32005 32006 /** 32007 * Internal dependencies 32008 */ 32009 32010 32011 /* harmony default export */ var color_palette = (with_color_context(external_wp_components_["ColorPalette"])); 32012 32013 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/control.js 32014 32015 32016 32017 /** 32018 * Internal dependencies 32019 */ 32020 32021 function ColorPaletteControl({ 32022 onChange, 32023 value, 32024 ...otherProps 32025 }) { 32026 return Object(external_wp_element_["createElement"])(control, Object(esm_extends["a" /* default */])({}, otherProps, { 32027 onColorChange: onChange, 32028 colorValue: value, 32029 gradients: [], 32030 disableCustomGradients: true 32031 })); 32032 } 32033 32034 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradient-picker/index.js 32035 32036 32037 32038 /** 32039 * WordPress dependencies 32040 */ 32041 32042 /** 32043 * Internal dependencies 32044 */ 32045 32046 32047 const gradient_picker_EMPTY_ARRAY = []; 32048 32049 function GradientPickerWithGradients(props) { 32050 const gradients = useSetting('color.gradients') || gradient_picker_EMPTY_ARRAY; 32051 const disableCustomGradients = !useSetting('color.customGradient'); 32052 return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalGradientPicker"], Object(esm_extends["a" /* default */])({ 32053 gradients: props.gradients !== undefined ? props.gradient : gradients, 32054 disableCustomGradients: props.disableCustomGradients !== undefined ? props.disableCustomGradients : disableCustomGradients 32055 }, props)); 32056 } 32057 32058 /* harmony default export */ var gradient_picker = (function (props) { 32059 const ComponentToUse = props.gradients !== undefined && props.disableCustomGradients !== undefined ? external_wp_components_["__experimentalGradientPicker"] : GradientPickerWithGradients; 32060 return Object(external_wp_element_["createElement"])(ComponentToUse, props); 32061 }); 32062 32063 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradient-picker/control.js 32064 32065 32066 32067 /** 32068 * External dependencies 32069 */ 32070 32071 32072 /** 32073 * WordPress dependencies 32074 */ 32075 32076 32077 32078 /** 32079 * Internal dependencies 32080 */ 32081 32082 32083 32084 function GradientPickerControl({ 32085 className, 32086 value, 32087 onChange, 32088 label = Object(external_wp_i18n_["__"])('Gradient Presets'), 32089 ...props 32090 }) { 32091 const gradients = useSetting('color.gradients'); 32092 const disableCustomGradients = !useSetting('color.customGradient'); 32093 32094 if (Object(external_lodash_["isEmpty"])(gradients) && disableCustomGradients) { 32095 return null; 32096 } 32097 32098 return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { 32099 className: classnames_default()('block-editor-gradient-picker-control', className) 32100 }, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"].VisualLabel, null, label), Object(external_wp_element_["createElement"])(gradient_picker, Object(esm_extends["a" /* default */])({ 32101 value: value, 32102 onChange: onChange, 32103 className: "block-editor-gradient-picker-control__gradient-picker-presets", 32104 gradients: gradients, 32105 disableCustomGradients: disableCustomGradients 32106 }, props))); 32107 } 32108 32109 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradient-picker/panel.js 32110 32111 32112 /** 32113 * External dependencies 32114 */ 32115 32116 /** 32117 * WordPress dependencies 32118 */ 32119 32120 32121 32122 /** 32123 * Internal dependencies 32124 */ 32125 32126 32127 32128 function GradientPanel(props) { 32129 const gradients = useSetting('color.gradients'); 32130 32131 if (Object(external_lodash_["isEmpty"])(gradients)) { 32132 return null; 32133 } 32134 32135 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 32136 title: Object(external_wp_i18n_["__"])('Gradient') 32137 }, Object(external_wp_element_["createElement"])(GradientPickerControl, props)); 32138 } 32139 32140 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-size-control/index.js 32141 32142 32143 /** 32144 * External dependencies 32145 */ 32146 32147 /** 32148 * WordPress dependencies 32149 */ 32150 32151 32152 32153 const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; 32154 function ImageSizeControl({ 32155 imageWidth, 32156 imageHeight, 32157 imageSizeOptions = [], 32158 isResizable = true, 32159 slug, 32160 width, 32161 height, 32162 onChange, 32163 onChangeImage = external_lodash_["noop"] 32164 }) { 32165 var _ref, _ref2; 32166 32167 function updateDimensions(nextWidth, nextHeight) { 32168 return () => { 32169 onChange({ 32170 width: nextWidth, 32171 height: nextHeight 32172 }); 32173 }; 32174 } 32175 32176 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !Object(external_lodash_["isEmpty"])(imageSizeOptions) && Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { 32177 label: Object(external_wp_i18n_["__"])('Image size'), 32178 value: slug, 32179 options: imageSizeOptions, 32180 onChange: onChangeImage 32181 }), isResizable && Object(external_wp_element_["createElement"])("div", { 32182 className: "block-editor-image-size-control" 32183 }, Object(external_wp_element_["createElement"])("p", { 32184 className: "block-editor-image-size-control__row" 32185 }, Object(external_wp_i18n_["__"])('Image dimensions')), Object(external_wp_element_["createElement"])("div", { 32186 className: "block-editor-image-size-control__row" 32187 }, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 32188 type: "number", 32189 className: "block-editor-image-size-control__width", 32190 label: Object(external_wp_i18n_["__"])('Width'), 32191 value: (_ref = width !== null && width !== void 0 ? width : imageWidth) !== null && _ref !== void 0 ? _ref : '', 32192 min: 1, 32193 onChange: value => onChange({ 32194 width: parseInt(value, 10) 32195 }) 32196 }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 32197 type: "number", 32198 className: "block-editor-image-size-control__height", 32199 label: Object(external_wp_i18n_["__"])('Height'), 32200 value: (_ref2 = height !== null && height !== void 0 ? height : imageHeight) !== null && _ref2 !== void 0 ? _ref2 : '', 32201 min: 1, 32202 onChange: value => onChange({ 32203 height: parseInt(value, 10) 32204 }) 32205 })), Object(external_wp_element_["createElement"])("div", { 32206 className: "block-editor-image-size-control__row" 32207 }, Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { 32208 "aria-label": Object(external_wp_i18n_["__"])('Image size presets') 32209 }, IMAGE_SIZE_PRESETS.map(scale => { 32210 const scaledWidth = Math.round(imageWidth * (scale / 100)); 32211 const scaledHeight = Math.round(imageHeight * (scale / 100)); 32212 const isCurrent = width === scaledWidth && height === scaledHeight; 32213 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 32214 key: scale, 32215 isSmall: true, 32216 isPrimary: isCurrent, 32217 isPressed: isCurrent, 32218 onClick: updateDimensions(scaledWidth, scaledHeight) 32219 }, scale, "%"); 32220 })), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 32221 isSmall: true, 32222 onClick: updateDimensions() 32223 }, Object(external_wp_i18n_["__"])('Reset'))))); 32224 } 32225 32226 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/with-client-id.js 32227 32228 32229 32230 /** 32231 * WordPress dependencies 32232 */ 32233 32234 /** 32235 * Internal dependencies 32236 */ 32237 32238 32239 const withClientId = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => { 32240 const { 32241 clientId 32242 } = useBlockEditContext(); 32243 return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, { 32244 clientId: clientId 32245 })); 32246 }, 'withClientId'); 32247 /* harmony default export */ var with_client_id = (withClientId); 32248 32249 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/button-block-appender.js 32250 32251 32252 /** 32253 * Internal dependencies 32254 */ 32255 32256 32257 const button_block_appender_ButtonBlockAppender = ({ 32258 clientId, 32259 showSeparator, 32260 isFloating, 32261 onAddBlock 32262 }) => { 32263 return Object(external_wp_element_["createElement"])(button_block_appender, { 32264 rootClientId: clientId, 32265 showSeparator: showSeparator, 32266 isFloating: isFloating, 32267 onAddBlock: onAddBlock 32268 }); 32269 }; 32270 /* harmony default export */ var inner_blocks_button_block_appender = (with_client_id(button_block_appender_ButtonBlockAppender)); 32271 32272 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/default-block-appender.js 32273 32274 32275 /** 32276 * External dependencies 32277 */ 32278 32279 /** 32280 * WordPress dependencies 32281 */ 32282 32283 32284 32285 /** 32286 * Internal dependencies 32287 */ 32288 32289 32290 32291 32292 const default_block_appender_DefaultBlockAppender = ({ 32293 clientId, 32294 lastBlockClientId 32295 }) => { 32296 return Object(external_wp_element_["createElement"])(default_block_appender, { 32297 rootClientId: clientId, 32298 lastBlockClientId: lastBlockClientId 32299 }); 32300 }; 32301 /* harmony default export */ var inner_blocks_default_block_appender = (Object(external_wp_compose_["compose"])([with_client_id, Object(external_wp_data_["withSelect"])((select, { 32302 clientId 32303 }) => { 32304 const { 32305 getBlockOrder 32306 } = select(store); 32307 const blockClientIds = getBlockOrder(clientId); 32308 return { 32309 lastBlockClientId: Object(external_lodash_["last"])(blockClientIds) 32310 }; 32311 })])(default_block_appender_DefaultBlockAppender)); 32312 32313 // EXTERNAL MODULE: external ["wp","isShallowEqual"] 32314 var external_wp_isShallowEqual_ = __webpack_require__("rl8x"); 32315 var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_); 32316 32317 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js 32318 /** 32319 * WordPress dependencies 32320 */ 32321 32322 32323 32324 /** 32325 * Internal dependencies 32326 */ 32327 32328 32329 /** 32330 * This hook is a side effect which updates the block-editor store when changes 32331 * happen to inner block settings. The given props are transformed into a 32332 * settings object, and if that is different from the current settings object in 32333 * the block-editor store, then the store is updated with the new settings which 32334 * came from props. 32335 * 32336 * @param {string} clientId The client ID of the block to update. 32337 * @param {string[]} allowedBlocks An array of block names which are permitted 32338 * in inner blocks. 32339 * @param {string} [templateLock] The template lock specified for the inner 32340 * blocks component. (e.g. "all") 32341 * @param {boolean} captureToolbars Whether or children toolbars should be shown 32342 * in the inner blocks component rather than on 32343 * the child block. 32344 * @param {string} orientation The direction in which the block 32345 * should face. 32346 */ 32347 32348 function useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureToolbars, orientation) { 32349 const { 32350 updateBlockListSettings 32351 } = Object(external_wp_data_["useDispatch"])(store); 32352 const { 32353 blockListSettings, 32354 parentLock 32355 } = Object(external_wp_data_["useSelect"])(select => { 32356 const rootClientId = select(store).getBlockRootClientId(clientId); 32357 return { 32358 blockListSettings: select(store).getBlockListSettings(clientId), 32359 parentLock: select(store).getTemplateLock(rootClientId) 32360 }; 32361 }, [clientId]); // Memoize as inner blocks implementors often pass a new array on every 32362 // render. 32363 32364 const _allowedBlocks = Object(external_wp_element_["useMemo"])(() => allowedBlocks, allowedBlocks); 32365 32366 Object(external_wp_element_["useLayoutEffect"])(() => { 32367 const newSettings = { 32368 allowedBlocks: _allowedBlocks, 32369 templateLock: templateLock === undefined ? parentLock : templateLock 32370 }; // These values are not defined for RN, so only include them if they 32371 // are defined. 32372 32373 if (captureToolbars !== undefined) { 32374 newSettings.__experimentalCaptureToolbars = captureToolbars; 32375 } 32376 32377 if (orientation !== undefined) { 32378 newSettings.orientation = orientation; 32379 } 32380 32381 if (!external_wp_isShallowEqual_default()(blockListSettings, newSettings)) { 32382 updateBlockListSettings(clientId, newSettings); 32383 } 32384 }, [clientId, blockListSettings, _allowedBlocks, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings]); 32385 } 32386 32387 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-inner-block-template-sync.js 32388 /** 32389 * External dependencies 32390 */ 32391 32392 /** 32393 * WordPress dependencies 32394 */ 32395 32396 32397 32398 32399 /** 32400 * Internal dependencies 32401 */ 32402 32403 32404 /** 32405 * This hook makes sure that a block's inner blocks stay in sync with the given 32406 * block "template". The template is a block hierarchy to which inner blocks must 32407 * conform. If the blocks get "out of sync" with the template and the template 32408 * is meant to be locked (e.g. templateLock = "all"), then we replace the inner 32409 * blocks with the correct value after synchronizing it with the template. 32410 * 32411 * @param {string} clientId The block client ID. 32412 * @param {Object} template The template to match. 32413 * @param {string} templateLock The template lock state for the inner blocks. For 32414 * example, if the template lock is set to "all", 32415 * then the inner blocks will stay in sync with the 32416 * template. If not defined or set to false, then 32417 * the inner blocks will not be synchronized with 32418 * the given template. 32419 * @param {boolean} templateInsertUpdatesSelection Whether or not to update the 32420 * block-editor selection state when inner blocks 32421 * are replaced after template synchronization. 32422 */ 32423 32424 function useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection) { 32425 const { 32426 getSelectedBlocksInitialCaretPosition 32427 } = Object(external_wp_data_["useSelect"])(store); 32428 const { 32429 replaceInnerBlocks 32430 } = Object(external_wp_data_["useDispatch"])(store); 32431 const innerBlocks = Object(external_wp_data_["useSelect"])(select => select(store).getBlocks(clientId), [clientId]); // Maintain a reference to the previous value so we can do a deep equality check. 32432 32433 const existingTemplate = Object(external_wp_element_["useRef"])(null); 32434 Object(external_wp_element_["useLayoutEffect"])(() => { 32435 // Only synchronize innerBlocks with template if innerBlocks are empty or 32436 // a locking all exists directly on the block. 32437 if (innerBlocks.length === 0 || templateLock === 'all') { 32438 const hasTemplateChanged = !Object(external_lodash_["isEqual"])(template, existingTemplate.current); 32439 32440 if (hasTemplateChanged) { 32441 existingTemplate.current = template; 32442 const nextBlocks = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(innerBlocks, template); 32443 32444 if (!Object(external_lodash_["isEqual"])(nextBlocks, innerBlocks)) { 32445 replaceInnerBlocks(clientId, nextBlocks, innerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0, // This ensures the "initialPosition" doesn't change when applying the template 32446 // If we're supposed to focus the block, we'll focus the first inner block 32447 // otherwise, we won't apply any auto-focus. 32448 // This ensures for instance that the focus stays in the inserter when inserting the "buttons" block. 32449 getSelectedBlocksInitialCaretPosition()); 32450 } 32451 } 32452 } 32453 }, [innerBlocks, template, templateLock, clientId]); 32454 } 32455 32456 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/get-block-context.js 32457 /** 32458 * External dependencies 32459 */ 32460 32461 /** 32462 * Block context cache, implemented as a WeakMap mapping block types to a 32463 * WeakMap mapping attributes object to context value. 32464 * 32465 * @type {WeakMap<string,WeakMap<string,*>>} 32466 */ 32467 32468 const BLOCK_CONTEXT_CACHE = new WeakMap(); 32469 /** 32470 * Returns a cached context object value for a given set of attributes for the 32471 * block type. 32472 * 32473 * @param {Record<string,*>} attributes Block attributes object. 32474 * @param {WPBlockType} blockType Block type settings. 32475 * 32476 * @return {Record<string,*>} Context value. 32477 */ 32478 32479 function getBlockContext(attributes, blockType) { 32480 if (!BLOCK_CONTEXT_CACHE.has(blockType)) { 32481 BLOCK_CONTEXT_CACHE.set(blockType, new WeakMap()); 32482 } 32483 32484 const blockTypeCache = BLOCK_CONTEXT_CACHE.get(blockType); 32485 32486 if (!blockTypeCache.has(attributes)) { 32487 const context = Object(external_lodash_["mapValues"])(blockType.providesContext, attributeName => attributes[attributeName]); 32488 blockTypeCache.set(attributes, context); 32489 } 32490 32491 return blockTypeCache.get(attributes); 32492 } 32493 32494 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js 32495 32496 32497 32498 /** 32499 * External dependencies 32500 */ 32501 32502 /** 32503 * WordPress dependencies 32504 */ 32505 32506 32507 32508 32509 32510 /** 32511 * Internal dependencies 32512 */ 32513 32514 32515 32516 32517 32518 32519 32520 32521 32522 32523 32524 32525 /** 32526 * InnerBlocks is a component which allows a single block to have multiple blocks 32527 * as children. The UncontrolledInnerBlocks component is used whenever the inner 32528 * blocks are not controlled by another entity. In other words, it is normally 32529 * used for inner blocks in the post editor 32530 * 32531 * @param {Object} props The component props. 32532 */ 32533 32534 function UncontrolledInnerBlocks(props) { 32535 const { 32536 clientId, 32537 allowedBlocks, 32538 template, 32539 templateLock, 32540 wrapperRef, 32541 templateInsertUpdatesSelection, 32542 __experimentalCaptureToolbars: captureToolbars, 32543 __experimentalAppenderTagName, 32544 renderAppender, 32545 orientation, 32546 placeholder, 32547 __experimentalLayout 32548 } = props; 32549 useNestedSettingsUpdate(clientId, allowedBlocks, templateLock, captureToolbars, orientation); 32550 useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection); 32551 const context = Object(external_wp_data_["useSelect"])(select => { 32552 const block = select(store).getBlock(clientId); 32553 const blockType = Object(external_wp_blocks_["getBlockType"])(block.name); 32554 32555 if (!blockType || !blockType.providesContext) { 32556 return; 32557 } 32558 32559 return getBlockContext(block.attributes, blockType); 32560 }, [clientId]); // This component needs to always be synchronous as it's the one changing 32561 // the async mode depending on the block selection. 32562 32563 return Object(external_wp_element_["createElement"])(BlockContextProvider, { 32564 value: context 32565 }, Object(external_wp_element_["createElement"])(BlockListItems, { 32566 rootClientId: clientId, 32567 renderAppender: renderAppender, 32568 __experimentalAppenderTagName: __experimentalAppenderTagName, 32569 __experimentalLayout: __experimentalLayout, 32570 wrapperRef: wrapperRef, 32571 placeholder: placeholder 32572 })); 32573 } 32574 /** 32575 * The controlled inner blocks component wraps the uncontrolled inner blocks 32576 * component with the blockSync hook. This keeps the innerBlocks of the block in 32577 * the block-editor store in sync with the blocks of the controlling entity. An 32578 * example of an inner block controller is a template part block, which provides 32579 * its own blocks from the template part entity data source. 32580 * 32581 * @param {Object} props The component props. 32582 */ 32583 32584 32585 function ControlledInnerBlocks(props) { 32586 useBlockSync(props); 32587 return Object(external_wp_element_["createElement"])(UncontrolledInnerBlocks, props); 32588 } 32589 32590 const ForwardedInnerBlocks = Object(external_wp_element_["forwardRef"])((props, ref) => { 32591 const innerBlocksProps = useInnerBlocksProps({ 32592 ref 32593 }, props); 32594 return Object(external_wp_element_["createElement"])("div", { 32595 className: "block-editor-inner-blocks" 32596 }, Object(external_wp_element_["createElement"])("div", innerBlocksProps)); 32597 }); 32598 /** 32599 * This hook is used to lightly mark an element as an inner blocks wrapper 32600 * element. Call this hook and pass the returned props to the element to mark as 32601 * an inner blocks wrapper, automatically rendering inner blocks as children. If 32602 * you define a ref for the element, it is important to pass the ref to this 32603 * hook, which the hook in turn will pass to the component through the props it 32604 * returns. Optionally, you can also pass any other props through this hook, and 32605 * they will be merged and returned. 32606 * 32607 * @param {Object} props Optional. Props to pass to the element. Must contain 32608 * the ref if one is defined. 32609 * @param {Object} options Optional. Inner blocks options. 32610 * 32611 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md 32612 */ 32613 32614 function useInnerBlocksProps(props = {}, options = {}) { 32615 const { 32616 clientId 32617 } = useBlockEditContext(); 32618 const isSmallScreen = Object(external_wp_compose_["useViewportMatch"])('medium', '<'); 32619 const hasOverlay = Object(external_wp_data_["useSelect"])(select => { 32620 const { 32621 getBlockName, 32622 isBlockSelected, 32623 hasSelectedInnerBlock, 32624 isNavigationMode 32625 } = select(store); 32626 const enableClickThrough = isNavigationMode() || isSmallScreen; 32627 return getBlockName(clientId) !== 'core/template' && !isBlockSelected(clientId) && !hasSelectedInnerBlock(clientId, true) && enableClickThrough; 32628 }, [clientId, isSmallScreen]); 32629 const ref = Object(external_wp_compose_["useMergeRefs"])([props.ref, useBlockDropZone({ 32630 rootClientId: clientId 32631 })]); 32632 const InnerBlocks = options.value && options.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks; 32633 return { ...props, 32634 ref, 32635 className: classnames_default()(props.className, 'block-editor-block-list__layout', { 32636 'has-overlay': hasOverlay 32637 }), 32638 children: Object(external_wp_element_["createElement"])(InnerBlocks, Object(esm_extends["a" /* default */])({}, options, { 32639 clientId: clientId 32640 })) 32641 }; 32642 } // Expose default appender placeholders as components. 32643 32644 ForwardedInnerBlocks.DefaultBlockAppender = inner_blocks_default_block_appender; 32645 ForwardedInnerBlocks.ButtonBlockAppender = inner_blocks_button_block_appender; 32646 ForwardedInnerBlocks.Content = Object(external_wp_blocks_["withBlockContentContext"])(({ 32647 BlockContent 32648 }) => Object(external_wp_element_["createElement"])(BlockContent, null)); 32649 /** 32650 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md 32651 */ 32652 32653 /* harmony default export */ var inner_blocks = (ForwardedInnerBlocks); 32654 32655 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-left.js 32656 32657 32658 /** 32659 * WordPress dependencies 32660 */ 32661 32662 const justifyLeft = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 32663 xmlns: "http://www.w3.org/2000/svg", 32664 viewBox: "0 0 24 24" 32665 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 32666 d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z" 32667 })); 32668 /* harmony default export */ var justify_left = (justifyLeft); 32669 32670 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-center.js 32671 32672 32673 /** 32674 * WordPress dependencies 32675 */ 32676 32677 const justifyCenter = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 32678 xmlns: "http://www.w3.org/2000/svg", 32679 viewBox: "0 0 24 24" 32680 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 32681 d: "M20 9h-7.2V4h-1.6v5H4v6h7.2v5h1.6v-5H20z" 32682 })); 32683 /* harmony default export */ var justify_center = (justifyCenter); 32684 32685 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-right.js 32686 32687 32688 /** 32689 * WordPress dependencies 32690 */ 32691 32692 const justifyRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 32693 xmlns: "http://www.w3.org/2000/svg", 32694 viewBox: "0 0 24 24" 32695 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 32696 d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z" 32697 })); 32698 /* harmony default export */ var justify_right = (justifyRight); 32699 32700 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js 32701 32702 32703 /** 32704 * WordPress dependencies 32705 */ 32706 32707 const justifySpaceBetween = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 32708 xmlns: "http://www.w3.org/2000/svg", 32709 viewBox: "0 0 24 24" 32710 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 32711 d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z" 32712 })); 32713 /* harmony default export */ var justify_space_between = (justifySpaceBetween); 32714 32715 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/ui.js 32716 32717 32718 32719 /** 32720 * WordPress dependencies 32721 */ 32722 32723 32724 32725 const icons = { 32726 left: justify_left, 32727 center: justify_center, 32728 right: justify_right, 32729 'space-between': justify_space_between 32730 }; 32731 32732 function JustifyContentUI({ 32733 allowedControls = ['left', 'center', 'right', 'space-between'], 32734 isCollapsed = true, 32735 onChange, 32736 value, 32737 popoverProps, 32738 isToolbar 32739 }) { 32740 // If the control is already selected we want a click 32741 // again on the control to deselect the item, so we 32742 // call onChange( undefined ) 32743 const handleClick = next => { 32744 if (next === value) { 32745 onChange(undefined); 32746 } else { 32747 onChange(next); 32748 } 32749 }; 32750 32751 const icon = value ? icons[value] : icons.left; 32752 const allControls = [{ 32753 name: 'left', 32754 icon: justify_left, 32755 title: Object(external_wp_i18n_["__"])('Justify items left'), 32756 isActive: 'left' === value, 32757 onClick: () => handleClick('left') 32758 }, { 32759 name: 'center', 32760 icon: justify_center, 32761 title: Object(external_wp_i18n_["__"])('Justify items center'), 32762 isActive: 'center' === value, 32763 onClick: () => handleClick('center') 32764 }, { 32765 name: 'right', 32766 icon: justify_right, 32767 title: Object(external_wp_i18n_["__"])('Justify items right'), 32768 isActive: 'right' === value, 32769 onClick: () => handleClick('right') 32770 }, { 32771 name: 'space-between', 32772 icon: justify_space_between, 32773 title: Object(external_wp_i18n_["__"])('Space between items'), 32774 isActive: 'space-between' === value, 32775 onClick: () => handleClick('space-between') 32776 }]; 32777 const UIComponent = isToolbar ? external_wp_components_["ToolbarGroup"] : external_wp_components_["ToolbarDropdownMenu"]; 32778 const extraProps = isToolbar ? { 32779 isCollapsed 32780 } : {}; 32781 return Object(external_wp_element_["createElement"])(UIComponent, Object(esm_extends["a" /* default */])({ 32782 icon: icon, 32783 popoverProps: popoverProps, 32784 label: Object(external_wp_i18n_["__"])('Change items justification'), 32785 controls: allControls.filter(elem => allowedControls.includes(elem.name)) 32786 }, extraProps)); 32787 } 32788 32789 /* harmony default export */ var justify_content_control_ui = (JustifyContentUI); 32790 32791 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/justify-content-control/index.js 32792 32793 32794 32795 /** 32796 * Internal dependencies 32797 */ 32798 32799 function JustifyContentControl(props) { 32800 return Object(external_wp_element_["createElement"])(justify_content_control_ui, Object(esm_extends["a" /* default */])({}, props, { 32801 isToolbar: false 32802 })); 32803 } 32804 function JustifyToolbar(props) { 32805 return Object(external_wp_element_["createElement"])(justify_content_control_ui, Object(esm_extends["a" /* default */])({}, props, { 32806 isToolbar: true 32807 })); 32808 } 32809 32810 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js 32811 var keyboard_return = __webpack_require__("btIw"); 32812 32813 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js 32814 32815 32816 /** 32817 * External dependencies 32818 */ 32819 32820 /** 32821 * WordPress dependencies 32822 */ 32823 32824 32825 32826 const defaultSettings = [{ 32827 id: 'opensInNewTab', 32828 title: Object(external_wp_i18n_["__"])('Open in new tab') 32829 }]; 32830 32831 const LinkControlSettingsDrawer = ({ 32832 value, 32833 onChange = external_lodash_["noop"], 32834 settings = defaultSettings 32835 }) => { 32836 if (!settings || !settings.length) { 32837 return null; 32838 } 32839 32840 const handleSettingChange = setting => newValue => { 32841 onChange({ ...value, 32842 [setting.id]: newValue 32843 }); 32844 }; 32845 32846 const theSettings = settings.map(setting => Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { 32847 className: "block-editor-link-control__setting", 32848 key: setting.id, 32849 label: setting.title, 32850 onChange: handleSettingChange(setting), 32851 checked: value ? !!value[setting.id] : false 32852 })); 32853 return Object(external_wp_element_["createElement"])("fieldset", { 32854 className: "block-editor-link-control__settings" 32855 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 32856 as: "legend" 32857 }, Object(external_wp_i18n_["__"])('Currently selected link settings')), theSettings); 32858 }; 32859 32860 /* harmony default export */ var settings_drawer = (LinkControlSettingsDrawer); 32861 32862 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js 32863 32864 32865 32866 /** 32867 * External dependencies 32868 */ 32869 32870 32871 32872 /** 32873 * WordPress dependencies 32874 */ 32875 32876 32877 32878 32879 32880 32881 32882 32883 /** 32884 * Internal dependencies 32885 */ 32886 32887 32888 32889 class url_input_URLInput extends external_wp_element_["Component"] { 32890 constructor(props) { 32891 super(props); 32892 this.onChange = this.onChange.bind(this); 32893 this.onFocus = this.onFocus.bind(this); 32894 this.onKeyDown = this.onKeyDown.bind(this); 32895 this.selectLink = this.selectLink.bind(this); 32896 this.handleOnClick = this.handleOnClick.bind(this); 32897 this.bindSuggestionNode = this.bindSuggestionNode.bind(this); 32898 this.autocompleteRef = props.autocompleteRef || Object(external_wp_element_["createRef"])(); 32899 this.inputRef = Object(external_wp_element_["createRef"])(); 32900 this.updateSuggestions = Object(external_lodash_["debounce"])(this.updateSuggestions.bind(this), 200); 32901 this.suggestionNodes = []; 32902 this.isUpdatingSuggestions = false; 32903 this.state = { 32904 suggestions: [], 32905 showSuggestions: false, 32906 selectedSuggestion: null, 32907 suggestionsListboxId: '', 32908 suggestionOptionIdPrefix: '' 32909 }; 32910 } 32911 32912 componentDidUpdate(prevProps) { 32913 const { 32914 showSuggestions, 32915 selectedSuggestion 32916 } = this.state; 32917 const { 32918 value 32919 } = this.props; // only have to worry about scrolling selected suggestion into view 32920 // when already expanded 32921 32922 if (showSuggestions && selectedSuggestion !== null && this.suggestionNodes[selectedSuggestion] && !this.scrollingIntoView) { 32923 this.scrollingIntoView = true; 32924 dom_scroll_into_view_lib_default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, { 32925 onlyScrollIfNeeded: true 32926 }); 32927 this.props.setTimeout(() => { 32928 this.scrollingIntoView = false; 32929 }, 100); 32930 } // Only attempt an update on suggestions if the input value has actually changed. 32931 32932 32933 if (prevProps.value !== value && this.shouldShowInitialSuggestions()) { 32934 this.updateSuggestions(); 32935 } 32936 } 32937 32938 componentDidMount() { 32939 if (this.shouldShowInitialSuggestions()) { 32940 this.updateSuggestions(); 32941 } 32942 } 32943 32944 componentWillUnmount() { 32945 var _this$suggestionsRequ, _this$suggestionsRequ2; 32946 32947 (_this$suggestionsRequ = this.suggestionsRequest) === null || _this$suggestionsRequ === void 0 ? void 0 : (_this$suggestionsRequ2 = _this$suggestionsRequ.cancel) === null || _this$suggestionsRequ2 === void 0 ? void 0 : _this$suggestionsRequ2.call(_this$suggestionsRequ); 32948 delete this.suggestionsRequest; 32949 } 32950 32951 bindSuggestionNode(index) { 32952 return ref => { 32953 this.suggestionNodes[index] = ref; 32954 }; 32955 } 32956 32957 shouldShowInitialSuggestions() { 32958 const { 32959 suggestions 32960 } = this.state; 32961 const { 32962 __experimentalShowInitialSuggestions = false, 32963 value 32964 } = this.props; 32965 return !this.isUpdatingSuggestions && __experimentalShowInitialSuggestions && !(value && value.length) && !(suggestions && suggestions.length); 32966 } 32967 32968 updateSuggestions(value = '') { 32969 const { 32970 __experimentalFetchLinkSuggestions: fetchLinkSuggestions, 32971 __experimentalHandleURLSuggestions: handleURLSuggestions 32972 } = this.props; 32973 32974 if (!fetchLinkSuggestions) { 32975 return; 32976 } 32977 32978 const isInitialSuggestions = !(value && value.length); // Allow a suggestions request if: 32979 // - there are at least 2 characters in the search input (except manual searches where 32980 // search input length is not required to trigger a fetch) 32981 // - this is a direct entry (eg: a URL) 32982 32983 if (!isInitialSuggestions && (value.length < 2 || !handleURLSuggestions && Object(external_wp_url_["isURL"])(value))) { 32984 this.setState({ 32985 showSuggestions: false, 32986 selectedSuggestion: null, 32987 loading: false 32988 }); 32989 return; 32990 } 32991 32992 this.isUpdatingSuggestions = true; 32993 this.setState({ 32994 selectedSuggestion: null, 32995 loading: true 32996 }); 32997 const request = fetchLinkSuggestions(value, { 32998 isInitialSuggestions 32999 }); 33000 request.then(suggestions => { 33001 // A fetch Promise doesn't have an abort option. It's mimicked by 33002 // comparing the request reference in on the instance, which is 33003 // reset or deleted on subsequent requests or unmounting. 33004 if (this.suggestionsRequest !== request) { 33005 return; 33006 } 33007 33008 this.setState({ 33009 suggestions, 33010 loading: false, 33011 showSuggestions: !!suggestions.length 33012 }); 33013 33014 if (!!suggestions.length) { 33015 this.props.debouncedSpeak(Object(external_wp_i18n_["sprintf"])( 33016 /* translators: %s: number of results. */ 33017 Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', suggestions.length), suggestions.length), 'assertive'); 33018 } else { 33019 this.props.debouncedSpeak(Object(external_wp_i18n_["__"])('No results.'), 'assertive'); 33020 } 33021 33022 this.isUpdatingSuggestions = false; 33023 }).catch(() => { 33024 if (this.suggestionsRequest === request) { 33025 this.setState({ 33026 loading: false 33027 }); 33028 this.isUpdatingSuggestions = false; 33029 } 33030 }); // Note that this assignment is handled *before* the async search request 33031 // as a Promise always resolves on the next tick of the event loop. 33032 33033 this.suggestionsRequest = request; 33034 } 33035 33036 onChange(event) { 33037 const inputValue = event.target.value; 33038 this.props.onChange(inputValue); 33039 33040 if (!this.props.disableSuggestions) { 33041 this.updateSuggestions(inputValue.trim()); 33042 } 33043 } 33044 33045 onFocus() { 33046 const { 33047 suggestions 33048 } = this.state; 33049 const { 33050 disableSuggestions, 33051 value 33052 } = this.props; // When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value 33053 // Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons) 33054 33055 if (value && !disableSuggestions && !this.isUpdatingSuggestions && !(suggestions && suggestions.length)) { 33056 // Ensure the suggestions are updated with the current input value 33057 this.updateSuggestions(value.trim()); 33058 } 33059 } 33060 33061 onKeyDown(event) { 33062 const { 33063 showSuggestions, 33064 selectedSuggestion, 33065 suggestions, 33066 loading 33067 } = this.state; // If the suggestions are not shown or loading, we shouldn't handle the arrow keys 33068 // We shouldn't preventDefault to allow block arrow keys navigation 33069 33070 if (!showSuggestions || !suggestions.length || loading) { 33071 // In the Windows version of Firefox the up and down arrows don't move the caret 33072 // within an input field like they do for Mac Firefox/Chrome/Safari. This causes 33073 // a form of focus trapping that is disruptive to the user experience. This disruption 33074 // only happens if the caret is not in the first or last position in the text input. 33075 // See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747 33076 switch (event.keyCode) { 33077 // When UP is pressed, if the caret is at the start of the text, move it to the 0 33078 // position. 33079 case external_wp_keycodes_["UP"]: 33080 { 33081 if (0 !== event.target.selectionStart) { 33082 event.stopPropagation(); 33083 event.preventDefault(); // Set the input caret to position 0 33084 33085 event.target.setSelectionRange(0, 0); 33086 } 33087 33088 break; 33089 } 33090 // When DOWN is pressed, if the caret is not at the end of the text, move it to the 33091 // last position. 33092 33093 case external_wp_keycodes_["DOWN"]: 33094 { 33095 if (this.props.value.length !== event.target.selectionStart) { 33096 event.stopPropagation(); 33097 event.preventDefault(); // Set the input caret to the last position 33098 33099 event.target.setSelectionRange(this.props.value.length, this.props.value.length); 33100 } 33101 33102 break; 33103 } 33104 } 33105 33106 return; 33107 } 33108 33109 const suggestion = this.state.suggestions[this.state.selectedSuggestion]; 33110 33111 switch (event.keyCode) { 33112 case external_wp_keycodes_["UP"]: 33113 { 33114 event.stopPropagation(); 33115 event.preventDefault(); 33116 const previousIndex = !selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1; 33117 this.setState({ 33118 selectedSuggestion: previousIndex 33119 }); 33120 break; 33121 } 33122 33123 case external_wp_keycodes_["DOWN"]: 33124 { 33125 event.stopPropagation(); 33126 event.preventDefault(); 33127 const nextIndex = selectedSuggestion === null || selectedSuggestion === suggestions.length - 1 ? 0 : selectedSuggestion + 1; 33128 this.setState({ 33129 selectedSuggestion: nextIndex 33130 }); 33131 break; 33132 } 33133 33134 case external_wp_keycodes_["TAB"]: 33135 { 33136 if (this.state.selectedSuggestion !== null) { 33137 this.selectLink(suggestion); // Announce a link has been selected when tabbing away from the input field. 33138 33139 this.props.speak(Object(external_wp_i18n_["__"])('Link selected.')); 33140 } 33141 33142 break; 33143 } 33144 33145 case external_wp_keycodes_["ENTER"]: 33146 { 33147 if (this.state.selectedSuggestion !== null) { 33148 event.stopPropagation(); 33149 this.selectLink(suggestion); 33150 } 33151 33152 break; 33153 } 33154 } 33155 } 33156 33157 selectLink(suggestion) { 33158 this.props.onChange(suggestion.url, suggestion); 33159 this.setState({ 33160 selectedSuggestion: null, 33161 showSuggestions: false 33162 }); 33163 } 33164 33165 handleOnClick(suggestion) { 33166 this.selectLink(suggestion); // Move focus to the input field when a link suggestion is clicked. 33167 33168 this.inputRef.current.focus(); 33169 } 33170 33171 static getDerivedStateFromProps({ 33172 value, 33173 instanceId, 33174 disableSuggestions, 33175 __experimentalShowInitialSuggestions = false 33176 }, { 33177 showSuggestions 33178 }) { 33179 let shouldShowSuggestions = showSuggestions; 33180 const hasValue = value && value.length; 33181 33182 if (!__experimentalShowInitialSuggestions && !hasValue) { 33183 shouldShowSuggestions = false; 33184 } 33185 33186 if (disableSuggestions === true) { 33187 shouldShowSuggestions = false; 33188 } 33189 33190 return { 33191 showSuggestions: shouldShowSuggestions, 33192 suggestionsListboxId: `block-editor-url-input-suggestions-${instanceId}`, 33193 suggestionOptionIdPrefix: `block-editor-url-input-suggestion-${instanceId}` 33194 }; 33195 } 33196 33197 render() { 33198 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, this.renderControl(), this.renderSuggestions()); 33199 } 33200 33201 renderControl() { 33202 const { 33203 label, 33204 className, 33205 isFullWidth, 33206 instanceId, 33207 placeholder = Object(external_wp_i18n_["__"])('Paste URL or type to search'), 33208 __experimentalRenderControl: renderControl, 33209 value = '' 33210 } = this.props; 33211 const { 33212 loading, 33213 showSuggestions, 33214 selectedSuggestion, 33215 suggestionsListboxId, 33216 suggestionOptionIdPrefix 33217 } = this.state; 33218 const controlProps = { 33219 id: `url-input-control-${instanceId}`, 33220 label, 33221 className: classnames_default()('block-editor-url-input', className, { 33222 'is-full-width': isFullWidth 33223 }) 33224 }; 33225 const inputProps = { 33226 value, 33227 required: true, 33228 className: 'block-editor-url-input__input', 33229 type: 'text', 33230 onChange: this.onChange, 33231 onFocus: this.onFocus, 33232 placeholder, 33233 onKeyDown: this.onKeyDown, 33234 role: 'combobox', 33235 'aria-label': Object(external_wp_i18n_["__"])('URL'), 33236 'aria-expanded': showSuggestions, 33237 'aria-autocomplete': 'list', 33238 'aria-owns': suggestionsListboxId, 33239 'aria-activedescendant': selectedSuggestion !== null ? `${suggestionOptionIdPrefix}-${selectedSuggestion}` : undefined, 33240 ref: this.inputRef 33241 }; 33242 33243 if (renderControl) { 33244 return renderControl(controlProps, inputProps, loading); 33245 } 33246 33247 return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], controlProps, Object(external_wp_element_["createElement"])("input", inputProps), loading && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)); 33248 } 33249 33250 renderSuggestions() { 33251 const { 33252 className, 33253 __experimentalRenderSuggestions: renderSuggestions, 33254 value = '', 33255 __experimentalShowInitialSuggestions = false 33256 } = this.props; 33257 const { 33258 showSuggestions, 33259 suggestions, 33260 selectedSuggestion, 33261 suggestionsListboxId, 33262 suggestionOptionIdPrefix, 33263 loading 33264 } = this.state; 33265 const suggestionsListProps = { 33266 id: suggestionsListboxId, 33267 ref: this.autocompleteRef, 33268 role: 'listbox' 33269 }; 33270 33271 const buildSuggestionItemProps = (suggestion, index) => { 33272 return { 33273 role: 'option', 33274 tabIndex: '-1', 33275 id: `${suggestionOptionIdPrefix}-${index}`, 33276 ref: this.bindSuggestionNode(index), 33277 'aria-selected': index === selectedSuggestion 33278 }; 33279 }; 33280 33281 if (Object(external_lodash_["isFunction"])(renderSuggestions) && showSuggestions && !!suggestions.length) { 33282 return renderSuggestions({ 33283 suggestions, 33284 selectedSuggestion, 33285 suggestionsListProps, 33286 buildSuggestionItemProps, 33287 isLoading: loading, 33288 handleSuggestionClick: this.handleOnClick, 33289 isInitialSuggestions: __experimentalShowInitialSuggestions && !(value && value.length) 33290 }); 33291 } 33292 33293 if (!Object(external_lodash_["isFunction"])(renderSuggestions) && showSuggestions && !!suggestions.length) { 33294 return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { 33295 position: "bottom", 33296 noArrow: true, 33297 focusOnMount: false 33298 }, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, suggestionsListProps, { 33299 className: classnames_default()('block-editor-url-input__suggestions', `${className}__suggestions`) 33300 }), suggestions.map((suggestion, index) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, buildSuggestionItemProps(suggestion, index), { 33301 key: suggestion.id, 33302 className: classnames_default()('block-editor-url-input__suggestion', { 33303 'is-selected': index === selectedSuggestion 33304 }), 33305 onClick: () => this.handleOnClick(suggestion) 33306 }), suggestion.title)))); 33307 } 33308 33309 return null; 33310 } 33311 33312 } 33313 /** 33314 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md 33315 */ 33316 33317 33318 /* harmony default export */ var url_input = (Object(external_wp_compose_["compose"])(external_wp_compose_["withSafeTimeout"], external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_data_["withSelect"])((select, props) => { 33319 // If a link suggestions handler is already provided then 33320 // bail 33321 if (Object(external_lodash_["isFunction"])(props.__experimentalFetchLinkSuggestions)) { 33322 return; 33323 } 33324 33325 const { 33326 getSettings 33327 } = select(store); 33328 return { 33329 __experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions 33330 }; 33331 }))(url_input_URLInput)); 33332 33333 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js 33334 33335 33336 33337 /** 33338 * External dependencies 33339 */ 33340 33341 33342 /** 33343 * WordPress dependencies 33344 */ 33345 33346 33347 33348 33349 33350 const LinkControlSearchCreate = ({ 33351 searchTerm, 33352 onClick, 33353 itemProps, 33354 isSelected, 33355 buttonText 33356 }) => { 33357 if (!searchTerm) { 33358 return null; 33359 } 33360 33361 let text; 33362 33363 if (buttonText) { 33364 text = Object(external_lodash_["isFunction"])(buttonText) ? buttonText(searchTerm) : buttonText; 33365 } else { 33366 text = Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["sprintf"])( 33367 /* translators: %s: search term. */ 33368 Object(external_wp_i18n_["__"])('Create: <mark>%s</mark>'), searchTerm), { 33369 mark: Object(external_wp_element_["createElement"])("mark", null) 33370 }); 33371 } 33372 33373 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, itemProps, { 33374 className: classnames_default()('block-editor-link-control__search-create block-editor-link-control__search-item', { 33375 'is-selected': isSelected 33376 }), 33377 onClick: onClick 33378 }), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 33379 className: "block-editor-link-control__search-item-icon", 33380 icon: plus["a" /* default */] 33381 }), Object(external_wp_element_["createElement"])("span", { 33382 className: "block-editor-link-control__search-item-header" 33383 }, Object(external_wp_element_["createElement"])("span", { 33384 className: "block-editor-link-control__search-item-title" 33385 }, text))); 33386 }; 33387 /* harmony default export */ var search_create_button = (LinkControlSearchCreate); 33388 33389 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js 33390 33391 33392 /** 33393 * WordPress dependencies 33394 */ 33395 33396 const globe = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { 33397 xmlns: "http://www.w3.org/2000/svg", 33398 viewBox: "-2 -2 24 24" 33399 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { 33400 d: "M9 0C4.03 0 0 4.03 0 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zM1.11 9.68h2.51c.04.91.167 1.814.38 2.7H1.84c-.403-.85-.65-1.764-.73-2.7zm8.57-5.4V1.19c.964.366 1.756 1.08 2.22 2 .205.347.386.708.54 1.08l-2.76.01zm3.22 1.35c.232.883.37 1.788.41 2.7H9.68v-2.7h3.22zM8.32 1.19v3.09H5.56c.154-.372.335-.733.54-1.08.462-.924 1.255-1.64 2.22-2.01zm0 4.44v2.7H4.7c.04-.912.178-1.817.41-2.7h3.21zm-4.7 2.69H1.11c.08-.936.327-1.85.73-2.7H4c-.213.886-.34 1.79-.38 2.7zM4.7 9.68h3.62v2.7H5.11c-.232-.883-.37-1.788-.41-2.7zm3.63 4v3.09c-.964-.366-1.756-1.08-2.22-2-.205-.347-.386-.708-.54-1.08l2.76-.01zm1.35 3.09v-3.04h2.76c-.154.372-.335.733-.54 1.08-.464.92-1.256 1.634-2.22 2v-.04zm0-4.44v-2.7h3.62c-.04.912-.178 1.817-.41 2.7H9.68zm4.71-2.7h2.51c-.08.936-.327 1.85-.73 2.7H14c.21-.87.337-1.757.38-2.65l.01-.05zm0-1.35c-.046-.894-.176-1.78-.39-2.65h2.16c.403.85.65 1.764.73 2.7l-2.5-.05zm1-4H13.6c-.324-.91-.793-1.76-1.39-2.52 1.244.56 2.325 1.426 3.14 2.52h.04zm-9.6-2.52c-.597.76-1.066 1.61-1.39 2.52H2.65c.815-1.094 1.896-1.96 3.14-2.52zm-3.15 12H4.4c.324.91.793 1.76 1.39 2.52-1.248-.567-2.33-1.445-3.14-2.55l-.01.03zm9.56 2.52c.597-.76 1.066-1.61 1.39-2.52h1.76c-.82 1.08-1.9 1.933-3.14 2.48l-.01.04z" 33401 })); 33402 /* harmony default export */ var library_globe = (globe); 33403 33404 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js 33405 33406 33407 33408 /** 33409 * External dependencies 33410 */ 33411 33412 /** 33413 * WordPress dependencies 33414 */ 33415 33416 33417 33418 33419 33420 const LinkControlSearchItem = ({ 33421 itemProps, 33422 suggestion, 33423 isSelected = false, 33424 onClick, 33425 isURL = false, 33426 searchTerm = '', 33427 shouldShowType = false 33428 }) => { 33429 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, itemProps, { 33430 onClick: onClick, 33431 className: classnames_default()('block-editor-link-control__search-item', { 33432 'is-selected': isSelected, 33433 'is-url': isURL, 33434 'is-entity': !isURL 33435 }) 33436 }), isURL && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 33437 className: "block-editor-link-control__search-item-icon", 33438 icon: library_globe 33439 }), Object(external_wp_element_["createElement"])("span", { 33440 className: "block-editor-link-control__search-item-header" 33441 }, Object(external_wp_element_["createElement"])("span", { 33442 className: "block-editor-link-control__search-item-title" 33443 }, Object(external_wp_element_["createElement"])(external_wp_components_["TextHighlight"], { 33444 text: suggestion.title, 33445 highlight: searchTerm 33446 })), Object(external_wp_element_["createElement"])("span", { 33447 "aria-hidden": !isURL, 33448 className: "block-editor-link-control__search-item-info" 33449 }, !isURL && (Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(suggestion.url)) || ''), isURL && Object(external_wp_i18n_["__"])('Press ENTER to add this link'))), shouldShowType && suggestion.type && Object(external_wp_element_["createElement"])("span", { 33450 className: "block-editor-link-control__search-item-type" 33451 }, suggestion.type === 'post_tag' ? 'tag' : suggestion.type)); 33452 }; 33453 /* harmony default export */ var search_item = (LinkControlSearchItem); 33454 33455 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/constants.js 33456 // Used as a unique identifier for the "Create" option within search results. 33457 // Used to help distinguish the "Create" suggestion within the search results in 33458 // order to handle it as a unique case. 33459 const CREATE_TYPE = '__CREATE__'; 33460 33461 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-results.js 33462 33463 33464 /** 33465 * WordPress dependencies 33466 */ 33467 33468 33469 /** 33470 * External dependencies 33471 */ 33472 33473 33474 33475 /** 33476 * Internal dependencies 33477 */ 33478 33479 33480 33481 33482 function LinkControlSearchResults({ 33483 instanceId, 33484 withCreateSuggestion, 33485 currentInputValue, 33486 handleSuggestionClick, 33487 suggestionsListProps, 33488 buildSuggestionItemProps, 33489 suggestions, 33490 selectedSuggestion, 33491 isLoading, 33492 isInitialSuggestions, 33493 createSuggestionButtonText, 33494 suggestionsQuery 33495 }) { 33496 const resultsListClasses = classnames_default()('block-editor-link-control__search-results', { 33497 'is-loading': isLoading 33498 }); 33499 const directLinkEntryTypes = ['url', 'mailto', 'tel', 'internal']; 33500 const isSingleDirectEntryResult = suggestions.length === 1 && directLinkEntryTypes.includes(suggestions[0].type.toLowerCase()); 33501 const shouldShowCreateSuggestion = withCreateSuggestion && !isSingleDirectEntryResult && !isInitialSuggestions; // If the query has a specified type, then we can skip showing them in the result. See #24839. 33502 33503 const shouldShowSuggestionsTypes = !(suggestionsQuery !== null && suggestionsQuery !== void 0 && suggestionsQuery.type); // According to guidelines aria-label should be added if the label 33504 // itself is not visible. 33505 // See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role 33506 33507 const searchResultsLabelId = `block-editor-link-control-search-results-label-${instanceId}`; 33508 const labelText = isInitialSuggestions ? Object(external_wp_i18n_["__"])('Recently updated') : Object(external_wp_i18n_["sprintf"])( 33509 /* translators: %s: search term. */ 33510 Object(external_wp_i18n_["__"])('Search results for "%s"'), currentInputValue); // VisuallyHidden rightly doesn't accept custom classNames 33511 // so we conditionally render it as a wrapper to visually hide the label 33512 // when that is required. 33513 33514 const searchResultsLabel = Object(external_wp_element_["createElement"])(isInitialSuggestions ? external_wp_element_["Fragment"] : external_wp_components_["VisuallyHidden"], {}, // empty props 33515 Object(external_wp_element_["createElement"])("span", { 33516 className: "block-editor-link-control__search-results-label", 33517 id: searchResultsLabelId 33518 }, labelText)); 33519 return Object(external_wp_element_["createElement"])("div", { 33520 className: "block-editor-link-control__search-results-wrapper" 33521 }, searchResultsLabel, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, suggestionsListProps, { 33522 className: resultsListClasses, 33523 "aria-labelledby": searchResultsLabelId 33524 }), suggestions.map((suggestion, index) => { 33525 if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) { 33526 return Object(external_wp_element_["createElement"])(search_create_button, { 33527 searchTerm: currentInputValue, 33528 buttonText: createSuggestionButtonText, 33529 onClick: () => handleSuggestionClick(suggestion) // Intentionally only using `type` here as 33530 // the constant is enough to uniquely 33531 // identify the single "CREATE" suggestion. 33532 , 33533 key: suggestion.type, 33534 itemProps: buildSuggestionItemProps(suggestion, index), 33535 isSelected: index === selectedSuggestion 33536 }); 33537 } // If we're not handling "Create" suggestions above then 33538 // we don't want them in the main results so exit early 33539 33540 33541 if (CREATE_TYPE === suggestion.type) { 33542 return null; 33543 } 33544 33545 return Object(external_wp_element_["createElement"])(search_item, { 33546 key: `${suggestion.id}-${suggestion.type}`, 33547 itemProps: buildSuggestionItemProps(suggestion, index), 33548 suggestion: suggestion, 33549 index: index, 33550 onClick: () => { 33551 handleSuggestionClick(suggestion); 33552 }, 33553 isSelected: index === selectedSuggestion, 33554 isURL: directLinkEntryTypes.includes(suggestion.type.toLowerCase()), 33555 searchTerm: currentInputValue, 33556 shouldShowType: shouldShowSuggestionsTypes 33557 }); 33558 }))); 33559 } 33560 33561 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js 33562 /** 33563 * External dependencies 33564 */ 33565 33566 /** 33567 * WordPress dependencies 33568 */ 33569 33570 33571 /** 33572 * Determines whether a given value could be a URL. Note this does not 33573 * guarantee the value is a URL only that it looks like it might be one. For 33574 * example, just because a string has `www.` in it doesn't make it a URL, 33575 * but it does make it highly likely that it will be so in the context of 33576 * creating a link it makes sense to treat it like one. 33577 * 33578 * @param {string} val the candidate for being URL-like (or not). 33579 * @return {boolean} whether or not the value is potentially a URL. 33580 */ 33581 33582 function isURLLike(val) { 33583 const isInternal = Object(external_lodash_["startsWith"])(val, '#'); 33584 return Object(external_wp_url_["isURL"])(val) || val && val.includes('www.') || isInternal; 33585 } 33586 33587 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js 33588 /** 33589 * WordPress dependencies 33590 */ 33591 33592 33593 33594 /** 33595 * External dependencies 33596 */ 33597 33598 33599 /** 33600 * Internal dependencies 33601 */ 33602 33603 33604 33605 33606 const handleNoop = () => Promise.resolve([]); 33607 const handleDirectEntry = val => { 33608 let type = 'URL'; 33609 const protocol = Object(external_wp_url_["getProtocol"])(val) || ''; 33610 33611 if (protocol.includes('mailto')) { 33612 type = 'mailto'; 33613 } 33614 33615 if (protocol.includes('tel')) { 33616 type = 'tel'; 33617 } 33618 33619 if (Object(external_lodash_["startsWith"])(val, '#')) { 33620 type = 'internal'; 33621 } 33622 33623 return Promise.resolve([{ 33624 id: val, 33625 title: val, 33626 url: type === 'URL' ? Object(external_wp_url_["prependHTTP"])(val) : val, 33627 type 33628 }]); 33629 }; 33630 33631 const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion) => { 33632 const { 33633 isInitialSuggestions 33634 } = suggestionsQuery; 33635 let results = await Promise.all([fetchSearchSuggestions(val, suggestionsQuery), directEntryHandler(val)]); 33636 const couldBeURL = !val.includes(' '); // If it's potentially a URL search then concat on a URL search suggestion 33637 // just for good measure. That way once the actual results run out we always 33638 // have a URL option to fallback on. 33639 33640 if (couldBeURL && withURLSuggestion && !isInitialSuggestions) { 33641 results = results[0].concat(results[1]); 33642 } else { 33643 results = results[0]; 33644 } // If displaying initial suggestions just return plain results. 33645 33646 33647 if (isInitialSuggestions) { 33648 return results; 33649 } // Here we append a faux suggestion to represent a "CREATE" option. This 33650 // is detected in the rendering of the search results and handled as a 33651 // special case. This is currently necessary because the suggestions 33652 // dropdown will only appear if there are valid suggestions and 33653 // therefore unless the create option is a suggestion it will not 33654 // display in scenarios where there are no results returned from the 33655 // API. In addition promoting CREATE to a first class suggestion affords 33656 // the a11y benefits afforded by `URLInput` to all suggestions (eg: 33657 // keyboard handling, ARIA roles...etc). 33658 // 33659 // Note also that the value of the `title` and `url` properties must correspond 33660 // to the text value of the `<input>`. This is because `title` is used 33661 // when creating the suggestion. Similarly `url` is used when using keyboard to select 33662 // the suggestion (the <form> `onSubmit` handler falls-back to `url`). 33663 33664 33665 return isURLLike(val) || !withCreateSuggestion ? results : results.concat({ 33666 // the `id` prop is intentionally ommitted here because it 33667 // is never exposed as part of the component's public API. 33668 // see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316. 33669 title: val, 33670 // must match the existing `<input>`s text value 33671 url: val, 33672 // must match the existing `<input>`s text value 33673 type: CREATE_TYPE 33674 }); 33675 }; 33676 33677 function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion) { 33678 const { 33679 fetchSearchSuggestions 33680 } = Object(external_wp_data_["useSelect"])(select => { 33681 const { 33682 getSettings 33683 } = select(store); 33684 return { 33685 fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions 33686 }; 33687 }, []); 33688 const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop; 33689 return Object(external_wp_element_["useCallback"])((val, { 33690 isInitialSuggestions 33691 }) => { 33692 return isURLLike(val) ? directEntryHandler(val, { 33693 isInitialSuggestions 33694 }) : handleEntitySearch(val, { ...suggestionsQuery, 33695 isInitialSuggestions 33696 }, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion); 33697 }, [directEntryHandler, fetchSearchSuggestions, withCreateSuggestion]); 33698 } 33699 33700 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js 33701 33702 33703 /** 33704 * External dependencies 33705 */ 33706 33707 /** 33708 * WordPress dependencies 33709 */ 33710 33711 33712 33713 33714 /** 33715 * Internal dependencies 33716 */ 33717 33718 33719 33720 33721 33722 const noopSearchHandler = Promise.resolve([]); 33723 const LinkControlSearchInput = Object(external_wp_element_["forwardRef"])(({ 33724 value, 33725 children, 33726 currentLink = {}, 33727 className = null, 33728 placeholder = null, 33729 withCreateSuggestion = false, 33730 onCreateSuggestion = external_lodash_["noop"], 33731 onChange = external_lodash_["noop"], 33732 onSelect = external_lodash_["noop"], 33733 showSuggestions = true, 33734 renderSuggestions = props => Object(external_wp_element_["createElement"])(LinkControlSearchResults, props), 33735 fetchSuggestions = null, 33736 allowDirectEntry = true, 33737 showInitialSuggestions = false, 33738 suggestionsQuery = {}, 33739 withURLSuggestion = true, 33740 createSuggestionButtonText 33741 }, ref) => { 33742 const genericSearchHandler = useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion); 33743 const searchHandler = showSuggestions ? fetchSuggestions || genericSearchHandler : noopSearchHandler; 33744 const instanceId = Object(external_wp_compose_["useInstanceId"])(LinkControlSearchInput); 33745 const [focusedSuggestion, setFocusedSuggestion] = Object(external_wp_element_["useState"])(); 33746 /** 33747 * Handles the user moving between different suggestions. Does not handle 33748 * choosing an individual item. 33749 * 33750 * @param {string} selection the url of the selected suggestion. 33751 * @param {Object} suggestion the suggestion object. 33752 */ 33753 33754 const onInputChange = (selection, suggestion) => { 33755 onChange(selection); 33756 setFocusedSuggestion(suggestion); 33757 }; 33758 33759 const onFormSubmit = event => { 33760 event.preventDefault(); 33761 onSuggestionSelected(focusedSuggestion || { 33762 url: value 33763 }); 33764 }; 33765 33766 const handleRenderSuggestions = props => renderSuggestions({ ...props, 33767 instanceId, 33768 withCreateSuggestion, 33769 currentInputValue: value, 33770 createSuggestionButtonText, 33771 suggestionsQuery, 33772 handleSuggestionClick: suggestion => { 33773 if (props.handleSuggestionClick) { 33774 props.handleSuggestionClick(suggestion); 33775 } 33776 33777 onSuggestionSelected(suggestion); 33778 } 33779 }); 33780 33781 const onSuggestionSelected = async selectedSuggestion => { 33782 let suggestion = selectedSuggestion; 33783 33784 if (CREATE_TYPE === selectedSuggestion.type) { 33785 // Create a new page and call onSelect with the output from the onCreateSuggestion callback 33786 try { 33787 var _suggestion; 33788 33789 suggestion = await onCreateSuggestion(selectedSuggestion.title); 33790 33791 if ((_suggestion = suggestion) !== null && _suggestion !== void 0 && _suggestion.url) { 33792 onSelect(suggestion); 33793 } 33794 } catch (e) {} 33795 33796 return; 33797 } 33798 33799 if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) { 33800 onSelect( // Some direct entries don't have types or IDs, and we still need to clear the previous ones. 33801 { ...Object(external_lodash_["omit"])(currentLink, 'id', 'url'), 33802 ...suggestion 33803 }, suggestion); 33804 } 33805 }; 33806 33807 return Object(external_wp_element_["createElement"])("form", { 33808 onSubmit: onFormSubmit 33809 }, Object(external_wp_element_["createElement"])(url_input, { 33810 className: className, 33811 value: value, 33812 onChange: onInputChange, 33813 placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : Object(external_wp_i18n_["__"])('Search or type url'), 33814 __experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null, 33815 __experimentalFetchLinkSuggestions: searchHandler, 33816 __experimentalHandleURLSuggestions: true, 33817 __experimentalShowInitialSuggestions: showInitialSuggestions, 33818 ref: ref 33819 }), children); 33820 }); 33821 /* harmony default export */ var search_input = (LinkControlSearchInput); 33822 33823 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/viewer-slot.js 33824 /** 33825 * WordPress dependencies 33826 */ 33827 33828 const { 33829 Slot: ViewerSlot, 33830 Fill: ViewerFill 33831 } = Object(external_wp_components_["createSlotFill"])('BlockEditorLinkControlViewer'); 33832 33833 /* harmony default export */ var viewer_slot = (ViewerSlot); 33834 33835 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/link-preview.js 33836 33837 33838 /** 33839 * External dependencies 33840 */ 33841 33842 /** 33843 * WordPress dependencies 33844 */ 33845 33846 33847 33848 33849 /** 33850 * Internal dependencies 33851 */ 33852 33853 33854 function LinkPreview({ 33855 value, 33856 onEditClick 33857 }) { 33858 const displayURL = value && Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(value.url), 16) || ''; 33859 return Object(external_wp_element_["createElement"])("div", { 33860 "aria-label": Object(external_wp_i18n_["__"])('Currently selected'), 33861 "aria-selected": "true", 33862 className: classnames_default()('block-editor-link-control__search-item', { 33863 'is-current': true 33864 }) 33865 }, Object(external_wp_element_["createElement"])("span", { 33866 className: "block-editor-link-control__search-item-header" 33867 }, Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { 33868 className: "block-editor-link-control__search-item-title", 33869 href: value.url 33870 }, value && value.title || displayURL), value && value.title && Object(external_wp_element_["createElement"])("span", { 33871 className: "block-editor-link-control__search-item-info" 33872 }, displayURL)), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 33873 isSecondary: true, 33874 onClick: () => onEditClick(), 33875 className: "block-editor-link-control__search-item-action" 33876 }, Object(external_wp_i18n_["__"])('Edit')), Object(external_wp_element_["createElement"])(ViewerSlot, { 33877 fillProps: value 33878 })); 33879 } 33880 33881 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-create-page.js 33882 /** 33883 * WordPress dependencies 33884 */ 33885 33886 33887 function useCreatePage(handleCreatePage) { 33888 const cancelableCreateSuggestion = Object(external_wp_element_["useRef"])(); 33889 const [isCreatingPage, setIsCreatingPage] = Object(external_wp_element_["useState"])(false); 33890 const [errorMessage, setErrorMessage] = Object(external_wp_element_["useState"])(null); 33891 33892 const createPage = async function (suggestionTitle) { 33893 setIsCreatingPage(true); 33894 setErrorMessage(null); 33895 33896 try { 33897 // Make cancellable in order that we can avoid setting State 33898 // if the component unmounts during the call to `createSuggestion` 33899 cancelableCreateSuggestion.current = makeCancelable( // Using Promise.resolve to allow createSuggestion to return a 33900 // non-Promise based value. 33901 Promise.resolve(handleCreatePage(suggestionTitle))); 33902 return await cancelableCreateSuggestion.current.promise; 33903 } catch (error) { 33904 if (error && error.isCanceled) { 33905 return; // bail if canceled to avoid setting state 33906 } 33907 33908 setErrorMessage(error.message || Object(external_wp_i18n_["__"])('An unknown error occurred during creation. Please try again.')); 33909 throw error; 33910 } finally { 33911 setIsCreatingPage(false); 33912 } 33913 }; 33914 /** 33915 * Handles cancelling any pending Promises that have been made cancelable. 33916 */ 33917 33918 33919 Object(external_wp_element_["useEffect"])(() => { 33920 return () => { 33921 // componentDidUnmount 33922 if (cancelableCreateSuggestion.current) { 33923 cancelableCreateSuggestion.current.cancel(); 33924 } 33925 }; 33926 }, []); 33927 return { 33928 createPage, 33929 isCreatingPage, 33930 errorMessage 33931 }; 33932 } 33933 /** 33934 * Creates a wrapper around a promise which allows it to be programmatically 33935 * cancelled. 33936 * See: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html 33937 * 33938 * @param {Promise} promise the Promise to make cancelable 33939 */ 33940 33941 const makeCancelable = promise => { 33942 let hasCanceled_ = false; 33943 const wrappedPromise = new Promise((resolve, reject) => { 33944 promise.then(val => hasCanceled_ ? reject({ 33945 isCanceled: true 33946 }) : resolve(val), error => hasCanceled_ ? reject({ 33947 isCanceled: true 33948 }) : reject(error)); 33949 }); 33950 return { 33951 promise: wrappedPromise, 33952 33953 cancel() { 33954 hasCanceled_ = true; 33955 } 33956 33957 }; 33958 }; 33959 33960 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/index.js 33961 33962 33963 /** 33964 * External dependencies 33965 */ 33966 33967 /** 33968 * WordPress dependencies 33969 */ 33970 33971 33972 33973 33974 33975 33976 /** 33977 * Internal dependencies 33978 */ 33979 33980 33981 33982 33983 33984 33985 /** 33986 * Default properties associated with a link control value. 33987 * 33988 * @typedef WPLinkControlDefaultValue 33989 * 33990 * @property {string} url Link URL. 33991 * @property {string=} title Link title. 33992 * @property {boolean=} opensInNewTab Whether link should open in a new browser 33993 * tab. This value is only assigned if not 33994 * providing a custom `settings` prop. 33995 */ 33996 33997 /* eslint-disable jsdoc/valid-types */ 33998 33999 /** 34000 * Custom settings values associated with a link. 34001 * 34002 * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue 34003 */ 34004 34005 /* eslint-enable */ 34006 34007 /** 34008 * Custom settings values associated with a link. 34009 * 34010 * @typedef WPLinkControlSetting 34011 * 34012 * @property {string} id Identifier to use as property for setting value. 34013 * @property {string} title Human-readable label to show in user interface. 34014 */ 34015 34016 /** 34017 * Properties associated with a link control value, composed as a union of the 34018 * default properties and any custom settings values. 34019 * 34020 * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue 34021 */ 34022 34023 /** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */ 34024 34025 /** 34026 * Properties associated with a search suggestion used within the LinkControl. 34027 * 34028 * @typedef WPLinkControlSuggestion 34029 * 34030 * @property {string} id Identifier to use to uniquely identify the suggestion. 34031 * @property {string} type Identifies the type of the suggestion (eg: `post`, 34032 * `page`, `url`...etc) 34033 * @property {string} title Human-readable label to show in user interface. 34034 * @property {string} url A URL for the suggestion. 34035 */ 34036 34037 /** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */ 34038 34039 /** 34040 * @typedef WPLinkControlProps 34041 * 34042 * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to 34043 * render a `ToggleControl` for that setting. 34044 * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the 34045 * internal editing state of the component to respective 34046 * show or not show the URL input field. 34047 * @property {WPLinkControlValue=} value Current link value. 34048 * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if 34049 * the user selects a new link or updates settings. 34050 * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link. 34051 * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL. 34052 * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately. 34053 * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion. 34054 * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions. 34055 * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL. 34056 * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion. 34057 */ 34058 34059 /** 34060 * Renders a link control. A link control is a controlled input which maintains 34061 * a value associated with a link (HTML anchor element) and relevant settings 34062 * for how that link is expected to behave. 34063 * 34064 * @param {WPLinkControlProps} props Component props. 34065 */ 34066 34067 function LinkControl({ 34068 searchInputPlaceholder, 34069 value, 34070 settings, 34071 onChange = external_lodash_["noop"], 34072 noDirectEntry = false, 34073 showSuggestions = true, 34074 showInitialSuggestions, 34075 forceIsEditingLink, 34076 createSuggestion, 34077 withCreateSuggestion, 34078 inputValue: propInputValue = '', 34079 suggestionsQuery = {}, 34080 noURLSuggestion = false, 34081 createSuggestionButtonText 34082 }) { 34083 if (withCreateSuggestion === undefined && createSuggestion) { 34084 withCreateSuggestion = true; 34085 } 34086 34087 const isMounting = Object(external_wp_element_["useRef"])(true); 34088 const wrapperNode = Object(external_wp_element_["useRef"])(); 34089 const [internalInputValue, setInternalInputValue] = Object(external_wp_element_["useState"])(value && value.url || ''); 34090 const currentInputValue = propInputValue || internalInputValue; 34091 const [isEditingLink, setIsEditingLink] = Object(external_wp_element_["useState"])(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url); 34092 const isEndingEditWithFocus = Object(external_wp_element_["useRef"])(false); 34093 Object(external_wp_element_["useEffect"])(() => { 34094 if (forceIsEditingLink !== undefined && forceIsEditingLink !== isEditingLink) { 34095 setIsEditingLink(forceIsEditingLink); 34096 } 34097 }, [forceIsEditingLink]); 34098 Object(external_wp_element_["useEffect"])(() => { 34099 if (isMounting.current) { 34100 isMounting.current = false; 34101 return; 34102 } // When `isEditingLink` changes, a focus loss could occur 34103 // since the link input may be removed from the DOM. To avoid this, 34104 // reinstate focus to a suitable target if focus has in-fact been lost. 34105 // Note that the check is necessary because while typically unsetting 34106 // edit mode would render the read-only mode's link element, it isn't 34107 // guaranteed. The link input may continue to be shown if the next value 34108 // is still unassigned after calling `onChange`. 34109 34110 34111 const hadFocusLoss = !wrapperNode.current.contains(wrapperNode.current.ownerDocument.activeElement); 34112 34113 if (hadFocusLoss) { 34114 // Prefer to focus a natural focusable descendent of the wrapper, 34115 // but settle for the wrapper if there are no other options. 34116 const nextFocusTarget = external_wp_dom_["focus"].focusable.find(wrapperNode.current)[0] || wrapperNode.current; 34117 nextFocusTarget.focus(); 34118 } 34119 34120 isEndingEditWithFocus.current = false; 34121 }, [isEditingLink]); 34122 /** 34123 * Cancels editing state and marks that focus may need to be restored after 34124 * the next render, if focus was within the wrapper when editing finished. 34125 */ 34126 34127 function stopEditing() { 34128 var _wrapperNode$current; 34129 34130 isEndingEditWithFocus.current = !!((_wrapperNode$current = wrapperNode.current) !== null && _wrapperNode$current !== void 0 && _wrapperNode$current.contains(wrapperNode.current.ownerDocument.activeElement)); 34131 setIsEditingLink(false); 34132 } 34133 34134 const { 34135 createPage, 34136 isCreatingPage, 34137 errorMessage 34138 } = useCreatePage(createSuggestion); 34139 34140 const handleSelectSuggestion = updatedValue => { 34141 onChange(updatedValue); 34142 stopEditing(); 34143 }; 34144 34145 return Object(external_wp_element_["createElement"])("div", { 34146 tabIndex: -1, 34147 ref: wrapperNode, 34148 className: "block-editor-link-control" 34149 }, isCreatingPage && Object(external_wp_element_["createElement"])("div", { 34150 className: "block-editor-link-control__loading" 34151 }, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), " ", Object(external_wp_i18n_["__"])('Creating'), "\u2026"), (isEditingLink || !value) && !isCreatingPage && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { 34152 className: "block-editor-link-control__search-input-wrapper" 34153 }, Object(external_wp_element_["createElement"])(search_input, { 34154 currentLink: value, 34155 className: "block-editor-link-control__search-input", 34156 placeholder: searchInputPlaceholder, 34157 value: currentInputValue, 34158 withCreateSuggestion: withCreateSuggestion, 34159 onCreateSuggestion: createPage, 34160 onChange: setInternalInputValue, 34161 onSelect: handleSelectSuggestion, 34162 showInitialSuggestions: showInitialSuggestions, 34163 allowDirectEntry: !noDirectEntry, 34164 showSuggestions: showSuggestions, 34165 suggestionsQuery: suggestionsQuery, 34166 withURLSuggestion: !noURLSuggestion, 34167 createSuggestionButtonText: createSuggestionButtonText 34168 }, Object(external_wp_element_["createElement"])("div", { 34169 className: "block-editor-link-control__search-actions" 34170 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34171 type: "submit", 34172 label: Object(external_wp_i18n_["__"])('Submit'), 34173 icon: keyboard_return["a" /* default */], 34174 className: "block-editor-link-control__search-submit" 34175 })))), errorMessage && Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { 34176 className: "block-editor-link-control__search-error", 34177 status: "error", 34178 isDismissible: false 34179 }, errorMessage)), value && !isEditingLink && !isCreatingPage && Object(external_wp_element_["createElement"])(LinkPreview, { 34180 value: value, 34181 onEditClick: () => setIsEditingLink(true) 34182 }), Object(external_wp_element_["createElement"])(settings_drawer, { 34183 value: value, 34184 settings: settings, 34185 onChange: onChange 34186 })); 34187 } 34188 34189 LinkControl.ViewerFill = ViewerFill; 34190 /* harmony default export */ var link_control = (LinkControl); 34191 34192 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js 34193 var library_media = __webpack_require__("rH4q"); 34194 34195 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js 34196 var upload = __webpack_require__("NTP4"); 34197 34198 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-upload/index.js 34199 /** 34200 * WordPress dependencies 34201 */ 34202 34203 /** 34204 * This is a placeholder for the media upload component necessary to make it possible to provide 34205 * an integration with the core blocks that handle media files. By default it renders nothing but 34206 * it provides a way to have it overridden with the `editor.MediaUpload` filter. 34207 * 34208 * @return {WPComponent} The component to be rendered. 34209 */ 34210 34211 const MediaUpload = () => null; 34212 /** 34213 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md 34214 */ 34215 34216 34217 /* harmony default export */ var media_upload = (Object(external_wp_components_["withFilters"])('editor.MediaUpload')(MediaUpload)); 34218 34219 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-upload/check.js 34220 /** 34221 * WordPress dependencies 34222 */ 34223 34224 /** 34225 * Internal dependencies 34226 */ 34227 34228 34229 function MediaUploadCheck({ 34230 fallback = null, 34231 children 34232 }) { 34233 const hasUploadPermissions = Object(external_wp_data_["useSelect"])(select => { 34234 const { 34235 getSettings 34236 } = select(store); 34237 return !!getSettings().mediaUpload; 34238 }, []); 34239 return hasUploadPermissions ? children : fallback; 34240 } 34241 /** 34242 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-upload/README.md 34243 */ 34244 34245 /* harmony default export */ var check = (MediaUploadCheck); 34246 34247 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js 34248 34249 34250 /** 34251 * External dependencies 34252 */ 34253 34254 /** 34255 * WordPress dependencies 34256 */ 34257 34258 34259 34260 34261 34262 34263 34264 34265 34266 34267 /** 34268 * Internal dependencies 34269 */ 34270 34271 34272 34273 34274 34275 34276 const MediaReplaceFlow = ({ 34277 mediaURL, 34278 mediaId, 34279 allowedTypes, 34280 accept, 34281 onSelect, 34282 onSelectURL, 34283 onFilesUpload = external_lodash_["noop"], 34284 name = Object(external_wp_i18n_["__"])('Replace'), 34285 createNotice, 34286 removeNotice 34287 }) => { 34288 const [mediaURLValue, setMediaURLValue] = Object(external_wp_element_["useState"])(mediaURL); 34289 const mediaUpload = Object(external_wp_data_["useSelect"])(select => { 34290 return select(store).getSettings().mediaUpload; 34291 }, []); 34292 const editMediaButtonRef = Object(external_wp_element_["createRef"])(); 34293 const errorNoticeID = Object(external_lodash_["uniqueId"])('block-editor/media-replace-flow/error-notice/'); 34294 34295 const onError = message => { 34296 const errorElement = document.createElement('div'); 34297 errorElement.innerHTML = Object(external_wp_element_["renderToString"])(message); // The default error contains some HTML that, 34298 // for example, makes the filename bold. 34299 // The notice, by default, accepts strings only and so 34300 // we need to remove the html from the error. 34301 34302 const renderMsg = errorElement.textContent || errorElement.innerText || ''; // We need to set a timeout for showing the notice 34303 // so that VoiceOver and possibly other screen readers 34304 // can announce the error afer the toolbar button 34305 // regains focus once the upload dialog closes. 34306 // Otherwise VO simply skips over the notice and announces 34307 // the focused element and the open menu. 34308 34309 setTimeout(() => { 34310 createNotice('error', renderMsg, { 34311 speak: true, 34312 id: errorNoticeID, 34313 isDismissible: true 34314 }); 34315 }, 1000); 34316 }; 34317 34318 const selectMedia = media => { 34319 onSelect(media); 34320 setMediaURLValue(media.url); 34321 Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('The media file has been replaced')); 34322 removeNotice(errorNoticeID); 34323 }; 34324 34325 const selectURL = newURL => { 34326 onSelectURL(newURL); 34327 }; 34328 34329 const uploadFiles = event => { 34330 const files = event.target.files; 34331 onFilesUpload(files); 34332 34333 const setMedia = ([media]) => { 34334 selectMedia(media); 34335 }; 34336 34337 mediaUpload({ 34338 allowedTypes, 34339 filesList: files, 34340 onFileChange: setMedia, 34341 onError 34342 }); 34343 }; 34344 34345 const openOnArrowDown = event => { 34346 if (event.keyCode === external_wp_keycodes_["DOWN"]) { 34347 event.preventDefault(); 34348 event.stopPropagation(); 34349 event.target.click(); 34350 } 34351 }; 34352 34353 const POPOVER_PROPS = { 34354 isAlternate: true 34355 }; 34356 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 34357 popoverProps: POPOVER_PROPS, 34358 contentClassName: "block-editor-media-replace-flow__options", 34359 renderToggle: ({ 34360 isOpen, 34361 onToggle 34362 }) => Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 34363 ref: editMediaButtonRef, 34364 "aria-expanded": isOpen, 34365 "aria-haspopup": "true", 34366 onClick: onToggle, 34367 onKeyDown: openOnArrowDown 34368 }, name), 34369 renderContent: ({ 34370 onClose 34371 }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], { 34372 className: "block-editor-media-replace-flow__media-upload-menu" 34373 }, Object(external_wp_element_["createElement"])(media_upload, { 34374 value: mediaId, 34375 onSelect: media => selectMedia(media), 34376 allowedTypes: allowedTypes, 34377 render: ({ 34378 open 34379 }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 34380 icon: library_media["a" /* default */], 34381 onClick: open 34382 }, Object(external_wp_i18n_["__"])('Open Media Library')) 34383 }), Object(external_wp_element_["createElement"])(check, null, Object(external_wp_element_["createElement"])(external_wp_components_["FormFileUpload"], { 34384 onChange: event => { 34385 uploadFiles(event, onClose); 34386 }, 34387 accept: accept, 34388 render: ({ 34389 openFileDialog 34390 }) => { 34391 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 34392 icon: upload["a" /* default */], 34393 onClick: () => { 34394 openFileDialog(); 34395 } 34396 }, Object(external_wp_i18n_["__"])('Upload')); 34397 } 34398 }))), onSelectURL && // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions 34399 Object(external_wp_element_["createElement"])("form", { 34400 className: "block-editor-media-flow__url-input", 34401 onKeyDown: event => { 34402 if (![external_wp_keycodes_["TAB"], external_wp_keycodes_["ESCAPE"]].includes(event.keyCode)) { 34403 event.stopPropagation(); 34404 } 34405 }, 34406 onKeyPress: event => { 34407 if (![external_wp_keycodes_["TAB"], external_wp_keycodes_["ESCAPE"]].includes(event.keyCode)) { 34408 event.stopPropagation(); 34409 } 34410 } 34411 }, Object(external_wp_element_["createElement"])("span", { 34412 className: "block-editor-media-replace-flow__image-url-label" 34413 }, Object(external_wp_i18n_["__"])('Current media URL:')), Object(external_wp_element_["createElement"])(link_control, { 34414 value: { 34415 url: mediaURLValue 34416 }, 34417 settings: [], 34418 showSuggestions: false, 34419 onChange: ({ 34420 url 34421 }) => { 34422 setMediaURLValue(url); 34423 selectURL(url); 34424 editMediaButtonRef.current.focus(); 34425 } 34426 }))) 34427 }); 34428 }; 34429 34430 /* harmony default export */ var media_replace_flow = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withDispatch"])(dispatch => { 34431 const { 34432 createNotice, 34433 removeNotice 34434 } = dispatch(external_wp_notices_["store"]); 34435 return { 34436 createNotice, 34437 removeNotice 34438 }; 34439 }), Object(external_wp_components_["withFilters"])('editor.MediaReplaceFlow')])(MediaReplaceFlow)); 34440 34441 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js + 1 modules 34442 var library_edit = __webpack_require__("B9Az"); 34443 34444 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer-url.js 34445 34446 34447 /** 34448 * External dependencies 34449 */ 34450 34451 /** 34452 * WordPress dependencies 34453 */ 34454 34455 34456 34457 function LinkViewerURL({ 34458 url, 34459 urlLabel, 34460 className 34461 }) { 34462 const linkClassName = classnames_default()(className, 'block-editor-url-popover__link-viewer-url'); 34463 34464 if (!url) { 34465 return Object(external_wp_element_["createElement"])("span", { 34466 className: linkClassName 34467 }); 34468 } 34469 34470 return Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { 34471 className: linkClassName, 34472 href: url 34473 }, urlLabel || Object(external_wp_url_["filterURLForDisplay"])(Object(external_wp_url_["safeDecodeURI"])(url))); 34474 } 34475 34476 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-viewer.js 34477 34478 34479 34480 /** 34481 * External dependencies 34482 */ 34483 34484 /** 34485 * WordPress dependencies 34486 */ 34487 34488 34489 34490 34491 /** 34492 * Internal dependencies 34493 */ 34494 34495 34496 function LinkViewer({ 34497 className, 34498 linkClassName, 34499 onEditLinkClick, 34500 url, 34501 urlLabel, 34502 ...props 34503 }) { 34504 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 34505 className: classnames_default()('block-editor-url-popover__link-viewer', className) 34506 }, props), Object(external_wp_element_["createElement"])(LinkViewerURL, { 34507 url: url, 34508 urlLabel: urlLabel, 34509 className: linkClassName 34510 }), onEditLinkClick && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34511 icon: library_edit["a" /* default */], 34512 label: Object(external_wp_i18n_["__"])('Edit'), 34513 onClick: onEditLinkClick 34514 })); 34515 } 34516 34517 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/link-editor.js 34518 34519 34520 34521 /** 34522 * External dependencies 34523 */ 34524 34525 /** 34526 * WordPress dependencies 34527 */ 34528 34529 34530 34531 34532 /** 34533 * Internal dependencies 34534 */ 34535 34536 34537 function LinkEditor({ 34538 autocompleteRef, 34539 className, 34540 onChangeInputValue, 34541 value, 34542 ...props 34543 }) { 34544 return Object(external_wp_element_["createElement"])("form", Object(esm_extends["a" /* default */])({ 34545 className: classnames_default()('block-editor-url-popover__link-editor', className) 34546 }, props), Object(external_wp_element_["createElement"])(url_input, { 34547 value: value, 34548 onChange: onChangeInputValue, 34549 autocompleteRef: autocompleteRef 34550 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34551 icon: keyboard_return["a" /* default */], 34552 label: Object(external_wp_i18n_["__"])('Apply'), 34553 type: "submit" 34554 })); 34555 } 34556 34557 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js 34558 34559 34560 34561 /** 34562 * WordPress dependencies 34563 */ 34564 34565 34566 34567 34568 /** 34569 * Internal dependencies 34570 */ 34571 34572 34573 34574 34575 function URLPopover({ 34576 additionalControls, 34577 children, 34578 renderSettings, 34579 position = 'bottom center', 34580 focusOnMount = 'firstElement', 34581 ...popoverProps 34582 }) { 34583 const [isSettingsExpanded, setIsSettingsExpanded] = Object(external_wp_element_["useState"])(false); 34584 const showSettings = !!renderSettings && isSettingsExpanded; 34585 34586 const toggleSettingsVisibility = () => { 34587 setIsSettingsExpanded(!isSettingsExpanded); 34588 }; 34589 34590 return Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], Object(esm_extends["a" /* default */])({ 34591 className: "block-editor-url-popover", 34592 focusOnMount: focusOnMount, 34593 position: position 34594 }, popoverProps), Object(external_wp_element_["createElement"])("div", { 34595 className: "block-editor-url-popover__input-container" 34596 }, Object(external_wp_element_["createElement"])("div", { 34597 className: "block-editor-url-popover__row" 34598 }, children, !!renderSettings && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34599 className: "block-editor-url-popover__settings-toggle", 34600 icon: chevron_down["a" /* default */], 34601 label: Object(external_wp_i18n_["__"])('Link settings'), 34602 onClick: toggleSettingsVisibility, 34603 "aria-expanded": isSettingsExpanded 34604 })), showSettings && Object(external_wp_element_["createElement"])("div", { 34605 className: "block-editor-url-popover__row block-editor-url-popover__settings" 34606 }, renderSettings())), additionalControls && !showSettings && Object(external_wp_element_["createElement"])("div", { 34607 className: "block-editor-url-popover__additional-controls" 34608 }, additionalControls)); 34609 } 34610 34611 URLPopover.LinkEditor = LinkEditor; 34612 URLPopover.LinkViewer = LinkViewer; 34613 /** 34614 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md 34615 */ 34616 34617 /* harmony default export */ var url_popover = (URLPopover); 34618 34619 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js 34620 34621 34622 /** 34623 * External dependencies 34624 */ 34625 34626 34627 /** 34628 * WordPress dependencies 34629 */ 34630 34631 34632 34633 34634 34635 34636 34637 /** 34638 * Internal dependencies 34639 */ 34640 34641 34642 34643 34644 34645 34646 const InsertFromURLPopover = ({ 34647 src, 34648 onChange, 34649 onSubmit, 34650 onClose 34651 }) => Object(external_wp_element_["createElement"])(url_popover, { 34652 onClose: onClose 34653 }, Object(external_wp_element_["createElement"])("form", { 34654 className: "block-editor-media-placeholder__url-input-form", 34655 onSubmit: onSubmit 34656 }, Object(external_wp_element_["createElement"])("input", { 34657 className: "block-editor-media-placeholder__url-input-field", 34658 type: "url", 34659 "aria-label": Object(external_wp_i18n_["__"])('URL'), 34660 placeholder: Object(external_wp_i18n_["__"])('Paste or type URL'), 34661 onChange: onChange, 34662 value: src 34663 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34664 className: "block-editor-media-placeholder__url-input-submit-button", 34665 icon: keyboard_return["a" /* default */], 34666 label: Object(external_wp_i18n_["__"])('Apply'), 34667 type: "submit" 34668 }))); 34669 34670 function MediaPlaceholder({ 34671 value = {}, 34672 allowedTypes, 34673 className, 34674 icon, 34675 labels = {}, 34676 mediaPreview, 34677 notices, 34678 isAppender, 34679 accept, 34680 addToGallery, 34681 multiple = false, 34682 dropZoneUIOnly, 34683 disableDropZone, 34684 disableMediaButtons, 34685 onError, 34686 onSelect, 34687 onCancel, 34688 onSelectURL, 34689 onDoubleClick, 34690 onFilesPreUpload = external_lodash_["noop"], 34691 onHTMLDrop = external_lodash_["noop"], 34692 children 34693 }) { 34694 const mediaUpload = Object(external_wp_data_["useSelect"])(select => { 34695 const { 34696 getSettings 34697 } = select(store); 34698 return getSettings().mediaUpload; 34699 }, []); 34700 const [src, setSrc] = Object(external_wp_element_["useState"])(''); 34701 const [isURLInputVisible, setIsURLInputVisible] = Object(external_wp_element_["useState"])(false); 34702 Object(external_wp_element_["useEffect"])(() => { 34703 var _value$src; 34704 34705 setSrc((_value$src = value === null || value === void 0 ? void 0 : value.src) !== null && _value$src !== void 0 ? _value$src : ''); 34706 }, [value === null || value === void 0 ? void 0 : value.src]); 34707 34708 const onlyAllowsImages = () => { 34709 if (!allowedTypes || allowedTypes.length === 0) { 34710 return false; 34711 } 34712 34713 return allowedTypes.every(allowedType => allowedType === 'image' || allowedType.startsWith('image/')); 34714 }; 34715 34716 const onChangeSrc = event => { 34717 setSrc(event.target.value); 34718 }; 34719 34720 const openURLInput = () => { 34721 setIsURLInputVisible(true); 34722 }; 34723 34724 const closeURLInput = () => { 34725 setIsURLInputVisible(false); 34726 }; 34727 34728 const onSubmitSrc = event => { 34729 event.preventDefault(); 34730 34731 if (src && onSelectURL) { 34732 onSelectURL(src); 34733 closeURLInput(); 34734 } 34735 }; 34736 34737 const onFilesUpload = files => { 34738 onFilesPreUpload(files); 34739 let setMedia; 34740 34741 if (multiple) { 34742 if (addToGallery) { 34743 // Since the setMedia function runs multiple times per upload group 34744 // and is passed newMedia containing every item in its group each time, we must 34745 // filter out whatever this upload group had previously returned to the 34746 // gallery before adding and returning the image array with replacement newMedia 34747 // values. 34748 // Define an array to store urls from newMedia between subsequent function calls. 34749 let lastMediaPassed = []; 34750 34751 setMedia = newMedia => { 34752 // Remove any images this upload group is responsible for (lastMediaPassed). 34753 // Their replacements are contained in newMedia. 34754 const filteredMedia = (value !== null && value !== void 0 ? value : []).filter(item => { 34755 // If Item has id, only remove it if lastMediaPassed has an item with that id. 34756 if (item.id) { 34757 return !lastMediaPassed.some( // Be sure to convert to number for comparison. 34758 ({ 34759 id 34760 }) => Number(id) === Number(item.id)); 34761 } // Compare transient images via .includes since gallery may append extra info onto the url. 34762 34763 34764 return !lastMediaPassed.some(({ 34765 urlSlug 34766 }) => item.url.includes(urlSlug)); 34767 }); // Return the filtered media array along with newMedia. 34768 34769 onSelect(filteredMedia.concat(newMedia)); // Reset lastMediaPassed and set it with ids and urls from newMedia. 34770 34771 lastMediaPassed = newMedia.map(media => { 34772 // Add everything up to '.fileType' to compare via .includes. 34773 const cutOffIndex = media.url.lastIndexOf('.'); 34774 const urlSlug = media.url.slice(0, cutOffIndex); 34775 return { 34776 id: media.id, 34777 urlSlug 34778 }; 34779 }); 34780 }; 34781 } else { 34782 setMedia = onSelect; 34783 } 34784 } else { 34785 setMedia = ([media]) => onSelect(media); 34786 } 34787 34788 mediaUpload({ 34789 allowedTypes, 34790 filesList: files, 34791 onFileChange: setMedia, 34792 onError 34793 }); 34794 }; 34795 34796 const onUpload = event => { 34797 onFilesUpload(event.target.files); 34798 }; 34799 34800 const renderPlaceholder = (content, onClick) => { 34801 let { 34802 instructions, 34803 title 34804 } = labels; 34805 34806 if (!mediaUpload && !onSelectURL) { 34807 instructions = Object(external_wp_i18n_["__"])('To edit this block, you need permission to upload media.'); 34808 } 34809 34810 if (instructions === undefined || title === undefined) { 34811 const typesAllowed = allowedTypes !== null && allowedTypes !== void 0 ? allowedTypes : []; 34812 const [firstAllowedType] = typesAllowed; 34813 const isOneType = 1 === typesAllowed.length; 34814 const isAudio = isOneType && 'audio' === firstAllowedType; 34815 const isImage = isOneType && 'image' === firstAllowedType; 34816 const isVideo = isOneType && 'video' === firstAllowedType; 34817 34818 if (instructions === undefined && mediaUpload) { 34819 instructions = Object(external_wp_i18n_["__"])('Upload a media file or pick one from your media library.'); 34820 34821 if (isAudio) { 34822 instructions = Object(external_wp_i18n_["__"])('Upload an audio file, pick one from your media library, or add one with a URL.'); 34823 } else if (isImage) { 34824 instructions = Object(external_wp_i18n_["__"])('Upload an image file, pick one from your media library, or add one with a URL.'); 34825 } else if (isVideo) { 34826 instructions = Object(external_wp_i18n_["__"])('Upload a video file, pick one from your media library, or add one with a URL.'); 34827 } 34828 } 34829 34830 if (title === undefined) { 34831 title = Object(external_wp_i18n_["__"])('Media'); 34832 34833 if (isAudio) { 34834 title = Object(external_wp_i18n_["__"])('Audio'); 34835 } else if (isImage) { 34836 title = Object(external_wp_i18n_["__"])('Image'); 34837 } else if (isVideo) { 34838 title = Object(external_wp_i18n_["__"])('Video'); 34839 } 34840 } 34841 } 34842 34843 const placeholderClassName = classnames_default()('block-editor-media-placeholder', className, { 34844 'is-appender': isAppender 34845 }); 34846 return Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { 34847 icon: icon, 34848 label: title, 34849 instructions: instructions, 34850 className: placeholderClassName, 34851 notices: notices, 34852 onClick: onClick, 34853 onDoubleClick: onDoubleClick, 34854 preview: mediaPreview 34855 }, content, children); 34856 }; 34857 34858 const renderDropZone = () => { 34859 if (disableDropZone) { 34860 return null; 34861 } 34862 34863 return Object(external_wp_element_["createElement"])(external_wp_components_["DropZone"], { 34864 onFilesDrop: onFilesUpload, 34865 onHTMLDrop: onHTMLDrop 34866 }); 34867 }; 34868 34869 const renderCancelLink = () => { 34870 return onCancel && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34871 className: "block-editor-media-placeholder__cancel-button", 34872 title: Object(external_wp_i18n_["__"])('Cancel'), 34873 isLink: true, 34874 onClick: onCancel 34875 }, Object(external_wp_i18n_["__"])('Cancel')); 34876 }; 34877 34878 const renderUrlSelectionUI = () => { 34879 return onSelectURL && Object(external_wp_element_["createElement"])("div", { 34880 className: "block-editor-media-placeholder__url-input-container" 34881 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34882 className: "block-editor-media-placeholder__button", 34883 onClick: openURLInput, 34884 isPressed: isURLInputVisible, 34885 isTertiary: true 34886 }, Object(external_wp_i18n_["__"])('Insert from URL')), isURLInputVisible && Object(external_wp_element_["createElement"])(InsertFromURLPopover, { 34887 src: src, 34888 onChange: onChangeSrc, 34889 onSubmit: onSubmitSrc, 34890 onClose: closeURLInput 34891 })); 34892 }; 34893 34894 const renderMediaUploadChecked = () => { 34895 const mediaLibraryButton = Object(external_wp_element_["createElement"])(media_upload, { 34896 addToGallery: addToGallery, 34897 gallery: multiple && onlyAllowsImages(), 34898 multiple: multiple, 34899 onSelect: onSelect, 34900 allowedTypes: allowedTypes, 34901 value: Array.isArray(value) ? value.map(({ 34902 id 34903 }) => id) : value.id, 34904 render: ({ 34905 open 34906 }) => { 34907 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34908 isTertiary: true, 34909 onClick: event => { 34910 event.stopPropagation(); 34911 open(); 34912 } 34913 }, Object(external_wp_i18n_["__"])('Media Library')); 34914 } 34915 }); 34916 34917 if (mediaUpload && isAppender) { 34918 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, renderDropZone(), Object(external_wp_element_["createElement"])(external_wp_components_["FormFileUpload"], { 34919 onChange: onUpload, 34920 accept: accept, 34921 multiple: multiple, 34922 render: ({ 34923 openFileDialog 34924 }) => { 34925 const content = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 34926 isPrimary: true, 34927 className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button') 34928 }, Object(external_wp_i18n_["__"])('Upload')), mediaLibraryButton, renderUrlSelectionUI(), renderCancelLink()); 34929 return renderPlaceholder(content, openFileDialog); 34930 } 34931 })); 34932 } 34933 34934 if (mediaUpload) { 34935 const content = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, renderDropZone(), Object(external_wp_element_["createElement"])(external_wp_components_["FormFileUpload"], { 34936 isPrimary: true, 34937 className: classnames_default()('block-editor-media-placeholder__button', 'block-editor-media-placeholder__upload-button'), 34938 onChange: onUpload, 34939 accept: accept, 34940 multiple: multiple 34941 }, Object(external_wp_i18n_["__"])('Upload')), mediaLibraryButton, renderUrlSelectionUI(), renderCancelLink()); 34942 return renderPlaceholder(content); 34943 } 34944 34945 return renderPlaceholder(mediaLibraryButton); 34946 }; 34947 34948 if (dropZoneUIOnly || disableMediaButtons) { 34949 if (dropZoneUIOnly) { 34950 external_wp_deprecated_default()('wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop', { 34951 since: '5.4', 34952 alternative: 'disableMediaButtons' 34953 }); 34954 } 34955 34956 return Object(external_wp_element_["createElement"])(check, null, renderDropZone()); 34957 } 34958 34959 return Object(external_wp_element_["createElement"])(check, { 34960 fallback: renderPlaceholder(renderUrlSelectionUI()) 34961 }, renderMediaUploadChecked()); 34962 } 34963 /** 34964 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md 34965 */ 34966 34967 /* harmony default export */ var media_placeholder = (Object(external_wp_components_["withFilters"])('editor.MediaPlaceholder')(MediaPlaceholder)); 34968 34969 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editable-text/index.js 34970 34971 34972 34973 /** 34974 * WordPress dependencies 34975 */ 34976 34977 /** 34978 * Internal dependencies 34979 */ 34980 34981 34982 const EditableText = Object(external_wp_element_["forwardRef"])((props, ref) => { 34983 return Object(external_wp_element_["createElement"])(rich_text, Object(esm_extends["a" /* default */])({ 34984 ref: ref 34985 }, props, { 34986 __unstableDisableFormats: true, 34987 preserveWhiteSpace: true 34988 })); 34989 }); 34990 34991 EditableText.Content = ({ 34992 value = '', 34993 tagName: Tag = 'div', 34994 ...props 34995 }) => { 34996 return Object(external_wp_element_["createElement"])(Tag, props, value); 34997 }; 34998 /** 34999 * Renders an editable text input in which text formatting is not allowed. 35000 */ 35001 35002 35003 /* harmony default export */ var editable_text = (EditableText); 35004 35005 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/plain-text/index.js 35006 35007 35008 35009 /** 35010 * External dependencies 35011 */ 35012 35013 35014 /** 35015 * WordPress dependencies 35016 */ 35017 35018 35019 /** 35020 * Internal dependencies 35021 */ 35022 35023 35024 /** 35025 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md 35026 */ 35027 35028 const PlainText = Object(external_wp_element_["forwardRef"])(({ 35029 __experimentalVersion, 35030 ...props 35031 }, ref) => { 35032 if (__experimentalVersion === 2) { 35033 return Object(external_wp_element_["createElement"])(editable_text, Object(esm_extends["a" /* default */])({ 35034 ref: ref 35035 }, props)); 35036 } 35037 35038 const { 35039 className, 35040 onChange, 35041 ...remainingProps 35042 } = props; 35043 return Object(external_wp_element_["createElement"])(lib_default.a, Object(esm_extends["a" /* default */])({ 35044 ref: ref, 35045 className: classnames_default()('block-editor-plain-text', className), 35046 onChange: event => onChange(event.target.value) 35047 }, remainingProps)); 35048 }); 35049 /* harmony default export */ var plain_text = (PlainText); 35050 35051 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/label.js 35052 35053 35054 /** 35055 * WordPress dependencies 35056 */ 35057 35058 35059 35060 35061 function ResponsiveBlockControlLabel({ 35062 property, 35063 viewport, 35064 desc 35065 }) { 35066 const instanceId = Object(external_wp_compose_["useInstanceId"])(ResponsiveBlockControlLabel); 35067 const accessibleLabel = desc || Object(external_wp_i18n_["sprintf"])( 35068 /* translators: 1: property name. 2: viewport name. */ 35069 Object(external_wp_i18n_["_x"])('Controls the %1$s property for %2$s viewports.', 'Text labelling a interface as controlling a given layout property (eg: margin) for a given screen size.'), property, viewport.label); 35070 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("span", { 35071 "aria-describedby": `rbc-desc-${instanceId}` 35072 }, viewport.label), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { 35073 as: "span", 35074 id: `rbc-desc-${instanceId}` 35075 }, accessibleLabel)); 35076 } 35077 35078 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/responsive-block-control/index.js 35079 35080 35081 /** 35082 * External dependencies 35083 */ 35084 35085 /** 35086 * WordPress dependencies 35087 */ 35088 35089 35090 35091 35092 /** 35093 * Internal dependencies 35094 */ 35095 35096 35097 35098 function ResponsiveBlockControl(props) { 35099 const { 35100 title, 35101 property, 35102 toggleLabel, 35103 onIsResponsiveChange, 35104 renderDefaultControl, 35105 renderResponsiveControls, 35106 isResponsive = false, 35107 defaultLabel = { 35108 id: 'all', 35109 35110 /* translators: 'Label. Used to signify a layout property (eg: margin, padding) will apply uniformly to all screensizes.' */ 35111 label: Object(external_wp_i18n_["__"])('All') 35112 }, 35113 viewports = [{ 35114 id: 'small', 35115 label: Object(external_wp_i18n_["__"])('Small screens') 35116 }, { 35117 id: 'medium', 35118 label: Object(external_wp_i18n_["__"])('Medium screens') 35119 }, { 35120 id: 'large', 35121 label: Object(external_wp_i18n_["__"])('Large screens') 35122 }] 35123 } = props; 35124 35125 if (!title || !property || !renderDefaultControl) { 35126 return null; 35127 } 35128 35129 const toggleControlLabel = toggleLabel || Object(external_wp_i18n_["sprintf"])( 35130 /* translators: 'Toggle control label. Should the property be the same across all screen sizes or unique per screen size.'. %s property value for the control (eg: margin, padding...etc) */ 35131 Object(external_wp_i18n_["__"])('Use the same %s on all screensizes.'), property); 35132 /* translators: 'Help text for the responsive mode toggle control.' */ 35133 35134 const toggleHelpText = Object(external_wp_i18n_["__"])('Toggle between using the same value for all screen sizes or using a unique value per screen size.'); 35135 35136 const defaultControl = renderDefaultControl(Object(external_wp_element_["createElement"])(ResponsiveBlockControlLabel, { 35137 property: property, 35138 viewport: defaultLabel 35139 }), defaultLabel); 35140 35141 const defaultResponsiveControls = () => { 35142 return viewports.map(viewport => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { 35143 key: viewport.id 35144 }, renderDefaultControl(Object(external_wp_element_["createElement"])(ResponsiveBlockControlLabel, { 35145 property: property, 35146 viewport: viewport 35147 }), viewport))); 35148 }; 35149 35150 return Object(external_wp_element_["createElement"])("fieldset", { 35151 className: "block-editor-responsive-block-control" 35152 }, Object(external_wp_element_["createElement"])("legend", { 35153 className: "block-editor-responsive-block-control__title" 35154 }, title), Object(external_wp_element_["createElement"])("div", { 35155 className: "block-editor-responsive-block-control__inner" 35156 }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { 35157 className: "block-editor-responsive-block-control__toggle", 35158 label: toggleControlLabel, 35159 checked: !isResponsive, 35160 onChange: onIsResponsiveChange, 35161 help: toggleHelpText 35162 }), Object(external_wp_element_["createElement"])("div", { 35163 className: classnames_default()('block-editor-responsive-block-control__group', { 35164 'is-responsive': isResponsive 35165 }) 35166 }, !isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls())))); 35167 } 35168 35169 /* harmony default export */ var responsive_block_control = (ResponsiveBlockControl); 35170 35171 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js 35172 /** 35173 * WordPress dependencies 35174 */ 35175 35176 35177 function RichTextShortcut({ 35178 character, 35179 type, 35180 onUse 35181 }) { 35182 const callback = () => { 35183 onUse(); 35184 return false; 35185 }; 35186 35187 Object(external_wp_compose_["useKeyboardShortcut"])(external_wp_keycodes_["rawShortcut"][type](character), callback, { 35188 bindGlobal: true 35189 }); 35190 return null; 35191 } 35192 35193 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/toolbar-button.js 35194 35195 35196 35197 /** 35198 * WordPress dependencies 35199 */ 35200 35201 35202 function RichTextToolbarButton({ 35203 name, 35204 shortcutType, 35205 shortcutCharacter, 35206 ...props 35207 }) { 35208 let shortcut; 35209 let fillName = 'RichText.ToolbarControls'; 35210 35211 if (name) { 35212 fillName += `.${name}`; 35213 } 35214 35215 if (shortcutType && shortcutCharacter) { 35216 shortcut = external_wp_keycodes_["displayShortcut"][shortcutType](shortcutCharacter); 35217 } 35218 35219 return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], { 35220 name: fillName 35221 }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], Object(esm_extends["a" /* default */])({}, props, { 35222 shortcut: shortcut 35223 }))); 35224 } 35225 35226 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js 35227 /** 35228 * WordPress dependencies 35229 */ 35230 35231 class input_event_unstableRichTextInputEvent extends external_wp_element_["Component"] { 35232 constructor() { 35233 super(...arguments); 35234 this.onInput = this.onInput.bind(this); 35235 } 35236 35237 onInput(event) { 35238 if (event.inputType === this.props.inputType) { 35239 this.props.onInput(); 35240 } 35241 } 35242 35243 componentDidMount() { 35244 document.addEventListener('input', this.onInput, true); 35245 } 35246 35247 componentWillUnmount() { 35248 document.removeEventListener('input', this.onInput, true); 35249 } 35250 35251 render() { 35252 return null; 35253 } 35254 35255 } 35256 35257 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/tool-selector/index.js 35258 35259 35260 35261 /** 35262 * WordPress dependencies 35263 */ 35264 35265 35266 35267 35268 35269 /** 35270 * Internal dependencies 35271 */ 35272 35273 35274 const selectIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 35275 xmlns: "http://www.w3.org/2000/svg", 35276 width: "24", 35277 height: "24", 35278 viewBox: "0 0 24 24" 35279 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 35280 d: "M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z" 35281 })); 35282 35283 function ToolSelector(props, ref) { 35284 const isNavigationTool = Object(external_wp_data_["useSelect"])(select => select(store).isNavigationMode(), []); 35285 const { 35286 setNavigationMode 35287 } = Object(external_wp_data_["useDispatch"])(store); 35288 35289 const onSwitchMode = mode => { 35290 setNavigationMode(mode === 'edit' ? false : true); 35291 }; 35292 35293 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { 35294 renderToggle: ({ 35295 isOpen, 35296 onToggle 35297 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { 35298 ref: ref, 35299 icon: isNavigationTool ? selectIcon : library_edit["a" /* default */], 35300 "aria-expanded": isOpen, 35301 "aria-haspopup": "true", 35302 onClick: onToggle 35303 /* translators: button label text should, if possible, be under 16 characters. */ 35304 , 35305 label: Object(external_wp_i18n_["__"])('Tools') 35306 })), 35307 position: "bottom right", 35308 renderContent: () => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], { 35309 role: "menu", 35310 "aria-label": Object(external_wp_i18n_["__"])('Tools') 35311 }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], { 35312 value: isNavigationTool ? 'select' : 'edit', 35313 onSelect: onSwitchMode, 35314 choices: [{ 35315 value: 'edit', 35316 label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { 35317 icon: library_edit["a" /* default */] 35318 }), Object(external_wp_i18n_["__"])('Edit')) 35319 }, { 35320 value: 'select', 35321 label: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, selectIcon, Object(external_wp_i18n_["__"])('Select')) 35322 }] 35323 })), Object(external_wp_element_["createElement"])("div", { 35324 className: "block-editor-tool-selector__help" 35325 }, Object(external_wp_i18n_["__"])('Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.'))) 35326 }); 35327 } 35328 35329 /* harmony default export */ var tool_selector = (Object(external_wp_element_["forwardRef"])(ToolSelector)); 35330 35331 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/unit-control/index.js 35332 35333 35334 35335 /** 35336 * WordPress dependencies 35337 */ 35338 35339 /** 35340 * Internal dependencies 35341 */ 35342 35343 35344 function UnitControl({ 35345 units: unitsProp, 35346 ...props 35347 }) { 35348 const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ 35349 availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'], 35350 units: unitsProp 35351 }); 35352 return Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], Object(esm_extends["a" /* default */])({ 35353 units: units 35354 }, props)); 35355 } 35356 35357 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js 35358 var library_link = __webpack_require__("Bpkj"); 35359 35360 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js 35361 var arrow_left = __webpack_require__("cjQ8"); 35362 35363 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/button.js 35364 35365 35366 /** 35367 * WordPress dependencies 35368 */ 35369 35370 35371 35372 35373 /** 35374 * Internal dependencies 35375 */ 35376 35377 35378 35379 class button_URLInputButton extends external_wp_element_["Component"] { 35380 constructor() { 35381 super(...arguments); 35382 this.toggle = this.toggle.bind(this); 35383 this.submitLink = this.submitLink.bind(this); 35384 this.state = { 35385 expanded: false 35386 }; 35387 } 35388 35389 toggle() { 35390 this.setState({ 35391 expanded: !this.state.expanded 35392 }); 35393 } 35394 35395 submitLink(event) { 35396 event.preventDefault(); 35397 this.toggle(); 35398 } 35399 35400 render() { 35401 const { 35402 url, 35403 onChange 35404 } = this.props; 35405 const { 35406 expanded 35407 } = this.state; 35408 const buttonLabel = url ? Object(external_wp_i18n_["__"])('Edit link') : Object(external_wp_i18n_["__"])('Insert link'); 35409 return Object(external_wp_element_["createElement"])("div", { 35410 className: "block-editor-url-input__button" 35411 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 35412 icon: library_link["a" /* default */], 35413 label: buttonLabel, 35414 onClick: this.toggle, 35415 className: "components-toolbar__control", 35416 isPressed: !!url 35417 }), expanded && Object(external_wp_element_["createElement"])("form", { 35418 className: "block-editor-url-input__button-modal", 35419 onSubmit: this.submitLink 35420 }, Object(external_wp_element_["createElement"])("div", { 35421 className: "block-editor-url-input__button-modal-line" 35422 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 35423 className: "block-editor-url-input__back", 35424 icon: arrow_left["a" /* default */], 35425 label: Object(external_wp_i18n_["__"])('Close'), 35426 onClick: this.toggle 35427 }), Object(external_wp_element_["createElement"])(url_input, { 35428 value: url || '', 35429 onChange: onChange 35430 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 35431 icon: keyboard_return["a" /* default */], 35432 label: Object(external_wp_i18n_["__"])('Submit'), 35433 type: "submit" 35434 })))); 35435 } 35436 35437 } 35438 /** 35439 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md 35440 */ 35441 35442 35443 /* harmony default export */ var url_input_button = (button_URLInputButton); 35444 35445 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js 35446 var library_close = __webpack_require__("w95h"); 35447 35448 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js 35449 35450 35451 /** 35452 * External dependencies 35453 */ 35454 35455 /** 35456 * WordPress dependencies 35457 */ 35458 35459 35460 35461 35462 35463 /** 35464 * Internal dependencies 35465 */ 35466 35467 35468 const LINK_DESTINATION_NONE = 'none'; 35469 const LINK_DESTINATION_CUSTOM = 'custom'; 35470 const LINK_DESTINATION_MEDIA = 'media'; 35471 const LINK_DESTINATION_ATTACHMENT = 'attachment'; 35472 const NEW_TAB_REL = ['noreferrer', 'noopener']; 35473 const image_url_input_ui_icon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 35474 viewBox: "0 0 24 24", 35475 xmlns: "http://www.w3.org/2000/svg" 35476 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 35477 d: "M0,0h24v24H0V0z", 35478 fill: "none" 35479 }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 35480 d: "m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z" 35481 }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 35482 d: "m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z" 35483 })); 35484 35485 const ImageURLInputUI = ({ 35486 linkDestination, 35487 onChangeUrl, 35488 url, 35489 mediaType = 'image', 35490 mediaUrl, 35491 mediaLink, 35492 linkTarget, 35493 linkClass, 35494 rel 35495 }) => { 35496 const [isOpen, setIsOpen] = Object(external_wp_element_["useState"])(false); 35497 const openLinkUI = Object(external_wp_element_["useCallback"])(() => { 35498 setIsOpen(true); 35499 }); 35500 const [isEditingLink, setIsEditingLink] = Object(external_wp_element_["useState"])(false); 35501 const [urlInput, setUrlInput] = Object(external_wp_element_["useState"])(null); 35502 const autocompleteRef = Object(external_wp_element_["useRef"])(null); 35503 const startEditLink = Object(external_wp_element_["useCallback"])(() => { 35504 if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) { 35505 setUrlInput(''); 35506 } 35507 35508 setIsEditingLink(true); 35509 }); 35510 const stopEditLink = Object(external_wp_element_["useCallback"])(() => { 35511 setIsEditingLink(false); 35512 }); 35513 const closeLinkUI = Object(external_wp_element_["useCallback"])(() => { 35514 setUrlInput(null); 35515 stopEditLink(); 35516 setIsOpen(false); 35517 }); 35518 35519 const removeNewTabRel = currentRel => { 35520 let newRel = currentRel; 35521 35522 if (currentRel !== undefined && !Object(external_lodash_["isEmpty"])(newRel)) { 35523 if (!Object(external_lodash_["isEmpty"])(newRel)) { 35524 Object(external_lodash_["each"])(NEW_TAB_REL, relVal => { 35525 const regExp = new RegExp('\\b' + relVal + '\\b', 'gi'); 35526 newRel = newRel.replace(regExp, ''); 35527 }); // Only trim if NEW_TAB_REL values was replaced. 35528 35529 if (newRel !== currentRel) { 35530 newRel = newRel.trim(); 35531 } 35532 35533 if (Object(external_lodash_["isEmpty"])(newRel)) { 35534 newRel = undefined; 35535 } 35536 } 35537 } 35538 35539 return newRel; 35540 }; 35541 35542 const getUpdatedLinkTargetSettings = value => { 35543 const newLinkTarget = value ? '_blank' : undefined; 35544 let updatedRel; 35545 35546 if (!newLinkTarget && !rel) { 35547 updatedRel = undefined; 35548 } else { 35549 updatedRel = removeNewTabRel(rel); 35550 } 35551 35552 return { 35553 linkTarget: newLinkTarget, 35554 rel: updatedRel 35555 }; 35556 }; 35557 35558 const onFocusOutside = Object(external_wp_element_["useCallback"])(() => { 35559 return event => { 35560 // The autocomplete suggestions list renders in a separate popover (in a portal), 35561 // so onFocusOutside fails to detect that a click on a suggestion occurred in the 35562 // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and 35563 // return to avoid the popover being closed. 35564 const autocompleteElement = autocompleteRef.current; 35565 35566 if (autocompleteElement && autocompleteElement.contains(event.target)) { 35567 return; 35568 } 35569 35570 setIsOpen(false); 35571 setUrlInput(null); 35572 stopEditLink(); 35573 }; 35574 }); 35575 const onSubmitLinkChange = Object(external_wp_element_["useCallback"])(() => { 35576 return event => { 35577 if (urlInput) { 35578 var _getLinkDestinations$; 35579 35580 // It is possible the entered URL actually matches a named link destination. 35581 // This check will ensure our link destination is correct. 35582 const selectedDestination = ((_getLinkDestinations$ = getLinkDestinations().find(destination => destination.url === urlInput)) === null || _getLinkDestinations$ === void 0 ? void 0 : _getLinkDestinations$.linkDestination) || LINK_DESTINATION_CUSTOM; 35583 onChangeUrl({ 35584 href: urlInput, 35585 linkDestination: selectedDestination 35586 }); 35587 } 35588 35589 stopEditLink(); 35590 setUrlInput(null); 35591 event.preventDefault(); 35592 }; 35593 }); 35594 const onLinkRemove = Object(external_wp_element_["useCallback"])(() => { 35595 onChangeUrl({ 35596 linkDestination: LINK_DESTINATION_NONE, 35597 href: '' 35598 }); 35599 }); 35600 35601 const getLinkDestinations = () => { 35602 const linkDestinations = [{ 35603 linkDestination: LINK_DESTINATION_MEDIA, 35604 title: Object(external_wp_i18n_["__"])('Media File'), 35605 url: mediaType === 'image' ? mediaUrl : undefined, 35606 icon: image_url_input_ui_icon 35607 }]; 35608 35609 if (mediaType === 'image' && mediaLink) { 35610 linkDestinations.push({ 35611 linkDestination: LINK_DESTINATION_ATTACHMENT, 35612 title: Object(external_wp_i18n_["__"])('Attachment Page'), 35613 url: mediaType === 'image' ? mediaLink : undefined, 35614 icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { 35615 viewBox: "0 0 24 24", 35616 xmlns: "http://www.w3.org/2000/svg" 35617 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 35618 d: "M0 0h24v24H0V0z", 35619 fill: "none" 35620 }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { 35621 d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z" 35622 })) 35623 }); 35624 } 35625 35626 return linkDestinations; 35627 }; 35628 35629 const onSetHref = value => { 35630 const linkDestinations = getLinkDestinations(); 35631 let linkDestinationInput; 35632 35633 if (!value) { 35634 linkDestinationInput = LINK_DESTINATION_NONE; 35635 } else { 35636 linkDestinationInput = (Object(external_lodash_["find"])(linkDestinations, destination => { 35637 return destination.url === value; 35638 }) || { 35639 linkDestination: LINK_DESTINATION_CUSTOM 35640 }).linkDestination; 35641 } 35642 35643 onChangeUrl({ 35644 linkDestination: linkDestinationInput, 35645 href: value 35646 }); 35647 }; 35648 35649 const onSetNewTab = value => { 35650 const updatedLinkTarget = getUpdatedLinkTargetSettings(value); 35651 onChangeUrl(updatedLinkTarget); 35652 }; 35653 35654 const onSetLinkRel = value => { 35655 onChangeUrl({ 35656 rel: value 35657 }); 35658 }; 35659 35660 const onSetLinkClass = value => { 35661 onChangeUrl({ 35662 linkClass: value 35663 }); 35664 }; 35665 35666 const advancedOptions = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { 35667 label: Object(external_wp_i18n_["__"])('Open in new tab'), 35668 onChange: onSetNewTab, 35669 checked: linkTarget === '_blank' 35670 }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 35671 label: Object(external_wp_i18n_["__"])('Link Rel'), 35672 value: removeNewTabRel(rel) || '', 35673 onChange: onSetLinkRel 35674 }), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { 35675 label: Object(external_wp_i18n_["__"])('Link CSS Class'), 35676 value: linkClass || '', 35677 onChange: onSetLinkClass 35678 })); 35679 const linkEditorValue = urlInput !== null ? urlInput : url; 35680 const urlLabel = (Object(external_lodash_["find"])(getLinkDestinations(), ['linkDestination', linkDestination]) || {}).title; 35681 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { 35682 icon: library_link["a" /* default */], 35683 className: "components-toolbar__control", 35684 label: url ? Object(external_wp_i18n_["__"])('Edit link') : Object(external_wp_i18n_["__"])('Insert link'), 35685 "aria-expanded": isOpen, 35686 onClick: openLinkUI 35687 }), isOpen && Object(external_wp_element_["createElement"])(url_popover, { 35688 onFocusOutside: onFocusOutside(), 35689 onClose: closeLinkUI, 35690 renderSettings: () => advancedOptions, 35691 additionalControls: !linkEditorValue && Object(external_wp_element_["createElement"])(external_wp_components_["NavigableMenu"], null, Object(external_lodash_["map"])(getLinkDestinations(), link => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 35692 key: link.linkDestination, 35693 icon: link.icon, 35694 onClick: () => { 35695 setUrlInput(null); 35696 onSetHref(link.url); 35697 stopEditLink(); 35698 } 35699 }, link.title))) 35700 }, (!url || isEditingLink) && Object(external_wp_element_["createElement"])(url_popover.LinkEditor, { 35701 className: "block-editor-format-toolbar__link-container-content", 35702 value: linkEditorValue, 35703 onChangeInputValue: setUrlInput, 35704 onSubmit: onSubmitLinkChange(), 35705 autocompleteRef: autocompleteRef 35706 }), url && !isEditingLink && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(url_popover.LinkViewer, { 35707 className: "block-editor-format-toolbar__link-container-content", 35708 url: url, 35709 onEditLinkClick: startEditLink, 35710 urlLabel: urlLabel 35711 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 35712 icon: library_close["a" /* default */], 35713 label: Object(external_wp_i18n_["__"])('Remove link'), 35714 onClick: onLinkRemove 35715 })))); 35716 }; 35717 35718 35719 35720 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 35721 var library_check = __webpack_require__("RMJe"); 35722 35723 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js 35724 35725 35726 /** 35727 * External dependencies 35728 */ 35729 35730 /** 35731 * WordPress dependencies 35732 */ 35733 35734 35735 35736 35737 35738 function PreviewOptions({ 35739 children, 35740 className, 35741 isEnabled = true, 35742 deviceType, 35743 setDeviceType 35744 }) { 35745 const isMobile = Object(external_wp_compose_["useViewportMatch"])('small', '<'); 35746 if (isMobile) return null; 35747 const popoverProps = { 35748 className: classnames_default()(className, 'block-editor-post-preview__dropdown-content'), 35749 position: 'bottom left' 35750 }; 35751 const toggleProps = { 35752 isTertiary: true, 35753 className: 'block-editor-post-preview__button-toggle', 35754 disabled: !isEnabled, 35755 35756 /* translators: button label text should, if possible, be under 16 characters. */ 35757 children: Object(external_wp_i18n_["__"])('Preview') 35758 }; 35759 return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { 35760 className: "block-editor-post-preview__dropdown", 35761 popoverProps: popoverProps, 35762 toggleProps: toggleProps, 35763 icon: null 35764 }, () => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 35765 className: "block-editor-post-preview__button-resize", 35766 onClick: () => setDeviceType('Desktop'), 35767 icon: deviceType === 'Desktop' && library_check["a" /* default */] 35768 }, Object(external_wp_i18n_["__"])('Desktop')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 35769 className: "block-editor-post-preview__button-resize", 35770 onClick: () => setDeviceType('Tablet'), 35771 icon: deviceType === 'Tablet' && library_check["a" /* default */] 35772 }, Object(external_wp_i18n_["__"])('Tablet')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { 35773 className: "block-editor-post-preview__button-resize", 35774 onClick: () => setDeviceType('Mobile'), 35775 icon: deviceType === 'Mobile' && library_check["a" /* default */] 35776 }, Object(external_wp_i18n_["__"])('Mobile'))), children)); 35777 } 35778 35779 // EXTERNAL MODULE: ./node_modules/css-mediaquery/index.js 35780 var css_mediaquery = __webpack_require__("6fKw"); 35781 35782 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-simulated-media-query/index.js 35783 /** 35784 * External dependencies 35785 */ 35786 35787 35788 /** 35789 * WordPress dependencies 35790 */ 35791 35792 35793 35794 const ENABLED_MEDIA_QUERY = '(min-width:0px)'; 35795 const DISABLED_MEDIA_QUERY = '(min-width:999999px)'; 35796 const VALID_MEDIA_QUERY_REGEX = /\((min|max)-width:[^\(]*?\)/g; 35797 35798 function getStyleSheetsThatMatchHostname() { 35799 var _window$document$styl, _window, _window$document; 35800 35801 if (typeof window === 'undefined') { 35802 return []; 35803 } 35804 35805 return Object(external_lodash_["filter"])((_window$document$styl = (_window = window) === null || _window === void 0 ? void 0 : (_window$document = _window.document) === null || _window$document === void 0 ? void 0 : _window$document.styleSheets) !== null && _window$document$styl !== void 0 ? _window$document$styl : [], styleSheet => { 35806 if (!styleSheet.href) { 35807 return false; 35808 } 35809 35810 return Object(external_wp_url_["getProtocol"])(styleSheet.href) === window.location.protocol && Object(external_wp_url_["getAuthority"])(styleSheet.href) === window.location.host; 35811 }); 35812 } 35813 35814 function isReplaceableMediaRule(rule) { 35815 if (!rule.media) { 35816 return false; 35817 } // Need to use "media.mediaText" instead of "conditionText" for IE support. 35818 35819 35820 return !!rule.media.mediaText.match(VALID_MEDIA_QUERY_REGEX); 35821 } 35822 35823 function replaceRule(styleSheet, newRuleText, index) { 35824 styleSheet.deleteRule(index); 35825 styleSheet.insertRule(newRuleText, index); 35826 } 35827 35828 function replaceMediaQueryWithWidthEvaluation(ruleText, widthValue) { 35829 return ruleText.replace(VALID_MEDIA_QUERY_REGEX, matchedSubstring => { 35830 if (Object(css_mediaquery["match"])(matchedSubstring, { 35831 type: 'screen', 35832 width: widthValue 35833 })) { 35834 return ENABLED_MEDIA_QUERY; 35835 } 35836 35837 return DISABLED_MEDIA_QUERY; 35838 }); 35839 } 35840 /** 35841 * Function that manipulates media queries from stylesheets to simulate a given 35842 * viewport width. 35843 * 35844 * @param {string} marker CSS selector string defining start and end of 35845 * manipulable styles. 35846 * @param {number?} width Viewport width to simulate. If provided null, the 35847 * stylesheets will not be modified. 35848 */ 35849 35850 35851 function useSimulatedMediaQuery(marker, width) { 35852 Object(external_wp_element_["useEffect"])(() => { 35853 if (!width) { 35854 return; 35855 } 35856 35857 const styleSheets = getStyleSheetsThatMatchHostname(); 35858 const originalStyles = []; 35859 styleSheets.forEach((styleSheet, styleSheetIndex) => { 35860 let relevantSection = false; 35861 35862 for (let ruleIndex = 0; ruleIndex < styleSheet.cssRules.length; ++ruleIndex) { 35863 const rule = styleSheet.cssRules[ruleIndex]; 35864 35865 if (rule.type !== window.CSSRule.STYLE_RULE && rule.type !== window.CSSRule.MEDIA_RULE) { 35866 continue; 35867 } 35868 35869 if (!relevantSection && !!rule.cssText.match(new RegExp(`#start-${marker}`))) { 35870 relevantSection = true; 35871 } 35872 35873 if (relevantSection && !!rule.cssText.match(new RegExp(`#end-${marker}`))) { 35874 relevantSection = false; 35875 } 35876 35877 if (!relevantSection || !isReplaceableMediaRule(rule)) { 35878 continue; 35879 } 35880 35881 const ruleText = rule.cssText; 35882 35883 if (!originalStyles[styleSheetIndex]) { 35884 originalStyles[styleSheetIndex] = []; 35885 } 35886 35887 originalStyles[styleSheetIndex][ruleIndex] = ruleText; 35888 replaceRule(styleSheet, replaceMediaQueryWithWidthEvaluation(ruleText, width), ruleIndex); 35889 } 35890 }); 35891 return () => { 35892 originalStyles.forEach((rulesCollection, styleSheetIndex) => { 35893 if (!rulesCollection) { 35894 return; 35895 } 35896 35897 for (let ruleIndex = 0; ruleIndex < rulesCollection.length; ++ruleIndex) { 35898 const originalRuleText = rulesCollection[ruleIndex]; 35899 35900 if (originalRuleText) { 35901 replaceRule(styleSheets[styleSheetIndex], originalRuleText, ruleIndex); 35902 } 35903 } 35904 }); 35905 }; 35906 }, [width]); 35907 } 35908 35909 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-resize-canvas/index.js 35910 /** 35911 * WordPress dependencies 35912 */ 35913 35914 /** 35915 * Internal dependencies 35916 */ 35917 35918 35919 /** 35920 * Function to resize the editor window. 35921 * 35922 * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile) 35923 * @param {boolean} __unstableDisableSimulation Whether to disable media query simulation. 35924 * 35925 * @return {Object} Inline styles to be added to resizable container. 35926 */ 35927 35928 function useResizeCanvas(deviceType, __unstableDisableSimulation) { 35929 const [actualWidth, updateActualWidth] = Object(external_wp_element_["useState"])(window.innerWidth); 35930 Object(external_wp_element_["useEffect"])(() => { 35931 if (deviceType === 'Desktop') { 35932 return; 35933 } 35934 35935 const resizeListener = () => updateActualWidth(window.innerWidth); 35936 35937 window.addEventListener('resize', resizeListener); 35938 return () => { 35939 window.removeEventListener('resize', resizeListener); 35940 }; 35941 }, [deviceType]); 35942 35943 const getCanvasWidth = device => { 35944 let deviceWidth; 35945 35946 switch (device) { 35947 case 'Tablet': 35948 deviceWidth = 780; 35949 break; 35950 35951 case 'Mobile': 35952 deviceWidth = 360; 35953 break; 35954 35955 default: 35956 return null; 35957 } 35958 35959 return deviceWidth < actualWidth ? deviceWidth : actualWidth; 35960 }; 35961 35962 const marginValue = () => window.innerHeight < 800 ? 36 : 72; 35963 35964 const contentInlineStyles = device => { 35965 const height = device === 'Mobile' ? '768px' : '1024px'; 35966 35967 switch (device) { 35968 case 'Tablet': 35969 case 'Mobile': 35970 return { 35971 width: getCanvasWidth(device), 35972 margin: marginValue() + 'px auto', 35973 height, 35974 borderRadius: '2px 2px 2px 2px', 35975 border: '1px solid #ddd', 35976 overflowY: 'auto' 35977 }; 35978 35979 default: 35980 return null; 35981 } 35982 }; 35983 35984 const width = __unstableDisableSimulation ? null : getCanvasWidth(deviceType); 35985 useSimulatedMediaQuery('resizable-editor-section', width); 35986 return contentInlineStyles(deviceType); 35987 } 35988 35989 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/skip-to-selected-block/index.js 35990 35991 35992 /** 35993 * WordPress dependencies 35994 */ 35995 35996 35997 35998 /** 35999 * Internal dependencies 36000 */ 36001 36002 36003 36004 36005 const SkipToSelectedBlock = ({ 36006 selectedBlockClientId 36007 }) => { 36008 const ref = useBlockRef(selectedBlockClientId); 36009 36010 const onClick = () => { 36011 ref.current.focus(); 36012 }; 36013 36014 return selectedBlockClientId ? Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { 36015 isSecondary: true, 36016 className: "block-editor-skip-to-selected-block", 36017 onClick: onClick 36018 }, Object(external_wp_i18n_["__"])('Skip to the selected block')) : null; 36019 }; 36020 36021 /* harmony default export */ var skip_to_selected_block = (Object(external_wp_data_["withSelect"])(select => { 36022 return { 36023 selectedBlockClientId: select(store).getBlockSelectionStart() 36024 }; 36025 })(SkipToSelectedBlock)); 36026 36027 // EXTERNAL MODULE: external ["wp","wordcount"] 36028 var external_wp_wordcount_ = __webpack_require__("7fqt"); 36029 36030 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/multi-selection-inspector/index.js 36031 36032 36033 /** 36034 * WordPress dependencies 36035 */ 36036 36037 36038 36039 36040 36041 /** 36042 * Internal dependencies 36043 */ 36044 36045 36046 36047 36048 function MultiSelectionInspector({ 36049 blocks 36050 }) { 36051 const words = Object(external_wp_wordcount_["count"])(Object(external_wp_blocks_["serialize"])(blocks), 'words'); 36052 return Object(external_wp_element_["createElement"])("div", { 36053 className: "block-editor-multi-selection-inspector__card" 36054 }, Object(external_wp_element_["createElement"])(BlockIcon, { 36055 icon: library_stack, 36056 showColors: true 36057 }), Object(external_wp_element_["createElement"])("div", { 36058 className: "block-editor-multi-selection-inspector__card-content" 36059 }, Object(external_wp_element_["createElement"])("div", { 36060 className: "block-editor-multi-selection-inspector__card-title" 36061 }, Object(external_wp_i18n_["sprintf"])( 36062 /* translators: %d: number of blocks */ 36063 Object(external_wp_i18n_["_n"])('%d block', '%d blocks', blocks.length), blocks.length)), Object(external_wp_element_["createElement"])("div", { 36064 className: "block-editor-multi-selection-inspector__card-description" 36065 }, Object(external_wp_i18n_["sprintf"])( 36066 /* translators: %d: number of words */ 36067 Object(external_wp_i18n_["_n"])('%d word', '%d words', words), words)))); 36068 } 36069 36070 /* harmony default export */ var multi_selection_inspector = (Object(external_wp_data_["withSelect"])(select => { 36071 const { 36072 getMultiSelectedBlocks 36073 } = select(store); 36074 return { 36075 blocks: getMultiSelectedBlocks() 36076 }; 36077 })(MultiSelectionInspector)); 36078 36079 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/default-style-picker/index.js 36080 36081 36082 /** 36083 * WordPress dependencies 36084 */ 36085 36086 36087 36088 36089 36090 /** 36091 * Internal dependencies 36092 */ 36093 36094 36095 function DefaultStylePicker({ 36096 blockName 36097 }) { 36098 const { 36099 preferredStyle, 36100 onUpdatePreferredStyleVariations, 36101 styles 36102 } = Object(external_wp_data_["useSelect"])(select => { 36103 var _preferredStyleVariat, _preferredStyleVariat2; 36104 36105 const settings = select(store).getSettings(); 36106 const preferredStyleVariations = settings.__experimentalPreferredStyleVariations; 36107 return { 36108 preferredStyle: preferredStyleVariations === null || preferredStyleVariations === void 0 ? void 0 : (_preferredStyleVariat = preferredStyleVariations.value) === null || _preferredStyleVariat === void 0 ? void 0 : _preferredStyleVariat[blockName], 36109 onUpdatePreferredStyleVariations: (_preferredStyleVariat2 = preferredStyleVariations === null || preferredStyleVariations === void 0 ? void 0 : preferredStyleVariations.onChange) !== null && _preferredStyleVariat2 !== void 0 ? _preferredStyleVariat2 : null, 36110 styles: select(external_wp_blocks_["store"]).getBlockStyles(blockName) 36111 }; 36112 }, [blockName]); 36113 const selectOptions = Object(external_wp_element_["useMemo"])(() => [{ 36114 label: Object(external_wp_i18n_["__"])('Not set'), 36115 value: '' 36116 }, ...styles.map(({ 36117 label, 36118 name 36119 }) => ({ 36120 label, 36121 value: name 36122 }))], [styles]); 36123 const selectOnChange = Object(external_wp_element_["useCallback"])(blockStyle => { 36124 onUpdatePreferredStyleVariations(blockName, blockStyle); 36125 }, [blockName, onUpdatePreferredStyleVariations]); 36126 return onUpdatePreferredStyleVariations && Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { 36127 options: selectOptions, 36128 value: preferredStyle || '', 36129 label: Object(external_wp_i18n_["__"])('Default Style'), 36130 onChange: selectOnChange 36131 }); 36132 } 36133 36134 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js 36135 36136 36137 /** 36138 * WordPress dependencies 36139 */ 36140 36141 36142 36143 36144 /** 36145 * Internal dependencies 36146 */ 36147 36148 36149 36150 36151 36152 36153 36154 36155 36156 36157 36158 36159 const BlockInspector = ({ 36160 showNoBlockSelectedMessage = true, 36161 bubblesVirtually = true 36162 }) => { 36163 const { 36164 count, 36165 hasBlockStyles, 36166 selectedBlockName, 36167 selectedBlockClientId, 36168 blockType 36169 } = Object(external_wp_data_["useSelect"])(select => { 36170 const { 36171 getSelectedBlockClientId, 36172 getSelectedBlockCount, 36173 getBlockName 36174 } = select(store); 36175 const { 36176 getBlockStyles 36177 } = select(external_wp_blocks_["store"]); 36178 36179 const _selectedBlockClientId = getSelectedBlockClientId(); 36180 36181 const _selectedBlockName = _selectedBlockClientId && getBlockName(_selectedBlockClientId); 36182 36183 const _blockType = _selectedBlockName && Object(external_wp_blocks_["getBlockType"])(_selectedBlockName); 36184 36185 const blockStyles = _selectedBlockName && getBlockStyles(_selectedBlockName); 36186 36187 return { 36188 count: getSelectedBlockCount(), 36189 selectedBlockClientId: _selectedBlockClientId, 36190 selectedBlockName: _selectedBlockName, 36191 blockType: _blockType, 36192 hasBlockStyles: blockStyles && blockStyles.length > 0 36193 }; 36194 }, []); 36195 36196 if (count > 1) { 36197 return Object(external_wp_element_["createElement"])("div", { 36198 className: "block-editor-block-inspector" 36199 }, Object(external_wp_element_["createElement"])(multi_selection_inspector, null), Object(external_wp_element_["createElement"])(inspector_controls.Slot, { 36200 bubblesVirtually: bubblesVirtually 36201 })); 36202 } 36203 36204 const isSelectedBlockUnregistered = selectedBlockName === Object(external_wp_blocks_["getUnregisteredTypeHandlerName"])(); 36205 /* 36206 * If the selected block is of an unregistered type, avoid showing it as an actual selection 36207 * because we want the user to focus on the unregistered block warning, not block settings. 36208 */ 36209 36210 if (!blockType || !selectedBlockClientId || isSelectedBlockUnregistered) { 36211 if (showNoBlockSelectedMessage) { 36212 return Object(external_wp_element_["createElement"])("span", { 36213 className: "block-editor-block-inspector__no-blocks" 36214 }, Object(external_wp_i18n_["__"])('No block selected.')); 36215 } 36216 36217 return null; 36218 } 36219 36220 return Object(external_wp_element_["createElement"])(BlockInspectorSingleBlock, { 36221 clientId: selectedBlockClientId, 36222 blockName: blockType.name, 36223 hasBlockStyles: hasBlockStyles, 36224 bubblesVirtually: bubblesVirtually 36225 }); 36226 }; 36227 36228 const BlockInspectorSingleBlock = ({ 36229 clientId, 36230 blockName, 36231 hasBlockStyles, 36232 bubblesVirtually 36233 }) => { 36234 const blockInformation = useBlockDisplayInformation(clientId); 36235 return Object(external_wp_element_["createElement"])("div", { 36236 className: "block-editor-block-inspector" 36237 }, Object(external_wp_element_["createElement"])(block_card, blockInformation), Object(external_wp_element_["createElement"])(block_variation_transforms, { 36238 blockClientId: clientId 36239 }), hasBlockStyles && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 36240 title: Object(external_wp_i18n_["__"])('Styles') 36241 }, Object(external_wp_element_["createElement"])(block_styles, { 36242 clientId: clientId 36243 }), Object(external_wp_blocks_["hasBlockSupport"])(blockName, 'defaultStylePicker', true) && Object(external_wp_element_["createElement"])(DefaultStylePicker, { 36244 blockName: blockName 36245 }))), Object(external_wp_element_["createElement"])(inspector_controls.Slot, { 36246 bubblesVirtually: bubblesVirtually 36247 }), Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(AdvancedControls, { 36248 slotName: inspector_advanced_controls.slotName, 36249 bubblesVirtually: bubblesVirtually 36250 })), Object(external_wp_element_["createElement"])(skip_to_selected_block, { 36251 key: "back" 36252 })); 36253 }; 36254 36255 const AdvancedControls = ({ 36256 slotName, 36257 bubblesVirtually 36258 }) => { 36259 const slot = Object(external_wp_components_["__experimentalUseSlot"])(slotName); 36260 const hasFills = Boolean(slot.fills && slot.fills.length); 36261 36262 if (!hasFills) { 36263 return null; 36264 } 36265 36266 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { 36267 className: "block-editor-block-inspector__advanced", 36268 title: Object(external_wp_i18n_["__"])('Advanced'), 36269 initialOpen: false 36270 }, Object(external_wp_element_["createElement"])(inspector_advanced_controls.Slot, { 36271 bubblesVirtually: bubblesVirtually 36272 })); 36273 }; 36274 36275 /* harmony default export */ var block_inspector = (BlockInspector); 36276 36277 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js 36278 36279 36280 /** 36281 * WordPress dependencies 36282 */ 36283 36284 36285 36286 /** 36287 * Internal dependencies 36288 */ 36289 36290 36291 36292 36293 36294 36295 /** 36296 * Renders block tools (the block toolbar, select/navigation mode toolbar, the 36297 * insertion point and a slot for the inline rich text toolbar). Must be wrapped 36298 * around the block content and editor styles wrapper or iframe. 36299 * 36300 * @param {Object} $0 Props. 36301 * @param {Object} $0.children The block content and style container. 36302 * @param {Object} $0.__unstableContentRef Ref holding the content scroll container. 36303 */ 36304 36305 function BlockTools({ 36306 children, 36307 __unstableContentRef 36308 }) { 36309 const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); 36310 const hasFixedToolbar = Object(external_wp_data_["useSelect"])(select => select(store).getSettings().hasFixedToolbar, []); 36311 return Object(external_wp_element_["createElement"])(InsertionPoint, { 36312 __unstableContentRef: __unstableContentRef 36313 }, (hasFixedToolbar || !isLargeViewport) && Object(external_wp_element_["createElement"])(block_contextual_toolbar, { 36314 isFixed: true 36315 }), Object(external_wp_element_["createElement"])(WrappedBlockPopover, { 36316 __unstableContentRef: __unstableContentRef 36317 }), Object(external_wp_element_["createElement"])(external_wp_components_["Popover"].Slot, { 36318 name: "block-toolbar", 36319 ref: usePopoverScroll(__unstableContentRef) 36320 }), children); 36321 } 36322 36323 // EXTERNAL MODULE: ./node_modules/traverse/index.js 36324 var traverse = __webpack_require__("eGrx"); 36325 var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse); 36326 36327 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/parse.js 36328 /* eslint-disable @wordpress/no-unused-vars-before-return */ 36329 // Adapted from https://github.com/reworkcss/css 36330 // because we needed to remove source map support. 36331 // http://www.w3.org/TR/CSS21/grammar.htm 36332 // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 36333 const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; 36334 /* harmony default export */ var parse = (function (css, options) { 36335 options = options || {}; 36336 /** 36337 * Positional. 36338 */ 36339 36340 let lineno = 1; 36341 let column = 1; 36342 /** 36343 * Update lineno and column based on `str`. 36344 */ 36345 36346 function updatePosition(str) { 36347 const lines = str.match(/\n/g); 36348 36349 if (lines) { 36350 lineno += lines.length; 36351 } 36352 36353 const i = str.lastIndexOf('\n'); // eslint-disable-next-line no-bitwise 36354 36355 column = ~i ? str.length - i : column + str.length; 36356 } 36357 /** 36358 * Mark position and patch `node.position`. 36359 */ 36360 36361 36362 function position() { 36363 const start = { 36364 line: lineno, 36365 column 36366 }; 36367 return function (node) { 36368 node.position = new Position(start); 36369 whitespace(); 36370 return node; 36371 }; 36372 } 36373 /** 36374 * Store position information for a node 36375 */ 36376 36377 36378 function Position(start) { 36379 this.start = start; 36380 this.end = { 36381 line: lineno, 36382 column 36383 }; 36384 this.source = options.source; 36385 } 36386 /** 36387 * Non-enumerable source string 36388 */ 36389 36390 36391 Position.prototype.content = css; 36392 /** 36393 * Error `msg`. 36394 */ 36395 36396 const errorsList = []; 36397 36398 function error(msg) { 36399 const err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); 36400 err.reason = msg; 36401 err.filename = options.source; 36402 err.line = lineno; 36403 err.column = column; 36404 err.source = css; 36405 36406 if (options.silent) { 36407 errorsList.push(err); 36408 } else { 36409 throw err; 36410 } 36411 } 36412 /** 36413 * Parse stylesheet. 36414 */ 36415 36416 36417 function stylesheet() { 36418 const rulesList = rules(); 36419 return { 36420 type: 'stylesheet', 36421 stylesheet: { 36422 source: options.source, 36423 rules: rulesList, 36424 parsingErrors: errorsList 36425 } 36426 }; 36427 } 36428 /** 36429 * Opening brace. 36430 */ 36431 36432 36433 function open() { 36434 return match(/^{\s*/); 36435 } 36436 /** 36437 * Closing brace. 36438 */ 36439 36440 36441 function close() { 36442 return match(/^}/); 36443 } 36444 /** 36445 * Parse ruleset. 36446 */ 36447 36448 36449 function rules() { 36450 let node; 36451 const accumulator = []; 36452 whitespace(); 36453 comments(accumulator); 36454 36455 while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) { 36456 if (node !== false) { 36457 accumulator.push(node); 36458 comments(accumulator); 36459 } 36460 } 36461 36462 return accumulator; 36463 } 36464 /** 36465 * Match `re` and return captures. 36466 */ 36467 36468 36469 function match(re) { 36470 const m = re.exec(css); 36471 36472 if (!m) { 36473 return; 36474 } 36475 36476 const str = m[0]; 36477 updatePosition(str); 36478 css = css.slice(str.length); 36479 return m; 36480 } 36481 /** 36482 * Parse whitespace. 36483 */ 36484 36485 36486 function whitespace() { 36487 match(/^\s*/); 36488 } 36489 /** 36490 * Parse comments; 36491 */ 36492 36493 36494 function comments(accumulator) { 36495 let c; 36496 accumulator = accumulator || []; // eslint-disable-next-line no-cond-assign 36497 36498 while (c = comment()) { 36499 if (c !== false) { 36500 accumulator.push(c); 36501 } 36502 } 36503 36504 return accumulator; 36505 } 36506 /** 36507 * Parse comment. 36508 */ 36509 36510 36511 function comment() { 36512 const pos = position(); 36513 36514 if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) { 36515 return; 36516 } 36517 36518 let i = 2; 36519 36520 while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) { 36521 ++i; 36522 } 36523 36524 i += 2; 36525 36526 if ('' === css.charAt(i - 1)) { 36527 return error('End of comment missing'); 36528 } 36529 36530 const str = css.slice(2, i - 2); 36531 column += 2; 36532 updatePosition(str); 36533 css = css.slice(i); 36534 column += 2; 36535 return pos({ 36536 type: 'comment', 36537 comment: str 36538 }); 36539 } 36540 /** 36541 * Parse selector. 36542 */ 36543 36544 36545 function selector() { 36546 const m = match(/^([^{]+)/); 36547 36548 if (!m) { 36549 return; 36550 } // FIXME: Remove all comments from selectors http://ostermiller.org/findcomment.html 36551 36552 36553 return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (matched) { 36554 return matched.replace(/,/g, '\u200C'); 36555 }).split(/\s*(?![^(]*\)),\s*/).map(function (s) { 36556 return s.replace(/\u200C/g, ','); 36557 }); 36558 } 36559 /** 36560 * Parse declaration. 36561 */ 36562 36563 36564 function declaration() { 36565 const pos = position(); // prop 36566 36567 let prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); 36568 36569 if (!prop) { 36570 return; 36571 } 36572 36573 prop = trim(prop[0]); // : 36574 36575 if (!match(/^:\s*/)) { 36576 return error("property missing ':'"); 36577 } // val 36578 36579 36580 const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); 36581 const ret = pos({ 36582 type: 'declaration', 36583 property: prop.replace(commentre, ''), 36584 value: val ? trim(val[0]).replace(commentre, '') : '' 36585 }); // ; 36586 36587 match(/^[;\s]*/); 36588 return ret; 36589 } 36590 /** 36591 * Parse declarations. 36592 */ 36593 36594 36595 function declarations() { 36596 const decls = []; 36597 36598 if (!open()) { 36599 return error("missing '{'"); 36600 } 36601 36602 comments(decls); // declarations 36603 36604 let decl; // eslint-disable-next-line no-cond-assign 36605 36606 while (decl = declaration()) { 36607 if (decl !== false) { 36608 decls.push(decl); 36609 comments(decls); 36610 } 36611 } 36612 36613 if (!close()) { 36614 return error("missing '}'"); 36615 } 36616 36617 return decls; 36618 } 36619 /** 36620 * Parse keyframe. 36621 */ 36622 36623 36624 function keyframe() { 36625 let m; 36626 const vals = []; 36627 const pos = position(); // eslint-disable-next-line no-cond-assign 36628 36629 while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) { 36630 vals.push(m[1]); 36631 match(/^,\s*/); 36632 } 36633 36634 if (!vals.length) { 36635 return; 36636 } 36637 36638 return pos({ 36639 type: 'keyframe', 36640 values: vals, 36641 declarations: declarations() 36642 }); 36643 } 36644 /** 36645 * Parse keyframes. 36646 */ 36647 36648 36649 function atkeyframes() { 36650 const pos = position(); 36651 let m = match(/^@([-\w]+)?keyframes\s*/); 36652 36653 if (!m) { 36654 return; 36655 } 36656 36657 const vendor = m[1]; // identifier 36658 36659 m = match(/^([-\w]+)\s*/); 36660 36661 if (!m) { 36662 return error('@keyframes missing name'); 36663 } 36664 36665 const name = m[1]; 36666 36667 if (!open()) { 36668 return error("@keyframes missing '{'"); 36669 } 36670 36671 let frame; 36672 let frames = comments(); // eslint-disable-next-line no-cond-assign 36673 36674 while (frame = keyframe()) { 36675 frames.push(frame); 36676 frames = frames.concat(comments()); 36677 } 36678 36679 if (!close()) { 36680 return error("@keyframes missing '}'"); 36681 } 36682 36683 return pos({ 36684 type: 'keyframes', 36685 name, 36686 vendor, 36687 keyframes: frames 36688 }); 36689 } 36690 /** 36691 * Parse supports. 36692 */ 36693 36694 36695 function atsupports() { 36696 const pos = position(); 36697 const m = match(/^@supports *([^{]+)/); 36698 36699 if (!m) { 36700 return; 36701 } 36702 36703 const supports = trim(m[1]); 36704 36705 if (!open()) { 36706 return error("@supports missing '{'"); 36707 } 36708 36709 const style = comments().concat(rules()); 36710 36711 if (!close()) { 36712 return error("@supports missing '}'"); 36713 } 36714 36715 return pos({ 36716 type: 'supports', 36717 supports, 36718 rules: style 36719 }); 36720 } 36721 /** 36722 * Parse host. 36723 */ 36724 36725 36726 function athost() { 36727 const pos = position(); 36728 const m = match(/^@host\s*/); 36729 36730 if (!m) { 36731 return; 36732 } 36733 36734 if (!open()) { 36735 return error("@host missing '{'"); 36736 } 36737 36738 const style = comments().concat(rules()); 36739 36740 if (!close()) { 36741 return error("@host missing '}'"); 36742 } 36743 36744 return pos({ 36745 type: 'host', 36746 rules: style 36747 }); 36748 } 36749 /** 36750 * Parse media. 36751 */ 36752 36753 36754 function atmedia() { 36755 const pos = position(); 36756 const m = match(/^@media *([^{]+)/); 36757 36758 if (!m) { 36759 return; 36760 } 36761 36762 const media = trim(m[1]); 36763 36764 if (!open()) { 36765 return error("@media missing '{'"); 36766 } 36767 36768 const style = comments().concat(rules()); 36769 36770 if (!close()) { 36771 return error("@media missing '}'"); 36772 } 36773 36774 return pos({ 36775 type: 'media', 36776 media, 36777 rules: style 36778 }); 36779 } 36780 /** 36781 * Parse custom-media. 36782 */ 36783 36784 36785 function atcustommedia() { 36786 const pos = position(); 36787 const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); 36788 36789 if (!m) { 36790 return; 36791 } 36792 36793 return pos({ 36794 type: 'custom-media', 36795 name: trim(m[1]), 36796 media: trim(m[2]) 36797 }); 36798 } 36799 /** 36800 * Parse paged media. 36801 */ 36802 36803 36804 function atpage() { 36805 const pos = position(); 36806 const m = match(/^@page */); 36807 36808 if (!m) { 36809 return; 36810 } 36811 36812 const sel = selector() || []; 36813 36814 if (!open()) { 36815 return error("@page missing '{'"); 36816 } 36817 36818 let decls = comments(); // declarations 36819 36820 let decl; // eslint-disable-next-line no-cond-assign 36821 36822 while (decl = declaration()) { 36823 decls.push(decl); 36824 decls = decls.concat(comments()); 36825 } 36826 36827 if (!close()) { 36828 return error("@page missing '}'"); 36829 } 36830 36831 return pos({ 36832 type: 'page', 36833 selectors: sel, 36834 declarations: decls 36835 }); 36836 } 36837 /** 36838 * Parse document. 36839 */ 36840 36841 36842 function atdocument() { 36843 const pos = position(); 36844 const m = match(/^@([-\w]+)?document *([^{]+)/); 36845 36846 if (!m) { 36847 return; 36848 } 36849 36850 const vendor = trim(m[1]); 36851 const doc = trim(m[2]); 36852 36853 if (!open()) { 36854 return error("@document missing '{'"); 36855 } 36856 36857 const style = comments().concat(rules()); 36858 36859 if (!close()) { 36860 return error("@document missing '}'"); 36861 } 36862 36863 return pos({ 36864 type: 'document', 36865 document: doc, 36866 vendor, 36867 rules: style 36868 }); 36869 } 36870 /** 36871 * Parse font-face. 36872 */ 36873 36874 36875 function atfontface() { 36876 const pos = position(); 36877 const m = match(/^@font-face\s*/); 36878 36879 if (!m) { 36880 return; 36881 } 36882 36883 if (!open()) { 36884 return error("@font-face missing '{'"); 36885 } 36886 36887 let decls = comments(); // declarations 36888 36889 let decl; // eslint-disable-next-line no-cond-assign 36890 36891 while (decl = declaration()) { 36892 decls.push(decl); 36893 decls = decls.concat(comments()); 36894 } 36895 36896 if (!close()) { 36897 return error("@font-face missing '}'"); 36898 } 36899 36900 return pos({ 36901 type: 'font-face', 36902 declarations: decls 36903 }); 36904 } 36905 /** 36906 * Parse import 36907 */ 36908 36909 36910 const atimport = _compileAtrule('import'); 36911 /** 36912 * Parse charset 36913 */ 36914 36915 36916 const atcharset = _compileAtrule('charset'); 36917 /** 36918 * Parse namespace 36919 */ 36920 36921 36922 const atnamespace = _compileAtrule('namespace'); 36923 /** 36924 * Parse non-block at-rules 36925 */ 36926 36927 36928 function _compileAtrule(name) { 36929 const re = new RegExp('^@' + name + '\\s*([^;]+);'); 36930 return function () { 36931 const pos = position(); 36932 const m = match(re); 36933 36934 if (!m) { 36935 return; 36936 } 36937 36938 const ret = { 36939 type: name 36940 }; 36941 ret[name] = m[1].trim(); 36942 return pos(ret); 36943 }; 36944 } 36945 /** 36946 * Parse at rule. 36947 */ 36948 36949 36950 function atrule() { 36951 if (css[0] !== '@') { 36952 return; 36953 } 36954 36955 return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface(); 36956 } 36957 /** 36958 * Parse rule. 36959 */ 36960 36961 36962 function rule() { 36963 const pos = position(); 36964 const sel = selector(); 36965 36966 if (!sel) { 36967 return error('selector missing'); 36968 } 36969 36970 comments(); 36971 return pos({ 36972 type: 'rule', 36973 selectors: sel, 36974 declarations: declarations() 36975 }); 36976 } 36977 36978 return addParent(stylesheet()); 36979 }); 36980 /** 36981 * Trim `str`. 36982 */ 36983 36984 function trim(str) { 36985 return str ? str.replace(/^\s+|\s+$/g, '') : ''; 36986 } 36987 /** 36988 * Adds non-enumerable parent node reference to each node. 36989 */ 36990 36991 36992 function addParent(obj, parent) { 36993 const isNode = obj && typeof obj.type === 'string'; 36994 const childParent = isNode ? obj : parent; 36995 36996 for (const k in obj) { 36997 const value = obj[k]; 36998 36999 if (Array.isArray(value)) { 37000 value.forEach(function (v) { 37001 addParent(v, childParent); 37002 }); 37003 } else if (value && typeof value === 'object') { 37004 addParent(value, childParent); 37005 } 37006 } 37007 37008 if (isNode) { 37009 Object.defineProperty(obj, 'parent', { 37010 configurable: true, 37011 writable: true, 37012 enumerable: false, 37013 value: parent || null 37014 }); 37015 } 37016 37017 return obj; 37018 } 37019 /* eslint-enable @wordpress/no-unused-vars-before-return */ 37020 37021 // EXTERNAL MODULE: ./node_modules/inherits/inherits_browser.js 37022 var inherits_browser = __webpack_require__("P7XM"); 37023 var inherits_browser_default = /*#__PURE__*/__webpack_require__.n(inherits_browser); 37024 37025 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/compiler.js 37026 // Adapted from https://github.com/reworkcss/css 37027 // because we needed to remove source map support. 37028 37029 /** 37030 * Expose `Compiler`. 37031 */ 37032 /* harmony default export */ var stringify_compiler = (Compiler); 37033 /** 37034 * Initialize a compiler. 37035 */ 37036 37037 function Compiler(opts) { 37038 this.options = opts || {}; 37039 } 37040 /** 37041 * Emit `str` 37042 */ 37043 37044 37045 Compiler.prototype.emit = function (str) { 37046 return str; 37047 }; 37048 /** 37049 * Visit `node`. 37050 */ 37051 37052 37053 Compiler.prototype.visit = function (node) { 37054 return this[node.type](node); 37055 }; 37056 /** 37057 * Map visit over array of `nodes`, optionally using a `delim` 37058 */ 37059 37060 37061 Compiler.prototype.mapVisit = function (nodes, delim) { 37062 let buf = ''; 37063 delim = delim || ''; 37064 37065 for (let i = 0, length = nodes.length; i < length; i++) { 37066 buf += this.visit(nodes[i]); 37067 37068 if (delim && i < length - 1) { 37069 buf += this.emit(delim); 37070 } 37071 } 37072 37073 return buf; 37074 }; 37075 37076 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/compress.js 37077 // Adapted from https://github.com/reworkcss/css 37078 // because we needed to remove source map support. 37079 37080 /** 37081 * External dependencies 37082 */ 37083 37084 /** 37085 * Internal dependencies 37086 */ 37087 37088 37089 /** 37090 * Expose compiler. 37091 */ 37092 37093 /* harmony default export */ var compress = (compress_Compiler); 37094 /** 37095 * Initialize a new `Compiler`. 37096 */ 37097 37098 function compress_Compiler(options) { 37099 stringify_compiler.call(this, options); 37100 } 37101 /** 37102 * Inherit from `Base.prototype`. 37103 */ 37104 37105 37106 inherits_browser_default()(compress_Compiler, stringify_compiler); 37107 /** 37108 * Compile `node`. 37109 */ 37110 37111 compress_Compiler.prototype.compile = function (node) { 37112 return node.stylesheet.rules.map(this.visit, this).join(''); 37113 }; 37114 /** 37115 * Visit comment node. 37116 */ 37117 37118 37119 compress_Compiler.prototype.comment = function (node) { 37120 return this.emit('', node.position); 37121 }; 37122 /** 37123 * Visit import node. 37124 */ 37125 37126 37127 compress_Compiler.prototype.import = function (node) { 37128 return this.emit('@import ' + node.import + ';', node.position); 37129 }; 37130 /** 37131 * Visit media node. 37132 */ 37133 37134 37135 compress_Compiler.prototype.media = function (node) { 37136 return this.emit('@media ' + node.media, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); 37137 }; 37138 /** 37139 * Visit document node. 37140 */ 37141 37142 37143 compress_Compiler.prototype.document = function (node) { 37144 const doc = '@' + (node.vendor || '') + 'document ' + node.document; 37145 return this.emit(doc, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); 37146 }; 37147 /** 37148 * Visit charset node. 37149 */ 37150 37151 37152 compress_Compiler.prototype.charset = function (node) { 37153 return this.emit('@charset ' + node.charset + ';', node.position); 37154 }; 37155 /** 37156 * Visit namespace node. 37157 */ 37158 37159 37160 compress_Compiler.prototype.namespace = function (node) { 37161 return this.emit('@namespace ' + node.namespace + ';', node.position); 37162 }; 37163 /** 37164 * Visit supports node. 37165 */ 37166 37167 37168 compress_Compiler.prototype.supports = function (node) { 37169 return this.emit('@supports ' + node.supports, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); 37170 }; 37171 /** 37172 * Visit keyframes node. 37173 */ 37174 37175 37176 compress_Compiler.prototype.keyframes = function (node) { 37177 return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit('{') + this.mapVisit(node.keyframes) + this.emit('}'); 37178 }; 37179 /** 37180 * Visit keyframe node. 37181 */ 37182 37183 37184 compress_Compiler.prototype.keyframe = function (node) { 37185 const decls = node.declarations; 37186 return this.emit(node.values.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}'); 37187 }; 37188 /** 37189 * Visit page node. 37190 */ 37191 37192 37193 compress_Compiler.prototype.page = function (node) { 37194 const sel = node.selectors.length ? node.selectors.join(', ') : ''; 37195 return this.emit('@page ' + sel, node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}'); 37196 }; 37197 /** 37198 * Visit font-face node. 37199 */ 37200 37201 37202 compress_Compiler.prototype['font-face'] = function (node) { 37203 return this.emit('@font-face', node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}'); 37204 }; 37205 /** 37206 * Visit host node. 37207 */ 37208 37209 37210 compress_Compiler.prototype.host = function (node) { 37211 return this.emit('@host', node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); 37212 }; 37213 /** 37214 * Visit custom-media node. 37215 */ 37216 37217 37218 compress_Compiler.prototype['custom-media'] = function (node) { 37219 return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); 37220 }; 37221 /** 37222 * Visit rule node. 37223 */ 37224 37225 37226 compress_Compiler.prototype.rule = function (node) { 37227 const decls = node.declarations; 37228 37229 if (!decls.length) { 37230 return ''; 37231 } 37232 37233 return this.emit(node.selectors.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}'); 37234 }; 37235 /** 37236 * Visit declaration node. 37237 */ 37238 37239 37240 compress_Compiler.prototype.declaration = function (node) { 37241 return this.emit(node.property + ':' + node.value, node.position) + this.emit(';'); 37242 }; 37243 37244 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/identity.js 37245 /* eslint-disable @wordpress/no-unused-vars-before-return */ 37246 // Adapted from https://github.com/reworkcss/css 37247 // because we needed to remove source map support. 37248 37249 /** 37250 * External dependencies 37251 */ 37252 37253 /** 37254 * Internal dependencies 37255 */ 37256 37257 37258 /** 37259 * Expose compiler. 37260 */ 37261 37262 /* harmony default export */ var identity = (identity_Compiler); 37263 /** 37264 * Initialize a new `Compiler`. 37265 */ 37266 37267 function identity_Compiler(options) { 37268 options = options || {}; 37269 stringify_compiler.call(this, options); 37270 this.indentation = options.indent; 37271 } 37272 /** 37273 * Inherit from `Base.prototype`. 37274 */ 37275 37276 37277 inherits_browser_default()(identity_Compiler, stringify_compiler); 37278 /** 37279 * Compile `node`. 37280 */ 37281 37282 identity_Compiler.prototype.compile = function (node) { 37283 return this.stylesheet(node); 37284 }; 37285 /** 37286 * Visit stylesheet node. 37287 */ 37288 37289 37290 identity_Compiler.prototype.stylesheet = function (node) { 37291 return this.mapVisit(node.stylesheet.rules, '\n\n'); 37292 }; 37293 /** 37294 * Visit comment node. 37295 */ 37296 37297 37298 identity_Compiler.prototype.comment = function (node) { 37299 return this.emit(this.indent() + '/*' + node.comment + '*/', node.position); 37300 }; 37301 /** 37302 * Visit import node. 37303 */ 37304 37305 37306 identity_Compiler.prototype.import = function (node) { 37307 return this.emit('@import ' + node.import + ';', node.position); 37308 }; 37309 /** 37310 * Visit media node. 37311 */ 37312 37313 37314 identity_Compiler.prototype.media = function (node) { 37315 return this.emit('@media ' + node.media, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); 37316 }; 37317 /** 37318 * Visit document node. 37319 */ 37320 37321 37322 identity_Compiler.prototype.document = function (node) { 37323 const doc = '@' + (node.vendor || '') + 'document ' + node.document; 37324 return this.emit(doc, node.position) + this.emit(' ' + ' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); 37325 }; 37326 /** 37327 * Visit charset node. 37328 */ 37329 37330 37331 identity_Compiler.prototype.charset = function (node) { 37332 return this.emit('@charset ' + node.charset + ';', node.position); 37333 }; 37334 /** 37335 * Visit namespace node. 37336 */ 37337 37338 37339 identity_Compiler.prototype.namespace = function (node) { 37340 return this.emit('@namespace ' + node.namespace + ';', node.position); 37341 }; 37342 /** 37343 * Visit supports node. 37344 */ 37345 37346 37347 identity_Compiler.prototype.supports = function (node) { 37348 return this.emit('@supports ' + node.supports, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); 37349 }; 37350 /** 37351 * Visit keyframes node. 37352 */ 37353 37354 37355 identity_Compiler.prototype.keyframes = function (node) { 37356 return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.keyframes, '\n') + this.emit(this.indent(-1) + '}'); 37357 }; 37358 /** 37359 * Visit keyframe node. 37360 */ 37361 37362 37363 identity_Compiler.prototype.keyframe = function (node) { 37364 const decls = node.declarations; 37365 return this.emit(this.indent()) + this.emit(node.values.join(', '), node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1) + '\n' + this.indent() + '}\n'); 37366 }; 37367 /** 37368 * Visit page node. 37369 */ 37370 37371 37372 identity_Compiler.prototype.page = function (node) { 37373 const sel = node.selectors.length ? node.selectors.join(', ') + ' ' : ''; 37374 return this.emit('@page ' + sel, node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}'); 37375 }; 37376 /** 37377 * Visit font-face node. 37378 */ 37379 37380 37381 identity_Compiler.prototype['font-face'] = function (node) { 37382 return this.emit('@font-face ', node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}'); 37383 }; 37384 /** 37385 * Visit host node. 37386 */ 37387 37388 37389 identity_Compiler.prototype.host = function (node) { 37390 return this.emit('@host', node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); 37391 }; 37392 /** 37393 * Visit custom-media node. 37394 */ 37395 37396 37397 identity_Compiler.prototype['custom-media'] = function (node) { 37398 return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); 37399 }; 37400 /** 37401 * Visit rule node. 37402 */ 37403 37404 37405 identity_Compiler.prototype.rule = function (node) { 37406 const indent = this.indent(); 37407 const decls = node.declarations; 37408 37409 if (!decls.length) { 37410 return ''; 37411 } 37412 37413 return this.emit(node.selectors.map(function (s) { 37414 return indent + s; 37415 }).join(',\n'), node.position) + this.emit(' {\n') + this.emit(this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1)) + this.emit('\n' + this.indent() + '}'); 37416 }; 37417 /** 37418 * Visit declaration node. 37419 */ 37420 37421 37422 identity_Compiler.prototype.declaration = function (node) { 37423 return this.emit(this.indent()) + this.emit(node.property + ': ' + node.value, node.position) + this.emit(';'); 37424 }; 37425 /** 37426 * Increase, decrease or return current indentation. 37427 */ 37428 37429 37430 identity_Compiler.prototype.indent = function (level) { 37431 this.level = this.level || 1; 37432 37433 if (null !== level) { 37434 this.level += level; 37435 return ''; 37436 } 37437 37438 return Array(this.level).join(this.indentation || ' '); 37439 }; 37440 /* eslint-enable @wordpress/no-unused-vars-before-return */ 37441 37442 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/ast/stringify/index.js 37443 // Adapted from https://github.com/reworkcss/css 37444 // because we needed to remove source map support. 37445 37446 /** 37447 * Internal dependencies 37448 */ 37449 37450 37451 /** 37452 * Stringfy the given AST `node`. 37453 * 37454 * Options: 37455 * 37456 * - `compress` space-optimized output 37457 * - `sourcemap` return an object with `.code` and `.map` 37458 * 37459 * @param {Object} node 37460 * @param {Object} [options] 37461 * @return {string} 37462 */ 37463 37464 /* harmony default export */ var stringify = (function (node, options) { 37465 options = options || {}; 37466 const compiler = options.compress ? new compress(options) : new identity(options); 37467 const code = compiler.compile(node); 37468 return code; 37469 }); 37470 37471 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/traverse.js 37472 /** 37473 * External dependencies 37474 */ 37475 37476 /** 37477 * Internal dependencies 37478 */ 37479 37480 37481 37482 function traverseCSS(css, callback) { 37483 try { 37484 const parsed = parse(css); 37485 const updated = traverse_default.a.map(parsed, function (node) { 37486 if (!node) { 37487 return node; 37488 } 37489 37490 const updatedNode = callback(node); 37491 return this.update(updatedNode); 37492 }); 37493 return stringify(updated); 37494 } catch (err) { 37495 // eslint-disable-next-line no-console 37496 console.warn('Error while traversing the CSS: ' + err); 37497 return null; 37498 } 37499 } 37500 37501 /* harmony default export */ var transform_styles_traverse = (traverseCSS); 37502 37503 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/transforms/url-rewrite.js 37504 /** 37505 * Return `true` if the given path is http/https. 37506 * 37507 * @param {string} filePath path 37508 * 37509 * @return {boolean} is remote path. 37510 */ 37511 function isRemotePath(filePath) { 37512 return /^(?:https?:)?\/\//.test(filePath); 37513 } 37514 /** 37515 * Return `true` if the given filePath is an absolute url. 37516 * 37517 * @param {string} filePath path 37518 * 37519 * @return {boolean} is absolute path. 37520 */ 37521 37522 37523 function isAbsolutePath(filePath) { 37524 return /^\/(?!\/)/.test(filePath); 37525 } 37526 /** 37527 * Whether or not the url should be inluded. 37528 * 37529 * @param {Object} meta url meta info 37530 * 37531 * @return {boolean} is valid. 37532 */ 37533 37534 37535 function isValidURL(meta) { 37536 // ignore hashes or data uris 37537 if (meta.value.indexOf('data:') === 0 || meta.value.indexOf('#') === 0) { 37538 return false; 37539 } 37540 37541 if (isAbsolutePath(meta.value)) { 37542 return false; 37543 } // do not handle the http/https urls if `includeRemote` is false 37544 37545 37546 if (isRemotePath(meta.value)) { 37547 return false; 37548 } 37549 37550 return true; 37551 } 37552 /** 37553 * Get the absolute path of the url, relative to the basePath 37554 * 37555 * @param {string} str the url 37556 * @param {string} baseURL base URL 37557 * 37558 * @return {string} the full path to the file 37559 */ 37560 37561 37562 function getResourcePath(str, baseURL) { 37563 return new URL(str, baseURL).toString(); 37564 } 37565 /** 37566 * Process the single `url()` pattern 37567 * 37568 * @param {string} baseURL the base URL for relative URLs 37569 * @return {Promise} the Promise 37570 */ 37571 37572 37573 function processURL(baseURL) { 37574 return meta => ({ ...meta, 37575 newUrl: 'url(' + meta.before + meta.quote + getResourcePath(meta.value, baseURL) + meta.quote + meta.after + ')' 37576 }); 37577 } 37578 /** 37579 * Get all `url()`s, and return the meta info 37580 * 37581 * @param {string} value decl.value 37582 * 37583 * @return {Array} the urls 37584 */ 37585 37586 37587 function getURLs(value) { 37588 const reg = /url\((\s*)(['"]?)(.+?)\2(\s*)\)/g; 37589 let match; 37590 const URLs = []; 37591 37592 while ((match = reg.exec(value)) !== null) { 37593 const meta = { 37594 source: match[0], 37595 before: match[1], 37596 quote: match[2], 37597 value: match[3], 37598 after: match[4] 37599 }; 37600 37601 if (isValidURL(meta)) { 37602 URLs.push(meta); 37603 } 37604 } 37605 37606 return URLs; 37607 } 37608 /** 37609 * Replace the raw value's `url()` segment to the new value 37610 * 37611 * @param {string} raw the raw value 37612 * @param {Array} URLs the URLs to replace 37613 * 37614 * @return {string} the new value 37615 */ 37616 37617 37618 function replaceURLs(raw, URLs) { 37619 URLs.forEach(item => { 37620 raw = raw.replace(item.source, item.newUrl); 37621 }); 37622 return raw; 37623 } 37624 37625 const rewrite = rootURL => node => { 37626 if (node.type === 'declaration') { 37627 const updatedURLs = getURLs(node.value).map(processURL(rootURL)); 37628 return { ...node, 37629 value: replaceURLs(node.value, updatedURLs) 37630 }; 37631 } 37632 37633 return node; 37634 }; 37635 37636 /* harmony default export */ var url_rewrite = (rewrite); 37637 37638 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/transforms/wrap.js 37639 /** 37640 * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector. 37641 */ 37642 const IS_ROOT_TAG = /^(body|html|:root).*$/; 37643 37644 const wrap = (namespace, ignore = []) => node => { 37645 const updateSelector = selector => { 37646 if (ignore.includes(selector.trim())) { 37647 return selector; 37648 } // Anything other than a root tag is always prefixed. 37649 37650 37651 { 37652 if (!selector.match(IS_ROOT_TAG)) { 37653 return namespace + ' ' + selector; 37654 } 37655 } // HTML and Body elements cannot be contained within our container so lets extract their styles. 37656 37657 return selector.replace(/^(body|html|:root)/, namespace); 37658 }; 37659 37660 if (node.type === 'rule') { 37661 return { ...node, 37662 selectors: node.selectors.map(updateSelector) 37663 }; 37664 } 37665 37666 return node; 37667 }; 37668 37669 /* harmony default export */ var transforms_wrap = (wrap); 37670 37671 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js 37672 /** 37673 * External dependencies 37674 */ 37675 37676 /** 37677 * WordPress dependencies 37678 */ 37679 37680 37681 /** 37682 * Internal dependencies 37683 */ 37684 37685 37686 37687 37688 /** 37689 * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed. 37690 * 37691 * @param {Array} styles CSS rules. 37692 * @param {string} wrapperClassName Wrapper Class Name. 37693 * @return {Array} converted rules. 37694 */ 37695 37696 const transformStyles = (styles, wrapperClassName = '') => { 37697 return Object(external_lodash_["map"])(styles, ({ 37698 css, 37699 baseURL, 37700 __experimentalNoWrapper = false 37701 }) => { 37702 const transforms = []; 37703 37704 if (wrapperClassName && !__experimentalNoWrapper) { 37705 transforms.push(transforms_wrap(wrapperClassName)); 37706 } 37707 37708 if (baseURL) { 37709 transforms.push(url_rewrite(baseURL)); 37710 } 37711 37712 if (transforms.length) { 37713 return transform_styles_traverse(css, Object(external_wp_compose_["compose"])(transforms)); 37714 } 37715 37716 return css; 37717 }); 37718 }; 37719 37720 /* harmony default export */ var transform_styles = (transformStyles); 37721 37722 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js 37723 37724 37725 /** 37726 * External dependencies 37727 */ 37728 37729 /** 37730 * WordPress dependencies 37731 */ 37732 37733 37734 /** 37735 * Internal dependencies 37736 */ 37737 37738 37739 const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper'; 37740 37741 function useDarkThemeBodyClassName(styles) { 37742 return Object(external_wp_element_["useCallback"])(node => { 37743 if (!node) { 37744 return; 37745 } 37746 37747 const { 37748 ownerDocument 37749 } = node; 37750 const { 37751 defaultView, 37752 body 37753 } = ownerDocument; 37754 const canvas = ownerDocument.querySelector(EDITOR_STYLES_SELECTOR); 37755 let backgroundColor; 37756 37757 if (!canvas) { 37758 // The real .editor-styles-wrapper element might not exist in the 37759 // DOM, so calculate the background color by creating a fake 37760 // wrapper. 37761 const tempCanvas = ownerDocument.createElement('div'); 37762 tempCanvas.classList.add('editor-styles-wrapper'); 37763 body.appendChild(tempCanvas); 37764 backgroundColor = defaultView.getComputedStyle(tempCanvas, null).getPropertyValue('background-color'); 37765 body.removeChild(tempCanvas); 37766 } else { 37767 backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color'); 37768 } // If background is transparent, it should be treated as light color. 37769 37770 37771 if (tinycolor_default()(backgroundColor).getLuminance() > 0.5 || tinycolor_default()(backgroundColor).getAlpha() === 0) { 37772 body.classList.remove('is-dark-theme'); 37773 } else { 37774 body.classList.add('is-dark-theme'); 37775 } 37776 }, [styles]); 37777 } 37778 37779 function EditorStyles({ 37780 styles 37781 }) { 37782 const transformedStyles = Object(external_wp_element_["useMemo"])(() => transform_styles(styles, EDITOR_STYLES_SELECTOR), [styles]); 37783 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("style", { 37784 ref: useDarkThemeBodyClassName(styles) 37785 }), transformedStyles.map((css, index) => Object(external_wp_element_["createElement"])("style", { 37786 key: index 37787 }, css))); 37788 } 37789 37790 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js 37791 37792 37793 /** 37794 * External dependencies 37795 */ 37796 37797 /** 37798 * WordPress dependencies 37799 */ 37800 37801 37802 /** 37803 * Internal dependencies 37804 */ 37805 37806 37807 37808 37809 function InserterLibrary({ 37810 rootClientId, 37811 clientId, 37812 isAppender, 37813 showInserterHelpPanel, 37814 showMostUsedBlocks = false, 37815 __experimentalInsertionIndex, 37816 onSelect = external_lodash_["noop"], 37817 shouldFocusBlock = false 37818 }) { 37819 const destinationRootClientId = Object(external_wp_data_["useSelect"])(select => { 37820 const { 37821 getBlockRootClientId 37822 } = select(store); 37823 return rootClientId || getBlockRootClientId(clientId) || undefined; 37824 }, [clientId, rootClientId]); 37825 return Object(external_wp_element_["createElement"])(menu, { 37826 onSelect: onSelect, 37827 rootClientId: destinationRootClientId, 37828 clientId: clientId, 37829 isAppender: isAppender, 37830 showInserterHelpPanel: showInserterHelpPanel, 37831 showMostUsedBlocks: showMostUsedBlocks, 37832 __experimentalInsertionIndex: __experimentalInsertionIndex, 37833 shouldFocusBlock: shouldFocusBlock 37834 }); 37835 } 37836 37837 /* harmony default export */ var library = (InserterLibrary); 37838 37839 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/keyboard-shortcuts/index.js 37840 /** 37841 * External dependencies 37842 */ 37843 37844 /** 37845 * WordPress dependencies 37846 */ 37847 37848 37849 37850 37851 37852 /** 37853 * Internal dependencies 37854 */ 37855 37856 37857 37858 function KeyboardShortcuts() { 37859 // Shortcuts Logic 37860 const { 37861 clientIds, 37862 rootClientId 37863 } = Object(external_wp_data_["useSelect"])(select => { 37864 const { 37865 getSelectedBlockClientIds, 37866 getBlockRootClientId 37867 } = select(store); 37868 const selectedClientIds = getSelectedBlockClientIds(); 37869 const [firstClientId] = selectedClientIds; 37870 return { 37871 clientIds: selectedClientIds, 37872 rootClientId: getBlockRootClientId(firstClientId) 37873 }; 37874 }, []); 37875 const { 37876 duplicateBlocks, 37877 removeBlocks, 37878 insertAfterBlock, 37879 insertBeforeBlock, 37880 clearSelectedBlock, 37881 moveBlocksUp, 37882 moveBlocksDown 37883 } = Object(external_wp_data_["useDispatch"])(store); // Moves selected block/blocks up 37884 37885 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/move-up', Object(external_wp_element_["useCallback"])(event => { 37886 event.preventDefault(); 37887 moveBlocksUp(clientIds, rootClientId); 37888 }, [clientIds, moveBlocksUp]), { 37889 bindGlobal: true, 37890 isDisabled: clientIds.length === 0 37891 }); // Moves selected block/blocks up 37892 37893 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/move-down', Object(external_wp_element_["useCallback"])(event => { 37894 event.preventDefault(); 37895 moveBlocksDown(clientIds, rootClientId); 37896 }, [clientIds, moveBlocksDown]), { 37897 bindGlobal: true, 37898 isDisabled: clientIds.length === 0 37899 }); // Prevents bookmark all Tabs shortcut in Chrome when devtools are closed. 37900 // Prevents reposition Chrome devtools pane shortcut when devtools are open. 37901 37902 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/duplicate', Object(external_wp_element_["useCallback"])(event => { 37903 event.preventDefault(); 37904 duplicateBlocks(clientIds); 37905 }, [clientIds, duplicateBlocks]), { 37906 bindGlobal: true, 37907 isDisabled: clientIds.length === 0 37908 }); // Does not clash with any known browser/native shortcuts, but preventDefault 37909 // is used to prevent any obscure unknown shortcuts from triggering. 37910 37911 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/remove', Object(external_wp_element_["useCallback"])(event => { 37912 event.preventDefault(); 37913 removeBlocks(clientIds); 37914 }, [clientIds, removeBlocks]), { 37915 bindGlobal: true, 37916 isDisabled: clientIds.length === 0 37917 }); // Does not clash with any known browser/native shortcuts, but preventDefault 37918 // is used to prevent any obscure unknown shortcuts from triggering. 37919 37920 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/insert-after', Object(external_wp_element_["useCallback"])(event => { 37921 event.preventDefault(); 37922 insertAfterBlock(Object(external_lodash_["last"])(clientIds)); 37923 }, [clientIds, insertAfterBlock]), { 37924 bindGlobal: true, 37925 isDisabled: clientIds.length === 0 37926 }); // Prevent 'view recently closed tabs' in Opera using preventDefault. 37927 37928 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/insert-before', Object(external_wp_element_["useCallback"])(event => { 37929 event.preventDefault(); 37930 insertBeforeBlock(Object(external_lodash_["first"])(clientIds)); 37931 }, [clientIds, insertBeforeBlock]), { 37932 bindGlobal: true, 37933 isDisabled: clientIds.length === 0 37934 }); 37935 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/delete-multi-selection', Object(external_wp_element_["useCallback"])(event => { 37936 event.preventDefault(); 37937 removeBlocks(clientIds); 37938 }, [clientIds, removeBlocks]), { 37939 isDisabled: clientIds.length < 2 37940 }); 37941 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/block-editor/unselect', Object(external_wp_element_["useCallback"])(event => { 37942 event.preventDefault(); 37943 clearSelectedBlock(); 37944 event.target.ownerDocument.defaultView.getSelection().removeAllRanges(); 37945 }, [clientIds, clearSelectedBlock]), { 37946 isDisabled: clientIds.length < 2 37947 }); 37948 return null; 37949 } 37950 37951 function KeyboardShortcutsRegister() { 37952 // Registering the shortcuts 37953 const { 37954 registerShortcut 37955 } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]); 37956 Object(external_wp_element_["useEffect"])(() => { 37957 registerShortcut({ 37958 name: 'core/block-editor/duplicate', 37959 category: 'block', 37960 description: Object(external_wp_i18n_["__"])('Duplicate the selected block(s).'), 37961 keyCombination: { 37962 modifier: 'primaryShift', 37963 character: 'd' 37964 } 37965 }); 37966 registerShortcut({ 37967 name: 'core/block-editor/remove', 37968 category: 'block', 37969 description: Object(external_wp_i18n_["__"])('Remove the selected block(s).'), 37970 keyCombination: { 37971 modifier: 'access', 37972 character: 'z' 37973 } 37974 }); 37975 registerShortcut({ 37976 name: 'core/block-editor/insert-before', 37977 category: 'block', 37978 description: Object(external_wp_i18n_["__"])('Insert a new block before the selected block(s).'), 37979 keyCombination: { 37980 modifier: 'primaryAlt', 37981 character: 't' 37982 } 37983 }); 37984 registerShortcut({ 37985 name: 'core/block-editor/insert-after', 37986 category: 'block', 37987 description: Object(external_wp_i18n_["__"])('Insert a new block after the selected block(s).'), 37988 keyCombination: { 37989 modifier: 'primaryAlt', 37990 character: 'y' 37991 } 37992 }); 37993 registerShortcut({ 37994 name: 'core/block-editor/delete-multi-selection', 37995 category: 'block', 37996 description: Object(external_wp_i18n_["__"])('Remove multiple selected blocks.'), 37997 keyCombination: { 37998 character: 'del' 37999 }, 38000 aliases: [{ 38001 character: 'backspace' 38002 }] 38003 }); 38004 registerShortcut({ 38005 name: 'core/block-editor/select-all', 38006 category: 'selection', 38007 description: Object(external_wp_i18n_["__"])('Select all text when typing. Press again to select all blocks.'), 38008 keyCombination: { 38009 modifier: 'primary', 38010 character: 'a' 38011 } 38012 }); 38013 registerShortcut({ 38014 name: 'core/block-editor/unselect', 38015 category: 'selection', 38016 description: Object(external_wp_i18n_["__"])('Clear selection.'), 38017 keyCombination: { 38018 character: 'escape' 38019 } 38020 }); 38021 registerShortcut({ 38022 name: 'core/block-editor/focus-toolbar', 38023 category: 'global', 38024 description: Object(external_wp_i18n_["__"])('Navigate to the nearest toolbar.'), 38025 keyCombination: { 38026 modifier: 'alt', 38027 character: 'F10' 38028 } 38029 }); 38030 registerShortcut({ 38031 name: 'core/block-editor/move-up', 38032 category: 'block', 38033 description: Object(external_wp_i18n_["__"])('Move the selected block(s) up.'), 38034 keyCombination: { 38035 modifier: 'secondary', 38036 character: 't' 38037 } 38038 }); 38039 registerShortcut({ 38040 name: 'core/block-editor/move-down', 38041 category: 'block', 38042 description: Object(external_wp_i18n_["__"])('Move the selected block(s) down.'), 38043 keyCombination: { 38044 modifier: 'secondary', 38045 character: 'y' 38046 } 38047 }); 38048 }, [registerShortcut]); 38049 return null; 38050 } 38051 38052 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 38053 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); 38054 38055 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js 38056 /** 38057 * WordPress dependencies 38058 */ 38059 38060 /** 38061 * Scrolls the multi block selection end into view if not in view already. This 38062 * is important to do after selection by keyboard. 38063 * 38064 * @deprecated 38065 */ 38066 38067 function MultiSelectScrollIntoView() { 38068 external_wp_deprecated_default()('wp.blockEditor.MultiSelectScrollIntoView', { 38069 hint: 'This behaviour is now built-in.' 38070 }); 38071 return null; 38072 } 38073 38074 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js 38075 38076 38077 /** 38078 * WordPress dependencies 38079 */ 38080 38081 38082 38083 38084 /** 38085 * Internal dependencies 38086 */ 38087 38088 38089 /** 38090 * Set of key codes upon which typing is to be initiated on a keydown event. 38091 * 38092 * @type {Set<number>} 38093 */ 38094 38095 const KEY_DOWN_ELIGIBLE_KEY_CODES = new Set([external_wp_keycodes_["UP"], external_wp_keycodes_["RIGHT"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["ENTER"], external_wp_keycodes_["BACKSPACE"]]); 38096 /** 38097 * Returns true if a given keydown event can be inferred as intent to start 38098 * typing, or false otherwise. A keydown is considered eligible if it is a 38099 * text navigation without shift active. 38100 * 38101 * @param {KeyboardEvent} event Keydown event to test. 38102 * 38103 * @return {boolean} Whether event is eligible to start typing. 38104 */ 38105 38106 function isKeyDownEligibleForStartTyping(event) { 38107 const { 38108 keyCode, 38109 shiftKey 38110 } = event; 38111 return !shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has(keyCode); 38112 } 38113 /** 38114 * Removes the `isTyping` flag when the mouse moves in the document of the given 38115 * element. 38116 */ 38117 38118 38119 function useMouseMoveTypingReset() { 38120 const isTyping = Object(external_wp_data_["useSelect"])(select => select(store).isTyping()); 38121 const { 38122 stopTyping 38123 } = Object(external_wp_data_["useDispatch"])(store); 38124 return Object(external_wp_compose_["useRefEffect"])(node => { 38125 if (!isTyping) { 38126 return; 38127 } 38128 38129 const { 38130 ownerDocument 38131 } = node; 38132 let lastClientX; 38133 let lastClientY; 38134 /** 38135 * On mouse move, unset typing flag if user has moved cursor. 38136 * 38137 * @param {MouseEvent} event Mousemove event. 38138 */ 38139 38140 function stopTypingOnMouseMove(event) { 38141 const { 38142 clientX, 38143 clientY 38144 } = event; // We need to check that the mouse really moved because Safari 38145 // triggers mousemove events when shift or ctrl are pressed. 38146 38147 if (lastClientX && lastClientY && (lastClientX !== clientX || lastClientY !== clientY)) { 38148 stopTyping(); 38149 } 38150 38151 lastClientX = clientX; 38152 lastClientY = clientY; 38153 } 38154 38155 ownerDocument.addEventListener('mousemove', stopTypingOnMouseMove); 38156 return () => { 38157 ownerDocument.removeEventListener('mousemove', stopTypingOnMouseMove); 38158 }; 38159 }, [isTyping, stopTyping]); 38160 } 38161 /** 38162 * Sets and removes the `isTyping` flag based on user actions: 38163 * 38164 * - Sets the flag if the user types within the given element. 38165 * - Removes the flag when the user selects some text, focusses a non-text 38166 * field, presses ESC or TAB, or moves the mouse in the document. 38167 */ 38168 38169 function useTypingObserver() { 38170 const isTyping = Object(external_wp_data_["useSelect"])(select => select(store).isTyping()); 38171 const { 38172 startTyping, 38173 stopTyping 38174 } = Object(external_wp_data_["useDispatch"])(store); 38175 const ref1 = useMouseMoveTypingReset(); 38176 const ref2 = Object(external_wp_compose_["useRefEffect"])(node => { 38177 const { 38178 ownerDocument 38179 } = node; 38180 const { 38181 defaultView 38182 } = ownerDocument; // Listeners to stop typing should only be added when typing. 38183 // Listeners to start typing should only be added when not typing. 38184 38185 if (isTyping) { 38186 let timerId; 38187 /** 38188 * Stops typing when focus transitions to a non-text field element. 38189 * 38190 * @param {FocusEvent} event Focus event. 38191 */ 38192 38193 function stopTypingOnNonTextField(event) { 38194 const { 38195 target 38196 } = event; // Since focus to a non-text field via arrow key will trigger 38197 // before the keydown event, wait until after current stack 38198 // before evaluating whether typing is to be stopped. Otherwise, 38199 // typing will re-start. 38200 38201 timerId = defaultView.setTimeout(() => { 38202 if (!Object(external_wp_dom_["isTextField"])(target)) { 38203 stopTyping(); 38204 } 38205 }); 38206 } 38207 /** 38208 * Unsets typing flag if user presses Escape while typing flag is 38209 * active. 38210 * 38211 * @param {KeyboardEvent} event Keypress or keydown event to 38212 * interpret. 38213 */ 38214 38215 38216 function stopTypingOnEscapeKey(event) { 38217 const { 38218 keyCode 38219 } = event; 38220 38221 if (keyCode === external_wp_keycodes_["ESCAPE"] || keyCode === external_wp_keycodes_["TAB"]) { 38222 stopTyping(); 38223 } 38224 } 38225 /** 38226 * On selection change, unset typing flag if user has made an 38227 * uncollapsed (shift) selection. 38228 */ 38229 38230 38231 function stopTypingOnSelectionUncollapse() { 38232 const selection = defaultView.getSelection(); 38233 const isCollapsed = selection.rangeCount > 0 && selection.getRangeAt(0).collapsed; 38234 38235 if (!isCollapsed) { 38236 stopTyping(); 38237 } 38238 } 38239 38240 node.addEventListener('focus', stopTypingOnNonTextField); 38241 node.addEventListener('keydown', stopTypingOnEscapeKey); 38242 ownerDocument.addEventListener('selectionchange', stopTypingOnSelectionUncollapse); 38243 return () => { 38244 defaultView.clearTimeout(timerId); 38245 node.removeEventListener('focus', stopTypingOnNonTextField); 38246 node.removeEventListener('keydown', stopTypingOnEscapeKey); 38247 ownerDocument.removeEventListener('selectionchange', stopTypingOnSelectionUncollapse); 38248 }; 38249 } 38250 /** 38251 * Handles a keypress or keydown event to infer intention to start 38252 * typing. 38253 * 38254 * @param {KeyboardEvent} event Keypress or keydown event to interpret. 38255 */ 38256 38257 38258 function startTypingInTextField(event) { 38259 const { 38260 type, 38261 target 38262 } = event; // Abort early if already typing, or key press is incurred outside a 38263 // text field (e.g. arrow-ing through toolbar buttons). 38264 // Ignore typing if outside the current DOM container 38265 38266 if (!Object(external_wp_dom_["isTextField"])(target) || !node.contains(target)) { 38267 return; 38268 } // Special-case keydown because certain keys do not emit a keypress 38269 // event. Conversely avoid keydown as the canonical event since 38270 // there are many keydown which are explicitly not targeted for 38271 // typing. 38272 38273 38274 if (type === 'keydown' && !isKeyDownEligibleForStartTyping(event)) { 38275 return; 38276 } 38277 38278 startTyping(); 38279 } 38280 38281 node.addEventListener('keypress', startTypingInTextField); 38282 node.addEventListener('keydown', startTypingInTextField); 38283 return () => { 38284 node.removeEventListener('keypress', startTypingInTextField); 38285 node.removeEventListener('keydown', startTypingInTextField); 38286 }; 38287 }, [isTyping, startTyping, stopTyping]); 38288 return Object(external_wp_compose_["useMergeRefs"])([ref1, ref2]); 38289 } 38290 38291 function ObserveTyping({ 38292 children 38293 }) { 38294 return Object(external_wp_element_["createElement"])("div", { 38295 ref: useTypingObserver() 38296 }, children); 38297 } 38298 /** 38299 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md 38300 */ 38301 38302 38303 /* harmony default export */ var observe_typing = (ObserveTyping); 38304 38305 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/preserve-scroll-in-reorder/index.js 38306 /** 38307 * WordPress dependencies 38308 */ 38309 38310 function PreserveScrollInReorder() { 38311 external_wp_deprecated_default()('PreserveScrollInReorder component', { 38312 since: '5.4', 38313 hint: 'This behavior is now built-in the block list' 38314 }); 38315 return null; 38316 } 38317 38318 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js 38319 38320 38321 /** 38322 * WordPress dependencies 38323 */ 38324 38325 38326 38327 38328 /** 38329 * Internal dependencies 38330 */ 38331 38332 38333 const isIE = window.navigator.userAgent.indexOf('Trident') !== -1; 38334 const arrowKeyCodes = new Set([external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]]); 38335 const initialTriggerPercentage = 0.75; 38336 function useTypewriter() { 38337 const hasSelectedBlock = Object(external_wp_data_["useSelect"])(select => select(store).hasSelectedBlock()); 38338 return Object(external_wp_compose_["useRefEffect"])(node => { 38339 if (!hasSelectedBlock) { 38340 return; 38341 } 38342 38343 const { 38344 ownerDocument 38345 } = node; 38346 const { 38347 defaultView 38348 } = ownerDocument; 38349 let scrollResizeRafId; 38350 let onKeyDownRafId; 38351 let caretRect; 38352 38353 function onScrollResize() { 38354 if (scrollResizeRafId) { 38355 return; 38356 } 38357 38358 scrollResizeRafId = defaultView.requestAnimationFrame(() => { 38359 computeCaretRectangle(); 38360 scrollResizeRafId = null; 38361 }); 38362 } 38363 38364 function onKeyDown(event) { 38365 // Ensure the any remaining request is cancelled. 38366 if (onKeyDownRafId) { 38367 defaultView.cancelAnimationFrame(onKeyDownRafId); 38368 } // Use an animation frame for a smooth result. 38369 38370 38371 onKeyDownRafId = defaultView.requestAnimationFrame(() => { 38372 maintainCaretPosition(event); 38373 onKeyDownRafId = null; 38374 }); 38375 } 38376 /** 38377 * Maintains the scroll position after a selection change caused by a 38378 * keyboard event. 38379 * 38380 * @param {KeyboardEvent} event Keyboard event. 38381 */ 38382 38383 38384 function maintainCaretPosition({ 38385 keyCode 38386 }) { 38387 if (!isSelectionEligibleForScroll()) { 38388 return; 38389 } 38390 38391 const currentCaretRect = Object(external_wp_dom_["computeCaretRect"])(defaultView); 38392 38393 if (!currentCaretRect) { 38394 return; 38395 } // If for some reason there is no position set to be scrolled to, let 38396 // this be the position to be scrolled to in the future. 38397 38398 38399 if (!caretRect) { 38400 caretRect = currentCaretRect; 38401 return; 38402 } // Even though enabling the typewriter effect for arrow keys results in 38403 // a pleasant experience, it may not be the case for everyone, so, for 38404 // now, let's disable it. 38405 38406 38407 if (arrowKeyCodes.has(keyCode)) { 38408 // Reset the caret position to maintain. 38409 caretRect = currentCaretRect; 38410 return; 38411 } 38412 38413 const diff = currentCaretRect.top - caretRect.top; 38414 38415 if (diff === 0) { 38416 return; 38417 } 38418 38419 const scrollContainer = Object(external_wp_dom_["getScrollContainer"])(node); // The page must be scrollable. 38420 38421 if (!scrollContainer) { 38422 return; 38423 } 38424 38425 const windowScroll = scrollContainer === ownerDocument.body; 38426 const scrollY = windowScroll ? defaultView.scrollY : scrollContainer.scrollTop; 38427 const scrollContainerY = windowScroll ? 0 : scrollContainer.getBoundingClientRect().top; 38428 const relativeScrollPosition = windowScroll ? caretRect.top / defaultView.innerHeight : (caretRect.top - scrollContainerY) / (defaultView.innerHeight - scrollContainerY); // If the scroll position is at the start, the active editable element 38429 // is the last one, and the caret is positioned within the initial 38430 // trigger percentage of the page, do not scroll the page. 38431 // The typewriter effect should not kick in until an empty page has been 38432 // filled with the initial trigger percentage or the user scrolls 38433 // intentionally down. 38434 38435 if (scrollY === 0 && relativeScrollPosition < initialTriggerPercentage && isLastEditableNode()) { 38436 // Reset the caret position to maintain. 38437 caretRect = currentCaretRect; 38438 return; 38439 } 38440 38441 const scrollContainerHeight = windowScroll ? defaultView.innerHeight : scrollContainer.clientHeight; // Abort if the target scroll position would scroll the caret out of 38442 // view. 38443 38444 if ( // The caret is under the lower fold. 38445 caretRect.top + caretRect.height > scrollContainerY + scrollContainerHeight || // The caret is above the upper fold. 38446 caretRect.top < scrollContainerY) { 38447 // Reset the caret position to maintain. 38448 caretRect = currentCaretRect; 38449 return; 38450 } 38451 38452 if (windowScroll) { 38453 defaultView.scrollBy(0, diff); 38454 } else { 38455 scrollContainer.scrollTop += diff; 38456 } 38457 } 38458 /** 38459 * Adds a `selectionchange` listener to reset the scroll position to be 38460 * maintained. 38461 */ 38462 38463 38464 function addSelectionChangeListener() { 38465 ownerDocument.addEventListener('selectionchange', computeCaretRectOnSelectionChange); 38466 } 38467 /** 38468 * Resets the scroll position to be maintained during a `selectionchange` 38469 * event. Also removes the listener, so it acts as a one-time listener. 38470 */ 38471 38472 38473 function computeCaretRectOnSelectionChange() { 38474 ownerDocument.removeEventListener('selectionchange', computeCaretRectOnSelectionChange); 38475 computeCaretRectangle(); 38476 } 38477 /** 38478 * Resets the scroll position to be maintained. 38479 */ 38480 38481 38482 function computeCaretRectangle() { 38483 if (isSelectionEligibleForScroll()) { 38484 caretRect = Object(external_wp_dom_["computeCaretRect"])(defaultView); 38485 } 38486 } 38487 /** 38488 * Checks if the current situation is elegible for scroll: 38489 * - There should be one and only one block selected. 38490 * - The component must contain the selection. 38491 * - The active element must be contenteditable. 38492 */ 38493 38494 38495 function isSelectionEligibleForScroll() { 38496 return node.contains(ownerDocument.activeElement) && ownerDocument.activeElement.isContentEditable; 38497 } 38498 38499 function isLastEditableNode() { 38500 const editableNodes = node.querySelectorAll('[contenteditable="true"]'); 38501 const lastEditableNode = editableNodes[editableNodes.length - 1]; 38502 return lastEditableNode === ownerDocument.activeElement; 38503 } // When the user scrolls or resizes, the scroll position should be 38504 // reset. 38505 38506 38507 defaultView.addEventListener('scroll', onScrollResize, true); 38508 defaultView.addEventListener('resize', onScrollResize, true); 38509 node.addEventListener('keydown', onKeyDown); 38510 node.addEventListener('keyup', maintainCaretPosition); 38511 node.addEventListener('mousedown', addSelectionChangeListener); 38512 node.addEventListener('touchstart', addSelectionChangeListener); 38513 return () => { 38514 defaultView.removeEventListener('scroll', onScrollResize, true); 38515 defaultView.removeEventListener('resize', onScrollResize, true); 38516 node.removeEventListener('keydown', onKeyDown); 38517 node.removeEventListener('keyup', maintainCaretPosition); 38518 node.removeEventListener('mousedown', addSelectionChangeListener); 38519 node.removeEventListener('touchstart', addSelectionChangeListener); 38520 ownerDocument.removeEventListener('selectionchange', computeCaretRectOnSelectionChange); 38521 defaultView.cancelAnimationFrame(scrollResizeRafId); 38522 defaultView.cancelAnimationFrame(onKeyDownRafId); 38523 }; 38524 }, [hasSelectedBlock]); 38525 } 38526 38527 function Typewriter({ 38528 children 38529 }) { 38530 return Object(external_wp_element_["createElement"])("div", { 38531 ref: useTypewriter(), 38532 className: "block-editor__typewriter" 38533 }, children); 38534 } 38535 /** 38536 * The exported component. The implementation of Typewriter faced technical 38537 * challenges in Internet Explorer, and is simply skipped, rendering the given 38538 * props children instead. 38539 * 38540 * @type {WPComponent} 38541 */ 38542 38543 38544 const TypewriterOrIEBypass = isIE ? props => props.children : Typewriter; 38545 /** 38546 * Ensures that the text selection keeps the same vertical distance from the 38547 * viewport during keyboard events within this component. The vertical distance 38548 * can vary. It is the last clicked or scrolled to position. 38549 */ 38550 38551 /* harmony default export */ var typewriter = (TypewriterOrIEBypass); 38552 38553 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js 38554 /** 38555 * External dependencies 38556 */ 38557 38558 /** 38559 * WordPress dependencies 38560 */ 38561 38562 38563 38564 /** 38565 * Internal dependencies 38566 */ 38567 38568 38569 38570 38571 function use_multi_selection_toggleRichText(container, toggle) { 38572 Array.from(container.querySelectorAll('.rich-text')).forEach(node => { 38573 if (toggle) { 38574 node.setAttribute('contenteditable', true); 38575 } else { 38576 node.removeAttribute('contenteditable'); 38577 } 38578 }); 38579 } 38580 /** 38581 * Returns for the deepest node at the start or end of a container node. Ignores 38582 * any text nodes that only contain HTML formatting whitespace. 38583 * 38584 * @param {Element} node Container to search. 38585 * @param {string} type 'start' or 'end'. 38586 */ 38587 38588 38589 function getDeepestNode(node, type) { 38590 const child = type === 'start' ? 'firstChild' : 'lastChild'; 38591 const sibling = type === 'start' ? 'nextSibling' : 'previousSibling'; 38592 38593 while (node[child]) { 38594 node = node[child]; 38595 38596 while (node.nodeType === node.TEXT_NODE && /^[ \t\n]*$/.test(node.data) && node[sibling]) { 38597 node = node[sibling]; 38598 } 38599 } 38600 38601 return node; 38602 } 38603 38604 function use_multi_selection_selector(select) { 38605 const { 38606 isMultiSelecting, 38607 getMultiSelectedBlockClientIds, 38608 hasMultiSelection, 38609 getSelectedBlockClientId 38610 } = select(store); 38611 return { 38612 isMultiSelecting: isMultiSelecting(), 38613 multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(), 38614 hasMultiSelection: hasMultiSelection(), 38615 selectedBlockClientId: getSelectedBlockClientId() 38616 }; 38617 } 38618 38619 function use_multi_selection_useMultiSelection() { 38620 const ref = Object(external_wp_element_["useRef"])(); 38621 const { 38622 isMultiSelecting, 38623 multiSelectedBlockClientIds, 38624 hasMultiSelection, 38625 selectedBlockClientId 38626 } = Object(external_wp_data_["useSelect"])(use_multi_selection_selector, []); 38627 const { 38628 selectBlock 38629 } = Object(external_wp_data_["useDispatch"])(store); 38630 const selectedRef = useBlockRef(selectedBlockClientId); // These must be in the right DOM order. 38631 38632 const startRef = useBlockRef(Object(external_lodash_["first"])(multiSelectedBlockClientIds)); 38633 const endRef = useBlockRef(Object(external_lodash_["last"])(multiSelectedBlockClientIds)); 38634 /** 38635 * When the component updates, and there is multi selection, we need to 38636 * select the entire block contents. 38637 */ 38638 38639 Object(external_wp_element_["useEffect"])(() => { 38640 const { 38641 ownerDocument 38642 } = ref.current; 38643 const { 38644 defaultView 38645 } = ownerDocument; 38646 38647 if (!hasMultiSelection || isMultiSelecting) { 38648 if (!selectedBlockClientId || isMultiSelecting) { 38649 return; 38650 } 38651 38652 const selection = defaultView.getSelection(); 38653 38654 if (selection.rangeCount && !selection.isCollapsed) { 38655 const blockNode = selectedRef.current; 38656 const { 38657 startContainer, 38658 endContainer 38659 } = selection.getRangeAt(0); 38660 38661 if (!!blockNode && (!blockNode.contains(startContainer) || !blockNode.contains(endContainer))) { 38662 selection.removeAllRanges(); 38663 } 38664 } 38665 38666 return; 38667 } 38668 38669 const { 38670 length 38671 } = multiSelectedBlockClientIds; 38672 38673 if (length < 2) { 38674 return; 38675 } // For some browsers, like Safari, it is important that focus happens 38676 // BEFORE selection. 38677 38678 38679 ref.current.focus(); 38680 const selection = defaultView.getSelection(); 38681 const range = ownerDocument.createRange(); // These must be in the right DOM order. 38682 // The most stable way to select the whole block contents is to start 38683 // and end at the deepest points. 38684 38685 const startNode = getDeepestNode(startRef.current, 'start'); 38686 const endNode = getDeepestNode(endRef.current, 'end'); // While rich text will be disabled with a delay when there is a multi 38687 // selection, we must do it immediately because it's not possible to set 38688 // selection across editable hosts. 38689 38690 use_multi_selection_toggleRichText(ref.current, false); 38691 range.setStartBefore(startNode); 38692 range.setEndAfter(endNode); 38693 selection.removeAllRanges(); 38694 selection.addRange(range); 38695 }, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectBlock, selectedBlockClientId]); 38696 return ref; 38697 } 38698 38699 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js 38700 38701 38702 /** 38703 * WordPress dependencies 38704 */ 38705 38706 38707 38708 38709 38710 /** 38711 * Internal dependencies 38712 */ 38713 38714 38715 38716 function isFormElement(element) { 38717 const { 38718 tagName 38719 } = element; 38720 return tagName === 'INPUT' || tagName === 'BUTTON' || tagName === 'SELECT' || tagName === 'TEXTAREA'; 38721 } 38722 38723 function useTabNav() { 38724 const container = Object(external_wp_element_["useRef"])(); 38725 const focusCaptureBeforeRef = Object(external_wp_element_["useRef"])(); 38726 const focusCaptureAfterRef = Object(external_wp_element_["useRef"])(); 38727 const lastFocus = Object(external_wp_element_["useRef"])(); 38728 const { 38729 hasMultiSelection, 38730 getSelectedBlockClientId 38731 } = Object(external_wp_data_["useSelect"])(store); 38732 const { 38733 setNavigationMode 38734 } = Object(external_wp_data_["useDispatch"])(store); 38735 const isNavigationMode = Object(external_wp_data_["useSelect"])(select => select(store).isNavigationMode(), []); // Don't allow tabbing to this element in Navigation mode. 38736 38737 const focusCaptureTabIndex = !isNavigationMode ? '0' : undefined; // Reference that holds the a flag for enabling or disabling 38738 // capturing on the focus capture elements. 38739 38740 const noCapture = Object(external_wp_element_["useRef"])(); 38741 38742 function onFocusCapture(event) { 38743 // Do not capture incoming focus if set by us in WritingFlow. 38744 if (noCapture.current) { 38745 noCapture.current = null; 38746 } else if (hasMultiSelection()) { 38747 container.current.focus(); 38748 } else if (getSelectedBlockClientId()) { 38749 lastFocus.current.focus(); 38750 } else { 38751 setNavigationMode(true); 38752 const isBefore = // eslint-disable-next-line no-bitwise 38753 event.target.compareDocumentPosition(container.current) & event.target.DOCUMENT_POSITION_FOLLOWING; 38754 const action = isBefore ? 'findNext' : 'findPrevious'; 38755 external_wp_dom_["focus"].tabbable[action](event.target).focus(); 38756 } 38757 } 38758 38759 const before = Object(external_wp_element_["createElement"])("div", { 38760 ref: focusCaptureBeforeRef, 38761 tabIndex: focusCaptureTabIndex, 38762 onFocus: onFocusCapture 38763 }); 38764 const after = Object(external_wp_element_["createElement"])("div", { 38765 ref: focusCaptureAfterRef, 38766 tabIndex: focusCaptureTabIndex, 38767 onFocus: onFocusCapture 38768 }); 38769 const ref = Object(external_wp_compose_["useRefEffect"])(node => { 38770 function onKeyDown(event) { 38771 if (event.keyCode === external_wp_keycodes_["ESCAPE"] && !hasMultiSelection()) { 38772 event.stopPropagation(); 38773 event.preventDefault(); 38774 setNavigationMode(true); 38775 return; 38776 } // In Edit mode, Tab should focus the first tabbable element after 38777 // the content, which is normally the sidebar (with block controls) 38778 // and Shift+Tab should focus the first tabbable element before the 38779 // content, which is normally the block toolbar. 38780 // Arrow keys can be used, and Tab and arrow keys can be used in 38781 // Navigation mode (press Esc), to navigate through blocks. 38782 38783 38784 if (event.keyCode !== external_wp_keycodes_["TAB"]) { 38785 return; 38786 } 38787 38788 const isShift = event.shiftKey; 38789 const direction = isShift ? 'findPrevious' : 'findNext'; 38790 38791 if (!hasMultiSelection() && !getSelectedBlockClientId()) { 38792 // Preserve the behaviour of entering navigation mode when 38793 // tabbing into the content without a block selection. 38794 // `onFocusCapture` already did this previously, but we need to 38795 // do it again here because after clearing block selection, 38796 // focus land on the writing flow container and pressing Tab 38797 // will no longer send focus through the focus capture element. 38798 if (event.target === node) setNavigationMode(true); 38799 return; 38800 } // Allow tabbing between form elements rendered in a block, 38801 // such as inside a placeholder. Form elements are generally 38802 // meant to be UI rather than part of the content. Ideally 38803 // these are not rendered in the content and perhaps in the 38804 // future they can be rendered in an iframe or shadow DOM. 38805 38806 38807 if (isFormElement(event.target) && isFormElement(external_wp_dom_["focus"].tabbable[direction](event.target))) { 38808 return; 38809 } 38810 38811 const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; // Disable focus capturing on the focus capture element, so it 38812 // doesn't refocus this block and so it allows default behaviour 38813 // (moving focus to the next tabbable element). 38814 38815 noCapture.current = true; // Focusing the focus capture element, which is located above and 38816 // below the editor, should not scroll the page all the way up or 38817 // down. 38818 38819 next.current.focus({ 38820 preventScroll: true 38821 }); 38822 } 38823 38824 function onFocusOut(event) { 38825 lastFocus.current = event.target; 38826 } // When tabbing back to an element in block list, this event handler prevents scrolling if the 38827 // focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph 38828 // when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the 38829 // top or bottom of the document. 38830 // 38831 // Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this 38832 // earlier in the keypress handler, and call focus( { preventScroll: true } ) instead. 38833 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters 38834 38835 38836 function preventScrollOnTab(event) { 38837 var _event$target; 38838 38839 if (event.keyCode !== external_wp_keycodes_["TAB"]) { 38840 return; 38841 } 38842 38843 if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('role')) === 'region') { 38844 return; 38845 } 38846 38847 if (container.current === event.target) { 38848 return; 38849 } 38850 38851 const isShift = event.shiftKey; 38852 const direction = isShift ? 'findPrevious' : 'findNext'; 38853 const target = external_wp_dom_["focus"].tabbable[direction](event.target); // only do something when the next tabbable is a focus capture div (before/after) 38854 38855 if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) { 38856 event.preventDefault(); 38857 target.focus({ 38858 preventScroll: true 38859 }); 38860 } 38861 } 38862 38863 node.ownerDocument.defaultView.addEventListener('keydown', preventScrollOnTab); 38864 node.addEventListener('keydown', onKeyDown); 38865 node.addEventListener('focusout', onFocusOut); 38866 return () => { 38867 node.ownerDocument.defaultView.removeEventListener('keydown', preventScrollOnTab); 38868 node.removeEventListener('keydown', onKeyDown); 38869 node.removeEventListener('focusout', onFocusOut); 38870 }; 38871 }, []); 38872 const mergedRefs = Object(external_wp_compose_["useMergeRefs"])([container, ref]); 38873 return [before, mergedRefs, after]; 38874 } 38875 38876 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js 38877 /** 38878 * External dependencies 38879 */ 38880 38881 /** 38882 * WordPress dependencies 38883 */ 38884 38885 38886 38887 38888 38889 /** 38890 * Internal dependencies 38891 */ 38892 38893 38894 38895 /** 38896 * Returns true if the element should consider edge navigation upon a keyboard 38897 * event of the given directional key code, or false otherwise. 38898 * 38899 * @param {Element} element HTML element to test. 38900 * @param {number} keyCode KeyboardEvent keyCode to test. 38901 * @param {boolean} hasModifier Whether a modifier is pressed. 38902 * 38903 * @return {boolean} Whether element should consider edge navigation. 38904 */ 38905 38906 function isNavigationCandidate(element, keyCode, hasModifier) { 38907 const isVertical = keyCode === external_wp_keycodes_["UP"] || keyCode === external_wp_keycodes_["DOWN"]; // Currently, all elements support unmodified vertical navigation. 38908 38909 if (isVertical && !hasModifier) { 38910 return true; 38911 } // Native inputs should not navigate horizontally. 38912 38913 38914 const { 38915 tagName 38916 } = element; 38917 return tagName !== 'INPUT' && tagName !== 'TEXTAREA'; 38918 } 38919 /** 38920 * Returns the optimal tab target from the given focused element in the desired 38921 * direction. A preference is made toward text fields, falling back to the block 38922 * focus stop if no other candidates exist for the block. 38923 * 38924 * @param {Element} target Currently focused text field. 38925 * @param {boolean} isReverse True if considering as the first field. 38926 * @param {Element} containerElement Element containing all blocks. 38927 * @param {boolean} onlyVertical Whether to only consider tabbable elements 38928 * that are visually above or under the 38929 * target. 38930 * 38931 * @return {?Element} Optimal tab target, if one exists. 38932 */ 38933 38934 function getClosestTabbable(target, isReverse, containerElement, onlyVertical) { 38935 // Since the current focus target is not guaranteed to be a text field, find 38936 // all focusables. Tabbability is considered later. 38937 let focusableNodes = external_wp_dom_["focus"].focusable.find(containerElement); 38938 38939 if (isReverse) { 38940 focusableNodes = Object(external_lodash_["reverse"])(focusableNodes); 38941 } // Consider as candidates those focusables after the current target. It's 38942 // assumed this can only be reached if the target is focusable (on its 38943 // keydown event), so no need to verify it exists in the set. 38944 38945 38946 focusableNodes = focusableNodes.slice(focusableNodes.indexOf(target) + 1); 38947 let targetRect; 38948 38949 if (onlyVertical) { 38950 targetRect = target.getBoundingClientRect(); 38951 } 38952 38953 function isTabCandidate(node) { 38954 // Not a candidate if the node is not tabbable. 38955 if (!external_wp_dom_["focus"].tabbable.isTabbableIndex(node)) { 38956 return false; 38957 } // Skip focusable elements such as links within content editable nodes. 38958 38959 38960 if (node.isContentEditable && node.contentEditable !== 'true') { 38961 return false; 38962 } 38963 38964 if (onlyVertical) { 38965 const nodeRect = node.getBoundingClientRect(); 38966 38967 if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) { 38968 return false; 38969 } 38970 } 38971 38972 return true; 38973 } 38974 38975 return Object(external_lodash_["find"])(focusableNodes, isTabCandidate); 38976 } 38977 function useArrowNav() { 38978 const { 38979 getSelectedBlockClientId, 38980 getMultiSelectedBlocksStartClientId, 38981 getMultiSelectedBlocksEndClientId, 38982 getPreviousBlockClientId, 38983 getNextBlockClientId, 38984 getFirstMultiSelectedBlockClientId, 38985 getLastMultiSelectedBlockClientId, 38986 getSettings, 38987 hasMultiSelection 38988 } = Object(external_wp_data_["useSelect"])(store); 38989 const { 38990 multiSelect, 38991 selectBlock 38992 } = Object(external_wp_data_["useDispatch"])(store); 38993 return Object(external_wp_compose_["useRefEffect"])(node => { 38994 // Here a DOMRect is stored while moving the caret vertically so 38995 // vertical position of the start position can be restored. This is to 38996 // recreate browser behaviour across blocks. 38997 let verticalRect; 38998 38999 function onMouseDown() { 39000 verticalRect = null; 39001 } 39002 39003 function expandSelection(isReverse) { 39004 const selectedBlockClientId = getSelectedBlockClientId(); 39005 const selectionStartClientId = getMultiSelectedBlocksStartClientId(); 39006 const selectionEndClientId = getMultiSelectedBlocksEndClientId(); 39007 const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); 39008 const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); 39009 const nextSelectionEndClientId = isReverse ? selectionBeforeEndClientId : selectionAfterEndClientId; 39010 39011 if (nextSelectionEndClientId) { 39012 if (selectionStartClientId === nextSelectionEndClientId) { 39013 selectBlock(nextSelectionEndClientId); 39014 } else { 39015 multiSelect(selectionStartClientId || selectedBlockClientId, nextSelectionEndClientId); 39016 } 39017 } 39018 } 39019 39020 function moveSelection(isReverse) { 39021 const selectedFirstClientId = getFirstMultiSelectedBlockClientId(); 39022 const selectedLastClientId = getLastMultiSelectedBlockClientId(); 39023 const focusedBlockClientId = isReverse ? selectedFirstClientId : selectedLastClientId; 39024 39025 if (focusedBlockClientId) { 39026 selectBlock(focusedBlockClientId); 39027 } 39028 } 39029 /** 39030 * Returns true if the given target field is the last in its block which 39031 * can be considered for tab transition. For example, in a block with 39032 * two text fields, this would return true when reversing from the first 39033 * of the two fields, but false when reversing from the second. 39034 * 39035 * @param {Element} target Currently focused text field. 39036 * @param {boolean} isReverse True if considering as the first field. 39037 * 39038 * @return {boolean} Whether field is at edge for tab transition. 39039 */ 39040 39041 39042 function isTabbableEdge(target, isReverse) { 39043 const closestTabbable = getClosestTabbable(target, isReverse, node); 39044 return !closestTabbable || !isInSameBlock(target, closestTabbable); 39045 } 39046 39047 function onKeyDown(event) { 39048 const { 39049 keyCode, 39050 target 39051 } = event; 39052 const isUp = keyCode === external_wp_keycodes_["UP"]; 39053 const isDown = keyCode === external_wp_keycodes_["DOWN"]; 39054 const isLeft = keyCode === external_wp_keycodes_["LEFT"]; 39055 const isRight = keyCode === external_wp_keycodes_["RIGHT"]; 39056 const isReverse = isUp || isLeft; 39057 const isHorizontal = isLeft || isRight; 39058 const isVertical = isUp || isDown; 39059 const isNav = isHorizontal || isVertical; 39060 const isShift = event.shiftKey; 39061 const hasModifier = isShift || event.ctrlKey || event.altKey || event.metaKey; 39062 const isNavEdge = isVertical ? external_wp_dom_["isVerticalEdge"] : external_wp_dom_["isHorizontalEdge"]; 39063 const { 39064 ownerDocument 39065 } = node; 39066 const { 39067 defaultView 39068 } = ownerDocument; 39069 39070 if (hasMultiSelection()) { 39071 if (isNav) { 39072 const action = isShift ? expandSelection : moveSelection; 39073 action(isReverse); 39074 event.preventDefault(); 39075 } 39076 39077 return; 39078 } // When presing any key other than up or down, the initial vertical 39079 // position must ALWAYS be reset. The vertical position is saved so 39080 // it can be restored as well as possible on sebsequent vertical 39081 // arrow key presses. It may not always be possible to restore the 39082 // exact same position (such as at an empty line), so it wouldn't be 39083 // good to compute the position right before any vertical arrow key 39084 // press. 39085 39086 39087 if (!isVertical) { 39088 verticalRect = null; 39089 } else if (!verticalRect) { 39090 verticalRect = Object(external_wp_dom_["computeCaretRect"])(defaultView); 39091 } // Abort if navigation has already been handled (e.g. RichText 39092 // inline boundaries). 39093 39094 39095 if (event.defaultPrevented) { 39096 return; 39097 } 39098 39099 if (!isNav) { 39100 return; 39101 } // Abort if our current target is not a candidate for navigation 39102 // (e.g. preserve native input behaviors). 39103 39104 39105 if (!isNavigationCandidate(target, keyCode, hasModifier)) { 39106 return; 39107 } // In the case of RTL scripts, right means previous and left means 39108 // next, which is the exact reverse of LTR. 39109 39110 39111 const isReverseDir = Object(external_wp_dom_["isRTL"])(target) ? !isReverse : isReverse; 39112 const { 39113 keepCaretInsideBlock 39114 } = getSettings(); 39115 const selectedBlockClientId = getSelectedBlockClientId(); 39116 39117 if (isShift) { 39118 const selectionEndClientId = getMultiSelectedBlocksEndClientId(); 39119 const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId); 39120 const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId); 39121 39122 if ( // Ensure that there is a target block. 39123 (isReverse && selectionBeforeEndClientId || !isReverse && selectionAfterEndClientId) && isTabbableEdge(target, isReverse) && isNavEdge(target, isReverse)) { 39124 // Shift key is down, and there is multi selection or we're 39125 // at the end of the current block. 39126 expandSelection(isReverse); 39127 event.preventDefault(); 39128 } 39129 } else if (isVertical && Object(external_wp_dom_["isVerticalEdge"])(target, isReverse) && !keepCaretInsideBlock) { 39130 const closestTabbable = getClosestTabbable(target, isReverse, node, true); 39131 39132 if (closestTabbable) { 39133 Object(external_wp_dom_["placeCaretAtVerticalEdge"])(closestTabbable, isReverse, verticalRect); 39134 event.preventDefault(); 39135 } 39136 } else if (isHorizontal && defaultView.getSelection().isCollapsed && Object(external_wp_dom_["isHorizontalEdge"])(target, isReverseDir) && !keepCaretInsideBlock) { 39137 const closestTabbable = getClosestTabbable(target, isReverseDir, node); 39138 Object(external_wp_dom_["placeCaretAtHorizontalEdge"])(closestTabbable, isReverse); 39139 event.preventDefault(); 39140 } 39141 } 39142 39143 node.addEventListener('mousedown', onMouseDown); 39144 node.addEventListener('keydown', onKeyDown); 39145 return () => { 39146 node.removeEventListener('mousedown', onMouseDown); 39147 node.removeEventListener('keydown', onKeyDown); 39148 }; 39149 }, []); 39150 } 39151 39152 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js 39153 /** 39154 * External dependencies 39155 */ 39156 39157 /** 39158 * WordPress dependencies 39159 */ 39160 39161 39162 39163 39164 39165 /** 39166 * Internal dependencies 39167 */ 39168 39169 39170 function useSelectAll() { 39171 const { 39172 getBlockOrder, 39173 getSelectedBlockClientIds, 39174 getBlockRootClientId 39175 } = Object(external_wp_data_["useSelect"])(store); 39176 const { 39177 multiSelect 39178 } = Object(external_wp_data_["useDispatch"])(store); 39179 const isMatch = Object(external_wp_keyboardShortcuts_["__unstableUseShortcutEventMatch"])(); 39180 return Object(external_wp_compose_["useRefEffect"])(node => { 39181 function onKeyDown(event) { 39182 if (!isMatch('core/block-editor/select-all', event)) { 39183 return; 39184 } 39185 39186 if (!Object(external_wp_dom_["isEntirelySelected"])(event.target)) { 39187 return; 39188 } 39189 39190 const selectedClientIds = getSelectedBlockClientIds(); 39191 const [firstSelectedClientId] = selectedClientIds; 39192 const rootClientId = getBlockRootClientId(firstSelectedClientId); 39193 let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a 39194 // level. See: https://github.com/WordPress/gutenberg/pull/31859/ 39195 39196 if (selectedClientIds.length === blockClientIds.length) { 39197 blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId)); 39198 } 39199 39200 const firstClientId = Object(external_lodash_["first"])(blockClientIds); 39201 const lastClientId = Object(external_lodash_["last"])(blockClientIds); 39202 39203 if (firstClientId === lastClientId) { 39204 return; 39205 } 39206 39207 multiSelect(firstClientId, lastClientId); 39208 event.preventDefault(); 39209 } 39210 39211 node.addEventListener('keydown', onKeyDown); 39212 return () => { 39213 node.removeEventListener('keydown', onKeyDown); 39214 }; 39215 }); 39216 } 39217 39218 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/index.js 39219 39220 39221 39222 /** 39223 * External dependencies 39224 */ 39225 39226 /** 39227 * WordPress dependencies 39228 */ 39229 39230 39231 39232 39233 39234 /** 39235 * Internal dependencies 39236 */ 39237 39238 39239 39240 39241 39242 39243 39244 function WritingFlow({ 39245 children, 39246 ...props 39247 }, forwardedRef) { 39248 const [before, ref, after] = useTabNav(); 39249 const hasMultiSelection = Object(external_wp_data_["useSelect"])(select => select(store).hasMultiSelection(), []); 39250 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, before, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, props, { 39251 ref: Object(external_wp_compose_["useMergeRefs"])([forwardedRef, ref, use_multi_selection_useMultiSelection(), useSelectAll(), useArrowNav()]), 39252 className: classnames_default()(props.className, 'block-editor-writing-flow'), 39253 tabIndex: -1, 39254 "aria-label": hasMultiSelection ? Object(external_wp_i18n_["__"])('Multiple selected blocks') : undefined 39255 }), children), after); 39256 } 39257 /** 39258 * Handles selection and navigation across blocks. This component should be 39259 * wrapped around BlockList. 39260 * 39261 * @param {Object} props Component properties. 39262 * @param {WPElement} props.children Children to be rendered. 39263 */ 39264 39265 39266 /* harmony default export */ var writing_flow = (Object(external_wp_element_["forwardRef"])(WritingFlow)); 39267 39268 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-canvas-click-redirect/index.js 39269 /** 39270 * External dependencies 39271 */ 39272 39273 /** 39274 * WordPress dependencies 39275 */ 39276 39277 39278 39279 /** 39280 * Given an element, returns true if the element is a tabbable text field, or 39281 * false otherwise. 39282 * 39283 * @param {Element} element Element to test. 39284 * 39285 * @return {boolean} Whether element is a tabbable text field. 39286 */ 39287 39288 const isTabbableTextField = Object(external_lodash_["overEvery"])([external_wp_dom_["isTextField"], external_wp_dom_["focus"].tabbable.isTabbableIndex]); 39289 function useCanvasClickRedirect() { 39290 return Object(external_wp_compose_["useRefEffect"])(node => { 39291 function onMouseDown(event) { 39292 // Only handle clicks on the canvas, not the content. 39293 if (event.target !== node) { 39294 return; 39295 } 39296 39297 const focusableNodes = external_wp_dom_["focus"].focusable.find(node); 39298 const target = Object(external_lodash_["findLast"])(focusableNodes, isTabbableTextField); 39299 39300 if (!target) { 39301 return; 39302 } 39303 39304 const { 39305 bottom 39306 } = target.getBoundingClientRect(); // Ensure the click is below the last block. 39307 39308 if (event.clientY < bottom) { 39309 return; 39310 } 39311 39312 Object(external_wp_dom_["placeCaretAtHorizontalEdge"])(target, true); 39313 event.preventDefault(); 39314 } 39315 39316 node.addEventListener('mousedown', onMouseDown); 39317 return () => { 39318 node.addEventListener('mousedown', onMouseDown); 39319 }; 39320 }, []); 39321 } 39322 39323 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js 39324 39325 39326 39327 /** 39328 * WordPress dependencies 39329 */ 39330 39331 39332 39333 39334 /** 39335 * Internal dependencies 39336 */ 39337 39338 39339 const BODY_CLASS_NAME = 'editor-styles-wrapper'; 39340 const BLOCK_PREFIX = 'wp-block'; 39341 /** 39342 * Clones stylesheets targetting the editor canvas to the given document. A 39343 * stylesheet is considered targetting the editor a canvas if it contains the 39344 * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors. 39345 * 39346 * Ideally, this hook should be removed in the future and styles should be added 39347 * explicitly as editor styles. 39348 * 39349 * @param {Document} doc The document to append cloned stylesheets to. 39350 */ 39351 39352 function styleSheetsCompat(doc) { 39353 // Search the document for stylesheets targetting the editor canvas. 39354 Array.from(document.styleSheets).forEach(styleSheet => { 39355 try { 39356 // May fail for external styles. 39357 // eslint-disable-next-line no-unused-expressions 39358 styleSheet.cssRules; 39359 } catch (e) { 39360 return; 39361 } 39362 39363 const { 39364 ownerNode, 39365 cssRules 39366 } = styleSheet; 39367 39368 if (!cssRules) { 39369 return; 39370 } // Generally, ignore inline styles. We add inline styles belonging to a 39371 // stylesheet later, which may or may not match the selectors. 39372 39373 39374 if (ownerNode.tagName !== 'LINK') { 39375 return; 39376 } // Don't try to add the reset styles, which were removed as a dependency 39377 // from `edit-blocks` for the iframe since we don't need to reset admin 39378 // styles. 39379 39380 39381 if (ownerNode.id === 'wp-reset-editor-styles-css') { 39382 return; 39383 } 39384 39385 const isMatch = Array.from(cssRules).find(({ 39386 selectorText 39387 }) => selectorText && (selectorText.includes(`.${BODY_CLASS_NAME}`) || selectorText.includes(`.${BLOCK_PREFIX}`))); 39388 39389 if (isMatch && !doc.getElementById(ownerNode.id)) { 39390 // eslint-disable-next-line no-console 39391 console.error(`Stylesheet ${ownerNode.id} was not properly added. 39392 For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style). 39393 For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`, ownerNode.outerHTML); 39394 doc.head.appendChild(ownerNode.cloneNode(true)); // Add inline styles belonging to the stylesheet. 39395 39396 const inlineCssId = ownerNode.id.replace('-css', '-inline-css'); 39397 const inlineCssElement = document.getElementById(inlineCssId); 39398 39399 if (inlineCssElement) { 39400 doc.head.appendChild(inlineCssElement.cloneNode(true)); 39401 } 39402 } 39403 }); 39404 } 39405 /** 39406 * Bubbles some event types (keydown, keypress, and dragover) to parent document 39407 * document to ensure that the keyboard shortcuts and drag and drop work. 39408 * 39409 * Ideally, we should remove event bubbling in the future. Keyboard shortcuts 39410 * should be context dependent, e.g. actions on blocks like Cmd+A should not 39411 * work globally outside the block editor. 39412 * 39413 * @param {Document} doc Document to attach listeners to. 39414 */ 39415 39416 39417 function bubbleEvents(doc) { 39418 const { 39419 defaultView 39420 } = doc; 39421 const { 39422 frameElement 39423 } = defaultView; 39424 39425 function bubbleEvent(event) { 39426 const prototype = Object.getPrototypeOf(event); 39427 const constructorName = prototype.constructor.name; 39428 const Constructor = window[constructorName]; 39429 const init = {}; 39430 39431 for (const key in event) { 39432 init[key] = event[key]; 39433 } 39434 39435 if (event instanceof defaultView.MouseEvent) { 39436 const rect = frameElement.getBoundingClientRect(); 39437 init.clientX += rect.left; 39438 init.clientY += rect.top; 39439 } 39440 39441 const newEvent = new Constructor(event.type, init); 39442 const cancelled = !frameElement.dispatchEvent(newEvent); 39443 39444 if (cancelled) { 39445 event.preventDefault(); 39446 } 39447 } 39448 39449 const eventTypes = ['keydown', 'keypress', 'dragover']; 39450 39451 for (const name of eventTypes) { 39452 doc.addEventListener(name, bubbleEvent); 39453 } 39454 } 39455 /** 39456 * Sets the document direction. 39457 * 39458 * Sets the `editor-styles-wrapper` class name on the body. 39459 * 39460 * Copies the `admin-color-*` class name to the body so that the admin color 39461 * scheme applies to components in the iframe. 39462 * 39463 * @param {Document} doc Document to add class name to. 39464 */ 39465 39466 39467 function setBodyClassName(doc) { 39468 doc.dir = document.dir; 39469 doc.body.className = BODY_CLASS_NAME; 39470 39471 for (const name of document.body.classList) { 39472 if (name.startsWith('admin-color-')) { 39473 doc.body.classList.add(name); 39474 } else if (name === 'wp-embed-responsive') { 39475 // Ideally ALL classes that are added through get_body_class should 39476 // be added in the editor too, which we'll somehow have to get from 39477 // the server in the future (which will run the PHP filters). 39478 doc.body.classList.add('wp-embed-responsive'); 39479 } 39480 } 39481 } 39482 39483 function useParsedAssets(html) { 39484 return Object(external_wp_element_["useMemo"])(() => { 39485 const doc = document.implementation.createHTMLDocument(''); 39486 doc.body.innerHTML = html; 39487 return Array.from(doc.body.children); 39488 }, [html]); 39489 } 39490 39491 async function loadScript(doc, { 39492 id, 39493 src 39494 }) { 39495 return new Promise((resolve, reject) => { 39496 const script = doc.createElement('script'); 39497 script.id = id; 39498 39499 if (src) { 39500 script.src = src; 39501 39502 script.onload = () => resolve(); 39503 39504 script.onerror = () => reject(); 39505 } else { 39506 resolve(); 39507 } 39508 39509 doc.head.appendChild(script); 39510 }); 39511 } 39512 39513 function Iframe({ 39514 contentRef, 39515 children, 39516 head, 39517 ...props 39518 }, ref) { 39519 const [, forceRender] = Object(external_wp_element_["useReducer"])(() => ({})); 39520 const [iframeDocument, setIframeDocument] = Object(external_wp_element_["useState"])(); 39521 const styles = useParsedAssets(window.__editorAssets.styles); 39522 const scripts = useParsedAssets(window.__editorAssets.scripts); 39523 const clearerRef = useBlockSelectionClearer(); 39524 const setRef = Object(external_wp_element_["useCallback"])(node => { 39525 if (!node) { 39526 return; 39527 } 39528 39529 function setDocumentIfReady() { 39530 const { 39531 contentDocument 39532 } = node; 39533 const { 39534 readyState, 39535 body, 39536 documentElement 39537 } = contentDocument; 39538 39539 if (readyState !== 'interactive' && readyState !== 'complete') { 39540 return false; 39541 } 39542 39543 if (typeof contentRef === 'function') { 39544 contentRef(body); 39545 } else if (contentRef) { 39546 contentRef.current = body; 39547 } 39548 39549 setBodyClassName(contentDocument); 39550 bubbleEvents(contentDocument); 39551 setBodyClassName(contentDocument); 39552 setIframeDocument(contentDocument); 39553 clearerRef(documentElement); 39554 clearerRef(body); 39555 scripts.reduce((promise, script) => promise.then(() => loadScript(contentDocument, script)), Promise.resolve()).finally(() => { 39556 // When script are loaded, re-render blocks to allow them 39557 // to initialise. 39558 forceRender(); 39559 }); 39560 return true; 39561 } 39562 39563 if (setDocumentIfReady()) { 39564 return; 39565 } // Document is not immediately loaded in Firefox. 39566 39567 39568 node.addEventListener('load', () => { 39569 setDocumentIfReady(); 39570 }); 39571 }, []); 39572 Object(external_wp_element_["useEffect"])(() => { 39573 if (iframeDocument) { 39574 styleSheetsCompat(iframeDocument); 39575 } 39576 }, [iframeDocument]); 39577 head = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("style", null, 'body{margin:0}'), styles.map(({ 39578 tagName, 39579 href, 39580 id, 39581 rel, 39582 media, 39583 textContent 39584 }) => { 39585 const TagName = tagName.toLowerCase(); 39586 39587 if (TagName === 'style') { 39588 return Object(external_wp_element_["createElement"])(TagName, { 39589 id, 39590 key: id 39591 }, textContent); 39592 } 39593 39594 return Object(external_wp_element_["createElement"])(TagName, { 39595 href, 39596 id, 39597 rel, 39598 media, 39599 key: id 39600 }); 39601 }), head); 39602 return Object(external_wp_element_["createElement"])("iframe", Object(esm_extends["a" /* default */])({}, props, { 39603 ref: Object(external_wp_compose_["useMergeRefs"])([ref, setRef]), 39604 tabIndex: "0", 39605 title: Object(external_wp_i18n_["__"])('Editor canvas'), 39606 name: "editor-canvas" 39607 }), iframeDocument && Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalStyleProvider"], { 39608 document: iframeDocument 39609 }, children), iframeDocument.body), iframeDocument && Object(external_wp_element_["createPortal"])(head, iframeDocument.head)); 39610 } 39611 39612 /* harmony default export */ var iframe = (Object(external_wp_element_["forwardRef"])(Iframe)); 39613 39614 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-no-recursive-renders/index.js 39615 39616 39617 /** 39618 * WordPress dependencies 39619 */ 39620 39621 /** 39622 * Internal dependencies 39623 */ 39624 39625 39626 const RenderedRefsContext = Object(external_wp_element_["createContext"])({}); 39627 /** 39628 * Immutably adds an unique identifier to a set scoped for a given block type. 39629 * 39630 * @param {Object} renderedBlocks Rendered blocks grouped by block name 39631 * @param {string} blockName Name of the block. 39632 * @param {*} uniqueId Any value that acts as a unique identifier for a block instance. 39633 * 39634 * @return {Object} The list of rendered blocks grouped by block name. 39635 */ 39636 39637 function addToBlockType(renderedBlocks, blockName, uniqueId) { 39638 const result = { ...renderedBlocks, 39639 [blockName]: renderedBlocks[blockName] ? new Set(renderedBlocks[blockName]) : new Set() 39640 }; 39641 result[blockName].add(uniqueId); 39642 return result; 39643 } 39644 /** 39645 * A React hook for keeping track of blocks previously rendered up in the block 39646 * tree. Blocks susceptible to recursion can use this hook in their `Edit` 39647 * function to prevent said recursion. 39648 * 39649 * @param {*} uniqueId Any value that acts as a unique identifier for a block instance. 39650 * @param {string} blockName Optional block name. 39651 * 39652 * @return {[boolean, Function]} A tuple of: 39653 * - a boolean describing whether the provided id 39654 * has already been rendered; 39655 * - a React context provider to be used to wrap 39656 * other elements. 39657 */ 39658 39659 39660 function useNoRecursiveRenders(uniqueId, blockName = '') { 39661 var _previouslyRenderedBl; 39662 39663 const previouslyRenderedBlocks = Object(external_wp_element_["useContext"])(RenderedRefsContext); 39664 const { 39665 name 39666 } = useBlockEditContext(); 39667 blockName = blockName || name; 39668 const hasAlreadyRendered = Boolean((_previouslyRenderedBl = previouslyRenderedBlocks[blockName]) === null || _previouslyRenderedBl === void 0 ? void 0 : _previouslyRenderedBl.has(uniqueId)); 39669 const newRenderedBlocks = Object(external_wp_element_["useMemo"])(() => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId]); 39670 const Provider = Object(external_wp_element_["useCallback"])(({ 39671 children 39672 }) => Object(external_wp_element_["createElement"])(RenderedRefsContext.Provider, { 39673 value: newRenderedBlocks 39674 }, children), [newRenderedBlocks]); 39675 return [hasAlreadyRendered, Provider]; 39676 } 39677 39678 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/index.js 39679 /* 39680 * Block Creation Components 39681 */ 39682 39683 39684 39685 39686 39687 39688 39689 39690 39691 39692 39693 39694 39695 39696 39697 39698 39699 39700 39701 39702 39703 39704 39705 39706 39707 39708 39709 39710 39711 39712 39713 39714 39715 39716 39717 39718 39719 39720 39721 39722 39723 39724 39725 39726 39727 39728 39729 39730 39731 39732 39733 39734 39735 39736 39737 39738 39739 39740 39741 39742 /* 39743 * Content Related Components 39744 */ 39745 39746 39747 39748 39749 39750 39751 39752 39753 39754 39755 39756 39757 39758 39759 39760 39761 39762 39763 39764 39765 39766 39767 39768 39769 39770 39771 39772 39773 39774 39775 39776 39777 39778 39779 39780 39781 /* 39782 * State Related Components 39783 */ 39784 39785 39786 39787 39788 39789 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/theme.js 39790 /** 39791 * Internal dependencies 39792 */ 39793 39794 /** 39795 * Given an array of theme colors checks colors for validity 39796 * 39797 * @param {Array} colors The array of theme colors 39798 * 39799 * @return {Array} The array of valid theme colors or the default colors 39800 */ 39801 39802 function validateThemeColors(colors) { 39803 if (colors === undefined) { 39804 colors = SETTINGS_DEFAULTS.colors; 39805 } else { 39806 const validColors = colors.filter(c => c.color); 39807 39808 if (validColors.length === 0) { 39809 colors = SETTINGS_DEFAULTS.colors; 39810 } else if (validColors.length < colors.length) { 39811 // Filter out invalid colors 39812 colors = validColors; 39813 } 39814 } 39815 39816 return colors; 39817 } 39818 /** 39819 * Given an array of theme gradients checks gradients for validity 39820 * 39821 * @param {Array} gradients The array of theme gradients 39822 * 39823 * @return {Array} The array of valid theme gradients or the default gradients 39824 */ 39825 39826 function validateThemeGradients(gradients) { 39827 if (gradients === undefined) { 39828 gradients = SETTINGS_DEFAULTS.gradients; 39829 } else { 39830 const validGradients = gradients.filter(c => c.gradient); 39831 39832 if (validGradients.length === 0) { 39833 gradients = SETTINGS_DEFAULTS.gradients; 39834 } else if (validGradients.length < gradients.length) { 39835 // Filter out invalid gradients 39836 gradients = validGradients; 39837 } 39838 } 39839 39840 return gradients; 39841 } 39842 39843 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/index.js 39844 39845 39846 39847 39848 // CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js 39849 /** 39850 * WordPress dependencies 39851 */ 39852 39853 /** 39854 * Internal dependencies 39855 */ 39856 39857 39858 39859 39860 39861 39862 39863 39864 39865 /***/ }), 39866 39867 /***/ "w95h": 39868 /***/ (function(module, __webpack_exports__, __webpack_require__) { 39869 39870 "use strict"; 39871 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 39872 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 39873 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 39874 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 39875 39876 39877 /** 39878 * WordPress dependencies 39879 */ 39880 39881 const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 39882 xmlns: "http://www.w3.org/2000/svg", 39883 viewBox: "0 0 24 24" 39884 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 39885 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" 39886 })); 39887 /* harmony default export */ __webpack_exports__["a"] = (close); 39888 39889 39890 /***/ }), 39891 39892 /***/ "wx14": 39893 /***/ (function(module, __webpack_exports__, __webpack_require__) { 39894 39895 "use strict"; 39896 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); 39897 function _extends() { 39898 _extends = Object.assign || function (target) { 39899 for (var i = 1; i < arguments.length; i++) { 39900 var source = arguments[i]; 39901 39902 for (var key in source) { 39903 if (Object.prototype.hasOwnProperty.call(source, key)) { 39904 target[key] = source[key]; 39905 } 39906 } 39907 } 39908 39909 return target; 39910 }; 39911 39912 return _extends.apply(this, arguments); 39913 } 39914 39915 /***/ }), 39916 39917 /***/ "xTGt": 39918 /***/ (function(module, exports) { 39919 39920 (function() { module.exports = window["wp"]["blob"]; }()); 39921 39922 /***/ }), 39923 39924 /***/ "ziDm": 39925 /***/ (function(module, __webpack_exports__, __webpack_require__) { 39926 39927 "use strict"; 39928 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); 39929 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 39930 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); 39931 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); 39932 39933 39934 /** 39935 * WordPress dependencies 39936 */ 39937 39938 const alignRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { 39939 xmlns: "http://www.w3.org/2000/svg", 39940 viewBox: "0 0 24 24" 39941 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { 39942 d: "M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z" 39943 })); 39944 /* harmony default export */ __webpack_exports__["a"] = (alignRight); 39945 39946 39947 /***/ }), 39948 39949 /***/ "zt9T": 39950 /***/ (function(module, exports, __webpack_require__) { 39951 39952 "use strict"; 39953 39954 39955 var util = __webpack_require__("jB5C"); 39956 39957 function scrollIntoView(elem, container, config) { 39958 config = config || {}; 39959 // document 归一化到 window 39960 if (container.nodeType === 9) { 39961 container = util.getWindow(container); 39962 } 39963 39964 var allowHorizontalScroll = config.allowHorizontalScroll; 39965 var onlyScrollIfNeeded = config.onlyScrollIfNeeded; 39966 var alignWithTop = config.alignWithTop; 39967 var alignWithLeft = config.alignWithLeft; 39968 var offsetTop = config.offsetTop || 0; 39969 var offsetLeft = config.offsetLeft || 0; 39970 var offsetBottom = config.offsetBottom || 0; 39971 var offsetRight = config.offsetRight || 0; 39972 39973 allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll; 39974 39975 var isWin = util.isWindow(container); 39976 var elemOffset = util.offset(elem); 39977 var eh = util.outerHeight(elem); 39978 var ew = util.outerWidth(elem); 39979 var containerOffset = undefined; 39980 var ch = undefined; 39981 var cw = undefined; 39982 var containerScroll = undefined; 39983 var diffTop = undefined; 39984 var diffBottom = undefined; 39985 var win = undefined; 39986 var winScroll = undefined; 39987 var ww = undefined; 39988 var wh = undefined; 39989 39990 if (isWin) { 39991 win = container; 39992 wh = util.height(win); 39993 ww = util.width(win); 39994 winScroll = { 39995 left: util.scrollLeft(win), 39996 top: util.scrollTop(win) 39997 }; 39998 // elem 相对 container 可视视窗的距离 39999 diffTop = { 40000 left: elemOffset.left - winScroll.left - offsetLeft, 40001 top: elemOffset.top - winScroll.top - offsetTop 40002 }; 40003 diffBottom = { 40004 left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight, 40005 top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom 40006 }; 40007 containerScroll = winScroll; 40008 } else { 40009 containerOffset = util.offset(container); 40010 ch = container.clientHeight; 40011 cw = container.clientWidth; 40012 containerScroll = { 40013 left: container.scrollLeft, 40014 top: container.scrollTop 40015 }; 40016 // elem 相对 container 可视视窗的距离 40017 // 注意边框, offset 是边框到根节点 40018 diffTop = { 40019 left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft, 40020 top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop 40021 }; 40022 diffBottom = { 40023 left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight, 40024 top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom 40025 }; 40026 } 40027 40028 if (diffTop.top < 0 || diffBottom.top > 0) { 40029 // 强制向上 40030 if (alignWithTop === true) { 40031 util.scrollTop(container, containerScroll.top + diffTop.top); 40032 } else if (alignWithTop === false) { 40033 util.scrollTop(container, containerScroll.top + diffBottom.top); 40034 } else { 40035 // 自动调整 40036 if (diffTop.top < 0) { 40037 util.scrollTop(container, containerScroll.top + diffTop.top); 40038 } else { 40039 util.scrollTop(container, containerScroll.top + diffBottom.top); 40040 } 40041 } 40042 } else { 40043 if (!onlyScrollIfNeeded) { 40044 alignWithTop = alignWithTop === undefined ? true : !!alignWithTop; 40045 if (alignWithTop) { 40046 util.scrollTop(container, containerScroll.top + diffTop.top); 40047 } else { 40048 util.scrollTop(container, containerScroll.top + diffBottom.top); 40049 } 40050 } 40051 } 40052 40053 if (allowHorizontalScroll) { 40054 if (diffTop.left < 0 || diffBottom.left > 0) { 40055 // 强制向上 40056 if (alignWithLeft === true) { 40057 util.scrollLeft(container, containerScroll.left + diffTop.left); 40058 } else if (alignWithLeft === false) { 40059 util.scrollLeft(container, containerScroll.left + diffBottom.left); 40060 } else { 40061 // 自动调整 40062 if (diffTop.left < 0) { 40063 util.scrollLeft(container, containerScroll.left + diffTop.left); 40064 } else { 40065 util.scrollLeft(container, containerScroll.left + diffBottom.left); 40066 } 40067 } 40068 } else { 40069 if (!onlyScrollIfNeeded) { 40070 alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft; 40071 if (alignWithLeft) { 40072 util.scrollLeft(container, containerScroll.left + diffTop.left); 40073 } else { 40074 util.scrollLeft(container, containerScroll.left + diffBottom.left); 40075 } 40076 } 40077 } 40078 } 40079 } 40080 40081 module.exports = scrollIntoView; 40082 40083 /***/ }) 40084 40085 /******/ });