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 = 303); |
85 /******/ return __webpack_require__(__webpack_require__.s = "SiJt"); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 14: |
90 /***/ "SiJt": |
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 /***/ 29: |
|
163 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
164 |
|
165 "use strict"; |
|
166 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
|
167 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
|
168 |
|
169 function _unsupportedIterableToArray(o, minLen) { |
|
170 if (!o) return; |
|
171 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
172 var n = Object.prototype.toString.call(o).slice(8, -1); |
|
173 if (n === "Object" && o.constructor) n = o.constructor.name; |
|
174 if (n === "Map" || n === "Set") return Array.from(o); |
|
175 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
176 } |
|
177 |
|
178 /***/ }), |
|
179 |
|
180 /***/ 303: |
|
181 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
182 |
92 |
183 "use strict"; |
93 "use strict"; |
184 __webpack_require__.r(__webpack_exports__); |
94 __webpack_require__.r(__webpack_exports__); |
185 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; }); |
95 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; }); |
186 /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); |
96 let document; |
187 |
97 let offset; |
188 var document; |
98 let output; |
189 var offset; |
99 let stack; |
190 var output; |
|
191 var stack; |
|
192 /** |
100 /** |
193 * Matches block comment delimiters |
101 * Matches block comment delimiters |
194 * |
102 * |
195 * While most of this pattern is straightforward the attribute parsing |
103 * While most of this pattern is straightforward the attribute parsing |
196 * incorporates a tricks to make sure we don't choke on specific input |
104 * incorporates a tricks to make sure we don't choke on specific input |
229 * |
137 * |
230 * @since 3.8.0 |
138 * @since 3.8.0 |
231 * @since 4.6.1 added optimization to prevent backtracking on attribute parsing |
139 * @since 4.6.1 added optimization to prevent backtracking on attribute parsing |
232 */ |
140 */ |
233 |
141 |
234 var tokenizer = /<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g; |
142 const tokenizer = /<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g; |
235 |
143 |
236 function Block(blockName, attrs, innerBlocks, innerHTML, innerContent) { |
144 function Block(blockName, attrs, innerBlocks, innerHTML, innerContent) { |
237 return { |
145 return { |
238 blockName: blockName, |
146 blockName, |
239 attrs: attrs, |
147 attrs, |
240 innerBlocks: innerBlocks, |
148 innerBlocks, |
241 innerHTML: innerHTML, |
149 innerHTML, |
242 innerContent: innerContent |
150 innerContent |
243 }; |
151 }; |
244 } |
152 } |
245 |
153 |
246 function Freeform(innerHTML) { |
154 function Freeform(innerHTML) { |
247 return Block(null, {}, [], innerHTML, [innerHTML]); |
155 return Block(null, {}, [], innerHTML, [innerHTML]); |
248 } |
156 } |
249 |
157 |
250 function Frame(block, tokenStart, tokenLength, prevOffset, leadingHtmlStart) { |
158 function Frame(block, tokenStart, tokenLength, prevOffset, leadingHtmlStart) { |
251 return { |
159 return { |
252 block: block, |
160 block, |
253 tokenStart: tokenStart, |
161 tokenStart, |
254 tokenLength: tokenLength, |
162 tokenLength, |
255 prevOffset: prevOffset || tokenStart + tokenLength, |
163 prevOffset: prevOffset || tokenStart + tokenLength, |
256 leadingHtmlStart: leadingHtmlStart |
164 leadingHtmlStart |
257 }; |
165 }; |
258 } |
166 } |
259 /** |
167 /** |
260 * Parser function, that converts input HTML into a block based structure. |
168 * Parser function, that converts input HTML into a block based structure. |
261 * |
169 * |
347 |
255 |
348 return output; |
256 return output; |
349 }; |
257 }; |
350 |
258 |
351 function proceed() { |
259 function proceed() { |
352 var next = nextToken(); |
260 const next = nextToken(); |
353 |
261 const [tokenType, blockName, attrs, startOffset, tokenLength] = next; |
354 var _next = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(next, 5), |
262 const stackDepth = stack.length; // we may have some HTML soup before the next block |
355 tokenType = _next[0], |
263 |
356 blockName = _next[1], |
264 const leadingHtmlStart = startOffset > offset ? offset : null; |
357 attrs = _next[2], |
|
358 startOffset = _next[3], |
|
359 tokenLength = _next[4]; |
|
360 |
|
361 var stackDepth = stack.length; // we may have some HTML soup before the next block |
|
362 |
|
363 var leadingHtmlStart = startOffset > offset ? offset : null; |
|
364 |
265 |
365 switch (tokenType) { |
266 switch (tokenType) { |
366 case 'no-more-tokens': |
267 case 'no-more-tokens': |
367 // if not in a block then flush output |
268 // if not in a block then flush output |
368 if (0 === stackDepth) { |
269 if (0 === stackDepth) { |
433 return true; |
334 return true; |
434 } // otherwise we're nested and we have to close out the current |
335 } // otherwise we're nested and we have to close out the current |
435 // block and add it as a innerBlock to the parent |
336 // block and add it as a innerBlock to the parent |
436 |
337 |
437 |
338 |
438 var stackTop = stack.pop(); |
339 const stackTop = stack.pop(); |
439 var html = document.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); |
340 const html = document.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); |
440 stackTop.block.innerHTML += html; |
341 stackTop.block.innerHTML += html; |
441 stackTop.block.innerContent.push(html); |
342 stackTop.block.innerContent.push(html); |
442 stackTop.prevOffset = startOffset + tokenLength; |
343 stackTop.prevOffset = startOffset + tokenLength; |
443 addInnerBlock(stackTop.block, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength); |
344 addInnerBlock(stackTop.block, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength); |
444 offset = startOffset + tokenLength; |
345 offset = startOffset + tokenLength; |
474 // aye the magic |
375 // aye the magic |
475 // we're using a single RegExp to tokenize the block comment delimiters |
376 // we're using a single RegExp to tokenize the block comment delimiters |
476 // we're also using a trick here because the only difference between a |
377 // we're also using a trick here because the only difference between a |
477 // block opener and a block closer is the leading `/` before `wp:` (and |
378 // block opener and a block closer is the leading `/` before `wp:` (and |
478 // a closer has no attributes). we can trap them both and process the |
379 // a closer has no attributes). we can trap them both and process the |
479 // match back in Javascript to see which one it was. |
380 // match back in JavaScript to see which one it was. |
480 var matches = tokenizer.exec(document); // we have no more tokens |
381 const matches = tokenizer.exec(document); // we have no more tokens |
481 |
382 |
482 if (null === matches) { |
383 if (null === matches) { |
483 return ['no-more-tokens']; |
384 return ['no-more-tokens']; |
484 } |
385 } |
485 |
386 |
486 var startedAt = matches.index; |
387 const startedAt = matches.index; |
487 |
388 const [match, closerMatch, namespaceMatch, nameMatch, attrsMatch |
488 var _matches = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(matches, 7), |
|
489 match = _matches[0], |
|
490 closerMatch = _matches[1], |
|
491 namespaceMatch = _matches[2], |
|
492 nameMatch = _matches[3], |
|
493 attrsMatch |
|
494 /* internal/unused */ |
389 /* internal/unused */ |
495 = _matches[4], |
390 ,, voidMatch] = matches; |
496 voidMatch = _matches[6]; |
391 const length = match.length; |
497 |
392 const isCloser = !!closerMatch; |
498 var length = match.length; |
393 const isVoid = !!voidMatch; |
499 var isCloser = !!closerMatch; |
394 const namespace = namespaceMatch || 'core/'; |
500 var isVoid = !!voidMatch; |
395 const name = namespace + nameMatch; |
501 var namespace = namespaceMatch || 'core/'; |
396 const hasAttrs = !!attrsMatch; |
502 var name = namespace + nameMatch; |
397 const attrs = hasAttrs ? parseJSON(attrsMatch) : {}; // This state isn't allowed |
503 var hasAttrs = !!attrsMatch; |
|
504 var attrs = hasAttrs ? parseJSON(attrsMatch) : {}; // This state isn't allowed |
|
505 // This is an error |
398 // This is an error |
506 |
399 |
507 if (isCloser && (isVoid || hasAttrs)) {// we can ignore them since they don't hurt anything |
400 if (isCloser && (isVoid || hasAttrs)) {// we can ignore them since they don't hurt anything |
508 // we may warn against this at some point or reject it |
401 // we may warn against this at some point or reject it |
509 } |
402 } |
518 |
411 |
519 return ['block-opener', name, attrs, startedAt, length]; |
412 return ['block-opener', name, attrs, startedAt, length]; |
520 } |
413 } |
521 |
414 |
522 function addFreeform(rawLength) { |
415 function addFreeform(rawLength) { |
523 var length = rawLength ? rawLength : document.length - offset; |
416 const length = rawLength ? rawLength : document.length - offset; |
524 |
417 |
525 if (0 === length) { |
418 if (0 === length) { |
526 return; |
419 return; |
527 } |
420 } |
528 |
421 |
529 output.push(Freeform(document.substr(offset, length))); |
422 output.push(Freeform(document.substr(offset, length))); |
530 } |
423 } |
531 |
424 |
532 function addInnerBlock(block, tokenStart, tokenLength, lastOffset) { |
425 function addInnerBlock(block, tokenStart, tokenLength, lastOffset) { |
533 var parent = stack[stack.length - 1]; |
426 const parent = stack[stack.length - 1]; |
534 parent.block.innerBlocks.push(block); |
427 parent.block.innerBlocks.push(block); |
535 var html = document.substr(parent.prevOffset, tokenStart - parent.prevOffset); |
428 const html = document.substr(parent.prevOffset, tokenStart - parent.prevOffset); |
536 |
429 |
537 if (html) { |
430 if (html) { |
538 parent.block.innerHTML += html; |
431 parent.block.innerHTML += html; |
539 parent.block.innerContent.push(html); |
432 parent.block.innerContent.push(html); |
540 } |
433 } |
542 parent.block.innerContent.push(null); |
435 parent.block.innerContent.push(null); |
543 parent.prevOffset = lastOffset ? lastOffset : tokenStart + tokenLength; |
436 parent.prevOffset = lastOffset ? lastOffset : tokenStart + tokenLength; |
544 } |
437 } |
545 |
438 |
546 function addBlockFromStack(endOffset) { |
439 function addBlockFromStack(endOffset) { |
547 var _stack$pop = stack.pop(), |
440 const { |
548 block = _stack$pop.block, |
441 block, |
549 leadingHtmlStart = _stack$pop.leadingHtmlStart, |
442 leadingHtmlStart, |
550 prevOffset = _stack$pop.prevOffset, |
443 prevOffset, |
551 tokenStart = _stack$pop.tokenStart; |
444 tokenStart |
552 |
445 } = stack.pop(); |
553 var html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset); |
446 const html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset); |
554 |
447 |
555 if (html) { |
448 if (html) { |
556 block.innerHTML += html; |
449 block.innerHTML += html; |
557 block.innerContent.push(html); |
450 block.innerContent.push(html); |
558 } |
451 } |