@uiw/react-md-editor
Version:
A markdown editor with preview, implemented with React.js and TypeScript.
1,620 lines (1,470 loc) • 2.58 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["@uiw/react-md-editor"] = factory(require("react"));
else
root["@uiw/react-md-editor"] = factory(root["React"]);
})(self, (__WEBPACK_EXTERNAL_MODULE__9787__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 5028:
/***/ (function(module) {
/**!
* @uiw/copy-to-clipboard v1.0.16
* Copy to clipboard.
*
* Copyright (c) 2023 Kenny Wang
* https://github.com/uiwjs/copy-to-clipboard.git
*
* @website: https://uiwjs.github.io/copy-to-clipboard
* Licensed under the MIT license
*/
(function (global, factory) {
true ? module.exports = factory() :
0;
})(this, (function () { 'use strict';
/**
* *** This styling is an extra step which is likely not required. ***
* https://github.com/w3c/clipboard-apis/blob/master/explainer.adoc#writing-to-the-clipboard
*
* Why is it here? To ensure:
*
* 1. the element is able to have focus and selection.
* 2. if element was to flash render it has minimal visual impact.
* 3. less flakyness with selection and copying which **might** occur if
* the textarea element is not visible.
*
* The likelihood is the element won't even render, not even a flash,
* so some of these are just precautions. However in IE the element
* is visible whilst the popup box asking the user for permission for
* the web page to copy to the clipboard.
*
* Place in top-left corner of screen regardless of scroll position.
*
* @typedef CopyTextToClipboard
* @property {(text: string, method?: (isCopy: boolean) => void) => void} void
* @returns {void}
*
* @param {string} text
* @param {CopyTextToClipboard} cb
*/
function copyTextToClipboard(text, cb) {
if (typeof document === "undefined") return;
const el = document.createElement('textarea');
el.value = text;
el.setAttribute('readonly', '');
el.style = {
position: 'absolute',
left: '-9999px',
};
document.body.appendChild(el);
const selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false;
el.select();
let isCopy = false;
try {
const successful = document.execCommand('copy');
isCopy = !!successful;
} catch (err) {
isCopy = false;
}
document.body.removeChild(el);
if (selected && document.getSelection) {
document.getSelection().removeAllRanges();
document.getSelection().addRange(selected);
}
cb && cb(isCopy);
}
return copyTextToClipboard;
}));
//# sourceMappingURL=copy-to-clipboard.umd.js.map
/***/ }),
/***/ 9377:
/***/ ((module) => {
module.exports = {
trueFunc: function trueFunc(){
return true;
},
falseFunc: function falseFunc(){
return false;
}
};
/***/ }),
/***/ 301:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({ value: true });
var parser_context_1 = __webpack_require__(8777);
var render_1 = __webpack_require__(1941);
var CssSelectorParser = /** @class */ (function () {
function CssSelectorParser() {
this.pseudos = {};
this.attrEqualityMods = {};
this.ruleNestingOperators = {};
this.substitutesEnabled = false;
}
CssSelectorParser.prototype.registerSelectorPseudos = function () {
var pseudos = [];
for (var _i = 0; _i < arguments.length; _i++) {
pseudos[_i] = arguments[_i];
}
for (var _a = 0, pseudos_1 = pseudos; _a < pseudos_1.length; _a++) {
var pseudo = pseudos_1[_a];
this.pseudos[pseudo] = 'selector';
}
return this;
};
CssSelectorParser.prototype.unregisterSelectorPseudos = function () {
var pseudos = [];
for (var _i = 0; _i < arguments.length; _i++) {
pseudos[_i] = arguments[_i];
}
for (var _a = 0, pseudos_2 = pseudos; _a < pseudos_2.length; _a++) {
var pseudo = pseudos_2[_a];
delete this.pseudos[pseudo];
}
return this;
};
CssSelectorParser.prototype.registerNumericPseudos = function () {
var pseudos = [];
for (var _i = 0; _i < arguments.length; _i++) {
pseudos[_i] = arguments[_i];
}
for (var _a = 0, pseudos_3 = pseudos; _a < pseudos_3.length; _a++) {
var pseudo = pseudos_3[_a];
this.pseudos[pseudo] = 'numeric';
}
return this;
};
CssSelectorParser.prototype.unregisterNumericPseudos = function () {
var pseudos = [];
for (var _i = 0; _i < arguments.length; _i++) {
pseudos[_i] = arguments[_i];
}
for (var _a = 0, pseudos_4 = pseudos; _a < pseudos_4.length; _a++) {
var pseudo = pseudos_4[_a];
delete this.pseudos[pseudo];
}
return this;
};
CssSelectorParser.prototype.registerNestingOperators = function () {
var operators = [];
for (var _i = 0; _i < arguments.length; _i++) {
operators[_i] = arguments[_i];
}
for (var _a = 0, operators_1 = operators; _a < operators_1.length; _a++) {
var operator = operators_1[_a];
this.ruleNestingOperators[operator] = true;
}
return this;
};
CssSelectorParser.prototype.unregisterNestingOperators = function () {
var operators = [];
for (var _i = 0; _i < arguments.length; _i++) {
operators[_i] = arguments[_i];
}
for (var _a = 0, operators_2 = operators; _a < operators_2.length; _a++) {
var operator = operators_2[_a];
delete this.ruleNestingOperators[operator];
}
return this;
};
CssSelectorParser.prototype.registerAttrEqualityMods = function () {
var mods = [];
for (var _i = 0; _i < arguments.length; _i++) {
mods[_i] = arguments[_i];
}
for (var _a = 0, mods_1 = mods; _a < mods_1.length; _a++) {
var mod = mods_1[_a];
this.attrEqualityMods[mod] = true;
}
return this;
};
CssSelectorParser.prototype.unregisterAttrEqualityMods = function () {
var mods = [];
for (var _i = 0; _i < arguments.length; _i++) {
mods[_i] = arguments[_i];
}
for (var _a = 0, mods_2 = mods; _a < mods_2.length; _a++) {
var mod = mods_2[_a];
delete this.attrEqualityMods[mod];
}
return this;
};
CssSelectorParser.prototype.enableSubstitutes = function () {
this.substitutesEnabled = true;
return this;
};
CssSelectorParser.prototype.disableSubstitutes = function () {
this.substitutesEnabled = false;
return this;
};
CssSelectorParser.prototype.parse = function (str) {
return parser_context_1.parseCssSelector(str, 0, this.pseudos, this.attrEqualityMods, this.ruleNestingOperators, this.substitutesEnabled);
};
CssSelectorParser.prototype.render = function (path) {
return render_1.renderEntity(path).trim();
};
return CssSelectorParser;
}());
exports.N = CssSelectorParser;
/***/ }),
/***/ 8777:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
var utils_1 = __webpack_require__(6517);
function parseCssSelector(str, pos, pseudos, attrEqualityMods, ruleNestingOperators, substitutesEnabled) {
var l = str.length;
var chr = '';
function getStr(quote, escapeTable) {
var result = '';
pos++;
chr = str.charAt(pos);
while (pos < l) {
if (chr === quote) {
pos++;
return result;
}
else if (chr === '\\') {
pos++;
chr = str.charAt(pos);
var esc = void 0;
if (chr === quote) {
result += quote;
}
else if ((esc = escapeTable[chr]) !== undefined) {
result += esc;
}
else if (utils_1.isHex(chr)) {
var hex = chr;
pos++;
chr = str.charAt(pos);
while (utils_1.isHex(chr)) {
hex += chr;
pos++;
chr = str.charAt(pos);
}
if (chr === ' ') {
pos++;
chr = str.charAt(pos);
}
result += String.fromCharCode(parseInt(hex, 16));
continue;
}
else {
result += chr;
}
}
else {
result += chr;
}
pos++;
chr = str.charAt(pos);
}
return result;
}
function getIdent() {
var result = '';
chr = str.charAt(pos);
while (pos < l) {
if (utils_1.isIdent(chr)) {
result += chr;
}
else if (chr === '\\') {
pos++;
if (pos >= l) {
throw Error('Expected symbol but end of file reached.');
}
chr = str.charAt(pos);
if (utils_1.identSpecialChars[chr]) {
result += chr;
}
else if (utils_1.isHex(chr)) {
var hex = chr;
pos++;
chr = str.charAt(pos);
while (utils_1.isHex(chr)) {
hex += chr;
pos++;
chr = str.charAt(pos);
}
if (chr === ' ') {
pos++;
chr = str.charAt(pos);
}
result += String.fromCharCode(parseInt(hex, 16));
continue;
}
else {
result += chr;
}
}
else {
return result;
}
pos++;
chr = str.charAt(pos);
}
return result;
}
function skipWhitespace() {
chr = str.charAt(pos);
var result = false;
while (chr === ' ' || chr === "\t" || chr === "\n" || chr === "\r" || chr === "\f") {
result = true;
pos++;
chr = str.charAt(pos);
}
return result;
}
function parse() {
var res = parseSelector();
if (pos < l) {
throw Error('Rule expected but "' + str.charAt(pos) + '" found.');
}
return res;
}
function parseSelector() {
var selector = parseSingleSelector();
if (!selector) {
return null;
}
var res = selector;
chr = str.charAt(pos);
while (chr === ',') {
pos++;
skipWhitespace();
if (res.type !== 'selectors') {
res = {
type: 'selectors',
selectors: [selector]
};
}
selector = parseSingleSelector();
if (!selector) {
throw Error('Rule expected after ",".');
}
res.selectors.push(selector);
}
return res;
}
function parseSingleSelector() {
skipWhitespace();
var selector = {
type: 'ruleSet'
};
var rule = parseRule();
if (!rule) {
return null;
}
var currentRule = selector;
while (rule) {
rule.type = 'rule';
currentRule.rule = rule;
currentRule = rule;
skipWhitespace();
chr = str.charAt(pos);
if (pos >= l || chr === ',' || chr === ')') {
break;
}
if (ruleNestingOperators[chr]) {
var op = chr;
pos++;
skipWhitespace();
rule = parseRule();
if (!rule) {
throw Error('Rule expected after "' + op + '".');
}
rule.nestingOperator = op;
}
else {
rule = parseRule();
if (rule) {
rule.nestingOperator = null;
}
}
}
return selector;
}
// @ts-ignore no-overlap
function parseRule() {
var rule = null;
while (pos < l) {
chr = str.charAt(pos);
if (chr === '*') {
pos++;
(rule = rule || {}).tagName = '*';
}
else if (utils_1.isIdentStart(chr) || chr === '\\') {
(rule = rule || {}).tagName = getIdent();
}
else if (chr === '.') {
pos++;
rule = rule || {};
(rule.classNames = rule.classNames || []).push(getIdent());
}
else if (chr === '#') {
pos++;
(rule = rule || {}).id = getIdent();
}
else if (chr === '[') {
pos++;
skipWhitespace();
var attr = {
name: getIdent()
};
skipWhitespace();
// @ts-ignore
if (chr === ']') {
pos++;
}
else {
var operator = '';
if (attrEqualityMods[chr]) {
operator = chr;
pos++;
chr = str.charAt(pos);
}
if (pos >= l) {
throw Error('Expected "=" but end of file reached.');
}
if (chr !== '=') {
throw Error('Expected "=" but "' + chr + '" found.');
}
attr.operator = operator + '=';
pos++;
skipWhitespace();
var attrValue = '';
attr.valueType = 'string';
// @ts-ignore
if (chr === '"') {
attrValue = getStr('"', utils_1.doubleQuotesEscapeChars);
// @ts-ignore
}
else if (chr === '\'') {
attrValue = getStr('\'', utils_1.singleQuoteEscapeChars);
// @ts-ignore
}
else if (substitutesEnabled && chr === '$') {
pos++;
attrValue = getIdent();
attr.valueType = 'substitute';
}
else {
while (pos < l) {
if (chr === ']') {
break;
}
attrValue += chr;
pos++;
chr = str.charAt(pos);
}
attrValue = attrValue.trim();
}
skipWhitespace();
if (pos >= l) {
throw Error('Expected "]" but end of file reached.');
}
if (chr !== ']') {
throw Error('Expected "]" but "' + chr + '" found.');
}
pos++;
attr.value = attrValue;
}
rule = rule || {};
(rule.attrs = rule.attrs || []).push(attr);
}
else if (chr === ':') {
pos++;
var pseudoName = getIdent();
var pseudo = {
name: pseudoName
};
// @ts-ignore
if (chr === '(') {
pos++;
var value = '';
skipWhitespace();
if (pseudos[pseudoName] === 'selector') {
pseudo.valueType = 'selector';
value = parseSelector();
}
else {
pseudo.valueType = pseudos[pseudoName] || 'string';
// @ts-ignore
if (chr === '"') {
value = getStr('"', utils_1.doubleQuotesEscapeChars);
// @ts-ignore
}
else if (chr === '\'') {
value = getStr('\'', utils_1.singleQuoteEscapeChars);
// @ts-ignore
}
else if (substitutesEnabled && chr === '$') {
pos++;
value = getIdent();
pseudo.valueType = 'substitute';
}
else {
while (pos < l) {
if (chr === ')') {
break;
}
value += chr;
pos++;
chr = str.charAt(pos);
}
value = value.trim();
}
skipWhitespace();
}
if (pos >= l) {
throw Error('Expected ")" but end of file reached.');
}
if (chr !== ')') {
throw Error('Expected ")" but "' + chr + '" found.');
}
pos++;
pseudo.value = value;
}
rule = rule || {};
(rule.pseudos = rule.pseudos || []).push(pseudo);
}
else {
break;
}
}
return rule;
}
return parse();
}
exports.parseCssSelector = parseCssSelector;
/***/ }),
/***/ 1941:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
var utils_1 = __webpack_require__(6517);
function renderEntity(entity) {
var res = '';
switch (entity.type) {
case 'ruleSet':
var currentEntity = entity.rule;
var parts = [];
while (currentEntity) {
if (currentEntity.nestingOperator) {
parts.push(currentEntity.nestingOperator);
}
parts.push(renderEntity(currentEntity));
currentEntity = currentEntity.rule;
}
res = parts.join(' ');
break;
case 'selectors':
res = entity.selectors.map(renderEntity).join(', ');
break;
case 'rule':
if (entity.tagName) {
if (entity.tagName === '*') {
res = '*';
}
else {
res = utils_1.escapeIdentifier(entity.tagName);
}
}
if (entity.id) {
res += "#" + utils_1.escapeIdentifier(entity.id);
}
if (entity.classNames) {
res += entity.classNames.map(function (cn) {
return "." + (utils_1.escapeIdentifier(cn));
}).join('');
}
if (entity.attrs) {
res += entity.attrs.map(function (attr) {
if ('operator' in attr) {
if (attr.valueType === 'substitute') {
return "[" + utils_1.escapeIdentifier(attr.name) + attr.operator + "$" + attr.value + "]";
}
else {
return "[" + utils_1.escapeIdentifier(attr.name) + attr.operator + utils_1.escapeStr(attr.value) + "]";
}
}
else {
return "[" + utils_1.escapeIdentifier(attr.name) + "]";
}
}).join('');
}
if (entity.pseudos) {
res += entity.pseudos.map(function (pseudo) {
if (pseudo.valueType) {
if (pseudo.valueType === 'selector') {
return ":" + utils_1.escapeIdentifier(pseudo.name) + "(" + renderEntity(pseudo.value) + ")";
}
else if (pseudo.valueType === 'substitute') {
return ":" + utils_1.escapeIdentifier(pseudo.name) + "($" + pseudo.value + ")";
}
else if (pseudo.valueType === 'numeric') {
return ":" + utils_1.escapeIdentifier(pseudo.name) + "(" + pseudo.value + ")";
}
else {
return (":" + utils_1.escapeIdentifier(pseudo.name) +
"(" + utils_1.escapeIdentifier(pseudo.value) + ")");
}
}
else {
return ":" + utils_1.escapeIdentifier(pseudo.name);
}
}).join('');
}
break;
default:
throw Error('Unknown entity type: "' + entity.type + '".');
}
return res;
}
exports.renderEntity = renderEntity;
/***/ }),
/***/ 6517:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
function isIdentStart(c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c === '-') || (c === '_');
}
exports.isIdentStart = isIdentStart;
function isIdent(c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c === '-' || c === '_';
}
exports.isIdent = isIdent;
function isHex(c) {
return (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || (c >= '0' && c <= '9');
}
exports.isHex = isHex;
function escapeIdentifier(s) {
var len = s.length;
var result = '';
var i = 0;
while (i < len) {
var chr = s.charAt(i);
if (exports.identSpecialChars[chr]) {
result += '\\' + chr;
}
else {
if (!(chr === '_' || chr === '-' ||
(chr >= 'A' && chr <= 'Z') ||
(chr >= 'a' && chr <= 'z') ||
(i !== 0 && chr >= '0' && chr <= '9'))) {
var charCode = chr.charCodeAt(0);
if ((charCode & 0xF800) === 0xD800) {
var extraCharCode = s.charCodeAt(i++);
if ((charCode & 0xFC00) !== 0xD800 || (extraCharCode & 0xFC00) !== 0xDC00) {
throw Error('UCS-2(decode): illegal sequence');
}
charCode = ((charCode & 0x3FF) << 10) + (extraCharCode & 0x3FF) + 0x10000;
}
result += '\\' + charCode.toString(16) + ' ';
}
else {
result += chr;
}
}
i++;
}
return result;
}
exports.escapeIdentifier = escapeIdentifier;
function escapeStr(s) {
var len = s.length;
var result = '';
var i = 0;
var replacement;
while (i < len) {
var chr = s.charAt(i);
if (chr === '"') {
chr = '\\"';
}
else if (chr === '\\') {
chr = '\\\\';
}
else if ((replacement = exports.strReplacementsRev[chr]) !== undefined) {
chr = replacement;
}
result += chr;
i++;
}
return "\"" + result + "\"";
}
exports.escapeStr = escapeStr;
exports.identSpecialChars = {
'!': true,
'"': true,
'#': true,
'$': true,
'%': true,
'&': true,
'\'': true,
'(': true,
')': true,
'*': true,
'+': true,
',': true,
'.': true,
'/': true,
';': true,
'<': true,
'=': true,
'>': true,
'?': true,
'@': true,
'[': true,
'\\': true,
']': true,
'^': true,
'`': true,
'{': true,
'|': true,
'}': true,
'~': true
};
exports.strReplacementsRev = {
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
'\f': '\\f',
'\v': '\\v'
};
exports.singleQuoteEscapeChars = {
n: '\n',
r: '\r',
t: '\t',
f: '\f',
'\\': '\\',
'\'': '\''
};
exports.doubleQuotesEscapeChars = {
n: '\n',
r: '\r',
t: '\t',
f: '\f',
'\\': '\\',
'"': '"'
};
/***/ }),
/***/ 229:
/***/ ((module) => {
"use strict";
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
return Array.isArray(arr);
}
return toStr.call(arr) === '[object Array]';
};
var isPlainObject = function isPlainObject(obj) {
if (!obj || toStr.call(obj) !== '[object Object]') {
return false;
}
var hasOwnConstructor = hasOwn.call(obj, 'constructor');
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
// Not own constructor property must be Object
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for (key in obj) { /**/ }
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
var setProperty = function setProperty(target, options) {
if (defineProperty && options.name === '__proto__') {
defineProperty(target, options.name, {
enumerable: true,
configurable: true,
value: options.newValue,
writable: true
});
} else {
target[options.name] = options.newValue;
}
};
// Return undefined instead of __proto__ if '__proto__' is not an own property
var getProperty = function getProperty(obj, name) {
if (name === '__proto__') {
if (!hasOwn.call(obj, name)) {
return void 0;
} else if (gOPD) {
// In early versions of node, obj['__proto__'] is buggy when obj has
// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
return gOPD(obj, name).value;
}
}
return obj[name];
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
var i = 1;
var length = arguments.length;
var deep = false;
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
target = {};
}
for (; i < length; ++i) {
options = arguments[i];
// Only deal with non-null/undefined values
if (options != null) {
// Extend the base object
for (name in options) {
src = getProperty(target, name);
copy = getProperty(options, name);
// Prevent never-ending loop
if (target !== copy) {
// Recurse if we're merging plain objects or arrays
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
setProperty(target, { name: name, newValue: copy });
}
}
}
}
}
// Return the modified object
return target;
};
/***/ }),
/***/ 8293:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
const { DOCUMENT_MODE } = __webpack_require__(3676);
//Const
const VALID_DOCTYPE_NAME = 'html';
const VALID_SYSTEM_ID = 'about:legacy-compat';
const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd';
const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [
'+//silmaril//dtd html pro v0r11 19970101//',
'-//as//dtd html 3.0 aswedit + extensions//',
'-//advasoft ltd//dtd html 3.0 aswedit + extensions//',
'-//ietf//dtd html 2.0 level 1//',
'-//ietf//dtd html 2.0 level 2//',
'-//ietf//dtd html 2.0 strict level 1//',
'-//ietf//dtd html 2.0 strict level 2//',
'-//ietf//dtd html 2.0 strict//',
'-//ietf//dtd html 2.0//',
'-//ietf//dtd html 2.1e//',
'-//ietf//dtd html 3.0//',
'-//ietf//dtd html 3.2 final//',
'-//ietf//dtd html 3.2//',
'-//ietf//dtd html 3//',
'-//ietf//dtd html level 0//',
'-//ietf//dtd html level 1//',
'-//ietf//dtd html level 2//',
'-//ietf//dtd html level 3//',
'-//ietf//dtd html strict level 0//',
'-//ietf//dtd html strict level 1//',
'-//ietf//dtd html strict level 2//',
'-//ietf//dtd html strict level 3//',
'-//ietf//dtd html strict//',
'-//ietf//dtd html//',
'-//metrius//dtd metrius presentational//',
'-//microsoft//dtd internet explorer 2.0 html strict//',
'-//microsoft//dtd internet explorer 2.0 html//',
'-//microsoft//dtd internet explorer 2.0 tables//',
'-//microsoft//dtd internet explorer 3.0 html strict//',
'-//microsoft//dtd internet explorer 3.0 html//',
'-//microsoft//dtd internet explorer 3.0 tables//',
'-//netscape comm. corp.//dtd html//',
'-//netscape comm. corp.//dtd strict html//',
"-//o'reilly and associates//dtd html 2.0//",
"-//o'reilly and associates//dtd html extended 1.0//",
"-//o'reilly and associates//dtd html extended relaxed 1.0//",
'-//sq//dtd html 2.0 hotmetal + extensions//',
'-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//',
'-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//',
'-//spyglass//dtd html 2.0 extended//',
'-//sun microsystems corp.//dtd hotjava html//',
'-//sun microsystems corp.//dtd hotjava strict html//',
'-//w3c//dtd html 3 1995-03-24//',
'-//w3c//dtd html 3.2 draft//',
'-//w3c//dtd html 3.2 final//',
'-//w3c//dtd html 3.2//',
'-//w3c//dtd html 3.2s draft//',
'-//w3c//dtd html 4.0 frameset//',
'-//w3c//dtd html 4.0 transitional//',
'-//w3c//dtd html experimental 19960712//',
'-//w3c//dtd html experimental 970421//',
'-//w3c//dtd w3 html//',
'-//w3o//dtd w3 html 3.0//',
'-//webtechs//dtd mozilla html 2.0//',
'-//webtechs//dtd mozilla html//'
];
const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([
'-//w3c//dtd html 4.01 frameset//',
'-//w3c//dtd html 4.01 transitional//'
]);
const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html'];
const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//'];
const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([
'-//w3c//dtd html 4.01 frameset//',
'-//w3c//dtd html 4.01 transitional//'
]);
//Utils
function enquoteDoctypeId(id) {
const quote = id.indexOf('"') !== -1 ? "'" : '"';
return quote + id + quote;
}
function hasPrefix(publicId, prefixes) {
for (let i = 0; i < prefixes.length; i++) {
if (publicId.indexOf(prefixes[i]) === 0) {
return true;
}
}
return false;
}
//API
exports.isConforming = function(token) {
return (
token.name === VALID_DOCTYPE_NAME &&
token.publicId === null &&
(token.systemId === null || token.systemId === VALID_SYSTEM_ID)
);
};
exports.getDocumentMode = function(token) {
if (token.name !== VALID_DOCTYPE_NAME) {
return DOCUMENT_MODE.QUIRKS;
}
const systemId = token.systemId;
if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) {
return DOCUMENT_MODE.QUIRKS;
}
let publicId = token.publicId;
if (publicId !== null) {
publicId = publicId.toLowerCase();
if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) {
return DOCUMENT_MODE.QUIRKS;
}
let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES;
if (hasPrefix(publicId, prefixes)) {
return DOCUMENT_MODE.QUIRKS;
}
prefixes =
systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES;
if (hasPrefix(publicId, prefixes)) {
return DOCUMENT_MODE.LIMITED_QUIRKS;
}
}
return DOCUMENT_MODE.NO_QUIRKS;
};
exports.serializeContent = function(name, publicId, systemId) {
let str = '!DOCTYPE ';
if (name) {
str += name;
}
if (publicId) {
str += ' PUBLIC ' + enquoteDoctypeId(publicId);
} else if (systemId) {
str += ' SYSTEM';
}
if (systemId !== null) {
str += ' ' + enquoteDoctypeId(systemId);
}
return str;
};
/***/ }),
/***/ 3941:
/***/ ((module) => {
"use strict";
module.exports = {
controlCharacterInInputStream: 'control-character-in-input-stream',
noncharacterInInputStream: 'noncharacter-in-input-stream',
surrogateInInputStream: 'surrogate-in-input-stream',
nonVoidHtmlElementStartTagWithTrailingSolidus: 'non-void-html-element-start-tag-with-trailing-solidus',
endTagWithAttributes: 'end-tag-with-attributes',
endTagWithTrailingSolidus: 'end-tag-with-trailing-solidus',
unexpectedSolidusInTag: 'unexpected-solidus-in-tag',
unexpectedNullCharacter: 'unexpected-null-character',
unexpectedQuestionMarkInsteadOfTagName: 'unexpected-question-mark-instead-of-tag-name',
invalidFirstCharacterOfTagName: 'invalid-first-character-of-tag-name',
unexpectedEqualsSignBeforeAttributeName: 'unexpected-equals-sign-before-attribute-name',
missingEndTagName: 'missing-end-tag-name',
unexpectedCharacterInAttributeName: 'unexpected-character-in-attribute-name',
unknownNamedCharacterReference: 'unknown-named-character-reference',
missingSemicolonAfterCharacterReference: 'missing-semicolon-after-character-reference',
unexpectedCharacterAfterDoctypeSystemIdentifier: 'unexpected-character-after-doctype-system-identifier',
unexpectedCharacterInUnquotedAttributeValue: 'unexpected-character-in-unquoted-attribute-value',
eofBeforeTagName: 'eof-before-tag-name',
eofInTag: 'eof-in-tag',
missingAttributeValue: 'missing-attribute-value',
missingWhitespaceBetweenAttributes: 'missing-whitespace-between-attributes',
missingWhitespaceAfterDoctypePublicKeyword: 'missing-whitespace-after-doctype-public-keyword',
missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:
'missing-whitespace-between-doctype-public-and-system-identifiers',
missingWhitespaceAfterDoctypeSystemKeyword: 'missing-whitespace-after-doctype-system-keyword',
missingQuoteBeforeDoctypePublicIdentifier: 'missing-quote-before-doctype-public-identifier',
missingQuoteBeforeDoctypeSystemIdentifier: 'missing-quote-before-doctype-system-identifier',
missingDoctypePublicIdentifier: 'missing-doctype-public-identifier',
missingDoctypeSystemIdentifier: 'missing-doctype-system-identifier',
abruptDoctypePublicIdentifier: 'abrupt-doctype-public-identifier',
abruptDoctypeSystemIdentifier: 'abrupt-doctype-system-identifier',
cdataInHtmlContent: 'cdata-in-html-content',
incorrectlyOpenedComment: 'incorrectly-opened-comment',
eofInScriptHtmlCommentLikeText: 'eof-in-script-html-comment-like-text',
eofInDoctype: 'eof-in-doctype',
nestedComment: 'nested-comment',
abruptClosingOfEmptyComment: 'abrupt-closing-of-empty-comment',
eofInComment: 'eof-in-comment',
incorrectlyClosedComment: 'incorrectly-closed-comment',
eofInCdata: 'eof-in-cdata',
absenceOfDigitsInNumericCharacterReference: 'absence-of-digits-in-numeric-character-reference',
nullCharacterReference: 'null-character-reference',
surrogateCharacterReference: 'surrogate-character-reference',
characterReferenceOutsideUnicodeRange: 'character-reference-outside-unicode-range',
controlCharacterReference: 'control-character-reference',
noncharacterCharacterReference: 'noncharacter-character-reference',
missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name',
missingDoctypeName: 'missing-doctype-name',
invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name',
duplicateAttribute: 'duplicate-attribute',
nonConformingDoctype: 'non-conforming-doctype',
missingDoctype: 'missing-doctype',
misplacedDoctype: 'misplaced-doctype',
endTagWithoutMatchingOpenElement: 'end-tag-without-matching-open-element',
closingOfElementWithOpenChildElements: 'closing-of-element-with-open-child-elements',
disallowedContentInNoscriptInHead: 'disallowed-content-in-noscript-in-head',
openElementsLeftAfterEof: 'open-elements-left-after-eof',
abandonedHeadElementChild: 'abandoned-head-element-child',
misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element',
nestedNoscriptInHead: 'nested-noscript-in-head',
eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text'
};
/***/ }),
/***/ 985:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
const Tokenizer = __webpack_require__(6504);
const HTML = __webpack_require__(3676);
//Aliases
const $ = HTML.TAG_NAMES;
const NS = HTML.NAMESPACES;
const ATTRS = HTML.ATTRS;
//MIME types
const MIME_TYPES = {
TEXT_HTML: 'text/html',
APPLICATION_XML: 'application/xhtml+xml'
};
//Attributes
const DEFINITION_URL_ATTR = 'definitionurl';
const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL';
const SVG_ATTRS_ADJUSTMENT_MAP = {
attributename: 'attributeName',
attributetype: 'attributeType',
basefrequency: 'baseFrequency',
baseprofile: 'baseProfile',
calcmode: 'calcMode',
clippathunits: 'clipPathUnits',
diffuseconstant: 'diffuseConstant',
edgemode: 'edgeMode',
filterunits: 'filterUnits',
glyphref: 'glyphRef',
gradienttransform: 'gradientTransform',
gradientunits: 'gradientUnits',
kernelmatrix: 'kernelMatrix',
kernelunitlength: 'kernelUnitLength',
keypoints: 'keyPoints',
keysplines: 'keySplines',
keytimes: 'keyTimes',
lengthadjust: 'lengthAdjust',
limitingconeangle: 'limitingConeAngle',
markerheight: 'markerHeight',
markerunits: 'markerUnits',
markerwidth: 'markerWidth',
maskcontentunits: 'maskContentUnits',
maskunits: 'maskUnits',
numoctaves: 'numOctaves',
pathlength: 'pathLength',
patterncontentunits: 'patternContentUnits',
patterntransform: 'patternTransform',
patternunits: 'patternUnits',
pointsatx: 'pointsAtX',
pointsaty: 'pointsAtY',
pointsatz: 'pointsAtZ',
preservealpha: 'preserveAlpha',
preserveaspectratio: 'preserveAspectRatio',
primitiveunits: 'primitiveUnits',
refx: 'refX',
refy: 'refY',
repeatcount: 'repeatCount',
repeatdur: 'repeatDur',
requiredextensions: 'requiredExtensions',
requiredfeatures: 'requiredFeatures',
specularconstant: 'specularConstant',
specularexponent: 'specularExponent',
spreadmethod: 'spreadMethod',
startoffset: 'startOffset',
stddeviation: 'stdDeviation',
stitchtiles: 'stitchTiles',
surfacescale: 'surfaceScale',
systemlanguage: 'systemLanguage',
tablevalues: 'tableValues',
targetx: 'targetX',
targety: 'targetY',
textlength: 'textLength',
viewbox: 'viewBox',
viewtarget: 'viewTarget',
xchannelselector: 'xChannelSelector',
ychannelselector: 'yChannelSelector',
zoomandpan: 'zoomAndPan'
};
const XML_ATTRS_ADJUSTMENT_MAP = {
'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK },
'xlink:arcrole': { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK },
'xlink:href': { prefix: 'xlink', name: 'href', namespace: NS.XLINK },
'xlink:role': { prefix: 'xlink', name: 'role', namespace: NS.XLINK },
'xlink:show': { prefix: 'xlink', name: 'show', namespace: NS.XLINK },
'xlink:title': { prefix: 'xlink', name: 'title', namespace: NS.XLINK },
'xlink:type': { prefix: 'xlink', name: 'type', namespace: NS.XLINK },
'xml:base': { prefix: 'xml', name: 'base', namespace: NS.XML },
'xml:lang': { prefix: 'xml', name: 'lang', namespace: NS.XML },
'xml:space': { prefix: 'xml', name: 'space', namespace: NS.XML },
xmlns: { prefix: '', name: 'xmlns', namespace: NS.XMLNS },
'xmlns:xlink': { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS }
};
//SVG tag names adjustment map
const SVG_TAG_NAMES_ADJUSTMENT_MAP = (exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = {
altglyph: 'altGlyph',
altglyphdef: 'altGlyphDef',
altglyphitem: 'altGlyphItem',
animatecolor: 'animateColor',
animatemotion: 'animateMotion',
animatetransform: 'animateTransform',
clippath: 'clipPath',
feblend: 'feBlend',
fecolormatrix: 'feColorMatrix',
fecomponenttransfer: 'feComponentTransfer',
fecomposite: 'feComposite',
feconvolvematrix: 'feConvolveMatrix',
fediffuselighting: 'feDiffuseLighting',
fedisplacementmap: 'feDisplacementMap',
fedistantlight: 'feDistantLight',
feflood: 'feFlood',
fefunca: 'feFuncA',
fefuncb: 'feFuncB',
fefuncg: 'feFuncG',
fefuncr: 'feFuncR',
fegaussianblur: 'feGaussianBlur',
feimage: 'feImage',
femerge: 'feMerge',
femergenode: 'feMergeNode',
femorphology: 'feMorphology',
feoffset: 'feOffset',
fepointlight: 'fePointLight',
fespecularlighting: 'feSpecularLighting',
fespotlight: 'feSpotLight',
fetile: 'feTile',
feturbulence: 'feTurbulence',
foreignobject: 'foreignObject',
glyphref: 'glyphRef',
lineargradient: 'linearGradient',
radialgradient: 'radialGradient',
textpath: 'textPath'
});
//Tags that causes exit from foreign content
const EXITS_FOREIGN_CONTENT = {
[$.B]: true,
[$.BIG]: true,
[$.BLOCKQUOTE]: true,
[$.BODY]: true,
[$.BR]: true,
[$.CENTER]: true,
[$.CODE]: true,
[$.DD]: true,
[$.DIV]: true,
[$.DL]: true,
[$.DT]: true,
[$.EM]: true,
[$.EMBED]: true,
[$.H1]: true,
[$.H2]: true,
[$.H3]: true,
[$.H4]: true,
[$.H5]: true,
[$.H6]: true,
[$.HEAD]: true,
[$.HR]: true,
[$.I]: true,
[$.IMG]: true,
[$.LI]: true,
[$.LISTING]: true,
[$.MENU]: true,
[$.META]: true,
[$.NOBR]: true,
[$.OL]: true,
[$.P]: true,
[$.PRE]: true,
[$.RUBY]: true,
[$.S]: true,
[$.SMALL]: true,
[$.SPAN]: true,
[$.STRONG]: true,
[$.STRIKE]: true,
[$.SUB]: true,
[$.SUP]: true,
[$.TABLE]: true,
[$.TT]: true,
[$.U]: true,
[$.UL]: true,
[$.VAR]: true
};
//Check exit from foreign content
exports.causesExit = function(startTagToken) {
const tn = startTagToken.tagName;
const isFontWithAttrs =
tn === $.FONT &&
(Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null ||
Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null ||
Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null);
return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn];
};
//Token adjustments
exports.adjustTokenMathMLAttrs = function(token) {
for (let i = 0; i < token.attrs.length; i++) {
if (token.attrs[i].name === DEFINITION_URL_ATTR) {
token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR;
break;
}
}
};
exports.adjustTokenSVGAttrs = function(token) {
for (let i = 0; i < token.attrs.length; i++) {
const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name];
if (adjustedAttrName) {
token.attrs[i].name = adjustedAttrName;
}
}
};
exports.adjustTokenXMLAttrs = function(token) {
for (let i = 0; i < token.attrs.length; i++) {
const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name];
if (adjustedAttrEntry) {
token.attrs[i].prefix = adjustedAttrEntry.prefix;
token.attrs[i].name = adjustedAttrEntry.name;
token.attrs[i].namespace = adjustedAttrEntry.namespace;
}
}
};
exports.adjustTokenSVGTagName = function(token) {
const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName];
if (adjustedTagName) {
token.tagName = adjustedTagName;
}
};
//Integration points
function isMathMLTextIntegrationPoint(tn, ns) {
return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT);
}
function isHtmlIntegrationPoint(tn, ns, attrs) {
if (ns === NS.MATHML && tn === $.ANNOTATION_XML) {
for (let i = 0; i < attrs.length; i++) {
if (attrs[i].name === ATTRS.ENCODING) {
const value = attrs[i].value.toLowerCase();
return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML;
}
}
}
return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE);
}
exports.isIntegrationPoint = function(tn, ns, attrs, foreignNS) {
if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) {
return true;
}
if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) {
return true;
}
return false;
};
/***/ }),
/***/ 3676:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
const NS = (exports.NAMESPACES = {
HTML: 'http://www.w3.org/1999/xhtml',
MATHML: 'http://www.w3.org/1998/Math/MathML',
SVG: 'http://www.w3.org/2000/svg',
XLINK: 'http://www.w3.org/1999/xlink',
XML: 'http://www.w3.org/XML/1998/namespace',
XMLNS: 'http://www.w3.org/2000/xmlns/'
});
exports.ATTRS = {
TYPE: 'type',
ACTION: 'action',
ENCODING: 'encoding',
PROMPT: 'prompt',
NAME: 'name',
COLOR: 'color',
FACE: 'face',
SIZE: 'size'
};
exports.DOCUMENT_MODE = {
NO_QUIRKS: 'no-quirks',
QUIRKS: 'quirks',
LIMITED_QUIRKS: 'limited-quirks'
};
const $ = (exports.TAG_NAMES = {
A: 'a',
ADDRESS: 'address',
ANNOTATION_XML: 'annotation-xml',
APPLET: 'applet',
AREA: 'area',
ARTICLE: 'article',
ASIDE: 'aside',
B: 'b',
BASE: 'base',
BASEFONT: 'basefont',
BGSOUND: 'bgsound',
BIG: 'big',
BLOCKQUOTE: 'blockquote',
BODY: 'body',
BR: 'br',
BUTTON: 'button',
CAPTION: 'caption',
CENTER: 'center',
CODE: 'code',
COL: 'col',
COLGROUP: 'colgroup',
DD: 'dd',
DESC: 'desc',
DETAILS: 'details',
DIALOG: 'dialog',
DIR: 'dir',
DIV: 'div',
DL: 'dl',
DT: 'dt',
EM: 'em',
EMBED: 'embed',
FIELDSET: 'fieldset',
FIGCAPTION: 'figcaption',
FIGURE: 'figure',
FONT: 'font',
FOOTER: 'footer',
FOREIGN_OBJECT: 'foreignObject',
FORM: 'form',
FRAME: 'frame',
FRAMESET: 'frameset',
H1: 'h1',
H2: 'h2',
H3: 'h3',
H4: 'h4',
H5: 'h5',
H6: 'h6',
HEAD: 'head',
HEADER: 'header',
HGROUP: 'hgroup',
HR: 'hr',
HTML: 'html',
I: 'i',
IMG: 'img',
IMAGE: 'image',
INPUT: 'input',
IFRAME: 'iframe',
KEYGEN: 'keygen',
LABEL: 'label',
LI: 'li',
LINK: 'link',
LISTING: 'listing',
MAIN: 'main',
MALIGNMARK: 'malignmark',
MARQUEE: 'marquee',
MATH: 'math',
MENU: 'menu',
META: 'meta',
MGLYPH: 'mglyph',
MI: 'mi',
MO: 'mo',
MN: 'mn',
MS: 'ms',
MTEXT: 'mtext',
NAV: 'nav',
NOBR: 'nobr',
NOFRAMES: 'noframes',
NOEMBED: 'noembed',
NOSCRIPT: 'noscript',
OBJECT: 'object',
OL: 'ol',
OPTGROUP: 'optgroup',
OPTION: 'option',
P: 'p',
PARAM: 'param',
PLAINTEXT: 'plaintext',
PRE: 'pre',
RB: 'rb',
RP: 'rp',
RT: 'rt',
RTC: 'rtc',
RUBY: 'ruby',
S: 's',
SCRIPT: 'script',
SECTION: 'section',
SELECT: 'select',
SOURCE: 'source',
SMALL: 'small',
SPAN: 'span',
STRIKE: 'strike',
STRONG: 'strong',
STYLE: 'style',
SUB: 'sub',
SUMMARY: 'summary',
SUP: 'sup',
TABLE: 'table',
TBODY: 'tbody',
TEMPLATE: 'template',
TEXTAREA: 'textarea',
TFOOT: 'tfoot',
TD: 'td',
TH: 'th',
THEAD: 'thead',
TITLE: 'title',
TR: 'tr',
TRACK: 'track',
TT: 'tt',
U: 'u',
UL: 'ul',
SVG: 'svg',
VAR: 'var',
WBR: 'wbr',
XMP: 'xmp'
});
exports.SPECIAL_ELEMENTS = {
[NS.HTML]: {
[$.ADDRESS]: true,
[$.APPLET]: true,
[$.AREA]: true,
[$.ARTICLE]: true,
[$.ASIDE]: true,
[$.BASE]: true,
[$.BASEFONT]: true,
[$.BGSOUND]: true,