· 6 years ago · Apr 09, 2019, 10:10 AM
1!function() {
2 function b(b) {
3 this.tokens = [],
4 this.tokens.links = {},
5 this.options = b || k.defaults,
6 this.rules = a.normal,
7 this.options.gfm && (this.rules = this.options.tables ? a.tables : a.gfm)
8 }
9 function d(a, b) {
10 if (this.options = b || k.defaults,
11 this.links = a,
12 this.rules = c.normal,
13 this.renderer = this.options.renderer || new e,
14 !this.links)
15 throw new Error("Tokens array requires a `links` property.");
16 this.options.gfm ? this.rules = this.options.breaks ? c.breaks : c.gfm : this.options.pedantic && (this.rules = c.pedantic)
17 }
18 function e() {}
19 function f(a) {
20 this.tokens = [],
21 this.token = null,
22 this.options = a || k.defaults,
23 this.options.renderer = this.options.renderer || new e,
24 this.renderer = this.options.renderer
25 }
26 function g(a, b) {
27 return a.replace(b ? /&/g : /&(?!#?\w+;)/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'")
28 }
29 function h(a, b) {
30 return a = a.source,
31 b = b || "",
32 function c(d, e) {
33 return d ? (e = e.source || e,
34 e = e.replace(/(^|[^\[])\^/g, "$1"),
35 a = a.replace(d, e),
36 c) : new RegExp(a,b)
37 }
38 }
39 function i() {}
40 function j(a) {
41 for (var c, d, b = 1; b < arguments.length; b++) {
42 c = arguments[b];
43 for (d in c)
44 Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
45 }
46 return a
47 }
48 function k(a, c, d) {
49 if (d || "function" == typeof c) {
50 d || (d = c,
51 c = null),
52 c = j({}, k.defaults, c || {});
53 var h, i, e = c.highlight, l = 0;
54 try {
55 h = b.lex(a, c)
56 } catch (m) {
57 return d(m)
58 }
59 i = h.length;
60 var n = function() {
61 var a, b;
62 try {
63 a = f.parse(h, c)
64 } catch (g) {
65 b = g
66 }
67 return c.highlight = e,
68 b ? d(b) : d(null, a)
69 };
70 if (!e || e.length < 3)
71 return n();
72 if (delete c.highlight,
73 !i)
74 return n();
75 for (; l < h.length; l++)
76 !function(a) {
77 return "code" !== a.type ? --i || n() : e(a.text, a.lang, function(b, c) {
78 return null == c || c === a.text ? --i || n() : (a.text = c,
79 a.escaped = !0,
80 --i || n(),
81 void 0)
82 })
83 }(h[l])
84 } else
85 try {
86 return c && (c = j({}, k.defaults, c)),
87 f.parse(b.lex(a, c), c)
88 } catch (m) {
89 if (m.message += "\nPlease report this to https://github.com/chjj/marked.",
90 (c || k.defaults).silent)
91 return "<p>An error occured:</p><pre>" + g(m.message + "", !0) + "</pre>";
92 throw m
93 }
94 }
95 var a = {
96 newline: /^\n+/,
97 code: /^( {4}[^\n]+\n*)+/,
98 fences: i,
99 hr: /^( *[-*_]){3,} *(?:\n+|$)/,
100 heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
101 nptable: i,
102 lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
103 blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/,
104 list: /^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
105 html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,
106 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
107 table: i,
108 paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
109 text: /^[^\n]+/
110 };
111 a.bullet = /(?:[*+-]|\d+\.)/,
112 a.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,
113 a.item = h(a.item, "gm")(/bull/g, a.bullet)(),
114 a.list = h(a.list)(/bull/g, a.bullet)("hr", /\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),
115 a._tag = "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b",
116 a.html = h(a.html)("comment", /<!--[\s\S]*?-->/)("closed", /<(tag)[\s\S]+?<\/\1>/)("closing", /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g, a._tag)(),
117 a.paragraph = h(a.paragraph)("hr", a.hr)("heading", a.heading)("lheading", a.lheading)("blockquote", a.blockquote)("tag", "<" + a._tag)("def", a.def)(),
118 a.normal = j({}, a),
119 a.gfm = j({}, a.normal, {
120 fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
121 paragraph: /^/
122 }),
123 a.gfm.paragraph = h(a.paragraph)("(?!", "(?!" + a.gfm.fences.source.replace("\\1", "\\2") + "|" + a.list.source.replace("\\1", "\\3") + "|")(),
124 a.tables = j({}, a.gfm, {
125 nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
126 table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
127 }),
128 b.rules = a,
129 b.lex = function(a, c) {
130 var d = new b(c);
131 return d.lex(a)
132 }
133 ,
134 b.prototype.lex = function(a) {
135 return a = a.replace(/\r\n|\r/g, "\n").replace(/\t/g, " ").replace(/\u00a0/g, " ").replace(/\u2424/g, "\n"),
136 this.token(a, !0)
137 }
138 ,
139 b.prototype.token = function(b, c) {
140 for (var d, e, f, g, h, i, j, k, l, b = b.replace(/^ +$/gm, ""); b; )
141 if ((f = this.rules.newline.exec(b)) && (b = b.substring(f[0].length),
142 f[0].length > 1 && this.tokens.push({
143 type: "space"
144 })),
145 f = this.rules.code.exec(b))
146 b = b.substring(f[0].length),
147 f = f[0].replace(/^ {4}/gm, ""),
148 this.tokens.push({
149 type: "code",
150 text: this.options.pedantic ? f : f.replace(/\n+$/, "")
151 });
152 else if (f = this.rules.fences.exec(b))
153 b = b.substring(f[0].length),
154 this.tokens.push({
155 type: "code",
156 lang: f[2],
157 text: f[3]
158 });
159 else if (f = this.rules.heading.exec(b))
160 b = b.substring(f[0].length),
161 this.tokens.push({
162 type: "heading",
163 depth: f[1].length,
164 text: f[2]
165 });
166 else if (c && (f = this.rules.nptable.exec(b))) {
167 for (b = b.substring(f[0].length),
168 i = {
169 type: "table",
170 header: f[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),
171 align: f[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
172 cells: f[3].replace(/\n$/, "").split("\n")
173 },
174 k = 0; k < i.align.length; k++)
175 i.align[k] = /^ *-+: *$/.test(i.align[k]) ? "right" : /^ *:-+: *$/.test(i.align[k]) ? "center" : /^ *:-+ *$/.test(i.align[k]) ? "left" : null;
176 for (k = 0; k < i.cells.length; k++)
177 i.cells[k] = i.cells[k].split(/ *\| */);
178 this.tokens.push(i)
179 } else if (f = this.rules.lheading.exec(b))
180 b = b.substring(f[0].length),
181 this.tokens.push({
182 type: "heading",
183 depth: "=" === f[2] ? 1 : 2,
184 text: f[1]
185 });
186 else if (f = this.rules.hr.exec(b))
187 b = b.substring(f[0].length),
188 this.tokens.push({
189 type: "hr"
190 });
191 else if (f = this.rules.blockquote.exec(b))
192 b = b.substring(f[0].length),
193 this.tokens.push({
194 type: "blockquote_start"
195 }),
196 f = f[0].replace(/^ *> ?/gm, ""),
197 this.token(f, c),
198 this.tokens.push({
199 type: "blockquote_end"
200 });
201 else if (f = this.rules.list.exec(b)) {
202 for (b = b.substring(f[0].length),
203 g = f[2],
204 this.tokens.push({
205 type: "list_start",
206 ordered: g.length > 1
207 }),
208 f = f[0].match(this.rules.item),
209 d = !1,
210 l = f.length,
211 k = 0; l > k; k++)
212 i = f[k],
213 j = i.length,
214 i = i.replace(/^ *([*+-]|\d+\.) +/, ""),
215 ~i.indexOf("\n ") && (j -= i.length,
216 i = this.options.pedantic ? i.replace(/^ {1,4}/gm, "") : i.replace(new RegExp("^ {1," + j + "}","gm"), "")),
217 this.options.smartLists && k !== l - 1 && (h = a.bullet.exec(f[k + 1])[0],
218 g === h || g.length > 1 && h.length > 1 || (b = f.slice(k + 1).join("\n") + b,
219 k = l - 1)),
220 e = d || /\n\n(?!\s*$)/.test(i),
221 k !== l - 1 && (d = "\n" === i.charAt(i.length - 1),
222 e || (e = d)),
223 this.tokens.push({
224 type: e ? "loose_item_start" : "list_item_start"
225 }),
226 this.token(i, !1),
227 this.tokens.push({
228 type: "list_item_end"
229 });
230 this.tokens.push({
231 type: "list_end"
232 })
233 } else if (f = this.rules.html.exec(b))
234 b = b.substring(f[0].length),
235 this.tokens.push({
236 type: this.options.sanitize ? "paragraph" : "html",
237 pre: "pre" === f[1] || "script" === f[1] || "style" === f[1],
238 text: f[0]
239 });
240 else if (c && (f = this.rules.def.exec(b)))
241 b = b.substring(f[0].length),
242 this.tokens.links[f[1].toLowerCase()] = {
243 href: f[2],
244 title: f[3]
245 };
246 else if (c && (f = this.rules.table.exec(b))) {
247 for (b = b.substring(f[0].length),
248 i = {
249 type: "table",
250 header: f[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),
251 align: f[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
252 cells: f[3].replace(/(?: *\| *)?\n$/, "").split("\n")
253 },
254 k = 0; k < i.align.length; k++)
255 i.align[k] = /^ *-+: *$/.test(i.align[k]) ? "right" : /^ *:-+: *$/.test(i.align[k]) ? "center" : /^ *:-+ *$/.test(i.align[k]) ? "left" : null;
256 for (k = 0; k < i.cells.length; k++)
257 i.cells[k] = i.cells[k].replace(/^ *\| *| *\| *$/g, "").split(/ *\| */);
258 this.tokens.push(i)
259 } else if (c && (f = this.rules.paragraph.exec(b)))
260 b = b.substring(f[0].length),
261 this.tokens.push({
262 type: "paragraph",
263 text: "\n" === f[1].charAt(f[1].length - 1) ? f[1].slice(0, -1) : f[1]
264 });
265 else if (f = this.rules.text.exec(b))
266 b = b.substring(f[0].length),
267 this.tokens.push({
268 type: "text",
269 text: f[0]
270 });
271 else if (b)
272 throw new Error("Infinite loop on byte: " + b.charCodeAt(0));
273 return this.tokens
274 }
275 ;
276 var c = {
277 escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
278 autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
279 url: i,
280 tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
281 link: /^!?\[(inside)\]\(href\)/,
282 reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
283 nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
284 strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
285 em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
286 code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
287 br: /^ {2,}\n(?!\s*$)/,
288 del: i,
289 text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
290 };
291 c._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,
292 c._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,
293 c.link = h(c.link)("inside", c._inside)("href", c._href)(),
294 c.reflink = h(c.reflink)("inside", c._inside)(),
295 c.normal = j({}, c),
296 c.pedantic = j({}, c.normal, {
297 strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
298 em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
299 }),
300 c.gfm = j({}, c.normal, {
301 escape: h(c.escape)("])", "~|])")(),
302 url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
303 del: /^~~(?=\S)([\s\S]*?\S)~~/,
304 text: h(c.text)("]|", "~]|")("|", "|https?://|")()
305 }),
306 c.breaks = j({}, c.gfm, {
307 br: h(c.br)("{2,}", "*")(),
308 text: h(c.gfm.text)("{2,}", "*")()
309 }),
310 d.rules = c,
311 d.output = function(a, b, c) {
312 var e = new d(b,c);
313 return e.output(a)
314 }
315 ,
316 d.prototype.output = function(a) {
317 for (var c, d, e, f, b = ""; a; )
318 if (f = this.rules.escape.exec(a))
319 a = a.substring(f[0].length),
320 b += f[1];
321 else if (f = this.rules.autolink.exec(a))
322 a = a.substring(f[0].length),
323 "@" === f[2] ? (d = ":" === f[1].charAt(6) ? this.mangle(f[1].substring(7)) : this.mangle(f[1]),
324 e = this.mangle("mailto:") + d) : (d = g(f[1]),
325 e = d),
326 b += this.renderer.link(e, null, d);
327 else if (f = this.rules.url.exec(a))
328 a = a.substring(f[0].length),
329 d = g(f[1]),
330 e = d,
331 b += this.renderer.link(e, null, d);
332 else if (f = this.rules.tag.exec(a))
333 a = a.substring(f[0].length),
334 b += this.options.sanitize ? g(f[0]) : f[0];
335 else if (f = this.rules.link.exec(a))
336 a = a.substring(f[0].length),
337 b += this.outputLink(f, {
338 href: f[2],
339 title: f[3]
340 });
341 else if ((f = this.rules.reflink.exec(a)) || (f = this.rules.nolink.exec(a))) {
342 if (a = a.substring(f[0].length),
343 c = (f[2] || f[1]).replace(/\s+/g, " "),
344 c = this.links[c.toLowerCase()],
345 !c || !c.href) {
346 b += f[0].charAt(0),
347 a = f[0].substring(1) + a;
348 continue
349 }
350 b += this.outputLink(f, c)
351 } else if (f = this.rules.strong.exec(a))
352 a = a.substring(f[0].length),
353 b += this.renderer.strong(this.output(f[2] || f[1]));
354 else if (f = this.rules.em.exec(a))
355 a = a.substring(f[0].length),
356 b += this.renderer.em(this.output(f[2] || f[1]));
357 else if (f = this.rules.code.exec(a))
358 a = a.substring(f[0].length),
359 b += this.renderer.codespan(g(f[2], !0));
360 else if (f = this.rules.br.exec(a))
361 a = a.substring(f[0].length),
362 b += this.renderer.br();
363 else if (f = this.rules.del.exec(a))
364 a = a.substring(f[0].length),
365 b += this.renderer.del(this.output(f[1]));
366 else if (f = this.rules.text.exec(a))
367 a = a.substring(f[0].length),
368 b += g(this.smartypants(f[0]));
369 else if (a)
370 throw new Error("Infinite loop on byte: " + a.charCodeAt(0));
371 return b
372 }
373 ,
374 d.prototype.outputLink = function(a, b) {
375 var c = g(b.href)
376 , d = b.title ? g(b.title) : null;
377 return "!" !== a[0].charAt(0) ? this.renderer.link(c, d, this.output(a[1])) : this.renderer.image(c, d, g(a[1]))
378 }
379 ,
380 d.prototype.smartypants = function(a) {
381 return this.options.smartypants ? a.replace(/--/g, "\u2014").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201c").replace(/"/g, "\u201d").replace(/\.{3}/g, "\u2026") : a
382 }
383 ,
384 d.prototype.mangle = function(a) {
385 for (var e, b = "", c = a.length, d = 0; c > d; d++)
386 e = a.charCodeAt(d),
387 Math.random() > .5 && (e = "x" + e.toString(16)),
388 b += "&#" + e + ";";
389 return b
390 }
391 ,
392 e.prototype.code = function(a, b, c, d) {
393 if (d = d || {},
394 d.highlight) {
395 var e = d.highlight(a, b);
396 null != e && e !== a && (c = !0,
397 a = e)
398 }
399 return b ? '<pre><code class="' + d.langPrefix + b + '">' + (c ? a : g(a)) + "\n</code></pre>\n" : "<pre><code>" + (c ? a : g(a, !0)) + "\n</code></pre>"
400 }
401 ,
402 e.prototype.blockquote = function(a) {
403 return "<blockquote>\n" + a + "</blockquote>\n"
404 }
405 ,
406 e.prototype.html = function(a) {
407 return a
408 }
409 ,
410 e.prototype.heading = function(a, b, c, d) {
411 return "<h" + b + ' id="' + d.headerPrefix + c.toLowerCase().replace(/[^\w]+/g, "-") + '">' + a + "</h" + b + ">\n"
412 }
413 ,
414 e.prototype.hr = function() {
415 return "<hr>\n"
416 }
417 ,
418 e.prototype.list = function(a, b) {
419 var c = b ? "ol" : "ul";
420 return "<" + c + ">\n" + a + "</" + c + ">\n"
421 }
422 ,
423 e.prototype.listitem = function(a) {
424 return "<li>" + a + "</li>\n"
425 }
426 ,
427 e.prototype.paragraph = function(a) {
428 return "<p>" + a + "</p>\n"
429 }
430 ,
431 e.prototype.table = function(a, b) {
432 return "<table>\n<thead>\n" + a + "</thead>\n" + "<tbody>\n" + b + "</tbody>\n" + "</table>\n"
433 }
434 ,
435 e.prototype.tablerow = function(a) {
436 return "<tr>\n" + a + "</tr>\n"
437 }
438 ,
439 e.prototype.tablecell = function(a, b) {
440 var c = b.header ? "th" : "td"
441 , d = b.align ? "<" + c + ' style="text-align:' + b.align + '">' : "<" + c + ">";
442 return d + a + "</" + c + ">\n"
443 }
444 ,
445 e.prototype.strong = function(a) {
446 return "<strong>" + a + "</strong>"
447 }
448 ,
449 e.prototype.em = function(a) {
450 return "<em>" + a + "</em>"
451 }
452 ,
453 e.prototype.codespan = function(a) {
454 return "<code>" + a + "</code>"
455 }
456 ,
457 e.prototype.br = function() {
458 return "<br>"
459 }
460 ,
461 e.prototype.del = function(a) {
462 return "<del>" + a + "</del>"
463 }
464 ,
465 e.prototype.link = function(a, b, c) {
466 var d = '<a href="' + a + '"';
467 return b && (d += ' title="' + b + '"'),
468 d += ">" + c + "</a>"
469 }
470 ,
471 e.prototype.image = function(a, b, c) {
472 var d = '<img src="' + a + '" alt="' + c + '"';
473 return b && (d += ' title="' + b + '"'),
474 d += ">"
475 }
476 ,
477 f.parse = function(a, b, c) {
478 var d = new f(b,c);
479 return d.parse(a)
480 }
481 ,
482 f.prototype.parse = function(a) {
483 this.inline = new d(a.links,this.options,this.renderer),
484 this.tokens = a.reverse();
485 for (var b = ""; this.next(); )
486 b += this.tok();
487 return b
488 }
489 ,
490 f.prototype.next = function() {
491 return this.token = this.tokens.pop()
492 }
493 ,
494 f.prototype.peek = function() {
495 return this.tokens[this.tokens.length - 1] || 0
496 }
497 ,
498 f.prototype.parseText = function() {
499 for (var a = this.token.text; "text" === this.peek().type; )
500 a += "\n" + this.next().text;
501 return this.inline.output(a)
502 }
503 ,
504 f.prototype.tok = function() {
505 switch (this.token.type) {
506 case "space":
507 return "";
508 case "hr":
509 return this.renderer.hr();
510 case "heading":
511 return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, this.token.text, this.options);
512 case "code":
513 return this.renderer.code(this.token.text, this.token.lang, this.token.escaped, this.options);
514 case "table":
515 var c, d, e, f, g, a = "", b = "";
516 for (e = "",
517 c = 0; c < this.token.header.length; c++)
518 f = {
519 header: !0,
520 align: this.token.align[c]
521 },
522 e += this.renderer.tablecell(this.inline.output(this.token.header[c]), {
523 header: !0,
524 align: this.token.align[c]
525 });
526 for (a += this.renderer.tablerow(e),
527 c = 0; c < this.token.cells.length; c++) {
528 for (d = this.token.cells[c],
529 e = "",
530 g = 0; g < d.length; g++)
531 e += this.renderer.tablecell(this.inline.output(d[g]), {
532 header: !1,
533 align: this.token.align[g]
534 });
535 b += this.renderer.tablerow(e)
536 }
537 return this.renderer.table(a, b);
538 case "blockquote_start":
539 for (var b = ""; "blockquote_end" !== this.next().type; )
540 b += this.tok();
541 return this.renderer.blockquote(b);
542 case "list_start":
543 for (var b = "", h = this.token.ordered; "list_end" !== this.next().type; )
544 b += this.tok();
545 return this.renderer.list(b, h);
546 case "list_item_start":
547 for (var b = ""; "list_item_end" !== this.next().type; )
548 b += "text" === this.token.type ? this.parseText() : this.tok();
549 return this.renderer.listitem(b);
550 case "loose_item_start":
551 for (var b = ""; "list_item_end" !== this.next().type; )
552 b += this.tok();
553 return this.renderer.listitem(b);
554 case "html":
555 var i = this.token.pre || this.options.pedantic ? this.token.text : this.inline.output(this.token.text);
556 return this.renderer.html(i);
557 case "paragraph":
558 return this.renderer.paragraph(this.inline.output(this.token.text));
559 case "text":
560 return this.renderer.paragraph(this.parseText())
561 }
562 }
563 ,
564 i.exec = i,
565 k.options = k.setOptions = function(a) {
566 return j(k.defaults, a),
567 k
568 }
569 ,
570 k.defaults = {
571 gfm: !0,
572 tables: !0,
573 breaks: !1,
574 pedantic: !1,
575 sanitize: !1,
576 smartLists: !1,
577 silent: !1,
578 highlight: null,
579 langPrefix: "lang-",
580 smartypants: !1,
581 headerPrefix: "",
582 renderer: new e
583 },
584 k.Parser = f,
585 k.parser = f.parse,
586 k.Renderer = e,
587 k.Lexer = b,
588 k.lexer = b.lex,
589 k.InlineLexer = d,
590 k.inlineLexer = d.output,
591 k.parse = k,
592 "object" == typeof exports ? module.exports = k : "function" == typeof define && define.amd ? define(function() {
593 return k
594 }) : this.marked = k
595}
596.call(function() {
597 return this || ("undefined" != typeof window ? window : global)
598}());
599var hljs = new function() {
600 function k(v) {
601 return v.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">")
602 }
603 function t(v) {
604 return v.nodeName.toLowerCase()
605 }
606 function i(w, x) {
607 var v = w && w.exec(x);
608 return v && v.index == 0
609 }
610 function d(v) {
611 return Array.prototype.map.call(v.childNodes, function(w) {
612 if (w.nodeType == 3) {
613 return b.useBR ? w.nodeValue.replace(/\n/g, "") : w.nodeValue
614 }
615 if (t(w) == "br") {
616 return "\n"
617 }
618 return d(w)
619 }).join("")
620 }
621 function r(w) {
622 var v = (w.className + " " + (w.parentNode ? w.parentNode.className : "")).split(/\s+/);
623 v = v.map(function(x) {
624 return x.replace(/^language-/, "")
625 });
626 return v.filter(function(x) {
627 return j(x) || x == "no-highlight"
628 })[0]
629 }
630 function o(x, y) {
631 var v = {};
632 for (var w in x) {
633 v[w] = x[w]
634 }
635 if (y) {
636 for (var w in y) {
637 v[w] = y[w]
638 }
639 }
640 return v
641 }
642 function u(x) {
643 var v = [];
644 (function w(y, z) {
645 for (var A = y.firstChild; A; A = A.nextSibling) {
646 if (A.nodeType == 3) {
647 z += A.nodeValue.length
648 } else {
649 if (t(A) == "br") {
650 z += 1
651 } else {
652 if (A.nodeType == 1) {
653 v.push({
654 event: "start",
655 offset: z,
656 node: A
657 });
658 z = w(A, z);
659 v.push({
660 event: "stop",
661 offset: z,
662 node: A
663 })
664 }
665 }
666 }
667 }
668 return z
669 }
670 )(x, 0);
671 return v
672 }
673 function q(w, y, C) {
674 var x = 0;
675 var F = "";
676 var z = [];
677 function B() {
678 if (!w.length || !y.length) {
679 return w.length ? w : y
680 }
681 if (w[0].offset != y[0].offset) {
682 return (w[0].offset < y[0].offset) ? w : y
683 }
684 return y[0].event == "start" ? w : y
685 }
686 function A(H) {
687 function G(I) {
688 return " " + I.nodeName + '="' + k(I.value) + '"'
689 }
690 F += "<" + t(H) + Array.prototype.map.call(H.attributes, G).join("") + ">"
691 }
692 function E(G) {
693 F += "</" + t(G) + ">"
694 }
695 function v(G) {
696 (G.event == "start" ? A : E)(G.node)
697 }
698 while (w.length || y.length) {
699 var D = B();
700 F += k(C.substr(x, D[0].offset - x));
701 x = D[0].offset;
702 if (D == w) {
703 z.reverse().forEach(E);
704 do {
705 v(D.splice(0, 1)[0]);
706 D = B()
707 } while (D == w && D.length && D[0].offset == x);z.reverse().forEach(A)
708 } else {
709 if (D[0].event == "start") {
710 z.push(D[0].node)
711 } else {
712 z.pop()
713 }
714 v(D.splice(0, 1)[0])
715 }
716 }
717 return F + k(C.substr(x))
718 }
719 function m(y) {
720 function v(z) {
721 return (z && z.source) || z
722 }
723 function w(A, z) {
724 return RegExp(v(A), "m" + (y.cI ? "i" : "") + (z ? "g" : ""))
725 }
726 function x(D, C) {
727 if (D.compiled) {
728 return
729 }
730 D.compiled = true;
731 D.k = D.k || D.bK;
732 if (D.k) {
733 var z = {};
734 function E(G, F) {
735 if (y.cI) {
736 F = F.toLowerCase()
737 }
738 F.split(" ").forEach(function(H) {
739 var I = H.split("|");
740 z[I[0]] = [G, I[1] ? Number(I[1]) : 1]
741 })
742 }
743 if (typeof D.k == "string") {
744 E("keyword", D.k)
745 } else {
746 Object.keys(D.k).forEach(function(F) {
747 E(F, D.k[F])
748 })
749 }
750 D.k = z
751 }
752 D.lR = w(D.l || /\b[A-Za-z0-9_]+\b/, true);
753 if (C) {
754 if (D.bK) {
755 D.b = D.bK.split(" ").join("|")
756 }
757 if (!D.b) {
758 D.b = /\B|\b/
759 }
760 D.bR = w(D.b);
761 if (!D.e && !D.eW) {
762 D.e = /\B|\b/
763 }
764 if (D.e) {
765 D.eR = w(D.e)
766 }
767 D.tE = v(D.e) || "";
768 if (D.eW && C.tE) {
769 D.tE += (D.e ? "|" : "") + C.tE
770 }
771 }
772 if (D.i) {
773 D.iR = w(D.i)
774 }
775 if (D.r === undefined) {
776 D.r = 1
777 }
778 if (!D.c) {
779 D.c = []
780 }
781 var B = [];
782 D.c.forEach(function(F) {
783 if (F.v) {
784 F.v.forEach(function(G) {
785 B.push(o(F, G))
786 })
787 } else {
788 B.push(F == "self" ? D : F)
789 }
790 });
791 D.c = B;
792 D.c.forEach(function(F) {
793 x(F, D)
794 });
795 if (D.starts) {
796 x(D.starts, C)
797 }
798 var A = D.c.map(function(F) {
799 return F.bK ? "\\.?\\b(" + F.b + ")\\b\\.?" : F.b
800 }).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);
801 D.t = A.length ? w(A.join("|"), true) : {
802 exec: function(F) {
803 return null
804 }
805 };
806 D.continuation = {}
807 }
808 x(y)
809 }
810 function c(S, L, J, R) {
811 function v(U, V) {
812 for (var T = 0; T < V.c.length; T++) {
813 if (i(V.c[T].bR, U)) {
814 return V.c[T]
815 }
816 }
817 }
818 function z(U, T) {
819 if (i(U.eR, T)) {
820 return U
821 }
822 if (U.eW) {
823 return z(U.parent, T)
824 }
825 }
826 function A(T, U) {
827 return !J && i(U.iR, T)
828 }
829 function E(V, T) {
830 var U = M.cI ? T[0].toLowerCase() : T[0];
831 return V.k.hasOwnProperty(U) && V.k[U]
832 }
833 function w(Z, X, W, V) {
834 var T = V ? "" : b.classPrefix
835 , U = '<span class="' + T
836 , Y = W ? "" : "</span>";
837 U += Z + '">';
838 return U + X + Y
839 }
840 function N() {
841 var U = k(C);
842 if (!I.k) {
843 return U
844 }
845 var T = "";
846 var X = 0;
847 I.lR.lastIndex = 0;
848 var V = I.lR.exec(U);
849 while (V) {
850 T += U.substr(X, V.index - X);
851 var W = E(I, V);
852 if (W) {
853 H += W[1];
854 T += w(W[0], V[0])
855 } else {
856 T += V[0]
857 }
858 X = I.lR.lastIndex;
859 V = I.lR.exec(U)
860 }
861 return T + U.substr(X)
862 }
863 function F() {
864 if (I.sL && !f[I.sL]) {
865 return k(C)
866 }
867 var T = I.sL ? c(I.sL, C, true, I.continuation.top) : g(C);
868 if (I.r > 0) {
869 H += T.r
870 }
871 if (I.subLanguageMode == "continuous") {
872 I.continuation.top = T.top
873 }
874 return w(T.language, T.value, false, true)
875 }
876 function Q() {
877 return I.sL !== undefined ? F() : N()
878 }
879 function P(V, U) {
880 var T = V.cN ? w(V.cN, "", true) : "";
881 if (V.rB) {
882 D += T;
883 C = ""
884 } else {
885 if (V.eB) {
886 D += k(U) + T;
887 C = ""
888 } else {
889 D += T;
890 C = U
891 }
892 }
893 I = Object.create(V, {
894 parent: {
895 value: I
896 }
897 })
898 }
899 function G(T, X) {
900 C += T;
901 if (X === undefined) {
902 D += Q();
903 return 0
904 }
905 var V = v(X, I);
906 if (V) {
907 D += Q();
908 P(V, X);
909 return V.rB ? 0 : X.length
910 }
911 var W = z(I, X);
912 if (W) {
913 var U = I;
914 if (!(U.rE || U.eE)) {
915 C += X
916 }
917 D += Q();
918 do {
919 if (I.cN) {
920 D += "</span>"
921 }
922 H += I.r;
923 I = I.parent
924 } while (I != W.parent);if (U.eE) {
925 D += k(X)
926 }
927 C = "";
928 if (W.starts) {
929 P(W.starts, "")
930 }
931 return U.rE ? 0 : X.length
932 }
933 if (A(X, I)) {
934 throw new Error('Illegal lexeme "' + X + '" for mode "' + (I.cN || "<unnamed>") + '"')
935 }
936 C += X;
937 return X.length || 1
938 }
939 var M = j(S);
940 if (!M) {
941 throw new Error('Unknown language: "' + S + '"')
942 }
943 m(M);
944 var I = R || M;
945 var D = "";
946 for (var K = I; K != M; K = K.parent) {
947 if (K.cN) {
948 D = w(K.cN, D, true)
949 }
950 }
951 var C = "";
952 var H = 0;
953 try {
954 var B, y, x = 0;
955 while (true) {
956 I.t.lastIndex = x;
957 B = I.t.exec(L);
958 if (!B) {
959 break
960 }
961 y = G(L.substr(x, B.index - x), B[0]);
962 x = B.index + y
963 }
964 G(L.substr(x));
965 for (var K = I; K.parent; K = K.parent) {
966 if (K.cN) {
967 D += "</span>"
968 }
969 }
970 return {
971 r: H,
972 value: D,
973 language: S,
974 top: I
975 }
976 } catch (O) {
977 if (O.message.indexOf("Illegal") != -1) {
978 return {
979 r: 0,
980 value: k(L)
981 }
982 } else {
983 throw O
984 }
985 }
986 }
987 function g(y, x) {
988 x = x || b.languages || Object.keys(f);
989 var v = {
990 r: 0,
991 value: k(y)
992 };
993 var w = v;
994 x.forEach(function(z) {
995 if (!j(z)) {
996 return
997 }
998 var A = c(z, y, false);
999 A.language = z;
1000 if (A.r > w.r) {
1001 w = A
1002 }
1003 if (A.r > v.r) {
1004 w = v;
1005 v = A
1006 }
1007 });
1008 if (w.language) {
1009 v.second_best = w
1010 }
1011 return v
1012 }
1013 function h(v) {
1014 if (b.tabReplace) {
1015 v = v.replace(/^((<[^>]+>|\t)+)/gm, function(w, z, y, x) {
1016 return z.replace(/\t/g, b.tabReplace)
1017 })
1018 }
1019 if (b.useBR) {
1020 v = v.replace(/\n/g, "<br>")
1021 }
1022 return v
1023 }
1024 function p(z) {
1025 var y = d(z);
1026 var A = r(z);
1027 if (A == "no-highlight") {
1028 return
1029 }
1030 var v = A ? c(A, y, true) : g(y);
1031 var w = u(z);
1032 if (w.length) {
1033 var x = document.createElementNS("http://www.w3.org/1999/xhtml", "pre");
1034 x.innerHTML = v.value;
1035 v.value = q(w, u(x), y)
1036 }
1037 v.value = h(v.value);
1038 z.innerHTML = v.value;
1039 z.className += " hljs " + (!A && v.language || "");
1040 z.result = {
1041 language: v.language,
1042 re: v.r
1043 };
1044 if (v.second_best) {
1045 z.second_best = {
1046 language: v.second_best.language,
1047 re: v.second_best.r
1048 }
1049 }
1050 }
1051 var b = {
1052 classPrefix: "hljs-",
1053 tabReplace: null,
1054 useBR: false,
1055 languages: undefined
1056 };
1057 function s(v) {
1058 b = o(b, v)
1059 }
1060 function l() {
1061 if (l.called) {
1062 return
1063 }
1064 l.called = true;
1065 var v = document.querySelectorAll("pre code");
1066 Array.prototype.forEach.call(v, p)
1067 }
1068 function a() {
1069 addEventListener("DOMContentLoaded", l, false);
1070 addEventListener("load", l, false)
1071 }
1072 var f = {};
1073 var n = {};
1074 function e(v, x) {
1075 var w = f[v] = x(this);
1076 if (w.aliases) {
1077 w.aliases.forEach(function(y) {
1078 n[y] = v
1079 })
1080 }
1081 }
1082 function j(v) {
1083 return f[v] || f[n[v]]
1084 }
1085 this.highlight = c;
1086 this.highlightAuto = g;
1087 this.fixMarkup = h;
1088 this.highlightBlock = p;
1089 this.configure = s;
1090 this.initHighlighting = l;
1091 this.initHighlightingOnLoad = a;
1092 this.registerLanguage = e;
1093 this.getLanguage = j;
1094 this.inherit = o;
1095 this.IR = "[a-zA-Z][a-zA-Z0-9_]*";
1096 this.UIR = "[a-zA-Z_][a-zA-Z0-9_]*";
1097 this.NR = "\\b\\d+(\\.\\d+)?";
1098 this.CNR = "(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
1099 this.BNR = "\\b(0b[01]+)";
1100 this.RSR = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
1101 this.BE = {
1102 b: "\\\\[\\s\\S]",
1103 r: 0
1104 };
1105 this.ASM = {
1106 cN: "string",
1107 b: "'",
1108 e: "'",
1109 i: "\\n",
1110 c: [this.BE]
1111 };
1112 this.QSM = {
1113 cN: "string",
1114 b: '"',
1115 e: '"',
1116 i: "\\n",
1117 c: [this.BE]
1118 };
1119 this.CLCM = {
1120 cN: "comment",
1121 b: "//",
1122 e: "$"
1123 };
1124 this.CBLCLM = {
1125 cN: "comment",
1126 b: "/\\*",
1127 e: "\\*/"
1128 };
1129 this.HCM = {
1130 cN: "comment",
1131 b: "#",
1132 e: "$"
1133 };
1134 this.NM = {
1135 cN: "number",
1136 b: this.NR,
1137 r: 0
1138 };
1139 this.CNM = {
1140 cN: "number",
1141 b: this.CNR,
1142 r: 0
1143 };
1144 this.BNM = {
1145 cN: "number",
1146 b: this.BNR,
1147 r: 0
1148 };
1149 this.REGEXP_MODE = {
1150 cN: "regexp",
1151 b: /\//,
1152 e: /\/[gim]*/,
1153 i: /\n/,
1154 c: [this.BE, {
1155 b: /\[/,
1156 e: /\]/,
1157 r: 0,
1158 c: [this.BE]
1159 }]
1160 };
1161 this.TM = {
1162 cN: "title",
1163 b: this.IR,
1164 r: 0
1165 };
1166 this.UTM = {
1167 cN: "title",
1168 b: this.UIR,
1169 r: 0
1170 }
1171}
1172();
1173hljs.registerLanguage("bash", function(b) {
1174 var a = {
1175 cN: "variable",
1176 v: [{
1177 b: /\$[\w\d#@][\w\d_]*/
1178 }, {
1179 b: /\$\{(.*?)\}/
1180 }]
1181 };
1182 var d = {
1183 cN: "string",
1184 b: /"/,
1185 e: /"/,
1186 c: [b.BE, a, {
1187 cN: "variable",
1188 b: /\$\(/,
1189 e: /\)/,
1190 c: [b.BE]
1191 }]
1192 };
1193 var c = {
1194 cN: "string",
1195 b: /'/,
1196 e: /'/
1197 };
1198 return {
1199 l: /-?[a-z\.]+/,
1200 k: {
1201 keyword: "if then else elif fi for break continue while in do done exit return set declare case esac export exec",
1202 literal: "true false",
1203 built_in: "printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",
1204 operator: "-ne -eq -lt -gt -f -d -e -s -l -a"
1205 },
1206 c: [{
1207 cN: "shebang",
1208 b: /^#![^\n]+sh\s*$/,
1209 r: 10
1210 }, {
1211 cN: "function",
1212 b: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
1213 rB: true,
1214 c: [b.inherit(b.TM, {
1215 b: /\w[\w\d_]*/
1216 })],
1217 r: 0
1218 }, b.HCM, b.NM, d, c, a]
1219 }
1220});
1221hljs.registerLanguage("cs", function(b) {
1222 var a = "abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await ascending descending from get group into join let orderby partial select set value var where yield";
1223 return {
1224 k: a,
1225 c: [{
1226 cN: "comment",
1227 b: "///",
1228 e: "$",
1229 rB: true,
1230 c: [{
1231 cN: "xmlDocTag",
1232 b: "///|<!--|-->"
1233 }, {
1234 cN: "xmlDocTag",
1235 b: "</?",
1236 e: ">"
1237 }]
1238 }, b.CLCM, b.CBLCLM, {
1239 cN: "preprocessor",
1240 b: "#",
1241 e: "$",
1242 k: "if else elif endif define undef warning error line region endregion pragma checksum"
1243 }, {
1244 cN: "string",
1245 b: '@"',
1246 e: '"',
1247 c: [{
1248 b: '""'
1249 }]
1250 }, b.ASM, b.QSM, b.CNM, {
1251 bK: "protected public private internal",
1252 e: /[{;=]/,
1253 k: a,
1254 c: [{
1255 bK: "class namespace interface",
1256 starts: {
1257 c: [b.TM]
1258 }
1259 }, {
1260 b: b.IR + "\\s*\\(",
1261 rB: true,
1262 c: [b.TM]
1263 }]
1264 }]
1265 }
1266});
1267hljs.registerLanguage("ruby", function(e) {
1268 var h = "[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";
1269 var g = "and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor";
1270 var a = {
1271 cN: "yardoctag",
1272 b: "@[A-Za-z]+"
1273 };
1274 var i = {
1275 cN: "comment",
1276 v: [{
1277 b: "#",
1278 e: "$",
1279 c: [a]
1280 }, {
1281 b: "^\\=begin",
1282 e: "^\\=end",
1283 c: [a],
1284 r: 10
1285 }, {
1286 b: "^__END__",
1287 e: "\\n$"
1288 }]
1289 };
1290 var c = {
1291 cN: "subst",
1292 b: "#\\{",
1293 e: "}",
1294 k: g
1295 };
1296 var d = {
1297 cN: "string",
1298 c: [e.BE, c],
1299 v: [{
1300 b: /'/,
1301 e: /'/
1302 }, {
1303 b: /"/,
1304 e: /"/
1305 }, {
1306 b: "%[qw]?\\(",
1307 e: "\\)"
1308 }, {
1309 b: "%[qw]?\\[",
1310 e: "\\]"
1311 }, {
1312 b: "%[qw]?{",
1313 e: "}"
1314 }, {
1315 b: "%[qw]?<",
1316 e: ">",
1317 r: 10
1318 }, {
1319 b: "%[qw]?/",
1320 e: "/",
1321 r: 10
1322 }, {
1323 b: "%[qw]?%",
1324 e: "%",
1325 r: 10
1326 }, {
1327 b: "%[qw]?-",
1328 e: "-",
1329 r: 10
1330 }, {
1331 b: "%[qw]?\\|",
1332 e: "\\|",
1333 r: 10
1334 }, {
1335 b: /\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/
1336 }]
1337 };
1338 var b = {
1339 cN: "params",
1340 b: "\\(",
1341 e: "\\)",
1342 k: g
1343 };
1344 var f = [d, i, {
1345 cN: "class",
1346 bK: "class module",
1347 e: "$|;",
1348 i: /=/,
1349 c: [e.inherit(e.TM, {
1350 b: "[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"
1351 }), {
1352 cN: "inheritance",
1353 b: "<\\s*",
1354 c: [{
1355 cN: "parent",
1356 b: "(" + e.IR + "::)?" + e.IR
1357 }]
1358 }, i]
1359 }, {
1360 cN: "function",
1361 bK: "def",
1362 e: " |$|;",
1363 r: 0,
1364 c: [e.inherit(e.TM, {
1365 b: h
1366 }), b, i]
1367 }, {
1368 cN: "constant",
1369 b: "(::)?(\\b[A-Z]\\w*(::)?)+",
1370 r: 0
1371 }, {
1372 cN: "symbol",
1373 b: ":",
1374 c: [d, {
1375 b: h
1376 }],
1377 r: 0
1378 }, {
1379 cN: "symbol",
1380 b: e.UIR + "(\\!|\\?)?:",
1381 r: 0
1382 }, {
1383 cN: "number",
1384 b: "(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",
1385 r: 0
1386 }, {
1387 cN: "variable",
1388 b: "(\\$\\W)|((\\$|\\@\\@?)(\\w+))"
1389 }, {
1390 b: "(" + e.RSR + ")\\s*",
1391 c: [i, {
1392 cN: "regexp",
1393 c: [e.BE, c],
1394 i: /\n/,
1395 v: [{
1396 b: "/",
1397 e: "/[a-z]*"
1398 }, {
1399 b: "%r{",
1400 e: "}[a-z]*"
1401 }, {
1402 b: "%r\\(",
1403 e: "\\)[a-z]*"
1404 }, {
1405 b: "%r!",
1406 e: "![a-z]*"
1407 }, {
1408 b: "%r\\[",
1409 e: "\\][a-z]*"
1410 }]
1411 }],
1412 r: 0
1413 }];
1414 c.c = f;
1415 b.c = f;
1416 return {
1417 k: g,
1418 c: f
1419 }
1420});
1421hljs.registerLanguage("diff", function(a) {
1422 return {
1423 c: [{
1424 cN: "chunk",
1425 r: 10,
1426 v: [{
1427 b: /^\@\@ +\-\d+,\d+ +\+\d+,\d+ +\@\@$/
1428 }, {
1429 b: /^\*\*\* +\d+,\d+ +\*\*\*\*$/
1430 }, {
1431 b: /^\-\-\- +\d+,\d+ +\-\-\-\-$/
1432 }]
1433 }, {
1434 cN: "header",
1435 v: [{
1436 b: /Index: /,
1437 e: /$/
1438 }, {
1439 b: /=====/,
1440 e: /=====$/
1441 }, {
1442 b: /^\-\-\-/,
1443 e: /$/
1444 }, {
1445 b: /^\*{3} /,
1446 e: /$/
1447 }, {
1448 b: /^\+\+\+/,
1449 e: /$/
1450 }, {
1451 b: /\*{5}/,
1452 e: /\*{5}$/
1453 }]
1454 }, {
1455 cN: "addition",
1456 b: "^\\+",
1457 e: "$"
1458 }, {
1459 cN: "deletion",
1460 b: "^\\-",
1461 e: "$"
1462 }, {
1463 cN: "change",
1464 b: "^\\!",
1465 e: "$"
1466 }]
1467 }
1468});
1469hljs.registerLanguage("javascript", function(a) {
1470 return {
1471 aliases: ["js"],
1472 k: {
1473 keyword: "in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",
1474 literal: "true false null undefined NaN Infinity",
1475 built_in: "eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"
1476 },
1477 c: [{
1478 cN: "pi",
1479 b: /^\s*('|")use strict('|")/,
1480 r: 10
1481 }, a.ASM, a.QSM, a.CLCM, a.CBLCLM, a.CNM, {
1482 b: "(" + a.RSR + "|\\b(case|return|throw)\\b)\\s*",
1483 k: "return throw case",
1484 c: [a.CLCM, a.CBLCLM, a.REGEXP_MODE, {
1485 b: /</,
1486 e: />;/,
1487 r: 0,
1488 sL: "xml"
1489 }],
1490 r: 0
1491 }, {
1492 cN: "function",
1493 bK: "function",
1494 e: /\{/,
1495 c: [a.inherit(a.TM, {
1496 b: /[A-Za-z$_][0-9A-Za-z$_]*/
1497 }), {
1498 cN: "params",
1499 b: /\(/,
1500 e: /\)/,
1501 c: [a.CLCM, a.CBLCLM],
1502 i: /["'\(]/
1503 }],
1504 i: /\[|%/
1505 }, {
1506 b: /\$[(.]/
1507 }, {
1508 b: "\\." + a.IR,
1509 r: 0
1510 }]
1511 }
1512});
1513hljs.registerLanguage("xml", function(a) {
1514 var c = "[A-Za-z0-9\\._:-]+";
1515 var d = {
1516 b: /<\?(php)?(?!\w)/,
1517 e: /\?>/,
1518 sL: "php",
1519 subLanguageMode: "continuous"
1520 };
1521 var b = {
1522 eW: true,
1523 i: /</,
1524 r: 0,
1525 c: [d, {
1526 cN: "attribute",
1527 b: c,
1528 r: 0
1529 }, {
1530 b: "=",
1531 r: 0,
1532 c: [{
1533 cN: "value",
1534 v: [{
1535 b: /"/,
1536 e: /"/
1537 }, {
1538 b: /'/,
1539 e: /'/
1540 }, {
1541 b: /[^\s\/>]+/
1542 }]
1543 }]
1544 }]
1545 };
1546 return {
1547 aliases: ["html"],
1548 cI: true,
1549 c: [{
1550 cN: "doctype",
1551 b: "<!DOCTYPE",
1552 e: ">",
1553 r: 10,
1554 c: [{
1555 b: "\\[",
1556 e: "\\]"
1557 }]
1558 }, {
1559 cN: "comment",
1560 b: "<!--",
1561 e: "-->",
1562 r: 10
1563 }, {
1564 cN: "cdata",
1565 b: "<\\!\\[CDATA\\[",
1566 e: "\\]\\]>",
1567 r: 10
1568 }, {
1569 cN: "tag",
1570 b: "<style(?=\\s|>|$)",
1571 e: ">",
1572 k: {
1573 title: "style"
1574 },
1575 c: [b],
1576 starts: {
1577 e: "</style>",
1578 rE: true,
1579 sL: "css"
1580 }
1581 }, {
1582 cN: "tag",
1583 b: "<script(?=\\s|>|$)",
1584 e: ">",
1585 k: {
1586 title: "script"
1587 },
1588 c: [b],
1589 starts: {
1590 e: "<\/script>",
1591 rE: true,
1592 sL: "javascript"
1593 }
1594 }, {
1595 b: "<%",
1596 e: "%>",
1597 sL: "vbscript"
1598 }, d, {
1599 cN: "pi",
1600 b: /<\?\w+/,
1601 e: /\?>/,
1602 r: 10
1603 }, {
1604 cN: "tag",
1605 b: "</?",
1606 e: "/?>",
1607 c: [{
1608 cN: "title",
1609 b: "[^ /><]+",
1610 r: 0
1611 }, b]
1612 }]
1613 }
1614});
1615hljs.registerLanguage("markdown", function(a) {
1616 return {
1617 c: [{
1618 cN: "header",
1619 v: [{
1620 b: "^#{1,6}",
1621 e: "$"
1622 }, {
1623 b: "^.+?\\n[=-]{2,}$"
1624 }]
1625 }, {
1626 b: "<",
1627 e: ">",
1628 sL: "xml",
1629 r: 0
1630 }, {
1631 cN: "bullet",
1632 b: "^([*+-]|(\\d+\\.))\\s+"
1633 }, {
1634 cN: "strong",
1635 b: "[*_]{2}.+?[*_]{2}"
1636 }, {
1637 cN: "emphasis",
1638 v: [{
1639 b: "\\*.+?\\*"
1640 }, {
1641 b: "_.+?_",
1642 r: 0
1643 }]
1644 }, {
1645 cN: "blockquote",
1646 b: "^>\\s+",
1647 e: "$"
1648 }, {
1649 cN: "code",
1650 v: [{
1651 b: "`.+?`"
1652 }, {
1653 b: "^( {4}|\t)",
1654 e: "$",
1655 r: 0
1656 }]
1657 }, {
1658 cN: "horizontal_rule",
1659 b: "^[-\\*]{3,}",
1660 e: "$"
1661 }, {
1662 b: "\\[.+?\\][\\(\\[].+?[\\)\\]]",
1663 rB: true,
1664 c: [{
1665 cN: "link_label",
1666 b: "\\[",
1667 e: "\\]",
1668 eB: true,
1669 rE: true,
1670 r: 0
1671 }, {
1672 cN: "link_url",
1673 b: "\\]\\(",
1674 e: "\\)",
1675 eB: true,
1676 eE: true
1677 }, {
1678 cN: "link_reference",
1679 b: "\\]\\[",
1680 e: "\\]",
1681 eB: true,
1682 eE: true,
1683 }],
1684 r: 10
1685 }, {
1686 b: "^\\[.+\\]:",
1687 e: "$",
1688 rB: true,
1689 c: [{
1690 cN: "link_reference",
1691 b: "\\[",
1692 e: "\\]",
1693 eB: true,
1694 eE: true
1695 }, {
1696 cN: "link_url",
1697 b: "\\s",
1698 e: "$"
1699 }]
1700 }]
1701 }
1702});
1703hljs.registerLanguage("css", function(a) {
1704 var b = "[a-zA-Z-][a-zA-Z0-9_-]*";
1705 var c = {
1706 cN: "function",
1707 b: b + "\\(",
1708 e: "\\)",
1709 c: ["self", a.NM, a.ASM, a.QSM]
1710 };
1711 return {
1712 cI: true,
1713 i: "[=/|']",
1714 c: [a.CBLCLM, {
1715 cN: "id",
1716 b: "\\#[A-Za-z0-9_-]+"
1717 }, {
1718 cN: "class",
1719 b: "\\.[A-Za-z0-9_-]+",
1720 r: 0
1721 }, {
1722 cN: "attr_selector",
1723 b: "\\[",
1724 e: "\\]",
1725 i: "$"
1726 }, {
1727 cN: "pseudo",
1728 b: ":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"
1729 }, {
1730 cN: "at_rule",
1731 b: "@(font-face|page)",
1732 l: "[a-z-]+",
1733 k: "font-face page"
1734 }, {
1735 cN: "at_rule",
1736 b: "@",
1737 e: "[{;]",
1738 c: [{
1739 cN: "keyword",
1740 b: /\S+/
1741 }, {
1742 b: /\s/,
1743 eW: true,
1744 eE: true,
1745 r: 0,
1746 c: [c, a.ASM, a.QSM, a.NM]
1747 }]
1748 }, {
1749 cN: "tag",
1750 b: b,
1751 r: 0
1752 }, {
1753 cN: "rules",
1754 b: "{",
1755 e: "}",
1756 i: "[^\\s]",
1757 r: 0,
1758 c: [a.CBLCLM, {
1759 cN: "rule",
1760 b: "[^\\s]",
1761 rB: true,
1762 e: ";",
1763 eW: true,
1764 c: [{
1765 cN: "attribute",
1766 b: "[A-Z\\_\\.\\-]+",
1767 e: ":",
1768 eE: true,
1769 i: "[^\\s]",
1770 starts: {
1771 cN: "value",
1772 eW: true,
1773 eE: true,
1774 c: [c, a.NM, a.QSM, a.ASM, a.CBLCLM, {
1775 cN: "hexcolor",
1776 b: "#[0-9A-Fa-f]+"
1777 }, {
1778 cN: "important",
1779 b: "!important"
1780 }]
1781 }
1782 }]
1783 }]
1784 }]
1785 }
1786});
1787hljs.registerLanguage("http", function(a) {
1788 return {
1789 i: "\\S",
1790 c: [{
1791 cN: "status",
1792 b: "^HTTP/[0-9\\.]+",
1793 e: "$",
1794 c: [{
1795 cN: "number",
1796 b: "\\b\\d{3}\\b"
1797 }]
1798 }, {
1799 cN: "request",
1800 b: "^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",
1801 rB: true,
1802 e: "$",
1803 c: [{
1804 cN: "string",
1805 b: " ",
1806 e: " ",
1807 eB: true,
1808 eE: true
1809 }]
1810 }, {
1811 cN: "attribute",
1812 b: "^\\w",
1813 e: ": ",
1814 eE: true,
1815 i: "\\n|\\s|=",
1816 starts: {
1817 cN: "string",
1818 e: "$"
1819 }
1820 }, {
1821 b: "\\n\\n",
1822 starts: {
1823 sL: "",
1824 eW: true
1825 }
1826 }]
1827 }
1828});
1829hljs.registerLanguage("java", function(b) {
1830 var a = "false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws";
1831 return {
1832 k: a,
1833 i: /<\//,
1834 c: [{
1835 cN: "javadoc",
1836 b: "/\\*\\*",
1837 e: "\\*/",
1838 c: [{
1839 cN: "javadoctag",
1840 b: "(^|\\s)@[A-Za-z]+"
1841 }],
1842 r: 10
1843 }, b.CLCM, b.CBLCLM, b.ASM, b.QSM, {
1844 bK: "protected public private",
1845 e: /[{;=]/,
1846 k: a,
1847 c: [{
1848 cN: "class",
1849 bK: "class interface",
1850 eW: true,
1851 i: /[:"<>]/,
1852 c: [{
1853 bK: "extends implements",
1854 r: 10
1855 }, b.UTM]
1856 }, {
1857 b: b.UIR + "\\s*\\(",
1858 rB: true,
1859 c: [b.UTM]
1860 }]
1861 }, b.CNM, {
1862 cN: "annotation",
1863 b: "@[A-Za-z]+"
1864 }]
1865 }
1866});
1867hljs.registerLanguage("php", function(b) {
1868 var e = {
1869 cN: "variable",
1870 b: "\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"
1871 };
1872 var a = {
1873 cN: "preprocessor",
1874 b: /<\?(php)?|\?>/
1875 };
1876 var c = {
1877 cN: "string",
1878 c: [b.BE, a],
1879 v: [{
1880 b: 'b"',
1881 e: '"'
1882 }, {
1883 b: "b'",
1884 e: "'"
1885 }, b.inherit(b.ASM, {
1886 i: null
1887 }), b.inherit(b.QSM, {
1888 i: null
1889 })]
1890 };
1891 var d = {
1892 v: [b.BNM, b.CNM]
1893 };
1894 return {
1895 cI: true,
1896 k: "and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",
1897 c: [b.CLCM, b.HCM, {
1898 cN: "comment",
1899 b: "/\\*",
1900 e: "\\*/",
1901 c: [{
1902 cN: "phpdoc",
1903 b: "\\s@[A-Za-z]+"
1904 }, a]
1905 }, {
1906 cN: "comment",
1907 b: "__halt_compiler.+?;",
1908 eW: true,
1909 k: "__halt_compiler",
1910 l: b.UIR
1911 }, {
1912 cN: "string",
1913 b: "<<<['\"]?\\w+['\"]?$",
1914 e: "^\\w+;",
1915 c: [b.BE]
1916 }, a, e, {
1917 cN: "function",
1918 bK: "function",
1919 e: /[;{]/,
1920 i: "\\$|\\[|%",
1921 c: [b.UTM, {
1922 cN: "params",
1923 b: "\\(",
1924 e: "\\)",
1925 c: ["self", e, b.CBLCLM, c, d]
1926 }]
1927 }, {
1928 cN: "class",
1929 bK: "class interface",
1930 e: "{",
1931 i: /[:\(\$"]/,
1932 c: [{
1933 bK: "extends implements",
1934 r: 10
1935 }, b.UTM]
1936 }, {
1937 bK: "namespace",
1938 e: ";",
1939 i: /[\.']/,
1940 c: [b.UTM]
1941 }, {
1942 bK: "use",
1943 e: ";",
1944 c: [b.UTM]
1945 }, {
1946 b: "=>"
1947 }, c, d]
1948 }
1949});
1950hljs.registerLanguage("python", function(a) {
1951 var f = {
1952 cN: "prompt",
1953 b: /^(>>>|\.\.\.) /
1954 };
1955 var b = {
1956 cN: "string",
1957 c: [a.BE],
1958 v: [{
1959 b: /(u|b)?r?'''/,
1960 e: /'''/,
1961 c: [f],
1962 r: 10
1963 }, {
1964 b: /(u|b)?r?"""/,
1965 e: /"""/,
1966 c: [f],
1967 r: 10
1968 }, {
1969 b: /(u|r|ur)'/,
1970 e: /'/,
1971 r: 10
1972 }, {
1973 b: /(u|r|ur)"/,
1974 e: /"/,
1975 r: 10
1976 }, {
1977 b: /(b|br)'/,
1978 e: /'/,
1979 }, {
1980 b: /(b|br)"/,
1981 e: /"/,
1982 }, a.ASM, a.QSM]
1983 };
1984 var d = {
1985 cN: "number",
1986 r: 0,
1987 v: [{
1988 b: a.BNR + "[lLjJ]?"
1989 }, {
1990 b: "\\b(0o[0-7]+)[lLjJ]?"
1991 }, {
1992 b: a.CNR + "[lLjJ]?"
1993 }]
1994 };
1995 var e = {
1996 cN: "params",
1997 b: /\(/,
1998 e: /\)/,
1999 c: ["self", f, d, b]
2000 };
2001 var c = {
2002 e: /:/,
2003 i: /[${=;\n]/,
2004 c: [a.UTM, e]
2005 };
2006 return {
2007 k: {
2008 keyword: "and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",
2009 built_in: "Ellipsis NotImplemented"
2010 },
2011 i: /(<\/|->|\?)/,
2012 c: [f, d, b, a.HCM, a.inherit(c, {
2013 cN: "function",
2014 bK: "def",
2015 r: 10
2016 }), a.inherit(c, {
2017 cN: "class",
2018 bK: "class"
2019 }), {
2020 cN: "decorator",
2021 b: /@/,
2022 e: /$/
2023 }, {
2024 b: /\b(print|exec)\(/
2025 }]
2026 }
2027});
2028hljs.registerLanguage("sql", function(a) {
2029 return {
2030 cI: true,
2031 i: /[<>]/,
2032 c: [{
2033 cN: "operator",
2034 b: "\\b(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant|merge)\\b(?!:)",
2035 e: ";",
2036 eW: true,
2037 k: {
2038 keyword: "all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number trigger if before after each row merge matched database",
2039 aggregate: "count sum min max avg"
2040 },
2041 c: [{
2042 cN: "string",
2043 b: "'",
2044 e: "'",
2045 c: [a.BE, {
2046 b: "''"
2047 }]
2048 }, {
2049 cN: "string",
2050 b: '"',
2051 e: '"',
2052 c: [a.BE, {
2053 b: '""'
2054 }]
2055 }, {
2056 cN: "string",
2057 b: "`",
2058 e: "`",
2059 c: [a.BE]
2060 }, a.CNM]
2061 }, a.CBLCLM, {
2062 cN: "comment",
2063 b: "--",
2064 e: "$"
2065 }]
2066 }
2067});
2068hljs.registerLanguage("ini", function(a) {
2069 return {
2070 cI: true,
2071 i: /\S/,
2072 c: [{
2073 cN: "comment",
2074 b: ";",
2075 e: "$"
2076 }, {
2077 cN: "title",
2078 b: "^\\[",
2079 e: "\\]"
2080 }, {
2081 cN: "setting",
2082 b: "^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",
2083 e: "$",
2084 c: [{
2085 cN: "value",
2086 eW: true,
2087 k: "on off true false yes no",
2088 c: [a.QSM, a.NM],
2089 r: 0
2090 }]
2091 }]
2092 }
2093});
2094hljs.registerLanguage("perl", function(c) {
2095 var d = "getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";
2096 var f = {
2097 cN: "subst",
2098 b: "[$@]\\{",
2099 e: "\\}",
2100 k: d
2101 };
2102 var g = {
2103 b: "->{",
2104 e: "}"
2105 };
2106 var a = {
2107 cN: "variable",
2108 v: [{
2109 b: /\$\d/
2110 }, {
2111 b: /[\$\%\@\*](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/
2112 }, {
2113 b: /[\$\%\@\*][^\s\w{]/,
2114 r: 0
2115 }]
2116 };
2117 var e = {
2118 cN: "comment",
2119 b: "^(__END__|__DATA__)",
2120 e: "\\n$",
2121 r: 5
2122 };
2123 var h = [c.BE, f, a];
2124 var b = [a, c.HCM, e, {
2125 cN: "comment",
2126 b: "^\\=\\w",
2127 e: "\\=cut",
2128 eW: true
2129 }, g, {
2130 cN: "string",
2131 c: h,
2132 v: [{
2133 b: "q[qwxr]?\\s*\\(",
2134 e: "\\)",
2135 r: 5
2136 }, {
2137 b: "q[qwxr]?\\s*\\[",
2138 e: "\\]",
2139 r: 5
2140 }, {
2141 b: "q[qwxr]?\\s*\\{",
2142 e: "\\}",
2143 r: 5
2144 }, {
2145 b: "q[qwxr]?\\s*\\|",
2146 e: "\\|",
2147 r: 5
2148 }, {
2149 b: "q[qwxr]?\\s*\\<",
2150 e: "\\>",
2151 r: 5
2152 }, {
2153 b: "qw\\s+q",
2154 e: "q",
2155 r: 5
2156 }, {
2157 b: "'",
2158 e: "'",
2159 c: [c.BE]
2160 }, {
2161 b: '"',
2162 e: '"'
2163 }, {
2164 b: "`",
2165 e: "`",
2166 c: [c.BE]
2167 }, {
2168 b: "{\\w+}",
2169 c: [],
2170 r: 0
2171 }, {
2172 b: "-?\\w+\\s*\\=\\>",
2173 c: [],
2174 r: 0
2175 }]
2176 }, {
2177 cN: "number",
2178 b: "(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",
2179 r: 0
2180 }, {
2181 b: "(\\/\\/|" + c.RSR + "|\\b(split|return|print|reverse|grep)\\b)\\s*",
2182 k: "split return print reverse grep",
2183 r: 0,
2184 c: [c.HCM, e, {
2185 cN: "regexp",
2186 b: "(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",
2187 r: 10
2188 }, {
2189 cN: "regexp",
2190 b: "(m|qr)?/",
2191 e: "/[a-z]*",
2192 c: [c.BE],
2193 r: 0
2194 }]
2195 }, {
2196 cN: "sub",
2197 bK: "sub",
2198 e: "(\\s*\\(.*?\\))?[;{]",
2199 r: 5
2200 }, {
2201 cN: "operator",
2202 b: "-\\w\\b",
2203 r: 0
2204 }];
2205 f.c = b;
2206 g.c = b;
2207 return {
2208 k: d,
2209 c: b
2210 }
2211});
2212hljs.registerLanguage("objectivec", function(a) {
2213 var d = {
2214 keyword: "int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign self synchronized id nonatomic super unichar IBOutlet IBAction strong weak @private @protected @public @try @property @end @throw @catch @finally @synthesize @dynamic @selector @optional @required",
2215 literal: "false true FALSE TRUE nil YES NO NULL",
2216 built_in: "NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection UIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"
2217 };
2218 var c = /[a-zA-Z@][a-zA-Z0-9_]*/;
2219 var b = "@interface @class @protocol @implementation";
2220 return {
2221 k: d,
2222 l: c,
2223 i: "</",
2224 c: [a.CLCM, a.CBLCLM, a.CNM, a.QSM, {
2225 cN: "string",
2226 b: "'",
2227 e: "[^\\\\]'",
2228 i: "[^\\\\][^']"
2229 }, {
2230 cN: "preprocessor",
2231 b: "#import",
2232 e: "$",
2233 c: [{
2234 cN: "title",
2235 b: '"',
2236 e: '"'
2237 }, {
2238 cN: "title",
2239 b: "<",
2240 e: ">"
2241 }]
2242 }, {
2243 cN: "preprocessor",
2244 b: "#",
2245 e: "$"
2246 }, {
2247 cN: "class",
2248 b: "(" + b.split(" ").join("|") + ")\\b",
2249 e: "({|$)",
2250 k: b,
2251 l: c,
2252 c: [a.UTM]
2253 }, {
2254 cN: "variable",
2255 b: "\\." + a.UIR,
2256 r: 0
2257 }]
2258 }
2259});
2260hljs.registerLanguage("coffeescript", function(c) {
2261 var b = {
2262 keyword: "in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",
2263 literal: "true false null undefined yes no on off",
2264 reserved: "case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",
2265 built_in: "npm require console print module exports global window document"
2266 };
2267 var a = "[A-Za-z$_][0-9A-Za-z$_]*";
2268 var f = c.inherit(c.TM, {
2269 b: a
2270 });
2271 var e = {
2272 cN: "subst",
2273 b: /#\{/,
2274 e: /}/,
2275 k: b
2276 };
2277 var d = [c.BNM, c.inherit(c.CNM, {
2278 starts: {
2279 e: "(\\s*/)?",
2280 r: 0
2281 }
2282 }), {
2283 cN: "string",
2284 v: [{
2285 b: /'''/,
2286 e: /'''/,
2287 c: [c.BE]
2288 }, {
2289 b: /'/,
2290 e: /'/,
2291 c: [c.BE]
2292 }, {
2293 b: /"""/,
2294 e: /"""/,
2295 c: [c.BE, e]
2296 }, {
2297 b: /"/,
2298 e: /"/,
2299 c: [c.BE, e]
2300 }]
2301 }, {
2302 cN: "regexp",
2303 v: [{
2304 b: "///",
2305 e: "///",
2306 c: [e, c.HCM]
2307 }, {
2308 b: "//[gim]*",
2309 r: 0
2310 }, {
2311 b: "/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"
2312 }]
2313 }, {
2314 cN: "property",
2315 b: "@" + a
2316 }, {
2317 b: "`",
2318 e: "`",
2319 eB: true,
2320 eE: true,
2321 sL: "javascript"
2322 }];
2323 e.c = d;
2324 return {
2325 k: b,
2326 c: d.concat([{
2327 cN: "comment",
2328 b: "###",
2329 e: "###"
2330 }, c.HCM, {
2331 cN: "function",
2332 b: "(" + a + "\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",
2333 e: "[-=]>",
2334 rB: true,
2335 c: [f, {
2336 cN: "params",
2337 b: "\\(",
2338 rB: true,
2339 c: [{
2340 b: /\(/,
2341 e: /\)/,
2342 k: b,
2343 c: ["self"].concat(d)
2344 }]
2345 }]
2346 }, {
2347 cN: "class",
2348 bK: "class",
2349 e: "$",
2350 i: /[:="\[\]]/,
2351 c: [{
2352 bK: "extends",
2353 eW: true,
2354 i: /[:="\[\]]/,
2355 c: [f]
2356 }, f]
2357 }, {
2358 cN: "attribute",
2359 b: a + ":",
2360 e: ":",
2361 rB: true,
2362 eE: true,
2363 r: 0
2364 }])
2365 }
2366});
2367hljs.registerLanguage("nginx", function(c) {
2368 var b = {
2369 cN: "variable",
2370 v: [{
2371 b: /\$\d+/
2372 }, {
2373 b: /\$\{/,
2374 e: /}/
2375 }, {
2376 b: "[\\$\\@]" + c.UIR
2377 }]
2378 };
2379 var a = {
2380 eW: true,
2381 l: "[a-z/_]+",
2382 k: {
2383 built_in: "on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"
2384 },
2385 r: 0,
2386 i: "=>",
2387 c: [c.HCM, {
2388 cN: "string",
2389 c: [c.BE, b],
2390 v: [{
2391 b: /"/,
2392 e: /"/
2393 }, {
2394 b: /'/,
2395 e: /'/
2396 }]
2397 }, {
2398 cN: "url",
2399 b: "([a-z]+):/",
2400 e: "\\s",
2401 eW: true,
2402 eE: true
2403 }, {
2404 cN: "regexp",
2405 c: [c.BE, b],
2406 v: [{
2407 b: "\\s\\^",
2408 e: "\\s|{|;",
2409 rE: true
2410 }, {
2411 b: "~\\*?\\s+",
2412 e: "\\s|{|;",
2413 rE: true
2414 }, {
2415 b: "\\*(\\.[a-z\\-]+)+"
2416 }, {
2417 b: "([a-z\\-]+\\.)+\\*"
2418 }]
2419 }, {
2420 cN: "number",
2421 b: "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"
2422 }, {
2423 cN: "number",
2424 b: "\\b\\d+[kKmMgGdshdwy]*\\b",
2425 r: 0
2426 }, b]
2427 };
2428 return {
2429 c: [c.HCM, {
2430 b: c.UIR + "\\s",
2431 e: ";|{",
2432 rB: true,
2433 c: [c.inherit(c.UTM, {
2434 starts: a
2435 })],
2436 r: 0
2437 }],
2438 i: "[^\\s\\}]"
2439 }
2440});
2441hljs.registerLanguage("json", function(a) {
2442 var e = {
2443 literal: "true false null"
2444 };
2445 var d = [a.QSM, a.CNM];
2446 var c = {
2447 cN: "value",
2448 e: ",",
2449 eW: true,
2450 eE: true,
2451 c: d,
2452 k: e
2453 };
2454 var b = {
2455 b: "{",
2456 e: "}",
2457 c: [{
2458 cN: "attribute",
2459 b: '\\s*"',
2460 e: '"\\s*:\\s*',
2461 eB: true,
2462 eE: true,
2463 c: [a.BE],
2464 i: "\\n",
2465 starts: c
2466 }],
2467 i: "\\S"
2468 };
2469 var f = {
2470 b: "\\[",
2471 e: "\\]",
2472 c: [a.inherit(c, {
2473 cN: null
2474 })],
2475 i: "\\S"
2476 };
2477 d.splice(d.length, 0, b, f);
2478 return {
2479 c: d,
2480 k: e,
2481 i: "\\S"
2482 }
2483});
2484hljs.registerLanguage("apache", function(a) {
2485 var b = {
2486 cN: "number",
2487 b: "[\\$%]\\d+"
2488 };
2489 return {
2490 cI: true,
2491 c: [a.HCM, {
2492 cN: "tag",
2493 b: "</?",
2494 e: ">"
2495 }, {
2496 cN: "keyword",
2497 b: /\w+/,
2498 r: 0,
2499 k: {
2500 common: "order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"
2501 },
2502 starts: {
2503 e: /$/,
2504 r: 0,
2505 k: {
2506 literal: "on off all"
2507 },
2508 c: [{
2509 cN: "sqbracket",
2510 b: "\\s\\[",
2511 e: "\\]$"
2512 }, {
2513 cN: "cbracket",
2514 b: "[\\$%]\\{",
2515 e: "\\}",
2516 c: ["self", b]
2517 }, b, a.QSM]
2518 }
2519 }],
2520 i: /\S/
2521 }
2522});
2523hljs.registerLanguage("cpp", function(a) {
2524 var b = {
2525 keyword: "false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary",
2526 built_in: "std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"
2527 };
2528 return {
2529 aliases: ["c"],
2530 k: b,
2531 i: "</",
2532 c: [a.CLCM, a.CBLCLM, a.QSM, {
2533 cN: "string",
2534 b: "'\\\\?.",
2535 e: "'",
2536 i: "."
2537 }, {
2538 cN: "number",
2539 b: "\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"
2540 }, a.CNM, {
2541 cN: "preprocessor",
2542 b: "#",
2543 e: "$",
2544 c: [{
2545 b: "include\\s*<",
2546 e: ">",
2547 i: "\\n"
2548 }, a.CLCM]
2549 }, {
2550 cN: "stl_container",
2551 b: "\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",
2552 e: ">",
2553 k: b,
2554 r: 10,
2555 c: ["self"]
2556 }]
2557 }
2558});
2559hljs.registerLanguage("makefile", function(a) {
2560 var b = {
2561 cN: "variable",
2562 b: /\$\(/,
2563 e: /\)/,
2564 c: [a.BE]
2565 };
2566 return {
2567 c: [a.HCM, {
2568 b: /^\w+\s*\W*=/,
2569 rB: true,
2570 r: 0,
2571 starts: {
2572 cN: "constant",
2573 e: /\s*\W*=/,
2574 eE: true,
2575 starts: {
2576 e: /$/,
2577 r: 0,
2578 c: [b],
2579 }
2580 }
2581 }, {
2582 cN: "title",
2583 b: /^[\w]+:\s*$/
2584 }, {
2585 cN: "phony",
2586 b: /^\.PHONY:/,
2587 e: /$/,
2588 k: ".PHONY",
2589 l: /[\.\w]+/
2590 }, {
2591 b: /^\t+/,
2592 e: /$/,
2593 c: [a.QSM, b]
2594 }]
2595 }
2596});
2597!function(e) {
2598 function t(r) {
2599 if (n[r])
2600 return n[r].exports;
2601 var i = n[r] = {
2602 i: r,
2603 l: !1,
2604 exports: {}
2605 };
2606 return e[r].call(i.exports, i, i.exports, t),
2607 i.l = !0,
2608 i.exports
2609 }
2610 var n = {};
2611 t.m = e,
2612 t.c = n,
2613 t.i = function(e) {
2614 return e
2615 }
2616 ,
2617 t.d = function(e, n, r) {
2618 t.o(e, n) || Object.defineProperty(e, n, {
2619 configurable: !1,
2620 enumerable: !0,
2621 get: r
2622 })
2623 }
2624 ,
2625 t.n = function(e) {
2626 var n = e && e.__esModule ? function() {
2627 return e.default
2628 }
2629 : function() {
2630 return e
2631 }
2632 ;
2633 return t.d(n, "a", n),
2634 n
2635 }
2636 ,
2637 t.o = function(e, t) {
2638 return Object.prototype.hasOwnProperty.call(e, t)
2639 }
2640 ,
2641 t.p = "",
2642 t(t.s = 11)
2643}([function(e, t, n) {
2644 "use strict";
2645 function r(e, t) {
2646 if (!(e instanceof t))
2647 throw new TypeError("Cannot call a class as a function")
2648 }
2649 Object.defineProperty(t, "__esModule", {
2650 value: !0
2651 });
2652 var i = function() {
2653 function e(e, t) {
2654 for (var n = 0; n < t.length; n++) {
2655 var r = t[n];
2656 r.enumerable = r.enumerable || !1,
2657 r.configurable = !0,
2658 "value"in r && (r.writable = !0),
2659 Object.defineProperty(e, r.key, r)
2660 }
2661 }
2662 return function(t, n, r) {
2663 return n && e(t.prototype, n),
2664 r && e(t, r),
2665 t
2666 }
2667 }()
2668 , o = n(1)
2669 , s = (function(e) {
2670 e && e.__esModule
2671 }(o),
2672 function() {
2673 function e(t, n, i) {
2674 r(this, e),
2675 this.data = t,
2676 this.term = n,
2677 this.strategy = i
2678 }
2679 return i(e, [{
2680 key: "replace",
2681 value: function(e, t) {
2682 var n = this.strategy.replace(this.data);
2683 if (null !== n) {
2684 Array.isArray(n) && (t = n[1] + t,
2685 n = n[0]);
2686 var r = this.strategy.matchText(e);
2687 if (r)
2688 return n = n.replace(/\$&/g, r[0]).replace(/\$(\d+)/g, function(e, t) {
2689 return r[parseInt(t, 10)]
2690 }),
2691 [[e.slice(0, r.index), n, e.slice(r.index + r[0].length)].join(""), t]
2692 }
2693 }
2694 }, {
2695 key: "render",
2696 value: function() {
2697 return this.strategy.template(this.data, this.term)
2698 }
2699 }]),
2700 e
2701 }());
2702 t.default = s
2703}
2704, function(e, t, n) {
2705 "use strict";
2706 function r(e, t) {
2707 if (!(e instanceof t))
2708 throw new TypeError("Cannot call a class as a function")
2709 }
2710 function i(e) {
2711 return e
2712 }
2713 Object.defineProperty(t, "__esModule", {
2714 value: !0
2715 });
2716 var o = function() {
2717 function e(e, t) {
2718 for (var n = 0; n < t.length; n++) {
2719 var r = t[n];
2720 r.enumerable = r.enumerable || !1,
2721 r.configurable = !0,
2722 "value"in r && (r.writable = !0),
2723 Object.defineProperty(e, r.key, r)
2724 }
2725 }
2726 return function(t, n, r) {
2727 return n && e(t.prototype, n),
2728 r && e(t, r),
2729 t
2730 }
2731 }()
2732 , s = n(12)
2733 , u = function(e) {
2734 return e && e.__esModule ? e : {
2735 default: e
2736 }
2737 }(s)
2738 , a = function() {
2739 function e(t) {
2740 r(this, e),
2741 this.props = t,
2742 this.cache = t.cache ? {} : null
2743 }
2744 return o(e, [{
2745 key: "destroy",
2746 value: function() {
2747 return this.cache = null,
2748 this
2749 }
2750 }, {
2751 key: "buildQuery",
2752 value: function(e) {
2753 if ("function" == typeof this.props.context) {
2754 var t = this.props.context(e);
2755 if ("string" == typeof t)
2756 e = t;
2757 else if (!t)
2758 return null
2759 }
2760 var n = this.matchText(e);
2761 return n ? new u.default(this,n[this.index],n) : null
2762 }
2763 }, {
2764 key: "search",
2765 value: function(e, t, n) {
2766 this.cache ? this.searchWithCache(e, t, n) : this.props.search(e, t, n)
2767 }
2768 }, {
2769 key: "replace",
2770 value: function(e) {
2771 return this.props.replace(e)
2772 }
2773 }, {
2774 key: "searchWithCache",
2775 value: function(e, t, n) {
2776 var r = this;
2777 this.cache && this.cache[e] ? t(this.cache[e]) : this.props.search(e, function(n) {
2778 r.cache && (r.cache[e] = n),
2779 t(n)
2780 }, n)
2781 }
2782 }, {
2783 key: "matchText",
2784 value: function(e) {
2785 return "function" == typeof this.match ? this.match(e) : e.match(this.match)
2786 }
2787 }, {
2788 key: "match",
2789 get: function() {
2790 return this.props.match
2791 }
2792 }, {
2793 key: "index",
2794 get: function() {
2795 return "number" == typeof this.props.index ? this.props.index : 2
2796 }
2797 }, {
2798 key: "template",
2799 get: function() {
2800 return this.props.template || i
2801 }
2802 }]),
2803 e
2804 }();
2805 t.default = a
2806}
2807, function(e) {
2808 "use strict";
2809 function t() {}
2810 function n(e, t, n) {
2811 this.fn = e,
2812 this.context = t,
2813 this.once = n || !1
2814 }
2815 function r() {
2816 this._events = new t,
2817 this._eventsCount = 0
2818 }
2819 var i = Object.prototype.hasOwnProperty
2820 , o = "~";
2821 Object.create && (t.prototype = Object.create(null),
2822 (new t).__proto__ || (o = !1)),
2823 r.prototype.eventNames = function() {
2824 var e, t, n = [];
2825 if (0 === this._eventsCount)
2826 return n;
2827 for (t in e = this._events)
2828 i.call(e, t) && n.push(o ? t.slice(1) : t);
2829 return Object.getOwnPropertySymbols ? n.concat(Object.getOwnPropertySymbols(e)) : n
2830 }
2831 ,
2832 r.prototype.listeners = function(e, t) {
2833 var n = o ? o + e : e
2834 , r = this._events[n];
2835 if (t)
2836 return !!r;
2837 if (!r)
2838 return [];
2839 if (r.fn)
2840 return [r.fn];
2841 for (var i = 0, s = r.length, u = new Array(s); i < s; i++)
2842 u[i] = r[i].fn;
2843 return u
2844 }
2845 ,
2846 r.prototype.emit = function(e, t, n, r, i, s) {
2847 var u = o ? o + e : e;
2848 if (!this._events[u])
2849 return !1;
2850 var a, l, c = this._events[u], h = arguments.length;
2851 if (c.fn) {
2852 switch (c.once && this.removeListener(e, c.fn, void 0, !0),
2853 h) {
2854 case 1:
2855 return c.fn.call(c.context),
2856 !0;
2857 case 2:
2858 return c.fn.call(c.context, t),
2859 !0;
2860 case 3:
2861 return c.fn.call(c.context, t, n),
2862 !0;
2863 case 4:
2864 return c.fn.call(c.context, t, n, r),
2865 !0;
2866 case 5:
2867 return c.fn.call(c.context, t, n, r, i),
2868 !0;
2869 case 6:
2870 return c.fn.call(c.context, t, n, r, i, s),
2871 !0
2872 }
2873 for (l = 1,
2874 a = new Array(h - 1); l < h; l++)
2875 a[l - 1] = arguments[l];
2876 c.fn.apply(c.context, a)
2877 } else {
2878 var f, d = c.length;
2879 for (l = 0; l < d; l++)
2880 switch (c[l].once && this.removeListener(e, c[l].fn, void 0, !0),
2881 h) {
2882 case 1:
2883 c[l].fn.call(c[l].context);
2884 break;
2885 case 2:
2886 c[l].fn.call(c[l].context, t);
2887 break;
2888 case 3:
2889 c[l].fn.call(c[l].context, t, n);
2890 break;
2891 case 4:
2892 c[l].fn.call(c[l].context, t, n, r);
2893 break;
2894 default:
2895 if (!a)
2896 for (f = 1,
2897 a = new Array(h - 1); f < h; f++)
2898 a[f - 1] = arguments[f];
2899 c[l].fn.apply(c[l].context, a)
2900 }
2901 }
2902 return !0
2903 }
2904 ,
2905 r.prototype.on = function(e, t, r) {
2906 var i = new n(t,r || this)
2907 , s = o ? o + e : e;
2908 return this._events[s] ? this._events[s].fn ? this._events[s] = [this._events[s], i] : this._events[s].push(i) : (this._events[s] = i,
2909 this._eventsCount++),
2910 this
2911 }
2912 ,
2913 r.prototype.once = function(e, t, r) {
2914 var i = new n(t,r || this,!0)
2915 , s = o ? o + e : e;
2916 return this._events[s] ? this._events[s].fn ? this._events[s] = [this._events[s], i] : this._events[s].push(i) : (this._events[s] = i,
2917 this._eventsCount++),
2918 this
2919 }
2920 ,
2921 r.prototype.removeListener = function(e, n, r, i) {
2922 var s = o ? o + e : e;
2923 if (!this._events[s])
2924 return this;
2925 if (!n)
2926 return 0 == --this._eventsCount ? this._events = new t : delete this._events[s],
2927 this;
2928 var u = this._events[s];
2929 if (u.fn)
2930 u.fn !== n || i && !u.once || r && u.context !== r || (0 == --this._eventsCount ? this._events = new t : delete this._events[s]);
2931 else {
2932 for (var a = 0, l = [], c = u.length; a < c; a++)
2933 (u[a].fn !== n || i && !u[a].once || r && u[a].context !== r) && l.push(u[a]);
2934 l.length ? this._events[s] = 1 === l.length ? l[0] : l : 0 == --this._eventsCount ? this._events = new t : delete this._events[s]
2935 }
2936 return this
2937 }
2938 ,
2939 r.prototype.removeAllListeners = function(e) {
2940 var n;
2941 return e ? (n = o ? o + e : e,
2942 this._events[n] && (0 == --this._eventsCount ? this._events = new t : delete this._events[n])) : (this._events = new t,
2943 this._eventsCount = 0),
2944 this
2945 }
2946 ,
2947 r.prototype.off = r.prototype.removeListener,
2948 r.prototype.addListener = r.prototype.on,
2949 r.prototype.setMaxListeners = function() {
2950 return this
2951 }
2952 ,
2953 r.prefixed = o,
2954 r.EventEmitter = r,
2955 e.exports = r
2956}
2957, function(e, t) {
2958 "use strict";
2959 function n(e) {
2960 var t = e.getBoundingClientRect()
2961 , n = e.ownerDocument
2962 , r = n.defaultView
2963 , i = n.documentElement
2964 , o = {
2965 top: t.top + r.pageYOffset,
2966 left: t.left + r.pageXOffset
2967 };
2968 return i && (o.top -= i.clientTop,
2969 o.left -= i.clientLeft),
2970 o
2971 }
2972 function r(e) {
2973 return e >= o && e <= s
2974 }
2975 function i(e) {
2976 var t = window.getComputedStyle(e);
2977 if (r(t.lineHeight.charCodeAt(0)))
2978 return r(t.lineHeight.charCodeAt(t.lineHeight.length - 1)) ? parseFloat(t.lineHeight) * parseFloat(t.fontSize) : parseFloat(t.lineHeight);
2979 var n = document.body;
2980 if (!n)
2981 return 0;
2982 var i = document.createElement(e.nodeName);
2983 i.innerHTML = " ",
2984 i.style.fontSize = t.fontSize,
2985 i.style.fontFamily = t.fontFamily,
2986 n.appendChild(i);
2987 var o = i.offsetHeight;
2988 return n.removeChild(i),
2989 o
2990 }
2991 Object.defineProperty(t, "__esModule", {
2992 value: !0
2993 }),
2994 t.calculateElementOffset = n,
2995 t.getLineHeightPx = i;
2996 var o = (t.createCustomEvent = function() {
2997 return "function" == typeof window.CustomEvent ? function(e, t) {
2998 return new document.defaultView.CustomEvent(e,{
2999 cancelable: t && t.cancelable || !1,
3000 detail: t && t.detail || void 0
3001 })
3002 }
3003 : function(e, t) {
3004 var n = document.createEvent("CustomEvent");
3005 return n.initCustomEvent(e, !1, t && t.cancelable || !1, t && t.detail || void 0),
3006 n
3007 }
3008 }(),
3009 "0".charCodeAt(0))
3010 , s = "9".charCodeAt(0)
3011}
3012, function(e, t, n) {
3013 "use strict";
3014 function r(e) {
3015 return e && e.__esModule ? e : {
3016 default: e
3017 }
3018 }
3019 function i(e, t) {
3020 if (!(e instanceof t))
3021 throw new TypeError("Cannot call a class as a function")
3022 }
3023 function o(e, t) {
3024 if (!e)
3025 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3026 return !t || "object" != typeof t && "function" != typeof t ? e : t
3027 }
3028 function s(e, t) {
3029 if ("function" != typeof t && null !== t)
3030 throw new TypeError("Super expression must either be null or a function, not " + typeof t);
3031 e.prototype = Object.create(t && t.prototype, {
3032 constructor: {
3033 value: e,
3034 enumerable: !1,
3035 writable: !0,
3036 configurable: !0
3037 }
3038 }),
3039 t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
3040 }
3041 Object.defineProperty(t, "__esModule", {
3042 value: !0
3043 });
3044 var u = function() {
3045 function e(e, t) {
3046 for (var n = 0; n < t.length; n++) {
3047 var r = t[n];
3048 r.enumerable = r.enumerable || !1,
3049 r.configurable = !0,
3050 "value"in r && (r.writable = !0),
3051 Object.defineProperty(e, r.key, r)
3052 }
3053 }
3054 return function(t, n, r) {
3055 return n && e(t.prototype, n),
3056 r && e(t, r),
3057 t
3058 }
3059 }()
3060 , a = n(2)
3061 , l = r(a)
3062 , c = n(10)
3063 , h = r(c)
3064 , f = n(0)
3065 , d = (r(f),
3066 n(3))
3067 , p = "dropdown-menu textcomplete-dropdown"
3068 , v = function(e) {
3069 function t(e) {
3070 i(this, t);
3071 var n = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
3072 n.shown = !1,
3073 n.items = [],
3074 n.footer = e.footer,
3075 n.header = e.header,
3076 n.maxCount = e.maxCount || 10,
3077 n.el.className = e.className || p,
3078 n.rotate = !e.hasOwnProperty("rotate") || e.rotate,
3079 n.placement = e.placement;
3080 var r = e.style;
3081 return r && Object.keys(r).forEach(function(e) {
3082 n.el.style[e] = r[e]
3083 }),
3084 n
3085 }
3086 return s(t, e),
3087 u(t, null, [{
3088 key: "createElement",
3089 value: function() {
3090 var e = document.createElement("ul")
3091 , t = e.style;
3092 t.display = "none",
3093 t.position = "absolute",
3094 t.zIndex = "10000";
3095 var n = document.body;
3096 return n && n.appendChild(e),
3097 e
3098 }
3099 }]),
3100 u(t, [{
3101 key: "destroy",
3102 value: function() {
3103 var e = this.el.parentNode;
3104 return e && e.removeChild(this.el),
3105 this.clear()._el = null,
3106 this
3107 }
3108 }, {
3109 key: "render",
3110 value: function(e, t) {
3111 var n = (0,
3112 d.createCustomEvent)("render", {
3113 cancelable: !0
3114 });
3115 if (this.emit("render", n),
3116 n.defaultPrevented)
3117 return this;
3118 var r = e.map(function(e) {
3119 return e.data
3120 })
3121 , i = e.slice(0, this.maxCount || e.length).map(function(e) {
3122 return new h.default(e)
3123 });
3124 return this.clear().setStrategyId(e[0]).renderEdge(r, "header").append(i).renderEdge(r, "footer").setOffset(t).show(),
3125 this.emit("rendered", (0,
3126 d.createCustomEvent)("rendered")),
3127 this
3128 }
3129 }, {
3130 key: "deactivate",
3131 value: function() {
3132 return this.hide().clear()
3133 }
3134 }, {
3135 key: "select",
3136 value: function(e) {
3137 var t = {
3138 searchResult: e.searchResult
3139 }
3140 , n = (0,
3141 d.createCustomEvent)("select", {
3142 cancelable: !0,
3143 detail: t
3144 });
3145 return this.emit("select", n),
3146 n.defaultPrevented ? this : (this.deactivate(),
3147 this.emit("selected", (0,
3148 d.createCustomEvent)("selected", {
3149 detail: t
3150 })),
3151 this)
3152 }
3153 }, {
3154 key: "up",
3155 value: function(e) {
3156 return this.shown ? this.moveActiveItem("prev", e) : this
3157 }
3158 }, {
3159 key: "down",
3160 value: function(e) {
3161 return this.shown ? this.moveActiveItem("next", e) : this
3162 }
3163 }, {
3164 key: "getActiveItem",
3165 value: function() {
3166 return this.items.find(function(e) {
3167 return e.active
3168 })
3169 }
3170 }, {
3171 key: "append",
3172 value: function(e) {
3173 var t = this
3174 , n = document.createDocumentFragment();
3175 return e.forEach(function(e) {
3176 t.items.push(e),
3177 e.appended(t),
3178 n.appendChild(e.el)
3179 }),
3180 this.el.appendChild(n),
3181 this
3182 }
3183 }, {
3184 key: "setOffset",
3185 value: function(e) {
3186 if (e.left ? this.el.style.left = e.left + "px" : e.right && (this.el.style.right = e.right + "px"),
3187 this.isPlacementTop()) {
3188 var t = document.documentElement;
3189 t && (this.el.style.bottom = t.clientHeight - e.top + e.lineHeight + "px")
3190 } else
3191 this.el.style.top = e.top + "px";
3192 return this
3193 }
3194 }, {
3195 key: "show",
3196 value: function() {
3197 if (!this.shown) {
3198 var e = (0,
3199 d.createCustomEvent)("show", {
3200 cancelable: !0
3201 });
3202 if (this.emit("show", e),
3203 e.defaultPrevented)
3204 return this;
3205 this.el.style.display = "block",
3206 this.shown = !0,
3207 this.emit("shown", (0,
3208 d.createCustomEvent)("shown"))
3209 }
3210 return this
3211 }
3212 }, {
3213 key: "hide",
3214 value: function() {
3215 if (this.shown) {
3216 var e = (0,
3217 d.createCustomEvent)("hide", {
3218 cancelable: !0
3219 });
3220 if (this.emit("hide", e),
3221 e.defaultPrevented)
3222 return this;
3223 this.el.style.display = "none",
3224 this.shown = !1,
3225 this.emit("hidden", (0,
3226 d.createCustomEvent)("hidden"))
3227 }
3228 return this
3229 }
3230 }, {
3231 key: "clear",
3232 value: function() {
3233 return this.el.innerHTML = "",
3234 this.items.forEach(function(e) {
3235 return e.destroy()
3236 }),
3237 this.items = [],
3238 this
3239 }
3240 }, {
3241 key: "moveActiveItem",
3242 value: function(e, t) {
3243 var n = this.getActiveItem()
3244 , r = void 0;
3245 return r = n ? n[e] : "next" === e ? this.items[0] : this.items[this.items.length - 1],
3246 r && (r.activate(),
3247 t.preventDefault()),
3248 this
3249 }
3250 }, {
3251 key: "setStrategyId",
3252 value: function(e) {
3253 var t = e && e.strategy.props.id;
3254 return t ? this.el.setAttribute("data-strategy", t) : this.el.removeAttribute("data-strategy"),
3255 this
3256 }
3257 }, {
3258 key: "renderEdge",
3259 value: function(e, t) {
3260 var n = ("header" === t ? this.header : this.footer) || ""
3261 , r = "function" == typeof n ? n(e) : n
3262 , i = document.createElement("li");
3263 return i.classList.add("textcomplete-" + t),
3264 i.innerHTML = r,
3265 this.el.appendChild(i),
3266 this
3267 }
3268 }, {
3269 key: "isPlacementTop",
3270 value: function() {
3271 return "top" === this.placement
3272 }
3273 }, {
3274 key: "el",
3275 get: function() {
3276 return this._el || (this._el = t.createElement()),
3277 this._el
3278 }
3279 }]),
3280 t
3281 }(l.default);
3282 t.default = v
3283}
3284, function(e, t, n) {
3285 "use strict";
3286 function r(e) {
3287 return e && e.__esModule ? e : {
3288 default: e
3289 }
3290 }
3291 function i(e, t) {
3292 if (!(e instanceof t))
3293 throw new TypeError("Cannot call a class as a function")
3294 }
3295 function o(e, t) {
3296 if (!e)
3297 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3298 return !t || "object" != typeof t && "function" != typeof t ? e : t
3299 }
3300 function s(e, t) {
3301 if ("function" != typeof t && null !== t)
3302 throw new TypeError("Super expression must either be null or a function, not " + typeof t);
3303 e.prototype = Object.create(t && t.prototype, {
3304 constructor: {
3305 value: e,
3306 enumerable: !1,
3307 writable: !0,
3308 configurable: !0
3309 }
3310 }),
3311 t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
3312 }
3313 Object.defineProperty(t, "__esModule", {
3314 value: !0
3315 });
3316 var u = function() {
3317 function e(e, t) {
3318 for (var n = 0; n < t.length; n++) {
3319 var r = t[n];
3320 r.enumerable = r.enumerable || !1,
3321 r.configurable = !0,
3322 "value"in r && (r.writable = !0),
3323 Object.defineProperty(e, r.key, r)
3324 }
3325 }
3326 return function(t, n, r) {
3327 return n && e(t.prototype, n),
3328 r && e(t, r),
3329 t
3330 }
3331 }()
3332 , a = n(2)
3333 , l = r(a)
3334 , c = n(3)
3335 , h = n(0)
3336 , f = (r(h),
3337 function(e) {
3338 function t() {
3339 return i(this, t),
3340 o(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments))
3341 }
3342 return s(t, e),
3343 u(t, [{
3344 key: "destroy",
3345 value: function() {
3346 return this
3347 }
3348 }, {
3349 key: "applySearchResult",
3350 value: function() {
3351 throw new Error("Not implemented.")
3352 }
3353 }, {
3354 key: "getCursorOffset",
3355 value: function() {
3356 throw new Error("Not implemented.")
3357 }
3358 }, {
3359 key: "getBeforeCursor",
3360 value: function() {
3361 throw new Error("Not implemented.")
3362 }
3363 }, {
3364 key: "emitMoveEvent",
3365 value: function(e) {
3366 var t = (0,
3367 c.createCustomEvent)("move", {
3368 cancelable: !0,
3369 detail: {
3370 code: e
3371 }
3372 });
3373 return this.emit("move", t),
3374 t
3375 }
3376 }, {
3377 key: "emitEnterEvent",
3378 value: function() {
3379 var e = (0,
3380 c.createCustomEvent)("enter", {
3381 cancelable: !0
3382 });
3383 return this.emit("enter", e),
3384 e
3385 }
3386 }, {
3387 key: "emitChangeEvent",
3388 value: function() {
3389 var e = (0,
3390 c.createCustomEvent)("change", {
3391 detail: {
3392 beforeCursor: this.getBeforeCursor()
3393 }
3394 });
3395 return this.emit("change", e),
3396 e
3397 }
3398 }, {
3399 key: "emitEscEvent",
3400 value: function() {
3401 var e = (0,
3402 c.createCustomEvent)("esc", {
3403 cancelable: !0
3404 });
3405 return this.emit("esc", e),
3406 e
3407 }
3408 }, {
3409 key: "getCode",
3410 value: function(e) {
3411 return 9 === e.keyCode ? "ENTER" : 13 === e.keyCode ? "ENTER" : 27 === e.keyCode ? "ESC" : 38 === e.keyCode ? "UP" : 40 === e.keyCode ? "DOWN" : 78 === e.keyCode && e.ctrlKey ? "DOWN" : 80 === e.keyCode && e.ctrlKey ? "UP" : "OTHER"
3412 }
3413 }]),
3414 t
3415 }(l.default));
3416 t.default = f
3417}
3418, function(e, t, n) {
3419 "use strict";
3420 function r(e) {
3421 return e && e.__esModule ? e : {
3422 default: e
3423 }
3424 }
3425 function i(e, t) {
3426 if (!(e instanceof t))
3427 throw new TypeError("Cannot call a class as a function")
3428 }
3429 function o(e, t) {
3430 if (!e)
3431 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3432 return !t || "object" != typeof t && "function" != typeof t ? e : t
3433 }
3434 function s(e, t) {
3435 if ("function" != typeof t && null !== t)
3436 throw new TypeError("Super expression must either be null or a function, not " + typeof t);
3437 e.prototype = Object.create(t && t.prototype, {
3438 constructor: {
3439 value: e,
3440 enumerable: !1,
3441 writable: !0,
3442 configurable: !0
3443 }
3444 }),
3445 t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
3446 }
3447 Object.defineProperty(t, "__esModule", {
3448 value: !0
3449 });
3450 var u = function() {
3451 function e(e, t) {
3452 for (var n = 0; n < t.length; n++) {
3453 var r = t[n];
3454 r.enumerable = r.enumerable || !1,
3455 r.configurable = !0,
3456 "value"in r && (r.writable = !0),
3457 Object.defineProperty(e, r.key, r)
3458 }
3459 }
3460 return function(t, n, r) {
3461 return n && e(t.prototype, n),
3462 r && e(t, r),
3463 t
3464 }
3465 }()
3466 , a = function e(t, n, r) {
3467 null === t && (t = Function.prototype);
3468 var i = Object.getOwnPropertyDescriptor(t, n);
3469 if (void 0 === i) {
3470 var o = Object.getPrototypeOf(t);
3471 return null === o ? void 0 : e(o, n, r)
3472 }
3473 if ("value"in i)
3474 return i.value;
3475 var s = i.get;
3476 if (void 0 !== s)
3477 return s.call(r)
3478 }
3479 , l = n(14)
3480 , c = r(l)
3481 , h = n(5)
3482 , f = r(h)
3483 , d = n(3)
3484 , p = n(0)
3485 , v = (r(p),
3486 n(13))
3487 , y = ["onInput", "onKeydown"]
3488 , m = function(e) {
3489 function t(e) {
3490 i(this, t);
3491 var n = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
3492 return n.el = e,
3493 y.forEach(function(e) {
3494 n[e] = n[e].bind(n)
3495 }),
3496 n.startListening(),
3497 n
3498 }
3499 return s(t, e),
3500 u(t, [{
3501 key: "destroy",
3502 value: function() {
3503 return a(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "destroy", this).call(this),
3504 this.stopListening(),
3505 this.el = null,
3506 this
3507 }
3508 }, {
3509 key: "applySearchResult",
3510 value: function(e) {
3511 var t = this.getBeforeCursor();
3512 if (null != t) {
3513 var n = e.replace(t, this.getAfterCursor());
3514 this.el.focus(),
3515 Array.isArray(n) && ((0,
3516 c.default)(this.el, n[0], n[1]),
3517 this.el.dispatchEvent(new Event("input")))
3518 }
3519 }
3520 }, {
3521 key: "getCursorOffset",
3522 value: function() {
3523 var e = (0,
3524 d.calculateElementOffset)(this.el)
3525 , t = this.getElScroll()
3526 , n = this.getCursorPosition()
3527 , r = (0,
3528 d.getLineHeightPx)(this.el)
3529 , i = e.top - t.top + n.top + r
3530 , o = e.left - t.left + n.left;
3531 return "rtl" !== this.el.dir ? {
3532 top: i,
3533 left: o,
3534 lineHeight: r
3535 } : {
3536 top: i,
3537 right: document.documentElement ? document.documentElement.clientWidth - o : 0,
3538 lineHeight: r
3539 }
3540 }
3541 }, {
3542 key: "getBeforeCursor",
3543 value: function() {
3544 return this.el.selectionStart !== this.el.selectionEnd ? null : this.el.value.substring(0, this.el.selectionEnd)
3545 }
3546 }, {
3547 key: "getAfterCursor",
3548 value: function() {
3549 return this.el.value.substring(this.el.selectionEnd)
3550 }
3551 }, {
3552 key: "getElScroll",
3553 value: function() {
3554 return {
3555 top: this.el.scrollTop,
3556 left: this.el.scrollLeft
3557 }
3558 }
3559 }, {
3560 key: "getCursorPosition",
3561 value: function() {
3562 return v(this.el, this.el.selectionEnd)
3563 }
3564 }, {
3565 key: "onInput",
3566 value: function() {
3567 this.emitChangeEvent()
3568 }
3569 }, {
3570 key: "onKeydown",
3571 value: function(e) {
3572 var t = this.getCode(e)
3573 , n = void 0;
3574 "UP" === t || "DOWN" === t ? n = this.emitMoveEvent(t) : "ENTER" === t ? n = this.emitEnterEvent() : "ESC" === t && (n = this.emitEscEvent()),
3575 n && n.defaultPrevented && e.preventDefault()
3576 }
3577 }, {
3578 key: "startListening",
3579 value: function() {
3580 this.el.addEventListener("input", this.onInput),
3581 this.el.addEventListener("keydown", this.onKeydown)
3582 }
3583 }, {
3584 key: "stopListening",
3585 value: function() {
3586 this.el.removeEventListener("input", this.onInput),
3587 this.el.removeEventListener("keydown", this.onKeydown)
3588 }
3589 }]),
3590 t
3591 }(f.default);
3592 t.default = m
3593}
3594, function(e, t, n) {
3595 "use strict";
3596 function r(e) {
3597 return e && e.__esModule ? e : {
3598 default: e
3599 }
3600 }
3601 function i(e, t) {
3602 if (!(e instanceof t))
3603 throw new TypeError("Cannot call a class as a function")
3604 }
3605 function o(e, t) {
3606 if (!e)
3607 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3608 return !t || "object" != typeof t && "function" != typeof t ? e : t
3609 }
3610 function s(e, t) {
3611 if ("function" != typeof t && null !== t)
3612 throw new TypeError("Super expression must either be null or a function, not " + typeof t);
3613 e.prototype = Object.create(t && t.prototype, {
3614 constructor: {
3615 value: e,
3616 enumerable: !1,
3617 writable: !0,
3618 configurable: !0
3619 }
3620 }),
3621 t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
3622 }
3623 Object.defineProperty(t, "__esModule", {
3624 value: !0
3625 });
3626 var u = function() {
3627 function e(e, t) {
3628 for (var n = 0; n < t.length; n++) {
3629 var r = t[n];
3630 r.enumerable = r.enumerable || !1,
3631 r.configurable = !0,
3632 "value"in r && (r.writable = !0),
3633 Object.defineProperty(e, r.key, r)
3634 }
3635 }
3636 return function(t, n, r) {
3637 return n && e(t.prototype, n),
3638 r && e(t, r),
3639 t
3640 }
3641 }()
3642 , a = n(9)
3643 , l = r(a)
3644 , c = n(5)
3645 , h = (r(c),
3646 n(4))
3647 , f = r(h)
3648 , d = n(1)
3649 , p = r(d)
3650 , v = n(0)
3651 , y = (r(v),
3652 n(2))
3653 , m = r(y)
3654 , g = ["handleChange", "handleEnter", "handleEsc", "handleHit", "handleMove", "handleSelect"]
3655 , b = function(e) {
3656 function t(e) {
3657 var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3658 i(this, t);
3659 var r = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
3660 return r.completer = new l.default,
3661 r.isQueryInFlight = !1,
3662 r.nextPendingQuery = null,
3663 r.dropdown = new f.default(n.dropdown || {}),
3664 r.editor = e,
3665 r.options = n,
3666 g.forEach(function(e) {
3667 r[e] = r[e].bind(r)
3668 }),
3669 r.startListening(),
3670 r
3671 }
3672 return s(t, e),
3673 u(t, [{
3674 key: "destroy",
3675 value: function() {
3676 var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
3677 return this.completer.destroy(),
3678 this.dropdown.destroy(),
3679 e && this.editor.destroy(),
3680 this.stopListening(),
3681 this
3682 }
3683 }, {
3684 key: "register",
3685 value: function(e) {
3686 var t = this;
3687 return e.forEach(function(e) {
3688 t.completer.registerStrategy(new p.default(e))
3689 }),
3690 this
3691 }
3692 }, {
3693 key: "trigger",
3694 value: function(e) {
3695 return this.isQueryInFlight ? this.nextPendingQuery = e : (this.isQueryInFlight = !0,
3696 this.nextPendingQuery = null,
3697 this.completer.run(e)),
3698 this
3699 }
3700 }, {
3701 key: "handleHit",
3702 value: function(e) {
3703 var t = e.searchResults;
3704 t.length ? this.dropdown.render(t, this.editor.getCursorOffset()) : this.dropdown.deactivate(),
3705 this.isQueryInFlight = !1,
3706 null !== this.nextPendingQuery && this.trigger(this.nextPendingQuery)
3707 }
3708 }, {
3709 key: "handleMove",
3710 value: function(e) {
3711 "UP" === e.detail.code ? this.dropdown.up(e) : this.dropdown.down(e)
3712 }
3713 }, {
3714 key: "handleEnter",
3715 value: function(e) {
3716 var t = this.dropdown.getActiveItem();
3717 t ? (this.dropdown.select(t),
3718 e.preventDefault()) : this.dropdown.deactivate()
3719 }
3720 }, {
3721 key: "handleEsc",
3722 value: function(e) {
3723 this.dropdown.shown && (this.dropdown.deactivate(),
3724 e.preventDefault())
3725 }
3726 }, {
3727 key: "handleChange",
3728 value: function(e) {
3729 null != e.detail.beforeCursor ? this.trigger(e.detail.beforeCursor) : this.dropdown.deactivate()
3730 }
3731 }, {
3732 key: "handleSelect",
3733 value: function(e) {
3734 this.emit("select", e),
3735 e.defaultPrevented || this.editor.applySearchResult(e.detail.searchResult)
3736 }
3737 }, {
3738 key: "startListening",
3739 value: function() {
3740 var e = this;
3741 this.editor.on("move", this.handleMove).on("enter", this.handleEnter).on("esc", this.handleEsc).on("change", this.handleChange),
3742 this.dropdown.on("select", this.handleSelect),
3743 ["show", "shown", "render", "rendered", "selected", "hidden", "hide"].forEach(function(t) {
3744 e.dropdown.on(t, function() {
3745 return e.emit(t)
3746 })
3747 }),
3748 this.completer.on("hit", this.handleHit)
3749 }
3750 }, {
3751 key: "stopListening",
3752 value: function() {
3753 this.completer.removeAllListeners(),
3754 this.dropdown.removeAllListeners(),
3755 this.editor.removeListener("move", this.handleMove).removeListener("enter", this.handleEnter).removeListener("esc", this.handleEsc).removeListener("change", this.handleChange)
3756 }
3757 }]),
3758 t
3759 }(m.default);
3760 t.default = b
3761}
3762, function(e) {
3763 var t;
3764 t = function() {
3765 return this
3766 }();
3767 try {
3768 t = t || Function("return this")() || (0,
3769 eval)("this")
3770 } catch (e) {
3771 "object" == typeof window && (t = window)
3772 }
3773 e.exports = t
3774}
3775, function(e, t, n) {
3776 "use strict";
3777 function r(e) {
3778 return e && e.__esModule ? e : {
3779 default: e
3780 }
3781 }
3782 function i(e, t) {
3783 if (!(e instanceof t))
3784 throw new TypeError("Cannot call a class as a function")
3785 }
3786 function o(e, t) {
3787 if (!e)
3788 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3789 return !t || "object" != typeof t && "function" != typeof t ? e : t
3790 }
3791 function s(e, t) {
3792 if ("function" != typeof t && null !== t)
3793 throw new TypeError("Super expression must either be null or a function, not " + typeof t);
3794 e.prototype = Object.create(t && t.prototype, {
3795 constructor: {
3796 value: e,
3797 enumerable: !1,
3798 writable: !0,
3799 configurable: !0
3800 }
3801 }),
3802 t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
3803 }
3804 Object.defineProperty(t, "__esModule", {
3805 value: !0
3806 });
3807 var u = function() {
3808 function e(e, t) {
3809 for (var n = 0; n < t.length; n++) {
3810 var r = t[n];
3811 r.enumerable = r.enumerable || !1,
3812 r.configurable = !0,
3813 "value"in r && (r.writable = !0),
3814 Object.defineProperty(e, r.key, r)
3815 }
3816 }
3817 return function(t, n, r) {
3818 return n && e(t.prototype, n),
3819 r && e(t, r),
3820 t
3821 }
3822 }()
3823 , a = n(2)
3824 , l = r(a)
3825 , c = n(1)
3826 , h = (r(c),
3827 n(0))
3828 , f = (r(h),
3829 ["handleQueryResult"])
3830 , d = function(e) {
3831 function t() {
3832 i(this, t);
3833 var e = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
3834 return e.strategies = [],
3835 f.forEach(function(t) {
3836 e[t] = e[t].bind(e)
3837 }),
3838 e
3839 }
3840 return s(t, e),
3841 u(t, [{
3842 key: "destroy",
3843 value: function() {
3844 return this.strategies.forEach(function(e) {
3845 return e.destroy()
3846 }),
3847 this
3848 }
3849 }, {
3850 key: "registerStrategy",
3851 value: function(e) {
3852 return this.strategies.push(e),
3853 this
3854 }
3855 }, {
3856 key: "run",
3857 value: function(e) {
3858 var t = this.extractQuery(e);
3859 t ? t.execute(this.handleQueryResult) : this.handleQueryResult([])
3860 }
3861 }, {
3862 key: "extractQuery",
3863 value: function(e) {
3864 for (var t = 0; t < this.strategies.length; t++) {
3865 var n = this.strategies[t].buildQuery(e);
3866 if (n)
3867 return n
3868 }
3869 return null
3870 }
3871 }, {
3872 key: "handleQueryResult",
3873 value: function(e) {
3874 this.emit("hit", {
3875 searchResults: e
3876 })
3877 }
3878 }]),
3879 t
3880 }(l.default);
3881 t.default = d
3882}
3883, function(e, t, n) {
3884 "use strict";
3885 function r(e) {
3886 return e && e.__esModule ? e : {
3887 default: e
3888 }
3889 }
3890 function i(e, t) {
3891 if (!(e instanceof t))
3892 throw new TypeError("Cannot call a class as a function")
3893 }
3894 Object.defineProperty(t, "__esModule", {
3895 value: !0
3896 }),
3897 t.CLASS_NAME = void 0;
3898 var o = function() {
3899 function e(e, t) {
3900 for (var n = 0; n < t.length; n++) {
3901 var r = t[n];
3902 r.enumerable = r.enumerable || !1,
3903 r.configurable = !0,
3904 "value"in r && (r.writable = !0),
3905 Object.defineProperty(e, r.key, r)
3906 }
3907 }
3908 return function(t, n, r) {
3909 return n && e(t.prototype, n),
3910 r && e(t, r),
3911 t
3912 }
3913 }()
3914 , s = n(4)
3915 , u = (r(s),
3916 n(0))
3917 , a = (r(u),
3918 t.CLASS_NAME = "textcomplete-item")
3919 , l = a + " active"
3920 , c = ["onClick", "onMouseover"]
3921 , h = function() {
3922 function e(t) {
3923 var n = this;
3924 i(this, e),
3925 this.searchResult = t,
3926 this.active = !1,
3927 c.forEach(function(e) {
3928 n[e] = n[e].bind(n)
3929 })
3930 }
3931 return o(e, [{
3932 key: "destroy",
3933 value: function() {
3934 this.el.removeEventListener("mousedown", this.onClick, !1),
3935 this.el.removeEventListener("mouseover", this.onMouseover, !1),
3936 this.el.removeEventListener("touchstart", this.onClick, !1),
3937 this._el = null
3938 }
3939 }, {
3940 key: "appended",
3941 value: function(e) {
3942 this.dropdown = e,
3943 this.siblings = e.items,
3944 this.index = this.siblings.length - 1
3945 }
3946 }, {
3947 key: "activate",
3948 value: function() {
3949 if (!this.active) {
3950 var e = this.dropdown.getActiveItem();
3951 e && e.deactivate(),
3952 this.active = !0,
3953 this.el.className = l
3954 }
3955 return this
3956 }
3957 }, {
3958 key: "deactivate",
3959 value: function() {
3960 return this.active && (this.active = !1,
3961 this.el.className = a),
3962 this
3963 }
3964 }, {
3965 key: "onClick",
3966 value: function(e) {
3967 e.preventDefault(),
3968 this.dropdown.select(this)
3969 }
3970 }, {
3971 key: "onMouseover",
3972 value: function() {
3973 this.activate()
3974 }
3975 }, {
3976 key: "el",
3977 get: function() {
3978 if (this._el)
3979 return this._el;
3980 var e = document.createElement("li");
3981 e.className = this.active ? l : a;
3982 var t = document.createElement("a");
3983 return t.innerHTML = this.searchResult.render(),
3984 e.appendChild(t),
3985 this._el = e,
3986 e.addEventListener("mousedown", this.onClick),
3987 e.addEventListener("mouseover", this.onMouseover),
3988 e.addEventListener("touchstart", this.onClick),
3989 e
3990 }
3991 }, {
3992 key: "next",
3993 get: function() {
3994 var e = void 0;
3995 if (this.index === this.siblings.length - 1) {
3996 if (!this.dropdown.rotate)
3997 return null;
3998 e = 0
3999 } else
4000 e = this.index + 1;
4001 return this.siblings[e]
4002 }
4003 }, {
4004 key: "prev",
4005 get: function() {
4006 var e = void 0;
4007 if (0 === this.index) {
4008 if (!this.dropdown.rotate)
4009 return null;
4010 e = this.siblings.length - 1
4011 } else
4012 e = this.index - 1;
4013 return this.siblings[e]
4014 }
4015 }]),
4016 e
4017 }();
4018 t.default = h
4019}
4020, function(e, t, n) {
4021 "use strict";
4022 (function(e) {
4023 function t(e) {
4024 return e && e.__esModule ? e : {
4025 default: e
4026 }
4027 }
4028 var r = n(7)
4029 , i = t(r)
4030 , o = n(6)
4031 , s = t(o)
4032 , u = void 0;
4033 u = e.Textcomplete && e.Textcomplete.editors ? e.Textcomplete.editors : {},
4034 u.Textarea = s.default,
4035 e.Textcomplete = i.default,
4036 e.Textcomplete.editors = u
4037 }
4038 ).call(t, n(8))
4039}
4040, function(e, t, n) {
4041 "use strict";
4042 function r(e) {
4043 return e && e.__esModule ? e : {
4044 default: e
4045 }
4046 }
4047 function i(e, t) {
4048 if (!(e instanceof t))
4049 throw new TypeError("Cannot call a class as a function")
4050 }
4051 Object.defineProperty(t, "__esModule", {
4052 value: !0
4053 });
4054 var o = function() {
4055 function e(e, t) {
4056 for (var n = 0; n < t.length; n++) {
4057 var r = t[n];
4058 r.enumerable = r.enumerable || !1,
4059 r.configurable = !0,
4060 "value"in r && (r.writable = !0),
4061 Object.defineProperty(e, r.key, r)
4062 }
4063 }
4064 return function(t, n, r) {
4065 return n && e(t.prototype, n),
4066 r && e(t, r),
4067 t
4068 }
4069 }()
4070 , s = n(0)
4071 , u = r(s)
4072 , a = n(1)
4073 , l = (r(a),
4074 function() {
4075 function e(t, n, r) {
4076 i(this, e),
4077 this.strategy = t,
4078 this.term = n,
4079 this.match = r
4080 }
4081 return o(e, [{
4082 key: "execute",
4083 value: function(e) {
4084 var t = this;
4085 this.strategy.search(this.term, function(n) {
4086 e(n.map(function(e) {
4087 return new u.default(e,t.term,t.strategy)
4088 }))
4089 }, this.match)
4090 }
4091 }]),
4092 e
4093 }());
4094 t.default = l
4095}
4096, function(e) {
4097 !function() {
4098 function t(e, t, o) {
4099 if (!r)
4100 throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");
4101 var s = o && o.debug || !1;
4102 if (s) {
4103 var u = document.querySelector("#input-textarea-caret-position-mirror-div");
4104 u && u.parentNode.removeChild(u)
4105 }
4106 var a = document.createElement("div");
4107 a.id = "input-textarea-caret-position-mirror-div",
4108 document.body.appendChild(a);
4109 var l = a.style
4110 , c = window.getComputedStyle ? getComputedStyle(e) : e.currentStyle;
4111 l.whiteSpace = "pre-wrap",
4112 "INPUT" !== e.nodeName && (l.wordWrap = "break-word"),
4113 l.position = "absolute",
4114 s || (l.visibility = "hidden"),
4115 n.forEach(function(e) {
4116 l[e] = c[e]
4117 }),
4118 i ? e.scrollHeight > parseInt(c.height) && (l.overflowY = "scroll") : l.overflow = "hidden",
4119 a.textContent = e.value.substring(0, t),
4120 "INPUT" === e.nodeName && (a.textContent = a.textContent.replace(/\s/g, "Â "));
4121 var h = document.createElement("span");
4122 h.textContent = e.value.substring(t) || ".",
4123 a.appendChild(h);
4124 var f = {
4125 top: h.offsetTop + parseInt(c.borderTopWidth),
4126 left: h.offsetLeft + parseInt(c.borderLeftWidth)
4127 };
4128 return s ? h.style.backgroundColor = "#aaa" : document.body.removeChild(a),
4129 f
4130 }
4131 var n = ["direction", "boxSizing", "width", "height", "overflowX", "overflowY", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "borderStyle", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "fontStyle", "fontVariant", "fontWeight", "fontStretch", "fontSize", "fontSizeAdjust", "lineHeight", "fontFamily", "textAlign", "textTransform", "textIndent", "textDecoration", "letterSpacing", "wordSpacing", "tabSize", "MozTabSize"]
4132 , r = "undefined" != typeof window
4133 , i = r && null != window.mozInnerScreenX;
4134 void 0 !== e && void 0 !== e.exports ? e.exports = t : r && (window.getCaretCoordinates = t)
4135 }()
4136}
4137, function(e, t) {
4138 "use strict";
4139 Object.defineProperty(t, "__esModule", {
4140 value: !0
4141 }),
4142 t.default = function(e, t, n) {
4143 for (var r = e.value, i = t + (n || ""), o = document.activeElement, s = 0, u = 0; r[s] === i[s]; )
4144 s++;
4145 for (; r[r.length - u - 1] === i[i.length - u - 1]; )
4146 u++;
4147 s = Math.min(s, r.length - u),
4148 e.setSelectionRange(s, r.length - u);
4149 var a = i.substring(s, i.length - u);
4150 return e.focus(),
4151 document.execCommand("insertText", !1, a) || (e.value = i),
4152 o && o.focus(),
4153 e.setSelectionRange(t.length, t.length),
4154 e
4155 }
4156}
4157]);
4158
4159/*!
4160Waypoints - 4.0.1
4161Copyright © 2011-2016 Caleb Troughton
4162Licensed under the MIT license.
4163https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
4164*/
4165!function() {
4166 "use strict";
4167 function t(n) {
4168 if (!n)
4169 throw new Error("No options passed to Waypoint constructor");
4170 if (!n.element)
4171 throw new Error("No element option passed to Waypoint constructor");
4172 if (!n.handler)
4173 throw new Error("No handler option passed to Waypoint constructor");
4174 this.key = "waypoint-" + e,
4175 this.options = t.Adapter.extend({}, t.defaults, n),
4176 this.element = this.options.element,
4177 this.adapter = new t.Adapter(this.element),
4178 this.callback = n.handler,
4179 this.axis = this.options.horizontal ? "horizontal" : "vertical",
4180 this.enabled = this.options.enabled,
4181 this.triggerPoint = null,
4182 this.group = t.Group.findOrCreate({
4183 name: this.options.group,
4184 axis: this.axis
4185 }),
4186 this.context = t.Context.findOrCreateByElement(this.options.context),
4187 t.offsetAliases[this.options.offset] && (this.options.offset = t.offsetAliases[this.options.offset]),
4188 this.group.add(this),
4189 this.context.add(this),
4190 i[this.key] = this,
4191 e += 1
4192 }
4193 var e = 0
4194 , i = {};
4195 t.prototype.queueTrigger = function(t) {
4196 this.group.queueTrigger(this, t)
4197 }
4198 ,
4199 t.prototype.trigger = function(t) {
4200 this.enabled && this.callback && this.callback.apply(this, t)
4201 }
4202 ,
4203 t.prototype.destroy = function() {
4204 this.context.remove(this),
4205 this.group.remove(this),
4206 delete i[this.key]
4207 }
4208 ,
4209 t.prototype.disable = function() {
4210 return this.enabled = !1,
4211 this
4212 }
4213 ,
4214 t.prototype.enable = function() {
4215 return this.context.refresh(),
4216 this.enabled = !0,
4217 this
4218 }
4219 ,
4220 t.prototype.next = function() {
4221 return this.group.next(this)
4222 }
4223 ,
4224 t.prototype.previous = function() {
4225 return this.group.previous(this)
4226 }
4227 ,
4228 t.invokeAll = function(t) {
4229 var e = [];
4230 for (var n in i)
4231 e.push(i[n]);
4232 for (var o = 0, r = e.length; r > o; o++)
4233 e[o][t]()
4234 }
4235 ,
4236 t.destroyAll = function() {
4237 t.invokeAll("destroy")
4238 }
4239 ,
4240 t.disableAll = function() {
4241 t.invokeAll("disable")
4242 }
4243 ,
4244 t.enableAll = function() {
4245 t.Context.refreshAll();
4246 for (var e in i)
4247 i[e].enabled = !0;
4248 return this
4249 }
4250 ,
4251 t.refreshAll = function() {
4252 t.Context.refreshAll()
4253 }
4254 ,
4255 t.viewportHeight = function() {
4256 return window.innerHeight || document.documentElement.clientHeight
4257 }
4258 ,
4259 t.viewportWidth = function() {
4260 return document.documentElement.clientWidth
4261 }
4262 ,
4263 t.adapters = [],
4264 t.defaults = {
4265 context: window,
4266 continuous: !0,
4267 enabled: !0,
4268 group: "default",
4269 horizontal: !1,
4270 offset: 0
4271 },
4272 t.offsetAliases = {
4273 "bottom-in-view": function() {
4274 return this.context.innerHeight() - this.adapter.outerHeight()
4275 },
4276 "right-in-view": function() {
4277 return this.context.innerWidth() - this.adapter.outerWidth()
4278 }
4279 },
4280 window.Waypoint = t
4281}(),
4282function() {
4283 "use strict";
4284 function t(t) {
4285 window.setTimeout(t, 1e3 / 60)
4286 }
4287 function e(t) {
4288 this.element = t,
4289 this.Adapter = o.Adapter,
4290 this.adapter = new this.Adapter(t),
4291 this.key = "waypoint-context-" + i,
4292 this.didScroll = !1,
4293 this.didResize = !1,
4294 this.oldScroll = {
4295 x: this.adapter.scrollLeft(),
4296 y: this.adapter.scrollTop()
4297 },
4298 this.waypoints = {
4299 vertical: {},
4300 horizontal: {}
4301 },
4302 t.waypointContextKey = this.key,
4303 n[t.waypointContextKey] = this,
4304 i += 1,
4305 o.windowContext || (o.windowContext = !0,
4306 o.windowContext = new e(window)),
4307 this.createThrottledScrollHandler(),
4308 this.createThrottledResizeHandler()
4309 }
4310 var i = 0
4311 , n = {}
4312 , o = window.Waypoint
4313 , r = window.onload;
4314 e.prototype.add = function(t) {
4315 var e = t.options.horizontal ? "horizontal" : "vertical";
4316 this.waypoints[e][t.key] = t,
4317 this.refresh()
4318 }
4319 ,
4320 e.prototype.checkEmpty = function() {
4321 var t = this.Adapter.isEmptyObject(this.waypoints.horizontal)
4322 , e = this.Adapter.isEmptyObject(this.waypoints.vertical)
4323 , i = this.element == this.element.window;
4324 t && e && !i && (this.adapter.off(".waypoints"),
4325 delete n[this.key])
4326 }
4327 ,
4328 e.prototype.createThrottledResizeHandler = function() {
4329 function t() {
4330 e.handleResize(),
4331 e.didResize = !1
4332 }
4333 var e = this;
4334 this.adapter.on("resize.waypoints", function() {
4335 e.didResize || (e.didResize = !0,
4336 o.requestAnimationFrame(t))
4337 })
4338 }
4339 ,
4340 e.prototype.createThrottledScrollHandler = function() {
4341 function t() {
4342 e.handleScroll(),
4343 e.didScroll = !1
4344 }
4345 var e = this;
4346 this.adapter.on("scroll.waypoints", function() {
4347 (!e.didScroll || o.isTouch) && (e.didScroll = !0,
4348 o.requestAnimationFrame(t))
4349 })
4350 }
4351 ,
4352 e.prototype.handleResize = function() {
4353 o.Context.refreshAll()
4354 }
4355 ,
4356 e.prototype.handleScroll = function() {
4357 var t = {}
4358 , e = {
4359 horizontal: {
4360 newScroll: this.adapter.scrollLeft(),
4361 oldScroll: this.oldScroll.x,
4362 forward: "right",
4363 backward: "left"
4364 },
4365 vertical: {
4366 newScroll: this.adapter.scrollTop(),
4367 oldScroll: this.oldScroll.y,
4368 forward: "down",
4369 backward: "up"
4370 }
4371 };
4372 for (var i in e) {
4373 var n = e[i]
4374 , o = n.newScroll > n.oldScroll
4375 , r = o ? n.forward : n.backward;
4376 for (var s in this.waypoints[i]) {
4377 var l = this.waypoints[i][s];
4378 if (null !== l.triggerPoint) {
4379 var a = n.oldScroll < l.triggerPoint
4380 , h = n.newScroll >= l.triggerPoint
4381 , p = a && h
4382 , u = !a && !h;
4383 (p || u) && (l.queueTrigger(r),
4384 t[l.group.id] = l.group)
4385 }
4386 }
4387 }
4388 for (var d in t)
4389 t[d].flushTriggers();
4390 this.oldScroll = {
4391 x: e.horizontal.newScroll,
4392 y: e.vertical.newScroll
4393 }
4394 }
4395 ,
4396 e.prototype.innerHeight = function() {
4397 return this.element == this.element.window ? o.viewportHeight() : this.adapter.innerHeight()
4398 }
4399 ,
4400 e.prototype.remove = function(t) {
4401 delete this.waypoints[t.axis][t.key],
4402 this.checkEmpty()
4403 }
4404 ,
4405 e.prototype.innerWidth = function() {
4406 return this.element == this.element.window ? o.viewportWidth() : this.adapter.innerWidth()
4407 }
4408 ,
4409 e.prototype.destroy = function() {
4410 var t = [];
4411 for (var e in this.waypoints)
4412 for (var i in this.waypoints[e])
4413 t.push(this.waypoints[e][i]);
4414 for (var n = 0, o = t.length; o > n; n++)
4415 t[n].destroy()
4416 }
4417 ,
4418 e.prototype.refresh = function() {
4419 var t, e = this.element == this.element.window, i = e ? void 0 : this.adapter.offset(), n = {};
4420 this.handleScroll(),
4421 t = {
4422 horizontal: {
4423 contextOffset: e ? 0 : i.left,
4424 contextScroll: e ? 0 : this.oldScroll.x,
4425 contextDimension: this.innerWidth(),
4426 oldScroll: this.oldScroll.x,
4427 forward: "right",
4428 backward: "left",
4429 offsetProp: "left"
4430 },
4431 vertical: {
4432 contextOffset: e ? 0 : i.top,
4433 contextScroll: e ? 0 : this.oldScroll.y,
4434 contextDimension: this.innerHeight(),
4435 oldScroll: this.oldScroll.y,
4436 forward: "down",
4437 backward: "up",
4438 offsetProp: "top"
4439 }
4440 };
4441 for (var r in t) {
4442 var s = t[r];
4443 for (var l in this.waypoints[r]) {
4444 var a, h, p, u, d, f = this.waypoints[r][l], c = f.options.offset, w = f.triggerPoint, y = 0, g = null == w;
4445 f.element !== f.element.window && (y = f.adapter.offset()[s.offsetProp]),
4446 "function" == typeof c ? c = c.apply(f) : "string" == typeof c && (c = parseFloat(c),
4447 f.options.offset.indexOf("%") > -1 && (c = Math.ceil(s.contextDimension * c / 100))),
4448 a = s.contextScroll - s.contextOffset,
4449 f.triggerPoint = Math.floor(y + a - c),
4450 h = w < s.oldScroll,
4451 p = f.triggerPoint >= s.oldScroll,
4452 u = h && p,
4453 d = !h && !p,
4454 !g && u ? (f.queueTrigger(s.backward),
4455 n[f.group.id] = f.group) : !g && d ? (f.queueTrigger(s.forward),
4456 n[f.group.id] = f.group) : g && s.oldScroll >= f.triggerPoint && (f.queueTrigger(s.forward),
4457 n[f.group.id] = f.group)
4458 }
4459 }
4460 return o.requestAnimationFrame(function() {
4461 for (var t in n)
4462 n[t].flushTriggers()
4463 }),
4464 this
4465 }
4466 ,
4467 e.findOrCreateByElement = function(t) {
4468 return e.findByElement(t) || new e(t)
4469 }
4470 ,
4471 e.refreshAll = function() {
4472 for (var t in n)
4473 n[t].refresh()
4474 }
4475 ,
4476 e.findByElement = function(t) {
4477 return n[t.waypointContextKey]
4478 }
4479 ,
4480 window.onload = function() {
4481 r && r(),
4482 e.refreshAll()
4483 }
4484 ,
4485 o.requestAnimationFrame = function(e) {
4486 var i = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || t;
4487 i.call(window, e)
4488 }
4489 ,
4490 o.Context = e
4491}(),
4492function() {
4493 "use strict";
4494 function t(t, e) {
4495 return t.triggerPoint - e.triggerPoint
4496 }
4497 function e(t, e) {
4498 return e.triggerPoint - t.triggerPoint
4499 }
4500 function i(t) {
4501 this.name = t.name,
4502 this.axis = t.axis,
4503 this.id = this.name + "-" + this.axis,
4504 this.waypoints = [],
4505 this.clearTriggerQueues(),
4506 n[this.axis][this.name] = this
4507 }
4508 var n = {
4509 vertical: {},
4510 horizontal: {}
4511 }
4512 , o = window.Waypoint;
4513 i.prototype.add = function(t) {
4514 this.waypoints.push(t)
4515 }
4516 ,
4517 i.prototype.clearTriggerQueues = function() {
4518 this.triggerQueues = {
4519 up: [],
4520 down: [],
4521 left: [],
4522 right: []
4523 }
4524 }
4525 ,
4526 i.prototype.flushTriggers = function() {
4527 for (var i in this.triggerQueues) {
4528 var n = this.triggerQueues[i]
4529 , o = "up" === i || "left" === i;
4530 n.sort(o ? e : t);
4531 for (var r = 0, s = n.length; s > r; r += 1) {
4532 var l = n[r];
4533 (l.options.continuous || r === n.length - 1) && l.trigger([i])
4534 }
4535 }
4536 this.clearTriggerQueues()
4537 }
4538 ,
4539 i.prototype.next = function(e) {
4540 this.waypoints.sort(t);
4541 var i = o.Adapter.inArray(e, this.waypoints)
4542 , n = i === this.waypoints.length - 1;
4543 return n ? null : this.waypoints[i + 1]
4544 }
4545 ,
4546 i.prototype.previous = function(e) {
4547 this.waypoints.sort(t);
4548 var i = o.Adapter.inArray(e, this.waypoints);
4549 return i ? this.waypoints[i - 1] : null
4550 }
4551 ,
4552 i.prototype.queueTrigger = function(t, e) {
4553 this.triggerQueues[e].push(t)
4554 }
4555 ,
4556 i.prototype.remove = function(t) {
4557 var e = o.Adapter.inArray(t, this.waypoints);
4558 e > -1 && this.waypoints.splice(e, 1)
4559 }
4560 ,
4561 i.prototype.first = function() {
4562 return this.waypoints[0]
4563 }
4564 ,
4565 i.prototype.last = function() {
4566 return this.waypoints[this.waypoints.length - 1]
4567 }
4568 ,
4569 i.findOrCreate = function(t) {
4570 return n[t.axis][t.name] || new i(t)
4571 }
4572 ,
4573 o.Group = i
4574}(),
4575function() {
4576 "use strict";
4577 function t(t) {
4578 return t === t.window
4579 }
4580 function e(e) {
4581 return t(e) ? e : e.defaultView
4582 }
4583 function i(t) {
4584 this.element = t,
4585 this.handlers = {}
4586 }
4587 var n = window.Waypoint;
4588 i.prototype.innerHeight = function() {
4589 var e = t(this.element);
4590 return e ? this.element.innerHeight : this.element.clientHeight
4591 }
4592 ,
4593 i.prototype.innerWidth = function() {
4594 var e = t(this.element);
4595 return e ? this.element.innerWidth : this.element.clientWidth
4596 }
4597 ,
4598 i.prototype.off = function(t, e) {
4599 function i(t, e, i) {
4600 for (var n = 0, o = e.length - 1; o > n; n++) {
4601 var r = e[n];
4602 i && i !== r || t.removeEventListener(r)
4603 }
4604 }
4605 var n = t.split(".")
4606 , o = n[0]
4607 , r = n[1]
4608 , s = this.element;
4609 if (r && this.handlers[r] && o)
4610 i(s, this.handlers[r][o], e),
4611 this.handlers[r][o] = [];
4612 else if (o)
4613 for (var l in this.handlers)
4614 i(s, this.handlers[l][o] || [], e),
4615 this.handlers[l][o] = [];
4616 else if (r && this.handlers[r]) {
4617 for (var a in this.handlers[r])
4618 i(s, this.handlers[r][a], e);
4619 this.handlers[r] = {}
4620 }
4621 }
4622 ,
4623 i.prototype.offset = function() {
4624 if (!this.element.ownerDocument)
4625 return null;
4626 var t = this.element.ownerDocument.documentElement
4627 , i = e(this.element.ownerDocument)
4628 , n = {
4629 top: 0,
4630 left: 0
4631 };
4632 return this.element.getBoundingClientRect && (n = this.element.getBoundingClientRect()),
4633 {
4634 top: n.top + i.pageYOffset - t.clientTop,
4635 left: n.left + i.pageXOffset - t.clientLeft
4636 }
4637 }
4638 ,
4639 i.prototype.on = function(t, e) {
4640 var i = t.split(".")
4641 , n = i[0]
4642 , o = i[1] || "__default"
4643 , r = this.handlers[o] = this.handlers[o] || {}
4644 , s = r[n] = r[n] || [];
4645 s.push(e),
4646 this.element.addEventListener(n, e)
4647 }
4648 ,
4649 i.prototype.outerHeight = function(e) {
4650 var i, n = this.innerHeight();
4651 return e && !t(this.element) && (i = window.getComputedStyle(this.element),
4652 n += parseInt(i.marginTop, 10),
4653 n += parseInt(i.marginBottom, 10)),
4654 n
4655 }
4656 ,
4657 i.prototype.outerWidth = function(e) {
4658 var i, n = this.innerWidth();
4659 return e && !t(this.element) && (i = window.getComputedStyle(this.element),
4660 n += parseInt(i.marginLeft, 10),
4661 n += parseInt(i.marginRight, 10)),
4662 n
4663 }
4664 ,
4665 i.prototype.scrollLeft = function() {
4666 var t = e(this.element);
4667 return t ? t.pageXOffset : this.element.scrollLeft
4668 }
4669 ,
4670 i.prototype.scrollTop = function() {
4671 var t = e(this.element);
4672 return t ? t.pageYOffset : this.element.scrollTop
4673 }
4674 ,
4675 i.extend = function() {
4676 function t(t, e) {
4677 if ("object" == typeof t && "object" == typeof e)
4678 for (var i in e)
4679 e.hasOwnProperty(i) && (t[i] = e[i]);
4680 return t
4681 }
4682 for (var e = Array.prototype.slice.call(arguments), i = 1, n = e.length; n > i; i++)
4683 t(e[0], e[i]);
4684 return e[0]
4685 }
4686 ,
4687 i.inArray = function(t, e, i) {
4688 return null == e ? -1 : e.indexOf(t, i)
4689 }
4690 ,
4691 i.isEmptyObject = function(t) {
4692 for (var e in t)
4693 return !1;
4694 return !0
4695 }
4696 ,
4697 n.adapters.push({
4698 name: "noframework",
4699 Adapter: i
4700 }),
4701 n.Adapter = i
4702}();
4703
4704(function() {
4705 var Match, calculate_operations, consecutive_where, create_index, diff, find_match, find_matching_blocks, html_to_tokens, is_end_of_tag, is_start_of_tag, is_tag, is_whitespace, isnt_tag, op_map, recursively_find_matching_blocks, render_operations, wrap;
4706 is_end_of_tag = function(char) {
4707 return ">" === char
4708 }
4709 ,
4710 is_start_of_tag = function(char) {
4711 return "<" === char
4712 }
4713 ,
4714 is_whitespace = function(char) {
4715 return /^\s+$/.test(char)
4716 }
4717 ,
4718 is_tag = function(token) {
4719 return /^\s*<[^>]+>\s*$/.test(token)
4720 }
4721 ,
4722 isnt_tag = function(token) {
4723 return !is_tag(token)
4724 }
4725 ,
4726 Match = function() {
4727 function Match(start_in_before1, start_in_after1, length1) {
4728 this.start_in_before = start_in_before1,
4729 this.start_in_after = start_in_after1,
4730 this.length = length1,
4731 this.end_in_before = this.start_in_before + this.length - 1,
4732 this.end_in_after = this.start_in_after + this.length - 1
4733 }
4734 return Match
4735 }(),
4736 html_to_tokens = function(html) {
4737 var char, current_word, i, len, mode, words;
4738 for (mode = "char",
4739 current_word = "",
4740 words = [],
4741 i = 0,
4742 len = html.length; i < len; i++)
4743 switch (char = html[i],
4744 mode) {
4745 case "tag":
4746 is_end_of_tag(char) ? (current_word += ">",
4747 words.push(current_word),
4748 current_word = "",
4749 mode = is_whitespace(char) ? "whitespace" : "char") : current_word += char;
4750 break;
4751 case "char":
4752 is_start_of_tag(char) ? (current_word && words.push(current_word),
4753 current_word = "<",
4754 mode = "tag") : /\s/.test(char) ? (current_word && words.push(current_word),
4755 current_word = char,
4756 mode = "whitespace") : /[\w\#@]+/i.test(char) ? current_word += char : (current_word && words.push(current_word),
4757 current_word = char);
4758 break;
4759 case "whitespace":
4760 is_start_of_tag(char) ? (current_word && words.push(current_word),
4761 current_word = "<",
4762 mode = "tag") : is_whitespace(char) ? current_word += char : (current_word && words.push(current_word),
4763 current_word = char,
4764 mode = "char");
4765 break;
4766 default:
4767 throw new Error("Unknown mode " + mode)
4768 }
4769 return current_word && words.push(current_word),
4770 words
4771 }
4772 ,
4773 find_match = function(before_tokens, after_tokens, index_of_before_locations_in_after_tokens, start_in_before, end_in_before, start_in_after, end_in_after) {
4774 var best_match_in_after, best_match_in_before, best_match_length, i, index_in_after, index_in_before, j, len, locations_in_after, looking_for, match, match_length_at, new_match_length, new_match_length_at, ref, ref1;
4775 for (best_match_in_before = start_in_before,
4776 best_match_in_after = start_in_after,
4777 best_match_length = 0,
4778 match_length_at = {},
4779 index_in_before = i = ref = start_in_before,
4780 ref1 = end_in_before; ref <= ref1 ? i < ref1 : i > ref1; index_in_before = ref <= ref1 ? ++i : --i) {
4781 for (new_match_length_at = {},
4782 looking_for = before_tokens[index_in_before],
4783 locations_in_after = index_of_before_locations_in_after_tokens[looking_for],
4784 j = 0,
4785 len = locations_in_after.length; j < len; j++)
4786 if (index_in_after = locations_in_after[j],
4787 !(index_in_after < start_in_after)) {
4788 if (index_in_after >= end_in_after)
4789 break;
4790 null == match_length_at[index_in_after - 1] && (match_length_at[index_in_after - 1] = 0),
4791 new_match_length = match_length_at[index_in_after - 1] + 1,
4792 new_match_length_at[index_in_after] = new_match_length,
4793 new_match_length > best_match_length && (best_match_in_before = index_in_before - new_match_length + 1,
4794 best_match_in_after = index_in_after - new_match_length + 1,
4795 best_match_length = new_match_length)
4796 }
4797 match_length_at = new_match_length_at
4798 }
4799 return 0 !== best_match_length && (match = new Match(best_match_in_before,best_match_in_after,best_match_length)),
4800 match
4801 }
4802 ,
4803 recursively_find_matching_blocks = function(before_tokens, after_tokens, index_of_before_locations_in_after_tokens, start_in_before, end_in_before, start_in_after, end_in_after, matching_blocks) {
4804 var match;
4805 return match = find_match(before_tokens, after_tokens, index_of_before_locations_in_after_tokens, start_in_before, end_in_before, start_in_after, end_in_after),
4806 null != match && (start_in_before < match.start_in_before && start_in_after < match.start_in_after && recursively_find_matching_blocks(before_tokens, after_tokens, index_of_before_locations_in_after_tokens, start_in_before, match.start_in_before, start_in_after, match.start_in_after, matching_blocks),
4807 matching_blocks.push(match),
4808 match.end_in_before <= end_in_before && match.end_in_after <= end_in_after && recursively_find_matching_blocks(before_tokens, after_tokens, index_of_before_locations_in_after_tokens, match.end_in_before + 1, end_in_before, match.end_in_after + 1, end_in_after, matching_blocks)),
4809 matching_blocks
4810 }
4811 ,
4812 create_index = function(p) {
4813 var i, idx, index, len, ref, token;
4814 if (null == p.find_these)
4815 throw new Error("params must have find_these key");
4816 if (null == p.in_these)
4817 throw new Error("params must have in_these key");
4818 for (index = {},
4819 ref = p.find_these,
4820 i = 0,
4821 len = ref.length; i < len; i++)
4822 for (token = ref[i],
4823 index[token] = [],
4824 idx = p.in_these.indexOf(token); idx !== -1; )
4825 index[token].push(idx),
4826 idx = p.in_these.indexOf(token, idx + 1);
4827 return index
4828 }
4829 ,
4830 find_matching_blocks = function(before_tokens, after_tokens) {
4831 var index_of_before_locations_in_after_tokens, matching_blocks;
4832 return matching_blocks = [],
4833 index_of_before_locations_in_after_tokens = create_index({
4834 find_these: before_tokens,
4835 in_these: after_tokens
4836 }),
4837 recursively_find_matching_blocks(before_tokens, after_tokens, index_of_before_locations_in_after_tokens, 0, before_tokens.length, 0, after_tokens.length, matching_blocks)
4838 }
4839 ,
4840 calculate_operations = function(before_tokens, after_tokens) {
4841 var action_map, action_up_to_match_positions, i, index, is_single_whitespace, j, last_op, len, len1, match, match_starts_at_current_position_in_after, match_starts_at_current_position_in_before, matches, op, operations, position_in_after, position_in_before, post_processed;
4842 if (null == before_tokens)
4843 throw new Error("before_tokens?");
4844 if (null == after_tokens)
4845 throw new Error("after_tokens?");
4846 for (position_in_before = position_in_after = 0,
4847 operations = [],
4848 action_map = {
4849 "false,false": "replace",
4850 "true,false": "insert",
4851 "false,true": "delete",
4852 "true,true": "none"
4853 },
4854 matches = find_matching_blocks(before_tokens, after_tokens),
4855 matches.push(new Match(before_tokens.length,after_tokens.length,0)),
4856 index = i = 0,
4857 len = matches.length; i < len; index = ++i)
4858 match = matches[index],
4859 match_starts_at_current_position_in_before = position_in_before === match.start_in_before,
4860 match_starts_at_current_position_in_after = position_in_after === match.start_in_after,
4861 action_up_to_match_positions = action_map[[match_starts_at_current_position_in_before, match_starts_at_current_position_in_after].toString()],
4862 "none" !== action_up_to_match_positions && operations.push({
4863 action: action_up_to_match_positions,
4864 start_in_before: position_in_before,
4865 end_in_before: "insert" !== action_up_to_match_positions ? match.start_in_before - 1 : void 0,
4866 start_in_after: position_in_after,
4867 end_in_after: "delete" !== action_up_to_match_positions ? match.start_in_after - 1 : void 0
4868 }),
4869 0 !== match.length && operations.push({
4870 action: "equal",
4871 start_in_before: match.start_in_before,
4872 end_in_before: match.end_in_before,
4873 start_in_after: match.start_in_after,
4874 end_in_after: match.end_in_after
4875 }),
4876 position_in_before = match.end_in_before + 1,
4877 position_in_after = match.end_in_after + 1;
4878 for (post_processed = [],
4879 last_op = {
4880 action: "none"
4881 },
4882 is_single_whitespace = function(op) {
4883 return "equal" === op.action && (op.end_in_before - op.start_in_before === 0 && /^\s$/.test(before_tokens.slice(op.start_in_before, +op.end_in_before + 1 || 9e9)))
4884 }
4885 ,
4886 j = 0,
4887 len1 = operations.length; j < len1; j++)
4888 op = operations[j],
4889 is_single_whitespace(op) && "replace" === last_op.action || "replace" === op.action && "replace" === last_op.action ? (last_op.end_in_before = op.end_in_before,
4890 last_op.end_in_after = op.end_in_after) : (post_processed.push(op),
4891 last_op = op);
4892 return post_processed
4893 }
4894 ,
4895 consecutive_where = function(start, content, predicate) {
4896 var answer, i, index, last_matching_index, len, token;
4897 for (content = content.slice(start, +content.length + 1 || 9e9),
4898 last_matching_index = void 0,
4899 index = i = 0,
4900 len = content.length; i < len && (token = content[index],
4901 answer = predicate(token),
4902 answer === !0 && (last_matching_index = index),
4903 answer !== !1); index = ++i)
4904 ;
4905 return null != last_matching_index ? content.slice(0, +last_matching_index + 1 || 9e9) : []
4906 }
4907 ,
4908 wrap = function(tag, content) {
4909 var length, non_tags, position, rendering, tags;
4910 for (rendering = "",
4911 position = 0,
4912 length = content.length; ; ) {
4913 if (position >= length)
4914 break;
4915 if (non_tags = consecutive_where(position, content, isnt_tag),
4916 position += non_tags.length,
4917 0 !== non_tags.length && (rendering += "<" + tag + ">" + non_tags.join("") + "</" + tag + ">"),
4918 position >= length)
4919 break;
4920 tags = consecutive_where(position, content, is_tag),
4921 position += tags.length,
4922 rendering += tags.join("")
4923 }
4924 return rendering
4925 }
4926 ,
4927 op_map = {
4928 equal: function(op, before_tokens, after_tokens) {
4929 return before_tokens.slice(op.start_in_before, +op.end_in_before + 1 || 9e9).join("")
4930 },
4931 insert: function(op, before_tokens, after_tokens) {
4932 var val;
4933 return val = after_tokens.slice(op.start_in_after, +op.end_in_after + 1 || 9e9),
4934 wrap("ins", val)
4935 },
4936 "delete": function(op, before_tokens, after_tokens) {
4937 var val;
4938 return val = before_tokens.slice(op.start_in_before, +op.end_in_before + 1 || 9e9),
4939 wrap("del", val)
4940 }
4941 },
4942 op_map.replace = function(op, before_tokens, after_tokens) {
4943 return op_map["delete"](op, before_tokens, after_tokens) + op_map.insert(op, before_tokens, after_tokens)
4944 }
4945 ,
4946 render_operations = function(before_tokens, after_tokens, operations) {
4947 var i, len, op, rendering;
4948 for (rendering = "",
4949 i = 0,
4950 len = operations.length; i < len; i++)
4951 op = operations[i],
4952 rendering += op_map[op.action](op, before_tokens, after_tokens);
4953 return rendering
4954 }
4955 ,
4956 diff = function(before, after) {
4957 var ops;
4958 return before === after ? before : (before = html_to_tokens(before),
4959 after = html_to_tokens(after),
4960 ops = calculate_operations(before, after),
4961 render_operations(before, after, ops))
4962 }
4963 ,
4964 diff.html_to_tokens = html_to_tokens,
4965 diff.find_matching_blocks = find_matching_blocks,
4966 find_matching_blocks.find_match = find_match,
4967 find_matching_blocks.create_index = create_index,
4968 diff.calculate_operations = calculate_operations,
4969 diff.render_operations = render_operations,
4970 "function" == typeof define ? define([], function() {
4971 return diff
4972 }) : "undefined" != typeof module && null !== module ? module.exports = diff : this.htmldiff = diff
4973}
4974).call(this);
4975(function() {
4976 window.stModules = {}
4977}
4978).call(this);
4979(function() {
4980 stModules.utils = {
4981 format: function(str, kwargs) {
4982 var key, value;
4983 for (key in kwargs)
4984 value = kwargs[key],
4985 str = str.replace("{" + key + "}", String(value));
4986 return str
4987 },
4988 isHidden: function(elms) {
4989 return 0 === Array.from(elms).filter(function(elm) {
4990 return "none" !== elm.style.display
4991 }).length
4992 }
4993 }
4994}
4995).call(this);
4996(function() {
4997 var Tab, bind = function(fn, me) {
4998 return function() {
4999 return fn.apply(me, arguments)
5000 }
5001 };
5002 Tab = function() {
5003 function Tab(el) {
5004 this.showTabContent = bind(this.showTabContent, this),
5005 this.selectTab = bind(this.selectTab, this),
5006 this.unselectAllTabs = bind(this.unselectAllTabs, this),
5007 this.hideAllTabsContent = bind(this.hideAllTabsContent, this),
5008 this.tabSwitch = bind(this.tabSwitch, this),
5009 this.el = el,
5010 this.containerElm = this.el.closest(".js-tabs-container"),
5011 this.setUp()
5012 }
5013 return Tab.prototype.setUp = function() {
5014 return this.el.addEventListener("click", this.tabSwitch)
5015 }
5016 ,
5017 Tab.prototype.tabSwitch = function(e) {
5018 e.preventDefault(),
5019 e.stopPropagation(),
5020 this.hideAllTabsContent(),
5021 this.el.classList.contains("is-selected") ? this.el.classList.remove("is-selected") : (this.unselectAllTabs(),
5022 this.selectTab(),
5023 this.showTabContent())
5024 }
5025 ,
5026 Tab.prototype.hideAllTabsContent = function() {
5027 var tabContentElms;
5028 return tabContentElms = this.containerElm.querySelectorAll(".js-tab-content"),
5029 Array.from(tabContentElms).forEach(function(elm) {
5030 return elm.style.display = "none"
5031 })
5032 }
5033 ,
5034 Tab.prototype.unselectAllTabs = function() {
5035 var tabElms;
5036 return tabElms = this.containerElm.querySelectorAll(".js-tab"),
5037 Array.from(tabElms).forEach(function(elm) {
5038 return elm.classList.remove("is-selected")
5039 })
5040 }
5041 ,
5042 Tab.prototype.selectTab = function() {
5043 return this.el.classList.add("is-selected")
5044 }
5045 ,
5046 Tab.prototype.showTabContent = function() {
5047 return this.containerElm.querySelector(this.el.dataset.related).style.display = "block"
5048 }
5049 ,
5050 Tab
5051 }(),
5052 stModules.tab = function(elms) {
5053 return Array.from(elms).map(function(elm) {
5054 return new Tab(elm)
5055 })
5056 }
5057 ,
5058 stModules.Tab = Tab
5059}
5060).call(this);
5061(function() {
5062 var EditorUpload, utils, bind = function(fn, me) {
5063 return function() {
5064 return fn.apply(me, arguments)
5065 }
5066 };
5067 utils = stModules.utils,
5068 EditorUpload = function() {
5069 function EditorUpload(el, options, meta) {
5070 null == options && (options = null),
5071 null == meta && (meta = null),
5072 this.openFileDialog = bind(this.openFileDialog, this),
5073 this.textReplace = bind(this.textReplace, this),
5074 this.addError = bind(this.addError, this),
5075 this.addFile = bind(this.addFile, this),
5076 this.buildFormData = bind(this.buildFormData, this),
5077 this.addPlaceholder = bind(this.addPlaceholder, this),
5078 this.sendFile = bind(this.sendFile, this),
5079 this.el = el,
5080 this.options = Object.assign({}, this.defaults, options || {}),
5081 this.meta = Object.assign({}, this._meta, meta || {}),
5082 this.textBox = el.querySelector("textarea"),
5083 this.formFile = document.createElement("form"),
5084 this.inputFile = document.createElement("input"),
5085 this.inputFile.type = "file",
5086 this.inputFile.accept = this.options.allowedFileMedia,
5087 this.setUp()
5088 }
5089 return EditorUpload.prototype.defaults = {
5090 csrfToken: "csrf_token",
5091 target: "target url",
5092 placeholderText: "uploading {name}",
5093 allowedFileMedia: ["*/*"]
5094 },
5095 EditorUpload.prototype._meta = {
5096 fieldName: "file",
5097 tag: "[{text}]({url})",
5098 elm: ".js-box-file"
5099 },
5100 EditorUpload.prototype.setUp = function() {
5101 return this.formFile.appendChild(this.inputFile),
5102 this.inputFile.addEventListener("change", this.sendFile),
5103 this.el.querySelector(this.meta.elm).addEventListener("click", this.openFileDialog)
5104 }
5105 ,
5106 EditorUpload.prototype.sendFile = function() {
5107 var file, formData, headers, placeholder;
5108 file = this.inputFile.files[0],
5109 placeholder = this.addPlaceholder(file),
5110 formData = this.buildFormData(file),
5111 this.formFile.reset(),
5112 headers = new Headers,
5113 headers.append("X-Requested-With", "XMLHttpRequest"),
5114 fetch(this.options.target, {
5115 method: "POST",
5116 headers: headers,
5117 credentials: "same-origin",
5118 body: formData
5119 }).then(function(_this) {
5120 return function(response) {
5121 if (!response.ok)
5122 throw new Error("error: " + response.status + " " + response.statusText);
5123 return response.json()
5124 }
5125 }(this)).then(function(_this) {
5126 return function(data) {
5127 return "url"in data ? _this.addFile(file.name, data.url, placeholder) : _this.addError(JSON.stringify(data.error), placeholder)
5128 }
5129 }(this))["catch"](function(_this) {
5130 return function(error) {
5131 return console.log(error.message),
5132 _this.addError(error.message, placeholder)
5133 }
5134 }(this))
5135 }
5136 ,
5137 EditorUpload.prototype.addPlaceholder = function(file) {
5138 var placeholder;
5139 return placeholder = utils.format(this.meta.tag, {
5140 text: utils.format(this.options.placeholderText, {
5141 name: file.name
5142 }),
5143 url: ""
5144 }),
5145 this.textBox.value += placeholder,
5146 placeholder
5147 }
5148 ,
5149 EditorUpload.prototype.buildFormData = function(file) {
5150 var formData;
5151 return formData = new FormData,
5152 formData.append("csrfmiddlewaretoken", this.options.csrfToken),
5153 formData.append(this.meta.fieldName, file),
5154 formData
5155 }
5156 ,
5157 EditorUpload.prototype.addFile = function(name, url, placeholder) {
5158 var imageTag;
5159 return imageTag = utils.format(this.meta.tag, {
5160 text: name,
5161 url: url
5162 }),
5163 this.textReplace(placeholder, imageTag)
5164 }
5165 ,
5166 EditorUpload.prototype.addError = function(error, placeholder) {
5167 return this.textReplace(placeholder, utils.format(this.meta.tag, {
5168 text: error,
5169 url: ""
5170 }))
5171 }
5172 ,
5173 EditorUpload.prototype.textReplace = function(find, replace) {
5174 this.textBox.value = this.textBox.value.replace(find, replace)
5175 }
5176 ,
5177 EditorUpload.prototype.openFileDialog = function(e) {
5178 return e.preventDefault(),
5179 e.stopPropagation(),
5180 e.stopImmediatePropagation(),
5181 this.inputFile.click()
5182 }
5183 ,
5184 EditorUpload
5185 }(),
5186 stModules.editorFileUpload = function(elms, options) {
5187 return Array.from(elms).map(function(elm) {
5188 return new EditorUpload(elm,options)
5189 })
5190 }
5191 ,
5192 stModules.editorImageUpload = function(elms, options) {
5193 return Array.from(elms).map(function(elm) {
5194 return new EditorUpload(elm,options,{
5195 fieldName: "image",
5196 tag: "",
5197 elm: ".js-box-image"
5198 })
5199 })
5200 }
5201 ,
5202 stModules.EditorUpload = EditorUpload
5203}
5204).call(this);
5205(function() {
5206 var Bookmark, Mark, bind = function(fn, me) {
5207 return function() {
5208 return fn.apply(me, arguments)
5209 }
5210 };
5211 Mark = function() {
5212 function Mark(options) {
5213 this.sendMark = bind(this.sendMark, this),
5214 this.canSend = bind(this.canSend, this),
5215 this.options = Object.assign({}, this.defaults, options),
5216 this.isSending = !1,
5217 this.commentNumber = this._getCommentNumber(),
5218 this.numberQueued = this.commentNumber
5219 }
5220 return Mark.prototype.defaults = {
5221 csrfToken: "csrf_token",
5222 target: "target url"
5223 },
5224 Mark.prototype._getCommentNumber = function() {
5225 var commentNumber;
5226 return commentNumber = window.location.hash.split("#c")[1],
5227 commentNumber = parseInt(commentNumber, 10),
5228 isNaN(commentNumber) ? commentNumber = 0 : commentNumber -= 1,
5229 commentNumber
5230 }
5231 ,
5232 Mark.prototype.canSend = function(number) {
5233 return Number.isInteger(number) || console.error("not a number"),
5234 number > this.commentNumber
5235 }
5236 ,
5237 Mark.prototype.sendMark = function(number) {
5238 var form, headers;
5239 if (this.canSend(number) && (this.numberQueued = number,
5240 !this.isSending))
5241 return this.isSending = !0,
5242 this.commentNumber = number,
5243 form = new FormData,
5244 form.append("csrfmiddlewaretoken", this.options.csrfToken),
5245 form.append("comment_number", String(number)),
5246 headers = new Headers,
5247 headers.append("X-Requested-With", "XMLHttpRequest"),
5248 fetch(this.options.target, {
5249 method: "POST",
5250 headers: headers,
5251 credentials: "same-origin",
5252 body: form
5253 }).then(function(_this) {
5254 return function(response) {
5255 return response.ok || console.log({
5256 status: response.status,
5257 statusText: response.statusText
5258 })
5259 }
5260 }(this))["catch"](function(_this) {
5261 return function(error) {
5262 return console.log(error.message)
5263 }
5264 }(this)).then(function(_this) {
5265 return function() {
5266 return _this.isSending = !1,
5267 _this.sendMark(_this.numberQueued)
5268 }
5269 }(this))
5270 }
5271 ,
5272 Mark
5273 }(),
5274 Bookmark = function() {
5275 function Bookmark(el, mark) {
5276 this.onWaypoint = bind(this.onWaypoint, this),
5277 this._getNumber = bind(this._getNumber, this),
5278 this.el = el,
5279 this.mark = mark,
5280 this.number = this._getNumber(),
5281 this.waypoint = this._addWaypointListener(el, this.onWaypoint)
5282 }
5283 return Bookmark.prototype._addWaypointListener = function(elm, handler) {
5284 return new Waypoint({
5285 element: elm,
5286 handler: handler,
5287 offset: "100%"
5288 })
5289 }
5290 ,
5291 Bookmark.prototype._getNumber = function() {
5292 var number;
5293 return number = parseInt(this.el.dataset.number, 10),
5294 !isNaN(number) || console.error("comment number is NaN"),
5295 number
5296 }
5297 ,
5298 Bookmark.prototype.onWaypoint = function() {
5299 this.mark.sendMark(this.number)
5300 }
5301 ,
5302 Bookmark
5303 }(),
5304 stModules.bookmark = function(elms, options) {
5305 var mark;
5306 return mark = new Mark(options),
5307 Array.from(elms).map(function(elm) {
5308 return new Bookmark(elm,mark)
5309 })
5310 }
5311 ,
5312 stModules.Bookmark = Bookmark,
5313 stModules.Mark = Mark
5314}
5315).call(this);
5316(function() {
5317 stModules.commentDiff = function(elms) {
5318 var curr, prev;
5319 return prev = null,
5320 curr = null,
5321 Array.from(elms).forEach(function(elm) {
5322 return curr = elm.innerHTML,
5323 null != prev && (elm.innerHTML = htmldiff(prev, curr)),
5324 prev = curr
5325 })
5326 }
5327}
5328).call(this);
5329(function() {
5330 var Editor, bind = function(fn, me) {
5331 return function() {
5332 return fn.apply(me, arguments)
5333 }
5334 };
5335 Editor = function() {
5336 function Editor(el, options) {
5337 this.togglePreview = bind(this.togglePreview, this),
5338 this.addPoll = bind(this.addPoll, this),
5339 this.addImage = bind(this.addImage, this),
5340 this.addUrl = bind(this.addUrl, this),
5341 this.addList = bind(this.addList, this),
5342 this.addItalic = bind(this.addItalic, this),
5343 this.addBold = bind(this.addBold, this),
5344 this.wrapSelection = bind(this.wrapSelection, this),
5345 this.el = el,
5346 this.options = Object.assign({}, this.defaults, options),
5347 this.textBox = el.querySelector("textarea"),
5348 this.preview = el.querySelector(".js-box-preview-content"),
5349 this.pollCounter = 1,
5350 this.isPreviewOn = !1,
5351 this.setUp()
5352 }
5353 return Editor.prototype.defaults = {
5354 boldedText: "bolded text",
5355 italicisedText: "italicised text",
5356 listItemText: "list item",
5357 linkText: "link text",
5358 linkUrlText: "link url",
5359 imageText: "image text",
5360 imageUrlText: "image url",
5361 pollTitleText: "Title",
5362 pollChoiceText: "Description"
5363 },
5364 Editor.prototype.setUp = function() {
5365 return this.el.querySelector(".js-box-bold").addEventListener("click", this.addBold),
5366 this.el.querySelector(".js-box-italic").addEventListener("click", this.addItalic),
5367 this.el.querySelector(".js-box-list").addEventListener("click", this.addList),
5368 this.el.querySelector(".js-box-url").addEventListener("click", this.addUrl),
5369 this.el.querySelector(".js-box-image").addEventListener("click", this.addImage),
5370 this.el.querySelector(".js-box-poll").addEventListener("click", this.addPoll),
5371 this.el.querySelector(".js-box-preview").addEventListener("click", this.togglePreview)
5372 }
5373 ,
5374 Editor.prototype.wrapSelection = function(preTxt, postTxt, defaultTxt) {
5375 var pointerLocation, postSelection, preSelection, selection;
5376 return preSelection = this.textBox.value.substring(0, this.textBox.selectionStart),
5377 selection = this.textBox.value.substring(this.textBox.selectionStart, this.textBox.selectionEnd),
5378 postSelection = this.textBox.value.substring(this.textBox.selectionEnd),
5379 selection || (selection = defaultTxt),
5380 this.textBox.value = preSelection + preTxt + selection + postTxt + postSelection,
5381 pointerLocation = this.textBox.value.length - postSelection.length,
5382 this.textBox.setSelectionRange(pointerLocation, pointerLocation),
5383 this.textBox.focus()
5384 }
5385 ,
5386 Editor.prototype.addBold = function(e) {
5387 return this.wrapSelection("**", "**", this.options.boldedText),
5388 this.stopClick(e)
5389 }
5390 ,
5391 Editor.prototype.addItalic = function(e) {
5392 return this.wrapSelection("*", "*", this.options.italicisedText),
5393 this.stopClick(e)
5394 }
5395 ,
5396 Editor.prototype.addList = function(e) {
5397 return this.wrapSelection("\n* ", "", this.options.listItemText),
5398 this.stopClick(e)
5399 }
5400 ,
5401 Editor.prototype.addUrl = function(e) {
5402 return this.wrapSelection("[", "](" + this.options.linkUrlText + ")", this.options.linkText),
5403 this.stopClick(e)
5404 }
5405 ,
5406 Editor.prototype.addImage = function(e) {
5407 return this.wrapSelection("", this.options.imageText),
5408 this.stopClick(e)
5409 }
5410 ,
5411 Editor.prototype.addPoll = function(e) {
5412 var poll;
5413 return poll = "\n\n[poll name=" + this.pollCounter + "]\n" + ("# " + this.options.pollTitleText + "\n") + ("1. " + this.options.pollChoiceText + "\n") + ("2. " + this.options.pollChoiceText + "\n") + "[/poll]\n",
5414 this.wrapSelection("", poll, ""),
5415 this.pollCounter++,
5416 this.stopClick(e)
5417 }
5418 ,
5419 Editor.prototype.togglePreview = function(e) {
5420 return this.isPreviewOn ? (this.isPreviewOn = !1,
5421 this.textBox.style.display = "block",
5422 this.preview.style.display = "none") : (this.isPreviewOn = !0,
5423 this.textBox.style.display = "none",
5424 this.preview.style.display = "block",
5425 this.preview.innerHTML = marked(this.textBox.value)),
5426 this.stopClick(e)
5427 }
5428 ,
5429 Editor.prototype.stopClick = function(e) {
5430 return e.preventDefault(),
5431 e.stopPropagation()
5432 }
5433 ,
5434 Editor
5435 }(),
5436 stModules.editor = function(elms, options) {
5437 return Array.from(elms).map(function(elm) {
5438 return new Editor(elm,options)
5439 })
5440 }
5441 ,
5442 stModules.Editor = Editor
5443}
5444).call(this);
5445(function() {
5446 stModules.emojiList = ["+1", "+1_tone1", "+1_tone2", "+1_tone3", "+1_tone4", "+1_tone5", "-1", "-1_tone1", "-1_tone2", "-1_tone3", "-1_tone4", "-1_tone5", "100", "1234", "8ball", "a", "ab", "abc", "abcd", "ac", "accept", "ad", "admission_tickets", "ae", "aerial_tramway", "af", "ag", "ai", "airplane", "airplane_arriving", "airplane_departure", "airplane_small", "al", "alarm_clock", "alembic", "alien", "am", "ambulance", "amphora", "anchor", "angel", "angel_tone1", "angel_tone2", "angel_tone3", "angel_tone4", "angel_tone5", "anger", "anger_right", "angry", "anguished", "ant", "ao", "apple", "aq", "aquarius", "ar", "archery", "aries", "arrow_backward", "arrow_double_down", "arrow_double_up", "arrow_down", "arrow_down_small", "arrow_forward", "arrow_heading_down", "arrow_heading_up", "arrow_left", "arrow_lower_left", "arrow_lower_right", "arrow_right", "arrow_right_hook", "arrow_up", "arrow_up_down", "arrow_up_small", "arrow_upper_left", "arrow_upper_right", "arrows_clockwise", "arrows_counterclockwise", "art", "articulated_lorry", "as", "asterisk", "astonished", "at", "athletic_shoe", "atm", "atom", "atom_symbol", "au", "aw", "ax", "az", "b", "ba", "baby", "baby_bottle", "baby_chick", "baby_symbol", "baby_tone1", "baby_tone2", "baby_tone3", "baby_tone4", "baby_tone5", "back", "badminton", "baggage_claim", "balloon", "ballot_box", "ballot_box_with_ballot", "ballot_box_with_check", "bamboo", "banana", "bangbang", "bank", "bar_chart", "barber", "baseball", "basketball", "basketball_player", "basketball_player_tone1", "basketball_player_tone2", "basketball_player_tone3", "basketball_player_tone4", "basketball_player_tone5", "bath", "bath_tone1", "bath_tone2", "bath_tone3", "bath_tone4", "bath_tone5", "bathtub", "battery", "bb", "bd", "be", "beach", "beach_umbrella", "beach_with_umbrella", "bear", "bed", "bee", "beer", "beers", "beetle", "beginner", "bell", "bellhop", "bellhop_bell", "bento", "bf", "bg", "bh", "bi", "bicyclist", "bicyclist_tone1", "bicyclist_tone2", "bicyclist_tone3", "bicyclist_tone4", "bicyclist_tone5", "bike", "bikini", "biohazard", "biohazard_sign", "bird", "birthday", "bj", "bl", "black_circle", "black_joker", "black_large_square", "black_medium_small_square", "black_medium_square", "black_nib", "black_small_square", "black_square_button", "blossom", "blowfish", "blue_book", "blue_car", "blue_heart", "blush", "bm", "bn", "bo", "boar", "bomb", "book", "bookmark", "bookmark_tabs", "books", "boom", "boot", "bottle_with_popping_cork", "bouquet", "bow", "bow_and_arrow", "bow_tone1", "bow_tone2", "bow_tone3", "bow_tone4", "bow_tone5", "bowling", "boy", "boy_tone1", "boy_tone2", "boy_tone3", "boy_tone4", "boy_tone5", "bq", "br", "bread", "bride_with_veil", "bride_with_veil_tone1", "bride_with_veil_tone2", "bride_with_veil_tone3", "bride_with_veil_tone4", "bride_with_veil_tone5", "bridge_at_night", "briefcase", "broken_heart", "bs", "bt", "bug", "building_construction", "bulb", "bullettrain_front", "bullettrain_side", "burrito", "bus", "busstop", "bust_in_silhouette", "busts_in_silhouette", "bv", "bw", "by", "bz", "ca", "cactus", "cake", "calendar", "calendar_spiral", "calling", "camel", "camera", "camera_with_flash", "camping", "cancer", "candle", "candy", "capital_abcd", "capricorn", "card_box", "card_file_box", "card_index", "card_index_dividers", "carousel_horse", "cat", "cat2", "cc", "cd", "cf", "cg", "ch", "chains", "champagne", "chart", "chart_with_downwards_trend", "chart_with_upwards_trend", "checkered_flag", "cheese", "cheese_wedge", "cherries", "cherry_blossom", "chestnut", "chicken", "children_crossing", "chile", "chipmunk", "chocolate_bar", "christmas_tree", "church", "ci", "cinema", "circus_tent", "city_dusk", "city_sunrise", "city_sunset", "cityscape", "ck", "cl", "clap", "clap_tone1", "clap_tone2", "clap_tone3", "clap_tone4", "clap_tone5", "clapper", "classical_building", "clipboard", "clock", "clock1", "clock10", "clock1030", "clock11", "clock1130", "clock12", "clock1230", "clock130", "clock2", "clock230", "clock3", "clock330", "clock4", "clock430", "clock5", "clock530", "clock6", "clock630", "clock7", "clock730", "clock8", "clock830", "clock9", "clock930", "closed_book", "closed_lock_with_key", "closed_umbrella", "cloud", "cloud_lightning", "cloud_rain", "cloud_snow", "cloud_tornado", "cloud_with_lightning", "cloud_with_rain", "cloud_with_snow", "cloud_with_tornado", "clubs", "cm", "cn", "co", "cocktail", "coffee", "coffin", "cold_sweat", "comet", "compression", "computer", "confetti_ball", "confounded", "confused", "congo", "congratulations", "construction", "construction_site", "construction_worker", "construction_worker_tone1", "construction_worker_tone2", "construction_worker_tone3", "construction_worker_tone4", "construction_worker_tone5", "control_knobs", "convenience_store", "cookie", "cool", "cop", "cop_tone1", "cop_tone2", "cop_tone3", "cop_tone4", "cop_tone5", "copyright", "corn", "couch", "couch_and_lamp", "couple", "couple_mm", "couple_with_heart", "couple_with_heart_mm", "couple_with_heart_ww", "couple_ww", "couplekiss", "couplekiss_mm", "couplekiss_ww", "cow", "cow2", "cp", "cr", "crab", "crayon", "credit_card", "crescent_moon", "cricket", "cricket_bat_ball", "crocodile", "cross", "crossed_flags", "crossed_swords", "crown", "cruise_ship", "cry", "crying_cat_face", "crystal_ball", "cu", "cupid", "curly_loop", "currency_exchange", "curry", "custard", "customs", "cv", "cw", "cx", "cy", "cyclone", "cz", "dagger", "dagger_knife", "dancer", "dancer_tone1", "dancer_tone2", "dancer_tone3", "dancer_tone4", "dancer_tone5", "dancers", "dango", "dark_sunglasses", "dart", "dash", "date", "de", "deciduous_tree", "department_store", "derelict_house_building", "desert", "desert_island", "desktop", "desktop_computer", "dg", "diamond_shape_with_a_dot_inside", "diamonds", "disappointed", "disappointed_relieved", "dividers", "dizzy", "dizzy_face", "dj", "dk", "dm", "do", "do_not_litter", "dog", "dog2", "dollar", "dolls", "dolphin", "door", "double_vertical_bar", "doughnut", "dove", "dove_of_peace", "dragon", "dragon_face", "dress", "dromedary_camel", "droplet", "dvd", "dz", "e-mail", "ea", "ear", "ear_of_rice", "ear_tone1", "ear_tone2", "ear_tone3", "ear_tone4", "ear_tone5", "earth_africa", "earth_americas", "earth_asia", "ec", "ee", "eg", "egg", "eggplant", "eh", "eight", "eight_pointed_black_star", "eight_spoked_asterisk", "electric_plug", "elephant", "email", "end", "envelope", "envelope_with_arrow", "er", "es", "et", "eu", "euro", "european_castle", "european_post_office", "evergreen_tree", "exclamation", "expressionless", "eye", "eye_in_speech_bubble", "eyeglasses", "eyes", "face_with_head_bandage", "face_with_rolling_eyes", "face_with_thermometer", "factory", "fallen_leaf", "family", "family_mmb", "family_mmbb", "family_mmg", "family_mmgb", "family_mmgg", "family_mwbb", "family_mwg", "family_mwgb", "family_mwgg", "family_wwb", "family_wwbb", "family_wwg", "family_wwgb", "family_wwgg", "fast_forward", "fax", "fearful", "feet", "ferris_wheel", "ferry", "fi", "field_hockey", "file_cabinet", "file_folder", "film_frames", "film_projector", "fire", "fire_engine", "fireworks", "first_quarter_moon", "first_quarter_moon_with_face", "fish", "fish_cake", "fishing_pole_and_fish", "fist", "fist_tone1", "fist_tone2", "fist_tone3", "fist_tone4", "fist_tone5", "five", "fj", "fk", "flag_ac", "flag_ad", "flag_ae", "flag_af", "flag_ag", "flag_ai", "flag_al", "flag_am", "flag_ao", "flag_aq", "flag_ar", "flag_as", "flag_at", "flag_au", "flag_aw", "flag_ax", "flag_az", "flag_ba", "flag_bb", "flag_bd", "flag_be", "flag_bf", "flag_bg", "flag_bh", "flag_bi", "flag_bj", "flag_bl", "flag_black", "flag_bm", "flag_bn", "flag_bo", "flag_bq", "flag_br", "flag_bs", "flag_bt", "flag_bv", "flag_bw", "flag_by", "flag_bz", "flag_ca", "flag_cc", "flag_cd", "flag_cf", "flag_cg", "flag_ch", "flag_ci", "flag_ck", "flag_cl", "flag_cm", "flag_cn", "flag_co", "flag_cp", "flag_cr", "flag_cu", "flag_cv", "flag_cw", "flag_cx", "flag_cy", "flag_cz", "flag_de", "flag_dg", "flag_dj", "flag_dk", "flag_dm", "flag_do", "flag_dz", "flag_ea", "flag_ec", "flag_ee", "flag_eg", "flag_eh", "flag_er", "flag_es", "flag_et", "flag_eu", "flag_fi", "flag_fj", "flag_fk", "flag_fm", "flag_fo", "flag_fr", "flag_ga", "flag_gb", "flag_gd", "flag_ge", "flag_gf", "flag_gg", "flag_gh", "flag_gi", "flag_gl", "flag_gm", "flag_gn", "flag_gp", "flag_gq", "flag_gr", "flag_gs", "flag_gt", "flag_gu", "flag_gw", "flag_gy", "flag_hk", "flag_hm", "flag_hn", "flag_hr", "flag_ht", "flag_hu", "flag_ic", "flag_id", "flag_ie", "flag_il", "flag_im", "flag_in", "flag_io", "flag_iq", "flag_ir", "flag_is", "flag_it", "flag_je", "flag_jm", "flag_jo", "flag_jp", "flag_ke", "flag_kg", "flag_kh", "flag_ki", "flag_km", "flag_kn", "flag_kp", "flag_kr", "flag_kw", "flag_ky", "flag_kz", "flag_la", "flag_lb", "flag_lc", "flag_li", "flag_lk", "flag_lr", "flag_ls", "flag_lt", "flag_lu", "flag_lv", "flag_ly", "flag_ma", "flag_mc", "flag_md", "flag_me", "flag_mf", "flag_mg", "flag_mh", "flag_mk", "flag_ml", "flag_mm", "flag_mn", "flag_mo", "flag_mp", "flag_mq", "flag_mr", "flag_ms", "flag_mt", "flag_mu", "flag_mv", "flag_mw", "flag_mx", "flag_my", "flag_mz", "flag_na", "flag_nc", "flag_ne", "flag_nf", "flag_ng", "flag_ni", "flag_nl", "flag_no", "flag_np", "flag_nr", "flag_nu", "flag_nz", "flag_om", "flag_pa", "flag_pe", "flag_pf", "flag_pg", "flag_ph", "flag_pk", "flag_pl", "flag_pm", "flag_pn", "flag_pr", "flag_ps", "flag_pt", "flag_pw", "flag_py", "flag_qa", "flag_re", "flag_ro", "flag_rs", "flag_ru", "flag_rw", "flag_sa", "flag_sb", "flag_sc", "flag_sd", "flag_se", "flag_sg", "flag_sh", "flag_si", "flag_sj", "flag_sk", "flag_sl", "flag_sm", "flag_sn", "flag_so", "flag_sr", "flag_ss", "flag_st", "flag_sv", "flag_sx", "flag_sy", "flag_sz", "flag_ta", "flag_tc", "flag_td", "flag_tf", "flag_tg", "flag_th", "flag_tj", "flag_tk", "flag_tl", "flag_tm", "flag_tn", "flag_to", "flag_tr", "flag_tt", "flag_tv", "flag_tw", "flag_tz", "flag_ua", "flag_ug", "flag_um", "flag_us", "flag_uy", "flag_uz", "flag_va", "flag_vc", "flag_ve", "flag_vg", "flag_vi", "flag_vn", "flag_vu", "flag_wf", "flag_white", "flag_ws", "flag_xk", "flag_ye", "flag_yt", "flag_za", "flag_zm", "flag_zw", "flags", "flame", "flan", "flashlight", "fleur-de-lis", "floppy_disk", "flower_playing_cards", "flushed", "fm", "fo", "fog", "foggy", "football", "footprints", "fork_and_knife", "fork_and_knife_with_plate", "fork_knife_plate", "fountain", "four", "four_leaf_clover", "fr", "frame_photo", "frame_with_picture", "free", "fried_shrimp", "fries", "frog", "frowning", "frowning2", "fuelpump", "full_moon", "full_moon_with_face", "funeral_urn", "ga", "game_die", "gb", "gd", "ge", "gear", "gem", "gemini", "gf", "gg", "gh", "ghost", "gi", "gift", "gift_heart", "girl", "girl_tone1", "girl_tone2", "girl_tone3", "girl_tone4", "girl_tone5", "gl", "globe_with_meridians", "gm", "gn", "goat", "golf", "golfer", "gp", "gq", "gr", "grandma", "grandma_tone1", "grandma_tone2", "grandma_tone3", "grandma_tone4", "grandma_tone5", "grapes", "green_apple", "green_book", "green_heart", "grey_exclamation", "grey_question", "grimacing", "grin", "grinning", "gs", "gt", "gu", "guardsman", "guardsman_tone1", "guardsman_tone2", "guardsman_tone3", "guardsman_tone4", "guardsman_tone5", "guitar", "gun", "gw", "gy", "haircut", "haircut_tone1", "haircut_tone2", "haircut_tone3", "haircut_tone4", "haircut_tone5", "hamburger", "hammer", "hammer_and_pick", "hammer_and_wrench", "hammer_pick", "hamster", "hand_splayed", "hand_splayed_tone1", "hand_splayed_tone2", "hand_splayed_tone3", "hand_splayed_tone4", "hand_splayed_tone5", "handbag", "hankey", "hash", "hatched_chick", "hatching_chick", "head_bandage", "headphones", "hear_no_evil", "heart", "heart_decoration", "heart_exclamation", "heart_eyes", "heart_eyes_cat", "heartbeat", "heartpulse", "hearts", "heavy_check_mark", "heavy_division_sign", "heavy_dollar_sign", "heavy_heart_exclamation_mark_ornament", "heavy_minus_sign", "heavy_multiplication_x", "heavy_plus_sign", "helicopter", "helmet_with_cross", "helmet_with_white_cross", "herb", "hibiscus", "high_brightness", "high_heel", "hk", "hm", "hn", "hockey", "hole", "homes", "honey_pot", "horse", "horse_racing", "horse_racing_tone1", "horse_racing_tone2", "horse_racing_tone3", "horse_racing_tone4", "horse_racing_tone5", "hospital", "hot_dog", "hot_pepper", "hotdog", "hotel", "hotsprings", "hourglass", "hourglass_flowing_sand", "house", "house_abandoned", "house_buildings", "house_with_garden", "hr", "ht", "hu", "hugging", "hugging_face", "hushed", "ic", "ice_cream", "ice_skate", "icecream", "id", "ideograph_advantage", "ie", "il", "im", "imp", "in", "inbox_tray", "incoming_envelope", "indonesia", "information_desk_person", "information_desk_person_tone1", "information_desk_person_tone2", "information_desk_person_tone3", "information_desk_person_tone4", "information_desk_person_tone5", "information_source", "innocent", "interrobang", "io", "iphone", "iq", "ir", "is", "island", "it", "izakaya_lantern", "jack_o_lantern", "japan", "japanese_castle", "japanese_goblin", "japanese_ogre", "je", "jeans", "jm", "jo", "joy", "joy_cat", "joystick", "jp", "kaaba", "ke", "key", "key2", "keyboard", "keycap_asterisk", "kg", "kh", "ki", "kimono", "kiss", "kiss_mm", "kiss_ww", "kissing", "kissing_cat", "kissing_closed_eyes", "kissing_heart", "kissing_smiling_eyes", "km", "kn", "knife", "koala", "koko", "kp", "kr", "kw", "ky", "kz", "la", "label", "large_blue_circle", "large_blue_diamond", "large_orange_diamond", "last_quarter_moon", "last_quarter_moon_with_face", "latin_cross", "laughing", "lb", "lc", "leaves", "ledger", "left_luggage", "left_right_arrow", "leftwards_arrow_with_hook", "lemon", "leo", "leopard", "level_slider", "levitate", "li", "libra", "lifter", "lifter_tone1", "lifter_tone2", "lifter_tone3", "lifter_tone4", "lifter_tone5", "light_rail", "link", "linked_paperclips", "lion", "lion_face", "lips", "lipstick", "lk", "lock", "lock_with_ink_pen", "lollipop", "loop", "loud_sound", "loudspeaker", "love_hotel", "love_letter", "low_brightness", "lower_left_ballpoint_pen", "lower_left_crayon", "lower_left_fountain_pen", "lower_left_paintbrush", "lr", "ls", "lt", "lu", "lv", "ly", "m", "ma", "mag", "mag_right", "mahjong", "mailbox", "mailbox_closed", "mailbox_with_mail", "mailbox_with_no_mail", "man", "man_in_business_suit_levitating", "man_tone1", "man_tone2", "man_tone3", "man_tone4", "man_tone5", "man_with_gua_pi_mao", "man_with_gua_pi_mao_tone1", "man_with_gua_pi_mao_tone2", "man_with_gua_pi_mao_tone3", "man_with_gua_pi_mao_tone4", "man_with_gua_pi_mao_tone5", "man_with_turban", "man_with_turban_tone1", "man_with_turban_tone2", "man_with_turban_tone3", "man_with_turban_tone4", "man_with_turban_tone5", "mans_shoe", "mantlepiece_clock", "map", "maple_leaf", "mask", "massage", "massage_tone1", "massage_tone2", "massage_tone3", "massage_tone4", "massage_tone5", "mc", "md", "me", "meat_on_bone", "medal", "mega", "melon", "menorah", "mens", "metal", "metal_tone1", "metal_tone2", "metal_tone3", "metal_tone4", "metal_tone5", "metro", "mf", "mg", "mh", "microphone", "microphone2", "microscope", "middle_finger", "middle_finger_tone1", "middle_finger_tone2", "middle_finger_tone3", "middle_finger_tone4", "middle_finger_tone5", "military_medal", "milky_way", "minibus", "minidisc", "mk", "ml", "mm", "mn", "mo", "mobile_phone_off", "money_mouth", "money_mouth_face", "money_with_wings", "moneybag", "monkey", "monkey_face", "monorail", "mortar_board", "mosque", "motorboat", "motorcycle", "motorway", "mount_fuji", "mountain", "mountain_bicyclist", "mountain_bicyclist_tone1", "mountain_bicyclist_tone2", "mountain_bicyclist_tone3", "mountain_bicyclist_tone4", "mountain_bicyclist_tone5", "mountain_cableway", "mountain_railway", "mountain_snow", "mouse", "mouse2", "mouse_three_button", "movie_camera", "moyai", "mp", "mq", "mr", "ms", "mt", "mu", "muscle", "muscle_tone1", "muscle_tone2", "muscle_tone3", "muscle_tone4", "muscle_tone5", "mushroom", "musical_keyboard", "musical_note", "musical_score", "mute", "mv", "mw", "mx", "my", "mz", "na", "nail_care", "nail_care_tone1", "nail_care_tone2", "nail_care_tone3", "nail_care_tone4", "nail_care_tone5", "name_badge", "national_park", "nc", "ne", "necktie", "negative_squared_cross_mark", "nerd", "nerd_face", "neutral_face", "new", "new_moon", "new_moon_with_face", "newspaper", "newspaper2", "next_track", "nf", "ng", "ni", "nigeria", "night_with_stars", "nine", "nl", "no", "no_bell", "no_bicycles", "no_entry", "no_entry_sign", "no_good", "no_good_tone1", "no_good_tone2", "no_good_tone3", "no_good_tone4", "no_good_tone5", "no_mobile_phones", "no_mouth", "no_pedestrians", "no_smoking", "non-potable_water", "nose", "nose_tone1", "nose_tone2", "nose_tone3", "nose_tone4", "nose_tone5", "notebook", "notebook_with_decorative_cover", "notepad_spiral", "notes", "np", "nr", "nu", "nut_and_bolt", "nz", "o", "o2", "ocean", "octopus", "oden", "office", "oil", "oil_drum", "ok", "ok_hand", "ok_hand_tone1", "ok_hand_tone2", "ok_hand_tone3", "ok_hand_tone4", "ok_hand_tone5", "ok_woman", "ok_woman_tone1", "ok_woman_tone2", "ok_woman_tone3", "ok_woman_tone4", "ok_woman_tone5", "old_key", "older_man", "older_man_tone1", "older_man_tone2", "older_man_tone3", "older_man_tone4", "older_man_tone5", "older_woman", "older_woman_tone1", "older_woman_tone2", "older_woman_tone3", "older_woman_tone4", "older_woman_tone5", "om", "om_symbol", "on", "oncoming_automobile", "oncoming_bus", "oncoming_police_car", "oncoming_taxi", "one", "open_file_folder", "open_hands", "open_hands_tone1", "open_hands_tone2", "open_hands_tone3", "open_hands_tone4", "open_hands_tone5", "open_mouth", "ophiuchus", "orange_book", "orthodox_cross", "outbox_tray", "ox", "pa", "package", "page_facing_up", "page_with_curl", "pager", "paintbrush", "palm_tree", "panda_face", "paperclip", "paperclips", "park", "parking", "part_alternation_mark", "partly_sunny", "passenger_ship", "passport_control", "pause_button", "paw_prints", "pe", "peace", "peace_symbol", "peach", "pear", "pen_ballpoint", "pen_fountain", "pencil", "pencil2", "penguin", "pensive", "performing_arts", "persevere", "person_frowning", "person_frowning_tone1", "person_frowning_tone2", "person_frowning_tone3", "person_frowning_tone4", "person_frowning_tone5", "person_with_ball", "person_with_ball_tone1", "person_with_ball_tone2", "person_with_ball_tone3", "person_with_ball_tone4", "person_with_ball_tone5", "person_with_blond_hair", "person_with_blond_hair_tone1", "person_with_blond_hair_tone2", "person_with_blond_hair_tone3", "person_with_blond_hair_tone4", "person_with_blond_hair_tone5", "person_with_pouting_face", "person_with_pouting_face_tone1", "person_with_pouting_face_tone2", "person_with_pouting_face_tone3", "person_with_pouting_face_tone4", "person_with_pouting_face_tone5", "pf", "pg", "ph", "pick", "pig", "pig2", "pig_nose", "pill", "pineapple", "ping_pong", "pisces", "pizza", "pk", "pl", "place_of_worship", "play_pause", "pm", "pn", "point_down", "point_down_tone1", "point_down_tone2", "point_down_tone3", "point_down_tone4", "point_down_tone5", "point_left", "point_left_tone1", "point_left_tone2", "point_left_tone3", "point_left_tone4", "point_left_tone5", "point_right", "point_right_tone1", "point_right_tone2", "point_right_tone3", "point_right_tone4", "point_right_tone5", "point_up", "point_up_2", "point_up_2_tone1", "point_up_2_tone2", "point_up_2_tone3", "point_up_2_tone4", "point_up_2_tone5", "point_up_tone1", "point_up_tone2", "point_up_tone3", "point_up_tone4", "point_up_tone5", "police_car", "poo", "poodle", "poop", "popcorn", "post_office", "postal_horn", "postbox", "potable_water", "pouch", "poultry_leg", "pound", "pouting_cat", "pr", "pray", "pray_tone1", "pray_tone2", "pray_tone3", "pray_tone4", "pray_tone5", "prayer_beads", "previous_track", "princess", "princess_tone1", "princess_tone2", "princess_tone3", "princess_tone4", "princess_tone5", "printer", "projector", "ps", "pt", "pudding", "punch", "punch_tone1", "punch_tone2", "punch_tone3", "punch_tone4", "punch_tone5", "purple_heart", "purse", "pushpin", "put_litter_in_its_place", "pw", "py", "qa", "question", "rabbit", "rabbit2", "race_car", "racehorse", "racing_car", "racing_motorcycle", "radio", "radio_button", "radioactive", "radioactive_sign", "rage", "railroad_track", "railway_car", "railway_track", "rainbow", "raised_hand", "raised_hand_tone1", "raised_hand_tone2", "raised_hand_tone3", "raised_hand_tone4", "raised_hand_tone5", "raised_hand_with_fingers_splayed", "raised_hand_with_fingers_splayed_tone1", "raised_hand_with_fingers_splayed_tone2", "raised_hand_with_fingers_splayed_tone3", "raised_hand_with_fingers_splayed_tone4", "raised_hand_with_fingers_splayed_tone5", "raised_hand_with_part_between_middle_and_ring_fingers", "raised_hand_with_part_between_middle_and_ring_fingers_tone1", "raised_hand_with_part_between_middle_and_ring_fingers_tone2", "raised_hand_with_part_between_middle_and_ring_fingers_tone3", "raised_hand_with_part_between_middle_and_ring_fingers_tone4", "raised_hand_with_part_between_middle_and_ring_fingers_tone5", "raised_hands", "raised_hands_tone1", "raised_hands_tone2", "raised_hands_tone3", "raised_hands_tone4", "raised_hands_tone5", "raising_hand", "raising_hand_tone1", "raising_hand_tone2", "raising_hand_tone3", "raising_hand_tone4", "raising_hand_tone5", "ram", "ramen", "rat", "re", "record_button", "recycle", "red_car", "red_circle", "registered", "relaxed", "relieved", "reminder_ribbon", "repeat", "repeat_one", "restroom", "reversed_hand_with_middle_finger_extended", "reversed_hand_with_middle_finger_extended_tone1", "reversed_hand_with_middle_finger_extended_tone2", "reversed_hand_with_middle_finger_extended_tone3", "reversed_hand_with_middle_finger_extended_tone4", "reversed_hand_with_middle_finger_extended_tone5", "revolving_hearts", "rewind", "ribbon", "rice", "rice_ball", "rice_cracker", "rice_scene", "right_anger_bubble", "ring", "ro", "robot", "robot_face", "rocket", "rolled_up_newspaper", "roller_coaster", "rolling_eyes", "rooster", "rose", "rosette", "rotating_light", "round_pushpin", "rowboat", "rowboat_tone1", "rowboat_tone2", "rowboat_tone3", "rowboat_tone4", "rowboat_tone5", "rs", "ru", "rugby_football", "runner", "runner_tone1", "runner_tone2", "runner_tone3", "runner_tone4", "runner_tone5", "running_shirt_with_sash", "rw", "sa", "sagittarius", "sailboat", "sake", "sandal", "santa", "santa_tone1", "santa_tone2", "santa_tone3", "santa_tone4", "santa_tone5", "satellite", "satellite_orbital", "satisfied", "saudi", "saudiarabia", "saxophone", "sb", "sc", "scales", "school", "school_satchel", "scissors", "scorpion", "scorpius", "scream", "scream_cat", "scroll", "sd", "se", "seat", "secret", "see_no_evil", "seedling", "seven", "sg", "sh", "shamrock", "shaved_ice", "sheep", "shell", "shield", "shinto_shrine", "ship", "shirt", "shit", "shopping_bags", "shower", "si", "sign_of_the_horns", "sign_of_the_horns_tone1", "sign_of_the_horns_tone2", "sign_of_the_horns_tone3", "sign_of_the_horns_tone4", "sign_of_the_horns_tone5", "signal_strength", "six", "six_pointed_star", "sj", "sk", "skeleton", "ski", "skier", "skull", "skull_and_crossbones", "skull_crossbones", "sl", "sleeping", "sleeping_accommodation", "sleepy", "sleuth_or_spy", "sleuth_or_spy_tone1", "sleuth_or_spy_tone2", "sleuth_or_spy_tone3", "sleuth_or_spy_tone4", "sleuth_or_spy_tone5", "slight_frown", "slight_smile", "slightly_frowning_face", "slightly_smiling_face", "slot_machine", "sm", "small_airplane", "small_blue_diamond", "small_orange_diamond", "small_red_triangle", "small_red_triangle_down", "smile", "smile_cat", "smiley", "smiley_cat", "smiling_imp", "smirk", "smirk_cat", "smoking", "sn", "snail", "snake", "snow_capped_mountain", "snowboarder", "snowflake", "snowman", "snowman2", "so", "sob", "soccer", "soon", "sos", "sound", "space_invader", "spades", "spaghetti", "sparkle", "sparkler", "sparkles", "sparkling_heart", "speak_no_evil", "speaker", "speaking_head", "speaking_head_in_silhouette", "speech_balloon", "speedboat", "spider", "spider_web", "spiral_calendar_pad", "spiral_note_pad", "sports_medal", "spy", "spy_tone1", "spy_tone2", "spy_tone3", "spy_tone4", "spy_tone5", "sr", "ss", "st", "stadium", "star", "star2", "star_and_crescent", "star_of_david", "stars", "station", "statue_of_liberty", "steam_locomotive", "stew", "stop_button", "stopwatch", "straight_ruler", "strawberry", "stuck_out_tongue", "stuck_out_tongue_closed_eyes", "stuck_out_tongue_winking_eye", "studio_microphone", "sun_with_face", "sunflower", "sunglasses", "sunny", "sunrise", "sunrise_over_mountains", "surfer", "surfer_tone1", "surfer_tone2", "surfer_tone3", "surfer_tone4", "surfer_tone5", "sushi", "suspension_railway", "sv", "sweat", "sweat_drops", "sweat_smile", "sweet_potato", "swimmer", "swimmer_tone1", "swimmer_tone2", "swimmer_tone3", "swimmer_tone4", "swimmer_tone5", "sx", "sy", "symbols", "synagogue", "syringe", "sz", "ta", "table_tennis", "taco", "tada", "tanabata_tree", "tangerine", "taurus", "taxi", "tc", "td", "tea", "telephone", "telephone_receiver", "telescope", "ten", "tennis", "tent", "tf", "tg", "th", "thermometer", "thermometer_face", "thinking", "thinking_face", "thought_balloon", "three", "three_button_mouse", "thumbdown", "thumbdown_tone1", "thumbdown_tone2", "thumbdown_tone3", "thumbdown_tone4", "thumbdown_tone5", "thumbsdown", "thumbsdown_tone1", "thumbsdown_tone2", "thumbsdown_tone3", "thumbsdown_tone4", "thumbsdown_tone5", "thumbsup", "thumbsup_tone1", "thumbsup_tone2", "thumbsup_tone3", "thumbsup_tone4", "thumbsup_tone5", "thumbup", "thumbup_tone1", "thumbup_tone2", "thumbup_tone3", "thumbup_tone4", "thumbup_tone5", "thunder_cloud_and_rain", "thunder_cloud_rain", "ticket", "tickets", "tiger", "tiger2", "timer", "timer_clock", "tired_face", "tj", "tk", "tl", "tm", "tn", "to", "toilet", "tokyo_tower", "tomato", "tongue", "tools", "top", "tophat", "tr", "track_next", "track_previous", "trackball", "tractor", "traffic_light", "train", "train2", "tram", "triangular_flag_on_post", "triangular_ruler", "trident", "triumph", "trolleybus", "trophy", "tropical_drink", "tropical_fish", "truck", "trumpet", "tt", "tulip", "turkey", "turkmenistan", "turtle", "tuvalu", "tv", "tw", "twisted_rightwards_arrows", "two", "two_hearts", "two_men_holding_hands", "two_women_holding_hands", "tz", "u5272", "u5408", "u55b6", "u6307", "u6708", "u6709", "u6e80", "u7121", "u7533", "u7981", "u7a7a", "ua", "ug", "um", "umbrella", "umbrella2", "umbrella_on_ground", "unamused", "underage", "unicorn", "unicorn_face", "unlock", "up", "upside_down", "upside_down_face", "urn", "us", "uy", "uz", "v", "v_tone1", "v_tone2", "v_tone3", "v_tone4", "v_tone5", "va", "vc", "ve", "vertical_traffic_light", "vg", "vhs", "vi", "vibration_mode", "video_camera", "video_game", "violin", "virgo", "vn", "volcano", "volleyball", "vs", "vu", "vulcan", "vulcan_tone1", "vulcan_tone2", "vulcan_tone3", "vulcan_tone4", "vulcan_tone5", "walking", "walking_tone1", "walking_tone2", "walking_tone3", "walking_tone4", "walking_tone5", "waning_crescent_moon", "waning_gibbous_moon", "warning", "wastebasket", "watch", "water_buffalo", "watermelon", "wave", "wave_tone1", "wave_tone2", "wave_tone3", "wave_tone4", "wave_tone5", "waving_black_flag", "waving_white_flag", "wavy_dash", "waxing_crescent_moon", "waxing_gibbous_moon", "wc", "weary", "wedding", "weight_lifter", "weight_lifter_tone1", "weight_lifter_tone2", "weight_lifter_tone3", "weight_lifter_tone4", "weight_lifter_tone5", "wf", "whale", "whale2", "wheel_of_dharma", "wheelchair", "white_check_mark", "white_circle", "white_flower", "white_frowning_face", "white_large_square", "white_medium_small_square", "white_medium_square", "white_small_square", "white_square_button", "white_sun_behind_cloud", "white_sun_behind_cloud_with_rain", "white_sun_cloud", "white_sun_rain_cloud", "white_sun_small_cloud", "white_sun_with_small_cloud", "wind_blowing_face", "wind_chime", "wine_glass", "wink", "wolf", "woman", "woman_tone1", "woman_tone2", "woman_tone3", "woman_tone4", "woman_tone5", "womans_clothes", "womans_hat", "womens", "world_map", "worried", "worship_symbol", "wrench", "writing_hand", "writing_hand_tone1", "writing_hand_tone2", "writing_hand_tone3", "writing_hand_tone4", "writing_hand_tone5", "ws", "x", "xk", "ye", "yellow_heart", "yen", "yin_yang", "yt", "yum", "za", "zap", "zero", "zipper_mouth", "zipper_mouth_face", "zm", "zw", "zzz"]
5447}
5448).call(this);
5449(function() {
5450 var Like, utils, bind = function(fn, me) {
5451 return function() {
5452 return fn.apply(me, arguments)
5453 }
5454 };
5455 utils = stModules.utils,
5456 Like = function() {
5457 function Like(el, options) {
5458 this.apiError = bind(this.apiError, this),
5459 this.removeLike = bind(this.removeLike, this),
5460 this.addLike = bind(this.addLike, this),
5461 this.sendLike = bind(this.sendLike, this),
5462 this.el = el,
5463 this.options = Object.assign({}, this.defaults, options),
5464 this.isSending = !1,
5465 this.setUp()
5466 }
5467 return Like.prototype.defaults = {
5468 csrfToken: "csrf_token",
5469 likeText: "like ({count})",
5470 removeLikeText: "remove like ({count})"
5471 },
5472 Like.prototype.setUp = function() {
5473 return this.el.addEventListener("click", this.sendLike)
5474 }
5475 ,
5476 Like.prototype.sendLike = function(e) {
5477 var formData, headers;
5478 e.preventDefault(),
5479 e.stopPropagation(),
5480 this.isSending || (this.isSending = !0,
5481 formData = new FormData,
5482 formData.append("csrfmiddlewaretoken", this.options.csrfToken),
5483 headers = new Headers,
5484 headers.append("X-Requested-With", "XMLHttpRequest"),
5485 fetch(this.el.getAttribute("href"), {
5486 method: "POST",
5487 headers: headers,
5488 credentials: "same-origin",
5489 body: formData
5490 }).then(function(_this) {
5491 return function(response) {
5492 if (!response.ok)
5493 throw new Error("error: " + response.status + " " + response.statusText);
5494 return response.json()
5495 }
5496 }(this)).then(function(_this) {
5497 return function(data) {
5498 return data.url_delete ? _this.addLike(data.url_delete) : data.url_create ? _this.removeLike(data.url_create) : _this.apiError()
5499 }
5500 }(this))["catch"](function(_this) {
5501 return function(error) {
5502 return console.log(error.message),
5503 _this.apiError()
5504 }
5505 }(this)).then(function(_this) {
5506 return function() {
5507 return _this.isSending = !1
5508 }
5509 }(this)))
5510 }
5511 ,
5512 Like.prototype.addLike = function(urlDelete) {
5513 return this.el.setAttribute("href", urlDelete),
5514 this.el.dataset.count = String(parseInt(this.el.dataset.count, 10) + 1),
5515 this.el.innerHTML = utils.format(this.options.removeLikeText, {
5516 count: this.el.dataset.count
5517 })
5518 }
5519 ,
5520 Like.prototype.removeLike = function(urlCreate) {
5521 return this.el.setAttribute("href", urlCreate),
5522 this.el.dataset.count = String(parseInt(this.el.dataset.count, 10) - 1),
5523 this.el.innerHTML = utils.format(this.options.likeText, {
5524 count: this.el.dataset.count
5525 })
5526 }
5527 ,
5528 Like.prototype.apiError = function() {
5529 return this.el.textContent = "api error"
5530 }
5531 ,
5532 Like
5533 }(),
5534 stModules.like = function(elms, options) {
5535 return Array.from(elms).map(function(elm) {
5536 return new Like(elm,options)
5537 })
5538 }
5539 ,
5540 stModules.Like = Like
5541}
5542).call(this);
5543(function() {
5544 var Messages, hasHash, utils, bind = function(fn, me) {
5545 return function() {
5546 return fn.apply(me, arguments)
5547 }
5548 };
5549 utils = stModules.utils,
5550 hasHash = function() {
5551 var hash;
5552 return hash = window.location.hash.split("#")[1],
5553 null != hash && hash.length > 0
5554 }
5555 ,
5556 Messages = function() {
5557 function Messages(el) {
5558 this.hasVisibleMessages = bind(this.hasVisibleMessages, this),
5559 this.hideMessage = bind(this.hideMessage, this),
5560 this.showAllCloseButtons = bind(this.showAllCloseButtons, this),
5561 this.placeMessages = bind(this.placeMessages, this),
5562 this.el = el,
5563 this.setUp()
5564 }
5565 return Messages.prototype.setUp = function() {
5566 return this.placeMessages(),
5567 this.showAllCloseButtons(),
5568 Array.from(this.el.querySelectorAll(".js-messages-close-button")).forEach(function(_this) {
5569 return function(elm) {
5570 return elm.addEventListener("click", _this.hideMessage)
5571 }
5572 }(this))
5573 }
5574 ,
5575 Messages.prototype.placeMessages = function() {
5576 if (hasHash())
5577 return this.el.classList.add("is-fixed")
5578 }
5579 ,
5580 Messages.prototype.showAllCloseButtons = function() {
5581 if (hasHash())
5582 return Array.from(this.el.querySelectorAll(".js-messages-close")).forEach(function(elm) {
5583 return elm.style.display = "block"
5584 })
5585 }
5586 ,
5587 Messages.prototype.hideMessage = function(e) {
5588 e.preventDefault(),
5589 e.stopPropagation(),
5590 e.currentTarget.closest(".js-messages-set").style.display = "none",
5591 this.hasVisibleMessages() || (this.el.style.display = "none",
5592 this.el.classList.remove("is-fixed"))
5593 }
5594 ,
5595 Messages.prototype.hasVisibleMessages = function() {
5596 return !utils.isHidden(this.el.querySelectorAll(".js-messages-set"))
5597 }
5598 ,
5599 Messages
5600 }(),
5601 stModules.messages = function(elms) {
5602 return Array.from(elms).map(function(elm) {
5603 return new Messages(elm)
5604 })
5605 }
5606 ,
5607 stModules.Messages = Messages
5608}
5609).call(this);
5610(function() {
5611 var MoveComment, MoveCommentBox, bind = function(fn, me) {
5612 return function() {
5613 return fn.apply(me, arguments)
5614 }
5615 };
5616 MoveCommentBox = function() {
5617 function MoveCommentBox(options) {
5618 this.show = bind(this.show, this),
5619 this.isHidden = bind(this.isHidden, this),
5620 this.moveComments = bind(this.moveComments, this),
5621 this.el = document.querySelector(".move-comments"),
5622 this.options = Object.assign({}, this.defaults, options),
5623 this.setUp()
5624 }
5625 return MoveCommentBox.prototype.defaults = {
5626 csrfToken: "csrf_token",
5627 target: "#post_url"
5628 },
5629 MoveCommentBox.prototype.setUp = function() {
5630 return this.el.querySelector(".js-move-comments").addEventListener("click", this.moveComments)
5631 }
5632 ,
5633 MoveCommentBox.prototype.moveComments = function(e) {
5634 var formElm, inputCSRFElm, inputTopicIdElm;
5635 e.preventDefault(),
5636 e.stopPropagation(),
5637 formElm = document.createElement("form"),
5638 formElm.className = "js-move-comment-form",
5639 formElm.action = this.options.target,
5640 formElm.method = "POST",
5641 formElm.style.display = "none",
5642 document.body.appendChild(formElm),
5643 inputCSRFElm = document.createElement("input"),
5644 inputCSRFElm.name = "csrfmiddlewaretoken",
5645 inputCSRFElm.type = "hidden",
5646 inputCSRFElm.value = this.options.csrfToken,
5647 formElm.appendChild(inputCSRFElm),
5648 inputTopicIdElm = document.createElement("input"),
5649 inputTopicIdElm.name = "topic",
5650 inputTopicIdElm.type = "text",
5651 inputTopicIdElm.value = this.el.querySelector("#id_move_comments_topic").value,
5652 formElm.appendChild(inputTopicIdElm),
5653 Array.from(document.querySelectorAll(".move-comment-checkbox")).forEach(function(elm) {
5654 return formElm.appendChild(elm.cloneNode(!1))
5655 }),
5656 formElm.submit()
5657 }
5658 ,
5659 MoveCommentBox.prototype.isHidden = function() {
5660 return "none" === this.el.style.display
5661 }
5662 ,
5663 MoveCommentBox.prototype.show = function() {
5664 this.el.style.display = "block"
5665 }
5666 ,
5667 MoveCommentBox
5668 }(),
5669 MoveComment = function() {
5670 function MoveComment(el, box) {
5671 this.addCommentSelection = bind(this.addCommentSelection, this),
5672 this.showMoveComments = bind(this.showMoveComments, this),
5673 this.el = el,
5674 this.box = box,
5675 this.setUp()
5676 }
5677 return MoveComment.prototype.setUp = function() {
5678 return this.el.addEventListener("click", this.showMoveComments)
5679 }
5680 ,
5681 MoveComment.prototype.showMoveComments = function(e) {
5682 e.preventDefault(),
5683 e.stopPropagation(),
5684 this.box.isHidden() && (this.box.show(),
5685 this.addCommentSelection())
5686 }
5687 ,
5688 MoveComment.prototype.addCommentSelection = function() {
5689 return Array.from(document.querySelectorAll(".comment-date")).forEach(function(elm) {
5690 var inputCheckboxElm, liElm;
5691 liElm = document.createElement("li"),
5692 elm.appendChild(liElm),
5693 inputCheckboxElm = document.createElement("input"),
5694 inputCheckboxElm.className = "move-comment-checkbox",
5695 inputCheckboxElm.name = "comments",
5696 inputCheckboxElm.type = "checkbox",
5697 inputCheckboxElm.value = elm.closest(".comment").dataset.pk,
5698 liElm.appendChild(inputCheckboxElm)
5699 })
5700 }
5701 ,
5702 MoveComment
5703 }(),
5704 stModules.moveComments = function(elms, options) {
5705 var box;
5706 return box = new MoveCommentBox(options),
5707 Array.from(elms).map(function(elm) {
5708 return new MoveComment(elm,box)
5709 })
5710 }
5711 ,
5712 stModules.MoveCommentBox = MoveCommentBox,
5713 stModules.MoveComment = MoveComment
5714}
5715).call(this);
5716(function() {
5717 var Notification, Tab, utils, bind = function(fn, me) {
5718 return function() {
5719 return fn.apply(me, arguments)
5720 }
5721 };
5722 utils = stModules.utils,
5723 Tab = stModules.Tab,
5724 Notification = function() {
5725 function Notification(el, options) {
5726 this.ajaxDone = bind(this.ajaxDone, this),
5727 this.addErrorTxt = bind(this.addErrorTxt, this),
5728 this.addIsEmptyTxt = bind(this.addIsEmptyTxt, this),
5729 this.addShowMoreLink = bind(this.addShowMoreLink, this),
5730 this.addNotifications = bind(this.addNotifications, this),
5731 this.tabSwitch = bind(this.tabSwitch, this),
5732 this.el = el,
5733 this.options = Object.assign({}, this.defaults, options),
5734 this.contentElm = document.querySelector(el.dataset.related),
5735 this.setUp()
5736 }
5737 return Notification.prototype.defaults = {
5738 notificationUrl: "#ajax",
5739 notificationListUrl: "#show-all",
5740 mentionTxt: "{user} mention you on {topic}",
5741 commentTxt: "{user} has commented on {topic}",
5742 showAll: "Show all",
5743 empty: "Nothing to show",
5744 unread: "unread"
5745 },
5746 Notification.prototype.setUp = function() {
5747 return this.el.addEventListener("click", this.tabSwitch)
5748 }
5749 ,
5750 Notification.prototype.tabSwitch = function(e) {
5751 var headers;
5752 e.preventDefault(),
5753 e.stopPropagation(),
5754 this.el.removeEventListener("click", this.tabSwitch),
5755 headers = new Headers,
5756 headers.append("X-Requested-With", "XMLHttpRequest"),
5757 fetch(this.options.notificationUrl, {
5758 method: "GET",
5759 headers: headers,
5760 credentials: "same-origin"
5761 }).then(function(_this) {
5762 return function(response) {
5763 if (!response.ok)
5764 throw new Error("error: " + response.status + " " + response.statusText);
5765 return response.json()
5766 }
5767 }(this)).then(function(_this) {
5768 return function(data) {
5769 return data.n.length > 0 ? (_this.addNotifications(data.n),
5770 _this.addShowMoreLink()) : _this.addIsEmptyTxt()
5771 }
5772 }(this))["catch"](function(_this) {
5773 return function(error) {
5774 return console.log(error.message),
5775 _this.addErrorTxt(error.message)
5776 }
5777 }(this)).then(function(_this) {
5778 return function() {
5779 return _this.ajaxDone()
5780 }
5781 }(this))
5782 }
5783 ,
5784 Notification.prototype.addNotifications = function(notifications) {
5785 return notifications.forEach(function(_this) {
5786 return function(n) {
5787 var linkElm, txt, txtElm, unreadElm;
5788 txt = 1 === n.action ? _this.options.mentionTxt : _this.options.commentTxt,
5789 linkElm = document.createElement("a"),
5790 linkElm.setAttribute("href", n.url),
5791 linkElm.textContent = n.title,
5792 txtElm = document.createElement("div"),
5793 txtElm.innerHTML = utils.format(txt, {
5794 user: n.user,
5795 topic: linkElm.outerHTML
5796 }),
5797 n.is_read || (unreadElm = document.createElement("span"),
5798 unreadElm.className = "row-unread",
5799 unreadElm.innerHTML = _this.options.unread,
5800 txtElm.innerHTML += " ",
5801 txtElm.appendChild(unreadElm)),
5802 _this.contentElm.appendChild(txtElm)
5803 }
5804 }(this))
5805 }
5806 ,
5807 Notification.prototype.addShowMoreLink = function() {
5808 var showAllContainerElm, showAllLinkElm;
5809 return showAllContainerElm = document.createElement("div"),
5810 showAllLinkElm = document.createElement("a"),
5811 showAllLinkElm.setAttribute("href", this.options.notificationListUrl),
5812 showAllLinkElm.innerHTML = this.options.showAll,
5813 showAllContainerElm.appendChild(showAllLinkElm),
5814 this.contentElm.appendChild(showAllContainerElm)
5815 }
5816 ,
5817 Notification.prototype.addIsEmptyTxt = function() {
5818 var emptyElm;
5819 return emptyElm = document.createElement("div"),
5820 emptyElm.innerHTML = this.options.empty,
5821 this.contentElm.appendChild(emptyElm)
5822 }
5823 ,
5824 Notification.prototype.addErrorTxt = function(message) {
5825 var ErrorElm;
5826 return ErrorElm = document.createElement("div"),
5827 ErrorElm.textContent = message,
5828 this.contentElm.appendChild(ErrorElm)
5829 }
5830 ,
5831 Notification.prototype.ajaxDone = function() {
5832 return this.el.classList.add("js-tab"),
5833 new Tab(this.el),
5834 this.el.click()
5835 }
5836 ,
5837 Notification
5838 }(),
5839 stModules.notification = function(elms, options) {
5840 return Array.from(elms).map(function(elm) {
5841 return new Notification(elm,options)
5842 })
5843 }
5844 ,
5845 stModules.Notification = Notification
5846}
5847).call(this);
5848(function() {
5849 var Postify, bind = function(fn, me) {
5850 return function() {
5851 return fn.apply(me, arguments)
5852 }
5853 };
5854 Postify = function() {
5855 function Postify(el, options) {
5856 this.makePost = bind(this.makePost, this),
5857 this.el = el,
5858 this.options = Object.assign({}, this.defaults, options),
5859 this.setUp()
5860 }
5861 return Postify.prototype.defaults = {
5862 csrfToken: "csrf_token"
5863 },
5864 Postify.prototype.setUp = function() {
5865 return this.el.addEventListener("click", this.makePost)
5866 }
5867 ,
5868 Postify.prototype.makePost = function(e) {
5869 var formElm, inputCSRFElm;
5870 e.preventDefault(),
5871 e.stopPropagation(),
5872 formElm = document.createElement("form"),
5873 formElm.className = "js-postify-form",
5874 formElm.action = this.el.getAttribute("href"),
5875 formElm.method = "POST",
5876 formElm.style.display = "none",
5877 document.body.appendChild(formElm),
5878 inputCSRFElm = document.createElement("input"),
5879 inputCSRFElm.name = "csrfmiddlewaretoken",
5880 inputCSRFElm.type = "hidden",
5881 inputCSRFElm.value = this.options.csrfToken,
5882 formElm.appendChild(inputCSRFElm),
5883 formElm.submit()
5884 }
5885 ,
5886 Postify
5887 }(),
5888 stModules.postify = function(elms, options) {
5889 return Array.from(elms).map(function(elm) {
5890 return new Postify(elm,options)
5891 })
5892 }
5893 ,
5894 stModules.Postify = Postify
5895}
5896).call(this);
5897(function() {
5898 var SocialShare, bind = function(fn, me) {
5899 return function() {
5900 return fn.apply(me, arguments)
5901 }
5902 };
5903 SocialShare = function() {
5904 function SocialShare(el) {
5905 this.closeDialog = bind(this.closeDialog, this),
5906 this.showDialog = bind(this.showDialog, this),
5907 this.el = el,
5908 this.dialog = document.querySelector(this.el.dataset.dialog),
5909 this.allDialogs = document.querySelectorAll(".share"),
5910 this.setUp()
5911 }
5912 return SocialShare.prototype.setUp = function() {
5913 var shareInput;
5914 return this.el.addEventListener("click", this.showDialog),
5915 this.dialog.querySelector(".share-close").addEventListener("click", this.closeDialog),
5916 shareInput = this.dialog.querySelector(".share-url"),
5917 shareInput.addEventListener("focus", this.select),
5918 shareInput.addEventListener("mouseup", this.stopEvent)
5919 }
5920 ,
5921 SocialShare.prototype.showDialog = function(e) {
5922 e.preventDefault(),
5923 e.stopPropagation(),
5924 Array.from(this.allDialogs).forEach(function(elm) {
5925 return elm.style.display = "none"
5926 }),
5927 this.dialog.style.display = "block"
5928 }
5929 ,
5930 SocialShare.prototype.closeDialog = function(e) {
5931 e.preventDefault(),
5932 e.stopPropagation(),
5933 this.dialog.style.display = "none"
5934 }
5935 ,
5936 SocialShare.prototype.select = function(e) {
5937 e.preventDefault(),
5938 e.stopPropagation(),
5939 this.setSelectionRange(0, this.value.length - 1)
5940 }
5941 ,
5942 SocialShare.prototype.stopEvent = function(e) {
5943 e.preventDefault(),
5944 e.stopPropagation()
5945 }
5946 ,
5947 SocialShare
5948 }(),
5949 stModules.socialShare = function(elms) {
5950 return Array.from(elms).map(function(elm) {
5951 return new SocialShare(elm)
5952 })
5953 }
5954 ,
5955 stModules.SocialShare = SocialShare
5956}
5957).call(this);
5958(function() {
5959 var Storage, bind = function(fn, me) {
5960 return function() {
5961 return fn.apply(me, arguments)
5962 }
5963 };
5964 Storage = function() {
5965 function Storage(el, lsKey) {
5966 this.clearStorage = bind(this.clearStorage, this),
5967 this.updateField = bind(this.updateField, this),
5968 this.updateStorage = bind(this.updateStorage, this),
5969 this._updateStorage = bind(this._updateStorage, this),
5970 this.el = el,
5971 this.lsKey = lsKey,
5972 this.isUpdating = !1,
5973 this.setUp()
5974 }
5975 return Storage.prototype.setUp = function() {
5976 return "undefined" == typeof localStorage || null === localStorage ? void console.log("No localStorage support. Bailing out") : (this.lsKey in localStorage && this.updateField(),
5977 window.addEventListener("storage", this.updateField),
5978 this.el.addEventListener("input", this.updateStorage),
5979 this.el.addEventListener("change", this.updateStorage),
5980 this.el.addEventListener("propertychange", this.updateStorage),
5981 this.el.closest("form").addEventListener("submit", this.clearStorage))
5982 }
5983 ,
5984 Storage.prototype._updateStorage = function() {
5985 var err, value;
5986 value = this.el.value;
5987 try {
5988 localStorage.setItem(this.lsKey, value)
5989 } catch (error) {
5990 err = error,
5991 localStorage.length > 0 && localStorage.clear()
5992 }
5993 }
5994 ,
5995 Storage.prototype.updateStorage = function() {
5996 this.isUpdating = !0;
5997 try {
5998 this._updateStorage()
5999 } finally {
6000 this.isUpdating = !1
6001 }
6002 }
6003 ,
6004 Storage.prototype.updateField = function() {
6005 this.isUpdating || (this.el.value = localStorage.getItem(this.lsKey))
6006 }
6007 ,
6008 Storage.prototype.clearStorage = function() {
6009 this.isUpdating = !0;
6010 try {
6011 localStorage.removeItem(this.lsKey)
6012 } finally {
6013 this.isUpdating = !1
6014 }
6015 }
6016 ,
6017 Storage
6018 }(),
6019 stModules.store = function(elm, lsKey) {
6020 return new Storage(elm,lsKey)
6021 }
6022 ,
6023 stModules.Storage = Storage
6024}
6025).call(this);
6026//# sourceMappingURL=all.min.js.map