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 = 374); |
85 /******/ return __webpack_require__(__webpack_require__.s = 453); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
|
90 /***/ 13: |
|
91 /***/ (function(module, exports) { |
|
92 |
|
93 (function() { module.exports = this["React"]; }()); |
|
94 |
|
95 /***/ }), |
|
96 |
|
97 /***/ 14: |
|
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
100 "use strict"; |
|
101 |
|
102 // EXPORTS |
|
103 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); |
|
104 |
|
105 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js |
|
106 var arrayWithHoles = __webpack_require__(38); |
|
107 |
|
108 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js |
|
109 function _iterableToArrayLimit(arr, i) { |
|
110 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; |
|
111 var _arr = []; |
|
112 var _n = true; |
|
113 var _d = false; |
|
114 var _e = undefined; |
|
115 |
|
116 try { |
|
117 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { |
|
118 _arr.push(_s.value); |
|
119 |
|
120 if (i && _arr.length === i) break; |
|
121 } |
|
122 } catch (err) { |
|
123 _d = true; |
|
124 _e = err; |
|
125 } finally { |
|
126 try { |
|
127 if (!_n && _i["return"] != null) _i["return"](); |
|
128 } finally { |
|
129 if (_d) throw _e; |
|
130 } |
|
131 } |
|
132 |
|
133 return _arr; |
|
134 } |
|
135 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
136 var unsupportedIterableToArray = __webpack_require__(29); |
|
137 |
|
138 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js |
|
139 var nonIterableRest = __webpack_require__(39); |
|
140 |
|
141 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 function _slicedToArray(arr, i) { |
|
147 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); |
|
148 } |
|
149 |
|
150 /***/ }), |
|
151 |
|
152 /***/ 144: |
|
153 /***/ (function(module, exports) { |
|
154 |
|
155 (function() { module.exports = this["ReactDOM"]; }()); |
|
156 |
|
157 /***/ }), |
|
158 |
90 /***/ 15: |
159 /***/ 15: |
|
160 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
161 |
|
162 "use strict"; |
|
163 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
|
164 /* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41); |
|
165 |
|
166 function _objectWithoutProperties(source, excluded) { |
|
167 if (source == null) return {}; |
|
168 var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); |
|
169 var key, i; |
|
170 |
|
171 if (Object.getOwnPropertySymbols) { |
|
172 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
173 |
|
174 for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
175 key = sourceSymbolKeys[i]; |
|
176 if (excluded.indexOf(key) >= 0) continue; |
|
177 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
178 target[key] = source[key]; |
|
179 } |
|
180 } |
|
181 |
|
182 return target; |
|
183 } |
|
184 |
|
185 /***/ }), |
|
186 |
|
187 /***/ 18: |
|
188 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
189 |
|
190 "use strict"; |
|
191 |
|
192 // EXPORTS |
|
193 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); |
|
194 |
|
195 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js |
|
196 var arrayLikeToArray = __webpack_require__(26); |
|
197 |
|
198 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
199 |
|
200 function _arrayWithoutHoles(arr) { |
|
201 if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); |
|
202 } |
|
203 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
204 var iterableToArray = __webpack_require__(35); |
|
205 |
|
206 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js |
|
207 var unsupportedIterableToArray = __webpack_require__(29); |
|
208 |
|
209 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
210 function _nonIterableSpread() { |
|
211 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
212 } |
|
213 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 function _toConsumableArray(arr) { |
|
219 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
220 } |
|
221 |
|
222 /***/ }), |
|
223 |
|
224 /***/ 2: |
|
225 /***/ (function(module, exports) { |
|
226 |
|
227 (function() { module.exports = this["lodash"]; }()); |
|
228 |
|
229 /***/ }), |
|
230 |
|
231 /***/ 26: |
|
232 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
233 |
|
234 "use strict"; |
|
235 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); |
|
236 function _arrayLikeToArray(arr, len) { |
|
237 if (len == null || len > arr.length) len = arr.length; |
|
238 |
|
239 for (var i = 0, arr2 = new Array(len); i < len; i++) { |
|
240 arr2[i] = arr[i]; |
|
241 } |
|
242 |
|
243 return arr2; |
|
244 } |
|
245 |
|
246 /***/ }), |
|
247 |
|
248 /***/ 29: |
|
249 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
250 |
|
251 "use strict"; |
|
252 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); |
|
253 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); |
|
254 |
|
255 function _unsupportedIterableToArray(o, minLen) { |
|
256 if (!o) return; |
|
257 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
258 var n = Object.prototype.toString.call(o).slice(8, -1); |
|
259 if (n === "Object" && o.constructor) n = o.constructor.name; |
|
260 if (n === "Map" || n === "Set") return Array.from(o); |
|
261 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); |
|
262 } |
|
263 |
|
264 /***/ }), |
|
265 |
|
266 /***/ 35: |
|
267 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
268 |
|
269 "use strict"; |
|
270 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
271 function _iterableToArray(iter) { |
|
272 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); |
|
273 } |
|
274 |
|
275 /***/ }), |
|
276 |
|
277 /***/ 38: |
|
278 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
279 |
|
280 "use strict"; |
|
281 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); |
|
282 function _arrayWithHoles(arr) { |
|
283 if (Array.isArray(arr)) return arr; |
|
284 } |
|
285 |
|
286 /***/ }), |
|
287 |
|
288 /***/ 39: |
|
289 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
290 |
|
291 "use strict"; |
|
292 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); |
|
293 function _nonIterableRest() { |
|
294 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
|
295 } |
|
296 |
|
297 /***/ }), |
|
298 |
|
299 /***/ 40: |
|
300 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
301 |
|
302 "use strict"; |
|
303 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
|
304 function _typeof(obj) { |
|
305 "@babel/helpers - typeof"; |
|
306 |
|
307 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { |
|
308 _typeof = function _typeof(obj) { |
|
309 return typeof obj; |
|
310 }; |
|
311 } else { |
|
312 _typeof = function _typeof(obj) { |
|
313 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
|
314 }; |
|
315 } |
|
316 |
|
317 return _typeof(obj); |
|
318 } |
|
319 |
|
320 /***/ }), |
|
321 |
|
322 /***/ 41: |
|
323 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
324 |
|
325 "use strict"; |
|
326 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); |
|
327 function _objectWithoutPropertiesLoose(source, excluded) { |
|
328 if (source == null) return {}; |
|
329 var target = {}; |
|
330 var sourceKeys = Object.keys(source); |
|
331 var key, i; |
|
332 |
|
333 for (i = 0; i < sourceKeys.length; i++) { |
|
334 key = sourceKeys[i]; |
|
335 if (excluded.indexOf(key) >= 0) continue; |
|
336 target[key] = source[key]; |
|
337 } |
|
338 |
|
339 return target; |
|
340 } |
|
341 |
|
342 /***/ }), |
|
343 |
|
344 /***/ 453: |
|
345 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
346 |
|
347 "use strict"; |
|
348 // ESM COMPAT FLAG |
|
349 __webpack_require__.r(__webpack_exports__); |
|
350 |
|
351 // EXPORTS |
|
352 __webpack_require__.d(__webpack_exports__, "createInterpolateElement", function() { return /* reexport */ create_interpolate_element; }); |
|
353 __webpack_require__.d(__webpack_exports__, "Children", function() { return /* reexport */ external_this_React_["Children"]; }); |
|
354 __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return /* reexport */ external_this_React_["cloneElement"]; }); |
|
355 __webpack_require__.d(__webpack_exports__, "Component", function() { return /* reexport */ external_this_React_["Component"]; }); |
|
356 __webpack_require__.d(__webpack_exports__, "createContext", function() { return /* reexport */ external_this_React_["createContext"]; }); |
|
357 __webpack_require__.d(__webpack_exports__, "createElement", function() { return /* reexport */ external_this_React_["createElement"]; }); |
|
358 __webpack_require__.d(__webpack_exports__, "createRef", function() { return /* reexport */ external_this_React_["createRef"]; }); |
|
359 __webpack_require__.d(__webpack_exports__, "forwardRef", function() { return /* reexport */ external_this_React_["forwardRef"]; }); |
|
360 __webpack_require__.d(__webpack_exports__, "Fragment", function() { return /* reexport */ external_this_React_["Fragment"]; }); |
|
361 __webpack_require__.d(__webpack_exports__, "isValidElement", function() { return /* reexport */ external_this_React_["isValidElement"]; }); |
|
362 __webpack_require__.d(__webpack_exports__, "memo", function() { return /* reexport */ external_this_React_["memo"]; }); |
|
363 __webpack_require__.d(__webpack_exports__, "StrictMode", function() { return /* reexport */ external_this_React_["StrictMode"]; }); |
|
364 __webpack_require__.d(__webpack_exports__, "useCallback", function() { return /* reexport */ external_this_React_["useCallback"]; }); |
|
365 __webpack_require__.d(__webpack_exports__, "useContext", function() { return /* reexport */ external_this_React_["useContext"]; }); |
|
366 __webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return /* reexport */ external_this_React_["useDebugValue"]; }); |
|
367 __webpack_require__.d(__webpack_exports__, "useEffect", function() { return /* reexport */ external_this_React_["useEffect"]; }); |
|
368 __webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return /* reexport */ external_this_React_["useImperativeHandle"]; }); |
|
369 __webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return /* reexport */ external_this_React_["useLayoutEffect"]; }); |
|
370 __webpack_require__.d(__webpack_exports__, "useMemo", function() { return /* reexport */ external_this_React_["useMemo"]; }); |
|
371 __webpack_require__.d(__webpack_exports__, "useReducer", function() { return /* reexport */ external_this_React_["useReducer"]; }); |
|
372 __webpack_require__.d(__webpack_exports__, "useRef", function() { return /* reexport */ external_this_React_["useRef"]; }); |
|
373 __webpack_require__.d(__webpack_exports__, "useState", function() { return /* reexport */ external_this_React_["useState"]; }); |
|
374 __webpack_require__.d(__webpack_exports__, "lazy", function() { return /* reexport */ external_this_React_["lazy"]; }); |
|
375 __webpack_require__.d(__webpack_exports__, "Suspense", function() { return /* reexport */ external_this_React_["Suspense"]; }); |
|
376 __webpack_require__.d(__webpack_exports__, "concatChildren", function() { return /* reexport */ concatChildren; }); |
|
377 __webpack_require__.d(__webpack_exports__, "switchChildrenNodeName", function() { return /* reexport */ switchChildrenNodeName; }); |
|
378 __webpack_require__.d(__webpack_exports__, "createPortal", function() { return /* reexport */ external_this_ReactDOM_["createPortal"]; }); |
|
379 __webpack_require__.d(__webpack_exports__, "findDOMNode", function() { return /* reexport */ external_this_ReactDOM_["findDOMNode"]; }); |
|
380 __webpack_require__.d(__webpack_exports__, "render", function() { return /* reexport */ external_this_ReactDOM_["render"]; }); |
|
381 __webpack_require__.d(__webpack_exports__, "unmountComponentAtNode", function() { return /* reexport */ external_this_ReactDOM_["unmountComponentAtNode"]; }); |
|
382 __webpack_require__.d(__webpack_exports__, "isEmptyElement", function() { return /* reexport */ utils_isEmptyElement; }); |
|
383 __webpack_require__.d(__webpack_exports__, "Platform", function() { return /* reexport */ platform; }); |
|
384 __webpack_require__.d(__webpack_exports__, "renderToString", function() { return /* reexport */ serialize; }); |
|
385 __webpack_require__.d(__webpack_exports__, "RawHTML", function() { return /* reexport */ RawHTML; }); |
|
386 |
|
387 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules |
|
388 var slicedToArray = __webpack_require__(14); |
|
389 |
|
390 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js |
|
391 var esm_typeof = __webpack_require__(40); |
|
392 |
|
393 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
394 var toConsumableArray = __webpack_require__(18); |
|
395 |
|
396 // EXTERNAL MODULE: external {"this":"React"} |
|
397 var external_this_React_ = __webpack_require__(13); |
|
398 |
|
399 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/create-interpolate-element.js |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 /** |
|
405 * External dependencies |
|
406 */ |
|
407 |
|
408 /** @typedef {import('./react').WPElement} WPElement */ |
|
409 |
|
410 var indoc, offset, output, stack; |
|
411 /** |
|
412 * Matches tags in the localized string |
|
413 * |
|
414 * This is used for extracting the tag pattern groups for parsing the localized |
|
415 * string and along with the map converting it to a react element. |
|
416 * |
|
417 * There are four references extracted using this tokenizer: |
|
418 * |
|
419 * match: Full match of the tag (i.e. <strong>, </strong>, <br/>) |
|
420 * isClosing: The closing slash, it it exists. |
|
421 * name: The name portion of the tag (strong, br) (if ) |
|
422 * isSelfClosed: The slash on a self closing tag, if it exists. |
|
423 * |
|
424 * @type {RegExp} |
|
425 */ |
|
426 |
|
427 var tokenizer = /<(\/)?(\w+)\s*(\/)?>/g; |
|
428 /** |
|
429 * The stack frame tracking parse progress. |
|
430 * |
|
431 * @typedef Frame |
|
432 * |
|
433 * @property {WPElement} element A parent element which may still have |
|
434 * @property {number} tokenStart Offset at which parent element first |
|
435 * appears. |
|
436 * @property {number} tokenLength Length of string marking start of parent |
|
437 * element. |
|
438 * @property {number} [prevOffset] Running offset at which parsing should |
|
439 * continue. |
|
440 * @property {number} [leadingTextStart] Offset at which last closing element |
|
441 * finished, used for finding text between |
|
442 * elements. |
|
443 * @property {WPElement[]} children Children. |
|
444 */ |
|
445 |
|
446 /** |
|
447 * Tracks recursive-descent parse state. |
|
448 * |
|
449 * This is a Stack frame holding parent elements until all children have been |
|
450 * parsed. |
|
451 * |
|
452 * @private |
|
453 * @param {WPElement} element A parent element which may still have |
|
454 * nested children not yet parsed. |
|
455 * @param {number} tokenStart Offset at which parent element first |
|
456 * appears. |
|
457 * @param {number} tokenLength Length of string marking start of parent |
|
458 * element. |
|
459 * @param {number} [prevOffset] Running offset at which parsing should |
|
460 * continue. |
|
461 * @param {number} [leadingTextStart] Offset at which last closing element |
|
462 * finished, used for finding text between |
|
463 * elements. |
|
464 * |
|
465 * @return {Frame} The stack frame tracking parse progress. |
|
466 */ |
|
467 |
|
468 function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) { |
|
469 return { |
|
470 element: element, |
|
471 tokenStart: tokenStart, |
|
472 tokenLength: tokenLength, |
|
473 prevOffset: prevOffset, |
|
474 leadingTextStart: leadingTextStart, |
|
475 children: [] |
|
476 }; |
|
477 } |
|
478 /** |
|
479 * This function creates an interpolated element from a passed in string with |
|
480 * specific tags matching how the string should be converted to an element via |
|
481 * the conversion map value. |
|
482 * |
|
483 * @example |
|
484 * For example, for the given string: |
|
485 * |
|
486 * "This is a <span>string</span> with <a>a link</a> and a self-closing |
|
487 * <CustomComponentB/> tag" |
|
488 * |
|
489 * You would have something like this as the conversionMap value: |
|
490 * |
|
491 * ```js |
|
492 * { |
|
493 * span: <span />, |
|
494 * a: <a href={ 'https://github.com' } />, |
|
495 * CustomComponentB: <CustomComponent />, |
|
496 * } |
|
497 * ``` |
|
498 * |
|
499 * @param {string} interpolatedString The interpolation string to be parsed. |
|
500 * @param {Object} conversionMap The map used to convert the string to |
|
501 * a react element. |
|
502 * @throws {TypeError} |
|
503 * @return {WPElement} A wp element. |
|
504 */ |
|
505 |
|
506 |
|
507 var create_interpolate_element_createInterpolateElement = function createInterpolateElement(interpolatedString, conversionMap) { |
|
508 indoc = interpolatedString; |
|
509 offset = 0; |
|
510 output = []; |
|
511 stack = []; |
|
512 tokenizer.lastIndex = 0; |
|
513 |
|
514 if (!create_interpolate_element_isValidConversionMap(conversionMap)) { |
|
515 throw new TypeError('The conversionMap provided is not valid. It must be an object with values that are WPElements'); |
|
516 } |
|
517 |
|
518 do {// twiddle our thumbs |
|
519 } while (proceed(conversionMap)); |
|
520 |
|
521 return external_this_React_["createElement"].apply(void 0, [external_this_React_["Fragment"], null].concat(Object(toConsumableArray["a" /* default */])(output))); |
|
522 }; |
|
523 /** |
|
524 * Validate conversion map. |
|
525 * |
|
526 * A map is considered valid if it's an object and every value in the object |
|
527 * is a WPElement |
|
528 * |
|
529 * @private |
|
530 * |
|
531 * @param {Object} conversionMap The map being validated. |
|
532 * |
|
533 * @return {boolean} True means the map is valid. |
|
534 */ |
|
535 |
|
536 |
|
537 var create_interpolate_element_isValidConversionMap = function isValidConversionMap(conversionMap) { |
|
538 var isObject = Object(esm_typeof["a" /* default */])(conversionMap) === 'object'; |
|
539 var values = isObject && Object.values(conversionMap); |
|
540 return isObject && values.length && values.every(function (element) { |
|
541 return Object(external_this_React_["isValidElement"])(element); |
|
542 }); |
|
543 }; |
|
544 /** |
|
545 * This is the iterator over the matches in the string. |
|
546 * |
|
547 * @private |
|
548 * |
|
549 * @param {Object} conversionMap The conversion map for the string. |
|
550 * |
|
551 * @return {boolean} true for continuing to iterate, false for finished. |
|
552 */ |
|
553 |
|
554 |
|
555 function proceed(conversionMap) { |
|
556 var next = nextToken(); |
|
557 |
|
558 var _next = Object(slicedToArray["a" /* default */])(next, 4), |
|
559 tokenType = _next[0], |
|
560 name = _next[1], |
|
561 startOffset = _next[2], |
|
562 tokenLength = _next[3]; |
|
563 |
|
564 var stackDepth = stack.length; |
|
565 var leadingTextStart = startOffset > offset ? offset : null; |
|
566 |
|
567 if (!conversionMap[name]) { |
|
568 addText(); |
|
569 return false; |
|
570 } |
|
571 |
|
572 switch (tokenType) { |
|
573 case 'no-more-tokens': |
|
574 if (stackDepth !== 0) { |
|
575 var _stack$pop = stack.pop(), |
|
576 stackLeadingText = _stack$pop.leadingTextStart, |
|
577 tokenStart = _stack$pop.tokenStart; |
|
578 |
|
579 output.push(indoc.substr(stackLeadingText, tokenStart)); |
|
580 } |
|
581 |
|
582 addText(); |
|
583 return false; |
|
584 |
|
585 case 'self-closed': |
|
586 if (0 === stackDepth) { |
|
587 if (null !== leadingTextStart) { |
|
588 output.push(indoc.substr(leadingTextStart, startOffset - leadingTextStart)); |
|
589 } |
|
590 |
|
591 output.push(conversionMap[name]); |
|
592 offset = startOffset + tokenLength; |
|
593 return true; |
|
594 } // otherwise we found an inner element |
|
595 |
|
596 |
|
597 addChild(createFrame(conversionMap[name], startOffset, tokenLength)); |
|
598 offset = startOffset + tokenLength; |
|
599 return true; |
|
600 |
|
601 case 'opener': |
|
602 stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart)); |
|
603 offset = startOffset + tokenLength; |
|
604 return true; |
|
605 |
|
606 case 'closer': |
|
607 // if we're not nesting then this is easy - close the block |
|
608 if (1 === stackDepth) { |
|
609 closeOuterElement(startOffset); |
|
610 offset = startOffset + tokenLength; |
|
611 return true; |
|
612 } // otherwise we're nested and we have to close out the current |
|
613 // block and add it as a innerBlock to the parent |
|
614 |
|
615 |
|
616 var stackTop = stack.pop(); |
|
617 var text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset); |
|
618 stackTop.children.push(text); |
|
619 stackTop.prevOffset = startOffset + tokenLength; |
|
620 var frame = createFrame(stackTop.element, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength); |
|
621 frame.children = stackTop.children; |
|
622 addChild(frame); |
|
623 offset = startOffset + tokenLength; |
|
624 return true; |
|
625 |
|
626 default: |
|
627 addText(); |
|
628 return false; |
|
629 } |
|
630 } |
|
631 /** |
|
632 * Grabs the next token match in the string and returns it's details. |
|
633 * |
|
634 * @private |
|
635 * |
|
636 * @return {Array} An array of details for the token matched. |
|
637 */ |
|
638 |
|
639 |
|
640 function nextToken() { |
|
641 var matches = tokenizer.exec(indoc); // we have no more tokens |
|
642 |
|
643 if (null === matches) { |
|
644 return ['no-more-tokens']; |
|
645 } |
|
646 |
|
647 var startedAt = matches.index; |
|
648 |
|
649 var _matches = Object(slicedToArray["a" /* default */])(matches, 4), |
|
650 match = _matches[0], |
|
651 isClosing = _matches[1], |
|
652 name = _matches[2], |
|
653 isSelfClosed = _matches[3]; |
|
654 |
|
655 var length = match.length; |
|
656 |
|
657 if (isSelfClosed) { |
|
658 return ['self-closed', name, startedAt, length]; |
|
659 } |
|
660 |
|
661 if (isClosing) { |
|
662 return ['closer', name, startedAt, length]; |
|
663 } |
|
664 |
|
665 return ['opener', name, startedAt, length]; |
|
666 } |
|
667 /** |
|
668 * Pushes text extracted from the indoc string to the output stack given the |
|
669 * current rawLength value and offset (if rawLength is provided ) or the |
|
670 * indoc.length and offset. |
|
671 * |
|
672 * @private |
|
673 */ |
|
674 |
|
675 |
|
676 function addText() { |
|
677 var length = indoc.length - offset; |
|
678 |
|
679 if (0 === length) { |
|
680 return; |
|
681 } |
|
682 |
|
683 output.push(indoc.substr(offset, length)); |
|
684 } |
|
685 /** |
|
686 * Pushes a child element to the associated parent element's children for the |
|
687 * parent currently active in the stack. |
|
688 * |
|
689 * @private |
|
690 * |
|
691 * @param {Frame} frame The Frame containing the child element and it's |
|
692 * token information. |
|
693 */ |
|
694 |
|
695 |
|
696 function addChild(frame) { |
|
697 var element = frame.element, |
|
698 tokenStart = frame.tokenStart, |
|
699 tokenLength = frame.tokenLength, |
|
700 prevOffset = frame.prevOffset, |
|
701 children = frame.children; |
|
702 var parent = stack[stack.length - 1]; |
|
703 var text = indoc.substr(parent.prevOffset, tokenStart - parent.prevOffset); |
|
704 |
|
705 if (text) { |
|
706 parent.children.push(text); |
|
707 } |
|
708 |
|
709 parent.children.push(external_this_React_["cloneElement"].apply(void 0, [element, null].concat(Object(toConsumableArray["a" /* default */])(children)))); |
|
710 parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength; |
|
711 } |
|
712 /** |
|
713 * This is called for closing tags. It creates the element currently active in |
|
714 * the stack. |
|
715 * |
|
716 * @private |
|
717 * |
|
718 * @param {number} endOffset Offset at which the closing tag for the element |
|
719 * begins in the string. If this is greater than the |
|
720 * prevOffset attached to the element, then this |
|
721 * helps capture any remaining nested text nodes in |
|
722 * the element. |
|
723 */ |
|
724 |
|
725 |
|
726 function closeOuterElement(endOffset) { |
|
727 var _stack$pop2 = stack.pop(), |
|
728 element = _stack$pop2.element, |
|
729 leadingTextStart = _stack$pop2.leadingTextStart, |
|
730 prevOffset = _stack$pop2.prevOffset, |
|
731 tokenStart = _stack$pop2.tokenStart, |
|
732 children = _stack$pop2.children; |
|
733 |
|
734 var text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset); |
|
735 |
|
736 if (text) { |
|
737 children.push(text); |
|
738 } |
|
739 |
|
740 if (null !== leadingTextStart) { |
|
741 output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart)); |
|
742 } |
|
743 |
|
744 output.push(external_this_React_["cloneElement"].apply(void 0, [element, null].concat(Object(toConsumableArray["a" /* default */])(children)))); |
|
745 } |
|
746 |
|
747 /* harmony default export */ var create_interpolate_element = (create_interpolate_element_createInterpolateElement); |
|
748 |
|
749 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
750 var defineProperty = __webpack_require__(5); |
|
751 |
|
752 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
753 var objectWithoutProperties = __webpack_require__(15); |
|
754 |
|
755 // EXTERNAL MODULE: external {"this":"lodash"} |
|
756 var external_this_lodash_ = __webpack_require__(2); |
|
757 |
|
758 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js |
|
759 |
|
760 |
|
761 |
|
762 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; } |
|
763 |
|
764 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; } |
|
765 |
|
766 /** |
|
767 * External dependencies |
|
768 */ |
|
769 |
|
770 |
|
771 /** |
|
772 * Object containing a React element. |
|
773 * |
|
774 * @typedef {import('react').ReactElement} WPElement |
|
775 */ |
|
776 |
|
777 /** |
|
778 * Object containing a React component. |
|
779 * |
|
780 * @typedef {import('react').ComponentType} WPComponent |
|
781 */ |
|
782 |
|
783 /** |
|
784 * Object containing a React synthetic event. |
|
785 * |
|
786 * @typedef {import('react').SyntheticEvent} WPSyntheticEvent |
|
787 */ |
|
788 |
|
789 /** |
|
790 * Object that provides utilities for dealing with React children. |
|
791 */ |
|
792 |
|
793 |
|
794 /** |
|
795 * Creates a copy of an element with extended props. |
|
796 * |
|
797 * @param {WPElement} element Element |
|
798 * @param {?Object} props Props to apply to cloned element |
|
799 * |
|
800 * @return {WPElement} Cloned element. |
|
801 */ |
|
802 |
|
803 |
|
804 /** |
|
805 * A base class to create WordPress Components (Refs, state and lifecycle hooks) |
|
806 */ |
|
807 |
|
808 |
|
809 /** |
|
810 * Creates a context object containing two components: a provider and consumer. |
|
811 * |
|
812 * @param {Object} defaultValue A default data stored in the context. |
|
813 * |
|
814 * @return {Object} Context object. |
|
815 */ |
|
816 |
|
817 |
|
818 /** |
|
819 * Returns a new element of given type. Type can be either a string tag name or |
|
820 * another function which itself returns an element. |
|
821 * |
|
822 * @param {?(string|Function)} type Tag name or element creator |
|
823 * @param {Object} props Element properties, either attribute |
|
824 * set to apply to DOM node or values to |
|
825 * pass through to element creator |
|
826 * @param {...WPElement} children Descendant elements |
|
827 * |
|
828 * @return {WPElement} Element. |
|
829 */ |
|
830 |
|
831 |
|
832 /** |
|
833 * Returns an object tracking a reference to a rendered element via its |
|
834 * `current` property as either a DOMElement or Element, dependent upon the |
|
835 * type of element rendered with the ref attribute. |
|
836 * |
|
837 * @return {Object} Ref object. |
|
838 */ |
|
839 |
|
840 |
|
841 /** |
|
842 * Component enhancer used to enable passing a ref to its wrapped component. |
|
843 * Pass a function argument which receives `props` and `ref` as its arguments, |
|
844 * returning an element using the forwarded ref. The return value is a new |
|
845 * component which forwards its ref. |
|
846 * |
|
847 * @param {Function} forwarder Function passed `props` and `ref`, expected to |
|
848 * return an element. |
|
849 * |
|
850 * @return {WPComponent} Enhanced component. |
|
851 */ |
|
852 |
|
853 |
|
854 /** |
|
855 * A component which renders its children without any wrapping element. |
|
856 */ |
|
857 |
|
858 |
|
859 /** |
|
860 * Checks if an object is a valid WPElement. |
|
861 * |
|
862 * @param {Object} objectToCheck The object to be checked. |
|
863 * |
|
864 * @return {boolean} true if objectToTest is a valid WPElement and false otherwise. |
|
865 */ |
|
866 |
|
867 |
|
868 /** |
|
869 * @see https://reactjs.org/docs/react-api.html#reactmemo |
|
870 */ |
|
871 |
|
872 |
|
873 /** |
|
874 * Component that activates additional checks and warnings for its descendants. |
|
875 */ |
|
876 |
|
877 |
|
878 /** |
|
879 * @see https://reactjs.org/docs/hooks-reference.html#usecallback |
|
880 */ |
|
881 |
|
882 |
|
883 /** |
|
884 * @see https://reactjs.org/docs/hooks-reference.html#usecontext |
|
885 */ |
|
886 |
|
887 |
|
888 /** |
|
889 * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue |
|
890 */ |
|
891 |
|
892 |
|
893 /** |
|
894 * @see https://reactjs.org/docs/hooks-reference.html#useeffect |
|
895 */ |
|
896 |
|
897 |
|
898 /** |
|
899 * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle |
|
900 */ |
|
901 |
|
902 |
|
903 /** |
|
904 * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect |
|
905 */ |
|
906 |
|
907 |
|
908 /** |
|
909 * @see https://reactjs.org/docs/hooks-reference.html#usememo |
|
910 */ |
|
911 |
|
912 |
|
913 /** |
|
914 * @see https://reactjs.org/docs/hooks-reference.html#usereducer |
|
915 */ |
|
916 |
|
917 |
|
918 /** |
|
919 * @see https://reactjs.org/docs/hooks-reference.html#useref |
|
920 */ |
|
921 |
|
922 |
|
923 /** |
|
924 * @see https://reactjs.org/docs/hooks-reference.html#usestate |
|
925 */ |
|
926 |
|
927 |
|
928 /** |
|
929 * @see https://reactjs.org/docs/react-api.html#reactlazy |
|
930 */ |
|
931 |
|
932 |
|
933 /** |
|
934 * @see https://reactjs.org/docs/react-api.html#reactsuspense |
|
935 */ |
|
936 |
|
937 |
|
938 /** |
|
939 * Concatenate two or more React children objects. |
|
940 * |
|
941 * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate. |
|
942 * |
|
943 * @return {Array} The concatenated value. |
|
944 */ |
|
945 |
|
946 function concatChildren() { |
|
947 for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) { |
|
948 childrenArguments[_key] = arguments[_key]; |
|
949 } |
|
950 |
|
951 return childrenArguments.reduce(function (accumulator, children, i) { |
|
952 external_this_React_["Children"].forEach(children, function (child, j) { |
|
953 if (child && 'string' !== typeof child) { |
|
954 child = Object(external_this_React_["cloneElement"])(child, { |
|
955 key: [i, j].join() |
|
956 }); |
|
957 } |
|
958 |
|
959 accumulator.push(child); |
|
960 }); |
|
961 return accumulator; |
|
962 }, []); |
|
963 } |
|
964 /** |
|
965 * Switches the nodeName of all the elements in the children object. |
|
966 * |
|
967 * @param {?Object} children Children object. |
|
968 * @param {string} nodeName Node name. |
|
969 * |
|
970 * @return {?Object} The updated children object. |
|
971 */ |
|
972 |
|
973 function switchChildrenNodeName(children, nodeName) { |
|
974 return children && external_this_React_["Children"].map(children, function (elt, index) { |
|
975 if (Object(external_this_lodash_["isString"])(elt)) { |
|
976 return Object(external_this_React_["createElement"])(nodeName, { |
|
977 key: index |
|
978 }, elt); |
|
979 } |
|
980 |
|
981 var _elt$props = elt.props, |
|
982 childrenProp = _elt$props.children, |
|
983 props = Object(objectWithoutProperties["a" /* default */])(_elt$props, ["children"]); |
|
984 |
|
985 return Object(external_this_React_["createElement"])(nodeName, _objectSpread({ |
|
986 key: index |
|
987 }, props), childrenProp); |
|
988 }); |
|
989 } |
|
990 |
|
991 // EXTERNAL MODULE: external {"this":"ReactDOM"} |
|
992 var external_this_ReactDOM_ = __webpack_require__(144); |
|
993 |
|
994 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js |
|
995 /** |
|
996 * External dependencies |
|
997 */ |
|
998 |
|
999 /** |
|
1000 * Creates a portal into which a component can be rendered. |
|
1001 * |
|
1002 * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235 |
|
1003 * |
|
1004 * @param {import('./react').WPElement} child Any renderable child, such as an element, |
|
1005 * string, or fragment. |
|
1006 * @param {HTMLElement} container DOM node into which element should be rendered. |
|
1007 */ |
|
1008 |
|
1009 |
|
1010 /** |
|
1011 * Finds the dom node of a React component. |
|
1012 * |
|
1013 * @param {import('./react').WPComponent} component Component's instance. |
|
1014 */ |
|
1015 |
|
1016 |
|
1017 /** |
|
1018 * Renders a given element into the target DOM node. |
|
1019 * |
|
1020 * @param {import('./react').WPElement} element Element to render. |
|
1021 * @param {HTMLElement} target DOM node into which element should be rendered. |
|
1022 */ |
|
1023 |
|
1024 |
|
1025 /** |
|
1026 * Removes any mounted element from the target DOM node. |
|
1027 * |
|
1028 * @param {Element} target DOM node in which element is to be removed |
|
1029 */ |
|
1030 |
|
1031 |
|
1032 |
|
1033 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js |
|
1034 /** |
|
1035 * External dependencies |
|
1036 */ |
|
1037 |
|
1038 /** |
|
1039 * Checks if the provided WP element is empty. |
|
1040 * |
|
1041 * @param {*} element WP element to check. |
|
1042 * @return {boolean} True when an element is considered empty. |
|
1043 */ |
|
1044 |
|
1045 var utils_isEmptyElement = function isEmptyElement(element) { |
|
1046 if (Object(external_this_lodash_["isNumber"])(element)) { |
|
1047 return false; |
|
1048 } |
|
1049 |
|
1050 if (Object(external_this_lodash_["isString"])(element) || Object(external_this_lodash_["isArray"])(element)) { |
|
1051 return !element.length; |
|
1052 } |
|
1053 |
|
1054 return !element; |
|
1055 }; |
|
1056 |
|
1057 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/platform.js |
|
1058 /** |
|
1059 * Parts of this source were derived and modified from react-native-web, |
|
1060 * released under the MIT license. |
|
1061 * |
|
1062 * Copyright (c) 2016-present, Nicolas Gallagher. |
|
1063 * Copyright (c) 2015-present, Facebook, Inc. |
|
1064 * |
|
1065 */ |
|
1066 var Platform = { |
|
1067 OS: 'web', |
|
1068 select: function select(spec) { |
|
1069 return 'web' in spec ? spec.web : spec.default; |
|
1070 } |
|
1071 }; |
|
1072 /** |
|
1073 * Component used to detect the current Platform being used. |
|
1074 * Use Platform.OS === 'web' to detect if running on web enviroment. |
|
1075 * |
|
1076 * This is the same concept as the React Native implementation. |
|
1077 * |
|
1078 * @see https://facebook.github.io/react-native/docs/platform-specific-code#platform-module |
|
1079 * |
|
1080 * Here is an example of how to use the select method: |
|
1081 * @example |
|
1082 * ```js |
|
1083 * import { Platform } from '@wordpress/element'; |
|
1084 * |
|
1085 * const placeholderLabel = Platform.select( { |
|
1086 * native: __( 'Add media' ), |
|
1087 * web: __( 'Drag images, upload new ones or select files from your library.' ), |
|
1088 * } ); |
|
1089 * ``` |
|
1090 */ |
|
1091 |
|
1092 /* harmony default export */ var platform = (Platform); |
|
1093 |
|
1094 // EXTERNAL MODULE: external {"this":["wp","escapeHtml"]} |
|
1095 var external_this_wp_escapeHtml_ = __webpack_require__(89); |
|
1096 |
|
1097 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js |
|
1098 |
|
1099 |
|
1100 |
|
1101 function raw_html_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; } |
|
1102 |
|
1103 function raw_html_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { raw_html_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 { raw_html_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
1104 |
|
1105 /** |
|
1106 * Internal dependencies |
|
1107 */ |
|
1108 // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly. |
|
1109 |
|
1110 /* eslint-disable jsdoc/valid-types */ |
|
1111 |
|
1112 /** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */ |
|
1113 |
|
1114 /* eslint-enable jsdoc/valid-types */ |
|
1115 |
|
1116 /** |
|
1117 * Component used as equivalent of Fragment with unescaped HTML, in cases where |
|
1118 * it is desirable to render dangerous HTML without needing a wrapper element. |
|
1119 * To preserve additional props, a `div` wrapper _will_ be created if any props |
|
1120 * aside from `children` are passed. |
|
1121 * |
|
1122 * @param {RawHTMLProps} props Children should be a string of HTML. Other props |
|
1123 * will be passed through to div wrapper. |
|
1124 * |
|
1125 * @return {JSX.Element} Dangerously-rendering component. |
|
1126 */ |
|
1127 |
|
1128 function RawHTML(_ref) { |
|
1129 var children = _ref.children, |
|
1130 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children"]); |
|
1131 |
|
1132 // The DIV wrapper will be stripped by serializer, unless there are |
|
1133 // non-children props present. |
|
1134 return Object(external_this_React_["createElement"])('div', raw_html_objectSpread({ |
|
1135 dangerouslySetInnerHTML: { |
|
1136 __html: children |
|
1137 } |
|
1138 }, props)); |
|
1139 } |
|
1140 |
|
1141 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 function serialize_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; } |
|
1147 |
|
1148 function serialize_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { serialize_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 { serialize_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } |
|
1149 |
|
1150 /** |
|
1151 * Parts of this source were derived and modified from fast-react-render, |
|
1152 * released under the MIT license. |
|
1153 * |
|
1154 * https://github.com/alt-j/fast-react-render |
|
1155 * |
|
1156 * Copyright (c) 2016 Andrey Morozov |
|
1157 * |
|
1158 * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
1159 * of this software and associated documentation files (the "Software"), to deal |
|
1160 * in the Software without restriction, including without limitation the rights |
|
1161 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
1162 * copies of the Software, and to permit persons to whom the Software is |
|
1163 * furnished to do so, subject to the following conditions: |
|
1164 * |
|
1165 * The above copyright notice and this permission notice shall be included in |
|
1166 * all copies or substantial portions of the Software. |
|
1167 * |
|
1168 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
1169 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
1170 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
1171 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
1172 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
1173 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
1174 * THE SOFTWARE. |
|
1175 */ |
|
1176 |
|
1177 /** |
|
1178 * External dependencies |
|
1179 */ |
|
1180 |
|
1181 /** |
|
1182 * WordPress dependencies |
|
1183 */ |
|
1184 |
|
1185 |
|
1186 /** |
|
1187 * Internal dependencies |
|
1188 */ |
|
1189 |
|
1190 |
|
1191 |
|
1192 /** @typedef {import('./react').WPElement} WPElement */ |
|
1193 |
|
1194 var _createContext = Object(external_this_React_["createContext"])(undefined), |
|
1195 Provider = _createContext.Provider, |
|
1196 Consumer = _createContext.Consumer; |
|
1197 |
|
1198 var ForwardRef = Object(external_this_React_["forwardRef"])(function () { |
|
1199 return null; |
|
1200 }); |
|
1201 /** |
|
1202 * Valid attribute types. |
|
1203 * |
|
1204 * @type {Set<string>} |
|
1205 */ |
|
1206 |
|
1207 var ATTRIBUTES_TYPES = new Set(['string', 'boolean', 'number']); |
|
1208 /** |
|
1209 * Element tags which can be self-closing. |
|
1210 * |
|
1211 * @type {Set<string>} |
|
1212 */ |
|
1213 |
|
1214 var SELF_CLOSING_TAGS = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']); |
|
1215 /** |
|
1216 * Boolean attributes are attributes whose presence as being assigned is |
|
1217 * meaningful, even if only empty. |
|
1218 * |
|
1219 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes |
|
1220 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
|
1221 * |
|
1222 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
|
1223 * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) |
|
1224 * .reduce( ( result, tr ) => Object.assign( result, { |
|
1225 * [ tr.firstChild.textContent.trim() ]: true |
|
1226 * } ), {} ) ).sort(); |
|
1227 * |
|
1228 * @type {Set<string>} |
|
1229 */ |
|
1230 |
|
1231 var BOOLEAN_ATTRIBUTES = new Set(['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']); |
|
1232 /** |
|
1233 * Enumerated attributes are attributes which must be of a specific value form. |
|
1234 * Like boolean attributes, these are meaningful if specified, even if not of a |
|
1235 * valid enumerated value. |
|
1236 * |
|
1237 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute |
|
1238 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
|
1239 * |
|
1240 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
|
1241 * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) |
|
1242 * .reduce( ( result, tr ) => Object.assign( result, { |
|
1243 * [ tr.firstChild.textContent.trim() ]: true |
|
1244 * } ), {} ) ).sort(); |
|
1245 * |
|
1246 * Some notable omissions: |
|
1247 * |
|
1248 * - `alt`: https://blog.whatwg.org/omit-alt |
|
1249 * |
|
1250 * @type {Set<string>} |
|
1251 */ |
|
1252 |
|
1253 var ENUMERATED_ATTRIBUTES = new Set(['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']); |
|
1254 /** |
|
1255 * Set of CSS style properties which support assignment of unitless numbers. |
|
1256 * Used in rendering of style properties, where `px` unit is assumed unless |
|
1257 * property is included in this set or value is zero. |
|
1258 * |
|
1259 * Generated via: |
|
1260 * |
|
1261 * Object.entries( document.createElement( 'div' ).style ) |
|
1262 * .filter( ( [ key ] ) => ( |
|
1263 * ! /^(webkit|ms|moz)/.test( key ) && |
|
1264 * ( e.style[ key ] = 10 ) && |
|
1265 * e.style[ key ] === '10' |
|
1266 * ) ) |
|
1267 * .map( ( [ key ] ) => key ) |
|
1268 * .sort(); |
|
1269 * |
|
1270 * @type {Set<string>} |
|
1271 */ |
|
1272 |
|
1273 var CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set(['animation', 'animationIterationCount', 'baselineShift', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'columnCount', 'cx', 'cy', 'fillOpacity', 'flexGrow', 'flexShrink', 'floodOpacity', 'fontWeight', 'gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'r', 'rx', 'ry', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'widows', 'x', 'y', 'zIndex', 'zoom']); |
|
1274 /** |
|
1275 * Returns true if the specified string is prefixed by one of an array of |
|
1276 * possible prefixes. |
|
1277 * |
|
1278 * @param {string} string String to check. |
|
1279 * @param {string[]} prefixes Possible prefixes. |
|
1280 * |
|
1281 * @return {boolean} Whether string has prefix. |
|
1282 */ |
|
1283 |
|
1284 function hasPrefix(string, prefixes) { |
|
1285 return prefixes.some(function (prefix) { |
|
1286 return string.indexOf(prefix) === 0; |
|
1287 }); |
|
1288 } |
|
1289 /** |
|
1290 * Returns true if the given prop name should be ignored in attributes |
|
1291 * serialization, or false otherwise. |
|
1292 * |
|
1293 * @param {string} attribute Attribute to check. |
|
1294 * |
|
1295 * @return {boolean} Whether attribute should be ignored. |
|
1296 */ |
|
1297 |
|
1298 function isInternalAttribute(attribute) { |
|
1299 return 'key' === attribute || 'children' === attribute; |
|
1300 } |
|
1301 /** |
|
1302 * Returns the normal form of the element's attribute value for HTML. |
|
1303 * |
|
1304 * @param {string} attribute Attribute name. |
|
1305 * @param {*} value Non-normalized attribute value. |
|
1306 * |
|
1307 * @return {*} Normalized attribute value. |
|
1308 */ |
|
1309 |
|
1310 |
|
1311 function getNormalAttributeValue(attribute, value) { |
|
1312 switch (attribute) { |
|
1313 case 'style': |
|
1314 return renderStyle(value); |
|
1315 } |
|
1316 |
|
1317 return value; |
|
1318 } |
|
1319 /** |
|
1320 * Returns the normal form of the element's attribute name for HTML. |
|
1321 * |
|
1322 * @param {string} attribute Non-normalized attribute name. |
|
1323 * |
|
1324 * @return {string} Normalized attribute name. |
|
1325 */ |
|
1326 |
|
1327 |
|
1328 function getNormalAttributeName(attribute) { |
|
1329 switch (attribute) { |
|
1330 case 'htmlFor': |
|
1331 return 'for'; |
|
1332 |
|
1333 case 'className': |
|
1334 return 'class'; |
|
1335 } |
|
1336 |
|
1337 return attribute.toLowerCase(); |
|
1338 } |
|
1339 /** |
|
1340 * Returns the normal form of the style property name for HTML. |
|
1341 * |
|
1342 * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color' |
|
1343 * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor' |
|
1344 * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform' |
|
1345 * |
|
1346 * @param {string} property Property name. |
|
1347 * |
|
1348 * @return {string} Normalized property name. |
|
1349 */ |
|
1350 |
|
1351 |
|
1352 function getNormalStylePropertyName(property) { |
|
1353 if (Object(external_this_lodash_["startsWith"])(property, '--')) { |
|
1354 return property; |
|
1355 } |
|
1356 |
|
1357 if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) { |
|
1358 return '-' + Object(external_this_lodash_["kebabCase"])(property); |
|
1359 } |
|
1360 |
|
1361 return Object(external_this_lodash_["kebabCase"])(property); |
|
1362 } |
|
1363 /** |
|
1364 * Returns the normal form of the style property value for HTML. Appends a |
|
1365 * default pixel unit if numeric, not a unitless property, and not zero. |
|
1366 * |
|
1367 * @param {string} property Property name. |
|
1368 * @param {*} value Non-normalized property value. |
|
1369 * |
|
1370 * @return {*} Normalized property value. |
|
1371 */ |
|
1372 |
|
1373 |
|
1374 function getNormalStylePropertyValue(property, value) { |
|
1375 if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) { |
|
1376 return value + 'px'; |
|
1377 } |
|
1378 |
|
1379 return value; |
|
1380 } |
|
1381 /** |
|
1382 * Serializes a React element to string. |
|
1383 * |
|
1384 * @param {import('react').ReactNode} element Element to serialize. |
|
1385 * @param {Object} [context] Context object. |
|
1386 * @param {Object} [legacyContext] Legacy context object. |
|
1387 * |
|
1388 * @return {string} Serialized element. |
|
1389 */ |
|
1390 |
|
1391 |
|
1392 function renderElement(element, context) { |
|
1393 var legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
1394 |
|
1395 if (null === element || undefined === element || false === element) { |
|
1396 return ''; |
|
1397 } |
|
1398 |
|
1399 if (Array.isArray(element)) { |
|
1400 return renderChildren(element, context, legacyContext); |
|
1401 } |
|
1402 |
|
1403 switch (Object(esm_typeof["a" /* default */])(element)) { |
|
1404 case 'string': |
|
1405 return Object(external_this_wp_escapeHtml_["escapeHTML"])(element); |
|
1406 |
|
1407 case 'number': |
|
1408 return element.toString(); |
|
1409 } |
|
1410 |
|
1411 var type = |
|
1412 /** @type {{type?: any, props?: any}} */ |
|
1413 element.type, |
|
1414 props = element.props; |
|
1415 |
|
1416 switch (type) { |
|
1417 case external_this_React_["StrictMode"]: |
|
1418 case external_this_React_["Fragment"]: |
|
1419 return renderChildren(props.children, context, legacyContext); |
|
1420 |
|
1421 case RawHTML: |
|
1422 var children = props.children, |
|
1423 wrapperProps = Object(objectWithoutProperties["a" /* default */])(props, ["children"]); |
|
1424 |
|
1425 return renderNativeComponent(Object(external_this_lodash_["isEmpty"])(wrapperProps) ? null : 'div', serialize_objectSpread({}, wrapperProps, { |
|
1426 dangerouslySetInnerHTML: { |
|
1427 __html: children |
|
1428 } |
|
1429 }), context, legacyContext); |
|
1430 } |
|
1431 |
|
1432 switch (Object(esm_typeof["a" /* default */])(type)) { |
|
1433 case 'string': |
|
1434 return renderNativeComponent(type, props, context, legacyContext); |
|
1435 |
|
1436 case 'function': |
|
1437 if (type.prototype && typeof type.prototype.render === 'function') { |
|
1438 return renderComponent(type, props, context, legacyContext); |
|
1439 } |
|
1440 |
|
1441 return renderElement(type(props, legacyContext), context, legacyContext); |
|
1442 } |
|
1443 |
|
1444 switch (type && type.$$typeof) { |
|
1445 case Provider.$$typeof: |
|
1446 return renderChildren(props.children, props.value, legacyContext); |
|
1447 |
|
1448 case Consumer.$$typeof: |
|
1449 return renderElement(props.children(context || type._currentValue), context, legacyContext); |
|
1450 |
|
1451 case ForwardRef.$$typeof: |
|
1452 return renderElement(type.render(props), context, legacyContext); |
|
1453 } |
|
1454 |
|
1455 return ''; |
|
1456 } |
|
1457 /** |
|
1458 * Serializes a native component type to string. |
|
1459 * |
|
1460 * @param {?string} type Native component type to serialize, or null if |
|
1461 * rendering as fragment of children content. |
|
1462 * @param {Object} props Props object. |
|
1463 * @param {Object} [context] Context object. |
|
1464 * @param {Object} [legacyContext] Legacy context object. |
|
1465 * |
|
1466 * @return {string} Serialized element. |
|
1467 */ |
|
1468 |
|
1469 function renderNativeComponent(type, props, context) { |
|
1470 var legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
1471 var content = ''; |
|
1472 |
|
1473 if (type === 'textarea' && props.hasOwnProperty('value')) { |
|
1474 // Textarea children can be assigned as value prop. If it is, render in |
|
1475 // place of children. Ensure to omit so it is not assigned as attribute |
|
1476 // as well. |
|
1477 content = renderChildren(props.value, context, legacyContext); |
|
1478 props = Object(external_this_lodash_["omit"])(props, 'value'); |
|
1479 } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') { |
|
1480 // Dangerous content is left unescaped. |
|
1481 content = props.dangerouslySetInnerHTML.__html; |
|
1482 } else if (typeof props.children !== 'undefined') { |
|
1483 content = renderChildren(props.children, context, legacyContext); |
|
1484 } |
|
1485 |
|
1486 if (!type) { |
|
1487 return content; |
|
1488 } |
|
1489 |
|
1490 var attributes = renderAttributes(props); |
|
1491 |
|
1492 if (SELF_CLOSING_TAGS.has(type)) { |
|
1493 return '<' + type + attributes + '/>'; |
|
1494 } |
|
1495 |
|
1496 return '<' + type + attributes + '>' + content + '</' + type + '>'; |
|
1497 } |
|
1498 /** @typedef {import('./react').WPComponent} WPComponent */ |
|
1499 |
|
1500 /** |
|
1501 * Serializes a non-native component type to string. |
|
1502 * |
|
1503 * @param {WPComponent} Component Component type to serialize. |
|
1504 * @param {Object} props Props object. |
|
1505 * @param {Object} [context] Context object. |
|
1506 * @param {Object} [legacyContext] Legacy context object. |
|
1507 * |
|
1508 * @return {string} Serialized element |
|
1509 */ |
|
1510 |
|
1511 function renderComponent(Component, props, context) { |
|
1512 var legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
1513 var instance = new |
|
1514 /** @type {import('react').ComponentClass} */ |
|
1515 Component(props, legacyContext); |
|
1516 |
|
1517 if (typeof // Ignore reason: Current prettier reformats parens and mangles type assertion |
|
1518 // prettier-ignore |
|
1519 |
|
1520 /** @type {{getChildContext?: () => unknown}} */ |
|
1521 instance.getChildContext === 'function') { |
|
1522 Object.assign(legacyContext, |
|
1523 /** @type {{getChildContext?: () => unknown}} */ |
|
1524 instance.getChildContext()); |
|
1525 } |
|
1526 |
|
1527 var html = renderElement(instance.render(), context, legacyContext); |
|
1528 return html; |
|
1529 } |
|
1530 /** |
|
1531 * Serializes an array of children to string. |
|
1532 * |
|
1533 * @param {import('react').ReactNodeArray} children Children to serialize. |
|
1534 * @param {Object} [context] Context object. |
|
1535 * @param {Object} [legacyContext] Legacy context object. |
|
1536 * |
|
1537 * @return {string} Serialized children. |
|
1538 */ |
|
1539 |
|
1540 function renderChildren(children, context) { |
|
1541 var legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
1542 var result = ''; |
|
1543 children = Object(external_this_lodash_["castArray"])(children); |
|
1544 |
|
1545 for (var i = 0; i < children.length; i++) { |
|
1546 var child = children[i]; |
|
1547 result += renderElement(child, context, legacyContext); |
|
1548 } |
|
1549 |
|
1550 return result; |
|
1551 } |
|
1552 /** |
|
1553 * Renders a props object as a string of HTML attributes. |
|
1554 * |
|
1555 * @param {Object} props Props object. |
|
1556 * |
|
1557 * @return {string} Attributes string. |
|
1558 */ |
|
1559 |
|
1560 |
|
1561 function renderAttributes(props) { |
|
1562 var result = ''; |
|
1563 |
|
1564 for (var key in props) { |
|
1565 var attribute = getNormalAttributeName(key); |
|
1566 |
|
1567 if (!Object(external_this_wp_escapeHtml_["isValidAttributeName"])(attribute)) { |
|
1568 continue; |
|
1569 } |
|
1570 |
|
1571 var value = getNormalAttributeValue(key, props[key]); // If value is not of serializeable type, skip. |
|
1572 |
|
1573 if (!ATTRIBUTES_TYPES.has(Object(esm_typeof["a" /* default */])(value))) { |
|
1574 continue; |
|
1575 } // Don't render internal attribute names. |
|
1576 |
|
1577 |
|
1578 if (isInternalAttribute(key)) { |
|
1579 continue; |
|
1580 } |
|
1581 |
|
1582 var isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute); // Boolean attribute should be omitted outright if its value is false. |
|
1583 |
|
1584 if (isBooleanAttribute && value === false) { |
|
1585 continue; |
|
1586 } |
|
1587 |
|
1588 var isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute); // Only write boolean value as attribute if meaningful. |
|
1589 |
|
1590 if (typeof value === 'boolean' && !isMeaningfulAttribute) { |
|
1591 continue; |
|
1592 } |
|
1593 |
|
1594 result += ' ' + attribute; // Boolean attributes should write attribute name, but without value. |
|
1595 // Mere presence of attribute name is effective truthiness. |
|
1596 |
|
1597 if (isBooleanAttribute) { |
|
1598 continue; |
|
1599 } |
|
1600 |
|
1601 if (typeof value === 'string') { |
|
1602 value = Object(external_this_wp_escapeHtml_["escapeAttribute"])(value); |
|
1603 } |
|
1604 |
|
1605 result += '="' + value + '"'; |
|
1606 } |
|
1607 |
|
1608 return result; |
|
1609 } |
|
1610 /** |
|
1611 * Renders a style object as a string attribute value. |
|
1612 * |
|
1613 * @param {Object} style Style object. |
|
1614 * |
|
1615 * @return {string} Style attribute value. |
|
1616 */ |
|
1617 |
|
1618 function renderStyle(style) { |
|
1619 // Only generate from object, e.g. tolerate string value. |
|
1620 if (!Object(external_this_lodash_["isPlainObject"])(style)) { |
|
1621 return style; |
|
1622 } |
|
1623 |
|
1624 var result; |
|
1625 |
|
1626 for (var property in style) { |
|
1627 var value = style[property]; |
|
1628 |
|
1629 if (null === value || undefined === value) { |
|
1630 continue; |
|
1631 } |
|
1632 |
|
1633 if (result) { |
|
1634 result += ';'; |
|
1635 } else { |
|
1636 result = ''; |
|
1637 } |
|
1638 |
|
1639 var normalName = getNormalStylePropertyName(property); |
|
1640 var normalValue = getNormalStylePropertyValue(property, value); |
|
1641 result += normalName + ':' + normalValue; |
|
1642 } |
|
1643 |
|
1644 return result; |
|
1645 } |
|
1646 /* harmony default export */ var serialize = (renderElement); |
|
1647 |
|
1648 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 /***/ }), |
|
1659 |
|
1660 /***/ 5: |
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
1661 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
92 |
1662 |
93 "use strict"; |
1663 "use strict"; |
94 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
1664 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
95 function _defineProperty(obj, key, value) { |
1665 function _defineProperty(obj, key, value) { |
107 return obj; |
1677 return obj; |
108 } |
1678 } |
109 |
1679 |
110 /***/ }), |
1680 /***/ }), |
111 |
1681 |
112 /***/ 2: |
1682 /***/ 89: |
113 /***/ (function(module, exports) { |
1683 /***/ (function(module, exports) { |
114 |
1684 |
115 (function() { module.exports = this["lodash"]; }()); |
|
116 |
|
117 /***/ }), |
|
118 |
|
119 /***/ 21: |
|
120 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
121 |
|
122 "use strict"; |
|
123 |
|
124 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js |
|
125 function _objectWithoutPropertiesLoose(source, excluded) { |
|
126 if (source == null) return {}; |
|
127 var target = {}; |
|
128 var sourceKeys = Object.keys(source); |
|
129 var key, i; |
|
130 |
|
131 for (i = 0; i < sourceKeys.length; i++) { |
|
132 key = sourceKeys[i]; |
|
133 if (excluded.indexOf(key) >= 0) continue; |
|
134 target[key] = source[key]; |
|
135 } |
|
136 |
|
137 return target; |
|
138 } |
|
139 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
140 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
|
141 |
|
142 function _objectWithoutProperties(source, excluded) { |
|
143 if (source == null) return {}; |
|
144 var target = _objectWithoutPropertiesLoose(source, excluded); |
|
145 var key, i; |
|
146 |
|
147 if (Object.getOwnPropertySymbols) { |
|
148 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
149 |
|
150 for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
151 key = sourceSymbolKeys[i]; |
|
152 if (excluded.indexOf(key) >= 0) continue; |
|
153 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
154 target[key] = source[key]; |
|
155 } |
|
156 } |
|
157 |
|
158 return target; |
|
159 } |
|
160 |
|
161 /***/ }), |
|
162 |
|
163 /***/ 27: |
|
164 /***/ (function(module, exports) { |
|
165 |
|
166 (function() { module.exports = this["React"]; }()); |
|
167 |
|
168 /***/ }), |
|
169 |
|
170 /***/ 32: |
|
171 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
172 |
|
173 "use strict"; |
|
174 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
|
175 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } |
|
176 |
|
177 function _typeof(obj) { |
|
178 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { |
|
179 _typeof = function _typeof(obj) { |
|
180 return _typeof2(obj); |
|
181 }; |
|
182 } else { |
|
183 _typeof = function _typeof(obj) { |
|
184 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); |
|
185 }; |
|
186 } |
|
187 |
|
188 return _typeof(obj); |
|
189 } |
|
190 |
|
191 /***/ }), |
|
192 |
|
193 /***/ 374: |
|
194 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
195 |
|
196 "use strict"; |
|
197 __webpack_require__.r(__webpack_exports__); |
|
198 |
|
199 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
200 var objectSpread = __webpack_require__(7); |
|
201 |
|
202 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules |
|
203 var objectWithoutProperties = __webpack_require__(21); |
|
204 |
|
205 // EXTERNAL MODULE: external "React" |
|
206 var external_React_ = __webpack_require__(27); |
|
207 |
|
208 // EXTERNAL MODULE: external "lodash" |
|
209 var external_lodash_ = __webpack_require__(2); |
|
210 |
|
211 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react.js |
|
212 |
|
213 |
|
214 |
|
215 /** |
|
216 * External dependencies |
|
217 */ |
|
218 |
|
219 |
|
220 /** |
|
221 * Object that provides utilities for dealing with React children. |
|
222 */ |
|
223 |
|
224 |
|
225 /** |
|
226 * Creates a copy of an element with extended props. |
|
227 * |
|
228 * @param {WPElement} element Element |
|
229 * @param {?Object} props Props to apply to cloned element |
|
230 * |
|
231 * @return {WPElement} Cloned element. |
|
232 */ |
|
233 |
|
234 |
|
235 /** |
|
236 * A base class to create WordPress Components (Refs, state and lifecycle hooks) |
|
237 */ |
|
238 |
|
239 |
|
240 /** |
|
241 * Creates a context object containing two components: a provider and consumer. |
|
242 * |
|
243 * @param {Object} defaultValue A default data stored in the context. |
|
244 * |
|
245 * @return {Object} Context object. |
|
246 */ |
|
247 |
|
248 |
|
249 /** |
|
250 * Returns a new element of given type. Type can be either a string tag name or |
|
251 * another function which itself returns an element. |
|
252 * |
|
253 * @param {?(string|Function)} type Tag name or element creator |
|
254 * @param {Object} props Element properties, either attribute |
|
255 * set to apply to DOM node or values to |
|
256 * pass through to element creator |
|
257 * @param {...WPElement} children Descendant elements |
|
258 * |
|
259 * @return {WPElement} Element. |
|
260 */ |
|
261 |
|
262 |
|
263 /** |
|
264 * Returns an object tracking a reference to a rendered element via its |
|
265 * `current` property as either a DOMElement or Element, dependent upon the |
|
266 * type of element rendered with the ref attribute. |
|
267 * |
|
268 * @return {Object} Ref object. |
|
269 */ |
|
270 |
|
271 |
|
272 /** |
|
273 * Component enhancer used to enable passing a ref to its wrapped component. |
|
274 * Pass a function argument which receives `props` and `ref` as its arguments, |
|
275 * returning an element using the forwarded ref. The return value is a new |
|
276 * component which forwards its ref. |
|
277 * |
|
278 * @param {Function} forwarder Function passed `props` and `ref`, expected to |
|
279 * return an element. |
|
280 * |
|
281 * @return {WPComponent} Enhanced component. |
|
282 */ |
|
283 |
|
284 |
|
285 /** |
|
286 * A component which renders its children without any wrapping element. |
|
287 */ |
|
288 |
|
289 |
|
290 /** |
|
291 * Checks if an object is a valid WPElement |
|
292 * |
|
293 * @param {Object} objectToCheck The object to be checked. |
|
294 * |
|
295 * @return {boolean} true if objectToTest is a valid WPElement and false otherwise. |
|
296 */ |
|
297 |
|
298 |
|
299 /** |
|
300 * Component that activates additional checks and warnings for its descendants. |
|
301 */ |
|
302 |
|
303 |
|
304 /** |
|
305 * @see https://reactjs.org/docs/hooks-reference.html#usecallback |
|
306 */ |
|
307 |
|
308 |
|
309 /** |
|
310 * @see https://reactjs.org/docs/hooks-reference.html#usecontext |
|
311 */ |
|
312 |
|
313 |
|
314 /** |
|
315 * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue |
|
316 */ |
|
317 |
|
318 |
|
319 /** |
|
320 * @see https://reactjs.org/docs/hooks-reference.html#useeffect |
|
321 */ |
|
322 |
|
323 |
|
324 /** |
|
325 * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle |
|
326 */ |
|
327 |
|
328 |
|
329 /** |
|
330 * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect |
|
331 */ |
|
332 |
|
333 |
|
334 /** |
|
335 * @see https://reactjs.org/docs/hooks-reference.html#usememo |
|
336 */ |
|
337 |
|
338 |
|
339 /** |
|
340 * @see https://reactjs.org/docs/hooks-reference.html#usereducer |
|
341 */ |
|
342 |
|
343 |
|
344 /** |
|
345 * @see https://reactjs.org/docs/hooks-reference.html#useref |
|
346 */ |
|
347 |
|
348 |
|
349 /** |
|
350 * @see https://reactjs.org/docs/hooks-reference.html#usestate |
|
351 */ |
|
352 |
|
353 |
|
354 /** |
|
355 * Concatenate two or more React children objects. |
|
356 * |
|
357 * @param {...?Object} childrenArguments Array of children arguments (array of arrays/strings/objects) to concatenate. |
|
358 * |
|
359 * @return {Array} The concatenated value. |
|
360 */ |
|
361 |
|
362 function concatChildren() { |
|
363 for (var _len = arguments.length, childrenArguments = new Array(_len), _key = 0; _key < _len; _key++) { |
|
364 childrenArguments[_key] = arguments[_key]; |
|
365 } |
|
366 |
|
367 return childrenArguments.reduce(function (memo, children, i) { |
|
368 external_React_["Children"].forEach(children, function (child, j) { |
|
369 if (child && 'string' !== typeof child) { |
|
370 child = Object(external_React_["cloneElement"])(child, { |
|
371 key: [i, j].join() |
|
372 }); |
|
373 } |
|
374 |
|
375 memo.push(child); |
|
376 }); |
|
377 return memo; |
|
378 }, []); |
|
379 } |
|
380 /** |
|
381 * Switches the nodeName of all the elements in the children object. |
|
382 * |
|
383 * @param {?Object} children Children object. |
|
384 * @param {string} nodeName Node name. |
|
385 * |
|
386 * @return {?Object} The updated children object. |
|
387 */ |
|
388 |
|
389 function switchChildrenNodeName(children, nodeName) { |
|
390 return children && external_React_["Children"].map(children, function (elt, index) { |
|
391 if (Object(external_lodash_["isString"])(elt)) { |
|
392 return Object(external_React_["createElement"])(nodeName, { |
|
393 key: index |
|
394 }, elt); |
|
395 } |
|
396 |
|
397 var _elt$props = elt.props, |
|
398 childrenProp = _elt$props.children, |
|
399 props = Object(objectWithoutProperties["a" /* default */])(_elt$props, ["children"]); |
|
400 |
|
401 return Object(external_React_["createElement"])(nodeName, Object(objectSpread["a" /* default */])({ |
|
402 key: index |
|
403 }, props), childrenProp); |
|
404 }); |
|
405 } |
|
406 |
|
407 // EXTERNAL MODULE: external "ReactDOM" |
|
408 var external_ReactDOM_ = __webpack_require__(52); |
|
409 |
|
410 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/react-platform.js |
|
411 /** |
|
412 * External dependencies |
|
413 */ |
|
414 |
|
415 /** |
|
416 * Creates a portal into which a component can be rendered. |
|
417 * |
|
418 * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235 |
|
419 * |
|
420 * @param {Component} component Component |
|
421 * @param {Element} target DOM node into which element should be rendered |
|
422 */ |
|
423 |
|
424 |
|
425 /** |
|
426 * Finds the dom node of a React component |
|
427 * |
|
428 * @param {Component} component component's instance |
|
429 * @param {Element} target DOM node into which element should be rendered |
|
430 */ |
|
431 |
|
432 |
|
433 /** |
|
434 * Renders a given element into the target DOM node. |
|
435 * |
|
436 * @param {WPElement} element Element to render |
|
437 * @param {Element} target DOM node into which element should be rendered |
|
438 */ |
|
439 |
|
440 |
|
441 /** |
|
442 * Removes any mounted element from the target DOM node. |
|
443 * |
|
444 * @param {Element} target DOM node in which element is to be removed |
|
445 */ |
|
446 |
|
447 |
|
448 |
|
449 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/utils.js |
|
450 /** |
|
451 * External dependencies |
|
452 */ |
|
453 |
|
454 /** |
|
455 * Checks if the provided WP element is empty. |
|
456 * |
|
457 * @param {*} element WP element to check. |
|
458 * @return {boolean} True when an element is considered empty. |
|
459 */ |
|
460 |
|
461 var utils_isEmptyElement = function isEmptyElement(element) { |
|
462 if (Object(external_lodash_["isNumber"])(element)) { |
|
463 return false; |
|
464 } |
|
465 |
|
466 if (Object(external_lodash_["isString"])(element) || Object(external_lodash_["isArray"])(element)) { |
|
467 return !element.length; |
|
468 } |
|
469 |
|
470 return !element; |
|
471 }; |
|
472 |
|
473 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js |
|
474 var esm_typeof = __webpack_require__(32); |
|
475 |
|
476 // EXTERNAL MODULE: external {"this":["wp","escapeHtml"]} |
|
477 var external_this_wp_escapeHtml_ = __webpack_require__(69); |
|
478 |
|
479 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/raw-html.js |
|
480 |
|
481 |
|
482 |
|
483 /** |
|
484 * Internal dependencies |
|
485 */ |
|
486 |
|
487 /** |
|
488 * Component used as equivalent of Fragment with unescaped HTML, in cases where |
|
489 * it is desirable to render dangerous HTML without needing a wrapper element. |
|
490 * To preserve additional props, a `div` wrapper _will_ be created if any props |
|
491 * aside from `children` are passed. |
|
492 * |
|
493 * @param {string} props.children HTML to render. |
|
494 * |
|
495 * @return {WPElement} Dangerously-rendering element. |
|
496 */ |
|
497 |
|
498 function RawHTML(_ref) { |
|
499 var children = _ref.children, |
|
500 props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children"]); |
|
501 |
|
502 // The DIV wrapper will be stripped by serializer, unless there are |
|
503 // non-children props present. |
|
504 return Object(external_React_["createElement"])('div', Object(objectSpread["a" /* default */])({ |
|
505 dangerouslySetInnerHTML: { |
|
506 __html: children |
|
507 } |
|
508 }, props)); |
|
509 } |
|
510 |
|
511 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/serialize.js |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 /** |
|
517 * Parts of this source were derived and modified from fast-react-render, |
|
518 * released under the MIT license. |
|
519 * |
|
520 * https://github.com/alt-j/fast-react-render |
|
521 * |
|
522 * Copyright (c) 2016 Andrey Morozov |
|
523 * |
|
524 * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
525 * of this software and associated documentation files (the "Software"), to deal |
|
526 * in the Software without restriction, including without limitation the rights |
|
527 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
528 * copies of the Software, and to permit persons to whom the Software is |
|
529 * furnished to do so, subject to the following conditions: |
|
530 * |
|
531 * The above copyright notice and this permission notice shall be included in |
|
532 * all copies or substantial portions of the Software. |
|
533 * |
|
534 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
535 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
536 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
537 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
538 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
539 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
540 * THE SOFTWARE. |
|
541 */ |
|
542 |
|
543 /** |
|
544 * External dependencies |
|
545 */ |
|
546 |
|
547 /** |
|
548 * WordPress dependencies |
|
549 */ |
|
550 |
|
551 |
|
552 /** |
|
553 * Internal dependencies |
|
554 */ |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 var _createContext = Object(external_React_["createContext"])(), |
|
560 Provider = _createContext.Provider, |
|
561 Consumer = _createContext.Consumer; |
|
562 /** |
|
563 * Valid attribute types. |
|
564 * |
|
565 * @type {Set} |
|
566 */ |
|
567 |
|
568 |
|
569 var ATTRIBUTES_TYPES = new Set(['string', 'boolean', 'number']); |
|
570 /** |
|
571 * Element tags which can be self-closing. |
|
572 * |
|
573 * @type {Set} |
|
574 */ |
|
575 |
|
576 var SELF_CLOSING_TAGS = new Set(['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']); |
|
577 /** |
|
578 * Boolean attributes are attributes whose presence as being assigned is |
|
579 * meaningful, even if only empty. |
|
580 * |
|
581 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes |
|
582 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
|
583 * |
|
584 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
|
585 * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) |
|
586 * .reduce( ( result, tr ) => Object.assign( result, { |
|
587 * [ tr.firstChild.textContent.trim() ]: true |
|
588 * } ), {} ) ).sort(); |
|
589 * |
|
590 * @type {Set} |
|
591 */ |
|
592 |
|
593 var BOOLEAN_ATTRIBUTES = new Set(['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']); |
|
594 /** |
|
595 * Enumerated attributes are attributes which must be of a specific value form. |
|
596 * Like boolean attributes, these are meaningful if specified, even if not of a |
|
597 * valid enumerated value. |
|
598 * |
|
599 * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute |
|
600 * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 |
|
601 * |
|
602 * Object.keys( [ ...document.querySelectorAll( '#attributes-1 > tbody > tr' ) ] |
|
603 * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) |
|
604 * .reduce( ( result, tr ) => Object.assign( result, { |
|
605 * [ tr.firstChild.textContent.trim() ]: true |
|
606 * } ), {} ) ).sort(); |
|
607 * |
|
608 * Some notable omissions: |
|
609 * |
|
610 * - `alt`: https://blog.whatwg.org/omit-alt |
|
611 * |
|
612 * @type {Set} |
|
613 */ |
|
614 |
|
615 var ENUMERATED_ATTRIBUTES = new Set(['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']); |
|
616 /** |
|
617 * Set of CSS style properties which support assignment of unitless numbers. |
|
618 * Used in rendering of style properties, where `px` unit is assumed unless |
|
619 * property is included in this set or value is zero. |
|
620 * |
|
621 * Generated via: |
|
622 * |
|
623 * Object.entries( document.createElement( 'div' ).style ) |
|
624 * .filter( ( [ key ] ) => ( |
|
625 * ! /^(webkit|ms|moz)/.test( key ) && |
|
626 * ( e.style[ key ] = 10 ) && |
|
627 * e.style[ key ] === '10' |
|
628 * ) ) |
|
629 * .map( ( [ key ] ) => key ) |
|
630 * .sort(); |
|
631 * |
|
632 * @type {Set} |
|
633 */ |
|
634 |
|
635 var CSS_PROPERTIES_SUPPORTS_UNITLESS = new Set(['animation', 'animationIterationCount', 'baselineShift', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'columnCount', 'cx', 'cy', 'fillOpacity', 'flexGrow', 'flexShrink', 'floodOpacity', 'fontWeight', 'gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart', 'lineHeight', 'opacity', 'order', 'orphans', 'r', 'rx', 'ry', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'widows', 'x', 'y', 'zIndex', 'zoom']); |
|
636 /** |
|
637 * Returns true if the specified string is prefixed by one of an array of |
|
638 * possible prefixes. |
|
639 * |
|
640 * @param {string} string String to check. |
|
641 * @param {string[]} prefixes Possible prefixes. |
|
642 * |
|
643 * @return {boolean} Whether string has prefix. |
|
644 */ |
|
645 |
|
646 function hasPrefix(string, prefixes) { |
|
647 return prefixes.some(function (prefix) { |
|
648 return string.indexOf(prefix) === 0; |
|
649 }); |
|
650 } |
|
651 /** |
|
652 * Returns true if the given prop name should be ignored in attributes |
|
653 * serialization, or false otherwise. |
|
654 * |
|
655 * @param {string} attribute Attribute to check. |
|
656 * |
|
657 * @return {boolean} Whether attribute should be ignored. |
|
658 */ |
|
659 |
|
660 function isInternalAttribute(attribute) { |
|
661 return 'key' === attribute || 'children' === attribute; |
|
662 } |
|
663 /** |
|
664 * Returns the normal form of the element's attribute value for HTML. |
|
665 * |
|
666 * @param {string} attribute Attribute name. |
|
667 * @param {*} value Non-normalized attribute value. |
|
668 * |
|
669 * @return {string} Normalized attribute value. |
|
670 */ |
|
671 |
|
672 |
|
673 function getNormalAttributeValue(attribute, value) { |
|
674 switch (attribute) { |
|
675 case 'style': |
|
676 return renderStyle(value); |
|
677 } |
|
678 |
|
679 return value; |
|
680 } |
|
681 /** |
|
682 * Returns the normal form of the element's attribute name for HTML. |
|
683 * |
|
684 * @param {string} attribute Non-normalized attribute name. |
|
685 * |
|
686 * @return {string} Normalized attribute name. |
|
687 */ |
|
688 |
|
689 |
|
690 function getNormalAttributeName(attribute) { |
|
691 switch (attribute) { |
|
692 case 'htmlFor': |
|
693 return 'for'; |
|
694 |
|
695 case 'className': |
|
696 return 'class'; |
|
697 } |
|
698 |
|
699 return attribute.toLowerCase(); |
|
700 } |
|
701 /** |
|
702 * Returns the normal form of the style property name for HTML. |
|
703 * |
|
704 * - Converts property names to kebab-case, e.g. 'backgroundColor' → 'background-color' |
|
705 * - Leaves custom attributes alone, e.g. '--myBackgroundColor' → '--myBackgroundColor' |
|
706 * - Converts vendor-prefixed property names to -kebab-case, e.g. 'MozTransform' → '-moz-transform' |
|
707 * |
|
708 * @param {string} property Property name. |
|
709 * |
|
710 * @return {string} Normalized property name. |
|
711 */ |
|
712 |
|
713 |
|
714 function getNormalStylePropertyName(property) { |
|
715 if (Object(external_lodash_["startsWith"])(property, '--')) { |
|
716 return property; |
|
717 } |
|
718 |
|
719 if (hasPrefix(property, ['ms', 'O', 'Moz', 'Webkit'])) { |
|
720 return '-' + Object(external_lodash_["kebabCase"])(property); |
|
721 } |
|
722 |
|
723 return Object(external_lodash_["kebabCase"])(property); |
|
724 } |
|
725 /** |
|
726 * Returns the normal form of the style property value for HTML. Appends a |
|
727 * default pixel unit if numeric, not a unitless property, and not zero. |
|
728 * |
|
729 * @param {string} property Property name. |
|
730 * @param {*} value Non-normalized property value. |
|
731 * |
|
732 * @return {*} Normalized property value. |
|
733 */ |
|
734 |
|
735 |
|
736 function getNormalStylePropertyValue(property, value) { |
|
737 if (typeof value === 'number' && 0 !== value && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) { |
|
738 return value + 'px'; |
|
739 } |
|
740 |
|
741 return value; |
|
742 } |
|
743 /** |
|
744 * Serializes a React element to string. |
|
745 * |
|
746 * @param {WPElement} element Element to serialize. |
|
747 * @param {?Object} context Context object. |
|
748 * @param {?Object} legacyContext Legacy context object. |
|
749 * |
|
750 * @return {string} Serialized element. |
|
751 */ |
|
752 |
|
753 |
|
754 function renderElement(element, context) { |
|
755 var legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
756 |
|
757 if (null === element || undefined === element || false === element) { |
|
758 return ''; |
|
759 } |
|
760 |
|
761 if (Array.isArray(element)) { |
|
762 return renderChildren(element, context, legacyContext); |
|
763 } |
|
764 |
|
765 switch (Object(esm_typeof["a" /* default */])(element)) { |
|
766 case 'string': |
|
767 return Object(external_this_wp_escapeHtml_["escapeHTML"])(element); |
|
768 |
|
769 case 'number': |
|
770 return element.toString(); |
|
771 } |
|
772 |
|
773 var type = element.type, |
|
774 props = element.props; |
|
775 |
|
776 switch (type) { |
|
777 case external_React_["StrictMode"]: |
|
778 case external_React_["Fragment"]: |
|
779 return renderChildren(props.children, context, legacyContext); |
|
780 |
|
781 case RawHTML: |
|
782 var children = props.children, |
|
783 wrapperProps = Object(objectWithoutProperties["a" /* default */])(props, ["children"]); |
|
784 |
|
785 return renderNativeComponent(Object(external_lodash_["isEmpty"])(wrapperProps) ? null : 'div', Object(objectSpread["a" /* default */])({}, wrapperProps, { |
|
786 dangerouslySetInnerHTML: { |
|
787 __html: children |
|
788 } |
|
789 }), context, legacyContext); |
|
790 } |
|
791 |
|
792 switch (Object(esm_typeof["a" /* default */])(type)) { |
|
793 case 'string': |
|
794 return renderNativeComponent(type, props, context, legacyContext); |
|
795 |
|
796 case 'function': |
|
797 if (type.prototype && typeof type.prototype.render === 'function') { |
|
798 return renderComponent(type, props, context, legacyContext); |
|
799 } |
|
800 |
|
801 return renderElement(type(props, legacyContext), context, legacyContext); |
|
802 } |
|
803 |
|
804 switch (type && type.$$typeof) { |
|
805 case Provider.$$typeof: |
|
806 return renderChildren(props.children, props.value, legacyContext); |
|
807 |
|
808 case Consumer.$$typeof: |
|
809 return renderElement(props.children(context || type._currentValue), context, legacyContext); |
|
810 } |
|
811 |
|
812 return ''; |
|
813 } |
|
814 /** |
|
815 * Serializes a native component type to string. |
|
816 * |
|
817 * @param {?string} type Native component type to serialize, or null if |
|
818 * rendering as fragment of children content. |
|
819 * @param {Object} props Props object. |
|
820 * @param {?Object} context Context object. |
|
821 * @param {?Object} legacyContext Legacy context object. |
|
822 * |
|
823 * @return {string} Serialized element. |
|
824 */ |
|
825 |
|
826 function renderNativeComponent(type, props, context) { |
|
827 var legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
828 var content = ''; |
|
829 |
|
830 if (type === 'textarea' && props.hasOwnProperty('value')) { |
|
831 // Textarea children can be assigned as value prop. If it is, render in |
|
832 // place of children. Ensure to omit so it is not assigned as attribute |
|
833 // as well. |
|
834 content = renderChildren(props.value, context, legacyContext); |
|
835 props = Object(external_lodash_["omit"])(props, 'value'); |
|
836 } else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === 'string') { |
|
837 // Dangerous content is left unescaped. |
|
838 content = props.dangerouslySetInnerHTML.__html; |
|
839 } else if (typeof props.children !== 'undefined') { |
|
840 content = renderChildren(props.children, context, legacyContext); |
|
841 } |
|
842 |
|
843 if (!type) { |
|
844 return content; |
|
845 } |
|
846 |
|
847 var attributes = renderAttributes(props); |
|
848 |
|
849 if (SELF_CLOSING_TAGS.has(type)) { |
|
850 return '<' + type + attributes + '/>'; |
|
851 } |
|
852 |
|
853 return '<' + type + attributes + '>' + content + '</' + type + '>'; |
|
854 } |
|
855 /** |
|
856 * Serializes a non-native component type to string. |
|
857 * |
|
858 * @param {Function} Component Component type to serialize. |
|
859 * @param {Object} props Props object. |
|
860 * @param {?Object} context Context object. |
|
861 * @param {?Object} legacyContext Legacy context object. |
|
862 * |
|
863 * @return {string} Serialized element |
|
864 */ |
|
865 |
|
866 function renderComponent(Component, props, context) { |
|
867 var legacyContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
|
868 var instance = new Component(props, legacyContext); |
|
869 |
|
870 if (typeof instance.getChildContext === 'function') { |
|
871 Object.assign(legacyContext, instance.getChildContext()); |
|
872 } |
|
873 |
|
874 var html = renderElement(instance.render(), context, legacyContext); |
|
875 return html; |
|
876 } |
|
877 /** |
|
878 * Serializes an array of children to string. |
|
879 * |
|
880 * @param {Array} children Children to serialize. |
|
881 * @param {?Object} context Context object. |
|
882 * @param {?Object} legacyContext Legacy context object. |
|
883 * |
|
884 * @return {string} Serialized children. |
|
885 */ |
|
886 |
|
887 function renderChildren(children, context) { |
|
888 var legacyContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
|
889 var result = ''; |
|
890 children = Object(external_lodash_["castArray"])(children); |
|
891 |
|
892 for (var i = 0; i < children.length; i++) { |
|
893 var child = children[i]; |
|
894 result += renderElement(child, context, legacyContext); |
|
895 } |
|
896 |
|
897 return result; |
|
898 } |
|
899 /** |
|
900 * Renders a props object as a string of HTML attributes. |
|
901 * |
|
902 * @param {Object} props Props object. |
|
903 * |
|
904 * @return {string} Attributes string. |
|
905 */ |
|
906 |
|
907 |
|
908 function renderAttributes(props) { |
|
909 var result = ''; |
|
910 |
|
911 for (var key in props) { |
|
912 var attribute = getNormalAttributeName(key); |
|
913 |
|
914 if (!Object(external_this_wp_escapeHtml_["isValidAttributeName"])(attribute)) { |
|
915 continue; |
|
916 } |
|
917 |
|
918 var value = getNormalAttributeValue(key, props[key]); // If value is not of serializeable type, skip. |
|
919 |
|
920 if (!ATTRIBUTES_TYPES.has(Object(esm_typeof["a" /* default */])(value))) { |
|
921 continue; |
|
922 } // Don't render internal attribute names. |
|
923 |
|
924 |
|
925 if (isInternalAttribute(key)) { |
|
926 continue; |
|
927 } |
|
928 |
|
929 var isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute); // Boolean attribute should be omitted outright if its value is false. |
|
930 |
|
931 if (isBooleanAttribute && value === false) { |
|
932 continue; |
|
933 } |
|
934 |
|
935 var isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ['data-', 'aria-']) || ENUMERATED_ATTRIBUTES.has(attribute); // Only write boolean value as attribute if meaningful. |
|
936 |
|
937 if (typeof value === 'boolean' && !isMeaningfulAttribute) { |
|
938 continue; |
|
939 } |
|
940 |
|
941 result += ' ' + attribute; // Boolean attributes should write attribute name, but without value. |
|
942 // Mere presence of attribute name is effective truthiness. |
|
943 |
|
944 if (isBooleanAttribute) { |
|
945 continue; |
|
946 } |
|
947 |
|
948 if (typeof value === 'string') { |
|
949 value = Object(external_this_wp_escapeHtml_["escapeAttribute"])(value); |
|
950 } |
|
951 |
|
952 result += '="' + value + '"'; |
|
953 } |
|
954 |
|
955 return result; |
|
956 } |
|
957 /** |
|
958 * Renders a style object as a string attribute value. |
|
959 * |
|
960 * @param {Object} style Style object. |
|
961 * |
|
962 * @return {string} Style attribute value. |
|
963 */ |
|
964 |
|
965 function renderStyle(style) { |
|
966 // Only generate from object, e.g. tolerate string value. |
|
967 if (!Object(external_lodash_["isPlainObject"])(style)) { |
|
968 return style; |
|
969 } |
|
970 |
|
971 var result; |
|
972 |
|
973 for (var property in style) { |
|
974 var value = style[property]; |
|
975 |
|
976 if (null === value || undefined === value) { |
|
977 continue; |
|
978 } |
|
979 |
|
980 if (result) { |
|
981 result += ';'; |
|
982 } else { |
|
983 result = ''; |
|
984 } |
|
985 |
|
986 var normalName = getNormalStylePropertyName(property); |
|
987 var normalValue = getNormalStylePropertyValue(property, value); |
|
988 result += normalName + ':' + normalValue; |
|
989 } |
|
990 |
|
991 return result; |
|
992 } |
|
993 /* harmony default export */ var serialize = (renderElement); |
|
994 |
|
995 // CONCATENATED MODULE: ./node_modules/@wordpress/element/build-module/index.js |
|
996 /* concated harmony reexport Children */__webpack_require__.d(__webpack_exports__, "Children", function() { return external_React_["Children"]; }); |
|
997 /* concated harmony reexport cloneElement */__webpack_require__.d(__webpack_exports__, "cloneElement", function() { return external_React_["cloneElement"]; }); |
|
998 /* concated harmony reexport Component */__webpack_require__.d(__webpack_exports__, "Component", function() { return external_React_["Component"]; }); |
|
999 /* concated harmony reexport createContext */__webpack_require__.d(__webpack_exports__, "createContext", function() { return external_React_["createContext"]; }); |
|
1000 /* concated harmony reexport createElement */__webpack_require__.d(__webpack_exports__, "createElement", function() { return external_React_["createElement"]; }); |
|
1001 /* concated harmony reexport createRef */__webpack_require__.d(__webpack_exports__, "createRef", function() { return external_React_["createRef"]; }); |
|
1002 /* concated harmony reexport forwardRef */__webpack_require__.d(__webpack_exports__, "forwardRef", function() { return external_React_["forwardRef"]; }); |
|
1003 /* concated harmony reexport Fragment */__webpack_require__.d(__webpack_exports__, "Fragment", function() { return external_React_["Fragment"]; }); |
|
1004 /* concated harmony reexport isValidElement */__webpack_require__.d(__webpack_exports__, "isValidElement", function() { return external_React_["isValidElement"]; }); |
|
1005 /* concated harmony reexport StrictMode */__webpack_require__.d(__webpack_exports__, "StrictMode", function() { return external_React_["StrictMode"]; }); |
|
1006 /* concated harmony reexport useCallback */__webpack_require__.d(__webpack_exports__, "useCallback", function() { return external_React_["useCallback"]; }); |
|
1007 /* concated harmony reexport useContext */__webpack_require__.d(__webpack_exports__, "useContext", function() { return external_React_["useContext"]; }); |
|
1008 /* concated harmony reexport useDebugValue */__webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return external_React_["useDebugValue"]; }); |
|
1009 /* concated harmony reexport useEffect */__webpack_require__.d(__webpack_exports__, "useEffect", function() { return external_React_["useEffect"]; }); |
|
1010 /* concated harmony reexport useImperativeHandle */__webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return external_React_["useImperativeHandle"]; }); |
|
1011 /* concated harmony reexport useLayoutEffect */__webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return external_React_["useLayoutEffect"]; }); |
|
1012 /* concated harmony reexport useMemo */__webpack_require__.d(__webpack_exports__, "useMemo", function() { return external_React_["useMemo"]; }); |
|
1013 /* concated harmony reexport useReducer */__webpack_require__.d(__webpack_exports__, "useReducer", function() { return external_React_["useReducer"]; }); |
|
1014 /* concated harmony reexport useRef */__webpack_require__.d(__webpack_exports__, "useRef", function() { return external_React_["useRef"]; }); |
|
1015 /* concated harmony reexport useState */__webpack_require__.d(__webpack_exports__, "useState", function() { return external_React_["useState"]; }); |
|
1016 /* concated harmony reexport concatChildren */__webpack_require__.d(__webpack_exports__, "concatChildren", function() { return concatChildren; }); |
|
1017 /* concated harmony reexport switchChildrenNodeName */__webpack_require__.d(__webpack_exports__, "switchChildrenNodeName", function() { return switchChildrenNodeName; }); |
|
1018 /* concated harmony reexport createPortal */__webpack_require__.d(__webpack_exports__, "createPortal", function() { return external_ReactDOM_["createPortal"]; }); |
|
1019 /* concated harmony reexport findDOMNode */__webpack_require__.d(__webpack_exports__, "findDOMNode", function() { return external_ReactDOM_["findDOMNode"]; }); |
|
1020 /* concated harmony reexport render */__webpack_require__.d(__webpack_exports__, "render", function() { return external_ReactDOM_["render"]; }); |
|
1021 /* concated harmony reexport unmountComponentAtNode */__webpack_require__.d(__webpack_exports__, "unmountComponentAtNode", function() { return external_ReactDOM_["unmountComponentAtNode"]; }); |
|
1022 /* concated harmony reexport isEmptyElement */__webpack_require__.d(__webpack_exports__, "isEmptyElement", function() { return utils_isEmptyElement; }); |
|
1023 /* concated harmony reexport renderToString */__webpack_require__.d(__webpack_exports__, "renderToString", function() { return serialize; }); |
|
1024 /* concated harmony reexport RawHTML */__webpack_require__.d(__webpack_exports__, "RawHTML", function() { return RawHTML; }); |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 /***/ }), |
|
1033 |
|
1034 /***/ 52: |
|
1035 /***/ (function(module, exports) { |
|
1036 |
|
1037 (function() { module.exports = this["ReactDOM"]; }()); |
|
1038 |
|
1039 /***/ }), |
|
1040 |
|
1041 /***/ 69: |
|
1042 /***/ (function(module, exports) { |
|
1043 |
|
1044 (function() { module.exports = this["wp"]["escapeHtml"]; }()); |
1685 (function() { module.exports = this["wp"]["escapeHtml"]; }()); |
1045 |
1686 |
1046 /***/ }), |
|
1047 |
|
1048 /***/ 7: |
|
1049 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1050 |
|
1051 "use strict"; |
|
1052 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
1053 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
1054 |
|
1055 function _objectSpread(target) { |
|
1056 for (var i = 1; i < arguments.length; i++) { |
|
1057 var source = arguments[i] != null ? arguments[i] : {}; |
|
1058 var ownKeys = Object.keys(source); |
|
1059 |
|
1060 if (typeof Object.getOwnPropertySymbols === 'function') { |
|
1061 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
1062 return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
1063 })); |
|
1064 } |
|
1065 |
|
1066 ownKeys.forEach(function (key) { |
|
1067 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
1068 }); |
|
1069 } |
|
1070 |
|
1071 return target; |
|
1072 } |
|
1073 |
|
1074 /***/ }) |
1687 /***/ }) |
1075 |
1688 |
1076 /******/ }); |
1689 /******/ }); |