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 = 254); |
85 /******/ return __webpack_require__(__webpack_require__.s = 283); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 254: |
90 /***/ 14: |
|
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
92 |
|
93 "use strict"; |
|
94 |
|
95 // EXPORTS |
|
96 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); |
|
97 |
|
98 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
99 var arrayWithHoles = __webpack_require__(38); |
|
100 |
|
101 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
102 function _iterableToArrayLimit(arr, i) { |
|
103 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
|
104 var _arr = []; |
|
105 var _n = true; |
|
106 var _d = false; |
|
107 var _e = undefined; |
|
108 |
|
109 try { |
|
110 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
111 _arr.push(_s.value); |
|
112 |
|
113 if (i && _arr.length === i) break; |
|
114 } |
|
115 } catch (err) { |
|
116 _d = true; |
|
117 _e = err; |
|
118 } finally { |
|
119 try { |
|
120 if (!_n && _i["return"] != null) _i["return"](); |
|
121 } finally { |
|
122 if (_d) throw _e; |
|
123 } |
|
124 } |
|
125 |
|
126 return _arr; |
|
127 } |
|
128 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
129 var unsupportedIterableToArray = __webpack_require__(29); |
|
130 |
|
131 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
132 var nonIterableRest = __webpack_require__(39); |
|
133 |
|
134 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 function _slicedToArray(arr, i) { |
|
140 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
141 } |
|
142 |
|
143 /***/ }), |
|
144 |
|
145 /***/ 26: |
|
146 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
147 |
|
148 "use strict"; |
|
149 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
|
150 function _arrayLikeToArray(arr, len) { |
|
151 if (len == null || len > arr.length) len = arr.length; |
|
152 |
|
153 for (var i = 0, arr2 = new Array(len); i < len; i++) { |
|
154 arr2[i] = arr[i]; |
|
155 } |
|
156 |
|
157 return arr2; |
|
158 } |
|
159 |
|
160 /***/ }), |
|
161 |
|
162 /***/ 283: |
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
163 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
92 |
164 |
93 "use strict"; |
165 "use strict"; |
94 __webpack_require__.r(__webpack_exports__); |
166 __webpack_require__.r(__webpack_exports__); |
95 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autop", function() { return autop; }); |
167 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autop", function() { return autop; }); |
96 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removep", function() { return removep; }); |
168 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removep", function() { return removep; }); |
97 /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28); |
169 /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); |
98 |
170 |
99 |
171 |
100 /** |
172 /** |
101 * The regular expression for an HTML element. |
173 * The regular expression for an HTML element. |
102 * |
174 * |
103 * @type {String} |
175 * @type {RegExp} |
104 */ |
176 */ |
105 var htmlSplitRegex = function () { |
177 var htmlSplitRegex = function () { |
106 /* eslint-disable no-multi-spaces */ |
178 /* eslint-disable no-multi-spaces */ |
107 var comments = '!' + // Start of comment, after the <. |
179 var comments = '!' + // Start of comment, after the <. |
108 '(?:' + // Unroll the loop: Consume everything until --> is found. |
180 '(?:' + // Unroll the loop: Consume everything until --> is found. |
134 }(); |
206 }(); |
135 /** |
207 /** |
136 * Separate HTML elements and comments from the text. |
208 * Separate HTML elements and comments from the text. |
137 * |
209 * |
138 * @param {string} input The text which has to be formatted. |
210 * @param {string} input The text which has to be formatted. |
139 * @return {Array} The formatted text. |
211 * @return {string[]} The formatted text. |
140 */ |
212 */ |
141 |
213 |
142 |
214 |
143 function htmlSplit(input) { |
215 function htmlSplit(input) { |
144 var parts = []; |
216 var parts = []; |
145 var workingInput = input; |
217 var workingInput = input; |
146 var match; |
218 var match; |
147 |
219 |
148 while (match = workingInput.match(htmlSplitRegex)) { |
220 while (match = workingInput.match(htmlSplitRegex)) { |
149 parts.push(workingInput.slice(0, match.index)); |
221 // The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`. |
|
222 // If the `g` flag is omitted, `index` is included. |
|
223 // `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number. |
|
224 // Assert `match.index` is a number. |
|
225 var index = |
|
226 /** @type {number} */ |
|
227 match.index; |
|
228 parts.push(workingInput.slice(0, index)); |
150 parts.push(match[0]); |
229 parts.push(match[0]); |
151 workingInput = workingInput.slice(match.index + match[0].length); |
230 workingInput = workingInput.slice(index + match[0].length); |
152 } |
231 } |
153 |
232 |
154 if (workingInput.length) { |
233 if (workingInput.length) { |
155 parts.push(workingInput); |
234 parts.push(workingInput); |
156 } |
235 } |
158 return parts; |
237 return parts; |
159 } |
238 } |
160 /** |
239 /** |
161 * Replace characters or phrases within HTML elements only. |
240 * Replace characters or phrases within HTML elements only. |
162 * |
241 * |
163 * @param {string} haystack The text which has to be formatted. |
242 * @param {string} haystack The text which has to be formatted. |
164 * @param {Object} replacePairs In the form {from: 'to', ...}. |
243 * @param {Record<string,string>} replacePairs In the form {from: 'to', …}. |
165 * @return {string} The formatted text. |
244 * @return {string} The formatted text. |
166 */ |
245 */ |
167 |
246 |
168 |
247 |
169 function replaceInHtmlTags(haystack, replacePairs) { |
248 function replaceInHtmlTags(haystack, replacePairs) { |
170 // Find all elements. |
249 // Find all elements. |
252 |
331 |
253 |
332 |
254 text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '\n\n'); |
333 text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '\n\n'); |
255 var allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a double line break above block-level opening tags. |
334 var allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a double line break above block-level opening tags. |
256 |
335 |
257 text = text.replace(new RegExp('(<' + allBlocks + '[\\s\/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags. |
336 text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags. |
258 |
337 |
259 text = text.replace(new RegExp('(<\/' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n". |
338 text = text.replace(new RegExp('(</' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n". |
260 |
339 |
261 text = text.replace(/\r\n|\r/g, '\n'); // Find newlines in all elements and add placeholders. |
340 text = text.replace(/\r\n|\r/g, '\n'); // Find newlines in all elements and add placeholders. |
262 |
341 |
263 text = replaceInHtmlTags(text, { |
342 text = replaceInHtmlTags(text, { |
264 '\n': ' <!-- wpnl --> ' |
343 '\n': ' <!-- wpnl --> ' |
310 |
389 |
311 text = text.replace(/<p>\s*<\/p>/g, ''); // Add a closing <p> inside <div>, <address>, or <form> tag if missing. |
390 text = text.replace(/<p>\s*<\/p>/g, ''); // Add a closing <p> inside <div>, <address>, or <form> tag if missing. |
312 |
391 |
313 text = text.replace(/<p>([^<]+)<\/(div|address|form)>/g, '<p>$1</p></$2>'); // If an opening or closing block element tag is wrapped in a <p>, unwrap it. |
392 text = text.replace(/<p>([^<]+)<\/(div|address|form)>/g, '<p>$1</p></$2>'); // If an opening or closing block element tag is wrapped in a <p>, unwrap it. |
314 |
393 |
315 text = text.replace(new RegExp('<p>\\s*(<\/?' + allBlocks + '[^>]*>)\\s*<\/p>', 'g'), '$1'); // In some cases <li> may get wrapped in <p>, fix them. |
394 text = text.replace(new RegExp('<p>\\s*(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1'); // In some cases <li> may get wrapped in <p>, fix them. |
316 |
395 |
317 text = text.replace(/<p>(<li.+?)<\/p>/g, '$1'); // If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>. |
396 text = text.replace(/<p>(<li.+?)<\/p>/g, '$1'); // If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>. |
318 |
397 |
319 text = text.replace(/<p><blockquote([^>]*)>/gi, '<blockquote$1><p>'); |
398 text = text.replace(/<p><blockquote([^>]*)>/gi, '<blockquote$1><p>'); |
320 text = text.replace(/<\/blockquote><\/p>/g, '</p></blockquote>'); // If an opening or closing block element tag is preceded by an opening <p> tag, remove it. |
399 text = text.replace(/<\/blockquote><\/p>/g, '</p></blockquote>'); // If an opening or closing block element tag is preceded by an opening <p> tag, remove it. |
321 |
400 |
322 text = text.replace(new RegExp('<p>\\s*(<\/?' + allBlocks + '[^>]*>)', 'g'), '$1'); // If an opening or closing block element tag is followed by a closing <p> tag, remove it. |
401 text = text.replace(new RegExp('<p>\\s*(</?' + allBlocks + '[^>]*>)', 'g'), '$1'); // If an opening or closing block element tag is followed by a closing <p> tag, remove it. |
323 |
402 |
324 text = text.replace(new RegExp('(<\/?' + allBlocks + '[^>]*>)\\s*<\/p>', 'g'), '$1'); // Optionally insert line breaks. |
403 text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1'); // Optionally insert line breaks. |
325 |
404 |
326 if (br) { |
405 if (br) { |
327 // Replace newlines that shouldn't be touched with a placeholder. |
406 // Replace newlines that shouldn't be touched with a placeholder. |
328 text = text.replace(/<(script|style).*?<\/\\1>/g, function (match) { |
407 text = text.replace(/<(script|style).*?<\/\\1>/g, function (match) { |
329 return match[0].replace(/\n/g, '<WPPreserveNewline />'); |
408 return match[0].replace(/\n/g, '<WPPreserveNewline />'); |
337 |
416 |
338 text = text.replace(/<WPPreserveNewline \/>/g, '\n'); |
417 text = text.replace(/<WPPreserveNewline \/>/g, '\n'); |
339 } // If a <br /> tag is after an opening or closing block tag, remove it. |
418 } // If a <br /> tag is after an opening or closing block tag, remove it. |
340 |
419 |
341 |
420 |
342 text = text.replace(new RegExp('(<\/?' + allBlocks + '[^>]*>)\\s*<br \/>', 'g'), '$1'); // If a <br /> tag is before a subset of opening or closing block tags, remove it. |
421 text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*<br />', 'g'), '$1'); // If a <br /> tag is before a subset of opening or closing block tags, remove it. |
343 |
422 |
344 text = text.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1'); |
423 text = text.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1'); |
345 text = text.replace(/\n<\/p>$/g, '</p>'); // Replace placeholder <pre> tags with their original content. |
424 text = text.replace(/\n<\/p>$/g, '</p>'); // Replace placeholder <pre> tags with their original content. |
346 |
425 |
347 preTags.forEach(function (preTag) { |
426 preTags.forEach(function (preTag) { |
415 |
496 |
416 |
497 |
417 html = html.replace(new RegExp('\\s*</(' + blocklist1 + ')>\\s*', 'g'), '</$1>\n'); |
498 html = html.replace(new RegExp('\\s*</(' + blocklist1 + ')>\\s*', 'g'), '</$1>\n'); |
418 html = html.replace(new RegExp('\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g'), '\n<$1>'); // Mark </p> if it has any attributes. |
499 html = html.replace(new RegExp('\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g'), '\n<$1>'); // Mark </p> if it has any attributes. |
419 |
500 |
420 html = html.replace(/(<p [^>]+>.*?)<\/p>/g, '$1</p#>'); // Preserve the first <p> inside a <div>. |
501 html = html.replace(/(<p [^>]+>[\s\S]*?)<\/p>/g, '$1</p#>'); // Preserve the first <p> inside a <div>. |
421 |
502 |
422 html = html.replace(/<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n'); // Remove paragraph tags. |
503 html = html.replace(/<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n'); // Remove paragraph tags. |
423 |
504 |
424 html = html.replace(/\s*<p>/gi, ''); |
505 html = html.replace(/\s*<p>/gi, ''); |
425 html = html.replace(/\s*<\/p>\s*/gi, '\n\n'); // Normalize white space chars and remove multiple line breaks. |
506 html = html.replace(/\s*<\/p>\s*/gi, '\n\n'); // Normalize white space chars and remove multiple line breaks. |
426 |
507 |
427 html = html.replace(/\n[\s\u00a0]+\n/g, '\n\n'); // Replace <br> tags with line breaks. |
508 html = html.replace(/\n[\s\u00a0]+\n/g, '\n\n'); // Replace <br> tags with line breaks. |
428 |
509 |
429 html = html.replace(/(\s*)<br ?\/?>\s*/gi, function (match, space) { |
510 html = html.replace(/(\s*)<br ?\/?>\s*/gi, function (_, space) { |
430 if (space && space.indexOf('\n') !== -1) { |
511 if (space && space.indexOf('\n') !== -1) { |
431 return '\n\n'; |
512 return '\n\n'; |
432 } |
513 } |
433 |
514 |
434 return '\n'; |
515 return '\n'; |
479 } // Restore preserved tags. |
560 } // Restore preserved tags. |
480 |
561 |
481 |
562 |
482 if (preserve.length) { |
563 if (preserve.length) { |
483 html = html.replace(/<wp-preserve>/g, function () { |
564 html = html.replace(/<wp-preserve>/g, function () { |
484 return preserve.shift(); |
565 return ( |
|
566 /** @type {string} */ |
|
567 preserve.shift() |
|
568 ); |
485 }); |
569 }); |
486 } |
570 } |
487 |
571 |
488 return html; |
572 return html; |
489 } |
573 } |
490 |
574 |
491 |
575 |
492 /***/ }), |
576 /***/ }), |
493 |
577 |
494 /***/ 28: |
578 /***/ 29: |
495 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
579 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
496 |
580 |
497 "use strict"; |
581 "use strict"; |
498 |
582 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
499 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
583 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
500 var arrayWithHoles = __webpack_require__(37); |
584 |
501 |
585 function _unsupportedIterableToArray(o, minLen) { |
502 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
586 if (!o) return; |
503 function _iterableToArrayLimit(arr, i) { |
587 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
504 var _arr = []; |
588 var n = Object.prototype.toString.call(o).slice(8, -1); |
505 var _n = true; |
589 if (n === "Object" && o.constructor) n = o.constructor.name; |
506 var _d = false; |
590 if (n === "Map" || n === "Set") return Array.from(o); |
507 var _e = undefined; |
591 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
508 |
|
509 try { |
|
510 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
511 _arr.push(_s.value); |
|
512 |
|
513 if (i && _arr.length === i) break; |
|
514 } |
|
515 } catch (err) { |
|
516 _d = true; |
|
517 _e = err; |
|
518 } finally { |
|
519 try { |
|
520 if (!_n && _i["return"] != null) _i["return"](); |
|
521 } finally { |
|
522 if (_d) throw _e; |
|
523 } |
|
524 } |
|
525 |
|
526 return _arr; |
|
527 } |
|
528 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
529 var nonIterableRest = __webpack_require__(38); |
|
530 |
|
531 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
532 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); |
|
533 |
|
534 |
|
535 |
|
536 function _slicedToArray(arr, i) { |
|
537 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
538 } |
592 } |
539 |
593 |
540 /***/ }), |
594 /***/ }), |
541 |
595 |
542 /***/ 37: |
596 /***/ 38: |
543 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
597 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
544 |
598 |
545 "use strict"; |
599 "use strict"; |
546 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
600 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
547 function _arrayWithHoles(arr) { |
601 function _arrayWithHoles(arr) { |
548 if (Array.isArray(arr)) return arr; |
602 if (Array.isArray(arr)) return arr; |
549 } |
603 } |
550 |
604 |
551 /***/ }), |
605 /***/ }), |
552 |
606 |
553 /***/ 38: |
607 /***/ 39: |
554 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
608 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
555 |
609 |
556 "use strict"; |
610 "use strict"; |
557 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
611 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
558 function _nonIterableRest() { |
612 function _nonIterableRest() { |
559 throw new TypeError("Invalid attempt to destructure non-iterable instance"); |
613 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
560 } |
614 } |
561 |
615 |
562 /***/ }) |
616 /***/ }) |
563 |
617 |
564 /******/ }); |
618 /******/ }); |