[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> rich-text.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["richText"] =
   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 = 451);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = window["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 105:
  98  /***/ (function(module, exports) {
  99  
 100  (function() { module.exports = window["wp"]["escapeHtml"]; }());
 101  
 102  /***/ }),
 103  
 104  /***/ 11:
 105  /***/ (function(module, exports) {
 106  
 107  (function() { module.exports = window["wp"]["compose"]; }());
 108  
 109  /***/ }),
 110  
 111  /***/ 12:
 112  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 113  
 114  "use strict";
 115  
 116  // EXPORTS
 117  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
 118  
 119  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 120  var arrayWithHoles = __webpack_require__(37);
 121  
 122  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 123  function _iterableToArrayLimit(arr, i) {
 124    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 125    var _arr = [];
 126    var _n = true;
 127    var _d = false;
 128    var _e = undefined;
 129  
 130    try {
 131      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 132        _arr.push(_s.value);
 133  
 134        if (i && _arr.length === i) break;
 135      }
 136    } catch (err) {
 137      _d = true;
 138      _e = err;
 139    } finally {
 140      try {
 141        if (!_n && _i["return"] != null) _i["return"]();
 142      } finally {
 143        if (_d) throw _e;
 144      }
 145    }
 146  
 147    return _arr;
 148  }
 149  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 150  var unsupportedIterableToArray = __webpack_require__(28);
 151  
 152  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 153  var nonIterableRest = __webpack_require__(38);
 154  
 155  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 156  
 157  
 158  
 159  
 160  function _slicedToArray(arr, i) {
 161    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 162  }
 163  
 164  /***/ }),
 165  
 166  /***/ 15:
 167  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 168  
 169  "use strict";
 170  
 171  // EXPORTS
 172  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 173  
 174  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 175  var arrayLikeToArray = __webpack_require__(24);
 176  
 177  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 178  
 179  function _arrayWithoutHoles(arr) {
 180    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 181  }
 182  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 183  var iterableToArray = __webpack_require__(39);
 184  
 185  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 186  var unsupportedIterableToArray = __webpack_require__(28);
 187  
 188  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 189  function _nonIterableSpread() {
 190    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 191  }
 192  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 193  
 194  
 195  
 196  
 197  function _toConsumableArray(arr) {
 198    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 199  }
 200  
 201  /***/ }),
 202  
 203  /***/ 17:
 204  /***/ (function(module, exports) {
 205  
 206  (function() { module.exports = window["wp"]["keycodes"]; }());
 207  
 208  /***/ }),
 209  
 210  /***/ 2:
 211  /***/ (function(module, exports) {
 212  
 213  (function() { module.exports = window["lodash"]; }());
 214  
 215  /***/ }),
 216  
 217  /***/ 24:
 218  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 219  
 220  "use strict";
 221  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 222  function _arrayLikeToArray(arr, len) {
 223    if (len == null || len > arr.length) len = arr.length;
 224  
 225    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 226      arr2[i] = arr[i];
 227    }
 228  
 229    return arr2;
 230  }
 231  
 232  /***/ }),
 233  
 234  /***/ 27:
 235  /***/ (function(module, exports) {
 236  
 237  (function() { module.exports = window["wp"]["dom"]; }());
 238  
 239  /***/ }),
 240  
 241  /***/ 28:
 242  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 243  
 244  "use strict";
 245  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 246  /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
 247  
 248  function _unsupportedIterableToArray(o, minLen) {
 249    if (!o) return;
 250    if (typeof o === "string") return Object(_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 251    var n = Object.prototype.toString.call(o).slice(8, -1);
 252    if (n === "Object" && o.constructor) n = o.constructor.name;
 253    if (n === "Map" || n === "Set") return Array.from(o);
 254    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 255  }
 256  
 257  /***/ }),
 258  
 259  /***/ 37:
 260  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 261  
 262  "use strict";
 263  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 264  function _arrayWithHoles(arr) {
 265    if (Array.isArray(arr)) return arr;
 266  }
 267  
 268  /***/ }),
 269  
 270  /***/ 38:
 271  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 272  
 273  "use strict";
 274  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 275  function _nonIterableRest() {
 276    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 277  }
 278  
 279  /***/ }),
 280  
 281  /***/ 39:
 282  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 283  
 284  "use strict";
 285  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 286  function _iterableToArray(iter) {
 287    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 288  }
 289  
 290  /***/ }),
 291  
 292  /***/ 4:
 293  /***/ (function(module, exports) {
 294  
 295  (function() { module.exports = window["wp"]["data"]; }());
 296  
 297  /***/ }),
 298  
 299  /***/ 40:
 300  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 301  
 302  "use strict";
 303  
 304  
 305  var LEAF_KEY, hasWeakMap;
 306  
 307  /**
 308   * Arbitrary value used as key for referencing cache object in WeakMap tree.
 309   *
 310   * @type {Object}
 311   */
 312  LEAF_KEY = {};
 313  
 314  /**
 315   * Whether environment supports WeakMap.
 316   *
 317   * @type {boolean}
 318   */
 319  hasWeakMap = typeof WeakMap !== 'undefined';
 320  
 321  /**
 322   * Returns the first argument as the sole entry in an array.
 323   *
 324   * @param {*} value Value to return.
 325   *
 326   * @return {Array} Value returned as entry in array.
 327   */
 328  function arrayOf( value ) {
 329      return [ value ];
 330  }
 331  
 332  /**
 333   * Returns true if the value passed is object-like, or false otherwise. A value
 334   * is object-like if it can support property assignment, e.g. object or array.
 335   *
 336   * @param {*} value Value to test.
 337   *
 338   * @return {boolean} Whether value is object-like.
 339   */
 340  function isObjectLike( value ) {
 341      return !! value && 'object' === typeof value;
 342  }
 343  
 344  /**
 345   * Creates and returns a new cache object.
 346   *
 347   * @return {Object} Cache object.
 348   */
 349  function createCache() {
 350      var cache = {
 351          clear: function() {
 352              cache.head = null;
 353          },
 354      };
 355  
 356      return cache;
 357  }
 358  
 359  /**
 360   * Returns true if entries within the two arrays are strictly equal by
 361   * reference from a starting index.
 362   *
 363   * @param {Array}  a         First array.
 364   * @param {Array}  b         Second array.
 365   * @param {number} fromIndex Index from which to start comparison.
 366   *
 367   * @return {boolean} Whether arrays are shallowly equal.
 368   */
 369  function isShallowEqual( a, b, fromIndex ) {
 370      var i;
 371  
 372      if ( a.length !== b.length ) {
 373          return false;
 374      }
 375  
 376      for ( i = fromIndex; i < a.length; i++ ) {
 377          if ( a[ i ] !== b[ i ] ) {
 378              return false;
 379          }
 380      }
 381  
 382      return true;
 383  }
 384  
 385  /**
 386   * Returns a memoized selector function. The getDependants function argument is
 387   * called before the memoized selector and is expected to return an immutable
 388   * reference or array of references on which the selector depends for computing
 389   * its own return value. The memoize cache is preserved only as long as those
 390   * dependant references remain the same. If getDependants returns a different
 391   * reference(s), the cache is cleared and the selector value regenerated.
 392   *
 393   * @param {Function} selector      Selector function.
 394   * @param {Function} getDependants Dependant getter returning an immutable
 395   *                                 reference or array of reference used in
 396   *                                 cache bust consideration.
 397   *
 398   * @return {Function} Memoized selector.
 399   */
 400  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
 401      var rootCache, getCache;
 402  
 403      // Use object source as dependant if getter not provided
 404      if ( ! getDependants ) {
 405          getDependants = arrayOf;
 406      }
 407  
 408      /**
 409       * Returns the root cache. If WeakMap is supported, this is assigned to the
 410       * root WeakMap cache set, otherwise it is a shared instance of the default
 411       * cache object.
 412       *
 413       * @return {(WeakMap|Object)} Root cache object.
 414       */
 415  	function getRootCache() {
 416          return rootCache;
 417      }
 418  
 419      /**
 420       * Returns the cache for a given dependants array. When possible, a WeakMap
 421       * will be used to create a unique cache for each set of dependants. This
 422       * is feasible due to the nature of WeakMap in allowing garbage collection
 423       * to occur on entries where the key object is no longer referenced. Since
 424       * WeakMap requires the key to be an object, this is only possible when the
 425       * dependant is object-like. The root cache is created as a hierarchy where
 426       * each top-level key is the first entry in a dependants set, the value a
 427       * WeakMap where each key is the next dependant, and so on. This continues
 428       * so long as the dependants are object-like. If no dependants are object-
 429       * like, then the cache is shared across all invocations.
 430       *
 431       * @see isObjectLike
 432       *
 433       * @param {Array} dependants Selector dependants.
 434       *
 435       * @return {Object} Cache object.
 436       */
 437  	function getWeakMapCache( dependants ) {
 438          var caches = rootCache,
 439              isUniqueByDependants = true,
 440              i, dependant, map, cache;
 441  
 442          for ( i = 0; i < dependants.length; i++ ) {
 443              dependant = dependants[ i ];
 444  
 445              // Can only compose WeakMap from object-like key.
 446              if ( ! isObjectLike( dependant ) ) {
 447                  isUniqueByDependants = false;
 448                  break;
 449              }
 450  
 451              // Does current segment of cache already have a WeakMap?
 452              if ( caches.has( dependant ) ) {
 453                  // Traverse into nested WeakMap.
 454                  caches = caches.get( dependant );
 455              } else {
 456                  // Create, set, and traverse into a new one.
 457                  map = new WeakMap();
 458                  caches.set( dependant, map );
 459                  caches = map;
 460              }
 461          }
 462  
 463          // We use an arbitrary (but consistent) object as key for the last item
 464          // in the WeakMap to serve as our running cache.
 465          if ( ! caches.has( LEAF_KEY ) ) {
 466              cache = createCache();
 467              cache.isUniqueByDependants = isUniqueByDependants;
 468              caches.set( LEAF_KEY, cache );
 469          }
 470  
 471          return caches.get( LEAF_KEY );
 472      }
 473  
 474      // Assign cache handler by availability of WeakMap
 475      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
 476  
 477      /**
 478       * Resets root memoization cache.
 479       */
 480  	function clear() {
 481          rootCache = hasWeakMap ? new WeakMap() : createCache();
 482      }
 483  
 484      // eslint-disable-next-line jsdoc/check-param-names
 485      /**
 486       * The augmented selector call, considering first whether dependants have
 487       * changed before passing it to underlying memoize function.
 488       *
 489       * @param {Object} source    Source object for derivation.
 490       * @param {...*}   extraArgs Additional arguments to pass to selector.
 491       *
 492       * @return {*} Selector result.
 493       */
 494  	function callSelector( /* source, ...extraArgs */ ) {
 495          var len = arguments.length,
 496              cache, node, i, args, dependants;
 497  
 498          // Create copy of arguments (avoid leaking deoptimization).
 499          args = new Array( len );
 500          for ( i = 0; i < len; i++ ) {
 501              args[ i ] = arguments[ i ];
 502          }
 503  
 504          dependants = getDependants.apply( null, args );
 505          cache = getCache( dependants );
 506  
 507          // If not guaranteed uniqueness by dependants (primitive type or lack
 508          // of WeakMap support), shallow compare against last dependants and, if
 509          // references have changed, destroy cache to recalculate result.
 510          if ( ! cache.isUniqueByDependants ) {
 511              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
 512                  cache.clear();
 513              }
 514  
 515              cache.lastDependants = dependants;
 516          }
 517  
 518          node = cache.head;
 519          while ( node ) {
 520              // Check whether node arguments match arguments
 521              if ( ! isShallowEqual( node.args, args, 1 ) ) {
 522                  node = node.next;
 523                  continue;
 524              }
 525  
 526              // At this point we can assume we've found a match
 527  
 528              // Surface matched node to head if not already
 529              if ( node !== cache.head ) {
 530                  // Adjust siblings to point to each other.
 531                  node.prev.next = node.next;
 532                  if ( node.next ) {
 533                      node.next.prev = node.prev;
 534                  }
 535  
 536                  node.next = cache.head;
 537                  node.prev = null;
 538                  cache.head.prev = node;
 539                  cache.head = node;
 540              }
 541  
 542              // Return immediately
 543              return node.val;
 544          }
 545  
 546          // No cached value found. Continue to insertion phase:
 547  
 548          node = {
 549              // Generate the result from original function
 550              val: selector.apply( null, args ),
 551          };
 552  
 553          // Avoid including the source object in the cache.
 554          args[ 0 ] = null;
 555          node.args = args;
 556  
 557          // Don't need to check whether node is already head, since it would
 558          // have been returned above already if it was
 559  
 560          // Shift existing head down list
 561          if ( cache.head ) {
 562              cache.head.prev = node;
 563              node.next = cache.head;
 564          }
 565  
 566          cache.head = node;
 567  
 568          return node.val;
 569      }
 570  
 571      callSelector.getDependants = getDependants;
 572      callSelector.clear = clear;
 573      clear();
 574  
 575      return callSelector;
 576  });
 577  
 578  
 579  /***/ }),
 580  
 581  /***/ 451:
 582  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 583  
 584  "use strict";
 585  // ESM COMPAT FLAG
 586  __webpack_require__.r(__webpack_exports__);
 587  
 588  // EXPORTS
 589  __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
 590  __webpack_require__.d(__webpack_exports__, "applyFormat", function() { return /* reexport */ applyFormat; });
 591  __webpack_require__.d(__webpack_exports__, "concat", function() { return /* reexport */ concat; });
 592  __webpack_require__.d(__webpack_exports__, "create", function() { return /* reexport */ create; });
 593  __webpack_require__.d(__webpack_exports__, "getActiveFormat", function() { return /* reexport */ getActiveFormat; });
 594  __webpack_require__.d(__webpack_exports__, "getActiveObject", function() { return /* reexport */ getActiveObject; });
 595  __webpack_require__.d(__webpack_exports__, "getTextContent", function() { return /* reexport */ getTextContent; });
 596  __webpack_require__.d(__webpack_exports__, "__unstableIsListRootSelected", function() { return /* reexport */ isListRootSelected; });
 597  __webpack_require__.d(__webpack_exports__, "__unstableIsActiveListType", function() { return /* reexport */ isActiveListType; });
 598  __webpack_require__.d(__webpack_exports__, "isCollapsed", function() { return /* reexport */ isCollapsed; });
 599  __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ isEmpty; });
 600  __webpack_require__.d(__webpack_exports__, "__unstableIsEmptyLine", function() { return /* reexport */ isEmptyLine; });
 601  __webpack_require__.d(__webpack_exports__, "join", function() { return /* reexport */ join; });
 602  __webpack_require__.d(__webpack_exports__, "registerFormatType", function() { return /* reexport */ registerFormatType; });
 603  __webpack_require__.d(__webpack_exports__, "removeFormat", function() { return /* reexport */ removeFormat; });
 604  __webpack_require__.d(__webpack_exports__, "remove", function() { return /* reexport */ remove_remove; });
 605  __webpack_require__.d(__webpack_exports__, "replace", function() { return /* reexport */ replace_replace; });
 606  __webpack_require__.d(__webpack_exports__, "insert", function() { return /* reexport */ insert; });
 607  __webpack_require__.d(__webpack_exports__, "__unstableInsertLineSeparator", function() { return /* reexport */ insertLineSeparator; });
 608  __webpack_require__.d(__webpack_exports__, "__unstableRemoveLineSeparator", function() { return /* reexport */ removeLineSeparator; });
 609  __webpack_require__.d(__webpack_exports__, "insertObject", function() { return /* reexport */ insertObject; });
 610  __webpack_require__.d(__webpack_exports__, "slice", function() { return /* reexport */ slice; });
 611  __webpack_require__.d(__webpack_exports__, "split", function() { return /* reexport */ split; });
 612  __webpack_require__.d(__webpack_exports__, "__unstableToDom", function() { return /* reexport */ toDom; });
 613  __webpack_require__.d(__webpack_exports__, "toHTMLString", function() { return /* reexport */ toHTMLString; });
 614  __webpack_require__.d(__webpack_exports__, "toggleFormat", function() { return /* reexport */ toggleFormat; });
 615  __webpack_require__.d(__webpack_exports__, "__UNSTABLE_LINE_SEPARATOR", function() { return /* reexport */ LINE_SEPARATOR; });
 616  __webpack_require__.d(__webpack_exports__, "unregisterFormatType", function() { return /* reexport */ unregisterFormatType; });
 617  __webpack_require__.d(__webpack_exports__, "__unstableCanIndentListItems", function() { return /* reexport */ canIndentListItems; });
 618  __webpack_require__.d(__webpack_exports__, "__unstableCanOutdentListItems", function() { return /* reexport */ canOutdentListItems; });
 619  __webpack_require__.d(__webpack_exports__, "__unstableIndentListItems", function() { return /* reexport */ indentListItems; });
 620  __webpack_require__.d(__webpack_exports__, "__unstableOutdentListItems", function() { return /* reexport */ outdentListItems; });
 621  __webpack_require__.d(__webpack_exports__, "__unstableChangeListType", function() { return /* reexport */ changeListType; });
 622  __webpack_require__.d(__webpack_exports__, "__unstableCreateElement", function() { return /* reexport */ createElement; });
 623  __webpack_require__.d(__webpack_exports__, "useAnchorRef", function() { return /* reexport */ useAnchorRef; });
 624  __webpack_require__.d(__webpack_exports__, "__experimentalRichText", function() { return /* reexport */ component; });
 625  __webpack_require__.d(__webpack_exports__, "__unstableFormatEdit", function() { return /* reexport */ FormatEdit; });
 626  
 627  // NAMESPACE OBJECT: ./node_modules/@wordpress/rich-text/build-module/store/selectors.js
 628  var selectors_namespaceObject = {};
 629  __webpack_require__.r(selectors_namespaceObject);
 630  __webpack_require__.d(selectors_namespaceObject, "getFormatTypes", function() { return getFormatTypes; });
 631  __webpack_require__.d(selectors_namespaceObject, "getFormatType", function() { return getFormatType; });
 632  __webpack_require__.d(selectors_namespaceObject, "getFormatTypeForBareElement", function() { return getFormatTypeForBareElement; });
 633  __webpack_require__.d(selectors_namespaceObject, "getFormatTypeForClassName", function() { return getFormatTypeForClassName; });
 634  
 635  // NAMESPACE OBJECT: ./node_modules/@wordpress/rich-text/build-module/store/actions.js
 636  var actions_namespaceObject = {};
 637  __webpack_require__.r(actions_namespaceObject);
 638  __webpack_require__.d(actions_namespaceObject, "addFormatTypes", function() { return addFormatTypes; });
 639  __webpack_require__.d(actions_namespaceObject, "removeFormatTypes", function() { return removeFormatTypes; });
 640  
 641  // EXTERNAL MODULE: external ["wp","data"]
 642  var external_wp_data_ = __webpack_require__(4);
 643  
 644  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 645  var defineProperty = __webpack_require__(5);
 646  
 647  // EXTERNAL MODULE: external "lodash"
 648  var external_lodash_ = __webpack_require__(2);
 649  
 650  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/reducer.js
 651  
 652  
 653  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 654  
 655  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 656  
 657  /**
 658   * External dependencies
 659   */
 660  
 661  /**
 662   * WordPress dependencies
 663   */
 664  
 665  
 666  /**
 667   * Reducer managing the format types
 668   *
 669   * @param {Object} state  Current state.
 670   * @param {Object} action Dispatched action.
 671   *
 672   * @return {Object} Updated state.
 673   */
 674  
 675  function reducer_formatTypes() {
 676    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 677    var action = arguments.length > 1 ? arguments[1] : undefined;
 678  
 679    switch (action.type) {
 680      case 'ADD_FORMAT_TYPES':
 681        return _objectSpread(_objectSpread({}, state), Object(external_lodash_["keyBy"])(action.formatTypes, 'name'));
 682  
 683      case 'REMOVE_FORMAT_TYPES':
 684        return Object(external_lodash_["omit"])(state, action.names);
 685    }
 686  
 687    return state;
 688  }
 689  /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
 690    formatTypes: reducer_formatTypes
 691  }));
 692  
 693  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
 694  var rememo = __webpack_require__(40);
 695  
 696  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/selectors.js
 697  /**
 698   * External dependencies
 699   */
 700  
 701  
 702  /**
 703   * Returns all the available format types.
 704   *
 705   * @param {Object} state Data state.
 706   *
 707   * @return {Array} Format types.
 708   */
 709  
 710  var getFormatTypes = Object(rememo["a" /* default */])(function (state) {
 711    return Object.values(state.formatTypes);
 712  }, function (state) {
 713    return [state.formatTypes];
 714  });
 715  /**
 716   * Returns a format type by name.
 717   *
 718   * @param {Object} state Data state.
 719   * @param {string} name Format type name.
 720   *
 721   * @return {Object?} Format type.
 722   */
 723  
 724  function getFormatType(state, name) {
 725    return state.formatTypes[name];
 726  }
 727  /**
 728   * Gets the format type, if any, that can handle a bare element (without a
 729   * data-format-type attribute), given the tag name of this element.
 730   *
 731   * @param {Object} state              Data state.
 732   * @param {string} bareElementTagName The tag name of the element to find a
 733   *                                    format type for.
 734   * @return {?Object} Format type.
 735   */
 736  
 737  function getFormatTypeForBareElement(state, bareElementTagName) {
 738    return Object(external_lodash_["find"])(getFormatTypes(state), function (_ref) {
 739      var className = _ref.className,
 740          tagName = _ref.tagName;
 741      return className === null && bareElementTagName === tagName;
 742    });
 743  }
 744  /**
 745   * Gets the format type, if any, that can handle an element, given its classes.
 746   *
 747   * @param {Object} state            Data state.
 748   * @param {string} elementClassName The classes of the element to find a format
 749   *                                  type for.
 750   * @return {?Object} Format type.
 751   */
 752  
 753  function getFormatTypeForClassName(state, elementClassName) {
 754    return Object(external_lodash_["find"])(getFormatTypes(state), function (_ref2) {
 755      var className = _ref2.className;
 756  
 757      if (className === null) {
 758        return false;
 759      }
 760  
 761      return " ".concat(elementClassName, " ").indexOf(" ".concat(className, " ")) >= 0;
 762    });
 763  }
 764  
 765  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/actions.js
 766  /**
 767   * External dependencies
 768   */
 769  
 770  /**
 771   * Returns an action object used in signalling that format types have been
 772   * added.
 773   *
 774   * @param {Array|Object} formatTypes Format types received.
 775   *
 776   * @return {Object} Action object.
 777   */
 778  
 779  function addFormatTypes(formatTypes) {
 780    return {
 781      type: 'ADD_FORMAT_TYPES',
 782      formatTypes: Object(external_lodash_["castArray"])(formatTypes)
 783    };
 784  }
 785  /**
 786   * Returns an action object used to remove a registered format type.
 787   *
 788   * @param {string|Array} names Format name.
 789   *
 790   * @return {Object} Action object.
 791   */
 792  
 793  function removeFormatTypes(names) {
 794    return {
 795      type: 'REMOVE_FORMAT_TYPES',
 796      names: Object(external_lodash_["castArray"])(names)
 797    };
 798  }
 799  
 800  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/index.js
 801  /**
 802   * WordPress dependencies
 803   */
 804  
 805  /**
 806   * Internal dependencies
 807   */
 808  
 809  
 810  
 811  
 812  var STORE_NAME = 'core/rich-text';
 813  /**
 814   * Store definition for the rich-text namespace.
 815   *
 816   * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
 817   *
 818   * @type {Object}
 819   */
 820  
 821  var store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, {
 822    reducer: reducer,
 823    selectors: selectors_namespaceObject,
 824    actions: actions_namespaceObject
 825  });
 826  Object(external_wp_data_["register"])(store);
 827  
 828  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 829  var toConsumableArray = __webpack_require__(15);
 830  
 831  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-format-equal.js
 832  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
 833  
 834  /**
 835   * Optimised equality check for format objects.
 836   *
 837   * @param {?RichTextFormat} format1 Format to compare.
 838   * @param {?RichTextFormat} format2 Format to compare.
 839   *
 840   * @return {boolean} True if formats are equal, false if not.
 841   */
 842  function isFormatEqual(format1, format2) {
 843    // Both not defined.
 844    if (format1 === format2) {
 845      return true;
 846    } // Either not defined.
 847  
 848  
 849    if (!format1 || !format2) {
 850      return false;
 851    }
 852  
 853    if (format1.type !== format2.type) {
 854      return false;
 855    }
 856  
 857    var attributes1 = format1.attributes;
 858    var attributes2 = format2.attributes; // Both not defined.
 859  
 860    if (attributes1 === attributes2) {
 861      return true;
 862    } // Either not defined.
 863  
 864  
 865    if (!attributes1 || !attributes2) {
 866      return false;
 867    }
 868  
 869    var keys1 = Object.keys(attributes1);
 870    var keys2 = Object.keys(attributes2);
 871  
 872    if (keys1.length !== keys2.length) {
 873      return false;
 874    }
 875  
 876    var length = keys1.length; // Optimise for speed.
 877  
 878    for (var i = 0; i < length; i++) {
 879      var name = keys1[i];
 880  
 881      if (attributes1[name] !== attributes2[name]) {
 882        return false;
 883      }
 884    }
 885  
 886    return true;
 887  }
 888  
 889  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/normalise-formats.js
 890  
 891  
 892  function normalise_formats_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 893  
 894  function normalise_formats_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { normalise_formats_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { normalise_formats_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 895  
 896  /**
 897   * Internal dependencies
 898   */
 899  
 900  /** @typedef {import('./create').RichTextValue} RichTextValue */
 901  
 902  /**
 903   * Normalises formats: ensures subsequent adjacent equal formats have the same
 904   * reference.
 905   *
 906   * @param {RichTextValue} value Value to normalise formats of.
 907   *
 908   * @return {RichTextValue} New value with normalised formats.
 909   */
 910  
 911  function normaliseFormats(value) {
 912    var newFormats = value.formats.slice();
 913    newFormats.forEach(function (formatsAtIndex, index) {
 914      var formatsAtPreviousIndex = newFormats[index - 1];
 915  
 916      if (formatsAtPreviousIndex) {
 917        var newFormatsAtIndex = formatsAtIndex.slice();
 918        newFormatsAtIndex.forEach(function (format, formatIndex) {
 919          var previousFormat = formatsAtPreviousIndex[formatIndex];
 920  
 921          if (isFormatEqual(format, previousFormat)) {
 922            newFormatsAtIndex[formatIndex] = previousFormat;
 923          }
 924        });
 925        newFormats[index] = newFormatsAtIndex;
 926      }
 927    });
 928    return normalise_formats_objectSpread(normalise_formats_objectSpread({}, value), {}, {
 929      formats: newFormats
 930    });
 931  }
 932  
 933  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/apply-format.js
 934  
 935  
 936  
 937  function apply_format_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 938  
 939  function apply_format_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { apply_format_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { apply_format_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 940  
 941  /**
 942   * External dependencies
 943   */
 944  
 945  /**
 946   * Internal dependencies
 947   */
 948  
 949  
 950  /** @typedef {import('./create').RichTextValue} RichTextValue */
 951  
 952  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
 953  
 954  function replace(array, index, value) {
 955    array = array.slice();
 956    array[index] = value;
 957    return array;
 958  }
 959  /**
 960   * Apply a format object to a Rich Text value from the given `startIndex` to the
 961   * given `endIndex`. Indices are retrieved from the selection if none are
 962   * provided.
 963   *
 964   * @param {RichTextValue}  value        Value to modify.
 965   * @param {RichTextFormat} format       Format to apply.
 966   * @param {number}         [startIndex] Start index.
 967   * @param {number}         [endIndex]   End index.
 968   *
 969   * @return {RichTextValue} A new value with the format applied.
 970   */
 971  
 972  
 973  function applyFormat(value, format) {
 974    var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
 975    var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
 976    var formats = value.formats,
 977        activeFormats = value.activeFormats;
 978    var newFormats = formats.slice(); // The selection is collapsed.
 979  
 980    if (startIndex === endIndex) {
 981      var startFormat = Object(external_lodash_["find"])(newFormats[startIndex], {
 982        type: format.type
 983      }); // If the caret is at a format of the same type, expand start and end to
 984      // the edges of the format. This is useful to apply new attributes.
 985  
 986      if (startFormat) {
 987        var index = newFormats[startIndex].indexOf(startFormat);
 988  
 989        while (newFormats[startIndex] && newFormats[startIndex][index] === startFormat) {
 990          newFormats[startIndex] = replace(newFormats[startIndex], index, format);
 991          startIndex--;
 992        }
 993  
 994        endIndex++;
 995  
 996        while (newFormats[endIndex] && newFormats[endIndex][index] === startFormat) {
 997          newFormats[endIndex] = replace(newFormats[endIndex], index, format);
 998          endIndex++;
 999        }
1000      }
1001    } else {
1002      // Determine the highest position the new format can be inserted at.
1003      var position = +Infinity;
1004  
1005      for (var _index = startIndex; _index < endIndex; _index++) {
1006        if (newFormats[_index]) {
1007          newFormats[_index] = newFormats[_index].filter(function (_ref) {
1008            var type = _ref.type;
1009            return type !== format.type;
1010          });
1011          var length = newFormats[_index].length;
1012  
1013          if (length < position) {
1014            position = length;
1015          }
1016        } else {
1017          newFormats[_index] = [];
1018          position = 0;
1019        }
1020      }
1021  
1022      for (var _index2 = startIndex; _index2 < endIndex; _index2++) {
1023        newFormats[_index2].splice(position, 0, format);
1024      }
1025    }
1026  
1027    return normaliseFormats(apply_format_objectSpread(apply_format_objectSpread({}, value), {}, {
1028      formats: newFormats,
1029      // Always revise active formats. This serves as a placeholder for new
1030      // inputs with the format so new input appears with the format applied,
1031      // and ensures a format of the same type uses the latest values.
1032      activeFormats: [].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["reject"])(activeFormats, {
1033        type: format.type
1034      })), [format])
1035    }));
1036  }
1037  
1038  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
1039  var esm_typeof = __webpack_require__(56);
1040  
1041  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/create-element.js
1042  /**
1043   * Parse the given HTML into a body element.
1044   *
1045   * Note: The current implementation will return a shared reference, reset on
1046   * each call to `createElement`. Therefore, you should not hold a reference to
1047   * the value to operate upon asynchronously, as it may have unexpected results.
1048   *
1049   * @param {HTMLDocument} document The HTML document to use to parse.
1050   * @param {string}       html     The HTML to parse.
1051   *
1052   * @return {HTMLBodyElement} Body element with parsed HTML.
1053   */
1054  function createElement(_ref, html) {
1055    var implementation = _ref.implementation;
1056  
1057    // Because `createHTMLDocument` is an expensive operation, and with this
1058    // function being internal to `rich-text` (full control in avoiding a risk
1059    // of asynchronous operations on the shared reference), a single document
1060    // is reused and reset for each call to the function.
1061    if (!createElement.body) {
1062      createElement.body = implementation.createHTMLDocument('').body;
1063    }
1064  
1065    createElement.body.innerHTML = html;
1066    return createElement.body;
1067  }
1068  
1069  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/special-characters.js
1070  /**
1071   * Line separator character, used for multiline text.
1072   */
1073  var LINE_SEPARATOR = "\u2028";
1074  /**
1075   * Object replacement character, used as a placeholder for objects.
1076   */
1077  
1078  var OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
1079  /**
1080   * Zero width non-breaking space, used as padding in the editable DOM tree when
1081   * it is empty otherwise.
1082   */
1083  
1084  var ZWNBSP = "\uFEFF";
1085  
1086  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/create.js
1087  
1088  
1089  
1090  
1091  function create_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1092  
1093  function create_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { create_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { create_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1094  
1095  /**
1096   * WordPress dependencies
1097   */
1098  
1099  /**
1100   * Internal dependencies
1101   */
1102  
1103  
1104  
1105  
1106  
1107  /**
1108   * @typedef {Object} RichTextFormat
1109   *
1110   * @property {string} type Format type.
1111   */
1112  
1113  /**
1114   * @typedef {Array<RichTextFormat>} RichTextFormatList
1115   */
1116  
1117  /**
1118   * @typedef {Object} RichTextValue
1119   *
1120   * @property {string}                    text         Text.
1121   * @property {Array<RichTextFormatList>} formats      Formats.
1122   * @property {Array<RichTextFormat>}     replacements Replacements.
1123   * @property {number|undefined}          start        Selection start.
1124   * @property {number|undefined}          end          Selection end.
1125   */
1126  
1127  function createEmptyValue() {
1128    return {
1129      formats: [],
1130      replacements: [],
1131      text: ''
1132    };
1133  }
1134  
1135  function simpleFindKey(object, value) {
1136    for (var key in object) {
1137      if (object[key] === value) {
1138        return key;
1139      }
1140    }
1141  }
1142  
1143  function toFormat(_ref) {
1144    var type = _ref.type,
1145        attributes = _ref.attributes;
1146    var formatType;
1147  
1148    if (attributes && attributes.class) {
1149      formatType = Object(external_wp_data_["select"])('core/rich-text').getFormatTypeForClassName(attributes.class);
1150  
1151      if (formatType) {
1152        // Preserve any additional classes.
1153        attributes.class = " ".concat(attributes.class, " ").replace(" ".concat(formatType.className, " "), ' ').trim();
1154  
1155        if (!attributes.class) {
1156          delete attributes.class;
1157        }
1158      }
1159    }
1160  
1161    if (!formatType) {
1162      formatType = Object(external_wp_data_["select"])('core/rich-text').getFormatTypeForBareElement(type);
1163    }
1164  
1165    if (!formatType) {
1166      return attributes ? {
1167        type: type,
1168        attributes: attributes
1169      } : {
1170        type: type
1171      };
1172    }
1173  
1174    if (formatType.__experimentalCreatePrepareEditableTree && !formatType.__experimentalCreateOnChangeEditableValue) {
1175      return null;
1176    }
1177  
1178    if (!attributes) {
1179      return {
1180        type: formatType.name
1181      };
1182    }
1183  
1184    var registeredAttributes = {};
1185    var unregisteredAttributes = {};
1186  
1187    for (var name in attributes) {
1188      var key = simpleFindKey(formatType.attributes, name);
1189  
1190      if (key) {
1191        registeredAttributes[key] = attributes[name];
1192      } else {
1193        unregisteredAttributes[name] = attributes[name];
1194      }
1195    }
1196  
1197    return {
1198      type: formatType.name,
1199      attributes: registeredAttributes,
1200      unregisteredAttributes: unregisteredAttributes
1201    };
1202  }
1203  /**
1204   * Create a RichText value from an `Element` tree (DOM), an HTML string or a
1205   * plain text string, with optionally a `Range` object to set the selection. If
1206   * called without any input, an empty value will be created. If
1207   * `multilineTag` is provided, any content of direct children whose type matches
1208   * `multilineTag` will be separated by two newlines. The optional functions can
1209   * be used to filter out content.
1210   *
1211   * A value will have the following shape, which you are strongly encouraged not
1212   * to modify without the use of helper functions:
1213   *
1214   * ```js
1215   * {
1216   *   text: string,
1217   *   formats: Array,
1218   *   replacements: Array,
1219   *   ?start: number,
1220   *   ?end: number,
1221   * }
1222   * ```
1223   *
1224   * As you can see, text and formatting are separated. `text` holds the text,
1225   * including any replacement characters for objects and lines. `formats`,
1226   * `objects` and `lines` are all sparse arrays of the same length as `text`. It
1227   * holds information about the formatting at the relevant text indices. Finally
1228   * `start` and `end` state which text indices are selected. They are only
1229   * provided if a `Range` was given.
1230   *
1231   * @param {Object}  [$1]                      Optional named arguments.
1232   * @param {Element} [$1.element]              Element to create value from.
1233   * @param {string}  [$1.text]                 Text to create value from.
1234   * @param {string}  [$1.html]                 HTML to create value from.
1235   * @param {Range}   [$1.range]                Range to create value from.
1236   * @param {string}  [$1.multilineTag]         Multiline tag if the structure is
1237   *                                            multiline.
1238   * @param {Array}   [$1.multilineWrapperTags] Tags where lines can be found if
1239   *                                            nesting is possible.
1240   * @param {boolean} [$1.preserveWhiteSpace]   Whether or not to collapse white
1241   *                                            space characters.
1242   * @param {boolean} [$1.__unstableIsEditableTree]
1243   *
1244   * @return {RichTextValue} A rich text value.
1245   */
1246  
1247  
1248  function create() {
1249    var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1250        element = _ref2.element,
1251        text = _ref2.text,
1252        html = _ref2.html,
1253        range = _ref2.range,
1254        multilineTag = _ref2.multilineTag,
1255        multilineWrapperTags = _ref2.multilineWrapperTags,
1256        isEditableTree = _ref2.__unstableIsEditableTree,
1257        preserveWhiteSpace = _ref2.preserveWhiteSpace;
1258  
1259    if (typeof text === 'string' && text.length > 0) {
1260      return {
1261        formats: Array(text.length),
1262        replacements: Array(text.length),
1263        text: text
1264      };
1265    }
1266  
1267    if (typeof html === 'string' && html.length > 0) {
1268      // It does not matter which document this is, we're just using it to
1269      // parse.
1270      element = createElement(document, html);
1271    }
1272  
1273    if (Object(esm_typeof["a" /* default */])(element) !== 'object') {
1274      return createEmptyValue();
1275    }
1276  
1277    if (!multilineTag) {
1278      return createFromElement({
1279        element: element,
1280        range: range,
1281        isEditableTree: isEditableTree,
1282        preserveWhiteSpace: preserveWhiteSpace
1283      });
1284    }
1285  
1286    return createFromMultilineElement({
1287      element: element,
1288      range: range,
1289      multilineTag: multilineTag,
1290      multilineWrapperTags: multilineWrapperTags,
1291      isEditableTree: isEditableTree,
1292      preserveWhiteSpace: preserveWhiteSpace
1293    });
1294  }
1295  /**
1296   * Helper to accumulate the value's selection start and end from the current
1297   * node and range.
1298   *
1299   * @param {Object} accumulator Object to accumulate into.
1300   * @param {Node}   node        Node to create value with.
1301   * @param {Range}  range       Range to create value with.
1302   * @param {Object} value       Value that is being accumulated.
1303   */
1304  
1305  function accumulateSelection(accumulator, node, range, value) {
1306    if (!range) {
1307      return;
1308    }
1309  
1310    var parentNode = node.parentNode;
1311    var startContainer = range.startContainer,
1312        startOffset = range.startOffset,
1313        endContainer = range.endContainer,
1314        endOffset = range.endOffset;
1315    var currentLength = accumulator.text.length; // Selection can be extracted from value.
1316  
1317    if (value.start !== undefined) {
1318      accumulator.start = currentLength + value.start; // Range indicates that the current node has selection.
1319    } else if (node === startContainer && node.nodeType === node.TEXT_NODE) {
1320      accumulator.start = currentLength + startOffset; // Range indicates that the current node is selected.
1321    } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset]) {
1322      accumulator.start = currentLength; // Range indicates that the selection is after the current node.
1323    } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset - 1]) {
1324      accumulator.start = currentLength + value.text.length; // Fallback if no child inside handled the selection.
1325    } else if (node === startContainer) {
1326      accumulator.start = currentLength;
1327    } // Selection can be extracted from value.
1328  
1329  
1330    if (value.end !== undefined) {
1331      accumulator.end = currentLength + value.end; // Range indicates that the current node has selection.
1332    } else if (node === endContainer && node.nodeType === node.TEXT_NODE) {
1333      accumulator.end = currentLength + endOffset; // Range indicates that the current node is selected.
1334    } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset - 1]) {
1335      accumulator.end = currentLength + value.text.length; // Range indicates that the selection is before the current node.
1336    } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset]) {
1337      accumulator.end = currentLength; // Fallback if no child inside handled the selection.
1338    } else if (node === endContainer) {
1339      accumulator.end = currentLength + endOffset;
1340    }
1341  }
1342  /**
1343   * Adjusts the start and end offsets from a range based on a text filter.
1344   *
1345   * @param {Node}     node   Node of which the text should be filtered.
1346   * @param {Range}    range  The range to filter.
1347   * @param {Function} filter Function to use to filter the text.
1348   *
1349   * @return {Object|void} Object containing range properties.
1350   */
1351  
1352  
1353  function filterRange(node, range, filter) {
1354    if (!range) {
1355      return;
1356    }
1357  
1358    var startContainer = range.startContainer,
1359        endContainer = range.endContainer;
1360    var startOffset = range.startOffset,
1361        endOffset = range.endOffset;
1362  
1363    if (node === startContainer) {
1364      startOffset = filter(node.nodeValue.slice(0, startOffset)).length;
1365    }
1366  
1367    if (node === endContainer) {
1368      endOffset = filter(node.nodeValue.slice(0, endOffset)).length;
1369    }
1370  
1371    return {
1372      startContainer: startContainer,
1373      startOffset: startOffset,
1374      endContainer: endContainer,
1375      endOffset: endOffset
1376    };
1377  }
1378  /**
1379   * Collapse any whitespace used for HTML formatting to one space character,
1380   * because it will also be displayed as such by the browser.
1381   *
1382   * @param {string} string
1383   */
1384  
1385  
1386  function collapseWhiteSpace(string) {
1387    return string.replace(/[\n\r\t]+/g, ' ');
1388  }
1389  
1390  var ZWNBSPRegExp = new RegExp(ZWNBSP, 'g');
1391  /**
1392   * Removes padding (zero width non breaking spaces) added by `toTree`.
1393   *
1394   * @param {string} string
1395   */
1396  
1397  function removePadding(string) {
1398    return string.replace(ZWNBSPRegExp, '');
1399  }
1400  /**
1401   * Creates a Rich Text value from a DOM element and range.
1402   *
1403   * @param {Object}  $1                        Named argements.
1404   * @param {Element} [$1.element]              Element to create value from.
1405   * @param {Range}   [$1.range]                Range to create value from.
1406   * @param {string}  [$1.multilineTag]         Multiline tag if the structure is
1407   *                                            multiline.
1408   * @param {Array}   [$1.multilineWrapperTags] Tags where lines can be found if
1409   *                                            nesting is possible.
1410   * @param {boolean} [$1.preserveWhiteSpace]   Whether or not to collapse white
1411   *                                            space characters.
1412   * @param {Array}   [$1.currentWrapperTags]
1413   * @param {boolean} [$1.isEditableTree]
1414   *
1415   * @return {RichTextValue} A rich text value.
1416   */
1417  
1418  
1419  function createFromElement(_ref3) {
1420    var element = _ref3.element,
1421        range = _ref3.range,
1422        multilineTag = _ref3.multilineTag,
1423        multilineWrapperTags = _ref3.multilineWrapperTags,
1424        _ref3$currentWrapperT = _ref3.currentWrapperTags,
1425        currentWrapperTags = _ref3$currentWrapperT === void 0 ? [] : _ref3$currentWrapperT,
1426        isEditableTree = _ref3.isEditableTree,
1427        preserveWhiteSpace = _ref3.preserveWhiteSpace;
1428    var accumulator = createEmptyValue();
1429  
1430    if (!element) {
1431      return accumulator;
1432    }
1433  
1434    if (!element.hasChildNodes()) {
1435      accumulateSelection(accumulator, element, range, createEmptyValue());
1436      return accumulator;
1437    }
1438  
1439    var length = element.childNodes.length; // Optimise for speed.
1440  
1441    var _loop = function _loop(index) {
1442      var node = element.childNodes[index];
1443      var type = node.nodeName.toLowerCase();
1444  
1445      if (node.nodeType === node.TEXT_NODE) {
1446        var filter = removePadding;
1447  
1448        if (!preserveWhiteSpace) {
1449          filter = function filter(string) {
1450            return removePadding(collapseWhiteSpace(string));
1451          };
1452        }
1453  
1454        var text = filter(node.nodeValue);
1455        range = filterRange(node, range, filter);
1456        accumulateSelection(accumulator, node, range, {
1457          text: text
1458        }); // Create a sparse array of the same length as `text`, in which
1459        // formats can be added.
1460  
1461        accumulator.formats.length += text.length;
1462        accumulator.replacements.length += text.length;
1463        accumulator.text += text;
1464        return "continue";
1465      }
1466  
1467      if (node.nodeType !== node.ELEMENT_NODE) {
1468        return "continue";
1469      }
1470  
1471      if (isEditableTree && ( // Ignore any placeholders.
1472      node.getAttribute('data-rich-text-placeholder') || // Ignore any line breaks that are not inserted by us.
1473      type === 'br' && !node.getAttribute('data-rich-text-line-break'))) {
1474        accumulateSelection(accumulator, node, range, createEmptyValue());
1475        return "continue";
1476      }
1477  
1478      if (type === 'br') {
1479        accumulateSelection(accumulator, node, range, createEmptyValue());
1480        mergePair(accumulator, create({
1481          text: '\n'
1482        }));
1483        return "continue";
1484      }
1485  
1486      var lastFormats = accumulator.formats[accumulator.formats.length - 1];
1487      var lastFormat = lastFormats && lastFormats[lastFormats.length - 1];
1488      var newFormat = toFormat({
1489        type: type,
1490        attributes: getAttributes({
1491          element: node
1492        })
1493      });
1494      var format = isFormatEqual(newFormat, lastFormat) ? lastFormat : newFormat;
1495  
1496      if (multilineWrapperTags && multilineWrapperTags.indexOf(type) !== -1) {
1497        var _value = createFromMultilineElement({
1498          element: node,
1499          range: range,
1500          multilineTag: multilineTag,
1501          multilineWrapperTags: multilineWrapperTags,
1502          currentWrapperTags: [].concat(Object(toConsumableArray["a" /* default */])(currentWrapperTags), [format]),
1503          isEditableTree: isEditableTree,
1504          preserveWhiteSpace: preserveWhiteSpace
1505        });
1506  
1507        accumulateSelection(accumulator, node, range, _value);
1508        mergePair(accumulator, _value);
1509        return "continue";
1510      }
1511  
1512      var value = createFromElement({
1513        element: node,
1514        range: range,
1515        multilineTag: multilineTag,
1516        multilineWrapperTags: multilineWrapperTags,
1517        isEditableTree: isEditableTree,
1518        preserveWhiteSpace: preserveWhiteSpace
1519      });
1520      accumulateSelection(accumulator, node, range, value);
1521  
1522      if (!format) {
1523        mergePair(accumulator, value);
1524      } else if (value.text.length === 0) {
1525        if (format.attributes) {
1526          mergePair(accumulator, {
1527            formats: [,],
1528            replacements: [format],
1529            text: OBJECT_REPLACEMENT_CHARACTER
1530          });
1531        }
1532      } else {
1533        // Indices should share a reference to the same formats array.
1534        // Only create a new reference if `formats` changes.
1535        function mergeFormats(formats) {
1536          if (mergeFormats.formats === formats) {
1537            return mergeFormats.newFormats;
1538          }
1539  
1540          var newFormats = formats ? [format].concat(Object(toConsumableArray["a" /* default */])(formats)) : [format];
1541          mergeFormats.formats = formats;
1542          mergeFormats.newFormats = newFormats;
1543          return newFormats;
1544        } // Since the formats parameter can be `undefined`, preset
1545        // `mergeFormats` with a new reference.
1546  
1547  
1548        mergeFormats.newFormats = [format];
1549        mergePair(accumulator, create_objectSpread(create_objectSpread({}, value), {}, {
1550          formats: Array.from(value.formats, mergeFormats)
1551        }));
1552      }
1553    };
1554  
1555    for (var index = 0; index < length; index++) {
1556      var _ret = _loop(index);
1557  
1558      if (_ret === "continue") continue;
1559    }
1560  
1561    return accumulator;
1562  }
1563  /**
1564   * Creates a rich text value from a DOM element and range that should be
1565   * multiline.
1566   *
1567   * @param {Object}  $1                        Named argements.
1568   * @param {Element} [$1.element]              Element to create value from.
1569   * @param {Range}   [$1.range]                Range to create value from.
1570   * @param {string}  [$1.multilineTag]         Multiline tag if the structure is
1571   *                                            multiline.
1572   * @param {Array}   [$1.multilineWrapperTags] Tags where lines can be found if
1573   *                                            nesting is possible.
1574   * @param {boolean} [$1.currentWrapperTags]   Whether to prepend a line
1575   *                                            separator.
1576   * @param {boolean} [$1.preserveWhiteSpace]   Whether or not to collapse white
1577   *                                            space characters.
1578   * @param {boolean} [$1.isEditableTree]
1579   *
1580   * @return {RichTextValue} A rich text value.
1581   */
1582  
1583  
1584  function createFromMultilineElement(_ref4) {
1585    var element = _ref4.element,
1586        range = _ref4.range,
1587        multilineTag = _ref4.multilineTag,
1588        multilineWrapperTags = _ref4.multilineWrapperTags,
1589        _ref4$currentWrapperT = _ref4.currentWrapperTags,
1590        currentWrapperTags = _ref4$currentWrapperT === void 0 ? [] : _ref4$currentWrapperT,
1591        isEditableTree = _ref4.isEditableTree,
1592        preserveWhiteSpace = _ref4.preserveWhiteSpace;
1593    var accumulator = createEmptyValue();
1594  
1595    if (!element || !element.hasChildNodes()) {
1596      return accumulator;
1597    }
1598  
1599    var length = element.children.length; // Optimise for speed.
1600  
1601    for (var index = 0; index < length; index++) {
1602      var node = element.children[index];
1603  
1604      if (node.nodeName.toLowerCase() !== multilineTag) {
1605        continue;
1606      }
1607  
1608      var value = createFromElement({
1609        element: node,
1610        range: range,
1611        multilineTag: multilineTag,
1612        multilineWrapperTags: multilineWrapperTags,
1613        currentWrapperTags: currentWrapperTags,
1614        isEditableTree: isEditableTree,
1615        preserveWhiteSpace: preserveWhiteSpace
1616      }); // Multiline value text should be separated by a line separator.
1617  
1618      if (index !== 0 || currentWrapperTags.length > 0) {
1619        mergePair(accumulator, {
1620          formats: [,],
1621          replacements: currentWrapperTags.length > 0 ? [currentWrapperTags] : [,],
1622          text: LINE_SEPARATOR
1623        });
1624      }
1625  
1626      accumulateSelection(accumulator, node, range, value);
1627      mergePair(accumulator, value);
1628    }
1629  
1630    return accumulator;
1631  }
1632  /**
1633   * Gets the attributes of an element in object shape.
1634   *
1635   * @param {Object}  $1         Named argements.
1636   * @param {Element} $1.element Element to get attributes from.
1637   *
1638   * @return {Object|void} Attribute object or `undefined` if the element has no
1639   *                       attributes.
1640   */
1641  
1642  
1643  function getAttributes(_ref5) {
1644    var element = _ref5.element;
1645  
1646    if (!element.hasAttributes()) {
1647      return;
1648    }
1649  
1650    var length = element.attributes.length;
1651    var accumulator; // Optimise for speed.
1652  
1653    for (var i = 0; i < length; i++) {
1654      var _element$attributes$i = element.attributes[i],
1655          name = _element$attributes$i.name,
1656          value = _element$attributes$i.value;
1657  
1658      if (name.indexOf('data-rich-text-') === 0) {
1659        continue;
1660      }
1661  
1662      accumulator = accumulator || {};
1663      accumulator[name] = value;
1664    }
1665  
1666    return accumulator;
1667  }
1668  
1669  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/concat.js
1670  /**
1671   * Internal dependencies
1672   */
1673  
1674  
1675  /** @typedef {import('./create').RichTextValue} RichTextValue */
1676  
1677  /**
1678   * Concats a pair of rich text values. Not that this mutates `a` and does NOT
1679   * normalise formats!
1680   *
1681   * @param {Object} a Value to mutate.
1682   * @param {Object} b Value to add read from.
1683   *
1684   * @return {Object} `a`, mutated.
1685   */
1686  
1687  function mergePair(a, b) {
1688    a.formats = a.formats.concat(b.formats);
1689    a.replacements = a.replacements.concat(b.replacements);
1690    a.text += b.text;
1691    return a;
1692  }
1693  /**
1694   * Combine all Rich Text values into one. This is similar to
1695   * `String.prototype.concat`.
1696   *
1697   * @param {...RichTextValue} values Objects to combine.
1698   *
1699   * @return {RichTextValue} A new value combining all given records.
1700   */
1701  
1702  function concat() {
1703    for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
1704      values[_key] = arguments[_key];
1705    }
1706  
1707    return normaliseFormats(values.reduce(mergePair, create()));
1708  }
1709  
1710  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-formats.js
1711  /** @typedef {import('./create').RichTextValue} RichTextValue */
1712  
1713  /** @typedef {import('./create').RichTextFormatList} RichTextFormatList */
1714  
1715  /**
1716   * Gets the all format objects at the start of the selection.
1717   *
1718   * @param {RichTextValue} value                Value to inspect.
1719   * @param {Array}         EMPTY_ACTIVE_FORMATS Array to return if there are no
1720   *                                             active formats.
1721   *
1722   * @return {RichTextFormatList} Active format objects.
1723   */
1724  function getActiveFormats(_ref) {
1725    var formats = _ref.formats,
1726        start = _ref.start,
1727        end = _ref.end,
1728        activeFormats = _ref.activeFormats;
1729    var EMPTY_ACTIVE_FORMATS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1730  
1731    if (start === undefined) {
1732      return EMPTY_ACTIVE_FORMATS;
1733    }
1734  
1735    if (start === end) {
1736      // For a collapsed caret, it is possible to override the active formats.
1737      if (activeFormats) {
1738        return activeFormats;
1739      }
1740  
1741      var formatsBefore = formats[start - 1] || EMPTY_ACTIVE_FORMATS;
1742      var formatsAfter = formats[start] || EMPTY_ACTIVE_FORMATS; // By default, select the lowest amount of formats possible (which means
1743      // the caret is positioned outside the format boundary). The user can
1744      // then use arrow keys to define `activeFormats`.
1745  
1746      if (formatsBefore.length < formatsAfter.length) {
1747        return formatsBefore;
1748      }
1749  
1750      return formatsAfter;
1751    }
1752  
1753    return formats[start] || EMPTY_ACTIVE_FORMATS;
1754  }
1755  
1756  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-format.js
1757  /**
1758   * External dependencies
1759   */
1760  
1761  /**
1762   * Internal dependencies
1763   */
1764  
1765  
1766  /** @typedef {import('./create').RichTextValue} RichTextValue */
1767  
1768  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
1769  
1770  /**
1771   * Gets the format object by type at the start of the selection. This can be
1772   * used to get e.g. the URL of a link format at the current selection, but also
1773   * to check if a format is active at the selection. Returns undefined if there
1774   * is no format at the selection.
1775   *
1776   * @param {RichTextValue} value      Value to inspect.
1777   * @param {string}        formatType Format type to look for.
1778   *
1779   * @return {RichTextFormat|undefined} Active format object of the specified
1780   *                                    type, or undefined.
1781   */
1782  
1783  function getActiveFormat(value, formatType) {
1784    return Object(external_lodash_["find"])(getActiveFormats(value), {
1785      type: formatType
1786    });
1787  }
1788  
1789  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-object.js
1790  /**
1791   * Internal dependencies
1792   */
1793  
1794  /** @typedef {import('./create').RichTextValue} RichTextValue */
1795  
1796  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
1797  
1798  /**
1799   * Gets the active object, if there is any.
1800   *
1801   * @param {RichTextValue} value Value to inspect.
1802   *
1803   * @return {RichTextFormat|void} Active object, or undefined.
1804   */
1805  
1806  function getActiveObject(_ref) {
1807    var start = _ref.start,
1808        end = _ref.end,
1809        replacements = _ref.replacements,
1810        text = _ref.text;
1811  
1812    if (start + 1 !== end || text[start] !== OBJECT_REPLACEMENT_CHARACTER) {
1813      return;
1814    }
1815  
1816    return replacements[start];
1817  }
1818  
1819  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-text-content.js
1820  /**
1821   * Internal dependencies
1822   */
1823  
1824  /** @typedef {import('./create').RichTextValue} RichTextValue */
1825  
1826  /**
1827   * Get the textual content of a Rich Text value. This is similar to
1828   * `Element.textContent`.
1829   *
1830   * @param {RichTextValue} value Value to use.
1831   *
1832   * @return {string} The text content.
1833   */
1834  
1835  function getTextContent(_ref) {
1836    var text = _ref.text;
1837    return text.replace(new RegExp(OBJECT_REPLACEMENT_CHARACTER, 'g'), '').replace(new RegExp(LINE_SEPARATOR, 'g'), '\n');
1838  }
1839  
1840  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-line-index.js
1841  /**
1842   * Internal dependencies
1843   */
1844  
1845  /** @typedef {import('./create').RichTextValue} RichTextValue */
1846  
1847  /**
1848   * Gets the currently selected line index, or the first line index if the
1849   * selection spans over multiple items.
1850   *
1851   * @param {RichTextValue}  value      Value to get the line index from.
1852   * @param {boolean}        startIndex Optional index that should be contained by
1853   *                                    the line. Defaults to the selection start
1854   *                                    of the value.
1855   *
1856   * @return {number|void} The line index. Undefined if not found.
1857   */
1858  
1859  function getLineIndex(_ref) {
1860    var start = _ref.start,
1861        text = _ref.text;
1862    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
1863    var index = startIndex;
1864  
1865    while (index--) {
1866      if (text[index] === LINE_SEPARATOR) {
1867        return index;
1868      }
1869    }
1870  }
1871  
1872  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-list-root-selected.js
1873  /**
1874   * Internal dependencies
1875   */
1876  
1877  /** @typedef {import('./create').RichTextValue} RichTextValue */
1878  
1879  /**
1880   * Whether or not the root list is selected.
1881   *
1882   * @param {RichTextValue} value The value to check.
1883   *
1884   * @return {boolean} True if the root list or nothing is selected, false if an
1885   *                   inner list is selected.
1886   */
1887  
1888  function isListRootSelected(value) {
1889    var replacements = value.replacements,
1890        start = value.start;
1891    var lineIndex = getLineIndex(value, start);
1892    var replacement = replacements[lineIndex];
1893    return !replacement || replacement.length < 1;
1894  }
1895  
1896  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-active-list-type.js
1897  /**
1898   * Internal dependencies
1899   */
1900  
1901  /** @typedef {import('./create').RichTextValue} RichTextValue */
1902  
1903  /**
1904   * Whether or not the selected list has the given tag name.
1905   *
1906   * @param {RichTextValue} value    The value to check.
1907   * @param {string}        type     The tag name the list should have.
1908   * @param {string}        rootType The current root tag name, to compare with in
1909   *                                 case nothing is selected.
1910   *
1911   * @return {boolean} True if the current list type matches `type`, false if not.
1912   */
1913  
1914  function isActiveListType(value, type, rootType) {
1915    var replacements = value.replacements,
1916        start = value.start;
1917    var lineIndex = getLineIndex(value, start);
1918    var replacement = replacements[lineIndex];
1919  
1920    if (!replacement || replacement.length === 0) {
1921      return type === rootType;
1922    }
1923  
1924    var lastFormat = replacement[replacement.length - 1];
1925    return lastFormat.type === type;
1926  }
1927  
1928  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-collapsed.js
1929  /** @typedef {import('./create').RichTextValue} RichTextValue */
1930  
1931  /**
1932   * Check if the selection of a Rich Text value is collapsed or not. Collapsed
1933   * means that no characters are selected, but there is a caret present. If there
1934   * is no selection, `undefined` will be returned. This is similar to
1935   * `window.getSelection().isCollapsed()`.
1936   *
1937   * @param {RichTextValue} value The rich text value to check.
1938   *
1939   * @return {boolean|undefined} True if the selection is collapsed, false if not,
1940   *                             undefined if there is no selection.
1941   */
1942  function isCollapsed(_ref) {
1943    var start = _ref.start,
1944        end = _ref.end;
1945  
1946    if (start === undefined || end === undefined) {
1947      return;
1948    }
1949  
1950    return start === end;
1951  }
1952  
1953  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-empty.js
1954  /**
1955   * Internal dependencies
1956   */
1957  
1958  /** @typedef {import('./create').RichTextValue} RichTextValue */
1959  
1960  /**
1961   * Check if a Rich Text value is Empty, meaning it contains no text or any
1962   * objects (such as images).
1963   *
1964   * @param {RichTextValue} value Value to use.
1965   *
1966   * @return {boolean} True if the value is empty, false if not.
1967   */
1968  
1969  function isEmpty(_ref) {
1970    var text = _ref.text;
1971    return text.length === 0;
1972  }
1973  /**
1974   * Check if the current collapsed selection is on an empty line in case of a
1975   * multiline value.
1976   *
1977   * @param  {RichTextValue} value Value te check.
1978   *
1979   * @return {boolean} True if the line is empty, false if not.
1980   */
1981  
1982  function isEmptyLine(_ref2) {
1983    var text = _ref2.text,
1984        start = _ref2.start,
1985        end = _ref2.end;
1986  
1987    if (start !== end) {
1988      return false;
1989    }
1990  
1991    if (text.length === 0) {
1992      return true;
1993    }
1994  
1995    if (start === 0 && text.slice(0, 1) === LINE_SEPARATOR) {
1996      return true;
1997    }
1998  
1999    if (start === text.length && text.slice(-1) === LINE_SEPARATOR) {
2000      return true;
2001    }
2002  
2003    return text.slice(start - 1, end + 1) === "".concat(LINE_SEPARATOR).concat(LINE_SEPARATOR);
2004  }
2005  
2006  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/join.js
2007  /**
2008   * Internal dependencies
2009   */
2010  
2011  
2012  /** @typedef {import('./create').RichTextValue} RichTextValue */
2013  
2014  /**
2015   * Combine an array of Rich Text values into one, optionally separated by
2016   * `separator`, which can be a Rich Text value, HTML string, or plain text
2017   * string. This is similar to `Array.prototype.join`.
2018   *
2019   * @param {Array<RichTextValue>} values      An array of values to join.
2020   * @param {string|RichTextValue} [separator] Separator string or value.
2021   *
2022   * @return {RichTextValue} A new combined value.
2023   */
2024  
2025  function join(values) {
2026    var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2027  
2028    if (typeof separator === 'string') {
2029      separator = create({
2030        text: separator
2031      });
2032    }
2033  
2034    return normaliseFormats(values.reduce(function (accumlator, _ref) {
2035      var formats = _ref.formats,
2036          replacements = _ref.replacements,
2037          text = _ref.text;
2038      return {
2039        formats: accumlator.formats.concat(separator.formats, formats),
2040        replacements: accumlator.replacements.concat(separator.replacements, replacements),
2041        text: accumlator.text + separator.text + text
2042      };
2043    }));
2044  }
2045  
2046  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/register-format-type.js
2047  
2048  
2049  function register_format_type_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2050  
2051  function register_format_type_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { register_format_type_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { register_format_type_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2052  
2053  /**
2054   * WordPress dependencies
2055   */
2056  
2057  /**
2058   * Internal dependencies
2059   */
2060  
2061  
2062  /**
2063   * @typedef {Object} WPFormat
2064   *
2065   * @property {string}   name        A string identifying the format. Must be
2066   *                                  unique across all registered formats.
2067   * @property {string}   tagName     The HTML tag this format will wrap the
2068   *                                  selection with.
2069   * @property {string}   [className] A class to match the format.
2070   * @property {string}   title       Name of the format.
2071   * @property {Function} edit        Should return a component for the user to
2072   *                                  interact with the new registered format.
2073   */
2074  
2075  /**
2076   * Registers a new format provided a unique name and an object defining its
2077   * behavior.
2078   *
2079   * @param {string}   name                 Format name.
2080   * @param {WPFormat} settings             Format settings.
2081   *
2082   * @return {WPFormat|undefined} The format, if it has been successfully
2083   *                              registered; otherwise `undefined`.
2084   */
2085  
2086  function registerFormatType(name, settings) {
2087    settings = register_format_type_objectSpread({
2088      name: name
2089    }, settings);
2090  
2091    if (typeof settings.name !== 'string') {
2092      window.console.error('Format names must be strings.');
2093      return;
2094    }
2095  
2096    if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(settings.name)) {
2097      window.console.error('Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format');
2098      return;
2099    }
2100  
2101    if (Object(external_wp_data_["select"])(store).getFormatType(settings.name)) {
2102      window.console.error('Format "' + settings.name + '" is already registered.');
2103      return;
2104    }
2105  
2106    if (typeof settings.tagName !== 'string' || settings.tagName === '') {
2107      window.console.error('Format tag names must be a string.');
2108      return;
2109    }
2110  
2111    if ((typeof settings.className !== 'string' || settings.className === '') && settings.className !== null) {
2112      window.console.error('Format class names must be a string, or null to handle bare elements.');
2113      return;
2114    }
2115  
2116    if (!/^[_a-zA-Z]+[a-zA-Z0-9-]*$/.test(settings.className)) {
2117      window.console.error('A class name must begin with a letter, followed by any number of hyphens, letters, or numbers.');
2118      return;
2119    }
2120  
2121    if (settings.className === null) {
2122      var formatTypeForBareElement = Object(external_wp_data_["select"])(store).getFormatTypeForBareElement(settings.tagName);
2123  
2124      if (formatTypeForBareElement) {
2125        window.console.error("Format \"".concat(formatTypeForBareElement.name, "\" is already registered to handle bare tag name \"").concat(settings.tagName, "\"."));
2126        return;
2127      }
2128    } else {
2129      var formatTypeForClassName = Object(external_wp_data_["select"])(store).getFormatTypeForClassName(settings.className);
2130  
2131      if (formatTypeForClassName) {
2132        window.console.error("Format \"".concat(formatTypeForClassName.name, "\" is already registered to handle class name \"").concat(settings.className, "\"."));
2133        return;
2134      }
2135    }
2136  
2137    if (!('title' in settings) || settings.title === '') {
2138      window.console.error('The format "' + settings.name + '" must have a title.');
2139      return;
2140    }
2141  
2142    if ('keywords' in settings && settings.keywords.length > 3) {
2143      window.console.error('The format "' + settings.name + '" can have a maximum of 3 keywords.');
2144      return;
2145    }
2146  
2147    if (typeof settings.title !== 'string') {
2148      window.console.error('Format titles must be strings.');
2149      return;
2150    }
2151  
2152    Object(external_wp_data_["dispatch"])(store).addFormatTypes(settings);
2153    return settings;
2154  }
2155  
2156  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove-format.js
2157  
2158  
2159  function remove_format_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2160  
2161  function remove_format_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { remove_format_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { remove_format_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2162  
2163  /**
2164   * External dependencies
2165   */
2166  
2167  /**
2168   * Internal dependencies
2169   */
2170  
2171  
2172  /** @typedef {import('./create').RichTextValue} RichTextValue */
2173  
2174  /**
2175   * Remove any format object from a Rich Text value by type from the given
2176   * `startIndex` to the given `endIndex`. Indices are retrieved from the
2177   * selection if none are provided.
2178   *
2179   * @param {RichTextValue} value        Value to modify.
2180   * @param {string}        formatType   Format type to remove.
2181   * @param {number}        [startIndex] Start index.
2182   * @param {number}        [endIndex]   End index.
2183   *
2184   * @return {RichTextValue} A new value with the format applied.
2185   */
2186  
2187  function removeFormat(value, formatType) {
2188    var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
2189    var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
2190    var formats = value.formats,
2191        activeFormats = value.activeFormats;
2192    var newFormats = formats.slice(); // If the selection is collapsed, expand start and end to the edges of the
2193    // format.
2194  
2195    if (startIndex === endIndex) {
2196      var format = Object(external_lodash_["find"])(newFormats[startIndex], {
2197        type: formatType
2198      });
2199  
2200      if (format) {
2201        while (Object(external_lodash_["find"])(newFormats[startIndex], format)) {
2202          filterFormats(newFormats, startIndex, formatType);
2203          startIndex--;
2204        }
2205  
2206        endIndex++;
2207  
2208        while (Object(external_lodash_["find"])(newFormats[endIndex], format)) {
2209          filterFormats(newFormats, endIndex, formatType);
2210          endIndex++;
2211        }
2212      }
2213    } else {
2214      for (var i = startIndex; i < endIndex; i++) {
2215        if (newFormats[i]) {
2216          filterFormats(newFormats, i, formatType);
2217        }
2218      }
2219    }
2220  
2221    return normaliseFormats(remove_format_objectSpread(remove_format_objectSpread({}, value), {}, {
2222      formats: newFormats,
2223      activeFormats: Object(external_lodash_["reject"])(activeFormats, {
2224        type: formatType
2225      })
2226    }));
2227  }
2228  
2229  function filterFormats(formats, index, formatType) {
2230    var newFormats = formats[index].filter(function (_ref) {
2231      var type = _ref.type;
2232      return type !== formatType;
2233    });
2234  
2235    if (newFormats.length) {
2236      formats[index] = newFormats;
2237    } else {
2238      delete formats[index];
2239    }
2240  }
2241  
2242  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert.js
2243  /**
2244   * Internal dependencies
2245   */
2246  
2247  
2248  /** @typedef {import('./create').RichTextValue} RichTextValue */
2249  
2250  /**
2251   * Insert a Rich Text value, an HTML string, or a plain text string, into a
2252   * Rich Text value at the given `startIndex`. Any content between `startIndex`
2253   * and `endIndex` will be removed. Indices are retrieved from the selection if
2254   * none are provided.
2255   *
2256   * @param {RichTextValue}        value         Value to modify.
2257   * @param {RichTextValue|string} valueToInsert Value to insert.
2258   * @param {number}               [startIndex]  Start index.
2259   * @param {number}               [endIndex]    End index.
2260   *
2261   * @return {RichTextValue} A new value with the value inserted.
2262   */
2263  
2264  function insert(value, valueToInsert) {
2265    var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
2266    var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
2267    var formats = value.formats,
2268        replacements = value.replacements,
2269        text = value.text;
2270  
2271    if (typeof valueToInsert === 'string') {
2272      valueToInsert = create({
2273        text: valueToInsert
2274      });
2275    }
2276  
2277    var index = startIndex + valueToInsert.text.length;
2278    return normaliseFormats({
2279      formats: formats.slice(0, startIndex).concat(valueToInsert.formats, formats.slice(endIndex)),
2280      replacements: replacements.slice(0, startIndex).concat(valueToInsert.replacements, replacements.slice(endIndex)),
2281      text: text.slice(0, startIndex) + valueToInsert.text + text.slice(endIndex),
2282      start: index,
2283      end: index
2284    });
2285  }
2286  
2287  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove.js
2288  /**
2289   * Internal dependencies
2290   */
2291  
2292  
2293  /** @typedef {import('./create').RichTextValue} RichTextValue */
2294  
2295  /**
2296   * Remove content from a Rich Text value between the given `startIndex` and
2297   * `endIndex`. Indices are retrieved from the selection if none are provided.
2298   *
2299   * @param {RichTextValue} value        Value to modify.
2300   * @param {number}        [startIndex] Start index.
2301   * @param {number}        [endIndex]   End index.
2302   *
2303   * @return {RichTextValue} A new value with the content removed.
2304   */
2305  
2306  function remove_remove(value, startIndex, endIndex) {
2307    return insert(value, create(), startIndex, endIndex);
2308  }
2309  
2310  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/replace.js
2311  
2312  
2313  /**
2314   * Internal dependencies
2315   */
2316  
2317  /** @typedef {import('./create').RichTextValue} RichTextValue */
2318  
2319  /**
2320   * Search a Rich Text value and replace the match(es) with `replacement`. This
2321   * is similar to `String.prototype.replace`.
2322   *
2323   * @param {RichTextValue}  value        The value to modify.
2324   * @param {RegExp|string}  pattern      A RegExp object or literal. Can also be
2325   *                                      a string. It is treated as a verbatim
2326   *                                      string and is not interpreted as a
2327   *                                      regular expression. Only the first
2328   *                                      occurrence will be replaced.
2329   * @param {Function|string} replacement The match or matches are replaced with
2330   *                                      the specified or the value returned by
2331   *                                      the specified function.
2332   *
2333   * @return {RichTextValue} A new value with replacements applied.
2334   */
2335  
2336  function replace_replace(_ref, pattern, replacement) {
2337    var formats = _ref.formats,
2338        replacements = _ref.replacements,
2339        text = _ref.text,
2340        start = _ref.start,
2341        end = _ref.end;
2342    text = text.replace(pattern, function (match) {
2343      for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2344        rest[_key - 1] = arguments[_key];
2345      }
2346  
2347      var offset = rest[rest.length - 2];
2348      var newText = replacement;
2349      var newFormats;
2350      var newReplacements;
2351  
2352      if (typeof newText === 'function') {
2353        newText = replacement.apply(void 0, [match].concat(rest));
2354      }
2355  
2356      if (Object(esm_typeof["a" /* default */])(newText) === 'object') {
2357        newFormats = newText.formats;
2358        newReplacements = newText.replacements;
2359        newText = newText.text;
2360      } else {
2361        newFormats = Array(newText.length);
2362        newReplacements = Array(newText.length);
2363  
2364        if (formats[offset]) {
2365          newFormats = newFormats.fill(formats[offset]);
2366        }
2367      }
2368  
2369      formats = formats.slice(0, offset).concat(newFormats, formats.slice(offset + match.length));
2370      replacements = replacements.slice(0, offset).concat(newReplacements, replacements.slice(offset + match.length));
2371  
2372      if (start) {
2373        start = end = offset + newText.length;
2374      }
2375  
2376      return newText;
2377    });
2378    return normaliseFormats({
2379      formats: formats,
2380      replacements: replacements,
2381      text: text,
2382      start: start,
2383      end: end
2384    });
2385  }
2386  
2387  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert-line-separator.js
2388  /**
2389   * Internal dependencies
2390   */
2391  
2392  
2393  /** @typedef {import('./create').RichTextValue} RichTextValue */
2394  
2395  /**
2396   * Insert a line break character into a Rich Text value at the given
2397   * `startIndex`. Any content between `startIndex` and `endIndex` will be
2398   * removed. Indices are retrieved from the selection if none are provided.
2399   *
2400   * @param {RichTextValue} value        Value to modify.
2401   * @param {number}        [startIndex] Start index.
2402   * @param {number}        [endIndex]   End index.
2403   *
2404   * @return {RichTextValue} A new value with the value inserted.
2405   */
2406  
2407  function insertLineSeparator(value) {
2408    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value.start;
2409    var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.end;
2410    var beforeText = value.text.slice(0, startIndex);
2411    var previousLineSeparatorIndex = beforeText.lastIndexOf(LINE_SEPARATOR);
2412    var previousLineSeparatorFormats = value.replacements[previousLineSeparatorIndex];
2413    var replacements = [,];
2414  
2415    if (previousLineSeparatorFormats) {
2416      replacements = [previousLineSeparatorFormats];
2417    }
2418  
2419    var valueToInsert = {
2420      formats: [,],
2421      replacements: replacements,
2422      text: LINE_SEPARATOR
2423    };
2424    return insert(value, valueToInsert, startIndex, endIndex);
2425  }
2426  
2427  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove-line-separator.js
2428  
2429  
2430  function remove_line_separator_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2431  
2432  function remove_line_separator_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { remove_line_separator_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { remove_line_separator_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2433  
2434  /**
2435   * Internal dependencies
2436   */
2437  
2438  
2439  
2440  /** @typedef {import('./create').RichTextValue} RichTextValue */
2441  
2442  /**
2443   * Removes a line separator character, if existing, from a Rich Text value at
2444   * the current indices. If no line separator exists on the indices it will
2445   * return undefined.
2446   *
2447   * @param {RichTextValue} value    Value to modify.
2448   * @param {boolean}       backward Indicates if are removing from the start
2449   *                                 index or the end index.
2450   *
2451   * @return {RichTextValue|undefined} A new value with the line separator
2452   *                                   removed. Or undefined if no line separator
2453   *                                   is found on the position.
2454   */
2455  
2456  function removeLineSeparator(value) {
2457    var backward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2458    var replacements = value.replacements,
2459        text = value.text,
2460        start = value.start,
2461        end = value.end;
2462    var collapsed = isCollapsed(value);
2463    var index = start - 1;
2464    var removeStart = collapsed ? start - 1 : start;
2465    var removeEnd = end;
2466  
2467    if (!backward) {
2468      index = end;
2469      removeStart = start;
2470      removeEnd = collapsed ? end + 1 : end;
2471    }
2472  
2473    if (text[index] !== LINE_SEPARATOR) {
2474      return;
2475    }
2476  
2477    var newValue; // If the line separator that is about te be removed
2478    // contains wrappers, remove the wrappers first.
2479  
2480    if (collapsed && replacements[index] && replacements[index].length) {
2481      var newReplacements = replacements.slice();
2482      newReplacements[index] = replacements[index].slice(0, -1);
2483      newValue = remove_line_separator_objectSpread(remove_line_separator_objectSpread({}, value), {}, {
2484        replacements: newReplacements
2485      });
2486    } else {
2487      newValue = remove_remove(value, removeStart, removeEnd);
2488    }
2489  
2490    return newValue;
2491  }
2492  
2493  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert-object.js
2494  /**
2495   * Internal dependencies
2496   */
2497  
2498  
2499  /** @typedef {import('./create').RichTextValue} RichTextValue */
2500  
2501  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
2502  
2503  /**
2504   * Insert a format as an object into a Rich Text value at the given
2505   * `startIndex`. Any content between `startIndex` and `endIndex` will be
2506   * removed. Indices are retrieved from the selection if none are provided.
2507   *
2508   * @param {RichTextValue}  value          Value to modify.
2509   * @param {RichTextFormat} formatToInsert Format to insert as object.
2510   * @param {number}         [startIndex]   Start index.
2511   * @param {number}         [endIndex]     End index.
2512   *
2513   * @return {RichTextValue} A new value with the object inserted.
2514   */
2515  
2516  function insertObject(value, formatToInsert, startIndex, endIndex) {
2517    var valueToInsert = {
2518      formats: [,],
2519      replacements: [formatToInsert],
2520      text: OBJECT_REPLACEMENT_CHARACTER
2521    };
2522    return insert(value, valueToInsert, startIndex, endIndex);
2523  }
2524  
2525  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/slice.js
2526  
2527  
2528  function slice_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2529  
2530  function slice_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { slice_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { slice_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2531  
2532  /** @typedef {import('./create').RichTextValue} RichTextValue */
2533  
2534  /**
2535   * Slice a Rich Text value from `startIndex` to `endIndex`. Indices are
2536   * retrieved from the selection if none are provided. This is similar to
2537   * `String.prototype.slice`.
2538   *
2539   * @param {RichTextValue} value        Value to modify.
2540   * @param {number}        [startIndex] Start index.
2541   * @param {number}        [endIndex]   End index.
2542   *
2543   * @return {RichTextValue} A new extracted value.
2544   */
2545  function slice(value) {
2546    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value.start;
2547    var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.end;
2548    var formats = value.formats,
2549        replacements = value.replacements,
2550        text = value.text;
2551  
2552    if (startIndex === undefined || endIndex === undefined) {
2553      return slice_objectSpread({}, value);
2554    }
2555  
2556    return {
2557      formats: formats.slice(startIndex, endIndex),
2558      replacements: replacements.slice(startIndex, endIndex),
2559      text: text.slice(startIndex, endIndex)
2560    };
2561  }
2562  
2563  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/split.js
2564  /**
2565   * Internal dependencies
2566   */
2567  
2568  /** @typedef {import('./create').RichTextValue} RichTextValue */
2569  
2570  /**
2571   * Split a Rich Text value in two at the given `startIndex` and `endIndex`, or
2572   * split at the given separator. This is similar to `String.prototype.split`.
2573   * Indices are retrieved from the selection if none are provided.
2574   *
2575   * @param {RichTextValue} value
2576   * @param {number|string} [string] Start index, or string at which to split.
2577   *
2578   * @return {Array<RichTextValue>} An array of new values.
2579   */
2580  
2581  function split(_ref, string) {
2582    var formats = _ref.formats,
2583        replacements = _ref.replacements,
2584        text = _ref.text,
2585        start = _ref.start,
2586        end = _ref.end;
2587  
2588    if (typeof string !== 'string') {
2589      return splitAtSelection.apply(void 0, arguments);
2590    }
2591  
2592    var nextStart = 0;
2593    return text.split(string).map(function (substring) {
2594      var startIndex = nextStart;
2595      var value = {
2596        formats: formats.slice(startIndex, startIndex + substring.length),
2597        replacements: replacements.slice(startIndex, startIndex + substring.length),
2598        text: substring
2599      };
2600      nextStart += string.length + substring.length;
2601  
2602      if (start !== undefined && end !== undefined) {
2603        if (start >= startIndex && start < nextStart) {
2604          value.start = start - startIndex;
2605        } else if (start < startIndex && end > startIndex) {
2606          value.start = 0;
2607        }
2608  
2609        if (end >= startIndex && end < nextStart) {
2610          value.end = end - startIndex;
2611        } else if (start < nextStart && end > nextStart) {
2612          value.end = substring.length;
2613        }
2614      }
2615  
2616      return value;
2617    });
2618  }
2619  
2620  function splitAtSelection(_ref2) {
2621    var formats = _ref2.formats,
2622        replacements = _ref2.replacements,
2623        text = _ref2.text,
2624        start = _ref2.start,
2625        end = _ref2.end;
2626    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
2627    var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end;
2628    var before = {
2629      formats: formats.slice(0, startIndex),
2630      replacements: replacements.slice(0, startIndex),
2631      text: text.slice(0, startIndex)
2632    };
2633    var after = {
2634      formats: formats.slice(endIndex),
2635      replacements: replacements.slice(endIndex),
2636      text: text.slice(endIndex),
2637      start: 0,
2638      end: 0
2639    };
2640    return [// Ensure newlines are trimmed.
2641    replace_replace(before, /\u2028+$/, ''), replace_replace(after, /^\u2028+/, '')];
2642  }
2643  
2644  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-format-type.js
2645  /**
2646   * WordPress dependencies
2647   */
2648  
2649  /**
2650   * Internal dependencies
2651   */
2652  
2653  
2654  /** @typedef {import('./register-format-type').RichTextFormatType} RichTextFormatType */
2655  
2656  /**
2657   * Returns a registered format type.
2658   *
2659   * @param {string} name Format name.
2660   *
2661   * @return {RichTextFormatType|undefined} Format type.
2662   */
2663  
2664  function get_format_type_getFormatType(name) {
2665    return Object(external_wp_data_["select"])(store).getFormatType(name);
2666  }
2667  
2668  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-tree.js
2669  
2670  
2671  
2672  function to_tree_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2673  
2674  function to_tree_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { to_tree_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { to_tree_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2675  
2676  /**
2677   * Internal dependencies
2678   */
2679  
2680  
2681  
2682  /**
2683   * Converts a format object to information that can be used to create an element
2684   * from (type, attributes and object).
2685   *
2686   * @param  {Object}  $1                        Named parameters.
2687   * @param  {string}  $1.type                   The format type.
2688   * @param  {Object}  $1.attributes             The format attributes.
2689   * @param  {Object}  $1.unregisteredAttributes The unregistered format
2690   *                                             attributes.
2691   * @param  {boolean} $1.object                 Whether or not it is an object
2692   *                                             format.
2693   * @param  {boolean} $1.boundaryClass          Whether or not to apply a boundary
2694   *                                             class.
2695   * @return {Object}                            Information to be used for
2696   *                                             element creation.
2697   */
2698  
2699  function fromFormat(_ref) {
2700    var type = _ref.type,
2701        attributes = _ref.attributes,
2702        unregisteredAttributes = _ref.unregisteredAttributes,
2703        object = _ref.object,
2704        boundaryClass = _ref.boundaryClass;
2705    var formatType = get_format_type_getFormatType(type);
2706    var elementAttributes = {};
2707  
2708    if (boundaryClass) {
2709      elementAttributes['data-rich-text-format-boundary'] = 'true';
2710    }
2711  
2712    if (!formatType) {
2713      if (attributes) {
2714        elementAttributes = to_tree_objectSpread(to_tree_objectSpread({}, attributes), elementAttributes);
2715      }
2716  
2717      return {
2718        type: type,
2719        attributes: elementAttributes,
2720        object: object
2721      };
2722    }
2723  
2724    elementAttributes = to_tree_objectSpread(to_tree_objectSpread({}, unregisteredAttributes), elementAttributes);
2725  
2726    for (var name in attributes) {
2727      var key = formatType.attributes ? formatType.attributes[name] : false;
2728  
2729      if (key) {
2730        elementAttributes[key] = attributes[name];
2731      } else {
2732        elementAttributes[name] = attributes[name];
2733      }
2734    }
2735  
2736    if (formatType.className) {
2737      if (elementAttributes.class) {
2738        elementAttributes.class = "".concat(formatType.className, " ").concat(elementAttributes.class);
2739      } else {
2740        elementAttributes.class = formatType.className;
2741      }
2742    }
2743  
2744    return {
2745      type: formatType.tagName,
2746      object: formatType.object,
2747      attributes: elementAttributes
2748    };
2749  }
2750  /**
2751   * Checks if both arrays of formats up until a certain index are equal.
2752   *
2753   * @param {Array}  a     Array of formats to compare.
2754   * @param {Array}  b     Array of formats to compare.
2755   * @param {number} index Index to check until.
2756   */
2757  
2758  
2759  function isEqualUntil(a, b, index) {
2760    do {
2761      if (a[index] !== b[index]) {
2762        return false;
2763      }
2764    } while (index--);
2765  
2766    return true;
2767  }
2768  
2769  function toTree(_ref2) {
2770    var value = _ref2.value,
2771        multilineTag = _ref2.multilineTag,
2772        preserveWhiteSpace = _ref2.preserveWhiteSpace,
2773        createEmpty = _ref2.createEmpty,
2774        append = _ref2.append,
2775        getLastChild = _ref2.getLastChild,
2776        getParent = _ref2.getParent,
2777        isText = _ref2.isText,
2778        getText = _ref2.getText,
2779        remove = _ref2.remove,
2780        appendText = _ref2.appendText,
2781        onStartIndex = _ref2.onStartIndex,
2782        onEndIndex = _ref2.onEndIndex,
2783        isEditableTree = _ref2.isEditableTree,
2784        placeholder = _ref2.placeholder;
2785    var formats = value.formats,
2786        replacements = value.replacements,
2787        text = value.text,
2788        start = value.start,
2789        end = value.end;
2790    var formatsLength = formats.length + 1;
2791    var tree = createEmpty();
2792    var multilineFormat = {
2793      type: multilineTag
2794    };
2795    var activeFormats = getActiveFormats(value);
2796    var deepestActiveFormat = activeFormats[activeFormats.length - 1];
2797    var lastSeparatorFormats;
2798    var lastCharacterFormats;
2799    var lastCharacter; // If we're building a multiline tree, start off with a multiline element.
2800  
2801    if (multilineTag) {
2802      append(append(tree, {
2803        type: multilineTag
2804      }), '');
2805      lastCharacterFormats = lastSeparatorFormats = [multilineFormat];
2806    } else {
2807      append(tree, '');
2808    }
2809  
2810    var _loop = function _loop(i) {
2811      var character = text.charAt(i);
2812      var shouldInsertPadding = isEditableTree && ( // Pad the line if the line is empty.
2813      !lastCharacter || lastCharacter === LINE_SEPARATOR || // Pad the line if the previous character is a line break, otherwise
2814      // the line break won't be visible.
2815      lastCharacter === '\n');
2816      var characterFormats = formats[i]; // Set multiline tags in queue for building the tree.
2817  
2818      if (multilineTag) {
2819        if (character === LINE_SEPARATOR) {
2820          characterFormats = lastSeparatorFormats = (replacements[i] || []).reduce(function (accumulator, format) {
2821            accumulator.push(format, multilineFormat);
2822            return accumulator;
2823          }, [multilineFormat]);
2824        } else {
2825          characterFormats = [].concat(Object(toConsumableArray["a" /* default */])(lastSeparatorFormats), Object(toConsumableArray["a" /* default */])(characterFormats || []));
2826        }
2827      }
2828  
2829      var pointer = getLastChild(tree);
2830  
2831      if (shouldInsertPadding && character === LINE_SEPARATOR) {
2832        var node = pointer;
2833  
2834        while (!isText(node)) {
2835          node = getLastChild(node);
2836        }
2837  
2838        append(getParent(node), ZWNBSP);
2839      } // Set selection for the start of line.
2840  
2841  
2842      if (lastCharacter === LINE_SEPARATOR) {
2843        var _node = pointer;
2844  
2845        while (!isText(_node)) {
2846          _node = getLastChild(_node);
2847        }
2848  
2849        if (onStartIndex && start === i) {
2850          onStartIndex(tree, _node);
2851        }
2852  
2853        if (onEndIndex && end === i) {
2854          onEndIndex(tree, _node);
2855        }
2856      }
2857  
2858      if (characterFormats) {
2859        characterFormats.forEach(function (format, formatIndex) {
2860          if (pointer && lastCharacterFormats && // Reuse the last element if all formats remain the same.
2861          isEqualUntil(characterFormats, lastCharacterFormats, formatIndex) && ( // Do not reuse the last element if the character is a
2862          // line separator.
2863          character !== LINE_SEPARATOR || characterFormats.length - 1 !== formatIndex)) {
2864            pointer = getLastChild(pointer);
2865            return;
2866          }
2867  
2868          var type = format.type,
2869              attributes = format.attributes,
2870              unregisteredAttributes = format.unregisteredAttributes;
2871          var boundaryClass = isEditableTree && character !== LINE_SEPARATOR && format === deepestActiveFormat;
2872          var parent = getParent(pointer);
2873          var newNode = append(parent, fromFormat({
2874            type: type,
2875            attributes: attributes,
2876            unregisteredAttributes: unregisteredAttributes,
2877            boundaryClass: boundaryClass
2878          }));
2879  
2880          if (isText(pointer) && getText(pointer).length === 0) {
2881            remove(pointer);
2882          }
2883  
2884          pointer = append(newNode, '');
2885        });
2886      } // No need for further processing if the character is a line separator.
2887  
2888  
2889      if (character === LINE_SEPARATOR) {
2890        lastCharacterFormats = characterFormats;
2891        lastCharacter = character;
2892        return "continue";
2893      } // If there is selection at 0, handle it before characters are inserted.
2894  
2895  
2896      if (i === 0) {
2897        if (onStartIndex && start === 0) {
2898          onStartIndex(tree, pointer);
2899        }
2900  
2901        if (onEndIndex && end === 0) {
2902          onEndIndex(tree, pointer);
2903        }
2904      }
2905  
2906      if (character === OBJECT_REPLACEMENT_CHARACTER) {
2907        pointer = append(getParent(pointer), fromFormat(to_tree_objectSpread(to_tree_objectSpread({}, replacements[i]), {}, {
2908          object: true
2909        }))); // Ensure pointer is text node.
2910  
2911        pointer = append(getParent(pointer), '');
2912      } else if (!preserveWhiteSpace && character === '\n') {
2913        pointer = append(getParent(pointer), {
2914          type: 'br',
2915          attributes: isEditableTree ? {
2916            'data-rich-text-line-break': 'true'
2917          } : undefined,
2918          object: true
2919        }); // Ensure pointer is text node.
2920  
2921        pointer = append(getParent(pointer), '');
2922      } else if (!isText(pointer)) {
2923        pointer = append(getParent(pointer), character);
2924      } else {
2925        appendText(pointer, character);
2926      }
2927  
2928      if (onStartIndex && start === i + 1) {
2929        onStartIndex(tree, pointer);
2930      }
2931  
2932      if (onEndIndex && end === i + 1) {
2933        onEndIndex(tree, pointer);
2934      }
2935  
2936      if (shouldInsertPadding && i === text.length) {
2937        append(getParent(pointer), ZWNBSP);
2938  
2939        if (placeholder && text.length === 0) {
2940          append(getParent(pointer), {
2941            type: 'span',
2942            attributes: {
2943              'data-rich-text-placeholder': placeholder,
2944              // Necessary to prevent the placeholder from catching
2945              // selection. The placeholder is also not editable after
2946              // all.
2947              contenteditable: 'false',
2948              style: 'pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;'
2949            }
2950          });
2951        }
2952      }
2953  
2954      lastCharacterFormats = characterFormats;
2955      lastCharacter = character;
2956    };
2957  
2958    for (var i = 0; i < formatsLength; i++) {
2959      var _ret = _loop(i);
2960  
2961      if (_ret === "continue") continue;
2962    }
2963  
2964    return tree;
2965  }
2966  
2967  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-dom.js
2968  
2969  
2970  
2971  function to_dom_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2972  
2973  function to_dom_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { to_dom_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { to_dom_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2974  
2975  /**
2976   * Internal dependencies
2977   */
2978  
2979  
2980  /** @typedef {import('./create').RichTextValue} RichTextValue */
2981  
2982  /**
2983   * Creates a path as an array of indices from the given root node to the given
2984   * node.
2985   *
2986   * @param {Node}        node     Node to find the path of.
2987   * @param {HTMLElement} rootNode Root node to find the path from.
2988   * @param {Array}       path     Initial path to build on.
2989   *
2990   * @return {Array} The path from the root node to the node.
2991   */
2992  
2993  function createPathToNode(node, rootNode, path) {
2994    var parentNode = node.parentNode;
2995    var i = 0;
2996  
2997    while (node = node.previousSibling) {
2998      i++;
2999    }
3000  
3001    path = [i].concat(Object(toConsumableArray["a" /* default */])(path));
3002  
3003    if (parentNode !== rootNode) {
3004      path = createPathToNode(parentNode, rootNode, path);
3005    }
3006  
3007    return path;
3008  }
3009  /**
3010   * Gets a node given a path (array of indices) from the given node.
3011   *
3012   * @param {HTMLElement} node Root node to find the wanted node in.
3013   * @param {Array}       path Path (indices) to the wanted node.
3014   *
3015   * @return {Object} Object with the found node and the remaining offset (if any).
3016   */
3017  
3018  
3019  function getNodeByPath(node, path) {
3020    path = Object(toConsumableArray["a" /* default */])(path);
3021  
3022    while (node && path.length > 1) {
3023      node = node.childNodes[path.shift()];
3024    }
3025  
3026    return {
3027      node: node,
3028      offset: path[0]
3029    };
3030  }
3031  
3032  function to_dom_append(element, child) {
3033    if (typeof child === 'string') {
3034      child = element.ownerDocument.createTextNode(child);
3035    }
3036  
3037    var _child = child,
3038        type = _child.type,
3039        attributes = _child.attributes;
3040  
3041    if (type) {
3042      child = element.ownerDocument.createElement(type);
3043  
3044      for (var key in attributes) {
3045        child.setAttribute(key, attributes[key]);
3046      }
3047    }
3048  
3049    return element.appendChild(child);
3050  }
3051  
3052  function to_dom_appendText(node, text) {
3053    node.appendData(text);
3054  }
3055  
3056  function to_dom_getLastChild(_ref) {
3057    var lastChild = _ref.lastChild;
3058    return lastChild;
3059  }
3060  
3061  function to_dom_getParent(_ref2) {
3062    var parentNode = _ref2.parentNode;
3063    return parentNode;
3064  }
3065  
3066  function to_dom_isText(node) {
3067    return node.nodeType === node.TEXT_NODE;
3068  }
3069  
3070  function to_dom_getText(_ref3) {
3071    var nodeValue = _ref3.nodeValue;
3072    return nodeValue;
3073  }
3074  
3075  function to_dom_remove(node) {
3076    return node.parentNode.removeChild(node);
3077  }
3078  
3079  function toDom(_ref4) {
3080    var value = _ref4.value,
3081        multilineTag = _ref4.multilineTag,
3082        prepareEditableTree = _ref4.prepareEditableTree,
3083        _ref4$isEditableTree = _ref4.isEditableTree,
3084        isEditableTree = _ref4$isEditableTree === void 0 ? true : _ref4$isEditableTree,
3085        placeholder = _ref4.placeholder,
3086        _ref4$doc = _ref4.doc,
3087        doc = _ref4$doc === void 0 ? document : _ref4$doc;
3088    var startPath = [];
3089    var endPath = [];
3090  
3091    if (prepareEditableTree) {
3092      value = to_dom_objectSpread(to_dom_objectSpread({}, value), {}, {
3093        formats: prepareEditableTree(value)
3094      });
3095    }
3096    /**
3097     * Returns a new instance of a DOM tree upon which RichText operations can be
3098     * applied.
3099     *
3100     * Note: The current implementation will return a shared reference, reset on
3101     * each call to `createEmpty`. Therefore, you should not hold a reference to
3102     * the value to operate upon asynchronously, as it may have unexpected results.
3103     *
3104     * @return {Object} RichText tree.
3105     */
3106  
3107  
3108    var createEmpty = function createEmpty() {
3109      return createElement(doc, '');
3110    };
3111  
3112    var tree = toTree({
3113      value: value,
3114      multilineTag: multilineTag,
3115      createEmpty: createEmpty,
3116      append: to_dom_append,
3117      getLastChild: to_dom_getLastChild,
3118      getParent: to_dom_getParent,
3119      isText: to_dom_isText,
3120      getText: to_dom_getText,
3121      remove: to_dom_remove,
3122      appendText: to_dom_appendText,
3123      onStartIndex: function onStartIndex(body, pointer) {
3124        startPath = createPathToNode(pointer, body, [pointer.nodeValue.length]);
3125      },
3126      onEndIndex: function onEndIndex(body, pointer) {
3127        endPath = createPathToNode(pointer, body, [pointer.nodeValue.length]);
3128      },
3129      isEditableTree: isEditableTree,
3130      placeholder: placeholder
3131    });
3132    return {
3133      body: tree,
3134      selection: {
3135        startPath: startPath,
3136        endPath: endPath
3137      }
3138    };
3139  }
3140  /**
3141   * Create an `Element` tree from a Rich Text value and applies the difference to
3142   * the `Element` tree contained by `current`. If a `multilineTag` is provided,
3143   * text separated by two new lines will be wrapped in an `Element` of that type.
3144   *
3145   * @param {Object}        $1                       Named arguments.
3146   * @param {RichTextValue} $1.value                 Value to apply.
3147   * @param {HTMLElement}   $1.current               The live root node to apply the element tree to.
3148   * @param {string}        [$1.multilineTag]        Multiline tag.
3149   * @param {Function}      [$1.prepareEditableTree] Function to filter editorable formats.
3150   * @param {boolean}       [$1.__unstableDomOnly]   Only apply elements, no selection.
3151   * @param {string}        [$1.placeholder]         Placeholder text.
3152   */
3153  
3154  function apply(_ref5) {
3155    var value = _ref5.value,
3156        current = _ref5.current,
3157        multilineTag = _ref5.multilineTag,
3158        prepareEditableTree = _ref5.prepareEditableTree,
3159        __unstableDomOnly = _ref5.__unstableDomOnly,
3160        placeholder = _ref5.placeholder;
3161  
3162    // Construct a new element tree in memory.
3163    var _toDom = toDom({
3164      value: value,
3165      multilineTag: multilineTag,
3166      prepareEditableTree: prepareEditableTree,
3167      placeholder: placeholder,
3168      doc: current.ownerDocument
3169    }),
3170        body = _toDom.body,
3171        selection = _toDom.selection;
3172  
3173    applyValue(body, current);
3174  
3175    if (value.start !== undefined && !__unstableDomOnly) {
3176      applySelection(selection, current);
3177    }
3178  }
3179  function applyValue(future, current) {
3180    var i = 0;
3181    var futureChild;
3182  
3183    while (futureChild = future.firstChild) {
3184      var currentChild = current.childNodes[i];
3185  
3186      if (!currentChild) {
3187        current.appendChild(futureChild);
3188      } else if (!currentChild.isEqualNode(futureChild)) {
3189        if (currentChild.nodeName !== futureChild.nodeName || currentChild.nodeType === currentChild.TEXT_NODE && currentChild.data !== futureChild.data) {
3190          current.replaceChild(futureChild, currentChild);
3191        } else {
3192          var currentAttributes = currentChild.attributes;
3193          var futureAttributes = futureChild.attributes;
3194  
3195          if (currentAttributes) {
3196            var ii = currentAttributes.length; // Reverse loop because `removeAttribute` on `currentChild`
3197            // changes `currentAttributes`.
3198  
3199            while (ii--) {
3200              var name = currentAttributes[ii].name;
3201  
3202              if (!futureChild.getAttribute(name)) {
3203                currentChild.removeAttribute(name);
3204              }
3205            }
3206          }
3207  
3208          if (futureAttributes) {
3209            for (var _ii = 0; _ii < futureAttributes.length; _ii++) {
3210              var _futureAttributes$_ii = futureAttributes[_ii],
3211                  _name = _futureAttributes$_ii.name,
3212                  value = _futureAttributes$_ii.value;
3213  
3214              if (currentChild.getAttribute(_name) !== value) {
3215                currentChild.setAttribute(_name, value);
3216              }
3217            }
3218          }
3219  
3220          applyValue(futureChild, currentChild);
3221          future.removeChild(futureChild);
3222        }
3223      } else {
3224        future.removeChild(futureChild);
3225      }
3226  
3227      i++;
3228    }
3229  
3230    while (current.childNodes[i]) {
3231      current.removeChild(current.childNodes[i]);
3232    }
3233  }
3234  /**
3235   * Returns true if two ranges are equal, or false otherwise. Ranges are
3236   * considered equal if their start and end occur in the same container and
3237   * offset.
3238   *
3239   * @param {Range} a First range object to test.
3240   * @param {Range} b First range object to test.
3241   *
3242   * @return {boolean} Whether the two ranges are equal.
3243   */
3244  
3245  function isRangeEqual(a, b) {
3246    return a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset;
3247  }
3248  
3249  function applySelection(_ref6, current) {
3250    var startPath = _ref6.startPath,
3251        endPath = _ref6.endPath;
3252  
3253    var _getNodeByPath = getNodeByPath(current, startPath),
3254        startContainer = _getNodeByPath.node,
3255        startOffset = _getNodeByPath.offset;
3256  
3257    var _getNodeByPath2 = getNodeByPath(current, endPath),
3258        endContainer = _getNodeByPath2.node,
3259        endOffset = _getNodeByPath2.offset;
3260  
3261    var ownerDocument = current.ownerDocument;
3262    var defaultView = ownerDocument.defaultView;
3263    var selection = defaultView.getSelection();
3264    var range = ownerDocument.createRange();
3265    range.setStart(startContainer, startOffset);
3266    range.setEnd(endContainer, endOffset);
3267    var activeElement = ownerDocument.activeElement;
3268  
3269    if (selection.rangeCount > 0) {
3270      // If the to be added range and the live range are the same, there's no
3271      // need to remove the live range and add the equivalent range.
3272      if (isRangeEqual(range, selection.getRangeAt(0))) {
3273        return;
3274      }
3275  
3276      selection.removeAllRanges();
3277    }
3278  
3279    selection.addRange(range); // This function is not intended to cause a shift in focus. Since the above
3280    // selection manipulations may shift focus, ensure that focus is restored to
3281    // its previous state.
3282  
3283    if (activeElement !== ownerDocument.activeElement) {
3284      // The `instanceof` checks protect against edge cases where the focused
3285      // element is not of the interface HTMLElement (does not have a `focus`
3286      // or `blur` property).
3287      //
3288      // See: https://github.com/Microsoft/TypeScript/issues/5901#issuecomment-431649653
3289      if (activeElement instanceof defaultView.HTMLElement) {
3290        activeElement.focus();
3291      }
3292    }
3293  }
3294  
3295  // EXTERNAL MODULE: external ["wp","escapeHtml"]
3296  var external_wp_escapeHtml_ = __webpack_require__(105);
3297  
3298  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-html-string.js
3299  /**
3300   * WordPress dependencies
3301   */
3302  
3303  /**
3304   * Internal dependencies
3305   */
3306  
3307  
3308  /** @typedef {import('./create').RichTextValue} RichTextValue */
3309  
3310  /**
3311   * Create an HTML string from a Rich Text value. If a `multilineTag` is
3312   * provided, text separated by a line separator will be wrapped in it.
3313   *
3314   * @param {Object}        $1                      Named argements.
3315   * @param {RichTextValue} $1.value                Rich text value.
3316   * @param {string}        [$1.multilineTag]       Multiline tag.
3317   * @param {boolean}       [$1.preserveWhiteSpace] Whether or not to use newline
3318   *                                                characters for line breaks.
3319   *
3320   * @return {string} HTML string.
3321   */
3322  
3323  function toHTMLString(_ref) {
3324    var value = _ref.value,
3325        multilineTag = _ref.multilineTag,
3326        preserveWhiteSpace = _ref.preserveWhiteSpace;
3327    var tree = toTree({
3328      value: value,
3329      multilineTag: multilineTag,
3330      preserveWhiteSpace: preserveWhiteSpace,
3331      createEmpty: to_html_string_createEmpty,
3332      append: to_html_string_append,
3333      getLastChild: to_html_string_getLastChild,
3334      getParent: to_html_string_getParent,
3335      isText: to_html_string_isText,
3336      getText: to_html_string_getText,
3337      remove: to_html_string_remove,
3338      appendText: to_html_string_appendText
3339    });
3340    return createChildrenHTML(tree.children);
3341  }
3342  
3343  function to_html_string_createEmpty() {
3344    return {};
3345  }
3346  
3347  function to_html_string_getLastChild(_ref2) {
3348    var children = _ref2.children;
3349    return children && children[children.length - 1];
3350  }
3351  
3352  function to_html_string_append(parent, object) {
3353    if (typeof object === 'string') {
3354      object = {
3355        text: object
3356      };
3357    }
3358  
3359    object.parent = parent;
3360    parent.children = parent.children || [];
3361    parent.children.push(object);
3362    return object;
3363  }
3364  
3365  function to_html_string_appendText(object, text) {
3366    object.text += text;
3367  }
3368  
3369  function to_html_string_getParent(_ref3) {
3370    var parent = _ref3.parent;
3371    return parent;
3372  }
3373  
3374  function to_html_string_isText(_ref4) {
3375    var text = _ref4.text;
3376    return typeof text === 'string';
3377  }
3378  
3379  function to_html_string_getText(_ref5) {
3380    var text = _ref5.text;
3381    return text;
3382  }
3383  
3384  function to_html_string_remove(object) {
3385    var index = object.parent.children.indexOf(object);
3386  
3387    if (index !== -1) {
3388      object.parent.children.splice(index, 1);
3389    }
3390  
3391    return object;
3392  }
3393  
3394  function createElementHTML(_ref6) {
3395    var type = _ref6.type,
3396        attributes = _ref6.attributes,
3397        object = _ref6.object,
3398        children = _ref6.children;
3399    var attributeString = '';
3400  
3401    for (var key in attributes) {
3402      if (!Object(external_wp_escapeHtml_["isValidAttributeName"])(key)) {
3403        continue;
3404      }
3405  
3406      attributeString += " ".concat(key, "=\"").concat(Object(external_wp_escapeHtml_["escapeAttribute"])(attributes[key]), "\"");
3407    }
3408  
3409    if (object) {
3410      return "<".concat(type).concat(attributeString, ">");
3411    }
3412  
3413    return "<".concat(type).concat(attributeString, ">").concat(createChildrenHTML(children), "</").concat(type, ">");
3414  }
3415  
3416  function createChildrenHTML() {
3417    var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3418    return children.map(function (child) {
3419      return child.text === undefined ? createElementHTML(child) : Object(external_wp_escapeHtml_["escapeEditableHTML"])(child.text);
3420    }).join('');
3421  }
3422  
3423  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/toggle-format.js
3424  /**
3425   * Internal dependencies
3426   */
3427  
3428  
3429  
3430  /** @typedef {import('./create').RichTextValue} RichTextValue */
3431  
3432  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
3433  
3434  /**
3435   * Toggles a format object to a Rich Text value at the current selection.
3436   *
3437   * @param {RichTextValue}  value  Value to modify.
3438   * @param {RichTextFormat} format Format to apply or remove.
3439   *
3440   * @return {RichTextValue} A new value with the format applied or removed.
3441   */
3442  
3443  function toggleFormat(value, format) {
3444    if (getActiveFormat(value, format.type)) {
3445      return removeFormat(value, format.type);
3446    }
3447  
3448    return applyFormat(value, format);
3449  }
3450  
3451  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/unregister-format-type.js
3452  /**
3453   * WordPress dependencies
3454   */
3455  
3456  /**
3457   * Internal dependencies
3458   */
3459  
3460  
3461  /** @typedef {import('./register-format-type').RichTextFormatType} RichTextFormatType */
3462  
3463  /**
3464   * Unregisters a format.
3465   *
3466   * @param {string} name Format name.
3467   *
3468   * @return {RichTextFormatType|undefined} The previous format value, if it has
3469   *                                        been successfully unregistered;
3470   *                                        otherwise `undefined`.
3471   */
3472  
3473  function unregisterFormatType(name) {
3474    var oldFormat = Object(external_wp_data_["select"])(store).getFormatType(name);
3475  
3476    if (!oldFormat) {
3477      window.console.error("Format ".concat(name, " is not registered."));
3478      return;
3479    }
3480  
3481    Object(external_wp_data_["dispatch"])(store).removeFormatTypes(name);
3482    return oldFormat;
3483  }
3484  
3485  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/can-indent-list-items.js
3486  /**
3487   * Internal dependencies
3488   */
3489  
3490  /** @typedef {import('./create').RichTextValue} RichTextValue */
3491  
3492  /**
3493   * Checks if the selected list item can be indented.
3494   *
3495   * @param {RichTextValue} value Value to check.
3496   *
3497   * @return {boolean} Whether or not the selected list item can be indented.
3498   */
3499  
3500  function canIndentListItems(value) {
3501    var lineIndex = getLineIndex(value); // There is only one line, so the line cannot be indented.
3502  
3503    if (lineIndex === undefined) {
3504      return false;
3505    }
3506  
3507    var replacements = value.replacements;
3508    var previousLineIndex = getLineIndex(value, lineIndex);
3509    var formatsAtLineIndex = replacements[lineIndex] || [];
3510    var formatsAtPreviousLineIndex = replacements[previousLineIndex] || []; // If the indentation of the current line is greater than previous line,
3511    // then the line cannot be furter indented.
3512  
3513    return formatsAtLineIndex.length <= formatsAtPreviousLineIndex.length;
3514  }
3515  
3516  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/can-outdent-list-items.js
3517  /**
3518   * Internal dependencies
3519   */
3520  
3521  /** @typedef {import('./create').RichTextValue} RichTextValue */
3522  
3523  /**
3524   * Checks if the selected list item can be outdented.
3525   *
3526   * @param {RichTextValue} value Value to check.
3527   *
3528   * @return {boolean} Whether or not the selected list item can be outdented.
3529   */
3530  
3531  function canOutdentListItems(value) {
3532    var replacements = value.replacements,
3533        start = value.start;
3534    var startingLineIndex = getLineIndex(value, start);
3535    return replacements[startingLineIndex] !== undefined;
3536  }
3537  
3538  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/indent-list-items.js
3539  
3540  
3541  function indent_list_items_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
3542  
3543  function indent_list_items_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { indent_list_items_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { indent_list_items_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3544  
3545  /**
3546   * Internal dependencies
3547   */
3548  
3549  
3550  
3551  /** @typedef {import('./create').RichTextValue} RichTextValue */
3552  
3553  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
3554  
3555  /**
3556   * Gets the line index of the first previous list item with higher indentation.
3557   *
3558   * @param {RichTextValue} value      Value to search.
3559   * @param {number}        lineIndex  Line index of the list item to compare
3560   *                                   with.
3561   *
3562   * @return {number|void} The line index.
3563   */
3564  
3565  function getTargetLevelLineIndex(_ref, lineIndex) {
3566    var text = _ref.text,
3567        replacements = _ref.replacements;
3568    var startFormats = replacements[lineIndex] || [];
3569    var index = lineIndex;
3570  
3571    while (index-- >= 0) {
3572      if (text[index] !== LINE_SEPARATOR) {
3573        continue;
3574      }
3575  
3576      var formatsAtIndex = replacements[index] || []; // Return the first line index that is one level higher. If the level is
3577      // lower or equal, there is no result.
3578  
3579      if (formatsAtIndex.length === startFormats.length + 1) {
3580        return index;
3581      } else if (formatsAtIndex.length <= startFormats.length) {
3582        return;
3583      }
3584    }
3585  }
3586  /**
3587   * Indents any selected list items if possible.
3588   *
3589   * @param {RichTextValue}  value      Value to change.
3590   * @param {RichTextFormat} rootFormat Root format.
3591   *
3592   * @return {RichTextValue} The changed value.
3593   */
3594  
3595  
3596  function indentListItems(value, rootFormat) {
3597    if (!canIndentListItems(value)) {
3598      return value;
3599    }
3600  
3601    var lineIndex = getLineIndex(value);
3602    var previousLineIndex = getLineIndex(value, lineIndex);
3603    var text = value.text,
3604        replacements = value.replacements,
3605        end = value.end;
3606    var newFormats = replacements.slice();
3607    var targetLevelLineIndex = getTargetLevelLineIndex(value, lineIndex);
3608  
3609    for (var index = lineIndex; index < end; index++) {
3610      if (text[index] !== LINE_SEPARATOR) {
3611        continue;
3612      } // Get the previous list, and if there's a child list, take over the
3613      // formats. If not, duplicate the last level and create a new level.
3614  
3615  
3616      if (targetLevelLineIndex) {
3617        var targetFormats = replacements[targetLevelLineIndex] || [];
3618        newFormats[index] = targetFormats.concat((newFormats[index] || []).slice(targetFormats.length - 1));
3619      } else {
3620        var _targetFormats = replacements[previousLineIndex] || [];
3621  
3622        var lastformat = _targetFormats[_targetFormats.length - 1] || rootFormat;
3623        newFormats[index] = _targetFormats.concat([lastformat], (newFormats[index] || []).slice(_targetFormats.length));
3624      }
3625    }
3626  
3627    return indent_list_items_objectSpread(indent_list_items_objectSpread({}, value), {}, {
3628      replacements: newFormats
3629    });
3630  }
3631  
3632  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-parent-line-index.js
3633  /**
3634   * Internal dependencies
3635   */
3636  
3637  /** @typedef {import('./create').RichTextValue} RichTextValue */
3638  
3639  /**
3640   * Gets the index of the first parent list. To get the parent list formats, we
3641   * go through every list item until we find one with exactly one format type
3642   * less.
3643   *
3644   * @param {RichTextValue} value     Value to search.
3645   * @param {number}        lineIndex Line index of a child list item.
3646   *
3647   * @return {number|void} The parent list line index.
3648   */
3649  
3650  function getParentLineIndex(_ref, lineIndex) {
3651    var text = _ref.text,
3652        replacements = _ref.replacements;
3653    var startFormats = replacements[lineIndex] || [];
3654    var index = lineIndex;
3655  
3656    while (index-- >= 0) {
3657      if (text[index] !== LINE_SEPARATOR) {
3658        continue;
3659      }
3660  
3661      var formatsAtIndex = replacements[index] || [];
3662  
3663      if (formatsAtIndex.length === startFormats.length - 1) {
3664        return index;
3665      }
3666    }
3667  }
3668  
3669  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-last-child-index.js
3670  /**
3671   * Internal dependencies
3672   */
3673  
3674  /** @typedef {import('./create').RichTextValue} RichTextValue */
3675  
3676  /**
3677   * Gets the line index of the last child in the list.
3678   *
3679   * @param {RichTextValue} value     Value to search.
3680   * @param {number}        lineIndex Line index of a list item in the list.
3681   *
3682   * @return {number} The index of the last child.
3683   */
3684  
3685  function getLastChildIndex(_ref, lineIndex) {
3686    var text = _ref.text,
3687        replacements = _ref.replacements;
3688    var lineFormats = replacements[lineIndex] || []; // Use the given line index in case there are no next children.
3689  
3690    var childIndex = lineIndex; // `lineIndex` could be `undefined` if it's the first line.
3691  
3692    for (var index = lineIndex || 0; index < text.length; index++) {
3693      // We're only interested in line indices.
3694      if (text[index] !== LINE_SEPARATOR) {
3695        continue;
3696      }
3697  
3698      var formatsAtIndex = replacements[index] || []; // If the amout of formats is equal or more, store it, then return the
3699      // last one if the amount of formats is less.
3700  
3701      if (formatsAtIndex.length >= lineFormats.length) {
3702        childIndex = index;
3703      } else {
3704        return childIndex;
3705      }
3706    } // If the end of the text is reached, return the last child index.
3707  
3708  
3709    return childIndex;
3710  }
3711  
3712  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/outdent-list-items.js
3713  
3714  
3715  function outdent_list_items_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
3716  
3717  function outdent_list_items_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { outdent_list_items_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { outdent_list_items_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3718  
3719  /**
3720   * Internal dependencies
3721   */
3722  
3723  
3724  
3725  
3726  
3727  /** @typedef {import('./create').RichTextValue} RichTextValue */
3728  
3729  /**
3730   * Outdents any selected list items if possible.
3731   *
3732   * @param {RichTextValue} value Value to change.
3733   *
3734   * @return {RichTextValue} The changed value.
3735   */
3736  
3737  function outdentListItems(value) {
3738    if (!canOutdentListItems(value)) {
3739      return value;
3740    }
3741  
3742    var text = value.text,
3743        replacements = value.replacements,
3744        start = value.start,
3745        end = value.end;
3746    var startingLineIndex = getLineIndex(value, start);
3747    var newFormats = replacements.slice(0);
3748    var parentFormats = replacements[getParentLineIndex(value, startingLineIndex)] || [];
3749    var endingLineIndex = getLineIndex(value, end);
3750    var lastChildIndex = getLastChildIndex(value, endingLineIndex); // Outdent all list items from the starting line index until the last child
3751    // index of the ending list. All children of the ending list need to be
3752    // outdented, otherwise they'll be orphaned.
3753  
3754    for (var index = startingLineIndex; index <= lastChildIndex; index++) {
3755      // Skip indices that are not line separators.
3756      if (text[index] !== LINE_SEPARATOR) {
3757        continue;
3758      } // In the case of level 0, the formats at the index are undefined.
3759  
3760  
3761      var currentFormats = newFormats[index] || []; // Omit the indentation level where the selection starts.
3762  
3763      newFormats[index] = parentFormats.concat(currentFormats.slice(parentFormats.length + 1));
3764  
3765      if (newFormats[index].length === 0) {
3766        delete newFormats[index];
3767      }
3768    }
3769  
3770    return outdent_list_items_objectSpread(outdent_list_items_objectSpread({}, value), {}, {
3771      replacements: newFormats
3772    });
3773  }
3774  
3775  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/change-list-type.js
3776  
3777  
3778  function change_list_type_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
3779  
3780  function change_list_type_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { change_list_type_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { change_list_type_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3781  
3782  /**
3783   * Internal dependencies
3784   */
3785  
3786  
3787  
3788  /** @typedef {import('./create').RichTextValue} RichTextValue */
3789  
3790  /** @typedef {import('./create').RichTextFormat} RichTextFormat */
3791  
3792  /**
3793   * Changes the list type of the selected indented list, if any. Looks at the
3794   * currently selected list item and takes the parent list, then changes the list
3795   * type of this list. When multiple lines are selected, the parent lists are
3796   * takes and changed.
3797   *
3798   * @param {RichTextValue}  value     Value to change.
3799   * @param {RichTextFormat} newFormat The new list format object. Choose between
3800   *                                   `{ type: 'ol' }` and `{ type: 'ul' }`.
3801   *
3802   * @return {RichTextValue} The changed value.
3803   */
3804  
3805  function changeListType(value, newFormat) {
3806    var text = value.text,
3807        replacements = value.replacements,
3808        start = value.start,
3809        end = value.end;
3810    var startingLineIndex = getLineIndex(value, start);
3811    var startLineFormats = replacements[startingLineIndex] || [];
3812    var endLineFormats = replacements[getLineIndex(value, end)] || [];
3813    var startIndex = getParentLineIndex(value, startingLineIndex);
3814    var newReplacements = replacements.slice();
3815    var startCount = startLineFormats.length - 1;
3816    var endCount = endLineFormats.length - 1;
3817    var changed;
3818  
3819    for (var index = startIndex + 1 || 0; index < text.length; index++) {
3820      if (text[index] !== LINE_SEPARATOR) {
3821        continue;
3822      }
3823  
3824      if ((newReplacements[index] || []).length <= startCount) {
3825        break;
3826      }
3827  
3828      if (!newReplacements[index]) {
3829        continue;
3830      }
3831  
3832      changed = true;
3833      newReplacements[index] = newReplacements[index].map(function (format, i) {
3834        return i < startCount || i > endCount ? format : newFormat;
3835      });
3836    }
3837  
3838    if (!changed) {
3839      return value;
3840    }
3841  
3842    return change_list_type_objectSpread(change_list_type_objectSpread({}, value), {}, {
3843      replacements: newReplacements
3844    });
3845  }
3846  
3847  // EXTERNAL MODULE: external ["wp","element"]
3848  var external_wp_element_ = __webpack_require__(0);
3849  
3850  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-anchor-ref.js
3851  /**
3852   * WordPress dependencies
3853   */
3854  
3855  /**
3856   * Internal dependencies
3857   */
3858  
3859  
3860  /** @typedef {import('@wordpress/element').RefObject} RefObject */
3861  
3862  /** @typedef {import('../register-format-type').RichTextFormatType} RichTextFormatType */
3863  
3864  /** @typedef {import('../create').RichTextValue} RichTextValue */
3865  
3866  /**
3867   * This hook, to be used in a format type's Edit component, returns the active
3868   * element that is formatted, or the selection range if no format is active.
3869   * The returned value is meant to be used for positioning UI, e.g. by passing it
3870   * to the `Popover` component.
3871   *
3872   * @param {Object}                 $1          Named parameters.
3873   * @param {RefObject<HTMLElement>} $1.ref      React ref of the element
3874   *                                             containing  the editable content.
3875   * @param {RichTextValue}          $1.value    Value to check for selection.
3876   * @param {RichTextFormatType}     $1.settings The format type's settings.
3877   *
3878   * @return {Element|Range} The active element or selection range.
3879   */
3880  
3881  function useAnchorRef(_ref) {
3882    var ref = _ref.ref,
3883        value = _ref.value,
3884        _ref$settings = _ref.settings,
3885        settings = _ref$settings === void 0 ? {} : _ref$settings;
3886    var tagName = settings.tagName,
3887        className = settings.className,
3888        name = settings.name;
3889    var activeFormat = name ? getActiveFormat(value, name) : undefined;
3890    return Object(external_wp_element_["useMemo"])(function () {
3891      if (!ref.current) return;
3892      var defaultView = ref.current.ownerDocument.defaultView;
3893      var selection = defaultView.getSelection();
3894  
3895      if (!selection.rangeCount) {
3896        return;
3897      }
3898  
3899      var range = selection.getRangeAt(0);
3900  
3901      if (!activeFormat) {
3902        return range;
3903      }
3904  
3905      var element = range.startContainer; // If the caret is right before the element, select the next element.
3906  
3907      element = element.nextElementSibling || element;
3908  
3909      while (element.nodeType !== element.ELEMENT_NODE) {
3910        element = element.parentNode;
3911      }
3912  
3913      return element.closest(tagName + (className ? '.' + className : ''));
3914    }, [activeFormat, value.start, value.end, tagName, className]);
3915  }
3916  
3917  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
3918  var slicedToArray = __webpack_require__(12);
3919  
3920  // EXTERNAL MODULE: external ["wp","keycodes"]
3921  var external_wp_keycodes_ = __webpack_require__(17);
3922  
3923  // EXTERNAL MODULE: external ["wp","dom"]
3924  var external_wp_dom_ = __webpack_require__(27);
3925  
3926  // EXTERNAL MODULE: external ["wp","compose"]
3927  var external_wp_compose_ = __webpack_require__(11);
3928  
3929  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/format-edit.js
3930  
3931  
3932  /**
3933   * Internal dependencies
3934   */
3935  
3936  
3937  function FormatEdit(_ref) {
3938    var formatTypes = _ref.formatTypes,
3939        onChange = _ref.onChange,
3940        onFocus = _ref.onFocus,
3941        value = _ref.value,
3942        forwardedRef = _ref.forwardedRef;
3943    return formatTypes.map(function (settings) {
3944      var name = settings.name,
3945          Edit = settings.edit;
3946  
3947      if (!Edit) {
3948        return null;
3949      }
3950  
3951      var activeFormat = getActiveFormat(value, name);
3952      var isActive = activeFormat !== undefined;
3953      var activeObject = getActiveObject(value);
3954      var isObjectActive = activeObject !== undefined && activeObject.type === name;
3955      return Object(external_wp_element_["createElement"])(Edit, {
3956        key: name,
3957        isActive: isActive,
3958        activeAttributes: isActive ? activeFormat.attributes || {} : {},
3959        isObjectActive: isObjectActive,
3960        activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {},
3961        value: value,
3962        onChange: onChange,
3963        onFocus: onFocus,
3964        contentRef: forwardedRef
3965      });
3966    });
3967  }
3968  
3969  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/update-formats.js
3970  /**
3971   * Internal dependencies
3972   */
3973  
3974  /** @typedef {import('./create').RichTextValue} RichTextValue */
3975  
3976  /**
3977   * Efficiently updates all the formats from `start` (including) until `end`
3978   * (excluding) with the active formats. Mutates `value`.
3979   *
3980   * @param  {Object}        $1         Named paramentes.
3981   * @param  {RichTextValue} $1.value   Value te update.
3982   * @param  {number}        $1.start   Index to update from.
3983   * @param  {number}        $1.end     Index to update until.
3984   * @param  {Array}         $1.formats Replacement formats.
3985   *
3986   * @return {RichTextValue} Mutated value.
3987   */
3988  
3989  function updateFormats(_ref) {
3990    var value = _ref.value,
3991        start = _ref.start,
3992        end = _ref.end,
3993        formats = _ref.formats;
3994    var formatsBefore = value.formats[start - 1] || [];
3995    var formatsAfter = value.formats[end] || []; // First, fix the references. If any format right before or after are
3996    // equal, the replacement format should use the same reference.
3997  
3998    value.activeFormats = formats.map(function (format, index) {
3999      if (formatsBefore[index]) {
4000        if (isFormatEqual(format, formatsBefore[index])) {
4001          return formatsBefore[index];
4002        }
4003      } else if (formatsAfter[index]) {
4004        if (isFormatEqual(format, formatsAfter[index])) {
4005          return formatsAfter[index];
4006        }
4007      }
4008  
4009      return format;
4010    });
4011  
4012    while (--end >= start) {
4013      if (value.activeFormats.length > 0) {
4014        value.formats[end] = value.activeFormats;
4015      } else {
4016        delete value.formats[end];
4017      }
4018    }
4019  
4020    return value;
4021  }
4022  
4023  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-format-types.js
4024  
4025  
4026  function use_format_types_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4027  
4028  function use_format_types_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { use_format_types_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { use_format_types_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4029  
4030  /**
4031   * WordPress dependencies
4032   */
4033  
4034  
4035  /**
4036   * Internal dependencies
4037   */
4038  
4039  
4040  
4041  function formatTypesSelector(select) {
4042    return select(store).getFormatTypes();
4043  }
4044  /**
4045   * Set of all interactive content tags.
4046   *
4047   * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content
4048   */
4049  
4050  
4051  var interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']);
4052  /**
4053   * This hook provides RichText with the `formatTypes` and its derived props from
4054   * experimental format type settings.
4055   *
4056   * @param {Object} $0                               Options
4057   * @param {string} $0.clientId                      Block client ID.
4058   * @param {string} $0.identifier                    Block attribute.
4059   * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formattings or not.
4060   * @param {Array} $0.allowedFormats                 Allowed formats
4061   */
4062  
4063  function useFormatTypes(_ref) {
4064    var clientId = _ref.clientId,
4065        identifier = _ref.identifier,
4066        withoutInteractiveFormatting = _ref.withoutInteractiveFormatting,
4067        allowedFormats = _ref.allowedFormats;
4068    var allFormatTypes = Object(external_wp_data_["useSelect"])(formatTypesSelector, []);
4069    var formatTypes = Object(external_wp_element_["useMemo"])(function () {
4070      return allFormatTypes.filter(function (_ref2) {
4071        var name = _ref2.name,
4072            tagName = _ref2.tagName;
4073  
4074        if (allowedFormats && !allowedFormats.includes(name)) {
4075          return false;
4076        }
4077  
4078        if (withoutInteractiveFormatting && interactiveContentTags.has(tagName)) {
4079          return false;
4080        }
4081  
4082        return true;
4083      });
4084    }, [allFormatTypes, allowedFormats, interactiveContentTags]);
4085    var keyedSelected = Object(external_wp_data_["useSelect"])(function (select) {
4086      return formatTypes.reduce(function (accumulator, type) {
4087        if (type.__experimentalGetPropsForEditableTreePreparation) {
4088          accumulator[type.name] = type.__experimentalGetPropsForEditableTreePreparation(select, {
4089            richTextIdentifier: identifier,
4090            blockClientId: clientId
4091          });
4092        }
4093  
4094        return accumulator;
4095      }, {});
4096    }, [formatTypes, clientId, identifier]);
4097    var dispatch = Object(external_wp_data_["useDispatch"])();
4098    var prepareHandlers = [];
4099    var valueHandlers = [];
4100    var changeHandlers = [];
4101    var dependencies = [];
4102    formatTypes.forEach(function (type) {
4103      if (type.__experimentalCreatePrepareEditableTree) {
4104        var selected = keyedSelected[type.name];
4105  
4106        var handler = type.__experimentalCreatePrepareEditableTree(selected, {
4107          richTextIdentifier: identifier,
4108          blockClientId: clientId
4109        });
4110  
4111        if (type.__experimentalCreateOnChangeEditableValue) {
4112          valueHandlers.push(handler);
4113        } else {
4114          prepareHandlers.push(handler);
4115        }
4116  
4117        for (var key in selected) {
4118          dependencies.push(selected[key]);
4119        }
4120      }
4121  
4122      if (type.__experimentalCreateOnChangeEditableValue) {
4123        var dispatchers = {};
4124  
4125        if (type.__experimentalGetPropsForEditableTreeChangeHandler) {
4126          dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, {
4127            richTextIdentifier: identifier,
4128            blockClientId: clientId
4129          });
4130        }
4131  
4132        changeHandlers.push(type.__experimentalCreateOnChangeEditableValue(use_format_types_objectSpread(use_format_types_objectSpread({}, keyedSelected[type.name] || {}), dispatchers), {
4133          richTextIdentifier: identifier,
4134          blockClientId: clientId
4135        }));
4136      }
4137    });
4138    return {
4139      formatTypes: formatTypes,
4140      prepareHandlers: prepareHandlers,
4141      valueHandlers: valueHandlers,
4142      changeHandlers: changeHandlers,
4143      dependencies: dependencies
4144    };
4145  }
4146  
4147  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-boundary-style.js
4148  /**
4149   * WordPress dependencies
4150   */
4151  
4152  /*
4153   * Calculates and renders the format boundary style when the active formats
4154   * change.
4155   */
4156  
4157  function useBoundaryStyle(_ref) {
4158    var activeFormats = _ref.activeFormats,
4159        ref = _ref.ref;
4160    Object(external_wp_element_["useEffect"])(function () {
4161      // There's no need to recalculate the boundary styles if no formats are
4162      // active, because no boundary styles will be visible.
4163      if (!activeFormats || !activeFormats.length) {
4164        return;
4165      }
4166  
4167      var boundarySelector = '*[data-rich-text-format-boundary]';
4168      var element = ref.current.querySelector(boundarySelector);
4169  
4170      if (!element) {
4171        return;
4172      }
4173  
4174      var ownerDocument = element.ownerDocument;
4175      var defaultView = ownerDocument.defaultView;
4176      var computedStyle = defaultView.getComputedStyle(element);
4177      var newColor = computedStyle.color.replace(')', ', 0.2)').replace('rgb', 'rgba');
4178      var selector = ".rich-text:focus ".concat(boundarySelector);
4179      var rule = "background-color: ".concat(newColor);
4180      var style = "".concat(selector, " {").concat(rule, "}");
4181      var globalStyleId = 'rich-text-boundary-style';
4182      var globalStyle = ownerDocument.getElementById(globalStyleId);
4183  
4184      if (!globalStyle) {
4185        globalStyle = ownerDocument.createElement('style');
4186        globalStyle.id = globalStyleId;
4187        ownerDocument.head.appendChild(globalStyle);
4188      }
4189  
4190      if (globalStyle.innerHTML !== style) {
4191        globalStyle.innerHTML = style;
4192      }
4193    }, [activeFormats]);
4194  }
4195  
4196  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-inline-warning.js
4197  /**
4198   * WordPress dependencies
4199   */
4200  
4201  var message = 'RichText cannot be used with an inline container. Please use a different display property.';
4202  function useInlineWarning(_ref) {
4203    var ref = _ref.ref;
4204    Object(external_wp_element_["useEffect"])(function () {
4205      if (false) { var computedStyle, defaultView, target; }
4206    }, []);
4207  }
4208  
4209  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-copy-handler.js
4210  /**
4211   * WordPress dependencies
4212   */
4213  
4214  /**
4215   * Internal dependencies
4216   */
4217  
4218  
4219  
4220  
4221  
4222  function useCopyHandler(_ref) {
4223    var record = _ref.record,
4224        multilineTag = _ref.multilineTag,
4225        preserveWhiteSpace = _ref.preserveWhiteSpace;
4226    return Object(external_wp_compose_["useRefEffect"])(function (element) {
4227      function onCopy(event) {
4228        if (isCollapsed(record.current) || !element.contains(element.ownerDocument.activeElement)) {
4229          return;
4230        }
4231  
4232        var selectedRecord = slice(record.current);
4233        var plainText = getTextContent(selectedRecord);
4234        var html = toHTMLString({
4235          value: selectedRecord,
4236          multilineTag: multilineTag,
4237          preserveWhiteSpace: preserveWhiteSpace
4238        });
4239        event.clipboardData.setData('text/plain', plainText);
4240        event.clipboardData.setData('text/html', html);
4241        event.clipboardData.setData('rich-text', 'true');
4242        event.preventDefault();
4243      }
4244  
4245      element.addEventListener('copy', onCopy);
4246      return function () {
4247        element.removeEventListener('copy', onCopy);
4248      };
4249    }, [record, multilineTag, preserveWhiteSpace]);
4250  }
4251  
4252  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/index.js
4253  
4254  
4255  
4256  
4257  
4258  function component_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4259  
4260  function component_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { component_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { component_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4261  
4262  /**
4263   * WordPress dependencies
4264   */
4265  
4266  
4267  
4268  
4269  /**
4270   * Internal dependencies
4271   */
4272  
4273  
4274  
4275  
4276  
4277  
4278  
4279  
4280  
4281  
4282  
4283  
4284  
4285  
4286  
4287  
4288  
4289  
4290  
4291  /** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */
4292  
4293  /**
4294   * All inserting input types that would insert HTML into the DOM.
4295   *
4296   * @see https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes
4297   *
4298   * @type {Set}
4299   */
4300  
4301  var INSERTION_INPUT_TYPES_TO_IGNORE = new Set(['insertParagraph', 'insertOrderedList', 'insertUnorderedList', 'insertHorizontalRule', 'insertLink']);
4302  /**
4303   * In HTML, leading and trailing spaces are not visible, and multiple spaces
4304   * elsewhere are visually reduced to one space. This rule prevents spaces from
4305   * collapsing so all space is visible in the editor and can be removed. It also
4306   * prevents some browsers from inserting non-breaking spaces at the end of a
4307   * line to prevent the space from visually disappearing. Sometimes these non
4308   * breaking spaces can linger in the editor causing unwanted non breaking spaces
4309   * in between words. If also prevent Firefox from inserting a trailing `br` node
4310   * to visualise any trailing space, causing the element to be saved.
4311   *
4312   * > Authors are encouraged to set the 'white-space' property on editing hosts
4313   * > and on markup that was originally created through these editing mechanisms
4314   * > to the value 'pre-wrap'. Default HTML whitespace handling is not well
4315   * > suited to WYSIWYG editing, and line wrapping will not work correctly in
4316   * > some corner cases if 'white-space' is left at its default value.
4317   *
4318   * https://html.spec.whatwg.org/multipage/interaction.html#best-practices-for-in-page-editors
4319   *
4320   * @type {string}
4321   */
4322  
4323  var whiteSpace = 'pre-wrap';
4324  /**
4325   * A minimum width of 1px will prevent the rich text container from collapsing
4326   * to 0 width and hiding the caret. This is useful for inline containers.
4327   */
4328  
4329  var minWidth = '1px';
4330  /**
4331   * Default style object for the editable element.
4332   *
4333   * @type {Object<string,string>}
4334   */
4335  
4336  var defaultStyle = {
4337    whiteSpace: whiteSpace,
4338    minWidth: minWidth
4339  };
4340  var EMPTY_ACTIVE_FORMATS = [];
4341  
4342  function createPrepareEditableTree(fns) {
4343    return function (value) {
4344      return fns.reduce(function (accumulator, fn) {
4345        return fn(accumulator, value.text);
4346      }, value.formats);
4347    };
4348  }
4349  /**
4350   * If the selection is set on the placeholder element, collapse the selection to
4351   * the start (before the placeholder).
4352   *
4353   * @param {Window} defaultView
4354   */
4355  
4356  
4357  function fixPlaceholderSelection(defaultView) {
4358    var selection = defaultView.getSelection();
4359    var anchorNode = selection.anchorNode,
4360        anchorOffset = selection.anchorOffset;
4361  
4362    if (anchorNode.nodeType !== anchorNode.ELEMENT_NODE) {
4363      return;
4364    }
4365  
4366    var targetNode = anchorNode.childNodes[anchorOffset];
4367  
4368    if (!targetNode || targetNode.nodeType !== targetNode.ELEMENT_NODE || !targetNode.getAttribute('data-rich-text-placeholder')) {
4369      return;
4370    }
4371  
4372    selection.collapseToStart();
4373  }
4374  
4375  function RichText(_ref, forwardedRef) {
4376    var _ref$tagName = _ref.tagName,
4377        TagName = _ref$tagName === void 0 ? 'div' : _ref$tagName,
4378        _ref$value = _ref.value,
4379        value = _ref$value === void 0 ? '' : _ref$value,
4380        selectionStart = _ref.selectionStart,
4381        selectionEnd = _ref.selectionEnd,
4382        children = _ref.children,
4383        allowedFormats = _ref.allowedFormats,
4384        withoutInteractiveFormatting = _ref.withoutInteractiveFormatting,
4385        placeholder = _ref.placeholder,
4386        disabled = _ref.disabled,
4387        preserveWhiteSpace = _ref.preserveWhiteSpace,
4388        onPaste = _ref.onPaste,
4389        _ref$format = _ref.format,
4390        format = _ref$format === void 0 ? 'string' : _ref$format,
4391        onDelete = _ref.onDelete,
4392        onEnter = _ref.onEnter,
4393        onSelectionChange = _ref.onSelectionChange,
4394        onChange = _ref.onChange,
4395        onFocus = _ref.unstableOnFocus,
4396        clientId = _ref.clientId,
4397        identifier = _ref.identifier,
4398        multilineTag = _ref.__unstableMultilineTag,
4399        multilineRootTag = _ref.__unstableMultilineRootTag,
4400        disableFormats = _ref.__unstableDisableFormats,
4401        didAutomaticChange = _ref.__unstableDidAutomaticChange,
4402        inputRule = _ref.__unstableInputRule,
4403        markAutomaticChange = _ref.__unstableMarkAutomaticChange,
4404        allowPrefixTransformations = _ref.__unstableAllowPrefixTransformations,
4405        undo = _ref.__unstableUndo,
4406        isCaretWithinFormattedText = _ref.__unstableIsCaretWithinFormattedText,
4407        onEnterFormattedText = _ref.__unstableOnEnterFormattedText,
4408        onExitFormattedText = _ref.__unstableOnExitFormattedText,
4409        onCreateUndoLevel = _ref.__unstableOnCreateUndoLevel,
4410        isSelected = _ref.__unstableIsSelected;
4411    var ref = Object(external_wp_element_["useRef"])();
4412  
4413    var _useState = Object(external_wp_element_["useState"])(),
4414        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
4415        _useState2$ = _useState2[0],
4416        activeFormats = _useState2$ === void 0 ? [] : _useState2$,
4417        setActiveFormats = _useState2[1];
4418  
4419    var _useFormatTypes = useFormatTypes({
4420      clientId: clientId,
4421      identifier: identifier,
4422      withoutInteractiveFormatting: withoutInteractiveFormatting,
4423      allowedFormats: allowedFormats
4424    }),
4425        formatTypes = _useFormatTypes.formatTypes,
4426        prepareHandlers = _useFormatTypes.prepareHandlers,
4427        valueHandlers = _useFormatTypes.valueHandlers,
4428        changeHandlers = _useFormatTypes.changeHandlers,
4429        dependencies = _useFormatTypes.dependencies; // For backward compatibility, fall back to tagName if it's a string.
4430    // tagName can now be a component for light blocks.
4431  
4432  
4433    if (!multilineRootTag && typeof TagName === 'string') {
4434      multilineRootTag = TagName;
4435    }
4436  
4437    function getDoc() {
4438      return ref.current.ownerDocument;
4439    }
4440  
4441    function getWin() {
4442      return getDoc().defaultView;
4443    }
4444    /**
4445     * Converts the outside data structure to our internal representation.
4446     *
4447     * @param {*} string The outside value, data type depends on props.
4448     *
4449     * @return {Object} An internal rich-text value.
4450     */
4451  
4452  
4453    function formatToValue(string) {
4454      if (disableFormats) {
4455        return {
4456          text: string,
4457          formats: Array(string.length),
4458          replacements: Array(string.length)
4459        };
4460      }
4461  
4462      if (format !== 'string') {
4463        return string;
4464      }
4465  
4466      var prepare = createPrepareEditableTree(valueHandlers);
4467      var result = create({
4468        html: string,
4469        multilineTag: multilineTag,
4470        multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
4471        preserveWhiteSpace: preserveWhiteSpace
4472      });
4473      result.formats = prepare(result);
4474      return result;
4475    }
4476    /**
4477     * Removes editor only formats from the value.
4478     *
4479     * Editor only formats are applied using `prepareEditableTree`, so we need to
4480     * remove them before converting the internal state
4481     *
4482     * @param {Object} val The internal rich-text value.
4483     *
4484     * @return {Object} A new rich-text value.
4485     */
4486  
4487  
4488    function removeEditorOnlyFormats(val) {
4489      formatTypes.forEach(function (formatType) {
4490        // Remove formats created by prepareEditableTree, because they are editor only.
4491        if (formatType.__experimentalCreatePrepareEditableTree) {
4492          val = removeFormat(val, formatType.name, 0, val.text.length);
4493        }
4494      });
4495      return val;
4496    }
4497    /**
4498     * Converts the internal value to the external data format.
4499     *
4500     * @param {Object} val The internal rich-text value.
4501     *
4502     * @return {*} The external data format, data type depends on props.
4503     */
4504  
4505  
4506    function valueToFormat(val) {
4507      if (disableFormats) {
4508        return val.text;
4509      }
4510  
4511      val = removeEditorOnlyFormats(val);
4512  
4513      if (format !== 'string') {
4514        return;
4515      }
4516  
4517      return toHTMLString({
4518        value: val,
4519        multilineTag: multilineTag,
4520        preserveWhiteSpace: preserveWhiteSpace
4521      });
4522    } // Internal values are updated synchronously, unlike props and state.
4523  
4524  
4525    var _value = Object(external_wp_element_["useRef"])(value);
4526  
4527    var record = Object(external_wp_element_["useRef"])(Object(external_wp_element_["useMemo"])(function () {
4528      var initialRecord = formatToValue(value);
4529      initialRecord.start = selectionStart;
4530      initialRecord.end = selectionEnd;
4531      return initialRecord;
4532    }, []));
4533  
4534    function createRecord() {
4535      var selection = getWin().getSelection();
4536      var range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
4537      return create({
4538        element: ref.current,
4539        range: range,
4540        multilineTag: multilineTag,
4541        multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
4542        __unstableIsEditableTree: true,
4543        preserveWhiteSpace: preserveWhiteSpace
4544      });
4545    }
4546  
4547    function applyRecord(newRecord) {
4548      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
4549          domOnly = _ref2.domOnly;
4550  
4551      apply({
4552        value: newRecord,
4553        current: ref.current,
4554        multilineTag: multilineTag,
4555        multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
4556        prepareEditableTree: createPrepareEditableTree(prepareHandlers),
4557        __unstableDomOnly: domOnly,
4558        placeholder: placeholder
4559      });
4560    }
4561    /**
4562     * Handles a paste event.
4563     *
4564     * Saves the pasted data as plain text in `pastedPlainText`.
4565     *
4566     * @param {ClipboardEvent} event The paste event.
4567     */
4568  
4569  
4570    function handlePaste(event) {
4571      if (!isSelected) {
4572        event.preventDefault();
4573        return;
4574      }
4575  
4576      var clipboardData = event.clipboardData;
4577      var plainText = '';
4578      var html = ''; // IE11 only supports `Text` as an argument for `getData` and will
4579      // otherwise throw an invalid argument error, so we try the standard
4580      // arguments first, then fallback to `Text` if they fail.
4581  
4582      try {
4583        plainText = clipboardData.getData('text/plain');
4584        html = clipboardData.getData('text/html');
4585      } catch (error1) {
4586        try {
4587          html = clipboardData.getData('Text');
4588        } catch (error2) {
4589          // Some browsers like UC Browser paste plain text by default and
4590          // don't support clipboardData at all, so allow default
4591          // behaviour.
4592          return;
4593        }
4594      }
4595  
4596      event.preventDefault(); // Allows us to ask for this information when we get a report.
4597  
4598      window.console.log('Received HTML:\n\n', html);
4599      window.console.log('Received plain text:\n\n', plainText);
4600  
4601      if (disableFormats) {
4602        handleChange(insert(record.current, plainText));
4603        return;
4604      }
4605  
4606      var transformed = formatTypes.reduce(function (accumlator, _ref3) {
4607        var __unstablePasteRule = _ref3.__unstablePasteRule;
4608  
4609        // Only allow one transform.
4610        if (__unstablePasteRule && accumlator === record.current) {
4611          accumlator = __unstablePasteRule(record.current, {
4612            html: html,
4613            plainText: plainText
4614          });
4615        }
4616  
4617        return accumlator;
4618      }, record.current);
4619  
4620      if (transformed !== record.current) {
4621        handleChange(transformed);
4622        return;
4623      }
4624  
4625      if (onPaste) {
4626        var files = Object(external_wp_dom_["getFilesFromDataTransfer"])(clipboardData);
4627        var isInternal = clipboardData.getData('rich-text') === 'true';
4628        onPaste({
4629          value: removeEditorOnlyFormats(record.current),
4630          onChange: handleChange,
4631          html: html,
4632          plainText: plainText,
4633          isInternal: isInternal,
4634          files: Object(toConsumableArray["a" /* default */])(files),
4635          activeFormats: activeFormats
4636        });
4637      }
4638    }
4639    /**
4640     * Handles delete on keydown:
4641     * - outdent list items,
4642     * - delete content if everything is selected,
4643     * - trigger the onDelete prop when selection is uncollapsed and at an edge.
4644     *
4645     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4646     */
4647  
4648  
4649    function handleDelete(event) {
4650      var keyCode = event.keyCode;
4651  
4652      if (keyCode !== external_wp_keycodes_["DELETE"] && keyCode !== external_wp_keycodes_["BACKSPACE"] && keyCode !== external_wp_keycodes_["ESCAPE"]) {
4653        return;
4654      }
4655  
4656      if (didAutomaticChange) {
4657        event.preventDefault();
4658        undo();
4659        return;
4660      }
4661  
4662      if (keyCode === external_wp_keycodes_["ESCAPE"]) {
4663        return;
4664      }
4665  
4666      var currentValue = createRecord();
4667      var start = currentValue.start,
4668          end = currentValue.end,
4669          text = currentValue.text;
4670      var isReverse = keyCode === external_wp_keycodes_["BACKSPACE"]; // Always handle full content deletion ourselves.
4671  
4672      if (start === 0 && end !== 0 && end === text.length) {
4673        handleChange(remove_remove(currentValue));
4674        event.preventDefault();
4675        return;
4676      }
4677  
4678      if (multilineTag) {
4679        var newValue; // Check to see if we should remove the first item if empty.
4680  
4681        if (isReverse && currentValue.start === 0 && currentValue.end === 0 && isEmptyLine(currentValue)) {
4682          newValue = removeLineSeparator(currentValue, !isReverse);
4683        } else {
4684          newValue = removeLineSeparator(currentValue, isReverse);
4685        }
4686  
4687        if (newValue) {
4688          handleChange(newValue);
4689          event.preventDefault();
4690          return;
4691        }
4692      } // Only process delete if the key press occurs at an uncollapsed edge.
4693  
4694  
4695      if (!onDelete || !isCollapsed(currentValue) || activeFormats.length || isReverse && start !== 0 || !isReverse && end !== text.length) {
4696        return;
4697      }
4698  
4699      onDelete({
4700        isReverse: isReverse,
4701        value: currentValue
4702      });
4703      event.preventDefault();
4704    }
4705    /**
4706     * Triggers the `onEnter` prop on keydown.
4707     *
4708     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4709     */
4710  
4711  
4712    function handleEnter(event) {
4713      if (event.keyCode !== external_wp_keycodes_["ENTER"]) {
4714        return;
4715      }
4716  
4717      event.preventDefault();
4718  
4719      if (!onEnter) {
4720        return;
4721      }
4722  
4723      onEnter({
4724        value: removeEditorOnlyFormats(createRecord()),
4725        onChange: handleChange,
4726        shiftKey: event.shiftKey
4727      });
4728    }
4729    /**
4730     * Indents list items on space keydown.
4731     *
4732     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4733     */
4734  
4735  
4736    function handleSpace(event) {
4737      var keyCode = event.keyCode,
4738          shiftKey = event.shiftKey,
4739          altKey = event.altKey,
4740          metaKey = event.metaKey,
4741          ctrlKey = event.ctrlKey;
4742  
4743      if ( // Only override when no modifiers are pressed.
4744      shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_wp_keycodes_["SPACE"] || multilineTag !== 'li') {
4745        return;
4746      }
4747  
4748      var currentValue = createRecord();
4749  
4750      if (!isCollapsed(currentValue)) {
4751        return;
4752      }
4753  
4754      var text = currentValue.text,
4755          start = currentValue.start;
4756      var characterBefore = text[start - 1]; // The caret must be at the start of a line.
4757  
4758      if (characterBefore && characterBefore !== LINE_SEPARATOR) {
4759        return;
4760      }
4761  
4762      handleChange(indentListItems(currentValue, {
4763        type: multilineRootTag
4764      }));
4765      event.preventDefault();
4766    }
4767    /**
4768     * Handles horizontal keyboard navigation when no modifiers are pressed. The
4769     * navigation is handled separately to move correctly around format
4770     * boundaries.
4771     *
4772     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4773     */
4774  
4775  
4776    function handleHorizontalNavigation(event) {
4777      var keyCode = event.keyCode,
4778          shiftKey = event.shiftKey,
4779          altKey = event.altKey,
4780          metaKey = event.metaKey,
4781          ctrlKey = event.ctrlKey;
4782  
4783      if ( // Only override left and right keys without modifiers pressed.
4784      shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_wp_keycodes_["LEFT"] && keyCode !== external_wp_keycodes_["RIGHT"]) {
4785        return;
4786      }
4787  
4788      var _record$current = record.current,
4789          text = _record$current.text,
4790          formats = _record$current.formats,
4791          start = _record$current.start,
4792          end = _record$current.end,
4793          _record$current$activ = _record$current.activeFormats,
4794          currentActiveFormats = _record$current$activ === void 0 ? [] : _record$current$activ;
4795      var collapsed = isCollapsed(record.current); // To do: ideally, we should look at visual position instead.
4796  
4797      var _getWin$getComputedSt = getWin().getComputedStyle(ref.current),
4798          direction = _getWin$getComputedSt.direction;
4799  
4800      var reverseKey = direction === 'rtl' ? external_wp_keycodes_["RIGHT"] : external_wp_keycodes_["LEFT"];
4801      var isReverse = event.keyCode === reverseKey; // If the selection is collapsed and at the very start, do nothing if
4802      // navigating backward.
4803      // If the selection is collapsed and at the very end, do nothing if
4804      // navigating forward.
4805  
4806      if (collapsed && currentActiveFormats.length === 0) {
4807        if (start === 0 && isReverse) {
4808          return;
4809        }
4810  
4811        if (end === text.length && !isReverse) {
4812          return;
4813        }
4814      } // If the selection is not collapsed, let the browser handle collapsing
4815      // the selection for now. Later we could expand this logic to set
4816      // boundary positions if needed.
4817  
4818  
4819      if (!collapsed) {
4820        return;
4821      }
4822  
4823      var formatsBefore = formats[start - 1] || EMPTY_ACTIVE_FORMATS;
4824      var formatsAfter = formats[start] || EMPTY_ACTIVE_FORMATS;
4825      var newActiveFormatsLength = currentActiveFormats.length;
4826      var source = formatsAfter;
4827  
4828      if (formatsBefore.length > formatsAfter.length) {
4829        source = formatsBefore;
4830      } // If the amount of formats before the caret and after the caret is
4831      // different, the caret is at a format boundary.
4832  
4833  
4834      if (formatsBefore.length < formatsAfter.length) {
4835        if (!isReverse && currentActiveFormats.length < formatsAfter.length) {
4836          newActiveFormatsLength++;
4837        }
4838  
4839        if (isReverse && currentActiveFormats.length > formatsBefore.length) {
4840          newActiveFormatsLength--;
4841        }
4842      } else if (formatsBefore.length > formatsAfter.length) {
4843        if (!isReverse && currentActiveFormats.length > formatsAfter.length) {
4844          newActiveFormatsLength--;
4845        }
4846  
4847        if (isReverse && currentActiveFormats.length < formatsBefore.length) {
4848          newActiveFormatsLength++;
4849        }
4850      }
4851  
4852      if (newActiveFormatsLength === currentActiveFormats.length) {
4853        record.current._newActiveFormats = isReverse ? formatsBefore : formatsAfter;
4854        return;
4855      }
4856  
4857      event.preventDefault();
4858      var newActiveFormats = source.slice(0, newActiveFormatsLength);
4859  
4860      var newValue = component_objectSpread(component_objectSpread({}, record.current), {}, {
4861        activeFormats: newActiveFormats
4862      });
4863  
4864      record.current = newValue;
4865      applyRecord(newValue);
4866      setActiveFormats(newActiveFormats);
4867    }
4868  
4869    function handleKeyDown(event) {
4870      if (event.defaultPrevented) {
4871        return;
4872      }
4873  
4874      handleDelete(event);
4875      handleEnter(event);
4876      handleSpace(event);
4877      handleHorizontalNavigation(event);
4878    }
4879  
4880    var lastHistoryValue = Object(external_wp_element_["useRef"])(value);
4881  
4882    function createUndoLevel() {
4883      // If the content is the same, no level needs to be created.
4884      if (lastHistoryValue.current === _value.current) {
4885        return;
4886      }
4887  
4888      onCreateUndoLevel();
4889      lastHistoryValue.current = _value.current;
4890    }
4891  
4892    var isComposing = Object(external_wp_element_["useRef"])(false);
4893    var timeout = Object(external_wp_element_["useRef"])();
4894    /**
4895     * Handle input on the next selection change event.
4896     *
4897     * @param {WPSyntheticEvent} event Synthetic input event.
4898     */
4899  
4900    function handleInput(event) {
4901      // Do not trigger a change if characters are being composed. Browsers
4902      // will usually emit a final `input` event when the characters are
4903      // composed.
4904      // As of December 2019, Safari doesn't support nativeEvent.isComposing.
4905      if (isComposing.current) {
4906        return;
4907      }
4908  
4909      var inputType;
4910  
4911      if (event) {
4912        inputType = event.inputType;
4913      }
4914  
4915      if (!inputType && event && event.nativeEvent) {
4916        inputType = event.nativeEvent.inputType;
4917      } // The browser formatted something or tried to insert HTML.
4918      // Overwrite it. It will be handled later by the format library if
4919      // needed.
4920  
4921  
4922      if (inputType && (inputType.indexOf('format') === 0 || INSERTION_INPUT_TYPES_TO_IGNORE.has(inputType))) {
4923        applyRecord(record.current);
4924        return;
4925      }
4926  
4927      var currentValue = createRecord();
4928      var _record$current2 = record.current,
4929          start = _record$current2.start,
4930          _record$current2$acti = _record$current2.activeFormats,
4931          oldActiveFormats = _record$current2$acti === void 0 ? [] : _record$current2$acti; // Update the formats between the last and new caret position.
4932  
4933      var change = updateFormats({
4934        value: currentValue,
4935        start: start,
4936        end: currentValue.start,
4937        formats: oldActiveFormats
4938      });
4939      handleChange(change, {
4940        withoutHistory: true
4941      }); // Create an undo level when input stops for over a second.
4942  
4943      getWin().clearTimeout(timeout.current);
4944      timeout.current = getWin().setTimeout(createUndoLevel, 1000); // Only run input rules when inserting text.
4945  
4946      if (inputType !== 'insertText') {
4947        return;
4948      }
4949  
4950      if (allowPrefixTransformations && inputRule) {
4951        inputRule(change, valueToFormat);
4952      }
4953  
4954      var transformed = formatTypes.reduce(function (accumlator, _ref4) {
4955        var __unstableInputRule = _ref4.__unstableInputRule;
4956  
4957        if (__unstableInputRule) {
4958          accumlator = __unstableInputRule(accumlator);
4959        }
4960  
4961        return accumlator;
4962      }, change);
4963  
4964      if (transformed !== change) {
4965        createUndoLevel();
4966        handleChange(component_objectSpread(component_objectSpread({}, transformed), {}, {
4967          activeFormats: oldActiveFormats
4968        }));
4969        markAutomaticChange();
4970      }
4971    }
4972  
4973    function handleCompositionStart() {
4974      isComposing.current = true; // Do not update the selection when characters are being composed as
4975      // this rerenders the component and might distroy internal browser
4976      // editing state.
4977  
4978      getDoc().removeEventListener('selectionchange', handleSelectionChange);
4979    }
4980  
4981    function handleCompositionEnd() {
4982      isComposing.current = false; // Ensure the value is up-to-date for browsers that don't emit a final
4983      // input event after composition.
4984  
4985      handleInput({
4986        inputType: 'insertText'
4987      }); // Tracking selection changes can be resumed.
4988  
4989      getDoc().addEventListener('selectionchange', handleSelectionChange);
4990    }
4991  
4992    var didMount = Object(external_wp_element_["useRef"])(false);
4993    /**
4994     * Syncs the selection to local state. A callback for the `selectionchange`
4995     * native events, `keyup`, `mouseup` and `touchend` synthetic events, and
4996     * animation frames after the `focus` event.
4997     *
4998     * @param {Event|WPSyntheticEvent|DOMHighResTimeStamp} event
4999     */
5000  
5001    function handleSelectionChange(event) {
5002      if (!ref.current) {
5003        return;
5004      }
5005  
5006      if (ref.current.ownerDocument.activeElement !== ref.current) {
5007        return;
5008      }
5009  
5010      if (event.type !== 'selectionchange' && !isSelected) {
5011        return;
5012      }
5013  
5014      if (disabled) {
5015        return;
5016      } // In case of a keyboard event, ignore selection changes during
5017      // composition.
5018  
5019  
5020      if (isComposing.current) {
5021        return;
5022      }
5023  
5024      var _createRecord = createRecord(),
5025          start = _createRecord.start,
5026          end = _createRecord.end,
5027          text = _createRecord.text;
5028  
5029      var oldRecord = record.current; // Fallback mechanism for IE11, which doesn't support the input event.
5030      // Any input results in a selection change.
5031  
5032      if (text !== oldRecord.text) {
5033        handleInput();
5034        return;
5035      }
5036  
5037      if (start === oldRecord.start && end === oldRecord.end) {
5038        // Sometimes the browser may set the selection on the placeholder
5039        // element, in which case the caret is not visible. We need to set
5040        // the caret before the placeholder if that's the case.
5041        if (oldRecord.text.length === 0 && start === 0) {
5042          fixPlaceholderSelection(getWin());
5043        }
5044  
5045        return;
5046      }
5047  
5048      var newValue = component_objectSpread(component_objectSpread({}, oldRecord), {}, {
5049        start: start,
5050        end: end,
5051        // _newActiveFormats may be set on arrow key navigation to control
5052        // the right boundary position. If undefined, getActiveFormats will
5053        // give the active formats according to the browser.
5054        activeFormats: oldRecord._newActiveFormats,
5055        _newActiveFormats: undefined
5056      });
5057  
5058      var newActiveFormats = getActiveFormats(newValue, EMPTY_ACTIVE_FORMATS); // Update the value with the new active formats.
5059  
5060      newValue.activeFormats = newActiveFormats;
5061  
5062      if (!isCaretWithinFormattedText && newActiveFormats.length) {
5063        onEnterFormattedText();
5064      } else if (isCaretWithinFormattedText && !newActiveFormats.length) {
5065        onExitFormattedText();
5066      } // It is important that the internal value is updated first,
5067      // otherwise the value will be wrong on render!
5068  
5069  
5070      record.current = newValue;
5071      applyRecord(newValue, {
5072        domOnly: true
5073      });
5074      onSelectionChange(start, end);
5075      setActiveFormats(newActiveFormats);
5076    }
5077    /**
5078     * Sync the value to global state. The node tree and selection will also be
5079     * updated if differences are found.
5080     *
5081     * @param {Object}  newRecord         The record to sync and apply.
5082     * @param {Object}  $2                Named options.
5083     * @param {boolean} $2.withoutHistory If true, no undo level will be
5084     *                                    created.
5085     */
5086  
5087  
5088    function handleChange(newRecord) {
5089      var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
5090          withoutHistory = _ref5.withoutHistory;
5091  
5092      if (disableFormats) {
5093        newRecord.formats = Array(newRecord.text.length);
5094        newRecord.replacements = Array(newRecord.text.length);
5095      }
5096  
5097      applyRecord(newRecord);
5098      var start = newRecord.start,
5099          end = newRecord.end,
5100          _newRecord$activeForm = newRecord.activeFormats,
5101          newActiveFormats = _newRecord$activeForm === void 0 ? [] : _newRecord$activeForm;
5102      Object.values(changeHandlers).forEach(function (changeHandler) {
5103        changeHandler(newRecord.formats, newRecord.text);
5104      });
5105      _value.current = valueToFormat(newRecord);
5106      record.current = newRecord; // Selection must be updated first, so it is recorded in history when
5107      // the content change happens.
5108  
5109      onSelectionChange(start, end);
5110      onChange(_value.current);
5111      setActiveFormats(newActiveFormats);
5112  
5113      if (!withoutHistory) {
5114        createUndoLevel();
5115      }
5116    }
5117    /**
5118     * Select object when they are clicked. The browser will not set any
5119     * selection when clicking e.g. an image.
5120     *
5121     * @param {WPSyntheticEvent} event Synthetic mousedown or touchstart event.
5122     */
5123  
5124  
5125    function handlePointerDown(event) {
5126      var target = event.target; // If the child element has no text content, it must be an object.
5127  
5128      if (target === ref.current || target.textContent) {
5129        return;
5130      }
5131  
5132      var parentNode = target.parentNode;
5133      var index = Array.from(parentNode.childNodes).indexOf(target);
5134      var range = getDoc().createRange();
5135      var selection = getWin().getSelection();
5136      range.setStart(target.parentNode, index);
5137      range.setEnd(target.parentNode, index + 1);
5138      selection.removeAllRanges();
5139      selection.addRange(range);
5140    }
5141  
5142    var rafId = Object(external_wp_element_["useRef"])();
5143    /**
5144     * Handles a focus event on the contenteditable field, calling the
5145     * `unstableOnFocus` prop callback if one is defined. The callback does not
5146     * receive any arguments.
5147     *
5148     * This is marked as a private API and the `unstableOnFocus` prop is not
5149     * documented, as the current requirements where it is used are subject to
5150     * future refactoring following `isSelected` handling.
5151     *
5152     * @private
5153     */
5154  
5155    function handleFocus() {
5156      if (onFocus) {
5157        onFocus();
5158      }
5159  
5160      if (!isSelected) {
5161        // We know for certain that on focus, the old selection is invalid.
5162        // It will be recalculated on the next mouseup, keyup, or touchend
5163        // event.
5164        var index = undefined;
5165        record.current = component_objectSpread(component_objectSpread({}, record.current), {}, {
5166          start: index,
5167          end: index,
5168          activeFormats: EMPTY_ACTIVE_FORMATS
5169        });
5170        onSelectionChange(index, index);
5171        setActiveFormats(EMPTY_ACTIVE_FORMATS);
5172      } else {
5173        onSelectionChange(record.current.start, record.current.end);
5174        setActiveFormats(getActiveFormats(component_objectSpread(component_objectSpread({}, record.current), {}, {
5175          activeFormats: undefined
5176        }), EMPTY_ACTIVE_FORMATS));
5177      } // Update selection as soon as possible, which is at the next animation
5178      // frame. The event listener for selection changes may be added too late
5179      // at this point, but this focus event is still too early to calculate
5180      // the selection.
5181  
5182  
5183      rafId.current = getWin().requestAnimationFrame(handleSelectionChange);
5184      getDoc().addEventListener('selectionchange', handleSelectionChange);
5185    }
5186  
5187    function handleBlur() {
5188      getDoc().removeEventListener('selectionchange', handleSelectionChange);
5189    }
5190  
5191    function applyFromProps() {
5192      _value.current = value;
5193      record.current = formatToValue(value);
5194      record.current.start = selectionStart;
5195      record.current.end = selectionEnd;
5196      applyRecord(record.current);
5197    }
5198  
5199    Object(external_wp_element_["useEffect"])(function () {
5200      if (didMount.current) {
5201        applyFromProps();
5202      }
5203    }, [TagName, placeholder]);
5204    Object(external_wp_element_["useEffect"])(function () {
5205      if (didMount.current && value !== _value.current) {
5206        applyFromProps();
5207      }
5208    }, [value]);
5209    Object(external_wp_element_["useEffect"])(function () {
5210      if (!didMount.current) {
5211        return;
5212      }
5213  
5214      if (isSelected && (selectionStart !== record.current.start || selectionEnd !== record.current.end)) {
5215        applyFromProps();
5216      } else {
5217        record.current = component_objectSpread(component_objectSpread({}, record.current), {}, {
5218          start: selectionStart,
5219          end: selectionEnd
5220        });
5221      }
5222    }, [selectionStart, selectionEnd, isSelected]);
5223    Object(external_wp_element_["useEffect"])(function () {
5224      if (didMount.current) {
5225        applyFromProps();
5226      }
5227    }, dependencies);
5228    Object(external_wp_element_["useLayoutEffect"])(function () {
5229      applyRecord(record.current, {
5230        domOnly: true
5231      });
5232      didMount.current = true;
5233      return function () {
5234        getDoc().removeEventListener('selectionchange', handleSelectionChange);
5235        getWin().cancelAnimationFrame(rafId.current);
5236        getWin().clearTimeout(timeout.current);
5237      };
5238    }, []);
5239  
5240    function focus() {
5241      ref.current.focus();
5242      applyRecord(record.current);
5243    }
5244  
5245    var editableProps = {
5246      // Overridable props.
5247      role: 'textbox',
5248      'aria-multiline': true,
5249      'aria-label': placeholder,
5250      ref: Object(external_wp_compose_["useMergeRefs"])([forwardedRef, ref, useCopyHandler({
5251        record: record,
5252        multilineTag: multilineTag,
5253        preserveWhiteSpace: preserveWhiteSpace
5254      })]),
5255      style: defaultStyle,
5256      className: 'rich-text',
5257      onPaste: handlePaste,
5258      onInput: handleInput,
5259      onCompositionStart: handleCompositionStart,
5260      onCompositionEnd: handleCompositionEnd,
5261      onKeyDown: handleKeyDown,
5262      onFocus: handleFocus,
5263      onBlur: handleBlur,
5264      onMouseDown: handlePointerDown,
5265      onTouchStart: handlePointerDown,
5266      // Selection updates must be done at these events as they
5267      // happen before the `selectionchange` event. In some cases,
5268      // the `selectionchange` event may not even fire, for
5269      // example when the window receives focus again on click.
5270      onKeyUp: handleSelectionChange,
5271      onMouseUp: handleSelectionChange,
5272      onTouchEnd: handleSelectionChange,
5273      // Do not set the attribute if disabled.
5274      contentEditable: disabled ? undefined : true,
5275      suppressContentEditableWarning: !disabled
5276    };
5277    useBoundaryStyle({
5278      ref: ref,
5279      activeFormats: activeFormats
5280    });
5281    useInlineWarning({
5282      ref: ref
5283    });
5284    return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isSelected && Object(external_wp_element_["createElement"])(FormatEdit, {
5285      value: record.current,
5286      onChange: handleChange,
5287      onFocus: focus,
5288      formatTypes: formatTypes,
5289      forwardedRef: ref
5290    }), children && children({
5291      isSelected: isSelected,
5292      value: record.current,
5293      onChange: handleChange,
5294      onFocus: focus,
5295      editableProps: editableProps,
5296      editableTagName: TagName
5297    }), !children && Object(external_wp_element_["createElement"])(TagName, editableProps));
5298  }
5299  /**
5300   * Renders a rich content input, providing users with the option to format the
5301   * content.
5302   */
5303  
5304  
5305  /* harmony default export */ var component = (Object(external_wp_element_["forwardRef"])(RichText));
5306  
5307  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/index.js
5308  
5309  
5310  
5311  
5312  
5313  
5314  
5315  
5316  
5317  
5318  
5319  
5320  
5321  
5322  
5323  
5324  
5325  
5326  
5327  
5328  
5329  
5330  
5331  
5332  
5333  
5334  
5335  
5336  
5337  
5338  
5339  
5340  
5341  
5342  
5343  
5344  
5345  
5346  /***/ }),
5347  
5348  /***/ 5:
5349  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5350  
5351  "use strict";
5352  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
5353  function _defineProperty(obj, key, value) {
5354    if (key in obj) {
5355      Object.defineProperty(obj, key, {
5356        value: value,
5357        enumerable: true,
5358        configurable: true,
5359        writable: true
5360      });
5361    } else {
5362      obj[key] = value;
5363    }
5364  
5365    return obj;
5366  }
5367  
5368  /***/ }),
5369  
5370  /***/ 56:
5371  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5372  
5373  "use strict";
5374  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
5375  function _typeof(obj) {
5376    "@babel/helpers - typeof";
5377  
5378    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
5379      _typeof = function _typeof(obj) {
5380        return typeof obj;
5381      };
5382    } else {
5383      _typeof = function _typeof(obj) {
5384        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
5385      };
5386    }
5387  
5388    return _typeof(obj);
5389  }
5390  
5391  /***/ })
5392  
5393  /******/ });


Generated: Mon Apr 19 01:00:04 2021 Cross-referenced by PHPXref 0.7.1