| @@ -1,5 +1,4 @@ | ||
| 1 | -"use strict"; | |
| 2 | 1 | var wp; |
| 3 | 2 | (wp ||= {}).blocks = (() => { |
| 4 | 3 | var __create = Object.create; |
| 5 | 4 | var __defProp = Object.defineProperty; |
| @@ -569,64 +568,8 @@ | ||
| 569 | 568 | module.exports.remove = removeAccents2; |
| 570 | 569 | } |
| 571 | 570 | }); |
| 572 | 571 | |
| 573 | - // node_modules/fast-deep-equal/es6/index.js | |
| 574 | - var require_es6 = __commonJS({ | |
| 575 | - "node_modules/fast-deep-equal/es6/index.js"(exports, module) { | |
| 576 | - "use strict"; | |
| 577 | - module.exports = function equal(a2, b3) { | |
| 578 | - if (a2 === b3) return true; | |
| 579 | - if (a2 && b3 && typeof a2 == "object" && typeof b3 == "object") { | |
| 580 | - if (a2.constructor !== b3.constructor) return false; | |
| 581 | - var length, i2, keys; | |
| 582 | - if (Array.isArray(a2)) { | |
| 583 | - length = a2.length; | |
| 584 | - if (length != b3.length) return false; | |
| 585 | - for (i2 = length; i2-- !== 0; ) | |
| 586 | - if (!equal(a2[i2], b3[i2])) return false; | |
| 587 | - return true; | |
| 588 | - } | |
| 589 | - if (a2 instanceof Map && b3 instanceof Map) { | |
| 590 | - if (a2.size !== b3.size) return false; | |
| 591 | - for (i2 of a2.entries()) | |
| 592 | - if (!b3.has(i2[0])) return false; | |
| 593 | - for (i2 of a2.entries()) | |
| 594 | - if (!equal(i2[1], b3.get(i2[0]))) return false; | |
| 595 | - return true; | |
| 596 | - } | |
| 597 | - if (a2 instanceof Set && b3 instanceof Set) { | |
| 598 | - if (a2.size !== b3.size) return false; | |
| 599 | - for (i2 of a2.entries()) | |
| 600 | - if (!b3.has(i2[0])) return false; | |
| 601 | - return true; | |
| 602 | - } | |
| 603 | - if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b3)) { | |
| 604 | - length = a2.length; | |
| 605 | - if (length != b3.length) return false; | |
| 606 | - for (i2 = length; i2-- !== 0; ) | |
| 607 | - if (a2[i2] !== b3[i2]) return false; | |
| 608 | - return true; | |
| 609 | - } | |
| 610 | - if (a2.constructor === RegExp) return a2.source === b3.source && a2.flags === b3.flags; | |
| 611 | - if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b3.valueOf(); | |
| 612 | - if (a2.toString !== Object.prototype.toString) return a2.toString() === b3.toString(); | |
| 613 | - keys = Object.keys(a2); | |
| 614 | - length = keys.length; | |
| 615 | - if (length !== Object.keys(b3).length) return false; | |
| 616 | - for (i2 = length; i2-- !== 0; ) | |
| 617 | - if (!Object.prototype.hasOwnProperty.call(b3, keys[i2])) return false; | |
| 618 | - for (i2 = length; i2-- !== 0; ) { | |
| 619 | - var key = keys[i2]; | |
| 620 | - if (!equal(a2[key], b3[key])) return false; | |
| 621 | - } | |
| 622 | - return true; | |
| 623 | - } | |
| 624 | - return a2 !== a2 && b3 !== b3; | |
| 625 | - }; | |
| 626 | - } | |
| 627 | - }); | |
| 628 | - | |
| 629 | 572 | // packages/blocks/node_modules/react-is/cjs/react-is.development.js |
| 630 | 573 | var require_react_is_development = __commonJS({ |
| 631 | 574 | "packages/blocks/node_modules/react-is/cjs/react-is.development.js"(exports) { |
| 632 | 575 | "use strict"; |
| @@ -854,8 +797,64 @@ | ||
| 854 | 797 | module.exports = window.ReactJSXRuntime; |
| 855 | 798 | } |
| 856 | 799 | }); |
| 857 | 800 | |
| 801 | + // node_modules/fast-deep-equal/es6/index.js | |
| 802 | + var require_es6 = __commonJS({ | |
| 803 | + "node_modules/fast-deep-equal/es6/index.js"(exports, module) { | |
| 804 | + "use strict"; | |
| 805 | + module.exports = function equal(a2, b2) { | |
| 806 | + if (a2 === b2) return true; | |
| 807 | + if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { | |
| 808 | + if (a2.constructor !== b2.constructor) return false; | |
| 809 | + var length, i2, keys; | |
| 810 | + if (Array.isArray(a2)) { | |
| 811 | + length = a2.length; | |
| 812 | + if (length != b2.length) return false; | |
| 813 | + for (i2 = length; i2-- !== 0; ) | |
| 814 | + if (!equal(a2[i2], b2[i2])) return false; | |
| 815 | + return true; | |
| 816 | + } | |
| 817 | + if (a2 instanceof Map && b2 instanceof Map) { | |
| 818 | + if (a2.size !== b2.size) return false; | |
| 819 | + for (i2 of a2.entries()) | |
| 820 | + if (!b2.has(i2[0])) return false; | |
| 821 | + for (i2 of a2.entries()) | |
| 822 | + if (!equal(i2[1], b2.get(i2[0]))) return false; | |
| 823 | + return true; | |
| 824 | + } | |
| 825 | + if (a2 instanceof Set && b2 instanceof Set) { | |
| 826 | + if (a2.size !== b2.size) return false; | |
| 827 | + for (i2 of a2.entries()) | |
| 828 | + if (!b2.has(i2[0])) return false; | |
| 829 | + return true; | |
| 830 | + } | |
| 831 | + if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { | |
| 832 | + length = a2.length; | |
| 833 | + if (length != b2.length) return false; | |
| 834 | + for (i2 = length; i2-- !== 0; ) | |
| 835 | + if (a2[i2] !== b2[i2]) return false; | |
| 836 | + return true; | |
| 837 | + } | |
| 838 | + if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; | |
| 839 | + if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf(); | |
| 840 | + if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString(); | |
| 841 | + keys = Object.keys(a2); | |
| 842 | + length = keys.length; | |
| 843 | + if (length !== Object.keys(b2).length) return false; | |
| 844 | + for (i2 = length; i2-- !== 0; ) | |
| 845 | + if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false; | |
| 846 | + for (i2 = length; i2-- !== 0; ) { | |
| 847 | + var key = keys[i2]; | |
| 848 | + if (!equal(a2[key], b2[key])) return false; | |
| 849 | + } | |
| 850 | + return true; | |
| 851 | + } | |
| 852 | + return a2 !== a2 && b2 !== b2; | |
| 853 | + }; | |
| 854 | + } | |
| 855 | + }); | |
| 856 | + | |
| 858 | 857 | // package-external:@wordpress/html-entities |
| 859 | 858 | var require_html_entities = __commonJS({ |
| 860 | 859 | "package-external:@wordpress/html-entities"(exports, module) { |
| 861 | 860 | module.exports = window.wp.htmlEntities; |
| @@ -875,8 +874,3632 @@ | ||
| 875 | 874 | module.exports = window.wp.blob; |
| 876 | 875 | } |
| 877 | 876 | }); |
| 878 | 877 | |
| 878 | + // node_modules/showdown/dist/showdown.js | |
| 879 | + var require_showdown = __commonJS({ | |
| 880 | + "node_modules/showdown/dist/showdown.js"(exports, module) { | |
| 881 | + (function() { | |
| 882 | + function getDefaultOpts(simple) { | |
| 883 | + "use strict"; | |
| 884 | + var defaultOptions = { | |
| 885 | + omitExtraWLInCodeBlocks: { | |
| 886 | + defaultValue: false, | |
| 887 | + describe: "Omit the default extra whiteline added to code blocks", | |
| 888 | + type: "boolean" | |
| 889 | + }, | |
| 890 | + noHeaderId: { | |
| 891 | + defaultValue: false, | |
| 892 | + describe: "Turn on/off generated header id", | |
| 893 | + type: "boolean" | |
| 894 | + }, | |
| 895 | + prefixHeaderId: { | |
| 896 | + defaultValue: false, | |
| 897 | + 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", | |
| 898 | + type: "string" | |
| 899 | + }, | |
| 900 | + rawPrefixHeaderId: { | |
| 901 | + defaultValue: false, | |
| 902 | + 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)', | |
| 903 | + type: "boolean" | |
| 904 | + }, | |
| 905 | + ghCompatibleHeaderId: { | |
| 906 | + defaultValue: false, | |
| 907 | + describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", | |
| 908 | + type: "boolean" | |
| 909 | + }, | |
| 910 | + rawHeaderId: { | |
| 911 | + defaultValue: false, | |
| 912 | + describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`, | |
| 913 | + type: "boolean" | |
| 914 | + }, | |
| 915 | + headerLevelStart: { | |
| 916 | + defaultValue: false, | |
| 917 | + describe: "The header blocks level start", | |
| 918 | + type: "integer" | |
| 919 | + }, | |
| 920 | + parseImgDimensions: { | |
| 921 | + defaultValue: false, | |
| 922 | + describe: "Turn on/off image dimension parsing", | |
| 923 | + type: "boolean" | |
| 924 | + }, | |
| 925 | + simplifiedAutoLink: { | |
| 926 | + defaultValue: false, | |
| 927 | + describe: "Turn on/off GFM autolink style", | |
| 928 | + type: "boolean" | |
| 929 | + }, | |
| 930 | + excludeTrailingPunctuationFromURLs: { | |
| 931 | + defaultValue: false, | |
| 932 | + describe: "Excludes trailing punctuation from links generated with autoLinking", | |
| 933 | + type: "boolean" | |
| 934 | + }, | |
| 935 | + literalMidWordUnderscores: { | |
| 936 | + defaultValue: false, | |
| 937 | + describe: "Parse midword underscores as literal underscores", | |
| 938 | + type: "boolean" | |
| 939 | + }, | |
| 940 | + literalMidWordAsterisks: { | |
| 941 | + defaultValue: false, | |
| 942 | + describe: "Parse midword asterisks as literal asterisks", | |
| 943 | + type: "boolean" | |
| 944 | + }, | |
| 945 | + strikethrough: { | |
| 946 | + defaultValue: false, | |
| 947 | + describe: "Turn on/off strikethrough support", | |
| 948 | + type: "boolean" | |
| 949 | + }, | |
| 950 | + tables: { | |
| 951 | + defaultValue: false, | |
| 952 | + describe: "Turn on/off tables support", | |
| 953 | + type: "boolean" | |
| 954 | + }, | |
| 955 | + tablesHeaderId: { | |
| 956 | + defaultValue: false, | |
| 957 | + describe: "Add an id to table headers", | |
| 958 | + type: "boolean" | |
| 959 | + }, | |
| 960 | + ghCodeBlocks: { | |
| 961 | + defaultValue: true, | |
| 962 | + describe: "Turn on/off GFM fenced code blocks support", | |
| 963 | + type: "boolean" | |
| 964 | + }, | |
| 965 | + tasklists: { | |
| 966 | + defaultValue: false, | |
| 967 | + describe: "Turn on/off GFM tasklist support", | |
| 968 | + type: "boolean" | |
| 969 | + }, | |
| 970 | + smoothLivePreview: { | |
| 971 | + defaultValue: false, | |
| 972 | + describe: "Prevents weird effects in live previews due to incomplete input", | |
| 973 | + type: "boolean" | |
| 974 | + }, | |
| 975 | + smartIndentationFix: { | |
| 976 | + defaultValue: false, | |
| 977 | + description: "Tries to smartly fix indentation in es6 strings", | |
| 978 | + type: "boolean" | |
| 979 | + }, | |
| 980 | + disableForced4SpacesIndentedSublists: { | |
| 981 | + defaultValue: false, | |
| 982 | + description: "Disables the requirement of indenting nested sublists by 4 spaces", | |
| 983 | + type: "boolean" | |
| 984 | + }, | |
| 985 | + simpleLineBreaks: { | |
| 986 | + defaultValue: false, | |
| 987 | + description: "Parses simple line breaks as <br> (GFM Style)", | |
| 988 | + type: "boolean" | |
| 989 | + }, | |
| 990 | + requireSpaceBeforeHeadingText: { | |
| 991 | + defaultValue: false, | |
| 992 | + description: "Makes adding a space between `#` and the header text mandatory (GFM Style)", | |
| 993 | + type: "boolean" | |
| 994 | + }, | |
| 995 | + ghMentions: { | |
| 996 | + defaultValue: false, | |
| 997 | + description: "Enables github @mentions", | |
| 998 | + type: "boolean" | |
| 999 | + }, | |
| 1000 | + ghMentionsLink: { | |
| 1001 | + defaultValue: "https://github.com/{u}", | |
| 1002 | + description: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", | |
| 1003 | + type: "string" | |
| 1004 | + }, | |
| 1005 | + encodeEmails: { | |
| 1006 | + defaultValue: true, | |
| 1007 | + description: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", | |
| 1008 | + type: "boolean" | |
| 1009 | + }, | |
| 1010 | + openLinksInNewWindow: { | |
| 1011 | + defaultValue: false, | |
| 1012 | + description: "Open all links in new windows", | |
| 1013 | + type: "boolean" | |
| 1014 | + }, | |
| 1015 | + backslashEscapesHTMLTags: { | |
| 1016 | + defaultValue: false, | |
| 1017 | + description: "Support for HTML Tag escaping. ex: <div>foo</div>", | |
| 1018 | + type: "boolean" | |
| 1019 | + }, | |
| 1020 | + emoji: { | |
| 1021 | + defaultValue: false, | |
| 1022 | + description: "Enable emoji support. Ex: `this is a :smile: emoji`", | |
| 1023 | + type: "boolean" | |
| 1024 | + }, | |
| 1025 | + underline: { | |
| 1026 | + defaultValue: false, | |
| 1027 | + 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>`", | |
| 1028 | + type: "boolean" | |
| 1029 | + }, | |
| 1030 | + completeHTMLDocument: { | |
| 1031 | + defaultValue: false, | |
| 1032 | + description: "Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags", | |
| 1033 | + type: "boolean" | |
| 1034 | + }, | |
| 1035 | + metadata: { | |
| 1036 | + defaultValue: false, | |
| 1037 | + description: "Enable support for document metadata (defined at the top of the document between `\xAB\xAB\xAB` and `\xBB\xBB\xBB` or between `---` and `---`).", | |
| 1038 | + type: "boolean" | |
| 1039 | + }, | |
| 1040 | + splitAdjacentBlockquotes: { | |
| 1041 | + defaultValue: false, | |
| 1042 | + description: "Split adjacent blockquote blocks", | |
| 1043 | + type: "boolean" | |
| 1044 | + } | |
| 1045 | + }; | |
| 1046 | + if (simple === false) { | |
| 1047 | + return JSON.parse(JSON.stringify(defaultOptions)); | |
| 1048 | + } | |
| 1049 | + var ret = {}; | |
| 1050 | + for (var opt in defaultOptions) { | |
| 1051 | + if (defaultOptions.hasOwnProperty(opt)) { | |
| 1052 | + ret[opt] = defaultOptions[opt].defaultValue; | |
| 1053 | + } | |
| 1054 | + } | |
| 1055 | + return ret; | |
| 1056 | + } | |
| 1057 | + function allOptionsOn() { | |
| 1058 | + "use strict"; | |
| 1059 | + var options = getDefaultOpts(true), ret = {}; | |
| 1060 | + for (var opt in options) { | |
| 1061 | + if (options.hasOwnProperty(opt)) { | |
| 1062 | + ret[opt] = true; | |
| 1063 | + } | |
| 1064 | + } | |
| 1065 | + return ret; | |
| 1066 | + } | |
| 1067 | + var showdown2 = {}, parsers = {}, extensions = {}, globalOptions = getDefaultOpts(true), setFlavor = "vanilla", flavor = { | |
| 1068 | + github: { | |
| 1069 | + omitExtraWLInCodeBlocks: true, | |
| 1070 | + simplifiedAutoLink: true, | |
| 1071 | + excludeTrailingPunctuationFromURLs: true, | |
| 1072 | + literalMidWordUnderscores: true, | |
| 1073 | + strikethrough: true, | |
| 1074 | + tables: true, | |
| 1075 | + tablesHeaderId: true, | |
| 1076 | + ghCodeBlocks: true, | |
| 1077 | + tasklists: true, | |
| 1078 | + disableForced4SpacesIndentedSublists: true, | |
| 1079 | + simpleLineBreaks: true, | |
| 1080 | + requireSpaceBeforeHeadingText: true, | |
| 1081 | + ghCompatibleHeaderId: true, | |
| 1082 | + ghMentions: true, | |
| 1083 | + backslashEscapesHTMLTags: true, | |
| 1084 | + emoji: true, | |
| 1085 | + splitAdjacentBlockquotes: true | |
| 1086 | + }, | |
| 1087 | + original: { | |
| 1088 | + noHeaderId: true, | |
| 1089 | + ghCodeBlocks: false | |
| 1090 | + }, | |
| 1091 | + ghost: { | |
| 1092 | + omitExtraWLInCodeBlocks: true, | |
| 1093 | + parseImgDimensions: true, | |
| 1094 | + simplifiedAutoLink: true, | |
| 1095 | + excludeTrailingPunctuationFromURLs: true, | |
| 1096 | + literalMidWordUnderscores: true, | |
| 1097 | + strikethrough: true, | |
| 1098 | + tables: true, | |
| 1099 | + tablesHeaderId: true, | |
| 1100 | + ghCodeBlocks: true, | |
| 1101 | + tasklists: true, | |
| 1102 | + smoothLivePreview: true, | |
| 1103 | + simpleLineBreaks: true, | |
| 1104 | + requireSpaceBeforeHeadingText: true, | |
| 1105 | + ghMentions: false, | |
| 1106 | + encodeEmails: true | |
| 1107 | + }, | |
| 1108 | + vanilla: getDefaultOpts(true), | |
| 1109 | + allOn: allOptionsOn() | |
| 1110 | + }; | |
| 1111 | + showdown2.helper = {}; | |
| 1112 | + showdown2.extensions = {}; | |
| 1113 | + showdown2.setOption = function(key, value) { | |
| 1114 | + "use strict"; | |
| 1115 | + globalOptions[key] = value; | |
| 1116 | + return this; | |
| 1117 | + }; | |
| 1118 | + showdown2.getOption = function(key) { | |
| 1119 | + "use strict"; | |
| 1120 | + return globalOptions[key]; | |
| 1121 | + }; | |
| 1122 | + showdown2.getOptions = function() { | |
| 1123 | + "use strict"; | |
| 1124 | + return globalOptions; | |
| 1125 | + }; | |
| 1126 | + showdown2.resetOptions = function() { | |
| 1127 | + "use strict"; | |
| 1128 | + globalOptions = getDefaultOpts(true); | |
| 1129 | + }; | |
| 1130 | + showdown2.setFlavor = function(name) { | |
| 1131 | + "use strict"; | |
| 1132 | + if (!flavor.hasOwnProperty(name)) { | |
| 1133 | + throw Error(name + " flavor was not found"); | |
| 1134 | + } | |
| 1135 | + showdown2.resetOptions(); | |
| 1136 | + var preset = flavor[name]; | |
| 1137 | + setFlavor = name; | |
| 1138 | + for (var option in preset) { | |
| 1139 | + if (preset.hasOwnProperty(option)) { | |
| 1140 | + globalOptions[option] = preset[option]; | |
| 1141 | + } | |
| 1142 | + } | |
| 1143 | + }; | |
| 1144 | + showdown2.getFlavor = function() { | |
| 1145 | + "use strict"; | |
| 1146 | + return setFlavor; | |
| 1147 | + }; | |
| 1148 | + showdown2.getFlavorOptions = function(name) { | |
| 1149 | + "use strict"; | |
| 1150 | + if (flavor.hasOwnProperty(name)) { | |
| 1151 | + return flavor[name]; | |
| 1152 | + } | |
| 1153 | + }; | |
| 1154 | + showdown2.getDefaultOptions = function(simple) { | |
| 1155 | + "use strict"; | |
| 1156 | + return getDefaultOpts(simple); | |
| 1157 | + }; | |
| 1158 | + showdown2.subParser = function(name, func) { | |
| 1159 | + "use strict"; | |
| 1160 | + if (showdown2.helper.isString(name)) { | |
| 1161 | + if (typeof func !== "undefined") { | |
| 1162 | + parsers[name] = func; | |
| 1163 | + } else { | |
| 1164 | + if (parsers.hasOwnProperty(name)) { | |
| 1165 | + return parsers[name]; | |
| 1166 | + } else { | |
| 1167 | + throw Error("SubParser named " + name + " not registered!"); | |
| 1168 | + } | |
| 1169 | + } | |
| 1170 | + } | |
| 1171 | + }; | |
| 1172 | + showdown2.extension = function(name, ext) { | |
| 1173 | + "use strict"; | |
| 1174 | + if (!showdown2.helper.isString(name)) { | |
| 1175 | + throw Error("Extension 'name' must be a string"); | |
| 1176 | + } | |
| 1177 | + name = showdown2.helper.stdExtName(name); | |
| 1178 | + if (showdown2.helper.isUndefined(ext)) { | |
| 1179 | + if (!extensions.hasOwnProperty(name)) { | |
| 1180 | + throw Error("Extension named " + name + " is not registered!"); | |
| 1181 | + } | |
| 1182 | + return extensions[name]; | |
| 1183 | + } else { | |
| 1184 | + if (typeof ext === "function") { | |
| 1185 | + ext = ext(); | |
| 1186 | + } | |
| 1187 | + if (!showdown2.helper.isArray(ext)) { | |
| 1188 | + ext = [ext]; | |
| 1189 | + } | |
| 1190 | + var validExtension = validate(ext, name); | |
| 1191 | + if (validExtension.valid) { | |
| 1192 | + extensions[name] = ext; | |
| 1193 | + } else { | |
| 1194 | + throw Error(validExtension.error); | |
| 1195 | + } | |
| 1196 | + } | |
| 1197 | + }; | |
| 1198 | + showdown2.getAllExtensions = function() { | |
| 1199 | + "use strict"; | |
| 1200 | + return extensions; | |
| 1201 | + }; | |
| 1202 | + showdown2.removeExtension = function(name) { | |
| 1203 | + "use strict"; | |
| 1204 | + delete extensions[name]; | |
| 1205 | + }; | |
| 1206 | + showdown2.resetExtensions = function() { | |
| 1207 | + "use strict"; | |
| 1208 | + extensions = {}; | |
| 1209 | + }; | |
| 1210 | + function validate(extension, name) { | |
| 1211 | + "use strict"; | |
| 1212 | + var errMsg = name ? "Error in " + name + " extension->" : "Error in unnamed extension", ret = { | |
| 1213 | + valid: true, | |
| 1214 | + error: "" | |
| 1215 | + }; | |
| 1216 | + if (!showdown2.helper.isArray(extension)) { | |
| 1217 | + extension = [extension]; | |
| 1218 | + } | |
| 1219 | + for (var i2 = 0; i2 < extension.length; ++i2) { | |
| 1220 | + var baseMsg = errMsg + " sub-extension " + i2 + ": ", ext = extension[i2]; | |
| 1221 | + if (typeof ext !== "object") { | |
| 1222 | + ret.valid = false; | |
| 1223 | + ret.error = baseMsg + "must be an object, but " + typeof ext + " given"; | |
| 1224 | + return ret; | |
| 1225 | + } | |
| 1226 | + if (!showdown2.helper.isString(ext.type)) { | |
| 1227 | + ret.valid = false; | |
| 1228 | + ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + " given"; | |
| 1229 | + return ret; | |
| 1230 | + } | |
| 1231 | + var type = ext.type = ext.type.toLowerCase(); | |
| 1232 | + if (type === "language") { | |
| 1233 | + type = ext.type = "lang"; | |
| 1234 | + } | |
| 1235 | + if (type === "html") { | |
| 1236 | + type = ext.type = "output"; | |
| 1237 | + } | |
| 1238 | + if (type !== "lang" && type !== "output" && type !== "listener") { | |
| 1239 | + ret.valid = false; | |
| 1240 | + ret.error = baseMsg + "type " + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"'; | |
| 1241 | + return ret; | |
| 1242 | + } | |
| 1243 | + if (type === "listener") { | |
| 1244 | + if (showdown2.helper.isUndefined(ext.listeners)) { | |
| 1245 | + ret.valid = false; | |
| 1246 | + ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"'; | |
| 1247 | + return ret; | |
| 1248 | + } | |
| 1249 | + } else { | |
| 1250 | + if (showdown2.helper.isUndefined(ext.filter) && showdown2.helper.isUndefined(ext.regex)) { | |
| 1251 | + ret.valid = false; | |
| 1252 | + ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method'; | |
| 1253 | + return ret; | |
| 1254 | + } | |
| 1255 | + } | |
| 1256 | + if (ext.listeners) { | |
| 1257 | + if (typeof ext.listeners !== "object") { | |
| 1258 | + ret.valid = false; | |
| 1259 | + ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + " given"; | |
| 1260 | + return ret; | |
| 1261 | + } | |
| 1262 | + for (var ln in ext.listeners) { | |
| 1263 | + if (ext.listeners.hasOwnProperty(ln)) { | |
| 1264 | + if (typeof ext.listeners[ln] !== "function") { | |
| 1265 | + ret.valid = false; | |
| 1266 | + 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"; | |
| 1267 | + return ret; | |
| 1268 | + } | |
| 1269 | + } | |
| 1270 | + } | |
| 1271 | + } | |
| 1272 | + if (ext.filter) { | |
| 1273 | + if (typeof ext.filter !== "function") { | |
| 1274 | + ret.valid = false; | |
| 1275 | + ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + " given"; | |
| 1276 | + return ret; | |
| 1277 | + } | |
| 1278 | + } else if (ext.regex) { | |
| 1279 | + if (showdown2.helper.isString(ext.regex)) { | |
| 1280 | + ext.regex = new RegExp(ext.regex, "g"); | |
| 1281 | + } | |
| 1282 | + if (!(ext.regex instanceof RegExp)) { | |
| 1283 | + ret.valid = false; | |
| 1284 | + ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + " given"; | |
| 1285 | + return ret; | |
| 1286 | + } | |
| 1287 | + if (showdown2.helper.isUndefined(ext.replace)) { | |
| 1288 | + ret.valid = false; | |
| 1289 | + ret.error = baseMsg + '"regex" extensions must implement a replace string or function'; | |
| 1290 | + return ret; | |
| 1291 | + } | |
| 1292 | + } | |
| 1293 | + } | |
| 1294 | + return ret; | |
| 1295 | + } | |
| 1296 | + showdown2.validateExtension = function(ext) { | |
| 1297 | + "use strict"; | |
| 1298 | + var validateExtension = validate(ext, null); | |
| 1299 | + if (!validateExtension.valid) { | |
| 1300 | + console.warn(validateExtension.error); | |
| 1301 | + return false; | |
| 1302 | + } | |
| 1303 | + return true; | |
| 1304 | + }; | |
| 1305 | + if (!showdown2.hasOwnProperty("helper")) { | |
| 1306 | + showdown2.helper = {}; | |
| 1307 | + } | |
| 1308 | + showdown2.helper.isString = function(a2) { | |
| 1309 | + "use strict"; | |
| 1310 | + return typeof a2 === "string" || a2 instanceof String; | |
| 1311 | + }; | |
| 1312 | + showdown2.helper.isFunction = function(a2) { | |
| 1313 | + "use strict"; | |
| 1314 | + var getType = {}; | |
| 1315 | + return a2 && getType.toString.call(a2) === "[object Function]"; | |
| 1316 | + }; | |
| 1317 | + showdown2.helper.isArray = function(a2) { | |
| 1318 | + "use strict"; | |
| 1319 | + return Array.isArray(a2); | |
| 1320 | + }; | |
| 1321 | + showdown2.helper.isUndefined = function(value) { | |
| 1322 | + "use strict"; | |
| 1323 | + return typeof value === "undefined"; | |
| 1324 | + }; | |
| 1325 | + showdown2.helper.forEach = function(obj, callback) { | |
| 1326 | + "use strict"; | |
| 1327 | + if (showdown2.helper.isUndefined(obj)) { | |
| 1328 | + throw new Error("obj param is required"); | |
| 1329 | + } | |
| 1330 | + if (showdown2.helper.isUndefined(callback)) { | |
| 1331 | + throw new Error("callback param is required"); | |
| 1332 | + } | |
| 1333 | + if (!showdown2.helper.isFunction(callback)) { | |
| 1334 | + throw new Error("callback param must be a function/closure"); | |
| 1335 | + } | |
| 1336 | + if (typeof obj.forEach === "function") { | |
| 1337 | + obj.forEach(callback); | |
| 1338 | + } else if (showdown2.helper.isArray(obj)) { | |
| 1339 | + for (var i2 = 0; i2 < obj.length; i2++) { | |
| 1340 | + callback(obj[i2], i2, obj); | |
| 1341 | + } | |
| 1342 | + } else if (typeof obj === "object") { | |
| 1343 | + for (var prop2 in obj) { | |
| 1344 | + if (obj.hasOwnProperty(prop2)) { | |
| 1345 | + callback(obj[prop2], prop2, obj); | |
| 1346 | + } | |
| 1347 | + } | |
| 1348 | + } else { | |
| 1349 | + throw new Error("obj does not seem to be an array or an iterable object"); | |
| 1350 | + } | |
| 1351 | + }; | |
| 1352 | + showdown2.helper.stdExtName = function(s2) { | |
| 1353 | + "use strict"; | |
| 1354 | + return s2.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); | |
| 1355 | + }; | |
| 1356 | + function escapeCharactersCallback(wholeMatch, m1) { | |
| 1357 | + "use strict"; | |
| 1358 | + var charCodeToEscape = m1.charCodeAt(0); | |
| 1359 | + return "\xA8E" + charCodeToEscape + "E"; | |
| 1360 | + } | |
| 1361 | + showdown2.helper.escapeCharactersCallback = escapeCharactersCallback; | |
| 1362 | + showdown2.helper.escapeCharacters = function(text2, charsToEscape, afterBackslash) { | |
| 1363 | + "use strict"; | |
| 1364 | + var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])"; | |
| 1365 | + if (afterBackslash) { | |
| 1366 | + regexString = "\\\\" + regexString; | |
| 1367 | + } | |
| 1368 | + var regex = new RegExp(regexString, "g"); | |
| 1369 | + text2 = text2.replace(regex, escapeCharactersCallback); | |
| 1370 | + return text2; | |
| 1371 | + }; | |
| 1372 | + showdown2.helper.unescapeHTMLEntities = function(txt) { | |
| 1373 | + "use strict"; | |
| 1374 | + return txt.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); | |
| 1375 | + }; | |
| 1376 | + var rgxFindMatchPos = function(str, left, right, flags) { | |
| 1377 | + "use strict"; | |
| 1378 | + 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; | |
| 1379 | + do { | |
| 1380 | + t3 = 0; | |
| 1381 | + while (m2 = x2.exec(str)) { | |
| 1382 | + if (l2.test(m2[0])) { | |
| 1383 | + if (!t3++) { | |
| 1384 | + s2 = x2.lastIndex; | |
| 1385 | + start = s2 - m2[0].length; | |
| 1386 | + } | |
| 1387 | + } else if (t3) { | |
| 1388 | + if (!--t3) { | |
| 1389 | + end = m2.index + m2[0].length; | |
| 1390 | + var obj = { | |
| 1391 | + left: { start, end: s2 }, | |
| 1392 | + match: { start: s2, end: m2.index }, | |
| 1393 | + right: { start: m2.index, end }, | |
| 1394 | + wholeMatch: { start, end } | |
| 1395 | + }; | |
| 1396 | + pos.push(obj); | |
| 1397 | + if (!g2) { | |
| 1398 | + return pos; | |
| 1399 | + } | |
| 1400 | + } | |
| 1401 | + } | |
| 1402 | + } | |
| 1403 | + } while (t3 && (x2.lastIndex = s2)); | |
| 1404 | + return pos; | |
| 1405 | + }; | |
| 1406 | + showdown2.helper.matchRecursiveRegExp = function(str, left, right, flags) { | |
| 1407 | + "use strict"; | |
| 1408 | + var matchPos = rgxFindMatchPos(str, left, right, flags), results = []; | |
| 1409 | + for (var i2 = 0; i2 < matchPos.length; ++i2) { | |
| 1410 | + results.push([ | |
| 1411 | + str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end), | |
| 1412 | + str.slice(matchPos[i2].match.start, matchPos[i2].match.end), | |
| 1413 | + str.slice(matchPos[i2].left.start, matchPos[i2].left.end), | |
| 1414 | + str.slice(matchPos[i2].right.start, matchPos[i2].right.end) | |
| 1415 | + ]); | |
| 1416 | + } | |
| 1417 | + return results; | |
| 1418 | + }; | |
| 1419 | + showdown2.helper.replaceRecursiveRegExp = function(str, replacement, left, right, flags) { | |
| 1420 | + "use strict"; | |
| 1421 | + if (!showdown2.helper.isFunction(replacement)) { | |
| 1422 | + var repStr = replacement; | |
| 1423 | + replacement = function() { | |
| 1424 | + return repStr; | |
| 1425 | + }; | |
| 1426 | + } | |
| 1427 | + var matchPos = rgxFindMatchPos(str, left, right, flags), finalStr = str, lng = matchPos.length; | |
| 1428 | + if (lng > 0) { | |
| 1429 | + var bits = []; | |
| 1430 | + if (matchPos[0].wholeMatch.start !== 0) { | |
| 1431 | + bits.push(str.slice(0, matchPos[0].wholeMatch.start)); | |
| 1432 | + } | |
| 1433 | + for (var i2 = 0; i2 < lng; ++i2) { | |
| 1434 | + bits.push( | |
| 1435 | + replacement( | |
| 1436 | + str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end), | |
| 1437 | + str.slice(matchPos[i2].match.start, matchPos[i2].match.end), | |
| 1438 | + str.slice(matchPos[i2].left.start, matchPos[i2].left.end), | |
| 1439 | + str.slice(matchPos[i2].right.start, matchPos[i2].right.end) | |
| 1440 | + ) | |
| 1441 | + ); | |
| 1442 | + if (i2 < lng - 1) { | |
| 1443 | + bits.push(str.slice(matchPos[i2].wholeMatch.end, matchPos[i2 + 1].wholeMatch.start)); | |
| 1444 | + } | |
| 1445 | + } | |
| 1446 | + if (matchPos[lng - 1].wholeMatch.end < str.length) { | |
| 1447 | + bits.push(str.slice(matchPos[lng - 1].wholeMatch.end)); | |
| 1448 | + } | |
| 1449 | + finalStr = bits.join(""); | |
| 1450 | + } | |
| 1451 | + return finalStr; | |
| 1452 | + }; | |
| 1453 | + showdown2.helper.regexIndexOf = function(str, regex, fromIndex) { | |
| 1454 | + "use strict"; | |
| 1455 | + if (!showdown2.helper.isString(str)) { | |
| 1456 | + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; | |
| 1457 | + } | |
| 1458 | + if (regex instanceof RegExp === false) { | |
| 1459 | + throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; | |
| 1460 | + } | |
| 1461 | + var indexOf = str.substring(fromIndex || 0).search(regex); | |
| 1462 | + return indexOf >= 0 ? indexOf + (fromIndex || 0) : indexOf; | |
| 1463 | + }; | |
| 1464 | + showdown2.helper.splitAtIndex = function(str, index) { | |
| 1465 | + "use strict"; | |
| 1466 | + if (!showdown2.helper.isString(str)) { | |
| 1467 | + throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; | |
| 1468 | + } | |
| 1469 | + return [str.substring(0, index), str.substring(index)]; | |
| 1470 | + }; | |
| 1471 | + showdown2.helper.encodeEmailAddress = function(mail) { | |
| 1472 | + "use strict"; | |
| 1473 | + var encode = [ | |
| 1474 | + function(ch) { | |
| 1475 | + return "&#" + ch.charCodeAt(0) + ";"; | |
| 1476 | + }, | |
| 1477 | + function(ch) { | |
| 1478 | + return "&#x" + ch.charCodeAt(0).toString(16) + ";"; | |
| 1479 | + }, | |
| 1480 | + function(ch) { | |
| 1481 | + return ch; | |
| 1482 | + } | |
| 1483 | + ]; | |
| 1484 | + mail = mail.replace(/./g, function(ch) { | |
| 1485 | + if (ch === "@") { | |
| 1486 | + ch = encode[Math.floor(Math.random() * 2)](ch); | |
| 1487 | + } else { | |
| 1488 | + var r2 = Math.random(); | |
| 1489 | + ch = r2 > 0.9 ? encode[2](ch) : r2 > 0.45 ? encode[1](ch) : encode[0](ch); | |
| 1490 | + } | |
| 1491 | + return ch; | |
| 1492 | + }); | |
| 1493 | + return mail; | |
| 1494 | + }; | |
| 1495 | + showdown2.helper.padEnd = function padEnd(str, targetLength, padString) { | |
| 1496 | + "use strict"; | |
| 1497 | + targetLength = targetLength >> 0; | |
| 1498 | + padString = String(padString || " "); | |
| 1499 | + if (str.length > targetLength) { | |
| 1500 | + return String(str); | |
| 1501 | + } else { | |
| 1502 | + targetLength = targetLength - str.length; | |
| 1503 | + if (targetLength > padString.length) { | |
| 1504 | + padString += padString.repeat(targetLength / padString.length); | |
| 1505 | + } | |
| 1506 | + return String(str) + padString.slice(0, targetLength); | |
| 1507 | + } | |
| 1508 | + }; | |
| 1509 | + if (typeof console === "undefined") { | |
| 1510 | + console = { | |
| 1511 | + warn: function(msg) { | |
| 1512 | + "use strict"; | |
| 1513 | + alert(msg); | |
| 1514 | + }, | |
| 1515 | + log: function(msg) { | |
| 1516 | + "use strict"; | |
| 1517 | + alert(msg); | |
| 1518 | + }, | |
| 1519 | + error: function(msg) { | |
| 1520 | + "use strict"; | |
| 1521 | + throw msg; | |
| 1522 | + } | |
| 1523 | + }; | |
| 1524 | + } | |
| 1525 | + showdown2.helper.regexes = { | |
| 1526 | + asteriskDashAndColon: /([*_:~])/g | |
| 1527 | + }; | |
| 1528 | + showdown2.helper.emojis = { | |
| 1529 | + "+1": "\u{1F44D}", | |
| 1530 | + "-1": "\u{1F44E}", | |
| 1531 | + "100": "\u{1F4AF}", | |
| 1532 | + "1234": "\u{1F522}", | |
| 1533 | + "1st_place_medal": "\u{1F947}", | |
| 1534 | + "2nd_place_medal": "\u{1F948}", | |
| 1535 | + "3rd_place_medal": "\u{1F949}", | |
| 1536 | + "8ball": "\u{1F3B1}", | |
| 1537 | + "a": "\u{1F170}\uFE0F", | |
| 1538 | + "ab": "\u{1F18E}", | |
| 1539 | + "abc": "\u{1F524}", | |
| 1540 | + "abcd": "\u{1F521}", | |
| 1541 | + "accept": "\u{1F251}", | |
| 1542 | + "aerial_tramway": "\u{1F6A1}", | |
| 1543 | + "airplane": "\u2708\uFE0F", | |
| 1544 | + "alarm_clock": "\u23F0", | |
| 1545 | + "alembic": "\u2697\uFE0F", | |
| 1546 | + "alien": "\u{1F47D}", | |
| 1547 | + "ambulance": "\u{1F691}", | |
| 1548 | + "amphora": "\u{1F3FA}", | |
| 1549 | + "anchor": "\u2693\uFE0F", | |
| 1550 | + "angel": "\u{1F47C}", | |
| 1551 | + "anger": "\u{1F4A2}", | |
| 1552 | + "angry": "\u{1F620}", | |
| 1553 | + "anguished": "\u{1F627}", | |
| 1554 | + "ant": "\u{1F41C}", | |
| 1555 | + "apple": "\u{1F34E}", | |
| 1556 | + "aquarius": "\u2652\uFE0F", | |
| 1557 | + "aries": "\u2648\uFE0F", | |
| 1558 | + "arrow_backward": "\u25C0\uFE0F", | |
| 1559 | + "arrow_double_down": "\u23EC", | |
| 1560 | + "arrow_double_up": "\u23EB", | |
| 1561 | + "arrow_down": "\u2B07\uFE0F", | |
| 1562 | + "arrow_down_small": "\u{1F53D}", | |
| 1563 | + "arrow_forward": "\u25B6\uFE0F", | |
| 1564 | + "arrow_heading_down": "\u2935\uFE0F", | |
| 1565 | + "arrow_heading_up": "\u2934\uFE0F", | |
| 1566 | + "arrow_left": "\u2B05\uFE0F", | |
| 1567 | + "arrow_lower_left": "\u2199\uFE0F", | |
| 1568 | + "arrow_lower_right": "\u2198\uFE0F", | |
| 1569 | + "arrow_right": "\u27A1\uFE0F", | |
| 1570 | + "arrow_right_hook": "\u21AA\uFE0F", | |
| 1571 | + "arrow_up": "\u2B06\uFE0F", | |
| 1572 | + "arrow_up_down": "\u2195\uFE0F", | |
| 1573 | + "arrow_up_small": "\u{1F53C}", | |
| 1574 | + "arrow_upper_left": "\u2196\uFE0F", | |
| 1575 | + "arrow_upper_right": "\u2197\uFE0F", | |
| 1576 | + "arrows_clockwise": "\u{1F503}", | |
| 1577 | + "arrows_counterclockwise": "\u{1F504}", | |
| 1578 | + "art": "\u{1F3A8}", | |
| 1579 | + "articulated_lorry": "\u{1F69B}", | |
| 1580 | + "artificial_satellite": "\u{1F6F0}", | |
| 1581 | + "astonished": "\u{1F632}", | |
| 1582 | + "athletic_shoe": "\u{1F45F}", | |
| 1583 | + "atm": "\u{1F3E7}", | |
| 1584 | + "atom_symbol": "\u269B\uFE0F", | |
| 1585 | + "avocado": "\u{1F951}", | |
| 1586 | + "b": "\u{1F171}\uFE0F", | |
| 1587 | + "baby": "\u{1F476}", | |
| 1588 | + "baby_bottle": "\u{1F37C}", | |
| 1589 | + "baby_chick": "\u{1F424}", | |
| 1590 | + "baby_symbol": "\u{1F6BC}", | |
| 1591 | + "back": "\u{1F519}", | |
| 1592 | + "bacon": "\u{1F953}", | |
| 1593 | + "badminton": "\u{1F3F8}", | |
| 1594 | + "baggage_claim": "\u{1F6C4}", | |
| 1595 | + "baguette_bread": "\u{1F956}", | |
| 1596 | + "balance_scale": "\u2696\uFE0F", | |
| 1597 | + "balloon": "\u{1F388}", | |
| 1598 | + "ballot_box": "\u{1F5F3}", | |
| 1599 | + "ballot_box_with_check": "\u2611\uFE0F", | |
| 1600 | + "bamboo": "\u{1F38D}", | |
| 1601 | + "banana": "\u{1F34C}", | |
| 1602 | + "bangbang": "\u203C\uFE0F", | |
| 1603 | + "bank": "\u{1F3E6}", | |
| 1604 | + "bar_chart": "\u{1F4CA}", | |
| 1605 | + "barber": "\u{1F488}", | |
| 1606 | + "baseball": "\u26BE\uFE0F", | |
| 1607 | + "basketball": "\u{1F3C0}", | |
| 1608 | + "basketball_man": "\u26F9\uFE0F", | |
| 1609 | + "basketball_woman": "\u26F9\uFE0F‍\u2640\uFE0F", | |
| 1610 | + "bat": "\u{1F987}", | |
| 1611 | + "bath": "\u{1F6C0}", | |
| 1612 | + "bathtub": "\u{1F6C1}", | |
| 1613 | + "battery": "\u{1F50B}", | |
| 1614 | + "beach_umbrella": "\u{1F3D6}", | |
| 1615 | + "bear": "\u{1F43B}", | |
| 1616 | + "bed": "\u{1F6CF}", | |
| 1617 | + "bee": "\u{1F41D}", | |
| 1618 | + "beer": "\u{1F37A}", | |
| 1619 | + "beers": "\u{1F37B}", | |
| 1620 | + "beetle": "\u{1F41E}", | |
| 1621 | + "beginner": "\u{1F530}", | |
| 1622 | + "bell": "\u{1F514}", | |
| 1623 | + "bellhop_bell": "\u{1F6CE}", | |
| 1624 | + "bento": "\u{1F371}", | |
| 1625 | + "biking_man": "\u{1F6B4}", | |
| 1626 | + "bike": "\u{1F6B2}", | |
| 1627 | + "biking_woman": "\u{1F6B4}‍\u2640\uFE0F", | |
| 1628 | + "bikini": "\u{1F459}", | |
| 1629 | + "biohazard": "\u2623\uFE0F", | |
| 1630 | + "bird": "\u{1F426}", | |
| 1631 | + "birthday": "\u{1F382}", | |
| 1632 | + "black_circle": "\u26AB\uFE0F", | |
| 1633 | + "black_flag": "\u{1F3F4}", | |
| 1634 | + "black_heart": "\u{1F5A4}", | |
| 1635 | + "black_joker": "\u{1F0CF}", | |
| 1636 | + "black_large_square": "\u2B1B\uFE0F", | |
| 1637 | + "black_medium_small_square": "\u25FE\uFE0F", | |
| 1638 | + "black_medium_square": "\u25FC\uFE0F", | |
| 1639 | + "black_nib": "\u2712\uFE0F", | |
| 1640 | + "black_small_square": "\u25AA\uFE0F", | |
| 1641 | + "black_square_button": "\u{1F532}", | |
| 1642 | + "blonde_man": "\u{1F471}", | |
| 1643 | + "blonde_woman": "\u{1F471}‍\u2640\uFE0F", | |
| 1644 | + "blossom": "\u{1F33C}", | |
| 1645 | + "blowfish": "\u{1F421}", | |
| 1646 | + "blue_book": "\u{1F4D8}", | |
| 1647 | + "blue_car": "\u{1F699}", | |
| 1648 | + "blue_heart": "\u{1F499}", | |
| 1649 | + "blush": "\u{1F60A}", | |
| 1650 | + "boar": "\u{1F417}", | |
| 1651 | + "boat": "\u26F5\uFE0F", | |
| 1652 | + "bomb": "\u{1F4A3}", | |
| 1653 | + "book": "\u{1F4D6}", | |
| 1654 | + "bookmark": "\u{1F516}", | |
| 1655 | + "bookmark_tabs": "\u{1F4D1}", | |
| 1656 | + "books": "\u{1F4DA}", | |
| 1657 | + "boom": "\u{1F4A5}", | |
| 1658 | + "boot": "\u{1F462}", | |
| 1659 | + "bouquet": "\u{1F490}", | |
| 1660 | + "bowing_man": "\u{1F647}", | |
| 1661 | + "bow_and_arrow": "\u{1F3F9}", | |
| 1662 | + "bowing_woman": "\u{1F647}‍\u2640\uFE0F", | |
| 1663 | + "bowling": "\u{1F3B3}", | |
| 1664 | + "boxing_glove": "\u{1F94A}", | |
| 1665 | + "boy": "\u{1F466}", | |
| 1666 | + "bread": "\u{1F35E}", | |
| 1667 | + "bride_with_veil": "\u{1F470}", | |
| 1668 | + "bridge_at_night": "\u{1F309}", | |
| 1669 | + "briefcase": "\u{1F4BC}", | |
| 1670 | + "broken_heart": "\u{1F494}", | |
| 1671 | + "bug": "\u{1F41B}", | |
| 1672 | + "building_construction": "\u{1F3D7}", | |
| 1673 | + "bulb": "\u{1F4A1}", | |
| 1674 | + "bullettrain_front": "\u{1F685}", | |
| 1675 | + "bullettrain_side": "\u{1F684}", | |
| 1676 | + "burrito": "\u{1F32F}", | |
| 1677 | + "bus": "\u{1F68C}", | |
| 1678 | + "business_suit_levitating": "\u{1F574}", | |
| 1679 | + "busstop": "\u{1F68F}", | |
| 1680 | + "bust_in_silhouette": "\u{1F464}", | |
| 1681 | + "busts_in_silhouette": "\u{1F465}", | |
| 1682 | + "butterfly": "\u{1F98B}", | |
| 1683 | + "cactus": "\u{1F335}", | |
| 1684 | + "cake": "\u{1F370}", | |
| 1685 | + "calendar": "\u{1F4C6}", | |
| 1686 | + "call_me_hand": "\u{1F919}", | |
| 1687 | + "calling": "\u{1F4F2}", | |
| 1688 | + "camel": "\u{1F42B}", | |
| 1689 | + "camera": "\u{1F4F7}", | |
| 1690 | + "camera_flash": "\u{1F4F8}", | |
| 1691 | + "camping": "\u{1F3D5}", | |
| 1692 | + "cancer": "\u264B\uFE0F", | |
| 1693 | + "candle": "\u{1F56F}", | |
| 1694 | + "candy": "\u{1F36C}", | |
| 1695 | + "canoe": "\u{1F6F6}", | |
| 1696 | + "capital_abcd": "\u{1F520}", | |
| 1697 | + "capricorn": "\u2651\uFE0F", | |
| 1698 | + "car": "\u{1F697}", | |
| 1699 | + "card_file_box": "\u{1F5C3}", | |
| 1700 | + "card_index": "\u{1F4C7}", | |
| 1701 | + "card_index_dividers": "\u{1F5C2}", | |
| 1702 | + "carousel_horse": "\u{1F3A0}", | |
| 1703 | + "carrot": "\u{1F955}", | |
| 1704 | + "cat": "\u{1F431}", | |
| 1705 | + "cat2": "\u{1F408}", | |
| 1706 | + "cd": "\u{1F4BF}", | |
| 1707 | + "chains": "\u26D3", | |
| 1708 | + "champagne": "\u{1F37E}", | |
| 1709 | + "chart": "\u{1F4B9}", | |
| 1710 | + "chart_with_downwards_trend": "\u{1F4C9}", | |
| 1711 | + "chart_with_upwards_trend": "\u{1F4C8}", | |
| 1712 | + "checkered_flag": "\u{1F3C1}", | |
| 1713 | + "cheese": "\u{1F9C0}", | |
| 1714 | + "cherries": "\u{1F352}", | |
| 1715 | + "cherry_blossom": "\u{1F338}", | |
| 1716 | + "chestnut": "\u{1F330}", | |
| 1717 | + "chicken": "\u{1F414}", | |
| 1718 | + "children_crossing": "\u{1F6B8}", | |
| 1719 | + "chipmunk": "\u{1F43F}", | |
| 1720 | + "chocolate_bar": "\u{1F36B}", | |
| 1721 | + "christmas_tree": "\u{1F384}", | |
| 1722 | + "church": "\u26EA\uFE0F", | |
| 1723 | + "cinema": "\u{1F3A6}", | |
| 1724 | + "circus_tent": "\u{1F3AA}", | |
| 1725 | + "city_sunrise": "\u{1F307}", | |
| 1726 | + "city_sunset": "\u{1F306}", | |
| 1727 | + "cityscape": "\u{1F3D9}", | |
| 1728 | + "cl": "\u{1F191}", | |
| 1729 | + "clamp": "\u{1F5DC}", | |
| 1730 | + "clap": "\u{1F44F}", | |
| 1731 | + "clapper": "\u{1F3AC}", | |
| 1732 | + "classical_building": "\u{1F3DB}", | |
| 1733 | + "clinking_glasses": "\u{1F942}", | |
| 1734 | + "clipboard": "\u{1F4CB}", | |
| 1735 | + "clock1": "\u{1F550}", | |
| 1736 | + "clock10": "\u{1F559}", | |
| 1737 | + "clock1030": "\u{1F565}", | |
| 1738 | + "clock11": "\u{1F55A}", | |
| 1739 | + "clock1130": "\u{1F566}", | |
| 1740 | + "clock12": "\u{1F55B}", | |
| 1741 | + "clock1230": "\u{1F567}", | |
| 1742 | + "clock130": "\u{1F55C}", | |
| 1743 | + "clock2": "\u{1F551}", | |
| 1744 | + "clock230": "\u{1F55D}", | |
| 1745 | + "clock3": "\u{1F552}", | |
| 1746 | + "clock330": "\u{1F55E}", | |
| 1747 | + "clock4": "\u{1F553}", | |
| 1748 | + "clock430": "\u{1F55F}", | |
| 1749 | + "clock5": "\u{1F554}", | |
| 1750 | + "clock530": "\u{1F560}", | |
| 1751 | + "clock6": "\u{1F555}", | |
| 1752 | + "clock630": "\u{1F561}", | |
| 1753 | + "clock7": "\u{1F556}", | |
| 1754 | + "clock730": "\u{1F562}", | |
| 1755 | + "clock8": "\u{1F557}", | |
| 1756 | + "clock830": "\u{1F563}", | |
| 1757 | + "clock9": "\u{1F558}", | |
| 1758 | + "clock930": "\u{1F564}", | |
| 1759 | + "closed_book": "\u{1F4D5}", | |
| 1760 | + "closed_lock_with_key": "\u{1F510}", | |
| 1761 | + "closed_umbrella": "\u{1F302}", | |
| 1762 | + "cloud": "\u2601\uFE0F", | |
| 1763 | + "cloud_with_lightning": "\u{1F329}", | |
| 1764 | + "cloud_with_lightning_and_rain": "\u26C8", | |
| 1765 | + "cloud_with_rain": "\u{1F327}", | |
| 1766 | + "cloud_with_snow": "\u{1F328}", | |
| 1767 | + "clown_face": "\u{1F921}", | |
| 1768 | + "clubs": "\u2663\uFE0F", | |
| 1769 | + "cocktail": "\u{1F378}", | |
| 1770 | + "coffee": "\u2615\uFE0F", | |
| 1771 | + "coffin": "\u26B0\uFE0F", | |
| 1772 | + "cold_sweat": "\u{1F630}", | |
| 1773 | + "comet": "\u2604\uFE0F", | |
| 1774 | + "computer": "\u{1F4BB}", | |
| 1775 | + "computer_mouse": "\u{1F5B1}", | |
| 1776 | + "confetti_ball": "\u{1F38A}", | |
| 1777 | + "confounded": "\u{1F616}", | |
| 1778 | + "confused": "\u{1F615}", | |
| 1779 | + "congratulations": "\u3297\uFE0F", | |
| 1780 | + "construction": "\u{1F6A7}", | |
| 1781 | + "construction_worker_man": "\u{1F477}", | |
| 1782 | + "construction_worker_woman": "\u{1F477}‍\u2640\uFE0F", | |
| 1783 | + "control_knobs": "\u{1F39B}", | |
| 1784 | + "convenience_store": "\u{1F3EA}", | |
| 1785 | + "cookie": "\u{1F36A}", | |
| 1786 | + "cool": "\u{1F192}", | |
| 1787 | + "policeman": "\u{1F46E}", | |
| 1788 | + "copyright": "\xA9\uFE0F", | |
| 1789 | + "corn": "\u{1F33D}", | |
| 1790 | + "couch_and_lamp": "\u{1F6CB}", | |
| 1791 | + "couple": "\u{1F46B}", | |
| 1792 | + "couple_with_heart_woman_man": "\u{1F491}", | |
| 1793 | + "couple_with_heart_man_man": "\u{1F468}‍\u2764\uFE0F‍\u{1F468}", | |
| 1794 | + "couple_with_heart_woman_woman": "\u{1F469}‍\u2764\uFE0F‍\u{1F469}", | |
| 1795 | + "couplekiss_man_man": "\u{1F468}‍\u2764\uFE0F‍\u{1F48B}‍\u{1F468}", | |
| 1796 | + "couplekiss_man_woman": "\u{1F48F}", | |
| 1797 | + "couplekiss_woman_woman": "\u{1F469}‍\u2764\uFE0F‍\u{1F48B}‍\u{1F469}", | |
| 1798 | + "cow": "\u{1F42E}", | |
| 1799 | + "cow2": "\u{1F404}", | |
| 1800 | + "cowboy_hat_face": "\u{1F920}", | |
| 1801 | + "crab": "\u{1F980}", | |
| 1802 | + "crayon": "\u{1F58D}", | |
| 1803 | + "credit_card": "\u{1F4B3}", | |
| 1804 | + "crescent_moon": "\u{1F319}", | |
| 1805 | + "cricket": "\u{1F3CF}", | |
| 1806 | + "crocodile": "\u{1F40A}", | |
| 1807 | + "croissant": "\u{1F950}", | |
| 1808 | + "crossed_fingers": "\u{1F91E}", | |
| 1809 | + "crossed_flags": "\u{1F38C}", | |
| 1810 | + "crossed_swords": "\u2694\uFE0F", | |
| 1811 | + "crown": "\u{1F451}", | |
| 1812 | + "cry": "\u{1F622}", | |
| 1813 | + "crying_cat_face": "\u{1F63F}", | |
| 1814 | + "crystal_ball": "\u{1F52E}", | |
| 1815 | + "cucumber": "\u{1F952}", | |
| 1816 | + "cupid": "\u{1F498}", | |
| 1817 | + "curly_loop": "\u27B0", | |
| 1818 | + "currency_exchange": "\u{1F4B1}", | |
| 1819 | + "curry": "\u{1F35B}", | |
| 1820 | + "custard": "\u{1F36E}", | |
| 1821 | + "customs": "\u{1F6C3}", | |
| 1822 | + "cyclone": "\u{1F300}", | |
| 1823 | + "dagger": "\u{1F5E1}", | |
| 1824 | + "dancer": "\u{1F483}", | |
| 1825 | + "dancing_women": "\u{1F46F}", | |
| 1826 | + "dancing_men": "\u{1F46F}‍\u2642\uFE0F", | |
| 1827 | + "dango": "\u{1F361}", | |
| 1828 | + "dark_sunglasses": "\u{1F576}", | |
| 1829 | + "dart": "\u{1F3AF}", | |
| 1830 | + "dash": "\u{1F4A8}", | |
| 1831 | + "date": "\u{1F4C5}", | |
| 1832 | + "deciduous_tree": "\u{1F333}", | |
| 1833 | + "deer": "\u{1F98C}", | |
| 1834 | + "department_store": "\u{1F3EC}", | |
| 1835 | + "derelict_house": "\u{1F3DA}", | |
| 1836 | + "desert": "\u{1F3DC}", | |
| 1837 | + "desert_island": "\u{1F3DD}", | |
| 1838 | + "desktop_computer": "\u{1F5A5}", | |
| 1839 | + "male_detective": "\u{1F575}\uFE0F", | |
| 1840 | + "diamond_shape_with_a_dot_inside": "\u{1F4A0}", | |
| 1841 | + "diamonds": "\u2666\uFE0F", | |
| 1842 | + "disappointed": "\u{1F61E}", | |
| 1843 | + "disappointed_relieved": "\u{1F625}", | |
| 1844 | + "dizzy": "\u{1F4AB}", | |
| 1845 | + "dizzy_face": "\u{1F635}", | |
| 1846 | + "do_not_litter": "\u{1F6AF}", | |
| 1847 | + "dog": "\u{1F436}", | |
| 1848 | + "dog2": "\u{1F415}", | |
| 1849 | + "dollar": "\u{1F4B5}", | |
| 1850 | + "dolls": "\u{1F38E}", | |
| 1851 | + "dolphin": "\u{1F42C}", | |
| 1852 | + "door": "\u{1F6AA}", | |
| 1853 | + "doughnut": "\u{1F369}", | |
| 1854 | + "dove": "\u{1F54A}", | |
| 1855 | + "dragon": "\u{1F409}", | |
| 1856 | + "dragon_face": "\u{1F432}", | |
| 1857 | + "dress": "\u{1F457}", | |
| 1858 | + "dromedary_camel": "\u{1F42A}", | |
| 1859 | + "drooling_face": "\u{1F924}", | |
| 1860 | + "droplet": "\u{1F4A7}", | |
| 1861 | + "drum": "\u{1F941}", | |
| 1862 | + "duck": "\u{1F986}", | |
| 1863 | + "dvd": "\u{1F4C0}", | |
| 1864 | + "e-mail": "\u{1F4E7}", | |
| 1865 | + "eagle": "\u{1F985}", | |
| 1866 | + "ear": "\u{1F442}", | |
| 1867 | + "ear_of_rice": "\u{1F33E}", | |
| 1868 | + "earth_africa": "\u{1F30D}", | |
| 1869 | + "earth_americas": "\u{1F30E}", | |
| 1870 | + "earth_asia": "\u{1F30F}", | |
| 1871 | + "egg": "\u{1F95A}", | |
| 1872 | + "eggplant": "\u{1F346}", | |
| 1873 | + "eight_pointed_black_star": "\u2734\uFE0F", | |
| 1874 | + "eight_spoked_asterisk": "\u2733\uFE0F", | |
| 1875 | + "electric_plug": "\u{1F50C}", | |
| 1876 | + "elephant": "\u{1F418}", | |
| 1877 | + "email": "\u2709\uFE0F", | |
| 1878 | + "end": "\u{1F51A}", | |
| 1879 | + "envelope_with_arrow": "\u{1F4E9}", | |
| 1880 | + "euro": "\u{1F4B6}", | |
| 1881 | + "european_castle": "\u{1F3F0}", | |
| 1882 | + "european_post_office": "\u{1F3E4}", | |
| 1883 | + "evergreen_tree": "\u{1F332}", | |
| 1884 | + "exclamation": "\u2757\uFE0F", | |
| 1885 | + "expressionless": "\u{1F611}", | |
| 1886 | + "eye": "\u{1F441}", | |
| 1887 | + "eye_speech_bubble": "\u{1F441}‍\u{1F5E8}", | |
| 1888 | + "eyeglasses": "\u{1F453}", | |
| 1889 | + "eyes": "\u{1F440}", | |
| 1890 | + "face_with_head_bandage": "\u{1F915}", | |
| 1891 | + "face_with_thermometer": "\u{1F912}", | |
| 1892 | + "fist_oncoming": "\u{1F44A}", | |
| 1893 | + "factory": "\u{1F3ED}", | |
| 1894 | + "fallen_leaf": "\u{1F342}", | |
| 1895 | + "family_man_woman_boy": "\u{1F46A}", | |
| 1896 | + "family_man_boy": "\u{1F468}‍\u{1F466}", | |
| 1897 | + "family_man_boy_boy": "\u{1F468}‍\u{1F466}‍\u{1F466}", | |
| 1898 | + "family_man_girl": "\u{1F468}‍\u{1F467}", | |
| 1899 | + "family_man_girl_boy": "\u{1F468}‍\u{1F467}‍\u{1F466}", | |
| 1900 | + "family_man_girl_girl": "\u{1F468}‍\u{1F467}‍\u{1F467}", | |
| 1901 | + "family_man_man_boy": "\u{1F468}‍\u{1F468}‍\u{1F466}", | |
| 1902 | + "family_man_man_boy_boy": "\u{1F468}‍\u{1F468}‍\u{1F466}‍\u{1F466}", | |
| 1903 | + "family_man_man_girl": "\u{1F468}‍\u{1F468}‍\u{1F467}", | |
| 1904 | + "family_man_man_girl_boy": "\u{1F468}‍\u{1F468}‍\u{1F467}‍\u{1F466}", | |
| 1905 | + "family_man_man_girl_girl": "\u{1F468}‍\u{1F468}‍\u{1F467}‍\u{1F467}", | |
| 1906 | + "family_man_woman_boy_boy": "\u{1F468}‍\u{1F469}‍\u{1F466}‍\u{1F466}", | |
| 1907 | + "family_man_woman_girl": "\u{1F468}‍\u{1F469}‍\u{1F467}", | |
| 1908 | + "family_man_woman_girl_boy": "\u{1F468}‍\u{1F469}‍\u{1F467}‍\u{1F466}", | |
| 1909 | + "family_man_woman_girl_girl": "\u{1F468}‍\u{1F469}‍\u{1F467}‍\u{1F467}", | |
| 1910 | + "family_woman_boy": "\u{1F469}‍\u{1F466}", | |
| 1911 | + "family_woman_boy_boy": "\u{1F469}‍\u{1F466}‍\u{1F466}", | |
| 1912 | + "family_woman_girl": "\u{1F469}‍\u{1F467}", | |
| 1913 | + "family_woman_girl_boy": "\u{1F469}‍\u{1F467}‍\u{1F466}", | |
| 1914 | + "family_woman_girl_girl": "\u{1F469}‍\u{1F467}‍\u{1F467}", | |
| 1915 | + "family_woman_woman_boy": "\u{1F469}‍\u{1F469}‍\u{1F466}", | |
| 1916 | + "family_woman_woman_boy_boy": "\u{1F469}‍\u{1F469}‍\u{1F466}‍\u{1F466}", | |
| 1917 | + "family_woman_woman_girl": "\u{1F469}‍\u{1F469}‍\u{1F467}", | |
| 1918 | + "family_woman_woman_girl_boy": "\u{1F469}‍\u{1F469}‍\u{1F467}‍\u{1F466}", | |
| 1919 | + "family_woman_woman_girl_girl": "\u{1F469}‍\u{1F469}‍\u{1F467}‍\u{1F467}", | |
| 1920 | + "fast_forward": "\u23E9", | |
| 1921 | + "fax": "\u{1F4E0}", | |
| 1922 | + "fearful": "\u{1F628}", | |
| 1923 | + "feet": "\u{1F43E}", | |
| 1924 | + "female_detective": "\u{1F575}\uFE0F‍\u2640\uFE0F", | |
| 1925 | + "ferris_wheel": "\u{1F3A1}", | |
| 1926 | + "ferry": "\u26F4", | |
| 1927 | + "field_hockey": "\u{1F3D1}", | |
| 1928 | + "file_cabinet": "\u{1F5C4}", | |
| 1929 | + "file_folder": "\u{1F4C1}", | |
| 1930 | + "film_projector": "\u{1F4FD}", | |
| 1931 | + "film_strip": "\u{1F39E}", | |
| 1932 | + "fire": "\u{1F525}", | |
| 1933 | + "fire_engine": "\u{1F692}", | |
| 1934 | + "fireworks": "\u{1F386}", | |
| 1935 | + "first_quarter_moon": "\u{1F313}", | |
| 1936 | + "first_quarter_moon_with_face": "\u{1F31B}", | |
| 1937 | + "fish": "\u{1F41F}", | |
| 1938 | + "fish_cake": "\u{1F365}", | |
| 1939 | + "fishing_pole_and_fish": "\u{1F3A3}", | |
| 1940 | + "fist_raised": "\u270A", | |
| 1941 | + "fist_left": "\u{1F91B}", | |
| 1942 | + "fist_right": "\u{1F91C}", | |
| 1943 | + "flags": "\u{1F38F}", | |
| 1944 | + "flashlight": "\u{1F526}", | |
| 1945 | + "fleur_de_lis": "\u269C\uFE0F", | |
| 1946 | + "flight_arrival": "\u{1F6EC}", | |
| 1947 | + "flight_departure": "\u{1F6EB}", | |
| 1948 | + "floppy_disk": "\u{1F4BE}", | |
| 1949 | + "flower_playing_cards": "\u{1F3B4}", | |
| 1950 | + "flushed": "\u{1F633}", | |
| 1951 | + "fog": "\u{1F32B}", | |
| 1952 | + "foggy": "\u{1F301}", | |
| 1953 | + "football": "\u{1F3C8}", | |
| 1954 | + "footprints": "\u{1F463}", | |
| 1955 | + "fork_and_knife": "\u{1F374}", | |
| 1956 | + "fountain": "\u26F2\uFE0F", | |
| 1957 | + "fountain_pen": "\u{1F58B}", | |
| 1958 | + "four_leaf_clover": "\u{1F340}", | |
| 1959 | + "fox_face": "\u{1F98A}", | |
| 1960 | + "framed_picture": "\u{1F5BC}", | |
| 1961 | + "free": "\u{1F193}", | |
| 1962 | + "fried_egg": "\u{1F373}", | |
| 1963 | + "fried_shrimp": "\u{1F364}", | |
| 1964 | + "fries": "\u{1F35F}", | |
| 1965 | + "frog": "\u{1F438}", | |
| 1966 | + "frowning": "\u{1F626}", | |
| 1967 | + "frowning_face": "\u2639\uFE0F", | |
| 1968 | + "frowning_man": "\u{1F64D}‍\u2642\uFE0F", | |
| 1969 | + "frowning_woman": "\u{1F64D}", | |
| 1970 | + "middle_finger": "\u{1F595}", | |
| 1971 | + "fuelpump": "\u26FD\uFE0F", | |
| 1972 | + "full_moon": "\u{1F315}", | |
| 1973 | + "full_moon_with_face": "\u{1F31D}", | |
| 1974 | + "funeral_urn": "\u26B1\uFE0F", | |
| 1975 | + "game_die": "\u{1F3B2}", | |
| 1976 | + "gear": "\u2699\uFE0F", | |
| 1977 | + "gem": "\u{1F48E}", | |
| 1978 | + "gemini": "\u264A\uFE0F", | |
| 1979 | + "ghost": "\u{1F47B}", | |
| 1980 | + "gift": "\u{1F381}", | |
| 1981 | + "gift_heart": "\u{1F49D}", | |
| 1982 | + "girl": "\u{1F467}", | |
| 1983 | + "globe_with_meridians": "\u{1F310}", | |
| 1984 | + "goal_net": "\u{1F945}", | |
| 1985 | + "goat": "\u{1F410}", | |
| 1986 | + "golf": "\u26F3\uFE0F", | |
| 1987 | + "golfing_man": "\u{1F3CC}\uFE0F", | |
| 1988 | + "golfing_woman": "\u{1F3CC}\uFE0F‍\u2640\uFE0F", | |
| 1989 | + "gorilla": "\u{1F98D}", | |
| 1990 | + "grapes": "\u{1F347}", | |
| 1991 | + "green_apple": "\u{1F34F}", | |
| 1992 | + "green_book": "\u{1F4D7}", | |
| 1993 | + "green_heart": "\u{1F49A}", | |
| 1994 | + "green_salad": "\u{1F957}", | |
| 1995 | + "grey_exclamation": "\u2755", | |
| 1996 | + "grey_question": "\u2754", | |
| 1997 | + "grimacing": "\u{1F62C}", | |
| 1998 | + "grin": "\u{1F601}", | |
| 1999 | + "grinning": "\u{1F600}", | |
| 2000 | + "guardsman": "\u{1F482}", | |
| 2001 | + "guardswoman": "\u{1F482}‍\u2640\uFE0F", | |
| 2002 | + "guitar": "\u{1F3B8}", | |
| 2003 | + "gun": "\u{1F52B}", | |
| 2004 | + "haircut_woman": "\u{1F487}", | |
| 2005 | + "haircut_man": "\u{1F487}‍\u2642\uFE0F", | |
| 2006 | + "hamburger": "\u{1F354}", | |
| 2007 | + "hammer": "\u{1F528}", | |
| 2008 | + "hammer_and_pick": "\u2692", | |
| 2009 | + "hammer_and_wrench": "\u{1F6E0}", | |
| 2010 | + "hamster": "\u{1F439}", | |
| 2011 | + "hand": "\u270B", | |
| 2012 | + "handbag": "\u{1F45C}", | |
| 2013 | + "handshake": "\u{1F91D}", | |
| 2014 | + "hankey": "\u{1F4A9}", | |
| 2015 | + "hatched_chick": "\u{1F425}", | |
| 2016 | + "hatching_chick": "\u{1F423}", | |
| 2017 | + "headphones": "\u{1F3A7}", | |
| 2018 | + "hear_no_evil": "\u{1F649}", | |
| 2019 | + "heart": "\u2764\uFE0F", | |
| 2020 | + "heart_decoration": "\u{1F49F}", | |
| 2021 | + "heart_eyes": "\u{1F60D}", | |
| 2022 | + "heart_eyes_cat": "\u{1F63B}", | |
| 2023 | + "heartbeat": "\u{1F493}", | |
| 2024 | + "heartpulse": "\u{1F497}", | |
| 2025 | + "hearts": "\u2665\uFE0F", | |
| 2026 | + "heavy_check_mark": "\u2714\uFE0F", | |
| 2027 | + "heavy_division_sign": "\u2797", | |
| 2028 | + "heavy_dollar_sign": "\u{1F4B2}", | |
| 2029 | + "heavy_heart_exclamation": "\u2763\uFE0F", | |
| 2030 | + "heavy_minus_sign": "\u2796", | |
| 2031 | + "heavy_multiplication_x": "\u2716\uFE0F", | |
| 2032 | + "heavy_plus_sign": "\u2795", | |
| 2033 | + "helicopter": "\u{1F681}", | |
| 2034 | + "herb": "\u{1F33F}", | |
| 2035 | + "hibiscus": "\u{1F33A}", | |
| 2036 | + "high_brightness": "\u{1F506}", | |
| 2037 | + "high_heel": "\u{1F460}", | |
| 2038 | + "hocho": "\u{1F52A}", | |
| 2039 | + "hole": "\u{1F573}", | |
| 2040 | + "honey_pot": "\u{1F36F}", | |
| 2041 | + "horse": "\u{1F434}", | |
| 2042 | + "horse_racing": "\u{1F3C7}", | |
| 2043 | + "hospital": "\u{1F3E5}", | |
| 2044 | + "hot_pepper": "\u{1F336}", | |
| 2045 | + "hotdog": "\u{1F32D}", | |
| 2046 | + "hotel": "\u{1F3E8}", | |
| 2047 | + "hotsprings": "\u2668\uFE0F", | |
| 2048 | + "hourglass": "\u231B\uFE0F", | |
| 2049 | + "hourglass_flowing_sand": "\u23F3", | |
| 2050 | + "house": "\u{1F3E0}", | |
| 2051 | + "house_with_garden": "\u{1F3E1}", | |
| 2052 | + "houses": "\u{1F3D8}", | |
| 2053 | + "hugs": "\u{1F917}", | |
| 2054 | + "hushed": "\u{1F62F}", | |
| 2055 | + "ice_cream": "\u{1F368}", | |
| 2056 | + "ice_hockey": "\u{1F3D2}", | |
| 2057 | + "ice_skate": "\u26F8", | |
| 2058 | + "icecream": "\u{1F366}", | |
| 2059 | + "id": "\u{1F194}", | |
| 2060 | + "ideograph_advantage": "\u{1F250}", | |
| 2061 | + "imp": "\u{1F47F}", | |
| 2062 | + "inbox_tray": "\u{1F4E5}", | |
| 2063 | + "incoming_envelope": "\u{1F4E8}", | |
| 2064 | + "tipping_hand_woman": "\u{1F481}", | |
| 2065 | + "information_source": "\u2139\uFE0F", | |
| 2066 | + "innocent": "\u{1F607}", | |
| 2067 | + "interrobang": "\u2049\uFE0F", | |
| 2068 | + "iphone": "\u{1F4F1}", | |
| 2069 | + "izakaya_lantern": "\u{1F3EE}", | |
| 2070 | + "jack_o_lantern": "\u{1F383}", | |
| 2071 | + "japan": "\u{1F5FE}", | |
| 2072 | + "japanese_castle": "\u{1F3EF}", | |
| 2073 | + "japanese_goblin": "\u{1F47A}", | |
| 2074 | + "japanese_ogre": "\u{1F479}", | |
| 2075 | + "jeans": "\u{1F456}", | |
| 2076 | + "joy": "\u{1F602}", | |
| 2077 | + "joy_cat": "\u{1F639}", | |
| 2078 | + "joystick": "\u{1F579}", | |
| 2079 | + "kaaba": "\u{1F54B}", | |
| 2080 | + "key": "\u{1F511}", | |
| 2081 | + "keyboard": "\u2328\uFE0F", | |
| 2082 | + "keycap_ten": "\u{1F51F}", | |
| 2083 | + "kick_scooter": "\u{1F6F4}", | |
| 2084 | + "kimono": "\u{1F458}", | |
| 2085 | + "kiss": "\u{1F48B}", | |
| 2086 | + "kissing": "\u{1F617}", | |
| 2087 | + "kissing_cat": "\u{1F63D}", | |
| 2088 | + "kissing_closed_eyes": "\u{1F61A}", | |
| 2089 | + "kissing_heart": "\u{1F618}", | |
| 2090 | + "kissing_smiling_eyes": "\u{1F619}", | |
| 2091 | + "kiwi_fruit": "\u{1F95D}", | |
| 2092 | + "koala": "\u{1F428}", | |
| 2093 | + "koko": "\u{1F201}", | |
| 2094 | + "label": "\u{1F3F7}", | |
| 2095 | + "large_blue_circle": "\u{1F535}", | |
| 2096 | + "large_blue_diamond": "\u{1F537}", | |
| 2097 | + "large_orange_diamond": "\u{1F536}", | |
| 2098 | + "last_quarter_moon": "\u{1F317}", | |
| 2099 | + "last_quarter_moon_with_face": "\u{1F31C}", | |
| 2100 | + "latin_cross": "\u271D\uFE0F", | |
| 2101 | + "laughing": "\u{1F606}", | |
| 2102 | + "leaves": "\u{1F343}", | |
| 2103 | + "ledger": "\u{1F4D2}", | |
| 2104 | + "left_luggage": "\u{1F6C5}", | |
| 2105 | + "left_right_arrow": "\u2194\uFE0F", | |
| 2106 | + "leftwards_arrow_with_hook": "\u21A9\uFE0F", | |
| 2107 | + "lemon": "\u{1F34B}", | |
| 2108 | + "leo": "\u264C\uFE0F", | |
| 2109 | + "leopard": "\u{1F406}", | |
| 2110 | + "level_slider": "\u{1F39A}", | |
| 2111 | + "libra": "\u264E\uFE0F", | |
| 2112 | + "light_rail": "\u{1F688}", | |
| 2113 | + "link": "\u{1F517}", | |
| 2114 | + "lion": "\u{1F981}", | |
| 2115 | + "lips": "\u{1F444}", | |
| 2116 | + "lipstick": "\u{1F484}", | |
| 2117 | + "lizard": "\u{1F98E}", | |
| 2118 | + "lock": "\u{1F512}", | |
| 2119 | + "lock_with_ink_pen": "\u{1F50F}", | |
| 2120 | + "lollipop": "\u{1F36D}", | |
| 2121 | + "loop": "\u27BF", | |
| 2122 | + "loud_sound": "\u{1F50A}", | |
| 2123 | + "loudspeaker": "\u{1F4E2}", | |
| 2124 | + "love_hotel": "\u{1F3E9}", | |
| 2125 | + "love_letter": "\u{1F48C}", | |
| 2126 | + "low_brightness": "\u{1F505}", | |
| 2127 | + "lying_face": "\u{1F925}", | |
| 2128 | + "m": "\u24C2\uFE0F", | |
| 2129 | + "mag": "\u{1F50D}", | |
| 2130 | + "mag_right": "\u{1F50E}", | |
| 2131 | + "mahjong": "\u{1F004}\uFE0F", | |
| 2132 | + "mailbox": "\u{1F4EB}", | |
| 2133 | + "mailbox_closed": "\u{1F4EA}", | |
| 2134 | + "mailbox_with_mail": "\u{1F4EC}", | |
| 2135 | + "mailbox_with_no_mail": "\u{1F4ED}", | |
| 2136 | + "man": "\u{1F468}", | |
| 2137 | + "man_artist": "\u{1F468}‍\u{1F3A8}", | |
| 2138 | + "man_astronaut": "\u{1F468}‍\u{1F680}", | |
| 2139 | + "man_cartwheeling": "\u{1F938}‍\u2642\uFE0F", | |
| 2140 | + "man_cook": "\u{1F468}‍\u{1F373}", | |
| 2141 | + "man_dancing": "\u{1F57A}", | |
| 2142 | + "man_facepalming": "\u{1F926}‍\u2642\uFE0F", | |
| 2143 | + "man_factory_worker": "\u{1F468}‍\u{1F3ED}", | |
| 2144 | + "man_farmer": "\u{1F468}‍\u{1F33E}", | |
| 2145 | + "man_firefighter": "\u{1F468}‍\u{1F692}", | |
| 2146 | + "man_health_worker": "\u{1F468}‍\u2695\uFE0F", | |
| 2147 | + "man_in_tuxedo": "\u{1F935}", | |
| 2148 | + "man_judge": "\u{1F468}‍\u2696\uFE0F", | |
| 2149 | + "man_juggling": "\u{1F939}‍\u2642\uFE0F", | |
| 2150 | + "man_mechanic": "\u{1F468}‍\u{1F527}", | |
| 2151 | + "man_office_worker": "\u{1F468}‍\u{1F4BC}", | |
| 2152 | + "man_pilot": "\u{1F468}‍\u2708\uFE0F", | |
| 2153 | + "man_playing_handball": "\u{1F93E}‍\u2642\uFE0F", | |
| 2154 | + "man_playing_water_polo": "\u{1F93D}‍\u2642\uFE0F", | |
| 2155 | + "man_scientist": "\u{1F468}‍\u{1F52C}", | |
| 2156 | + "man_shrugging": "\u{1F937}‍\u2642\uFE0F", | |
| 2157 | + "man_singer": "\u{1F468}‍\u{1F3A4}", | |
| 2158 | + "man_student": "\u{1F468}‍\u{1F393}", | |
| 2159 | + "man_teacher": "\u{1F468}‍\u{1F3EB}", | |
| 2160 | + "man_technologist": "\u{1F468}‍\u{1F4BB}", | |
| 2161 | + "man_with_gua_pi_mao": "\u{1F472}", | |
| 2162 | + "man_with_turban": "\u{1F473}", | |
| 2163 | + "tangerine": "\u{1F34A}", | |
| 2164 | + "mans_shoe": "\u{1F45E}", | |
| 2165 | + "mantelpiece_clock": "\u{1F570}", | |
| 2166 | + "maple_leaf": "\u{1F341}", | |
| 2167 | + "martial_arts_uniform": "\u{1F94B}", | |
| 2168 | + "mask": "\u{1F637}", | |
| 2169 | + "massage_woman": "\u{1F486}", | |
| 2170 | + "massage_man": "\u{1F486}‍\u2642\uFE0F", | |
| 2171 | + "meat_on_bone": "\u{1F356}", | |
| 2172 | + "medal_military": "\u{1F396}", | |
| 2173 | + "medal_sports": "\u{1F3C5}", | |
| 2174 | + "mega": "\u{1F4E3}", | |
| 2175 | + "melon": "\u{1F348}", | |
| 2176 | + "memo": "\u{1F4DD}", | |
| 2177 | + "men_wrestling": "\u{1F93C}‍\u2642\uFE0F", | |
| 2178 | + "menorah": "\u{1F54E}", | |
| 2179 | + "mens": "\u{1F6B9}", | |
| 2180 | + "metal": "\u{1F918}", | |
| 2181 | + "metro": "\u{1F687}", | |
| 2182 | + "microphone": "\u{1F3A4}", | |
| 2183 | + "microscope": "\u{1F52C}", | |
| 2184 | + "milk_glass": "\u{1F95B}", | |
| 2185 | + "milky_way": "\u{1F30C}", | |
| 2186 | + "minibus": "\u{1F690}", | |
| 2187 | + "minidisc": "\u{1F4BD}", | |
| 2188 | + "mobile_phone_off": "\u{1F4F4}", | |
| 2189 | + "money_mouth_face": "\u{1F911}", | |
| 2190 | + "money_with_wings": "\u{1F4B8}", | |
| 2191 | + "moneybag": "\u{1F4B0}", | |
| 2192 | + "monkey": "\u{1F412}", | |
| 2193 | + "monkey_face": "\u{1F435}", | |
| 2194 | + "monorail": "\u{1F69D}", | |
| 2195 | + "moon": "\u{1F314}", | |
| 2196 | + "mortar_board": "\u{1F393}", | |
| 2197 | + "mosque": "\u{1F54C}", | |
| 2198 | + "motor_boat": "\u{1F6E5}", | |
| 2199 | + "motor_scooter": "\u{1F6F5}", | |
| 2200 | + "motorcycle": "\u{1F3CD}", | |
| 2201 | + "motorway": "\u{1F6E3}", | |
| 2202 | + "mount_fuji": "\u{1F5FB}", | |
| 2203 | + "mountain": "\u26F0", | |
| 2204 | + "mountain_biking_man": "\u{1F6B5}", | |
| 2205 | + "mountain_biking_woman": "\u{1F6B5}‍\u2640\uFE0F", | |
| 2206 | + "mountain_cableway": "\u{1F6A0}", | |
| 2207 | + "mountain_railway": "\u{1F69E}", | |
| 2208 | + "mountain_snow": "\u{1F3D4}", | |
| 2209 | + "mouse": "\u{1F42D}", | |
| 2210 | + "mouse2": "\u{1F401}", | |
| 2211 | + "movie_camera": "\u{1F3A5}", | |
| 2212 | + "moyai": "\u{1F5FF}", | |
| 2213 | + "mrs_claus": "\u{1F936}", | |
| 2214 | + "muscle": "\u{1F4AA}", | |
| 2215 | + "mushroom": "\u{1F344}", | |
| 2216 | + "musical_keyboard": "\u{1F3B9}", | |
| 2217 | + "musical_note": "\u{1F3B5}", | |
| 2218 | + "musical_score": "\u{1F3BC}", | |
| 2219 | + "mute": "\u{1F507}", | |
| 2220 | + "nail_care": "\u{1F485}", | |
| 2221 | + "name_badge": "\u{1F4DB}", | |
| 2222 | + "national_park": "\u{1F3DE}", | |
| 2223 | + "nauseated_face": "\u{1F922}", | |
| 2224 | + "necktie": "\u{1F454}", | |
| 2225 | + "negative_squared_cross_mark": "\u274E", | |
| 2226 | + "nerd_face": "\u{1F913}", | |
| 2227 | + "neutral_face": "\u{1F610}", | |
| 2228 | + "new": "\u{1F195}", | |
| 2229 | + "new_moon": "\u{1F311}", | |
| 2230 | + "new_moon_with_face": "\u{1F31A}", | |
| 2231 | + "newspaper": "\u{1F4F0}", | |
| 2232 | + "newspaper_roll": "\u{1F5DE}", | |
| 2233 | + "next_track_button": "\u23ED", | |
| 2234 | + "ng": "\u{1F196}", | |
| 2235 | + "no_good_man": "\u{1F645}‍\u2642\uFE0F", | |
| 2236 | + "no_good_woman": "\u{1F645}", | |
| 2237 | + "night_with_stars": "\u{1F303}", | |
| 2238 | + "no_bell": "\u{1F515}", | |
| 2239 | + "no_bicycles": "\u{1F6B3}", | |
| 2240 | + "no_entry": "\u26D4\uFE0F", | |
| 2241 | + "no_entry_sign": "\u{1F6AB}", | |
| 2242 | + "no_mobile_phones": "\u{1F4F5}", | |
| 2243 | + "no_mouth": "\u{1F636}", | |
| 2244 | + "no_pedestrians": "\u{1F6B7}", | |
| 2245 | + "no_smoking": "\u{1F6AD}", | |
| 2246 | + "non-potable_water": "\u{1F6B1}", | |
| 2247 | + "nose": "\u{1F443}", | |
| 2248 | + "notebook": "\u{1F4D3}", | |
| 2249 | + "notebook_with_decorative_cover": "\u{1F4D4}", | |
| 2250 | + "notes": "\u{1F3B6}", | |
| 2251 | + "nut_and_bolt": "\u{1F529}", | |
| 2252 | + "o": "\u2B55\uFE0F", | |
| 2253 | + "o2": "\u{1F17E}\uFE0F", | |
| 2254 | + "ocean": "\u{1F30A}", | |
| 2255 | + "octopus": "\u{1F419}", | |
| 2256 | + "oden": "\u{1F362}", | |
| 2257 | + "office": "\u{1F3E2}", | |
| 2258 | + "oil_drum": "\u{1F6E2}", | |
| 2259 | + "ok": "\u{1F197}", | |
| 2260 | + "ok_hand": "\u{1F44C}", | |
| 2261 | + "ok_man": "\u{1F646}‍\u2642\uFE0F", | |
| 2262 | + "ok_woman": "\u{1F646}", | |
| 2263 | + "old_key": "\u{1F5DD}", | |
| 2264 | + "older_man": "\u{1F474}", | |
| 2265 | + "older_woman": "\u{1F475}", | |
| 2266 | + "om": "\u{1F549}", | |
| 2267 | + "on": "\u{1F51B}", | |
| 2268 | + "oncoming_automobile": "\u{1F698}", | |
| 2269 | + "oncoming_bus": "\u{1F68D}", | |
| 2270 | + "oncoming_police_car": "\u{1F694}", | |
| 2271 | + "oncoming_taxi": "\u{1F696}", | |
| 2272 | + "open_file_folder": "\u{1F4C2}", | |
| 2273 | + "open_hands": "\u{1F450}", | |
| 2274 | + "open_mouth": "\u{1F62E}", | |
| 2275 | + "open_umbrella": "\u2602\uFE0F", | |
| 2276 | + "ophiuchus": "\u26CE", | |
| 2277 | + "orange_book": "\u{1F4D9}", | |
| 2278 | + "orthodox_cross": "\u2626\uFE0F", | |
| 2279 | + "outbox_tray": "\u{1F4E4}", | |
| 2280 | + "owl": "\u{1F989}", | |
| 2281 | + "ox": "\u{1F402}", | |
| 2282 | + "package": "\u{1F4E6}", | |
| 2283 | + "page_facing_up": "\u{1F4C4}", | |
| 2284 | + "page_with_curl": "\u{1F4C3}", | |
| 2285 | + "pager": "\u{1F4DF}", | |
| 2286 | + "paintbrush": "\u{1F58C}", | |
| 2287 | + "palm_tree": "\u{1F334}", | |
| 2288 | + "pancakes": "\u{1F95E}", | |
| 2289 | + "panda_face": "\u{1F43C}", | |
| 2290 | + "paperclip": "\u{1F4CE}", | |
| 2291 | + "paperclips": "\u{1F587}", | |
| 2292 | + "parasol_on_ground": "\u26F1", | |
| 2293 | + "parking": "\u{1F17F}\uFE0F", | |
| 2294 | + "part_alternation_mark": "\u303D\uFE0F", | |
| 2295 | + "partly_sunny": "\u26C5\uFE0F", | |
| 2296 | + "passenger_ship": "\u{1F6F3}", | |
| 2297 | + "passport_control": "\u{1F6C2}", | |
| 2298 | + "pause_button": "\u23F8", | |
| 2299 | + "peace_symbol": "\u262E\uFE0F", | |
| 2300 | + "peach": "\u{1F351}", | |
| 2301 | + "peanuts": "\u{1F95C}", | |
| 2302 | + "pear": "\u{1F350}", | |
| 2303 | + "pen": "\u{1F58A}", | |
| 2304 | + "pencil2": "\u270F\uFE0F", | |
| 2305 | + "penguin": "\u{1F427}", | |
| 2306 | + "pensive": "\u{1F614}", | |
| 2307 | + "performing_arts": "\u{1F3AD}", | |
| 2308 | + "persevere": "\u{1F623}", | |
| 2309 | + "person_fencing": "\u{1F93A}", | |
| 2310 | + "pouting_woman": "\u{1F64E}", | |
| 2311 | + "phone": "\u260E\uFE0F", | |
| 2312 | + "pick": "\u26CF", | |
| 2313 | + "pig": "\u{1F437}", | |
| 2314 | + "pig2": "\u{1F416}", | |
| 2315 | + "pig_nose": "\u{1F43D}", | |
| 2316 | + "pill": "\u{1F48A}", | |
| 2317 | + "pineapple": "\u{1F34D}", | |
| 2318 | + "ping_pong": "\u{1F3D3}", | |
| 2319 | + "pisces": "\u2653\uFE0F", | |
| 2320 | + "pizza": "\u{1F355}", | |
| 2321 | + "place_of_worship": "\u{1F6D0}", | |
| 2322 | + "plate_with_cutlery": "\u{1F37D}", | |
| 2323 | + "play_or_pause_button": "\u23EF", | |
| 2324 | + "point_down": "\u{1F447}", | |
| 2325 | + "point_left": "\u{1F448}", | |
| 2326 | + "point_right": "\u{1F449}", | |
| 2327 | + "point_up": "\u261D\uFE0F", | |
| 2328 | + "point_up_2": "\u{1F446}", | |
| 2329 | + "police_car": "\u{1F693}", | |
| 2330 | + "policewoman": "\u{1F46E}‍\u2640\uFE0F", | |
| 2331 | + "poodle": "\u{1F429}", | |
| 2332 | + "popcorn": "\u{1F37F}", | |
| 2333 | + "post_office": "\u{1F3E3}", | |
| 2334 | + "postal_horn": "\u{1F4EF}", | |
| 2335 | + "postbox": "\u{1F4EE}", | |
| 2336 | + "potable_water": "\u{1F6B0}", | |
| 2337 | + "potato": "\u{1F954}", | |
| 2338 | + "pouch": "\u{1F45D}", | |
| 2339 | + "poultry_leg": "\u{1F357}", | |
| 2340 | + "pound": "\u{1F4B7}", | |
| 2341 | + "rage": "\u{1F621}", | |
| 2342 | + "pouting_cat": "\u{1F63E}", | |
| 2343 | + "pouting_man": "\u{1F64E}‍\u2642\uFE0F", | |
| 2344 | + "pray": "\u{1F64F}", | |
| 2345 | + "prayer_beads": "\u{1F4FF}", | |
| 2346 | + "pregnant_woman": "\u{1F930}", | |
| 2347 | + "previous_track_button": "\u23EE", | |
| 2348 | + "prince": "\u{1F934}", | |
| 2349 | + "princess": "\u{1F478}", | |
| 2350 | + "printer": "\u{1F5A8}", | |
| 2351 | + "purple_heart": "\u{1F49C}", | |
| 2352 | + "purse": "\u{1F45B}", | |
| 2353 | + "pushpin": "\u{1F4CC}", | |
| 2354 | + "put_litter_in_its_place": "\u{1F6AE}", | |
| 2355 | + "question": "\u2753", | |
| 2356 | + "rabbit": "\u{1F430}", | |
| 2357 | + "rabbit2": "\u{1F407}", | |
| 2358 | + "racehorse": "\u{1F40E}", | |
| 2359 | + "racing_car": "\u{1F3CE}", | |
| 2360 | + "radio": "\u{1F4FB}", | |
| 2361 | + "radio_button": "\u{1F518}", | |
| 2362 | + "radioactive": "\u2622\uFE0F", | |
| 2363 | + "railway_car": "\u{1F683}", | |
| 2364 | + "railway_track": "\u{1F6E4}", | |
| 2365 | + "rainbow": "\u{1F308}", | |
| 2366 | + "rainbow_flag": "\u{1F3F3}\uFE0F‍\u{1F308}", | |
| 2367 | + "raised_back_of_hand": "\u{1F91A}", | |
| 2368 | + "raised_hand_with_fingers_splayed": "\u{1F590}", | |
| 2369 | + "raised_hands": "\u{1F64C}", | |
| 2370 | + "raising_hand_woman": "\u{1F64B}", | |
| 2371 | + "raising_hand_man": "\u{1F64B}‍\u2642\uFE0F", | |
| 2372 | + "ram": "\u{1F40F}", | |
| 2373 | + "ramen": "\u{1F35C}", | |
| 2374 | + "rat": "\u{1F400}", | |
| 2375 | + "record_button": "\u23FA", | |
| 2376 | + "recycle": "\u267B\uFE0F", | |
| 2377 | + "red_circle": "\u{1F534}", | |
| 2378 | + "registered": "\xAE\uFE0F", | |
| 2379 | + "relaxed": "\u263A\uFE0F", | |
| 2380 | + "relieved": "\u{1F60C}", | |
| 2381 | + "reminder_ribbon": "\u{1F397}", | |
| 2382 | + "repeat": "\u{1F501}", | |
| 2383 | + "repeat_one": "\u{1F502}", | |
| 2384 | + "rescue_worker_helmet": "\u26D1", | |
| 2385 | + "restroom": "\u{1F6BB}", | |
| 2386 | + "revolving_hearts": "\u{1F49E}", | |
| 2387 | + "rewind": "\u23EA", | |
| 2388 | + "rhinoceros": "\u{1F98F}", | |
| 2389 | + "ribbon": "\u{1F380}", | |
| 2390 | + "rice": "\u{1F35A}", | |
| 2391 | + "rice_ball": "\u{1F359}", | |
| 2392 | + "rice_cracker": "\u{1F358}", | |
| 2393 | + "rice_scene": "\u{1F391}", | |
| 2394 | + "right_anger_bubble": "\u{1F5EF}", | |
| 2395 | + "ring": "\u{1F48D}", | |
| 2396 | + "robot": "\u{1F916}", | |
| 2397 | + "rocket": "\u{1F680}", | |
| 2398 | + "rofl": "\u{1F923}", | |
| 2399 | + "roll_eyes": "\u{1F644}", | |
| 2400 | + "roller_coaster": "\u{1F3A2}", | |
| 2401 | + "rooster": "\u{1F413}", | |
| 2402 | + "rose": "\u{1F339}", | |
| 2403 | + "rosette": "\u{1F3F5}", | |
| 2404 | + "rotating_light": "\u{1F6A8}", | |
| 2405 | + "round_pushpin": "\u{1F4CD}", | |
| 2406 | + "rowing_man": "\u{1F6A3}", | |
| 2407 | + "rowing_woman": "\u{1F6A3}‍\u2640\uFE0F", | |
| 2408 | + "rugby_football": "\u{1F3C9}", | |
| 2409 | + "running_man": "\u{1F3C3}", | |
| 2410 | + "running_shirt_with_sash": "\u{1F3BD}", | |
| 2411 | + "running_woman": "\u{1F3C3}‍\u2640\uFE0F", | |
| 2412 | + "sa": "\u{1F202}\uFE0F", | |
| 2413 | + "sagittarius": "\u2650\uFE0F", | |
| 2414 | + "sake": "\u{1F376}", | |
| 2415 | + "sandal": "\u{1F461}", | |
| 2416 | + "santa": "\u{1F385}", | |
| 2417 | + "satellite": "\u{1F4E1}", | |
| 2418 | + "saxophone": "\u{1F3B7}", | |
| 2419 | + "school": "\u{1F3EB}", | |
| 2420 | + "school_satchel": "\u{1F392}", | |
| 2421 | + "scissors": "\u2702\uFE0F", | |
| 2422 | + "scorpion": "\u{1F982}", | |
| 2423 | + "scorpius": "\u264F\uFE0F", | |
| 2424 | + "scream": "\u{1F631}", | |
| 2425 | + "scream_cat": "\u{1F640}", | |
| 2426 | + "scroll": "\u{1F4DC}", | |
| 2427 | + "seat": "\u{1F4BA}", | |
| 2428 | + "secret": "\u3299\uFE0F", | |
| 2429 | + "see_no_evil": "\u{1F648}", | |
| 2430 | + "seedling": "\u{1F331}", | |
| 2431 | + "selfie": "\u{1F933}", | |
| 2432 | + "shallow_pan_of_food": "\u{1F958}", | |
| 2433 | + "shamrock": "\u2618\uFE0F", | |
| 2434 | + "shark": "\u{1F988}", | |
| 2435 | + "shaved_ice": "\u{1F367}", | |
| 2436 | + "sheep": "\u{1F411}", | |
| 2437 | + "shell": "\u{1F41A}", | |
| 2438 | + "shield": "\u{1F6E1}", | |
| 2439 | + "shinto_shrine": "\u26E9", | |
| 2440 | + "ship": "\u{1F6A2}", | |
| 2441 | + "shirt": "\u{1F455}", | |
| 2442 | + "shopping": "\u{1F6CD}", | |
| 2443 | + "shopping_cart": "\u{1F6D2}", | |
| 2444 | + "shower": "\u{1F6BF}", | |
| 2445 | + "shrimp": "\u{1F990}", | |
| 2446 | + "signal_strength": "\u{1F4F6}", | |
| 2447 | + "six_pointed_star": "\u{1F52F}", | |
| 2448 | + "ski": "\u{1F3BF}", | |
| 2449 | + "skier": "\u26F7", | |
| 2450 | + "skull": "\u{1F480}", | |
| 2451 | + "skull_and_crossbones": "\u2620\uFE0F", | |
| 2452 | + "sleeping": "\u{1F634}", | |
| 2453 | + "sleeping_bed": "\u{1F6CC}", | |
| 2454 | + "sleepy": "\u{1F62A}", | |
| 2455 | + "slightly_frowning_face": "\u{1F641}", | |
| 2456 | + "slightly_smiling_face": "\u{1F642}", | |
| 2457 | + "slot_machine": "\u{1F3B0}", | |
| 2458 | + "small_airplane": "\u{1F6E9}", | |
| 2459 | + "small_blue_diamond": "\u{1F539}", | |
| 2460 | + "small_orange_diamond": "\u{1F538}", | |
| 2461 | + "small_red_triangle": "\u{1F53A}", | |
| 2462 | + "small_red_triangle_down": "\u{1F53B}", | |
| 2463 | + "smile": "\u{1F604}", | |
| 2464 | + "smile_cat": "\u{1F638}", | |
| 2465 | + "smiley": "\u{1F603}", | |
| 2466 | + "smiley_cat": "\u{1F63A}", | |
| 2467 | + "smiling_imp": "\u{1F608}", | |
| 2468 | + "smirk": "\u{1F60F}", | |
| 2469 | + "smirk_cat": "\u{1F63C}", | |
| 2470 | + "smoking": "\u{1F6AC}", | |
| 2471 | + "snail": "\u{1F40C}", | |
| 2472 | + "snake": "\u{1F40D}", | |
| 2473 | + "sneezing_face": "\u{1F927}", | |
| 2474 | + "snowboarder": "\u{1F3C2}", | |
| 2475 | + "snowflake": "\u2744\uFE0F", | |
| 2476 | + "snowman": "\u26C4\uFE0F", | |
| 2477 | + "snowman_with_snow": "\u2603\uFE0F", | |
| 2478 | + "sob": "\u{1F62D}", | |
| 2479 | + "soccer": "\u26BD\uFE0F", | |
| 2480 | + "soon": "\u{1F51C}", | |
| 2481 | + "sos": "\u{1F198}", | |
| 2482 | + "sound": "\u{1F509}", | |
| 2483 | + "space_invader": "\u{1F47E}", | |
| 2484 | + "spades": "\u2660\uFE0F", | |
| 2485 | + "spaghetti": "\u{1F35D}", | |
| 2486 | + "sparkle": "\u2747\uFE0F", | |
| 2487 | + "sparkler": "\u{1F387}", | |
| 2488 | + "sparkles": "\u2728", | |
| 2489 | + "sparkling_heart": "\u{1F496}", | |
| 2490 | + "speak_no_evil": "\u{1F64A}", | |
| 2491 | + "speaker": "\u{1F508}", | |
| 2492 | + "speaking_head": "\u{1F5E3}", | |
| 2493 | + "speech_balloon": "\u{1F4AC}", | |
| 2494 | + "speedboat": "\u{1F6A4}", | |
| 2495 | + "spider": "\u{1F577}", | |
| 2496 | + "spider_web": "\u{1F578}", | |
| 2497 | + "spiral_calendar": "\u{1F5D3}", | |
| 2498 | + "spiral_notepad": "\u{1F5D2}", | |
| 2499 | + "spoon": "\u{1F944}", | |
| 2500 | + "squid": "\u{1F991}", | |
| 2501 | + "stadium": "\u{1F3DF}", | |
| 2502 | + "star": "\u2B50\uFE0F", | |
| 2503 | + "star2": "\u{1F31F}", | |
| 2504 | + "star_and_crescent": "\u262A\uFE0F", | |
| 2505 | + "star_of_david": "\u2721\uFE0F", | |
| 2506 | + "stars": "\u{1F320}", | |
| 2507 | + "station": "\u{1F689}", | |
| 2508 | + "statue_of_liberty": "\u{1F5FD}", | |
| 2509 | + "steam_locomotive": "\u{1F682}", | |
| 2510 | + "stew": "\u{1F372}", | |
| 2511 | + "stop_button": "\u23F9", | |
| 2512 | + "stop_sign": "\u{1F6D1}", | |
| 2513 | + "stopwatch": "\u23F1", | |
| 2514 | + "straight_ruler": "\u{1F4CF}", | |
| 2515 | + "strawberry": "\u{1F353}", | |
| 2516 | + "stuck_out_tongue": "\u{1F61B}", | |
| 2517 | + "stuck_out_tongue_closed_eyes": "\u{1F61D}", | |
| 2518 | + "stuck_out_tongue_winking_eye": "\u{1F61C}", | |
| 2519 | + "studio_microphone": "\u{1F399}", | |
| 2520 | + "stuffed_flatbread": "\u{1F959}", | |
| 2521 | + "sun_behind_large_cloud": "\u{1F325}", | |
| 2522 | + "sun_behind_rain_cloud": "\u{1F326}", | |
| 2523 | + "sun_behind_small_cloud": "\u{1F324}", | |
| 2524 | + "sun_with_face": "\u{1F31E}", | |
| 2525 | + "sunflower": "\u{1F33B}", | |
| 2526 | + "sunglasses": "\u{1F60E}", | |
| 2527 | + "sunny": "\u2600\uFE0F", | |
| 2528 | + "sunrise": "\u{1F305}", | |
| 2529 | + "sunrise_over_mountains": "\u{1F304}", | |
| 2530 | + "surfing_man": "\u{1F3C4}", | |
| 2531 | + "surfing_woman": "\u{1F3C4}‍\u2640\uFE0F", | |
| 2532 | + "sushi": "\u{1F363}", | |
| 2533 | + "suspension_railway": "\u{1F69F}", | |
| 2534 | + "sweat": "\u{1F613}", | |
| 2535 | + "sweat_drops": "\u{1F4A6}", | |
| 2536 | + "sweat_smile": "\u{1F605}", | |
| 2537 | + "sweet_potato": "\u{1F360}", | |
| 2538 | + "swimming_man": "\u{1F3CA}", | |
| 2539 | + "swimming_woman": "\u{1F3CA}‍\u2640\uFE0F", | |
| 2540 | + "symbols": "\u{1F523}", | |
| 2541 | + "synagogue": "\u{1F54D}", | |
| 2542 | + "syringe": "\u{1F489}", | |
| 2543 | + "taco": "\u{1F32E}", | |
| 2544 | + "tada": "\u{1F389}", | |
| 2545 | + "tanabata_tree": "\u{1F38B}", | |
| 2546 | + "taurus": "\u2649\uFE0F", | |
| 2547 | + "taxi": "\u{1F695}", | |
| 2548 | + "tea": "\u{1F375}", | |
| 2549 | + "telephone_receiver": "\u{1F4DE}", | |
| 2550 | + "telescope": "\u{1F52D}", | |
| 2551 | + "tennis": "\u{1F3BE}", | |
| 2552 | + "tent": "\u26FA\uFE0F", | |
| 2553 | + "thermometer": "\u{1F321}", | |
| 2554 | + "thinking": "\u{1F914}", | |
| 2555 | + "thought_balloon": "\u{1F4AD}", | |
| 2556 | + "ticket": "\u{1F3AB}", | |
| 2557 | + "tickets": "\u{1F39F}", | |
| 2558 | + "tiger": "\u{1F42F}", | |
| 2559 | + "tiger2": "\u{1F405}", | |
| 2560 | + "timer_clock": "\u23F2", | |
| 2561 | + "tipping_hand_man": "\u{1F481}‍\u2642\uFE0F", | |
| 2562 | + "tired_face": "\u{1F62B}", | |
| 2563 | + "tm": "\u2122\uFE0F", | |
| 2564 | + "toilet": "\u{1F6BD}", | |
| 2565 | + "tokyo_tower": "\u{1F5FC}", | |
| 2566 | + "tomato": "\u{1F345}", | |
| 2567 | + "tongue": "\u{1F445}", | |
| 2568 | + "top": "\u{1F51D}", | |
| 2569 | + "tophat": "\u{1F3A9}", | |
| 2570 | + "tornado": "\u{1F32A}", | |
| 2571 | + "trackball": "\u{1F5B2}", | |
| 2572 | + "tractor": "\u{1F69C}", | |
| 2573 | + "traffic_light": "\u{1F6A5}", | |
| 2574 | + "train": "\u{1F68B}", | |
| 2575 | + "train2": "\u{1F686}", | |
| 2576 | + "tram": "\u{1F68A}", | |
| 2577 | + "triangular_flag_on_post": "\u{1F6A9}", | |
| 2578 | + "triangular_ruler": "\u{1F4D0}", | |
| 2579 | + "trident": "\u{1F531}", | |
| 2580 | + "triumph": "\u{1F624}", | |
| 2581 | + "trolleybus": "\u{1F68E}", | |
| 2582 | + "trophy": "\u{1F3C6}", | |
| 2583 | + "tropical_drink": "\u{1F379}", | |
| 2584 | + "tropical_fish": "\u{1F420}", | |
| 2585 | + "truck": "\u{1F69A}", | |
| 2586 | + "trumpet": "\u{1F3BA}", | |
| 2587 | + "tulip": "\u{1F337}", | |
| 2588 | + "tumbler_glass": "\u{1F943}", | |
| 2589 | + "turkey": "\u{1F983}", | |
| 2590 | + "turtle": "\u{1F422}", | |
| 2591 | + "tv": "\u{1F4FA}", | |
| 2592 | + "twisted_rightwards_arrows": "\u{1F500}", | |
| 2593 | + "two_hearts": "\u{1F495}", | |
| 2594 | + "two_men_holding_hands": "\u{1F46C}", | |
| 2595 | + "two_women_holding_hands": "\u{1F46D}", | |
| 2596 | + "u5272": "\u{1F239}", | |
| 2597 | + "u5408": "\u{1F234}", | |
| 2598 | + "u55b6": "\u{1F23A}", | |
| 2599 | + "u6307": "\u{1F22F}\uFE0F", | |
| 2600 | + "u6708": "\u{1F237}\uFE0F", | |
| 2601 | + "u6709": "\u{1F236}", | |
| 2602 | + "u6e80": "\u{1F235}", | |
| 2603 | + "u7121": "\u{1F21A}\uFE0F", | |
| 2604 | + "u7533": "\u{1F238}", | |
| 2605 | + "u7981": "\u{1F232}", | |
| 2606 | + "u7a7a": "\u{1F233}", | |
| 2607 | + "umbrella": "\u2614\uFE0F", | |
| 2608 | + "unamused": "\u{1F612}", | |
| 2609 | + "underage": "\u{1F51E}", | |
| 2610 | + "unicorn": "\u{1F984}", | |
| 2611 | + "unlock": "\u{1F513}", | |
| 2612 | + "up": "\u{1F199}", | |
| 2613 | + "upside_down_face": "\u{1F643}", | |
| 2614 | + "v": "\u270C\uFE0F", | |
| 2615 | + "vertical_traffic_light": "\u{1F6A6}", | |
| 2616 | + "vhs": "\u{1F4FC}", | |
| 2617 | + "vibration_mode": "\u{1F4F3}", | |
| 2618 | + "video_camera": "\u{1F4F9}", | |
| 2619 | + "video_game": "\u{1F3AE}", | |
| 2620 | + "violin": "\u{1F3BB}", | |
| 2621 | + "virgo": "\u264D\uFE0F", | |
| 2622 | + "volcano": "\u{1F30B}", | |
| 2623 | + "volleyball": "\u{1F3D0}", | |
| 2624 | + "vs": "\u{1F19A}", | |
| 2625 | + "vulcan_salute": "\u{1F596}", | |
| 2626 | + "walking_man": "\u{1F6B6}", | |
| 2627 | + "walking_woman": "\u{1F6B6}‍\u2640\uFE0F", | |
| 2628 | + "waning_crescent_moon": "\u{1F318}", | |
| 2629 | + "waning_gibbous_moon": "\u{1F316}", | |
| 2630 | + "warning": "\u26A0\uFE0F", | |
| 2631 | + "wastebasket": "\u{1F5D1}", | |
| 2632 | + "watch": "\u231A\uFE0F", | |
| 2633 | + "water_buffalo": "\u{1F403}", | |
| 2634 | + "watermelon": "\u{1F349}", | |
| 2635 | + "wave": "\u{1F44B}", | |
| 2636 | + "wavy_dash": "\u3030\uFE0F", | |
| 2637 | + "waxing_crescent_moon": "\u{1F312}", | |
| 2638 | + "wc": "\u{1F6BE}", | |
| 2639 | + "weary": "\u{1F629}", | |
| 2640 | + "wedding": "\u{1F492}", | |
| 2641 | + "weight_lifting_man": "\u{1F3CB}\uFE0F", | |
| 2642 | + "weight_lifting_woman": "\u{1F3CB}\uFE0F‍\u2640\uFE0F", | |
| 2643 | + "whale": "\u{1F433}", | |
| 2644 | + "whale2": "\u{1F40B}", | |
| 2645 | + "wheel_of_dharma": "\u2638\uFE0F", | |
| 2646 | + "wheelchair": "\u267F\uFE0F", | |
| 2647 | + "white_check_mark": "\u2705", | |
| 2648 | + "white_circle": "\u26AA\uFE0F", | |
| 2649 | + "white_flag": "\u{1F3F3}\uFE0F", | |
| 2650 | + "white_flower": "\u{1F4AE}", | |
| 2651 | + "white_large_square": "\u2B1C\uFE0F", | |
| 2652 | + "white_medium_small_square": "\u25FD\uFE0F", | |
| 2653 | + "white_medium_square": "\u25FB\uFE0F", | |
| 2654 | + "white_small_square": "\u25AB\uFE0F", | |
| 2655 | + "white_square_button": "\u{1F533}", | |
| 2656 | + "wilted_flower": "\u{1F940}", | |
| 2657 | + "wind_chime": "\u{1F390}", | |
| 2658 | + "wind_face": "\u{1F32C}", | |
| 2659 | + "wine_glass": "\u{1F377}", | |
| 2660 | + "wink": "\u{1F609}", | |
| 2661 | + "wolf": "\u{1F43A}", | |
| 2662 | + "woman": "\u{1F469}", | |
| 2663 | + "woman_artist": "\u{1F469}‍\u{1F3A8}", | |
| 2664 | + "woman_astronaut": "\u{1F469}‍\u{1F680}", | |
| 2665 | + "woman_cartwheeling": "\u{1F938}‍\u2640\uFE0F", | |
| 2666 | + "woman_cook": "\u{1F469}‍\u{1F373}", | |
| 2667 | + "woman_facepalming": "\u{1F926}‍\u2640\uFE0F", | |
| 2668 | + "woman_factory_worker": "\u{1F469}‍\u{1F3ED}", | |
| 2669 | + "woman_farmer": "\u{1F469}‍\u{1F33E}", | |
| 2670 | + "woman_firefighter": "\u{1F469}‍\u{1F692}", | |
| 2671 | + "woman_health_worker": "\u{1F469}‍\u2695\uFE0F", | |
| 2672 | + "woman_judge": "\u{1F469}‍\u2696\uFE0F", | |
| 2673 | + "woman_juggling": "\u{1F939}‍\u2640\uFE0F", | |
| 2674 | + "woman_mechanic": "\u{1F469}‍\u{1F527}", | |
| 2675 | + "woman_office_worker": "\u{1F469}‍\u{1F4BC}", | |
| 2676 | + "woman_pilot": "\u{1F469}‍\u2708\uFE0F", | |
| 2677 | + "woman_playing_handball": "\u{1F93E}‍\u2640\uFE0F", | |
| 2678 | + "woman_playing_water_polo": "\u{1F93D}‍\u2640\uFE0F", | |
| 2679 | + "woman_scientist": "\u{1F469}‍\u{1F52C}", | |
| 2680 | + "woman_shrugging": "\u{1F937}‍\u2640\uFE0F", | |
| 2681 | + "woman_singer": "\u{1F469}‍\u{1F3A4}", | |
| 2682 | + "woman_student": "\u{1F469}‍\u{1F393}", | |
| 2683 | + "woman_teacher": "\u{1F469}‍\u{1F3EB}", | |
| 2684 | + "woman_technologist": "\u{1F469}‍\u{1F4BB}", | |
| 2685 | + "woman_with_turban": "\u{1F473}‍\u2640\uFE0F", | |
| 2686 | + "womans_clothes": "\u{1F45A}", | |
| 2687 | + "womans_hat": "\u{1F452}", | |
| 2688 | + "women_wrestling": "\u{1F93C}‍\u2640\uFE0F", | |
| 2689 | + "womens": "\u{1F6BA}", | |
| 2690 | + "world_map": "\u{1F5FA}", | |
| 2691 | + "worried": "\u{1F61F}", | |
| 2692 | + "wrench": "\u{1F527}", | |
| 2693 | + "writing_hand": "\u270D\uFE0F", | |
| 2694 | + "x": "\u274C", | |
| 2695 | + "yellow_heart": "\u{1F49B}", | |
| 2696 | + "yen": "\u{1F4B4}", | |
| 2697 | + "yin_yang": "\u262F\uFE0F", | |
| 2698 | + "yum": "\u{1F60B}", | |
| 2699 | + "zap": "\u26A1\uFE0F", | |
| 2700 | + "zipper_mouth_face": "\u{1F910}", | |
| 2701 | + "zzz": "\u{1F4A4}", | |
| 2702 | + /* special emojis :P */ | |
| 2703 | + "octocat": '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">', | |
| 2704 | + "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>` | |
| 2705 | + }; | |
| 2706 | + showdown2.Converter = function(converterOptions) { | |
| 2707 | + "use strict"; | |
| 2708 | + var options = {}, langExtensions = [], outputModifiers = [], listeners = {}, setConvFlavor = setFlavor, metadata = { | |
| 2709 | + parsed: {}, | |
| 2710 | + raw: "", | |
| 2711 | + format: "" | |
| 2712 | + }; | |
| 2713 | + _constructor(); | |
| 2714 | + function _constructor() { | |
| 2715 | + converterOptions = converterOptions || {}; | |
| 2716 | + for (var gOpt in globalOptions) { | |
| 2717 | + if (globalOptions.hasOwnProperty(gOpt)) { | |
| 2718 | + options[gOpt] = globalOptions[gOpt]; | |
| 2719 | + } | |
| 2720 | + } | |
| 2721 | + if (typeof converterOptions === "object") { | |
| 2722 | + for (var opt in converterOptions) { | |
| 2723 | + if (converterOptions.hasOwnProperty(opt)) { | |
| 2724 | + options[opt] = converterOptions[opt]; | |
| 2725 | + } | |
| 2726 | + } | |
| 2727 | + } else { | |
| 2728 | + throw Error("Converter expects the passed parameter to be an object, but " + typeof converterOptions + " was passed instead."); | |
| 2729 | + } | |
| 2730 | + if (options.extensions) { | |
| 2731 | + showdown2.helper.forEach(options.extensions, _parseExtension); | |
| 2732 | + } | |
| 2733 | + } | |
| 2734 | + function _parseExtension(ext, name) { | |
| 2735 | + name = name || null; | |
| 2736 | + if (showdown2.helper.isString(ext)) { | |
| 2737 | + ext = showdown2.helper.stdExtName(ext); | |
| 2738 | + name = ext; | |
| 2739 | + if (showdown2.extensions[ext]) { | |
| 2740 | + 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!"); | |
| 2741 | + legacyExtensionLoading(showdown2.extensions[ext], ext); | |
| 2742 | + return; | |
| 2743 | + } else if (!showdown2.helper.isUndefined(extensions[ext])) { | |
| 2744 | + ext = extensions[ext]; | |
| 2745 | + } else { | |
| 2746 | + throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.'); | |
| 2747 | + } | |
| 2748 | + } | |
| 2749 | + if (typeof ext === "function") { | |
| 2750 | + ext = ext(); | |
| 2751 | + } | |
| 2752 | + if (!showdown2.helper.isArray(ext)) { | |
| 2753 | + ext = [ext]; | |
| 2754 | + } | |
| 2755 | + var validExt = validate(ext, name); | |
| 2756 | + if (!validExt.valid) { | |
| 2757 | + throw Error(validExt.error); | |
| 2758 | + } | |
| 2759 | + for (var i2 = 0; i2 < ext.length; ++i2) { | |
| 2760 | + switch (ext[i2].type) { | |
| 2761 | + case "lang": | |
| 2762 | + langExtensions.push(ext[i2]); | |
| 2763 | + break; | |
| 2764 | + case "output": | |
| 2765 | + outputModifiers.push(ext[i2]); | |
| 2766 | + break; | |
| 2767 | + } | |
| 2768 | + if (ext[i2].hasOwnProperty("listeners")) { | |
| 2769 | + for (var ln in ext[i2].listeners) { | |
| 2770 | + if (ext[i2].listeners.hasOwnProperty(ln)) { | |
| 2771 | + listen(ln, ext[i2].listeners[ln]); | |
| 2772 | + } | |
| 2773 | + } | |
| 2774 | + } | |
| 2775 | + } | |
| 2776 | + } | |
| 2777 | + function legacyExtensionLoading(ext, name) { | |
| 2778 | + if (typeof ext === "function") { | |
| 2779 | + ext = ext(new showdown2.Converter()); | |
| 2780 | + } | |
| 2781 | + if (!showdown2.helper.isArray(ext)) { | |
| 2782 | + ext = [ext]; | |
| 2783 | + } | |
| 2784 | + var valid = validate(ext, name); | |
| 2785 | + if (!valid.valid) { | |
| 2786 | + throw Error(valid.error); | |
| 2787 | + } | |
| 2788 | + for (var i2 = 0; i2 < ext.length; ++i2) { | |
| 2789 | + switch (ext[i2].type) { | |
| 2790 | + case "lang": | |
| 2791 | + langExtensions.push(ext[i2]); | |
| 2792 | + break; | |
| 2793 | + case "output": | |
| 2794 | + outputModifiers.push(ext[i2]); | |
| 2795 | + break; | |
| 2796 | + default: | |
| 2797 | + throw Error("Extension loader error: Type unrecognized!!!"); | |
| 2798 | + } | |
| 2799 | + } | |
| 2800 | + } | |
| 2801 | + function listen(name, callback) { | |
| 2802 | + if (!showdown2.helper.isString(name)) { | |
| 2803 | + throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof name + " given"); | |
| 2804 | + } | |
| 2805 | + if (typeof callback !== "function") { | |
| 2806 | + throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof callback + " given"); | |
| 2807 | + } | |
| 2808 | + if (!listeners.hasOwnProperty(name)) { | |
| 2809 | + listeners[name] = []; | |
| 2810 | + } | |
| 2811 | + listeners[name].push(callback); | |
| 2812 | + } | |
| 2813 | + function rTrimInputText(text2) { | |
| 2814 | + var rsp = text2.match(/^\s*/)[0].length, rgx = new RegExp("^\\s{0," + rsp + "}", "gm"); | |
| 2815 | + return text2.replace(rgx, ""); | |
| 2816 | + } | |
| 2817 | + this._dispatch = function dispatch3(evtName, text2, options2, globals) { | |
| 2818 | + if (listeners.hasOwnProperty(evtName)) { | |
| 2819 | + for (var ei = 0; ei < listeners[evtName].length; ++ei) { | |
| 2820 | + var nText = listeners[evtName][ei](evtName, text2, this, options2, globals); | |
| 2821 | + if (nText && typeof nText !== "undefined") { | |
| 2822 | + text2 = nText; | |
| 2823 | + } | |
| 2824 | + } | |
| 2825 | + } | |
| 2826 | + return text2; | |
| 2827 | + }; | |
| 2828 | + this.listen = function(name, callback) { | |
| 2829 | + listen(name, callback); | |
| 2830 | + return this; | |
| 2831 | + }; | |
| 2832 | + this.makeHtml = function(text2) { | |
| 2833 | + if (!text2) { | |
| 2834 | + return text2; | |
| 2835 | + } | |
| 2836 | + var globals = { | |
| 2837 | + gHtmlBlocks: [], | |
| 2838 | + gHtmlMdBlocks: [], | |
| 2839 | + gHtmlSpans: [], | |
| 2840 | + gUrls: {}, | |
| 2841 | + gTitles: {}, | |
| 2842 | + gDimensions: {}, | |
| 2843 | + gListLevel: 0, | |
| 2844 | + hashLinkCounts: {}, | |
| 2845 | + langExtensions, | |
| 2846 | + outputModifiers, | |
| 2847 | + converter: this, | |
| 2848 | + ghCodeBlocks: [], | |
| 2849 | + metadata: { | |
| 2850 | + parsed: {}, | |
| 2851 | + raw: "", | |
| 2852 | + format: "" | |
| 2853 | + } | |
| 2854 | + }; | |
| 2855 | + text2 = text2.replace(/¨/g, "\xA8T"); | |
| 2856 | + text2 = text2.replace(/\$/g, "\xA8D"); | |
| 2857 | + text2 = text2.replace(/\r\n/g, "\n"); | |
| 2858 | + text2 = text2.replace(/\r/g, "\n"); | |
| 2859 | + text2 = text2.replace(/\u00A0/g, " "); | |
| 2860 | + if (options.smartIndentationFix) { | |
| 2861 | + text2 = rTrimInputText(text2); | |
| 2862 | + } | |
| 2863 | + text2 = "\n\n" + text2 + "\n\n"; | |
| 2864 | + text2 = showdown2.subParser("detab")(text2, options, globals); | |
| 2865 | + text2 = text2.replace(/^[ \t]+$/mg, ""); | |
| 2866 | + showdown2.helper.forEach(langExtensions, function(ext) { | |
| 2867 | + text2 = showdown2.subParser("runExtension")(ext, text2, options, globals); | |
| 2868 | + }); | |
| 2869 | + text2 = showdown2.subParser("metadata")(text2, options, globals); | |
| 2870 | + text2 = showdown2.subParser("hashPreCodeTags")(text2, options, globals); | |
| 2871 | + text2 = showdown2.subParser("githubCodeBlocks")(text2, options, globals); | |
| 2872 | + text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals); | |
| 2873 | + text2 = showdown2.subParser("hashCodeTags")(text2, options, globals); | |
| 2874 | + text2 = showdown2.subParser("stripLinkDefinitions")(text2, options, globals); | |
| 2875 | + text2 = showdown2.subParser("blockGamut")(text2, options, globals); | |
| 2876 | + text2 = showdown2.subParser("unhashHTMLSpans")(text2, options, globals); | |
| 2877 | + text2 = showdown2.subParser("unescapeSpecialChars")(text2, options, globals); | |
| 2878 | + text2 = text2.replace(/¨D/g, "$$"); | |
| 2879 | + text2 = text2.replace(/¨T/g, "\xA8"); | |
| 2880 | + text2 = showdown2.subParser("completeHTMLDocument")(text2, options, globals); | |
| 2881 | + showdown2.helper.forEach(outputModifiers, function(ext) { | |
| 2882 | + text2 = showdown2.subParser("runExtension")(ext, text2, options, globals); | |
| 2883 | + }); | |
| 2884 | + metadata = globals.metadata; | |
| 2885 | + return text2; | |
| 2886 | + }; | |
| 2887 | + this.makeMarkdown = this.makeMd = function(src, HTMLParser) { | |
| 2888 | + src = src.replace(/\r\n/g, "\n"); | |
| 2889 | + src = src.replace(/\r/g, "\n"); | |
| 2890 | + src = src.replace(/>[ \t]+</, ">\xA8NBSP;<"); | |
| 2891 | + if (!HTMLParser) { | |
| 2892 | + if (window && window.document) { | |
| 2893 | + HTMLParser = window.document; | |
| 2894 | + } else { | |
| 2895 | + 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"); | |
| 2896 | + } | |
| 2897 | + } | |
| 2898 | + var doc = HTMLParser.createElement("div"); | |
| 2899 | + doc.innerHTML = src; | |
| 2900 | + var globals = { | |
| 2901 | + preList: substitutePreCodeTags(doc) | |
| 2902 | + }; | |
| 2903 | + clean(doc); | |
| 2904 | + var nodes = doc.childNodes, mdDoc = ""; | |
| 2905 | + for (var i2 = 0; i2 < nodes.length; i2++) { | |
| 2906 | + mdDoc += showdown2.subParser("makeMarkdown.node")(nodes[i2], globals); | |
| 2907 | + } | |
| 2908 | + function clean(node) { | |
| 2909 | + for (var n2 = 0; n2 < node.childNodes.length; ++n2) { | |
| 2910 | + var child = node.childNodes[n2]; | |
| 2911 | + if (child.nodeType === 3) { | |
| 2912 | + if (!/\S/.test(child.nodeValue)) { | |
| 2913 | + node.removeChild(child); | |
| 2914 | + --n2; | |
| 2915 | + } else { | |
| 2916 | + child.nodeValue = child.nodeValue.split("\n").join(" "); | |
| 2917 | + child.nodeValue = child.nodeValue.replace(/(\s)+/g, "$1"); | |
| 2918 | + } | |
| 2919 | + } else if (child.nodeType === 1) { | |
| 2920 | + clean(child); | |
| 2921 | + } | |
| 2922 | + } | |
| 2923 | + } | |
| 2924 | + function substitutePreCodeTags(doc2) { | |
| 2925 | + var pres = doc2.querySelectorAll("pre"), presPH = []; | |
| 2926 | + for (var i3 = 0; i3 < pres.length; ++i3) { | |
| 2927 | + if (pres[i3].childElementCount === 1 && pres[i3].firstChild.tagName.toLowerCase() === "code") { | |
| 2928 | + var content = pres[i3].firstChild.innerHTML.trim(), language = pres[i3].firstChild.getAttribute("data-language") || ""; | |
| 2929 | + if (language === "") { | |
| 2930 | + var classes = pres[i3].firstChild.className.split(" "); | |
| 2931 | + for (var c2 = 0; c2 < classes.length; ++c2) { | |
| 2932 | + var matches = classes[c2].match(/^language-(.+)$/); | |
| 2933 | + if (matches !== null) { | |
| 2934 | + language = matches[1]; | |
| 2935 | + break; | |
| 2936 | + } | |
| 2937 | + } | |
| 2938 | + } | |
| 2939 | + content = showdown2.helper.unescapeHTMLEntities(content); | |
| 2940 | + presPH.push(content); | |
| 2941 | + pres[i3].outerHTML = '<precode language="' + language + '" precodenum="' + i3.toString() + '"></precode>'; | |
| 2942 | + } else { | |
| 2943 | + presPH.push(pres[i3].innerHTML); | |
| 2944 | + pres[i3].innerHTML = ""; | |
| 2945 | + pres[i3].setAttribute("prenum", i3.toString()); | |
| 2946 | + } | |
| 2947 | + } | |
| 2948 | + return presPH; | |
| 2949 | + } | |
| 2950 | + return mdDoc; | |
| 2951 | + }; | |
| 2952 | + this.setOption = function(key, value) { | |
| 2953 | + options[key] = value; | |
| 2954 | + }; | |
| 2955 | + this.getOption = function(key) { | |
| 2956 | + return options[key]; | |
| 2957 | + }; | |
| 2958 | + this.getOptions = function() { | |
| 2959 | + return options; | |
| 2960 | + }; | |
| 2961 | + this.addExtension = function(extension, name) { | |
| 2962 | + name = name || null; | |
| 2963 | + _parseExtension(extension, name); | |
| 2964 | + }; | |
| 2965 | + this.useExtension = function(extensionName) { | |
| 2966 | + _parseExtension(extensionName); | |
| 2967 | + }; | |
| 2968 | + this.setFlavor = function(name) { | |
| 2969 | + if (!flavor.hasOwnProperty(name)) { | |
| 2970 | + throw Error(name + " flavor was not found"); | |
| 2971 | + } | |
| 2972 | + var preset = flavor[name]; | |
| 2973 | + setConvFlavor = name; | |
| 2974 | + for (var option in preset) { | |
| 2975 | + if (preset.hasOwnProperty(option)) { | |
| 2976 | + options[option] = preset[option]; | |
| 2977 | + } | |
| 2978 | + } | |
| 2979 | + }; | |
| 2980 | + this.getFlavor = function() { | |
| 2981 | + return setConvFlavor; | |
| 2982 | + }; | |
| 2983 | + this.removeExtension = function(extension) { | |
| 2984 | + if (!showdown2.helper.isArray(extension)) { | |
| 2985 | + extension = [extension]; | |
| 2986 | + } | |
| 2987 | + for (var a2 = 0; a2 < extension.length; ++a2) { | |
| 2988 | + var ext = extension[a2]; | |
| 2989 | + for (var i2 = 0; i2 < langExtensions.length; ++i2) { | |
| 2990 | + if (langExtensions[i2] === ext) { | |
| 2991 | + langExtensions[i2].splice(i2, 1); | |
| 2992 | + } | |
| 2993 | + } | |
| 2994 | + for (var ii = 0; ii < outputModifiers.length; ++i2) { | |
| 2995 | + if (outputModifiers[ii] === ext) { | |
| 2996 | + outputModifiers[ii].splice(i2, 1); | |
| 2997 | + } | |
| 2998 | + } | |
| 2999 | + } | |
| 3000 | + }; | |
| 3001 | + this.getAllExtensions = function() { | |
| 3002 | + return { | |
| 3003 | + language: langExtensions, | |
| 3004 | + output: outputModifiers | |
| 3005 | + }; | |
| 3006 | + }; | |
| 3007 | + this.getMetadata = function(raw) { | |
| 3008 | + if (raw) { | |
| 3009 | + return metadata.raw; | |
| 3010 | + } else { | |
| 3011 | + return metadata.parsed; | |
| 3012 | + } | |
| 3013 | + }; | |
| 3014 | + this.getMetadataFormat = function() { | |
| 3015 | + return metadata.format; | |
| 3016 | + }; | |
| 3017 | + this._setMetadataPair = function(key, value) { | |
| 3018 | + metadata.parsed[key] = value; | |
| 3019 | + }; | |
| 3020 | + this._setMetadataFormat = function(format) { | |
| 3021 | + metadata.format = format; | |
| 3022 | + }; | |
| 3023 | + this._setMetadataRaw = function(raw) { | |
| 3024 | + metadata.raw = raw; | |
| 3025 | + }; | |
| 3026 | + }; | |
| 3027 | + showdown2.subParser("anchors", function(text2, options, globals) { | |
| 3028 | + "use strict"; | |
| 3029 | + text2 = globals.converter._dispatch("anchors.before", text2, options, globals); | |
| 3030 | + var writeAnchorTag = function(wholeMatch, linkText, linkId, url, m5, m6, title) { | |
| 3031 | + if (showdown2.helper.isUndefined(title)) { | |
| 3032 | + title = ""; | |
| 3033 | + } | |
| 3034 | + linkId = linkId.toLowerCase(); | |
| 3035 | + if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) { | |
| 3036 | + url = ""; | |
| 3037 | + } else if (!url) { | |
| 3038 | + if (!linkId) { | |
| 3039 | + linkId = linkText.toLowerCase().replace(/ ?\n/g, " "); | |
| 3040 | + } | |
| 3041 | + url = "#" + linkId; | |
| 3042 | + if (!showdown2.helper.isUndefined(globals.gUrls[linkId])) { | |
| 3043 | + url = globals.gUrls[linkId]; | |
| 3044 | + if (!showdown2.helper.isUndefined(globals.gTitles[linkId])) { | |
| 3045 | + title = globals.gTitles[linkId]; | |
| 3046 | + } | |
| 3047 | + } else { | |
| 3048 | + return wholeMatch; | |
| 3049 | + } | |
| 3050 | + } | |
| 3051 | + url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); | |
| 3052 | + var result = '<a href="' + url + '"'; | |
| 3053 | + if (title !== "" && title !== null) { | |
| 3054 | + title = title.replace(/"/g, """); | |
| 3055 | + title = title.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); | |
| 3056 | + result += ' title="' + title + '"'; | |
| 3057 | + } | |
| 3058 | + if (options.openLinksInNewWindow && !/^#/.test(url)) { | |
| 3059 | + result += ' rel="noopener noreferrer" target="\xA8E95Eblank"'; | |
| 3060 | + } | |
| 3061 | + result += ">" + linkText + "</a>"; | |
| 3062 | + return result; | |
| 3063 | + }; | |
| 3064 | + text2 = text2.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag); | |
| 3065 | + text2 = text2.replace( | |
| 3066 | + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, | |
| 3067 | + writeAnchorTag | |
| 3068 | + ); | |
| 3069 | + text2 = text2.replace( | |
| 3070 | + /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, | |
| 3071 | + writeAnchorTag | |
| 3072 | + ); | |
| 3073 | + text2 = text2.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag); | |
| 3074 | + if (options.ghMentions) { | |
| 3075 | + text2 = text2.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(wm, st, escape, mentions, username) { | |
| 3076 | + if (escape === "\\") { | |
| 3077 | + return st + mentions; | |
| 3078 | + } | |
| 3079 | + if (!showdown2.helper.isString(options.ghMentionsLink)) { | |
| 3080 | + throw new Error("ghMentionsLink option must be a string"); | |
| 3081 | + } | |
| 3082 | + var lnk = options.ghMentionsLink.replace(/\{u}/g, username), target = ""; | |
| 3083 | + if (options.openLinksInNewWindow) { | |
| 3084 | + target = ' rel="noopener noreferrer" target="\xA8E95Eblank"'; | |
| 3085 | + } | |
| 3086 | + return st + '<a href="' + lnk + '"' + target + ">" + mentions + "</a>"; | |
| 3087 | + }); | |
| 3088 | + } | |
| 3089 | + text2 = globals.converter._dispatch("anchors.after", text2, options, globals); | |
| 3090 | + return text2; | |
| 3091 | + }); | |
| 3092 | + 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) { | |
| 3093 | + "use strict"; | |
| 3094 | + return function(wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) { | |
| 3095 | + link = link.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); | |
| 3096 | + var lnkTxt = link, append = "", target = "", lmc = leadingMagicChars || "", tmc = trailingMagicChars || ""; | |
| 3097 | + if (/^www\./i.test(link)) { | |
| 3098 | + link = link.replace(/^www\./i, "http://www."); | |
| 3099 | + } | |
| 3100 | + if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) { | |
| 3101 | + append = trailingPunctuation; | |
| 3102 | + } | |
| 3103 | + if (options.openLinksInNewWindow) { | |
| 3104 | + target = ' rel="noopener noreferrer" target="\xA8E95Eblank"'; | |
| 3105 | + } | |
| 3106 | + return lmc + '<a href="' + link + '"' + target + ">" + lnkTxt + "</a>" + append + tmc; | |
| 3107 | + }; | |
| 3108 | + }, replaceMail = function(options, globals) { | |
| 3109 | + "use strict"; | |
| 3110 | + return function(wholeMatch, b2, mail) { | |
| 3111 | + var href = "mailto:"; | |
| 3112 | + b2 = b2 || ""; | |
| 3113 | + mail = showdown2.subParser("unescapeSpecialChars")(mail, options, globals); | |
| 3114 | + if (options.encodeEmails) { | |
| 3115 | + href = showdown2.helper.encodeEmailAddress(href + mail); | |
| 3116 | + mail = showdown2.helper.encodeEmailAddress(mail); | |
| 3117 | + } else { | |
| 3118 | + href = href + mail; | |
| 3119 | + } | |
| 3120 | + return b2 + '<a href="' + href + '">' + mail + "</a>"; | |
| 3121 | + }; | |
| 3122 | + }; | |
| 3123 | + showdown2.subParser("autoLinks", function(text2, options, globals) { | |
| 3124 | + "use strict"; | |
| 3125 | + text2 = globals.converter._dispatch("autoLinks.before", text2, options, globals); | |
| 3126 | + text2 = text2.replace(delimUrlRegex, replaceLink(options)); | |
| 3127 | + text2 = text2.replace(delimMailRegex, replaceMail(options, globals)); | |
| 3128 | + text2 = globals.converter._dispatch("autoLinks.after", text2, options, globals); | |
| 3129 | + return text2; | |
| 3130 | + }); | |
| 3131 | + showdown2.subParser("simplifiedAutoLinks", function(text2, options, globals) { | |
| 3132 | + "use strict"; | |
| 3133 | + if (!options.simplifiedAutoLink) { | |
| 3134 | + return text2; | |
| 3135 | + } | |
| 3136 | + text2 = globals.converter._dispatch("simplifiedAutoLinks.before", text2, options, globals); | |
| 3137 | + if (options.excludeTrailingPunctuationFromURLs) { | |
| 3138 | + text2 = text2.replace(simpleURLRegex2, replaceLink(options)); | |
| 3139 | + } else { | |
| 3140 | + text2 = text2.replace(simpleURLRegex, replaceLink(options)); | |
| 3141 | + } | |
| 3142 | + text2 = text2.replace(simpleMailRegex, replaceMail(options, globals)); | |
| 3143 | + text2 = globals.converter._dispatch("simplifiedAutoLinks.after", text2, options, globals); | |
| 3144 | + return text2; | |
| 3145 | + }); | |
| 3146 | + showdown2.subParser("blockGamut", function(text2, options, globals) { | |
| 3147 | + "use strict"; | |
| 3148 | + text2 = globals.converter._dispatch("blockGamut.before", text2, options, globals); | |
| 3149 | + text2 = showdown2.subParser("blockQuotes")(text2, options, globals); | |
| 3150 | + text2 = showdown2.subParser("headers")(text2, options, globals); | |
| 3151 | + text2 = showdown2.subParser("horizontalRule")(text2, options, globals); | |
| 3152 | + text2 = showdown2.subParser("lists")(text2, options, globals); | |
| 3153 | + text2 = showdown2.subParser("codeBlocks")(text2, options, globals); | |
| 3154 | + text2 = showdown2.subParser("tables")(text2, options, globals); | |
| 3155 | + text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals); | |
| 3156 | + text2 = showdown2.subParser("paragraphs")(text2, options, globals); | |
| 3157 | + text2 = globals.converter._dispatch("blockGamut.after", text2, options, globals); | |
| 3158 | + return text2; | |
| 3159 | + }); | |
| 3160 | + showdown2.subParser("blockQuotes", function(text2, options, globals) { | |
| 3161 | + "use strict"; | |
| 3162 | + text2 = globals.converter._dispatch("blockQuotes.before", text2, options, globals); | |
| 3163 | + text2 = text2 + "\n\n"; | |
| 3164 | + var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; | |
| 3165 | + if (options.splitAdjacentBlockquotes) { | |
| 3166 | + rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm; | |
| 3167 | + } | |
| 3168 | + text2 = text2.replace(rgx, function(bq) { | |
| 3169 | + bq = bq.replace(/^[ \t]*>[ \t]?/gm, ""); | |
| 3170 | + bq = bq.replace(/¨0/g, ""); | |
| 3171 | + bq = bq.replace(/^[ \t]+$/gm, ""); | |
| 3172 | + bq = showdown2.subParser("githubCodeBlocks")(bq, options, globals); | |
| 3173 | + bq = showdown2.subParser("blockGamut")(bq, options, globals); | |
| 3174 | + bq = bq.replace(/(^|\n)/g, "$1 "); | |
| 3175 | + bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function(wholeMatch, m1) { | |
| 3176 | + var pre = m1; | |
| 3177 | + pre = pre.replace(/^ /mg, "\xA80"); | |
| 3178 | + pre = pre.replace(/¨0/g, ""); | |
| 3179 | + return pre; | |
| 3180 | + }); | |
| 3181 | + return showdown2.subParser("hashBlock")("<blockquote>\n" + bq + "\n</blockquote>", options, globals); | |
| 3182 | + }); | |
| 3183 | + text2 = globals.converter._dispatch("blockQuotes.after", text2, options, globals); | |
| 3184 | + return text2; | |
| 3185 | + }); | |
| 3186 | + showdown2.subParser("codeBlocks", function(text2, options, globals) { | |
| 3187 | + "use strict"; | |
| 3188 | + text2 = globals.converter._dispatch("codeBlocks.before", text2, options, globals); | |
| 3189 | + text2 += "\xA80"; | |
| 3190 | + var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; | |
| 3191 | + text2 = text2.replace(pattern, function(wholeMatch, m1, m2) { | |
| 3192 | + var codeblock = m1, nextChar = m2, end = "\n"; | |
| 3193 | + codeblock = showdown2.subParser("outdent")(codeblock, options, globals); | |
| 3194 | + codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals); | |
| 3195 | + codeblock = showdown2.subParser("detab")(codeblock, options, globals); | |
| 3196 | + codeblock = codeblock.replace(/^\n+/g, ""); | |
| 3197 | + codeblock = codeblock.replace(/\n+$/g, ""); | |
| 3198 | + if (options.omitExtraWLInCodeBlocks) { | |
| 3199 | + end = ""; | |
| 3200 | + } | |
| 3201 | + codeblock = "<pre><code>" + codeblock + end + "</code></pre>"; | |
| 3202 | + return showdown2.subParser("hashBlock")(codeblock, options, globals) + nextChar; | |
| 3203 | + }); | |
| 3204 | + text2 = text2.replace(/¨0/, ""); | |
| 3205 | + text2 = globals.converter._dispatch("codeBlocks.after", text2, options, globals); | |
| 3206 | + return text2; | |
| 3207 | + }); | |
| 3208 | + showdown2.subParser("codeSpans", function(text2, options, globals) { | |
| 3209 | + "use strict"; | |
| 3210 | + text2 = globals.converter._dispatch("codeSpans.before", text2, options, globals); | |
| 3211 | + if (typeof text2 === "undefined") { | |
| 3212 | + text2 = ""; | |
| 3213 | + } | |
| 3214 | + text2 = text2.replace( | |
| 3215 | + /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, | |
| 3216 | + function(wholeMatch, m1, m2, m3) { | |
| 3217 | + var c2 = m3; | |
| 3218 | + c2 = c2.replace(/^([ \t]*)/g, ""); | |
| 3219 | + c2 = c2.replace(/[ \t]*$/g, ""); | |
| 3220 | + c2 = showdown2.subParser("encodeCode")(c2, options, globals); | |
| 3221 | + c2 = m1 + "<code>" + c2 + "</code>"; | |
| 3222 | + c2 = showdown2.subParser("hashHTMLSpans")(c2, options, globals); | |
| 3223 | + return c2; | |
| 3224 | + } | |
| 3225 | + ); | |
| 3226 | + text2 = globals.converter._dispatch("codeSpans.after", text2, options, globals); | |
| 3227 | + return text2; | |
| 3228 | + }); | |
| 3229 | + showdown2.subParser("completeHTMLDocument", function(text2, options, globals) { | |
| 3230 | + "use strict"; | |
| 3231 | + if (!options.completeHTMLDocument) { | |
| 3232 | + return text2; | |
| 3233 | + } | |
| 3234 | + text2 = globals.converter._dispatch("completeHTMLDocument.before", text2, options, globals); | |
| 3235 | + var doctype = "html", doctypeParsed = "<!DOCTYPE HTML>\n", title = "", charset = '<meta charset="utf-8">\n', lang = "", metadata = ""; | |
| 3236 | + if (typeof globals.metadata.parsed.doctype !== "undefined") { | |
| 3237 | + doctypeParsed = "<!DOCTYPE " + globals.metadata.parsed.doctype + ">\n"; | |
| 3238 | + doctype = globals.metadata.parsed.doctype.toString().toLowerCase(); | |
| 3239 | + if (doctype === "html" || doctype === "html5") { | |
| 3240 | + charset = '<meta charset="utf-8">'; | |
| 3241 | + } | |
| 3242 | + } | |
| 3243 | + for (var meta in globals.metadata.parsed) { | |
| 3244 | + if (globals.metadata.parsed.hasOwnProperty(meta)) { | |
| 3245 | + switch (meta.toLowerCase()) { | |
| 3246 | + case "doctype": | |
| 3247 | + break; | |
| 3248 | + case "title": | |
| 3249 | + title = "<title>" + globals.metadata.parsed.title + "</title>\n"; | |
| 3250 | + break; | |
| 3251 | + case "charset": | |
| 3252 | + if (doctype === "html" || doctype === "html5") { | |
| 3253 | + charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n'; | |
| 3254 | + } else { | |
| 3255 | + charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n'; | |
| 3256 | + } | |
| 3257 | + break; | |
| 3258 | + case "language": | |
| 3259 | + case "lang": | |
| 3260 | + lang = ' lang="' + globals.metadata.parsed[meta] + '"'; | |
| 3261 | + metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n'; | |
| 3262 | + break; | |
| 3263 | + default: | |
| 3264 | + metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n'; | |
| 3265 | + } | |
| 3266 | + } | |
| 3267 | + } | |
| 3268 | + text2 = doctypeParsed + "<html" + lang + ">\n<head>\n" + title + charset + metadata + "</head>\n<body>\n" + text2.trim() + "\n</body>\n</html>"; | |
| 3269 | + text2 = globals.converter._dispatch("completeHTMLDocument.after", text2, options, globals); | |
| 3270 | + return text2; | |
| 3271 | + }); | |
| 3272 | + showdown2.subParser("detab", function(text2, options, globals) { | |
| 3273 | + "use strict"; | |
| 3274 | + text2 = globals.converter._dispatch("detab.before", text2, options, globals); | |
| 3275 | + text2 = text2.replace(/\t(?=\t)/g, " "); | |
| 3276 | + text2 = text2.replace(/\t/g, "\xA8A\xA8B"); | |
| 3277 | + text2 = text2.replace(/¨B(.+?)¨A/g, function(wholeMatch, m1) { | |
| 3278 | + var leadingText = m1, numSpaces = 4 - leadingText.length % 4; | |
| 3279 | + for (var i2 = 0; i2 < numSpaces; i2++) { | |
| 3280 | + leadingText += " "; | |
| 3281 | + } | |
| 3282 | + return leadingText; | |
| 3283 | + }); | |
| 3284 | + text2 = text2.replace(/¨A/g, " "); | |
| 3285 | + text2 = text2.replace(/¨B/g, ""); | |
| 3286 | + text2 = globals.converter._dispatch("detab.after", text2, options, globals); | |
| 3287 | + return text2; | |
| 3288 | + }); | |
| 3289 | + showdown2.subParser("ellipsis", function(text2, options, globals) { | |
| 3290 | + "use strict"; | |
| 3291 | + text2 = globals.converter._dispatch("ellipsis.before", text2, options, globals); | |
| 3292 | + text2 = text2.replace(/\.\.\./g, "\u2026"); | |
| 3293 | + text2 = globals.converter._dispatch("ellipsis.after", text2, options, globals); | |
| 3294 | + return text2; | |
| 3295 | + }); | |
| 3296 | + showdown2.subParser("emoji", function(text2, options, globals) { | |
| 3297 | + "use strict"; | |
| 3298 | + if (!options.emoji) { | |
| 3299 | + return text2; | |
| 3300 | + } | |
| 3301 | + text2 = globals.converter._dispatch("emoji.before", text2, options, globals); | |
| 3302 | + var emojiRgx = /:([\S]+?):/g; | |
| 3303 | + text2 = text2.replace(emojiRgx, function(wm, emojiCode) { | |
| 3304 | + if (showdown2.helper.emojis.hasOwnProperty(emojiCode)) { | |
| 3305 | + return showdown2.helper.emojis[emojiCode]; | |
| 3306 | + } | |
| 3307 | + return wm; | |
| 3308 | + }); | |
| 3309 | + text2 = globals.converter._dispatch("emoji.after", text2, options, globals); | |
| 3310 | + return text2; | |
| 3311 | + }); | |
| 3312 | + showdown2.subParser("encodeAmpsAndAngles", function(text2, options, globals) { | |
| 3313 | + "use strict"; | |
| 3314 | + text2 = globals.converter._dispatch("encodeAmpsAndAngles.before", text2, options, globals); | |
| 3315 | + text2 = text2.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"); | |
| 3316 | + text2 = text2.replace(/<(?![a-z\/?$!])/gi, "<"); | |
| 3317 | + text2 = text2.replace(/</g, "<"); | |
| 3318 | + text2 = text2.replace(/>/g, ">"); | |
| 3319 | + text2 = globals.converter._dispatch("encodeAmpsAndAngles.after", text2, options, globals); | |
| 3320 | + return text2; | |
| 3321 | + }); | |
| 3322 | + showdown2.subParser("encodeBackslashEscapes", function(text2, options, globals) { | |
| 3323 | + "use strict"; | |
| 3324 | + text2 = globals.converter._dispatch("encodeBackslashEscapes.before", text2, options, globals); | |
| 3325 | + text2 = text2.replace(/\\(\\)/g, showdown2.helper.escapeCharactersCallback); | |
| 3326 | + text2 = text2.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown2.helper.escapeCharactersCallback); | |
| 3327 | + text2 = globals.converter._dispatch("encodeBackslashEscapes.after", text2, options, globals); | |
| 3328 | + return text2; | |
| 3329 | + }); | |
| 3330 | + showdown2.subParser("encodeCode", function(text2, options, globals) { | |
| 3331 | + "use strict"; | |
| 3332 | + text2 = globals.converter._dispatch("encodeCode.before", text2, options, globals); | |
| 3333 | + text2 = text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/([*_{}\[\]\\=~-])/g, showdown2.helper.escapeCharactersCallback); | |
| 3334 | + text2 = globals.converter._dispatch("encodeCode.after", text2, options, globals); | |
| 3335 | + return text2; | |
| 3336 | + }); | |
| 3337 | + showdown2.subParser("escapeSpecialCharsWithinTagAttributes", function(text2, options, globals) { | |
| 3338 | + "use strict"; | |
| 3339 | + text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", text2, options, globals); | |
| 3340 | + var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; | |
| 3341 | + text2 = text2.replace(tags, function(wholeMatch) { | |
| 3342 | + return wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback); | |
| 3343 | + }); | |
| 3344 | + text2 = text2.replace(comments, function(wholeMatch) { | |
| 3345 | + return wholeMatch.replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback); | |
| 3346 | + }); | |
| 3347 | + text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", text2, options, globals); | |
| 3348 | + return text2; | |
| 3349 | + }); | |
| 3350 | + showdown2.subParser("githubCodeBlocks", function(text2, options, globals) { | |
| 3351 | + "use strict"; | |
| 3352 | + if (!options.ghCodeBlocks) { | |
| 3353 | + return text2; | |
| 3354 | + } | |
| 3355 | + text2 = globals.converter._dispatch("githubCodeBlocks.before", text2, options, globals); | |
| 3356 | + text2 += "\xA80"; | |
| 3357 | + text2 = text2.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(wholeMatch, delim, language, codeblock) { | |
| 3358 | + var end = options.omitExtraWLInCodeBlocks ? "" : "\n"; | |
| 3359 | + codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals); | |
| 3360 | + codeblock = showdown2.subParser("detab")(codeblock, options, globals); | |
| 3361 | + codeblock = codeblock.replace(/^\n+/g, ""); | |
| 3362 | + codeblock = codeblock.replace(/\n+$/g, ""); | |
| 3363 | + codeblock = "<pre><code" + (language ? ' class="' + language + " language-" + language + '"' : "") + ">" + codeblock + end + "</code></pre>"; | |
| 3364 | + codeblock = showdown2.subParser("hashBlock")(codeblock, options, globals); | |
| 3365 | + return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n"; | |
| 3366 | + }); | |
| 3367 | + text2 = text2.replace(/¨0/, ""); | |
| 3368 | + return globals.converter._dispatch("githubCodeBlocks.after", text2, options, globals); | |
| 3369 | + }); | |
| 3370 | + showdown2.subParser("hashBlock", function(text2, options, globals) { | |
| 3371 | + "use strict"; | |
| 3372 | + text2 = globals.converter._dispatch("hashBlock.before", text2, options, globals); | |
| 3373 | + text2 = text2.replace(/(^\n+|\n+$)/g, ""); | |
| 3374 | + text2 = "\n\n\xA8K" + (globals.gHtmlBlocks.push(text2) - 1) + "K\n\n"; | |
| 3375 | + text2 = globals.converter._dispatch("hashBlock.after", text2, options, globals); | |
| 3376 | + return text2; | |
| 3377 | + }); | |
| 3378 | + showdown2.subParser("hashCodeTags", function(text2, options, globals) { | |
| 3379 | + "use strict"; | |
| 3380 | + text2 = globals.converter._dispatch("hashCodeTags.before", text2, options, globals); | |
| 3381 | + var repFunc = function(wholeMatch, match, left, right) { | |
| 3382 | + var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right; | |
| 3383 | + return "\xA8C" + (globals.gHtmlSpans.push(codeblock) - 1) + "C"; | |
| 3384 | + }; | |
| 3385 | + text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "<code\\b[^>]*>", "</code>", "gim"); | |
| 3386 | + text2 = globals.converter._dispatch("hashCodeTags.after", text2, options, globals); | |
| 3387 | + return text2; | |
| 3388 | + }); | |
| 3389 | + showdown2.subParser("hashElement", function(text2, options, globals) { | |
| 3390 | + "use strict"; | |
| 3391 | + return function(wholeMatch, m1) { | |
| 3392 | + var blockText = m1; | |
| 3393 | + blockText = blockText.replace(/\n\n/g, "\n"); | |
| 3394 | + blockText = blockText.replace(/^\n/, ""); | |
| 3395 | + blockText = blockText.replace(/\n+$/g, ""); | |
| 3396 | + blockText = "\n\n\xA8K" + (globals.gHtmlBlocks.push(blockText) - 1) + "K\n\n"; | |
| 3397 | + return blockText; | |
| 3398 | + }; | |
| 3399 | + }); | |
| 3400 | + showdown2.subParser("hashHTMLBlocks", function(text2, options, globals) { | |
| 3401 | + "use strict"; | |
| 3402 | + text2 = globals.converter._dispatch("hashHTMLBlocks.before", text2, options, globals); | |
| 3403 | + var blockTags = [ | |
| 3404 | + "pre", | |
| 3405 | + "div", | |
| 3406 | + "h1", | |
| 3407 | + "h2", | |
| 3408 | + "h3", | |
| 3409 | + "h4", | |
| 3410 | + "h5", | |
| 3411 | + "h6", | |
| 3412 | + "blockquote", | |
| 3413 | + "table", | |
| 3414 | + "dl", | |
| 3415 | + "ol", | |
| 3416 | + "ul", | |
| 3417 | + "script", | |
| 3418 | + "noscript", | |
| 3419 | + "form", | |
| 3420 | + "fieldset", | |
| 3421 | + "iframe", | |
| 3422 | + "math", | |
| 3423 | + "style", | |
| 3424 | + "section", | |
| 3425 | + "header", | |
| 3426 | + "footer", | |
| 3427 | + "nav", | |
| 3428 | + "article", | |
| 3429 | + "aside", | |
| 3430 | + "address", | |
| 3431 | + "audio", | |
| 3432 | + "canvas", | |
| 3433 | + "figure", | |
| 3434 | + "hgroup", | |
| 3435 | + "output", | |
| 3436 | + "video", | |
| 3437 | + "p" | |
| 3438 | + ], repFunc = function(wholeMatch, match, left, right) { | |
| 3439 | + var txt = wholeMatch; | |
| 3440 | + if (left.search(/\bmarkdown\b/) !== -1) { | |
| 3441 | + txt = left + globals.converter.makeHtml(match) + right; | |
| 3442 | + } | |
| 3443 | + return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n"; | |
| 3444 | + }; | |
| 3445 | + if (options.backslashEscapesHTMLTags) { | |
| 3446 | + text2 = text2.replace(/\\<(\/?[^>]+?)>/g, function(wm, inside) { | |
| 3447 | + return "<" + inside + ">"; | |
| 3448 | + }); | |
| 3449 | + } | |
| 3450 | + for (var i2 = 0; i2 < blockTags.length; ++i2) { | |
| 3451 | + var opTagPos, rgx1 = new RegExp("^ {0,3}(<" + blockTags[i2] + "\\b[^>]*>)", "im"), patLeft = "<" + blockTags[i2] + "\\b[^>]*>", patRight = "</" + blockTags[i2] + ">"; | |
| 3452 | + while ((opTagPos = showdown2.helper.regexIndexOf(text2, rgx1)) !== -1) { | |
| 3453 | + var subTexts = showdown2.helper.splitAtIndex(text2, opTagPos), newSubText1 = showdown2.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, "im"); | |
| 3454 | + if (newSubText1 === subTexts[1]) { | |
| 3455 | + break; | |
| 3456 | + } | |
| 3457 | + text2 = subTexts[0].concat(newSubText1); | |
| 3458 | + } | |
| 3459 | + } | |
| 3460 | + text2 = text2.replace( | |
| 3461 | + /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, | |
| 3462 | + showdown2.subParser("hashElement")(text2, options, globals) | |
| 3463 | + ); | |
| 3464 | + text2 = showdown2.helper.replaceRecursiveRegExp(text2, function(txt) { | |
| 3465 | + return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n"; | |
| 3466 | + }, "^ {0,3}<!--", "-->", "gm"); | |
| 3467 | + text2 = text2.replace( | |
| 3468 | + /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, | |
| 3469 | + showdown2.subParser("hashElement")(text2, options, globals) | |
| 3470 | + ); | |
| 3471 | + text2 = globals.converter._dispatch("hashHTMLBlocks.after", text2, options, globals); | |
| 3472 | + return text2; | |
| 3473 | + }); | |
| 3474 | + showdown2.subParser("hashHTMLSpans", function(text2, options, globals) { | |
| 3475 | + "use strict"; | |
| 3476 | + text2 = globals.converter._dispatch("hashHTMLSpans.before", text2, options, globals); | |
| 3477 | + function hashHTMLSpan(html2) { | |
| 3478 | + return "\xA8C" + (globals.gHtmlSpans.push(html2) - 1) + "C"; | |
| 3479 | + } | |
| 3480 | + text2 = text2.replace(/<[^>]+?\/>/gi, function(wm) { | |
| 3481 | + return hashHTMLSpan(wm); | |
| 3482 | + }); | |
| 3483 | + text2 = text2.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(wm) { | |
| 3484 | + return hashHTMLSpan(wm); | |
| 3485 | + }); | |
| 3486 | + text2 = text2.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(wm) { | |
| 3487 | + return hashHTMLSpan(wm); | |
| 3488 | + }); | |
| 3489 | + text2 = text2.replace(/<[^>]+?>/gi, function(wm) { | |
| 3490 | + return hashHTMLSpan(wm); | |
| 3491 | + }); | |
| 3492 | + text2 = globals.converter._dispatch("hashHTMLSpans.after", text2, options, globals); | |
| 3493 | + return text2; | |
| 3494 | + }); | |
| 3495 | + showdown2.subParser("unhashHTMLSpans", function(text2, options, globals) { | |
| 3496 | + "use strict"; | |
| 3497 | + text2 = globals.converter._dispatch("unhashHTMLSpans.before", text2, options, globals); | |
| 3498 | + for (var i2 = 0; i2 < globals.gHtmlSpans.length; ++i2) { | |
| 3499 | + var repText = globals.gHtmlSpans[i2], limit = 0; | |
| 3500 | + while (/¨C(\d+)C/.test(repText)) { | |
| 3501 | + var num = RegExp.$1; | |
| 3502 | + repText = repText.replace("\xA8C" + num + "C", globals.gHtmlSpans[num]); | |
| 3503 | + if (limit === 10) { | |
| 3504 | + console.error("maximum nesting of 10 spans reached!!!"); | |
| 3505 | + break; | |
| 3506 | + } | |
| 3507 | + ++limit; | |
| 3508 | + } | |
| 3509 | + text2 = text2.replace("\xA8C" + i2 + "C", repText); | |
| 3510 | + } | |
| 3511 | + text2 = globals.converter._dispatch("unhashHTMLSpans.after", text2, options, globals); | |
| 3512 | + return text2; | |
| 3513 | + }); | |
| 3514 | + showdown2.subParser("hashPreCodeTags", function(text2, options, globals) { | |
| 3515 | + "use strict"; | |
| 3516 | + text2 = globals.converter._dispatch("hashPreCodeTags.before", text2, options, globals); | |
| 3517 | + var repFunc = function(wholeMatch, match, left, right) { | |
| 3518 | + var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right; | |
| 3519 | + return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n"; | |
| 3520 | + }; | |
| 3521 | + text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>", "^ {0,3}</code>\\s*</pre>", "gim"); | |
| 3522 | + text2 = globals.converter._dispatch("hashPreCodeTags.after", text2, options, globals); | |
| 3523 | + return text2; | |
| 3524 | + }); | |
| 3525 | + showdown2.subParser("headers", function(text2, options, globals) { | |
| 3526 | + "use strict"; | |
| 3527 | + text2 = globals.converter._dispatch("headers.before", text2, options, globals); | |
| 3528 | + 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; | |
| 3529 | + text2 = text2.replace(setextRegexH1, function(wholeMatch, m1) { | |
| 3530 | + var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">"; | |
| 3531 | + return showdown2.subParser("hashBlock")(hashBlock, options, globals); | |
| 3532 | + }); | |
| 3533 | + text2 = text2.replace(setextRegexH2, function(matchFound, m1) { | |
| 3534 | + var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart + 1, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">"; | |
| 3535 | + return showdown2.subParser("hashBlock")(hashBlock, options, globals); | |
| 3536 | + }); | |
| 3537 | + var atxStyle = options.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; | |
| 3538 | + text2 = text2.replace(atxStyle, function(wholeMatch, m1, m2) { | |
| 3539 | + var hText = m2; | |
| 3540 | + if (options.customizedHeaderId) { | |
| 3541 | + hText = m2.replace(/\s?\{([^{]+?)}\s*$/, ""); | |
| 3542 | + } | |
| 3543 | + 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 + ">"; | |
| 3544 | + return showdown2.subParser("hashBlock")(header, options, globals); | |
| 3545 | + }); | |
| 3546 | + function headerId(m2) { | |
| 3547 | + var title, prefix; | |
| 3548 | + if (options.customizedHeaderId) { | |
| 3549 | + var match = m2.match(/\{([^{]+?)}\s*$/); | |
| 3550 | + if (match && match[1]) { | |
| 3551 | + m2 = match[1]; | |
| 3552 | + } | |
| 3553 | + } | |
| 3554 | + title = m2; | |
| 3555 | + if (showdown2.helper.isString(options.prefixHeaderId)) { | |
| 3556 | + prefix = options.prefixHeaderId; | |
| 3557 | + } else if (options.prefixHeaderId === true) { | |
| 3558 | + prefix = "section-"; | |
| 3559 | + } else { | |
| 3560 | + prefix = ""; | |
| 3561 | + } | |
| 3562 | + if (!options.rawPrefixHeaderId) { | |
| 3563 | + title = prefix + title; | |
| 3564 | + } | |
| 3565 | + if (options.ghCompatibleHeaderId) { | |
| 3566 | + title = title.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase(); | |
| 3567 | + } else if (options.rawHeaderId) { | |
| 3568 | + title = title.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "\xA8").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase(); | |
| 3569 | + } else { | |
| 3570 | + title = title.replace(/[^\w]/g, "").toLowerCase(); | |
| 3571 | + } | |
| 3572 | + if (options.rawPrefixHeaderId) { | |
| 3573 | + title = prefix + title; | |
| 3574 | + } | |
| 3575 | + if (globals.hashLinkCounts[title]) { | |
| 3576 | + title = title + "-" + globals.hashLinkCounts[title]++; | |
| 3577 | + } else { | |
| 3578 | + globals.hashLinkCounts[title] = 1; | |
| 3579 | + } | |
| 3580 | + return title; | |
| 3581 | + } | |
| 3582 | + text2 = globals.converter._dispatch("headers.after", text2, options, globals); | |
| 3583 | + return text2; | |
| 3584 | + }); | |
| 3585 | + showdown2.subParser("horizontalRule", function(text2, options, globals) { | |
| 3586 | + "use strict"; | |
| 3587 | + text2 = globals.converter._dispatch("horizontalRule.before", text2, options, globals); | |
| 3588 | + var key = showdown2.subParser("hashBlock")("<hr />", options, globals); | |
| 3589 | + text2 = text2.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key); | |
| 3590 | + text2 = text2.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key); | |
| 3591 | + text2 = text2.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key); | |
| 3592 | + text2 = globals.converter._dispatch("horizontalRule.after", text2, options, globals); | |
| 3593 | + return text2; | |
| 3594 | + }); | |
| 3595 | + showdown2.subParser("images", function(text2, options, globals) { | |
| 3596 | + "use strict"; | |
| 3597 | + text2 = globals.converter._dispatch("images.before", text2, options, globals); | |
| 3598 | + 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; | |
| 3599 | + function writeImageTagBase64(wholeMatch, altText, linkId, url, width, height, m5, title) { | |
| 3600 | + url = url.replace(/\s/g, ""); | |
| 3601 | + return writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title); | |
| 3602 | + } | |
| 3603 | + function writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title) { | |
| 3604 | + var gUrls = globals.gUrls, gTitles = globals.gTitles, gDims = globals.gDimensions; | |
| 3605 | + linkId = linkId.toLowerCase(); | |
| 3606 | + if (!title) { | |
| 3607 | + title = ""; | |
| 3608 | + } | |
| 3609 | + if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) { | |
| 3610 | + url = ""; | |
| 3611 | + } else if (url === "" || url === null) { | |
| 3612 | + if (linkId === "" || linkId === null) { | |
| 3613 | + linkId = altText.toLowerCase().replace(/ ?\n/g, " "); | |
| 3614 | + } | |
| 3615 | + url = "#" + linkId; | |
| 3616 | + if (!showdown2.helper.isUndefined(gUrls[linkId])) { | |
| 3617 | + url = gUrls[linkId]; | |
| 3618 | + if (!showdown2.helper.isUndefined(gTitles[linkId])) { | |
| 3619 | + title = gTitles[linkId]; | |
| 3620 | + } | |
| 3621 | + if (!showdown2.helper.isUndefined(gDims[linkId])) { | |
| 3622 | + width = gDims[linkId].width; | |
| 3623 | + height = gDims[linkId].height; | |
| 3624 | + } | |
| 3625 | + } else { | |
| 3626 | + return wholeMatch; | |
| 3627 | + } | |
| 3628 | + } | |
| 3629 | + altText = altText.replace(/"/g, """).replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); | |
| 3630 | + url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); | |
| 3631 | + var result = '<img src="' + url + '" alt="' + altText + '"'; | |
| 3632 | + if (title && showdown2.helper.isString(title)) { | |
| 3633 | + title = title.replace(/"/g, """).replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); | |
| 3634 | + result += ' title="' + title + '"'; | |
| 3635 | + } | |
| 3636 | + if (width && height) { | |
| 3637 | + width = width === "*" ? "auto" : width; | |
| 3638 | + height = height === "*" ? "auto" : height; | |
| 3639 | + result += ' width="' + width + '"'; | |
| 3640 | + result += ' height="' + height + '"'; | |
| 3641 | + } | |
| 3642 | + result += " />"; | |
| 3643 | + return result; | |
| 3644 | + } | |
| 3645 | + text2 = text2.replace(referenceRegExp, writeImageTag); | |
| 3646 | + text2 = text2.replace(base64RegExp, writeImageTagBase64); | |
| 3647 | + text2 = text2.replace(crazyRegExp, writeImageTag); | |
| 3648 | + text2 = text2.replace(inlineRegExp, writeImageTag); | |
| 3649 | + text2 = text2.replace(refShortcutRegExp, writeImageTag); | |
| 3650 | + text2 = globals.converter._dispatch("images.after", text2, options, globals); | |
| 3651 | + return text2; | |
| 3652 | + }); | |
| 3653 | + showdown2.subParser("italicsAndBold", function(text2, options, globals) { | |
| 3654 | + "use strict"; | |
| 3655 | + text2 = globals.converter._dispatch("italicsAndBold.before", text2, options, globals); | |
| 3656 | + function parseInside(txt, left, right) { | |
| 3657 | + return left + txt + right; | |
| 3658 | + } | |
| 3659 | + if (options.literalMidWordUnderscores) { | |
| 3660 | + text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) { | |
| 3661 | + return parseInside(txt, "<strong><em>", "</em></strong>"); | |
| 3662 | + }); | |
| 3663 | + text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) { | |
| 3664 | + return parseInside(txt, "<strong>", "</strong>"); | |
| 3665 | + }); | |
| 3666 | + text2 = text2.replace(/\b_(\S[\s\S]*?)_\b/g, function(wm, txt) { | |
| 3667 | + return parseInside(txt, "<em>", "</em>"); | |
| 3668 | + }); | |
| 3669 | + } else { | |
| 3670 | + text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) { | |
| 3671 | + return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm; | |
| 3672 | + }); | |
| 3673 | + text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) { | |
| 3674 | + return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm; | |
| 3675 | + }); | |
| 3676 | + text2 = text2.replace(/_([^\s_][\s\S]*?)_/g, function(wm, m2) { | |
| 3677 | + return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm; | |
| 3678 | + }); | |
| 3679 | + } | |
| 3680 | + if (options.literalMidWordAsterisks) { | |
| 3681 | + text2 = text2.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(wm, lead, txt) { | |
| 3682 | + return parseInside(txt, lead + "<strong><em>", "</em></strong>"); | |
| 3683 | + }); | |
| 3684 | + text2 = text2.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(wm, lead, txt) { | |
| 3685 | + return parseInside(txt, lead + "<strong>", "</strong>"); | |
| 3686 | + }); | |
| 3687 | + text2 = text2.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(wm, lead, txt) { | |
| 3688 | + return parseInside(txt, lead + "<em>", "</em>"); | |
| 3689 | + }); | |
| 3690 | + } else { | |
| 3691 | + text2 = text2.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(wm, m2) { | |
| 3692 | + return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm; | |
| 3693 | + }); | |
| 3694 | + text2 = text2.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(wm, m2) { | |
| 3695 | + return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm; | |
| 3696 | + }); | |
| 3697 | + text2 = text2.replace(/\*([^\s*][\s\S]*?)\*/g, function(wm, m2) { | |
| 3698 | + return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm; | |
| 3699 | + }); | |
| 3700 | + } | |
| 3701 | + text2 = globals.converter._dispatch("italicsAndBold.after", text2, options, globals); | |
| 3702 | + return text2; | |
| 3703 | + }); | |
| 3704 | + showdown2.subParser("lists", function(text2, options, globals) { | |
| 3705 | + "use strict"; | |
| 3706 | + function processListItems(listStr, trimTrailing) { | |
| 3707 | + globals.gListLevel++; | |
| 3708 | + listStr = listStr.replace(/\n{2,}$/, "\n"); | |
| 3709 | + listStr += "\xA80"; | |
| 3710 | + 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); | |
| 3711 | + if (options.disableForced4SpacesIndentedSublists) { | |
| 3712 | + rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; | |
| 3713 | + } | |
| 3714 | + listStr = listStr.replace(rgx, function(wholeMatch, m1, m2, m3, m4, taskbtn, checked) { | |
| 3715 | + checked = checked && checked.trim() !== ""; | |
| 3716 | + var item = showdown2.subParser("outdent")(m4, options, globals), bulletStyle = ""; | |
| 3717 | + if (taskbtn && options.tasklists) { | |
| 3718 | + bulletStyle = ' class="task-list-item" style="list-style-type: none;"'; | |
| 3719 | + item = item.replace(/^[ \t]*\[(x|X| )?]/m, function() { | |
| 3720 | + var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"'; | |
| 3721 | + if (checked) { | |
| 3722 | + otp += " checked"; | |
| 3723 | + } | |
| 3724 | + otp += ">"; | |
| 3725 | + return otp; | |
| 3726 | + }); | |
| 3727 | + } | |
| 3728 | + item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function(wm2) { | |
| 3729 | + return "\xA8A" + wm2; | |
| 3730 | + }); | |
| 3731 | + if (m1 || item.search(/\n{2,}/) > -1) { | |
| 3732 | + item = showdown2.subParser("githubCodeBlocks")(item, options, globals); | |
| 3733 | + item = showdown2.subParser("blockGamut")(item, options, globals); | |
| 3734 | + } else { | |
| 3735 | + item = showdown2.subParser("lists")(item, options, globals); | |
| 3736 | + item = item.replace(/\n$/, ""); | |
| 3737 | + item = showdown2.subParser("hashHTMLBlocks")(item, options, globals); | |
| 3738 | + item = item.replace(/\n\n+/g, "\n\n"); | |
| 3739 | + if (isParagraphed) { | |
| 3740 | + item = showdown2.subParser("paragraphs")(item, options, globals); | |
| 3741 | + } else { | |
| 3742 | + item = showdown2.subParser("spanGamut")(item, options, globals); | |
| 3743 | + } | |
| 3744 | + } | |
| 3745 | + item = item.replace("\xA8A", ""); | |
| 3746 | + item = "<li" + bulletStyle + ">" + item + "</li>\n"; | |
| 3747 | + return item; | |
| 3748 | + }); | |
| 3749 | + listStr = listStr.replace(/¨0/g, ""); | |
| 3750 | + globals.gListLevel--; | |
| 3751 | + if (trimTrailing) { | |
| 3752 | + listStr = listStr.replace(/\s+$/, ""); | |
| 3753 | + } | |
| 3754 | + return listStr; | |
| 3755 | + } | |
| 3756 | + function styleStartNumber(list, listType) { | |
| 3757 | + if (listType === "ol") { | |
| 3758 | + var res = list.match(/^ *(\d+)\./); | |
| 3759 | + if (res && res[1] !== "1") { | |
| 3760 | + return ' start="' + res[1] + '"'; | |
| 3761 | + } | |
| 3762 | + } | |
| 3763 | + return ""; | |
| 3764 | + } | |
| 3765 | + function parseConsecutiveLists(list, listType, trimTrailing) { | |
| 3766 | + 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 = ""; | |
| 3767 | + if (list.search(counterRxg) !== -1) { | |
| 3768 | + (function parseCL(txt) { | |
| 3769 | + var pos = txt.search(counterRxg), style2 = styleStartNumber(list, listType); | |
| 3770 | + if (pos !== -1) { | |
| 3771 | + result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt.slice(0, pos), !!trimTrailing) + "</" + listType + ">\n"; | |
| 3772 | + listType = listType === "ul" ? "ol" : "ul"; | |
| 3773 | + counterRxg = listType === "ul" ? olRgx : ulRgx; | |
| 3774 | + parseCL(txt.slice(pos)); | |
| 3775 | + } else { | |
| 3776 | + result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt, !!trimTrailing) + "</" + listType + ">\n"; | |
| 3777 | + } | |
| 3778 | + })(list); | |
| 3779 | + } else { | |
| 3780 | + var style = styleStartNumber(list, listType); | |
| 3781 | + result = "\n\n<" + listType + style + ">\n" + processListItems(list, !!trimTrailing) + "</" + listType + ">\n"; | |
| 3782 | + } | |
| 3783 | + return result; | |
| 3784 | + } | |
| 3785 | + text2 = globals.converter._dispatch("lists.before", text2, options, globals); | |
| 3786 | + text2 += "\xA80"; | |
| 3787 | + if (globals.gListLevel) { | |
| 3788 | + text2 = text2.replace( | |
| 3789 | + /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, | |
| 3790 | + function(wholeMatch, list, m2) { | |
| 3791 | + var listType = m2.search(/[*+-]/g) > -1 ? "ul" : "ol"; | |
| 3792 | + return parseConsecutiveLists(list, listType, true); | |
| 3793 | + } | |
| 3794 | + ); | |
| 3795 | + } else { | |
| 3796 | + text2 = text2.replace( | |
| 3797 | + /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, | |
| 3798 | + function(wholeMatch, m1, list, m3) { | |
| 3799 | + var listType = m3.search(/[*+-]/g) > -1 ? "ul" : "ol"; | |
| 3800 | + return parseConsecutiveLists(list, listType, false); | |
| 3801 | + } | |
| 3802 | + ); | |
| 3803 | + } | |
| 3804 | + text2 = text2.replace(/¨0/, ""); | |
| 3805 | + text2 = globals.converter._dispatch("lists.after", text2, options, globals); | |
| 3806 | + return text2; | |
| 3807 | + }); | |
| 3808 | + showdown2.subParser("metadata", function(text2, options, globals) { | |
| 3809 | + "use strict"; | |
| 3810 | + if (!options.metadata) { | |
| 3811 | + return text2; | |
| 3812 | + } | |
| 3813 | + text2 = globals.converter._dispatch("metadata.before", text2, options, globals); | |
| 3814 | + function parseMetadataContents(content) { | |
| 3815 | + globals.metadata.raw = content; | |
| 3816 | + content = content.replace(/&/g, "&").replace(/"/g, """); | |
| 3817 | + content = content.replace(/\n {4}/g, " "); | |
| 3818 | + content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(wm, key, value) { | |
| 3819 | + globals.metadata.parsed[key] = value; | |
| 3820 | + return ""; | |
| 3821 | + }); | |
| 3822 | + } | |
| 3823 | + text2 = text2.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(wholematch, format, content) { | |
| 3824 | + parseMetadataContents(content); | |
| 3825 | + return "\xA8M"; | |
| 3826 | + }); | |
| 3827 | + text2 = text2.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(wholematch, format, content) { | |
| 3828 | + if (format) { | |
| 3829 | + globals.metadata.format = format; | |
| 3830 | + } | |
| 3831 | + parseMetadataContents(content); | |
| 3832 | + return "\xA8M"; | |
| 3833 | + }); | |
| 3834 | + text2 = text2.replace(/¨M/g, ""); | |
| 3835 | + text2 = globals.converter._dispatch("metadata.after", text2, options, globals); | |
| 3836 | + return text2; | |
| 3837 | + }); | |
| 3838 | + showdown2.subParser("outdent", function(text2, options, globals) { | |
| 3839 | + "use strict"; | |
| 3840 | + text2 = globals.converter._dispatch("outdent.before", text2, options, globals); | |
| 3841 | + text2 = text2.replace(/^(\t|[ ]{1,4})/gm, "\xA80"); | |
| 3842 | + text2 = text2.replace(/¨0/g, ""); | |
| 3843 | + text2 = globals.converter._dispatch("outdent.after", text2, options, globals); | |
| 3844 | + return text2; | |
| 3845 | + }); | |
| 3846 | + showdown2.subParser("paragraphs", function(text2, options, globals) { | |
| 3847 | + "use strict"; | |
| 3848 | + text2 = globals.converter._dispatch("paragraphs.before", text2, options, globals); | |
| 3849 | + text2 = text2.replace(/^\n+/g, ""); | |
| 3850 | + text2 = text2.replace(/\n+$/g, ""); | |
| 3851 | + var grafs = text2.split(/\n{2,}/g), grafsOut = [], end = grafs.length; | |
| 3852 | + for (var i2 = 0; i2 < end; i2++) { | |
| 3853 | + var str = grafs[i2]; | |
| 3854 | + if (str.search(/¨(K|G)(\d+)\1/g) >= 0) { | |
| 3855 | + grafsOut.push(str); | |
| 3856 | + } else if (str.search(/\S/) >= 0) { | |
| 3857 | + str = showdown2.subParser("spanGamut")(str, options, globals); | |
| 3858 | + str = str.replace(/^([ \t]*)/g, "<p>"); | |
| 3859 | + str += "</p>"; | |
| 3860 | + grafsOut.push(str); | |
| 3861 | + } | |
| 3862 | + } | |
| 3863 | + end = grafsOut.length; | |
| 3864 | + for (i2 = 0; i2 < end; i2++) { | |
| 3865 | + var blockText = "", grafsOutIt = grafsOut[i2], codeFlag = false; | |
| 3866 | + while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) { | |
| 3867 | + var delim = RegExp.$1, num = RegExp.$2; | |
| 3868 | + if (delim === "K") { | |
| 3869 | + blockText = globals.gHtmlBlocks[num]; | |
| 3870 | + } else { | |
| 3871 | + if (codeFlag) { | |
| 3872 | + blockText = showdown2.subParser("encodeCode")(globals.ghCodeBlocks[num].text, options, globals); | |
| 3873 | + } else { | |
| 3874 | + blockText = globals.ghCodeBlocks[num].codeblock; | |
| 3875 | + } | |
| 3876 | + } | |
| 3877 | + blockText = blockText.replace(/\$/g, "$$$$"); | |
| 3878 | + grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText); | |
| 3879 | + if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) { | |
| 3880 | + codeFlag = true; | |
| 3881 | + } | |
| 3882 | + } | |
| 3883 | + grafsOut[i2] = grafsOutIt; | |
| 3884 | + } | |
| 3885 | + text2 = grafsOut.join("\n"); | |
| 3886 | + text2 = text2.replace(/^\n+/g, ""); | |
| 3887 | + text2 = text2.replace(/\n+$/g, ""); | |
| 3888 | + return globals.converter._dispatch("paragraphs.after", text2, options, globals); | |
| 3889 | + }); | |
| 3890 | + showdown2.subParser("runExtension", function(ext, text2, options, globals) { | |
| 3891 | + "use strict"; | |
| 3892 | + if (ext.filter) { | |
| 3893 | + text2 = ext.filter(text2, globals.converter, options); | |
| 3894 | + } else if (ext.regex) { | |
| 3895 | + var re = ext.regex; | |
| 3896 | + if (!(re instanceof RegExp)) { | |
| 3897 | + re = new RegExp(re, "g"); | |
| 3898 | + } | |
| 3899 | + text2 = text2.replace(re, ext.replace); | |
| 3900 | + } | |
| 3901 | + return text2; | |
| 3902 | + }); | |
| 3903 | + showdown2.subParser("spanGamut", function(text2, options, globals) { | |
| 3904 | + "use strict"; | |
| 3905 | + text2 = globals.converter._dispatch("spanGamut.before", text2, options, globals); | |
| 3906 | + text2 = showdown2.subParser("codeSpans")(text2, options, globals); | |
| 3907 | + text2 = showdown2.subParser("escapeSpecialCharsWithinTagAttributes")(text2, options, globals); | |
| 3908 | + text2 = showdown2.subParser("encodeBackslashEscapes")(text2, options, globals); | |
| 3909 | + text2 = showdown2.subParser("images")(text2, options, globals); | |
| 3910 | + text2 = showdown2.subParser("anchors")(text2, options, globals); | |
| 3911 | + text2 = showdown2.subParser("autoLinks")(text2, options, globals); | |
| 3912 | + text2 = showdown2.subParser("simplifiedAutoLinks")(text2, options, globals); | |
| 3913 | + text2 = showdown2.subParser("emoji")(text2, options, globals); | |
| 3914 | + text2 = showdown2.subParser("underline")(text2, options, globals); | |
| 3915 | + text2 = showdown2.subParser("italicsAndBold")(text2, options, globals); | |
| 3916 | + text2 = showdown2.subParser("strikethrough")(text2, options, globals); | |
| 3917 | + text2 = showdown2.subParser("ellipsis")(text2, options, globals); | |
| 3918 | + text2 = showdown2.subParser("hashHTMLSpans")(text2, options, globals); | |
| 3919 | + text2 = showdown2.subParser("encodeAmpsAndAngles")(text2, options, globals); | |
| 3920 | + if (options.simpleLineBreaks) { | |
| 3921 | + if (!/\n\n¨K/.test(text2)) { | |
| 3922 | + text2 = text2.replace(/\n+/g, "<br />\n"); | |
| 3923 | + } | |
| 3924 | + } else { | |
| 3925 | + text2 = text2.replace(/ +\n/g, "<br />\n"); | |
| 3926 | + } | |
| 3927 | + text2 = globals.converter._dispatch("spanGamut.after", text2, options, globals); | |
| 3928 | + return text2; | |
| 3929 | + }); | |
| 3930 | + showdown2.subParser("strikethrough", function(text2, options, globals) { | |
| 3931 | + "use strict"; | |
| 3932 | + function parseInside(txt) { | |
| 3933 | + if (options.simplifiedAutoLink) { | |
| 3934 | + txt = showdown2.subParser("simplifiedAutoLinks")(txt, options, globals); | |
| 3935 | + } | |
| 3936 | + return "<del>" + txt + "</del>"; | |
| 3937 | + } | |
| 3938 | + if (options.strikethrough) { | |
| 3939 | + text2 = globals.converter._dispatch("strikethrough.before", text2, options, globals); | |
| 3940 | + text2 = text2.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(wm, txt) { | |
| 3941 | + return parseInside(txt); | |
| 3942 | + }); | |
| 3943 | + text2 = globals.converter._dispatch("strikethrough.after", text2, options, globals); | |
| 3944 | + } | |
| 3945 | + return text2; | |
| 3946 | + }); | |
| 3947 | + showdown2.subParser("stripLinkDefinitions", function(text2, options, globals) { | |
| 3948 | + "use strict"; | |
| 3949 | + 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; | |
| 3950 | + text2 += "\xA80"; | |
| 3951 | + var replaceFunc = function(wholeMatch, linkId, url, width, height, blankLines, title) { | |
| 3952 | + linkId = linkId.toLowerCase(); | |
| 3953 | + if (url.match(/^data:.+?\/.+?;base64,/)) { | |
| 3954 | + globals.gUrls[linkId] = url.replace(/\s/g, ""); | |
| 3955 | + } else { | |
| 3956 | + globals.gUrls[linkId] = showdown2.subParser("encodeAmpsAndAngles")(url, options, globals); | |
| 3957 | + } | |
| 3958 | + if (blankLines) { | |
| 3959 | + return blankLines + title; | |
| 3960 | + } else { | |
| 3961 | + if (title) { | |
| 3962 | + globals.gTitles[linkId] = title.replace(/"|'/g, """); | |
| 3963 | + } | |
| 3964 | + if (options.parseImgDimensions && width && height) { | |
| 3965 | + globals.gDimensions[linkId] = { | |
| 3966 | + width, | |
| 3967 | + height | |
| 3968 | + }; | |
| 3969 | + } | |
| 3970 | + } | |
| 3971 | + return ""; | |
| 3972 | + }; | |
| 3973 | + text2 = text2.replace(base64Regex, replaceFunc); | |
| 3974 | + text2 = text2.replace(regex, replaceFunc); | |
| 3975 | + text2 = text2.replace(/¨0/, ""); | |
| 3976 | + return text2; | |
| 3977 | + }); | |
| 3978 | + showdown2.subParser("tables", function(text2, options, globals) { | |
| 3979 | + "use strict"; | |
| 3980 | + if (!options.tables) { | |
| 3981 | + return text2; | |
| 3982 | + } | |
| 3983 | + 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; | |
| 3984 | + function parseStyles(sLine) { | |
| 3985 | + if (/^:[ \t]*--*$/.test(sLine)) { | |
| 3986 | + return ' style="text-align:left;"'; | |
| 3987 | + } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) { | |
| 3988 | + return ' style="text-align:right;"'; | |
| 3989 | + } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) { | |
| 3990 | + return ' style="text-align:center;"'; | |
| 3991 | + } else { | |
| 3992 | + return ""; | |
| 3993 | + } | |
| 3994 | + } | |
| 3995 | + function parseHeaders(header, style) { | |
| 3996 | + var id = ""; | |
| 3997 | + header = header.trim(); | |
| 3998 | + if (options.tablesHeaderId || options.tableHeaderId) { | |
| 3999 | + id = ' id="' + header.replace(/ /g, "_").toLowerCase() + '"'; | |
| 4000 | + } | |
| 4001 | + header = showdown2.subParser("spanGamut")(header, options, globals); | |
| 4002 | + return "<th" + id + style + ">" + header + "</th>\n"; | |
| 4003 | + } | |
| 4004 | + function parseCells(cell, style) { | |
| 4005 | + var subText = showdown2.subParser("spanGamut")(cell, options, globals); | |
| 4006 | + return "<td" + style + ">" + subText + "</td>\n"; | |
| 4007 | + } | |
| 4008 | + function buildTable(headers, cells) { | |
| 4009 | + var tb = "<table>\n<thead>\n<tr>\n", tblLgn = headers.length; | |
| 4010 | + for (var i2 = 0; i2 < tblLgn; ++i2) { | |
| 4011 | + tb += headers[i2]; | |
| 4012 | + } | |
| 4013 | + tb += "</tr>\n</thead>\n<tbody>\n"; | |
| 4014 | + for (i2 = 0; i2 < cells.length; ++i2) { | |
| 4015 | + tb += "<tr>\n"; | |
| 4016 | + for (var ii = 0; ii < tblLgn; ++ii) { | |
| 4017 | + tb += cells[i2][ii]; | |
| 4018 | + } | |
| 4019 | + tb += "</tr>\n"; | |
| 4020 | + } | |
| 4021 | + tb += "</tbody>\n</table>\n"; | |
| 4022 | + return tb; | |
| 4023 | + } | |
| 4024 | + function parseTable(rawTable) { | |
| 4025 | + var i2, tableLines = rawTable.split("\n"); | |
| 4026 | + for (i2 = 0; i2 < tableLines.length; ++i2) { | |
| 4027 | + if (/^ {0,3}\|/.test(tableLines[i2])) { | |
| 4028 | + tableLines[i2] = tableLines[i2].replace(/^ {0,3}\|/, ""); | |
| 4029 | + } | |
| 4030 | + if (/\|[ \t]*$/.test(tableLines[i2])) { | |
| 4031 | + tableLines[i2] = tableLines[i2].replace(/\|[ \t]*$/, ""); | |
| 4032 | + } | |
| 4033 | + tableLines[i2] = showdown2.subParser("codeSpans")(tableLines[i2], options, globals); | |
| 4034 | + } | |
| 4035 | + var rawHeaders = tableLines[0].split("|").map(function(s2) { | |
| 4036 | + return s2.trim(); | |
| 4037 | + }), rawStyles = tableLines[1].split("|").map(function(s2) { | |
| 4038 | + return s2.trim(); | |
| 4039 | + }), rawCells = [], headers = [], styles = [], cells = []; | |
| 4040 | + tableLines.shift(); | |
| 4041 | + tableLines.shift(); | |
| 4042 | + for (i2 = 0; i2 < tableLines.length; ++i2) { | |
| 4043 | + if (tableLines[i2].trim() === "") { | |
| 4044 | + continue; | |
| 4045 | + } | |
| 4046 | + rawCells.push( | |
| 4047 | + tableLines[i2].split("|").map(function(s2) { | |
| 4048 | + return s2.trim(); | |
| 4049 | + }) | |
| 4050 | + ); | |
| 4051 | + } | |
| 4052 | + if (rawHeaders.length < rawStyles.length) { | |
| 4053 | + return rawTable; | |
| 4054 | + } | |
| 4055 | + for (i2 = 0; i2 < rawStyles.length; ++i2) { | |
| 4056 | + styles.push(parseStyles(rawStyles[i2])); | |
| 4057 | + } | |
| 4058 | + for (i2 = 0; i2 < rawHeaders.length; ++i2) { | |
| 4059 | + if (showdown2.helper.isUndefined(styles[i2])) { | |
| 4060 | + styles[i2] = ""; | |
| 4061 | + } | |
| 4062 | + headers.push(parseHeaders(rawHeaders[i2], styles[i2])); | |
| 4063 | + } | |
| 4064 | + for (i2 = 0; i2 < rawCells.length; ++i2) { | |
| 4065 | + var row = []; | |
| 4066 | + for (var ii = 0; ii < headers.length; ++ii) { | |
| 4067 | + if (showdown2.helper.isUndefined(rawCells[i2][ii])) { | |
| 4068 | + } | |
| 4069 | + row.push(parseCells(rawCells[i2][ii], styles[ii])); | |
| 4070 | + } | |
| 4071 | + cells.push(row); | |
| 4072 | + } | |
| 4073 | + return buildTable(headers, cells); | |
| 4074 | + } | |
| 4075 | + text2 = globals.converter._dispatch("tables.before", text2, options, globals); | |
| 4076 | + text2 = text2.replace(/\\(\|)/g, showdown2.helper.escapeCharactersCallback); | |
| 4077 | + text2 = text2.replace(tableRgx, parseTable); | |
| 4078 | + text2 = text2.replace(singeColTblRgx, parseTable); | |
| 4079 | + text2 = globals.converter._dispatch("tables.after", text2, options, globals); | |
| 4080 | + return text2; | |
| 4081 | + }); | |
| 4082 | + showdown2.subParser("underline", function(text2, options, globals) { | |
| 4083 | + "use strict"; | |
| 4084 | + if (!options.underline) { | |
| 4085 | + return text2; | |
| 4086 | + } | |
| 4087 | + text2 = globals.converter._dispatch("underline.before", text2, options, globals); | |
| 4088 | + if (options.literalMidWordUnderscores) { | |
| 4089 | + text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) { | |
| 4090 | + return "<u>" + txt + "</u>"; | |
| 4091 | + }); | |
| 4092 | + text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) { | |
| 4093 | + return "<u>" + txt + "</u>"; | |
| 4094 | + }); | |
| 4095 | + } else { | |
| 4096 | + text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) { | |
| 4097 | + return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm; | |
| 4098 | + }); | |
| 4099 | + text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) { | |
| 4100 | + return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm; | |
| 4101 | + }); | |
| 4102 | + } | |
| 4103 | + text2 = text2.replace(/(_)/g, showdown2.helper.escapeCharactersCallback); | |
| 4104 | + text2 = globals.converter._dispatch("underline.after", text2, options, globals); | |
| 4105 | + return text2; | |
| 4106 | + }); | |
| 4107 | + showdown2.subParser("unescapeSpecialChars", function(text2, options, globals) { | |
| 4108 | + "use strict"; | |
| 4109 | + text2 = globals.converter._dispatch("unescapeSpecialChars.before", text2, options, globals); | |
| 4110 | + text2 = text2.replace(/¨E(\d+)E/g, function(wholeMatch, m1) { | |
| 4111 | + var charCodeToReplace = parseInt(m1); | |
| 4112 | + return String.fromCharCode(charCodeToReplace); | |
| 4113 | + }); | |
| 4114 | + text2 = globals.converter._dispatch("unescapeSpecialChars.after", text2, options, globals); | |
| 4115 | + return text2; | |
| 4116 | + }); | |
| 4117 | + showdown2.subParser("makeMarkdown.blockquote", function(node, globals) { | |
| 4118 | + "use strict"; | |
| 4119 | + var txt = ""; | |
| 4120 | + if (node.hasChildNodes()) { | |
| 4121 | + var children = node.childNodes, childrenLength = children.length; | |
| 4122 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4123 | + var innerTxt = showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4124 | + if (innerTxt === "") { | |
| 4125 | + continue; | |
| 4126 | + } | |
| 4127 | + txt += innerTxt; | |
| 4128 | + } | |
| 4129 | + } | |
| 4130 | + txt = txt.trim(); | |
| 4131 | + txt = "> " + txt.split("\n").join("\n> "); | |
| 4132 | + return txt; | |
| 4133 | + }); | |
| 4134 | + showdown2.subParser("makeMarkdown.codeBlock", function(node, globals) { | |
| 4135 | + "use strict"; | |
| 4136 | + var lang = node.getAttribute("language"), num = node.getAttribute("precodenum"); | |
| 4137 | + return "```" + lang + "\n" + globals.preList[num] + "\n```"; | |
| 4138 | + }); | |
| 4139 | + showdown2.subParser("makeMarkdown.codeSpan", function(node) { | |
| 4140 | + "use strict"; | |
| 4141 | + return "`" + node.innerHTML + "`"; | |
| 4142 | + }); | |
| 4143 | + showdown2.subParser("makeMarkdown.emphasis", function(node, globals) { | |
| 4144 | + "use strict"; | |
| 4145 | + var txt = ""; | |
| 4146 | + if (node.hasChildNodes()) { | |
| 4147 | + txt += "*"; | |
| 4148 | + var children = node.childNodes, childrenLength = children.length; | |
| 4149 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4150 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4151 | + } | |
| 4152 | + txt += "*"; | |
| 4153 | + } | |
| 4154 | + return txt; | |
| 4155 | + }); | |
| 4156 | + showdown2.subParser("makeMarkdown.header", function(node, globals, headerLevel) { | |
| 4157 | + "use strict"; | |
| 4158 | + var headerMark = new Array(headerLevel + 1).join("#"), txt = ""; | |
| 4159 | + if (node.hasChildNodes()) { | |
| 4160 | + txt = headerMark + " "; | |
| 4161 | + var children = node.childNodes, childrenLength = children.length; | |
| 4162 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4163 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4164 | + } | |
| 4165 | + } | |
| 4166 | + return txt; | |
| 4167 | + }); | |
| 4168 | + showdown2.subParser("makeMarkdown.hr", function() { | |
| 4169 | + "use strict"; | |
| 4170 | + return "---"; | |
| 4171 | + }); | |
| 4172 | + showdown2.subParser("makeMarkdown.image", function(node) { | |
| 4173 | + "use strict"; | |
| 4174 | + var txt = ""; | |
| 4175 | + if (node.hasAttribute("src")) { | |
| 4176 | + txt += " + ">"; | |
| 4178 | + if (node.hasAttribute("width") && node.hasAttribute("height")) { | |
| 4179 | + txt += " =" + node.getAttribute("width") + "x" + node.getAttribute("height"); | |
| 4180 | + } | |
| 4181 | + if (node.hasAttribute("title")) { | |
| 4182 | + txt += ' "' + node.getAttribute("title") + '"'; | |
| 4183 | + } | |
| 4184 | + txt += ")"; | |
| 4185 | + } | |
| 4186 | + return txt; | |
| 4187 | + }); | |
| 4188 | + showdown2.subParser("makeMarkdown.links", function(node, globals) { | |
| 4189 | + "use strict"; | |
| 4190 | + var txt = ""; | |
| 4191 | + if (node.hasChildNodes() && node.hasAttribute("href")) { | |
| 4192 | + var children = node.childNodes, childrenLength = children.length; | |
| 4193 | + txt = "["; | |
| 4194 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4195 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4196 | + } | |
| 4197 | + txt += "]("; | |
| 4198 | + txt += "<" + node.getAttribute("href") + ">"; | |
| 4199 | + if (node.hasAttribute("title")) { | |
| 4200 | + txt += ' "' + node.getAttribute("title") + '"'; | |
| 4201 | + } | |
| 4202 | + txt += ")"; | |
| 4203 | + } | |
| 4204 | + return txt; | |
| 4205 | + }); | |
| 4206 | + showdown2.subParser("makeMarkdown.list", function(node, globals, type) { | |
| 4207 | + "use strict"; | |
| 4208 | + var txt = ""; | |
| 4209 | + if (!node.hasChildNodes()) { | |
| 4210 | + return ""; | |
| 4211 | + } | |
| 4212 | + var listItems = node.childNodes, listItemsLenght = listItems.length, listNum = node.getAttribute("start") || 1; | |
| 4213 | + for (var i2 = 0; i2 < listItemsLenght; ++i2) { | |
| 4214 | + if (typeof listItems[i2].tagName === "undefined" || listItems[i2].tagName.toLowerCase() !== "li") { | |
| 4215 | + continue; | |
| 4216 | + } | |
| 4217 | + var bullet = ""; | |
| 4218 | + if (type === "ol") { | |
| 4219 | + bullet = listNum.toString() + ". "; | |
| 4220 | + } else { | |
| 4221 | + bullet = "- "; | |
| 4222 | + } | |
| 4223 | + txt += bullet + showdown2.subParser("makeMarkdown.listItem")(listItems[i2], globals); | |
| 4224 | + ++listNum; | |
| 4225 | + } | |
| 4226 | + txt += "\n<!-- -->\n"; | |
| 4227 | + return txt.trim(); | |
| 4228 | + }); | |
| 4229 | + showdown2.subParser("makeMarkdown.listItem", function(node, globals) { | |
| 4230 | + "use strict"; | |
| 4231 | + var listItemTxt = ""; | |
| 4232 | + var children = node.childNodes, childrenLenght = children.length; | |
| 4233 | + for (var i2 = 0; i2 < childrenLenght; ++i2) { | |
| 4234 | + listItemTxt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4235 | + } | |
| 4236 | + if (!/\n$/.test(listItemTxt)) { | |
| 4237 | + listItemTxt += "\n"; | |
| 4238 | + } else { | |
| 4239 | + listItemTxt = listItemTxt.split("\n").join("\n ").replace(/^ {4}$/gm, "").replace(/\n\n+/g, "\n\n"); | |
| 4240 | + } | |
| 4241 | + return listItemTxt; | |
| 4242 | + }); | |
| 4243 | + showdown2.subParser("makeMarkdown.node", function(node, globals, spansOnly) { | |
| 4244 | + "use strict"; | |
| 4245 | + spansOnly = spansOnly || false; | |
| 4246 | + var txt = ""; | |
| 4247 | + if (node.nodeType === 3) { | |
| 4248 | + return showdown2.subParser("makeMarkdown.txt")(node, globals); | |
| 4249 | + } | |
| 4250 | + if (node.nodeType === 8) { | |
| 4251 | + return "<!--" + node.data + "-->\n\n"; | |
| 4252 | + } | |
| 4253 | + if (node.nodeType !== 1) { | |
| 4254 | + return ""; | |
| 4255 | + } | |
| 4256 | + var tagName = node.tagName.toLowerCase(); | |
| 4257 | + switch (tagName) { | |
| 4258 | + // | |
| 4259 | + // BLOCKS | |
| 4260 | + // | |
| 4261 | + case "h1": | |
| 4262 | + if (!spansOnly) { | |
| 4263 | + txt = showdown2.subParser("makeMarkdown.header")(node, globals, 1) + "\n\n"; | |
| 4264 | + } | |
| 4265 | + break; | |
| 4266 | + case "h2": | |
| 4267 | + if (!spansOnly) { | |
| 4268 | + txt = showdown2.subParser("makeMarkdown.header")(node, globals, 2) + "\n\n"; | |
| 4269 | + } | |
| 4270 | + break; | |
| 4271 | + case "h3": | |
| 4272 | + if (!spansOnly) { | |
| 4273 | + txt = showdown2.subParser("makeMarkdown.header")(node, globals, 3) + "\n\n"; | |
| 4274 | + } | |
| 4275 | + break; | |
| 4276 | + case "h4": | |
| 4277 | + if (!spansOnly) { | |
| 4278 | + txt = showdown2.subParser("makeMarkdown.header")(node, globals, 4) + "\n\n"; | |
| 4279 | + } | |
| 4280 | + break; | |
| 4281 | + case "h5": | |
| 4282 | + if (!spansOnly) { | |
| 4283 | + txt = showdown2.subParser("makeMarkdown.header")(node, globals, 5) + "\n\n"; | |
| 4284 | + } | |
| 4285 | + break; | |
| 4286 | + case "h6": | |
| 4287 | + if (!spansOnly) { | |
| 4288 | + txt = showdown2.subParser("makeMarkdown.header")(node, globals, 6) + "\n\n"; | |
| 4289 | + } | |
| 4290 | + break; | |
| 4291 | + case "p": | |
| 4292 | + if (!spansOnly) { | |
| 4293 | + txt = showdown2.subParser("makeMarkdown.paragraph")(node, globals) + "\n\n"; | |
| 4294 | + } | |
| 4295 | + break; | |
| 4296 | + case "blockquote": | |
| 4297 | + if (!spansOnly) { | |
| 4298 | + txt = showdown2.subParser("makeMarkdown.blockquote")(node, globals) + "\n\n"; | |
| 4299 | + } | |
| 4300 | + break; | |
| 4301 | + case "hr": | |
| 4302 | + if (!spansOnly) { | |
| 4303 | + txt = showdown2.subParser("makeMarkdown.hr")(node, globals) + "\n\n"; | |
| 4304 | + } | |
| 4305 | + break; | |
| 4306 | + case "ol": | |
| 4307 | + if (!spansOnly) { | |
| 4308 | + txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ol") + "\n\n"; | |
| 4309 | + } | |
| 4310 | + break; | |
| 4311 | + case "ul": | |
| 4312 | + if (!spansOnly) { | |
| 4313 | + txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ul") + "\n\n"; | |
| 4314 | + } | |
| 4315 | + break; | |
| 4316 | + case "precode": | |
| 4317 | + if (!spansOnly) { | |
| 4318 | + txt = showdown2.subParser("makeMarkdown.codeBlock")(node, globals) + "\n\n"; | |
| 4319 | + } | |
| 4320 | + break; | |
| 4321 | + case "pre": | |
| 4322 | + if (!spansOnly) { | |
| 4323 | + txt = showdown2.subParser("makeMarkdown.pre")(node, globals) + "\n\n"; | |
| 4324 | + } | |
| 4325 | + break; | |
| 4326 | + case "table": | |
| 4327 | + if (!spansOnly) { | |
| 4328 | + txt = showdown2.subParser("makeMarkdown.table")(node, globals) + "\n\n"; | |
| 4329 | + } | |
| 4330 | + break; | |
| 4331 | + // | |
| 4332 | + // SPANS | |
| 4333 | + // | |
| 4334 | + case "code": | |
| 4335 | + txt = showdown2.subParser("makeMarkdown.codeSpan")(node, globals); | |
| 4336 | + break; | |
| 4337 | + case "em": | |
| 4338 | + case "i": | |
| 4339 | + txt = showdown2.subParser("makeMarkdown.emphasis")(node, globals); | |
| 4340 | + break; | |
| 4341 | + case "strong": | |
| 4342 | + case "b": | |
| 4343 | + txt = showdown2.subParser("makeMarkdown.strong")(node, globals); | |
| 4344 | + break; | |
| 4345 | + case "del": | |
| 4346 | + txt = showdown2.subParser("makeMarkdown.strikethrough")(node, globals); | |
| 4347 | + break; | |
| 4348 | + case "a": | |
| 4349 | + txt = showdown2.subParser("makeMarkdown.links")(node, globals); | |
| 4350 | + break; | |
| 4351 | + case "img": | |
| 4352 | + txt = showdown2.subParser("makeMarkdown.image")(node, globals); | |
| 4353 | + break; | |
| 4354 | + default: | |
| 4355 | + txt = node.outerHTML + "\n\n"; | |
| 4356 | + } | |
| 4357 | + return txt; | |
| 4358 | + }); | |
| 4359 | + showdown2.subParser("makeMarkdown.paragraph", function(node, globals) { | |
| 4360 | + "use strict"; | |
| 4361 | + var txt = ""; | |
| 4362 | + if (node.hasChildNodes()) { | |
| 4363 | + var children = node.childNodes, childrenLength = children.length; | |
| 4364 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4365 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4366 | + } | |
| 4367 | + } | |
| 4368 | + txt = txt.trim(); | |
| 4369 | + return txt; | |
| 4370 | + }); | |
| 4371 | + showdown2.subParser("makeMarkdown.pre", function(node, globals) { | |
| 4372 | + "use strict"; | |
| 4373 | + var num = node.getAttribute("prenum"); | |
| 4374 | + return "<pre>" + globals.preList[num] + "</pre>"; | |
| 4375 | + }); | |
| 4376 | + showdown2.subParser("makeMarkdown.strikethrough", function(node, globals) { | |
| 4377 | + "use strict"; | |
| 4378 | + var txt = ""; | |
| 4379 | + if (node.hasChildNodes()) { | |
| 4380 | + txt += "~~"; | |
| 4381 | + var children = node.childNodes, childrenLength = children.length; | |
| 4382 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4383 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4384 | + } | |
| 4385 | + txt += "~~"; | |
| 4386 | + } | |
| 4387 | + return txt; | |
| 4388 | + }); | |
| 4389 | + showdown2.subParser("makeMarkdown.strong", function(node, globals) { | |
| 4390 | + "use strict"; | |
| 4391 | + var txt = ""; | |
| 4392 | + if (node.hasChildNodes()) { | |
| 4393 | + txt += "**"; | |
| 4394 | + var children = node.childNodes, childrenLength = children.length; | |
| 4395 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4396 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); | |
| 4397 | + } | |
| 4398 | + txt += "**"; | |
| 4399 | + } | |
| 4400 | + return txt; | |
| 4401 | + }); | |
| 4402 | + showdown2.subParser("makeMarkdown.table", function(node, globals) { | |
| 4403 | + "use strict"; | |
| 4404 | + var txt = "", tableArray = [[], []], headings = node.querySelectorAll("thead>tr>th"), rows = node.querySelectorAll("tbody>tr"), i2, ii; | |
| 4405 | + for (i2 = 0; i2 < headings.length; ++i2) { | |
| 4406 | + var headContent = showdown2.subParser("makeMarkdown.tableCell")(headings[i2], globals), allign = "---"; | |
| 4407 | + if (headings[i2].hasAttribute("style")) { | |
| 4408 | + var style = headings[i2].getAttribute("style").toLowerCase().replace(/\s/g, ""); | |
| 4409 | + switch (style) { | |
| 4410 | + case "text-align:left;": | |
| 4411 | + allign = ":---"; | |
| 4412 | + break; | |
| 4413 | + case "text-align:right;": | |
| 4414 | + allign = "---:"; | |
| 4415 | + break; | |
| 4416 | + case "text-align:center;": | |
| 4417 | + allign = ":---:"; | |
| 4418 | + break; | |
| 4419 | + } | |
| 4420 | + } | |
| 4421 | + tableArray[0][i2] = headContent.trim(); | |
| 4422 | + tableArray[1][i2] = allign; | |
| 4423 | + } | |
| 4424 | + for (i2 = 0; i2 < rows.length; ++i2) { | |
| 4425 | + var r2 = tableArray.push([]) - 1, cols = rows[i2].getElementsByTagName("td"); | |
| 4426 | + for (ii = 0; ii < headings.length; ++ii) { | |
| 4427 | + var cellContent = " "; | |
| 4428 | + if (typeof cols[ii] !== "undefined") { | |
| 4429 | + cellContent = showdown2.subParser("makeMarkdown.tableCell")(cols[ii], globals); | |
| 4430 | + } | |
| 4431 | + tableArray[r2].push(cellContent); | |
| 4432 | + } | |
| 4433 | + } | |
| 4434 | + var cellSpacesCount = 3; | |
| 4435 | + for (i2 = 0; i2 < tableArray.length; ++i2) { | |
| 4436 | + for (ii = 0; ii < tableArray[i2].length; ++ii) { | |
| 4437 | + var strLen = tableArray[i2][ii].length; | |
| 4438 | + if (strLen > cellSpacesCount) { | |
| 4439 | + cellSpacesCount = strLen; | |
| 4440 | + } | |
| 4441 | + } | |
| 4442 | + } | |
| 4443 | + for (i2 = 0; i2 < tableArray.length; ++i2) { | |
| 4444 | + for (ii = 0; ii < tableArray[i2].length; ++ii) { | |
| 4445 | + if (i2 === 1) { | |
| 4446 | + if (tableArray[i2][ii].slice(-1) === ":") { | |
| 4447 | + tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii].slice(-1), cellSpacesCount - 1, "-") + ":"; | |
| 4448 | + } else { | |
| 4449 | + tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount, "-"); | |
| 4450 | + } | |
| 4451 | + } else { | |
| 4452 | + tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount); | |
| 4453 | + } | |
| 4454 | + } | |
| 4455 | + txt += "| " + tableArray[i2].join(" | ") + " |\n"; | |
| 4456 | + } | |
| 4457 | + return txt.trim(); | |
| 4458 | + }); | |
| 4459 | + showdown2.subParser("makeMarkdown.tableCell", function(node, globals) { | |
| 4460 | + "use strict"; | |
| 4461 | + var txt = ""; | |
| 4462 | + if (!node.hasChildNodes()) { | |
| 4463 | + return ""; | |
| 4464 | + } | |
| 4465 | + var children = node.childNodes, childrenLength = children.length; | |
| 4466 | + for (var i2 = 0; i2 < childrenLength; ++i2) { | |
| 4467 | + txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals, true); | |
| 4468 | + } | |
| 4469 | + return txt.trim(); | |
| 4470 | + }); | |
| 4471 | + showdown2.subParser("makeMarkdown.txt", function(node) { | |
| 4472 | + "use strict"; | |
| 4473 | + var txt = node.nodeValue; | |
| 4474 | + txt = txt.replace(/ +/g, " "); | |
| 4475 | + txt = txt.replace(/¨NBSP;/g, " "); | |
| 4476 | + txt = showdown2.helper.unescapeHTMLEntities(txt); | |
| 4477 | + txt = txt.replace(/([*_~|`])/g, "\\$1"); | |
| 4478 | + txt = txt.replace(/^(\s*)>/g, "\\$1>"); | |
| 4479 | + txt = txt.replace(/^#/gm, "\\#"); | |
| 4480 | + txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"); | |
| 4481 | + txt = txt.replace(/^( {0,3}\d+)\./gm, "$1\\."); | |
| 4482 | + txt = txt.replace(/^( {0,3})([+-])/gm, "$1\\$2"); | |
| 4483 | + txt = txt.replace(/]([\s]*)\(/g, "\\]$1\\("); | |
| 4484 | + txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"); | |
| 4485 | + return txt; | |
| 4486 | + }); | |
| 4487 | + var root = this; | |
| 4488 | + if (typeof define === "function" && define.amd) { | |
| 4489 | + define(function() { | |
| 4490 | + "use strict"; | |
| 4491 | + return showdown2; | |
| 4492 | + }); | |
| 4493 | + } else if (typeof module !== "undefined" && module.exports) { | |
| 4494 | + module.exports = showdown2; | |
| 4495 | + } else { | |
| 4496 | + root.showdown = showdown2; | |
| 4497 | + } | |
| 4498 | + }).call(exports); | |
| 4499 | + } | |
| 4500 | + }); | |
| 4501 | + | |
| 879 | 4502 | // packages/blocks/build-module/index.mjs |
| 880 | 4503 | var index_exports = {}; |
| 881 | 4504 | __export(index_exports, { |
| 882 | 4505 | __EXPERIMENTAL_ELEMENTS: () => __EXPERIMENTAL_ELEMENTS, |
| @@ -891,9 +4514,8 @@ | ||
| 891 | 4514 | __unstableGetInnerBlocksProps: () => getInnerBlocksProps, |
| 892 | 4515 | __unstableSerializeAndClean: () => __unstableSerializeAndClean, |
| 893 | 4516 | children: () => children_default, |
| 894 | 4517 | cloneBlock: () => cloneBlock, |
| 895 | - cloneSanitizedBlock: () => cloneSanitizedBlock, | |
| 896 | 4518 | createBlock: () => createBlock, |
| 897 | 4519 | createBlocksFromInnerBlocksTemplate: () => createBlocksFromInnerBlocksTemplate, |
| 898 | 4520 | doBlocksMatchTemplate: () => doBlocksMatchTemplate, |
| 899 | 4521 | findTransform: () => findTransform, |
| @@ -940,9 +4562,8 @@ | ||
| 940 | 4562 | registerBlockCollection: () => registerBlockCollection, |
| 941 | 4563 | registerBlockStyle: () => registerBlockStyle, |
| 942 | 4564 | registerBlockType: () => registerBlockType, |
| 943 | 4565 | registerBlockVariation: () => registerBlockVariation, |
| 944 | - sanitizeBlockAttributes: () => sanitizeBlockAttributes, | |
| 945 | 4566 | serialize: () => serialize, |
| 946 | 4567 | serializeRawBlock: () => serializeRawBlock, |
| 947 | 4568 | setCategories: () => setCategories2, |
| 948 | 4569 | setDefaultBlockName: () => setDefaultBlockName, |
| @@ -998,13 +4619,13 @@ | ||
| 998 | 4619 | while (result.charAt(end - 1) === "\0") |
| 999 | 4620 | end--; |
| 1000 | 4621 | return result.slice(start, end).split("\0").map(transform).join(delimiter); |
| 1001 | 4622 | } |
| 1002 | - function replace(input, re2, value) { | |
| 1003 | - if (re2 instanceof RegExp) | |
| 1004 | - return input.replace(re2, value); | |
| 1005 | - return re2.reduce(function(input2, re3) { | |
| 1006 | - return input2.replace(re3, value); | |
| 4623 | + function replace(input, re, value) { | |
| 4624 | + if (re instanceof RegExp) | |
| 4625 | + return input.replace(re, value); | |
| 4626 | + return re.reduce(function(input2, re2) { | |
| 4627 | + return input2.replace(re2, value); | |
| 1007 | 4628 | }, input); |
| 1008 | 4629 | } |
| 1009 | 4630 | |
| 1010 | 4631 | // node_modules/pascal-case/dist.es2015/index.js |
| @@ -1206,27 +4827,27 @@ | ||
| 1206 | 4827 | |
| 1207 | 4828 | // node_modules/colord/plugins/names.mjs |
| 1208 | 4829 | function names_default(e2, f2) { |
| 1209 | 4830 | 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 = {}; |
| 1210 | - for (var d3 in a2) r2[a2[d3]] = d3; | |
| 1211 | - var l4 = {}; | |
| 4831 | + for (var d2 in a2) r2[a2[d2]] = d2; | |
| 4832 | + var l2 = {}; | |
| 1212 | 4833 | e2.prototype.toName = function(f3) { |
| 1213 | 4834 | if (!(this.rgba.a || this.rgba.r || this.rgba.g || this.rgba.b)) return "transparent"; |
| 1214 | - var d4, i2, n2 = r2[this.toHex()]; | |
| 4835 | + var d3, i2, n2 = r2[this.toHex()]; | |
| 1215 | 4836 | if (n2) return n2; |
| 1216 | 4837 | if (null == f3 ? void 0 : f3.closest) { |
| 1217 | - var o3 = this.toRgb(), t3 = 1 / 0, b3 = "black"; | |
| 1218 | - if (!l4.length) for (var c2 in a2) l4[c2] = new e2(a2[c2]).toRgb(); | |
| 1219 | - for (var g3 in a2) { | |
| 1220 | - var u2 = (d4 = o3, i2 = l4[g3], Math.pow(d4.r - i2.r, 2) + Math.pow(d4.g - i2.g, 2) + Math.pow(d4.b - i2.b, 2)); | |
| 1221 | - u2 < t3 && (t3 = u2, b3 = g3); | |
| 4838 | + var o3 = this.toRgb(), t3 = 1 / 0, b2 = "black"; | |
| 4839 | + if (!l2.length) for (var c2 in a2) l2[c2] = new e2(a2[c2]).toRgb(); | |
| 4840 | + for (var g2 in a2) { | |
| 4841 | + 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)); | |
| 4842 | + u2 < t3 && (t3 = u2, b2 = g2); | |
| 1222 | 4843 | } |
| 1223 | - return b3; | |
| 4844 | + return b2; | |
| 1224 | 4845 | } |
| 1225 | 4846 | }; |
| 1226 | 4847 | f2.string.push([function(f3) { |
| 1227 | - var r3 = f3.toLowerCase(), d4 = "transparent" === r3 ? "#0000" : a2[r3]; | |
| 1228 | - return d4 ? new e2(d4).toRgb() : null; | |
| 4848 | + var r3 = f3.toLowerCase(), d3 = "transparent" === r3 ? "#0000" : a2[r3]; | |
| 4849 | + return d3 ? new e2(d3).toRgb() : null; | |
| 1229 | 4850 | }, "name"]); |
| 1230 | 4851 | } |
| 1231 | 4852 | |
| 1232 | 4853 | // node_modules/colord/plugins/a11y.mjs |
| @@ -1242,10 +4863,10 @@ | ||
| 1242 | 4863 | 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; |
| 1243 | 4864 | var o4, r2, n2; |
| 1244 | 4865 | }, o3.prototype.contrast = function(r2) { |
| 1245 | 4866 | void 0 === r2 && (r2 = "#FFF"); |
| 1246 | - var n2, a2, i2, e2, v3, u2, d3, c2 = r2 instanceof o3 ? r2 : new o3(r2); | |
| 1247 | - return e2 = this.rgba, v3 = c2.toRgb(), u2 = t2(e2), d3 = t2(v3), n2 = u2 > d3 ? (u2 + 0.05) / (d3 + 0.05) : (d3 + 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; | |
| 4867 | + var n2, a2, i2, e2, v2, u2, d2, c2 = r2 instanceof o3 ? r2 : new o3(r2); | |
| 4868 | + 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; | |
| 1248 | 4869 | }, o3.prototype.isReadable = function(o4, t3) { |
| 1249 | 4870 | 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); |
| 1250 | 4871 | var r2, n2, a2, i2, e2; |
| 1251 | 4872 | }; |
| @@ -1309,13 +4930,8 @@ | ||
| 1309 | 4930 | value: ["background", "backgroundPosition"], |
| 1310 | 4931 | support: ["background", "backgroundPosition"], |
| 1311 | 4932 | useEngine: true |
| 1312 | 4933 | }, |
| 1313 | - backgroundGradient: { | |
| 1314 | - value: ["background", "gradient"], | |
| 1315 | - support: ["background", "gradient"], | |
| 1316 | - useEngine: true | |
| 1317 | - }, | |
| 1318 | 4934 | borderColor: { |
| 1319 | 4935 | value: ["border", "color"], |
| 1320 | 4936 | support: ["__experimentalBorder", "color"], |
| 1321 | 4937 | useEngine: true |
| @@ -1480,13 +5096,8 @@ | ||
| 1480 | 5096 | value: ["dimensions", "minHeight"], |
| 1481 | 5097 | support: ["dimensions", "minHeight"], |
| 1482 | 5098 | useEngine: true |
| 1483 | 5099 | }, |
| 1484 | - minWidth: { | |
| 1485 | - value: ["dimensions", "minWidth"], | |
| 1486 | - support: ["dimensions", "minWidth"], | |
| 1487 | - useEngine: true | |
| 1488 | - }, | |
| 1489 | 5100 | height: { |
| 1490 | 5101 | value: ["dimensions", "height"], |
| 1491 | 5102 | support: ["dimensions", "height"], |
| 1492 | 5103 | useEngine: true |
| @@ -1613,12 +5224,9 @@ | ||
| 1613 | 5224 | for (const [name, blockType] of Object.entries(definitions)) { |
| 1614 | 5225 | addBootstrappedBlockType2(name, blockType); |
| 1615 | 5226 | } |
| 1616 | 5227 | } |
| 1617 | - function getBlockSettingsFromMetadata({ | |
| 1618 | - textdomain, | |
| 1619 | - ...metadata | |
| 1620 | - }) { | |
| 5228 | + function getBlockSettingsFromMetadata({ textdomain, ...metadata }) { | |
| 1621 | 5229 | const allowedFields = [ |
| 1622 | 5230 | "apiVersion", |
| 1623 | 5231 | "title", |
| 1624 | 5232 | "category", |
| @@ -1696,23 +5304,20 @@ | ||
| 1696 | 5304 | ) |
| 1697 | 5305 | ); |
| 1698 | 5306 | } |
| 1699 | 5307 | if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) { |
| 1700 | - return Object.keys(settingValue).reduce( | |
| 1701 | - (accumulator, key) => { | |
| 1702 | - if (!i18nSchema[key]) { | |
| 1703 | - accumulator[key] = settingValue[key]; | |
| 1704 | - return accumulator; | |
| 1705 | - } | |
| 1706 | - accumulator[key] = translateBlockSettingUsingI18nSchema( | |
| 1707 | - i18nSchema[key], | |
| 1708 | - settingValue[key], | |
| 1709 | - textdomain | |
| 1710 | - ); | |
| 5308 | + return Object.keys(settingValue).reduce((accumulator, key) => { | |
| 5309 | + if (!i18nSchema[key]) { | |
| 5310 | + accumulator[key] = settingValue[key]; | |
| 1711 | 5311 | return accumulator; |
| 1712 | - }, | |
| 1713 | - {} | |
| 1714 | - ); | |
| 5312 | + } | |
| 5313 | + accumulator[key] = translateBlockSettingUsingI18nSchema( | |
| 5314 | + i18nSchema[key], | |
| 5315 | + settingValue[key], | |
| 5316 | + textdomain | |
| 5317 | + ); | |
| 5318 | + return accumulator; | |
| 5319 | + }, {}); | |
| 1715 | 5320 | } |
| 1716 | 5321 | return settingValue; |
| 1717 | 5322 | } |
| 1718 | 5323 | function registerBlockCollection(namespace, { title, icon }) { |
| @@ -1795,15 +5400,9 @@ | ||
| 1795 | 5400 | var getBlockVariations = (blockName, scope) => { |
| 1796 | 5401 | return (0, import_data.select)(store).getBlockVariations(blockName, scope); |
| 1797 | 5402 | }; |
| 1798 | 5403 | var registerBlockVariation = (blockName, variation) => { |
| 1799 | - if (Array.isArray(variation)) { | |
| 1800 | - for (const v3 of variation) { | |
| 1801 | - if (typeof v3.name !== "string") { | |
| 1802 | - (0, import_warning.default)("Variation names must be unique strings."); | |
| 1803 | - } | |
| 1804 | - } | |
| 1805 | - } else if (typeof variation.name !== "string") { | |
| 5404 | + if (typeof variation.name !== "string") { | |
| 1806 | 5405 | (0, import_warning.default)("Variation names must be unique strings."); |
| 1807 | 5406 | } |
| 1808 | 5407 | (0, import_data.dispatch)(store).addBlockVariations(blockName, variation); |
| 1809 | 5408 | }; |
| @@ -1912,11 +5511,9 @@ | ||
| 1912 | 5511 | function isUnmodifiedBlock(block, role) { |
| 1913 | 5512 | const blockAttributes = getBlockType(block.name)?.attributes ?? {}; |
| 1914 | 5513 | const attributesByRole = role ? Object.entries(blockAttributes).filter(([key, definition]) => { |
| 1915 | 5514 | if (role === "content" && key === "metadata") { |
| 1916 | - return Object.keys( | |
| 1917 | - block.attributes[key]?.bindings ?? {} | |
| 1918 | - ).length > 0; | |
| 5515 | + return Object.keys(block.attributes[key]?.bindings ?? {}).length > 0; | |
| 1919 | 5516 | } |
| 1920 | 5517 | return definition.role === role || definition.__experimentalRole === role; |
| 1921 | 5518 | }) : []; |
| 1922 | 5519 | const attributesToCheck = !!attributesByRole.length ? attributesByRole : Object.entries(blockAttributes); |
| @@ -1937,26 +5534,25 @@ | ||
| 1937 | 5534 | function isValidIcon(icon) { |
| 1938 | 5535 | return !!icon && (typeof icon === "string" || (0, import_element.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element.Component); |
| 1939 | 5536 | } |
| 1940 | 5537 | function normalizeIconObject(icon) { |
| 1941 | - const resolvedIcon = icon || BLOCK_ICON_DEFAULT; | |
| 1942 | - if (isValidIcon(resolvedIcon)) { | |
| 1943 | - return { src: resolvedIcon }; | |
| 5538 | + icon = icon || BLOCK_ICON_DEFAULT; | |
| 5539 | + if (isValidIcon(icon)) { | |
| 5540 | + return { src: icon }; | |
| 1944 | 5541 | } |
| 1945 | - const iconDescriptor = resolvedIcon; | |
| 1946 | - if ("background" in iconDescriptor) { | |
| 1947 | - const colordBgColor = w(iconDescriptor.background); | |
| 5542 | + if ("background" in icon) { | |
| 5543 | + const colordBgColor = w(icon.background); | |
| 1948 | 5544 | const getColorContrast = (iconColor) => colordBgColor.contrast(iconColor); |
| 1949 | 5545 | const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast)); |
| 1950 | 5546 | return { |
| 1951 | - ...iconDescriptor, | |
| 1952 | - foreground: iconDescriptor.foreground ? iconDescriptor.foreground : ICON_COLORS.find( | |
| 5547 | + ...icon, | |
| 5548 | + foreground: icon.foreground ? icon.foreground : ICON_COLORS.find( | |
| 1953 | 5549 | (iconColor) => getColorContrast(iconColor) === maxContrast |
| 1954 | 5550 | ), |
| 1955 | 5551 | shadowColor: colordBgColor.alpha(0.3).toRgbString() |
| 1956 | 5552 | }; |
| 1957 | 5553 | } |
| 1958 | - return iconDescriptor; | |
| 5554 | + return icon; | |
| 1959 | 5555 | } |
| 1960 | 5556 | function normalizeBlockType(blockTypeOrName) { |
| 1961 | 5557 | if (typeof blockTypeOrName === "string") { |
| 1962 | 5558 | return getBlockType(blockTypeOrName); |
| @@ -1974,9 +5570,9 @@ | ||
| 1974 | 5570 | } |
| 1975 | 5571 | return (0, import_dom.__unstableStripHTML)(label); |
| 1976 | 5572 | } |
| 1977 | 5573 | function getAccessibleBlockLabel(blockType, attributes, position, direction = "vertical") { |
| 1978 | - const title = blockType?.title ?? ""; | |
| 5574 | + const title = blockType?.title; | |
| 1979 | 5575 | const label = blockType ? getBlockLabel(blockType, attributes, "accessibility") : ""; |
| 1980 | 5576 | const hasPosition = position !== void 0; |
| 1981 | 5577 | const hasLabel = label && label !== title; |
| 1982 | 5578 | if (hasPosition && direction === "vertical") { |
| @@ -2032,14 +5628,13 @@ | ||
| 2032 | 5628 | } |
| 2033 | 5629 | if (attributeSchema.type === "rich-text") { |
| 2034 | 5630 | return new import_rich_text.RichTextData(); |
| 2035 | 5631 | } |
| 2036 | - return void 0; | |
| 2037 | 5632 | } |
| 2038 | 5633 | function isBlockRegistered(name) { |
| 2039 | 5634 | return getBlockType(name) !== void 0; |
| 2040 | 5635 | } |
| 2041 | - function sanitizeBlockAttributes(name, attributes) { | |
| 5636 | + function __experimentalSanitizeBlockAttributes(name, attributes) { | |
| 2042 | 5637 | const blockType = getBlockType(name); |
| 2043 | 5638 | if (void 0 === blockType) { |
| 2044 | 5639 | throw new Error(`Block type '${name}' is not registered.`); |
| 2045 | 5640 | } |
| @@ -2063,9 +5658,9 @@ | ||
| 2063 | 5658 | if (void 0 !== _default) { |
| 2064 | 5659 | accumulator[key] = _default; |
| 2065 | 5660 | } |
| 2066 | 5661 | } |
| 2067 | - if (["node", "children"].indexOf(schema.source ?? "") !== -1) { | |
| 5662 | + if (["node", "children"].indexOf(schema.source) !== -1) { | |
| 2068 | 5663 | if (typeof accumulator[key] === "string") { |
| 2069 | 5664 | accumulator[key] = [accumulator[key]]; |
| 2070 | 5665 | } else if (!Array.isArray(accumulator[key])) { |
| 2071 | 5666 | accumulator[key] = []; |
| @@ -2075,15 +5670,8 @@ | ||
| 2075 | 5670 | }, |
| 2076 | 5671 | {} |
| 2077 | 5672 | ); |
| 2078 | 5673 | } |
| 2079 | - function __experimentalSanitizeBlockAttributes(name, attributes) { | |
| 2080 | - (0, import_deprecated.default)("__experimentalSanitizeBlockAttributes", { | |
| 2081 | - since: "7.1", | |
| 2082 | - alternative: "sanitizeBlockAttributes" | |
| 2083 | - }); | |
| 2084 | - return sanitizeBlockAttributes(name, attributes); | |
| 2085 | - } | |
| 2086 | 5674 | function getBlockAttributesNamesByRole(name, role) { |
| 2087 | 5675 | const attributes = getBlockType(name)?.attributes; |
| 2088 | 5676 | if (!attributes) { |
| 2089 | 5677 | return []; |
| @@ -2132,13 +5720,10 @@ | ||
| 2132 | 5720 | return attribute?.role === "content" || attribute?.__experimentalRole === "content"; |
| 2133 | 5721 | }); |
| 2134 | 5722 | } |
| 2135 | 5723 | function omit(object, keys) { |
| 2136 | - const keysArray = Array.isArray(keys) ? keys : [keys]; | |
| 2137 | 5724 | return Object.fromEntries( |
| 2138 | - Object.entries(object).filter( | |
| 2139 | - ([key]) => !keysArray.includes(key) | |
| 2140 | - ) | |
| 5725 | + Object.entries(object).filter(([key]) => !keys.includes(key)) | |
| 2141 | 5726 | ); |
| 2142 | 5727 | } |
| 2143 | 5728 | |
| 2144 | 5729 | // packages/blocks/build-module/store/reducer.mjs |
| @@ -2438,9 +6023,8 @@ | ||
| 2438 | 6023 | hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport2, |
| 2439 | 6024 | isMatchingSearchTerm: () => isMatchingSearchTerm |
| 2440 | 6025 | }); |
| 2441 | 6026 | var import_remove_accents = __toESM(require_remove_accents(), 1); |
| 2442 | - var import_es6 = __toESM(require_es6(), 1); | |
| 2443 | 6027 | var import_data4 = __toESM(require_data(), 1); |
| 2444 | 6028 | var import_rich_text2 = __toESM(require_rich_text(), 1); |
| 2445 | 6029 | var import_deprecated3 = __toESM(require_deprecated(), 1); |
| 2446 | 6030 | |
| @@ -2453,9 +6037,9 @@ | ||
| 2453 | 6037 | }); |
| 2454 | 6038 | return value ?? defaultValue; |
| 2455 | 6039 | }; |
| 2456 | 6040 | function isObject2(candidate) { |
| 2457 | - return typeof candidate === "object" && candidate !== null && candidate.constructor === Object; | |
| 6041 | + return typeof candidate === "object" && candidate.constructor === Object && candidate !== null; | |
| 2458 | 6042 | } |
| 2459 | 6043 | function matchesAttributes(blockAttributes, variationAttributes) { |
| 2460 | 6044 | if (isObject2(blockAttributes) && isObject2(variationAttributes)) { |
| 2461 | 6045 | return Object.entries(variationAttributes).every( |
| @@ -2541,32 +6125,30 @@ | ||
| 2541 | 6125 | if (!blockType) { |
| 2542 | 6126 | return []; |
| 2543 | 6127 | } |
| 2544 | 6128 | const supportKeys = []; |
| 2545 | - const supports = blockType?.supports; | |
| 2546 | - if (supports?.spacing?.blockGap) { | |
| 6129 | + if (blockType?.supports?.spacing?.blockGap) { | |
| 2547 | 6130 | supportKeys.push("blockGap"); |
| 2548 | 6131 | } |
| 2549 | - if (supports?.shadow) { | |
| 6132 | + if (blockType?.supports?.shadow) { | |
| 2550 | 6133 | supportKeys.push("shadow"); |
| 2551 | 6134 | } |
| 2552 | - const stylePropertyMap = __EXPERIMENTAL_STYLE_PROPERTY; | |
| 2553 | - Object.keys(stylePropertyMap).forEach((styleName) => { | |
| 2554 | - if (!stylePropertyMap[styleName].support) { | |
| 6135 | + Object.keys(__EXPERIMENTAL_STYLE_PROPERTY).forEach((styleName) => { | |
| 6136 | + if (!__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { | |
| 2555 | 6137 | return; |
| 2556 | 6138 | } |
| 2557 | - if (stylePropertyMap[styleName].requiresOptOut) { | |
| 2558 | - if (supports && stylePropertyMap[styleName].support[0] in supports && getValueFromObjectPath( | |
| 2559 | - supports, | |
| 2560 | - stylePropertyMap[styleName].support | |
| 6139 | + if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { | |
| 6140 | + if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && getValueFromObjectPath( | |
| 6141 | + blockType.supports, | |
| 6142 | + __EXPERIMENTAL_STYLE_PROPERTY[styleName].support | |
| 2561 | 6143 | ) !== false) { |
| 2562 | 6144 | supportKeys.push(styleName); |
| 2563 | 6145 | return; |
| 2564 | 6146 | } |
| 2565 | 6147 | } |
| 2566 | - if (supports && getValueFromObjectPath( | |
| 2567 | - supports, | |
| 2568 | - stylePropertyMap[styleName].support, | |
| 6148 | + if (getValueFromObjectPath( | |
| 6149 | + blockType.supports, | |
| 6150 | + __EXPERIMENTAL_STYLE_PROPERTY[styleName].support, | |
| 2569 | 6151 | false |
| 2570 | 6152 | )) { |
| 2571 | 6153 | supportKeys.push(styleName); |
| 2572 | 6154 | } |
| @@ -2572,11 +6154,9 @@ | ||
| 2572 | 6154 | } |
| 2573 | 6155 | }); |
| 2574 | 6156 | return filterElementBlockSupports(supportKeys, name, element); |
| 2575 | 6157 | }, |
| 2576 | - (state, name) => [ | |
| 2577 | - state.blockTypes[name] | |
| 2578 | - ] | |
| 6158 | + (state, name) => [state.blockTypes[name]] | |
| 2579 | 6159 | ); |
| 2580 | 6160 | function getBootstrappedBlockType(state, name) { |
| 2581 | 6161 | return state.bootstrappedBlockTypes[name]; |
| 2582 | 6162 | } |
| @@ -2602,9 +6182,13 @@ | ||
| 2602 | 6182 | } |
| 2603 | 6183 | } |
| 2604 | 6184 | return source.getFieldsList({ select: select3, context }); |
| 2605 | 6185 | }, |
| 2606 | - (state, source, blockContext) => [source.getFieldsList, source.usesContext, blockContext] | |
| 6186 | + (state, source, blockContext) => [ | |
| 6187 | + source.getFieldsList, | |
| 6188 | + source.usesContext, | |
| 6189 | + blockContext | |
| 6190 | + ] | |
| 2607 | 6191 | ) |
| 2608 | 6192 | ); |
| 2609 | 6193 | var hasContentRoleAttribute = (state, blockTypeName) => { |
| 2610 | 6194 | const blockType = getBlockType2(state, blockTypeName); |
| @@ -2653,33 +6237,20 @@ | ||
| 2653 | 6237 | scope |
| 2654 | 6238 | ); |
| 2655 | 6239 | }); |
| 2656 | 6240 | }, |
| 2657 | - (state, blockName) => [ | |
| 2658 | - state.blockVariations[blockName] | |
| 2659 | - ] | |
| 6241 | + (state, blockName) => [state.blockVariations[blockName]] | |
| 2660 | 6242 | ); |
| 2661 | - function getActiveBlockVariation(state, blockName, attributes, scope, innerContent) { | |
| 6243 | + function getActiveBlockVariation(state, blockName, attributes, scope) { | |
| 2662 | 6244 | const variations = getBlockVariations2(state, blockName, scope); |
| 2663 | 6245 | if (!variations) { |
| 2664 | 6246 | return variations; |
| 2665 | 6247 | } |
| 2666 | - if (innerContent) { | |
| 2667 | - const innerContentMatch = variations.find( | |
| 2668 | - (variation) => variation.innerContent && (0, import_es6.default)(variation.innerContent, innerContent) | |
| 2669 | - ); | |
| 2670 | - if (innerContentMatch) { | |
| 2671 | - return innerContentMatch; | |
| 2672 | - } | |
| 2673 | - } | |
| 2674 | 6248 | const blockType = getBlockType2(state, blockName); |
| 2675 | 6249 | const attributeKeys = Object.keys(blockType?.attributes || {}); |
| 2676 | 6250 | let match; |
| 2677 | 6251 | let maxMatchedAttributes = 0; |
| 2678 | 6252 | for (const variation of variations) { |
| 2679 | - if (variation.innerContent) { | |
| 2680 | - continue; | |
| 2681 | - } | |
| 2682 | 6253 | if (Array.isArray(variation.isActive)) { |
| 2683 | 6254 | const definedAttributes = variation.isActive.filter( |
| 2684 | 6255 | (attribute) => { |
| 2685 | 6256 | const topLevelAttribute = attribute.split(".")[0]; |
| @@ -2713,12 +6284,9 @@ | ||
| 2713 | 6284 | if (isMatch && definedAttributesLength > maxMatchedAttributes) { |
| 2714 | 6285 | match = variation; |
| 2715 | 6286 | maxMatchedAttributes = definedAttributesLength; |
| 2716 | 6287 | } |
| 2717 | - } else if (variation.isActive?.( | |
| 2718 | - attributes, | |
| 2719 | - variation.attributes | |
| 2720 | - )) { | |
| 6288 | + } else if (variation.isActive?.(attributes, variation.attributes)) { | |
| 2721 | 6289 | return match || variation; |
| 2722 | 6290 | } |
| 2723 | 6291 | } |
| 2724 | 6292 | if (!match && ["block", "transform"].includes(scope)) { |
| @@ -2729,10 +6297,10 @@ | ||
| 2729 | 6297 | return match; |
| 2730 | 6298 | } |
| 2731 | 6299 | function getDefaultBlockVariation(state, blockName, scope) { |
| 2732 | 6300 | const variations = getBlockVariations2(state, blockName, scope); |
| 2733 | - const defaultVariation = [...variations || []].reverse().find(({ isDefault }) => !!isDefault); | |
| 2734 | - return defaultVariation || variations?.[0]; | |
| 6301 | + const defaultVariation = [...variations].reverse().find(({ isDefault }) => !!isDefault); | |
| 6302 | + return defaultVariation || variations[0]; | |
| 2735 | 6303 | } |
| 2736 | 6304 | function getCategories(state) { |
| 2737 | 6305 | return state.categories; |
| 2738 | 6306 | } |
| @@ -2779,9 +6347,9 @@ | ||
| 2779 | 6347 | function isMatchingSearchTerm(state, nameOrType, searchTerm = "") { |
| 2780 | 6348 | const blockType = getNormalizedBlockType(state, nameOrType); |
| 2781 | 6349 | const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); |
| 2782 | 6350 | const isSearchMatch = (candidate) => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm); |
| 2783 | - return isSearchMatch(blockType?.title) || blockType?.keywords?.some(isSearchMatch) || isSearchMatch(blockType?.category) || typeof blockType?.description === "string" && isSearchMatch(blockType.description); | |
| 6351 | + return isSearchMatch(blockType.title) || blockType.keywords?.some(isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === "string" && isSearchMatch(blockType.description); | |
| 2784 | 6352 | } |
| 2785 | 6353 | var hasChildBlocks2 = (state, blockName) => { |
| 2786 | 6354 | return getChildBlockNames2(state, blockName).length > 0; |
| 2787 | 6355 | }; |
| @@ -2861,11 +6429,9 @@ | ||
| 2861 | 6429 | } |
| 2862 | 6430 | }); |
| 2863 | 6431 | return result; |
| 2864 | 6432 | } |
| 2865 | - var processBlockType = (name, blockSettings) => ({ | |
| 2866 | - select: select3 | |
| 2867 | - }) => { | |
| 6433 | + var processBlockType = (name, blockSettings) => ({ select: select3 }) => { | |
| 2868 | 6434 | const bootstrappedBlockType = select3.getBootstrappedBlockType(name); |
| 2869 | 6435 | const blockType = { |
| 2870 | 6436 | apiVersion: 1, |
| 2871 | 6437 | name, |
| @@ -2950,11 +6516,9 @@ | ||
| 2950 | 6516 | } |
| 2951 | 6517 | if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) { |
| 2952 | 6518 | settings.category = LEGACY_CATEGORY_MAPPING[settings.category]; |
| 2953 | 6519 | } |
| 2954 | - if ("category" in settings && !select3.getCategories().some( | |
| 2955 | - ({ slug }) => slug === settings.category | |
| 2956 | - )) { | |
| 6520 | + if ("category" in settings && !select3.getCategories().some(({ slug }) => slug === settings.category)) { | |
| 2957 | 6521 | (0, import_warning2.default)( |
| 2958 | 6522 | 'The block "' + name + '" is registered with an invalid category "' + settings.category + '".' |
| 2959 | 6523 | ); |
| 2960 | 6524 | delete settings.category; |
| @@ -2981,9 +6545,10 @@ | ||
| 2981 | 6545 | ); |
| 2982 | 6546 | } |
| 2983 | 6547 | if (!Array.isArray(settings?.parent) && settings?.parent !== void 0) { |
| 2984 | 6548 | (0, import_warning2.default)( |
| 2985 | - "Parent must be undefined or an array of block types, but it is " + settings.parent | |
| 6549 | + "Parent must be undefined or an array of block types, but it is ", | |
| 6550 | + settings.parent | |
| 2986 | 6551 | ); |
| 2987 | 6552 | return; |
| 2988 | 6553 | } |
| 2989 | 6554 | if (1 === settings?.parent?.length && name === settings.parent[0]) { |
| @@ -3173,43 +6738,47 @@ | ||
| 3173 | 6738 | (0, import_data5.register)(store); |
| 3174 | 6739 | unlock(store).registerPrivateSelectors(private_selectors_exports); |
| 3175 | 6740 | unlock(store).registerPrivateActions(private_actions_exports); |
| 3176 | 6741 | |
| 3177 | - // node_modules/uuid/dist/stringify.js | |
| 6742 | + // node_modules/uuid/dist/esm-browser/rng.js | |
| 6743 | + var getRandomValues; | |
| 6744 | + var rnds8 = new Uint8Array(16); | |
| 6745 | + function rng() { | |
| 6746 | + if (!getRandomValues) { | |
| 6747 | + getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); | |
| 6748 | + if (!getRandomValues) { | |
| 6749 | + throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); | |
| 6750 | + } | |
| 6751 | + } | |
| 6752 | + return getRandomValues(rnds8); | |
| 6753 | + } | |
| 6754 | + | |
| 6755 | + // node_modules/uuid/dist/esm-browser/stringify.js | |
| 3178 | 6756 | var byteToHex = []; |
| 3179 | 6757 | for (let i2 = 0; i2 < 256; ++i2) { |
| 3180 | 6758 | byteToHex.push((i2 + 256).toString(16).slice(1)); |
| 3181 | 6759 | } |
| 3182 | 6760 | function unsafeStringify(arr, offset = 0) { |
| 3183 | - 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(); | |
| 6761 | + 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]]; | |
| 3184 | 6762 | } |
| 3185 | 6763 | |
| 3186 | - // node_modules/uuid/dist/rng.js | |
| 3187 | - var rnds8 = new Uint8Array(16); | |
| 3188 | - function rng() { | |
| 3189 | - return crypto.getRandomValues(rnds8); | |
| 3190 | - } | |
| 6764 | + // node_modules/uuid/dist/esm-browser/native.js | |
| 6765 | + var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); | |
| 6766 | + var native_default = { | |
| 6767 | + randomUUID | |
| 6768 | + }; | |
| 3191 | 6769 | |
| 3192 | - // node_modules/uuid/dist/v4.js | |
| 6770 | + // node_modules/uuid/dist/esm-browser/v4.js | |
| 3193 | 6771 | function v4(options, buf, offset) { |
| 3194 | - if (!buf && !options && crypto.randomUUID) { | |
| 3195 | - return crypto.randomUUID(); | |
| 6772 | + if (native_default.randomUUID && !buf && !options) { | |
| 6773 | + return native_default.randomUUID(); | |
| 3196 | 6774 | } |
| 3197 | - return _v4(options, buf, offset); | |
| 3198 | - } | |
| 3199 | - function _v4(options, buf, offset) { | |
| 3200 | 6775 | options = options || {}; |
| 3201 | - const rnds = options.random ?? options.rng?.() ?? rng(); | |
| 3202 | - if (rnds.length < 16) { | |
| 3203 | - throw new Error("Random bytes length must be >= 16"); | |
| 3204 | - } | |
| 6776 | + const rnds = options.random || (options.rng || rng)(); | |
| 3205 | 6777 | rnds[6] = rnds[6] & 15 | 64; |
| 3206 | 6778 | rnds[8] = rnds[8] & 63 | 128; |
| 3207 | 6779 | if (buf) { |
| 3208 | 6780 | offset = offset || 0; |
| 3209 | - if (offset < 0 || offset + 16 > buf.length) { | |
| 3210 | - throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`); | |
| 3211 | - } | |
| 3212 | 6781 | for (let i2 = 0; i2 < 16; ++i2) { |
| 3213 | 6782 | buf[offset + i2] = rnds[i2]; |
| 3214 | 6783 | } |
| 3215 | 6784 | return buf; |
| @@ -3219,12 +6788,9 @@ | ||
| 3219 | 6788 | var v4_default = v4; |
| 3220 | 6789 | |
| 3221 | 6790 | // packages/blocks/build-module/api/factory.mjs |
| 3222 | 6791 | var import_hooks2 = __toESM(require_hooks(), 1); |
| 3223 | - var import_deprecated6 = __toESM(require_deprecated(), 1); | |
| 3224 | - var import_warning3 = __toESM(require_warning(), 1); | |
| 3225 | - var getBlockTypeWithTransformMetadata = (blockType, transform) => transform.variationName ? { ...blockType, variationName: transform.variationName } : blockType; | |
| 3226 | - function createBlock(name, attributes = {}, innerBlocks = [], innerContent) { | |
| 6792 | + function createBlock(name, attributes = {}, innerBlocks = []) { | |
| 3227 | 6793 | if (!isBlockRegistered(name)) { |
| 3228 | 6794 | return createBlock("core/missing", { |
| 3229 | 6795 | originalName: name, |
| 3230 | 6796 | originalContent: "", |
| @@ -3230,11 +6796,14 @@ | ||
| 3230 | 6796 | originalContent: "", |
| 3231 | 6797 | originalUndelimitedContent: "" |
| 3232 | 6798 | }); |
| 3233 | 6799 | } |
| 3234 | - const sanitizedAttributes = sanitizeBlockAttributes(name, attributes); | |
| 6800 | + const sanitizedAttributes = __experimentalSanitizeBlockAttributes( | |
| 6801 | + name, | |
| 6802 | + attributes | |
| 6803 | + ); | |
| 3235 | 6804 | const clientId = v4_default(); |
| 3236 | - const block = { | |
| 6805 | + return { | |
| 3237 | 6806 | clientId, |
| 3238 | 6807 | name, |
| 3239 | 6808 | isValid: true, |
| 3240 | 6809 | attributes: sanitizedAttributes, |
| @@ -3239,18 +6808,8 @@ | ||
| 3239 | 6808 | isValid: true, |
| 3240 | 6809 | attributes: sanitizedAttributes, |
| 3241 | 6810 | innerBlocks |
| 3242 | 6811 | }; |
| 3243 | - if (innerContent) { | |
| 3244 | - if (name === "core/html") { | |
| 3245 | - block.innerContent = innerContent; | |
| 3246 | - } else { | |
| 3247 | - (0, import_warning3.default)( | |
| 3248 | - `The innerContent argument passed to createBlock for the "${name}" block was ignored. Only the Custom HTML block stores static inner content.` | |
| 3249 | - ); | |
| 3250 | - } | |
| 3251 | - } | |
| 3252 | - return block; | |
| 3253 | 6812 | } |
| 3254 | 6813 | function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) { |
| 3255 | 6814 | return innerBlocksOrTemplate.map((innerBlock) => { |
| 3256 | 6815 | const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [ |
| @@ -3255,23 +6814,19 @@ | ||
| 3255 | 6814 | return innerBlocksOrTemplate.map((innerBlock) => { |
| 3256 | 6815 | const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [ |
| 3257 | 6816 | innerBlock.name, |
| 3258 | 6817 | innerBlock.attributes, |
| 3259 | - innerBlock.innerBlocks, | |
| 3260 | - innerBlock.innerContent | |
| 6818 | + innerBlock.innerBlocks | |
| 3261 | 6819 | ]; |
| 3262 | - const [name, attributes, innerBlocks = [], innerContent] = innerBlockTemplate; | |
| 6820 | + const [name, attributes, innerBlocks = []] = innerBlockTemplate; | |
| 3263 | 6821 | return createBlock( |
| 3264 | 6822 | name, |
| 3265 | 6823 | attributes, |
| 3266 | - createBlocksFromInnerBlocksTemplate( | |
| 3267 | - innerBlocks | |
| 3268 | - ), | |
| 3269 | - innerContent | |
| 6824 | + createBlocksFromInnerBlocksTemplate(innerBlocks) | |
| 3270 | 6825 | ); |
| 3271 | 6826 | }); |
| 3272 | 6827 | } |
| 3273 | - function cloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { | |
| 6828 | + function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { | |
| 3274 | 6829 | const { name } = block; |
| 3275 | 6830 | if (!isBlockRegistered(name)) { |
| 3276 | 6831 | return createBlock("core/missing", { |
| 3277 | 6832 | originalName: name, |
| @@ -3279,9 +6834,9 @@ | ||
| 3279 | 6834 | originalUndelimitedContent: "" |
| 3280 | 6835 | }); |
| 3281 | 6836 | } |
| 3282 | 6837 | const clientId = v4_default(); |
| 3283 | - const sanitizedAttributes = sanitizeBlockAttributes(name, { | |
| 6838 | + const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, { | |
| 3284 | 6839 | ...block.attributes, |
| 3285 | 6840 | ...mergeAttributes |
| 3286 | 6841 | }); |
| 3287 | 6842 | return { |
| @@ -3288,19 +6843,12 @@ | ||
| 3288 | 6843 | ...block, |
| 3289 | 6844 | clientId, |
| 3290 | 6845 | attributes: sanitizedAttributes, |
| 3291 | 6846 | innerBlocks: newInnerBlocks || block.innerBlocks.map( |
| 3292 | - (innerBlock) => cloneSanitizedBlock(innerBlock) | |
| 6847 | + (innerBlock) => __experimentalCloneSanitizedBlock(innerBlock) | |
| 3293 | 6848 | ) |
| 3294 | 6849 | }; |
| 3295 | 6850 | } |
| 3296 | - function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { | |
| 3297 | - (0, import_deprecated6.default)("__experimentalCloneSanitizedBlock", { | |
| 3298 | - since: "7.1", | |
| 3299 | - alternative: "cloneSanitizedBlock" | |
| 3300 | - }); | |
| 3301 | - return cloneSanitizedBlock(block, mergeAttributes, newInnerBlocks); | |
| 3302 | - } | |
| 3303 | 6851 | function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) { |
| 3304 | 6852 | const clientId = v4_default(); |
| 3305 | 6853 | return { |
| 3306 | 6854 | ...block, |
| @@ -3346,16 +6894,18 @@ | ||
| 3346 | 6894 | if (!blocks.length) { |
| 3347 | 6895 | return []; |
| 3348 | 6896 | } |
| 3349 | 6897 | const allBlockTypes = getBlockTypes(); |
| 3350 | - const blockTypesWithPossibleFromTransforms = allBlockTypes.flatMap( | |
| 6898 | + const blockTypesWithPossibleFromTransforms = allBlockTypes.filter( | |
| 3351 | 6899 | (blockType) => { |
| 3352 | 6900 | const fromTransforms = getBlockTransforms("from", blockType.name); |
| 3353 | - return fromTransforms.filter( | |
| 3354 | - (transform) => isPossibleTransformForSource(transform, "from", blocks) | |
| 3355 | - ).map( | |
| 3356 | - (transform) => getBlockTypeWithTransformMetadata(blockType, transform) | |
| 3357 | - ); | |
| 6901 | + return !!findTransform(fromTransforms, (transform) => { | |
| 6902 | + return isPossibleTransformForSource( | |
| 6903 | + transform, | |
| 6904 | + "from", | |
| 6905 | + blocks | |
| 6906 | + ); | |
| 6907 | + }); | |
| 3358 | 6908 | } |
| 3359 | 6909 | ); |
| 3360 | 6910 | return blockTypesWithPossibleFromTransforms; |
| 3361 | 6911 | }; |
| @@ -3368,19 +6918,12 @@ | ||
| 3368 | 6918 | const transformsTo = blockType ? getBlockTransforms("to", blockType.name) : []; |
| 3369 | 6919 | const possibleTransforms = transformsTo.filter((transform) => { |
| 3370 | 6920 | return transform && isPossibleTransformForSource(transform, "to", blocks); |
| 3371 | 6921 | }); |
| 3372 | - return possibleTransforms.flatMap((transformation) => { | |
| 3373 | - return (transformation.blocks || []).map((name) => { | |
| 3374 | - const transformedBlockType = getBlockType(name); | |
| 3375 | - return transformedBlockType ? getBlockTypeWithTransformMetadata( | |
| 3376 | - transformedBlockType, | |
| 3377 | - transformation | |
| 3378 | - ) : void 0; | |
| 3379 | - }); | |
| 3380 | - }).filter((bt) => !!bt); | |
| 6922 | + const blockNames = possibleTransforms.map((transformation) => transformation.blocks).flat(); | |
| 6923 | + return blockNames.map(getBlockType); | |
| 3381 | 6924 | }; |
| 3382 | - var isWildcardBlockTransform = (t3) => !!t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*"); | |
| 6925 | + var isWildcardBlockTransform = (t3) => t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*"); | |
| 3383 | 6926 | var isContainerGroupBlock = (name) => name === getGroupingBlockName(); |
| 3384 | 6927 | function getPossibleBlockTransformations(blocks) { |
| 3385 | 6928 | if (!blocks.length) { |
| 3386 | 6929 | return []; |
| @@ -3386,19 +6929,14 @@ | ||
| 3386 | 6929 | return []; |
| 3387 | 6930 | } |
| 3388 | 6931 | const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks); |
| 3389 | 6932 | const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks); |
| 3390 | - const blockTypesByNameAndVariation = /* @__PURE__ */ new Map(); | |
| 3391 | - for (const blockType of [ | |
| 3392 | - ...blockTypesForFromTransforms, | |
| 3393 | - ...blockTypesForToTransforms | |
| 3394 | - ]) { | |
| 3395 | - const key = blockType.variationName ? `${blockType.name}/${blockType.variationName}` : blockType.name; | |
| 3396 | - if (!blockTypesByNameAndVariation.has(key)) { | |
| 3397 | - blockTypesByNameAndVariation.set(key, blockType); | |
| 3398 | - } | |
| 3399 | - } | |
| 3400 | - return [...blockTypesByNameAndVariation.values()]; | |
| 6933 | + return [ | |
| 6934 | + .../* @__PURE__ */ new Set([ | |
| 6935 | + ...blockTypesForFromTransforms, | |
| 6936 | + ...blockTypesForToTransforms | |
| 6937 | + ]) | |
| 6938 | + ]; | |
| 3401 | 6939 | } |
| 3402 | 6940 | function findTransform(transforms, predicate) { |
| 3403 | 6941 | const hooks = (0, import_hooks2.createHooks)(); |
| 3404 | 6942 | for (let i2 = 0; i2 < transforms.length; i2++) { |
| @@ -3419,14 +6957,13 @@ | ||
| 3419 | 6957 | return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat(); |
| 3420 | 6958 | } |
| 3421 | 6959 | const blockType = normalizeBlockType(blockTypeOrName); |
| 3422 | 6960 | const { name: blockName, transforms } = blockType || {}; |
| 3423 | - const directionTransforms = transforms?.[direction]; | |
| 3424 | - if (!transforms || !Array.isArray(directionTransforms)) { | |
| 6961 | + if (!transforms || !Array.isArray(transforms[direction])) { | |
| 3425 | 6962 | return []; |
| 3426 | 6963 | } |
| 3427 | 6964 | const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms); |
| 3428 | - const filteredTransforms = usingMobileTransformations ? directionTransforms.filter((t3) => { | |
| 6965 | + const filteredTransforms = usingMobileTransformations ? transforms[direction].filter((t3) => { | |
| 3429 | 6966 | if (t3.type === "raw") { |
| 3430 | 6967 | return true; |
| 3431 | 6968 | } |
| 3432 | 6969 | if (t3.type === "prefix") { |
| @@ -3442,9 +6979,9 @@ | ||
| 3442 | 6979 | (transformBlockName) => transforms.supportedMobileTransforms.includes( |
| 3443 | 6980 | transformBlockName |
| 3444 | 6981 | ) |
| 3445 | 6982 | ); |
| 3446 | - }) : directionTransforms; | |
| 6983 | + }) : transforms[direction]; | |
| 3447 | 6984 | return filteredTransforms.map((transform) => ({ |
| 3448 | 6985 | ...transform, |
| 3449 | 6986 | blockName, |
| 3450 | 6987 | usingMobileTransformations |
| @@ -3458,9 +6995,9 @@ | ||
| 3458 | 6995 | const attributes = transform.isMultiBlock ? blocks.map((block2) => block2.attributes) : sourceBlock.attributes; |
| 3459 | 6996 | const block = transform.isMultiBlock ? blocks : sourceBlock; |
| 3460 | 6997 | return transform.isMatch(attributes, block); |
| 3461 | 6998 | } |
| 3462 | - function switchToBlockType(blocks, name, variationName) { | |
| 6999 | + function switchToBlockType(blocks, name) { | |
| 3463 | 7000 | const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; |
| 3464 | 7001 | const isMultiBlock = blocksArray.length > 1; |
| 3465 | 7002 | const firstBlock = blocksArray[0]; |
| 3466 | 7003 | const sourceName = firstBlock.name; |
| @@ -3465,15 +7002,14 @@ | ||
| 3465 | 7002 | const firstBlock = blocksArray[0]; |
| 3466 | 7003 | const sourceName = firstBlock.name; |
| 3467 | 7004 | const transformationsFrom = getBlockTransforms("from", name); |
| 3468 | 7005 | const transformationsTo = getBlockTransforms("to", sourceName); |
| 3469 | - const isMatchingVariation = (t3) => variationName ? t3.variationName === variationName : !t3.variationName; | |
| 3470 | 7006 | const transformation = findTransform( |
| 3471 | 7007 | transformationsTo, |
| 3472 | - (t3) => t3.type === "block" && isMatchingVariation(t3) && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) | |
| 7008 | + (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) | |
| 3473 | 7009 | ) || findTransform( |
| 3474 | 7010 | transformationsFrom, |
| 3475 | - (t3) => t3.type === "block" && isMatchingVariation(t3) && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) | |
| 7011 | + (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) | |
| 3476 | 7012 | ); |
| 3477 | 7013 | if (!transformation) { |
| 3478 | 7014 | return null; |
| 3479 | 7015 | } |
| @@ -3525,10 +7061,9 @@ | ||
| 3525 | 7061 | name, |
| 3526 | 7062 | example.attributes, |
| 3527 | 7063 | (example.innerBlocks ?? []).map( |
| 3528 | 7064 | (innerBlock) => getBlockFromExample(innerBlock.name, innerBlock) |
| 3529 | - ), | |
| 3530 | - example.innerContent | |
| 7065 | + ) | |
| 3531 | 7066 | ); |
| 3532 | 7067 | |
| 3533 | 7068 | // packages/blocks/build-module/api/parser/index.mjs |
| 3534 | 7069 | var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser(), 1); |
| @@ -3538,9 +7073,9 @@ | ||
| 3538 | 7073 | var import_element2 = __toESM(require_element(), 1); |
| 3539 | 7074 | var import_hooks3 = __toESM(require_hooks(), 1); |
| 3540 | 7075 | var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); |
| 3541 | 7076 | var import_autop = __toESM(require_autop(), 1); |
| 3542 | - var import_deprecated7 = __toESM(require_deprecated(), 1); | |
| 7077 | + var import_deprecated6 = __toESM(require_deprecated(), 1); | |
| 3543 | 7078 | |
| 3544 | 7079 | // packages/blocks/build-module/api/parser/serialize-raw-block.mjs |
| 3545 | 7080 | function serializeRawBlock(rawBlock, options = {}) { |
| 3546 | 7081 | const { isCommentDelimited = true } = options; |
| @@ -3556,9 +7091,9 @@ | ||
| 3556 | 7091 | // `null` denotes a nested block, otherwise we have an HTML fragment. |
| 3557 | 7092 | item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options) |
| 3558 | 7093 | ) |
| 3559 | 7094 | ).join("\n").replace(/\n+/g, "\n").trim(); |
| 3560 | - return isCommentDelimited ? getCommentDelimitedContent(blockName ?? void 0, attrs, content) : content; | |
| 7095 | + return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content; | |
| 3561 | 7096 | } |
| 3562 | 7097 | |
| 3563 | 7098 | // packages/blocks/build-module/api/serializer.mjs |
| 3564 | 7099 | var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| @@ -3602,22 +7137,18 @@ | ||
| 3602 | 7137 | const blockType = normalizeBlockType(blockTypeOrName); |
| 3603 | 7138 | if (!blockType?.save) { |
| 3604 | 7139 | return null; |
| 3605 | 7140 | } |
| 3606 | - let save = blockType.save; | |
| 7141 | + let { save } = blockType; | |
| 3607 | 7142 | if (save.prototype instanceof import_element2.Component) { |
| 3608 | - const SaveClass = save; | |
| 3609 | - const instance = new SaveClass({ attributes }); | |
| 7143 | + const instance = new save({ attributes }); | |
| 3610 | 7144 | save = instance.render.bind(instance); |
| 3611 | 7145 | } |
| 3612 | 7146 | blockPropsProvider.blockType = blockType; |
| 3613 | 7147 | blockPropsProvider.attributes = attributes; |
| 3614 | 7148 | innerBlocksPropsProvider.innerBlocks = innerBlocks; |
| 3615 | - let element = save({ | |
| 3616 | - attributes, | |
| 3617 | - innerBlocks | |
| 3618 | - }); | |
| 3619 | - if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !((blockType.apiVersion ?? 0) > 1)) { | |
| 7149 | + let element = save({ attributes, innerBlocks }); | |
| 7150 | + if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !(blockType.apiVersion > 1)) { | |
| 3620 | 7151 | const props = (0, import_hooks3.applyFilters)( |
| 3621 | 7152 | "blocks.getSaveContent.extraProps", |
| 3622 | 7153 | { ...element.props }, |
| 3623 | 7154 | blockType, |
| @@ -3623,12 +7154,9 @@ | ||
| 3623 | 7154 | blockType, |
| 3624 | 7155 | attributes |
| 3625 | 7156 | ); |
| 3626 | 7157 | if (!(0, import_is_shallow_equal.isShallowEqual)(props, element.props)) { |
| 3627 | - element = (0, import_element2.cloneElement)( | |
| 3628 | - element, | |
| 3629 | - props | |
| 3630 | - ); | |
| 7158 | + element = (0, import_element2.cloneElement)(element, props); | |
| 3631 | 7159 | } |
| 3632 | 7160 | } |
| 3633 | 7161 | return (0, import_hooks3.applyFilters)( |
| 3634 | 7162 | "blocks.getSaveElement", |
| @@ -3637,14 +7165,9 @@ | ||
| 3637 | 7165 | attributes |
| 3638 | 7166 | ); |
| 3639 | 7167 | } |
| 3640 | 7168 | function getSaveContent(blockTypeOrName, attributes, innerBlocks) { |
| 3641 | - const blockType = normalizeBlockType( | |
| 3642 | - blockTypeOrName | |
| 3643 | - ); | |
| 3644 | - if (!blockType) { | |
| 3645 | - return ""; | |
| 3646 | - } | |
| 7169 | + const blockType = normalizeBlockType(blockTypeOrName); | |
| 3647 | 7170 | return (0, import_element2.renderToString)( |
| 3648 | 7171 | getSaveElement(blockType, attributes, innerBlocks) |
| 3649 | 7172 | ); |
| 3650 | 7173 | } |
| @@ -3661,9 +7184,9 @@ | ||
| 3661 | 7184 | if (attributeSchema.role === "local") { |
| 3662 | 7185 | return accumulator; |
| 3663 | 7186 | } |
| 3664 | 7187 | if (attributeSchema.__experimentalRole === "local") { |
| 3665 | - (0, import_deprecated7.default)("__experimentalRole attribute", { | |
| 7188 | + (0, import_deprecated6.default)("__experimentalRole attribute", { | |
| 3666 | 7189 | since: "6.7", |
| 3667 | 7190 | version: "6.8", |
| 3668 | 7191 | alternative: "role attribute", |
| 3669 | 7192 | hint: `Check the block.json of the ${blockType?.name} block.` |
| @@ -3681,29 +7204,10 @@ | ||
| 3681 | 7204 | } |
| 3682 | 7205 | function serializeAttributes(attributes) { |
| 3683 | 7206 | return JSON.stringify(attributes).replaceAll("\\\\", "\\u005c").replaceAll("--", "\\u002d\\u002d").replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("&", "\\u0026").replaceAll('\\"', "\\u0022"); |
| 3684 | 7207 | } |
| 3685 | - function serializeInnerContent(innerContent, innerBlocks) { | |
| 3686 | - let childIndex = 0; | |
| 3687 | - const parts = innerContent.map((item) => { | |
| 3688 | - if (item !== null) { | |
| 3689 | - return item; | |
| 3690 | - } | |
| 3691 | - const innerBlock = innerBlocks[childIndex++]; | |
| 3692 | - return innerBlock ? serializeBlock(innerBlock, { isInnerBlocks: true }) : ""; | |
| 3693 | - }); | |
| 3694 | - for (; childIndex < innerBlocks.length; childIndex++) { | |
| 3695 | - parts.push( | |
| 3696 | - serializeBlock(innerBlocks[childIndex], { isInnerBlocks: true }) | |
| 3697 | - ); | |
| 3698 | - } | |
| 3699 | - return parts.join("").trim(); | |
| 3700 | - } | |
| 3701 | 7208 | function getBlockInnerHTML(block) { |
| 3702 | - if (block.innerContent && block.name === "core/html") { | |
| 3703 | - return serializeInnerContent(block.innerContent, block.innerBlocks); | |
| 3704 | - } | |
| 3705 | - let saveContent = block.originalContent ?? ""; | |
| 7209 | + let saveContent = block.originalContent; | |
| 3706 | 7210 | if (block.isValid || block.innerBlocks.length) { |
| 3707 | 7211 | try { |
| 3708 | 7212 | saveContent = getSaveContent( |
| 3709 | 7213 | block.name, |
| @@ -3709,9 +7213,9 @@ | ||
| 3709 | 7213 | block.name, |
| 3710 | 7214 | block.attributes, |
| 3711 | 7215 | block.innerBlocks |
| 3712 | 7216 | ); |
| 3713 | - } catch { | |
| 7217 | + } catch (error) { | |
| 3714 | 7218 | } |
| 3715 | 7219 | } |
| 3716 | 7220 | return saveContent; |
| 3717 | 7221 | } |
| @@ -3740,27 +7244,18 @@ | ||
| 3740 | 7244 | } |
| 3741 | 7245 | const saveAttributes = getCommentAttributes(blockType, block.attributes); |
| 3742 | 7246 | return getCommentDelimitedContent(blockName, saveAttributes, saveContent); |
| 3743 | 7247 | } |
| 3744 | - var __unstableSerializeAndClean = /* @__PURE__ */ (() => { | |
| 3745 | - const cache = /* @__PURE__ */ new WeakMap(); | |
| 3746 | - return (blocks) => { | |
| 3747 | - const cached = cache.get(blocks); | |
| 3748 | - if (cached !== void 0) { | |
| 3749 | - return cached; | |
| 3750 | - } | |
| 3751 | - let effectiveBlocks = blocks; | |
| 3752 | - if (effectiveBlocks.length === 1 && isUnmodifiedDefaultBlock(effectiveBlocks[0])) { | |
| 3753 | - effectiveBlocks = []; | |
| 3754 | - } | |
| 3755 | - let content = serialize(effectiveBlocks); | |
| 3756 | - if (effectiveBlocks.length === 1 && effectiveBlocks[0].name === getFreeformContentHandlerName() && effectiveBlocks[0].name === "core/freeform") { | |
| 3757 | - content = (0, import_autop.removep)(content); | |
| 3758 | - } | |
| 3759 | - cache.set(blocks, content); | |
| 3760 | - return content; | |
| 3761 | - }; | |
| 3762 | - })(); | |
| 7248 | + function __unstableSerializeAndClean(blocks) { | |
| 7249 | + if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) { | |
| 7250 | + blocks = []; | |
| 7251 | + } | |
| 7252 | + let content = serialize(blocks); | |
| 7253 | + if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName() && blocks[0].name === "core/freeform") { | |
| 7254 | + content = (0, import_autop.removep)(content); | |
| 7255 | + } | |
| 7256 | + return content; | |
| 7257 | + } | |
| 3763 | 7258 | function serialize(blocks, options) { |
| 3764 | 7259 | const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; |
| 3765 | 7260 | return blocksArray.map((block) => serializeBlock(block, options)).join("\n\n"); |
| 3766 | 7261 | } |
| @@ -4515,10 +8010,10 @@ | ||
| 4515 | 8010 | })() |
| 4516 | 8011 | ); |
| 4517 | 8012 | |
| 4518 | 8013 | // packages/blocks/build-module/api/validation/index.mjs |
| 4519 | - var import_es62 = __toESM(require_es6(), 1); | |
| 4520 | - var import_deprecated8 = __toESM(require_deprecated(), 1); | |
| 8014 | + var import_es6 = __toESM(require_es6(), 1); | |
| 8015 | + var import_deprecated7 = __toESM(require_deprecated(), 1); | |
| 4521 | 8016 | var import_html_entities = __toESM(require_html_entities(), 1); |
| 4522 | 8017 | |
| 4523 | 8018 | // packages/blocks/build-module/api/validation/logger.mjs |
| 4524 | 8019 | function createLogger() { |
| @@ -4551,9 +8046,9 @@ | ||
| 4551 | 8046 | }; |
| 4552 | 8047 | } |
| 4553 | 8048 | |
| 4554 | 8049 | // packages/blocks/build-module/api/validation/index.mjs |
| 4555 | - var identity = (x3) => x3; | |
| 8050 | + var identity = (x2) => x2; | |
| 4556 | 8051 | var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g; |
| 4557 | 8052 | var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/; |
| 4558 | 8053 | var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/; |
| 4559 | 8054 | var BOOLEAN_ATTRIBUTES = [ |
| @@ -4613,12 +8108,9 @@ | ||
| 4613 | 8108 | var MEANINGFUL_ATTRIBUTES = [ |
| 4614 | 8109 | ...BOOLEAN_ATTRIBUTES, |
| 4615 | 8110 | ...ENUMERATED_ATTRIBUTES |
| 4616 | 8111 | ]; |
| 4617 | - var TEXT_NORMALIZATIONS = [ | |
| 4618 | - identity, | |
| 4619 | - getTextWithCollapsedWhitespace | |
| 4620 | - ]; | |
| 8112 | + var TEXT_NORMALIZATIONS = [identity, getTextWithCollapsedWhitespace]; | |
| 4621 | 8113 | var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; |
| 4622 | 8114 | var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; |
| 4623 | 8115 | var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; |
| 4624 | 8116 | function isValidCharacterReference(text2) { |
| @@ -4628,17 +8120,16 @@ | ||
| 4628 | 8120 | /** |
| 4629 | 8121 | * Returns a substitute string for an entity string sequence between `&` |
| 4630 | 8122 | * and `;`, or undefined if no substitution should occur. |
| 4631 | 8123 | * |
| 4632 | - * @param entity Entity fragment discovered in HTML. | |
| 8124 | + * @param {string} entity Entity fragment discovered in HTML. | |
| 4633 | 8125 | * |
| 4634 | - * @return Entity substitute value. | |
| 8126 | + * @return {string | undefined} Entity substitute value. | |
| 4635 | 8127 | */ |
| 4636 | 8128 | parse(entity) { |
| 4637 | 8129 | if (isValidCharacterReference(entity)) { |
| 4638 | 8130 | return (0, import_html_entities.decodeEntities)("&" + entity + ";"); |
| 4639 | 8131 | } |
| 4640 | - return void 0; | |
| 4641 | 8132 | } |
| 4642 | 8133 | }; |
| 4643 | 8134 | function getTextPiecesSplitOnWhitespace(text2) { |
| 4644 | 8135 | return text2.trim().split(REGEXP_WHITESPACE); |
| @@ -4646,9 +8137,9 @@ | ||
| 4646 | 8137 | function getTextWithCollapsedWhitespace(text2) { |
| 4647 | 8138 | return getTextPiecesSplitOnWhitespace(text2).join(" "); |
| 4648 | 8139 | } |
| 4649 | 8140 | function getMeaningfulAttributePairs(token) { |
| 4650 | - return (token.attributes ?? []).filter((pair) => { | |
| 8141 | + return token.attributes.filter((pair) => { | |
| 4651 | 8142 | const [key, value] = pair; |
| 4652 | 8143 | return value || key.indexOf("data-") === 0 || MEANINGFUL_ATTRIBUTES.includes(key); |
| 4653 | 8144 | }); |
| 4654 | 8145 | } |
| @@ -4706,9 +8197,9 @@ | ||
| 4706 | 8197 | ); |
| 4707 | 8198 | return actualDiff.length === 0 && expectedDiff.length === 0; |
| 4708 | 8199 | }, |
| 4709 | 8200 | style: (actual, expected) => { |
| 4710 | - return (0, import_es62.default)( | |
| 8201 | + return (0, import_es6.default)( | |
| 4711 | 8202 | ...[actual, expected].map(getStyleProperties) |
| 4712 | 8203 | ); |
| 4713 | 8204 | }, |
| 4714 | 8205 | // For each boolean attribute, mere presence of attribute in both is enough |
| @@ -4791,16 +8282,13 @@ | ||
| 4791 | 8282 | if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) { |
| 4792 | 8283 | return token; |
| 4793 | 8284 | } |
| 4794 | 8285 | } |
| 4795 | - return void 0; | |
| 4796 | 8286 | } |
| 4797 | 8287 | function getHTMLTokens(html2, logger = createLogger()) { |
| 4798 | 8288 | try { |
| 4799 | - return new Tokenizer(new DecodeEntityParser()).tokenize( | |
| 4800 | - html2 | |
| 4801 | - ); | |
| 4802 | - } catch { | |
| 8289 | + return new Tokenizer(new DecodeEntityParser()).tokenize(html2); | |
| 8290 | + } catch (e2) { | |
| 4803 | 8291 | logger.warning("Malformed HTML detected: %s", html2); |
| 4804 | 8292 | } |
| 4805 | 8293 | return null; |
| 4806 | 8294 | } |
| @@ -4895,9 +8383,9 @@ | ||
| 4895 | 8383 | } |
| 4896 | 8384 | return [isValid, logger.getItems()]; |
| 4897 | 8385 | } |
| 4898 | 8386 | function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { |
| 4899 | - (0, import_deprecated8.default)("isValidBlockContent introduces opportunity for data loss", { | |
| 8387 | + (0, import_deprecated7.default)("isValidBlockContent introduces opportunity for data loss", { | |
| 4900 | 8388 | since: "12.6", |
| 4901 | 8389 | plugin: "Gutenberg", |
| 4902 | 8390 | alternative: "validateBlock" |
| 4903 | 8391 | }); |
| @@ -4902,11 +8390,9 @@ | ||
| 4902 | 8390 | alternative: "validateBlock" |
| 4903 | 8391 | }); |
| 4904 | 8392 | const blockType = normalizeBlockType(blockTypeOrName); |
| 4905 | 8393 | const block = { |
| 4906 | - clientId: "", | |
| 4907 | 8394 | name: blockType.name, |
| 4908 | - isValid: true, | |
| 4909 | 8395 | attributes, |
| 4910 | 8396 | innerBlocks: [], |
| 4911 | 8397 | originalContent: originalBlockContent |
| 4912 | 8398 | }; |
| @@ -4914,34 +8400,8 @@ | ||
| 4914 | 8400 | return isValid; |
| 4915 | 8401 | } |
| 4916 | 8402 | |
| 4917 | 8403 | // packages/blocks/build-module/api/parser/convert-legacy-block.mjs |
| 4918 | - function normalizeStyleStateAliases(style) { | |
| 4919 | - if (false) { | |
| 4920 | - return style; | |
| 4921 | - } | |
| 4922 | - if (!style || typeof style !== "object" || Array.isArray(style)) { | |
| 4923 | - return style; | |
| 4924 | - } | |
| 4925 | - let normalizedStyle = style; | |
| 4926 | - const viewportAliases = { | |
| 4927 | - "@mobile": "mobile", | |
| 4928 | - "@tablet": "tablet" | |
| 4929 | - }; | |
| 4930 | - Object.entries(viewportAliases).forEach(([state, legacyState]) => { | |
| 4931 | - if (!Object.hasOwn(normalizedStyle, legacyState)) { | |
| 4932 | - return; | |
| 4933 | - } | |
| 4934 | - if (normalizedStyle === style) { | |
| 4935 | - normalizedStyle = { ...normalizedStyle }; | |
| 4936 | - } | |
| 4937 | - if (!Object.hasOwn(normalizedStyle, state)) { | |
| 4938 | - normalizedStyle[state] = normalizedStyle[legacyState]; | |
| 4939 | - } | |
| 4940 | - delete normalizedStyle[legacyState]; | |
| 4941 | - }); | |
| 4942 | - return normalizedStyle; | |
| 4943 | - } | |
| 4944 | 8404 | function convertLegacyBlockNameAndAttributes(name, attributes) { |
| 4945 | 8405 | const newAttributes = { ...attributes }; |
| 4946 | 8406 | if ("core/cover-image" === name) { |
| 4947 | 8407 | name = "core/cover"; |
| @@ -4954,13 +8414,13 @@ | ||
| 4954 | 8414 | name = "core/social-link"; |
| 4955 | 8415 | } |
| 4956 | 8416 | if (name && name.indexOf("core-embed/") === 0) { |
| 4957 | 8417 | const providerSlug = name.substring(11); |
| 4958 | - const deprecated13 = { | |
| 8418 | + const deprecated12 = { | |
| 4959 | 8419 | speaker: "speaker-deck", |
| 4960 | 8420 | polldaddy: "crowdsignal" |
| 4961 | 8421 | }; |
| 4962 | - newAttributes.providerNameSlug = providerSlug in deprecated13 ? deprecated13[providerSlug] : providerSlug; | |
| 8422 | + newAttributes.providerNameSlug = providerSlug in deprecated12 ? deprecated12[providerSlug] : providerSlug; | |
| 4963 | 8423 | if (!["amazon-kindle", "wordpress"].includes(providerSlug)) { |
| 4964 | 8424 | newAttributes.responsive = true; |
| 4965 | 8425 | } |
| 4966 | 8426 | name = "core/embed"; |
| @@ -4975,9 +8435,9 @@ | ||
| 4975 | 8435 | name = "core/comment-date"; |
| 4976 | 8436 | } |
| 4977 | 8437 | if (name === "core/comments-query-loop") { |
| 4978 | 8438 | name = "core/comments"; |
| 4979 | - const className = newAttributes.className ?? ""; | |
| 8439 | + const { className = "" } = newAttributes; | |
| 4980 | 8440 | if (!className.includes("wp-block-comments-query-loop")) { |
| 4981 | 8441 | newAttributes.className = [ |
| 4982 | 8442 | "wp-block-comments-query-loop", |
| 4983 | 8443 | className |
| @@ -4987,41 +8447,37 @@ | ||
| 4987 | 8447 | if (name === "core/post-comments") { |
| 4988 | 8448 | name = "core/comments"; |
| 4989 | 8449 | newAttributes.legacy = true; |
| 4990 | 8450 | } |
| 4991 | - const layout = attributes.layout; | |
| 4992 | - if (layout?.type === "grid" && typeof layout?.columnCount === "string") { | |
| 8451 | + if (attributes.layout?.type === "grid" && typeof attributes.layout?.columnCount === "string") { | |
| 4993 | 8452 | newAttributes.layout = { |
| 4994 | 8453 | ...newAttributes.layout, |
| 4995 | - columnCount: parseInt(layout.columnCount, 10) | |
| 8454 | + columnCount: parseInt(attributes.layout.columnCount, 10) | |
| 4996 | 8455 | }; |
| 4997 | 8456 | } |
| 4998 | - const style = attributes.style; | |
| 4999 | - const styleLayout = style?.layout; | |
| 5000 | - if (typeof styleLayout?.columnSpan === "string") { | |
| 5001 | - const columnSpanNumber = parseInt(styleLayout.columnSpan, 10); | |
| 8457 | + if (typeof attributes.style?.layout?.columnSpan === "string") { | |
| 8458 | + const columnSpanNumber = parseInt( | |
| 8459 | + attributes.style.layout.columnSpan, | |
| 8460 | + 10 | |
| 8461 | + ); | |
| 5002 | 8462 | newAttributes.style = { |
| 5003 | 8463 | ...newAttributes.style, |
| 5004 | 8464 | layout: { |
| 5005 | - ...newAttributes.style?.layout, | |
| 8465 | + ...newAttributes.style.layout, | |
| 5006 | 8466 | columnSpan: isNaN(columnSpanNumber) ? void 0 : columnSpanNumber |
| 5007 | 8467 | } |
| 5008 | 8468 | }; |
| 5009 | 8469 | } |
| 5010 | - if (typeof styleLayout?.rowSpan === "string") { | |
| 5011 | - const rowSpanNumber = parseInt(styleLayout.rowSpan, 10); | |
| 8470 | + if (typeof attributes.style?.layout?.rowSpan === "string") { | |
| 8471 | + const rowSpanNumber = parseInt(attributes.style.layout.rowSpan, 10); | |
| 5012 | 8472 | newAttributes.style = { |
| 5013 | 8473 | ...newAttributes.style, |
| 5014 | 8474 | layout: { |
| 5015 | - ...newAttributes.style?.layout, | |
| 8475 | + ...newAttributes.style.layout, | |
| 5016 | 8476 | rowSpan: isNaN(rowSpanNumber) ? void 0 : rowSpanNumber |
| 5017 | 8477 | } |
| 5018 | 8478 | }; |
| 5019 | 8479 | } |
| 5020 | - const normalizedStyle = normalizeStyleStateAliases(newAttributes.style); | |
| 5021 | - if (normalizedStyle !== newAttributes.style) { | |
| 5022 | - newAttributes.style = normalizedStyle; | |
| 5023 | - } | |
| 5024 | 8480 | return [name, newAttributes]; |
| 5025 | 8481 | } |
| 5026 | 8482 | |
| 5027 | 8483 | // node_modules/hpq/es/get-path.js |
| @@ -5181,18 +8637,18 @@ | ||
| 5181 | 8637 | // packages/blocks/build-module/api/matchers.mjs |
| 5182 | 8638 | var import_rich_text3 = __toESM(require_rich_text(), 1); |
| 5183 | 8639 | |
| 5184 | 8640 | // packages/blocks/build-module/api/node.mjs |
| 5185 | - var import_deprecated10 = __toESM(require_deprecated(), 1); | |
| 8641 | + var import_deprecated9 = __toESM(require_deprecated(), 1); | |
| 5186 | 8642 | |
| 5187 | 8643 | // packages/blocks/build-module/api/children.mjs |
| 5188 | 8644 | var import_element3 = __toESM(require_element(), 1); |
| 5189 | - var import_deprecated9 = __toESM(require_deprecated(), 1); | |
| 8645 | + var import_deprecated8 = __toESM(require_deprecated(), 1); | |
| 5190 | 8646 | function getSerializeCapableElement(children) { |
| 5191 | 8647 | return children; |
| 5192 | 8648 | } |
| 5193 | 8649 | function getChildrenArray(children) { |
| 5194 | - (0, import_deprecated9.default)("wp.blocks.children.getChildrenArray", { | |
| 8650 | + (0, import_deprecated8.default)("wp.blocks.children.getChildrenArray", { | |
| 5195 | 8651 | since: "6.1", |
| 5196 | 8652 | version: "6.3", |
| 5197 | 8653 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 5198 | 8654 | }); |
| @@ -5198,9 +8654,9 @@ | ||
| 5198 | 8654 | }); |
| 5199 | 8655 | return children; |
| 5200 | 8656 | } |
| 5201 | 8657 | function concat(...blockNodes) { |
| 5202 | - (0, import_deprecated9.default)("wp.blocks.children.concat", { | |
| 8658 | + (0, import_deprecated8.default)("wp.blocks.children.concat", { | |
| 5203 | 8659 | since: "6.1", |
| 5204 | 8660 | version: "6.3", |
| 5205 | 8661 | alternative: "wp.richText.concat", |
| 5206 | 8662 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5207,10 +8663,10 @@ | ||
| 5207 | 8663 | }); |
| 5208 | 8664 | const result = []; |
| 5209 | 8665 | for (let i2 = 0; i2 < blockNodes.length; i2++) { |
| 5210 | 8666 | const blockNode = Array.isArray(blockNodes[i2]) ? blockNodes[i2] : [blockNodes[i2]]; |
| 5211 | - for (let j3 = 0; j3 < blockNode.length; j3++) { | |
| 5212 | - const child = blockNode[j3]; | |
| 8667 | + for (let j2 = 0; j2 < blockNode.length; j2++) { | |
| 8668 | + const child = blockNode[j2]; | |
| 5213 | 8669 | const canConcatToPreviousString = typeof child === "string" && typeof result[result.length - 1] === "string"; |
| 5214 | 8670 | if (canConcatToPreviousString) { |
| 5215 | 8671 | result[result.length - 1] += child; |
| 5216 | 8672 | } else { |
| @@ -5220,9 +8676,9 @@ | ||
| 5220 | 8676 | } |
| 5221 | 8677 | return result; |
| 5222 | 8678 | } |
| 5223 | 8679 | function fromDOM22(domNodes) { |
| 5224 | - (0, import_deprecated9.default)("wp.blocks.children.fromDOM", { | |
| 8680 | + (0, import_deprecated8.default)("wp.blocks.children.fromDOM", { | |
| 5225 | 8681 | since: "6.1", |
| 5226 | 8682 | version: "6.3", |
| 5227 | 8683 | alternative: "wp.richText.create", |
| 5228 | 8684 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5230,15 +8686,15 @@ | ||
| 5230 | 8686 | const result = []; |
| 5231 | 8687 | for (let i2 = 0; i2 < domNodes.length; i2++) { |
| 5232 | 8688 | try { |
| 5233 | 8689 | result.push(fromDOM2(domNodes[i2])); |
| 5234 | - } catch { | |
| 8690 | + } catch (error) { | |
| 5235 | 8691 | } |
| 5236 | 8692 | } |
| 5237 | 8693 | return result; |
| 5238 | 8694 | } |
| 5239 | 8695 | function toHTML(children) { |
| 5240 | - (0, import_deprecated9.default)("wp.blocks.children.toHTML", { | |
| 8696 | + (0, import_deprecated8.default)("wp.blocks.children.toHTML", { | |
| 5241 | 8697 | since: "6.1", |
| 5242 | 8698 | version: "6.3", |
| 5243 | 8699 | alternative: "wp.richText.toHTMLString", |
| 5244 | 8700 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5246,9 +8702,9 @@ | ||
| 5246 | 8702 | const element = getSerializeCapableElement(children); |
| 5247 | 8703 | return (0, import_element3.renderToString)(element); |
| 5248 | 8704 | } |
| 5249 | 8705 | function matcher(selector) { |
| 5250 | - (0, import_deprecated9.default)("wp.blocks.children.matcher", { | |
| 8706 | + (0, import_deprecated8.default)("wp.blocks.children.matcher", { | |
| 5251 | 8707 | since: "6.1", |
| 5252 | 8708 | version: "6.3", |
| 5253 | 8709 | alternative: "html source", |
| 5254 | 8710 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5273,14 +8729,14 @@ | ||
| 5273 | 8729 | }; |
| 5274 | 8730 | |
| 5275 | 8731 | // packages/blocks/build-module/api/node.mjs |
| 5276 | 8732 | function isNodeOfType(node, type) { |
| 5277 | - (0, import_deprecated10.default)("wp.blocks.node.isNodeOfType", { | |
| 8733 | + (0, import_deprecated9.default)("wp.blocks.node.isNodeOfType", { | |
| 5278 | 8734 | since: "6.1", |
| 5279 | 8735 | version: "6.3", |
| 5280 | 8736 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 5281 | 8737 | }); |
| 5282 | - return typeof node !== "string" && node?.type === type; | |
| 8738 | + return node && node.type === type; | |
| 5283 | 8739 | } |
| 5284 | 8740 | function getNamedNodeMapAsObject(nodeMap) { |
| 5285 | 8741 | const result = {}; |
| 5286 | 8742 | for (let i2 = 0; i2 < nodeMap.length; i2++) { |
| @@ -5289,9 +8745,9 @@ | ||
| 5289 | 8745 | } |
| 5290 | 8746 | return result; |
| 5291 | 8747 | } |
| 5292 | 8748 | function fromDOM2(domNode) { |
| 5293 | - (0, import_deprecated10.default)("wp.blocks.node.fromDOM", { | |
| 8749 | + (0, import_deprecated9.default)("wp.blocks.node.fromDOM", { | |
| 5294 | 8750 | since: "6.1", |
| 5295 | 8751 | version: "6.3", |
| 5296 | 8752 | alternative: "wp.richText.create", |
| 5297 | 8753 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5312,9 +8768,9 @@ | ||
| 5312 | 8768 | } |
| 5313 | 8769 | }; |
| 5314 | 8770 | } |
| 5315 | 8771 | function toHTML2(node) { |
| 5316 | - (0, import_deprecated10.default)("wp.blocks.node.toHTML", { | |
| 8772 | + (0, import_deprecated9.default)("wp.blocks.node.toHTML", { | |
| 5317 | 8773 | since: "6.1", |
| 5318 | 8774 | version: "6.3", |
| 5319 | 8775 | alternative: "wp.richText.toHTMLString", |
| 5320 | 8776 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5321,9 +8777,9 @@ | ||
| 5321 | 8777 | }); |
| 5322 | 8778 | return toHTML([node]); |
| 5323 | 8779 | } |
| 5324 | 8780 | function matcher2(selector) { |
| 5325 | - (0, import_deprecated10.default)("wp.blocks.node.matcher", { | |
| 8781 | + (0, import_deprecated9.default)("wp.blocks.node.matcher", { | |
| 5326 | 8782 | since: "6.1", |
| 5327 | 8783 | version: "6.3", |
| 5328 | 8784 | alternative: "html source", |
| 5329 | 8785 | link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| @@ -5334,9 +8790,9 @@ | ||
| 5334 | 8790 | match = domNode.querySelector(selector); |
| 5335 | 8791 | } |
| 5336 | 8792 | try { |
| 5337 | 8793 | return fromDOM2(match); |
| 5338 | - } catch { | |
| 8794 | + } catch (error) { | |
| 5339 | 8795 | return null; |
| 5340 | 8796 | } |
| 5341 | 8797 | }; |
| 5342 | 8798 | } |
| @@ -5373,11 +8829,9 @@ | ||
| 5373 | 8829 | }; |
| 5374 | 8830 | } |
| 5375 | 8831 | var richText = (selector, preserveWhiteSpace) => (el) => { |
| 5376 | 8832 | const target = selector ? el.querySelector(selector) : el; |
| 5377 | - return target ? import_rich_text3.RichTextData.fromHTMLElement(target, { | |
| 5378 | - preserveWhiteSpace | |
| 5379 | - }) : import_rich_text3.RichTextData.empty(); | |
| 8833 | + return target ? import_rich_text3.RichTextData.fromHTMLElement(target, { preserveWhiteSpace }) : import_rich_text3.RichTextData.empty(); | |
| 5380 | 8834 | }; |
| 5381 | 8835 | |
| 5382 | 8836 | // packages/blocks/build-module/api/parser/get-block-attributes.mjs |
| 5383 | 8837 | var toBooleanAttributeMatcher = (matcher3) => (value) => matcher3(value) !== void 0; |
| @@ -5441,69 +8895,59 @@ | ||
| 5441 | 8895 | } |
| 5442 | 8896 | function isValidByEnum(value, enumSet) { |
| 5443 | 8897 | return !Array.isArray(enumSet) || enumSet.includes(value); |
| 5444 | 8898 | } |
| 5445 | - var matcherFromSource = memize( | |
| 5446 | - (sourceConfig) => { | |
| 5447 | - switch (sourceConfig.source) { | |
| 5448 | - case "attribute": { | |
| 5449 | - let matcher3 = attr( | |
| 5450 | - sourceConfig.selector, | |
| 5451 | - sourceConfig.attribute | |
| 5452 | - ); | |
| 5453 | - if (sourceConfig.type === "boolean") { | |
| 5454 | - matcher3 = toBooleanAttributeMatcher(matcher3); | |
| 5455 | - } | |
| 5456 | - return matcher3; | |
| 8899 | + var matcherFromSource = memize((sourceConfig) => { | |
| 8900 | + switch (sourceConfig.source) { | |
| 8901 | + case "attribute": { | |
| 8902 | + let matcher3 = attr(sourceConfig.selector, sourceConfig.attribute); | |
| 8903 | + if (sourceConfig.type === "boolean") { | |
| 8904 | + matcher3 = toBooleanAttributeMatcher(matcher3); | |
| 5457 | 8905 | } |
| 5458 | - case "html": | |
| 5459 | - return html(sourceConfig.selector, sourceConfig.multiline); | |
| 5460 | - case "text": | |
| 5461 | - return text(sourceConfig.selector); | |
| 5462 | - case "rich-text": | |
| 5463 | - return richText( | |
| 5464 | - sourceConfig.selector, | |
| 5465 | - sourceConfig.__unstablePreserveWhiteSpace | |
| 5466 | - ); | |
| 5467 | - case "children": | |
| 5468 | - return matcher(sourceConfig.selector); | |
| 5469 | - case "node": | |
| 5470 | - return matcher2(sourceConfig.selector); | |
| 5471 | - case "query": | |
| 5472 | - const subMatchers = Object.fromEntries( | |
| 5473 | - Object.entries(sourceConfig.query).map( | |
| 5474 | - ([key, subSourceConfig]) => [ | |
| 5475 | - key, | |
| 5476 | - matcherFromSource(subSourceConfig) | |
| 5477 | - ] | |
| 5478 | - ) | |
| 5479 | - ); | |
| 5480 | - return query(sourceConfig.selector, subMatchers); | |
| 5481 | - case "tag": { | |
| 5482 | - const matcher3 = prop(sourceConfig.selector, "nodeName"); | |
| 5483 | - return (domNode) => matcher3(domNode)?.toLowerCase(); | |
| 5484 | - } | |
| 5485 | - default: | |
| 5486 | - console.error( | |
| 5487 | - `Unknown source type "${sourceConfig.source}"` | |
| 5488 | - ); | |
| 5489 | - return void 0; | |
| 8906 | + return matcher3; | |
| 5490 | 8907 | } |
| 8908 | + case "html": | |
| 8909 | + return html(sourceConfig.selector, sourceConfig.multiline); | |
| 8910 | + case "text": | |
| 8911 | + return text(sourceConfig.selector); | |
| 8912 | + case "rich-text": | |
| 8913 | + return richText( | |
| 8914 | + sourceConfig.selector, | |
| 8915 | + sourceConfig.__unstablePreserveWhiteSpace | |
| 8916 | + ); | |
| 8917 | + case "children": | |
| 8918 | + return matcher(sourceConfig.selector); | |
| 8919 | + case "node": | |
| 8920 | + return matcher2(sourceConfig.selector); | |
| 8921 | + case "query": | |
| 8922 | + const subMatchers = Object.fromEntries( | |
| 8923 | + Object.entries(sourceConfig.query).map( | |
| 8924 | + ([key, subSourceConfig]) => [ | |
| 8925 | + key, | |
| 8926 | + matcherFromSource(subSourceConfig) | |
| 8927 | + ] | |
| 8928 | + ) | |
| 8929 | + ); | |
| 8930 | + return query(sourceConfig.selector, subMatchers); | |
| 8931 | + case "tag": { | |
| 8932 | + const matcher3 = prop(sourceConfig.selector, "nodeName"); | |
| 8933 | + return (domNode) => matcher3(domNode)?.toLowerCase(); | |
| 8934 | + } | |
| 8935 | + default: | |
| 8936 | + console.error(`Unknown source type "${sourceConfig.source}"`); | |
| 5491 | 8937 | } |
| 5492 | - ); | |
| 8938 | + }); | |
| 5493 | 8939 | function parseHtml(innerHTML) { |
| 5494 | 8940 | return parse(innerHTML, (h2) => h2); |
| 5495 | 8941 | } |
| 5496 | 8942 | function parseWithAttributeSchema(innerHTML, attributeSchema) { |
| 5497 | - return matcherFromSource(attributeSchema)( | |
| 5498 | - parseHtml(innerHTML) | |
| 5499 | - ); | |
| 8943 | + return matcherFromSource(attributeSchema)(parseHtml(innerHTML)); | |
| 5500 | 8944 | } |
| 5501 | 8945 | function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) { |
| 5502 | 8946 | const doc = parseHtml(innerHTML); |
| 5503 | 8947 | const blockType = normalizeBlockType(blockTypeOrName); |
| 5504 | 8948 | const blockAttributes = Object.fromEntries( |
| 5505 | - Object.entries(blockType?.attributes ?? {}).map( | |
| 8949 | + Object.entries(blockType.attributes ?? {}).map( | |
| 5506 | 8950 | ([key, schema]) => [ |
| 5507 | 8951 | key, |
| 5508 | 8952 | getBlockAttribute(key, schema, doc, attributes, innerHTML) |
| 5509 | 8953 | ] |
| @@ -5594,14 +9038,14 @@ | ||
| 5594 | 9038 | let updatedBlockAttributes = attributes; |
| 5595 | 9039 | updatedBlockAttributes = fixCustomClassname( |
| 5596 | 9040 | attributes, |
| 5597 | 9041 | blockType, |
| 5598 | - originalContent ?? "" | |
| 9042 | + originalContent | |
| 5599 | 9043 | ); |
| 5600 | 9044 | updatedBlockAttributes = fixGlobalAttribute( |
| 5601 | 9045 | updatedBlockAttributes, |
| 5602 | 9046 | blockType, |
| 5603 | - originalContent ?? "", | |
| 9047 | + originalContent, | |
| 5604 | 9048 | "ariaLabel", |
| 5605 | 9049 | "data-aria-label", |
| 5606 | 9050 | ARIA_LABEL_ATTR_SCHEMA |
| 5607 | 9051 | ); |
| @@ -5607,9 +9051,9 @@ | ||
| 5607 | 9051 | ); |
| 5608 | 9052 | updatedBlockAttributes = fixGlobalAttribute( |
| 5609 | 9053 | updatedBlockAttributes, |
| 5610 | 9054 | blockType, |
| 5611 | - originalContent ?? "", | |
| 9055 | + originalContent, | |
| 5612 | 9056 | "anchor", |
| 5613 | 9057 | "data-anchor", |
| 5614 | 9058 | ANCHOR_ATTR_SCHEMA |
| 5615 | 9059 | ); |
| @@ -5623,9 +9067,9 @@ | ||
| 5623 | 9067 | function stubFalse() { |
| 5624 | 9068 | return false; |
| 5625 | 9069 | } |
| 5626 | 9070 | function applyBlockDeprecatedVersions(block, rawBlock, blockType) { |
| 5627 | - const parsedAttributes = rawBlock.attrs ?? {}; | |
| 9071 | + const parsedAttributes = rawBlock.attrs; | |
| 5628 | 9072 | const { deprecated: deprecatedDefinitions } = blockType; |
| 5629 | 9073 | if (!deprecatedDefinitions || !deprecatedDefinitions.length) { |
| 5630 | 9074 | return block; |
| 5631 | 9075 | } |
| @@ -5637,12 +9081,9 @@ | ||
| 5637 | 9081 | })) { |
| 5638 | 9082 | continue; |
| 5639 | 9083 | } |
| 5640 | 9084 | const deprecatedBlockType = Object.assign( |
| 5641 | - omit( | |
| 5642 | - blockType, | |
| 5643 | - DEPRECATED_ENTRY_KEYS | |
| 5644 | - ), | |
| 9085 | + omit(blockType, DEPRECATED_ENTRY_KEYS), | |
| 5645 | 9086 | deprecatedDefinitions[i2] |
| 5646 | 9087 | ); |
| 5647 | 9088 | let migratedBlock = { |
| 5648 | 9089 | ...block, |
| @@ -5647,9 +9088,9 @@ | ||
| 5647 | 9088 | let migratedBlock = { |
| 5648 | 9089 | ...block, |
| 5649 | 9090 | attributes: getBlockAttributes( |
| 5650 | 9091 | deprecatedBlockType, |
| 5651 | - block.originalContent ?? "", | |
| 9092 | + block.originalContent, | |
| 5652 | 9093 | parsedAttributes |
| 5653 | 9094 | ) |
| 5654 | 9095 | }; |
| 5655 | 9096 | let [isValid] = validateBlock(migratedBlock, deprecatedBlockType); |
| @@ -5690,9 +9131,9 @@ | ||
| 5690 | 9131 | // packages/blocks/build-module/api/parser/index.mjs |
| 5691 | 9132 | function convertLegacyBlocks(rawBlock) { |
| 5692 | 9133 | const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes( |
| 5693 | 9134 | rawBlock.blockName, |
| 5694 | - rawBlock.attrs ?? {} | |
| 9135 | + rawBlock.attrs | |
| 5695 | 9136 | ); |
| 5696 | 9137 | return { |
| 5697 | 9138 | ...rawBlock, |
| 5698 | 9139 | blockName: correctName, |
| @@ -5773,16 +9214,8 @@ | ||
| 5773 | 9214 | ), |
| 5774 | 9215 | parsedInnerBlocks |
| 5775 | 9216 | ); |
| 5776 | 9217 | parsedBlock.originalContent = normalizedBlock.innerHTML; |
| 5777 | - if (blockType.name === "core/html") { | |
| 5778 | - parsedBlock.innerContent = normalizedBlock.innerContent ?? [ | |
| 5779 | - normalizedBlock.innerHTML | |
| 5780 | - ]; | |
| 5781 | - parsedBlock.isValid = true; | |
| 5782 | - parsedBlock.validationIssues = []; | |
| 5783 | - return parsedBlock; | |
| 5784 | - } | |
| 5785 | 9218 | const validatedBlock = applyBlockValidation(parsedBlock, blockType); |
| 5786 | 9219 | const { validationIssues } = validatedBlock; |
| 5787 | 9220 | const updatedBlock = applyBlockDeprecatedVersions( |
| 5788 | 9221 | validatedBlock, |
| @@ -5807,27 +9240,24 @@ | ||
| 5807 | 9240 | } |
| 5808 | 9241 | return updatedBlock; |
| 5809 | 9242 | } |
| 5810 | 9243 | function parse2(content, options) { |
| 5811 | - return (0, import_block_serialization_default_parser.parse)(content).reduce( | |
| 5812 | - (accumulator, rawBlock) => { | |
| 5813 | - const block = parseRawBlock( | |
| 5814 | - rawBlock, | |
| 5815 | - options | |
| 5816 | - ); | |
| 5817 | - if (block) { | |
| 5818 | - accumulator.push(block); | |
| 5819 | - } | |
| 5820 | - return accumulator; | |
| 5821 | - }, | |
| 5822 | - [] | |
| 5823 | - ); | |
| 9244 | + return (0, import_block_serialization_default_parser.parse)(content).reduce((accumulator, rawBlock) => { | |
| 9245 | + const block = parseRawBlock(rawBlock, options); | |
| 9246 | + if (block) { | |
| 9247 | + accumulator.push(block); | |
| 9248 | + } | |
| 9249 | + return accumulator; | |
| 9250 | + }, []); | |
| 5824 | 9251 | } |
| 5825 | 9252 | |
| 5826 | 9253 | // packages/blocks/build-module/api/raw-handling/index.mjs |
| 5827 | - var import_deprecated11 = __toESM(require_deprecated(), 1); | |
| 5828 | - var import_dom13 = __toESM(require_dom(), 1); | |
| 9254 | + var import_deprecated10 = __toESM(require_deprecated(), 1); | |
| 9255 | + var import_dom12 = __toESM(require_dom(), 1); | |
| 5829 | 9256 | |
| 9257 | + // packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs | |
| 9258 | + var import_element4 = __toESM(require_element(), 1); | |
| 9259 | + | |
| 5830 | 9260 | // packages/blocks/build-module/api/raw-handling/get-raw-transforms.mjs |
| 5831 | 9261 | function getRawTransforms() { |
| 5832 | 9262 | return getBlockTransforms("from").filter(({ type }) => type === "raw").map((transform) => { |
| 5833 | 9263 | return transform.isMatch ? transform : { |
| @@ -5841,23 +9271,22 @@ | ||
| 5841 | 9271 | function htmlToBlocks(html2, handler) { |
| 5842 | 9272 | const doc = document.implementation.createHTMLDocument(""); |
| 5843 | 9273 | doc.body.innerHTML = html2; |
| 5844 | 9274 | return Array.from(doc.body.children).flatMap((node) => { |
| 5845 | - const transforms = getRawTransforms(); | |
| 5846 | 9275 | const rawTransform = findTransform( |
| 5847 | - transforms, | |
| 5848 | - ((t3) => { | |
| 5849 | - const transform2 = t3; | |
| 5850 | - return transform2.isMatch(node); | |
| 5851 | - }) | |
| 9276 | + getRawTransforms(), | |
| 9277 | + ({ isMatch }) => isMatch(node) | |
| 5852 | 9278 | ); |
| 5853 | 9279 | if (!rawTransform) { |
| 9280 | + if (import_element4.Platform.isNative) { | |
| 9281 | + return parse2( | |
| 9282 | + `<!-- wp:html -->${node.outerHTML}<!-- /wp:html -->` | |
| 9283 | + ); | |
| 9284 | + } | |
| 5854 | 9285 | return createBlock( |
| 5855 | 9286 | // Should not be hardcoded. |
| 5856 | 9287 | "core/html", |
| 5857 | - {}, | |
| 5858 | - [], | |
| 5859 | - [node.outerHTML] | |
| 9288 | + getBlockAttributes("core/html", node.outerHTML) | |
| 5860 | 9289 | ); |
| 5861 | 9290 | } |
| 5862 | 9291 | const { transform, blockName } = rawTransform; |
| 5863 | 9292 | if (transform) { |
| @@ -6003,9 +9432,9 @@ | ||
| 6003 | 9432 | if (!isList(node)) { |
| 6004 | 9433 | return; |
| 6005 | 9434 | } |
| 6006 | 9435 | const list = node; |
| 6007 | - const prevElement = list.previousElementSibling; | |
| 9436 | + const prevElement = node.previousElementSibling; | |
| 6008 | 9437 | if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { |
| 6009 | 9438 | while (list.firstChild) { |
| 6010 | 9439 | prevElement.appendChild(list.firstChild); |
| 6011 | 9440 | } |
| @@ -6021,9 +9450,9 @@ | ||
| 6021 | 9450 | parentList.removeChild(parentListItem); |
| 6022 | 9451 | } |
| 6023 | 9452 | } |
| 6024 | 9453 | if (parentElement && isList(parentElement)) { |
| 6025 | - const prevListItem = list.previousElementSibling; | |
| 9454 | + const prevListItem = node.previousElementSibling; | |
| 6026 | 9455 | if (prevListItem) { |
| 6027 | 9456 | prevListItem.appendChild(node); |
| 6028 | 9457 | } else { |
| 6029 | 9458 | (0, import_dom4.unwrap)(node); |
| @@ -6031,14 +9460,13 @@ | ||
| 6031 | 9460 | } |
| 6032 | 9461 | } |
| 6033 | 9462 | |
| 6034 | 9463 | // packages/blocks/build-module/api/raw-handling/blockquote-normaliser.mjs |
| 6035 | - function blockquoteNormaliser(options = {}) { | |
| 6036 | - return (bq) => { | |
| 6037 | - if (bq.nodeName !== "BLOCKQUOTE") { | |
| 9464 | + function blockquoteNormaliser(options) { | |
| 9465 | + return (node) => { | |
| 9466 | + if (node.nodeName !== "BLOCKQUOTE") { | |
| 6038 | 9467 | return; |
| 6039 | 9468 | } |
| 6040 | - const node = bq; | |
| 6041 | 9469 | node.innerHTML = normaliseBlocks(node.innerHTML, options); |
| 6042 | 9470 | }; |
| 6043 | 9471 | } |
| 6044 | 9472 | |
| @@ -6060,9 +9488,9 @@ | ||
| 6060 | 9488 | beforeElement.parentNode.insertBefore(figure, beforeElement); |
| 6061 | 9489 | figure.appendChild(element); |
| 6062 | 9490 | } |
| 6063 | 9491 | function figureContentReducer(node, doc, schema) { |
| 6064 | - if (!schema || !isFigureContent(node, schema)) { | |
| 9492 | + if (!isFigureContent(node, schema)) { | |
| 6065 | 9493 | return; |
| 6066 | 9494 | } |
| 6067 | 9495 | let nodeToInsert = node; |
| 6068 | 9496 | const parentNode = node.parentNode; |
| @@ -6070,12 +9498,11 @@ | ||
| 6070 | 9498 | nodeToInsert = node.parentNode; |
| 6071 | 9499 | } |
| 6072 | 9500 | const wrapper = nodeToInsert.closest("p,div"); |
| 6073 | 9501 | if (wrapper) { |
| 6074 | - const element = node; | |
| 6075 | - if (!element.classList) { | |
| 9502 | + if (!node.classList) { | |
| 6076 | 9503 | wrapFigureContent(nodeToInsert, wrapper); |
| 6077 | - } else if (element.classList.contains("alignright") || element.classList.contains("alignleft") || element.classList.contains("aligncenter") || !wrapper.textContent.trim()) { | |
| 9504 | + } else if (node.classList.contains("alignright") || node.classList.contains("alignleft") || node.classList.contains("aligncenter") || !wrapper.textContent.trim()) { | |
| 6078 | 9505 | wrapFigureContent(nodeToInsert, wrapper); |
| 6079 | 9506 | } |
| 6080 | 9507 | } else { |
| 6081 | 9508 | wrapFigureContent(nodeToInsert); |
| @@ -6084,22 +9511,17 @@ | ||
| 6084 | 9511 | |
| 6085 | 9512 | // packages/blocks/build-module/api/raw-handling/shortcode-converter.mjs |
| 6086 | 9513 | var import_shortcode = __toESM(require_shortcode(), 1); |
| 6087 | 9514 | var castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; |
| 6088 | - var beforeLineRegexp = /(\n|<p>|<br\s*\/?>)\s*$/; | |
| 6089 | - var afterLineRegexp = /^\s*(\n|<\/p>|<br\s*\/?>)/; | |
| 9515 | + var beforeLineRegexp = /(\n|<p>)\s*$/; | |
| 9516 | + var afterLineRegexp = /^\s*(\n|<\/p>)/; | |
| 6090 | 9517 | function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) { |
| 6091 | - const transformsFrom = getBlockTransforms( | |
| 6092 | - "from" | |
| 6093 | - ); | |
| 9518 | + const transformsFrom = getBlockTransforms("from"); | |
| 6094 | 9519 | const transformation = findTransform( |
| 6095 | 9520 | transformsFrom, |
| 6096 | - ((transform) => { | |
| 6097 | - const t3 = transform; | |
| 6098 | - return excludedBlockNames.indexOf(t3.blockName) === -1 && t3.type === "shortcode" && castArray(t3.tag).some( | |
| 6099 | - (tag) => (0, import_shortcode.regexp)(tag).test(HTML) | |
| 6100 | - ); | |
| 6101 | - }) | |
| 9521 | + (transform) => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === "shortcode" && castArray(transform.tag).some( | |
| 9522 | + (tag) => (0, import_shortcode.regexp)(tag).test(HTML) | |
| 9523 | + ) | |
| 6102 | 9524 | ); |
| 6103 | 9525 | if (!transformation) { |
| 6104 | 9526 | return [HTML]; |
| 6105 | 9527 | } |
| @@ -6214,18 +9636,13 @@ | ||
| 6214 | 9636 | case "children": { |
| 6215 | 9637 | if (objValue === "*" || srcValue === "*") { |
| 6216 | 9638 | return "*"; |
| 6217 | 9639 | } |
| 6218 | - return mergeSchemas( | |
| 6219 | - { ...objValue || {} }, | |
| 6220 | - srcValue || {} | |
| 6221 | - ); | |
| 9640 | + return { ...objValue, ...srcValue }; | |
| 6222 | 9641 | } |
| 6223 | 9642 | case "attributes": |
| 6224 | 9643 | case "require": { |
| 6225 | - return Array.from( | |
| 6226 | - /* @__PURE__ */ new Set([...objValue || [], ...srcValue || []]) | |
| 6227 | - ); | |
| 9644 | + return [...objValue || [], ...srcValue || []]; | |
| 6228 | 9645 | } |
| 6229 | 9646 | case "isMatch": { |
| 6230 | 9647 | if (!objValue || !srcValue) { |
| 6231 | 9648 | return void 0; |
| @@ -6233,48 +9650,20 @@ | ||
| 6233 | 9650 | return (...args) => { |
| 6234 | 9651 | return objValue(...args) || srcValue(...args); |
| 6235 | 9652 | }; |
| 6236 | 9653 | } |
| 6237 | - case "classes": { | |
| 6238 | - if ((objValue || []).includes("*") || (srcValue || []).includes("*")) { | |
| 6239 | - return ["*"]; | |
| 6240 | - } | |
| 6241 | - return [...objValue || [], ...srcValue || []]; | |
| 6242 | - } | |
| 6243 | 9654 | } |
| 6244 | 9655 | } |
| 6245 | - function mergeTagNameSchemas(a2, b3) { | |
| 6246 | - if (a2 === b3) { | |
| 6247 | - return a2; | |
| 9656 | + function mergeTagNameSchemas(a2, b2) { | |
| 9657 | + for (const key in b2) { | |
| 9658 | + a2[key] = a2[key] ? mergeTagNameSchemaProperties(a2[key], b2[key], key) : { ...b2[key] }; | |
| 6248 | 9659 | } |
| 6249 | - for (const key in b3) { | |
| 6250 | - if (a2[key]) { | |
| 6251 | - a2[key] = mergeTagNameSchemaProperties( | |
| 6252 | - a2[key], | |
| 6253 | - b3[key], | |
| 6254 | - key | |
| 6255 | - ); | |
| 6256 | - } else if (Array.isArray(b3[key])) { | |
| 6257 | - a2[key] = b3[key].slice(); | |
| 6258 | - } else { | |
| 6259 | - a2[key] = { ...b3[key] }; | |
| 6260 | - } | |
| 6261 | - } | |
| 6262 | 9660 | return a2; |
| 6263 | 9661 | } |
| 6264 | - function mergeSchemas(a2, b3) { | |
| 6265 | - if (a2 === b3) { | |
| 6266 | - return a2; | |
| 9662 | + function mergeSchemas(a2, b2) { | |
| 9663 | + for (const key in b2) { | |
| 9664 | + a2[key] = a2[key] ? mergeTagNameSchemas(a2[key], b2[key]) : { ...b2[key] }; | |
| 6267 | 9665 | } |
| 6268 | - for (const key in b3) { | |
| 6269 | - if (a2[key]) { | |
| 6270 | - a2[key] = mergeTagNameSchemas(a2[key], b3[key]); | |
| 6271 | - } else if (Array.isArray(b3[key])) { | |
| 6272 | - a2[key] = b3[key].slice(); | |
| 6273 | - } else { | |
| 6274 | - a2[key] = { ...b3[key] }; | |
| 6275 | - } | |
| 6276 | - } | |
| 6277 | 9666 | return a2; |
| 6278 | 9667 | } |
| 6279 | 9668 | return schemas.reduce(mergeSchemas, {}); |
| 6280 | 9669 | } |
| @@ -6331,9 +9720,9 @@ | ||
| 6331 | 9720 | return getSibling(parentNode, which); |
| 6332 | 9721 | } |
| 6333 | 9722 | |
| 6334 | 9723 | // packages/blocks/build-module/api/raw-handling/paste-handler.mjs |
| 6335 | - var import_dom12 = __toESM(require_dom(), 1); | |
| 9724 | + var import_dom11 = __toESM(require_dom(), 1); | |
| 6336 | 9725 | |
| 6337 | 9726 | // packages/blocks/build-module/api/raw-handling/comment-remover.mjs |
| 6338 | 9727 | var import_dom7 = __toESM(require_dom(), 1); |
| 6339 | 9728 | function commentRemover(node) { |
| @@ -6365,9 +9754,9 @@ | ||
| 6365 | 9754 | (node) => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag) |
| 6366 | 9755 | ); |
| 6367 | 9756 | } |
| 6368 | 9757 | function isDoubleBR(node) { |
| 6369 | - return node.nodeName === "BR" && !!node.previousSibling && node.previousSibling.nodeName === "BR"; | |
| 9758 | + return node.nodeName === "BR" && node.previousSibling && node.previousSibling.nodeName === "BR"; | |
| 6370 | 9759 | } |
| 6371 | 9760 | function isInlineContent(HTML, contextTag) { |
| 6372 | 9761 | const doc = document.implementation.createHTMLDocument(""); |
| 6373 | 9762 | doc.body.innerHTML = HTML; |
| @@ -6385,40 +9774,38 @@ | ||
| 6385 | 9774 | textDecorationLine, |
| 6386 | 9775 | textDecoration, |
| 6387 | 9776 | verticalAlign |
| 6388 | 9777 | } = node.style; |
| 6389 | - const element = node; | |
| 6390 | 9778 | if (fontWeight === "bold" || fontWeight === "700") { |
| 6391 | - (0, import_dom9.wrap)(doc.createElement("strong"), element); | |
| 9779 | + (0, import_dom9.wrap)(doc.createElement("strong"), node); | |
| 6392 | 9780 | } |
| 6393 | 9781 | if (fontStyle === "italic") { |
| 6394 | - (0, import_dom9.wrap)(doc.createElement("em"), element); | |
| 9782 | + (0, import_dom9.wrap)(doc.createElement("em"), node); | |
| 6395 | 9783 | } |
| 6396 | 9784 | if (textDecorationLine === "line-through" || textDecoration.includes("line-through")) { |
| 6397 | - (0, import_dom9.wrap)(doc.createElement("s"), element); | |
| 9785 | + (0, import_dom9.wrap)(doc.createElement("s"), node); | |
| 6398 | 9786 | } |
| 6399 | 9787 | if (verticalAlign === "super") { |
| 6400 | - (0, import_dom9.wrap)(doc.createElement("sup"), element); | |
| 9788 | + (0, import_dom9.wrap)(doc.createElement("sup"), node); | |
| 6401 | 9789 | } else if (verticalAlign === "sub") { |
| 6402 | - (0, import_dom9.wrap)(doc.createElement("sub"), element); | |
| 9790 | + (0, import_dom9.wrap)(doc.createElement("sub"), node); | |
| 6403 | 9791 | } |
| 6404 | 9792 | } else if (node.nodeName === "B") { |
| 6405 | - (0, import_dom9.replaceTag)(node, "strong"); | |
| 9793 | + node = (0, import_dom9.replaceTag)(node, "strong"); | |
| 6406 | 9794 | } else if (node.nodeName === "I") { |
| 6407 | - (0, import_dom9.replaceTag)(node, "em"); | |
| 9795 | + node = (0, import_dom9.replaceTag)(node, "em"); | |
| 6408 | 9796 | } else if (node.nodeName === "A") { |
| 6409 | - const anchor = node; | |
| 6410 | - if (anchor.target && anchor.target.toLowerCase() === "_blank") { | |
| 6411 | - anchor.rel = "noopener"; | |
| 9797 | + if (node.target && node.target.toLowerCase() === "_blank") { | |
| 9798 | + node.rel = "noreferrer noopener"; | |
| 6412 | 9799 | } else { |
| 6413 | - anchor.removeAttribute("target"); | |
| 6414 | - anchor.removeAttribute("rel"); | |
| 9800 | + node.removeAttribute("target"); | |
| 9801 | + node.removeAttribute("rel"); | |
| 6415 | 9802 | } |
| 6416 | - if (anchor.name && !anchor.id) { | |
| 6417 | - anchor.id = anchor.name; | |
| 9803 | + if (node.name && !node.id) { | |
| 9804 | + node.id = node.name; | |
| 6418 | 9805 | } |
| 6419 | - if (anchor.id && !anchor.ownerDocument.querySelector(`[href="#${anchor.id}"]`)) { | |
| 6420 | - anchor.removeAttribute("id"); | |
| 9806 | + if (node.id && !node.ownerDocument.querySelector(`[href="#${node.id}"]`)) { | |
| 9807 | + node.removeAttribute("id"); | |
| 6421 | 9808 | } |
| 6422 | 9809 | } |
| 6423 | 9810 | } |
| 6424 | 9811 | |
| @@ -6434,25 +9821,21 @@ | ||
| 6434 | 9821 | function msListIgnore(node) { |
| 6435 | 9822 | if (node.nodeType !== node.ELEMENT_NODE) { |
| 6436 | 9823 | return; |
| 6437 | 9824 | } |
| 6438 | - const el = node; | |
| 6439 | - const style = el.getAttribute("style"); | |
| 9825 | + const style = node.getAttribute("style"); | |
| 6440 | 9826 | if (!style || !style.includes("mso-list")) { |
| 6441 | 9827 | return; |
| 6442 | 9828 | } |
| 6443 | - const rules = style.split(";").reduce( | |
| 6444 | - (acc, rule) => { | |
| 6445 | - const [key, value] = rule.split(":"); | |
| 6446 | - if (key && value) { | |
| 6447 | - acc[key.trim().toLowerCase()] = value.trim().toLowerCase(); | |
| 6448 | - } | |
| 6449 | - return acc; | |
| 6450 | - }, | |
| 6451 | - {} | |
| 6452 | - ); | |
| 9829 | + const rules = style.split(";").reduce((acc, rule) => { | |
| 9830 | + const [key, value] = rule.split(":"); | |
| 9831 | + if (key && value) { | |
| 9832 | + acc[key.trim().toLowerCase()] = value.trim().toLowerCase(); | |
| 9833 | + } | |
| 9834 | + return acc; | |
| 9835 | + }, {}); | |
| 6453 | 9836 | if (rules["mso-list"] === "ignore") { |
| 6454 | - el.remove(); | |
| 9837 | + node.remove(); | |
| 6455 | 9838 | } |
| 6456 | 9839 | } |
| 6457 | 9840 | |
| 6458 | 9841 | // packages/blocks/build-module/api/raw-handling/ms-list-converter.mjs |
| @@ -6462,28 +9845,27 @@ | ||
| 6462 | 9845 | function msListConverter(node, doc) { |
| 6463 | 9846 | if (node.nodeName !== "P") { |
| 6464 | 9847 | return; |
| 6465 | 9848 | } |
| 6466 | - const element = node; | |
| 6467 | - const style = element.getAttribute("style"); | |
| 9849 | + const style = node.getAttribute("style"); | |
| 6468 | 9850 | if (!style || !style.includes("mso-list")) { |
| 6469 | 9851 | return; |
| 6470 | 9852 | } |
| 6471 | - const prevNode = element.previousElementSibling; | |
| 9853 | + const prevNode = node.previousElementSibling; | |
| 6472 | 9854 | if (!prevNode || !isList2(prevNode)) { |
| 6473 | - const type = element.textContent.trim().slice(0, 1); | |
| 9855 | + const type = node.textContent.trim().slice(0, 1); | |
| 6474 | 9856 | const isNumeric = /[1iIaA]/.test(type); |
| 6475 | 9857 | const newListNode = doc.createElement(isNumeric ? "ol" : "ul"); |
| 6476 | 9858 | if (isNumeric) { |
| 6477 | 9859 | newListNode.setAttribute("type", type); |
| 6478 | 9860 | } |
| 6479 | - element.parentNode.insertBefore(newListNode, element); | |
| 9861 | + node.parentNode.insertBefore(newListNode, node); | |
| 6480 | 9862 | } |
| 6481 | - const listNode = element.previousElementSibling; | |
| 9863 | + const listNode = node.previousElementSibling; | |
| 6482 | 9864 | const listType = listNode.nodeName; |
| 6483 | 9865 | const listItem = doc.createElement("li"); |
| 6484 | 9866 | let receivingNode = listNode; |
| 6485 | - listItem.innerHTML = deepFilterHTML(element.innerHTML, [msListIgnore]); | |
| 9867 | + listItem.innerHTML = deepFilterHTML(node.innerHTML, [msListIgnore]); | |
| 6486 | 9868 | const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style); |
| 6487 | 9869 | let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0; |
| 6488 | 9870 | while (level--) { |
| 6489 | 9871 | receivingNode = receivingNode.lastChild || receivingNode; |
| @@ -6496,18 +9878,17 @@ | ||
| 6496 | 9878 | doc.createElement(listType) |
| 6497 | 9879 | ); |
| 6498 | 9880 | } |
| 6499 | 9881 | receivingNode.appendChild(listItem); |
| 6500 | - element.parentNode.removeChild(element); | |
| 9882 | + node.parentNode.removeChild(node); | |
| 6501 | 9883 | } |
| 6502 | 9884 | |
| 6503 | 9885 | // packages/blocks/build-module/api/raw-handling/image-corrector.mjs |
| 6504 | 9886 | var import_blob = __toESM(require_blob(), 1); |
| 6505 | - function imageCorrector(img) { | |
| 6506 | - if (img.nodeName !== "IMG") { | |
| 9887 | + function imageCorrector(node) { | |
| 9888 | + if (node.nodeName !== "IMG") { | |
| 6507 | 9889 | return; |
| 6508 | 9890 | } |
| 6509 | - const node = img; | |
| 6510 | 9891 | if (node.src.indexOf("file:") === 0) { |
| 6511 | 9892 | node.src = ""; |
| 6512 | 9893 | } |
| 6513 | 9894 | if (node.src.indexOf("data:") === 0) { |
| @@ -6519,9 +9900,9 @@ | ||
| 6519 | 9900 | } |
| 6520 | 9901 | let decoded; |
| 6521 | 9902 | try { |
| 6522 | 9903 | decoded = atob(data); |
| 6523 | - } catch { | |
| 9904 | + } catch (e2) { | |
| 6524 | 9905 | node.src = ""; |
| 6525 | 9906 | return; |
| 6526 | 9907 | } |
| 6527 | 9908 | const uint8Array = new Uint8Array(decoded.length); |
| @@ -6537,1273 +9918,24 @@ | ||
| 6537 | 9918 | } |
| 6538 | 9919 | } |
| 6539 | 9920 | |
| 6540 | 9921 | // packages/blocks/build-module/api/raw-handling/div-normaliser.mjs |
| 6541 | - function divNormaliser(div) { | |
| 6542 | - if (div.nodeName !== "DIV") { | |
| 9922 | + function divNormaliser(node) { | |
| 9923 | + if (node.nodeName !== "DIV") { | |
| 6543 | 9924 | return; |
| 6544 | 9925 | } |
| 6545 | - const node = div; | |
| 6546 | 9926 | node.innerHTML = normaliseBlocks(node.innerHTML); |
| 6547 | 9927 | } |
| 6548 | 9928 | |
| 6549 | - // node_modules/marked/lib/marked.esm.js | |
| 6550 | - function z() { | |
| 6551 | - return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null }; | |
| 6552 | - } | |
| 6553 | - var T = z(); | |
| 6554 | - function G(l4) { | |
| 6555 | - T = l4; | |
| 6556 | - } | |
| 6557 | - var _ = { exec: () => null }; | |
| 6558 | - function d2(l4, e2 = "") { | |
| 6559 | - let t3 = typeof l4 == "string" ? l4 : l4.source, n2 = { replace: (s2, r2) => { | |
| 6560 | - let i2 = typeof r2 == "string" ? r2 : r2.source; | |
| 6561 | - return i2 = i2.replace(m2.caret, "$1"), t3 = t3.replace(s2, i2), n2; | |
| 6562 | - }, getRegex: () => new RegExp(t3, e2) }; | |
| 6563 | - return n2; | |
| 6564 | - } | |
| 6565 | - var Re = ((l4 = "") => { | |
| 6566 | - try { | |
| 6567 | - return !!new RegExp("(?<=1)(?<!1)" + l4); | |
| 6568 | - } catch { | |
| 6569 | - return false; | |
| 6570 | - } | |
| 6571 | - })(); | |
| 6572 | - var m2 = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l4) => new RegExp(`^( {0,3}${l4})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}#`), htmlBeginRegex: (l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}>`) }; | |
| 6573 | - var Te = /^(?:[ \t]*(?:\n|$))+/; | |
| 6574 | - var Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/; | |
| 6575 | - var we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/; | |
| 6576 | - var I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/; | |
| 6577 | - var ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/; | |
| 6578 | - var Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/; | |
| 6579 | - var ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/; | |
| 6580 | - var oe = d2(ie).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(); | |
| 6581 | - var Pe = d2(ie).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(); | |
| 6582 | - var j2 = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/; | |
| 6583 | - var Se = /^[^\n]+/; | |
| 6584 | - var F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/; | |
| 6585 | - var $e = d2(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(); | |
| 6586 | - var Le = d2(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(); | |
| 6587 | - var v2 = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul"; | |
| 6588 | - var U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/; | |
| 6589 | - var _e = d2("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v2).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); | |
| 6590 | - var ae = d2(j2).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v2).getRegex(); | |
| 6591 | - var Me = d2(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(); | |
| 6592 | - var K = { blockquote: Me, code: Oe, def: $e, fences: we, heading: ye, hr: I, html: _e, lheading: oe, list: Le, newline: Te, paragraph: ae, table: _, text: Se }; | |
| 6593 | - var re = d2("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v2).getRegex(); | |
| 6594 | - var ze = { ...K, lheading: Pe, table: re, paragraph: d2(j2).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v2).getRegex() }; | |
| 6595 | - var Ee = { ...K, html: d2(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d2(j2).replace("hr", I).replace("heading", ` *#{1,6} *[^ | |
| 6596 | -]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }; | |
| 6597 | - var Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/; | |
| 6598 | - var Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/; | |
| 6599 | - var le = /^( {2,}|\\)\n(?!\s*$)/; | |
| 6600 | - var Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/; | |
| 6601 | - var E = /[\p{P}\p{S}]/u; | |
| 6602 | - var H2 = /[\s\p{P}\p{S}]/u; | |
| 6603 | - var W = /[^\s\p{P}\p{S}]/u; | |
| 6604 | - var Be = d2(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H2).getRegex(); | |
| 6605 | - var ue = /(?!~)[\p{P}\p{S}]/u; | |
| 6606 | - var De = /(?!~)[\s\p{P}\p{S}]/u; | |
| 6607 | - var qe = /(?:[^\s\p{P}\p{S}]|~)/u; | |
| 6608 | - var ve = d2(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(); | |
| 6609 | - var pe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/; | |
| 6610 | - var He = d2(pe, "u").replace(/punct/g, E).getRegex(); | |
| 6611 | - var Ze = d2(pe, "u").replace(/punct/g, ue).getRegex(); | |
| 6612 | - var ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)"; | |
| 6613 | - var Ge = d2(ce, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H2).replace(/punct/g, E).getRegex(); | |
| 6614 | - var Ne = d2(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, ue).getRegex(); | |
| 6615 | - var Qe = d2("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H2).replace(/punct/g, E).getRegex(); | |
| 6616 | - var je = d2(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, E).getRegex(); | |
| 6617 | - var Fe = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)"; | |
| 6618 | - var Ue = d2(Fe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H2).replace(/punct/g, E).getRegex(); | |
| 6619 | - var Ke = d2(/\\(punct)/, "gu").replace(/punct/g, E).getRegex(); | |
| 6620 | - var We = d2(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(); | |
| 6621 | - var Xe = d2(U).replace("(?:-->|$)", "-->").getRegex(); | |
| 6622 | - var Je = d2("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Xe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(); | |
| 6623 | - var q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/; | |
| 6624 | - var Ve = d2(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(); | |
| 6625 | - var he = d2(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(); | |
| 6626 | - var ke = d2(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(); | |
| 6627 | - var Ye = d2("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex(); | |
| 6628 | - var se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/; | |
| 6629 | - var X = { _backpedal: _, anyPunctuation: Ke, autolink: We, blockSkip: ve, br: le, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: He, emStrongRDelimAst: Ge, emStrongRDelimUnd: Qe, escape: Ae, link: Ve, nolink: ke, punctuation: Be, reflink: he, reflinkSearch: Ye, tag: Je, text: Ie, url: _ }; | |
| 6630 | - var et = { ...X, link: d2(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: d2(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }; | |
| 6631 | - var N2 = { ...X, emStrongRDelimAst: Ne, emStrongLDelim: Ze, delLDelim: je, delRDelim: Ue, url: d2(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d2(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex() }; | |
| 6632 | - var tt = { ...N2, br: d2(le).replace("{2,}", "*").getRegex(), text: d2(N2.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }; | |
| 6633 | - var B = { normal: K, gfm: ze, pedantic: Ee }; | |
| 6634 | - var A = { normal: X, gfm: N2, breaks: tt, pedantic: et }; | |
| 6635 | - var nt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }; | |
| 6636 | - var de = (l4) => nt[l4]; | |
| 6637 | - function O(l4, e2) { | |
| 6638 | - if (e2) { | |
| 6639 | - if (m2.escapeTest.test(l4)) return l4.replace(m2.escapeReplace, de); | |
| 6640 | - } else if (m2.escapeTestNoEncode.test(l4)) return l4.replace(m2.escapeReplaceNoEncode, de); | |
| 6641 | - return l4; | |
| 6642 | - } | |
| 6643 | - function J(l4) { | |
| 6644 | - try { | |
| 6645 | - l4 = encodeURI(l4).replace(m2.percentDecode, "%"); | |
| 6646 | - } catch { | |
| 6647 | - return null; | |
| 6648 | - } | |
| 6649 | - return l4; | |
| 6650 | - } | |
| 6651 | - function V(l4, e2) { | |
| 6652 | - let t3 = l4.replace(m2.findPipe, (r2, i2, o3) => { | |
| 6653 | - let u2 = false, a2 = i2; | |
| 6654 | - for (; --a2 >= 0 && o3[a2] === "\\"; ) u2 = !u2; | |
| 6655 | - return u2 ? "|" : " |"; | |
| 6656 | - }), n2 = t3.split(m2.splitPipe), s2 = 0; | |
| 6657 | - if (n2[0].trim() || n2.shift(), n2.length > 0 && !n2.at(-1)?.trim() && n2.pop(), e2) if (n2.length > e2) n2.splice(e2); | |
| 6658 | - else for (; n2.length < e2; ) n2.push(""); | |
| 6659 | - for (; s2 < n2.length; s2++) n2[s2] = n2[s2].trim().replace(m2.slashPipe, "|"); | |
| 6660 | - return n2; | |
| 6661 | - } | |
| 6662 | - function $2(l4, e2, t3) { | |
| 6663 | - let n2 = l4.length; | |
| 6664 | - if (n2 === 0) return ""; | |
| 6665 | - let s2 = 0; | |
| 6666 | - for (; s2 < n2; ) { | |
| 6667 | - let r2 = l4.charAt(n2 - s2 - 1); | |
| 6668 | - if (r2 === e2 && !t3) s2++; | |
| 6669 | - else if (r2 !== e2 && t3) s2++; | |
| 6670 | - else break; | |
| 6671 | - } | |
| 6672 | - return l4.slice(0, n2 - s2); | |
| 6673 | - } | |
| 6674 | - function Y(l4) { | |
| 6675 | - let e2 = l4.split(` | |
| 6676 | -`), t3 = e2.length - 1; | |
| 6677 | - for (; t3 >= 0 && m2.blankLine.test(e2[t3]); ) t3--; | |
| 6678 | - return e2.length - t3 <= 2 ? l4 : e2.slice(0, t3 + 1).join(` | |
| 6679 | -`); | |
| 6680 | - } | |
| 6681 | - function ge(l4, e2) { | |
| 6682 | - if (l4.indexOf(e2[1]) === -1) return -1; | |
| 6683 | - let t3 = 0; | |
| 6684 | - for (let n2 = 0; n2 < l4.length; n2++) if (l4[n2] === "\\") n2++; | |
| 6685 | - else if (l4[n2] === e2[0]) t3++; | |
| 6686 | - else if (l4[n2] === e2[1] && (t3--, t3 < 0)) return n2; | |
| 6687 | - return t3 > 0 ? -2 : -1; | |
| 6688 | - } | |
| 6689 | - function fe(l4, e2 = 0) { | |
| 6690 | - let t3 = e2, n2 = ""; | |
| 6691 | - for (let s2 of l4) if (s2 === " ") { | |
| 6692 | - let r2 = 4 - t3 % 4; | |
| 6693 | - n2 += " ".repeat(r2), t3 += r2; | |
| 6694 | - } else n2 += s2, t3++; | |
| 6695 | - return n2; | |
| 6696 | - } | |
| 6697 | - function me(l4, e2, t3, n2, s2) { | |
| 6698 | - let r2 = e2.href, i2 = e2.title || null, o3 = l4[1].replace(s2.other.outputLinkReplace, "$1"); | |
| 6699 | - n2.state.inLink = true; | |
| 6700 | - let u2 = { type: l4[0].charAt(0) === "!" ? "image" : "link", raw: t3, href: r2, title: i2, text: o3, tokens: n2.inlineTokens(o3) }; | |
| 6701 | - return n2.state.inLink = false, u2; | |
| 6702 | - } | |
| 6703 | - function rt(l4, e2, t3) { | |
| 6704 | - let n2 = l4.match(t3.other.indentCodeCompensation); | |
| 6705 | - if (n2 === null) return e2; | |
| 6706 | - let s2 = n2[1]; | |
| 6707 | - return e2.split(` | |
| 6708 | -`).map((r2) => { | |
| 6709 | - let i2 = r2.match(t3.other.beginningSpace); | |
| 6710 | - if (i2 === null) return r2; | |
| 6711 | - let [o3] = i2; | |
| 6712 | - return o3.length >= s2.length ? r2.slice(s2.length) : r2; | |
| 6713 | - }).join(` | |
| 6714 | -`); | |
| 6715 | - } | |
| 6716 | - var w2 = class { | |
| 6717 | - options; | |
| 6718 | - rules; | |
| 6719 | - lexer; | |
| 6720 | - constructor(e2) { | |
| 6721 | - this.options = e2 || T; | |
| 6722 | - } | |
| 6723 | - space(e2) { | |
| 6724 | - let t3 = this.rules.block.newline.exec(e2); | |
| 6725 | - if (t3 && t3[0].length > 0) return { type: "space", raw: t3[0] }; | |
| 6726 | - } | |
| 6727 | - code(e2) { | |
| 6728 | - let t3 = this.rules.block.code.exec(e2); | |
| 6729 | - if (t3) { | |
| 6730 | - let n2 = this.options.pedantic ? t3[0] : Y(t3[0]), s2 = n2.replace(this.rules.other.codeRemoveIndent, ""); | |
| 6731 | - return { type: "code", raw: n2, codeBlockStyle: "indented", text: s2 }; | |
| 6732 | - } | |
| 6733 | - } | |
| 6734 | - fences(e2) { | |
| 6735 | - let t3 = this.rules.block.fences.exec(e2); | |
| 6736 | - if (t3) { | |
| 6737 | - let n2 = t3[0], s2 = rt(n2, t3[3] || "", this.rules); | |
| 6738 | - return { type: "code", raw: n2, lang: t3[2] ? t3[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t3[2], text: s2 }; | |
| 6739 | - } | |
| 6740 | - } | |
| 6741 | - heading(e2) { | |
| 6742 | - let t3 = this.rules.block.heading.exec(e2); | |
| 6743 | - if (t3) { | |
| 6744 | - let n2 = t3[2].trim(); | |
| 6745 | - if (this.rules.other.endingHash.test(n2)) { | |
| 6746 | - let s2 = $2(n2, "#"); | |
| 6747 | - (this.options.pedantic || !s2 || this.rules.other.endingSpaceChar.test(s2)) && (n2 = s2.trim()); | |
| 6748 | - } | |
| 6749 | - return { type: "heading", raw: $2(t3[0], ` | |
| 6750 | -`), depth: t3[1].length, text: n2, tokens: this.lexer.inline(n2) }; | |
| 6751 | - } | |
| 6752 | - } | |
| 6753 | - hr(e2) { | |
| 6754 | - let t3 = this.rules.block.hr.exec(e2); | |
| 6755 | - if (t3) return { type: "hr", raw: $2(t3[0], ` | |
| 6756 | -`) }; | |
| 6757 | - } | |
| 6758 | - blockquote(e2) { | |
| 6759 | - let t3 = this.rules.block.blockquote.exec(e2); | |
| 6760 | - if (t3) { | |
| 6761 | - let n2 = $2(t3[0], ` | |
| 6762 | -`).split(` | |
| 6763 | -`), s2 = "", r2 = "", i2 = []; | |
| 6764 | - for (; n2.length > 0; ) { | |
| 6765 | - let o3 = false, u2 = [], a2; | |
| 6766 | - for (a2 = 0; a2 < n2.length; a2++) if (this.rules.other.blockquoteStart.test(n2[a2])) u2.push(n2[a2]), o3 = true; | |
| 6767 | - else if (!o3) u2.push(n2[a2]); | |
| 6768 | - else break; | |
| 6769 | - n2 = n2.slice(a2); | |
| 6770 | - let c2 = u2.join(` | |
| 6771 | -`), p2 = c2.replace(this.rules.other.blockquoteSetextReplace, ` | |
| 6772 | - $1`).replace(this.rules.other.blockquoteSetextReplace2, ""); | |
| 6773 | - s2 = s2 ? `${s2} | |
| 6774 | -${c2}` : c2, r2 = r2 ? `${r2} | |
| 6775 | -${p2}` : p2; | |
| 6776 | - let k2 = this.lexer.state.top; | |
| 6777 | - if (this.lexer.state.top = true, this.lexer.blockTokens(p2, i2, true), this.lexer.state.top = k2, n2.length === 0) break; | |
| 6778 | - let h2 = i2.at(-1); | |
| 6779 | - if (h2?.type === "code") break; | |
| 6780 | - if (h2?.type === "blockquote") { | |
| 6781 | - let R = h2, f2 = R.raw + ` | |
| 6782 | -` + n2.join(` | |
| 6783 | -`), S2 = this.blockquote(f2); | |
| 6784 | - i2[i2.length - 1] = S2, s2 = s2.substring(0, s2.length - R.raw.length) + S2.raw, r2 = r2.substring(0, r2.length - R.text.length) + S2.text; | |
| 6785 | - break; | |
| 6786 | - } else if (h2?.type === "list") { | |
| 6787 | - let R = h2, f2 = R.raw + ` | |
| 6788 | -` + n2.join(` | |
| 6789 | -`), S2 = this.list(f2); | |
| 6790 | - i2[i2.length - 1] = S2, s2 = s2.substring(0, s2.length - h2.raw.length) + S2.raw, r2 = r2.substring(0, r2.length - R.raw.length) + S2.raw, n2 = f2.substring(i2.at(-1).raw.length).split(` | |
| 6791 | -`); | |
| 6792 | - continue; | |
| 6793 | - } | |
| 6794 | - } | |
| 6795 | - return { type: "blockquote", raw: s2, tokens: i2, text: r2 }; | |
| 6796 | - } | |
| 6797 | - } | |
| 6798 | - list(e2) { | |
| 6799 | - let t3 = this.rules.block.list.exec(e2); | |
| 6800 | - if (t3) { | |
| 6801 | - let n2 = t3[1].trim(), s2 = n2.length > 1, r2 = { type: "list", raw: "", ordered: s2, start: s2 ? +n2.slice(0, -1) : "", loose: false, items: [] }; | |
| 6802 | - n2 = s2 ? `\\d{1,9}\\${n2.slice(-1)}` : `\\${n2}`, this.options.pedantic && (n2 = s2 ? n2 : "[*+-]"); | |
| 6803 | - let i2 = this.rules.other.listItemRegex(n2), o3 = false; | |
| 6804 | - for (; e2; ) { | |
| 6805 | - let a2 = false, c2 = "", p2 = ""; | |
| 6806 | - if (!(t3 = i2.exec(e2)) || this.rules.block.hr.test(e2)) break; | |
| 6807 | - c2 = t3[0], e2 = e2.substring(c2.length); | |
| 6808 | - let k2 = fe(t3[2].split(` | |
| 6809 | -`, 1)[0], t3[1].length), h2 = e2.split(` | |
| 6810 | -`, 1)[0], R = !k2.trim(), f2 = 0; | |
| 6811 | - if (this.options.pedantic ? (f2 = 2, p2 = k2.trimStart()) : R ? f2 = t3[1].length + 1 : (f2 = k2.search(this.rules.other.nonSpaceChar), f2 = f2 > 4 ? 1 : f2, p2 = k2.slice(f2), f2 += t3[1].length), R && this.rules.other.blankLine.test(h2) && (c2 += h2 + ` | |
| 6812 | -`, e2 = e2.substring(h2.length + 1), a2 = true), !a2) { | |
| 6813 | - let S2 = this.rules.other.nextBulletRegex(f2), ee = this.rules.other.hrRegex(f2), te = this.rules.other.fencesBeginRegex(f2), ne = this.rules.other.headingBeginRegex(f2), xe = this.rules.other.htmlBeginRegex(f2), be = this.rules.other.blockquoteBeginRegex(f2); | |
| 6814 | - for (; e2; ) { | |
| 6815 | - let Z = e2.split(` | |
| 6816 | -`, 1)[0], C; | |
| 6817 | - if (h2 = Z, this.options.pedantic ? (h2 = h2.replace(this.rules.other.listReplaceNesting, " "), C = h2) : C = h2.replace(this.rules.other.tabCharGlobal, " "), te.test(h2) || ne.test(h2) || xe.test(h2) || be.test(h2) || S2.test(h2) || ee.test(h2)) break; | |
| 6818 | - if (C.search(this.rules.other.nonSpaceChar) >= f2 || !h2.trim()) p2 += ` | |
| 6819 | -` + C.slice(f2); | |
| 6820 | - else { | |
| 6821 | - if (R || k2.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(k2) || ne.test(k2) || ee.test(k2)) break; | |
| 6822 | - p2 += ` | |
| 6823 | -` + h2; | |
| 6824 | - } | |
| 6825 | - R = !h2.trim(), c2 += Z + ` | |
| 6826 | -`, e2 = e2.substring(Z.length + 1), k2 = C.slice(f2); | |
| 6827 | - } | |
| 6828 | - } | |
| 6829 | - r2.loose || (o3 ? r2.loose = true : this.rules.other.doubleBlankLine.test(c2) && (o3 = true)), r2.items.push({ type: "list_item", raw: c2, task: !!this.options.gfm && this.rules.other.listIsTask.test(p2), loose: false, text: p2, tokens: [] }), r2.raw += c2; | |
| 6830 | - } | |
| 6831 | - let u2 = r2.items.at(-1); | |
| 6832 | - if (u2) u2.raw = u2.raw.trimEnd(), u2.text = u2.text.trimEnd(); | |
| 6833 | - else return; | |
| 6834 | - r2.raw = r2.raw.trimEnd(); | |
| 6835 | - for (let a2 of r2.items) { | |
| 6836 | - this.lexer.state.top = false, a2.tokens = this.lexer.blockTokens(a2.text, []); | |
| 6837 | - let c2 = a2.tokens[0]; | |
| 6838 | - if (a2.task && (c2?.type === "text" || c2?.type === "paragraph")) { | |
| 6839 | - a2.text = a2.text.replace(this.rules.other.listReplaceTask, ""), c2.raw = c2.raw.replace(this.rules.other.listReplaceTask, ""), c2.text = c2.text.replace(this.rules.other.listReplaceTask, ""); | |
| 6840 | - for (let k2 = this.lexer.inlineQueue.length - 1; k2 >= 0; k2--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k2].src)) { | |
| 6841 | - this.lexer.inlineQueue[k2].src = this.lexer.inlineQueue[k2].src.replace(this.rules.other.listReplaceTask, ""); | |
| 6842 | - break; | |
| 6843 | - } | |
| 6844 | - let p2 = this.rules.other.listTaskCheckbox.exec(a2.raw); | |
| 6845 | - if (p2) { | |
| 6846 | - let k2 = { type: "checkbox", raw: p2[0] + " ", checked: p2[0] !== "[ ]" }; | |
| 6847 | - a2.checked = k2.checked, r2.loose ? a2.tokens[0] && ["paragraph", "text"].includes(a2.tokens[0].type) && "tokens" in a2.tokens[0] && a2.tokens[0].tokens ? (a2.tokens[0].raw = k2.raw + a2.tokens[0].raw, a2.tokens[0].text = k2.raw + a2.tokens[0].text, a2.tokens[0].tokens.unshift(k2)) : a2.tokens.unshift({ type: "paragraph", raw: k2.raw, text: k2.raw, tokens: [k2] }) : a2.tokens.unshift(k2); | |
| 6848 | - } | |
| 6849 | - } else a2.task && (a2.task = false); | |
| 6850 | - if (!r2.loose) { | |
| 6851 | - let p2 = a2.tokens.filter((h2) => h2.type === "space"), k2 = p2.length > 0 && p2.some((h2) => this.rules.other.anyLine.test(h2.raw)); | |
| 6852 | - r2.loose = k2; | |
| 6853 | - } | |
| 6854 | - } | |
| 6855 | - if (r2.loose) for (let a2 of r2.items) { | |
| 6856 | - a2.loose = true; | |
| 6857 | - for (let c2 of a2.tokens) c2.type === "text" && (c2.type = "paragraph"); | |
| 6858 | - } | |
| 6859 | - return r2; | |
| 6860 | - } | |
| 6861 | - } | |
| 6862 | - html(e2) { | |
| 6863 | - let t3 = this.rules.block.html.exec(e2); | |
| 6864 | - if (t3) { | |
| 6865 | - let n2 = Y(t3[0]); | |
| 6866 | - return { type: "html", block: true, raw: n2, pre: t3[1] === "pre" || t3[1] === "script" || t3[1] === "style", text: n2 }; | |
| 6867 | - } | |
| 6868 | - } | |
| 6869 | - def(e2) { | |
| 6870 | - let t3 = this.rules.block.def.exec(e2); | |
| 6871 | - if (t3) { | |
| 6872 | - let n2 = t3[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s2 = t3[2] ? t3[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r2 = t3[3] ? t3[3].substring(1, t3[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t3[3]; | |
| 6873 | - return { type: "def", tag: n2, raw: $2(t3[0], ` | |
| 6874 | -`), href: s2, title: r2 }; | |
| 6875 | - } | |
| 6876 | - } | |
| 6877 | - table(e2) { | |
| 6878 | - let t3 = this.rules.block.table.exec(e2); | |
| 6879 | - if (!t3 || !this.rules.other.tableDelimiter.test(t3[2])) return; | |
| 6880 | - let n2 = V(t3[1]), s2 = t3[2].replace(this.rules.other.tableAlignChars, "").split("|"), r2 = t3[3]?.trim() ? t3[3].replace(this.rules.other.tableRowBlankLine, "").split(` | |
| 6881 | -`) : [], i2 = { type: "table", raw: $2(t3[0], ` | |
| 6882 | -`), header: [], align: [], rows: [] }; | |
| 6883 | - if (n2.length === s2.length) { | |
| 6884 | - for (let o3 of s2) this.rules.other.tableAlignRight.test(o3) ? i2.align.push("right") : this.rules.other.tableAlignCenter.test(o3) ? i2.align.push("center") : this.rules.other.tableAlignLeft.test(o3) ? i2.align.push("left") : i2.align.push(null); | |
| 6885 | - for (let o3 = 0; o3 < n2.length; o3++) i2.header.push({ text: n2[o3], tokens: this.lexer.inline(n2[o3]), header: true, align: i2.align[o3] }); | |
| 6886 | - for (let o3 of r2) i2.rows.push(V(o3, i2.header.length).map((u2, a2) => ({ text: u2, tokens: this.lexer.inline(u2), header: false, align: i2.align[a2] }))); | |
| 6887 | - return i2; | |
| 6888 | - } | |
| 6889 | - } | |
| 6890 | - lheading(e2) { | |
| 6891 | - let t3 = this.rules.block.lheading.exec(e2); | |
| 6892 | - if (t3) { | |
| 6893 | - let n2 = t3[1].trim(); | |
| 6894 | - return { type: "heading", raw: $2(t3[0], ` | |
| 6895 | -`), depth: t3[2].charAt(0) === "=" ? 1 : 2, text: n2, tokens: this.lexer.inline(n2) }; | |
| 6896 | - } | |
| 6897 | - } | |
| 6898 | - paragraph(e2) { | |
| 6899 | - let t3 = this.rules.block.paragraph.exec(e2); | |
| 6900 | - if (t3) { | |
| 6901 | - let n2 = t3[1].charAt(t3[1].length - 1) === ` | |
| 6902 | -` ? t3[1].slice(0, -1) : t3[1]; | |
| 6903 | - return { type: "paragraph", raw: t3[0], text: n2, tokens: this.lexer.inline(n2) }; | |
| 6904 | - } | |
| 6905 | - } | |
| 6906 | - text(e2) { | |
| 6907 | - let t3 = this.rules.block.text.exec(e2); | |
| 6908 | - if (t3) return { type: "text", raw: t3[0], text: t3[0], tokens: this.lexer.inline(t3[0]) }; | |
| 6909 | - } | |
| 6910 | - escape(e2) { | |
| 6911 | - let t3 = this.rules.inline.escape.exec(e2); | |
| 6912 | - if (t3) return { type: "escape", raw: t3[0], text: t3[1] }; | |
| 6913 | - } | |
| 6914 | - tag(e2) { | |
| 6915 | - let t3 = this.rules.inline.tag.exec(e2); | |
| 6916 | - if (t3) return !this.lexer.state.inLink && this.rules.other.startATag.test(t3[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t3[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t3[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t3[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t3[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t3[0] }; | |
| 6917 | - } | |
| 6918 | - link(e2) { | |
| 6919 | - let t3 = this.rules.inline.link.exec(e2); | |
| 6920 | - if (t3) { | |
| 6921 | - let n2 = t3[2].trim(); | |
| 6922 | - if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n2)) { | |
| 6923 | - if (!this.rules.other.endAngleBracket.test(n2)) return; | |
| 6924 | - let i2 = $2(n2.slice(0, -1), "\\"); | |
| 6925 | - if ((n2.length - i2.length) % 2 === 0) return; | |
| 6926 | - } else { | |
| 6927 | - let i2 = ge(t3[2], "()"); | |
| 6928 | - if (i2 === -2) return; | |
| 6929 | - if (i2 > -1) { | |
| 6930 | - let u2 = (t3[0].indexOf("!") === 0 ? 5 : 4) + t3[1].length + i2; | |
| 6931 | - t3[2] = t3[2].substring(0, i2), t3[0] = t3[0].substring(0, u2).trim(), t3[3] = ""; | |
| 6932 | - } | |
| 6933 | - } | |
| 6934 | - let s2 = t3[2], r2 = ""; | |
| 6935 | - if (this.options.pedantic) { | |
| 6936 | - let i2 = this.rules.other.pedanticHrefTitle.exec(s2); | |
| 6937 | - i2 && (s2 = i2[1], r2 = i2[3]); | |
| 6938 | - } else r2 = t3[3] ? t3[3].slice(1, -1) : ""; | |
| 6939 | - return s2 = s2.trim(), this.rules.other.startAngleBracket.test(s2) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n2) ? s2 = s2.slice(1) : s2 = s2.slice(1, -1)), me(t3, { href: s2 && s2.replace(this.rules.inline.anyPunctuation, "$1"), title: r2 && r2.replace(this.rules.inline.anyPunctuation, "$1") }, t3[0], this.lexer, this.rules); | |
| 6940 | - } | |
| 6941 | - } | |
| 6942 | - reflink(e2, t3) { | |
| 6943 | - let n2; | |
| 6944 | - if ((n2 = this.rules.inline.reflink.exec(e2)) || (n2 = this.rules.inline.nolink.exec(e2))) { | |
| 6945 | - let s2 = (n2[2] || n2[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r2 = t3[s2.toLowerCase()]; | |
| 6946 | - if (!r2) { | |
| 6947 | - let i2 = n2[0].charAt(0); | |
| 6948 | - return { type: "text", raw: i2, text: i2 }; | |
| 6949 | - } | |
| 6950 | - return me(n2, r2, n2[0], this.lexer, this.rules); | |
| 6951 | - } | |
| 6952 | - } | |
| 6953 | - emStrong(e2, t3, n2 = "") { | |
| 6954 | - let s2 = this.rules.inline.emStrongLDelim.exec(e2); | |
| 6955 | - if (!s2 || !s2[1] && !s2[2] && !s2[3] && !s2[4] || s2[4] && n2.match(this.rules.other.unicodeAlphaNumeric)) return; | |
| 6956 | - if (!(s2[1] || s2[3] || "") || !n2 || this.rules.inline.punctuation.exec(n2)) { | |
| 6957 | - let i2 = [...s2[0]].length - 1, o3, u2, a2 = i2, c2 = 0, p2 = s2[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; | |
| 6958 | - for (p2.lastIndex = 0, t3 = t3.slice(-1 * e2.length + i2); (s2 = p2.exec(t3)) !== null; ) { | |
| 6959 | - if (o3 = s2[1] || s2[2] || s2[3] || s2[4] || s2[5] || s2[6], !o3) continue; | |
| 6960 | - if (u2 = [...o3].length, s2[3] || s2[4]) { | |
| 6961 | - a2 += u2; | |
| 6962 | - continue; | |
| 6963 | - } else if ((s2[5] || s2[6]) && i2 % 3 && !((i2 + u2) % 3)) { | |
| 6964 | - c2 += u2; | |
| 6965 | - continue; | |
| 6966 | - } | |
| 6967 | - if (a2 -= u2, a2 > 0) continue; | |
| 6968 | - u2 = Math.min(u2, u2 + a2 + c2); | |
| 6969 | - let k2 = [...s2[0]][0].length, h2 = e2.slice(0, i2 + s2.index + k2 + u2); | |
| 6970 | - if (Math.min(i2, u2) % 2) { | |
| 6971 | - let f2 = h2.slice(1, -1); | |
| 6972 | - return { type: "em", raw: h2, text: f2, tokens: this.lexer.inlineTokens(f2) }; | |
| 6973 | - } | |
| 6974 | - let R = h2.slice(2, -2); | |
| 6975 | - return { type: "strong", raw: h2, text: R, tokens: this.lexer.inlineTokens(R) }; | |
| 6976 | - } | |
| 6977 | - } | |
| 6978 | - } | |
| 6979 | - codespan(e2) { | |
| 6980 | - let t3 = this.rules.inline.code.exec(e2); | |
| 6981 | - if (t3) { | |
| 6982 | - let n2 = t3[2].replace(this.rules.other.newLineCharGlobal, " "), s2 = this.rules.other.nonSpaceChar.test(n2), r2 = this.rules.other.startingSpaceChar.test(n2) && this.rules.other.endingSpaceChar.test(n2); | |
| 6983 | - return s2 && r2 && (n2 = n2.substring(1, n2.length - 1)), { type: "codespan", raw: t3[0], text: n2 }; | |
| 6984 | - } | |
| 6985 | - } | |
| 6986 | - br(e2) { | |
| 6987 | - let t3 = this.rules.inline.br.exec(e2); | |
| 6988 | - if (t3) return { type: "br", raw: t3[0] }; | |
| 6989 | - } | |
| 6990 | - del(e2, t3, n2 = "") { | |
| 6991 | - let s2 = this.rules.inline.delLDelim.exec(e2); | |
| 6992 | - if (!s2) return; | |
| 6993 | - if (!(s2[1] || "") || !n2 || this.rules.inline.punctuation.exec(n2)) { | |
| 6994 | - let i2 = [...s2[0]].length - 1, o3, u2, a2 = i2, c2 = this.rules.inline.delRDelim; | |
| 6995 | - for (c2.lastIndex = 0, t3 = t3.slice(-1 * e2.length + i2); (s2 = c2.exec(t3)) !== null; ) { | |
| 6996 | - if (o3 = s2[1] || s2[2] || s2[3] || s2[4] || s2[5] || s2[6], !o3 || (u2 = [...o3].length, u2 !== i2)) continue; | |
| 6997 | - if (s2[3] || s2[4]) { | |
| 6998 | - a2 += u2; | |
| 6999 | - continue; | |
| 7000 | - } | |
| 7001 | - if (a2 -= u2, a2 > 0) continue; | |
| 7002 | - u2 = Math.min(u2, u2 + a2); | |
| 7003 | - let p2 = [...s2[0]][0].length, k2 = e2.slice(0, i2 + s2.index + p2 + u2), h2 = k2.slice(i2, -i2); | |
| 7004 | - return { type: "del", raw: k2, text: h2, tokens: this.lexer.inlineTokens(h2) }; | |
| 7005 | - } | |
| 7006 | - } | |
| 7007 | - } | |
| 7008 | - autolink(e2) { | |
| 7009 | - let t3 = this.rules.inline.autolink.exec(e2); | |
| 7010 | - if (t3) { | |
| 7011 | - let n2, s2; | |
| 7012 | - return t3[2] === "@" ? (n2 = t3[1], s2 = "mailto:" + n2) : (n2 = t3[1], s2 = n2), { type: "link", raw: t3[0], text: n2, href: s2, tokens: [{ type: "text", raw: n2, text: n2 }] }; | |
| 7013 | - } | |
| 7014 | - } | |
| 7015 | - url(e2) { | |
| 7016 | - let t3; | |
| 7017 | - if (t3 = this.rules.inline.url.exec(e2)) { | |
| 7018 | - let n2, s2; | |
| 7019 | - if (t3[2] === "@") n2 = t3[0], s2 = "mailto:" + n2; | |
| 7020 | - else { | |
| 7021 | - let r2; | |
| 7022 | - do | |
| 7023 | - r2 = t3[0], t3[0] = this.rules.inline._backpedal.exec(t3[0])?.[0] ?? ""; | |
| 7024 | - while (r2 !== t3[0]); | |
| 7025 | - n2 = t3[0], t3[1] === "www." ? s2 = "http://" + t3[0] : s2 = t3[0]; | |
| 7026 | - } | |
| 7027 | - return { type: "link", raw: t3[0], text: n2, href: s2, tokens: [{ type: "text", raw: n2, text: n2 }] }; | |
| 7028 | - } | |
| 7029 | - } | |
| 7030 | - inlineText(e2) { | |
| 7031 | - let t3 = this.rules.inline.text.exec(e2); | |
| 7032 | - if (t3) { | |
| 7033 | - let n2 = this.lexer.state.inRawBlock; | |
| 7034 | - return { type: "text", raw: t3[0], text: t3[0], escaped: n2 }; | |
| 7035 | - } | |
| 7036 | - } | |
| 7037 | - }; | |
| 7038 | - var x2 = class l2 { | |
| 7039 | - tokens; | |
| 7040 | - options; | |
| 7041 | - state; | |
| 7042 | - inlineQueue; | |
| 7043 | - tokenizer; | |
| 7044 | - constructor(e2) { | |
| 7045 | - this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e2 || T, this.options.tokenizer = this.options.tokenizer || new w2(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true }; | |
| 7046 | - let t3 = { other: m2, block: B.normal, inline: A.normal }; | |
| 7047 | - this.options.pedantic ? (t3.block = B.pedantic, t3.inline = A.pedantic) : this.options.gfm && (t3.block = B.gfm, this.options.breaks ? t3.inline = A.breaks : t3.inline = A.gfm), this.tokenizer.rules = t3; | |
| 7048 | - } | |
| 7049 | - static get rules() { | |
| 7050 | - return { block: B, inline: A }; | |
| 7051 | - } | |
| 7052 | - static lex(e2, t3) { | |
| 7053 | - return new l2(t3).lex(e2); | |
| 7054 | - } | |
| 7055 | - static lexInline(e2, t3) { | |
| 7056 | - return new l2(t3).inlineTokens(e2); | |
| 7057 | - } | |
| 7058 | - lex(e2) { | |
| 7059 | - e2 = e2.replace(m2.carriageReturn, ` | |
| 7060 | -`), this.blockTokens(e2, this.tokens); | |
| 7061 | - for (let t3 = 0; t3 < this.inlineQueue.length; t3++) { | |
| 7062 | - let n2 = this.inlineQueue[t3]; | |
| 7063 | - this.inlineTokens(n2.src, n2.tokens); | |
| 7064 | - } | |
| 7065 | - return this.inlineQueue = [], this.tokens; | |
| 7066 | - } | |
| 7067 | - blockTokens(e2, t3 = [], n2 = false) { | |
| 7068 | - this.tokenizer.lexer = this, this.options.pedantic && (e2 = e2.replace(m2.tabCharGlobal, " ").replace(m2.spaceLine, "")); | |
| 7069 | - let s2 = 1 / 0; | |
| 7070 | - for (; e2; ) { | |
| 7071 | - if (e2.length < s2) s2 = e2.length; | |
| 7072 | - else { | |
| 7073 | - this.infiniteLoopError(e2.charCodeAt(0)); | |
| 7074 | - break; | |
| 7075 | - } | |
| 7076 | - let r2; | |
| 7077 | - if (this.options.extensions?.block?.some((o3) => (r2 = o3.call({ lexer: this }, e2, t3)) ? (e2 = e2.substring(r2.raw.length), t3.push(r2), true) : false)) continue; | |
| 7078 | - if (r2 = this.tokenizer.space(e2)) { | |
| 7079 | - e2 = e2.substring(r2.raw.length); | |
| 7080 | - let o3 = t3.at(-1); | |
| 7081 | - r2.raw.length === 1 && o3 !== void 0 ? o3.raw += ` | |
| 7082 | -` : t3.push(r2); | |
| 7083 | - continue; | |
| 7084 | - } | |
| 7085 | - if (r2 = this.tokenizer.code(e2)) { | |
| 7086 | - e2 = e2.substring(r2.raw.length); | |
| 7087 | - let o3 = t3.at(-1); | |
| 7088 | - o3?.type === "paragraph" || o3?.type === "text" ? (o3.raw += (o3.raw.endsWith(` | |
| 7089 | -`) ? "" : ` | |
| 7090 | -`) + r2.raw, o3.text += ` | |
| 7091 | -` + r2.text, this.inlineQueue.at(-1).src = o3.text) : t3.push(r2); | |
| 7092 | - continue; | |
| 7093 | - } | |
| 7094 | - if (r2 = this.tokenizer.fences(e2)) { | |
| 7095 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7096 | - continue; | |
| 7097 | - } | |
| 7098 | - if (r2 = this.tokenizer.heading(e2)) { | |
| 7099 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7100 | - continue; | |
| 7101 | - } | |
| 7102 | - if (r2 = this.tokenizer.hr(e2)) { | |
| 7103 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7104 | - continue; | |
| 7105 | - } | |
| 7106 | - if (r2 = this.tokenizer.blockquote(e2)) { | |
| 7107 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7108 | - continue; | |
| 7109 | - } | |
| 7110 | - if (r2 = this.tokenizer.list(e2)) { | |
| 7111 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7112 | - continue; | |
| 7113 | - } | |
| 7114 | - if (r2 = this.tokenizer.html(e2)) { | |
| 7115 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7116 | - continue; | |
| 7117 | - } | |
| 7118 | - if (r2 = this.tokenizer.def(e2)) { | |
| 7119 | - e2 = e2.substring(r2.raw.length); | |
| 7120 | - let o3 = t3.at(-1); | |
| 7121 | - o3?.type === "paragraph" || o3?.type === "text" ? (o3.raw += (o3.raw.endsWith(` | |
| 7122 | -`) ? "" : ` | |
| 7123 | -`) + r2.raw, o3.text += ` | |
| 7124 | -` + r2.raw, this.inlineQueue.at(-1).src = o3.text) : this.tokens.links[r2.tag] || (this.tokens.links[r2.tag] = { href: r2.href, title: r2.title }, t3.push(r2)); | |
| 7125 | - continue; | |
| 7126 | - } | |
| 7127 | - if (r2 = this.tokenizer.table(e2)) { | |
| 7128 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7129 | - continue; | |
| 7130 | - } | |
| 7131 | - if (r2 = this.tokenizer.lheading(e2)) { | |
| 7132 | - e2 = e2.substring(r2.raw.length), t3.push(r2); | |
| 7133 | - continue; | |
| 7134 | - } | |
| 7135 | - let i2 = e2; | |
| 7136 | - if (this.options.extensions?.startBlock) { | |
| 7137 | - let o3 = 1 / 0, u2 = e2.slice(1), a2; | |
| 7138 | - this.options.extensions.startBlock.forEach((c2) => { | |
| 7139 | - a2 = c2.call({ lexer: this }, u2), typeof a2 == "number" && a2 >= 0 && (o3 = Math.min(o3, a2)); | |
| 7140 | - }), o3 < 1 / 0 && o3 >= 0 && (i2 = e2.substring(0, o3 + 1)); | |
| 7141 | - } | |
| 7142 | - if (this.state.top && (r2 = this.tokenizer.paragraph(i2))) { | |
| 7143 | - let o3 = t3.at(-1); | |
| 7144 | - n2 && o3?.type === "paragraph" ? (o3.raw += (o3.raw.endsWith(` | |
| 7145 | -`) ? "" : ` | |
| 7146 | -`) + r2.raw, o3.text += ` | |
| 7147 | -` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o3.text) : t3.push(r2), n2 = i2.length !== e2.length, e2 = e2.substring(r2.raw.length); | |
| 7148 | - continue; | |
| 7149 | - } | |
| 7150 | - if (r2 = this.tokenizer.text(e2)) { | |
| 7151 | - e2 = e2.substring(r2.raw.length); | |
| 7152 | - let o3 = t3.at(-1); | |
| 7153 | - o3?.type === "text" ? (o3.raw += (o3.raw.endsWith(` | |
| 7154 | -`) ? "" : ` | |
| 7155 | -`) + r2.raw, o3.text += ` | |
| 7156 | -` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o3.text) : t3.push(r2); | |
| 7157 | - continue; | |
| 7158 | - } | |
| 7159 | - if (e2) { | |
| 7160 | - this.infiniteLoopError(e2.charCodeAt(0)); | |
| 7161 | - break; | |
| 7162 | - } | |
| 7163 | - } | |
| 7164 | - return this.state.top = true, t3; | |
| 7165 | - } | |
| 7166 | - inline(e2, t3 = []) { | |
| 7167 | - return this.inlineQueue.push({ src: e2, tokens: t3 }), t3; | |
| 7168 | - } | |
| 7169 | - inlineTokens(e2, t3 = []) { | |
| 7170 | - this.tokenizer.lexer = this; | |
| 7171 | - let n2 = e2, s2 = null; | |
| 7172 | - if (this.tokens.links) { | |
| 7173 | - let a2 = Object.keys(this.tokens.links); | |
| 7174 | - if (a2.length > 0) for (; (s2 = this.tokenizer.rules.inline.reflinkSearch.exec(n2)) !== null; ) a2.includes(s2[0].slice(s2[0].lastIndexOf("[") + 1, -1)) && (n2 = n2.slice(0, s2.index) + "[" + "a".repeat(s2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)); | |
| 7175 | - } | |
| 7176 | - for (; (s2 = this.tokenizer.rules.inline.anyPunctuation.exec(n2)) !== null; ) n2 = n2.slice(0, s2.index) + "++" + n2.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); | |
| 7177 | - let r2; | |
| 7178 | - for (; (s2 = this.tokenizer.rules.inline.blockSkip.exec(n2)) !== null; ) r2 = s2[2] ? s2[2].length : 0, n2 = n2.slice(0, s2.index + r2) + "[" + "a".repeat(s2[0].length - r2 - 2) + "]" + n2.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); | |
| 7179 | - n2 = this.options.hooks?.emStrongMask?.call({ lexer: this }, n2) ?? n2; | |
| 7180 | - let i2 = false, o3 = "", u2 = 1 / 0; | |
| 7181 | - for (; e2; ) { | |
| 7182 | - if (e2.length < u2) u2 = e2.length; | |
| 7183 | - else { | |
| 7184 | - this.infiniteLoopError(e2.charCodeAt(0)); | |
| 7185 | - break; | |
| 7186 | - } | |
| 7187 | - i2 || (o3 = ""), i2 = false; | |
| 7188 | - let a2; | |
| 7189 | - if (this.options.extensions?.inline?.some((p2) => (a2 = p2.call({ lexer: this }, e2, t3)) ? (e2 = e2.substring(a2.raw.length), t3.push(a2), true) : false)) continue; | |
| 7190 | - if (a2 = this.tokenizer.escape(e2)) { | |
| 7191 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7192 | - continue; | |
| 7193 | - } | |
| 7194 | - if (a2 = this.tokenizer.tag(e2)) { | |
| 7195 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7196 | - continue; | |
| 7197 | - } | |
| 7198 | - if (a2 = this.tokenizer.link(e2)) { | |
| 7199 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7200 | - continue; | |
| 7201 | - } | |
| 7202 | - if (a2 = this.tokenizer.reflink(e2, this.tokens.links)) { | |
| 7203 | - e2 = e2.substring(a2.raw.length); | |
| 7204 | - let p2 = t3.at(-1); | |
| 7205 | - a2.type === "text" && p2?.type === "text" ? (p2.raw += a2.raw, p2.text += a2.text) : t3.push(a2); | |
| 7206 | - continue; | |
| 7207 | - } | |
| 7208 | - if (a2 = this.tokenizer.emStrong(e2, n2, o3)) { | |
| 7209 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7210 | - continue; | |
| 7211 | - } | |
| 7212 | - if (a2 = this.tokenizer.codespan(e2)) { | |
| 7213 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7214 | - continue; | |
| 7215 | - } | |
| 7216 | - if (a2 = this.tokenizer.br(e2)) { | |
| 7217 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7218 | - continue; | |
| 7219 | - } | |
| 7220 | - if (a2 = this.tokenizer.del(e2, n2, o3)) { | |
| 7221 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7222 | - continue; | |
| 7223 | - } | |
| 7224 | - if (a2 = this.tokenizer.autolink(e2)) { | |
| 7225 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7226 | - continue; | |
| 7227 | - } | |
| 7228 | - if (!this.state.inLink && (a2 = this.tokenizer.url(e2))) { | |
| 7229 | - e2 = e2.substring(a2.raw.length), t3.push(a2); | |
| 7230 | - continue; | |
| 7231 | - } | |
| 7232 | - let c2 = e2; | |
| 7233 | - if (this.options.extensions?.startInline) { | |
| 7234 | - let p2 = 1 / 0, k2 = e2.slice(1), h2; | |
| 7235 | - this.options.extensions.startInline.forEach((R) => { | |
| 7236 | - h2 = R.call({ lexer: this }, k2), typeof h2 == "number" && h2 >= 0 && (p2 = Math.min(p2, h2)); | |
| 7237 | - }), p2 < 1 / 0 && p2 >= 0 && (c2 = e2.substring(0, p2 + 1)); | |
| 7238 | - } | |
| 7239 | - if (a2 = this.tokenizer.inlineText(c2)) { | |
| 7240 | - e2 = e2.substring(a2.raw.length), a2.raw.slice(-1) !== "_" && (o3 = a2.raw.slice(-1)), i2 = true; | |
| 7241 | - let p2 = t3.at(-1); | |
| 7242 | - p2?.type === "text" ? (p2.raw += a2.raw, p2.text += a2.text) : t3.push(a2); | |
| 7243 | - continue; | |
| 7244 | - } | |
| 7245 | - if (e2) { | |
| 7246 | - this.infiniteLoopError(e2.charCodeAt(0)); | |
| 7247 | - break; | |
| 7248 | - } | |
| 7249 | - } | |
| 7250 | - return t3; | |
| 7251 | - } | |
| 7252 | - infiniteLoopError(e2) { | |
| 7253 | - let t3 = "Infinite loop on byte: " + e2; | |
| 7254 | - if (this.options.silent) console.error(t3); | |
| 7255 | - else throw new Error(t3); | |
| 7256 | - } | |
| 7257 | - }; | |
| 7258 | - var y2 = class { | |
| 7259 | - options; | |
| 7260 | - parser; | |
| 7261 | - constructor(e2) { | |
| 7262 | - this.options = e2 || T; | |
| 7263 | - } | |
| 7264 | - space(e2) { | |
| 7265 | - return ""; | |
| 7266 | - } | |
| 7267 | - code({ text: e2, lang: t3, escaped: n2 }) { | |
| 7268 | - let s2 = (t3 || "").match(m2.notSpaceStart)?.[0], r2 = e2.replace(m2.endingNewline, "") + ` | |
| 7269 | -`; | |
| 7270 | - return s2 ? '<pre><code class="language-' + O(s2) + '">' + (n2 ? r2 : O(r2, true)) + `</code></pre> | |
| 7271 | -` : "<pre><code>" + (n2 ? r2 : O(r2, true)) + `</code></pre> | |
| 7272 | -`; | |
| 7273 | - } | |
| 7274 | - blockquote({ tokens: e2 }) { | |
| 7275 | - return `<blockquote> | |
| 7276 | -${this.parser.parse(e2)}</blockquote> | |
| 7277 | -`; | |
| 7278 | - } | |
| 7279 | - html({ text: e2 }) { | |
| 7280 | - return e2; | |
| 7281 | - } | |
| 7282 | - def(e2) { | |
| 7283 | - return ""; | |
| 7284 | - } | |
| 7285 | - heading({ tokens: e2, depth: t3 }) { | |
| 7286 | - return `<h${t3}>${this.parser.parseInline(e2)}</h${t3}> | |
| 7287 | -`; | |
| 7288 | - } | |
| 7289 | - hr(e2) { | |
| 7290 | - return `<hr> | |
| 7291 | -`; | |
| 7292 | - } | |
| 7293 | - list(e2) { | |
| 7294 | - let t3 = e2.ordered, n2 = e2.start, s2 = ""; | |
| 7295 | - for (let o3 = 0; o3 < e2.items.length; o3++) { | |
| 7296 | - let u2 = e2.items[o3]; | |
| 7297 | - s2 += this.listitem(u2); | |
| 7298 | - } | |
| 7299 | - let r2 = t3 ? "ol" : "ul", i2 = t3 && n2 !== 1 ? ' start="' + n2 + '"' : ""; | |
| 7300 | - return "<" + r2 + i2 + `> | |
| 7301 | -` + s2 + "</" + r2 + `> | |
| 7302 | -`; | |
| 7303 | - } | |
| 7304 | - listitem(e2) { | |
| 7305 | - return `<li>${this.parser.parse(e2.tokens)}</li> | |
| 7306 | -`; | |
| 7307 | - } | |
| 7308 | - checkbox({ checked: e2 }) { | |
| 7309 | - return "<input " + (e2 ? 'checked="" ' : "") + 'disabled="" type="checkbox"> '; | |
| 7310 | - } | |
| 7311 | - paragraph({ tokens: e2 }) { | |
| 7312 | - return `<p>${this.parser.parseInline(e2)}</p> | |
| 7313 | -`; | |
| 7314 | - } | |
| 7315 | - table(e2) { | |
| 7316 | - let t3 = "", n2 = ""; | |
| 7317 | - for (let r2 = 0; r2 < e2.header.length; r2++) n2 += this.tablecell(e2.header[r2]); | |
| 7318 | - t3 += this.tablerow({ text: n2 }); | |
| 7319 | - let s2 = ""; | |
| 7320 | - for (let r2 = 0; r2 < e2.rows.length; r2++) { | |
| 7321 | - let i2 = e2.rows[r2]; | |
| 7322 | - n2 = ""; | |
| 7323 | - for (let o3 = 0; o3 < i2.length; o3++) n2 += this.tablecell(i2[o3]); | |
| 7324 | - s2 += this.tablerow({ text: n2 }); | |
| 7325 | - } | |
| 7326 | - return s2 && (s2 = `<tbody>${s2}</tbody>`), `<table> | |
| 7327 | -<thead> | |
| 7328 | -` + t3 + `</thead> | |
| 7329 | -` + s2 + `</table> | |
| 7330 | -`; | |
| 7331 | - } | |
| 7332 | - tablerow({ text: e2 }) { | |
| 7333 | - return `<tr> | |
| 7334 | -${e2}</tr> | |
| 7335 | -`; | |
| 7336 | - } | |
| 7337 | - tablecell(e2) { | |
| 7338 | - let t3 = this.parser.parseInline(e2.tokens), n2 = e2.header ? "th" : "td"; | |
| 7339 | - return (e2.align ? `<${n2} align="${e2.align}">` : `<${n2}>`) + t3 + `</${n2}> | |
| 7340 | -`; | |
| 7341 | - } | |
| 7342 | - strong({ tokens: e2 }) { | |
| 7343 | - return `<strong>${this.parser.parseInline(e2)}</strong>`; | |
| 7344 | - } | |
| 7345 | - em({ tokens: e2 }) { | |
| 7346 | - return `<em>${this.parser.parseInline(e2)}</em>`; | |
| 7347 | - } | |
| 7348 | - codespan({ text: e2 }) { | |
| 7349 | - return `<code>${O(e2, true)}</code>`; | |
| 7350 | - } | |
| 7351 | - br(e2) { | |
| 7352 | - return "<br>"; | |
| 7353 | - } | |
| 7354 | - del({ tokens: e2 }) { | |
| 7355 | - return `<del>${this.parser.parseInline(e2)}</del>`; | |
| 7356 | - } | |
| 7357 | - link({ href: e2, title: t3, tokens: n2 }) { | |
| 7358 | - let s2 = this.parser.parseInline(n2), r2 = J(e2); | |
| 7359 | - if (r2 === null) return s2; | |
| 7360 | - e2 = r2; | |
| 7361 | - let i2 = '<a href="' + e2 + '"'; | |
| 7362 | - return t3 && (i2 += ' title="' + O(t3) + '"'), i2 += ">" + s2 + "</a>", i2; | |
| 7363 | - } | |
| 7364 | - image({ href: e2, title: t3, text: n2, tokens: s2 }) { | |
| 7365 | - s2 && (n2 = this.parser.parseInline(s2, this.parser.textRenderer)); | |
| 7366 | - let r2 = J(e2); | |
| 7367 | - if (r2 === null) return O(n2); | |
| 7368 | - e2 = r2; | |
| 7369 | - let i2 = `<img src="${e2}" alt="${O(n2)}"`; | |
| 7370 | - return t3 && (i2 += ` title="${O(t3)}"`), i2 += ">", i2; | |
| 7371 | - } | |
| 7372 | - text(e2) { | |
| 7373 | - return "tokens" in e2 && e2.tokens ? this.parser.parseInline(e2.tokens) : "escaped" in e2 && e2.escaped ? e2.text : O(e2.text); | |
| 7374 | - } | |
| 7375 | - }; | |
| 7376 | - var L = class { | |
| 7377 | - strong({ text: e2 }) { | |
| 7378 | - return e2; | |
| 7379 | - } | |
| 7380 | - em({ text: e2 }) { | |
| 7381 | - return e2; | |
| 7382 | - } | |
| 7383 | - codespan({ text: e2 }) { | |
| 7384 | - return e2; | |
| 7385 | - } | |
| 7386 | - del({ text: e2 }) { | |
| 7387 | - return e2; | |
| 7388 | - } | |
| 7389 | - html({ text: e2 }) { | |
| 7390 | - return e2; | |
| 7391 | - } | |
| 7392 | - text({ text: e2 }) { | |
| 7393 | - return e2; | |
| 7394 | - } | |
| 7395 | - link({ text: e2 }) { | |
| 7396 | - return "" + e2; | |
| 7397 | - } | |
| 7398 | - image({ text: e2 }) { | |
| 7399 | - return "" + e2; | |
| 7400 | - } | |
| 7401 | - br() { | |
| 7402 | - return ""; | |
| 7403 | - } | |
| 7404 | - checkbox({ raw: e2 }) { | |
| 7405 | - return e2; | |
| 7406 | - } | |
| 7407 | - }; | |
| 7408 | - var b2 = class l3 { | |
| 7409 | - options; | |
| 7410 | - renderer; | |
| 7411 | - textRenderer; | |
| 7412 | - constructor(e2) { | |
| 7413 | - this.options = e2 || T, this.options.renderer = this.options.renderer || new y2(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L(); | |
| 7414 | - } | |
| 7415 | - static parse(e2, t3) { | |
| 7416 | - return new l3(t3).parse(e2); | |
| 7417 | - } | |
| 7418 | - static parseInline(e2, t3) { | |
| 7419 | - return new l3(t3).parseInline(e2); | |
| 7420 | - } | |
| 7421 | - parse(e2) { | |
| 7422 | - this.renderer.parser = this; | |
| 7423 | - let t3 = ""; | |
| 7424 | - for (let n2 = 0; n2 < e2.length; n2++) { | |
| 7425 | - let s2 = e2[n2]; | |
| 7426 | - if (this.options.extensions?.renderers?.[s2.type]) { | |
| 7427 | - let i2 = s2, o3 = this.options.extensions.renderers[i2.type].call({ parser: this }, i2); | |
| 7428 | - if (o3 !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i2.type)) { | |
| 7429 | - t3 += o3 || ""; | |
| 7430 | - continue; | |
| 7431 | - } | |
| 7432 | - } | |
| 7433 | - let r2 = s2; | |
| 7434 | - switch (r2.type) { | |
| 7435 | - case "space": { | |
| 7436 | - t3 += this.renderer.space(r2); | |
| 7437 | - break; | |
| 7438 | - } | |
| 7439 | - case "hr": { | |
| 7440 | - t3 += this.renderer.hr(r2); | |
| 7441 | - break; | |
| 7442 | - } | |
| 7443 | - case "heading": { | |
| 7444 | - t3 += this.renderer.heading(r2); | |
| 7445 | - break; | |
| 7446 | - } | |
| 7447 | - case "code": { | |
| 7448 | - t3 += this.renderer.code(r2); | |
| 7449 | - break; | |
| 7450 | - } | |
| 7451 | - case "table": { | |
| 7452 | - t3 += this.renderer.table(r2); | |
| 7453 | - break; | |
| 7454 | - } | |
| 7455 | - case "blockquote": { | |
| 7456 | - t3 += this.renderer.blockquote(r2); | |
| 7457 | - break; | |
| 7458 | - } | |
| 7459 | - case "list": { | |
| 7460 | - t3 += this.renderer.list(r2); | |
| 7461 | - break; | |
| 7462 | - } | |
| 7463 | - case "checkbox": { | |
| 7464 | - t3 += this.renderer.checkbox(r2); | |
| 7465 | - break; | |
| 7466 | - } | |
| 7467 | - case "html": { | |
| 7468 | - t3 += this.renderer.html(r2); | |
| 7469 | - break; | |
| 7470 | - } | |
| 7471 | - case "def": { | |
| 7472 | - t3 += this.renderer.def(r2); | |
| 7473 | - break; | |
| 7474 | - } | |
| 7475 | - case "paragraph": { | |
| 7476 | - t3 += this.renderer.paragraph(r2); | |
| 7477 | - break; | |
| 7478 | - } | |
| 7479 | - case "text": { | |
| 7480 | - t3 += this.renderer.text(r2); | |
| 7481 | - break; | |
| 7482 | - } | |
| 7483 | - default: { | |
| 7484 | - let i2 = 'Token with "' + r2.type + '" type was not found.'; | |
| 7485 | - if (this.options.silent) return console.error(i2), ""; | |
| 7486 | - throw new Error(i2); | |
| 7487 | - } | |
| 7488 | - } | |
| 7489 | - } | |
| 7490 | - return t3; | |
| 7491 | - } | |
| 7492 | - parseInline(e2, t3 = this.renderer) { | |
| 7493 | - this.renderer.parser = this; | |
| 7494 | - let n2 = ""; | |
| 7495 | - for (let s2 = 0; s2 < e2.length; s2++) { | |
| 7496 | - let r2 = e2[s2]; | |
| 7497 | - if (this.options.extensions?.renderers?.[r2.type]) { | |
| 7498 | - let o3 = this.options.extensions.renderers[r2.type].call({ parser: this }, r2); | |
| 7499 | - if (o3 !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r2.type)) { | |
| 7500 | - n2 += o3 || ""; | |
| 7501 | - continue; | |
| 7502 | - } | |
| 7503 | - } | |
| 7504 | - let i2 = r2; | |
| 7505 | - switch (i2.type) { | |
| 7506 | - case "escape": { | |
| 7507 | - n2 += t3.text(i2); | |
| 7508 | - break; | |
| 7509 | - } | |
| 7510 | - case "html": { | |
| 7511 | - n2 += t3.html(i2); | |
| 7512 | - break; | |
| 7513 | - } | |
| 7514 | - case "link": { | |
| 7515 | - n2 += t3.link(i2); | |
| 7516 | - break; | |
| 7517 | - } | |
| 7518 | - case "image": { | |
| 7519 | - n2 += t3.image(i2); | |
| 7520 | - break; | |
| 7521 | - } | |
| 7522 | - case "checkbox": { | |
| 7523 | - n2 += t3.checkbox(i2); | |
| 7524 | - break; | |
| 7525 | - } | |
| 7526 | - case "strong": { | |
| 7527 | - n2 += t3.strong(i2); | |
| 7528 | - break; | |
| 7529 | - } | |
| 7530 | - case "em": { | |
| 7531 | - n2 += t3.em(i2); | |
| 7532 | - break; | |
| 7533 | - } | |
| 7534 | - case "codespan": { | |
| 7535 | - n2 += t3.codespan(i2); | |
| 7536 | - break; | |
| 7537 | - } | |
| 7538 | - case "br": { | |
| 7539 | - n2 += t3.br(i2); | |
| 7540 | - break; | |
| 7541 | - } | |
| 7542 | - case "del": { | |
| 7543 | - n2 += t3.del(i2); | |
| 7544 | - break; | |
| 7545 | - } | |
| 7546 | - case "text": { | |
| 7547 | - n2 += t3.text(i2); | |
| 7548 | - break; | |
| 7549 | - } | |
| 7550 | - default: { | |
| 7551 | - let o3 = 'Token with "' + i2.type + '" type was not found.'; | |
| 7552 | - if (this.options.silent) return console.error(o3), ""; | |
| 7553 | - throw new Error(o3); | |
| 7554 | - } | |
| 7555 | - } | |
| 7556 | - } | |
| 7557 | - return n2; | |
| 7558 | - } | |
| 7559 | - }; | |
| 7560 | - var P = class { | |
| 7561 | - options; | |
| 7562 | - block; | |
| 7563 | - constructor(e2) { | |
| 7564 | - this.options = e2 || T; | |
| 7565 | - } | |
| 7566 | - static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]); | |
| 7567 | - static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]); | |
| 7568 | - preprocess(e2) { | |
| 7569 | - return e2; | |
| 7570 | - } | |
| 7571 | - postprocess(e2) { | |
| 7572 | - return e2; | |
| 7573 | - } | |
| 7574 | - processAllTokens(e2) { | |
| 7575 | - return e2; | |
| 7576 | - } | |
| 7577 | - emStrongMask(e2) { | |
| 7578 | - return e2; | |
| 7579 | - } | |
| 7580 | - provideLexer(e2 = this.block) { | |
| 7581 | - return e2 ? x2.lex : x2.lexInline; | |
| 7582 | - } | |
| 7583 | - provideParser(e2 = this.block) { | |
| 7584 | - return e2 ? b2.parse : b2.parseInline; | |
| 7585 | - } | |
| 7586 | - }; | |
| 7587 | - var D = class { | |
| 7588 | - defaults = z(); | |
| 7589 | - options = this.setOptions; | |
| 7590 | - parse = this.parseMarkdown(true); | |
| 7591 | - parseInline = this.parseMarkdown(false); | |
| 7592 | - Parser = b2; | |
| 7593 | - Renderer = y2; | |
| 7594 | - TextRenderer = L; | |
| 7595 | - Lexer = x2; | |
| 7596 | - Tokenizer = w2; | |
| 7597 | - Hooks = P; | |
| 7598 | - constructor(...e2) { | |
| 7599 | - this.use(...e2); | |
| 7600 | - } | |
| 7601 | - walkTokens(e2, t3) { | |
| 7602 | - let n2 = []; | |
| 7603 | - for (let s2 of e2) switch (n2 = n2.concat(t3.call(this, s2)), s2.type) { | |
| 7604 | - case "table": { | |
| 7605 | - let r2 = s2; | |
| 7606 | - for (let i2 of r2.header) n2 = n2.concat(this.walkTokens(i2.tokens, t3)); | |
| 7607 | - for (let i2 of r2.rows) for (let o3 of i2) n2 = n2.concat(this.walkTokens(o3.tokens, t3)); | |
| 7608 | - break; | |
| 7609 | - } | |
| 7610 | - case "list": { | |
| 7611 | - let r2 = s2; | |
| 7612 | - n2 = n2.concat(this.walkTokens(r2.items, t3)); | |
| 7613 | - break; | |
| 7614 | - } | |
| 7615 | - default: { | |
| 7616 | - let r2 = s2; | |
| 7617 | - this.defaults.extensions?.childTokens?.[r2.type] ? this.defaults.extensions.childTokens[r2.type].forEach((i2) => { | |
| 7618 | - let o3 = r2[i2].flat(1 / 0); | |
| 7619 | - n2 = n2.concat(this.walkTokens(o3, t3)); | |
| 7620 | - }) : r2.tokens && (n2 = n2.concat(this.walkTokens(r2.tokens, t3))); | |
| 7621 | - } | |
| 7622 | - } | |
| 7623 | - return n2; | |
| 7624 | - } | |
| 7625 | - use(...e2) { | |
| 7626 | - let t3 = this.defaults.extensions || { renderers: {}, childTokens: {} }; | |
| 7627 | - return e2.forEach((n2) => { | |
| 7628 | - let s2 = { ...n2 }; | |
| 7629 | - if (s2.async = this.defaults.async || s2.async || false, n2.extensions && (n2.extensions.forEach((r2) => { | |
| 7630 | - if (!r2.name) throw new Error("extension name required"); | |
| 7631 | - if ("renderer" in r2) { | |
| 7632 | - let i2 = t3.renderers[r2.name]; | |
| 7633 | - i2 ? t3.renderers[r2.name] = function(...o3) { | |
| 7634 | - let u2 = r2.renderer.apply(this, o3); | |
| 7635 | - return u2 === false && (u2 = i2.apply(this, o3)), u2; | |
| 7636 | - } : t3.renderers[r2.name] = r2.renderer; | |
| 7637 | - } | |
| 7638 | - if ("tokenizer" in r2) { | |
| 7639 | - if (!r2.level || r2.level !== "block" && r2.level !== "inline") throw new Error("extension level must be 'block' or 'inline'"); | |
| 7640 | - let i2 = t3[r2.level]; | |
| 7641 | - i2 ? i2.unshift(r2.tokenizer) : t3[r2.level] = [r2.tokenizer], r2.start && (r2.level === "block" ? t3.startBlock ? t3.startBlock.push(r2.start) : t3.startBlock = [r2.start] : r2.level === "inline" && (t3.startInline ? t3.startInline.push(r2.start) : t3.startInline = [r2.start])); | |
| 7642 | - } | |
| 7643 | - "childTokens" in r2 && r2.childTokens && (t3.childTokens[r2.name] = r2.childTokens); | |
| 7644 | - }), s2.extensions = t3), n2.renderer) { | |
| 7645 | - let r2 = this.defaults.renderer || new y2(this.defaults); | |
| 7646 | - for (let i2 in n2.renderer) { | |
| 7647 | - if (!(i2 in r2)) throw new Error(`renderer '${i2}' does not exist`); | |
| 7648 | - if (["options", "parser"].includes(i2)) continue; | |
| 7649 | - let o3 = i2, u2 = n2.renderer[o3], a2 = r2[o3]; | |
| 7650 | - r2[o3] = (...c2) => { | |
| 7651 | - let p2 = u2.apply(r2, c2); | |
| 7652 | - return p2 === false && (p2 = a2.apply(r2, c2)), p2 || ""; | |
| 7653 | - }; | |
| 7654 | - } | |
| 7655 | - s2.renderer = r2; | |
| 7656 | - } | |
| 7657 | - if (n2.tokenizer) { | |
| 7658 | - let r2 = this.defaults.tokenizer || new w2(this.defaults); | |
| 7659 | - for (let i2 in n2.tokenizer) { | |
| 7660 | - if (!(i2 in r2)) throw new Error(`tokenizer '${i2}' does not exist`); | |
| 7661 | - if (["options", "rules", "lexer"].includes(i2)) continue; | |
| 7662 | - let o3 = i2, u2 = n2.tokenizer[o3], a2 = r2[o3]; | |
| 7663 | - r2[o3] = (...c2) => { | |
| 7664 | - let p2 = u2.apply(r2, c2); | |
| 7665 | - return p2 === false && (p2 = a2.apply(r2, c2)), p2; | |
| 7666 | - }; | |
| 7667 | - } | |
| 7668 | - s2.tokenizer = r2; | |
| 7669 | - } | |
| 7670 | - if (n2.hooks) { | |
| 7671 | - let r2 = this.defaults.hooks || new P(); | |
| 7672 | - for (let i2 in n2.hooks) { | |
| 7673 | - if (!(i2 in r2)) throw new Error(`hook '${i2}' does not exist`); | |
| 7674 | - if (["options", "block"].includes(i2)) continue; | |
| 7675 | - let o3 = i2, u2 = n2.hooks[o3], a2 = r2[o3]; | |
| 7676 | - P.passThroughHooks.has(i2) ? r2[o3] = (c2) => { | |
| 7677 | - if (this.defaults.async && P.passThroughHooksRespectAsync.has(i2)) return (async () => { | |
| 7678 | - let k2 = await u2.call(r2, c2); | |
| 7679 | - return a2.call(r2, k2); | |
| 7680 | - })(); | |
| 7681 | - let p2 = u2.call(r2, c2); | |
| 7682 | - return a2.call(r2, p2); | |
| 7683 | - } : r2[o3] = (...c2) => { | |
| 7684 | - if (this.defaults.async) return (async () => { | |
| 7685 | - let k2 = await u2.apply(r2, c2); | |
| 7686 | - return k2 === false && (k2 = await a2.apply(r2, c2)), k2; | |
| 7687 | - })(); | |
| 7688 | - let p2 = u2.apply(r2, c2); | |
| 7689 | - return p2 === false && (p2 = a2.apply(r2, c2)), p2; | |
| 7690 | - }; | |
| 7691 | - } | |
| 7692 | - s2.hooks = r2; | |
| 7693 | - } | |
| 7694 | - if (n2.walkTokens) { | |
| 7695 | - let r2 = this.defaults.walkTokens, i2 = n2.walkTokens; | |
| 7696 | - s2.walkTokens = function(o3) { | |
| 7697 | - let u2 = []; | |
| 7698 | - return u2.push(i2.call(this, o3)), r2 && (u2 = u2.concat(r2.call(this, o3))), u2; | |
| 7699 | - }; | |
| 7700 | - } | |
| 7701 | - this.defaults = { ...this.defaults, ...s2 }; | |
| 7702 | - }), this; | |
| 7703 | - } | |
| 7704 | - setOptions(e2) { | |
| 7705 | - return this.defaults = { ...this.defaults, ...e2 }, this; | |
| 7706 | - } | |
| 7707 | - lexer(e2, t3) { | |
| 7708 | - return x2.lex(e2, t3 ?? this.defaults); | |
| 7709 | - } | |
| 7710 | - parser(e2, t3) { | |
| 7711 | - return b2.parse(e2, t3 ?? this.defaults); | |
| 7712 | - } | |
| 7713 | - parseMarkdown(e2) { | |
| 7714 | - return (n2, s2) => { | |
| 7715 | - let r2 = { ...s2 }, i2 = { ...this.defaults, ...r2 }, o3 = this.onError(!!i2.silent, !!i2.async); | |
| 7716 | - if (this.defaults.async === true && r2.async === false) return o3(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.")); | |
| 7717 | - if (typeof n2 > "u" || n2 === null) return o3(new Error("marked(): input parameter is undefined or null")); | |
| 7718 | - if (typeof n2 != "string") return o3(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n2) + ", string expected")); | |
| 7719 | - if (i2.hooks && (i2.hooks.options = i2, i2.hooks.block = e2), i2.async) return (async () => { | |
| 7720 | - let u2 = i2.hooks ? await i2.hooks.preprocess(n2) : n2, c2 = await (i2.hooks ? await i2.hooks.provideLexer(e2) : e2 ? x2.lex : x2.lexInline)(u2, i2), p2 = i2.hooks ? await i2.hooks.processAllTokens(c2) : c2; | |
| 7721 | - i2.walkTokens && await Promise.all(this.walkTokens(p2, i2.walkTokens)); | |
| 7722 | - let h2 = await (i2.hooks ? await i2.hooks.provideParser(e2) : e2 ? b2.parse : b2.parseInline)(p2, i2); | |
| 7723 | - return i2.hooks ? await i2.hooks.postprocess(h2) : h2; | |
| 7724 | - })().catch(o3); | |
| 7725 | - try { | |
| 7726 | - i2.hooks && (n2 = i2.hooks.preprocess(n2)); | |
| 7727 | - let a2 = (i2.hooks ? i2.hooks.provideLexer(e2) : e2 ? x2.lex : x2.lexInline)(n2, i2); | |
| 7728 | - i2.hooks && (a2 = i2.hooks.processAllTokens(a2)), i2.walkTokens && this.walkTokens(a2, i2.walkTokens); | |
| 7729 | - let p2 = (i2.hooks ? i2.hooks.provideParser(e2) : e2 ? b2.parse : b2.parseInline)(a2, i2); | |
| 7730 | - return i2.hooks && (p2 = i2.hooks.postprocess(p2)), p2; | |
| 7731 | - } catch (u2) { | |
| 7732 | - return o3(u2); | |
| 7733 | - } | |
| 7734 | - }; | |
| 7735 | - } | |
| 7736 | - onError(e2, t3) { | |
| 7737 | - return (n2) => { | |
| 7738 | - if (n2.message += ` | |
| 7739 | -Please report this to https://github.com/markedjs/marked.`, e2) { | |
| 7740 | - let s2 = "<p>An error occurred:</p><pre>" + O(n2.message + "", true) + "</pre>"; | |
| 7741 | - return t3 ? Promise.resolve(s2) : s2; | |
| 7742 | - } | |
| 7743 | - if (t3) return Promise.reject(n2); | |
| 7744 | - throw n2; | |
| 7745 | - }; | |
| 7746 | - } | |
| 7747 | - }; | |
| 7748 | - var M2 = new D(); | |
| 7749 | - function g2(l4, e2) { | |
| 7750 | - return M2.parse(l4, e2); | |
| 7751 | - } | |
| 7752 | - g2.options = g2.setOptions = function(l4) { | |
| 7753 | - return M2.setOptions(l4), g2.defaults = M2.defaults, G(g2.defaults), g2; | |
| 7754 | - }; | |
| 7755 | - g2.getDefaults = z; | |
| 7756 | - g2.defaults = T; | |
| 7757 | - g2.use = function(...l4) { | |
| 7758 | - return M2.use(...l4), g2.defaults = M2.defaults, G(g2.defaults), g2; | |
| 7759 | - }; | |
| 7760 | - g2.walkTokens = function(l4, e2) { | |
| 7761 | - return M2.walkTokens(l4, e2); | |
| 7762 | - }; | |
| 7763 | - g2.parseInline = M2.parseInline; | |
| 7764 | - g2.Parser = b2; | |
| 7765 | - g2.parser = b2.parse; | |
| 7766 | - g2.Renderer = y2; | |
| 7767 | - g2.TextRenderer = L; | |
| 7768 | - g2.Lexer = x2; | |
| 7769 | - g2.lexer = x2.lex; | |
| 7770 | - g2.Tokenizer = w2; | |
| 7771 | - g2.Hooks = P; | |
| 7772 | - g2.parse = g2; | |
| 7773 | - var jt = g2.options; | |
| 7774 | - var Ft = g2.setOptions; | |
| 7775 | - var Ut = g2.use; | |
| 7776 | - var Kt = g2.walkTokens; | |
| 7777 | - var Wt = g2.parseInline; | |
| 7778 | - var Jt = b2.parse; | |
| 7779 | - var Vt = x2.lex; | |
| 7780 | - | |
| 7781 | 9929 | // packages/blocks/build-module/api/raw-handling/markdown-converter.mjs |
| 7782 | - function escapeBodyText(value) { | |
| 7783 | - return value.replace(/&(?!#?\w+;)/g, "&").replace(/</g, "<").replace(/>/g, ">"); | |
| 7784 | - } | |
| 7785 | - var converter = new D({ | |
| 7786 | - gfm: true, | |
| 7787 | - breaks: true, | |
| 7788 | - renderer: { | |
| 7789 | - // Match showdown's `omitExtraWLInCodeBlocks`: marked appends `\n` | |
| 7790 | - // before `</code>`, which leaks into the Code block's content as a | |
| 7791 | - // trailing blank line. | |
| 7792 | - code({ text: text2, lang }) { | |
| 7793 | - const language = (lang || "").match(/^\S*/)?.[0]; | |
| 7794 | - const cls = language ? ` class="${language} language-${language}"` : ""; | |
| 7795 | - return `<pre><code${cls}>${escapeBodyText( | |
| 7796 | - text2 | |
| 7797 | - )}</code></pre>`; | |
| 7798 | - }, | |
| 7799 | - text(token) { | |
| 7800 | - if ("tokens" in token && token.tokens || "escaped" in token && token.escaped) { | |
| 7801 | - return false; | |
| 7802 | - } | |
| 7803 | - return escapeBodyText(token.text); | |
| 7804 | - } | |
| 7805 | - } | |
| 9930 | + var import_showdown = __toESM(require_showdown(), 1); | |
| 9931 | + var converter = new import_showdown.default.Converter({ | |
| 9932 | + noHeaderId: true, | |
| 9933 | + tables: true, | |
| 9934 | + literalMidWordUnderscores: true, | |
| 9935 | + omitExtraWLInCodeBlocks: true, | |
| 9936 | + simpleLineBreaks: true, | |
| 9937 | + strikethrough: true | |
| 7806 | 9938 | }); |
| 7807 | 9939 | function slackMarkdownVariantCorrector(text2) { |
| 7808 | 9940 | return text2.replace( |
| 7809 | 9941 | /((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, |
| @@ -7814,33 +9946,17 @@ | ||
| 7814 | 9946 | } |
| 7815 | 9947 | function bulletsToAsterisks(text2) { |
| 7816 | 9948 | return text2.replace(/(^|\n)•( +)/g, "$1*$2"); |
| 7817 | 9949 | } |
| 7818 | - function escapeSingleLineOrderedListMarker(text2) { | |
| 7819 | - if (text2.includes("\n")) { | |
| 7820 | - return text2; | |
| 7821 | - } | |
| 7822 | - return text2.replace(/^(\d+)\.(\s)/, "$1\\.$2"); | |
| 7823 | - } | |
| 7824 | - var correctors = [ | |
| 7825 | - escapeSingleLineOrderedListMarker, | |
| 7826 | - bulletsToAsterisks, | |
| 7827 | - slackMarkdownVariantCorrector | |
| 7828 | - ]; | |
| 7829 | 9950 | function markdownConverter(text2) { |
| 7830 | - return converter.parse( | |
| 7831 | - correctors.reduce( | |
| 7832 | - (current, corrector) => corrector(current), | |
| 7833 | - text2 | |
| 7834 | - ), | |
| 7835 | - { async: false } | |
| 9951 | + return converter.makeHtml( | |
| 9952 | + slackMarkdownVariantCorrector(bulletsToAsterisks(text2)) | |
| 7836 | 9953 | ); |
| 7837 | 9954 | } |
| 7838 | 9955 | |
| 7839 | 9956 | // packages/blocks/build-module/api/raw-handling/iframe-remover.mjs |
| 7840 | - function iframeRemover(iframe) { | |
| 7841 | - if (iframe.nodeName === "IFRAME") { | |
| 7842 | - const node = iframe; | |
| 9957 | + function iframeRemover(node) { | |
| 9958 | + if (node.nodeName === "IFRAME") { | |
| 7843 | 9959 | const text2 = node.ownerDocument.createTextNode(node.src); |
| 7844 | 9960 | node.parentNode.replaceChild(text2, node); |
| 7845 | 9961 | } |
| 7846 | 9962 | } |
| @@ -7847,16 +9963,15 @@ | ||
| 7847 | 9963 | |
| 7848 | 9964 | // packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.mjs |
| 7849 | 9965 | var import_dom10 = __toESM(require_dom(), 1); |
| 7850 | 9966 | function googleDocsUIdRemover(node) { |
| 7851 | - const el = node; | |
| 7852 | - if (!el.id || el.id.indexOf("docs-internal-guid-") !== 0) { | |
| 9967 | + if (!node.id || node.id.indexOf("docs-internal-guid-") !== 0) { | |
| 7853 | 9968 | return; |
| 7854 | 9969 | } |
| 7855 | - if (el.tagName === "B") { | |
| 9970 | + if (node.tagName === "B") { | |
| 7856 | 9971 | (0, import_dom10.unwrap)(node); |
| 7857 | 9972 | } else { |
| 7858 | - el.removeAttribute("id"); | |
| 9973 | + node.removeAttribute("id"); | |
| 7859 | 9974 | } |
| 7860 | 9975 | } |
| 7861 | 9976 | |
| 7862 | 9977 | // packages/blocks/build-module/api/raw-handling/html-formatting-remover.mjs |
| @@ -7872,10 +9987,9 @@ | ||
| 7872 | 9987 | if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === "PRE") { |
| 7873 | 9988 | return; |
| 7874 | 9989 | } |
| 7875 | 9990 | } |
| 7876 | - const textNode = node; | |
| 7877 | - let newData = textNode.data.replace(/[ \r\n\t]+/g, " "); | |
| 9991 | + let newData = node.data.replace(/[ \r\n\t]+/g, " "); | |
| 7878 | 9992 | if (newData[0] === " ") { |
| 7879 | 9993 | const previousSibling = getSibling(node, "previous"); |
| 7880 | 9994 | if (!previousSibling || previousSibling.nodeName === "BR" || previousSibling.textContent.slice(-1) === " ") { |
| 7881 | 9995 | newData = newData.slice(1); |
| @@ -7889,41 +10003,12 @@ | ||
| 7889 | 10003 | } |
| 7890 | 10004 | if (!newData) { |
| 7891 | 10005 | node.parentNode.removeChild(node); |
| 7892 | 10006 | } else { |
| 7893 | - textNode.data = newData; | |
| 10007 | + node.data = newData; | |
| 7894 | 10008 | } |
| 7895 | 10009 | } |
| 7896 | 10010 | |
| 7897 | - // packages/blocks/build-module/api/raw-handling/format-space-corrector.mjs | |
| 7898 | - var import_dom11 = __toESM(require_dom(), 1); | |
| 7899 | - function moveEdgeSpace(node, doc, isLeading) { | |
| 7900 | - const child = isLeading ? node.firstChild : node.lastChild; | |
| 7901 | - if (!child || child.nodeType !== node.TEXT_NODE) { | |
| 7902 | - return; | |
| 7903 | - } | |
| 7904 | - const text2 = child; | |
| 7905 | - const edgeIndex = isLeading ? 0 : text2.data.length - 1; | |
| 7906 | - if (text2.data[edgeIndex] !== " ") { | |
| 7907 | - return; | |
| 7908 | - } | |
| 7909 | - text2.data = isLeading ? text2.data.slice(1) : text2.data.slice(0, -1); | |
| 7910 | - if (!text2.data) { | |
| 7911 | - node.removeChild(text2); | |
| 7912 | - } | |
| 7913 | - node.parentNode.insertBefore( | |
| 7914 | - doc.createTextNode(" "), | |
| 7915 | - isLeading ? node : node.nextSibling | |
| 7916 | - ); | |
| 7917 | - } | |
| 7918 | - function formatSpaceCorrector(node, doc) { | |
| 7919 | - if (node.nodeType !== node.ELEMENT_NODE || !(0, import_dom11.isPhrasingContent)(node)) { | |
| 7920 | - return; | |
| 7921 | - } | |
| 7922 | - moveEdgeSpace(node, doc, true); | |
| 7923 | - moveEdgeSpace(node, doc, false); | |
| 7924 | - } | |
| 7925 | - | |
| 7926 | 10011 | // packages/blocks/build-module/api/raw-handling/br-remover.mjs |
| 7927 | 10012 | function brRemover(node) { |
| 7928 | 10013 | if (node.nodeName !== "BR") { |
| 7929 | 10014 | return; |
| @@ -7952,9 +10037,9 @@ | ||
| 7952 | 10037 | } |
| 7953 | 10038 | if (node.getAttribute("data-stringify-type") !== "paragraph-break") { |
| 7954 | 10039 | return; |
| 7955 | 10040 | } |
| 7956 | - const parentNode = node.parentNode; | |
| 10041 | + const { parentNode } = node; | |
| 7957 | 10042 | parentNode.insertBefore(node.ownerDocument.createElement("br"), node); |
| 7958 | 10043 | parentNode.insertBefore(node.ownerDocument.createElement("br"), node); |
| 7959 | 10044 | parentNode.removeChild(node); |
| 7960 | 10045 | } |
| @@ -7996,23 +10081,22 @@ | ||
| 7996 | 10081 | function headingTransformer(node) { |
| 7997 | 10082 | if (node.nodeType !== node.ELEMENT_NODE) { |
| 7998 | 10083 | return; |
| 7999 | 10084 | } |
| 8000 | - const element = node; | |
| 8001 | - if (element.tagName === "P" && element.getAttribute("role") === "heading" && element.hasAttribute("aria-level")) { | |
| 8002 | - const level = parseInt(element.getAttribute("aria-level"), 10); | |
| 10085 | + if (node.tagName === "P" && node.getAttribute("role") === "heading" && node.hasAttribute("aria-level")) { | |
| 10086 | + const level = parseInt(node.getAttribute("aria-level"), 10); | |
| 8003 | 10087 | if (level >= 1 && level <= 6) { |
| 8004 | 10088 | const headingTag = `H${level}`; |
| 8005 | - const newHeading = element.ownerDocument.createElement(headingTag); | |
| 8006 | - Array.from(element.attributes).forEach((attr2) => { | |
| 10089 | + const newHeading = node.ownerDocument.createElement(headingTag); | |
| 10090 | + Array.from(node.attributes).forEach((attr2) => { | |
| 8007 | 10091 | if (attr2.name !== "role" && attr2.name !== "aria-level") { |
| 8008 | 10092 | newHeading.setAttribute(attr2.name, attr2.value); |
| 8009 | 10093 | } |
| 8010 | 10094 | }); |
| 8011 | - while (element.firstChild) { | |
| 8012 | - newHeading.appendChild(element.firstChild); | |
| 10095 | + while (node.firstChild) { | |
| 10096 | + newHeading.appendChild(node.firstChild); | |
| 8013 | 10097 | } |
| 8014 | - element.parentNode.replaceChild(newHeading, element); | |
| 10098 | + node.parentNode.replaceChild(newHeading, node); | |
| 8015 | 10099 | } |
| 8016 | 10100 | } |
| 8017 | 10101 | } |
| 8018 | 10102 | |
| @@ -8025,18 +10109,12 @@ | ||
| 8025 | 10109 | msListIgnore, |
| 8026 | 10110 | phrasingContentReducer, |
| 8027 | 10111 | commentRemover |
| 8028 | 10112 | ]); |
| 8029 | - HTML = (0, import_dom12.removeInvalidHTML)( | |
| 8030 | - HTML, | |
| 8031 | - (0, import_dom12.getPhrasingContentSchema)("paste"), | |
| 8032 | - true | |
| 8033 | - ); | |
| 8034 | - HTML = deepFilterHTML(HTML, [ | |
| 8035 | - htmlFormattingRemover, | |
| 8036 | - formatSpaceCorrector, | |
| 8037 | - brRemover | |
| 8038 | - ]); | |
| 10113 | + HTML = (0, import_dom11.removeInvalidHTML)(HTML, (0, import_dom11.getPhrasingContentSchema)("paste"), { | |
| 10114 | + inline: true | |
| 10115 | + }); | |
| 10116 | + HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); | |
| 8039 | 10117 | log("Processed inline HTML:\n\n", HTML); |
| 8040 | 10118 | return HTML; |
| 8041 | 10119 | } |
| 8042 | 10120 | function pasteHandler({ |
| @@ -8065,9 +10143,11 @@ | ||
| 8065 | 10143 | return parseResult; |
| 8066 | 10144 | } |
| 8067 | 10145 | } |
| 8068 | 10146 | } |
| 8069 | - HTML = HTML.normalize(); | |
| 10147 | + if (String.prototype.normalize) { | |
| 10148 | + HTML = HTML.normalize(); | |
| 10149 | + } | |
| 8070 | 10150 | HTML = deepFilterHTML(HTML, [slackParagraphCorrector]); |
| 8071 | 10151 | const isPlainText = plainText && (!HTML || isPlain(HTML)); |
| 8072 | 10152 | if (isPlainText && isLatexMathMode(plainText)) { |
| 8073 | 10153 | return [createBlock("core/math", { latex: plainText })]; |
| @@ -8090,9 +10170,9 @@ | ||
| 8090 | 10170 | } |
| 8091 | 10171 | if (mode === "AUTO" && !hasShortcodes && isInlineContent(HTML, tagName)) { |
| 8092 | 10172 | return filterInlineHTML(HTML); |
| 8093 | 10173 | } |
| 8094 | - const phrasingContentSchema = (0, import_dom12.getPhrasingContentSchema)("paste"); | |
| 10174 | + const phrasingContentSchema = (0, import_dom11.getPhrasingContentSchema)("paste"); | |
| 8095 | 10175 | const blockContentSchema = getBlockContentSchema("paste"); |
| 8096 | 10176 | const blocks = pieces.map((piece) => { |
| 8097 | 10177 | if (typeof piece !== "string") { |
| 8098 | 10178 | return piece; |
| @@ -8117,18 +10197,13 @@ | ||
| 8117 | 10197 | // Keep top-level phrasing content, normalised by `normaliseBlocks`. |
| 8118 | 10198 | ...phrasingContentSchema |
| 8119 | 10199 | }; |
| 8120 | 10200 | piece = deepFilterHTML(piece, filters, blockContentSchema); |
| 8121 | - piece = (0, import_dom12.removeInvalidHTML)(piece, schema, false); | |
| 10201 | + piece = (0, import_dom11.removeInvalidHTML)(piece, schema); | |
| 8122 | 10202 | piece = normaliseBlocks(piece); |
| 8123 | 10203 | piece = deepFilterHTML( |
| 8124 | 10204 | piece, |
| 8125 | - [ | |
| 8126 | - htmlFormattingRemover, | |
| 8127 | - formatSpaceCorrector, | |
| 8128 | - brRemover, | |
| 8129 | - emptyParagraphRemover | |
| 8130 | - ], | |
| 10205 | + [htmlFormattingRemover, brRemover, emptyParagraphRemover], | |
| 8131 | 10206 | blockContentSchema |
| 8132 | 10207 | ); |
| 8133 | 10208 | log("Processed HTML piece:\n\n", piece); |
| 8134 | 10209 | return htmlToBlocks(piece, pasteHandler); |
| @@ -8136,12 +10211,11 @@ | ||
| 8136 | 10211 | if (mode === "AUTO" && blocks.length === 1 && hasBlockSupport(blocks[0].name, "__unstablePasteTextInline", false)) { |
| 8137 | 10212 | const trimRegex = /^[\n]+|[\n]+$/g; |
| 8138 | 10213 | const trimmedPlainText = plainText.replace(trimRegex, ""); |
| 8139 | 10214 | if (trimmedPlainText !== "" && trimmedPlainText.indexOf("\n") === -1) { |
| 8140 | - return (0, import_dom12.removeInvalidHTML)( | |
| 10215 | + return (0, import_dom11.removeInvalidHTML)( | |
| 8141 | 10216 | getBlockInnerHTML(blocks[0]), |
| 8142 | - phrasingContentSchema, | |
| 8143 | - false | |
| 10217 | + phrasingContentSchema | |
| 8144 | 10218 | ).replace(trimRegex, ""); |
| 8145 | 10219 | } |
| 8146 | 10220 | } |
| 8147 | 10221 | return blocks; |
| @@ -8148,13 +10222,13 @@ | ||
| 8148 | 10222 | } |
| 8149 | 10223 | |
| 8150 | 10224 | // packages/blocks/build-module/api/raw-handling/index.mjs |
| 8151 | 10225 | function deprecatedGetPhrasingContentSchema(context) { |
| 8152 | - (0, import_deprecated11.default)("wp.blocks.getPhrasingContentSchema", { | |
| 10226 | + (0, import_deprecated10.default)("wp.blocks.getPhrasingContentSchema", { | |
| 8153 | 10227 | since: "5.6", |
| 8154 | 10228 | alternative: "wp.dom.getPhrasingContentSchema" |
| 8155 | 10229 | }); |
| 8156 | - return (0, import_dom13.getPhrasingContentSchema)(context); | |
| 10230 | + return (0, import_dom12.getPhrasingContentSchema)(context); | |
| 8157 | 10231 | } |
| 8158 | 10232 | function rawHandler({ HTML = "" }) { |
| 8159 | 10233 | if (HTML.indexOf("<!-- wp:") !== -1) { |
| 8160 | 10234 | const parseResult = parse2(HTML); |
| @@ -8198,9 +10272,9 @@ | ||
| 8198 | 10272 | (0, import_data6.dispatch)(store).updateCategory(slug, category); |
| 8199 | 10273 | } |
| 8200 | 10274 | |
| 8201 | 10275 | // packages/blocks/build-module/api/templates.mjs |
| 8202 | - var import_element4 = __toESM(require_element(), 1); | |
| 10276 | + var import_element5 = __toESM(require_element(), 1); | |
| 8203 | 10277 | function doBlocksMatchTemplate(blocks = [], template = []) { |
| 8204 | 10278 | return blocks.length === template.length && template.every(([name, , innerBlocksTemplate], index) => { |
| 8205 | 10279 | const block = blocks[index]; |
| 8206 | 10280 | return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate); |
| @@ -8220,16 +10294,14 @@ | ||
| 8220 | 10294 | ); |
| 8221 | 10295 | } |
| 8222 | 10296 | function normalizeAttribute(definition, value) { |
| 8223 | 10297 | if (isHTMLAttribute(definition) && Array.isArray(value)) { |
| 8224 | - return (0, import_element4.renderToString)(value); | |
| 10298 | + return (0, import_element5.renderToString)(value); | |
| 8225 | 10299 | } |
| 8226 | 10300 | if (isQueryAttribute(definition) && value) { |
| 8227 | - return value.map( | |
| 8228 | - (subValues) => { | |
| 8229 | - return normalizeAttributes(definition.query, subValues); | |
| 8230 | - } | |
| 8231 | - ); | |
| 10301 | + return value.map((subValues) => { | |
| 10302 | + return normalizeAttributes(definition.query, subValues); | |
| 10303 | + }); | |
| 8232 | 10304 | } |
| 8233 | 10305 | return value; |
| 8234 | 10306 | } |
| 8235 | 10307 | function synchronizeBlocksWithTemplate(blocks = [], template) { |
| @@ -8275,11 +10347,11 @@ | ||
| 8275 | 10347 | parseRawBlock |
| 8276 | 10348 | }); |
| 8277 | 10349 | |
| 8278 | 10350 | // packages/blocks/build-module/deprecated.mjs |
| 8279 | - var import_deprecated12 = __toESM(require_deprecated(), 1); | |
| 10351 | + var import_deprecated11 = __toESM(require_deprecated(), 1); | |
| 8280 | 10352 | function withBlockContentContext(OriginalComponent) { |
| 8281 | - (0, import_deprecated12.default)("wp.blocks.withBlockContentContext", { | |
| 10353 | + (0, import_deprecated11.default)("wp.blocks.withBlockContentContext", { | |
| 8282 | 10354 | since: "6.1" |
| 8283 | 10355 | }); |
| 8284 | 10356 | return OriginalComponent; |
| 8285 | 10357 | } |
| @@ -8296,8 +10368,11 @@ | ||
| 8296 | 10368 | * |
| 8297 | 10369 | * This source code is licensed under the MIT license found in the |
| 8298 | 10370 | * LICENSE file in the root directory of this source tree. |
| 8299 | 10371 | *) |
| 10372 | + | |
| 10373 | +showdown/dist/showdown.js: | |
| 10374 | + (*! showdown v 1.9.1 - 02-11-2019 *) | |
| 8300 | 10375 | |
| 8301 | 10376 | is-plain-object/dist/is-plain-object.mjs: |
| 8302 | 10377 | (*! |
| 8303 | 10378 | * is-plain-object <https://github.com/jonschlinkert/is-plain-object> |