| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/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‍\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}‍\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}‍\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}‍\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}‍\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}‍\u2764\uFE0F‍\u{1F468}", 1795 "couple_with_heart_woman_woman": "\u{1F469}‍\u2764\uFE0F‍\u{1F469}", 1796 "couplekiss_man_man": "\u{1F468}‍\u2764\uFE0F‍\u{1F48B}‍\u{1F468}", 1797 "couplekiss_man_woman": "\u{1F48F}", 1798 "couplekiss_woman_woman": "\u{1F469}‍\u2764\uFE0F‍\u{1F48B}‍\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}‍\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}‍\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}‍\u{1F466}", 1898 "family_man_boy_boy": "\u{1F468}‍\u{1F466}‍\u{1F466}", 1899 "family_man_girl": "\u{1F468}‍\u{1F467}", 1900 "family_man_girl_boy": "\u{1F468}‍\u{1F467}‍\u{1F466}", 1901 "family_man_girl_girl": "\u{1F468}‍\u{1F467}‍\u{1F467}", 1902 "family_man_man_boy": "\u{1F468}‍\u{1F468}‍\u{1F466}", 1903 "family_man_man_boy_boy": "\u{1F468}‍\u{1F468}‍\u{1F466}‍\u{1F466}", 1904 "family_man_man_girl": "\u{1F468}‍\u{1F468}‍\u{1F467}", 1905 "family_man_man_girl_boy": "\u{1F468}‍\u{1F468}‍\u{1F467}‍\u{1F466}", 1906 "family_man_man_girl_girl": "\u{1F468}‍\u{1F468}‍\u{1F467}‍\u{1F467}", 1907 "family_man_woman_boy_boy": "\u{1F468}‍\u{1F469}‍\u{1F466}‍\u{1F466}", 1908 "family_man_woman_girl": "\u{1F468}‍\u{1F469}‍\u{1F467}", 1909 "family_man_woman_girl_boy": "\u{1F468}‍\u{1F469}‍\u{1F467}‍\u{1F466}", 1910 "family_man_woman_girl_girl": "\u{1F468}‍\u{1F469}‍\u{1F467}‍\u{1F467}", 1911 "family_woman_boy": "\u{1F469}‍\u{1F466}", 1912 "family_woman_boy_boy": "\u{1F469}‍\u{1F466}‍\u{1F466}", 1913 "family_woman_girl": "\u{1F469}‍\u{1F467}", 1914 "family_woman_girl_boy": "\u{1F469}‍\u{1F467}‍\u{1F466}", 1915 "family_woman_girl_girl": "\u{1F469}‍\u{1F467}‍\u{1F467}", 1916 "family_woman_woman_boy": "\u{1F469}‍\u{1F469}‍\u{1F466}", 1917 "family_woman_woman_boy_boy": "\u{1F469}‍\u{1F469}‍\u{1F466}‍\u{1F466}", 1918 "family_woman_woman_girl": "\u{1F469}‍\u{1F469}‍\u{1F467}", 1919 "family_woman_woman_girl_boy": "\u{1F469}‍\u{1F469}‍\u{1F467}‍\u{1F466}", 1920 "family_woman_woman_girl_girl": "\u{1F469}‍\u{1F469}‍\u{1F467}‍\u{1F467}", 1921 "fast_forward": "\u23E9", 1922 "fax": "\u{1F4E0}", 1923 "fearful": "\u{1F628}", 1924 "feet": "\u{1F43E}", 1925 "female_detective": "\u{1F575}\uFE0F‍\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}‍\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‍\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}‍\u2640\uFE0F", 2003 "guitar": "\u{1F3B8}", 2004 "gun": "\u{1F52B}", 2005 "haircut_woman": "\u{1F487}", 2006 "haircut_man": "\u{1F487}‍\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}‍\u{1F3A8}", 2139 "man_astronaut": "\u{1F468}‍\u{1F680}", 2140 "man_cartwheeling": "\u{1F938}‍\u2642\uFE0F", 2141 "man_cook": "\u{1F468}‍\u{1F373}", 2142 "man_dancing": "\u{1F57A}", 2143 "man_facepalming": "\u{1F926}‍\u2642\uFE0F", 2144 "man_factory_worker": "\u{1F468}‍\u{1F3ED}", 2145 "man_farmer": "\u{1F468}‍\u{1F33E}", 2146 "man_firefighter": "\u{1F468}‍\u{1F692}", 2147 "man_health_worker": "\u{1F468}‍\u2695\uFE0F", 2148 "man_in_tuxedo": "\u{1F935}", 2149 "man_judge": "\u{1F468}‍\u2696\uFE0F", 2150 "man_juggling": "\u{1F939}‍\u2642\uFE0F", 2151 "man_mechanic": "\u{1F468}‍\u{1F527}", 2152 "man_office_worker": "\u{1F468}‍\u{1F4BC}", 2153 "man_pilot": "\u{1F468}‍\u2708\uFE0F", 2154 "man_playing_handball": "\u{1F93E}‍\u2642\uFE0F", 2155 "man_playing_water_polo": "\u{1F93D}‍\u2642\uFE0F", 2156 "man_scientist": "\u{1F468}‍\u{1F52C}", 2157 "man_shrugging": "\u{1F937}‍\u2642\uFE0F", 2158 "man_singer": "\u{1F468}‍\u{1F3A4}", 2159 "man_student": "\u{1F468}‍\u{1F393}", 2160 "man_teacher": "\u{1F468}‍\u{1F3EB}", 2161 "man_technologist": "\u{1F468}‍\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}‍\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}‍\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}‍\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}‍\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}‍\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}‍\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}‍\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‍\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}‍\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}‍\u2640\uFE0F", 2409 "rugby_football": "\u{1F3C9}", 2410 "running_man": "\u{1F3C3}", 2411 "running_shirt_with_sash": "\u{1F3BD}", 2412 "running_woman": "\u{1F3C3}‍\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}‍\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}‍\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}‍\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}‍\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‍\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}‍\u{1F3A8}", 2665 "woman_astronaut": "\u{1F469}‍\u{1F680}", 2666 "woman_cartwheeling": "\u{1F938}‍\u2640\uFE0F", 2667 "woman_cook": "\u{1F469}‍\u{1F373}", 2668 "woman_facepalming": "\u{1F926}‍\u2640\uFE0F", 2669 "woman_factory_worker": "\u{1F469}‍\u{1F3ED}", 2670 "woman_farmer": "\u{1F469}‍\u{1F33E}", 2671 "woman_firefighter": "\u{1F469}‍\u{1F692}", 2672 "woman_health_worker": "\u{1F469}‍\u2695\uFE0F", 2673 "woman_judge": "\u{1F469}‍\u2696\uFE0F", 2674 "woman_juggling": "\u{1F939}‍\u2640\uFE0F", 2675 "woman_mechanic": "\u{1F469}‍\u{1F527}", 2676 "woman_office_worker": "\u{1F469}‍\u{1F4BC}", 2677 "woman_pilot": "\u{1F469}‍\u2708\uFE0F", 2678 "woman_playing_handball": "\u{1F93E}‍\u2640\uFE0F", 2679 "woman_playing_water_polo": "\u{1F93D}‍\u2640\uFE0F", 2680 "woman_scientist": "\u{1F469}‍\u{1F52C}", 2681 "woman_shrugging": "\u{1F937}‍\u2640\uFE0F", 2682 "woman_singer": "\u{1F469}‍\u{1F3A4}", 2683 "woman_student": "\u{1F469}‍\u{1F393}", 2684 "woman_teacher": "\u{1F469}‍\u{1F3EB}", 2685 "woman_technologist": "\u{1F469}‍\u{1F4BB}", 2686 "woman_with_turban": "\u{1F473}‍\u2640\uFE0F", 2687 "womans_clothes": "\u{1F45A}", 2688 "womans_hat": "\u{1F452}", 2689 "women_wrestling": "\u{1F93C}‍\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, " "); 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, """); 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, "&"); 3317 text2 = text2.replace(/<(?![a-z\/?$!])/gi, "<"); 3318 text2 = text2.replace(/</g, "<"); 3319 text2 = text2.replace(/>/g, ">"); 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, "&").replace(/</g, "<").replace(/>/g, ">").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 "<" + inside + ">"; 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(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase(); 3568 } else if (options.rawHeaderId) { 3569 title = title.replace(/ /g, "-").replace(/&/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, """).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, """).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, "&").replace(/"/g, """); 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, """); 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 += " + ">"; 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/stringify.js 6781 var byteToHex = []; 6782 for (let i2 = 0; i2 < 256; ++i2) { 6783 byteToHex.push((i2 + 256).toString(16).slice(1)); 6784 } 6785 function unsafeStringify(arr, offset = 0) { 6786 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]]).toLowerCase(); 6787 } 6788 6789 // node_modules/uuid/dist/rng.js 6790 var rnds8 = new Uint8Array(16); 6791 function rng() { 6792 return crypto.getRandomValues(rnds8); 6793 } 6794 6795 // node_modules/uuid/dist/v4.js 6796 function v4(options, buf, offset) { 6797 if (!buf && !options && crypto.randomUUID) { 6798 return crypto.randomUUID(); 6799 } 6800 return _v4(options, buf, offset); 6801 } 6802 function _v4(options, buf, offset) { 6803 options = options || {}; 6804 const rnds = options.random ?? options.rng?.() ?? rng(); 6805 if (rnds.length < 16) { 6806 throw new Error("Random bytes length must be >= 16"); 6807 } 6808 rnds[6] = rnds[6] & 15 | 64; 6809 rnds[8] = rnds[8] & 63 | 128; 6810 if (buf) { 6811 offset = offset || 0; 6812 if (offset < 0 || offset + 16 > buf.length) { 6813 throw new RangeError(`UUID byte range $offset}:$offset + 15} is out of buffer bounds`); 6814 } 6815 for (let i2 = 0; i2 < 16; ++i2) { 6816 buf[offset + i2] = rnds[i2]; 6817 } 6818 return buf; 6819 } 6820 return unsafeStringify(rnds); 6821 } 6822 var v4_default = v4; 6823 6824 // packages/blocks/build-module/api/factory.mjs 6825 var import_hooks2 = __toESM(require_hooks(), 1); 6826 var getBlockTypeWithTransformMetadata = (blockType, transform) => transform.variationName ? { ...blockType, variationName: transform.variationName } : blockType; 6827 function createBlock(name, attributes = {}, innerBlocks = []) { 6828 if (!isBlockRegistered(name)) { 6829 return createBlock("core/missing", { 6830 originalName: name, 6831 originalContent: "", 6832 originalUndelimitedContent: "" 6833 }); 6834 } 6835 const sanitizedAttributes = __experimentalSanitizeBlockAttributes( 6836 name, 6837 attributes 6838 ); 6839 const clientId = v4_default(); 6840 return { 6841 clientId, 6842 name, 6843 isValid: true, 6844 attributes: sanitizedAttributes, 6845 innerBlocks 6846 }; 6847 } 6848 function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) { 6849 return innerBlocksOrTemplate.map((innerBlock) => { 6850 const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [ 6851 innerBlock.name, 6852 innerBlock.attributes, 6853 innerBlock.innerBlocks 6854 ]; 6855 const [name, attributes, innerBlocks = []] = innerBlockTemplate; 6856 return createBlock( 6857 name, 6858 attributes, 6859 createBlocksFromInnerBlocksTemplate( 6860 innerBlocks 6861 ) 6862 ); 6863 }); 6864 } 6865 function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { 6866 const { name } = block; 6867 if (!isBlockRegistered(name)) { 6868 return createBlock("core/missing", { 6869 originalName: name, 6870 originalContent: "", 6871 originalUndelimitedContent: "" 6872 }); 6873 } 6874 const clientId = v4_default(); 6875 const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, { 6876 ...block.attributes, 6877 ...mergeAttributes 6878 }); 6879 return { 6880 ...block, 6881 clientId, 6882 attributes: sanitizedAttributes, 6883 innerBlocks: newInnerBlocks || block.innerBlocks.map( 6884 (innerBlock) => __experimentalCloneSanitizedBlock(innerBlock) 6885 ) 6886 }; 6887 } 6888 function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) { 6889 const clientId = v4_default(); 6890 return { 6891 ...block, 6892 clientId, 6893 attributes: { 6894 ...block.attributes, 6895 ...mergeAttributes 6896 }, 6897 innerBlocks: newInnerBlocks || block.innerBlocks.map((innerBlock) => cloneBlock(innerBlock)) 6898 }; 6899 } 6900 var isPossibleTransformForSource = (transform, direction, blocks) => { 6901 if (!blocks.length) { 6902 return false; 6903 } 6904 const isMultiBlock = blocks.length > 1; 6905 const firstBlockName = blocks[0].name; 6906 const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock; 6907 if (!isValidForMultiBlocks) { 6908 return false; 6909 } 6910 if (!isWildcardBlockTransform(transform) && !blocks.every((block) => block.name === firstBlockName)) { 6911 return false; 6912 } 6913 const isBlockType = transform.type === "block"; 6914 if (!isBlockType) { 6915 return false; 6916 } 6917 const sourceBlock = blocks[0]; 6918 const hasMatchingName = direction !== "from" || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform); 6919 if (!hasMatchingName) { 6920 return false; 6921 } 6922 if (!isMultiBlock && direction === "from" && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) { 6923 return false; 6924 } 6925 if (!maybeCheckTransformIsMatch(transform, blocks)) { 6926 return false; 6927 } 6928 return true; 6929 }; 6930 var getBlockTypesForPossibleFromTransforms = (blocks) => { 6931 if (!blocks.length) { 6932 return []; 6933 } 6934 const allBlockTypes = getBlockTypes(); 6935 const blockTypesWithPossibleFromTransforms = allBlockTypes.flatMap( 6936 (blockType) => { 6937 const fromTransforms = getBlockTransforms("from", blockType.name); 6938 return fromTransforms.filter( 6939 (transform) => isPossibleTransformForSource(transform, "from", blocks) 6940 ).map( 6941 (transform) => getBlockTypeWithTransformMetadata(blockType, transform) 6942 ); 6943 } 6944 ); 6945 return blockTypesWithPossibleFromTransforms; 6946 }; 6947 var getBlockTypesForPossibleToTransforms = (blocks) => { 6948 if (!blocks.length) { 6949 return []; 6950 } 6951 const sourceBlock = blocks[0]; 6952 const blockType = getBlockType(sourceBlock.name); 6953 const transformsTo = blockType ? getBlockTransforms("to", blockType.name) : []; 6954 const possibleTransforms = transformsTo.filter((transform) => { 6955 return transform && isPossibleTransformForSource(transform, "to", blocks); 6956 }); 6957 return possibleTransforms.flatMap((transformation) => { 6958 return (transformation.blocks || []).map((name) => { 6959 const transformedBlockType = getBlockType(name); 6960 return transformedBlockType ? getBlockTypeWithTransformMetadata( 6961 transformedBlockType, 6962 transformation 6963 ) : void 0; 6964 }); 6965 }).filter((bt) => !!bt); 6966 }; 6967 var isWildcardBlockTransform = (t3) => !!t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*"); 6968 var isContainerGroupBlock = (name) => name === getGroupingBlockName(); 6969 function getPossibleBlockTransformations(blocks) { 6970 if (!blocks.length) { 6971 return []; 6972 } 6973 const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks); 6974 const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks); 6975 const blockTypesByNameAndVariation = /* @__PURE__ */ new Map(); 6976 for (const blockType of [ 6977 ...blockTypesForFromTransforms, 6978 ...blockTypesForToTransforms 6979 ]) { 6980 const key = blockType.variationName ? `$blockType.name}/$blockType.variationName}` : blockType.name; 6981 if (!blockTypesByNameAndVariation.has(key)) { 6982 blockTypesByNameAndVariation.set(key, blockType); 6983 } 6984 } 6985 return [...blockTypesByNameAndVariation.values()]; 6986 } 6987 function findTransform(transforms, predicate) { 6988 const hooks = (0, import_hooks2.createHooks)(); 6989 for (let i2 = 0; i2 < transforms.length; i2++) { 6990 const candidate = transforms[i2]; 6991 if (predicate(candidate)) { 6992 hooks.addFilter( 6993 "transform", 6994 "transform/" + i2.toString(), 6995 (result) => result ? result : candidate, 6996 candidate.priority 6997 ); 6998 } 6999 } 7000 return hooks.applyFilters("transform", null); 7001 } 7002 function getBlockTransforms(direction, blockTypeOrName) { 7003 if (blockTypeOrName === void 0) { 7004 return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat(); 7005 } 7006 const blockType = normalizeBlockType(blockTypeOrName); 7007 const { name: blockName, transforms } = blockType || {}; 7008 const directionTransforms = transforms?.[direction]; 7009 if (!transforms || !Array.isArray(directionTransforms)) { 7010 return []; 7011 } 7012 const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms); 7013 const filteredTransforms = usingMobileTransformations ? directionTransforms.filter((t3) => { 7014 if (t3.type === "raw") { 7015 return true; 7016 } 7017 if (t3.type === "prefix") { 7018 return true; 7019 } 7020 if (!t3.blocks || !t3.blocks.length) { 7021 return false; 7022 } 7023 if (isWildcardBlockTransform(t3)) { 7024 return true; 7025 } 7026 return t3.blocks.every( 7027 (transformBlockName) => transforms.supportedMobileTransforms.includes( 7028 transformBlockName 7029 ) 7030 ); 7031 }) : directionTransforms; 7032 return filteredTransforms.map((transform) => ({ 7033 ...transform, 7034 blockName, 7035 usingMobileTransformations 7036 })); 7037 } 7038 function maybeCheckTransformIsMatch(transform, blocks) { 7039 if (typeof transform.isMatch !== "function") { 7040 return true; 7041 } 7042 const sourceBlock = blocks[0]; 7043 const attributes = transform.isMultiBlock ? blocks.map((block2) => block2.attributes) : sourceBlock.attributes; 7044 const block = transform.isMultiBlock ? blocks : sourceBlock; 7045 return transform.isMatch(attributes, block); 7046 } 7047 function switchToBlockType(blocks, name, variationName) { 7048 const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; 7049 const isMultiBlock = blocksArray.length > 1; 7050 const firstBlock = blocksArray[0]; 7051 const sourceName = firstBlock.name; 7052 const transformationsFrom = getBlockTransforms("from", name); 7053 const transformationsTo = getBlockTransforms("to", sourceName); 7054 const isMatchingVariation = (t3) => variationName ? t3.variationName === variationName : !t3.variationName; 7055 const transformation = findTransform( 7056 transformationsTo, 7057 (t3) => t3.type === "block" && isMatchingVariation(t3) && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) 7058 ) || findTransform( 7059 transformationsFrom, 7060 (t3) => t3.type === "block" && isMatchingVariation(t3) && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) 7061 ); 7062 if (!transformation) { 7063 return null; 7064 } 7065 let transformationResults; 7066 if (transformation.isMultiBlock) { 7067 if ("__experimentalConvert" in transformation) { 7068 transformationResults = transformation.__experimentalConvert(blocksArray); 7069 } else { 7070 transformationResults = transformation.transform( 7071 blocksArray.map((currentBlock) => currentBlock.attributes), 7072 blocksArray.map((currentBlock) => currentBlock.innerBlocks) 7073 ); 7074 } 7075 } else if ("__experimentalConvert" in transformation) { 7076 transformationResults = transformation.__experimentalConvert(firstBlock); 7077 } else { 7078 transformationResults = transformation.transform( 7079 firstBlock.attributes, 7080 firstBlock.innerBlocks 7081 ); 7082 } 7083 if (transformationResults === null || typeof transformationResults !== "object") { 7084 return null; 7085 } 7086 transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults]; 7087 if (transformationResults.some( 7088 (result) => !getBlockType(result.name) 7089 )) { 7090 return null; 7091 } 7092 const hasSwitchedBlock = transformationResults.some( 7093 (result) => result.name === name 7094 ); 7095 if (!hasSwitchedBlock) { 7096 return null; 7097 } 7098 const ret = transformationResults.map((result, index, results) => { 7099 return (0, import_hooks2.applyFilters)( 7100 "blocks.switchToBlockType.transformedBlock", 7101 result, 7102 blocks, 7103 index, 7104 results 7105 ); 7106 }); 7107 return ret; 7108 } 7109 var getBlockFromExample = (name, example) => createBlock( 7110 name, 7111 example.attributes, 7112 (example.innerBlocks ?? []).map( 7113 (innerBlock) => getBlockFromExample(innerBlock.name, innerBlock) 7114 ) 7115 ); 7116 7117 // packages/blocks/build-module/api/parser/index.mjs 7118 var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser(), 1); 7119 var import_autop2 = __toESM(require_autop(), 1); 7120 7121 // packages/blocks/build-module/api/serializer.mjs 7122 var import_element2 = __toESM(require_element(), 1); 7123 var import_hooks3 = __toESM(require_hooks(), 1); 7124 var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); 7125 var import_autop = __toESM(require_autop(), 1); 7126 var import_deprecated6 = __toESM(require_deprecated(), 1); 7127 7128 // packages/blocks/build-module/api/parser/serialize-raw-block.mjs 7129 function serializeRawBlock(rawBlock, options = {}) { 7130 const { isCommentDelimited = true } = options; 7131 const { 7132 blockName, 7133 attrs = {}, 7134 innerBlocks = [], 7135 innerContent = [] 7136 } = rawBlock; 7137 let childIndex = 0; 7138 const content = innerContent.map( 7139 (item) => ( 7140 // `null` denotes a nested block, otherwise we have an HTML fragment. 7141 item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options) 7142 ) 7143 ).join("\n").replace(/\n+/g, "\n").trim(); 7144 return isCommentDelimited ? getCommentDelimitedContent(blockName ?? void 0, attrs, content) : content; 7145 } 7146 7147 // packages/blocks/build-module/api/serializer.mjs 7148 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 7149 function getBlockDefaultClassName(blockName) { 7150 const className = "wp-block-" + blockName.replace(/\//, "-").replace(/^core-/, ""); 7151 return (0, import_hooks3.applyFilters)( 7152 "blocks.getBlockDefaultClassName", 7153 className, 7154 blockName 7155 ); 7156 } 7157 function getBlockMenuDefaultClassName(blockName) { 7158 const className = "editor-block-list-item-" + blockName.replace(/\//, "-").replace(/^core-/, ""); 7159 return (0, import_hooks3.applyFilters)( 7160 "blocks.getBlockMenuDefaultClassName", 7161 className, 7162 blockName 7163 ); 7164 } 7165 var blockPropsProvider = {}; 7166 var innerBlocksPropsProvider = {}; 7167 function getBlockProps(props = {}) { 7168 const { blockType, attributes } = blockPropsProvider; 7169 return getBlockProps.skipFilters ? props : (0, import_hooks3.applyFilters)( 7170 "blocks.getSaveContent.extraProps", 7171 { ...props }, 7172 blockType, 7173 attributes 7174 ); 7175 } 7176 function getInnerBlocksProps(props = {}) { 7177 const { innerBlocks } = innerBlocksPropsProvider; 7178 if (!Array.isArray(innerBlocks)) { 7179 return { ...props, children: innerBlocks }; 7180 } 7181 const html2 = serialize(innerBlocks, { isInnerBlocks: true }); 7182 const children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element2.RawHTML, { children: html2 }); 7183 return { ...props, children }; 7184 } 7185 function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) { 7186 const blockType = normalizeBlockType(blockTypeOrName); 7187 if (!blockType?.save) { 7188 return null; 7189 } 7190 let save = blockType.save; 7191 if (save.prototype instanceof import_element2.Component) { 7192 const SaveClass = save; 7193 const instance = new SaveClass({ attributes }); 7194 save = instance.render.bind(instance); 7195 } 7196 blockPropsProvider.blockType = blockType; 7197 blockPropsProvider.attributes = attributes; 7198 innerBlocksPropsProvider.innerBlocks = innerBlocks; 7199 let element = save({ 7200 attributes, 7201 innerBlocks 7202 }); 7203 if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !((blockType.apiVersion ?? 0) > 1)) { 7204 const props = (0, import_hooks3.applyFilters)( 7205 "blocks.getSaveContent.extraProps", 7206 { ...element.props }, 7207 blockType, 7208 attributes 7209 ); 7210 if (!(0, import_is_shallow_equal.isShallowEqual)(props, element.props)) { 7211 element = (0, import_element2.cloneElement)( 7212 element, 7213 props 7214 ); 7215 } 7216 } 7217 return (0, import_hooks3.applyFilters)( 7218 "blocks.getSaveElement", 7219 element, 7220 blockType, 7221 attributes 7222 ); 7223 } 7224 function getSaveContent(blockTypeOrName, attributes, innerBlocks) { 7225 const blockType = normalizeBlockType( 7226 blockTypeOrName 7227 ); 7228 if (!blockType) { 7229 return ""; 7230 } 7231 return (0, import_element2.renderToString)( 7232 getSaveElement(blockType, attributes, innerBlocks) 7233 ); 7234 } 7235 function getCommentAttributes(blockType, attributes) { 7236 return Object.entries(blockType.attributes ?? {}).reduce( 7237 (accumulator, [key, attributeSchema]) => { 7238 const value = attributes[key]; 7239 if (void 0 === value) { 7240 return accumulator; 7241 } 7242 if (attributeSchema.source !== void 0) { 7243 return accumulator; 7244 } 7245 if (attributeSchema.role === "local") { 7246 return accumulator; 7247 } 7248 if (attributeSchema.__experimentalRole === "local") { 7249 (0, import_deprecated6.default)("__experimentalRole attribute", { 7250 since: "6.7", 7251 version: "6.8", 7252 alternative: "role attribute", 7253 hint: `Check the block.json of the $blockType?.name} block.` 7254 }); 7255 return accumulator; 7256 } 7257 if ("default" in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) { 7258 return accumulator; 7259 } 7260 accumulator[key] = value; 7261 return accumulator; 7262 }, 7263 {} 7264 ); 7265 } 7266 function serializeAttributes(attributes) { 7267 return JSON.stringify(attributes).replaceAll("\\\\", "\\u005c").replaceAll("--", "\\u002d\\u002d").replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("&", "\\u0026").replaceAll('\\"', "\\u0022"); 7268 } 7269 function getBlockInnerHTML(block) { 7270 let saveContent = block.originalContent ?? ""; 7271 if (block.isValid || block.innerBlocks.length) { 7272 try { 7273 saveContent = getSaveContent( 7274 block.name, 7275 block.attributes, 7276 block.innerBlocks 7277 ); 7278 } catch { 7279 } 7280 } 7281 return saveContent; 7282 } 7283 function getCommentDelimitedContent(rawBlockName, attributes, content) { 7284 const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + " " : ""; 7285 const blockName = rawBlockName?.startsWith("core/") ? rawBlockName.slice(5) : rawBlockName; 7286 if (!content) { 7287 return `<!-- wp:$blockName} $serializedAttributes}/-->`; 7288 } 7289 return `<!-- wp:$blockName} $serializedAttributes}--> 7290 ` + content + ` 7291 <!-- /wp:$blockName} -->`; 7292 } 7293 function serializeBlock(block, { isInnerBlocks = false } = {}) { 7294 if (!block.isValid && block.__unstableBlockSource) { 7295 return serializeRawBlock(block.__unstableBlockSource); 7296 } 7297 const blockName = block.name; 7298 const saveContent = getBlockInnerHTML(block); 7299 if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) { 7300 return saveContent; 7301 } 7302 const blockType = getBlockType(blockName); 7303 if (!blockType) { 7304 return saveContent; 7305 } 7306 const saveAttributes = getCommentAttributes(blockType, block.attributes); 7307 return getCommentDelimitedContent(blockName, saveAttributes, saveContent); 7308 } 7309 var __unstableSerializeAndClean = /* @__PURE__ */ (() => { 7310 const cache = /* @__PURE__ */ new WeakMap(); 7311 return (blocks) => { 7312 const cached = cache.get(blocks); 7313 if (cached !== void 0) { 7314 return cached; 7315 } 7316 let effectiveBlocks = blocks; 7317 if (effectiveBlocks.length === 1 && isUnmodifiedDefaultBlock(effectiveBlocks[0])) { 7318 effectiveBlocks = []; 7319 } 7320 let content = serialize(effectiveBlocks); 7321 if (effectiveBlocks.length === 1 && effectiveBlocks[0].name === getFreeformContentHandlerName() && effectiveBlocks[0].name === "core/freeform") { 7322 content = (0, import_autop.removep)(content); 7323 } 7324 cache.set(blocks, content); 7325 return content; 7326 }; 7327 })(); 7328 function serialize(blocks, options) { 7329 const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; 7330 return blocksArray.map((block) => serializeBlock(block, options)).join("\n\n"); 7331 } 7332 7333 // node_modules/simple-html-tokenizer/dist/es6/index.js 7334 var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/; 7335 var CHARCODE = /^#([0-9]+)$/; 7336 var NAMED = /^([A-Za-z0-9]+)$/; 7337 var EntityParser = ( 7338 /** @class */ 7339 (function() { 7340 function EntityParser2(named) { 7341 this.named = named; 7342 } 7343 EntityParser2.prototype.parse = function(entity) { 7344 if (!entity) { 7345 return; 7346 } 7347 var matches = entity.match(HEXCHARCODE); 7348 if (matches) { 7349 return String.fromCharCode(parseInt(matches[1], 16)); 7350 } 7351 matches = entity.match(CHARCODE); 7352 if (matches) { 7353 return String.fromCharCode(parseInt(matches[1], 10)); 7354 } 7355 matches = entity.match(NAMED); 7356 if (matches) { 7357 return this.named[matches[1]]; 7358 } 7359 }; 7360 return EntityParser2; 7361 })() 7362 ); 7363 var WSP = /[\t\n\f ]/; 7364 var ALPHA = /[A-Za-z]/; 7365 var CRLF = /\r\n?/g; 7366 function isSpace(char) { 7367 return WSP.test(char); 7368 } 7369 function isAlpha(char) { 7370 return ALPHA.test(char); 7371 } 7372 function preprocessInput(input) { 7373 return input.replace(CRLF, "\n"); 7374 } 7375 var EventedTokenizer = ( 7376 /** @class */ 7377 (function() { 7378 function EventedTokenizer2(delegate, entityParser) { 7379 this.delegate = delegate; 7380 this.entityParser = entityParser; 7381 this.state = "beforeData"; 7382 this.line = -1; 7383 this.column = -1; 7384 this.input = ""; 7385 this.index = -1; 7386 this.tagNameBuffer = ""; 7387 this.states = { 7388 beforeData: function() { 7389 var char = this.peek(); 7390 if (char === "<") { 7391 this.transitionTo( 7392 "tagOpen" 7393 /* tagOpen */ 7394 ); 7395 this.markTagStart(); 7396 this.consume(); 7397 } else { 7398 if (char === "\n") { 7399 var tag = this.tagNameBuffer.toLowerCase(); 7400 if (tag === "pre" || tag === "textarea") { 7401 this.consume(); 7402 } 7403 } 7404 this.transitionTo( 7405 "data" 7406 /* data */ 7407 ); 7408 this.delegate.beginData(); 7409 } 7410 }, 7411 data: function() { 7412 var char = this.peek(); 7413 if (char === "<") { 7414 this.delegate.finishData(); 7415 this.transitionTo( 7416 "tagOpen" 7417 /* tagOpen */ 7418 ); 7419 this.markTagStart(); 7420 this.consume(); 7421 } else if (char === "&") { 7422 this.consume(); 7423 this.delegate.appendToData(this.consumeCharRef() || "&"); 7424 } else { 7425 this.consume(); 7426 this.delegate.appendToData(char); 7427 } 7428 }, 7429 tagOpen: function() { 7430 var char = this.consume(); 7431 if (char === "!") { 7432 this.transitionTo( 7433 "markupDeclarationOpen" 7434 /* markupDeclarationOpen */ 7435 ); 7436 } else if (char === "/") { 7437 this.transitionTo( 7438 "endTagOpen" 7439 /* endTagOpen */ 7440 ); 7441 } else if (char === "@" || char === ":" || isAlpha(char)) { 7442 this.transitionTo( 7443 "tagName" 7444 /* tagName */ 7445 ); 7446 this.tagNameBuffer = ""; 7447 this.delegate.beginStartTag(); 7448 this.appendToTagName(char); 7449 } 7450 }, 7451 markupDeclarationOpen: function() { 7452 var char = this.consume(); 7453 if (char === "-" && this.input.charAt(this.index) === "-") { 7454 this.consume(); 7455 this.transitionTo( 7456 "commentStart" 7457 /* commentStart */ 7458 ); 7459 this.delegate.beginComment(); 7460 } 7461 }, 7462 commentStart: function() { 7463 var char = this.consume(); 7464 if (char === "-") { 7465 this.transitionTo( 7466 "commentStartDash" 7467 /* commentStartDash */ 7468 ); 7469 } else if (char === ">") { 7470 this.delegate.finishComment(); 7471 this.transitionTo( 7472 "beforeData" 7473 /* beforeData */ 7474 ); 7475 } else { 7476 this.delegate.appendToCommentData(char); 7477 this.transitionTo( 7478 "comment" 7479 /* comment */ 7480 ); 7481 } 7482 }, 7483 commentStartDash: function() { 7484 var char = this.consume(); 7485 if (char === "-") { 7486 this.transitionTo( 7487 "commentEnd" 7488 /* commentEnd */ 7489 ); 7490 } else if (char === ">") { 7491 this.delegate.finishComment(); 7492 this.transitionTo( 7493 "beforeData" 7494 /* beforeData */ 7495 ); 7496 } else { 7497 this.delegate.appendToCommentData("-"); 7498 this.transitionTo( 7499 "comment" 7500 /* comment */ 7501 ); 7502 } 7503 }, 7504 comment: function() { 7505 var char = this.consume(); 7506 if (char === "-") { 7507 this.transitionTo( 7508 "commentEndDash" 7509 /* commentEndDash */ 7510 ); 7511 } else { 7512 this.delegate.appendToCommentData(char); 7513 } 7514 }, 7515 commentEndDash: function() { 7516 var char = this.consume(); 7517 if (char === "-") { 7518 this.transitionTo( 7519 "commentEnd" 7520 /* commentEnd */ 7521 ); 7522 } else { 7523 this.delegate.appendToCommentData("-" + char); 7524 this.transitionTo( 7525 "comment" 7526 /* comment */ 7527 ); 7528 } 7529 }, 7530 commentEnd: function() { 7531 var char = this.consume(); 7532 if (char === ">") { 7533 this.delegate.finishComment(); 7534 this.transitionTo( 7535 "beforeData" 7536 /* beforeData */ 7537 ); 7538 } else { 7539 this.delegate.appendToCommentData("--" + char); 7540 this.transitionTo( 7541 "comment" 7542 /* comment */ 7543 ); 7544 } 7545 }, 7546 tagName: function() { 7547 var char = this.consume(); 7548 if (isSpace(char)) { 7549 this.transitionTo( 7550 "beforeAttributeName" 7551 /* beforeAttributeName */ 7552 ); 7553 } else if (char === "/") { 7554 this.transitionTo( 7555 "selfClosingStartTag" 7556 /* selfClosingStartTag */ 7557 ); 7558 } else if (char === ">") { 7559 this.delegate.finishTag(); 7560 this.transitionTo( 7561 "beforeData" 7562 /* beforeData */ 7563 ); 7564 } else { 7565 this.appendToTagName(char); 7566 } 7567 }, 7568 beforeAttributeName: function() { 7569 var char = this.peek(); 7570 if (isSpace(char)) { 7571 this.consume(); 7572 return; 7573 } else if (char === "/") { 7574 this.transitionTo( 7575 "selfClosingStartTag" 7576 /* selfClosingStartTag */ 7577 ); 7578 this.consume(); 7579 } else if (char === ">") { 7580 this.consume(); 7581 this.delegate.finishTag(); 7582 this.transitionTo( 7583 "beforeData" 7584 /* beforeData */ 7585 ); 7586 } else if (char === "=") { 7587 this.delegate.reportSyntaxError("attribute name cannot start with equals sign"); 7588 this.transitionTo( 7589 "attributeName" 7590 /* attributeName */ 7591 ); 7592 this.delegate.beginAttribute(); 7593 this.consume(); 7594 this.delegate.appendToAttributeName(char); 7595 } else { 7596 this.transitionTo( 7597 "attributeName" 7598 /* attributeName */ 7599 ); 7600 this.delegate.beginAttribute(); 7601 } 7602 }, 7603 attributeName: function() { 7604 var char = this.peek(); 7605 if (isSpace(char)) { 7606 this.transitionTo( 7607 "afterAttributeName" 7608 /* afterAttributeName */ 7609 ); 7610 this.consume(); 7611 } else if (char === "/") { 7612 this.delegate.beginAttributeValue(false); 7613 this.delegate.finishAttributeValue(); 7614 this.consume(); 7615 this.transitionTo( 7616 "selfClosingStartTag" 7617 /* selfClosingStartTag */ 7618 ); 7619 } else if (char === "=") { 7620 this.transitionTo( 7621 "beforeAttributeValue" 7622 /* beforeAttributeValue */ 7623 ); 7624 this.consume(); 7625 } else if (char === ">") { 7626 this.delegate.beginAttributeValue(false); 7627 this.delegate.finishAttributeValue(); 7628 this.consume(); 7629 this.delegate.finishTag(); 7630 this.transitionTo( 7631 "beforeData" 7632 /* beforeData */ 7633 ); 7634 } else if (char === '"' || char === "'" || char === "<") { 7635 this.delegate.reportSyntaxError(char + " is not a valid character within attribute names"); 7636 this.consume(); 7637 this.delegate.appendToAttributeName(char); 7638 } else { 7639 this.consume(); 7640 this.delegate.appendToAttributeName(char); 7641 } 7642 }, 7643 afterAttributeName: function() { 7644 var char = this.peek(); 7645 if (isSpace(char)) { 7646 this.consume(); 7647 return; 7648 } else if (char === "/") { 7649 this.delegate.beginAttributeValue(false); 7650 this.delegate.finishAttributeValue(); 7651 this.consume(); 7652 this.transitionTo( 7653 "selfClosingStartTag" 7654 /* selfClosingStartTag */ 7655 ); 7656 } else if (char === "=") { 7657 this.consume(); 7658 this.transitionTo( 7659 "beforeAttributeValue" 7660 /* beforeAttributeValue */ 7661 ); 7662 } else if (char === ">") { 7663 this.delegate.beginAttributeValue(false); 7664 this.delegate.finishAttributeValue(); 7665 this.consume(); 7666 this.delegate.finishTag(); 7667 this.transitionTo( 7668 "beforeData" 7669 /* beforeData */ 7670 ); 7671 } else { 7672 this.delegate.beginAttributeValue(false); 7673 this.delegate.finishAttributeValue(); 7674 this.transitionTo( 7675 "attributeName" 7676 /* attributeName */ 7677 ); 7678 this.delegate.beginAttribute(); 7679 this.consume(); 7680 this.delegate.appendToAttributeName(char); 7681 } 7682 }, 7683 beforeAttributeValue: function() { 7684 var char = this.peek(); 7685 if (isSpace(char)) { 7686 this.consume(); 7687 } else if (char === '"') { 7688 this.transitionTo( 7689 "attributeValueDoubleQuoted" 7690 /* attributeValueDoubleQuoted */ 7691 ); 7692 this.delegate.beginAttributeValue(true); 7693 this.consume(); 7694 } else if (char === "'") { 7695 this.transitionTo( 7696 "attributeValueSingleQuoted" 7697 /* attributeValueSingleQuoted */ 7698 ); 7699 this.delegate.beginAttributeValue(true); 7700 this.consume(); 7701 } else if (char === ">") { 7702 this.delegate.beginAttributeValue(false); 7703 this.delegate.finishAttributeValue(); 7704 this.consume(); 7705 this.delegate.finishTag(); 7706 this.transitionTo( 7707 "beforeData" 7708 /* beforeData */ 7709 ); 7710 } else { 7711 this.transitionTo( 7712 "attributeValueUnquoted" 7713 /* attributeValueUnquoted */ 7714 ); 7715 this.delegate.beginAttributeValue(false); 7716 this.consume(); 7717 this.delegate.appendToAttributeValue(char); 7718 } 7719 }, 7720 attributeValueDoubleQuoted: function() { 7721 var char = this.consume(); 7722 if (char === '"') { 7723 this.delegate.finishAttributeValue(); 7724 this.transitionTo( 7725 "afterAttributeValueQuoted" 7726 /* afterAttributeValueQuoted */ 7727 ); 7728 } else if (char === "&") { 7729 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); 7730 } else { 7731 this.delegate.appendToAttributeValue(char); 7732 } 7733 }, 7734 attributeValueSingleQuoted: function() { 7735 var char = this.consume(); 7736 if (char === "'") { 7737 this.delegate.finishAttributeValue(); 7738 this.transitionTo( 7739 "afterAttributeValueQuoted" 7740 /* afterAttributeValueQuoted */ 7741 ); 7742 } else if (char === "&") { 7743 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); 7744 } else { 7745 this.delegate.appendToAttributeValue(char); 7746 } 7747 }, 7748 attributeValueUnquoted: function() { 7749 var char = this.peek(); 7750 if (isSpace(char)) { 7751 this.delegate.finishAttributeValue(); 7752 this.consume(); 7753 this.transitionTo( 7754 "beforeAttributeName" 7755 /* beforeAttributeName */ 7756 ); 7757 } else if (char === "/") { 7758 this.delegate.finishAttributeValue(); 7759 this.consume(); 7760 this.transitionTo( 7761 "selfClosingStartTag" 7762 /* selfClosingStartTag */ 7763 ); 7764 } else if (char === "&") { 7765 this.consume(); 7766 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); 7767 } else if (char === ">") { 7768 this.delegate.finishAttributeValue(); 7769 this.consume(); 7770 this.delegate.finishTag(); 7771 this.transitionTo( 7772 "beforeData" 7773 /* beforeData */ 7774 ); 7775 } else { 7776 this.consume(); 7777 this.delegate.appendToAttributeValue(char); 7778 } 7779 }, 7780 afterAttributeValueQuoted: function() { 7781 var char = this.peek(); 7782 if (isSpace(char)) { 7783 this.consume(); 7784 this.transitionTo( 7785 "beforeAttributeName" 7786 /* beforeAttributeName */ 7787 ); 7788 } else if (char === "/") { 7789 this.consume(); 7790 this.transitionTo( 7791 "selfClosingStartTag" 7792 /* selfClosingStartTag */ 7793 ); 7794 } else if (char === ">") { 7795 this.consume(); 7796 this.delegate.finishTag(); 7797 this.transitionTo( 7798 "beforeData" 7799 /* beforeData */ 7800 ); 7801 } else { 7802 this.transitionTo( 7803 "beforeAttributeName" 7804 /* beforeAttributeName */ 7805 ); 7806 } 7807 }, 7808 selfClosingStartTag: function() { 7809 var char = this.peek(); 7810 if (char === ">") { 7811 this.consume(); 7812 this.delegate.markTagAsSelfClosing(); 7813 this.delegate.finishTag(); 7814 this.transitionTo( 7815 "beforeData" 7816 /* beforeData */ 7817 ); 7818 } else { 7819 this.transitionTo( 7820 "beforeAttributeName" 7821 /* beforeAttributeName */ 7822 ); 7823 } 7824 }, 7825 endTagOpen: function() { 7826 var char = this.consume(); 7827 if (char === "@" || char === ":" || isAlpha(char)) { 7828 this.transitionTo( 7829 "tagName" 7830 /* tagName */ 7831 ); 7832 this.tagNameBuffer = ""; 7833 this.delegate.beginEndTag(); 7834 this.appendToTagName(char); 7835 } 7836 } 7837 }; 7838 this.reset(); 7839 } 7840 EventedTokenizer2.prototype.reset = function() { 7841 this.transitionTo( 7842 "beforeData" 7843 /* beforeData */ 7844 ); 7845 this.input = ""; 7846 this.index = 0; 7847 this.line = 1; 7848 this.column = 0; 7849 this.delegate.reset(); 7850 }; 7851 EventedTokenizer2.prototype.transitionTo = function(state) { 7852 this.state = state; 7853 }; 7854 EventedTokenizer2.prototype.tokenize = function(input) { 7855 this.reset(); 7856 this.tokenizePart(input); 7857 this.tokenizeEOF(); 7858 }; 7859 EventedTokenizer2.prototype.tokenizePart = function(input) { 7860 this.input += preprocessInput(input); 7861 while (this.index < this.input.length) { 7862 var handler = this.states[this.state]; 7863 if (handler !== void 0) { 7864 handler.call(this); 7865 } else { 7866 throw new Error("unhandled state " + this.state); 7867 } 7868 } 7869 }; 7870 EventedTokenizer2.prototype.tokenizeEOF = function() { 7871 this.flushData(); 7872 }; 7873 EventedTokenizer2.prototype.flushData = function() { 7874 if (this.state === "data") { 7875 this.delegate.finishData(); 7876 this.transitionTo( 7877 "beforeData" 7878 /* beforeData */ 7879 ); 7880 } 7881 }; 7882 EventedTokenizer2.prototype.peek = function() { 7883 return this.input.charAt(this.index); 7884 }; 7885 EventedTokenizer2.prototype.consume = function() { 7886 var char = this.peek(); 7887 this.index++; 7888 if (char === "\n") { 7889 this.line++; 7890 this.column = 0; 7891 } else { 7892 this.column++; 7893 } 7894 return char; 7895 }; 7896 EventedTokenizer2.prototype.consumeCharRef = function() { 7897 var endIndex = this.input.indexOf(";", this.index); 7898 if (endIndex === -1) { 7899 return; 7900 } 7901 var entity = this.input.slice(this.index, endIndex); 7902 var chars = this.entityParser.parse(entity); 7903 if (chars) { 7904 var count = entity.length; 7905 while (count) { 7906 this.consume(); 7907 count--; 7908 } 7909 this.consume(); 7910 return chars; 7911 } 7912 }; 7913 EventedTokenizer2.prototype.markTagStart = function() { 7914 this.delegate.tagOpen(); 7915 }; 7916 EventedTokenizer2.prototype.appendToTagName = function(char) { 7917 this.tagNameBuffer += char; 7918 this.delegate.appendToTagName(char); 7919 }; 7920 return EventedTokenizer2; 7921 })() 7922 ); 7923 var Tokenizer = ( 7924 /** @class */ 7925 (function() { 7926 function Tokenizer2(entityParser, options) { 7927 if (options === void 0) { 7928 options = {}; 7929 } 7930 this.options = options; 7931 this.token = null; 7932 this.startLine = 1; 7933 this.startColumn = 0; 7934 this.tokens = []; 7935 this.tokenizer = new EventedTokenizer(this, entityParser); 7936 this._currentAttribute = void 0; 7937 } 7938 Tokenizer2.prototype.tokenize = function(input) { 7939 this.tokens = []; 7940 this.tokenizer.tokenize(input); 7941 return this.tokens; 7942 }; 7943 Tokenizer2.prototype.tokenizePart = function(input) { 7944 this.tokens = []; 7945 this.tokenizer.tokenizePart(input); 7946 return this.tokens; 7947 }; 7948 Tokenizer2.prototype.tokenizeEOF = function() { 7949 this.tokens = []; 7950 this.tokenizer.tokenizeEOF(); 7951 return this.tokens[0]; 7952 }; 7953 Tokenizer2.prototype.reset = function() { 7954 this.token = null; 7955 this.startLine = 1; 7956 this.startColumn = 0; 7957 }; 7958 Tokenizer2.prototype.current = function() { 7959 var token = this.token; 7960 if (token === null) { 7961 throw new Error("token was unexpectedly null"); 7962 } 7963 if (arguments.length === 0) { 7964 return token; 7965 } 7966 for (var i2 = 0; i2 < arguments.length; i2++) { 7967 if (token.type === arguments[i2]) { 7968 return token; 7969 } 7970 } 7971 throw new Error("token type was unexpectedly " + token.type); 7972 }; 7973 Tokenizer2.prototype.push = function(token) { 7974 this.token = token; 7975 this.tokens.push(token); 7976 }; 7977 Tokenizer2.prototype.currentAttribute = function() { 7978 return this._currentAttribute; 7979 }; 7980 Tokenizer2.prototype.addLocInfo = function() { 7981 if (this.options.loc) { 7982 this.current().loc = { 7983 start: { 7984 line: this.startLine, 7985 column: this.startColumn 7986 }, 7987 end: { 7988 line: this.tokenizer.line, 7989 column: this.tokenizer.column 7990 } 7991 }; 7992 } 7993 this.startLine = this.tokenizer.line; 7994 this.startColumn = this.tokenizer.column; 7995 }; 7996 Tokenizer2.prototype.beginData = function() { 7997 this.push({ 7998 type: "Chars", 7999 chars: "" 8000 }); 8001 }; 8002 Tokenizer2.prototype.appendToData = function(char) { 8003 this.current( 8004 "Chars" 8005 /* Chars */ 8006 ).chars += char; 8007 }; 8008 Tokenizer2.prototype.finishData = function() { 8009 this.addLocInfo(); 8010 }; 8011 Tokenizer2.prototype.beginComment = function() { 8012 this.push({ 8013 type: "Comment", 8014 chars: "" 8015 }); 8016 }; 8017 Tokenizer2.prototype.appendToCommentData = function(char) { 8018 this.current( 8019 "Comment" 8020 /* Comment */ 8021 ).chars += char; 8022 }; 8023 Tokenizer2.prototype.finishComment = function() { 8024 this.addLocInfo(); 8025 }; 8026 Tokenizer2.prototype.tagOpen = function() { 8027 }; 8028 Tokenizer2.prototype.beginStartTag = function() { 8029 this.push({ 8030 type: "StartTag", 8031 tagName: "", 8032 attributes: [], 8033 selfClosing: false 8034 }); 8035 }; 8036 Tokenizer2.prototype.beginEndTag = function() { 8037 this.push({ 8038 type: "EndTag", 8039 tagName: "" 8040 }); 8041 }; 8042 Tokenizer2.prototype.finishTag = function() { 8043 this.addLocInfo(); 8044 }; 8045 Tokenizer2.prototype.markTagAsSelfClosing = function() { 8046 this.current( 8047 "StartTag" 8048 /* StartTag */ 8049 ).selfClosing = true; 8050 }; 8051 Tokenizer2.prototype.appendToTagName = function(char) { 8052 this.current( 8053 "StartTag", 8054 "EndTag" 8055 /* EndTag */ 8056 ).tagName += char; 8057 }; 8058 Tokenizer2.prototype.beginAttribute = function() { 8059 this._currentAttribute = ["", "", false]; 8060 }; 8061 Tokenizer2.prototype.appendToAttributeName = function(char) { 8062 this.currentAttribute()[0] += char; 8063 }; 8064 Tokenizer2.prototype.beginAttributeValue = function(isQuoted) { 8065 this.currentAttribute()[2] = isQuoted; 8066 }; 8067 Tokenizer2.prototype.appendToAttributeValue = function(char) { 8068 this.currentAttribute()[1] += char; 8069 }; 8070 Tokenizer2.prototype.finishAttributeValue = function() { 8071 this.current( 8072 "StartTag" 8073 /* StartTag */ 8074 ).attributes.push(this._currentAttribute); 8075 }; 8076 Tokenizer2.prototype.reportSyntaxError = function(message) { 8077 this.current().syntaxError = message; 8078 }; 8079 return Tokenizer2; 8080 })() 8081 ); 8082 8083 // packages/blocks/build-module/api/validation/index.mjs 8084 var import_es6 = __toESM(require_es6(), 1); 8085 var import_deprecated7 = __toESM(require_deprecated(), 1); 8086 var import_html_entities = __toESM(require_html_entities(), 1); 8087 8088 // packages/blocks/build-module/api/validation/logger.mjs 8089 function createLogger() { 8090 function createLogHandler(logger) { 8091 return (message, ...args) => logger("Block validation: " + message, ...args); 8092 } 8093 return { 8094 // eslint-disable-next-line no-console 8095 error: createLogHandler(console.error), 8096 // eslint-disable-next-line no-console 8097 warning: createLogHandler(console.warn), 8098 getItems() { 8099 return []; 8100 } 8101 }; 8102 } 8103 function createQueuedLogger() { 8104 const queue = []; 8105 const logger = createLogger(); 8106 return { 8107 error(...args) { 8108 queue.push({ log: logger.error, args }); 8109 }, 8110 warning(...args) { 8111 queue.push({ log: logger.warning, args }); 8112 }, 8113 getItems() { 8114 return queue; 8115 } 8116 }; 8117 } 8118 8119 // packages/blocks/build-module/api/validation/index.mjs 8120 var identity = (x2) => x2; 8121 var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g; 8122 var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/; 8123 var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/; 8124 var BOOLEAN_ATTRIBUTES = [ 8125 "allowfullscreen", 8126 "allowpaymentrequest", 8127 "allowusermedia", 8128 "async", 8129 "autofocus", 8130 "autoplay", 8131 "checked", 8132 "controls", 8133 "default", 8134 "defer", 8135 "disabled", 8136 "download", 8137 "formnovalidate", 8138 "hidden", 8139 "ismap", 8140 "itemscope", 8141 "loop", 8142 "multiple", 8143 "muted", 8144 "nomodule", 8145 "novalidate", 8146 "open", 8147 "playsinline", 8148 "readonly", 8149 "required", 8150 "reversed", 8151 "selected", 8152 "typemustmatch" 8153 ]; 8154 var ENUMERATED_ATTRIBUTES = [ 8155 "autocapitalize", 8156 "autocomplete", 8157 "charset", 8158 "contenteditable", 8159 "crossorigin", 8160 "decoding", 8161 "dir", 8162 "draggable", 8163 "enctype", 8164 "formenctype", 8165 "formmethod", 8166 "http-equiv", 8167 "inputmode", 8168 "kind", 8169 "method", 8170 "preload", 8171 "scope", 8172 "shape", 8173 "spellcheck", 8174 "translate", 8175 "type", 8176 "wrap" 8177 ]; 8178 var MEANINGFUL_ATTRIBUTES = [ 8179 ...BOOLEAN_ATTRIBUTES, 8180 ...ENUMERATED_ATTRIBUTES 8181 ]; 8182 var TEXT_NORMALIZATIONS = [ 8183 identity, 8184 getTextWithCollapsedWhitespace 8185 ]; 8186 var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; 8187 var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; 8188 var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; 8189 function isValidCharacterReference(text2) { 8190 return REGEXP_NAMED_CHARACTER_REFERENCE.test(text2) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text2) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text2); 8191 } 8192 var DecodeEntityParser = class { 8193 /** 8194 * Returns a substitute string for an entity string sequence between `&` 8195 * and `;`, or undefined if no substitution should occur. 8196 * 8197 * @param entity Entity fragment discovered in HTML. 8198 * 8199 * @return Entity substitute value. 8200 */ 8201 parse(entity) { 8202 if (isValidCharacterReference(entity)) { 8203 return (0, import_html_entities.decodeEntities)("&" + entity + ";"); 8204 } 8205 return void 0; 8206 } 8207 }; 8208 function getTextPiecesSplitOnWhitespace(text2) { 8209 return text2.trim().split(REGEXP_WHITESPACE); 8210 } 8211 function getTextWithCollapsedWhitespace(text2) { 8212 return getTextPiecesSplitOnWhitespace(text2).join(" "); 8213 } 8214 function getMeaningfulAttributePairs(token) { 8215 return (token.attributes ?? []).filter((pair) => { 8216 const [key, value] = pair; 8217 return value || key.indexOf("data-") === 0 || MEANINGFUL_ATTRIBUTES.includes(key); 8218 }); 8219 } 8220 function isEquivalentTextTokens(actual, expected, logger = createLogger()) { 8221 let actualChars = actual.chars; 8222 let expectedChars = expected.chars; 8223 for (let i2 = 0; i2 < TEXT_NORMALIZATIONS.length; i2++) { 8224 const normalize = TEXT_NORMALIZATIONS[i2]; 8225 actualChars = normalize(actualChars); 8226 expectedChars = normalize(expectedChars); 8227 if (actualChars === expectedChars) { 8228 return true; 8229 } 8230 } 8231 logger.warning( 8232 "Expected text `%s`, saw `%s`.", 8233 expected.chars, 8234 actual.chars 8235 ); 8236 return false; 8237 } 8238 function getNormalizedLength(value) { 8239 if (0 === parseFloat(value)) { 8240 return "0"; 8241 } 8242 if (value.indexOf(".") === 0) { 8243 return "0" + value; 8244 } 8245 return value; 8246 } 8247 function getNormalizedStyleValue(value) { 8248 const textPieces = getTextPiecesSplitOnWhitespace(value); 8249 const normalizedPieces = textPieces.map(getNormalizedLength); 8250 const result = normalizedPieces.join(" "); 8251 return result.replace(REGEXP_STYLE_URL_TYPE, "url($1)"); 8252 } 8253 function getStyleProperties(text2) { 8254 const pairs = text2.replace(/;?\s*$/, "").split(";").map((style) => { 8255 const [key, ...valueParts] = style.split(":"); 8256 const value = valueParts.join(":"); 8257 return [key.trim(), getNormalizedStyleValue(value.trim())]; 8258 }); 8259 return Object.fromEntries(pairs); 8260 } 8261 var isEqualAttributesOfName = { 8262 class: (actual, expected) => { 8263 const [actualPieces, expectedPieces] = [actual, expected].map( 8264 getTextPiecesSplitOnWhitespace 8265 ); 8266 const actualDiff = actualPieces.filter( 8267 (c2) => !expectedPieces.includes(c2) 8268 ); 8269 const expectedDiff = expectedPieces.filter( 8270 (c2) => !actualPieces.includes(c2) 8271 ); 8272 return actualDiff.length === 0 && expectedDiff.length === 0; 8273 }, 8274 style: (actual, expected) => { 8275 return (0, import_es6.default)( 8276 ...[actual, expected].map(getStyleProperties) 8277 ); 8278 }, 8279 // For each boolean attribute, mere presence of attribute in both is enough 8280 // to assume equivalence. 8281 ...Object.fromEntries( 8282 BOOLEAN_ATTRIBUTES.map((attribute) => [attribute, () => true]) 8283 ) 8284 }; 8285 function isEqualTagAttributePairs(actual, expected, logger = createLogger()) { 8286 if (actual.length !== expected.length) { 8287 logger.warning( 8288 "Expected attributes %o, instead saw %o.", 8289 expected, 8290 actual 8291 ); 8292 return false; 8293 } 8294 const expectedAttributes = {}; 8295 for (let i2 = 0; i2 < expected.length; i2++) { 8296 expectedAttributes[expected[i2][0].toLowerCase()] = expected[i2][1]; 8297 } 8298 for (let i2 = 0; i2 < actual.length; i2++) { 8299 const [name, actualValue] = actual[i2]; 8300 const nameLower = name.toLowerCase(); 8301 if (!expectedAttributes.hasOwnProperty(nameLower)) { 8302 logger.warning("Encountered unexpected attribute `%s`.", name); 8303 return false; 8304 } 8305 const expectedValue = expectedAttributes[nameLower]; 8306 const isEqualAttributes = isEqualAttributesOfName[nameLower]; 8307 if (isEqualAttributes) { 8308 if (!isEqualAttributes(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 } else if (actualValue !== expectedValue) { 8318 logger.warning( 8319 "Expected attribute `%s` of value `%s`, saw `%s`.", 8320 name, 8321 expectedValue, 8322 actualValue 8323 ); 8324 return false; 8325 } 8326 } 8327 return true; 8328 } 8329 var isEqualTokensOfType = { 8330 StartTag: (actual, expected, logger = createLogger()) => { 8331 if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case- 8332 // insensitive check on the assumption that the majority case will 8333 // have exactly equal tag names. 8334 actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) { 8335 logger.warning( 8336 "Expected tag name `%s`, instead saw `%s`.", 8337 expected.tagName, 8338 actual.tagName 8339 ); 8340 return false; 8341 } 8342 return isEqualTagAttributePairs( 8343 ...[actual, expected].map(getMeaningfulAttributePairs), 8344 logger 8345 ); 8346 }, 8347 Chars: isEquivalentTextTokens, 8348 Comment: isEquivalentTextTokens 8349 }; 8350 function getNextNonWhitespaceToken(tokens) { 8351 let token; 8352 while (token = tokens.shift()) { 8353 if (token.type !== "Chars") { 8354 return token; 8355 } 8356 if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) { 8357 return token; 8358 } 8359 } 8360 return void 0; 8361 } 8362 function getHTMLTokens(html2, logger = createLogger()) { 8363 try { 8364 return new Tokenizer(new DecodeEntityParser()).tokenize( 8365 html2 8366 ); 8367 } catch { 8368 logger.warning("Malformed HTML detected: %s", html2); 8369 } 8370 return null; 8371 } 8372 function isClosedByToken(currentToken, nextToken) { 8373 if (!currentToken.selfClosing) { 8374 return false; 8375 } 8376 if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === "EndTag") { 8377 return true; 8378 } 8379 return false; 8380 } 8381 function isEquivalentHTML(actual, expected, logger = createLogger()) { 8382 if (actual === expected) { 8383 return true; 8384 } 8385 const [actualTokens, expectedTokens] = [actual, expected].map( 8386 (html2) => getHTMLTokens(html2, logger) 8387 ); 8388 if (!actualTokens || !expectedTokens) { 8389 return false; 8390 } 8391 let actualToken, expectedToken; 8392 while (actualToken = getNextNonWhitespaceToken(actualTokens)) { 8393 expectedToken = getNextNonWhitespaceToken(expectedTokens); 8394 if (!expectedToken) { 8395 logger.warning( 8396 "Expected end of content, instead saw %o.", 8397 actualToken 8398 ); 8399 return false; 8400 } 8401 if (actualToken.type !== expectedToken.type) { 8402 logger.warning( 8403 "Expected token of type `%s` (%o), instead saw `%s` (%o).", 8404 expectedToken.type, 8405 expectedToken, 8406 actualToken.type, 8407 actualToken 8408 ); 8409 return false; 8410 } 8411 const isEqualTokens = isEqualTokensOfType[actualToken.type]; 8412 if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) { 8413 return false; 8414 } 8415 if (isClosedByToken(actualToken, expectedTokens[0])) { 8416 getNextNonWhitespaceToken(expectedTokens); 8417 } else if (isClosedByToken(expectedToken, actualTokens[0])) { 8418 getNextNonWhitespaceToken(actualTokens); 8419 } 8420 } 8421 if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { 8422 logger.warning( 8423 "Expected %o, instead saw end of content.", 8424 expectedToken 8425 ); 8426 return false; 8427 } 8428 return true; 8429 } 8430 function validateBlock(block, blockTypeOrName = block.name) { 8431 const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName(); 8432 if (isFallbackBlock) { 8433 return [true, []]; 8434 } 8435 const logger = createQueuedLogger(); 8436 const blockType = normalizeBlockType(blockTypeOrName); 8437 let generatedBlockContent; 8438 try { 8439 generatedBlockContent = getSaveContent(blockType, block.attributes); 8440 } catch (error) { 8441 logger.error( 8442 "Block validation failed because an error occurred while generating block content:\n\n%s", 8443 error.toString() 8444 ); 8445 return [false, logger.getItems()]; 8446 } 8447 const isValid = isEquivalentHTML( 8448 block.originalContent, 8449 generatedBlockContent, 8450 logger 8451 ); 8452 if (!isValid) { 8453 logger.error( 8454 "Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s", 8455 blockType.name, 8456 blockType, 8457 generatedBlockContent, 8458 block.originalContent 8459 ); 8460 } 8461 return [isValid, logger.getItems()]; 8462 } 8463 function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { 8464 (0, import_deprecated7.default)("isValidBlockContent introduces opportunity for data loss", { 8465 since: "12.6", 8466 plugin: "Gutenberg", 8467 alternative: "validateBlock" 8468 }); 8469 const blockType = normalizeBlockType(blockTypeOrName); 8470 const block = { 8471 clientId: "", 8472 name: blockType.name, 8473 isValid: true, 8474 attributes, 8475 innerBlocks: [], 8476 originalContent: originalBlockContent 8477 }; 8478 const [isValid] = validateBlock(block, blockType); 8479 return isValid; 8480 } 8481 8482 // packages/blocks/build-module/api/parser/convert-legacy-block.mjs 8483 function convertLegacyBlockNameAndAttributes(name, attributes) { 8484 const newAttributes = { ...attributes }; 8485 if ("core/cover-image" === name) { 8486 name = "core/cover"; 8487 } 8488 if ("core/text" === name || "core/cover-text" === name) { 8489 name = "core/paragraph"; 8490 } 8491 if (name && name.indexOf("core/social-link-") === 0) { 8492 newAttributes.service = name.substring(17); 8493 name = "core/social-link"; 8494 } 8495 if (name && name.indexOf("core-embed/") === 0) { 8496 const providerSlug = name.substring(11); 8497 const deprecated12 = { 8498 speaker: "speaker-deck", 8499 polldaddy: "crowdsignal" 8500 }; 8501 newAttributes.providerNameSlug = providerSlug in deprecated12 ? deprecated12[providerSlug] : providerSlug; 8502 if (!["amazon-kindle", "wordpress"].includes(providerSlug)) { 8503 newAttributes.responsive = true; 8504 } 8505 name = "core/embed"; 8506 } 8507 if (name === "core/post-comment-author") { 8508 name = "core/comment-author-name"; 8509 } 8510 if (name === "core/post-comment-content") { 8511 name = "core/comment-content"; 8512 } 8513 if (name === "core/post-comment-date") { 8514 name = "core/comment-date"; 8515 } 8516 if (name === "core/comments-query-loop") { 8517 name = "core/comments"; 8518 const className = newAttributes.className ?? ""; 8519 if (!className.includes("wp-block-comments-query-loop")) { 8520 newAttributes.className = [ 8521 "wp-block-comments-query-loop", 8522 className 8523 ].join(" "); 8524 } 8525 } 8526 if (name === "core/post-comments") { 8527 name = "core/comments"; 8528 newAttributes.legacy = true; 8529 } 8530 const layout = attributes.layout; 8531 if (layout?.type === "grid" && typeof layout?.columnCount === "string") { 8532 newAttributes.layout = { 8533 ...newAttributes.layout, 8534 columnCount: parseInt(layout.columnCount, 10) 8535 }; 8536 } 8537 const style = attributes.style; 8538 const styleLayout = style?.layout; 8539 if (typeof styleLayout?.columnSpan === "string") { 8540 const columnSpanNumber = parseInt(styleLayout.columnSpan, 10); 8541 newAttributes.style = { 8542 ...newAttributes.style, 8543 layout: { 8544 ...newAttributes.style?.layout, 8545 columnSpan: isNaN(columnSpanNumber) ? void 0 : columnSpanNumber 8546 } 8547 }; 8548 } 8549 if (typeof styleLayout?.rowSpan === "string") { 8550 const rowSpanNumber = parseInt(styleLayout.rowSpan, 10); 8551 newAttributes.style = { 8552 ...newAttributes.style, 8553 layout: { 8554 ...newAttributes.style?.layout, 8555 rowSpan: isNaN(rowSpanNumber) ? void 0 : rowSpanNumber 8556 } 8557 }; 8558 } 8559 return [name, newAttributes]; 8560 } 8561 8562 // node_modules/hpq/es/get-path.js 8563 function getPath(object, path) { 8564 var segments = path.split("."); 8565 var segment; 8566 while (segment = segments.shift()) { 8567 if (!(segment in object)) { 8568 return; 8569 } 8570 object = object[segment]; 8571 } 8572 return object; 8573 } 8574 8575 // node_modules/hpq/es/index.js 8576 var getDocument = /* @__PURE__ */ (function() { 8577 var doc; 8578 return function() { 8579 if (!doc) { 8580 doc = document.implementation.createHTMLDocument(""); 8581 } 8582 return doc; 8583 }; 8584 })(); 8585 function parse(source, matchers) { 8586 if (!matchers) { 8587 return; 8588 } 8589 if ("string" === typeof source) { 8590 var doc = getDocument(); 8591 doc.body.innerHTML = source; 8592 source = doc.body; 8593 } 8594 if ("function" === typeof matchers) { 8595 return matchers(source); 8596 } 8597 if (Object !== matchers.constructor) { 8598 return; 8599 } 8600 return Object.keys(matchers).reduce(function(memo, key) { 8601 memo[key] = parse(source, matchers[key]); 8602 return memo; 8603 }, {}); 8604 } 8605 function prop(selector, name) { 8606 if (1 === arguments.length) { 8607 name = selector; 8608 selector = void 0; 8609 } 8610 return function(node) { 8611 var match = node; 8612 if (selector) { 8613 match = node.querySelector(selector); 8614 } 8615 if (match) { 8616 return getPath(match, name); 8617 } 8618 }; 8619 } 8620 function attr(selector, name) { 8621 if (1 === arguments.length) { 8622 name = selector; 8623 selector = void 0; 8624 } 8625 return function(node) { 8626 var attributes = prop(selector, "attributes")(node); 8627 if (attributes && attributes.hasOwnProperty(name)) { 8628 return attributes[name].value; 8629 } 8630 }; 8631 } 8632 function text(selector) { 8633 return prop(selector, "textContent"); 8634 } 8635 function query(selector, matchers) { 8636 return function(node) { 8637 var matches = node.querySelectorAll(selector); 8638 return [].map.call(matches, function(match) { 8639 return parse(match, matchers); 8640 }); 8641 }; 8642 } 8643 8644 // node_modules/memize/dist/index.js 8645 function memize(fn, options) { 8646 var size = 0; 8647 var head; 8648 var tail; 8649 options = options || {}; 8650 function memoized() { 8651 var node = head, len = arguments.length, args, i2; 8652 searchCache: while (node) { 8653 if (node.args.length !== arguments.length) { 8654 node = node.next; 8655 continue; 8656 } 8657 for (i2 = 0; i2 < len; i2++) { 8658 if (node.args[i2] !== arguments[i2]) { 8659 node = node.next; 8660 continue searchCache; 8661 } 8662 } 8663 if (node !== head) { 8664 if (node === tail) { 8665 tail = node.prev; 8666 } 8667 node.prev.next = node.next; 8668 if (node.next) { 8669 node.next.prev = node.prev; 8670 } 8671 node.next = head; 8672 node.prev = null; 8673 head.prev = node; 8674 head = node; 8675 } 8676 return node.val; 8677 } 8678 args = new Array(len); 8679 for (i2 = 0; i2 < len; i2++) { 8680 args[i2] = arguments[i2]; 8681 } 8682 node = { 8683 args, 8684 // Generate the result from original function 8685 val: fn.apply(null, args) 8686 }; 8687 if (head) { 8688 head.prev = node; 8689 node.next = head; 8690 } else { 8691 tail = node; 8692 } 8693 if (size === /** @type {MemizeOptions} */ 8694 options.maxSize) { 8695 tail = /** @type {MemizeCacheNode} */ 8696 tail.prev; 8697 tail.next = null; 8698 } else { 8699 size++; 8700 } 8701 head = node; 8702 return node.val; 8703 } 8704 memoized.clear = function() { 8705 head = null; 8706 tail = null; 8707 size = 0; 8708 }; 8709 return memoized; 8710 } 8711 8712 // packages/blocks/build-module/api/parser/get-block-attributes.mjs 8713 var import_hooks4 = __toESM(require_hooks(), 1); 8714 var import_rich_text4 = __toESM(require_rich_text(), 1); 8715 8716 // packages/blocks/build-module/api/matchers.mjs 8717 var import_rich_text3 = __toESM(require_rich_text(), 1); 8718 8719 // packages/blocks/build-module/api/node.mjs 8720 var import_deprecated9 = __toESM(require_deprecated(), 1); 8721 8722 // packages/blocks/build-module/api/children.mjs 8723 var import_element3 = __toESM(require_element(), 1); 8724 var import_deprecated8 = __toESM(require_deprecated(), 1); 8725 function getSerializeCapableElement(children) { 8726 return children; 8727 } 8728 function getChildrenArray(children) { 8729 (0, import_deprecated8.default)("wp.blocks.children.getChildrenArray", { 8730 since: "6.1", 8731 version: "6.3", 8732 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8733 }); 8734 return children; 8735 } 8736 function concat(...blockNodes) { 8737 (0, import_deprecated8.default)("wp.blocks.children.concat", { 8738 since: "6.1", 8739 version: "6.3", 8740 alternative: "wp.richText.concat", 8741 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8742 }); 8743 const result = []; 8744 for (let i2 = 0; i2 < blockNodes.length; i2++) { 8745 const blockNode = Array.isArray(blockNodes[i2]) ? blockNodes[i2] : [blockNodes[i2]]; 8746 for (let j2 = 0; j2 < blockNode.length; j2++) { 8747 const child = blockNode[j2]; 8748 const canConcatToPreviousString = typeof child === "string" && typeof result[result.length - 1] === "string"; 8749 if (canConcatToPreviousString) { 8750 result[result.length - 1] += child; 8751 } else { 8752 result.push(child); 8753 } 8754 } 8755 } 8756 return result; 8757 } 8758 function fromDOM22(domNodes) { 8759 (0, import_deprecated8.default)("wp.blocks.children.fromDOM", { 8760 since: "6.1", 8761 version: "6.3", 8762 alternative: "wp.richText.create", 8763 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8764 }); 8765 const result = []; 8766 for (let i2 = 0; i2 < domNodes.length; i2++) { 8767 try { 8768 result.push(fromDOM2(domNodes[i2])); 8769 } catch { 8770 } 8771 } 8772 return result; 8773 } 8774 function toHTML(children) { 8775 (0, import_deprecated8.default)("wp.blocks.children.toHTML", { 8776 since: "6.1", 8777 version: "6.3", 8778 alternative: "wp.richText.toHTMLString", 8779 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8780 }); 8781 const element = getSerializeCapableElement(children); 8782 return (0, import_element3.renderToString)(element); 8783 } 8784 function matcher(selector) { 8785 (0, import_deprecated8.default)("wp.blocks.children.matcher", { 8786 since: "6.1", 8787 version: "6.3", 8788 alternative: "html source", 8789 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8790 }); 8791 return (domNode) => { 8792 let match = domNode; 8793 if (selector) { 8794 match = domNode.querySelector(selector); 8795 } 8796 if (match) { 8797 return fromDOM22(match.childNodes); 8798 } 8799 return []; 8800 }; 8801 } 8802 var children_default = { 8803 concat, 8804 getChildrenArray, 8805 fromDOM: fromDOM22, 8806 toHTML, 8807 matcher 8808 }; 8809 8810 // packages/blocks/build-module/api/node.mjs 8811 function isNodeOfType(node, type) { 8812 (0, import_deprecated9.default)("wp.blocks.node.isNodeOfType", { 8813 since: "6.1", 8814 version: "6.3", 8815 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8816 }); 8817 return typeof node !== "string" && node?.type === type; 8818 } 8819 function getNamedNodeMapAsObject(nodeMap) { 8820 const result = {}; 8821 for (let i2 = 0; i2 < nodeMap.length; i2++) { 8822 const { name, value } = nodeMap[i2]; 8823 result[name] = value; 8824 } 8825 return result; 8826 } 8827 function fromDOM2(domNode) { 8828 (0, import_deprecated9.default)("wp.blocks.node.fromDOM", { 8829 since: "6.1", 8830 version: "6.3", 8831 alternative: "wp.richText.create", 8832 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8833 }); 8834 if (domNode.nodeType === domNode.TEXT_NODE) { 8835 return domNode.nodeValue; 8836 } 8837 if (domNode.nodeType !== domNode.ELEMENT_NODE) { 8838 throw new TypeError( 8839 "A block node can only be created from a node of type text or element." 8840 ); 8841 } 8842 return { 8843 type: domNode.nodeName.toLowerCase(), 8844 props: { 8845 ...getNamedNodeMapAsObject(domNode.attributes), 8846 children: fromDOM22(domNode.childNodes) 8847 } 8848 }; 8849 } 8850 function toHTML2(node) { 8851 (0, import_deprecated9.default)("wp.blocks.node.toHTML", { 8852 since: "6.1", 8853 version: "6.3", 8854 alternative: "wp.richText.toHTMLString", 8855 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8856 }); 8857 return toHTML([node]); 8858 } 8859 function matcher2(selector) { 8860 (0, import_deprecated9.default)("wp.blocks.node.matcher", { 8861 since: "6.1", 8862 version: "6.3", 8863 alternative: "html source", 8864 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8865 }); 8866 return (domNode) => { 8867 let match = domNode; 8868 if (selector) { 8869 match = domNode.querySelector(selector); 8870 } 8871 try { 8872 return fromDOM2(match); 8873 } catch { 8874 return null; 8875 } 8876 }; 8877 } 8878 var node_default = { 8879 isNodeOfType, 8880 fromDOM: fromDOM2, 8881 toHTML: toHTML2, 8882 matcher: matcher2 8883 }; 8884 8885 // packages/blocks/build-module/api/matchers.mjs 8886 function html(selector, multilineTag) { 8887 return (domNode) => { 8888 let match = domNode; 8889 if (selector) { 8890 match = domNode.querySelector(selector); 8891 } 8892 if (!match) { 8893 return ""; 8894 } 8895 if (multilineTag) { 8896 let value = ""; 8897 const length = match.children.length; 8898 for (let index = 0; index < length; index++) { 8899 const child = match.children[index]; 8900 if (child.nodeName.toLowerCase() !== multilineTag) { 8901 continue; 8902 } 8903 value += child.outerHTML; 8904 } 8905 return value; 8906 } 8907 return match.innerHTML; 8908 }; 8909 } 8910 var richText = (selector, preserveWhiteSpace) => (el) => { 8911 const target = selector ? el.querySelector(selector) : el; 8912 return target ? import_rich_text3.RichTextData.fromHTMLElement(target, { 8913 preserveWhiteSpace 8914 }) : import_rich_text3.RichTextData.empty(); 8915 }; 8916 8917 // packages/blocks/build-module/api/parser/get-block-attributes.mjs 8918 var toBooleanAttributeMatcher = (matcher3) => (value) => matcher3(value) !== void 0; 8919 function isOfType(value, type) { 8920 switch (type) { 8921 case "rich-text": 8922 return value instanceof import_rich_text4.RichTextData; 8923 case "string": 8924 return typeof value === "string"; 8925 case "boolean": 8926 return typeof value === "boolean"; 8927 case "object": 8928 return !!value && value.constructor === Object; 8929 case "null": 8930 return value === null; 8931 case "array": 8932 return Array.isArray(value); 8933 case "integer": 8934 case "number": 8935 return typeof value === "number"; 8936 } 8937 return true; 8938 } 8939 function isOfTypes(value, types) { 8940 return types.some((type) => isOfType(value, type)); 8941 } 8942 function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) { 8943 let value; 8944 switch (attributeSchema.source) { 8945 // An undefined source means that it's an attribute serialized to the 8946 // block's "comment". 8947 case void 0: 8948 value = commentAttributes ? commentAttributes[attributeKey] : void 0; 8949 break; 8950 // raw source means that it's the original raw block content. 8951 case "raw": 8952 value = innerHTML; 8953 break; 8954 case "attribute": 8955 case "property": 8956 case "html": 8957 case "text": 8958 case "rich-text": 8959 case "children": 8960 case "node": 8961 case "query": 8962 case "tag": 8963 value = parseWithAttributeSchema(innerDOM, attributeSchema); 8964 break; 8965 } 8966 if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) { 8967 value = void 0; 8968 } 8969 if (value === void 0) { 8970 value = getDefault(attributeSchema); 8971 } 8972 return value; 8973 } 8974 function isValidByType(value, type) { 8975 return type === void 0 || isOfTypes(value, Array.isArray(type) ? type : [type]); 8976 } 8977 function isValidByEnum(value, enumSet) { 8978 return !Array.isArray(enumSet) || enumSet.includes(value); 8979 } 8980 var matcherFromSource = memize( 8981 (sourceConfig) => { 8982 switch (sourceConfig.source) { 8983 case "attribute": { 8984 let matcher3 = attr( 8985 sourceConfig.selector, 8986 sourceConfig.attribute 8987 ); 8988 if (sourceConfig.type === "boolean") { 8989 matcher3 = toBooleanAttributeMatcher(matcher3); 8990 } 8991 return matcher3; 8992 } 8993 case "html": 8994 return html(sourceConfig.selector, sourceConfig.multiline); 8995 case "text": 8996 return text(sourceConfig.selector); 8997 case "rich-text": 8998 return richText( 8999 sourceConfig.selector, 9000 sourceConfig.__unstablePreserveWhiteSpace 9001 ); 9002 case "children": 9003 return matcher(sourceConfig.selector); 9004 case "node": 9005 return matcher2(sourceConfig.selector); 9006 case "query": 9007 const subMatchers = Object.fromEntries( 9008 Object.entries(sourceConfig.query).map( 9009 ([key, subSourceConfig]) => [ 9010 key, 9011 matcherFromSource(subSourceConfig) 9012 ] 9013 ) 9014 ); 9015 return query(sourceConfig.selector, subMatchers); 9016 case "tag": { 9017 const matcher3 = prop(sourceConfig.selector, "nodeName"); 9018 return (domNode) => matcher3(domNode)?.toLowerCase(); 9019 } 9020 default: 9021 console.error( 9022 `Unknown source type "${sourceConfig.source}"` 9023 ); 9024 return void 0; 9025 } 9026 } 9027 ); 9028 function parseHtml(innerHTML) { 9029 return parse(innerHTML, (h2) => h2); 9030 } 9031 function parseWithAttributeSchema(innerHTML, attributeSchema) { 9032 return matcherFromSource(attributeSchema)( 9033 parseHtml(innerHTML) 9034 ); 9035 } 9036 function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) { 9037 const doc = parseHtml(innerHTML); 9038 const blockType = normalizeBlockType(blockTypeOrName); 9039 const blockAttributes = Object.fromEntries( 9040 Object.entries(blockType?.attributes ?? {}).map( 9041 ([key, schema]) => [ 9042 key, 9043 getBlockAttribute(key, schema, doc, attributes, innerHTML) 9044 ] 9045 ) 9046 ); 9047 return (0, import_hooks4.applyFilters)( 9048 "blocks.getBlockAttributes", 9049 blockAttributes, 9050 blockType, 9051 innerHTML, 9052 attributes 9053 ); 9054 } 9055 9056 // packages/blocks/build-module/api/parser/fix-custom-classname.mjs 9057 var CLASS_ATTR_SCHEMA = { 9058 type: "string", 9059 source: "attribute", 9060 selector: "[data-custom-class-name] > *", 9061 attribute: "class" 9062 }; 9063 function getHTMLRootElementClasses(innerHTML) { 9064 const parsed = parseWithAttributeSchema( 9065 `<div data-custom-class-name>$innerHTML}</div>`, 9066 CLASS_ATTR_SCHEMA 9067 ); 9068 return parsed ? parsed.trim().split(/\s+/) : []; 9069 } 9070 function fixCustomClassname(blockAttributes, blockType, innerHTML) { 9071 if (!hasBlockSupport(blockType, "customClassName", true)) { 9072 return blockAttributes; 9073 } 9074 const modifiedBlockAttributes = { ...blockAttributes }; 9075 const { className: omittedClassName, ...attributesSansClassName } = modifiedBlockAttributes; 9076 const serialized = getSaveContent(blockType, attributesSansClassName); 9077 const defaultClasses = getHTMLRootElementClasses(serialized); 9078 const actualClasses = getHTMLRootElementClasses(innerHTML); 9079 const customClasses = actualClasses.filter( 9080 (className) => !defaultClasses.includes(className) 9081 ); 9082 if (customClasses.length) { 9083 modifiedBlockAttributes.className = customClasses.join(" "); 9084 } else if (serialized) { 9085 delete modifiedBlockAttributes.className; 9086 } 9087 return modifiedBlockAttributes; 9088 } 9089 9090 // packages/blocks/build-module/api/parser/fix-global-attribute.mjs 9091 function getHTMLRootElement(innerHTML, dataAttribute, attributeSchema) { 9092 const parsed = parseWithAttributeSchema( 9093 `<div $dataAttribute}>$innerHTML}</div>`, 9094 attributeSchema 9095 ); 9096 return parsed; 9097 } 9098 function fixGlobalAttribute(blockAttributes, blockType, innerHTML, supportKey, dataAttribute, attributeSchema) { 9099 if (!hasBlockSupport(blockType, supportKey, false)) { 9100 return blockAttributes; 9101 } 9102 const modifiedBlockAttributes = { ...blockAttributes }; 9103 const attributeValue = getHTMLRootElement( 9104 innerHTML, 9105 dataAttribute, 9106 attributeSchema 9107 ); 9108 if (attributeValue) { 9109 modifiedBlockAttributes[supportKey] = attributeValue; 9110 } 9111 return modifiedBlockAttributes; 9112 } 9113 9114 // packages/blocks/build-module/api/parser/apply-built-in-validation-fixes.mjs 9115 var ARIA_LABEL_ATTR_SCHEMA = { 9116 type: "string", 9117 source: "attribute", 9118 selector: "[data-aria-label] > *", 9119 attribute: "aria-label" 9120 }; 9121 var ANCHOR_ATTR_SCHEMA = { 9122 type: "string", 9123 source: "attribute", 9124 selector: "[data-anchor] > *", 9125 attribute: "id" 9126 }; 9127 function applyBuiltInValidationFixes(block, blockType) { 9128 const { attributes, originalContent } = block; 9129 let updatedBlockAttributes = attributes; 9130 updatedBlockAttributes = fixCustomClassname( 9131 attributes, 9132 blockType, 9133 originalContent ?? "" 9134 ); 9135 updatedBlockAttributes = fixGlobalAttribute( 9136 updatedBlockAttributes, 9137 blockType, 9138 originalContent ?? "", 9139 "ariaLabel", 9140 "data-aria-label", 9141 ARIA_LABEL_ATTR_SCHEMA 9142 ); 9143 updatedBlockAttributes = fixGlobalAttribute( 9144 updatedBlockAttributes, 9145 blockType, 9146 originalContent ?? "", 9147 "anchor", 9148 "data-anchor", 9149 ANCHOR_ATTR_SCHEMA 9150 ); 9151 return { 9152 ...block, 9153 attributes: updatedBlockAttributes 9154 }; 9155 } 9156 9157 // packages/blocks/build-module/api/parser/apply-block-deprecated-versions.mjs 9158 function stubFalse() { 9159 return false; 9160 } 9161 function applyBlockDeprecatedVersions(block, rawBlock, blockType) { 9162 const parsedAttributes = rawBlock.attrs ?? {}; 9163 const { deprecated: deprecatedDefinitions } = blockType; 9164 if (!deprecatedDefinitions || !deprecatedDefinitions.length) { 9165 return block; 9166 } 9167 for (let i2 = 0; i2 < deprecatedDefinitions.length; i2++) { 9168 const { isEligible = stubFalse } = deprecatedDefinitions[i2]; 9169 if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, { 9170 blockNode: rawBlock, 9171 block 9172 })) { 9173 continue; 9174 } 9175 const deprecatedBlockType = Object.assign( 9176 omit( 9177 blockType, 9178 DEPRECATED_ENTRY_KEYS 9179 ), 9180 deprecatedDefinitions[i2] 9181 ); 9182 let migratedBlock = { 9183 ...block, 9184 attributes: getBlockAttributes( 9185 deprecatedBlockType, 9186 block.originalContent ?? "", 9187 parsedAttributes 9188 ) 9189 }; 9190 let [isValid] = validateBlock(migratedBlock, deprecatedBlockType); 9191 if (!isValid) { 9192 migratedBlock = applyBuiltInValidationFixes( 9193 migratedBlock, 9194 deprecatedBlockType 9195 ); 9196 [isValid] = validateBlock(migratedBlock, deprecatedBlockType); 9197 } 9198 if (!isValid) { 9199 continue; 9200 } 9201 let migratedInnerBlocks = migratedBlock.innerBlocks; 9202 let migratedAttributes = migratedBlock.attributes; 9203 const { migrate } = deprecatedBlockType; 9204 if (migrate) { 9205 let migrated = migrate(migratedAttributes, block.innerBlocks); 9206 if (!Array.isArray(migrated)) { 9207 migrated = [migrated]; 9208 } 9209 [ 9210 migratedAttributes = parsedAttributes, 9211 migratedInnerBlocks = block.innerBlocks 9212 ] = migrated; 9213 } 9214 block = { 9215 ...block, 9216 attributes: migratedAttributes, 9217 innerBlocks: migratedInnerBlocks, 9218 isValid: true, 9219 validationIssues: [] 9220 }; 9221 } 9222 return block; 9223 } 9224 9225 // packages/blocks/build-module/api/parser/index.mjs 9226 function convertLegacyBlocks(rawBlock) { 9227 const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes( 9228 rawBlock.blockName, 9229 rawBlock.attrs ?? {} 9230 ); 9231 return { 9232 ...rawBlock, 9233 blockName: correctName, 9234 attrs: correctedAttributes 9235 }; 9236 } 9237 function normalizeRawBlock(rawBlock, options) { 9238 const fallbackBlockName = getFreeformContentHandlerName(); 9239 const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName(); 9240 const rawAttributes = rawBlock.attrs || {}; 9241 const rawInnerBlocks = rawBlock.innerBlocks || []; 9242 let rawInnerHTML = rawBlock.innerHTML.trim(); 9243 if (rawBlockName === fallbackBlockName && rawBlockName === "core/freeform" && !options?.__unstableSkipAutop) { 9244 rawInnerHTML = (0, import_autop2.autop)(rawInnerHTML).trim(); 9245 } 9246 return { 9247 ...rawBlock, 9248 blockName: rawBlockName, 9249 attrs: rawAttributes, 9250 innerHTML: rawInnerHTML, 9251 innerBlocks: rawInnerBlocks 9252 }; 9253 } 9254 function createMissingBlockType(rawBlock) { 9255 const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName(); 9256 const originalUndelimitedContent = serializeRawBlock(rawBlock, { 9257 isCommentDelimited: false 9258 }); 9259 const originalContent = serializeRawBlock(rawBlock, { 9260 isCommentDelimited: true 9261 }); 9262 return { 9263 blockName: unregisteredFallbackBlock, 9264 attrs: { 9265 originalName: rawBlock.blockName, 9266 originalContent, 9267 originalUndelimitedContent 9268 }, 9269 innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML, 9270 innerBlocks: rawBlock.innerBlocks, 9271 innerContent: rawBlock.innerContent 9272 }; 9273 } 9274 function applyBlockValidation(unvalidatedBlock, blockType) { 9275 const [isValid] = validateBlock(unvalidatedBlock, blockType); 9276 if (isValid) { 9277 return { ...unvalidatedBlock, isValid, validationIssues: [] }; 9278 } 9279 const fixedBlock = applyBuiltInValidationFixes( 9280 unvalidatedBlock, 9281 blockType 9282 ); 9283 const [isFixedValid, validationIssues] = validateBlock( 9284 fixedBlock, 9285 blockType 9286 ); 9287 return { ...fixedBlock, isValid: isFixedValid, validationIssues }; 9288 } 9289 function parseRawBlock(rawBlock, options) { 9290 let normalizedBlock = normalizeRawBlock(rawBlock, options); 9291 normalizedBlock = convertLegacyBlocks(normalizedBlock); 9292 let blockType = getBlockType(normalizedBlock.blockName); 9293 if (!blockType) { 9294 normalizedBlock = createMissingBlockType(normalizedBlock); 9295 blockType = getBlockType(normalizedBlock.blockName); 9296 } 9297 const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName(); 9298 if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) { 9299 return; 9300 } 9301 const parsedInnerBlocks = normalizedBlock.innerBlocks.map((innerBlock) => parseRawBlock(innerBlock, options)).filter((innerBlock) => !!innerBlock); 9302 const parsedBlock = createBlock( 9303 normalizedBlock.blockName, 9304 getBlockAttributes( 9305 blockType, 9306 normalizedBlock.innerHTML, 9307 normalizedBlock.attrs 9308 ), 9309 parsedInnerBlocks 9310 ); 9311 parsedBlock.originalContent = normalizedBlock.innerHTML; 9312 const validatedBlock = applyBlockValidation(parsedBlock, blockType); 9313 const { validationIssues } = validatedBlock; 9314 const updatedBlock = applyBlockDeprecatedVersions( 9315 validatedBlock, 9316 normalizedBlock, 9317 blockType 9318 ); 9319 if (!updatedBlock.isValid) { 9320 updatedBlock.__unstableBlockSource = rawBlock; 9321 } 9322 if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) { 9323 console.groupCollapsed("Updated Block: %s", blockType.name); 9324 console.info( 9325 "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", 9326 blockType.name, 9327 blockType, 9328 getSaveContent(blockType, updatedBlock.attributes), 9329 updatedBlock.originalContent 9330 ); 9331 console.groupEnd(); 9332 } else if (!validatedBlock.isValid && !updatedBlock.isValid) { 9333 validationIssues.forEach(({ log: log2, args }) => log2(...args)); 9334 } 9335 return updatedBlock; 9336 } 9337 function parse2(content, options) { 9338 return (0, import_block_serialization_default_parser.parse)(content).reduce( 9339 (accumulator, rawBlock) => { 9340 const block = parseRawBlock( 9341 rawBlock, 9342 options 9343 ); 9344 if (block) { 9345 accumulator.push(block); 9346 } 9347 return accumulator; 9348 }, 9349 [] 9350 ); 9351 } 9352 9353 // packages/blocks/build-module/api/raw-handling/index.mjs 9354 var import_deprecated10 = __toESM(require_deprecated(), 1); 9355 var import_dom12 = __toESM(require_dom(), 1); 9356 9357 // packages/blocks/build-module/api/raw-handling/get-raw-transforms.mjs 9358 function getRawTransforms() { 9359 return getBlockTransforms("from").filter(({ type }) => type === "raw").map((transform) => { 9360 return transform.isMatch ? transform : { 9361 ...transform, 9362 isMatch: (node) => transform.selector && node.matches(transform.selector) 9363 }; 9364 }); 9365 } 9366 9367 // packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs 9368 function htmlToBlocks(html2, handler) { 9369 const doc = document.implementation.createHTMLDocument(""); 9370 doc.body.innerHTML = html2; 9371 return Array.from(doc.body.children).flatMap((node) => { 9372 const transforms = getRawTransforms(); 9373 const rawTransform = findTransform( 9374 transforms, 9375 ((t3) => { 9376 const transform2 = t3; 9377 return transform2.isMatch(node); 9378 }) 9379 ); 9380 if (!rawTransform) { 9381 return createBlock( 9382 // Should not be hardcoded. 9383 "core/html", 9384 getBlockAttributes("core/html", node.outerHTML) 9385 ); 9386 } 9387 const { transform, blockName } = rawTransform; 9388 if (transform) { 9389 const block = transform(node, handler); 9390 if (node.hasAttribute("class")) { 9391 block.attributes.className = node.getAttribute("class"); 9392 } 9393 return block; 9394 } 9395 return createBlock( 9396 blockName, 9397 getBlockAttributes(blockName, node.outerHTML) 9398 ); 9399 }); 9400 } 9401 9402 // packages/blocks/build-module/api/raw-handling/normalise-blocks.mjs 9403 var import_dom2 = __toESM(require_dom(), 1); 9404 function normaliseBlocks(HTML, options = {}) { 9405 const decuDoc = document.implementation.createHTMLDocument(""); 9406 const accuDoc = document.implementation.createHTMLDocument(""); 9407 const decu = decuDoc.body; 9408 const accu = accuDoc.body; 9409 decu.innerHTML = HTML; 9410 while (decu.firstChild) { 9411 const node = decu.firstChild; 9412 if (node.nodeType === node.TEXT_NODE) { 9413 if ((0, import_dom2.isEmpty)(node)) { 9414 decu.removeChild(node); 9415 } else { 9416 if (!accu.lastChild || accu.lastChild.nodeName !== "P") { 9417 accu.appendChild(accuDoc.createElement("P")); 9418 } 9419 accu.lastChild.appendChild(node); 9420 } 9421 } else if (node.nodeType === node.ELEMENT_NODE) { 9422 if (node.nodeName === "BR") { 9423 if (node.nextSibling && node.nextSibling.nodeName === "BR") { 9424 accu.appendChild(accuDoc.createElement("P")); 9425 decu.removeChild(node.nextSibling); 9426 } 9427 if (accu.lastChild && accu.lastChild.nodeName === "P" && accu.lastChild.hasChildNodes()) { 9428 accu.lastChild.appendChild(node); 9429 } else { 9430 decu.removeChild(node); 9431 } 9432 } else if (node.nodeName === "P") { 9433 if ((0, import_dom2.isEmpty)(node) && !options.raw) { 9434 decu.removeChild(node); 9435 } else { 9436 accu.appendChild(node); 9437 } 9438 } else if ((0, import_dom2.isPhrasingContent)(node)) { 9439 if (!accu.lastChild || accu.lastChild.nodeName !== "P") { 9440 accu.appendChild(accuDoc.createElement("P")); 9441 } 9442 accu.lastChild.appendChild(node); 9443 } else { 9444 accu.appendChild(node); 9445 } 9446 } else { 9447 decu.removeChild(node); 9448 } 9449 } 9450 return accu.innerHTML; 9451 } 9452 9453 // packages/blocks/build-module/api/raw-handling/special-comment-converter.mjs 9454 var import_dom3 = __toESM(require_dom(), 1); 9455 function specialCommentConverter(node, doc) { 9456 if (node.nodeType !== node.COMMENT_NODE) { 9457 return; 9458 } 9459 if (node.nodeValue !== "nextpage" && node.nodeValue.indexOf("more") !== 0) { 9460 return; 9461 } 9462 const block = createBlock2(node, doc); 9463 if (!node.parentNode || node.parentNode.nodeName !== "P") { 9464 (0, import_dom3.replace)(node, block); 9465 } else { 9466 const childNodes = Array.from(node.parentNode.childNodes); 9467 const nodeIndex = childNodes.indexOf(node); 9468 const wrapperNode = node.parentNode.parentNode || doc.body; 9469 const paragraphBuilder = (acc, child) => { 9470 if (!acc) { 9471 acc = doc.createElement("p"); 9472 } 9473 acc.appendChild(child); 9474 return acc; 9475 }; 9476 [ 9477 childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null), 9478 block, 9479 childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null) 9480 ].forEach( 9481 (element) => element && wrapperNode.insertBefore(element, node.parentNode) 9482 ); 9483 (0, import_dom3.remove)(node.parentNode); 9484 } 9485 } 9486 function createBlock2(commentNode, doc) { 9487 if (commentNode.nodeValue === "nextpage") { 9488 return createNextpage(doc); 9489 } 9490 const customText = commentNode.nodeValue.slice(4).trim(); 9491 let sibling = commentNode; 9492 let noTeaser = false; 9493 while (sibling = sibling.nextSibling) { 9494 if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === "noteaser") { 9495 noTeaser = true; 9496 (0, import_dom3.remove)(sibling); 9497 break; 9498 } 9499 } 9500 return createMore(customText, noTeaser, doc); 9501 } 9502 function createMore(customText, noTeaser, doc) { 9503 const node = doc.createElement("wp-block"); 9504 node.dataset.block = "core/more"; 9505 if (customText) { 9506 node.dataset.customText = customText; 9507 } 9508 if (noTeaser) { 9509 node.dataset.noTeaser = ""; 9510 } 9511 return node; 9512 } 9513 function createNextpage(doc) { 9514 const node = doc.createElement("wp-block"); 9515 node.dataset.block = "core/nextpage"; 9516 return node; 9517 } 9518 9519 // packages/blocks/build-module/api/raw-handling/list-reducer.mjs 9520 var import_dom4 = __toESM(require_dom(), 1); 9521 function isList(node) { 9522 return node.nodeName === "OL" || node.nodeName === "UL"; 9523 } 9524 function shallowTextContent(element) { 9525 return Array.from(element.childNodes).map(({ nodeValue = "" }) => nodeValue).join(""); 9526 } 9527 function listReducer(node) { 9528 if (!isList(node)) { 9529 return; 9530 } 9531 const list = node; 9532 const prevElement = list.previousElementSibling; 9533 if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { 9534 while (list.firstChild) { 9535 prevElement.appendChild(list.firstChild); 9536 } 9537 list.parentNode.removeChild(list); 9538 } 9539 const parentElement = node.parentNode; 9540 if (parentElement && parentElement.nodeName === "LI" && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { 9541 const parentListItem = parentElement; 9542 const prevListItem = parentListItem.previousElementSibling; 9543 const parentList = parentListItem.parentNode; 9544 if (prevListItem) { 9545 prevListItem.appendChild(list); 9546 parentList.removeChild(parentListItem); 9547 } 9548 } 9549 if (parentElement && isList(parentElement)) { 9550 const prevListItem = list.previousElementSibling; 9551 if (prevListItem) { 9552 prevListItem.appendChild(node); 9553 } else { 9554 (0, import_dom4.unwrap)(node); 9555 } 9556 } 9557 } 9558 9559 // packages/blocks/build-module/api/raw-handling/blockquote-normaliser.mjs 9560 function blockquoteNormaliser(options = {}) { 9561 return (bq) => { 9562 if (bq.nodeName !== "BLOCKQUOTE") { 9563 return; 9564 } 9565 const node = bq; 9566 node.innerHTML = normaliseBlocks(node.innerHTML, options); 9567 }; 9568 } 9569 9570 // packages/blocks/build-module/api/raw-handling/figure-content-reducer.mjs 9571 var import_dom5 = __toESM(require_dom(), 1); 9572 function isFigureContent(node, schema) { 9573 const tag = node.nodeName.toLowerCase(); 9574 if (tag === "figcaption" || (0, import_dom5.isTextContent)(node)) { 9575 return false; 9576 } 9577 return tag in (schema?.figure?.children ?? {}); 9578 } 9579 function canHaveAnchor(node, schema) { 9580 const tag = node.nodeName.toLowerCase(); 9581 return tag in (schema?.figure?.children?.a?.children ?? {}); 9582 } 9583 function wrapFigureContent(element, beforeElement = element) { 9584 const figure = element.ownerDocument.createElement("figure"); 9585 beforeElement.parentNode.insertBefore(figure, beforeElement); 9586 figure.appendChild(element); 9587 } 9588 function figureContentReducer(node, doc, schema) { 9589 if (!schema || !isFigureContent(node, schema)) { 9590 return; 9591 } 9592 let nodeToInsert = node; 9593 const parentNode = node.parentNode; 9594 if (canHaveAnchor(node, schema) && parentNode.nodeName === "A" && parentNode.childNodes.length === 1) { 9595 nodeToInsert = node.parentNode; 9596 } 9597 const wrapper = nodeToInsert.closest("p,div"); 9598 if (wrapper) { 9599 const element = node; 9600 if (!element.classList) { 9601 wrapFigureContent(nodeToInsert, wrapper); 9602 } else if (element.classList.contains("alignright") || element.classList.contains("alignleft") || element.classList.contains("aligncenter") || !wrapper.textContent.trim()) { 9603 wrapFigureContent(nodeToInsert, wrapper); 9604 } 9605 } else { 9606 wrapFigureContent(nodeToInsert); 9607 } 9608 } 9609 9610 // packages/blocks/build-module/api/raw-handling/shortcode-converter.mjs 9611 var import_shortcode = __toESM(require_shortcode(), 1); 9612 var castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; 9613 var beforeLineRegexp = /(\n|<p>|<br\s*\/?>)\s*$/; 9614 var afterLineRegexp = /^\s*(\n|<\/p>|<br\s*\/?>)/; 9615 function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) { 9616 const transformsFrom = getBlockTransforms( 9617 "from" 9618 ); 9619 const transformation = findTransform( 9620 transformsFrom, 9621 ((transform) => { 9622 const t3 = transform; 9623 return excludedBlockNames.indexOf(t3.blockName) === -1 && t3.type === "shortcode" && castArray(t3.tag).some( 9624 (tag) => (0, import_shortcode.regexp)(tag).test(HTML) 9625 ); 9626 }) 9627 ); 9628 if (!transformation) { 9629 return [HTML]; 9630 } 9631 const transformTags = castArray(transformation.tag); 9632 const transformTag = transformTags.find( 9633 (tag) => (0, import_shortcode.regexp)(tag).test(HTML) 9634 ); 9635 let match; 9636 const previousIndex = lastIndex; 9637 if (match = (0, import_shortcode.next)(transformTag, HTML, lastIndex)) { 9638 lastIndex = match.index + match.content.length; 9639 const beforeHTML = HTML.substr(0, match.index); 9640 const afterHTML = HTML.substr(lastIndex); 9641 if (!match.shortcode.content?.includes("<") && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) { 9642 return segmentHTMLToShortcodeBlock(HTML, lastIndex); 9643 } 9644 if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { 9645 return segmentHTMLToShortcodeBlock(HTML, previousIndex, [ 9646 ...excludedBlockNames, 9647 transformation.blockName 9648 ]); 9649 } 9650 let blocks = []; 9651 if (typeof transformation.transform === "function") { 9652 blocks = [].concat( 9653 transformation.transform(match.shortcode.attrs, match) 9654 ); 9655 blocks = blocks.map((block) => { 9656 block.originalContent = match.shortcode.content; 9657 return applyBuiltInValidationFixes( 9658 block, 9659 getBlockType(block.name) 9660 ); 9661 }); 9662 } else { 9663 const attributes = Object.fromEntries( 9664 Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode).map(([key, schema]) => [ 9665 key, 9666 schema.shortcode(match.shortcode.attrs, match) 9667 ]) 9668 ); 9669 const blockType = getBlockType(transformation.blockName); 9670 if (!blockType) { 9671 return [HTML]; 9672 } 9673 const transformationBlockType = { 9674 ...blockType, 9675 attributes: transformation.attributes 9676 }; 9677 let block = createBlock( 9678 transformation.blockName, 9679 getBlockAttributes( 9680 transformationBlockType, 9681 match.shortcode.content, 9682 attributes 9683 ) 9684 ); 9685 block.originalContent = match.shortcode.content; 9686 block = applyBuiltInValidationFixes( 9687 block, 9688 transformationBlockType 9689 ); 9690 blocks = [block]; 9691 } 9692 return [ 9693 ...segmentHTMLToShortcodeBlock( 9694 beforeHTML.replace(beforeLineRegexp, "") 9695 ), 9696 ...blocks, 9697 ...segmentHTMLToShortcodeBlock( 9698 afterHTML.replace(afterLineRegexp, "") 9699 ) 9700 ]; 9701 } 9702 return [HTML]; 9703 } 9704 var shortcode_converter_default = segmentHTMLToShortcodeBlock; 9705 9706 // packages/blocks/build-module/api/raw-handling/utils.mjs 9707 var import_dom6 = __toESM(require_dom(), 1); 9708 function getBlockContentSchemaFromTransforms(transforms, context) { 9709 const phrasingContentSchema = (0, import_dom6.getPhrasingContentSchema)(context); 9710 const schemaArgs = { phrasingContentSchema, isPaste: context === "paste" }; 9711 const schemas = transforms.map(({ isMatch, blockName, schema }) => { 9712 const hasAnchorSupport = hasBlockSupport(blockName, "anchor"); 9713 schema = typeof schema === "function" ? schema(schemaArgs) : schema; 9714 if (!hasAnchorSupport && !isMatch) { 9715 return schema; 9716 } 9717 if (!schema) { 9718 return {}; 9719 } 9720 return Object.fromEntries( 9721 Object.entries(schema).map(([key, value]) => { 9722 let attributes = value.attributes || []; 9723 if (hasAnchorSupport) { 9724 attributes = [...attributes, "id"]; 9725 } 9726 return [ 9727 key, 9728 { 9729 ...value, 9730 attributes, 9731 isMatch: isMatch ? isMatch : void 0 9732 } 9733 ]; 9734 }) 9735 ); 9736 }); 9737 function mergeTagNameSchemaProperties(objValue, srcValue, key) { 9738 switch (key) { 9739 case "children": { 9740 if (objValue === "*" || srcValue === "*") { 9741 return "*"; 9742 } 9743 return mergeSchemas( 9744 { ...objValue || {} }, 9745 srcValue || {} 9746 ); 9747 } 9748 case "attributes": 9749 case "require": { 9750 return Array.from( 9751 /* @__PURE__ */ new Set([...objValue || [], ...srcValue || []]) 9752 ); 9753 } 9754 case "isMatch": { 9755 if (!objValue || !srcValue) { 9756 return void 0; 9757 } 9758 return (...args) => { 9759 return objValue(...args) || srcValue(...args); 9760 }; 9761 } 9762 case "classes": { 9763 if ((objValue || []).includes("*") || (srcValue || []).includes("*")) { 9764 return ["*"]; 9765 } 9766 return [...objValue || [], ...srcValue || []]; 9767 } 9768 } 9769 } 9770 function mergeTagNameSchemas(a2, b2) { 9771 if (a2 === b2) { 9772 return a2; 9773 } 9774 for (const key in b2) { 9775 if (a2[key]) { 9776 a2[key] = mergeTagNameSchemaProperties( 9777 a2[key], 9778 b2[key], 9779 key 9780 ); 9781 } else if (Array.isArray(b2[key])) { 9782 a2[key] = b2[key].slice(); 9783 } else { 9784 a2[key] = { ...b2[key] }; 9785 } 9786 } 9787 return a2; 9788 } 9789 function mergeSchemas(a2, b2) { 9790 if (a2 === b2) { 9791 return a2; 9792 } 9793 for (const key in b2) { 9794 if (a2[key]) { 9795 a2[key] = mergeTagNameSchemas(a2[key], b2[key]); 9796 } else if (Array.isArray(b2[key])) { 9797 a2[key] = b2[key].slice(); 9798 } else { 9799 a2[key] = { ...b2[key] }; 9800 } 9801 } 9802 return a2; 9803 } 9804 return schemas.reduce(mergeSchemas, {}); 9805 } 9806 function getBlockContentSchema(context) { 9807 return getBlockContentSchemaFromTransforms(getRawTransforms(), context); 9808 } 9809 function isPlain(HTML) { 9810 if (!/<(?!br[ />])/i.test(HTML)) { 9811 return true; 9812 } 9813 const doc = document.implementation.createHTMLDocument(""); 9814 doc.body.innerHTML = HTML; 9815 if (doc.body.children.length !== 1) { 9816 return false; 9817 } 9818 const wrapper = doc.body.children.item(0); 9819 const descendants = wrapper.getElementsByTagName("*"); 9820 for (let i2 = 0; i2 < descendants.length; i2++) { 9821 if (descendants.item(i2).tagName !== "BR") { 9822 return false; 9823 } 9824 } 9825 if (wrapper.tagName !== "SPAN") { 9826 return false; 9827 } 9828 return true; 9829 } 9830 function deepFilterNodeList(nodeList, filters, doc, schema) { 9831 Array.from(nodeList).forEach((node) => { 9832 deepFilterNodeList(node.childNodes, filters, doc, schema); 9833 filters.forEach((item) => { 9834 if (!doc.contains(node)) { 9835 return; 9836 } 9837 item(node, doc, schema); 9838 }); 9839 }); 9840 } 9841 function deepFilterHTML(HTML, filters = [], schema) { 9842 const doc = document.implementation.createHTMLDocument(""); 9843 doc.body.innerHTML = HTML; 9844 deepFilterNodeList(doc.body.childNodes, filters, doc, schema); 9845 return doc.body.innerHTML; 9846 } 9847 function getSibling(node, which) { 9848 const sibling = node[`$which}Sibling`]; 9849 if (sibling && (0, import_dom6.isPhrasingContent)(sibling)) { 9850 return sibling; 9851 } 9852 const { parentNode } = node; 9853 if (!parentNode || !(0, import_dom6.isPhrasingContent)(parentNode)) { 9854 return; 9855 } 9856 return getSibling(parentNode, which); 9857 } 9858 9859 // packages/blocks/build-module/api/raw-handling/paste-handler.mjs 9860 var import_dom11 = __toESM(require_dom(), 1); 9861 9862 // packages/blocks/build-module/api/raw-handling/comment-remover.mjs 9863 var import_dom7 = __toESM(require_dom(), 1); 9864 function commentRemover(node) { 9865 if (node.nodeType === node.COMMENT_NODE) { 9866 (0, import_dom7.remove)(node); 9867 } 9868 } 9869 9870 // packages/blocks/build-module/api/raw-handling/is-inline-content.mjs 9871 var import_dom8 = __toESM(require_dom(), 1); 9872 function isInline(node, contextTag) { 9873 if ((0, import_dom8.isTextContent)(node)) { 9874 return true; 9875 } 9876 if (!contextTag) { 9877 return false; 9878 } 9879 const tag = node.nodeName.toLowerCase(); 9880 const inlineAllowedTagGroups = [ 9881 ["ul", "li", "ol"], 9882 ["h1", "h2", "h3", "h4", "h5", "h6"] 9883 ]; 9884 return inlineAllowedTagGroups.some( 9885 (tagGroup) => [tag, contextTag].filter((t3) => !tagGroup.includes(t3)).length === 0 9886 ); 9887 } 9888 function deepCheck(nodes, contextTag) { 9889 return nodes.every( 9890 (node) => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag) 9891 ); 9892 } 9893 function isDoubleBR(node) { 9894 return node.nodeName === "BR" && !!node.previousSibling && node.previousSibling.nodeName === "BR"; 9895 } 9896 function isInlineContent(HTML, contextTag) { 9897 const doc = document.implementation.createHTMLDocument(""); 9898 doc.body.innerHTML = HTML; 9899 const nodes = Array.from(doc.body.children); 9900 return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); 9901 } 9902 9903 // packages/blocks/build-module/api/raw-handling/phrasing-content-reducer.mjs 9904 var import_dom9 = __toESM(require_dom(), 1); 9905 function phrasingContentReducer(node, doc) { 9906 if (node.nodeName === "SPAN" && node.style) { 9907 const { 9908 fontWeight, 9909 fontStyle, 9910 textDecorationLine, 9911 textDecoration, 9912 verticalAlign 9913 } = node.style; 9914 const element = node; 9915 if (fontWeight === "bold" || fontWeight === "700") { 9916 (0, import_dom9.wrap)(doc.createElement("strong"), element); 9917 } 9918 if (fontStyle === "italic") { 9919 (0, import_dom9.wrap)(doc.createElement("em"), element); 9920 } 9921 if (textDecorationLine === "line-through" || textDecoration.includes("line-through")) { 9922 (0, import_dom9.wrap)(doc.createElement("s"), element); 9923 } 9924 if (verticalAlign === "super") { 9925 (0, import_dom9.wrap)(doc.createElement("sup"), element); 9926 } else if (verticalAlign === "sub") { 9927 (0, import_dom9.wrap)(doc.createElement("sub"), element); 9928 } 9929 } else if (node.nodeName === "B") { 9930 (0, import_dom9.replaceTag)(node, "strong"); 9931 } else if (node.nodeName === "I") { 9932 (0, import_dom9.replaceTag)(node, "em"); 9933 } else if (node.nodeName === "A") { 9934 const anchor = node; 9935 if (anchor.target && anchor.target.toLowerCase() === "_blank") { 9936 anchor.rel = "noopener"; 9937 } else { 9938 anchor.removeAttribute("target"); 9939 anchor.removeAttribute("rel"); 9940 } 9941 if (anchor.name && !anchor.id) { 9942 anchor.id = anchor.name; 9943 } 9944 if (anchor.id && !anchor.ownerDocument.querySelector(`[href="#$anchor.id}"]`)) { 9945 anchor.removeAttribute("id"); 9946 } 9947 } 9948 } 9949 9950 // packages/blocks/build-module/api/raw-handling/head-remover.mjs 9951 function headRemover(node) { 9952 if (node.nodeName !== "SCRIPT" && node.nodeName !== "NOSCRIPT" && node.nodeName !== "TEMPLATE" && node.nodeName !== "STYLE") { 9953 return; 9954 } 9955 node.parentNode.removeChild(node); 9956 } 9957 9958 // packages/blocks/build-module/api/raw-handling/ms-list-ignore.mjs 9959 function msListIgnore(node) { 9960 if (node.nodeType !== node.ELEMENT_NODE) { 9961 return; 9962 } 9963 const el = node; 9964 const style = el.getAttribute("style"); 9965 if (!style || !style.includes("mso-list")) { 9966 return; 9967 } 9968 const rules = style.split(";").reduce( 9969 (acc, rule) => { 9970 const [key, value] = rule.split(":"); 9971 if (key && value) { 9972 acc[key.trim().toLowerCase()] = value.trim().toLowerCase(); 9973 } 9974 return acc; 9975 }, 9976 {} 9977 ); 9978 if (rules["mso-list"] === "ignore") { 9979 el.remove(); 9980 } 9981 } 9982 9983 // packages/blocks/build-module/api/raw-handling/ms-list-converter.mjs 9984 function isList2(node) { 9985 return node.nodeName === "OL" || node.nodeName === "UL"; 9986 } 9987 function msListConverter(node, doc) { 9988 if (node.nodeName !== "P") { 9989 return; 9990 } 9991 const element = node; 9992 const style = element.getAttribute("style"); 9993 if (!style || !style.includes("mso-list")) { 9994 return; 9995 } 9996 const prevNode = element.previousElementSibling; 9997 if (!prevNode || !isList2(prevNode)) { 9998 const type = element.textContent.trim().slice(0, 1); 9999 const isNumeric = /[1iIaA]/.test(type); 10000 const newListNode = doc.createElement(isNumeric ? "ol" : "ul"); 10001 if (isNumeric) { 10002 newListNode.setAttribute("type", type); 10003 } 10004 element.parentNode.insertBefore(newListNode, element); 10005 } 10006 const listNode = element.previousElementSibling; 10007 const listType = listNode.nodeName; 10008 const listItem = doc.createElement("li"); 10009 let receivingNode = listNode; 10010 listItem.innerHTML = deepFilterHTML(element.innerHTML, [msListIgnore]); 10011 const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style); 10012 let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0; 10013 while (level--) { 10014 receivingNode = receivingNode.lastChild || receivingNode; 10015 if (isList2(receivingNode)) { 10016 receivingNode = receivingNode.lastChild || receivingNode; 10017 } 10018 } 10019 if (!isList2(receivingNode)) { 10020 receivingNode = receivingNode.appendChild( 10021 doc.createElement(listType) 10022 ); 10023 } 10024 receivingNode.appendChild(listItem); 10025 element.parentNode.removeChild(element); 10026 } 10027 10028 // packages/blocks/build-module/api/raw-handling/image-corrector.mjs 10029 var import_blob = __toESM(require_blob(), 1); 10030 function imageCorrector(img) { 10031 if (img.nodeName !== "IMG") { 10032 return; 10033 } 10034 const node = img; 10035 if (node.src.indexOf("file:") === 0) { 10036 node.src = ""; 10037 } 10038 if (node.src.indexOf("data:") === 0) { 10039 const [properties, data] = node.src.split(","); 10040 const [type] = properties.slice(5).split(";"); 10041 if (!data || !type) { 10042 node.src = ""; 10043 return; 10044 } 10045 let decoded; 10046 try { 10047 decoded = atob(data); 10048 } catch { 10049 node.src = ""; 10050 return; 10051 } 10052 const uint8Array = new Uint8Array(decoded.length); 10053 for (let i2 = 0; i2 < uint8Array.length; i2++) { 10054 uint8Array[i2] = decoded.charCodeAt(i2); 10055 } 10056 const name = type.replace("/", "."); 10057 const file = new window.File([uint8Array], name, { type }); 10058 node.src = (0, import_blob.createBlobURL)(file); 10059 } 10060 if (node.height === 1 || node.width === 1) { 10061 node.parentNode.removeChild(node); 10062 } 10063 } 10064 10065 // packages/blocks/build-module/api/raw-handling/div-normaliser.mjs 10066 function divNormaliser(div) { 10067 if (div.nodeName !== "DIV") { 10068 return; 10069 } 10070 const node = div; 10071 node.innerHTML = normaliseBlocks(node.innerHTML); 10072 } 10073 10074 // packages/blocks/build-module/api/raw-handling/markdown-converter.mjs 10075 var import_showdown = __toESM(require_showdown(), 1); 10076 var converter = new import_showdown.default.Converter({ 10077 noHeaderId: true, 10078 tables: true, 10079 literalMidWordUnderscores: true, 10080 omitExtraWLInCodeBlocks: true, 10081 simpleLineBreaks: true, 10082 strikethrough: true 10083 }); 10084 function slackMarkdownVariantCorrector(text2) { 10085 return text2.replace( 10086 /((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, 10087 (match, p1, p2, p3) => `$p1} 10088 $p2} 10089 $p3}` 10090 ); 10091 } 10092 function bulletsToAsterisks(text2) { 10093 return text2.replace(/(^|\n)•( +)/g, "$1*$2"); 10094 } 10095 function escapeSingleLineOrderedListMarker(text2) { 10096 if (text2.includes("\n")) { 10097 return text2; 10098 } 10099 return text2.replace(/^(\d+)\.(\s)/, "$1\\.$2"); 10100 } 10101 var correctors = [ 10102 escapeSingleLineOrderedListMarker, 10103 bulletsToAsterisks, 10104 slackMarkdownVariantCorrector 10105 ]; 10106 function markdownConverter(text2) { 10107 return converter.makeHtml( 10108 correctors.reduce( 10109 (current, corrector) => corrector(current), 10110 text2 10111 ) 10112 ); 10113 } 10114 10115 // packages/blocks/build-module/api/raw-handling/iframe-remover.mjs 10116 function iframeRemover(iframe) { 10117 if (iframe.nodeName === "IFRAME") { 10118 const node = iframe; 10119 const text2 = node.ownerDocument.createTextNode(node.src); 10120 node.parentNode.replaceChild(text2, node); 10121 } 10122 } 10123 10124 // packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.mjs 10125 var import_dom10 = __toESM(require_dom(), 1); 10126 function googleDocsUIdRemover(node) { 10127 const el = node; 10128 if (!el.id || el.id.indexOf("docs-internal-guid-") !== 0) { 10129 return; 10130 } 10131 if (el.tagName === "B") { 10132 (0, import_dom10.unwrap)(node); 10133 } else { 10134 el.removeAttribute("id"); 10135 } 10136 } 10137 10138 // packages/blocks/build-module/api/raw-handling/html-formatting-remover.mjs 10139 function isFormattingSpace(character) { 10140 return character === " " || character === "\r" || character === "\n" || character === " "; 10141 } 10142 function htmlFormattingRemover(node) { 10143 if (node.nodeType !== node.TEXT_NODE) { 10144 return; 10145 } 10146 let parent = node; 10147 while (parent = parent.parentNode) { 10148 if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === "PRE") { 10149 return; 10150 } 10151 } 10152 const textNode = node; 10153 let newData = textNode.data.replace(/[ \r\n\t]+/g, " "); 10154 if (newData[0] === " ") { 10155 const previousSibling = getSibling(node, "previous"); 10156 if (!previousSibling || previousSibling.nodeName === "BR" || previousSibling.textContent.slice(-1) === " ") { 10157 newData = newData.slice(1); 10158 } 10159 } 10160 if (newData[newData.length - 1] === " ") { 10161 const nextSibling = getSibling(node, "next"); 10162 if (!nextSibling || nextSibling.nodeName === "BR" || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) { 10163 newData = newData.slice(0, -1); 10164 } 10165 } 10166 if (!newData) { 10167 node.parentNode.removeChild(node); 10168 } else { 10169 textNode.data = newData; 10170 } 10171 } 10172 10173 // packages/blocks/build-module/api/raw-handling/br-remover.mjs 10174 function brRemover(node) { 10175 if (node.nodeName !== "BR") { 10176 return; 10177 } 10178 if (getSibling(node, "next")) { 10179 return; 10180 } 10181 node.parentNode.removeChild(node); 10182 } 10183 10184 // packages/blocks/build-module/api/raw-handling/empty-paragraph-remover.mjs 10185 function emptyParagraphRemover(node) { 10186 if (node.nodeName !== "P") { 10187 return; 10188 } 10189 if (node.hasChildNodes()) { 10190 return; 10191 } 10192 node.parentNode.removeChild(node); 10193 } 10194 10195 // packages/blocks/build-module/api/raw-handling/slack-paragraph-corrector.mjs 10196 function slackParagraphCorrector(node) { 10197 if (node.nodeName !== "SPAN") { 10198 return; 10199 } 10200 if (node.getAttribute("data-stringify-type") !== "paragraph-break") { 10201 return; 10202 } 10203 const parentNode = node.parentNode; 10204 parentNode.insertBefore(node.ownerDocument.createElement("br"), node); 10205 parentNode.insertBefore(node.ownerDocument.createElement("br"), node); 10206 parentNode.removeChild(node); 10207 } 10208 10209 // packages/blocks/build-module/api/raw-handling/latex-to-math.mjs 10210 function isLatexMathMode(text2) { 10211 const lettersRegex = /[\p{L}\s]+/gu; 10212 let match; 10213 while (match = lettersRegex.exec(text2)) { 10214 if (text2[match.index - 1] === "{") { 10215 continue; 10216 } 10217 let sequence = match[0]; 10218 if (text2[match.index - 1] === "\\") { 10219 sequence = sequence.replace(/^[a-zA-Z]+/, ""); 10220 } 10221 if (sequence.length < 6) { 10222 continue; 10223 } 10224 return false; 10225 } 10226 if (/\\[a-zA-Z]+\s*\{/g.test(text2)) { 10227 return true; 10228 } 10229 const softClues = [ 10230 (t3) => t3.includes("^") && !t3.startsWith("^"), 10231 (t3) => ["=", "+", "-", "/", "*"].some( 10232 (operator) => t3.includes(operator) 10233 ), 10234 (t3) => /\\[a-zA-Z]+/g.test(t3) 10235 ]; 10236 if (softClues.filter((clue) => clue(text2)).length >= 2) { 10237 return true; 10238 } 10239 return false; 10240 } 10241 10242 // packages/blocks/build-module/api/raw-handling/heading-transformer.mjs 10243 function headingTransformer(node) { 10244 if (node.nodeType !== node.ELEMENT_NODE) { 10245 return; 10246 } 10247 const element = node; 10248 if (element.tagName === "P" && element.getAttribute("role") === "heading" && element.hasAttribute("aria-level")) { 10249 const level = parseInt(element.getAttribute("aria-level"), 10); 10250 if (level >= 1 && level <= 6) { 10251 const headingTag = `H$level}`; 10252 const newHeading = element.ownerDocument.createElement(headingTag); 10253 Array.from(element.attributes).forEach((attr2) => { 10254 if (attr2.name !== "role" && attr2.name !== "aria-level") { 10255 newHeading.setAttribute(attr2.name, attr2.value); 10256 } 10257 }); 10258 while (element.firstChild) { 10259 newHeading.appendChild(element.firstChild); 10260 } 10261 element.parentNode.replaceChild(newHeading, element); 10262 } 10263 } 10264 } 10265 10266 // packages/blocks/build-module/api/raw-handling/paste-handler.mjs 10267 var log = (...args) => window?.console?.log?.(...args); 10268 function filterInlineHTML(HTML) { 10269 HTML = deepFilterHTML(HTML, [ 10270 headRemover, 10271 googleDocsUIdRemover, 10272 msListIgnore, 10273 phrasingContentReducer, 10274 commentRemover 10275 ]); 10276 HTML = (0, import_dom11.removeInvalidHTML)( 10277 HTML, 10278 (0, import_dom11.getPhrasingContentSchema)("paste"), 10279 true 10280 ); 10281 HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); 10282 log("Processed inline HTML:\n\n", HTML); 10283 return HTML; 10284 } 10285 function pasteHandler({ 10286 HTML = "", 10287 plainText = "", 10288 mode = "AUTO", 10289 tagName 10290 }) { 10291 log("Received HTML (pasteHandler):\n\n", HTML); 10292 log("Received plain text (pasteHandler):\n\n", plainText); 10293 HTML = HTML.replace(/<meta[^>]+>/g, ""); 10294 HTML = HTML.replace( 10295 /^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, 10296 "" 10297 ); 10298 HTML = HTML.replace( 10299 /(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, 10300 "" 10301 ); 10302 if (mode !== "INLINE") { 10303 const content = HTML ? HTML : plainText; 10304 if (content.indexOf("<!-- wp:") !== -1) { 10305 const parseResult = parse2(content); 10306 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform"; 10307 if (!isSingleFreeFormBlock) { 10308 return parseResult; 10309 } 10310 } 10311 } 10312 HTML = HTML.normalize(); 10313 HTML = deepFilterHTML(HTML, [slackParagraphCorrector]); 10314 const isPlainText = plainText && (!HTML || isPlain(HTML)); 10315 if (isPlainText && isLatexMathMode(plainText)) { 10316 return [createBlock("core/math", { latex: plainText })]; 10317 } 10318 if (isPlainText) { 10319 HTML = plainText; 10320 if (!/^\s+$/.test(plainText)) { 10321 HTML = markdownConverter(HTML); 10322 } 10323 } 10324 const pieces = shortcode_converter_default(HTML); 10325 const hasShortcodes = pieces.length > 1; 10326 if (isPlainText && !hasShortcodes) { 10327 if (mode === "AUTO" && plainText.indexOf("\n") === -1 && plainText.indexOf("<p>") !== 0 && HTML.indexOf("<p>") === 0) { 10328 mode = "INLINE"; 10329 } 10330 } 10331 if (mode === "INLINE") { 10332 return filterInlineHTML(HTML); 10333 } 10334 if (mode === "AUTO" && !hasShortcodes && isInlineContent(HTML, tagName)) { 10335 return filterInlineHTML(HTML); 10336 } 10337 const phrasingContentSchema = (0, import_dom11.getPhrasingContentSchema)("paste"); 10338 const blockContentSchema = getBlockContentSchema("paste"); 10339 const blocks = pieces.map((piece) => { 10340 if (typeof piece !== "string") { 10341 return piece; 10342 } 10343 const filters = [ 10344 googleDocsUIdRemover, 10345 msListConverter, 10346 headRemover, 10347 listReducer, 10348 imageCorrector, 10349 phrasingContentReducer, 10350 specialCommentConverter, 10351 commentRemover, 10352 iframeRemover, 10353 figureContentReducer, 10354 blockquoteNormaliser(), 10355 divNormaliser, 10356 headingTransformer 10357 ]; 10358 const schema = { 10359 ...blockContentSchema, 10360 // Keep top-level phrasing content, normalised by `normaliseBlocks`. 10361 ...phrasingContentSchema 10362 }; 10363 piece = deepFilterHTML(piece, filters, blockContentSchema); 10364 piece = (0, import_dom11.removeInvalidHTML)(piece, schema, false); 10365 piece = normaliseBlocks(piece); 10366 piece = deepFilterHTML( 10367 piece, 10368 [htmlFormattingRemover, brRemover, emptyParagraphRemover], 10369 blockContentSchema 10370 ); 10371 log("Processed HTML piece:\n\n", piece); 10372 return htmlToBlocks(piece, pasteHandler); 10373 }).flat().filter(Boolean); 10374 if (mode === "AUTO" && blocks.length === 1 && hasBlockSupport(blocks[0].name, "__unstablePasteTextInline", false)) { 10375 const trimRegex = /^[\n]+|[\n]+$/g; 10376 const trimmedPlainText = plainText.replace(trimRegex, ""); 10377 if (trimmedPlainText !== "" && trimmedPlainText.indexOf("\n") === -1) { 10378 return (0, import_dom11.removeInvalidHTML)( 10379 getBlockInnerHTML(blocks[0]), 10380 phrasingContentSchema, 10381 false 10382 ).replace(trimRegex, ""); 10383 } 10384 } 10385 return blocks; 10386 } 10387 10388 // packages/blocks/build-module/api/raw-handling/index.mjs 10389 function deprecatedGetPhrasingContentSchema(context) { 10390 (0, import_deprecated10.default)("wp.blocks.getPhrasingContentSchema", { 10391 since: "5.6", 10392 alternative: "wp.dom.getPhrasingContentSchema" 10393 }); 10394 return (0, import_dom12.getPhrasingContentSchema)(context); 10395 } 10396 function rawHandler({ HTML = "" }) { 10397 if (HTML.indexOf("<!-- wp:") !== -1) { 10398 const parseResult = parse2(HTML); 10399 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform"; 10400 if (!isSingleFreeFormBlock) { 10401 return parseResult; 10402 } 10403 } 10404 const pieces = shortcode_converter_default(HTML); 10405 const blockContentSchema = getBlockContentSchema(); 10406 return pieces.map((piece) => { 10407 if (typeof piece !== "string") { 10408 return piece; 10409 } 10410 const filters = [ 10411 // Needed to adjust invalid lists. 10412 listReducer, 10413 // Needed to create more and nextpage blocks. 10414 specialCommentConverter, 10415 // Needed to create media blocks. 10416 figureContentReducer, 10417 // Needed to create the quote block, which cannot handle text 10418 // without wrapper paragraphs. 10419 blockquoteNormaliser({ raw: true }) 10420 ]; 10421 piece = deepFilterHTML(piece, filters, blockContentSchema); 10422 piece = normaliseBlocks(piece, { raw: true }); 10423 return htmlToBlocks(piece, rawHandler); 10424 }).flat().filter(Boolean); 10425 } 10426 10427 // packages/blocks/build-module/api/categories.mjs 10428 var import_data6 = __toESM(require_data(), 1); 10429 function getCategories2() { 10430 return (0, import_data6.select)(store).getCategories(); 10431 } 10432 function setCategories2(categories2) { 10433 (0, import_data6.dispatch)(store).setCategories(categories2); 10434 } 10435 function updateCategory2(slug, category) { 10436 (0, import_data6.dispatch)(store).updateCategory(slug, category); 10437 } 10438 10439 // packages/blocks/build-module/api/templates.mjs 10440 var import_element4 = __toESM(require_element(), 1); 10441 function doBlocksMatchTemplate(blocks = [], template = []) { 10442 return blocks.length === template.length && template.every(([name, , innerBlocksTemplate], index) => { 10443 const block = blocks[index]; 10444 return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate); 10445 }); 10446 } 10447 var isHTMLAttribute = (attributeDefinition) => attributeDefinition?.source === "html"; 10448 var isQueryAttribute = (attributeDefinition) => attributeDefinition?.source === "query"; 10449 function normalizeAttributes(schema, values) { 10450 if (!values) { 10451 return {}; 10452 } 10453 return Object.fromEntries( 10454 Object.entries(values).map(([key, value]) => [ 10455 key, 10456 normalizeAttribute(schema[key], value) 10457 ]) 10458 ); 10459 } 10460 function normalizeAttribute(definition, value) { 10461 if (isHTMLAttribute(definition) && Array.isArray(value)) { 10462 return (0, import_element4.renderToString)(value); 10463 } 10464 if (isQueryAttribute(definition) && value) { 10465 return value.map( 10466 (subValues) => { 10467 return normalizeAttributes(definition.query, subValues); 10468 } 10469 ); 10470 } 10471 return value; 10472 } 10473 function synchronizeBlocksWithTemplate(blocks = [], template) { 10474 if (!template) { 10475 return blocks; 10476 } 10477 return template.map( 10478 ([name, attributes, innerBlocksTemplate], index) => { 10479 const block = blocks[index]; 10480 if (block && block.name === name) { 10481 const innerBlocks = synchronizeBlocksWithTemplate( 10482 block.innerBlocks, 10483 innerBlocksTemplate 10484 ); 10485 return { ...block, innerBlocks }; 10486 } 10487 const blockType = getBlockType(name); 10488 const normalizedAttributes = normalizeAttributes( 10489 blockType?.attributes ?? {}, 10490 attributes 10491 ); 10492 const [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes( 10493 name, 10494 normalizedAttributes 10495 ); 10496 return createBlock( 10497 blockName, 10498 blockAttributes, 10499 synchronizeBlocksWithTemplate([], innerBlocksTemplate) 10500 ); 10501 } 10502 ); 10503 } 10504 10505 // packages/blocks/build-module/api/index.mjs 10506 var fieldsKey = /* @__PURE__ */ Symbol("fields"); 10507 var formKey = /* @__PURE__ */ Symbol("form"); 10508 var privateApis = {}; 10509 lock(privateApis, { 10510 isContentBlock, 10511 fieldsKey, 10512 formKey, 10513 parseRawBlock 10514 }); 10515 10516 // packages/blocks/build-module/deprecated.mjs 10517 var import_deprecated11 = __toESM(require_deprecated(), 1); 10518 function withBlockContentContext(OriginalComponent) { 10519 (0, import_deprecated11.default)("wp.blocks.withBlockContentContext", { 10520 since: "6.1" 10521 }); 10522 return OriginalComponent; 10523 } 10524 return __toCommonJS(index_exports); 10525 })(); 10526 /*! Bundled license information: 10527 10528 react-is/cjs/react-is.development.js: 10529 (** 10530 * @license React 10531 * react-is.development.js 10532 * 10533 * Copyright (c) Facebook, Inc. and its affiliates. 10534 * 10535 * This source code is licensed under the MIT license found in the 10536 * LICENSE file in the root directory of this source tree. 10537 *) 10538 10539 showdown/dist/showdown.js: 10540 (*! showdown v 1.9.1 - 02-11-2019 *) 10541 10542 is-plain-object/dist/is-plain-object.mjs: 10543 (*! 10544 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 10545 * 10546 * Copyright (c) 2014-2017, Jon Schlinkert. 10547 * Released under the MIT License. 10548 *) 10549 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Jun 30 08:20:12 2026 | Cross-referenced by PHPXref |