\n\n";
}), e = e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function(e, t, n) {
var i = t.length;
return "" + a(n) + "\n\n";
});
}
function f(e, t) {
e += "~0";
var n = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
return B ? e = e.replace(n, function(e, n, i) {
var r = n, o = i.search(/[*+-]/g) > -1 ? "ul" : "ol", a = m(r, o, t);
return a = a.replace(/\s+$/, ""), a = "<" + o + ">" + a + "" + o + ">\n";
}) : (n = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,
e = e.replace(n, function(e, t, n, i) {
var r = t, o = n, a = i.search(/[*+-]/g) > -1 ? "ul" : "ol", s = m(o, a);
return s = r + "<" + a + ">\n" + s + "" + a + ">\n";
})), e = e.replace(/~0/, "");
}
function m(e, t, n) {
B++, e = e.replace(/\n{2,}$/, "\n"), e += "~0";
var i = $[t], r = new RegExp("(^[ \\t]*)(" + i + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + i + ")[ \\t]+))", "gm"), s = !1;
return e = e.replace(r, function(e, t, i, r) {
var l = r, c = /\n\n$/.test(l), u = c || l.search(/\n{2,}/) > -1;
return u || s ? l = o(I(l), !0) : (l = f(I(l), !0), l = l.replace(/\n$/, ""), n || (l = a(l))),
s = c, "
" + l + "
\n";
}), e = e.replace(/~0/g, ""), B--, e;
}
function g(e) {
return e += "~0", e = e.replace(/(?:\n\n|^\n?)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g, function(e, t, n) {
var i = t, r = n;
return i = y(I(i)), i = D(i), i = i.replace(/^\n+/g, ""), i = i.replace(/\n+$/g, ""),
i = "
" + i + "\n
", "\n\n" + i + "\n\n" + r;
}), e = e.replace(/~0/, "");
}
function v(e) {
return e = e.replace(/(^\n+|\n+$)/g, ""), "\n\n~K" + (F.push(e) - 1) + "K\n\n";
}
function b(e) {
return e = e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function(e, t, n, i) {
var r = i;
return r = r.replace(/^([ \t]*)/g, ""), r = r.replace(/[ \t]*$/g, ""), r = y(r),
r = r.replace(/:\/\//g, "~P"), t + "" + r + "";
});
}
function y(e) {
return e = e.replace(/&/g, "&"), e = e.replace(//g, ">"),
e = M(e, "*_{}[]\\", !1);
}
function x(e) {
return e = e.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g, "$1$3$4"),
e = e.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g, "$1$3$4");
}
function w(e) {
return e = e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function(e, t) {
var n = t;
return n = n.replace(/^[ \t]*>[ \t]?/gm, "~0"), n = n.replace(/~0/g, ""), n = n.replace(/^[ \t]+$/gm, ""),
n = o(n), n = n.replace(/(^|\n)/g, "$1 "), n = n.replace(/(\s*
[^\r]+?<\/pre>)/gm, function(e, t) {
var n = t;
return n = n.replace(/^ /gm, "~0"), n = n.replace(/~0/g, "");
}), v("
\n" + n + "\n
");
});
}
function S(e, t) {
e = e.replace(/^\n+/g, ""), e = e.replace(/\n+$/g, "");
for (var n = e.split(/\n{2,}/g), i = [], r = /~K(\d+)K/, o = n.length, s = 0; o > s; s++) {
var l = n[s];
r.test(l) ? i.push(l) : /\S/.test(l) && (l = a(l), l = l.replace(/^([ \t]*)/g, "
"),
l += "
", i.push(l));
}
if (!t) {
o = i.length;
for (var s = 0; o > s; s++) for (var c = !0; c; ) c = !1, i[s] = i[s].replace(/~K(\d+)K/g, function(e, t) {
return c = !0, F[t];
});
}
return i.join("\n\n");
}
function C(e) {
return e = e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), e = e.replace(/<(?![a-z\/?!]|~D)/gi, "<");
}
function _(e) {
return e = e.replace(/\\(\\)/g, L), e = e.replace(/\\([`*_{}\[\]()>#+-.!])/g, L);
}
function k(e, t, n, i) {
if (t) return e;
if (")" !== i.charAt(i.length - 1)) return "<" + n + i + ">";
for (var r = i.match(/[()]/g), o = 0, a = 0; a < r.length; a++) "(" === r[a] ? 0 >= o ? o = 1 : o++ : o--;
var s = "";
if (0 > o) {
var l = new RegExp("\\){1," + -o + "}$");
i = i.replace(l, function(e) {
return s = e, "";
});
}
if (s) {
var c = i.charAt(i.length - 1);
U.test(c) || (s = c + s, i = i.substr(0, i.length - 1));
}
return "<" + n + i + ">" + s;
}
function E(e) {
e = e.replace(H, k);
var t = function(e, t) {
return '' + R.plainLinkText(t) + "";
};
return e = e.replace(/<((https?|ftp):[^'">\s]+)>/gi, t);
}
function T(e) {
return e = e.replace(/~E(\d+)E/g, function(e, t) {
var n = parseInt(t);
return String.fromCharCode(n);
});
}
function I(e) {
return e = e.replace(/^(\t|[ ]{1,4})/gm, "~0"), e = e.replace(/~0/g, "");
}
function D(e) {
if (!/\t/.test(e)) return e;
var t, n = [ " ", " ", " ", " " ], i = 0;
return e.replace(/[\n\t]/g, function(e, r) {
return "\n" === e ? (i = r + 1, e) : (t = (r - i) % 4, i = r + 1, n[t]);
});
}
function N(e) {
if (!e) return "";
e.length;
return e.replace(z, function(e) {
return "~D" == e ? "%24" : ":" == e ? ":" : "%" + e.charCodeAt(0).toString(16);
});
}
function M(e, t, n) {
var i = "([" + t.replace(/([\[\]\\])/g, "\\$1") + "])";
n && (i = "\\\\" + i);
var r = new RegExp(i, "g");
return e = e.replace(r, L);
}
function L(e, t) {
var n = t.charCodeAt(0);
return "~E" + n + "E";
}
var A = {};
this.setOptions = function(e) {
A = e;
};
var R = this.hooks = new n();
R.addNoop("plainLinkText"), R.addNoop("preConversion"), R.addNoop("postNormalization"),
R.addNoop("preBlockGamut"), R.addNoop("postBlockGamut"), R.addNoop("preSpanGamut"),
R.addNoop("postSpanGamut"), R.addNoop("postConversion");
var P, O, F, B;
this.makeHtml = function(n) {
if (P) throw new Error("Recursive call to converter.makeHtml");
return P = new i(), O = new i(), F = [], B = 0, n = R.preConversion(n), n = n.replace(/~/g, "~T"),
n = n.replace(/\$/g, "~D"), n = n.replace(/\r\n/g, "\n"), n = n.replace(/\r/g, "\n"),
n = "\n\n" + n + "\n\n", n = D(n), n = n.replace(/^[ \t]+$/gm, ""), n = R.postNormalization(n),
n = t(n), n = e(n), n = o(n), n = T(n), n = n.replace(/~D/g, "$$"), n = n.replace(/~T/g, "~"),
n = R.postConversion(n), F = O = P = null, n;
};
var j = function(e) {
return o(e);
}, $ = {
ol: "\\d+[.]",
ul: "[*+-]"
}, q = "[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]", G = "[-A-Z0-9+&@#/%=~_|[\\])]", H = new RegExp('(="|<)?\\b(https?|ftp)(://' + q + "*" + G + ")(?=$|\\W)", "gi"), U = new RegExp(G, "i"), z = /(?:["'*()[\]:]|~D)/g;
};
}(), define("libs/Markdown.Converter", function() {}), function() {
function e(e) {
return e.replace(/^\s+|\s+$/g, "");
}
function t(e) {
return e.replace(/\s+$/g, "");
}
function n(e) {
return e.replace(new RegExp("^(\\t|[ ]{1,4})", "gm"), "");
}
function i(e, t) {
return -1 != e.indexOf(t);
}
function r(e, t) {
return e.replace(/<[^>]*>?/gi, function(e) {
return e.match(t) ? e : "";
});
}
function o(e, t) {
for (var n = {}, i = 0; i < e.length; i++) n[e[i]] = e[i];
for (i = 0; i < t.length; i++) n[t[i]] = t[i];
var r = [];
for (var o in n) n.hasOwnProperty(o) && r.push(n[o]);
return r;
}
function a(e) {
return "" != e.charAt(0) && (e = "" + e), "" != e.charAt(e.length - 1) && (e += ""),
e;
}
function s(e) {
return "" == e.charAt(0) && (e = e.substr(1)), "" == e.charAt(e.length - 1) && (e = e.substr(0, e.length - 1)),
e;
}
function l(e, t) {
return r(c(e, t), m);
}
function c(e, t) {
var n = t.blockGamutHookCallback(e);
return n = p(n), n = n.replace(/~D/g, "$$").replace(/~T/g, "~"), n = t.previousPostConversion(n);
}
function u(e) {
return e.replace(/\\\|/g, "~I").replace(/\\:/g, "~i");
}
function d(e) {
return e.replace(/~I/g, "|").replace(/~i/g, ":");
}
function p(e) {
return e = e.replace(/~E(\d+)E/g, function(e, t) {
var n = parseInt(t);
return String.fromCharCode(n);
});
}
function h(e) {
return e.toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
}
function f(e, t) {
var n = t;
return n = n.replace(/&\#8220;/g, '"'), n = n.replace(/&\#8221;/g, '"'), n = n.replace(/&\#8216;/g, "'"),
n = n.replace(/&\#8217;/g, "'"), n = n.replace(/&\#8212;/g, "---"), n = n.replace(/&\#8211;/g, "--"),
n = n.replace(/&\#8230;/g, "...");
}
var m = new RegExp([ "^(<\\/?(a|abbr|acronym|applet|area|b|basefont|", "bdo|big|button|cite|code|del|dfn|em|figcaption|", "font|i|iframe|img|input|ins|kbd|label|map|", "mark|meter|object|param|progress|q|ruby|rp|rt|s|", "samp|script|select|small|span|strike|strong|", "sub|sup|textarea|time|tt|u|var|wbr)[^>]*>|", "<(br)\\s?\\/?>)$" ].join(""), "i");
Array.indexOf || (Array.prototype.indexOf = function(e) {
for (var t = 0; t < this.length; t++) if (this[t] == e) return t;
return -1;
}), Markdown.Extra = function() {
this.converter = null, this.hashBlocks = [], this.footnotes = {}, this.usedFootnotes = [],
this.attributeBlocks = !1, this.googleCodePrettify = !1, this.highlightJs = !1,
this.tableClass = "", this.tabWidth = 4;
}, Markdown.Extra.init = function(e, t) {
var n = new Markdown.Extra(), r = [], o = [], a = [], s = [ "unHashExtraBlocks" ];
return t = t || {}, t.extensions = t.extensions || [ "all" ], i(t.extensions, "all") && (t.extensions = [ "tables", "fenced_code_gfm", "def_list", "attr_list", "footnotes", "smartypants", "strikethrough", "newlines" ]),
o.push("wrapHeaders"), i(t.extensions, "attr_list") && (r.push("hashFcbAttributeBlocks"),
o.push("hashHeaderAttributeBlocks"), s.push("applyAttributeBlocks"), n.attributeBlocks = !0),
i(t.extensions, "fenced_code_gfm") && (o.push("fencedCodeBlocks"), r.push("fencedCodeBlocks")),
i(t.extensions, "tables") && o.push("tables"), i(t.extensions, "def_list") && o.push("definitionLists"),
i(t.extensions, "footnotes") && (r.push("stripFootnoteDefinitions"), o.push("doFootnotes"),
s.push("printFootnotes")), i(t.extensions, "smartypants") && s.push("runSmartyPants"),
i(t.extensions, "strikethrough") && a.push("strikethrough"), i(t.extensions, "newlines") && a.push("newlines"),
e.hooks.chain("postNormalization", function(e) {
return n.doTransform(r, e) + "\n";
}), e.hooks.chain("preBlockGamut", function(e, t) {
return n.blockGamutHookCallback = t, e = u(e), e = n.doTransform(o, e) + "\n", e = d(e);
}), e.hooks.chain("postSpanGamut", function(e) {
return n.doTransform(a, e);
}), n.previousPostConversion = e.hooks.postConversion, e.hooks.chain("postConversion", function(e) {
return e = n.doTransform(s, e), n.hashBlocks = [], n.footnotes = {}, n.usedFootnotes = [],
e;
}), "highlighter" in t && (n.googleCodePrettify = "prettify" === t.highlighter,
n.highlightJs = "highlight" === t.highlighter), "table_class" in t && (n.tableClass = t.table_class),
n.converter = e, n;
}, Markdown.Extra.prototype.doTransform = function(e, t) {
for (var n = 0; n < e.length; n++) t = this[e[n]](t);
return t;
}, Markdown.Extra.prototype.hashExtraBlock = function(e) {
return "\n
~X" + (this.hashBlocks.push(e) - 1) + "X
\n";
}, Markdown.Extra.prototype.hashExtraInline = function(e) {
return "~X" + (this.hashBlocks.push(e) - 1) + "X";
}, Markdown.Extra.prototype.unHashExtraBlocks = function(e) {
function t() {
var i = !1;
e = e.replace(/(?:
)?~X(\d+)X(?:<\/p>)?/g, function(e, t) {
i = !0;
var r = parseInt(t, 10);
return n.hashBlocks[r];
}), i === !0 && t();
}
var n = this;
return t(), e;
}, Markdown.Extra.prototype.wrapHeaders = function(e) {
function t(e) {
return "\n" + e + "\n";
}
return e = e.replace(/^.+[ \t]*\n=+[ \t]*\n+/gm, t), e = e.replace(/^.+[ \t]*\n-+[ \t]*\n+/gm, t),
e = e.replace(/^\#{1,6}[ \t]*.+?[ \t]*\#*\n+/gm, t);
};
var g = "\\{[ \\t]*((?:[#.][-_:a-zA-Z0-9]+[ \\t]*)+)\\}", v = new RegExp("^(#{1,6}.*#{0,6})[ \\t]+" + g + "[ \\t]*(?:\\n|0x03)", "gm"), b = new RegExp("^(.*)[ \\t]+" + g + "[ \\t]*\\n(?=[\\-|=]+\\s*(?:\\n|0x03))", "gm"), y = new RegExp("^(```[^`\\n]*)[ \\t]+" + g + "[ \\t]*\\n(?=([\\s\\S]*?)\\n```[ \\t]*(\\n|0x03))", "gm");
Markdown.Extra.prototype.hashHeaderAttributeBlocks = function(e) {
function t(e, t, i) {
return "
~XX" + (n.hashBlocks.push(i) - 1) + "XX
\n" + t + "\n";
}
var n = this;
return e = e.replace(v, t), e = e.replace(b, t);
}, Markdown.Extra.prototype.hashFcbAttributeBlocks = function(e) {
function t(e, t, i) {
return "
~XX" + (n.hashBlocks.push(i) - 1) + "XX
\n" + t + "\n";
}
var n = this;
return e.replace(y, t);
}, Markdown.Extra.prototype.applyAttributeBlocks = function(e) {
var t = this, n = new RegExp('
~XX(\\d+)XX
[\\s]*(?:<(h[1-6]|pre)(?: +class="(\\S+)")?(>[\\s\\S]*?\\2>))', "gm");
return e = e.replace(n, function(e, n, i, r, a) {
if (!i) return "";
for (var s = parseInt(n, 10), l = t.hashBlocks[s], c = l.match(/#[^\s#.]+/g) || [], u = c[0] ? ' id="' + c[0].substr(1, c[0].length - 1) + '"' : "", d = l.match(/\.[^\s#.]+/g) || [], p = 0; p < d.length; p++) d[p] = d[p].substr(1, d[p].length - 1);
var h = "";
return r && (d = o(d, [ r ])), d.length > 0 && (h = ' class="' + d.join(" ") + '"'),
"<" + i + u + h + a;
});
}, Markdown.Extra.prototype.tables = function(t) {
function n(t, n, r, o) {
n = n.replace(/^ *[|]/m, ""), r = r.replace(/^ *[|]/m, ""), o = o.replace(/^ *[|]/gm, ""),
n = n.replace(/[|] *$/m, ""), r = r.replace(/[|] *$/m, ""), o = o.replace(/[|] *$/gm, ""),
alignspecs = r.split(/ *[|] */), align = [];
for (var a = 0; a < alignspecs.length; a++) {
var s = alignspecs[a];
align[a] = s.match(/^ *-+: *$/m) ? ' align="right"' : s.match(/^ *:-+: *$/m) ? ' align="center"' : s.match(/^ *:-+ *$/m) ? ' align="left"' : "";
}
var c = n.split(/ *[|] */), u = c.length, d = i.tableClass ? ' class="' + i.tableClass + '"' : "", p = [ "
\n", "\n", "
\n" ].join("");
for (a = 0; u > a; a++) {
var h = l(e(c[a]), i);
p += [ "
", h, "
\n" ].join("");
}
p += "
\n\n";
var f = o.split("\n");
for (a = 0; a < f.length; a++) if (!f[a].match(/^\s*$/)) {
for (var m = f[a].split(/ *[|] */), g = u - m.length, v = 0; g > v; v++) m.push("");
for (p += "
\n", v = 0; u > v; v++) {
var b = l(e(m[v]), i);
p += [ "
", b, "
\n" ].join("");
}
p += "
\n";
}
return p += "
\n", i.hashExtraBlock(p);
}
var i = this, r = new RegExp([ "^", "[ ]{0,3}", "[|]", "(.+)\\n", "[ ]{0,3}", "[|]([ ]*[-:]+[-| :]*)\\n", "(", "(?:[ ]*[|].*\\n?)*", ")", "(?:\\n|$)" ].join(""), "gm"), o = new RegExp([ "^", "[ ]{0,3}", "(\\S.*[|].*)\\n", "[ ]{0,3}", "([-:]+[ ]*[|][-| :]*)\\n", "(", "(?:.*[|].*\\n?)*", ")", "(?:\\n|$)" ].join(""), "gm");
return t = t.replace(r, n), t = t.replace(o, n);
}, Markdown.Extra.prototype.stripFootnoteDefinitions = function(e) {
var t = this;
return e = e.replace(/\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/g, function(e, n, i) {
return n = h(n), i += "\n", i = i.replace(/^[ ]{0,3}/g, ""), t.footnotes[n] = i,
"\n";
});
}, Markdown.Extra.prototype.doFootnotes = function(e) {
var t = this;
if (t.isConvertingFootnote === !0) return e;
var n = 0;
return e = e.replace(/\[\^(.+?)\]/g, function(e, i) {
var r = h(i), o = t.footnotes[r];
if (void 0 === o) return e;
n++, t.usedFootnotes.push(r);
var a = '' + n + "";
return t.hashExtraInline(a);
});
}, Markdown.Extra.prototype.printFootnotes = function(e) {
var t = this;
if (0 === t.usedFootnotes.length) return e;
e += '\n\n
\n\n\n\n';
for (var n = 0; n < t.usedFootnotes.length; n++) {
var i = t.usedFootnotes[n], r = t.footnotes[i];
t.isConvertingFootnote = !0;
var o = l(r, t);
delete t.isConvertingFootnote, e += '
";
}, Markdown.Extra.prototype.fencedCodeBlocks = function(t) {
function n(e) {
return e = e.replace(/&/g, "&"), e = e.replace(//g, ">"),
e = e.replace(/~D/g, "$$"), e = e.replace(/~T/g, "~");
}
var i = this;
return t = t.replace(/(?:^|\n)```([^`\n]*)\n([\s\S]*?)\n```[ \t]*(?=\n)/g, function(t, r, o) {
var a = e(r), s = o, l = i.googleCodePrettify ? ' class="prettyprint"' : "", c = "";
a && (c = i.googleCodePrettify || i.highlightJs ? ' class="language-' + a + '"' : ' class="' + a + '"');
var u = [ "
", n(s), "
" ].join("");
return i.hashExtraBlock(u);
});
}, Markdown.Extra.prototype.educatePants = function(e) {
var t = this, n = "", i = 0;
e.replace(/(?:)|(<)([a-zA-Z1-6]+)([^\n]*?>)([\s\S]*?)(<\/\2>)/g, function(r, o, a, s, l, c, u) {
var d = e.substring(i, u);
return n += t.applyPants(d), t.smartyPantsLastChar = n.substring(n.length - 1),
i = u + r.length, o ? (/code|kbd|pre|script|noscript|iframe|math|ins|del|pre/i.test(a) ? t.smartyPantsLastChar = l.substring(l.length - 1) : l = t.educatePants(l),
void (n += o + a + s + l + c)) : void (n += r);
});
var r = e.substring(i);
return n += t.applyPants(r), t.smartyPantsLastChar = n.substring(n.length - 1),
n;
}, Markdown.Extra.prototype.applyPants = function(e) {
return e = e.replace(/---/g, "—").replace(/--/g, "–"), e = e.replace(/\.\.\./g, "…").replace(/\.\s\.\s\./g, "…"),
e = e.replace(/``/g, "“").replace(/''/g, "”"), /^'$/.test(e) ? /\S/.test(this.smartyPantsLastChar) ? "’" : "‘" : /^"$/.test(e) ? /\S/.test(this.smartyPantsLastChar) ? "”" : "“" : (e = e.replace(/^'(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "’"),
e = e.replace(/^"(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "”"), e = e.replace(/"'(?=\w)/g, "“‘"),
e = e.replace(/'"(?=\w)/g, "‘“"), e = e.replace(/'(?=\d{2}s)/g, "’"),
e = e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)'(?=\w)/g, "$1‘"),
e = e.replace(/([^\s\[\{\(\-])'/g, "$1’"), e = e.replace(/'(?=\s|s\b)/g, "’"),
e = e.replace(/'/g, "‘"), e = e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)"(?=\w)/g, "$1“"),
e = e.replace(/([^\s\[\{\(\-])"/g, "$1”"), e = e.replace(/"(?=\s)/g, "”"),
e = e.replace(/"/gi, "“"));
}, Markdown.Extra.prototype.runSmartyPants = function(e) {
return this.smartyPantsLastChar = "", e = this.educatePants(e), e = e.replace(/(<([a-zA-Z1-6]+)\b([^\n>]*?)(\/)?>)/g, f);
}, Markdown.Extra.prototype.definitionLists = function(t) {
var n = new RegExp([ "(\\x02\\n?|\\n\\n)", "(?:", "(", "(", "[ ]{0,3}", "((?:[ \\t]*\\S.*\\n)+)", "\\n?", "[ ]{0,3}:[ ]+", ")", "([\\s\\S]+?)", "(", "(?=\\0x03)", "|", "(?=", "\\n{2,}", "(?=\\S)", "(?!", "[ ]{0,3}", "(?:\\S.*\\n)+?", "\\n?", "[ ]{0,3}:[ ]+", ")", "(?!", "[ ]{0,3}:[ ]+", ")", ")", ")", ")", ")" ].join(""), "gm"), i = this;
return t = a(t), t = t.replace(n, function(t, n, r) {
var o = e(i.processDefListItems(r));
return o = "
\n" + o + "\n
", n + i.hashExtraBlock(o) + "\n\n";
}), s(t);
}, Markdown.Extra.prototype.processDefListItems = function(i) {
var r = this, o = new RegExp([ "(\\x02\\n?|\\n\\n+)", "(", "[ ]{0,3}", "(?![:][ ]|[ ])", "(?:\\S.*\\n)+?", ")", "(?=\\n?[ ]{0,3}:[ ])" ].join(""), "gm"), u = new RegExp([ "\\n(\\n+)?", "(", "[ ]{0,3}", "[:][ ]+", ")", "([\\s\\S]+?)", "(?=\\n*", "(?:", "\\n[ ]{0,3}[:][ ]|", "
|\\x03", ")", ")" ].join(""), "gm");
return i = a(i), i = i.replace(/\n{2,}(?=\\x03)/, "\n"), i = i.replace(o, function(t, n, i) {
for (var o = e(i).split("\n"), a = "", s = 0; s < o.length; s++) {
var c = o[s];
c = l(e(c), r), a += "\n
" + c + "
";
}
return a + "\n";
}), i = i.replace(u, function(e, i, o, a) {
return i || a.match(/\n{2,}/) ? (a = Array(o.length + 1).join(" ") + a, a = n(a) + "\n\n",
a = "\n" + c(a, r) + "\n") : (a = t(a), a = l(n(a), r)), "\n
Allows StackEdit to interpret LaTeX mathematical expressions.
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\nMore info';
}), define("text!libs/mathjax_config.js", [], function() {
return 'MathJax.Hub.Config({\n skipStartupTypeset: true,\n "HTML-CSS": {\n preferredFont: "TeX",\n availableFonts: [\n "TeX"\n ],\n linebreaks: {\n automatic: true\n },\n EqnChunk: 10,\n imageFont: null\n },\n tex2jax: <%= tex2jax || \'{ inlineMath: [["$","$"],["\\\\\\\\\\\\\\\\(","\\\\\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\\\\\[","\\\\\\\\]"]], processEscapes: true }\' %>,\n TeX: $.extend({\n noUndefined: {\n attributes: {\n mathcolor: "red",\n mathbackground: "#FFEEEE",\n mathsize: "90%"\n }\n },\n Safe: {\n allow: {\n URLs: "safe",\n classes: "safe",\n cssIDs: "safe",\n styles: "safe",\n fontsize: "all"\n }\n }\n }, <%= tex %>),\n messageStyle: "none"\n});\n';
}), define("libs/mathjax_init", [ "settings", "text!libs/mathjax_config.js" ], function(e, t) {
var n = document.createElement("script");
n.type = "text/x-mathjax-config", n.innerHTML = _.template(t, {
tex: e.extensionSettings.mathJax ? e.extensionSettings.mathJax.tex : "undefined",
tex2jax: e.extensionSettings.mathJax ? e.extensionSettings.mathJax.tex2jax : void 0
}), document.getElementsByTagName("head")[0].appendChild(n);
}), define("extensions/mathJax", [ "utils", "classes/Extension", "text!html/mathJaxSettingsBlock.html", "mathjax" ], function(e, t, n) {
function i(e, t, n) {
var i = u.slice(e, t + 1).join("").replace(/&/g, "&").replace(//g, ">");
for (x.Browser.isMSIE && (i = i.replace(/(%[^\n]*)\n/g, "$1 \n")); t > e; ) u[t] = "",
t--;
u[e] = "@@" + m.length + "@@", n && (i = n(i)), m.push(i), d = p = h = null;
}
function r(e) {
d = p = h = null, m = [];
var t;
/`/.test(e) ? (e = e.replace(/~/g, "~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, function(e) {
return e.replace(/\$/g, "~D");
}), t = function(e) {
return e.replace(/~([TD])/g, function(e, t) {
return {
T: "~",
D: "$"
}[t];
});
}) : t = function(e) {
return e;
}, u = w(e.replace(/\r\n?/g, "\n"), S);
for (var n = 1, r = u.length; r > n; n += 2) {
var o = u[n];
"@" === o.charAt(0) ? (u[n] = "@@" + m.length + "@@", m.push(o)) : d ? p == y && "\n" == o.charAt(0) ? (h && (n = h,
i(d, n, t)), d = p = h = null, f = 0) : o === p ? f ? h = n : i(d, n, t) : o.match(/\n.*\n/) ? (h && (n = h,
i(d, n, t)), d = p = h = null, f = 0) : "{" === o ? f++ : "}" === o && f && f-- : o === y || "$$" === o ? (d = n,
p = o, f = 0) : "begin" === o.substr(1, 5) && (d = n, p = "\\end" + o.substr(6),
f = 0);
}
return h && i(d, h, t), t(u.join(""));
}
function o(e) {
return e = e.replace(/@@(\d+)@@/g, function(e, t) {
return m[t];
}), m = null, e;
}
function a() {
v = !1, x.cancelTypeset = !1, x.Queue([ "Typeset", x, b ]), x.Queue(c);
}
function s() {
v || (v = !0, x.Cancel(), x.Queue(a));
}
var l = new t("mathJax", "MathJax", !0);
l.settingsBlock = n, l.defaultConfig = {
tex: "{}",
tex2jax: '{ inlineMath: [["$","$"],["\\\\\\\\(","\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true }'
}, l.onLoadSettings = function() {
e.setInputValue("#input-mathjax-config-tex", l.config.tex), e.setInputValue("#input-mathjax-config-tex2jax", l.config.tex2jax);
}, l.onSaveSettings = function(t, n) {
t.tex = e.getInputJsValue("#input-mathjax-config-tex", n), t.tex2jax = e.getInputJsValue("#input-mathjax-config-tex2jax", n);
}, l.onPagedownConfigure = function(e) {
b = document.getElementById("preview-contents");
var t = e.getConverter();
t.hooks.chain("preConversion", r), t.hooks.chain("postConversion", o);
};
var c;
l.onAsyncPreview = function(e) {
c = e, s();
};
var u, d, p, h, f, m, g = !1, v = !1, b = null, y = "$", x = MathJax.Hub;
x.Queue(function() {
g = !0, x.processUpdateTime = 50, x.Config({
"HTML-CSS": {
EqnChunk: 10,
EqnChunkFactor: 1
},
SVG: {
EqnChunk: 10,
EqnChunkFactor: 1
}
});
});
var w, S = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i;
return w = 3 === "aba".split(/(b)/).length ? function(e, t) {
return e.split(t);
} : function(e, t) {
var n, i = [];
if (!t.global) {
n = t.toString();
var r = "";
n = n.replace(/^\/(.*)\/([im]*)$/, function(e, t, n) {
return r = n, t;
}), t = RegExp(n, r + "g");
}
for (var o = t.lastIndex = 0; n = t.exec(e); ) i.push(e.substring(o, n.index)),
i.push.apply(i, n.slice(1)), o = n.index + n[0].length;
return i.push(e.substring(o)), i;
}, function() {
var e = MathJax.Hub;
if (!e.Cancel) {
e.cancelTypeset = !1, e.Register.StartupHook("HTML-CSS Jax Config", function() {
var t = MathJax.OutputJax["HTML-CSS"], n = t.Translate;
t.Augment({
Translate: function(i, r) {
if (e.cancelTypeset || r.cancelled) throw Error("MathJax Canceled");
return n.call(t, i, r);
}
});
}), e.Register.StartupHook("SVG Jax Config", function() {
var t = MathJax.OutputJax.SVG, n = t.Translate;
t.Augment({
Translate: function(i, r) {
if (e.cancelTypeset || r.cancelled) throw Error("MathJax Canceled");
return n.call(t, i, r);
}
});
}), e.Register.StartupHook("TeX Jax Config", function() {
var t = MathJax.InputJax.TeX, n = t.Translate;
t.Augment({
Translate: function(i, r) {
if (e.cancelTypeset || r.cancelled) throw Error("MathJax Canceled");
return n.call(t, i, r);
}
});
});
var t = e.processError;
e.processError = function(n, i, r) {
return "MathJax Canceled" !== n.message ? t.call(e, n, i, r) : (MathJax.Message.Clear(0, 0),
i.jaxIDs = [], i.jax = {}, i.scripts = [], i.i = i.j = 0, i.cancelled = !0, null);
}, e.Cancel = function() {
this.cancelTypeset = !0;
};
}
}(), l;
}), define("text!html/partialRenderingSettingsBlock.html", [], function() {
return "
Renders modified sections only.
\n
\n
Note: Document sections are based on title elements (h1, h2...). Therefore if\n your document does not contain any title, performance will not be increased.
\n
";
}), define("extensions/partialRendering", [ "underscore", "crel", "extensions/markdownExtra", "classes/Extension", "text!html/partialRenderingSettingsBlock.html" ], function(e, t, n, i, r) {
function o() {
var t = [], n = "\n";
if (m = !1, e.each(g, function(e) {
var i = '\n\n\n' + e.text + "\n\n";
f && (i = i.replace(/^```.*\n[\s\S]*?\n```|\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/gm, function(e, t) {
return t ? (m = !0, n += e.replace(/^\s*\n/gm, "") + "\n", "") : e;
})), i = i.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm, function(e, t) {
return t ? (n += e.replace(/^\s*\n/gm, "") + "\n", "") : e;
}), t.push({
id: e.id,
text: i + "\n"
});
}), y = [], b = [], d = void 0, x === !0 || u != n) return x = !1, u = n, b = v,
v = t, void (y = t);
var i = v.length;
e.some(v, function(e, n) {
return n >= t.length || e.text != t[n].text ? (i = n, !0) : void 0;
});
var r = -v.length;
e.some(v.slice().reverse(), function(e, n) {
return n >= t.length || e.text != t[t.length - n - 1].text ? (r = -n, !0) : void 0;
}), i - r > v.length && (r = i - v.length);
var o = v.slice(0, i);
y = t.slice(i, t.length + r);
var a = v.slice(v.length + r, v.length);
d = e.first(a), b = v.slice(i, v.length + r), v = o.concat(y).concat(a);
}
function a(e) {
var t = e.id.substring(3), n = w[t];
n && S.removeChild(n), w[t] = e, S.appendChild(e);
}
function s() {
function n(n) {
for (var i = t("div", {
id: "wmd-preview-section-" + n.id,
"class": "wmd-preview-section preview-content"
}), o = !1; r; ) {
var s = r.nextSibling, l = "se-preview-section-delimiter" == r.className;
if (o === !0 && "DIV" == r.tagName && l) break;
o = !0, "DIV" == r.tagName && "footnotes" == r.className ? e.each(r.querySelectorAll("ol > li"), a) : l || i.appendChild(r),
r = s;
}
return i;
}
e.each(b, function(e) {
var t = document.getElementById("wmd-preview-section-" + e.id);
h.removeChild(t);
});
var i = document.getElementById("wmd-preview"), r = i.firstChild, o = document.createDocumentFragment();
e.each(y, function(e) {
o.appendChild(n(e));
}), i.innerHTML = "";
var s = p;
void 0 !== d && (s = document.getElementById("wmd-preview-section-" + d.id)), h.insertBefore(o, s),
p.innerHTML = "", delete p.exportableHtml;
var l = [];
if (m === !0) {
var c = t("ol");
e.each(h.querySelectorAll("a.footnote"), function(e, t) {
e.textContent = t + 1;
var n = e.id.substring(6);
l.push(n);
var i = w[n];
i && c.appendChild(i.cloneNode(!0));
}), l.length > 0 && p.appendChild(t("div", {
"class": "footnotes"
}, t("hr"), c)), Object.keys(w).forEach(function(e) {
-1 === l.indexOf(e) && (S.removeChild(w[e]), delete w[e]);
});
}
}
var l = new i("partialRendering", "Partial Rendering", !0);
l.settingsBlock = r;
var c, u, d, p, h, f = !1, m = !1, g = [], v = [], b = [], y = [], x = !1, w = {}, S = document.createDocumentFragment();
return l.onSectionsCreated = function(e) {
g = e;
}, l.onPagedownConfigure = function(t) {
c = t.getConverter(), c.hooks.chain("preConversion", function() {
o();
var t = e.map(y, function(e) {
return e.text;
});
return t.push(u + "\n\n"), t.join("");
}), t.hooks.chain("onPreviewRefresh", function() {
s();
});
}, l.onInit = function() {
n.enabled && e.some(n.config.extensions, function(e) {
return "footnotes" == e;
}) && (f = !0);
}, l.onReady = function() {
p = t("div", {
id: "wmd-preview-section-footnotes",
"class": "preview-content"
}), h = document.getElementById("preview-contents"), h.appendChild(p);
}, l.onFileSelected = function() {
x = !0;
}, l;
}), define("extensions/markdownSectionParser", [ "underscore", "extensions/markdownExtra", "extensions/mathJax", "extensions/partialRendering", "classes/Extension", "crel" ], function(e, t, n, i, r, o) {
function a(e, t) {
function n(e, t) {
var n = o.substring(a, t);
u.push({
id: ++h,
text: n,
textWithFrontMatter: i + n
}), i = "";
}
if (e === p) {
var i = (p.frontMatter || {})._frontMatter || "", r = t.substring(i.length), o = r + "\n\n";
u = [];
var a = 0;
o.replace(d, function(e, t) {
n(a, t), a = t;
}), n(a, r.length), s.onSectionsCreated(u);
}
}
var s, l = new r("markdownSectionParser", "Markdown section parser");
l.onEventMgrCreated = function(e) {
s = e;
};
var c, u = [], d = "^.+[ \\t]*\\n=+[ \\t]*\\n+|^.+[ \\t]*\\n-+[ \\t]*\\n+|^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*\\n+";
l.onPagedownConfigure = function(r) {
t.enabled && e.some(t.config.extensions, function(e) {
return "fenced_code_gfm" == e;
}) && (d = "^```[^`\\n]*\\n[\\s\\S]*?\\n```|" + d), n.enabled && (d = "^[ \\t]*\\n\\$\\$[\\s\\S]*?\\$\\$|" + d,
d = "^[ \\t]*\\n\\\\\\\\[[\\s\\S]*?\\\\\\\\]|" + d, d = "^[ \\t]*\\n\\\\?\\\\begin\\{[a-z]*\\*?\\}[\\s\\S]*?\\\\end\\{[a-z]*\\*?\\}|" + d),
d = new RegExp(d, "gm");
var a = r.getConverter();
i.enabled || (a.hooks.chain("preConversion", function() {
return e.reduce(u, function(e, t) {
return e + '\n\n\n' + t.text + "\n\n";
}, "");
}), r.hooks.chain("onPreviewRefresh", function() {
function e() {
for (var e = o("div", {
"class": "wmd-preview-section preview-content"
}), t = !1; n; ) {
var i = n.nextSibling, r = "se-preview-section-delimiter" == n.className;
if (t === !0 && "DIV" == n.tagName && r) break;
t = !0, r || e.appendChild(n), n = i;
}
return e;
}
var t = document.getElementById("wmd-preview"), n = t.firstChild, i = document.createDocumentFragment();
u.forEach(function(t) {
i.appendChild(e(t));
}), c.innerHTML = "", c.appendChild(t), c.appendChild(i);
}));
}, l.onReady = function() {
c = document.getElementById("preview-contents");
};
var p;
l.onFileSelected = function(e) {
p = e;
};
var h = 0;
return l.onFileOpen = a, l.onContentChanged = a, l;
}), define("text!html/buttonMarkdownSyntax.html", [], function() {
return '\n
\n
Markdown syntax
\n \n
\n
Phrase Emphasis
\n\n
*italic* **bold**\n_italic_ __bold__\n
\n\n
Links
\n\n
Inline:
\n\n
An [example](http://url.com/ "Title")\n
\n\n
Reference-style labels (titles are optional):
\n\n
An [example][id]. Then, anywhere\nelse in the doc, define the link:\n\n [id]: http://example.com/ "Title"\n
> Email-style angle brackets\n> are used for blockquotes.\n\n> > And, they can be nested.\n\n> #### Headers in blockquotes\n>\n> * You can quote a list.\n> * Etc.\n
\n\n
Code Spans
\n\n
`<code>` spans are delimited\nby backticks.\n\nYou can include literal backticks\nlike `` `this` ``.\n
\n\n
Preformatted Code Blocks
\n\n
Indent every line of a code block by at least 4 spaces or 1 tab.
\n\n
This is a normal paragraph.\n\n This is a preformatted\n code block.\n
" ].join("");
n += t.chain(s).sortBy(function(e) {
return e.name.toLowerCase();
}).reduce(function(e, n) {
return e + t.template(E, {
folderDesc: n
});
}, "").value(), o.innerHTML = n, t.each(o.querySelectorAll(".folder"), function(n) {
n = e(n), n.click(function() {
var i = s[n.data("folderIndex")];
t.each(I, function(e) {
e.folder && e.folder.removeFile(e), i && i.addFile(e);
}), f.onFoldersChanged(), e(g.querySelectorAll(".document-list")).removeClass("hide"),
e(g.querySelectorAll(".choose-folder, .select-folder-list")).addClass("hide");
});
}), e(g.querySelectorAll(".document-list")).addClass("hide"), e(g.querySelectorAll(".choose-folder, .select-folder-list")).removeClass("hide");
}
});
y = h.parent(), e(g.querySelectorAll(".action-cancel")).click(function() {
e(g.querySelectorAll(".document-list")).removeClass("hide"), e(g.querySelectorAll(".confirm-delete, .choose-folder, .selected-document-list, .select-folder-list")).addClass("hide");
}), e(v).on("click", ".button-delete", function(t) {
t.stopPropagation();
var n = e(this), i = n.parent(), r = s[i.data("folderIndex")], o = l[i.data("fileIndex")];
I = [], D = [], r ? (D.push(r), I = r.fileList) : o && I.push(o), u();
}).on("click", ".button-rename", function(t) {
t.stopPropagation();
var n, i = e(this.parentNode), r = s[i.data("folderIndex")], o = l[i.data("fileIndex")];
r ? n = r.name : o && (n = o.title), i.find(".name").addClass("hide"), i.find(".input-rename").removeClass("hide").val(n)[0].select();
}).on("blur keyup", ".input-rename", function(t) {
function n() {
var t = i.parent(), n = e.trim(i.val()), r = s[t.data("folderIndex")], o = l[t.data("fileIndex")];
n && r && n != r.name ? (r.name = n, f.onFoldersChanged()) : n && o && n != o.title ? (o.title = n,
f.onTitleChanged(o)) : (i.addClass("hide"), t.find(".name").removeClass("hide"));
}
var i = e(this);
void 0 === t.keyCode ? n() : 13 == t.keyCode ? (n(), t.stopPropagation()) : 27 == t.keyCode && (i.val(""),
n(), t.stopPropagation());
}).on("click", ".file .checkbox", function(e) {
e.stopPropagation();
}).on("change", ".file .checkbox input", function() {
e(this).parents(".file-list").prev().find(".checkbox input").prop("checked", !1),
N();
}).on("click", ".folder .checkbox", function(e) {
e.stopPropagation();
}).on("change", ".folder .checkbox input", function() {
e(this).parents(".folder").next().find(".checkbox input").prop("checked", this.checked),
N();
});
}, h;
}), define("extensions/workingIndicator", [ "jquery", "underscore", "crel", "classes/Extension" ], function(e, t, n, i) {
var r, o, a = new i("workingIndicator", "Working Indicator"), s = [ "@<%= prefix %>keyframes <%= name %> {", " 0% { opacity:<%= z %>; }", " <%= start %>.01% { opacity:<%= alpha %>; }", " <%= start %>.02% { opacity:1; }", " <%= ((start + trail) % 100) %>.01% { opacity:<%= alpha %>; }", " 100% { opacity:<%= z %>; }", "}" ].join("\n");
return a.onAsyncRunning = function(e) {
r.toggleClass("working", e), o.toggleClass("hide", !e);
}, a.onReady = function() {
function i(e) {
e.z = Math.max(1 - (1 - e.alpha) / e.trail * (100 - e.start), e.alpha), a += t.template(s, t.extend({
prefix: ""
}, e)), a += t.template(s, t.extend({
prefix: "-webkit-"
}, e));
}
var a = "";
r = e(document.body), o = e('
'), e(".working-indicator").append(o);
for (var l = 0; 3 > l; l++) {
var c = "working-indicator-bar" + l;
i({
name: c,
alpha: .25,
start: 20 * l,
trail: 50
});
var u = c + " 0.7s linear infinite";
o.append(e('
Note: The mapping between Markdown and HTML is based on the\n position of the title elements (h1, h2...) in the page. Therefore if\n your document does not contain any title, the mapping will be linear and\n consequently less accurate.
\n
";
}), define("extensions/scrollSync", [ "jquery", "underscore", "classes/Extension", "text!html/scrollSyncSettingsBlock.html" ], function(e, t, n, i) {
function r(e, n, i) {
var r, o = t.find(n, function(t, n) {
return r = n, e < t.endOffset;
});
if (void 0 !== o) {
var a = (e - o.startOffset) / (o.height || 1), s = i[r];
return s.startOffset + s.height * a;
}
}
function o(e, t, n, i, r) {
function o() {
var l = Date.now(), c = (l - s) / 200;
if (1 > c) {
var u = t + a * Math.cos((1 - c) * Math.PI / 2);
e.scrollTop = u, i(u), p = setTimeout(o, 1);
} else h = void 0, e.scrollTop = n, setTimeout(r, 100);
}
h && (clearTimeout(p), h()), h = r;
var a = n - t, s = Date.now();
o();
}
var a = new n("scrollSync", "Scroll Sync", !0, !0);
a.settingsBlock = i;
var s;
a.onSectionsCreated = function(e) {
s = e;
};
var l, c, u, d, p, h, f = [], m = [], g = t.debounce(function() {
f = [];
var e, n;
t.each(l.querySelectorAll(".wmd-input-section"), function(t) {
if (void 0 === e) return void (e = 0);
t = t.firstChild;
var n = t.offsetTop;
f.push({
startOffset: e,
endOffset: n,
height: n - e
}), e = n;
}), n = l.scrollHeight, f.push({
startOffset: e,
endOffset: n,
height: n - e
}), m = [];
var i;
t.each(c.querySelectorAll(".wmd-preview-section"), function(e) {
if (void 0 === i) return void (i = 0);
var t = e.offsetTop;
m.push({
startOffset: i,
endOffset: t,
height: t - i
}), i = t;
}), n = c.scrollHeight, m.push({
startOffset: i,
endOffset: n,
height: n - i
}), u = -10, d = -10, S();
}, 500), v = !0, b = !1, y = !1, x = !1, w = !1, S = t.throttle(function() {
if (v && 0 !== f.length && f.length === m.length) {
var e = l.scrollTop;
0 > e && (e = 0);
var n, i = c.scrollTop;
if (b === !0) {
if (Math.abs(e - u) <= 9) return;
if (b = !1, u = e, n = r(e, f, m), n = t.min([ n, c.scrollHeight - c.offsetHeight ]),
Math.abs(n - i) <= 9) return void (d = i);
o(c, i, n, function(e) {
w = !0, d = e;
}, function() {
w = !1;
});
} else if (y === !0) {
if (Math.abs(i - d) <= 9) return;
if (y = !1, d = i, n = r(i, m, f), n = t.min([ n, l.scrollHeight - l.offsetHeight ]),
Math.abs(n - e) <= 9) return void (u = e);
o(l, e, n, function(e) {
x = !0, u = e;
}, function() {
x = !1;
});
}
}
}, 100);
a.onLayoutResize = function() {
b = !0, g();
}, a.onFileClosed = function() {
f = [];
};
var C = !1;
a.onReady = function() {
c = document.querySelector(".preview-container"), l = document.querySelector("#wmd-input"),
e(c).scroll(function() {
w === !1 && C === !1 && (y = !0, b = !1, S()), C = !1;
}), e(l).scroll(function() {
x === !1 && (b = !0, y = !1, S());
}), e(".preview-panel").on("hide.layout.toggle", function() {
v = !1;
}).on("shown.layout.toggle", function() {
v = !0;
}), e(".extension-preview-buttons .table-of-contents").on("click", "a", function(t) {
t.preventDefault();
var n = this.hash, i = e(n);
if (i.length) {
var o = i[0].getBoundingClientRect().top - c.getBoundingClientRect().top + c.scrollTop;
c.scrollTop = o;
var a = r(o, m, f);
l.scrollTop = a;
}
});
};
var _, k;
return a.onPagedownConfigure = function(e) {
_ = document.getElementById("preview-contents"), e.getConverter().hooks.chain("postConversion", function(e) {
return k = _.offsetHeight, _.style.height = k + "px", e;
});
}, a.onPreviewFinished = function() {
_.style.removeProperty("height");
var e = _.offsetHeight;
b = !0, k > e && (C = !0), g();
}, a;
}), define("text!html/buttonSyncSettingsBlock.html", [], function() {
return '
Adds a "Synchronize documents" button in the navigation bar.
\n
\n
\n \n
\n ms\n
\n
\n
\n \n
\n \n
\n
\n
';
}), define("extensions/buttonSync", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "text!html/buttonSyncSettingsBlock.html" ], function(e, t, n, i, r, o, a) {
var s = new r("buttonSync", 'Button "Synchronize"', !1, !0);
s.settingsBlock = a, s.defaultConfig = {
syncPeriod: 18e4,
syncShortcut: "mod+s"
}, s.onLoadSettings = function() {
i.setInputValue("#input-sync-period", s.config.syncPeriod), i.setInputValue("#input-sync-shortcut", s.config.syncShortcut);
}, s.onSaveSettings = function(e, t) {
e.syncPeriod = i.getInputIntValue("#input-sync-period", t, 0), e.syncShortcut = i.getInputTextValue("#input-sync-shortcut", t);
};
var l;
s.onSynchronizerCreated = function(e) {
l = e;
};
var c, u = !1, d = !1, p = function() {
void 0 !== c && (u === !0 || l.hasSync() === !1 || d ? c.addClass("disabled") : c.removeClass("disabled"));
}, h = 0;
return s.onPeriodicRun = function() {
!s.config.syncPeriod || h + s.config.syncPeriod > i.currentTime || l.sync() && (h = i.currentTime);
}, s.onCreateButton = function() {
var t = n("a", {
"class": "btn btn-success button-synchronize",
title: "Force synchronization Ctrl/Cmd+S"
}, n("i", {
"class": "icon-refresh"
}));
return c = e(t), c.click(function() {
c.hasClass("disabled") || l.sync() && (h = i.currentTime);
}), t;
}, s.onReady = p, s.onFileCreated = p, s.onFileDeleted = p, s.onSyncImportSuccess = p,
s.onSyncExportSuccess = p, s.onSyncRemoved = p, s.onSyncRunning = function(e) {
u = e, p();
}, s.onOfflineChanged = function(e) {
d = e, p();
}, s.onReady = function() {
o.bind(s.config.syncShortcut, function(e) {
l.sync() && (h = i.currentTime), e.preventDefault();
}), e(".action-force-synchronization").click(function() {
l.sync() && (h = i.currentTime);
});
}, s;
}), define("extensions/buttonPublish", [ "jquery", "underscore", "crel", "classes/Extension" ], function(e, t, n, i) {
function r() {
void 0 !== o && (c === !0 || u === !1 || d === !0 ? o.addClass("disabled") : o.removeClass("disabled"));
}
var o, a, s, l = new i("buttonPublish", 'Button "Publish"'), c = !1, u = !1, d = !1;
l.onPublisherCreated = function(e) {
s = e;
}, l.onCreateButton = function() {
var t = n("a", {
"class": "btn btn-success button-publish",
title: "Update document publication"
}, n("i", {
"class": "icon-upload"
}));
return o = e(t).click(function() {
o.hasClass("disabled") || s.publish();
}), t;
}, l.onPublishRunning = function(e) {
c = e, r();
}, l.onOfflineChanged = function(e) {
d = e, r();
};
var p = function() {
u = 0 === t.size(a.publishLocations) ? !1 : !0, r();
};
return l.onFileSelected = function(e) {
a = e, p();
}, l.onReady = function() {
e(".action-update-publication").click(s.publish);
}, l.onPublishRemoved = p, l.onNewPublishSuccess = p, l;
}), define("text!html/buttonStat.html", [], function() {
return '\n
Helps find and replace text in the current document.
\n
\n
\n \n
\n \n
\n
\n
';
}), define("extensions/findReplace", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "rangy", "text!html/findReplace.html", "text!html/findReplaceSettingsBlock.html" ], function(e, t, n, i, r, o, a, s, l) {
function c() {
u(), M.forEach(function(e) {
try {
x.undoToRange(e);
} catch (t) {}
}), M = [];
}
function u() {
if (S) {
try {
S && w.undoToRange(S);
} catch (e) {}
S = void 0;
}
}
function d(e) {
function t(e) {
return e.container === s.container ? {
container: o.endContainer.parentElement.nextSibling,
offsetInContainer: e.offsetInContainer - s.offsetInContainer,
offset: e.offset
} : e;
}
if (O) {
var n = k.val(), i = I.prop("checked"), r = D.prop("checked");
if (e || n != A || i != R || r != P) {
A = n, R = i, P = r, c();
var o, s = {};
L = [];
var l = 0, u = n.length;
if (u) try {
var d = i ? "gm" : "gmi";
if (n = r ? n : n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), N = new RegExp(n, d),
b.getValue().replace(N, function(e, t) {
L.push({
start: t,
end: t + e.length
});
}), l = L.length, L.length < 200) {
var p = [];
L.forEach(function(e) {
p.push(e.start), p.push(e.end);
}), p = b.selectionMgr.findOffsets(p);
for (var h = 0; h < p.length; h += 2) {
var f = p[h], m = p[h + 1], g = t(f), v = t(m), y = a.createRange();
y.setStart(g.container, g.offsetInContainer), y.setEnd(v.container, v.offsetInContainer),
s = m, o = y, x.applyToRange(y), M[f.offset] = y;
}
b.selectionMgr.hasFocus && b.selectionMgr.updateSelectionRange();
}
} catch (w) {}
T.innerHTML = l;
}
}
}
function p() {
y.onEditorPopover(), O = !0, _.show(), k.focus()[0].setSelectionRange(0, k.val().length),
b.selectionMgr.adjustTop = 50, b.selectionMgr.adjustBottom = 220, d(!0);
}
function h() {
O = !1, _.hide(), c(), b.selectionMgr.adjustTop = 0, b.selectionMgr.adjustBottom = 0,
b.focus();
}
function f() {
u();
var e = Math.min(b.selectionMgr.selectionStart, b.selectionMgr.selectionEnd), n = t.find(L, function(t) {
return t.start > e;
});
if (n || (n = t.first(L)), n) {
if (S = M[n.start], !S) {
var i = b.selectionMgr.createRange(n.start, n.end);
S = a.createRange(), S.setStart(i.startContainer, i.startOffset), S.setEnd(i.endContainer, i.endOffset);
}
w.applyToRange(S), S.start = n.start, S.end = n.end, b.selectionMgr.setSelectionStartEnd(n.start, n.end),
b.selectionMgr.updateCursorCoordinates(!0);
}
}
function m() {
if (!S) return f();
var e = E.val();
b.replace(S.start, S.end, e), setTimeout(function() {
f(), E.focus();
}, 1);
}
function g() {
var e = E.val();
b.replaceAll(N, e);
}
var v = new r("findReplace", "Find and Replace", !0, !0);
v.settingsBlock = l, v.defaultConfig = {
findReplaceShortcut: "mod+f"
}, v.onLoadSettings = function() {
i.setInputValue("#input-find-replace-shortcut", v.config.findReplaceShortcut);
}, v.onSaveSettings = function(e, t) {
e.findReplaceShortcut = i.getInputTextValue("#input-find-replace-shortcut", t);
};
var b;
v.onEditorCreated = function(e) {
b = e;
};
var y;
v.onEventMgrCreated = function(e) {
y = e;
};
var x, w, S, C, _, k, E, T, I, D, N, M = [], L = [], A = "", R = !1, P = !1, O = !1;
return v.onEditorPopover = function() {
h();
}, v.onContentChanged = t.bind(d, null, !0), v.onFileOpen = t.bind(d, null, !0),
v.onReady = function() {
x = a.createCssClassApplier("find-replace-highlight", {
normalize: !1
}), w = a.createCssClassApplier("find-replace-select", {
normalize: !1
}), C = document.querySelector("#wmd-input .editor-content");
var i = n("div", {
"class": "find-replace"
});
_ = e(i).hide(), i.innerHTML = s, document.querySelector(".layout-wrapper-l2").appendChild(i),
e(".button-find-replace-dismiss").click(function() {
h();
}), T = i.querySelector(".found-counter"), I = _.find(".checkbox-case-sensitive").change(t.bind(d, null, !1)),
D = _.find(".checkbox-regexp").change(t.bind(d, null, !1)), _.find(".search-button").click(f),
k = e("#input-find-replace-search-for").keyup(t.bind(d, null, !1)), _.find(".replace-button").click(m),
E = e("#input-find-replace-replace-with"), _.find(".replace-all-button").click(g),
e().add(k).add(E).keydown(function(e) {
13 === e.which && (e.preventDefault(), f());
}), o.bind(v.config.findReplaceShortcut, function(e) {
var t = b.selectionMgr.getSelectedText();
t && k.val(t), p(), e.preventDefault();
});
}, v;
}), define("text!html/htmlSanitizerSettingsBlock.html", [], function() {
return '
Prevents cross-site-scripting attacks (XSS).
\n
Careful: Disable at your own risk!
\n';
}), define("extensions/htmlSanitizer", [ "jquery", "underscore", "utils", "logger", "classes/Extension", "text!html/htmlSanitizerSettingsBlock.html" ], function(e, t, n, i, r, o) {
function a(e, t) {
var i, r = t ? m : f;
return i = n.urlResolve(e).href, "" === i || i.match(r) ? void 0 : "unsafe:" + i;
}
function s(e) {
var t, n = {}, i = e.split(",");
for (t = 0; t < i.length; t++) n[i[t]] = !0;
return n;
}
function l(e, t) {
function n(e, n, r, o) {
if (n = n && n.toLowerCase(), D[n]) for (;s.last() && N[s.last()]; ) i("", s.last());
I[n] && s.last() == n && i("", n), o = k[n] || !!o, o || s.push(n);
var a = {};
r.replace(b, function(e, t, n, i, r) {
var o = n || i || r || "";
a[t] = c(o);
}), t.start && t.start(n, a, o);
}
function i(e, n) {
var i, r = 0;
if (n = n && n.toLowerCase()) for (r = s.length - 1; r >= 0 && s[r] != n; r--) ;
if (r >= 0) {
for (i = s.length - 1; i >= r; i--) t.end && t.end(s[i]);
s.length = r;
}
}
var r, o, a, s = [], l = e;
for (s.last = function() {
return s[s.length - 1];
}; e; ) {
if (o = !0, s.last() && M[s.last()]) e = e.replace(new RegExp("(.*)<\\s*\\/\\s*" + s.last() + "[^>]*>", "i"), function(e, n) {
return n = n.replace(w, "$1").replace(C, "$1"), t.chars && t.chars(c(n)), "";
}), i("", s.last()); else if (0 === e.indexOf("", r) === r && (t.comment && t.comment(e.substring(4, r)),
e = e.substring(r + 3), o = !1)) : S.test(e) ? (a = e.match(S), a && (e = e.replace(a[0], ""),
o = !1)) : x.test(e) ? (a = e.match(v), a && (e = e.substring(a[0].length), a[0].replace(v, i),
o = !1)) : y.test(e) && (a = e.match(g), a && (e = e.substring(a[0].length), a[0].replace(g, n),
o = !1)), o) {
r = e.indexOf("<");
var u = 0 > r ? e : e.substring(0, r);
e = 0 > r ? "" : e.substring(r), t.chars && t.chars(c(u));
}
if (e == l) return s.reverse(), s.forEach(function(e) {
h.push(""), h.push(e), h.push(">");
});
l = e;
}
i();
}
function c(e) {
if (!e) return "";
var t = O.exec(e), n = t[1], i = t[3], r = t[2];
return r && (P.innerHTML = r.replace(//g, ">");
}
function d(e, n) {
var i = !1, r = t.bind(e.push, e);
return {
start: function(e, o, a) {
e = e && e.toLowerCase(), !i && M[e] && (i = e), i || L[e] !== !0 || (r("<"), r(e),
t.forEach(o, function(t, i) {
var o = i && i.toLowerCase(), a = "img" === e && "src" === o || "background" === o;
R[o] !== !0 || A[o] === !0 && !n(t, a) || (r(" "), r(i), r('="'), r(u(t)), r('"'));
}), r(a ? "/>" : ">"));
},
end: function(e) {
e = e && e.toLowerCase(), i || L[e] !== !0 || (r(""), r(e), r(">")), e == i && (i = !1);
},
chars: function(e) {
i || r(u(e));
},
comment: function(e) {
i || (r(""));
}
};
}
var p = new r("htmlSanitizer", "HTML Sanitizer", !0);
p.settingsBlock = o;
var h;
p.onPagedownConfigure = function(e) {
var t = e.getConverter();
t.hooks.chain("postConversion", function(e) {
return h = [], e.split('').forEach(function(e) {
l(e, d(h, function(e, t) {
return !/^unsafe/.test(a(e, t));
})), h.push('');
}), h.slice(0, -1).join("");
});
};
var f = /^\s*(https?|ftp|mailto|tel|file):/, m = /^\s*(https?|ftp|file):|data:image\//, g = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, v = /^<\s*\/\s*([\w:-]+)[^>]*>/, b = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, y = /^, x = /^<\s*\//, w = //g, S = /]*?)>/i, C = //g, _ = /([^\#-~| |!])/g, k = s("area,br,col,hr,img,wbr"), E = s("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), T = s("rp,rt"), I = t.extend({}, T, E), D = t.extend({}, E, s("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")), N = t.extend({}, T, s("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")), M = s("script,style");
D.iframe = !0;
var L = t.extend({}, k, D, N, I), A = s("background,cite,href,longdesc,src,usemap"), R = t.extend({}, A, s("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width"));
R.id = !0, R.allowfullscreen = !0;
var P = document.createElement("pre"), O = /^(\s*)([\s\S]*?)(\s*)$/;
return p;
}), function(e) {
var t = "waitForImages";
e.waitForImages = {
hasImageProperties: [ "backgroundImage", "listStyleImage", "borderImage", "borderCornerImage" ]
}, e.expr[":"].uncached = function(t) {
if (!e(t).is('img[src!=""]')) return !1;
var n = new Image();
return n.src = t.src, !n.complete;
}, e.fn.waitForImages = function(n, i, r) {
var o = 0, a = 0;
if (e.isPlainObject(arguments[0]) && (r = arguments[0].waitForAll, i = arguments[0].each,
n = arguments[0].finished), n = n || e.noop, i = i || e.noop, r = !!r, !e.isFunction(n) || !e.isFunction(i)) throw new TypeError("An invalid callback was supplied.");
return this.each(function() {
var s = e(this), l = [], c = e.waitForImages.hasImageProperties || [], u = /url\(\s*(['"]?)(.*?)\1\s*\)/g;
r ? s.find("*").andSelf().each(function() {
var t = e(this);
t.is("img:uncached") && l.push({
src: t.attr("src"),
element: t[0]
}), e.each(c, function(e, n) {
var i, r = t.css(n);
if (!r) return !0;
for (;i = u.exec(r); ) l.push({
src: i[2],
element: t[0]
});
});
}) : s.find("img:uncached").each(function() {
l.push({
src: this.src,
element: this
});
}), o = l.length, a = 0, 0 === o && n.call(s[0]), e.each(l, function(r, l) {
var c = new Image();
e(c).bind("load." + t + " error." + t, function(e) {
return a++, i.call(l.element, a, o, "load" == e.type), a == o ? (n.call(s[0]), !1) : void 0;
}), c.src = l.src;
});
});
};
}(jQuery), define("jquery-waitforimages", function() {}), define("eventMgr", [ "jquery", "underscore", "crel", "mousetrap", "utils", "logger", "classes/Extension", "settings", "text!html/settingsExtensionsAccordion.html", "extensions/yamlFrontMatterParser", "extensions/markdownSectionParser", "extensions/partialRendering", "extensions/buttonMarkdownSyntax", "extensions/googleAnalytics", "extensions/twitter", "extensions/dialogAbout", "extensions/dialogManagePublication", "extensions/dialogManageSynchronization", "extensions/dialogManageSharing", "extensions/dialogOpenHarddrive", "extensions/documentTitle", "extensions/documentSelector", "extensions/documentPanel", "extensions/documentManager", "extensions/workingIndicator", "extensions/notifications", "extensions/umlDiagrams", "extensions/markdownExtra", "extensions/toc", "extensions/mathJax", "extensions/emailConverter", "extensions/scrollSync", "extensions/buttonSync", "extensions/buttonPublish", "extensions/buttonStat", "extensions/buttonHtmlCode", "extensions/buttonViewer", "extensions/welcomeTour", "extensions/shortcuts", "extensions/userCustom", "extensions/comments", "extensions/findReplace", "extensions/htmlSanitizer", "bootstrap", "jquery-waitforimages" ], function(e, t, n, i, r, o, a, s, l) {
function c(e) {
return t.chain(h).map(function(t) {
return t.enabled && t[e];
}).compact().value();
}
function u(e) {
return m[e] = c(e), function() {
o.log(e, arguments);
var n = arguments;
t.each(m[e], function(e) {
try {
e.apply(null, n);
} catch (i) {
console.error(t.isObject(i) ? i.stack : i);
}
});
};
}
function d(e) {
p[e] = u(e);
}
var p = {}, h = t.chain(arguments).map(function(e) {
return e instanceof a && e;
}).compact().value(), f = s.extensionSettings || {};
t.each(h, function(e) {
e.config = t.extend({}, e.defaultConfig, f[e.extensionId]), e.enabled = window.viewerMode === !0 && e.disableInViewer === !0 ? !1 : !e.isOptional || void 0 === e.config.enabled || e.config.enabled === !0;
});
var m = {};
p.addListener = function(e, t) {
try {
m[e].push(t);
} catch (n) {
console.error("No event listener called " + e);
}
}, u("onInit")(), p.onLoadSettings = function() {
o.log("onLoadSettings"), t.each(h, function(e) {
var t = !e.isOptional || void 0 === e.config.enabled || e.config.enabled === !0;
r.setInputChecked("#input-enable-extension-" + e.extensionId, t), "markdownExtra" == e.extensionId ? r.setInputChecked("#input-settings-markdown-extra", t) : "mathJax" == e.extensionId && r.setInputChecked("#input-settings-mathjax", t);
var n = e.onLoadSettings;
n && n();
});
}, p.onSaveSettings = function(e, n) {
o.log("onSaveSettings"), t.each(h, function(i) {
var o = t.extend({}, i.defaultConfig);
o.enabled = r.getInputChecked("#input-enable-extension-" + i.extensionId);
var a;
"markdownExtra" == i.extensionId ? (a = r.getInputChecked("#input-settings-markdown-extra"),
a != i.enabled && (o.enabled = a)) : "mathJax" == i.extensionId && (a = r.getInputChecked("#input-settings-mathjax"),
a != i.enabled && (o.enabled = a));
var s = i.onSaveSettings;
s && s(o, n), e[i.extensionId] = o;
});
}, d("onMessage"), d("onError"), d("onOfflineChanged"), d("onUserActive"), d("onAsyncRunning"),
d("onPeriodicRun"), d("onEditorCreated"), d("onFileMgrCreated"), d("onSynchronizerCreated"),
d("onPublisherCreated"), d("onSharingCreated"), d("onEventMgrCreated"), d("onFileCreated"),
d("onFileDeleted"), d("onFileSelected"), d("onFileOpen"), d("onFileClosed"), d("onContentChanged"),
d("onTitleChanged"), d("onFoldersChanged"), d("onSyncRunning"), d("onSyncSuccess"),
d("onSyncImportSuccess"), d("onSyncExportSuccess"), d("onSyncRemoved"), d("onPublishRunning"),
d("onPublishSuccess"), d("onNewPublishSuccess"), d("onPublishRemoved"), d("onLayoutCreated"),
d("onLayoutResize"), d("onExtensionButtonResize"), d("onPagedownConfigure"), d("onSectionsCreated"),
d("onCursorCoordinates"), d("onEditorPopover"), d("onDiscussionCreated"), d("onDiscussionRemoved"),
d("onCommentsChanged"), d("onTweet");
var g, v, b = u("onPreviewFinished"), y = c("onAsyncPreview");
p.onAsyncPreview = function() {
function e(n) {
var i = n.length ? n.shift() : function() {
setTimeout(function() {
var e = "";
t.each(g.children, function(n) {
if (!n.exportableHtml) {
var i = n.cloneNode(!0);
t.each(i.querySelectorAll(".MathJax, .MathJax_Display, .MathJax_Preview"), function(e) {
e.parentNode.removeChild(e);
}), n.exportableHtml = i.innerHTML;
}
e += n.exportableHtml;
});
var n = r.trim(e), i = n.replace(/ .*?<\/span> /g, "");
b(n, i);
}, 10);
};
i(function() {
e(n);
});
}
o.log("onAsyncPreview"), e(y.concat([ function(e) {
v.waitForImages(e);
} ]));
};
var x = u("onReady");
return p.onReady = function() {
g = document.getElementById("preview-contents"), v = e(g);
var r = function(e) {
var i = n("div", {
"class": "btn-group"
}), r = e();
return t.isString(r) ? i.innerHTML = r : t.isElement(r) && i.appendChild(r), i;
};
if (window.viewerMode === !1) {
var a = t.chain(h).sortBy(function(e) {
return e.extensionName.toLowerCase();
}).reduce(function(e, n) {
return e + (n.settingsBlock ? t.template(l, {
extensionId: n.extensionId,
extensionName: n.extensionName,
isOptional: n.isOptional,
settingsBlock: n.settingsBlock
}) : "");
}, "").value();
document.querySelector(".accordion-extensions").innerHTML = a, o.log("onCreateButton");
var s = c("onCreateButton"), u = document.createDocumentFragment();
t.each(s, function(e) {
u.appendChild(r(e));
}), document.querySelector(".extension-buttons").appendChild(u);
}
o.log("onCreatePreviewButton");
var d = c("onCreatePreviewButton"), f = document.createDocumentFragment();
t.each(d, function(e) {
f.appendChild(r(e));
});
var m = document.querySelector(".extension-preview-buttons");
m.appendChild(f), i.bind("escape", function() {
p.onEditorPopover();
}), x();
}, p.onEventMgrCreated(p), p;
}), function() {
var e = /\blang(?:uage)?-(?!\*)(\w+)\b/i, t = self.Prism = {
util: {
type: function(e) {
return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1];
},
clone: function(e) {
var n = t.util.type(e);
switch (n) {
case "Object":
var i = {};
for (var r in e) e.hasOwnProperty(r) && (i[r] = t.util.clone(e[r]));
return i;
case "Array":
return e.slice();
}
return e;
}
},
languages: {
extend: function(e, n) {
var i = t.util.clone(t.languages[e]);
for (var r in n) i[r] = n[r];
return i;
},
insertBefore: function(e, n, i, r) {
r = r || t.languages;
var o = r[e], a = {};
for (var s in o) if (o.hasOwnProperty(s)) {
if (s == n) for (var l in i) i.hasOwnProperty(l) && (a[l] = i[l]);
a[s] = o[s];
}
return r[e] = a;
},
DFS: function(e, n) {
for (var i in e) n.call(e, i, e[i]), "Object" === t.util.type(e) && t.languages.DFS(e[i], n);
}
},
highlightAll: function(e, n) {
for (var i, r = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'), o = 0; i = r[o++]; ) t.highlightElement(i, e === !0, n);
},
highlightElement: function(i, r, o) {
for (var a, s, l = i; l && !e.test(l.className); ) l = l.parentNode;
if (l && (a = (l.className.match(e) || [ , "" ])[1], s = t.languages[a]), s) {
i.className = i.className.replace(e, "").replace(/\s+/g, " ") + " language-" + a,
l = i.parentNode, /pre/i.test(l.nodeName) && (l.className = l.className.replace(e, "").replace(/\s+/g, " ") + " language-" + a);
var c = i.textContent;
if (c) {
c = c.replace(/&/g, "&").replace(/ e.length) break e;
if (!(p instanceof i)) {
s.lastIndex = 0;
var h = s.exec(p);
if (h) {
c && (u = h[1].length);
var f = h.index - 1 + u, h = h[0].slice(u), m = h.length, g = f + m, v = p.slice(0, f + 1), b = p.slice(g + 1), y = [ d, 1 ];
v && y.push(v);
var x = new i(a, l ? t.tokenize(h, l) : h);
y.push(x), b && y.push(b), Array.prototype.splice.apply(r, y);
}
}
}
}
return r;
},
hooks: {
all: {},
add: function(e, n) {
var i = t.hooks.all;
i[e] = i[e] || [], i[e].push(n);
},
run: function(e, n) {
var i = t.hooks.all[e];
if (i && i.length) for (var r, o = 0; r = i[o++]; ) r(n);
}
}
}, n = t.Token = function(e, t) {
this.type = e, this.content = t;
};
if (n.stringify = function(e, i, r) {
if ("string" == typeof e) return e;
if ("[object Array]" == Object.prototype.toString.call(e)) return e.map(function(t) {
return n.stringify(t, i, e);
}).join("");
var o = {
type: e.type,
content: n.stringify(e.content, i, r),
tag: "span",
classes: [ "token", e.type ],
attributes: {},
language: i,
parent: r
};
"comment" == o.type && (o.attributes.spellcheck = "true"), t.hooks.run("wrap", o);
var a = "";
for (var s in o.attributes) a += s + '="' + (o.attributes[s] || "") + '"';
return "<" + o.tag + ' class="' + o.classes.join(" ") + '" ' + a + ">" + o.content + "" + o.tag + ">";
}, !self.document) return void self.addEventListener("message", function(e) {
var n = JSON.parse(e.data), i = n.language, r = n.code;
self.postMessage(JSON.stringify(t.tokenize(r, t.languages[i]))), self.close();
}, !1);
var i = document.getElementsByTagName("script");
i = i[i.length - 1], i && (t.filename = i.src, document.addEventListener && !i.hasAttribute("data-manual") && document.addEventListener("DOMContentLoaded", t.highlightAll));
}(), define("prism-core", function(e) {
return function() {
var t;
return t || e.Prism;
};
}(this));
var DIFF_DELETE = -1, DIFF_INSERT = 1, DIFF_EQUAL = 0;
diff_match_patch.Diff, diff_match_patch.prototype.diff_main = function(e, t, n, i) {
"undefined" == typeof i && (i = this.Diff_Timeout <= 0 ? Number.MAX_VALUE : new Date().getTime() + 1e3 * this.Diff_Timeout);
var r = i;
if (null == e || null == t) throw new Error("Null input. (diff_main)");
if (e == t) return e ? [ [ DIFF_EQUAL, e ] ] : [];
"undefined" == typeof n && (n = !0);
var o = n, a = this.diff_commonPrefix(e, t), s = e.substring(0, a);
e = e.substring(a), t = t.substring(a), a = this.diff_commonSuffix(e, t);
var l = e.substring(e.length - a);
e = e.substring(0, e.length - a), t = t.substring(0, t.length - a);
var c = this.diff_compute_(e, t, o, r);
return s && c.unshift([ DIFF_EQUAL, s ]), l && c.push([ DIFF_EQUAL, l ]), this.diff_cleanupMerge(c),
c;
}, diff_match_patch.prototype.diff_compute_ = function(e, t, n, i) {
var r;
if (!e) return [ [ DIFF_INSERT, t ] ];
if (!t) return [ [ DIFF_DELETE, e ] ];
var o = e.length > t.length ? e : t, a = e.length > t.length ? t : e, s = o.indexOf(a);
if (-1 != s) return r = [ [ DIFF_INSERT, o.substring(0, s) ], [ DIFF_EQUAL, a ], [ DIFF_INSERT, o.substring(s + a.length) ] ],
e.length > t.length && (r[0][0] = r[2][0] = DIFF_DELETE), r;
if (1 == a.length) return [ [ DIFF_DELETE, e ], [ DIFF_INSERT, t ] ];
var l = this.diff_halfMatch_(e, t);
if (l) {
var c = l[0], u = l[1], d = l[2], p = l[3], h = l[4], f = this.diff_main(c, d, n, i), m = this.diff_main(u, p, n, i);
return f.concat([ [ DIFF_EQUAL, h ] ], m);
}
return n && e.length > 100 && t.length > 100 ? this.diff_lineMode_(e, t, i) : this.diff_bisect_(e, t, i);
}, diff_match_patch.prototype.diff_lineMode_ = function(e, t, n) {
var i = this.diff_linesToChars_(e, t);
e = i.chars1, t = i.chars2;
var r = i.lineArray, o = this.diff_main(e, t, !1, n);
this.diff_charsToLines_(o, r), this.diff_cleanupSemantic(o), o.push([ DIFF_EQUAL, "" ]);
for (var a = 0, s = 0, l = 0, c = "", u = ""; a < o.length; ) {
switch (o[a][0]) {
case DIFF_INSERT:
l++, u += o[a][1];
break;
case DIFF_DELETE:
s++, c += o[a][1];
break;
case DIFF_EQUAL:
if (s >= 1 && l >= 1) {
o.splice(a - s - l, s + l), a = a - s - l;
for (var i = this.diff_main(c, u, !1, n), d = i.length - 1; d >= 0; d--) o.splice(a, 0, i[d]);
a += i.length;
}
l = 0, s = 0, c = "", u = "";
}
a++;
}
return o.pop(), o;
}, diff_match_patch.prototype.diff_bisect_ = function(e, t, n) {
for (var i = e.length, r = t.length, o = Math.ceil((i + r) / 2), a = o, s = 2 * o, l = new Array(s), c = new Array(s), u = 0; s > u; u++) l[u] = -1,
c[u] = -1;
l[a + 1] = 0, c[a + 1] = 0;
for (var d = i - r, p = d % 2 != 0, h = 0, f = 0, m = 0, g = 0, v = 0; o > v && !(new Date().getTime() > n); v++) {
for (var b = -v + h; v - f >= b; b += 2) {
var y, x = a + b;
y = b == -v || b != v && l[x - 1] < l[x + 1] ? l[x + 1] : l[x - 1] + 1;
for (var w = y - b; i > y && r > w && e.charAt(y) == t.charAt(w); ) y++, w++;
if (l[x] = y, y > i) f += 2; else if (w > r) h += 2; else if (p) {
var S = a + d - b;
if (S >= 0 && s > S && -1 != c[S]) {
var C = i - c[S];
if (y >= C) return this.diff_bisectSplit_(e, t, y, w, n);
}
}
}
for (var _ = -v + m; v - g >= _; _ += 2) {
var C, S = a + _;
C = _ == -v || _ != v && c[S - 1] < c[S + 1] ? c[S + 1] : c[S - 1] + 1;
for (var k = C - _; i > C && r > k && e.charAt(i - C - 1) == t.charAt(r - k - 1); ) C++,
k++;
if (c[S] = C, C > i) g += 2; else if (k > r) m += 2; else if (!p) {
var x = a + d - _;
if (x >= 0 && s > x && -1 != l[x]) {
var y = l[x], w = a + y - x;
if (C = i - C, y >= C) return this.diff_bisectSplit_(e, t, y, w, n);
}
}
}
}
return [ [ DIFF_DELETE, e ], [ DIFF_INSERT, t ] ];
}, diff_match_patch.prototype.diff_bisectSplit_ = function(e, t, n, i, r) {
var o = e.substring(0, n), a = t.substring(0, i), s = e.substring(n), l = t.substring(i), c = this.diff_main(o, a, !1, r), u = this.diff_main(s, l, !1, r);
return c.concat(u);
}, diff_match_patch.prototype.diff_linesToChars_ = function(e, t) {
function n(e) {
for (var t = "", n = 0, o = -1, a = i.length; o < e.length - 1; ) {
o = e.indexOf("\n", n), -1 == o && (o = e.length - 1);
var s = e.substring(n, o + 1);
n = o + 1, (r.hasOwnProperty ? r.hasOwnProperty(s) : void 0 !== r[s]) ? t += String.fromCharCode(r[s]) : (t += String.fromCharCode(a),
r[s] = a, i[a++] = s);
}
return t;
}
var i = [], r = {};
i[0] = "";
var o = n(e), a = n(t);
return {
chars1: o,
chars2: a,
lineArray: i
};
}, diff_match_patch.prototype.diff_charsToLines_ = function(e, t) {
for (var n = 0; n < e.length; n++) {
for (var i = e[n][1], r = [], o = 0; o < i.length; o++) r[o] = t[i.charCodeAt(o)];
e[n][1] = r.join("");
}
}, diff_match_patch.prototype.diff_commonPrefix = function(e, t) {
if (!e || !t || e.charAt(0) != t.charAt(0)) return 0;
for (var n = 0, i = Math.min(e.length, t.length), r = i, o = 0; r > n; ) e.substring(o, r) == t.substring(o, r) ? (n = r,
o = n) : i = r, r = Math.floor((i - n) / 2 + n);
return r;
}, diff_match_patch.prototype.diff_commonSuffix = function(e, t) {
if (!e || !t || e.charAt(e.length - 1) != t.charAt(t.length - 1)) return 0;
for (var n = 0, i = Math.min(e.length, t.length), r = i, o = 0; r > n; ) e.substring(e.length - r, e.length - o) == t.substring(t.length - r, t.length - o) ? (n = r,
o = n) : i = r, r = Math.floor((i - n) / 2 + n);
return r;
}, diff_match_patch.prototype.diff_commonOverlap_ = function(e, t) {
var n = e.length, i = t.length;
if (0 == n || 0 == i) return 0;
n > i ? e = e.substring(n - i) : i > n && (t = t.substring(0, n));
var r = Math.min(n, i);
if (e == t) return r;
for (var o = 0, a = 1; ;) {
var s = e.substring(r - a), l = t.indexOf(s);
if (-1 == l) return o;
a += l, (0 == l || e.substring(r - a) == t.substring(0, a)) && (o = a, a++);
}
}, diff_match_patch.prototype.diff_halfMatch_ = function(e, t) {
function n(e, t, n) {
for (var i, r, o, s, l = e.substring(n, n + Math.floor(e.length / 4)), c = -1, u = ""; -1 != (c = t.indexOf(l, c + 1)); ) {
var d = a.diff_commonPrefix(e.substring(n), t.substring(c)), p = a.diff_commonSuffix(e.substring(0, n), t.substring(0, c));
u.length < p + d && (u = t.substring(c - p, c) + t.substring(c, c + d), i = e.substring(0, n - p),
r = e.substring(n + d), o = t.substring(0, c - p), s = t.substring(c + d));
}
return 2 * u.length >= e.length ? [ i, r, o, s, u ] : null;
}
if (this.Diff_Timeout <= 0) return null;
var i = e.length > t.length ? e : t, r = e.length > t.length ? t : e;
if (i.length < 4 || 2 * r.length < i.length) return null;
var o, a = this, s = n(i, r, Math.ceil(i.length / 4)), l = n(i, r, Math.ceil(i.length / 2));
if (!s && !l) return null;
o = l ? s && s[4].length > l[4].length ? s : l : s;
var c, u, d, p;
e.length > t.length ? (c = o[0], u = o[1], d = o[2], p = o[3]) : (d = o[0], p = o[1],
c = o[2], u = o[3]);
var h = o[4];
return [ c, u, d, p, h ];
}, diff_match_patch.prototype.diff_cleanupSemantic = function(e) {
for (var t = !1, n = [], i = 0, r = null, o = 0, a = 0, s = 0, l = 0, c = 0; o < e.length; ) e[o][0] == DIFF_EQUAL ? (n[i++] = o,
a = l, s = c, l = 0, c = 0, r = e[o][1]) : (e[o][0] == DIFF_INSERT ? l += e[o][1].length : c += e[o][1].length,
r && r.length <= Math.max(a, s) && r.length <= Math.max(l, c) && (e.splice(n[i - 1], 0, [ DIFF_DELETE, r ]),
e[n[i - 1] + 1][0] = DIFF_INSERT, i--, i--, o = i > 0 ? n[i - 1] : -1, a = 0, s = 0,
l = 0, c = 0, r = null, t = !0)), o++;
for (t && this.diff_cleanupMerge(e), this.diff_cleanupSemanticLossless(e), o = 1; o < e.length; ) {
if (e[o - 1][0] == DIFF_DELETE && e[o][0] == DIFF_INSERT) {
var u = e[o - 1][1], d = e[o][1], p = this.diff_commonOverlap_(u, d), h = this.diff_commonOverlap_(d, u);
p >= h ? (p >= u.length / 2 || p >= d.length / 2) && (e.splice(o, 0, [ DIFF_EQUAL, d.substring(0, p) ]),
e[o - 1][1] = u.substring(0, u.length - p), e[o + 1][1] = d.substring(p), o++) : (h >= u.length / 2 || h >= d.length / 2) && (e.splice(o, 0, [ DIFF_EQUAL, u.substring(0, h) ]),
e[o - 1][0] = DIFF_INSERT, e[o - 1][1] = d.substring(0, d.length - h), e[o + 1][0] = DIFF_DELETE,
e[o + 1][1] = u.substring(h), o++), o++;
}
o++;
}
}, diff_match_patch.prototype.diff_cleanupSemanticLossless = function(e) {
function t(e, t) {
if (!e || !t) return 6;
var n = e.charAt(e.length - 1), i = t.charAt(0), r = n.match(diff_match_patch.nonAlphaNumericRegex_), o = i.match(diff_match_patch.nonAlphaNumericRegex_), a = r && n.match(diff_match_patch.whitespaceRegex_), s = o && i.match(diff_match_patch.whitespaceRegex_), l = a && n.match(diff_match_patch.linebreakRegex_), c = s && i.match(diff_match_patch.linebreakRegex_), u = l && e.match(diff_match_patch.blanklineEndRegex_), d = c && t.match(diff_match_patch.blanklineStartRegex_);
return u || d ? 5 : l || c ? 4 : r && !a && s ? 3 : a || s ? 2 : r || o ? 1 : 0;
}
for (var n = 1; n < e.length - 1; ) {
if (e[n - 1][0] == DIFF_EQUAL && e[n + 1][0] == DIFF_EQUAL) {
var i = e[n - 1][1], r = e[n][1], o = e[n + 1][1], a = this.diff_commonSuffix(i, r);
if (a) {
var s = r.substring(r.length - a);
i = i.substring(0, i.length - a), r = s + r.substring(0, r.length - a), o = s + o;
}
for (var l = i, c = r, u = o, d = t(i, r) + t(r, o); r.charAt(0) === o.charAt(0); ) {
i += r.charAt(0), r = r.substring(1) + o.charAt(0), o = o.substring(1);
var p = t(i, r) + t(r, o);
p >= d && (d = p, l = i, c = r, u = o);
}
e[n - 1][1] != l && (l ? e[n - 1][1] = l : (e.splice(n - 1, 1), n--), e[n][1] = c,
u ? e[n + 1][1] = u : (e.splice(n + 1, 1), n--));
}
n++;
}
}, diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/, diff_match_patch.whitespaceRegex_ = /\s/,
diff_match_patch.linebreakRegex_ = /[\r\n]/, diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/,
diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/, diff_match_patch.prototype.diff_cleanupEfficiency = function(e) {
for (var t = !1, n = [], i = 0, r = null, o = 0, a = !1, s = !1, l = !1, c = !1; o < e.length; ) e[o][0] == DIFF_EQUAL ? (e[o][1].length < this.Diff_EditCost && (l || c) ? (n[i++] = o,
a = l, s = c, r = e[o][1]) : (i = 0, r = null), l = c = !1) : (e[o][0] == DIFF_DELETE ? c = !0 : l = !0,
r && (a && s && l && c || r.length < this.Diff_EditCost / 2 && a + s + l + c == 3) && (e.splice(n[i - 1], 0, [ DIFF_DELETE, r ]),
e[n[i - 1] + 1][0] = DIFF_INSERT, i--, r = null, a && s ? (l = c = !0, i = 0) : (i--,
o = i > 0 ? n[i - 1] : -1, l = c = !1), t = !0)), o++;
t && this.diff_cleanupMerge(e);
}, diff_match_patch.prototype.diff_cleanupMerge = function(e) {
e.push([ DIFF_EQUAL, "" ]);
for (var t, n = 0, i = 0, r = 0, o = "", a = ""; n < e.length; ) switch (e[n][0]) {
case DIFF_INSERT:
r++, a += e[n][1], n++;
break;
case DIFF_DELETE:
i++, o += e[n][1], n++;
break;
case DIFF_EQUAL:
i + r > 1 ? (0 !== i && 0 !== r && (t = this.diff_commonPrefix(a, o), 0 !== t && (n - i - r > 0 && e[n - i - r - 1][0] == DIFF_EQUAL ? e[n - i - r - 1][1] += a.substring(0, t) : (e.splice(0, 0, [ DIFF_EQUAL, a.substring(0, t) ]),
n++), a = a.substring(t), o = o.substring(t)), t = this.diff_commonSuffix(a, o),
0 !== t && (e[n][1] = a.substring(a.length - t) + e[n][1], a = a.substring(0, a.length - t),
o = o.substring(0, o.length - t))), 0 === i ? e.splice(n - r, i + r, [ DIFF_INSERT, a ]) : 0 === r ? e.splice(n - i, i + r, [ DIFF_DELETE, o ]) : e.splice(n - i - r, i + r, [ DIFF_DELETE, o ], [ DIFF_INSERT, a ]),
n = n - i - r + (i ? 1 : 0) + (r ? 1 : 0) + 1) : 0 !== n && e[n - 1][0] == DIFF_EQUAL ? (e[n - 1][1] += e[n][1],
e.splice(n, 1)) : n++, r = 0, i = 0, o = "", a = "";
}
"" === e[e.length - 1][1] && e.pop();
var s = !1;
for (n = 1; n < e.length - 1; ) e[n - 1][0] == DIFF_EQUAL && e[n + 1][0] == DIFF_EQUAL && (e[n][1].substring(e[n][1].length - e[n - 1][1].length) == e[n - 1][1] ? (e[n][1] = e[n - 1][1] + e[n][1].substring(0, e[n][1].length - e[n - 1][1].length),
e[n + 1][1] = e[n - 1][1] + e[n + 1][1], e.splice(n - 1, 1), s = !0) : e[n][1].substring(0, e[n + 1][1].length) == e[n + 1][1] && (e[n - 1][1] += e[n + 1][1],
e[n][1] = e[n][1].substring(e[n + 1][1].length) + e[n + 1][1], e.splice(n + 1, 1),
s = !0)), n++;
s && this.diff_cleanupMerge(e);
}, diff_match_patch.prototype.diff_xIndex = function(e, t) {
var n, i = 0, r = 0, o = 0, a = 0;
for (n = 0; n < e.length && (e[n][0] !== DIFF_INSERT && (i += e[n][1].length), e[n][0] !== DIFF_DELETE && (r += e[n][1].length),
!(i > t)); n++) o = i, a = r;
return e.length != n && e[n][0] === DIFF_DELETE ? a : a + (t - o);
}, diff_match_patch.prototype.diff_prettyHtml = function(e) {
for (var t = [], n = /&/g, i = //g, o = /\n/g, a = 0; a < e.length; a++) {
var s = e[a][0], l = e[a][1], c = l.replace(n, "&").replace(i, "<").replace(r, ">").replace(o, "¶ ");
switch (s) {
case DIFF_INSERT:
t[a] = '' + c + "";
break;
case DIFF_DELETE:
t[a] = '' + c + "";
break;
case DIFF_EQUAL:
t[a] = "" + c + "";
}
}
return t.join("");
}, diff_match_patch.prototype.diff_text1 = function(e) {
for (var t = [], n = 0; n < e.length; n++) e[n][0] !== DIFF_INSERT && (t[n] = e[n][1]);
return t.join("");
}, diff_match_patch.prototype.diff_text2 = function(e) {
for (var t = [], n = 0; n < e.length; n++) e[n][0] !== DIFF_DELETE && (t[n] = e[n][1]);
return t.join("");
}, diff_match_patch.prototype.diff_levenshtein = function(e) {
for (var t = 0, n = 0, i = 0, r = 0; r < e.length; r++) {
var o = e[r][0], a = e[r][1];
switch (o) {
case DIFF_INSERT:
n += a.length;
break;
case DIFF_DELETE:
i += a.length;
break;
case DIFF_EQUAL:
t += Math.max(n, i), n = 0, i = 0;
}
}
return t += Math.max(n, i);
}, diff_match_patch.prototype.diff_toDelta = function(e) {
for (var t = [], n = 0; n < e.length; n++) switch (e[n][0]) {
case DIFF_INSERT:
t[n] = "+" + encodeURI(e[n][1]);
break;
case DIFF_DELETE:
t[n] = "-" + e[n][1].length;
break;
case DIFF_EQUAL:
t[n] = "=" + e[n][1].length;
}
return t.join(" ").replace(/%20/g, " ");
}, diff_match_patch.prototype.diff_fromDelta = function(e, t) {
for (var n = [], i = 0, r = 0, o = t.split(/\t/g), a = 0; a < o.length; a++) {
var s = o[a].substring(1);
switch (o[a].charAt(0)) {
case "+":
try {
n[i++] = [ DIFF_INSERT, decodeURI(s) ];
} catch (l) {
throw new Error("Illegal escape in diff_fromDelta: " + s);
}
break;
case "-":
case "=":
var c = parseInt(s, 10);
if (isNaN(c) || 0 > c) throw new Error("Invalid number in diff_fromDelta: " + s);
var u = e.substring(r, r += c);
n[i++] = "=" == o[a].charAt(0) ? [ DIFF_EQUAL, u ] : [ DIFF_DELETE, u ];
break;
default:
if (o[a]) throw new Error("Invalid diff operation in diff_fromDelta: " + o[a]);
}
}
if (r != e.length) throw new Error("Delta length (" + r + ") does not equal source text length (" + e.length + ").");
return n;
}, diff_match_patch.prototype.match_main = function(e, t, n) {
if (null == e || null == t || null == n) throw new Error("Null input. (match_main)");
return n = Math.max(0, Math.min(n, e.length)), e == t ? 0 : e.length ? e.substring(n, n + t.length) == t ? n : this.match_bitap_(e, t, n) : -1;
}, diff_match_patch.prototype.match_bitap_ = function(e, t, n) {
function i(e, i) {
var r = e / t.length, a = Math.abs(n - i);
return o.Match_Distance ? r + a / o.Match_Distance : a ? 1 : r;
}
if (t.length > this.Match_MaxBits) throw new Error("Pattern too long for this browser.");
var r = this.match_alphabet_(t), o = this, a = this.Match_Threshold, s = e.indexOf(t, n);
-1 != s && (a = Math.min(i(0, s), a), s = e.lastIndexOf(t, n + t.length), -1 != s && (a = Math.min(i(0, s), a)));
var l = 1 << t.length - 1;
s = -1;
for (var c, u, d, p = t.length + e.length, h = 0; h < t.length; h++) {
for (c = 0, u = p; u > c; ) i(h, n + u) <= a ? c = u : p = u, u = Math.floor((p - c) / 2 + c);
p = u;
var f = Math.max(1, n - u + 1), m = Math.min(n + u, e.length) + t.length, g = Array(m + 2);
g[m + 1] = (1 << h) - 1;
for (var v = m; v >= f; v--) {
var b = r[e.charAt(v - 1)];
if (g[v] = 0 === h ? (g[v + 1] << 1 | 1) & b : (g[v + 1] << 1 | 1) & b | ((d[v + 1] | d[v]) << 1 | 1) | d[v + 1],
g[v] & l) {
var y = i(h, v - 1);
if (a >= y) {
if (a = y, s = v - 1, !(s > n)) break;
f = Math.max(1, 2 * n - s);
}
}
}
if (i(h + 1, n) > a) break;
d = g;
}
return s;
}, diff_match_patch.prototype.match_alphabet_ = function(e) {
for (var t = {}, n = 0; n < e.length; n++) t[e.charAt(n)] = 0;
for (var n = 0; n < e.length; n++) t[e.charAt(n)] |= 1 << e.length - n - 1;
return t;
}, diff_match_patch.prototype.patch_addContext_ = function(e, t) {
if (0 != t.length) {
for (var n = t.substring(e.start2, e.start2 + e.length1), i = 0; t.indexOf(n) != t.lastIndexOf(n) && n.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin; ) i += this.Patch_Margin,
n = t.substring(e.start2 - i, e.start2 + e.length1 + i);
i += this.Patch_Margin;
var r = t.substring(e.start2 - i, e.start2);
r && e.diffs.unshift([ DIFF_EQUAL, r ]);
var o = t.substring(e.start2 + e.length1, e.start2 + e.length1 + i);
o && e.diffs.push([ DIFF_EQUAL, o ]), e.start1 -= r.length, e.start2 -= r.length,
e.length1 += r.length + o.length, e.length2 += r.length + o.length;
}
}, diff_match_patch.prototype.patch_make = function(e, t, n) {
var i, r;
if ("string" == typeof e && "string" == typeof t && "undefined" == typeof n) i = e,
r = this.diff_main(i, t, !0), r.length > 2 && (this.diff_cleanupSemantic(r), this.diff_cleanupEfficiency(r)); else if (e && "object" == typeof e && "undefined" == typeof t && "undefined" == typeof n) r = e,
i = this.diff_text1(r); else if ("string" == typeof e && t && "object" == typeof t && "undefined" == typeof n) i = e,
r = t; else {
if ("string" != typeof e || "string" != typeof t || !n || "object" != typeof n) throw new Error("Unknown call format to patch_make.");
i = e, r = n;
}
if (0 === r.length) return [];
for (var o = [], a = new diff_match_patch.patch_obj(), s = 0, l = 0, c = 0, u = i, d = i, p = 0; p < r.length; p++) {
var h = r[p][0], f = r[p][1];
switch (s || h === DIFF_EQUAL || (a.start1 = l, a.start2 = c), h) {
case DIFF_INSERT:
a.diffs[s++] = r[p], a.length2 += f.length, d = d.substring(0, c) + f + d.substring(c);
break;
case DIFF_DELETE:
a.length1 += f.length, a.diffs[s++] = r[p], d = d.substring(0, c) + d.substring(c + f.length);
break;
case DIFF_EQUAL:
f.length <= 2 * this.Patch_Margin && s && r.length != p + 1 ? (a.diffs[s++] = r[p],
a.length1 += f.length, a.length2 += f.length) : f.length >= 2 * this.Patch_Margin && s && (this.patch_addContext_(a, u),
o.push(a), a = new diff_match_patch.patch_obj(), s = 0, u = d, l = c);
}
h !== DIFF_INSERT && (l += f.length), h !== DIFF_DELETE && (c += f.length);
}
return s && (this.patch_addContext_(a, u), o.push(a)), o;
}, diff_match_patch.prototype.patch_deepCopy = function(e) {
for (var t = [], n = 0; n < e.length; n++) {
var i = e[n], r = new diff_match_patch.patch_obj();
r.diffs = [];
for (var o = 0; o < i.diffs.length; o++) r.diffs[o] = i.diffs[o].slice();
r.start1 = i.start1, r.start2 = i.start2, r.length1 = i.length1, r.length2 = i.length2,
t[n] = r;
}
return t;
}, diff_match_patch.prototype.patch_apply = function(e, t) {
if (0 == e.length) return [ t, [] ];
e = this.patch_deepCopy(e);
var n = this.patch_addPadding(e);
t = n + t + n, this.patch_splitMax(e);
for (var i = 0, r = [], o = 0; o < e.length; o++) {
var a, s = e[o].start2 + i, l = this.diff_text1(e[o].diffs), c = -1;
if (l.length > this.Match_MaxBits ? (a = this.match_main(t, l.substring(0, this.Match_MaxBits), s),
-1 != a && (c = this.match_main(t, l.substring(l.length - this.Match_MaxBits), s + l.length - this.Match_MaxBits),
(-1 == c || a >= c) && (a = -1))) : a = this.match_main(t, l, s), -1 == a) r[o] = !1,
i -= e[o].length2 - e[o].length1; else {
r[o] = !0, i = a - s;
var u;
if (u = -1 == c ? t.substring(a, a + l.length) : t.substring(a, c + this.Match_MaxBits),
l == u) t = t.substring(0, a) + this.diff_text2(e[o].diffs) + t.substring(a + l.length); else {
var d = this.diff_main(l, u, !1);
if (l.length > this.Match_MaxBits && this.diff_levenshtein(d) / l.length > this.Patch_DeleteThreshold) r[o] = !1; else {
this.diff_cleanupSemanticLossless(d);
for (var p, h = 0, f = 0; f < e[o].diffs.length; f++) {
var m = e[o].diffs[f];
m[0] !== DIFF_EQUAL && (p = this.diff_xIndex(d, h)), m[0] === DIFF_INSERT ? t = t.substring(0, a + p) + m[1] + t.substring(a + p) : m[0] === DIFF_DELETE && (t = t.substring(0, a + p) + t.substring(a + this.diff_xIndex(d, h + m[1].length))),
m[0] !== DIFF_DELETE && (h += m[1].length);
}
}
}
}
}
return t = t.substring(n.length, t.length - n.length), [ t, r ];
}, diff_match_patch.prototype.patch_addPadding = function(e) {
for (var t = this.Patch_Margin, n = "", i = 1; t >= i; i++) n += String.fromCharCode(i);
for (var i = 0; i < e.length; i++) e[i].start1 += t, e[i].start2 += t;
var r = e[0], o = r.diffs;
if (0 == o.length || o[0][0] != DIFF_EQUAL) o.unshift([ DIFF_EQUAL, n ]), r.start1 -= t,
r.start2 -= t, r.length1 += t, r.length2 += t; else if (t > o[0][1].length) {
var a = t - o[0][1].length;
o[0][1] = n.substring(o[0][1].length) + o[0][1], r.start1 -= a, r.start2 -= a, r.length1 += a,
r.length2 += a;
}
if (r = e[e.length - 1], o = r.diffs, 0 == o.length || o[o.length - 1][0] != DIFF_EQUAL) o.push([ DIFF_EQUAL, n ]),
r.length1 += t, r.length2 += t; else if (t > o[o.length - 1][1].length) {
var a = t - o[o.length - 1][1].length;
o[o.length - 1][1] += n.substring(0, a), r.length1 += a, r.length2 += a;
}
return n;
}, diff_match_patch.prototype.patch_splitMax = function(e) {
for (var t = this.Match_MaxBits, n = 0; n < e.length; n++) if (!(e[n].length1 <= t)) {
var i = e[n];
e.splice(n--, 1);
for (var r = i.start1, o = i.start2, a = ""; 0 !== i.diffs.length; ) {
var s = new diff_match_patch.patch_obj(), l = !0;
for (s.start1 = r - a.length, s.start2 = o - a.length, "" !== a && (s.length1 = s.length2 = a.length,
s.diffs.push([ DIFF_EQUAL, a ])); 0 !== i.diffs.length && s.length1 < t - this.Patch_Margin; ) {
var c = i.diffs[0][0], u = i.diffs[0][1];
c === DIFF_INSERT ? (s.length2 += u.length, o += u.length, s.diffs.push(i.diffs.shift()),
l = !1) : c === DIFF_DELETE && 1 == s.diffs.length && s.diffs[0][0] == DIFF_EQUAL && u.length > 2 * t ? (s.length1 += u.length,
r += u.length, l = !1, s.diffs.push([ c, u ]), i.diffs.shift()) : (u = u.substring(0, t - s.length1 - this.Patch_Margin),
s.length1 += u.length, r += u.length, c === DIFF_EQUAL ? (s.length2 += u.length,
o += u.length) : l = !1, s.diffs.push([ c, u ]), u == i.diffs[0][1] ? i.diffs.shift() : i.diffs[0][1] = i.diffs[0][1].substring(u.length));
}
a = this.diff_text2(s.diffs), a = a.substring(a.length - this.Patch_Margin);
var d = this.diff_text1(i.diffs).substring(0, this.Patch_Margin);
"" !== d && (s.length1 += d.length, s.length2 += d.length, 0 !== s.diffs.length && s.diffs[s.diffs.length - 1][0] === DIFF_EQUAL ? s.diffs[s.diffs.length - 1][1] += d : s.diffs.push([ DIFF_EQUAL, d ])),
l || e.splice(++n, 0, s);
}
}
}, diff_match_patch.prototype.patch_toText = function(e) {
for (var t = [], n = 0; n < e.length; n++) t[n] = e[n];
return t.join("");
}, diff_match_patch.prototype.patch_fromText = function(e) {
var t = [];
if (!e) return t;
for (var n = e.split("\n"), i = 0, r = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/; i < n.length; ) {
var o = n[i].match(r);
if (!o) throw new Error("Invalid patch string: " + n[i]);
var a = new diff_match_patch.patch_obj();
for (t.push(a), a.start1 = parseInt(o[1], 10), "" === o[2] ? (a.start1--, a.length1 = 1) : "0" == o[2] ? a.length1 = 0 : (a.start1--,
a.length1 = parseInt(o[2], 10)), a.start2 = parseInt(o[3], 10), "" === o[4] ? (a.start2--,
a.length2 = 1) : "0" == o[4] ? a.length2 = 0 : (a.start2--, a.length2 = parseInt(o[4], 10)),
i++; i < n.length; ) {
var s = n[i].charAt(0);
try {
var l = decodeURI(n[i].substring(1));
} catch (c) {
throw new Error("Illegal escape in patch_fromText: " + l);
}
if ("-" == s) a.diffs.push([ DIFF_DELETE, l ]); else if ("+" == s) a.diffs.push([ DIFF_INSERT, l ]); else if (" " == s) a.diffs.push([ DIFF_EQUAL, l ]); else {
if ("@" == s) break;
if ("" !== s) throw new Error('Invalid patch mode "' + s + '" in: ' + l);
}
i++;
}
}
return t;
}, diff_match_patch.patch_obj = function() {
this.diffs = [], this.start1 = null, this.start2 = null, this.length1 = 0, this.length2 = 0;
}, diff_match_patch.patch_obj.prototype.toString = function() {
var e, t;
e = 0 === this.length1 ? this.start1 + ",0" : 1 == this.length1 ? this.start1 + 1 : this.start1 + 1 + "," + this.length1,
t = 0 === this.length2 ? this.start2 + ",0" : 1 == this.length2 ? this.start2 + 1 : this.start2 + 1 + "," + this.length2;
for (var n, i = [ "@@ -" + e + " +" + t + " @@\n" ], r = 0; r < this.diffs.length; r++) {
switch (this.diffs[r][0]) {
case DIFF_INSERT:
n = "+";
break;
case DIFF_DELETE:
n = "-";
break;
case DIFF_EQUAL:
n = " ";
}
i[r + 1] = n + encodeURI(this.diffs[r][1]) + "\n";
}
return i.join("").replace(/%20/g, " ");
}, this.diff_match_patch = diff_match_patch, this.DIFF_DELETE = DIFF_DELETE, this.DIFF_INSERT = DIFF_INSERT,
this.DIFF_EQUAL = DIFF_EQUAL, define("diff_match_patch_uncompressed", function(e) {
return function() {
var t;
return t || e.diff_match_patch;
};
}(this)), !function(e) {
if ("object" == typeof exports) module.exports = e(); else if ("function" == typeof define && define.amd) define("jsondiffpatch", e); else {
var t;
"undefined" != typeof window ? t = window : "undefined" != typeof global ? t = global : "undefined" != typeof self && (t = self),
t.jsondiffpatch = e();
}
}(function() {
return function e(t, n, i) {
function r(a, s) {
if (!n[a]) {
if (!t[a]) {
var l = "function" == typeof require && require;
if (!s && l) return l(a, !0);
if (o) return o(a, !0);
throw new Error("Cannot find module '" + a + "'");
}
var c = n[a] = {
exports: {}
};
t[a][0].call(c.exports, function(e) {
var n = t[a][1][e];
return r(n ? n : e);
}, c, c.exports, e, t, n, i);
}
return n[a].exports;
}
for (var o = "function" == typeof require && require, a = 0; a < i.length; a++) r(i[a]);
return r;
}({
1: [ function(e, t) {
var n = t.exports = {};
n.nextTick = function() {
var e = "undefined" != typeof window && window.setImmediate, t = "undefined" != typeof window && window.postMessage && window.addEventListener;
if (e) return function(e) {
return window.setImmediate(e);
};
if (t) {
var n = [];
return window.addEventListener("message", function(e) {
var t = e.source;
if ((t === window || null === t) && "process-tick" === e.data && (e.stopPropagation(),
n.length > 0)) {
var i = n.shift();
i();
}
}, !0), function(e) {
n.push(e), window.postMessage("process-tick", "*");
};
}
return function(e) {
setTimeout(e, 0);
};
}(), n.title = "browser", n.browser = !0, n.env = {}, n.argv = [], n.binding = function() {
throw new Error("process.binding is not supported");
}, n.cwd = function() {
return "/";
}, n.chdir = function() {
throw new Error("process.chdir is not supported");
};
}, {} ],
2: [ function(e, t, n) {
var i = e("../pipe").Pipe, r = function() {};
r.prototype.setResult = function(e) {
return this.result = e, this.hasResult = !0, this;
}, r.prototype.exit = function() {
return this.exiting = !0, this;
}, r.prototype.switchTo = function(e, t) {
return "string" == typeof e || e instanceof i ? this.nextPipe = e : (this.next = e,
t && (this.nextPipe = t)), this;
}, r.prototype.push = function(e, t) {
return e.parent = this, "undefined" != typeof t && (e.childName = t), e.root = this.root || this,
e.options = e.options || this.options, this.children ? (this.children[this.children.length - 1].next = e,
this.children.push(e)) : (this.children = [ e ], this.nextAfterChildren = this.next || null,
this.next = e), e.next = this, this;
}, n.Context = r;
}, {
"../pipe": 15
} ],
3: [ function(e, t, n) {
var i = e("./context").Context, r = function(e, t) {
this.left = e, this.right = t, this.pipe = "diff";
};
r.prototype = new i(), n.DiffContext = r;
}, {
"./context": 2
} ],
4: [ function(e, t, n) {
var i = e("./context").Context, r = function(e, t) {
this.left = e, this.delta = t, this.pipe = "patch";
};
r.prototype = new i(), n.PatchContext = r;
}, {
"./context": 2
} ],
5: [ function(e, t, n) {
var i = e("./context").Context, r = function(e) {
this.delta = e, this.pipe = "reverse";
};
r.prototype = new i(), n.ReverseContext = r;
}, {
"./context": 2
} ],
6: [ function(e, t) {
t.exports = function(e, t) {
var n;
return "string" == typeof t && (n = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(Z|([+\-])(\d{2}):(\d{2}))$/.exec(t)) ? new Date(Date.UTC(+n[1], +n[2] - 1, +n[3], +n[4], +n[5], +n[6])) : t;
};
}, {} ],
7: [ function(e, t, n) {
var i = e("./processor").Processor, r = e("./pipe").Pipe, o = e("./contexts/diff").DiffContext, a = e("./contexts/patch").PatchContext, s = e("./contexts/reverse").ReverseContext, l = e("./filters/trivial"), c = e("./filters/nested"), u = e("./filters/arrays"), d = e("./filters/dates"), p = e("./filters/texts"), h = function(e) {
this.processor = new i(e), this.processor.pipe(new r("diff").append(c.collectChildrenDiffFilter, l.diffFilter, d.diffFilter, p.diffFilter, c.objectsDiffFilter, u.diffFilter).shouldHaveResult()),
this.processor.pipe(new r("patch").append(c.collectChildrenPatchFilter, u.collectChildrenPatchFilter, l.patchFilter, p.patchFilter, c.patchFilter, u.patchFilter).shouldHaveResult()),
this.processor.pipe(new r("reverse").append(c.collectChildrenReverseFilter, u.collectChildrenReverseFilter, l.reverseFilter, p.reverseFilter, c.reverseFilter, u.reverseFilter).shouldHaveResult());
};
h.prototype.options = function() {
return this.processor.options.apply(this.processor, arguments);
}, h.prototype.diff = function(e, t) {
return this.processor.process(new o(e, t));
}, h.prototype.patch = function(e, t) {
return this.processor.process(new a(e, t));
}, h.prototype.reverse = function(e) {
return this.processor.process(new s(e));
}, h.prototype.unpatch = function(e, t) {
return this.patch(e, this.reverse(t));
}, n.DiffPatcher = h;
}, {
"./contexts/diff": 3,
"./contexts/patch": 4,
"./contexts/reverse": 5,
"./filters/arrays": 9,
"./filters/dates": 10,
"./filters/nested": 12,
"./filters/texts": 13,
"./filters/trivial": 14,
"./pipe": 15,
"./processor": 16
} ],
8: [ function(e, t, n) {
(function(t) {
var i = e("./diffpatcher").DiffPatcher;
n.DiffPatcher = i, n.create = function(e) {
return new i(e);
}, n.dateReviver = e("./date-reviver");
var r;
n.diff = function() {
return r || (r = new i()), r.diff.apply(r, arguments);
}, n.patch = function() {
return r || (r = new i()), r.patch.apply(r, arguments);
}, n.unpatch = function() {
return r || (r = new i()), r.unpatch.apply(r, arguments);
}, n.reverse = function() {
return r || (r = new i()), r.reverse.apply(r, arguments);
};
var o = "undefined" != typeof t && "string" == typeof t.execPath;
if (o) {
var a = e("./formatters/index");
n.formatters = a, n.console = a.console;
} else n.homepage = "https://github.com/benjamine/jsondiffpatch", n.version = "0.1.5";
}).call(this, e("/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
}, {
"./date-reviver": 6,
"./diffpatcher": 7,
"/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js": 1
} ],
9: [ function(e, t, n) {
var i = e("../contexts/diff").DiffContext, r = e("../contexts/patch").PatchContext, o = e("../contexts/reverse").ReverseContext, a = e("./lcs"), s = 3, l = "function" == typeof Array.isArray ? Array.isArray : function(e) {
return e instanceof Array;
}, c = "function" == typeof Array.prototype.indexOf ? function(e, t) {
return e.indexOf(t);
} : function(e, t) {
for (var n = e.length, i = 0; n > i; i++) if (e[i] === t) return i;
return -1;
}, u = function(e) {
if (e.leftIsArray) {
for (var t, n, r, o, l = e.options && e.options.objectHash, u = function(e, t, n, i, r) {
var o = e[n], a = t[i];
if (o === a) return !0;
if ("object" != typeof o || "object" != typeof a) return !1;
if (!l) return !1;
var s, c;
return "number" == typeof n ? (r.hashCache1 = r.hashCache1 || [], s = r.hashCache1[n],
"undefined" == typeof s && (r.hashCache1[n] = s = l(o, n))) : s = l(o), "undefined" == typeof s ? !1 : ("number" == typeof i ? (r.hashCache2 = r.hashCache2 || [],
c = r.hashCache2[i], "undefined" == typeof c && (r.hashCache2[i] = c = l(a, i))) : c = l(a),
"undefined" == typeof c ? !1 : s === c);
}, d = {}, p = 0, h = 0, f = e.left, m = e.right, g = f.length, v = m.length; g > p && v > p && u(f, m, p, p, d); ) t = p,
o = new i(e.left[t], e.right[t]), e.push(o, t), p++;
for (;g > h + p && v > h + p && u(f, m, g - 1 - h, v - 1 - h, d); ) n = g - 1 - h,
r = v - 1 - h, o = new i(e.left[n], e.right[r]), e.push(o, r), h++;
var b;
if (p + h === g) {
if (g === v) return void e.setResult(void 0).exit();
for (b = b || {
_t: "a"
}, t = p; v - h > t; t++) b[t] = [ m[t] ];
return void e.setResult(b).exit();
}
if (p + h === v) {
for (b = b || {
_t: "a"
}, t = p; g - h > t; t++) b["_" + t] = [ f[t], 0, 0 ];
return void e.setResult(b).exit();
}
d = {};
var y = f.slice(p, g - h), x = m.slice(p, v - h), w = a.get(y, x, u, d), S = [];
for (b = b || {
_t: "a"
}, t = p; g - h > t; t++) c(w.indices1, t - p) < 0 && (b["_" + t] = [ f[t], 0, 0 ],
S.push(t));
var C = !0;
e.options && e.options.arrays && e.options.arrays.detectMove === !1 && (C = !1);
var _ = !1;
e.options && e.options.arrays && e.options.arrays.includeValueOnMove && (_ = !0);
var k = S.length;
for (t = p; v - h > t; t++) {
var E = c(w.indices2, t - p);
if (0 > E) {
var T = !1;
if (C && k > 0) for (n = 0; k > n; n++) if (u(y, x, S[n] - p, t - p, d)) {
b["_" + S[n]].splice(1, 2, t, s), _ || (b["_" + S[n]][0] = ""), n = S[n], r = t,
o = new i(e.left[n], e.right[r]), e.push(o, r), S.splice(n, 1), T = !0;
break;
}
T || (b[t] = [ m[t] ]);
} else n = w.indices1[E] + p, r = w.indices2[E] + p, o = new i(e.left[n], e.right[r]),
e.push(o, r);
}
e.setResult(b).exit();
}
};
u.filterName = "arrays";
var d = {
numerically: function(e, t) {
return e - t;
},
numericallyBy: function(e) {
return function(t, n) {
return t[e] - n[e];
};
}
}, p = function(e) {
if (e.nested && "a" === e.delta._t) {
var t, n, i = e.delta, o = e.left, a = [], l = [], c = [];
for (t in i) if ("_t" !== t) if ("_" === t[0]) {
if (0 !== i[t][2] && i[t][2] !== s) throw new Error("only removal or move can be applied at original array indices, invalid diff type: " + i[t][2]);
a.push(parseInt(t.slice(1), 10));
} else 1 === i[t].length ? l.push({
index: parseInt(t, 10),
value: i[t][0]
}) : c.push({
index: parseInt(t, 10),
delta: i[t]
});
for (a = a.sort(d.numerically), t = a.length - 1; t >= 0; t--) {
n = a[t];
var u = i["_" + n], p = o.splice(n, 1)[0];
u[2] === s && l.push({
index: u[1],
value: p
});
}
l = l.sort(d.numericallyBy("index"));
var h = l.length;
for (t = 0; h > t; t++) {
var f = l[t];
o.splice(f.index, 0, f.value);
}
var m, g = c.length;
if (g > 0) for (t = 0; g > t; t++) {
var v = c[t];
m = new r(e.left[v.index], v.delta), e.push(m, v.index);
}
return e.children ? void e.exit() : void e.setResult(e.left).exit();
}
};
p.filterName = "arrays";
var h = function(e) {
if (e && e.children && "a" === e.delta._t) {
for (var t, n = e.children.length, i = 0; n > i; i++) t = e.children[i], e.left[t.childName] = t.result;
e.setResult(e.left).exit();
}
};
h.filterName = "arraysCollectChildren";
var f = function(e) {
if (!e.nested) return void (e.delta[2] === s && (e.newName = "_" + e.delta[1], e.setResult([ e.delta[0], parseInt(e.childName.substr(1), 10), s ]).exit()));
if ("a" === e.delta._t) {
var t, n;
for (t in e.delta) "_t" !== t && (n = new o(e.delta[t]), e.push(n, t));
e.exit();
}
};
f.filterName = "arrays";
var m = function(e, t, n) {
var i = t;
if ("string" == typeof t && "_" === t[0]) i = parseInt(t.substr(1), 10); else {
var r = "_" + t;
if (l(n) && 0 === n[2]) i = r; else for (var o in e) {
var a = e[o];
l(a) && a[2] === s && a[1].toString() === t && (i = o.substr(1));
}
}
return i;
}, g = function(e) {
if (e && e.children && "a" === e.delta._t) {
for (var t, n = e.children.length, i = {
_t: "a"
}, r = 0; n > r; r++) {
t = e.children[r];
var o = t.newName;
"undefined" == typeof o && (o = m(e.delta, t.childName, t.result)), i[o] !== t.result && (i[o] = t.result);
}
e.setResult(i).exit();
}
};
g.filterName = "arraysCollectChildren", n.diffFilter = u, n.patchFilter = p, n.collectChildrenPatchFilter = h,
n.reverseFilter = f, n.collectChildrenReverseFilter = g;
}, {
"../contexts/diff": 3,
"../contexts/patch": 4,
"../contexts/reverse": 5,
"./lcs": 11
} ],
10: [ function(e, t, n) {
var i = function(e) {
e.left instanceof Date ? (e.setResult(e.right instanceof Date ? e.left.getTime() !== e.right.getTime() ? [ e.left, e.right ] : void 0 : [ e.left, e.right ]),
e.exit()) : e.right instanceof Date && e.setResult([ e.left, e.right ]).exit();
};
i.filterName = "dates", n.diffFilter = i;
}, {} ],
11: [ function(e, t, n) {
var i = function(e, t, n, i) {
return e[n] === t[i];
}, r = function(e, t, n, i) {
var r, o, a = e.length, s = t.length, l = [ a + 1 ];
for (r = 0; a + 1 > r; r++) for (l[r] = [ s + 1 ], o = 0; s + 1 > o; o++) l[r][o] = 0;
for (l.match = n, r = 1; a + 1 > r; r++) for (o = 1; s + 1 > o; o++) l[r][o] = n(e, t, r - 1, o - 1, i) ? l[r - 1][o - 1] + 1 : Math.max(l[r - 1][o], l[r][o - 1]);
return l;
}, o = function(e, t, n, i, r, a) {
if (0 === i || 0 === r) return {
sequence: [],
indices1: [],
indices2: []
};
if (e.match(t, n, i - 1, r - 1, a)) {
var s = o(e, t, n, i - 1, r - 1, a);
return s.sequence.push(t[i - 1]), s.indices1.push(i - 1), s.indices2.push(r - 1),
s;
}
return e[i][r - 1] > e[i - 1][r] ? o(e, t, n, i, r - 1, a) : o(e, t, n, i - 1, r, a);
}, a = function(e, t, n, a) {
a = a || {};
var s = r(e, t, n || i, a), l = o(s, e, t, e.length, t.length, a);
return "string" == typeof e && "string" == typeof t && (l.sequence = l.sequence.join("")),
l;
};
n.get = a;
}, {} ],
12: [ function(e, t, n) {
var i = e("../contexts/diff").DiffContext, r = e("../contexts/patch").PatchContext, o = e("../contexts/reverse").ReverseContext, a = function(e) {
if (e && e.children) {
for (var t, n = e.children.length, i = e.result, r = 0; n > r; r++) t = e.children[r],
"undefined" != typeof t.result && (i = i || {}, i[t.childName] = t.result);
i && e.leftIsArray && (i._t = "a"), e.setResult(i).exit();
}
};
a.filterName = "collectChildren";
var s = function(e) {
if (!e.leftIsArray && "object" === e.leftType) {
var t, n;
for (t in e.left) n = new i(e.left[t], e.right[t]), e.push(n, t);
for (t in e.right) "undefined" == typeof e.left[t] && (n = new i(void 0, e.right[t]),
e.push(n, t));
return e.children && 0 !== e.children.length ? void e.exit() : void e.setResult(void 0).exit();
}
};
s.filterName = "objects";
var l = function(e) {
if (e.nested && !e.delta._t) {
var t, n;
for (t in e.delta) n = new r(e.left[t], e.delta[t]), e.push(n, t);
e.exit();
}
};
l.filterName = "objects";
var c = function(e) {
if (e && e.children && !e.delta._t) {
for (var t, n = e.children.length, i = 0; n > i; i++) t = e.children[i], e.left[t.childName] !== t.result && (e.left[t.childName] = t.result);
e.setResult(e.left).exit();
}
};
c.filterName = "collectChildren";
var u = function(e) {
if (e.nested && !e.delta._t) {
var t, n;
for (t in e.delta) n = new o(e.delta[t]), e.push(n, t);
e.exit();
}
};
u.filterName = "objects";
var d = function(e) {
if (e && e.children && !e.delta._t) {
for (var t, n = e.children.length, i = {}, r = 0; n > r; r++) t = e.children[r],
i[t.childName] !== t.result && (i[t.childName] = t.result);
e.setResult(i).exit();
}
};
d.filterName = "collectChildren", n.collectChildrenDiffFilter = a, n.objectsDiffFilter = s,
n.patchFilter = l, n.collectChildrenPatchFilter = c, n.reverseFilter = u, n.collectChildrenReverseFilter = d;
}, {
"../contexts/diff": 3,
"../contexts/patch": 4,
"../contexts/reverse": 5
} ],
13: [ function(e, t, n) {
var i = 2, r = 60, o = null, a = function() {
if (!o) {
var t;
if ("undefined" != typeof diff_match_patch) t = new diff_match_patch(); else if ("function" == typeof e) {
var n = e("../../external/diff_match_patch_uncompressed");
t = new n.diff_match_patch();
}
if (!t) {
var i = new Error("text diff_match_patch library not found");
throw i.diff_match_patch_not_found = !0, i;
}
o = {
diff: function(e, n) {
return t.patch_toText(t.patch_make(e, n));
},
patch: function(e, n) {
for (var i = t.patch_apply(t.patch_fromText(n), e), r = 0; r < i[1].length; r++) if (!i[1][r]) {
var o = new Error("text patch failed");
o.textPatchFailed = !0;
}
return i[0];
}
};
}
return o;
}, s = function(e) {
if ("string" === e.leftType) {
var t = e.options && e.options.textDiff && e.options.textDiff.minLength || r;
if (e.left.length < t || e.right.length < t) return void e.setResult([ e.left, e.right ]).exit();
var n = a().diff;
e.setResult([ n(e.left, e.right), 0, i ]).exit();
}
};
s.filterName = "texts";
var l = function(e) {
if (!e.nested && e.delta[2] === i) {
var t = a().patch;
e.setResult(t(e.left, e.delta[0])).exit();
}
};
l.filterName = "texts";
var c = function(e) {
var t, n, i, r, o, a, s, l, c = null, u = /^@@ +\-(\d+),(\d+) +\+(\d+),(\d+) +@@$/;
for (i = e.split("\n"), t = 0, n = i.length; n > t; t++) {
r = i[t];
var d = r.slice(0, 1);
"@" === d ? (c = u.exec(r), a = t, s = null, l = null, i[a] = "@@ -" + c[3] + "," + c[4] + " +" + c[1] + "," + c[2] + " @@") : "+" === d ? (s = t,
i[t] = "-" + i[t].slice(1), "+" === i[t - 1].slice(0, 1) && (o = i[t], i[t] = i[t - 1],
i[t - 1] = o)) : "-" === d && (l = t, i[t] = "+" + i[t].slice(1));
}
return i.join("\n");
}, u = function(e) {
e.nested || e.delta[2] === i && e.setResult([ c(e.delta[0]), 0, i ]).exit();
};
u.filterName = "texts", n.diffFilter = s, n.patchFilter = l, n.reverseFilter = u;
}, {} ],
14: [ function(e, t, n) {
var i = "function" == typeof Array.isArray ? Array.isArray : function(e) {
return e instanceof Array;
}, r = function(e) {
if (e.left === e.right) return void e.setResult(void 0).exit();
if ("undefined" == typeof e.left) {
if ("function" == typeof e.right) throw new Error("functions are not supported");
return void e.setResult([ e.right ]).exit();
}
if ("undefined" == typeof e.right) return void e.setResult([ e.left, 0, 0 ]).exit();
if ("function" == typeof e.left || "function" == typeof e.right) throw new Error("functions are not supported");
return e.leftType = null === e.left ? "null" : typeof e.left, e.rightType = null === e.right ? "null" : typeof e.right,
e.leftType !== e.rightType ? void e.setResult([ e.left, e.right ]).exit() : "boolean" === e.leftType || "number" === e.leftType ? void e.setResult([ e.left, e.right ]).exit() : ("object" === e.leftType && (e.leftIsArray = i(e.left)),
"object" === e.rightType && (e.rightIsArray = i(e.right)), e.leftIsArray !== e.rightIsArray ? void e.setResult([ e.left, e.right ]).exit() : void 0);
};
r.filterName = "trivial";
var o = function(e) {
return "undefined" == typeof e.delta ? void e.setResult(e.left).exit() : (e.nested = !i(e.delta),
e.nested ? void 0 : 1 === e.delta.length ? void e.setResult(e.delta[0]).exit() : 2 === e.delta.length ? void e.setResult(e.delta[1]).exit() : 3 === e.delta.length && 0 === e.delta[2] ? void e.setResult(void 0).exit() : void 0);
};
o.filterName = "trivial";
var a = function(e) {
return "undefined" == typeof e.delta ? void e.setResult(e.delta).exit() : (e.nested = !i(e.delta),
e.nested ? void 0 : 1 === e.delta.length ? void e.setResult([ e.delta[0], 0, 0 ]).exit() : 2 === e.delta.length ? void e.setResult([ e.delta[1], e.delta[0] ]).exit() : 3 === e.delta.length && 0 === e.delta[2] ? void e.setResult([ e.delta[0] ]).exit() : void 0);
};
a.filterName = "trivial", n.diffFilter = r, n.patchFilter = o, n.reverseFilter = a;
}, {} ],
15: [ function(e, t, n) {
var i = function(e) {
this.name = e, this.filters = [];
};
i.prototype.process = function(e) {
if (!this.processor) throw new Error("add this pipe to a processor before using it");
for (var t = this.debug, n = this.filters.length, i = e, r = 0; n > r; r++) {
var o = this.filters[r];
if (t && this.log("filter: " + o.filterName), o(i), "object" == typeof i && i.exiting) {
i.exiting = !1;
break;
}
}
!i.next && this.resultCheck && this.resultCheck(i);
}, i.prototype.log = function(e) {
console.log("[jsondiffpatch] " + this.name + " pipe, " + e);
}, i.prototype.append = function() {
return this.filters.push.apply(this.filters, arguments), this;
}, i.prototype.prepend = function() {
return this.filters.unshift.apply(this.filters, arguments), this;
}, i.prototype.indexOf = function(e) {
if (!e) throw new Error("a filter name is required");
for (var t = 0; t < this.filters.length; t++) {
var n = this.filters[t];
if (n.filterName === e) return t;
}
throw new Error("filter not found: " + e);
}, i.prototype.list = function() {
for (var e = [], t = 0; t < this.filters.length; t++) {
var n = this.filters[t];
e.push(n.filterName);
}
return e;
}, i.prototype.after = function(e) {
var t = this.indexOf(e), n = Array.prototype.slice.call(arguments, 1);
if (!n.length) throw new Error("a filter is required");
return n.unshift(t + 1, 0), Array.prototype.splice.apply(this.filters, n), this;
}, i.prototype.before = function(e) {
var t = this.indexOf(e), n = Array.prototype.slice.call(arguments, 1);
if (!n.length) throw new Error("a filter is required");
return n.unshift(t, 0), Array.prototype.splice.apply(this.filters, n), this;
}, i.prototype.clear = function() {
return this.filters.length = 0, this;
}, i.prototype.shouldHaveResult = function(e) {
if (e === !1) return void (this.resultCheck = null);
if (!this.resultCheck) {
var t = this;
return this.resultCheck = function(e) {
if (!e.hasResult) {
console.log(e);
var n = new Error(t.name + " failed");
throw n.noResult = !0, n;
}
}, this;
}
}, n.Pipe = i;
}, {} ],
16: [ function(e, t, n) {
var i = function(e) {
this.selfOptions = e, this.pipes = {};
};
i.prototype.options = function(e) {
return e && (this.selfOptions = e), this.selfOptions;
}, i.prototype.pipe = function(e, t) {
if ("string" == typeof e) {
if ("undefined" == typeof t) return this.pipes[e];
this.pipes[e] = t;
}
if (e && e.name) {
if (t = e, t.processor === this) return t;
this.pipes[t.name] = t;
}
return t.processor = this, t;
}, i.prototype.process = function(e, t) {
var n = e;
n.options = this.options();
for (var i, r, o = t || e.pipe || "default"; o; ) "undefined" != typeof n.nextAfterChildren && (n.next = n.nextAfterChildren,
n.nextAfterChildren = null), "string" == typeof o && (o = this.pipe(o)), o.process(n),
r = n, i = o, o = null, n && n.next && (n = n.next, o = r.nextPipe || n.pipe || i);
return n.hasResult ? n.result : void 0;
}, n.Processor = i;
}, {} ]
}, {}, [ 8 ])(8);
}), "undefined" == typeof WeakMap && !function() {
var e = Object.defineProperty, t = Date.now() % 1e9, n = function() {
this.name = "__st" + (1e9 * Math.random() >>> 0) + (t++ + "__");
};
n.prototype = {
set: function(t, n) {
var i = t[this.name];
i && i[0] === t ? i[1] = n : e(t, this.name, {
value: [ t, n ],
writable: !0
});
},
get: function(e) {
var t;
return (t = e[this.name]) && t[0] === e ? t[1] : void 0;
},
"delete": function(e) {
this.set(e, void 0);
}
}, window.WeakMap = n;
}(), define("WeakMap", function() {}), function(e) {
function t(e) {
x.push(e), y || (y = !0, g(i));
}
function n(e) {
return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(e) || e;
}
function i() {
y = !1;
var e = x;
x = [], e.sort(function(e, t) {
return e.uid_ - t.uid_;
});
var t = !1;
e.forEach(function(e) {
var n = e.takeRecords();
r(e), n.length && (e.callback_(n, e), t = !0);
}), t && i();
}
function r(e) {
e.nodes_.forEach(function(t) {
var n = m.get(t);
n && n.forEach(function(t) {
t.observer === e && t.removeTransientObservers();
});
});
}
function o(e, t) {
for (var n = e; n; n = n.parentNode) {
var i = m.get(n);
if (i) for (var r = 0; r < i.length; r++) {
var o = i[r], a = o.options;
if (n === e || a.subtree) {
var s = t(a);
s && o.enqueue(s);
}
}
}
}
function a(e) {
this.callback_ = e, this.nodes_ = [], this.records_ = [], this.uid_ = ++w;
}
function s(e, t) {
this.type = e, this.target = t, this.addedNodes = [], this.removedNodes = [], this.previousSibling = null,
this.nextSibling = null, this.attributeName = null, this.attributeNamespace = null,
this.oldValue = null;
}
function l(e) {
var t = new s(e.type, e.target);
return t.addedNodes = e.addedNodes.slice(), t.removedNodes = e.removedNodes.slice(),
t.previousSibling = e.previousSibling, t.nextSibling = e.nextSibling, t.attributeName = e.attributeName,
t.attributeNamespace = e.attributeNamespace, t.oldValue = e.oldValue, t;
}
function c(e, t) {
return S = new s(e, t);
}
function u(e) {
return C ? C : (C = l(S), C.oldValue = e, C);
}
function d() {
S = C = void 0;
}
function p(e) {
return e === C || e === S;
}
function h(e, t) {
return e === t ? e : C && p(e) ? C : null;
}
function f(e, t, n) {
this.observer = e, this.target = t, this.options = n, this.transientObservedNodes = [];
}
var m = new WeakMap(), g = window.msSetImmediate;
if (!g) {
var v = [], b = String(Math.random());
window.addEventListener("message", function(e) {
if (e.data === b) {
var t = v;
v = [], t.forEach(function(e) {
e();
});
}
}), g = function(e) {
v.push(e), window.postMessage(b, "*");
};
}
var y = !1, x = [], w = 0;
a.prototype = {
observe: function(e, t) {
if (e = n(e), !t.childList && !t.attributes && !t.characterData || t.attributeOldValue && !t.attributes || t.attributeFilter && t.attributeFilter.length && !t.attributes || t.characterDataOldValue && !t.characterData) throw new SyntaxError();
var i = m.get(e);
i || m.set(e, i = []);
for (var r, o = 0; o < i.length; o++) if (i[o].observer === this) {
r = i[o], r.removeListeners(), r.options = t;
break;
}
r || (r = new f(this, e, t), i.push(r), this.nodes_.push(e)), r.addListeners();
},
disconnect: function() {
this.nodes_.forEach(function(e) {
for (var t = m.get(e), n = 0; n < t.length; n++) {
var i = t[n];
if (i.observer === this) {
i.removeListeners(), t.splice(n, 1);
break;
}
}
}, this), this.records_ = [];
},
takeRecords: function() {
var e = this.records_;
return this.records_ = [], e;
}
};
var S, C;
f.prototype = {
enqueue: function(e) {
var n = this.observer.records_, i = n.length;
if (n.length > 0) {
var r = n[i - 1], o = h(r, e);
if (o) return void (n[i - 1] = o);
} else t(this.observer);
n[i] = e;
},
addListeners: function() {
this.addListeners_(this.target);
},
addListeners_: function(e) {
var t = this.options;
t.attributes && e.addEventListener("DOMAttrModified", this, !0), t.characterData && e.addEventListener("DOMCharacterDataModified", this, !0),
t.childList && e.addEventListener("DOMNodeInserted", this, !0), (t.childList || t.subtree) && e.addEventListener("DOMNodeRemoved", this, !0);
},
removeListeners: function() {
this.removeListeners_(this.target);
},
removeListeners_: function(e) {
var t = this.options;
t.attributes && e.removeEventListener("DOMAttrModified", this, !0), t.characterData && e.removeEventListener("DOMCharacterDataModified", this, !0),
t.childList && e.removeEventListener("DOMNodeInserted", this, !0), (t.childList || t.subtree) && e.removeEventListener("DOMNodeRemoved", this, !0);
},
addTransientObserver: function(e) {
if (e !== this.target) {
this.addListeners_(e), this.transientObservedNodes.push(e);
var t = m.get(e);
t || m.set(e, t = []), t.push(this);
}
},
removeTransientObservers: function() {
var e = this.transientObservedNodes;
this.transientObservedNodes = [], e.forEach(function(e) {
this.removeListeners_(e);
for (var t = m.get(e), n = 0; n < t.length; n++) if (t[n] === this) {
t.splice(n, 1);
break;
}
}, this);
},
handleEvent: function(e) {
switch (e.stopImmediatePropagation(), e.type) {
case "DOMAttrModified":
var t = e.attrName, n = e.relatedNode.namespaceURI, i = e.target, r = new c("attributes", i);
r.attributeName = t, r.attributeNamespace = n;
var a = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
o(i, function(e) {
return !e.attributes || e.attributeFilter && e.attributeFilter.length && -1 === e.attributeFilter.indexOf(t) && -1 === e.attributeFilter.indexOf(n) ? void 0 : e.attributeOldValue ? u(a) : r;
});
break;
case "DOMCharacterDataModified":
var i = e.target, r = c("characterData", i), a = e.prevValue;
o(i, function(e) {
return e.characterData ? e.characterDataOldValue ? u(a) : r : void 0;
});
break;
case "DOMNodeRemoved":
this.addTransientObserver(e.target);
case "DOMNodeInserted":
var s, l, i = e.relatedNode, p = e.target;
"DOMNodeInserted" === e.type ? (s = [ p ], l = []) : (s = [], l = [ p ]);
var h = p.previousSibling, f = p.nextSibling, r = c("childList", i);
r.addedNodes = s, r.removedNodes = l, r.previousSibling = h, r.nextSibling = f,
o(i, function(e) {
return e.childList ? r : void 0;
});
}
d();
}
}, e.JsMutationObserver = a, e.MutationObserver || (e.MutationObserver = a);
}(this), define("MutationObservers", function() {}), Prism.languages.markup = {
comment: /<!--[\w\W]*?-->/g,
prolog: /<\?.+?\?>/,
doctype: /<!DOCTYPE.+?>/,
cdata: /<!\[CDATA\[[\w\W]*?]]>/i,
tag: {
pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,
inside: {
tag: {
pattern: /^<\/?[\w:-]+/i,
inside: {
punctuation: /^<\/?/,
namespace: /^[\w-]+?:/
}
},
"attr-value": {
pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,
inside: {
punctuation: /=|>|"/g
}
},
punctuation: /\/?>/g,
"attr-name": {
pattern: /[\w:-]+/g,
inside: {
namespace: /^[\w-]+?:/
}
}
}
},
entity: /&#?[\da-z]{1,8};/gi
}, Prism.hooks.add("wrap", function(e) {
"entity" === e.type && (e.attributes.title = e.content.replace(/&/, "&"));
}), define("bower-libs/prism/components/prism-markup", function() {}), Prism.languages.latex = {
keyword: /\\(?:[^a-zA-Z]|[a-zA-Z]+)/g,
lparen: /[[({]/g,
rparen: /[\])}]/g,
comment: /%.*/g
}, define("libs/prism-latex", function() {}), Prism.languages.md = function() {
var e = "(&|[-A-Z0-9+@#/%?=~_|[\\]()!:,.;])", t = "(&|[-A-Z0-9+@#/%=~_|[\\])])", n = new RegExp("(https?|ftp)(://" + e + "*" + t + ")(?=$|\\W)", "gi"), i = /(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)/gi, r = Prism.languages.latex, o = /\n/gm, a = {};
a["pre gfm"] = {
pattern: /^`{3}.*\n(?:[\s\S]*?)\n`{3} *$/gm,
inside: {
"md md-pre": /`{3}/,
lf: o
}
}, a["h1 alt"] = {
pattern: /^(.+)[ \t]*\n=+[ \t]*$/gm,
inside: {}
}, a["h2 alt"] = {
pattern: /^(.+)[ \t]*\n-+[ \t]*$/gm,
inside: {}
};
for (var s = 6; s >= 1; s--) a["h" + s] = {
pattern: new RegExp("^#{" + s + "}.+$", "gm"),
inside: {
"md md-hash": new RegExp("^#{" + s + "}")
}
};
a.li = {
pattern: /^[ \t]*([*+\-]|\d+\.)[ \t].+(?:\n|[ \t].*\n)*/gm,
inside: {
"md md-li": /^[ \t]*([*+\-]|\d+\.)[ \t]/m,
"pre gfm": {
pattern: /^((?: {4}|\t)+)`{3}.*\n(?:[\s\S]*?)\n\1`{3} *$/gm,
inside: {
"md md-pre": /`{3}/,
lf: o
}
},
lf: o
}
}, a.pre = {
pattern: /(^|(?:^|(?:^|\n)(?![ \t]*([*+\-]|\d+\.)[ \t]).*\n)\s*?\n)(\s*(?: {4}|\t).*(?:\n|$))+/g,
lookbehind: !0,
inside: {
lf: o
}
}, a.table = {
pattern: new RegExp([ "^", "[ ]{0,3}", "[|]", "(.+)\\n", "[ ]{0,3}", "[|]([ ]*[-:]+[-| :]*)\\n", "(", "(?:[ ]*[|].*\\n?)*", ")", "(?:\\n|$)" ].join(""), "gm"),
inside: {
lf: o
}
}, a["table alt"] = {
pattern: new RegExp([ "^", "[ ]{0,3}", "(\\S.*[|].*)\\n", "[ ]{0,3}", "([-:]+[ ]*[|][-| :]*)\\n", "(", "(?:.*[|].*\\n?)*", ")", "(?:\\n|$)" ].join(""), "gm"),
inside: {
lf: o
}
}, a.hr = {
pattern: /^([*\-_] *){3,}$/gm
}, a.blockquote = {
pattern: /^ {0,3}> *[^\n]+$/gm,
inside: {
"md md-gt": /^ {0,3}> */,
li: a.li
}
}, a["math block"] = {
pattern: /(\$\$|\\\\\[|\\\\\\\\\()[\s\S]*?(\$\$|\\\\\]|\\\\\\\\\))/g,
inside: {
"md md-bracket-start": /^(\$\$|\\\\\[|\\\\\\\\\()/,
"md md-bracket-end": /(\$\$|\\\\\]|\\\\\\\\\))/,
lf: o,
rest: r
}
}, a["latex block"] = {
pattern: /\\?\\begin\{([a-z]*\*?)\}[\s\S]*?\\?\\end\{\1\}/g,
inside: {
keyword: /\\?\\(begin|end)/,
lf: o,
rest: r
}
}, a.fndef = {
pattern: /^ {0,3}\[\^.*?\]:[ \t]+.*$/gm,
inside: {
"ref-id": {
pattern: /\[\^.*?\]/,
inside: {
"md md-bracket-start": /\[/,
"md md-bracket-end": /\]/
}
}
}
}, a.linkdef = {
pattern: /^ {0,3}\[.*?\]:[ \t]+.*$/gm,
inside: {
"link-id": {
pattern: /\[.*?\]/,
inside: {
"md md-bracket-start": /\[/,
"md md-bracket-end": /\]/
}
},
url: n,
linktitle: /['\"\(][^\'\"\)]*['\"\)]/
}
}, a.p = {
pattern: /.+/g,
inside: {
"md md-toc": /^\s*\[(toc|TOC)\]\s*$/g
}
}, a.lf = /^\n$/gm, a.img = {
pattern: /!\[[^\]]*\]\([^\)]+\)/g,
inside: {
"md md-bang": /^!/,
"md md-bracket-start": /\[/,
"md md-alt": /[^\[]+(?=\])/,
"md md-bracket-end": /\](?=\()/,
"md img-parens": {
pattern: /\([^\)]+\)/,
inside: {
"md md-paren-start": /^\(/,
"md md-title": /(['\u2018][^'\u2019]*['\u2019]|["\u201c][^"\u201d]*["\u201d])(?=\)$)/,
"md md-src": /[^\('" \t]+(?=[\)'" \t])/,
"md md-paren-end": /\)$/
}
}
}
}, a.link = {
pattern: /\[(?:(\\.)|[^\[\]])*\]\([^\(\)\s]+(\(\S*?\))??[^\(\)\s]*?(\s(['\u2018][^'\u2019]*['\u2019]|["\u201c][^"\u201d]*["\u201d]))?\)/gm,
inside: {
"md md-bracket-start": {
pattern: /(^|[^\\])\[/,
lookbehind: !0
},
"md md-underlined-text": {
pattern: /(?:(\\.)|[^\[\]])+(?=\])/
},
"md md-bracket-end": /\]\s?\(/,
"md md-paren-end": /\)$/,
"md md-href": /.*/
}
}, a.fn = {
pattern: /\[\^(.*?)\]/g,
inside: {
ref: {
pattern: /^\[[^\[\]]+\] ?/,
inside: {
"md md-bracket-start": /\[/,
"md md-ref": /^[^\[\]]+/,
"md md-bracket-end": /\]/
}
}
}
}, a.imgref = {
pattern: /!\[(.*?)\] ?\[(.*?)\]/g,
inside: {
"md md-bang": /^!/,
"ref-end": {
pattern: /\[[^\[\]]+\]$/,
inside: {
"md md-bracket-start": /\[/,
"md md-href": /[^\[\]]+(?=]$)/,
"md md-bracket-end": /\]/
}
},
"ref-start": {
pattern: /^\[[^\[\]]+\] ?/,
inside: {
"md md-bracket-start": /\[/,
"md md-alt": /^[^\[\]]+/,
"md md-bracket-end": /\]/
}
}
}
}, a.linkref = {
pattern: /\[(.*?)\] ?\[(.*?)\]/g,
inside: {
"ref-end": {
pattern: /\[[^\[\]]+\]$/,
inside: {
"md md-bracket-start": /\[/,
"md md-href": /[^\[\]]+(?=]$)/,
"md md-bracket-end": /\]/
}
},
"ref-start": {
pattern: /^\[[^\[\]]+\] ?/,
inside: {
"md md-bracket-start": /\[/,
"md md-underlined-text": /^[^\[\]]+/,
"md md-bracket-end": /\]/
}
}
}
}, a.code = {
pattern: /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/g,
lookbehind: !0,
inside: {
"md md-code": /`/
}
}, a.math = {
pattern: /\$.*?\$/g,
inside: {
"md md-bracket-start": /^\$/,
"md md-bracket-end": /\$$/,
rest: r
}
}, a.strong = {
pattern: /([_\*])\1((?!\1{2}).)*\1{2}/g,
inside: {
"md md-strong": /([_\*])\1/g
}
}, a.em = {
pattern: /(^|[^\\])(\*|_)(\S[^\2]*?)??[^\s\\]+?\2/g,
lookbehind: !0,
inside: {
"md md-em md-start": /^(\*|_)/,
"md md-em md-close": /(\*|_)$/
}
}, a.strike = {
pattern: /(^|\n|\W)(~~)(?=\S)([^\r]*?\S)\2/gm,
lookbehind: !0,
inside: {
"md md-s": /(~~)/,
"md-strike-text": /[^~]+/
}
};
for (var l = {
code: a.code,
math: a.math,
fn: a.fn,
img: a.img,
link: a.link,
imgref: a.imgref,
linkref: a.linkref,
url: n,
email: i,
strong: a.strong,
em: a.em,
strike: a.strike,
conflict: /\u29f8\u29f8/g,
comment: Prism.languages.markup.comment,
tag: Prism.languages.markup.tag,
entity: Prism.languages.markup.entity
}, c = 6; c >= 1; c--) a["h" + c].inside.rest = l;
a["h1 alt"].inside.rest = l, a["h2 alt"].inside.rest = l, a.table.inside.rest = l,
a["table alt"].inside.rest = l, a.p.inside.rest = l, a.blockquote.inside.rest = l,
a.li.inside.rest = l, a.fndef.inside.rest = l, l = {
code: a.code,
fn: a.fn,
link: a.link,
linkref: a.linkref,
conflict: /\u29f8\u29f8/g
}, a.strong.inside.rest = l, a.em.inside.rest = l, a.strike.inside.rest = l;
var u = {
code: a.code,
strong: a.strong,
em: a.em,
strike: a.strike,
conflict: /\u29f8\u29f8/g,
comment: Prism.languages.markup.comment,
tag: Prism.languages.markup.tag,
entity: Prism.languages.markup.entity
};
return a.link.inside["md md-underlined-text"].inside = u, a.linkref.inside["ref-start"].inside["md md-underlined-text"].inside = u,
a;
}(), define("libs/prism-markdown", function() {}), define("editor", [ "jquery", "underscore", "utils", "settings", "eventMgr", "prism-core", "diff_match_patch_uncompressed", "jsondiffpatch", "crel", "rangy", "MutationObservers", "libs/prism-markdown" ], function(e, t, n, i, r, o, a, s, l, c) {
function u() {
this.isWatching = !1;
var e;
this.startWatching = function() {
this.isWatching = !0, e = e || new MutationObserver(S), e.observe(N, {
childList: !0,
subtree: !0,
characterData: !0
});
}, this.stopWatching = function() {
e.disconnect(), this.isWatching = !1;
}, this.noWatch = function(e) {
this.isWatching === !0 ? (this.stopWatching(), e(), this.startWatching()) : e();
};
}
function d() {
var e = this, o = 0, a = 0;
this.selectionStart = 0, this.selectionEnd = 0, this.cursorY = 0, this.adjustTop = 0,
this.adjustBottom = 0, this.findOffsets = function(e) {
var t = [];
if (!e.length) return t;
for (var n = e.shift(), i = document.createTreeWalker(N, 4, null, !1), r = "", o = 0; i.nextNode(); ) {
r = i.currentNode.nodeValue || "";
for (var a = o + r.length; a > n; ) {
if (t.push({
container: i.currentNode,
offsetInContainer: n - o,
offset: n
}), !e.length) return t;
n = e.shift();
}
o = a;
}
do t.push({
container: i.currentNode,
offsetInContainer: r.length,
offset: n
}), n = e.shift(); while (n);
return t;
}, this.createRange = function(e, n) {
e = 0 > e ? 0 : e, n = 0 > n ? 0 : n;
var i, r, o = document.createRange(), a = [];
t.isNumber(e) && (a.push(e), i = a.length - 1), t.isNumber(n) && (a.push(n), r = a.length - 1),
a = this.findOffsets(a);
var s = t.isObject(e) ? e : a[i];
o.setStart(s.container, s.offsetInContainer);
var l = s;
return n && n != e && (l = t.isObject(n) ? n : a[r]), o.setEnd(l.container, l.offsetInContainer),
o;
};
var s, l = n.debounce(function() {
D.toggleClass("has-selection", this.selectionStart !== this.selectionEnd);
var e = this.getCoordinates(this.selectionEnd, this.selectionEndContainer, this.selectionEndOffset);
if (this.cursorY !== e.y && (this.cursorY = e.y, r.onCursorCoordinates(e.x, e.y)),
s) {
var t, n;
if (t = n = I.offsetHeight / 2 * i.cursorFocusRatio, t = this.adjustTop || t, n = this.adjustBottom || t,
t && n) {
var o = I.scrollTop + t, a = I.scrollTop + I.offsetHeight - n;
V.cursorY < o ? I.scrollTop += V.cursorY - o : V.cursorY > a && (I.scrollTop += V.cursorY - a);
}
}
s = !1;
}, this);
this.updateCursorCoordinates = function(e) {
s = s || e, l();
}, this.updateSelectionRange = function() {
var e = Math.min(this.selectionStart, this.selectionEnd), t = Math.max(this.selectionStart, this.selectionEnd), n = this.createRange(e, t), i = c.getSelection();
i.removeAllRanges(), i.addRange(n, this.selectionStart > this.selectionEnd);
};
var u = t.debounce(function() {
o = e.selectionStart, a = e.selectionEnd;
}, 50);
this.setSelectionStartEnd = function(e, t) {
void 0 === e && (e = this.selectionStart), 0 > e && (e = 0), void 0 === t && (t = this.selectionEnd),
0 > t && (t = 0), this.selectionStart = e, this.selectionEnd = t, q.editorStart = e,
q.editorEnd = t, u();
}, this.saveSelectionState = function() {
function t() {
if (G === !1) {
var t = e.selectionStart, n = e.selectionEnd, i = c.getSelection();
if (i.rangeCount > 0) {
var r = i.getRangeAt(0), o = r.startContainer;
if (N.compareDocumentPosition(o) & Node.DOCUMENT_POSITION_CONTAINED_BY || N === o) {
var a = r.startOffset;
o.hasChildNodes() && a > 0 && (o = o.childNodes[a - 1], a = o.textContent.length);
for (var s = o; o != N; ) {
for (;o = o.previousSibling; ) o.textContent && (a += o.textContent.length);
o = s = s.parentNode;
}
i.isBackwards() ? (t = a + r.toString().length, n = a) : (t = a, n = a + r.toString().length),
t === n && "\n" == r.startContainer.textContent && 1 == r.startOffset && (t = --n,
e.setSelectionStartEnd(t, n), e.updateSelectionRange());
}
}
e.setSelectionStartEnd(t, n);
}
X.saveSelectionState();
}
var i = !1, r = n.debounce(function() {
t(), e.updateCursorCoordinates(i), s();
}), s = n.debounce(function() {
t(), o === e.selectionStart && a === e.selectionEnd && (i = !1), e.updateCursorCoordinates(i),
i = !1;
}, 10);
return function(e, n, s) {
return s && (o = void 0, a = void 0), e ? (i = i || n, r()) : void t();
};
}(), this.getSelectedText = function() {
var e = Math.min(this.selectionStart, this.selectionEnd), t = Math.max(this.selectionStart, this.selectionEnd);
return W.substring(e, t);
}, this.getCoordinates = function(e, t, n) {
if (!t) {
var i = this.findOffsets([ e ])[0];
t = i.container, n = i.offsetInContainer;
}
var r = 0, o = 0;
if ("\n" == t.textContent) o = t.parentNode.offsetTop + t.parentNode.offsetHeight / 2; else {
var a = W[e], s = {
container: t,
offsetInContainer: n,
offset: e
}, l = {
container: t,
offsetInContainer: n,
offset: e
};
e > 0 && (void 0 === a || "\n" == a) ? 0 === s.offset ? s = e - 1 : s.offsetInContainer -= 1 : l.offset === t.textContent.length ? l = e + 1 : l.offsetInContainer += 1;
var c = this.createRange(s, l), u = c.getBoundingClientRect();
o = u.top + u.height / 2 - I.getBoundingClientRect().top + I.scrollTop;
}
return {
x: r,
y: o
};
}, this.getClosestWordOffset = function(e) {
var t = 0, n = 0, i = 0;
return W.split(/\s/).some(function(r) {
return r && (t = i, n = i + r.length, n > e) ? !0 : void (i += r.length + 1);
}), {
start: t,
end: n
};
};
}
function p(e) {
void 0 !== I && V.saveSelectionState(!0, !0, e);
}
function h(e) {
var t = U.diff_commonPrefix(W, e);
t === W.length && t--;
var n = Math.min(U.diff_commonSuffix(W, e), W.length - t, e.length - t), i = e.substring(t, e.length - n), r = V.createRange(t, W.length - n);
return r.deleteContents(), r.insertNode(document.createTextNode(i)), {
start: t,
end: e.length - n
};
}
function f(e, t, n) {
X.currentMode = X.currentMode || "replace";
var i = V.createRange(Math.min(e, t), Math.max(e, t));
"" + i != n && (i.deleteContents(), i.insertNode(document.createTextNode(n)));
var r = e + n.length;
V.setSelectionStartEnd(r, r), V.updateSelectionRange(), V.updateCursorCoordinates(!0);
}
function m(e, t) {
X.currentMode = X.currentMode || "replace";
var n = W.replace(e, t);
if (n != W) {
var i = F.setValue(n);
V.setSelectionStartEnd(i.end, i.end), V.updateSelectionRange(), V.updateCursorCoordinates(!0);
}
}
function g(e, t) {
var n = V.selectionStart;
if (n !== V.selectionEnd) return !1;
var i = V.createRange(n - e.length, n);
return "" + i != e ? !1 : (i.deleteContents(), i.insertNode(document.createTextNode(t)),
n = n - e.length + t.length, V.setSelectionStartEnd(n, n), V.updateSelectionRange(),
V.updateCursorCoordinates(!0), !0);
}
function v(e) {
h(e), W = e;
}
function b() {
return W;
}
function y() {
M.focus(), V.updateSelectionRange(), I.scrollTop = B;
}
function x() {
function e(e, n, i) {
H.noWatch(function() {
W != e.content && (v(e.content), q.content = e.content, r.onContentChanged(q, e.content)),
V.setSelectionStartEnd(n, i), V.updateSelectionRange(), V.updateCursorCoordinates(!0);
var o = q.discussionListJSON;
if (o != e.discussionListJSON) {
var a = q.discussionList;
q.discussionListJSON = e.discussionListJSON;
var s = q.discussionList, l = z.diff(a, s), c = !1;
t.each(l, function(e, n) {
t.isArray(e) ? 1 === e.length ? r.onDiscussionCreated(q, s[n]) : r.onDiscussionRemoved(q, a[n]) : c = !0;
}), c && r.onCommentsChanged(q);
}
}), s = n, l = i, a = e, this.currentMode = void 0, o = void 0, this.onButtonStateChange(),
p();
}
var i, o, a, s, l, c = [], u = [];
this.setCommandMode = function() {
this.currentMode = "command";
}, this.setMode = function() {}, this.onButtonStateChange = function() {}, this.saveState = n.debounce(function() {
u = [];
var e = Date.now();
if ("comment" == this.currentMode || "replace" == this.currentMode || "newlines" == o || this.currentMode != o || e - i > 1e3) for (c.push(a); c.length > 100; ) c.shift(); else s = a.selectionStartBefore,
l = a.selectionEndBefore;
a = {
selectionStartBefore: s,
selectionEndBefore: l,
selectionStartAfter: V.selectionStart,
selectionEndAfter: V.selectionEnd,
content: W,
discussionListJSON: q.discussionListJSON
}, i = e, o = this.currentMode, this.currentMode = void 0, this.onButtonStateChange();
}, this), this.saveSelectionState = t.debounce(function() {
void 0 === this.currentMode && (s = V.selectionStart, l = V.selectionEnd);
}, 50), this.canUndo = function() {
return c.length;
}, this.canRedo = function() {
return u.length;
}, this.undo = function() {
var t = c.pop();
t && (u.push(a), e.call(this, t, a.selectionStartBefore, a.selectionEndBefore));
}, this.redo = function() {
var t = u.pop();
t && (c.push(a), e.call(this, t, t.selectionStartAfter, t.selectionEndAfter));
}, this.init = function() {
var e = q.content;
c = [], u = [], i = 0, a = {
selectionStartAfter: q.selectionStart,
selectionEndAfter: q.selectionEnd,
content: e,
discussionListJSON: q.discussionListJSON
}, this.currentMode = void 0, o = void 0, N.textContent = e, S();
};
}
function w() {
H.isWatching === !0 && (X.currentMode = X.currentMode || "comment", X.saveState());
}
function S() {
var e = I.textContent;
if (N.lastChild === O && "\n" == O.textContent.slice(-1) && (e = e.slice(0, -1)),
e = e.replace(/\r\n?/g, "\n"), G === !1) {
if (e == W) return void (0 === N.children.length && (N.innerHTML = "", K.forEach(function(e) {
N.appendChild(e.elt);
}), E()));
X.currentMode = X.currentMode || "typing";
var n = t.values(q.discussionList);
q.newDiscussion && n.push(q.newDiscussion);
var i = C(W, e, n);
W = e, i === !0 && (q.discussionList = q.discussionList), q.content = W, V.saveSelectionState(),
r.onContentChanged(q, W), i && r.onCommentsChanged(q), X.saveState(), Q();
} else W = e, q.content = W, V.setSelectionStartEnd(q.editorStart, q.editorEnd),
V.updateSelectionRange(), V.updateCursorCoordinates(), X.saveSelectionState(), r.onFileOpen(q, W),
R.scrollTop = q.previewScrollTop, B = q.editorScrollTop, I.scrollTop = B, G = !1;
}
function C(e, t, n) {
if (n.length) {
var i = U.diff_main(e, t), r = !1, o = 0;
return i.forEach(function(e) {
var t = e[0], i = e[1];
if (0 === t) return void (o += i.length);
var a = o, s = i.length;
-1 === t && (a += s, s = -s), n.forEach(function(e) {
e.selectionEnd > a ? (e.selectionEnd += s, e.discussionIndex && (r = !0)) : e.selectionEnd > o && (e.selectionEnd = o,
e.discussionIndex && (r = !0)), e.selectionStart >= a ? (e.selectionStart += s,
e.discussionIndex && (r = !0)) : e.selectionStart > o && (e.selectionStart = o,
e.discussionIndex && (r = !0));
}), 1 === t && (o += i.length);
}), r;
}
}
function _(e) {
if (Z = [], J = [], Y = void 0, G === !0) return J = K, K = e, void (Z = e);
var n = K.length;
t.some(K, function(t, i) {
var r = e[i];
return i >= e.length || t.textWithFrontMatter != r.textWithFrontMatter || t.elt.parentNode !== N || t.elt.textContent != r.textWithFrontMatter ? (n = i,
!0) : void 0;
});
var i = -K.length;
t.some(K.slice().reverse(), function(t, n) {
var r = e[e.length - n - 1];
return n >= e.length || t.textWithFrontMatter != r.textWithFrontMatter || t.elt.parentNode !== N || t.elt.textContent != r.textWithFrontMatter ? (i = -n,
!0) : void 0;
}), n - i > K.length && (i = n - K.length);
var r = K.slice(0, n);
Z = e.slice(n, e.length + i);
var o = K.slice(K.length + i, K.length);
Y = t.first(o), J = K.slice(n, K.length + i), K = r.concat(Z).concat(o);
}
function k() {
var e = document.createDocumentFragment();
Z.forEach(function(t) {
T(t), e.appendChild(t.elt);
}), H.noWatch(function() {
if (G === !0) N.innerHTML = "", N.appendChild(e); else {
J.forEach(function(e) {
e.elt.parentNode === N && N.removeChild(e.elt), e.elt.generated = !1;
}), void 0 !== Y ? N.insertBefore(e, Y.elt) : N.appendChild(e);
for (var t = N.firstChild; t; ) {
var n = t.nextSibling;
t.generated || N.removeChild(t), t = n;
}
}
E(), V.updateSelectionRange(), V.updateCursorCoordinates();
});
}
function E() {
O = l("span", {
"class": "token lf"
}), O.textContent = "\n", N.appendChild(O);
}
function T(e) {
var t = et(e.text);
window.viewerMode || (t = o.highlight(t, o.languages.md));
var n = e.textWithFrontMatter.substring(0, e.textWithFrontMatter.length - e.text.length);
n.length && (n = et(n), n = n.replace(/\n/g, '\n'),
t = '' + n + "" + t);
var i = l("span", {
id: "wmd-input-section-" + e.id,
"class": "wmd-input-section"
});
i.generated = !0, i.innerHTML = t, e.elt = i;
}
var I, D, N, M, L, A, R, P, O, F = {}, B = 0, j = function() {
var e, n = 0, r = function() {
var e = Date.now();
P.refreshPreview(), n = Date.now() - e;
};
return i.lazyRendering === !0 ? t.debounce(r, 500) : function() {
clearTimeout(e), e = setTimeout(r, 2e3 > n ? n : 2e3);
};
}();
r.addListener("onPagedownConfigure", function(e) {
P = e;
});
var $ = 0;
r.addListener("onSectionsCreated", function(e) {
$ || (_(e), k()), G === !0 ? P.refreshPreview() : j();
});
var q, G = !0;
r.addListener("onFileSelected", function(e) {
G = !0, q = e;
});
var H = new u();
F.watcher = H;
var U = new a(), z = s.create({
objectHash: function(e) {
return JSON.stringify(e);
},
arrays: {
detectMove: !1
},
textDiff: {
minLength: 9999999
}
}), V = new d();
F.selectionMgr = V, e(document).on("selectionchange", ".editor-content", t.bind(V.saveSelectionState, V, !0, !1)),
F.adjustCursorPosition = p;
var W;
F.setValue = h, F.replace = f, F.replaceAll = m, F.replacePreviousText = g, F.setValueNoWatch = v,
F.getValue = b, F.focus = y;
var X = new x();
F.undoMgr = X, r.addListener("onDiscussionCreated", w), r.addListener("onDiscussionRemoved", w),
r.addListener("onCommentsChanged", w);
var Q = t.debounce(function() {
var e = window.getSelection();
V.hasFocus && !$ && V.selectionStart === V.selectionEnd && e.modify && (V.selectionStart ? (e.modify("move", "backward", "character"),
e.modify("move", "forward", "character")) : (e.modify("move", "forward", "character"),
e.modify("move", "backward", "character")));
}, 10);
F.adjustCommentOffsets = C, F.init = function() {
if (I = document.getElementById("wmd-input"), D = e(I), N = I.querySelector(".editor-content"),
M = e(N), L = I.querySelector(".editor-margin"), A = e(L), R = document.querySelector(".preview-container"),
D.addClass(i.editorFontClass), H.startWatching(), e(I).scroll(function() {
B = I.scrollTop, G === !1 && (q.editorScrollTop = B);
}), e(R).scroll(function() {
G === !1 && (q.previewScrollTop = R.scrollTop);
}), /AppleWebKit\/([\d.]+)/.exec(navigator.userAgent)) {
var n = e('').appendTo("html");
M.blur(function() {
n[0].setSelectionRange(0, 0), n.blur();
});
}
I.focus = y, I.adjustCursorPosition = p, Object.defineProperty(I, "value", {
get: function() {
return W;
},
set: h
}), Object.defineProperty(I, "selectionStart", {
get: function() {
return Math.min(V.selectionStart, V.selectionEnd);
},
set: function(e) {
V.setSelectionStartEnd(e), V.updateSelectionRange(), V.updateCursorCoordinates();
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(I, "selectionEnd", {
get: function() {
return Math.max(V.selectionStart, V.selectionEnd);
},
set: function(e) {
V.setSelectionStartEnd(void 0, e), V.updateSelectionRange(), V.updateCursorCoordinates();
},
enumerable: !0,
configurable: !0
});
var r = !1;
M.on("keydown", function(e) {
if (17 !== e.which && 91 !== e.which && 18 !== e.which && 16 !== e.which) {
V.saveSelectionState(), p();
var t = e.metaKey || e.ctrlKey;
switch (e.which) {
case 9:
t || (o("indent", {
inverse: e.shiftKey
}), e.preventDefault());
break;
case 13:
o("newline"), e.preventDefault();
}
13 !== e.which && (r = !1);
}
}).on("compositionstart", function() {
$++;
}).on("compositionend", function() {
setTimeout(function() {
$--;
}, 0);
}).on("mouseup", t.bind(V.saveSelectionState, V, !0, !1)).on("paste", function(e) {
X.currentMode = "paste", e.preventDefault();
var t, n = (e.originalEvent || e).clipboardData;
n ? t = n.getData("text/plain") : (n = window.clipboardData, t = n && n.getData("Text")),
t && (f(V.selectionStart, V.selectionEnd, t), p());
}).on("cut", function() {
X.currentMode = "cut", p();
}).on("focus", function() {
V.hasFocus = !0;
}).on("blur", function() {
V.hasFocus = !1;
});
var o = function(e, t) {
var n = b(), i = Math.min(V.selectionStart, V.selectionEnd), r = Math.max(V.selectionStart, V.selectionEnd), o = {
selectionStart: i,
selectionEnd: r,
before: n.slice(0, i),
after: n.slice(r),
selection: n.slice(i, r)
};
s[e](o, t || {}), h(o.before + o.selection + o.after), V.setSelectionStartEnd(o.selectionStart, o.selectionEnd),
V.updateSelectionRange();
}, a = /^ {0,3}>[ ]*|^[ \t]*(?:[*+\-]|(\d+)\.)[ \t]|^\s+/, s = {
indent: function(e, t) {
function n(e, t, n, i) {
return n = +n || 0, i = i || "", e.slice(0, t) + i + e.slice(t + n);
}
var i = e.before.lastIndexOf("\n") + 1;
if (t.inverse) /\s/.test(e.before.charAt(i)) && (e.before = n(e.before, i, 1), e.selectionStart--,
e.selectionEnd--), e.selection = e.selection.replace(/^[ \t]/gm, ""); else {
var r = e.before.slice(i);
if (!e.selection && !r.match(a)) return e.before += " ", e.selectionStart++, void e.selectionEnd++;
e.before = n(e.before, i, 0, " "), e.selection = e.selection.replace(/\r?\n(?=[\s\S])/g, "\n "),
e.selectionStart++, e.selectionEnd++;
}
e.selectionEnd = e.selectionStart + e.selection.length;
},
newline: function(e) {
var t = e.before.lastIndexOf("\n") + 1;
if (r) return e.before = e.before.substring(0, t), e.selection = "", e.selectionStart = t,
e.selectionEnd = t, void (r = !1);
r = !1;
var n = e.before.slice(t), i = n.match(a), o = (i || [ "" ])[0];
if (i && i[1]) {
var s = parseInt(i[1], 10);
o = o.replace(/\d+/, s + 1);
}
o.length && (r = !0), X.currentMode = "newlines", e.before += "\n" + o, e.selection = "",
e.selectionStart += o.length + 1, e.selectionEnd = e.selectionStart;
}
};
};
var Y, K = [], J = [], Z = [], et = function() {
var e = {
"&": "&",
"<": "<",
"\xa0": " "
};
return function(t) {
return t.replace(/[&<\u00a0]/g, function(t) {
return e[t];
});
};
}();
return r.onEditorCreated(F), F;
}), function(e, t) {
function n() {
i.READY || (b.determineEventTypes(), f.each(i.gestures, function(e) {
x.register(e);
}), b.onTouch(i.DOCUMENT, p, x.detect), b.onTouch(i.DOCUMENT, h, x.detect), i.READY = !0);
}
var i = function(e, t) {
return new i.Instance(e, t || {});
};
i.VERSION = "1.0.11", i.defaults = {
stop_browser_behavior: {
userSelect: "none",
touchAction: "pan-y",
touchCallout: "none",
contentZooming: "none",
userDrag: "none",
tapHighlightColor: "rgba(0,0,0,0)"
}
}, i.HAS_POINTEREVENTS = e.navigator.pointerEnabled || e.navigator.msPointerEnabled,
i.HAS_TOUCHEVENTS = "ontouchstart" in e, i.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i,
i.NO_MOUSEEVENTS = i.HAS_TOUCHEVENTS && e.navigator.userAgent.match(i.MOBILE_REGEX),
i.EVENT_TYPES = {}, i.UPDATE_VELOCITY_INTERVAL = 16, i.DOCUMENT = e.document;
var r = i.DIRECTION_DOWN = "down", o = i.DIRECTION_LEFT = "left", a = i.DIRECTION_UP = "up", s = i.DIRECTION_RIGHT = "right", l = i.POINTER_MOUSE = "mouse", c = i.POINTER_TOUCH = "touch", u = i.POINTER_PEN = "pen", d = i.EVENT_START = "start", p = i.EVENT_MOVE = "move", h = i.EVENT_END = "end";
i.plugins = i.plugins || {}, i.gestures = i.gestures || {}, i.READY = !1;
var f = i.utils = {
extend: function(e, n, i) {
for (var r in n) e[r] !== t && i || (e[r] = n[r]);
return e;
},
each: function(e, n, i) {
var r, o;
if ("forEach" in e) e.forEach(n, i); else if (e.length !== t) {
for (r = -1; o = e[++r]; ) if (n.call(i, o, r, e) === !1) return;
} else for (r in e) if (e.hasOwnProperty(r) && n.call(i, e[r], r, e) === !1) return;
},
inStr: function(e, t) {
return e.indexOf(t) > -1;
},
hasParent: function(e, t) {
for (;e; ) {
if (e == t) return !0;
e = e.parentNode;
}
return !1;
},
getCenter: function(e) {
var t = [], n = [], i = [], r = [], o = Math.min, a = Math.max;
return 1 === e.length ? {
pageX: e[0].pageX,
pageY: e[0].pageY,
clientX: e[0].clientX,
clientY: e[0].clientY
} : (f.each(e, function(e) {
t.push(e.pageX), n.push(e.pageY), i.push(e.clientX), r.push(e.clientY);
}), {
pageX: (o.apply(Math, t) + a.apply(Math, t)) / 2,
pageY: (o.apply(Math, n) + a.apply(Math, n)) / 2,
clientX: (o.apply(Math, i) + a.apply(Math, i)) / 2,
clientY: (o.apply(Math, r) + a.apply(Math, r)) / 2
});
},
getVelocity: function(e, t, n) {
return {
x: Math.abs(t / e) || 0,
y: Math.abs(n / e) || 0
};
},
getAngle: function(e, t) {
var n = t.clientX - e.clientX, i = t.clientY - e.clientY;
return 180 * Math.atan2(i, n) / Math.PI;
},
getDirection: function(e, t) {
var n = Math.abs(e.clientX - t.clientX), i = Math.abs(e.clientY - t.clientY);
return n >= i ? e.clientX - t.clientX > 0 ? o : s : e.clientY - t.clientY > 0 ? a : r;
},
getDistance: function(e, t) {
var n = t.clientX - e.clientX, i = t.clientY - e.clientY;
return Math.sqrt(n * n + i * i);
},
getScale: function(e, t) {
return e.length >= 2 && t.length >= 2 ? this.getDistance(t[0], t[1]) / this.getDistance(e[0], e[1]) : 1;
},
getRotation: function(e, t) {
return e.length >= 2 && t.length >= 2 ? this.getAngle(t[1], t[0]) - this.getAngle(e[1], e[0]) : 0;
},
isVertical: function(e) {
return e == a || e == r;
},
toggleDefaultBehavior: function(e, t, n) {
if (t && e && e.style) {
f.each([ "webkit", "moz", "Moz", "ms", "o", "" ], function(i) {
f.each(t, function(t, r) {
i && (r = i + r.substring(0, 1).toUpperCase() + r.substring(1)), r in e.style && (e.style[r] = !n && t);
});
});
var i = function() {
return !1;
};
"none" == t.userSelect && (e.onselectstart = !n && i), "none" == t.userDrag && (e.ondragstart = !n && i);
}
}
};
i.Instance = function(e, t) {
var r = this;
return n(), this.element = e, this.enabled = !0, this.options = f.extend(f.extend({}, i.defaults), t || {}),
this.options.stop_browser_behavior && f.toggleDefaultBehavior(this.element, this.options.stop_browser_behavior, !1),
this.eventStartHandler = b.onTouch(e, d, function(e) {
r.enabled && x.startDetect(r, e);
}), this.eventHandlers = [], this;
}, i.Instance.prototype = {
on: function(e, t) {
var n = e.split(" ");
return f.each(n, function(e) {
this.element.addEventListener(e, t, !1), this.eventHandlers.push({
gesture: e,
handler: t
});
}, this), this;
},
off: function(e, t) {
var n, i, r = e.split(" ");
return f.each(r, function(e) {
for (this.element.removeEventListener(e, t, !1), n = -1; i = this.eventHandlers[++n]; ) i.gesture === e && i.handler === t && this.eventHandlers.splice(n, 1);
}, this), this;
},
trigger: function(e, t) {
t || (t = {});
var n = i.DOCUMENT.createEvent("Event");
n.initEvent(e, !0, !0), n.gesture = t;
var r = this.element;
return f.hasParent(t.target, r) && (r = t.target), r.dispatchEvent(n), this;
},
enable: function(e) {
return this.enabled = e, this;
},
dispose: function() {
var e, t;
for (this.options.stop_browser_behavior && f.toggleDefaultBehavior(this.element, this.options.stop_browser_behavior, !0),
e = -1; t = this.eventHandlers[++e]; ) this.element.removeEventListener(t.gesture, t.handler, !1);
return this.eventHandlers = [], b.unbindDom(this.element, i.EVENT_TYPES[d], this.eventStartHandler),
null;
}
};
var m = null, g = !1, v = !1, b = i.event = {
bindDom: function(e, t, n) {
var i = t.split(" ");
f.each(i, function(t) {
e.addEventListener(t, n, !1);
});
},
unbindDom: function(e, t, n) {
var i = t.split(" ");
f.each(i, function(t) {
e.removeEventListener(t, n, !1);
});
},
onTouch: function(e, t, n) {
var r = this, o = function(o) {
var a = o.type.toLowerCase();
if (!f.inStr(a, "mouse") || !v) {
f.inStr(a, "touch") || f.inStr(a, "pointerdown") || f.inStr(a, "mouse") && 1 === o.which ? g = !0 : f.inStr(a, "mouse") && !o.which && (g = !1),
(f.inStr(a, "touch") || f.inStr(a, "pointer")) && (v = !0);
var s = 0;
g && (i.HAS_POINTEREVENTS && t != h ? s = y.updatePointer(t, o) : f.inStr(a, "touch") ? s = o.touches.length : v || (s = f.inStr(a, "up") ? 0 : 1),
s > 0 && t == h ? t = p : s || (t = h), (s || null === m) && (m = o), n.call(x, r.collectEventData(e, t, r.getTouchList(m, t), o)),
i.HAS_POINTEREVENTS && t == h && (s = y.updatePointer(t, o))), s || (m = null, g = !1,
v = !1, y.reset());
}
};
return this.bindDom(e, i.EVENT_TYPES[t], o), o;
},
determineEventTypes: function() {
var e;
e = i.HAS_POINTEREVENTS ? y.getEvents() : i.NO_MOUSEEVENTS ? [ "touchstart", "touchmove", "touchend touchcancel" ] : [ "touchstart mousedown", "touchmove mousemove", "touchend touchcancel mouseup" ],
i.EVENT_TYPES[d] = e[0], i.EVENT_TYPES[p] = e[1], i.EVENT_TYPES[h] = e[2];
},
getTouchList: function(e) {
return i.HAS_POINTEREVENTS ? y.getTouchList() : e.touches ? e.touches : (e.identifier = 1,
[ e ]);
},
collectEventData: function(e, t, n, i) {
var r = c;
return (f.inStr(i.type, "mouse") || y.matchType(l, i)) && (r = l), {
center: f.getCenter(n),
timeStamp: Date.now(),
target: i.target,
touches: n,
eventType: t,
pointerType: r,
srcEvent: i,
preventDefault: function() {
var e = this.srcEvent;
e.preventManipulation && e.preventManipulation(), e.preventDefault && e.preventDefault();
},
stopPropagation: function() {
this.srcEvent.stopPropagation();
},
stopDetect: function() {
return x.stopDetect();
}
};
}
}, y = i.PointerEvent = {
pointers: {},
getTouchList: function() {
var e = [];
return f.each(this.pointers, function(t) {
e.push(t);
}), e;
},
updatePointer: function(e, t) {
return e == h ? delete this.pointers[t.pointerId] : (t.identifier = t.pointerId,
this.pointers[t.pointerId] = t), Object.keys(this.pointers).length;
},
matchType: function(e, t) {
if (!t.pointerType) return !1;
var n = t.pointerType, i = {};
return i[l] = n === l, i[c] = n === c, i[u] = n === u, i[e];
},
getEvents: function() {
return [ "pointerdown MSPointerDown", "pointermove MSPointerMove", "pointerup pointercancel MSPointerUp MSPointerCancel" ];
},
reset: function() {
this.pointers = {};
}
}, x = i.detection = {
gestures: [],
current: null,
previous: null,
stopped: !1,
startDetect: function(e, t) {
this.current || (this.stopped = !1, this.current = {
inst: e,
startEvent: f.extend({}, t),
lastEvent: !1,
lastVelocityEvent: !1,
velocity: !1,
name: ""
}, this.detect(t));
},
detect: function(e) {
if (this.current && !this.stopped) {
e = this.extendEventData(e);
var t = this.current.inst, n = t.options;
return f.each(this.gestures, function(i) {
return this.stopped || n[i.name] === !1 || t.enabled === !1 || i.handler.call(i, e, t) !== !1 ? void 0 : (this.stopDetect(),
!1);
}, this), this.current && (this.current.lastEvent = e), e.eventType == h && !e.touches.length - 1 && this.stopDetect(),
e;
}
},
stopDetect: function() {
this.previous = f.extend({}, this.current), this.current = null, this.stopped = !0;
},
getVelocityData: function(e, t, n, r) {
var o = this.current, a = o.lastVelocityEvent, s = o.velocity;
a && e.timeStamp - a.timeStamp > i.UPDATE_VELOCITY_INTERVAL ? (s = f.getVelocity(e.timeStamp - a.timeStamp, e.center.clientX - a.center.clientX, e.center.clientY - a.center.clientY),
o.lastVelocityEvent = e) : o.velocity || (s = f.getVelocity(t, n, r), o.lastVelocityEvent = e),
o.velocity = s, e.velocityX = s.x, e.velocityY = s.y;
},
getInterimData: function(e) {
var t, n, i = this.current.lastEvent;
e.eventType == h ? (t = i && i.interimAngle, n = i && i.interimDirection) : (t = i && f.getAngle(i.center, e.center),
n = i && f.getDirection(i.center, e.center)), e.interimAngle = t, e.interimDirection = n;
},
extendEventData: function(e) {
var t = this.current, n = t.startEvent;
(e.touches.length != n.touches.length || e.touches === n.touches) && (n.touches = [],
f.each(e.touches, function(e) {
n.touches.push(f.extend({}, e));
}));
var i = e.timeStamp - n.timeStamp, r = e.center.clientX - n.center.clientX, o = e.center.clientY - n.center.clientY;
return this.getVelocityData(e, i, r, o), this.getInterimData(e), f.extend(e, {
startEvent: n,
deltaTime: i,
deltaX: r,
deltaY: o,
distance: f.getDistance(n.center, e.center),
angle: f.getAngle(n.center, e.center),
direction: f.getDirection(n.center, e.center),
scale: f.getScale(n.touches, e.touches),
rotation: f.getRotation(n.touches, e.touches)
}), e;
},
register: function(e) {
var n = e.defaults || {};
return n[e.name] === t && (n[e.name] = !0), f.extend(i.defaults, n, !0), e.index = e.index || 1e3,
this.gestures.push(e), this.gestures.sort(function(e, t) {
return e.index < t.index ? -1 : e.index > t.index ? 1 : 0;
}), this.gestures;
}
};
i.gestures.Drag = {
name: "drag",
index: 50,
defaults: {
drag_min_distance: 10,
correct_for_drag_min_distance: !0,
drag_max_touches: 1,
drag_block_horizontal: !1,
drag_block_vertical: !1,
drag_lock_to_axis: !1,
drag_lock_min_distance: 25
},
triggered: !1,
handler: function(e, t) {
var n = x.current;
if (n.name != this.name && this.triggered) return t.trigger(this.name + "end", e),
void (this.triggered = !1);
if (!(t.options.drag_max_touches > 0 && e.touches.length > t.options.drag_max_touches)) switch (e.eventType) {
case d:
this.triggered = !1;
break;
case p:
if (e.distance < t.options.drag_min_distance && n.name != this.name) return;
var i = n.startEvent.center;
if (n.name != this.name && (n.name = this.name, t.options.correct_for_drag_min_distance && e.distance > 0)) {
var l = Math.abs(t.options.drag_min_distance / e.distance);
i.pageX += e.deltaX * l, i.pageY += e.deltaY * l, i.clientX += e.deltaX * l, i.clientY += e.deltaY * l,
e = x.extendEventData(e);
}
(n.lastEvent.drag_locked_to_axis || t.options.drag_lock_to_axis && t.options.drag_lock_min_distance <= e.distance) && (e.drag_locked_to_axis = !0);
var c = n.lastEvent.direction;
e.drag_locked_to_axis && c !== e.direction && (e.direction = f.isVertical(c) ? e.deltaY < 0 ? a : r : e.deltaX < 0 ? o : s),
this.triggered || (t.trigger(this.name + "start", e), this.triggered = !0), t.trigger(this.name, e),
t.trigger(this.name + e.direction, e);
var u = f.isVertical(e.direction);
(t.options.drag_block_vertical && u || t.options.drag_block_horizontal && !u) && e.preventDefault();
break;
case h:
this.triggered && t.trigger(this.name + "end", e), this.triggered = !1;
}
}
}, i.gestures.Hold = {
name: "hold",
index: 10,
defaults: {
hold_timeout: 500,
hold_threshold: 2
},
timer: null,
handler: function(e, t) {
switch (e.eventType) {
case d:
clearTimeout(this.timer), x.current.name = this.name, this.timer = setTimeout(function() {
"hold" == x.current.name && t.trigger("hold", e);
}, t.options.hold_timeout);
break;
case p:
e.distance > t.options.hold_threshold && clearTimeout(this.timer);
break;
case h:
clearTimeout(this.timer);
}
}
}, i.gestures.Release = {
name: "release",
index: 1/0,
handler: function(e, t) {
e.eventType == h && t.trigger(this.name, e);
}
}, i.gestures.Swipe = {
name: "swipe",
index: 40,
defaults: {
swipe_min_touches: 1,
swipe_max_touches: 1,
swipe_velocity: .7
},
handler: function(e, t) {
if (e.eventType == h) {
if (e.touches.length < t.options.swipe_min_touches || e.touches.length > t.options.swipe_max_touches) return;
(e.velocityX > t.options.swipe_velocity || e.velocityY > t.options.swipe_velocity) && (t.trigger(this.name, e),
t.trigger(this.name + e.direction, e));
}
}
}, i.gestures.Tap = {
name: "tap",
index: 100,
defaults: {
tap_max_touchtime: 250,
tap_max_distance: 10,
tap_always: !0,
doubletap_distance: 20,
doubletap_interval: 300
},
has_moved: !1,
handler: function(e, t) {
var n, i, r;
e.eventType == d ? this.has_moved = !1 : e.eventType != p || this.moved ? e.eventType == h && "touchcancel" != e.srcEvent.type && e.deltaTime < t.options.tap_max_touchtime && !this.has_moved && (n = x.previous,
i = n && n.lastEvent && e.timeStamp - n.lastEvent.timeStamp, r = !1, n && "tap" == n.name && i && i < t.options.doubletap_interval && e.distance < t.options.doubletap_distance && (t.trigger("doubletap", e),
r = !0), (!r || t.options.tap_always) && (x.current.name = "tap", t.trigger(x.current.name, e))) : this.has_moved = e.distance > t.options.tap_max_distance;
}
}, i.gestures.Touch = {
name: "touch",
index: -1/0,
defaults: {
prevent_default: !1,
prevent_mouseevents: !1
},
handler: function(e, t) {
return t.options.prevent_mouseevents && e.pointerType == l ? void e.stopDetect() : (t.options.prevent_default && e.preventDefault(),
void (e.eventType == d && t.trigger(this.name, e)));
}
}, i.gestures.Transform = {
name: "transform",
index: 45,
defaults: {
transform_min_scale: .01,
transform_min_rotation: 1,
transform_always_block: !1,
transform_within_instance: !1
},
triggered: !1,
handler: function(e, t) {
if (x.current.name != this.name && this.triggered) return t.trigger(this.name + "end", e),
void (this.triggered = !1);
if (!(e.touches.length < 2)) {
if (t.options.transform_always_block && e.preventDefault(), t.options.transform_within_instance) for (var n = -1; e.touches[++n]; ) if (!f.hasParent(e.touches[n].target, t.element)) return;
switch (e.eventType) {
case d:
this.triggered = !1;
break;
case p:
var i = Math.abs(1 - e.scale), r = Math.abs(e.rotation);
if (i < t.options.transform_min_scale && r < t.options.transform_min_rotation) return;
x.current.name = this.name, this.triggered || (t.trigger(this.name + "start", e),
this.triggered = !0), t.trigger(this.name, e), r > t.options.transform_min_rotation && t.trigger("rotate", e),
i > t.options.transform_min_scale && (t.trigger("pinch", e), t.trigger("pinch" + (e.scale < 1 ? "in" : "out"), e));
break;
case h:
this.triggered && t.trigger(this.name + "end", e), this.triggered = !1;
}
}
}
}, "function" == typeof define && define.amd ? define("hammerjs", [], function() {
return i;
}) : "object" == typeof module && module.exports ? module.exports = i : e.Hammer = i;
}(window), define("layout", [ "jquery", "underscore", "utils", "constants", "settings", "eventMgr", "crel", "mousetrap", "hammerjs" ], function(e, t, n, i, r, o, a, s, l) {
function c() {
U = !0, b.$elt.addClass("layout-animate");
}
function u() {
U = !1, b.$elt.removeClass("layout-animate");
}
function d(t) {
this.selector = t, this.elt = document.querySelector(t), this.$elt = e(this.elt);
}
function p(e) {
e && e.target !== b.elt && e.target !== y.elt && e.target !== k.elt || (z.forEach(function(e) {
e();
}), u(), 0 !== z.length && f(), z = []);
}
function h() {
return t.find(tt, function(e) {
return v.width > e.screenWidth;
}).maxWidth;
}
function f() {
var e = x.height - 60, t = (_.elt.offsetWidth - h()) / 2;
t < i.EDITOR_DEFAULT_PADDING && (t = i.EDITOR_DEFAULT_PADDING), V.style.paddingLeft = t + "px",
V.style.paddingRight = t + "px", V.style.paddingBottom = e + "px", X.style.width = t + "px";
var n = (E.elt.offsetWidth - h()) / 2;
n < i.EDITOR_DEFAULT_PADDING && (n = i.EDITOR_DEFAULT_PADDING), W.style.paddingLeft = n + "px",
W.style.paddingRight = n + "px", W.style.paddingBottom = e + "px";
var r = rt + st + $ + ot;
window.viewerMode && (r = rt + st + $ + at);
var a = v.width - r + $;
nt.forEach(function(e, t) {
r += e.width, t === nt.length - 1 && (r -= ot), v.width < r ? Y.appendChild(e.elt) : (Q.insertBefore(e.elt, J),
a = v.width - r + $);
}), Z.css({
maxWidth: a
}), K.toggleClass("hide", 0 === Y.children.length), o.onLayoutResize();
}
function m() {
b.width = v.width + B + (C.isShown ? j : 0), b.elt.style.width = b.width + "px",
C.right = C.isShown ? 0 : -j, C.elt.style.right = C.right + "px";
}
function g() {
for (v = {
width: window.innerWidth,
height: window.innerHeight
}; ;) {
if (b.y = w.isOpen ? 0 : -P, b.x = S.isOpen ? 0 : C.isOpen ? -(B + j) : -B, b.width = v.width + B + j,
b.height = v.height - b.y, y.left = B, y.width = v.width, y.height = b.height, x.top = P,
x.width = v.width, x.height = b.height - P, b.applyCss(), y.applyCss(), x.applyCss(),
window.viewerMode) return k.width = x.width, k.height = x.height, E.width = x.width,
E.height = x.height, k.applyCss(), E.applyCss(), f();
if (!(w.isOpen && x.height < O.height + A)) {
if (lt) {
if (k.isOpen) {
if (k.halfSize && (k.height = (x.height + A) / 2), k.height < F.height && (k.height = F.height),
k.y = x.height - k.height, k.y < O.height) {
var e = x.height - O.height;
if (e < F.height) {
k.isOpen = !1, k.$elt.trigger("hide.layout.toggle").trigger("hidden.layout.toggle");
continue;
}
k.height = e, k.y = x.height - k.height;
}
} else k.y = x.height - A;
k.width = x.width, _.height = k.y, _.width = x.width, E.top = A, E.height = k.height - A,
E.width = k.width, T.width = R, I.width = R, I.x = (k.width - R) / 2, D.width = E.width;
} else {
if (k.isOpen) {
if (k.halfSize && (k.width = (x.width + A) / 2), k.width < F.width && (k.width = F.width),
k.x = x.width - k.width, k.x < O.width) {
var t = x.width - O.width;
if (t < F.width) {
k.isOpen = !1, k.$elt.trigger("hide.layout.toggle").trigger("hidden.layout.toggle");
continue;
}
k.width = t, k.x = x.width - k.width;
}
} else k.x = x.width - A;
k.height = x.height, _.width = k.x, _.height = x.height, E.left = A, E.width = k.width - A,
E.height = k.height, T.height = R, I.height = R, I.y = (k.height - R) / 2, D.height = E.height;
}
break;
}
w.isOpen = !1, w.$elt.trigger("hide.layout.toggle").trigger("hidden.layout.toggle");
}
T.$elt.toggleClass("open", w.isOpen), I.$elt.toggleClass("open", k.isOpen), D.$elt.toggleClass("open", k.isOpen),
_.applyCss(), k.applyCss(), E.applyCss(), I.applyCss(), D.applyCss(), T.applyCss(),
m(), N.adjustPosition(), f();
}
var v, b, y, x, w, S, C, _, k, E, T, I, D, N, M, L = {}, A = 32, R = 60, P = 50, O = {
width: 250,
height: 140
}, F = {
width: 330,
height: 160
}, B = 280, j = 320, $ = 200, q = 18, G = 130, H = {
x: -45,
y: -6
}, U = !1, z = [];
d.prototype.applyCss = function() {
void 0 !== this.top && (this.elt.style.top = this.top + "px"), void 0 !== this.left && (this.elt.style.left = this.left + "px"),
void 0 !== this.bottom && (this.elt.style.bottom = this.bottom + "px"), void 0 !== this.right && (this.elt.style.right = this.right + "px"),
(void 0 !== this.x || void 0 !== this.y) && (this.x = this.x || 0, this.y = this.y || 0,
this.elt.style["-webkit-transform"] = "translate(" + this.x + "px, " + this.y + "px)",
this.elt.style["-ms-transform"] = "translate(" + this.x + "px, " + this.y + "px)",
this.elt.style.transform = "translate(" + this.x + "px, " + this.y + "px)"), U && this.width < this.oldWidth ? z.push(t.bind(function() {
this.elt.style.width = this.width + "px";
}, this)) : void 0 !== this.width && (this.elt.style.width = this.width + "px"),
this.oldWidth = this.width, U && this.height < this.oldHeight ? z.push(t.bind(function() {
this.elt.style.height = this.height + "px";
}, this)) : void 0 !== this.height && (this.elt.style.height = this.height + "px"),
this.oldHeight = this.height, clearTimeout(M), U && (M = setTimeout(p, 800));
}, d.prototype.createToggler = function(i) {
var r, o = 0;
this.toggle = function(a) {
a !== this.isOpen && (this.isOpen = t.isBoolean(a) ? a : !this.isOpen, this.isOpen ? (this.isShown = !0,
this.$elt.addClass("panel-open").trigger("show.layout.toggle"), i && (r = e(n.createBackdrop(b.elt)).on("click.backdrop", t.bind(function() {
this.toggle(!1);
}, this)), this.$elt.addClass("bring-to-front")), z.push(t.bind(function() {
0 === --o && this.isOpen && this.$elt.trigger("shown.layout.toggle");
}, this))) : (this.$elt.trigger("hide.layout.toggle"), r && (r.off("click.backdrop"),
r[0].removeBackdrop(), r = void 0), z.push(t.bind(function() {
0 === --o && (this.isOpen || (this.isShown = !1, this.$elt.removeClass("panel-open bring-to-front").trigger("hidden.layout.toggle")));
}, this))), o++, c(), g());
};
}, d.prototype.initHammer = function(e) {
this.hammer = l(this.elt, {
drag: e ? !0 : !1,
drag_max_touches: 0,
gesture: !1,
hold: !1,
release: !1,
swipe: e ? !1 : !0,
tap: !1,
touch: !1,
transform: !1
});
};
var V, W, X, Q, Y, K, J, Z, et = [ {
screenWidth: 0,
maxWidth: 600 * r.maxWidthRatio
}, {
screenWidth: 1e3,
maxWidth: 700 * r.maxWidthRatio
}, {
screenWidth: 1200,
maxWidth: 800 * r.maxWidthRatio
}, {
screenWidth: 1400,
maxWidth: 900 * r.maxWidthRatio
} ], tt = et.slice(0).reverse(), nt = [], it = [ 80, 80, 160, 160, 80, 40 ].map(function(e) {
return e + 18;
}), rt = 86, ot = 40, at = 100, st = 88, lt = "vertical" == r.layoutOrientation;
return L.init = function() {
function n(e, t) {
t = t || 0, c += [ "@media (min-width: " + t + "px) {", "#wmd-input {", " font-size: " + e + "px;", "}", "#preview-contents {", " font-size: " + e + "px;", "}", "}" ].join("\n");
}
var i = 0;
if (e(document.body).on("show.bs.modal", ".modal", function() {
S.toggle(!1), C.toggle(!1), i++;
}).on("hidden.bs.modal", ".modal", function() {
i--;
}), function(e) {
e.position = "absolute", e.top = 0, e.left = 0, e.bottom = 0, e.right = 0, e.overflow = "hidden";
}(document.body.style), document.documentElement.style.overflow = "hidden", b = new d(".layout-wrapper-l1"),
y = new d(".layout-wrapper-l2"), x = new d(".layout-wrapper-l3"), w = new d(".navbar"),
S = new d(".menu-panel"), C = new d(".document-panel"), _ = new d("#wmd-input"),
k = new d(".preview-panel"), E = new d(".preview-container"), T = new d(".layout-toggler-navbar"),
I = new d(".layout-toggler-preview"), D = new d(".layout-resizer-preview"), N = new d(".extension-preview-buttons"),
V = _.elt.querySelector(".editor-content"), W = document.getElementById("preview-contents"),
X = _.elt.querySelector(".editor-margin"), Q = w.elt.querySelector(".navbar-inner"),
Y = w.elt.querySelector(".buttons-dropdown .dropdown-menu"), K = w.$elt.find(".buttons-dropdown"),
J = w.elt.querySelector(".title-container"), Z = w.$elt.find(".file-title-navbar, .input-file-title"),
e([ b.elt, y.elt, x.elt ]).on("scroll", function() {
this.scrollLeft = 0;
}), t.each(w.elt.querySelectorAll(".right-buttons"), function(e) {
nt.push({
elt: e,
width: it.shift()
});
}), t.each(w.elt.querySelectorAll(".left-buttons"), function(e) {
nt.push({
elt: e,
width: it.shift()
});
}), b.$elt.toggleClass("layout-vertical", lt), b.$elt.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", p),
w.isOpen = !0, w.createToggler(), T.$elt.click(t.bind(w.toggle, w)), k.isOpen = !0,
k.createToggler(), k.halfSize = !0, I.$elt.click(t.bind(k.toggle, k)), k.$elt.on("show.layout.toggle", function() {
t.defer(function() {
k.isOpen || (window.location.href = "viewer");
});
}), C.isOpen = !1, C.createToggler(!0), C.$elt.find(".toggle-button").click(t.bind(C.toggle, C)),
C.$elt.on("click", "a[data-toggle!=collapse]", t.bind(C.toggle, C, !1)), C.$elt.on("hidden.layout.toggle", function() {
m(), i || _.elt.focus();
}), S.isOpen = !1, !window.viewerMode) {
S.createToggler(!0), S.$elt.find(".toggle-button").click(t.bind(S.toggle, S)), S.$elt.on("click", "a[data-toggle!=collapse]", t.bind(S.toggle, S, !1)),
S.$elt.on("show.bs.collapse hidden.layout.toggle", function() {
S.$elt.find(".in").collapse("hide");
}), S.$elt.on("hidden.layout.toggle", function() {
i || _.elt.focus();
}), D.initHammer(!0);
var o;
D.hammer.on("dragstart", function() {
o = {
width: k.width,
height: k.height
};
}).on("drag", function(e) {
lt ? k.height = o.height - e.gesture.deltaY : k.width = o.width - e.gesture.deltaX,
e.gesture.preventDefault(), k.halfSize = !1, g();
});
}
N.initHammer(!0), N.adjustPosition = function() {
if (N.isDragged) {
var e = -v.width + N.elt.offsetWidth, t = -v.height + N.elt.offsetHeight;
this.x < e && (this.x = e), this.y < t && (this.y = t), this.x > 0 && (this.x = 0),
this.y > 0 && (this.y = 0), this.applyCss();
}
};
var l;
N.hammer.on("dragstart", function() {
N.isOpen = !0, N.isDragged = !0, N.$elt.removeClass("closed animate"), y.$elt.addClass("dragging"),
l = {
x: N.x,
y: N.y
};
}).on("drag", function(e) {
N.x = l.x + e.gesture.deltaX, N.y = l.y + e.gesture.deltaY, N.adjustPosition(),
e.gesture.preventDefault();
}).on("dragend", function() {
y.$elt.removeClass("dragging"), N.$elt.find(".btn-group").toggleClass("dropup", v.height / 2 > -N.y);
}), s.stopCallback = function() {
return S.isOpen || C.isOpen || i;
}, e(window).resize(g).focus(function() {
S.isOpen || C.isOpen || i || _.elt.focus();
});
var c = "";
n(16 * r.fontSizeRatio), n(17 * r.fontSizeRatio, 600), n(18 * r.fontSizeRatio, 1200);
var u = a("style", {
type: "text/css"
});
u.innerHTML = c, document.head.appendChild(u), g();
}, o.addListener("onReady", function() {
function n() {
clearTimeout(r), N.isDragged || (N.isOpen = !0, N.x = H.x, N.applyCss(), N.$elt.removeClass("closed"));
}
function i() {
clearTimeout(r), r = setTimeout(function() {
N.isDragged || o || (N.isOpen = !1, N.x = H.x + N.elt.offsetWidth + q, N.applyCss(),
N.$elt.addClass("closed"));
}, 3e3);
}
N.x = H.x, N.y = H.y, N.applyCss(), setTimeout(function() {
N.$elt.addClass("animate");
}, 0);
var r, o = !1;
n(), i(), N.$elt.hover(n, i).on("show.bs.dropdown", function() {
o = !0;
}).on("hidden.bs.dropdown", function() {
o = !1, i();
}), t.each(N.elt.querySelectorAll(".btn-group"), function(t) {
var n = e(t);
n.on("shown.bs.dropdown", function() {
n.find(".dropdown-menu").css({
right: -N.elt.offsetWidth + n.width() + n.position().left
});
var e = -N.y - G;
v.height / 2 > -N.y && (e = v.height + N.y - N.elt.offsetHeight - G), n.find(".markdown-syntax, .table-of-contents").css({
maxHeight: e
});
}).addClass("dropup");
});
}), o.addListener("onExtensionButtonResize", function() {
N.isDragged ? N.adjustPosition() : N.isOpen || (N.$elt.removeClass("animate"), N.x = H.x + N.elt.offsetWidth + q,
N.applyCss(), setTimeout(function() {
N.$elt.addClass("animate");
}, 0));
}), o.onLayoutCreated(L), L;
}), define("text!html/bodyEditor.html", [], function() {
return '
Careful:\n You\'re using the public CouchDB instance.\n Anybody can open, edit and delete your files there! To setup your own CouchDB instance click\n here.\n
\n\n
\n
\n \n\n
\n \n Multiple IDs can be provided (space separated)\n
The following documents will be\n removed from CouchDB:
\n\n \n
\n \n
\n
\n
\n\n\n
\n
\n
\n\n
\n \n
Save on CouchDB
\n
\n
\n
Careful:\n You\'re using the public CouchDB instance.\n Anybody can open, edit and delete your files there! To setup your own CouchDB instance click\n here.\n
\n\n
\n This will save "" to CouchDB and keep it synchronized.\n
\n
\n
Tip: You can use a\n YAML front matter to specify tags for your document.
\n
Alternatively, you can place comma separated tags in square brackets at the beginning of the document title.
\n
\n
\n \n
\n
\n
\n\n\n
\n
\n
\n\n
\n \n
Synchronization
\n
\n
\n
\n "" is synchronized with the\n following location(s):\n
\n \n
\n
Note: Removing a synchronized location will not delete any\n file.
\n
\n
\n \n
\n
\n
\n\n\n
\n
\n
\n\n
\n \n
\n Publish on \n
\n
\n
\n
\n
\n \n
\n Host must be accessible publicly,\n unless you\'re hosting your own StackEdit instance.\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n File path is composed of both\n folder and filename. \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n Jetpack plugin is required for\n self-hosted sites.\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n File path is composed of both\n folder and filename. \n
\n
\n
\n \n
\n If no file ID is supplied, a new file\n will be created in your Google Drive root folder. You can move\n the file afterwards within Google Drive.\n
\n
\n
\n \n
\n If no file name is supplied, the\n document title will be used.\n
Tip: You can use a\n YAML front matter to specify the title of your page.
\n
Interpreted variables:title.
\n
\n
\n
About URL: For newly created page , Blogger API will append a generated number to the url like about-me-1234.html, if you deeply care about your URL naming, you should first create the page on Blogger and then update them with StackEdit specifying the pageId when publishing.\n
\n
About page visibility: Blogger API does not respect published status for pages.When publishing the page to Blogger, the page will be live but not added to the page listing. You should arrange the page listing from Blogger dashboard.\n
\n
\n
\n \n
\n
\n
\n\n\n
\n
\n
\n\n
\n \n
Publication
\n
\n
\n
\n "" is published on the following\n location(s):\n
\n \n
\n
Note: Removing a publish location will not delete the actual publication.
\n
\n
\n \n
\n
\n
\n\n\n
\n
\n
\n\n
\n \n
Sharing
\n
\n
\n
Collaborate on "" using the following link(s):
\n
No sharing link yet!\n
\n \n
\n
Note: To collaborate on this document, just save it on CouchDB.\n To collaborate via Google Drive or Dropbox, you have to share the file manually from Google Drive/Dropbox websites.
\n
\n \n
Share a read-only version of "" using the following link(s):
\n
No sharing link yet!\n
\n \n
\n
Note: To share a read-only version of this document, just publish it as a Gist in\n Markdown format.
\n
\n
\n
Tip: You can open any markdown URL within StackEdit Viewer using viewer#!url=.
');
n.find("a").click(_), t.insertBefore(n[0], t.firstChild), j = j.add(n);
});
});
}, 3e3);
return c.addListener("onOfflineChanged", $), c.addListener("onReady", function() {
function n(e) {
if (e = e || "default", r != e) {
var t = "less!themes/" + e;
-1 !== window.baseDir.indexOf("-min") && (t = "css!themes/" + e), requirejs.undef(t),
require([ t ]), r = e;
}
}
e(document.body).on("shown.bs.modal", ".modal", function() {
var t = e(this);
setTimeout(function() {
t.find(".btn:first").focus(), t.find("button:first").focus(), t.find("input:enabled:visible:first").focus();
}, 50);
}).on("hidden.bs.modal", ".modal", function() {
i.focus(), n(window.theme);
}).on("keypress", ".modal", function(t) {
13 != t.which || e(t.target).is("textarea") || e(this).find(".modal-footer a:last").click();
}), e(".action-insert-link").click(function(t) {
var n = a.getInputTextValue(e("#input-insert-link"), t);
void 0 !== n && (T.insertLinkCallback(n), T.insertLinkCallback = void 0);
}), e(".action-insert-image").click(function(t) {
var n = a.getInputTextValue(e("#input-insert-image"), t);
void 0 !== n && (T.insertLinkCallback(n), T.insertLinkCallback = void 0);
}), e(".modal-insert-link, .modal-insert-image").on("hidden.bs.modal", function() {
void 0 !== T.insertLinkCallback && (T.insertLinkCallback(null), T.insertLinkCallback = void 0);
}), e(".action-load-settings").click(function() {
x();
}), e(".action-apply-settings").click(function(e) {
w(e), e.isPropagationStopped() || window.location.reload();
}), e(".action-add-google-drive-account").click(function() {
3 !== l.gdriveMultiAccount && (l.gdriveMultiAccount++, s.settings = JSON.stringify(l),
window.location.reload());
});
var r = window.theme;
R = e("#input-settings-theme"), R.on("change", function() {
n(this.value);
}), e(".action-import-docs-settings").click(function() {
e("#input-file-import-docs-settings").click();
});
var u;
if (e("#input-file-import-docs-settings").change(function(n) {
var i = (n.dataTransfer || n.target).files;
e(".modal-settings").modal("hide"), t.each(i, function(t) {
var n = new FileReader();
n.onload = function(t) {
return function(n) {
try {
u = JSON.parse(n.target.result);
var i = parseInt(u.version.match(/^v(\d+)$/)[1], 10), r = parseInt(s.version.match(/^v(\d+)$/)[1], 10);
i > r ? c.onError("Incompatible version. Please upgrade StackEdit.") : e(".modal-import-docs-settings").modal("show");
} catch (o) {
c.onError("Wrong format: " + t.name);
}
e("#input-file-import-docs-settings").val("");
};
}(t), n.readAsText(t);
});
}), e(".action-import-docs-settings-confirm").click(function() {
s.clear();
var e = /^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV4$|^version$/;
t.each(u, function(t, n) {
e.test(n) && (s[n] = t);
}), window.location.reload();
}), e(".action-export-docs-settings").click(function() {
a.saveAs(JSON.stringify(s), "StackEdit local storage.json");
}), e(".action-default-settings").click(function() {
s.removeItem("settings"), s.removeItem("theme"), l.dropboxFullAccess || s.removeItem("dropbox.lastChangeId"),
window.location.reload();
}), e(".action-app-reset").click(function() {
s.clear(), window.location.reload();
}), e(".action-reset-input").click(function() {
a.resetModalInputs();
}), a.createTooltip(".tooltip-lazy-rendering", "Disable preview rendering while typing in order to offload CPU. Refresh preview after 500 ms of inactivity."),
a.createTooltip(".tooltip-default-content", [ "Thanks for supporting StackEdit by adding a backlink in your documents!
", 'NOTE: Backlinks in Stack Exchange Q/A are not welcome.' ].join("")),
a.createTooltip(".tooltip-template", h), a.createTooltip(".tooltip-pdf-options", f),
e("div.dropdown-menu").click(function(e) {
e.stopPropagation();
}), e(".modal-non-unique").modal({
backdrop: "static",
keyboard: !1,
show: !1
}), t.each(document.querySelectorAll("img"), function(t) {
var n = e(t), i = n.data("stackeditSrc");
i && n.attr("src", window.baseDir + "/img/" + i);
}), window.viewerMode === !1) {
var d = t.reduce(o.THEME_LIST, function(e, t, n) {
return e + '";
}, "");
document.getElementById("input-settings-theme").innerHTML = d;
}
$();
}), T;
}), define("text!WELCOME.md", [], function() {
return 'Welcome to StackEdit!\n===================\n\n\nHey! I\'m your first Markdown document in **StackEdit**[^stackedit]. Don\'t delete me, I\'m very helpful! I can be recovered anyway in the **Utils** tab of the **Settings** dialog.\n\n----------\n\n\nDocuments\n-------------\n\nStackEdit stores your documents in your browser, which means all your documents are automatically saved locally and are accessible **offline!**\n\n> **Note:**\n\n> - StackEdit is accessible offline after the application has been loaded for the first time.\n> - Your local documents are not shared between different browsers or computers.\n> - Clearing your browser\'s data may **delete all your local documents!** Make sure your documents are synchronized with **Google Drive** or **Dropbox** (check out the [ Synchronization](#synchronization) section).\n\n#### Create a document\n\nThe document panel is accessible using the button in the navigation bar. You can create a new document by clicking **New document** in the document panel.\n\n#### Switch to another document\n\nAll your local documents are listed in the document panel. You can switch from one to another by clicking a document in the list or you can toggle documents using Ctrl+[ and Ctrl+].\n\n#### Rename a document\n\nYou can rename the current document by clicking the document title in the navigation bar.\n\n#### Delete a document\n\nYou can delete the current document by clicking **Delete document** in the document panel.\n\n#### Export a document\n\nYou can save the current document to a file by clicking **Export to disk** from the menu panel.\n\n> **Tip:** Check out the [ Publish a document](#publish-a-document) section for a description of the different output formats.\n\n\n----------\n\n\nSynchronization\n-------------------\n\nStackEdit can be combined with **Google Drive** and **Dropbox** to have your documents saved in the *Cloud*. The synchronization mechanism takes care of uploading your modifications or downloading the latest version of your documents.\n\n> **Note:**\n\n> - Full access to **Google Drive** or **Dropbox** is required to be able to import any document in StackEdit. Permission restrictions can be configured in the settings.\n> - Imported documents are downloaded in your browser and are not transmitted to a server.\n> - If you experience problems saving your documents on Google Drive, check and optionally disable browser extensions, such as Disconnect.\n\n#### Open a document\n\nYou can open a document from **Google Drive** or the **Dropbox** by opening the **Synchronize** sub-menu and by clicking **Open from...**. Once opened, any modification in your document will be automatically synchronized with the file in your **Google Drive** / **Dropbox** account.\n\n#### Save a document\n\nYou can save any document by opening the **Synchronize** sub-menu and by clicking **Save on...**. Even if your document is already synchronized with **Google Drive** or **Dropbox**, you can export it to a another location. StackEdit can synchronize one document with multiple locations and accounts.\n\n#### Synchronize a document\n\nOnce your document is linked to a **Google Drive** or a **Dropbox** file, StackEdit will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. A merge will be performed if necessary and conflicts will be detected.\n\nIf you just have modified your document and you want to force the synchronization, click the button in the navigation bar.\n\n> **Note:** The button is disabled when you have no document to synchronize.\n\n#### Manage document synchronization\n\nSince one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking **Manage synchronization** in the **Synchronize** sub-menu. This will let you remove synchronization locations that are associated to your document.\n\n> **Note:** If you delete the file from **Google Drive** or from **Dropbox**, the document will no longer be synchronized with that location.\n\n----------\n\n\nPublication\n-------------\n\nOnce you are happy with your document, you can publish it on different websites directly from StackEdit. As for now, StackEdit can publish on **Blogger**, **Dropbox**, **Gist**, **GitHub**, **Google Drive**, **Tumblr**, **WordPress** and on any SSH server.\n\n#### Publish a document\n\nYou can publish your document by opening the **Publish** sub-menu and by choosing a website. In the dialog box, you can choose the publication format:\n\n- Markdown, to publish the Markdown text on a website that can interpret it (**GitHub** for instance),\n- HTML, to publish the document converted into HTML (on a blog for example),\n- Template, to have a full control of the output.\n\n> **Note:** The default template is a simple webpage wrapping your document in HTML format. You can customize it in the **Advanced** tab of the **Settings** dialog.\n\n#### Update a publication\n\nAfter publishing, StackEdit will keep your document linked to that publication which makes it easy for you to update it. Once you have modified your document and you want to update your publication, click on the button in the navigation bar.\n\n> **Note:** The button is disabled when your document has not been published yet.\n\n#### Manage document publication\n\nSince one document can be published on multiple locations, you can list and manage publish locations by clicking **Manage publication** in the menu panel. This will let you remove publication locations that are associated to your document.\n\n> **Note:** If the file has been removed from the website or the blog, the document will no longer be published on that location.\n\n----------\n\n\nMarkdown Extra\n--------------------\n\nStackEdit supports **Markdown Extra**, which extends **Markdown** syntax with some nice features.\n\n> **Tip:** You can disable any **Markdown Extra** feature in the **Extensions** tab of the **Settings** dialog.\n\n> **Note:** You can find more information about **Markdown** syntax [here][2] and **Markdown Extra** extension [here][3].\n\n\n### Tables\n\n**Markdown Extra** has a special syntax for tables:\n\nItem | Value\n-------- | ---\nComputer | $1600\nPhone | $12\nPipe | $1\n\nYou can specify column alignment with one or two colons:\n\n| Item | Value | Qty |\n| :------- | ----: | :---: |\n| Computer | $1600 | 5 |\n| Phone | $12 | 12 |\n| Pipe | $1 | 234 |\n\n\n### Definition Lists\n\n**Markdown Extra** has a special syntax for definition lists too:\n\nTerm 1\nTerm 2\n: Definition A\n: Definition B\n\nTerm 3\n\n: Definition C\n\n: Definition D\n\n > part of definition D\n\n\n### Fenced code blocks\n\nGitHub\'s fenced code blocks are also supported with **Highlight.js** syntax highlighting:\n\n```\n// Foo\nvar bar = 0;\n```\n\n> **Tip:** To use **Prettify** instead of **Highlight.js**, just configure the **Markdown Extra** extension in the **Settings** dialog.\n\n> **Note:** You can find more information:\n\n> - about **Prettify** syntax highlighting [here][5],\n> - about **Highlight.js** syntax highlighting [here][6].\n\n\n### Footnotes\n\nYou can create footnotes like this[^footnote].\n\n [^footnote]: Here is the *text* of the **footnote**.\n\n\n### SmartyPants\n\nSmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:\n\n| | ASCII | HTML |\n ----------------- | ---------------------------- | ------------------\n| Single backticks | `\'Isn\'t this fun?\'` | \'Isn\'t this fun?\' |\n| Quotes | `"Isn\'t this fun?"` | "Isn\'t this fun?" |\n| Dashes | `-- is en-dash, --- is em-dash` | -- is en-dash, --- is em-dash |\n\n\n### Table of contents\n\nYou can insert a table of contents using the marker `[TOC]`:\n\n[TOC]\n\n\n### MathJax\n\nYou can render *LaTeX* mathematical expressions using **MathJax**, as on [math.stackexchange.com][1]:\n\nThe *Gamma function* satisfying $\\Gamma(n) = (n-1)!\\quad\\forall n\\in\\mathbb N$ is via the Euler integral\n\n$$\n\\Gamma(z) = \\int_0^\\infty t^{z-1}e^{-t}dt\\,.\n$$\n\n> **Tip:** To make sure mathematical expressions are rendered properly on your website, include **MathJax** into your template:\n\n```\n\n```\n\n> **Note:** You can find more information about **LaTeX** mathematical expressions [here][4].\n\n\n### UML diagrams\n\nYou can also render sequence diagrams like this:\n\n```sequence\nAlice->Bob: Hello Bob, how are you?\nNote right of Bob: Bob thinks\nBob-->Alice: I am good thanks!\n```\n\nAnd flow charts like this:\n\n```flow\nst=>start: Start\ne=>end\nop=>operation: My Operation\ncond=>condition: Yes or No?\n\nst->op->cond\ncond(yes)->e\ncond(no)->op\n```\n\n> **Note:** You can find more information:\n\n> - about **Sequence diagrams** syntax [here][7],\n> - about **Flow charts** syntax [here][8].\n\n### Support StackEdit\n\n[![](https://cdn.monetizejs.com/resources/button-32.png)](https://monetizejs.com/authorize?client_id=ESTHdCYOi18iLhhO&summary=true)\n\n [^stackedit]: [StackEdit](https://stackedit.io/) is a full-featured, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.\n\n\n [1]: http://math.stackexchange.com/\n [2]: http://daringfireball.net/projects/markdown/syntax "Markdown"\n [3]: https://github.com/jmcmanus/pagedown-extra "Pagedown Extra"\n [4]: http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference\n [5]: https://code.google.com/p/google-code-prettify/\n [6]: http://highlightjs.org/\n [7]: http://bramp.github.io/js-sequence-diagrams/\n [8]: http://adrai.github.io/flowchart.js/\n';
}), define("fileMgr", [ "jquery", "underscore", "constants", "core", "utils", "storage", "settings", "eventMgr", "fileSystem", "classes/FileDescriptor", "text!WELCOME.md" ], function(e, t, n, i, r, o, a, s, l, c, u) {
var d = {};
return d.currentFile = void 0, d.selectFile = function(r) {
if (r = r || d.currentFile, void 0 === r) {
var o = t.size(l);
r = 0 === o ? d.createFile(n.WELCOME_DOCUMENT_TITLE, u) : t.max(l, function(e) {
return e.selectTime || 0;
});
}
d.currentFile !== r && (d.currentFile = r, r.selectTime = new Date().getTime(),
s.onFileSelected(r), e(".action-edit-document").toggleClass("hide", r.fileIndex != n.TEMPORARY_FILE_INDEX)),
i.initEditor(r);
}, d.createFile = function(e, i, u, d, p) {
if (i = void 0 !== i ? i : a.defaultContent, !e) {
e = n.DEFAULT_FILE_TITLE;
for (var h = 2, f = function(t) {
return t.title == e;
}; t.some(l, f); ) e = n.DEFAULT_FILE_TITLE + h++;
}
var m = n.TEMPORARY_FILE_INDEX;
if (!p) do m = "file." + r.id(); while (t.has(l, m));
d = d || {};
var g = t.reduce(d, function(e, t) {
return r.storeAttributes(t), e + t.syncIndex + ";";
}, ";");
o[m + ".title"] = e, o[m + ".content"] = i, o[m + ".sync"] = g, o[m + ".publish"] = ";";
var v = new c(m, e, d);
return u && (v.discussionListJSON = u), p || (r.appendIndexToArray("file.list", m),
l[m] = v, s.onFileCreated(v)), v;
}, d.deleteFile = function(e) {
e = e || d.currentFile, e.folder && (e.folder.removeFile(e), s.onFoldersChanged()),
r.removeIndexFromArray("file.list", e.fileIndex), delete l[e.fileIndex], d.currentFile === e && (d.currentFile = void 0,
d.selectFile()), s.onFileDeleted(e);
}, d.getFileFromSyncIndex = function(e) {
return t.find(l, function(n) {
return t.has(n.syncLocations, e);
});
}, d.getFileFromPublishIndex = function(e) {
return t.find(l, function(n) {
return t.has(n.publishLocations, e);
});
}, s.addListener("onReady", function() {
function t() {
if (a) {
o.addClass("hide"), r.removeClass("hide");
var t = e.trim(o.val()), n = d.currentFile;
t && t != n.title && (n.title = t, s.onTitleChanged(n)), o.val(n.title), i.focus(),
a = !1;
}
}
var i = e("#wmd-input");
d.selectFile();
var r = e(".file-title-navbar"), o = e(".input-file-title");
e(".action-create-file").click(function() {
setTimeout(function() {
var e = d.createFile();
d.selectFile(e), r.click();
}, 400);
}), e(".action-remove-file-confirm").click(function() {
e(".modal-remove-file-confirm").modal("show");
}), e(".action-remove-file").click(function() {
d.deleteFile();
});
var a;
r.click(function() {
if (window.viewerMode !== !0) {
r.addClass("hide");
var e = o.removeClass("hide");
a = !0, setTimeout(function() {
e.focus().get(0).select();
}, 10);
}
}), o.blur(function() {
setTimeout(function() {
t();
}, 0);
}).keypress(function(e) {
13 == e.keyCode && (t(), e.preventDefault()), 27 == e.keyCode && (o.val(""), t());
}), e(".action-open-stackedit").click(function() {
window.location.href = "editor";
}), e(".action-edit-document").click(function() {
var e = i.val(), t = d.currentFile.title, n = d.createFile(t, e);
d.selectFile(n), window.location.href = "editor";
}), e(".action-welcome-file").click(function() {
var e = d.createFile(n.WELCOME_DOCUMENT_TITLE, u);
d.selectFile(e);
});
}), s.onFileMgrCreated(d), d;
}), define("classes/Provider", [ "underscore", "utils", "settings", "eventMgr", "fileMgr", "editor", "diff_match_patch_uncompressed", "jsondiffpatch" ], function(e, t, n, i, r, o, a, s) {
function l(e, t) {
this.providerId = e, this.providerName = t, this.isPublishEnabled = !0;
}
l.prototype.parseDiscussionList = function(t) {
try {
var n = JSON.parse(t);
return e.each(n, function(t, n) {
if (t.discussionIndex != n || !e.isNumber(t.selectionStart) || !e.isNumber(t.selectionEnd)) throw "invalid";
t.commentList && t.commentList.forEach(function(t) {
if (t.author && !e.isString(t.author) || !e.isString(t.content)) throw "invalid";
});
}), n;
} catch (i) {}
}, l.prototype.serializeContent = function(e, t) {
return t.length > 2 ? e + "" : e;
}, l.prototype.parseContent = function(e) {
var t, n = "{}", i = /$/.exec(e);
return i && (t = this.parseDiscussionList(i[1])) && (e = e.substring(0, i.index),
n = i[1]), {
content: e,
discussionList: t || {},
discussionListJSON: n
};
};
var c = new a();
c.Match_Threshold = 0, c.Patch_DeleteThreshold = 0;
var u = s.create({
objectHash: function(e) {
return JSON.stringify(e);
},
textDiff: {
minLength: 9999999
}
}), d = "merge" == n.conflictMode;
return l.prototype.syncMerge = function(n, a, s, l, p, h) {
function f(e) {
function t() {
(i[1] || r[1]) && (i[1] && r[1] ? (i[1] = "\u29f8\u29f8" + i[1] + "\u29f8\u29f8",
r[1] += "\u29f8\u29f8", n.push(i), n.push(r)) : n.push([ 0, i[1] + r[1] ]), i = [ -1, "" ],
r = [ 1, "" ]);
}
var n = [], i = [ -1, "" ], r = [ 1, "" ], o = 20;
return e.forEach(function(a, s) {
function l() {
return 0 === s || s === e.length - 1;
}
var c = a[0], u = a[1];
if (0 === c) if (l() || u.length > o) {
if (i[1] || r[1]) {
var d = /\s/.exec(u);
if (d) {
var p = d.index, h = u.substring(0, p);
u = u.substring(p), i[1] += h, r[1] += h;
}
}
if (u) {
for (var f = u.length; f && /\S/.test(u[f - 1]); ) f--;
var m = u.substring(f);
u = u.substring(0, f), l() || u.length > o ? (t(), n.push([ 0, u ])) : (i[1] += u,
r[1] += u), i[1] += m, r[1] += m;
}
} else i[1] += u, r[1] += u; else -1 === c ? i[1] += u : 1 === c && (r[1] += u);
}), i[1] == r[1] ? n.push([ 0, r[1] ]) : t(), n;
}
var m = n.content, g = n.title, v = n.discussionListJSON, b = n.discussionList, y = t.crc32(m), x = t.crc32(g), w = t.crc32(v), S = t.crc32(s), C = t.crc32(l), _ = t.crc32(h), k = a.contentCRC != y, E = a.contentCRC != S, T = m != s && E, I = T && k;
a.titleCRC = a.titleCRC || x;
var D, N, M = a.titleCRC != x, L = a.titleCRC != C, A = g != l && L, R = A && M, P = a.discussionListCRC != w, O = a.discussionListCRC != _, F = v != h && O, B = F && P, j = [], $ = s, q = l, G = p, H = !1, U = !1, z = !1;
if (!d && (I || R || B) || I && void 0 === a.content || R && void 0 === a.title || B && void 0 === a.discussionList) r.createFile(g + " (backup)", m, v),
i.onMessage('Conflict detected on "' + g + '". A backup has been created locally.'); else {
if (I) {
var V = a.content;
D = c.diff_main(V, m), c.diff_cleanupSemantic(D), N = c.patch_make(V, D);
var W = c.patch_apply(N, s);
if ($ = W[0], !W[1].every(e.identity)) {
D = c.diff_main(m, $), D = f(D), $ = "";
var X;
D.forEach(function(e) {
var t = e[0], n = e[1];
0 === t || X ? 0 === t && X && (X.selectionEnd = $.length, j.push(X), X = void 0) : X = {
selectionStart: $.length,
type: "conflict"
}, $ += n;
}), X && (X.selectionEnd = $.length, j.push(X));
}
}
T && (P && (H = !0), O ? U = !0 : (H = !0, G = b)), B && (z = !0), R && (N = c.patch_make(a.title, g),
q = c.patch_apply(N, l)[0]);
}
var Q;
if (T) {
var Y = [];
r.currentFile === n && (Q = {
selectionStart: o.selectionMgr.selectionStart,
selectionEnd: o.selectionMgr.selectionEnd
}, Y.push(Q), n.newDiscussion && Y.push(n.newDiscussion)), H && (Y = Y.concat(e.values(b))),
F |= o.adjustCommentOffsets(m, $, Y);
}
if (U) {
var K = e.values(p);
o.adjustCommentOffsets(s, $, K);
}
if (z) {
var J = JSON.parse(a.discussionList);
D = u.diff(J, b), u.patch(p, D), e.each(p, function(e, t) {
e || delete p[t];
});
}
return j.length && (F = !0, j.forEach(function(n) {
var i;
do i = t.id(); while (e.has(G, i));
n.discussionIndex = i, G[i] = n;
})), A && (n.title = q, i.onTitleChanged(n), i.onMessage('"' + g + '" has been renamed to "' + q + '" on ' + this.providerName + ".")),
(T || F) && o.watcher.noWatch(e.bind(function() {
if (T && (r.currentFile === n && (o.setValueNoWatch($), Q && o.selectionMgr.setSelectionStartEnd(Q.selectionStart, Q.selectionEnd)),
n.content = $, i.onContentChanged(n, $)), F) {
n.discussionList = G;
var t = u.diff(b, G), a = !1;
e.each(t, function(t, r) {
e.isArray(t) ? 1 === t.length ? i.onDiscussionCreated(n, G[r]) : i.onDiscussionRemoved(n, b[r]) : a = !0;
}), a && i.onCommentsChanged(n);
}
o.undoMgr.currentMode = "sync", o.undoMgr.saveState(), i.onMessage('"' + l + '" has been updated from ' + this.providerName + "."),
j.length && i.onMessage('"' + l + '" has conflicts that you have to review.');
}, this)), {
contentCRC: S,
titleCRC: C,
discussionListCRC: _
};
}, l;
}), define("classes/AsyncTask", [ "underscore", "constants", "utils", "eventMgr" ], function(e, t, n, i) {
function r(e) {
this.finished = !1, this.timeout = t.ASYNC_TASK_DEFAULT_TIMEOUT, this.retryCounter = 0,
this.runCallbacks = [], this.successCallbacks = [], this.errorCallbacks = [], this.force = e;
}
function o() {
if (c === !0) return void (l + u.timeout < n.currentTime && u.error(new Error("A timeout occurred.")));
if (void 0 === u) {
if (0 === s.length || !s[0].force && p === !1) return;
u = s.shift(), l = n.currentTime, d === !1 && (d = !0, i.onAsyncRunning(!0));
}
l <= n.currentTime && (c = !0, u.chain());
}
function a(t, n, r) {
try {
e.each(n, function(e) {
e(r);
});
} finally {
t.finished = !0, u === t && (u = void 0, c = !1), 0 === s.length ? (d = !1, i.onAsyncRunning(!1)) : o();
}
}
var s = [];
r.prototype.onRun = function(e) {
this.runCallbacks.push(e);
}, r.prototype.onSuccess = function(e) {
this.successCallbacks.push(e);
}, r.prototype.onError = function(e) {
this.errorCallbacks.push(e);
};
var l = 0;
r.prototype.chain = function(e) {
if (l = n.currentTime, n.logStackTrace(), this.finished !== !0) {
if (void 0 === this.queue && (this.queue = this.runCallbacks.slice()), void 0 !== e) return void e();
if (0 === this.queue.length) return void a(this, this.successCallbacks);
var t = this.queue.shift();
t();
}
}, r.prototype.error = function(e) {
if (n.logStackTrace(), this.finished !== !0) throw e = e || new Error("Unknown error"),
e.message && i.onError(e), a(this, this.errorCallbacks, e), e;
};
var c = !1;
r.prototype.retry = function(e, t) {
if (this.finished !== !0) {
if (t = t || 5, this.queue = void 0, this.retryCounter >= t) return void this.error(e);
var i = 1e3 * Math.pow(2, this.retryCounter++);
l = n.currentTime + i, c = !1, o();
}
}, r.prototype.enqueue = function() {
s.push(this), o();
};
var u, d = !1, p = !1;
return i.addListener("onUserActive", function() {
p = !0;
}), i.addListener("onPeriodicRun", o), r;
}), define("helpers/dropboxHelper", [ "jquery", "underscore", "constants", "core", "utils", "storage", "logger", "settings", "eventMgr", "classes/AsyncTask" ], function(e, t, n, i, r, o, a, s, l, c) {
function u(t) {
t.onRun(function() {
return v === !0 ? (f = void 0, t.error(new Error("Operation not available in offline mode.|stopPublish"))) : void 0 !== f ? t.chain() : void e.ajax({
url: "libs/dropbox.min.js",
dataType: "script",
timeout: n.AJAX_TIMEOUT
}).done(function() {
f = new Dropbox.Client({
key: s.dropboxFullAccess === !0 ? n.DROPBOX_APP_KEY : n.DROPBOX_RESTRICTED_APP_KEY,
secret: s.dropboxFullAccess === !0 ? n.DROPBOX_APP_SECRET : n.DROPBOX_RESTRICTED_APP_SECRET
}), f.authDriver(new Dropbox.AuthDriver.Popup({
receiverUrl: n.BASE_URL + "html/dropbox-oauth-receiver.html",
rememberUser: !0
})), t.chain();
}).fail(function(e) {
var n = {
status: e.status,
responseText: e.statusText
};
p(n, t);
});
});
}
function d(e) {
e.onRun(function() {
function t() {
r.redirectConfirm("You are being redirected to Dropbox authorization page.", function() {
e.chain(i);
}, function() {
e.error(new Error("Operation canceled."));
});
}
function i() {
o === !1 ? e.timeout = n.ASYNC_TASK_LONG_TIMEOUT : f.reset(), f.authenticate({
interactive: !o
}, function(n, i) {
return i.isAuthenticated() === !0 ? (m = !0, e.chain()) : o === !0 ? (o = !1, e.chain(t)) : void e.error(new Error("Access to Dropbox account is not authorized."));
});
}
if (m === !0) return e.chain();
var o = !0;
e.chain(i);
});
}
function p(e, n) {
var r = !0;
if (e) if (a.error(e), "string" == typeof e) r = e; else {
if (r = "Dropbox error (" + e.status + ": " + e.responseText + ").", 401 === e.status || 403 === e.status) return m = !1,
r = "Access to Dropbox account is not authorized.", n.retry(new Error(r), 1);
if (400 === e.status && -1 !== e.responseText.indexOf("oauth_nonce")) return t.each(t.keys(o), function(e) {
0 === e.indexOf("dropbox-auth") && o.removeItem(e);
}), m = !1, n.retry(new Error(r), 1);
e.status <= 0 && (f = void 0, m = !1, i.setOffline(), r = "|stopPublish");
}
n.error(new Error(r));
}
function h(t) {
t.onRun(function() {
function i() {
r.redirectConfirm("You are being redirected to Dropbox Chooser page.", function() {
t.chain();
}, function() {
t.error(new Error("Operation canceled."));
});
}
return b === !0 ? t.chain() : void e.ajax({
url: "https://www.dropbox.com/static/api/1/dropbox.js",
dataType: "script",
timeout: n.AJAX_TIMEOUT
}).done(function() {
b = !0, t.chain(i);
}).fail(function(e) {
var n = {
status: e.status,
responseText: e.statusText
};
p(n, t);
});
});
}
var f, m = !1, g = {}, v = !1;
l.addListener("onOfflineChanged", function(e) {
v = e;
}), g.upload = function(e, t, n) {
var i, r = new c();
u(r), d(r), r.onRun(function() {
f.writeFile(e, t, function(t, n) {
return t ? (400 === t.status && (t = 'Could not upload document into path "' + e + '".'),
void p(t, r)) : (i = n, r.chain());
});
}), r.onSuccess(function() {
n(void 0, i);
}), r.onError(function(e) {
n(e);
}), r.enqueue();
}, g.checkChanges = function(e, t) {
var n = [], i = e || 0, r = new c();
u(r), d(r), r.onRun(function() {
function e() {
f.pullChanges(i, function(t, o) {
return t ? p(t, r) : (i = o.cursor(), void 0 !== o.changes && (n = n.concat(o.changes)),
void (o.shouldPullAgain ? r.chain(e) : r.chain()));
});
}
r.chain(e);
}), r.onSuccess(function() {
t(void 0, n, i);
}), r.onError(function(e) {
t(e);
}), r.enqueue();
}, g.downloadMetadata = function(e, t) {
var n = [], i = new c();
u(i), d(i), i.onRun(function() {
function t() {
if (0 === e.length) return i.chain();
var r = e[0];
f.stat(r, function(r, o) {
return o ? (n.push(o), e.shift(), i.chain(t)) : void p(r, i);
});
}
i.chain(t);
}), i.onSuccess(function() {
t(void 0, n);
}), i.onError(function(e) {
t(e);
}), i.enqueue();
}, g.downloadContent = function(e, n) {
var i = [], r = new c();
u(r), d(r), r.onRun(function() {
function n() {
if (0 === e.length) return r.chain();
var o = e[0];
i.push(o);
var a;
return o.isFile === !0 ? a = o : void 0 !== o.wasRemoved && (a = o.stat), a ? void f.readFile(a.path, function(i, o) {
return t.isString(o) ? (a.content = o, e.shift(), r.chain(n)) : void p(i, r);
}) : (e.shift(), r.chain(n));
}
r.chain(n);
}), r.onSuccess(function() {
n(void 0, i);
}), r.onError(function(e) {
n(e);
}), r.enqueue();
};
var b = !1;
return g.picker = function(e) {
var t = [], i = new c();
i.timeout = n.ASYNC_TASK_LONG_TIMEOUT, u(i), h(i), i.onRun(function() {
var e = {};
e.multiselect = !0, e.linkType = "direct", e.success = function(e) {
for (var n = 0; n < e.length; n++) {
var r = e[n].link;
r = r.replace(/.*\/view\/[^\/]*/, ""), t.push(decodeURI(r));
}
i.chain();
}, e.cancel = function() {
i.chain();
}, Dropbox.choose(e);
}), i.onSuccess(function() {
e(void 0, t);
}), i.onError(function(t) {
e(t);
}), i.enqueue();
}, g;
}), define("providers/dropboxProvider", [ "underscore", "utils", "storage", "settings", "classes/Provider", "eventMgr", "fileMgr", "helpers/dropboxHelper" ], function(e, t, n, i, r, o, a, s) {
function l(e) {
return void 0 === e ? void 0 : e.match(/^[^\\<>:"\|?\*]+$/) ? 0 !== e.indexOf("/") ? "/" + e : e : void o.onError('"' + e + '" contains invalid characters.');
}
function c(e) {
return "sync." + p + "." + encodeURIComponent(e.toLowerCase());
}
function u(e, n, i, r) {
r = r || "{}";
var o = {};
return o.provider = h, o.path = e, o.version = n, o.contentCRC = t.crc32(i), o.discussionListCRC = t.crc32(r),
o.syncIndex = c(e), f === !0 && (o.content = i, o.discussionList = r), o;
}
function d(t) {
s.downloadMetadata(t, function(t, n) {
t || s.downloadContent(n, function(t, n) {
if (!t) {
var i = [];
e.each(n, function(e) {
var t = h.parseContent(e.content), n = u(e.path, e.versionTag, t.content, t.discussionListJSON), r = {};
r[n.syncIndex] = n;
var o = a.createFile(e.name, t.content, t.discussionListJSON, r);
a.selectFile(o), i.push(o);
}), 0 !== i.length && o.onSyncImportSuccess(i, h);
}
});
});
}
var p = "dropbox", h = new r(p, "Dropbox");
h.defaultPublishFormat = "template", h.getSyncLocationLink = h.getPublishLocationLink = function(e) {
var t = e.path.split("/").map(encodeURIComponent), n = t.pop();
return [ "https://www.dropbox.com/home", t.join("/"), "?select=", n ].join("");
};
var f = "merge" == i.conflictMode;
return h.importFiles = function() {
s.picker(function(t, n) {
if (!t && 0 !== n.length) {
var i = [];
e.each(n, function(e) {
var t = c(e), n = a.getFileFromSyncIndex(t);
return void 0 !== n ? o.onError('"' + n.title + '" is already in your local documents.') : void i.push(e);
}), d(i);
}
});
}, h.exportFile = function(e, n, i, r, d, p) {
var f = t.getInputTextValue("#input-sync-export-dropbox-path", e);
if (f = l(f), void 0 === f) return p(!0);
var m = c(f), g = a.getFileFromSyncIndex(m);
if (void 0 !== g) {
var v = g.title;
return o.onError('File path is already synchronized with "' + v + '".'), p(!0);
}
var b = h.serializeContent(i, r);
s.upload(f, b, function(e, t) {
if (e) return p(e);
var n = u(t.path, t.versionTag, i, r);
p(void 0, n);
});
}, h.syncUp = function(e, t, n, i, r, o, a, l, c) {
if (l.contentCRC == t && l.discussionListCRC == o) return c(void 0, !1);
var u = h.serializeContent(e, r);
s.upload(l.path, u, function(n, a) {
return n ? c(n, !0) : (l.version = a.versionTag, f === !0 && (l.content = e, l.discussionList = r),
l.contentCRC = t, l.titleCRC = i, l.discussionListCRC = o, void c(void 0, !0));
});
}, h.syncDown = function(i) {
var r = n[p + ".lastChangeId"];
s.checkChanges(r, function(r, l, u) {
if (r) return i(r);
var d = [];
e.each(l, function(e) {
var t = c(e.path), n = a.getFileFromSyncIndex(t), i = n && n.syncLocations[t];
return i ? (e.fileDesc = n, e.syncAttributes = i, e.wasRemoved === !0 ? void d.push(e) : void (i.version != e.stat.versionTag && d.push(e))) : void 0;
}), s.downloadContent(d, function(e, r) {
function a() {
if (0 === r.length) return n[p + ".lastChangeId"] = u, i();
var e = r.pop(), s = e.fileDesc, l = e.syncAttributes;
if (e.wasRemoved === !0) return o.onError('"' + s.title + '" has been removed from Dropbox.'),
s.removeSyncLocation(l), o.onSyncRemoved(s, l);
var c = e.stat, d = h.parseContent(c.content), m = d.content, g = d.discussionListJSON, v = d.discussionList, b = h.syncMerge(s, l, m, s.title, v, g);
l.version = c.versionTag, f === !0 && (l.content = m, l.discussionList = v), l.contentCRC = b.contentCRC,
l.discussionListCRC = b.discussionListCRC, t.storeAttributes(l), setTimeout(a, 5);
}
return e ? void i(e) : void setTimeout(a, 5);
});
});
}, h.publish = function(e, t, n, i, r) {
var o = l(e.path);
return void 0 === o ? r(!0) : void s.upload(o, i, r);
}, h.newPublishAttributes = function(e) {
var n = {};
return n.path = t.getInputTextValue("#input-publish-dropbox-path", e), e.isPropagationStopped() ? void 0 : n;
}, h;
}), function(e, t) {
var n, i = e.document;
n = function() {
var n, r, o, a, s, l, c, u, d, p, h, f, m, g = {}, v = {}, b = !1, y = {
ENTER: 13,
ESC: 27,
SPACE: 32
}, x = [];
return v = {
buttons: {
holder: '',
submit: '',
ok: '',
cancel: ''
},
input: '',
message: '
{{message}}
',
log: '{{message}}'
}, m = function() {
var e, n, r = !1, o = i.createElement("fakeelement"), a = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "otransitionend",
transition: "transitionend"
};
for (e in a) if (o.style[e] !== t) {
n = a[e], r = !0;
break;
}
return {
type: n,
supported: r
};
}, n = function(e) {
return i.getElementById(e);
}, g = {
labels: {
ok: "OK",
cancel: "Cancel"
},
delay: 5e3,
buttonReverse: !1,
buttonFocus: "ok",
transition: t,
addListeners: function(e) {
var t, n, l, c, u, d = "undefined" != typeof o, p = "undefined" != typeof r, h = "undefined" != typeof f, m = "", g = this;
t = function(t) {
return "undefined" != typeof t.preventDefault && t.preventDefault(), l(t), "undefined" != typeof f && (m = f.value),
"function" == typeof e && ("undefined" != typeof f ? e(!0, m) : e(!0)), !1;
}, n = function(t) {
return "undefined" != typeof t.preventDefault && t.preventDefault(), l(t), "function" == typeof e && e(!1),
!1;
}, l = function() {
g.hide(), g.unbind(i.body, "keyup", c), g.unbind(a, "focus", u), d && g.unbind(o, "click", t),
p && g.unbind(r, "click", n);
}, c = function(e) {
var i = e.keyCode;
(i === y.SPACE && !h || h && i === y.ENTER) && t(e), i === y.ESC && p && n(e);
}, u = function() {
h ? f.focus() : !p || g.buttonReverse ? o.focus() : r.focus();
}, this.bind(a, "focus", u), this.bind(s, "focus", u), d && this.bind(o, "click", t),
p && this.bind(r, "click", n), this.bind(i.body, "keyup", c), this.transition.supported || this.setFocus();
},
bind: function(e, t, n) {
"function" == typeof e.addEventListener ? e.addEventListener(t, n, !1) : e.attachEvent && e.attachEvent("on" + t, n);
},
handleErrors: function() {
if ("undefined" != typeof e.onerror) {
var t = this;
return e.onerror = function(e, n, i) {
t.error("[" + e + " on line " + i + " of " + n + "]", 0);
}, !0;
}
return !1;
},
appendButtons: function(e, t) {
return this.buttonReverse ? t + e : e + t;
},
build: function(e) {
var t = "", n = e.type, i = e.message, r = e.cssClass || "";
switch (t += '
', t += 'Reset Focus',
"none" === g.buttonFocus && (t += ''),
"prompt" === n && (t += '
'), t += '',
t += v.message.replace("{{message}}", i), "prompt" === n && (t += v.input), t += v.buttons.holder,
t += "", "prompt" === n && (t += "