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


Generated: Fri Jan 24 01:00:03 2020 Cross-referenced by PHPXref 0.7.1