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