PluginProbe
Gutenberg / 23.1.0
Gutenberg v23.1.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / scripts / blocks / index.js

index.js in Gutenberg 23.1.0, at build/scripts/blocks/index.js

10,503 lines 383.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2 var wp;
3 (wp ||= {}).blocks = (() => {
4 var __create = Object.create;
5 var __defProp = Object.defineProperty;
6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7 var __getOwnPropNames = Object.getOwnPropertyNames;
8 var __getProtoOf = Object.getPrototypeOf;
9 var __hasOwnProp = Object.prototype.hasOwnProperty;
10 var __commonJS = (cb, mod) => function __require() {
11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12 };
13 var __export = (target, all) => {
14 for (var name in all)
15 __defProp(target, name, { get: all[name], enumerable: true });
16 };
17 var __copyProps = (to, from, except, desc) => {
18 if (from && typeof from === "object" || typeof from === "function") {
19 for (let key of __getOwnPropNames(from))
20 if (!__hasOwnProp.call(to, key) && key !== except)
21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22 }
23 return to;
24 };
25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26 // If the importer is in node compatibility mode or this is not an ESM
27 // file that has been converted to a CommonJS file using a Babel-
28 // compatible transform (i.e. "__esModule" has not been set), then set
29 // "default" to the CommonJS "module.exports" for node compatibility.
30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31 mod
32 ));
33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
35 // package-external:@wordpress/data
36 var require_data = __commonJS({
37 "package-external:@wordpress/data"(exports, module) {
38 module.exports = window.wp.data;
39 }
40 });
41
42 // package-external:@wordpress/i18n
43 var require_i18n = __commonJS({
44 "package-external:@wordpress/i18n"(exports, module) {
45 module.exports = window.wp.i18n;
46 }
47 });
48
49 // package-external:@wordpress/element
50 var require_element = __commonJS({
51 "package-external:@wordpress/element"(exports, module) {
52 module.exports = window.wp.element;
53 }
54 });
55
56 // package-external:@wordpress/dom
57 var require_dom = __commonJS({
58 "package-external:@wordpress/dom"(exports, module) {
59 module.exports = window.wp.dom;
60 }
61 });
62
63 // package-external:@wordpress/rich-text
64 var require_rich_text = __commonJS({
65 "package-external:@wordpress/rich-text"(exports, module) {
66 module.exports = window.wp.richText;
67 }
68 });
69
70 // package-external:@wordpress/deprecated
71 var require_deprecated = __commonJS({
72 "package-external:@wordpress/deprecated"(exports, module) {
73 module.exports = window.wp.deprecated;
74 }
75 });
76
77 // package-external:@wordpress/warning
78 var require_warning = __commonJS({
79 "package-external:@wordpress/warning"(exports, module) {
80 module.exports = window.wp.warning;
81 }
82 });
83
84 // package-external:@wordpress/private-apis
85 var require_private_apis = __commonJS({
86 "package-external:@wordpress/private-apis"(exports, module) {
87 module.exports = window.wp.privateApis;
88 }
89 });
90
91 // node_modules/remove-accents/index.js
92 var require_remove_accents = __commonJS({
93 "node_modules/remove-accents/index.js"(exports, module) {
94 var characterMap = {
95 "\xC0": "A",
96 "\xC1": "A",
97 "\xC2": "A",
98 "\xC3": "A",
99 "\xC4": "A",
100 "\xC5": "A",
101 "\u1EA4": "A",
102 "\u1EAE": "A",
103 "\u1EB2": "A",
104 "\u1EB4": "A",
105 "\u1EB6": "A",
106 "\xC6": "AE",
107 "\u1EA6": "A",
108 "\u1EB0": "A",
109 "\u0202": "A",
110 "\u1EA2": "A",
111 "\u1EA0": "A",
112 "\u1EA8": "A",
113 "\u1EAA": "A",
114 "\u1EAC": "A",
115 "\xC7": "C",
116 "\u1E08": "C",
117 "\xC8": "E",
118 "\xC9": "E",
119 "\xCA": "E",
120 "\xCB": "E",
121 "\u1EBE": "E",
122 "\u1E16": "E",
123 "\u1EC0": "E",
124 "\u1E14": "E",
125 "\u1E1C": "E",
126 "\u0206": "E",
127 "\u1EBA": "E",
128 "\u1EBC": "E",
129 "\u1EB8": "E",
130 "\u1EC2": "E",
131 "\u1EC4": "E",
132 "\u1EC6": "E",
133 "\xCC": "I",
134 "\xCD": "I",
135 "\xCE": "I",
136 "\xCF": "I",
137 "\u1E2E": "I",
138 "\u020A": "I",
139 "\u1EC8": "I",
140 "\u1ECA": "I",
141 "\xD0": "D",
142 "\xD1": "N",
143 "\xD2": "O",
144 "\xD3": "O",
145 "\xD4": "O",
146 "\xD5": "O",
147 "\xD6": "O",
148 "\xD8": "O",
149 "\u1ED0": "O",
150 "\u1E4C": "O",
151 "\u1E52": "O",
152 "\u020E": "O",
153 "\u1ECE": "O",
154 "\u1ECC": "O",
155 "\u1ED4": "O",
156 "\u1ED6": "O",
157 "\u1ED8": "O",
158 "\u1EDC": "O",
159 "\u1EDE": "O",
160 "\u1EE0": "O",
161 "\u1EDA": "O",
162 "\u1EE2": "O",
163 "\xD9": "U",
164 "\xDA": "U",
165 "\xDB": "U",
166 "\xDC": "U",
167 "\u1EE6": "U",
168 "\u1EE4": "U",
169 "\u1EEC": "U",
170 "\u1EEE": "U",
171 "\u1EF0": "U",
172 "\xDD": "Y",
173 "\xE0": "a",
174 "\xE1": "a",
175 "\xE2": "a",
176 "\xE3": "a",
177 "\xE4": "a",
178 "\xE5": "a",
179 "\u1EA5": "a",
180 "\u1EAF": "a",
181 "\u1EB3": "a",
182 "\u1EB5": "a",
183 "\u1EB7": "a",
184 "\xE6": "ae",
185 "\u1EA7": "a",
186 "\u1EB1": "a",
187 "\u0203": "a",
188 "\u1EA3": "a",
189 "\u1EA1": "a",
190 "\u1EA9": "a",
191 "\u1EAB": "a",
192 "\u1EAD": "a",
193 "\xE7": "c",
194 "\u1E09": "c",
195 "\xE8": "e",
196 "\xE9": "e",
197 "\xEA": "e",
198 "\xEB": "e",
199 "\u1EBF": "e",
200 "\u1E17": "e",
201 "\u1EC1": "e",
202 "\u1E15": "e",
203 "\u1E1D": "e",
204 "\u0207": "e",
205 "\u1EBB": "e",
206 "\u1EBD": "e",
207 "\u1EB9": "e",
208 "\u1EC3": "e",
209 "\u1EC5": "e",
210 "\u1EC7": "e",
211 "\xEC": "i",
212 "\xED": "i",
213 "\xEE": "i",
214 "\xEF": "i",
215 "\u1E2F": "i",
216 "\u020B": "i",
217 "\u1EC9": "i",
218 "\u1ECB": "i",
219 "\xF0": "d",
220 "\xF1": "n",
221 "\xF2": "o",
222 "\xF3": "o",
223 "\xF4": "o",
224 "\xF5": "o",
225 "\xF6": "o",
226 "\xF8": "o",
227 "\u1ED1": "o",
228 "\u1E4D": "o",
229 "\u1E53": "o",
230 "\u020F": "o",
231 "\u1ECF": "o",
232 "\u1ECD": "o",
233 "\u1ED5": "o",
234 "\u1ED7": "o",
235 "\u1ED9": "o",
236 "\u1EDD": "o",
237 "\u1EDF": "o",
238 "\u1EE1": "o",
239 "\u1EDB": "o",
240 "\u1EE3": "o",
241 "\xF9": "u",
242 "\xFA": "u",
243 "\xFB": "u",
244 "\xFC": "u",
245 "\u1EE7": "u",
246 "\u1EE5": "u",
247 "\u1EED": "u",
248 "\u1EEF": "u",
249 "\u1EF1": "u",
250 "\xFD": "y",
251 "\xFF": "y",
252 "\u0100": "A",
253 "\u0101": "a",
254 "\u0102": "A",
255 "\u0103": "a",
256 "\u0104": "A",
257 "\u0105": "a",
258 "\u0106": "C",
259 "\u0107": "c",
260 "\u0108": "C",
261 "\u0109": "c",
262 "\u010A": "C",
263 "\u010B": "c",
264 "\u010C": "C",
265 "\u010D": "c",
266 "C\u0306": "C",
267 "c\u0306": "c",
268 "\u010E": "D",
269 "\u010F": "d",
270 "\u0110": "D",
271 "\u0111": "d",
272 "\u0112": "E",
273 "\u0113": "e",
274 "\u0114": "E",
275 "\u0115": "e",
276 "\u0116": "E",
277 "\u0117": "e",
278 "\u0118": "E",
279 "\u0119": "e",
280 "\u011A": "E",
281 "\u011B": "e",
282 "\u011C": "G",
283 "\u01F4": "G",
284 "\u011D": "g",
285 "\u01F5": "g",
286 "\u011E": "G",
287 "\u011F": "g",
288 "\u0120": "G",
289 "\u0121": "g",
290 "\u0122": "G",
291 "\u0123": "g",
292 "\u0124": "H",
293 "\u0125": "h",
294 "\u0126": "H",
295 "\u0127": "h",
296 "\u1E2A": "H",
297 "\u1E2B": "h",
298 "\u0128": "I",
299 "\u0129": "i",
300 "\u012A": "I",
301 "\u012B": "i",
302 "\u012C": "I",
303 "\u012D": "i",
304 "\u012E": "I",
305 "\u012F": "i",
306 "\u0130": "I",
307 "\u0131": "i",
308 "\u0132": "IJ",
309 "\u0133": "ij",
310 "\u0134": "J",
311 "\u0135": "j",
312 "\u0136": "K",
313 "\u0137": "k",
314 "\u1E30": "K",
315 "\u1E31": "k",
316 "K\u0306": "K",
317 "k\u0306": "k",
318 "\u0139": "L",
319 "\u013A": "l",
320 "\u013B": "L",
321 "\u013C": "l",
322 "\u013D": "L",
323 "\u013E": "l",
324 "\u013F": "L",
325 "\u0140": "l",
326 "\u0141": "l",
327 "\u0142": "l",
328 "\u1E3E": "M",
329 "\u1E3F": "m",
330 "M\u0306": "M",
331 "m\u0306": "m",
332 "\u0143": "N",
333 "\u0144": "n",
334 "\u0145": "N",
335 "\u0146": "n",
336 "\u0147": "N",
337 "\u0148": "n",
338 "\u0149": "n",
339 "N\u0306": "N",
340 "n\u0306": "n",
341 "\u014C": "O",
342 "\u014D": "o",
343 "\u014E": "O",
344 "\u014F": "o",
345 "\u0150": "O",
346 "\u0151": "o",
347 "\u0152": "OE",
348 "\u0153": "oe",
349 "P\u0306": "P",
350 "p\u0306": "p",
351 "\u0154": "R",
352 "\u0155": "r",
353 "\u0156": "R",
354 "\u0157": "r",
355 "\u0158": "R",
356 "\u0159": "r",
357 "R\u0306": "R",
358 "r\u0306": "r",
359 "\u0212": "R",
360 "\u0213": "r",
361 "\u015A": "S",
362 "\u015B": "s",
363 "\u015C": "S",
364 "\u015D": "s",
365 "\u015E": "S",
366 "\u0218": "S",
367 "\u0219": "s",
368 "\u015F": "s",
369 "\u0160": "S",
370 "\u0161": "s",
371 "\u0162": "T",
372 "\u0163": "t",
373 "\u021B": "t",
374 "\u021A": "T",
375 "\u0164": "T",
376 "\u0165": "t",
377 "\u0166": "T",
378 "\u0167": "t",
379 "T\u0306": "T",
380 "t\u0306": "t",
381 "\u0168": "U",
382 "\u0169": "u",
383 "\u016A": "U",
384 "\u016B": "u",
385 "\u016C": "U",
386 "\u016D": "u",
387 "\u016E": "U",
388 "\u016F": "u",
389 "\u0170": "U",
390 "\u0171": "u",
391 "\u0172": "U",
392 "\u0173": "u",
393 "\u0216": "U",
394 "\u0217": "u",
395 "V\u0306": "V",
396 "v\u0306": "v",
397 "\u0174": "W",
398 "\u0175": "w",
399 "\u1E82": "W",
400 "\u1E83": "w",
401 "X\u0306": "X",
402 "x\u0306": "x",
403 "\u0176": "Y",
404 "\u0177": "y",
405 "\u0178": "Y",
406 "Y\u0306": "Y",
407 "y\u0306": "y",
408 "\u0179": "Z",
409 "\u017A": "z",
410 "\u017B": "Z",
411 "\u017C": "z",
412 "\u017D": "Z",
413 "\u017E": "z",
414 "\u017F": "s",
415 "\u0192": "f",
416 "\u01A0": "O",
417 "\u01A1": "o",
418 "\u01AF": "U",
419 "\u01B0": "u",
420 "\u01CD": "A",
421 "\u01CE": "a",
422 "\u01CF": "I",
423 "\u01D0": "i",
424 "\u01D1": "O",
425 "\u01D2": "o",
426 "\u01D3": "U",
427 "\u01D4": "u",
428 "\u01D5": "U",
429 "\u01D6": "u",
430 "\u01D7": "U",
431 "\u01D8": "u",
432 "\u01D9": "U",
433 "\u01DA": "u",
434 "\u01DB": "U",
435 "\u01DC": "u",
436 "\u1EE8": "U",
437 "\u1EE9": "u",
438 "\u1E78": "U",
439 "\u1E79": "u",
440 "\u01FA": "A",
441 "\u01FB": "a",
442 "\u01FC": "AE",
443 "\u01FD": "ae",
444 "\u01FE": "O",
445 "\u01FF": "o",
446 "\xDE": "TH",
447 "\xFE": "th",
448 "\u1E54": "P",
449 "\u1E55": "p",
450 "\u1E64": "S",
451 "\u1E65": "s",
452 "X\u0301": "X",
453 "x\u0301": "x",
454 "\u0403": "\u0413",
455 "\u0453": "\u0433",
456 "\u040C": "\u041A",
457 "\u045C": "\u043A",
458 "A\u030B": "A",
459 "a\u030B": "a",
460 "E\u030B": "E",
461 "e\u030B": "e",
462 "I\u030B": "I",
463 "i\u030B": "i",
464 "\u01F8": "N",
465 "\u01F9": "n",
466 "\u1ED2": "O",
467 "\u1ED3": "o",
468 "\u1E50": "O",
469 "\u1E51": "o",
470 "\u1EEA": "U",
471 "\u1EEB": "u",
472 "\u1E80": "W",
473 "\u1E81": "w",
474 "\u1EF2": "Y",
475 "\u1EF3": "y",
476 "\u0200": "A",
477 "\u0201": "a",
478 "\u0204": "E",
479 "\u0205": "e",
480 "\u0208": "I",
481 "\u0209": "i",
482 "\u020C": "O",
483 "\u020D": "o",
484 "\u0210": "R",
485 "\u0211": "r",
486 "\u0214": "U",
487 "\u0215": "u",
488 "B\u030C": "B",
489 "b\u030C": "b",
490 "\u010C\u0323": "C",
491 "\u010D\u0323": "c",
492 "\xCA\u030C": "E",
493 "\xEA\u030C": "e",
494 "F\u030C": "F",
495 "f\u030C": "f",
496 "\u01E6": "G",
497 "\u01E7": "g",
498 "\u021E": "H",
499 "\u021F": "h",
500 "J\u030C": "J",
501 "\u01F0": "j",
502 "\u01E8": "K",
503 "\u01E9": "k",
504 "M\u030C": "M",
505 "m\u030C": "m",
506 "P\u030C": "P",
507 "p\u030C": "p",
508 "Q\u030C": "Q",
509 "q\u030C": "q",
510 "\u0158\u0329": "R",
511 "\u0159\u0329": "r",
512 "\u1E66": "S",
513 "\u1E67": "s",
514 "V\u030C": "V",
515 "v\u030C": "v",
516 "W\u030C": "W",
517 "w\u030C": "w",
518 "X\u030C": "X",
519 "x\u030C": "x",
520 "Y\u030C": "Y",
521 "y\u030C": "y",
522 "A\u0327": "A",
523 "a\u0327": "a",
524 "B\u0327": "B",
525 "b\u0327": "b",
526 "\u1E10": "D",
527 "\u1E11": "d",
528 "\u0228": "E",
529 "\u0229": "e",
530 "\u0190\u0327": "E",
531 "\u025B\u0327": "e",
532 "\u1E28": "H",
533 "\u1E29": "h",
534 "I\u0327": "I",
535 "i\u0327": "i",
536 "\u0197\u0327": "I",
537 "\u0268\u0327": "i",
538 "M\u0327": "M",
539 "m\u0327": "m",
540 "O\u0327": "O",
541 "o\u0327": "o",
542 "Q\u0327": "Q",
543 "q\u0327": "q",
544 "U\u0327": "U",
545 "u\u0327": "u",
546 "X\u0327": "X",
547 "x\u0327": "x",
548 "Z\u0327": "Z",
549 "z\u0327": "z",
550 "\u0439": "\u0438",
551 "\u0419": "\u0418",
552 "\u0451": "\u0435",
553 "\u0401": "\u0415"
554 };
555 var chars = Object.keys(characterMap).join("|");
556 var allAccents = new RegExp(chars, "g");
557 var firstAccent = new RegExp(chars, "");
558 function matcher3(match) {
559 return characterMap[match];
560 }
561 var removeAccents2 = function(string) {
562 return string.replace(allAccents, matcher3);
563 };
564 var hasAccents = function(string) {
565 return !!string.match(firstAccent);
566 };
567 module.exports = removeAccents2;
568 module.exports.has = hasAccents;
569 module.exports.remove = removeAccents2;
570 }
571 });
572
573 // packages/blocks/node_modules/react-is/cjs/react-is.development.js
574 var require_react_is_development = __commonJS({
575 "packages/blocks/node_modules/react-is/cjs/react-is.development.js"(exports) {
576 "use strict";
577 if (true) {
578 (function() {
579 "use strict";
580 var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
581 var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
582 var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
583 var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
584 var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
585 var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
586 var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
587 var REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context");
588 var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
589 var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
590 var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list");
591 var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
592 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
593 var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
594 var enableScopeAPI = false;
595 var enableCacheElement = false;
596 var enableTransitionTracing = false;
597 var enableLegacyHidden = false;
598 var enableDebugTracing = false;
599 var REACT_MODULE_REFERENCE;
600 {
601 REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
602 }
603 function isValidElementType2(type) {
604 if (typeof type === "string" || typeof type === "function") {
605 return true;
606 }
607 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
608 return true;
609 }
610 if (typeof type === "object" && type !== null) {
611 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
612 // types supported by any Flight configuration anywhere since
613 // we don't know which Flight build this will end up being used
614 // with.
615 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
616 return true;
617 }
618 }
619 return false;
620 }
621 function typeOf(object) {
622 if (typeof object === "object" && object !== null) {
623 var $$typeof = object.$$typeof;
624 switch ($$typeof) {
625 case REACT_ELEMENT_TYPE:
626 var type = object.type;
627 switch (type) {
628 case REACT_FRAGMENT_TYPE:
629 case REACT_PROFILER_TYPE:
630 case REACT_STRICT_MODE_TYPE:
631 case REACT_SUSPENSE_TYPE:
632 case REACT_SUSPENSE_LIST_TYPE:
633 return type;
634 default:
635 var $$typeofType = type && type.$$typeof;
636 switch ($$typeofType) {
637 case REACT_SERVER_CONTEXT_TYPE:
638 case REACT_CONTEXT_TYPE:
639 case REACT_FORWARD_REF_TYPE:
640 case REACT_LAZY_TYPE:
641 case REACT_MEMO_TYPE:
642 case REACT_PROVIDER_TYPE:
643 return $$typeofType;
644 default:
645 return $$typeof;
646 }
647 }
648 case REACT_PORTAL_TYPE:
649 return $$typeof;
650 }
651 }
652 return void 0;
653 }
654 var ContextConsumer = REACT_CONTEXT_TYPE;
655 var ContextProvider = REACT_PROVIDER_TYPE;
656 var Element = REACT_ELEMENT_TYPE;
657 var ForwardRef = REACT_FORWARD_REF_TYPE;
658 var Fragment = REACT_FRAGMENT_TYPE;
659 var Lazy = REACT_LAZY_TYPE;
660 var Memo = REACT_MEMO_TYPE;
661 var Portal = REACT_PORTAL_TYPE;
662 var Profiler = REACT_PROFILER_TYPE;
663 var StrictMode = REACT_STRICT_MODE_TYPE;
664 var Suspense = REACT_SUSPENSE_TYPE;
665 var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
666 var hasWarnedAboutDeprecatedIsAsyncMode = false;
667 var hasWarnedAboutDeprecatedIsConcurrentMode = false;
668 function isAsyncMode(object) {
669 {
670 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
671 hasWarnedAboutDeprecatedIsAsyncMode = true;
672 console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
673 }
674 }
675 return false;
676 }
677 function isConcurrentMode(object) {
678 {
679 if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
680 hasWarnedAboutDeprecatedIsConcurrentMode = true;
681 console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
682 }
683 }
684 return false;
685 }
686 function isContextConsumer(object) {
687 return typeOf(object) === REACT_CONTEXT_TYPE;
688 }
689 function isContextProvider(object) {
690 return typeOf(object) === REACT_PROVIDER_TYPE;
691 }
692 function isElement(object) {
693 return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
694 }
695 function isForwardRef(object) {
696 return typeOf(object) === REACT_FORWARD_REF_TYPE;
697 }
698 function isFragment(object) {
699 return typeOf(object) === REACT_FRAGMENT_TYPE;
700 }
701 function isLazy(object) {
702 return typeOf(object) === REACT_LAZY_TYPE;
703 }
704 function isMemo(object) {
705 return typeOf(object) === REACT_MEMO_TYPE;
706 }
707 function isPortal(object) {
708 return typeOf(object) === REACT_PORTAL_TYPE;
709 }
710 function isProfiler(object) {
711 return typeOf(object) === REACT_PROFILER_TYPE;
712 }
713 function isStrictMode(object) {
714 return typeOf(object) === REACT_STRICT_MODE_TYPE;
715 }
716 function isSuspense(object) {
717 return typeOf(object) === REACT_SUSPENSE_TYPE;
718 }
719 function isSuspenseList(object) {
720 return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
721 }
722 exports.ContextConsumer = ContextConsumer;
723 exports.ContextProvider = ContextProvider;
724 exports.Element = Element;
725 exports.ForwardRef = ForwardRef;
726 exports.Fragment = Fragment;
727 exports.Lazy = Lazy;
728 exports.Memo = Memo;
729 exports.Portal = Portal;
730 exports.Profiler = Profiler;
731 exports.StrictMode = StrictMode;
732 exports.Suspense = Suspense;
733 exports.SuspenseList = SuspenseList;
734 exports.isAsyncMode = isAsyncMode;
735 exports.isConcurrentMode = isConcurrentMode;
736 exports.isContextConsumer = isContextConsumer;
737 exports.isContextProvider = isContextProvider;
738 exports.isElement = isElement;
739 exports.isForwardRef = isForwardRef;
740 exports.isFragment = isFragment;
741 exports.isLazy = isLazy;
742 exports.isMemo = isMemo;
743 exports.isPortal = isPortal;
744 exports.isProfiler = isProfiler;
745 exports.isStrictMode = isStrictMode;
746 exports.isSuspense = isSuspense;
747 exports.isSuspenseList = isSuspenseList;
748 exports.isValidElementType = isValidElementType2;
749 exports.typeOf = typeOf;
750 })();
751 }
752 }
753 });
754
755 // packages/blocks/node_modules/react-is/index.js
756 var require_react_is = __commonJS({
757 "packages/blocks/node_modules/react-is/index.js"(exports, module) {
758 "use strict";
759 if (false) {
760 module.exports = null;
761 } else {
762 module.exports = require_react_is_development();
763 }
764 }
765 });
766
767 // package-external:@wordpress/hooks
768 var require_hooks = __commonJS({
769 "package-external:@wordpress/hooks"(exports, module) {
770 module.exports = window.wp.hooks;
771 }
772 });
773
774 // package-external:@wordpress/block-serialization-default-parser
775 var require_block_serialization_default_parser = __commonJS({
776 "package-external:@wordpress/block-serialization-default-parser"(exports, module) {
777 module.exports = window.wp.blockSerializationDefaultParser;
778 }
779 });
780
781 // package-external:@wordpress/autop
782 var require_autop = __commonJS({
783 "package-external:@wordpress/autop"(exports, module) {
784 module.exports = window.wp.autop;
785 }
786 });
787
788 // package-external:@wordpress/is-shallow-equal
789 var require_is_shallow_equal = __commonJS({
790 "package-external:@wordpress/is-shallow-equal"(exports, module) {
791 module.exports = window.wp.isShallowEqual;
792 }
793 });
794
795 // vendor-external:react/jsx-runtime
796 var require_jsx_runtime = __commonJS({
797 "vendor-external:react/jsx-runtime"(exports, module) {
798 module.exports = window.ReactJSXRuntime;
799 }
800 });
801
802 // node_modules/fast-deep-equal/es6/index.js
803 var require_es6 = __commonJS({
804 "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
805 "use strict";
806 module.exports = function equal(a2, b2) {
807 if (a2 === b2) return true;
808 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
809 if (a2.constructor !== b2.constructor) return false;
810 var length, i2, keys;
811 if (Array.isArray(a2)) {
812 length = a2.length;
813 if (length != b2.length) return false;
814 for (i2 = length; i2-- !== 0; )
815 if (!equal(a2[i2], b2[i2])) return false;
816 return true;
817 }
818 if (a2 instanceof Map && b2 instanceof Map) {
819 if (a2.size !== b2.size) return false;
820 for (i2 of a2.entries())
821 if (!b2.has(i2[0])) return false;
822 for (i2 of a2.entries())
823 if (!equal(i2[1], b2.get(i2[0]))) return false;
824 return true;
825 }
826 if (a2 instanceof Set && b2 instanceof Set) {
827 if (a2.size !== b2.size) return false;
828 for (i2 of a2.entries())
829 if (!b2.has(i2[0])) return false;
830 return true;
831 }
832 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
833 length = a2.length;
834 if (length != b2.length) return false;
835 for (i2 = length; i2-- !== 0; )
836 if (a2[i2] !== b2[i2]) return false;
837 return true;
838 }
839 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
840 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
841 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
842 keys = Object.keys(a2);
843 length = keys.length;
844 if (length !== Object.keys(b2).length) return false;
845 for (i2 = length; i2-- !== 0; )
846 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
847 for (i2 = length; i2-- !== 0; ) {
848 var key = keys[i2];
849 if (!equal(a2[key], b2[key])) return false;
850 }
851 return true;
852 }
853 return a2 !== a2 && b2 !== b2;
854 };
855 }
856 });
857
858 // package-external:@wordpress/html-entities
859 var require_html_entities = __commonJS({
860 "package-external:@wordpress/html-entities"(exports, module) {
861 module.exports = window.wp.htmlEntities;
862 }
863 });
864
865 // package-external:@wordpress/shortcode
866 var require_shortcode = __commonJS({
867 "package-external:@wordpress/shortcode"(exports, module) {
868 module.exports = window.wp.shortcode;
869 }
870 });
871
872 // package-external:@wordpress/blob
873 var require_blob = __commonJS({
874 "package-external:@wordpress/blob"(exports, module) {
875 module.exports = window.wp.blob;
876 }
877 });
878
879 // node_modules/showdown/dist/showdown.js
880 var require_showdown = __commonJS({
881 "node_modules/showdown/dist/showdown.js"(exports, module) {
882 (function() {
883 function getDefaultOpts(simple) {
884 "use strict";
885 var defaultOptions = {
886 omitExtraWLInCodeBlocks: {
887 defaultValue: false,
888 describe: "Omit the default extra whiteline added to code blocks",
889 type: "boolean"
890 },
891 noHeaderId: {
892 defaultValue: false,
893 describe: "Turn on/off generated header id",
894 type: "boolean"
895 },
896 prefixHeaderId: {
897 defaultValue: false,
898 describe: "Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",
899 type: "string"
900 },
901 rawPrefixHeaderId: {
902 defaultValue: false,
903 describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
904 type: "boolean"
905 },
906 ghCompatibleHeaderId: {
907 defaultValue: false,
908 describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",
909 type: "boolean"
910 },
911 rawHeaderId: {
912 defaultValue: false,
913 describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`,
914 type: "boolean"
915 },
916 headerLevelStart: {
917 defaultValue: false,
918 describe: "The header blocks level start",
919 type: "integer"
920 },
921 parseImgDimensions: {
922 defaultValue: false,
923 describe: "Turn on/off image dimension parsing",
924 type: "boolean"
925 },
926 simplifiedAutoLink: {
927 defaultValue: false,
928 describe: "Turn on/off GFM autolink style",
929 type: "boolean"
930 },
931 excludeTrailingPunctuationFromURLs: {
932 defaultValue: false,
933 describe: "Excludes trailing punctuation from links generated with autoLinking",
934 type: "boolean"
935 },
936 literalMidWordUnderscores: {
937 defaultValue: false,
938 describe: "Parse midword underscores as literal underscores",
939 type: "boolean"
940 },
941 literalMidWordAsterisks: {
942 defaultValue: false,
943 describe: "Parse midword asterisks as literal asterisks",
944 type: "boolean"
945 },
946 strikethrough: {
947 defaultValue: false,
948 describe: "Turn on/off strikethrough support",
949 type: "boolean"
950 },
951 tables: {
952 defaultValue: false,
953 describe: "Turn on/off tables support",
954 type: "boolean"
955 },
956 tablesHeaderId: {
957 defaultValue: false,
958 describe: "Add an id to table headers",
959 type: "boolean"
960 },
961 ghCodeBlocks: {
962 defaultValue: true,
963 describe: "Turn on/off GFM fenced code blocks support",
964 type: "boolean"
965 },
966 tasklists: {
967 defaultValue: false,
968 describe: "Turn on/off GFM tasklist support",
969 type: "boolean"
970 },
971 smoothLivePreview: {
972 defaultValue: false,
973 describe: "Prevents weird effects in live previews due to incomplete input",
974 type: "boolean"
975 },
976 smartIndentationFix: {
977 defaultValue: false,
978 description: "Tries to smartly fix indentation in es6 strings",
979 type: "boolean"
980 },
981 disableForced4SpacesIndentedSublists: {
982 defaultValue: false,
983 description: "Disables the requirement of indenting nested sublists by 4 spaces",
984 type: "boolean"
985 },
986 simpleLineBreaks: {
987 defaultValue: false,
988 description: "Parses simple line breaks as <br> (GFM Style)",
989 type: "boolean"
990 },
991 requireSpaceBeforeHeadingText: {
992 defaultValue: false,
993 description: "Makes adding a space between `#` and the header text mandatory (GFM Style)",
994 type: "boolean"
995 },
996 ghMentions: {
997 defaultValue: false,
998 description: "Enables github @mentions",
999 type: "boolean"
1000 },
1001 ghMentionsLink: {
1002 defaultValue: "https://github.com/{u}",
1003 description: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",
1004 type: "string"
1005 },
1006 encodeEmails: {
1007 defaultValue: true,
1008 description: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",
1009 type: "boolean"
1010 },
1011 openLinksInNewWindow: {
1012 defaultValue: false,
1013 description: "Open all links in new windows",
1014 type: "boolean"
1015 },
1016 backslashEscapesHTMLTags: {
1017 defaultValue: false,
1018 description: "Support for HTML Tag escaping. ex: <div>foo</div>",
1019 type: "boolean"
1020 },
1021 emoji: {
1022 defaultValue: false,
1023 description: "Enable emoji support. Ex: `this is a :smile: emoji`",
1024 type: "boolean"
1025 },
1026 underline: {
1027 defaultValue: false,
1028 description: "Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",
1029 type: "boolean"
1030 },
1031 completeHTMLDocument: {
1032 defaultValue: false,
1033 description: "Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",
1034 type: "boolean"
1035 },
1036 metadata: {
1037 defaultValue: false,
1038 description: "Enable support for document metadata (defined at the top of the document between `\xAB\xAB\xAB` and `\xBB\xBB\xBB` or between `---` and `---`).",
1039 type: "boolean"
1040 },
1041 splitAdjacentBlockquotes: {
1042 defaultValue: false,
1043 description: "Split adjacent blockquote blocks",
1044 type: "boolean"
1045 }
1046 };
1047 if (simple === false) {
1048 return JSON.parse(JSON.stringify(defaultOptions));
1049 }
1050 var ret = {};
1051 for (var opt in defaultOptions) {
1052 if (defaultOptions.hasOwnProperty(opt)) {
1053 ret[opt] = defaultOptions[opt].defaultValue;
1054 }
1055 }
1056 return ret;
1057 }
1058 function allOptionsOn() {
1059 "use strict";
1060 var options = getDefaultOpts(true), ret = {};
1061 for (var opt in options) {
1062 if (options.hasOwnProperty(opt)) {
1063 ret[opt] = true;
1064 }
1065 }
1066 return ret;
1067 }
1068 var showdown2 = {}, parsers = {}, extensions = {}, globalOptions = getDefaultOpts(true), setFlavor = "vanilla", flavor = {
1069 github: {
1070 omitExtraWLInCodeBlocks: true,
1071 simplifiedAutoLink: true,
1072 excludeTrailingPunctuationFromURLs: true,
1073 literalMidWordUnderscores: true,
1074 strikethrough: true,
1075 tables: true,
1076 tablesHeaderId: true,
1077 ghCodeBlocks: true,
1078 tasklists: true,
1079 disableForced4SpacesIndentedSublists: true,
1080 simpleLineBreaks: true,
1081 requireSpaceBeforeHeadingText: true,
1082 ghCompatibleHeaderId: true,
1083 ghMentions: true,
1084 backslashEscapesHTMLTags: true,
1085 emoji: true,
1086 splitAdjacentBlockquotes: true
1087 },
1088 original: {
1089 noHeaderId: true,
1090 ghCodeBlocks: false
1091 },
1092 ghost: {
1093 omitExtraWLInCodeBlocks: true,
1094 parseImgDimensions: true,
1095 simplifiedAutoLink: true,
1096 excludeTrailingPunctuationFromURLs: true,
1097 literalMidWordUnderscores: true,
1098 strikethrough: true,
1099 tables: true,
1100 tablesHeaderId: true,
1101 ghCodeBlocks: true,
1102 tasklists: true,
1103 smoothLivePreview: true,
1104 simpleLineBreaks: true,
1105 requireSpaceBeforeHeadingText: true,
1106 ghMentions: false,
1107 encodeEmails: true
1108 },
1109 vanilla: getDefaultOpts(true),
1110 allOn: allOptionsOn()
1111 };
1112 showdown2.helper = {};
1113 showdown2.extensions = {};
1114 showdown2.setOption = function(key, value) {
1115 "use strict";
1116 globalOptions[key] = value;
1117 return this;
1118 };
1119 showdown2.getOption = function(key) {
1120 "use strict";
1121 return globalOptions[key];
1122 };
1123 showdown2.getOptions = function() {
1124 "use strict";
1125 return globalOptions;
1126 };
1127 showdown2.resetOptions = function() {
1128 "use strict";
1129 globalOptions = getDefaultOpts(true);
1130 };
1131 showdown2.setFlavor = function(name) {
1132 "use strict";
1133 if (!flavor.hasOwnProperty(name)) {
1134 throw Error(name + " flavor was not found");
1135 }
1136 showdown2.resetOptions();
1137 var preset = flavor[name];
1138 setFlavor = name;
1139 for (var option in preset) {
1140 if (preset.hasOwnProperty(option)) {
1141 globalOptions[option] = preset[option];
1142 }
1143 }
1144 };
1145 showdown2.getFlavor = function() {
1146 "use strict";
1147 return setFlavor;
1148 };
1149 showdown2.getFlavorOptions = function(name) {
1150 "use strict";
1151 if (flavor.hasOwnProperty(name)) {
1152 return flavor[name];
1153 }
1154 };
1155 showdown2.getDefaultOptions = function(simple) {
1156 "use strict";
1157 return getDefaultOpts(simple);
1158 };
1159 showdown2.subParser = function(name, func) {
1160 "use strict";
1161 if (showdown2.helper.isString(name)) {
1162 if (typeof func !== "undefined") {
1163 parsers[name] = func;
1164 } else {
1165 if (parsers.hasOwnProperty(name)) {
1166 return parsers[name];
1167 } else {
1168 throw Error("SubParser named " + name + " not registered!");
1169 }
1170 }
1171 }
1172 };
1173 showdown2.extension = function(name, ext) {
1174 "use strict";
1175 if (!showdown2.helper.isString(name)) {
1176 throw Error("Extension 'name' must be a string");
1177 }
1178 name = showdown2.helper.stdExtName(name);
1179 if (showdown2.helper.isUndefined(ext)) {
1180 if (!extensions.hasOwnProperty(name)) {
1181 throw Error("Extension named " + name + " is not registered!");
1182 }
1183 return extensions[name];
1184 } else {
1185 if (typeof ext === "function") {
1186 ext = ext();
1187 }
1188 if (!showdown2.helper.isArray(ext)) {
1189 ext = [ext];
1190 }
1191 var validExtension = validate(ext, name);
1192 if (validExtension.valid) {
1193 extensions[name] = ext;
1194 } else {
1195 throw Error(validExtension.error);
1196 }
1197 }
1198 };
1199 showdown2.getAllExtensions = function() {
1200 "use strict";
1201 return extensions;
1202 };
1203 showdown2.removeExtension = function(name) {
1204 "use strict";
1205 delete extensions[name];
1206 };
1207 showdown2.resetExtensions = function() {
1208 "use strict";
1209 extensions = {};
1210 };
1211 function validate(extension, name) {
1212 "use strict";
1213 var errMsg = name ? "Error in " + name + " extension->" : "Error in unnamed extension", ret = {
1214 valid: true,
1215 error: ""
1216 };
1217 if (!showdown2.helper.isArray(extension)) {
1218 extension = [extension];
1219 }
1220 for (var i2 = 0; i2 < extension.length; ++i2) {
1221 var baseMsg = errMsg + " sub-extension " + i2 + ": ", ext = extension[i2];
1222 if (typeof ext !== "object") {
1223 ret.valid = false;
1224 ret.error = baseMsg + "must be an object, but " + typeof ext + " given";
1225 return ret;
1226 }
1227 if (!showdown2.helper.isString(ext.type)) {
1228 ret.valid = false;
1229 ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + " given";
1230 return ret;
1231 }
1232 var type = ext.type = ext.type.toLowerCase();
1233 if (type === "language") {
1234 type = ext.type = "lang";
1235 }
1236 if (type === "html") {
1237 type = ext.type = "output";
1238 }
1239 if (type !== "lang" && type !== "output" && type !== "listener") {
1240 ret.valid = false;
1241 ret.error = baseMsg + "type " + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
1242 return ret;
1243 }
1244 if (type === "listener") {
1245 if (showdown2.helper.isUndefined(ext.listeners)) {
1246 ret.valid = false;
1247 ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
1248 return ret;
1249 }
1250 } else {
1251 if (showdown2.helper.isUndefined(ext.filter) && showdown2.helper.isUndefined(ext.regex)) {
1252 ret.valid = false;
1253 ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
1254 return ret;
1255 }
1256 }
1257 if (ext.listeners) {
1258 if (typeof ext.listeners !== "object") {
1259 ret.valid = false;
1260 ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + " given";
1261 return ret;
1262 }
1263 for (var ln in ext.listeners) {
1264 if (ext.listeners.hasOwnProperty(ln)) {
1265 if (typeof ext.listeners[ln] !== "function") {
1266 ret.valid = false;
1267 ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln + " must be a function but " + typeof ext.listeners[ln] + " given";
1268 return ret;
1269 }
1270 }
1271 }
1272 }
1273 if (ext.filter) {
1274 if (typeof ext.filter !== "function") {
1275 ret.valid = false;
1276 ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + " given";
1277 return ret;
1278 }
1279 } else if (ext.regex) {
1280 if (showdown2.helper.isString(ext.regex)) {
1281 ext.regex = new RegExp(ext.regex, "g");
1282 }
1283 if (!(ext.regex instanceof RegExp)) {
1284 ret.valid = false;
1285 ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + " given";
1286 return ret;
1287 }
1288 if (showdown2.helper.isUndefined(ext.replace)) {
1289 ret.valid = false;
1290 ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
1291 return ret;
1292 }
1293 }
1294 }
1295 return ret;
1296 }
1297 showdown2.validateExtension = function(ext) {
1298 "use strict";
1299 var validateExtension = validate(ext, null);
1300 if (!validateExtension.valid) {
1301 console.warn(validateExtension.error);
1302 return false;
1303 }
1304 return true;
1305 };
1306 if (!showdown2.hasOwnProperty("helper")) {
1307 showdown2.helper = {};
1308 }
1309 showdown2.helper.isString = function(a2) {
1310 "use strict";
1311 return typeof a2 === "string" || a2 instanceof String;
1312 };
1313 showdown2.helper.isFunction = function(a2) {
1314 "use strict";
1315 var getType = {};
1316 return a2 && getType.toString.call(a2) === "[object Function]";
1317 };
1318 showdown2.helper.isArray = function(a2) {
1319 "use strict";
1320 return Array.isArray(a2);
1321 };
1322 showdown2.helper.isUndefined = function(value) {
1323 "use strict";
1324 return typeof value === "undefined";
1325 };
1326 showdown2.helper.forEach = function(obj, callback) {
1327 "use strict";
1328 if (showdown2.helper.isUndefined(obj)) {
1329 throw new Error("obj param is required");
1330 }
1331 if (showdown2.helper.isUndefined(callback)) {
1332 throw new Error("callback param is required");
1333 }
1334 if (!showdown2.helper.isFunction(callback)) {
1335 throw new Error("callback param must be a function/closure");
1336 }
1337 if (typeof obj.forEach === "function") {
1338 obj.forEach(callback);
1339 } else if (showdown2.helper.isArray(obj)) {
1340 for (var i2 = 0; i2 < obj.length; i2++) {
1341 callback(obj[i2], i2, obj);
1342 }
1343 } else if (typeof obj === "object") {
1344 for (var prop2 in obj) {
1345 if (obj.hasOwnProperty(prop2)) {
1346 callback(obj[prop2], prop2, obj);
1347 }
1348 }
1349 } else {
1350 throw new Error("obj does not seem to be an array or an iterable object");
1351 }
1352 };
1353 showdown2.helper.stdExtName = function(s2) {
1354 "use strict";
1355 return s2.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase();
1356 };
1357 function escapeCharactersCallback(wholeMatch, m1) {
1358 "use strict";
1359 var charCodeToEscape = m1.charCodeAt(0);
1360 return "\xA8E" + charCodeToEscape + "E";
1361 }
1362 showdown2.helper.escapeCharactersCallback = escapeCharactersCallback;
1363 showdown2.helper.escapeCharacters = function(text2, charsToEscape, afterBackslash) {
1364 "use strict";
1365 var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])";
1366 if (afterBackslash) {
1367 regexString = "\\\\" + regexString;
1368 }
1369 var regex = new RegExp(regexString, "g");
1370 text2 = text2.replace(regex, escapeCharactersCallback);
1371 return text2;
1372 };
1373 showdown2.helper.unescapeHTMLEntities = function(txt) {
1374 "use strict";
1375 return txt.replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
1376 };
1377 var rgxFindMatchPos = function(str, left, right, flags) {
1378 "use strict";
1379 var f2 = flags || "", g2 = f2.indexOf("g") > -1, x2 = new RegExp(left + "|" + right, "g" + f2.replace(/g/g, "")), l2 = new RegExp(left, f2.replace(/g/g, "")), pos = [], t3, s2, m2, start, end;
1380 do {
1381 t3 = 0;
1382 while (m2 = x2.exec(str)) {
1383 if (l2.test(m2[0])) {
1384 if (!t3++) {
1385 s2 = x2.lastIndex;
1386 start = s2 - m2[0].length;
1387 }
1388 } else if (t3) {
1389 if (!--t3) {
1390 end = m2.index + m2[0].length;
1391 var obj = {
1392 left: { start, end: s2 },
1393 match: { start: s2, end: m2.index },
1394 right: { start: m2.index, end },
1395 wholeMatch: { start, end }
1396 };
1397 pos.push(obj);
1398 if (!g2) {
1399 return pos;
1400 }
1401 }
1402 }
1403 }
1404 } while (t3 && (x2.lastIndex = s2));
1405 return pos;
1406 };
1407 showdown2.helper.matchRecursiveRegExp = function(str, left, right, flags) {
1408 "use strict";
1409 var matchPos = rgxFindMatchPos(str, left, right, flags), results = [];
1410 for (var i2 = 0; i2 < matchPos.length; ++i2) {
1411 results.push([
1412 str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end),
1413 str.slice(matchPos[i2].match.start, matchPos[i2].match.end),
1414 str.slice(matchPos[i2].left.start, matchPos[i2].left.end),
1415 str.slice(matchPos[i2].right.start, matchPos[i2].right.end)
1416 ]);
1417 }
1418 return results;
1419 };
1420 showdown2.helper.replaceRecursiveRegExp = function(str, replacement, left, right, flags) {
1421 "use strict";
1422 if (!showdown2.helper.isFunction(replacement)) {
1423 var repStr = replacement;
1424 replacement = function() {
1425 return repStr;
1426 };
1427 }
1428 var matchPos = rgxFindMatchPos(str, left, right, flags), finalStr = str, lng = matchPos.length;
1429 if (lng > 0) {
1430 var bits = [];
1431 if (matchPos[0].wholeMatch.start !== 0) {
1432 bits.push(str.slice(0, matchPos[0].wholeMatch.start));
1433 }
1434 for (var i2 = 0; i2 < lng; ++i2) {
1435 bits.push(
1436 replacement(
1437 str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end),
1438 str.slice(matchPos[i2].match.start, matchPos[i2].match.end),
1439 str.slice(matchPos[i2].left.start, matchPos[i2].left.end),
1440 str.slice(matchPos[i2].right.start, matchPos[i2].right.end)
1441 )
1442 );
1443 if (i2 < lng - 1) {
1444 bits.push(str.slice(matchPos[i2].wholeMatch.end, matchPos[i2 + 1].wholeMatch.start));
1445 }
1446 }
1447 if (matchPos[lng - 1].wholeMatch.end < str.length) {
1448 bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
1449 }
1450 finalStr = bits.join("");
1451 }
1452 return finalStr;
1453 };
1454 showdown2.helper.regexIndexOf = function(str, regex, fromIndex) {
1455 "use strict";
1456 if (!showdown2.helper.isString(str)) {
1457 throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
1458 }
1459 if (regex instanceof RegExp === false) {
1460 throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";
1461 }
1462 var indexOf = str.substring(fromIndex || 0).search(regex);
1463 return indexOf >= 0 ? indexOf + (fromIndex || 0) : indexOf;
1464 };
1465 showdown2.helper.splitAtIndex = function(str, index) {
1466 "use strict";
1467 if (!showdown2.helper.isString(str)) {
1468 throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
1469 }
1470 return [str.substring(0, index), str.substring(index)];
1471 };
1472 showdown2.helper.encodeEmailAddress = function(mail) {
1473 "use strict";
1474 var encode = [
1475 function(ch) {
1476 return "&#" + ch.charCodeAt(0) + ";";
1477 },
1478 function(ch) {
1479 return "&#x" + ch.charCodeAt(0).toString(16) + ";";
1480 },
1481 function(ch) {
1482 return ch;
1483 }
1484 ];
1485 mail = mail.replace(/./g, function(ch) {
1486 if (ch === "@") {
1487 ch = encode[Math.floor(Math.random() * 2)](ch);
1488 } else {
1489 var r2 = Math.random();
1490 ch = r2 > 0.9 ? encode[2](ch) : r2 > 0.45 ? encode[1](ch) : encode[0](ch);
1491 }
1492 return ch;
1493 });
1494 return mail;
1495 };
1496 showdown2.helper.padEnd = function padEnd(str, targetLength, padString) {
1497 "use strict";
1498 targetLength = targetLength >> 0;
1499 padString = String(padString || " ");
1500 if (str.length > targetLength) {
1501 return String(str);
1502 } else {
1503 targetLength = targetLength - str.length;
1504 if (targetLength > padString.length) {
1505 padString += padString.repeat(targetLength / padString.length);
1506 }
1507 return String(str) + padString.slice(0, targetLength);
1508 }
1509 };
1510 if (typeof console === "undefined") {
1511 console = {
1512 warn: function(msg) {
1513 "use strict";
1514 alert(msg);
1515 },
1516 log: function(msg) {
1517 "use strict";
1518 alert(msg);
1519 },
1520 error: function(msg) {
1521 "use strict";
1522 throw msg;
1523 }
1524 };
1525 }
1526 showdown2.helper.regexes = {
1527 asteriskDashAndColon: /([*_:~])/g
1528 };
1529 showdown2.helper.emojis = {
1530 "+1": "\u{1F44D}",
1531 "-1": "\u{1F44E}",
1532 "100": "\u{1F4AF}",
1533 "1234": "\u{1F522}",
1534 "1st_place_medal": "\u{1F947}",
1535 "2nd_place_medal": "\u{1F948}",
1536 "3rd_place_medal": "\u{1F949}",
1537 "8ball": "\u{1F3B1}",
1538 "a": "\u{1F170}\uFE0F",
1539 "ab": "\u{1F18E}",
1540 "abc": "\u{1F524}",
1541 "abcd": "\u{1F521}",
1542 "accept": "\u{1F251}",
1543 "aerial_tramway": "\u{1F6A1}",
1544 "airplane": "\u2708\uFE0F",
1545 "alarm_clock": "\u23F0",
1546 "alembic": "\u2697\uFE0F",
1547 "alien": "\u{1F47D}",
1548 "ambulance": "\u{1F691}",
1549 "amphora": "\u{1F3FA}",
1550 "anchor": "\u2693\uFE0F",
1551 "angel": "\u{1F47C}",
1552 "anger": "\u{1F4A2}",
1553 "angry": "\u{1F620}",
1554 "anguished": "\u{1F627}",
1555 "ant": "\u{1F41C}",
1556 "apple": "\u{1F34E}",
1557 "aquarius": "\u2652\uFE0F",
1558 "aries": "\u2648\uFE0F",
1559 "arrow_backward": "\u25C0\uFE0F",
1560 "arrow_double_down": "\u23EC",
1561 "arrow_double_up": "\u23EB",
1562 "arrow_down": "\u2B07\uFE0F",
1563 "arrow_down_small": "\u{1F53D}",
1564 "arrow_forward": "\u25B6\uFE0F",
1565 "arrow_heading_down": "\u2935\uFE0F",
1566 "arrow_heading_up": "\u2934\uFE0F",
1567 "arrow_left": "\u2B05\uFE0F",
1568 "arrow_lower_left": "\u2199\uFE0F",
1569 "arrow_lower_right": "\u2198\uFE0F",
1570 "arrow_right": "\u27A1\uFE0F",
1571 "arrow_right_hook": "\u21AA\uFE0F",
1572 "arrow_up": "\u2B06\uFE0F",
1573 "arrow_up_down": "\u2195\uFE0F",
1574 "arrow_up_small": "\u{1F53C}",
1575 "arrow_upper_left": "\u2196\uFE0F",
1576 "arrow_upper_right": "\u2197\uFE0F",
1577 "arrows_clockwise": "\u{1F503}",
1578 "arrows_counterclockwise": "\u{1F504}",
1579 "art": "\u{1F3A8}",
1580 "articulated_lorry": "\u{1F69B}",
1581 "artificial_satellite": "\u{1F6F0}",
1582 "astonished": "\u{1F632}",
1583 "athletic_shoe": "\u{1F45F}",
1584 "atm": "\u{1F3E7}",
1585 "atom_symbol": "\u269B\uFE0F",
1586 "avocado": "\u{1F951}",
1587 "b": "\u{1F171}\uFE0F",
1588 "baby": "\u{1F476}",
1589 "baby_bottle": "\u{1F37C}",
1590 "baby_chick": "\u{1F424}",
1591 "baby_symbol": "\u{1F6BC}",
1592 "back": "\u{1F519}",
1593 "bacon": "\u{1F953}",
1594 "badminton": "\u{1F3F8}",
1595 "baggage_claim": "\u{1F6C4}",
1596 "baguette_bread": "\u{1F956}",
1597 "balance_scale": "\u2696\uFE0F",
1598 "balloon": "\u{1F388}",
1599 "ballot_box": "\u{1F5F3}",
1600 "ballot_box_with_check": "\u2611\uFE0F",
1601 "bamboo": "\u{1F38D}",
1602 "banana": "\u{1F34C}",
1603 "bangbang": "\u203C\uFE0F",
1604 "bank": "\u{1F3E6}",
1605 "bar_chart": "\u{1F4CA}",
1606 "barber": "\u{1F488}",
1607 "baseball": "\u26BE\uFE0F",
1608 "basketball": "\u{1F3C0}",
1609 "basketball_man": "\u26F9\uFE0F",
1610 "basketball_woman": "\u26F9\uFE0F&zwj;\u2640\uFE0F",
1611 "bat": "\u{1F987}",
1612 "bath": "\u{1F6C0}",
1613 "bathtub": "\u{1F6C1}",
1614 "battery": "\u{1F50B}",
1615 "beach_umbrella": "\u{1F3D6}",
1616 "bear": "\u{1F43B}",
1617 "bed": "\u{1F6CF}",
1618 "bee": "\u{1F41D}",
1619 "beer": "\u{1F37A}",
1620 "beers": "\u{1F37B}",
1621 "beetle": "\u{1F41E}",
1622 "beginner": "\u{1F530}",
1623 "bell": "\u{1F514}",
1624 "bellhop_bell": "\u{1F6CE}",
1625 "bento": "\u{1F371}",
1626 "biking_man": "\u{1F6B4}",
1627 "bike": "\u{1F6B2}",
1628 "biking_woman": "\u{1F6B4}&zwj;\u2640\uFE0F",
1629 "bikini": "\u{1F459}",
1630 "biohazard": "\u2623\uFE0F",
1631 "bird": "\u{1F426}",
1632 "birthday": "\u{1F382}",
1633 "black_circle": "\u26AB\uFE0F",
1634 "black_flag": "\u{1F3F4}",
1635 "black_heart": "\u{1F5A4}",
1636 "black_joker": "\u{1F0CF}",
1637 "black_large_square": "\u2B1B\uFE0F",
1638 "black_medium_small_square": "\u25FE\uFE0F",
1639 "black_medium_square": "\u25FC\uFE0F",
1640 "black_nib": "\u2712\uFE0F",
1641 "black_small_square": "\u25AA\uFE0F",
1642 "black_square_button": "\u{1F532}",
1643 "blonde_man": "\u{1F471}",
1644 "blonde_woman": "\u{1F471}&zwj;\u2640\uFE0F",
1645 "blossom": "\u{1F33C}",
1646 "blowfish": "\u{1F421}",
1647 "blue_book": "\u{1F4D8}",
1648 "blue_car": "\u{1F699}",
1649 "blue_heart": "\u{1F499}",
1650 "blush": "\u{1F60A}",
1651 "boar": "\u{1F417}",
1652 "boat": "\u26F5\uFE0F",
1653 "bomb": "\u{1F4A3}",
1654 "book": "\u{1F4D6}",
1655 "bookmark": "\u{1F516}",
1656 "bookmark_tabs": "\u{1F4D1}",
1657 "books": "\u{1F4DA}",
1658 "boom": "\u{1F4A5}",
1659 "boot": "\u{1F462}",
1660 "bouquet": "\u{1F490}",
1661 "bowing_man": "\u{1F647}",
1662 "bow_and_arrow": "\u{1F3F9}",
1663 "bowing_woman": "\u{1F647}&zwj;\u2640\uFE0F",
1664 "bowling": "\u{1F3B3}",
1665 "boxing_glove": "\u{1F94A}",
1666 "boy": "\u{1F466}",
1667 "bread": "\u{1F35E}",
1668 "bride_with_veil": "\u{1F470}",
1669 "bridge_at_night": "\u{1F309}",
1670 "briefcase": "\u{1F4BC}",
1671 "broken_heart": "\u{1F494}",
1672 "bug": "\u{1F41B}",
1673 "building_construction": "\u{1F3D7}",
1674 "bulb": "\u{1F4A1}",
1675 "bullettrain_front": "\u{1F685}",
1676 "bullettrain_side": "\u{1F684}",
1677 "burrito": "\u{1F32F}",
1678 "bus": "\u{1F68C}",
1679 "business_suit_levitating": "\u{1F574}",
1680 "busstop": "\u{1F68F}",
1681 "bust_in_silhouette": "\u{1F464}",
1682 "busts_in_silhouette": "\u{1F465}",
1683 "butterfly": "\u{1F98B}",
1684 "cactus": "\u{1F335}",
1685 "cake": "\u{1F370}",
1686 "calendar": "\u{1F4C6}",
1687 "call_me_hand": "\u{1F919}",
1688 "calling": "\u{1F4F2}",
1689 "camel": "\u{1F42B}",
1690 "camera": "\u{1F4F7}",
1691 "camera_flash": "\u{1F4F8}",
1692 "camping": "\u{1F3D5}",
1693 "cancer": "\u264B\uFE0F",
1694 "candle": "\u{1F56F}",
1695 "candy": "\u{1F36C}",
1696 "canoe": "\u{1F6F6}",
1697 "capital_abcd": "\u{1F520}",
1698 "capricorn": "\u2651\uFE0F",
1699 "car": "\u{1F697}",
1700 "card_file_box": "\u{1F5C3}",
1701 "card_index": "\u{1F4C7}",
1702 "card_index_dividers": "\u{1F5C2}",
1703 "carousel_horse": "\u{1F3A0}",
1704 "carrot": "\u{1F955}",
1705 "cat": "\u{1F431}",
1706 "cat2": "\u{1F408}",
1707 "cd": "\u{1F4BF}",
1708 "chains": "\u26D3",
1709 "champagne": "\u{1F37E}",
1710 "chart": "\u{1F4B9}",
1711 "chart_with_downwards_trend": "\u{1F4C9}",
1712 "chart_with_upwards_trend": "\u{1F4C8}",
1713 "checkered_flag": "\u{1F3C1}",
1714 "cheese": "\u{1F9C0}",
1715 "cherries": "\u{1F352}",
1716 "cherry_blossom": "\u{1F338}",
1717 "chestnut": "\u{1F330}",
1718 "chicken": "\u{1F414}",
1719 "children_crossing": "\u{1F6B8}",
1720 "chipmunk": "\u{1F43F}",
1721 "chocolate_bar": "\u{1F36B}",
1722 "christmas_tree": "\u{1F384}",
1723 "church": "\u26EA\uFE0F",
1724 "cinema": "\u{1F3A6}",
1725 "circus_tent": "\u{1F3AA}",
1726 "city_sunrise": "\u{1F307}",
1727 "city_sunset": "\u{1F306}",
1728 "cityscape": "\u{1F3D9}",
1729 "cl": "\u{1F191}",
1730 "clamp": "\u{1F5DC}",
1731 "clap": "\u{1F44F}",
1732 "clapper": "\u{1F3AC}",
1733 "classical_building": "\u{1F3DB}",
1734 "clinking_glasses": "\u{1F942}",
1735 "clipboard": "\u{1F4CB}",
1736 "clock1": "\u{1F550}",
1737 "clock10": "\u{1F559}",
1738 "clock1030": "\u{1F565}",
1739 "clock11": "\u{1F55A}",
1740 "clock1130": "\u{1F566}",
1741 "clock12": "\u{1F55B}",
1742 "clock1230": "\u{1F567}",
1743 "clock130": "\u{1F55C}",
1744 "clock2": "\u{1F551}",
1745 "clock230": "\u{1F55D}",
1746 "clock3": "\u{1F552}",
1747 "clock330": "\u{1F55E}",
1748 "clock4": "\u{1F553}",
1749 "clock430": "\u{1F55F}",
1750 "clock5": "\u{1F554}",
1751 "clock530": "\u{1F560}",
1752 "clock6": "\u{1F555}",
1753 "clock630": "\u{1F561}",
1754 "clock7": "\u{1F556}",
1755 "clock730": "\u{1F562}",
1756 "clock8": "\u{1F557}",
1757 "clock830": "\u{1F563}",
1758 "clock9": "\u{1F558}",
1759 "clock930": "\u{1F564}",
1760 "closed_book": "\u{1F4D5}",
1761 "closed_lock_with_key": "\u{1F510}",
1762 "closed_umbrella": "\u{1F302}",
1763 "cloud": "\u2601\uFE0F",
1764 "cloud_with_lightning": "\u{1F329}",
1765 "cloud_with_lightning_and_rain": "\u26C8",
1766 "cloud_with_rain": "\u{1F327}",
1767 "cloud_with_snow": "\u{1F328}",
1768 "clown_face": "\u{1F921}",
1769 "clubs": "\u2663\uFE0F",
1770 "cocktail": "\u{1F378}",
1771 "coffee": "\u2615\uFE0F",
1772 "coffin": "\u26B0\uFE0F",
1773 "cold_sweat": "\u{1F630}",
1774 "comet": "\u2604\uFE0F",
1775 "computer": "\u{1F4BB}",
1776 "computer_mouse": "\u{1F5B1}",
1777 "confetti_ball": "\u{1F38A}",
1778 "confounded": "\u{1F616}",
1779 "confused": "\u{1F615}",
1780 "congratulations": "\u3297\uFE0F",
1781 "construction": "\u{1F6A7}",
1782 "construction_worker_man": "\u{1F477}",
1783 "construction_worker_woman": "\u{1F477}&zwj;\u2640\uFE0F",
1784 "control_knobs": "\u{1F39B}",
1785 "convenience_store": "\u{1F3EA}",
1786 "cookie": "\u{1F36A}",
1787 "cool": "\u{1F192}",
1788 "policeman": "\u{1F46E}",
1789 "copyright": "\xA9\uFE0F",
1790 "corn": "\u{1F33D}",
1791 "couch_and_lamp": "\u{1F6CB}",
1792 "couple": "\u{1F46B}",
1793 "couple_with_heart_woman_man": "\u{1F491}",
1794 "couple_with_heart_man_man": "\u{1F468}&zwj;\u2764\uFE0F&zwj;\u{1F468}",
1795 "couple_with_heart_woman_woman": "\u{1F469}&zwj;\u2764\uFE0F&zwj;\u{1F469}",
1796 "couplekiss_man_man": "\u{1F468}&zwj;\u2764\uFE0F&zwj;\u{1F48B}&zwj;\u{1F468}",
1797 "couplekiss_man_woman": "\u{1F48F}",
1798 "couplekiss_woman_woman": "\u{1F469}&zwj;\u2764\uFE0F&zwj;\u{1F48B}&zwj;\u{1F469}",
1799 "cow": "\u{1F42E}",
1800 "cow2": "\u{1F404}",
1801 "cowboy_hat_face": "\u{1F920}",
1802 "crab": "\u{1F980}",
1803 "crayon": "\u{1F58D}",
1804 "credit_card": "\u{1F4B3}",
1805 "crescent_moon": "\u{1F319}",
1806 "cricket": "\u{1F3CF}",
1807 "crocodile": "\u{1F40A}",
1808 "croissant": "\u{1F950}",
1809 "crossed_fingers": "\u{1F91E}",
1810 "crossed_flags": "\u{1F38C}",
1811 "crossed_swords": "\u2694\uFE0F",
1812 "crown": "\u{1F451}",
1813 "cry": "\u{1F622}",
1814 "crying_cat_face": "\u{1F63F}",
1815 "crystal_ball": "\u{1F52E}",
1816 "cucumber": "\u{1F952}",
1817 "cupid": "\u{1F498}",
1818 "curly_loop": "\u27B0",
1819 "currency_exchange": "\u{1F4B1}",
1820 "curry": "\u{1F35B}",
1821 "custard": "\u{1F36E}",
1822 "customs": "\u{1F6C3}",
1823 "cyclone": "\u{1F300}",
1824 "dagger": "\u{1F5E1}",
1825 "dancer": "\u{1F483}",
1826 "dancing_women": "\u{1F46F}",
1827 "dancing_men": "\u{1F46F}&zwj;\u2642\uFE0F",
1828 "dango": "\u{1F361}",
1829 "dark_sunglasses": "\u{1F576}",
1830 "dart": "\u{1F3AF}",
1831 "dash": "\u{1F4A8}",
1832 "date": "\u{1F4C5}",
1833 "deciduous_tree": "\u{1F333}",
1834 "deer": "\u{1F98C}",
1835 "department_store": "\u{1F3EC}",
1836 "derelict_house": "\u{1F3DA}",
1837 "desert": "\u{1F3DC}",
1838 "desert_island": "\u{1F3DD}",
1839 "desktop_computer": "\u{1F5A5}",
1840 "male_detective": "\u{1F575}\uFE0F",
1841 "diamond_shape_with_a_dot_inside": "\u{1F4A0}",
1842 "diamonds": "\u2666\uFE0F",
1843 "disappointed": "\u{1F61E}",
1844 "disappointed_relieved": "\u{1F625}",
1845 "dizzy": "\u{1F4AB}",
1846 "dizzy_face": "\u{1F635}",
1847 "do_not_litter": "\u{1F6AF}",
1848 "dog": "\u{1F436}",
1849 "dog2": "\u{1F415}",
1850 "dollar": "\u{1F4B5}",
1851 "dolls": "\u{1F38E}",
1852 "dolphin": "\u{1F42C}",
1853 "door": "\u{1F6AA}",
1854 "doughnut": "\u{1F369}",
1855 "dove": "\u{1F54A}",
1856 "dragon": "\u{1F409}",
1857 "dragon_face": "\u{1F432}",
1858 "dress": "\u{1F457}",
1859 "dromedary_camel": "\u{1F42A}",
1860 "drooling_face": "\u{1F924}",
1861 "droplet": "\u{1F4A7}",
1862 "drum": "\u{1F941}",
1863 "duck": "\u{1F986}",
1864 "dvd": "\u{1F4C0}",
1865 "e-mail": "\u{1F4E7}",
1866 "eagle": "\u{1F985}",
1867 "ear": "\u{1F442}",
1868 "ear_of_rice": "\u{1F33E}",
1869 "earth_africa": "\u{1F30D}",
1870 "earth_americas": "\u{1F30E}",
1871 "earth_asia": "\u{1F30F}",
1872 "egg": "\u{1F95A}",
1873 "eggplant": "\u{1F346}",
1874 "eight_pointed_black_star": "\u2734\uFE0F",
1875 "eight_spoked_asterisk": "\u2733\uFE0F",
1876 "electric_plug": "\u{1F50C}",
1877 "elephant": "\u{1F418}",
1878 "email": "\u2709\uFE0F",
1879 "end": "\u{1F51A}",
1880 "envelope_with_arrow": "\u{1F4E9}",
1881 "euro": "\u{1F4B6}",
1882 "european_castle": "\u{1F3F0}",
1883 "european_post_office": "\u{1F3E4}",
1884 "evergreen_tree": "\u{1F332}",
1885 "exclamation": "\u2757\uFE0F",
1886 "expressionless": "\u{1F611}",
1887 "eye": "\u{1F441}",
1888 "eye_speech_bubble": "\u{1F441}&zwj;\u{1F5E8}",
1889 "eyeglasses": "\u{1F453}",
1890 "eyes": "\u{1F440}",
1891 "face_with_head_bandage": "\u{1F915}",
1892 "face_with_thermometer": "\u{1F912}",
1893 "fist_oncoming": "\u{1F44A}",
1894 "factory": "\u{1F3ED}",
1895 "fallen_leaf": "\u{1F342}",
1896 "family_man_woman_boy": "\u{1F46A}",
1897 "family_man_boy": "\u{1F468}&zwj;\u{1F466}",
1898 "family_man_boy_boy": "\u{1F468}&zwj;\u{1F466}&zwj;\u{1F466}",
1899 "family_man_girl": "\u{1F468}&zwj;\u{1F467}",
1900 "family_man_girl_boy": "\u{1F468}&zwj;\u{1F467}&zwj;\u{1F466}",
1901 "family_man_girl_girl": "\u{1F468}&zwj;\u{1F467}&zwj;\u{1F467}",
1902 "family_man_man_boy": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F466}",
1903 "family_man_man_boy_boy": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F466}&zwj;\u{1F466}",
1904 "family_man_man_girl": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F467}",
1905 "family_man_man_girl_boy": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F467}&zwj;\u{1F466}",
1906 "family_man_man_girl_girl": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F467}&zwj;\u{1F467}",
1907 "family_man_woman_boy_boy": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F466}&zwj;\u{1F466}",
1908 "family_man_woman_girl": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F467}",
1909 "family_man_woman_girl_boy": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F466}",
1910 "family_man_woman_girl_girl": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F467}",
1911 "family_woman_boy": "\u{1F469}&zwj;\u{1F466}",
1912 "family_woman_boy_boy": "\u{1F469}&zwj;\u{1F466}&zwj;\u{1F466}",
1913 "family_woman_girl": "\u{1F469}&zwj;\u{1F467}",
1914 "family_woman_girl_boy": "\u{1F469}&zwj;\u{1F467}&zwj;\u{1F466}",
1915 "family_woman_girl_girl": "\u{1F469}&zwj;\u{1F467}&zwj;\u{1F467}",
1916 "family_woman_woman_boy": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F466}",
1917 "family_woman_woman_boy_boy": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F466}&zwj;\u{1F466}",
1918 "family_woman_woman_girl": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F467}",
1919 "family_woman_woman_girl_boy": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F466}",
1920 "family_woman_woman_girl_girl": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F467}",
1921 "fast_forward": "\u23E9",
1922 "fax": "\u{1F4E0}",
1923 "fearful": "\u{1F628}",
1924 "feet": "\u{1F43E}",
1925 "female_detective": "\u{1F575}\uFE0F&zwj;\u2640\uFE0F",
1926 "ferris_wheel": "\u{1F3A1}",
1927 "ferry": "\u26F4",
1928 "field_hockey": "\u{1F3D1}",
1929 "file_cabinet": "\u{1F5C4}",
1930 "file_folder": "\u{1F4C1}",
1931 "film_projector": "\u{1F4FD}",
1932 "film_strip": "\u{1F39E}",
1933 "fire": "\u{1F525}",
1934 "fire_engine": "\u{1F692}",
1935 "fireworks": "\u{1F386}",
1936 "first_quarter_moon": "\u{1F313}",
1937 "first_quarter_moon_with_face": "\u{1F31B}",
1938 "fish": "\u{1F41F}",
1939 "fish_cake": "\u{1F365}",
1940 "fishing_pole_and_fish": "\u{1F3A3}",
1941 "fist_raised": "\u270A",
1942 "fist_left": "\u{1F91B}",
1943 "fist_right": "\u{1F91C}",
1944 "flags": "\u{1F38F}",
1945 "flashlight": "\u{1F526}",
1946 "fleur_de_lis": "\u269C\uFE0F",
1947 "flight_arrival": "\u{1F6EC}",
1948 "flight_departure": "\u{1F6EB}",
1949 "floppy_disk": "\u{1F4BE}",
1950 "flower_playing_cards": "\u{1F3B4}",
1951 "flushed": "\u{1F633}",
1952 "fog": "\u{1F32B}",
1953 "foggy": "\u{1F301}",
1954 "football": "\u{1F3C8}",
1955 "footprints": "\u{1F463}",
1956 "fork_and_knife": "\u{1F374}",
1957 "fountain": "\u26F2\uFE0F",
1958 "fountain_pen": "\u{1F58B}",
1959 "four_leaf_clover": "\u{1F340}",
1960 "fox_face": "\u{1F98A}",
1961 "framed_picture": "\u{1F5BC}",
1962 "free": "\u{1F193}",
1963 "fried_egg": "\u{1F373}",
1964 "fried_shrimp": "\u{1F364}",
1965 "fries": "\u{1F35F}",
1966 "frog": "\u{1F438}",
1967 "frowning": "\u{1F626}",
1968 "frowning_face": "\u2639\uFE0F",
1969 "frowning_man": "\u{1F64D}&zwj;\u2642\uFE0F",
1970 "frowning_woman": "\u{1F64D}",
1971 "middle_finger": "\u{1F595}",
1972 "fuelpump": "\u26FD\uFE0F",
1973 "full_moon": "\u{1F315}",
1974 "full_moon_with_face": "\u{1F31D}",
1975 "funeral_urn": "\u26B1\uFE0F",
1976 "game_die": "\u{1F3B2}",
1977 "gear": "\u2699\uFE0F",
1978 "gem": "\u{1F48E}",
1979 "gemini": "\u264A\uFE0F",
1980 "ghost": "\u{1F47B}",
1981 "gift": "\u{1F381}",
1982 "gift_heart": "\u{1F49D}",
1983 "girl": "\u{1F467}",
1984 "globe_with_meridians": "\u{1F310}",
1985 "goal_net": "\u{1F945}",
1986 "goat": "\u{1F410}",
1987 "golf": "\u26F3\uFE0F",
1988 "golfing_man": "\u{1F3CC}\uFE0F",
1989 "golfing_woman": "\u{1F3CC}\uFE0F&zwj;\u2640\uFE0F",
1990 "gorilla": "\u{1F98D}",
1991 "grapes": "\u{1F347}",
1992 "green_apple": "\u{1F34F}",
1993 "green_book": "\u{1F4D7}",
1994 "green_heart": "\u{1F49A}",
1995 "green_salad": "\u{1F957}",
1996 "grey_exclamation": "\u2755",
1997 "grey_question": "\u2754",
1998 "grimacing": "\u{1F62C}",
1999 "grin": "\u{1F601}",
2000 "grinning": "\u{1F600}",
2001 "guardsman": "\u{1F482}",
2002 "guardswoman": "\u{1F482}&zwj;\u2640\uFE0F",
2003 "guitar": "\u{1F3B8}",
2004 "gun": "\u{1F52B}",
2005 "haircut_woman": "\u{1F487}",
2006 "haircut_man": "\u{1F487}&zwj;\u2642\uFE0F",
2007 "hamburger": "\u{1F354}",
2008 "hammer": "\u{1F528}",
2009 "hammer_and_pick": "\u2692",
2010 "hammer_and_wrench": "\u{1F6E0}",
2011 "hamster": "\u{1F439}",
2012 "hand": "\u270B",
2013 "handbag": "\u{1F45C}",
2014 "handshake": "\u{1F91D}",
2015 "hankey": "\u{1F4A9}",
2016 "hatched_chick": "\u{1F425}",
2017 "hatching_chick": "\u{1F423}",
2018 "headphones": "\u{1F3A7}",
2019 "hear_no_evil": "\u{1F649}",
2020 "heart": "\u2764\uFE0F",
2021 "heart_decoration": "\u{1F49F}",
2022 "heart_eyes": "\u{1F60D}",
2023 "heart_eyes_cat": "\u{1F63B}",
2024 "heartbeat": "\u{1F493}",
2025 "heartpulse": "\u{1F497}",
2026 "hearts": "\u2665\uFE0F",
2027 "heavy_check_mark": "\u2714\uFE0F",
2028 "heavy_division_sign": "\u2797",
2029 "heavy_dollar_sign": "\u{1F4B2}",
2030 "heavy_heart_exclamation": "\u2763\uFE0F",
2031 "heavy_minus_sign": "\u2796",
2032 "heavy_multiplication_x": "\u2716\uFE0F",
2033 "heavy_plus_sign": "\u2795",
2034 "helicopter": "\u{1F681}",
2035 "herb": "\u{1F33F}",
2036 "hibiscus": "\u{1F33A}",
2037 "high_brightness": "\u{1F506}",
2038 "high_heel": "\u{1F460}",
2039 "hocho": "\u{1F52A}",
2040 "hole": "\u{1F573}",
2041 "honey_pot": "\u{1F36F}",
2042 "horse": "\u{1F434}",
2043 "horse_racing": "\u{1F3C7}",
2044 "hospital": "\u{1F3E5}",
2045 "hot_pepper": "\u{1F336}",
2046 "hotdog": "\u{1F32D}",
2047 "hotel": "\u{1F3E8}",
2048 "hotsprings": "\u2668\uFE0F",
2049 "hourglass": "\u231B\uFE0F",
2050 "hourglass_flowing_sand": "\u23F3",
2051 "house": "\u{1F3E0}",
2052 "house_with_garden": "\u{1F3E1}",
2053 "houses": "\u{1F3D8}",
2054 "hugs": "\u{1F917}",
2055 "hushed": "\u{1F62F}",
2056 "ice_cream": "\u{1F368}",
2057 "ice_hockey": "\u{1F3D2}",
2058 "ice_skate": "\u26F8",
2059 "icecream": "\u{1F366}",
2060 "id": "\u{1F194}",
2061 "ideograph_advantage": "\u{1F250}",
2062 "imp": "\u{1F47F}",
2063 "inbox_tray": "\u{1F4E5}",
2064 "incoming_envelope": "\u{1F4E8}",
2065 "tipping_hand_woman": "\u{1F481}",
2066 "information_source": "\u2139\uFE0F",
2067 "innocent": "\u{1F607}",
2068 "interrobang": "\u2049\uFE0F",
2069 "iphone": "\u{1F4F1}",
2070 "izakaya_lantern": "\u{1F3EE}",
2071 "jack_o_lantern": "\u{1F383}",
2072 "japan": "\u{1F5FE}",
2073 "japanese_castle": "\u{1F3EF}",
2074 "japanese_goblin": "\u{1F47A}",
2075 "japanese_ogre": "\u{1F479}",
2076 "jeans": "\u{1F456}",
2077 "joy": "\u{1F602}",
2078 "joy_cat": "\u{1F639}",
2079 "joystick": "\u{1F579}",
2080 "kaaba": "\u{1F54B}",
2081 "key": "\u{1F511}",
2082 "keyboard": "\u2328\uFE0F",
2083 "keycap_ten": "\u{1F51F}",
2084 "kick_scooter": "\u{1F6F4}",
2085 "kimono": "\u{1F458}",
2086 "kiss": "\u{1F48B}",
2087 "kissing": "\u{1F617}",
2088 "kissing_cat": "\u{1F63D}",
2089 "kissing_closed_eyes": "\u{1F61A}",
2090 "kissing_heart": "\u{1F618}",
2091 "kissing_smiling_eyes": "\u{1F619}",
2092 "kiwi_fruit": "\u{1F95D}",
2093 "koala": "\u{1F428}",
2094 "koko": "\u{1F201}",
2095 "label": "\u{1F3F7}",
2096 "large_blue_circle": "\u{1F535}",
2097 "large_blue_diamond": "\u{1F537}",
2098 "large_orange_diamond": "\u{1F536}",
2099 "last_quarter_moon": "\u{1F317}",
2100 "last_quarter_moon_with_face": "\u{1F31C}",
2101 "latin_cross": "\u271D\uFE0F",
2102 "laughing": "\u{1F606}",
2103 "leaves": "\u{1F343}",
2104 "ledger": "\u{1F4D2}",
2105 "left_luggage": "\u{1F6C5}",
2106 "left_right_arrow": "\u2194\uFE0F",
2107 "leftwards_arrow_with_hook": "\u21A9\uFE0F",
2108 "lemon": "\u{1F34B}",
2109 "leo": "\u264C\uFE0F",
2110 "leopard": "\u{1F406}",
2111 "level_slider": "\u{1F39A}",
2112 "libra": "\u264E\uFE0F",
2113 "light_rail": "\u{1F688}",
2114 "link": "\u{1F517}",
2115 "lion": "\u{1F981}",
2116 "lips": "\u{1F444}",
2117 "lipstick": "\u{1F484}",
2118 "lizard": "\u{1F98E}",
2119 "lock": "\u{1F512}",
2120 "lock_with_ink_pen": "\u{1F50F}",
2121 "lollipop": "\u{1F36D}",
2122 "loop": "\u27BF",
2123 "loud_sound": "\u{1F50A}",
2124 "loudspeaker": "\u{1F4E2}",
2125 "love_hotel": "\u{1F3E9}",
2126 "love_letter": "\u{1F48C}",
2127 "low_brightness": "\u{1F505}",
2128 "lying_face": "\u{1F925}",
2129 "m": "\u24C2\uFE0F",
2130 "mag": "\u{1F50D}",
2131 "mag_right": "\u{1F50E}",
2132 "mahjong": "\u{1F004}\uFE0F",
2133 "mailbox": "\u{1F4EB}",
2134 "mailbox_closed": "\u{1F4EA}",
2135 "mailbox_with_mail": "\u{1F4EC}",
2136 "mailbox_with_no_mail": "\u{1F4ED}",
2137 "man": "\u{1F468}",
2138 "man_artist": "\u{1F468}&zwj;\u{1F3A8}",
2139 "man_astronaut": "\u{1F468}&zwj;\u{1F680}",
2140 "man_cartwheeling": "\u{1F938}&zwj;\u2642\uFE0F",
2141 "man_cook": "\u{1F468}&zwj;\u{1F373}",
2142 "man_dancing": "\u{1F57A}",
2143 "man_facepalming": "\u{1F926}&zwj;\u2642\uFE0F",
2144 "man_factory_worker": "\u{1F468}&zwj;\u{1F3ED}",
2145 "man_farmer": "\u{1F468}&zwj;\u{1F33E}",
2146 "man_firefighter": "\u{1F468}&zwj;\u{1F692}",
2147 "man_health_worker": "\u{1F468}&zwj;\u2695\uFE0F",
2148 "man_in_tuxedo": "\u{1F935}",
2149 "man_judge": "\u{1F468}&zwj;\u2696\uFE0F",
2150 "man_juggling": "\u{1F939}&zwj;\u2642\uFE0F",
2151 "man_mechanic": "\u{1F468}&zwj;\u{1F527}",
2152 "man_office_worker": "\u{1F468}&zwj;\u{1F4BC}",
2153 "man_pilot": "\u{1F468}&zwj;\u2708\uFE0F",
2154 "man_playing_handball": "\u{1F93E}&zwj;\u2642\uFE0F",
2155 "man_playing_water_polo": "\u{1F93D}&zwj;\u2642\uFE0F",
2156 "man_scientist": "\u{1F468}&zwj;\u{1F52C}",
2157 "man_shrugging": "\u{1F937}&zwj;\u2642\uFE0F",
2158 "man_singer": "\u{1F468}&zwj;\u{1F3A4}",
2159 "man_student": "\u{1F468}&zwj;\u{1F393}",
2160 "man_teacher": "\u{1F468}&zwj;\u{1F3EB}",
2161 "man_technologist": "\u{1F468}&zwj;\u{1F4BB}",
2162 "man_with_gua_pi_mao": "\u{1F472}",
2163 "man_with_turban": "\u{1F473}",
2164 "tangerine": "\u{1F34A}",
2165 "mans_shoe": "\u{1F45E}",
2166 "mantelpiece_clock": "\u{1F570}",
2167 "maple_leaf": "\u{1F341}",
2168 "martial_arts_uniform": "\u{1F94B}",
2169 "mask": "\u{1F637}",
2170 "massage_woman": "\u{1F486}",
2171 "massage_man": "\u{1F486}&zwj;\u2642\uFE0F",
2172 "meat_on_bone": "\u{1F356}",
2173 "medal_military": "\u{1F396}",
2174 "medal_sports": "\u{1F3C5}",
2175 "mega": "\u{1F4E3}",
2176 "melon": "\u{1F348}",
2177 "memo": "\u{1F4DD}",
2178 "men_wrestling": "\u{1F93C}&zwj;\u2642\uFE0F",
2179 "menorah": "\u{1F54E}",
2180 "mens": "\u{1F6B9}",
2181 "metal": "\u{1F918}",
2182 "metro": "\u{1F687}",
2183 "microphone": "\u{1F3A4}",
2184 "microscope": "\u{1F52C}",
2185 "milk_glass": "\u{1F95B}",
2186 "milky_way": "\u{1F30C}",
2187 "minibus": "\u{1F690}",
2188 "minidisc": "\u{1F4BD}",
2189 "mobile_phone_off": "\u{1F4F4}",
2190 "money_mouth_face": "\u{1F911}",
2191 "money_with_wings": "\u{1F4B8}",
2192 "moneybag": "\u{1F4B0}",
2193 "monkey": "\u{1F412}",
2194 "monkey_face": "\u{1F435}",
2195 "monorail": "\u{1F69D}",
2196 "moon": "\u{1F314}",
2197 "mortar_board": "\u{1F393}",
2198 "mosque": "\u{1F54C}",
2199 "motor_boat": "\u{1F6E5}",
2200 "motor_scooter": "\u{1F6F5}",
2201 "motorcycle": "\u{1F3CD}",
2202 "motorway": "\u{1F6E3}",
2203 "mount_fuji": "\u{1F5FB}",
2204 "mountain": "\u26F0",
2205 "mountain_biking_man": "\u{1F6B5}",
2206 "mountain_biking_woman": "\u{1F6B5}&zwj;\u2640\uFE0F",
2207 "mountain_cableway": "\u{1F6A0}",
2208 "mountain_railway": "\u{1F69E}",
2209 "mountain_snow": "\u{1F3D4}",
2210 "mouse": "\u{1F42D}",
2211 "mouse2": "\u{1F401}",
2212 "movie_camera": "\u{1F3A5}",
2213 "moyai": "\u{1F5FF}",
2214 "mrs_claus": "\u{1F936}",
2215 "muscle": "\u{1F4AA}",
2216 "mushroom": "\u{1F344}",
2217 "musical_keyboard": "\u{1F3B9}",
2218 "musical_note": "\u{1F3B5}",
2219 "musical_score": "\u{1F3BC}",
2220 "mute": "\u{1F507}",
2221 "nail_care": "\u{1F485}",
2222 "name_badge": "\u{1F4DB}",
2223 "national_park": "\u{1F3DE}",
2224 "nauseated_face": "\u{1F922}",
2225 "necktie": "\u{1F454}",
2226 "negative_squared_cross_mark": "\u274E",
2227 "nerd_face": "\u{1F913}",
2228 "neutral_face": "\u{1F610}",
2229 "new": "\u{1F195}",
2230 "new_moon": "\u{1F311}",
2231 "new_moon_with_face": "\u{1F31A}",
2232 "newspaper": "\u{1F4F0}",
2233 "newspaper_roll": "\u{1F5DE}",
2234 "next_track_button": "\u23ED",
2235 "ng": "\u{1F196}",
2236 "no_good_man": "\u{1F645}&zwj;\u2642\uFE0F",
2237 "no_good_woman": "\u{1F645}",
2238 "night_with_stars": "\u{1F303}",
2239 "no_bell": "\u{1F515}",
2240 "no_bicycles": "\u{1F6B3}",
2241 "no_entry": "\u26D4\uFE0F",
2242 "no_entry_sign": "\u{1F6AB}",
2243 "no_mobile_phones": "\u{1F4F5}",
2244 "no_mouth": "\u{1F636}",
2245 "no_pedestrians": "\u{1F6B7}",
2246 "no_smoking": "\u{1F6AD}",
2247 "non-potable_water": "\u{1F6B1}",
2248 "nose": "\u{1F443}",
2249 "notebook": "\u{1F4D3}",
2250 "notebook_with_decorative_cover": "\u{1F4D4}",
2251 "notes": "\u{1F3B6}",
2252 "nut_and_bolt": "\u{1F529}",
2253 "o": "\u2B55\uFE0F",
2254 "o2": "\u{1F17E}\uFE0F",
2255 "ocean": "\u{1F30A}",
2256 "octopus": "\u{1F419}",
2257 "oden": "\u{1F362}",
2258 "office": "\u{1F3E2}",
2259 "oil_drum": "\u{1F6E2}",
2260 "ok": "\u{1F197}",
2261 "ok_hand": "\u{1F44C}",
2262 "ok_man": "\u{1F646}&zwj;\u2642\uFE0F",
2263 "ok_woman": "\u{1F646}",
2264 "old_key": "\u{1F5DD}",
2265 "older_man": "\u{1F474}",
2266 "older_woman": "\u{1F475}",
2267 "om": "\u{1F549}",
2268 "on": "\u{1F51B}",
2269 "oncoming_automobile": "\u{1F698}",
2270 "oncoming_bus": "\u{1F68D}",
2271 "oncoming_police_car": "\u{1F694}",
2272 "oncoming_taxi": "\u{1F696}",
2273 "open_file_folder": "\u{1F4C2}",
2274 "open_hands": "\u{1F450}",
2275 "open_mouth": "\u{1F62E}",
2276 "open_umbrella": "\u2602\uFE0F",
2277 "ophiuchus": "\u26CE",
2278 "orange_book": "\u{1F4D9}",
2279 "orthodox_cross": "\u2626\uFE0F",
2280 "outbox_tray": "\u{1F4E4}",
2281 "owl": "\u{1F989}",
2282 "ox": "\u{1F402}",
2283 "package": "\u{1F4E6}",
2284 "page_facing_up": "\u{1F4C4}",
2285 "page_with_curl": "\u{1F4C3}",
2286 "pager": "\u{1F4DF}",
2287 "paintbrush": "\u{1F58C}",
2288 "palm_tree": "\u{1F334}",
2289 "pancakes": "\u{1F95E}",
2290 "panda_face": "\u{1F43C}",
2291 "paperclip": "\u{1F4CE}",
2292 "paperclips": "\u{1F587}",
2293 "parasol_on_ground": "\u26F1",
2294 "parking": "\u{1F17F}\uFE0F",
2295 "part_alternation_mark": "\u303D\uFE0F",
2296 "partly_sunny": "\u26C5\uFE0F",
2297 "passenger_ship": "\u{1F6F3}",
2298 "passport_control": "\u{1F6C2}",
2299 "pause_button": "\u23F8",
2300 "peace_symbol": "\u262E\uFE0F",
2301 "peach": "\u{1F351}",
2302 "peanuts": "\u{1F95C}",
2303 "pear": "\u{1F350}",
2304 "pen": "\u{1F58A}",
2305 "pencil2": "\u270F\uFE0F",
2306 "penguin": "\u{1F427}",
2307 "pensive": "\u{1F614}",
2308 "performing_arts": "\u{1F3AD}",
2309 "persevere": "\u{1F623}",
2310 "person_fencing": "\u{1F93A}",
2311 "pouting_woman": "\u{1F64E}",
2312 "phone": "\u260E\uFE0F",
2313 "pick": "\u26CF",
2314 "pig": "\u{1F437}",
2315 "pig2": "\u{1F416}",
2316 "pig_nose": "\u{1F43D}",
2317 "pill": "\u{1F48A}",
2318 "pineapple": "\u{1F34D}",
2319 "ping_pong": "\u{1F3D3}",
2320 "pisces": "\u2653\uFE0F",
2321 "pizza": "\u{1F355}",
2322 "place_of_worship": "\u{1F6D0}",
2323 "plate_with_cutlery": "\u{1F37D}",
2324 "play_or_pause_button": "\u23EF",
2325 "point_down": "\u{1F447}",
2326 "point_left": "\u{1F448}",
2327 "point_right": "\u{1F449}",
2328 "point_up": "\u261D\uFE0F",
2329 "point_up_2": "\u{1F446}",
2330 "police_car": "\u{1F693}",
2331 "policewoman": "\u{1F46E}&zwj;\u2640\uFE0F",
2332 "poodle": "\u{1F429}",
2333 "popcorn": "\u{1F37F}",
2334 "post_office": "\u{1F3E3}",
2335 "postal_horn": "\u{1F4EF}",
2336 "postbox": "\u{1F4EE}",
2337 "potable_water": "\u{1F6B0}",
2338 "potato": "\u{1F954}",
2339 "pouch": "\u{1F45D}",
2340 "poultry_leg": "\u{1F357}",
2341 "pound": "\u{1F4B7}",
2342 "rage": "\u{1F621}",
2343 "pouting_cat": "\u{1F63E}",
2344 "pouting_man": "\u{1F64E}&zwj;\u2642\uFE0F",
2345 "pray": "\u{1F64F}",
2346 "prayer_beads": "\u{1F4FF}",
2347 "pregnant_woman": "\u{1F930}",
2348 "previous_track_button": "\u23EE",
2349 "prince": "\u{1F934}",
2350 "princess": "\u{1F478}",
2351 "printer": "\u{1F5A8}",
2352 "purple_heart": "\u{1F49C}",
2353 "purse": "\u{1F45B}",
2354 "pushpin": "\u{1F4CC}",
2355 "put_litter_in_its_place": "\u{1F6AE}",
2356 "question": "\u2753",
2357 "rabbit": "\u{1F430}",
2358 "rabbit2": "\u{1F407}",
2359 "racehorse": "\u{1F40E}",
2360 "racing_car": "\u{1F3CE}",
2361 "radio": "\u{1F4FB}",
2362 "radio_button": "\u{1F518}",
2363 "radioactive": "\u2622\uFE0F",
2364 "railway_car": "\u{1F683}",
2365 "railway_track": "\u{1F6E4}",
2366 "rainbow": "\u{1F308}",
2367 "rainbow_flag": "\u{1F3F3}\uFE0F&zwj;\u{1F308}",
2368 "raised_back_of_hand": "\u{1F91A}",
2369 "raised_hand_with_fingers_splayed": "\u{1F590}",
2370 "raised_hands": "\u{1F64C}",
2371 "raising_hand_woman": "\u{1F64B}",
2372 "raising_hand_man": "\u{1F64B}&zwj;\u2642\uFE0F",
2373 "ram": "\u{1F40F}",
2374 "ramen": "\u{1F35C}",
2375 "rat": "\u{1F400}",
2376 "record_button": "\u23FA",
2377 "recycle": "\u267B\uFE0F",
2378 "red_circle": "\u{1F534}",
2379 "registered": "\xAE\uFE0F",
2380 "relaxed": "\u263A\uFE0F",
2381 "relieved": "\u{1F60C}",
2382 "reminder_ribbon": "\u{1F397}",
2383 "repeat": "\u{1F501}",
2384 "repeat_one": "\u{1F502}",
2385 "rescue_worker_helmet": "\u26D1",
2386 "restroom": "\u{1F6BB}",
2387 "revolving_hearts": "\u{1F49E}",
2388 "rewind": "\u23EA",
2389 "rhinoceros": "\u{1F98F}",
2390 "ribbon": "\u{1F380}",
2391 "rice": "\u{1F35A}",
2392 "rice_ball": "\u{1F359}",
2393 "rice_cracker": "\u{1F358}",
2394 "rice_scene": "\u{1F391}",
2395 "right_anger_bubble": "\u{1F5EF}",
2396 "ring": "\u{1F48D}",
2397 "robot": "\u{1F916}",
2398 "rocket": "\u{1F680}",
2399 "rofl": "\u{1F923}",
2400 "roll_eyes": "\u{1F644}",
2401 "roller_coaster": "\u{1F3A2}",
2402 "rooster": "\u{1F413}",
2403 "rose": "\u{1F339}",
2404 "rosette": "\u{1F3F5}",
2405 "rotating_light": "\u{1F6A8}",
2406 "round_pushpin": "\u{1F4CD}",
2407 "rowing_man": "\u{1F6A3}",
2408 "rowing_woman": "\u{1F6A3}&zwj;\u2640\uFE0F",
2409 "rugby_football": "\u{1F3C9}",
2410 "running_man": "\u{1F3C3}",
2411 "running_shirt_with_sash": "\u{1F3BD}",
2412 "running_woman": "\u{1F3C3}&zwj;\u2640\uFE0F",
2413 "sa": "\u{1F202}\uFE0F",
2414 "sagittarius": "\u2650\uFE0F",
2415 "sake": "\u{1F376}",
2416 "sandal": "\u{1F461}",
2417 "santa": "\u{1F385}",
2418 "satellite": "\u{1F4E1}",
2419 "saxophone": "\u{1F3B7}",
2420 "school": "\u{1F3EB}",
2421 "school_satchel": "\u{1F392}",
2422 "scissors": "\u2702\uFE0F",
2423 "scorpion": "\u{1F982}",
2424 "scorpius": "\u264F\uFE0F",
2425 "scream": "\u{1F631}",
2426 "scream_cat": "\u{1F640}",
2427 "scroll": "\u{1F4DC}",
2428 "seat": "\u{1F4BA}",
2429 "secret": "\u3299\uFE0F",
2430 "see_no_evil": "\u{1F648}",
2431 "seedling": "\u{1F331}",
2432 "selfie": "\u{1F933}",
2433 "shallow_pan_of_food": "\u{1F958}",
2434 "shamrock": "\u2618\uFE0F",
2435 "shark": "\u{1F988}",
2436 "shaved_ice": "\u{1F367}",
2437 "sheep": "\u{1F411}",
2438 "shell": "\u{1F41A}",
2439 "shield": "\u{1F6E1}",
2440 "shinto_shrine": "\u26E9",
2441 "ship": "\u{1F6A2}",
2442 "shirt": "\u{1F455}",
2443 "shopping": "\u{1F6CD}",
2444 "shopping_cart": "\u{1F6D2}",
2445 "shower": "\u{1F6BF}",
2446 "shrimp": "\u{1F990}",
2447 "signal_strength": "\u{1F4F6}",
2448 "six_pointed_star": "\u{1F52F}",
2449 "ski": "\u{1F3BF}",
2450 "skier": "\u26F7",
2451 "skull": "\u{1F480}",
2452 "skull_and_crossbones": "\u2620\uFE0F",
2453 "sleeping": "\u{1F634}",
2454 "sleeping_bed": "\u{1F6CC}",
2455 "sleepy": "\u{1F62A}",
2456 "slightly_frowning_face": "\u{1F641}",
2457 "slightly_smiling_face": "\u{1F642}",
2458 "slot_machine": "\u{1F3B0}",
2459 "small_airplane": "\u{1F6E9}",
2460 "small_blue_diamond": "\u{1F539}",
2461 "small_orange_diamond": "\u{1F538}",
2462 "small_red_triangle": "\u{1F53A}",
2463 "small_red_triangle_down": "\u{1F53B}",
2464 "smile": "\u{1F604}",
2465 "smile_cat": "\u{1F638}",
2466 "smiley": "\u{1F603}",
2467 "smiley_cat": "\u{1F63A}",
2468 "smiling_imp": "\u{1F608}",
2469 "smirk": "\u{1F60F}",
2470 "smirk_cat": "\u{1F63C}",
2471 "smoking": "\u{1F6AC}",
2472 "snail": "\u{1F40C}",
2473 "snake": "\u{1F40D}",
2474 "sneezing_face": "\u{1F927}",
2475 "snowboarder": "\u{1F3C2}",
2476 "snowflake": "\u2744\uFE0F",
2477 "snowman": "\u26C4\uFE0F",
2478 "snowman_with_snow": "\u2603\uFE0F",
2479 "sob": "\u{1F62D}",
2480 "soccer": "\u26BD\uFE0F",
2481 "soon": "\u{1F51C}",
2482 "sos": "\u{1F198}",
2483 "sound": "\u{1F509}",
2484 "space_invader": "\u{1F47E}",
2485 "spades": "\u2660\uFE0F",
2486 "spaghetti": "\u{1F35D}",
2487 "sparkle": "\u2747\uFE0F",
2488 "sparkler": "\u{1F387}",
2489 "sparkles": "\u2728",
2490 "sparkling_heart": "\u{1F496}",
2491 "speak_no_evil": "\u{1F64A}",
2492 "speaker": "\u{1F508}",
2493 "speaking_head": "\u{1F5E3}",
2494 "speech_balloon": "\u{1F4AC}",
2495 "speedboat": "\u{1F6A4}",
2496 "spider": "\u{1F577}",
2497 "spider_web": "\u{1F578}",
2498 "spiral_calendar": "\u{1F5D3}",
2499 "spiral_notepad": "\u{1F5D2}",
2500 "spoon": "\u{1F944}",
2501 "squid": "\u{1F991}",
2502 "stadium": "\u{1F3DF}",
2503 "star": "\u2B50\uFE0F",
2504 "star2": "\u{1F31F}",
2505 "star_and_crescent": "\u262A\uFE0F",
2506 "star_of_david": "\u2721\uFE0F",
2507 "stars": "\u{1F320}",
2508 "station": "\u{1F689}",
2509 "statue_of_liberty": "\u{1F5FD}",
2510 "steam_locomotive": "\u{1F682}",
2511 "stew": "\u{1F372}",
2512 "stop_button": "\u23F9",
2513 "stop_sign": "\u{1F6D1}",
2514 "stopwatch": "\u23F1",
2515 "straight_ruler": "\u{1F4CF}",
2516 "strawberry": "\u{1F353}",
2517 "stuck_out_tongue": "\u{1F61B}",
2518 "stuck_out_tongue_closed_eyes": "\u{1F61D}",
2519 "stuck_out_tongue_winking_eye": "\u{1F61C}",
2520 "studio_microphone": "\u{1F399}",
2521 "stuffed_flatbread": "\u{1F959}",
2522 "sun_behind_large_cloud": "\u{1F325}",
2523 "sun_behind_rain_cloud": "\u{1F326}",
2524 "sun_behind_small_cloud": "\u{1F324}",
2525 "sun_with_face": "\u{1F31E}",
2526 "sunflower": "\u{1F33B}",
2527 "sunglasses": "\u{1F60E}",
2528 "sunny": "\u2600\uFE0F",
2529 "sunrise": "\u{1F305}",
2530 "sunrise_over_mountains": "\u{1F304}",
2531 "surfing_man": "\u{1F3C4}",
2532 "surfing_woman": "\u{1F3C4}&zwj;\u2640\uFE0F",
2533 "sushi": "\u{1F363}",
2534 "suspension_railway": "\u{1F69F}",
2535 "sweat": "\u{1F613}",
2536 "sweat_drops": "\u{1F4A6}",
2537 "sweat_smile": "\u{1F605}",
2538 "sweet_potato": "\u{1F360}",
2539 "swimming_man": "\u{1F3CA}",
2540 "swimming_woman": "\u{1F3CA}&zwj;\u2640\uFE0F",
2541 "symbols": "\u{1F523}",
2542 "synagogue": "\u{1F54D}",
2543 "syringe": "\u{1F489}",
2544 "taco": "\u{1F32E}",
2545 "tada": "\u{1F389}",
2546 "tanabata_tree": "\u{1F38B}",
2547 "taurus": "\u2649\uFE0F",
2548 "taxi": "\u{1F695}",
2549 "tea": "\u{1F375}",
2550 "telephone_receiver": "\u{1F4DE}",
2551 "telescope": "\u{1F52D}",
2552 "tennis": "\u{1F3BE}",
2553 "tent": "\u26FA\uFE0F",
2554 "thermometer": "\u{1F321}",
2555 "thinking": "\u{1F914}",
2556 "thought_balloon": "\u{1F4AD}",
2557 "ticket": "\u{1F3AB}",
2558 "tickets": "\u{1F39F}",
2559 "tiger": "\u{1F42F}",
2560 "tiger2": "\u{1F405}",
2561 "timer_clock": "\u23F2",
2562 "tipping_hand_man": "\u{1F481}&zwj;\u2642\uFE0F",
2563 "tired_face": "\u{1F62B}",
2564 "tm": "\u2122\uFE0F",
2565 "toilet": "\u{1F6BD}",
2566 "tokyo_tower": "\u{1F5FC}",
2567 "tomato": "\u{1F345}",
2568 "tongue": "\u{1F445}",
2569 "top": "\u{1F51D}",
2570 "tophat": "\u{1F3A9}",
2571 "tornado": "\u{1F32A}",
2572 "trackball": "\u{1F5B2}",
2573 "tractor": "\u{1F69C}",
2574 "traffic_light": "\u{1F6A5}",
2575 "train": "\u{1F68B}",
2576 "train2": "\u{1F686}",
2577 "tram": "\u{1F68A}",
2578 "triangular_flag_on_post": "\u{1F6A9}",
2579 "triangular_ruler": "\u{1F4D0}",
2580 "trident": "\u{1F531}",
2581 "triumph": "\u{1F624}",
2582 "trolleybus": "\u{1F68E}",
2583 "trophy": "\u{1F3C6}",
2584 "tropical_drink": "\u{1F379}",
2585 "tropical_fish": "\u{1F420}",
2586 "truck": "\u{1F69A}",
2587 "trumpet": "\u{1F3BA}",
2588 "tulip": "\u{1F337}",
2589 "tumbler_glass": "\u{1F943}",
2590 "turkey": "\u{1F983}",
2591 "turtle": "\u{1F422}",
2592 "tv": "\u{1F4FA}",
2593 "twisted_rightwards_arrows": "\u{1F500}",
2594 "two_hearts": "\u{1F495}",
2595 "two_men_holding_hands": "\u{1F46C}",
2596 "two_women_holding_hands": "\u{1F46D}",
2597 "u5272": "\u{1F239}",
2598 "u5408": "\u{1F234}",
2599 "u55b6": "\u{1F23A}",
2600 "u6307": "\u{1F22F}\uFE0F",
2601 "u6708": "\u{1F237}\uFE0F",
2602 "u6709": "\u{1F236}",
2603 "u6e80": "\u{1F235}",
2604 "u7121": "\u{1F21A}\uFE0F",
2605 "u7533": "\u{1F238}",
2606 "u7981": "\u{1F232}",
2607 "u7a7a": "\u{1F233}",
2608 "umbrella": "\u2614\uFE0F",
2609 "unamused": "\u{1F612}",
2610 "underage": "\u{1F51E}",
2611 "unicorn": "\u{1F984}",
2612 "unlock": "\u{1F513}",
2613 "up": "\u{1F199}",
2614 "upside_down_face": "\u{1F643}",
2615 "v": "\u270C\uFE0F",
2616 "vertical_traffic_light": "\u{1F6A6}",
2617 "vhs": "\u{1F4FC}",
2618 "vibration_mode": "\u{1F4F3}",
2619 "video_camera": "\u{1F4F9}",
2620 "video_game": "\u{1F3AE}",
2621 "violin": "\u{1F3BB}",
2622 "virgo": "\u264D\uFE0F",
2623 "volcano": "\u{1F30B}",
2624 "volleyball": "\u{1F3D0}",
2625 "vs": "\u{1F19A}",
2626 "vulcan_salute": "\u{1F596}",
2627 "walking_man": "\u{1F6B6}",
2628 "walking_woman": "\u{1F6B6}&zwj;\u2640\uFE0F",
2629 "waning_crescent_moon": "\u{1F318}",
2630 "waning_gibbous_moon": "\u{1F316}",
2631 "warning": "\u26A0\uFE0F",
2632 "wastebasket": "\u{1F5D1}",
2633 "watch": "\u231A\uFE0F",
2634 "water_buffalo": "\u{1F403}",
2635 "watermelon": "\u{1F349}",
2636 "wave": "\u{1F44B}",
2637 "wavy_dash": "\u3030\uFE0F",
2638 "waxing_crescent_moon": "\u{1F312}",
2639 "wc": "\u{1F6BE}",
2640 "weary": "\u{1F629}",
2641 "wedding": "\u{1F492}",
2642 "weight_lifting_man": "\u{1F3CB}\uFE0F",
2643 "weight_lifting_woman": "\u{1F3CB}\uFE0F&zwj;\u2640\uFE0F",
2644 "whale": "\u{1F433}",
2645 "whale2": "\u{1F40B}",
2646 "wheel_of_dharma": "\u2638\uFE0F",
2647 "wheelchair": "\u267F\uFE0F",
2648 "white_check_mark": "\u2705",
2649 "white_circle": "\u26AA\uFE0F",
2650 "white_flag": "\u{1F3F3}\uFE0F",
2651 "white_flower": "\u{1F4AE}",
2652 "white_large_square": "\u2B1C\uFE0F",
2653 "white_medium_small_square": "\u25FD\uFE0F",
2654 "white_medium_square": "\u25FB\uFE0F",
2655 "white_small_square": "\u25AB\uFE0F",
2656 "white_square_button": "\u{1F533}",
2657 "wilted_flower": "\u{1F940}",
2658 "wind_chime": "\u{1F390}",
2659 "wind_face": "\u{1F32C}",
2660 "wine_glass": "\u{1F377}",
2661 "wink": "\u{1F609}",
2662 "wolf": "\u{1F43A}",
2663 "woman": "\u{1F469}",
2664 "woman_artist": "\u{1F469}&zwj;\u{1F3A8}",
2665 "woman_astronaut": "\u{1F469}&zwj;\u{1F680}",
2666 "woman_cartwheeling": "\u{1F938}&zwj;\u2640\uFE0F",
2667 "woman_cook": "\u{1F469}&zwj;\u{1F373}",
2668 "woman_facepalming": "\u{1F926}&zwj;\u2640\uFE0F",
2669 "woman_factory_worker": "\u{1F469}&zwj;\u{1F3ED}",
2670 "woman_farmer": "\u{1F469}&zwj;\u{1F33E}",
2671 "woman_firefighter": "\u{1F469}&zwj;\u{1F692}",
2672 "woman_health_worker": "\u{1F469}&zwj;\u2695\uFE0F",
2673 "woman_judge": "\u{1F469}&zwj;\u2696\uFE0F",
2674 "woman_juggling": "\u{1F939}&zwj;\u2640\uFE0F",
2675 "woman_mechanic": "\u{1F469}&zwj;\u{1F527}",
2676 "woman_office_worker": "\u{1F469}&zwj;\u{1F4BC}",
2677 "woman_pilot": "\u{1F469}&zwj;\u2708\uFE0F",
2678 "woman_playing_handball": "\u{1F93E}&zwj;\u2640\uFE0F",
2679 "woman_playing_water_polo": "\u{1F93D}&zwj;\u2640\uFE0F",
2680 "woman_scientist": "\u{1F469}&zwj;\u{1F52C}",
2681 "woman_shrugging": "\u{1F937}&zwj;\u2640\uFE0F",
2682 "woman_singer": "\u{1F469}&zwj;\u{1F3A4}",
2683 "woman_student": "\u{1F469}&zwj;\u{1F393}",
2684 "woman_teacher": "\u{1F469}&zwj;\u{1F3EB}",
2685 "woman_technologist": "\u{1F469}&zwj;\u{1F4BB}",
2686 "woman_with_turban": "\u{1F473}&zwj;\u2640\uFE0F",
2687 "womans_clothes": "\u{1F45A}",
2688 "womans_hat": "\u{1F452}",
2689 "women_wrestling": "\u{1F93C}&zwj;\u2640\uFE0F",
2690 "womens": "\u{1F6BA}",
2691 "world_map": "\u{1F5FA}",
2692 "worried": "\u{1F61F}",
2693 "wrench": "\u{1F527}",
2694 "writing_hand": "\u270D\uFE0F",
2695 "x": "\u274C",
2696 "yellow_heart": "\u{1F49B}",
2697 "yen": "\u{1F4B4}",
2698 "yin_yang": "\u262F\uFE0F",
2699 "yum": "\u{1F60B}",
2700 "zap": "\u26A1\uFE0F",
2701 "zipper_mouth_face": "\u{1F910}",
2702 "zzz": "\u{1F4A4}",
2703 /* special emojis :P */
2704 "octocat": '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
2705 "showdown": `<span style="font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;">S</span>`
2706 };
2707 showdown2.Converter = function(converterOptions) {
2708 "use strict";
2709 var options = {}, langExtensions = [], outputModifiers = [], listeners = {}, setConvFlavor = setFlavor, metadata = {
2710 parsed: {},
2711 raw: "",
2712 format: ""
2713 };
2714 _constructor();
2715 function _constructor() {
2716 converterOptions = converterOptions || {};
2717 for (var gOpt in globalOptions) {
2718 if (globalOptions.hasOwnProperty(gOpt)) {
2719 options[gOpt] = globalOptions[gOpt];
2720 }
2721 }
2722 if (typeof converterOptions === "object") {
2723 for (var opt in converterOptions) {
2724 if (converterOptions.hasOwnProperty(opt)) {
2725 options[opt] = converterOptions[opt];
2726 }
2727 }
2728 } else {
2729 throw Error("Converter expects the passed parameter to be an object, but " + typeof converterOptions + " was passed instead.");
2730 }
2731 if (options.extensions) {
2732 showdown2.helper.forEach(options.extensions, _parseExtension);
2733 }
2734 }
2735 function _parseExtension(ext, name) {
2736 name = name || null;
2737 if (showdown2.helper.isString(ext)) {
2738 ext = showdown2.helper.stdExtName(ext);
2739 name = ext;
2740 if (showdown2.extensions[ext]) {
2741 console.warn("DEPRECATION WARNING: " + ext + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!");
2742 legacyExtensionLoading(showdown2.extensions[ext], ext);
2743 return;
2744 } else if (!showdown2.helper.isUndefined(extensions[ext])) {
2745 ext = extensions[ext];
2746 } else {
2747 throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
2748 }
2749 }
2750 if (typeof ext === "function") {
2751 ext = ext();
2752 }
2753 if (!showdown2.helper.isArray(ext)) {
2754 ext = [ext];
2755 }
2756 var validExt = validate(ext, name);
2757 if (!validExt.valid) {
2758 throw Error(validExt.error);
2759 }
2760 for (var i2 = 0; i2 < ext.length; ++i2) {
2761 switch (ext[i2].type) {
2762 case "lang":
2763 langExtensions.push(ext[i2]);
2764 break;
2765 case "output":
2766 outputModifiers.push(ext[i2]);
2767 break;
2768 }
2769 if (ext[i2].hasOwnProperty("listeners")) {
2770 for (var ln in ext[i2].listeners) {
2771 if (ext[i2].listeners.hasOwnProperty(ln)) {
2772 listen(ln, ext[i2].listeners[ln]);
2773 }
2774 }
2775 }
2776 }
2777 }
2778 function legacyExtensionLoading(ext, name) {
2779 if (typeof ext === "function") {
2780 ext = ext(new showdown2.Converter());
2781 }
2782 if (!showdown2.helper.isArray(ext)) {
2783 ext = [ext];
2784 }
2785 var valid = validate(ext, name);
2786 if (!valid.valid) {
2787 throw Error(valid.error);
2788 }
2789 for (var i2 = 0; i2 < ext.length; ++i2) {
2790 switch (ext[i2].type) {
2791 case "lang":
2792 langExtensions.push(ext[i2]);
2793 break;
2794 case "output":
2795 outputModifiers.push(ext[i2]);
2796 break;
2797 default:
2798 throw Error("Extension loader error: Type unrecognized!!!");
2799 }
2800 }
2801 }
2802 function listen(name, callback) {
2803 if (!showdown2.helper.isString(name)) {
2804 throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof name + " given");
2805 }
2806 if (typeof callback !== "function") {
2807 throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof callback + " given");
2808 }
2809 if (!listeners.hasOwnProperty(name)) {
2810 listeners[name] = [];
2811 }
2812 listeners[name].push(callback);
2813 }
2814 function rTrimInputText(text2) {
2815 var rsp = text2.match(/^\s*/)[0].length, rgx = new RegExp("^\\s{0," + rsp + "}", "gm");
2816 return text2.replace(rgx, "");
2817 }
2818 this._dispatch = function dispatch3(evtName, text2, options2, globals) {
2819 if (listeners.hasOwnProperty(evtName)) {
2820 for (var ei = 0; ei < listeners[evtName].length; ++ei) {
2821 var nText = listeners[evtName][ei](evtName, text2, this, options2, globals);
2822 if (nText && typeof nText !== "undefined") {
2823 text2 = nText;
2824 }
2825 }
2826 }
2827 return text2;
2828 };
2829 this.listen = function(name, callback) {
2830 listen(name, callback);
2831 return this;
2832 };
2833 this.makeHtml = function(text2) {
2834 if (!text2) {
2835 return text2;
2836 }
2837 var globals = {
2838 gHtmlBlocks: [],
2839 gHtmlMdBlocks: [],
2840 gHtmlSpans: [],
2841 gUrls: {},
2842 gTitles: {},
2843 gDimensions: {},
2844 gListLevel: 0,
2845 hashLinkCounts: {},
2846 langExtensions,
2847 outputModifiers,
2848 converter: this,
2849 ghCodeBlocks: [],
2850 metadata: {
2851 parsed: {},
2852 raw: "",
2853 format: ""
2854 }
2855 };
2856 text2 = text2.replace(/¨/g, "\xA8T");
2857 text2 = text2.replace(/\$/g, "\xA8D");
2858 text2 = text2.replace(/\r\n/g, "\n");
2859 text2 = text2.replace(/\r/g, "\n");
2860 text2 = text2.replace(/\u00A0/g, "&nbsp;");
2861 if (options.smartIndentationFix) {
2862 text2 = rTrimInputText(text2);
2863 }
2864 text2 = "\n\n" + text2 + "\n\n";
2865 text2 = showdown2.subParser("detab")(text2, options, globals);
2866 text2 = text2.replace(/^[ \t]+$/mg, "");
2867 showdown2.helper.forEach(langExtensions, function(ext) {
2868 text2 = showdown2.subParser("runExtension")(ext, text2, options, globals);
2869 });
2870 text2 = showdown2.subParser("metadata")(text2, options, globals);
2871 text2 = showdown2.subParser("hashPreCodeTags")(text2, options, globals);
2872 text2 = showdown2.subParser("githubCodeBlocks")(text2, options, globals);
2873 text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals);
2874 text2 = showdown2.subParser("hashCodeTags")(text2, options, globals);
2875 text2 = showdown2.subParser("stripLinkDefinitions")(text2, options, globals);
2876 text2 = showdown2.subParser("blockGamut")(text2, options, globals);
2877 text2 = showdown2.subParser("unhashHTMLSpans")(text2, options, globals);
2878 text2 = showdown2.subParser("unescapeSpecialChars")(text2, options, globals);
2879 text2 = text2.replace(/¨D/g, "$$");
2880 text2 = text2.replace(/¨T/g, "\xA8");
2881 text2 = showdown2.subParser("completeHTMLDocument")(text2, options, globals);
2882 showdown2.helper.forEach(outputModifiers, function(ext) {
2883 text2 = showdown2.subParser("runExtension")(ext, text2, options, globals);
2884 });
2885 metadata = globals.metadata;
2886 return text2;
2887 };
2888 this.makeMarkdown = this.makeMd = function(src, HTMLParser) {
2889 src = src.replace(/\r\n/g, "\n");
2890 src = src.replace(/\r/g, "\n");
2891 src = src.replace(/>[ \t]+</, ">\xA8NBSP;<");
2892 if (!HTMLParser) {
2893 if (window && window.document) {
2894 HTMLParser = window.document;
2895 } else {
2896 throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");
2897 }
2898 }
2899 var doc = HTMLParser.createElement("div");
2900 doc.innerHTML = src;
2901 var globals = {
2902 preList: substitutePreCodeTags(doc)
2903 };
2904 clean(doc);
2905 var nodes = doc.childNodes, mdDoc = "";
2906 for (var i2 = 0; i2 < nodes.length; i2++) {
2907 mdDoc += showdown2.subParser("makeMarkdown.node")(nodes[i2], globals);
2908 }
2909 function clean(node) {
2910 for (var n2 = 0; n2 < node.childNodes.length; ++n2) {
2911 var child = node.childNodes[n2];
2912 if (child.nodeType === 3) {
2913 if (!/\S/.test(child.nodeValue)) {
2914 node.removeChild(child);
2915 --n2;
2916 } else {
2917 child.nodeValue = child.nodeValue.split("\n").join(" ");
2918 child.nodeValue = child.nodeValue.replace(/(\s)+/g, "$1");
2919 }
2920 } else if (child.nodeType === 1) {
2921 clean(child);
2922 }
2923 }
2924 }
2925 function substitutePreCodeTags(doc2) {
2926 var pres = doc2.querySelectorAll("pre"), presPH = [];
2927 for (var i3 = 0; i3 < pres.length; ++i3) {
2928 if (pres[i3].childElementCount === 1 && pres[i3].firstChild.tagName.toLowerCase() === "code") {
2929 var content = pres[i3].firstChild.innerHTML.trim(), language = pres[i3].firstChild.getAttribute("data-language") || "";
2930 if (language === "") {
2931 var classes = pres[i3].firstChild.className.split(" ");
2932 for (var c2 = 0; c2 < classes.length; ++c2) {
2933 var matches = classes[c2].match(/^language-(.+)$/);
2934 if (matches !== null) {
2935 language = matches[1];
2936 break;
2937 }
2938 }
2939 }
2940 content = showdown2.helper.unescapeHTMLEntities(content);
2941 presPH.push(content);
2942 pres[i3].outerHTML = '<precode language="' + language + '" precodenum="' + i3.toString() + '"></precode>';
2943 } else {
2944 presPH.push(pres[i3].innerHTML);
2945 pres[i3].innerHTML = "";
2946 pres[i3].setAttribute("prenum", i3.toString());
2947 }
2948 }
2949 return presPH;
2950 }
2951 return mdDoc;
2952 };
2953 this.setOption = function(key, value) {
2954 options[key] = value;
2955 };
2956 this.getOption = function(key) {
2957 return options[key];
2958 };
2959 this.getOptions = function() {
2960 return options;
2961 };
2962 this.addExtension = function(extension, name) {
2963 name = name || null;
2964 _parseExtension(extension, name);
2965 };
2966 this.useExtension = function(extensionName) {
2967 _parseExtension(extensionName);
2968 };
2969 this.setFlavor = function(name) {
2970 if (!flavor.hasOwnProperty(name)) {
2971 throw Error(name + " flavor was not found");
2972 }
2973 var preset = flavor[name];
2974 setConvFlavor = name;
2975 for (var option in preset) {
2976 if (preset.hasOwnProperty(option)) {
2977 options[option] = preset[option];
2978 }
2979 }
2980 };
2981 this.getFlavor = function() {
2982 return setConvFlavor;
2983 };
2984 this.removeExtension = function(extension) {
2985 if (!showdown2.helper.isArray(extension)) {
2986 extension = [extension];
2987 }
2988 for (var a2 = 0; a2 < extension.length; ++a2) {
2989 var ext = extension[a2];
2990 for (var i2 = 0; i2 < langExtensions.length; ++i2) {
2991 if (langExtensions[i2] === ext) {
2992 langExtensions[i2].splice(i2, 1);
2993 }
2994 }
2995 for (var ii = 0; ii < outputModifiers.length; ++i2) {
2996 if (outputModifiers[ii] === ext) {
2997 outputModifiers[ii].splice(i2, 1);
2998 }
2999 }
3000 }
3001 };
3002 this.getAllExtensions = function() {
3003 return {
3004 language: langExtensions,
3005 output: outputModifiers
3006 };
3007 };
3008 this.getMetadata = function(raw) {
3009 if (raw) {
3010 return metadata.raw;
3011 } else {
3012 return metadata.parsed;
3013 }
3014 };
3015 this.getMetadataFormat = function() {
3016 return metadata.format;
3017 };
3018 this._setMetadataPair = function(key, value) {
3019 metadata.parsed[key] = value;
3020 };
3021 this._setMetadataFormat = function(format) {
3022 metadata.format = format;
3023 };
3024 this._setMetadataRaw = function(raw) {
3025 metadata.raw = raw;
3026 };
3027 };
3028 showdown2.subParser("anchors", function(text2, options, globals) {
3029 "use strict";
3030 text2 = globals.converter._dispatch("anchors.before", text2, options, globals);
3031 var writeAnchorTag = function(wholeMatch, linkText, linkId, url, m5, m6, title) {
3032 if (showdown2.helper.isUndefined(title)) {
3033 title = "";
3034 }
3035 linkId = linkId.toLowerCase();
3036 if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
3037 url = "";
3038 } else if (!url) {
3039 if (!linkId) {
3040 linkId = linkText.toLowerCase().replace(/ ?\n/g, " ");
3041 }
3042 url = "#" + linkId;
3043 if (!showdown2.helper.isUndefined(globals.gUrls[linkId])) {
3044 url = globals.gUrls[linkId];
3045 if (!showdown2.helper.isUndefined(globals.gTitles[linkId])) {
3046 title = globals.gTitles[linkId];
3047 }
3048 } else {
3049 return wholeMatch;
3050 }
3051 }
3052 url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3053 var result = '<a href="' + url + '"';
3054 if (title !== "" && title !== null) {
3055 title = title.replace(/"/g, "&quot;");
3056 title = title.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3057 result += ' title="' + title + '"';
3058 }
3059 if (options.openLinksInNewWindow && !/^#/.test(url)) {
3060 result += ' rel="noopener noreferrer" target="\xA8E95Eblank"';
3061 }
3062 result += ">" + linkText + "</a>";
3063 return result;
3064 };
3065 text2 = text2.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
3066 text2 = text2.replace(
3067 /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
3068 writeAnchorTag
3069 );
3070 text2 = text2.replace(
3071 /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
3072 writeAnchorTag
3073 );
3074 text2 = text2.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
3075 if (options.ghMentions) {
3076 text2 = text2.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(wm, st, escape, mentions, username) {
3077 if (escape === "\\") {
3078 return st + mentions;
3079 }
3080 if (!showdown2.helper.isString(options.ghMentionsLink)) {
3081 throw new Error("ghMentionsLink option must be a string");
3082 }
3083 var lnk = options.ghMentionsLink.replace(/\{u}/g, username), target = "";
3084 if (options.openLinksInNewWindow) {
3085 target = ' rel="noopener noreferrer" target="\xA8E95Eblank"';
3086 }
3087 return st + '<a href="' + lnk + '"' + target + ">" + mentions + "</a>";
3088 });
3089 }
3090 text2 = globals.converter._dispatch("anchors.after", text2, options, globals);
3091 return text2;
3092 });
3093 var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, replaceLink = function(options) {
3094 "use strict";
3095 return function(wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
3096 link = link.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3097 var lnkTxt = link, append = "", target = "", lmc = leadingMagicChars || "", tmc = trailingMagicChars || "";
3098 if (/^www\./i.test(link)) {
3099 link = link.replace(/^www\./i, "http://www.");
3100 }
3101 if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
3102 append = trailingPunctuation;
3103 }
3104 if (options.openLinksInNewWindow) {
3105 target = ' rel="noopener noreferrer" target="\xA8E95Eblank"';
3106 }
3107 return lmc + '<a href="' + link + '"' + target + ">" + lnkTxt + "</a>" + append + tmc;
3108 };
3109 }, replaceMail = function(options, globals) {
3110 "use strict";
3111 return function(wholeMatch, b2, mail) {
3112 var href = "mailto:";
3113 b2 = b2 || "";
3114 mail = showdown2.subParser("unescapeSpecialChars")(mail, options, globals);
3115 if (options.encodeEmails) {
3116 href = showdown2.helper.encodeEmailAddress(href + mail);
3117 mail = showdown2.helper.encodeEmailAddress(mail);
3118 } else {
3119 href = href + mail;
3120 }
3121 return b2 + '<a href="' + href + '">' + mail + "</a>";
3122 };
3123 };
3124 showdown2.subParser("autoLinks", function(text2, options, globals) {
3125 "use strict";
3126 text2 = globals.converter._dispatch("autoLinks.before", text2, options, globals);
3127 text2 = text2.replace(delimUrlRegex, replaceLink(options));
3128 text2 = text2.replace(delimMailRegex, replaceMail(options, globals));
3129 text2 = globals.converter._dispatch("autoLinks.after", text2, options, globals);
3130 return text2;
3131 });
3132 showdown2.subParser("simplifiedAutoLinks", function(text2, options, globals) {
3133 "use strict";
3134 if (!options.simplifiedAutoLink) {
3135 return text2;
3136 }
3137 text2 = globals.converter._dispatch("simplifiedAutoLinks.before", text2, options, globals);
3138 if (options.excludeTrailingPunctuationFromURLs) {
3139 text2 = text2.replace(simpleURLRegex2, replaceLink(options));
3140 } else {
3141 text2 = text2.replace(simpleURLRegex, replaceLink(options));
3142 }
3143 text2 = text2.replace(simpleMailRegex, replaceMail(options, globals));
3144 text2 = globals.converter._dispatch("simplifiedAutoLinks.after", text2, options, globals);
3145 return text2;
3146 });
3147 showdown2.subParser("blockGamut", function(text2, options, globals) {
3148 "use strict";
3149 text2 = globals.converter._dispatch("blockGamut.before", text2, options, globals);
3150 text2 = showdown2.subParser("blockQuotes")(text2, options, globals);
3151 text2 = showdown2.subParser("headers")(text2, options, globals);
3152 text2 = showdown2.subParser("horizontalRule")(text2, options, globals);
3153 text2 = showdown2.subParser("lists")(text2, options, globals);
3154 text2 = showdown2.subParser("codeBlocks")(text2, options, globals);
3155 text2 = showdown2.subParser("tables")(text2, options, globals);
3156 text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals);
3157 text2 = showdown2.subParser("paragraphs")(text2, options, globals);
3158 text2 = globals.converter._dispatch("blockGamut.after", text2, options, globals);
3159 return text2;
3160 });
3161 showdown2.subParser("blockQuotes", function(text2, options, globals) {
3162 "use strict";
3163 text2 = globals.converter._dispatch("blockQuotes.before", text2, options, globals);
3164 text2 = text2 + "\n\n";
3165 var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
3166 if (options.splitAdjacentBlockquotes) {
3167 rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
3168 }
3169 text2 = text2.replace(rgx, function(bq) {
3170 bq = bq.replace(/^[ \t]*>[ \t]?/gm, "");
3171 bq = bq.replace(/¨0/g, "");
3172 bq = bq.replace(/^[ \t]+$/gm, "");
3173 bq = showdown2.subParser("githubCodeBlocks")(bq, options, globals);
3174 bq = showdown2.subParser("blockGamut")(bq, options, globals);
3175 bq = bq.replace(/(^|\n)/g, "$1 ");
3176 bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function(wholeMatch, m1) {
3177 var pre = m1;
3178 pre = pre.replace(/^ /mg, "\xA80");
3179 pre = pre.replace(/¨0/g, "");
3180 return pre;
3181 });
3182 return showdown2.subParser("hashBlock")("<blockquote>\n" + bq + "\n</blockquote>", options, globals);
3183 });
3184 text2 = globals.converter._dispatch("blockQuotes.after", text2, options, globals);
3185 return text2;
3186 });
3187 showdown2.subParser("codeBlocks", function(text2, options, globals) {
3188 "use strict";
3189 text2 = globals.converter._dispatch("codeBlocks.before", text2, options, globals);
3190 text2 += "\xA80";
3191 var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
3192 text2 = text2.replace(pattern, function(wholeMatch, m1, m2) {
3193 var codeblock = m1, nextChar = m2, end = "\n";
3194 codeblock = showdown2.subParser("outdent")(codeblock, options, globals);
3195 codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals);
3196 codeblock = showdown2.subParser("detab")(codeblock, options, globals);
3197 codeblock = codeblock.replace(/^\n+/g, "");
3198 codeblock = codeblock.replace(/\n+$/g, "");
3199 if (options.omitExtraWLInCodeBlocks) {
3200 end = "";
3201 }
3202 codeblock = "<pre><code>" + codeblock + end + "</code></pre>";
3203 return showdown2.subParser("hashBlock")(codeblock, options, globals) + nextChar;
3204 });
3205 text2 = text2.replace(/¨0/, "");
3206 text2 = globals.converter._dispatch("codeBlocks.after", text2, options, globals);
3207 return text2;
3208 });
3209 showdown2.subParser("codeSpans", function(text2, options, globals) {
3210 "use strict";
3211 text2 = globals.converter._dispatch("codeSpans.before", text2, options, globals);
3212 if (typeof text2 === "undefined") {
3213 text2 = "";
3214 }
3215 text2 = text2.replace(
3216 /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
3217 function(wholeMatch, m1, m2, m3) {
3218 var c2 = m3;
3219 c2 = c2.replace(/^([ \t]*)/g, "");
3220 c2 = c2.replace(/[ \t]*$/g, "");
3221 c2 = showdown2.subParser("encodeCode")(c2, options, globals);
3222 c2 = m1 + "<code>" + c2 + "</code>";
3223 c2 = showdown2.subParser("hashHTMLSpans")(c2, options, globals);
3224 return c2;
3225 }
3226 );
3227 text2 = globals.converter._dispatch("codeSpans.after", text2, options, globals);
3228 return text2;
3229 });
3230 showdown2.subParser("completeHTMLDocument", function(text2, options, globals) {
3231 "use strict";
3232 if (!options.completeHTMLDocument) {
3233 return text2;
3234 }
3235 text2 = globals.converter._dispatch("completeHTMLDocument.before", text2, options, globals);
3236 var doctype = "html", doctypeParsed = "<!DOCTYPE HTML>\n", title = "", charset = '<meta charset="utf-8">\n', lang = "", metadata = "";
3237 if (typeof globals.metadata.parsed.doctype !== "undefined") {
3238 doctypeParsed = "<!DOCTYPE " + globals.metadata.parsed.doctype + ">\n";
3239 doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
3240 if (doctype === "html" || doctype === "html5") {
3241 charset = '<meta charset="utf-8">';
3242 }
3243 }
3244 for (var meta in globals.metadata.parsed) {
3245 if (globals.metadata.parsed.hasOwnProperty(meta)) {
3246 switch (meta.toLowerCase()) {
3247 case "doctype":
3248 break;
3249 case "title":
3250 title = "<title>" + globals.metadata.parsed.title + "</title>\n";
3251 break;
3252 case "charset":
3253 if (doctype === "html" || doctype === "html5") {
3254 charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
3255 } else {
3256 charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
3257 }
3258 break;
3259 case "language":
3260 case "lang":
3261 lang = ' lang="' + globals.metadata.parsed[meta] + '"';
3262 metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
3263 break;
3264 default:
3265 metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
3266 }
3267 }
3268 }
3269 text2 = doctypeParsed + "<html" + lang + ">\n<head>\n" + title + charset + metadata + "</head>\n<body>\n" + text2.trim() + "\n</body>\n</html>";
3270 text2 = globals.converter._dispatch("completeHTMLDocument.after", text2, options, globals);
3271 return text2;
3272 });
3273 showdown2.subParser("detab", function(text2, options, globals) {
3274 "use strict";
3275 text2 = globals.converter._dispatch("detab.before", text2, options, globals);
3276 text2 = text2.replace(/\t(?=\t)/g, " ");
3277 text2 = text2.replace(/\t/g, "\xA8A\xA8B");
3278 text2 = text2.replace(/¨B(.+?)¨A/g, function(wholeMatch, m1) {
3279 var leadingText = m1, numSpaces = 4 - leadingText.length % 4;
3280 for (var i2 = 0; i2 < numSpaces; i2++) {
3281 leadingText += " ";
3282 }
3283 return leadingText;
3284 });
3285 text2 = text2.replace(/¨A/g, " ");
3286 text2 = text2.replace(/¨B/g, "");
3287 text2 = globals.converter._dispatch("detab.after", text2, options, globals);
3288 return text2;
3289 });
3290 showdown2.subParser("ellipsis", function(text2, options, globals) {
3291 "use strict";
3292 text2 = globals.converter._dispatch("ellipsis.before", text2, options, globals);
3293 text2 = text2.replace(/\.\.\./g, "\u2026");
3294 text2 = globals.converter._dispatch("ellipsis.after", text2, options, globals);
3295 return text2;
3296 });
3297 showdown2.subParser("emoji", function(text2, options, globals) {
3298 "use strict";
3299 if (!options.emoji) {
3300 return text2;
3301 }
3302 text2 = globals.converter._dispatch("emoji.before", text2, options, globals);
3303 var emojiRgx = /:([\S]+?):/g;
3304 text2 = text2.replace(emojiRgx, function(wm, emojiCode) {
3305 if (showdown2.helper.emojis.hasOwnProperty(emojiCode)) {
3306 return showdown2.helper.emojis[emojiCode];
3307 }
3308 return wm;
3309 });
3310 text2 = globals.converter._dispatch("emoji.after", text2, options, globals);
3311 return text2;
3312 });
3313 showdown2.subParser("encodeAmpsAndAngles", function(text2, options, globals) {
3314 "use strict";
3315 text2 = globals.converter._dispatch("encodeAmpsAndAngles.before", text2, options, globals);
3316 text2 = text2.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&amp;");
3317 text2 = text2.replace(/<(?![a-z\/?$!])/gi, "&lt;");
3318 text2 = text2.replace(/</g, "&lt;");
3319 text2 = text2.replace(/>/g, "&gt;");
3320 text2 = globals.converter._dispatch("encodeAmpsAndAngles.after", text2, options, globals);
3321 return text2;
3322 });
3323 showdown2.subParser("encodeBackslashEscapes", function(text2, options, globals) {
3324 "use strict";
3325 text2 = globals.converter._dispatch("encodeBackslashEscapes.before", text2, options, globals);
3326 text2 = text2.replace(/\\(\\)/g, showdown2.helper.escapeCharactersCallback);
3327 text2 = text2.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown2.helper.escapeCharactersCallback);
3328 text2 = globals.converter._dispatch("encodeBackslashEscapes.after", text2, options, globals);
3329 return text2;
3330 });
3331 showdown2.subParser("encodeCode", function(text2, options, globals) {
3332 "use strict";
3333 text2 = globals.converter._dispatch("encodeCode.before", text2, options, globals);
3334 text2 = text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/([*_{}\[\]\\=~-])/g, showdown2.helper.escapeCharactersCallback);
3335 text2 = globals.converter._dispatch("encodeCode.after", text2, options, globals);
3336 return text2;
3337 });
3338 showdown2.subParser("escapeSpecialCharsWithinTagAttributes", function(text2, options, globals) {
3339 "use strict";
3340 text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", text2, options, globals);
3341 var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
3342 text2 = text2.replace(tags, function(wholeMatch) {
3343 return wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback);
3344 });
3345 text2 = text2.replace(comments, function(wholeMatch) {
3346 return wholeMatch.replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback);
3347 });
3348 text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", text2, options, globals);
3349 return text2;
3350 });
3351 showdown2.subParser("githubCodeBlocks", function(text2, options, globals) {
3352 "use strict";
3353 if (!options.ghCodeBlocks) {
3354 return text2;
3355 }
3356 text2 = globals.converter._dispatch("githubCodeBlocks.before", text2, options, globals);
3357 text2 += "\xA80";
3358 text2 = text2.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(wholeMatch, delim, language, codeblock) {
3359 var end = options.omitExtraWLInCodeBlocks ? "" : "\n";
3360 codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals);
3361 codeblock = showdown2.subParser("detab")(codeblock, options, globals);
3362 codeblock = codeblock.replace(/^\n+/g, "");
3363 codeblock = codeblock.replace(/\n+$/g, "");
3364 codeblock = "<pre><code" + (language ? ' class="' + language + " language-" + language + '"' : "") + ">" + codeblock + end + "</code></pre>";
3365 codeblock = showdown2.subParser("hashBlock")(codeblock, options, globals);
3366 return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n";
3367 });
3368 text2 = text2.replace(/¨0/, "");
3369 return globals.converter._dispatch("githubCodeBlocks.after", text2, options, globals);
3370 });
3371 showdown2.subParser("hashBlock", function(text2, options, globals) {
3372 "use strict";
3373 text2 = globals.converter._dispatch("hashBlock.before", text2, options, globals);
3374 text2 = text2.replace(/(^\n+|\n+$)/g, "");
3375 text2 = "\n\n\xA8K" + (globals.gHtmlBlocks.push(text2) - 1) + "K\n\n";
3376 text2 = globals.converter._dispatch("hashBlock.after", text2, options, globals);
3377 return text2;
3378 });
3379 showdown2.subParser("hashCodeTags", function(text2, options, globals) {
3380 "use strict";
3381 text2 = globals.converter._dispatch("hashCodeTags.before", text2, options, globals);
3382 var repFunc = function(wholeMatch, match, left, right) {
3383 var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right;
3384 return "\xA8C" + (globals.gHtmlSpans.push(codeblock) - 1) + "C";
3385 };
3386 text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "<code\\b[^>]*>", "</code>", "gim");
3387 text2 = globals.converter._dispatch("hashCodeTags.after", text2, options, globals);
3388 return text2;
3389 });
3390 showdown2.subParser("hashElement", function(text2, options, globals) {
3391 "use strict";
3392 return function(wholeMatch, m1) {
3393 var blockText = m1;
3394 blockText = blockText.replace(/\n\n/g, "\n");
3395 blockText = blockText.replace(/^\n/, "");
3396 blockText = blockText.replace(/\n+$/g, "");
3397 blockText = "\n\n\xA8K" + (globals.gHtmlBlocks.push(blockText) - 1) + "K\n\n";
3398 return blockText;
3399 };
3400 });
3401 showdown2.subParser("hashHTMLBlocks", function(text2, options, globals) {
3402 "use strict";
3403 text2 = globals.converter._dispatch("hashHTMLBlocks.before", text2, options, globals);
3404 var blockTags = [
3405 "pre",
3406 "div",
3407 "h1",
3408 "h2",
3409 "h3",
3410 "h4",
3411 "h5",
3412 "h6",
3413 "blockquote",
3414 "table",
3415 "dl",
3416 "ol",
3417 "ul",
3418 "script",
3419 "noscript",
3420 "form",
3421 "fieldset",
3422 "iframe",
3423 "math",
3424 "style",
3425 "section",
3426 "header",
3427 "footer",
3428 "nav",
3429 "article",
3430 "aside",
3431 "address",
3432 "audio",
3433 "canvas",
3434 "figure",
3435 "hgroup",
3436 "output",
3437 "video",
3438 "p"
3439 ], repFunc = function(wholeMatch, match, left, right) {
3440 var txt = wholeMatch;
3441 if (left.search(/\bmarkdown\b/) !== -1) {
3442 txt = left + globals.converter.makeHtml(match) + right;
3443 }
3444 return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n";
3445 };
3446 if (options.backslashEscapesHTMLTags) {
3447 text2 = text2.replace(/\\<(\/?[^>]+?)>/g, function(wm, inside) {
3448 return "&lt;" + inside + "&gt;";
3449 });
3450 }
3451 for (var i2 = 0; i2 < blockTags.length; ++i2) {
3452 var opTagPos, rgx1 = new RegExp("^ {0,3}(<" + blockTags[i2] + "\\b[^>]*>)", "im"), patLeft = "<" + blockTags[i2] + "\\b[^>]*>", patRight = "</" + blockTags[i2] + ">";
3453 while ((opTagPos = showdown2.helper.regexIndexOf(text2, rgx1)) !== -1) {
3454 var subTexts = showdown2.helper.splitAtIndex(text2, opTagPos), newSubText1 = showdown2.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, "im");
3455 if (newSubText1 === subTexts[1]) {
3456 break;
3457 }
3458 text2 = subTexts[0].concat(newSubText1);
3459 }
3460 }
3461 text2 = text2.replace(
3462 /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
3463 showdown2.subParser("hashElement")(text2, options, globals)
3464 );
3465 text2 = showdown2.helper.replaceRecursiveRegExp(text2, function(txt) {
3466 return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n";
3467 }, "^ {0,3}<!--", "-->", "gm");
3468 text2 = text2.replace(
3469 /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
3470 showdown2.subParser("hashElement")(text2, options, globals)
3471 );
3472 text2 = globals.converter._dispatch("hashHTMLBlocks.after", text2, options, globals);
3473 return text2;
3474 });
3475 showdown2.subParser("hashHTMLSpans", function(text2, options, globals) {
3476 "use strict";
3477 text2 = globals.converter._dispatch("hashHTMLSpans.before", text2, options, globals);
3478 function hashHTMLSpan(html2) {
3479 return "\xA8C" + (globals.gHtmlSpans.push(html2) - 1) + "C";
3480 }
3481 text2 = text2.replace(/<[^>]+?\/>/gi, function(wm) {
3482 return hashHTMLSpan(wm);
3483 });
3484 text2 = text2.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(wm) {
3485 return hashHTMLSpan(wm);
3486 });
3487 text2 = text2.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(wm) {
3488 return hashHTMLSpan(wm);
3489 });
3490 text2 = text2.replace(/<[^>]+?>/gi, function(wm) {
3491 return hashHTMLSpan(wm);
3492 });
3493 text2 = globals.converter._dispatch("hashHTMLSpans.after", text2, options, globals);
3494 return text2;
3495 });
3496 showdown2.subParser("unhashHTMLSpans", function(text2, options, globals) {
3497 "use strict";
3498 text2 = globals.converter._dispatch("unhashHTMLSpans.before", text2, options, globals);
3499 for (var i2 = 0; i2 < globals.gHtmlSpans.length; ++i2) {
3500 var repText = globals.gHtmlSpans[i2], limit = 0;
3501 while (/¨C(\d+)C/.test(repText)) {
3502 var num = RegExp.$1;
3503 repText = repText.replace("\xA8C" + num + "C", globals.gHtmlSpans[num]);
3504 if (limit === 10) {
3505 console.error("maximum nesting of 10 spans reached!!!");
3506 break;
3507 }
3508 ++limit;
3509 }
3510 text2 = text2.replace("\xA8C" + i2 + "C", repText);
3511 }
3512 text2 = globals.converter._dispatch("unhashHTMLSpans.after", text2, options, globals);
3513 return text2;
3514 });
3515 showdown2.subParser("hashPreCodeTags", function(text2, options, globals) {
3516 "use strict";
3517 text2 = globals.converter._dispatch("hashPreCodeTags.before", text2, options, globals);
3518 var repFunc = function(wholeMatch, match, left, right) {
3519 var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right;
3520 return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n";
3521 };
3522 text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>", "^ {0,3}</code>\\s*</pre>", "gim");
3523 text2 = globals.converter._dispatch("hashPreCodeTags.after", text2, options, globals);
3524 return text2;
3525 });
3526 showdown2.subParser("headers", function(text2, options, globals) {
3527 "use strict";
3528 text2 = globals.converter._dispatch("headers.before", text2, options, globals);
3529 var headerLevelStart = isNaN(parseInt(options.headerLevelStart)) ? 1 : parseInt(options.headerLevelStart), setextRegexH1 = options.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, setextRegexH2 = options.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
3530 text2 = text2.replace(setextRegexH1, function(wholeMatch, m1) {
3531 var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">";
3532 return showdown2.subParser("hashBlock")(hashBlock, options, globals);
3533 });
3534 text2 = text2.replace(setextRegexH2, function(matchFound, m1) {
3535 var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart + 1, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">";
3536 return showdown2.subParser("hashBlock")(hashBlock, options, globals);
3537 });
3538 var atxStyle = options.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
3539 text2 = text2.replace(atxStyle, function(wholeMatch, m1, m2) {
3540 var hText = m2;
3541 if (options.customizedHeaderId) {
3542 hText = m2.replace(/\s?\{([^{]+?)}\s*$/, "");
3543 }
3544 var span = showdown2.subParser("spanGamut")(hText, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m2) + '"', hLevel = headerLevelStart - 1 + m1.length, header = "<h" + hLevel + hID + ">" + span + "</h" + hLevel + ">";
3545 return showdown2.subParser("hashBlock")(header, options, globals);
3546 });
3547 function headerId(m2) {
3548 var title, prefix;
3549 if (options.customizedHeaderId) {
3550 var match = m2.match(/\{([^{]+?)}\s*$/);
3551 if (match && match[1]) {
3552 m2 = match[1];
3553 }
3554 }
3555 title = m2;
3556 if (showdown2.helper.isString(options.prefixHeaderId)) {
3557 prefix = options.prefixHeaderId;
3558 } else if (options.prefixHeaderId === true) {
3559 prefix = "section-";
3560 } else {
3561 prefix = "";
3562 }
3563 if (!options.rawPrefixHeaderId) {
3564 title = prefix + title;
3565 }
3566 if (options.ghCompatibleHeaderId) {
3567 title = title.replace(/ /g, "-").replace(/&amp;/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase();
3568 } else if (options.rawHeaderId) {
3569 title = title.replace(/ /g, "-").replace(/&amp;/g, "&").replace(/¨T/g, "\xA8").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase();
3570 } else {
3571 title = title.replace(/[^\w]/g, "").toLowerCase();
3572 }
3573 if (options.rawPrefixHeaderId) {
3574 title = prefix + title;
3575 }
3576 if (globals.hashLinkCounts[title]) {
3577 title = title + "-" + globals.hashLinkCounts[title]++;
3578 } else {
3579 globals.hashLinkCounts[title] = 1;
3580 }
3581 return title;
3582 }
3583 text2 = globals.converter._dispatch("headers.after", text2, options, globals);
3584 return text2;
3585 });
3586 showdown2.subParser("horizontalRule", function(text2, options, globals) {
3587 "use strict";
3588 text2 = globals.converter._dispatch("horizontalRule.before", text2, options, globals);
3589 var key = showdown2.subParser("hashBlock")("<hr />", options, globals);
3590 text2 = text2.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
3591 text2 = text2.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
3592 text2 = text2.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
3593 text2 = globals.converter._dispatch("horizontalRule.after", text2, options, globals);
3594 return text2;
3595 });
3596 showdown2.subParser("images", function(text2, options, globals) {
3597 "use strict";
3598 text2 = globals.converter._dispatch("images.before", text2, options, globals);
3599 var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, base64RegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
3600 function writeImageTagBase64(wholeMatch, altText, linkId, url, width, height, m5, title) {
3601 url = url.replace(/\s/g, "");
3602 return writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title);
3603 }
3604 function writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title) {
3605 var gUrls = globals.gUrls, gTitles = globals.gTitles, gDims = globals.gDimensions;
3606 linkId = linkId.toLowerCase();
3607 if (!title) {
3608 title = "";
3609 }
3610 if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
3611 url = "";
3612 } else if (url === "" || url === null) {
3613 if (linkId === "" || linkId === null) {
3614 linkId = altText.toLowerCase().replace(/ ?\n/g, " ");
3615 }
3616 url = "#" + linkId;
3617 if (!showdown2.helper.isUndefined(gUrls[linkId])) {
3618 url = gUrls[linkId];
3619 if (!showdown2.helper.isUndefined(gTitles[linkId])) {
3620 title = gTitles[linkId];
3621 }
3622 if (!showdown2.helper.isUndefined(gDims[linkId])) {
3623 width = gDims[linkId].width;
3624 height = gDims[linkId].height;
3625 }
3626 } else {
3627 return wholeMatch;
3628 }
3629 }
3630 altText = altText.replace(/"/g, "&quot;").replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3631 url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3632 var result = '<img src="' + url + '" alt="' + altText + '"';
3633 if (title && showdown2.helper.isString(title)) {
3634 title = title.replace(/"/g, "&quot;").replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3635 result += ' title="' + title + '"';
3636 }
3637 if (width && height) {
3638 width = width === "*" ? "auto" : width;
3639 height = height === "*" ? "auto" : height;
3640 result += ' width="' + width + '"';
3641 result += ' height="' + height + '"';
3642 }
3643 result += " />";
3644 return result;
3645 }
3646 text2 = text2.replace(referenceRegExp, writeImageTag);
3647 text2 = text2.replace(base64RegExp, writeImageTagBase64);
3648 text2 = text2.replace(crazyRegExp, writeImageTag);
3649 text2 = text2.replace(inlineRegExp, writeImageTag);
3650 text2 = text2.replace(refShortcutRegExp, writeImageTag);
3651 text2 = globals.converter._dispatch("images.after", text2, options, globals);
3652 return text2;
3653 });
3654 showdown2.subParser("italicsAndBold", function(text2, options, globals) {
3655 "use strict";
3656 text2 = globals.converter._dispatch("italicsAndBold.before", text2, options, globals);
3657 function parseInside(txt, left, right) {
3658 return left + txt + right;
3659 }
3660 if (options.literalMidWordUnderscores) {
3661 text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) {
3662 return parseInside(txt, "<strong><em>", "</em></strong>");
3663 });
3664 text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) {
3665 return parseInside(txt, "<strong>", "</strong>");
3666 });
3667 text2 = text2.replace(/\b_(\S[\s\S]*?)_\b/g, function(wm, txt) {
3668 return parseInside(txt, "<em>", "</em>");
3669 });
3670 } else {
3671 text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) {
3672 return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm;
3673 });
3674 text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) {
3675 return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm;
3676 });
3677 text2 = text2.replace(/_([^\s_][\s\S]*?)_/g, function(wm, m2) {
3678 return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm;
3679 });
3680 }
3681 if (options.literalMidWordAsterisks) {
3682 text2 = text2.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(wm, lead, txt) {
3683 return parseInside(txt, lead + "<strong><em>", "</em></strong>");
3684 });
3685 text2 = text2.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(wm, lead, txt) {
3686 return parseInside(txt, lead + "<strong>", "</strong>");
3687 });
3688 text2 = text2.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(wm, lead, txt) {
3689 return parseInside(txt, lead + "<em>", "</em>");
3690 });
3691 } else {
3692 text2 = text2.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(wm, m2) {
3693 return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm;
3694 });
3695 text2 = text2.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(wm, m2) {
3696 return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm;
3697 });
3698 text2 = text2.replace(/\*([^\s*][\s\S]*?)\*/g, function(wm, m2) {
3699 return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm;
3700 });
3701 }
3702 text2 = globals.converter._dispatch("italicsAndBold.after", text2, options, globals);
3703 return text2;
3704 });
3705 showdown2.subParser("lists", function(text2, options, globals) {
3706 "use strict";
3707 function processListItems(listStr, trimTrailing) {
3708 globals.gListLevel++;
3709 listStr = listStr.replace(/\n{2,}$/, "\n");
3710 listStr += "\xA80";
3711 var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, isParagraphed = /\n[ \t]*\n(?!¨0)/.test(listStr);
3712 if (options.disableForced4SpacesIndentedSublists) {
3713 rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
3714 }
3715 listStr = listStr.replace(rgx, function(wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
3716 checked = checked && checked.trim() !== "";
3717 var item = showdown2.subParser("outdent")(m4, options, globals), bulletStyle = "";
3718 if (taskbtn && options.tasklists) {
3719 bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
3720 item = item.replace(/^[ \t]*\[(x|X| )?]/m, function() {
3721 var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
3722 if (checked) {
3723 otp += " checked";
3724 }
3725 otp += ">";
3726 return otp;
3727 });
3728 }
3729 item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function(wm2) {
3730 return "\xA8A" + wm2;
3731 });
3732 if (m1 || item.search(/\n{2,}/) > -1) {
3733 item = showdown2.subParser("githubCodeBlocks")(item, options, globals);
3734 item = showdown2.subParser("blockGamut")(item, options, globals);
3735 } else {
3736 item = showdown2.subParser("lists")(item, options, globals);
3737 item = item.replace(/\n$/, "");
3738 item = showdown2.subParser("hashHTMLBlocks")(item, options, globals);
3739 item = item.replace(/\n\n+/g, "\n\n");
3740 if (isParagraphed) {
3741 item = showdown2.subParser("paragraphs")(item, options, globals);
3742 } else {
3743 item = showdown2.subParser("spanGamut")(item, options, globals);
3744 }
3745 }
3746 item = item.replace("\xA8A", "");
3747 item = "<li" + bulletStyle + ">" + item + "</li>\n";
3748 return item;
3749 });
3750 listStr = listStr.replace(/¨0/g, "");
3751 globals.gListLevel--;
3752 if (trimTrailing) {
3753 listStr = listStr.replace(/\s+$/, "");
3754 }
3755 return listStr;
3756 }
3757 function styleStartNumber(list, listType) {
3758 if (listType === "ol") {
3759 var res = list.match(/^ *(\d+)\./);
3760 if (res && res[1] !== "1") {
3761 return ' start="' + res[1] + '"';
3762 }
3763 }
3764 return "";
3765 }
3766 function parseConsecutiveLists(list, listType, trimTrailing) {
3767 var olRgx = options.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, ulRgx = options.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, counterRxg = listType === "ul" ? olRgx : ulRgx, result = "";
3768 if (list.search(counterRxg) !== -1) {
3769 (function parseCL(txt) {
3770 var pos = txt.search(counterRxg), style2 = styleStartNumber(list, listType);
3771 if (pos !== -1) {
3772 result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt.slice(0, pos), !!trimTrailing) + "</" + listType + ">\n";
3773 listType = listType === "ul" ? "ol" : "ul";
3774 counterRxg = listType === "ul" ? olRgx : ulRgx;
3775 parseCL(txt.slice(pos));
3776 } else {
3777 result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt, !!trimTrailing) + "</" + listType + ">\n";
3778 }
3779 })(list);
3780 } else {
3781 var style = styleStartNumber(list, listType);
3782 result = "\n\n<" + listType + style + ">\n" + processListItems(list, !!trimTrailing) + "</" + listType + ">\n";
3783 }
3784 return result;
3785 }
3786 text2 = globals.converter._dispatch("lists.before", text2, options, globals);
3787 text2 += "\xA80";
3788 if (globals.gListLevel) {
3789 text2 = text2.replace(
3790 /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
3791 function(wholeMatch, list, m2) {
3792 var listType = m2.search(/[*+-]/g) > -1 ? "ul" : "ol";
3793 return parseConsecutiveLists(list, listType, true);
3794 }
3795 );
3796 } else {
3797 text2 = text2.replace(
3798 /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
3799 function(wholeMatch, m1, list, m3) {
3800 var listType = m3.search(/[*+-]/g) > -1 ? "ul" : "ol";
3801 return parseConsecutiveLists(list, listType, false);
3802 }
3803 );
3804 }
3805 text2 = text2.replace(/¨0/, "");
3806 text2 = globals.converter._dispatch("lists.after", text2, options, globals);
3807 return text2;
3808 });
3809 showdown2.subParser("metadata", function(text2, options, globals) {
3810 "use strict";
3811 if (!options.metadata) {
3812 return text2;
3813 }
3814 text2 = globals.converter._dispatch("metadata.before", text2, options, globals);
3815 function parseMetadataContents(content) {
3816 globals.metadata.raw = content;
3817 content = content.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
3818 content = content.replace(/\n {4}/g, " ");
3819 content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(wm, key, value) {
3820 globals.metadata.parsed[key] = value;
3821 return "";
3822 });
3823 }
3824 text2 = text2.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(wholematch, format, content) {
3825 parseMetadataContents(content);
3826 return "\xA8M";
3827 });
3828 text2 = text2.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(wholematch, format, content) {
3829 if (format) {
3830 globals.metadata.format = format;
3831 }
3832 parseMetadataContents(content);
3833 return "\xA8M";
3834 });
3835 text2 = text2.replace(/¨M/g, "");
3836 text2 = globals.converter._dispatch("metadata.after", text2, options, globals);
3837 return text2;
3838 });
3839 showdown2.subParser("outdent", function(text2, options, globals) {
3840 "use strict";
3841 text2 = globals.converter._dispatch("outdent.before", text2, options, globals);
3842 text2 = text2.replace(/^(\t|[ ]{1,4})/gm, "\xA80");
3843 text2 = text2.replace(/¨0/g, "");
3844 text2 = globals.converter._dispatch("outdent.after", text2, options, globals);
3845 return text2;
3846 });
3847 showdown2.subParser("paragraphs", function(text2, options, globals) {
3848 "use strict";
3849 text2 = globals.converter._dispatch("paragraphs.before", text2, options, globals);
3850 text2 = text2.replace(/^\n+/g, "");
3851 text2 = text2.replace(/\n+$/g, "");
3852 var grafs = text2.split(/\n{2,}/g), grafsOut = [], end = grafs.length;
3853 for (var i2 = 0; i2 < end; i2++) {
3854 var str = grafs[i2];
3855 if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
3856 grafsOut.push(str);
3857 } else if (str.search(/\S/) >= 0) {
3858 str = showdown2.subParser("spanGamut")(str, options, globals);
3859 str = str.replace(/^([ \t]*)/g, "<p>");
3860 str += "</p>";
3861 grafsOut.push(str);
3862 }
3863 }
3864 end = grafsOut.length;
3865 for (i2 = 0; i2 < end; i2++) {
3866 var blockText = "", grafsOutIt = grafsOut[i2], codeFlag = false;
3867 while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
3868 var delim = RegExp.$1, num = RegExp.$2;
3869 if (delim === "K") {
3870 blockText = globals.gHtmlBlocks[num];
3871 } else {
3872 if (codeFlag) {
3873 blockText = showdown2.subParser("encodeCode")(globals.ghCodeBlocks[num].text, options, globals);
3874 } else {
3875 blockText = globals.ghCodeBlocks[num].codeblock;
3876 }
3877 }
3878 blockText = blockText.replace(/\$/g, "$$$$");
3879 grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
3880 if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
3881 codeFlag = true;
3882 }
3883 }
3884 grafsOut[i2] = grafsOutIt;
3885 }
3886 text2 = grafsOut.join("\n");
3887 text2 = text2.replace(/^\n+/g, "");
3888 text2 = text2.replace(/\n+$/g, "");
3889 return globals.converter._dispatch("paragraphs.after", text2, options, globals);
3890 });
3891 showdown2.subParser("runExtension", function(ext, text2, options, globals) {
3892 "use strict";
3893 if (ext.filter) {
3894 text2 = ext.filter(text2, globals.converter, options);
3895 } else if (ext.regex) {
3896 var re = ext.regex;
3897 if (!(re instanceof RegExp)) {
3898 re = new RegExp(re, "g");
3899 }
3900 text2 = text2.replace(re, ext.replace);
3901 }
3902 return text2;
3903 });
3904 showdown2.subParser("spanGamut", function(text2, options, globals) {
3905 "use strict";
3906 text2 = globals.converter._dispatch("spanGamut.before", text2, options, globals);
3907 text2 = showdown2.subParser("codeSpans")(text2, options, globals);
3908 text2 = showdown2.subParser("escapeSpecialCharsWithinTagAttributes")(text2, options, globals);
3909 text2 = showdown2.subParser("encodeBackslashEscapes")(text2, options, globals);
3910 text2 = showdown2.subParser("images")(text2, options, globals);
3911 text2 = showdown2.subParser("anchors")(text2, options, globals);
3912 text2 = showdown2.subParser("autoLinks")(text2, options, globals);
3913 text2 = showdown2.subParser("simplifiedAutoLinks")(text2, options, globals);
3914 text2 = showdown2.subParser("emoji")(text2, options, globals);
3915 text2 = showdown2.subParser("underline")(text2, options, globals);
3916 text2 = showdown2.subParser("italicsAndBold")(text2, options, globals);
3917 text2 = showdown2.subParser("strikethrough")(text2, options, globals);
3918 text2 = showdown2.subParser("ellipsis")(text2, options, globals);
3919 text2 = showdown2.subParser("hashHTMLSpans")(text2, options, globals);
3920 text2 = showdown2.subParser("encodeAmpsAndAngles")(text2, options, globals);
3921 if (options.simpleLineBreaks) {
3922 if (!/\n\n¨K/.test(text2)) {
3923 text2 = text2.replace(/\n+/g, "<br />\n");
3924 }
3925 } else {
3926 text2 = text2.replace(/ +\n/g, "<br />\n");
3927 }
3928 text2 = globals.converter._dispatch("spanGamut.after", text2, options, globals);
3929 return text2;
3930 });
3931 showdown2.subParser("strikethrough", function(text2, options, globals) {
3932 "use strict";
3933 function parseInside(txt) {
3934 if (options.simplifiedAutoLink) {
3935 txt = showdown2.subParser("simplifiedAutoLinks")(txt, options, globals);
3936 }
3937 return "<del>" + txt + "</del>";
3938 }
3939 if (options.strikethrough) {
3940 text2 = globals.converter._dispatch("strikethrough.before", text2, options, globals);
3941 text2 = text2.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(wm, txt) {
3942 return parseInside(txt);
3943 });
3944 text2 = globals.converter._dispatch("strikethrough.after", text2, options, globals);
3945 }
3946 return text2;
3947 });
3948 showdown2.subParser("stripLinkDefinitions", function(text2, options, globals) {
3949 "use strict";
3950 var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm, base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
3951 text2 += "\xA80";
3952 var replaceFunc = function(wholeMatch, linkId, url, width, height, blankLines, title) {
3953 linkId = linkId.toLowerCase();
3954 if (url.match(/^data:.+?\/.+?;base64,/)) {
3955 globals.gUrls[linkId] = url.replace(/\s/g, "");
3956 } else {
3957 globals.gUrls[linkId] = showdown2.subParser("encodeAmpsAndAngles")(url, options, globals);
3958 }
3959 if (blankLines) {
3960 return blankLines + title;
3961 } else {
3962 if (title) {
3963 globals.gTitles[linkId] = title.replace(/"|'/g, "&quot;");
3964 }
3965 if (options.parseImgDimensions && width && height) {
3966 globals.gDimensions[linkId] = {
3967 width,
3968 height
3969 };
3970 }
3971 }
3972 return "";
3973 };
3974 text2 = text2.replace(base64Regex, replaceFunc);
3975 text2 = text2.replace(regex, replaceFunc);
3976 text2 = text2.replace(/¨0/, "");
3977 return text2;
3978 });
3979 showdown2.subParser("tables", function(text2, options, globals) {
3980 "use strict";
3981 if (!options.tables) {
3982 return text2;
3983 }
3984 var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
3985 function parseStyles(sLine) {
3986 if (/^:[ \t]*--*$/.test(sLine)) {
3987 return ' style="text-align:left;"';
3988 } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
3989 return ' style="text-align:right;"';
3990 } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
3991 return ' style="text-align:center;"';
3992 } else {
3993 return "";
3994 }
3995 }
3996 function parseHeaders(header, style) {
3997 var id = "";
3998 header = header.trim();
3999 if (options.tablesHeaderId || options.tableHeaderId) {
4000 id = ' id="' + header.replace(/ /g, "_").toLowerCase() + '"';
4001 }
4002 header = showdown2.subParser("spanGamut")(header, options, globals);
4003 return "<th" + id + style + ">" + header + "</th>\n";
4004 }
4005 function parseCells(cell, style) {
4006 var subText = showdown2.subParser("spanGamut")(cell, options, globals);
4007 return "<td" + style + ">" + subText + "</td>\n";
4008 }
4009 function buildTable(headers, cells) {
4010 var tb = "<table>\n<thead>\n<tr>\n", tblLgn = headers.length;
4011 for (var i2 = 0; i2 < tblLgn; ++i2) {
4012 tb += headers[i2];
4013 }
4014 tb += "</tr>\n</thead>\n<tbody>\n";
4015 for (i2 = 0; i2 < cells.length; ++i2) {
4016 tb += "<tr>\n";
4017 for (var ii = 0; ii < tblLgn; ++ii) {
4018 tb += cells[i2][ii];
4019 }
4020 tb += "</tr>\n";
4021 }
4022 tb += "</tbody>\n</table>\n";
4023 return tb;
4024 }
4025 function parseTable(rawTable) {
4026 var i2, tableLines = rawTable.split("\n");
4027 for (i2 = 0; i2 < tableLines.length; ++i2) {
4028 if (/^ {0,3}\|/.test(tableLines[i2])) {
4029 tableLines[i2] = tableLines[i2].replace(/^ {0,3}\|/, "");
4030 }
4031 if (/\|[ \t]*$/.test(tableLines[i2])) {
4032 tableLines[i2] = tableLines[i2].replace(/\|[ \t]*$/, "");
4033 }
4034 tableLines[i2] = showdown2.subParser("codeSpans")(tableLines[i2], options, globals);
4035 }
4036 var rawHeaders = tableLines[0].split("|").map(function(s2) {
4037 return s2.trim();
4038 }), rawStyles = tableLines[1].split("|").map(function(s2) {
4039 return s2.trim();
4040 }), rawCells = [], headers = [], styles = [], cells = [];
4041 tableLines.shift();
4042 tableLines.shift();
4043 for (i2 = 0; i2 < tableLines.length; ++i2) {
4044 if (tableLines[i2].trim() === "") {
4045 continue;
4046 }
4047 rawCells.push(
4048 tableLines[i2].split("|").map(function(s2) {
4049 return s2.trim();
4050 })
4051 );
4052 }
4053 if (rawHeaders.length < rawStyles.length) {
4054 return rawTable;
4055 }
4056 for (i2 = 0; i2 < rawStyles.length; ++i2) {
4057 styles.push(parseStyles(rawStyles[i2]));
4058 }
4059 for (i2 = 0; i2 < rawHeaders.length; ++i2) {
4060 if (showdown2.helper.isUndefined(styles[i2])) {
4061 styles[i2] = "";
4062 }
4063 headers.push(parseHeaders(rawHeaders[i2], styles[i2]));
4064 }
4065 for (i2 = 0; i2 < rawCells.length; ++i2) {
4066 var row = [];
4067 for (var ii = 0; ii < headers.length; ++ii) {
4068 if (showdown2.helper.isUndefined(rawCells[i2][ii])) {
4069 }
4070 row.push(parseCells(rawCells[i2][ii], styles[ii]));
4071 }
4072 cells.push(row);
4073 }
4074 return buildTable(headers, cells);
4075 }
4076 text2 = globals.converter._dispatch("tables.before", text2, options, globals);
4077 text2 = text2.replace(/\\(\|)/g, showdown2.helper.escapeCharactersCallback);
4078 text2 = text2.replace(tableRgx, parseTable);
4079 text2 = text2.replace(singeColTblRgx, parseTable);
4080 text2 = globals.converter._dispatch("tables.after", text2, options, globals);
4081 return text2;
4082 });
4083 showdown2.subParser("underline", function(text2, options, globals) {
4084 "use strict";
4085 if (!options.underline) {
4086 return text2;
4087 }
4088 text2 = globals.converter._dispatch("underline.before", text2, options, globals);
4089 if (options.literalMidWordUnderscores) {
4090 text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) {
4091 return "<u>" + txt + "</u>";
4092 });
4093 text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) {
4094 return "<u>" + txt + "</u>";
4095 });
4096 } else {
4097 text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) {
4098 return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm;
4099 });
4100 text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) {
4101 return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm;
4102 });
4103 }
4104 text2 = text2.replace(/(_)/g, showdown2.helper.escapeCharactersCallback);
4105 text2 = globals.converter._dispatch("underline.after", text2, options, globals);
4106 return text2;
4107 });
4108 showdown2.subParser("unescapeSpecialChars", function(text2, options, globals) {
4109 "use strict";
4110 text2 = globals.converter._dispatch("unescapeSpecialChars.before", text2, options, globals);
4111 text2 = text2.replace(/¨E(\d+)E/g, function(wholeMatch, m1) {
4112 var charCodeToReplace = parseInt(m1);
4113 return String.fromCharCode(charCodeToReplace);
4114 });
4115 text2 = globals.converter._dispatch("unescapeSpecialChars.after", text2, options, globals);
4116 return text2;
4117 });
4118 showdown2.subParser("makeMarkdown.blockquote", function(node, globals) {
4119 "use strict";
4120 var txt = "";
4121 if (node.hasChildNodes()) {
4122 var children = node.childNodes, childrenLength = children.length;
4123 for (var i2 = 0; i2 < childrenLength; ++i2) {
4124 var innerTxt = showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4125 if (innerTxt === "") {
4126 continue;
4127 }
4128 txt += innerTxt;
4129 }
4130 }
4131 txt = txt.trim();
4132 txt = "> " + txt.split("\n").join("\n> ");
4133 return txt;
4134 });
4135 showdown2.subParser("makeMarkdown.codeBlock", function(node, globals) {
4136 "use strict";
4137 var lang = node.getAttribute("language"), num = node.getAttribute("precodenum");
4138 return "```" + lang + "\n" + globals.preList[num] + "\n```";
4139 });
4140 showdown2.subParser("makeMarkdown.codeSpan", function(node) {
4141 "use strict";
4142 return "`" + node.innerHTML + "`";
4143 });
4144 showdown2.subParser("makeMarkdown.emphasis", function(node, globals) {
4145 "use strict";
4146 var txt = "";
4147 if (node.hasChildNodes()) {
4148 txt += "*";
4149 var children = node.childNodes, childrenLength = children.length;
4150 for (var i2 = 0; i2 < childrenLength; ++i2) {
4151 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4152 }
4153 txt += "*";
4154 }
4155 return txt;
4156 });
4157 showdown2.subParser("makeMarkdown.header", function(node, globals, headerLevel) {
4158 "use strict";
4159 var headerMark = new Array(headerLevel + 1).join("#"), txt = "";
4160 if (node.hasChildNodes()) {
4161 txt = headerMark + " ";
4162 var children = node.childNodes, childrenLength = children.length;
4163 for (var i2 = 0; i2 < childrenLength; ++i2) {
4164 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4165 }
4166 }
4167 return txt;
4168 });
4169 showdown2.subParser("makeMarkdown.hr", function() {
4170 "use strict";
4171 return "---";
4172 });
4173 showdown2.subParser("makeMarkdown.image", function(node) {
4174 "use strict";
4175 var txt = "";
4176 if (node.hasAttribute("src")) {
4177 txt += "![" + node.getAttribute("alt") + "](";
4178 txt += "<" + node.getAttribute("src") + ">";
4179 if (node.hasAttribute("width") && node.hasAttribute("height")) {
4180 txt += " =" + node.getAttribute("width") + "x" + node.getAttribute("height");
4181 }
4182 if (node.hasAttribute("title")) {
4183 txt += ' "' + node.getAttribute("title") + '"';
4184 }
4185 txt += ")";
4186 }
4187 return txt;
4188 });
4189 showdown2.subParser("makeMarkdown.links", function(node, globals) {
4190 "use strict";
4191 var txt = "";
4192 if (node.hasChildNodes() && node.hasAttribute("href")) {
4193 var children = node.childNodes, childrenLength = children.length;
4194 txt = "[";
4195 for (var i2 = 0; i2 < childrenLength; ++i2) {
4196 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4197 }
4198 txt += "](";
4199 txt += "<" + node.getAttribute("href") + ">";
4200 if (node.hasAttribute("title")) {
4201 txt += ' "' + node.getAttribute("title") + '"';
4202 }
4203 txt += ")";
4204 }
4205 return txt;
4206 });
4207 showdown2.subParser("makeMarkdown.list", function(node, globals, type) {
4208 "use strict";
4209 var txt = "";
4210 if (!node.hasChildNodes()) {
4211 return "";
4212 }
4213 var listItems = node.childNodes, listItemsLenght = listItems.length, listNum = node.getAttribute("start") || 1;
4214 for (var i2 = 0; i2 < listItemsLenght; ++i2) {
4215 if (typeof listItems[i2].tagName === "undefined" || listItems[i2].tagName.toLowerCase() !== "li") {
4216 continue;
4217 }
4218 var bullet = "";
4219 if (type === "ol") {
4220 bullet = listNum.toString() + ". ";
4221 } else {
4222 bullet = "- ";
4223 }
4224 txt += bullet + showdown2.subParser("makeMarkdown.listItem")(listItems[i2], globals);
4225 ++listNum;
4226 }
4227 txt += "\n<!-- -->\n";
4228 return txt.trim();
4229 });
4230 showdown2.subParser("makeMarkdown.listItem", function(node, globals) {
4231 "use strict";
4232 var listItemTxt = "";
4233 var children = node.childNodes, childrenLenght = children.length;
4234 for (var i2 = 0; i2 < childrenLenght; ++i2) {
4235 listItemTxt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4236 }
4237 if (!/\n$/.test(listItemTxt)) {
4238 listItemTxt += "\n";
4239 } else {
4240 listItemTxt = listItemTxt.split("\n").join("\n ").replace(/^ {4}$/gm, "").replace(/\n\n+/g, "\n\n");
4241 }
4242 return listItemTxt;
4243 });
4244 showdown2.subParser("makeMarkdown.node", function(node, globals, spansOnly) {
4245 "use strict";
4246 spansOnly = spansOnly || false;
4247 var txt = "";
4248 if (node.nodeType === 3) {
4249 return showdown2.subParser("makeMarkdown.txt")(node, globals);
4250 }
4251 if (node.nodeType === 8) {
4252 return "<!--" + node.data + "-->\n\n";
4253 }
4254 if (node.nodeType !== 1) {
4255 return "";
4256 }
4257 var tagName = node.tagName.toLowerCase();
4258 switch (tagName) {
4259 //
4260 // BLOCKS
4261 //
4262 case "h1":
4263 if (!spansOnly) {
4264 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 1) + "\n\n";
4265 }
4266 break;
4267 case "h2":
4268 if (!spansOnly) {
4269 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 2) + "\n\n";
4270 }
4271 break;
4272 case "h3":
4273 if (!spansOnly) {
4274 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 3) + "\n\n";
4275 }
4276 break;
4277 case "h4":
4278 if (!spansOnly) {
4279 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 4) + "\n\n";
4280 }
4281 break;
4282 case "h5":
4283 if (!spansOnly) {
4284 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 5) + "\n\n";
4285 }
4286 break;
4287 case "h6":
4288 if (!spansOnly) {
4289 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 6) + "\n\n";
4290 }
4291 break;
4292 case "p":
4293 if (!spansOnly) {
4294 txt = showdown2.subParser("makeMarkdown.paragraph")(node, globals) + "\n\n";
4295 }
4296 break;
4297 case "blockquote":
4298 if (!spansOnly) {
4299 txt = showdown2.subParser("makeMarkdown.blockquote")(node, globals) + "\n\n";
4300 }
4301 break;
4302 case "hr":
4303 if (!spansOnly) {
4304 txt = showdown2.subParser("makeMarkdown.hr")(node, globals) + "\n\n";
4305 }
4306 break;
4307 case "ol":
4308 if (!spansOnly) {
4309 txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ol") + "\n\n";
4310 }
4311 break;
4312 case "ul":
4313 if (!spansOnly) {
4314 txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ul") + "\n\n";
4315 }
4316 break;
4317 case "precode":
4318 if (!spansOnly) {
4319 txt = showdown2.subParser("makeMarkdown.codeBlock")(node, globals) + "\n\n";
4320 }
4321 break;
4322 case "pre":
4323 if (!spansOnly) {
4324 txt = showdown2.subParser("makeMarkdown.pre")(node, globals) + "\n\n";
4325 }
4326 break;
4327 case "table":
4328 if (!spansOnly) {
4329 txt = showdown2.subParser("makeMarkdown.table")(node, globals) + "\n\n";
4330 }
4331 break;
4332 //
4333 // SPANS
4334 //
4335 case "code":
4336 txt = showdown2.subParser("makeMarkdown.codeSpan")(node, globals);
4337 break;
4338 case "em":
4339 case "i":
4340 txt = showdown2.subParser("makeMarkdown.emphasis")(node, globals);
4341 break;
4342 case "strong":
4343 case "b":
4344 txt = showdown2.subParser("makeMarkdown.strong")(node, globals);
4345 break;
4346 case "del":
4347 txt = showdown2.subParser("makeMarkdown.strikethrough")(node, globals);
4348 break;
4349 case "a":
4350 txt = showdown2.subParser("makeMarkdown.links")(node, globals);
4351 break;
4352 case "img":
4353 txt = showdown2.subParser("makeMarkdown.image")(node, globals);
4354 break;
4355 default:
4356 txt = node.outerHTML + "\n\n";
4357 }
4358 return txt;
4359 });
4360 showdown2.subParser("makeMarkdown.paragraph", function(node, globals) {
4361 "use strict";
4362 var txt = "";
4363 if (node.hasChildNodes()) {
4364 var children = node.childNodes, childrenLength = children.length;
4365 for (var i2 = 0; i2 < childrenLength; ++i2) {
4366 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4367 }
4368 }
4369 txt = txt.trim();
4370 return txt;
4371 });
4372 showdown2.subParser("makeMarkdown.pre", function(node, globals) {
4373 "use strict";
4374 var num = node.getAttribute("prenum");
4375 return "<pre>" + globals.preList[num] + "</pre>";
4376 });
4377 showdown2.subParser("makeMarkdown.strikethrough", function(node, globals) {
4378 "use strict";
4379 var txt = "";
4380 if (node.hasChildNodes()) {
4381 txt += "~~";
4382 var children = node.childNodes, childrenLength = children.length;
4383 for (var i2 = 0; i2 < childrenLength; ++i2) {
4384 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4385 }
4386 txt += "~~";
4387 }
4388 return txt;
4389 });
4390 showdown2.subParser("makeMarkdown.strong", function(node, globals) {
4391 "use strict";
4392 var txt = "";
4393 if (node.hasChildNodes()) {
4394 txt += "**";
4395 var children = node.childNodes, childrenLength = children.length;
4396 for (var i2 = 0; i2 < childrenLength; ++i2) {
4397 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4398 }
4399 txt += "**";
4400 }
4401 return txt;
4402 });
4403 showdown2.subParser("makeMarkdown.table", function(node, globals) {
4404 "use strict";
4405 var txt = "", tableArray = [[], []], headings = node.querySelectorAll("thead>tr>th"), rows = node.querySelectorAll("tbody>tr"), i2, ii;
4406 for (i2 = 0; i2 < headings.length; ++i2) {
4407 var headContent = showdown2.subParser("makeMarkdown.tableCell")(headings[i2], globals), allign = "---";
4408 if (headings[i2].hasAttribute("style")) {
4409 var style = headings[i2].getAttribute("style").toLowerCase().replace(/\s/g, "");
4410 switch (style) {
4411 case "text-align:left;":
4412 allign = ":---";
4413 break;
4414 case "text-align:right;":
4415 allign = "---:";
4416 break;
4417 case "text-align:center;":
4418 allign = ":---:";
4419 break;
4420 }
4421 }
4422 tableArray[0][i2] = headContent.trim();
4423 tableArray[1][i2] = allign;
4424 }
4425 for (i2 = 0; i2 < rows.length; ++i2) {
4426 var r2 = tableArray.push([]) - 1, cols = rows[i2].getElementsByTagName("td");
4427 for (ii = 0; ii < headings.length; ++ii) {
4428 var cellContent = " ";
4429 if (typeof cols[ii] !== "undefined") {
4430 cellContent = showdown2.subParser("makeMarkdown.tableCell")(cols[ii], globals);
4431 }
4432 tableArray[r2].push(cellContent);
4433 }
4434 }
4435 var cellSpacesCount = 3;
4436 for (i2 = 0; i2 < tableArray.length; ++i2) {
4437 for (ii = 0; ii < tableArray[i2].length; ++ii) {
4438 var strLen = tableArray[i2][ii].length;
4439 if (strLen > cellSpacesCount) {
4440 cellSpacesCount = strLen;
4441 }
4442 }
4443 }
4444 for (i2 = 0; i2 < tableArray.length; ++i2) {
4445 for (ii = 0; ii < tableArray[i2].length; ++ii) {
4446 if (i2 === 1) {
4447 if (tableArray[i2][ii].slice(-1) === ":") {
4448 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii].slice(-1), cellSpacesCount - 1, "-") + ":";
4449 } else {
4450 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount, "-");
4451 }
4452 } else {
4453 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount);
4454 }
4455 }
4456 txt += "| " + tableArray[i2].join(" | ") + " |\n";
4457 }
4458 return txt.trim();
4459 });
4460 showdown2.subParser("makeMarkdown.tableCell", function(node, globals) {
4461 "use strict";
4462 var txt = "";
4463 if (!node.hasChildNodes()) {
4464 return "";
4465 }
4466 var children = node.childNodes, childrenLength = children.length;
4467 for (var i2 = 0; i2 < childrenLength; ++i2) {
4468 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals, true);
4469 }
4470 return txt.trim();
4471 });
4472 showdown2.subParser("makeMarkdown.txt", function(node) {
4473 "use strict";
4474 var txt = node.nodeValue;
4475 txt = txt.replace(/ +/g, " ");
4476 txt = txt.replace(/¨NBSP;/g, " ");
4477 txt = showdown2.helper.unescapeHTMLEntities(txt);
4478 txt = txt.replace(/([*_~|`])/g, "\\$1");
4479 txt = txt.replace(/^(\s*)>/g, "\\$1>");
4480 txt = txt.replace(/^#/gm, "\\#");
4481 txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3");
4482 txt = txt.replace(/^( {0,3}\d+)\./gm, "$1\\.");
4483 txt = txt.replace(/^( {0,3})([+-])/gm, "$1\\$2");
4484 txt = txt.replace(/]([\s]*)\(/g, "\\]$1\\(");
4485 txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:");
4486 return txt;
4487 });
4488 var root = this;
4489 if (typeof define === "function" && define.amd) {
4490 define(function() {
4491 "use strict";
4492 return showdown2;
4493 });
4494 } else if (typeof module !== "undefined" && module.exports) {
4495 module.exports = showdown2;
4496 } else {
4497 root.showdown = showdown2;
4498 }
4499 }).call(exports);
4500 }
4501 });
4502
4503 // packages/blocks/build-module/index.mjs
4504 var index_exports = {};
4505 __export(index_exports, {
4506 __EXPERIMENTAL_ELEMENTS: () => __EXPERIMENTAL_ELEMENTS,
4507 __EXPERIMENTAL_PATHS_WITH_OVERRIDE: () => __EXPERIMENTAL_PATHS_WITH_OVERRIDE,
4508 __EXPERIMENTAL_STYLE_PROPERTY: () => __EXPERIMENTAL_STYLE_PROPERTY,
4509 __experimentalCloneSanitizedBlock: () => __experimentalCloneSanitizedBlock,
4510 __experimentalGetAccessibleBlockLabel: () => getAccessibleBlockLabel,
4511 __experimentalGetBlockAttributesNamesByRole: () => __experimentalGetBlockAttributesNamesByRole,
4512 __experimentalGetBlockLabel: () => getBlockLabel,
4513 __experimentalSanitizeBlockAttributes: () => __experimentalSanitizeBlockAttributes,
4514 __unstableGetBlockProps: () => getBlockProps,
4515 __unstableGetInnerBlocksProps: () => getInnerBlocksProps,
4516 __unstableSerializeAndClean: () => __unstableSerializeAndClean,
4517 children: () => children_default,
4518 cloneBlock: () => cloneBlock,
4519 createBlock: () => createBlock,
4520 createBlocksFromInnerBlocksTemplate: () => createBlocksFromInnerBlocksTemplate,
4521 doBlocksMatchTemplate: () => doBlocksMatchTemplate,
4522 findTransform: () => findTransform,
4523 getBlockAttributes: () => getBlockAttributes,
4524 getBlockAttributesNamesByRole: () => getBlockAttributesNamesByRole,
4525 getBlockBindingsSource: () => getBlockBindingsSource,
4526 getBlockBindingsSources: () => getBlockBindingsSources,
4527 getBlockContent: () => getBlockInnerHTML,
4528 getBlockDefaultClassName: () => getBlockDefaultClassName,
4529 getBlockFromExample: () => getBlockFromExample,
4530 getBlockMenuDefaultClassName: () => getBlockMenuDefaultClassName,
4531 getBlockSupport: () => getBlockSupport,
4532 getBlockTransforms: () => getBlockTransforms,
4533 getBlockType: () => getBlockType,
4534 getBlockTypes: () => getBlockTypes,
4535 getBlockVariations: () => getBlockVariations,
4536 getCategories: () => getCategories2,
4537 getChildBlockNames: () => getChildBlockNames,
4538 getDefaultBlockName: () => getDefaultBlockName,
4539 getFreeformContentHandlerName: () => getFreeformContentHandlerName,
4540 getGroupingBlockName: () => getGroupingBlockName,
4541 getPhrasingContentSchema: () => deprecatedGetPhrasingContentSchema,
4542 getPossibleBlockTransformations: () => getPossibleBlockTransformations,
4543 getSaveContent: () => getSaveContent,
4544 getSaveElement: () => getSaveElement,
4545 getUnregisteredTypeHandlerName: () => getUnregisteredTypeHandlerName,
4546 hasBlockSupport: () => hasBlockSupport,
4547 hasChildBlocks: () => hasChildBlocks,
4548 hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport,
4549 isReusableBlock: () => isReusableBlock,
4550 isTemplatePart: () => isTemplatePart,
4551 isUnmodifiedBlock: () => isUnmodifiedBlock,
4552 isUnmodifiedDefaultBlock: () => isUnmodifiedDefaultBlock,
4553 isValidBlockContent: () => isValidBlockContent,
4554 isValidIcon: () => isValidIcon,
4555 node: () => node_default,
4556 normalizeIconObject: () => normalizeIconObject,
4557 parse: () => parse2,
4558 parseWithAttributeSchema: () => parseWithAttributeSchema,
4559 pasteHandler: () => pasteHandler,
4560 privateApis: () => privateApis,
4561 rawHandler: () => rawHandler,
4562 registerBlockBindingsSource: () => registerBlockBindingsSource,
4563 registerBlockCollection: () => registerBlockCollection,
4564 registerBlockStyle: () => registerBlockStyle,
4565 registerBlockType: () => registerBlockType,
4566 registerBlockVariation: () => registerBlockVariation,
4567 serialize: () => serialize,
4568 serializeRawBlock: () => serializeRawBlock,
4569 setCategories: () => setCategories2,
4570 setDefaultBlockName: () => setDefaultBlockName,
4571 setFreeformContentHandlerName: () => setFreeformContentHandlerName,
4572 setGroupingBlockName: () => setGroupingBlockName,
4573 setUnregisteredTypeHandlerName: () => setUnregisteredTypeHandlerName,
4574 store: () => store,
4575 switchToBlockType: () => switchToBlockType,
4576 synchronizeBlocksWithTemplate: () => synchronizeBlocksWithTemplate,
4577 unregisterBlockBindingsSource: () => unregisterBlockBindingsSource,
4578 unregisterBlockStyle: () => unregisterBlockStyle,
4579 unregisterBlockType: () => unregisterBlockType,
4580 unregisterBlockVariation: () => unregisterBlockVariation,
4581 unstable__bootstrapServerSideBlockDefinitions: () => unstable__bootstrapServerSideBlockDefinitions,
4582 updateCategory: () => updateCategory2,
4583 validateBlock: () => validateBlock,
4584 withBlockContentContext: () => withBlockContentContext
4585 });
4586
4587 // packages/blocks/build-module/store/index.mjs
4588 var import_data5 = __toESM(require_data(), 1);
4589
4590 // node_modules/tslib/tslib.es6.mjs
4591 var __assign = function() {
4592 __assign = Object.assign || function __assign2(t3) {
4593 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
4594 s2 = arguments[i2];
4595 for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t3[p2] = s2[p2];
4596 }
4597 return t3;
4598 };
4599 return __assign.apply(this, arguments);
4600 };
4601
4602 // node_modules/lower-case/dist.es2015/index.js
4603 function lowerCase(str) {
4604 return str.toLowerCase();
4605 }
4606
4607 // node_modules/no-case/dist.es2015/index.js
4608 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
4609 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
4610 function noCase(input, options) {
4611 if (options === void 0) {
4612 options = {};
4613 }
4614 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
4615 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
4616 var start = 0;
4617 var end = result.length;
4618 while (result.charAt(start) === "\0")
4619 start++;
4620 while (result.charAt(end - 1) === "\0")
4621 end--;
4622 return result.slice(start, end).split("\0").map(transform).join(delimiter);
4623 }
4624 function replace(input, re, value) {
4625 if (re instanceof RegExp)
4626 return input.replace(re, value);
4627 return re.reduce(function(input2, re2) {
4628 return input2.replace(re2, value);
4629 }, input);
4630 }
4631
4632 // node_modules/pascal-case/dist.es2015/index.js
4633 function pascalCaseTransform(input, index) {
4634 var firstChar = input.charAt(0);
4635 var lowerChars = input.substr(1).toLowerCase();
4636 if (index > 0 && firstChar >= "0" && firstChar <= "9") {
4637 return "_" + firstChar + lowerChars;
4638 }
4639 return "" + firstChar.toUpperCase() + lowerChars;
4640 }
4641 function pascalCase(input, options) {
4642 if (options === void 0) {
4643 options = {};
4644 }
4645 return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
4646 }
4647
4648 // node_modules/camel-case/dist.es2015/index.js
4649 function camelCaseTransform(input, index) {
4650 if (index === 0)
4651 return input.toLowerCase();
4652 return pascalCaseTransform(input, index);
4653 }
4654 function camelCase(input, options) {
4655 if (options === void 0) {
4656 options = {};
4657 }
4658 return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
4659 }
4660
4661 // packages/blocks/build-module/store/reducer.mjs
4662 var import_data2 = __toESM(require_data(), 1);
4663 var import_i18n3 = __toESM(require_i18n(), 1);
4664
4665 // node_modules/colord/index.mjs
4666 var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
4667 var t = function(r2) {
4668 return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2;
4669 };
4670 var n = function(r2, t3, n2) {
4671 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = Math.pow(10, t3)), Math.round(n2 * r2) / n2 + 0;
4672 };
4673 var e = function(r2, t3, n2) {
4674 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t3 ? r2 : t3;
4675 };
4676 var u = function(r2) {
4677 return (r2 = isFinite(r2) ? r2 % 360 : 0) > 0 ? r2 : r2 + 360;
4678 };
4679 var a = function(r2) {
4680 return { r: e(r2.r, 0, 255), g: e(r2.g, 0, 255), b: e(r2.b, 0, 255), a: e(r2.a) };
4681 };
4682 var o = function(r2) {
4683 return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) };
4684 };
4685 var i = /^#([0-9a-f]{3,8})$/i;
4686 var s = function(r2) {
4687 var t3 = r2.toString(16);
4688 return t3.length < 2 ? "0" + t3 : t3;
4689 };
4690 var h = function(r2) {
4691 var t3 = r2.r, n2 = r2.g, e2 = r2.b, u2 = r2.a, a2 = Math.max(t3, n2, e2), o3 = a2 - Math.min(t3, n2, e2), i2 = o3 ? a2 === t3 ? (n2 - e2) / o3 : a2 === n2 ? 2 + (e2 - t3) / o3 : 4 + (t3 - n2) / o3 : 0;
4692 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o3 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
4693 };
4694 var b = function(r2) {
4695 var t3 = r2.h, n2 = r2.s, e2 = r2.v, u2 = r2.a;
4696 t3 = t3 / 360 * 6, n2 /= 100, e2 /= 100;
4697 var a2 = Math.floor(t3), o3 = e2 * (1 - n2), i2 = e2 * (1 - (t3 - a2) * n2), s2 = e2 * (1 - (1 - t3 + a2) * n2), h2 = a2 % 6;
4698 return { r: 255 * [e2, i2, o3, o3, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o3, o3][h2], b: 255 * [o3, o3, s2, e2, e2, i2][h2], a: u2 };
4699 };
4700 var g = function(r2) {
4701 return { h: u(r2.h), s: e(r2.s, 0, 100), l: e(r2.l, 0, 100), a: e(r2.a) };
4702 };
4703 var d = function(r2) {
4704 return { h: n(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
4705 };
4706 var f = function(r2) {
4707 return b((n2 = (t3 = r2).s, { h: t3.h, s: (n2 *= ((e2 = t3.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t3.a }));
4708 var t3, n2, e2;
4709 };
4710 var c = function(r2) {
4711 return { h: (t3 = h(r2)).h, s: (u2 = (200 - (n2 = t3.s)) * (e2 = t3.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t3.a };
4712 var t3, n2, e2, u2;
4713 };
4714 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4715 var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4716 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4717 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4718 var y = { string: [[function(r2) {
4719 var t3 = i.exec(r2);
4720 return t3 ? (r2 = t3[1]).length <= 4 ? { r: parseInt(r2[0] + r2[0], 16), g: parseInt(r2[1] + r2[1], 16), b: parseInt(r2[2] + r2[2], 16), a: 4 === r2.length ? n(parseInt(r2[3] + r2[3], 16) / 255, 2) : 1 } : 6 === r2.length || 8 === r2.length ? { r: parseInt(r2.substr(0, 2), 16), g: parseInt(r2.substr(2, 2), 16), b: parseInt(r2.substr(4, 2), 16), a: 8 === r2.length ? n(parseInt(r2.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
4721 }, "hex"], [function(r2) {
4722 var t3 = v.exec(r2) || m.exec(r2);
4723 return t3 ? t3[2] !== t3[4] || t3[4] !== t3[6] ? null : a({ r: Number(t3[1]) / (t3[2] ? 100 / 255 : 1), g: Number(t3[3]) / (t3[4] ? 100 / 255 : 1), b: Number(t3[5]) / (t3[6] ? 100 / 255 : 1), a: void 0 === t3[7] ? 1 : Number(t3[7]) / (t3[8] ? 100 : 1) }) : null;
4724 }, "rgb"], [function(t3) {
4725 var n2 = l.exec(t3) || p.exec(t3);
4726 if (!n2) return null;
4727 var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) });
4728 return f(a2);
4729 }, "hsl"]], object: [[function(r2) {
4730 var n2 = r2.r, e2 = r2.g, u2 = r2.b, o3 = r2.a, i2 = void 0 === o3 ? 1 : o3;
4731 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
4732 }, "rgb"], [function(r2) {
4733 var n2 = r2.h, e2 = r2.s, u2 = r2.l, a2 = r2.a, o3 = void 0 === a2 ? 1 : a2;
4734 if (!t(n2) || !t(e2) || !t(u2)) return null;
4735 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o3) });
4736 return f(i2);
4737 }, "hsl"], [function(r2) {
4738 var n2 = r2.h, a2 = r2.s, o3 = r2.v, i2 = r2.a, s2 = void 0 === i2 ? 1 : i2;
4739 if (!t(n2) || !t(a2) || !t(o3)) return null;
4740 var h2 = (function(r3) {
4741 return { h: u(r3.h), s: e(r3.s, 0, 100), v: e(r3.v, 0, 100), a: e(r3.a) };
4742 })({ h: Number(n2), s: Number(a2), v: Number(o3), a: Number(s2) });
4743 return b(h2);
4744 }, "hsv"]] };
4745 var N = function(r2, t3) {
4746 for (var n2 = 0; n2 < t3.length; n2++) {
4747 var e2 = t3[n2][0](r2);
4748 if (e2) return [e2, t3[n2][1]];
4749 }
4750 return [null, void 0];
4751 };
4752 var x = function(r2) {
4753 return "string" == typeof r2 ? N(r2.trim(), y.string) : "object" == typeof r2 && null !== r2 ? N(r2, y.object) : [null, void 0];
4754 };
4755 var M = function(r2, t3) {
4756 var n2 = c(r2);
4757 return { h: n2.h, s: e(n2.s + 100 * t3, 0, 100), l: n2.l, a: n2.a };
4758 };
4759 var H = function(r2) {
4760 return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
4761 };
4762 var $ = function(r2, t3) {
4763 var n2 = c(r2);
4764 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t3, 0, 100), a: n2.a };
4765 };
4766 var j = (function() {
4767 function r2(r3) {
4768 this.parsed = x(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
4769 }
4770 return r2.prototype.isValid = function() {
4771 return null !== this.parsed;
4772 }, r2.prototype.brightness = function() {
4773 return n(H(this.rgba), 2);
4774 }, r2.prototype.isDark = function() {
4775 return H(this.rgba) < 0.5;
4776 }, r2.prototype.isLight = function() {
4777 return H(this.rgba) >= 0.5;
4778 }, r2.prototype.toHex = function() {
4779 return r3 = o(this.rgba), t3 = r3.r, e2 = r3.g, u2 = r3.b, i2 = (a2 = r3.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t3) + s(e2) + s(u2) + i2;
4780 var r3, t3, e2, u2, a2, i2;
4781 }, r2.prototype.toRgb = function() {
4782 return o(this.rgba);
4783 }, r2.prototype.toRgbString = function() {
4784 return r3 = o(this.rgba), t3 = r3.r, n2 = r3.g, e2 = r3.b, (u2 = r3.a) < 1 ? "rgba(" + t3 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t3 + ", " + n2 + ", " + e2 + ")";
4785 var r3, t3, n2, e2, u2;
4786 }, r2.prototype.toHsl = function() {
4787 return d(c(this.rgba));
4788 }, r2.prototype.toHslString = function() {
4789 return r3 = d(c(this.rgba)), t3 = r3.h, n2 = r3.s, e2 = r3.l, (u2 = r3.a) < 1 ? "hsla(" + t3 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t3 + ", " + n2 + "%, " + e2 + "%)";
4790 var r3, t3, n2, e2, u2;
4791 }, r2.prototype.toHsv = function() {
4792 return r3 = h(this.rgba), { h: n(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
4793 var r3;
4794 }, r2.prototype.invert = function() {
4795 return w({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
4796 var r3;
4797 }, r2.prototype.saturate = function(r3) {
4798 return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, r3));
4799 }, r2.prototype.desaturate = function(r3) {
4800 return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, -r3));
4801 }, r2.prototype.grayscale = function() {
4802 return w(M(this.rgba, -1));
4803 }, r2.prototype.lighten = function(r3) {
4804 return void 0 === r3 && (r3 = 0.1), w($(this.rgba, r3));
4805 }, r2.prototype.darken = function(r3) {
4806 return void 0 === r3 && (r3 = 0.1), w($(this.rgba, -r3));
4807 }, r2.prototype.rotate = function(r3) {
4808 return void 0 === r3 && (r3 = 15), this.hue(this.hue() + r3);
4809 }, r2.prototype.alpha = function(r3) {
4810 return "number" == typeof r3 ? w({ r: (t3 = this.rgba).r, g: t3.g, b: t3.b, a: r3 }) : n(this.rgba.a, 3);
4811 var t3;
4812 }, r2.prototype.hue = function(r3) {
4813 var t3 = c(this.rgba);
4814 return "number" == typeof r3 ? w({ h: r3, s: t3.s, l: t3.l, a: t3.a }) : n(t3.h);
4815 }, r2.prototype.isEqual = function(r3) {
4816 return this.toHex() === w(r3).toHex();
4817 }, r2;
4818 })();
4819 var w = function(r2) {
4820 return r2 instanceof j ? r2 : new j(r2);
4821 };
4822 var S = [];
4823 var k = function(r2) {
4824 r2.forEach(function(r3) {
4825 S.indexOf(r3) < 0 && (r3(j, y), S.push(r3));
4826 });
4827 };
4828
4829 // node_modules/colord/plugins/names.mjs
4830 function names_default(e2, f2) {
4831 var a2 = { white: "#ffffff", bisque: "#ffe4c4", blue: "#0000ff", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", antiquewhite: "#faebd7", aqua: "#00ffff", azure: "#f0ffff", whitesmoke: "#f5f5f5", papayawhip: "#ffefd5", plum: "#dda0dd", blanchedalmond: "#ffebcd", black: "#000000", gold: "#ffd700", goldenrod: "#daa520", gainsboro: "#dcdcdc", cornsilk: "#fff8dc", cornflowerblue: "#6495ed", burlywood: "#deb887", aquamarine: "#7fffd4", beige: "#f5f5dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkkhaki: "#bdb76b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", peachpuff: "#ffdab9", darkmagenta: "#8b008b", darkred: "#8b0000", darkorchid: "#9932cc", darkorange: "#ff8c00", darkslateblue: "#483d8b", gray: "#808080", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", deeppink: "#ff1493", deepskyblue: "#00bfff", wheat: "#f5deb3", firebrick: "#b22222", floralwhite: "#fffaf0", ghostwhite: "#f8f8ff", darkviolet: "#9400d3", magenta: "#ff00ff", green: "#008000", dodgerblue: "#1e90ff", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", blueviolet: "#8a2be2", forestgreen: "#228b22", lawngreen: "#7cfc00", indianred: "#cd5c5c", indigo: "#4b0082", fuchsia: "#ff00ff", brown: "#a52a2a", maroon: "#800000", mediumblue: "#0000cd", lightcoral: "#f08080", darkturquoise: "#00ced1", lightcyan: "#e0ffff", ivory: "#fffff0", lightyellow: "#ffffe0", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", linen: "#faf0e6", mediumaquamarine: "#66cdaa", lemonchiffon: "#fffacd", lime: "#00ff00", khaki: "#f0e68c", mediumseagreen: "#3cb371", limegreen: "#32cd32", mediumspringgreen: "#00fa9a", lightskyblue: "#87cefa", lightblue: "#add8e6", midnightblue: "#191970", lightpink: "#ffb6c1", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", mintcream: "#f5fffa", lightslategray: "#778899", lightslategrey: "#778899", navajowhite: "#ffdead", navy: "#000080", mediumvioletred: "#c71585", powderblue: "#b0e0e6", palegoldenrod: "#eee8aa", oldlace: "#fdf5e6", paleturquoise: "#afeeee", mediumturquoise: "#48d1cc", mediumorchid: "#ba55d3", rebeccapurple: "#663399", lightsteelblue: "#b0c4de", mediumslateblue: "#7b68ee", thistle: "#d8bfd8", tan: "#d2b48c", orchid: "#da70d6", mediumpurple: "#9370db", purple: "#800080", pink: "#ffc0cb", skyblue: "#87ceeb", springgreen: "#00ff7f", palegreen: "#98fb98", red: "#ff0000", yellow: "#ffff00", slateblue: "#6a5acd", lavenderblush: "#fff0f5", peru: "#cd853f", palevioletred: "#db7093", violet: "#ee82ee", teal: "#008080", slategray: "#708090", slategrey: "#708090", aliceblue: "#f0f8ff", darkseagreen: "#8fbc8f", darkolivegreen: "#556b2f", greenyellow: "#adff2f", seagreen: "#2e8b57", seashell: "#fff5ee", tomato: "#ff6347", silver: "#c0c0c0", sienna: "#a0522d", lavender: "#e6e6fa", lightgreen: "#90ee90", orange: "#ffa500", orangered: "#ff4500", steelblue: "#4682b4", royalblue: "#4169e1", turquoise: "#40e0d0", yellowgreen: "#9acd32", salmon: "#fa8072", saddlebrown: "#8b4513", sandybrown: "#f4a460", rosybrown: "#bc8f8f", darksalmon: "#e9967a", lightgoldenrodyellow: "#fafad2", snow: "#fffafa", lightgrey: "#d3d3d3", lightgray: "#d3d3d3", dimgray: "#696969", dimgrey: "#696969", olivedrab: "#6b8e23", olive: "#808000" }, r2 = {};
4832 for (var d2 in a2) r2[a2[d2]] = d2;
4833 var l2 = {};
4834 e2.prototype.toName = function(f3) {
4835 if (!(this.rgba.a || this.rgba.r || this.rgba.g || this.rgba.b)) return "transparent";
4836 var d3, i2, n2 = r2[this.toHex()];
4837 if (n2) return n2;
4838 if (null == f3 ? void 0 : f3.closest) {
4839 var o3 = this.toRgb(), t3 = 1 / 0, b2 = "black";
4840 if (!l2.length) for (var c2 in a2) l2[c2] = new e2(a2[c2]).toRgb();
4841 for (var g2 in a2) {
4842 var u2 = (d3 = o3, i2 = l2[g2], Math.pow(d3.r - i2.r, 2) + Math.pow(d3.g - i2.g, 2) + Math.pow(d3.b - i2.b, 2));
4843 u2 < t3 && (t3 = u2, b2 = g2);
4844 }
4845 return b2;
4846 }
4847 };
4848 f2.string.push([function(f3) {
4849 var r3 = f3.toLowerCase(), d3 = "transparent" === r3 ? "#0000" : a2[r3];
4850 return d3 ? new e2(d3).toRgb() : null;
4851 }, "name"]);
4852 }
4853
4854 // node_modules/colord/plugins/a11y.mjs
4855 var o2 = function(o3) {
4856 var t3 = o3 / 255;
4857 return t3 < 0.04045 ? t3 / 12.92 : Math.pow((t3 + 0.055) / 1.055, 2.4);
4858 };
4859 var t2 = function(t3) {
4860 return 0.2126 * o2(t3.r) + 0.7152 * o2(t3.g) + 0.0722 * o2(t3.b);
4861 };
4862 function a11y_default(o3) {
4863 o3.prototype.luminance = function() {
4864 return o4 = t2(this.rgba), void 0 === (r2 = 2) && (r2 = 0), void 0 === n2 && (n2 = Math.pow(10, r2)), Math.round(n2 * o4) / n2 + 0;
4865 var o4, r2, n2;
4866 }, o3.prototype.contrast = function(r2) {
4867 void 0 === r2 && (r2 = "#FFF");
4868 var n2, a2, i2, e2, v2, u2, d2, c2 = r2 instanceof o3 ? r2 : new o3(r2);
4869 return e2 = this.rgba, v2 = c2.toRgb(), u2 = t2(e2), d2 = t2(v2), n2 = u2 > d2 ? (u2 + 0.05) / (d2 + 0.05) : (d2 + 0.05) / (u2 + 0.05), void 0 === (a2 = 2) && (a2 = 0), void 0 === i2 && (i2 = Math.pow(10, a2)), Math.floor(i2 * n2) / i2 + 0;
4870 }, o3.prototype.isReadable = function(o4, t3) {
4871 return void 0 === o4 && (o4 = "#FFF"), void 0 === t3 && (t3 = {}), this.contrast(o4) >= (e2 = void 0 === (i2 = (r2 = t3).size) ? "normal" : i2, "AAA" === (a2 = void 0 === (n2 = r2.level) ? "AA" : n2) && "normal" === e2 ? 7 : "AA" === a2 && "large" === e2 ? 3 : 4.5);
4872 var r2, n2, a2, i2, e2;
4873 };
4874 }
4875
4876 // packages/blocks/build-module/api/utils.mjs
4877 var import_element = __toESM(require_element(), 1);
4878 var import_i18n2 = __toESM(require_i18n(), 1);
4879 var import_dom = __toESM(require_dom(), 1);
4880 var import_rich_text = __toESM(require_rich_text(), 1);
4881 var import_deprecated = __toESM(require_deprecated(), 1);
4882
4883 // packages/blocks/build-module/api/constants.mjs
4884 var BLOCK_ICON_DEFAULT = "block-default";
4885 var DEPRECATED_ENTRY_KEYS = [
4886 "attributes",
4887 "supports",
4888 "save",
4889 "migrate",
4890 "isEligible",
4891 "apiVersion"
4892 ];
4893 var __EXPERIMENTAL_STYLE_PROPERTY = {
4894 // Kept for back-compatibility purposes.
4895 "--wp--style--color--link": {
4896 value: ["color", "link"],
4897 support: ["color", "link"]
4898 },
4899 aspectRatio: {
4900 value: ["dimensions", "aspectRatio"],
4901 support: ["dimensions", "aspectRatio"],
4902 useEngine: true
4903 },
4904 background: {
4905 value: ["color", "gradient"],
4906 support: ["color", "gradients"],
4907 useEngine: true
4908 },
4909 backgroundColor: {
4910 value: ["color", "background"],
4911 support: ["color", "background"],
4912 requiresOptOut: true,
4913 useEngine: true
4914 },
4915 backgroundImage: {
4916 value: ["background", "backgroundImage"],
4917 support: ["background", "backgroundImage"],
4918 useEngine: true
4919 },
4920 backgroundRepeat: {
4921 value: ["background", "backgroundRepeat"],
4922 support: ["background", "backgroundRepeat"],
4923 useEngine: true
4924 },
4925 backgroundSize: {
4926 value: ["background", "backgroundSize"],
4927 support: ["background", "backgroundSize"],
4928 useEngine: true
4929 },
4930 backgroundPosition: {
4931 value: ["background", "backgroundPosition"],
4932 support: ["background", "backgroundPosition"],
4933 useEngine: true
4934 },
4935 backgroundGradient: {
4936 value: ["background", "gradient"],
4937 support: ["background", "gradient"],
4938 useEngine: true
4939 },
4940 borderColor: {
4941 value: ["border", "color"],
4942 support: ["__experimentalBorder", "color"],
4943 useEngine: true
4944 },
4945 borderRadius: {
4946 value: ["border", "radius"],
4947 support: ["__experimentalBorder", "radius"],
4948 properties: {
4949 borderTopLeftRadius: "topLeft",
4950 borderTopRightRadius: "topRight",
4951 borderBottomLeftRadius: "bottomLeft",
4952 borderBottomRightRadius: "bottomRight"
4953 },
4954 useEngine: true
4955 },
4956 borderStyle: {
4957 value: ["border", "style"],
4958 support: ["__experimentalBorder", "style"],
4959 useEngine: true
4960 },
4961 borderWidth: {
4962 value: ["border", "width"],
4963 support: ["__experimentalBorder", "width"],
4964 useEngine: true
4965 },
4966 borderTopColor: {
4967 value: ["border", "top", "color"],
4968 support: ["__experimentalBorder", "color"],
4969 useEngine: true
4970 },
4971 borderTopStyle: {
4972 value: ["border", "top", "style"],
4973 support: ["__experimentalBorder", "style"],
4974 useEngine: true
4975 },
4976 borderTopWidth: {
4977 value: ["border", "top", "width"],
4978 support: ["__experimentalBorder", "width"],
4979 useEngine: true
4980 },
4981 borderRightColor: {
4982 value: ["border", "right", "color"],
4983 support: ["__experimentalBorder", "color"],
4984 useEngine: true
4985 },
4986 borderRightStyle: {
4987 value: ["border", "right", "style"],
4988 support: ["__experimentalBorder", "style"],
4989 useEngine: true
4990 },
4991 borderRightWidth: {
4992 value: ["border", "right", "width"],
4993 support: ["__experimentalBorder", "width"],
4994 useEngine: true
4995 },
4996 borderBottomColor: {
4997 value: ["border", "bottom", "color"],
4998 support: ["__experimentalBorder", "color"],
4999 useEngine: true
5000 },
5001 borderBottomStyle: {
5002 value: ["border", "bottom", "style"],
5003 support: ["__experimentalBorder", "style"],
5004 useEngine: true
5005 },
5006 borderBottomWidth: {
5007 value: ["border", "bottom", "width"],
5008 support: ["__experimentalBorder", "width"],
5009 useEngine: true
5010 },
5011 borderLeftColor: {
5012 value: ["border", "left", "color"],
5013 support: ["__experimentalBorder", "color"],
5014 useEngine: true
5015 },
5016 borderLeftStyle: {
5017 value: ["border", "left", "style"],
5018 support: ["__experimentalBorder", "style"],
5019 useEngine: true
5020 },
5021 borderLeftWidth: {
5022 value: ["border", "left", "width"],
5023 support: ["__experimentalBorder", "width"],
5024 useEngine: true
5025 },
5026 color: {
5027 value: ["color", "text"],
5028 support: ["color", "text"],
5029 requiresOptOut: true,
5030 useEngine: true
5031 },
5032 columnCount: {
5033 value: ["typography", "textColumns"],
5034 support: ["typography", "textColumns"],
5035 useEngine: true
5036 },
5037 filter: {
5038 value: ["filter", "duotone"],
5039 support: ["filter", "duotone"]
5040 },
5041 linkColor: {
5042 value: ["elements", "link", "color", "text"],
5043 support: ["color", "link"]
5044 },
5045 captionColor: {
5046 value: ["elements", "caption", "color", "text"],
5047 support: ["color", "caption"]
5048 },
5049 buttonColor: {
5050 value: ["elements", "button", "color", "text"],
5051 support: ["color", "button"]
5052 },
5053 buttonBackgroundColor: {
5054 value: ["elements", "button", "color", "background"],
5055 support: ["color", "button"]
5056 },
5057 headingColor: {
5058 value: ["elements", "heading", "color", "text"],
5059 support: ["color", "heading"]
5060 },
5061 headingBackgroundColor: {
5062 value: ["elements", "heading", "color", "background"],
5063 support: ["color", "heading"]
5064 },
5065 fontFamily: {
5066 value: ["typography", "fontFamily"],
5067 support: ["typography", "__experimentalFontFamily"],
5068 useEngine: true
5069 },
5070 fontSize: {
5071 value: ["typography", "fontSize"],
5072 support: ["typography", "fontSize"],
5073 useEngine: true
5074 },
5075 fontStyle: {
5076 value: ["typography", "fontStyle"],
5077 support: ["typography", "__experimentalFontStyle"],
5078 useEngine: true
5079 },
5080 fontWeight: {
5081 value: ["typography", "fontWeight"],
5082 support: ["typography", "__experimentalFontWeight"],
5083 useEngine: true
5084 },
5085 lineHeight: {
5086 value: ["typography", "lineHeight"],
5087 support: ["typography", "lineHeight"],
5088 useEngine: true
5089 },
5090 margin: {
5091 value: ["spacing", "margin"],
5092 support: ["spacing", "margin"],
5093 properties: {
5094 marginTop: "top",
5095 marginRight: "right",
5096 marginBottom: "bottom",
5097 marginLeft: "left"
5098 },
5099 useEngine: true
5100 },
5101 minHeight: {
5102 value: ["dimensions", "minHeight"],
5103 support: ["dimensions", "minHeight"],
5104 useEngine: true
5105 },
5106 minWidth: {
5107 value: ["dimensions", "minWidth"],
5108 support: ["dimensions", "minWidth"],
5109 useEngine: true
5110 },
5111 height: {
5112 value: ["dimensions", "height"],
5113 support: ["dimensions", "height"],
5114 useEngine: true
5115 },
5116 width: {
5117 value: ["dimensions", "width"],
5118 support: ["dimensions", "width"],
5119 useEngine: true
5120 },
5121 padding: {
5122 value: ["spacing", "padding"],
5123 support: ["spacing", "padding"],
5124 properties: {
5125 paddingTop: "top",
5126 paddingRight: "right",
5127 paddingBottom: "bottom",
5128 paddingLeft: "left"
5129 },
5130 useEngine: true
5131 },
5132 textAlign: {
5133 value: ["typography", "textAlign"],
5134 support: ["typography", "textAlign"],
5135 useEngine: false
5136 },
5137 textDecoration: {
5138 value: ["typography", "textDecoration"],
5139 support: ["typography", "__experimentalTextDecoration"],
5140 useEngine: true
5141 },
5142 textTransform: {
5143 value: ["typography", "textTransform"],
5144 support: ["typography", "__experimentalTextTransform"],
5145 useEngine: true
5146 },
5147 letterSpacing: {
5148 value: ["typography", "letterSpacing"],
5149 support: ["typography", "__experimentalLetterSpacing"],
5150 useEngine: true
5151 },
5152 textIndent: {
5153 value: ["typography", "textIndent"],
5154 support: ["typography", "textIndent"],
5155 useEngine: true
5156 },
5157 writingMode: {
5158 value: ["typography", "writingMode"],
5159 support: ["typography", "__experimentalWritingMode"],
5160 useEngine: true
5161 },
5162 "--wp--style--root--padding": {
5163 value: ["spacing", "padding"],
5164 support: ["spacing", "padding"],
5165 properties: {
5166 "--wp--style--root--padding-top": "top",
5167 "--wp--style--root--padding-right": "right",
5168 "--wp--style--root--padding-bottom": "bottom",
5169 "--wp--style--root--padding-left": "left"
5170 },
5171 rootOnly: true
5172 }
5173 };
5174 var __EXPERIMENTAL_ELEMENTS = {
5175 link: "a:where(:not(.wp-element-button))",
5176 heading: "h1, h2, h3, h4, h5, h6",
5177 h1: "h1",
5178 h2: "h2",
5179 h3: "h3",
5180 h4: "h4",
5181 h5: "h5",
5182 h6: "h6",
5183 button: ".wp-element-button, .wp-block-button__link",
5184 caption: ".wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption",
5185 cite: "cite",
5186 select: "select",
5187 textInput: "textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=url])"
5188 };
5189 var __EXPERIMENTAL_PATHS_WITH_OVERRIDE = {
5190 "color.duotone": true,
5191 "color.gradients": true,
5192 "color.palette": true,
5193 "dimensions.aspectRatios": true,
5194 "typography.fontSizes": true,
5195 "spacing.spacingSizes": true
5196 };
5197
5198 // packages/blocks/build-module/api/registration.mjs
5199 var import_data = __toESM(require_data(), 1);
5200 var import_i18n = __toESM(require_i18n(), 1);
5201 var import_warning = __toESM(require_warning(), 1);
5202
5203 // packages/blocks/build-module/api/i18n-block.json
5204 var i18n_block_default = {
5205 title: "block title",
5206 description: "block description",
5207 keywords: ["block keyword"],
5208 styles: [
5209 {
5210 label: "block style label"
5211 }
5212 ],
5213 variations: [
5214 {
5215 title: "block variation title",
5216 description: "block variation description",
5217 keywords: ["block variation keyword"]
5218 }
5219 ]
5220 };
5221
5222 // packages/blocks/build-module/lock-unlock.mjs
5223 var import_private_apis = __toESM(require_private_apis(), 1);
5224 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
5225 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
5226 "@wordpress/blocks"
5227 );
5228
5229 // packages/blocks/build-module/api/registration.mjs
5230 function isObject(object) {
5231 return object !== null && typeof object === "object";
5232 }
5233 function unstable__bootstrapServerSideBlockDefinitions(definitions) {
5234 const { addBootstrappedBlockType: addBootstrappedBlockType2 } = unlock((0, import_data.dispatch)(store));
5235 for (const [name, blockType] of Object.entries(definitions)) {
5236 addBootstrappedBlockType2(name, blockType);
5237 }
5238 }
5239 function getBlockSettingsFromMetadata({
5240 textdomain,
5241 ...metadata
5242 }) {
5243 const allowedFields = [
5244 "apiVersion",
5245 "title",
5246 "category",
5247 "parent",
5248 "ancestor",
5249 "icon",
5250 "description",
5251 "keywords",
5252 "attributes",
5253 "providesContext",
5254 "usesContext",
5255 "selectors",
5256 "supports",
5257 "styles",
5258 "example",
5259 "variations",
5260 "blockHooks",
5261 "allowedBlocks"
5262 ];
5263 const settings = Object.fromEntries(
5264 Object.entries(metadata).filter(
5265 ([key]) => allowedFields.includes(key)
5266 )
5267 );
5268 if (textdomain) {
5269 Object.keys(i18n_block_default).forEach((key) => {
5270 if (!settings[key]) {
5271 return;
5272 }
5273 settings[key] = translateBlockSettingUsingI18nSchema(
5274 i18n_block_default[key],
5275 settings[key],
5276 textdomain
5277 );
5278 });
5279 }
5280 return settings;
5281 }
5282 function registerBlockType(blockNameOrMetadata, settings) {
5283 const name = isObject(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata;
5284 if (typeof name !== "string") {
5285 (0, import_warning.default)("Block names must be strings.");
5286 return;
5287 }
5288 if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) {
5289 (0, import_warning.default)(
5290 "Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block"
5291 );
5292 return;
5293 }
5294 if ((0, import_data.select)(store).getBlockType(name)) {
5295 (0, import_warning.default)('Block "' + name + '" is already registered.');
5296 return;
5297 }
5298 const { addBootstrappedBlockType: addBootstrappedBlockType2, addUnprocessedBlockType: addUnprocessedBlockType2 } = unlock(
5299 (0, import_data.dispatch)(store)
5300 );
5301 if (isObject(blockNameOrMetadata)) {
5302 const metadata = getBlockSettingsFromMetadata(blockNameOrMetadata);
5303 addBootstrappedBlockType2(name, metadata);
5304 }
5305 addUnprocessedBlockType2(name, settings);
5306 return (0, import_data.select)(store).getBlockType(name);
5307 }
5308 function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) {
5309 if (typeof i18nSchema === "string" && typeof settingValue === "string") {
5310 return (0, import_i18n._x)(settingValue, i18nSchema, textdomain);
5311 }
5312 if (Array.isArray(i18nSchema) && i18nSchema.length && Array.isArray(settingValue)) {
5313 return settingValue.map(
5314 (value) => translateBlockSettingUsingI18nSchema(
5315 i18nSchema[0],
5316 value,
5317 textdomain
5318 )
5319 );
5320 }
5321 if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) {
5322 return Object.keys(settingValue).reduce(
5323 (accumulator, key) => {
5324 if (!i18nSchema[key]) {
5325 accumulator[key] = settingValue[key];
5326 return accumulator;
5327 }
5328 accumulator[key] = translateBlockSettingUsingI18nSchema(
5329 i18nSchema[key],
5330 settingValue[key],
5331 textdomain
5332 );
5333 return accumulator;
5334 },
5335 {}
5336 );
5337 }
5338 return settingValue;
5339 }
5340 function registerBlockCollection(namespace, { title, icon }) {
5341 (0, import_data.dispatch)(store).addBlockCollection(namespace, title, icon);
5342 }
5343 function unregisterBlockType(name) {
5344 const oldBlock = (0, import_data.select)(store).getBlockType(name);
5345 if (!oldBlock) {
5346 (0, import_warning.default)('Block "' + name + '" is not registered.');
5347 return;
5348 }
5349 (0, import_data.dispatch)(store).removeBlockTypes(name);
5350 return oldBlock;
5351 }
5352 function setFreeformContentHandlerName(blockName) {
5353 (0, import_data.dispatch)(store).setFreeformFallbackBlockName(blockName);
5354 }
5355 function getFreeformContentHandlerName() {
5356 return (0, import_data.select)(store).getFreeformFallbackBlockName();
5357 }
5358 function getGroupingBlockName() {
5359 return (0, import_data.select)(store).getGroupingBlockName();
5360 }
5361 function setUnregisteredTypeHandlerName(blockName) {
5362 (0, import_data.dispatch)(store).setUnregisteredFallbackBlockName(blockName);
5363 }
5364 function getUnregisteredTypeHandlerName() {
5365 return (0, import_data.select)(store).getUnregisteredFallbackBlockName();
5366 }
5367 function setDefaultBlockName(name) {
5368 (0, import_data.dispatch)(store).setDefaultBlockName(name);
5369 }
5370 function setGroupingBlockName(name) {
5371 (0, import_data.dispatch)(store).setGroupingBlockName(name);
5372 }
5373 function getDefaultBlockName() {
5374 return (0, import_data.select)(store).getDefaultBlockName();
5375 }
5376 function getBlockType(name) {
5377 return (0, import_data.select)(store)?.getBlockType(name);
5378 }
5379 function getBlockTypes() {
5380 return (0, import_data.select)(store).getBlockTypes();
5381 }
5382 function getBlockSupport(nameOrType, feature, defaultSupports) {
5383 return (0, import_data.select)(store).getBlockSupport(
5384 nameOrType,
5385 feature,
5386 defaultSupports
5387 );
5388 }
5389 function hasBlockSupport(nameOrType, feature, defaultSupports) {
5390 return (0, import_data.select)(store).hasBlockSupport(
5391 nameOrType,
5392 feature,
5393 defaultSupports
5394 );
5395 }
5396 function isReusableBlock(blockOrType) {
5397 return blockOrType?.name === "core/block";
5398 }
5399 function isTemplatePart(blockOrType) {
5400 return blockOrType?.name === "core/template-part";
5401 }
5402 var getChildBlockNames = (blockName) => {
5403 return (0, import_data.select)(store).getChildBlockNames(blockName);
5404 };
5405 var hasChildBlocks = (blockName) => {
5406 return (0, import_data.select)(store).hasChildBlocks(blockName);
5407 };
5408 var hasChildBlocksWithInserterSupport = (blockName) => {
5409 return (0, import_data.select)(store).hasChildBlocksWithInserterSupport(blockName);
5410 };
5411 var registerBlockStyle = (blockNames, styleVariation) => {
5412 (0, import_data.dispatch)(store).addBlockStyles(blockNames, styleVariation);
5413 };
5414 var unregisterBlockStyle = (blockName, styleVariationName) => {
5415 (0, import_data.dispatch)(store).removeBlockStyles(blockName, styleVariationName);
5416 };
5417 var getBlockVariations = (blockName, scope) => {
5418 return (0, import_data.select)(store).getBlockVariations(blockName, scope);
5419 };
5420 var registerBlockVariation = (blockName, variation) => {
5421 if (Array.isArray(variation)) {
5422 for (const v2 of variation) {
5423 if (typeof v2.name !== "string") {
5424 (0, import_warning.default)("Variation names must be unique strings.");
5425 }
5426 }
5427 } else if (typeof variation.name !== "string") {
5428 (0, import_warning.default)("Variation names must be unique strings.");
5429 }
5430 (0, import_data.dispatch)(store).addBlockVariations(blockName, variation);
5431 };
5432 var unregisterBlockVariation = (blockName, variationName) => {
5433 (0, import_data.dispatch)(store).removeBlockVariations(blockName, variationName);
5434 };
5435 var registerBlockBindingsSource = (source) => {
5436 const {
5437 name,
5438 label,
5439 usesContext,
5440 getValues,
5441 setValues,
5442 canUserEditValue,
5443 getFieldsList
5444 } = source;
5445 const existingSource = unlock(
5446 (0, import_data.select)(store)
5447 ).getBlockBindingsSource(name);
5448 const serverProps = ["label", "usesContext"];
5449 for (const prop2 in existingSource) {
5450 if (!serverProps.includes(prop2) && existingSource[prop2]) {
5451 (0, import_warning.default)(
5452 'Block bindings source "' + name + '" is already registered.'
5453 );
5454 return;
5455 }
5456 }
5457 if (!name) {
5458 (0, import_warning.default)("Block bindings source must contain a name.");
5459 return;
5460 }
5461 if (typeof name !== "string") {
5462 (0, import_warning.default)("Block bindings source name must be a string.");
5463 return;
5464 }
5465 if (/[A-Z]+/.test(name)) {
5466 (0, import_warning.default)(
5467 "Block bindings source name must not contain uppercase characters."
5468 );
5469 return;
5470 }
5471 if (!/^[a-z0-9/-]+$/.test(name)) {
5472 (0, import_warning.default)(
5473 "Block bindings source name must contain only valid characters: lowercase characters, hyphens, or digits. Example: my-plugin/my-custom-source."
5474 );
5475 return;
5476 }
5477 if (!/^[a-z0-9-]+\/[a-z0-9-]+$/.test(name)) {
5478 (0, import_warning.default)(
5479 "Block bindings source name must contain a namespace and valid characters. Example: my-plugin/my-custom-source."
5480 );
5481 return;
5482 }
5483 if (!label && !existingSource?.label) {
5484 (0, import_warning.default)("Block bindings source must contain a label.");
5485 return;
5486 }
5487 if (label && typeof label !== "string") {
5488 (0, import_warning.default)("Block bindings source label must be a string.");
5489 return;
5490 }
5491 if (label && existingSource?.label && label !== existingSource?.label) {
5492 (0, import_warning.default)('Block bindings "' + name + '" source label was overridden.');
5493 }
5494 if (usesContext && !Array.isArray(usesContext)) {
5495 (0, import_warning.default)("Block bindings source usesContext must be an array.");
5496 return;
5497 }
5498 if (getValues && typeof getValues !== "function") {
5499 (0, import_warning.default)("Block bindings source getValues must be a function.");
5500 return;
5501 }
5502 if (setValues && typeof setValues !== "function") {
5503 (0, import_warning.default)("Block bindings source setValues must be a function.");
5504 return;
5505 }
5506 if (canUserEditValue && typeof canUserEditValue !== "function") {
5507 (0, import_warning.default)("Block bindings source canUserEditValue must be a function.");
5508 return;
5509 }
5510 if (getFieldsList && typeof getFieldsList !== "function") {
5511 (0, import_warning.default)("Block bindings source getFieldsList must be a function.");
5512 return;
5513 }
5514 return unlock((0, import_data.dispatch)(store)).addBlockBindingsSource(source);
5515 };
5516 function unregisterBlockBindingsSource(name) {
5517 const oldSource = getBlockBindingsSource(name);
5518 if (!oldSource) {
5519 (0, import_warning.default)('Block bindings source "' + name + '" is not registered.');
5520 return;
5521 }
5522 unlock((0, import_data.dispatch)(store)).removeBlockBindingsSource(name);
5523 }
5524 function getBlockBindingsSource(name) {
5525 return unlock((0, import_data.select)(store)).getBlockBindingsSource(name);
5526 }
5527 function getBlockBindingsSources() {
5528 return unlock((0, import_data.select)(store)).getAllBlockBindingsSources();
5529 }
5530
5531 // packages/blocks/build-module/api/utils.mjs
5532 k([names_default, a11y_default]);
5533 var ICON_COLORS = ["#191e23", "#f8f9f9"];
5534 function isUnmodifiedBlock(block, role) {
5535 const blockAttributes = getBlockType(block.name)?.attributes ?? {};
5536 const attributesByRole = role ? Object.entries(blockAttributes).filter(([key, definition]) => {
5537 if (role === "content" && key === "metadata") {
5538 return Object.keys(
5539 block.attributes[key]?.bindings ?? {}
5540 ).length > 0;
5541 }
5542 return definition.role === role || definition.__experimentalRole === role;
5543 }) : [];
5544 const attributesToCheck = !!attributesByRole.length ? attributesByRole : Object.entries(blockAttributes);
5545 return attributesToCheck.every(([key, definition]) => {
5546 const value = block.attributes[key];
5547 if (definition.hasOwnProperty("default")) {
5548 return value === definition.default;
5549 }
5550 if (definition.type === "rich-text") {
5551 return !value?.length;
5552 }
5553 return value === void 0;
5554 });
5555 }
5556 function isUnmodifiedDefaultBlock(block, role) {
5557 return block.name === getDefaultBlockName() && isUnmodifiedBlock(block, role);
5558 }
5559 function isValidIcon(icon) {
5560 return !!icon && (typeof icon === "string" || (0, import_element.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element.Component);
5561 }
5562 function normalizeIconObject(icon) {
5563 const resolvedIcon = icon || BLOCK_ICON_DEFAULT;
5564 if (isValidIcon(resolvedIcon)) {
5565 return { src: resolvedIcon };
5566 }
5567 const iconDescriptor = resolvedIcon;
5568 if ("background" in iconDescriptor) {
5569 const colordBgColor = w(iconDescriptor.background);
5570 const getColorContrast = (iconColor) => colordBgColor.contrast(iconColor);
5571 const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast));
5572 return {
5573 ...iconDescriptor,
5574 foreground: iconDescriptor.foreground ? iconDescriptor.foreground : ICON_COLORS.find(
5575 (iconColor) => getColorContrast(iconColor) === maxContrast
5576 ),
5577 shadowColor: colordBgColor.alpha(0.3).toRgbString()
5578 };
5579 }
5580 return iconDescriptor;
5581 }
5582 function normalizeBlockType(blockTypeOrName) {
5583 if (typeof blockTypeOrName === "string") {
5584 return getBlockType(blockTypeOrName);
5585 }
5586 return blockTypeOrName;
5587 }
5588 function getBlockLabel(blockType, attributes, context = "visual") {
5589 const { __experimentalLabel: getLabel, title } = blockType;
5590 const label = getLabel && getLabel(attributes, { context });
5591 if (!label) {
5592 return title;
5593 }
5594 if (label.toPlainText) {
5595 return label.toPlainText();
5596 }
5597 return (0, import_dom.__unstableStripHTML)(label);
5598 }
5599 function getAccessibleBlockLabel(blockType, attributes, position, direction = "vertical") {
5600 const title = blockType?.title ?? "";
5601 const label = blockType ? getBlockLabel(blockType, attributes, "accessibility") : "";
5602 const hasPosition = position !== void 0;
5603 const hasLabel = label && label !== title;
5604 if (hasPosition && direction === "vertical") {
5605 if (hasLabel) {
5606 return (0, import_i18n2.sprintf)(
5607 /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
5608 (0, import_i18n2.__)("%1$s Block. Row %2$d. %3$s"),
5609 title,
5610 position,
5611 label
5612 );
5613 }
5614 return (0, import_i18n2.sprintf)(
5615 /* translators: accessibility text. 1: The block title. 2: The block row number. */
5616 (0, import_i18n2.__)("%1$s Block. Row %2$d"),
5617 title,
5618 position
5619 );
5620 } else if (hasPosition && direction === "horizontal") {
5621 if (hasLabel) {
5622 return (0, import_i18n2.sprintf)(
5623 /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
5624 (0, import_i18n2.__)("%1$s Block. Column %2$d. %3$s"),
5625 title,
5626 position,
5627 label
5628 );
5629 }
5630 return (0, import_i18n2.sprintf)(
5631 /* translators: accessibility text. 1: The block title. 2: The block column number. */
5632 (0, import_i18n2.__)("%1$s Block. Column %2$d"),
5633 title,
5634 position
5635 );
5636 }
5637 if (hasLabel) {
5638 return (0, import_i18n2.sprintf)(
5639 /* translators: accessibility text. 1: The block title. 2: The block label. */
5640 (0, import_i18n2.__)("%1$s Block. %2$s"),
5641 title,
5642 label
5643 );
5644 }
5645 return (0, import_i18n2.sprintf)(
5646 /* translators: accessibility text. %s: The block title. */
5647 (0, import_i18n2.__)("%s Block"),
5648 title
5649 );
5650 }
5651 function getDefault(attributeSchema) {
5652 if (attributeSchema.default !== void 0) {
5653 return attributeSchema.default;
5654 }
5655 if (attributeSchema.type === "rich-text") {
5656 return new import_rich_text.RichTextData();
5657 }
5658 return void 0;
5659 }
5660 function isBlockRegistered(name) {
5661 return getBlockType(name) !== void 0;
5662 }
5663 function __experimentalSanitizeBlockAttributes(name, attributes) {
5664 const blockType = getBlockType(name);
5665 if (void 0 === blockType) {
5666 throw new Error(`Block type '${name}' is not registered.`);
5667 }
5668 return Object.entries(blockType.attributes).reduce(
5669 (accumulator, [key, schema]) => {
5670 const value = attributes[key];
5671 if (void 0 !== value) {
5672 if (schema.type === "rich-text") {
5673 if (value instanceof import_rich_text.RichTextData) {
5674 accumulator[key] = value;
5675 } else if (typeof value === "string") {
5676 accumulator[key] = import_rich_text.RichTextData.fromHTMLString(value);
5677 }
5678 } else if (schema.type === "string" && value instanceof import_rich_text.RichTextData) {
5679 accumulator[key] = value.toHTMLString();
5680 } else {
5681 accumulator[key] = value;
5682 }
5683 } else {
5684 const _default = getDefault(schema);
5685 if (void 0 !== _default) {
5686 accumulator[key] = _default;
5687 }
5688 }
5689 if (["node", "children"].indexOf(schema.source ?? "") !== -1) {
5690 if (typeof accumulator[key] === "string") {
5691 accumulator[key] = [accumulator[key]];
5692 } else if (!Array.isArray(accumulator[key])) {
5693 accumulator[key] = [];
5694 }
5695 }
5696 return accumulator;
5697 },
5698 {}
5699 );
5700 }
5701 function getBlockAttributesNamesByRole(name, role) {
5702 const attributes = getBlockType(name)?.attributes;
5703 if (!attributes) {
5704 return [];
5705 }
5706 const attributesNames = Object.keys(attributes);
5707 if (!role) {
5708 return attributesNames;
5709 }
5710 return attributesNames.filter((attributeName) => {
5711 const attribute = attributes[attributeName];
5712 if (attribute?.role === role) {
5713 return true;
5714 }
5715 if (attribute?.__experimentalRole === role) {
5716 (0, import_deprecated.default)("__experimentalRole attribute", {
5717 since: "6.7",
5718 version: "6.8",
5719 alternative: "role attribute",
5720 hint: `Check the block.json of the ${name} block.`
5721 });
5722 return true;
5723 }
5724 return false;
5725 });
5726 }
5727 var __experimentalGetBlockAttributesNamesByRole = (...args) => {
5728 (0, import_deprecated.default)("__experimentalGetBlockAttributesNamesByRole", {
5729 since: "6.7",
5730 version: "6.8",
5731 alternative: "getBlockAttributesNamesByRole"
5732 });
5733 return getBlockAttributesNamesByRole(...args);
5734 };
5735 function isContentBlock(name) {
5736 const blockType = getBlockType(name);
5737 const attributes = blockType?.attributes;
5738 const supportsContentRole = blockType?.supports?.contentRole;
5739 if (supportsContentRole) {
5740 return true;
5741 }
5742 if (!attributes) {
5743 return false;
5744 }
5745 return !!Object.keys(attributes)?.some((attributeKey) => {
5746 const attribute = attributes[attributeKey];
5747 return attribute?.role === "content" || attribute?.__experimentalRole === "content";
5748 });
5749 }
5750 function omit(object, keys) {
5751 const keysArray = Array.isArray(keys) ? keys : [keys];
5752 return Object.fromEntries(
5753 Object.entries(object).filter(
5754 ([key]) => !keysArray.includes(key)
5755 )
5756 );
5757 }
5758
5759 // packages/blocks/build-module/store/reducer.mjs
5760 var DEFAULT_CATEGORIES = [
5761 { slug: "text", title: (0, import_i18n3.__)("Text") },
5762 { slug: "media", title: (0, import_i18n3.__)("Media") },
5763 { slug: "design", title: (0, import_i18n3.__)("Design") },
5764 { slug: "widgets", title: (0, import_i18n3.__)("Widgets") },
5765 { slug: "theme", title: (0, import_i18n3.__)("Theme") },
5766 { slug: "embed", title: (0, import_i18n3.__)("Embeds") },
5767 { slug: "reusable", title: (0, import_i18n3.__)("Reusable blocks") }
5768 ];
5769 function keyBlockTypesByName(types) {
5770 return types.reduce(
5771 (newBlockTypes, block) => ({
5772 ...newBlockTypes,
5773 [block.name]: block
5774 }),
5775 {}
5776 );
5777 }
5778 function getUniqueItemsByName(items) {
5779 return items.reduce((acc, currentItem) => {
5780 if (!acc.some((item) => item.name === currentItem.name)) {
5781 acc.push(currentItem);
5782 }
5783 return acc;
5784 }, []);
5785 }
5786 function bootstrappedBlockTypes(state = {}, action) {
5787 switch (action.type) {
5788 case "ADD_BOOTSTRAPPED_BLOCK_TYPE":
5789 const { name, blockType } = action;
5790 const serverDefinition = state[name];
5791 if (serverDefinition) {
5792 return state;
5793 }
5794 const newDefinition = Object.fromEntries(
5795 Object.entries(blockType).filter(
5796 ([, value]) => value !== null && value !== void 0
5797 ).map(([key, value]) => [camelCase(key), value])
5798 );
5799 newDefinition.name = name;
5800 return {
5801 ...state,
5802 [name]: newDefinition
5803 };
5804 case "REMOVE_BLOCK_TYPES":
5805 return omit(state, action.names);
5806 }
5807 return state;
5808 }
5809 function unprocessedBlockTypes(state = {}, action) {
5810 switch (action.type) {
5811 case "ADD_UNPROCESSED_BLOCK_TYPE":
5812 return {
5813 ...state,
5814 [action.name]: action.blockType
5815 };
5816 case "REMOVE_BLOCK_TYPES":
5817 return omit(state, action.names);
5818 }
5819 return state;
5820 }
5821 function blockTypes(state = {}, action) {
5822 switch (action.type) {
5823 case "ADD_BLOCK_TYPES":
5824 return {
5825 ...state,
5826 ...keyBlockTypesByName(action.blockTypes)
5827 };
5828 case "REMOVE_BLOCK_TYPES":
5829 return omit(state, action.names);
5830 }
5831 return state;
5832 }
5833 function blockStyles(state = {}, action) {
5834 switch (action.type) {
5835 case "ADD_BLOCK_TYPES":
5836 return {
5837 ...state,
5838 ...Object.fromEntries(
5839 Object.entries(
5840 keyBlockTypesByName(action.blockTypes)
5841 ).map(([name, blockType]) => [
5842 name,
5843 getUniqueItemsByName([
5844 ...(blockType.styles ?? []).map((style) => ({
5845 ...style,
5846 source: "block"
5847 })),
5848 ...(state[blockType.name] ?? []).filter(
5849 ({ source }) => "block" !== source
5850 )
5851 ])
5852 ])
5853 )
5854 };
5855 case "ADD_BLOCK_STYLES":
5856 const updatedStyles = {};
5857 action.blockNames.forEach((blockName) => {
5858 updatedStyles[blockName] = getUniqueItemsByName([
5859 ...state[blockName] ?? [],
5860 ...action.styles
5861 ]);
5862 });
5863 return { ...state, ...updatedStyles };
5864 case "REMOVE_BLOCK_STYLES":
5865 return {
5866 ...state,
5867 [action.blockName]: (state[action.blockName] ?? []).filter(
5868 (style) => action.styleNames.indexOf(style.name) === -1
5869 )
5870 };
5871 }
5872 return state;
5873 }
5874 function blockVariations(state = {}, action) {
5875 switch (action.type) {
5876 case "ADD_BLOCK_TYPES":
5877 return {
5878 ...state,
5879 ...Object.fromEntries(
5880 Object.entries(
5881 keyBlockTypesByName(action.blockTypes)
5882 ).map(([name, blockType]) => {
5883 return [
5884 name,
5885 getUniqueItemsByName([
5886 ...(blockType.variations ?? []).map(
5887 (variation) => ({
5888 ...variation,
5889 source: "block"
5890 })
5891 ),
5892 ...(state[blockType.name] ?? []).filter(
5893 ({ source }) => "block" !== source
5894 )
5895 ])
5896 ];
5897 })
5898 )
5899 };
5900 case "ADD_BLOCK_VARIATIONS":
5901 return {
5902 ...state,
5903 [action.blockName]: getUniqueItemsByName([
5904 ...state[action.blockName] ?? [],
5905 ...action.variations
5906 ])
5907 };
5908 case "REMOVE_BLOCK_VARIATIONS":
5909 return {
5910 ...state,
5911 [action.blockName]: (state[action.blockName] ?? []).filter(
5912 (variation) => action.variationNames.indexOf(variation.name) === -1
5913 )
5914 };
5915 }
5916 return state;
5917 }
5918 function createBlockNameSetterReducer(setActionType) {
5919 return (state = null, action) => {
5920 switch (action.type) {
5921 case "REMOVE_BLOCK_TYPES":
5922 if (action.names.indexOf(state) !== -1) {
5923 return null;
5924 }
5925 return state;
5926 case setActionType:
5927 return action.name || null;
5928 }
5929 return state;
5930 };
5931 }
5932 var defaultBlockName = createBlockNameSetterReducer(
5933 "SET_DEFAULT_BLOCK_NAME"
5934 );
5935 var freeformFallbackBlockName = createBlockNameSetterReducer(
5936 "SET_FREEFORM_FALLBACK_BLOCK_NAME"
5937 );
5938 var unregisteredFallbackBlockName = createBlockNameSetterReducer(
5939 "SET_UNREGISTERED_FALLBACK_BLOCK_NAME"
5940 );
5941 var groupingBlockName = createBlockNameSetterReducer(
5942 "SET_GROUPING_BLOCK_NAME"
5943 );
5944 function categories(state = DEFAULT_CATEGORIES, action) {
5945 switch (action.type) {
5946 case "SET_CATEGORIES":
5947 const uniqueCategories = /* @__PURE__ */ new Map();
5948 (action.categories || []).forEach((category) => {
5949 uniqueCategories.set(category.slug, category);
5950 });
5951 return [...uniqueCategories.values()];
5952 case "UPDATE_CATEGORY": {
5953 if (!action.category || !Object.keys(action.category).length) {
5954 return state;
5955 }
5956 const categoryToChange = state.find(
5957 ({ slug }) => slug === action.slug
5958 );
5959 if (categoryToChange) {
5960 return state.map((category) => {
5961 if (category.slug === action.slug) {
5962 return {
5963 ...category,
5964 ...action.category
5965 };
5966 }
5967 return category;
5968 });
5969 }
5970 }
5971 }
5972 return state;
5973 }
5974 function collections(state = {}, action) {
5975 switch (action.type) {
5976 case "ADD_BLOCK_COLLECTION":
5977 return {
5978 ...state,
5979 [action.namespace]: {
5980 title: action.title,
5981 icon: action.icon
5982 }
5983 };
5984 case "REMOVE_BLOCK_COLLECTION":
5985 return omit(state, action.namespace);
5986 }
5987 return state;
5988 }
5989 function getMergedUsesContext(existingUsesContext = [], newUsesContext = []) {
5990 const mergedArrays = Array.from(
5991 new Set(existingUsesContext.concat(newUsesContext))
5992 );
5993 return mergedArrays.length > 0 ? mergedArrays : void 0;
5994 }
5995 function blockBindingsSources(state = {}, action) {
5996 switch (action.type) {
5997 case "ADD_BLOCK_BINDINGS_SOURCE":
5998 return {
5999 ...state,
6000 [action.name]: {
6001 label: action.label || state[action.name]?.label,
6002 usesContext: getMergedUsesContext(
6003 state[action.name]?.usesContext,
6004 action.usesContext
6005 ),
6006 getValues: action.getValues,
6007 setValues: action.setValues,
6008 // Only set `canUserEditValue` if `setValues` is also defined.
6009 canUserEditValue: action.setValues && action.canUserEditValue,
6010 getFieldsList: action.getFieldsList
6011 }
6012 };
6013 case "REMOVE_BLOCK_BINDINGS_SOURCE":
6014 return omit(state, action.name);
6015 }
6016 return state;
6017 }
6018 var reducer_default = (0, import_data2.combineReducers)({
6019 bootstrappedBlockTypes,
6020 unprocessedBlockTypes,
6021 blockTypes,
6022 blockStyles,
6023 blockVariations,
6024 defaultBlockName,
6025 freeformFallbackBlockName,
6026 unregisteredFallbackBlockName,
6027 groupingBlockName,
6028 categories,
6029 collections,
6030 blockBindingsSources
6031 });
6032
6033 // packages/blocks/build-module/store/selectors.mjs
6034 var selectors_exports = {};
6035 __export(selectors_exports, {
6036 __experimentalHasContentRoleAttribute: () => __experimentalHasContentRoleAttribute,
6037 getActiveBlockVariation: () => getActiveBlockVariation,
6038 getBlockStyles: () => getBlockStyles,
6039 getBlockSupport: () => getBlockSupport2,
6040 getBlockType: () => getBlockType2,
6041 getBlockTypes: () => getBlockTypes2,
6042 getBlockVariations: () => getBlockVariations2,
6043 getCategories: () => getCategories,
6044 getChildBlockNames: () => getChildBlockNames2,
6045 getCollections: () => getCollections,
6046 getDefaultBlockName: () => getDefaultBlockName2,
6047 getDefaultBlockVariation: () => getDefaultBlockVariation,
6048 getFreeformFallbackBlockName: () => getFreeformFallbackBlockName,
6049 getGroupingBlockName: () => getGroupingBlockName2,
6050 getUnregisteredFallbackBlockName: () => getUnregisteredFallbackBlockName,
6051 hasBlockSupport: () => hasBlockSupport2,
6052 hasChildBlocks: () => hasChildBlocks2,
6053 hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport2,
6054 isMatchingSearchTerm: () => isMatchingSearchTerm
6055 });
6056 var import_remove_accents = __toESM(require_remove_accents(), 1);
6057 var import_data4 = __toESM(require_data(), 1);
6058 var import_rich_text2 = __toESM(require_rich_text(), 1);
6059 var import_deprecated3 = __toESM(require_deprecated(), 1);
6060
6061 // packages/blocks/build-module/store/utils.mjs
6062 var getValueFromObjectPath = (object, path, defaultValue) => {
6063 const normalizedPath = Array.isArray(path) ? path : path.split(".");
6064 let value = object;
6065 normalizedPath.forEach((fieldName) => {
6066 value = value?.[fieldName];
6067 });
6068 return value ?? defaultValue;
6069 };
6070 function isObject2(candidate) {
6071 return typeof candidate === "object" && candidate !== null && candidate.constructor === Object;
6072 }
6073 function matchesAttributes(blockAttributes, variationAttributes) {
6074 if (isObject2(blockAttributes) && isObject2(variationAttributes)) {
6075 return Object.entries(variationAttributes).every(
6076 ([key, value]) => matchesAttributes(blockAttributes?.[key], value)
6077 );
6078 }
6079 return blockAttributes === variationAttributes;
6080 }
6081
6082 // packages/blocks/build-module/store/private-selectors.mjs
6083 var private_selectors_exports = {};
6084 __export(private_selectors_exports, {
6085 getAllBlockBindingsSources: () => getAllBlockBindingsSources,
6086 getBlockBindingsSource: () => getBlockBindingsSource2,
6087 getBlockBindingsSourceFieldsList: () => getBlockBindingsSourceFieldsList,
6088 getBootstrappedBlockType: () => getBootstrappedBlockType,
6089 getSupportedStyles: () => getSupportedStyles,
6090 getUnprocessedBlockTypes: () => getUnprocessedBlockTypes,
6091 hasContentRoleAttribute: () => hasContentRoleAttribute
6092 });
6093 var import_data3 = __toESM(require_data(), 1);
6094 var import_deprecated2 = __toESM(require_deprecated(), 1);
6095 var ROOT_BLOCK_SUPPORTS = [
6096 "background",
6097 "backgroundColor",
6098 "color",
6099 "linkColor",
6100 "captionColor",
6101 "buttonColor",
6102 "headingColor",
6103 "fontFamily",
6104 "fontSize",
6105 "fontStyle",
6106 "fontWeight",
6107 "lineHeight",
6108 "padding",
6109 "contentSize",
6110 "wideSize",
6111 "blockGap",
6112 "textAlign",
6113 "textDecoration",
6114 "textIndent",
6115 "textTransform",
6116 "letterSpacing"
6117 ];
6118 function filterElementBlockSupports(blockSupports, name, element) {
6119 return blockSupports.filter((support) => {
6120 if (support === "fontSize" && element === "heading") {
6121 return false;
6122 }
6123 if (support === "textDecoration" && !name && element !== "link") {
6124 return false;
6125 }
6126 if (support === "textTransform" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes(
6127 element
6128 ) || element === "button" || element === "caption" || element === "text")) {
6129 return false;
6130 }
6131 if (support === "letterSpacing" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes(
6132 element
6133 ) || element === "button" || element === "caption" || element === "text")) {
6134 return false;
6135 }
6136 if (support === "textIndent" && !name) {
6137 return false;
6138 }
6139 if (support === "textColumns" && !name) {
6140 return false;
6141 }
6142 return true;
6143 });
6144 }
6145 var getSupportedStyles = (0, import_data3.createSelector)(
6146 (state, name, element) => {
6147 if (!name) {
6148 return filterElementBlockSupports(
6149 ROOT_BLOCK_SUPPORTS,
6150 name,
6151 element
6152 );
6153 }
6154 const blockType = getBlockType2(state, name);
6155 if (!blockType) {
6156 return [];
6157 }
6158 const supportKeys = [];
6159 const supports = blockType?.supports;
6160 if (supports?.spacing?.blockGap) {
6161 supportKeys.push("blockGap");
6162 }
6163 if (supports?.shadow) {
6164 supportKeys.push("shadow");
6165 }
6166 const stylePropertyMap = __EXPERIMENTAL_STYLE_PROPERTY;
6167 Object.keys(stylePropertyMap).forEach((styleName) => {
6168 if (!stylePropertyMap[styleName].support) {
6169 return;
6170 }
6171 if (stylePropertyMap[styleName].requiresOptOut) {
6172 if (supports && stylePropertyMap[styleName].support[0] in supports && getValueFromObjectPath(
6173 supports,
6174 stylePropertyMap[styleName].support
6175 ) !== false) {
6176 supportKeys.push(styleName);
6177 return;
6178 }
6179 }
6180 if (supports && getValueFromObjectPath(
6181 supports,
6182 stylePropertyMap[styleName].support,
6183 false
6184 )) {
6185 supportKeys.push(styleName);
6186 }
6187 });
6188 return filterElementBlockSupports(supportKeys, name, element);
6189 },
6190 (state, name) => [
6191 state.blockTypes[name]
6192 ]
6193 );
6194 function getBootstrappedBlockType(state, name) {
6195 return state.bootstrappedBlockTypes[name];
6196 }
6197 function getUnprocessedBlockTypes(state) {
6198 return state.unprocessedBlockTypes;
6199 }
6200 function getAllBlockBindingsSources(state) {
6201 return state.blockBindingsSources;
6202 }
6203 function getBlockBindingsSource2(state, sourceName) {
6204 return state.blockBindingsSources[sourceName];
6205 }
6206 var getBlockBindingsSourceFieldsList = (0, import_data3.createRegistrySelector)(
6207 (select3) => (0, import_data3.createSelector)(
6208 (state, source, blockContext) => {
6209 if (!source.getFieldsList) {
6210 return [];
6211 }
6212 const context = {};
6213 if (source?.usesContext?.length) {
6214 for (const key of source.usesContext) {
6215 context[key] = blockContext[key];
6216 }
6217 }
6218 return source.getFieldsList({ select: select3, context });
6219 },
6220 (state, source, blockContext) => [source.getFieldsList, source.usesContext, blockContext]
6221 )
6222 );
6223 var hasContentRoleAttribute = (state, blockTypeName) => {
6224 const blockType = getBlockType2(state, blockTypeName);
6225 if (!blockType) {
6226 return false;
6227 }
6228 return Object.values(blockType.attributes).some(
6229 ({ role, __experimentalRole }) => {
6230 if (role === "content") {
6231 return true;
6232 }
6233 if (__experimentalRole === "content") {
6234 (0, import_deprecated2.default)("__experimentalRole attribute", {
6235 since: "6.7",
6236 version: "6.8",
6237 alternative: "role attribute",
6238 hint: `Check the block.json of the ${blockTypeName} block.`
6239 });
6240 return true;
6241 }
6242 return false;
6243 }
6244 );
6245 };
6246
6247 // packages/blocks/build-module/store/selectors.mjs
6248 var getNormalizedBlockType = (state, nameOrType) => "string" === typeof nameOrType ? getBlockType2(state, nameOrType) : nameOrType;
6249 var getBlockTypes2 = (0, import_data4.createSelector)(
6250 (state) => Object.values(state.blockTypes),
6251 (state) => [state.blockTypes]
6252 );
6253 function getBlockType2(state, name) {
6254 return state.blockTypes[name];
6255 }
6256 function getBlockStyles(state, name) {
6257 return state.blockStyles[name];
6258 }
6259 var getBlockVariations2 = (0, import_data4.createSelector)(
6260 (state, blockName, scope) => {
6261 const variations = state.blockVariations[blockName];
6262 if (!variations || !scope) {
6263 return variations;
6264 }
6265 return variations.filter((variation) => {
6266 return (variation.scope || ["block", "inserter"]).includes(
6267 scope
6268 );
6269 });
6270 },
6271 (state, blockName) => [
6272 state.blockVariations[blockName]
6273 ]
6274 );
6275 function getActiveBlockVariation(state, blockName, attributes, scope) {
6276 const variations = getBlockVariations2(state, blockName, scope);
6277 if (!variations) {
6278 return variations;
6279 }
6280 const blockType = getBlockType2(state, blockName);
6281 const attributeKeys = Object.keys(blockType?.attributes || {});
6282 let match;
6283 let maxMatchedAttributes = 0;
6284 for (const variation of variations) {
6285 if (Array.isArray(variation.isActive)) {
6286 const definedAttributes = variation.isActive.filter(
6287 (attribute) => {
6288 const topLevelAttribute = attribute.split(".")[0];
6289 return attributeKeys.includes(topLevelAttribute);
6290 }
6291 );
6292 const definedAttributesLength = definedAttributes.length;
6293 if (definedAttributesLength === 0) {
6294 continue;
6295 }
6296 const isMatch = definedAttributes.every((attribute) => {
6297 const variationAttributeValue = getValueFromObjectPath(
6298 variation.attributes,
6299 attribute
6300 );
6301 if (variationAttributeValue === void 0) {
6302 return false;
6303 }
6304 let blockAttributeValue = getValueFromObjectPath(
6305 attributes,
6306 attribute
6307 );
6308 if (blockAttributeValue instanceof import_rich_text2.RichTextData) {
6309 blockAttributeValue = blockAttributeValue.toHTMLString();
6310 }
6311 return matchesAttributes(
6312 blockAttributeValue,
6313 variationAttributeValue
6314 );
6315 });
6316 if (isMatch && definedAttributesLength > maxMatchedAttributes) {
6317 match = variation;
6318 maxMatchedAttributes = definedAttributesLength;
6319 }
6320 } else if (variation.isActive?.(
6321 attributes,
6322 variation.attributes
6323 )) {
6324 return match || variation;
6325 }
6326 }
6327 if (!match && ["block", "transform"].includes(scope)) {
6328 match = variations.find(
6329 (variation) => variation?.isDefault && !Object.hasOwn(variation, "isActive")
6330 );
6331 }
6332 return match;
6333 }
6334 function getDefaultBlockVariation(state, blockName, scope) {
6335 const variations = getBlockVariations2(state, blockName, scope);
6336 const defaultVariation = [...variations || []].reverse().find(({ isDefault }) => !!isDefault);
6337 return defaultVariation || variations?.[0];
6338 }
6339 function getCategories(state) {
6340 return state.categories;
6341 }
6342 function getCollections(state) {
6343 return state.collections;
6344 }
6345 function getDefaultBlockName2(state) {
6346 return state.defaultBlockName;
6347 }
6348 function getFreeformFallbackBlockName(state) {
6349 return state.freeformFallbackBlockName;
6350 }
6351 function getUnregisteredFallbackBlockName(state) {
6352 return state.unregisteredFallbackBlockName;
6353 }
6354 function getGroupingBlockName2(state) {
6355 return state.groupingBlockName;
6356 }
6357 var getChildBlockNames2 = (0, import_data4.createSelector)(
6358 (state, blockName) => {
6359 return getBlockTypes2(state).filter((blockType) => {
6360 return blockType.parent?.includes(blockName);
6361 }).map(({ name }) => name);
6362 },
6363 (state) => [state.blockTypes]
6364 );
6365 var getBlockSupport2 = (state, nameOrType, feature, defaultSupports) => {
6366 const blockType = getNormalizedBlockType(state, nameOrType);
6367 if (!blockType?.supports) {
6368 return defaultSupports;
6369 }
6370 return getValueFromObjectPath(
6371 blockType.supports,
6372 feature,
6373 defaultSupports
6374 );
6375 };
6376 function hasBlockSupport2(state, nameOrType, feature, defaultSupports) {
6377 return !!getBlockSupport2(state, nameOrType, feature, defaultSupports);
6378 }
6379 function getNormalizedSearchTerm(term) {
6380 return (0, import_remove_accents.default)(term ?? "").toLowerCase().trim();
6381 }
6382 function isMatchingSearchTerm(state, nameOrType, searchTerm = "") {
6383 const blockType = getNormalizedBlockType(state, nameOrType);
6384 const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
6385 const isSearchMatch = (candidate) => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm);
6386 return isSearchMatch(blockType?.title) || blockType?.keywords?.some(isSearchMatch) || isSearchMatch(blockType?.category) || typeof blockType?.description === "string" && isSearchMatch(blockType.description);
6387 }
6388 var hasChildBlocks2 = (state, blockName) => {
6389 return getChildBlockNames2(state, blockName).length > 0;
6390 };
6391 var hasChildBlocksWithInserterSupport2 = (state, blockName) => {
6392 return getChildBlockNames2(state, blockName).some((childBlockName) => {
6393 return hasBlockSupport2(state, childBlockName, "inserter", true);
6394 });
6395 };
6396 var __experimentalHasContentRoleAttribute = (...args) => {
6397 (0, import_deprecated3.default)("__experimentalHasContentRoleAttribute", {
6398 since: "6.7",
6399 version: "6.8",
6400 hint: "This is a private selector."
6401 });
6402 return hasContentRoleAttribute(...args);
6403 };
6404
6405 // packages/blocks/build-module/store/actions.mjs
6406 var actions_exports = {};
6407 __export(actions_exports, {
6408 __experimentalReapplyBlockFilters: () => __experimentalReapplyBlockFilters,
6409 addBlockCollection: () => addBlockCollection,
6410 addBlockStyles: () => addBlockStyles,
6411 addBlockTypes: () => addBlockTypes,
6412 addBlockVariations: () => addBlockVariations,
6413 reapplyBlockTypeFilters: () => reapplyBlockTypeFilters,
6414 removeBlockCollection: () => removeBlockCollection,
6415 removeBlockStyles: () => removeBlockStyles,
6416 removeBlockTypes: () => removeBlockTypes,
6417 removeBlockVariations: () => removeBlockVariations,
6418 setCategories: () => setCategories,
6419 setDefaultBlockName: () => setDefaultBlockName2,
6420 setFreeformFallbackBlockName: () => setFreeformFallbackBlockName,
6421 setGroupingBlockName: () => setGroupingBlockName2,
6422 setUnregisteredFallbackBlockName: () => setUnregisteredFallbackBlockName,
6423 updateCategory: () => updateCategory
6424 });
6425 var import_deprecated5 = __toESM(require_deprecated(), 1);
6426
6427 // node_modules/is-plain-object/dist/is-plain-object.mjs
6428 function isObject3(o3) {
6429 return Object.prototype.toString.call(o3) === "[object Object]";
6430 }
6431 function isPlainObject(o3) {
6432 var ctor, prot;
6433 if (isObject3(o3) === false) return false;
6434 ctor = o3.constructor;
6435 if (ctor === void 0) return true;
6436 prot = ctor.prototype;
6437 if (isObject3(prot) === false) return false;
6438 if (prot.hasOwnProperty("isPrototypeOf") === false) {
6439 return false;
6440 }
6441 return true;
6442 }
6443
6444 // packages/blocks/build-module/store/process-block-type.mjs
6445 var import_react_is = __toESM(require_react_is(), 1);
6446 var import_deprecated4 = __toESM(require_deprecated(), 1);
6447 var import_hooks = __toESM(require_hooks(), 1);
6448 var import_warning2 = __toESM(require_warning(), 1);
6449 var LEGACY_CATEGORY_MAPPING = {
6450 common: "text",
6451 formatting: "text",
6452 layout: "design"
6453 };
6454 function mergeBlockVariations(bootstrappedVariations = [], clientVariations = []) {
6455 const result = [...bootstrappedVariations];
6456 clientVariations.forEach((clientVariation) => {
6457 const index = result.findIndex(
6458 (bootstrappedVariation) => bootstrappedVariation.name === clientVariation.name
6459 );
6460 if (index !== -1) {
6461 result[index] = { ...result[index], ...clientVariation };
6462 } else {
6463 result.push(clientVariation);
6464 }
6465 });
6466 return result;
6467 }
6468 var processBlockType = (name, blockSettings) => ({
6469 select: select3
6470 }) => {
6471 const bootstrappedBlockType = select3.getBootstrappedBlockType(name);
6472 const blockType = {
6473 apiVersion: 1,
6474 name,
6475 icon: BLOCK_ICON_DEFAULT,
6476 keywords: [],
6477 attributes: {},
6478 providesContext: {},
6479 usesContext: [],
6480 selectors: {},
6481 supports: {},
6482 styles: [],
6483 blockHooks: {},
6484 save: () => null,
6485 ...bootstrappedBlockType,
6486 ...blockSettings,
6487 // blockType.variations can be defined as a filePath.
6488 variations: mergeBlockVariations(
6489 Array.isArray(bootstrappedBlockType?.variations) ? bootstrappedBlockType.variations : [],
6490 Array.isArray(blockSettings?.variations) ? blockSettings.variations : []
6491 )
6492 };
6493 if (!blockType.attributes || typeof blockType.attributes !== "object") {
6494 (0, import_warning2.default)(
6495 'The block "' + name + '" is registering attributes as `null` or `undefined`. Use an empty object (`attributes: {}`) or exclude the `attributes` key.'
6496 );
6497 blockType.attributes = {};
6498 }
6499 const settings = (0, import_hooks.applyFilters)(
6500 "blocks.registerBlockType",
6501 blockType,
6502 name,
6503 null
6504 );
6505 if (settings.apiVersion <= 2) {
6506 (0, import_deprecated4.default)("Block with API version 2 or lower", {
6507 since: "6.9",
6508 hint: `The block "${name}" is registered with API version ${settings.apiVersion}. This means that the post editor may work as a non-iframe editor. Since all editors are planned to work as iframes in the future, set the \`apiVersion\` field to 3 and test the block inside the iframe editor.`,
6509 link: "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/"
6510 });
6511 }
6512 if (settings.description && typeof settings.description !== "string") {
6513 (0, import_deprecated4.default)("Declaring non-string block descriptions", {
6514 since: "6.2"
6515 });
6516 }
6517 if (settings.deprecated) {
6518 settings.deprecated = settings.deprecated.map(
6519 (deprecation) => Object.fromEntries(
6520 Object.entries(
6521 // Only keep valid deprecation keys.
6522 (0, import_hooks.applyFilters)(
6523 "blocks.registerBlockType",
6524 // Merge deprecation keys with pre-filter settings
6525 // so that filters that depend on specific keys being
6526 // present don't fail.
6527 {
6528 // Omit deprecation keys here so that deprecations
6529 // can opt out of specific keys like "supports".
6530 ...omit(blockType, DEPRECATED_ENTRY_KEYS),
6531 ...deprecation
6532 },
6533 blockType.name,
6534 deprecation
6535 )
6536 ).filter(
6537 ([key]) => DEPRECATED_ENTRY_KEYS.includes(key)
6538 )
6539 )
6540 );
6541 }
6542 if (!isPlainObject(settings)) {
6543 (0, import_warning2.default)("Block settings must be a valid object.");
6544 return;
6545 }
6546 if (typeof settings.save !== "function") {
6547 (0, import_warning2.default)('The "save" property must be a valid function.');
6548 return;
6549 }
6550 if ("edit" in settings && !(0, import_react_is.isValidElementType)(settings.edit)) {
6551 (0, import_warning2.default)('The "edit" property must be a valid component.');
6552 return;
6553 }
6554 if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) {
6555 settings.category = LEGACY_CATEGORY_MAPPING[settings.category];
6556 }
6557 if ("category" in settings && !select3.getCategories().some(
6558 ({ slug }) => slug === settings.category
6559 )) {
6560 (0, import_warning2.default)(
6561 'The block "' + name + '" is registered with an invalid category "' + settings.category + '".'
6562 );
6563 delete settings.category;
6564 }
6565 if (!("title" in settings) || settings.title === "") {
6566 (0, import_warning2.default)('The block "' + name + '" must have a title.');
6567 return;
6568 }
6569 if (typeof settings.title !== "string") {
6570 (0, import_warning2.default)("Block titles must be strings.");
6571 return;
6572 }
6573 settings.icon = normalizeIconObject(settings.icon);
6574 if (!isValidIcon(settings.icon.src)) {
6575 (0, import_warning2.default)(
6576 "The icon passed is invalid. The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional"
6577 );
6578 return;
6579 }
6580 if (typeof settings?.parent === "string" || settings?.parent instanceof String) {
6581 settings.parent = [settings.parent];
6582 (0, import_warning2.default)(
6583 "Parent must be undefined or an array of strings (block types), but it is a string."
6584 );
6585 }
6586 if (!Array.isArray(settings?.parent) && settings?.parent !== void 0) {
6587 (0, import_warning2.default)(
6588 "Parent must be undefined or an array of block types, but it is " + settings.parent
6589 );
6590 return;
6591 }
6592 if (1 === settings?.parent?.length && name === settings.parent[0]) {
6593 (0, import_warning2.default)(
6594 'Block "' + name + '" cannot be a parent of itself. Please remove the block name from the parent list.'
6595 );
6596 return;
6597 }
6598 return settings;
6599 };
6600
6601 // packages/blocks/build-module/store/actions.mjs
6602 function addBlockTypes(blockTypes2) {
6603 return {
6604 type: "ADD_BLOCK_TYPES",
6605 blockTypes: Array.isArray(blockTypes2) ? blockTypes2 : [blockTypes2]
6606 };
6607 }
6608 function reapplyBlockTypeFilters() {
6609 return ({ dispatch: dispatch3, select: select3 }) => {
6610 const processedBlockTypes = [];
6611 for (const [name, settings] of Object.entries(
6612 select3.getUnprocessedBlockTypes()
6613 )) {
6614 const result = dispatch3(processBlockType(name, settings));
6615 if (result) {
6616 processedBlockTypes.push(result);
6617 }
6618 }
6619 if (!processedBlockTypes.length) {
6620 return;
6621 }
6622 dispatch3.addBlockTypes(processedBlockTypes);
6623 };
6624 }
6625 function __experimentalReapplyBlockFilters() {
6626 (0, import_deprecated5.default)(
6627 'wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters',
6628 {
6629 since: "6.4",
6630 alternative: "reapplyBlockFilters"
6631 }
6632 );
6633 return reapplyBlockTypeFilters();
6634 }
6635 function removeBlockTypes(names) {
6636 return {
6637 type: "REMOVE_BLOCK_TYPES",
6638 names: Array.isArray(names) ? names : [names]
6639 };
6640 }
6641 function addBlockStyles(blockNames, styles) {
6642 return {
6643 type: "ADD_BLOCK_STYLES",
6644 styles: Array.isArray(styles) ? styles : [styles],
6645 blockNames: Array.isArray(blockNames) ? blockNames : [blockNames]
6646 };
6647 }
6648 function removeBlockStyles(blockName, styleNames) {
6649 return {
6650 type: "REMOVE_BLOCK_STYLES",
6651 styleNames: Array.isArray(styleNames) ? styleNames : [styleNames],
6652 blockName
6653 };
6654 }
6655 function addBlockVariations(blockName, variations) {
6656 return {
6657 type: "ADD_BLOCK_VARIATIONS",
6658 variations: Array.isArray(variations) ? variations : [variations],
6659 blockName
6660 };
6661 }
6662 function removeBlockVariations(blockName, variationNames) {
6663 return {
6664 type: "REMOVE_BLOCK_VARIATIONS",
6665 variationNames: Array.isArray(variationNames) ? variationNames : [variationNames],
6666 blockName
6667 };
6668 }
6669 function setDefaultBlockName2(name) {
6670 return {
6671 type: "SET_DEFAULT_BLOCK_NAME",
6672 name
6673 };
6674 }
6675 function setFreeformFallbackBlockName(name) {
6676 return {
6677 type: "SET_FREEFORM_FALLBACK_BLOCK_NAME",
6678 name
6679 };
6680 }
6681 function setUnregisteredFallbackBlockName(name) {
6682 return {
6683 type: "SET_UNREGISTERED_FALLBACK_BLOCK_NAME",
6684 name
6685 };
6686 }
6687 function setGroupingBlockName2(name) {
6688 return {
6689 type: "SET_GROUPING_BLOCK_NAME",
6690 name
6691 };
6692 }
6693 function setCategories(categories2) {
6694 return {
6695 type: "SET_CATEGORIES",
6696 categories: categories2
6697 };
6698 }
6699 function updateCategory(slug, category) {
6700 return {
6701 type: "UPDATE_CATEGORY",
6702 slug,
6703 category
6704 };
6705 }
6706 function addBlockCollection(namespace, title, icon) {
6707 return {
6708 type: "ADD_BLOCK_COLLECTION",
6709 namespace,
6710 title,
6711 icon
6712 };
6713 }
6714 function removeBlockCollection(namespace) {
6715 return {
6716 type: "REMOVE_BLOCK_COLLECTION",
6717 namespace
6718 };
6719 }
6720
6721 // packages/blocks/build-module/store/private-actions.mjs
6722 var private_actions_exports = {};
6723 __export(private_actions_exports, {
6724 addBlockBindingsSource: () => addBlockBindingsSource,
6725 addBootstrappedBlockType: () => addBootstrappedBlockType,
6726 addUnprocessedBlockType: () => addUnprocessedBlockType,
6727 removeBlockBindingsSource: () => removeBlockBindingsSource
6728 });
6729 function addBootstrappedBlockType(name, blockType) {
6730 return {
6731 type: "ADD_BOOTSTRAPPED_BLOCK_TYPE",
6732 name,
6733 blockType
6734 };
6735 }
6736 function addUnprocessedBlockType(name, blockType) {
6737 return ({ dispatch: dispatch3 }) => {
6738 dispatch3({ type: "ADD_UNPROCESSED_BLOCK_TYPE", name, blockType });
6739 const processedBlockType = dispatch3(
6740 processBlockType(name, blockType)
6741 );
6742 if (!processedBlockType) {
6743 return;
6744 }
6745 dispatch3.addBlockTypes(processedBlockType);
6746 };
6747 }
6748 function addBlockBindingsSource(source) {
6749 return {
6750 type: "ADD_BLOCK_BINDINGS_SOURCE",
6751 name: source.name,
6752 label: source.label,
6753 usesContext: source.usesContext,
6754 getValues: source.getValues,
6755 setValues: source.setValues,
6756 canUserEditValue: source.canUserEditValue,
6757 getFieldsList: source.getFieldsList
6758 };
6759 }
6760 function removeBlockBindingsSource(name) {
6761 return {
6762 type: "REMOVE_BLOCK_BINDINGS_SOURCE",
6763 name
6764 };
6765 }
6766
6767 // packages/blocks/build-module/store/constants.mjs
6768 var STORE_NAME = "core/blocks";
6769
6770 // packages/blocks/build-module/store/index.mjs
6771 var store = (0, import_data5.createReduxStore)(STORE_NAME, {
6772 reducer: reducer_default,
6773 selectors: selectors_exports,
6774 actions: actions_exports
6775 });
6776 (0, import_data5.register)(store);
6777 unlock(store).registerPrivateSelectors(private_selectors_exports);
6778 unlock(store).registerPrivateActions(private_actions_exports);
6779
6780 // node_modules/uuid/dist/esm-browser/rng.js
6781 var getRandomValues;
6782 var rnds8 = new Uint8Array(16);
6783 function rng() {
6784 if (!getRandomValues) {
6785 getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
6786 if (!getRandomValues) {
6787 throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
6788 }
6789 }
6790 return getRandomValues(rnds8);
6791 }
6792
6793 // node_modules/uuid/dist/esm-browser/stringify.js
6794 var byteToHex = [];
6795 for (let i2 = 0; i2 < 256; ++i2) {
6796 byteToHex.push((i2 + 256).toString(16).slice(1));
6797 }
6798 function unsafeStringify(arr, offset = 0) {
6799 return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
6800 }
6801
6802 // node_modules/uuid/dist/esm-browser/native.js
6803 var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
6804 var native_default = {
6805 randomUUID
6806 };
6807
6808 // node_modules/uuid/dist/esm-browser/v4.js
6809 function v4(options, buf, offset) {
6810 if (native_default.randomUUID && !buf && !options) {
6811 return native_default.randomUUID();
6812 }
6813 options = options || {};
6814 const rnds = options.random || (options.rng || rng)();
6815 rnds[6] = rnds[6] & 15 | 64;
6816 rnds[8] = rnds[8] & 63 | 128;
6817 if (buf) {
6818 offset = offset || 0;
6819 for (let i2 = 0; i2 < 16; ++i2) {
6820 buf[offset + i2] = rnds[i2];
6821 }
6822 return buf;
6823 }
6824 return unsafeStringify(rnds);
6825 }
6826 var v4_default = v4;
6827
6828 // packages/blocks/build-module/api/factory.mjs
6829 var import_hooks2 = __toESM(require_hooks(), 1);
6830 function createBlock(name, attributes = {}, innerBlocks = []) {
6831 if (!isBlockRegistered(name)) {
6832 return createBlock("core/missing", {
6833 originalName: name,
6834 originalContent: "",
6835 originalUndelimitedContent: ""
6836 });
6837 }
6838 const sanitizedAttributes = __experimentalSanitizeBlockAttributes(
6839 name,
6840 attributes
6841 );
6842 const clientId = v4_default();
6843 return {
6844 clientId,
6845 name,
6846 isValid: true,
6847 attributes: sanitizedAttributes,
6848 innerBlocks
6849 };
6850 }
6851 function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) {
6852 return innerBlocksOrTemplate.map((innerBlock) => {
6853 const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [
6854 innerBlock.name,
6855 innerBlock.attributes,
6856 innerBlock.innerBlocks
6857 ];
6858 const [name, attributes, innerBlocks = []] = innerBlockTemplate;
6859 return createBlock(
6860 name,
6861 attributes,
6862 createBlocksFromInnerBlocksTemplate(
6863 innerBlocks
6864 )
6865 );
6866 });
6867 }
6868 function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) {
6869 const { name } = block;
6870 if (!isBlockRegistered(name)) {
6871 return createBlock("core/missing", {
6872 originalName: name,
6873 originalContent: "",
6874 originalUndelimitedContent: ""
6875 });
6876 }
6877 const clientId = v4_default();
6878 const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, {
6879 ...block.attributes,
6880 ...mergeAttributes
6881 });
6882 return {
6883 ...block,
6884 clientId,
6885 attributes: sanitizedAttributes,
6886 innerBlocks: newInnerBlocks || block.innerBlocks.map(
6887 (innerBlock) => __experimentalCloneSanitizedBlock(innerBlock)
6888 )
6889 };
6890 }
6891 function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) {
6892 const clientId = v4_default();
6893 return {
6894 ...block,
6895 clientId,
6896 attributes: {
6897 ...block.attributes,
6898 ...mergeAttributes
6899 },
6900 innerBlocks: newInnerBlocks || block.innerBlocks.map((innerBlock) => cloneBlock(innerBlock))
6901 };
6902 }
6903 var isPossibleTransformForSource = (transform, direction, blocks) => {
6904 if (!blocks.length) {
6905 return false;
6906 }
6907 const isMultiBlock = blocks.length > 1;
6908 const firstBlockName = blocks[0].name;
6909 const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
6910 if (!isValidForMultiBlocks) {
6911 return false;
6912 }
6913 if (!isWildcardBlockTransform(transform) && !blocks.every((block) => block.name === firstBlockName)) {
6914 return false;
6915 }
6916 const isBlockType = transform.type === "block";
6917 if (!isBlockType) {
6918 return false;
6919 }
6920 const sourceBlock = blocks[0];
6921 const hasMatchingName = direction !== "from" || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
6922 if (!hasMatchingName) {
6923 return false;
6924 }
6925 if (!isMultiBlock && direction === "from" && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) {
6926 return false;
6927 }
6928 if (!maybeCheckTransformIsMatch(transform, blocks)) {
6929 return false;
6930 }
6931 return true;
6932 };
6933 var getBlockTypesForPossibleFromTransforms = (blocks) => {
6934 if (!blocks.length) {
6935 return [];
6936 }
6937 const allBlockTypes = getBlockTypes();
6938 const blockTypesWithPossibleFromTransforms = allBlockTypes.filter(
6939 (blockType) => {
6940 const fromTransforms = getBlockTransforms("from", blockType.name);
6941 return !!findTransform(fromTransforms, (transform) => {
6942 return isPossibleTransformForSource(
6943 transform,
6944 "from",
6945 blocks
6946 );
6947 });
6948 }
6949 );
6950 return blockTypesWithPossibleFromTransforms;
6951 };
6952 var getBlockTypesForPossibleToTransforms = (blocks) => {
6953 if (!blocks.length) {
6954 return [];
6955 }
6956 const sourceBlock = blocks[0];
6957 const blockType = getBlockType(sourceBlock.name);
6958 const transformsTo = blockType ? getBlockTransforms("to", blockType.name) : [];
6959 const possibleTransforms = transformsTo.filter((transform) => {
6960 return transform && isPossibleTransformForSource(transform, "to", blocks);
6961 });
6962 const blockNames = possibleTransforms.map((transformation) => transformation.blocks).flat();
6963 return blockNames.filter((name) => !!name).map(getBlockType).filter((bt) => !!bt);
6964 };
6965 var isWildcardBlockTransform = (t3) => !!t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*");
6966 var isContainerGroupBlock = (name) => name === getGroupingBlockName();
6967 function getPossibleBlockTransformations(blocks) {
6968 if (!blocks.length) {
6969 return [];
6970 }
6971 const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks);
6972 const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks);
6973 return [
6974 .../* @__PURE__ */ new Set([
6975 ...blockTypesForFromTransforms,
6976 ...blockTypesForToTransforms
6977 ])
6978 ];
6979 }
6980 function findTransform(transforms, predicate) {
6981 const hooks = (0, import_hooks2.createHooks)();
6982 for (let i2 = 0; i2 < transforms.length; i2++) {
6983 const candidate = transforms[i2];
6984 if (predicate(candidate)) {
6985 hooks.addFilter(
6986 "transform",
6987 "transform/" + i2.toString(),
6988 (result) => result ? result : candidate,
6989 candidate.priority
6990 );
6991 }
6992 }
6993 return hooks.applyFilters("transform", null);
6994 }
6995 function getBlockTransforms(direction, blockTypeOrName) {
6996 if (blockTypeOrName === void 0) {
6997 return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat();
6998 }
6999 const blockType = normalizeBlockType(blockTypeOrName);
7000 const { name: blockName, transforms } = blockType || {};
7001 if (!transforms || !Array.isArray(transforms[direction])) {
7002 return [];
7003 }
7004 const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms);
7005 const filteredTransforms = usingMobileTransformations ? transforms[direction].filter((t3) => {
7006 if (t3.type === "raw") {
7007 return true;
7008 }
7009 if (t3.type === "prefix") {
7010 return true;
7011 }
7012 if (!t3.blocks || !t3.blocks.length) {
7013 return false;
7014 }
7015 if (isWildcardBlockTransform(t3)) {
7016 return true;
7017 }
7018 return t3.blocks.every(
7019 (transformBlockName) => transforms.supportedMobileTransforms.includes(
7020 transformBlockName
7021 )
7022 );
7023 }) : transforms[direction];
7024 return filteredTransforms.map((transform) => ({
7025 ...transform,
7026 blockName,
7027 usingMobileTransformations
7028 }));
7029 }
7030 function maybeCheckTransformIsMatch(transform, blocks) {
7031 if (typeof transform.isMatch !== "function") {
7032 return true;
7033 }
7034 const sourceBlock = blocks[0];
7035 const attributes = transform.isMultiBlock ? blocks.map((block2) => block2.attributes) : sourceBlock.attributes;
7036 const block = transform.isMultiBlock ? blocks : sourceBlock;
7037 return transform.isMatch(attributes, block);
7038 }
7039 function switchToBlockType(blocks, name) {
7040 const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
7041 const isMultiBlock = blocksArray.length > 1;
7042 const firstBlock = blocksArray[0];
7043 const sourceName = firstBlock.name;
7044 const transformationsFrom = getBlockTransforms("from", name);
7045 const transformationsTo = getBlockTransforms("to", sourceName);
7046 const transformation = findTransform(
7047 transformationsTo,
7048 (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray)
7049 ) || findTransform(
7050 transformationsFrom,
7051 (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray)
7052 );
7053 if (!transformation) {
7054 return null;
7055 }
7056 let transformationResults;
7057 if (transformation.isMultiBlock) {
7058 if ("__experimentalConvert" in transformation) {
7059 transformationResults = transformation.__experimentalConvert(blocksArray);
7060 } else {
7061 transformationResults = transformation.transform(
7062 blocksArray.map((currentBlock) => currentBlock.attributes),
7063 blocksArray.map((currentBlock) => currentBlock.innerBlocks)
7064 );
7065 }
7066 } else if ("__experimentalConvert" in transformation) {
7067 transformationResults = transformation.__experimentalConvert(firstBlock);
7068 } else {
7069 transformationResults = transformation.transform(
7070 firstBlock.attributes,
7071 firstBlock.innerBlocks
7072 );
7073 }
7074 if (transformationResults === null || typeof transformationResults !== "object") {
7075 return null;
7076 }
7077 transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults];
7078 if (transformationResults.some(
7079 (result) => !getBlockType(result.name)
7080 )) {
7081 return null;
7082 }
7083 const hasSwitchedBlock = transformationResults.some(
7084 (result) => result.name === name
7085 );
7086 if (!hasSwitchedBlock) {
7087 return null;
7088 }
7089 const ret = transformationResults.map((result, index, results) => {
7090 return (0, import_hooks2.applyFilters)(
7091 "blocks.switchToBlockType.transformedBlock",
7092 result,
7093 blocks,
7094 index,
7095 results
7096 );
7097 });
7098 return ret;
7099 }
7100 var getBlockFromExample = (name, example) => createBlock(
7101 name,
7102 example.attributes,
7103 (example.innerBlocks ?? []).map(
7104 (innerBlock) => getBlockFromExample(innerBlock.name, innerBlock)
7105 )
7106 );
7107
7108 // packages/blocks/build-module/api/parser/index.mjs
7109 var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser(), 1);
7110 var import_autop2 = __toESM(require_autop(), 1);
7111
7112 // packages/blocks/build-module/api/serializer.mjs
7113 var import_element2 = __toESM(require_element(), 1);
7114 var import_hooks3 = __toESM(require_hooks(), 1);
7115 var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1);
7116 var import_autop = __toESM(require_autop(), 1);
7117 var import_deprecated6 = __toESM(require_deprecated(), 1);
7118
7119 // packages/blocks/build-module/api/parser/serialize-raw-block.mjs
7120 function serializeRawBlock(rawBlock, options = {}) {
7121 const { isCommentDelimited = true } = options;
7122 const {
7123 blockName,
7124 attrs = {},
7125 innerBlocks = [],
7126 innerContent = []
7127 } = rawBlock;
7128 let childIndex = 0;
7129 const content = innerContent.map(
7130 (item) => (
7131 // `null` denotes a nested block, otherwise we have an HTML fragment.
7132 item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options)
7133 )
7134 ).join("\n").replace(/\n+/g, "\n").trim();
7135 return isCommentDelimited ? getCommentDelimitedContent(blockName ?? void 0, attrs, content) : content;
7136 }
7137
7138 // packages/blocks/build-module/api/serializer.mjs
7139 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
7140 function getBlockDefaultClassName(blockName) {
7141 const className = "wp-block-" + blockName.replace(/\//, "-").replace(/^core-/, "");
7142 return (0, import_hooks3.applyFilters)(
7143 "blocks.getBlockDefaultClassName",
7144 className,
7145 blockName
7146 );
7147 }
7148 function getBlockMenuDefaultClassName(blockName) {
7149 const className = "editor-block-list-item-" + blockName.replace(/\//, "-").replace(/^core-/, "");
7150 return (0, import_hooks3.applyFilters)(
7151 "blocks.getBlockMenuDefaultClassName",
7152 className,
7153 blockName
7154 );
7155 }
7156 var blockPropsProvider = {};
7157 var innerBlocksPropsProvider = {};
7158 function getBlockProps(props = {}) {
7159 const { blockType, attributes } = blockPropsProvider;
7160 return getBlockProps.skipFilters ? props : (0, import_hooks3.applyFilters)(
7161 "blocks.getSaveContent.extraProps",
7162 { ...props },
7163 blockType,
7164 attributes
7165 );
7166 }
7167 function getInnerBlocksProps(props = {}) {
7168 const { innerBlocks } = innerBlocksPropsProvider;
7169 if (!Array.isArray(innerBlocks)) {
7170 return { ...props, children: innerBlocks };
7171 }
7172 const html2 = serialize(innerBlocks, { isInnerBlocks: true });
7173 const children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element2.RawHTML, { children: html2 });
7174 return { ...props, children };
7175 }
7176 function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) {
7177 const blockType = normalizeBlockType(blockTypeOrName);
7178 if (!blockType?.save) {
7179 return null;
7180 }
7181 let save = blockType.save;
7182 if (save.prototype instanceof import_element2.Component) {
7183 const SaveClass = save;
7184 const instance = new SaveClass({ attributes });
7185 save = instance.render.bind(instance);
7186 }
7187 blockPropsProvider.blockType = blockType;
7188 blockPropsProvider.attributes = attributes;
7189 innerBlocksPropsProvider.innerBlocks = innerBlocks;
7190 let element = save({
7191 attributes,
7192 innerBlocks
7193 });
7194 if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !((blockType.apiVersion ?? 0) > 1)) {
7195 const props = (0, import_hooks3.applyFilters)(
7196 "blocks.getSaveContent.extraProps",
7197 { ...element.props },
7198 blockType,
7199 attributes
7200 );
7201 if (!(0, import_is_shallow_equal.isShallowEqual)(props, element.props)) {
7202 element = (0, import_element2.cloneElement)(
7203 element,
7204 props
7205 );
7206 }
7207 }
7208 return (0, import_hooks3.applyFilters)(
7209 "blocks.getSaveElement",
7210 element,
7211 blockType,
7212 attributes
7213 );
7214 }
7215 function getSaveContent(blockTypeOrName, attributes, innerBlocks) {
7216 const blockType = normalizeBlockType(
7217 blockTypeOrName
7218 );
7219 if (!blockType) {
7220 return "";
7221 }
7222 return (0, import_element2.renderToString)(
7223 getSaveElement(blockType, attributes, innerBlocks)
7224 );
7225 }
7226 function getCommentAttributes(blockType, attributes) {
7227 return Object.entries(blockType.attributes ?? {}).reduce(
7228 (accumulator, [key, attributeSchema]) => {
7229 const value = attributes[key];
7230 if (void 0 === value) {
7231 return accumulator;
7232 }
7233 if (attributeSchema.source !== void 0) {
7234 return accumulator;
7235 }
7236 if (attributeSchema.role === "local") {
7237 return accumulator;
7238 }
7239 if (attributeSchema.__experimentalRole === "local") {
7240 (0, import_deprecated6.default)("__experimentalRole attribute", {
7241 since: "6.7",
7242 version: "6.8",
7243 alternative: "role attribute",
7244 hint: `Check the block.json of the ${blockType?.name} block.`
7245 });
7246 return accumulator;
7247 }
7248 if ("default" in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) {
7249 return accumulator;
7250 }
7251 accumulator[key] = value;
7252 return accumulator;
7253 },
7254 {}
7255 );
7256 }
7257 function serializeAttributes(attributes) {
7258 return JSON.stringify(attributes).replaceAll("\\\\", "\\u005c").replaceAll("--", "\\u002d\\u002d").replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("&", "\\u0026").replaceAll('\\"', "\\u0022");
7259 }
7260 function getBlockInnerHTML(block) {
7261 let saveContent = block.originalContent ?? "";
7262 if (block.isValid || block.innerBlocks.length) {
7263 try {
7264 saveContent = getSaveContent(
7265 block.name,
7266 block.attributes,
7267 block.innerBlocks
7268 );
7269 } catch {
7270 }
7271 }
7272 return saveContent;
7273 }
7274 function getCommentDelimitedContent(rawBlockName, attributes, content) {
7275 const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + " " : "";
7276 const blockName = rawBlockName?.startsWith("core/") ? rawBlockName.slice(5) : rawBlockName;
7277 if (!content) {
7278 return `<!-- wp:${blockName} ${serializedAttributes}/-->`;
7279 }
7280 return `<!-- wp:${blockName} ${serializedAttributes}-->
7281 ` + content + `
7282 <!-- /wp:${blockName} -->`;
7283 }
7284 function serializeBlock(block, { isInnerBlocks = false } = {}) {
7285 if (!block.isValid && block.__unstableBlockSource) {
7286 return serializeRawBlock(block.__unstableBlockSource);
7287 }
7288 const blockName = block.name;
7289 const saveContent = getBlockInnerHTML(block);
7290 if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
7291 return saveContent;
7292 }
7293 const blockType = getBlockType(blockName);
7294 if (!blockType) {
7295 return saveContent;
7296 }
7297 const saveAttributes = getCommentAttributes(blockType, block.attributes);
7298 return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
7299 }
7300 var __unstableSerializeAndClean = /* @__PURE__ */ (() => {
7301 const cache = /* @__PURE__ */ new WeakMap();
7302 return (blocks) => {
7303 const cached = cache.get(blocks);
7304 if (cached !== void 0) {
7305 return cached;
7306 }
7307 let effectiveBlocks = blocks;
7308 if (effectiveBlocks.length === 1 && isUnmodifiedDefaultBlock(effectiveBlocks[0])) {
7309 effectiveBlocks = [];
7310 }
7311 let content = serialize(effectiveBlocks);
7312 if (effectiveBlocks.length === 1 && effectiveBlocks[0].name === getFreeformContentHandlerName() && effectiveBlocks[0].name === "core/freeform") {
7313 content = (0, import_autop.removep)(content);
7314 }
7315 cache.set(blocks, content);
7316 return content;
7317 };
7318 })();
7319 function serialize(blocks, options) {
7320 const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
7321 return blocksArray.map((block) => serializeBlock(block, options)).join("\n\n");
7322 }
7323
7324 // node_modules/simple-html-tokenizer/dist/es6/index.js
7325 var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
7326 var CHARCODE = /^#([0-9]+)$/;
7327 var NAMED = /^([A-Za-z0-9]+)$/;
7328 var EntityParser = (
7329 /** @class */
7330 (function() {
7331 function EntityParser2(named) {
7332 this.named = named;
7333 }
7334 EntityParser2.prototype.parse = function(entity) {
7335 if (!entity) {
7336 return;
7337 }
7338 var matches = entity.match(HEXCHARCODE);
7339 if (matches) {
7340 return String.fromCharCode(parseInt(matches[1], 16));
7341 }
7342 matches = entity.match(CHARCODE);
7343 if (matches) {
7344 return String.fromCharCode(parseInt(matches[1], 10));
7345 }
7346 matches = entity.match(NAMED);
7347 if (matches) {
7348 return this.named[matches[1]];
7349 }
7350 };
7351 return EntityParser2;
7352 })()
7353 );
7354 var WSP = /[\t\n\f ]/;
7355 var ALPHA = /[A-Za-z]/;
7356 var CRLF = /\r\n?/g;
7357 function isSpace(char) {
7358 return WSP.test(char);
7359 }
7360 function isAlpha(char) {
7361 return ALPHA.test(char);
7362 }
7363 function preprocessInput(input) {
7364 return input.replace(CRLF, "\n");
7365 }
7366 var EventedTokenizer = (
7367 /** @class */
7368 (function() {
7369 function EventedTokenizer2(delegate, entityParser) {
7370 this.delegate = delegate;
7371 this.entityParser = entityParser;
7372 this.state = "beforeData";
7373 this.line = -1;
7374 this.column = -1;
7375 this.input = "";
7376 this.index = -1;
7377 this.tagNameBuffer = "";
7378 this.states = {
7379 beforeData: function() {
7380 var char = this.peek();
7381 if (char === "<") {
7382 this.transitionTo(
7383 "tagOpen"
7384 /* tagOpen */
7385 );
7386 this.markTagStart();
7387 this.consume();
7388 } else {
7389 if (char === "\n") {
7390 var tag = this.tagNameBuffer.toLowerCase();
7391 if (tag === "pre" || tag === "textarea") {
7392 this.consume();
7393 }
7394 }
7395 this.transitionTo(
7396 "data"
7397 /* data */
7398 );
7399 this.delegate.beginData();
7400 }
7401 },
7402 data: function() {
7403 var char = this.peek();
7404 if (char === "<") {
7405 this.delegate.finishData();
7406 this.transitionTo(
7407 "tagOpen"
7408 /* tagOpen */
7409 );
7410 this.markTagStart();
7411 this.consume();
7412 } else if (char === "&") {
7413 this.consume();
7414 this.delegate.appendToData(this.consumeCharRef() || "&");
7415 } else {
7416 this.consume();
7417 this.delegate.appendToData(char);
7418 }
7419 },
7420 tagOpen: function() {
7421 var char = this.consume();
7422 if (char === "!") {
7423 this.transitionTo(
7424 "markupDeclarationOpen"
7425 /* markupDeclarationOpen */
7426 );
7427 } else if (char === "/") {
7428 this.transitionTo(
7429 "endTagOpen"
7430 /* endTagOpen */
7431 );
7432 } else if (char === "@" || char === ":" || isAlpha(char)) {
7433 this.transitionTo(
7434 "tagName"
7435 /* tagName */
7436 );
7437 this.tagNameBuffer = "";
7438 this.delegate.beginStartTag();
7439 this.appendToTagName(char);
7440 }
7441 },
7442 markupDeclarationOpen: function() {
7443 var char = this.consume();
7444 if (char === "-" && this.input.charAt(this.index) === "-") {
7445 this.consume();
7446 this.transitionTo(
7447 "commentStart"
7448 /* commentStart */
7449 );
7450 this.delegate.beginComment();
7451 }
7452 },
7453 commentStart: function() {
7454 var char = this.consume();
7455 if (char === "-") {
7456 this.transitionTo(
7457 "commentStartDash"
7458 /* commentStartDash */
7459 );
7460 } else if (char === ">") {
7461 this.delegate.finishComment();
7462 this.transitionTo(
7463 "beforeData"
7464 /* beforeData */
7465 );
7466 } else {
7467 this.delegate.appendToCommentData(char);
7468 this.transitionTo(
7469 "comment"
7470 /* comment */
7471 );
7472 }
7473 },
7474 commentStartDash: function() {
7475 var char = this.consume();
7476 if (char === "-") {
7477 this.transitionTo(
7478 "commentEnd"
7479 /* commentEnd */
7480 );
7481 } else if (char === ">") {
7482 this.delegate.finishComment();
7483 this.transitionTo(
7484 "beforeData"
7485 /* beforeData */
7486 );
7487 } else {
7488 this.delegate.appendToCommentData("-");
7489 this.transitionTo(
7490 "comment"
7491 /* comment */
7492 );
7493 }
7494 },
7495 comment: function() {
7496 var char = this.consume();
7497 if (char === "-") {
7498 this.transitionTo(
7499 "commentEndDash"
7500 /* commentEndDash */
7501 );
7502 } else {
7503 this.delegate.appendToCommentData(char);
7504 }
7505 },
7506 commentEndDash: function() {
7507 var char = this.consume();
7508 if (char === "-") {
7509 this.transitionTo(
7510 "commentEnd"
7511 /* commentEnd */
7512 );
7513 } else {
7514 this.delegate.appendToCommentData("-" + char);
7515 this.transitionTo(
7516 "comment"
7517 /* comment */
7518 );
7519 }
7520 },
7521 commentEnd: function() {
7522 var char = this.consume();
7523 if (char === ">") {
7524 this.delegate.finishComment();
7525 this.transitionTo(
7526 "beforeData"
7527 /* beforeData */
7528 );
7529 } else {
7530 this.delegate.appendToCommentData("--" + char);
7531 this.transitionTo(
7532 "comment"
7533 /* comment */
7534 );
7535 }
7536 },
7537 tagName: function() {
7538 var char = this.consume();
7539 if (isSpace(char)) {
7540 this.transitionTo(
7541 "beforeAttributeName"
7542 /* beforeAttributeName */
7543 );
7544 } else if (char === "/") {
7545 this.transitionTo(
7546 "selfClosingStartTag"
7547 /* selfClosingStartTag */
7548 );
7549 } else if (char === ">") {
7550 this.delegate.finishTag();
7551 this.transitionTo(
7552 "beforeData"
7553 /* beforeData */
7554 );
7555 } else {
7556 this.appendToTagName(char);
7557 }
7558 },
7559 beforeAttributeName: function() {
7560 var char = this.peek();
7561 if (isSpace(char)) {
7562 this.consume();
7563 return;
7564 } else if (char === "/") {
7565 this.transitionTo(
7566 "selfClosingStartTag"
7567 /* selfClosingStartTag */
7568 );
7569 this.consume();
7570 } else if (char === ">") {
7571 this.consume();
7572 this.delegate.finishTag();
7573 this.transitionTo(
7574 "beforeData"
7575 /* beforeData */
7576 );
7577 } else if (char === "=") {
7578 this.delegate.reportSyntaxError("attribute name cannot start with equals sign");
7579 this.transitionTo(
7580 "attributeName"
7581 /* attributeName */
7582 );
7583 this.delegate.beginAttribute();
7584 this.consume();
7585 this.delegate.appendToAttributeName(char);
7586 } else {
7587 this.transitionTo(
7588 "attributeName"
7589 /* attributeName */
7590 );
7591 this.delegate.beginAttribute();
7592 }
7593 },
7594 attributeName: function() {
7595 var char = this.peek();
7596 if (isSpace(char)) {
7597 this.transitionTo(
7598 "afterAttributeName"
7599 /* afterAttributeName */
7600 );
7601 this.consume();
7602 } else if (char === "/") {
7603 this.delegate.beginAttributeValue(false);
7604 this.delegate.finishAttributeValue();
7605 this.consume();
7606 this.transitionTo(
7607 "selfClosingStartTag"
7608 /* selfClosingStartTag */
7609 );
7610 } else if (char === "=") {
7611 this.transitionTo(
7612 "beforeAttributeValue"
7613 /* beforeAttributeValue */
7614 );
7615 this.consume();
7616 } else if (char === ">") {
7617 this.delegate.beginAttributeValue(false);
7618 this.delegate.finishAttributeValue();
7619 this.consume();
7620 this.delegate.finishTag();
7621 this.transitionTo(
7622 "beforeData"
7623 /* beforeData */
7624 );
7625 } else if (char === '"' || char === "'" || char === "<") {
7626 this.delegate.reportSyntaxError(char + " is not a valid character within attribute names");
7627 this.consume();
7628 this.delegate.appendToAttributeName(char);
7629 } else {
7630 this.consume();
7631 this.delegate.appendToAttributeName(char);
7632 }
7633 },
7634 afterAttributeName: function() {
7635 var char = this.peek();
7636 if (isSpace(char)) {
7637 this.consume();
7638 return;
7639 } else if (char === "/") {
7640 this.delegate.beginAttributeValue(false);
7641 this.delegate.finishAttributeValue();
7642 this.consume();
7643 this.transitionTo(
7644 "selfClosingStartTag"
7645 /* selfClosingStartTag */
7646 );
7647 } else if (char === "=") {
7648 this.consume();
7649 this.transitionTo(
7650 "beforeAttributeValue"
7651 /* beforeAttributeValue */
7652 );
7653 } else if (char === ">") {
7654 this.delegate.beginAttributeValue(false);
7655 this.delegate.finishAttributeValue();
7656 this.consume();
7657 this.delegate.finishTag();
7658 this.transitionTo(
7659 "beforeData"
7660 /* beforeData */
7661 );
7662 } else {
7663 this.delegate.beginAttributeValue(false);
7664 this.delegate.finishAttributeValue();
7665 this.transitionTo(
7666 "attributeName"
7667 /* attributeName */
7668 );
7669 this.delegate.beginAttribute();
7670 this.consume();
7671 this.delegate.appendToAttributeName(char);
7672 }
7673 },
7674 beforeAttributeValue: function() {
7675 var char = this.peek();
7676 if (isSpace(char)) {
7677 this.consume();
7678 } else if (char === '"') {
7679 this.transitionTo(
7680 "attributeValueDoubleQuoted"
7681 /* attributeValueDoubleQuoted */
7682 );
7683 this.delegate.beginAttributeValue(true);
7684 this.consume();
7685 } else if (char === "'") {
7686 this.transitionTo(
7687 "attributeValueSingleQuoted"
7688 /* attributeValueSingleQuoted */
7689 );
7690 this.delegate.beginAttributeValue(true);
7691 this.consume();
7692 } else if (char === ">") {
7693 this.delegate.beginAttributeValue(false);
7694 this.delegate.finishAttributeValue();
7695 this.consume();
7696 this.delegate.finishTag();
7697 this.transitionTo(
7698 "beforeData"
7699 /* beforeData */
7700 );
7701 } else {
7702 this.transitionTo(
7703 "attributeValueUnquoted"
7704 /* attributeValueUnquoted */
7705 );
7706 this.delegate.beginAttributeValue(false);
7707 this.consume();
7708 this.delegate.appendToAttributeValue(char);
7709 }
7710 },
7711 attributeValueDoubleQuoted: function() {
7712 var char = this.consume();
7713 if (char === '"') {
7714 this.delegate.finishAttributeValue();
7715 this.transitionTo(
7716 "afterAttributeValueQuoted"
7717 /* afterAttributeValueQuoted */
7718 );
7719 } else if (char === "&") {
7720 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&");
7721 } else {
7722 this.delegate.appendToAttributeValue(char);
7723 }
7724 },
7725 attributeValueSingleQuoted: function() {
7726 var char = this.consume();
7727 if (char === "'") {
7728 this.delegate.finishAttributeValue();
7729 this.transitionTo(
7730 "afterAttributeValueQuoted"
7731 /* afterAttributeValueQuoted */
7732 );
7733 } else if (char === "&") {
7734 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&");
7735 } else {
7736 this.delegate.appendToAttributeValue(char);
7737 }
7738 },
7739 attributeValueUnquoted: function() {
7740 var char = this.peek();
7741 if (isSpace(char)) {
7742 this.delegate.finishAttributeValue();
7743 this.consume();
7744 this.transitionTo(
7745 "beforeAttributeName"
7746 /* beforeAttributeName */
7747 );
7748 } else if (char === "/") {
7749 this.delegate.finishAttributeValue();
7750 this.consume();
7751 this.transitionTo(
7752 "selfClosingStartTag"
7753 /* selfClosingStartTag */
7754 );
7755 } else if (char === "&") {
7756 this.consume();
7757 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&");
7758 } else if (char === ">") {
7759 this.delegate.finishAttributeValue();
7760 this.consume();
7761 this.delegate.finishTag();
7762 this.transitionTo(
7763 "beforeData"
7764 /* beforeData */
7765 );
7766 } else {
7767 this.consume();
7768 this.delegate.appendToAttributeValue(char);
7769 }
7770 },
7771 afterAttributeValueQuoted: function() {
7772 var char = this.peek();
7773 if (isSpace(char)) {
7774 this.consume();
7775 this.transitionTo(
7776 "beforeAttributeName"
7777 /* beforeAttributeName */
7778 );
7779 } else if (char === "/") {
7780 this.consume();
7781 this.transitionTo(
7782 "selfClosingStartTag"
7783 /* selfClosingStartTag */
7784 );
7785 } else if (char === ">") {
7786 this.consume();
7787 this.delegate.finishTag();
7788 this.transitionTo(
7789 "beforeData"
7790 /* beforeData */
7791 );
7792 } else {
7793 this.transitionTo(
7794 "beforeAttributeName"
7795 /* beforeAttributeName */
7796 );
7797 }
7798 },
7799 selfClosingStartTag: function() {
7800 var char = this.peek();
7801 if (char === ">") {
7802 this.consume();
7803 this.delegate.markTagAsSelfClosing();
7804 this.delegate.finishTag();
7805 this.transitionTo(
7806 "beforeData"
7807 /* beforeData */
7808 );
7809 } else {
7810 this.transitionTo(
7811 "beforeAttributeName"
7812 /* beforeAttributeName */
7813 );
7814 }
7815 },
7816 endTagOpen: function() {
7817 var char = this.consume();
7818 if (char === "@" || char === ":" || isAlpha(char)) {
7819 this.transitionTo(
7820 "tagName"
7821 /* tagName */
7822 );
7823 this.tagNameBuffer = "";
7824 this.delegate.beginEndTag();
7825 this.appendToTagName(char);
7826 }
7827 }
7828 };
7829 this.reset();
7830 }
7831 EventedTokenizer2.prototype.reset = function() {
7832 this.transitionTo(
7833 "beforeData"
7834 /* beforeData */
7835 );
7836 this.input = "";
7837 this.index = 0;
7838 this.line = 1;
7839 this.column = 0;
7840 this.delegate.reset();
7841 };
7842 EventedTokenizer2.prototype.transitionTo = function(state) {
7843 this.state = state;
7844 };
7845 EventedTokenizer2.prototype.tokenize = function(input) {
7846 this.reset();
7847 this.tokenizePart(input);
7848 this.tokenizeEOF();
7849 };
7850 EventedTokenizer2.prototype.tokenizePart = function(input) {
7851 this.input += preprocessInput(input);
7852 while (this.index < this.input.length) {
7853 var handler = this.states[this.state];
7854 if (handler !== void 0) {
7855 handler.call(this);
7856 } else {
7857 throw new Error("unhandled state " + this.state);
7858 }
7859 }
7860 };
7861 EventedTokenizer2.prototype.tokenizeEOF = function() {
7862 this.flushData();
7863 };
7864 EventedTokenizer2.prototype.flushData = function() {
7865 if (this.state === "data") {
7866 this.delegate.finishData();
7867 this.transitionTo(
7868 "beforeData"
7869 /* beforeData */
7870 );
7871 }
7872 };
7873 EventedTokenizer2.prototype.peek = function() {
7874 return this.input.charAt(this.index);
7875 };
7876 EventedTokenizer2.prototype.consume = function() {
7877 var char = this.peek();
7878 this.index++;
7879 if (char === "\n") {
7880 this.line++;
7881 this.column = 0;
7882 } else {
7883 this.column++;
7884 }
7885 return char;
7886 };
7887 EventedTokenizer2.prototype.consumeCharRef = function() {
7888 var endIndex = this.input.indexOf(";", this.index);
7889 if (endIndex === -1) {
7890 return;
7891 }
7892 var entity = this.input.slice(this.index, endIndex);
7893 var chars = this.entityParser.parse(entity);
7894 if (chars) {
7895 var count = entity.length;
7896 while (count) {
7897 this.consume();
7898 count--;
7899 }
7900 this.consume();
7901 return chars;
7902 }
7903 };
7904 EventedTokenizer2.prototype.markTagStart = function() {
7905 this.delegate.tagOpen();
7906 };
7907 EventedTokenizer2.prototype.appendToTagName = function(char) {
7908 this.tagNameBuffer += char;
7909 this.delegate.appendToTagName(char);
7910 };
7911 return EventedTokenizer2;
7912 })()
7913 );
7914 var Tokenizer = (
7915 /** @class */
7916 (function() {
7917 function Tokenizer2(entityParser, options) {
7918 if (options === void 0) {
7919 options = {};
7920 }
7921 this.options = options;
7922 this.token = null;
7923 this.startLine = 1;
7924 this.startColumn = 0;
7925 this.tokens = [];
7926 this.tokenizer = new EventedTokenizer(this, entityParser);
7927 this._currentAttribute = void 0;
7928 }
7929 Tokenizer2.prototype.tokenize = function(input) {
7930 this.tokens = [];
7931 this.tokenizer.tokenize(input);
7932 return this.tokens;
7933 };
7934 Tokenizer2.prototype.tokenizePart = function(input) {
7935 this.tokens = [];
7936 this.tokenizer.tokenizePart(input);
7937 return this.tokens;
7938 };
7939 Tokenizer2.prototype.tokenizeEOF = function() {
7940 this.tokens = [];
7941 this.tokenizer.tokenizeEOF();
7942 return this.tokens[0];
7943 };
7944 Tokenizer2.prototype.reset = function() {
7945 this.token = null;
7946 this.startLine = 1;
7947 this.startColumn = 0;
7948 };
7949 Tokenizer2.prototype.current = function() {
7950 var token = this.token;
7951 if (token === null) {
7952 throw new Error("token was unexpectedly null");
7953 }
7954 if (arguments.length === 0) {
7955 return token;
7956 }
7957 for (var i2 = 0; i2 < arguments.length; i2++) {
7958 if (token.type === arguments[i2]) {
7959 return token;
7960 }
7961 }
7962 throw new Error("token type was unexpectedly " + token.type);
7963 };
7964 Tokenizer2.prototype.push = function(token) {
7965 this.token = token;
7966 this.tokens.push(token);
7967 };
7968 Tokenizer2.prototype.currentAttribute = function() {
7969 return this._currentAttribute;
7970 };
7971 Tokenizer2.prototype.addLocInfo = function() {
7972 if (this.options.loc) {
7973 this.current().loc = {
7974 start: {
7975 line: this.startLine,
7976 column: this.startColumn
7977 },
7978 end: {
7979 line: this.tokenizer.line,
7980 column: this.tokenizer.column
7981 }
7982 };
7983 }
7984 this.startLine = this.tokenizer.line;
7985 this.startColumn = this.tokenizer.column;
7986 };
7987 Tokenizer2.prototype.beginData = function() {
7988 this.push({
7989 type: "Chars",
7990 chars: ""
7991 });
7992 };
7993 Tokenizer2.prototype.appendToData = function(char) {
7994 this.current(
7995 "Chars"
7996 /* Chars */
7997 ).chars += char;
7998 };
7999 Tokenizer2.prototype.finishData = function() {
8000 this.addLocInfo();
8001 };
8002 Tokenizer2.prototype.beginComment = function() {
8003 this.push({
8004 type: "Comment",
8005 chars: ""
8006 });
8007 };
8008 Tokenizer2.prototype.appendToCommentData = function(char) {
8009 this.current(
8010 "Comment"
8011 /* Comment */
8012 ).chars += char;
8013 };
8014 Tokenizer2.prototype.finishComment = function() {
8015 this.addLocInfo();
8016 };
8017 Tokenizer2.prototype.tagOpen = function() {
8018 };
8019 Tokenizer2.prototype.beginStartTag = function() {
8020 this.push({
8021 type: "StartTag",
8022 tagName: "",
8023 attributes: [],
8024 selfClosing: false
8025 });
8026 };
8027 Tokenizer2.prototype.beginEndTag = function() {
8028 this.push({
8029 type: "EndTag",
8030 tagName: ""
8031 });
8032 };
8033 Tokenizer2.prototype.finishTag = function() {
8034 this.addLocInfo();
8035 };
8036 Tokenizer2.prototype.markTagAsSelfClosing = function() {
8037 this.current(
8038 "StartTag"
8039 /* StartTag */
8040 ).selfClosing = true;
8041 };
8042 Tokenizer2.prototype.appendToTagName = function(char) {
8043 this.current(
8044 "StartTag",
8045 "EndTag"
8046 /* EndTag */
8047 ).tagName += char;
8048 };
8049 Tokenizer2.prototype.beginAttribute = function() {
8050 this._currentAttribute = ["", "", false];
8051 };
8052 Tokenizer2.prototype.appendToAttributeName = function(char) {
8053 this.currentAttribute()[0] += char;
8054 };
8055 Tokenizer2.prototype.beginAttributeValue = function(isQuoted) {
8056 this.currentAttribute()[2] = isQuoted;
8057 };
8058 Tokenizer2.prototype.appendToAttributeValue = function(char) {
8059 this.currentAttribute()[1] += char;
8060 };
8061 Tokenizer2.prototype.finishAttributeValue = function() {
8062 this.current(
8063 "StartTag"
8064 /* StartTag */
8065 ).attributes.push(this._currentAttribute);
8066 };
8067 Tokenizer2.prototype.reportSyntaxError = function(message) {
8068 this.current().syntaxError = message;
8069 };
8070 return Tokenizer2;
8071 })()
8072 );
8073
8074 // packages/blocks/build-module/api/validation/index.mjs
8075 var import_es6 = __toESM(require_es6(), 1);
8076 var import_deprecated7 = __toESM(require_deprecated(), 1);
8077 var import_html_entities = __toESM(require_html_entities(), 1);
8078
8079 // packages/blocks/build-module/api/validation/logger.mjs
8080 function createLogger() {
8081 function createLogHandler(logger) {
8082 return (message, ...args) => logger("Block validation: " + message, ...args);
8083 }
8084 return {
8085 // eslint-disable-next-line no-console
8086 error: createLogHandler(console.error),
8087 // eslint-disable-next-line no-console
8088 warning: createLogHandler(console.warn),
8089 getItems() {
8090 return [];
8091 }
8092 };
8093 }
8094 function createQueuedLogger() {
8095 const queue = [];
8096 const logger = createLogger();
8097 return {
8098 error(...args) {
8099 queue.push({ log: logger.error, args });
8100 },
8101 warning(...args) {
8102 queue.push({ log: logger.warning, args });
8103 },
8104 getItems() {
8105 return queue;
8106 }
8107 };
8108 }
8109
8110 // packages/blocks/build-module/api/validation/index.mjs
8111 var identity = (x2) => x2;
8112 var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g;
8113 var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/;
8114 var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/;
8115 var BOOLEAN_ATTRIBUTES = [
8116 "allowfullscreen",
8117 "allowpaymentrequest",
8118 "allowusermedia",
8119 "async",
8120 "autofocus",
8121 "autoplay",
8122 "checked",
8123 "controls",
8124 "default",
8125 "defer",
8126 "disabled",
8127 "download",
8128 "formnovalidate",
8129 "hidden",
8130 "ismap",
8131 "itemscope",
8132 "loop",
8133 "multiple",
8134 "muted",
8135 "nomodule",
8136 "novalidate",
8137 "open",
8138 "playsinline",
8139 "readonly",
8140 "required",
8141 "reversed",
8142 "selected",
8143 "typemustmatch"
8144 ];
8145 var ENUMERATED_ATTRIBUTES = [
8146 "autocapitalize",
8147 "autocomplete",
8148 "charset",
8149 "contenteditable",
8150 "crossorigin",
8151 "decoding",
8152 "dir",
8153 "draggable",
8154 "enctype",
8155 "formenctype",
8156 "formmethod",
8157 "http-equiv",
8158 "inputmode",
8159 "kind",
8160 "method",
8161 "preload",
8162 "scope",
8163 "shape",
8164 "spellcheck",
8165 "translate",
8166 "type",
8167 "wrap"
8168 ];
8169 var MEANINGFUL_ATTRIBUTES = [
8170 ...BOOLEAN_ATTRIBUTES,
8171 ...ENUMERATED_ATTRIBUTES
8172 ];
8173 var TEXT_NORMALIZATIONS = [
8174 identity,
8175 getTextWithCollapsedWhitespace
8176 ];
8177 var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i;
8178 var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/;
8179 var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i;
8180 function isValidCharacterReference(text2) {
8181 return REGEXP_NAMED_CHARACTER_REFERENCE.test(text2) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text2) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text2);
8182 }
8183 var DecodeEntityParser = class {
8184 /**
8185 * Returns a substitute string for an entity string sequence between `&`
8186 * and `;`, or undefined if no substitution should occur.
8187 *
8188 * @param entity Entity fragment discovered in HTML.
8189 *
8190 * @return Entity substitute value.
8191 */
8192 parse(entity) {
8193 if (isValidCharacterReference(entity)) {
8194 return (0, import_html_entities.decodeEntities)("&" + entity + ";");
8195 }
8196 return void 0;
8197 }
8198 };
8199 function getTextPiecesSplitOnWhitespace(text2) {
8200 return text2.trim().split(REGEXP_WHITESPACE);
8201 }
8202 function getTextWithCollapsedWhitespace(text2) {
8203 return getTextPiecesSplitOnWhitespace(text2).join(" ");
8204 }
8205 function getMeaningfulAttributePairs(token) {
8206 return (token.attributes ?? []).filter((pair) => {
8207 const [key, value] = pair;
8208 return value || key.indexOf("data-") === 0 || MEANINGFUL_ATTRIBUTES.includes(key);
8209 });
8210 }
8211 function isEquivalentTextTokens(actual, expected, logger = createLogger()) {
8212 let actualChars = actual.chars;
8213 let expectedChars = expected.chars;
8214 for (let i2 = 0; i2 < TEXT_NORMALIZATIONS.length; i2++) {
8215 const normalize = TEXT_NORMALIZATIONS[i2];
8216 actualChars = normalize(actualChars);
8217 expectedChars = normalize(expectedChars);
8218 if (actualChars === expectedChars) {
8219 return true;
8220 }
8221 }
8222 logger.warning(
8223 "Expected text `%s`, saw `%s`.",
8224 expected.chars,
8225 actual.chars
8226 );
8227 return false;
8228 }
8229 function getNormalizedLength(value) {
8230 if (0 === parseFloat(value)) {
8231 return "0";
8232 }
8233 if (value.indexOf(".") === 0) {
8234 return "0" + value;
8235 }
8236 return value;
8237 }
8238 function getNormalizedStyleValue(value) {
8239 const textPieces = getTextPiecesSplitOnWhitespace(value);
8240 const normalizedPieces = textPieces.map(getNormalizedLength);
8241 const result = normalizedPieces.join(" ");
8242 return result.replace(REGEXP_STYLE_URL_TYPE, "url($1)");
8243 }
8244 function getStyleProperties(text2) {
8245 const pairs = text2.replace(/;?\s*$/, "").split(";").map((style) => {
8246 const [key, ...valueParts] = style.split(":");
8247 const value = valueParts.join(":");
8248 return [key.trim(), getNormalizedStyleValue(value.trim())];
8249 });
8250 return Object.fromEntries(pairs);
8251 }
8252 var isEqualAttributesOfName = {
8253 class: (actual, expected) => {
8254 const [actualPieces, expectedPieces] = [actual, expected].map(
8255 getTextPiecesSplitOnWhitespace
8256 );
8257 const actualDiff = actualPieces.filter(
8258 (c2) => !expectedPieces.includes(c2)
8259 );
8260 const expectedDiff = expectedPieces.filter(
8261 (c2) => !actualPieces.includes(c2)
8262 );
8263 return actualDiff.length === 0 && expectedDiff.length === 0;
8264 },
8265 style: (actual, expected) => {
8266 return (0, import_es6.default)(
8267 ...[actual, expected].map(getStyleProperties)
8268 );
8269 },
8270 // For each boolean attribute, mere presence of attribute in both is enough
8271 // to assume equivalence.
8272 ...Object.fromEntries(
8273 BOOLEAN_ATTRIBUTES.map((attribute) => [attribute, () => true])
8274 )
8275 };
8276 function isEqualTagAttributePairs(actual, expected, logger = createLogger()) {
8277 if (actual.length !== expected.length) {
8278 logger.warning(
8279 "Expected attributes %o, instead saw %o.",
8280 expected,
8281 actual
8282 );
8283 return false;
8284 }
8285 const expectedAttributes = {};
8286 for (let i2 = 0; i2 < expected.length; i2++) {
8287 expectedAttributes[expected[i2][0].toLowerCase()] = expected[i2][1];
8288 }
8289 for (let i2 = 0; i2 < actual.length; i2++) {
8290 const [name, actualValue] = actual[i2];
8291 const nameLower = name.toLowerCase();
8292 if (!expectedAttributes.hasOwnProperty(nameLower)) {
8293 logger.warning("Encountered unexpected attribute `%s`.", name);
8294 return false;
8295 }
8296 const expectedValue = expectedAttributes[nameLower];
8297 const isEqualAttributes = isEqualAttributesOfName[nameLower];
8298 if (isEqualAttributes) {
8299 if (!isEqualAttributes(actualValue, expectedValue)) {
8300 logger.warning(
8301 "Expected attribute `%s` of value `%s`, saw `%s`.",
8302 name,
8303 expectedValue,
8304 actualValue
8305 );
8306 return false;
8307 }
8308 } else if (actualValue !== expectedValue) {
8309 logger.warning(
8310 "Expected attribute `%s` of value `%s`, saw `%s`.",
8311 name,
8312 expectedValue,
8313 actualValue
8314 );
8315 return false;
8316 }
8317 }
8318 return true;
8319 }
8320 var isEqualTokensOfType = {
8321 StartTag: (actual, expected, logger = createLogger()) => {
8322 if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case-
8323 // insensitive check on the assumption that the majority case will
8324 // have exactly equal tag names.
8325 actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) {
8326 logger.warning(
8327 "Expected tag name `%s`, instead saw `%s`.",
8328 expected.tagName,
8329 actual.tagName
8330 );
8331 return false;
8332 }
8333 return isEqualTagAttributePairs(
8334 ...[actual, expected].map(getMeaningfulAttributePairs),
8335 logger
8336 );
8337 },
8338 Chars: isEquivalentTextTokens,
8339 Comment: isEquivalentTextTokens
8340 };
8341 function getNextNonWhitespaceToken(tokens) {
8342 let token;
8343 while (token = tokens.shift()) {
8344 if (token.type !== "Chars") {
8345 return token;
8346 }
8347 if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) {
8348 return token;
8349 }
8350 }
8351 return void 0;
8352 }
8353 function getHTMLTokens(html2, logger = createLogger()) {
8354 try {
8355 return new Tokenizer(new DecodeEntityParser()).tokenize(
8356 html2
8357 );
8358 } catch {
8359 logger.warning("Malformed HTML detected: %s", html2);
8360 }
8361 return null;
8362 }
8363 function isClosedByToken(currentToken, nextToken) {
8364 if (!currentToken.selfClosing) {
8365 return false;
8366 }
8367 if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === "EndTag") {
8368 return true;
8369 }
8370 return false;
8371 }
8372 function isEquivalentHTML(actual, expected, logger = createLogger()) {
8373 if (actual === expected) {
8374 return true;
8375 }
8376 const [actualTokens, expectedTokens] = [actual, expected].map(
8377 (html2) => getHTMLTokens(html2, logger)
8378 );
8379 if (!actualTokens || !expectedTokens) {
8380 return false;
8381 }
8382 let actualToken, expectedToken;
8383 while (actualToken = getNextNonWhitespaceToken(actualTokens)) {
8384 expectedToken = getNextNonWhitespaceToken(expectedTokens);
8385 if (!expectedToken) {
8386 logger.warning(
8387 "Expected end of content, instead saw %o.",
8388 actualToken
8389 );
8390 return false;
8391 }
8392 if (actualToken.type !== expectedToken.type) {
8393 logger.warning(
8394 "Expected token of type `%s` (%o), instead saw `%s` (%o).",
8395 expectedToken.type,
8396 expectedToken,
8397 actualToken.type,
8398 actualToken
8399 );
8400 return false;
8401 }
8402 const isEqualTokens = isEqualTokensOfType[actualToken.type];
8403 if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) {
8404 return false;
8405 }
8406 if (isClosedByToken(actualToken, expectedTokens[0])) {
8407 getNextNonWhitespaceToken(expectedTokens);
8408 } else if (isClosedByToken(expectedToken, actualTokens[0])) {
8409 getNextNonWhitespaceToken(actualTokens);
8410 }
8411 }
8412 if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) {
8413 logger.warning(
8414 "Expected %o, instead saw end of content.",
8415 expectedToken
8416 );
8417 return false;
8418 }
8419 return true;
8420 }
8421 function validateBlock(block, blockTypeOrName = block.name) {
8422 const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName();
8423 if (isFallbackBlock) {
8424 return [true, []];
8425 }
8426 const logger = createQueuedLogger();
8427 const blockType = normalizeBlockType(blockTypeOrName);
8428 let generatedBlockContent;
8429 try {
8430 generatedBlockContent = getSaveContent(blockType, block.attributes);
8431 } catch (error) {
8432 logger.error(
8433 "Block validation failed because an error occurred while generating block content:\n\n%s",
8434 error.toString()
8435 );
8436 return [false, logger.getItems()];
8437 }
8438 const isValid = isEquivalentHTML(
8439 block.originalContent,
8440 generatedBlockContent,
8441 logger
8442 );
8443 if (!isValid) {
8444 logger.error(
8445 "Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",
8446 blockType.name,
8447 blockType,
8448 generatedBlockContent,
8449 block.originalContent
8450 );
8451 }
8452 return [isValid, logger.getItems()];
8453 }
8454 function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) {
8455 (0, import_deprecated7.default)("isValidBlockContent introduces opportunity for data loss", {
8456 since: "12.6",
8457 plugin: "Gutenberg",
8458 alternative: "validateBlock"
8459 });
8460 const blockType = normalizeBlockType(blockTypeOrName);
8461 const block = {
8462 clientId: "",
8463 name: blockType.name,
8464 isValid: true,
8465 attributes,
8466 innerBlocks: [],
8467 originalContent: originalBlockContent
8468 };
8469 const [isValid] = validateBlock(block, blockType);
8470 return isValid;
8471 }
8472
8473 // packages/blocks/build-module/api/parser/convert-legacy-block.mjs
8474 function convertLegacyBlockNameAndAttributes(name, attributes) {
8475 const newAttributes = { ...attributes };
8476 if ("core/cover-image" === name) {
8477 name = "core/cover";
8478 }
8479 if ("core/text" === name || "core/cover-text" === name) {
8480 name = "core/paragraph";
8481 }
8482 if (name && name.indexOf("core/social-link-") === 0) {
8483 newAttributes.service = name.substring(17);
8484 name = "core/social-link";
8485 }
8486 if (name && name.indexOf("core-embed/") === 0) {
8487 const providerSlug = name.substring(11);
8488 const deprecated12 = {
8489 speaker: "speaker-deck",
8490 polldaddy: "crowdsignal"
8491 };
8492 newAttributes.providerNameSlug = providerSlug in deprecated12 ? deprecated12[providerSlug] : providerSlug;
8493 if (!["amazon-kindle", "wordpress"].includes(providerSlug)) {
8494 newAttributes.responsive = true;
8495 }
8496 name = "core/embed";
8497 }
8498 if (name === "core/post-comment-author") {
8499 name = "core/comment-author-name";
8500 }
8501 if (name === "core/post-comment-content") {
8502 name = "core/comment-content";
8503 }
8504 if (name === "core/post-comment-date") {
8505 name = "core/comment-date";
8506 }
8507 if (name === "core/comments-query-loop") {
8508 name = "core/comments";
8509 const className = newAttributes.className ?? "";
8510 if (!className.includes("wp-block-comments-query-loop")) {
8511 newAttributes.className = [
8512 "wp-block-comments-query-loop",
8513 className
8514 ].join(" ");
8515 }
8516 }
8517 if (name === "core/post-comments") {
8518 name = "core/comments";
8519 newAttributes.legacy = true;
8520 }
8521 const layout = attributes.layout;
8522 if (layout?.type === "grid" && typeof layout?.columnCount === "string") {
8523 newAttributes.layout = {
8524 ...newAttributes.layout,
8525 columnCount: parseInt(layout.columnCount, 10)
8526 };
8527 }
8528 const style = attributes.style;
8529 const styleLayout = style?.layout;
8530 if (typeof styleLayout?.columnSpan === "string") {
8531 const columnSpanNumber = parseInt(styleLayout.columnSpan, 10);
8532 newAttributes.style = {
8533 ...newAttributes.style,
8534 layout: {
8535 ...newAttributes.style?.layout,
8536 columnSpan: isNaN(columnSpanNumber) ? void 0 : columnSpanNumber
8537 }
8538 };
8539 }
8540 if (typeof styleLayout?.rowSpan === "string") {
8541 const rowSpanNumber = parseInt(styleLayout.rowSpan, 10);
8542 newAttributes.style = {
8543 ...newAttributes.style,
8544 layout: {
8545 ...newAttributes.style?.layout,
8546 rowSpan: isNaN(rowSpanNumber) ? void 0 : rowSpanNumber
8547 }
8548 };
8549 }
8550 return [name, newAttributes];
8551 }
8552
8553 // node_modules/hpq/es/get-path.js
8554 function getPath(object, path) {
8555 var segments = path.split(".");
8556 var segment;
8557 while (segment = segments.shift()) {
8558 if (!(segment in object)) {
8559 return;
8560 }
8561 object = object[segment];
8562 }
8563 return object;
8564 }
8565
8566 // node_modules/hpq/es/index.js
8567 var getDocument = /* @__PURE__ */ (function() {
8568 var doc;
8569 return function() {
8570 if (!doc) {
8571 doc = document.implementation.createHTMLDocument("");
8572 }
8573 return doc;
8574 };
8575 })();
8576 function parse(source, matchers) {
8577 if (!matchers) {
8578 return;
8579 }
8580 if ("string" === typeof source) {
8581 var doc = getDocument();
8582 doc.body.innerHTML = source;
8583 source = doc.body;
8584 }
8585 if ("function" === typeof matchers) {
8586 return matchers(source);
8587 }
8588 if (Object !== matchers.constructor) {
8589 return;
8590 }
8591 return Object.keys(matchers).reduce(function(memo, key) {
8592 memo[key] = parse(source, matchers[key]);
8593 return memo;
8594 }, {});
8595 }
8596 function prop(selector, name) {
8597 if (1 === arguments.length) {
8598 name = selector;
8599 selector = void 0;
8600 }
8601 return function(node) {
8602 var match = node;
8603 if (selector) {
8604 match = node.querySelector(selector);
8605 }
8606 if (match) {
8607 return getPath(match, name);
8608 }
8609 };
8610 }
8611 function attr(selector, name) {
8612 if (1 === arguments.length) {
8613 name = selector;
8614 selector = void 0;
8615 }
8616 return function(node) {
8617 var attributes = prop(selector, "attributes")(node);
8618 if (attributes && attributes.hasOwnProperty(name)) {
8619 return attributes[name].value;
8620 }
8621 };
8622 }
8623 function text(selector) {
8624 return prop(selector, "textContent");
8625 }
8626 function query(selector, matchers) {
8627 return function(node) {
8628 var matches = node.querySelectorAll(selector);
8629 return [].map.call(matches, function(match) {
8630 return parse(match, matchers);
8631 });
8632 };
8633 }
8634
8635 // node_modules/memize/dist/index.js
8636 function memize(fn, options) {
8637 var size = 0;
8638 var head;
8639 var tail;
8640 options = options || {};
8641 function memoized() {
8642 var node = head, len = arguments.length, args, i2;
8643 searchCache: while (node) {
8644 if (node.args.length !== arguments.length) {
8645 node = node.next;
8646 continue;
8647 }
8648 for (i2 = 0; i2 < len; i2++) {
8649 if (node.args[i2] !== arguments[i2]) {
8650 node = node.next;
8651 continue searchCache;
8652 }
8653 }
8654 if (node !== head) {
8655 if (node === tail) {
8656 tail = node.prev;
8657 }
8658 node.prev.next = node.next;
8659 if (node.next) {
8660 node.next.prev = node.prev;
8661 }
8662 node.next = head;
8663 node.prev = null;
8664 head.prev = node;
8665 head = node;
8666 }
8667 return node.val;
8668 }
8669 args = new Array(len);
8670 for (i2 = 0; i2 < len; i2++) {
8671 args[i2] = arguments[i2];
8672 }
8673 node = {
8674 args,
8675 // Generate the result from original function
8676 val: fn.apply(null, args)
8677 };
8678 if (head) {
8679 head.prev = node;
8680 node.next = head;
8681 } else {
8682 tail = node;
8683 }
8684 if (size === /** @type {MemizeOptions} */
8685 options.maxSize) {
8686 tail = /** @type {MemizeCacheNode} */
8687 tail.prev;
8688 tail.next = null;
8689 } else {
8690 size++;
8691 }
8692 head = node;
8693 return node.val;
8694 }
8695 memoized.clear = function() {
8696 head = null;
8697 tail = null;
8698 size = 0;
8699 };
8700 return memoized;
8701 }
8702
8703 // packages/blocks/build-module/api/parser/get-block-attributes.mjs
8704 var import_hooks4 = __toESM(require_hooks(), 1);
8705 var import_rich_text4 = __toESM(require_rich_text(), 1);
8706
8707 // packages/blocks/build-module/api/matchers.mjs
8708 var import_rich_text3 = __toESM(require_rich_text(), 1);
8709
8710 // packages/blocks/build-module/api/node.mjs
8711 var import_deprecated9 = __toESM(require_deprecated(), 1);
8712
8713 // packages/blocks/build-module/api/children.mjs
8714 var import_element3 = __toESM(require_element(), 1);
8715 var import_deprecated8 = __toESM(require_deprecated(), 1);
8716 function getSerializeCapableElement(children) {
8717 return children;
8718 }
8719 function getChildrenArray(children) {
8720 (0, import_deprecated8.default)("wp.blocks.children.getChildrenArray", {
8721 since: "6.1",
8722 version: "6.3",
8723 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8724 });
8725 return children;
8726 }
8727 function concat(...blockNodes) {
8728 (0, import_deprecated8.default)("wp.blocks.children.concat", {
8729 since: "6.1",
8730 version: "6.3",
8731 alternative: "wp.richText.concat",
8732 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8733 });
8734 const result = [];
8735 for (let i2 = 0; i2 < blockNodes.length; i2++) {
8736 const blockNode = Array.isArray(blockNodes[i2]) ? blockNodes[i2] : [blockNodes[i2]];
8737 for (let j2 = 0; j2 < blockNode.length; j2++) {
8738 const child = blockNode[j2];
8739 const canConcatToPreviousString = typeof child === "string" && typeof result[result.length - 1] === "string";
8740 if (canConcatToPreviousString) {
8741 result[result.length - 1] += child;
8742 } else {
8743 result.push(child);
8744 }
8745 }
8746 }
8747 return result;
8748 }
8749 function fromDOM22(domNodes) {
8750 (0, import_deprecated8.default)("wp.blocks.children.fromDOM", {
8751 since: "6.1",
8752 version: "6.3",
8753 alternative: "wp.richText.create",
8754 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8755 });
8756 const result = [];
8757 for (let i2 = 0; i2 < domNodes.length; i2++) {
8758 try {
8759 result.push(fromDOM2(domNodes[i2]));
8760 } catch {
8761 }
8762 }
8763 return result;
8764 }
8765 function toHTML(children) {
8766 (0, import_deprecated8.default)("wp.blocks.children.toHTML", {
8767 since: "6.1",
8768 version: "6.3",
8769 alternative: "wp.richText.toHTMLString",
8770 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8771 });
8772 const element = getSerializeCapableElement(children);
8773 return (0, import_element3.renderToString)(element);
8774 }
8775 function matcher(selector) {
8776 (0, import_deprecated8.default)("wp.blocks.children.matcher", {
8777 since: "6.1",
8778 version: "6.3",
8779 alternative: "html source",
8780 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8781 });
8782 return (domNode) => {
8783 let match = domNode;
8784 if (selector) {
8785 match = domNode.querySelector(selector);
8786 }
8787 if (match) {
8788 return fromDOM22(match.childNodes);
8789 }
8790 return [];
8791 };
8792 }
8793 var children_default = {
8794 concat,
8795 getChildrenArray,
8796 fromDOM: fromDOM22,
8797 toHTML,
8798 matcher
8799 };
8800
8801 // packages/blocks/build-module/api/node.mjs
8802 function isNodeOfType(node, type) {
8803 (0, import_deprecated9.default)("wp.blocks.node.isNodeOfType", {
8804 since: "6.1",
8805 version: "6.3",
8806 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8807 });
8808 return typeof node !== "string" && node?.type === type;
8809 }
8810 function getNamedNodeMapAsObject(nodeMap) {
8811 const result = {};
8812 for (let i2 = 0; i2 < nodeMap.length; i2++) {
8813 const { name, value } = nodeMap[i2];
8814 result[name] = value;
8815 }
8816 return result;
8817 }
8818 function fromDOM2(domNode) {
8819 (0, import_deprecated9.default)("wp.blocks.node.fromDOM", {
8820 since: "6.1",
8821 version: "6.3",
8822 alternative: "wp.richText.create",
8823 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8824 });
8825 if (domNode.nodeType === domNode.TEXT_NODE) {
8826 return domNode.nodeValue;
8827 }
8828 if (domNode.nodeType !== domNode.ELEMENT_NODE) {
8829 throw new TypeError(
8830 "A block node can only be created from a node of type text or element."
8831 );
8832 }
8833 return {
8834 type: domNode.nodeName.toLowerCase(),
8835 props: {
8836 ...getNamedNodeMapAsObject(domNode.attributes),
8837 children: fromDOM22(domNode.childNodes)
8838 }
8839 };
8840 }
8841 function toHTML2(node) {
8842 (0, import_deprecated9.default)("wp.blocks.node.toHTML", {
8843 since: "6.1",
8844 version: "6.3",
8845 alternative: "wp.richText.toHTMLString",
8846 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8847 });
8848 return toHTML([node]);
8849 }
8850 function matcher2(selector) {
8851 (0, import_deprecated9.default)("wp.blocks.node.matcher", {
8852 since: "6.1",
8853 version: "6.3",
8854 alternative: "html source",
8855 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8856 });
8857 return (domNode) => {
8858 let match = domNode;
8859 if (selector) {
8860 match = domNode.querySelector(selector);
8861 }
8862 try {
8863 return fromDOM2(match);
8864 } catch {
8865 return null;
8866 }
8867 };
8868 }
8869 var node_default = {
8870 isNodeOfType,
8871 fromDOM: fromDOM2,
8872 toHTML: toHTML2,
8873 matcher: matcher2
8874 };
8875
8876 // packages/blocks/build-module/api/matchers.mjs
8877 function html(selector, multilineTag) {
8878 return (domNode) => {
8879 let match = domNode;
8880 if (selector) {
8881 match = domNode.querySelector(selector);
8882 }
8883 if (!match) {
8884 return "";
8885 }
8886 if (multilineTag) {
8887 let value = "";
8888 const length = match.children.length;
8889 for (let index = 0; index < length; index++) {
8890 const child = match.children[index];
8891 if (child.nodeName.toLowerCase() !== multilineTag) {
8892 continue;
8893 }
8894 value += child.outerHTML;
8895 }
8896 return value;
8897 }
8898 return match.innerHTML;
8899 };
8900 }
8901 var richText = (selector, preserveWhiteSpace) => (el) => {
8902 const target = selector ? el.querySelector(selector) : el;
8903 return target ? import_rich_text3.RichTextData.fromHTMLElement(target, {
8904 preserveWhiteSpace
8905 }) : import_rich_text3.RichTextData.empty();
8906 };
8907
8908 // packages/blocks/build-module/api/parser/get-block-attributes.mjs
8909 var toBooleanAttributeMatcher = (matcher3) => (value) => matcher3(value) !== void 0;
8910 function isOfType(value, type) {
8911 switch (type) {
8912 case "rich-text":
8913 return value instanceof import_rich_text4.RichTextData;
8914 case "string":
8915 return typeof value === "string";
8916 case "boolean":
8917 return typeof value === "boolean";
8918 case "object":
8919 return !!value && value.constructor === Object;
8920 case "null":
8921 return value === null;
8922 case "array":
8923 return Array.isArray(value);
8924 case "integer":
8925 case "number":
8926 return typeof value === "number";
8927 }
8928 return true;
8929 }
8930 function isOfTypes(value, types) {
8931 return types.some((type) => isOfType(value, type));
8932 }
8933 function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) {
8934 let value;
8935 switch (attributeSchema.source) {
8936 // An undefined source means that it's an attribute serialized to the
8937 // block's "comment".
8938 case void 0:
8939 value = commentAttributes ? commentAttributes[attributeKey] : void 0;
8940 break;
8941 // raw source means that it's the original raw block content.
8942 case "raw":
8943 value = innerHTML;
8944 break;
8945 case "attribute":
8946 case "property":
8947 case "html":
8948 case "text":
8949 case "rich-text":
8950 case "children":
8951 case "node":
8952 case "query":
8953 case "tag":
8954 value = parseWithAttributeSchema(innerDOM, attributeSchema);
8955 break;
8956 }
8957 if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) {
8958 value = void 0;
8959 }
8960 if (value === void 0) {
8961 value = getDefault(attributeSchema);
8962 }
8963 return value;
8964 }
8965 function isValidByType(value, type) {
8966 return type === void 0 || isOfTypes(value, Array.isArray(type) ? type : [type]);
8967 }
8968 function isValidByEnum(value, enumSet) {
8969 return !Array.isArray(enumSet) || enumSet.includes(value);
8970 }
8971 var matcherFromSource = memize(
8972 (sourceConfig) => {
8973 switch (sourceConfig.source) {
8974 case "attribute": {
8975 let matcher3 = attr(
8976 sourceConfig.selector,
8977 sourceConfig.attribute
8978 );
8979 if (sourceConfig.type === "boolean") {
8980 matcher3 = toBooleanAttributeMatcher(matcher3);
8981 }
8982 return matcher3;
8983 }
8984 case "html":
8985 return html(sourceConfig.selector, sourceConfig.multiline);
8986 case "text":
8987 return text(sourceConfig.selector);
8988 case "rich-text":
8989 return richText(
8990 sourceConfig.selector,
8991 sourceConfig.__unstablePreserveWhiteSpace
8992 );
8993 case "children":
8994 return matcher(sourceConfig.selector);
8995 case "node":
8996 return matcher2(sourceConfig.selector);
8997 case "query":
8998 const subMatchers = Object.fromEntries(
8999 Object.entries(sourceConfig.query).map(
9000 ([key, subSourceConfig]) => [
9001 key,
9002 matcherFromSource(subSourceConfig)
9003 ]
9004 )
9005 );
9006 return query(sourceConfig.selector, subMatchers);
9007 case "tag": {
9008 const matcher3 = prop(sourceConfig.selector, "nodeName");
9009 return (domNode) => matcher3(domNode)?.toLowerCase();
9010 }
9011 default:
9012 console.error(
9013 `Unknown source type "${sourceConfig.source}"`
9014 );
9015 return void 0;
9016 }
9017 }
9018 );
9019 function parseHtml(innerHTML) {
9020 return parse(innerHTML, (h2) => h2);
9021 }
9022 function parseWithAttributeSchema(innerHTML, attributeSchema) {
9023 return matcherFromSource(attributeSchema)(
9024 parseHtml(innerHTML)
9025 );
9026 }
9027 function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) {
9028 const doc = parseHtml(innerHTML);
9029 const blockType = normalizeBlockType(blockTypeOrName);
9030 const blockAttributes = Object.fromEntries(
9031 Object.entries(blockType?.attributes ?? {}).map(
9032 ([key, schema]) => [
9033 key,
9034 getBlockAttribute(key, schema, doc, attributes, innerHTML)
9035 ]
9036 )
9037 );
9038 return (0, import_hooks4.applyFilters)(
9039 "blocks.getBlockAttributes",
9040 blockAttributes,
9041 blockType,
9042 innerHTML,
9043 attributes
9044 );
9045 }
9046
9047 // packages/blocks/build-module/api/parser/fix-custom-classname.mjs
9048 var CLASS_ATTR_SCHEMA = {
9049 type: "string",
9050 source: "attribute",
9051 selector: "[data-custom-class-name] > *",
9052 attribute: "class"
9053 };
9054 function getHTMLRootElementClasses(innerHTML) {
9055 const parsed = parseWithAttributeSchema(
9056 `<div data-custom-class-name>${innerHTML}</div>`,
9057 CLASS_ATTR_SCHEMA
9058 );
9059 return parsed ? parsed.trim().split(/\s+/) : [];
9060 }
9061 function fixCustomClassname(blockAttributes, blockType, innerHTML) {
9062 if (!hasBlockSupport(blockType, "customClassName", true)) {
9063 return blockAttributes;
9064 }
9065 const modifiedBlockAttributes = { ...blockAttributes };
9066 const { className: omittedClassName, ...attributesSansClassName } = modifiedBlockAttributes;
9067 const serialized = getSaveContent(blockType, attributesSansClassName);
9068 const defaultClasses = getHTMLRootElementClasses(serialized);
9069 const actualClasses = getHTMLRootElementClasses(innerHTML);
9070 const customClasses = actualClasses.filter(
9071 (className) => !defaultClasses.includes(className)
9072 );
9073 if (customClasses.length) {
9074 modifiedBlockAttributes.className = customClasses.join(" ");
9075 } else if (serialized) {
9076 delete modifiedBlockAttributes.className;
9077 }
9078 return modifiedBlockAttributes;
9079 }
9080
9081 // packages/blocks/build-module/api/parser/fix-global-attribute.mjs
9082 function getHTMLRootElement(innerHTML, dataAttribute, attributeSchema) {
9083 const parsed = parseWithAttributeSchema(
9084 `<div ${dataAttribute}>${innerHTML}</div>`,
9085 attributeSchema
9086 );
9087 return parsed;
9088 }
9089 function fixGlobalAttribute(blockAttributes, blockType, innerHTML, supportKey, dataAttribute, attributeSchema) {
9090 if (!hasBlockSupport(blockType, supportKey, false)) {
9091 return blockAttributes;
9092 }
9093 const modifiedBlockAttributes = { ...blockAttributes };
9094 const attributeValue = getHTMLRootElement(
9095 innerHTML,
9096 dataAttribute,
9097 attributeSchema
9098 );
9099 if (attributeValue) {
9100 modifiedBlockAttributes[supportKey] = attributeValue;
9101 }
9102 return modifiedBlockAttributes;
9103 }
9104
9105 // packages/blocks/build-module/api/parser/apply-built-in-validation-fixes.mjs
9106 var ARIA_LABEL_ATTR_SCHEMA = {
9107 type: "string",
9108 source: "attribute",
9109 selector: "[data-aria-label] > *",
9110 attribute: "aria-label"
9111 };
9112 var ANCHOR_ATTR_SCHEMA = {
9113 type: "string",
9114 source: "attribute",
9115 selector: "[data-anchor] > *",
9116 attribute: "id"
9117 };
9118 function applyBuiltInValidationFixes(block, blockType) {
9119 const { attributes, originalContent } = block;
9120 let updatedBlockAttributes = attributes;
9121 updatedBlockAttributes = fixCustomClassname(
9122 attributes,
9123 blockType,
9124 originalContent ?? ""
9125 );
9126 updatedBlockAttributes = fixGlobalAttribute(
9127 updatedBlockAttributes,
9128 blockType,
9129 originalContent ?? "",
9130 "ariaLabel",
9131 "data-aria-label",
9132 ARIA_LABEL_ATTR_SCHEMA
9133 );
9134 updatedBlockAttributes = fixGlobalAttribute(
9135 updatedBlockAttributes,
9136 blockType,
9137 originalContent ?? "",
9138 "anchor",
9139 "data-anchor",
9140 ANCHOR_ATTR_SCHEMA
9141 );
9142 return {
9143 ...block,
9144 attributes: updatedBlockAttributes
9145 };
9146 }
9147
9148 // packages/blocks/build-module/api/parser/apply-block-deprecated-versions.mjs
9149 function stubFalse() {
9150 return false;
9151 }
9152 function applyBlockDeprecatedVersions(block, rawBlock, blockType) {
9153 const parsedAttributes = rawBlock.attrs ?? {};
9154 const { deprecated: deprecatedDefinitions } = blockType;
9155 if (!deprecatedDefinitions || !deprecatedDefinitions.length) {
9156 return block;
9157 }
9158 for (let i2 = 0; i2 < deprecatedDefinitions.length; i2++) {
9159 const { isEligible = stubFalse } = deprecatedDefinitions[i2];
9160 if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, {
9161 blockNode: rawBlock,
9162 block
9163 })) {
9164 continue;
9165 }
9166 const deprecatedBlockType = Object.assign(
9167 omit(
9168 blockType,
9169 DEPRECATED_ENTRY_KEYS
9170 ),
9171 deprecatedDefinitions[i2]
9172 );
9173 let migratedBlock = {
9174 ...block,
9175 attributes: getBlockAttributes(
9176 deprecatedBlockType,
9177 block.originalContent ?? "",
9178 parsedAttributes
9179 )
9180 };
9181 let [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
9182 if (!isValid) {
9183 migratedBlock = applyBuiltInValidationFixes(
9184 migratedBlock,
9185 deprecatedBlockType
9186 );
9187 [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
9188 }
9189 if (!isValid) {
9190 continue;
9191 }
9192 let migratedInnerBlocks = migratedBlock.innerBlocks;
9193 let migratedAttributes = migratedBlock.attributes;
9194 const { migrate } = deprecatedBlockType;
9195 if (migrate) {
9196 let migrated = migrate(migratedAttributes, block.innerBlocks);
9197 if (!Array.isArray(migrated)) {
9198 migrated = [migrated];
9199 }
9200 [
9201 migratedAttributes = parsedAttributes,
9202 migratedInnerBlocks = block.innerBlocks
9203 ] = migrated;
9204 }
9205 block = {
9206 ...block,
9207 attributes: migratedAttributes,
9208 innerBlocks: migratedInnerBlocks,
9209 isValid: true,
9210 validationIssues: []
9211 };
9212 }
9213 return block;
9214 }
9215
9216 // packages/blocks/build-module/api/parser/index.mjs
9217 function convertLegacyBlocks(rawBlock) {
9218 const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes(
9219 rawBlock.blockName,
9220 rawBlock.attrs ?? {}
9221 );
9222 return {
9223 ...rawBlock,
9224 blockName: correctName,
9225 attrs: correctedAttributes
9226 };
9227 }
9228 function normalizeRawBlock(rawBlock, options) {
9229 const fallbackBlockName = getFreeformContentHandlerName();
9230 const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName();
9231 const rawAttributes = rawBlock.attrs || {};
9232 const rawInnerBlocks = rawBlock.innerBlocks || [];
9233 let rawInnerHTML = rawBlock.innerHTML.trim();
9234 if (rawBlockName === fallbackBlockName && rawBlockName === "core/freeform" && !options?.__unstableSkipAutop) {
9235 rawInnerHTML = (0, import_autop2.autop)(rawInnerHTML).trim();
9236 }
9237 return {
9238 ...rawBlock,
9239 blockName: rawBlockName,
9240 attrs: rawAttributes,
9241 innerHTML: rawInnerHTML,
9242 innerBlocks: rawInnerBlocks
9243 };
9244 }
9245 function createMissingBlockType(rawBlock) {
9246 const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName();
9247 const originalUndelimitedContent = serializeRawBlock(rawBlock, {
9248 isCommentDelimited: false
9249 });
9250 const originalContent = serializeRawBlock(rawBlock, {
9251 isCommentDelimited: true
9252 });
9253 return {
9254 blockName: unregisteredFallbackBlock,
9255 attrs: {
9256 originalName: rawBlock.blockName,
9257 originalContent,
9258 originalUndelimitedContent
9259 },
9260 innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML,
9261 innerBlocks: rawBlock.innerBlocks,
9262 innerContent: rawBlock.innerContent
9263 };
9264 }
9265 function applyBlockValidation(unvalidatedBlock, blockType) {
9266 const [isValid] = validateBlock(unvalidatedBlock, blockType);
9267 if (isValid) {
9268 return { ...unvalidatedBlock, isValid, validationIssues: [] };
9269 }
9270 const fixedBlock = applyBuiltInValidationFixes(
9271 unvalidatedBlock,
9272 blockType
9273 );
9274 const [isFixedValid, validationIssues] = validateBlock(
9275 fixedBlock,
9276 blockType
9277 );
9278 return { ...fixedBlock, isValid: isFixedValid, validationIssues };
9279 }
9280 function parseRawBlock(rawBlock, options) {
9281 let normalizedBlock = normalizeRawBlock(rawBlock, options);
9282 normalizedBlock = convertLegacyBlocks(normalizedBlock);
9283 let blockType = getBlockType(normalizedBlock.blockName);
9284 if (!blockType) {
9285 normalizedBlock = createMissingBlockType(normalizedBlock);
9286 blockType = getBlockType(normalizedBlock.blockName);
9287 }
9288 const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName();
9289 if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) {
9290 return;
9291 }
9292 const parsedInnerBlocks = normalizedBlock.innerBlocks.map((innerBlock) => parseRawBlock(innerBlock, options)).filter((innerBlock) => !!innerBlock);
9293 const parsedBlock = createBlock(
9294 normalizedBlock.blockName,
9295 getBlockAttributes(
9296 blockType,
9297 normalizedBlock.innerHTML,
9298 normalizedBlock.attrs
9299 ),
9300 parsedInnerBlocks
9301 );
9302 parsedBlock.originalContent = normalizedBlock.innerHTML;
9303 const validatedBlock = applyBlockValidation(parsedBlock, blockType);
9304 const { validationIssues } = validatedBlock;
9305 const updatedBlock = applyBlockDeprecatedVersions(
9306 validatedBlock,
9307 normalizedBlock,
9308 blockType
9309 );
9310 if (!updatedBlock.isValid) {
9311 updatedBlock.__unstableBlockSource = rawBlock;
9312 }
9313 if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) {
9314 console.groupCollapsed("Updated Block: %s", blockType.name);
9315 console.info(
9316 "Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",
9317 blockType.name,
9318 blockType,
9319 getSaveContent(blockType, updatedBlock.attributes),
9320 updatedBlock.originalContent
9321 );
9322 console.groupEnd();
9323 } else if (!validatedBlock.isValid && !updatedBlock.isValid) {
9324 validationIssues.forEach(({ log: log2, args }) => log2(...args));
9325 }
9326 return updatedBlock;
9327 }
9328 function parse2(content, options) {
9329 return (0, import_block_serialization_default_parser.parse)(content).reduce(
9330 (accumulator, rawBlock) => {
9331 const block = parseRawBlock(
9332 rawBlock,
9333 options
9334 );
9335 if (block) {
9336 accumulator.push(block);
9337 }
9338 return accumulator;
9339 },
9340 []
9341 );
9342 }
9343
9344 // packages/blocks/build-module/api/raw-handling/index.mjs
9345 var import_deprecated10 = __toESM(require_deprecated(), 1);
9346 var import_dom12 = __toESM(require_dom(), 1);
9347
9348 // packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs
9349 var import_element4 = __toESM(require_element(), 1);
9350
9351 // packages/blocks/build-module/api/raw-handling/get-raw-transforms.mjs
9352 function getRawTransforms() {
9353 return getBlockTransforms("from").filter(({ type }) => type === "raw").map((transform) => {
9354 return transform.isMatch ? transform : {
9355 ...transform,
9356 isMatch: (node) => transform.selector && node.matches(transform.selector)
9357 };
9358 });
9359 }
9360
9361 // packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs
9362 function htmlToBlocks(html2, handler) {
9363 const doc = document.implementation.createHTMLDocument("");
9364 doc.body.innerHTML = html2;
9365 return Array.from(doc.body.children).flatMap((node) => {
9366 const transforms = getRawTransforms();
9367 const rawTransform = findTransform(
9368 transforms,
9369 ((t3) => {
9370 const transform2 = t3;
9371 return transform2.isMatch(node);
9372 })
9373 );
9374 if (!rawTransform) {
9375 if (import_element4.Platform.isNative) {
9376 return parse2(
9377 `<!-- wp:html -->${node.outerHTML}<!-- /wp:html -->`
9378 );
9379 }
9380 return createBlock(
9381 // Should not be hardcoded.
9382 "core/html",
9383 getBlockAttributes("core/html", node.outerHTML)
9384 );
9385 }
9386 const { transform, blockName } = rawTransform;
9387 if (transform) {
9388 const block = transform(node, handler);
9389 if (node.hasAttribute("class")) {
9390 block.attributes.className = node.getAttribute("class");
9391 }
9392 return block;
9393 }
9394 return createBlock(
9395 blockName,
9396 getBlockAttributes(blockName, node.outerHTML)
9397 );
9398 });
9399 }
9400
9401 // packages/blocks/build-module/api/raw-handling/normalise-blocks.mjs
9402 var import_dom2 = __toESM(require_dom(), 1);
9403 function normaliseBlocks(HTML, options = {}) {
9404 const decuDoc = document.implementation.createHTMLDocument("");
9405 const accuDoc = document.implementation.createHTMLDocument("");
9406 const decu = decuDoc.body;
9407 const accu = accuDoc.body;
9408 decu.innerHTML = HTML;
9409 while (decu.firstChild) {
9410 const node = decu.firstChild;
9411 if (node.nodeType === node.TEXT_NODE) {
9412 if ((0, import_dom2.isEmpty)(node)) {
9413 decu.removeChild(node);
9414 } else {
9415 if (!accu.lastChild || accu.lastChild.nodeName !== "P") {
9416 accu.appendChild(accuDoc.createElement("P"));
9417 }
9418 accu.lastChild.appendChild(node);
9419 }
9420 } else if (node.nodeType === node.ELEMENT_NODE) {
9421 if (node.nodeName === "BR") {
9422 if (node.nextSibling && node.nextSibling.nodeName === "BR") {
9423 accu.appendChild(accuDoc.createElement("P"));
9424 decu.removeChild(node.nextSibling);
9425 }
9426 if (accu.lastChild && accu.lastChild.nodeName === "P" && accu.lastChild.hasChildNodes()) {
9427 accu.lastChild.appendChild(node);
9428 } else {
9429 decu.removeChild(node);
9430 }
9431 } else if (node.nodeName === "P") {
9432 if ((0, import_dom2.isEmpty)(node) && !options.raw) {
9433 decu.removeChild(node);
9434 } else {
9435 accu.appendChild(node);
9436 }
9437 } else if ((0, import_dom2.isPhrasingContent)(node)) {
9438 if (!accu.lastChild || accu.lastChild.nodeName !== "P") {
9439 accu.appendChild(accuDoc.createElement("P"));
9440 }
9441 accu.lastChild.appendChild(node);
9442 } else {
9443 accu.appendChild(node);
9444 }
9445 } else {
9446 decu.removeChild(node);
9447 }
9448 }
9449 return accu.innerHTML;
9450 }
9451
9452 // packages/blocks/build-module/api/raw-handling/special-comment-converter.mjs
9453 var import_dom3 = __toESM(require_dom(), 1);
9454 function specialCommentConverter(node, doc) {
9455 if (node.nodeType !== node.COMMENT_NODE) {
9456 return;
9457 }
9458 if (node.nodeValue !== "nextpage" && node.nodeValue.indexOf("more") !== 0) {
9459 return;
9460 }
9461 const block = createBlock2(node, doc);
9462 if (!node.parentNode || node.parentNode.nodeName !== "P") {
9463 (0, import_dom3.replace)(node, block);
9464 } else {
9465 const childNodes = Array.from(node.parentNode.childNodes);
9466 const nodeIndex = childNodes.indexOf(node);
9467 const wrapperNode = node.parentNode.parentNode || doc.body;
9468 const paragraphBuilder = (acc, child) => {
9469 if (!acc) {
9470 acc = doc.createElement("p");
9471 }
9472 acc.appendChild(child);
9473 return acc;
9474 };
9475 [
9476 childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null),
9477 block,
9478 childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null)
9479 ].forEach(
9480 (element) => element && wrapperNode.insertBefore(element, node.parentNode)
9481 );
9482 (0, import_dom3.remove)(node.parentNode);
9483 }
9484 }
9485 function createBlock2(commentNode, doc) {
9486 if (commentNode.nodeValue === "nextpage") {
9487 return createNextpage(doc);
9488 }
9489 const customText = commentNode.nodeValue.slice(4).trim();
9490 let sibling = commentNode;
9491 let noTeaser = false;
9492 while (sibling = sibling.nextSibling) {
9493 if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === "noteaser") {
9494 noTeaser = true;
9495 (0, import_dom3.remove)(sibling);
9496 break;
9497 }
9498 }
9499 return createMore(customText, noTeaser, doc);
9500 }
9501 function createMore(customText, noTeaser, doc) {
9502 const node = doc.createElement("wp-block");
9503 node.dataset.block = "core/more";
9504 if (customText) {
9505 node.dataset.customText = customText;
9506 }
9507 if (noTeaser) {
9508 node.dataset.noTeaser = "";
9509 }
9510 return node;
9511 }
9512 function createNextpage(doc) {
9513 const node = doc.createElement("wp-block");
9514 node.dataset.block = "core/nextpage";
9515 return node;
9516 }
9517
9518 // packages/blocks/build-module/api/raw-handling/list-reducer.mjs
9519 var import_dom4 = __toESM(require_dom(), 1);
9520 function isList(node) {
9521 return node.nodeName === "OL" || node.nodeName === "UL";
9522 }
9523 function shallowTextContent(element) {
9524 return Array.from(element.childNodes).map(({ nodeValue = "" }) => nodeValue).join("");
9525 }
9526 function listReducer(node) {
9527 if (!isList(node)) {
9528 return;
9529 }
9530 const list = node;
9531 const prevElement = list.previousElementSibling;
9532 if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) {
9533 while (list.firstChild) {
9534 prevElement.appendChild(list.firstChild);
9535 }
9536 list.parentNode.removeChild(list);
9537 }
9538 const parentElement = node.parentNode;
9539 if (parentElement && parentElement.nodeName === "LI" && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) {
9540 const parentListItem = parentElement;
9541 const prevListItem = parentListItem.previousElementSibling;
9542 const parentList = parentListItem.parentNode;
9543 if (prevListItem) {
9544 prevListItem.appendChild(list);
9545 parentList.removeChild(parentListItem);
9546 }
9547 }
9548 if (parentElement && isList(parentElement)) {
9549 const prevListItem = list.previousElementSibling;
9550 if (prevListItem) {
9551 prevListItem.appendChild(node);
9552 } else {
9553 (0, import_dom4.unwrap)(node);
9554 }
9555 }
9556 }
9557
9558 // packages/blocks/build-module/api/raw-handling/blockquote-normaliser.mjs
9559 function blockquoteNormaliser(options = {}) {
9560 return (bq) => {
9561 if (bq.nodeName !== "BLOCKQUOTE") {
9562 return;
9563 }
9564 const node = bq;
9565 node.innerHTML = normaliseBlocks(node.innerHTML, options);
9566 };
9567 }
9568
9569 // packages/blocks/build-module/api/raw-handling/figure-content-reducer.mjs
9570 var import_dom5 = __toESM(require_dom(), 1);
9571 function isFigureContent(node, schema) {
9572 const tag = node.nodeName.toLowerCase();
9573 if (tag === "figcaption" || (0, import_dom5.isTextContent)(node)) {
9574 return false;
9575 }
9576 return tag in (schema?.figure?.children ?? {});
9577 }
9578 function canHaveAnchor(node, schema) {
9579 const tag = node.nodeName.toLowerCase();
9580 return tag in (schema?.figure?.children?.a?.children ?? {});
9581 }
9582 function wrapFigureContent(element, beforeElement = element) {
9583 const figure = element.ownerDocument.createElement("figure");
9584 beforeElement.parentNode.insertBefore(figure, beforeElement);
9585 figure.appendChild(element);
9586 }
9587 function figureContentReducer(node, doc, schema) {
9588 if (!schema || !isFigureContent(node, schema)) {
9589 return;
9590 }
9591 let nodeToInsert = node;
9592 const parentNode = node.parentNode;
9593 if (canHaveAnchor(node, schema) && parentNode.nodeName === "A" && parentNode.childNodes.length === 1) {
9594 nodeToInsert = node.parentNode;
9595 }
9596 const wrapper = nodeToInsert.closest("p,div");
9597 if (wrapper) {
9598 const element = node;
9599 if (!element.classList) {
9600 wrapFigureContent(nodeToInsert, wrapper);
9601 } else if (element.classList.contains("alignright") || element.classList.contains("alignleft") || element.classList.contains("aligncenter") || !wrapper.textContent.trim()) {
9602 wrapFigureContent(nodeToInsert, wrapper);
9603 }
9604 } else {
9605 wrapFigureContent(nodeToInsert);
9606 }
9607 }
9608
9609 // packages/blocks/build-module/api/raw-handling/shortcode-converter.mjs
9610 var import_shortcode = __toESM(require_shortcode(), 1);
9611 var castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
9612 var beforeLineRegexp = /(\n|<p>|<br\s*\/?>)\s*$/;
9613 var afterLineRegexp = /^\s*(\n|<\/p>|<br\s*\/?>)/;
9614 function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) {
9615 const transformsFrom = getBlockTransforms(
9616 "from"
9617 );
9618 const transformation = findTransform(
9619 transformsFrom,
9620 ((transform) => {
9621 const t3 = transform;
9622 return excludedBlockNames.indexOf(t3.blockName) === -1 && t3.type === "shortcode" && castArray(t3.tag).some(
9623 (tag) => (0, import_shortcode.regexp)(tag).test(HTML)
9624 );
9625 })
9626 );
9627 if (!transformation) {
9628 return [HTML];
9629 }
9630 const transformTags = castArray(transformation.tag);
9631 const transformTag = transformTags.find(
9632 (tag) => (0, import_shortcode.regexp)(tag).test(HTML)
9633 );
9634 let match;
9635 const previousIndex = lastIndex;
9636 if (match = (0, import_shortcode.next)(transformTag, HTML, lastIndex)) {
9637 lastIndex = match.index + match.content.length;
9638 const beforeHTML = HTML.substr(0, match.index);
9639 const afterHTML = HTML.substr(lastIndex);
9640 if (!match.shortcode.content?.includes("<") && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) {
9641 return segmentHTMLToShortcodeBlock(HTML, lastIndex);
9642 }
9643 if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) {
9644 return segmentHTMLToShortcodeBlock(HTML, previousIndex, [
9645 ...excludedBlockNames,
9646 transformation.blockName
9647 ]);
9648 }
9649 let blocks = [];
9650 if (typeof transformation.transform === "function") {
9651 blocks = [].concat(
9652 transformation.transform(match.shortcode.attrs, match)
9653 );
9654 blocks = blocks.map((block) => {
9655 block.originalContent = match.shortcode.content;
9656 return applyBuiltInValidationFixes(
9657 block,
9658 getBlockType(block.name)
9659 );
9660 });
9661 } else {
9662 const attributes = Object.fromEntries(
9663 Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode).map(([key, schema]) => [
9664 key,
9665 schema.shortcode(match.shortcode.attrs, match)
9666 ])
9667 );
9668 const blockType = getBlockType(transformation.blockName);
9669 if (!blockType) {
9670 return [HTML];
9671 }
9672 const transformationBlockType = {
9673 ...blockType,
9674 attributes: transformation.attributes
9675 };
9676 let block = createBlock(
9677 transformation.blockName,
9678 getBlockAttributes(
9679 transformationBlockType,
9680 match.shortcode.content,
9681 attributes
9682 )
9683 );
9684 block.originalContent = match.shortcode.content;
9685 block = applyBuiltInValidationFixes(
9686 block,
9687 transformationBlockType
9688 );
9689 blocks = [block];
9690 }
9691 return [
9692 ...segmentHTMLToShortcodeBlock(
9693 beforeHTML.replace(beforeLineRegexp, "")
9694 ),
9695 ...blocks,
9696 ...segmentHTMLToShortcodeBlock(
9697 afterHTML.replace(afterLineRegexp, "")
9698 )
9699 ];
9700 }
9701 return [HTML];
9702 }
9703 var shortcode_converter_default = segmentHTMLToShortcodeBlock;
9704
9705 // packages/blocks/build-module/api/raw-handling/utils.mjs
9706 var import_dom6 = __toESM(require_dom(), 1);
9707 function getBlockContentSchemaFromTransforms(transforms, context) {
9708 const phrasingContentSchema = (0, import_dom6.getPhrasingContentSchema)(context);
9709 const schemaArgs = { phrasingContentSchema, isPaste: context === "paste" };
9710 const schemas = transforms.map(({ isMatch, blockName, schema }) => {
9711 const hasAnchorSupport = hasBlockSupport(blockName, "anchor");
9712 schema = typeof schema === "function" ? schema(schemaArgs) : schema;
9713 if (!hasAnchorSupport && !isMatch) {
9714 return schema;
9715 }
9716 if (!schema) {
9717 return {};
9718 }
9719 return Object.fromEntries(
9720 Object.entries(schema).map(([key, value]) => {
9721 let attributes = value.attributes || [];
9722 if (hasAnchorSupport) {
9723 attributes = [...attributes, "id"];
9724 }
9725 return [
9726 key,
9727 {
9728 ...value,
9729 attributes,
9730 isMatch: isMatch ? isMatch : void 0
9731 }
9732 ];
9733 })
9734 );
9735 });
9736 function mergeTagNameSchemaProperties(objValue, srcValue, key) {
9737 switch (key) {
9738 case "children": {
9739 if (objValue === "*" || srcValue === "*") {
9740 return "*";
9741 }
9742 return { ...objValue, ...srcValue };
9743 }
9744 case "attributes":
9745 case "require": {
9746 return [...objValue || [], ...srcValue || []];
9747 }
9748 case "isMatch": {
9749 if (!objValue || !srcValue) {
9750 return void 0;
9751 }
9752 return (...args) => {
9753 return objValue(...args) || srcValue(...args);
9754 };
9755 }
9756 }
9757 }
9758 function mergeTagNameSchemas(a2, b2) {
9759 for (const key in b2) {
9760 a2[key] = a2[key] ? mergeTagNameSchemaProperties(a2[key], b2[key], key) : { ...b2[key] };
9761 }
9762 return a2;
9763 }
9764 function mergeSchemas(a2, b2) {
9765 for (const key in b2) {
9766 a2[key] = a2[key] ? mergeTagNameSchemas(a2[key], b2[key]) : { ...b2[key] };
9767 }
9768 return a2;
9769 }
9770 return schemas.reduce(mergeSchemas, {});
9771 }
9772 function getBlockContentSchema(context) {
9773 return getBlockContentSchemaFromTransforms(getRawTransforms(), context);
9774 }
9775 function isPlain(HTML) {
9776 if (!/<(?!br[ />])/i.test(HTML)) {
9777 return true;
9778 }
9779 const doc = document.implementation.createHTMLDocument("");
9780 doc.body.innerHTML = HTML;
9781 if (doc.body.children.length !== 1) {
9782 return false;
9783 }
9784 const wrapper = doc.body.children.item(0);
9785 const descendants = wrapper.getElementsByTagName("*");
9786 for (let i2 = 0; i2 < descendants.length; i2++) {
9787 if (descendants.item(i2).tagName !== "BR") {
9788 return false;
9789 }
9790 }
9791 if (wrapper.tagName !== "SPAN") {
9792 return false;
9793 }
9794 return true;
9795 }
9796 function deepFilterNodeList(nodeList, filters, doc, schema) {
9797 Array.from(nodeList).forEach((node) => {
9798 deepFilterNodeList(node.childNodes, filters, doc, schema);
9799 filters.forEach((item) => {
9800 if (!doc.contains(node)) {
9801 return;
9802 }
9803 item(node, doc, schema);
9804 });
9805 });
9806 }
9807 function deepFilterHTML(HTML, filters = [], schema) {
9808 const doc = document.implementation.createHTMLDocument("");
9809 doc.body.innerHTML = HTML;
9810 deepFilterNodeList(doc.body.childNodes, filters, doc, schema);
9811 return doc.body.innerHTML;
9812 }
9813 function getSibling(node, which) {
9814 const sibling = node[`${which}Sibling`];
9815 if (sibling && (0, import_dom6.isPhrasingContent)(sibling)) {
9816 return sibling;
9817 }
9818 const { parentNode } = node;
9819 if (!parentNode || !(0, import_dom6.isPhrasingContent)(parentNode)) {
9820 return;
9821 }
9822 return getSibling(parentNode, which);
9823 }
9824
9825 // packages/blocks/build-module/api/raw-handling/paste-handler.mjs
9826 var import_dom11 = __toESM(require_dom(), 1);
9827
9828 // packages/blocks/build-module/api/raw-handling/comment-remover.mjs
9829 var import_dom7 = __toESM(require_dom(), 1);
9830 function commentRemover(node) {
9831 if (node.nodeType === node.COMMENT_NODE) {
9832 (0, import_dom7.remove)(node);
9833 }
9834 }
9835
9836 // packages/blocks/build-module/api/raw-handling/is-inline-content.mjs
9837 var import_dom8 = __toESM(require_dom(), 1);
9838 function isInline(node, contextTag) {
9839 if ((0, import_dom8.isTextContent)(node)) {
9840 return true;
9841 }
9842 if (!contextTag) {
9843 return false;
9844 }
9845 const tag = node.nodeName.toLowerCase();
9846 const inlineAllowedTagGroups = [
9847 ["ul", "li", "ol"],
9848 ["h1", "h2", "h3", "h4", "h5", "h6"]
9849 ];
9850 return inlineAllowedTagGroups.some(
9851 (tagGroup) => [tag, contextTag].filter((t3) => !tagGroup.includes(t3)).length === 0
9852 );
9853 }
9854 function deepCheck(nodes, contextTag) {
9855 return nodes.every(
9856 (node) => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag)
9857 );
9858 }
9859 function isDoubleBR(node) {
9860 return node.nodeName === "BR" && !!node.previousSibling && node.previousSibling.nodeName === "BR";
9861 }
9862 function isInlineContent(HTML, contextTag) {
9863 const doc = document.implementation.createHTMLDocument("");
9864 doc.body.innerHTML = HTML;
9865 const nodes = Array.from(doc.body.children);
9866 return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
9867 }
9868
9869 // packages/blocks/build-module/api/raw-handling/phrasing-content-reducer.mjs
9870 var import_dom9 = __toESM(require_dom(), 1);
9871 function phrasingContentReducer(node, doc) {
9872 if (node.nodeName === "SPAN" && node.style) {
9873 const {
9874 fontWeight,
9875 fontStyle,
9876 textDecorationLine,
9877 textDecoration,
9878 verticalAlign
9879 } = node.style;
9880 const element = node;
9881 if (fontWeight === "bold" || fontWeight === "700") {
9882 (0, import_dom9.wrap)(doc.createElement("strong"), element);
9883 }
9884 if (fontStyle === "italic") {
9885 (0, import_dom9.wrap)(doc.createElement("em"), element);
9886 }
9887 if (textDecorationLine === "line-through" || textDecoration.includes("line-through")) {
9888 (0, import_dom9.wrap)(doc.createElement("s"), element);
9889 }
9890 if (verticalAlign === "super") {
9891 (0, import_dom9.wrap)(doc.createElement("sup"), element);
9892 } else if (verticalAlign === "sub") {
9893 (0, import_dom9.wrap)(doc.createElement("sub"), element);
9894 }
9895 } else if (node.nodeName === "B") {
9896 (0, import_dom9.replaceTag)(node, "strong");
9897 } else if (node.nodeName === "I") {
9898 (0, import_dom9.replaceTag)(node, "em");
9899 } else if (node.nodeName === "A") {
9900 const anchor = node;
9901 if (anchor.target && anchor.target.toLowerCase() === "_blank") {
9902 anchor.rel = "noopener";
9903 } else {
9904 anchor.removeAttribute("target");
9905 anchor.removeAttribute("rel");
9906 }
9907 if (anchor.name && !anchor.id) {
9908 anchor.id = anchor.name;
9909 }
9910 if (anchor.id && !anchor.ownerDocument.querySelector(`[href="#${anchor.id}"]`)) {
9911 anchor.removeAttribute("id");
9912 }
9913 }
9914 }
9915
9916 // packages/blocks/build-module/api/raw-handling/head-remover.mjs
9917 function headRemover(node) {
9918 if (node.nodeName !== "SCRIPT" && node.nodeName !== "NOSCRIPT" && node.nodeName !== "TEMPLATE" && node.nodeName !== "STYLE") {
9919 return;
9920 }
9921 node.parentNode.removeChild(node);
9922 }
9923
9924 // packages/blocks/build-module/api/raw-handling/ms-list-ignore.mjs
9925 function msListIgnore(node) {
9926 if (node.nodeType !== node.ELEMENT_NODE) {
9927 return;
9928 }
9929 const el = node;
9930 const style = el.getAttribute("style");
9931 if (!style || !style.includes("mso-list")) {
9932 return;
9933 }
9934 const rules = style.split(";").reduce(
9935 (acc, rule) => {
9936 const [key, value] = rule.split(":");
9937 if (key && value) {
9938 acc[key.trim().toLowerCase()] = value.trim().toLowerCase();
9939 }
9940 return acc;
9941 },
9942 {}
9943 );
9944 if (rules["mso-list"] === "ignore") {
9945 el.remove();
9946 }
9947 }
9948
9949 // packages/blocks/build-module/api/raw-handling/ms-list-converter.mjs
9950 function isList2(node) {
9951 return node.nodeName === "OL" || node.nodeName === "UL";
9952 }
9953 function msListConverter(node, doc) {
9954 if (node.nodeName !== "P") {
9955 return;
9956 }
9957 const element = node;
9958 const style = element.getAttribute("style");
9959 if (!style || !style.includes("mso-list")) {
9960 return;
9961 }
9962 const prevNode = element.previousElementSibling;
9963 if (!prevNode || !isList2(prevNode)) {
9964 const type = element.textContent.trim().slice(0, 1);
9965 const isNumeric = /[1iIaA]/.test(type);
9966 const newListNode = doc.createElement(isNumeric ? "ol" : "ul");
9967 if (isNumeric) {
9968 newListNode.setAttribute("type", type);
9969 }
9970 element.parentNode.insertBefore(newListNode, element);
9971 }
9972 const listNode = element.previousElementSibling;
9973 const listType = listNode.nodeName;
9974 const listItem = doc.createElement("li");
9975 let receivingNode = listNode;
9976 listItem.innerHTML = deepFilterHTML(element.innerHTML, [msListIgnore]);
9977 const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
9978 let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0;
9979 while (level--) {
9980 receivingNode = receivingNode.lastChild || receivingNode;
9981 if (isList2(receivingNode)) {
9982 receivingNode = receivingNode.lastChild || receivingNode;
9983 }
9984 }
9985 if (!isList2(receivingNode)) {
9986 receivingNode = receivingNode.appendChild(
9987 doc.createElement(listType)
9988 );
9989 }
9990 receivingNode.appendChild(listItem);
9991 element.parentNode.removeChild(element);
9992 }
9993
9994 // packages/blocks/build-module/api/raw-handling/image-corrector.mjs
9995 var import_blob = __toESM(require_blob(), 1);
9996 function imageCorrector(img) {
9997 if (img.nodeName !== "IMG") {
9998 return;
9999 }
10000 const node = img;
10001 if (node.src.indexOf("file:") === 0) {
10002 node.src = "";
10003 }
10004 if (node.src.indexOf("data:") === 0) {
10005 const [properties, data] = node.src.split(",");
10006 const [type] = properties.slice(5).split(";");
10007 if (!data || !type) {
10008 node.src = "";
10009 return;
10010 }
10011 let decoded;
10012 try {
10013 decoded = atob(data);
10014 } catch {
10015 node.src = "";
10016 return;
10017 }
10018 const uint8Array = new Uint8Array(decoded.length);
10019 for (let i2 = 0; i2 < uint8Array.length; i2++) {
10020 uint8Array[i2] = decoded.charCodeAt(i2);
10021 }
10022 const name = type.replace("/", ".");
10023 const file = new window.File([uint8Array], name, { type });
10024 node.src = (0, import_blob.createBlobURL)(file);
10025 }
10026 if (node.height === 1 || node.width === 1) {
10027 node.parentNode.removeChild(node);
10028 }
10029 }
10030
10031 // packages/blocks/build-module/api/raw-handling/div-normaliser.mjs
10032 function divNormaliser(div) {
10033 if (div.nodeName !== "DIV") {
10034 return;
10035 }
10036 const node = div;
10037 node.innerHTML = normaliseBlocks(node.innerHTML);
10038 }
10039
10040 // packages/blocks/build-module/api/raw-handling/markdown-converter.mjs
10041 var import_showdown = __toESM(require_showdown(), 1);
10042 var converter = new import_showdown.default.Converter({
10043 noHeaderId: true,
10044 tables: true,
10045 literalMidWordUnderscores: true,
10046 omitExtraWLInCodeBlocks: true,
10047 simpleLineBreaks: true,
10048 strikethrough: true
10049 });
10050 function slackMarkdownVariantCorrector(text2) {
10051 return text2.replace(
10052 /((?:^|\n)```)([^\n`]+)(```(?:$|\n))/,
10053 (match, p1, p2, p3) => `${p1}
10054 ${p2}
10055 ${p3}`
10056 );
10057 }
10058 function bulletsToAsterisks(text2) {
10059 return text2.replace(/(^|\n)•( +)/g, "$1*$2");
10060 }
10061 function markdownConverter(text2) {
10062 return converter.makeHtml(
10063 slackMarkdownVariantCorrector(bulletsToAsterisks(text2))
10064 );
10065 }
10066
10067 // packages/blocks/build-module/api/raw-handling/iframe-remover.mjs
10068 function iframeRemover(iframe) {
10069 if (iframe.nodeName === "IFRAME") {
10070 const node = iframe;
10071 const text2 = node.ownerDocument.createTextNode(node.src);
10072 node.parentNode.replaceChild(text2, node);
10073 }
10074 }
10075
10076 // packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.mjs
10077 var import_dom10 = __toESM(require_dom(), 1);
10078 function googleDocsUIdRemover(node) {
10079 const el = node;
10080 if (!el.id || el.id.indexOf("docs-internal-guid-") !== 0) {
10081 return;
10082 }
10083 if (el.tagName === "B") {
10084 (0, import_dom10.unwrap)(node);
10085 } else {
10086 el.removeAttribute("id");
10087 }
10088 }
10089
10090 // packages/blocks/build-module/api/raw-handling/html-formatting-remover.mjs
10091 function isFormattingSpace(character) {
10092 return character === " " || character === "\r" || character === "\n" || character === " ";
10093 }
10094 function htmlFormattingRemover(node) {
10095 if (node.nodeType !== node.TEXT_NODE) {
10096 return;
10097 }
10098 let parent = node;
10099 while (parent = parent.parentNode) {
10100 if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === "PRE") {
10101 return;
10102 }
10103 }
10104 const textNode = node;
10105 let newData = textNode.data.replace(/[ \r\n\t]+/g, " ");
10106 if (newData[0] === " ") {
10107 const previousSibling = getSibling(node, "previous");
10108 if (!previousSibling || previousSibling.nodeName === "BR" || previousSibling.textContent.slice(-1) === " ") {
10109 newData = newData.slice(1);
10110 }
10111 }
10112 if (newData[newData.length - 1] === " ") {
10113 const nextSibling = getSibling(node, "next");
10114 if (!nextSibling || nextSibling.nodeName === "BR" || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) {
10115 newData = newData.slice(0, -1);
10116 }
10117 }
10118 if (!newData) {
10119 node.parentNode.removeChild(node);
10120 } else {
10121 textNode.data = newData;
10122 }
10123 }
10124
10125 // packages/blocks/build-module/api/raw-handling/br-remover.mjs
10126 function brRemover(node) {
10127 if (node.nodeName !== "BR") {
10128 return;
10129 }
10130 if (getSibling(node, "next")) {
10131 return;
10132 }
10133 node.parentNode.removeChild(node);
10134 }
10135
10136 // packages/blocks/build-module/api/raw-handling/empty-paragraph-remover.mjs
10137 function emptyParagraphRemover(node) {
10138 if (node.nodeName !== "P") {
10139 return;
10140 }
10141 if (node.hasChildNodes()) {
10142 return;
10143 }
10144 node.parentNode.removeChild(node);
10145 }
10146
10147 // packages/blocks/build-module/api/raw-handling/slack-paragraph-corrector.mjs
10148 function slackParagraphCorrector(node) {
10149 if (node.nodeName !== "SPAN") {
10150 return;
10151 }
10152 if (node.getAttribute("data-stringify-type") !== "paragraph-break") {
10153 return;
10154 }
10155 const parentNode = node.parentNode;
10156 parentNode.insertBefore(node.ownerDocument.createElement("br"), node);
10157 parentNode.insertBefore(node.ownerDocument.createElement("br"), node);
10158 parentNode.removeChild(node);
10159 }
10160
10161 // packages/blocks/build-module/api/raw-handling/latex-to-math.mjs
10162 function isLatexMathMode(text2) {
10163 const lettersRegex = /[\p{L}\s]+/gu;
10164 let match;
10165 while (match = lettersRegex.exec(text2)) {
10166 if (text2[match.index - 1] === "{") {
10167 continue;
10168 }
10169 let sequence = match[0];
10170 if (text2[match.index - 1] === "\\") {
10171 sequence = sequence.replace(/^[a-zA-Z]+/, "");
10172 }
10173 if (sequence.length < 6) {
10174 continue;
10175 }
10176 return false;
10177 }
10178 if (/\\[a-zA-Z]+\s*\{/g.test(text2)) {
10179 return true;
10180 }
10181 const softClues = [
10182 (t3) => t3.includes("^") && !t3.startsWith("^"),
10183 (t3) => ["=", "+", "-", "/", "*"].some(
10184 (operator) => t3.includes(operator)
10185 ),
10186 (t3) => /\\[a-zA-Z]+/g.test(t3)
10187 ];
10188 if (softClues.filter((clue) => clue(text2)).length >= 2) {
10189 return true;
10190 }
10191 return false;
10192 }
10193
10194 // packages/blocks/build-module/api/raw-handling/heading-transformer.mjs
10195 function headingTransformer(node) {
10196 if (node.nodeType !== node.ELEMENT_NODE) {
10197 return;
10198 }
10199 const element = node;
10200 if (element.tagName === "P" && element.getAttribute("role") === "heading" && element.hasAttribute("aria-level")) {
10201 const level = parseInt(element.getAttribute("aria-level"), 10);
10202 if (level >= 1 && level <= 6) {
10203 const headingTag = `H${level}`;
10204 const newHeading = element.ownerDocument.createElement(headingTag);
10205 Array.from(element.attributes).forEach((attr2) => {
10206 if (attr2.name !== "role" && attr2.name !== "aria-level") {
10207 newHeading.setAttribute(attr2.name, attr2.value);
10208 }
10209 });
10210 while (element.firstChild) {
10211 newHeading.appendChild(element.firstChild);
10212 }
10213 element.parentNode.replaceChild(newHeading, element);
10214 }
10215 }
10216 }
10217
10218 // packages/blocks/build-module/api/raw-handling/paste-handler.mjs
10219 var log = (...args) => window?.console?.log?.(...args);
10220 function filterInlineHTML(HTML) {
10221 HTML = deepFilterHTML(HTML, [
10222 headRemover,
10223 googleDocsUIdRemover,
10224 msListIgnore,
10225 phrasingContentReducer,
10226 commentRemover
10227 ]);
10228 HTML = (0, import_dom11.removeInvalidHTML)(
10229 HTML,
10230 (0, import_dom11.getPhrasingContentSchema)("paste"),
10231 true
10232 );
10233 HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]);
10234 log("Processed inline HTML:\n\n", HTML);
10235 return HTML;
10236 }
10237 function pasteHandler({
10238 HTML = "",
10239 plainText = "",
10240 mode = "AUTO",
10241 tagName
10242 }) {
10243 log("Received HTML (pasteHandler):\n\n", HTML);
10244 log("Received plain text (pasteHandler):\n\n", plainText);
10245 HTML = HTML.replace(/<meta[^>]+>/g, "");
10246 HTML = HTML.replace(
10247 /^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i,
10248 ""
10249 );
10250 HTML = HTML.replace(
10251 /(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i,
10252 ""
10253 );
10254 if (mode !== "INLINE") {
10255 const content = HTML ? HTML : plainText;
10256 if (content.indexOf("<!-- wp:") !== -1) {
10257 const parseResult = parse2(content);
10258 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform";
10259 if (!isSingleFreeFormBlock) {
10260 return parseResult;
10261 }
10262 }
10263 }
10264 HTML = HTML.normalize();
10265 HTML = deepFilterHTML(HTML, [slackParagraphCorrector]);
10266 const isPlainText = plainText && (!HTML || isPlain(HTML));
10267 if (isPlainText && isLatexMathMode(plainText)) {
10268 return [createBlock("core/math", { latex: plainText })];
10269 }
10270 if (isPlainText) {
10271 HTML = plainText;
10272 if (!/^\s+$/.test(plainText)) {
10273 HTML = markdownConverter(HTML);
10274 }
10275 }
10276 const pieces = shortcode_converter_default(HTML);
10277 const hasShortcodes = pieces.length > 1;
10278 if (isPlainText && !hasShortcodes) {
10279 if (mode === "AUTO" && plainText.indexOf("\n") === -1 && plainText.indexOf("<p>") !== 0 && HTML.indexOf("<p>") === 0) {
10280 mode = "INLINE";
10281 }
10282 }
10283 if (mode === "INLINE") {
10284 return filterInlineHTML(HTML);
10285 }
10286 if (mode === "AUTO" && !hasShortcodes && isInlineContent(HTML, tagName)) {
10287 return filterInlineHTML(HTML);
10288 }
10289 const phrasingContentSchema = (0, import_dom11.getPhrasingContentSchema)("paste");
10290 const blockContentSchema = getBlockContentSchema("paste");
10291 const blocks = pieces.map((piece) => {
10292 if (typeof piece !== "string") {
10293 return piece;
10294 }
10295 const filters = [
10296 googleDocsUIdRemover,
10297 msListConverter,
10298 headRemover,
10299 listReducer,
10300 imageCorrector,
10301 phrasingContentReducer,
10302 specialCommentConverter,
10303 commentRemover,
10304 iframeRemover,
10305 figureContentReducer,
10306 blockquoteNormaliser(),
10307 divNormaliser,
10308 headingTransformer
10309 ];
10310 const schema = {
10311 ...blockContentSchema,
10312 // Keep top-level phrasing content, normalised by `normaliseBlocks`.
10313 ...phrasingContentSchema
10314 };
10315 piece = deepFilterHTML(piece, filters, blockContentSchema);
10316 piece = (0, import_dom11.removeInvalidHTML)(piece, schema, false);
10317 piece = normaliseBlocks(piece);
10318 piece = deepFilterHTML(
10319 piece,
10320 [htmlFormattingRemover, brRemover, emptyParagraphRemover],
10321 blockContentSchema
10322 );
10323 log("Processed HTML piece:\n\n", piece);
10324 return htmlToBlocks(piece, pasteHandler);
10325 }).flat().filter(Boolean);
10326 if (mode === "AUTO" && blocks.length === 1 && hasBlockSupport(blocks[0].name, "__unstablePasteTextInline", false)) {
10327 const trimRegex = /^[\n]+|[\n]+$/g;
10328 const trimmedPlainText = plainText.replace(trimRegex, "");
10329 if (trimmedPlainText !== "" && trimmedPlainText.indexOf("\n") === -1) {
10330 return (0, import_dom11.removeInvalidHTML)(
10331 getBlockInnerHTML(blocks[0]),
10332 phrasingContentSchema,
10333 false
10334 ).replace(trimRegex, "");
10335 }
10336 }
10337 return blocks;
10338 }
10339
10340 // packages/blocks/build-module/api/raw-handling/index.mjs
10341 function deprecatedGetPhrasingContentSchema(context) {
10342 (0, import_deprecated10.default)("wp.blocks.getPhrasingContentSchema", {
10343 since: "5.6",
10344 alternative: "wp.dom.getPhrasingContentSchema"
10345 });
10346 return (0, import_dom12.getPhrasingContentSchema)(context);
10347 }
10348 function rawHandler({ HTML = "" }) {
10349 if (HTML.indexOf("<!-- wp:") !== -1) {
10350 const parseResult = parse2(HTML);
10351 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform";
10352 if (!isSingleFreeFormBlock) {
10353 return parseResult;
10354 }
10355 }
10356 const pieces = shortcode_converter_default(HTML);
10357 const blockContentSchema = getBlockContentSchema();
10358 return pieces.map((piece) => {
10359 if (typeof piece !== "string") {
10360 return piece;
10361 }
10362 const filters = [
10363 // Needed to adjust invalid lists.
10364 listReducer,
10365 // Needed to create more and nextpage blocks.
10366 specialCommentConverter,
10367 // Needed to create media blocks.
10368 figureContentReducer,
10369 // Needed to create the quote block, which cannot handle text
10370 // without wrapper paragraphs.
10371 blockquoteNormaliser({ raw: true })
10372 ];
10373 piece = deepFilterHTML(piece, filters, blockContentSchema);
10374 piece = normaliseBlocks(piece, { raw: true });
10375 return htmlToBlocks(piece, rawHandler);
10376 }).flat().filter(Boolean);
10377 }
10378
10379 // packages/blocks/build-module/api/categories.mjs
10380 var import_data6 = __toESM(require_data(), 1);
10381 function getCategories2() {
10382 return (0, import_data6.select)(store).getCategories();
10383 }
10384 function setCategories2(categories2) {
10385 (0, import_data6.dispatch)(store).setCategories(categories2);
10386 }
10387 function updateCategory2(slug, category) {
10388 (0, import_data6.dispatch)(store).updateCategory(slug, category);
10389 }
10390
10391 // packages/blocks/build-module/api/templates.mjs
10392 var import_element5 = __toESM(require_element(), 1);
10393 function doBlocksMatchTemplate(blocks = [], template = []) {
10394 return blocks.length === template.length && template.every(([name, , innerBlocksTemplate], index) => {
10395 const block = blocks[index];
10396 return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate);
10397 });
10398 }
10399 var isHTMLAttribute = (attributeDefinition) => attributeDefinition?.source === "html";
10400 var isQueryAttribute = (attributeDefinition) => attributeDefinition?.source === "query";
10401 function normalizeAttributes(schema, values) {
10402 if (!values) {
10403 return {};
10404 }
10405 return Object.fromEntries(
10406 Object.entries(values).map(([key, value]) => [
10407 key,
10408 normalizeAttribute(schema[key], value)
10409 ])
10410 );
10411 }
10412 function normalizeAttribute(definition, value) {
10413 if (isHTMLAttribute(definition) && Array.isArray(value)) {
10414 return (0, import_element5.renderToString)(value);
10415 }
10416 if (isQueryAttribute(definition) && value) {
10417 return value.map(
10418 (subValues) => {
10419 return normalizeAttributes(definition.query, subValues);
10420 }
10421 );
10422 }
10423 return value;
10424 }
10425 function synchronizeBlocksWithTemplate(blocks = [], template) {
10426 if (!template) {
10427 return blocks;
10428 }
10429 return template.map(
10430 ([name, attributes, innerBlocksTemplate], index) => {
10431 const block = blocks[index];
10432 if (block && block.name === name) {
10433 const innerBlocks = synchronizeBlocksWithTemplate(
10434 block.innerBlocks,
10435 innerBlocksTemplate
10436 );
10437 return { ...block, innerBlocks };
10438 }
10439 const blockType = getBlockType(name);
10440 const normalizedAttributes = normalizeAttributes(
10441 blockType?.attributes ?? {},
10442 attributes
10443 );
10444 const [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(
10445 name,
10446 normalizedAttributes
10447 );
10448 return createBlock(
10449 blockName,
10450 blockAttributes,
10451 synchronizeBlocksWithTemplate([], innerBlocksTemplate)
10452 );
10453 }
10454 );
10455 }
10456
10457 // packages/blocks/build-module/api/index.mjs
10458 var fieldsKey = /* @__PURE__ */ Symbol("fields");
10459 var formKey = /* @__PURE__ */ Symbol("form");
10460 var privateApis = {};
10461 lock(privateApis, {
10462 isContentBlock,
10463 fieldsKey,
10464 formKey,
10465 parseRawBlock
10466 });
10467
10468 // packages/blocks/build-module/deprecated.mjs
10469 var import_deprecated11 = __toESM(require_deprecated(), 1);
10470 function withBlockContentContext(OriginalComponent) {
10471 (0, import_deprecated11.default)("wp.blocks.withBlockContentContext", {
10472 since: "6.1"
10473 });
10474 return OriginalComponent;
10475 }
10476 return __toCommonJS(index_exports);
10477 })();
10478 /*! Bundled license information:
10479
10480 react-is/cjs/react-is.development.js:
10481 (**
10482 * @license React
10483 * react-is.development.js
10484 *
10485 * Copyright (c) Facebook, Inc. and its affiliates.
10486 *
10487 * This source code is licensed under the MIT license found in the
10488 * LICENSE file in the root directory of this source tree.
10489 *)
10490
10491 showdown/dist/showdown.js:
10492 (*! showdown v 1.9.1 - 02-11-2019 *)
10493
10494 is-plain-object/dist/is-plain-object.mjs:
10495 (*!
10496 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
10497 *
10498 * Copyright (c) 2014-2017, Jon Schlinkert.
10499 * Released under the MIT License.
10500 *)
10501 */
10502 //# sourceMappingURL=index.js.map
10503