UNPKG

formula-editor-plus

Version:

> 注意:本项目利用了mathquill.js 实现可视化编辑功能,该库必须要jquery支持,并采用Mathjax3以上版本版本渲染

1,234 lines (1,230 loc) 136 kB
(function() { var it, X, $ = window.jQuery, Ot = "mathquill-command-id", z = "mathquill-block-id", J = Math.min, Tt = Math.max; if (it = !1, !$) throw "MathQuill requires jQuery 1.5.2+ to be loaded first"; function L() { } var ut = [].slice; function ft(s) { var r = s.length - 1; return function() { var t = ut.call(arguments, 0, r), e = ut.call(arguments, r); return s.apply(this, t.concat([e])); }; } var Ht = ft(function(s, r) { return ft(function(t, e) { if (s in t) return t[s].apply(t, r.concat(e)); }); }); function pt(s) { return ft(function(r, t) { return typeof r != "function" && (r = Ht(r)), s.call(this, function(e) { return r.apply(e, [e].concat(t)); }); }); } function h(s) { var r = ut.call(arguments, 1); return function() { return s.apply(this, r); }; } var m = /* @__PURE__ */ function(s, r, t) { function e(o) { return typeof o == "object"; } function i(o) { return typeof o == "function"; } function a() { } return function o(c, l) { function p() { var v = new d(); return i(v.init) && v.init.apply(v, arguments), v; } function d() { } l === void 0 && (l = c, c = Object), p.Bare = d; var g, w = a[s] = c[s], q = d[s] = p[s] = p.p = new a(); return q.constructor = p, p.extend = function(v) { return o(p, v); }, (p.open = function(v) { if (g = {}, i(v) ? g = v.call(p, q, w, p, c) : e(v) && (g = v), e(g)) for (var y in g) r.call(g, y) && (q[y] = g[y]); return i(q.init) || (q.init = c), p; })(l); }; }("prototype", {}.hasOwnProperty), u = -1, T = m($, function(s) { s.insDirOf = function(r, t) { return r === u ? this.insertBefore(t.first()) : this.insertAfter(t.last()); }, s.insAtDirEnd = function(r, t) { return r === u ? this.prependTo(t) : this.appendTo(t); }; }), M = m(function(s) { s.parent = 0, s[u] = 0, s[1] = 0, s.init = function(r, t, e) { this.parent = r, this[u] = t, this[1] = e; }, this.copy = function(r) { return M(r.parent, r[u], r[1]); }; }), I = m(function(s) { s[u] = 0, s[1] = 0, s.parent = 0; var r = 0; this.byId = {}, s.init = function() { this.id = r += 1, I.byId[this.id] = this, this.ends = {}, this.ends[u] = 0, this.ends[1] = 0; }, s.dispose = function() { delete I.byId[this.id]; }, s.toString = function() { return "{{ MathQuill Node #" + this.id + " }}"; }, s.jQ = T(), s.jQadd = function(t) { return this.jQ = this.jQ.add(t); }, s.jQize = function(t) { t = T(t || this.html()); function e(a) { if (a.getAttribute) { var o = a.getAttribute("mathquill-command-id"), c = a.getAttribute("mathquill-block-id"); o && I.byId[o].jQadd(a), c && I.byId[c].jQadd(a); } for (a = a.firstChild; a; a = a.nextSibling) e(a); } for (var i = 0; i < t.length; i += 1) e(t[i]); return t; }, s.createDir = function(t, e) { var i = this; return i.jQize(), i.jQ.insDirOf(t, e.jQ), e[t] = i.adopt(e.parent, e[u], e[1]), i; }, s.createLeftOf = function(t) { return this.createDir(u, t); }, s.selectChildren = function(t, e) { return jt(t, e); }, s.bubble = pt(function(t) { for (var e = this; e && t(e) !== !1; e = e.parent) ; return this; }), s.postOrder = pt(function(t) { return function e(i) { i.eachChild(e), t(i); }(this), this; }), s.isEmpty = function() { return this.ends[u] === 0 && this.ends[1] === 0; }, s.isStyleBlock = function() { return !1; }, s.children = function() { return D(this.ends[u], this.ends[1]); }, s.eachChild = function() { var t = this.children(); return t.each.apply(t, arguments), this; }, s.foldChildren = function(t, e) { return this.children().fold(t, e); }, s.withDirAdopt = function(t, e, i, a) { return D(this, this).withDirAdopt(t, e, i, a), this; }, s.adopt = function(t, e, i) { return D(this, this).adopt(t, e, i), this; }, s.disown = function() { return D(this, this).disown(), this; }, s.remove = function() { return this.jQ.remove(), this.postOrder("dispose"), this.disown(); }; }); function dt(s, r, t) { r ? r[1] === t && r.parent : s.ends[u], t ? t[u] === r && t.parent : s.ends[1]; } var D = m(function(s) { s.init = function(r, t, e) { if (e === X && (e = u), this.ends = {}, r) { r.parent, t.parent, this.ends[e] = r, this.ends[-e] = t; var i = this.fold([], function(a, o) { return a.push.apply(a, o.jQ.get()), a; }); this.jQ = this.jQ.add(i); } }, s.jQ = T(), s.withDirAdopt = function(r, t, e, i) { return r === u ? this.adopt(t, e, i) : this.adopt(t, i, e); }, s.adopt = function(r, t, e) { dt(r, t, e); var i = this; i.disowned = !1; var a = i.ends[u]; if (!a) return this; var o = i.ends[1]; return t || (r.ends[u] = a), e ? e[u] = o : r.ends[1] = o, i.ends[1][1] = e, i.each(function(c) { c[u] = t, c.parent = r, t && (t[1] = c), t = c; }), i; }, s.disown = function() { var r = this, t = r.ends[u]; if (!t || r.disowned) return r; r.disowned = !0; var e = r.ends[1], i = t.parent; return dt(i, t[u], t), dt(i, e, e[1]), t[u] ? t[u][1] = e[1] : i.ends[u] = e[1], e[1] ? e[1][u] = t[u] : i.ends[1] = t[u], r; }, s.remove = function() { return this.jQ.remove(), this.each("postOrder", "dispose"), this.disown(); }, s.each = pt(function(r) { var t = this, e = t.ends[u]; if (!e) return t; for (; e !== t.ends[1][1] && r(e) !== !1; e = e[1]) ; return t; }), s.fold = function(r, t) { return this.each(function(e) { r = t.call(this, r, e); }), r; }; }), n = {}, Y = {}, Ut = m(M, function(s) { s.init = function(r, t) { this.parent = r, this.options = t; var e = this.jQ = this._jQ = T('<span class="mq-cursor">&#8203;</span>'); this.blink = function() { e.toggleClass("mq-blink"); }, this.upDownCache = {}; }, s.show = function() { return this.jQ = this._jQ.removeClass("mq-blink"), "intervalId" in this ? clearInterval(this.intervalId) : (this[1] ? this.selection && this.selection.ends[u][u] === this[u] ? this.jQ.insertBefore(this.selection.jQ) : this.jQ.insertBefore(this[1].jQ.first()) : this.jQ.appendTo(this.parent.jQ), $(".math-area").css("background-color") == "rgb(0, 0, 0)" ? $(this.jQ).css("border-color", "#ffffff") : $(this.jQ).css("border-color", "#000000"), this.parent.focus()), this.intervalId = setInterval(this.blink, 500), this; }, s.hide = function() { return "intervalId" in this && clearInterval(this.intervalId), delete this.intervalId, this.jQ.detach(), this.jQ = T(), this; }, s.withDirInsertAt = function(r, t, e, i) { var a = this.parent; this.parent = t, this[r] = e, this[-r] = i, a !== t && a.blur && a.blur(this); }, s.insDirOf = function(r, t) { return this.jQ.insDirOf(r, t.jQ), this.withDirInsertAt(r, t.parent, t[r], t), this.parent.jQ.addClass("mq-hasCursor"), this.setCursorHandle(this.parent), this; }, s.insLeftOf = function(r) { return this.insDirOf(u, r); }, s.insRightOf = function(r) { return this.insDirOf(1, r); }, s.insAtDirEnd = function(r, t) { return this.jQ.insAtDirEnd(r, t.jQ), this.withDirInsertAt(r, t, 0, t.ends[r]), t.focus(), this.setCursorHandle(t), this; }, s.insAtLeftEnd = function(r) { return this.insAtDirEnd(u, r); }, s.insAtRightEnd = function(r) { return this.insAtDirEnd(1, r); }, s.setCursorHandle = function(r) { let t = (e) => { e.parent ? t(e.parent) : e.controller.handle("cursor"); }; t(r); }, s.jumpUpDown = function(r, t) { var e = this; e.upDownCache[r.id] = M.copy(e); var i = e.upDownCache[t.id]; if (i) i[1] ? e.insLeftOf(i[1]) : e.insAtRightEnd(i.parent); else { var a = e.offset().left; t.seek(a, e); } }, s.offset = function() { var r = this.jQ.removeClass("mq-cursor").offset(); return this.jQ.addClass("mq-cursor"), r; }, s.unwrapGramp = function() { var r = this.parent.parent, t = r.parent, e = r[1], i = r[u]; if (r.disown().eachChild(function(a) { a.isEmpty() || (a.children().adopt(t, i, e).each(function(o) { o.jQ.insertBefore(r.jQ.first()); }), i = a.ends[1]); }), !this[1]) if (this[u]) this[1] = this[u][1]; else for (; !this[1]; ) { if (this.parent = this.parent[1], !this.parent) { this[1] = r[1], this.parent = t; break; } this[1] = this.parent.ends[u]; } this[1] ? this.insLeftOf(this[1]) : this.insAtRightEnd(t), r.jQ.remove(), r[u].siblingDeleted && r[u].siblingDeleted(this.options, 1), r[1].siblingDeleted && r[1].siblingDeleted(this.options, u); }, s.startSelection = function() { for (var r = this.anticursor = M.copy(this), t = r.ancestors = {}, e = r; e.parent; e = e.parent) t[e.parent.id] = e; }, s.endSelection = function() { delete this.anticursor; }, s.select = function() { var r = this.anticursor; if (this[u] === r[u] && this.parent === r.parent) return !1; for (var t = this; t.parent; t = t.parent) if (t.parent.id in r.ancestors) { var e = t.parent; break; } var i, a, o = r.ancestors[e.id], c = 1; if (t[u] !== o) { for (var l = t; l; l = l[1]) if (l[1] === o[1]) { c = u, i = t, a = o; break; } } return c === 1 && (i = o, a = t), i instanceof M && (i = i[1]), a instanceof M && (a = a[u]), this.hide().selection = e.selectChildren(i, a), this.selection.ends[c] && this.insDirOf(c, this.selection.ends[c]), this.selectionChanged(), !0; }, s.clearSelection = function() { return this.selection && (this.selection.clear(), delete this.selection, this.selectionChanged()), this; }, s.deleteSelection = function() { this.selection && (this[u] = this.selection.ends[u][u], this[1] = this.selection.ends[1][1], this.selection.remove(), this.selectionChanged(), delete this.selection); }, s.replaceSelection = function() { var r = this.selection; return r && (this[u] = r.ends[u][u], this[1] = r.ends[1][1], delete this.selection), r; }; }), jt = m(D, function(s, r) { s.init = function() { r.init.apply(this, arguments), this.jQ = this.jQ.wrapAll('<span class="mq-selection"></span>').parent(); }, s.adopt = function() { return this.jQ.replaceWith(this.jQ = this.jQ.children()), r.adopt.apply(this, arguments); }, s.clear = function() { return this.jQ[0] && this.jQ.replaceWith(this.jQ[0].childNodes), this; }, s.join = function(t) { return this.fold("", function(e, i) { return e + i[t](); }); }; }), R = m(function(s) { s.init = function(t, e, i) { this.id = t.id, this.data = {}, this.root = t, this.container = e, this.options = i, t.controller = this, this.cursor = t.cursor = Ut(t, i); }, s.handle = function(t, e) { var i = this.options.handlers; if (i && i.fns[t]) { var a = i.APIClasses[this.KIND_OF_MQ](this); e === u || e === 1 ? i.fns[t](e, a) : i.fns[t](a); } }; var r = []; this.onNotify = function(t) { r.push(t); }, s.notify = function() { for (var t = 0; t < r.length; t += 1) r[t].apply(this.cursor, arguments); return this; }; }), Z = {}, W = m(), rt = {}, St = m(), Qt = {}; function mt() { window.console && console.warn(`You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else: MathQuill = MathQuill.getInterface(1); // now MathQuill.MathField() works like it used to `); } function E(s) { return mt(), kt(s); } E.prototype = St.p, E.VERSION = "v0.10.1", E.interfaceVersion = function(s) { if (s !== 1) throw "Only interface version 1 supported. You specified: " + s; return (mt = function() { window.console && console.warn(`You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else: MathQuill = MathQuill.getInterface(1); // now MathQuill.MathField() works like it used to `); })(), E; }, E.getInterface = at, E.isSelectedItalic = !0; var Ct = at.MIN = 1, _t = at.MAX = 2; function at(s) { if (!(Ct <= s && s <= _t)) throw "Only interface versions between " + Ct + " and " + _t + " supported. You specified: " + s; function r(o) { if (!o || !o.nodeType) return null; var c = T(o).children(".mq-root-block").attr(z), l = c && I.byId[c].controller; return l ? t[l.KIND_OF_MQ](l) : null; } var t = {}; function e(o, c) { for (var l in c && c.handlers && (c.handlers = { fns: c.handlers, APIClasses: t }), c) if (c.hasOwnProperty(l)) { var p = c[l], d = rt[l]; o[l] = d ? d(p) : p; } } r.L = u, r.R = 1, r.saneKeyboardEvents = Lt, r.config = function(o) { return e(W.p, o), this; }, r.registerEmbed = function(o, c) { if (!/^[a-z][a-z0-9]*$/i.test(o)) throw "Embed name must start with letter and be only letters and digits"; Qt[o] = c; }; var i = t.AbstractMathQuill = m(St, function(o) { o.init = function(c) { this.__controller = c, this.__options = c.options, this.id = c.id, this.data = c.data; }, o.__mathquillify = function(c) { var l = this.__controller, p = l.root, d = l.container; l.createTextarea(); var g = d.addClass(c).contents().detach(); p.jQ = T('<span class="mq-root-block"/>').attr(z, p.id).appendTo(d), this.latex(g.text()), this.revert = function() { return d.empty().unbind(".mathquill").removeClass("mq-editable-field mq-math-mode mq-text-mode").append(g); }; }, o.config = function(c) { return e(this.__options, c), this; }, o.el = function() { return this.__controller.container[0]; }, o.text = function() { return this.__controller.exportText(); }, o.latex = function(c) { return arguments.length > 0 ? (this.__controller.renderLatexMath(c), this.__controller.blurred && this.__controller.cursor.hide().parent.blur(), this) : this.__controller.exportLatex(); }, o.positionFix = function(c) { if (this.__controller.textarea.focus(), c != null && c != 0) for (var l = Math.abs(c), p = 0; p < l; p++) c > 0 ? this.__controller.moveRight() : this.__controller.moveLeft(); }, o.positionFiy = function(c) { if (this.__controller.textarea.focus(), c != null && c != 0) for (var l = Math.abs(c), p = 0; p < l; p++) c > 0 ? this.__controller.moveUp() : this.__controller.moveDown(); }, o.html = function() { return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g, "").replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i, "").replace(/ mq-hasCursor|mq-hasCursor ?/, "").replace(/ class=(""|(?= |>))/g, ""); }, o.reflow = function() { return this.__controller.root.postOrder("reflow"), this; }; }); for (var a in r.prototype = i.prototype, t.EditableField = m(i, function(o, c) { o.__mathquillify = function() { return c.__mathquillify.apply(this, arguments), this.__controller.editable = !0, this.__controller.delegateMouseEvents(), this.__controller.editablesTextareaEvents(), this; }, o.focus = function() { return this.__controller.textarea.focus(), this; }, o.blur = function() { return this.__controller.textarea.blur(), this; }, o.write = function(l) { if (!(window.$currentJQ.hasClass("mq-text-mode") && l.length > 1)) return this.__controller.writeLatex(l), this.__controller.scrollHoriz(), this.__controller.blurred && this.__controller.cursor.hide().parent.blur(), this; }, o.empty = function() { var l = this.__controller.root, p = this.__controller.cursor; return l.eachChild("postOrder", "dispose"), l.ends[u] = l.ends[1] = 0, l.jQ.empty(), delete p.selection, p.insAtRightEnd(l), this; }, o.cmd = function(l) { var p = this.__controller.notify(), d = p.cursor; if (/^\\[a-z]+\{\}$/i.test(l)) { l = l.slice(1); var g = n[l]; g && (l = g(l), d.selection && l.replaces(d.replaceSelection()), l.createLeftOf(d.show()), this.__controller.scrollHoriz()); } else d.parent.write(d, l); return p.blurred && d.hide().parent.blur(), this; }, o.select = function() { var l = this.__controller; for (l.notify("move").cursor.insAtRightEnd(l.root); l.cursor[u]; ) l.selectLeft(); return this; }, o.clearSelection = function() { return this.__controller.cursor.clearSelection(), this; }, o.moveToDirEnd = function(l) { return this.__controller.notify("move").cursor.insAtDirEnd(l, this.__controller.root), this; }, o.moveToLeftEnd = function() { return this.moveToDirEnd(u); }, o.moveToRightEnd = function() { return this.moveToDirEnd(1); }, o.keystroke = function(l) { l = l.replace(/^\s+|\s+$/g, "").split(/\s+/); for (var p = 0; p < l.length; p += 1) this.__controller.keystroke(l[p], { preventDefault: L }); return this; }, o.typedText = function(l) { for (var p = 0; p < l.length; p += 1) this.__controller.typedText(l.charAt(p)); return this; }, o.dropEmbedded = function(l, p, d) { var g = l - T(window).scrollLeft(), w = p - T(window).scrollTop(), q = document.elementFromPoint(g, w); this.__controller.seek(T(q), l, p), ae().setOptions(d).createLeftOf(this.__controller.cursor); }, o.clickAt = function(l, p, d) { d = d || document.elementFromPoint(l, p); var g = this.__controller, w = g.root; return $.contains(w.jQ[0], d) || (d = w.jQ[0]), g.seek(T(d), l + pageXOffset, p + pageYOffset), g.blurred && this.focus(), this; }, o.ignoreNextMousedown = function(l) { return this.__controller.cursor.options.ignoreNextMousedown = l, this; }; }), r.EditableField = function() { throw "wtf don't call me, I'm 'abstract'"; }, r.EditableField.prototype = t.EditableField.prototype, Z) (function(o, c) { var l = t[o] = c(t); r[o] = function(p, d) { var g = r(p); if (g instanceof l || !p || !p.nodeType) return g; var w = R(l.RootBlock(), T(p), W()); return w.KIND_OF_MQ = o, l(w).__mathquillify(d, s); }, r[o].prototype = l.prototype; })(a, Z[a]); return r; } E.noConflict = function() { return window.MathQuill = Vt, E; }; var Vt = window.MathQuill; function Dt(s) { for (var r = "moveOutOf deleteOutOf selectOutOf upOutOf downOutOf".split(" "), t = 0; t < r.length; t += 1) (function(e) { s[e] = function(i) { this.controller.handle(e, i); }; })(r[t]); s.reflow = function() { this.controller.handle("reflow"), this.controller.handle("edited"), this.controller.handle("edit"); }; } window.MathQuill = E; var Et, x = m(function(s, r, t) { function e(c, l) { throw "Parse Error: " + l + " at " + (c = c ? "'" + c + "'" : "EOF"); } s.init = function(c) { this._ = c; }, s.parse = function(c) { return this.skip(o)._("" + c, function(l, p) { return p; }, e); }, s.or = function(c) { var l = this; return t(function(p, d, g) { return l._(p, d, function(w) { return c._(p, d, g); }); }); }, s.then = function(c) { var l = this; return t(function(p, d, g) { return l._(p, function(w, q) { var v = c instanceof t ? c : c(q); return v._(w, d, g); }, g); }); }, s.many = function() { var c = this; return t(function(l, p, d) { for (var g = []; c._(l, w, q); ) ; return p(l, g); function w(v, y) { return l = v, g.push(y), !0; } function q() { return !1; } }); }, s.times = function(c, l) { arguments.length < 2 && (l = c); var p = this; return t(function(d, g, w) { for (var q, v = [], y = !0, O = 0; O < c; O += 1) if (!(y = p._(d, S, A))) return w(d, q); for (; O < l && y; O += 1) y = p._(d, S, ce); return g(d, v); function S(ct, ht) { return v.push(ht), d = ct, !0; } function A(ct, ht) { return q = ht, d = ct, !1; } function ce(ct, ht) { return !1; } }); }, s.result = function(c) { return this.then(a(c)); }, s.atMost = function(c) { return this.times(0, c); }, s.atLeast = function(c) { var l = this; return l.times(c).then(function(p) { return l.many().map(function(d) { return p.concat(d); }); }); }, s.map = function(c) { return this.then(function(l) { return a(c(l)); }); }, s.skip = function(c) { return this.then(function(l) { return c.result(l); }); }, this.string = function(c) { var l = c.length, p = "expected '" + c + "'"; return t(function(d, g, w) { var q = d.slice(0, l); return q === c ? g(d.slice(l), q) : w(d, p); }); }; var i = this.regex = function(c) { c.toString().charAt(1); var l = "expected " + c; return t(function(p, d, g) { var w = c.exec(p); if (w) { var q = w[0]; return d(p.slice(q.length), q); } return g(p, l); }); }, a = t.succeed = function(c) { return t(function(l, p) { return p(l, c); }); }, o = (t.fail = function(c) { return t(function(l, p, d) { return d(l, c); }); }, t.letter = i(/^[a-z]/i), t.letters = i(/^[a-z]*/i), t.digit = i(/^[0-9]/), t.digits = i(/^[0-9]*/), t.whitespace = i(/^\s+/), t.optWhitespace = i(/^\s*/), t.any = t(function(c, l, p) { return c ? l(c.slice(1), c.charAt(0)) : p(c, "expected any character"); }), t.all = t(function(c, l, p) { return l("", c); }), t.eof = t(function(c, l, p) { return c ? p(c, "expected EOF") : l(c, c); })); }), Lt = (Et = { 8: "Backspace", 9: "Tab", 10: "Enter", 13: "Enter", 16: "Shift", 17: "Control", 18: "Alt", 20: "CapsLock", 27: "Esc", 32: "Spacebar", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 45: "Insert", 46: "Del", 144: "NumLock" }, function(s, r) { var t, e = null, i = null, a = $(s), o = $(r.container || a), c = L; function l(v) { c = v, clearTimeout(t), t = setTimeout(v); } function p(v) { l(function(y) { c = L, clearTimeout(t), v(y); }); } o.bind("keydown keypress input keyup focusout paste", function(v) { c(v); }); var d = !1; function g() { r.keystroke(function(v) { var y, O = v.which || v.keyCode, S = Et[O], A = []; return v.ctrlKey && A.push("Ctrl"), v.originalEvent && v.originalEvent.metaKey && A.push("Meta"), v.altKey && A.push("Alt"), v.shiftKey && A.push("Shift"), y = S || String.fromCharCode(O), A.length || S ? (A.push(y), A.join("-")) : y; }(e), e); } function w() { var v; if ((!("selectionStart" in (v = a[0])) || v.selectionStart === v.selectionEnd) && !it) { var y = a.val(); window.$currentJQ.hasClass("mq-text-mode") && y.match(/[\u4e00-\u9fa5|\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3010|\u3011|\u007e|\\]+/g) ? a.val("") : y.length > 1 ? (a.val(""), r.paste(y)) : y.length === 1 ? (a.val(""), r.typedText(y)) : y && a[0].select && a[0].select(); var O = r.notify().cursor.parent; O.isEmpty() ? O.jQ.addClass("mq-outLine") : O.jQ.removeClass("mq-outLine"); } } function q() { var v = a.val(); a.val(""), v && r.paste(v); } return l(w), o.bind({ keydown: function(v) { e = v, i = null, d && p(function(y) { y && y.type === "focusout" || !a[0].select || a[0].select(); }), g(); }, keypress: function(v) { e && i && g(), i = v, l(w); }, keyup: function(v) { e && !i && l(w); }, focusout: function() { e = i = null; }, compositionstart: function(v) { it = !0; }, compositionend: function(v) { var y = a.val() || v.originalEvent.data; const O = window.$currentJQ.hasClass("mq-text-mode"); a.val(""), !O && r.paste(y), it = !1; }, cut: function() { p(function() { r.cut(); }); }, copy: function() { p(function() { r.copy(); }); }, paste: function(v) { a.focus(), l(q); } }), { select: function(v) { c(), c = L, clearTimeout(t), a.val(v), v && a[0].select && a[0].select(), d = !!v; } }; }); R.open(function(s, r) { s.exportText = function() { return this.root.foldChildren("", function(t, e) { return t + e.text(); }); }; }), R.open(function(s) { s.focusBlurEvents = function() { var r, t = this, e = t.root, i = t.cursor; function a() { clearTimeout(r), i.selection && i.selection.jQ.addClass("mq-blur"), o(); } function o() { i.hide().parent.blur(), t.container.removeClass("mq-focused"), T(window).unbind("blur", a); } t.textarea.focus(function() { t.blurred = !1, clearTimeout(r), t.container.addClass("mq-focused"), i.parent || i.insAtRightEnd(e), i.selection ? (i.selection.jQ.removeClass("mq-blur"), t.selectionChanged()) : i.show(); }).blur(function() { t.blurred = !0, r = setTimeout(function() { e.postOrder("intentionalBlur"), o(); }), T(window).bind("blur", a); }), t.blurred = !0, i.hide().parent.blur(); }; }), R.open(function(s) { s.keystroke = function(r, t) { this.cursor.parent.keystroke(r, t, this); }; }), I.open(function(s) { s.keystroke = function(r, t, e) { var i = e.cursor; switch (r) { case "Ctrl-Shift-Backspace": case "Ctrl-Backspace": e.ctrlDeleteDir(u); break; case "Shift-Backspace": case "Backspace": e.backspace(); break; case "Esc": case "Tab": return void e.escapeDir(1, r, t); case "Shift-Tab": case "Shift-Esc": return void e.escapeDir(u, r, t); case "End": e.notify("move").cursor.insAtRightEnd(i.parent); break; case "Ctrl-End": e.notify("move").cursor.insAtRightEnd(e.root); break; case "Shift-End": for (; i[1]; ) e.selectRight(); break; case "Ctrl-Shift-End": for (; i[1] || i.parent !== e.root; ) e.selectRight(); break; case "Home": e.notify("move").cursor.insAtLeftEnd(i.parent); break; case "Ctrl-Home": e.notify("move").cursor.insAtLeftEnd(e.root); break; case "Shift-Home": for (; i[u]; ) e.selectLeft(); break; case "Ctrl-Shift-Home": for (; i[u] || i.parent !== e.root; ) e.selectLeft(); break; case "Left": e.moveLeft(); break; case "Shift-Left": e.selectLeft(); break; case "Ctrl-Left": break; case "Right": e.moveRight(); break; case "Shift-Right": e.selectRight(); break; case "Ctrl-Right": break; case "Up": e.moveUp(); break; case "Down": e.moveDown(); break; case "Shift-Up": if (i[u]) for (; i[u]; ) e.selectLeft(); else e.selectLeft(); case "Shift-Down": if (i[1]) for (; i[1]; ) e.selectRight(); else e.selectRight(); case "Ctrl-Up": case "Ctrl-Down": break; case "Ctrl-Shift-Del": case "Ctrl-Del": e.ctrlDeleteDir(1); break; case "Shift-Del": case "Del": e.deleteForward(); break; case "Meta-A": case "Ctrl-A": for (e.notify("move").cursor.insAtRightEnd(e.root); i[u]; ) e.selectLeft(); break; default: return; } t.preventDefault(), e.scrollHoriz(); }, s.moveOutOf = s.moveTowards = s.deleteOutOf = s.deleteTowards = s.unselectInto = s.selectOutOf = s.selectTowards = function() { }; }), R.open(function(s) { function r(t, e) { var i = t.notify("upDown").cursor, a = e + "Into", o = e + "OutOf"; return i[1][a] ? i.insAtLeftEnd(i[1][a]) : i[u][a] ? i.insAtRightEnd(i[u][a]) : i.parent.bubble(function(c) { var l = c[o]; if (l && (typeof l == "function" && (l = c[o](i)), l instanceof I && i.jumpUpDown(c, l), l !== !0)) return !1; }), t; } this.onNotify(function(t) { t !== "move" && t !== "upDown" || this.show().clearSelection(); }), s.escapeDir = function(t, e, i) { var a = this.cursor; if (a.parent !== this.root && i.preventDefault(), a.parent !== this.root) return a.parent.moveOutOf(t, a), this.notify("move"); }, rt.leftRightIntoCmdGoes = function(t) { if (t && t !== "up" && t !== "down") throw '"up" or "down" required for leftRightIntoCmdGoes option, got "' + t + '"'; return t; }, s.moveDir = function(t) { var e = this.cursor, i = e.options.leftRightIntoCmdGoes; return e.selection ? e.insDirOf(t, e.selection.ends[t]) : e[t] ? e[t].moveTowards(t, e, i) : e.parent.moveOutOf(t, e, i), this.notify("move"); }, s.moveLeft = function() { return this.moveDir(u); }, s.moveRight = function() { return this.moveDir(1); }, s.moveUp = function() { return r(this, "up"); }, s.moveDown = function() { return r(this, "down"); }, this.onNotify(function(t) { t !== "upDown" && (this.upDownCache = {}); }), this.onNotify(function(t) { t === "edit" && this.show().deleteSelection(); }), s.deleteDir = function(t) { var e = this.cursor, i = e.selection; return this.notify("edit"), i || (e[t] ? e[t].deleteTowards(t, e) : e.parent.deleteOutOf(t, e)), e[u].siblingDeleted && e[u].siblingDeleted(e.options, 1), e[1].siblingDeleted && e[1].siblingDeleted(e.options, u), e.parent.bubble("reflow"), this; }, s.ctrlDeleteDir = function(t) { var e = this.cursor; return !e[t] || e.selection ? this.deleteDir(t) : (this.notify("edit"), t === u ? D(e.parent.ends[u], e[u]).remove() : D(e[1], e.parent.ends[1]).remove(), e.insAtDirEnd(t, e.parent), e[u].siblingDeleted && e[u].siblingDeleted(e.options, 1), e[1].siblingDeleted && e[1].siblingDeleted(e.options, u), e.parent.bubble("reflow"), this); }, s.backspace = function() { return this.deleteDir(u); }, s.deleteForward = function() { return this.deleteDir(1); }, this.onNotify(function(t) { t !== "select" && this.endSelection(); }), s.selectDir = function(t) { var e = this.notify("select").cursor, i = e.selection; e.anticursor || e.startSelection(); var a = e[t]; a ? i && i.ends[t] === a && e.anticursor[-t] !== a ? a.unselectInto(t, e) : a.selectTowards(t, e) : e.parent.selectOutOf(t, e), e.clearSelection(), e.select() || e.show(); }, s.selectLeft = function() { return this.selectDir(u); }, s.selectRight = function() { return this.selectDir(1); }; }); var j = function() { function s(O) { for (var S = O[0] || Q(), A = 1; A < O.length; A += 1) O[A].children().adopt(S, S.ends[1], 0); return S; } var r = x.string, t = x.regex, e = x.letter, i = x.any, a = x.optWhitespace, o = x.succeed, c = x.fail, l = e.map(function(O) { return P(O); }), p = t(/^[^${}\\_^]/).map(function(O) { return f(O); }), d = t(/^[^\\a-eg-zA-Z]/).or(r("\\").then(t(/^[a-z]+/i).or(t(/^\s+/).result(" ")).or(i))).then(function(O) { var S = n[O]; return S ? S(O).parser() : c("unknown command: \\" + O); }).or(l).or(p), g = r("{").then(function() { return q; }).skip(r("}")), w = a.then(g.or(d.map(function(O) { var S = Q(); return O.adopt(S, 0, 0), S; }))), q = w.many().map(s).skip(a), v = r("[").then(w.then(function(O) { return O.join("latex") !== "]" ? o(O) : c(); }).many().map(s).skip(a)).skip(r("]")), y = q; return y.block = w, y.optBlock = v, y; }(); R.open(function(s, r) { s.exportLatex = function() { return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi, "$1"); }, s.writeLatex = function(t) { var e = this.notify("edit").cursor, i = x.all, a = x.eof, o = j.skip(a).or(i.result(!1)).parse(t); return o && !o.isEmpty() && (o.children().adopt(e.parent, e[u], e[1]), o.jQize().insertBefore(e.jQ), e[u] = o.ends[1], o.finalizeInsert(e.options, e), o.ends[1][1].siblingCreated && o.ends[1][1].siblingCreated(e.options, u), o.ends[u][u].siblingCreated && o.ends[u][u].siblingCreated(e.options, 1), e.parent.bubble("reflow")), this; }, s.renderLatexMath = function(t) { var e = this.root, i = this.cursor, a = x.all, o = x.eof, c = j.skip(o).or(a.result(!1)).parse(t); e.eachChild("postOrder", "dispose"), e.ends[u] = e.ends[1] = 0, c && c.children().adopt(e, 0, 0); var l = e.jQ; if (c) { var p = c.join("html"); l.html(p), e.jQize(l.children()), e.finalizeInsert(i.options); } else l.empty(); delete i.selection, i.insAtRightEnd(e); }, s.renderLatexText = function(t) { var e = this.root, i = this.cursor; e.jQ.children().slice(1).remove(), e.eachChild("postOrder", "dispose"), e.ends[u] = e.ends[1] = 0, delete i.selection, i.show().insAtRightEnd(e); var a = x.regex, o = x.string, c = x.eof, l = x.all, p = o("$").then(j).skip(o("$").or(c)).map(function(q) { var v = It(i); v.createBlocks(); var y = v.ends[u]; return q.children().adopt(y, 0, 0), v; }), d = o("\\$").result("$").or(a(/^[^$]/)).map(f), g = p.or(d).many().skip(c).or(l.result(!1)).parse(t); if (g) { for (var w = 0; w < g.length; w += 1) g[w].adopt(e, e.ends[1], 0); e.jQize().appendTo(e.jQ), e.finalizeInsert(i.options); } }; }), R.open(function(s) { W.p.ignoreNextMousedown = L, s.delegateMouseEvents = function() { var r = this.root.jQ; this.container.bind("mousedown.mathquill", function(t) { var e, i = T(t.target).closest(".mq-root-block"), a = I.byId[i.attr(z) || r.attr(z)].controller, o = a.cursor, c = o.blink, l = a.textareaSpan, p = a.textarea; t.preventDefault(), t.target.unselectable = !0, o.options.ignoreNextMousedown(t) || (o.options.ignoreNextMousedown = L, a.blurred && (a.editable || i.prepend(l), p.focus()), o.blink = L, a.seek(T(t.target), t.pageX, t.pageY).cursor.startSelection(), i.mousemove(d), T(t.target.ownerDocument).mousemove(g).mouseup(function w(q) { o.blink = c, o.selection || (a.editable ? o.show() : l.detach()), i.unbind("mousemove", d), T(q.target.ownerDocument).unbind("mousemove", g).unbind("mouseup", w); })); function d(w) { e = T(w.target); } function g(w) { o.anticursor || o.startSelection(), a.seek(e, w.pageX, w.pageY).cursor.select(), e = X; } }); }; }), R.open(function(s) { s.seek = function(r, t, e) { var i = this.notify("select").cursor; if (r) { var a = r.attr(z) || r.attr(Ot); if (!a) { var o = r.parent(); a = o.attr(z) || o.attr(Ot); } } var c = a ? I.byId[a] : this.root; return i.clearSelection().show(), c.seek(t, i), this.scrollHoriz(), this; }; }), R.open(function(s) { s.scrollHoriz = function() { var r = this.cursor, t = r.selection, e = this.root.jQ[0].getBoundingClientRect(); if (t) { var i = t.jQ[0].getBoundingClientRect(), a = i.left - (e.left + 20), o = i.right - (e.right - 20); if (t.ends[u] === r[1]) if (a < 0) l = a; else { if (!(o > 0)) return; i.left - o < e.left + 20 ? l = a : l = o; } else if (o > 0) l = o; else { if (!(a < 0)) return; i.right - a > e.right - 20 ? l = o : l = a; } } else { var c = r.jQ[0].getBoundingClientRect().left; if (c > e.right - 20) var l = c - (e.right - 20); else { if (!(c < e.left + 20)) return; var l = c - (e.left + 20); } } this.root.jQ.stop().animate({ scrollLeft: "+=" + l }, 100); }; }), R.open(function(s) { W.p.substituteTextarea = function() { return T("<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />")[0]; }, s.createTextarea = function() { var r = this.textareaSpan = T('<span class="mq-textarea"></span>'), t = this.options.substituteTextarea(); if (!t.nodeType) throw "substituteTextarea() must return a DOM element, got " + t; t = this.textarea = T(t).appendTo(r); var e = this; e.cursor.selectionChanged = function() { e.selectionChanged(); }; }, s.selectionChanged = function() { var r = this; Ft(r.container[0]), r.textareaSelectionTimeout === X && (r.textareaSelectionTimeout = setTimeout(function() { r.setTextareaSelection(); })), r.handle("select"); }, s.setTextareaSelection = function() { this.textareaSelectionTimeout = X; var r = ""; this.cursor.selection && (r = this.cursor.selection.join("latex"), this.options.statelessClipboard && (r = "$" + r + "$")), this.selectFn(r); }, s.staticMathTextareaEvents = function() { var r = this, t = (r.root, r.cursor), e = r.textarea, i = r.textareaSpan; function a() { i.detach(), r.blurred = !0; } this.container.prepend($('<span class="mq-selectable">').text("$" + r.exportLatex() + "$")), r.blurred = !0, e.bind("cut paste", !1).bind("copy", function() { r.setTextareaSelection(); }).focus(function() { r.blurred = !1; }).blur(function() { t.selection && t.selection.clear(), setTimeout(a); }), r.selectFn = function(o) { e.val(o), o && e.select(); }; }, W.p.substituteKeyboardEvents = Lt, s.editablesTextareaEvents = function() { var r = this.textarea, t = this.textareaSpan, e = this.options.substituteKeyboardEvents(r, this); this.selectFn = function(i) { e.select(i); }, this.container.prepend(t), this.focusBlurEvents(); }, s.typedText = function(r) { if (r === ` `) return this.handle("enter"); var t = this.notify().cursor; t.parent.write(t, r), !t[1] && t.parent.jQ.hasClass("overfrown") && t.parent.jQ.children("[mathquill-command-id]").length >= 3 && this.moveRight(), this.scrollHoriz(); }, s.cut = function() { var r = this, t = r.cursor; t.selection && setTimeout(function() { r.notify("edit"), t.parent.bubble("reflow"); }); }, s.copy = function() { this.setTextareaSelection(); }, s.paste = function(r) { this.options.statelessClipboard && (r = r.slice(0, 1) === "$" && r.slice(-1) === "$" ? r.slice(1, -1) : "\\text{" + r + "}"); var t = this.notify("edit").cursor; T(t.parent.jQ[0])[0].className.indexOf("mq-text-mode") == -1 && this.writeLatex(r).cursor.show(); }; }); var At = m(I, function(s, r) { s.finalizeInsert = function(t, e) { var i = this; i.postOrder("finalizeTree", t), i.postOrder("contactWeld", e), i.postOrder("blur"), i.postOrder("reflow"), i[1].siblingCreated && i[1].siblingCreated(t, u), i[u].siblingCreated && i[u].siblingCreated(t, 1), i.bubble("reflow"); }; }), b = m(At, function(s, r) { s.init = function(t, e, i) { var a = this; r.init.call(a), a.ctrlSeq || (a.ctrlSeq = t), e && (a.htmlTemplate = e), i && (a.textTemplate = i); }, s.replaces = function(t) { t.disown(), this.replacedFragment = t; }, s.isEmpty = function() { return this.foldChildren(!0, function(t, e) { return t && e.isEmpty(); }); }, s.parser = function() { var t = j.block, e = this; return t.times(e.numBlocks()).map(function(i) { e.blocks = i; for (var a = 0; a < i.length; a += 1) i[a].adopt(e, e.ends[1], 0); return e; }); }, s.createLeftOf = function(t) { var e = this, i = e.replacedFragment; e.createBlocks(), r.createLeftOf.call(e, t), i && (i.adopt(e.ends[u], 0, 0), i.jQ.appendTo(e.ends[u].jQ)), e.finalizeInsert(t.options), e.placeCursor(t); }, s.createBlocks = function() { for (var t = this, e = t.numBlocks(), i = t.blocks = Array(e), a = 0; a < e; a += 1) (i[a] = Q()).adopt(t, t.ends[1], 0); }, s.placeCursor = function(t) { t.insAtRightEnd(this.foldChildren(this.ends[u], function(e, i) { return e.isEmpty() ? e : i; })); }, s.moveTowards = function(t, e, i) { var a = i && this[i + "Into"]; e.insAtDirEnd(-t, a || this.ends[-t]); }, s.deleteTowards = function(t, e) { this.isEmpty() ? e[t] = this.remove()[t] : this.moveTowards(t, e, null); }, s.selectTowards = function(t, e) { e[-t] = this, e[t] = this[t]; }, s.selectChildren = function() { return jt(this, this); }, s.unselectInto = function(t, e) { e.insAtDirEnd(-t, e.anticursor.ancestors[this.id]); }, s.seek = function(t, e) { function i(l) { var p = {}; return p[u] = l.jQ.offset().left, p[1] = p[u] + l.jQ.outerWidth(), p; } var a = this, o = i(a); if (t < o[u]) return e.insLeftOf(a); if (t > o[1]) return e.insRightOf(a); var c = o[u]; a.eachChild(function(l) { var p = i(l); return t < p[u] ? (t - c < p[u] - t ? l[u] ? e.insAtRightEnd(l[u]) : e.insLeftOf(a) : e.insAtLeftEnd(l), !1) : t > p[1] ? void (l[1] ? c = p[1] : o[1] - t < t - p[1] ? e.insRightOf(a) : e.insAtRightEnd(l)) : (l.seek(t, e), !1); }); }, s.numBlocks = function() { var t = this.htmlTemplate.match(/&\d+/g); return t ? t.length : 0; }, s.html = function() { var t = this, e = t.blocks, i = " mathquill-command-id=" + t.id, a = t.htmlTemplate.match(/<[^<>]+>|[^<>]+/g); a.join(""), this.htmlTemplate; for (var o = 0, c = a[0]; c; c = a[o += 1]) if (c.slice(-2) === "/>") a[o] = c.slice(0, -2) + i + "/>"; else if (c.charAt(0) === "<") { c.charAt(1), a[o] = c.slice(0, -1) + i + ">"; var l = 1; do (c = a[o += 1]).slice(0, 2) === "</" ? l -= 1 : c.charAt(0) === "<" && c.slice(-2) !== "/>" && (l += 1); while (l > 0); } return a.join("").replace(/>&(\d+)/g, function(p, d) { return " mathquill-block-id=" + e[d].id + ">" + e[d].join("html"); }); }, s.latex = function() { return this.foldChildren(this.ctrlSeq, function(t, e) { return t + "{" + (e.latex() || " ") + "}"; }); }, s.textTemplate = [""], s.text = function() { var t = this, e = 0; return t.foldChildren(t.textTemplate[e], function(i, a) { e += 1; var o = a.text(); return i && t.textTemplate[e] === "(" && o[0] === "(" && o.slice(-1) === ")" ? i + o.slice(1, -1) + t.textTemplate[e] : i + a.text() + (t.textTemplate[e] || ""); }); }; }), F = m(b, function(s, r) { s.init = function(t, e, i) { i || (i = t && t.length > 1 ? t.slice(1) : t), r.init.call(this, t, e, [i]); }, s.parser = function() { return x.succeed(this); }, s.numBlocks = function() { return 0; }, s.replaces = function(t) { t.remove(); }, s.createBlocks = L, s.moveTowards = function(t, e) { e.jQ.insDirOf(t, this.jQ), e[-t] = this, e[t] = this[t]; }, s.deleteTowards = function(t, e) { e[t] = this.remove()[t]; }, s.seek = function(t, e) { t - this.jQ.offset().left < this.jQ.outerWidth() / 2 ? e.insLeftOf(this) : e.insRightOf(this); }, s.latex = function() { return this.ctrlSeq; }, s.text = function() { return this.textTemplate; }, s.placeCursor = L, s.isEmpty = function() { return !0; }; }), f = m(F, function(s, r) { s.init = function(t, e) { r.init.call(this, t, "<span>" + (e || t) + "</span>"); }; }), k = m(F, function(s, r) { s.init = function(t, e, i) { r.init.call(this, t, '<span class="mq-binary-operator">' + e + "</span>", i); }; }), Q = m(At, function(s, r) { s.join = function(t) { return this.foldChildren("", function(e, i) { return e.indexOf("\\lbrace ") >= 0 && (e = e.replace(/\\lbrace /g, "\\begin{cases}")), e + i[t](); }); }, s.html = function() { return this.join("html"); }, s.latex = function() { return this.join("latex"); }, s.text = function() { return this.ends[u] === this.ends[1] && this.ends[u] !== 0 ? this.ends[u].text() : this.join("text"); }, s.keystroke = function(t, e, i) { return !i.options.spaceBehavesLikeTab || t !== "Spacebar" && t !== "Shift-Spacebar" ? r.keystroke.apply(this, arguments) : (e.preventDefault(), void i.escapeDir(t === "Shift-Spacebar" ? u : 1, t, e)); }, s.moveOutOf = function(t, e, i) { !(i && this.parent[i + "Into"]) && this[t] ? e.insAtDirEnd(-t, this[t]) : e.insDirOf(t, this.parent); }, s.selectOutOf = function(t, e) { e.insDirOf(t, this.parent); }, s.deleteOutOf = function(t, e) { e.unwrapGramp(); }, s.seek = function(t, e) { var i = this.ends[1]; if (!i || i.jQ.offset().left + i.jQ.outerWidth() < t) return e.insAtRightEnd(this); if (t < this.ends[u].jQ.offset().left) return e.insAtLeftEnd(this); for (; t < i.jQ.offset().left; ) i = i[u]; return i.seek(t, e); }, s.chToCmd = function(t, e) { var i; return t.match(/^[a-zA-Z]$/) ? P(t) : /^\d$/.test(t) ? Yt(t) : e && e.typingSlashWritesDivisionSymbol && t === "/" ? n["÷"](t) : e && e.typingAsteriskWritesTimesSymbol && t === "*" ? n["×"](t) : (i = Y[t] || n[t]) ? i(t) : f(t); }, s.write = function(t, e) { var i = this.chToCmd(e, t.options); t.selection && i.replaces(t.replaceSelection()), i.createLeftOf(t.show()); }, s.focus = function() { return window.$currentJQ = this.jQ, this.jQ.addClass("mq-hasCursor"), this.jQ.removeClass("mq-empty"), this.isEmpty() && this.jQ.addClass("mq-outLine"), this; }, s.blur = function() { return this.jQ.removeClass("mq-hasCursor"), this.jQ.removeClass("mq-outLine"), this.isEmpty() && this.jQ.addClass("mq-empty"), this; }; }); Z.StaticMath = function(s) { return m(s.AbstractMathQuill, function(r, t) { this.RootBlock = Q, r.__mathquillify = function(e, i) { return this.config(e), t.__mathquillify.call(this, "mq-math-mode"), this.__controller.delegateMouseEvents(), this.__controller.staticMathTextareaEvents(), this; }, r.init = function() { t.init.apply(this, arguments), this.__controller.root.postOrder("registerInnerField", this.innerFields = [], s.MathField); }, r.latex = function() { var e = t.latex.apply(this, arguments); return arguments.length > 0 && this.__controller.root.postOrder("registerInnerField", this.innerFields = [], s.MathField), e; }; }); }; var zt = m(Q, Dt); Z.MathField = function(s) { return m(s.EditableField, function(r, t) { this.RootBlock = zt, r.__mathquillify = function(e, i) { return this.config(e), i > 1 && (this.__controller.root.reflow = L), t.__mathquillify.call(this, "mq-editable-field mq-math-mode"), delete this.__controller.root.reflow, this; }; }); }; var tt = m(I, function(s, r) { function t(e) { e.jQ[0].normalize(); var i = e.jQ[0].firstChild; if (i) { i.nodeType; var a = V(i.data); return a.jQadd(i), e.children().disown(), a.adopt(e, 0, 0); } } s.ctrlSeq = "\\text", s.replaces = function(e) { e instanceof D ? this.replacedText = e.remove().jQ.text() : typeof e == "string" && (this.replacedText = e); }, s.jQa