\n\n";
}), t = t.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function(t, e, n) {
var i = e.length;
return "" + a(n) + "\n\n";
});
}
function f(t, e) {
t += "~0";
var n = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
return B ? t = t.replace(n, function(t, n, i) {
var r = n, o = i.search(/[*+-]/g) > -1 ? "ul" : "ol", a = m(r, o, e);
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,
t = t.replace(n, function(t, e, n, i) {
var r = e, o = n, a = i.search(/[*+-]/g) > -1 ? "ul" : "ol", s = m(o, a);
return s = r + "<" + a + ">\n" + s + "" + a + ">\n";
})), t = t.replace(/~0/, "");
}
function m(t, e, n) {
B++, t = t.replace(/\n{2,}$/, "\n"), t += "~0";
var i = $[e], r = new RegExp("(^[ \\t]*)(" + i + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + i + ")[ \\t]+))", "gm"), s = !1;
return t = t.replace(r, function(t, e, i, r) {
var l = r, c = /\n\n$/.test(l);
return c || l.search(/\n{2,}/) > -1 || s ? l = o(I(l), !0) : (l = f(I(l), !0), l = l.replace(/\n$/, ""),
n || (l = a(l))), s = c, "
" + l + "
\n";
}), t = t.replace(/~0/g, ""), B--, t;
}
function g(t) {
return t += "~0", t = t.replace(/(?:\n\n|^\n?)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g, function(t, e, n) {
var i = e, r = n;
return i = y(I(i)), i = D(i), i = i.replace(/^\n+/g, ""), i = i.replace(/\n+$/g, ""),
"\n\n" + (i = "
" + i + "\n
") + "\n\n" + r;
}), t = t.replace(/~0/, "");
}
function v(t) {
return t = t.replace(/(^\n+|\n+$)/g, ""), "\n\n~K" + (F.push(t) - 1) + "K\n\n";
}
function b(t) {
return t = t.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function(t, e, n, i, r) {
var o = i;
return o = o.replace(/^([ \t]*)/g, ""), o = o.replace(/[ \t]*$/g, ""), o = y(o),
o = o.replace(/:\/\//g, "~P"), e + "" + o + "";
});
}
function y(t) {
return t = t.replace(/&/g, "&"), t = t.replace(//g, ">"),
t = M(t, "*_{}[]\\", !1);
}
function x(t) {
return t = t.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g, "$1$3$4"),
t = t.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g, "$1$3$4");
}
function w(t) {
return t = t.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function(t, e) {
var n = e;
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(t, e) {
var n = e;
return n = n.replace(/^ /gm, "~0"), n = n.replace(/~0/g, "");
}), v("
\n" + n + "\n
");
});
}
function S(t, e) {
t = t.replace(/^\n+/g, ""), t = t.replace(/\n+$/g, "");
for (var n = t.split(/\n{2,}/g), i = [], r = /~K(\d+)K/, o = n.length, s = 0; s < o; 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 (!e) {
o = i.length;
for (var s = 0; s < o; s++) for (var c = !0; c; ) c = !1, i[s] = i[s].replace(/~K(\d+)K/g, function(t, e) {
return c = !0, F[e];
});
}
return i.join("\n\n");
}
function C(t) {
return t = t.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), t = t.replace(/<(?![a-z\/?!]|~D)/gi, "<");
}
function _(t) {
return t = t.replace(/\\(\\)/g, L), t = t.replace(/\\([`*_{}\[\]()>#+-.!])/g, L);
}
function k(t, e, n, i) {
if (e) return t;
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] ? o <= 0 ? o = 1 : o++ : o--;
var s = "";
if (o < 0) {
var l = new RegExp("\\){1," + -o + "}$");
i = i.replace(l, function(t) {
return s = t, "";
});
}
if (s) {
var c = i.charAt(i.length - 1);
G.test(c) || (s = c + s, i = i.substr(0, i.length - 1));
}
return "<" + n + i + ">" + s;
}
function E(t) {
t = t.replace(q, k);
var e = function(t, e) {
return '' + R.plainLinkText(e) + "";
};
return t = t.replace(/<((https?|ftp):[^'">\s]+)>/gi, e);
}
function T(t) {
return t = t.replace(/~E(\d+)E/g, function(t, e) {
var n = parseInt(e);
return String.fromCharCode(n);
});
}
function I(t) {
return t = t.replace(/^(\t|[ ]{1,4})/gm, "~0"), t = t.replace(/~0/g, "");
}
function D(t) {
if (!/\t/.test(t)) return t;
var e, n = [ " ", " ", " ", " " ], i = 0;
return t.replace(/[\n\t]/g, function(t, r) {
return "\n" === t ? (i = r + 1, t) : (e = (r - i) % 4, i = r + 1, n[e]);
});
}
function N(t) {
return t ? (t.length, t.replace(H, function(t, e) {
return "~D" == t ? "%24" : ":" == t ? ":" : "%" + t.charCodeAt(0).toString(16);
})) : "";
}
function M(t, e, n) {
var i = "([" + e.replace(/([\[\]\\])/g, "\\$1") + "])";
n && (i = "\\\\" + i);
var r = new RegExp(i, "g");
return t = t.replace(r, L);
}
function L(t, e) {
return "~E" + e.charCodeAt(0) + "E";
}
var A = {};
this.setOptions = function(t) {
A = t;
};
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 = e(n), n = t(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(t) {
return o(t);
}, $ = {
ol: "\\d+[.]",
ul: "[*+-]"
}, q = new RegExp('(="|<)?\\b(https?|ftp)(://[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]*[-A-Z0-9+&@#/%=~_|[\\])])(?=$|\\W)', "gi"), G = new RegExp("[-A-Z0-9+&@#/%=~_|[\\])]", "i"), H = /(?:["'*()[\]:]|~D)/g;
};
}(), define("libs/Markdown.Converter", function() {}), function() {
function t(t) {
return t.replace(/^\s+|\s+$/g, "");
}
function e(t) {
return t.replace(/\s+$/g, "");
}
function n(t) {
return t.replace(new RegExp("^(\\t|[ ]{1,4})", "gm"), "");
}
function i(t, e) {
return -1 != t.indexOf(e);
}
function r(t, e) {
return t.replace(/<[^>]*>?/gi, function(t) {
return t.match(e) ? t : "";
});
}
function o(t, e) {
for (var n = {}, i = 0; i < t.length; i++) n[t[i]] = t[i];
for (i = 0; i < e.length; i++) n[e[i]] = e[i];
var r = [];
for (var o in n) n.hasOwnProperty(o) && r.push(n[o]);
return r;
}
function a(t) {
return "\x02" != t.charAt(0) && (t = "\x02" + t), "\x03" != t.charAt(t.length - 1) && (t += "\x03"),
t;
}
function s(t) {
return "\x02" == t.charAt(0) && (t = t.substr(1)), "\x03" == t.charAt(t.length - 1) && (t = t.substr(0, t.length - 1)),
t;
}
function l(t, e) {
return r(c(t, e), m);
}
function c(t, e) {
var n = e.blockGamutHookCallback(t);
return n = p(n), n = n.replace(/~D/g, "$$").replace(/~T/g, "~"), n = e.previousPostConversion(n);
}
function u(t) {
return t.replace(/\\\|/g, "~I").replace(/\\:/g, "~i");
}
function d(t) {
return t.replace(/~I/g, "|").replace(/~i/g, ":");
}
function p(t) {
return t = t.replace(/~E(\d+)E/g, function(t, e) {
var n = parseInt(e);
return String.fromCharCode(n);
});
}
function h(t) {
return t.toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
}
function f(t, e) {
var n = e;
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(t) {
for (var e = 0; e < this.length; e++) if (this[e] == t) return e;
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(t, e) {
var n = new Markdown.Extra(), r = [], o = [], a = [], s = [ "unHashExtraBlocks" ];
return e = e || {}, e.extensions = e.extensions || [ "all" ], i(e.extensions, "all") && (e.extensions = [ "tables", "fenced_code_gfm", "def_list", "attr_list", "footnotes", "smartypants", "strikethrough", "newlines" ]),
o.push("wrapHeaders"), i(e.extensions, "attr_list") && (r.push("hashFcbAttributeBlocks"),
o.push("hashHeaderAttributeBlocks"), s.push("applyAttributeBlocks"), n.attributeBlocks = !0),
i(e.extensions, "fenced_code_gfm") && (o.push("fencedCodeBlocks"), r.push("fencedCodeBlocks")),
i(e.extensions, "tables") && o.push("tables"), i(e.extensions, "def_list") && o.push("definitionLists"),
i(e.extensions, "footnotes") && (r.push("stripFootnoteDefinitions"), o.push("doFootnotes"),
s.push("printFootnotes")), i(e.extensions, "smartypants") && s.push("runSmartyPants"),
i(e.extensions, "strikethrough") && a.push("strikethrough"), i(e.extensions, "newlines") && a.push("newlines"),
t.hooks.chain("postNormalization", function(t) {
return n.doTransform(r, t) + "\n";
}), t.hooks.chain("preBlockGamut", function(t, e) {
return n.blockGamutHookCallback = e, t = u(t), t = n.doTransform(o, t) + "\n", t = d(t);
}), t.hooks.chain("postSpanGamut", function(t) {
return n.doTransform(a, t);
}), n.previousPostConversion = t.hooks.postConversion, t.hooks.chain("postConversion", function(t) {
return t = n.doTransform(s, t), n.hashBlocks = [], n.footnotes = {}, n.usedFootnotes = [],
t;
}), "highlighter" in e && (n.googleCodePrettify = "prettify" === e.highlighter,
n.highlightJs = "highlight" === e.highlighter), "table_class" in e && (n.tableClass = e.table_class),
n.converter = t, n;
}, Markdown.Extra.prototype.doTransform = function(t, e) {
for (var n = 0; n < t.length; n++) e = this[t[n]](e);
return e;
}, Markdown.Extra.prototype.hashExtraBlock = function(t) {
return "\n
~X" + (this.hashBlocks.push(t) - 1) + "X
\n";
}, Markdown.Extra.prototype.hashExtraInline = function(t) {
return "~X" + (this.hashBlocks.push(t) - 1) + "X";
}, Markdown.Extra.prototype.unHashExtraBlocks = function(t) {
function e() {
var i = !1;
t = t.replace(/(?:
)?~X(\d+)X(?:<\/p>)?/g, function(t, e) {
i = !0;
var r = parseInt(e, 10);
return n.hashBlocks[r];
}), !0 === i && e();
}
var n = this;
return e(), t;
}, Markdown.Extra.prototype.wrapHeaders = function(t) {
function e(t) {
return "\n" + t + "\n";
}
return t = t.replace(/^.+[ \t]*\n=+[ \t]*\n+/gm, e), t = t.replace(/^.+[ \t]*\n-+[ \t]*\n+/gm, e),
t = t.replace(/^\#{1,6}[ \t]*.+?[ \t]*\#*\n+/gm, e);
};
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(t) {
function e(t, e, i) {
return "
~XX" + (n.hashBlocks.push(i) - 1) + "XX
\n" + e + "\n";
}
var n = this;
return t = t.replace(v, e), t = t.replace(b, e);
}, Markdown.Extra.prototype.hashFcbAttributeBlocks = function(t) {
function e(t, e, i) {
return "
~XX" + (n.hashBlocks.push(i) - 1) + "XX
\n" + e + "\n";
}
var n = this;
return t.replace(y, e);
}, Markdown.Extra.prototype.applyAttributeBlocks = function(t) {
var e = this, n = new RegExp('
~XX(\\d+)XX
[\\s]*(?:<(h[1-6]|pre)(?: +class="(\\S+)")?(>[\\s\\S]*?\\2>))', "gm");
return t = t.replace(n, function(t, n, i, r, a) {
if (!i) return "";
for (var s = parseInt(n, 10), l = e.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(e) {
function n(e, n, r, o, a, s) {
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 c = 0; c < alignspecs.length; c++) {
var u = alignspecs[c];
u.match(/^ *-+: *$/m) ? align[c] = ' align="right"' : u.match(/^ *:-+: *$/m) ? align[c] = ' align="center"' : u.match(/^ *:-+ *$/m) ? align[c] = ' align="left"' : align[c] = "";
}
var d = n.split(/ *[|] */), p = d.length, h = i.tableClass ? ' class="' + i.tableClass + '"' : "", f = [ "
\n", "\n", "
\n" ].join("");
for (c = 0; c < p; c++) {
var m = l(t(d[c]), i);
f += [ "
", m, "
\n" ].join("");
}
f += "
\n\n";
var g = o.split("\n");
for (c = 0; c < g.length; c++) if (!g[c].match(/^\s*$/)) {
for (var v = g[c].split(/ *[|] */), b = p - v.length, y = 0; y < b; y++) v.push("");
for (f += "
\n", y = 0; y < p; y++) {
var x = l(t(v[y]), i);
f += [ "
", x, "
\n" ].join("");
}
f += "
\n";
}
return f += "
\n", i.hashExtraBlock(f);
}
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 e = e.replace(r, n), e = e.replace(o, n);
}, Markdown.Extra.prototype.stripFootnoteDefinitions = function(t) {
var e = this;
return t = t.replace(/\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/g, function(t, n, i) {
return n = h(n), i += "\n", i = i.replace(/^[ ]{0,3}/g, ""), e.footnotes[n] = i,
"\n";
});
}, Markdown.Extra.prototype.doFootnotes = function(t) {
var e = this;
if (!0 === e.isConvertingFootnote) return t;
var n = 0;
return t = t.replace(/\[\^(.+?)\]/g, function(t, i) {
var r = h(i);
if (void 0 === e.footnotes[r]) return t;
n++, e.usedFootnotes.push(r);
var o = '' + n + "";
return e.hashExtraInline(o);
});
}, Markdown.Extra.prototype.printFootnotes = function(t) {
var e = this;
if (0 === e.usedFootnotes.length) return t;
t += '\n\n
\n\n\n\n';
for (var n = 0; n < e.usedFootnotes.length; n++) {
var i = e.usedFootnotes[n], r = e.footnotes[i];
e.isConvertingFootnote = !0;
var o = l(r, e);
delete e.isConvertingFootnote, t += '
";
}, Markdown.Extra.prototype.fencedCodeBlocks = function(e) {
function n(t) {
return t = t.replace(/&/g, "&"), t = t.replace(//g, ">"),
t = t.replace(/~D/g, "$$"), t = t.replace(/~T/g, "~");
}
var i = this;
return e = e.replace(/(?:^|\n)```([^`\n]*)\n([\s\S]*?)\n```[ \t]*(?=\n)/g, function(e, r, o) {
var a = t(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(t) {
var e = this, n = "", i = 0;
t.replace(/(?:)|(<)([a-zA-Z1-6]+)([^\n]*?>)([\s\S]*?)(<\/\2>)/g, function(r, o, a, s, l, c, u) {
var d = t.substring(i, u);
return n += e.applyPants(d), e.smartyPantsLastChar = n.substring(n.length - 1),
i = u + r.length, o ? (/code|kbd|pre|script|noscript|iframe|math|ins|del|pre/i.test(a) ? e.smartyPantsLastChar = l.substring(l.length - 1) : l = e.educatePants(l),
void (n += o + a + s + l + c)) : void (n += r);
});
var r = t.substring(i);
return n += e.applyPants(r), e.smartyPantsLastChar = n.substring(n.length - 1),
n;
}, Markdown.Extra.prototype.applyPants = function(t) {
return t = t.replace(/---/g, "—").replace(/--/g, "–"), t = t.replace(/\.\.\./g, "…").replace(/\.\s\.\s\./g, "…"),
t = t.replace(/``/g, "“").replace(/''/g, "”"), /^'$/.test(t) ? /\S/.test(this.smartyPantsLastChar) ? "’" : "‘" : /^"$/.test(t) ? /\S/.test(this.smartyPantsLastChar) ? "”" : "“" : (t = t.replace(/^'(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "’"),
t = t.replace(/^"(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "”"), t = t.replace(/"'(?=\w)/g, "“‘"),
t = t.replace(/'"(?=\w)/g, "‘“"), t = t.replace(/'(?=\d{2}s)/g, "’"),
t = t.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)'(?=\w)/g, "$1‘"),
t = t.replace(/([^\s\[\{\(\-])'/g, "$1’"), t = t.replace(/'(?=\s|s\b)/g, "’"),
t = t.replace(/'/g, "‘"), t = t.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)"(?=\w)/g, "$1“"),
t = t.replace(/([^\s\[\{\(\-])"/g, "$1”"), t = t.replace(/"(?=\s)/g, "”"),
t = t.replace(/"/gi, "“"));
}, Markdown.Extra.prototype.runSmartyPants = function(t) {
return this.smartyPantsLastChar = "", t = this.educatePants(t), t = t.replace(/(<([a-zA-Z1-6]+)\b([^\n>]*?)(\/)?>)/g, f);
}, Markdown.Extra.prototype.definitionLists = function(e) {
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 e = a(e), e = e.replace(n, function(e, n, r) {
var o = t(i.processDefListItems(r));
return o = "
\n" + o + "\n
", n + i.hashExtraBlock(o) + "\n\n";
}), s(e);
}, 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(e, n, i) {
for (var o = t(i).split("\n"), a = "", s = 0; s < o.length; s++) {
var c = o[s];
c = l(t(c), r), a += "\n
" + c + "
";
}
return a + "\n";
}), i = i.replace(u, function(t, 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 = e(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\tskipStartupTypeset: 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(t, e) {
var n = document.createElement("script");
n.type = "text/x-mathjax-config", n.innerHTML = _.template(e, {
tex: t.extensionSettings.mathJax ? t.extensionSettings.mathJax.tex : "undefined",
tex2jax: t.extensionSettings.mathJax ? t.extensionSettings.mathJax.tex2jax : void 0
}), document.getElementsByTagName("head")[0].appendChild(n);
}), define("extensions/mathJax", [ "utils", "classes/Extension", "text!html/mathJaxSettingsBlock.html", "mathjax" ], function(t, e, n) {
function i(t, e, n) {
var i = u.slice(t, e + 1).join("").replace(/&/g, "&").replace(//g, ">");
for (x.Browser.isMSIE && (i = i.replace(/(%[^\n]*)\n/g, "$1 \n")); e > t; ) u[e] = "",
e--;
u[t] = "@@" + m.length + "@@", n && (i = n(i)), m.push(i), d = p = h = null;
}
function r(t) {
d = p = h = null, m = [];
var e;
/`/.test(t) ? (t = t.replace(/~/g, "~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, function(t) {
return t.replace(/\$/g, "~D");
}), e = function(t) {
return t.replace(/~([TD])/g, function(t, e) {
return {
T: "~",
D: "$"
}[e];
});
}) : e = function(t) {
return t;
}, u = w(t.replace(/\r\n?/g, "\n"), S);
for (var n = 1, r = u.length; n < r; 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, e)), d = p = h = null, f = 0) : o === p ? f ? h = n : i(d, n, e) : o.match(/\n.*\n/) ? (h && (n = h,
i(d, n, e)), 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, e), e(u.join(""));
}
function o(t) {
return t = t.replace(/@@(\d+)@@/g, function(t, e) {
return m[e];
}), m = null, t;
}
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 e("mathJax", "MathJax", (!0));
l.settingsBlock = n, l.defaultConfig = {
tex: "{}",
tex2jax: '{ inlineMath: [["$","$"],["\\\\\\\\(","\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true }'
}, l.onLoadSettings = function() {
t.setInputValue("#input-mathjax-config-tex", l.config.tex), t.setInputValue("#input-mathjax-config-tex2jax", l.config.tex2jax);
}, l.onSaveSettings = function(e, n) {
e.tex = t.getInputJsValue("#input-mathjax-config-tex", n), e.tex2jax = t.getInputJsValue("#input-mathjax-config-tex2jax", n);
}, l.onPagedownConfigure = function(t) {
b = document.getElementById("preview-contents");
var e = t.getConverter();
e.hooks.chain("preConversion", r), e.hooks.chain("postConversion", o);
};
var c;
l.onAsyncPreview = function(t) {
c = t, 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(t, e) {
return t.split(e);
} : function(t, e) {
var n, i = [];
if (!e.global) {
n = e.toString();
var r = "";
n = n.replace(/^\/(.*)\/([im]*)$/, function(t, e, n) {
return r = n, e;
}), e = RegExp(n, r + "g");
}
for (var o = e.lastIndex = 0; n = e.exec(t); ) i.push(t.substring(o, n.index)),
i.push.apply(i, n.slice(1)), o = n.index + n[0].length;
return i.push(t.substring(o)), i;
}, function() {
var t = MathJax.Hub;
if (!t.Cancel) {
t.cancelTypeset = !1, t.Register.StartupHook("HTML-CSS Jax Config", function() {
var e = MathJax.OutputJax["HTML-CSS"], n = e.Translate;
e.Augment({
Translate: function(i, r) {
if (t.cancelTypeset || r.cancelled) throw Error("MathJax Canceled");
return n.call(e, i, r);
}
});
}), t.Register.StartupHook("SVG Jax Config", function() {
var e = MathJax.OutputJax.SVG, n = e.Translate;
e.Augment({
Translate: function(i, r) {
if (t.cancelTypeset || r.cancelled) throw Error("MathJax Canceled");
return n.call(e, i, r);
}
});
}), t.Register.StartupHook("TeX Jax Config", function() {
var e = MathJax.InputJax.TeX, n = e.Translate;
e.Augment({
Translate: function(i, r) {
if (t.cancelTypeset || r.cancelled) throw Error("MathJax Canceled");
return n.call(e, i, r);
}
});
});
var e = t.processError;
t.processError = function(n, i, r) {
return "MathJax Canceled" !== n.message ? e.call(t, n, i, r) : (MathJax.Message.Clear(0, 0),
i.jaxIDs = [], i.jax = {}, i.scripts = [], i.i = i.j = 0, i.cancelled = !0, null);
}, t.Cancel = function() {
this.cancelTypeset = !0;
};
}
}(), l;
}), define("text!html/partialRenderingSettingsBlock.html", [], function() {
return "
Renders modified sections only.
\n
\n\t
Note: Document sections are based on title elements (h1, h2...). Therefore if\n\tyour 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(t, e, n, i, r) {
function o() {
var e = [], n = "\n";
if (m = !1, t.each(g, function(t) {
var i = '\n\n\n' + t.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(t, e) {
return e ? (m = !0, n += t.replace(/^\s*\n/gm, "") + "\n", "") : t;
})), i = i.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm, function(t, e) {
return e ? (n += t.replace(/^\s*\n/gm, "") + "\n", "") : t;
}), e.push({
id: t.id,
text: i + "\n"
});
}), y = [], b = [], d = void 0, !0 === x || u != n) return x = !1, u = n, b = v,
v = e, void (y = e);
var i = v.length;
t.some(v, function(t, n) {
if (n >= e.length || t.text != e[n].text) return i = n, !0;
});
var r = -v.length;
t.some(v.slice().reverse(), function(t, n) {
if (n >= e.length || t.text != e[e.length - n - 1].text) return r = -n, !0;
}), i - r > v.length && (r = i - v.length);
var o = v.slice(0, i);
y = e.slice(i, e.length + r);
var a = v.slice(v.length + r, v.length);
d = t.first(a), b = v.slice(i, v.length + r), v = o.concat(y).concat(a);
}
function a(t) {
var e = t.id.substring(3), n = w[e];
n && S.removeChild(n), w[e] = t, S.appendChild(t);
}
function s() {
function n(n) {
for (var i = e("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 (!0 === o && "DIV" == r.tagName && l) break;
o = !0, "DIV" == r.tagName && "footnotes" == r.className ? t.each(r.querySelectorAll("ol > li"), a) : l || i.appendChild(r),
r = s;
}
return i;
}
t.each(b, function(t) {
var e = document.getElementById("wmd-preview-section-" + t.id);
h.removeChild(e);
});
var i = document.getElementById("wmd-preview"), r = i.firstChild, o = document.createDocumentFragment();
t.each(y, function(t) {
o.appendChild(n(t));
}), 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 (!0 === m) {
var c = e("ol");
t.each(h.querySelectorAll("a.footnote"), function(t, e) {
t.textContent = e + 1;
var n = t.id.substring(6);
l.push(n);
var i = w[n];
i && c.appendChild(i.cloneNode(!0));
}), l.length > 0 && p.appendChild(e("div", {
"class": "footnotes"
}, e("hr"), c)), Object.keys(w).forEach(function(t) {
-1 === l.indexOf(t) && (S.removeChild(w[t]), delete w[t]);
});
}
}
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(t) {
g = t;
}, l.onPagedownConfigure = function(e) {
c = e.getConverter(), c.hooks.chain("preConversion", function() {
o();
var e = t.map(y, function(t) {
return t.text;
});
return e.push(u + "\n\n"), e.join("");
}), e.hooks.chain("onPreviewRefresh", function() {
s();
});
}, l.onInit = function() {
n.enabled && t.some(n.config.extensions, function(t) {
return "footnotes" == t;
}) && (f = !0);
}, l.onReady = function() {
p = e("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(t, e, n, i, r, o) {
function a(t, e) {
function n(t, e) {
var n = o.substring(a, e);
u.push({
id: ++h,
text: n,
textWithFrontMatter: i + n
}), i = "";
}
if (t === p) {
var i = (p.frontMatter || {})._frontMatter || "", r = e.substring(i.length), o = r + "\n\n";
u = [];
var a = 0;
o.replace(d, function(t, e) {
n(a, e), a = e;
}), n(a, r.length), s.onSectionsCreated(u);
}
}
var s, l = new r("markdownSectionParser", "Markdown section parser");
l.onEventMgrCreated = function(t) {
s = t;
};
var c, u = [], d = "^.+[ \\t]*\\n=+[ \\t]*\\n+|^.+[ \\t]*\\n-+[ \\t]*\\n+|^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*\\n+";
l.onPagedownConfigure = function(r) {
e.enabled && t.some(e.config.extensions, function(t) {
return "fenced_code_gfm" == t;
}) && (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 t.reduce(u, function(t, e) {
return t + '\n\n\n' + e.text + "\n\n";
}, "");
}), r.hooks.chain("onPreviewRefresh", function() {
function t() {
for (var t = o("div", {
"class": "wmd-preview-section preview-content"
}), e = !1; n; ) {
var i = n.nextSibling, r = "se-preview-section-delimiter" == n.className;
if (!0 === e && "DIV" == n.tagName && r) break;
e = !0, r || t.appendChild(n), n = i;
}
return t;
}
var e = document.getElementById("wmd-preview"), n = e.firstChild, i = document.createDocumentFragment();
u.forEach(function(e) {
i.appendChild(t());
}), c.innerHTML = "", c.appendChild(e), c.appendChild(i);
}));
}, l.onReady = function() {
c = document.getElementById("preview-contents");
};
var p;
l.onFileSelected = function(t) {
p = t;
};
var h = 0;
return l.onFileOpen = a, l.onContentChanged = a, l;
}), define("text!html/buttonMarkdownSyntax.html", [], function() {
return '\n
\n\t
Markdown syntax
\n \n\t
\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
\n';
}), define("extensions/dialogAbout", [ "jquery", "underscore", "constants", "utils", "classes/Extension", "monetizejs", "text!html/dialogAbout.html" ], function(t, e, n, i, r, o, a) {
var s, l = new r("dialogAbout", 'Dialog "About"');
l.onEventMgrCreated = function(t) {
s = t;
};
var c = new o({
applicationID: "ESTHdCYOi18iLhhO"
});
return l.onReady = function() {
i.addModal("modal-about", e.template(a, {
version: n.VERSION
})), t(".modal-about .sponsorship-button").click(function() {
c.getPayments({
summary: !0
}, function() {
s.onMessage("Please refresh the page for your sponsorship to take effect.");
});
});
}, l;
}), define("text!html/dialogManagePublicationLocation.html", [], function() {
return '
Generates a table of contents when a [TOC] marker is found.
\n
\n\t
\n\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t
\n\t
\n\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t
\n\t
\n\t
\n \n
\n
\n \n
\n
\n
\n\t\n
';
}), define("extensions/toc", [ "jquery", "underscore", "utils", "classes/Extension", "text!html/buttonToc.html", "text!html/tocSettingsBlock.html" ], function(t, e, n, i, r, o) {
function a(t, e, n) {
this.tagName = t, this.anchor = e, this.text = n, this.children = [];
}
function s(t, n) {
function i() {
void 0 !== r && (r.children.length > 0 && (r.children = s(r.children, n + 1)), l.push(r));
}
n = n || 1;
var r, o = "H" + n, l = [];
return e.each(t, function(t) {
t.tagName != o ? n !== c.config.maxDepth && (void 0 === r && (r = new a()), r.children.push(t)) : (i(),
r = t);
}), i(), l;
}
function l() {
function t(t) {
for (var r = t.id || n.slugify(t.textContent) || "title", o = r, a = 0; e.has(i, o); ) o = r + "-" + ++a;
return i[o] = !0, t.id = o, o;
}
var i = {}, r = [];
return e.each(u.querySelectorAll("h1, h2, h3, h4, h5, h6"), function(e) {
r.push(new a(e.tagName, t(e), e.textContent));
}), r = s(r), '
\n
\n' + r.join("") + "
\n
\n";
}
var c = new i("toc", "Table of Contents", (!0));
c.settingsBlock = o, c.defaultConfig = {
marker: "\\[(TOC|toc)\\]",
maxDepth: 6,
button: !0
}, c.onLoadSettings = function() {
n.setInputValue("#input-toc-marker", c.config.marker), n.setInputValue("#input-toc-maxdepth", c.config.maxDepth),
n.setInputChecked("#input-toc-button", c.config.button);
}, c.onSaveSettings = function(t, e) {
t.marker = n.getInputRegExpValue("#input-toc-marker", e), t.maxDepth = n.getInputIntValue("#input-toc-maxdepth"),
t.button = n.getInputChecked("#input-toc-button");
}, c.onCreatePreviewButton = function() {
if (c.config.button) return r;
}, a.prototype.childrenToString = function() {
if (0 === this.children.length) return "";
var t = "
\n";
return e.each(this.children, function(e) {
t += e.toString();
}), t += "
\n";
}, a.prototype.toString = function() {
var t = "
Note: The mapping between Markdown and HTML is based on the\n\tposition of the title elements (h1, h2...) in the page. Therefore if\n\tyour document does not contain any title, the mapping will be linear and\n\tconsequently less accurate.
\n
";
}), define("extensions/scrollSync", [ "jquery", "underscore", "classes/Extension", "text!html/scrollSyncSettingsBlock.html" ], function(t, e, n, i) {
function r(t, n, i) {
var r, o = e.find(n, function(e, n) {
return r = n, t < e.endOffset;
});
if (void 0 !== o) {
var a = (t - o.startOffset) / (o.height || 1), s = i[r];
return s.startOffset + s.height * a;
}
}
function o(t, e, n, i, r) {
function o() {
var l = Date.now(), c = (l - s) / 200;
if (c < 1) {
var u = e + a * Math.cos((1 - c) * Math.PI / 2);
t.scrollTop = u, i(u), p = setTimeout(o, 1);
} else h = void 0, t.scrollTop = n, setTimeout(r, 100);
}
h && (clearTimeout(p), h()), h = r;
var a = n - e, s = Date.now();
o();
}
var a = new n("scrollSync", "Scroll Sync", (!0), (!0));
a.settingsBlock = i;
var s;
a.onSectionsCreated = function(t) {
s = t;
};
var l, c, u, d, p, h, f = [], m = [], g = e.debounce(function() {
f = [];
var t, n;
e.each(l.querySelectorAll(".wmd-input-section"), function(e) {
if (void 0 === t) return void (t = 0);
e = e.firstChild;
var n = e.offsetTop;
f.push({
startOffset: t,
endOffset: n,
height: n - t
}), t = n;
}), n = l.scrollHeight, f.push({
startOffset: t,
endOffset: n,
height: n - t
}), m = [];
var i;
e.each(c.querySelectorAll(".wmd-preview-section"), function(t) {
if (void 0 === i) return void (i = 0);
var e = t.offsetTop;
m.push({
startOffset: i,
endOffset: e,
height: e - i
}), i = e;
}), 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 = e.throttle(function() {
if (v && 0 !== f.length && f.length === m.length) {
var t = l.scrollTop;
t < 0 && (t = 0);
var n, i = c.scrollTop;
if (!0 === b) {
if (Math.abs(t - u) <= 9) return;
if (b = !1, u = t, n = r(t, f, m), n = e.min([ n, c.scrollHeight - c.offsetHeight ]),
Math.abs(n - i) <= 9) return void (d = i);
o(c, i, n, function(t) {
w = !0, d = t;
}, function() {
w = !1;
});
} else if (!0 === y) {
if (Math.abs(i - d) <= 9) return;
if (y = !1, d = i, n = r(i, m, f), n = e.min([ n, l.scrollHeight - l.offsetHeight ]),
Math.abs(n - t) <= 9) return void (u = t);
o(l, t, n, function(t) {
x = !0, u = t;
}, 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"),
t(c).scroll(function() {
!1 === w && !1 === C && (y = !0, b = !1, S()), C = !1;
}), t(l).scroll(function() {
!1 === x && (b = !0, y = !1, S());
}), t(".preview-panel").on("hide.layout.toggle", function() {
v = !1;
}).on("shown.layout.toggle", function() {
v = !0;
}), t(".extension-preview-buttons .table-of-contents").on("click", "a", function(e) {
e.preventDefault();
var n = this.hash, i = t(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(t) {
_ = document.getElementById("preview-contents"), t.getConverter().hooks.chain("postConversion", function(t) {
return k = _.offsetHeight, _.style.height = k + "px", t;
});
}, a.onPreviewFinished = function() {
_.style.removeProperty("height");
var t = _.offsetHeight;
b = !0, t < k && (C = !0), g();
}, a;
}), define("text!html/buttonSyncSettingsBlock.html", [], function() {
return '
Adds a "Synchronize documents" button in the navigation bar.
\n
\n\t
\n\t\t\n\t\t
\n\t\t\t ms\n\t\t
\n\t
\n\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t
\n\t
\n
';
}), define("extensions/buttonSync", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "text!html/buttonSyncSettingsBlock.html" ], function(t, e, 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(t, e) {
t.syncPeriod = i.getInputIntValue("#input-sync-period", e, 0), t.syncShortcut = i.getInputTextValue("#input-sync-shortcut", e);
};
var l;
s.onSynchronizerCreated = function(t) {
l = t;
};
var c, u = !1, d = !1, p = function() {
void 0 !== c && (!0 === u || !1 === l.hasSync() || 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 e = n("a", {
"class": "btn btn-success button-synchronize",
title: "Force synchronization Ctrl/Cmd+S"
}, n("i", {
"class": "icon-refresh"
}));
return c = t(e), c.click(function() {
c.hasClass("disabled") || l.sync() && (h = i.currentTime);
}), e;
}, s.onReady = p, s.onFileCreated = p, s.onFileDeleted = p, s.onSyncImportSuccess = p,
s.onSyncExportSuccess = p, s.onSyncRemoved = p, s.onSyncRunning = function(t) {
u = t, p();
}, s.onOfflineChanged = function(t) {
d = t, p();
}, s.onReady = function() {
o.bind(s.config.syncShortcut, function(t) {
l.sync() && (h = i.currentTime), t.preventDefault();
}), t(".action-force-synchronization").click(function() {
l.sync() && (h = i.currentTime);
});
}, s;
}), define("extensions/buttonPublish", [ "jquery", "underscore", "crel", "classes/Extension" ], function(t, e, n, i) {
function r() {
void 0 !== o && (!0 === c || !1 === u || !0 === d ? 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(t) {
s = t;
}, l.onCreateButton = function() {
var e = n("a", {
"class": "btn btn-success button-publish",
title: "Update document publication"
}, n("i", {
"class": "icon-upload"
}));
return o = t(e).click(function() {
o.hasClass("disabled") || s.publish();
}), e;
}, l.onPublishRunning = function(t) {
c = t, r();
}, l.onOfflineChanged = function(t) {
d = t, r();
};
var p = function() {
u = 0 !== e.size(a.publishLocations), r();
};
return l.onFileSelected = function(t) {
a = t, p();
}, l.onReady = function() {
t(".action-update-publication").click(s.publish);
}, l.onPublishRemoved = p, l.onNewPublishSuccess = p, l;
}), define("text!html/buttonStat.html", [], function() {
return '\n
\n\n';
}), define("extensions/comments", [ "jquery", "underscore", "utils", "storage", "crel", "rangy", "classes/Extension", "text!html/commentsPopoverContent.html", "bootstrap" ], function(t, e, n, i, r, o, a, s) {
function l(t, e, n) {
e = Math.round(e);
for (var i = e - 21; i < e + 22; ) S[i] && (e = i + 22), i++;
!n && (S[e] = 1);
var r = -8;
-1 !== t.className.indexOf(" icon-split") && (r = -12);
var o = e + r;
t.style.top = o + "px", t.style.right = "12px";
}
function c(e, n) {
this.commentElt = e, this.$commentElt = t(e).addClass("active"), this.fileDesc = n,
this.discussionIndex = e.discussionIndex;
}
function u(t) {
var e = _.getPopoverElt(), n = 0;
e.offsetWidth < x.offsetWidth - 10 && (n = x.offsetWidth - 10 - e.offsetWidth),
e.style.left = n + "px", e.querySelector(".arrow").style.left = x.offsetWidth - parseInt(t.style.right) - t.offsetWidth / 2 - n + "px";
var i = window.innerHeight - _.hr.getBoundingClientRect().top;
i < 0 && (e.style.top = parseInt(e.style.top) + i + "px");
}
function d() {
_ && _.$commentElt.popover("toggle").popover("destroy");
}
function p() {
var t = _.getDiscussion(), n = i["author.name"], r = [];
return t.commentList && (r = t.commentList.map(function(t) {
var i = t.author || "Anonymous";
return e.template(m, {
author: i,
content: t.content,
reply: t.author != n
});
})), "conflict" == t.type && r.unshift(e.template(m, {
author: "StackEdit",
content: "Conflicting changes have been detected.",
reply: !0
})), r.join("");
}
var h, f = new a("comments", "Comments", (!1), (!0)), m = [ "
\">", '
<%= author %>
', '
<%= content %>
', "
" ].join(""), g = [ '', ' ', ' ', " ", " \u201c<%- title %>\u201d", "" ].join("");
f.onEventMgrCreated = function(t) {
h = t;
};
var v, b;
f.onEditorCreated = function(t) {
v = t, b = v.selectionMgr;
};
var y, x, w, S = [], C = r("a", {
"class": "discussion icon-comment new"
});
c.prototype.getDiscussion = function() {
return this.discussionIndex ? this.fileDesc.discussionList[this.discussionIndex] : this.fileDesc.newDiscussion;
}, c.prototype.getPopoverElt = function() {
return document.querySelector(".comments-popover .popover:last-child");
};
var _, k, E, T, I, D, N = {}, M = [], L = !1, A = e.debounce(function() {
function t() {
var i;
if (0 === o.length) return e.filter(N, function(t, n) {
return !e.has(E.discussionList, n);
}).forEach(function(t) {
x.removeChild(t), delete N[t.discussionIndex];
}), l(C, w, !0), _ && !_.discussionIndex && (y.scrollTop += parseInt(C.style.top) - y.scrollTop - 3 * y.offsetHeight / 4,
u(C)), M = e.sortBy(N, function(t) {
return t.selectionEnd;
}), I.toggleClass("some", 0 !== M.length), I.toggleClass("replied", L), void D.toggleClass("icon-chat", 0 !== M.length);
var a = o.shift(), s = N[a.discussionIndex];
s || (s = r("a"));
var c = "discussion", d = !a.commentList || !n || e.last(a.commentList).author != n;
d && (L = !0), c += "conflict" == a.type ? " icon-split" : " icon-comment", c += d ? " replied" : " added",
s.className = c, s.discussionIndex = a.discussionIndex, s.selectionEnd = a.selectionEnd,
i = b.getCoordinates(a.selectionEnd), l(s, i.y), x.appendChild(s), N[a.discussionIndex] = s,
_ && _.getDiscussion() === a && (y.scrollTop += parseInt(s.style.top) - y.scrollTop - 3 * y.offsetHeight / 4,
u(s)), T = setTimeout(t, 5);
}
if (void 0 !== E) {
L = !1, M = [];
var n = i["author.name"];
S = [];
var o = e.sortBy(E.discussionList, function(t) {
return t.selectionEnd;
});
clearTimeout(T), T = setTimeout(t, 5);
}
}, 50);
return f.onLayoutResize = A, f.onFileOpen = function(t) {
E = t, A();
}, f.onContentChanged = function(t) {
E === t && A();
}, f.onCursorCoordinates = function(t, e) {
w = e, l(C, e, !0);
}, f.onCommentsChanged = function(t) {
if (E === t) {
if (void 0 !== _) {
var e = _;
e.discussionIndex && (e.getPopoverElt().querySelector(".discussion-comment-list").innerHTML = p());
try {
k.undoToRange(e.rangyRange);
} catch (t) {}
var n = e.getDiscussion();
e.selectionRange = b.createRange(n.selectionStart, n.selectionEnd), e.rangyRange = o.createRange(),
e.rangyRange.setStart(e.selectionRange.startContainer, e.selectionRange.startOffset),
e.rangyRange.setEnd(e.selectionRange.endContainer, e.selectionRange.endOffset),
setTimeout(function() {
_ === e && k.applyToRange(e.rangyRange);
}, 50);
}
A();
}
}, f.onEditorPopover = function() {
d();
}, f.onDiscussionCreated = function(t) {
E === t && A();
}, f.onDiscussionRemoved = function(t, e) {
E === t && (void 0 !== _ && _.discussionIndex == e.discussionIndex && d(), A());
}, f.onReady = function() {
k = o.createCssClassApplier("comment-highlight", {
normalize: !1
});
var a = "";
y = document.getElementById("wmd-input"), x = document.querySelector("#wmd-input > .editor-margin"),
x.appendChild(C);
var l = t(r("div", {
"class": "comments-popover"
}));
t(document.body).append(l).on("click", function(t) {
_ && _.$commentElt[0] !== t.target && d();
}).popover({
placement: "auto top",
container: ".comments-popover",
html: !0,
title: function() {
if (!_) return !0;
var t = _.getDiscussion(), n = t.selectionEnd - t.selectionStart, i = v.getValue().substr(t.selectionStart, n > 20 ? 20 : n);
return n > 20 && (i += "..."), e.template(g, {
title: i
});
},
content: function() {
return e.template(s, {
commentList: p()
});
},
selector: "#wmd-input > .editor-margin > .discussion"
}), t(x).on("show.bs.popover", function(t) {
h.onEditorPopover();
var e = new c(t.target, E);
_ = e;
var n = e.getDiscussion();
if (!n) {
var i = Math.min(b.selectionStart, b.selectionEnd), r = Math.max(b.selectionStart, b.selectionEnd);
if (i === r) {
var o = b.getClosestWordOffset(i);
i = o.start, r = o.end;
}
n = {
selectionStart: i,
selectionEnd: r,
commentList: []
}, E.newDiscussion = n;
}
e.selectionRange = b.createRange(n.selectionStart, n.selectionEnd), y.scrollTop += parseInt(t.target.style.top) - y.scrollTop - 3 * y.offsetHeight / 4;
}).on("shown.bs.popover", function(r) {
var s = _, l = s.getPopoverElt();
s.$authorInputElt = t(l.querySelector(".input-comment-author")).val(i["author.name"]),
s.$contentInputElt = t(l.querySelector(".input-comment-content")), s.hr = l.querySelector("hr"),
u(s.commentElt), l.querySelector(".scrollport").scrollTop = 9999999;
var c = t(l.querySelector(".action-add-comment"));
t().add(s.$contentInputElt).add(s.$authorInputElt).keydown(function(t) {
13 === t.which && (t.preventDefault(), c.click());
}), c.click(function(t) {
var i = n.getInputTextValue(s.$authorInputElt), r = n.getInputTextValue(s.$contentInputElt, t);
if (!t.isPropagationStopped()) {
var o = s.getDiscussion();
s.$contentInputElt.val(""), d(), o.commentList = o.commentList || [], o.commentList.push({
author: i,
content: r
});
var a = s.fileDesc.discussionList || {};
if (o.discussionIndex) s.fileDesc.discussionList = a, h.onCommentsChanged(s.fileDesc); else {
var l;
do l = n.id(); while (e.has(a, l));
o.discussionIndex = l, a[l] = o, s.fileDesc.discussionList = a, h.onDiscussionCreated(s.fileDesc, o);
}
y.focus();
}
});
var p = t(l.querySelector(".action-remove-discussion"));
r.target.discussionIndex ? p.click(function() {
d();
var t = s.getDiscussion();
delete s.fileDesc.discussionList[t.discussionIndex], s.fileDesc.discussionList = s.fileDesc.discussionList,
h.onDiscussionRemoved(s.fileDesc, t), y.focus();
}) : p.hide(), s.rangyRange = o.createRange(), s.rangyRange.setStart(s.selectionRange.startContainer, s.selectionRange.startOffset),
s.rangyRange.setEnd(s.selectionRange.endContainer, s.selectionRange.endOffset),
setTimeout(function() {
_ === s && k.applyToRange(s.rangyRange);
}, 50), s.$contentInputElt.focus().val(a);
}).on("hide.bs.popover", function() {
if (_) {
_.$commentElt.removeClass("active"), a = _.$contentInputElt.val(), i["author.name"] = _.$authorInputElt.val();
try {
k.undoToRange(_.rangyRange);
} catch (t) {}
_ = void 0, delete E.newDiscussion;
}
}), l.on("click", ".popover", function(t) {
t.stopPropagation();
});
var f = t(C);
I = t(".button-open-discussion").click(function(n) {
var i = f;
if (_) if (_.discussionIndex) {
var r = -1;
M.some(function(t, e) {
if (t === _.commentElt) return r = e, !0;
}), i = t(M[r + 1]);
} else i = t(e.first(M)); else b.selectionStart === b.selectionEnd && M.length && (i = t(e.first(M)));
0 === i.length ? (d(), v.focus(), v.adjustCursorPosition(!0)) : i.click(), n.stopPropagation();
}), D = I.find("i");
}, f;
}), define("text!html/findReplace.html", [], function() {
return '\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
\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\t
\n\t\t
\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
Synchronization
\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t"" is synchronized with the\n\t\t\t\t\tfollowing location(s):\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
Note: Removing a synchronized location will not delete any\n\t\t\t\t\tfile.
\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\t\t
\n\t
\n
\n\n\n
\n\t
\n\t\t
\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\tPublish on \n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t Host must be accessible publicly,\n\t\t\t\t\t\t\t\tunless you\'re hosting your own StackEdit instance.\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t File path is composed of both\n\t\t\t\t\t\t\t\tfolder and filename. \n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tJetpack plugin is required for\n\t\t\t\t\t\t\t\tself-hosted sites.\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t File path is composed of both\n\t\t\t\t\t\t\t\tfolder and filename. \n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t If no file ID is supplied, a new file\n\t\t\t\t\t\t\t\twill be created in your Google Drive root folder. You can move\n\t\t\t\t\t\t\t\tthe file afterwards within Google Drive.\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t If no file name is supplied, the\n\t\t\t\t\t\t\t\tdocument title will be used.\n\t\t\t\t\t\t
Tip: You can use a\n YAML front matter to specify the title of your page.
\n
Interpreted variables:title.
\n\t\t\t\t
\n\t\t\t\t
\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\t\t\t\t
\n\t\t\t
\n\t\t\t\n\t\t
\n\t
\n
\n\n\n
\n\t
\n\t\t
\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
Publication
\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t"" is published on the following\n\t\t\t\t\tlocation(s):\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
Note: Removing a publish location will not delete the actual publication.
\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\t\t
\n\t
\n
\n\n\n
\n\t
\n\t\t
\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
Sharing
\n\t\t\t
\n\t\t\t
\n
Collaborate on "" using the following link(s):
\n \t
No sharing link yet!\n \t
\n \n \t
\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 \t
\n \n
Share a read-only version of "" using the following link(s):
\n \t
No sharing link yet!\n \t
\n \n \t
\n
Note: To share a read-only version of this document, just publish it as a Gist in\n Markdown format.
\n \t
\n \t
\n \t\t
Tip: You can open any markdown URL within StackEdit Viewer using viewer#!url=.
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tPlease sign in first with Google. Once linked with your Google accounts, changing account is not possible unless you reset the application.\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n \n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t Existing authorization has to be revoked in\n\t\t\t\t\t\t\t\t\t\tGoogle Dashboard\n\t\t\t\t\t\t\t\t\t\tfor this change to take effect.\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t If unchecked, access will be restricted to folder\n\t\t\t\t\t\t\t\t\t\t/Applications/StackEdit for existing files.\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t Existing authorization has to be revoked in\n\t\t\t\t\t\t\t\t\t\tGitHub settings\n\t\t\t\t\t\t\t\t\t\tfor this change to take effect.\n\t\t\t\t\t\t\t\t\t
');
n.find("a").click(_), e.insertBefore(n[0], e.firstChild), j = j.add(n);
});
});
}, 3e3);
return c.addListener("onOfflineChanged", $), c.addListener("onReady", function() {
function n(t) {
if (t = t || "default", r != t) {
var e = "less!themes/" + t;
-1 !== window.baseDir.indexOf("-min") && (e = "css!themes/" + t), requirejs.undef(e),
require([ e ]), r = t;
}
}
t(document.body).on("shown.bs.modal", ".modal", function() {
var e = t(this);
setTimeout(function() {
e.find(".btn:first").focus(), e.find("button:first").focus(), e.find("input:enabled:visible:first").focus();
}, 50);
}).on("hidden.bs.modal", ".modal", function() {
i.focus(), n(window.theme);
}).on("keypress", ".modal", function(e) {
13 != e.which || t(e.target).is("textarea") || t(this).find(".modal-footer a:last").click();
}), t(".action-insert-link").click(function(e) {
var n = a.getInputTextValue(t("#input-insert-link"), e);
void 0 !== n && (T.insertLinkCallback(n), T.insertLinkCallback = void 0);
}), t(".action-insert-image").click(function(e) {
var n = a.getInputTextValue(t("#input-insert-image"), e);
void 0 !== n && (T.insertLinkCallback(n), T.insertLinkCallback = void 0);
}), t(".modal-insert-link, .modal-insert-image").on("hidden.bs.modal", function() {
void 0 !== T.insertLinkCallback && (T.insertLinkCallback(null), T.insertLinkCallback = void 0);
}), t(".action-load-settings").click(function() {
x();
}), t(".action-apply-settings").click(function(t) {
w(t), t.isPropagationStopped() || window.location.reload();
}), t(".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 = t("#input-settings-theme"), R.on("change", function() {
n(this.value);
}), t(".action-import-docs-settings").click(function() {
t("#input-file-import-docs-settings").click();
});
var u;
if (t("#input-file-import-docs-settings").change(function(n) {
var i = (n.dataTransfer || n.target).files;
t(".modal-settings").modal("hide"), e.each(i, function(t) {
var e = new FileReader();
e.onload = function(t) {
return function(e) {
try {
u = JSON.parse(e.target.result), parseInt(u.version.match(/^v(\d+)$/)[1], 10) > parseInt(s.version.match(/^v(\d+)$/)[1], 10) ? c.onError("Incompatible version. Please upgrade StackEdit.") : n(".modal-import-docs-settings").modal("show");
} catch (n) {
c.onError("Wrong format: " + t.name);
}
n("#input-file-import-docs-settings").val("");
};
}(t), e.readAsText(t);
});
}), t(".action-import-docs-settings-confirm").click(function() {
s.clear();
var t = /^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV4$|^version$/;
e.each(u, function(e, n) {
t.test(n) && (s[n] = e);
}), window.location.reload();
}), t(".action-export-docs-settings").click(function() {
a.saveAs(JSON.stringify(s), "StackEdit local storage.json");
}), t(".action-default-settings").click(function() {
s.removeItem("settings"), s.removeItem("theme"), l.dropboxFullAccess || s.removeItem("dropbox.lastChangeId"),
window.location.reload();
}), t(".action-app-reset").click(function() {
s.clear(), window.location.reload();
}), t(".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),
t("div.dropdown-menu").click(function(t) {
t.stopPropagation();
}), t(".modal-non-unique").modal({
backdrop: "static",
keyboard: !1,
show: !1
}), e.each(document.querySelectorAll("img"), function(e) {
var n = t(e), i = n.data("stackeditSrc");
i && n.attr("src", window.baseDir + "/img/" + i);
}), !1 === window.viewerMode) {
var d = e.reduce(o.THEME_LIST, function(t, e, n) {
return t + '";
}, "");
document.getElementById("input-settings-theme").innerHTML = d;
}
t(".modal-header").append(' Switch to StackEdit 5 now!'),
$();
}), 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\t> 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(t, e, n, i, r, o, a, s, l, c, u) {
var d = {};
return d.currentFile = void 0, d.selectFile = function(r) {
void 0 === (r = r || d.currentFile) && (r = 0 === e.size(l) ? d.createFile(n.WELCOME_DOCUMENT_TITLE, u) : e.max(l, function(t) {
return t.selectTime || 0;
})), d.currentFile !== r && (d.currentFile = r, r.selectTime = new Date().getTime(),
s.onFileSelected(r), t(".action-edit-document").toggleClass("hide", r.fileIndex != n.TEMPORARY_FILE_INDEX)),
i.initEditor(r);
}, d.createFile = function(t, i, u, d, p) {
if (i = void 0 !== i ? i : a.defaultContent, !t) {
t = n.DEFAULT_FILE_TITLE;
for (var h = 2, f = function(e) {
return e.title == t;
}; e.some(l, f); ) t = n.DEFAULT_FILE_TITLE + h++;
}
var m = n.TEMPORARY_FILE_INDEX;
if (!p) do m = "file." + r.id(); while (e.has(l, m));
d = d || {};
var g = e.reduce(d, function(t, e) {
return r.storeAttributes(e), t + e.syncIndex + ";";
}, ";");
o[m + ".title"] = t, o[m + ".content"] = i, o[m + ".sync"] = g, o[m + ".publish"] = ";";
var v = new c(m, t, d);
return u && (v.discussionListJSON = u), p || (r.appendIndexToArray("file.list", m),
l[m] = v, s.onFileCreated(v)), v;
}, d.deleteFile = function(t) {
t = t || d.currentFile, t.folder && (t.folder.removeFile(t), s.onFoldersChanged()),
r.removeIndexFromArray("file.list", t.fileIndex), delete l[t.fileIndex], d.currentFile === t && (d.currentFile = void 0,
d.selectFile()), s.onFileDeleted(t);
}, d.getFileFromSyncIndex = function(t) {
return e.find(l, function(n) {
return e.has(n.syncLocations, t);
});
}, d.getFileFromPublishIndex = function(t) {
return e.find(l, function(n) {
return e.has(n.publishLocations, t);
});
}, s.addListener("onReady", function() {
function e() {
if (a) {
o.addClass("hide"), r.removeClass("hide");
var e = t.trim(o.val()), n = d.currentFile;
e && e != n.title && (n.title = e, s.onTitleChanged(n)), o.val(n.title), i.focus(),
a = !1;
}
}
var i = t("#wmd-input");
d.selectFile();
var r = t(".file-title-navbar"), o = t(".input-file-title");
t(".action-create-file").click(function() {
setTimeout(function() {
var t = d.createFile();
d.selectFile(t), r.click();
}, 400);
}), t(".action-remove-file-confirm").click(function() {
t(".modal-remove-file-confirm").modal("show");
}), t(".action-remove-file").click(function() {
d.deleteFile();
});
var a;
r.click(function() {
if (!0 !== window.viewerMode) {
r.addClass("hide");
var t = o.removeClass("hide");
a = !0, setTimeout(function() {
t.focus().get(0).select();
}, 10);
}
}), o.blur(function() {
setTimeout(function() {
e();
}, 0);
}).keypress(function(t) {
13 == t.keyCode && (e(), t.preventDefault()), 27 == t.keyCode && (o.val(""), e());
}), t(".action-open-stackedit").click(function() {
window.location.href = "editor";
}), t(".action-edit-document").click(function() {
var t = i.val(), e = d.currentFile.title, n = d.createFile(e, t);
d.selectFile(n), window.location.href = "editor";
}), t(".action-welcome-file").click(function() {
var t = d.createFile(n.WELCOME_DOCUMENT_TITLE, u);
d.selectFile(t);
});
}), s.onFileMgrCreated(d), d;
}), define("classes/Provider", [ "underscore", "utils", "settings", "eventMgr", "fileMgr", "editor", "diff_match_patch_uncompressed", "jsondiffpatch" ], function(t, e, n, i, r, o, a, s) {
function l(t, e) {
this.providerId = t, this.providerName = e, this.isPublishEnabled = !0;
}
l.prototype.parseDiscussionList = function(t) {
try {
var e = JSON.parse(t);
return n.each(e, function(t, e) {
if (t.discussionIndex != e || !n.isNumber(t.selectionStart) || !n.isNumber(t.selectionEnd)) throw "invalid";
t.commentList && t.commentList.forEach(function(t) {
if (t.author && !n.isString(t.author) || !n.isString(t.content)) throw "invalid";
});
}), e;
} catch (n) {}
}, l.prototype.serializeContent = function(t, e) {
return e.length > 2 ? t + "" : t;
}, l.prototype.parseContent = function(t) {
var e, n = "{}", i = /$/.exec(t);
return i && (e = this.parseDiscussionList(i[1])) && (t = t.substring(0, i.index),
n = i[1]), {
content: t,
discussionList: e || {},
discussionListJSON: n
};
};
var c = new a();
c.Match_Threshold = 0, c.Patch_DeleteThreshold = 0;
var u = s.create({
objectHash: function(t) {
return JSON.stringify(t);
},
textDiff: {
minLength: 9999999
}
}), d = "merge" == n.conflictMode;
return l.prototype.syncMerge = function(n, a, s, l, p, h) {
var f = n.content, m = n.title, g = n.discussionListJSON, v = n.discussionList, b = e.crc32(f), y = e.crc32(m), x = e.crc32(g), w = e.crc32(s), S = e.crc32(l), C = e.crc32(h), _ = a.contentCRC != b, k = a.contentCRC != w, E = f != s && k, T = E && _;
a.titleCRC = a.titleCRC || y;
var I, D, N = a.titleCRC != y, M = a.titleCRC != S, L = m != l && M, A = L && N, R = a.discussionListCRC != x, P = a.discussionListCRC != C, O = g != h && P, F = O && R, B = [], j = s, $ = l, q = p, G = !1, H = !1, U = !1;
if (!d && (T || A || F) || T && void 0 === a.content || A && void 0 === a.title || F && void 0 === a.discussionList) r.createFile(m + " (backup)", f, g),
i.onMessage('Conflict detected on "' + m + '". A backup has been created locally.'); else {
if (T) {
var z = a.content;
I = c.diff_main(z, f), c.diff_cleanupSemantic(I), D = c.patch_make(z, I);
var V = c.patch_apply(D, s);
if (j = V[0], !V[1].every(t.identity)) {
I = c.diff_main(f, j), I = function(t) {
function e() {
(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, "" ];
return t.forEach(function(o, a) {
function s() {
return 0 === a || a === t.length - 1;
}
var l = o[0], c = o[1];
if (0 === l) if (s() || c.length > 20) {
if (i[1] || r[1]) {
var u = /\s/.exec(c);
if (u) {
var d = u.index, p = c.substring(0, d);
c = c.substring(d), i[1] += p, r[1] += p;
}
}
if (c) {
for (var h = c.length; h && /\S/.test(c[h - 1]); ) h--;
var f = c.substring(h);
c = c.substring(0, h), s() || c.length > 20 ? (e(), n.push([ 0, c ])) : (i[1] += c,
r[1] += c), i[1] += f, r[1] += f;
}
} else i[1] += c, r[1] += c; else -1 === l ? i[1] += c : 1 === l && (r[1] += c);
}), i[1] == r[1] ? n.push([ 0, r[1] ]) : e(), n;
}(I), j = "";
var W;
I.forEach(function(t) {
var e = t[0], n = t[1];
0 === e || W ? 0 === e && W && (W.selectionEnd = j.length, B.push(W), W = void 0) : W = {
selectionStart: j.length,
type: "conflict"
}, j += n;
}), W && (W.selectionEnd = j.length, B.push(W));
}
}
E && (R && (G = !0), P ? H = !0 : (G = !0, q = v)), F && (U = !0), A && (D = c.patch_make(a.title, m),
$ = c.patch_apply(D, l)[0]);
}
var X;
if (E) {
var Q = [];
r.currentFile === n && (X = {
selectionStart: o.selectionMgr.selectionStart,
selectionEnd: o.selectionMgr.selectionEnd
}, Q.push(X), n.newDiscussion && Q.push(n.newDiscussion)), G && (Q = Q.concat(t.values(v))),
O |= o.adjustCommentOffsets(f, j, Q);
}
if (H) {
var Y = t.values(p);
o.adjustCommentOffsets(s, j, Y);
}
if (U) {
var K = JSON.parse(a.discussionList);
I = u.diff(K, v), u.patch(p, I), t.each(p, function(t, e) {
t || delete p[e];
});
}
return B.length && (O = !0, B.forEach(function(n) {
var i;
do i = e.id(); while (t.has(q, i));
n.discussionIndex = i, q[i] = n;
})), L && (n.title = $, i.onTitleChanged(n), i.onMessage('"' + m + '" has been renamed to "' + $ + '" on ' + this.providerName + ".")),
(E || O) && o.watcher.noWatch(t.bind(function() {
if (E && (r.currentFile === n && (o.setValueNoWatch(j), X && o.selectionMgr.setSelectionStartEnd(X.selectionStart, X.selectionEnd)),
n.content = j, i.onContentChanged(n, j)), O) {
n.discussionList = q;
var e = u.diff(v, q), a = !1;
t.each(e, function(e, r) {
t.isArray(e) ? 1 === e.length ? i.onDiscussionCreated(n, q[r]) : i.onDiscussionRemoved(n, v[r]) : a = !0;
}), a && i.onCommentsChanged(n);
}
o.undoMgr.currentMode = "sync", o.undoMgr.saveState(), i.onMessage('"' + l + '" has been updated from ' + this.providerName + "."),
B.length && i.onMessage('"' + l + '" has conflicts that you have to review.');
}, this)), {
contentCRC: w,
titleCRC: S,
discussionListCRC: C
};
}, l;
}), define("classes/AsyncTask", [ "underscore", "constants", "utils", "eventMgr" ], function(t, e, n, i) {
function r(t) {
this.finished = !1, this.timeout = e.ASYNC_TASK_DEFAULT_TIMEOUT, this.retryCounter = 0,
this.runCallbacks = [], this.successCallbacks = [], this.errorCallbacks = [], this.force = t;
}
function o() {
if (!0 === c) 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 && !1 === p) return;
u = s.shift(), l = n.currentTime, !1 === d && (d = !0, i.onAsyncRunning(!0));
}
l <= n.currentTime && (c = !0, u.chain());
}
function a(e, n, r) {
try {
t.each(n, function(t) {
t(r);
});
} finally {
e.finished = !0, u === e && (u = void 0, c = !1), 0 === s.length ? (d = !1, i.onAsyncRunning(!1)) : o();
}
}
var s = [];
r.prototype.onRun = function(t) {
this.runCallbacks.push(t);
}, r.prototype.onSuccess = function(t) {
this.successCallbacks.push(t);
}, r.prototype.onError = function(t) {
this.errorCallbacks.push(t);
};
var l = 0;
r.prototype.chain = function(t) {
if (l = n.currentTime, n.logStackTrace(), !0 !== this.finished) {
if (void 0 === this.queue && (this.queue = this.runCallbacks.slice()), void 0 !== t) return void t();
if (0 === this.queue.length) return void a(this, this.successCallbacks);
this.queue.shift()();
}
}, r.prototype.error = function(t) {
if (n.logStackTrace(), !0 !== this.finished) throw t = t || new Error("Unknown error"),
t.message && i.onError(t), a(this, this.errorCallbacks, t), t;
};
var c = !1;
r.prototype.retry = function(t, e) {
if (!0 !== this.finished) {
if (e = e || 5, this.queue = void 0, this.retryCounter >= e) return void this.error(t);
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(t, e, n, i, r, o, a, s, l, c) {
function u(e) {
e.onRun(function() {
return !0 === v ? (f = void 0, e.error(new Error("Operation not available in offline mode.|stopPublish"))) : void 0 !== f ? e.chain() : void t.ajax({
url: "libs/dropbox.min.js",
dataType: "script",
timeout: n.AJAX_TIMEOUT
}).done(function() {
f = new Dropbox.Client({
key: !0 === s.dropboxFullAccess ? n.DROPBOX_APP_KEY : n.DROPBOX_RESTRICTED_APP_KEY,
secret: !0 === s.dropboxFullAccess ? 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
})), e.chain();
}).fail(function(t) {
p({
status: t.status,
responseText: t.statusText
}, e);
});
});
}
function d(t) {
t.onRun(function() {
function e() {
r.redirectConfirm("You are being redirected to Dropbox authorization page.", function() {
t.chain(i);
}, function() {
t.error(new Error("Operation canceled."));
});
}
function i() {
!1 === o ? t.timeout = n.ASYNC_TASK_LONG_TIMEOUT : f.reset(), f.authenticate({
interactive: !o
}, function(n, i) {
return !0 === i.isAuthenticated() ? (m = !0, t.chain()) : !0 === o ? (o = !1, t.chain(e)) : void t.error(new Error("Access to Dropbox account is not authorized."));
});
}
if (!0 === m) return t.chain();
var o = !0;
t.chain(i);
});
}
function p(t, n) {
var r = !0;
if (t) if (a.error(t), "string" == typeof t) r = t; else {
if (r = "Dropbox error (" + t.status + ": " + t.responseText + ").", 401 === t.status || 403 === t.status) return m = !1,
r = "Access to Dropbox account is not authorized.", n.retry(new Error(r), 1);
if (400 === t.status && -1 !== t.responseText.indexOf("oauth_nonce")) return e.each(e.keys(o), function(t) {
0 === t.indexOf("dropbox-auth") && o.removeItem(t);
}), m = !1, n.retry(new Error(r), 1);
t.status <= 0 && (f = void 0, m = !1, i.setOffline(), r = "|stopPublish");
}
n.error(new Error(r));
}
function h(e) {
e.onRun(function() {
function i() {
r.redirectConfirm("You are being redirected to Dropbox Chooser page.", function() {
e.chain();
}, function() {
e.error(new Error("Operation canceled."));
});
}
return !0 === b ? e.chain() : void t.ajax({
url: "https://www.dropbox.com/static/api/1/dropbox.js",
dataType: "script",
timeout: n.AJAX_TIMEOUT
}).done(function() {
b = !0, e.chain(i);
}).fail(function(t) {
p({
status: t.status,
responseText: t.statusText
}, e);
});
});
}
var f, m = !1, g = {}, v = !1;
l.addListener("onOfflineChanged", function(t) {
v = t;
}), g.upload = function(t, e, n) {
var i, r = new c();
u(r), d(r), r.onRun(function() {
f.writeFile(t, e, function(e, n) {
return e ? (400 === e.status && (e = 'Could not upload document into path "' + t + '".'),
void p(e, r)) : (i = n, r.chain());
});
}), r.onSuccess(function() {
n(void 0, i);
}), r.onError(function(t) {
n(t);
}), r.enqueue();
}, g.checkChanges = function(t, e) {
var n = [], i = t || 0, r = new c();
u(r), d(r), r.onRun(function() {
function t() {
f.pullChanges(i, function(e, o) {
return e ? p(e, r) : (i = o.cursor(), void 0 !== o.changes && (n = n.concat(o.changes)),
o.shouldPullAgain ? r.chain(t) : r.chain(), void 0);
});
}
r.chain(t);
}), r.onSuccess(function() {
e(void 0, n, i);
}), r.onError(function(t) {
e(t);
}), r.enqueue();
}, g.downloadMetadata = function(t, e) {
var n = [], i = new c();
u(i), d(i), i.onRun(function() {
function e() {
if (0 === t.length) return i.chain();
var r = t[0];
f.stat(r, function(r, o) {
return o ? (n.push(o), t.shift(), i.chain(e)) : void p(r, i);
});
}
i.chain(e);
}), i.onSuccess(function() {
e(void 0, n);
}), i.onError(function(t) {
e(t);
}), i.enqueue();
}, g.downloadContent = function(t, n) {
var i = [], r = new c();
u(r), d(r), r.onRun(function() {
function n() {
if (0 === t.length) return r.chain();
var o = t[0];
i.push(o);
var a;
return !0 === o.isFile ? a = o : void 0 !== o.wasRemoved && (a = o.stat), a ? void f.readFile(a.path, function(i, o) {
return e.isString(o) ? (a.content = o, t.shift(), r.chain(n)) : void p(i, r);
}) : (t.shift(), r.chain(n));
}
r.chain(n);
}), r.onSuccess(function() {
n(void 0, i);
}), r.onError(function(t) {
n(t);
}), r.enqueue();
};
var b = !1;
return g.picker = function(t) {
var e = [], i = new c();
i.timeout = n.ASYNC_TASK_LONG_TIMEOUT, u(i), h(i), i.onRun(function() {
var t = {};
t.multiselect = !0, t.linkType = "direct", t.success = function(t) {
for (var n = 0; n < t.length; n++) {
var r = t[n].link;
r = r.replace(/.*\/view\/[^\/]*/, ""), e.push(decodeURI(r));
}
i.chain();
}, t.cancel = function() {
i.chain();
}, Dropbox.choose(t);
}), i.onSuccess(function() {
t(void 0, e);
}), i.onError(function(e) {
t(e);
}), i.enqueue();
}, g;
}), define("providers/dropboxProvider", [ "underscore", "utils", "storage", "settings", "classes/Provider", "eventMgr", "fileMgr", "helpers/dropboxHelper" ], function(t, e, n, i, r, o, a, s) {
function l(t) {
if (void 0 !== t) return t.match(/^[^\\<>:"\|?\*]+$/) ? 0 !== t.indexOf("/") ? "/" + t : t : void o.onError('"' + t + '" contains invalid characters.');
}
function c(t) {
return "sync." + p + "." + encodeURIComponent(t.toLowerCase());
}
function u(t, n, i, r) {
r = r || "{}";
var o = {};
return o.provider = h, o.path = t, o.version = n, o.contentCRC = e.crc32(i), o.discussionListCRC = e.crc32(r),
o.syncIndex = c(t), !0 === f && (o.content = i, o.discussionList = r), o;
}
function d(e) {
s.downloadMetadata(e, function(e, n) {
e || s.downloadContent(n, function(e, n) {
if (!e) {
var i = [];
t.each(n, function(t) {
var e = h.parseContent(t.content), n = u(t.path, t.versionTag, e.content, e.discussionListJSON), r = {};
r[n.syncIndex] = n;
var o = a.createFile(t.name, e.content, e.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(t) {
var e = t.path.split("/").map(encodeURIComponent), n = e.pop();
return [ "https://www.dropbox.com/home", e.join("/"), "?select=", n ].join("");
};
var f = "merge" == i.conflictMode;
return h.importFiles = function() {
s.picker(function(e, n) {
if (!e && 0 !== n.length) {
var i = [];
t.each(n, function(t) {
var e = c(t), n = a.getFileFromSyncIndex(e);
return void 0 !== n ? o.onError('"' + n.title + '" is already in your local documents.') : void i.push(t);
}), d(i);
}
});
}, h.exportFile = function(t, n, i, r, d, p) {
var f = e.getInputTextValue("#input-sync-export-dropbox-path", t);
if (void 0 === (f = l(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(t, e) {
if (t) return p(t);
var n = u(e.path, e.versionTag, i, r);
p(void 0, n);
});
}, h.syncUp = function(t, e, n, i, r, o, a, l, c) {
if (l.contentCRC == e && l.discussionListCRC == o) return c(void 0, !1);
var u = h.serializeContent(t, r);
s.upload(l.path, u, function(n, a) {
return n ? c(n, !0) : (l.version = a.versionTag, !0 === f && (l.content = t, l.discussionList = r),
l.contentCRC = e, l.titleCRC = i, l.discussionListCRC = o, c(void 0, !0), void 0);
});
}, h.syncDown = function(i) {
var r = n[p + ".lastChangeId"];
s.checkChanges(r, function(r, l, u) {
if (r) return i(r);
var d = [];
t.each(l, function(t) {
var e = c(t.path), n = a.getFileFromSyncIndex(e), i = n && n.syncLocations[e];
if (i) {
if (t.fileDesc = n, t.syncAttributes = i, !0 === t.wasRemoved) return void d.push(t);
i.version != t.stat.versionTag && d.push(t);
}
}), s.downloadContent(d, function(t, r) {
function a() {
if (0 === r.length) return n[p + ".lastChangeId"] = u, i();
var t = r.pop(), s = t.fileDesc, l = t.syncAttributes;
if (!0 === t.wasRemoved) return o.onError('"' + s.title + '" has been removed from Dropbox.'),
s.removeSyncLocation(l), o.onSyncRemoved(s, l);
var c = t.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, !0 === f && (l.content = m, l.discussionList = v), l.contentCRC = b.contentCRC,
l.discussionListCRC = b.discussionListCRC, e.storeAttributes(l), setTimeout(a, 5);
}
return t ? void i(t) : void setTimeout(a, 5);
});
});
}, h.publish = function(t, e, n, i, r) {
var o = l(t.path);
return void 0 === o ? r(!0) : void s.upload(o, i, r);
}, h.newPublishAttributes = function(t) {
var n = {};
if (n.path = e.getInputTextValue("#input-publish-dropbox-path", t), !t.isPropagationStopped()) return n;
}, h;
}), function(t, e) {
"use strict";
var n, i = t.document;
n = function() {
var e, n, r, o, a, s, l, c, u, d, p, h, f, m = {}, g = {}, v = !1, b = {
ENTER: 13,
ESC: 27,
SPACE: 32
}, y = [];
return g = {
buttons: {
holder: '',
submit: '',
ok: '',
cancel: ''
},
input: '',
message: '
{{message}}
',
log: '{{message}}'
}, f = function() {
var t, e, n = !1, r = i.createElement("fakeelement"), o = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "otransitionend",
transition: "transitionend"
};
for (t in o) if (void 0 !== r.style[t]) {
e = o[t], n = !0;
break;
}
return {
type: e,
supported: n
};
}, e = function(t) {
return i.getElementById(t);
}, m = {
labels: {
ok: "OK",
cancel: "Cancel"
},
delay: 5e3,
buttonReverse: !1,
buttonFocus: "ok",
transition: void 0,
addListeners: function(t) {
var e, s, l, c, u, d = void 0 !== r, p = void 0 !== n, f = void 0 !== h, m = "", g = this;
e = function(e) {
return void 0 !== e.preventDefault && e.preventDefault(), l(e), void 0 !== h && (m = h.value),
"function" == typeof t && (void 0 !== h ? t(!0, m) : t(!0)), !1;
}, s = function(e) {
return void 0 !== e.preventDefault && e.preventDefault(), l(e), "function" == typeof t && t(!1),
!1;
}, l = function(t) {
g.hide(), g.unbind(i.body, "keyup", c), g.unbind(o, "focus", u), d && g.unbind(r, "click", e),
p && g.unbind(n, "click", s);
}, c = function(t) {
var n = t.keyCode;
(n === b.SPACE && !f || f && n === b.ENTER) && e(t), n === b.ESC && p && s(t);
}, u = function(t) {
f ? h.focus() : !p || g.buttonReverse ? r.focus() : n.focus();
}, this.bind(o, "focus", u), this.bind(a, "focus", u), d && this.bind(r, "click", e),
p && this.bind(n, "click", s), this.bind(i.body, "keyup", c), this.transition.supported || this.setFocus();
},
bind: function(t, e, n) {
"function" == typeof t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent && t.attachEvent("on" + e, n);
},
handleErrors: function() {
if (void 0 !== t.onerror) {
var e = this;
return t.onerror = function(t, n, i) {
e.error("[" + t + " on line " + i + " of " + n + "]", 0);
}, !0;
}
return !1;
},
appendButtons: function(t, e) {
return this.buttonReverse ? e + t : t + e;
},
build: function(t) {
var e = "", n = t.type, i = t.message, r = t.cssClass || "";
switch (e += '
', e += 'Reset Focus',
"none" === m.buttonFocus && (e += ''),
"prompt" === n && (e += '
'), e += '',
e += g.message.replace("{{message}}", i), "prompt" === n && (e += g.input), e += g.buttons.holder,
e += "", "prompt" === n && (e += "