lunaticbum a810db5d25 ...
2024-10-10 17:37:22 +09:00

24033 lines
1.1 MiB

/*!
* @toast-ui/editor
* @version 3.2.2 | Fri Feb 17 2023
* @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
* @license MIT
*/
! function(e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.toastui = t() : (e.toastui = e.toastui || {}, e.toastui.Editor = t())
}(self, (function() {
return function() {
var e = {
368: function(e) {
/*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */
e.exports = function() {
"use strict";
function e(e) {
if (Array.isArray(e)) {
for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t];
return n
}
return Array.from(e)
}
var t = Object.hasOwnProperty,
n = Object.setPrototypeOf,
r = Object.isFrozen,
o = Object.getPrototypeOf,
i = Object.getOwnPropertyDescriptor,
s = Object.freeze,
a = Object.seal,
l = Object.create,
c = "undefined" != typeof Reflect && Reflect,
u = c.apply,
d = c.construct;
u || (u = function(e, t, n) {
return e.apply(t, n)
}), s || (s = function(e) {
return e
}), a || (a = function(e) {
return e
}), d || (d = function(t, n) {
return new(Function.prototype.bind.apply(t, [null].concat(e(n))))
});
var p = x(Array.prototype.forEach),
h = x(Array.prototype.pop),
f = x(Array.prototype.push),
m = x(String.prototype.toLowerCase),
g = x(String.prototype.match),
v = x(String.prototype.replace),
y = x(String.prototype.indexOf),
b = x(String.prototype.trim),
w = x(RegExp.prototype.test),
k = C(TypeError);
function x(e) {
return function(t) {
for (var n = arguments.length, r = Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++) r[o - 1] = arguments[o];
return u(e, t, r)
}
}
function C(e) {
return function() {
for (var t = arguments.length, n = Array(t), r = 0; r < t; r++) n[r] = arguments[r];
return d(e, n)
}
}
function T(e, t) {
n && n(e, null);
for (var o = t.length; o--;) {
var i = t[o];
if ("string" == typeof i) {
var s = m(i);
s !== i && (r(t) || (t[o] = s), i = s)
}
e[i] = !0
}
return e
}
function M(e) {
var n = l(null),
r = void 0;
for (r in e) u(t, e, [r]) && (n[r] = e[r]);
return n
}
function S(e, t) {
for (; null !== e;) {
var n = i(e, t);
if (n) {
if (n.get) return x(n.get);
if ("function" == typeof n.value) return x(n.value)
}
e = o(e)
}
function r(e) {
return console.warn("fallback value for", e), null
}
return r
}
var E = s(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]),
N = s(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]),
O = s(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]),
D = s(["animate", "color-profile", "cursor", "discard", "fedropshadow", "feimage", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]),
A = s(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]),
L = s(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]),
I = s(["#text"]),
R = s(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]),
P = s(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]),
B = s(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]),
F = s(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]),
H = a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),
z = a(/<%[\s\S]*|[\s\S]*%>/gm),
q = a(/^data-[\-\w.\u00B7-\uFFFF]/),
V = a(/^aria-[\-\w]+$/),
j = a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),
$ = a(/^(?:\w+script|data):/i),
_ = a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),
U = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
return typeof e
} : function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
};
function W(e) {
if (Array.isArray(e)) {
for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t];
return n
}
return Array.from(e)
}
var J = function() {
return "undefined" == typeof window ? null : window
},
G = function(e, t) {
if ("object" !== (void 0 === e ? "undefined" : U(e)) || "function" != typeof e.createPolicy) return null;
var n = null,
r = "data-tt-policy-suffix";
t.currentScript && t.currentScript.hasAttribute(r) && (n = t.currentScript.getAttribute(r));
var o = "dompurify" + (n ? "#" + n : "");
try {
return e.createPolicy(o, {
createHTML: function(e) {
return e
}
})
} catch (e) {
return console.warn("TrustedTypes policy " + o + " could not be created."), null
}
};
function K() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : J(),
t = function(e) {
return K(e)
};
if (t.version = "2.3.3", t.removed = [], !e || !e.document || 9 !== e.document.nodeType) return t.isSupported = !1, t;
var n = e.document,
r = e.document,
o = e.DocumentFragment,
i = e.HTMLTemplateElement,
a = e.Node,
l = e.Element,
c = e.NodeFilter,
u = e.NamedNodeMap,
d = void 0 === u ? e.NamedNodeMap || e.MozNamedAttrMap : u,
x = e.Text,
C = e.Comment,
Z = e.DOMParser,
X = e.trustedTypes,
Q = l.prototype,
Y = S(Q, "cloneNode"),
ee = S(Q, "nextSibling"),
te = S(Q, "childNodes"),
ne = S(Q, "parentNode");
if ("function" == typeof i) {
var re = r.createElement("template");
re.content && re.content.ownerDocument && (r = re.content.ownerDocument)
}
var oe = G(X, n),
ie = oe && Fe ? oe.createHTML("") : "",
se = r,
ae = se.implementation,
le = se.createNodeIterator,
ce = se.createDocumentFragment,
ue = se.getElementsByTagName,
de = n.importNode,
pe = {};
try {
pe = M(r).documentMode ? r.documentMode : {}
} catch (e) {}
var he = {};
t.isSupported = "function" == typeof ne && ae && void 0 !== ae.createHTMLDocument && 9 !== pe;
var fe = H,
me = z,
ge = q,
ve = V,
ye = $,
be = _,
we = j,
ke = null,
xe = T({}, [].concat(W(E), W(N), W(O), W(A), W(I))),
Ce = null,
Te = T({}, [].concat(W(R), W(P), W(B), W(F))),
Me = null,
Se = null,
Ee = !0,
Ne = !0,
Oe = !1,
De = !1,
Ae = !1,
Le = !1,
Ie = !1,
Re = !1,
Pe = !1,
Be = !0,
Fe = !1,
He = !0,
ze = !0,
qe = !1,
Ve = {},
je = null,
$e = T({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]),
_e = null,
Ue = T({}, ["audio", "video", "img", "source", "image", "track"]),
We = null,
Je = T({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
Ge = "http://www.w3.org/1998/Math/MathML",
Ke = "http://www.w3.org/2000/svg",
Ze = "http://www.w3.org/1999/xhtml",
Xe = Ze,
Qe = !1,
Ye = void 0,
et = ["application/xhtml+xml", "text/html"],
tt = "text/html",
nt = void 0,
rt = null,
ot = r.createElement("form"),
it = function(e) {
rt && rt === e || (e && "object" === (void 0 === e ? "undefined" : U(e)) || (e = {}), e = M(e), ke = "ALLOWED_TAGS" in e ? T({}, e.ALLOWED_TAGS) : xe, Ce = "ALLOWED_ATTR" in e ? T({}, e.ALLOWED_ATTR) : Te, We = "ADD_URI_SAFE_ATTR" in e ? T(M(Je), e.ADD_URI_SAFE_ATTR) : Je, _e = "ADD_DATA_URI_TAGS" in e ? T(M(Ue), e.ADD_DATA_URI_TAGS) : Ue, je = "FORBID_CONTENTS" in e ? T({}, e.FORBID_CONTENTS) : $e, Me = "FORBID_TAGS" in e ? T({}, e.FORBID_TAGS) : {}, Se = "FORBID_ATTR" in e ? T({}, e.FORBID_ATTR) : {}, Ve = "USE_PROFILES" in e && e.USE_PROFILES, Ee = !1 !== e.ALLOW_ARIA_ATTR, Ne = !1 !== e.ALLOW_DATA_ATTR, Oe = e.ALLOW_UNKNOWN_PROTOCOLS || !1, De = e.SAFE_FOR_TEMPLATES || !1, Ae = e.WHOLE_DOCUMENT || !1, Re = e.RETURN_DOM || !1, Pe = e.RETURN_DOM_FRAGMENT || !1, Be = !1 !== e.RETURN_DOM_IMPORT, Fe = e.RETURN_TRUSTED_TYPE || !1, Ie = e.FORCE_BODY || !1, He = !1 !== e.SANITIZE_DOM, ze = !1 !== e.KEEP_CONTENT, qe = e.IN_PLACE || !1, we = e.ALLOWED_URI_REGEXP || we, Xe = e.NAMESPACE || Ze, Ye = Ye = -1 === et.indexOf(e.PARSER_MEDIA_TYPE) ? tt : e.PARSER_MEDIA_TYPE, nt = "application/xhtml+xml" === Ye ? function(e) {
return e
} : m, De && (Ne = !1), Pe && (Re = !0), Ve && (ke = T({}, [].concat(W(I))), Ce = [], !0 === Ve.html && (T(ke, E), T(Ce, R)), !0 === Ve.svg && (T(ke, N), T(Ce, P), T(Ce, F)), !0 === Ve.svgFilters && (T(ke, O), T(Ce, P), T(Ce, F)), !0 === Ve.mathMl && (T(ke, A), T(Ce, B), T(Ce, F))), e.ADD_TAGS && (ke === xe && (ke = M(ke)), T(ke, e.ADD_TAGS)), e.ADD_ATTR && (Ce === Te && (Ce = M(Ce)), T(Ce, e.ADD_ATTR)), e.ADD_URI_SAFE_ATTR && T(We, e.ADD_URI_SAFE_ATTR), e.FORBID_CONTENTS && (je === $e && (je = M(je)), T(je, e.FORBID_CONTENTS)), ze && (ke["#text"] = !0), Ae && T(ke, ["html", "head", "body"]), ke.table && (T(ke, ["tbody"]), delete Me.tbody), s && s(e), rt = e)
},
st = T({}, ["mi", "mo", "mn", "ms", "mtext"]),
at = T({}, ["foreignobject", "desc", "title", "annotation-xml"]),
lt = T({}, N);
T(lt, O), T(lt, D);
var ct = T({}, A);
T(ct, L);
var ut = function(e) {
var t = ne(e);
t && t.tagName || (t = {
namespaceURI: Ze,
tagName: "template"
});
var n = m(e.tagName),
r = m(t.tagName);
if (e.namespaceURI === Ke) return t.namespaceURI === Ze ? "svg" === n : t.namespaceURI === Ge ? "svg" === n && ("annotation-xml" === r || st[r]) : Boolean(lt[n]);
if (e.namespaceURI === Ge) return t.namespaceURI === Ze ? "math" === n : t.namespaceURI === Ke ? "math" === n && at[r] : Boolean(ct[n]);
if (e.namespaceURI === Ze) {
if (t.namespaceURI === Ke && !at[r]) return !1;
if (t.namespaceURI === Ge && !st[r]) return !1;
var o = T({}, ["title", "style", "font", "a", "script"]);
return !ct[n] && (o[n] || !lt[n])
}
return !1
},
dt = function(e) {
f(t.removed, {
element: e
});
try {
e.parentNode.removeChild(e)
} catch (t) {
try {
e.outerHTML = ie
} catch (t) {
e.remove()
}
}
},
pt = function(e, n) {
try {
f(t.removed, {
attribute: n.getAttributeNode(e),
from: n
})
} catch (e) {
f(t.removed, {
attribute: null,
from: n
})
}
if (n.removeAttribute(e), "is" === e && !Ce[e])
if (Re || Pe) try {
dt(n)
} catch (e) {} else try {
n.setAttribute(e, "")
} catch (e) {}
},
ht = function(e) {
var t = void 0,
n = void 0;
if (Ie) e = "<remove></remove>" + e;
else {
var o = g(e, /^[\r\n\t ]+/);
n = o && o[0]
}
"application/xhtml+xml" === Ye && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
var i = oe ? oe.createHTML(e) : e;
if (Xe === Ze) try {
t = (new Z).parseFromString(i, Ye)
} catch (e) {}
if (!t || !t.documentElement) {
t = ae.createDocument(Xe, "template", null);
try {
t.documentElement.innerHTML = Qe ? "" : i
} catch (e) {}
}
var s = t.body || t.documentElement;
return e && n && s.insertBefore(r.createTextNode(n), s.childNodes[0] || null), Xe === Ze ? ue.call(t, Ae ? "html" : "body")[0] : Ae ? t.documentElement : s
},
ft = function(e) {
return le.call(e.ownerDocument || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT, null, !1)
},
mt = function(e) {
return !(e instanceof x || e instanceof C || "string" == typeof e.nodeName && "string" == typeof e.textContent && "function" == typeof e.removeChild && e.attributes instanceof d && "function" == typeof e.removeAttribute && "function" == typeof e.setAttribute && "string" == typeof e.namespaceURI && "function" == typeof e.insertBefore)
},
gt = function(e) {
return "object" === (void 0 === a ? "undefined" : U(a)) ? e instanceof a : e && "object" === (void 0 === e ? "undefined" : U(e)) && "number" == typeof e.nodeType && "string" == typeof e.nodeName
},
vt = function(e, n, r) {
he[e] && p(he[e], (function(e) {
e.call(t, n, r, rt)
}))
},
yt = function(e) {
var n = void 0;
if (vt("beforeSanitizeElements", e, null), mt(e)) return dt(e), !0;
if (g(e.nodeName, /[\u0080-\uFFFF]/)) return dt(e), !0;
var r = nt(e.nodeName);
if (vt("uponSanitizeElement", e, {
tagName: r,
allowedTags: ke
}), !gt(e.firstElementChild) && (!gt(e.content) || !gt(e.content.firstElementChild)) && w(/<[/\w]/g, e.innerHTML) && w(/<[/\w]/g, e.textContent)) return dt(e), !0;
if ("select" === r && w(/<template/i, e.innerHTML)) return dt(e), !0;
if (!ke[r] || Me[r]) {
if (ze && !je[r]) {
var o = ne(e) || e.parentNode,
i = te(e) || e.childNodes;
if (i && o)
for (var s = i.length - 1; s >= 0; --s) o.insertBefore(Y(i[s], !0), ee(e))
}
return dt(e), !0
}
return e instanceof l && !ut(e) ? (dt(e), !0) : "noscript" !== r && "noembed" !== r || !w(/<\/no(script|embed)/i, e.innerHTML) ? (De && 3 === e.nodeType && (n = e.textContent, n = v(n, fe, " "), n = v(n, me, " "), e.textContent !== n && (f(t.removed, {
element: e.cloneNode()
}), e.textContent = n)), vt("afterSanitizeElements", e, null), !1) : (dt(e), !0)
},
bt = function(e, t, n) {
if (He && ("id" === t || "name" === t) && (n in r || n in ot)) return !1;
if (Ne && !Se[t] && w(ge, t));
else if (Ee && w(ve, t));
else {
if (!Ce[t] || Se[t]) return !1;
if (We[t]);
else if (w(we, v(n, be, "")));
else if ("src" !== t && "xlink:href" !== t && "href" !== t || "script" === e || 0 !== y(n, "data:") || !_e[e])
if (Oe && !w(ye, v(n, be, "")));
else if (n) return !1
}
return !0
},
wt = function(e) {
var n = void 0,
r = void 0,
o = void 0,
i = void 0;
vt("beforeSanitizeAttributes", e, null);
var s = e.attributes;
if (s) {
var a = {
attrName: "",
attrValue: "",
keepAttr: !0,
allowedAttributes: Ce
};
for (i = s.length; i--;) {
var l = n = s[i],
c = l.name,
u = l.namespaceURI;
if (r = b(n.value), o = nt(c), a.attrName = o, a.attrValue = r, a.keepAttr = !0, a.forceKeepAttr = void 0, vt("uponSanitizeAttribute", e, a), r = a.attrValue, !a.forceKeepAttr && (pt(c, e), a.keepAttr))
if (w(/\/>/i, r)) pt(c, e);
else {
De && (r = v(r, fe, " "), r = v(r, me, " "));
var d = nt(e.nodeName);
if (bt(d, o, r)) try {
u ? e.setAttributeNS(u, c, r) : e.setAttribute(c, r), h(t.removed)
} catch (e) {}
}
}
vt("afterSanitizeAttributes", e, null)
}
},
kt = function e(t) {
var n = void 0,
r = ft(t);
for (vt("beforeSanitizeShadowDOM", t, null); n = r.nextNode();) vt("uponSanitizeShadowNode", n, null), yt(n) || (n.content instanceof o && e(n.content), wt(n));
vt("afterSanitizeShadowDOM", t, null)
};
return t.sanitize = function(r, i) {
var s = void 0,
l = void 0,
c = void 0,
u = void 0,
d = void 0;
if ((Qe = !r) && (r = "\x3c!--\x3e"), "string" != typeof r && !gt(r)) {
if ("function" != typeof r.toString) throw k("toString is not a function");
if ("string" != typeof(r = r.toString())) throw k("dirty is not a string, aborting")
}
if (!t.isSupported) {
if ("object" === U(e.toStaticHTML) || "function" == typeof e.toStaticHTML) {
if ("string" == typeof r) return e.toStaticHTML(r);
if (gt(r)) return e.toStaticHTML(r.outerHTML)
}
return r
}
if (Le || it(i), t.removed = [], "string" == typeof r && (qe = !1), qe);
else if (r instanceof a) 1 === (l = (s = ht("\x3c!----\x3e")).ownerDocument.importNode(r, !0)).nodeType && "BODY" === l.nodeName || "HTML" === l.nodeName ? s = l : s.appendChild(l);
else {
if (!Re && !De && !Ae && -1 === r.indexOf("<")) return oe && Fe ? oe.createHTML(r) : r;
if (!(s = ht(r))) return Re ? null : ie
}
s && Ie && dt(s.firstChild);
for (var p = ft(qe ? r : s); c = p.nextNode();) 3 === c.nodeType && c === u || yt(c) || (c.content instanceof o && kt(c.content), wt(c), u = c);
if (u = null, qe) return r;
if (Re) {
if (Pe)
for (d = ce.call(s.ownerDocument); s.firstChild;) d.appendChild(s.firstChild);
else d = s;
return Be && (d = de.call(n, d, !0)), d
}
var h = Ae ? s.outerHTML : s.innerHTML;
return De && (h = v(h, fe, " "), h = v(h, me, " ")), oe && Fe ? oe.createHTML(h) : h
}, t.setConfig = function(e) {
it(e), Le = !0
}, t.clearConfig = function() {
rt = null, Le = !1
}, t.isValidAttribute = function(e, t, n) {
rt || it({});
var r = nt(e),
o = nt(t);
return bt(r, o, n)
}, t.addHook = function(e, t) {
"function" == typeof t && (he[e] = he[e] || [], f(he[e], t))
}, t.removeHook = function(e) {
he[e] && h(he[e])
}, t.removeHooks = function(e) {
he[e] && (he[e] = [])
}, t.removeAllHooks = function() {
he = {}
}, t
}
return K()
}()
},
928: function(e, t, n) {
"use strict";
var r = n(322);
e.exports = function(e, t, n) {
var o, i;
if (n = n || 0, !r(t)) return -1;
if (Array.prototype.indexOf) return Array.prototype.indexOf.call(t, e, n);
for (i = t.length, o = n; n >= 0 && o < i; o += 1)
if (t[o] === e) return o;
return -1
}
},
690: function(e, t, n) {
"use strict";
var r = n(322),
o = n(893),
i = n(956);
e.exports = function(e, t, n) {
r(e) ? o(e, t, n) : i(e, t, n)
}
},
893: function(e) {
"use strict";
e.exports = function(e, t, n) {
var r = 0,
o = e.length;
for (n = n || null; r < o && !1 !== t.call(n, e[r], r, e); r += 1);
}
},
956: function(e) {
"use strict";
e.exports = function(e, t, n) {
var r;
for (r in n = n || null, e)
if (e.hasOwnProperty(r) && !1 === t.call(n, e[r], r, e)) break
}
},
354: function(e, t, n) {
"use strict";
var r = n(893);
e.exports = function(e) {
var t;
try {
t = Array.prototype.slice.call(e)
} catch (n) {
t = [], r(e, (function(e) {
t.push(e)
}))
}
return t
}
},
755: function(e) {
"use strict";
var t = "_feEventKey";
e.exports = function(e, n) {
var r, o = e[t];
return o || (o = e[t] = {}), (r = o[n]) || (r = o[n] = []), r
}
},
349: function(e, t, n) {
"use strict";
var r = n(758),
o = n(690),
i = n(755);
function s(e, t, n) {
var r, s = i(e, t);
n ? (o(s, (function(o, i) {
return n !== o.handler || (a(e, t, o.wrappedHandler), r = i, !1)
})), s.splice(r, 1)) : (o(s, (function(n) {
a(e, t, n.wrappedHandler)
})), s.splice(0, s.length))
}
function a(e, t, n) {
"removeEventListener" in e ? e.removeEventListener(t, n) : "detachEvent" in e && e.detachEvent("on" + t, n)
}
e.exports = function(e, t, n) {
r(t) ? o(t.split(/\s+/g), (function(t) {
s(e, t, n)
})) : o(t, (function(t, n) {
s(e, n, t)
}))
}
},
348: function(e, t, n) {
"use strict";
var r = n(758),
o = n(690),
i = n(755);
function s(e, t, n, r) {
function s(t) {
n.call(r || e, t || window.event)
}
"addEventListener" in e ? e.addEventListener(t, s) : "attachEvent" in e && e.attachEvent("on" + t, s),
function(e, t, n, r) {
var s = i(e, t),
a = !1;
o(s, (function(e) {
return e.handler !== n || (a = !0, !1)
})), a || s.push({
handler: n,
wrappedHandler: r
})
}(e, t, n, s)
}
e.exports = function(e, t, n, i) {
r(t) ? o(t.split(/\s+/g), (function(t) {
s(e, t, n, i)
})) : o(t, (function(t, r) {
s(e, r, t, n)
}))
}
},
24: function(e, t, n) {
"use strict";
var r = n(322),
o = n(929);
e.exports = function(e, t) {
t = (t = r(t) ? t.join(" ") : t).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), o(e.className.baseVal) ? e.className = t : e.className.baseVal = t
}
},
204: function(e, t, n) {
"use strict";
var r = n(690),
o = n(928),
i = n(902),
s = n(24);
e.exports = function(e) {
var t, n = Array.prototype.slice.call(arguments, 1),
a = e.classList,
l = [];
a ? r(n, (function(t) {
e.classList.add(t)
})) : ((t = i(e)) && (n = [].concat(t.split(/\s+/), n)), r(n, (function(e) {
o(e, l) < 0 && l.push(e)
})), s(e, l))
}
},
522: function(e, t, n) {
"use strict";
var r = n(758),
o = n(690);
e.exports = function(e, t, n) {
var i = e.style;
r(t) ? i[t] = n : o(t, (function(e, t) {
i[t] = e
}))
}
},
902: function(e, t, n) {
"use strict";
var r = n(929);
e.exports = function(e) {
return e && e.className ? r(e.className.baseVal) ? e.className : e.className.baseVal : ""
}
},
714: function(e, t, n) {
"use strict";
var r = n(928),
o = n(902);
e.exports = function(e, t) {
var n;
return e.classList ? e.classList.contains(t) : (n = o(e).split(/\s+/), r(t, n) > -1)
}
},
471: function(e, t, n) {
"use strict";
var r = n(928),
o = n(354),
i = Element.prototype,
s = i.matches || i.webkitMatchesSelector || i.mozMatchesSelector || i.msMatchesSelector || function(e) {
var t = this.document || this.ownerDocument;
return r(this, o(t.querySelectorAll(e))) > -1
};
e.exports = function(e, t) {
return s.call(e, t)
}
},
462: function(e, t, n) {
"use strict";
var r = n(893),
o = n(928),
i = n(902),
s = n(24);
e.exports = function(e) {
var t, n, a = Array.prototype.slice.call(arguments, 1),
l = e.classList;
l ? r(a, (function(e) {
l.remove(e)
})) : (t = i(e).split(/\s+/), n = [], r(t, (function(e) {
o(e, a) < 0 && n.push(e)
})), s(e, n))
}
},
969: function(e) {
"use strict";
e.exports = function(e, t) {
var n, r, o, i, s = Object.prototype.hasOwnProperty;
for (o = 1, i = arguments.length; o < i; o += 1)
for (r in n = arguments[o]) s.call(n, r) && (e[r] = n[r]);
return e
}
},
254: function(e, t, n) {
"use strict";
var r = n(956);
e.exports = function(e, t) {
var n = document.createElement("img"),
o = "";
return r(t, (function(e, t) {
o += "&" + t + "=" + e
})), o = o.substring(1), n.src = e + "?" + o, n.style.display = "none", document.body.appendChild(n), document.body.removeChild(n), n
}
},
391: function(e, t, n) {
"use strict";
var r = n(929),
o = n(254);
e.exports = function(e, t) {
var n = location.hostname,
i = "TOAST UI " + e + " for " + n + ": Statistics",
s = window.localStorage.getItem(i);
(r(window.tui) || !1 !== window.tui.usageStatistics) && (s && ! function(e) {
return (new Date).getTime() - e > 6048e5
}(s) || (window.localStorage.setItem(i, (new Date).getTime()), setTimeout((function() {
"interactive" !== document.readyState && "complete" !== document.readyState || o("https://www.google-analytics.com/collect", {
v: 1,
t: "event",
tid: t,
cid: n,
dp: n,
dh: e,
el: e,
ec: "use"
})
}), 1e3)))
}
},
516: function(e) {
"use strict";
e.exports = function(e, t) {
var n, r;
return t = t || 0,
function() {
r = Array.prototype.slice.call(arguments), window.clearTimeout(n), n = window.setTimeout((function() {
e.apply(null, r)
}), t)
}
}
},
423: function(e, t, n) {
"use strict";
var r = n(516);
e.exports = function(e, t) {
var n, o, i, s, a = !0,
l = function(t) {
e.apply(null, t), n = null
};
function c() {
if (s = Array.prototype.slice.call(arguments), a) return l(s), void(a = !1);
i = Number(new Date), n = n || i, o(s), i - n >= t && l(s)
}
return o = r(l, t = t || 0), c.reset = function() {
a = !0, n = null
}, c
}
},
322: function(e) {
"use strict";
e.exports = function(e) {
return e instanceof Array
}
},
326: function(e) {
"use strict";
e.exports = function(e) {
return "boolean" == typeof e || e instanceof Boolean
}
},
65: function(e, t, n) {
"use strict";
var r = n(929),
o = n(934);
e.exports = function(e) {
return !r(e) && !o(e)
}
},
404: function(e, t, n) {
"use strict";
var r = n(790);
e.exports = function(e) {
return !r(e)
}
},
294: function(e) {
"use strict";
e.exports = function(e) {
return e instanceof Function
}
},
934: function(e) {
"use strict";
e.exports = function(e) {
return null === e
}
},
321: function(e) {
"use strict";
e.exports = function(e) {
return "number" == typeof e || e instanceof Number
}
},
73: function(e) {
"use strict";
e.exports = function(e) {
return e === Object(e)
}
},
758: function(e) {
"use strict";
e.exports = function(e) {
return "string" == typeof e || e instanceof String
}
},
790: function(e, t, n) {
"use strict";
var r = n(65);
e.exports = function(e) {
return r(e) && !1 !== e
}
},
929: function(e) {
"use strict";
e.exports = function(e) {
return void 0 === e
}
}
},
t = {};
function n(r) {
var o = t[r];
if (void 0 !== o) return o.exports;
var i = t[r] = {
exports: {}
};
return e[r].call(i.exports, i, i.exports, n), i.exports
}
n.n = function(e) {
var t = e && e.__esModule ? function() {
return e.default
} : function() {
return e
};
return n.d(t, {
a: t
}), t
}, n.d = function(e, t) {
for (var r in t) n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, {
enumerable: !0,
get: t[r]
})
}, n.g = function() {
if ("object" == typeof globalThis) return globalThis;
try {
return this || new Function("return this")()
} catch (e) {
if ("object" == typeof window) return window
}
}(), n.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
};
var r = {};
return function() {
"use strict";
n.d(r, {
default: function() {
return vy
}
});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var e = function(t, n) {
return e = Object.setPrototypeOf || {
__proto__: []
}
instanceof Array && function(e, t) {
e.__proto__ = t
} || function(e, t) {
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n])
}, e(t, n)
};
function t(t, n) {
if ("function" != typeof n && null !== n) throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
function r() {
this.constructor = t
}
e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r)
}
var o = function() {
return o = Object.assign || function(e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var o in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
return e
}, o.apply(this, arguments)
};
Object.create;
function i(e, t, n) {
if (n || 2 === arguments.length)
for (var r, o = 0, i = t.length; o < i; o++) !r && o in t || (r || (r = Array.prototype.slice.call(t, 0, o)), r[o] = t[o]);
return e.concat(r || Array.prototype.slice.call(t))
}
function s(e, t) {
return Object.defineProperty ? Object.defineProperty(e, "raw", {
value: t
}) : e.raw = t, e
}
Object.create;
function a(e) {
this.content = e
}
a.prototype = {
constructor: a,
find: function(e) {
for (var t = 0; t < this.content.length; t += 2)
if (this.content[t] === e) return t;
return -1
},
get: function(e) {
var t = this.find(e);
return -1 == t ? void 0 : this.content[t + 1]
},
update: function(e, t, n) {
var r = n && n != e ? this.remove(n) : this,
o = r.find(e),
i = r.content.slice();
return -1 == o ? i.push(n || e, t) : (i[o + 1] = t, n && (i[o] = n)), new a(i)
},
remove: function(e) {
var t = this.find(e);
if (-1 == t) return this;
var n = this.content.slice();
return n.splice(t, 2), new a(n)
},
addToStart: function(e, t) {
return new a([e, t].concat(this.remove(e).content))
},
addToEnd: function(e, t) {
var n = this.remove(e).content.slice();
return n.push(e, t), new a(n)
},
addBefore: function(e, t, n) {
var r = this.remove(t),
o = r.content.slice(),
i = r.find(e);
return o.splice(-1 == i ? o.length : i, 0, t, n), new a(o)
},
forEach: function(e) {
for (var t = 0; t < this.content.length; t += 2) e(this.content[t], this.content[t + 1])
},
prepend: function(e) {
return (e = a.from(e)).size ? new a(e.content.concat(this.subtract(e).content)) : this
},
append: function(e) {
return (e = a.from(e)).size ? new a(this.subtract(e).content.concat(e.content)) : this
},
subtract: function(e) {
var t = this;
e = a.from(e);
for (var n = 0; n < e.content.length; n += 2) t = t.remove(e.content[n]);
return t
},
get size() {
return this.content.length >> 1
}
}, a.from = function(e) {
if (e instanceof a) return e;
var t = [];
if (e)
for (var n in e) t.push(n, e[n]);
return new a(t)
};
var l = a;
function c(e, t, n) {
for (let r = 0;; r++) {
if (r == e.childCount || r == t.childCount) return e.childCount == t.childCount ? null : n;
let o = e.child(r),
i = t.child(r);
if (o != i) {
if (!o.sameMarkup(i)) return n;
if (o.isText && o.text != i.text) {
for (let e = 0; o.text[e] == i.text[e]; e++) n++;
return n
}
if (o.content.size || i.content.size) {
let e = c(o.content, i.content, n + 1);
if (null != e) return e
}
n += o.nodeSize
} else n += o.nodeSize
}
}
function u(e, t, n, r) {
for (let o = e.childCount, i = t.childCount;;) {
if (0 == o || 0 == i) return o == i ? null : {
a: n,
b: r
};
let s = e.child(--o),
a = t.child(--i),
l = s.nodeSize;
if (s != a) {
if (!s.sameMarkup(a)) return {
a: n,
b: r
};
if (s.isText && s.text != a.text) {
let e = 0,
t = Math.min(s.text.length, a.text.length);
for (; e < t && s.text[s.text.length - e - 1] == a.text[a.text.length - e - 1];) e++, n--, r--;
return {
a: n,
b: r
}
}
if (s.content.size || a.content.size) {
let e = u(s.content, a.content, n - 1, r - 1);
if (e) return e
}
n -= l, r -= l
} else n -= l, r -= l
}
}
class d {
constructor(e, t) {
if (this.content = e, this.size = t || 0, null == t)
for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize
}
nodesBetween(e, t, n, r = 0, o) {
for (let i = 0, s = 0; s < t; i++) {
let a = this.content[i],
l = s + a.nodeSize;
if (l > e && !1 !== n(a, r + s, o || null, i) && a.content.size) {
let o = s + 1;
a.nodesBetween(Math.max(0, e - o), Math.min(a.content.size, t - o), n, r + o)
}
s = l
}
}
descendants(e) {
this.nodesBetween(0, this.size, e)
}
textBetween(e, t, n, r) {
let o = "",
i = !0;
return this.nodesBetween(e, t, ((s, a) => {
s.isText ? (o += s.text.slice(Math.max(e, a) - a, t - a), i = !n) : s.isLeaf ? (r ? o += "function" == typeof r ? r(s) : r : s.type.spec.leafText && (o += s.type.spec.leafText(s)), i = !n) : !i && s.isBlock && (o += n, i = !0)
}), 0), o
}
append(e) {
if (!e.size) return this;
if (!this.size) return e;
let t = this.lastChild,
n = e.firstChild,
r = this.content.slice(),
o = 0;
for (t.isText && t.sameMarkup(n) && (r[r.length - 1] = t.withText(t.text + n.text), o = 1); o < e.content.length; o++) r.push(e.content[o]);
return new d(r, this.size + e.size)
}
cut(e, t = this.size) {
if (0 == e && t == this.size) return this;
let n = [],
r = 0;
if (t > e)
for (let o = 0, i = 0; i < t; o++) {
let s = this.content[o],
a = i + s.nodeSize;
a > e && ((i < e || a > t) && (s = s.isText ? s.cut(Math.max(0, e - i), Math.min(s.text.length, t - i)) : s.cut(Math.max(0, e - i - 1), Math.min(s.content.size, t - i - 1))), n.push(s), r += s.nodeSize), i = a
}
return new d(n, r)
}
cutByIndex(e, t) {
return e == t ? d.empty : 0 == e && t == this.content.length ? this : new d(this.content.slice(e, t))
}
replaceChild(e, t) {
let n = this.content[e];
if (n == t) return this;
let r = this.content.slice(),
o = this.size + t.nodeSize - n.nodeSize;
return r[e] = t, new d(r, o)
}
addToStart(e) {
return new d([e].concat(this.content), this.size + e.nodeSize)
}
addToEnd(e) {
return new d(this.content.concat(e), this.size + e.nodeSize)
}
eq(e) {
if (this.content.length != e.content.length) return !1;
for (let t = 0; t < this.content.length; t++)
if (!this.content[t].eq(e.content[t])) return !1;
return !0
}
get firstChild() {
return this.content.length ? this.content[0] : null
}
get lastChild() {
return this.content.length ? this.content[this.content.length - 1] : null
}
get childCount() {
return this.content.length
}
child(e) {
let t = this.content[e];
if (!t) throw new RangeError("Index " + e + " out of range for " + this);
return t
}
maybeChild(e) {
return this.content[e] || null
}
forEach(e) {
for (let t = 0, n = 0; t < this.content.length; t++) {
let r = this.content[t];
e(r, n, t), n += r.nodeSize
}
}
findDiffStart(e, t = 0) {
return c(this, e, t)
}
findDiffEnd(e, t = this.size, n = e.size) {
return u(this, e, t, n)
}
findIndex(e, t = -1) {
if (0 == e) return h(0, e);
if (e == this.size) return h(this.content.length, e);
if (e > this.size || e < 0) throw new RangeError(`Position ${e} outside of fragment (${this})`);
for (let n = 0, r = 0;; n++) {
let o = r + this.child(n).nodeSize;
if (o >= e) return o == e || t > 0 ? h(n + 1, o) : h(n, r);
r = o
}
}
toString() {
return "<" + this.toStringInner() + ">"
}
toStringInner() {
return this.content.join(", ")
}
toJSON() {
return this.content.length ? this.content.map((e => e.toJSON())) : null
}
static fromJSON(e, t) {
if (!t) return d.empty;
if (!Array.isArray(t)) throw new RangeError("Invalid input for Fragment.fromJSON");
return new d(t.map(e.nodeFromJSON))
}
static fromArray(e) {
if (!e.length) return d.empty;
let t, n = 0;
for (let r = 0; r < e.length; r++) {
let o = e[r];
n += o.nodeSize, r && o.isText && e[r - 1].sameMarkup(o) ? (t || (t = e.slice(0, r)), t[t.length - 1] = o.withText(t[t.length - 1].text + o.text)) : t && t.push(o)
}
return new d(t || e, n)
}
static from(e) {
if (!e) return d.empty;
if (e instanceof d) return e;
if (Array.isArray(e)) return this.fromArray(e);
if (e.attrs) return new d([e], e.nodeSize);
throw new RangeError("Can not convert " + e + " to a Fragment" + (e.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""))
}
}
d.empty = new d([], 0);
const p = {
index: 0,
offset: 0
};
function h(e, t) {
return p.index = e, p.offset = t, p
}
function f(e, t) {
if (e === t) return !0;
if (!e || "object" != typeof e || !t || "object" != typeof t) return !1;
let n = Array.isArray(e);
if (Array.isArray(t) != n) return !1;
if (n) {
if (e.length != t.length) return !1;
for (let n = 0; n < e.length; n++)
if (!f(e[n], t[n])) return !1
} else {
for (let n in e)
if (!(n in t) || !f(e[n], t[n])) return !1;
for (let n in t)
if (!(n in e)) return !1
}
return !0
}
class m {
constructor(e, t) {
this.type = e, this.attrs = t
}
addToSet(e) {
let t, n = !1;
for (let r = 0; r < e.length; r++) {
let o = e[r];
if (this.eq(o)) return e;
if (this.type.excludes(o.type)) t || (t = e.slice(0, r));
else {
if (o.type.excludes(this.type)) return e;
!n && o.type.rank > this.type.rank && (t || (t = e.slice(0, r)), t.push(this), n = !0), t && t.push(o)
}
}
return t || (t = e.slice()), n || t.push(this), t
}
removeFromSet(e) {
for (let t = 0; t < e.length; t++)
if (this.eq(e[t])) return e.slice(0, t).concat(e.slice(t + 1));
return e
}
isInSet(e) {
for (let t = 0; t < e.length; t++)
if (this.eq(e[t])) return !0;
return !1
}
eq(e) {
return this == e || this.type == e.type && f(this.attrs, e.attrs)
}
toJSON() {
let e = {
type: this.type.name
};
for (let t in this.attrs) {
e.attrs = this.attrs;
break
}
return e
}
static fromJSON(e, t) {
if (!t) throw new RangeError("Invalid input for Mark.fromJSON");
let n = e.marks[t.type];
if (!n) throw new RangeError(`There is no mark type ${t.type} in this schema`);
return n.create(t.attrs)
}
static sameSet(e, t) {
if (e == t) return !0;
if (e.length != t.length) return !1;
for (let n = 0; n < e.length; n++)
if (!e[n].eq(t[n])) return !1;
return !0
}
static setFrom(e) {
if (!e || Array.isArray(e) && 0 == e.length) return m.none;
if (e instanceof m) return [e];
let t = e.slice();
return t.sort(((e, t) => e.type.rank - t.type.rank)), t
}
}
m.none = [];
class g extends Error {}
class v {
constructor(e, t, n) {
this.content = e, this.openStart = t, this.openEnd = n
}
get size() {
return this.content.size - this.openStart - this.openEnd
}
insertAt(e, t) {
let n = b(this.content, e + this.openStart, t);
return n && new v(n, this.openStart, this.openEnd)
}
removeBetween(e, t) {
return new v(y(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd)
}
eq(e) {
return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd
}
toString() {
return this.content + "(" + this.openStart + "," + this.openEnd + ")"
}
toJSON() {
if (!this.content.size) return null;
let e = {
content: this.content.toJSON()
};
return this.openStart > 0 && (e.openStart = this.openStart), this.openEnd > 0 && (e.openEnd = this.openEnd), e
}
static fromJSON(e, t) {
if (!t) return v.empty;
let n = t.openStart || 0,
r = t.openEnd || 0;
if ("number" != typeof n || "number" != typeof r) throw new RangeError("Invalid input for Slice.fromJSON");
return new v(d.fromJSON(e, t.content), n, r)
}
static maxOpen(e, t = !0) {
let n = 0,
r = 0;
for (let r = e.firstChild; r && !r.isLeaf && (t || !r.type.spec.isolating); r = r.firstChild) n++;
for (let n = e.lastChild; n && !n.isLeaf && (t || !n.type.spec.isolating); n = n.lastChild) r++;
return new v(e, n, r)
}
}
function y(e, t, n) {
let {
index: r,
offset: o
} = e.findIndex(t), i = e.maybeChild(r), {
index: s,
offset: a
} = e.findIndex(n);
if (o == t || i.isText) {
if (a != n && !e.child(s).isText) throw new RangeError("Removing non-flat range");
return e.cut(0, t).append(e.cut(n))
}
if (r != s) throw new RangeError("Removing non-flat range");
return e.replaceChild(r, i.copy(y(i.content, t - o - 1, n - o - 1)))
}
function b(e, t, n, r) {
let {
index: o,
offset: i
} = e.findIndex(t), s = e.maybeChild(o);
if (i == t || s.isText) return r && !r.canReplace(o, o, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
let a = b(s.content, t - i - 1, n);
return a && e.replaceChild(o, s.copy(a))
}
function w(e, t, n) {
if (n.openStart > e.depth) throw new g("Inserted content deeper than insertion position");
if (e.depth - n.openStart != t.depth - n.openEnd) throw new g("Inconsistent open depths");
return k(e, t, n, 0)
}
function k(e, t, n, r) {
let o = e.index(r),
i = e.node(r);
if (o == t.index(r) && r < e.depth - n.openStart) {
let s = k(e, t, n, r + 1);
return i.copy(i.content.replaceChild(o, s))
}
if (n.content.size) {
if (n.openStart || n.openEnd || e.depth != r || t.depth != r) {
let {
start: o,
end: s
} = function(e, t) {
let n = t.depth - e.openStart,
r = t.node(n).copy(e.content);
for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(d.from(r));
return {
start: r.resolveNoCache(e.openStart + n),
end: r.resolveNoCache(r.content.size - e.openEnd - n)
}
}(n, e);
return S(i, E(e, o, s, t, r))
} {
let r = e.parent,
o = r.content;
return S(r, o.cut(0, e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))
}
}
return S(i, N(e, t, r))
}
function x(e, t) {
if (!t.type.compatibleContent(e.type)) throw new g("Cannot join " + t.type.name + " onto " + e.type.name)
}
function C(e, t, n) {
let r = e.node(n);
return x(r, t.node(n)), r
}
function T(e, t) {
let n = t.length - 1;
n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e)
}
function M(e, t, n, r) {
let o = (t || e).node(n),
i = 0,
s = t ? t.index(n) : o.childCount;
e && (i = e.index(n), e.depth > n ? i++ : e.textOffset && (T(e.nodeAfter, r), i++));
for (let e = i; e < s; e++) T(o.child(e), r);
t && t.depth == n && t.textOffset && T(t.nodeBefore, r)
}
function S(e, t) {
if (!e.type.validContent(t)) throw new g("Invalid content for node " + e.type.name);
return e.copy(t)
}
function E(e, t, n, r, o) {
let i = e.depth > o && C(e, t, o + 1),
s = r.depth > o && C(n, r, o + 1),
a = [];
return M(null, e, o, a), i && s && t.index(o) == n.index(o) ? (x(i, s), T(S(i, E(e, t, n, r, o + 1)), a)) : (i && T(S(i, N(e, t, o + 1)), a), M(t, n, o, a), s && T(S(s, N(n, r, o + 1)), a)), M(r, null, o, a), new d(a)
}
function N(e, t, n) {
let r = [];
if (M(null, e, n, r), e.depth > n) {
T(S(C(e, t, n + 1), N(e, t, n + 1)), r)
}
return M(t, null, n, r), new d(r)
}
v.empty = new v(d.empty, 0, 0);
class O {
constructor(e, t, n) {
this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1
}
resolveDepth(e) {
return null == e ? this.depth : e < 0 ? this.depth + e : e
}
get parent() {
return this.node(this.depth)
}
get doc() {
return this.node(0)
}
node(e) {
return this.path[3 * this.resolveDepth(e)]
}
index(e) {
return this.path[3 * this.resolveDepth(e) + 1]
}
indexAfter(e) {
return e = this.resolveDepth(e), this.index(e) + (e != this.depth || this.textOffset ? 1 : 0)
}
start(e) {
return 0 == (e = this.resolveDepth(e)) ? 0 : this.path[3 * e - 1] + 1
}
end(e) {
return e = this.resolveDepth(e), this.start(e) + this.node(e).content.size
}
before(e) {
if (!(e = this.resolveDepth(e))) throw new RangeError("There is no position before the top-level node");
return e == this.depth + 1 ? this.pos : this.path[3 * e - 1]
}
after(e) {
if (!(e = this.resolveDepth(e))) throw new RangeError("There is no position after the top-level node");
return e == this.depth + 1 ? this.pos : this.path[3 * e - 1] + this.path[3 * e].nodeSize
}
get textOffset() {
return this.pos - this.path[this.path.length - 1]
}
get nodeAfter() {
let e = this.parent,
t = this.index(this.depth);
if (t == e.childCount) return null;
let n = this.pos - this.path[this.path.length - 1],
r = e.child(t);
return n ? e.child(t).cut(n) : r
}
get nodeBefore() {
let e = this.index(this.depth),
t = this.pos - this.path[this.path.length - 1];
return t ? this.parent.child(e).cut(0, t) : 0 == e ? null : this.parent.child(e - 1)
}
posAtIndex(e, t) {
t = this.resolveDepth(t);
let n = this.path[3 * t],
r = 0 == t ? 0 : this.path[3 * t - 1] + 1;
for (let t = 0; t < e; t++) r += n.child(t).nodeSize;
return r
}
marks() {
let e = this.parent,
t = this.index();
if (0 == e.content.size) return m.none;
if (this.textOffset) return e.child(t).marks;
let n = e.maybeChild(t - 1),
r = e.maybeChild(t);
if (!n) {
let e = n;
n = r, r = e
}
let o = n.marks;
for (var i = 0; i < o.length; i++) !1 !== o[i].type.spec.inclusive || r && o[i].isInSet(r.marks) || (o = o[i--].removeFromSet(o));
return o
}
marksAcross(e) {
let t = this.parent.maybeChild(this.index());
if (!t || !t.isInline) return null;
let n = t.marks,
r = e.parent.maybeChild(e.index());
for (var o = 0; o < n.length; o++) !1 !== n[o].type.spec.inclusive || r && n[o].isInSet(r.marks) || (n = n[o--].removeFromSet(n));
return n
}
sharedDepth(e) {
for (let t = this.depth; t > 0; t--)
if (this.start(t) <= e && this.end(t) >= e) return t;
return 0
}
blockRange(e = this, t) {
if (e.pos < this.pos) return e.blockRange(this);
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--)
if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new I(this, e, n);
return null
}
sameParent(e) {
return this.pos - this.parentOffset == e.pos - e.parentOffset
}
max(e) {
return e.pos > this.pos ? e : this
}
min(e) {
return e.pos < this.pos ? e : this
}
toString() {
let e = "";
for (let t = 1; t <= this.depth; t++) e += (e ? "/" : "") + this.node(t).type.name + "_" + this.index(t - 1);
return e + ":" + this.parentOffset
}
static resolve(e, t) {
if (!(t >= 0 && t <= e.content.size)) throw new RangeError("Position " + t + " out of range");
let n = [],
r = 0,
o = t;
for (let t = e;;) {
let {
index: e,
offset: i
} = t.content.findIndex(o), s = o - i;
if (n.push(t, e, r + i), !s) break;
if (t = t.child(e), t.isText) break;
o = s - 1, r += i + 1
}
return new O(t, n, o)
}
static resolveCached(e, t) {
for (let n = 0; n < D.length; n++) {
let r = D[n];
if (r.pos == t && r.doc == e) return r
}
let n = D[A] = O.resolve(e, t);
return A = (A + 1) % L, n
}
}
let D = [],
A = 0,
L = 12;
class I {
constructor(e, t, n) {
this.$from = e, this.$to = t, this.depth = n
}
get start() {
return this.$from.before(this.depth + 1)
}
get end() {
return this.$to.after(this.depth + 1)
}
get parent() {
return this.$from.node(this.depth)
}
get startIndex() {
return this.$from.index(this.depth)
}
get endIndex() {
return this.$to.indexAfter(this.depth)
}
}
const R = Object.create(null);
class P {
constructor(e, t, n, r = m.none) {
this.type = e, this.attrs = t, this.marks = r, this.content = n || d.empty
}
get nodeSize() {
return this.isLeaf ? 1 : 2 + this.content.size
}
get childCount() {
return this.content.childCount
}
child(e) {
return this.content.child(e)
}
maybeChild(e) {
return this.content.maybeChild(e)
}
forEach(e) {
this.content.forEach(e)
}
nodesBetween(e, t, n, r = 0) {
this.content.nodesBetween(e, t, n, r, this)
}
descendants(e) {
this.nodesBetween(0, this.content.size, e)
}
get textContent() {
return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "")
}
textBetween(e, t, n, r) {
return this.content.textBetween(e, t, n, r)
}
get firstChild() {
return this.content.firstChild
}
get lastChild() {
return this.content.lastChild
}
eq(e) {
return this == e || this.sameMarkup(e) && this.content.eq(e.content)
}
sameMarkup(e) {
return this.hasMarkup(e.type, e.attrs, e.marks)
}
hasMarkup(e, t, n) {
return this.type == e && f(this.attrs, t || e.defaultAttrs || R) && m.sameSet(this.marks, n || m.none)
}
copy(e = null) {
return e == this.content ? this : new P(this.type, this.attrs, e, this.marks)
}
mark(e) {
return e == this.marks ? this : new P(this.type, this.attrs, this.content, e)
}
cut(e, t = this.content.size) {
return 0 == e && t == this.content.size ? this : this.copy(this.content.cut(e, t))
}
slice(e, t = this.content.size, n = !1) {
if (e == t) return v.empty;
let r = this.resolve(e),
o = this.resolve(t),
i = n ? 0 : r.sharedDepth(t),
s = r.start(i),
a = r.node(i).content.cut(r.pos - s, o.pos - s);
return new v(a, r.depth - i, o.depth - i)
}
replace(e, t, n) {
return w(this.resolve(e), this.resolve(t), n)
}
nodeAt(e) {
for (let t = this;;) {
let {
index: n,
offset: r
} = t.content.findIndex(e);
if (t = t.maybeChild(n), !t) return null;
if (r == e || t.isText) return t;
e -= r + 1
}
}
childAfter(e) {
let {
index: t,
offset: n
} = this.content.findIndex(e);
return {
node: this.content.maybeChild(t),
index: t,
offset: n
}
}
childBefore(e) {
if (0 == e) return {
node: null,
index: 0,
offset: 0
};
let {
index: t,
offset: n
} = this.content.findIndex(e);
if (n < e) return {
node: this.content.child(t),
index: t,
offset: n
};
let r = this.content.child(t - 1);
return {
node: r,
index: t - 1,
offset: n - r.nodeSize
}
}
resolve(e) {
return O.resolveCached(this, e)
}
resolveNoCache(e) {
return O.resolve(this, e)
}
rangeHasMark(e, t, n) {
let r = !1;
return t > e && this.nodesBetween(e, t, (e => (n.isInSet(e.marks) && (r = !0), !r))), r
}
get isBlock() {
return this.type.isBlock
}
get isTextblock() {
return this.type.isTextblock
}
get inlineContent() {
return this.type.inlineContent
}
get isInline() {
return this.type.isInline
}
get isText() {
return this.type.isText
}
get isLeaf() {
return this.type.isLeaf
}
get isAtom() {
return this.type.isAtom
}
toString() {
if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
let e = this.type.name;
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), F(this.marks, e)
}
contentMatchAt(e) {
let t = this.type.contentMatch.matchFragment(this.content, 0, e);
if (!t) throw new Error("Called contentMatchAt on a node with invalid content");
return t
}
canReplace(e, t, n = d.empty, r = 0, o = n.childCount) {
let i = this.contentMatchAt(e).matchFragment(n, r, o),
s = i && i.matchFragment(this.content, t);
if (!s || !s.validEnd) return !1;
for (let e = r; e < o; e++)
if (!this.type.allowsMarks(n.child(e).marks)) return !1;
return !0
}
canReplaceWith(e, t, n, r) {
if (r && !this.type.allowsMarks(r)) return !1;
let o = this.contentMatchAt(e).matchType(n),
i = o && o.matchFragment(this.content, t);
return !!i && i.validEnd
}
canAppend(e) {
return e.content.size ? this.canReplace(this.childCount, this.childCount, e.content) : this.type.compatibleContent(e.type)
}
check() {
if (!this.type.validContent(this.content)) throw new RangeError(`Invalid content for node ${this.type.name}: ${this.content.toString().slice(0,50)}`);
let e = m.none;
for (let t = 0; t < this.marks.length; t++) e = this.marks[t].addToSet(e);
if (!m.sameSet(e, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);
this.content.forEach((e => e.check()))
}
toJSON() {
let e = {
type: this.type.name
};
for (let t in this.attrs) {
e.attrs = this.attrs;
break
}
return this.content.size && (e.content = this.content.toJSON()), this.marks.length && (e.marks = this.marks.map((e => e.toJSON()))), e
}
static fromJSON(e, t) {
if (!t) throw new RangeError("Invalid input for Node.fromJSON");
let n = null;
if (t.marks) {
if (!Array.isArray(t.marks)) throw new RangeError("Invalid mark data for Node.fromJSON");
n = t.marks.map(e.markFromJSON)
}
if ("text" == t.type) {
if ("string" != typeof t.text) throw new RangeError("Invalid text node in JSON");
return e.text(t.text, n)
}
let r = d.fromJSON(e, t.content);
return e.nodeType(t.type).create(t.attrs, r, n)
}
}
P.prototype.text = void 0;
class B extends P {
constructor(e, t, n, r) {
if (super(e, t, null, r), !n) throw new RangeError("Empty text nodes are not allowed");
this.text = n
}
toString() {
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : F(this.marks, JSON.stringify(this.text))
}
get textContent() {
return this.text
}
textBetween(e, t) {
return this.text.slice(e, t)
}
get nodeSize() {
return this.text.length
}
mark(e) {
return e == this.marks ? this : new B(this.type, this.attrs, this.text, e)
}
withText(e) {
return e == this.text ? this : new B(this.type, this.attrs, e, this.marks)
}
cut(e = 0, t = this.text.length) {
return 0 == e && t == this.text.length ? this : this.withText(this.text.slice(e, t))
}
eq(e) {
return this.sameMarkup(e) && this.text == e.text
}
toJSON() {
let e = super.toJSON();
return e.text = this.text, e
}
}
function F(e, t) {
for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
return t
}
class H {
constructor(e) {
this.validEnd = e, this.next = [], this.wrapCache = []
}
static parse(e, t) {
let n = new z(e, t);
if (null == n.next) return H.empty;
let r = q(n);
n.next && n.err("Unexpected trailing text");
let o = function(e) {
let t = Object.create(null);
return n(W(e, 0));
function n(r) {
let o = [];
r.forEach((t => {
e[t].forEach((({
term: t,
to: n
}) => {
if (!t) return;
let r;
for (let e = 0; e < o.length; e++) o[e][0] == t && (r = o[e][1]);
W(e, n).forEach((e => {
r || o.push([t, r = []]), -1 == r.indexOf(e) && r.push(e)
}))
}))
}));
let i = t[r.join(",")] = new H(r.indexOf(e.length - 1) > -1);
for (let e = 0; e < o.length; e++) {
let r = o[e][1].sort(U);
i.next.push({
type: o[e][0],
next: t[r.join(",")] || n(r)
})
}
return i
}
}(function(e) {
let t = [
[]
];
return o(i(e, 0), n()), t;
function n() {
return t.push([]) - 1
}
function r(e, n, r) {
let o = {
term: r,
to: n
};
return t[e].push(o), o
}
function o(e, t) {
e.forEach((e => e.to = t))
}
function i(e, t) {
if ("choice" == e.type) return e.exprs.reduce(((e, n) => e.concat(i(n, t))), []);
if ("seq" != e.type) {
if ("star" == e.type) {
let s = n();
return r(t, s), o(i(e.expr, s), s), [r(s)]
}
if ("plus" == e.type) {
let s = n();
return o(i(e.expr, t), s), o(i(e.expr, s), s), [r(s)]
}
if ("opt" == e.type) return [r(t)].concat(i(e.expr, t));
if ("range" == e.type) {
let s = t;
for (let t = 0; t < e.min; t++) {
let t = n();
o(i(e.expr, s), t), s = t
}
if (-1 == e.max) o(i(e.expr, s), s);
else
for (let t = e.min; t < e.max; t++) {
let t = n();
r(s, t), o(i(e.expr, s), t), s = t
}
return [r(s)]
}
if ("name" == e.type) return [r(t, void 0, e.value)];
throw new Error("Unknown expr type")
}
for (let r = 0;; r++) {
let s = i(e.exprs[r], t);
if (r == e.exprs.length - 1) return s;
o(s, t = n())
}
}
}(r));
return function(e, t) {
for (let n = 0, r = [e]; n < r.length; n++) {
let e = r[n],
o = !e.validEnd,
i = [];
for (let t = 0; t < e.next.length; t++) {
let {
type: n,
next: s
} = e.next[t];
i.push(n.name), !o || n.isText || n.hasRequiredAttrs() || (o = !1), -1 == r.indexOf(s) && r.push(s)
}
o && t.err("Only non-generatable nodes (" + i.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)")
}
}(o, n), o
}
matchType(e) {
for (let t = 0; t < this.next.length; t++)
if (this.next[t].type == e) return this.next[t].next;
return null
}
matchFragment(e, t = 0, n = e.childCount) {
let r = this;
for (let o = t; r && o < n; o++) r = r.matchType(e.child(o).type);
return r
}
get inlineContent() {
return this.next.length && this.next[0].type.isInline
}
get defaultType() {
for (let e = 0; e < this.next.length; e++) {
let {
type: t
} = this.next[e];
if (!t.isText && !t.hasRequiredAttrs()) return t
}
return null
}
compatible(e) {
for (let t = 0; t < this.next.length; t++)
for (let n = 0; n < e.next.length; n++)
if (this.next[t].type == e.next[n].type) return !0;
return !1
}
fillBefore(e, t = !1, n = 0) {
let r = [this];
return function o(i, s) {
let a = i.matchFragment(e, n);
if (a && (!t || a.validEnd)) return d.from(s.map((e => e.createAndFill())));
for (let e = 0; e < i.next.length; e++) {
let {
type: t,
next: n
} = i.next[e];
if (!t.isText && !t.hasRequiredAttrs() && -1 == r.indexOf(n)) {
r.push(n);
let e = o(n, s.concat(t));
if (e) return e
}
}
return null
}(this, [])
}
findWrapping(e) {
for (let t = 0; t < this.wrapCache.length; t += 2)
if (this.wrapCache[t] == e) return this.wrapCache[t + 1];
let t = this.computeWrapping(e);
return this.wrapCache.push(e, t), t
}
computeWrapping(e) {
let t = Object.create(null),
n = [{
match: this,
type: null,
via: null
}];
for (; n.length;) {
let r = n.shift(),
o = r.match;
if (o.matchType(e)) {
let e = [];
for (let t = r; t.type; t = t.via) e.push(t.type);
return e.reverse()
}
for (let e = 0; e < o.next.length; e++) {
let {
type: i,
next: s
} = o.next[e];
i.isLeaf || i.hasRequiredAttrs() || i.name in t || r.type && !s.validEnd || (n.push({
match: i.contentMatch,
type: i,
via: r
}), t[i.name] = !0)
}
}
return null
}
get edgeCount() {
return this.next.length
}
edge(e) {
if (e >= this.next.length) throw new RangeError(`There's no ${e}th edge in this content match`);
return this.next[e]
}
toString() {
let e = [];
return function t(n) {
e.push(n);
for (let r = 0; r < n.next.length; r++) - 1 == e.indexOf(n.next[r].next) && t(n.next[r].next)
}(this), e.map(((t, n) => {
let r = n + (t.validEnd ? "*" : " ") + " ";
for (let n = 0; n < t.next.length; n++) r += (n ? ", " : "") + t.next[n].type.name + "->" + e.indexOf(t.next[n].next);
return r
})).join("\n")
}
}
H.empty = new H(!0);
class z {
constructor(e, t) {
this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), "" == this.tokens[this.tokens.length - 1] && this.tokens.pop(), "" == this.tokens[0] && this.tokens.shift()
}
get next() {
return this.tokens[this.pos]
}
eat(e) {
return this.next == e && (this.pos++ || !0)
}
err(e) {
throw new SyntaxError(e + " (in content expression '" + this.string + "')")
}
}
function q(e) {
let t = [];
do {
t.push(V(e))
} while (e.eat("|"));
return 1 == t.length ? t[0] : {
type: "choice",
exprs: t
}
}
function V(e) {
let t = [];
do {
t.push(j(e))
} while (e.next && ")" != e.next && "|" != e.next);
return 1 == t.length ? t[0] : {
type: "seq",
exprs: t
}
}
function j(e) {
let t = function(e) {
if (e.eat("(")) {
let t = q(e);
return e.eat(")") || e.err("Missing closing paren"), t
}
if (!/\W/.test(e.next)) {
let t = function(e, t) {
let n = e.nodeTypes,
r = n[t];
if (r) return [r];
let o = [];
for (let e in n) {
let r = n[e];
r.groups.indexOf(t) > -1 && o.push(r)
}
0 == o.length && e.err("No node type or group '" + t + "' found");
return o
}(e, e.next).map((t => (null == e.inline ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
type: "name",
value: t
})));
return e.pos++, 1 == t.length ? t[0] : {
type: "choice",
exprs: t
}
}
e.err("Unexpected token '" + e.next + "'")
}(e);
for (;;)
if (e.eat("+")) t = {
type: "plus",
expr: t
};
else if (e.eat("*")) t = {
type: "star",
expr: t
};
else if (e.eat("?")) t = {
type: "opt",
expr: t
};
else {
if (!e.eat("{")) break;
t = _(e, t)
}
return t
}
function $(e) {
/\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
let t = Number(e.next);
return e.pos++, t
}
function _(e, t) {
let n = $(e),
r = n;
return e.eat(",") && (r = "}" != e.next ? $(e) : -1), e.eat("}") || e.err("Unclosed braced range"), {
type: "range",
min: n,
max: r,
expr: t
}
}
function U(e, t) {
return t - e
}
function W(e, t) {
let n = [];
return function t(r) {
let o = e[r];
if (1 == o.length && !o[0].term) return t(o[0].to);
n.push(r);
for (let e = 0; e < o.length; e++) {
let {
term: r,
to: i
} = o[e];
r || -1 != n.indexOf(i) || t(i)
}
}(t), n.sort(U)
}
function J(e) {
let t = Object.create(null);
for (let n in e) {
let r = e[n];
if (!r.hasDefault) return null;
t[n] = r.default
}
return t
}
function G(e, t) {
let n = Object.create(null);
for (let r in e) {
let o = t && t[r];
if (void 0 === o) {
let t = e[r];
if (!t.hasDefault) throw new RangeError("No value supplied for attribute " + r);
o = t.default
}
n[r] = o
}
return n
}
function K(e) {
let t = Object.create(null);
if (e)
for (let n in e) t[n] = new X(e[n]);
return t
}
class Z {
constructor(e, t, n) {
this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = K(n.attrs), this.defaultAttrs = J(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || "text" == e), this.isText = "text" == e
}
get isInline() {
return !this.isBlock
}
get isTextblock() {
return this.isBlock && this.inlineContent
}
get isLeaf() {
return this.contentMatch == H.empty
}
get isAtom() {
return this.isLeaf || !!this.spec.atom
}
get whitespace() {
return this.spec.whitespace || (this.spec.code ? "pre" : "normal")
}
hasRequiredAttrs() {
for (let e in this.attrs)
if (this.attrs[e].isRequired) return !0;
return !1
}
compatibleContent(e) {
return this == e || this.contentMatch.compatible(e.contentMatch)
}
computeAttrs(e) {
return !e && this.defaultAttrs ? this.defaultAttrs : G(this.attrs, e)
}
create(e = null, t, n) {
if (this.isText) throw new Error("NodeType.create can't construct text nodes");
return new P(this, this.computeAttrs(e), d.from(t), m.setFrom(n))
}
createChecked(e = null, t, n) {
if (t = d.from(t), !this.validContent(t)) throw new RangeError("Invalid content for node " + this.name);
return new P(this, this.computeAttrs(e), t, m.setFrom(n))
}
createAndFill(e = null, t, n) {
if (e = this.computeAttrs(e), (t = d.from(t)).size) {
let e = this.contentMatch.fillBefore(t);
if (!e) return null;
t = e.append(t)
}
let r = this.contentMatch.matchFragment(t),
o = r && r.fillBefore(d.empty, !0);
return o ? new P(this, e, t.append(o), m.setFrom(n)) : null
}
validContent(e) {
let t = this.contentMatch.matchFragment(e);
if (!t || !t.validEnd) return !1;
for (let t = 0; t < e.childCount; t++)
if (!this.allowsMarks(e.child(t).marks)) return !1;
return !0
}
allowsMarkType(e) {
return null == this.markSet || this.markSet.indexOf(e) > -1
}
allowsMarks(e) {
if (null == this.markSet) return !0;
for (let t = 0; t < e.length; t++)
if (!this.allowsMarkType(e[t].type)) return !1;
return !0
}
allowedMarks(e) {
if (null == this.markSet) return e;
let t;
for (let n = 0; n < e.length; n++) this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t || (t = e.slice(0, n));
return t ? t.length ? t : m.none : e
}
static compile(e, t) {
let n = Object.create(null);
e.forEach(((e, r) => n[e] = new Z(e, t, r)));
let r = t.spec.topNode || "doc";
if (!n[r]) throw new RangeError("Schema is missing its top node type ('" + r + "')");
if (!n.text) throw new RangeError("Every schema needs a 'text' type");
for (let e in n.text.attrs) throw new RangeError("The text node type should not have attributes");
return n
}
}
class X {
constructor(e) {
this.hasDefault = Object.prototype.hasOwnProperty.call(e, "default"), this.default = e.default
}
get isRequired() {
return !this.hasDefault
}
}
class Q {
constructor(e, t, n, r) {
this.name = e, this.rank = t, this.schema = n, this.spec = r, this.attrs = K(r.attrs), this.excluded = null;
let o = J(this.attrs);
this.instance = o ? new m(this, o) : null
}
create(e = null) {
return !e && this.instance ? this.instance : new m(this, G(this.attrs, e))
}
static compile(e, t) {
let n = Object.create(null),
r = 0;
return e.forEach(((e, o) => n[e] = new Q(e, r++, t, o))), n
}
removeFromSet(e) {
for (var t = 0; t < e.length; t++) e[t].type == this && (e = e.slice(0, t).concat(e.slice(t + 1)), t--);
return e
}
isInSet(e) {
for (let t = 0; t < e.length; t++)
if (e[t].type == this) return e[t]
}
excludes(e) {
return this.excluded.indexOf(e) > -1
}
}
class Y {
constructor(e) {
this.cached = Object.create(null), this.spec = {
nodes: l.from(e.nodes),
marks: l.from(e.marks || {}),
topNode: e.topNode
}, this.nodes = Z.compile(this.spec.nodes, this), this.marks = Q.compile(this.spec.marks, this);
let t = Object.create(null);
for (let e in this.nodes) {
if (e in this.marks) throw new RangeError(e + " can not be both a node and a mark");
let n = this.nodes[e],
r = n.spec.content || "",
o = n.spec.marks;
n.contentMatch = t[r] || (t[r] = H.parse(r, this.nodes)), n.inlineContent = n.contentMatch.inlineContent, n.markSet = "_" == o ? null : o ? ee(this, o.split(" ")) : "" != o && n.inlineContent ? null : []
}
for (let e in this.marks) {
let t = this.marks[e],
n = t.spec.excludes;
t.excluded = null == n ? [t] : "" == n ? [] : ee(this, n.split(" "))
}
this.nodeFromJSON = this.nodeFromJSON.bind(this), this.markFromJSON = this.markFromJSON.bind(this), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = Object.create(null)
}
node(e, t = null, n, r) {
if ("string" == typeof e) e = this.nodeType(e);
else {
if (!(e instanceof Z)) throw new RangeError("Invalid node type: " + e);
if (e.schema != this) throw new RangeError("Node type from different schema used (" + e.name + ")")
}
return e.createChecked(t, n, r)
}
text(e, t) {
let n = this.nodes.text;
return new B(n, n.defaultAttrs, e, m.setFrom(t))
}
mark(e, t) {
return "string" == typeof e && (e = this.marks[e]), e.create(t)
}
nodeFromJSON(e) {
return P.fromJSON(this, e)
}
markFromJSON(e) {
return m.fromJSON(this, e)
}
nodeType(e) {
let t = this.nodes[e];
if (!t) throw new RangeError("Unknown node type: " + e);
return t
}
}
function ee(e, t) {
let n = [];
for (let r = 0; r < t.length; r++) {
let o = t[r],
i = e.marks[o],
s = i;
if (i) n.push(i);
else
for (let t in e.marks) {
let r = e.marks[t];
("_" == o || r.spec.group && r.spec.group.split(" ").indexOf(o) > -1) && n.push(s = r)
}
if (!s) throw new SyntaxError("Unknown mark type: '" + t[r] + "'")
}
return n
}
class te {
constructor(e, t) {
this.schema = e, this.rules = t, this.tags = [], this.styles = [], t.forEach((e => {
e.tag ? this.tags.push(e) : e.style && this.styles.push(e)
})), this.normalizeLists = !this.tags.some((t => {
if (!/^(ul|ol)\b/.test(t.tag) || !t.node) return !1;
let n = e.nodes[t.node];
return n.contentMatch.matchType(n)
}))
}
parse(e, t = {}) {
let n = new ae(this, t, !1);
return n.addAll(e, t.from, t.to), n.finish()
}
parseSlice(e, t = {}) {
let n = new ae(this, t, !0);
return n.addAll(e, t.from, t.to), v.maxOpen(n.finish())
}
matchTag(e, t, n) {
for (let r = n ? this.tags.indexOf(n) + 1 : 0; r < this.tags.length; r++) {
let n = this.tags[r];
if (le(e, n.tag) && (void 0 === n.namespace || e.namespaceURI == n.namespace) && (!n.context || t.matchesContext(n.context))) {
if (n.getAttrs) {
let t = n.getAttrs(e);
if (!1 === t) continue;
n.attrs = t || void 0
}
return n
}
}
}
matchStyle(e, t, n, r) {
for (let o = r ? this.styles.indexOf(r) + 1 : 0; o < this.styles.length; o++) {
let r = this.styles[o],
i = r.style;
if (!(0 != i.indexOf(e) || r.context && !n.matchesContext(r.context) || i.length > e.length && (61 != i.charCodeAt(e.length) || i.slice(e.length + 1) != t))) {
if (r.getAttrs) {
let e = r.getAttrs(t);
if (!1 === e) continue;
r.attrs = e || void 0
}
return r
}
}
}
static schemaRules(e) {
let t = [];
function n(e) {
let n = null == e.priority ? 50 : e.priority,
r = 0;
for (; r < t.length; r++) {
let e = t[r];
if ((null == e.priority ? 50 : e.priority) < n) break
}
t.splice(r, 0, e)
}
for (let t in e.marks) {
let r = e.marks[t].spec.parseDOM;
r && r.forEach((e => {
n(e = ce(e)), e.mark = t
}))
}
for (let t in e.nodes) {
let r = e.nodes[t].spec.parseDOM;
r && r.forEach((e => {
n(e = ce(e)), e.node = t
}))
}
return t
}
static fromSchema(e) {
return e.cached.domParser || (e.cached.domParser = new te(e, te.schemaRules(e)))
}
}
const ne = {
address: !0,
article: !0,
aside: !0,
blockquote: !0,
canvas: !0,
dd: !0,
div: !0,
dl: !0,
fieldset: !0,
figcaption: !0,
figure: !0,
footer: !0,
form: !0,
h1: !0,
h2: !0,
h3: !0,
h4: !0,
h5: !0,
h6: !0,
header: !0,
hgroup: !0,
hr: !0,
li: !0,
noscript: !0,
ol: !0,
output: !0,
p: !0,
pre: !0,
section: !0,
table: !0,
tfoot: !0,
ul: !0
},
re = {
head: !0,
noscript: !0,
object: !0,
script: !0,
style: !0,
title: !0
},
oe = {
ol: !0,
ul: !0
};
function ie(e, t, n) {
return null != t ? (t ? 1 : 0) | ("full" === t ? 2 : 0) : e && "pre" == e.whitespace ? 3 : -5 & n
}
class se {
constructor(e, t, n, r, o, i, s) {
this.type = e, this.attrs = t, this.marks = n, this.pendingMarks = r, this.solid = o, this.options = s, this.content = [], this.activeMarks = m.none, this.stashMarks = [], this.match = i || (4 & s ? null : e.contentMatch)
}
findWrapping(e) {
if (!this.match) {
if (!this.type) return [];
let t = this.type.contentMatch.fillBefore(d.from(e));
if (!t) {
let t, n = this.type.contentMatch;
return (t = n.findWrapping(e.type)) ? (this.match = n, t) : null
}
this.match = this.type.contentMatch.matchFragment(t)
}
return this.match.findWrapping(e.type)
}
finish(e) {
if (!(1 & this.options)) {
let e, t = this.content[this.content.length - 1];
if (t && t.isText && (e = /[ \t\r\n\u000c]+$/.exec(t.text))) {
let n = t;
t.text.length == e[0].length ? this.content.pop() : this.content[this.content.length - 1] = n.withText(n.text.slice(0, n.text.length - e[0].length))
}
}
let t = d.from(this.content);
return !e && this.match && (t = t.append(this.match.fillBefore(d.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t
}
popFromStashMark(e) {
for (let t = this.stashMarks.length - 1; t >= 0; t--)
if (e.eq(this.stashMarks[t])) return this.stashMarks.splice(t, 1)[0]
}
applyPending(e) {
for (let t = 0, n = this.pendingMarks; t < n.length; t++) {
let r = n[t];
(this.type ? this.type.allowsMarkType(r.type) : ue(r.type, e)) && !r.isInSet(this.activeMarks) && (this.activeMarks = r.addToSet(this.activeMarks), this.pendingMarks = r.removeFromSet(this.pendingMarks))
}
}
inlineContext(e) {
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !ne.hasOwnProperty(e.parentNode.nodeName.toLowerCase())
}
}
class ae {
constructor(e, t, n) {
this.parser = e, this.options = t, this.isOpen = n, this.open = 0;
let r, o = t.topNode,
i = ie(null, t.preserveWhitespace, 0) | (n ? 4 : 0);
r = o ? new se(o.type, o.attrs, m.none, m.none, !0, t.topMatch || o.type.contentMatch, i) : new se(n ? null : e.schema.topNodeType, null, m.none, m.none, !0, null, i), this.nodes = [r], this.find = t.findPositions, this.needsBlock = !1
}
get top() {
return this.nodes[this.open]
}
addDOM(e) {
if (3 == e.nodeType) this.addTextNode(e);
else if (1 == e.nodeType) {
let t = e.getAttribute("style"),
n = t ? this.readStyles(function(e) {
let t, n = /\s*([\w-]+)\s*:\s*([^;]+)/g,
r = [];
for (; t = n.exec(e);) r.push(t[1], t[2].trim());
return r
}(t)) : null,
r = this.top;
if (null != n)
for (let e = 0; e < n.length; e++) this.addPendingMark(n[e]);
if (this.addElement(e), null != n)
for (let e = 0; e < n.length; e++) this.removePendingMark(n[e], r)
}
}
addTextNode(e) {
let t = e.nodeValue,
n = this.top;
if (2 & n.options || n.inlineContext(e) || /[^ \t\r\n\u000c]/.test(t)) {
if (1 & n.options) t = 2 & n.options ? t.replace(/\r\n?/g, "\n") : t.replace(/\r?\n|\r/g, " ");
else if (t = t.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(t) && this.open == this.nodes.length - 1) {
let r = n.content[n.content.length - 1],
o = e.previousSibling;
(!r || o && "BR" == o.nodeName || r.isText && /[ \t\r\n\u000c]$/.test(r.text)) && (t = t.slice(1))
}
t && this.insertNode(this.parser.schema.text(t)), this.findInText(e)
} else this.findInside(e)
}
addElement(e, t) {
let n, r = e.nodeName.toLowerCase();
oe.hasOwnProperty(r) && this.parser.normalizeLists && function(e) {
for (let t = e.firstChild, n = null; t; t = t.nextSibling) {
let e = 1 == t.nodeType ? t.nodeName.toLowerCase() : null;
e && oe.hasOwnProperty(e) && n ? (n.appendChild(t), t = n) : "li" == e ? n = t : e && (n = null)
}
}(e);
let o = this.options.ruleFromNode && this.options.ruleFromNode(e) || (n = this.parser.matchTag(e, this, t));
if (o ? o.ignore : re.hasOwnProperty(r)) this.findInside(e), this.ignoreFallback(e);
else if (!o || o.skip || o.closeParent) {
o && o.closeParent ? this.open = Math.max(0, this.open - 1) : o && o.skip.nodeType && (e = o.skip);
let t, n = this.top,
i = this.needsBlock;
if (ne.hasOwnProperty(r)) t = !0, n.type || (this.needsBlock = !0);
else if (!e.firstChild) return void this.leafFallback(e);
this.addAll(e), t && this.sync(n), this.needsBlock = i
} else this.addElementByRule(e, o, !1 === o.consuming ? n : void 0)
}
leafFallback(e) {
"BR" == e.nodeName && this.top.type && this.top.type.inlineContent && this.addTextNode(e.ownerDocument.createTextNode("\n"))
}
ignoreFallback(e) {
"BR" != e.nodeName || this.top.type && this.top.type.inlineContent || this.findPlace(this.parser.schema.text("-"))
}
readStyles(e) {
let t = m.none;
e: for (let n = 0; n < e.length; n += 2)
for (let r;;) {
let o = this.parser.matchStyle(e[n], e[n + 1], this, r);
if (!o) continue e;
if (o.ignore) return null;
if (t = this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t), !1 !== o.consuming) break;
r = o
}
return t
}
addElementByRule(e, t, n) {
let r, o, i;
if (t.node) o = this.parser.schema.nodes[t.node], o.isLeaf ? this.insertNode(o.create(t.attrs)) || this.leafFallback(e) : r = this.enter(o, t.attrs || null, t.preserveWhitespace);
else {
i = this.parser.schema.marks[t.mark].create(t.attrs), this.addPendingMark(i)
}
let s = this.top;
if (o && o.isLeaf) this.findInside(e);
else if (n) this.addElement(e, n);
else if (t.getContent) this.findInside(e), t.getContent(e, this.parser.schema).forEach((e => this.insertNode(e)));
else {
let n = e;
"string" == typeof t.contentElement ? n = e.querySelector(t.contentElement) : "function" == typeof t.contentElement ? n = t.contentElement(e) : t.contentElement && (n = t.contentElement), this.findAround(e, n, !0), this.addAll(n)
}
r && this.sync(s) && this.open--, i && this.removePendingMark(i, s)
}
addAll(e, t, n) {
let r = t || 0;
for (let o = t ? e.childNodes[t] : e.firstChild, i = null == n ? null : e.childNodes[n]; o != i; o = o.nextSibling, ++r) this.findAtPoint(e, r), this.addDOM(o);
this.findAtPoint(e, r)
}
findPlace(e) {
let t, n;
for (let r = this.open; r >= 0; r--) {
let o = this.nodes[r],
i = o.findWrapping(e);
if (i && (!t || t.length > i.length) && (t = i, n = o, !i.length)) break;
if (o.solid) break
}
if (!t) return !1;
this.sync(n);
for (let e = 0; e < t.length; e++) this.enterInner(t[e], null, !1);
return !0
}
insertNode(e) {
if (e.isInline && this.needsBlock && !this.top.type) {
let e = this.textblockFromContext();
e && this.enterInner(e)
}
if (this.findPlace(e)) {
this.closeExtra();
let t = this.top;
t.applyPending(e.type), t.match && (t.match = t.match.matchType(e.type));
let n = t.activeMarks;
for (let r = 0; r < e.marks.length; r++) t.type && !t.type.allowsMarkType(e.marks[r].type) || (n = e.marks[r].addToSet(n));
return t.content.push(e.mark(n)), !0
}
return !1
}
enter(e, t, n) {
let r = this.findPlace(e.create(t));
return r && this.enterInner(e, t, !0, n), r
}
enterInner(e, t = null, n = !1, r) {
this.closeExtra();
let o = this.top;
o.applyPending(e), o.match = o.match && o.match.matchType(e);
let i = ie(e, r, o.options);
4 & o.options && 0 == o.content.length && (i |= 4), this.nodes.push(new se(e, t, o.activeMarks, o.pendingMarks, n, null, i)), this.open++
}
closeExtra(e = !1) {
let t = this.nodes.length - 1;
if (t > this.open) {
for (; t > this.open; t--) this.nodes[t - 1].content.push(this.nodes[t].finish(e));
this.nodes.length = this.open + 1
}
}
finish() {
return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(this.isOpen || this.options.topOpen)
}
sync(e) {
for (let t = this.open; t >= 0; t--)
if (this.nodes[t] == e) return this.open = t, !0;
return !1
}
get currentPos() {
this.closeExtra();
let e = 0;
for (let t = this.open; t >= 0; t--) {
let n = this.nodes[t].content;
for (let t = n.length - 1; t >= 0; t--) e += n[t].nodeSize;
t && e++
}
return e
}
findAtPoint(e, t) {
if (this.find)
for (let n = 0; n < this.find.length; n++) this.find[n].node == e && this.find[n].offset == t && (this.find[n].pos = this.currentPos)
}
findInside(e) {
if (this.find)
for (let t = 0; t < this.find.length; t++) null == this.find[t].pos && 1 == e.nodeType && e.contains(this.find[t].node) && (this.find[t].pos = this.currentPos)
}
findAround(e, t, n) {
if (e != t && this.find)
for (let r = 0; r < this.find.length; r++)
if (null == this.find[r].pos && 1 == e.nodeType && e.contains(this.find[r].node)) {
t.compareDocumentPosition(this.find[r].node) & (n ? 2 : 4) && (this.find[r].pos = this.currentPos)
}
}
findInText(e) {
if (this.find)
for (let t = 0; t < this.find.length; t++) this.find[t].node == e && (this.find[t].pos = this.currentPos - (e.nodeValue.length - this.find[t].offset))
}
matchesContext(e) {
if (e.indexOf("|") > -1) return e.split(/\s*\|\s*/).some(this.matchesContext, this);
let t = e.split("/"),
n = this.options.context,
r = !(this.isOpen || n && n.parent.type != this.nodes[0].type),
o = -(n ? n.depth + 1 : 0) + (r ? 0 : 1),
i = (e, s) => {
for (; e >= 0; e--) {
let a = t[e];
if ("" == a) {
if (e == t.length - 1 || 0 == e) continue;
for (; s >= o; s--)
if (i(e - 1, s)) return !0;
return !1
} {
let e = s > 0 || 0 == s && r ? this.nodes[s].type : n && s >= o ? n.node(s - o).type : null;
if (!e || e.name != a && -1 == e.groups.indexOf(a)) return !1;
s--
}
}
return !0
};
return i(t.length - 1, this.open)
}
textblockFromContext() {
let e = this.options.context;
if (e)
for (let t = e.depth; t >= 0; t--) {
let n = e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;
if (n && n.isTextblock && n.defaultAttrs) return n
}
for (let e in this.parser.schema.nodes) {
let t = this.parser.schema.nodes[e];
if (t.isTextblock && t.defaultAttrs) return t
}
}
addPendingMark(e) {
let t = function(e, t) {
for (let n = 0; n < t.length; n++)
if (e.eq(t[n])) return t[n]
}(e, this.top.pendingMarks);
t && this.top.stashMarks.push(t), this.top.pendingMarks = e.addToSet(this.top.pendingMarks)
}
removePendingMark(e, t) {
for (let n = this.open; n >= 0; n--) {
let r = this.nodes[n];
if (r.pendingMarks.lastIndexOf(e) > -1) r.pendingMarks = e.removeFromSet(r.pendingMarks);
else {
r.activeMarks = e.removeFromSet(r.activeMarks);
let t = r.popFromStashMark(e);
t && r.type && r.type.allowsMarkType(t.type) && (r.activeMarks = t.addToSet(r.activeMarks))
}
if (r == t) break
}
}
}
function le(e, t) {
return (e.matches || e.msMatchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector).call(e, t)
}
function ce(e) {
let t = {};
for (let n in e) t[n] = e[n];
return t
}
function ue(e, t) {
let n = t.schema.nodes;
for (let r in n) {
let o = n[r];
if (!o.allowsMarkType(e)) continue;
let i = [],
s = e => {
i.push(e);
for (let n = 0; n < e.edgeCount; n++) {
let {
type: r,
next: o
} = e.edge(n);
if (r == t) return !0;
if (i.indexOf(o) < 0 && s(o)) return !0
}
};
if (s(o.contentMatch)) return !0
}
}
class de {
constructor(e, t) {
this.nodes = e, this.marks = t
}
serializeFragment(e, t = {}, n) {
n || (n = he(t).createDocumentFragment());
let r = n,
o = [];
return e.forEach((e => {
if (o.length || e.marks.length) {
let n = 0,
i = 0;
for (; n < o.length && i < e.marks.length;) {
let t = e.marks[i];
if (this.marks[t.type.name]) {
if (!t.eq(o[n][0]) || !1 === t.type.spec.spanning) break;
n++, i++
} else i++
}
for (; n < o.length;) r = o.pop()[1];
for (; i < e.marks.length;) {
let n = e.marks[i++],
s = this.serializeMark(n, e.isInline, t);
s && (o.push([n, r]), r.appendChild(s.dom), r = s.contentDOM || s.dom)
}
}
r.appendChild(this.serializeNodeInner(e, t))
})), n
}
serializeNodeInner(e, t) {
let {
dom: n,
contentDOM: r
} = de.renderSpec(he(t), this.nodes[e.type.name](e));
if (r) {
if (e.isLeaf) throw new RangeError("Content hole not allowed in a leaf node spec");
this.serializeFragment(e.content, t, r)
}
return n
}
serializeNode(e, t = {}) {
let n = this.serializeNodeInner(e, t);
for (let r = e.marks.length - 1; r >= 0; r--) {
let o = this.serializeMark(e.marks[r], e.isInline, t);
o && ((o.contentDOM || o.dom).appendChild(n), n = o.dom)
}
return n
}
serializeMark(e, t, n = {}) {
let r = this.marks[e.type.name];
return r && de.renderSpec(he(n), r(e, t))
}
static renderSpec(e, t, n = null) {
if ("string" == typeof t) return {
dom: e.createTextNode(t)
};
if (null != t.nodeType) return {
dom: t
};
if (t.dom && null != t.dom.nodeType) return t;
let r, o = t[0],
i = o.indexOf(" ");
i > 0 && (n = o.slice(0, i), o = o.slice(i + 1));
let s = n ? e.createElementNS(n, o) : e.createElement(o),
a = t[1],
l = 1;
if (a && "object" == typeof a && null == a.nodeType && !Array.isArray(a)) {
l = 2;
for (let e in a)
if (null != a[e]) {
let t = e.indexOf(" ");
t > 0 ? s.setAttributeNS(e.slice(0, t), e.slice(t + 1), a[e]) : s.setAttribute(e, a[e])
}
}
for (let o = l; o < t.length; o++) {
let i = t[o];
if (0 === i) {
if (o < t.length - 1 || o > l) throw new RangeError("Content hole must be the only child of its parent node");
return {
dom: s,
contentDOM: s
}
} {
let {
dom: t,
contentDOM: o
} = de.renderSpec(e, i, n);
if (s.appendChild(t), o) {
if (r) throw new RangeError("Multiple content holes");
r = o
}
}
}
return {
dom: s,
contentDOM: r
}
}
static fromSchema(e) {
return e.cached.domSerializer || (e.cached.domSerializer = new de(this.nodesFromSchema(e), this.marksFromSchema(e)))
}
static nodesFromSchema(e) {
let t = pe(e.nodes);
return t.text || (t.text = e => e.text), t
}
static marksFromSchema(e) {
return pe(e.marks)
}
}
function pe(e) {
let t = {};
for (let n in e) {
let r = e[n].spec.toDOM;
r && (t[n] = r)
}
return t
}
function he(e) {
return e.document || window.document
}
var fe = n(956),
me = n.n(fe),
ge = n(969),
ve = n.n(ge),
ye = n(522),
be = n.n(ye),
we = n(204),
ke = n.n(we),
xe = n(462),
Ce = n.n(xe),
Te = n(758),
Me = n.n(Te),
Se = n(321),
Ee = n.n(Se),
Ne = n(929),
Oe = n.n(Ne),
De = n(934),
Ae = n.n(De),
Le = n(391),
Ie = n.n(Le),
Re = (/Mac/.test(navigator.platform), /[\u0020]+/g),
Pe = /[>(){}[\]+-.!#|]/g,
Be = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g,
Fe = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g,
He = /[*_~`]/g,
ze = /!\[.*\]\(.*\)/g,
qe = /[[\]]/g,
Ve = /(?:^|[^\\])\\(?!\\)/g,
je = new RegExp('[&<>"]', "g");
function $e(e) {
switch (e) {
case "&":
return "&amp;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case '"':
return "&quot;";
default:
return e
}
}
function _e(e) {
return je.test(e) ? e.replace(je, $e) : e
}
function Ue(e, t) {
return -1 !== e.indexOf(t)
}
var We = ["rel", "target", "hreflang", "type"],
Je = {
codeblock: /(^ {4}[^\n]+\n*)+/,
thematicBreak: /^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,
atxHeading: /^(#{1,6}) +[\s\S]+/,
seTextheading: /^([^\n]+)\n *(=|-){2,} */,
blockquote: /^( *>[^\n]+.*)+/,
list: /^ *(\*+|-+|\d+\.) [\s\S]+/,
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,
link: /!?\[.*\]\(.*\)/,
reflink: /!?\[.*\]\s*\[([^\]]*)\]/,
verticalBar: /\u007C/,
fencedCodeblock: /^((`|~){3,})/
};
function Ge(e) {
if (!e) return null;
var t = {};
return We.forEach((function(n) {
Oe()(e[n]) || (t[n] = e[n])
})), t
}
function Ke(e, t) {
for (var n = "", r = 0; r < t; r += 1) n += e;
return n
}
function Ze(e) {
for (var t = [], n = ze.exec(e); n;) t.push([n.index, n.index + n[0].length]), n = ze.exec(e);
return e.replace(qe, (function(e, n) {
var r = t.some((function(e) {
return n > e[0] && n < e[1]
}));
return r ? e : "\\" + e
}))
}
function Xe(e) {
var t = function(e) {
return "\\" + e
},
n = e.replace(Re, " ");
return Fe.test(n) && (n = n.replace(Fe, t)), Ve.test(n) && (n = n.replace(Ve, (function(e) {
return e + "\\"
}))), n = n.replace(He, t), Be.test(n) && (n = n.replace(Be, t)),
function(e) {
var t = !1;
return me()(Je, (function(n) {
return n.test(e) && (t = !0), !t
})), t
}(n) && (n = n.replace(Pe, t)), n
}
function Qe(e) {
return Ae()(e) || Oe()(e)
}
function Ye(e, t) {
if (null === e && e === t) return !0;
if ("object" != typeof e || "object" != typeof t || Qe(e) || Qe(t)) return e === t;
for (var n in e)
if (e[n] !== t[n]) return !1;
for (var n in t)
if (!(n in e)) return !1;
return !0
}
function et(e) {
return e[e.length - 1]
}
function tt(e) {
return "object" == typeof e && null !== e
}
function nt(e, t) {
var n = o({}, e);
return e && t && Object.keys(t).forEach((function(e) {
tt(n[e]) ? Array.isArray(t[e]) ? n[e] = rt(t[e]) : n.hasOwnProperty(e) ? n[e] = nt(n[e], t[e]) : n[e] = ot(t[e]) : n[e] = t[e]
})), n
}
function rt(e) {
return e.map((function(e) {
return tt(e) ? Array.isArray(e) ? rt(e) : ot(e) : e
}))
}
function ot(e) {
var t = Object.keys(e);
return t.length ? t.reduce((function(t, n) {
return tt(e[n]) ? t[n] = Array.isArray(e[n]) ? rt(e[n]) : ot(e[n]) : t[n] = e[n], t
}), {}) : e
}
function it(e, t) {
return void 0 === t && (t = {}), Object.keys(t).forEach((function(n) {
e.hasOwnProperty(n) && "object" == typeof e[n] ? Array.isArray(t[n]) ? e[n] = t[n] : it(e[n], t[n]) : e[n] = t[n]
})), e
}
function st(e, t) {
return e > t ? [t, e] : [e, t]
}
const at = Math.pow(2, 16);
function lt(e, t) {
return e + t * at
}
function ct(e) {
return 65535 & e
}
class ut {
constructor(e, t, n) {
this.pos = e, this.delInfo = t, this.recover = n
}
get deleted() {
return (8 & this.delInfo) > 0
}
get deletedBefore() {
return (5 & this.delInfo) > 0
}
get deletedAfter() {
return (6 & this.delInfo) > 0
}
get deletedAcross() {
return (4 & this.delInfo) > 0
}
}
class dt {
constructor(e, t = !1) {
if (this.ranges = e, this.inverted = t, !e.length && dt.empty) return dt.empty
}
recover(e) {
let t = 0,
n = ct(e);
if (!this.inverted)
for (let e = 0; e < n; e++) t += this.ranges[3 * e + 2] - this.ranges[3 * e + 1];
return this.ranges[3 * n] + t + function(e) {
return (e - (65535 & e)) / at
}(e)
}
mapResult(e, t = 1) {
return this._map(e, t, !1)
}
map(e, t = 1) {
return this._map(e, t, !0)
}
_map(e, t, n) {
let r = 0,
o = this.inverted ? 2 : 1,
i = this.inverted ? 1 : 2;
for (let s = 0; s < this.ranges.length; s += 3) {
let a = this.ranges[s] - (this.inverted ? r : 0);
if (a > e) break;
let l = this.ranges[s + o],
c = this.ranges[s + i],
u = a + l;
if (e <= u) {
let o = a + r + ((l ? e == a ? -1 : e == u ? 1 : t : t) < 0 ? 0 : c);
if (n) return o;
let i = e == (t < 0 ? a : u) ? null : lt(s / 3, e - a),
d = e == a ? 2 : e == u ? 1 : 4;
return (t < 0 ? e != a : e != u) && (d |= 8), new ut(o, d, i)
}
r += c - l
}
return n ? e + r : new ut(e + r, 0, null)
}
touches(e, t) {
let n = 0,
r = ct(t),
o = this.inverted ? 2 : 1,
i = this.inverted ? 1 : 2;
for (let t = 0; t < this.ranges.length; t += 3) {
let s = this.ranges[t] - (this.inverted ? n : 0);
if (s > e) break;
let a = this.ranges[t + o];
if (e <= s + a && t == 3 * r) return !0;
n += this.ranges[t + i] - a
}
return !1
}
forEach(e) {
let t = this.inverted ? 2 : 1,
n = this.inverted ? 1 : 2;
for (let r = 0, o = 0; r < this.ranges.length; r += 3) {
let i = this.ranges[r],
s = i - (this.inverted ? o : 0),
a = i + (this.inverted ? 0 : o),
l = this.ranges[r + t],
c = this.ranges[r + n];
e(s, s + l, a, a + c), o += c - l
}
}
invert() {
return new dt(this.ranges, !this.inverted)
}
toString() {
return (this.inverted ? "-" : "") + JSON.stringify(this.ranges)
}
static offset(e) {
return 0 == e ? dt.empty : new dt(e < 0 ? [0, -e, 0] : [0, 0, e])
}
}
dt.empty = new dt([]);
class pt {
constructor(e = [], t, n = 0, r = e.length) {
this.maps = e, this.mirror = t, this.from = n, this.to = r
}
slice(e = 0, t = this.maps.length) {
return new pt(this.maps, this.mirror, e, t)
}
copy() {
return new pt(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to)
}
appendMap(e, t) {
this.to = this.maps.push(e), null != t && this.setMirror(this.maps.length - 1, t)
}
appendMapping(e) {
for (let t = 0, n = this.maps.length; t < e.maps.length; t++) {
let r = e.getMirror(t);
this.appendMap(e.maps[t], null != r && r < t ? n + r : void 0)
}
}
getMirror(e) {
if (this.mirror)
for (let t = 0; t < this.mirror.length; t++)
if (this.mirror[t] == e) return this.mirror[t + (t % 2 ? -1 : 1)]
}
setMirror(e, t) {
this.mirror || (this.mirror = []), this.mirror.push(e, t)
}
appendMappingInverted(e) {
for (let t = e.maps.length - 1, n = this.maps.length + e.maps.length; t >= 0; t--) {
let r = e.getMirror(t);
this.appendMap(e.maps[t].invert(), null != r && r > t ? n - r - 1 : void 0)
}
}
invert() {
let e = new pt;
return e.appendMappingInverted(this), e
}
map(e, t = 1) {
if (this.mirror) return this._map(e, t, !0);
for (let n = this.from; n < this.to; n++) e = this.maps[n].map(e, t);
return e
}
mapResult(e, t = 1) {
return this._map(e, t, !1)
}
_map(e, t, n) {
let r = 0;
for (let n = this.from; n < this.to; n++) {
let o = this.maps[n].mapResult(e, t);
if (null != o.recover) {
let t = this.getMirror(n);
if (null != t && t > n && t < this.to) {
n = t, e = this.maps[t].recover(o.recover);
continue
}
}
r |= o.delInfo, e = o.pos
}
return n ? e : new ut(e, r, null)
}
}
const ht = Object.create(null);
class ft {
getMap() {
return dt.empty
}
merge(e) {
return null
}
static fromJSON(e, t) {
if (!t || !t.stepType) throw new RangeError("Invalid input for Step.fromJSON");
let n = ht[t.stepType];
if (!n) throw new RangeError(`No step type ${t.stepType} defined`);
return n.fromJSON(e, t)
}
static jsonID(e, t) {
if (e in ht) throw new RangeError("Duplicate use of step JSON ID " + e);
return ht[e] = t, t.prototype.jsonID = e, t
}
}
class mt {
constructor(e, t) {
this.doc = e, this.failed = t
}
static ok(e) {
return new mt(e, null)
}
static fail(e) {
return new mt(null, e)
}
static fromReplace(e, t, n, r) {
try {
return mt.ok(e.replace(t, n, r))
} catch (e) {
if (e instanceof g) return mt.fail(e.message);
throw e
}
}
}
function gt(e, t, n) {
let r = [];
for (let o = 0; o < e.childCount; o++) {
let i = e.child(o);
i.content.size && (i = i.copy(gt(i.content, t, i))), i.isInline && (i = t(i, n, o)), r.push(i)
}
return d.fromArray(r)
}
class vt extends ft {
constructor(e, t, n) {
super(), this.from = e, this.to = t, this.mark = n
}
apply(e) {
let t = e.slice(this.from, this.to),
n = e.resolve(this.from),
r = n.node(n.sharedDepth(this.to)),
o = new v(gt(t.content, ((e, t) => e.isAtom && t.type.allowsMarkType(this.mark.type) ? e.mark(this.mark.addToSet(e.marks)) : e), r), t.openStart, t.openEnd);
return mt.fromReplace(e, this.from, this.to, o)
}
invert() {
return new yt(this.from, this.to, this.mark)
}
map(e) {
let t = e.mapResult(this.from, 1),
n = e.mapResult(this.to, -1);
return t.deleted && n.deleted || t.pos >= n.pos ? null : new vt(t.pos, n.pos, this.mark)
}
merge(e) {
return e instanceof vt && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new vt(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null
}
toJSON() {
return {
stepType: "addMark",
mark: this.mark.toJSON(),
from: this.from,
to: this.to
}
}
static fromJSON(e, t) {
if ("number" != typeof t.from || "number" != typeof t.to) throw new RangeError("Invalid input for AddMarkStep.fromJSON");
return new vt(t.from, t.to, e.markFromJSON(t.mark))
}
}
ft.jsonID("addMark", vt);
class yt extends ft {
constructor(e, t, n) {
super(), this.from = e, this.to = t, this.mark = n
}
apply(e) {
let t = e.slice(this.from, this.to),
n = new v(gt(t.content, (e => e.mark(this.mark.removeFromSet(e.marks))), e), t.openStart, t.openEnd);
return mt.fromReplace(e, this.from, this.to, n)
}
invert() {
return new vt(this.from, this.to, this.mark)
}
map(e) {
let t = e.mapResult(this.from, 1),
n = e.mapResult(this.to, -1);
return t.deleted && n.deleted || t.pos >= n.pos ? null : new yt(t.pos, n.pos, this.mark)
}
merge(e) {
return e instanceof yt && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new yt(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null
}
toJSON() {
return {
stepType: "removeMark",
mark: this.mark.toJSON(),
from: this.from,
to: this.to
}
}
static fromJSON(e, t) {
if ("number" != typeof t.from || "number" != typeof t.to) throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
return new yt(t.from, t.to, e.markFromJSON(t.mark))
}
}
ft.jsonID("removeMark", yt);
class bt extends ft {
constructor(e, t, n, r = !1) {
super(), this.from = e, this.to = t, this.slice = n, this.structure = r
}
apply(e) {
return this.structure && kt(e, this.from, this.to) ? mt.fail("Structure replace would overwrite content") : mt.fromReplace(e, this.from, this.to, this.slice)
}
getMap() {
return new dt([this.from, this.to - this.from, this.slice.size])
}
invert(e) {
return new bt(this.from, this.from + this.slice.size, e.slice(this.from, this.to))
}
map(e) {
let t = e.mapResult(this.from, 1),
n = e.mapResult(this.to, -1);
return t.deletedAcross && n.deletedAcross ? null : new bt(t.pos, Math.max(t.pos, n.pos), this.slice)
}
merge(e) {
if (!(e instanceof bt) || e.structure || this.structure) return null;
if (this.from + this.slice.size != e.from || this.slice.openEnd || e.slice.openStart) {
if (e.to != this.from || this.slice.openStart || e.slice.openEnd) return null;
{
let t = this.slice.size + e.slice.size == 0 ? v.empty : new v(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
return new bt(e.from, this.to, t, this.structure)
}
} {
let t = this.slice.size + e.slice.size == 0 ? v.empty : new v(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
return new bt(this.from, this.to + (e.to - e.from), t, this.structure)
}
}
toJSON() {
let e = {
stepType: "replace",
from: this.from,
to: this.to
};
return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e
}
static fromJSON(e, t) {
if ("number" != typeof t.from || "number" != typeof t.to) throw new RangeError("Invalid input for ReplaceStep.fromJSON");
return new bt(t.from, t.to, v.fromJSON(e, t.slice), !!t.structure)
}
}
ft.jsonID("replace", bt);
class wt extends ft {
constructor(e, t, n, r, o, i, s = !1) {
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = o, this.insert = i, this.structure = s
}
apply(e) {
if (this.structure && (kt(e, this.from, this.gapFrom) || kt(e, this.gapTo, this.to))) return mt.fail("Structure gap-replace would overwrite content");
let t = e.slice(this.gapFrom, this.gapTo);
if (t.openStart || t.openEnd) return mt.fail("Gap is not a flat range");
let n = this.slice.insertAt(this.insert, t.content);
return n ? mt.fromReplace(e, this.from, this.to, n) : mt.fail("Content does not fit in gap")
}
getMap() {
return new dt([this.from, this.gapFrom - this.from, this.insert, this.gapTo, this.to - this.gapTo, this.slice.size - this.insert])
}
invert(e) {
let t = this.gapTo - this.gapFrom;
return new wt(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure)
}
map(e) {
let t = e.mapResult(this.from, 1),
n = e.mapResult(this.to, -1),
r = e.map(this.gapFrom, -1),
o = e.map(this.gapTo, 1);
return t.deletedAcross && n.deletedAcross || r < t.pos || o > n.pos ? null : new wt(t.pos, n.pos, r, o, this.slice, this.insert, this.structure)
}
toJSON() {
let e = {
stepType: "replaceAround",
from: this.from,
to: this.to,
gapFrom: this.gapFrom,
gapTo: this.gapTo,
insert: this.insert
};
return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e
}
static fromJSON(e, t) {
if ("number" != typeof t.from || "number" != typeof t.to || "number" != typeof t.gapFrom || "number" != typeof t.gapTo || "number" != typeof t.insert) throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
return new wt(t.from, t.to, t.gapFrom, t.gapTo, v.fromJSON(e, t.slice), t.insert, !!t.structure)
}
}
function kt(e, t, n) {
let r = e.resolve(t),
o = n - t,
i = r.depth;
for (; o > 0 && i > 0 && r.indexAfter(i) == r.node(i).childCount;) i--, o--;
if (o > 0) {
let e = r.node(i).maybeChild(r.indexAfter(i));
for (; o > 0;) {
if (!e || e.isLeaf) return !0;
e = e.firstChild, o--
}
}
return !1
}
function xt(e, t, n) {
return (0 == t || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n))
}
function Ct(e) {
let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
for (let n = e.depth;; --n) {
let r = e.$from.node(n),
o = e.$from.index(n),
i = e.$to.indexAfter(n);
if (n < e.depth && r.canReplace(o, i, t)) return n;
if (0 == n || r.type.spec.isolating || !xt(r, o, i)) break
}
return null
}
function Tt(e) {
return {
type: e,
attrs: null
}
}
function Mt(e, t, n = 1, r) {
let o = e.resolve(t),
i = o.depth - n,
s = r && r[r.length - 1] || o.parent;
if (i < 0 || o.parent.type.spec.isolating || !o.parent.canReplace(o.index(), o.parent.childCount) || !s.type.validContent(o.parent.content.cutByIndex(o.index(), o.parent.childCount))) return !1;
for (let e = o.depth - 1, t = n - 2; e > i; e--, t--) {
let n = o.node(e),
i = o.index(e);
if (n.type.spec.isolating) return !1;
let s = n.content.cutByIndex(i, n.childCount),
a = r && r[t] || n;
if (a != n && (s = s.replaceChild(0, a.type.create(a.attrs))), !n.canReplace(i + 1, n.childCount) || !a.type.validContent(s)) return !1
}
let a = o.indexAfter(i),
l = r && r[0];
return o.node(i).canReplaceWith(a, a, l ? l.type : o.node(i + 1).type)
}
function St(e, t) {
let n = e.resolve(t),
r = n.index();
return Et(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1)
}
function Et(e, t) {
return !(!e || !t || e.isLeaf || !e.canAppend(t))
}
function Nt(e, t, n = t, r = v.empty) {
if (t == n && !r.size) return null;
let o = e.resolve(t),
i = e.resolve(n);
return Ot(o, i, r) ? new bt(t, n, r) : new Dt(o, i, r).fit()
}
function Ot(e, t, n) {
return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content)
}
ft.jsonID("replaceAround", wt);
class Dt {
constructor(e, t, n) {
this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = d.empty;
for (let t = 0; t <= e.depth; t++) {
let n = e.node(t);
this.frontier.push({
type: n.type,
match: n.contentMatchAt(e.indexAfter(t))
})
}
for (let t = e.depth; t > 0; t--) this.placed = d.from(e.node(t).copy(this.placed))
}
get depth() {
return this.frontier.length - 1
}
fit() {
for (; this.unplaced.size;) {
let e = this.findFittable();
e ? this.placeNodes(e) : this.openMore() || this.dropNode()
}
let e = this.mustMoveInline(),
t = this.placed.size - this.depth - this.$from.depth,
n = this.$from,
r = this.close(e < 0 ? this.$to : n.doc.resolve(e));
if (!r) return null;
let o = this.placed,
i = n.depth,
s = r.depth;
for (; i && s && 1 == o.childCount;) o = o.firstChild.content, i--, s--;
let a = new v(o, i, s);
return e > -1 ? new wt(n.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || n.pos != this.$to.pos ? new bt(n.pos, r.pos, a) : null
}
findFittable() {
for (let e = 1; e <= 2; e++)
for (let t = this.unplaced.openStart; t >= 0; t--) {
let n, r = null;
t ? (r = It(this.unplaced.content, t - 1).firstChild, n = r.content) : n = this.unplaced.content;
let o = n.firstChild;
for (let n = this.depth; n >= 0; n--) {
let i, {
type: s,
match: a
} = this.frontier[n],
l = null;
if (1 == e && (o ? a.matchType(o.type) || (l = a.fillBefore(d.from(o), !1)) : r && s.compatibleContent(r.type))) return {
sliceDepth: t,
frontierDepth: n,
parent: r,
inject: l
};
if (2 == e && o && (i = a.findWrapping(o.type))) return {
sliceDepth: t,
frontierDepth: n,
parent: r,
wrap: i
};
if (r && a.matchType(r.type)) break
}
}
}
openMore() {
let {
content: e,
openStart: t,
openEnd: n
} = this.unplaced, r = It(e, t);
return !(!r.childCount || r.firstChild.isLeaf) && (this.unplaced = new v(e, t + 1, Math.max(n, r.size + t >= e.size - n ? t + 1 : 0)), !0)
}
dropNode() {
let {
content: e,
openStart: t,
openEnd: n
} = this.unplaced, r = It(e, t);
if (r.childCount <= 1 && t > 0) {
let o = e.size - t <= t + r.size;
this.unplaced = new v(At(e, t - 1, 1), t - 1, o ? t - 1 : n)
} else this.unplaced = new v(At(e, t, 1), t, n)
}
placeNodes({
sliceDepth: e,
frontierDepth: t,
parent: n,
inject: r,
wrap: o
}) {
for (; this.depth > t;) this.closeFrontierNode();
if (o)
for (let e = 0; e < o.length; e++) this.openFrontierNode(o[e]);
let i = this.unplaced,
s = n ? n.content : i.content,
a = i.openStart - e,
l = 0,
c = [],
{
match: u,
type: p
} = this.frontier[t];
if (r) {
for (let e = 0; e < r.childCount; e++) c.push(r.child(e));
u = u.matchFragment(r)
}
let h = s.size + e - (i.content.size - i.openEnd);
for (; l < s.childCount;) {
let e = s.child(l),
t = u.matchType(e.type);
if (!t) break;
l++, (l > 1 || 0 == a || e.content.size) && (u = t, c.push(Rt(e.mark(p.allowedMarks(e.marks)), 1 == l ? a : 0, l == s.childCount ? h : -1)))
}
let f = l == s.childCount;
f || (h = -1), this.placed = Lt(this.placed, t, d.from(c)), this.frontier[t].match = u, f && h < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
for (let e = 0, t = s; e < h; e++) {
let e = t.lastChild;
this.frontier.push({
type: e.type,
match: e.contentMatchAt(e.childCount)
}), t = e.content
}
this.unplaced = f ? 0 == e ? v.empty : new v(At(i.content, e - 1, 1), e - 1, h < 0 ? i.openEnd : e - 1) : new v(At(i.content, e, l), i.openStart, i.openEnd)
}
mustMoveInline() {
if (!this.$to.parent.isTextblock) return -1;
let e, t = this.frontier[this.depth];
if (!t.type.isTextblock || !Pt(this.$to, this.$to.depth, t.type, t.match, !1) || this.$to.depth == this.depth && (e = this.findCloseLevel(this.$to)) && e.depth == this.depth) return -1;
let {
depth: n
} = this.$to, r = this.$to.after(n);
for (; n > 1 && r == this.$to.end(--n);) ++r;
return r
}
findCloseLevel(e) {
e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
let {
match: n,
type: r
} = this.frontier[t], o = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), i = Pt(e, t, r, n, o);
if (i) {
for (let n = t - 1; n >= 0; n--) {
let {
match: t,
type: r
} = this.frontier[n], o = Pt(e, n, r, t, !0);
if (!o || o.childCount) continue e
}
return {
depth: t,
fit: i,
move: o ? e.doc.resolve(e.after(t + 1)) : e
}
}
}
}
close(e) {
let t = this.findCloseLevel(e);
if (!t) return null;
for (; this.depth > t.depth;) this.closeFrontierNode();
t.fit.childCount && (this.placed = Lt(this.placed, t.depth, t.fit)), e = t.move;
for (let n = t.depth + 1; n <= e.depth; n++) {
let t = e.node(n),
r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
this.openFrontierNode(t.type, t.attrs, r)
}
return e
}
openFrontierNode(e, t = null, n) {
let r = this.frontier[this.depth];
r.match = r.match.matchType(e), this.placed = Lt(this.placed, this.depth, d.from(e.create(t, n))), this.frontier.push({
type: e,
match: e.contentMatch
})
}
closeFrontierNode() {
let e = this.frontier.pop().match.fillBefore(d.empty, !0);
e.childCount && (this.placed = Lt(this.placed, this.frontier.length, e))
}
}
function At(e, t, n) {
return 0 == t ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(At(e.firstChild.content, t - 1, n)))
}
function Lt(e, t, n) {
return 0 == t ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(Lt(e.lastChild.content, t - 1, n)))
}
function It(e, t) {
for (let n = 0; n < t; n++) e = e.firstChild.content;
return e
}
function Rt(e, t, n) {
if (t <= 0) return e;
let r = e.content;
return t > 1 && (r = r.replaceChild(0, Rt(r.firstChild, t - 1, 1 == r.childCount ? n - 1 : 0))), t > 0 && (r = e.type.contentMatch.fillBefore(r).append(r), n <= 0 && (r = r.append(e.type.contentMatch.matchFragment(r).fillBefore(d.empty, !0)))), e.copy(r)
}
function Pt(e, t, n, r, o) {
let i = e.node(t),
s = o ? e.indexAfter(t) : e.index(t);
if (s == i.childCount && !n.compatibleContent(i.type)) return null;
let a = r.fillBefore(i.content, !0, s);
return a && ! function(e, t, n) {
for (let r = n; r < t.childCount; r++)
if (!e.allowsMarks(t.child(r).marks)) return !0;
return !1
}(n, i.content, s) ? a : null
}
function Bt(e) {
return e.spec.defining || e.spec.definingForContent
}
function Ft(e, t, n, r, o) {
if (t < n) {
let o = e.firstChild;
e = e.replaceChild(0, o.copy(Ft(o.content, t + 1, n, r, o)))
}
if (t > r) {
let t = o.contentMatchAt(0),
n = t.fillBefore(e).append(e);
e = n.append(t.matchFragment(n).fillBefore(d.empty, !0))
}
return e
}
function Ht(e, t) {
let n = [];
for (let r = Math.min(e.depth, t.depth); r >= 0; r--) {
let o = e.start(r);
if (o < e.pos - (e.depth - r) || t.end(r) > t.pos + (t.depth - r) || e.node(r).type.spec.isolating || t.node(r).type.spec.isolating) break;
(o == t.start(r) || r == e.depth && r == t.depth && e.parent.inlineContent && t.parent.inlineContent && r && t.start(r - 1) == o - 1) && n.push(r)
}
return n
}
let zt = class extends Error {};
zt = function e(t) {
let n = Error.call(this, t);
return n.__proto__ = e.prototype, n
}, (zt.prototype = Object.create(Error.prototype)).constructor = zt, zt.prototype.name = "TransformError";
const qt = Object.create(null);
class Vt {
constructor(e, t, n) {
this.$anchor = e, this.$head = t, this.ranges = n || [new jt(e.min(t), e.max(t))]
}
get anchor() {
return this.$anchor.pos
}
get head() {
return this.$head.pos
}
get from() {
return this.$from.pos
}
get to() {
return this.$to.pos
}
get $from() {
return this.ranges[0].$from
}
get $to() {
return this.ranges[0].$to
}
get empty() {
let e = this.ranges;
for (let t = 0; t < e.length; t++)
if (e[t].$from.pos != e[t].$to.pos) return !1;
return !0
}
content() {
return this.$from.doc.slice(this.from, this.to, !0)
}
replace(e, t = v.empty) {
let n = t.content.lastChild,
r = null;
for (let e = 0; e < t.openEnd; e++) r = n, n = n.lastChild;
let o = e.steps.length,
i = this.ranges;
for (let s = 0; s < i.length; s++) {
let {
$from: a,
$to: l
} = i[s], c = e.mapping.slice(o);
e.replaceRange(c.map(a.pos), c.map(l.pos), s ? v.empty : t), 0 == s && Qt(e, o, (n ? n.isInline : r && r.isTextblock) ? -1 : 1)
}
}
replaceWith(e, t) {
let n = e.steps.length,
r = this.ranges;
for (let o = 0; o < r.length; o++) {
let {
$from: i,
$to: s
} = r[o], a = e.mapping.slice(n), l = a.map(i.pos), c = a.map(s.pos);
o ? e.deleteRange(l, c) : (e.replaceRangeWith(l, c, t), Qt(e, n, t.isInline ? -1 : 1))
}
}
static findFrom(e, t, n = !1) {
let r = e.parent.inlineContent ? new Ut(e) : Xt(e.node(0), e.parent, e.pos, e.index(), t, n);
if (r) return r;
for (let r = e.depth - 1; r >= 0; r--) {
let o = t < 0 ? Xt(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : Xt(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
if (o) return o
}
return null
}
static near(e, t = 1) {
return this.findFrom(e, t) || this.findFrom(e, -t) || new Kt(e.node(0))
}
static atStart(e) {
return Xt(e, e, 0, 0, 1) || new Kt(e)
}
static atEnd(e) {
return Xt(e, e, e.content.size, e.childCount, -1) || new Kt(e)
}
static fromJSON(e, t) {
if (!t || !t.type) throw new RangeError("Invalid input for Selection.fromJSON");
let n = qt[t.type];
if (!n) throw new RangeError(`No selection type ${t.type} defined`);
return n.fromJSON(e, t)
}
static jsonID(e, t) {
if (e in qt) throw new RangeError("Duplicate use of selection JSON ID " + e);
return qt[e] = t, t.prototype.jsonID = e, t
}
getBookmark() {
return Ut.between(this.$anchor, this.$head).getBookmark()
}
}
Vt.prototype.visible = !0;
class jt {
constructor(e, t) {
this.$from = e, this.$to = t
}
}
let $t = !1;
function _t(e) {
$t || e.parent.inlineContent || ($t = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"))
}
class Ut extends Vt {
constructor(e, t = e) {
_t(e), _t(t), super(e, t)
}
get $cursor() {
return this.$anchor.pos == this.$head.pos ? this.$head : null
}
map(e, t) {
let n = e.resolve(t.map(this.head));
if (!n.parent.inlineContent) return Vt.near(n);
let r = e.resolve(t.map(this.anchor));
return new Ut(r.parent.inlineContent ? r : n, n)
}
replace(e, t = v.empty) {
if (super.replace(e, t), t == v.empty) {
let t = this.$from.marksAcross(this.$to);
t && e.ensureMarks(t)
}
}
eq(e) {
return e instanceof Ut && e.anchor == this.anchor && e.head == this.head
}
getBookmark() {
return new Wt(this.anchor, this.head)
}
toJSON() {
return {
type: "text",
anchor: this.anchor,
head: this.head
}
}
static fromJSON(e, t) {
if ("number" != typeof t.anchor || "number" != typeof t.head) throw new RangeError("Invalid input for TextSelection.fromJSON");
return new Ut(e.resolve(t.anchor), e.resolve(t.head))
}
static create(e, t, n = t) {
let r = e.resolve(t);
return new this(r, n == t ? r : e.resolve(n))
}
static between(e, t, n) {
let r = e.pos - t.pos;
if (n && !r || (n = r >= 0 ? 1 : -1), !t.parent.inlineContent) {
let e = Vt.findFrom(t, n, !0) || Vt.findFrom(t, -n, !0);
if (!e) return Vt.near(t, n);
t = e.$head
}
return e.parent.inlineContent || (0 == r || (e = (Vt.findFrom(e, -n, !0) || Vt.findFrom(e, n, !0)).$anchor).pos < t.pos != r < 0) && (e = t), new Ut(e, t)
}
}
Vt.jsonID("text", Ut);
class Wt {
constructor(e, t) {
this.anchor = e, this.head = t
}
map(e) {
return new Wt(e.map(this.anchor), e.map(this.head))
}
resolve(e) {
return Ut.between(e.resolve(this.anchor), e.resolve(this.head))
}
}
class Jt extends Vt {
constructor(e) {
let t = e.nodeAfter,
n = e.node(0).resolve(e.pos + t.nodeSize);
super(e, n), this.node = t
}
map(e, t) {
let {
deleted: n,
pos: r
} = t.mapResult(this.anchor), o = e.resolve(r);
return n ? Vt.near(o) : new Jt(o)
}
content() {
return new v(d.from(this.node), 0, 0)
}
eq(e) {
return e instanceof Jt && e.anchor == this.anchor
}
toJSON() {
return {
type: "node",
anchor: this.anchor
}
}
getBookmark() {
return new Gt(this.anchor)
}
static fromJSON(e, t) {
if ("number" != typeof t.anchor) throw new RangeError("Invalid input for NodeSelection.fromJSON");
return new Jt(e.resolve(t.anchor))
}
static create(e, t) {
return new Jt(e.resolve(t))
}
static isSelectable(e) {
return !e.isText && !1 !== e.type.spec.selectable
}
}
Jt.prototype.visible = !1, Vt.jsonID("node", Jt);
class Gt {
constructor(e) {
this.anchor = e
}
map(e) {
let {
deleted: t,
pos: n
} = e.mapResult(this.anchor);
return t ? new Wt(n, n) : new Gt(n)
}
resolve(e) {
let t = e.resolve(this.anchor),
n = t.nodeAfter;
return n && Jt.isSelectable(n) ? new Jt(t) : Vt.near(t)
}
}
class Kt extends Vt {
constructor(e) {
super(e.resolve(0), e.resolve(e.content.size))
}
replace(e, t = v.empty) {
if (t == v.empty) {
e.delete(0, e.doc.content.size);
let t = Vt.atStart(e.doc);
t.eq(e.selection) || e.setSelection(t)
} else super.replace(e, t)
}
toJSON() {
return {
type: "all"
}
}
static fromJSON(e) {
return new Kt(e)
}
map(e) {
return new Kt(e)
}
eq(e) {
return e instanceof Kt
}
getBookmark() {
return Zt
}
}
Vt.jsonID("all", Kt);
const Zt = {
map() {
return this
},
resolve: e => new Kt(e)
};
function Xt(e, t, n, r, o, i = !1) {
if (t.inlineContent) return Ut.create(e, n);
for (let s = r - (o > 0 ? 0 : 1); o > 0 ? s < t.childCount : s >= 0; s += o) {
let r = t.child(s);
if (r.isAtom) {
if (!i && Jt.isSelectable(r)) return Jt.create(e, n - (o < 0 ? r.nodeSize : 0))
} else {
let t = Xt(e, r, n + o, o < 0 ? r.childCount : 0, o, i);
if (t) return t
}
n += r.nodeSize * o
}
return null
}
function Qt(e, t, n) {
let r = e.steps.length - 1;
if (r < t) return;
let o, i = e.steps[r];
(i instanceof bt || i instanceof wt) && (e.mapping.maps[r].forEach(((e, t, n, r) => {
null == o && (o = r)
})), e.setSelection(Vt.near(e.doc.resolve(o), n)))
}
class Yt extends class {
constructor(e) {
this.doc = e, this.steps = [], this.docs = [], this.mapping = new pt
}
get before() {
return this.docs.length ? this.docs[0] : this.doc
}
step(e) {
let t = this.maybeStep(e);
if (t.failed) throw new zt(t.failed);
return this
}
maybeStep(e) {
let t = e.apply(this.doc);
return t.failed || this.addStep(e, t.doc), t
}
get docChanged() {
return this.steps.length > 0
}
addStep(e, t) {
this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t
}
replace(e, t = e, n = v.empty) {
let r = Nt(this.doc, e, t, n);
return r && this.step(r), this
}
replaceWith(e, t, n) {
return this.replace(e, t, new v(d.from(n), 0, 0))
}
delete(e, t) {
return this.replace(e, t, v.empty)
}
insert(e, t) {
return this.replaceWith(e, e, t)
}
replaceRange(e, t, n) {
return function(e, t, n, r) {
if (!r.size) return e.deleteRange(t, n);
let o = e.doc.resolve(t),
i = e.doc.resolve(n);
if (Ot(o, i, r)) return e.step(new bt(t, n, r));
let s = Ht(o, e.doc.resolve(n));
0 == s[s.length - 1] && s.pop();
let a = -(o.depth + 1);
s.unshift(a);
for (let e = o.depth, t = o.pos - 1; e > 0; e--, t--) {
let n = o.node(e).type.spec;
if (n.defining || n.definingAsContext || n.isolating) break;
s.indexOf(e) > -1 ? a = e : o.before(e) == t && s.splice(1, 0, -e)
}
let l = s.indexOf(a),
c = [],
u = r.openStart;
for (let e = r.content, t = 0;; t++) {
let n = e.firstChild;
if (c.push(n), t == r.openStart) break;
e = n.content
}
for (let e = u - 1; e >= 0; e--) {
let t = c[e].type,
n = Bt(t);
if (n && o.node(l).type != t) u = e;
else if (n || !t.isTextblock) break
}
for (let t = r.openStart; t >= 0; t--) {
let a = (t + u + 1) % (r.openStart + 1),
d = c[a];
if (d)
for (let t = 0; t < s.length; t++) {
let c = s[(t + l) % s.length],
u = !0;
c < 0 && (u = !1, c = -c);
let p = o.node(c - 1),
h = o.index(c - 1);
if (p.canReplaceWith(h, h, d.type, d.marks)) return e.replace(o.before(c), u ? i.after(c) : n, new v(Ft(r.content, 0, r.openStart, a), a, r.openEnd))
}
}
let d = e.steps.length;
for (let a = s.length - 1; a >= 0 && (e.replace(t, n, r), !(e.steps.length > d)); a--) {
let e = s[a];
e < 0 || (t = o.before(e), n = i.after(e))
}
}(this, e, t, n), this
}
replaceRangeWith(e, t, n) {
return function(e, t, n, r) {
if (!r.isInline && t == n && e.doc.resolve(t).parent.content.size) {
let o = function(e, t, n) {
let r = e.resolve(t);
if (r.parent.canReplaceWith(r.index(), r.index(), n)) return t;
if (0 == r.parentOffset)
for (let e = r.depth - 1; e >= 0; e--) {
let t = r.index(e);
if (r.node(e).canReplaceWith(t, t, n)) return r.before(e + 1);
if (t > 0) return null
}
if (r.parentOffset == r.parent.content.size)
for (let e = r.depth - 1; e >= 0; e--) {
let t = r.indexAfter(e);
if (r.node(e).canReplaceWith(t, t, n)) return r.after(e + 1);
if (t < r.node(e).childCount) return null
}
return null
}(e.doc, t, r.type);
null != o && (t = n = o)
}
e.replaceRange(t, n, new v(d.from(r), 0, 0))
}(this, e, t, n), this
}
deleteRange(e, t) {
return function(e, t, n) {
let r = e.doc.resolve(t),
o = e.doc.resolve(n),
i = Ht(r, o);
for (let t = 0; t < i.length; t++) {
let n = i[t],
s = t == i.length - 1;
if (s && 0 == n || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), o.end(n));
if (n > 0 && (s || r.node(n - 1).canReplace(r.index(n - 1), o.indexAfter(n - 1)))) return e.delete(r.before(n), o.after(n))
}
for (let i = 1; i <= r.depth && i <= o.depth; i++)
if (t - r.start(i) == r.depth - i && n > r.end(i) && o.end(i) - n != o.depth - i) return e.delete(r.before(i), n);
e.delete(t, n)
}(this, e, t), this
}
lift(e, t) {
return function(e, t, n) {
let {
$from: r,
$to: o,
depth: i
} = t, s = r.before(i + 1), a = o.after(i + 1), l = s, c = a, u = d.empty, p = 0;
for (let e = i, t = !1; e > n; e--) t || r.index(e) > 0 ? (t = !0, u = d.from(r.node(e).copy(u)), p++) : l--;
let h = d.empty,
f = 0;
for (let e = i, t = !1; e > n; e--) t || o.after(e + 1) < o.end(e) ? (t = !0, h = d.from(o.node(e).copy(h)), f++) : c++;
e.step(new wt(l, c, s, a, new v(u.append(h), p, f), u.size - p, !0))
}(this, e, t), this
}
join(e, t = 1) {
return function(e, t, n) {
let r = new bt(t - n, t + n, v.empty, !0);
e.step(r)
}(this, e, t), this
}
wrap(e, t) {
return function(e, t, n) {
let r = d.empty;
for (let e = n.length - 1; e >= 0; e--) {
if (r.size) {
let t = n[e].type.contentMatch.matchFragment(r);
if (!t || !t.validEnd) throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")
}
r = d.from(n[e].type.create(n[e].attrs, r))
}
let o = t.start,
i = t.end;
e.step(new wt(o, i, o, i, new v(r, 0, 0), n.length, !0))
}(this, e, t), this
}
setBlockType(e, t = e, n, r = null) {
return function(e, t, n, r, o) {
if (!r.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock");
let i = e.steps.length;
e.doc.nodesBetween(t, n, ((t, n) => {
if (t.isTextblock && !t.hasMarkup(r, o) && function(e, t, n) {
let r = e.resolve(t),
o = r.index();
return r.parent.canReplaceWith(o, o + 1, n)
}(e.doc, e.mapping.slice(i).map(n), r)) {
e.clearIncompatible(e.mapping.slice(i).map(n, 1), r);
let s = e.mapping.slice(i),
a = s.map(n, 1),
l = s.map(n + t.nodeSize, 1);
return e.step(new wt(a, l, a + 1, l - 1, new v(d.from(r.create(o, null, t.marks)), 0, 0), 1, !0)), !1
}
}))
}(this, e, t, n, r), this
}
setNodeMarkup(e, t, n = null, r = []) {
return function(e, t, n, r, o) {
let i = e.doc.nodeAt(t);
if (!i) throw new RangeError("No node at given position");
n || (n = i.type);
let s = n.create(r, null, o || i.marks);
if (i.isLeaf) return e.replaceWith(t, t + i.nodeSize, s);
if (!n.validContent(i.content)) throw new RangeError("Invalid content for node type " + n.name);
e.step(new wt(t, t + i.nodeSize, t + 1, t + i.nodeSize - 1, new v(d.from(s), 0, 0), 1, !0))
}(this, e, t, n, r), this
}
split(e, t = 1, n) {
return function(e, t, n = 1, r) {
let o = e.doc.resolve(t),
i = d.empty,
s = d.empty;
for (let e = o.depth, t = o.depth - n, a = n - 1; e > t; e--, a--) {
i = d.from(o.node(e).copy(i));
let t = r && r[a];
s = d.from(t ? t.type.create(t.attrs, s) : o.node(e).copy(s))
}
e.step(new bt(t, t, new v(i.append(s), n, n), !0))
}(this, e, t, n), this
}
addMark(e, t, n) {
return function(e, t, n, r) {
let o, i, s = [],
a = [];
e.doc.nodesBetween(t, n, ((e, l, c) => {
if (!e.isInline) return;
let u = e.marks;
if (!r.isInSet(u) && c.type.allowsMarkType(r.type)) {
let c = Math.max(l, t),
d = Math.min(l + e.nodeSize, n),
p = r.addToSet(u);
for (let e = 0; e < u.length; e++) u[e].isInSet(p) || (o && o.to == c && o.mark.eq(u[e]) ? o.to = d : s.push(o = new yt(c, d, u[e])));
i && i.to == c ? i.to = d : a.push(i = new vt(c, d, r))
}
})), s.forEach((t => e.step(t))), a.forEach((t => e.step(t)))
}(this, e, t, n), this
}
removeMark(e, t, n) {
return function(e, t, n, r) {
let o = [],
i = 0;
e.doc.nodesBetween(t, n, ((e, s) => {
if (!e.isInline) return;
i++;
let a = null;
if (r instanceof Q) {
let t, n = e.marks;
for (; t = r.isInSet(n);)(a || (a = [])).push(t), n = t.removeFromSet(n)
} else r ? r.isInSet(e.marks) && (a = [r]) : a = e.marks;
if (a && a.length) {
let r = Math.min(s + e.nodeSize, n);
for (let e = 0; e < a.length; e++) {
let n, l = a[e];
for (let e = 0; e < o.length; e++) {
let t = o[e];
t.step == i - 1 && l.eq(o[e].style) && (n = t)
}
n ? (n.to = r, n.step = i) : o.push({
style: l,
from: Math.max(s, t),
to: r,
step: i
})
}
}
})), o.forEach((t => e.step(new yt(t.from, t.to, t.style))))
}(this, e, t, n), this
}
clearIncompatible(e, t, n) {
return function(e, t, n, r = n.contentMatch) {
let o = e.doc.nodeAt(t),
i = [],
s = t + 1;
for (let t = 0; t < o.childCount; t++) {
let a = o.child(t),
l = s + a.nodeSize,
c = r.matchType(a.type);
if (c) {
r = c;
for (let t = 0; t < a.marks.length; t++) n.allowsMarkType(a.marks[t].type) || e.step(new yt(s, l, a.marks[t]))
} else i.push(new bt(s, l, v.empty));
s = l
}
if (!r.validEnd) {
let t = r.fillBefore(d.empty, !0);
e.replace(s, s, new v(t, 0, 0))
}
for (let t = i.length - 1; t >= 0; t--) e.step(i[t])
}(this, e, t, n), this
}
} {
constructor(e) {
super(e.doc), this.curSelectionFor = 0, this.updated = 0, this.meta = Object.create(null), this.time = Date.now(), this.curSelection = e.selection, this.storedMarks = e.storedMarks
}
get selection() {
return this.curSelectionFor < this.steps.length && (this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor)), this.curSelectionFor = this.steps.length), this.curSelection
}
setSelection(e) {
if (e.$from.doc != this.doc) throw new RangeError("Selection passed to setSelection must point at the current document");
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = -3 & (1 | this.updated), this.storedMarks = null, this
}
get selectionSet() {
return (1 & this.updated) > 0
}
setStoredMarks(e) {
return this.storedMarks = e, this.updated |= 2, this
}
ensureMarks(e) {
return m.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this
}
addStoredMark(e) {
return this.ensureMarks(e.addToSet(this.storedMarks || this.selection.$head.marks()))
}
removeStoredMark(e) {
return this.ensureMarks(e.removeFromSet(this.storedMarks || this.selection.$head.marks()))
}
get storedMarksSet() {
return (2 & this.updated) > 0
}
addStep(e, t) {
super.addStep(e, t), this.updated = -3 & this.updated, this.storedMarks = null
}
setTime(e) {
return this.time = e, this
}
replaceSelection(e) {
return this.selection.replace(this, e), this
}
replaceSelectionWith(e, t = !0) {
let n = this.selection;
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) || m.none))), n.replaceWith(this, e), this
}
deleteSelection() {
return this.selection.replace(this), this
}
insertText(e, t, n) {
let r = this.doc.type.schema;
if (null == t) return e ? this.replaceSelectionWith(r.text(e), !0) : this.deleteSelection();
{
if (null == n && (n = t), n = null == n ? t : n, !e) return this.deleteRange(t, n);
let o = this.storedMarks;
if (!o) {
let e = this.doc.resolve(t);
o = n == t ? e.marks() : e.marksAcross(this.doc.resolve(n))
}
return this.replaceRangeWith(t, n, r.text(e, o)), this.selection.empty || this.setSelection(Vt.near(this.selection.$to)), this
}
}
setMeta(e, t) {
return this.meta["string" == typeof e ? e : e.key] = t, this
}
getMeta(e) {
return this.meta["string" == typeof e ? e : e.key]
}
get isGeneric() {
for (let e in this.meta) return !1;
return !0
}
scrollIntoView() {
return this.updated |= 4, this
}
get scrolledIntoView() {
return (4 & this.updated) > 0
}
}
function en(e, t) {
return t && e ? e.bind(t) : e
}
class tn {
constructor(e, t, n) {
this.name = e, this.init = en(t.init, n), this.apply = en(t.apply, n)
}
}
const nn = [new tn("doc", {
init: e => e.doc || e.schema.topNodeType.createAndFill(),
apply: e => e.doc
}), new tn("selection", {
init: (e, t) => e.selection || Vt.atStart(t.doc),
apply: e => e.selection
}), new tn("storedMarks", {
init: e => e.storedMarks || null,
apply: (e, t, n, r) => r.selection.$cursor ? e.storedMarks : null
}), new tn("scrollToSelection", {
init: () => 0,
apply: (e, t) => e.scrolledIntoView ? t + 1 : t
})];
class rn {
constructor(e, t) {
this.schema = e, this.plugins = [], this.pluginsByKey = Object.create(null), this.fields = nn.slice(), t && t.forEach((e => {
if (this.pluginsByKey[e.key]) throw new RangeError("Adding different instances of a keyed plugin (" + e.key + ")");
this.plugins.push(e), this.pluginsByKey[e.key] = e, e.spec.state && this.fields.push(new tn(e.key, e.spec.state, e))
}))
}
}
class on {
constructor(e) {
this.config = e
}
get schema() {
return this.config.schema
}
get plugins() {
return this.config.plugins
}
apply(e) {
return this.applyTransaction(e).state
}
filterTransaction(e, t = -1) {
for (let n = 0; n < this.config.plugins.length; n++)
if (n != t) {
let t = this.config.plugins[n];
if (t.spec.filterTransaction && !t.spec.filterTransaction.call(t, e, this)) return !1
} return !0
}
applyTransaction(e) {
if (!this.filterTransaction(e)) return {
state: this,
transactions: []
};
let t = [e],
n = this.applyInner(e),
r = null;
for (;;) {
let o = !1;
for (let i = 0; i < this.config.plugins.length; i++) {
let s = this.config.plugins[i];
if (s.spec.appendTransaction) {
let a = r ? r[i].n : 0,
l = r ? r[i].state : this,
c = a < t.length && s.spec.appendTransaction.call(s, a ? t.slice(a) : t, l, n);
if (c && n.filterTransaction(c, i)) {
if (c.setMeta("appendedTransaction", e), !r) {
r = [];
for (let e = 0; e < this.config.plugins.length; e++) r.push(e < i ? {
state: n,
n: t.length
} : {
state: this,
n: 0
})
}
t.push(c), n = n.applyInner(c), o = !0
}
r && (r[i] = {
state: n,
n: t.length
})
}
}
if (!o) return {
state: n,
transactions: t
}
}
}
applyInner(e) {
if (!e.before.eq(this.doc)) throw new RangeError("Applying a mismatched transaction");
let t = new on(this.config),
n = this.config.fields;
for (let r = 0; r < n.length; r++) {
let o = n[r];
t[o.name] = o.apply(e, this[o.name], this, t)
}
return t
}
get tr() {
return new Yt(this)
}
static create(e) {
let t = new rn(e.doc ? e.doc.type.schema : e.schema, e.plugins),
n = new on(t);
for (let r = 0; r < t.fields.length; r++) n[t.fields[r].name] = t.fields[r].init(e, n);
return n
}
reconfigure(e) {
let t = new rn(this.schema, e.plugins),
n = t.fields,
r = new on(t);
for (let t = 0; t < n.length; t++) {
let o = n[t].name;
r[o] = this.hasOwnProperty(o) ? this[o] : n[t].init(e, r)
}
return r
}
toJSON(e) {
let t = {
doc: this.doc.toJSON(),
selection: this.selection.toJSON()
};
if (this.storedMarks && (t.storedMarks = this.storedMarks.map((e => e.toJSON()))), e && "object" == typeof e)
for (let n in e) {
if ("doc" == n || "selection" == n) throw new RangeError("The JSON fields `doc` and `selection` are reserved");
let r = e[n],
o = r.spec.state;
o && o.toJSON && (t[n] = o.toJSON.call(r, this[r.key]))
}
return t
}
static fromJSON(e, t, n) {
if (!t) throw new RangeError("Invalid input for EditorState.fromJSON");
if (!e.schema) throw new RangeError("Required config field 'schema' missing");
let r = new rn(e.schema, e.plugins),
o = new on(r);
return r.fields.forEach((r => {
if ("doc" == r.name) o.doc = P.fromJSON(e.schema, t.doc);
else if ("selection" == r.name) o.selection = Vt.fromJSON(o.doc, t.selection);
else if ("storedMarks" == r.name) t.storedMarks && (o.storedMarks = t.storedMarks.map(e.schema.markFromJSON));
else {
if (n)
for (let i in n) {
let s = n[i],
a = s.spec.state;
if (s.key == r.name && a && a.fromJSON && Object.prototype.hasOwnProperty.call(t, i)) return void(o[r.name] = a.fromJSON.call(s, e, t[i], o))
}
o[r.name] = r.init(e, o)
}
})), o
}
}
function sn(e, t, n) {
for (let r in e) {
let o = e[r];
o instanceof Function ? o = o.bind(t) : "handleDOMEvents" == r && (o = sn(o, t, {})), n[r] = o
}
return n
}
class an {
constructor(e) {
this.spec = e, this.props = {}, e.props && sn(e.props, this, this.props), this.key = e.key ? e.key.key : cn("plugin")
}
getState(e) {
return e[this.key]
}
}
const ln = Object.create(null);
function cn(e) {
return e in ln ? e + "$" + ++ln[e] : (ln[e] = 0, e + "$")
}
class un {
constructor(e = "key") {
this.key = cn(e)
}
get(e) {
return e.config.pluginsByKey[this.key]
}
getState(e) {
return e[this.key]
}
}
const dn = "undefined" != typeof navigator ? navigator : null,
pn = "undefined" != typeof document ? document : null,
hn = dn && dn.userAgent || "",
fn = /Edge\/(\d+)/.exec(hn),
mn = /MSIE \d/.exec(hn),
gn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hn),
vn = !!(mn || gn || fn),
yn = mn ? document.documentMode : gn ? +gn[1] : fn ? +fn[1] : 0,
bn = !vn && /gecko\/(\d+)/i.test(hn);
bn && (/Firefox\/(\d+)/.exec(hn) || [0, 0])[1];
const wn = !vn && /Chrome\/(\d+)/.exec(hn),
kn = !!wn,
xn = wn ? +wn[1] : 0,
Cn = !vn && !!dn && /Apple Computer/.test(dn.vendor),
Tn = Cn && (/Mobile\/\w+/.test(hn) || !!dn && dn.maxTouchPoints > 2),
Mn = Tn || !!dn && /Mac/.test(dn.platform),
Sn = /Android \d/.test(hn),
En = !!pn && "webkitFontSmoothing" in pn.documentElement.style,
Nn = En ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0,
On = function(e) {
for (var t = 0;; t++)
if (!(e = e.previousSibling)) return t
},
Dn = function(e) {
let t = e.assignedSlot || e.parentNode;
return t && 11 == t.nodeType ? t.host : t
};
let An = null;
const Ln = function(e, t, n) {
let r = An || (An = document.createRange());
return r.setEnd(e, null == n ? e.nodeValue.length : n), r.setStart(e, t || 0), r
},
In = function(e, t, n, r) {
return n && (Pn(e, t, n, r, -1) || Pn(e, t, n, r, 1))
},
Rn = /^(img|br|input|textarea|hr)$/i;
function Pn(e, t, n, r, o) {
for (;;) {
if (e == n && t == r) return !0;
if (t == (o < 0 ? 0 : Bn(e))) {
let n = e.parentNode;
if (!n || 1 != n.nodeType || Fn(e) || Rn.test(e.nodeName) || "false" == e.contentEditable) return !1;
t = On(e) + (o < 0 ? 0 : 1), e = n
} else {
if (1 != e.nodeType) return !1;
if ("false" == (e = e.childNodes[t + (o < 0 ? -1 : 0)]).contentEditable) return !1;
t = o < 0 ? Bn(e) : 0
}
}
}
function Bn(e) {
return 3 == e.nodeType ? e.nodeValue.length : e.childNodes.length
}
function Fn(e) {
let t;
for (let n = e; n && !(t = n.pmViewDesc); n = n.parentNode);
return t && t.node && t.node.isBlock && (t.dom == e || t.contentDOM == e)
}
const Hn = function(e) {
let t = e.isCollapsed;
return t && kn && e.rangeCount && !e.getRangeAt(0).collapsed && (t = !1), t
};
function zn(e, t) {
let n = document.createEvent("Event");
return n.initEvent("keydown", !0, !0), n.keyCode = e, n.key = n.code = t, n
}
function qn(e) {
return {
left: 0,
right: e.documentElement.clientWidth,
top: 0,
bottom: e.documentElement.clientHeight
}
}
function Vn(e, t) {
return "number" == typeof e ? e : e[t]
}
function jn(e) {
let t = e.getBoundingClientRect(),
n = t.width / e.offsetWidth || 1,
r = t.height / e.offsetHeight || 1;
return {
left: t.left,
right: t.left + e.clientWidth * n,
top: t.top,
bottom: t.top + e.clientHeight * r
}
}
function $n(e, t, n) {
let r = e.someProp("scrollThreshold") || 0,
o = e.someProp("scrollMargin") || 5,
i = e.dom.ownerDocument;
for (let s = n || e.dom; s; s = Dn(s)) {
if (1 != s.nodeType) continue;
let e = s,
n = e == i.body,
a = n ? qn(i) : jn(e),
l = 0,
c = 0;
if (t.top < a.top + Vn(r, "top") ? c = -(a.top - t.top + Vn(o, "top")) : t.bottom > a.bottom - Vn(r, "bottom") && (c = t.bottom - a.bottom + Vn(o, "bottom")), t.left < a.left + Vn(r, "left") ? l = -(a.left - t.left + Vn(o, "left")) : t.right > a.right - Vn(r, "right") && (l = t.right - a.right + Vn(o, "right")), l || c)
if (n) i.defaultView.scrollBy(l, c);
else {
let n = e.scrollLeft,
r = e.scrollTop;
c && (e.scrollTop += c), l && (e.scrollLeft += l);
let o = e.scrollLeft - n,
i = e.scrollTop - r;
t = {
left: t.left - o,
top: t.top - i,
right: t.right - o,
bottom: t.bottom - i
}
} if (n) break
}
}
function _n(e) {
let t = [],
n = e.ownerDocument;
for (let r = e; r && (t.push({
dom: r,
top: r.scrollTop,
left: r.scrollLeft
}), e != n); r = Dn(r));
return t
}
function Un(e, t) {
for (let n = 0; n < e.length; n++) {
let {
dom: r,
top: o,
left: i
} = e[n];
r.scrollTop != o + t && (r.scrollTop = o + t), r.scrollLeft != i && (r.scrollLeft = i)
}
}
let Wn = null;
function Jn(e, t) {
let n, r, o = 2e8,
i = 0,
s = t.top,
a = t.top;
for (let l = e.firstChild, c = 0; l; l = l.nextSibling, c++) {
let e;
if (1 == l.nodeType) e = l.getClientRects();
else {
if (3 != l.nodeType) continue;
e = Ln(l).getClientRects()
}
for (let u = 0; u < e.length; u++) {
let d = e[u];
if (d.top <= s && d.bottom >= a) {
s = Math.max(d.bottom, s), a = Math.min(d.top, a);
let e = d.left > t.left ? d.left - t.left : d.right < t.left ? t.left - d.right : 0;
if (e < o) {
n = l, o = e, r = e && 3 == n.nodeType ? {
left: d.right < t.left ? d.right : d.left,
top: t.top
} : t, 1 == l.nodeType && e && (i = c + (t.left >= (d.left + d.right) / 2 ? 1 : 0));
continue
}
}!n && (t.left >= d.right && t.top >= d.top || t.left >= d.left && t.top >= d.bottom) && (i = c + 1)
}
}
return n && 3 == n.nodeType ? function(e, t) {
let n = e.nodeValue.length,
r = document.createRange();
for (let o = 0; o < n; o++) {
r.setEnd(e, o + 1), r.setStart(e, o);
let n = Xn(r, 1);
if (n.top != n.bottom && Gn(t, n)) return {
node: e,
offset: o + (t.left >= (n.left + n.right) / 2 ? 1 : 0)
}
}
return {
node: e,
offset: 0
}
}(n, r) : !n || o && 1 == n.nodeType ? {
node: e,
offset: i
} : Jn(n, r)
}
function Gn(e, t) {
return e.left >= t.left - 1 && e.left <= t.right + 1 && e.top >= t.top - 1 && e.top <= t.bottom + 1
}
function Kn(e, t, n) {
let r = e.childNodes.length;
if (r && n.top < n.bottom)
for (let o = Math.max(0, Math.min(r - 1, Math.floor(r * (t.top - n.top) / (n.bottom - n.top)) - 2)), i = o;;) {
let n = e.childNodes[i];
if (1 == n.nodeType) {
let e = n.getClientRects();
for (let r = 0; r < e.length; r++) {
let o = e[r];
if (Gn(t, o)) return Kn(n, t, o)
}
}
if ((i = (i + 1) % r) == o) break
}
return e
}
function Zn(e, t) {
let n, r = e.dom.ownerDocument,
o = 0;
if (r.caretPositionFromPoint) try {
let e = r.caretPositionFromPoint(t.left, t.top);
e && ({
offsetNode: n,
offset: o
} = e)
} catch (e) {}
if (!n && r.caretRangeFromPoint) {
let e = r.caretRangeFromPoint(t.left, t.top);
e && ({
startContainer: n,
startOffset: o
} = e)
}
let i, s = (e.root.elementFromPoint ? e.root : r).elementFromPoint(t.left, t.top);
if (!s || !e.dom.contains(1 != s.nodeType ? s.parentNode : s)) {
let n = e.dom.getBoundingClientRect();
if (!Gn(t, n)) return null;
if (s = Kn(e.dom, t, n), !s) return null
}
if (Cn)
for (let e = s; n && e; e = Dn(e)) e.draggable && (n = void 0);
if (s = function(e, t) {
let n = e.parentNode;
return n && /^li$/i.test(n.nodeName) && t.left < e.getBoundingClientRect().left ? n : e
}(s, t), n) {
if (bn && 1 == n.nodeType && (o = Math.min(o, n.childNodes.length), o < n.childNodes.length)) {
let e, r = n.childNodes[o];
"IMG" == r.nodeName && (e = r.getBoundingClientRect()).right <= t.left && e.bottom > t.top && o++
}
n == e.dom && o == n.childNodes.length - 1 && 1 == n.lastChild.nodeType && t.top > n.lastChild.getBoundingClientRect().bottom ? i = e.state.doc.content.size : 0 != o && 1 == n.nodeType && "BR" == n.childNodes[o - 1].nodeName || (i = function(e, t, n, r) {
let o = -1;
for (let n = t; n != e.dom;) {
let t = e.docView.nearestDesc(n, !0);
if (!t) return null;
if (t.node.isBlock && t.parent) {
let e = t.dom.getBoundingClientRect();
if (e.left > r.left || e.top > r.top) o = t.posBefore;
else {
if (!(e.right < r.left || e.bottom < r.top)) break;
o = t.posAfter
}
}
n = t.dom.parentNode
}
return o > -1 ? o : e.docView.posFromDOM(t, n, 1)
}(e, n, o, t))
}
null == i && (i = function(e, t, n) {
let {
node: r,
offset: o
} = Jn(t, n), i = -1;
if (1 == r.nodeType && !r.firstChild) {
let e = r.getBoundingClientRect();
i = e.left != e.right && n.left > (e.left + e.right) / 2 ? 1 : -1
}
return e.docView.posFromDOM(r, o, i)
}(e, s, t));
let a = e.docView.nearestDesc(s, !0);
return {
pos: i,
inside: a ? a.posAtStart - a.border : -1
}
}
function Xn(e, t) {
let n = e.getClientRects();
return n.length ? n[t < 0 ? 0 : n.length - 1] : e.getBoundingClientRect()
}
const Qn = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
function Yn(e, t, n) {
let {
node: r,
offset: o,
atom: i
} = e.docView.domFromPos(t, n < 0 ? -1 : 1), s = En || bn;
if (3 == r.nodeType) {
if (!s || !Qn.test(r.nodeValue) && (n < 0 ? o : o != r.nodeValue.length)) {
let e = o,
t = o,
i = n < 0 ? 1 : -1;
return n < 0 && !o ? (t++, i = -1) : n >= 0 && o == r.nodeValue.length ? (e--, i = 1) : n < 0 ? e-- : t++, er(Xn(Ln(r, e, t), i), i < 0)
} {
let e = Xn(Ln(r, o, o), n);
if (bn && o && /\s/.test(r.nodeValue[o - 1]) && o < r.nodeValue.length) {
let t = Xn(Ln(r, o - 1, o - 1), -1);
if (t.top == e.top) {
let n = Xn(Ln(r, o, o + 1), -1);
if (n.top != e.top) return er(n, n.left < t.left)
}
}
return e
}
}
if (!e.state.doc.resolve(t - (i || 0)).parent.inlineContent) {
if (null == i && o && (n < 0 || o == Bn(r))) {
let e = r.childNodes[o - 1];
if (1 == e.nodeType) return tr(e.getBoundingClientRect(), !1)
}
if (null == i && o < Bn(r)) {
let e = r.childNodes[o];
if (1 == e.nodeType) return tr(e.getBoundingClientRect(), !0)
}
return tr(r.getBoundingClientRect(), n >= 0)
}
if (null == i && o && (n < 0 || o == Bn(r))) {
let e = r.childNodes[o - 1],
t = 3 == e.nodeType ? Ln(e, Bn(e) - (s ? 0 : 1)) : 1 != e.nodeType || "BR" == e.nodeName && e.nextSibling ? null : e;
if (t) return er(Xn(t, 1), !1)
}
if (null == i && o < Bn(r)) {
let e = r.childNodes[o];
for (; e.pmViewDesc && e.pmViewDesc.ignoreForCoords;) e = e.nextSibling;
let t = e ? 3 == e.nodeType ? Ln(e, 0, s ? 0 : 1) : 1 == e.nodeType ? e : null : null;
if (t) return er(Xn(t, -1), !0)
}
return er(Xn(3 == r.nodeType ? Ln(r) : r, -n), n >= 0)
}
function er(e, t) {
if (0 == e.width) return e;
let n = t ? e.left : e.right;
return {
top: e.top,
bottom: e.bottom,
left: n,
right: n
}
}
function tr(e, t) {
if (0 == e.height) return e;
let n = t ? e.top : e.bottom;
return {
top: n,
bottom: n,
left: e.left,
right: e.right
}
}
function nr(e, t, n) {
let r = e.state,
o = e.root.activeElement;
r != t && e.updateState(t), o != e.dom && e.focus();
try {
return n()
} finally {
r != t && e.updateState(r), o != e.dom && o && o.focus()
}
}
const rr = /[\u0590-\u08ac]/;
let or = null,
ir = null,
sr = !1;
function ar(e, t, n) {
return or == t && ir == n ? sr : (or = t, ir = n, sr = "up" == n || "down" == n ? function(e, t, n) {
let r = t.selection,
o = "up" == n ? r.$from : r.$to;
return nr(e, t, (() => {
let {
node: t
} = e.docView.domFromPos(o.pos, "up" == n ? -1 : 1);
for (;;) {
let n = e.docView.nearestDesc(t, !0);
if (!n) break;
if (n.node.isBlock) {
t = n.dom;
break
}
t = n.dom.parentNode
}
let r = Yn(e, o.pos, 1);
for (let e = t.firstChild; e; e = e.nextSibling) {
let t;
if (1 == e.nodeType) t = e.getClientRects();
else {
if (3 != e.nodeType) continue;
t = Ln(e, 0, e.nodeValue.length).getClientRects()
}
for (let e = 0; e < t.length; e++) {
let o = t[e];
if (o.bottom > o.top + 1 && ("up" == n ? r.top - o.top > 2 * (o.bottom - r.top) : o.bottom - r.bottom > 2 * (r.bottom - o.top))) return !1
}
}
return !0
}))
}(e, t, n) : function(e, t, n) {
let {
$head: r
} = t.selection;
if (!r.parent.isTextblock) return !1;
let o = r.parentOffset,
i = !o,
s = o == r.parent.content.size,
a = e.domSelection();
return rr.test(r.parent.textContent) && a.modify ? nr(e, t, (() => {
let t = a.getRangeAt(0),
o = a.focusNode,
i = a.focusOffset,
s = a.caretBidiLevel;
a.modify("move", n, "character");
let l = !(r.depth ? e.docView.domAfterPos(r.before()) : e.dom).contains(1 == a.focusNode.nodeType ? a.focusNode : a.focusNode.parentNode) || o == a.focusNode && i == a.focusOffset;
return a.removeAllRanges(), a.addRange(t), null != s && (a.caretBidiLevel = s), l
})) : "left" == n || "backward" == n ? i : s
}(e, t, n))
}
class lr {
constructor(e, t, n, r) {
this.parent = e, this.children = t, this.dom = n, this.contentDOM = r, this.dirty = 0, n.pmViewDesc = this
}
matchesWidget(e) {
return !1
}
matchesMark(e) {
return !1
}
matchesNode(e, t, n) {
return !1
}
matchesHack(e) {
return !1
}
parseRule() {
return null
}
stopEvent(e) {
return !1
}
get size() {
let e = 0;
for (let t = 0; t < this.children.length; t++) e += this.children[t].size;
return e
}
get border() {
return 0
}
destroy() {
this.parent = void 0, this.dom.pmViewDesc == this && (this.dom.pmViewDesc = void 0);
for (let e = 0; e < this.children.length; e++) this.children[e].destroy()
}
posBeforeChild(e) {
for (let t = 0, n = this.posAtStart;; t++) {
let r = this.children[t];
if (r == e) return n;
n += r.size
}
}
get posBefore() {
return this.parent.posBeforeChild(this)
}
get posAtStart() {
return this.parent ? this.parent.posBeforeChild(this) + this.border : 0
}
get posAfter() {
return this.posBefore + this.size
}
get posAtEnd() {
return this.posAtStart + this.size - 2 * this.border
}
localPosFromDOM(e, t, n) {
if (this.contentDOM && this.contentDOM.contains(1 == e.nodeType ? e : e.parentNode)) {
if (n < 0) {
let n, r;
if (e == this.contentDOM) n = e.childNodes[t - 1];
else {
for (; e.parentNode != this.contentDOM;) e = e.parentNode;
n = e.previousSibling
}
for (; n && (!(r = n.pmViewDesc) || r.parent != this);) n = n.previousSibling;
return n ? this.posBeforeChild(r) + r.size : this.posAtStart
} {
let n, r;
if (e == this.contentDOM) n = e.childNodes[t];
else {
for (; e.parentNode != this.contentDOM;) e = e.parentNode;
n = e.nextSibling
}
for (; n && (!(r = n.pmViewDesc) || r.parent != this);) n = n.nextSibling;
return n ? this.posBeforeChild(r) : this.posAtEnd
}
}
let r;
if (e == this.dom && this.contentDOM) r = t > On(this.contentDOM);
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) r = 2 & e.compareDocumentPosition(this.contentDOM);
else if (this.dom.firstChild) {
if (0 == t)
for (let t = e;; t = t.parentNode) {
if (t == this.dom) {
r = !1;
break
}
if (t.previousSibling) break
}
if (null == r && t == e.childNodes.length)
for (let t = e;; t = t.parentNode) {
if (t == this.dom) {
r = !0;
break
}
if (t.nextSibling) break
}
}
return (null == r ? n > 0 : r) ? this.posAtEnd : this.posAtStart
}
nearestDesc(e, t = !1) {
for (let n = !0, r = e; r; r = r.parentNode) {
let o, i = this.getDesc(r);
if (i && (!t || i.node)) {
if (!n || !(o = i.nodeDOM) || (1 == o.nodeType ? o.contains(1 == e.nodeType ? e : e.parentNode) : o == e)) return i;
n = !1
}
}
}
getDesc(e) {
let t = e.pmViewDesc;
for (let e = t; e; e = e.parent)
if (e == this) return t
}
posFromDOM(e, t, n) {
for (let r = e; r; r = r.parentNode) {
let o = this.getDesc(r);
if (o) return o.localPosFromDOM(e, t, n)
}
return -1
}
descAt(e) {
for (let t = 0, n = 0; t < this.children.length; t++) {
let r = this.children[t],
o = n + r.size;
if (n == e && o != n) {
for (; !r.border && r.children.length;) r = r.children[0];
return r
}
if (e < o) return r.descAt(e - n - r.border);
n = o
}
}
domFromPos(e, t) {
if (!this.contentDOM) return {
node: this.dom,
offset: 0,
atom: e + 1
};
let n, r = 0,
o = 0;
for (let t = 0; r < this.children.length; r++) {
let n = this.children[r],
i = t + n.size;
if (i > e || n instanceof mr) {
o = e - t;
break
}
t = i
}
if (o) return this.children[r].domFromPos(o - this.children[r].border, t);
for (; r && !(n = this.children[r - 1]).size && n instanceof cr && n.side >= 0; r--);
if (t <= 0) {
let e, n = !0;
for (; e = r ? this.children[r - 1] : null, e && e.dom.parentNode != this.contentDOM; r--, n = !1);
return e && t && n && !e.border && !e.domAtom ? e.domFromPos(e.size, t) : {
node: this.contentDOM,
offset: e ? On(e.dom) + 1 : 0
}
} {
let e, n = !0;
for (; e = r < this.children.length ? this.children[r] : null, e && e.dom.parentNode != this.contentDOM; r++, n = !1);
return e && n && !e.border && !e.domAtom ? e.domFromPos(0, t) : {
node: this.contentDOM,
offset: e ? On(e.dom) : this.contentDOM.childNodes.length
}
}
}
parseRange(e, t, n = 0) {
if (0 == this.children.length) return {
node: this.contentDOM,
from: e,
to: t,
fromOffset: 0,
toOffset: this.contentDOM.childNodes.length
};
let r = -1,
o = -1;
for (let i = n, s = 0;; s++) {
let n = this.children[s],
a = i + n.size;
if (-1 == r && e <= a) {
let o = i + n.border;
if (e >= o && t <= a - n.border && n.node && n.contentDOM && this.contentDOM.contains(n.contentDOM)) return n.parseRange(e, t, o);
e = i;
for (let t = s; t > 0; t--) {
let n = this.children[t - 1];
if (n.size && n.dom.parentNode == this.contentDOM && !n.emptyChildAt(1)) {
r = On(n.dom) + 1;
break
}
e -= n.size
} - 1 == r && (r = 0)
}
if (r > -1 && (a > t || s == this.children.length - 1)) {
t = a;
for (let e = s + 1; e < this.children.length; e++) {
let n = this.children[e];
if (n.size && n.dom.parentNode == this.contentDOM && !n.emptyChildAt(-1)) {
o = On(n.dom);
break
}
t += n.size
} - 1 == o && (o = this.contentDOM.childNodes.length);
break
}
i = a
}
return {
node: this.contentDOM,
from: e,
to: t,
fromOffset: r,
toOffset: o
}
}
emptyChildAt(e) {
if (this.border || !this.contentDOM || !this.children.length) return !1;
let t = this.children[e < 0 ? 0 : this.children.length - 1];
return 0 == t.size || t.emptyChildAt(e)
}
domAfterPos(e) {
let {
node: t,
offset: n
} = this.domFromPos(e, 0);
if (1 != t.nodeType || n == t.childNodes.length) throw new RangeError("No node after pos " + e);
return t.childNodes[n]
}
setSelection(e, t, n, r = !1) {
let o = Math.min(e, t),
i = Math.max(e, t);
for (let s = 0, a = 0; s < this.children.length; s++) {
let l = this.children[s],
c = a + l.size;
if (o > a && i < c) return l.setSelection(e - a - l.border, t - a - l.border, n, r);
a = c
}
let s = this.domFromPos(e, e ? -1 : 1),
a = t == e ? s : this.domFromPos(t, t ? -1 : 1),
l = n.getSelection(),
c = !1;
if ((bn || Cn) && e == t) {
let {
node: e,
offset: t
} = s;
if (3 == e.nodeType) {
if (c = !(!t || "\n" != e.nodeValue[t - 1]), c && t == e.nodeValue.length)
for (let t, n = e; n; n = n.parentNode) {
if (t = n.nextSibling) {
"BR" == t.nodeName && (s = a = {
node: t.parentNode,
offset: On(t) + 1
});
break
}
let e = n.pmViewDesc;
if (e && e.node && e.node.isBlock) break
}
} else {
let n = e.childNodes[t - 1];
c = n && ("BR" == n.nodeName || "false" == n.contentEditable)
}
}
if (bn && l.focusNode && l.focusNode != a.node && 1 == l.focusNode.nodeType) {
let e = l.focusNode.childNodes[l.focusOffset];
e && "false" == e.contentEditable && (r = !0)
}
if (!(r || c && Cn) && In(s.node, s.offset, l.anchorNode, l.anchorOffset) && In(a.node, a.offset, l.focusNode, l.focusOffset)) return;
let u = !1;
if ((l.extend || e == t) && !c) {
l.collapse(s.node, s.offset);
try {
e != t && l.extend(a.node, a.offset), u = !0
} catch (e) {
if (!(e instanceof DOMException)) throw e
}
}
if (!u) {
if (e > t) {
let e = s;
s = a, a = e
}
let n = document.createRange();
n.setEnd(a.node, a.offset), n.setStart(s.node, s.offset), l.removeAllRanges(), l.addRange(n)
}
}
ignoreMutation(e) {
return !this.contentDOM && "selection" != e.type
}
get contentLost() {
return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM)
}
markDirty(e, t) {
for (let n = 0, r = 0; r < this.children.length; r++) {
let o = this.children[r],
i = n + o.size;
if (n == i ? e <= i && t >= n : e < i && t > n) {
let r = n + o.border,
s = i - o.border;
if (e >= r && t <= s) return this.dirty = e == n || t == i ? 2 : 1, void(e != r || t != s || !o.contentLost && o.dom.parentNode == this.contentDOM ? o.markDirty(e - r, t - r) : o.dirty = 3);
o.dirty = o.dom != o.contentDOM || o.dom.parentNode != this.contentDOM || o.children.length ? 3 : 2
}
n = i
}
this.dirty = 2
}
markParentsDirty() {
let e = 1;
for (let t = this.parent; t; t = t.parent, e++) {
let n = 1 == e ? 2 : 1;
t.dirty < n && (t.dirty = n)
}
}
get domAtom() {
return !1
}
get ignoreForCoords() {
return !1
}
}
class cr extends lr {
constructor(e, t, n, r) {
let o, i = t.type.toDOM;
if ("function" == typeof i && (i = i(n, (() => o ? o.parent ? o.parent.posBeforeChild(o) : void 0 : r))), !t.type.spec.raw) {
if (1 != i.nodeType) {
let e = document.createElement("span");
e.appendChild(i), i = e
}
i.contentEditable = "false", i.classList.add("ProseMirror-widget")
}
super(e, [], i, null), this.widget = t, this.widget = t, o = this
}
matchesWidget(e) {
return 0 == this.dirty && e.type.eq(this.widget.type)
}
parseRule() {
return {
ignore: !0
}
}
stopEvent(e) {
let t = this.widget.spec.stopEvent;
return !!t && t(e)
}
ignoreMutation(e) {
return "selection" != e.type || this.widget.spec.ignoreSelection
}
destroy() {
this.widget.type.destroy(this.dom), super.destroy()
}
get domAtom() {
return !0
}
get side() {
return this.widget.type.side
}
}
class ur extends lr {
constructor(e, t, n, r) {
super(e, [], t, null), this.textDOM = n, this.text = r
}
get size() {
return this.text.length
}
localPosFromDOM(e, t) {
return e != this.textDOM ? this.posAtStart + (t ? this.size : 0) : this.posAtStart + t
}
domFromPos(e) {
return {
node: this.textDOM,
offset: e
}
}
ignoreMutation(e) {
return "characterData" === e.type && e.target.nodeValue == e.oldValue
}
}
class dr extends lr {
constructor(e, t, n, r) {
super(e, [], n, r), this.mark = t
}
static create(e, t, n, r) {
let o = r.nodeViews[t.type.name],
i = o && o(t, r, n);
return i && i.dom || (i = de.renderSpec(document, t.type.spec.toDOM(t, n))), new dr(e, t, i.dom, i.contentDOM || i.dom)
}
parseRule() {
return 3 & this.dirty || this.mark.type.spec.reparseInView ? null : {
mark: this.mark.type.name,
attrs: this.mark.attrs,
contentElement: this.contentDOM || void 0
}
}
matchesMark(e) {
return 3 != this.dirty && this.mark.eq(e)
}
markDirty(e, t) {
if (super.markDirty(e, t), 0 != this.dirty) {
let e = this.parent;
for (; !e.node;) e = e.parent;
e.dirty < this.dirty && (e.dirty = this.dirty), this.dirty = 0
}
}
slice(e, t, n) {
let r = dr.create(this.parent, this.mark, !0, n),
o = this.children,
i = this.size;
t < i && (o = Nr(o, t, i, n)), e > 0 && (o = Nr(o, 0, e, n));
for (let e = 0; e < o.length; e++) o[e].parent = r;
return r.children = o, r
}
}
class pr extends lr {
constructor(e, t, n, r, o, i, s, a, l) {
super(e, [], o, i), this.node = t, this.outerDeco = n, this.innerDeco = r, this.nodeDOM = s, i && this.updateChildren(a, l)
}
static create(e, t, n, r, o, i) {
let s, a = o.nodeViews[t.type.name],
l = a && a(t, o, (() => s ? s.parent ? s.parent.posBeforeChild(s) : void 0 : i), n, r),
c = l && l.dom,
u = l && l.contentDOM;
if (t.isText)
if (c) {
if (3 != c.nodeType) throw new RangeError("Text must be rendered as a DOM text node")
} else c = document.createTextNode(t.text);
else c || ({
dom: c,
contentDOM: u
} = de.renderSpec(document, t.type.spec.toDOM(t)));
u || t.isText || "BR" == c.nodeName || (c.hasAttribute("contenteditable") || (c.contentEditable = "false"), t.type.spec.draggable && (c.draggable = !0));
let d = c;
return c = Cr(c, n, t), l ? s = new gr(e, t, n, r, c, u || null, d, l, o, i + 1) : t.isText ? new fr(e, t, n, r, c, d, o) : new pr(e, t, n, r, c, u || null, d, o, i + 1)
}
parseRule() {
if (this.node.type.spec.reparseInView) return null;
let e = {
node: this.node.type.name,
attrs: this.node.attrs
};
if ("pre" == this.node.type.whitespace && (e.preserveWhitespace = "full"), this.contentDOM)
if (this.contentLost) {
for (let t = this.children.length - 1; t >= 0; t--) {
let n = this.children[t];
if (this.dom.contains(n.dom.parentNode)) {
e.contentElement = n.dom.parentNode;
break
}
}
e.contentElement || (e.getContent = () => d.empty)
} else e.contentElement = this.contentDOM;
else e.getContent = () => this.node.content;
return e
}
matchesNode(e, t, n) {
return 0 == this.dirty && e.eq(this.node) && Tr(t, this.outerDeco) && n.eq(this.innerDeco)
}
get size() {
return this.node.nodeSize
}
get border() {
return this.node.isLeaf ? 0 : 1
}
updateChildren(e, t) {
let n = this.node.inlineContent,
r = t,
o = e.composing ? this.localCompositionInfo(e, t) : null,
i = o && o.pos > -1 ? o : null,
s = o && o.pos < 0,
a = new Sr(this, i && i.node);
! function(e, t, n, r) {
let o = t.locals(e),
i = 0;
if (0 == o.length) {
for (let n = 0; n < e.childCount; n++) {
let s = e.child(n);
r(s, o, t.forChild(i, s), n), i += s.nodeSize
}
return
}
let s = 0,
a = [],
l = null;
for (let c = 0;;) {
if (s < o.length && o[s].to == i) {
let e, t = o[s++];
for (; s < o.length && o[s].to == i;)(e || (e = [t])).push(o[s++]);
if (e) {
e.sort(Er);
for (let t = 0; t < e.length; t++) n(e[t], c, !!l)
} else n(t, c, !!l)
}
let u, d;
if (l) d = -1, u = l, l = null;
else {
if (!(c < e.childCount)) break;
d = c, u = e.child(c++)
}
for (let e = 0; e < a.length; e++) a[e].to <= i && a.splice(e--, 1);
for (; s < o.length && o[s].from <= i && o[s].to > i;) a.push(o[s++]);
let p = i + u.nodeSize;
if (u.isText) {
let e = p;
s < o.length && o[s].from < e && (e = o[s].from);
for (let t = 0; t < a.length; t++) a[t].to < e && (e = a[t].to);
e < p && (l = u.cut(e - i), u = u.cut(0, e - i), p = e, d = -1)
}
r(u, u.isInline && !u.isLeaf ? a.filter((e => !e.inline)) : a.slice(), t.forChild(i, u), d), i = p
}
}(this.node, this.innerDeco, ((t, o, i) => {
t.spec.marks ? a.syncToMarks(t.spec.marks, n, e) : t.type.side >= 0 && !i && a.syncToMarks(o == this.node.childCount ? m.none : this.node.child(o).marks, n, e), a.placeWidget(t, e, r)
}), ((t, i, l, c) => {
let u;
a.syncToMarks(t.marks, n, e), a.findNodeMatch(t, i, l, c) || s && e.state.selection.from > r && e.state.selection.to < r + t.nodeSize && (u = a.findIndexWithChild(o.node)) > -1 && a.updateNodeAt(t, i, l, u, e) || a.updateNextNode(t, i, l, e, c) || a.addNode(t, i, l, e, r), r += t.nodeSize
})), a.syncToMarks([], n, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || 2 == this.dirty) && (i && this.protectLocalComposition(e, i), vr(this.contentDOM, this.children, e), Tn && function(e) {
if ("UL" == e.nodeName || "OL" == e.nodeName) {
let t = e.style.cssText;
e.style.cssText = t + "; list-style: square !important", window.getComputedStyle(e).listStyle, e.style.cssText = t
}
}(this.dom))
}
localCompositionInfo(e, t) {
let {
from: n,
to: r
} = e.state.selection;
if (!(e.state.selection instanceof Ut) || n < t || r > t + this.node.content.size) return null;
let o = e.domSelection(),
i = function(e, t) {
for (;;) {
if (3 == e.nodeType) return e;
if (1 == e.nodeType && t > 0) {
if (e.childNodes.length > t && 3 == e.childNodes[t].nodeType) return e.childNodes[t];
t = Bn(e = e.childNodes[t - 1])
} else {
if (!(1 == e.nodeType && t < e.childNodes.length)) return null;
e = e.childNodes[t], t = 0
}
}
}(o.focusNode, o.focusOffset);
if (!i || !this.dom.contains(i.parentNode)) return null;
if (this.node.inlineContent) {
let e = i.nodeValue,
o = function(e, t, n, r) {
for (let o = 0, i = 0; o < e.childCount && i <= r;) {
let s = e.child(o++),
a = i;
if (i += s.nodeSize, !s.isText) continue;
let l = s.text;
for (; o < e.childCount;) {
let t = e.child(o++);
if (i += t.nodeSize, !t.isText) break;
l += t.text
}
if (i >= n) {
let e = a < r ? l.lastIndexOf(t, r - a - 1) : -1;
if (e >= 0 && e + t.length + a >= n) return a + e;
if (n == r && l.length >= r + t.length - a && l.slice(r - a, r - a + t.length) == t) return r
}
}
return -1
}(this.node.content, e, n - t, r - t);
return o < 0 ? null : {
node: i,
pos: o,
text: e
}
}
return {
node: i,
pos: -1,
text: ""
}
}
protectLocalComposition(e, {
node: t,
pos: n,
text: r
}) {
if (this.getDesc(t)) return;
let o = t;
for (; o.parentNode != this.contentDOM; o = o.parentNode) {
for (; o.previousSibling;) o.parentNode.removeChild(o.previousSibling);
for (; o.nextSibling;) o.parentNode.removeChild(o.nextSibling);
o.pmViewDesc && (o.pmViewDesc = void 0)
}
let i = new ur(this, o, t, r);
e.input.compositionNodes.push(i), this.children = Nr(this.children, n, n + r.length, e, i)
}
update(e, t, n, r) {
return !(3 == this.dirty || !e.sameMarkup(this.node)) && (this.updateInner(e, t, n, r), !0)
}
updateInner(e, t, n, r) {
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(r, this.posAtStart), this.dirty = 0
}
updateOuterDeco(e) {
if (Tr(e, this.outerDeco)) return;
let t = 1 != this.nodeDOM.nodeType,
n = this.dom;
this.dom = kr(this.dom, this.nodeDOM, wr(this.outerDeco, this.node, t), wr(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e
}
selectNode() {
1 == this.nodeDOM.nodeType && this.nodeDOM.classList.add("ProseMirror-selectednode"), !this.contentDOM && this.node.type.spec.draggable || (this.dom.draggable = !0)
}
deselectNode() {
1 == this.nodeDOM.nodeType && this.nodeDOM.classList.remove("ProseMirror-selectednode"), !this.contentDOM && this.node.type.spec.draggable || this.dom.removeAttribute("draggable")
}
get domAtom() {
return this.node.isAtom
}
}
function hr(e, t, n, r, o) {
return Cr(r, t, e), new pr(void 0, e, t, n, r, r, r, o, 0)
}
class fr extends pr {
constructor(e, t, n, r, o, i, s) {
super(e, t, n, r, o, null, i, s, 0)
}
parseRule() {
let e = this.nodeDOM.parentNode;
for (; e && e != this.dom && !e.pmIsDeco;) e = e.parentNode;
return {
skip: e || !0
}
}
update(e, t, n, r) {
return !(3 == this.dirty || 0 != this.dirty && !this.inParent() || !e.sameMarkup(this.node)) && (this.updateOuterDeco(t), 0 == this.dirty && e.text == this.node.text || e.text == this.nodeDOM.nodeValue || (this.nodeDOM.nodeValue = e.text, r.trackWrites == this.nodeDOM && (r.trackWrites = null)), this.node = e, this.dirty = 0, !0)
}
inParent() {
let e = this.parent.contentDOM;
for (let t = this.nodeDOM; t; t = t.parentNode)
if (t == e) return !0;
return !1
}
domFromPos(e) {
return {
node: this.nodeDOM,
offset: e
}
}
localPosFromDOM(e, t, n) {
return e == this.nodeDOM ? this.posAtStart + Math.min(t, this.node.text.length) : super.localPosFromDOM(e, t, n)
}
ignoreMutation(e) {
return "characterData" != e.type && "selection" != e.type
}
slice(e, t, n) {
let r = this.node.cut(e, t),
o = document.createTextNode(r.text);
return new fr(this.parent, r, this.outerDeco, this.innerDeco, o, o, n)
}
markDirty(e, t) {
super.markDirty(e, t), this.dom == this.nodeDOM || 0 != e && t != this.nodeDOM.nodeValue.length || (this.dirty = 3)
}
get domAtom() {
return !1
}
}
class mr extends lr {
parseRule() {
return {
ignore: !0
}
}
matchesHack(e) {
return 0 == this.dirty && this.dom.nodeName == e
}
get domAtom() {
return !0
}
get ignoreForCoords() {
return "IMG" == this.dom.nodeName
}
}
class gr extends pr {
constructor(e, t, n, r, o, i, s, a, l, c) {
super(e, t, n, r, o, i, s, l, c), this.spec = a
}
update(e, t, n, r) {
if (3 == this.dirty) return !1;
if (this.spec.update) {
let o = this.spec.update(e, t, n);
return o && this.updateInner(e, t, n, r), o
}
return !(!this.contentDOM && !e.isLeaf) && super.update(e, t, n, r)
}
selectNode() {
this.spec.selectNode ? this.spec.selectNode() : super.selectNode()
}
deselectNode() {
this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode()
}
setSelection(e, t, n, r) {
this.spec.setSelection ? this.spec.setSelection(e, t, n) : super.setSelection(e, t, n, r)
}
destroy() {
this.spec.destroy && this.spec.destroy(), super.destroy()
}
stopEvent(e) {
return !!this.spec.stopEvent && this.spec.stopEvent(e)
}
ignoreMutation(e) {
return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e)
}
}
function vr(e, t, n) {
let r = e.firstChild,
o = !1;
for (let i = 0; i < t.length; i++) {
let s = t[i],
a = s.dom;
if (a.parentNode == e) {
for (; a != r;) r = Mr(r), o = !0;
r = r.nextSibling
} else o = !0, e.insertBefore(a, r);
if (s instanceof dr) {
let t = r ? r.previousSibling : e.lastChild;
vr(s.contentDOM, s.children, n), r = t ? t.nextSibling : e.firstChild
}
}
for (; r;) r = Mr(r), o = !0;
o && n.trackWrites == e && (n.trackWrites = null)
}
const yr = function(e) {
e && (this.nodeName = e)
};
yr.prototype = Object.create(null);
const br = [new yr];
function wr(e, t, n) {
if (0 == e.length) return br;
let r = n ? br[0] : new yr,
o = [r];
for (let i = 0; i < e.length; i++) {
let s = e[i].type.attrs;
if (s) {
s.nodeName && o.push(r = new yr(s.nodeName));
for (let e in s) {
let i = s[e];
null != i && (n && 1 == o.length && o.push(r = new yr(t.isInline ? "span" : "div")), "class" == e ? r.class = (r.class ? r.class + " " : "") + i : "style" == e ? r.style = (r.style ? r.style + ";" : "") + i : "nodeName" != e && (r[e] = i))
}
}
}
return o
}
function kr(e, t, n, r) {
if (n == br && r == br) return t;
let o = t;
for (let t = 0; t < r.length; t++) {
let i = r[t],
s = n[t];
if (t) {
let t;
s && s.nodeName == i.nodeName && o != e && (t = o.parentNode) && t.nodeName.toLowerCase() == i.nodeName || (t = document.createElement(i.nodeName), t.pmIsDeco = !0, t.appendChild(o), s = br[0]), o = t
}
xr(o, s || br[0], i)
}
return o
}
function xr(e, t, n) {
for (let r in t) "class" == r || "style" == r || "nodeName" == r || r in n || e.removeAttribute(r);
for (let r in n) "class" != r && "style" != r && "nodeName" != r && n[r] != t[r] && e.setAttribute(r, n[r]);
if (t.class != n.class) {
let r = t.class ? t.class.split(" ").filter(Boolean) : [],
o = n.class ? n.class.split(" ").filter(Boolean) : [];
for (let t = 0; t < r.length; t++) - 1 == o.indexOf(r[t]) && e.classList.remove(r[t]);
for (let t = 0; t < o.length; t++) - 1 == r.indexOf(o[t]) && e.classList.add(o[t]);
0 == e.classList.length && e.removeAttribute("class")
}
if (t.style != n.style) {
if (t.style) {
let n, r = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;
for (; n = r.exec(t.style);) e.style.removeProperty(n[1])
}
n.style && (e.style.cssText += n.style)
}
}
function Cr(e, t, n) {
return kr(e, e, br, wr(t, n, 1 != e.nodeType))
}
function Tr(e, t) {
if (e.length != t.length) return !1;
for (let n = 0; n < e.length; n++)
if (!e[n].type.eq(t[n].type)) return !1;
return !0
}
function Mr(e) {
let t = e.nextSibling;
return e.parentNode.removeChild(e), t
}
class Sr {
constructor(e, t) {
this.lock = t, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = function(e, t) {
let n = t,
r = n.children.length,
o = e.childCount,
i = new Map,
s = [];
e: for (; o > 0;) {
let a;
for (;;)
if (r) {
let e = n.children[r - 1];
if (!(e instanceof dr)) {
a = e, r--;
break
}
n = e, r = e.children.length
} else {
if (n == t) break e;
r = n.parent.children.indexOf(n), n = n.parent
} let l = a.node;
if (l) {
if (l != e.child(o - 1)) break;
--o, i.set(a, o), s.push(a)
}
}
return {
index: o,
matched: i,
matches: s.reverse()
}
}(e.node.content, e)
}
destroyBetween(e, t) {
if (e != t) {
for (let n = e; n < t; n++) this.top.children[n].destroy();
this.top.children.splice(e, t - e), this.changed = !0
}
}
destroyRest() {
this.destroyBetween(this.index, this.top.children.length)
}
syncToMarks(e, t, n) {
let r = 0,
o = this.stack.length >> 1,
i = Math.min(o, e.length);
for (; r < i && (r == o - 1 ? this.top : this.stack[r + 1 << 1]).matchesMark(e[r]) && !1 !== e[r].type.spec.spanning;) r++;
for (; r < o;) this.destroyRest(), this.top.dirty = 0, this.index = this.stack.pop(), this.top = this.stack.pop(), o--;
for (; o < e.length;) {
this.stack.push(this.top, this.index + 1);
let r = -1;
for (let t = this.index; t < Math.min(this.index + 3, this.top.children.length); t++)
if (this.top.children[t].matchesMark(e[o])) {
r = t;
break
} if (r > -1) r > this.index && (this.changed = !0, this.destroyBetween(this.index, r)), this.top = this.top.children[this.index];
else {
let r = dr.create(this.top, e[o], t, n);
this.top.children.splice(this.index, 0, r), this.top = r, this.changed = !0
}
this.index = 0, o++
}
}
findNodeMatch(e, t, n, r) {
let o, i = -1;
if (r >= this.preMatch.index && (o = this.preMatch.matches[r - this.preMatch.index]).parent == this.top && o.matchesNode(e, t, n)) i = this.top.children.indexOf(o, this.index);
else
for (let r = this.index, o = Math.min(this.top.children.length, r + 5); r < o; r++) {
let o = this.top.children[r];
if (o.matchesNode(e, t, n) && !this.preMatch.matched.has(o)) {
i = r;
break
}
}
return !(i < 0) && (this.destroyBetween(this.index, i), this.index++, !0)
}
updateNodeAt(e, t, n, r, o) {
let i = this.top.children[r];
return 3 == i.dirty && i.dom == i.contentDOM && (i.dirty = 2), !!i.update(e, t, n, o) && (this.destroyBetween(this.index, r), this.index++, !0)
}
findIndexWithChild(e) {
for (;;) {
let t = e.parentNode;
if (!t) return -1;
if (t == this.top.contentDOM) {
let t = e.pmViewDesc;
if (t)
for (let e = this.index; e < this.top.children.length; e++)
if (this.top.children[e] == t) return e;
return -1
}
e = t
}
}
updateNextNode(e, t, n, r, o) {
for (let i = this.index; i < this.top.children.length; i++) {
let s = this.top.children[i];
if (s instanceof pr) {
let a = this.preMatch.matched.get(s);
if (null != a && a != o) return !1;
let l = s.dom;
if (!(this.lock && (l == this.lock || 1 == l.nodeType && l.contains(this.lock.parentNode)) && !(e.isText && s.node && s.node.isText && s.nodeDOM.nodeValue == e.text && 3 != s.dirty && Tr(t, s.outerDeco))) && s.update(e, t, n, r)) return this.destroyBetween(this.index, i), s.dom != l && (this.changed = !0), this.index++, !0;
break
}
}
return !1
}
addNode(e, t, n, r, o) {
this.top.children.splice(this.index++, 0, pr.create(this.top, e, t, n, r, o)), this.changed = !0
}
placeWidget(e, t, n) {
let r = this.index < this.top.children.length ? this.top.children[this.index] : null;
if (!r || !r.matchesWidget(e) || e != r.widget && r.widget.type.toDOM.parentNode) {
let r = new cr(this.top, e, t, n);
this.top.children.splice(this.index++, 0, r), this.changed = !0
} else this.index++
}
addTextblockHacks() {
let e = this.top.children[this.index - 1],
t = this.top;
for (; e instanceof dr;) t = e, e = t.children[t.children.length - 1];
e && e instanceof fr && !/\n$/.test(e.node.text) || ((Cn || kn) && e && "false" == e.dom.contentEditable && this.addHackNode("IMG", t), this.addHackNode("BR", this.top))
}
addHackNode(e, t) {
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e)) this.index++;
else {
let n = document.createElement(e);
"IMG" == e && (n.className = "ProseMirror-separator", n.alt = ""), "BR" == e && (n.className = "ProseMirror-trailingBreak");
let r = new mr(this.top, [], n, null);
t != this.top ? t.children.push(r) : t.children.splice(this.index++, 0, r), this.changed = !0
}
}
}
function Er(e, t) {
return e.type.side - t.type.side
}
function Nr(e, t, n, r, o) {
let i = [];
for (let s = 0, a = 0; s < e.length; s++) {
let l = e[s],
c = a,
u = a += l.size;
c >= n || u <= t ? i.push(l) : (c < t && i.push(l.slice(0, t - c, r)), o && (i.push(o), o = void 0), u > n && i.push(l.slice(n - c, l.size, r)))
}
return i
}
function Or(e, t = null) {
let n = e.domSelection(),
r = e.state.doc;
if (!n.focusNode) return null;
let o = e.docView.nearestDesc(n.focusNode),
i = o && 0 == o.size,
s = e.docView.posFromDOM(n.focusNode, n.focusOffset, 1);
if (s < 0) return null;
let a, l, c = r.resolve(s);
if (Hn(n)) {
for (a = c; o && !o.node;) o = o.parent;
let e = o.node;
if (o && e.isAtom && Jt.isSelectable(e) && o.parent && (!e.isInline || ! function(e, t, n) {
for (let r = 0 == t, o = t == Bn(e); r || o;) {
if (e == n) return !0;
let t = On(e);
if (!(e = e.parentNode)) return !1;
r = r && 0 == t, o = o && t == Bn(e)
}
}(n.focusNode, n.focusOffset, o.dom))) {
let e = o.posBefore;
l = new Jt(s == e ? c : r.resolve(e))
}
} else {
let t = e.docView.posFromDOM(n.anchorNode, n.anchorOffset, 1);
if (t < 0) return null;
a = r.resolve(t)
}
if (!l) {
l = Hr(e, a, c, "pointer" == t || e.state.selection.head < c.pos && !i ? 1 : -1)
}
return l
}
function Dr(e) {
return e.editable ? e.hasFocus() : qr(e) && document.activeElement && document.activeElement.contains(e.dom)
}
function Ar(e, t = !1) {
let n = e.state.selection;
if (Br(e, n), Dr(e)) {
if (!t && e.input.mouseDown && e.input.mouseDown.allowDefault && kn) {
let t = e.domSelection(),
n = e.domObserver.currentSelection;
if (t.anchorNode && n.anchorNode && In(t.anchorNode, t.anchorOffset, n.anchorNode, n.anchorOffset)) return e.input.mouseDown.delayedSelectionSync = !0, void e.domObserver.setCurSelection()
}
if (e.domObserver.disconnectSelection(), e.cursorWrapper) ! function(e) {
let t = e.domSelection(),
n = document.createRange(),
r = e.cursorWrapper.dom,
o = "IMG" == r.nodeName;
o ? n.setEnd(r.parentNode, On(r) + 1) : n.setEnd(r, 0);
n.collapse(!1), t.removeAllRanges(), t.addRange(n), !o && !e.state.selection.visible && vn && yn <= 11 && (r.disabled = !0, r.disabled = !1)
}(e);
else {
let r, o, {
anchor: i,
head: s
} = n;
!Lr || n instanceof Ut || (n.$from.parent.inlineContent || (r = Ir(e, n.from)), n.empty || n.$from.parent.inlineContent || (o = Ir(e, n.to))), e.docView.setSelection(i, s, e.root, t), Lr && (r && Pr(r), o && Pr(o)), n.visible ? e.dom.classList.remove("ProseMirror-hideselection") : (e.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && function(e) {
let t = e.dom.ownerDocument;
t.removeEventListener("selectionchange", e.input.hideSelectionGuard);
let n = e.domSelection(),
r = n.anchorNode,
o = n.anchorOffset;
t.addEventListener("selectionchange", e.input.hideSelectionGuard = () => {
n.anchorNode == r && n.anchorOffset == o || (t.removeEventListener("selectionchange", e.input.hideSelectionGuard), setTimeout((() => {
Dr(e) && !e.state.selection.visible || e.dom.classList.remove("ProseMirror-hideselection")
}), 20))
})
}(e))
}
e.domObserver.setCurSelection(), e.domObserver.connectSelection()
}
}
const Lr = Cn || kn && xn < 63;
function Ir(e, t) {
let {
node: n,
offset: r
} = e.docView.domFromPos(t, 0), o = r < n.childNodes.length ? n.childNodes[r] : null, i = r ? n.childNodes[r - 1] : null;
if (Cn && o && "false" == o.contentEditable) return Rr(o);
if (!(o && "false" != o.contentEditable || i && "false" != i.contentEditable)) {
if (o) return Rr(o);
if (i) return Rr(i)
}
}
function Rr(e) {
return e.contentEditable = "true", Cn && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e
}
function Pr(e) {
e.contentEditable = "false", e.wasDraggable && (e.draggable = !0, e.wasDraggable = null)
}
function Br(e, t) {
if (t instanceof Jt) {
let n = e.docView.descAt(t.from);
n != e.lastSelectedViewDesc && (Fr(e), n && n.selectNode(), e.lastSelectedViewDesc = n)
} else Fr(e)
}
function Fr(e) {
e.lastSelectedViewDesc && (e.lastSelectedViewDesc.parent && e.lastSelectedViewDesc.deselectNode(), e.lastSelectedViewDesc = void 0)
}
function Hr(e, t, n, r) {
return e.someProp("createSelectionBetween", (r => r(e, t, n))) || Ut.between(t, n, r)
}
function zr(e) {
return (!e.editable || e.root.activeElement == e.dom) && qr(e)
}
function qr(e) {
let t = e.domSelection();
if (!t.anchorNode) return !1;
try {
return e.dom.contains(3 == t.anchorNode.nodeType ? t.anchorNode.parentNode : t.anchorNode) && (e.editable || e.dom.contains(3 == t.focusNode.nodeType ? t.focusNode.parentNode : t.focusNode))
} catch (e) {
return !1
}
}
function Vr(e, t) {
let {
$anchor: n,
$head: r
} = e.selection, o = t > 0 ? n.max(r) : n.min(r), i = o.parent.inlineContent ? o.depth ? e.doc.resolve(t > 0 ? o.after() : o.before()) : null : o;
return i && Vt.findFrom(i, t)
}
function jr(e, t) {
return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()), !0
}
function $r(e, t, n) {
let r = e.state.selection;
if (!(r instanceof Ut)) {
if (r instanceof Jt && r.node.isInline) return jr(e, new Ut(t > 0 ? r.$to : r.$from));
{
let n = Vr(e.state, t);
return !!n && jr(e, n)
}
}
if (!r.empty || n.indexOf("s") > -1) return !1;
if (e.endOfTextblock(t > 0 ? "right" : "left")) {
let n = Vr(e.state, t);
return !!(n && n instanceof Jt) && jr(e, n)
}
if (!(Mn && n.indexOf("m") > -1)) {
let n, o = r.$head,
i = o.textOffset ? null : t < 0 ? o.nodeBefore : o.nodeAfter;
if (!i || i.isText) return !1;
let s = t < 0 ? o.pos - i.nodeSize : o.pos;
return !!(i.isAtom || (n = e.docView.descAt(s)) && !n.contentDOM) && (Jt.isSelectable(i) ? jr(e, new Jt(t < 0 ? e.state.doc.resolve(o.pos - i.nodeSize) : o)) : !!En && jr(e, new Ut(e.state.doc.resolve(t < 0 ? s : s + i.nodeSize))))
}
}
function _r(e) {
return 3 == e.nodeType ? e.nodeValue.length : e.childNodes.length
}
function Ur(e) {
let t = e.pmViewDesc;
return t && 0 == t.size && (e.nextSibling || "BR" != e.nodeName)
}
function Wr(e) {
let t = e.domSelection(),
n = t.focusNode,
r = t.focusOffset;
if (!n) return;
let o, i, s = !1;
for (bn && 1 == n.nodeType && r < _r(n) && Ur(n.childNodes[r]) && (s = !0);;)
if (r > 0) {
if (1 != n.nodeType) break;
{
let e = n.childNodes[r - 1];
if (Ur(e)) o = n, i = --r;
else {
if (3 != e.nodeType) break;
n = e, r = n.nodeValue.length
}
}
} else {
if (Gr(n)) break;
{
let t = n.previousSibling;
for (; t && Ur(t);) o = n.parentNode, i = On(t), t = t.previousSibling;
if (t) n = t, r = _r(n);
else {
if (n = n.parentNode, n == e.dom) break;
r = 0
}
}
} s ? Kr(e, t, n, r) : o && Kr(e, t, o, i)
}
function Jr(e) {
let t = e.domSelection(),
n = t.focusNode,
r = t.focusOffset;
if (!n) return;
let o, i, s = _r(n);
for (;;)
if (r < s) {
if (1 != n.nodeType) break;
if (!Ur(n.childNodes[r])) break;
o = n, i = ++r
} else {
if (Gr(n)) break;
{
let t = n.nextSibling;
for (; t && Ur(t);) o = t.parentNode, i = On(t) + 1, t = t.nextSibling;
if (t) n = t, r = 0, s = _r(n);
else {
if (n = n.parentNode, n == e.dom) break;
r = s = 0
}
}
} o && Kr(e, t, o, i)
}
function Gr(e) {
let t = e.pmViewDesc;
return t && t.node && t.node.isBlock
}
function Kr(e, t, n, r) {
if (Hn(t)) {
let e = document.createRange();
e.setEnd(n, r), e.setStart(n, r), t.removeAllRanges(), t.addRange(e)
} else t.extend && t.extend(n, r);
e.domObserver.setCurSelection();
let {
state: o
} = e;
setTimeout((() => {
e.state == o && Ar(e)
}), 50)
}
function Zr(e, t, n) {
let r = e.state.selection;
if (r instanceof Ut && !r.empty || n.indexOf("s") > -1) return !1;
if (Mn && n.indexOf("m") > -1) return !1;
let {
$from: o,
$to: i
} = r;
if (!o.parent.inlineContent || e.endOfTextblock(t < 0 ? "up" : "down")) {
let n = Vr(e.state, t);
if (n && n instanceof Jt) return jr(e, n)
}
if (!o.parent.inlineContent) {
let n = t < 0 ? o : i,
s = r instanceof Kt ? Vt.near(n, t) : Vt.findFrom(n, t);
return !!s && jr(e, s)
}
return !1
}
function Xr(e, t) {
if (!(e.state.selection instanceof Ut)) return !0;
let {
$head: n,
$anchor: r,
empty: o
} = e.state.selection;
if (!n.sameParent(r)) return !0;
if (!o) return !1;
if (e.endOfTextblock(t > 0 ? "forward" : "backward")) return !0;
let i = !n.textOffset && (t < 0 ? n.nodeBefore : n.nodeAfter);
if (i && !i.isText) {
let r = e.state.tr;
return t < 0 ? r.delete(n.pos - i.nodeSize, n.pos) : r.delete(n.pos, n.pos + i.nodeSize), e.dispatch(r), !0
}
return !1
}
function Qr(e, t, n) {
e.domObserver.stop(), t.contentEditable = n, e.domObserver.start()
}
function Yr(e, t) {
let n = t.keyCode,
r = function(e) {
let t = "";
return e.ctrlKey && (t += "c"), e.metaKey && (t += "m"), e.altKey && (t += "a"), e.shiftKey && (t += "s"), t
}(t);
return 8 == n || Mn && 72 == n && "c" == r ? Xr(e, -1) || Wr(e) : 46 == n || Mn && 68 == n && "c" == r ? Xr(e, 1) || Jr(e) : 13 == n || 27 == n || (37 == n || Mn && 66 == n && "c" == r ? $r(e, -1, r) || Wr(e) : 39 == n || Mn && 70 == n && "c" == r ? $r(e, 1, r) || Jr(e) : 38 == n || Mn && 80 == n && "c" == r ? Zr(e, -1, r) || Wr(e) : 40 == n || Mn && 78 == n && "c" == r ? function(e) {
if (!Cn || e.state.selection.$head.parentOffset > 0) return !1;
let {
focusNode: t,
focusOffset: n
} = e.domSelection();
if (t && 1 == t.nodeType && 0 == n && t.firstChild && "false" == t.firstChild.contentEditable) {
let n = t.firstChild;
Qr(e, n, "true"), setTimeout((() => Qr(e, n, "false")), 20)
}
return !1
}(e) || Zr(e, 1, r) || Jr(e) : r == (Mn ? "m" : "c") && (66 == n || 73 == n || 89 == n || 90 == n))
}
function eo(e, t) {
let n = [],
{
content: r,
openStart: o,
openEnd: i
} = t;
for (; o > 1 && i > 1 && 1 == r.childCount && 1 == r.firstChild.childCount;) {
o--, i--;
let e = r.firstChild;
n.push(e.type.name, e.attrs != e.type.defaultAttrs ? e.attrs : null), r = e.content
}
let s = e.someProp("clipboardSerializer") || de.fromSchema(e.state.schema),
a = uo(),
l = a.createElement("div");
l.appendChild(s.serializeFragment(r, {
document: a
}));
let c, u = l.firstChild,
d = 0;
for (; u && 1 == u.nodeType && (c = lo[u.nodeName.toLowerCase()]);) {
for (let e = c.length - 1; e >= 0; e--) {
let t = a.createElement(c[e]);
for (; l.firstChild;) t.appendChild(l.firstChild);
l.appendChild(t), d++
}
u = l.firstChild
}
return u && 1 == u.nodeType && u.setAttribute("data-pm-slice", `${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`), {
dom: l,
text: e.someProp("clipboardTextSerializer", (e => e(t))) || t.content.textBetween(0, t.content.size, "\n\n")
}
}
function to(e, t, n, r, o) {
let i, s, a = o.parent.type.spec.code;
if (!n && !t) return null;
let l = t && (r || a || !n);
if (l) {
if (e.someProp("transformPastedText", (e => {
t = e(t, a || r)
})), a) return t ? new v(d.from(e.state.schema.text(t.replace(/\r\n?/g, "\n"))), 0, 0) : v.empty;
let n = e.someProp("clipboardTextParser", (e => e(t, o, r)));
if (n) s = n;
else {
let n = o.marks(),
{
schema: r
} = e.state,
s = de.fromSchema(r);
i = document.createElement("div"), t.split(/(?:\r\n?|\n)+/).forEach((e => {
let t = i.appendChild(document.createElement("p"));
e && t.appendChild(s.serializeNode(r.text(e, n)))
}))
}
} else e.someProp("transformPastedHTML", (e => {
n = e(n)
})), i = function(e) {
let t = /^(\s*<meta [^>]*>)*/.exec(e);
t && (e = e.slice(t[0].length));
let n, r = uo().createElement("div"),
o = /<([a-z][^>\s]+)/i.exec(e);
(n = o && lo[o[1].toLowerCase()]) && (e = n.map((e => "<" + e + ">")).join("") + e + n.map((e => "</" + e + ">")).reverse().join(""));
if (r.innerHTML = e, n)
for (let e = 0; e < n.length; e++) r = r.querySelector(n[e]) || r;
return r
}(n), En && function(e) {
let t = e.querySelectorAll(kn ? "span:not([class]):not([style])" : "span.Apple-converted-space");
for (let n = 0; n < t.length; n++) {
let r = t[n];
1 == r.childNodes.length && "Â " == r.textContent && r.parentNode && r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "), r)
}
}(i);
let c = i && i.querySelector("[data-pm-slice]"),
u = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
if (u && u[3])
for (let e = +u[3]; e > 0 && i.firstChild; e--) i = i.firstChild;
if (!s) {
let t = e.someProp("clipboardParser") || e.someProp("domParser") || te.fromSchema(e.state.schema);
s = t.parseSlice(i, {
preserveWhitespace: !(!l && !u),
context: o,
ruleFromNode: e => "BR" != e.nodeName || e.nextSibling || !e.parentNode || no.test(e.parentNode.nodeName) ? null : {
ignore: !0
}
})
}
if (u) s = function(e, t) {
if (!e.size) return e;
let n, r = e.content.firstChild.type.schema;
try {
n = JSON.parse(t)
} catch (t) {
return e
}
let {
content: o,
openStart: i,
openEnd: s
} = e;
for (let e = n.length - 2; e >= 0; e -= 2) {
let t = r.nodes[n[e]];
if (!t || t.hasRequiredAttrs()) break;
o = d.from(t.create(n[e + 1], o)), i++, s++
}
return new v(o, i, s)
}(ao(s, +u[1], +u[2]), u[4]);
else if (s = v.maxOpen(function(e, t) {
if (e.childCount < 2) return e;
for (let n = t.depth; n >= 0; n--) {
let r, o = t.node(n).contentMatchAt(t.index(n)),
i = [];
if (e.forEach((e => {
if (!i) return;
let t, n = o.findWrapping(e.type);
if (!n) return i = null;
if (t = i.length && r.length && oo(n, r, e, i[i.length - 1], 0)) i[i.length - 1] = t;
else {
i.length && (i[i.length - 1] = io(i[i.length - 1], r.length));
let t = ro(e, n);
i.push(t), o = o.matchType(t.type), r = n
}
})), i) return d.from(i)
}
return e
}(s.content, o), !0), s.openStart || s.openEnd) {
let e = 0,
t = 0;
for (let t = s.content.firstChild; e < s.openStart && !t.type.spec.isolating; e++, t = t.firstChild);
for (let e = s.content.lastChild; t < s.openEnd && !e.type.spec.isolating; t++, e = e.lastChild);
s = ao(s, e, t)
}
return e.someProp("transformPasted", (e => {
s = e(s)
})), s
}
const no = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
function ro(e, t, n = 0) {
for (let r = t.length - 1; r >= n; r--) e = t[r].create(null, d.from(e));
return e
}
function oo(e, t, n, r, o) {
if (o < e.length && o < t.length && e[o] == t[o]) {
let i = oo(e, t, n, r.lastChild, o + 1);
if (i) return r.copy(r.content.replaceChild(r.childCount - 1, i));
if (r.contentMatchAt(r.childCount).matchType(o == e.length - 1 ? n.type : e[o + 1])) return r.copy(r.content.append(d.from(ro(n, e, o + 1))))
}
}
function io(e, t) {
if (0 == t) return e;
let n = e.content.replaceChild(e.childCount - 1, io(e.lastChild, t - 1)),
r = e.contentMatchAt(e.childCount).fillBefore(d.empty, !0);
return e.copy(n.append(r))
}
function so(e, t, n, r, o, i) {
let s = t < 0 ? e.firstChild : e.lastChild,
a = s.content;
return o < r - 1 && (a = so(a, t, n, r, o + 1, i)), o >= n && (a = t < 0 ? s.contentMatchAt(0).fillBefore(a, e.childCount > 1 || i <= o).append(a) : a.append(s.contentMatchAt(s.childCount).fillBefore(d.empty, !0))), e.replaceChild(t < 0 ? 0 : e.childCount - 1, s.copy(a))
}
function ao(e, t, n) {
return t < e.openStart && (e = new v(so(e.content, -1, t, e.openStart, 0, e.openEnd), t, e.openEnd)), n < e.openEnd && (e = new v(so(e.content, 1, n, e.openEnd, 0, 0), e.openStart, n)), e
}
const lo = {
thead: ["table"],
tbody: ["table"],
tfoot: ["table"],
caption: ["table"],
colgroup: ["table"],
col: ["table", "colgroup"],
tr: ["table", "tbody"],
td: ["table", "tbody", "tr"],
th: ["table", "tbody", "tr"]
};
let co = null;
function uo() {
return co || (co = document.implementation.createHTMLDocument("title"))
}
const po = {};
let ho = {};
class fo {
constructor() {
this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = {
time: 0,
x: 0,
y: 0,
type: ""
}, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastAndroidDelete = 0, this.composing = !1, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.domChangeCount = 0, this.eventHandlers = Object.create(null), this.hideSelectionGuard = null
}
}
function mo(e, t) {
e.input.lastSelectionOrigin = t, e.input.lastSelectionTime = Date.now()
}
function go(e) {
e.someProp("handleDOMEvents", (t => {
for (let n in t) e.input.eventHandlers[n] || e.dom.addEventListener(n, e.input.eventHandlers[n] = t => vo(e, t))
}))
}
function vo(e, t) {
return e.someProp("handleDOMEvents", (n => {
let r = n[t.type];
return !!r && (r(e, t) || t.defaultPrevented)
}))
}
function yo(e, t) {
if (!t.bubbles) return !0;
if (t.defaultPrevented) return !1;
for (let n = t.target; n != e.dom; n = n.parentNode)
if (!n || 11 == n.nodeType || n.pmViewDesc && n.pmViewDesc.stopEvent(t)) return !1;
return !0
}
function bo(e) {
return {
left: e.clientX,
top: e.clientY
}
}
function wo(e, t, n, r, o) {
if (-1 == r) return !1;
let i = e.state.doc.resolve(r);
for (let r = i.depth + 1; r > 0; r--)
if (e.someProp(t, (t => r > i.depth ? t(e, n, i.nodeAfter, i.before(r), o, !0) : t(e, n, i.node(r), i.before(r), o, !1)))) return !0;
return !1
}
function ko(e, t, n) {
e.focused || e.focus();
let r = e.state.tr.setSelection(t);
"pointer" == n && r.setMeta("pointer", !0), e.dispatch(r)
}
function xo(e, t, n, r, o) {
return wo(e, "handleClickOn", t, n, r) || e.someProp("handleClick", (n => n(e, t, r))) || (o ? function(e, t) {
if (-1 == t) return !1;
let n, r, o = e.state.selection;
o instanceof Jt && (n = o.node);
let i = e.state.doc.resolve(t);
for (let e = i.depth + 1; e > 0; e--) {
let t = e > i.depth ? i.nodeAfter : i.node(e);
if (Jt.isSelectable(t)) {
r = n && o.$from.depth > 0 && e >= o.$from.depth && i.before(o.$from.depth + 1) == o.$from.pos ? i.before(o.$from.depth) : i.before(e);
break
}
}
return null != r && (ko(e, Jt.create(e.state.doc, r), "pointer"), !0)
}(e, n) : function(e, t) {
if (-1 == t) return !1;
let n = e.state.doc.resolve(t),
r = n.nodeAfter;
return !!(r && r.isAtom && Jt.isSelectable(r)) && (ko(e, new Jt(n), "pointer"), !0)
}(e, n))
}
function Co(e, t, n, r) {
return wo(e, "handleDoubleClickOn", t, n, r) || e.someProp("handleDoubleClick", (n => n(e, t, r)))
}
function To(e, t, n, r) {
return wo(e, "handleTripleClickOn", t, n, r) || e.someProp("handleTripleClick", (n => n(e, t, r))) || function(e, t, n) {
if (0 != n.button) return !1;
let r = e.state.doc;
if (-1 == t) return !!r.inlineContent && (ko(e, Ut.create(r, 0, r.content.size), "pointer"), !0);
let o = r.resolve(t);
for (let t = o.depth + 1; t > 0; t--) {
let n = t > o.depth ? o.nodeAfter : o.node(t),
i = o.before(t);
if (n.inlineContent) ko(e, Ut.create(r, i + 1, i + 1 + n.content.size), "pointer");
else {
if (!Jt.isSelectable(n)) continue;
ko(e, Jt.create(r, i), "pointer")
}
return !0
}
}(e, n, r)
}
function Mo(e) {
return Lo(e)
}
ho.keydown = (e, t) => {
let n = t;
if (e.input.shiftKey = 16 == n.keyCode || n.shiftKey, !No(e, n) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !Sn || !kn || 13 != n.keyCode))
if (229 != n.keyCode && e.domObserver.forceFlush(), !Tn || 13 != n.keyCode || n.ctrlKey || n.altKey || n.metaKey) e.someProp("handleKeyDown", (t => t(e, n))) || Yr(e, n) ? n.preventDefault() : mo(e, "key");
else {
let t = Date.now();
e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout((() => {
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t => t(e, zn(13, "Enter")))), e.input.lastIOSEnter = 0)
}), 200)
}
}, ho.keyup = (e, t) => {
16 == t.keyCode && (e.input.shiftKey = !1)
}, ho.keypress = (e, t) => {
let n = t;
if (No(e, n) || !n.charCode || n.ctrlKey && !n.altKey || Mn && n.metaKey) return;
if (e.someProp("handleKeyPress", (t => t(e, n)))) return void n.preventDefault();
let r = e.state.selection;
if (!(r instanceof Ut && r.$from.sameParent(r.$to))) {
let t = String.fromCharCode(n.charCode);
e.someProp("handleTextInput", (n => n(e, r.$from.pos, r.$to.pos, t))) || e.dispatch(e.state.tr.insertText(t).scrollIntoView()), n.preventDefault()
}
};
const So = Mn ? "metaKey" : "ctrlKey";
po.mousedown = (e, t) => {
let n = t;
e.input.shiftKey = n.shiftKey;
let r = Mo(e),
o = Date.now(),
i = "singleClick";
o - e.input.lastClick.time < 500 && function(e, t) {
let n = t.x - e.clientX,
r = t.y - e.clientY;
return n * n + r * r < 100
}(n, e.input.lastClick) && !n[So] && ("singleClick" == e.input.lastClick.type ? i = "doubleClick" : "doubleClick" == e.input.lastClick.type && (i = "tripleClick")), e.input.lastClick = {
time: o,
x: n.clientX,
y: n.clientY,
type: i
};
let s = e.posAtCoords(bo(n));
s && ("singleClick" == i ? (e.input.mouseDown && e.input.mouseDown.done(), e.input.mouseDown = new Eo(e, s, n, !!r)) : ("doubleClick" == i ? Co : To)(e, s.pos, s.inside, n) ? n.preventDefault() : mo(e, "pointer"))
};
class Eo {
constructor(e, t, n, r) {
let o, i;
if (this.view = e, this.pos = t, this.event = n, this.flushed = r, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!n[So], this.allowDefault = n.shiftKey, t.inside > -1) o = e.state.doc.nodeAt(t.inside), i = t.inside;
else {
let n = e.state.doc.resolve(t.pos);
o = n.parent, i = n.depth ? n.before() : 0
}
const s = r ? null : n.target,
a = s ? e.docView.nearestDesc(s, !0) : null;
this.target = a ? a.dom : null;
let {
selection: l
} = e.state;
(0 == n.button && o.type.spec.draggable && !1 !== o.type.spec.selectable || l instanceof Jt && l.from <= i && l.to > i) && (this.mightDrag = {
node: o,
pos: i,
addAttr: !(!this.target || this.target.draggable),
setUneditable: !(!this.target || !bn || this.target.hasAttribute("contentEditable"))
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout((() => {
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false")
}), 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), mo(e, "pointer")
}
done() {
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout((() => Ar(this.view))), this.view.input.mouseDown = null
}
up(e) {
if (this.done(), !this.view.dom.contains(e.target)) return;
let t = this.pos;
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(bo(e))), this.allowDefault || !t ? mo(this.view, "pointer") : xo(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : 0 == e.button && (this.flushed || Cn && this.mightDrag && !this.mightDrag.node.isAtom || kn && !(this.view.state.selection instanceof Ut) && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (ko(this.view, Vt.near(this.view.state.doc.resolve(t.pos)), "pointer"), e.preventDefault()) : mo(this.view, "pointer")
}
move(e) {
!this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0), mo(this.view, "pointer"), 0 == e.buttons && this.done()
}
}
function No(e, t) {
return !!e.composing || !!(Cn && Math.abs(t.timeStamp - e.input.compositionEndedAt) < 500) && (e.input.compositionEndedAt = -2e8, !0)
}
po.touchdown = e => {
Mo(e), mo(e, "pointer")
}, po.contextmenu = e => Mo(e);
const Oo = Sn ? 5e3 : -1;
function Do(e, t) {
clearTimeout(e.input.composingTimeout), t > -1 && (e.input.composingTimeout = setTimeout((() => Lo(e)), t))
}
function Ao(e) {
for (e.composing && (e.input.composing = !1, e.input.compositionEndedAt = function() {
let e = document.createEvent("Event");
return e.initEvent("event", !0, !0), e.timeStamp
}()); e.input.compositionNodes.length > 0;) e.input.compositionNodes.pop().markParentsDirty()
}
function Lo(e, t = !1) {
if (!(Sn && e.domObserver.flushingSoon >= 0)) {
if (e.domObserver.forceFlush(), Ao(e), t || e.docView && e.docView.dirty) {
let t = Or(e);
return t && !t.eq(e.state.selection) ? e.dispatch(e.state.tr.setSelection(t)) : e.updateState(e.state), !0
}
return !1
}
}
ho.compositionstart = ho.compositionupdate = e => {
if (!e.composing) {
e.domObserver.flush();
let {
state: t
} = e, n = t.selection.$from;
if (t.selection.empty && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((e => !1 === e.type.spec.inclusive)))) e.markCursor = e.state.storedMarks || n.marks(), Lo(e, !0), e.markCursor = null;
else if (Lo(e), bn && t.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
let t = e.domSelection();
for (let e = t.focusNode, n = t.focusOffset; e && 1 == e.nodeType && 0 != n;) {
let r = n < 0 ? e.lastChild : e.childNodes[n - 1];
if (!r) break;
if (3 == r.nodeType) {
t.collapse(r, r.nodeValue.length);
break
}
e = r, n = -1
}
}
e.input.composing = !0
}
Do(e, Oo)
}, ho.compositionend = (e, t) => {
e.composing && (e.input.composing = !1, e.input.compositionEndedAt = t.timeStamp, Do(e, 20))
};
const Io = vn && yn < 15 || Tn && Nn < 604;
function Ro(e, t, n, r) {
let o = to(e, t, n, e.input.shiftKey, e.state.selection.$from);
if (e.someProp("handlePaste", (t => t(e, r, o || v.empty)))) return !0;
if (!o) return !1;
let i = function(e) {
return 0 == e.openStart && 0 == e.openEnd && 1 == e.content.childCount ? e.content.firstChild : null
}(o),
s = i ? e.state.tr.replaceSelectionWith(i, e.input.shiftKey) : e.state.tr.replaceSelection(o);
return e.dispatch(s.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0
}
po.copy = ho.cut = (e, t) => {
let n = t,
r = e.state.selection,
o = "cut" == n.type;
if (r.empty) return;
let i = Io ? null : n.clipboardData,
s = r.content(),
{
dom: a,
text: l
} = eo(e, s);
i ? (n.preventDefault(), i.clearData(), i.setData("text/html", a.innerHTML), i.setData("text/plain", l)) : function(e, t) {
if (!e.dom.parentNode) return;
let n = e.dom.parentNode.appendChild(document.createElement("div"));
n.appendChild(t), n.style.cssText = "position: fixed; left: -10000px; top: 10px";
let r = getSelection(),
o = document.createRange();
o.selectNodeContents(t), e.dom.blur(), r.removeAllRanges(), r.addRange(o), setTimeout((() => {
n.parentNode && n.parentNode.removeChild(n), e.focus()
}), 50)
}(e, a), o && e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"))
}, ho.paste = (e, t) => {
let n = t;
if (e.composing && !Sn) return;
let r = Io ? null : n.clipboardData;
r && Ro(e, r.getData("text/plain"), r.getData("text/html"), n) ? n.preventDefault() : function(e, t) {
if (!e.dom.parentNode) return;
let n = e.input.shiftKey || e.state.selection.$from.parent.type.spec.code,
r = e.dom.parentNode.appendChild(document.createElement(n ? "textarea" : "div"));
n || (r.contentEditable = "true"), r.style.cssText = "position: fixed; left: -10000px; top: 10px", r.focus(), setTimeout((() => {
e.focus(), r.parentNode && r.parentNode.removeChild(r), n ? Ro(e, r.value, null, t) : Ro(e, r.textContent, r.innerHTML, t)
}), 50)
}(e, n)
};
class Po {
constructor(e, t) {
this.slice = e, this.move = t
}
}
const Bo = Mn ? "altKey" : "ctrlKey";
po.dragstart = (e, t) => {
let n = t,
r = e.input.mouseDown;
if (r && r.done(), !n.dataTransfer) return;
let o = e.state.selection,
i = o.empty ? null : e.posAtCoords(bo(n));
if (i && i.pos >= o.from && i.pos <= (o instanceof Jt ? o.to - 1 : o.to));
else if (r && r.mightDrag) e.dispatch(e.state.tr.setSelection(Jt.create(e.state.doc, r.mightDrag.pos)));
else if (n.target && 1 == n.target.nodeType) {
let t = e.docView.nearestDesc(n.target, !0);
t && t.node.type.spec.draggable && t != e.docView && e.dispatch(e.state.tr.setSelection(Jt.create(e.state.doc, t.posBefore)))
}
let s = e.state.selection.content(),
{
dom: a,
text: l
} = eo(e, s);
n.dataTransfer.clearData(), n.dataTransfer.setData(Io ? "Text" : "text/html", a.innerHTML), n.dataTransfer.effectAllowed = "copyMove", Io || n.dataTransfer.setData("text/plain", l), e.dragging = new Po(s, !n[Bo])
}, po.dragend = e => {
let t = e.dragging;
window.setTimeout((() => {
e.dragging == t && (e.dragging = null)
}), 50)
}, ho.dragover = ho.dragenter = (e, t) => t.preventDefault(), ho.drop = (e, t) => {
let n = t,
r = e.dragging;
if (e.dragging = null, !n.dataTransfer) return;
let o = e.posAtCoords(bo(n));
if (!o) return;
let i = e.state.doc.resolve(o.pos);
if (!i) return;
let s = r && r.slice;
s ? e.someProp("transformPasted", (e => {
s = e(s)
})) : s = to(e, n.dataTransfer.getData(Io ? "Text" : "text/plain"), Io ? null : n.dataTransfer.getData("text/html"), !1, i);
let a = !(!r || n[Bo]);
if (e.someProp("handleDrop", (t => t(e, n, s || v.empty, a)))) return void n.preventDefault();
if (!s) return;
n.preventDefault();
let l = s ? function(e, t, n) {
let r = e.resolve(t);
if (!n.content.size) return t;
let o = n.content;
for (let e = 0; e < n.openStart; e++) o = o.firstChild.content;
for (let e = 1; e <= (0 == n.openStart && n.size ? 2 : 1); e++)
for (let t = r.depth; t >= 0; t--) {
let n = t == r.depth ? 0 : r.pos <= (r.start(t + 1) + r.end(t + 1)) / 2 ? -1 : 1,
i = r.index(t) + (n > 0 ? 1 : 0),
s = r.node(t),
a = !1;
if (1 == e) a = s.canReplace(i, i, o);
else {
let e = s.contentMatchAt(i).findWrapping(o.firstChild.type);
a = e && s.canReplaceWith(i, i, e[0])
}
if (a) return 0 == n ? r.pos : n < 0 ? r.before(t + 1) : r.after(t + 1)
}
return null
}(e.state.doc, i.pos, s) : i.pos;
null == l && (l = i.pos);
let c = e.state.tr;
a && c.deleteSelection();
let u = c.mapping.map(l),
d = 0 == s.openStart && 0 == s.openEnd && 1 == s.content.childCount,
p = c.doc;
if (d ? c.replaceRangeWith(u, u, s.content.firstChild) : c.replaceRange(u, u, s), c.doc.eq(p)) return;
let h = c.doc.resolve(u);
if (d && Jt.isSelectable(s.content.firstChild) && h.nodeAfter && h.nodeAfter.sameMarkup(s.content.firstChild)) c.setSelection(new Jt(h));
else {
let t = c.mapping.map(l);
c.mapping.maps[c.mapping.maps.length - 1].forEach(((e, n, r, o) => t = o)), c.setSelection(Hr(e, h, c.doc.resolve(t)))
}
e.focus(), e.dispatch(c.setMeta("uiEvent", "drop"))
}, po.focus = e => {
e.focused || (e.domObserver.stop(), e.dom.classList.add("ProseMirror-focused"), e.domObserver.start(), e.focused = !0, setTimeout((() => {
e.docView && e.hasFocus() && !e.domObserver.currentSelection.eq(e.domSelection()) && Ar(e)
}), 20))
}, po.blur = (e, t) => {
let n = t;
e.focused && (e.domObserver.stop(), e.dom.classList.remove("ProseMirror-focused"), e.domObserver.start(), n.relatedTarget && e.dom.contains(n.relatedTarget) && e.domObserver.currentSelection.clear(), e.focused = !1)
}, po.beforeinput = (e, t) => {
if (kn && Sn && "deleteContentBackward" == t.inputType) {
e.domObserver.flushSoon();
let {
domChangeCount: t
} = e.input;
setTimeout((() => {
if (e.input.domChangeCount != t) return;
if (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", (t => t(e, zn(8, "Backspace"))))) return;
let {
$cursor: n
} = e.state.selection;
n && n.pos > 0 && e.dispatch(e.state.tr.delete(n.pos - 1, n.pos).scrollIntoView())
}), 50)
}
};
for (let e in ho) po[e] = ho[e];
function Fo(e, t) {
if (e == t) return !0;
for (let n in e)
if (e[n] !== t[n]) return !1;
for (let n in t)
if (!(n in e)) return !1;
return !0
}
class Ho {
constructor(e, t) {
this.toDOM = e, this.spec = t || $o, this.side = this.spec.side || 0
}
map(e, t, n, r) {
let {
pos: o,
deleted: i
} = e.mapResult(t.from + r, this.side < 0 ? -1 : 1);
return i ? null : new Vo(o - n, o - n, this)
}
valid() {
return !0
}
eq(e) {
return this == e || e instanceof Ho && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && Fo(this.spec, e.spec))
}
destroy(e) {
this.spec.destroy && this.spec.destroy(e)
}
}
class zo {
constructor(e, t) {
this.attrs = e, this.spec = t || $o
}
map(e, t, n, r) {
let o = e.map(t.from + r, this.spec.inclusiveStart ? -1 : 1) - n,
i = e.map(t.to + r, this.spec.inclusiveEnd ? 1 : -1) - n;
return o >= i ? null : new Vo(o, i, this)
}
valid(e, t) {
return t.from < t.to
}
eq(e) {
return this == e || e instanceof zo && Fo(this.attrs, e.attrs) && Fo(this.spec, e.spec)
}
static is(e) {
return e.type instanceof zo
}
destroy() {}
}
class qo {
constructor(e, t) {
this.attrs = e, this.spec = t || $o
}
map(e, t, n, r) {
let o = e.mapResult(t.from + r, 1);
if (o.deleted) return null;
let i = e.mapResult(t.to + r, -1);
return i.deleted || i.pos <= o.pos ? null : new Vo(o.pos - n, i.pos - n, this)
}
valid(e, t) {
let n, {
index: r,
offset: o
} = e.content.findIndex(t.from);
return o == t.from && !(n = e.child(r)).isText && o + n.nodeSize == t.to
}
eq(e) {
return this == e || e instanceof qo && Fo(this.attrs, e.attrs) && Fo(this.spec, e.spec)
}
destroy() {}
}
class Vo {
constructor(e, t, n) {
this.from = e, this.to = t, this.type = n
}
copy(e, t) {
return new Vo(e, t, this.type)
}
eq(e, t = 0) {
return this.type.eq(e.type) && this.from + t == e.from && this.to + t == e.to
}
map(e, t, n) {
return this.type.map(e, this, t, n)
}
static widget(e, t, n) {
return new Vo(e, e, new Ho(t, n))
}
static inline(e, t, n, r) {
return new Vo(e, t, new zo(n, r))
}
static node(e, t, n, r) {
return new Vo(e, t, new qo(n, r))
}
get spec() {
return this.type.spec
}
get inline() {
return this.type instanceof zo
}
}
const jo = [],
$o = {};
class _o {
constructor(e, t) {
this.local = e.length ? e : jo, this.children = t.length ? t : jo
}
static create(e, t) {
return t.length ? Zo(t, e, 0, $o) : Uo
}
find(e, t, n) {
let r = [];
return this.findInner(null == e ? 0 : e, null == t ? 1e9 : t, r, 0, n), r
}
findInner(e, t, n, r, o) {
for (let i = 0; i < this.local.length; i++) {
let s = this.local[i];
s.from <= t && s.to >= e && (!o || o(s.spec)) && n.push(s.copy(s.from + r, s.to + r))
}
for (let i = 0; i < this.children.length; i += 3)
if (this.children[i] < t && this.children[i + 1] > e) {
let s = this.children[i] + 1;
this.children[i + 2].findInner(e - s, t - s, n, r + s, o)
}
}
map(e, t, n) {
return this == Uo || 0 == e.maps.length ? this : this.mapInner(e, t, 0, 0, n || $o)
}
mapInner(e, t, n, r, o) {
let i;
for (let s = 0; s < this.local.length; s++) {
let a = this.local[s].map(e, n, r);
a && a.type.valid(t, a) ? (i || (i = [])).push(a) : o.onRemove && o.onRemove(this.local[s].spec)
}
return this.children.length ? function(e, t, n, r, o, i, s) {
let a = e.slice(),
l = (e, t, n, r) => {
for (let s = 0; s < a.length; s += 3) {
let l, c = a[s + 1];
if (c < 0 || e > c + i) continue;
let u = a[s] + i;
t >= u ? a[s + 1] = e <= u ? -2 : -1 : n >= o && (l = r - n - (t - e)) && (a[s] += l, a[s + 1] += l)
}
};
for (let e = 0; e < n.maps.length; e++) n.maps[e].forEach(l);
let c = !1;
for (let t = 0; t < a.length; t += 3)
if (a[t + 1] < 0) {
if (-2 == a[t + 1]) {
c = !0, a[t + 1] = -1;
continue
}
let l = n.map(e[t] + i),
u = l - o;
if (u < 0 || u >= r.content.size) {
c = !0;
continue
}
let d = n.map(e[t + 1] + i, -1) - o,
{
index: p,
offset: h
} = r.content.findIndex(u),
f = r.maybeChild(p);
if (f && h == u && h + f.nodeSize == d) {
let r = a[t + 2].mapInner(n, f, l + 1, e[t] + i + 1, s);
r != Uo ? (a[t] = u, a[t + 1] = d, a[t + 2] = r) : (a[t + 1] = -2, c = !0)
} else c = !0
} if (c) {
let l = function(e, t, n, r, o, i, s) {
function a(e, t) {
for (let i = 0; i < e.local.length; i++) {
let a = e.local[i].map(r, o, t);
a ? n.push(a) : s.onRemove && s.onRemove(e.local[i].spec)
}
for (let n = 0; n < e.children.length; n += 3) a(e.children[n + 2], e.children[n] + t + 1)
}
for (let n = 0; n < e.length; n += 3) - 1 == e[n + 1] && a(e[n + 2], t[n] + i + 1);
return n
}(a, e, t, n, o, i, s),
c = Zo(l, r, 0, s);
t = c.local;
for (let e = 0; e < a.length; e += 3) a[e + 1] < 0 && (a.splice(e, 3), e -= 3);
for (let e = 0, t = 0; e < c.children.length; e += 3) {
let n = c.children[e];
for (; t < a.length && a[t] < n;) t += 3;
a.splice(t, 0, c.children[e], c.children[e + 1], c.children[e + 2])
}
}
return new _o(t.sort(Xo), a)
}(this.children, i || [], e, t, n, r, o) : i ? new _o(i.sort(Xo), jo) : Uo
}
add(e, t) {
return t.length ? this == Uo ? _o.create(e, t) : this.addInner(e, t, 0) : this
}
addInner(e, t, n) {
let r, o = 0;
e.forEach(((e, i) => {
let s, a = i + n;
if (s = Go(t, e, a)) {
for (r || (r = this.children.slice()); o < r.length && r[o] < i;) o += 3;
r[o] == i ? r[o + 2] = r[o + 2].addInner(e, s, a + 1) : r.splice(o, 0, i, i + e.nodeSize, Zo(s, e, a + 1, $o)), o += 3
}
}));
let i = Jo(o ? Ko(t) : t, -n);
for (let t = 0; t < i.length; t++) i[t].type.valid(e, i[t]) || i.splice(t--, 1);
return new _o(i.length ? this.local.concat(i).sort(Xo) : this.local, r || this.children)
}
remove(e) {
return 0 == e.length || this == Uo ? this : this.removeInner(e, 0)
}
removeInner(e, t) {
let n = this.children,
r = this.local;
for (let r = 0; r < n.length; r += 3) {
let o, i = n[r] + t,
s = n[r + 1] + t;
for (let t, n = 0; n < e.length; n++)(t = e[n]) && t.from > i && t.to < s && (e[n] = null, (o || (o = [])).push(t));
if (!o) continue;
n == this.children && (n = this.children.slice());
let a = n[r + 2].removeInner(o, i + 1);
a != Uo ? n[r + 2] = a : (n.splice(r, 3), r -= 3)
}
if (r.length)
for (let n, o = 0; o < e.length; o++)
if (n = e[o])
for (let e = 0; e < r.length; e++) r[e].eq(n, t) && (r == this.local && (r = this.local.slice()), r.splice(e--, 1));
return n == this.children && r == this.local ? this : r.length || n.length ? new _o(r, n) : Uo
}
forChild(e, t) {
if (this == Uo) return this;
if (t.isLeaf) return _o.empty;
let n, r;
for (let t = 0; t < this.children.length; t += 3)
if (this.children[t] >= e) {
this.children[t] == e && (n = this.children[t + 2]);
break
} let o = e + 1,
i = o + t.content.size;
for (let e = 0; e < this.local.length; e++) {
let t = this.local[e];
if (t.from < i && t.to > o && t.type instanceof zo) {
let e = Math.max(o, t.from) - o,
n = Math.min(i, t.to) - o;
e < n && (r || (r = [])).push(t.copy(e, n))
}
}
if (r) {
let e = new _o(r.sort(Xo), jo);
return n ? new Wo([e, n]) : e
}
return n || Uo
}
eq(e) {
if (this == e) return !0;
if (!(e instanceof _o) || this.local.length != e.local.length || this.children.length != e.children.length) return !1;
for (let t = 0; t < this.local.length; t++)
if (!this.local[t].eq(e.local[t])) return !1;
for (let t = 0; t < this.children.length; t += 3)
if (this.children[t] != e.children[t] || this.children[t + 1] != e.children[t + 1] || !this.children[t + 2].eq(e.children[t + 2])) return !1;
return !0
}
locals(e) {
return Qo(this.localsInner(e))
}
localsInner(e) {
if (this == Uo) return jo;
if (e.inlineContent || !this.local.some(zo.is)) return this.local;
let t = [];
for (let e = 0; e < this.local.length; e++) this.local[e].type instanceof zo || t.push(this.local[e]);
return t
}
}
_o.empty = new _o([], []), _o.removeOverlap = Qo;
const Uo = _o.empty;
class Wo {
constructor(e) {
this.members = e
}
map(e, t) {
const n = this.members.map((n => n.map(e, t, $o)));
return Wo.from(n)
}
forChild(e, t) {
if (t.isLeaf) return _o.empty;
let n = [];
for (let r = 0; r < this.members.length; r++) {
let o = this.members[r].forChild(e, t);
o != Uo && (o instanceof Wo ? n = n.concat(o.members) : n.push(o))
}
return Wo.from(n)
}
eq(e) {
if (!(e instanceof Wo) || e.members.length != this.members.length) return !1;
for (let t = 0; t < this.members.length; t++)
if (!this.members[t].eq(e.members[t])) return !1;
return !0
}
locals(e) {
let t, n = !0;
for (let r = 0; r < this.members.length; r++) {
let o = this.members[r].localsInner(e);
if (o.length)
if (t) {
n && (t = t.slice(), n = !1);
for (let e = 0; e < o.length; e++) t.push(o[e])
} else t = o
}
return t ? Qo(n ? t : t.sort(Xo)) : jo
}
static from(e) {
switch (e.length) {
case 0:
return Uo;
case 1:
return e[0];
default:
return new Wo(e)
}
}
}
function Jo(e, t) {
if (!t || !e.length) return e;
let n = [];
for (let r = 0; r < e.length; r++) {
let o = e[r];
n.push(new Vo(o.from + t, o.to + t, o.type))
}
return n
}
function Go(e, t, n) {
if (t.isLeaf) return null;
let r = n + t.nodeSize,
o = null;
for (let t, i = 0; i < e.length; i++)(t = e[i]) && t.from > n && t.to < r && ((o || (o = [])).push(t), e[i] = null);
return o
}
function Ko(e) {
let t = [];
for (let n = 0; n < e.length; n++) null != e[n] && t.push(e[n]);
return t
}
function Zo(e, t, n, r) {
let o = [],
i = !1;
t.forEach(((t, s) => {
let a = Go(e, t, s + n);
if (a) {
i = !0;
let e = Zo(a, t, n + s + 1, r);
e != Uo && o.push(s, s + t.nodeSize, e)
}
}));
let s = Jo(i ? Ko(e) : e, -n).sort(Xo);
for (let e = 0; e < s.length; e++) s[e].type.valid(t, s[e]) || (r.onRemove && r.onRemove(s[e].spec), s.splice(e--, 1));
return s.length || o.length ? new _o(s, o) : Uo
}
function Xo(e, t) {
return e.from - t.from || e.to - t.to
}
function Qo(e) {
let t = e;
for (let n = 0; n < t.length - 1; n++) {
let r = t[n];
if (r.from != r.to)
for (let o = n + 1; o < t.length; o++) {
let i = t[o];
if (i.from != r.from) {
i.from < r.to && (t == e && (t = e.slice()), t[n] = r.copy(r.from, i.from), Yo(t, o, r.copy(i.from, r.to)));
break
}
i.to != r.to && (t == e && (t = e.slice()), t[o] = i.copy(i.from, r.to), Yo(t, o + 1, i.copy(r.to, i.to)))
}
}
return t
}
function Yo(e, t, n) {
for (; t < e.length && Xo(n, e[t]) > 0;) t++;
e.splice(t, 0, n)
}
function ei(e) {
let t = [];
return e.someProp("decorations", (n => {
let r = n(e.state);
r && r != Uo && t.push(r)
})), e.cursorWrapper && t.push(_o.create(e.state.doc, [e.cursorWrapper.deco])), Wo.from(t)
}
const ti = {
childList: !0,
characterData: !0,
characterDataOldValue: !0,
attributes: !0,
attributeOldValue: !0,
subtree: !0
},
ni = vn && yn <= 11;
class ri {
constructor() {
this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0
}
set(e) {
this.anchorNode = e.anchorNode, this.anchorOffset = e.anchorOffset, this.focusNode = e.focusNode, this.focusOffset = e.focusOffset
}
clear() {
this.anchorNode = this.focusNode = null
}
eq(e) {
return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset
}
}
class oi {
constructor(e, t) {
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new ri, this.onCharData = null, this.suppressingSelectionUpdates = !1, this.observer = window.MutationObserver && new window.MutationObserver((e => {
for (let t = 0; t < e.length; t++) this.queue.push(e[t]);
vn && yn <= 11 && e.some((e => "childList" == e.type && e.removedNodes.length || "characterData" == e.type && e.oldValue.length > e.target.nodeValue.length)) ? this.flushSoon() : this.flush()
})), ni && (this.onCharData = e => {
this.queue.push({
target: e.target,
type: "characterData",
oldValue: e.prevValue
}), this.flushSoon()
}), this.onSelectionChange = this.onSelectionChange.bind(this)
}
flushSoon() {
this.flushingSoon < 0 && (this.flushingSoon = window.setTimeout((() => {
this.flushingSoon = -1, this.flush()
}), 20))
}
forceFlush() {
this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush())
}
start() {
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, ti)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection()
}
stop() {
if (this.observer) {
let e = this.observer.takeRecords();
if (e.length) {
for (let t = 0; t < e.length; t++) this.queue.push(e[t]);
window.setTimeout((() => this.flush()), 20)
}
this.observer.disconnect()
}
this.onCharData && this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData), this.disconnectSelection()
}
connectSelection() {
this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange)
}
disconnectSelection() {
this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange)
}
suppressSelectionUpdates() {
this.suppressingSelectionUpdates = !0, setTimeout((() => this.suppressingSelectionUpdates = !1), 50)
}
onSelectionChange() {
if (zr(this.view)) {
if (this.suppressingSelectionUpdates) return Ar(this.view);
if (vn && yn <= 11 && !this.view.state.selection.empty) {
let e = this.view.domSelection();
if (e.focusNode && In(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset)) return this.flushSoon()
}
this.flush()
}
}
setCurSelection() {
this.currentSelection.set(this.view.domSelection())
}
ignoreSelectionChange(e) {
if (0 == e.rangeCount) return !0;
let t = e.getRangeAt(0).commonAncestorContainer,
n = this.view.docView.nearestDesc(t);
return n && n.ignoreMutation({
type: "selection",
target: 3 == t.nodeType ? t.parentNode : t
}) ? (this.setCurSelection(), !0) : void 0
}
flush() {
if (!this.view.docView || this.flushingSoon > -1) return;
let e = this.observer ? this.observer.takeRecords() : [];
this.queue.length && (e = this.queue.concat(e), this.queue.length = 0);
let t = this.view.domSelection(),
n = !this.suppressingSelectionUpdates && !this.currentSelection.eq(t) && zr(this.view) && !this.ignoreSelectionChange(t),
r = -1,
o = -1,
i = !1,
s = [];
if (this.view.editable)
for (let t = 0; t < e.length; t++) {
let n = this.registerMutation(e[t], s);
n && (r = r < 0 ? n.from : Math.min(n.from, r), o = o < 0 ? n.to : Math.max(n.to, o), n.typeOver && (i = !0))
}
if (bn && s.length > 1) {
let e = s.filter((e => "BR" == e.nodeName));
if (2 == e.length) {
let t = e[0],
n = e[1];
t.parentNode && t.parentNode.parentNode == n.parentNode ? n.remove() : t.remove()
}
}(r > -1 || n) && (r > -1 && (this.view.docView.markDirty(r, o), function(e) {
if (ii) return;
ii = !0, "normal" == getComputedStyle(e.dom).whiteSpace && console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")
}(this.view)), this.handleDOMChange(r, o, i, s), this.view.docView && this.view.docView.dirty ? this.view.updateState(this.view.state) : this.currentSelection.eq(t) || Ar(this.view), this.currentSelection.set(t))
}
registerMutation(e, t) {
if (t.indexOf(e.target) > -1) return null;
let n = this.view.docView.nearestDesc(e.target);
if ("attributes" == e.type && (n == this.view.docView || "contenteditable" == e.attributeName || "style" == e.attributeName && !e.oldValue && !e.target.getAttribute("style"))) return null;
if (!n || n.ignoreMutation(e)) return null;
if ("childList" == e.type) {
for (let n = 0; n < e.addedNodes.length; n++) t.push(e.addedNodes[n]);
if (n.contentDOM && n.contentDOM != n.dom && !n.contentDOM.contains(e.target)) return {
from: n.posBefore,
to: n.posAfter
};
let r = e.previousSibling,
o = e.nextSibling;
if (vn && yn <= 11 && e.addedNodes.length)
for (let t = 0; t < e.addedNodes.length; t++) {
let {
previousSibling: n,
nextSibling: i
} = e.addedNodes[t];
(!n || Array.prototype.indexOf.call(e.addedNodes, n) < 0) && (r = n), (!i || Array.prototype.indexOf.call(e.addedNodes, i) < 0) && (o = i)
}
let i = r && r.parentNode == e.target ? On(r) + 1 : 0,
s = n.localPosFromDOM(e.target, i, -1),
a = o && o.parentNode == e.target ? On(o) : e.target.childNodes.length;
return {
from: s,
to: n.localPosFromDOM(e.target, a, 1)
}
}
return "attributes" == e.type ? {
from: n.posAtStart - n.border,
to: n.posAtEnd + n.border
} : {
from: n.posAtStart,
to: n.posAtEnd,
typeOver: e.target.nodeValue == e.oldValue
}
}
}
let ii = !1;
function si(e) {
let t = e.pmViewDesc;
if (t) return t.parseRule();
if ("BR" == e.nodeName && e.parentNode) {
if (Cn && /^(ul|ol)$/i.test(e.parentNode.nodeName)) {
let e = document.createElement("div");
return e.appendChild(document.createElement("li")), {
skip: e
}
}
if (e.parentNode.lastChild == e || Cn && /^(tr|table)$/i.test(e.parentNode.nodeName)) return {
ignore: !0
}
} else if ("IMG" == e.nodeName && e.getAttribute("mark-placeholder")) return {
ignore: !0
};
return null
}
function ai(e, t, n, r, o) {
if (t < 0) {
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null,
n = Or(e, t);
if (n && !e.state.selection.eq(n)) {
let r = e.state.tr.setSelection(n);
"pointer" == t ? r.setMeta("pointer", !0) : "key" == t && r.scrollIntoView(), e.dispatch(r)
}
return
}
let i = e.state.doc.resolve(t),
s = i.sharedDepth(n);
t = i.before(s + 1), n = e.state.doc.resolve(n).after(s + 1);
let a = e.state.selection,
l = function(e, t, n) {
let r, {
node: o,
fromOffset: i,
toOffset: s,
from: a,
to: l
} = e.docView.parseRange(t, n),
c = e.domSelection(),
u = c.anchorNode;
if (u && e.dom.contains(1 == u.nodeType ? u : u.parentNode) && (r = [{
node: u,
offset: c.anchorOffset
}], Hn(c) || r.push({
node: c.focusNode,
offset: c.focusOffset
})), kn && 8 === e.input.lastKeyCode)
for (let e = s; e > i; e--) {
let t = o.childNodes[e - 1],
n = t.pmViewDesc;
if ("BR" == t.nodeName && !n) {
s = e;
break
}
if (!n || n.size) break
}
let d = e.state.doc,
p = e.someProp("domParser") || te.fromSchema(e.state.schema),
h = d.resolve(a),
f = null,
m = p.parse(o, {
topNode: h.parent,
topMatch: h.parent.contentMatchAt(h.index()),
topOpen: !0,
from: i,
to: s,
preserveWhitespace: "pre" != h.parent.type.whitespace || "full",
findPositions: r,
ruleFromNode: si,
context: h
});
if (r && null != r[0].pos) {
let e = r[0].pos,
t = r[1] && r[1].pos;
null == t && (t = e), f = {
anchor: e + a,
head: t + a
}
}
return {
doc: m,
sel: f,
from: a,
to: l
}
}(e, t, n);
if (kn && e.cursorWrapper && l.sel && l.sel.anchor == e.cursorWrapper.deco.from && l.sel.head == l.sel.anchor) {
let t = e.cursorWrapper.deco.type.toDOM.nextSibling,
n = t && t.nodeValue ? t.nodeValue.length : 1;
l.sel = {
anchor: l.sel.anchor + n,
head: l.sel.anchor + n
}
}
let c, u, p = e.state.doc,
h = p.slice(l.from, l.to);
8 === e.input.lastKeyCode && Date.now() - 100 < e.input.lastKeyCodeTime ? (c = e.state.selection.to, u = "end") : (c = e.state.selection.from, u = "start"), e.input.lastKeyCode = null;
let f = function(e, t, n, r, o) {
let i = e.findDiffStart(t, n);
if (null == i) return null;
let {
a: s,
b: a
} = e.findDiffEnd(t, n + e.size, n + t.size);
if ("end" == o) {
r -= s + Math.max(0, i - Math.min(s, a)) - i
}
if (s < i && e.size < t.size) {
i -= r <= i && r >= s ? i - r : 0, a = i + (a - s), s = i
} else if (a < i) {
i -= r <= i && r >= a ? i - r : 0, s = i + (s - a), a = i
}
return {
start: i,
endA: s,
endB: a
}
}(h.content, l.doc.content, l.from, c, u);
if ((Tn && e.input.lastIOSEnter > Date.now() - 225 || Sn) && o.some((e => "DIV" == e.nodeName || "P" == e.nodeName)) && (!f || f.endA >= f.endB) && e.someProp("handleKeyDown", (t => t(e, zn(13, "Enter"))))) return void(e.input.lastIOSEnter = 0);
if (!f) {
if (!(r && a instanceof Ut && !a.empty && a.$head.sameParent(a.$anchor)) || e.composing || l.sel && l.sel.anchor != l.sel.head) {
if (l.sel) {
let t = li(e, e.state.doc, l.sel);
t && !t.eq(e.state.selection) && e.dispatch(e.state.tr.setSelection(t))
}
return
}
f = {
start: a.from,
endA: a.to,
endB: a.to
}
}
e.input.domChangeCount++, e.state.selection.from < e.state.selection.to && f.start == f.endB && e.state.selection instanceof Ut && (f.start > e.state.selection.from && f.start <= e.state.selection.from + 2 && e.state.selection.from >= l.from ? f.start = e.state.selection.from : f.endA < e.state.selection.to && f.endA >= e.state.selection.to - 2 && e.state.selection.to <= l.to && (f.endB += e.state.selection.to - f.endA, f.endA = e.state.selection.to)), vn && yn <= 11 && f.endB == f.start + 1 && f.endA == f.start && f.start > l.from && " Â " == l.doc.textBetween(f.start - l.from - 1, f.start - l.from + 1) && (f.start--, f.endA--, f.endB--);
let m, g = l.doc.resolveNoCache(f.start - l.from),
v = l.doc.resolveNoCache(f.endB - l.from),
y = p.resolve(f.start),
b = g.sameParent(v) && g.parent.inlineContent && y.end() >= f.endA;
if ((Tn && e.input.lastIOSEnter > Date.now() - 225 && (!b || o.some((e => "DIV" == e.nodeName || "P" == e.nodeName))) || !b && g.pos < l.doc.content.size && (m = Vt.findFrom(l.doc.resolve(g.pos + 1), 1, !0)) && m.head == v.pos) && e.someProp("handleKeyDown", (t => t(e, zn(13, "Enter"))))) return void(e.input.lastIOSEnter = 0);
if (e.state.selection.anchor > f.start && function(e, t, n, r, o) {
if (!r.parent.isTextblock || n - t <= o.pos - r.pos || ci(r, !0, !1) < o.pos) return !1;
let i = e.resolve(t);
if (i.parentOffset < i.parent.content.size || !i.parent.isTextblock) return !1;
let s = e.resolve(ci(i, !0, !0));
return !(!s.parent.isTextblock || s.pos > n || ci(s, !0, !1) < n) && r.parent.content.cut(r.parentOffset).eq(s.parent.content)
}(p, f.start, f.endA, g, v) && e.someProp("handleKeyDown", (t => t(e, zn(8, "Backspace"))))) return void(Sn && kn && e.domObserver.suppressSelectionUpdates());
kn && Sn && f.endB == f.start && (e.input.lastAndroidDelete = Date.now()), Sn && !b && g.start() != v.start() && 0 == v.parentOffset && g.depth == v.depth && l.sel && l.sel.anchor == l.sel.head && l.sel.head == f.endA && (f.endB -= 2, v = l.doc.resolveNoCache(f.endB - l.from), setTimeout((() => {
e.someProp("handleKeyDown", (function(t) {
return t(e, zn(13, "Enter"))
}))
}), 20));
let w, k, x, C = f.start,
T = f.endA;
if (b)
if (g.pos == v.pos) vn && yn <= 11 && 0 == g.parentOffset && (e.domObserver.suppressSelectionUpdates(), setTimeout((() => Ar(e)), 20)), w = e.state.tr.delete(C, T), k = p.resolve(f.start).marksAcross(p.resolve(f.endA));
else if (f.endA == f.endB && (x = function(e, t) {
let n, r, o, i = e.firstChild.marks,
s = t.firstChild.marks,
a = i,
l = s;
for (let e = 0; e < s.length; e++) a = s[e].removeFromSet(a);
for (let e = 0; e < i.length; e++) l = i[e].removeFromSet(l);
if (1 == a.length && 0 == l.length) r = a[0], n = "add", o = e => e.mark(r.addToSet(e.marks));
else {
if (0 != a.length || 1 != l.length) return null;
r = l[0], n = "remove", o = e => e.mark(r.removeFromSet(e.marks))
}
let c = [];
for (let e = 0; e < t.childCount; e++) c.push(o(t.child(e)));
if (d.from(c).eq(e)) return {
mark: r,
type: n
}
}(g.parent.content.cut(g.parentOffset, v.parentOffset), y.parent.content.cut(y.parentOffset, f.endA - y.start())))) w = e.state.tr, "add" == x.type ? w.addMark(C, T, x.mark) : w.removeMark(C, T, x.mark);
else if (g.parent.child(g.index()).isText && g.index() == v.index() - (v.textOffset ? 0 : 1)) {
let t = g.parent.textBetween(g.parentOffset, v.parentOffset);
if (e.someProp("handleTextInput", (n => n(e, C, T, t)))) return;
w = e.state.tr.insertText(t, C, T)
}
if (w || (w = e.state.tr.replace(C, T, l.doc.slice(f.start - l.from, f.endB - l.from))), l.sel) {
let t = li(e, w.doc, l.sel);
t && !(kn && Sn && e.composing && t.empty && (f.start != f.endB || e.input.lastAndroidDelete < Date.now() - 100) && (t.head == C || t.head == w.mapping.map(T) - 1) || vn && t.empty && t.head == C) && w.setSelection(t)
}
k && w.ensureMarks(k), e.dispatch(w.scrollIntoView())
}
function li(e, t, n) {
return Math.max(n.anchor, n.head) > t.content.size ? null : Hr(e, t.resolve(n.anchor), t.resolve(n.head))
}
function ci(e, t, n) {
let r = e.depth,
o = t ? e.end() : e.pos;
for (; r > 0 && (t || e.indexAfter(r) == e.node(r).childCount);) r--, o++, t = !1;
if (n) {
let t = e.node(r).maybeChild(e.indexAfter(r));
for (; t && !t.isLeaf;) t = t.firstChild, o++
}
return o
}
class ui {
constructor(e, t) {
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new fo, this.prevDirectPlugins = [], this.pluginViews = [], this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(mi), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : "function" == typeof e ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = hi(this), pi(this), this.nodeViews = fi(this), this.docView = hr(this.state.doc, di(this), ei(this), this.dom, this), this.domObserver = new oi(this, ((e, t, n, r) => ai(this, e, t, n, r))), this.domObserver.start(),
function(e) {
for (let t in po) {
let n = po[t];
e.dom.addEventListener(t, e.input.eventHandlers[t] = t => {
!yo(e, t) || vo(e, t) || !e.editable && t.type in ho || n(e, t)
})
}
Cn && e.dom.addEventListener("input", (() => null)), go(e)
}(this), this.updatePluginViews()
}
get composing() {
return this.input.composing
}
get props() {
if (this._props.state != this.state) {
let e = this._props;
this._props = {};
for (let t in e) this._props[t] = e[t];
this._props.state = this.state
}
return this._props
}
update(e) {
e.handleDOMEvents != this._props.handleDOMEvents && go(this), this._props = e, e.plugins && (e.plugins.forEach(mi), this.directPlugins = e.plugins), this.updateStateInner(e.state, !0)
}
setProps(e) {
let t = {};
for (let e in this._props) t[e] = this._props[e];
t.state = this.state;
for (let n in e) t[n] = e[n];
this.update(t)
}
updateState(e) {
this.updateStateInner(e, this.state.plugins != e.plugins)
}
updateStateInner(e, t) {
let n = this.state,
r = !1,
o = !1;
if (e.storedMarks && this.composing && (Ao(this), o = !0), this.state = e, t) {
let e = fi(this);
(function(e, t) {
let n = 0,
r = 0;
for (let r in e) {
if (e[r] != t[r]) return !0;
n++
}
for (let e in t) r++;
return n != r
})(e, this.nodeViews) && (this.nodeViews = e, r = !0), go(this)
}
this.editable = hi(this), pi(this);
let i = ei(this),
s = di(this),
a = t ? "reset" : e.scrollToSelection > n.scrollToSelection ? "to selection" : "preserve",
l = r || !this.docView.matchesNode(e.doc, s, i);
!l && e.selection.eq(n.selection) || (o = !0);
let c = "preserve" == a && o && null == this.dom.style.overflowAnchor && function(e) {
let t, n, r = e.dom.getBoundingClientRect(),
o = Math.max(0, r.top);
for (let i = (r.left + r.right) / 2, s = o + 1; s < Math.min(innerHeight, r.bottom); s += 5) {
let r = e.root.elementFromPoint(i, s);
if (!r || r == e.dom || !e.dom.contains(r)) continue;
let a = r.getBoundingClientRect();
if (a.top >= o - 20) {
t = r, n = a.top;
break
}
}
return {
refDOM: t,
refTop: n,
stack: _n(e.dom)
}
}(this);
if (o) {
this.domObserver.stop();
let t = l && (vn || kn) && !this.composing && !n.selection.empty && !e.selection.empty && function(e, t) {
let n = Math.min(e.$anchor.sharedDepth(e.head), t.$anchor.sharedDepth(t.head));
return e.$anchor.start(n) != t.$anchor.start(n)
}(n.selection, e.selection);
if (l) {
let n = kn ? this.trackWrites = this.domSelection().focusNode : null;
!r && this.docView.update(e.doc, s, i, this) || (this.docView.updateOuterDeco([]), this.docView.destroy(), this.docView = hr(e.doc, s, i, this.dom, this)), n && !this.trackWrites && (t = !0)
}
t || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelection()) && function(e) {
let t = e.docView.domFromPos(e.state.selection.anchor, 0),
n = e.domSelection();
return In(t.node, t.offset, n.anchorNode, n.anchorOffset)
}(this)) ? Ar(this, t) : (Br(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start()
}
if (this.updatePluginViews(n), "reset" == a) this.dom.scrollTop = 0;
else if ("to selection" == a) {
let t = this.domSelection().focusNode;
if (this.someProp("handleScrollToSelection", (e => e(this))));
else if (e.selection instanceof Jt) {
let n = this.docView.domAfterPos(e.selection.from);
1 == n.nodeType && $n(this, n.getBoundingClientRect(), t)
} else $n(this, this.coordsAtPos(e.selection.head, 1), t)
} else c && function({
refDOM: e,
refTop: t,
stack: n
}) {
let r = e ? e.getBoundingClientRect().top : 0;
Un(n, 0 == r ? 0 : r - t)
}(c)
}
destroyPluginViews() {
let e;
for (; e = this.pluginViews.pop();) e.destroy && e.destroy()
}
updatePluginViews(e) {
if (e && e.plugins == this.state.plugins && this.directPlugins == this.prevDirectPlugins)
for (let t = 0; t < this.pluginViews.length; t++) {
let n = this.pluginViews[t];
n.update && n.update(this, e)
} else {
this.prevDirectPlugins = this.directPlugins, this.destroyPluginViews();
for (let e = 0; e < this.directPlugins.length; e++) {
let t = this.directPlugins[e];
t.spec.view && this.pluginViews.push(t.spec.view(this))
}
for (let e = 0; e < this.state.plugins.length; e++) {
let t = this.state.plugins[e];
t.spec.view && this.pluginViews.push(t.spec.view(this))
}
}
}
someProp(e, t) {
let n, r = this._props && this._props[e];
if (null != r && (n = t ? t(r) : r)) return n;
for (let r = 0; r < this.directPlugins.length; r++) {
let o = this.directPlugins[r].props[e];
if (null != o && (n = t ? t(o) : o)) return n
}
let o = this.state.plugins;
if (o)
for (let r = 0; r < o.length; r++) {
let i = o[r].props[e];
if (null != i && (n = t ? t(i) : i)) return n
}
}
hasFocus() {
return this.root.activeElement == this.dom
}
focus() {
this.domObserver.stop(), this.editable && function(e) {
if (e.setActive) return e.setActive();
if (Wn) return e.focus(Wn);
let t = _n(e);
e.focus(null == Wn ? {
get preventScroll() {
return Wn = {
preventScroll: !0
}, !0
}
} : void 0), Wn || (Wn = !1, Un(t, 0))
}(this.dom), Ar(this), this.domObserver.start()
}
get root() {
let e = this._root;
if (null == e)
for (let e = this.dom.parentNode; e; e = e.parentNode)
if (9 == e.nodeType || 11 == e.nodeType && e.host) return e.getSelection || (Object.getPrototypeOf(e).getSelection = () => e.ownerDocument.getSelection()), this._root = e;
return e || document
}
posAtCoords(e) {
return Zn(this, e)
}
coordsAtPos(e, t = 1) {
return Yn(this, e, t)
}
domAtPos(e, t = 0) {
return this.docView.domFromPos(e, t)
}
nodeDOM(e) {
let t = this.docView.descAt(e);
return t ? t.nodeDOM : null
}
posAtDOM(e, t, n = -1) {
let r = this.docView.posFromDOM(e, t, n);
if (null == r) throw new RangeError("DOM position not inside the editor");
return r
}
endOfTextblock(e, t) {
return ar(this, t || this.state, e)
}
destroy() {
this.docView && (! function(e) {
e.domObserver.stop();
for (let t in e.input.eventHandlers) e.dom.removeEventListener(t, e.input.eventHandlers[t]);
clearTimeout(e.input.composingTimeout), clearTimeout(e.input.lastIOSEnterFallbackTimeout)
}(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], ei(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null)
}
get isDestroyed() {
return null == this.docView
}
dispatchEvent(e) {
return function(e, t) {
vo(e, t) || !po[t.type] || !e.editable && t.type in ho || po[t.type](e, t)
}(this, e)
}
dispatch(e) {
let t = this._props.dispatchTransaction;
t ? t.call(this, e) : this.updateState(this.state.apply(e))
}
domSelection() {
return this.root.getSelection()
}
}
function di(e) {
let t = Object.create(null);
return t.class = "ProseMirror", t.contenteditable = String(e.editable), t.translate = "no", e.someProp("attributes", (n => {
if ("function" == typeof n && (n = n(e.state)), n)
for (let e in n) "class" == e && (t.class += " " + n[e]), "style" == e ? t.style = (t.style ? t.style + ";" : "") + n[e] : t[e] || "contenteditable" == e || "nodeName" == e || (t[e] = String(n[e]))
})), [Vo.node(0, e.state.doc.content.size, t)]
}
function pi(e) {
if (e.markCursor) {
let t = document.createElement("img");
t.className = "ProseMirror-separator", t.setAttribute("mark-placeholder", "true"), t.setAttribute("alt", ""), e.cursorWrapper = {
dom: t,
deco: Vo.widget(e.state.selection.head, t, {
raw: !0,
marks: e.markCursor
})
}
} else e.cursorWrapper = null
}
function hi(e) {
return !e.someProp("editable", (t => !1 === t(e.state)))
}
function fi(e) {
let t = Object.create(null);
function n(e) {
for (let n in e) Object.prototype.hasOwnProperty.call(t, n) || (t[n] = e[n])
}
return e.someProp("nodeViews", n), e.someProp("markViews", n), t
}
function mi(e) {
if (e.spec.state || e.spec.filterTransaction || e.spec.appendTransaction) throw new RangeError("Plugins passed directly to the view must not have a state component")
}
for (var gi = n(354), vi = n.n(gi), yi = {
8: "Backspace",
9: "Tab",
10: "Enter",
12: "NumLock",
13: "Enter",
16: "Shift",
17: "Control",
18: "Alt",
20: "CapsLock",
27: "Escape",
32: " ",
33: "PageUp",
34: "PageDown",
35: "End",
36: "Home",
37: "ArrowLeft",
38: "ArrowUp",
39: "ArrowRight",
40: "ArrowDown",
44: "PrintScreen",
45: "Insert",
46: "Delete",
59: ";",
61: "=",
91: "Meta",
92: "Meta",
106: "*",
107: "+",
108: ",",
109: "-",
110: ".",
111: "/",
144: "NumLock",
145: "ScrollLock",
160: "Shift",
161: "Shift",
162: "Control",
163: "Control",
164: "Alt",
165: "Alt",
173: "-",
186: ";",
187: "=",
188: ",",
189: "-",
190: ".",
191: "/",
192: "`",
219: "[",
220: "\\",
221: "]",
222: "'",
229: "q"
}, bi = {
48: ")",
49: "!",
50: "@",
51: "#",
52: "$",
53: "%",
54: "^",
55: "&",
56: "*",
57: "(",
59: ":",
61: "+",
173: "_",
186: ":",
187: "+",
188: "<",
189: "_",
190: ">",
191: "?",
192: "~",
219: "{",
220: "|",
221: "}",
222: '"',
229: "Q"
}, wi = "undefined" != typeof navigator && /Chrome\/(\d+)/.exec(navigator.userAgent), ki = "undefined" != typeof navigator && /Apple Computer/.test(navigator.vendor), xi = "undefined" != typeof navigator && /Gecko\/\d+/.test(navigator.userAgent), Ci = "undefined" != typeof navigator && /Mac/.test(navigator.platform), Ti = "undefined" != typeof navigator && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent), Mi = wi && (Ci || +wi[1] < 57) || xi && Ci, Si = 0; Si < 10; Si++) yi[48 + Si] = yi[96 + Si] = String(Si);
for (Si = 1; Si <= 24; Si++) yi[Si + 111] = "F" + Si;
for (Si = 65; Si <= 90; Si++) yi[Si] = String.fromCharCode(Si + 32), bi[Si] = String.fromCharCode(Si);
for (var Ei in yi) bi.hasOwnProperty(Ei) || (bi[Ei] = yi[Ei]);
const Ni = "undefined" != typeof navigator && /Mac|iP(hone|[oa]d)/.test(navigator.platform);
function Oi(e) {
let t, n, r, o, i = e.split(/-(?!$)/),
s = i[i.length - 1];
"Space" == s && (s = " ");
for (let e = 0; e < i.length - 1; e++) {
let s = i[e];
if (/^(cmd|meta|m)$/i.test(s)) o = !0;
else if (/^a(lt)?$/i.test(s)) t = !0;
else if (/^(c|ctrl|control)$/i.test(s)) n = !0;
else if (/^s(hift)?$/i.test(s)) r = !0;
else {
if (!/^mod$/i.test(s)) throw new Error("Unrecognized modifier name: " + s);
Ni ? o = !0 : n = !0
}
}
return t && (s = "Alt-" + s), n && (s = "Ctrl-" + s), o && (s = "Meta-" + s), r && (s = "Shift-" + s), s
}
function Di(e, t, n) {
return t.altKey && (e = "Alt-" + e), t.ctrlKey && (e = "Ctrl-" + e), t.metaKey && (e = "Meta-" + e), !1 !== n && t.shiftKey && (e = "Shift-" + e), e
}
function Ai(e) {
return new an({
props: {
handleKeyDown: Li(e)
}
})
}
function Li(e) {
let t = function(e) {
let t = Object.create(null);
for (let n in e) t[Oi(n)] = e[n];
return t
}(e);
return function(e, n) {
let r, o = function(e) {
var t = !(Mi && (e.ctrlKey || e.altKey || e.metaKey) || (ki || Ti) && e.shiftKey && e.key && 1 == e.key.length) && e.key || (e.shiftKey ? bi : yi)[e.keyCode] || e.key || "Unidentified";
return "Esc" == t && (t = "Escape"), "Del" == t && (t = "Delete"), "Left" == t && (t = "ArrowLeft"), "Up" == t && (t = "ArrowUp"), "Right" == t && (t = "ArrowRight"), "Down" == t && (t = "ArrowDown"), t
}(n),
i = 1 == o.length && " " != o,
s = t[Di(o, n, !i)];
if (s && s(e.state, e.dispatch, e)) return !0;
if (i && (n.shiftKey || n.altKey || n.metaKey || o.charCodeAt(0) > 127) && (r = yi[n.keyCode]) && r != o) {
let o = t[Di(r, n, !0)];
if (o && o(e.state, e.dispatch, e)) return !0
} else if (i && n.shiftKey) {
let r = t[Di(o, n, !0)];
if (r && r(e.state, e.dispatch, e)) return !0
}
return !1
}
}
const Ii = (e, t) => !e.selection.empty && (t && t(e.tr.deleteSelection().scrollIntoView()), !0);
function Ri(e, t, n = !1) {
for (let r = e; r; r = "start" == t ? r.firstChild : r.lastChild) {
if (r.isTextblock) return !0;
if (n && 1 != r.childCount) return !1
}
return !1
}
function Pi(e) {
if (!e.parent.type.spec.isolating)
for (let t = e.depth - 1; t >= 0; t--) {
if (e.index(t) > 0) return e.doc.resolve(e.before(t + 1));
if (e.node(t).type.spec.isolating) break
}
return null
}
const Bi = (e, t, n) => {
let {
$cursor: r
} = e.selection;
if (!r || (n ? !n.endOfTextblock("forward", e) : r.parentOffset < r.parent.content.size)) return !1;
let o = Fi(r);
if (!o) return !1;
let i = o.nodeAfter;
if ($i(e, o, t)) return !0;
if (0 == r.parent.content.size && (Ri(i, "start") || Jt.isSelectable(i))) {
let n = Nt(e.doc, r.before(), r.after(), v.empty);
if (n && n.slice.size < n.to - n.from) {
if (t) {
let r = e.tr.step(n);
r.setSelection(Ri(i, "start") ? Vt.findFrom(r.doc.resolve(r.mapping.map(o.pos)), 1) : Jt.create(r.doc, r.mapping.map(o.pos))), t(r.scrollIntoView())
}
return !0
}
}
return !(!i.isAtom || o.depth != r.depth - 1) && (t && t(e.tr.delete(o.pos, o.pos + i.nodeSize).scrollIntoView()), !0)
};
function Fi(e) {
if (!e.parent.type.spec.isolating)
for (let t = e.depth - 1; t >= 0; t--) {
let n = e.node(t);
if (e.index(t) + 1 < n.childCount) return e.doc.resolve(e.after(t + 1));
if (n.type.spec.isolating) break
}
return null
}
const Hi = (e, t) => {
let {
$head: n,
$anchor: r
} = e.selection;
return !(!n.parent.type.spec.code || !n.sameParent(r)) && (t && t(e.tr.insertText("\n").scrollIntoView()), !0)
};
function zi(e) {
for (let t = 0; t < e.edgeCount; t++) {
let {
type: n
} = e.edge(t);
if (n.isTextblock && !n.hasRequiredAttrs()) return n
}
return null
}
const qi = (e, t) => {
let {
$head: n,
$anchor: r
} = e.selection;
if (!n.parent.type.spec.code || !n.sameParent(r)) return !1;
let o = n.node(-1),
i = n.indexAfter(-1),
s = zi(o.contentMatchAt(i));
if (!s || !o.canReplaceWith(i, i, s)) return !1;
if (t) {
let r = n.after(),
o = e.tr.replaceWith(r, r, s.createAndFill());
o.setSelection(Vt.near(o.doc.resolve(r), 1)), t(o.scrollIntoView())
}
return !0
},
Vi = (e, t) => {
let {
$from: n,
$to: r
} = e.selection;
if (e.selection instanceof Jt && e.selection.node.isBlock) return !(!n.parentOffset || !Mt(e.doc, n.pos)) && (t && t(e.tr.split(n.pos).scrollIntoView()), !0);
if (!n.parent.isBlock) return !1;
if (t) {
let o = r.parentOffset == r.parent.content.size,
i = e.tr;
(e.selection instanceof Ut || e.selection instanceof Kt) && i.deleteSelection();
let s = 0 == n.depth ? null : zi(n.node(-1).contentMatchAt(n.indexAfter(-1))),
a = o && s ? [{
type: s
}] : void 0,
l = Mt(i.doc, i.mapping.map(n.pos), 1, a);
if (a || l || !Mt(i.doc, i.mapping.map(n.pos), 1, s ? [{
type: s
}] : void 0) || (s && (a = [{
type: s
}]), l = !0), l && (i.split(i.mapping.map(n.pos), 1, a), !o && !n.parentOffset && n.parent.type != s)) {
let e = i.mapping.map(n.before()),
t = i.doc.resolve(e);
s && n.node(-1).canReplaceWith(t.index(), t.index() + 1, s) && i.setNodeMarkup(i.mapping.map(n.before()), s)
}
t(i.scrollIntoView())
}
return !0
},
ji = (e, t) => (t && t(e.tr.setSelection(new Kt(e.doc))), !0);
function $i(e, t, n) {
let r, o, i = t.nodeBefore,
s = t.nodeAfter;
if (i.type.spec.isolating || s.type.spec.isolating) return !1;
if (function(e, t, n) {
let r = t.nodeBefore,
o = t.nodeAfter,
i = t.index();
return !(!(r && o && r.type.compatibleContent(o.type)) || (!r.content.size && t.parent.canReplace(i - 1, i) ? (n && n(e.tr.delete(t.pos - r.nodeSize, t.pos).scrollIntoView()), 0) : !t.parent.canReplace(i, i + 1) || !o.isTextblock && !St(e.doc, t.pos) || (n && n(e.tr.clearIncompatible(t.pos, r.type, r.contentMatchAt(r.childCount)).join(t.pos).scrollIntoView()), 0)))
}(e, t, n)) return !0;
let a = t.parent.canReplace(t.index(), t.index() + 1);
if (a && (r = (o = i.contentMatchAt(i.childCount)).findWrapping(s.type)) && o.matchType(r[0] || s.type).validEnd) {
if (n) {
let o = t.pos + s.nodeSize,
a = d.empty;
for (let e = r.length - 1; e >= 0; e--) a = d.from(r[e].create(null, a));
a = d.from(i.copy(a));
let l = e.tr.step(new wt(t.pos - 1, o, t.pos, o, new v(a, 1, 0), r.length, !0)),
c = o + 2 * r.length;
St(l.doc, c) && l.join(c), n(l.scrollIntoView())
}
return !0
}
let l = Vt.findFrom(t, 1),
c = l && l.$from.blockRange(l.$to),
u = c && Ct(c);
if (null != u && u >= t.depth) return n && n(e.tr.lift(c, u).scrollIntoView()), !0;
if (a && Ri(s, "start", !0) && Ri(i, "end")) {
let r = i,
o = [];
for (; o.push(r), !r.isTextblock;) r = r.lastChild;
let a = s,
l = 1;
for (; !a.isTextblock; a = a.firstChild) l++;
if (r.canReplace(r.childCount, r.childCount, a.content)) {
if (n) {
let r = d.empty;
for (let e = o.length - 1; e >= 0; e--) r = d.from(o[e].copy(r));
n(e.tr.step(new wt(t.pos - o.length, t.pos + s.nodeSize, t.pos + l, t.pos + s.nodeSize - l, new v(r, o.length, 0), 0, !0)).scrollIntoView())
}
return !0
}
}
return !1
}
function _i(e) {
return function(t, n) {
let r = t.selection,
o = e < 0 ? r.$from : r.$to,
i = o.depth;
for (; o.node(i).isInline;) {
if (!i) return !1;
i--
}
return !!o.node(i).isTextblock && (n && n(t.tr.setSelection(Ut.create(t.doc, e < 0 ? o.start(i) : o.end(i)))), !0)
}
}
const Ui = _i(-1),
Wi = _i(1);
function Ji(e, t = null) {
return function(n, r) {
let {
$from: o,
$to: i
} = n.selection, s = o.blockRange(i), a = s && function(e, t, n = null, r = e) {
let o = function(e, t) {
let {
parent: n,
startIndex: r,
endIndex: o
} = e, i = n.contentMatchAt(r).findWrapping(t);
if (!i) return null;
let s = i.length ? i[0] : t;
return n.canReplaceWith(r, o, s) ? i : null
}(e, t),
i = o && function(e, t) {
let {
parent: n,
startIndex: r,
endIndex: o
} = e, i = n.child(r), s = t.contentMatch.findWrapping(i.type);
if (!s) return null;
let a = (s.length ? s[s.length - 1] : t).contentMatch;
for (let e = r; a && e < o; e++) a = a.matchType(n.child(e).type);
return a && a.validEnd ? s : null
}(r, t);
return i ? o.map(Tt).concat({
type: t,
attrs: n
}).concat(i.map(Tt)) : null
}(s, e, t);
return !!a && (r && r(n.tr.wrap(s, a).scrollIntoView()), !0)
}
}
function Gi(e, t = null) {
return function(n, r) {
let {
from: o,
to: i
} = n.selection, s = !1;
return n.doc.nodesBetween(o, i, ((r, o) => {
if (s) return !1;
if (r.isTextblock && !r.hasMarkup(e, t))
if (r.type == e) s = !0;
else {
let t = n.doc.resolve(o),
r = t.index();
s = t.parent.canReplaceWith(r, r + 1, e)
}
})), !!s && (r && r(n.tr.setBlockType(o, i, e, t).scrollIntoView()), !0)
}
}
function Ki(e, t = null) {
return function(n, r) {
let {
empty: o,
$cursor: i,
ranges: s
} = n.selection;
if (o && !i || ! function(e, t, n) {
for (let r = 0; r < t.length; r++) {
let {
$from: o,
$to: i
} = t[r], s = 0 == o.depth && e.type.allowsMarkType(n);
if (e.nodesBetween(o.pos, i.pos, (e => {
if (s) return !1;
s = e.inlineContent && e.type.allowsMarkType(n)
})), s) return !0
}
return !1
}(n.doc, s, e)) return !1;
if (r)
if (i) e.isInSet(n.storedMarks || i.marks()) ? r(n.tr.removeStoredMark(e)) : r(n.tr.addStoredMark(e.create(t)));
else {
let o = !1,
i = n.tr;
for (let t = 0; !o && t < s.length; t++) {
let {
$from: r,
$to: i
} = s[t];
o = n.doc.rangeHasMark(r.pos, i.pos, e)
}
for (let n = 0; n < s.length; n++) {
let {
$from: r,
$to: a
} = s[n];
if (o) i.removeMark(r.pos, a.pos, e);
else {
let n = r.pos,
o = a.pos,
s = r.nodeAfter,
l = a.nodeBefore,
c = s && s.isText ? /^\s*/.exec(s.text)[0].length : 0,
u = l && l.isText ? /\s*$/.exec(l.text)[0].length : 0;
n + c < o && (n += c, o -= u), i.addMark(n, o, e.create(t))
}
}
r(i.scrollIntoView())
} return !0
}
}
function Zi(...e) {
return function(t, n, r) {
for (let o = 0; o < e.length; o++)
if (e[o](t, n, r)) return !0;
return !1
}
}
let Xi = Zi(Ii, ((e, t, n) => {
let {
$cursor: r
} = e.selection;
if (!r || (n ? !n.endOfTextblock("backward", e) : r.parentOffset > 0)) return !1;
let o = Pi(r);
if (!o) {
let n = r.blockRange(),
o = n && Ct(n);
return null != o && (t && t(e.tr.lift(n, o).scrollIntoView()), !0)
}
let i = o.nodeBefore;
if (!i.type.spec.isolating && $i(e, o, t)) return !0;
if (0 == r.parent.content.size && (Ri(i, "end") || Jt.isSelectable(i))) {
let n = Nt(e.doc, r.before(), r.after(), v.empty);
if (n && n.slice.size < n.to - n.from) {
if (t) {
let r = e.tr.step(n);
r.setSelection(Ri(i, "end") ? Vt.findFrom(r.doc.resolve(r.mapping.map(o.pos, -1)), -1) : Jt.create(r.doc, o.pos - i.nodeSize)), t(r.scrollIntoView())
}
return !0
}
}
return !(!i.isAtom || o.depth != r.depth - 1) && (t && t(e.tr.delete(o.pos - i.nodeSize, o.pos).scrollIntoView()), !0)
}), ((e, t, n) => {
let {
$head: r,
empty: o
} = e.selection, i = r;
if (!o) return !1;
if (r.parent.isTextblock) {
if (n ? !n.endOfTextblock("backward", e) : r.parentOffset > 0) return !1;
i = Pi(r)
}
let s = i && i.nodeBefore;
return !(!s || !Jt.isSelectable(s)) && (t && t(e.tr.setSelection(Jt.create(e.doc, i.pos - s.nodeSize)).scrollIntoView()), !0)
})),
Qi = Zi(Ii, Bi, ((e, t, n) => {
let {
$head: r,
empty: o
} = e.selection, i = r;
if (!o) return !1;
if (r.parent.isTextblock) {
if (n ? !n.endOfTextblock("forward", e) : r.parentOffset < r.parent.content.size) return !1;
i = Fi(r)
}
let s = i && i.nodeAfter;
return !(!s || !Jt.isSelectable(s)) && (t && t(e.tr.setSelection(Jt.create(e.doc, i.pos)).scrollIntoView()), !0)
}));
const Yi = {
Enter: Zi(Hi, ((e, t) => {
let n = e.selection,
{
$from: r,
$to: o
} = n;
if (n instanceof Kt || r.parent.inlineContent || o.parent.inlineContent) return !1;
let i = zi(o.parent.contentMatchAt(o.indexAfter()));
if (!i || !i.isTextblock) return !1;
if (t) {
let n = (!r.parentOffset && o.index() < o.parent.childCount ? r : o).pos,
s = e.tr.insert(n, i.createAndFill());
s.setSelection(Ut.create(s.doc, n + 1)), t(s.scrollIntoView())
}
return !0
}), ((e, t) => {
let {
$cursor: n
} = e.selection;
if (!n || n.parent.content.size) return !1;
if (n.depth > 1 && n.after() != n.end(-1)) {
let r = n.before();
if (Mt(e.doc, r)) return t && t(e.tr.split(r).scrollIntoView()), !0
}
let r = n.blockRange(),
o = r && Ct(r);
return null != o && (t && t(e.tr.lift(r, o).scrollIntoView()), !0)
}), Vi),
"Mod-Enter": qi,
Backspace: Xi,
"Mod-Backspace": Xi,
"Shift-Backspace": Xi,
Delete: Qi,
"Mod-Delete": Qi,
"Mod-a": ji
},
es = {
"Ctrl-h": Yi.Backspace,
"Alt-Backspace": Yi["Mod-Backspace"],
"Ctrl-d": Yi.Delete,
"Ctrl-Alt-Backspace": Yi["Mod-Delete"],
"Alt-Delete": Yi["Mod-Delete"],
"Alt-d": Yi["Mod-Delete"],
"Ctrl-a": Ui,
"Ctrl-e": Wi
};
for (let e in Yi) es[e] = Yi[e];
const ts = ("undefined" != typeof navigator ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : !("undefined" == typeof os || !os.platform) && "darwin" == os.platform()) ? es : Yi;
class ns {
constructor(e, t) {
var n;
this.match = e, this.match = e, this.handler = "string" == typeof t ? (n = t, function(e, t, r, o) {
let i = n;
if (t[1]) {
let e = t[0].lastIndexOf(t[1]);
i += t[0].slice(e + t[1].length);
let n = (r += e) - o;
n > 0 && (i = t[0].slice(e - n, e) + i, r = o)
}
return e.tr.insertText(i, r, o)
}) : t
}
}
function rs({
rules: e
}) {
let t = new an({
state: {
init: () => null,
apply(e, t) {
let n = e.getMeta(this);
return n || (e.selectionSet || e.docChanged ? null : t)
}
},
props: {
handleTextInput: (n, r, o, i) => is(n, r, o, i, e, t),
handleDOMEvents: {
compositionend: n => {
setTimeout((() => {
let {
$cursor: r
} = n.state.selection;
r && is(n, r.pos, r.pos, "", e, t)
}))
}
}
},
isInputRules: !0
});
return t
}
function is(e, t, n, r, o, i) {
if (e.composing) return !1;
let s = e.state,
a = s.doc.resolve(t);
if (a.parent.type.spec.code) return !1;
let l = a.parent.textBetween(Math.max(0, a.parentOffset - 500), a.parentOffset, null, "") + r;
for (let a = 0; a < o.length; a++) {
let c = o[a].match.exec(l),
u = c && o[a].handler(s, c, t - (c[0].length - r.length), n);
if (u) return e.dispatch(u.setMeta(i, {
transform: u,
from: t,
to: n,
text: r
})), !0
}
return !1
}
const ss = (e, t) => {
let n = e.plugins;
for (let r = 0; r < n.length; r++) {
let o, i = n[r];
if (i.spec.isInputRules && (o = i.getState(e))) {
if (t) {
let n = e.tr,
r = o.transform;
for (let e = r.steps.length - 1; e >= 0; e--) n.step(r.steps[e].invert(r.docs[e]));
if (o.text) {
let t = n.doc.resolve(o.from).marks();
n.replaceWith(o.from, o.to, e.schema.text(o.text, t))
} else n.delete(o.from, o.to);
t(n)
}
return !0
}
}
return !1
};
new ns(/--$/, "—"), new ns(/\.\.\.$/, "…"), new ns(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "“"), new ns(/"$/, "”"), new ns(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "‘"), new ns(/'$/, "’");
var as = 200,
ls = function() {};
ls.prototype.append = function(e) {
return e.length ? (e = ls.from(e), !this.length && e || e.length < as && this.leafAppend(e) || this.length < as && e.leafPrepend(this) || this.appendInner(e)) : this
}, ls.prototype.prepend = function(e) {
return e.length ? ls.from(e).append(this) : this
}, ls.prototype.appendInner = function(e) {
return new us(this, e)
}, ls.prototype.slice = function(e, t) {
return void 0 === e && (e = 0), void 0 === t && (t = this.length), e >= t ? ls.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t))
}, ls.prototype.get = function(e) {
if (!(e < 0 || e >= this.length)) return this.getInner(e)
}, ls.prototype.forEach = function(e, t, n) {
void 0 === t && (t = 0), void 0 === n && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0)
}, ls.prototype.map = function(e, t, n) {
void 0 === t && (t = 0), void 0 === n && (n = this.length);
var r = [];
return this.forEach((function(t, n) {
return r.push(e(t, n))
}), t, n), r
}, ls.from = function(e) {
return e instanceof ls ? e : e && e.length ? new cs(e) : ls.empty
};
var cs = function(e) {
function t(t) {
e.call(this), this.values = t
}
e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
var n = {
length: {
configurable: !0
},
depth: {
configurable: !0
}
};
return t.prototype.flatten = function() {
return this.values
}, t.prototype.sliceInner = function(e, n) {
return 0 == e && n == this.length ? this : new t(this.values.slice(e, n))
}, t.prototype.getInner = function(e) {
return this.values[e]
}, t.prototype.forEachInner = function(e, t, n, r) {
for (var o = t; o < n; o++)
if (!1 === e(this.values[o], r + o)) return !1
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
for (var o = t - 1; o >= n; o--)
if (!1 === e(this.values[o], r + o)) return !1
}, t.prototype.leafAppend = function(e) {
if (this.length + e.length <= as) return new t(this.values.concat(e.flatten()))
}, t.prototype.leafPrepend = function(e) {
if (this.length + e.length <= as) return new t(e.flatten().concat(this.values))
}, n.length.get = function() {
return this.values.length
}, n.depth.get = function() {
return 0
}, Object.defineProperties(t.prototype, n), t
}(ls);
ls.empty = new cs([]);
var us = function(e) {
function t(t, n) {
e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1
}
return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
return this.left.flatten().concat(this.right.flatten())
}, t.prototype.getInner = function(e) {
return e < this.left.length ? this.left.get(e) : this.right.get(e - this.left.length)
}, t.prototype.forEachInner = function(e, t, n, r) {
var o = this.left.length;
return !(t < o && !1 === this.left.forEachInner(e, t, Math.min(n, o), r)) && (!(n > o && !1 === this.right.forEachInner(e, Math.max(t - o, 0), Math.min(this.length, n) - o, r + o)) && void 0)
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
var o = this.left.length;
return !(t > o && !1 === this.right.forEachInvertedInner(e, t - o, Math.max(n, o) - o, r + o)) && (!(n < o && !1 === this.left.forEachInvertedInner(e, Math.min(t, o), n, r)) && void 0)
}, t.prototype.sliceInner = function(e, t) {
if (0 == e && t == this.length) return this;
var n = this.left.length;
return t <= n ? this.left.slice(e, t) : e >= n ? this.right.slice(e - n, t - n) : this.left.slice(e, n).append(this.right.slice(0, t - n))
}, t.prototype.leafAppend = function(e) {
var n = this.right.leafAppend(e);
if (n) return new t(this.left, n)
}, t.prototype.leafPrepend = function(e) {
var n = this.left.leafPrepend(e);
if (n) return new t(n, this.right)
}, t.prototype.appendInner = function(e) {
return this.left.depth >= Math.max(this.right.depth, e.depth) + 1 ? new t(this.left, new t(this.right, e)) : new t(this, e)
}, t
}(ls),
ds = ls;
class ps {
constructor(e, t) {
this.items = e, this.eventCount = t
}
popEvent(e, t) {
if (0 == this.eventCount) return null;
let n, r, o = this.items.length;
for (;; o--) {
if (this.items.get(o - 1).selection) {
--o;
break
}
}
t && (n = this.remapping(o, this.items.length), r = n.maps.length);
let i, s, a = e.tr,
l = [],
c = [];
return this.items.forEach(((e, t) => {
if (!e.step) return n || (n = this.remapping(o, t + 1), r = n.maps.length), r--, void c.push(e);
if (n) {
c.push(new hs(e.map));
let t, o = e.step.map(n.slice(r));
o && a.maybeStep(o).doc && (t = a.mapping.maps[a.mapping.maps.length - 1], l.push(new hs(t, void 0, void 0, l.length + c.length))), r--, t && n.appendMap(t, r)
} else a.maybeStep(e.step);
return e.selection ? (i = n ? e.selection.map(n.slice(r)) : e.selection, s = new ps(this.items.slice(0, o).append(c.reverse().concat(l)), this.eventCount - 1), !1) : void 0
}), this.items.length, 0), {
remaining: s,
transform: a,
selection: i
}
}
addTransform(e, t, n, r) {
let o = [],
i = this.eventCount,
s = this.items,
a = !r && s.length ? s.get(s.length - 1) : null;
for (let n = 0; n < e.steps.length; n++) {
let l, c = e.steps[n].invert(e.docs[n]),
u = new hs(e.mapping.maps[n], c, t);
(l = a && a.merge(u)) && (u = l, n ? o.pop() : s = s.slice(0, s.length - 1)), o.push(u), t && (i++, t = void 0), r || (a = u)
}
let l = i - n.depth;
return l > ms && (s = function(e, t) {
let n;
return e.forEach(((e, r) => {
if (e.selection && 0 == t--) return n = r, !1
})), e.slice(n)
}(s, l), i -= l), new ps(s.append(o), i)
}
remapping(e, t) {
let n = new pt;
return this.items.forEach(((t, r) => {
let o = null != t.mirrorOffset && r - t.mirrorOffset >= e ? n.maps.length - t.mirrorOffset : void 0;
n.appendMap(t.map, o)
}), e, t), n
}
addMaps(e) {
return 0 == this.eventCount ? this : new ps(this.items.append(e.map((e => new hs(e)))), this.eventCount)
}
rebased(e, t) {
if (!this.eventCount) return this;
let n = [],
r = Math.max(0, this.items.length - t),
o = e.mapping,
i = e.steps.length,
s = this.eventCount;
this.items.forEach((e => {
e.selection && s--
}), r);
let a = t;
this.items.forEach((t => {
let r = o.getMirror(--a);
if (null == r) return;
i = Math.min(i, r);
let l = o.maps[r];
if (t.step) {
let i = e.steps[r].invert(e.docs[r]),
c = t.selection && t.selection.map(o.slice(a + 1, r));
c && s++, n.push(new hs(l, i, c))
} else n.push(new hs(l))
}), r);
let l = [];
for (let e = t; e < i; e++) l.push(new hs(o.maps[e]));
let c = this.items.slice(0, r).append(l).append(n),
u = new ps(c, s);
return u.emptyItemCount() > 500 && (u = u.compress(this.items.length - n.length)), u
}
emptyItemCount() {
let e = 0;
return this.items.forEach((t => {
t.step || e++
})), e
}
compress(e = this.items.length) {
let t = this.remapping(0, e),
n = t.maps.length,
r = [],
o = 0;
return this.items.forEach(((i, s) => {
if (s >= e) r.push(i), i.selection && o++;
else if (i.step) {
let e = i.step.map(t.slice(n)),
s = e && e.getMap();
if (n--, s && t.appendMap(s, n), e) {
let a = i.selection && i.selection.map(t.slice(n));
a && o++;
let l, c = new hs(s.invert(), e, a),
u = r.length - 1;
(l = r.length && r[u].merge(c)) ? r[u] = l: r.push(c)
}
} else i.map && n--
}), this.items.length, 0), new ps(ds.from(r.reverse()), o)
}
}
ps.empty = new ps(ds.empty, 0);
class hs {
constructor(e, t, n, r) {
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r
}
merge(e) {
if (this.step && e.step && !e.selection) {
let t = e.step.merge(this.step);
if (t) return new hs(t.getMap().invert(), t, this.selection)
}
}
}
class fs {
constructor(e, t, n, r) {
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r
}
}
const ms = 20;
function gs(e) {
let t = [];
return e.forEach(((e, n, r, o) => t.push(r, o))), t
}
function vs(e, t) {
if (!e) return null;
let n = [];
for (let r = 0; r < e.length; r += 2) {
let o = t.map(e[r], 1),
i = t.map(e[r + 1], -1);
o <= i && n.push(o, i)
}
return n
}
function ys(e, t, n, r) {
let o = ks(t),
i = xs.get(t).spec.config,
s = (r ? e.undone : e.done).popEvent(t, o);
if (!s) return;
let a = s.selection.resolve(s.transform.doc),
l = (r ? e.done : e.undone).addTransform(s.transform, t.selection.getBookmark(), i, o),
c = new fs(r ? l : s.remaining, r ? s.remaining : l, null, 0);
n(s.transform.setSelection(a).setMeta(xs, {
redo: r,
historyState: c
}).scrollIntoView())
}
let bs = !1,
ws = null;
function ks(e) {
let t = e.plugins;
if (ws != t) {
bs = !1, ws = t;
for (let e = 0; e < t.length; e++)
if (t[e].spec.historyPreserveItems) {
bs = !0;
break
}
}
return bs
}
const xs = new un("history"),
Cs = new un("closeHistory");
function Ts(e = {}) {
return e = {
depth: e.depth || 100,
newGroupDelay: e.newGroupDelay || 500
}, new an({
key: xs,
state: {
init: () => new fs(ps.empty, ps.empty, null, 0),
apply: (t, n, r) => function(e, t, n, r) {
let o, i = n.getMeta(xs);
if (i) return i.historyState;
n.getMeta(Cs) && (e = new fs(e.done, e.undone, null, 0));
let s = n.getMeta("appendedTransaction");
if (0 == n.steps.length) return e;
if (s && s.getMeta(xs)) return s.getMeta(xs).redo ? new fs(e.done.addTransform(n, void 0, r, ks(t)), e.undone, gs(n.mapping.maps[n.steps.length - 1]), e.prevTime) : new fs(e.done, e.undone.addTransform(n, void 0, r, ks(t)), null, e.prevTime);
if (!1 === n.getMeta("addToHistory") || s && !1 === s.getMeta("addToHistory")) return (o = n.getMeta("rebased")) ? new fs(e.done.rebased(n, o), e.undone.rebased(n, o), vs(e.prevRanges, n.mapping), e.prevTime) : new fs(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), vs(e.prevRanges, n.mapping), e.prevTime);
{
let o = 0 == e.prevTime || !s && (e.prevTime < (n.time || 0) - r.newGroupDelay || ! function(e, t) {
if (!t) return !1;
if (!e.docChanged) return !0;
let n = !1;
return e.mapping.maps[0].forEach(((e, r) => {
for (let o = 0; o < t.length; o += 2) e <= t[o + 1] && r >= t[o] && (n = !0)
})), n
}(n, e.prevRanges)),
i = s ? vs(e.prevRanges, n.mapping) : gs(n.mapping.maps[n.steps.length - 1]);
return new fs(e.done.addTransform(n, o ? t.selection.getBookmark() : void 0, r, ks(t)), ps.empty, i, n.time)
}
}(n, r, t, e)
},
config: e,
props: {
handleDOMEvents: {
beforeinput(e, t) {
let n = t.inputType,
r = "historyUndo" == n ? Ms : "historyRedo" == n ? Ss : null;
return !!r && (t.preventDefault(), r(e.state, e.dispatch))
}
}
}
})
}
const Ms = (e, t) => {
let n = xs.getState(e);
return !(!n || 0 == n.done.eventCount) && (t && ys(n, e, t, !1), !0)
},
Ss = (e, t) => {
let n = xs.getState(e);
return !(!n || 0 == n.undone.eventCount) && (t && ys(n, e, t, !0), !0)
};
function Es(e, t) {
var n = e.nodes.paragraph;
return t ? n.create(null, Me()(t) ? e.text(t) : t) : n.createAndFill()
}
function Ns(e, t, n) {
return e.text(t, n)
}
function Os(e, t, n) {
void 0 === n && (n = t);
var r = e.doc.content.size,
o = r > 0 ? r - 1 : 1;
return Ut.create(e.doc, Math.min(t, o), Math.min(n, o))
}
function Ds(e, t, n) {
var r = t.pos;
return e.replaceWith(r, r, Es(n)), e.setSelection(Os(e, r + 1))
}
function As(e) {
for (var t = e.state, n = e.from, r = e.startIndex, o = e.endIndex, i = e.createText, s = t.tr, a = t.doc, l = t.schema, c = r; c <= o; c += 1) {
var u = a.child(c),
p = u.nodeSize,
h = u.textContent,
f = u.content,
m = i(h),
g = m ? Ns(l, m) : d.empty,
v = s.mapping.map(n),
y = v + f.size;
s.replaceWith(v, y, g), n += p
}
return s
}
function Ls(e, t, n, r) {
var o = n.length;
e.split(t).delete(t - o, t).insert(e.mapping.map(t), r).setSelection(Os(e, e.mapping.map(t) - o))
}
function Is(e) {
return e.sourcepos[0][0]
}
function Rs(e) {
return e.sourcepos[1][0]
}
function Ps(e) {
return e.sourcepos[0][1]
}
function Bs(e) {
return e.sourcepos[1][1]
}
function Fs(e) {
var t = e.type;
return "strike" === t || "strong" === t || "emph" === t || "code" === t || "link" === t || "image" === t
}
function Hs(e) {
return e && ("item" === e.type || "list" === e.type)
}
function zs(e) {
return Hs(e) && "ordered" === e.listData.type
}
function qs(e) {
return Hs(e) && "ordered" !== e.listData.type
}
function Vs(e) {
return e && ("tableCell" === e.type || "tableDelimCell" === e.type)
}
function js(e, t, n) {
for (void 0 === n && (n = !0), e = n ? e : e.parent; e && "document" !== e.type;) {
if (t(e)) return e;
e = e.parent
}
return null
}
function $s(e, t) {
return [e[0], e[1] + t]
}
function _s(e, t) {
return [e[0], t]
}
function Us(e) {
var t = e.firstChild.literal;
switch (e.type) {
case "emph":
return "*" + t + "*";
case "strong":
return "**" + t + "**";
case "strike":
return "~~" + t + "~~";
case "code":
return "`" + t + "`";
case "link":
case "image":
var n = e,
r = n.destination,
o = n.title;
return ("link" === e.type ? "" : "!") + "[" + t + "](" + r + (o ? ' "' + o + '"' : "") + ")";
default:
return null
}
}
function Ws(e) {
switch (e.type) {
case "document":
case "blockQuote":
case "list":
case "item":
case "paragraph":
case "heading":
case "emph":
case "strong":
case "strike":
case "link":
case "image":
case "table":
case "tableHead":
case "tableBody":
case "tableRow":
case "tableCell":
case "tableDelimRow":
case "customInline":
return !0;
default:
return !1
}
}
function Js(e) {
for (var t = [], n = e.walker(), r = null; r = n.next();) {
var o = r.node;
"text" === o.type && t.push(o.literal)
}
return t.join("")
}
var Gs = [],
Ks = {},
Zs = /\$\$widget\d+\s/;
function Xs(e) {
var t = e.search(Zs);
if (-1 !== t) {
var n = e.substring(t).replace(Zs, "").replace("$$", "");
e = e.substring(0, t), e += Xs(n)
}
return e
}
function Qs(e, t) {
return "$$" + e + " " + t + "$$"
}
function Ys(e, t) {
var n = Ks[e],
r = n.rule,
o = n.toDOM,
i = Xs(t).match(r);
return i && (t = i[0]), o(t)
}
function ea() {
return Gs
}
function ta(e) {
(Gs = e).forEach((function(e, t) {
Ks["widget" + t] = e
}))
}
function na(e, t, n, r) {
return e.concat(ra(t, n, r))
}
function ra(e, t, n) {
void 0 === n && (n = 0);
var r = [],
o = (Gs[n] || {}).rule,
i = n + 1;
if (e = Xs(e), o && o.test(e)) {
for (var s = void 0; - 1 !== (s = e.search(o));) {
var a = e.substring(0, s);
a && (r = na(r, a, t, i));
var l = (e = e.substring(s)).match(o)[0],
c = "widget" + n;
r.push(t.nodes.widget.create({
info: c
}, t.text(Qs(c, l)))), e = e.substring(l.length)
}
e && (r = na(r, e, t, i))
} else e && (r = n < Gs.length - 1 ? na(r, e, t, i) : [t.text(e)]);
return r
}
function oa(e) {
for (var t, n = "", r = e.walker(); t = r.next();) {
var o = t.node;
t.entering && (o !== e && "text" !== o.type ? (n += Us(o), r.resumeAt(e, !1), r.next()) : "text" === o.type && (n += o.literal))
}
return n
}
function ia() {
return {
deleteSelection: function() {
return Ii
},
selectAll: function() {
return ji
},
undo: function() {
return Ms
},
redo: function() {
return Ss
}
}
}
var sa = n(322),
aa = n.n(sa),
la = n(714),
ca = n.n(la),
ua = n(471),
da = n.n(ua),
pa = "[A-Za-z][A-Za-z0-9-]*",
ha = "(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)",
fa = "<(" + pa + ")(" + ha + ")*\\s*/?>",
ma = "(?:" + fa + "|</([A-Za-z][A-Za-z0-9-]*)\\s*[>])",
ga = new RegExp("^" + ma, "i"),
va = /<br\s*\/*>/i,
ya = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,
ba = "</p><p>";
function wa(e, t, n) {
var r = parseInt(e.left, 10),
o = parseInt(e.top, 10),
i = parseInt(e.width, 10) + parseInt(e.paddingLeft, 10) + parseInt(e.paddingRight, 10),
s = parseInt(e.height, 10) + parseInt(e.paddingTop, 10) + parseInt(e.paddingBottom, 10);
return t >= r && t <= r + i && n >= o && n <= o + s
}
var ka = "toastui-editor-";
function xa() {
for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
for (var n = [], r = 0, o = e; r < o.length; r++) {
var i = o[r],
s = void 0;
(s = Array.isArray(i) ? i[0] ? i[1] : null : i) && n.push("" + ka + s)
}
return n.join(" ")
}
function Ca() {
for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
return e.map((function(e) {
return ka + "md-" + e
})).join(" ")
}
function Ta(e) {
return e && e.nodeType === Node.ELEMENT_NODE
}
function Ma(e) {
e.parentNode && e.parentNode.removeChild(e)
}
function Sa(e, t, n) {
Oe()(n) && (n = !ca()(e, t)), (n ? ke() : Ce())(e, t)
}
function Ea(e, t) {
var n = document.createElement("div");
Me()(e) ? n.innerHTML = e : n.appendChild(e);
var r = n.firstChild;
return t && t.appendChild(r), r
}
function Na(e) {
var t = window.getComputedStyle(e);
return ["margin-left", "margin-right"].reduce((function(e, n) {
return e + parseInt(t.getPropertyValue(n), 10)
}), 0) + e.offsetWidth
}
function Oa(e, t) {
var n;
for (n = Me()(t) ? function(e) {
return da()(e, t)
} : function(e) {
return e === t
}; e && e !== document;) {
if (Ta(e) && n(e)) return e;
e = e.parentNode
}
return null
}
function Da(e, t) {
for (var n = 0, r = 0; e && e !== t;) {
if (n += e.offsetTop, r += e.offsetLeft, e.offsetParent === t.offsetParent) break;
e = e.offsetParent
}
return {
offsetTop: n,
offsetLeft: r
}
}
function Aa(e, t) {
Object.keys(e).forEach((function(n) {
Qe(e[n]) ? t.removeAttribute(n) : t.setAttribute(n, e[n])
}))
}
function La(e) {
var t = e;
return t = (t = t.replace(/<img class="ProseMirror-separator" alt="">/g, "")).replace(/ class="ProseMirror-trailingBreak"/g, "")
}
var Ia = new un("widget"),
Ra = function() {
function e(e, t) {
var n = this;
this.popup = null, this.removeWidget = function() {
n.popup && (n.rootEl.removeChild(n.popup), n.popup = null)
}, this.rootEl = e.dom.parentElement, this.eventEmitter = t, this.eventEmitter.listen("blur", this.removeWidget), this.eventEmitter.listen("loadUI", (function() {
n.rootEl = Oa(e.dom.parentElement, "." + xa("defaultUI"))
})), this.eventEmitter.listen("removePopupWidget", this.removeWidget)
}
return e.prototype.update = function(e) {
var t = Ia.getState(e.state);
if (this.removeWidget(), t) {
var n = t.node,
r = t.style,
o = e.coordsAtPos(t.pos),
i = o.top,
s = o.left,
a = o.bottom - i,
l = this.rootEl.getBoundingClientRect(),
c = i - l.top;
be()(n, {
opacity: "0"
}), this.rootEl.appendChild(n), be()(n, {
position: "absolute",
left: s - l.left + 5 + "px",
top: ("bottom" === r ? c + a - 5 : c - a) + "px",
opacity: "1"
}), this.popup = n, e.focus()
}
}, e.prototype.destroy = function() {
this.eventEmitter.removeEventHandler("blur", this.removeWidget)
}, e
}();
function Pa(e) {
return new an({
key: Ia,
state: {
init: function() {
return null
},
apply: function(e) {
return e.getMeta("widget")
}
},
view: function(t) {
return new Ra(t, e)
}
})
}
var Ba = n(893),
Fa = n.n(Ba);
function Ha(e, t, n) {
e.emit("addImageBlobHook", t, (function(n, r) {
e.emit("command", "addImage", {
imageUrl: n,
altText: r || t.name || "image"
})
}), n)
}
function za(e) {
var t = vi()(e).filter((function(e) {
return -1 !== e.type.indexOf("image")
}));
if (1 === t.length) {
var n = t[0];
if (n) return n.getAsFile()
}
return null
}
function qa(e) {
var t = e.eventEmitter;
return new an({
props: {
handleDOMEvents: {
drop: function(e, n) {
var r, o = null === (r = n.dataTransfer) || void 0 === r ? void 0 : r.files;
return o && Fa()(o, (function(e) {
return -1 === e.type.indexOf("image") || (n.preventDefault(), n.stopPropagation(), Ha(t, e, n.type), !1)
})), !0
}
}
}
})
}
var Va = function() {
function e() {}
return Object.defineProperty(e.prototype, "type", {
get: function() {
return "node"
},
enumerable: !1,
configurable: !0
}), e.prototype.setContext = function(e) {
this.context = e
}, e
}();
function ja(e) {
var t = document.createElement("span"),
n = Ys(e.attrs.info, e.textContent);
return t.className = "tui-widget", t.appendChild(n), {
dom: t
}
}
function $a(e) {
return "widget" === e.type.name
}
var _a = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "widget"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: {
info: {
default: null
}
},
group: "inline",
inline: !0,
content: "text*",
selectable: !1,
atom: !0,
toDOM: function() {
return ["span", {
class: "tui-widget"
}, 0]
},
parseDOM: [{
tag: "span.tui-widget",
getAttrs: function(e) {
return {
info: e.textContent.match(/\$\$(widget\d+)/)[1]
}
}
}]
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
Ua = function() {
function e(e) {
this.timer = null, this.el = document.createElement("div"), this.el.className = "toastui-editor", this.eventEmitter = e, this.placeholder = {
text: ""
}
}
return e.prototype.createState = function() {
return on.create({
schema: this.schema,
plugins: this.createPlugins()
})
}, e.prototype.initEvent = function() {
var e = this,
t = e.eventEmitter,
n = e.view,
r = e.editorType;
n.dom.addEventListener("focus", (function() {
return t.emit("focus", r)
})), n.dom.addEventListener("blur", (function() {
return t.emit("blur", r)
}))
}, e.prototype.emitChangeEvent = function(e) {
this.eventEmitter.emit("caretChange", this.editorType), e.docChanged && this.eventEmitter.emit("change", this.editorType)
}, Object.defineProperty(e.prototype, "defaultPlugins", {
get: function() {
var e, t = this.createInputRules(),
n = i(i([], this.keymaps), [Ai(o({
"Shift-Enter": ts.Enter
}, ts)), Ts(), (e = this.placeholder, new an({
props: {
decorations: function(t) {
var n = t.doc;
if (e.text && 1 === n.childCount && n.firstChild.isTextblock && 0 === n.firstChild.content.size) {
var r = document.createElement("span");
return ke()(r, "placeholder"), e.className && ke()(r, e.className), r.textContent = e.text, _o.create(n, [Vo.widget(1, r)])
}
return null
}
}
})), Pa(this.eventEmitter), qa(this.context)]);
return t ? n.concat(t) : n
},
enumerable: !1,
configurable: !0
}), e.prototype.createInputRules = function() {
var e = ea().map((function(e) {
var t = e.rule;
return new ns(t, (function(e, n, r, o) {
var i = e.schema,
s = e.tr,
a = e.doc,
l = n.input.match(new RegExp(t, "g")),
c = a.resolve(r),
u = c.parent,
d = 0;
if ($a(u) && (u = c.node(c.depth - 1)), u.forEach((function(e) {
return $a(e) && (d += 1)
})), l.length > d) {
var p = et(l),
h = ra(p, i);
return s.replaceWith(o - p.length + 1, o, h)
}
return null
}))
}));
return e.length ? rs({
rules: e
}) : null
}, e.prototype.clearTimer = function() {
this.timer && (clearTimeout(this.timer), this.timer = null)
}, e.prototype.createSchema = function() {
return new Y({
nodes: this.specs.nodes,
marks: this.specs.marks
})
}, e.prototype.createKeymaps = function(e) {
var t = ia(),
n = t.undo,
r = t.redo,
o = this.specs.keymaps(e),
i = {
"Mod-z": n(),
"Shift-Mod-z": r()
};
return e ? o.concat(Ai(i)) : o
}, e.prototype.createCommands = function() {
return this.specs.commands(this.view)
}, e.prototype.createPluginProps = function() {
var e = this;
return this.extraPlugins.map((function(t) {
return t(e.eventEmitter)
}))
}, e.prototype.focus = function() {
var e = this;
this.clearTimer(), this.timer = setTimeout((function() {
e.view.focus(), e.view.dispatch(e.view.state.tr.scrollIntoView())
}))
}, e.prototype.blur = function() {
this.view.dom.blur()
}, e.prototype.destroy = function() {
var e = this;
this.clearTimer(), this.view.destroy(), Object.keys(this).forEach((function(t) {
delete e[t]
}))
}, e.prototype.moveCursorToStart = function(e) {
var t = this.view.state.tr;
this.view.dispatch(t.setSelection(Os(t, 1)).scrollIntoView()), e && this.focus()
}, e.prototype.moveCursorToEnd = function(e) {
var t = this.view.state.tr;
this.view.dispatch(t.setSelection(Os(t, t.doc.content.size - 1)).scrollIntoView()), e && this.focus()
}, e.prototype.setScrollTop = function(e) {
this.view.dom.scrollTop = e
}, e.prototype.getScrollTop = function() {
return this.view.dom.scrollTop
}, e.prototype.setPlaceholder = function(e) {
this.placeholder.text = e, this.view.dispatch(this.view.state.tr.scrollIntoView())
}, e.prototype.setHeight = function(e) {
be()(this.el, {
height: e + "px"
})
}, e.prototype.setMinHeight = function(e) {
be()(this.el, {
minHeight: e + "px"
})
}, e.prototype.getElement = function() {
return this.el
}, e
}(),
Wa = Ua,
Ja = n(294),
Ga = n.n(Ja),
Ka = ["Enter", "Shift-Enter", "Mod-Enter", "Tab", "Shift-Tab", "Delete", "Backspace", "Mod-Delete", "Mod-Backspace", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Mod-d", "Mod-D", "Alt-ArrowUp", "Alt-ArrowDown"];
function Za(e, t, n) {
return e.focus(), t(n)(e.state, e.dispatch, e)
}
var Xa = function() {
function e(e) {
this.specs = e
}
return Object.defineProperty(e.prototype, "nodes", {
get: function() {
return this.specs.filter((function(e) {
return "node" === e.type
})).reduce((function(e, t) {
var n, r = t.name,
i = t.schema;
return o(o({}, e), ((n = {})[r] = i, n))
}), {})
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(e.prototype, "marks", {
get: function() {
return this.specs.filter((function(e) {
return "mark" === e.type
})).reduce((function(e, t) {
var n, r = t.name,
i = t.schema;
return o(o({}, e), ((n = {})[r] = i, n))
}), {})
},
enumerable: !1,
configurable: !0
}), e.prototype.commands = function(e, t) {
var n = this.specs.filter((function(e) {
return e.commands
})).reduce((function(t, n) {
var r = {},
i = n.commands();
return Ga()(i) ? r[n.name] = function(t) {
return Za(e, i, t)
} : Object.keys(i).forEach((function(t) {
r[t] = function(n) {
return Za(e, i[t], n)
}
})), o(o({}, t), r)
}), {}),
r = ia();
return Object.keys(r).forEach((function(t) {
n[t] = function(n) {
return Za(e, r[t], n)
}
})), t && Object.keys(t).forEach((function(r) {
n[r] = function(n) {
return Za(e, t[r], n)
}
})), n
}, e.prototype.keymaps = function(e) {
return this.specs.filter((function(e) {
return e.keymaps
})).map((function(e) {
return e.keymaps()
})).map((function(t) {
return e || Object.keys(t).forEach((function(e) {
Ue(Ka, e) || delete t[e]
})), Ai(t)
}))
}, e.prototype.setContext = function(e) {
this.specs.forEach((function(t) {
t.setContext(e)
}))
}, e
}(),
Qa = Xa;
function Ya(e) {
var t = e.from,
n = e.to;
return e instanceof Kt ? [t + 1, n - 1] : [t, n]
}
function el(e) {
return e.index(0) + 1
}
function tl(e, t, n) {
void 0 === n && (n = 1);
var r = 0;
return e.forEach((function(e, o) {
$a(e) && o + 2 < t && (r += 2 * n)
})), r
}
function nl(e, t, n) {
void 0 === n && (n = t);
var r = t === n,
o = e.resolve(t),
i = el(o),
s = i,
a = o.start(1),
l = a;
if (!r) {
var c = e.resolve(n === e.content.size ? n - 1 : n);
l = c.start(1), s = el(c), c.pos === e.content.size && (n = e.content.size - 2)
}
var u = Math.max(t - a + 1, 1),
d = Math.max(n - l + 1, 1);
return [
[i, u + tl(e.child(i - 1), u, -1)],
[s, d + tl(e.child(s - 1), d, -1)]
]
}
function rl(e, t) {
for (var n = [], r = 0, o = 0; r < t; r += 1) {
var i = e.child(r);
n[r] = o, o += i.nodeSize
}
return n
}
function ol(e, t, n) {
var r = rl(e, n[0]),
o = t[0] - 1,
i = n[0] - 1,
s = e.child(o),
a = e.child(i),
l = r[o],
c = r[i];
return l += t[1] + tl(s, t[1] - 1), c += n[1] + tl(a, n[1] - 1), [l, Math.min(c, e.content.size)]
}
function il(e) {
var t = e.$from,
n = e.$to,
r = e.from,
o = e.to,
i = t.doc;
return e instanceof Kt && (t = i.resolve(r + 1), n = i.resolve(o - 1)), 0 === t.depth && (n = t = i.resolve(r - 1)), {
startFromOffset: t.start(1),
endFromOffset: n.start(1),
startToOffset: t.end(1),
endToOffset: n.end(1),
startIndex: t.index(0),
endIndex: n.index(0),
from: t.pos,
to: n.pos
}
}
function sl(e, t) {
for (var n = 1, r = 1, o = 0, i = 0; o < e.childCount; o += 1) {
var s = e.child(o).nodeSize;
if (n = i + 1, r = i + s - 1, o === t) break;
i += s
}
return {
startOffset: n,
endOffset: r
}
}
var al = "heading",
ll = "link",
cl = "code",
ul = "meta",
dl = "delimiter",
pl = "markedText",
hl = {
strong: 2,
emph: 1,
strike: 2
};
function fl(e, t, n, r) {
return {
start: e,
end: t,
spec: {
type: n,
attrs: r
}
}
}
function ml(e, t, n) {
var r = e.type,
o = $s(t, hl[r]),
i = $s(n, -hl[r]);
return [fl(o, i, r), fl(t, o, dl), fl(i, n, dl)]
}
function gl(e, t, n, r) {
return [fl(e, t, ll), fl(_s(e, n[1] + 1), _s(t, r), ll, {
desc: !0
}), fl(_s(t, r + 2), $s(t, -1), ll, {
url: !0
})]
}
function vl(e, t, n, r) {
var i = {
start: t,
end: n,
spec: {
attrs: {
className: r + "-line-background",
codeStart: t[0],
codeEnd: n[0]
}
},
lineBackground: !0
};
return "item" !== e.type && "blockQuote" !== e.type ? [o(o({}, i), {
end: t,
spec: {
attrs: {
className: r + "-line-background start"
}
}
}), o(o({}, i), {
start: [Math.min(t[0] + 1, n[0]), t[1]]
})] : null
}
function yl(e, t) {
for (var n = []; e;) {
var r = e.type;
"paragraph" !== r && "codeBlock" !== r || n.push(fl([Is(e), Ps(e) - 1], [Rs(e), Bs(e) + 1], t)), e = e.next
}
return n
}
var bl = {
heading: function(e, t, n) {
var r = e.level,
o = e.headingType,
i = [fl(t, n, al, {
level: r
})];
return "atx" === o ? i.push(fl(t, $s(t, r), dl)) : i.push(fl(_s(n, 0), n, al, {
seText: !0
})), i
},
strong: ml,
emph: ml,
strike: ml,
link: function(e, t, n) {
var r = e.lastChild,
o = e.extendedAutolink,
i = r ? Bs(r) + 1 : 2;
return o ? [fl(t, n, ll, {
desc: !0
})] : gl(t, n, t, i)
},
image: function(e, t, n) {
var r = e.lastChild,
o = r ? Bs(r) + 1 : 3,
s = $s(t, 1);
return i([fl(t, s, ul)], gl(t, n, s, o))
},
code: function(e, t, n) {
var r = e.tickCount,
o = $s(t, r),
i = $s(n, -r);
return [fl(t, n, cl), fl(t, o, cl, {
start: !0
}), fl(o, i, cl, {
marked: !0
}), fl(i, n, cl, {
end: !0
})]
},
codeBlock: function(e, t, n, r) {
var o = e.fenceOffset,
i = e.fenceLength,
s = e.fenceChar,
a = e.info,
l = e.infoPadding,
c = e.parent,
u = o + i,
d = [fl(_s(t, 1), n, "codeBlock")];
s && d.push(fl(t, $s(t, u), dl)), a && d.push(fl($s(t, i), $s(t, i + l + a.length), ul)), new RegExp("^(\\s{0,4})(" + s + "{" + i + ",})").test(r) && d.push(fl(_s(n, 1), n, dl));
var p = vl(c, t, n, "code-block");
return p ? d.concat(p) : d
},
blockQuote: function(e, t, n) {
var r = e.parent && "blockQuote" !== e.parent.type ? [fl(t, n, "blockQuote")] : [];
if (e.firstChild) {
var o = [];
"paragraph" === e.firstChild.type ? o = function(e) {
for (var t = []; e;) t.push(fl([Is(e), Ps(e)], [Rs(e), Bs(e) + 1], pl)), e = e.next;
return t
}(e.firstChild.firstChild) : "list" === e.firstChild.type && (o = yl(e.firstChild, pl)), r = i(i([], r), o)
}
return r
},
item: function(e, t) {
var n = e.listData,
r = n.padding,
s = n.task,
a = function(e) {
for (var t = 0; e.parent.parent && "item" === e.parent.parent.type;) e = e.parent.parent, t += 1;
return ["listItem", o(o({}, [{
odd: !0
}, {
even: !0
}][t % 2]), {
listStyle: !0
})]
}(e),
l = [fl.apply(void 0, i([t, $s(t, r)], a))];
return s && (l.push(fl($s(t, r), $s(t, r + 3), "taskDelimiter")), l.push(fl($s(t, r + 1), $s(t, r + 2), ul))), l.concat(yl(e.firstChild, pl))
},
customBlock: function(e, t, n) {
var r = e,
o = r.offset,
i = r.syntaxLength,
s = r.info,
a = r.parent,
l = o + i,
c = [fl(_s(t, 1), n, "customBlock")];
c.push(fl(t, $s(t, l), dl)), s && c.push(fl($s(t, l), $s(t, i + s.length), ul)), c.push(fl(_s(n, 1), n, dl));
var u = vl(a, t, n, "custom-block");
return u ? c.concat(u) : c
}
},
wl = {
thematicBreak: "thematicBreak",
table: "table",
tableCell: "tableCell",
htmlInline: "html"
};
function kl(e, t, n, r) {
var o = e.type;
return Ga()(bl[o]) ? bl[o](e, t, n, r) : wl[o] ? [fl(t, n, wl[o])] : null
}
var xl = {};
function Cl(e) {
var t = e.schema,
n = e.toastMark;
return new an({
appendTransaction: function(e, r, o) {
var i = e[0],
s = o.tr;
if (i.docChanged) {
var a = [];
i.getMeta("editResult").forEach((function(e) {
var t = e.nodes,
r = e.removedNodeRange;
if (t.length) {
a = a.concat(function(e, t) {
var n = e.doc,
r = t[0].sourcepos[0],
o = et(t).sourcepos[1],
i = [r[0], r[1]],
s = [o[0], o[1] + 1],
a = [];
return function(e, t, n) {
var r = [];
xl = {};
for (var o = t[0] - 1; o < n[0]; o += 1) {
var i = e.child(o),
s = i.attrs.codeEnd,
a = i.attrs.codeStart;
if (a && s && !Ue(r, a)) {
r.push(a), s = Math.min(s, e.childCount);
for (var l = a - 1, c = n[0], u = l; u < c; u += 1) xl[u] = !0
}
}
}(n, r, o), a.push({
start: i,
end: s
}), a
}(s, t));
for (var o = 0, i = t; o < i.length; o++)
for (var l = i[o].walker(), c = l.next(); c;) {
var u = c.node;
c.entering && (a = a.concat(Ml(u, n))), c = l.next()
}
} else if (r)
for (var d = s.doc.childCount - 1, p = r.line, h = p[0], f = p[1], m = Math.min(h, d), g = Math.min(f, d), v = m; v <= g; v += 1) xl[v] = !0
})),
function(e, t, n) {
var r = e.doc,
o = t.nodes.paragraph,
i = rl(r, r.childCount);
n.forEach((function(n) {
var s = n.start,
a = n.end,
l = n.spec,
c = n.lineBackground,
u = Math.min(s[0], r.childCount) - 1,
d = Math.min(a[0], r.childCount) - 1,
p = r.child(u),
h = r.child(d),
f = i[u],
m = i[d];
(f += s[1] + tl(p, s[1] - 1), m += a[1] + tl(h, a[1] - 1), l) ? c ? function(e, t, n, r, o) {
void 0 === o && (o = {});
for (var i = r.startIndex, s = r.endIndex, a = r.from, l = r.to, c = !1, u = i; u <= s; u += 1) delete xl[u], c = Tl(t, u, o);
c && e.setBlockType(a, l, n, o)
}(e, r, o, {
from: f,
to: m,
startIndex: u,
endIndex: d
}, l.attrs) : e.addMark(f, m, t.mark(l.type, l.attrs)): e.removeMark(f, m)
})),
function(e, t, n) {
Object.keys(xl).forEach((function(r) {
var o = Number(r),
i = Math.min(Number(r) + 1, e.doc.childCount - 1),
s = t[o],
a = t[i] - 1;
o === i && (a += 2), e.setBlockType(s, a, n)
}))
}(e, i, o)
}(s, t, a)
}
return s.setMeta("widget", i.getMeta("widget"))
}
})
}
function Tl(e, t, n) {
return Object.keys(n).some((function(r) {
return n[r] !== e.child(t).attrs[r]
}))
}
function Ml(e, t) {
var n = t.getLineTexts(),
r = [Is(e), Ps(e)],
o = [Rs(e), Bs(e) + 1],
i = kl(e, r, o, n[o[0] - 1]);
return null != i ? i : []
}
var Sl = ["taskList", "orderedList", "bulletList", "table", "strong", "emph", "strike", "heading", "thematicBreak", "blockQuote", "code", "codeBlock", "indent", "outdent"];
function El(e) {
var t = {
indent: {
active: !1,
disabled: !0
},
outdent: {
active: !1,
disabled: !0
}
},
n = !0;
return function(e, t, n) {
for (void 0 === n && (n = !0), e = n ? e : e.parent; e && "document" !== e.type;) t(e), e = e.parent
}(e, (function(e) {
var r = function(e) {
var t = e.type;
return Hs(e) ? e.listData.task ? "taskList" : "ordered" === e.listData.type ? "orderedList" : "bulletList" : -1 !== t.indexOf("table") ? "table" : Ue(Sl, t) ? t : null
}(e);
r && ("bulletList" === r || "orderedList" === r ? n && (t[r] = {
active: !0
}, t.indent.disabled = !1, t.outdent.disabled = !1, n = !1) : t[r] = {
active: !0
})
})), t
}
function Nl(e) {
var t = e.toastMark,
n = e.eventEmitter;
return new an({
view: function() {
return {
update: function(e, r) {
var o = e.state,
i = o.doc,
s = o.selection;
if (!(r && r.doc.eq(i) && r.selection.eq(s))) {
var a = s.from,
l = o.doc.resolve(a).start(),
c = a - l;
a === l && (c += 1);
var u = [o.doc.content.findIndex(a).index + 1, c],
d = t.findNodeAtPosition(u),
p = El(d);
n.emit("changeToolbarState", {
cursorPos: u,
mdNode: d,
toolbarState: p
}), n.emit("setFocusedNode", d)
}
}
}
}
})
}
var Ol = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "doc"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "block+"
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
Dl = function() {
function e() {}
return Object.defineProperty(e.prototype, "type", {
get: function() {
return "mark"
},
enumerable: !1,
configurable: !0
}), e.prototype.setContext = function(e) {
this.context = e
}, e
}(),
Al = Dl;
function Ll(e, t) {
return Il(e, t - 1)
}
function Il(e, t) {
return e.child(t).textContent
}
var Rl = /^\s*> ?/,
Pl = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "blockQuote"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("block-quote")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.createBlockQuoteText = function(e, t) {
return t ? e.replace(Rl, "").trim() : "> " + e.trim()
}, n.prototype.extendBlockQuote = function() {
var e = this;
return function(t, n) {
var r = t.selection,
o = t.doc,
i = t.tr,
s = t.schema,
a = il(r),
l = a.endFromOffset,
c = a.endToOffset,
u = a.endIndex,
d = a.to,
p = Il(o, u);
if (Rl.test(p) && d > l && r.empty) {
if (!p.replace(Rl, "").trim()) i.deleteRange(l, c).split(i.mapping.map(c));
else {
var h = p.slice(d - l).trim();
Ls(i, c, h, Ns(s, e.createBlockQuoteText(h)))
}
return n(i), !0
}
return !1
}
}, n.prototype.commands = function() {
var e = this;
return function() {
return function(t, n) {
var r = t.selection,
o = t.doc,
i = il(r),
s = i.startFromOffset,
a = i.endToOffset,
l = i.startIndex,
c = i.endIndex,
u = Rl.test(Il(o, l)),
d = As({
state: t,
startIndex: l,
endIndex: c,
from: s,
createText: function(t) {
return e.createBlockQuoteText(t, u)
}
});
return n(d.setSelection(Os(d, d.mapping.map(a)))), !0
}
}
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"alt-q": e,
"alt-Q": e,
Enter: this.extendBlockQuote()
}
}, n
}(Al),
Bl = /(^\s*)([-*+] |[\d]+\. )/,
Fl = /(^\s*)([\d])+\.( \[[ xX]])? /,
Hl = /^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/,
zl = /(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /,
ql = /^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/,
Vl = /(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/,
jl = /(^\s*)([-*+])( \[[ xX]]) /;
function $l(e) {
return Fl.test(e) ? "ordered" : "bullet"
}
function _l(e) {
for (var t = 0; e && "document" !== e.type;) "list" === e.type && (t += 1), e = e.parent;
return t
}
function Ul(e, t, n, r) {
for (var o = e.getLineTexts().length, i = [], s = t; r ? s < o : s > 1;) {
s = r ? s + 1 : s - 1;
var a = e.findFirstNodeAtLine(s),
l = _l(a);
if (l === n) i.push({
line: s,
depth: n,
mdNode: a
});
else if (l < n) break
}
return i
}
function Wl(e, t, n, r) {
void 0 === r && (r = 0);
var o = Number.MAX_VALUE,
i = 0,
s = t.map((function(t, s) {
var a = t.line;
o = Math.min(a - 1, o), i = Math.max(a - 1, i);
var l = Ll(e, a);
return l = "bullet" === n ? function(e) {
if (!Bl.test(e)) return "* " + e;
var t = $l(e);
return "bullet" === t && zl.test(e) ? e = e.replace(jl, "$1$2 ") : "ordered" === t && (e = e.replace(Fl, "$1* ")), e
}(l) : function(e, t) {
if (!Bl.test(e)) return t + ". " + e;
var n = $l(e);
if ("bullet" === n || "ordered" === n && zl.test(e)) e = e.replace(zl, "$1" + t + ". ");
else if ("ordered" === n) {
var r = Hl.exec(e)[3];
Number(r) !== t && (e = e.replace(Fl, "$1" + t + ". "))
}
return e
}(l, s + 1 + r), {
text: l,
line: a
}
}));
return {
changedResults: s,
firstIndex: o,
lastIndex: i
}
}
function Jl(e, t) {
var n, r, o, i, s, a, l, c = (r = (n = t).toastMark, o = n.mdNode, i = n.line, s = _l(o), a = Ul(r, i, s, !1).reverse(), l = Ul(r, i, s, !0), a.concat([{
line: i,
depth: s,
mdNode: o
}]).concat(l));
return Wl(t.doc, c, e)
}
var Gl = {
bullet: function(e) {
return Jl("bullet", e)
},
ordered: function(e) {
return Jl("ordered", e)
},
task: function(e) {
var t = e.mdNode,
n = e.doc,
r = e.line,
o = Ll(n, r);
return t.listData.task ? o = o.replace(Vl, "$1$2") : Hs(t) && (o = o.replace(Bl, "$1$2[ ] ")), {
changedResults: [{
text: o,
line: r
}]
}
}
},
Kl = {
bullet: function(e) {
var t = e.doc,
n = e.line;
return {
changedResults: [{
text: "* " + Ll(t, n),
line: n
}]
}
},
ordered: function(e) {
for (var t = e.toastMark, n = e.doc, r = e.line, o = e.startLine, i = Ll(n, r), s = 1, a = o, l = 0, c = o - 1; c > 0; c -= 1) {
var u = t.findFirstNodeAtLine(c),
d = Ll(n, c) && !!js(u, (function(e) {
return Hs(e)
})),
p = Hl.exec(Ll(n, c));
if (!p && !d) break;
if (p || !d) {
var h = p,
f = h[1],
m = h[3];
if (!f) {
s = Number(m), a = c;
break
}
} else l += 1
}
return {
changedResults: [{
text: s + r - a - l + ". " + i,
line: r
}]
}
},
task: function(e) {
var t = e.doc,
n = e.line;
return {
changedResults: [{
text: "* [ ] " + Ll(t, n),
line: n
}]
}
}
},
Zl = {
bullet: function(e) {
var t = e.line,
n = Ll(e.doc, t),
r = ql.exec(n);
return {
listSyntax: "" + r[1] + r[2]
}
},
ordered: function(e) {
var t = e.toastMark,
n = e.line,
r = e.mdNode,
i = e.doc,
s = _l(r),
a = Ll(i, n),
l = Hl.exec(a),
c = l[1],
u = l[3],
d = l[4],
p = Number(u) + 1,
h = "" + c + p + d,
f = Ul(t, n, s, !0).filter((function(e) {
var t = Hl.exec(Ll(i, e.line));
return t && t[1].length === c.length && !!js(e.mdNode, (function(e) {
return zs(e)
}))
}));
return o({
listSyntax: h
}, Wl(i, f, "ordered", p))
}
};
function Xl(e, t, n, r, o) {
for (var i = [], s = Ll(e, n), a = Hl.exec(s); a;) {
var l = a[1],
c = a[4],
u = a[5],
d = l.length;
if (d === o) i.push(Ns(t, "" + l + r + c + u)), r += 1, n += 1;
else if (d > o) {
var p = Xl(e, t, n, 1, d);
n = p.line, i = i.concat(p.nodes)
}
if (d < o || n > e.childCount) break;
s = Ll(e, n), a = Hl.exec(s)
}
return {
nodes: i,
line: n
}
}
var Ql = /(^\s{1,4})(.*)/;
function Yl(e, t, n) {
return e < t || Bl.test(n) || Rl.test(n)
}
function ec(e, t, n) {
var r = n.$from;
0 === r.depth && (r = e.resolve(r.pos - 1));
var o = r.node(1),
i = r.start(1),
s = o.content.size;
return o.rangeHasMark(0, s, t.marks.table) && r.pos - i !== s && r.pos !== i
}
function tc(e, t) {
var n = t.from,
r = t.to;
if ("indent" === t.type) {
n += 4, r += 4 * (t.lineLen + 1)
} else {
var o = t.spaceLenList;
n -= o[0];
for (var i = 0; i < o.length; i += 1) r -= o[i]
}
return Os(e, n, r)
}
var nc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "paragraph"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "inline*",
attrs: {
className: {
default: null
},
codeStart: {
default: null
},
codeEnd: {
default: null
}
},
selectable: !1,
group: "block",
parseDOM: [{
tag: "div"
}],
toDOM: function(e) {
var t = e.attrs;
return t.className ? ["div", {
class: Ca(t.className)
}, 0] : ["div", 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.reorderList = function(e, t) {
for (var n = this.context, r = n.view, o = n.toastMark, i = n.schema, s = r.state, a = s.tr, l = s.selection, c = s.doc, u = o.findFirstNodeAtLine(e), d = u; u && !qs(u) && "document" !== u.parent.type;)
if (zs(u = u.parent)) {
d = u;
break
} d && (e = d.sourcepos[0][0]);
var p = Hl.exec(Ll(c, e)),
h = p[1],
f = p[3],
m = h.length,
g = Xl(c, i, e, Number(f), m),
v = g.line,
y = g.nodes;
t = Math.max(t, v - 1);
for (var b = sl(c, e - 1).startOffset, w = e - 1; w <= t - 1; w += 1) {
var k = c.child(w),
x = k.nodeSize,
C = k.content,
T = a.mapping.map(b),
M = T + C.size;
a.replaceWith(T, M, y[w - e + 1]), b += x
}
var S = Os(a, l.from, l.to);
r.dispatch(a.setSelection(S))
}, n.prototype.indent = function(e) {
var t = this;
return void 0 === e && (e = !1),
function() {
return function(n, r) {
var o = n.schema,
i = n.selection,
s = n.doc,
a = il(i),
l = a.from,
c = a.to,
u = a.startFromOffset,
d = a.startIndex,
p = a.endIndex;
if (e && ec(s, o, i)) return !1;
var h = Il(s, d);
if (e && Yl(l, c, h) || !e && Bl.test(h)) {
var f = As({
state: n,
from: u,
startIndex: d,
endIndex: p,
createText: function(e) {
return " " + e
}
}),
m = {
type: "indent",
from: l,
to: c,
lineLen: p - d
};
r(f.setSelection(tc(f, m))), Hl.test(h) && t.reorderList(d + 1, p + 1)
} else e && r(n.tr.insert(c, Ns(o, " ")));
return !0
}
}
}, n.prototype.outdent = function(e) {
var t = this;
return void 0 === e && (e = !1),
function() {
return function(n, r) {
var o = n.selection,
i = n.doc,
s = n.schema,
a = il(o),
l = a.from,
c = a.to,
u = a.startFromOffset,
d = a.startIndex,
p = a.endIndex;
if (e && ec(i, s, o)) return !1;
var h = Il(i, d);
if (e && Yl(l, c, h) || !e && Bl.test(h)) {
var f = [],
m = As({
state: n,
from: u,
startIndex: d,
endIndex: p,
createText: function(e) {
var t = Ql.exec(e);
return f.push(t ? t[1].length : 0), e.replace(Ql, "$2")
}
}),
g = {
type: "outdent",
from: l,
to: c,
spaceLenList: f
};
r(m.setSelection(tc(m, g))), Hl.test(h) && t.reorderList(d + 1, p + 1)
} else if (e) {
var v = h.slice(0, c - u),
y = v.replace(/\s{1,4}$/, ""),
b = c - (v.length - y.length);
r(n.tr.delete(b, c))
}
return !0
}
}
}, n.prototype.deleteLines = function() {
var e = this;
return function(t, n) {
var r = e.context.view,
o = il(t.selection),
i = o.startFromOffset,
s = o.endToOffset;
return Zi((function() {
return n(t.tr.deleteRange(i, s)), !0
}), Bi)(t, n, r)
}
}, n.prototype.moveDown = function() {
return function(e, t) {
var n = e.doc,
r = e.tr,
o = e.selection,
i = e.schema,
s = il(o),
a = s.startFromOffset,
l = s.endToOffset,
c = s.endIndex;
if (c < n.content.childCount - 1) {
var u = n.child(c + 1),
d = u.nodeSize,
p = u.textContent;
return r.delete(l, l + d).split(a).insert(r.mapping.map(a) - 2, Ns(i, p)), t(r), !0
}
return !1
}
}, n.prototype.moveUp = function() {
return function(e, t) {
var n = e.tr,
r = e.doc,
o = e.selection,
i = e.schema,
s = il(o),
a = s.startFromOffset,
l = s.endToOffset,
c = s.startIndex;
if (c > 0) {
var u = r.child(c - 1),
d = u.nodeSize,
p = u.textContent;
return n.delete(a - d, a).split(n.mapping.map(l)).insert(n.mapping.map(l), Ns(i, p)), t(n), !0
}
return !1
}
}, n.prototype.commands = function() {
return {
indent: this.indent(),
outdent: this.outdent()
}
}, n.prototype.keymaps = function() {
return {
Tab: this.indent(!0)(),
"Shift-Tab": this.outdent(!0)(),
"Mod-d": this.deleteLines(),
"Mod-D": this.deleteLines(),
"Alt-ArrowUp": this.moveUp(),
"Alt-ArrowDown": this.moveDown()
}
}, n
}(Va),
rc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "text"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
group: "inline"
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
oc = /^#{1,6}\s/,
ic = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "heading"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: {
level: {
default: 1
},
seText: {
default: !1
}
},
toDOM: function(e) {
var t = e.attrs,
n = "heading|heading" + t.level;
return t.seText && (n += "|delimiter|setext"), ["span", {
class: Ca.apply(void 0, n.split("|"))
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.createHeadingText = function(e, t, n) {
for (var r = t.replace(n, "").trim(), o = ""; e > 0;) o += "#", e -= 1;
return o + " " + r
}, n.prototype.commands = function() {
var e = this;
return function(t) {
return function(n, r) {
var o = t.level,
i = il(n.selection),
s = i.startFromOffset,
a = i.endToOffset,
l = As({
state: n,
from: s,
startIndex: i.startIndex,
endIndex: i.endIndex,
createText: function(t) {
var n = t.match(oc),
r = n ? n[0] : "";
return e.createHeadingText(o, t, r)
}
});
return r(l.setSelection(Os(l, l.mapping.map(a)))), !0
}
}
}, n
}(Al),
sc = "```",
ac = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "codeBlock"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("code-block")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t) {
var n = e.selection,
r = e.schema,
o = e.tr,
i = il(n),
s = i.startFromOffset,
a = i.endToOffset,
l = Ns(r, sc);
return o.insert(s, l).split(s + sc.length), o.split(o.mapping.map(a)).insert(o.mapping.map(a), l), t(o.setSelection(Os(o, o.mapping.map(a) - (sc.length + 2)))), !0
}
}
}, n.prototype.keepIndentation = function() {
var e = this;
return function(t, n) {
var r = t.selection,
o = t.tr,
i = t.doc,
s = t.schema,
a = e.context.toastMark,
l = il(r),
c = l.startFromOffset,
u = l.endToOffset,
d = l.endIndex,
p = l.from,
h = l.to,
f = Il(i, d);
if (p === h && f.trim()) {
var m = f.match(/^\s+/);
if (function(e) {
return e && "codeBlock" === e.type
}(a.findFirstNodeAtLine(d + 1)) && m) {
var g = m[0],
v = f.slice(h - c);
return Ls(o, u, v, Ns(s, g + v)), n(o), !0
}
}
return !1
}
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Shift-Mod-p": e,
"Shift-Mod-P": e,
Enter: this.keepIndentation()
}
}, n
}(Al),
lc = /\||\s/g;
function cc(e, t) {
for (var n = "|", r = 0; r < e; r += 1) n += t ? " --- |" : " |";
return n
}
var uc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "table"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("table")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.extendTable = function() {
var e = this;
return function(t, n) {
var r = t.selection,
o = t.doc,
i = t.tr,
s = t.schema;
if (!r.empty) return !1;
var a = il(r),
l = a.endFromOffset,
c = a.endToOffset,
u = a.endIndex,
d = a.to,
p = Il(o, u),
h = [u + 1, d - l + 1],
f = js(e.context.toastMark.findNodeAtPosition(h), (function(e) {
return Vs(e) && ("tableDelimRow" === e.parent.type || "tableBody" === e.parent.parent.type)
}));
if (f) {
var m = !p.replace(lc, "").trim(),
g = cc(f.parent.parent.parent.columns.length);
return m ? i.deleteRange(l, c).split(i.mapping.map(c)) : i.split(c).insert(i.mapping.map(c), Ns(s, g)).setSelection(Os(i, i.mapping.map(c) - 2)), n(i), !0
}
return !1
}
}, n.prototype.moveTableCell = function(e) {
var t = this;
return function(n, r) {
var o = n.selection,
i = n.tr,
s = il(o),
a = s.endFromOffset,
l = [s.endIndex + 1, s.to - a],
c = js(t.context.toastMark.findNodeAtPosition(l), (function(e) {
return Vs(e)
}));
if (c) {
var u = c.parent,
d = function(e) {
return e ? {
type: "next",
parentType: "tableHead",
childType: "firstChild"
} : {
type: "prev",
parentType: "tableBody",
childType: "lastChild"
}
}(e),
p = d.type,
h = d.parentType,
f = d.childType,
m = Bs(c);
if (c[p]) m = Bs(c[p]) - 1;
else {
var g = u[p] || u.parent.type !== h ? u[p] : u.parent[p][f];
if ("next" === p) m += (g ? Bs(g[f]) : 0) + 2;
else "prev" === p && (m = g ? -4 : 0)
}
return r(i.setSelection(Os(i, a + m))), !0
}
return !1
}
}, n.prototype.addTable = function() {
return function(e) {
return function(t, n) {
var r = t.selection,
o = t.tr,
s = t.schema,
a = e,
l = a.columnCount,
c = a.rowCount,
u = il(r).endToOffset,
d = function(e) {
return [cc(e), cc(e, !0)]
}(l),
p = function(e, t) {
for (var n = [], r = 0; r < t; r += 1) n.push(cc(e));
return n
}(l, c - 1);
return i(i([], d), p).forEach((function(e) {
o.split(o.mapping.map(u)).insert(o.mapping.map(u), Ns(s, e))
})), n(o.setSelection(Os(o, u + 4))), !0
}
}
}, n.prototype.commands = function() {
return {
addTable: this.addTable()
}
}, n.prototype.keymaps = function() {
return {
Enter: this.extendTable(),
Tab: this.moveTableCell(!0),
"Shift-Tab": this.moveTableCell(!1)
}
}, n
}(Al),
dc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "thematicBreak"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("thematic-break")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.hr = function() {
return function() {
return function(e, t) {
var n = e.selection,
r = e.schema,
o = e.tr,
i = il(n),
s = i.from,
a = i.to,
l = i.endToOffset,
c = Ns(r, "***");
return o.split(s).replaceWith(o.mapping.map(s), o.mapping.map(a), c).split(o.mapping.map(a)).setSelection(Os(o, o.mapping.map(l))), t(o), !0
}
}
}, n.prototype.commands = function() {
return {
hr: this.hr()
}
}, n.prototype.keymaps = function() {
var e = this.hr()();
return {
"Mod-l": e,
"Mod-L": e
}
}, n
}(Al);
function pc(e, t) {
var n = e.type;
return t <= e.sourcepos[0][0] && ("codeBlock" === n || "heading" === n || n.match("table"))
}
var hc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "listItem"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: {
odd: {
default: !1
},
even: {
default: !1
},
listStyle: {
default: !1
}
},
toDOM: function(e) {
var t = e.attrs,
n = t.odd,
r = t.even,
o = "list-item";
return t.listStyle && (o += "|list-item-style"), n && (o += "|list-item-odd"), r && (o += "|list-item-even"), ["span", {
class: Ca.apply(void 0, o.split("|"))
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.extendList = function() {
var e = this;
return function(t, n) {
var r = t.selection,
o = t.doc,
i = t.schema,
s = t.tr,
a = e.context.toastMark,
l = il(r),
c = l.to,
u = l.startFromOffset,
d = l.endFromOffset,
p = l.endIndex,
h = l.endToOffset,
f = Il(o, p);
if (!Bl.test(f) || r.from === u || !r.empty) return !1;
if (!f.replace(zl, "").trim()) s.deleteRange(d, h).split(s.mapping.map(h));
else {
var m = $l(f),
g = a.findFirstNodeAtLine(p + 1),
v = f.slice(c - d),
y = {
toastMark: a,
mdNode: g,
doc: o,
line: p + 1
},
b = Zl[m](y),
w = b.listSyntax,
k = b.changedResults;
if (null == k ? void 0 : k.length) {
s.split(c), k.unshift({
text: w + v,
line: p + 1
}), e.changeToListPerLine(s, k, {
from: c,
startLine: k[0].line,
endLine: et(k).line
});
var x = s.mapping.map(h) - v.length;
s.setSelection(Os(s, x))
} else {
Ls(s, h, v, Ns(i, w + v))
}
}
return n(s), !0
}
}, n.prototype.toList = function(e) {
var t = this;
return function() {
return function(n, r) {
for (var o = n.doc, i = n.tr, s = n.selection, a = t.context.toastMark, l = il(s), c = l.startIndex + 1, u = l.endIndex + 1, d = l.endToOffset, p = [], h = c; h <= u; h += 1) {
var f = a.findFirstNodeAtLine(h);
if (f && pc(f, h)) break;
if (-1 === p.indexOf(h)) {
var m = {
toastMark: a,
mdNode: f,
doc: o,
line: h,
startLine: c
},
g = (Hs(f) ? Gl[e](m) : Kl[e](m)).changedResults,
v = t.changeToListPerLine(i, g, {
from: sl(o, g[0].line - 1).startOffset,
startLine: g[0].line,
endLine: et(g).line,
indexDiff: 1
});
d = Math.max(v, d), g && (p = p.concat(g.map((function(e) {
return e.line
}))))
}
}
return r(i.setSelection(Os(i, i.mapping.map(d)))), !0
}
}
}, n.prototype.changeToListPerLine = function(e, t, n) {
for (var r = n.from, o = n.startLine, i = n.endLine, s = n.indexDiff, a = void 0 === s ? 0 : s, l = 0, c = function(n) {
var o = e.doc.child(n),
i = o.nodeSize,
s = o.content,
c = e.mapping.map(r),
d = c + s.size,
p = t.filter((function(e) {
return e.line - a === n
}))[0];
p && (e.replaceWith(c, d, Ns(u.context.schema, p.text)), l = Math.max(l, r + s.size)), r += i
}, u = this, d = o - a; d <= i - a; d += 1) c(d);
return l
}, n.prototype.toggleTask = function() {
var e = this;
return function(t, n) {
for (var r = t.selection, o = t.tr, i = t.doc, s = t.schema, a = e.context.toastMark, l = il(r), c = l.startIndex, u = l.endIndex, d = null, p = c; p <= u; p += 1) {
var h = a.findFirstNodeAtLine(p + 1);
if (Hs(h) && h.listData.task) {
var f = h.listData,
m = f.checked,
g = f.padding,
v = m ? " " : "x",
y = h.sourcepos[0],
b = sl(i, y[0] - 1).startOffset;
b += y[1] + g, d = o.replaceWith(b, b + 1, s.text(v))
}
}
return !!d && (n(d), !0)
}
}, n.prototype.commands = function() {
return {
bulletList: this.toList("bullet"),
orderedList: this.toList("ordered"),
taskList: this.toList("task")
}
}, n.prototype.keymaps = function() {
var e = this.toList("bullet")(),
t = this.toList("ordered")(),
n = this.toList("task")(),
r = this.toggleTask();
return {
"Mod-u": e,
"Mod-U": e,
"Mod-o": t,
"Mod-O": t,
"alt-t": n,
"alt-T": n,
"Shift-Ctrl-x": r,
"Shift-Ctrl-X": r,
Enter: this.extendList()
}
}, n
}(Al);
function fc(e, t) {
return function() {
return function(n, r) {
var o = n.tr,
i = n.selection,
s = Ga()(e) ? e : function(t) {
return e.test(t)
},
a = t.length,
l = o.doc,
c = Ya(i),
u = c[0],
d = c[1],
p = Math.max(u - a, 1),
h = Math.min(d + a, l.content.size - 1),
f = i.content(),
m = f.content.textBetween(0, f.content.size, "\n"),
g = l.textBetween(p, u, "\n"),
v = l.textBetween(d, h, "\n");
if (m = "" + g + m + v, g && v && s(m)) o.delete(h - a, h).delete(p, p + a);
else {
o.insertText(t, d).insertText(t, u);
var y = i.empty ? Os(o, u + a) : Os(o, u + a, d + a);
o.setSelection(y)
}
return r(o), !0
}
}
}
var mc = /^(\*{2}|_{2}).*([\s\S]*)\1$/m,
gc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "strong"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("strong")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.bold = function() {
return fc(mc, "**")
}, n.prototype.commands = function() {
return {
bold: this.bold()
}
}, n.prototype.keymaps = function() {
var e = this.bold()();
return {
"Mod-b": e,
"Mod-B": e
}
}, n
}(Al),
vc = /^(~{2}).*([\s\S]*)\1$/m,
yc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "strike"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("strike")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return fc(vc, "~~")
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Mod-s": e,
"Mod-S": e
}
}, n
}(Al),
bc = /^(\*|_).*([\s\S]*)\1$/m,
wc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "emph"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("emph")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.italic = function() {
return fc(bc, "*")
}, n.prototype.commands = function() {
return {
italic: this.italic()
}
}, n.prototype.keymaps = function() {
var e = this.italic()();
return {
"Mod-i": e,
"Mod-I": e
}
}, n
}(Al),
kc = /^(`).*([\s\S]*)\1$/m,
xc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "code"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: {
start: {
default: !1
},
end: {
default: !1
},
marked: {
default: !1
}
},
toDOM: function(e) {
var t = e.attrs,
n = "code";
return t.start && (n += "|delimiter|start"), t.end && (n += "|delimiter|end"), t.marked && (n += "|marked-text"), ["span", {
class: Ca.apply(void 0, n.split("|"))
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return fc(kc, "`")
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Shift-Mod-c": e,
"Shift-Mod-C": e
}
}, n
}(Al),
Cc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "link"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: {
url: {
default: !1
},
desc: {
default: !1
}
},
toDOM: function(e) {
var t = e.attrs,
n = "link";
return t.url && (n += "|link-url|marked-text"), t.desc && (n += "|link-desc|marked-text"), ["span", {
class: Ca.apply(void 0, n.split("|"))
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.addLinkOrImage = function(e) {
return function(t) {
return function(n, r) {
var o = n.selection,
i = n.tr,
s = n.schema,
a = Ya(o),
l = a[0],
c = a[1],
u = t,
d = u.linkText,
p = u.altText,
h = u.linkUrl,
f = u.imageUrl,
m = d,
g = h,
v = "";
return "image" === e && (m = p, g = f, v = "!"), v += "[" + (m = Ze(m)) + "](" + g + ")", r(i.replaceWith(l, c, Ns(s, v))), !0
}
}
}, n.prototype.commands = function() {
return {
addImage: this.addLinkOrImage("image"),
addLink: this.addLinkOrImage("link")
}
}, n
}(Al),
Tc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "taskDelimiter"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("delimiter", "list-item")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Al),
Mc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "delimiter"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("delimiter")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Al),
Sc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "meta"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("meta")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Al),
Ec = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "markedText"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("marked-text")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Al),
Nc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "tableCell"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("table-cell")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Al),
Oc = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "html"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("html")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Al),
Dc = "$$",
Ac = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "customBlock"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
toDOM: function() {
return ["span", {
class: Ca("custom-block")
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function(e) {
return function(t, n) {
var r = t.selection,
o = t.schema,
i = t.tr,
s = il(r),
a = s.startFromOffset,
l = s.endToOffset;
if (!(null == e ? void 0 : e.info)) return !1;
var c = "$$" + e.info,
u = Ns(o, c),
d = Ns(o, Dc);
return i.insert(a, u).split(a + c.length), i.split(i.mapping.map(l)).insert(i.mapping.map(l), d), n(i.setSelection(Os(i, i.mapping.map(l) - (Dc.length + 2)))), !0
}
}
}, n
}(Al),
Lc = /x|backspace/i,
Ic = /^\[(\s*)(x?)(\s*)\](?:\s+)/i;
var Rc = "cut",
Pc = /\r\n|\n|\r/,
Bc = function(e) {
function n(t, n) {
var r = e.call(this, t) || this,
i = n.toastMark,
s = n.useCommandShortcut,
a = void 0 === s || s,
l = n.mdPlugins,
c = void 0 === l ? [] : l;
return r.editorType = "markdown", r.el.classList.add("md-mode"), r.toastMark = i, r.extraPlugins = c, r.specs = r.createSpecs(), r.schema = r.createSchema(), r.context = r.createContext(), r.keymaps = r.createKeymaps(a), r.view = r.createView(), r.commands = r.createCommands(), r.specs.setContext(o(o({}, r.context), {
view: r.view
})), r.createClipboard(), r.eventEmitter.listen("changePreviewTabWrite", (function(e) {
return r.toggleActive(!0, e)
})), r.eventEmitter.listen("changePreviewTabPreview", (function() {
return r.toggleActive(!1)
})), r.initEvent(), r
}
return t(n, e), n.prototype.toggleActive = function(e, t) {
Sa(this.el, "active", e), e ? t || this.focus() : this.blur()
}, n.prototype.createClipboard = function() {
var e = this;
this.clipboard = document.createElement("textarea"), this.clipboard.className = xa("pseudo-clipboard"), this.clipboard.addEventListener("paste", (function(t) {
var n = t.clipboardData || window.clipboardData,
r = n && n.items;
if (r) {
var o = vi()(r).some((function(e) {
return "string" === e.kind && "text/rtf" === e.type
}));
if (!o) {
var i = za(r);
i && (t.preventDefault(), Ha(e.eventEmitter, i, t.type))
}
}
})), this.clipboard.addEventListener("input", (function(t) {
var n = t.target.value;
e.replaceSelection(n), t.preventDefault(), t.target.value = ""
})), this.el.insertBefore(this.clipboard, this.view.dom)
}, n.prototype.createContext = function() {
return {
toastMark: this.toastMark,
schema: this.schema,
eventEmitter: this.eventEmitter
}
}, n.prototype.createSpecs = function() {
return new Qa([new Ol, new nc, new _a, new rc, new ic, new Pl, new ac, new Ac, new uc, new Nc, new dc, new hc, new gc, new yc, new wc, new xc, new Cc, new Mc, new Tc, new Ec, new Sc, new Oc])
}, n.prototype.createPlugins = function() {
return i([Cl(this.context), Nl(this.context), (e = this.context, t = e.schema, n = e.toastMark, new an({
props: {
handleDOMEvents: {
keyup: function(e, r) {
var o, i = e.state,
s = i.doc,
a = i.tr,
l = i.selection;
if (l.empty && Lc.test(r.key)) {
var c = il(l),
u = c.startIndex,
d = c.startFromOffset,
p = [u + 1, c.from - d + 1],
h = js(n.findNodeAtPosition(p), (function(e) {
var t;
return "paragraph" === e.type && "item" === (null === (t = e.parent) || void 0 === t ? void 0 : t.type)
}));
if (null === (o = null == h ? void 0 : h.firstChild) || void 0 === o ? void 0 : o.literal) {
var f = h.firstChild,
m = f.literal.match(Ic);
if (m) {
var g = f.sourcepos[0],
v = m[1],
y = m[2],
b = m[3],
w = v.length + b.length,
k = sl(s, g[0] - 1).startOffset,
x = g[1] + k;
if (y) {
var C = w ? w + 1 : 0;
a.replaceWith(x, C + x, t.text(y)), e.dispatch(a)
} else w || (a.insertText(" ", x), e.dispatch(a))
}
}
}
return !1
}
}
}
}))], this.createPluginProps()).concat(this.defaultPlugins);
var e, t, n
}, n.prototype.createView = function() {
var e = this;
return new ui(this.el, {
state: this.createState(),
dispatchTransaction: function(t) {
e.updateMarkdown(t);
var n = e.view.state.applyTransaction(t).state;
e.view.updateState(n), e.emitChangeEvent(t)
},
handleKeyDown: function(t, n) {
return (n.metaKey || n.ctrlKey) && "V" === n.key.toUpperCase() && e.clipboard.focus(), e.eventEmitter.emit("keydown", e.editorType, n), !1
},
handleDOMEvents: {
copy: function(t, n) {
return e.captureCopy(n)
},
cut: function(t, n) {
return e.captureCopy(n, Rc)
},
scroll: function() {
return e.eventEmitter.emit("scroll", "editor"), !0
},
keyup: function(t, n) {
return e.eventEmitter.emit("keyup", e.editorType, n), !1
}
},
nodeViews: {
widget: ja
}
})
}, n.prototype.createCommands = function() {
return this.specs.commands(this.view)
}, n.prototype.captureCopy = function(e, t) {
e.preventDefault();
var n = this.view.state,
r = n.selection,
o = n.tr;
if (r.empty) return !0;
var i = this.getChanged(r.content());
return e.clipboardData ? e.clipboardData.setData("text/plain", i) : window.clipboardData.setData("Text", i), t === Rc && this.view.dispatch(o.deleteSelection().scrollIntoView().setMeta("uiEvent", Rc)), !0
}, n.prototype.updateMarkdown = function(e) {
var t = this;
e.docChanged && e.steps.forEach((function(n, r) {
if (n.slice && !(n instanceof wt)) {
var o = e.docs[r],
i = [n.from, n.to],
s = nl(o, i[0], i[1]),
a = s[0],
l = s[1],
c = t.getChanged(n.slice);
a[0] === l[0] && a[1] === l[1] && "" === c && (c = "\n");
var u = t.toastMark.editMarkdown(a, l, c);
t.eventEmitter.emit("updatePreview", u), e.setMeta("editResult", u).scrollIntoView()
}
}))
}, n.prototype.getChanged = function(e) {
var t = "",
n = e.content.size;
return e.content.nodesBetween(0, n, (function(e, r) {
e.isText ? t += e.text.slice(Math.max(0, r) - r, n - r) : e.isBlock && r > 0 && (t += "\n")
})), t
}, n.prototype.setSelection = function(e, t) {
void 0 === t && (t = e);
var n = this.view.state.tr,
r = ol(n.doc, e, t),
o = r[0],
i = r[1];
this.view.dispatch(n.setSelection(Os(n, o, i)).scrollIntoView())
}, n.prototype.replaceSelection = function(e, t, n) {
var r, o = this.view.state,
i = o.tr,
s = o.schema,
a = o.doc,
l = e.split(Pc).map((function(e) {
return Es(s, ra(e, s))
})),
c = new v(d.from(l), 1, 1);
if (this.focus(), t && n) {
var u = ol(a, t, n),
p = u[0],
h = u[1];
r = i.replaceRange(p, h, c)
} else r = i.replaceSelection(c);
this.view.dispatch(r.scrollIntoView())
}, n.prototype.deleteSelection = function(e, t) {
var n, r = this.view.state,
o = r.tr,
i = r.doc;
if (e && t) {
var s = ol(i, e, t),
a = s[0],
l = s[1];
n = o.deleteRange(a, l)
} else n = o.deleteSelection();
this.view.dispatch(n.scrollIntoView())
}, n.prototype.getSelectedText = function(e, t) {
var n = this.view.state,
r = n.doc,
o = n.selection,
i = o.from,
s = o.to;
if (e && t) {
var a = ol(r, e, t);
i = a[0], s = a[1]
}
return r.textBetween(i, s, "\n")
}, n.prototype.getSelection = function() {
var e = this.view.state.selection,
t = e.from,
n = e.to;
return nl(this.view.state.tr.doc, t, n)
}, n.prototype.setMarkdown = function(e, t) {
void 0 === t && (t = !0);
var n = e.split(Pc),
r = this.view.state,
o = r.tr,
i = r.doc,
s = r.schema,
a = n.map((function(e) {
return Es(s, ra(e, s))
}));
this.view.dispatch(o.replaceWith(0, i.content.size, a)), t && this.moveCursorToEnd(!0)
}, n.prototype.addWidget = function(e, t, n) {
var r = this.view.state,
o = r.tr,
i = r.doc,
s = r.selection,
a = n ? ol(i, n, n)[0] : s.to;
this.view.dispatch(o.setMeta("widget", {
pos: a,
node: e,
style: t
}))
}, n.prototype.replaceWithWidget = function(e, t, n) {
var r = this.view.state,
o = r.tr,
i = r.schema,
s = ol(r.doc, e, t),
a = ra(n, i);
this.view.dispatch(o.replaceWith(s[0], s[1], a))
}, n.prototype.getRangeInfoOfNode = function(e) {
var t = this.view.state,
n = t.doc,
r = t.selection,
o = e || nl(n, r.from)[0],
i = this.toastMark.findNodeAtPosition(o);
return "text" === i.type && "paragraph" !== i.parent.type && (i = i.parent), i.sourcepos[1][1] += 1, {
range: i.sourcepos,
type: i.type
}
}, n.prototype.getMarkdown = function() {
return this.toastMark.getLineTexts().map((function(e) {
return Xs(e)
})).join("\n")
}, n.prototype.getToastMark = function() {
return this.toastMark
}, n
}(Wa),
Fc = Bc,
Hc = n(349),
zc = n.n(Hc),
qc = n(348),
Vc = n.n(qc),
jc = function(e, t) {
return jc = Object.setPrototypeOf || {
__proto__: []
}
instanceof Array && function(e, t) {
e.__proto__ = t
} || function(e, t) {
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n])
}, jc(e, t)
};
function $c(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
function n() {
this.constructor = e
}
jc(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
}
var _c = function() {
return _c = Object.assign || function(e) {
for (var t, n = 1, r = arguments.length; n < r; n++)
for (var o in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
return e
}, _c.apply(this, arguments)
};
function Uc(e, t, n) {
if (n || 2 === arguments.length)
for (var r, o = 0, i = t.length; o < i; o++) !r && o in t || (r || (r = Array.prototype.slice.call(t, 0, o)), r[o] = t[o]);
return e.concat(r || Array.prototype.slice.call(t))
}
var Wc = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : void 0 !== n.g ? n.g : "undefined" != typeof self ? self : {},
Jc = {};
function Gc(e, t, n) {
var r, o, i, s, a, l = "";
for ("string" != typeof t && (n = t, t = Gc.defaultChars), void 0 === n && (n = !0), a = function(e) {
var t, n, r = Jc[e];
if (r) return r;
for (r = Jc[e] = [], t = 0; t < 128; t++) n = String.fromCharCode(t), /^[0-9a-z]$/i.test(n) ? r.push(n) : r.push("%" + ("0" + t.toString(16).toUpperCase()).slice(-2));
for (t = 0; t < e.length; t++) r[e.charCodeAt(t)] = e[t];
return r
}(t), r = 0, o = e.length; r < o; r++)
if (i = e.charCodeAt(r), n && 37 === i && r + 2 < o && /^[0-9a-f]{2}$/i.test(e.slice(r + 1, r + 3))) l += e.slice(r, r + 3), r += 2;
else if (i < 128) l += a[i];
else if (i >= 55296 && i <= 57343) {
if (i >= 55296 && i <= 56319 && r + 1 < o && (s = e.charCodeAt(r + 1)) >= 56320 && s <= 57343) {
l += encodeURIComponent(e[r] + e[r + 1]), r++;
continue
}
l += "%EF%BF%BD"
} else l += encodeURIComponent(e[r]);
return l
}
Gc.defaultChars = ";/?:@&=+$,-_.!~*'()#", Gc.componentChars = "-_.!~*'()";
var Kc = Gc,
Zc = {},
Xc = {},
Qc = {
Aacute: "Á",
aacute: "á",
Abreve: "Ä‚",
abreve: "ă",
ac: "∾",
acd: "∿",
acE: "∾̳",
Acirc: "Â",
acirc: "â",
acute: "´",
Acy: "А",
acy: "а",
AElig: "Æ",
aelig: "æ",
af: "⁡",
Afr: "𝔄",
afr: "𝔞",
Agrave: "À",
agrave: "Ã ",
alefsym: "ℵ",
aleph: "ℵ",
Alpha: "Α",
alpha: "α",
Amacr: "Ä€",
amacr: "ā",
amalg: "⨿",
amp: "&",
AMP: "&",
andand: "â©•",
And: "â©“",
and: "∧",
andd: "⩜",
andslope: "⩘",
andv: "⩚",
ang: "∠",
ange: "⦤",
angle: "∠",
angmsdaa: "⦨",
angmsdab: "⦩",
angmsdac: "⦪",
angmsdad: "⦫",
angmsdae: "⦬",
angmsdaf: "⦭",
angmsdag: "⦮",
angmsdah: "⦯",
angmsd: "∡",
angrt: "∟",
angrtvb: "⊾",
angrtvbd: "⦝",
angsph: "∢",
angst: "Ã…",
angzarr: "⍼",
Aogon: "Ä„",
aogon: "Ä…",
Aopf: "𝔸",
aopf: "𝕒",
apacir: "⩯",
ap: "≈",
apE: "â©°",
ape: "≊",
apid: "≋",
apos: "'",
ApplyFunction: "⁡",
approx: "≈",
approxeq: "≊",
Aring: "Ã…",
aring: "Ã¥",
Ascr: "𝒜",
ascr: "𝒶",
Assign: "≔",
ast: "*",
asymp: "≈",
asympeq: "≍",
Atilde: "Ã",
atilde: "ã",
Auml: "Ä",
auml: "ä",
awconint: "∳",
awint: "⨑",
backcong: "≌",
backepsilon: "϶",
backprime: "‵",
backsim: "∽",
backsimeq: "⋍",
Backslash: "∖",
Barv: "â«§",
barvee: "⊽",
barwed: "⌅",
Barwed: "⌆",
barwedge: "⌅",
bbrk: "⎵",
bbrktbrk: "⎶",
bcong: "≌",
Bcy: "Б",
bcy: "б",
bdquo: "„",
becaus: "∵",
because: "∵",
Because: "∵",
bemptyv: "⦰",
bepsi: "϶",
bernou: "ℬ",
Bernoullis: "ℬ",
Beta: "Î’",
beta: "β",
beth: "â„¶",
between: "≬",
Bfr: "𝔅",
bfr: "𝔟",
bigcap: "â‹‚",
bigcirc: "â—¯",
bigcup: "⋃",
bigodot: "⨀",
bigoplus: "⨁",
bigotimes: "⨂",
bigsqcup: "⨆",
bigstar: "★",
bigtriangledown: "â–½",
bigtriangleup: "â–³",
biguplus: "⨄",
bigvee: "⋁",
bigwedge: "â‹€",
bkarow: "⤍",
blacklozenge: "â§«",
blacksquare: "â–ª",
blacktriangle: "â–´",
blacktriangledown: "â–¾",
blacktriangleleft: "â—‚",
blacktriangleright: "â–¸",
blank: "␣",
blk12: "â–’",
blk14: "â–‘",
blk34: "â–“",
block: "â–ˆ",
bne: "=⃥",
bnequiv: "≡⃥",
bNot: "â«­",
bnot: "⌐",
Bopf: "𝔹",
bopf: "𝕓",
bot: "⊥",
bottom: "⊥",
bowtie: "⋈",
boxbox: "⧉",
boxdl: "┐",
boxdL: "â••",
boxDl: "â•–",
boxDL: "â•—",
boxdr: "┌",
boxdR: "â•’",
boxDr: "â•“",
boxDR: "â•”",
boxh: "─",
boxH: "═",
boxhd: "┬",
boxHd: "╤",
boxhD: "â•¥",
boxHD: "╦",
boxhu: "â”´",
boxHu: "â•§",
boxhU: "╨",
boxHU: "â•©",
boxminus: "⊟",
boxplus: "⊞",
boxtimes: "⊠",
boxul: "┘",
boxuL: "â•›",
boxUl: "╜",
boxUL: "╝",
boxur: "â””",
boxuR: "╘",
boxUr: "â•™",
boxUR: "╚",
boxv: "│",
boxV: "â•‘",
boxvh: "┼",
boxvH: "╪",
boxVh: "â•«",
boxVH: "╬",
boxvl: "┤",
boxvL: "â•¡",
boxVl: "â•¢",
boxVL: "â•£",
boxvr: "├",
boxvR: "╞",
boxVr: "╟",
boxVR: "â• ",
bprime: "‵",
breve: "˘",
Breve: "˘",
brvbar: "¦",
bscr: "𝒷",
Bscr: "ℬ",
bsemi: "⁏",
bsim: "∽",
bsime: "⋍",
bsolb: "â§…",
bsol: "\\",
bsolhsub: "⟈",
bull: "•",
bullet: "•",
bump: "≎",
bumpE: "⪮",
bumpe: "≏",
Bumpeq: "≎",
bumpeq: "≏",
Cacute: "Ć",
cacute: "ć",
capand: "â©„",
capbrcup: "⩉",
capcap: "â©‹",
cap: "∩",
Cap: "â‹’",
capcup: "⩇",
capdot: "â©€",
CapitalDifferentialD: "â……",
caps: "∩︀",
caret: "⁁",
caron: "ˇ",
Cayleys: "â„­",
ccaps: "⩍",
Ccaron: "Č",
ccaron: "č",
Ccedil: "Ç",
ccedil: "ç",
Ccirc: "Ĉ",
ccirc: "ĉ",
Cconint: "∰",
ccups: "⩌",
ccupssm: "⩐",
Cdot: "ÄŠ",
cdot: "Ä‹",
cedil: "¸",
Cedilla: "¸",
cemptyv: "⦲",
cent: "¢",
centerdot: "·",
CenterDot: "·",
cfr: "𝔠",
Cfr: "â„­",
CHcy: "Ч",
chcy: "ч",
check: "✓",
checkmark: "✓",
Chi: "Χ",
chi: "χ",
circ: "ˆ",
circeq: "≗",
circlearrowleft: "↺",
circlearrowright: "↻",
circledast: "⊛",
circledcirc: "⊚",
circleddash: "⊝",
CircleDot: "⊙",
circledR: "®",
circledS: "Ⓢ",
CircleMinus: "⊖",
CirclePlus: "⊕",
CircleTimes: "⊗",
cir: "â—‹",
cirE: "⧃",
cire: "≗",
cirfnint: "⨐",
cirmid: "⫯",
cirscir: "â§‚",
ClockwiseContourIntegral: "∲",
CloseCurlyDoubleQuote: "”",
CloseCurlyQuote: "’",
clubs: "♣",
clubsuit: "♣",
colon: ":",
Colon: "∷",
Colone: "â©´",
colone: "≔",
coloneq: "≔",
comma: ",",
commat: "@",
comp: "∁",
compfn: "∘",
complement: "∁",
complexes: "â„‚",
cong: "≅",
congdot: "â©­",
Congruent: "≡",
conint: "∮",
Conint: "∯",
ContourIntegral: "∮",
copf: "𝕔",
Copf: "â„‚",
coprod: "∐",
Coproduct: "∐",
copy: "©",
COPY: "©",
copysr: "â„—",
CounterClockwiseContourIntegral: "∳",
crarr: "↵",
cross: "✗",
Cross: "⨯",
Cscr: "𝒞",
cscr: "𝒸",
csub: "⫏",
csube: "â«‘",
csup: "⫐",
csupe: "â«’",
ctdot: "⋯",
cudarrl: "⤸",
cudarrr: "⤵",
cuepr: "⋞",
cuesc: "⋟",
cularr: "↶",
cularrp: "⤽",
cupbrcap: "⩈",
cupcap: "⩆",
CupCap: "≍",
cup: "∪",
Cup: "â‹“",
cupcup: "⩊",
cupdot: "⊍",
cupor: "â©…",
cups: "∪︀",
curarr: "↷",
curarrm: "⤼",
curlyeqprec: "⋞",
curlyeqsucc: "⋟",
curlyvee: "⋎",
curlywedge: "⋏",
curren: "¤",
curvearrowleft: "↶",
curvearrowright: "↷",
cuvee: "⋎",
cuwed: "⋏",
cwconint: "∲",
cwint: "∱",
cylcty: "⌭",
dagger: "†",
Dagger: "‡",
daleth: "ℸ",
darr: "↓",
Darr: "↡",
dArr: "⇓",
dash: "‐",
Dashv: "⫤",
dashv: "⊣",
dbkarow: "⤏",
dblac: "˝",
Dcaron: "ÄŽ",
dcaron: "ď",
Dcy: "Д",
dcy: "д",
ddagger: "‡",
ddarr: "⇊",
DD: "â……",
dd: "â…†",
DDotrahd: "⤑",
ddotseq: "â©·",
deg: "°",
Del: "∇",
Delta: "Δ",
delta: "δ",
demptyv: "⦱",
dfisht: "⥿",
Dfr: "𝔇",
dfr: "𝔡",
dHar: "⥥",
dharl: "⇃",
dharr: "⇂",
DiacriticalAcute: "´",
DiacriticalDot: "Ë™",
DiacriticalDoubleAcute: "˝",
DiacriticalGrave: "`",
DiacriticalTilde: "˜",
diam: "â‹„",
diamond: "â‹„",
Diamond: "â‹„",
diamondsuit: "♦",
diams: "♦",
die: "¨",
DifferentialD: "â…†",
digamma: "ϝ",
disin: "⋲",
div: "÷",
divide: "÷",
divideontimes: "⋇",
divonx: "⋇",
DJcy: "Ђ",
djcy: "Ñ’",
dlcorn: "⌞",
dlcrop: "⌍",
dollar: "$",
Dopf: "𝔻",
dopf: "𝕕",
Dot: "¨",
dot: "Ë™",
DotDot: "⃜",
doteq: "≐",
doteqdot: "≑",
DotEqual: "≐",
dotminus: "∸",
dotplus: "∔",
dotsquare: "⊡",
doublebarwedge: "⌆",
DoubleContourIntegral: "∯",
DoubleDot: "¨",
DoubleDownArrow: "⇓",
DoubleLeftArrow: "⇐",
DoubleLeftRightArrow: "⇔",
DoubleLeftTee: "⫤",
DoubleLongLeftArrow: "⟸",
DoubleLongLeftRightArrow: "⟺",
DoubleLongRightArrow: "⟹",
DoubleRightArrow: "⇒",
DoubleRightTee: "⊨",
DoubleUpArrow: "⇑",
DoubleUpDownArrow: "⇕",
DoubleVerticalBar: "∥",
DownArrowBar: "⤓",
downarrow: "↓",
DownArrow: "↓",
Downarrow: "⇓",
DownArrowUpArrow: "⇵",
DownBreve: "Ì‘",
downdownarrows: "⇊",
downharpoonleft: "⇃",
downharpoonright: "⇂",
DownLeftRightVector: "⥐",
DownLeftTeeVector: "⥞",
DownLeftVectorBar: "⥖",
DownLeftVector: "↽",
DownRightTeeVector: "⥟",
DownRightVectorBar: "⥗",
DownRightVector: "⇁",
DownTeeArrow: "↧",
DownTee: "⊤",
drbkarow: "⤐",
drcorn: "⌟",
drcrop: "⌌",
Dscr: "𝒟",
dscr: "𝒹",
DScy: "Ð…",
dscy: "Ñ•",
dsol: "â§¶",
Dstrok: "Đ",
dstrok: "Ä‘",
dtdot: "⋱",
dtri: "â–¿",
dtrif: "â–¾",
duarr: "⇵",
duhar: "⥯",
dwangle: "⦦",
DZcy: "Џ",
dzcy: "ÑŸ",
dzigrarr: "⟿",
Eacute: "É",
eacute: "é",
easter: "â©®",
Ecaron: "Äš",
ecaron: "Ä›",
Ecirc: "Ê",
ecirc: "ê",
ecir: "≖",
ecolon: "≕",
Ecy: "Э",
ecy: "э",
eDDot: "â©·",
Edot: "Ä–",
edot: "Ä—",
eDot: "≑",
ee: "â…‡",
efDot: "≒",
Efr: "𝔈",
efr: "𝔢",
eg: "⪚",
Egrave: "È",
egrave: "è",
egs: "⪖",
egsdot: "⪘",
el: "⪙",
Element: "∈",
elinters: "⏧",
ell: "â„“",
els: "⪕",
elsdot: "⪗",
Emacr: "Ä’",
emacr: "Ä“",
empty: "∅",
emptyset: "∅",
EmptySmallSquare: "â—»",
emptyv: "∅",
EmptyVerySmallSquare: "â–«",
emsp13: " ",
emsp14: " ",
emsp: " ",
ENG: "ÅŠ",
eng: "Å‹",
ensp: " ",
Eogon: "Ę",
eogon: "Ä™",
Eopf: "𝔼",
eopf: "𝕖",
epar: "â‹•",
eparsl: "â§£",
eplus: "⩱",
epsi: "ε",
Epsilon: "Ε",
epsilon: "ε",
epsiv: "ϵ",
eqcirc: "≖",
eqcolon: "≕",
eqsim: "≂",
eqslantgtr: "⪖",
eqslantless: "⪕",
Equal: "⩵",
equals: "=",
EqualTilde: "≂",
equest: "≟",
Equilibrium: "⇌",
equiv: "≡",
equivDD: "⩸",
eqvparsl: "â§¥",
erarr: "⥱",
erDot: "≓",
escr: "ℯ",
Escr: "â„°",
esdot: "≐",
Esim: "⩳",
esim: "≂",
Eta: "Η",
eta: "η",
ETH: "Ð",
eth: "ð",
Euml: "Ë",
euml: "ë",
euro: "€",
excl: "!",
exist: "∃",
Exists: "∃",
expectation: "â„°",
exponentiale: "â…‡",
ExponentialE: "â…‡",
fallingdotseq: "≒",
Fcy: "Ф",
fcy: "Ñ„",
female: "♀",
ffilig: "ffi",
fflig: "ff",
ffllig: "ffl",
Ffr: "𝔉",
ffr: "𝔣",
filig: "fi",
FilledSmallSquare: "â—¼",
FilledVerySmallSquare: "â–ª",
fjlig: "fj",
flat: "â™­",
fllig: "fl",
fltns: "â–±",
fnof: "Æ’",
Fopf: "𝔽",
fopf: "𝕗",
forall: "∀",
ForAll: "∀",
fork: "â‹”",
forkv: "â«™",
Fouriertrf: "ℱ",
fpartint: "⨍",
frac12: "½",
frac13: "â…“",
frac14: "¼",
frac15: "â…•",
frac16: "â…™",
frac18: "â…›",
frac23: "â…”",
frac25: "â…–",
frac34: "¾",
frac35: "â…—",
frac38: "⅜",
frac45: "â…˜",
frac56: "â…š",
frac58: "⅝",
frac78: "â…ž",
frasl: "⁄",
frown: "⌢",
fscr: "𝒻",
Fscr: "ℱ",
gacute: "ǵ",
Gamma: "Γ",
gamma: "γ",
Gammad: "Ϝ",
gammad: "ϝ",
gap: "⪆",
Gbreve: "Äž",
gbreve: "ÄŸ",
Gcedil: "Ä¢",
Gcirc: "Ĝ",
gcirc: "ĝ",
Gcy: "Г",
gcy: "г",
Gdot: "Ä ",
gdot: "Ä¡",
ge: "≥",
gE: "≧",
gEl: "⪌",
gel: "â‹›",
geq: "≥",
geqq: "≧",
geqslant: "⩾",
gescc: "⪩",
ges: "⩾",
gesdot: "⪀",
gesdoto: "⪂",
gesdotol: "⪄",
gesl: "⋛︀",
gesles: "⪔",
Gfr: "𝔊",
gfr: "𝔤",
gg: "≫",
Gg: "â‹™",
ggg: "â‹™",
gimel: "â„·",
GJcy: "Ѓ",
gjcy: "Ñ“",
gla: "⪥",
gl: "≷",
glE: "⪒",
glj: "⪤",
gnap: "⪊",
gnapprox: "⪊",
gne: "⪈",
gnE: "≩",
gneq: "⪈",
gneqq: "≩",
gnsim: "â‹§",
Gopf: "𝔾",
gopf: "𝕘",
grave: "`",
GreaterEqual: "≥",
GreaterEqualLess: "â‹›",
GreaterFullEqual: "≧",
GreaterGreater: "⪢",
GreaterLess: "≷",
GreaterSlantEqual: "⩾",
GreaterTilde: "≳",
Gscr: "𝒢",
gscr: "ℊ",
gsim: "≳",
gsime: "⪎",
gsiml: "⪐",
gtcc: "⪧",
gtcir: "⩺",
gt: ">",
GT: ">",
Gt: "≫",
gtdot: "â‹—",
gtlPar: "⦕",
gtquest: "⩼",
gtrapprox: "⪆",
gtrarr: "⥸",
gtrdot: "â‹—",
gtreqless: "â‹›",
gtreqqless: "⪌",
gtrless: "≷",
gtrsim: "≳",
gvertneqq: "≩︀",
gvnE: "≩︀",
Hacek: "ˇ",
hairsp: " ",
half: "½",
hamilt: "â„‹",
HARDcy: "Ъ",
hardcy: "ÑŠ",
harrcir: "⥈",
harr: "↔",
hArr: "⇔",
harrw: "↭",
Hat: "^",
hbar: "ℏ",
Hcirc: "Ĥ",
hcirc: "Ä¥",
hearts: "♥",
heartsuit: "♥",
hellip: "…",
hercon: "⊹",
hfr: "𝔥",
Hfr: "ℌ",
HilbertSpace: "â„‹",
hksearow: "⤥",
hkswarow: "⤦",
hoarr: "⇿",
homtht: "∻",
hookleftarrow: "↩",
hookrightarrow: "↪",
hopf: "𝕙",
Hopf: "ℍ",
horbar: "―",
HorizontalLine: "─",
hscr: "𝒽",
Hscr: "â„‹",
hslash: "ℏ",
Hstrok: "Ħ",
hstrok: "ħ",
HumpDownHump: "≎",
HumpEqual: "≏",
hybull: "⁃",
hyphen: "‐",
Iacute: "Í",
iacute: "í",
ic: "⁣",
Icirc: "ÃŽ",
icirc: "î",
Icy: "И",
icy: "и",
Idot: "İ",
IEcy: "Е",
iecy: "е",
iexcl: "¡",
iff: "⇔",
ifr: "𝔦",
Ifr: "â„‘",
Igrave: "Ì",
igrave: "ì",
ii: "â…ˆ",
iiiint: "⨌",
iiint: "∭",
iinfin: "⧜",
iiota: "â„©",
IJlig: "IJ",
ijlig: "ij",
Imacr: "Ī",
imacr: "Ä«",
image: "â„‘",
ImaginaryI: "â…ˆ",
imagline: "ℐ",
imagpart: "â„‘",
imath: "ı",
Im: "â„‘",
imof: "⊷",
imped: "Ƶ",
Implies: "⇒",
incare: "â„…",
in: "∈",
infin: "∞",
infintie: "⧝",
inodot: "ı",
intcal: "⊺",
int: "∫",
Int: "∬",
integers: "ℤ",
Integral: "∫",
intercal: "⊺",
Intersection: "â‹‚",
intlarhk: "⨗",
intprod: "⨼",
InvisibleComma: "⁣",
InvisibleTimes: "⁢",
IOcy: "Ё",
iocy: "Ñ‘",
Iogon: "Ä®",
iogon: "į",
Iopf: "𝕀",
iopf: "𝕚",
Iota: "Ι",
iota: "ι",
iprod: "⨼",
iquest: "¿",
iscr: "𝒾",
Iscr: "ℐ",
isin: "∈",
isindot: "⋵",
isinE: "⋹",
isins: "â‹´",
isinsv: "⋳",
isinv: "∈",
it: "⁢",
Itilde: "Ĩ",
itilde: "Ä©",
Iukcy: "І",
iukcy: "Ñ–",
Iuml: "Ï",
iuml: "ï",
Jcirc: "Ä´",
jcirc: "ĵ",
Jcy: "Й",
jcy: "й",
Jfr: "𝔍",
jfr: "𝔧",
jmath: "È·",
Jopf: "𝕁",
jopf: "𝕛",
Jscr: "𝒥",
jscr: "𝒿",
Jsercy: "Ј",
jsercy: "ј",
Jukcy: "Є",
jukcy: "Ñ”",
Kappa: "Κ",
kappa: "κ",
kappav: "ϰ",
Kcedil: "Ķ",
kcedil: "Ä·",
Kcy: "К",
kcy: "к",
Kfr: "𝔎",
kfr: "𝔨",
kgreen: "ĸ",
KHcy: "Ð¥",
khcy: "Ñ…",
KJcy: "Ќ",
kjcy: "ќ",
Kopf: "𝕂",
kopf: "𝕜",
Kscr: "𝒦",
kscr: "𝓀",
lAarr: "⇚",
Lacute: "Ĺ",
lacute: "ĺ",
laemptyv: "⦴",
lagran: "â„’",
Lambda: "Λ",
lambda: "λ",
lang: "⟨",
Lang: "⟪",
langd: "⦑",
langle: "⟨",
lap: "⪅",
Laplacetrf: "â„’",
laquo: "«",
larrb: "⇤",
larrbfs: "⤟",
larr: "←",
Larr: "↞",
lArr: "⇐",
larrfs: "⤝",
larrhk: "↩",
larrlp: "↫",
larrpl: "⤹",
larrsim: "⥳",
larrtl: "↢",
latail: "⤙",
lAtail: "⤛",
lat: "⪫",
late: "⪭",
lates: "⪭︀",
lbarr: "⤌",
lBarr: "⤎",
lbbrk: "❲",
lbrace: "{",
lbrack: "[",
lbrke: "⦋",
lbrksld: "⦏",
lbrkslu: "⦍",
Lcaron: "Ľ",
lcaron: "ľ",
Lcedil: "Ä»",
lcedil: "ļ",
lceil: "⌈",
lcub: "{",
Lcy: "Л",
lcy: "л",
ldca: "⤶",
ldquo: "“",
ldquor: "„",
ldrdhar: "⥧",
ldrushar: "⥋",
ldsh: "↲",
le: "≤",
lE: "≦",
LeftAngleBracket: "⟨",
LeftArrowBar: "⇤",
leftarrow: "←",
LeftArrow: "←",
Leftarrow: "⇐",
LeftArrowRightArrow: "⇆",
leftarrowtail: "↢",
LeftCeiling: "⌈",
LeftDoubleBracket: "⟦",
LeftDownTeeVector: "⥡",
LeftDownVectorBar: "⥙",
LeftDownVector: "⇃",
LeftFloor: "⌊",
leftharpoondown: "↽",
leftharpoonup: "↼",
leftleftarrows: "⇇",
leftrightarrow: "↔",
LeftRightArrow: "↔",
Leftrightarrow: "⇔",
leftrightarrows: "⇆",
leftrightharpoons: "⇋",
leftrightsquigarrow: "↭",
LeftRightVector: "⥎",
LeftTeeArrow: "↤",
LeftTee: "⊣",
LeftTeeVector: "⥚",
leftthreetimes: "â‹‹",
LeftTriangleBar: "⧏",
LeftTriangle: "⊲",
LeftTriangleEqual: "⊴",
LeftUpDownVector: "⥑",
LeftUpTeeVector: "⥠",
LeftUpVectorBar: "⥘",
LeftUpVector: "↿",
LeftVectorBar: "⥒",
LeftVector: "↼",
lEg: "⪋",
leg: "⋚",
leq: "≤",
leqq: "≦",
leqslant: "⩽",
lescc: "⪨",
les: "⩽",
lesdot: "â©¿",
lesdoto: "⪁",
lesdotor: "⪃",
lesg: "⋚︀",
lesges: "⪓",
lessapprox: "⪅",
lessdot: "â‹–",
lesseqgtr: "⋚",
lesseqqgtr: "⪋",
LessEqualGreater: "⋚",
LessFullEqual: "≦",
LessGreater: "≶",
lessgtr: "≶",
LessLess: "⪡",
lesssim: "≲",
LessSlantEqual: "⩽",
LessTilde: "≲",
lfisht: "⥼",
lfloor: "⌊",
Lfr: "𝔏",
lfr: "𝔩",
lg: "≶",
lgE: "⪑",
lHar: "⥢",
lhard: "↽",
lharu: "↼",
lharul: "⥪",
lhblk: "â–„",
LJcy: "Љ",
ljcy: "Ñ™",
llarr: "⇇",
ll: "≪",
Ll: "⋘",
llcorner: "⌞",
Lleftarrow: "⇚",
llhard: "⥫",
lltri: "â—º",
Lmidot: "Ä¿",
lmidot: "Å€",
lmoustache: "⎰",
lmoust: "⎰",
lnap: "⪉",
lnapprox: "⪉",
lne: "⪇",
lnE: "≨",
lneq: "⪇",
lneqq: "≨",
lnsim: "⋦",
loang: "⟬",
loarr: "⇽",
lobrk: "⟦",
longleftarrow: "⟵",
LongLeftArrow: "⟵",
Longleftarrow: "⟸",
longleftrightarrow: "⟷",
LongLeftRightArrow: "⟷",
Longleftrightarrow: "⟺",
longmapsto: "⟼",
longrightarrow: "⟶",
LongRightArrow: "⟶",
Longrightarrow: "⟹",
looparrowleft: "↫",
looparrowright: "↬",
lopar: "⦅",
Lopf: "𝕃",
lopf: "𝕝",
loplus: "⨭",
lotimes: "⨴",
lowast: "∗",
lowbar: "_",
LowerLeftArrow: "↙",
LowerRightArrow: "↘",
loz: "â—Š",
lozenge: "â—Š",
lozf: "â§«",
lpar: "(",
lparlt: "⦓",
lrarr: "⇆",
lrcorner: "⌟",
lrhar: "⇋",
lrhard: "⥭",
lrm: "‎",
lrtri: "⊿",
lsaquo: "‹",
lscr: "𝓁",
Lscr: "â„’",
lsh: "↰",
Lsh: "↰",
lsim: "≲",
lsime: "⪍",
lsimg: "⪏",
lsqb: "[",
lsquo: "‘",
lsquor: "‚",
Lstrok: "Ł",
lstrok: "Å‚",
ltcc: "⪦",
ltcir: "⩹",
lt: "<",
LT: "<",
Lt: "≪",
ltdot: "â‹–",
lthree: "â‹‹",
ltimes: "⋉",
ltlarr: "⥶",
ltquest: "â©»",
ltri: "â—ƒ",
ltrie: "⊴",
ltrif: "â—‚",
ltrPar: "⦖",
lurdshar: "⥊",
luruhar: "⥦",
lvertneqq: "≨︀",
lvnE: "≨︀",
macr: "¯",
male: "♂",
malt: "✠",
maltese: "✠",
Map: "⤅",
map: "↦",
mapsto: "↦",
mapstodown: "↧",
mapstoleft: "↤",
mapstoup: "↥",
marker: "â–®",
mcomma: "⨩",
Mcy: "М",
mcy: "м",
mdash: "—",
mDDot: "∺",
measuredangle: "∡",
MediumSpace: " ",
Mellintrf: "ℳ",
Mfr: "𝔐",
mfr: "𝔪",
mho: "â„§",
micro: "µ",
midast: "*",
midcir: "â«°",
mid: "∣",
middot: "·",
minusb: "⊟",
minus: "−",
minusd: "∸",
minusdu: "⨪",
MinusPlus: "∓",
mlcp: "â«›",
mldr: "…",
mnplus: "∓",
models: "⊧",
Mopf: "𝕄",
mopf: "𝕞",
mp: "∓",
mscr: "𝓂",
Mscr: "ℳ",
mstpos: "∾",
Mu: "Μ",
mu: "μ",
multimap: "⊸",
mumap: "⊸",
nabla: "∇",
Nacute: "Ń",
nacute: "Å„",
nang: "∠⃒",
nap: "≉",
napE: "⩰̸",
napid: "≋̸",
napos: "ʼn",
napprox: "≉",
natural: "â™®",
naturals: "â„•",
natur: "â™®",
nbsp: "Â ",
nbump: "≎̸",
nbumpe: "≏̸",
ncap: "⩃",
Ncaron: "Ň",
ncaron: "ň",
Ncedil: "Å…",
ncedil: "ņ",
ncong: "≇",
ncongdot: "⩭̸",
ncup: "â©‚",
Ncy: "Н",
ncy: "н",
ndash: "–",
nearhk: "⤤",
nearr: "↗",
neArr: "⇗",
nearrow: "↗",
ne: "≠",
nedot: "≐̸",
NegativeMediumSpace: "​",
NegativeThickSpace: "​",
NegativeThinSpace: "​",
NegativeVeryThinSpace: "​",
nequiv: "≢",
nesear: "⤨",
nesim: "≂̸",
NestedGreaterGreater: "≫",
NestedLessLess: "≪",
NewLine: "\n",
nexist: "∄",
nexists: "∄",
Nfr: "𝔑",
nfr: "𝔫",
ngE: "≧̸",
nge: "≱",
ngeq: "≱",
ngeqq: "≧̸",
ngeqslant: "⩾̸",
nges: "⩾̸",
nGg: "⋙̸",
ngsim: "≵",
nGt: "≫⃒",
ngt: "≯",
ngtr: "≯",
nGtv: "≫̸",
nharr: "↮",
nhArr: "⇎",
nhpar: "⫲",
ni: "∋",
nis: "⋼",
nisd: "⋺",
niv: "∋",
NJcy: "Њ",
njcy: "Ñš",
nlarr: "↚",
nlArr: "⇍",
nldr: "‥",
nlE: "≦̸",
nle: "≰",
nleftarrow: "↚",
nLeftarrow: "⇍",
nleftrightarrow: "↮",
nLeftrightarrow: "⇎",
nleq: "≰",
nleqq: "≦̸",
nleqslant: "⩽̸",
nles: "⩽̸",
nless: "≮",
nLl: "⋘̸",
nlsim: "≴",
nLt: "≪⃒",
nlt: "≮",
nltri: "⋪",
nltrie: "⋬",
nLtv: "≪̸",
nmid: "∤",
NoBreak: "⁠",
NonBreakingSpace: "Â ",
nopf: "𝕟",
Nopf: "â„•",
Not: "⫬",
not: "¬",
NotCongruent: "≢",
NotCupCap: "≭",
NotDoubleVerticalBar: "∦",
NotElement: "∉",
NotEqual: "≠",
NotEqualTilde: "≂̸",
NotExists: "∄",
NotGreater: "≯",
NotGreaterEqual: "≱",
NotGreaterFullEqual: "≧̸",
NotGreaterGreater: "≫̸",
NotGreaterLess: "≹",
NotGreaterSlantEqual: "⩾̸",
NotGreaterTilde: "≵",
NotHumpDownHump: "≎̸",
NotHumpEqual: "≏̸",
notin: "∉",
notindot: "⋵̸",
notinE: "⋹̸",
notinva: "∉",
notinvb: "â‹·",
notinvc: "â‹¶",
NotLeftTriangleBar: "⧏̸",
NotLeftTriangle: "⋪",
NotLeftTriangleEqual: "⋬",
NotLess: "≮",
NotLessEqual: "≰",
NotLessGreater: "≸",
NotLessLess: "≪̸",
NotLessSlantEqual: "⩽̸",
NotLessTilde: "≴",
NotNestedGreaterGreater: "⪢̸",
NotNestedLessLess: "⪡̸",
notni: "∌",
notniva: "∌",
notnivb: "⋾",
notnivc: "⋽",
NotPrecedes: "⊀",
NotPrecedesEqual: "⪯̸",
NotPrecedesSlantEqual: "â‹ ",
NotReverseElement: "∌",
NotRightTriangleBar: "⧐̸",
NotRightTriangle: "â‹«",
NotRightTriangleEqual: "â‹­",
NotSquareSubset: "⊏̸",
NotSquareSubsetEqual: "â‹¢",
NotSquareSuperset: "⊐̸",
NotSquareSupersetEqual: "â‹£",
NotSubset: "⊂⃒",
NotSubsetEqual: "⊈",
NotSucceeds: "⊁",
NotSucceedsEqual: "⪰̸",
NotSucceedsSlantEqual: "â‹¡",
NotSucceedsTilde: "≿̸",
NotSuperset: "⊃⃒",
NotSupersetEqual: "⊉",
NotTilde: "≁",
NotTildeEqual: "≄",
NotTildeFullEqual: "≇",
NotTildeTilde: "≉",
NotVerticalBar: "∤",
nparallel: "∦",
npar: "∦",
nparsl: "⫽⃥",
npart: "∂̸",
npolint: "⨔",
npr: "⊀",
nprcue: "â‹ ",
nprec: "⊀",
npreceq: "⪯̸",
npre: "⪯̸",
nrarrc: "⤳̸",
nrarr: "↛",
nrArr: "⇏",
nrarrw: "↝̸",
nrightarrow: "↛",
nRightarrow: "⇏",
nrtri: "â‹«",
nrtrie: "â‹­",
nsc: "⊁",
nsccue: "â‹¡",
nsce: "⪰̸",
Nscr: "𝒩",
nscr: "𝓃",
nshortmid: "∤",
nshortparallel: "∦",
nsim: "≁",
nsime: "≄",
nsimeq: "≄",
nsmid: "∤",
nspar: "∦",
nsqsube: "â‹¢",
nsqsupe: "â‹£",
nsub: "⊄",
nsubE: "⫅̸",
nsube: "⊈",
nsubset: "⊂⃒",
nsubseteq: "⊈",
nsubseteqq: "⫅̸",
nsucc: "⊁",
nsucceq: "⪰̸",
nsup: "⊅",
nsupE: "⫆̸",
nsupe: "⊉",
nsupset: "⊃⃒",
nsupseteq: "⊉",
nsupseteqq: "⫆̸",
ntgl: "≹",
Ntilde: "Ñ",
ntilde: "ñ",
ntlg: "≸",
ntriangleleft: "⋪",
ntrianglelefteq: "⋬",
ntriangleright: "â‹«",
ntrianglerighteq: "â‹­",
Nu: "Ν",
nu: "ν",
num: "#",
numero: "â„–",
numsp: " ",
nvap: "≍⃒",
nvdash: "⊬",
nvDash: "⊭",
nVdash: "⊮",
nVDash: "⊯",
nvge: "≥⃒",
nvgt: ">⃒",
nvHarr: "⤄",
nvinfin: "â§ž",
nvlArr: "⤂",
nvle: "≤⃒",
nvlt: "<⃒",
nvltrie: "⊴⃒",
nvrArr: "⤃",
nvrtrie: "⊵⃒",
nvsim: "∼⃒",
nwarhk: "⤣",
nwarr: "↖",
nwArr: "⇖",
nwarrow: "↖",
nwnear: "⤧",
Oacute: "Ó",
oacute: "ó",
oast: "⊛",
Ocirc: "Ô",
ocirc: "ô",
ocir: "⊚",
Ocy: "О",
ocy: "о",
odash: "⊝",
Odblac: "Ő",
odblac: "Å‘",
odiv: "⨸",
odot: "⊙",
odsold: "⦼",
OElig: "Å’",
oelig: "Å“",
ofcir: "⦿",
Ofr: "𝔒",
ofr: "𝔬",
ogon: "Ë›",
Ograve: "Ã’",
ograve: "ò",
ogt: "⧁",
ohbar: "⦵",
ohm: "Ω",
oint: "∮",
olarr: "↺",
olcir: "⦾",
olcross: "⦻",
oline: "‾",
olt: "â§€",
Omacr: "Ō",
omacr: "ō",
Omega: "Ω",
omega: "ω",
Omicron: "Ο",
omicron: "ο",
omid: "⦶",
ominus: "⊖",
Oopf: "𝕆",
oopf: "𝕠",
opar: "⦷",
OpenCurlyDoubleQuote: "“",
OpenCurlyQuote: "‘",
operp: "⦹",
oplus: "⊕",
orarr: "↻",
Or: "â©”",
or: "∨",
ord: "⩝",
order: "â„´",
orderof: "â„´",
ordf: "ª",
ordm: "º",
origof: "⊶",
oror: "â©–",
orslope: "â©—",
orv: "â©›",
oS: "Ⓢ",
Oscr: "𝒪",
oscr: "â„´",
Oslash: "Ø",
oslash: "ø",
osol: "⊘",
Otilde: "Õ",
otilde: "õ",
otimesas: "⨶",
Otimes: "⨷",
otimes: "⊗",
Ouml: "Ö",
ouml: "ö",
ovbar: "⌽",
OverBar: "‾",
OverBrace: "⏞",
OverBracket: "⎴",
OverParenthesis: "⏜",
para: "¶",
parallel: "∥",
par: "∥",
parsim: "⫳",
parsl: "⫽",
part: "∂",
PartialD: "∂",
Pcy: "П",
pcy: "п",
percnt: "%",
period: ".",
permil: "‰",
perp: "⊥",
pertenk: "‱",
Pfr: "𝔓",
pfr: "𝔭",
Phi: "Φ",
phi: "φ",
phiv: "Ï•",
phmmat: "ℳ",
phone: "☎",
Pi: "Î ",
pi: "Ï€",
pitchfork: "â‹”",
piv: "Ï–",
planck: "ℏ",
planckh: "ℎ",
plankv: "ℏ",
plusacir: "⨣",
plusb: "⊞",
pluscir: "⨢",
plus: "+",
plusdo: "∔",
plusdu: "⨥",
pluse: "⩲",
PlusMinus: "±",
plusmn: "±",
plussim: "⨦",
plustwo: "⨧",
pm: "±",
Poincareplane: "ℌ",
pointint: "⨕",
popf: "𝕡",
Popf: "â„™",
pound: "£",
prap: "⪷",
Pr: "⪻",
pr: "≺",
prcue: "≼",
precapprox: "⪷",
prec: "≺",
preccurlyeq: "≼",
Precedes: "≺",
PrecedesEqual: "⪯",
PrecedesSlantEqual: "≼",
PrecedesTilde: "≾",
preceq: "⪯",
precnapprox: "⪹",
precneqq: "⪵",
precnsim: "⋨",
pre: "⪯",
prE: "⪳",
precsim: "≾",
prime: "′",
Prime: "″",
primes: "â„™",
prnap: "⪹",
prnE: "⪵",
prnsim: "⋨",
prod: "∏",
Product: "∏",
profalar: "⌮",
profline: "⌒",
profsurf: "⌓",
prop: "∝",
Proportional: "∝",
Proportion: "∷",
propto: "∝",
prsim: "≾",
prurel: "⊰",
Pscr: "𝒫",
pscr: "𝓅",
Psi: "Ψ",
psi: "ψ",
puncsp: " ",
Qfr: "𝔔",
qfr: "𝔮",
qint: "⨌",
qopf: "𝕢",
Qopf: "ℚ",
qprime: "⁗",
Qscr: "𝒬",
qscr: "𝓆",
quaternions: "ℍ",
quatint: "⨖",
quest: "?",
questeq: "≟",
quot: '"',
QUOT: '"',
rAarr: "⇛",
race: "∽̱",
Racute: "Å”",
racute: "Å•",
radic: "√",
raemptyv: "⦳",
rang: "⟩",
Rang: "⟫",
rangd: "⦒",
range: "⦥",
rangle: "⟩",
raquo: "»",
rarrap: "⥵",
rarrb: "⇥",
rarrbfs: "⤠",
rarrc: "⤳",
rarr: "→",
Rarr: "↠",
rArr: "⇒",
rarrfs: "⤞",
rarrhk: "↪",
rarrlp: "↬",
rarrpl: "⥅",
rarrsim: "⥴",
Rarrtl: "⤖",
rarrtl: "↣",
rarrw: "↝",
ratail: "⤚",
rAtail: "⤜",
ratio: "∶",
rationals: "ℚ",
rbarr: "⤍",
rBarr: "⤏",
RBarr: "⤐",
rbbrk: "❳",
rbrace: "}",
rbrack: "]",
rbrke: "⦌",
rbrksld: "⦎",
rbrkslu: "⦐",
Rcaron: "Ř",
rcaron: "Å™",
Rcedil: "Å–",
rcedil: "Å—",
rceil: "⌉",
rcub: "}",
Rcy: "Ð ",
rcy: "Ñ€",
rdca: "⤷",
rdldhar: "⥩",
rdquo: "”",
rdquor: "”",
rdsh: "↳",
real: "ℜ",
realine: "â„›",
realpart: "ℜ",
reals: "ℝ",
Re: "ℜ",
rect: "â–­",
reg: "®",
REG: "®",
ReverseElement: "∋",
ReverseEquilibrium: "⇋",
ReverseUpEquilibrium: "⥯",
rfisht: "⥽",
rfloor: "⌋",
rfr: "𝔯",
Rfr: "ℜ",
rHar: "⥤",
rhard: "⇁",
rharu: "⇀",
rharul: "⥬",
Rho: "Ρ",
rho: "ρ",
rhov: "ϱ",
RightAngleBracket: "⟩",
RightArrowBar: "⇥",
rightarrow: "→",
RightArrow: "→",
Rightarrow: "⇒",
RightArrowLeftArrow: "⇄",
rightarrowtail: "↣",
RightCeiling: "⌉",
RightDoubleBracket: "⟧",
RightDownTeeVector: "⥝",
RightDownVectorBar: "⥕",
RightDownVector: "⇂",
RightFloor: "⌋",
rightharpoondown: "⇁",
rightharpoonup: "⇀",
rightleftarrows: "⇄",
rightleftharpoons: "⇌",
rightrightarrows: "⇉",
rightsquigarrow: "↝",
RightTeeArrow: "↦",
RightTee: "⊢",
RightTeeVector: "⥛",
rightthreetimes: "⋌",
RightTriangleBar: "⧐",
RightTriangle: "⊳",
RightTriangleEqual: "⊵",
RightUpDownVector: "⥏",
RightUpTeeVector: "⥜",
RightUpVectorBar: "⥔",
RightUpVector: "↾",
RightVectorBar: "⥓",
RightVector: "⇀",
ring: "Ëš",
risingdotseq: "≓",
rlarr: "⇄",
rlhar: "⇌",
rlm: "‏",
rmoustache: "⎱",
rmoust: "⎱",
rnmid: "â«®",
roang: "⟭",
roarr: "⇾",
robrk: "⟧",
ropar: "⦆",
ropf: "𝕣",
Ropf: "ℝ",
roplus: "⨮",
rotimes: "⨵",
RoundImplies: "⥰",
rpar: ")",
rpargt: "⦔",
rppolint: "⨒",
rrarr: "⇉",
Rrightarrow: "⇛",
rsaquo: "›",
rscr: "𝓇",
Rscr: "â„›",
rsh: "↱",
Rsh: "↱",
rsqb: "]",
rsquo: "’",
rsquor: "’",
rthree: "⋌",
rtimes: "⋊",
rtri: "â–¹",
rtrie: "⊵",
rtrif: "â–¸",
rtriltri: "â§Ž",
RuleDelayed: "â§´",
ruluhar: "⥨",
rx: "℞",
Sacute: "Åš",
sacute: "Å›",
sbquo: "‚",
scap: "⪸",
Scaron: "Å ",
scaron: "Å¡",
Sc: "⪼",
sc: "≻",
sccue: "≽",
sce: "⪰",
scE: "⪴",
Scedil: "Åž",
scedil: "ÅŸ",
Scirc: "Ŝ",
scirc: "ŝ",
scnap: "⪺",
scnE: "⪶",
scnsim: "â‹©",
scpolint: "⨓",
scsim: "≿",
Scy: "С",
scy: "с",
sdotb: "⊡",
sdot: "â‹…",
sdote: "⩦",
searhk: "⤥",
searr: "↘",
seArr: "⇘",
searrow: "↘",
sect: "§",
semi: ";",
seswar: "⤩",
setminus: "∖",
setmn: "∖",
sext: "✶",
Sfr: "𝔖",
sfr: "𝔰",
sfrown: "⌢",
sharp: "♯",
SHCHcy: "Щ",
shchcy: "щ",
SHcy: "Ш",
shcy: "ш",
ShortDownArrow: "↓",
ShortLeftArrow: "←",
shortmid: "∣",
shortparallel: "∥",
ShortRightArrow: "→",
ShortUpArrow: "↑",
shy: "­",
Sigma: "Σ",
sigma: "σ",
sigmaf: "Ï‚",
sigmav: "Ï‚",
sim: "∼",
simdot: "⩪",
sime: "≃",
simeq: "≃",
simg: "⪞",
simgE: "⪠",
siml: "⪝",
simlE: "⪟",
simne: "≆",
simplus: "⨤",
simrarr: "⥲",
slarr: "←",
SmallCircle: "∘",
smallsetminus: "∖",
smashp: "⨳",
smeparsl: "⧤",
smid: "∣",
smile: "⌣",
smt: "⪪",
smte: "⪬",
smtes: "⪬︀",
SOFTcy: "Ь",
softcy: "ь",
solbar: "⌿",
solb: "â§„",
sol: "/",
Sopf: "𝕊",
sopf: "𝕤",
spades: "â™ ",
spadesuit: "â™ ",
spar: "∥",
sqcap: "⊓",
sqcaps: "⊓︀",
sqcup: "⊔",
sqcups: "⊔︀",
Sqrt: "√",
sqsub: "⊏",
sqsube: "⊑",
sqsubset: "⊏",
sqsubseteq: "⊑",
sqsup: "⊐",
sqsupe: "⊒",
sqsupset: "⊐",
sqsupseteq: "⊒",
square: "â–¡",
Square: "â–¡",
SquareIntersection: "⊓",
SquareSubset: "⊏",
SquareSubsetEqual: "⊑",
SquareSuperset: "⊐",
SquareSupersetEqual: "⊒",
SquareUnion: "⊔",
squarf: "â–ª",
squ: "â–¡",
squf: "â–ª",
srarr: "→",
Sscr: "𝒮",
sscr: "𝓈",
ssetmn: "∖",
ssmile: "⌣",
sstarf: "⋆",
Star: "⋆",
star: "☆",
starf: "★",
straightepsilon: "ϵ",
straightphi: "Ï•",
strns: "¯",
sub: "⊂",
Sub: "⋐",
subdot: "⪽",
subE: "â«…",
sube: "⊆",
subedot: "⫃",
submult: "⫁",
subnE: "â«‹",
subne: "⊊",
subplus: "⪿",
subrarr: "⥹",
subset: "⊂",
Subset: "⋐",
subseteq: "⊆",
subseteqq: "â«…",
SubsetEqual: "⊆",
subsetneq: "⊊",
subsetneqq: "â«‹",
subsim: "⫇",
subsub: "â«•",
subsup: "â«“",
succapprox: "⪸",
succ: "≻",
succcurlyeq: "≽",
Succeeds: "≻",
SucceedsEqual: "⪰",
SucceedsSlantEqual: "≽",
SucceedsTilde: "≿",
succeq: "⪰",
succnapprox: "⪺",
succneqq: "⪶",
succnsim: "â‹©",
succsim: "≿",
SuchThat: "∋",
sum: "∑",
Sum: "∑",
sung: "♪",
sup1: "¹",
sup2: "²",
sup3: "³",
sup: "⊃",
Sup: "â‹‘",
supdot: "⪾",
supdsub: "⫘",
supE: "⫆",
supe: "⊇",
supedot: "â«„",
Superset: "⊃",
SupersetEqual: "⊇",
suphsol: "⟉",
suphsub: "â«—",
suplarr: "⥻",
supmult: "â«‚",
supnE: "⫌",
supne: "⊋",
supplus: "â«€",
supset: "⊃",
Supset: "â‹‘",
supseteq: "⊇",
supseteqq: "⫆",
supsetneq: "⊋",
supsetneqq: "⫌",
supsim: "⫈",
supsub: "â«”",
supsup: "â«–",
swarhk: "⤦",
swarr: "↙",
swArr: "⇙",
swarrow: "↙",
swnwar: "⤪",
szlig: "ß",
Tab: "\t",
target: "⌖",
Tau: "Τ",
tau: "Ï„",
tbrk: "⎴",
Tcaron: "Ť",
tcaron: "Å¥",
Tcedil: "Å¢",
tcedil: "Å£",
Tcy: "Т",
tcy: "Ñ‚",
tdot: "⃛",
telrec: "⌕",
Tfr: "𝔗",
tfr: "𝔱",
there4: "∴",
therefore: "∴",
Therefore: "∴",
Theta: "Θ",
theta: "θ",
thetasym: "Ï‘",
thetav: "Ï‘",
thickapprox: "≈",
thicksim: "∼",
ThickSpace: "  ",
ThinSpace: " ",
thinsp: " ",
thkap: "≈",
thksim: "∼",
THORN: "Þ",
thorn: "þ",
tilde: "˜",
Tilde: "∼",
TildeEqual: "≃",
TildeFullEqual: "≅",
TildeTilde: "≈",
timesbar: "⨱",
timesb: "⊠",
times: "×",
timesd: "⨰",
tint: "∭",
toea: "⤨",
topbot: "⌶",
topcir: "⫱",
top: "⊤",
Topf: "𝕋",
topf: "𝕥",
topfork: "⫚",
tosa: "⤩",
tprime: "‴",
trade: "â„¢",
TRADE: "â„¢",
triangle: "â–µ",
triangledown: "â–¿",
triangleleft: "â—ƒ",
trianglelefteq: "⊴",
triangleq: "≜",
triangleright: "â–¹",
trianglerighteq: "⊵",
tridot: "â—¬",
trie: "≜",
triminus: "⨺",
TripleDot: "⃛",
triplus: "⨹",
trisb: "⧍",
tritime: "⨻",
trpezium: "⏢",
Tscr: "𝒯",
tscr: "𝓉",
TScy: "Ц",
tscy: "ц",
TSHcy: "Ћ",
tshcy: "Ñ›",
Tstrok: "Ŧ",
tstrok: "ŧ",
twixt: "≬",
twoheadleftarrow: "↞",
twoheadrightarrow: "↠",
Uacute: "Ú",
uacute: "ú",
uarr: "↑",
Uarr: "↟",
uArr: "⇑",
Uarrocir: "⥉",
Ubrcy: "ÐŽ",
ubrcy: "Ñž",
Ubreve: "Ŭ",
ubreve: "Å­",
Ucirc: "Û",
ucirc: "û",
Ucy: "У",
ucy: "у",
udarr: "⇅",
Udblac: "Ű",
udblac: "ű",
udhar: "⥮",
ufisht: "⥾",
Ufr: "𝔘",
ufr: "𝔲",
Ugrave: "Ù",
ugrave: "ù",
uHar: "⥣",
uharl: "↿",
uharr: "↾",
uhblk: "â–€",
ulcorn: "⌜",
ulcorner: "⌜",
ulcrop: "⌏",
ultri: "â—¸",
Umacr: "Ū",
umacr: "Å«",
uml: "¨",
UnderBar: "_",
UnderBrace: "⏟",
UnderBracket: "⎵",
UnderParenthesis: "⏝",
Union: "⋃",
UnionPlus: "⊎",
Uogon: "Ų",
uogon: "ų",
Uopf: "𝕌",
uopf: "𝕦",
UpArrowBar: "⤒",
uparrow: "↑",
UpArrow: "↑",
Uparrow: "⇑",
UpArrowDownArrow: "⇅",
updownarrow: "↕",
UpDownArrow: "↕",
Updownarrow: "⇕",
UpEquilibrium: "⥮",
upharpoonleft: "↿",
upharpoonright: "↾",
uplus: "⊎",
UpperLeftArrow: "↖",
UpperRightArrow: "↗",
upsi: "Ï…",
Upsi: "Ï’",
upsih: "Ï’",
Upsilon: "Î¥",
upsilon: "Ï…",
UpTeeArrow: "↥",
UpTee: "⊥",
upuparrows: "⇈",
urcorn: "⌝",
urcorner: "⌝",
urcrop: "⌎",
Uring: "Å®",
uring: "ů",
urtri: "â—¹",
Uscr: "𝒰",
uscr: "𝓊",
utdot: "â‹°",
Utilde: "Ũ",
utilde: "Å©",
utri: "â–µ",
utrif: "â–´",
uuarr: "⇈",
Uuml: "Ü",
uuml: "ü",
uwangle: "⦧",
vangrt: "⦜",
varepsilon: "ϵ",
varkappa: "ϰ",
varnothing: "∅",
varphi: "Ï•",
varpi: "Ï–",
varpropto: "∝",
varr: "↕",
vArr: "⇕",
varrho: "ϱ",
varsigma: "Ï‚",
varsubsetneq: "⊊︀",
varsubsetneqq: "⫋︀",
varsupsetneq: "⊋︀",
varsupsetneqq: "⫌︀",
vartheta: "Ï‘",
vartriangleleft: "⊲",
vartriangleright: "⊳",
vBar: "⫨",
Vbar: "â««",
vBarv: "â«©",
Vcy: "Ð’",
vcy: "в",
vdash: "⊢",
vDash: "⊨",
Vdash: "⊩",
VDash: "⊫",
Vdashl: "⫦",
veebar: "⊻",
vee: "∨",
Vee: "⋁",
veeeq: "≚",
vellip: "â‹®",
verbar: "|",
Verbar: "‖",
vert: "|",
Vert: "‖",
VerticalBar: "∣",
VerticalLine: "|",
VerticalSeparator: "❘",
VerticalTilde: "≀",
VeryThinSpace: " ",
Vfr: "𝔙",
vfr: "𝔳",
vltri: "⊲",
vnsub: "⊂⃒",
vnsup: "⊃⃒",
Vopf: "𝕍",
vopf: "𝕧",
vprop: "∝",
vrtri: "⊳",
Vscr: "𝒱",
vscr: "𝓋",
vsubnE: "⫋︀",
vsubne: "⊊︀",
vsupnE: "⫌︀",
vsupne: "⊋︀",
Vvdash: "⊪",
vzigzag: "⦚",
Wcirc: "Å´",
wcirc: "ŵ",
wedbar: "⩟",
wedge: "∧",
Wedge: "â‹€",
wedgeq: "≙",
weierp: "℘",
Wfr: "𝔚",
wfr: "𝔴",
Wopf: "𝕎",
wopf: "𝕨",
wp: "℘",
wr: "≀",
wreath: "≀",
Wscr: "𝒲",
wscr: "𝓌",
xcap: "â‹‚",
xcirc: "â—¯",
xcup: "⋃",
xdtri: "â–½",
Xfr: "𝔛",
xfr: "𝔵",
xharr: "⟷",
xhArr: "⟺",
Xi: "Ξ",
xi: "ξ",
xlarr: "⟵",
xlArr: "⟸",
xmap: "⟼",
xnis: "â‹»",
xodot: "⨀",
Xopf: "𝕏",
xopf: "𝕩",
xoplus: "⨁",
xotime: "⨂",
xrarr: "⟶",
xrArr: "⟹",
Xscr: "𝒳",
xscr: "𝓍",
xsqcup: "⨆",
xuplus: "⨄",
xutri: "â–³",
xvee: "⋁",
xwedge: "â‹€",
Yacute: "Ý",
yacute: "ý",
YAcy: "Я",
yacy: "я",
Ycirc: "Ŷ",
ycirc: "Å·",
Ycy: "Ы",
ycy: "Ñ‹",
yen: "Â¥",
Yfr: "𝔜",
yfr: "𝔶",
YIcy: "Ї",
yicy: "Ñ—",
Yopf: "𝕐",
yopf: "𝕪",
Yscr: "𝒴",
yscr: "𝓎",
YUcy: "Ю",
yucy: "ÑŽ",
yuml: "ÿ",
Yuml: "Ÿ",
Zacute: "Ź",
zacute: "ź",
Zcaron: "Ž",
zcaron: "ž",
Zcy: "З",
zcy: "з",
Zdot: "Å»",
zdot: "ż",
zeetrf: "ℨ",
ZeroWidthSpace: "​",
Zeta: "Ζ",
zeta: "ζ",
zfr: "𝔷",
Zfr: "ℨ",
ZHcy: "Ж",
zhcy: "ж",
zigrarr: "⇝",
zopf: "𝕫",
Zopf: "ℤ",
Zscr: "𝒵",
zscr: "𝓏",
zwj: "‍",
zwnj: "‌"
},
Yc = {
Aacute: "Á",
aacute: "á",
Acirc: "Â",
acirc: "â",
acute: "´",
AElig: "Æ",
aelig: "æ",
Agrave: "À",
agrave: "Ã ",
amp: "&",
AMP: "&",
Aring: "Ã…",
aring: "Ã¥",
Atilde: "Ã",
atilde: "ã",
Auml: "Ä",
auml: "ä",
brvbar: "¦",
Ccedil: "Ç",
ccedil: "ç",
cedil: "¸",
cent: "¢",
copy: "©",
COPY: "©",
curren: "¤",
deg: "°",
divide: "÷",
Eacute: "É",
eacute: "é",
Ecirc: "Ê",
ecirc: "ê",
Egrave: "È",
egrave: "è",
ETH: "Ð",
eth: "ð",
Euml: "Ë",
euml: "ë",
frac12: "½",
frac14: "¼",
frac34: "¾",
gt: ">",
GT: ">",
Iacute: "Í",
iacute: "í",
Icirc: "ÃŽ",
icirc: "î",
iexcl: "¡",
Igrave: "Ì",
igrave: "ì",
iquest: "¿",
Iuml: "Ï",
iuml: "ï",
laquo: "«",
lt: "<",
LT: "<",
macr: "¯",
micro: "µ",
middot: "·",
nbsp: "Â ",
not: "¬",
Ntilde: "Ñ",
ntilde: "ñ",
Oacute: "Ó",
oacute: "ó",
Ocirc: "Ô",
ocirc: "ô",
Ograve: "Ã’",
ograve: "ò",
ordf: "ª",
ordm: "º",
Oslash: "Ø",
oslash: "ø",
Otilde: "Õ",
otilde: "õ",
Ouml: "Ö",
ouml: "ö",
para: "¶",
plusmn: "±",
pound: "£",
quot: '"',
QUOT: '"',
raquo: "»",
reg: "®",
REG: "®",
sect: "§",
shy: "­",
sup1: "¹",
sup2: "²",
sup3: "³",
szlig: "ß",
THORN: "Þ",
thorn: "þ",
times: "×",
Uacute: "Ú",
uacute: "ú",
Ucirc: "Û",
ucirc: "û",
Ugrave: "Ù",
ugrave: "ù",
uml: "¨",
Uuml: "Ü",
uuml: "ü",
Yacute: "Ý",
yacute: "ý",
yen: "Â¥",
yuml: "ÿ"
},
eu = {
amp: "&",
apos: "'",
gt: ">",
lt: "<",
quot: '"'
},
tu = {},
nu = Wc && Wc.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
};
Object.defineProperty(tu, "__esModule", {
value: !0
});
var ru = nu({
0: 65533,
128: 8364,
130: 8218,
131: 402,
132: 8222,
133: 8230,
134: 8224,
135: 8225,
136: 710,
137: 8240,
138: 352,
139: 8249,
140: 338,
142: 381,
145: 8216,
146: 8217,
147: 8220,
148: 8221,
149: 8226,
150: 8211,
151: 8212,
152: 732,
153: 8482,
154: 353,
155: 8250,
156: 339,
158: 382,
159: 376
}),
ou = String.fromCodePoint || function(e) {
var t = "";
return e > 65535 && (e -= 65536, t += String.fromCharCode(e >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), t += String.fromCharCode(e)
};
tu.default = function(e) {
return e >= 55296 && e <= 57343 || e > 1114111 ? "�" : (e in ru.default && (e = ru.default[e]), ou(e))
};
var iu = Wc && Wc.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
};
Object.defineProperty(Xc, "__esModule", {
value: !0
}), Xc.decodeHTML = Xc.decodeHTMLStrict = Xc.decodeXML = void 0;
var su = iu(Qc),
au = iu(Yc),
lu = iu(eu),
cu = iu(tu),
uu = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
function du(e) {
var t = hu(e);
return function(e) {
return String(e).replace(uu, t)
}
}
Xc.decodeXML = du(lu.default), Xc.decodeHTMLStrict = du(su.default);
var pu = function(e, t) {
return e < t ? 1 : -1
};
function hu(e) {
return function(t) {
if ("#" === t.charAt(1)) {
var n = t.charAt(2);
return "X" === n || "x" === n ? cu.default(parseInt(t.substr(3), 16)) : cu.default(parseInt(t.substr(2), 10))
}
return e[t.slice(1, -1)] || t
}
}
Xc.decodeHTML = function() {
for (var e = Object.keys(au.default).sort(pu), t = Object.keys(su.default).sort(pu), n = 0, r = 0; n < t.length; n++) e[r] === t[n] ? (t[n] += ";?", r++) : t[n] += ";";
var o = new RegExp("&(?:" + t.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"),
i = hu(su.default);
function s(e) {
return ";" !== e.substr(-1) && (e += ";"), i(e)
}
return function(e) {
return String(e).replace(o, s)
}
}();
var fu = {},
mu = Wc && Wc.__importDefault || function(e) {
return e && e.__esModule ? e : {
default: e
}
};
Object.defineProperty(fu, "__esModule", {
value: !0
}), fu.escapeUTF8 = fu.escape = fu.encodeNonAsciiHTML = fu.encodeHTML = fu.encodeXML = void 0;
var gu = xu(mu(eu).default),
vu = Cu(gu);
fu.encodeXML = Nu(gu);
var yu, bu, wu = xu(mu(Qc).default),
ku = Cu(wu);
function xu(e) {
return Object.keys(e).sort().reduce((function(t, n) {
return t[e[n]] = "&" + n + ";", t
}), {})
}
function Cu(e) {
for (var t = [], n = [], r = 0, o = Object.keys(e); r < o.length; r++) {
var i = o[r];
1 === i.length ? t.push("\\" + i) : n.push(i)
}
t.sort();
for (var s = 0; s < t.length - 1; s++) {
for (var a = s; a < t.length - 1 && t[a].charCodeAt(1) + 1 === t[a + 1].charCodeAt(1);) a += 1;
var l = 1 + a - s;
l < 3 || t.splice(s, l, t[s] + "-" + t[a])
}
return n.unshift("[" + t.join("") + "]"), new RegExp(n.join("|"), "g")
}
fu.encodeHTML = (yu = wu, bu = ku, function(e) {
return e.replace(bu, (function(e) {
return yu[e]
})).replace(Tu, Su)
}), fu.encodeNonAsciiHTML = Nu(wu);
var Tu = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,
Mu = null != String.prototype.codePointAt ? function(e) {
return e.codePointAt(0)
} : function(e) {
return 1024 * (e.charCodeAt(0) - 55296) + e.charCodeAt(1) - 56320 + 65536
};
function Su(e) {
return "&#x" + (e.length > 1 ? Mu(e) : e.charCodeAt(0)).toString(16).toUpperCase() + ";"
}
var Eu = new RegExp(vu.source + "|" + Tu.source, "g");
function Nu(e) {
return function(t) {
return t.replace(Eu, (function(t) {
return e[t] || Su(t)
}))
}
}
fu.escape = function(e) {
return e.replace(Eu, Su)
}, fu.escapeUTF8 = function(e) {
return e.replace(vu, Su)
},
function(e) {
Object.defineProperty(e, "__esModule", {
value: !0
}), e.decodeXMLStrict = e.decodeHTML5Strict = e.decodeHTML4Strict = e.decodeHTML5 = e.decodeHTML4 = e.decodeHTMLStrict = e.decodeHTML = e.decodeXML = e.encodeHTML5 = e.encodeHTML4 = e.escapeUTF8 = e.escape = e.encodeNonAsciiHTML = e.encodeHTML = e.encodeXML = e.encode = e.decodeStrict = e.decode = void 0;
var t = Xc,
n = fu;
e.decode = function(e, n) {
return (!n || n <= 0 ? t.decodeXML : t.decodeHTML)(e)
}, e.decodeStrict = function(e, n) {
return (!n || n <= 0 ? t.decodeXML : t.decodeHTMLStrict)(e)
}, e.encode = function(e, t) {
return (!t || t <= 0 ? n.encodeXML : n.encodeHTML)(e)
};
var r = fu;
Object.defineProperty(e, "encodeXML", {
enumerable: !0,
get: function() {
return r.encodeXML
}
}), Object.defineProperty(e, "encodeHTML", {
enumerable: !0,
get: function() {
return r.encodeHTML
}
}), Object.defineProperty(e, "encodeNonAsciiHTML", {
enumerable: !0,
get: function() {
return r.encodeNonAsciiHTML
}
}), Object.defineProperty(e, "escape", {
enumerable: !0,
get: function() {
return r.escape
}
}), Object.defineProperty(e, "escapeUTF8", {
enumerable: !0,
get: function() {
return r.escapeUTF8
}
}), Object.defineProperty(e, "encodeHTML4", {
enumerable: !0,
get: function() {
return r.encodeHTML
}
}), Object.defineProperty(e, "encodeHTML5", {
enumerable: !0,
get: function() {
return r.encodeHTML
}
});
var o = Xc;
Object.defineProperty(e, "decodeXML", {
enumerable: !0,
get: function() {
return o.decodeXML
}
}), Object.defineProperty(e, "decodeHTML", {
enumerable: !0,
get: function() {
return o.decodeHTML
}
}), Object.defineProperty(e, "decodeHTMLStrict", {
enumerable: !0,
get: function() {
return o.decodeHTMLStrict
}
}), Object.defineProperty(e, "decodeHTML4", {
enumerable: !0,
get: function() {
return o.decodeHTML
}
}), Object.defineProperty(e, "decodeHTML5", {
enumerable: !0,
get: function() {
return o.decodeHTML
}
}), Object.defineProperty(e, "decodeHTML4Strict", {
enumerable: !0,
get: function() {
return o.decodeHTMLStrict
}
}), Object.defineProperty(e, "decodeHTML5Strict", {
enumerable: !0,
get: function() {
return o.decodeHTMLStrict
}
}), Object.defineProperty(e, "decodeXMLStrict", {
enumerable: !0,
get: function() {
return o.decodeXML
}
})
}(Zc);
var Ou = "&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});",
Du = /[\\&]/,
Au = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",
Lu = new RegExp("\\\\" + Au + "|" + Ou, "gi"),
Iu = new RegExp('[&<>"]', "g"),
Ru = function(e) {
return 92 === e.charCodeAt(0) ? e.charAt(1) : Zc.decodeHTML(e)
};
function Pu(e) {
return Du.test(e) ? e.replace(Lu, Ru) : e
}
function Bu(e) {
try {
return Kc(e)
} catch (t) {
return e
}
}
function Fu(e) {
switch (e) {
case "&":
return "&amp;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case '"':
return "&quot;";
default:
return e
}
}
function Hu(e) {
return Iu.test(e) ? e.replace(Iu, Fu) : e
}
function zu(e, t) {
for (var n = [], r = 0; r < t; r++) n.push(e);
return n.join("")
}
function qu(e) {
return !e || !/[^ \t]+/.test(e)
}
var Vu = function() {
function e(e) {
this.current = e, this.root = e, this.entering = !0
}
return e.prototype.next = function() {
var e = this.current,
t = this.entering;
if (null === e) return null;
var n = ju(e);
return t && n ? e.firstChild ? (this.current = e.firstChild, this.entering = !0) : this.entering = !1 : e === this.root ? this.current = null : null === e.next ? (this.current = e.parent, this.entering = !1) : (this.current = e.next, this.entering = !0), {
entering: t,
node: e
}
}, e.prototype.resumeAt = function(e, t) {
this.current = e, this.entering = !0 === t
}, e
}();
function ju(e) {
switch (e.type) {
case "document":
case "blockQuote":
case "list":
case "item":
case "paragraph":
case "heading":
case "emph":
case "strong":
case "strike":
case "link":
case "image":
case "table":
case "tableHead":
case "tableBody":
case "tableRow":
case "tableCell":
case "tableDelimRow":
case "customInline":
return !0;
default:
return !1
}
}
var $u = 1,
_u = {};
function Uu(e) {
delete _u[e]
}
var Wu = function() {
function e(e, t) {
this.parent = null, this.prev = null, this.next = null, this.firstChild = null, this.lastChild = null, this.literal = null, this.id = "document" === e ? -1 : $u++, this.type = e, this.sourcepos = t, _u[this.id] = this
}
return e.prototype.isContainer = function() {
return ju(this)
}, e.prototype.unlink = function() {
this.prev ? this.prev.next = this.next : this.parent && (this.parent.firstChild = this.next), this.next ? this.next.prev = this.prev : this.parent && (this.parent.lastChild = this.prev), this.parent = null, this.next = null, this.prev = null
}, e.prototype.replaceWith = function(e) {
this.insertBefore(e), this.unlink()
}, e.prototype.insertAfter = function(e) {
e.unlink(), e.next = this.next, e.next && (e.next.prev = e), e.prev = this, this.next = e, this.parent && (e.parent = this.parent, e.next || (e.parent.lastChild = e))
}, e.prototype.insertBefore = function(e) {
e.unlink(), e.prev = this.prev, e.prev && (e.prev.next = e), e.next = this, this.prev = e, e.parent = this.parent, e.prev || (e.parent.firstChild = e)
}, e.prototype.appendChild = function(e) {
e.unlink(), e.parent = this, this.lastChild ? (this.lastChild.next = e, e.prev = this.lastChild, this.lastChild = e) : (this.firstChild = e, this.lastChild = e)
}, e.prototype.prependChild = function(e) {
e.unlink(), e.parent = this, this.firstChild ? (this.firstChild.prev = e, e.next = this.firstChild, this.firstChild = e) : (this.firstChild = e, this.lastChild = e)
}, e.prototype.walker = function() {
return new Vu(this)
}, e
}(),
Ju = function(e) {
function t(t, n) {
var r = e.call(this, t, n) || this;
return r.open = !0, r.lineOffsets = null, r.stringContent = null, r.lastLineBlank = !1, r.lastLineChecked = !1, r.type = t, r
}
return $c(t, e), t
}(Wu),
Gu = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.listData = null, t
}
return $c(t, e), t
}(Ju),
Ku = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.level = 0, t.headingType = "atx", t
}
return $c(t, e), t
}(Ju),
Zu = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.isFenced = !1, t.fenceChar = null, t.fenceLength = 0, t.fenceOffset = -1, t.info = null, t.infoPadding = 0, t
}
return $c(t, e), t
}(Ju),
Xu = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.columns = [], t
}
return $c(t, e), t
}(Ju),
Qu = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.startIdx = 0, t.endIdx = 0, t.paddingLeft = 0, t.paddingRight = 0, t.ignored = !1, t
}
return $c(t, e), t
}(Ju),
Yu = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.title = "", t.dest = "", t.label = "", t
}
return $c(t, e), t
}(Ju),
ed = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.syntaxLength = 0, t.offset = -1, t.info = "", t
}
return $c(t, e), t
}(Ju),
td = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.htmlBlockType = -1, t
}
return $c(t, e), t
}(Ju),
nd = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.destination = null, t.title = null, t.extendedAutolink = !1, t
}
return $c(t, e), t
}(Wu),
rd = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.tickCount = 0, t
}
return $c(t, e), t
}(Wu),
od = function(e) {
function t() {
var t = null !== e && e.apply(this, arguments) || this;
return t.info = "", t
}
return $c(t, e), t
}(Wu);
function id(e, t) {
switch (e) {
case "heading":
return new Ku(e, t);
case "list":
case "item":
return new Gu(e, t);
case "link":
case "image":
return new nd(e, t);
case "codeBlock":
return new Zu(e, t);
case "htmlBlock":
return new td(e, t);
case "table":
return new Xu(e, t);
case "tableCell":
return new Qu(e, t);
case "document":
case "paragraph":
case "blockQuote":
case "thematicBreak":
case "tableRow":
case "tableBody":
case "tableHead":
case "frontMatter":
return new Ju(e, t);
case "code":
return new rd(e, t);
case "refDef":
return new Yu(e, t);
case "customBlock":
return new ed(e, t);
case "customInline":
return new od(e, t);
default:
return new Wu(e, t)
}
}
function sd(e) {
return "codeBlock" === e.type
}
function ad(e) {
return "list" === e.type
}
function ld(e) {
return "refDef" === e.type
}
function cd(e) {
return "customBlock" === e.type
}
function ud(e, t) {
var n = id("text", t);
return n.literal = e, n
}
var dd, pd = "[A-Za-z][A-Za-z0-9-]*",
hd = "<" + pd + "(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",
fd = "</" + pd + "\\s*[>]",
md = new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*[>]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)", "i");
if (String.fromCodePoint) dd = function(e) {
try {
return String.fromCodePoint(e)
} catch (e) {
if (e instanceof RangeError) return String.fromCharCode(65533);
throw e
}
};
else {
var gd = String.fromCharCode,
vd = Math.floor;
dd = function() {
for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
var n, r, o = 16384,
i = [],
s = -1,
a = e.length;
if (!a) return "";
for (var l = ""; ++s < a;) {
var c = Number(e[s]);
if (!isFinite(c) || c < 0 || c > 1114111 || vd(c) !== c) return String.fromCharCode(65533);
c <= 65535 ? i.push(c) : (n = 55296 + ((c -= 65536) >> 10), r = c % 1024 + 56320, i.push(n, r)), (s + 1 === a || i.length > o) && (l += gd.apply(void 0, i), i.length = 0)
}
return l
}
}
var yd = dd;
function bd(e) {
var t = /\)+$/.exec(e);
if (t) {
for (var n = 0, r = 0, o = e; r < o.length; r++) {
var i = o[r];
"(" === i ? n < 0 ? n = 1 : n += 1 : ")" === i && (n -= 1)
}
if (n < 0) {
var s = Math.min(-n, t[0].length);
return e.substring(0, e.length - s)
}
}
return e
}
function wd(e) {
return e.replace(/&[A-Za-z0-9]+;$/, "")
}
function kd(e) {
return Uc(Uc([], function(e) {
for (var t, n = new RegExp("(www|https?://).(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+[^<\\s]*[^<?!.,:*_?~\\s]", "g"), r = []; t = n.exec(e);) {
var o = wd(bd(t[0])),
i = "www" === t[1] ? "http://" : "";
r.push({
text: o,
range: [t.index, t.index + o.length - 1],
url: "" + i + o
})
}
return r
}(e)), function(e) {
for (var t, n = new RegExp("[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+", "g"), r = []; t = n.exec(e);) {
var o = t[0];
/[_-]+$/.test(o) || r.push({
text: o,
range: [t.index, t.index + o.length - 1],
url: "mailto:" + o
})
}
return r
}(e)).sort((function(e, t) {
return e.range[0] - t.range[0]
}))
}
function xd(e) {
return e[e.length - 1]
}
function Cd(e) {
return e.slice(1, e.length - 1).trim().replace(/[ \t\r\n]+/, " ").toLowerCase().toUpperCase()
}
function Td(e, t) {
Object.keys(e).forEach((function(n) {
t(n, e[n])
}))
}
function Md(e) {
return !Object.keys(e).length
}
var Sd = 126,
Ed = 39,
Nd = 34,
Od = 36,
Dd = "\\\\" + Au,
Ad = new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/),
Ld = new RegExp('^(?:"(' + Dd + '|[^"\\x00])*"|\'(' + Dd + "|[^'\\x00])*'|\\((" + Dd + "|[^()\\x00])*\\))"),
Id = /^(?:<(?:[^<>\n\\\x00]|\\.)*>)/,
Rd = new RegExp("^" + Au),
Pd = new RegExp("^" + Ou, "i"),
Bd = /`+/,
Fd = /^`+/,
Hd = /\.\.\./g,
zd = /--+/g,
qd = /^<([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])?)*)>/,
Vd = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i,
jd = /^ *(?:\n *)?/,
$d = /^[ \t\n\x0b\x0c\x0d]/,
_d = /^\s/,
Ud = / *$/,
Wd = /^ */,
Jd = /^ *(?:\n|$)/,
Gd = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/,
Kd = /^[^\n`\[\]\\!<&*_'"~$]+/m,
Zd = function() {
function e(e) {
this.subject = "", this.delimiters = null, this.brackets = null, this.pos = 0, this.lineStartNum = 0, this.lineIdx = 0, this.lineOffsets = [0], this.linePosOffset = 0, this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.options = e
}
return e.prototype.sourcepos = function(e, t) {
var n = this.linePosOffset + this.lineOffsets[this.lineIdx],
r = this.lineStartNum + this.lineIdx,
o = [r, e + n];
return "number" == typeof t ? [o, [r, t + n]] : o
}, e.prototype.nextLine = function() {
this.lineIdx += 1, this.linePosOffset = -this.pos
}, e.prototype.match = function(e) {
var t = e.exec(this.subject.slice(this.pos));
return null === t ? null : (this.pos += t.index + t[0].length, t[0])
}, e.prototype.peek = function() {
return this.pos < this.subject.length ? this.subject.charCodeAt(this.pos) : -1
}, e.prototype.spnl = function() {
return this.match(jd), !0
}, e.prototype.parseBackticks = function(e) {
var t = this.pos + 1,
n = this.match(Fd);
if (null === n) return !1;
for (var r, o = this.pos; null !== (r = this.match(Bd));)
if (r === n) {
var i = this.subject.slice(o, this.pos - n.length),
s = this.sourcepos(t, this.pos),
a = i.split("\n");
if (a.length > 1) {
var l = xd(a);
this.lineIdx += a.length - 1, this.linePosOffset = -(this.pos - l.length - n.length), s[1] = this.sourcepos(this.pos), i = a.join(" ")
}
var c = id("code", s);
return i.length > 0 && null !== i.match(/[^ ]/) && " " == i[0] && " " == i[i.length - 1] ? c.literal = i.slice(1, i.length - 1) : c.literal = i, c.tickCount = n.length, e.appendChild(c), !0
} return this.pos = o, e.appendChild(ud(n, this.sourcepos(t, this.pos - 1))), !0
}, e.prototype.parseBackslash = function(e) {
var t, n = this.subject;
this.pos += 1;
var r = this.pos;
return 10 === this.peek() ? (this.pos += 1, t = id("linebreak", this.sourcepos(this.pos - 1, this.pos)), e.appendChild(t), this.nextLine()) : Rd.test(n.charAt(this.pos)) ? (e.appendChild(ud(n.charAt(this.pos), this.sourcepos(r, this.pos))), this.pos += 1) : e.appendChild(ud("\\", this.sourcepos(r, r))), !0
}, e.prototype.parseAutolink = function(e) {
var t, n, r, o = this.pos + 1;
return (t = this.match(qd)) ? (n = t.slice(1, t.length - 1), (r = id("link", this.sourcepos(o, this.pos))).destination = Bu("mailto:" + n), r.title = "", r.appendChild(ud(n, this.sourcepos(o + 1, this.pos - 1))), e.appendChild(r), !0) : !!(t = this.match(Vd)) && (n = t.slice(1, t.length - 1), (r = id("link", this.sourcepos(o, this.pos))).destination = Bu(n), r.title = "", r.appendChild(ud(n, this.sourcepos(o + 1, this.pos - 1))), e.appendChild(r), !0)
}, e.prototype.parseHtmlTag = function(e) {
var t = this.pos + 1,
n = this.match(md);
if (null === n) return !1;
var r = id("htmlInline", this.sourcepos(t, this.pos));
return r.literal = n, e.appendChild(r), !0
}, e.prototype.scanDelims = function(e) {
var t = 0,
n = this.pos;
if (e === Ed || e === Nd) t++, this.pos++;
else
for (; this.peek() === e;) t++, this.pos++;
if (0 === t || t < 2 && (e === Sd || e === Od)) return this.pos = n, null;
var r, o = 0 === n ? "\n" : this.subject.charAt(n - 1),
i = this.peek();
r = -1 === i ? "\n" : yd(i);
var s, a, l = _d.test(r),
c = Ad.test(r),
u = _d.test(o),
d = Ad.test(o),
p = !l && (!c || u || d),
h = !u && (!d || l || c);
return 95 === e ? (s = p && (!h || d), a = h && (!p || c)) : e === Ed || e === Nd ? (s = p && !h, a = h) : e === Od ? (s = !l, a = !u) : (s = p, a = h), this.pos = n, {
numdelims: t,
canOpen: s,
canClose: a
}
}, e.prototype.handleDelim = function(e, t) {
var n = this.scanDelims(e);
if (!n) return !1;
var r = n.numdelims,
o = this.pos + 1;
this.pos += r;
var i = ud(e === Ed ? "’" : e === Nd ? "“" : this.subject.slice(o - 1, this.pos), this.sourcepos(o, this.pos));
return t.appendChild(i), (n.canOpen || n.canClose) && (this.options.smart || e !== Ed && e !== Nd) && (this.delimiters = {
cc: e,
numdelims: r,
origdelims: r,
node: i,
previous: this.delimiters,
next: null,
canOpen: n.canOpen,
canClose: n.canClose
}, this.delimiters.previous && (this.delimiters.previous.next = this.delimiters)), !0
}, e.prototype.removeDelimiter = function(e) {
null !== e.previous && (e.previous.next = e.next), null === e.next ? this.delimiters = e.previous : e.next.previous = e.previous
}, e.prototype.removeDelimitersBetween = function(e, t) {
e.next !== t && (e.next = t, t.previous = e)
}, e.prototype.processEmphasis = function(e) {
var t, n, r, o, i, s, a, l = !1,
c = ((t = {})[95] = [e, e, e], t[42] = [e, e, e], t[39] = [e], t[34] = [e], t[126] = [e], t[36] = [e], t);
for (r = this.delimiters; null !== r && r.previous !== e;) r = r.previous;
for (; null !== r;) {
var u = r.cc,
d = 95 === u || 42 === u;
if (r.canClose) {
for (n = r.previous, a = !1; null !== n && n !== e && n !== c[u][d ? r.origdelims % 3 : 0];) {
if (l = d && (r.canOpen || n.canClose) && r.origdelims % 3 != 0 && (n.origdelims + r.origdelims) % 3 == 0, n.cc === r.cc && n.canOpen && !l) {
a = !0;
break
}
n = n.previous
}
if (o = r, d || u === Sd || u === Od)
if (a) {
if (n) {
var p = r.numdelims >= 2 && n.numdelims >= 2 ? 2 : 1,
h = d ? 0 : 1;
i = n.node, s = r.node;
var f = d ? 1 === p ? "emph" : "strong" : "strike";
u === Od && (f = "customInline");
var m = id(f),
g = i.sourcepos[1],
v = s.sourcepos[0];
m.sourcepos = [
[g[0], g[1] - p + 1],
[v[0], v[1] + p - 1]
], i.sourcepos[1][1] -= p, s.sourcepos[0][1] += p, i.literal = i.literal.slice(p), s.literal = s.literal.slice(p), n.numdelims -= p, r.numdelims -= p;
for (var y = i.next, b = void 0; y && y !== s;) b = y.next, y.unlink(), m.appendChild(y), y = b;
if (u === Od) {
var w = m.firstChild,
k = w.literal || "",
x = k.split(/\s/)[0];
m.info = x, k.length <= x.length ? w.unlink() : (w.sourcepos[0][1] += x.length, w.literal = k.replace(x + " ", ""))
}
if (i.insertAfter(m), this.removeDelimitersBetween(n, r), n.numdelims <= h && (0 === n.numdelims && i.unlink(), this.removeDelimiter(n)), r.numdelims <= h) {
0 === r.numdelims && s.unlink();
var C = r.next;
this.removeDelimiter(r), r = C
}
}
} else r = r.next;
else u === Ed ? (r.node.literal = "’", a && (n.node.literal = "‘"), r = r.next) : u === Nd && (r.node.literal = "”", a && (n.node.literal = "“"), r = r.next);
a || (c[u][d ? o.origdelims % 3 : 0] = o.previous, o.canOpen || this.removeDelimiter(o))
} else r = r.next
}
for (; null !== this.delimiters && this.delimiters !== e;) this.removeDelimiter(this.delimiters)
}, e.prototype.parseLinkTitle = function() {
var e = this.match(Ld);
return null === e ? null : Pu(e.substr(1, e.length - 2))
}, e.prototype.parseLinkDestination = function() {
var e = this.match(Id);
if (null === e) {
if (60 === this.peek()) return null;
for (var t = this.pos, n = 0, r = void 0; - 1 !== (r = this.peek());)
if (92 === r && Rd.test(this.subject.charAt(this.pos + 1))) this.pos += 1, -1 !== this.peek() && (this.pos += 1);
else if (40 === r) this.pos += 1, n += 1;
else if (41 === r) {
if (n < 1) break;
this.pos += 1, n -= 1
} else {
if (null !== $d.exec(yd(r))) break;
this.pos += 1
}
return this.pos === t && 41 !== r || 0 !== n ? null : Bu(Pu(e = this.subject.substr(t, this.pos - t)))
}
return Bu(Pu(e.substr(1, e.length - 2)))
}, e.prototype.parseLinkLabel = function() {
var e = this.match(Gd);
return null === e || e.length > 1001 ? 0 : e.length
}, e.prototype.parseOpenBracket = function(e) {
var t = this.pos;
this.pos += 1;
var n = ud("[", this.sourcepos(this.pos, this.pos));
return e.appendChild(n), this.addBracket(n, t, !1), !0
}, e.prototype.parseBang = function(e) {
var t = this.pos;
if (this.pos += 1, 91 === this.peek()) {
this.pos += 1;
var n = ud("![", this.sourcepos(this.pos - 1, this.pos));
e.appendChild(n), this.addBracket(n, t + 1, !0)
} else {
n = ud("!", this.sourcepos(this.pos, this.pos));
e.appendChild(n)
}
return !0
}, e.prototype.parseCloseBracket = function(e) {
var t = null,
n = null,
r = !1;
this.pos += 1;
var o = this.pos,
i = this.brackets;
if (null === i) return e.appendChild(ud("]", this.sourcepos(o, o))), !0;
if (!i.active) return e.appendChild(ud("]", this.sourcepos(o, o))), this.removeBracket(), !0;
var s = i.image,
a = this.pos;
40 === this.peek() && (this.pos++, this.spnl() && null !== (t = this.parseLinkDestination()) && this.spnl() && ($d.test(this.subject.charAt(this.pos - 1)) && (n = this.parseLinkTitle()), 1) && this.spnl() && 41 === this.peek() ? (this.pos += 1, r = !0) : this.pos = a);
var l = "";
if (!r) {
var c = this.pos,
u = this.parseLinkLabel();
if (u > 2 ? l = this.subject.slice(c, c + u) : i.bracketAfter || (l = this.subject.slice(i.index, o)), 0 === u && (this.pos = a), l) {
l = Cd(l);
var d = this.refMap[l];
d && (t = d.destination, n = d.title, r = !0)
}
}
if (r) {
var p = id(s ? "image" : "link");
p.destination = t, p.title = n || "", p.sourcepos = [i.startpos, this.sourcepos(this.pos)];
for (var h = i.node.next, f = void 0; h;) f = h.next, h.unlink(), p.appendChild(h), h = f;
if (e.appendChild(p), this.processEmphasis(i.previousDelimiter), this.removeBracket(), i.node.unlink(), !s)
for (i = this.brackets; null !== i;) i.image || (i.active = !1), i = i.previous;
return this.options.referenceDefinition && (this.refLinkCandidateMap[e.id] = {
node: e,
refLabel: l
}), !0
}
return this.removeBracket(), this.pos = o, e.appendChild(ud("]", this.sourcepos(o, o))), this.options.referenceDefinition && (this.refLinkCandidateMap[e.id] = {
node: e,
refLabel: l
}), !0
}, e.prototype.addBracket = function(e, t, n) {
null !== this.brackets && (this.brackets.bracketAfter = !0), this.brackets = {
node: e,
startpos: this.sourcepos(t + (n ? 0 : 1)),
previous: this.brackets,
previousDelimiter: this.delimiters,
index: t,
image: n,
active: !0
}
}, e.prototype.removeBracket = function() {
this.brackets && (this.brackets = this.brackets.previous)
}, e.prototype.parseEntity = function(e) {
var t, n = this.pos + 1;
return !!(t = this.match(Pd)) && (e.appendChild(ud(Zc.decodeHTML(t), this.sourcepos(n, this.pos))), !0)
}, e.prototype.parseString = function(e) {
var t, n = this.pos + 1;
if (t = this.match(Kd)) {
if (this.options.smart) {
var r = t.replace(Hd, "…").replace(zd, (function(e) {
var t = 0,
n = 0;
return e.length % 3 == 0 ? n = e.length / 3 : e.length % 2 == 0 ? t = e.length / 2 : e.length % 3 == 2 ? (t = 1, n = (e.length - 2) / 3) : (t = 2, n = (e.length - 4) / 3), zu("—", n) + zu("–", t)
}));
e.appendChild(ud(r, this.sourcepos(n, this.pos)))
} else {
var o = ud(t, this.sourcepos(n, this.pos));
e.appendChild(o)
}
return !0
}
return !1
}, e.prototype.parseNewline = function(e) {
this.pos += 1;
var t = e.lastChild;
if (t && "text" === t.type && " " === t.literal[t.literal.length - 1]) {
var n = " " === t.literal[t.literal.length - 2],
r = t.literal.length;
t.literal = t.literal.replace(Ud, "");
var o = r - t.literal.length;
t.sourcepos[1][1] -= o, e.appendChild(id(n ? "linebreak" : "softbreak", this.sourcepos(this.pos - o, this.pos)))
} else e.appendChild(id("softbreak", this.sourcepos(this.pos, this.pos)));
return this.nextLine(), this.match(Wd), !0
}, e.prototype.parseReference = function(e, t) {
if (!this.options.referenceDefinition) return 0;
this.subject = e.stringContent, this.pos = 0;
var n = null,
r = this.pos,
o = this.parseLinkLabel();
if (0 === o) return 0;
var i = this.subject.substr(0, o);
if (58 !== this.peek()) return this.pos = r, 0;
this.pos++, this.spnl();
var s = this.parseLinkDestination();
if (null === s) return this.pos = r, 0;
var a = this.pos;
this.spnl(), this.pos !== a && (n = this.parseLinkTitle()), null === n && (n = "", this.pos = a);
var l = !0;
if (null === this.match(Jd) && ("" === n ? l = !1 : (n = "", this.pos = a, l = null !== this.match(Jd))), !l) return this.pos = r, 0;
var c = Cd(i);
if ("" === c) return this.pos = r, 0;
var u = this.getReferenceDefSourcepos(e);
e.sourcepos[0][0] = u[1][0] + 1;
var d = id("refDef", u);
return d.title = n, d.dest = s, d.label = c, e.insertBefore(d), t[c] ? this.refDefCandidateMap[d.id] = d : t[c] = $p(d), this.pos - r
}, e.prototype.mergeTextNodes = function(e) {
for (var t, n = []; t = e.next();) {
var r = t.entering,
o = t.node;
if (r && "text" === o.type) n.push(o);
else if (1 === n.length) n = [];
else if (n.length > 1) {
var i = n[0],
s = n[n.length - 1];
i.sourcepos && s.sourcepos && (i.sourcepos[1] = s.sourcepos[1]), i.next = s.next, i.next && (i.next.prev = i);
for (var a = 1; a < n.length; a += 1) i.literal += n[a].literal, n[a].unlink();
n = []
}
}
}, e.prototype.getReferenceDefSourcepos = function(e) {
for (var t = e.stringContent.split(/\n|\r\n/), n = !1, r = 0, o = {
line: 0,
ch: 0
}, i = 0; i < t.length; i += 1) {
var s = t[i];
if ($d.test(s)) break;
if (/\:/.test(s) && 0 === r) {
if (n) break;
var a = s.indexOf(":") === s.length - 1 ? i + 1 : i;
o = {
line: a,
ch: t[a].length
}, n = !0
}
var l = s.match(/'|"/g);
if (l && (r += l.length), 2 === r) {
o = {
line: i,
ch: s.length
};
break
}
}
return [
[e.sourcepos[0][0], e.sourcepos[0][1]],
[e.sourcepos[0][0] + o.line, o.ch]
]
}, e.prototype.parseInline = function(e) {
var t, n = !1,
r = this.peek();
if (-1 === r) return !1;
switch (r) {
case 10:
n = this.parseNewline(e);
break;
case 92:
n = this.parseBackslash(e);
break;
case 96:
n = this.parseBackticks(e);
break;
case 42:
case 95:
case Sd:
case Od:
n = this.handleDelim(r, e);
break;
case Ed:
case Nd:
n = !!(null === (t = this.options) || void 0 === t ? void 0 : t.smart) && this.handleDelim(r, e);
break;
case 91:
n = this.parseOpenBracket(e);
break;
case 33:
n = this.parseBang(e);
break;
case 93:
n = this.parseCloseBracket(e);
break;
case 60:
n = this.parseAutolink(e) || this.parseHtmlTag(e);
break;
case 38:
e.disabledEntityParse || (n = this.parseEntity(e));
break;
default:
n = this.parseString(e)
}
return n || (this.pos += 1, e.appendChild(ud(yd(r), this.sourcepos(this.pos, this.pos + 1)))), !0
}, e.prototype.parse = function(e) {
for (this.subject = e.stringContent.trim(), this.pos = 0, this.delimiters = null, this.brackets = null, this.lineOffsets = e.lineOffsets || [0], this.lineIdx = 0, this.linePosOffset = 0, this.lineStartNum = e.sourcepos[0][0], function(e) {
return "heading" === e.type
}(e) && (this.lineOffsets[0] += e.level + 1); this.parseInline(e););
e.stringContent = null, this.processEmphasis(null), this.mergeTextNodes(e.walker());
var t = this.options,
n = t.extendedAutolinks,
r = t.customParser;
if (n && function(e, t) {
var n;
"boolean" == typeof t && (t = kd);
for (var r = function() {
var e = n.entering,
r = n.node;
if (e && "text" === r.type && "link" !== r.parent.type) {
var o = r.literal,
i = t(o);
if (!i || !i.length) return "continue";
for (var s = 0, a = r.sourcepos[0], l = a[0], c = a[1], u = function(e, t) {
return [
[l, c + e],
[l, c + t]
]
}, d = [], p = 0, h = i; p < h.length; p++) {
var f = h[p],
m = f.range,
g = f.url,
v = f.text;
m[0] > s && d.push(ud(o.substring(s, m[0]), u(s, m[0] - 1)));
var y = id("link", u.apply(void 0, m));
y.appendChild(ud(v, u.apply(void 0, m))), y.destination = g, y.extendedAutolink = !0, d.push(y), s = m[1] + 1
}
s < o.length && d.push(ud(o.substring(s), u(s, o.length - 1)));
for (var b = 0, w = d; b < w.length; b++) {
var k = w[b];
r.insertBefore(k)
}
r.unlink()
}
}; n = e.next();) r()
}(e.walker(), n), r && e.firstChild)
for (var o, i = e.firstChild.walker(); o = i.next();) {
var s = o.node,
a = o.entering;
r[s.type] && r[s.type](s, {
entering: a,
options: this.options
})
}
}, e
}(),
Xd = /^\[([ \txX])\][ \t]+/;
var Qd = /[^ \t\f\v\r\n]/,
Yd = /^(?:`{3,}|~{3,})(?= *$)/;
function ep(e) {
for (var t = e; t;) {
if (t.lastLineBlank) return !0;
var n = t.type;
if (t.lastLineChecked || "list" !== n && "item" !== n) {
t.lastLineChecked = !0;
break
}
t.lastLineChecked = !0, t = t.lastChild
}
return !1
}
function tp(e, t) {
return t < e.length ? e.charCodeAt(t) : -1
}
function np(e) {
return !Qd.test(e)
}
function rp(e) {
return 32 === e || 9 === e
}
var op = /^\$\$$/,
ip = {
continue: function(e, t) {
var n = e.currentLine,
r = n.match(op);
if (r) return e.lastLineLength = r[0].length, e.finalize(t, e.lineNumber), 2;
for (var o = t.offset; o > 0 && rp(tp(n, e.offset));) e.advanceOffset(1, !0), o--;
return 0
},
finalize: function(e, t) {
if (null !== t.stringContent) {
var n = t.stringContent,
r = n.indexOf("\n"),
o = n.slice(0, r),
i = n.slice(r + 1),
s = o.match(/^(\s*)(.*)/);
t.info = Pu(s[2].trim()), t.literal = i, t.stringContent = null
}
},
canContain: function() {
return !1
},
acceptsLines: !0
},
sp = {
continue: function() {
return 1
},
finalize: function() {},
canContain: function() {
return !1
},
acceptsLines: !0
},
ap = {
continue: function() {
return 0
},
finalize: function(e, t) {
for (var n = t.firstChild; n;) {
if (ep(n) && n.next) {
t.listData.tight = !1;
break
}
for (var r = n.firstChild; r;) {
if (ep(r) && (n.next || r.next)) {
t.listData.tight = !1;
break
}
r = r.next
}
n = n.next
}
},
canContain: function(e) {
return "item" === e
},
acceptsLines: !1
},
lp = {
continue: function(e, t) {
if (e.blank) {
if (null === t.firstChild) return 1;
e.advanceNextNonspace()
} else {
if (!(e.indent >= t.listData.markerOffset + t.listData.padding)) return 1;
e.advanceOffset(t.listData.markerOffset + t.listData.padding, !0)
}
return 0
},
finalize: function(e, t) {
if (t.firstChild && "paragraph" === t.firstChild.type) {
var n = t.firstChild,
r = n.stringContent.match(Xd);
if (r) {
var o = r[0].length;
n.stringContent = n.stringContent.substring(o - 1), n.sourcepos[0][1] += o, n.lineOffsets[0] += o, t.listData.task = !0, t.listData.checked = /[xX]/.test(r[1])
}
}
},
canContain: function(e) {
return "item" !== e
},
acceptsLines: !1
},
cp = {
continue: function(e, t) {
var n = e.currentLine,
r = e.indent;
if (t.isFenced) {
var o = r <= 3 && n.charAt(e.nextNonspace) === t.fenceChar && n.slice(e.nextNonspace).match(Yd);
if (o && o[0].length >= t.fenceLength) return e.lastLineLength = e.offset + r + o[0].length, e.finalize(t, e.lineNumber), 2;
for (var i = t.fenceOffset; i > 0 && rp(tp(n, e.offset));) e.advanceOffset(1, !0), i--
} else if (r >= 4) e.advanceOffset(4, !0);
else {
if (!e.blank) return 1;
e.advanceNextNonspace()
}
return 0
},
finalize: function(e, t) {
var n;
if (null !== t.stringContent) {
if (t.isFenced) {
var r = t.stringContent,
o = r.indexOf("\n"),
i = r.slice(0, o),
s = r.slice(o + 1),
a = i.match(/^(\s*)(.*)/);
t.infoPadding = a[1].length, t.info = Pu(a[2].trim()), t.literal = s
} else t.literal = null === (n = t.stringContent) || void 0 === n ? void 0 : n.replace(/(\n *)+$/, "\n");
t.stringContent = null
}
},
canContain: function() {
return !1
},
acceptsLines: !0
},
up = {
continue: function(e) {
return e.blank ? 1 : 0
},
finalize: function(e, t) {
if (null !== t.stringContent) {
for (var n, r = !1; 91 === tp(t.stringContent, 0) && (n = e.inlineParser.parseReference(t, e.refMap));) t.stringContent = t.stringContent.slice(n), r = !0;
r && np(t.stringContent) && t.unlink()
}
},
canContain: function() {
return !1
},
acceptsLines: !0
},
dp = {
document: {
continue: function() {
return 0
},
finalize: function() {},
canContain: function(e) {
return "item" !== e
},
acceptsLines: !1
},
list: ap,
blockQuote: {
continue: function(e) {
var t = e.currentLine;
return e.indented || 62 !== tp(t, e.nextNonspace) ? 1 : (e.advanceNextNonspace(), e.advanceOffset(1, !1), rp(tp(t, e.offset)) && e.advanceOffset(1, !0), 0)
},
finalize: function() {},
canContain: function(e) {
return "item" !== e
},
acceptsLines: !1
},
item: lp,
heading: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function() {
return !1
},
acceptsLines: !1
},
thematicBreak: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function() {
return !1
},
acceptsLines: !1
},
codeBlock: cp,
htmlBlock: {
continue: function(e, t) {
return !e.blank || 6 !== t.htmlBlockType && 7 !== t.htmlBlockType ? 0 : 1
},
finalize: function(e, t) {
var n;
t.literal = (null === (n = t.stringContent) || void 0 === n ? void 0 : n.replace(/(\n *)+$/, "")) || null, t.stringContent = null
},
canContain: function() {
return !1
},
acceptsLines: !0
},
paragraph: up,
table: {
continue: function() {
return 0
},
finalize: function() {},
canContain: function(e) {
return "tableHead" === e || "tableBody" === e
},
acceptsLines: !1
},
tableBody: {
continue: function() {
return 0
},
finalize: function() {},
canContain: function(e) {
return "tableRow" === e
},
acceptsLines: !1
},
tableHead: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function(e) {
return "tableRow" === e || "tableDelimRow" === e
},
acceptsLines: !1
},
tableRow: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function(e) {
return "tableCell" === e
},
acceptsLines: !1
},
tableCell: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function() {
return !1
},
acceptsLines: !1
},
tableDelimRow: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function(e) {
return "tableDelimCell" === e
},
acceptsLines: !1
},
tableDelimCell: {
continue: function() {
return 1
},
finalize: function() {},
canContain: function() {
return !1
},
acceptsLines: !1
},
refDef: sp,
customBlock: ip,
frontMatter: sp
};
function pp(e) {
for (var t = 0, n = 0, r = [], o = 0; o < e.length; o += 1)
if ("|" === e[o] && "\\" !== e[o - 1]) {
var i = e.substring(t, o);
0 === t && qu(i) ? n = o + 1 : r.push(i), t = o + 1
} t < e.length && (qu(i = e.substring(t, e.length)) || r.push(i));
return [n, r]
}
function hp(e, t, n, r) {
for (var o = [], i = 0, s = t; i < s.length; i++) {
var a = s[i],
l = a.match(/^[ \t]+/),
c = l ? l[0].length : 0,
u = void 0,
d = void 0;
if (c === a.length) c = 0, u = 0, d = "";
else {
var p = a.match(/[ \t]+$/);
u = p ? p[0].length : 0, d = a.slice(c, a.length - u)
}
var h = r + c,
f = id(e, [
[n, r],
[n, r + a.length - 1]
]);
f.stringContent = d.replace(/\\\|/g, "|"), f.startIdx = o.length, f.endIdx = o.length, f.lineOffsets = [h - 1], f.paddingLeft = c, f.paddingRight = u, o.push(f), r += a.length + 1
}
return o
}
function fp(e) {
var t = null,
n = e.stringContent,
r = n[0];
return ":" === n[n.length - 1] ? t = ":" === r ? "center" : "right" : ":" === r && (t = "left"), {
align: t
}
}
var mp = /^(\$\$)(\s*[a-zA-Z])+/,
gp = /^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/,
vp = /^`{3,}(?!.*`)|^~{3,}/,
yp = [/./, /^<(?:script|pre|style)(?:\s|>|$)/i, /^<!--/, /^<[?]/, /^<![A-Z]/, /^<!\[CDATA\[/, /^<[/]?(?: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[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i, new RegExp("^(?:" + hd + "|" + fd + ")\\s*$", "i")],
bp = /^(?:=+|-+)[ \t]*$/,
wp = /^#{1,6}(?:[ \t]+|$)/,
kp = /^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/,
xp = /^[*+-]/,
Cp = /^(\d{1,9})([.)])/;
function Tp(e, t) {
return e.options.disallowDeepHeading && ("blockQuote" === t.type || "item" === t.type)
}
var Mp = [function(e) {
return e.indented || 62 !== tp(e.currentLine, e.nextNonspace) ? 0 : (e.advanceNextNonspace(), e.advanceOffset(1, !1), rp(tp(e.currentLine, e.offset)) && e.advanceOffset(1, !0), e.closeUnmatchedBlocks(), e.addChild("blockQuote", e.nextNonspace), 1)
}, function(e, t) {
var n;
if (!e.indented && !Tp(e, t) && (n = e.currentLine.slice(e.nextNonspace).match(wp))) {
e.advanceNextNonspace(), e.advanceOffset(n[0].length, !1), e.closeUnmatchedBlocks();
var r = e.addChild("heading", e.nextNonspace);
return r.level = n[0].trim().length, r.headingType = "atx", r.stringContent = e.currentLine.slice(e.offset).replace(/^[ \t]*#+[ \t]*$/, "").replace(/[ \t]+#+[ \t]*$/, ""), e.advanceOffset(e.currentLine.length - e.offset), 2
}
return 0
}, function(e) {
var t;
if (!e.indented && (t = e.currentLine.slice(e.nextNonspace).match(vp))) {
var n = t[0].length;
e.closeUnmatchedBlocks();
var r = e.addChild("codeBlock", e.nextNonspace);
return r.isFenced = !0, r.fenceLength = n, r.fenceChar = t[0][0], r.fenceOffset = e.indent, e.advanceNextNonspace(), e.advanceOffset(n, !1), 2
}
return 0
}, function(e, t) {
if (!e.indented && 60 === tp(e.currentLine, e.nextNonspace)) {
var n = e.currentLine.slice(e.nextNonspace),
r = e.options.disallowedHtmlBlockTags,
o = void 0;
for (o = 1; o <= 7; o++) {
var i = n.match(yp[o]);
if (i) {
if (7 === o) {
if ("paragraph" === t.type) return 0;
if (r.length > 0)
if (new RegExp("</?(?:" + r.join("|") + ")", "i").test(i[0])) return 0
}
return e.closeUnmatchedBlocks(), e.addChild("htmlBlock", e.offset).htmlBlockType = o, 2
}
}
}
return 0
}, function(e, t) {
var n;
if (null !== t.stringContent && !e.indented && "paragraph" === t.type && !Tp(e, t.parent) && (n = e.currentLine.slice(e.nextNonspace).match(bp))) {
e.closeUnmatchedBlocks();
for (var r = void 0; 91 === tp(t.stringContent, 0) && (r = e.inlineParser.parseReference(t, e.refMap));) t.stringContent = t.stringContent.slice(r);
if (t.stringContent.length > 0) {
var o = id("heading", t.sourcepos);
return o.level = "=" === n[0][0] ? 1 : 2, o.headingType = "setext", o.stringContent = t.stringContent, t.insertAfter(o), t.unlink(), e.tip = o, e.advanceOffset(e.currentLine.length - e.offset, !1), 2
}
return 0
}
return 0
}, function(e) {
return !e.indented && kp.test(e.currentLine.slice(e.nextNonspace)) ? (e.closeUnmatchedBlocks(), e.addChild("thematicBreak", e.nextNonspace), e.advanceOffset(e.currentLine.length - e.offset, !1), 2) : 0
}, function(e, t) {
var n, r, o, i = t;
return e.indented && "list" !== t.type || !(n = function(e, t) {
var n, r, o = e.currentLine.slice(e.nextNonspace),
i = {
type: "bullet",
tight: !0,
bulletChar: "",
start: 0,
delimiter: "",
padding: 0,
markerOffset: e.indent,
task: !1,
checked: !1
};
if (e.indent >= 4) return null;
if (n = o.match(xp)) i.type = "bullet", i.bulletChar = n[0][0];
else {
if (!(n = o.match(Cp)) || "paragraph" === t.type && "1" !== n[1]) return null;
i.type = "ordered", i.start = parseInt(n[1], 10), i.delimiter = n[2]
}
if (-1 !== (r = tp(e.currentLine, e.nextNonspace + n[0].length)) && 9 !== r && 32 !== r) return null;
if ("paragraph" === t.type && !e.currentLine.slice(e.nextNonspace + n[0].length).match(Qd)) return null;
e.advanceNextNonspace(), e.advanceOffset(n[0].length, !0);
var s = e.column,
a = e.offset;
do {
e.advanceOffset(1, !0), r = tp(e.currentLine, e.offset)
} while (e.column - s < 5 && rp(r));
var l = -1 === tp(e.currentLine, e.offset),
c = e.column - s;
return c >= 5 || c < 1 || l ? (i.padding = n[0].length + 1, e.column = s, e.offset = a, rp(tp(e.currentLine, e.offset)) && e.advanceOffset(1, !0)) : i.padding = n[0].length + c, i
}(e, i)) ? 0 : (e.closeUnmatchedBlocks(), "list" === e.tip.type && (r = i.listData, o = n, r.type === o.type && r.delimiter === o.delimiter && r.bulletChar === o.bulletChar) || ((i = e.addChild("list", e.nextNonspace)).listData = n), (i = e.addChild("item", e.nextNonspace)).listData = n, 1)
}, function(e) {
return e.indented && "paragraph" !== e.tip.type && !e.blank ? (e.advanceOffset(4, !0), e.closeUnmatchedBlocks(), e.addChild("codeBlock", e.offset), 2) : 0
}, function(e, t) {
var n = t.stringContent;
if ("paragraph" === t.type && !e.indented && !e.blank) {
var r = n.length - 1,
o = n.lastIndexOf("\n", r - 1) + 1,
i = n.slice(o, r),
s = e.currentLine.slice(e.nextNonspace),
a = pp(i),
l = a[0],
c = a[1],
u = pp(s),
d = u[0],
p = u[1],
h = /^[ \t]*:?-+:?[ \t]*$/;
if (!c.length || !p.length || p.some((function(e) {
return !h.test(e)
})) || 1 === p.length && 0 !== s.indexOf("|")) return 0;
var f = t.lineOffsets,
m = e.lineNumber - 1,
g = xd(f) + 1,
v = id("table", [
[m, g],
[e.lineNumber, e.offset]
]);
if (v.columns = p.map((function() {
return {
align: null
}
})), t.insertAfter(v), 1 === f.length) t.unlink();
else {
t.stringContent = n.slice(0, o);
var y = o - (n.lastIndexOf("\n", o - 2) + 1) - 1;
e.lastLineLength = f[f.length - 2] + y, e.finalize(t, m - 1)
}
e.advanceOffset(e.currentLine.length - e.offset, !1);
var b = id("tableHead", [
[m, g],
[e.lineNumber, e.offset]
]);
v.appendChild(b);
var w = id("tableRow", [
[m, g],
[m, g + i.length - 1]
]),
k = id("tableDelimRow", [
[e.lineNumber, e.nextNonspace + 1],
[e.lineNumber, e.offset]
]);
b.appendChild(w), b.appendChild(k), hp("tableCell", c, m, g + l).forEach((function(e) {
w.appendChild(e)
}));
var x = hp("tableDelimCell", p, e.lineNumber, e.nextNonspace + 1 + d);
return x.forEach((function(e) {
k.appendChild(e)
})), v.columns = x.map(fp), e.tip = v, 2
}
return 0
}, function(e, t) {
if ("table" !== t.type && "tableBody" !== t.type || !e.blank && -1 === e.currentLine.indexOf("|")) return 0;
if (e.advanceOffset(e.currentLine.length - e.offset, !1), e.blank) {
var n = t;
return "tableBody" === t.type && (n = t.parent, e.finalize(t, e.lineNumber - 1)), e.finalize(n, e.lineNumber - 1), 0
}
var r = t;
"table" === t.type && ((r = e.addChild("tableBody", e.nextNonspace)).stringContent = null);
var o = id("tableRow", [
[e.lineNumber, e.nextNonspace + 1],
[e.lineNumber, e.currentLine.length]
]);
r.appendChild(o);
var i = r.parent,
s = pp(e.currentLine.slice(e.nextNonspace)),
a = s[0];
return hp("tableCell", s[1], e.lineNumber, e.nextNonspace + 1 + a).forEach((function(e, t) {
t >= i.columns.length && (e.ignored = !0), o.appendChild(e)
})), 2
}, function(e) {
var t;
if (!e.indented && !gp.test(e.currentLine) && (t = e.currentLine.match(mp))) {
var n = t[1].length;
e.closeUnmatchedBlocks();
var r = e.addChild("customBlock", e.nextNonspace);
return r.syntaxLength = n, r.offset = e.indent, e.advanceNextNonspace(), e.advanceOffset(n, !1), 2
}
return 0
}],
Sp = /^(-{3}|\+{3}|;{3})$/,
Ep = function(e, t) {
var n = e.currentLine,
r = e.lineNumber,
o = e.indented;
return 1 === r && !o && "document" === t.type && Sp.test(n) ? (e.closeUnmatchedBlocks(), e.addChild("frontMatter", e.nextNonspace).stringContent = n, e.advanceNextNonspace(), e.advanceOffset(n.length, !1), 2) : 0
},
Np = {
continue: function(e, t) {
var n = e.currentLine,
r = n.match(Sp);
return "frontMatter" === t.type && r ? (t.stringContent += n, e.lastLineLength = r[0].length, e.finalize(t, e.lineNumber), 2) : 0
},
finalize: function(e, t) {
null !== t.stringContent && (t.literal = t.stringContent, t.stringContent = null)
},
canContain: function() {
return !1
},
acceptsLines: !0
},
Op = [/./, /<\/(?:script|pre|style)>/i, /-->/, /\?>/, />/, /\]\]>/],
Dp = /^[#`~*+_=<>0-9-;$]/,
Ap = /\r\n|\n|\r/;
function Lp() {
return id("document", [
[1, 1],
[0, 0]
])
}
var Ip = {
smart: !1,
tagFilter: !1,
extendedAutolinks: !1,
disallowedHtmlBlockTags: [],
referenceDefinition: !1,
disallowDeepHeading: !1,
customParser: null,
frontMatter: !1
},
Rp = function() {
function e(e) {
this.options = _c(_c({}, Ip), e), this.doc = Lp(), this.tip = this.doc, this.oldtip = this.doc, this.lineNumber = 0, this.offset = 0, this.column = 0, this.nextNonspace = 0, this.nextNonspaceColumn = 0, this.indent = 0, this.currentLine = "", this.indented = !1, this.blank = !1, this.partiallyConsumedTab = !1, this.allClosed = !0, this.lastMatchedContainer = this.doc, this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.lastLineLength = 0, this.lines = [], this.options.frontMatter && (dp.frontMatter = Np, Mp.unshift(Ep)), this.inlineParser = new Zd(this.options)
}
return e.prototype.advanceOffset = function(e, t) {
void 0 === t && (t = !1);
for (var n, r, o, i = this.currentLine; e > 0 && (o = i[this.offset]);) "\t" === o ? (n = 4 - this.column % 4, t ? (this.partiallyConsumedTab = n > e, r = n > e ? e : n, this.column += r, this.offset += this.partiallyConsumedTab ? 0 : 1, e -= r) : (this.partiallyConsumedTab = !1, this.column += n, this.offset += 1, e -= 1)) : (this.partiallyConsumedTab = !1, this.offset += 1, this.column += 1, e -= 1)
}, e.prototype.advanceNextNonspace = function() {
this.offset = this.nextNonspace, this.column = this.nextNonspaceColumn, this.partiallyConsumedTab = !1
}, e.prototype.findNextNonspace = function() {
for (var e, t = this.currentLine, n = this.offset, r = this.column;
"" !== (e = t.charAt(n));)
if (" " === e) n++, r++;
else {
if ("\t" !== e) break;
n++, r += 4 - r % 4
} this.blank = "\n" === e || "\r" === e || "" === e, this.nextNonspace = n, this.nextNonspaceColumn = r, this.indent = this.nextNonspaceColumn - this.column, this.indented = this.indent >= 4
}, e.prototype.addLine = function() {
if (this.partiallyConsumedTab) {
this.offset += 1;
var e = 4 - this.column % 4;
this.tip.stringContent += zu(" ", e)
}
this.tip.lineOffsets ? this.tip.lineOffsets.push(this.offset) : this.tip.lineOffsets = [this.offset], this.tip.stringContent += this.currentLine.slice(this.offset) + "\n"
}, e.prototype.addChild = function(e, t) {
for (; !dp[this.tip.type].canContain(e);) this.finalize(this.tip, this.lineNumber - 1);
var n = t + 1,
r = id(e, [
[this.lineNumber, n],
[0, 0]
]);
return r.stringContent = "", this.tip.appendChild(r), this.tip = r, r
}, e.prototype.closeUnmatchedBlocks = function() {
if (!this.allClosed) {
for (; this.oldtip !== this.lastMatchedContainer;) {
var e = this.oldtip.parent;
this.finalize(this.oldtip, this.lineNumber - 1), this.oldtip = e
}
this.allClosed = !0
}
}, e.prototype.finalize = function(e, t) {
var n = e.parent;
e.open = !1, e.sourcepos[1] = [t, this.lastLineLength], dp[e.type].finalize(this, e), this.tip = n
}, e.prototype.processInlines = function(e) {
var t, n = this.options.customParser,
r = e.walker();
for (this.inlineParser.refMap = this.refMap, this.inlineParser.refLinkCandidateMap = this.refLinkCandidateMap, this.inlineParser.refDefCandidateMap = this.refDefCandidateMap, this.inlineParser.options = this.options; t = r.next();) {
var o = t.node,
i = t.entering,
s = o.type;
n && n[s] && n[s](o, {
entering: i,
options: this.options
}), i || "paragraph" !== s && "heading" !== s && ("tableCell" !== s || o.ignored) || this.inlineParser.parse(o)
}
}, e.prototype.incorporateLine = function(e) {
var t = this.doc;
this.oldtip = this.tip, this.offset = 0, this.column = 0, this.blank = !1, this.partiallyConsumedTab = !1, this.lineNumber += 1, -1 !== e.indexOf("\0") && (e = e.replace(/\0/g, "�")), this.currentLine = e;
for (var n, r = !0;
(n = t.lastChild) && n.open;) {
switch (t = n, this.findNextNonspace(), dp[t.type].continue(this, t)) {
case 0:
break;
case 1:
r = !1;
break;
case 2:
return void(this.lastLineLength = e.length);
default:
throw new Error("continue returned illegal value, must be 0, 1, or 2")
}
if (!r) {
t = t.parent;
break
}
}
this.allClosed = t === this.oldtip, this.lastMatchedContainer = t;
for (var o = "paragraph" !== t.type && dp[t.type].acceptsLines, i = Mp.length; !o;) {
if (this.findNextNonspace(), "table" !== t.type && "tableBody" !== t.type && "paragraph" !== t.type && !this.indented && !Dp.test(e.slice(this.nextNonspace))) {
this.advanceNextNonspace();
break
}
for (var s = 0; s < i;) {
var a = Mp[s](this, t);
if (1 === a) {
t = this.tip;
break
}
if (2 === a) {
t = this.tip, o = !0;
break
}
s++
}
if (s === i) {
this.advanceNextNonspace();
break
}
}
if (this.allClosed || this.blank || "paragraph" !== this.tip.type) {
this.closeUnmatchedBlocks(), this.blank && t.lastChild && (t.lastChild.lastLineBlank = !0);
for (var l = t.type, c = this.blank && !("blockQuote" === l || sd(t) && t.isFenced || "item" === l && !t.firstChild && t.sourcepos[0][0] === this.lineNumber), u = t; u;) u.lastLineBlank = c, u = u.parent;
dp[l].acceptsLines ? (this.addLine(), function(e) {
return "htmlBlock" === e.type
}(t) && t.htmlBlockType >= 1 && t.htmlBlockType <= 5 && Op[t.htmlBlockType].test(this.currentLine.slice(this.offset)) && (this.lastLineLength = e.length, this.finalize(t, this.lineNumber))) : this.offset < e.length && !this.blank && (t = this.addChild("paragraph", this.offset), this.advanceNextNonspace(), this.addLine())
} else this.addLine();
this.lastLineLength = e.length
}, e.prototype.parse = function(e, t) {
this.doc = Lp(), this.tip = this.doc, this.lineNumber = 0, this.lastLineLength = 0, this.offset = 0, this.column = 0, this.lastMatchedContainer = this.doc, this.currentLine = "";
var n = e.split(Ap),
r = n.length;
this.lines = t || n, this.options.referenceDefinition && this.clearRefMaps(), 10 === e.charCodeAt(e.length - 1) && (r -= 1);
for (var o = 0; o < r; o++) this.incorporateLine(n[o]);
for (; this.tip;) this.finalize(this.tip, r);
return this.processInlines(this.doc), this.doc
}, e.prototype.partialParseStart = function(e, t) {
this.doc = Lp(), this.tip = this.doc, this.lineNumber = e - 1, this.lastLineLength = 0, this.offset = 0, this.column = 0, this.lastMatchedContainer = this.doc, this.currentLine = "";
for (var n = t.length, r = 0; r < n; r++) this.incorporateLine(t[r]);
return this.doc
}, e.prototype.partialParseExtends = function(e) {
for (var t = 0; t < e.length; t++) this.incorporateLine(e[t])
}, e.prototype.partialParseFinish = function() {
for (; this.tip;) this.finalize(this.tip, this.lineNumber);
this.processInlines(this.doc)
}, e.prototype.setRefMaps = function(e, t, n) {
this.refMap = e, this.refLinkCandidateMap = t, this.refDefCandidateMap = n
}, e.prototype.clearRefMaps = function() {
[this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap].forEach((function(e) {
var t;
t = e, Object.keys(t).forEach((function(e) {
delete t[e]
}))
}))
}, e
}();
function Pp(e, t) {
return e[0] < t[0] ? 1 : e[0] > t[0] ? -1 : e[1] < t[1] ? 1 : e[1] > t[1] ? -1 : 0
}
function Bp(e, t) {
var n = e[0];
return 1 === Pp(e[1], t) ? 1 : -1 === Pp(n, t) ? -1 : 0
}
function Fp(e, t) {
for (var n = 0, r = t; n < r.length; n++) {
var o = r[n];
e.insertBefore(o)
}
}
function Hp(e, t) {
var n = e[0];
return e[1][0] < t ? 1 : n[0] > t ? -1 : 0
}
function zp(e, t) {
for (var n = e.firstChild; n;) {
var r = Hp(n.sourcepos, t);
if (0 === r) return n;
if (-1 === r) return n.prev || n;
n = n.next
}
return e.lastChild
}
function qp(e) {
return function(e) {
return _u[e]
}(e) || null
}
function Vp(e, t, n) {
if (void 0 === n && (n = null), t)
for (var r = t.walker(); t && t !== n;) {
e(t);
var o = r.next();
if (!o) break;
t = o.node
}
}
var jp = /\r\n|\n|\r/;
function $p(e) {
return {
id: e.id,
title: e.title,
sourcepos: e.sourcepos,
unlinked: !1,
destination: e.dest
}
}
var _p = function() {
function e(e, t) {
this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.referenceDefinition = !!(null == t ? void 0 : t.referenceDefinition), this.parser = new Rp(t), this.parser.setRefMaps(this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap), this.eventHandlerMap = {
change: []
}, e = e || "", this.lineTexts = e.split(jp), this.root = this.parser.parse(e, this.lineTexts)
}
return e.prototype.updateLineTexts = function(e, t, n) {
var r, o = e[0],
i = e[1],
s = t[0],
a = t[1],
l = n.split(jp),
c = l.length,
u = this.lineTexts[o - 1],
d = this.lineTexts[s - 1];
l[0] = u.slice(0, i - 1) + l[0], l[c - 1] = l[c - 1] + d.slice(a - 1);
var p = s - o + 1;
return (r = this.lineTexts).splice.apply(r, Uc([o - 1, p], l)), c - p
}, e.prototype.updateRootNodeState = function() {
if (1 === this.lineTexts.length && "" === this.lineTexts[0]) return this.root.lastLineBlank = !0, void(this.root.sourcepos = [
[1, 1],
[1, 0]
]);
this.root.lastChild && (this.root.lastLineBlank = this.root.lastChild.lastLineBlank);
for (var e = this.lineTexts, t = e.length - 1;
"" === e[t];) t -= 1;
e.length - 2 > t && (t += 1), this.root.sourcepos[1] = [t + 1, e[t].length]
}, e.prototype.replaceRangeNodes = function(e, t, n) {
e ? (Fp(e, n), function(e, t) {
if (e.parent === t.parent && e !== t) {
for (var n = e.next; n && n !== t;) {
for (var r = n.next, o = 0, i = ["parent", "prev", "next"]; o < i.length; o++) {
var s = i[o];
n[s] && (Uu(n[s].id), n[s] = null)
}
n = r
}
e.next = t.next, t.next ? t.next.prev = e : e.parent.lastChild = e
}
}(e, t), [e.id, t.id].forEach((function(e) {
return Uu(e)
})), e.unlink()) : t ? (Fp(t, n), Uu(t.id), t.unlink()) : function(e, t) {
for (var n = t.length - 1; n >= 0; n -= 1) e.prependChild(t[n])
}(this.root, n)
}, e.prototype.getNodeRange = function(e, t) {
var n = zp(this.root, e[0]),
r = zp(this.root, t[0]);
return r && r.next && t[0] + 1 === r.next.sourcepos[0][0] && (r = r.next), [n, r]
}, e.prototype.trigger = function(e, t) {
this.eventHandlerMap[e].forEach((function(e) {
e(t)
}))
}, e.prototype.extendEndLine = function(e) {
for (;
"" === this.lineTexts[e];) e += 1;
return e
}, e.prototype.parseRange = function(e, t, n, r) {
var o;
e && e.prev && (ad(e.prev) && function(e) {
var t = e.match(/^[ \t]+/);
if (t && (t[0].length >= 2 || /\t/.test(t[0]))) return !0;
var n = t ? e.slice(t.length) : e;
return xp.test(n) || Cp.test(n)
}(this.lineTexts[n - 1]) || function(e) {
return "table" === e.type
}(e.prev) && (!np(o = this.lineTexts[n - 1]) && -1 !== o.indexOf("|"))) && (n = (e = e.prev).sourcepos[0][0]);
for (var i = this.lineTexts.slice(n - 1, r), s = this.parser.partialParseStart(n, i), a = t ? t.next : this.root.firstChild, l = s.lastChild, c = l && sd(l) && l.open, u = l && cd(l) && l.open, d = l && ad(l);
(c || u) && a || d && a && ("list" === a.type || a.sourcepos[0][1] >= 2);) {
var p = this.extendEndLine(a.sourcepos[1][0]);
this.parser.partialParseExtends(this.lineTexts.slice(r, p)), e || (e = t), t = a, r = p, a = a.next
}
return this.parser.partialParseFinish(), {
newNodes: function(e) {
for (var t = [], n = e.firstChild; n;) t.push(n), n = n.next;
return t
}(s),
extStartNode: e,
extEndNode: t
}
}, e.prototype.getRemovedNodeRange = function(e, t) {
return !e || e && ld(e) || t && ld(t) ? null : {
id: [e.id, t.id],
line: [e.sourcepos[0][0] - 1, t.sourcepos[1][0] - 1]
}
}, e.prototype.markDeletedRefMap = function(e, t) {
var n = this;
if (!Md(this.refMap)) {
var r = function(e) {
if (ld(e)) {
var t = n.refMap[e.label];
t && e.id === t.id && (t.unlinked = !0)
}
};
e && Vp(r, e.parent, t), t && Vp(r, t)
}
}, e.prototype.replaceWithNewRefDefState = function(e) {
var t = this;
if (!Md(this.refMap)) {
var n = function(e) {
if (ld(e)) {
var n = e.label,
r = t.refMap[n];
r && !r.unlinked || (t.refMap[n] = $p(e))
}
};
e.forEach((function(e) {
Vp(n, e)
}))
}
}, e.prototype.replaceWithRefDefCandidate = function() {
var e = this;
Md(this.refDefCandidateMap) || Td(this.refDefCandidateMap, (function(t, n) {
var r = n.label,
o = n.sourcepos,
i = e.refMap[r];
(!i || i.unlinked || i.sourcepos[0][0] > o[0][0]) && (e.refMap[r] = $p(n))
}))
}, e.prototype.getRangeWithRefDef = function(e, t, n, r, o) {
if (this.referenceDefinition && !Md(this.refMap)) {
var i = zp(this.root, e - 1),
s = zp(this.root, t + 1);
i && ld(i) && i !== n && i !== r && (e = (n = i).sourcepos[0][0]), s && ld(s) && s !== n && s !== r && (r = s, t = this.extendEndLine(r.sourcepos[1][0] + o))
}
return [n, r, e, t]
}, e.prototype.parse = function(e, t, n) {
void 0 === n && (n = 0);
var r = this.getNodeRange(e, t),
o = r[0],
i = r[1],
s = o ? Math.min(o.sourcepos[0][0], e[0]) : e[0],
a = this.extendEndLine((i ? Math.max(i.sourcepos[1][0], t[0]) : t[0]) + n),
l = this.parseRange.apply(this, this.getRangeWithRefDef(s, a, o, i, n)),
c = l.newNodes,
u = l.extStartNode,
d = l.extEndNode,
p = this.getRemovedNodeRange(u, d),
h = d ? d.next : this.root.firstChild;
return this.referenceDefinition ? (this.markDeletedRefMap(u, d), this.replaceRangeNodes(u, d, c), this.replaceWithNewRefDefState(c)) : this.replaceRangeNodes(u, d, c), {
nodes: c,
removedNodeRange: p,
nextNode: h
}
}, e.prototype.parseRefLink = function() {
var e = this,
t = [];
return Md(this.refMap) || Td(this.refMap, (function(n, r) {
r.unlinked && delete e.refMap[n], Td(e.refLinkCandidateMap, (function(r, o) {
var i = o.node;
o.refLabel === n && t.push(e.parse(i.sourcepos[0], i.sourcepos[1]))
}))
})), t
}, e.prototype.removeUnlinkedCandidate = function() {
Md(this.refDefCandidateMap) || [this.refLinkCandidateMap, this.refDefCandidateMap].forEach((function(e) {
Td(e, (function(t) {
(function(e) {
var t = qp(e);
if (!t) return !0;
for (; t && "document" !== t.type;) {
if (!t.parent && !t.prev && !t.next) return !0;
t = t.parent
}
return !1
})(t) && delete e[t]
}))
}))
}, e.prototype.editMarkdown = function(e, t, n) {
var r = this.updateLineTexts(e, t, n),
o = this.parse(e, t, r),
i = function(e) {
for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
var r = _c({}, e);
return t.forEach((function(e) {
delete r[e]
})), r
}(o, "nextNode");
! function(e, t) {
if (e && e.parent && 0 !== t) {
var n, r = e.parent.walker();
for (r.resumeAt(e, !0); n = r.next();) {
var o = n.node;
n.entering && (o.sourcepos[0][0] += t, o.sourcepos[1][0] += t)
}
}
}(o.nextNode, r), this.updateRootNodeState();
var s = [i];
return this.referenceDefinition && (this.removeUnlinkedCandidate(), this.replaceWithRefDefCandidate(), s = s.concat(this.parseRefLink())), this.trigger("change", s), s
}, e.prototype.getLineTexts = function() {
return this.lineTexts
}, e.prototype.getRootNode = function() {
return this.root
}, e.prototype.findNodeAtPosition = function(e) {
var t = function(e, t) {
for (var n = e, r = null; n;) {
var o = Bp(n.sourcepos, t);
if (0 === o) {
if (!n.firstChild) return n;
r = n, n = n.firstChild
} else {
if (-1 === o) return r;
if (!n.next) return r;
n = n.next
}
}
return n
}(this.root, e);
return t && t !== this.root ? t : null
}, e.prototype.findFirstNodeAtLine = function(e) {
return function(e, t) {
for (var n = e.firstChild, r = null; n;) {
var o = Hp(n.sourcepos, t);
if (0 === o) {
if (n.sourcepos[0][0] === t || !n.firstChild) return n;
r = n, n = n.firstChild
} else {
if (-1 === o) break;
r = n, n = n.next
}
}
return r ? function(e) {
for (; e.parent && "document" !== e.parent.type && e.parent.sourcepos[0][0] === e.sourcepos[0][0];) e = e.parent;
return e
}(function(e) {
for (; e.lastChild;) e = e.lastChild;
return e
}(r)) : null
}(this.root, e)
}, e.prototype.on = function(e, t) {
this.eventHandlerMap[e].push(t)
}, e.prototype.off = function(e, t) {
var n = this.eventHandlerMap[e],
r = n.indexOf(t);
n.splice(r, 1)
}, e.prototype.findNodeById = function(e) {
return qp(e)
}, e.prototype.removeAllNode = function() {
_u = {}
}, e
}(),
Up = new RegExp("<(/?(?:" + ["title", "textarea", "style", "xmp", "iframe", "noembed", "noframes", "script", "plaintext"].join("|") + ")[^>]*>)", "ig");
function Wp(e) {
return Up.test(e) ? e.replace(Up, (function(e, t) {
return "&lt;" + t
})) : e
}
var Jp = {
heading: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "h" + e.level,
outerNewLine: !0
}
},
text: function(e) {
return {
type: "text",
content: e.literal
}
},
softbreak: function(e, t) {
return {
type: "html",
content: t.options.softbreak
}
},
linebreak: function() {
return {
type: "html",
content: "<br />\n"
}
},
emph: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "em"
}
},
strong: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "strong"
}
},
paragraph: function(e, t) {
var n, r = t.entering,
o = null === (n = e.parent) || void 0 === n ? void 0 : n.parent;
return o && "list" === o.type && o.listData.tight ? null : {
type: r ? "openTag" : "closeTag",
tagName: "p",
outerNewLine: !0
}
},
thematicBreak: function() {
return {
type: "openTag",
tagName: "hr",
outerNewLine: !0,
selfClose: !0
}
},
blockQuote: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "blockquote",
outerNewLine: !0,
innerNewLine: !0
}
},
list: function(e, t) {
var n = t.entering,
r = e.listData,
o = r.type,
i = r.start,
s = "bullet" === o ? "ul" : "ol",
a = {};
return "ol" === s && null !== i && 1 !== i && (a.start = i.toString()), {
type: n ? "openTag" : "closeTag",
tagName: s,
attributes: a,
outerNewLine: !0
}
},
item: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "li",
outerNewLine: !0
}
},
htmlInline: function(e, t) {
return {
type: "html",
content: t.options.tagFilter ? Wp(e.literal) : e.literal
}
},
htmlBlock: function(e, t) {
var n = t.options,
r = n.tagFilter ? Wp(e.literal) : e.literal;
return n.nodeId ? [{
type: "openTag",
tagName: "div",
outerNewLine: !0
}, {
type: "html",
content: r
}, {
type: "closeTag",
tagName: "div",
outerNewLine: !0
}] : {
type: "html",
content: r,
outerNewLine: !0
}
},
code: function(e) {
return [{
type: "openTag",
tagName: "code"
}, {
type: "text",
content: e.literal
}, {
type: "closeTag",
tagName: "code"
}]
},
codeBlock: function(e) {
var t = e.info,
n = t ? t.split(/\s+/) : [],
r = [];
return n.length > 0 && n[0].length > 0 && r.push("language-" + Hu(n[0])), [{
type: "openTag",
tagName: "pre",
outerNewLine: !0
}, {
type: "openTag",
tagName: "code",
classNames: r
}, {
type: "text",
content: e.literal
}, {
type: "closeTag",
tagName: "code"
}, {
type: "closeTag",
tagName: "pre",
outerNewLine: !0
}]
},
link: function(e, t) {
if (t.entering) {
var n = e,
r = n.title,
o = n.destination;
return {
type: "openTag",
tagName: "a",
attributes: _c({
href: Hu(o)
}, r && {
title: Hu(r)
})
}
}
return {
type: "closeTag",
tagName: "a"
}
},
image: function(e, t) {
var n = t.getChildrenText,
r = t.skipChildren,
o = e,
i = o.title,
s = o.destination;
return r(), {
type: "openTag",
tagName: "img",
selfClose: !0,
attributes: _c({
src: Hu(s),
alt: n(e)
}, i && {
title: Hu(i)
})
}
},
customBlock: function(e, t, n) {
var r = e.info.trim().toLowerCase(),
o = n[r];
if (o) try {
return o(e, t)
} catch (e) {
console.warn("[@toast-ui/editor] - The error occurred when " + r + " block node was parsed in markdown renderer: " + e)
}
return [{
type: "openTag",
tagName: "div",
outerNewLine: !0
}, {
type: "text",
content: e.literal
}, {
type: "closeTag",
tagName: "div",
outerNewLine: !0
}]
},
frontMatter: function(e) {
return [{
type: "openTag",
tagName: "div",
outerNewLine: !0,
attributes: {
style: "white-space: pre; display: none;"
}
}, {
type: "text",
content: e.literal
}, {
type: "closeTag",
tagName: "div",
outerNewLine: !0
}]
},
customInline: function(e, t, n) {
var r = e,
o = r.info,
i = r.firstChild,
s = o.trim().toLowerCase(),
a = n[s],
l = t.entering;
if (a) try {
return a(e, t)
} catch (e) {
console.warn("[@toast-ui/editor] - The error occurred when " + s + " inline node was parsed in markdown renderer: " + e)
}
return l ? [{
type: "openTag",
tagName: "span"
}, {
type: "text",
content: "$$" + o + (i ? " " : "")
}] : [{
type: "text",
content: "$$"
}, {
type: "closeTag",
tagName: "span"
}]
}
},
Gp = {
strike: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "del"
}
},
item: function(e, t) {
var n = t.entering,
r = e.listData,
o = r.checked,
i = r.task;
if (n) {
var s = {
type: "openTag",
tagName: "li",
outerNewLine: !0
};
return i ? [s, {
type: "openTag",
tagName: "input",
selfClose: !0,
attributes: _c(_c({}, o && {
checked: ""
}), {
disabled: "",
type: "checkbox"
})
}, {
type: "text",
content: " "
}] : s
}
return {
type: "closeTag",
tagName: "li",
outerNewLine: !0
}
},
table: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "table",
outerNewLine: !0
}
},
tableHead: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "thead",
outerNewLine: !0
}
},
tableBody: function(e, t) {
return {
type: t.entering ? "openTag" : "closeTag",
tagName: "tbody",
outerNewLine: !0
}
},
tableRow: function(e, t) {
if (t.entering) return {
type: "openTag",
tagName: "tr",
outerNewLine: !0
};
var n = [];
if (e.lastChild)
for (var r = e.parent.parent.columns.length, o = e.lastChild.endIdx + 1; o < r; o += 1) n.push({
type: "openTag",
tagName: "td",
outerNewLine: !0
}, {
type: "closeTag",
tagName: "td",
outerNewLine: !0
});
return n.push({
type: "closeTag",
tagName: "tr",
outerNewLine: !0
}), n
},
tableCell: function(e, t) {
var n = t.entering;
if (e.ignored) return {
type: "text",
content: ""
};
var r = e.parent.parent,
o = "tableHead" === r.type ? "th" : "td",
i = r.parent.columns[e.startIdx],
s = (null == i ? void 0 : i.align) ? {
align: i.align
} : null;
return n ? _c({
type: "openTag",
tagName: o,
outerNewLine: !0
}, s && {
attributes: s
}) : {
type: "closeTag",
tagName: o,
outerNewLine: !0
}
}
},
Kp = {
softbreak: "\n",
gfm: !1,
tagFilter: !1,
nodeId: !1
};
function Zp(e) {
for (var t = [], n = e.walker(), r = null; r = n.next();) {
var o = r.node;
"text" === o.type && t.push(o.literal)
}
return t.join("")
}
var Xp = function() {
function e(e) {
this.buffer = [], this.options = _c(_c({}, Kp), e), this.convertors = this.createConvertors(), delete this.options.convertors
}
return e.prototype.createConvertors = function() {
var e = _c({}, Jp);
if (this.options.gfm && (e = _c(_c({}, e), Gp)), this.options.convertors) {
var t = this.options.convertors,
n = Object.keys(t),
r = _c(_c({}, Jp), Gp);
n.forEach((function(n) {
var o = e[n],
i = t[n],
s = -1 === Object.keys(r).indexOf(n) ? n.toLowerCase() : n;
e[s] = o ? function(e, t, n) {
return t.origin = function() {
return o(e, t, n)
}, i(e, t)
} : i
}))
}
return e
}, e.prototype.getConvertors = function() {
return this.convertors
}, e.prototype.getOptions = function() {
return this.options
}, e.prototype.render = function(e) {
var t = this;
this.buffer = [];
for (var n = e.walker(), r = null, o = function() {
var e = r.node,
o = r.entering,
s = i.convertors[e.type];
if (!s) return "continue";
var a = !1,
l = {
entering: o,
leaf: !ju(e),
options: i.options,
getChildrenText: Zp,
skipChildren: function() {
a = !0
}
},
c = cd(e) || function(e) {
return "customInline" === e.type
}(e) ? s(e, l, i.convertors) : s(e, l);
c && ((Array.isArray(c) ? c : [c]).forEach((function(n, r) {
"openTag" === n.type && t.options.nodeId && 0 === r && (n.attributes || (n.attributes = {}), n.attributes["data-nodeid"] = String(e.id)), t.renderHTMLNode(n)
})), a && (n.resumeAt(e, !1), n.next()))
}, i = this; r = n.next();) o();
return this.addNewLine(), this.buffer.join("")
}, e.prototype.renderHTMLNode = function(e) {
switch (e.type) {
case "openTag":
case "closeTag":
this.renderElementNode(e);
break;
case "text":
this.renderTextNode(e);
break;
case "html":
this.renderRawHtmlNode(e)
}
}, e.prototype.generateOpenTagString = function(e) {
var t = this,
n = e.tagName,
r = e.classNames,
o = e.attributes;
this.buffer.push("<" + n), r && r.length > 0 && this.buffer.push(' class="' + r.join(" ") + '"'), o && Object.keys(o).forEach((function(e) {
var n = o[e];
t.buffer.push(" " + e + '="' + n + '"')
})), e.selfClose && this.buffer.push(" /"), this.buffer.push(">")
}, e.prototype.generateCloseTagString = function(e) {
var t = e.tagName;
this.buffer.push("</" + t + ">")
}, e.prototype.addNewLine = function() {
this.buffer.length && "\n" !== xd(xd(this.buffer)) && this.buffer.push("\n")
}, e.prototype.addOuterNewLine = function(e) {
e.outerNewLine && this.addNewLine()
}, e.prototype.addInnerNewLine = function(e) {
e.innerNewLine && this.addNewLine()
}, e.prototype.renderTextNode = function(e) {
this.buffer.push(Hu(e.content))
}, e.prototype.renderRawHtmlNode = function(e) {
this.addOuterNewLine(e), this.buffer.push(e.content), this.addOuterNewLine(e)
}, e.prototype.renderElementNode = function(e) {
"openTag" === e.type ? (this.addOuterNewLine(e), this.generateOpenTagString(e), e.selfClose ? this.addOuterNewLine(e) : this.addInnerNewLine(e)) : (this.addInnerNewLine(e), this.generateCloseTagString(e), this.addOuterNewLine(e))
}, e
}(),
Qp = n(368),
Yp = n.n(Qp),
eh = ["iframe", "embed"],
th = [];
function nh(e) {
Ue(eh, e) && th.push(e.toLowerCase())
}
function rh(e, t) {
return Yp().sanitize(e, o({
ADD_TAGS: th,
ADD_ATTR: ["rel", "target", "hreflang", "type"],
FORBID_TAGS: ["input", "script", "textarea", "form", "button", "select", "meta", "style", "link", "title", "object", "base"]
}, t))
}
function oh(e, t) {
return e.literal.replace(new RegExp("(<\\s*" + t + "[^>]*>)|(</" + t + "\\s*[>])", "ig"), "").trim()
}
function ih(e) {
var t = (e = e.match(ga)[0]).match(new RegExp(ha, "g"));
return t ? t.reduce((function(e, t) {
var n = t.trim().split("="),
r = n[0],
o = n.slice(1);
return o.length && (e[r] = o.join("=").replace(/'|"/g, "").trim()), e
}), {}) : {}
}
function sh(e) {
return vi()(e.attributes).reduce((function(e, t) {
return e[t.nodeName] = t.nodeValue, e
}), {})
}
function ah(e, t, n, r) {
var o = r.getToDOMNode(t)(e),
i = n(o.outerHTML),
s = document.createElement("div");
return s.innerHTML = i, {
dom: o = s.firstChild,
htmlAttrs: sh(o)
}
}
var lh = {
htmlBlock: function(e, t, n) {
return {
atom: !0,
content: "block+",
group: "block",
attrs: {
htmlAttrs: {
default: {}
},
childrenHTML: {
default: ""
},
htmlBlock: {
default: !0
}
},
parseDOM: [{
tag: e,
getAttrs: function(e) {
return {
htmlAttrs: sh(e),
childrenHTML: e.innerHTML
}
}
}],
toDOM: function(r) {
var o = ah(r, e, t, n),
s = o.dom,
a = o.htmlAttrs;
return a.class = a.class ? a.class + " html-block" : "html-block", i([e, a], vi()(s.childNodes))
}
}
},
htmlInline: function(e, t, n) {
return {
attrs: {
htmlAttrs: {
default: {}
},
htmlInline: {
default: !0
}
},
parseDOM: [{
tag: e,
getAttrs: function(e) {
return {
htmlAttrs: sh(e)
}
}
}],
toDOM: function(r) {
var o = ah(r, e, t, n).htmlAttrs;
return [e, o, 0]
}
}
}
};
var ch = /^\s*<\s*\//,
uh = {
paragraph: function(e, t) {
var n = t.entering,
r = t.origin;
return t.options.nodeId ? {
type: n ? "openTag" : "closeTag",
outerNewLine: !0,
tagName: "p"
} : r()
},
softbreak: function(e) {
return {
type: "html",
content: e.prev && "htmlInline" === e.prev.type && /<br ?\/?>/.test(e.prev.literal) ? "\n" : "<br>\n"
}
},
item: function(e, t) {
if (t.entering) {
var n = {},
r = [];
return e.listData.task && (n["data-task"] = "", r.push("task-list-item"), e.listData.checked && (r.push("checked"), n["data-task-checked"] = "")), {
type: "openTag",
tagName: "li",
classNames: r,
attributes: n,
outerNewLine: !0
}
}
return {
type: "closeTag",
tagName: "li",
outerNewLine: !0
}
},
code: function(e) {
return [{
type: "openTag",
tagName: "code",
attributes: {
"data-backticks": String(e.tickCount)
}
}, {
type: "text",
content: e.literal
}, {
type: "closeTag",
tagName: "code"
}]
},
codeBlock: function(e) {
var t = e,
n = t.fenceLength,
r = t.info,
o = r ? r.split(/\s+/) : [],
i = [],
s = {};
if (n > 3 && (s["data-backticks"] = n), o.length > 0 && o[0].length > 0) {
var a = o[0];
i.push("lang-" + a), s["data-language"] = a
}
return [{
type: "openTag",
tagName: "pre",
classNames: i
}, {
type: "openTag",
tagName: "code",
attributes: s
}, {
type: "text",
content: e.literal
}, {
type: "closeTag",
tagName: "code"
}, {
type: "closeTag",
tagName: "pre"
}]
},
customInline: function(e, t) {
var n = t.origin,
r = t.entering,
o = t.skipChildren,
i = e.info;
return -1 !== i.indexOf("widget") && r ? (o(), [{
type: "openTag",
tagName: "span",
classNames: ["tui-widget"]
}, {
type: "html",
content: Ys(i, oa(e)).outerHTML
}, {
type: "closeTag",
tagName: "span"
}]) : n()
}
};
function dh(e, t) {
var n = o({}, uh);
return e && (n.link = function(t, n) {
var r = n.entering,
i = (0, n.origin)();
return r && (i.attributes = o(o({}, i.attributes), e)), i
}), t && Object.keys(t).forEach((function(e) {
var r = n[e],
i = t[e];
r && Ga()(i) ? n[e] = function(e, t) {
var n = o({}, t);
return n.origin = function() {
return r(e, t)
}, i(e, n)
} : Ue(["htmlBlock", "htmlInline"], e) && !Ga()(i) ? n[e] = function(e, t) {
var n = e.literal.match(ga);
if (n) {
var r = n[0],
s = n[1],
a = n[3],
l = (s || a).toLowerCase(),
c = i[l],
u = oh(e, l);
if (c) {
var d = o({}, e);
return d.attrs = ih(r), d.childrenHTML = u, d.type = l, t.entering = !ch.test(e.literal), c(d, t)
}
}
return t.origin()
} : n[e] = i
})), n
}
var ph = ["list", "item", "blockQuote"],
hh = ["UL", "OL", "BLOCKQUOTE"];
function fh(e, t) {
var n, r = e.child(t);
return !r.childCount || 1 === r.childCount && !(null === (n = r.firstChild.text) || void 0 === n ? void 0 : n.trim())
}
function mh(e, t, n) {
var r = Is(t) - 1,
o = Rs(t) - 1,
i = n[r].getBoundingClientRect(),
s = n[o].offsetTop - n[r].offsetTop + n[o].clientHeight;
return {
height: s <= 0 ? n[r].clientHeight : s + gh(e, n, Math.min(o + 1, e.childCount - 1)),
rect: i
}
}
function gh(e, t, n) {
for (var r = e.childCount - 1, o = 0; n <= r && fh(e, n);) o += t[n].clientHeight, n += 1;
return o
}
function vh(e, t) {
for (var n = 0; e && e !== t && (Ue(hh, e.tagName) || (n += e.offsetTop), e.offsetParent !== t.offsetParent);) e = e.parentElement;
return n
}
function yh(e, t, n) {
return e && t > n + e.offsetTop ? yh(e.nextElementSibling, t, n) || e : null
}
function bh(e, t) {
for (var n = e.querySelector('[data-nodeid="' + t.id + '"]'); !n || Fs(t);) t = t.parent, n = e.querySelector('[data-nodeid="' + t.id + '"]');
return function(e) {
var t = e.mdNode,
n = e.el;
for (;
(Ue(ph, t.type) || "table" === t.type) && t.firstChild;) t = t.firstChild, n = n.firstElementChild;
return {
mdNode: t,
el: n
}
}({
mdNode: t,
el: n
})
}
var wh = {};
function kh(e) {
e && (delete wh[Number(e.getAttribute("data-nodeid"))], vi()(e.children).forEach((function(e) {
kh(e)
})))
}
function xh(e, t, n) {
var r, o = wh[r = n] && wh[r].height,
i = function(e) {
return wh[e] && wh[e].offsetTop
}(n),
s = o || e.clientHeight,
a = i || vh(e, t) || e.offsetTop;
return o || function(e, t) {
wh[e] = wh[e] || {}, wh[e].height = t
}(n, s), i || function(e, t) {
wh[e] = wh[e] || {}, wh[e].offsetTop = t
}(n, a), {
nodeHeight: s,
offsetTop: a
}
}
var Ch = xa("md-preview-highlight");
var Th = function() {
function e(e, t) {
var n = document.createElement("div");
this.el = n, this.eventEmitter = e, this.isViewer = !!t.isViewer, this.el.className = xa("md-preview");
var r = t.linkAttributes,
o = t.customHTMLRenderer,
i = t.sanitizer,
s = t.highlight,
a = void 0 !== s && s;
this.renderer = new Xp({
gfm: !0,
nodeId: !0,
convertors: dh(r, o)
}), this.cursorNodeId = null, this.sanitizer = i, this.initEvent(a), this.initContentSection(), this.isViewer && (this.previewContent.style.overflowWrap = "break-word")
}
return e.prototype.initContentSection = function() {
this.previewContent = Ea('<div class="' + xa("contents") + '"></div>'), this.isViewer || this.el.appendChild(this.previewContent)
}, e.prototype.toggleActive = function(e) {
Sa(this.el, "active", e)
}, e.prototype.initEvent = function(e) {
var t = this;
this.eventEmitter.listen("updatePreview", this.update.bind(this)), this.isViewer || (e && (this.eventEmitter.listen("changeToolbarState", (function(e) {
var n = e.mdNode,
r = e.cursorPos;
t.updateCursorNode(n, r)
})), this.eventEmitter.listen("blur", (function() {
t.removeHighlight()
}))), Vc()(this.el, "scroll", (function(e) {
t.eventEmitter.emit("scroll", "preview", function(e, t) {
for (var n = t, r = null; n;) {
var o = n.firstElementChild;
if (!o) break;
r = n, n = yh(o, e, vh(n, t))
}
var i = n || r;
return i === t ? null : i
}(e.target.scrollTop, t.previewContent))
})), this.eventEmitter.listen("changePreviewTabPreview", (function() {
return t.toggleActive(!0)
})), this.eventEmitter.listen("changePreviewTabWrite", (function() {
return t.toggleActive(!1)
})))
}, e.prototype.removeHighlight = function() {
if (this.cursorNodeId) {
var e = this.getElementByNodeId(this.cursorNodeId);
e && Ce()(e, Ch)
}
}, e.prototype.updateCursorNode = function(e, t) {
e && ("tableRow" === (e = js(e, (function(e) {
return ! function(e) {
switch (e.type) {
case "code":
case "text":
case "emph":
case "strong":
case "strike":
case "link":
case "image":
case "htmlInline":
case "linebreak":
case "softbreak":
case "customInline":
return !0;
default:
return !1
}
}(e)
}))).type ? e = function(e, t) {
for (var n = e.firstChild; n && n.next && !(Ps(n.next) > t + 1);) n = n.next;
return n
}(e, t[1]) : "tableBody" === e.type && (e = null));
var n = e ? e.id : null;
if (this.cursorNodeId !== n) {
var r = this.getElementByNodeId(this.cursorNodeId),
o = this.getElementByNodeId(n);
r && Ce()(r, Ch), o && ke()(o, Ch), this.cursorNodeId = n
}
}, e.prototype.getElementByNodeId = function(e) {
return e ? this.previewContent.querySelector('[data-nodeid="' + e + '"]') : null
}, e.prototype.update = function(e) {
var t = this;
e.forEach((function(e) {
return t.replaceRangeNodes(e)
})), this.eventEmitter.emit("afterPreviewRender", this)
}, e.prototype.replaceRangeNodes = function(e) {
var t = this,
n = e.nodes,
r = e.removedNodeRange,
o = this.previewContent,
i = this.eventEmitter.emitReduce("beforePreviewRender", this.sanitizer(n.map((function(e) {
return t.renderer.render(e)
})).join("")));
if (r) {
var s = r.id,
a = s[0],
l = s[1],
c = this.getElementByNodeId(a),
u = this.getElementByNodeId(l);
if (c) {
c.insertAdjacentHTML("beforebegin", i);
for (var d = c; d && d !== u;) {
var p = d.nextElementSibling;
Ma(d), kh(d), d = p
}(null == d ? void 0 : d.parentNode) && (Ma(d), kh(d))
}
} else o.insertAdjacentHTML("afterbegin", i)
}, e.prototype.getRenderer = function() {
return this.renderer
}, e.prototype.destroy = function() {
zc()(this.el, "scroll"), this.el = null
}, e.prototype.getElement = function() {
return this.el
}, e.prototype.getHTML = function() {
return La(this.previewContent.innerHTML)
}, e.prototype.setHTML = function(e) {
this.previewContent.innerHTML = e
}, e.prototype.setHeight = function(e) {
be()(this.el, {
height: e + "px"
})
}, e.prototype.setMinHeight = function(e) {
be()(this.el, {
minHeight: e + "px"
})
}, e
}(),
Mh = Th;
function Sh(e, t) {
for (var n = e.depth; n;) {
var r = e.node(n);
if (t(r, n)) return {
node: r,
depth: n,
offset: n > 0 ? e.before(n) : 0
};
n -= 1
}
return null
}
function Eh(e) {
return !!Sh(e, (function(e) {
var t = e.type;
return "listItem" === t.name || "bulletList" === t.name || "orderedList" === t.name
}))
}
function Nh(e) {
return !!Sh(e, (function(e) {
var t = e.type;
return "tableHeadCell" === t.name || "tableBodyCell" === t.name
}))
}
function Oh(e) {
return Sh(e, (function(e) {
return "listItem" === e.type.name
}))
}
function Dh(e) {
return {
tag: e,
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html");
return o({}, t && {
rawHTML: t
})
}
}
}
function Ah(e) {
return Object.keys(e).reduce((function(t, n) {
return "rawHTML" !== n && e[n] && (t[n = "className" === n ? "class" : n] = e[n]), t
}), {})
}
function Lh(e) {
return {
tag: e,
getAttrs: function(e) {
return ["rawHTML", "colspan", "rowspan", "extended"].reduce((function(t, n) {
var r = "rawHTML" === n ? "data-raw-html" : n,
o = e.getAttribute(r);
return o && (t[n] = Ue(["rawHTML", "extended"], n) ? o : Number(o)), t
}), {})
}
}
}
function Ih(e) {
var t = e.htmlAttrs,
n = e.classNames;
return o(o({}, t), {
class: n ? n.join(" ") : null
})
}
function Rh(e, t, n, r) {
var o = t.$from,
i = t.$to,
s = t.depth,
a = t,
l = !1;
if (s >= 2 && o.node(s - 1).type.compatibleContent(n) && 0 === t.startIndex && o.index(s - 1)) {
var c = e.doc.resolve(t.start - 2);
a = new I(c, c, s), t.endIndex < t.parent.childCount && (t = new I(o, e.doc.resolve(i.end(s)), s)), l = !0
}
var u = function(e, t, n, r) {
var o = function(e, t) {
var n = e.parent,
r = e.startIndex,
o = e.endIndex,
i = n.contentMatchAt(r).findWrapping(t);
if (i) {
var s = i.length ? i[0] : t;
return n.canReplaceWith(r, o, s) ? i : null
}
return null
}(e, n),
i = function(e, t) {
var n = e.parent,
r = e.startIndex,
o = e.endIndex,
i = n.child(r),
s = t.contentMatch.findWrapping(i.type);
if (s) {
for (var a = (s.length ? s[s.length - 1] : t).contentMatch, l = r; a && l < o; l += 1) a = a.matchType(n.child(l).type);
if (a && a.validEnd) return s
}
return null
}(t, n);
if (o && i) {
var s = o.map((function(e) {
return {
type: e
}
})),
a = i.map((function(e) {
return {
type: e,
attrs: r
}
}));
return s.concat({
type: n
}).concat(a)
}
return null
}(a, t, n, r);
return u ? function(e, t, n, r, o) {
for (var i = t.start, s = t.end, a = t.startIndex, l = t.endIndex, c = t.parent, u = d.empty, p = n.length - 1; p >= 0; p -= 1) u = d.from(n[p].type.create(n[p].attrs, u));
e.step(new wt(i - (r ? 2 : 0), s, i, s, new v(u, 0, 0), n.length, !0));
var h = 0;
for (p = 0; p < n.length; p += 1)
if (n[p].type === o) {
h = p + 1;
break
} for (var f = n.length - h, m = i + n.length - (r ? 2 : 0), g = (p = a, l); p < g; p += 1) !(p === a) && Mt(e.doc, m, f) && (e.split(m, f), m += 2 * f), m += c.child(p).nodeSize;
return e
}(e, t, u, l, n) : e
}
function Ph(e, t) {
for (var n = e.resolve(t);
"paragraph" !== n.node().type.name;) t -= 2, n = e.resolve(t);
return Oh(n)
}
function Bh(e) {
return function(t, n) {
var r = t.selection,
o = t.tr,
i = r.$from,
s = r.$to,
a = i.blockRange(s);
if (a) {
var l = Eh(i) ? function(e, t, n) {
var r = t.$from,
o = t.$to,
i = Oh(r),
s = Oh(o);
if (i && s)
for (; s;) {
var a = s.offset,
l = s.node,
c = s.depth;
l.attrs.task && e.setNodeMarkup(a, null, {
task: !1,
checked: !1
});
var u = e.doc.resolve(a);
if (u.parent.type !== n) {
var d = u.before(c - 1);
e.setNodeMarkup(d, n)
}
if (a === i.offset) break;
s = Ph(e.doc, a)
}
return e
}(o, a, e) : Rh(o, a, e);
return n(l), !0
}
return !1
}
}
function Fh() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = e.schema,
i = n.$from,
s = n.$to,
a = i.blockRange(s);
if (a) {
var l = Eh(i) ? function(e, t) {
var n = t.$from,
r = t.$to,
o = Oh(n),
i = Oh(r);
if (o && i)
for (; i;) {
var s = i.offset,
a = {
task: !i.node.attrs.task,
checked: !1
};
if (e.setNodeMarkup(s, null, a), s === o.offset) break;
i = Ph(e.doc, s)
}
return e
}(r, a) : Rh(r, a, o.nodes.bulletList, {
task: !0
});
return t(l), !0
}
return !1
}
}
function Hh(e) {
return function(t, n) {
var r = t.tr,
o = t.selection,
i = o.$from,
s = o.$to,
a = i.blockRange(s, (function(t) {
var n = t.childCount,
r = t.firstChild;
return !!n && r.type === e
}));
if (a) {
var l = i.node(a.depth - 1).type === e ? function(e, t, n) {
var r = t.$from,
o = t.$to,
i = t.end,
s = t.depth,
a = t.parent,
l = o.end(s);
return i < l && (e.step(new wt(i - 1, l, i, l, new v(d.from(n.create(null, a.copy())), 1, 0), 1, !0)), t = new I(e.doc.resolve(r.pos), e.doc.resolve(l), s)), e.lift(t, Ct(t)), e
}(r, a, e) : function(e, t) {
for (var n = t.parent, r = t.end, o = t.endIndex - 1, i = t.startIndex; o > i; o -= 1) r -= n.child(o).nodeSize, e.delete(r - 1, r + 1);
var s = e.doc.resolve(t.start),
a = s.nodeAfter,
l = 0 === t.startIndex,
c = t.endIndex === n.childCount,
u = s.node(-1),
p = s.index(-1),
h = u.canReplace(p + (l ? 0 : 1), p + 1, null == a ? void 0 : a.content.append(c ? d.empty : d.from(n)));
if (a && h) {
var f = s.pos,
m = f + a.nodeSize;
e.step(new wt(f - (l ? 1 : 0), m + (c ? 1 : 0), f + 1, m - 1, new v((l ? d.empty : d.from(n.copy(d.empty))).append(c ? d.empty : d.from(n.copy(d.empty))), l ? 0 : 1, c ? 0 : 1), l ? 0 : 1))
}
return e
}(r, a);
return n(l), !0
}
return !1
}
}
function zh() {
return function() {
return function(e, t) {
var n = e.selection,
r = e.schema,
o = n.$from,
i = n.$to;
return !(!o.blockRange(i) || !Eh(o)) && function(e) {
return function(t, n) {
var r = t.tr,
o = t.selection,
i = o.$from,
s = o.$to,
a = i.blockRange(s, (function(t) {
var n = t.childCount,
r = t.firstChild;
return !!n && r.type === e
}));
if (a && a.startIndex > 0) {
var l = a.parent,
c = l.child(a.startIndex - 1);
if (c.type !== e) return !1;
var u = c.lastChild && c.lastChild.type === l.type,
p = u ? d.from(e.create()) : null,
h = new v(d.from(e.create(null, d.from(l.type.create(null, p)))), u ? 3 : 1, 0),
f = a.start,
m = a.end;
return r.step(new wt(f - (u ? 3 : 1), m, f, m, h, 1, !0)), n(r), !0
}
return !1
}
}(r.nodes.listItem)(e, t)
}
}
}
function qh() {
return {
indent: zh(),
outdent: function() {
return function(e, t) {
var n = e.selection,
r = e.schema,
o = n.$from,
i = n.$to;
return !(!o.blockRange(i) || !Eh(o)) && Hh(r.nodes.listItem)(e, t)
}
}
}
}
var Vh = new Map,
jh = function() {
function e(e, t, n, r) {
this.table = e, this.tableRows = t, this.tableStartPos = n, this.rowInfo = r
}
return e.create = function(t) {
var n = Sh(t, (function(e) {
return "table" === e.type.name
}));
if (n) {
var r = n.node,
o = n.depth,
i = n.offset,
s = Vh.get(r);
if ((null == s ? void 0 : s.tableStartPos) === i + 1) return s;
var a = [],
l = t.start(o),
c = r.child(0),
u = r.child(1),
d = $h(c, l),
p = $h(u, l + c.nodeSize);
c.forEach((function(e) {
return a.push(e)
})), u.forEach((function(e) {
return a.push(e)
}));
var h = new e(r, a, l, d.concat(p));
return Vh.set(r, h), h
}
return null
}, Object.defineProperty(e.prototype, "totalRowCount", {
get: function() {
return this.rowInfo.length
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(e.prototype, "totalColumnCount", {
get: function() {
return this.rowInfo[0].length
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(e.prototype, "tableStartOffset", {
get: function() {
return this.tableStartPos
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(e.prototype, "tableEndOffset", {
get: function() {
return this.tableStartPos + this.table.nodeSize - 1
},
enumerable: !1,
configurable: !0
}), e.prototype.getCellInfo = function(e, t) {
return this.rowInfo[e][t]
}, e.prototype.posAt = function(e, t) {
for (var n = 0, r = this.tableStartPos;; n += 1) {
var o = r + this.tableRows[n].nodeSize;
if (n === e) {
for (var i = t; i < this.totalColumnCount && this.rowInfo[n][i].offset < r;) i += 1;
return i === this.totalColumnCount ? o : this.rowInfo[n][i].offset
}
r = o
}
}, e.prototype.getNodeAndPos = function(e, t) {
var n = this.rowInfo[e][t];
return {
node: this.table.nodeAt(n.offset - this.tableStartOffset),
pos: n.offset
}
}, e.prototype.extendedRowspan = function(e, t) {
return !1
}, e.prototype.extendedColspan = function(e, t) {
return !1
}, e.prototype.getRowspanCount = function(e, t) {
return 0
}, e.prototype.getColspanCount = function(e, t) {
return 0
}, e.prototype.decreaseColspanCount = function(e, t) {
return 0
}, e.prototype.decreaseRowspanCount = function(e, t) {
return 0
}, e.prototype.getColspanStartInfo = function(e, t) {
return null
}, e.prototype.getRowspanStartInfo = function(e, t) {
return null
}, e.prototype.getCellStartOffset = function(e, t) {
var n = this.rowInfo[e][t].offset;
return this.extendedRowspan(e, t) ? this.posAt(e, t) : n
}, e.prototype.getCellEndOffset = function(e, t) {
var n = this.rowInfo[e][t],
r = n.offset,
o = n.nodeSize;
return this.extendedRowspan(e, t) ? this.posAt(e, t) : r + o
}, e.prototype.getCellIndex = function(e) {
for (var t = 0; t < this.totalRowCount; t += 1)
for (var n = this.rowInfo[t], r = 0; r < this.totalColumnCount; r += 1)
if (n[r].offset + 1 > e.pos) return [t, r];
return [0, 0]
}, e.prototype.getRectOffsets = function(e, t) {
var n, r, o;
void 0 === t && (t = e), e.pos > t.pos && (e = (n = [t, e])[0], t = n[1]);
var i = this.getCellIndex(e),
s = i[0],
a = i[1],
l = this.getCellIndex(t),
c = l[0],
u = l[1];
return s = (r = st(s, c))[0], c = r[1], a = (o = st(a, u))[0], u = o[1], this.getSpannedOffsets({
startRowIdx: s,
startColIdx: a,
endRowIdx: c,
endColIdx: u
})
}, e.prototype.getSpannedOffsets = function(e) {
return e
}, e
}(),
$h = function(e, t) {
var n = [];
return e.forEach((function(e, r) {
var o = {
rowspanMap: {},
colspanMap: {},
length: 0
};
e.forEach((function(e, n) {
for (var i = e.nodeSize, s = 0; o[s];) s += 1;
o[s] = {
offset: t + r + n + 2,
nodeSize: i
}, o.length += 1
})), n.push(o)
})), n
};
function _h(e, t) {
return it(jh.prototype, e), $h = t, jh
}
var Uh = function(e) {
function n(t, n) {
void 0 === n && (n = t);
var r = this,
o = t.node(0),
i = jh.create(t),
s = i.getRectOffsets(t, n),
a = function(e, t, n) {
for (var r = n.startRowIdx, o = n.startColIdx, i = n.endRowIdx, s = n.endColIdx, a = [], l = r; l <= i; l += 1)
for (var c = o; c <= s; c += 1) {
var u = t.getCellInfo(l, c),
d = u.offset,
p = u.nodeSize;
a.push(new jt(e.resolve(d + 1), e.resolve(d + p - 1)))
}
return a
}(o, i, s);
return (r = e.call(this, a[0].$from, a[0].$to, a) || this).startCell = t, r.endCell = n, r.offsetMap = i, r.isCellSelection = !0, r.visible = !1, r
}
return t(n, e), n.prototype.map = function(e, t) {
var r = this.startCell.pos,
o = this.endCell.pos,
i = e.resolve(t.map(r)),
s = e.resolve(t.map(o)),
a = jh.create(i);
if (this.offsetMap.totalColumnCount > a.totalColumnCount || this.offsetMap.totalRowCount > a.totalRowCount) {
var l = {
tableBody: 1,
tableRow: 2,
tableCell: 3,
paragraph: 4
} [s.parent.type.name],
c = s.end(s.depth - l),
u = Math.min(c - 4, s.pos);
return Ut.create(e, u)
}
return new n(i, s)
}, n.prototype.eq = function(e) {
return e instanceof n && e.startCell.pos === this.startCell.pos && e.endCell.pos === this.endCell.pos
}, n.prototype.content = function() {
for (var e = this.startCell.node(-2), t = this.startCell.start(-2), n = e.child(1).firstChild, r = e.child(0).type.create(), o = e.child(1).type.create(), i = jh.create(this.startCell), s = i.getRectOffsets(this.startCell, this.endCell), a = s.startRowIdx, l = s.startColIdx, c = s.endRowIdx, u = s.endColIdx, p = !1, h = a; h <= c; h += 1) {
for (var f = [], m = l; m <= u; m += 1) {
var g = i.getCellInfo(h, m).offset,
y = e.nodeAt(g - t);
y && (p = "tableHeadCell" === y.type.name, i.extendedRowspan(h, m) || i.extendedColspan(h, m) ? f.push(y.type.create({
extended: !0
})) : f.push(y.copy(y.content)))
}
var b = n.copy(d.from(f)),
w = p ? r : o;
w.content = w.content.append(d.from(b))
}
return new v(function(e, t) {
var n = [];
return e.childCount && n.push(e), t.childCount && n.push(t), d.from(n)
}(r, o), 1, 1)
}, n.prototype.toJSON = function() {
return JSON.stringify(this)
}, n
}(Vt),
Wh = Uh;
function Jh(e, t, n, r) {
for (var o = n.nodes, i = o.tableRow, s = o.tableBodyCell, a = o.paragraph, l = [], c = 0; c < e; c += 1) {
for (var u = [], d = 0; d < t; d += 1) {
var p = r && r[c * t + d],
h = a.create(null, p ? n.text(p) : []);
u.push(s.create(null, h))
}
l.push(i.create(null, u))
}
return l
}
function Gh(e, t, n, r) {
void 0 === r && (r = null);
for (var o = n.nodes, i = o.tableHeadCell, s = o.tableBodyCell, a = o.paragraph, l = 0 === t ? i : s, c = [], u = 0; u < e; u += 1) c.push(l.create(r, a.create()));
return c
}
function Kh(e, t) {
for (; e && e !== t;) {
if ("TD" === e.nodeName || "TH" === e.nodeName) return e;
e = e.parentNode
}
return null
}
function Zh(e) {
return Sh(e, (function(e) {
var t = e.type;
return "tableHeadCell" === t.name || "tableBodyCell" === t.name
}))
}
function Xh(e) {
if (e instanceof Ut) {
var t = e.$anchor,
n = Zh(t);
if (n) {
var r = t.node(0).resolve(t.before(n.depth));
return {
anchor: r,
head: r
}
}
}
var o = e;
return {
anchor: o.startCell,
head: o.endCell
}
}
function Qh(e) {
var t;
if (e.size) {
var n = e.content,
r = e.openStart,
o = e.openEnd;
if (1 !== n.childCount) return null;
for (; 1 === n.childCount && (r > 0 && o > 0 || "table" === (null === (t = n.firstChild) || void 0 === t ? void 0 : t.type.name));) r -= 1, o -= 1, n = n.firstChild.content;
if ("tableHead" === n.firstChild.type.name || "tableBody" === n.firstChild.type.name) return n
}
return null
}
function Yh(e) {
var t = e.startRowIdx,
n = e.startColIdx;
return {
rowCount: e.endRowIdx - t + 1,
columnCount: e.endColIdx - n + 1
}
}
function ef(e, t) {
return o(o({}, e.attrs), t)
}
var tf = new un("cellSelection"),
nf = function() {
function e(e) {
this.view = e, this.handlers = {
mousedown: this.handleMousedown.bind(this),
mousemove: this.handleMousemove.bind(this),
mouseup: this.handleMouseup.bind(this)
}, this.startCellPos = null, this.init()
}
return e.prototype.init = function() {
this.view.dom.addEventListener("mousedown", this.handlers.mousedown)
}, e.prototype.handleMousedown = function(e) {
var t = Kh(e.target, this.view.dom);
if (2 !== e.button) {
if (t) {
var n = this.getCellPos(e);
n && (this.startCellPos = n), this.bindEvent()
}
} else e.preventDefault()
}, e.prototype.handleMousemove = function(e) {
var t, n = tf.getState(this.view.state),
r = this.getCellPos(e),
o = this.startCellPos;
n ? t = this.view.state.doc.resolve(n) : o !== r && (t = o), t && o && r && this.setCellSelection(o, r)
}, e.prototype.handleMouseup = function() {
this.startCellPos = null, this.unbindEvent(), null !== tf.getState(this.view.state) && this.view.dispatch(this.view.state.tr.setMeta(tf, -1))
}, e.prototype.bindEvent = function() {
var e = this.view.dom;
e.addEventListener("mousemove", this.handlers.mousemove), e.addEventListener("mouseup", this.handlers.mouseup)
}, e.prototype.unbindEvent = function() {
var e = this.view.dom;
e.removeEventListener("mousemove", this.handlers.mousemove), e.removeEventListener("mouseup", this.handlers.mouseup)
}, e.prototype.getCellPos = function(e) {
var t = e.clientX,
n = e.clientY,
r = this.view.posAtCoords({
left: t,
top: n
});
if (r) {
var o = this.view.state.doc,
i = o.resolve(r.pos),
s = Zh(i);
if (s) {
var a = i.before(s.depth);
return o.resolve(a)
}
}
return null
}, e.prototype.setCellSelection = function(e, t) {
var n = this.view.state,
r = n.selection,
o = n.tr,
i = null === tf.getState(this.view.state),
s = new Wh(e, t);
if (i || !r.eq(s)) {
var a = o.setSelection(s);
i && a.setMeta(tf, t.pos), this.view.dispatch(a)
}
}, e.prototype.destroy = function() {
this.view.dom.removeEventListener("mousedown", this.handlers.mousedown)
}, e
}(),
rf = nf,
of = xa("cell-selected");
function sf(e) {
var t = e.selection,
n = e.doc;
if (t instanceof Wh) {
var r = [];
return t.ranges.forEach((function(e) {
var t = e.$from,
n = e.$to;
r.push(Vo.node(t.pos - 1, n.pos + 1, {
class: of
}))
})), _o.create(n, r)
}
return null
}
var af = n(928),
lf = n.n(af),
cf = function() {
function e() {
this.keys = [], this.values = []
}
return e.prototype.getKeyIndex = function(e) {
return lf()(e, this.keys)
}, e.prototype.get = function(e) {
return this.values[this.getKeyIndex(e)]
}, e.prototype.set = function(e, t) {
var n = this.getKeyIndex(e);
return n > -1 ? this.values[n] = t : (this.keys.push(e), this.values.push(t)), this
}, e.prototype.has = function(e) {
return this.getKeyIndex(e) > -1
}, e.prototype.delete = function(e) {
var t = this.getKeyIndex(e);
return t > -1 && (this.keys.splice(t, 1), this.values.splice(t, 1), !0)
}, e.prototype.forEach = function(e, t) {
var n = this;
void 0 === t && (t = this), this.values.forEach((function(r, o) {
r && n.keys[o] && e.call(t, r, n.keys[o], n)
}))
}, e.prototype.clear = function() {
this.keys = [], this.values = []
}, e
}(),
uf = cf,
df = "en-US",
pf = function() {
function e() {
this.code = df, this.langs = new uf
}
return e.prototype.setCode = function(e) {
this.code = e || df
}, e.prototype.setLanguage = function(e, t) {
var n = this;
(e = [].concat(e)).forEach((function(e) {
if (n.langs.has(e)) {
var r = n.langs.get(e);
n.langs.set(e, ve()(r, t))
} else n.langs.set(e, t)
}))
}, e.prototype.get = function(e, t) {
t || (t = this.code);
var n = this.langs.get(t);
n || (n = this.langs.get(df));
var r = n[e];
if (!r) throw new Error('There is no text key "' + e + '" in ' + t);
return r
}, e
}(),
hf = new pf,
ff = [
[{
action: "Add row to up",
command: "addRowToUp",
disableInThead: !0,
className: "add-row-up"
}, {
action: "Add row to down",
command: "addRowToDown",
disableInThead: !0,
className: "add-row-down"
}, {
action: "Remove row",
command: "removeRow",
disableInThead: !0,
className: "remove-row"
}],
[{
action: "Add column to left",
command: "addColumnToLeft",
className: "add-column-left"
}, {
action: "Add column to right",
command: "addColumnToRight",
className: "add-column-right"
}, {
action: "Remove column",
command: "removeColumn",
className: "remove-column"
}],
[{
action: "Align column to left",
command: "alignColumn",
payload: {
align: "left"
},
className: "align-column-left"
}, {
action: "Align column to center",
command: "alignColumn",
payload: {
align: "center"
},
className: "align-column-center"
}, {
action: "Align column to right",
command: "alignColumn",
payload: {
align: "right"
},
className: "align-column-right"
}],
[{
action: "Remove table",
command: "removeTable",
className: "remove-table"
}]
];
function mf(e, t) {
return ff.map((function(n) {
return n.map((function(n) {
var r = n.action,
o = n.command,
i = n.payload,
s = n.disableInThead,
a = n.className;
return {
label: hf.get(r),
onClick: function() {
e.emit("command", o, i)
},
disabled: t && !!s,
className: a
}
}))
})).concat()
}
function gf(e) {
return new an({
props: {
handleDOMEvents: {
contextmenu: function(t, n) {
var r = Kh(n.target, t.dom);
if (r) {
n.preventDefault();
var o = n,
i = o.clientX,
s = o.clientY,
a = t.dom.parentNode.getBoundingClientRect(),
l = a.left,
c = a.top,
u = "TH" === r.nodeName;
return e.emit("contextmenu", {
pos: {
left: i - l + 10 + "px",
top: s - c + 30 + "px"
},
menuGroups: mf(e, u),
tableCell: r
}), !0
}
return !1
}
}
}
})
}
var vf = ["image", "link", "customBlock", "frontMatter"],
yf = ["strong", "strike", "emph", "code"],
bf = ["bulletList", "orderedList", "taskList"];
function wf(e, t, n) {
var r = e.$from,
o = e.$to,
i = e.from,
s = e.to,
a = {
indent: {
active: !1,
disabled: !0
},
outdent: {
active: !1,
disabled: !0
}
};
return t.nodesBetween(i, s, (function(e, t, i) {
var s = function(e, t) {
var n = e.type.name;
return "listItem" === n ? e.attrs.task ? "taskList" : t.type.name : -1 !== n.indexOf("table") ? "table" : n
}(e, i);
Ue(vf, s) || (Ue(bf, s) ? (! function(e, t) {
t[e] = {
active: !0
}, bf.filter((function(t) {
return t !== e
})).forEach((function(e) {
t[e] && delete t[e]
}))
}(s, a), a.indent.disabled = !1, a.outdent.disabled = !1) : "paragraph" === s || "text" === s ? function(e, t, n, r) {
yf.forEach((function(o) {
var i = n.marks[o],
s = e.marksAcross(t) || [];
i.isInSet(s) && (r[o] = {
active: !0
})
}))
}(r, o, n, a) : a[s] = {
active: !0
})
})), a
}
function kf(e) {
return new an({
view: function() {
return {
update: function(t) {
var n = t.state,
r = n.selection,
o = n.doc,
i = n.schema;
e.emit("changeToolbarState", {
toolbarState: wf(r, o, i)
})
}
}
}
})
}
var xf = function() {
function e(e, t, n, r) {
var o = this;
this.openEditor = function() {
if (o.innerEditorView) throw new Error("The editor is already opened.");
o.dom.draggable = !1, o.wrapper.style.display = "none", o.innerViewContainer.style.display = "block", o.innerEditorView = new ui(o.innerViewContainer, {
state: on.create({
doc: o.node,
plugins: [Ai({
"Mod-z": function() {
return Ms(o.innerEditorView.state, o.innerEditorView.dispatch)
},
"Shift-Mod-z": function() {
return Ss(o.innerEditorView.state, o.innerEditorView.dispatch)
},
Tab: function(e, t) {
return t(e.tr.insertText("\t")), !0
},
Enter: Hi,
Escape: function() {
return o.cancelEditing(), !0
},
"Ctrl-Enter": function() {
return o.saveAndFinishEditing(), !0
}
}), Ts()]
}),
dispatchTransaction: function(e) {
return o.dispatchInner(e)
},
handleDOMEvents: {
mousedown: function() {
return o.editorView.hasFocus() && o.innerEditorView.focus(), !0
},
blur: function() {
return o.saveAndFinishEditing(), !0
}
}
}), o.innerEditorView.focus()
}, this.node = e, this.editorView = t, this.getPos = n, this.toDOMAdaptor = r, this.innerEditorView = null, this.canceled = !1, this.dom = document.createElement("div"), this.dom.className = xa("custom-block"), this.wrapper = document.createElement("div"), this.wrapper.className = xa("custom-block-view"), this.createInnerViewContainer(), this.renderCustomBlock(), this.dom.appendChild(this.innerViewContainer), this.dom.appendChild(this.wrapper)
}
return e.prototype.renderToolArea = function() {
var e = this,
t = document.createElement("div"),
n = document.createElement("span"),
r = document.createElement("button");
t.className = "tool", n.textContent = this.node.attrs.info, n.className = "info", r.type = "button", r.addEventListener("click", (function() {
return e.openEditor()
})), t.appendChild(n), t.appendChild(r), this.wrapper.appendChild(t)
}, e.prototype.renderCustomBlock = function() {
var e = this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);
if (e) {
for (var t = e(this.node); this.wrapper.hasChildNodes();) this.wrapper.removeChild(this.wrapper.lastChild);
t && this.wrapper.appendChild(t), this.renderToolArea()
}
}, e.prototype.createInnerViewContainer = function() {
this.innerViewContainer = document.createElement("div"), this.innerViewContainer.className = xa("custom-block-editor"), this.innerViewContainer.style.display = "none"
}, e.prototype.closeEditor = function() {
this.innerEditorView && (this.innerEditorView.destroy(), this.innerEditorView = null, this.innerViewContainer.style.display = "none"), this.wrapper.style.display = "block"
}, e.prototype.saveAndFinishEditing = function() {
var e = this.editorView.state.selection.to,
t = this.editorView.state;
this.editorView.dispatch(t.tr.setSelection(Os(t.tr, e))), this.editorView.focus(), this.renderCustomBlock(), this.closeEditor()
}, e.prototype.cancelEditing = function() {
var e = function(e) {
let t = xs.getState(e);
return t ? t.done.eventCount : 0
}(this.innerEditorView.state);
for (this.canceled = !0; e--;) Ms(this.innerEditorView.state, this.innerEditorView.dispatch), Ms(this.editorView.state, this.editorView.dispatch);
this.canceled = !1;
var t = this.editorView.state.selection.to,
n = this.editorView.state;
this.editorView.dispatch(n.tr.setSelection(Ut.create(n.doc, t))), this.editorView.focus(), this.closeEditor()
}, e.prototype.dispatchInner = function(e) {
var t = this.innerEditorView.state.applyTransaction(e),
n = t.state,
r = t.transactions;
if (this.innerEditorView.updateState(n), !this.canceled && Ga()(this.getPos)) {
for (var o = this.editorView.state.tr, i = dt.offset(this.getPos() + 1), s = 0; s < r.length; s += 1)
for (var a = r[s].steps, l = 0; l < a.length; l += 1) o.step(a[l].map(i));
o.docChanged && this.editorView.dispatch(o)
}
}, e.prototype.update = function(e) {
return !!e.sameMarkup(this.node) && (this.node = e, this.innerEditorView || this.renderCustomBlock(), !0)
}, e.prototype.stopEvent = function(e) {
return !!this.innerEditorView && !!e.target && this.innerEditorView.dom.contains(e.target)
}, e.prototype.ignoreMutation = function() {
return !0
}, e.prototype.destroy = function() {
this.dom.removeEventListener("dblclick", this.openEditor), this.closeEditor()
}, e
}(),
Cf = "image-link",
Tf = function() {
function e(e, t, n, r) {
var o, i = this;
this.handleMousedown = function(e) {
e.preventDefault();
var t = e.target,
n = e.offsetX,
r = e.offsetY;
if (i.imageLink && Ga()(i.getPos) && ca()(t, Cf)) {
var o = getComputedStyle(t, ":before");
if (e.stopPropagation(), wa(o, n, r)) {
var s = i.view.state.tr,
a = i.getPos();
s.setSelection(Os(s, a, a + 1)), i.view.dispatch(s), i.eventEmitter.emit("openPopup", "link", i.imageLink.attrs)
}
}
}, this.node = e, this.view = t, this.getPos = n, this.eventEmitter = r, this.imageLink = null !== (o = e.marks.filter((function(e) {
return "link" === e.type.name
}))[0]) && void 0 !== o ? o : null, this.dom = this.createElement(), this.bindEvent()
}
return e.prototype.createElement = function() {
var e = this.createImageElement(this.node);
if (this.imageLink) {
var t = document.createElement("span");
return t.className = Cf, t.appendChild(e), t
}
return e
}, e.prototype.createImageElement = function(e) {
var t = document.createElement("img"),
n = e.attrs,
r = n.imageUrl,
o = n.altText,
i = Ih(e.attrs);
return t.src = r, o && (t.alt = o), Aa(i, t), t
}, e.prototype.bindEvent = function() {
this.imageLink && this.dom.addEventListener("mousedown", this.handleMousedown)
}, e.prototype.stopEvent = function() {
return !0
}, e.prototype.destroy = function() {
this.imageLink && this.dom.removeEventListener("mousedown", this.handleMousedown)
}, e
}(),
Mf = function() {
function e(e, t, n, r) {
var o = this;
this.contentDOM = null, this.input = null, this.timer = null, this.handleMousedown = function(e) {
var t = e.target;
if ("none" !== getComputedStyle(t, ":after").backgroundImage && Ga()(o.getPos)) {
var n = o.view.coordsAtPos(o.getPos()),
r = n.top,
i = n.right;
o.createLanguageEditor({
top: r,
right: i
})
}
}, this.handleKeydown = function(e) {
"Enter" === e.key && o.input && (e.preventDefault(), o.changeLanguage())
}, this.node = e, this.view = t, this.getPos = n, this.eventEmitter = r, this.createElement(), this.bindDOMEvent(), this.bindEvent()
}
return e.prototype.createElement = function() {
var e = this.node.attrs.language,
t = document.createElement("div");
t.setAttribute("data-language", e || "text"), t.className = "toastui-editor-ww-code-block";
var n = this.createCodeBlockElement(),
r = n.firstChild;
t.appendChild(n), this.dom = t, this.contentDOM = r
}, e.prototype.createCodeBlockElement = function() {
var e = document.createElement("pre"),
t = document.createElement("code"),
n = this.node.attrs.language,
r = Ih(this.node.attrs);
return n && t.setAttribute("data-language", n), Aa(r, e), e.appendChild(t), e
}, e.prototype.createLanguageEditor = function(e) {
var t = this,
n = e.top,
r = e.right,
o = document.createElement("span");
o.className = "toastui-editor-ww-code-block-language";
var i = document.createElement("input");
i.type = "text", i.value = this.node.attrs.language, o.appendChild(i), this.view.dom.parentElement.appendChild(o);
var s = o.clientWidth;
be()(o, {
top: n + 10 + "px",
left: r - s - 10 + "px",
width: s + "px"
}), this.input = i, this.input.addEventListener("blur", (function() {
return t.changeLanguage()
})), this.input.addEventListener("keydown", this.handleKeydown), this.clearTimer(), this.timer = setTimeout((function() {
t.input.focus()
}))
}, e.prototype.bindDOMEvent = function() {
this.dom && this.dom.addEventListener("click", this.handleMousedown)
}, e.prototype.bindEvent = function() {
var e = this;
this.eventEmitter.listen("scroll", (function() {
e.input && e.reset()
}))
}, e.prototype.changeLanguage = function() {
if (this.input && Ga()(this.getPos)) {
var e = this.input.value;
this.reset();
var t = this.getPos(),
n = this.view.state.tr;
n.setNodeMarkup(t, null, {
language: e
}), this.view.dispatch(n)
}
}, e.prototype.reset = function() {
var e;
if (null === (e = this.input) || void 0 === e ? void 0 : e.parentElement) {
var t = this.input.parentElement;
this.input = null, Ma(t)
}
}, e.prototype.clearTimer = function() {
this.timer && (clearTimeout(this.timer), this.timer = null)
}, e.prototype.stopEvent = function() {
return !0
}, e.prototype.update = function(e) {
return !!e.sameMarkup(this.node) && (this.node = e, !0)
}, e.prototype.destroy = function() {
this.reset(), this.clearTimer(), this.dom && this.dom.removeEventListener("click", this.handleMousedown)
}, e
}(),
Sf = /MsoListParagraph/,
Ef = /style=(.|\n)*mso-/,
Nf = /mso-list:(.*)/,
Of = /O:P/,
Df = /^(n|u|l)/;
function Af(e) {
for (var t = [], n = document.createTreeWalker(e, 1, null, !1); n.nextNode();) {
var r = n.currentNode;
if (Ta(r)) {
var o = r,
i = o.outerHTML,
s = o.textContent,
a = Ef.test(i),
l = Nf.test(i);
a && !l && s ? t.push([r, !0]) : (Of.test(r.nodeName) || a && !s || l) && t.push([r, !1])
}
}
return t.forEach((function(e) {
var t = e[0];
e[1] ? function(e) {
for (var t = []; e.firstChild;) t.push(e.firstChild), e.parentNode && e.parentNode.insertBefore(e.firstChild, e);
Ma(e)
}(t) : Ma(t)
})), e.innerHTML.trim()
}
function Lf(e) {
var t = [];
return e.forEach((function(e, n) {
var r = t[n - 1],
o = function(e, t) {
var n = e.getAttribute("style");
if (n) {
var r = n.match(Nf)[1].trim().split(" ")[1];
return {
id: t,
level: parseInt(r.replace("level", ""), 10),
prev: null,
parent: null,
children: [],
unordered: Df.test(e.textContent || ""),
contents: Af(e)
}
}
return null
}(e, n);
o && (r && function(e, t) {
if (t.level < e.level) t.children.push(e), e.parent = t;
else {
for (; t && t.level !== e.level;) t = t.parent;
t && (e.prev = t, e.parent = t.parent, e.parent && e.parent.children.push(e))
}
}(o, r), t.push(o))
})), t
}
function If(e) {
var t = e[0].unordered ? "ul" : "ol",
n = document.createElement(t);
return e.forEach((function(e) {
var t = e.children,
r = e.contents,
o = document.createElement("li");
o.innerHTML = r, n.appendChild(o), t.length && n.appendChild(If(t))
})), n
}
function Rf(e) {
return If(Lf(e).filter((function(e) {
return !e.parent
})))
}
function Pf(e) {
var t = document.createElement("div");
t.innerHTML = e;
var n, r, o, i = [],
s = (n = t, r = "p.MsoListParagraph", (o = vi()(n.querySelectorAll(r))).length ? o : []);
return s.forEach((function(e) {
var n = function(e) {
for (; e && !Ta(e);) e = e.nextSibling;
return !e || !Sf.test(e.className)
}(e.nextSibling);
if (i.push(e), n) {
var r = Rf(i),
o = e.nextSibling;
o ? function(e, t) {
t.parentNode && t.parentNode.insertBefore(e, t)
}(r, o) : function(e, t) {
(t = aa()(t) ? vi()(t) : [t]).forEach((function(t) {
e.appendChild(t)
}))
}(t, r), i = []
}
Ma(e)
})), "" + (s.length ? "<p></p>" : "") + t.innerHTML
}
var Bf = "\x3c!--StartFragment--\x3e";
function Ff(e) {
return function(e) {
return Ef.test(e)
}(e = function(e) {
return /<\/td>((?!<\/tr>)[\s\S])*$/i.test(e) && (e = "<tr>" + e + "</tr>"), /<\/tr>((?!<\/table>)[\s\S])*$/i.test(e) && (e = "<table>" + e + "</table>"), e
}(e = function(e) {
var t = e.indexOf(Bf),
n = e.lastIndexOf("\x3c!--EndFragment--\x3e");
return t > -1 && n > -1 && (e = e.slice(t + Bf.length, n)), e.replace(/<br[^>]*>/g, ba)
}(e))) && (e = Pf(e)), e
}
function Hf(e, t, n) {
for (var r = [], o = e.childCount, i = 0; i < o; i += 1)
if (!e.child(i).attrs.extended) {
var s = i < o ? n.create(e.child(i).attrs, e.child(i).content) : n.createAndFill();
r.push(s)
} return r
}
function zf(e, t, n) {
var r = n.nodes,
o = r.tableRow,
i = Hf(e, 0, r.tableHeadCell);
return o.create(null, i)
}
function qf(e, t, n) {
var r = n.nodes,
o = r.tableRow,
i = Hf(e, 0, r.tableBodyCell);
return o.create(null, i)
}
function Vf(e) {
var t = [],
n = [];
"tableHead" === e.firstChild.type.name && e.firstChild.forEach((function(e) {
return t.push(e)
}));
"tableBody" === e.lastChild.type.name && e.lastChild.forEach((function(e) {
return n.push(e)
}));
return i(i([], t), n)
}
function jf(e, t, n) {
var r = zf(e, 0, n);
return n.nodes.tableHead.create(null, r)
}
function $f(e, t, n) {
var r = e.map((function(e) {
return qf(e, 0, n)
}));
if (!e.length) {
var o = function(e, t) {
for (var n = t.nodes, r = n.tableRow, o = n.tableBodyCell, i = [], s = 0; s < e; s += 1) {
var a = o.createAndFill();
i.push(a)
}
return r.create({
dummyRowForPasting: !0
}, i)
}(t, n);
r.push(o)
}
return n.nodes.tableBody.create(null, r)
}
function _f(e, t, n) {
var r = [],
o = e.content,
i = e.openStart,
s = e.openEnd;
return o.forEach((function(e) {
if ("table" === e.type.name) {
var o = Qh(new v(d.from(e), 0, 0));
if (o) {
var i = Vf(o),
s = "tableBody" === o.firstChild.type.name,
a = function(e, t, n, r) {
var o = function(e) {
return e.reduce((function(e, t) {
return e.childCount > t.childCount ? e : t
})).childCount
}(e);
if (n && r) return t.nodes.table.create(null, [$f(e, o, t)]);
var i = e[0],
s = e.slice(1),
a = [jf(i, 0, t)];
return s.length && a.push($f(s, o, t)), t.nodes.table.create(null, a)
}(i, t, s, n);
r.push(a)
}
} else r.push(e)
})), new v(d.from(r), i, s)
}
function Uf(e) {
return 4 * e
}
function Wf(e, t) {
var n = e.state,
r = n.selection,
o = n.schema,
i = n.tr,
s = Xh(r),
a = s.anchor,
l = s.head;
if (a && l) {
var c = Qh(t);
if (!c) return !1;
var u = jh.create(a),
d = u.getRectOffsets(a, l),
p = function(e, t, n) {
var r = [],
o = Vf(e),
i = (o[0].childCount, o.length),
s = 0 === t.startRowIdx,
a = o.slice(0, i);
if (s) {
var l = a.shift();
if (l) {
var c = zf(l, 0, n).content;
r.push(c)
}
}
return a.forEach((function(e) {
if (!e.attrs.dummyRowForPasting) {
var t = qf(e, 0, n).content;
r.push(t)
}
})), r
}(c, d, o),
h = function(e, t, n) {
for (var r = t.startRowIdx, o = t.startColIdx, i = n.length, s = 0, a = function(e) {
var t = n[e].childCount;
n[e].forEach((function(e) {
var n = e.attrs.colspan;
n > 1 && (t += n - 1)
})), s = Math.max(s, t)
}, l = 0; l < i; l += 1) a(l);
var c = r + i - 1,
u = o + s - 1;
return {
startRowIdx: r,
startColIdx: o,
endRowIdx: c,
endColIdx: u,
addedRowCount: Math.max(c + 1 - e.totalRowCount, 0),
addedColumnCount: Math.max(u + 1 - e.totalColumnCount, 0)
}
}(u, d, p),
f = [];
return function(e, t) {
var n = Yh(e.getSpannedOffsets(t)),
r = n.rowCount,
o = n.columnCount,
i = Yh(t),
s = i.rowCount,
a = i.columnCount;
return r === s && o === a
}(u, h) && (function(e, t) {
for (var n = e.startRowIdx, r = e.startColIdx, o = e.endRowIdx, i = e.endColIdx, s = e.addedRowCount, a = e.addedColumnCount, l = n; l <= o - s; l += 1) t.push({
rowIdx: l,
startColIdx: r,
endColIdx: i - a
})
}(h, f), h.addedColumnCount && function(e, t, n, r, o) {
for (var i = r.startRowIdx, s = r.startColIdx, a = r.endRowIdx, l = r.endColIdx, c = r.addedRowCount, u = r.addedColumnCount, d = n.totalRowCount, p = 0, h = 0; h < d; h += 1) {
var f = n.getCellInfo(h, l - u),
m = f.offset,
g = f.nodeSize,
v = e.mapping.map(m + g),
y = Gh(u, h, t);
if (e.insert(v, y), h >= i && h <= a - c) {
var b = n.getCellInfo(h, l - u),
w = e.mapping.map(b.offset),
k = v + Uf(u);
o[p] = {
rowIdx: h,
startColIdx: s,
endColIdx: l,
dummyOffsets: [w, k]
}, p += 1
}
}
}(i, o, u, h, f), h.addedRowCount && function(e, t, n, r, o) {
var i = r.addedRowCount,
s = r.addedColumnCount,
a = r.startColIdx,
l = r.endColIdx,
c = e.mapping.maps.length,
u = n.tableEndOffset - 2,
d = Jh(i, n.totalColumnCount + s, t),
p = u;
e.insert(e.mapping.slice(c).map(p), d);
for (var h = 0; h < i; h += 1) {
var f = p + Uf(a) + 1,
m = p + Uf(l + 1) + 1,
g = p + Uf(n.totalColumnCount + s) + 2;
o.push({
rowIdx: h + n.totalRowCount,
startColIdx: a,
endColIdx: l,
dummyOffsets: [f, m]
}), p = g
}
}(i, o, u, h, f), function(e, t, n, r) {
var o = e.mapping.maps.length;
n.forEach((function(n, i) {
var s = n.rowIdx,
a = n.startColIdx,
l = n.endColIdx,
c = n.dummyOffsets,
u = e.mapping.slice(o),
d = new v(t[i], 0, 0),
p = c ? c[0] : r.getCellStartOffset(s, a),
h = c ? c[1] : r.getCellEndOffset(s, l);
e.replace(u.map(p), u.map(h), d)
}))
}(i, p, f, u), e.dispatch(i), function(e, t, n) {
var r = e.state,
o = r.tr,
i = r.doc,
s = jh.create(i.resolve(n)),
a = t[0],
l = a.rowIdx,
c = a.startColIdx,
u = et(t),
d = u.rowIdx,
p = u.endColIdx,
h = s.getCellInfo(l, c).offset,
f = s.getCellInfo(d, p).offset;
e.dispatch(o.setSelection(new Wh(i.resolve(h), i.resolve(f))))
}(e, f, u.getCellInfo(0, 0).offset)), !0
}
return !1
}
var Jf, Gf = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "doc"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "block+"
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
Kf = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "paragraph"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "inline*",
group: "block",
attrs: o({}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [{
tag: "p"
}],
toDOM: function(e) {
return ["p", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
Zf = /\s{1,4}$/,
Xf = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "text"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
group: "inline"
}
},
enumerable: !1,
configurable: !0
}), n.prototype.addSpaces = function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = n.$from,
i = n.$to;
return !(!o.blockRange(i) || Eh(o) || Nh(o)) && (t(r.insertText(" ", o.pos, i.pos)), !0)
}
}, n.prototype.removeSpaces = function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = n.$from,
i = n.$to,
s = n.from;
if (o.blockRange(i) && !Eh(o) && !Nh(o)) {
var a = o.nodeBefore;
if (a && a.isText) {
var l = a.text,
c = l.replace(Zf, ""),
u = l.length - c.length;
return t(r.delete(s - u, s)), !0
}
}
return !1
}
}, n.prototype.keymaps = function() {
return {
Tab: this.addSpaces(),
"Shift-Tab": this.removeSpaces()
}
}, n
}(Va),
Qf = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "heading"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "levels", {
get: function() {
return [1, 2, 3, 4, 5, 6]
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
var e = this.levels.map((function(e) {
return {
tag: "h" + e,
getAttrs: function(t) {
var n = t.getAttribute("data-raw-html");
return o({
level: e
}, n && {
rawHTML: n
})
}
}
}));
return {
attrs: o({
level: {
default: 1
},
headingType: {
default: "atx"
},
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
content: "inline*",
group: "block",
defining: !0,
parseDOM: e,
toDOM: function(e) {
var t = e.attrs;
return ["h" + t.level, Ih(t), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function(e) {
return function(t, n) {
return Gi(t.schema.nodes[e.level ? "heading" : "paragraph"], e)(t, n)
}
}
}, n
}(Va),
Yf = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "codeBlock"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "text*",
group: "block",
attrs: o({
language: {
default: null
},
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
code: !0,
defining: !0,
marks: "",
parseDOM: [{
tag: "pre",
preserveWhitespace: "full",
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html"),
n = e.firstElementChild;
return o({
language: (null == n ? void 0 : n.getAttribute("data-language")) || null
}, t && {
rawHTML: t
})
}
}],
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "pre", ["code", o({
"data-language": t.language
}, Ih(t)), 0]]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t) {
return Gi(e.schema.nodes.codeBlock)(e, t)
}
}
}, n.prototype.moveCursor = function(e) {
var t = this;
return function(n, r) {
var o, i, s = n.tr,
a = n.doc,
l = n.schema,
c = n.selection.$from;
if (t.context.view.endOfTextblock(e) && "codeBlock" === c.node().type.name) {
var u = c.parent.textContent.split("\n"),
d = "up" === e ? c.start() : c.end(),
p = "up" === e ? [d, u[0].length + d] : [d - et(u).length, d],
h = a.resolve("up" === e ? c.before() : c.after()),
f = "up" === e ? h.nodeBefore : h.nodeAfter;
if (o = c.pos, i = p[1], o >= p[0] && o <= i && !f) {
var m = Ds(s, h, l);
if (m) return r(m), !0
}
}
return !1
}
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Shift-Mod-p": e,
"Shift-Mod-P": e,
ArrowUp: this.moveCursor("up"),
ArrowDown: this.moveCursor("down")
}
}, n
}(Va),
em = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "bulletList"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "listItem+",
group: "block",
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [Dh("ul")],
toDOM: function(e) {
return ["ul", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.changeList = function() {
return function(e, t) {
return Bh(e.schema.nodes.bulletList)(e, t)
}
}, n.prototype.commands = function() {
return {
bulletList: this.changeList,
taskList: Fh
}
}, n.prototype.keymaps = function() {
var e = this.changeList(),
t = qh(),
n = t.indent,
r = t.outdent;
return {
"Mod-u": e,
"Mod-U": e,
Tab: n(),
"Shift-Tab": r()
}
}, n
}(Va),
tm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "orderedList"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "listItem+",
group: "block",
attrs: o({
order: {
default: 1
},
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [{
tag: "ol",
getAttrs: function(e) {
var t = e.getAttribute("start"),
n = e.getAttribute("data-raw-html");
return o({
order: e.hasAttribute("start") ? Number(t) : 1
}, n && {
rawHTML: n
})
}
}],
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "ol", o({
start: 1 === t.order ? null : t.order
}, Ih(t)), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t) {
return Bh(e.schema.nodes.orderedList)(e, t)
}
}
}, n.prototype.keymaps = function() {
var e = this.commands()(),
t = qh(),
n = t.indent,
r = t.outdent;
return {
"Mod-o": e,
"Mod-O": e,
Tab: n(),
"Shift-Tab": r()
}
}, n
}(Va),
nm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "listItem"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "paragraph block*",
selectable: !1,
attrs: {
task: {
default: !1
},
checked: {
default: !1
},
rawHTML: {
default: null
}
},
defining: !0,
parseDOM: [{
tag: "li",
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html");
return o({
task: e.hasAttribute("data-task"),
checked: e.hasAttribute("data-task-checked")
}, t && {
rawHTML: t
})
}
}],
toDOM: function(e) {
var t = e.attrs,
n = t.task,
r = t.checked;
if (!n) return [t.rawHTML || "li", 0];
var i = ["task-list-item"];
return r && i.push("checked"), [t.rawHTML || "li", o({
class: i.join(" "),
"data-task": n
}, r && {
"data-task-checked": r
}), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.liftToPrevListItem = function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = e.schema,
i = n.$from,
s = n.empty,
a = o.nodes.listItem,
l = i.parent,
c = i.node(-1);
if (s && !l.childCount && c.type === a) {
if (i.index(-2) >= 1) return r.delete(i.start(-1) - 1, i.end(-1)), t(r), !0;
if (i.node(-3).type === a) return r.delete(i.start(-2) - 1, i.end(-1)), t(r), !0
}
return !1
}
}, n.prototype.keymaps = function() {
return {
Backspace: this.liftToPrevListItem(),
Enter: function(e, t) {
return function(e) {
return function(t, n) {
var r = t.tr,
o = t.selection,
i = o.$from,
s = o.$to;
if (i.depth < 2 || !i.sameParent(s)) return !1;
var a = i.node(-1);
if (a.type !== e) return !1;
if (0 === i.parent.content.size && i.node(-1).childCount === i.indexAfter(-1)) {
if (2 === i.depth || i.node(-3).type !== e || i.index(-2) !== i.node(-2).childCount - 1) return !1;
for (var l = i.index(-1) > 0, c = d.empty, u = i.depth - (l ? 1 : 2); u >= i.depth - 3; u -= 1) c = d.from(i.node(u).copy(c));
return c = c.append(d.from(e.createAndFill())), r.replace(l ? i.before() : i.before(-1), i.after(-3), new v(c, l ? 3 : 2, 2)), r.setSelection(Vt.near(r.doc.resolve(i.pos + (l ? 3 : 2)))), n(r), !0
}
var p = s.pos === i.end() ? a.contentMatchAt(0).defaultType : null,
h = p && [null, {
type: p
}];
return r.delete(i.pos, s.pos), !!Mt(r.doc, i.pos, 2, h) && (r.split(i.pos, 2, h), n(r), !0)
}
}(e.schema.nodes.listItem)(e, t)
}
}
}, n
}(Va),
rm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "blockQuote"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
content: "block+",
group: "block",
parseDOM: [Dh("blockquote")],
toDOM: function(e) {
return ["blockquote", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t) {
return Ji(e.schema.nodes.blockQuote)(e, t)
}
}
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Alt-q": e,
"Alt-Q": e
}
}, n
}(Va),
om = {
left: function(e, t) {
var n = e[0],
r = e[1],
o = t.totalColumnCount,
i = 0 === r;
if (0 !== n || !i) {
r -= 1, i && (n -= 1, r = o - 1);
var s = t.getCellInfo(n, r),
a = s.offset,
l = s.nodeSize;
return a + l - 2
}
return null
},
right: function(e, t) {
var n = e[0],
r = e[1],
o = t.totalRowCount,
i = t.totalColumnCount,
s = r === i - 1;
if (n !== o - 1 || !s) {
var a = r + 1,
l = t.getColspanStartInfo(n, r);
return (null == l ? void 0 : l.count) > 1 && (a += l.count - 1), (s || a === i) && (n += 1, a = 0), t.getCellInfo(n, a).offset + 2
}
return null
},
up: function(e, t) {
var n = e[0],
r = e[1];
if (n > 0) {
var o = t.getCellInfo(n - 1, r),
i = o.offset,
s = o.nodeSize;
return i + s - 2
}
return null
},
down: function(e, t) {
var n = e[0],
r = e[1],
o = t.totalRowCount;
if (n < o - 1) {
var i = n + 1,
s = t.getRowspanStartInfo(n, r);
return (null == s ? void 0 : s.count) > 1 && (i += s.count - 1), t.getCellInfo(i, r).offset + 2
}
return null
}
};
function im(e, t, n, r) {
var o = t[0],
i = t[1],
s = o + 3,
a = i >= s,
l = a ? o + 1 : i,
c = function(e, t, n, r, o) {
var i = t[0],
s = t[1],
a = t[2];
if (e === Jf.LEFT || e === Jf.UP) {
if (o && ! function(e, t, n) {
var r = n[0],
o = n[1],
i = t.resolve(e.before(r - 1));
return o === r && !i.nodeBefore
}(n, r, [i, s])) return !1;
var l = n.before(a);
if (r.resolve(l).nodeBefore) return !1
}
return !0
}(e, [i, s, l], n, r, a),
u = function(e, t, n, r, o) {
if (e === Jf.RIGHT || e === Jf.DOWN) {
if (o && ! function(e) {
for (var t, n, r = e.depth; r && "tableBodyCell" !== (n = e.node(r)).type.name;) {
if ("listItem" === n.type.name) {
var o = e.node(r - 1).lastChild === n,
i = "paragraph" !== (null === (t = n.lastChild) || void 0 === t ? void 0 : t.type.name);
return !!o && !i
}
r -= 1
}
return !1
}(n)) return !1;
var i = n.after(t);
if (r.resolve(i).nodeAfter) return !1
}
return !0
}(e, l, n, r, a);
return c && u
}
function sm(e, t, n) {
var r = n[0],
o = n[1],
i = t.getRowspanStartInfo(r, o),
s = e === Jf.UP && 0 === r,
a = e === Jf.DOWN && ((null == i ? void 0 : i.count) > 1 ? r + i.count - 1 : r) === t.totalRowCount - 1;
return s || a
}
function am(e, t, n, r) {
void 0 === r && (r = !1);
var o = e.doc.resolve(t.tableEndOffset);
return r || !o.nodeAfter ? Ds(e, o, n) : e.setSelection(Vt.near(o, 1))
}
function lm(e, t, n, r) {
var o = (0, om[e])(n, r);
if (o) {
var i = e === Jf.RIGHT || e === Jf.DOWN ? 1 : -1;
return t.setSelection(Vt.near(t.doc.resolve(o), i))
}
return null
}
function cm(e, t, n) {
var r = e.getCellInfo(t, 0).offset,
o = e.getCellInfo(t, n - 1);
return {
from: r,
to: o.offset + o.nodeSize
}
}! function(e) {
e.LEFT = "left", e.RIGHT = "right", e.UP = "up", e.DOWN = "down"
}(Jf || (Jf = {}));
var um = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "table"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "tableHead{1} tableBody{1}",
group: "block",
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [Dh("table")],
toDOM: function(e) {
return ["table", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.addTable = function() {
return function(e) {
return void 0 === e && (e = {
rowCount: 2,
columnCount: 1,
data: []
}),
function(t, n) {
var r = e.rowCount,
o = e.columnCount,
i = e.data,
s = t.schema,
a = t.selection,
l = t.tr,
c = a.from,
u = a.to,
d = a.$from;
if (c === u && !Nh(d)) {
var p = s.nodes,
h = p.tableHead,
f = p.tableBody,
m = null == i ? void 0 : i.slice(0, o),
g = null == i ? void 0 : i.slice(o, i.length),
v = function(e, t, n) {
for (var r = t.nodes, o = r.tableRow, i = r.tableHeadCell, s = r.paragraph, a = [], l = 0; l < e; l += 1) {
var c = n && n[l],
u = s.create(null, c ? t.text(c) : []);
a.push(i.create(null, u))
}
return [o.create(null, a)]
}(o, s, m),
y = Jh(r - 1, o, s, g),
b = s.nodes.table.create(null, [h.create(null, v), f.create(null, y)]);
return n(l.replaceSelectionWith(b)), !0
}
return !1
}
}
}, n.prototype.removeTable = function() {
return function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = jh.create(n.$anchor);
if (o) {
var i = o.tableStartOffset,
s = o.tableEndOffset,
a = i - 1,
l = Os(r.delete(a, s), a);
return t(r.setSelection(l)), !0
}
return !1
}
}
}, n.prototype.addColumn = function(e) {
return function() {
return function(t, n) {
var r = t.selection,
o = t.tr,
i = t.schema,
s = Xh(r),
a = s.anchor,
l = s.head;
if (a && l) {
for (var c = jh.create(a), u = c.getRectOffsets(a, l), d = e === Jf.LEFT ? u.startColIdx : u.endColIdx + 1, p = Yh(u).columnCount, h = c.totalRowCount, f = 0; f < h; f += 1) {
var m = Gh(p, f, i);
o.insert(o.mapping.map(c.posAt(f, d)), m)
}
return n(o), !0
}
return !1
}
}
}, n.prototype.removeColumn = function() {
return function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = Xh(n),
i = o.anchor,
s = o.head;
if (i && s) {
var a = jh.create(i),
l = a.getRectOffsets(i, s),
c = a.totalColumnCount,
u = a.totalRowCount;
if (Yh(l).columnCount === c) return !1;
for (var d = l.startColIdx, p = l.endColIdx, h = r.mapping.maps.length, f = 0; f < u; f += 1)
for (var m = p; m >= d; m -= 1) {
var g = a.getCellInfo(f, m),
v = g.offset,
y = g.nodeSize,
b = r.mapping.slice(h).map(v),
w = b + y;
r.delete(b, w)
}
return t(r), !0
}
return !1
}
}
}, n.prototype.addRow = function(e) {
return function() {
return function(t, n) {
var r = t.selection,
o = t.schema,
i = t.tr,
s = Xh(r),
a = s.anchor,
l = s.head;
if (a && l) {
var c = jh.create(a),
u = c.totalColumnCount,
d = c.getRectOffsets(a, l),
p = Yh(d).rowCount,
h = function(e, t, n) {
var r, o, i;
return e === Jf.UP ? (r = n.startRowIdx, o = 0, i = -1) : (r = n.endRowIdx, o = t.totalColumnCount - 1, i = t.getCellInfo(r, o).nodeSize + 1), {
targetRowIdx: r,
insertColIdx: o,
nodeSize: i
}
}(e, c, d),
f = h.targetRowIdx,
m = h.insertColIdx,
g = h.nodeSize;
if (!(0 === f)) {
for (var v = [], y = i.mapping.map(c.posAt(f, m)) + g, b = [], w = 0; w < u; w += 1) b = b.concat(Gh(1, f, o));
for (var k = 0; k < p; k += 1) v.push(o.nodes.tableRow.create(null, b));
return n(i.insert(y, v)), !0
}
}
return !1
}
}
}, n.prototype.removeRow = function() {
return function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = Xh(n),
i = o.anchor,
s = o.head;
if (i && s) {
var a = jh.create(i),
l = a.totalRowCount,
c = a.totalColumnCount,
u = a.getRectOffsets(i, s),
d = Yh(u).rowCount,
p = u.startRowIdx,
h = u.endRowIdx;
if (d === l - 1 || 0 === p) return !1;
for (var f = h; f >= p; f -= 1) {
var m = cm(a, f, c),
g = m.from,
v = m.to;
r.delete(g - 1, v + 1)
}
return t(r), !0
}
return !1
}
}
}, n.prototype.alignColumn = function() {
return function(e) {
return void 0 === e && (e = {
align: "center"
}),
function(t, n) {
var r = e.align,
o = t.selection,
i = t.tr,
s = Xh(o),
a = s.anchor,
l = s.head;
if (a && l) {
for (var c = jh.create(a), u = c.totalRowCount, d = c.getRectOffsets(a, l), p = d.startColIdx, h = d.endColIdx, f = 0; f < u; f += 1)
for (var m = p; m <= h; m += 1)
if (!c.extendedRowspan(f, m) && !c.extendedColspan(f, m)) {
var g = c.getNodeAndPos(f, m),
v = g.node,
y = g.pos,
b = ef(v, {
align: r
});
i.setNodeMarkup(y, null, b)
} return n(i), !0
}
return !1
}
}
}, n.prototype.moveToCell = function(e) {
return function(t, n) {
var r = t.selection,
o = t.tr,
i = t.schema,
s = Xh(r),
a = s.anchor,
l = s.head;
if (a && l) {
var c = jh.create(a),
u = c.getCellIndex(a),
d = void 0;
if (d = sm(e, c, u) ? am(o, c, i) : lm(e, o, u, c)) return n(d), !0
}
return !1
}
}, n.prototype.moveInCell = function(e) {
var t = this;
return function(n, r) {
var o = n.selection,
i = n.tr,
s = n.doc,
a = n.schema,
l = o.$from;
if (!t.context.view.endOfTextblock(e)) return !1;
var c = Sh(l, (function(e) {
var t = e.type;
return "tableHeadCell" === t.name || "tableBodyCell" === t.name
}));
if (c) {
var u = Sh(l, (function(e) {
return "paragraph" === e.type.name
})),
d = c.depth;
if (u && im(e, [d, u.depth], l, s)) {
var p = Xh(o).anchor,
h = jh.create(p),
f = h.getCellIndex(p),
m = void 0;
if (! function(e, t, n) {
var r = n[0],
o = n[1];
if (e === Jf.UP || e === Jf.DOWN) return !1;
var i = t.tableStartOffset,
s = t.tableEndOffset,
a = t.getCellInfo(r, o),
l = a.offset,
c = a.nodeSize;
return (e === Jf.LEFT ? i : s) === (e === Jf.LEFT ? l - 2 : l + c + 3)
}(e, h, f) ? sm(e, h, f) ? e === Jf.UP ? m = function(e, t, n) {
var r = e.doc.resolve(t.tableStartOffset - 1);
return r.nodeBefore ? e.setSelection(Vt.near(r, -1)) : Ds(e, r, n)
}(i, h, a) : e === Jf.DOWN && (m = am(i, h, a)) : m = lm(e, i, f, h) : m = function(e, t, n) {
var r = e.doc.resolve(t.before(n - 3));
return e.setSelection(new Jt(r))
}(i, l, d), m) return r(m), !0
}
}
return !1
}
}, n.prototype.deleteCells = function() {
return function(e, t) {
var n = e.schema,
r = e.selection,
o = e.tr,
i = Xh(r),
s = i.anchor,
a = i.head;
if (s && a && !(r instanceof Ut)) {
for (var l = jh.create(s), c = l.getRectOffsets(s, a), u = c.startRowIdx, d = c.startColIdx, p = c.endRowIdx, h = c.endColIdx, f = u; f <= p; f += 1)
for (var m = d; m <= h; m += 1)
if (!l.extendedRowspan(f, m) && !l.extendedColspan(f, m)) {
var g = l.getNodeAndPos(f, m),
v = g.node,
y = g.pos,
b = Gh(1, f, n, v.attrs);
o.replaceWith(o.mapping.map(y), o.mapping.map(y + v.nodeSize), b)
} return t(o), !0
}
return !1
}
}, n.prototype.exitTable = function() {
return function(e, t) {
var n = e.selection,
r = e.tr,
o = e.schema,
i = n.$from;
if (Sh(i, (function(e) {
var t = e.type;
return "tableHeadCell" === t.name || "tableBodyCell" === t.name
})) && Sh(i, (function(e) {
return "paragraph" === e.type.name
}))) {
var s = Xh(n).anchor;
return t(am(r, jh.create(s), o, !0)), !0
}
return !1
}
}, n.prototype.commands = function() {
return {
addTable: this.addTable(),
removeTable: this.removeTable(),
addColumnToLeft: this.addColumn(Jf.LEFT),
addColumnToRight: this.addColumn(Jf.RIGHT),
removeColumn: this.removeColumn(),
addRowToUp: this.addRow(Jf.UP),
addRowToDown: this.addRow(Jf.DOWN),
removeRow: this.removeRow(),
alignColumn: this.alignColumn()
}
}, n.prototype.keymaps = function() {
var e = this.deleteCells();
return {
Tab: this.moveToCell(Jf.RIGHT),
"Shift-Tab": this.moveToCell(Jf.LEFT),
ArrowUp: this.moveInCell(Jf.UP),
ArrowDown: this.moveInCell(Jf.DOWN),
ArrowLeft: this.moveInCell(Jf.LEFT),
ArrowRight: this.moveInCell(Jf.RIGHT),
Backspace: e,
"Mod-Backspace": e,
Delete: e,
"Mod-Delete": e,
"Mod-Enter": this.exitTable()
}
}, n
}(Va),
dm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "tableHead"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "tableRow{1}",
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [Dh("thead")],
toDOM: function(e) {
return ["thead", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
pm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "tableBody"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "tableRow+",
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [{
tag: "tbody",
getAttrs: function(e) {
var t = e.querySelectorAll("tr")[0].children.length,
n = e.getAttribute("data-raw-html");
return !!t && o({}, n && {
rawHTML: n
})
}
}],
toDOM: function(e) {
return ["tbody", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
hm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "tableRow"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "(tableHeadCell | tableBodyCell)*",
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [{
tag: "tr",
getAttrs: function(e) {
var t = e.children.length,
n = e.getAttribute("data-raw-html");
return !!t && o({}, n && {
rawHTML: n
})
}
}],
toDOM: function(e) {
return ["tr", Ih(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
fm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "tableHeadCell"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "paragraph+",
attrs: o({
align: {
default: null
},
className: {
default: null
},
rawHTML: {
default: null
},
colspan: {
default: null
},
extended: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
isolating: !0,
parseDOM: [Lh("th")],
toDOM: function(e) {
var t = e.attrs,
n = Ah(t);
return ["th", o(o({}, n), Ih(t)), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
mm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "tableBodyCell"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "(paragraph | bulletList | orderedList)+",
attrs: {
align: {
default: null
},
className: {
default: null
},
rawHTML: {
default: null
},
colspan: {
default: null
},
rowspan: {
default: null
},
extended: {
default: null
}
},
isolating: !0,
parseDOM: [Lh("td")],
toDOM: function(e) {
return ["td", Ah(e.attrs), 0]
}
}
},
enumerable: !1,
configurable: !0
}), n
}(Va),
gm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "image"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
inline: !0,
attrs: o({
imageUrl: {
default: ""
},
altText: {
default: null
},
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
group: "inline",
selectable: !1,
parseDOM: [{
tag: "img[src]",
getAttrs: function(e) {
var t = rh(e, {
RETURN_DOM_FRAGMENT: !0
}).firstChild,
n = t.getAttribute("src") || "",
r = t.getAttribute("data-raw-html"),
i = t.getAttribute("alt");
return o({
imageUrl: n,
altText: i
}, r && {
rawHTML: r
})
}
}],
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "img", o(o({
src: _e(t.imageUrl)
}, t.altText && {
alt: t.altText
}), Ih(t))]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.addImage = function() {
return function(e) {
return function(t, n) {
var r = t.schema,
i = t.tr,
s = e,
a = s.imageUrl,
l = s.altText;
if (!a) return !1;
var c = r.nodes.image.createAndFill(o({
imageUrl: a
}, l && {
altText: l
}));
return n(i.replaceSelectionWith(c).scrollIntoView()), !0
}
}
}, n.prototype.commands = function() {
return {
addImage: this.addImage()
}
}, n
}(Va),
vm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "thematicBreak"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
group: "block",
parseDOM: [{
tag: "hr"
}],
selectable: !1,
toDOM: function(e) {
var t = e.attrs;
return ["div", Ih(t), [t.rawHTML || "hr"]]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.hr = function() {
var e = this;
return function() {
return function(t, n) {
var r, o = t.selection,
i = o.$from;
if (i === o.$to) {
var s = t.doc,
a = t.schema.nodes,
l = a.thematicBreak,
c = a.paragraph,
u = [l.create()],
d = i.node(1),
p = s.child(s.childCount - 1) === d,
h = s.resolve(i.after(1)),
f = (null === (r = i.nodeAfter) || void 0 === r ? void 0 : r.type.name) === e.name;
return (p || f) && u.push(c.create()), n(t.tr.insert(h.pos, u).scrollIntoView()), !0
}
return !1
}
}
}, n.prototype.commands = function() {
return {
hr: this.hr()
}
}, n.prototype.keymaps = function() {
var e = this.hr()();
return {
"Mod-l": e,
"Mod-L": e
}
}, n
}(Va),
ym = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "strong"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
var e = ["b", "strong"].map((function(e) {
return {
tag: e,
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html");
return o({}, t && {
rawHTML: t
})
}
}
}));
return {
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: e,
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "strong", Ih(t)]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.bold = function() {
return function() {
return function(e, t) {
return Ki(e.schema.marks.strong)(e, t)
}
}
}, n.prototype.commands = function() {
return {
bold: this.bold()
}
}, n.prototype.keymaps = function() {
var e = this.bold()();
return {
"Mod-b": e,
"Mod-B": e
}
}, n
}(Al),
bm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "emph"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
var e = ["i", "em"].map((function(e) {
return {
tag: e,
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html");
return o({}, t && {
rawHTML: t
})
}
}
}));
return {
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: e,
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "em", Ih(t)]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.italic = function() {
return function() {
return function(e, t) {
return Ki(e.schema.marks.emph)(e, t)
}
}
}, n.prototype.commands = function() {
return {
italic: this.italic()
}
}, n.prototype.keymaps = function() {
var e = this.italic()();
return {
"Mod-i": e,
"Mod-I": e
}
}, n
}(Al),
wm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "strike"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
var e = ["s", "del"].map((function(e) {
return {
tag: e,
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html");
return o({}, t && {
rawHTML: t
})
}
}
}));
return {
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: e,
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "del", Ih(t)]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t) {
return Ki(e.schema.marks.strike)(e, t)
}
}
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Mod-s": e,
"Mod-S": e
}
}, n
}(Al),
km = function(e) {
function n(t) {
var n = e.call(this) || this;
return n.linkAttributes = t, n
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "link"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
var e = this;
return {
attrs: o({
linkUrl: {
default: ""
},
title: {
default: null
},
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
inclusive: !1,
parseDOM: [{
tag: "a[href]",
getAttrs: function(e) {
var t = rh(e, {
RETURN_DOM_FRAGMENT: !0
}).firstChild,
n = t.getAttribute("href") || "",
r = t.getAttribute("title") || "",
i = t.getAttribute("data-raw-html");
return o({
linkUrl: n,
title: r
}, i && {
rawHTML: i
})
}
}],
toDOM: function(t) {
var n = t.attrs;
return [n.rawHTML || "a", o(o({
href: _e(n.linkUrl)
}, e.linkAttributes), Ih(n))]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.addLink = function() {
return function(e) {
return function(t, n) {
var r = e,
o = r.linkUrl,
i = r.linkText,
s = void 0 === i ? "" : i,
a = t.schema,
l = t.tr,
c = t.selection,
u = c.empty,
d = c.from,
p = c.to;
if (d && p && o) {
var h = {
linkUrl: o
},
f = a.mark("link", h);
if (u && s) {
var m = Ns(a, s, f);
l.replaceRangeWith(d, p, m)
} else l.addMark(d, p, f);
return n(l.scrollIntoView()), !0
}
return !1
}
}
}, n.prototype.toggleLink = function() {
return function(e) {
return function(t, n) {
return Ki(t.schema.marks.link, e)(t, n)
}
}
}, n.prototype.commands = function() {
return {
addLink: this.addLink(),
toggleLink: this.toggleLink()
}
}, n
}(Al),
xm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "code"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
attrs: o({
rawHTML: {
default: null
}
}, {
htmlAttrs: {
default: null
},
classNames: {
default: null
}
}),
parseDOM: [{
tag: "code",
getAttrs: function(e) {
var t = e.getAttribute("data-raw-html");
return o({}, t && {
rawHTML: t
})
}
}],
toDOM: function(e) {
var t = e.attrs;
return [t.rawHTML || "code", Ih(t)]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t) {
return Ki(e.schema.marks.code)(e, t)
}
}
}, n.prototype.keymaps = function() {
var e = this.commands()();
return {
"Shift-Mod-c": e,
"Shift-Mod-C": e
}
}, n
}(Al),
Cm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "customBlock"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "text*",
group: "block",
attrs: {
info: {
default: null
}
},
atom: !0,
code: !0,
defining: !0,
parseDOM: [{
tag: "div[data-custom-info]",
getAttrs: function(e) {
return {
info: e.getAttribute("data-custom-info")
}
}
}],
toDOM: function(e) {
return ["div", {
"data-custom-info": e.attrs.info || null
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function(e) {
return function(t, n) {
return !!(null == e ? void 0 : e.info) && Gi(t.schema.nodes.customBlock, e)(t, n)
}
}
}, n
}(Va),
Tm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "frontMatter"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "text*",
group: "block",
code: !0,
defining: !0,
parseDOM: [{
preserveWhitespace: "full",
tag: "div[data-front-matter]"
}],
toDOM: function() {
return ["div", {
"data-front-matter": "true"
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t, n) {
var r = e.selection.$from;
return !(!n.endOfTextblock("down") || "frontMatter" !== r.node().type.name) && qi(e, t)
}
}
}, n.prototype.keymaps = function() {
return {
Enter: this.commands()()
}
}, n
}(Va),
Mm = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), Object.defineProperty(n.prototype, "name", {
get: function() {
return "htmlComment"
},
enumerable: !1,
configurable: !0
}), Object.defineProperty(n.prototype, "schema", {
get: function() {
return {
content: "text*",
group: "block",
code: !0,
defining: !0,
parseDOM: [{
preserveWhitespace: "full",
tag: "div[data-html-comment]"
}],
toDOM: function() {
return ["div", {
"data-html-comment": "true"
}, 0]
}
}
},
enumerable: !1,
configurable: !0
}), n.prototype.commands = function() {
return function() {
return function(e, t, n) {
var r = e.selection.$from;
return !(!n.endOfTextblock("down") || "htmlComment" !== r.node().type.name) && qi(e, t)
}
}
}, n.prototype.keymaps = function() {
return {
Enter: this.commands()()
}
}, n
}(Va);
var Sm = xa("contents"),
Em = function(e) {
function n(t, n) {
var r = e.call(this, t) || this,
i = n.toDOMAdaptor,
s = n.htmlSchemaMap,
a = void 0 === s ? {} : s,
l = n.linkAttributes,
c = void 0 === l ? {} : l,
u = n.useCommandShortcut,
d = void 0 === u || u,
p = n.wwPlugins,
h = void 0 === p ? [] : p,
f = n.wwNodeViews,
m = void 0 === f ? {} : f;
return r.editorType = "wysiwyg", r.el.classList.add("ww-mode"), r.toDOMAdaptor = i, r.linkAttributes = c, r.extraPlugins = h, r.pluginNodeViews = m, r.specs = r.createSpecs(), r.schema = r.createSchema(a), r.context = r.createContext(), r.keymaps = r.createKeymaps(d), r.view = r.createView(), r.commands = r.createCommands(), r.specs.setContext(o(o({}, r.context), {
view: r.view
})), r.initEvent(), r
}
return t(n, e), n.prototype.createSpecs = function() {
return e = this.linkAttributes, new Qa([new Gf, new Kf, new Xf, new Qf, new Yf, new em, new tm, new nm, new rm, new um, new dm, new pm, new hm, new fm, new mm, new gm, new vm, new ym, new bm, new wm, new km(e), new xm, new Cm, new Tm, new _a, new Mm]);
var e
}, n.prototype.createContext = function() {
return {
schema: this.schema,
eventEmitter: this.eventEmitter
}
}, n.prototype.createSchema = function(e) {
return new Y({
nodes: o(o({}, this.specs.nodes), e.nodes),
marks: o(o({}, this.specs.marks), e.marks)
})
}, n.prototype.createPlugins = function() {
return i([new an({
key: tf,
state: {
init: function() {
return null
},
apply: function(e, t) {
var n = e.getMeta(tf);
if (n) return -1 === n ? null : n;
if (Ae()(t) || !e.docChanged) return t;
var r = e.mapping.mapResult(t),
o = r.deleted,
i = r.pos;
return o ? null : i
}
},
props: {
decorations: sf,
createSelectionBetween: function(e) {
var t = e.state;
return Ae()(tf.getState(t)) ? null : t.selection
}
},
view: function(e) {
return new rf(e)
}
}), gf(this.eventEmitter), new an({
props: {
handleDOMEvents: {
mousedown: function(e, t) {
var n = t,
r = n.clientX,
i = n.clientY,
s = e.posAtCoords({
left: r,
top: i
});
if (s) {
var a = e.state,
l = a.doc,
c = a.tr,
u = l.resolve(s.pos),
d = Oh(u),
p = t.target,
h = getComputedStyle(p, ":before"),
f = t,
m = f.offsetX,
g = f.offsetY;
if (!d || !wa(h, m, g)) return !1;
t.preventDefault();
var v = u.before(d.depth),
y = d.node.attrs;
return c.setNodeMarkup(v, null, o(o({}, y), {
checked: !y.checked
})), e.dispatch(c), !0
}
return !1
}
}
}
}), kf(this.eventEmitter)], this.createPluginProps()).concat(this.defaultPlugins)
}, n.prototype.createPluginNodeViews = function() {
var e = this.eventEmitter,
t = this.pluginNodeViews,
n = {};
return t && Object.keys(t).forEach((function(r) {
n[r] = function(n, o, i) {
return t[r](n, o, i, e)
}
})), n
}, n.prototype.createView = function() {
var e = this,
t = this.toDOMAdaptor,
n = this.eventEmitter;
return new ui(this.el, {
state: this.createState(),
attributes: {
class: Sm
},
nodeViews: o({
customBlock: function(e, n, r) {
return new xf(e, n, r, t)
},
image: function(e, t, r) {
return new Tf(e, t, r, n)
},
codeBlock: function(e, t, r) {
return new Mf(e, t, r, n)
},
widget: ja
}, this.createPluginNodeViews()),
dispatchTransaction: function(t) {
var n = e.view.state.applyTransaction(t).state;
e.view.updateState(n), e.emitChangeEvent(t.scrollIntoView()), e.eventEmitter.emit("setFocusedNode", n.selection.$from.node(1))
},
transformPastedHTML: Ff,
transformPasted: function(t) {
return _f(t, e.schema, Nh(e.view.state.selection.$from))
},
handlePaste: function(e, t, n) {
return Wf(e, n)
},
handleKeyDown: function(t, n) {
return e.eventEmitter.emit("keydown", e.editorType, n), !1
},
handleDOMEvents: {
paste: function(t, n) {
var r = n.clipboardData || window.clipboardData,
o = null == r ? void 0 : r.items;
if (o) {
var i = vi()(o).some((function(e) {
return "string" === e.kind && "text/rtf" === e.type
}));
if (!i) {
var s = za(o);
s && (n.preventDefault(), Ha(e.eventEmitter, s, n.type))
}
}
return !1
},
keyup: function(t, n) {
return e.eventEmitter.emit("keyup", e.editorType, n), !1
},
scroll: function() {
return e.eventEmitter.emit("scroll", "editor"), !0
}
}
})
}, n.prototype.createCommands = function() {
return this.specs.commands(this.view, qh())
}, n.prototype.getHTML = function() {
return La(this.view.dom.innerHTML)
}, n.prototype.getModel = function() {
return this.view.state.doc
}, n.prototype.getSelection = function() {
var e = this.view.state.selection;
return [e.from, e.to]
}, n.prototype.getSchema = function() {
return this.view.state.schema
}, n.prototype.replaceSelection = function(e, t, n) {
var r = this.view.state,
o = r.schema,
i = r.tr,
s = e.split("\n").map((function(e) {
return Es(o, ra(e, o))
})),
a = new v(d.from(s), 1, 1),
l = Ee()(t) && Ee()(n) ? i.replaceRange(t, n, a) : i.replaceSelection(a);
this.view.dispatch(l), this.focus()
}, n.prototype.deleteSelection = function(e, t) {
var n = this.view.state.tr,
r = Ee()(e) && Ee()(t) ? n.deleteRange(e, t) : n.deleteSelection();
this.view.dispatch(r.scrollIntoView())
}, n.prototype.getSelectedText = function(e, t) {
var n = this.view.state,
r = n.doc,
o = n.selection,
i = o.from,
s = o.to;
return Ee()(e) && Ee()(t) && (i = e, s = t), r.textBetween(i, s, "\n")
}, n.prototype.setModel = function(e, t) {
void 0 === t && (t = !1);
var n = this.view.state,
r = n.tr,
o = n.doc;
this.view.dispatch(r.replaceWith(0, o.content.size, e)), t && this.moveCursorToEnd(!0)
}, n.prototype.setSelection = function(e, t) {
void 0 === t && (t = e);
var n = this.view.state.tr,
r = Os(n, e, t);
this.view.dispatch(n.setSelection(r).scrollIntoView())
}, n.prototype.addWidget = function(e, t, n) {
var r = this.view,
o = r.dispatch,
i = r.state;
o(i.tr.setMeta("widget", {
pos: null != n ? n : i.selection.to,
node: e,
style: t
}))
}, n.prototype.replaceWithWidget = function(e, t, n) {
var r = this.view.state,
o = r.tr,
i = ra(n, r.schema);
this.view.dispatch(o.replaceWith(e, t, i))
}, n.prototype.getRangeInfoOfNode = function(e) {
var t = this.view.state,
n = t.doc,
r = t.selection,
o = e ? n.resolve(e) : r.$from,
i = o.marks(),
s = o.node(),
a = o.start(),
l = o.end(),
c = s.type.name;
if (i.length || "paragraph" === c) {
var u = i[i.length - 1];
c = u ? u.type.name : "text", s.forEach((function(e, t) {
var n = e.isText,
r = e.nodeSize,
i = e.marks,
s = o.pos - a;
n && t <= s && t + r >= s && function(e) {
return !e.length || Ue(e, u)
}(i) && (l = (a += t) + r)
}))
}
return {
range: [a, l],
type: c
}
}, n
}(Wa),
Nm = Em,
Om = n(404),
Dm = n.n(Om),
Am = ["afterPreviewRender", "updatePreview", "changeMode", "needChangeMode", "command", "changePreviewStyle", "changePreviewTabPreview", "changePreviewTabWrite", "scroll", "contextmenu", "show", "hide", "changeLanguage", "changeToolbarState", "toggleScrollSync", "mixinTableOffsetMapPrototype", "setFocusedNode", "removePopupWidget", "query", "openPopup", "closePopup", "addImageBlobHook", "beforePreviewRender", "beforeConvertWysiwygToMarkdown", "load", "loadUI", "change", "caretChange", "destroy", "focus", "blur", "keydown", "keyup"],
Lm = function() {
function e() {
var e = this;
this.events = new uf, this.eventTypes = Am.reduce((function(e, t) {
return o(o({}, e), {
type: t
})
}), {}), this.hold = !1, Am.forEach((function(t) {
e.addEventType(t)
}))
}
return e.prototype.listen = function(e, t) {
var n = this.getTypeInfo(e),
r = this.events.get(n.type) || [];
if (!this.hasEventType(n.type)) throw new Error("There is no event type " + n.type);
n.namespace && (t.namespace = n.namespace), r.push(t), this.events.set(n.type, r)
}, e.prototype.emit = function(e) {
for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
var r = this.getTypeInfo(e),
o = this.events.get(r.type),
i = [];
return !this.hold && o && o.forEach((function(e) {
var n = e.apply(void 0, t);
Oe()(n) || i.push(n)
})), i
}, e.prototype.emitReduce = function(e, t) {
for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
var o = this.events.get(e);
return !this.hold && o && o.forEach((function(e) {
var r = e.apply(void 0, i([t], n));
Dm()(r) || (t = r)
})), t
}, e.prototype.getTypeInfo = function(e) {
var t = e.split(".");
return {
type: t[0],
namespace: t[1]
}
}, e.prototype.hasEventType = function(e) {
return !Oe()(this.eventTypes[this.getTypeInfo(e).type])
}, e.prototype.addEventType = function(e) {
if (this.hasEventType(e)) throw new Error("There is already have event type " + e);
this.eventTypes[e] = e
}, e.prototype.removeEventHandler = function(e, t) {
var n = this,
r = this.getTypeInfo(e),
o = r.type,
i = r.namespace;
o && t ? this.removeEventHandlerWithHandler(o, t) : o && !i ? this.events.delete(o) : !o && i ? this.events.forEach((function(e, t) {
n.removeEventHandlerWithTypeInfo(t, i)
})) : o && i && this.removeEventHandlerWithTypeInfo(o, i)
}, e.prototype.removeEventHandlerWithHandler = function(e, t) {
var n = this.events.get(e);
if (n) {
var r = n.indexOf(t);
n.indexOf(t) >= 0 && n.splice(r, 1)
}
}, e.prototype.removeEventHandlerWithTypeInfo = function(e, t) {
var n = [],
r = this.events.get(e);
r && (r.map((function(e) {
return e.namespace !== t && n.push(e), null
})), this.events.set(e, n))
}, e.prototype.getEvents = function() {
return this.events
}, e.prototype.holdEventInvoke = function(e) {
this.hold = !0, e(), this.hold = !1
}, e
}(),
Im = Lm,
Rm = function() {
function e(e, t, n, r) {
this.eventEmitter = e, this.mdCommands = t, this.wwCommands = n, this.getEditorType = r, this.initEvent()
}
return e.prototype.initEvent = function() {
var e = this;
this.eventEmitter.listen("command", (function(t, n) {
e.exec(t, n)
}))
}, e.prototype.addCommand = function(e, t, n) {
"markdown" === e ? this.mdCommands[t] = n : this.wwCommands[t] = n
}, e.prototype.deleteCommand = function(e, t) {
"markdown" === e ? delete this.mdCommands[t] : delete this.wwCommands[t]
}, e.prototype.exec = function(e, t) {
"markdown" === this.getEditorType() ? this.mdCommands[e](t) : this.wwCommands[e](t)
}, e
}(),
Pm = Rm;
function Bm(e) {
return "\n" === e[e.length - 1] ? e.slice(0, e.length - 1) : e
}
function Fm(e, t) {
var n = e.schema,
r = t.literal.match(ga);
if (r) {
var o = r[1],
i = r[3],
s = (o || i).toLowerCase();
return "htmlInline" === t.type && !(!n.marks[s] && !n.nodes[s])
}
return !1
}
function Hm(e) {
return Ue(["text", "strong", "emph", "strike", "image", "link", "code"], e.type)
}
function zm(e) {
return "softbreak" === (null == e ? void 0 : e.type)
}
function qm(e) {
var t = e.type,
n = e.literal,
r = "htmlInline" === t && n.match(ga);
if (r) {
var o = r[1],
i = r[3],
s = o || i;
if (s) return Ue(["ul", "ol", "li"], s.toLowerCase())
}
return !1
}
function Vm(e) {
for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
var r = document.createElement("div");
r.innerHTML = rh(e);
var o = r.firstChild;
return t.map((function(e) {
return o.getAttribute(e) || ""
}))
}
var jm = {
"b, strong": function(e, t, n) {
var r = e.schema.marks.strong;
n ? e.openMark(r.create({
rawHTML: n
})) : e.closeMark(r)
},
"i, em": function(e, t, n) {
var r = e.schema.marks.emph;
n ? e.openMark(r.create({
rawHTML: n
})) : e.closeMark(r)
},
"s, del": function(e, t, n) {
var r = e.schema.marks.strike;
n ? e.openMark(r.create({
rawHTML: n
})) : e.closeMark(r)
},
code: function(e, t, n) {
var r = e.schema.marks.code;
n ? e.openMark(r.create({
rawHTML: n
})) : e.closeMark(r)
},
a: function(e, t, n) {
var r = t.literal,
o = e.schema.marks.link;
if (n) {
var i = Vm(r, "href")[0];
e.openMark(o.create({
linkUrl: i,
rawHTML: n
}))
} else e.closeMark(o)
},
img: function(e, t, n) {
var r = t.literal;
if (n) {
var i = Vm(r, "src", "alt"),
s = i[0],
a = i[1],
l = e.schema.nodes.image;
e.addNode(l, o({
rawHTML: n,
imageUrl: s
}, a && {
altText: a
}))
}
},
hr: function(e, t, n) {
e.addNode(e.schema.nodes.thematicBreak, {
rawHTML: n
})
},
br: function(e, t) {
var n = e.schema.nodes.paragraph,
r = t.parent,
o = t.prev,
i = t.next;
"paragraph" === (null == r ? void 0 : r.type) ? (zm(o) && e.openNode(n), zm(i) ? e.closeNode() : i && (e.closeNode(), e.openNode(n))) : "tableCell" === (null == r ? void 0 : r.type) && (o && (Hm(o) || Fm(e, o)) && e.closeNode(), i && (Hm(i) || Fm(e, i)) && e.openNode(n))
},
pre: function(e, t, n) {
var r, o, i = document.createElement("div");
i.innerHTML = t.literal;
var s = null === (o = null === (r = i.firstChild) || void 0 === r ? void 0 : r.firstChild) || void 0 === o ? void 0 : o.textContent;
e.openNode(e.schema.nodes.codeBlock, {
rawHTML: n
}), e.addText(Bm(s)), e.closeNode()
},
"ul, ol": function(e, t, n) {
if ("tableCell" === t.parent.type) {
var r = e.schema.nodes,
o = r.bulletList,
i = r.orderedList,
s = r.paragraph,
a = "ul" === n ? o : i;
n ? (t.prev && !qm(t.prev) && e.closeNode(), e.openNode(a, {
rawHTML: n
})) : (e.closeNode(), t.next && !qm(t.next) && e.openNode(s))
}
},
li: function(e, t, n) {
var r;
if ("tableCell" === (null === (r = t.parent) || void 0 === r ? void 0 : r.type)) {
var i = e.schema.nodes,
s = i.listItem,
a = i.paragraph;
if (n) {
var l = function(e) {
var t = e.literal;
return {
task: /data-task/.test(t),
checked: /data-task-checked/.test(t)
}
}(t);
t.prev && !qm(t.prev) && e.closeNode(), e.openNode(s, o({
rawHTML: n
}, l)), t.next && !qm(t.next) && e.openNode(a)
} else t.prev && !qm(t.prev) && e.closeNode(), e.closeNode()
}
}
},
$m = function(e) {
var t = {};
return Object.keys(e).forEach((function(n) {
n.split(", ").forEach((function(r) {
var o = r.toLowerCase();
t[o] = e[n]
}))
})), t
}(jm);
function _m(e) {
return "htmlInline" === e.type && va.test(e.literal)
}
function Um(e) {
vi()(e.childNodes).forEach((function(e) {
if (Ta(e)) {
var t = e.nodeName.toLowerCase();
e.setAttribute("data-raw-html", t), e.childNodes && Um(e)
}
}))
}
var Wm = {
text: function(e, t) {
e.addText(t.literal || "")
},
paragraph: function(e, t, n, r) {
var o;
if (n.entering) {
var i = e.schema.nodes.paragraph;
"paragraph" === (null === (o = t.prev) || void 0 === o ? void 0 : o.type) && (e.openNode(i, r), e.closeNode()), e.openNode(i, r)
} else e.closeNode()
},
heading: function(e, t, n, r) {
if (n.entering) {
var i = t,
s = i.level,
a = i.headingType;
e.openNode(e.schema.nodes.heading, o({
level: s,
headingType: a
}, r))
} else e.closeNode()
},
codeBlock: function(e, t, n) {
var r = e.schema.nodes.codeBlock,
i = t,
s = i.info,
a = i.literal;
e.openNode(r, o({
language: s
}, n)), e.addText(Bm(a || "")), e.closeNode()
},
list: function(e, t, n, r) {
if (n.entering) {
var i = e.schema.nodes,
s = i.bulletList,
a = i.orderedList,
l = t.listData,
c = l.type,
u = l.start;
"bullet" === c ? e.openNode(s, r) : e.openNode(a, o({
order: u
}, r))
} else e.closeNode()
},
item: function(e, t, n, r) {
var i = n.entering,
s = e.schema.nodes.listItem,
a = t.listData,
l = a.task,
c = a.checked;
if (i) {
var u = o(o(o({}, l && {
task: l
}), c && {
checked: c
}), r);
e.openNode(s, u)
} else e.closeNode()
},
blockQuote: function(e, t, n, r) {
n.entering ? e.openNode(e.schema.nodes.blockQuote, r) : e.closeNode()
},
image: function(e, t, n, r) {
var i = n.entering,
s = n.skipChildren,
a = e.schema.nodes.image,
l = t,
c = l.destination,
u = l.firstChild;
i && s && s(), e.addNode(a, o(o({
imageUrl: c
}, u && {
altText: u.literal
}), r))
},
thematicBreak: function(e, t, n, r) {
e.addNode(e.schema.nodes.thematicBreak, r)
},
strong: function(e, t, n, r) {
var o = n.entering,
i = e.schema.marks.strong;
o ? e.openMark(i.create(r)) : e.closeMark(i)
},
emph: function(e, t, n, r) {
var o = n.entering,
i = e.schema.marks.emph;
o ? e.openMark(i.create(r)) : e.closeMark(i)
},
link: function(e, t, n, r) {
var i = n.entering,
s = e.schema.marks.link,
a = t,
l = a.destination,
c = a.title;
if (i) {
var u = o({
linkUrl: l,
title: c
}, r);
e.openMark(s.create(u))
} else e.closeMark(s)
},
softbreak: function(e, t) {
if ("paragraph" === t.parent.type) {
var n = t.prev,
r = t.next;
n && !_m(n) && e.closeNode(), r && !_m(r) && e.openNode(e.schema.nodes.paragraph)
}
},
table: function(e, t, n, r) {
n.entering ? e.openNode(e.schema.nodes.table, r) : e.closeNode()
},
tableHead: function(e, t, n, r) {
n.entering ? e.openNode(e.schema.nodes.tableHead, r) : e.closeNode()
},
tableBody: function(e, t, n, r) {
n.entering ? e.openNode(e.schema.nodes.tableBody, r) : e.closeNode()
},
tableRow: function(e, t, n, r) {
n.entering ? e.openNode(e.schema.nodes.tableRow, r) : e.closeNode()
},
tableCell: function(e, t, n) {
var r = n.entering;
if (!t.ignored) {
var i = function(t) {
return t && (Hm(t) || Fm(e, t))
};
if (r) {
var s = e.schema.nodes,
a = s.tableHeadCell,
l = s.tableBodyCell,
c = s.paragraph,
u = t.parent.parent,
d = "tableHead" === u.type ? a : l,
p = (u.parent.columns[t.startIdx] || {}).align,
h = o({}, t.attrs);
p && (h.align = p), e.openNode(d, h), i(t.firstChild) && e.openNode(c)
} else i(t.lastChild) && e.closeNode(), e.closeNode()
}
},
strike: function(e, t, n, r) {
var o = n.entering,
i = e.schema.marks.strike;
o ? e.openMark(i.create(r)) : e.closeMark(i)
},
code: function(e, t, n, r) {
var o = e.schema.marks.code;
e.openMark(o.create(r)), e.addText(Bm(t.literal || "")), e.closeMark(o)
},
customBlock: function(e, t) {
var n = e.schema.nodes,
r = n.customBlock,
o = n.paragraph,
i = t,
s = i.info,
a = i.literal;
e.openNode(r, {
info: s
}), e.addText(Bm(a || "")), e.closeNode(), t.next || (e.openNode(o), e.closeNode())
},
frontMatter: function(e, t) {
e.openNode(e.schema.nodes.frontMatter), e.addText(t.literal), e.closeNode()
},
htmlInline: function(e, t) {
var n = t.literal,
r = n.match(ga),
o = r[1],
i = r[3],
s = (o || i).toLowerCase(),
a = e.schema.marks[s],
l = rh(n);
if (null == a ? void 0 : a.spec.attrs.htmlInline)
if (o) {
var c = ih(l);
e.openMark(a.create({
htmlAttrs: c
}))
} else e.closeMark(a);
else {
var u = $m[s];
u && u(e, t, o)
}
},
htmlBlock: function(e, t) {
var n = t.literal,
r = document.createElement("div");
if (ya.test(n)) e.openNode(e.schema.nodes.htmlComment), e.addText(t.literal), e.closeNode();
else {
var o = n.match(ga),
i = o[1],
s = o[3],
a = (i || s).toLowerCase(),
l = e.schema.nodes[a],
c = rh(n);
if (null == l ? void 0 : l.spec.attrs.htmlBlock) {
var u = ih(c),
d = oh(t, a);
e.addNode(l, {
htmlAttrs: u,
childrenHTML: d
})
} else r.innerHTML = c, Um(r), e.convertByDOMParser(r)
}
},
customInline: function(e, t, n) {
var r = n.entering,
o = n.skipChildren,
i = t,
s = i.info,
a = i.firstChild,
l = e.schema;
if (-1 !== s.indexOf("widget") && r) {
var c = oa(t);
o(), e.addNode(l.nodes.widget, {
info: s
}, [l.text(Qs(s, c))])
} else {
var u = "$$";
r && (u += a ? s + " " : s), e.addText(u)
}
}
};
var Jm = function() {
function e(e, t) {
this.schema = e, this.convertors = t, this.stack = [{
type: this.schema.topNodeType,
attrs: null,
content: []
}], this.marks = m.none
}
return e.prototype.top = function() {
return et(this.stack)
}, e.prototype.push = function(e) {
this.stack.length && this.top().content.push(e)
}, e.prototype.addText = function(e) {
if (e) {
var t = this.top().content,
n = et(t),
r = this.schema.text(e, this.marks),
o = n && (s = r, !!((i = n).isText && s.isText && m.sameSet(i.marks, s.marks)) && i.withText(i.text + s.text));
o ? t[t.length - 1] = o : t.push(r)
}
var i, s
}, e.prototype.openMark = function(e) {
this.marks = e.addToSet(this.marks)
}, e.prototype.closeMark = function(e) {
this.marks = e.removeFromSet(this.marks)
}, e.prototype.addNode = function(e, t, n) {
var r = e.createAndFill(t, n, this.marks);
return r ? (this.push(r), r) : null
}, e.prototype.openNode = function(e, t) {
this.stack.push({
type: e,
attrs: t,
content: []
})
}, e.prototype.closeNode = function() {
this.marks.length && (this.marks = m.none);
var e = this.stack.pop(),
t = e.type,
n = e.attrs,
r = e.content;
return this.addNode(t, n, r)
}, e.prototype.convertByDOMParser = function(e) {
var t = this;
te.fromSchema(this.schema).parse(e).content.forEach((function(e) {
return t.push(e)
}))
}, e.prototype.closeUnmatchedHTMLInline = function(e, t) {
var n;
if (!t && "htmlInline" !== e.type)
for (var r = this.stack.length - 1; r >= 0; r -= 1) {
var o = this.stack[r];
if (!(null === (n = o.attrs) || void 0 === n ? void 0 : n.rawHTML)) break;
o.content.length ? this.closeNode() : this.stack.pop()
}
}, e.prototype.convert = function(e, t) {
for (var n = e.walker(), r = n.next(), o = function() {
var e = r.node,
o = r.entering,
s = i.convertors[e.type],
a = !1;
if (s) {
var l = {
entering: o,
leaf: !Ws(e),
getChildrenText: Js,
options: {
gfm: !0,
nodeId: !1,
tagFilter: !1,
softbreak: "\n"
},
skipChildren: function() {
a = !0
}
};
if (i.closeUnmatchedHTMLInline(e, o), s(i, e, l), (null == t ? void 0 : t.node) === e) {
var c = i.stack.reduce((function(e, t) {
return e + t.content.reduce((function(e, t) {
return e + t.nodeSize
}), 0)
}), 0) + 1;
t.setMappedPos(c)
}
}
a && (n.resumeAt(e, !1), n.next()), r = n.next()
}, i = this; r;) o()
}, e.prototype.convertNode = function(e, t) {
return this.convert(e, t), this.stack.length ? this.closeNode() : null
}, e
}(),
Gm = Jm;
var Km = {
text: function(e, t) {
var n, r = t.node,
o = null !== (n = r.text) && void 0 !== n ? n : "";
(r.marks || []).some((function(e) {
return "link" === e.type.name
})) ? e.text(Ze(o), !1) : e.text(o)
},
paragraph: function(e, t) {
var n = t.node,
r = t.parent,
o = t.index,
i = void 0 === o ? 0 : o;
if (e.stopNewline) e.convertInline(n);
else {
var s = 0 === i,
a = !s && r.child(i - 1),
l = a && 0 === a.childCount,
c = i < r.childCount - 1 && r.child(i + 1),
u = c && "paragraph" === c.type.name,
d = 0 === n.childCount;
if (d && l) e.write("<br>\n");
else if (!d || l || s) e.convertInline(n), u ? e.write("\n") : e.closeBlock(n);
else {
if ("listItem" === (null == r ? void 0 : r.type.name)) {
var p = e.getDelim();
e.setDelim(""), e.write("<br>"), e.setDelim(p)
}
e.write("\n")
}
}
},
heading: function(e, t, n) {
var r = t.node,
o = n.delim;
"atx" === r.attrs.headingType ? (e.write(o + " "), e.convertInline(r), e.closeBlock(r)) : (e.convertInline(r), e.ensureNewLine(), e.write(o), e.closeBlock(r))
},
codeBlock: function(e, t, n) {
var r = t.node,
o = n.delim,
i = n.text,
s = o,
a = s[0],
l = s[1];
e.write(a), e.ensureNewLine(), e.text(i, !1), e.ensureNewLine(), e.write(l), e.closeBlock(r)
},
blockQuote: function(e, t, n) {
var r = t.node,
o = t.parent,
i = n.delim;
(null == o ? void 0 : o.type.name) === r.type.name && e.flushClose(1), e.wrapBlock(i, null, r, (function() {
return e.convertNode(r)
}))
},
bulletList: function(e, t, n) {
var r = t.node,
o = n.delim;
e.convertList(r, Ke(" ", 4), (function() {
return o + " "
}))
},
orderedList: function(e, t) {
var n = t.node,
r = n.attrs.order || 1;
e.convertList(n, Ke(" ", 4), (function(e) {
return String(r + e) + ". "
}))
},
listItem: function(e, t) {
var n = t.node,
r = n.attrs,
o = r.task,
i = r.checked;
o && e.write("[" + (i ? "x" : " ") + "] "), e.convertNode(n)
},
image: function(e, t, n) {
var r = n.attrs;
e.write("![" + (null == r ? void 0 : r.altText) + "](" + (null == r ? void 0 : r.imageUrl) + ")")
},
thematicBreak: function(e, t, n) {
var r = t.node,
o = n.delim;
e.write(o), e.closeBlock(r)
},
table: function(e, t) {
var n = t.node;
e.convertNode(n), e.closeBlock(n)
},
tableHead: function(e, t, n) {
var r = t.node,
o = n.delim,
i = r.firstChild;
e.convertNode(r);
var s = null != o ? o : "";
!o && i && i.forEach((function(e) {
var t = function(e, t) {
var n = e.length,
r = "",
o = "";
return "left" === t ? (r = ":", n -= 1) : "right" === t ? (o = ":", n -= 1) : "center" === t && (r = ":", o = ":", n -= 2), "" + r + Ke("-", Math.max(n, 3)) + o
}(e.textContent, e.attrs.align);
s += "| " + t + " "
})), e.write(s + "|"), e.ensureNewLine()
},
tableBody: function(e, t) {
var n = t.node;
e.convertNode(n)
},
tableRow: function(e, t) {
var n = t.node;
e.convertNode(n), e.write("|"), e.ensureNewLine()
},
tableHeadCell: function(e, t, n) {
var r = t.node,
o = n.delim,
i = void 0 === o ? "| " : o;
e.write(i), e.convertTableCell(r), e.write(" ")
},
tableBodyCell: function(e, t, n) {
var r = t.node,
o = n.delim,
i = void 0 === o ? "| " : o;
e.write(i), e.convertTableCell(r), e.write(" ")
},
customBlock: function(e, t, n) {
var r = t.node,
o = n.delim,
i = n.text,
s = o,
a = s[0],
l = s[1];
e.write(a), e.ensureNewLine(), e.text(i, !1), e.ensureNewLine(), e.write(l), e.closeBlock(r)
},
frontMatter: function(e, t, n) {
var r = t.node,
o = n.text;
e.text(o, !1), e.closeBlock(r)
},
widget: function(e, t, n) {
var r = n.text;
e.write(r)
},
html: function(e, t, n) {
var r = t.node,
o = n.text;
e.write(o), r.attrs.htmlBlock && e.closeBlock(r)
},
htmlComment: function(e, t, n) {
var r = t.node,
o = n.text;
e.write(o), e.closeBlock(r)
}
};
function Zm(e, t) {
var n = e.text,
r = /`+/g,
o = 0;
if (e.isText && n)
for (var i = r.exec(n); i;) o = Math.max(o, i[0].length), i = r.exec(n);
for (var s = o > 0 && t > 0 ? " `" : "`", a = 0; a < o; a += 1) s += "`";
return o > 0 && t < 0 && (s += " "), s
}
function Xm(e) {
return e ? ["<" + e + ">", "</" + e + ">"] : null
}
function Qm(e) {
return e ? "<" + e + ">" : null
}
function Ym(e) {
return e ? "</" + e + ">" : null
}
var eg = {
heading: function(e) {
var t = e.node.attrs,
n = t.level,
r = Ke("#", n);
return "setext" === t.headingType && (r = 1 === n ? "===" : "---"), {
delim: r,
rawHTML: Xm(t.rawHTML)
}
},
codeBlock: function(e) {
var t = e.node,
n = t.attrs,
r = t.textContent;
return {
delim: ["```" + (n.language || ""), "```"],
rawHTML: Xm(n.rawHTML),
text: r
}
},
blockQuote: function(e) {
return {
delim: "> ",
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
bulletList: function(e, t) {
var n = e.node,
r = t.inTable,
o = n.attrs.rawHTML;
return r && (o = o || "ul"), {
delim: "*",
rawHTML: Xm(o)
}
},
orderedList: function(e, t) {
var n = e.node,
r = t.inTable,
o = n.attrs.rawHTML;
return r && (o = o || "ol"), {
rawHTML: Xm(o)
}
},
listItem: function(e, t) {
var n = e.node,
r = t.inTable,
o = n.attrs,
i = o.task,
s = o.checked,
a = n.attrs.rawHTML;
return r && (a = a || "li"), {
rawHTML: a ? ["<" + a + (i ? ' class="task-list-item' + (s ? " checked" : "") + '"' : "") + (i ? " data-task" + (s ? " data-task-checked" : "") : "") + ">", "</" + a + ">"] : null
}
},
table: function(e) {
return {
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
tableHead: function(e) {
return {
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
tableBody: function(e) {
return {
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
tableRow: function(e) {
return {
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
tableHeadCell: function(e) {
return {
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
tableBodyCell: function(e) {
return {
rawHTML: Xm(e.node.attrs.rawHTML)
}
},
image: function(e) {
var t = e.node.attrs,
n = t.rawHTML,
r = t.altText,
o = t.imageUrl.replace(/&amp;/g, "&"),
i = r ? ' alt="' + _e(r) + '"' : "";
return {
rawHTML: n ? "<" + n + ' src="' + _e(o) + '"' + i + ">" : null,
attrs: {
altText: Ze(r || ""),
imageUrl: o
}
}
},
thematicBreak: function(e) {
return {
delim: "***",
rawHTML: Qm(e.node.attrs.rawHTML)
}
},
customBlock: function(e) {
var t = e.node,
n = t.attrs,
r = t.textContent;
return {
delim: ["$$" + n.info, "$$"],
text: r
}
},
frontMatter: function(e) {
return {
text: e.node.textContent
}
},
widget: function(e) {
return {
text: e.node.textContent
}
},
strong: function(e, t) {
var n = e.node,
r = t.entering,
o = n.attrs.rawHTML;
return {
delim: "**",
rawHTML: r ? Qm(o) : Ym(o)
}
},
emph: function(e, t) {
var n = e.node,
r = t.entering,
o = n.attrs.rawHTML;
return {
delim: "*",
rawHTML: r ? Qm(o) : Ym(o)
}
},
strike: function(e, t) {
var n = e.node,
r = t.entering,
o = n.attrs.rawHTML;
return {
delim: "~~",
rawHTML: r ? Qm(o) : Ym(o)
}
},
link: function(e, t) {
var n, r, o = e.node,
i = t.entering,
s = o.attrs,
a = s.title,
l = s.rawHTML,
c = s.linkUrl.replace(/&amp;/g, "&"),
u = a ? ' title="' + _e(a) + '"' : "";
return i ? {
delim: "[",
rawHTML: l ? "<" + l + ' href="' + _e(c) + '"' + u + ">" : null
} : {
delim: "](" + c + (a ? " " + (n = Ze(a), (r = -1 === n.indexOf('"') ? '""' : -1 === n.indexOf("'") ? "''" : "()")[0] + n + r[1]) : "") + ")",
rawHTML: Ym(l)
}
},
code: function(e, t) {
var n = e.node,
r = e.parent,
o = e.index,
i = void 0 === o ? 0 : o,
s = t.entering;
return {
delim: s ? Zm(r.child(i), -1) : Zm(r.child(i - 1), 1),
rawHTML: s ? Qm(n.attrs.rawHTML) : Ym(n.attrs.rawHTML)
}
},
htmlComment: function(e) {
return {
text: e.node.textContent
}
},
html: function(e, t) {
var n = e.node,
r = t.entering,
o = n.type.name,
i = n.attrs.htmlAttrs,
s = "<" + o,
a = "</" + o + ">";
return Object.keys(i).forEach((function(e) {
s += " " + e + '="' + i[e].replace(/"/g, "'") + '"'
})), s += ">", n.attrs.htmlInline ? {
rawHTML: r ? s : a
} : {
text: "" + s + n.attrs.childrenHTML + a
}
}
},
tg = {
strong: {
mixable: !0,
removedEnclosingWhitespace: !0
},
emph: {
mixable: !0,
removedEnclosingWhitespace: !0
},
strike: {
mixable: !0,
removedEnclosingWhitespace: !0
},
code: {
escape: !1
},
link: null,
html: null
};
function ng(e) {
var t = {};
return Object.keys(Km).forEach((function(n) {
t[n] = function(t, r) {
if (Km[n]) {
var o = e[n],
i = o ? o(r, {
inTable: t.inTable
}) : {};
! function(e, t) {
var n = t.state,
r = t.nodeInfo,
o = t.params,
i = o.rawHTML;
i ? lf()(e, ["heading", "codeBlock"]) > -1 ? function(e, t, n) {
var r = n[0],
o = n[1];
e.write(r), e.convertInline(t), e.write(o)
}(n, r.node, i) : lf()(e, ["image", "thematicBreak"]) > -1 ? n.write(i) : function(e, t, n) {
var r = t.node,
o = t.parent,
i = n[0],
s = n[1];
e.stopNewline = !0, e.write(i), e.convertNode(r), e.write(s), "doc" === (null == o ? void 0 : o.type.name) && (e.closeBlock(r), e.stopNewline = !1)
}(n, r, i) : Km[e](n, r, o)
}(n, {
state: t,
nodeInfo: r,
params: i
})
}
}
})), t
}
function rg(e) {
Object.keys(e).forEach((function(t) {
var n = eg[t],
r = e[t];
eg[t] = n ? function(e, t) {
return t.origin = function() {
return n(e, t)
}, r(e, t)
} : r, delete e[t]
}));
var t = ng(eg),
n = function(e) {
var t = {};
return Object.keys(tg).forEach((function(n) {
t[n] = function(t, r) {
var i = tg[n],
s = e[n],
a = s && t && !Oe()(r) ? s(t, {
entering: r
}) : {};
return o(o({}, a), i)
}
})), t
}(eg);
return {
nodeTypeConvertors: t,
markTypeConvertors: n
}
}
var og = function() {
function e(e) {
var t = e.nodeTypeConvertors,
n = e.markTypeConvertors;
this.nodeTypeConvertors = t, this.markTypeConvertors = n, this.delim = "", this.result = "", this.closed = !1, this.tightList = !1, this.stopNewline = !1, this.inTable = !1
}
return e.prototype.getMarkConvertor = function(e) {
var t = e.attrs.htmlInline ? "html" : e.type.name;
return this.markTypeConvertors[t]
}, e.prototype.isInBlank = function() {
return /(^|\n)$/.test(this.result)
}, e.prototype.markText = function(e, t, n, r) {
var o = this.getMarkConvertor(e);
if (o) {
var i = o({
node: e,
parent: n,
index: r
}, t),
s = i.delim;
return i.rawHTML || s
}
return ""
}, e.prototype.setDelim = function(e) {
this.delim = e
}, e.prototype.getDelim = function() {
return this.delim
}, e.prototype.flushClose = function(e) {
if (!this.stopNewline && this.closed) {
if (this.isInBlank() || (this.result += "\n"), e || (e = 2), e > 1) {
var t = this.delim,
n = /\s+$/.exec(t);
n && (t = t.slice(0, t.length - n[0].length));
for (var r = 1; r < e; r += 1) this.result += t + "\n"
}
this.closed = !1
}
}, e.prototype.wrapBlock = function(e, t, n, r) {
var o = this.getDelim();
this.write(t || e), this.setDelim(this.getDelim() + e), r(), this.setDelim(o), this.closeBlock(n)
}, e.prototype.ensureNewLine = function() {
this.isInBlank() || (this.result += "\n")
}, e.prototype.write = function(e) {
void 0 === e && (e = ""), this.flushClose(), this.delim && this.isInBlank() && (this.result += this.delim), e && (this.result += e)
}, e.prototype.closeBlock = function(e) {
this.closed = e
}, e.prototype.text = function(e, t) {
void 0 === t && (t = !0);
for (var n = e.split("\n"), r = 0; r < n.length; r += 1) this.write(), this.result += t ? Xe(n[r]) : n[r], r !== n.length - 1 && (this.result += "\n")
}, e.prototype.convertBlock = function(e, t, n) {
var r = e.type.name,
o = this.nodeTypeConvertors[r],
i = {
node: e,
parent: t,
index: n
};
e.attrs.htmlBlock ? this.nodeTypeConvertors.html(this, i) : o && o(this, i)
}, e.prototype.convertInline = function(e) {
var t = this,
n = [],
r = "",
o = function(o, i, s) {
var a = o ? o.marks : [],
l = r;
r = "";
var c = o && o.isText && a.some((function(e) {
var n = t.getMarkConvertor(e),
r = n && n();
return r && r.removedEnclosingWhitespace
}));
if (c && o && o.text) {
var u = /^(\s*)(.*?)(\s*)$/m.exec(o.text),
d = u[1],
p = u[2],
h = u[3];
l += d, r = h, (d || h) && ((o = p ? o.withText(p) : null) || (a = n))
}
for (var f = a.length && et(a), m = f && t.getMarkConvertor(f), g = m && m(), v = g && !1 === g.escape, y = a.length - (v ? 1 : 0), b = 0; b < y; b += 1) {
p = a[b];
if (g && !g.mixable) break;
for (var w = 0; w < n.length; w += 1) {
var k = n[w];
if (g && !g.mixable) break;
if (p.eq(k)) {
b > w ? a = a.slice(0, w).concat(p).concat(a.slice(w, b)).concat(a.slice(b + 1, y)) : w > b && (a = a.slice(0, b).concat(a.slice(b + 1, w)).concat(p).concat(a.slice(w, y)));
break
}
}
}
for (var x = 0; x < Math.min(n.length, y) && a[x].eq(n[x]);) x += 1;
for (; x < n.length;) {
var C = n.pop();
C && t.text(t.markText(C, !1, e, s), !1)
}
if (l && t.text(l), o) {
for (; n.length < y;) {
p = a[n.length];
n.push(p), t.text(t.markText(p, !0, e, s), !1)
}
v && o.isText ? t.text(t.markText(f, !0, e, s) + o.text + t.markText(f, !1, e, s + 1), !1) : t.convertBlock(o, e, s)
}
};
e.forEach(o), o(null, 0, e.childCount)
}, e.prototype.convertList = function(e, t, n) {
var r, o = this;
this.closed && this.closed.type === e.type ? this.flushClose(3) : this.tightList && this.flushClose(1);
var i = null === (r = e.attrs.tight) || void 0 === r || r,
s = this.tightList;
this.tightList = i, e.forEach((function(r, s, a) {
a && i && o.flushClose(1), o.wrapBlock(t, n(a), e, (function() {
return o.convertBlock(r, e, a)
}))
})), this.tightList = s
}, e.prototype.convertTableCell = function(e) {
var t = this;
this.stopNewline = !0, this.inTable = !0, e.forEach((function(n, r, o) {
Ue(["bulletList", "orderedList"], n.type.name) ? (t.convertBlock(n, e, o), t.closed = !1) : (t.convertInline(n), o < e.childCount - 1 && "paragraph" === e.child(o + 1).type.name && t.write("<br>"))
})), this.stopNewline = !1, this.inTable = !1
}, e.prototype.convertNode = function(e, t) {
var n = this;
return e.forEach((function(r, o, i) {
if (n.convertBlock(r, e, i), (null == t ? void 0 : t.node) === r) {
var s = n.result.split("\n");
t.setMappedPos([s.length, et(s).length + 1])
}
})), this.result
}, e
}(),
ig = og,
sg = function() {
function e(e, t, n, r) {
var i = this;
this.setMappedPos = function(e) {
i.mappedPosWhenConverting = e
}, this.schema = e, this.eventEmitter = r, this.focusedNode = null, this.mappedPosWhenConverting = null, this.toWwConvertors = function(e) {
var t = Object.keys(e),
n = o({}, Wm),
r = new Xp({
gfm: !0,
nodeId: !0,
convertors: e
}).getConvertors();
return t.forEach((function(t) {
var o = Wm[t];
o && !Ue(["htmlBlock", "htmlInline"], t) && (n[t] = function(n, i, s) {
s.origin = function() {
return r[t](i, s, r)
};
var a, l = e[t](i, s);
if (l) {
var c = Array.isArray(l) ? l[0] : l;
a = {
htmlAttrs: c.attributes,
classNames: c.classNames
}
}
o(n, i, s, a)
})
})), n
}(n), this.toMdConvertors = rg(t || {}), this.eventEmitter.listen("setFocusedNode", (function(e) {
return i.focusedNode = e
}))
}
return e.prototype.getMappedPos = function() {
return this.mappedPosWhenConverting
}, e.prototype.getInfoForPosSync = function() {
return {
node: this.focusedNode,
setMappedPos: this.setMappedPos
}
}, e.prototype.toWysiwygModel = function(e) {
return new Gm(this.schema, this.toWwConvertors).convertNode(e, this.getInfoForPosSync())
}, e.prototype.toMarkdownText = function(e) {
var t = new ig(this.toMdConvertors).convertNode(e, this.getInfoForPosSync());
return t = this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown", t)
}, e
}(),
ag = sg;
function lg(e) {
var t = e.plugins,
n = e.eventEmitter,
r = e.usageStatistics,
i = e.instance;
return n.listen("mixinTableOffsetMapPrototype", _h), (null != t ? t : []).reduce((function(e, t) {
var s = function(e) {
var t = e.plugin,
n = {
eventEmitter: e.eventEmitter,
usageStatistics: e.usageStatistics,
instance: e.instance,
pmState: {
Plugin: an,
PluginKey: un,
Selection: Vt,
TextSelection: Ut
},
pmView: {
Decoration: Vo,
DecorationSet: _o
},
pmModel: {
Fragment: d
},
pmRules: {
InputRule: ns,
inputRules: rs,
undoInputRule: ss
},
pmKeymap: {
keymap: Ai
},
i18n: hf
};
if (aa()(t)) {
var r = t[0],
o = t[1];
return r(n, void 0 === o ? {} : o)
}
return t(n)
}({
plugin: t,
eventEmitter: n,
usageStatistics: r,
instance: i
});
if (!s) throw new Error("The return value of the executed plugin is empty.");
var a = s.markdownParsers,
l = s.toHTMLRenderers,
c = s.toMarkdownRenderers,
u = s.markdownPlugins,
p = s.wysiwygPlugins,
h = s.wysiwygNodeViews,
f = s.markdownCommands,
m = s.wysiwygCommands,
g = s.toolbarItems;
return l && (e.toHTMLRenderers = nt(e.toHTMLRenderers, l)), c && (e.toMarkdownRenderers = nt(e.toMarkdownRenderers, c)), u && (e.mdPlugins = e.mdPlugins.concat(u)), p && (e.wwPlugins = e.wwPlugins.concat(p)), h && (e.wwNodeViews = o(o({}, e.wwNodeViews), h)), f && (e.mdCommands = o(o({}, e.mdCommands), f)), m && (e.wwCommands = o(o({}, e.wwCommands), m)), g && (e.toolbarItems = e.toolbarItems.concat(g)), a && (e.markdownParsers = o(o({}, e.markdownParsers), a)), e
}), {
toHTMLRenderers: {},
toMarkdownRenderers: {},
mdPlugins: [],
wwPlugins: [],
wwNodeViews: {},
mdCommands: {},
wwCommands: {},
toolbarItems: [],
markdownParsers: {}
})
}
var cg = function() {
function e(e) {
var t = this;
this.options = ve()({
linkAttributes: null,
extendedAutolinks: !1,
customHTMLRenderer: null,
referenceDefinition: !1,
customHTMLSanitizer: null,
frontMatter: !1,
usageStatistics: !0,
theme: "light"
}, e), this.eventEmitter = new Im;
var n, r = Ge(this.options.linkAttributes),
i = lg({
plugins: this.options.plugins,
eventEmitter: this.eventEmitter,
usageStatistics: this.options.usageStatistics,
instance: this
}) || {},
s = i.toHTMLRenderers,
a = i.markdownParsers,
l = this.options,
c = l.customHTMLRenderer,
u = l.extendedAutolinks,
d = l.referenceDefinition,
p = l.frontMatter,
h = l.customHTMLSanitizer,
f = {
linkAttributes: r,
customHTMLRenderer: o(o({}, s), c),
extendedAutolinks: u,
referenceDefinition: d,
frontMatter: p,
sanitizer: h || rh
};
n = f.customHTMLRenderer, ["htmlBlock", "htmlInline"].forEach((function(e) {
n[e] && Object.keys(n[e]).forEach((function(e) {
return nh(e)
}))
})), this.options.events && me()(this.options.events, (function(e, n) {
t.on(n, e)
}));
var m = this.options,
g = m.el,
v = m.initialValue,
y = m.theme,
b = g.innerHTML;
"light" !== y && g.classList.add(xa(y)), g.innerHTML = "", this.toastMark = new _p("", {
disallowedHtmlBlockTags: ["br", "img"],
extendedAutolinks: u,
referenceDefinition: d,
disallowDeepHeading: !0,
frontMatter: p,
customParser: a
}), this.preview = new Mh(this.eventEmitter, o(o({}, f), {
isViewer: !0
})), Vc()(this.preview.previewContent, "mousedown", this.toggleTask.bind(this)), v ? this.setMarkdown(v) : b && this.preview.setHTML(b), g.appendChild(this.preview.previewContent), this.eventEmitter.emit("load", this)
}
return e.prototype.toggleTask = function(e) {
var t = e.target,
n = getComputedStyle(t, ":before");
!t.hasAttribute("data-task-disabled") && t.hasAttribute("data-task") && wa(n, e.offsetX, e.offsetY) && (Sa(t, "checked"), this.eventEmitter.emit("change", {
source: "viewer",
date: e
}))
}, e.prototype.setMarkdown = function(e) {
var t = this.toastMark.getLineTexts(),
n = [t.length, et(t).length + 1],
r = this.toastMark.editMarkdown([1, 1], n, e || "");
this.eventEmitter.emit("updatePreview", r)
}, e.prototype.on = function(e, t) {
this.eventEmitter.listen(e, t)
}, e.prototype.off = function(e) {
this.eventEmitter.removeEventHandler(e)
}, e.prototype.addHook = function(e, t) {
this.eventEmitter.removeEventHandler(e), this.eventEmitter.listen(e, t)
}, e.prototype.destroy = function() {
zc()(this.preview.el, "mousedown", this.toggleTask.bind(this)), this.preview.destroy(), this.eventEmitter.emit("destroy")
}, e.prototype.isViewer = function() {
return !0
}, e.prototype.isMarkdownMode = function() {
return !1
}, e.prototype.isWysiwygMode = function() {
return !1
}, e
}(),
ug = cg;
function dg(e) {
return e instanceof P
}
function pg(e) {
return Ue(["document", "blockQuote", "bulletList", "orderedList", "listItem", "paragraph", "heading", "emph", "strong", "strike", "link", "image", "table", "tableHead", "tableBody", "tableRow", "tableHeadCell", "tableBodyCell"], e)
}
var hg = {
openTag: function(e, t) {
var n = e,
r = n.tagName,
i = n.classNames,
s = n.attributes,
a = document.createElement(r),
l = {};
i && (a.className = i.join(" ")), s && (l = o(o({}, l), s)), Aa(l, a), t.push(a)
},
closeTag: function(e, t) {
if (t.length > 1) {
var n = t.pop();
et(t).appendChild(n)
}
},
html: function(e, t) {
et(t).insertAdjacentHTML("beforeend", e.content)
},
text: function(e, t) {
var n = document.createTextNode(e.content);
et(t).appendChild(n)
}
},
fg = function() {
function e(e, t) {
var n = dh(e, t),
r = o(o({}, t.htmlBlock), t.htmlInline);
this.customConvertorKeys = Object.keys(t).concat(Object.keys(r)), this.renderer = new Xp({
gfm: !0,
convertors: o(o({}, n), r)
}), this.convertors = this.renderer.getConvertors()
}
return e.prototype.generateTokens = function(e) {
var t = function(e) {
var t = e.attrs,
n = e.type.name,
r = {
type: n,
wysiwygNode: !0,
literal: !pg(n) && dg(e) ? e.textContent : null
},
i = {
heading: {
level: t.level
},
link: {
destination: t.linkUrl,
title: t.title
},
image: {
destination: t.imageUrl
},
codeBlock: {
info: t.language
},
bulletList: {
type: "list",
listData: {
type: "bullet"
}
},
orderedList: {
type: "list",
listData: {
type: "ordered",
start: t.order
}
},
listItem: {
type: "item",
listData: {
task: t.task,
checked: t.checked
}
},
tableHeadCell: {
type: "tableCell",
cellType: "head",
align: t.align
},
tableBodyCell: {
type: "tableCell",
cellType: "body",
align: t.align
},
customBlock: {
info: t.info
}
} [n],
s = o(o({}, r), i),
a = e.attrs,
l = a.htmlAttrs,
c = a.childrenHTML;
return l ? o(o({}, s), {
attrs: l,
childrenHTML: c
}) : s
}(e),
n = {
entering: !0,
leaf: !!dg(e) && e.isLeaf,
options: this.renderer.getOptions(),
getChildrenText: function() {
return dg(e) ? e.textContent : ""
},
skipChildren: function() {
return !1
}
},
r = this.convertors[e.type.name],
i = r(t, n, this.convertors),
s = aa()(i) ? i : [i];
return (pg(e.type.name) || e.attrs.htmlInline) && (n.entering = !1, s.push({
type: "text",
content: dg(e) ? e.textContent : ""
}), s = s.concat(r(t, n, this.convertors))), s
}, e.prototype.toDOMNode = function(e) {
var t = this.generateTokens(e),
n = [];
return t.forEach((function(e) {
return hg[e.type](e, n)
})), n[0]
}, e.prototype.getToDOMNode = function(e) {
return Ue(this.customConvertorKeys, e) ? this.toDOMNode.bind(this) : null
}, e
}(),
mg = null,
gg = null;
function vg(e, t) {
var n = t.syncScrollTop,
r = t.releaseEventBlock;
gg && clearTimeout(gg), n(e), gg = setTimeout((function() {
r()
}), 15)
}
var yg = function() {
function e(e, t, n) {
this.latestEditorScrollTop = null, this.latestPreviewScrollTop = null, this.blockedScroll = null, this.active = !0, this.timer = null;
var r = t.previewContent,
o = t.el;
this.previewRoot = r, this.previewEl = o, this.mdEditor = e, this.editorView = e.view, this.toastMark = e.getToastMark(), this.eventEmitter = n, this.addScrollSyncEvent()
}
return e.prototype.addScrollSyncEvent = function() {
var e = this;
this.eventEmitter.listen("afterPreviewRender", (function() {
e.clearTimer(), e.timer = setTimeout((function() {
e.syncPreviewScrollTop(!0)
}), 200)
})), this.eventEmitter.listen("scroll", (function(t, n) {
e.active && ("editor" === t && "editor" !== e.blockedScroll ? e.syncPreviewScrollTop() : "preview" === t && "preview" !== e.blockedScroll && e.syncEditorScrollTop(n))
})), this.eventEmitter.listen("toggleScrollSync", (function(t) {
e.active = t
}))
}, e.prototype.getMdNodeAtPos = function(e, t) {
var n = e.content.findIndex(t.pos).index;
return this.toastMark.findFirstNodeAtLine(n + 1)
}, e.prototype.getScrollTopByCaretPos = function() {
var e = this.mdEditor.getSelection(),
t = this.toastMark.findFirstNodeAtLine(e[0][0]),
n = this.previewEl.clientHeight,
r = bh(this.previewRoot, t).el,
o = (vh(r, this.previewRoot) || r.offsetTop) + r.clientHeight - .5 * n;
return this.latestEditorScrollTop = null, r.getBoundingClientRect().top - this.previewEl.getBoundingClientRect().top < n ? null : o
}, e.prototype.syncPreviewScrollTop = function(e) {
void 0 === e && (e = !1);
var t = this,
n = t.editorView,
r = t.previewEl,
o = t.previewRoot,
i = n.dom.getBoundingClientRect(),
s = i.left,
a = i.top,
l = n.posAtCoords({
left: s,
top: a
}),
c = n.state.doc,
u = this.getMdNodeAtPos(c, l);
if (u && ! function(e) {
var t = e.type;
return "htmlBlock" === t || "htmlInline" === t
}(u)) {
var d = r.scrollTop,
p = n.dom,
h = p.scrollTop,
f = p.scrollHeight,
m = p.clientHeight,
g = p.children,
v = f - h <= m + 18,
y = v ? r.scrollHeight : 0;
if (h && !v) {
if (e) {
var b = this.getScrollTopByCaretPos();
if (!b) return;
y = b
} else {
var w = bh(this.previewRoot, u),
k = w.el,
x = mh(c, w.mdNode, g),
C = x.height,
T = x.rect;
y = (vh(k, o) || k.offsetTop) + k.clientHeight * (a > T.top ? Math.min((a - T.top) / C, 1) : 0)
}
y = this.getResolvedScrollTop("editor", h, y, d), this.latestEditorScrollTop = h
}
y !== d && this.run("editor", y, d)
}
}, e.prototype.syncEditorScrollTop = function(e) {
var t = this,
n = t.toastMark,
r = t.editorView,
o = t.previewRoot,
i = t.previewEl,
s = r.dom,
a = r.state,
l = i.scrollTop,
c = i.clientHeight,
u = i.scrollHeight - l <= c,
d = s.scrollTop,
p = u ? s.scrollHeight : 0;
if (l && e && !u) {
if (e = function(e, t) {
for (; !e.getAttribute("data-nodeid") && e.parentElement !== t;) e = e.parentElement;
return e
}(e, o), !e.getAttribute("data-nodeid")) return;
var h = s.children,
f = Number(e.getAttribute("data-nodeid")),
m = bh(this.previewRoot, n.findNodeById(f)),
g = m.mdNode,
v = m.el;
p = h[Is(g) - 1].offsetTop;
var y = mh(a.doc, g, h).height,
b = xh(v, o, f),
w = b.nodeHeight;
p += function(e, t, n, r) {
return Math.min((e - t) / n, 1) * r
}(l, b.offsetTop, w, y), p = this.getResolvedScrollTop("preview", l, p, d), this.latestPreviewScrollTop = l
}
p !== d && this.run("preview", p, d)
}, e.prototype.getResolvedScrollTop = function(e, t, n, r) {
var o = "editor" === e ? this.latestEditorScrollTop : this.latestPreviewScrollTop;
return null === o ? n : o < t ? Math.max(n, r) : Math.min(n, r)
}, e.prototype.run = function(e, t, n) {
var r, o = this;
"editor" === e ? (r = this.previewEl, this.blockedScroll = "preview") : (r = this.editorView.dom, this.blockedScroll = "editor"),
function(e, t, n) {
var r = t - e,
o = Date.now(),
i = function() {
var s, a = (Date.now() - o) / 100;
mg && clearTimeout(mg), a < 1 ? (s = e + r * Math.cos((1 - a) * Math.PI / 2), vg(Math.ceil(s), n), mg = setTimeout(i, 1)) : (vg(t, n), mg = null)
};
i()
}(n, t, {
syncScrollTop: function(e) {
return r.scrollTop = e
},
releaseEventBlock: function() {
return o.blockedScroll = null
}
})
}, e.prototype.clearTimer = function() {
this.timer && (clearTimeout(this.timer), this.timer = null)
}, e.prototype.destroy = function() {
this.clearTimer(), this.eventEmitter.removeEventHandler("scroll"), this.eventEmitter.removeEventHandler("afterPreviewRender")
}, e
}(),
bg = {
getPopupInitialValues: function(e, t) {
return "link" === t.popupName ? {
linkText: e.getSelectedText()
} : {}
}
};
var wg = function() {
function e(e) {
var t = this;
this.initialHTML = e.el.innerHTML, e.el.innerHTML = "", this.options = ve()({
previewStyle: "tab",
previewHighlight: !0,
initialEditType: "markdown",
height: "300px",
minHeight: "200px",
language: "en-US",
useCommandShortcut: !0,
usageStatistics: !0,
toolbarItems: [
["heading", "bold", "italic", "strike"],
["hr", "quote"],
["ul", "ol", "task", "indent", "outdent"],
["table", "image", "link"],
["code", "codeblock"],
["scrollSync"]
],
hideModeSwitch: !1,
linkAttributes: null,
extendedAutolinks: !1,
customHTMLRenderer: null,
customMarkdownRenderer: null,
referenceDefinition: !1,
customHTMLSanitizer: null,
frontMatter: !1,
widgetRules: [],
theme: "light",
autofocus: !0
}, e);
var n = this.options,
r = n.customHTMLRenderer,
i = n.extendedAutolinks,
s = n.referenceDefinition,
a = n.frontMatter,
l = n.customMarkdownRenderer,
c = n.useCommandShortcut,
u = n.initialEditType,
d = n.widgetRules,
p = n.customHTMLSanitizer;
this.mode = u || "markdown", this.mdPreviewStyle = this.options.previewStyle, this.i18n = hf, this.i18n.setCode(this.options.language), this.eventEmitter = new Im, ta(d);
var h = Ge(this.options.linkAttributes);
this.pluginInfo = lg({
plugins: this.options.plugins,
eventEmitter: this.eventEmitter,
usageStatistics: this.options.usageStatistics,
instance: this
});
var f = this.pluginInfo,
m = f.toHTMLRenderers,
g = f.toMarkdownRenderers,
v = f.mdPlugins,
y = f.wwPlugins,
b = f.wwNodeViews,
w = f.mdCommands,
k = f.wwCommands,
x = f.markdownParsers,
C = {
linkAttributes: h,
customHTMLRenderer: nt(m, r),
extendedAutolinks: i,
referenceDefinition: s,
frontMatter: a,
sanitizer: p || rh
},
T = new fg(h, C.customHTMLRenderer),
M = function(e, t, n) {
var r = {
nodes: {},
marks: {}
};
return ["htmlBlock", "htmlInline"].forEach((function(o) {
e[o] && Object.keys(e[o]).forEach((function(e) {
var i = "htmlBlock" === o ? "nodes" : "marks";
nh(e), r[i][e] = lh[o](e, t, n)
}))
})), r
}(C.customHTMLRenderer, C.sanitizer, T);
this.toastMark = new _p("", {
disallowedHtmlBlockTags: ["br", "img"],
extendedAutolinks: i,
referenceDefinition: s,
disallowDeepHeading: !0,
frontMatter: a,
customParser: x
}), this.mdEditor = new Fc(this.eventEmitter, {
toastMark: this.toastMark,
useCommandShortcut: c,
mdPlugins: v
}), this.preview = new Mh(this.eventEmitter, o(o({}, C), {
isViewer: !1,
highlight: this.options.previewHighlight
})), this.wwEditor = new Nm(this.eventEmitter, {
toDOMAdaptor: T,
useCommandShortcut: c,
htmlSchemaMap: M,
linkAttributes: h,
wwPlugins: y,
wwNodeViews: b
}), this.convertor = new ag(this.wwEditor.getSchema(), o(o({}, g), l), dh(h, C.customHTMLRenderer), this.eventEmitter), this.setMinHeight(this.options.minHeight), this.setHeight(this.options.height), this.setMarkdown(this.options.initialValue, !1), this.options.placeholder && this.setPlaceholder(this.options.placeholder), this.options.initialValue || this.setHTML(this.initialHTML, !1), this.commandManager = new Pm(this.eventEmitter, this.mdEditor.commands, this.wwEditor.commands, (function() {
return t.mode
})), this.options.usageStatistics && Ie()("editor", "UA-129966929-1"), this.scrollSync = new yg(this.mdEditor, this.preview, this.eventEmitter), this.addInitEvent(), this.addInitCommand(w, k),
function(e) {
e.eventEmitter.listen("query", (function(t, n) {
return bg[t](e, n)
}))
}(this), this.options.hooks && me()(this.options.hooks, (function(e, n) {
return t.addHook(n, e)
})), this.options.events && me()(this.options.events, (function(e, n) {
return t.on(n, e)
})), this.eventEmitter.emit("load", this), this.moveCursorToStart(this.options.autofocus)
}
return e.prototype.addInitEvent = function() {
var e = this;
this.on("needChangeMode", this.changeMode.bind(this)), this.on("loadUI", (function() {
if ("auto" !== e.height) {
var t = Math.min(parseInt(e.minHeight, 10), parseInt(e.height, 10) - 75) + "px";
e.setMinHeight(t)
}
})),
function(e) {
e.listen("addImageBlobHook", (function(e, t) {
var n = new FileReader;
n.onload = function(e) {
var n = e.target;
return t(n.result)
}, n.readAsDataURL(e)
}))
}(this.eventEmitter)
}, e.prototype.addInitCommand = function(e, t) {
var n = this,
r = function(e, t) {
Object.keys(t).forEach((function(r) {
n.addCommand(e, r, t[r])
}))
};
this.addCommand("markdown", "toggleScrollSync", (function(e) {
return n.eventEmitter.emit("toggleScrollSync", e.active), !0
})), r("markdown", e), r("wysiwyg", t)
}, e.prototype.getCurrentModeEditor = function() {
return this.isMarkdownMode() ? this.mdEditor : this.wwEditor
}, e.factory = function(t) {
return t.viewer ? new ug(t) : new e(t)
}, e.setLanguage = function(e, t) {
hf.setLanguage(e, t)
}, e.prototype.changePreviewStyle = function(e) {
this.mdPreviewStyle !== e && (this.mdPreviewStyle = e, this.eventEmitter.emit("changePreviewStyle", e))
}, e.prototype.exec = function(e, t) {
this.commandManager.exec(e, t)
}, e.prototype.addCommand = function(e, t, n) {
var r = this;
this.commandManager.addCommand(e, t, (function(t) {
void 0 === t && (t = {});
var o = ("markdown" === e ? r.mdEditor : r.wwEditor).view;
n(t, o.state, o.dispatch, o)
}))
}, e.prototype.on = function(e, t) {
this.eventEmitter.listen(e, t)
}, e.prototype.off = function(e) {
this.eventEmitter.removeEventHandler(e)
}, e.prototype.addHook = function(e, t) {
this.eventEmitter.removeEventHandler(e), this.eventEmitter.listen(e, t)
}, e.prototype.removeHook = function(e) {
this.eventEmitter.removeEventHandler(e)
}, e.prototype.focus = function() {
this.getCurrentModeEditor().focus()
}, e.prototype.blur = function() {
this.getCurrentModeEditor().blur()
}, e.prototype.moveCursorToEnd = function(e) {
void 0 === e && (e = !0), this.getCurrentModeEditor().moveCursorToEnd(e)
}, e.prototype.moveCursorToStart = function(e) {
void 0 === e && (e = !0), this.getCurrentModeEditor().moveCursorToStart(e)
}, e.prototype.setMarkdown = function(e, t) {
if (void 0 === e && (e = ""), void 0 === t && (t = !0), this.mdEditor.setMarkdown(e, t), this.isWysiwygMode()) {
var n = this.toastMark.getRootNode(),
r = this.convertor.toWysiwygModel(n);
this.wwEditor.setModel(r, t)
}
}, e.prototype.setHTML = function(e, t) {
void 0 === e && (e = ""), void 0 === t && (t = !0);
var n = document.createElement("div");
n.innerHTML = function(e) {
var t = e.replace(/<p><br\s*\/*><\/p>/gi, "<p></p>"),
n = new RegExp(ma, "ig"),
r = t.match(n);
return null == r || r.forEach((function(e, n) {
if (va.test(e)) {
var o = ba;
if (n) {
var i = r[n - 1].match(fa);
if (i && !/br/i.test(i[1])) {
var s = i[1];
o = "</" + s + "><" + s + ">"
}
}
t = t.replace(va, o)
}
})), t
}(e);
var r = te.fromSchema(this.wwEditor.schema).parse(n);
this.isMarkdownMode() ? this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r), t) : this.wwEditor.setModel(r, t)
}, e.prototype.getMarkdown = function() {
return this.isMarkdownMode() ? this.mdEditor.getMarkdown() : this.convertor.toMarkdownText(this.wwEditor.getModel())
}, e.prototype.getHTML = function() {
var e = this;
this.eventEmitter.holdEventInvoke((function() {
if (e.isMarkdownMode()) {
var t = e.toastMark.getRootNode(),
n = e.convertor.toWysiwygModel(t);
e.wwEditor.setModel(n)
}
}));
var t = La(this.wwEditor.view.dom.innerHTML);
if (this.placeholder) {
var n = new RegExp('<span class="placeholder[^>]+>' + this.placeholder + "</span>", "i");
return t.replace(n, "")
}
return t
}, e.prototype.insertText = function(e) {
this.getCurrentModeEditor().replaceSelection(e)
}, e.prototype.setSelection = function(e, t) {
this.getCurrentModeEditor().setSelection(e, t)
}, e.prototype.replaceSelection = function(e, t, n) {
this.getCurrentModeEditor().replaceSelection(e, t, n)
}, e.prototype.deleteSelection = function(e, t) {
this.getCurrentModeEditor().deleteSelection(e, t)
}, e.prototype.getSelectedText = function(e, t) {
return this.getCurrentModeEditor().getSelectedText(e, t)
}, e.prototype.getRangeInfoOfNode = function(e) {
return this.getCurrentModeEditor().getRangeInfoOfNode(e)
}, e.prototype.addWidget = function(e, t, n) {
this.getCurrentModeEditor().addWidget(e, t, n)
}, e.prototype.replaceWithWidget = function(e, t, n) {
this.getCurrentModeEditor().replaceWithWidget(e, t, n)
}, e.prototype.setHeight = function(e) {
var t = this.options.el;
Me()(e) && ("auto" === e ? ke()(t, "auto-height") : Ce()(t, "auto-height"), this.setMinHeight(this.getMinHeight())), be()(t, {
height: e
}), this.height = e
}, e.prototype.getHeight = function() {
return this.height
}, e.prototype.setMinHeight = function(e) {
if (e !== this.minHeight) {
var t = this.height || this.options.height;
"auto" !== t && this.options.el.querySelector("." + xa("main")) && (e = Math.min(parseInt(e, 10), parseInt(t, 10) - 75) + "px");
var n = parseInt(e, 10);
this.minHeight = e, this.wwEditor.setMinHeight(n), this.mdEditor.setMinHeight(n), this.preview.setMinHeight(n)
}
}, e.prototype.getMinHeight = function() {
return this.minHeight
}, e.prototype.isMarkdownMode = function() {
return "markdown" === this.mode
}, e.prototype.isWysiwygMode = function() {
return "wysiwyg" === this.mode
}, e.prototype.isViewer = function() {
return !1
}, e.prototype.getCurrentPreviewStyle = function() {
return this.mdPreviewStyle
}, e.prototype.changeMode = function(e, t) {
if (this.mode !== e) {
if (this.mode = e, this.isWysiwygMode()) {
var n = this.toastMark.getRootNode(),
r = this.convertor.toWysiwygModel(n);
this.wwEditor.setModel(r)
} else {
r = this.wwEditor.getModel();
this.mdEditor.setMarkdown(this.convertor.toMarkdownText(r), !t)
}
if (this.eventEmitter.emit("removePopupWidget"), this.eventEmitter.emit("changeMode", e), !t) {
var o = this.convertor.getMappedPos();
this.focus(), this.isWysiwygMode() && Ee()(o) ? this.wwEditor.setSelection(o) : Array.isArray(o) && this.mdEditor.setSelection(o)
}
}
}, e.prototype.destroy = function() {
var e = this;
this.wwEditor.destroy(), this.mdEditor.destroy(), this.preview.destroy(), this.scrollSync.destroy(), this.eventEmitter.emit("destroy"), this.eventEmitter.getEvents().forEach((function(t, n) {
return e.off(n)
}))
}, e.prototype.hide = function() {
this.eventEmitter.emit("hide")
}, e.prototype.show = function() {
this.eventEmitter.emit("show")
}, e.prototype.setScrollTop = function(e) {
this.getCurrentModeEditor().setScrollTop(e)
}, e.prototype.getScrollTop = function() {
return this.getCurrentModeEditor().getScrollTop()
}, e.prototype.reset = function() {
this.wwEditor.setModel([]), this.mdEditor.setMarkdown("")
}, e.prototype.getSelection = function() {
return this.getCurrentModeEditor().getSelection()
}, e.prototype.setPlaceholder = function(e) {
this.placeholder = e, this.mdEditor.setPlaceholder(e), this.wwEditor.setPlaceholder(e)
}, e.prototype.getEditorElements = function() {
return {
mdEditor: this.mdEditor.getElement(),
mdPreview: this.preview.getElement(),
wwEditor: this.wwEditor.getElement()
}
}, e.prototype.convertPosToMatchEditorMode = function(e, t, n) {
var r, o;
void 0 === t && (t = e), void 0 === n && (n = this.mode);
var i = this.mdEditor.view.state.doc,
s = Array.isArray(e),
a = Array.isArray(t),
l = e,
c = t;
if (s !== a) throw new Error("Types of arguments must be same");
return "markdown" !== n || s || a ? "wysiwyg" === n && s && a && (l = (o = ol(i, e, t))[0], c = o[1]) : (l = (r = nl(i, e, t))[0], c = r[1]), [l, c]
}, e
}(),
kg = wg;
var xg = n(326),
Cg = n.n(xg),
Tg = function() {
function e(e) {
this.current = e, this.root = e, this.entering = !0
}
return e.prototype.walk = function() {
var e = this.entering,
t = this.current;
return t ? (e ? t.firstChild ? (this.current = t.firstChild, this.entering = !0) : this.entering = !1 : t === this.root ? this.current = null : t.next ? (this.current = t.next, this.entering = !0) : (this.current = t.parent, this.entering = !1), {
vnode: t,
entering: e
}) : null
}, e
}(),
Mg = function() {
function e(e, t, n) {
this.parent = null, this.old = null, this.firstChild = null, this.next = null, this.skip = !1, this.type = e, this.props = t, this.children = n, this.props.children = n, t.ref && (this.ref = t.ref, delete t.ref), t.key && (this.key = t.key, delete t.key)
}
return e.prototype.walker = function() {
return new Tg(this)
}, e.removalNodes = [], e
}();
function Sg(e, t) {
var n, r = e;
Cg()(e) || null == e ? r = null : (Me()(e) || Ee()(e)) && (n = String(e), r = new Mg("TEXT_NODE", {
nodeValue: n
}, [])), r && t.push(r)
}
var Eg = function(e) {
for (var t, n, r = arguments, o = 1, i = "", s = "", a = [0], l = function(e) {
1 === o && (e || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? a.push(e ? r[e] : i) : 3 === o && (e || i) ? (a[1] = e ? r[e] : i, o = 2) : 2 === o && "..." === i && e ? a[2] = it(a[2] || {}, r[e]) : 2 === o && i && !e ? (a[2] = a[2] || {})[i] = !0 : o >= 5 && (5 === o ? ((a[2] = a[2] || {})[n] = e ? i ? i + r[e] : r[e] : i, o = 6) : (e || i) && (a[2][n] += e ? i + r[e] : i)), i = ""
}, c = 0; c < e.length; c++) {
c && (1 === o && l(), l(c));
for (var u = 0; u < e[c].length; u++) t = e[c][u], 1 === o ? "<" === t ? (l(), a = [a, "", null], o = 3) : i += t : 4 === o ? "--" === i && ">" === t ? (o = 1, i = "") : i = t + i[0] : s ? t === s ? s = "" : i += t : '"' === t || "'" === t ? s = t : ">" === t ? (l(), o = 1) : o && ("=" === t ? (o = 5, n = i, i = "") : "/" === t && (o < 5 || ">" === e[c][u + 1]) ? (l(), 3 === o && (a = a[0]), o = a, (a = a[0]).push(this.apply(null, o.slice(1))), o = 0) : " " === t || "\t" === t || "\n" === t || "\r" === t ? (l(), o = 2) : i += t), 3 === o && "!--" === i && (o = 4, a = a[0])
}
return l(), a.length > 2 ? a.slice(1) : a[1]
}.bind((function(e, t) {
for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
var o = [];
return n.forEach((function(e) {
Array.isArray(e) ? e.forEach((function(e) {
Sg(e, o)
})) : Sg(e, o)
})), new Mg(e, t || {}, o)
})),
Ng = n(73),
Og = n.n(Ng);
function Dg(e) {
var t;
return "TEXT_NODE" === e.type ? t = document.createTextNode(e.props.nodeValue) : Rg(t = document.createElement(e.type), {}, e.props), t
}
function Ag(e, t) {
e.node ? t.removeChild(e.node) : Ag(e.firstChild, t)
}
function Lg(e, t, n) {
Object.keys(t).forEach((function(r) {
if (/^on/.test(r)) {
if (!n[r] || t[r] !== n[r]) {
var o = r.slice(2).toLowerCase();
e.removeEventListener(o, t[r])
}
} else "children" === r || n[r] || function(e) {
return (null == e ? void 0 : e.nodeType) === Node.TEXT_NODE
}(e) || e.removeAttribute(r)
})), Rg(e, t, n, (function(e) {
return !Ye(t[e], n[e])
}))
}
var Ig = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
function Rg(e, t, n, r) {
Object.keys(n).forEach((function(o) {
if (!r || r(o))
if (/^on/.test(o)) {
var i = o.slice(2).toLowerCase();
e.addEventListener(i, n[o])
} else "nodeValue" === o ? e[o] = n[o] : "style" === o && Og()(n[o]) ? function(e, t, n) {
t && Object.keys(t).forEach((function(t) {
e.style[t] = ""
}));
Object.keys(n).forEach((function(t) {
var r = n[t];
e.style[t] = Ee()(r) && !Ig.test(t) ? r + "px" : r
}))
}(e, t[o], n[o]) : "children" !== o && (!1 === n[o] ? e.removeAttribute(o) : e.setAttribute(o, n[o]))
}))
}
function Pg(e) {
if (Mg.removalNodes.forEach((function(e) {
return Fg(e)
})), e)
for (var t = void 0, n = e.walker(); t = n.walk();)
if (e = t.vnode, t.entering) Fg(e);
else if (Ga()(e.type)) {
var r = e.component;
if (!e.old && r.mounted && r.mounted(), e.old && r.updated) {
var o = r.prevProps || {};
r.updated(o)
}
}
}
function Bg(e) {
for (var t = e.parent; !t.node;) t = t.parent;
return t.node
}
function Fg(e) {
if (e && e.parent) {
if (e.node) {
var t = Bg(e);
"A" === e.effect ? t.appendChild(e.node) : "U" === e.effect && Lg(e.node, e.old.props, e.props)
}
if ("D" === e.effect)
for (var n = void 0, r = e.walker(); n = r.walk();)
if (e = n.vnode, !n.entering)
if (Ga()(e.type)) {
var o = e.component;
o.beforeDestroy && o.beforeDestroy()
} else {
Ag(e, t = Bg(e))
} e.ref && (e.component ? e.ref(e.component) : e.node && e.ref(e.node))
}
}
function Hg(e, t) {
var n = t.props,
r = t.component;
return r ? (r.prevProps = r.props, r.props = t.props, r) : new e(n)
}
function zg(e) {
for (var t = e; e && !e.skip;) {
if (Ga()(e.type)) {
var n = Hg(e.type, e);
n.vnode = e, e.component = n, e.props.children = e.children = [n.render()], qg(e)
} else e.node || (e.node = Dg(e)), qg(e);
if (e.firstChild) e = e.firstChild;
else {
for (; e && e.parent && !e.next && (e = e.parent) !== t;);
e = e.next
}
}
}
function qg(e) {
var t = e.children,
n = e.old ? e.old.firstChild : null,
r = null;
t.forEach((function(t, o) {
var i = function(e, t) {
return e && t && t.type === e.type && (!t.key || t.key === e.key)
}(n, t);
i && (t.old = n, t.parent = e, t.node = n.node, t.component = n.component, t.effect = "U"), t && !i && (t.old = null, t.parent = e, t.node = null, t.effect = "A"), n && !i && (Mg.removalNodes.push(n), n.effect = "D"), n && (n = n.next), 0 === o ? e.firstChild = t : t && (r.next = t), r = t
}));
var o = et(t);
if (!t.length)
for (; n;) Mg.removalNodes.push(n), n.effect = "D", n = n.next;
for (; n && o;) n && o.old !== n && (Mg.removalNodes.push(n), n.effect = "D", n = n.next)
}
function Vg(e, t) {
var n = new Mg(e.tagName.toLowerCase(), {}, [t]);
return n.node = e, Mg.removalNodes = [], zg(n), Pg(n),
function() {
return function(e) {
e.effect = "D", Mg.removalNodes = [e], Pg(), Mg.removalNodes = []
}(n.firstChild)
}
}
var jg, $g = function() {
function e(e) {
this.props = e, this.state = {}, this.refs = {}
}
return e.prototype.setState = function(e) {
var t = o(o({}, this.state), e);
Ye(this.state, t) || (this.state = t, function(e) {
var t = e.vnode;
t.effect = "U", t.old = t, t.next && (t.next.skip = !0), Mg.removalNodes = [], zg(t), Pg(t), t.next && (t.next.skip = !1)
}(this))
}, e
}(),
_g = function(e) {
function n(t) {
var n = e.call(this, t) || this;
return n.state = {
hide: !1
}, n
}
return t(n, e), n.prototype.show = function() {
this.setState({
hide: !1
})
}, n.prototype.hide = function() {
this.setState({
hide: !0
})
}, n.prototype.render = function() {
var e = this.props,
t = e.editorType,
n = e.eventEmitter;
return Eg(jg || (jg = s(['\n <div class="', '" style="display: ', '">\n <div\n class="tab-item', '"\n onClick=', "\n >\n ", '\n </div>\n <div\n class="tab-item', '"\n onClick=', "\n >\n ", "\n </div>\n </div>\n "], ['\n <div class="', '" style="display: ', '">\n <div\n class="tab-item', '"\n onClick=', "\n >\n ", '\n </div>\n <div\n class="tab-item', '"\n onClick=', "\n >\n ", "\n </div>\n </div>\n "])), xa("mode-switch"), this.state.hide ? "none" : "block", "markdown" === t ? " active" : "", (function() {
n.emit("needChangeMode", "markdown")
}), hf.get("Markdown"), "wysiwyg" === t ? " active" : "", (function() {
n.emit("needChangeMode", "wysiwyg")
}), hf.get("WYSIWYG"))
}, n
}($g),
Ug = n(423),
Wg = n.n(Ug),
Jg = function() {
if ("undefined" != typeof Map) return Map;
function e(e, t) {
var n = -1;
return e.some((function(e, r) {
return e[0] === t && (n = r, !0)
})), n
}
return function() {
function t() {
this.__entries__ = []
}
return Object.defineProperty(t.prototype, "size", {
get: function() {
return this.__entries__.length
},
enumerable: !0,
configurable: !0
}), t.prototype.get = function(t) {
var n = e(this.__entries__, t),
r = this.__entries__[n];
return r && r[1]
}, t.prototype.set = function(t, n) {
var r = e(this.__entries__, t);
~r ? this.__entries__[r][1] = n : this.__entries__.push([t, n])
}, t.prototype.delete = function(t) {
var n = this.__entries__,
r = e(n, t);
~r && n.splice(r, 1)
}, t.prototype.has = function(t) {
return !!~e(this.__entries__, t)
}, t.prototype.clear = function() {
this.__entries__.splice(0)
}, t.prototype.forEach = function(e, t) {
void 0 === t && (t = null);
for (var n = 0, r = this.__entries__; n < r.length; n++) {
var o = r[n];
e.call(t, o[1], o[0])
}
}, t
}()
}(),
Gg = "undefined" != typeof window && "undefined" != typeof document && window.document === document,
Kg = void 0 !== n.g && n.g.Math === Math ? n.g : "undefined" != typeof self && self.Math === Math ? self : "undefined" != typeof window && window.Math === Math ? window : Function("return this")(),
Zg = "function" == typeof requestAnimationFrame ? requestAnimationFrame.bind(Kg) : function(e) {
return setTimeout((function() {
return e(Date.now())
}), 1e3 / 60)
};
var Xg = ["top", "right", "bottom", "left", "width", "height", "size", "weight"],
Qg = "undefined" != typeof MutationObserver,
Yg = function() {
function e() {
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = function(e, t) {
var n = !1,
r = !1,
o = 0;
function i() {
n && (n = !1, e()), r && a()
}
function s() {
Zg(i)
}
function a() {
var e = Date.now();
if (n) {
if (e - o < 2) return;
r = !0
} else n = !0, r = !1, setTimeout(s, t);
o = e
}
return a
}(this.refresh.bind(this), 20)
}
return e.prototype.addObserver = function(e) {
~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_()
}, e.prototype.removeObserver = function(e) {
var t = this.observers_,
n = t.indexOf(e);
~n && t.splice(n, 1), !t.length && this.connected_ && this.disconnect_()
}, e.prototype.refresh = function() {
this.updateObservers_() && this.refresh()
}, e.prototype.updateObservers_ = function() {
var e = this.observers_.filter((function(e) {
return e.gatherActive(), e.hasActive()
}));
return e.forEach((function(e) {
return e.broadcastActive()
})), e.length > 0
}, e.prototype.connect_ = function() {
Gg && !this.connected_ && (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Qg ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
attributes: !0,
childList: !0,
characterData: !0,
subtree: !0
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0)
}, e.prototype.disconnect_ = function() {
Gg && this.connected_ && (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1)
}, e.prototype.onTransitionEnd_ = function(e) {
var t = e.propertyName,
n = void 0 === t ? "" : t;
Xg.some((function(e) {
return !!~n.indexOf(e)
})) && this.refresh()
}, e.getInstance = function() {
return this.instance_ || (this.instance_ = new e), this.instance_
}, e.instance_ = null, e
}(),
ev = function(e, t) {
for (var n = 0, r = Object.keys(t); n < r.length; n++) {
var o = r[n];
Object.defineProperty(e, o, {
value: t[o],
enumerable: !1,
writable: !1,
configurable: !0
})
}
return e
},
tv = function(e) {
return e && e.ownerDocument && e.ownerDocument.defaultView || Kg
},
nv = lv(0, 0, 0, 0);
function rv(e) {
return parseFloat(e) || 0
}
function ov(e) {
for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
return t.reduce((function(t, n) {
return t + rv(e["border-" + n + "-width"])
}), 0)
}
function iv(e) {
var t = e.clientWidth,
n = e.clientHeight;
if (!t && !n) return nv;
var r = tv(e).getComputedStyle(e),
o = function(e) {
for (var t = {}, n = 0, r = ["top", "right", "bottom", "left"]; n < r.length; n++) {
var o = r[n],
i = e["padding-" + o];
t[o] = rv(i)
}
return t
}(r),
i = o.left + o.right,
s = o.top + o.bottom,
a = rv(r.width),
l = rv(r.height);
if ("border-box" === r.boxSizing && (Math.round(a + i) !== t && (a -= ov(r, "left", "right") + i), Math.round(l + s) !== n && (l -= ov(r, "top", "bottom") + s)), ! function(e) {
return e === tv(e).document.documentElement
}(e)) {
var c = Math.round(a + i) - t,
u = Math.round(l + s) - n;
1 !== Math.abs(c) && (a -= c), 1 !== Math.abs(u) && (l -= u)
}
return lv(o.left, o.top, a, l)
}
var sv = "undefined" != typeof SVGGraphicsElement ? function(e) {
return e instanceof tv(e).SVGGraphicsElement
} : function(e) {
return e instanceof tv(e).SVGElement && "function" == typeof e.getBBox
};
function av(e) {
return Gg ? sv(e) ? function(e) {
var t = e.getBBox();
return lv(0, 0, t.width, t.height)
}(e) : iv(e) : nv
}
function lv(e, t, n, r) {
return {
x: e,
y: t,
width: n,
height: r
}
}
var cv = function() {
function e(e) {
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = lv(0, 0, 0, 0), this.target = e
}
return e.prototype.isActive = function() {
var e = av(this.target);
return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight
}, e.prototype.broadcastRect = function() {
var e = this.contentRect_;
return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e
}, e
}(),
uv = function(e, t) {
var n = function(e) {
var t = e.x,
n = e.y,
r = e.width,
o = e.height,
i = "undefined" != typeof DOMRectReadOnly ? DOMRectReadOnly : Object,
s = Object.create(i.prototype);
return ev(s, {
x: t,
y: n,
width: r,
height: o,
top: n,
right: t + r,
bottom: o + n,
left: t
}), s
}(t);
ev(this, {
target: e,
contentRect: n
})
},
dv = function() {
function e(e, t, n) {
if (this.activeObservations_ = [], this.observations_ = new Jg, "function" != typeof e) throw new TypeError("The callback provided as parameter 1 is not a function.");
this.callback_ = e, this.controller_ = t, this.callbackCtx_ = n
}
return e.prototype.observe = function(e) {
if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
if ("undefined" != typeof Element && Element instanceof Object) {
if (!(e instanceof tv(e).Element)) throw new TypeError('parameter 1 is not of type "Element".');
var t = this.observations_;
t.has(e) || (t.set(e, new cv(e)), this.controller_.addObserver(this), this.controller_.refresh())
}
}, e.prototype.unobserve = function(e) {
if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
if ("undefined" != typeof Element && Element instanceof Object) {
if (!(e instanceof tv(e).Element)) throw new TypeError('parameter 1 is not of type "Element".');
var t = this.observations_;
t.has(e) && (t.delete(e), t.size || this.controller_.removeObserver(this))
}
}, e.prototype.disconnect = function() {
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this)
}, e.prototype.gatherActive = function() {
var e = this;
this.clearActive(), this.observations_.forEach((function(t) {
t.isActive() && e.activeObservations_.push(t)
}))
}, e.prototype.broadcastActive = function() {
if (this.hasActive()) {
var e = this.callbackCtx_,
t = this.activeObservations_.map((function(e) {
return new uv(e.target, e.broadcastRect())
}));
this.callback_.call(e, t, e), this.clearActive()
}
}, e.prototype.clearActive = function() {
this.activeObservations_.splice(0)
}, e.prototype.hasActive = function() {
return this.activeObservations_.length > 0
}, e
}(),
pv = "undefined" != typeof WeakMap ? new WeakMap : new Jg,
hv = function e(t) {
if (!(this instanceof e)) throw new TypeError("Cannot call a class as a function.");
if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
var n = Yg.getInstance(),
r = new dv(t, n, this);
pv.set(this, r)
};
["observe", "unobserve", "disconnect"].forEach((function(e) {
hv.prototype[e] = function() {
var t;
return (t = pv.get(this))[e].apply(t, arguments)
}
}));
var fv, mv, gv, vv, yv, bv, wv, kv, xv, Cv, Tv, Mv, Sv, Ev, Nv, Ov, Dv = void 0 !== Kg.ResizeObserver ? Kg.ResizeObserver : hv,
Av = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), n.prototype.execCommand = function(e) {
var t = Oa(e.target, "li");
this.props.execCommand("heading", {
level: Number(t.getAttribute("data-level"))
})
}, n.prototype.render = function() {
var e = this;
return Eg(mv || (mv = s(["\n <ul\n onClick=", '\n aria-role="menu"\n aria-label="', '"\n >\n ', '\n <li data-type="Paragraph" aria-role="menuitem">\n <div>', "</div>\n </li>\n </ul>\n "], ["\n <ul\n onClick=", '\n aria-role="menu"\n aria-label="', '"\n >\n ', '\n <li data-type="Paragraph" aria-role="menuitem">\n <div>', "</div>\n </li>\n </ul>\n "])), (function(t) {
return e.execCommand(t)
}), hf.get("Headings"), [1, 2, 3, 4, 5, 6].map((function(e) {
return Eg(fv || (fv = s(['\n <li data-level="', '" data-type="Heading" aria-role="menuitem">\n <', ">", " ", "</$>\n </li>\n "], ['\n <li data-level="', '" data-type="Heading" aria-role="menuitem">\n <', ">", " ", "</$>\n </li>\n "])), e, "h" + e, hf.get("Heading"), e)
})), hf.get("Paragraph"))
}, n
}($g),
Lv = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), n.prototype.toggleTab = function(e, t) {
this.props.onClick(e, t)
}, n.prototype.render = function() {
var e = this;
return Eg(vv || (vv = s(['\n <div class="', '" aria-role="tabpanel">\n ', "\n </div>\n "], ['\n <div class="', '" aria-role="tabpanel">\n ', "\n </div>\n "])), xa("tabs"), this.props.tabs.map((function(t) {
var n = t.name,
r = t.text,
o = e.props.activeTab === n;
return Eg(gv || (gv = s(['\n <div\n class="tab-item', '"\n onClick=', '\n aria-role="tab"\n aria-label="', '"\n aria-selected="', '"\n tabindex="', '"\n >\n ', "\n </div>\n "], ['\n <div\n class="tab-item', '"\n onClick=', '\n aria-role="tab"\n aria-label="', '"\n aria-selected="', '"\n tabindex="', '"\n >\n ', "\n </div>\n "])), o ? " active" : "", (function(t) {
return e.toggleTab(t, n)
}), hf.get(r), o ? "true" : "false", o ? "0" : "-1", hf.get(r))
})))
}, n
}($g),
Iv = function(e) {
function n(t) {
var n = e.call(this, t) || this;
return n.initialize = function(e) {
void 0 === e && (e = "file");
var t = n.refs.url;
t.value = "", n.refs.altText.value = "", n.refs.file.value = "", Ce()(t, "wrong"), n.setState({
activeTab: e,
file: null,
fileNameElClassName: ""
})
}, n.execCommand = function() {
"file" === n.state.activeTab ? n.emitAddImageBlob() : n.emitAddImage()
}, n.toggleTab = function(e, t) {
t !== n.state.activeTab && n.initialize(t)
}, n.showFileSelectBox = function() {
n.refs.file.click()
}, n.changeFile = function(e) {
var t = e.target.files;
(null == t ? void 0 : t.length) && n.setState({
file: t[0]
})
}, n.state = {
activeTab: "file",
file: null,
fileNameElClassName: ""
}, n.tabs = [{
name: "file",
text: "File"
}, {
name: "url",
text: "URL"
}], n
}
return t(n, e), n.prototype.emitAddImageBlob = function() {
var e = this,
t = this.refs.file.files,
n = this.refs.altText,
r = " wrong";
if (null == t ? void 0 : t.length) {
r = "";
var o = t.item(0);
this.props.eventEmitter.emit("addImageBlobHook", o, (function(t, r) {
return e.props.execCommand("addImage", {
imageUrl: t,
altText: r || n.value
})
}), "ui")
}
this.setState({
fileNameElClassName: r
})
}, n.prototype.emitAddImage = function() {
var e = this.refs.url,
t = this.refs.altText,
n = e.value,
r = t.value || "image";
Ce()(e, "wrong"), n.length ? n && this.props.execCommand("addImage", {
imageUrl: n,
altText: r
}) : ke()(e, "wrong")
}, n.prototype.preventSelectStart = function(e) {
e.preventDefault()
}, n.prototype.updated = function() {
this.props.show || this.initialize()
}, n.prototype.render = function() {
var e = this,
t = this.state,
n = t.activeTab,
r = t.file,
o = t.fileNameElClassName;
return Eg(yv || (yv = s(['\n <div aria-label="', '">\n <', " tabs=", " activeTab=", " onClick=", ' />\n <div style="display:', '">\n <label for="toastuiImageUrlInput">', '</label>\n <input\n id="toastuiImageUrlInput"\n type="text"\n ref=', '\n />\n </div>\n <div style="display:', ';position: relative;">\n <label for="toastuiImageFileInput">', '</label>\n <span\n class="', "", '"\n onClick=', "\n onSelectstart=", "\n >\n ", '\n </span>\n <button\n type="button"\n class="', '"\n onClick=', "\n >\n ", '\n </button>\n <input\n id="toastuiImageFileInput"\n type="file"\n accept="image/*"\n onChange=', "\n ref=", '\n />\n </div>\n <label for="toastuiAltTextInput">', '</label>\n <input\n id="toastuiAltTextInput"\n type="text"\n ref=', '\n />\n <div class="', '">\n <button type="button" class="', '" onClick=', ">\n ", '\n </button>\n <button type="button" class="', '" onClick=', ">\n ", "\n </button>\n </div>\n </div>\n "], ['\n <div aria-label="', '">\n <', " tabs=", " activeTab=", " onClick=", ' />\n <div style="display:', '">\n <label for="toastuiImageUrlInput">', '</label>\n <input\n id="toastuiImageUrlInput"\n type="text"\n ref=', '\n />\n </div>\n <div style="display:', ';position: relative;">\n <label for="toastuiImageFileInput">', '</label>\n <span\n class="', "", '"\n onClick=', "\n onSelectstart=", "\n >\n ", '\n </span>\n <button\n type="button"\n class="', '"\n onClick=', "\n >\n ", '\n </button>\n <input\n id="toastuiImageFileInput"\n type="file"\n accept="image/*"\n onChange=', "\n ref=", '\n />\n </div>\n <label for="toastuiAltTextInput">', '</label>\n <input\n id="toastuiAltTextInput"\n type="text"\n ref=', '\n />\n <div class="', '">\n <button type="button" class="', '" onClick=', ">\n ", '\n </button>\n <button type="button" class="', '" onClick=', ">\n ", "\n </button>\n </div>\n </div>\n "])), hf.get("Insert image"), Lv, this.tabs, n, this.toggleTab, "url" === n ? "block" : "none", hf.get("Image URL"), (function(t) {
return e.refs.url = t
}), "file" === n ? "block" : "none", hf.get("Select image file"), xa("file-name"), r ? " has-file" : o, this.showFileSelectBox, this.preventSelectStart, r ? r.name : hf.get("No file"), xa("file-select-button"), this.showFileSelectBox, hf.get("Choose a file"), this.changeFile, (function(t) {
return e.refs.file = t
}), hf.get("Description"), (function(t) {
return e.refs.altText = t
}), xa("button-container"), xa("close-button"), this.props.hidePopup, hf.get("Cancel"), xa("ok-button"), this.execCommand, hf.get("OK"))
}, n
}($g),
Rv = function(e) {
function n() {
var t = null !== e && e.apply(this, arguments) || this;
return t.execCommand = function() {
var e = t.refs.url,
n = t.refs.text;
(Ce()(e, "wrong"), Ce()(n, "wrong"), e.value.length < 1) ? ke()(e, "wrong"): Oe()(t.props.initialValues.linkUrl) && n.value.length < 1 ? ke()(n, "wrong") : t.props.execCommand("addLink", {
linkUrl: e.value,
linkText: n.value
})
}, t
}
return t(n, e), n.prototype.initialize = function() {
var e = this.props.initialValues,
t = e.linkUrl,
n = e.linkText,
r = this.refs.url,
o = this.refs.text;
Ce()(r, "wrong"), Ce()(o, "wrong", "disabled"), o.removeAttribute("disabled"), t && (ke()(o, "disabled"), o.setAttribute("disabled", "disabled")), r.value = t || "", o.value = n || ""
}, n.prototype.mounted = function() {
this.initialize()
}, n.prototype.updated = function(e) {
!e.show && this.props.show && this.initialize()
}, n.prototype.render = function() {
var e = this;
return Eg(bv || (bv = s(['\n <div aria-label="', '">\n <label for="toastuiLinkUrlInput">', '</label>\n <input\n id="toastuiLinkUrlInput"\n type="text"\n ref=', '\n />\n <label for="toastuiLinkTextInput">', '</label>\n <input\n id="toastuiLinkTextInput"\n type="text"\n ref=', '\n />\n <div class="', '">\n <button type="button" class="', '" onClick=', ">\n ", '\n </button>\n <button type="button" class="', '" onClick=', ">\n ", "\n </button>\n </div>\n </div>\n "], ['\n <div aria-label="', '">\n <label for="toastuiLinkUrlInput">', '</label>\n <input\n id="toastuiLinkUrlInput"\n type="text"\n ref=', '\n />\n <label for="toastuiLinkTextInput">', '</label>\n <input\n id="toastuiLinkTextInput"\n type="text"\n ref=', '\n />\n <div class="', '">\n <button type="button" class="', '" onClick=', ">\n ", '\n </button>\n <button type="button" class="', '" onClick=', ">\n ", "\n </button>\n </div>\n </div>\n "])), hf.get("Insert link"), hf.get("URL"), (function(t) {
return e.refs.url = t
}), hf.get("Link text"), (function(t) {
return e.refs.text = t
}), xa("button-container"), xa("close-button"), this.props.hidePopup, hf.get("Cancel"), xa("ok-button"), this.execCommand, hf.get("OK"))
}, n
}($g),
Pv = function(e) {
function n(t) {
var n = e.call(this, t) || this;
return n.extendSelectionRange = function(e) {
var t = e.pageX,
r = e.pageY,
i = t - n.offsetRect.left,
s = r - n.offsetRect.top,
a = n.getSelectionRangeByOffset(i, s);
n.setState(o({}, a))
}, n.execCommand = function() {
n.props.execCommand("addTable", {
rowCount: n.state.rowIdx + 1,
columnCount: n.state.colIdx + 1
})
}, n.state = {
rowIdx: -1,
colIdx: -1
}, n
}
return t(n, e), n.prototype.getDescription = function() {
return -1 === this.state.colIdx ? "" : this.state.colIdx + 1 + " x " + (this.state.rowIdx + 1)
}, n.prototype.getBoundByRange = function(e, t) {
return {
width: 20 * (e + 1),
height: 20 * (t + 1)
}
}, n.prototype.getRangeByOffset = function(e, t) {
return {
colIdx: Math.floor(e / 20),
rowIdx: Math.floor(t / 20)
}
}, n.prototype.getTableRange = function() {
var e = this.state,
t = e.colIdx,
n = e.rowIdx,
r = Math.max(t, 5),
o = Math.max(n, 5);
return t >= 5 && r < 9 && (r += 1), n >= 5 && o < 14 && (o += 1), {
colIdx: r + 1,
rowIdx: o + 1
}
}, n.prototype.getSelectionAreaBound = function() {
var e = this.getBoundByRange(this.state.colIdx, this.state.rowIdx),
t = e.width,
n = e.height;
return t || n ? {
width: t - 1,
height: n - 1,
display: "block"
} : {
display: "none"
}
}, n.prototype.getSelectionRangeByOffset = function(e, t) {
var n = this.getRangeByOffset(e, t);
return n.rowIdx = Math.min(Math.max(n.rowIdx, 1), 14), n.colIdx = Math.min(Math.max(n.colIdx, 1), 9), n
}, n.prototype.updated = function() {
if (this.props.show) {
if (-1 === this.state.colIdx && -1 === this.state.rowIdx) {
var e = this.refs.tableEl.getBoundingClientRect(),
t = e.left,
n = e.top;
this.offsetRect = {
left: window.pageXOffset + t,
top: window.pageYOffset + n
}
}
} else this.setState({
colIdx: -1,
rowIdx: -1
})
}, n.prototype.createTableArea = function(e) {
for (var t = e.colIdx, n = e.rowIdx, r = [], o = 0; o < n; o += 1) {
for (var i = [], a = 0; a < t; a += 1) {
var l = xa("table-cell") + (o > 0 ? "" : " header");
i.push(Eg(wv || (wv = s(['<div class="', '"></div>'], ['<div class="', '"></div>'])), l))
}
r.push(Eg(kv || (kv = s(['<div class="', '">', "</div>"], ['<div class="', '">', "</div>"])), xa("table-row"), i))
}
return Eg(xv || (xv = s(['<div class="', '">', "</div>"], ['<div class="', '">', "</div>"])), xa("table"), r)
}, n.prototype.render = function() {
var e = this,
t = this.getTableRange(),
n = this.getSelectionAreaBound();
return Eg(Cv || (Cv = s(['\n <div aria-label="', '">\n <div\n class="', '"\n ref=', "\n onMousemove=", "\n onClick=", "\n >\n ", '\n <div class="', '" style=', '></div>\n </div>\n <p class="', '">', "</p>\n </div>\n "], ['\n <div aria-label="', '">\n <div\n class="', '"\n ref=', "\n onMousemove=", "\n onClick=", "\n >\n ", '\n <div class="', '" style=', '></div>\n </div>\n <p class="', '">', "</p>\n </div>\n "])), hf.get("Insert table"), xa("table-selection"), (function(t) {
return e.refs.tableEl = t
}), this.extendSelectionRange, this.execCommand, this.createTableArea(t), xa("table-selection-layer"), n, xa("table-description"), this.getDescription())
}, n
}($g),
Bv = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), n.prototype.mounted = function() {
this.refs.el.appendChild(this.props.body)
}, n.prototype.updated = function(e) {
this.refs.el.replaceChild(this.props.body, e.body)
}, n.prototype.render = function() {
var e = this;
return Eg(Tv || (Tv = s(["<div ref=", "></div>"], ["<div ref=", "></div>"])), (function(t) {
return e.refs.el = t
}))
}, n
}($g);
function Fv(e) {
return Me()(e) ? function(e) {
var t;
switch (e) {
case "heading":
t = {
name: "heading",
className: "heading",
tooltip: hf.get("Headings"),
state: "heading"
};
break;
case "bold":
t = {
name: "bold",
className: "bold",
command: "bold",
tooltip: hf.get("Bold"),
state: "strong"
};
break;
case "italic":
t = {
name: "italic",
className: "italic",
command: "italic",
tooltip: hf.get("Italic"),
state: "emph"
};
break;
case "strike":
t = {
name: "strike",
className: "strike",
command: "strike",
tooltip: hf.get("Strike"),
state: "strike"
};
break;
case "hr":
t = {
name: "hr",
className: "hrline",
command: "hr",
tooltip: hf.get("Line"),
state: "thematicBreak"
};
break;
case "quote":
t = {
name: "quote",
className: "quote",
command: "blockQuote",
tooltip: hf.get("Blockquote"),
state: "blockQuote"
};
break;
case "ul":
t = {
name: "ul",
className: "bullet-list",
command: "bulletList",
tooltip: hf.get("Unordered list"),
state: "bulletList"
};
break;
case "ol":
t = {
name: "ol",
className: "ordered-list",
command: "orderedList",
tooltip: hf.get("Ordered list"),
state: "orderedList"
};
break;
case "task":
t = {
name: "task",
className: "task-list",
command: "taskList",
tooltip: hf.get("Task"),
state: "taskList"
};
break;
case "table":
t = {
name: "table",
className: "table",
tooltip: hf.get("Insert table"),
state: "table"
};
break;
case "image":
t = {
name: "image",
className: "image",
tooltip: hf.get("Insert image")
};
break;
case "link":
t = {
name: "link",
className: "link",
tooltip: hf.get("Insert link")
};
break;
case "code":
t = {
name: "code",
className: "code",
command: "code",
tooltip: hf.get("Code"),
state: "code"
};
break;
case "codeblock":
t = {
name: "codeblock",
className: "codeblock",
command: "codeBlock",
tooltip: hf.get("Insert CodeBlock"),
state: "codeBlock"
};
break;
case "indent":
t = {
name: "indent",
className: "indent",
command: "indent",
tooltip: hf.get("Indent"),
state: "indent"
};
break;
case "outdent":
t = {
name: "outdent",
className: "outdent",
command: "outdent",
tooltip: hf.get("Outdent"),
state: "outdent"
};
break;
case "scrollSync":
t = function() {
var e = document.createElement("label"),
t = document.createElement("input"),
n = document.createElement("span");
e.className = "scroll-sync active", t.type = "checkbox", t.checked = !0, n.className = "switch";
var r = function(n) {
return t.addEventListener("change", (function(t) {
var r = t.target.checked;
r ? ke()(e, "active") : Ce()(e, "active"), n("toggleScrollSync", {
active: r
})
}))
};
return e.appendChild(t), e.appendChild(n), {
name: "scrollSync",
el: e,
onMounted: r
}
}();
break;
case "more":
t = {
name: "more",
className: "more",
tooltip: hf.get("More")
}
}
"scrollSync" !== t.name && (t.className += " " + xa("toolbar-icons"));
return t
}(e) : e
}
function Hv(e, t) {
var n = t.el,
r = t.pos,
i = t.popup,
a = t.initialValues;
switch (e) {
case "heading":
return {
render: function(e) {
return Eg(Mv || (Mv = s(["<", " ...", " />"], ["<", " ...", " />"])), Av, e)
}, className: xa("popup-add-heading"), fromEl: n, pos: r
};
case "link":
return {
render: function(e) {
return Eg(Sv || (Sv = s(["<", " ...", " />"], ["<", " ...", " />"])), Rv, e)
}, className: xa("popup-add-link"), fromEl: n, pos: r, initialValues: a
};
case "image":
return {
render: function(e) {
return Eg(Ev || (Ev = s(["<", " ...", " />"], ["<", " ...", " />"])), Iv, e)
}, className: xa("popup-add-image"), fromEl: n, pos: r
};
case "table":
return {
render: function(e) {
return Eg(Nv || (Nv = s(["<", " ...", " />"], ["<", " ...", " />"])), Pv, e)
}, className: xa("popup-add-table"), fromEl: n, pos: r
};
case "customPopupBody":
return i ? o({
render: function(e) {
return Eg(Ov || (Ov = s(["<", " ...", " body=", " />"], ["<", " ...", " body=", " />"])), Bv, e, i.body)
},
fromEl: n,
pos: r
}, i) : null;
default:
return null
}
}
function zv(e) {
e.hidden = e.length === e.filter((function(e) {
return e.hidden
})).length
}
function qv(e, t) {
return e.reduce((function(e, n) {
e.push(n.map((function(e) {
return function(e) {
return e.hidden = "scrollSync" === e.name && t, e
}(Fv(e))
})));
var r = e[(e.length || 1) - 1];
return r && zv(r), e
}), [])
}
var Vv, jv, $v = function(e) {
function n() {
var t = null !== e && e.apply(this, arguments) || this;
return t.handleMousedown = function(e) {
Oa(e.target, "." + xa("popup")) || Oa(e.target, t.props.info.fromEl) || t.props.hidePopup()
}, t
}
return t(n, e), n.prototype.mounted = function() {
document.addEventListener("mousedown", this.handleMousedown), this.props.eventEmitter.listen("closePopup", this.props.hidePopup)
}, n.prototype.beforeDestroy = function() {
document.removeEventListener("mousedown", this.handleMousedown)
}, n.prototype.updated = function(e) {
var t = this.props,
n = t.show,
r = t.info;
if (n && r.pos && e.show !== n) {
var i = o({}, r.pos),
s = this.refs.el.offsetWidth,
a = Oa(this.refs.el, "." + xa("toolbar")).offsetWidth;
i.left + s >= a && (i.left = a - s - 20), Ye(this.state.popupPos, i) || this.setState({
popupPos: i
})
}
}, n.prototype.render = function() {
var e = this,
t = this.props,
n = t.info,
r = t.show,
i = t.hidePopup,
a = t.eventEmitter,
l = t.execCommand,
c = n || {},
u = c.className,
d = void 0 === u ? "" : u,
p = c.style,
h = c.render,
f = c.initialValues,
m = void 0 === f ? {} : f,
g = o(o({
display: r ? "block" : "none"
}, p), this.state.popupPos);
return Eg(Vv || (Vv = s(['\n <div\n class="', " ", '"\n style=', "\n ref=", '\n aria-role="dialog"\n >\n <div class="', '">\n ', "\n </div>\n </div>\n "], ['\n <div\n class="', " ", '"\n style=', "\n ref=", '\n aria-role="dialog"\n >\n <div class="', '">\n ', "\n </div>\n </div>\n "])), xa("popup"), d, g, (function(t) {
return e.refs.el = t
}), xa("popup-body"), h && h({
eventEmitter: a,
show: r,
hidePopup: i,
execCommand: l,
initialValues: m
}))
}, n
}($g);
function _v(e) {
return function(n) {
function r(e) {
var t = n.call(this, e) || this;
return t.showTooltip = function(e) {
var n = t.props.item.tooltip;
if (!t.props.disabled && n) {
var r = t.getBound(e),
o = r.left + 6 + "px",
i = r.top + 6 + "px";
be()(t.props.tooltipRef.current, {
display: "block",
left: o,
top: i
}), t.props.tooltipRef.current.querySelector(".text").textContent = n
}
}, t.hideTooltip = function() {
be()(t.props.tooltipRef.current, "display", "none")
}, t.state = {
active: !1,
disabled: e.disabled
}, t.addEvent(), t
}
return t(r, n), r.prototype.addEvent = function() {
var e = this,
t = this.props,
n = t.item,
r = t.eventEmitter;
n.state && r.listen("changeToolbarState", (function(t) {
var r, o = null !== (r = t.toolbarState[n.state]) && void 0 !== r ? r : {},
i = o.active,
s = o.disabled;
e.setState({
active: !!i,
disabled: null != s ? s : e.props.disabled
})
}))
}, r.prototype.getBound = function(e) {
var t = Da(e, Oa(e, "." + xa("toolbar"))),
n = t.offsetLeft,
r = t.offsetTop;
return {
left: n,
top: e.offsetHeight + r
}
}, r.prototype.render = function() {
return Eg(jv || (jv = s(["\n <", "\n ...", "\n active=", "\n showTooltip=", "\n hideTooltip=", "\n getBound=", "\n disabled=", "\n />\n "], ["\n <", "\n ...", "\n active=", "\n showTooltip=", "\n hideTooltip=", "\n getBound=", "\n disabled=", "\n />\n "])), e, this.props, this.state.active, this.showTooltip, this.hideTooltip, this.getBound, this.state.disabled || this.props.disabled)
}, r
}($g)
}
var Uv, Wv, Jv, Gv, Kv, Zv, Xv, Qv, Yv, ey, ty, ny, ry, oy, iy = function(e) {
function n() {
var t = null !== e && e.apply(this, arguments) || this;
return t.showTooltip = function() {
t.props.showTooltip(t.refs.el)
}, t.execCommand = function() {
var e = t.props,
n = e.item,
r = e.execCommand,
o = e.setPopupInfo,
i = e.getBound,
s = e.eventEmitter,
a = n.command,
l = n.name,
c = n.popup;
if (a) r(a);
else {
var u = c ? "customPopupBody" : l,
d = s.emit("query", "getPopupInitialValues", {
popupName: u
})[0],
p = Hv(u, {
el: t.refs.el,
pos: i(t.refs.el),
popup: c,
initialValues: d
});
p && o(p)
}
}, t
}
return t(n, e), n.prototype.mounted = function() {
this.setItemWidth()
}, n.prototype.updated = function(e) {
e.item.name !== this.props.item.name && this.setItemWidth()
}, n.prototype.setItemWidth = function() {
var e = this.props,
t = e.setItemWidth,
n = e.item;
t && t(n.name, Na(this.refs.el) + (n.hidden ? 80 : 0))
}, n.prototype.render = function() {
var e = this,
t = this.props,
n = t.hideTooltip,
r = t.disabled,
i = t.item,
a = t.active,
l = o({
display: i.hidden ? "none" : null
}, i.style),
c = (i.className || "") + (a ? " active" : "");
return Eg(Uv || (Uv = s(["\n <button\n ref=", '\n type="button"\n style=', "\n class=", "\n onClick=", "\n onMouseover=", "\n onMouseout=", "\n disabled=", "\n aria-label=", "\n >\n ", "\n </button>\n "], ["\n <button\n ref=", '\n type="button"\n style=', "\n class=", "\n onClick=", "\n onMouseover=", "\n onMouseout=", "\n disabled=", "\n aria-label=", "\n >\n ", "\n </button>\n "])), (function(t) {
return e.refs.el = t
}), l, c, this.execCommand, this.showTooltip, n, !!r, i.text || i.tooltip || "", i.text || "")
}, n
}($g),
sy = _v(iy),
ay = function(e) {
function n() {
var t = null !== e && e.apply(this, arguments) || this;
return t.showTooltip = function() {
t.props.showTooltip(t.refs.el)
}, t.showPopup = function() {
var e = Hv("customPopupBody", {
el: t.refs.el,
pos: t.props.getBound(t.refs.el),
popup: t.props.item.popup
});
e && t.props.setPopupInfo(e)
}, t
}
return t(n, e), n.prototype.mounted = function() {
var e = this.props,
t = e.setItemWidth,
n = e.item;
this.refs.el.appendChild(n.el), t && t(n.name, Na(this.refs.el)), n.onMounted && n.onMounted(this.props.execCommand)
}, n.prototype.updated = function(e) {
var t, n = this.props,
r = n.item,
o = n.active,
i = n.disabled;
e.active === o && e.disabled === i || null === (t = r.onUpdated) || void 0 === t || t.call(r, {
active: o,
disabled: i
})
}, n.prototype.render = function() {
var e = this,
t = this.props,
n = t.disabled,
r = {
display: t.item.hidden ? "none" : "inline-block"
},
o = function(e) {
return n ? null : e
};
return Eg(Wv || (Wv = s(["\n <div\n ref=", "\n style=", "\n class=", "\n onClick=", "\n onMouseover=", "\n onMouseout=", "\n ></div>\n "], ["\n <div\n ref=", "\n style=", "\n class=", "\n onClick=", "\n onMouseover=", "\n onMouseout=", "\n ></div>\n "])), (function(t) {
return e.refs.el = t
}), r, xa("toolbar-item-wrapper"), o(this.showPopup), o(this.showTooltip), o(this.props.hideTooltip))
}, n
}($g),
ly = _v(ay),
cy = function(e) {
function n() {
return null !== e && e.apply(this, arguments) || this
}
return t(n, e), n.prototype.render = function() {
var e = this,
t = this.props,
n = t.group,
r = t.hiddenDivider,
o = n.hidden ? {
display: "none"
} : null,
i = r ? {
display: "none"
} : null;
return Eg(Gv || (Gv = s(['\n <div class="', '" style=', ">\n ", '\n <div class="', '" style=', "></div>\n </div>\n "], ['\n <div class="', '" style=', ">\n ", '\n <div class="', '" style=', "></div>\n </div>\n "])), xa("toolbar-group"), o, n.map((function(t) {
var n = t.el ? ly : sy;
return Eg(Jv || (Jv = s(["<", " key=", " ...", " item=", " />"], ["<", " key=", " ...", " item=", " />"])), n, t.name, e.props, t)
})), xa("toolbar-divider"), i)
}, n
}($g),
uy = function(e) {
function n(t) {
var n = e.call(this, t) || this;
return n.handleClickDocument = function(e) {
var t = e.target;
Oa(t, "." + xa("dropdown-toolbar")) || Oa(t, ".more") || n.setState({
showDropdown: !1,
dropdownPos: null
})
}, n.showTooltip = function() {
n.props.showTooltip(n.refs.el)
}, n.state = {
showDropdown: !1,
dropdownPos: null
}, n
}
return t(n, e), n.prototype.getBound = function() {
var e = this.props.getBound(this.refs.el);
return e.top += 4, o(o({}, e), {
left: null,
right: 10
})
}, n.prototype.mounted = function() {
document.addEventListener("click", this.handleClickDocument)
}, n.prototype.updated = function() {
this.state.showDropdown && !this.state.dropdownPos && this.setState({
dropdownPos: this.getBound()
})
}, n.prototype.beforeDestroy = function() {
document.removeEventListener("click", this.handleClickDocument)
}, n.prototype.render = function() {
var e = this,
t = this.state,
n = t.showDropdown,
r = t.dropdownPos,
i = this.props,
a = i.disabled,
l = i.item,
c = i.items,
u = i.hideTooltip,
d = c.filter((function(e) {
return !e.hidden
})),
p = d.length ? null : {
display: "none"
},
h = n ? null : {
display: "none"
};
return Eg(Zv || (Zv = s(['\n <div class="', '" style=', ">\n <button\n ref=", '\n type="button"\n class=', "\n onClick=", "\n onMouseover=", "\n onMouseout=", "\n disabled=", '\n ></button>\n <div\n class="', '"\n style=', "\n ref=", "\n >\n ", "\n </div>\n </div>\n "], ['\n <div class="', '" style=', ">\n <button\n ref=", '\n type="button"\n class=', "\n onClick=", "\n onMouseover=", "\n onMouseout=", "\n disabled=", '\n ></button>\n <div\n class="', '"\n style=', "\n ref=", "\n >\n ", "\n </div>\n </div>\n "])), xa("toolbar-group"), p, (function(t) {
return e.refs.el = t
}), l.className, (function() {
return e.setState({
showDropdown: !0
})
}), this.showTooltip, u, a, xa("dropdown-toolbar"), o(o({}, h), r), (function(t) {
return e.refs.dropdownEl = t
}), d.length ? d.map((function(t, n) {
var r;
return Eg(Kv || (Kv = s(["\n <", "\n group=", "\n hiddenDivider=", "\n ...", "\n />\n "], ["\n <", "\n group=", "\n hiddenDivider=", "\n ...", "\n />\n "])), cy, t, n === d.length - 1 || (null === (r = d[n + 1]) || void 0 === r ? void 0 : r.hidden), e.props)
})) : null)
}, n
}($g),
dy = _v(uy),
py = function(e) {
function n(t) {
var n = e.call(this, t) || this;
return n.toggleTab = function(e, t) {
var r = n.props.eventEmitter;
if (n.state.activeTab !== t) {
var o = "write" === t ? "changePreviewTabWrite" : "changePreviewTabPreview";
r.emit(o), n.setState({
activeTab: t
})
}
}, n.setItemWidth = function(e, t) {
n.itemWidthMap[e] = t
}, n.setPopupInfo = function(e) {
n.setState({
showPopup: !0,
popupInfo: e
})
}, n.openPopup = function(e, t) {
void 0 === t && (t = {});
var r = n.refs.el.querySelector("." + xa("toolbar-group") + " ." + e);
if (r) {
var o = Da(r, Oa(r, "." + xa("toolbar"))),
i = o.offsetLeft,
s = o.offsetTop,
a = Hv(e, {
el: r,
pos: {
left: i,
top: r.offsetHeight + s
},
initialValues: t
});
a && n.setPopupInfo(a)
}
}, n.hidePopup = function() {
n.state.showPopup && n.setState({
showPopup: !1
})
}, n.execCommand = function(e, t) {
n.props.eventEmitter.emit("command", e, t), n.hidePopup()
}, n.tabs = [{
name: "write",
text: "Write"
}, {
name: "preview",
text: "Preview"
}], n.itemWidthMap = {}, n.initialItems = qv(t.toolbarItems || [], n.hiddenScrollSync()), n.state = {
items: n.initialItems,
dropdownItems: [],
showPopup: !1,
popupInfo: {},
activeTab: "write"
}, n.tooltipRef = {
current: null
}, n.resizeObserver = new Dv((function() {
return n.handleResize()
})), n.addEvent(), n
}
return t(n, e), n.prototype.insertToolbarItem = function(e, t) {
var n = e.groupIndex,
r = e.itemIndex,
o = this.initialItems[n];
t = Fv(t), o ? o.splice(r, 0, t) : this.initialItems.push([t]), this.setState(this.classifyToolbarItems())
}, n.prototype.removeToolbarItem = function(e) {
var t = this;
Fa()(this.initialItems, (function(n) {
var r = !1;
return Fa()(n, (function(o, i) {
return o.name !== e || (r = !0, n.splice(i, 1), t.setState(t.classifyToolbarItems()), !1)
})), !r
}))
}, n.prototype.addEvent = function() {
var e = this,
t = this.props.eventEmitter;
this.handleResize = Wg()((function() {
e.setState({
items: e.initialItems,
dropdownItems: []
}), e.setState(e.classifyToolbarItems())
}), 200), t.listen("openPopup", this.openPopup)
}, n.prototype.appendTooltipToRoot = function() {
var e = '<div class="' + xa("tooltip") + '" style="display:none">\n <div class="arrow"></div>\n <span class="text"></span>\n </div>';
this.tooltipRef.current = Ea(e, this.refs.el)
}, n.prototype.hiddenScrollSync = function() {
return "wysiwyg" === this.props.editorType || "tab" === this.props.previewStyle
}, n.prototype.movePrevItemToDropdownToolbar = function(e, t, n, r) {
var o = function(e) {
var t = e.pop();
t && r.push(t)
};
if (e > 1) o(n);
else {
var i = et(t);
i && o(i)
}
}, n.prototype.classifyToolbarItems = function() {
var e = this,
t = 0,
n = this.refs.el.clientWidth,
r = this.refs.el.querySelector("." + xa("toolbar-divider")),
o = r ? Na(r) : 0,
i = [],
s = [],
a = !1;
return this.initialItems.forEach((function(r, l) {
var c = [],
u = [];
r.forEach((function(r, o) {
r.hidden || ((t += e.itemWidthMap[r.name]) > n - 50 ? (a || (e.movePrevItemToDropdownToolbar(o, i, c, u), a = !0), u.push(r)) : c.push(r))
})), c.length && (zv(c), i.push(c)), u.length && (zv(u), s.push(u)), l < e.state.items.length - 1 && (t += o)
})), {
items: i,
dropdownItems: s
}
}, n.prototype.mounted = function() {
"tab" === this.props.previewStyle && this.props.eventEmitter.emit("changePreviewTabWrite", !0), this.setState(this.classifyToolbarItems()), this.appendTooltipToRoot(), this.resizeObserver.observe(this.refs.el)
}, n.prototype.updated = function(e) {
var t, n, r = this.props,
o = r.editorType,
i = r.previewStyle,
s = r.eventEmitter,
a = i !== e.previewStyle,
l = o !== e.editorType;
if (a || l) {
t = this.initialItems, n = this.hiddenScrollSync(), t.forEach((function(e) {
e.forEach((function(e) {
return e.hidden = "scrollSync" === e.name && n
})), zv(e)
}));
var c = this.classifyToolbarItems();
(a || "tab" === i && "markdown" === o) && (s.emit("changePreviewTabWrite"), c.activeTab = "write"), this.setState(c)
}
}, n.prototype.beforeDestroy = function() {
window.removeEventListener("resize", this.handleResize), this.resizeObserver.disconnect(), Ma(this.tooltipRef.current)
}, n.prototype.render = function() {
var e = this,
t = this.props,
n = t.previewStyle,
r = t.eventEmitter,
o = t.editorType,
i = this.state,
a = i.popupInfo,
l = i.showPopup,
c = i.activeTab,
u = i.items,
d = i.dropdownItems,
p = {
eventEmitter: r,
tooltipRef: this.tooltipRef,
disabled: "markdown" === o && "tab" === n && "preview" === c,
execCommand: this.execCommand,
setPopupInfo: this.setPopupInfo
},
h = "tab" === n ? {
borderTopLeftRadius: 0
} : null;
return Eg(Qv || (Qv = s(['\n <div class="', '">\n <div\n class="', '"\n style="display: ', '"\n >\n <', " tabs=", " activeTab=", " onClick=", ' />\n </div>\n <div\n class="', '"\n ref=', "\n style=", "\n >\n ", "\n <", "\n item=", "\n items=", "\n ...", "\n />\n </div>\n <", "\n info=", "\n show=", "\n eventEmitter=", "\n hidePopup=", "\n execCommand=", "\n />\n </div>\n "], ['\n <div class="', '">\n <div\n class="', '"\n style="display: ', '"\n >\n <', " tabs=", " activeTab=", " onClick=", ' />\n </div>\n <div\n class="', '"\n ref=', "\n style=", "\n >\n ", "\n <", "\n item=", "\n items=", "\n ...", "\n />\n </div>\n <", "\n info=", "\n show=", "\n eventEmitter=", "\n hidePopup=", "\n execCommand=", "\n />\n </div>\n "])), xa("toolbar"), xa("md-tab-container"), "wysiwyg" === o || "vertical" === n ? "none" : "block", Lv, this.tabs, c, this.toggleTab, xa("defaultUI-toolbar"), (function(t) {
return e.refs.el = t
}), h, u.map((function(t, n) {
var r;
return Eg(Xv || (Xv = s(["\n <", "\n group=", "\n hiddenDivider=", "\n setItemWidth=", "\n ...", "\n />\n "], ["\n <", "\n group=", "\n hiddenDivider=", "\n setItemWidth=", "\n ...", "\n />\n "])), cy, t, n === u.length - 1 || (null === (r = u[n + 1]) || void 0 === r ? void 0 : r.hidden), e.setItemWidth, p)
})), dy, Fv("more"), d, p, $v, a, l, r, this.hidePopup, this.execCommand)
}, n
}($g),
hy = function(e) {
function n(t) {
var n = e.call(this, t) || this;
return n.handleClickDocument = function(e) {
Oa(e.target, "." + xa("context-menu")) || n.setState({
pos: null
})
}, n.state = {
pos: null,
menuGroups: []
}, n.addEvent(), n
}
return t(n, e), n.prototype.addEvent = function() {
var e = this;
this.props.eventEmitter.listen("contextmenu", (function(t) {
var n = t.pos,
r = t.menuGroups;
e.setState({
pos: n,
menuGroups: r
})
}))
}, n.prototype.mounted = function() {
document.addEventListener("click", this.handleClickDocument)
}, n.prototype.beforeDestroy = function() {
document.removeEventListener("click", this.handleClickDocument)
}, n.prototype.getMenuGroupElements = function() {
var e = this,
t = this.state,
n = t.pos,
r = t.menuGroups;
return n ? r.reduce((function(t, n) {
var r = [];
return n.forEach((function(t) {
var n = t.label,
o = t.className,
i = void 0 !== o && o,
a = t.disabled,
l = t.onClick;
r.push(Eg(Yv || (Yv = s(["\n <li\n onClick=", '\n class="menu-item', '"\n aria-role="menuitem"\n >\n <span class="', '">', "</span>\n </li>\n "], ["\n <li\n onClick=", '\n class="menu-item', '"\n aria-role="menuitem"\n >\n <span class="', '">', "</span>\n </li>\n "])), (function() {
a || (l(), e.setState({
pos: null
}))
}), a ? " disabled" : "", i, n))
})), t.push(Eg(ey || (ey = s(['<ul class="menu-group">\n ', "\n </ul>"], ['<ul class="menu-group">\n ', "\n </ul>"])), r)), t
}), []) : []
}, n.prototype.render = function() {
var e = o({
display: this.state.pos ? "block" : "none"
}, this.state.pos);
return Eg(ty || (ty = s(['<div class="', '" style=', ' aria-role="menu">\n ', "\n </div>"], ['<div class="', '" style=', ' aria-role="menu">\n ', "\n </div>"])), xa("context-menu"), e, this.getMenuGroupElements())
}, n
}($g),
fy = function(e) {
function n(t) {
var n = e.call(this, t) || this;
n.changeMode = function(e) {
e !== n.state.editorType && n.setState({
editorType: e
})
}, n.changePreviewStyle = function(e) {
e !== n.state.previewStyle && n.setState({
previewStyle: e
})
}, n.hide = function() {
n.setState({
hide: !0
})
}, n.show = function() {
n.setState({
hide: !1
})
};
var r = t.editorType,
o = t.previewStyle;
return n.state = {
editorType: r,
previewStyle: o,
hide: !1
}, n.addEvent(), n
}
return t(n, e), n.prototype.mounted = function() {
var e = this.props.slots,
t = e.wwEditor,
n = e.mdEditor,
r = e.mdPreview;
this.refs.wwContainer.appendChild(t), this.refs.mdContainer.insertAdjacentElement("afterbegin", n), this.refs.mdContainer.appendChild(r)
}, n.prototype.insertToolbarItem = function(e, t) {
this.toolbar.insertToolbarItem(e, t)
}, n.prototype.removeToolbarItem = function(e) {
this.toolbar.removeToolbarItem(e)
}, n.prototype.render = function() {
var e = this,
t = this.props,
n = t.eventEmitter,
r = t.hideModeSwitch,
o = t.toolbarItems,
i = t.theme,
a = this.state,
l = a.hide,
c = a.previewStyle,
u = a.editorType,
d = l ? " hidden" : "",
p = xa("markdown" === u ? "md-mode" : "ww-mode"),
h = xa("md") + "-" + c + "-style",
f = xa(["light" !== i, i + " "]);
return Eg(ry || (ry = s(['\n <div\n class="', "", "", '"\n ref=', "\n >\n <", "\n ref=", "\n eventEmitter=", "\n previewStyle=", "\n toolbarItems=", "\n editorType=", '\n />\n <div\n class="', " ", '"\n ref=', '\n >\n <div class="', '">\n <div\n class="', " ", '"\n ref=', '\n >\n <div class="', '"></div>\n </div>\n <div\n class="', '"\n ref=', "\n />\n </div>\n </div>\n ", "\n <", " eventEmitter=", " />\n </div>\n "], ['\n <div\n class="', "", "", '"\n ref=', "\n >\n <", "\n ref=", "\n eventEmitter=", "\n previewStyle=", "\n toolbarItems=", "\n editorType=", '\n />\n <div\n class="', " ", '"\n ref=', '\n >\n <div class="', '">\n <div\n class="', " ", '"\n ref=', '\n >\n <div class="', '"></div>\n </div>\n <div\n class="', '"\n ref=', "\n />\n </div>\n </div>\n ", "\n <", " eventEmitter=", " />\n </div>\n "])), f, xa("defaultUI"), d, (function(t) {
return e.refs.el = t
}), py, (function(t) {
return e.toolbar = t
}), n, c, o, u, xa("main"), p, (function(t) {
return e.refs.editorSection = t
}), xa("main-container"), xa("md-container"), h, (function(t) {
return e.refs.mdContainer = t
}), xa("md-splitter"), xa("ww-container"), (function(t) {
return e.refs.wwContainer = t
}), !r && Eg(ny || (ny = s(["<", " eventEmitter=", " editorType=", " />"], ["<", " eventEmitter=", " editorType=", " />"])), _g, n, u), hy, n)
}, n.prototype.addEvent = function() {
var e = this.props.eventEmitter;
e.listen("hide", this.hide), e.listen("show", this.show), e.listen("changeMode", this.changeMode), e.listen("changePreviewStyle", this.changePreviewStyle)
}, n
}($g),
my = function(e) {
function n(t) {
var n, r, o = e.call(this, t) || this,
i = Vg(o.options.el, Eg(oy || (oy = s(["\n <", "\n ref=", "\n eventEmitter=", "\n slots=", "\n hideModeSwitch=", "\n toolbarItems=", "\n previewStyle=", "\n editorType=", "\n theme=", "\n />\n "], ["\n <", "\n ref=", "\n eventEmitter=", "\n slots=", "\n hideModeSwitch=", "\n toolbarItems=", "\n previewStyle=", "\n editorType=", "\n theme=", "\n />\n "])), fy, (function(e) {
return r = e
}), o.eventEmitter, o.getEditorElements(), o.options.hideModeSwitch, o.options.toolbarItems, o.options.previewStyle, o.options.initialEditType, o.options.theme));
return o.setMinHeight(o.options.minHeight), o.setHeight(o.options.height), o.defaultUI = {
insertToolbarItem: r.insertToolbarItem.bind(r),
removeToolbarItem: r.removeToolbarItem.bind(r),
destroy: i
}, null === (n = o.pluginInfo.toolbarItems) || void 0 === n || n.forEach((function(e) {
var t = e.groupIndex,
n = e.itemIndex,
r = e.item;
o.defaultUI.insertToolbarItem({
groupIndex: t,
itemIndex: n
}, r)
})), o.eventEmitter.emit("loadUI", o), o
}
return t(n, e), n.factory = function(e) {
return e.viewer ? new ug(e) : new n(e)
}, n.prototype.insertToolbarItem = function(e, t) {
this.defaultUI.insertToolbarItem(e, t)
}, n.prototype.removeToolbarItem = function(e) {
this.defaultUI.removeToolbarItem(e)
}, n.prototype.destroy = function() {
e.prototype.destroy.call(this), this.defaultUI.destroy()
}, n
}(kg),
gy = my;
kg.setLanguage(["en", "en-US"], {
Markdown: "Markdown",
WYSIWYG: "WYSIWYG",
Write: "Write",
Preview: "Preview",
Headings: "Headings",
Paragraph: "Paragraph",
Bold: "Bold",
Italic: "Italic",
Strike: "Strike",
Code: "Inline code",
Line: "Line",
Blockquote: "Blockquote",
"Unordered list": "Unordered list",
"Ordered list": "Ordered list",
Task: "Task",
Indent: "Indent",
Outdent: "Outdent",
"Insert link": "Insert link",
"Insert CodeBlock": "Insert codeBlock",
"Insert table": "Insert table",
"Insert image": "Insert image",
Heading: "Heading",
"Image URL": "Image URL",
"Select image file": "Select image file",
"Choose a file": "Choose a file",
"No file": "No file",
Description: "Description",
OK: "OK",
More: "More",
Cancel: "Cancel",
File: "File",
URL: "URL",
"Link text": "Link text",
"Add row to up": "Add row to up",
"Add row to down": "Add row to down",
"Add column to left": "Add column to left",
"Add column to right": "Add column to right",
"Remove row": "Remove row",
"Remove column": "Remove column",
"Align column to left": "Align column to left",
"Align column to center": "Align column to center",
"Align column to right": "Align column to right",
"Remove table": "Remove table",
"Would you like to paste as table?": "Would you like to paste as table?",
"Text color": "Text color",
"Auto scroll enabled": "Auto scroll enabled",
"Auto scroll disabled": "Auto scroll disabled",
"Choose language": "Choose language"
});
var vy = gy
}(), r = r.default
}()
}));