PluginProbe
Age Gate / 3.7.3
Age Gate v3.7.3
3.7.3 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 All 113 releases
age-gate / dist / raw / admin.js

admin.js in Age Gate 3.7.3, at dist/raw/admin.js

12,915 lines 786.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! For license information please see admin.js.LICENSE.txt */
2 (() => {
3 var __webpack_modules__ = {
4 4302: (module, __unused_webpack_exports, __webpack_require__) => {
5 var e;
6 module.exports = function t(e, n, r) {
7 function i(a, l) {
8 if (!n[a]) {
9 if (!e[a]) {
10 if (o) return o(a, !0);
11 var c = new Error("Cannot find module '" + a + "'");
12 throw c.code = "MODULE_NOT_FOUND", c;
13 }
14 var u = n[a] = {
15 exports: {}
16 };
17 e[a][0].call(u.exports, (function(t) {
18 var n = e[a][1][t];
19 return i(n || t);
20 }), u, u.exports, t, e, n, r);
21 }
22 return n[a].exports;
23 }
24 for (var o = void 0, a = 0; a < r.length; a++) i(r[a]);
25 return i;
26 }({
27 1: [ function(e, t, n) {
28 "use strict";
29 function r() {
30 for (var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", t = 0, n = e.length; n > t; ++t) s[t] = e[t],
31 c[e.charCodeAt(t)] = t;
32 c["-".charCodeAt(0)] = 62, c["_".charCodeAt(0)] = 63;
33 }
34 function i(e) {
35 var t, n, r, i, o, a, l = e.length;
36 if (l % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
37 o = "=" === e[l - 2] ? 2 : "=" === e[l - 1] ? 1 : 0, a = new u(3 * l / 4 - o), r = o > 0 ? l - 4 : l;
38 var s = 0;
39 for (t = 0, n = 0; r > t; t += 4, n += 3) i = c[e.charCodeAt(t)] << 18 | c[e.charCodeAt(t + 1)] << 12 | c[e.charCodeAt(t + 2)] << 6 | c[e.charCodeAt(t + 3)],
40 a[s++] = i >> 16 & 255, a[s++] = i >> 8 & 255, a[s++] = 255 & i;
41 return 2 === o ? (i = c[e.charCodeAt(t)] << 2 | c[e.charCodeAt(t + 1)] >> 4, a[s++] = 255 & i) : 1 === o && (i = c[e.charCodeAt(t)] << 10 | c[e.charCodeAt(t + 1)] << 4 | c[e.charCodeAt(t + 2)] >> 2,
42 a[s++] = i >> 8 & 255, a[s++] = 255 & i), a;
43 }
44 function o(e) {
45 return s[e >> 18 & 63] + s[e >> 12 & 63] + s[e >> 6 & 63] + s[63 & e];
46 }
47 function a(e, t, n) {
48 for (var r, i = [], a = t; n > a; a += 3) r = (e[a] << 16) + (e[a + 1] << 8) + e[a + 2],
49 i.push(o(r));
50 return i.join("");
51 }
52 function l(e) {
53 for (var t, n = e.length, r = n % 3, i = "", o = [], l = 16383, c = 0, u = n - r; u > c; c += l) o.push(a(e, c, c + l > u ? u : c + l));
54 return 1 === r ? (t = e[n - 1], i += s[t >> 2], i += s[t << 4 & 63], i += "==") : 2 === r && (t = (e[n - 2] << 8) + e[n - 1],
55 i += s[t >> 10], i += s[t >> 4 & 63], i += s[t << 2 & 63], i += "="), o.push(i),
56 o.join("");
57 }
58 n.toByteArray = i, n.fromByteArray = l;
59 var s = [], c = [], u = "undefined" != typeof Uint8Array ? Uint8Array : Array;
60 r();
61 }, {} ],
62 2: [ function(e, t, n) {}, {} ],
63 3: [ function(e, t, n) {
64 (function(t) {
65 "use strict";
66 function r() {
67 try {
68 var e = new Uint8Array(1);
69 return e.foo = function() {
70 return 42;
71 }, 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength;
72 } catch (t) {
73 return !1;
74 }
75 }
76 function i() {
77 return a.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
78 }
79 function o(e, t) {
80 if (i() < t) throw new RangeError("Invalid typed array length");
81 return a.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = a.prototype : (null === e && (e = new a(t)),
82 e.length = t), e;
83 }
84 function a(e, t, n) {
85 if (!(a.TYPED_ARRAY_SUPPORT || this instanceof a)) return new a(e, t, n);
86 if ("number" == typeof e) {
87 if ("string" == typeof t) throw new Error("If encoding is specified then the first argument must be a string");
88 return u(this, e);
89 }
90 return l(this, e, t, n);
91 }
92 function l(e, t, n, r) {
93 if ("number" == typeof t) throw new TypeError('"value" argument must not be a number');
94 return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? d(e, t, n, r) : "string" == typeof t ? f(e, t, n) : p(e, t);
95 }
96 function s(e) {
97 if ("number" != typeof e) throw new TypeError('"size" argument must be a number');
98 }
99 function c(e, t, n, r) {
100 return s(t), 0 >= t ? o(e, t) : void 0 !== n ? "string" == typeof r ? o(e, t).fill(n, r) : o(e, t).fill(n) : o(e, t);
101 }
102 function u(e, t) {
103 if (s(t), e = o(e, 0 > t ? 0 : 0 | m(t)), !a.TYPED_ARRAY_SUPPORT) for (var n = 0; t > n; n++) e[n] = 0;
104 return e;
105 }
106 function f(e, t, n) {
107 if ("string" == typeof n && "" !== n || (n = "utf8"), !a.isEncoding(n)) throw new TypeError('"encoding" must be a valid string encoding');
108 return (e = o(e, 0 | v(t, n))).write(t, n), e;
109 }
110 function h(e, t) {
111 var n = 0 | m(t.length);
112 e = o(e, n);
113 for (var r = 0; n > r; r += 1) e[r] = 255 & t[r];
114 return e;
115 }
116 function d(e, t, n, r) {
117 if (t.byteLength, 0 > n || t.byteLength < n) throw new RangeError("'offset' is out of bounds");
118 if (t.byteLength < n + (r || 0)) throw new RangeError("'length' is out of bounds");
119 return t = void 0 === r ? new Uint8Array(t, n) : new Uint8Array(t, n, r), a.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = a.prototype : e = h(e, t),
120 e;
121 }
122 function p(e, t) {
123 if (a.isBuffer(t)) {
124 var n = 0 | m(t.length);
125 return 0 === (e = o(e, n)).length || t.copy(e, 0, 0, n), e;
126 }
127 if (t) {
128 if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length" in t) return "number" != typeof t.length || K(t.length) ? o(e, 0) : h(e, t);
129 if ("Buffer" === t.type && J(t.data)) return h(e, t.data);
130 }
131 throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
132 }
133 function m(e) {
134 if (e >= i()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i().toString(16) + " bytes");
135 return 0 | e;
136 }
137 function g(e) {
138 return +e != e && (e = 0), a.alloc(+e);
139 }
140 function v(e, t) {
141 if (a.isBuffer(e)) return e.length;
142 if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer)) return e.byteLength;
143 "string" != typeof e && (e = "" + e);
144 var n = e.length;
145 if (0 === n) return 0;
146 for (var r = !1; ;) switch (t) {
147 case "ascii":
148 case "binary":
149 case "raw":
150 case "raws":
151 return n;
152
153 case "utf8":
154 case "utf-8":
155 case void 0:
156 return q(e).length;
157
158 case "ucs2":
159 case "ucs-2":
160 case "utf16le":
161 case "utf-16le":
162 return 2 * n;
163
164 case "hex":
165 return n >>> 1;
166
167 case "base64":
168 return $(e).length;
169
170 default:
171 if (r) return q(e).length;
172 t = ("" + t).toLowerCase(), r = !0;
173 }
174 }
175 function y(e, t, n) {
176 var r = !1;
177 if ((void 0 === t || 0 > t) && (t = 0), t > this.length) return "";
178 if ((void 0 === n || n > this.length) && (n = this.length), 0 >= n) return "";
179 if ((t >>>= 0) >= (n >>>= 0)) return "";
180 for (e || (e = "utf8"); ;) switch (e) {
181 case "hex":
182 return I(this, t, n);
183
184 case "utf8":
185 case "utf-8":
186 return N(this, t, n);
187
188 case "ascii":
189 return E(this, t, n);
190
191 case "binary":
192 return O(this, t, n);
193
194 case "base64":
195 return M(this, t, n);
196
197 case "ucs2":
198 case "ucs-2":
199 case "utf16le":
200 case "utf-16le":
201 return P(this, t, n);
202
203 default:
204 if (r) throw new TypeError("Unknown encoding: " + e);
205 e = (e + "").toLowerCase(), r = !0;
206 }
207 }
208 function x(e, t, n) {
209 var r = e[t];
210 e[t] = e[n], e[n] = r;
211 }
212 function b(e, t, n, r) {
213 function i(e, t) {
214 return 1 === o ? e[t] : e.readUInt16BE(t * o);
215 }
216 var o = 1, a = e.length, l = t.length;
217 if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r || "utf-16le" === r)) {
218 if (e.length < 2 || t.length < 2) return -1;
219 o = 2, a /= 2, l /= 2, n /= 2;
220 }
221 for (var s = -1, c = 0; a > n + c; c++) if (i(e, n + c) === i(t, -1 === s ? 0 : c - s)) {
222 if (-1 === s && (s = c), c - s + 1 === l) return (n + s) * o;
223 } else -1 !== s && (c -= c - s), s = -1;
224 return -1;
225 }
226 function w(e, t, n, r) {
227 n = Number(n) || 0;
228 var i = e.length - n;
229 r ? (r = Number(r)) > i && (r = i) : r = i;
230 var o = t.length;
231 if (o % 2 != 0) throw new Error("Invalid hex string");
232 r > o / 2 && (r = o / 2);
233 for (var a = 0; r > a; a++) {
234 var l = parseInt(t.substr(2 * a, 2), 16);
235 if (isNaN(l)) return a;
236 e[n + a] = l;
237 }
238 return a;
239 }
240 function k(e, t, n, r) {
241 return V(q(t, e.length - n), e, n, r);
242 }
243 function S(e, t, n, r) {
244 return V(G(t), e, n, r);
245 }
246 function C(e, t, n, r) {
247 return S(e, t, n, r);
248 }
249 function L(e, t, n, r) {
250 return V($(t), e, n, r);
251 }
252 function T(e, t, n, r) {
253 return V(Y(t, e.length - n), e, n, r);
254 }
255 function M(e, t, n) {
256 return 0 === t && n === e.length ? X.fromByteArray(e) : X.fromByteArray(e.slice(t, n));
257 }
258 function N(e, t, n) {
259 n = Math.min(e.length, n);
260 for (var r = [], i = t; n > i; ) {
261 var s, c, u, f, o = e[i], a = null, l = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
262 if (n >= i + l) switch (l) {
263 case 1:
264 128 > o && (a = o);
265 break;
266
267 case 2:
268 128 == (192 & (s = e[i + 1])) && (f = (31 & o) << 6 | 63 & s) > 127 && (a = f);
269 break;
270
271 case 3:
272 s = e[i + 1], c = e[i + 2], 128 == (192 & s) && 128 == (192 & c) && (f = (15 & o) << 12 | (63 & s) << 6 | 63 & c) > 2047 && (55296 > f || f > 57343) && (a = f);
273 break;
274
275 case 4:
276 s = e[i + 1], c = e[i + 2], u = e[i + 3], 128 == (192 & s) && 128 == (192 & c) && 128 == (192 & u) && (f = (15 & o) << 18 | (63 & s) << 12 | (63 & c) << 6 | 63 & u) > 65535 && 1114112 > f && (a = f);
277 }
278 null === a ? (a = 65533, l = 1) : a > 65535 && (a -= 65536, r.push(a >>> 10 & 1023 | 55296),
279 a = 56320 | 1023 & a), r.push(a), i += l;
280 }
281 return A(r);
282 }
283 function A(e) {
284 var t = e.length;
285 if (Q >= t) return String.fromCharCode.apply(String, e);
286 for (var n = "", r = 0; t > r; ) n += String.fromCharCode.apply(String, e.slice(r, r += Q));
287 return n;
288 }
289 function E(e, t, n) {
290 var r = "";
291 n = Math.min(e.length, n);
292 for (var i = t; n > i; i++) r += String.fromCharCode(127 & e[i]);
293 return r;
294 }
295 function O(e, t, n) {
296 var r = "";
297 n = Math.min(e.length, n);
298 for (var i = t; n > i; i++) r += String.fromCharCode(e[i]);
299 return r;
300 }
301 function I(e, t, n) {
302 var r = e.length;
303 (!t || 0 > t) && (t = 0), (!n || 0 > n || n > r) && (n = r);
304 for (var i = "", o = t; n > o; o++) i += U(e[o]);
305 return i;
306 }
307 function P(e, t, n) {
308 for (var r = e.slice(t, n), i = "", o = 0; o < r.length; o += 2) i += String.fromCharCode(r[o] + 256 * r[o + 1]);
309 return i;
310 }
311 function R(e, t, n) {
312 if (e % 1 != 0 || 0 > e) throw new RangeError("offset is not uint");
313 if (e + t > n) throw new RangeError("Trying to access beyond buffer length");
314 }
315 function D(e, t, n, r, i, o) {
316 if (!a.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
317 if (t > i || o > t) throw new RangeError('"value" argument is out of bounds');
318 if (n + r > e.length) throw new RangeError("Index out of range");
319 }
320 function H(e, t, n, r) {
321 0 > t && (t = 65535 + t + 1);
322 for (var i = 0, o = Math.min(e.length - n, 2); o > i; i++) e[n + i] = (t & 255 << 8 * (r ? i : 1 - i)) >>> 8 * (r ? i : 1 - i);
323 }
324 function W(e, t, n, r) {
325 0 > t && (t = 4294967295 + t + 1);
326 for (var i = 0, o = Math.min(e.length - n, 4); o > i; i++) e[n + i] = t >>> 8 * (r ? i : 3 - i) & 255;
327 }
328 function B(e, t, n, r, i, o) {
329 if (n + r > e.length) throw new RangeError("Index out of range");
330 if (0 > n) throw new RangeError("Index out of range");
331 }
332 function _(e, t, n, r, i) {
333 return i || B(e, t, n, 4, 34028234663852886e22, -34028234663852886e22), Z.write(e, t, n, r, 23, 4),
334 n + 4;
335 }
336 function F(e, t, n, r, i) {
337 return i || B(e, t, n, 8, 17976931348623157e292, -17976931348623157e292), Z.write(e, t, n, r, 52, 8),
338 n + 8;
339 }
340 function z(e) {
341 if ((e = j(e).replace(ee, "")).length < 2) return "";
342 for (;e.length % 4 != 0; ) e += "=";
343 return e;
344 }
345 function j(e) {
346 return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "");
347 }
348 function U(e) {
349 return 16 > e ? "0" + e.toString(16) : e.toString(16);
350 }
351 function q(e, t) {
352 t = t || 1 / 0;
353 for (var n, r = e.length, i = null, o = [], a = 0; r > a; a++) {
354 if ((n = e.charCodeAt(a)) > 55295 && 57344 > n) {
355 if (!i) {
356 if (n > 56319) {
357 (t -= 3) > -1 && o.push(239, 191, 189);
358 continue;
359 }
360 if (a + 1 === r) {
361 (t -= 3) > -1 && o.push(239, 191, 189);
362 continue;
363 }
364 i = n;
365 continue;
366 }
367 if (56320 > n) {
368 (t -= 3) > -1 && o.push(239, 191, 189), i = n;
369 continue;
370 }
371 n = 65536 + (i - 55296 << 10 | n - 56320);
372 } else i && (t -= 3) > -1 && o.push(239, 191, 189);
373 if (i = null, 128 > n) {
374 if ((t -= 1) < 0) break;
375 o.push(n);
376 } else if (2048 > n) {
377 if ((t -= 2) < 0) break;
378 o.push(n >> 6 | 192, 63 & n | 128);
379 } else if (65536 > n) {
380 if ((t -= 3) < 0) break;
381 o.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128);
382 } else {
383 if (!(1114112 > n)) throw new Error("Invalid code point");
384 if ((t -= 4) < 0) break;
385 o.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, 63 & n | 128);
386 }
387 }
388 return o;
389 }
390 function G(e) {
391 for (var t = [], n = 0; n < e.length; n++) t.push(255 & e.charCodeAt(n));
392 return t;
393 }
394 function Y(e, t) {
395 for (var n, r, i, o = [], a = 0; a < e.length && !((t -= 2) < 0); a++) r = (n = e.charCodeAt(a)) >> 8,
396 i = n % 256, o.push(i), o.push(r);
397 return o;
398 }
399 function $(e) {
400 return X.toByteArray(z(e));
401 }
402 function V(e, t, n, r) {
403 for (var i = 0; r > i && !(i + n >= t.length || i >= e.length); i++) t[i + n] = e[i];
404 return i;
405 }
406 function K(e) {
407 return e != e;
408 }
409 var X = e("base64-js"), Z = e("ieee754"), J = e("isarray");
410 n.Buffer = a, n.SlowBuffer = g, n.INSPECT_MAX_BYTES = 50, a.TYPED_ARRAY_SUPPORT = void 0 !== t.TYPED_ARRAY_SUPPORT ? t.TYPED_ARRAY_SUPPORT : r(),
411 n.kMaxLength = i(), a.poolSize = 8192, a._augment = function(e) {
412 return e.__proto__ = a.prototype, e;
413 }, a.from = function(e, t, n) {
414 return l(null, e, t, n);
415 }, a.TYPED_ARRAY_SUPPORT && (a.prototype.__proto__ = Uint8Array.prototype, a.__proto__ = Uint8Array,
416 "undefined" != typeof Symbol && Symbol.species && a[Symbol.species] === a && Object.defineProperty(a, Symbol.species, {
417 value: null,
418 configurable: !0
419 })), a.alloc = function(e, t, n) {
420 return c(null, e, t, n);
421 }, a.allocUnsafe = function(e) {
422 return u(null, e);
423 }, a.allocUnsafeSlow = function(e) {
424 return u(null, e);
425 }, a.isBuffer = function(e) {
426 return !(null == e || !e._isBuffer);
427 }, a.compare = function(e, t) {
428 if (!a.isBuffer(e) || !a.isBuffer(t)) throw new TypeError("Arguments must be Buffers");
429 if (e === t) return 0;
430 for (var n = e.length, r = t.length, i = 0, o = Math.min(n, r); o > i; ++i) if (e[i] !== t[i]) {
431 n = e[i], r = t[i];
432 break;
433 }
434 return r > n ? -1 : n > r ? 1 : 0;
435 }, a.isEncoding = function(e) {
436 switch (String(e).toLowerCase()) {
437 case "hex":
438 case "utf8":
439 case "utf-8":
440 case "ascii":
441 case "binary":
442 case "base64":
443 case "raw":
444 case "ucs2":
445 case "ucs-2":
446 case "utf16le":
447 case "utf-16le":
448 return !0;
449
450 default:
451 return !1;
452 }
453 }, a.concat = function(e, t) {
454 if (!J(e)) throw new TypeError('"list" argument must be an Array of Buffers');
455 if (0 === e.length) return a.alloc(0);
456 var n;
457 if (void 0 === t) for (t = 0, n = 0; n < e.length; n++) t += e[n].length;
458 var r = a.allocUnsafe(t), i = 0;
459 for (n = 0; n < e.length; n++) {
460 var o = e[n];
461 if (!a.isBuffer(o)) throw new TypeError('"list" argument must be an Array of Buffers');
462 o.copy(r, i), i += o.length;
463 }
464 return r;
465 }, a.byteLength = v, a.prototype._isBuffer = !0, a.prototype.swap16 = function() {
466 var e = this.length;
467 if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
468 for (var t = 0; e > t; t += 2) x(this, t, t + 1);
469 return this;
470 }, a.prototype.swap32 = function() {
471 var e = this.length;
472 if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
473 for (var t = 0; e > t; t += 4) x(this, t, t + 3), x(this, t + 1, t + 2);
474 return this;
475 }, a.prototype.toString = function() {
476 var e = 0 | this.length;
477 return 0 === e ? "" : 0 === arguments.length ? N(this, 0, e) : y.apply(this, arguments);
478 }, a.prototype.equals = function(e) {
479 if (!a.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
480 return this === e || 0 === a.compare(this, e);
481 }, a.prototype.inspect = function() {
482 var e = "", t = n.INSPECT_MAX_BYTES;
483 return this.length > 0 && (e = this.toString("hex", 0, t).match(/.{2}/g).join(" "),
484 this.length > t && (e += " ... ")), "<Buffer " + e + ">";
485 }, a.prototype.compare = function(e, t, n, r, i) {
486 if (!a.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
487 if (void 0 === t && (t = 0), void 0 === n && (n = e ? e.length : 0), void 0 === r && (r = 0),
488 void 0 === i && (i = this.length), 0 > t || n > e.length || 0 > r || i > this.length) throw new RangeError("out of range index");
489 if (r >= i && t >= n) return 0;
490 if (r >= i) return -1;
491 if (t >= n) return 1;
492 if (this === e) return 0;
493 for (var o = (i >>>= 0) - (r >>>= 0), l = (n >>>= 0) - (t >>>= 0), s = Math.min(o, l), c = this.slice(r, i), u = e.slice(t, n), f = 0; s > f; ++f) if (c[f] !== u[f]) {
494 o = c[f], l = u[f];
495 break;
496 }
497 return l > o ? -1 : o > l ? 1 : 0;
498 }, a.prototype.indexOf = function(e, t, n) {
499 if ("string" == typeof t ? (n = t, t = 0) : t > 2147483647 ? t = 2147483647 : -2147483648 > t && (t = -2147483648),
500 t >>= 0, 0 === this.length) return -1;
501 if (t >= this.length) return -1;
502 if (0 > t && (t = Math.max(this.length + t, 0)), "string" == typeof e && (e = a.from(e, n)),
503 a.isBuffer(e)) return 0 === e.length ? -1 : b(this, e, t, n);
504 if ("number" == typeof e) return a.TYPED_ARRAY_SUPPORT && "function" === Uint8Array.prototype.indexOf ? Uint8Array.prototype.indexOf.call(this, e, t) : b(this, [ e ], t, n);
505 throw new TypeError("val must be string, number or Buffer");
506 }, a.prototype.includes = function(e, t, n) {
507 return -1 !== this.indexOf(e, t, n);
508 }, a.prototype.write = function(e, t, n, r) {
509 if (void 0 === t) r = "utf8", n = this.length, t = 0; else if (void 0 === n && "string" == typeof t) r = t,
510 n = this.length, t = 0; else {
511 if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
512 t |= 0, isFinite(n) ? (n |= 0, void 0 === r && (r = "utf8")) : (r = n, n = void 0);
513 }
514 var i = this.length - t;
515 if ((void 0 === n || n > i) && (n = i), e.length > 0 && (0 > n || 0 > t) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
516 r || (r = "utf8");
517 for (var o = !1; ;) switch (r) {
518 case "hex":
519 return w(this, e, t, n);
520
521 case "utf8":
522 case "utf-8":
523 return k(this, e, t, n);
524
525 case "ascii":
526 return S(this, e, t, n);
527
528 case "binary":
529 return C(this, e, t, n);
530
531 case "base64":
532 return L(this, e, t, n);
533
534 case "ucs2":
535 case "ucs-2":
536 case "utf16le":
537 case "utf-16le":
538 return T(this, e, t, n);
539
540 default:
541 if (o) throw new TypeError("Unknown encoding: " + r);
542 r = ("" + r).toLowerCase(), o = !0;
543 }
544 }, a.prototype.toJSON = function() {
545 return {
546 type: "Buffer",
547 data: Array.prototype.slice.call(this._arr || this, 0)
548 };
549 };
550 var Q = 4096;
551 a.prototype.slice = function(e, t) {
552 var r, n = this.length;
553 if (0 > (e = ~~e) ? 0 > (e += n) && (e = 0) : e > n && (e = n), 0 > (t = void 0 === t ? n : ~~t) ? 0 > (t += n) && (t = 0) : t > n && (t = n),
554 e > t && (t = e), a.TYPED_ARRAY_SUPPORT) (r = this.subarray(e, t)).__proto__ = a.prototype; else {
555 var i = t - e;
556 r = new a(i, void 0);
557 for (var o = 0; i > o; o++) r[o] = this[o + e];
558 }
559 return r;
560 }, a.prototype.readUIntLE = function(e, t, n) {
561 e |= 0, t |= 0, n || R(e, t, this.length);
562 for (var r = this[e], i = 1, o = 0; ++o < t && (i *= 256); ) r += this[e + o] * i;
563 return r;
564 }, a.prototype.readUIntBE = function(e, t, n) {
565 e |= 0, t |= 0, n || R(e, t, this.length);
566 for (var r = this[e + --t], i = 1; t > 0 && (i *= 256); ) r += this[e + --t] * i;
567 return r;
568 }, a.prototype.readUInt8 = function(e, t) {
569 return t || R(e, 1, this.length), this[e];
570 }, a.prototype.readUInt16LE = function(e, t) {
571 return t || R(e, 2, this.length), this[e] | this[e + 1] << 8;
572 }, a.prototype.readUInt16BE = function(e, t) {
573 return t || R(e, 2, this.length), this[e] << 8 | this[e + 1];
574 }, a.prototype.readUInt32LE = function(e, t) {
575 return t || R(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3];
576 }, a.prototype.readUInt32BE = function(e, t) {
577 return t || R(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
578 }, a.prototype.readIntLE = function(e, t, n) {
579 e |= 0, t |= 0, n || R(e, t, this.length);
580 for (var r = this[e], i = 1, o = 0; ++o < t && (i *= 256); ) r += this[e + o] * i;
581 return r >= (i *= 128) && (r -= Math.pow(2, 8 * t)), r;
582 }, a.prototype.readIntBE = function(e, t, n) {
583 e |= 0, t |= 0, n || R(e, t, this.length);
584 for (var r = t, i = 1, o = this[e + --r]; r > 0 && (i *= 256); ) o += this[e + --r] * i;
585 return o >= (i *= 128) && (o -= Math.pow(2, 8 * t)), o;
586 }, a.prototype.readInt8 = function(e, t) {
587 return t || R(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e];
588 }, a.prototype.readInt16LE = function(e, t) {
589 t || R(e, 2, this.length);
590 var n = this[e] | this[e + 1] << 8;
591 return 32768 & n ? 4294901760 | n : n;
592 }, a.prototype.readInt16BE = function(e, t) {
593 t || R(e, 2, this.length);
594 var n = this[e + 1] | this[e] << 8;
595 return 32768 & n ? 4294901760 | n : n;
596 }, a.prototype.readInt32LE = function(e, t) {
597 return t || R(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
598 }, a.prototype.readInt32BE = function(e, t) {
599 return t || R(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
600 }, a.prototype.readFloatLE = function(e, t) {
601 return t || R(e, 4, this.length), Z.read(this, e, !0, 23, 4);
602 }, a.prototype.readFloatBE = function(e, t) {
603 return t || R(e, 4, this.length), Z.read(this, e, !1, 23, 4);
604 }, a.prototype.readDoubleLE = function(e, t) {
605 return t || R(e, 8, this.length), Z.read(this, e, !0, 52, 8);
606 }, a.prototype.readDoubleBE = function(e, t) {
607 return t || R(e, 8, this.length), Z.read(this, e, !1, 52, 8);
608 }, a.prototype.writeUIntLE = function(e, t, n, r) {
609 e = +e, t |= 0, n |= 0, r || D(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
610 var o = 1, a = 0;
611 for (this[t] = 255 & e; ++a < n && (o *= 256); ) this[t + a] = e / o & 255;
612 return t + n;
613 }, a.prototype.writeUIntBE = function(e, t, n, r) {
614 e = +e, t |= 0, n |= 0, r || D(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
615 var o = n - 1, a = 1;
616 for (this[t + o] = 255 & e; --o >= 0 && (a *= 256); ) this[t + o] = e / a & 255;
617 return t + n;
618 }, a.prototype.writeUInt8 = function(e, t, n) {
619 return e = +e, t |= 0, n || D(this, e, t, 1, 255, 0), a.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
620 this[t] = 255 & e, t + 1;
621 }, a.prototype.writeUInt16LE = function(e, t, n) {
622 return e = +e, t |= 0, n || D(this, e, t, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
623 this[t + 1] = e >>> 8) : H(this, e, t, !0), t + 2;
624 }, a.prototype.writeUInt16BE = function(e, t, n) {
625 return e = +e, t |= 0, n || D(this, e, t, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
626 this[t + 1] = 255 & e) : H(this, e, t, !1), t + 2;
627 }, a.prototype.writeUInt32LE = function(e, t, n) {
628 return e = +e, t |= 0, n || D(this, e, t, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24,
629 this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e) : W(this, e, t, !0),
630 t + 4;
631 }, a.prototype.writeUInt32BE = function(e, t, n) {
632 return e = +e, t |= 0, n || D(this, e, t, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24,
633 this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : W(this, e, t, !1),
634 t + 4;
635 }, a.prototype.writeIntLE = function(e, t, n, r) {
636 if (e = +e, t |= 0, !r) {
637 var i = Math.pow(2, 8 * n - 1);
638 D(this, e, t, n, i - 1, -i);
639 }
640 var o = 0, a = 1, l = 0;
641 for (this[t] = 255 & e; ++o < n && (a *= 256); ) 0 > e && 0 === l && 0 !== this[t + o - 1] && (l = 1),
642 this[t + o] = (e / a | 0) - l & 255;
643 return t + n;
644 }, a.prototype.writeIntBE = function(e, t, n, r) {
645 if (e = +e, t |= 0, !r) {
646 var i = Math.pow(2, 8 * n - 1);
647 D(this, e, t, n, i - 1, -i);
648 }
649 var o = n - 1, a = 1, l = 0;
650 for (this[t + o] = 255 & e; --o >= 0 && (a *= 256); ) 0 > e && 0 === l && 0 !== this[t + o + 1] && (l = 1),
651 this[t + o] = (e / a | 0) - l & 255;
652 return t + n;
653 }, a.prototype.writeInt8 = function(e, t, n) {
654 return e = +e, t |= 0, n || D(this, e, t, 1, 127, -128), a.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
655 0 > e && (e = 255 + e + 1), this[t] = 255 & e, t + 1;
656 }, a.prototype.writeInt16LE = function(e, t, n) {
657 return e = +e, t |= 0, n || D(this, e, t, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
658 this[t + 1] = e >>> 8) : H(this, e, t, !0), t + 2;
659 }, a.prototype.writeInt16BE = function(e, t, n) {
660 return e = +e, t |= 0, n || D(this, e, t, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
661 this[t + 1] = 255 & e) : H(this, e, t, !1), t + 2;
662 }, a.prototype.writeInt32LE = function(e, t, n) {
663 return e = +e, t |= 0, n || D(this, e, t, 4, 2147483647, -2147483648), a.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
664 this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : W(this, e, t, !0),
665 t + 4;
666 }, a.prototype.writeInt32BE = function(e, t, n) {
667 return e = +e, t |= 0, n || D(this, e, t, 4, 2147483647, -2147483648), 0 > e && (e = 4294967295 + e + 1),
668 a.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8,
669 this[t + 3] = 255 & e) : W(this, e, t, !1), t + 4;
670 }, a.prototype.writeFloatLE = function(e, t, n) {
671 return _(this, e, t, !0, n);
672 }, a.prototype.writeFloatBE = function(e, t, n) {
673 return _(this, e, t, !1, n);
674 }, a.prototype.writeDoubleLE = function(e, t, n) {
675 return F(this, e, t, !0, n);
676 }, a.prototype.writeDoubleBE = function(e, t, n) {
677 return F(this, e, t, !1, n);
678 }, a.prototype.copy = function(e, t, n, r) {
679 if (n || (n = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length),
680 t || (t = 0), r > 0 && n > r && (r = n), r === n) return 0;
681 if (0 === e.length || 0 === this.length) return 0;
682 if (0 > t) throw new RangeError("targetStart out of bounds");
683 if (0 > n || n >= this.length) throw new RangeError("sourceStart out of bounds");
684 if (0 > r) throw new RangeError("sourceEnd out of bounds");
685 r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
686 var i, o = r - n;
687 if (this === e && t > n && r > t) for (i = o - 1; i >= 0; i--) e[i + t] = this[i + n]; else if (1e3 > o || !a.TYPED_ARRAY_SUPPORT) for (i = 0; o > i; i++) e[i + t] = this[i + n]; else Uint8Array.prototype.set.call(e, this.subarray(n, n + o), t);
688 return o;
689 }, a.prototype.fill = function(e, t, n, r) {
690 if ("string" == typeof e) {
691 if ("string" == typeof t ? (r = t, t = 0, n = this.length) : "string" == typeof n && (r = n,
692 n = this.length), 1 === e.length) {
693 var i = e.charCodeAt(0);
694 256 > i && (e = i);
695 }
696 if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string");
697 if ("string" == typeof r && !a.isEncoding(r)) throw new TypeError("Unknown encoding: " + r);
698 } else "number" == typeof e && (e &= 255);
699 if (0 > t || this.length < t || this.length < n) throw new RangeError("Out of range index");
700 if (t >= n) return this;
701 var o;
702 if (t >>>= 0, n = void 0 === n ? this.length : n >>> 0, e || (e = 0), "number" == typeof e) for (o = t; n > o; o++) this[o] = e; else {
703 var l = a.isBuffer(e) ? e : q(new a(e, r).toString()), s = l.length;
704 for (o = 0; n - t > o; o++) this[o + t] = l[o % s];
705 }
706 return this;
707 };
708 var ee = /[^+\/0-9A-Za-z-_]/g;
709 }).call(this, void 0 !== __webpack_require__.g ? __webpack_require__.g : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
710 }, {
711 "base64-js": 1,
712 ieee754: 15,
713 isarray: 16
714 } ],
715 4: [ function(e, t, n) {
716 "use strict";
717 function r(e) {
718 return "function" != typeof (e = e || {}).codeMirrorInstance || "function" != typeof e.codeMirrorInstance.defineMode ? void 0 : (String.prototype.includes || (String.prototype.includes = function() {
719 return -1 !== String.prototype.indexOf.apply(this, arguments);
720 }), void e.codeMirrorInstance.defineMode("spell-checker", (function(t) {
721 if (!r.aff_loading) {
722 r.aff_loading = !0;
723 var n = new XMLHttpRequest;
724 n.open("GET", "https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff", !0),
725 n.onload = function() {
726 4 === n.readyState && 200 === n.status && (r.aff_data = n.responseText, r.num_loaded++,
727 2 == r.num_loaded && (r.typo = new i("en_US", r.aff_data, r.dic_data, {
728 platform: "any"
729 })));
730 }, n.send(null);
731 }
732 if (!r.dic_loading) {
733 r.dic_loading = !0;
734 var o = new XMLHttpRequest;
735 o.open("GET", "https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic", !0),
736 o.onload = function() {
737 4 === o.readyState && 200 === o.status && (r.dic_data = o.responseText, r.num_loaded++,
738 2 == r.num_loaded && (r.typo = new i("en_US", r.aff_data, r.dic_data, {
739 platform: "any"
740 })));
741 }, o.send(null);
742 }
743 var a = '!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ', l = {
744 token: function(e) {
745 var t = e.peek(), n = "";
746 if (a.includes(t)) return e.next(), null;
747 for (;null != (t = e.peek()) && !a.includes(t); ) n += t, e.next();
748 return r.typo && !r.typo.check(n) ? "spell-error" : null;
749 }
750 }, s = e.codeMirrorInstance.getMode(t, t.backdrop || "text/plain");
751 return e.codeMirrorInstance.overlayMode(s, l, !0);
752 })));
753 }
754 var i = e("typo-js");
755 r.num_loaded = 0, r.aff_loading = !1, r.dic_loading = !1, r.aff_data = "", r.dic_data = "",
756 r.typo, t.exports = r;
757 }, {
758 "typo-js": 18
759 } ],
760 5: [ function(t, n, r) {
761 var i;
762 i = function(e) {
763 "use strict";
764 function t(e) {
765 var t = e.getWrapperElement();
766 e.state.fullScreenRestore = {
767 scrollTop: window.pageYOffset,
768 scrollLeft: window.pageXOffset,
769 width: t.style.width,
770 height: t.style.height
771 }, t.style.width = "", t.style.height = "auto", t.className += " CodeMirror-fullscreen",
772 document.documentElement.style.overflow = "hidden", e.refresh();
773 }
774 function n(e) {
775 var t = e.getWrapperElement();
776 t.className = t.className.replace(/\s*CodeMirror-fullscreen\b/, ""), document.documentElement.style.overflow = "";
777 var n = e.state.fullScreenRestore;
778 t.style.width = n.width, t.style.height = n.height, window.scrollTo(n.scrollLeft, n.scrollTop),
779 e.refresh();
780 }
781 e.defineOption("fullScreen", !1, (function(r, i, o) {
782 o == e.Init && (o = !1), !o != !i && (i ? t(r) : n(r));
783 }));
784 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror" ], i) : i(CodeMirror);
785 }, {
786 "../../lib/codemirror": 10
787 } ],
788 6: [ function(t, n, r) {
789 var i;
790 i = function(e) {
791 function t(e) {
792 e.state.placeholder && (e.state.placeholder.parentNode.removeChild(e.state.placeholder),
793 e.state.placeholder = null);
794 }
795 function n(e) {
796 t(e);
797 var n = e.state.placeholder = document.createElement("pre");
798 n.style.cssText = "height: 0; overflow: visible", n.className = "CodeMirror-placeholder";
799 var r = e.getOption("placeholder");
800 "string" == typeof r && (r = document.createTextNode(r)), n.appendChild(r), e.display.lineSpace.insertBefore(n, e.display.lineSpace.firstChild);
801 }
802 function r(e) {
803 o(e) && n(e);
804 }
805 function i(e) {
806 var r = e.getWrapperElement(), i = o(e);
807 r.className = r.className.replace(" CodeMirror-empty", "") + (i ? " CodeMirror-empty" : ""),
808 i ? n(e) : t(e);
809 }
810 function o(e) {
811 return 1 === e.lineCount() && "" === e.getLine(0);
812 }
813 e.defineOption("placeholder", "", (function(n, o, a) {
814 var l = a && a != e.Init;
815 if (o && !l) n.on("blur", r), n.on("change", i), n.on("swapDoc", i), i(n); else if (!o && l) {
816 n.off("blur", r), n.off("change", i), n.off("swapDoc", i), t(n);
817 var s = n.getWrapperElement();
818 s.className = s.className.replace(" CodeMirror-empty", "");
819 }
820 o && !n.hasFocus() && r(n);
821 }));
822 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror" ], i) : i(CodeMirror);
823 }, {
824 "../../lib/codemirror": 10
825 } ],
826 7: [ function(t, n, r) {
827 var i;
828 i = function(e) {
829 "use strict";
830 var t = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/, n = /^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/, r = /[*+-]\s/;
831 e.commands.newlineAndIndentContinueMarkdownList = function(i) {
832 if (i.getOption("disableInput")) return e.Pass;
833 for (var o = i.listSelections(), a = [], l = 0; l < o.length; l++) {
834 var s = o[l].head, c = i.getStateAfter(s.line), u = !1 !== c.list, f = 0 !== c.quote, h = i.getLine(s.line), d = t.exec(h);
835 if (!o[l].empty() || !u && !f || !d) return void i.execCommand("newlineAndIndent");
836 if (n.test(h)) i.replaceRange("", {
837 line: s.line,
838 ch: 0
839 }, {
840 line: s.line,
841 ch: s.ch + 1
842 }), a[l] = "\n"; else {
843 var p = d[1], m = d[5], g = r.test(d[2]) || d[2].indexOf(">") >= 0 ? d[2] : parseInt(d[3], 10) + 1 + d[4];
844 a[l] = "\n" + p + g + m;
845 }
846 }
847 i.replaceSelections(a);
848 };
849 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror" ], i) : i(CodeMirror);
850 }, {
851 "../../lib/codemirror": 10
852 } ],
853 8: [ function(t, n, r) {
854 var i;
855 i = function(e) {
856 "use strict";
857 e.overlayMode = function(t, n, r) {
858 return {
859 startState: function() {
860 return {
861 base: e.startState(t),
862 overlay: e.startState(n),
863 basePos: 0,
864 baseCur: null,
865 overlayPos: 0,
866 overlayCur: null,
867 streamSeen: null
868 };
869 },
870 copyState: function(r) {
871 return {
872 base: e.copyState(t, r.base),
873 overlay: e.copyState(n, r.overlay),
874 basePos: r.basePos,
875 baseCur: null,
876 overlayPos: r.overlayPos,
877 overlayCur: null
878 };
879 },
880 token: function(e, i) {
881 return (e != i.streamSeen || Math.min(i.basePos, i.overlayPos) < e.start) && (i.streamSeen = e,
882 i.basePos = i.overlayPos = e.start), e.start == i.basePos && (i.baseCur = t.token(e, i.base),
883 i.basePos = e.pos), e.start == i.overlayPos && (e.pos = e.start, i.overlayCur = n.token(e, i.overlay),
884 i.overlayPos = e.pos), e.pos = Math.min(i.basePos, i.overlayPos), null == i.overlayCur ? i.baseCur : null != i.baseCur && i.overlay.combineTokens || r && null == i.overlay.combineTokens ? i.baseCur + " " + i.overlayCur : i.overlayCur;
885 },
886 indent: t.indent && function(e, n) {
887 return t.indent(e.base, n);
888 },
889 electricChars: t.electricChars,
890 innerMode: function(e) {
891 return {
892 state: e.base,
893 mode: t
894 };
895 },
896 blankLine: function(e) {
897 t.blankLine && t.blankLine(e.base), n.blankLine && n.blankLine(e.overlay);
898 }
899 };
900 };
901 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror" ], i) : i(CodeMirror);
902 }, {
903 "../../lib/codemirror": 10
904 } ],
905 9: [ function(t, n, r) {
906 var i;
907 i = function(e) {
908 "use strict";
909 function t(e) {
910 e.operation((function() {
911 a(e);
912 }));
913 }
914 function n(e) {
915 e.state.markedSelection.length && e.operation((function() {
916 i(e);
917 }));
918 }
919 function r(e, t, n, r) {
920 if (0 != c(t, n)) for (var i = e.state.markedSelection, o = e.state.markedSelectionStyle, a = t.line; ;) {
921 var u = a == t.line ? t : s(a, 0), f = a + l, h = f >= n.line, d = h ? n : s(f, 0), p = e.markText(u, d, {
922 className: o
923 });
924 if (null == r ? i.push(p) : i.splice(r++, 0, p), h) break;
925 a = f;
926 }
927 }
928 function i(e) {
929 for (var t = e.state.markedSelection, n = 0; n < t.length; ++n) t[n].clear();
930 t.length = 0;
931 }
932 function o(e) {
933 i(e);
934 for (var t = e.listSelections(), n = 0; n < t.length; n++) r(e, t[n].from(), t[n].to());
935 }
936 function a(e) {
937 if (!e.somethingSelected()) return i(e);
938 if (e.listSelections().length > 1) return o(e);
939 var t = e.getCursor("start"), n = e.getCursor("end"), a = e.state.markedSelection;
940 if (!a.length) return r(e, t, n);
941 var s = a[0].find(), u = a[a.length - 1].find();
942 if (!s || !u || n.line - t.line < l || c(t, u.to) >= 0 || c(n, s.from) <= 0) return o(e);
943 for (;c(t, s.from) > 0; ) a.shift().clear(), s = a[0].find();
944 for (c(t, s.from) < 0 && (s.to.line - t.line < l ? (a.shift().clear(), r(e, t, s.to, 0)) : r(e, t, s.from, 0)); c(n, u.to) < 0; ) a.pop().clear(),
945 u = a[a.length - 1].find();
946 c(n, u.to) > 0 && (n.line - u.from.line < l ? (a.pop().clear(), r(e, u.from, n)) : r(e, u.to, n));
947 }
948 e.defineOption("styleSelectedText", !1, (function(r, a, l) {
949 var s = l && l != e.Init;
950 a && !s ? (r.state.markedSelection = [], r.state.markedSelectionStyle = "string" == typeof a ? a : "CodeMirror-selectedtext",
951 o(r), r.on("cursorActivity", t), r.on("change", n)) : !a && s && (r.off("cursorActivity", t),
952 r.off("change", n), i(r), r.state.markedSelection = r.state.markedSelectionStyle = null);
953 }));
954 var l = 8, s = e.Pos, c = e.cmpPos;
955 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror" ], i) : i(CodeMirror);
956 }, {
957 "../../lib/codemirror": 10
958 } ],
959 10: [ function(t, n, r) {
960 !function(t) {
961 if ("object" == typeof r && "object" == typeof n) n.exports = t(); else {
962 if ("function" == typeof e && e.amd) return e([], t);
963 (this || window).CodeMirror = t();
964 }
965 }((function() {
966 "use strict";
967 function e(n, r) {
968 if (!(this instanceof e)) return new e(n, r);
969 this.options = r = r ? Wi(r) : {}, Wi(ea, r, !1), d(r);
970 var i = r.value;
971 "string" == typeof i && (i = new Ca(i, r.mode, null, r.lineSeparator)), this.doc = i;
972 var o = new e.inputStyles[r.inputStyle](this), a = this.display = new t(n, i, o);
973 a.wrapper.CodeMirror = this, c(this), l(this), r.lineWrapping && (this.display.wrapper.className += " CodeMirror-wrap"),
974 r.autofocus && !Ao && a.input.focus(), v(this), this.state = {
975 keyMaps: [],
976 overlays: [],
977 modeGen: 0,
978 overwrite: !1,
979 delayingBlurEvent: !1,
980 focused: !1,
981 suppressEdits: !1,
982 pasteIncoming: !1,
983 cutIncoming: !1,
984 selectingText: !1,
985 draggingText: !1,
986 highlight: new Ei,
987 keySeq: null,
988 specialChars: null
989 };
990 var s = this;
991 for (var u in xo && 11 > bo && setTimeout((function() {
992 s.display.input.reset(!0);
993 }), 20), jt(this), Ki(), bt(this), this.curOp.forceUpdate = !0, Xr(this, i), r.autofocus && !Ao || s.hasFocus() ? setTimeout(Bi(vn, this), 20) : yn(this),
994 ta) ta.hasOwnProperty(u) && ta[u](this, r[u], na);
995 k(this), r.finishInit && r.finishInit(this);
996 for (var f = 0; f < aa.length; ++f) aa[f](this);
997 kt(this), wo && r.lineWrapping && "optimizelegibility" == getComputedStyle(a.lineDiv).textRendering && (a.lineDiv.style.textRendering = "auto");
998 }
999 function t(e, t, n) {
1000 var r = this;
1001 this.input = n, r.scrollbarFiller = ji("div", null, "CodeMirror-scrollbar-filler"),
1002 r.scrollbarFiller.setAttribute("cm-not-content", "true"), r.gutterFiller = ji("div", null, "CodeMirror-gutter-filler"),
1003 r.gutterFiller.setAttribute("cm-not-content", "true"), r.lineDiv = ji("div", null, "CodeMirror-code"),
1004 r.selectionDiv = ji("div", null, null, "position: relative; z-index: 1"), r.cursorDiv = ji("div", null, "CodeMirror-cursors"),
1005 r.measure = ji("div", null, "CodeMirror-measure"), r.lineMeasure = ji("div", null, "CodeMirror-measure"),
1006 r.lineSpace = ji("div", [ r.measure, r.lineMeasure, r.selectionDiv, r.cursorDiv, r.lineDiv ], null, "position: relative; outline: none"),
1007 r.mover = ji("div", [ ji("div", [ r.lineSpace ], "CodeMirror-lines") ], null, "position: relative"),
1008 r.sizer = ji("div", [ r.mover ], "CodeMirror-sizer"), r.sizerWidth = null, r.heightForcer = ji("div", null, null, "position: absolute; height: " + Da + "px; width: 1px;"),
1009 r.gutters = ji("div", null, "CodeMirror-gutters"), r.lineGutter = null, r.scroller = ji("div", [ r.sizer, r.heightForcer, r.gutters ], "CodeMirror-scroll"),
1010 r.scroller.setAttribute("tabIndex", "-1"), r.wrapper = ji("div", [ r.scrollbarFiller, r.gutterFiller, r.scroller ], "CodeMirror"),
1011 xo && 8 > bo && (r.gutters.style.zIndex = -1, r.scroller.style.paddingRight = 0),
1012 wo || go && Ao || (r.scroller.draggable = !0), e && (e.appendChild ? e.appendChild(r.wrapper) : e(r.wrapper)),
1013 r.viewFrom = r.viewTo = t.first, r.reportedViewFrom = r.reportedViewTo = t.first,
1014 r.view = [], r.renderedView = null, r.externalMeasured = null, r.viewOffset = 0,
1015 r.lastWrapHeight = r.lastWrapWidth = 0, r.updateLineNumbers = null, r.nativeBarWidth = r.barHeight = r.barWidth = 0,
1016 r.scrollbarsClipped = !1, r.lineNumWidth = r.lineNumInnerWidth = r.lineNumChars = null,
1017 r.alignWidgets = !1, r.cachedCharWidth = r.cachedTextHeight = r.cachedPaddingH = null,
1018 r.maxLine = null, r.maxLineLength = 0, r.maxLineChanged = !1, r.wheelDX = r.wheelDY = r.wheelStartX = r.wheelStartY = null,
1019 r.shift = !1, r.selForContextMenu = null, r.activeTouch = null, n.init(r);
1020 }
1021 function n(t) {
1022 t.doc.mode = e.getMode(t.options, t.doc.modeOption), r(t);
1023 }
1024 function r(e) {
1025 e.doc.iter((function(e) {
1026 e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null);
1027 })), e.doc.frontier = e.doc.first, _e(e, 100), e.state.modeGen++, e.curOp && Dt(e);
1028 }
1029 function i(e) {
1030 e.options.lineWrapping ? (Ja(e.display.wrapper, "CodeMirror-wrap"), e.display.sizer.style.minWidth = "",
1031 e.display.sizerWidth = null) : (Za(e.display.wrapper, "CodeMirror-wrap"), h(e)),
1032 a(e), Dt(e), lt(e), setTimeout((function() {
1033 y(e);
1034 }), 100);
1035 }
1036 function o(e) {
1037 var t = yt(e.display), n = e.options.lineWrapping, r = n && Math.max(5, e.display.scroller.clientWidth / xt(e.display) - 3);
1038 return function(i) {
1039 if (kr(e.doc, i)) return 0;
1040 var o = 0;
1041 if (i.widgets) for (var a = 0; a < i.widgets.length; a++) i.widgets[a].height && (o += i.widgets[a].height);
1042 return n ? o + (Math.ceil(i.text.length / r) || 1) * t : o + t;
1043 };
1044 }
1045 function a(e) {
1046 var t = e.doc, n = o(e);
1047 t.iter((function(e) {
1048 var t = n(e);
1049 t != e.height && ei(e, t);
1050 }));
1051 }
1052 function l(e) {
1053 e.display.wrapper.className = e.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + e.options.theme.replace(/(^|\s)\s*/g, " cm-s-"),
1054 lt(e);
1055 }
1056 function s(e) {
1057 c(e), Dt(e), setTimeout((function() {
1058 w(e);
1059 }), 20);
1060 }
1061 function c(e) {
1062 var t = e.display.gutters, n = e.options.gutters;
1063 Ui(t);
1064 for (var r = 0; r < n.length; ++r) {
1065 var i = n[r], o = t.appendChild(ji("div", null, "CodeMirror-gutter " + i));
1066 "CodeMirror-linenumbers" == i && (e.display.lineGutter = o, o.style.width = (e.display.lineNumWidth || 1) + "px");
1067 }
1068 t.style.display = r ? "" : "none", u(e);
1069 }
1070 function u(e) {
1071 var t = e.display.gutters.offsetWidth;
1072 e.display.sizer.style.marginLeft = t + "px";
1073 }
1074 function f(e) {
1075 if (0 == e.height) return 0;
1076 for (var t, n = e.text.length, r = e; t = mr(r); ) r = (i = t.find(0, !0)).from.line,
1077 n += i.from.ch - i.to.ch;
1078 for (r = e; t = gr(r); ) {
1079 var i = t.find(0, !0);
1080 n -= r.text.length - i.from.ch, n += (r = i.to.line).text.length - i.to.ch;
1081 }
1082 return n;
1083 }
1084 function h(e) {
1085 var t = e.display, n = e.doc;
1086 t.maxLine = Zr(n, n.first), t.maxLineLength = f(t.maxLine), t.maxLineChanged = !0,
1087 n.iter((function(e) {
1088 var n = f(e);
1089 n > t.maxLineLength && (t.maxLineLength = n, t.maxLine = e);
1090 }));
1091 }
1092 function d(e) {
1093 var t = Pi(e.gutters, "CodeMirror-linenumbers");
1094 -1 == t && e.lineNumbers ? e.gutters = e.gutters.concat([ "CodeMirror-linenumbers" ]) : t > -1 && !e.lineNumbers && (e.gutters = e.gutters.slice(0),
1095 e.gutters.splice(t, 1));
1096 }
1097 function p(e) {
1098 var t = e.display, n = t.gutters.offsetWidth, r = Math.round(e.doc.height + qe(e.display));
1099 return {
1100 clientHeight: t.scroller.clientHeight,
1101 viewHeight: t.wrapper.clientHeight,
1102 scrollWidth: t.scroller.scrollWidth,
1103 clientWidth: t.scroller.clientWidth,
1104 viewWidth: t.wrapper.clientWidth,
1105 barLeft: e.options.fixedGutter ? n : 0,
1106 docHeight: r,
1107 scrollHeight: r + Ye(e) + t.barHeight,
1108 nativeBarWidth: t.nativeBarWidth,
1109 gutterWidth: n
1110 };
1111 }
1112 function m(e, t, n) {
1113 this.cm = n;
1114 var r = this.vert = ji("div", [ ji("div", null, null, "min-width: 1px") ], "CodeMirror-vscrollbar"), i = this.horiz = ji("div", [ ji("div", null, null, "height: 100%; min-height: 1px") ], "CodeMirror-hscrollbar");
1115 e(r), e(i), Ea(r, "scroll", (function() {
1116 r.clientHeight && t(r.scrollTop, "vertical");
1117 })), Ea(i, "scroll", (function() {
1118 i.clientWidth && t(i.scrollLeft, "horizontal");
1119 })), this.checkedZeroWidth = !1, xo && 8 > bo && (this.horiz.style.minHeight = this.vert.style.minWidth = "18px");
1120 }
1121 function g() {}
1122 function v(t) {
1123 t.display.scrollbars && (t.display.scrollbars.clear(), t.display.scrollbars.addClass && Za(t.display.wrapper, t.display.scrollbars.addClass)),
1124 t.display.scrollbars = new e.scrollbarModel[t.options.scrollbarStyle]((function(e) {
1125 t.display.wrapper.insertBefore(e, t.display.scrollbarFiller), Ea(e, "mousedown", (function() {
1126 t.state.focused && setTimeout((function() {
1127 t.display.input.focus();
1128 }), 0);
1129 })), e.setAttribute("cm-not-content", "true");
1130 }), (function(e, n) {
1131 "horizontal" == n ? on(t, e) : rn(t, e);
1132 }), t), t.display.scrollbars.addClass && Ja(t.display.wrapper, t.display.scrollbars.addClass);
1133 }
1134 function y(e, t) {
1135 t || (t = p(e));
1136 var n = e.display.barWidth, r = e.display.barHeight;
1137 x(e, t);
1138 for (var i = 0; 4 > i && n != e.display.barWidth || r != e.display.barHeight; i++) n != e.display.barWidth && e.options.lineWrapping && O(e),
1139 x(e, p(e)), n = e.display.barWidth, r = e.display.barHeight;
1140 }
1141 function x(e, t) {
1142 var n = e.display, r = n.scrollbars.update(t);
1143 n.sizer.style.paddingRight = (n.barWidth = r.right) + "px", n.sizer.style.paddingBottom = (n.barHeight = r.bottom) + "px",
1144 n.heightForcer.style.borderBottom = r.bottom + "px solid transparent", r.right && r.bottom ? (n.scrollbarFiller.style.display = "block",
1145 n.scrollbarFiller.style.height = r.bottom + "px", n.scrollbarFiller.style.width = r.right + "px") : n.scrollbarFiller.style.display = "",
1146 r.bottom && e.options.coverGutterNextToScrollbar && e.options.fixedGutter ? (n.gutterFiller.style.display = "block",
1147 n.gutterFiller.style.height = r.bottom + "px", n.gutterFiller.style.width = t.gutterWidth + "px") : n.gutterFiller.style.display = "";
1148 }
1149 function b(e, t, n) {
1150 var r = n && null != n.top ? Math.max(0, n.top) : e.scroller.scrollTop;
1151 r = Math.floor(r - Ue(e));
1152 var i = n && null != n.bottom ? n.bottom : r + e.wrapper.clientHeight, o = ni(t, r), a = ni(t, i);
1153 if (n && n.ensure) {
1154 var l = n.ensure.from.line, s = n.ensure.to.line;
1155 o > l ? (o = l, a = ni(t, ri(Zr(t, l)) + e.wrapper.clientHeight)) : Math.min(s, t.lastLine()) >= a && (o = ni(t, ri(Zr(t, s)) - e.wrapper.clientHeight),
1156 a = s);
1157 }
1158 return {
1159 from: o,
1160 to: Math.max(a, o + 1)
1161 };
1162 }
1163 function w(e) {
1164 var t = e.display, n = t.view;
1165 if (t.alignWidgets || t.gutters.firstChild && e.options.fixedGutter) {
1166 for (var r = C(t) - t.scroller.scrollLeft + e.doc.scrollLeft, i = t.gutters.offsetWidth, o = r + "px", a = 0; a < n.length; a++) if (!n[a].hidden) {
1167 e.options.fixedGutter && n[a].gutter && (n[a].gutter.style.left = o);
1168 var l = n[a].alignable;
1169 if (l) for (var s = 0; s < l.length; s++) l[s].style.left = o;
1170 }
1171 e.options.fixedGutter && (t.gutters.style.left = r + i + "px");
1172 }
1173 }
1174 function k(e) {
1175 if (!e.options.lineNumbers) return !1;
1176 var t = e.doc, n = S(e.options, t.first + t.size - 1), r = e.display;
1177 if (n.length != r.lineNumChars) {
1178 var i = r.measure.appendChild(ji("div", [ ji("div", n) ], "CodeMirror-linenumber CodeMirror-gutter-elt")), o = i.firstChild.offsetWidth, a = i.offsetWidth - o;
1179 return r.lineGutter.style.width = "", r.lineNumInnerWidth = Math.max(o, r.lineGutter.offsetWidth - a) + 1,
1180 r.lineNumWidth = r.lineNumInnerWidth + a, r.lineNumChars = r.lineNumInnerWidth ? n.length : -1,
1181 r.lineGutter.style.width = r.lineNumWidth + "px", u(e), !0;
1182 }
1183 return !1;
1184 }
1185 function S(e, t) {
1186 return String(e.lineNumberFormatter(t + e.firstLineNumber));
1187 }
1188 function C(e) {
1189 return e.scroller.getBoundingClientRect().left - e.sizer.getBoundingClientRect().left;
1190 }
1191 function L(e, t, n) {
1192 var r = e.display;
1193 this.viewport = t, this.visible = b(r, e.doc, t), this.editorIsHidden = !r.wrapper.offsetWidth,
1194 this.wrapperHeight = r.wrapper.clientHeight, this.wrapperWidth = r.wrapper.clientWidth,
1195 this.oldDisplayWidth = $e(e), this.force = n, this.dims = P(e), this.events = [];
1196 }
1197 function T(e) {
1198 var t = e.display;
1199 !t.scrollbarsClipped && t.scroller.offsetWidth && (t.nativeBarWidth = t.scroller.offsetWidth - t.scroller.clientWidth,
1200 t.heightForcer.style.height = Ye(e) + "px", t.sizer.style.marginBottom = -t.nativeBarWidth + "px",
1201 t.sizer.style.borderRightWidth = Ye(e) + "px", t.scrollbarsClipped = !0);
1202 }
1203 function M(e, t) {
1204 var n = e.display, r = e.doc;
1205 if (t.editorIsHidden) return Wt(e), !1;
1206 if (!t.force && t.visible.from >= n.viewFrom && t.visible.to <= n.viewTo && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo) && n.renderedView == n.view && 0 == zt(e)) return !1;
1207 k(e) && (Wt(e), t.dims = P(e));
1208 var i = r.first + r.size, o = Math.max(t.visible.from - e.options.viewportMargin, r.first), a = Math.min(i, t.visible.to + e.options.viewportMargin);
1209 n.viewFrom < o && o - n.viewFrom < 20 && (o = Math.max(r.first, n.viewFrom)), n.viewTo > a && n.viewTo - a < 20 && (a = Math.min(i, n.viewTo)),
1210 Wo && (o = br(e.doc, o), a = wr(e.doc, a));
1211 var l = o != n.viewFrom || a != n.viewTo || n.lastWrapHeight != t.wrapperHeight || n.lastWrapWidth != t.wrapperWidth;
1212 Ft(e, o, a), n.viewOffset = ri(Zr(e.doc, n.viewFrom)), e.display.mover.style.top = n.viewOffset + "px";
1213 var s = zt(e);
1214 if (!l && 0 == s && !t.force && n.renderedView == n.view && (null == n.updateLineNumbers || n.updateLineNumbers >= n.viewTo)) return !1;
1215 var c = Gi();
1216 return s > 4 && (n.lineDiv.style.display = "none"), R(e, n.updateLineNumbers, t.dims),
1217 s > 4 && (n.lineDiv.style.display = ""), n.renderedView = n.view, c && Gi() != c && c.offsetHeight && c.focus(),
1218 Ui(n.cursorDiv), Ui(n.selectionDiv), n.gutters.style.height = n.sizer.style.minHeight = 0,
1219 l && (n.lastWrapHeight = t.wrapperHeight, n.lastWrapWidth = t.wrapperWidth, _e(e, 400)),
1220 n.updateLineNumbers = null, !0;
1221 }
1222 function N(e, t) {
1223 for (var n = t.viewport, r = !0; (r && e.options.lineWrapping && t.oldDisplayWidth != $e(e) || (n && null != n.top && (n = {
1224 top: Math.min(e.doc.height + qe(e.display) - Ve(e), n.top)
1225 }), t.visible = b(e.display, e.doc, n), !(t.visible.from >= e.display.viewFrom && t.visible.to <= e.display.viewTo))) && M(e, t); r = !1) {
1226 O(e);
1227 var i = p(e);
1228 Re(e), y(e, i), E(e, i);
1229 }
1230 t.signal(e, "update", e), e.display.viewFrom == e.display.reportedViewFrom && e.display.viewTo == e.display.reportedViewTo || (t.signal(e, "viewportChange", e, e.display.viewFrom, e.display.viewTo),
1231 e.display.reportedViewFrom = e.display.viewFrom, e.display.reportedViewTo = e.display.viewTo);
1232 }
1233 function A(e, t) {
1234 var n = new L(e, t);
1235 if (M(e, n)) {
1236 O(e), N(e, n);
1237 var r = p(e);
1238 Re(e), y(e, r), E(e, r), n.finish();
1239 }
1240 }
1241 function E(e, t) {
1242 e.display.sizer.style.minHeight = t.docHeight + "px", e.display.heightForcer.style.top = t.docHeight + "px",
1243 e.display.gutters.style.height = t.docHeight + e.display.barHeight + Ye(e) + "px";
1244 }
1245 function O(e) {
1246 for (var t = e.display, n = t.lineDiv.offsetTop, r = 0; r < t.view.length; r++) {
1247 var i, o = t.view[r];
1248 if (!o.hidden) {
1249 if (xo && 8 > bo) {
1250 var a = o.node.offsetTop + o.node.offsetHeight;
1251 i = a - n, n = a;
1252 } else {
1253 var l = o.node.getBoundingClientRect();
1254 i = l.bottom - l.top;
1255 }
1256 var s = o.line.height - i;
1257 if (2 > i && (i = yt(t)), (s > .001 || -.001 > s) && (ei(o.line, i), I(o.line),
1258 o.rest)) for (var c = 0; c < o.rest.length; c++) I(o.rest[c]);
1259 }
1260 }
1261 }
1262 function I(e) {
1263 if (e.widgets) for (var t = 0; t < e.widgets.length; ++t) e.widgets[t].height = e.widgets[t].node.parentNode.offsetHeight;
1264 }
1265 function P(e) {
1266 for (var t = e.display, n = {}, r = {}, i = t.gutters.clientLeft, o = t.gutters.firstChild, a = 0; o; o = o.nextSibling,
1267 ++a) n[e.options.gutters[a]] = o.offsetLeft + o.clientLeft + i, r[e.options.gutters[a]] = o.clientWidth;
1268 return {
1269 fixedPos: C(t),
1270 gutterTotalWidth: t.gutters.offsetWidth,
1271 gutterLeft: n,
1272 gutterWidth: r,
1273 wrapperWidth: t.wrapper.clientWidth
1274 };
1275 }
1276 function R(e, t, n) {
1277 function r(t) {
1278 var n = t.nextSibling;
1279 return wo && Eo && e.display.currentWheelTarget == t ? t.style.display = "none" : t.parentNode.removeChild(t),
1280 n;
1281 }
1282 for (var i = e.display, o = e.options.lineNumbers, a = i.lineDiv, l = a.firstChild, s = i.view, c = i.viewFrom, u = 0; u < s.length; u++) {
1283 var f = s[u];
1284 if (f.hidden) ; else if (f.node && f.node.parentNode == a) {
1285 for (;l != f.node; ) l = r(l);
1286 var h = o && null != t && c >= t && f.lineNumber;
1287 f.changes && (Pi(f.changes, "gutter") > -1 && (h = !1), D(e, f, c, n)), h && (Ui(f.lineNumber),
1288 f.lineNumber.appendChild(document.createTextNode(S(e.options, c)))), l = f.node.nextSibling;
1289 } else {
1290 var d = U(e, f, c, n);
1291 a.insertBefore(d, l);
1292 }
1293 c += f.size;
1294 }
1295 for (;l; ) l = r(l);
1296 }
1297 function D(e, t, n, r) {
1298 for (var i = 0; i < t.changes.length; i++) {
1299 var o = t.changes[i];
1300 "text" == o ? _(e, t) : "gutter" == o ? z(e, t, n, r) : "class" == o ? F(t) : "widget" == o && j(e, t, r);
1301 }
1302 t.changes = null;
1303 }
1304 function H(e) {
1305 return e.node == e.text && (e.node = ji("div", null, null, "position: relative"),
1306 e.text.parentNode && e.text.parentNode.replaceChild(e.node, e.text), e.node.appendChild(e.text),
1307 xo && 8 > bo && (e.node.style.zIndex = 2)), e.node;
1308 }
1309 function W(e) {
1310 var t = e.bgClass ? e.bgClass + " " + (e.line.bgClass || "") : e.line.bgClass;
1311 if (t && (t += " CodeMirror-linebackground"), e.background) t ? e.background.className = t : (e.background.parentNode.removeChild(e.background),
1312 e.background = null); else if (t) {
1313 var n = H(e);
1314 e.background = n.insertBefore(ji("div", null, t), n.firstChild);
1315 }
1316 }
1317 function B(e, t) {
1318 var n = e.display.externalMeasured;
1319 return n && n.line == t.line ? (e.display.externalMeasured = null, t.measure = n.measure,
1320 n.built) : Br(e, t);
1321 }
1322 function _(e, t) {
1323 var n = t.text.className, r = B(e, t);
1324 t.text == t.node && (t.node = r.pre), t.text.parentNode.replaceChild(r.pre, t.text),
1325 t.text = r.pre, r.bgClass != t.bgClass || r.textClass != t.textClass ? (t.bgClass = r.bgClass,
1326 t.textClass = r.textClass, F(t)) : n && (t.text.className = n);
1327 }
1328 function F(e) {
1329 W(e), e.line.wrapClass ? H(e).className = e.line.wrapClass : e.node != e.text && (e.node.className = "");
1330 var t = e.textClass ? e.textClass + " " + (e.line.textClass || "") : e.line.textClass;
1331 e.text.className = t || "";
1332 }
1333 function z(e, t, n, r) {
1334 if (t.gutter && (t.node.removeChild(t.gutter), t.gutter = null), t.gutterBackground && (t.node.removeChild(t.gutterBackground),
1335 t.gutterBackground = null), t.line.gutterClass) {
1336 var i = H(t);
1337 t.gutterBackground = ji("div", null, "CodeMirror-gutter-background " + t.line.gutterClass, "left: " + (e.options.fixedGutter ? r.fixedPos : -r.gutterTotalWidth) + "px; width: " + r.gutterTotalWidth + "px"),
1338 i.insertBefore(t.gutterBackground, t.text);
1339 }
1340 var o = t.line.gutterMarkers;
1341 if (e.options.lineNumbers || o) {
1342 i = H(t);
1343 var a = t.gutter = ji("div", null, "CodeMirror-gutter-wrapper", "left: " + (e.options.fixedGutter ? r.fixedPos : -r.gutterTotalWidth) + "px");
1344 if (e.display.input.setUneditable(a), i.insertBefore(a, t.text), t.line.gutterClass && (a.className += " " + t.line.gutterClass),
1345 !e.options.lineNumbers || o && o["CodeMirror-linenumbers"] || (t.lineNumber = a.appendChild(ji("div", S(e.options, n), "CodeMirror-linenumber CodeMirror-gutter-elt", "left: " + r.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + e.display.lineNumInnerWidth + "px"))),
1346 o) for (var l = 0; l < e.options.gutters.length; ++l) {
1347 var s = e.options.gutters[l], c = o.hasOwnProperty(s) && o[s];
1348 c && a.appendChild(ji("div", [ c ], "CodeMirror-gutter-elt", "left: " + r.gutterLeft[s] + "px; width: " + r.gutterWidth[s] + "px"));
1349 }
1350 }
1351 }
1352 function j(e, t, n) {
1353 t.alignable && (t.alignable = null);
1354 for (var i = t.node.firstChild; i; i = r) {
1355 var r = i.nextSibling;
1356 "CodeMirror-linewidget" == i.className && t.node.removeChild(i);
1357 }
1358 q(e, t, n);
1359 }
1360 function U(e, t, n, r) {
1361 var i = B(e, t);
1362 return t.text = t.node = i.pre, i.bgClass && (t.bgClass = i.bgClass), i.textClass && (t.textClass = i.textClass),
1363 F(t), z(e, t, n, r), q(e, t, r), t.node;
1364 }
1365 function q(e, t, n) {
1366 if (G(e, t.line, t, n, !0), t.rest) for (var r = 0; r < t.rest.length; r++) G(e, t.rest[r], t, n, !1);
1367 }
1368 function G(e, t, n, r, i) {
1369 if (t.widgets) for (var o = H(n), a = 0, l = t.widgets; a < l.length; ++a) {
1370 var s = l[a], c = ji("div", [ s.node ], "CodeMirror-linewidget");
1371 s.handleMouseEvents || c.setAttribute("cm-ignore-events", "true"), Y(s, c, n, r),
1372 e.display.input.setUneditable(c), i && s.above ? o.insertBefore(c, n.gutter || n.text) : o.appendChild(c),
1373 Ci(s, "redraw");
1374 }
1375 }
1376 function Y(e, t, n, r) {
1377 if (e.noHScroll) {
1378 (n.alignable || (n.alignable = [])).push(t);
1379 var i = r.wrapperWidth;
1380 t.style.left = r.fixedPos + "px", e.coverGutter || (i -= r.gutterTotalWidth, t.style.paddingLeft = r.gutterTotalWidth + "px"),
1381 t.style.width = i + "px";
1382 }
1383 e.coverGutter && (t.style.zIndex = 5, t.style.position = "relative", e.noHScroll || (t.style.marginLeft = -r.gutterTotalWidth + "px"));
1384 }
1385 function $(e) {
1386 return Bo(e.line, e.ch);
1387 }
1388 function V(e, t) {
1389 return _o(e, t) < 0 ? t : e;
1390 }
1391 function K(e, t) {
1392 return _o(e, t) < 0 ? e : t;
1393 }
1394 function X(e) {
1395 e.state.focused || (e.display.input.focus(), vn(e));
1396 }
1397 function Z(e, t, n, r, i) {
1398 var o = e.doc;
1399 e.display.shift = !1, r || (r = o.sel);
1400 var a = e.state.pasteIncoming || "paste" == i, l = o.splitLines(t), s = null;
1401 if (a && r.ranges.length > 1) if (Fo && Fo.text.join("\n") == t) {
1402 if (r.ranges.length % Fo.text.length == 0) {
1403 s = [];
1404 for (var c = 0; c < Fo.text.length; c++) s.push(o.splitLines(Fo.text[c]));
1405 }
1406 } else l.length == r.ranges.length && (s = Ri(l, (function(e) {
1407 return [ e ];
1408 })));
1409 for (c = r.ranges.length - 1; c >= 0; c--) {
1410 var u = r.ranges[c], f = u.from(), h = u.to();
1411 u.empty() && (n && n > 0 ? f = Bo(f.line, f.ch - n) : e.state.overwrite && !a ? h = Bo(h.line, Math.min(Zr(o, h.line).text.length, h.ch + Ii(l).length)) : Fo && Fo.lineWise && Fo.text.join("\n") == t && (f = h = Bo(f.line, 0)));
1412 var d = e.curOp.updateInput, p = {
1413 from: f,
1414 to: h,
1415 text: s ? s[c % s.length] : l,
1416 origin: i || (a ? "paste" : e.state.cutIncoming ? "cut" : "+input")
1417 };
1418 Tn(e.doc, p), Ci(e, "inputRead", e, p);
1419 }
1420 t && !a && Q(e, t), Bn(e), e.curOp.updateInput = d, e.curOp.typing = !0, e.state.pasteIncoming = e.state.cutIncoming = !1;
1421 }
1422 function J(e, t) {
1423 var n = e.clipboardData && e.clipboardData.getData("text/plain");
1424 return n ? (e.preventDefault(), t.isReadOnly() || t.options.disableInput || At(t, (function() {
1425 Z(t, n, 0, null, "paste");
1426 })), !0) : void 0;
1427 }
1428 function Q(e, t) {
1429 if (e.options.electricChars && e.options.smartIndent) for (var n = e.doc.sel, r = n.ranges.length - 1; r >= 0; r--) {
1430 var i = n.ranges[r];
1431 if (!(i.head.ch > 100 || r && n.ranges[r - 1].head.line == i.head.line)) {
1432 var o = e.getModeAt(i.head), a = !1;
1433 if (o.electricChars) {
1434 for (var l = 0; l < o.electricChars.length; l++) if (t.indexOf(o.electricChars.charAt(l)) > -1) {
1435 a = Fn(e, i.head.line, "smart");
1436 break;
1437 }
1438 } else o.electricInput && o.electricInput.test(Zr(e.doc, i.head.line).text.slice(0, i.head.ch)) && (a = Fn(e, i.head.line, "smart"));
1439 a && Ci(e, "electricInput", e, i.head.line);
1440 }
1441 }
1442 }
1443 function ee(e) {
1444 for (var t = [], n = [], r = 0; r < e.doc.sel.ranges.length; r++) {
1445 var i = e.doc.sel.ranges[r].head.line, o = {
1446 anchor: Bo(i, 0),
1447 head: Bo(i + 1, 0)
1448 };
1449 n.push(o), t.push(e.getRange(o.anchor, o.head));
1450 }
1451 return {
1452 text: t,
1453 ranges: n
1454 };
1455 }
1456 function te(e) {
1457 e.setAttribute("autocorrect", "off"), e.setAttribute("autocapitalize", "off"), e.setAttribute("spellcheck", "false");
1458 }
1459 function ne(e) {
1460 this.cm = e, this.prevInput = "", this.pollingFast = !1, this.polling = new Ei,
1461 this.inaccurateSelection = !1, this.hasSelection = !1, this.composing = null;
1462 }
1463 function re() {
1464 var e = ji("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none"), t = ji("div", [ e ], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
1465 return wo ? e.style.width = "1000px" : e.setAttribute("wrap", "off"), No && (e.style.border = "1px solid black"),
1466 te(e), t;
1467 }
1468 function ie(e) {
1469 this.cm = e, this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null,
1470 this.polling = new Ei, this.gracePeriod = !1;
1471 }
1472 function oe(e, t) {
1473 var n = Qe(e, t.line);
1474 if (!n || n.hidden) return null;
1475 var r = Zr(e.doc, t.line), i = Xe(n, r, t.line), o = ii(r), a = "left";
1476 o && (a = co(o, t.ch) % 2 ? "right" : "left");
1477 var s = nt(i.map, t.ch, a);
1478 return s.offset = "right" == s.collapse ? s.end : s.start, s;
1479 }
1480 function ae(e, t) {
1481 return t && (e.bad = !0), e;
1482 }
1483 function le(e, t, n) {
1484 var r;
1485 if (t == e.display.lineDiv) {
1486 if (!(r = e.display.lineDiv.childNodes[n])) return ae(e.clipPos(Bo(e.display.viewTo - 1)), !0);
1487 t = null, n = 0;
1488 } else for (r = t; ;r = r.parentNode) {
1489 if (!r || r == e.display.lineDiv) return null;
1490 if (r.parentNode && r.parentNode == e.display.lineDiv) break;
1491 }
1492 for (var i = 0; i < e.display.view.length; i++) {
1493 var o = e.display.view[i];
1494 if (o.node == r) return se(o, t, n);
1495 }
1496 }
1497 function se(e, t, n) {
1498 function r(t, n, r) {
1499 for (var i = -1; i < (u ? u.length : 0); i++) for (var o = 0 > i ? c.map : u[i], a = 0; a < o.length; a += 3) {
1500 var l = o[a + 2];
1501 if (l == t || l == n) {
1502 var s = ti(0 > i ? e.line : e.rest[i]), f = o[a] + r;
1503 return (0 > r || l != t) && (f = o[a + (r ? 1 : 0)]), Bo(s, f);
1504 }
1505 }
1506 }
1507 var i = e.text.firstChild, o = !1;
1508 if (!t || !Va(i, t)) return ae(Bo(ti(e.line), 0), !0);
1509 if (t == i && (o = !0, t = i.childNodes[n], n = 0, !t)) {
1510 var a = e.rest ? Ii(e.rest) : e.line;
1511 return ae(Bo(ti(a), a.text.length), o);
1512 }
1513 var l = 3 == t.nodeType ? t : null, s = t;
1514 for (l || 1 != t.childNodes.length || 3 != t.firstChild.nodeType || (l = t.firstChild,
1515 n && (n = l.nodeValue.length)); s.parentNode != i; ) s = s.parentNode;
1516 var c = e.measure, u = c.maps, f = r(l, s, n);
1517 if (f) return ae(f, o);
1518 for (var h = s.nextSibling, d = l ? l.nodeValue.length - n : 0; h; h = h.nextSibling) {
1519 if (f = r(h, h.firstChild, 0)) return ae(Bo(f.line, f.ch - d), o);
1520 d += h.textContent.length;
1521 }
1522 var p = s.previousSibling;
1523 for (d = n; p; p = p.previousSibling) {
1524 if (f = r(p, p.firstChild, -1)) return ae(Bo(f.line, f.ch + d), o);
1525 d += h.textContent.length;
1526 }
1527 }
1528 function ce(e, t, n, r, i) {
1529 function o(e) {
1530 return function(t) {
1531 return t.id == e;
1532 };
1533 }
1534 function a(t) {
1535 if (1 == t.nodeType) {
1536 var n = t.getAttribute("cm-text");
1537 if (null != n) return "" == n && (n = t.textContent.replace(/\u200b/g, "")), void (l += n);
1538 var u, f = t.getAttribute("cm-marker");
1539 if (f) {
1540 var h = e.findMarks(Bo(r, 0), Bo(i + 1, 0), o(+f));
1541 return void (h.length && (u = h[0].find()) && (l += Jr(e.doc, u.from, u.to).join(c)));
1542 }
1543 if ("false" == t.getAttribute("contenteditable")) return;
1544 for (var d = 0; d < t.childNodes.length; d++) a(t.childNodes[d]);
1545 /^(pre|div|p)$/i.test(t.nodeName) && (s = !0);
1546 } else if (3 == t.nodeType) {
1547 var p = t.nodeValue;
1548 if (!p) return;
1549 s && (l += c, s = !1), l += p;
1550 }
1551 }
1552 for (var l = "", s = !1, c = e.doc.lineSeparator(); a(t), t != n; ) t = t.nextSibling;
1553 return l;
1554 }
1555 function ue(e, t) {
1556 this.ranges = e, this.primIndex = t;
1557 }
1558 function fe(e, t) {
1559 this.anchor = e, this.head = t;
1560 }
1561 function he(e, t) {
1562 var n = e[t];
1563 e.sort((function(e, t) {
1564 return _o(e.from(), t.from());
1565 })), t = Pi(e, n);
1566 for (var r = 1; r < e.length; r++) {
1567 var i = e[r], o = e[r - 1];
1568 if (_o(o.to(), i.from()) >= 0) {
1569 var a = K(o.from(), i.from()), l = V(o.to(), i.to()), s = o.empty() ? i.from() == i.head : o.from() == o.head;
1570 t >= r && --t, e.splice(--r, 2, new fe(s ? l : a, s ? a : l));
1571 }
1572 }
1573 return new ue(e, t);
1574 }
1575 function de(e, t) {
1576 return new ue([ new fe(e, t || e) ], 0);
1577 }
1578 function pe(e, t) {
1579 return Math.max(e.first, Math.min(t, e.first + e.size - 1));
1580 }
1581 function me(e, t) {
1582 if (t.line < e.first) return Bo(e.first, 0);
1583 var n = e.first + e.size - 1;
1584 return t.line > n ? Bo(n, Zr(e, n).text.length) : ge(t, Zr(e, t.line).text.length);
1585 }
1586 function ge(e, t) {
1587 var n = e.ch;
1588 return null == n || n > t ? Bo(e.line, t) : 0 > n ? Bo(e.line, 0) : e;
1589 }
1590 function ve(e, t) {
1591 return t >= e.first && t < e.first + e.size;
1592 }
1593 function ye(e, t) {
1594 for (var n = [], r = 0; r < t.length; r++) n[r] = me(e, t[r]);
1595 return n;
1596 }
1597 function xe(e, t, n, r) {
1598 if (e.cm && e.cm.display.shift || e.extend) {
1599 var i = t.anchor;
1600 if (r) {
1601 var o = _o(n, i) < 0;
1602 o != _o(r, i) < 0 ? (i = n, n = r) : o != _o(n, r) < 0 && (n = r);
1603 }
1604 return new fe(i, n);
1605 }
1606 return new fe(r || n, n);
1607 }
1608 function be(e, t, n, r) {
1609 Te(e, new ue([ xe(e, e.sel.primary(), t, n) ], 0), r);
1610 }
1611 function we(e, t, n) {
1612 for (var r = [], i = 0; i < e.sel.ranges.length; i++) r[i] = xe(e, e.sel.ranges[i], t[i], null);
1613 Te(e, he(r, e.sel.primIndex), n);
1614 }
1615 function ke(e, t, n, r) {
1616 var i = e.sel.ranges.slice(0);
1617 i[t] = n, Te(e, he(i, e.sel.primIndex), r);
1618 }
1619 function Se(e, t, n, r) {
1620 Te(e, de(t, n), r);
1621 }
1622 function Ce(e, t, n) {
1623 var r = {
1624 ranges: t.ranges,
1625 update: function(t) {
1626 this.ranges = [];
1627 for (var n = 0; n < t.length; n++) this.ranges[n] = new fe(me(e, t[n].anchor), me(e, t[n].head));
1628 },
1629 origin: n && n.origin
1630 };
1631 return Pa(e, "beforeSelectionChange", e, r), e.cm && Pa(e.cm, "beforeSelectionChange", e.cm, r),
1632 r.ranges != t.ranges ? he(r.ranges, r.ranges.length - 1) : t;
1633 }
1634 function Le(e, t, n) {
1635 var r = e.history.done, i = Ii(r);
1636 i && i.ranges ? (r[r.length - 1] = t, Me(e, t, n)) : Te(e, t, n);
1637 }
1638 function Te(e, t, n) {
1639 Me(e, t, n), fi(e, e.sel, e.cm ? e.cm.curOp.id : NaN, n);
1640 }
1641 function Me(e, t, n) {
1642 (Ni(e, "beforeSelectionChange") || e.cm && Ni(e.cm, "beforeSelectionChange")) && (t = Ce(e, t, n));
1643 var r = n && n.bias || (_o(t.primary().head, e.sel.primary().head) < 0 ? -1 : 1);
1644 Ne(e, Ee(e, t, r, !0)), n && !1 === n.scroll || !e.cm || Bn(e.cm);
1645 }
1646 function Ne(e, t) {
1647 t.equals(e.sel) || (e.sel = t, e.cm && (e.cm.curOp.updateInput = e.cm.curOp.selectionChanged = !0,
1648 Mi(e.cm)), Ci(e, "cursorActivity", e));
1649 }
1650 function Ae(e) {
1651 Ne(e, Ee(e, e.sel, null, !1), Wa);
1652 }
1653 function Ee(e, t, n, r) {
1654 for (var i, o = 0; o < t.ranges.length; o++) {
1655 var a = t.ranges[o], l = t.ranges.length == e.sel.ranges.length && e.sel.ranges[o], s = Ie(e, a.anchor, l && l.anchor, n, r), c = Ie(e, a.head, l && l.head, n, r);
1656 (i || s != a.anchor || c != a.head) && (i || (i = t.ranges.slice(0, o)), i[o] = new fe(s, c));
1657 }
1658 return i ? he(i, t.primIndex) : t;
1659 }
1660 function Oe(e, t, n, r, i) {
1661 var o = Zr(e, t.line);
1662 if (o.markedSpans) for (var a = 0; a < o.markedSpans.length; ++a) {
1663 var l = o.markedSpans[a], s = l.marker;
1664 if ((null == l.from || (s.inclusiveLeft ? l.from <= t.ch : l.from < t.ch)) && (null == l.to || (s.inclusiveRight ? l.to >= t.ch : l.to > t.ch))) {
1665 if (i && (Pa(s, "beforeCursorEnter"), s.explicitlyCleared)) {
1666 if (o.markedSpans) {
1667 --a;
1668 continue;
1669 }
1670 break;
1671 }
1672 if (!s.atomic) continue;
1673 if (n) {
1674 var c, u = s.find(0 > r ? 1 : -1);
1675 if ((0 > r ? s.inclusiveRight : s.inclusiveLeft) && (u = Pe(e, u, -r, u && u.line == t.line ? o : null)),
1676 u && u.line == t.line && (c = _o(u, n)) && (0 > r ? 0 > c : c > 0)) return Oe(e, u, t, r, i);
1677 }
1678 var f = s.find(0 > r ? -1 : 1);
1679 return (0 > r ? s.inclusiveLeft : s.inclusiveRight) && (f = Pe(e, f, r, f.line == t.line ? o : null)),
1680 f ? Oe(e, f, t, r, i) : null;
1681 }
1682 }
1683 return t;
1684 }
1685 function Ie(e, t, n, r, i) {
1686 var o = r || 1, a = Oe(e, t, n, o, i) || !i && Oe(e, t, n, o, !0) || Oe(e, t, n, -o, i) || !i && Oe(e, t, n, -o, !0);
1687 return a || (e.cantEdit = !0, Bo(e.first, 0));
1688 }
1689 function Pe(e, t, n, r) {
1690 return 0 > n && 0 == t.ch ? t.line > e.first ? me(e, Bo(t.line - 1)) : null : n > 0 && t.ch == (r || Zr(e, t.line)).text.length ? t.line < e.first + e.size - 1 ? Bo(t.line + 1, 0) : null : new Bo(t.line, t.ch + n);
1691 }
1692 function Re(e) {
1693 e.display.input.showSelection(e.display.input.prepareSelection());
1694 }
1695 function De(e, t) {
1696 for (var n = e.doc, r = {}, i = r.cursors = document.createDocumentFragment(), o = r.selection = document.createDocumentFragment(), a = 0; a < n.sel.ranges.length; a++) if (!1 !== t || a != n.sel.primIndex) {
1697 var l = n.sel.ranges[a];
1698 if (!(l.from().line >= e.display.viewTo || l.to().line < e.display.viewFrom)) {
1699 var s = l.empty();
1700 (s || e.options.showCursorWhenSelecting) && He(e, l.head, i), s || We(e, l, o);
1701 }
1702 }
1703 return r;
1704 }
1705 function He(e, t, n) {
1706 var r = dt(e, t, "div", null, null, !e.options.singleCursorHeightPerLine), i = n.appendChild(ji("div", " ", "CodeMirror-cursor"));
1707 if (i.style.left = r.left + "px", i.style.top = r.top + "px", i.style.height = Math.max(0, r.bottom - r.top) * e.options.cursorHeight + "px",
1708 r.other) {
1709 var o = n.appendChild(ji("div", " ", "CodeMirror-cursor CodeMirror-secondarycursor"));
1710 o.style.display = "", o.style.left = r.other.left + "px", o.style.top = r.other.top + "px",
1711 o.style.height = .85 * (r.other.bottom - r.other.top) + "px";
1712 }
1713 }
1714 function We(e, t, n) {
1715 function r(e, t, n, r) {
1716 0 > t && (t = 0), t = Math.round(t), r = Math.round(r), l.appendChild(ji("div", null, "CodeMirror-selected", "position: absolute; left: " + e + "px; top: " + t + "px; width: " + (null == n ? u - e : n) + "px; height: " + (r - t) + "px"));
1717 }
1718 function i(t, n, i) {
1719 function o(n, r) {
1720 return ht(e, Bo(t, n), "div", f, r);
1721 }
1722 var l, s, f = Zr(a, t), h = f.text.length;
1723 return eo(ii(f), n || 0, null == i ? h : i, (function(e, t, a) {
1724 var f, d, p, m = o(e, "left");
1725 if (e == t) f = m, d = p = m.left; else {
1726 if (f = o(t - 1, "right"), "rtl" == a) {
1727 var g = m;
1728 m = f, f = g;
1729 }
1730 d = m.left, p = f.right;
1731 }
1732 null == n && 0 == e && (d = c), f.top - m.top > 3 && (r(d, m.top, null, m.bottom),
1733 d = c, m.bottom < f.top && r(d, m.bottom, null, f.top)), null == i && t == h && (p = u),
1734 (!l || m.top < l.top || m.top == l.top && m.left < l.left) && (l = m), (!s || f.bottom > s.bottom || f.bottom == s.bottom && f.right > s.right) && (s = f),
1735 c + 1 > d && (d = c), r(d, f.top, p - d, f.bottom);
1736 })), {
1737 start: l,
1738 end: s
1739 };
1740 }
1741 var o = e.display, a = e.doc, l = document.createDocumentFragment(), s = Ge(e.display), c = s.left, u = Math.max(o.sizerWidth, $e(e) - o.sizer.offsetLeft) - s.right, f = t.from(), h = t.to();
1742 if (f.line == h.line) i(f.line, f.ch, h.ch); else {
1743 var d = Zr(a, f.line), p = Zr(a, h.line), m = yr(d) == yr(p), g = i(f.line, f.ch, m ? d.text.length + 1 : null).end, v = i(h.line, m ? 0 : null, h.ch).start;
1744 m && (g.top < v.top - 2 ? (r(g.right, g.top, null, g.bottom), r(c, v.top, v.left, v.bottom)) : r(g.right, g.top, v.left - g.right, g.bottom)),
1745 g.bottom < v.top && r(c, g.bottom, null, v.top);
1746 }
1747 n.appendChild(l);
1748 }
1749 function Be(e) {
1750 if (e.state.focused) {
1751 var t = e.display;
1752 clearInterval(t.blinker);
1753 var n = !0;
1754 t.cursorDiv.style.visibility = "", e.options.cursorBlinkRate > 0 ? t.blinker = setInterval((function() {
1755 t.cursorDiv.style.visibility = (n = !n) ? "" : "hidden";
1756 }), e.options.cursorBlinkRate) : e.options.cursorBlinkRate < 0 && (t.cursorDiv.style.visibility = "hidden");
1757 }
1758 }
1759 function _e(e, t) {
1760 e.doc.mode.startState && e.doc.frontier < e.display.viewTo && e.state.highlight.set(t, Bi(Fe, e));
1761 }
1762 function Fe(e) {
1763 var t = e.doc;
1764 if (t.frontier < t.first && (t.frontier = t.first), !(t.frontier >= e.display.viewTo)) {
1765 var n = +new Date + e.options.workTime, r = sa(t.mode, je(e, t.frontier)), i = [];
1766 t.iter(t.frontier, Math.min(t.first + t.size, e.display.viewTo + 500), (function(o) {
1767 if (t.frontier >= e.display.viewFrom) {
1768 var a = o.styles, l = o.text.length > e.options.maxHighlightLength, s = Rr(e, o, l ? sa(t.mode, r) : r, !0);
1769 o.styles = s.styles;
1770 var c = o.styleClasses, u = s.classes;
1771 u ? o.styleClasses = u : c && (o.styleClasses = null);
1772 for (var f = !a || a.length != o.styles.length || c != u && (!c || !u || c.bgClass != u.bgClass || c.textClass != u.textClass), h = 0; !f && h < a.length; ++h) f = a[h] != o.styles[h];
1773 f && i.push(t.frontier), o.stateAfter = l ? r : sa(t.mode, r);
1774 } else o.text.length <= e.options.maxHighlightLength && Hr(e, o.text, r), o.stateAfter = t.frontier % 5 == 0 ? sa(t.mode, r) : null;
1775 return ++t.frontier, +new Date > n ? (_e(e, e.options.workDelay), !0) : void 0;
1776 })), i.length && At(e, (function() {
1777 for (var t = 0; t < i.length; t++) Ht(e, i[t], "text");
1778 }));
1779 }
1780 }
1781 function ze(e, t, n) {
1782 for (var r, i, o = e.doc, a = n ? -1 : t - (e.doc.mode.innerMode ? 1e3 : 100), l = t; l > a; --l) {
1783 if (l <= o.first) return o.first;
1784 var s = Zr(o, l - 1);
1785 if (s.stateAfter && (!n || l <= o.frontier)) return l;
1786 var c = Fa(s.text, null, e.options.tabSize);
1787 (null == i || r > c) && (i = l - 1, r = c);
1788 }
1789 return i;
1790 }
1791 function je(e, t, n) {
1792 var r = e.doc, i = e.display;
1793 if (!r.mode.startState) return !0;
1794 var o = ze(e, t, n), a = o > r.first && Zr(r, o - 1).stateAfter;
1795 return a = a ? sa(r.mode, a) : ca(r.mode), r.iter(o, t, (function(n) {
1796 Hr(e, n.text, a);
1797 var l = o == t - 1 || o % 5 == 0 || o >= i.viewFrom && o < i.viewTo;
1798 n.stateAfter = l ? sa(r.mode, a) : null, ++o;
1799 })), n && (r.frontier = o), a;
1800 }
1801 function Ue(e) {
1802 return e.lineSpace.offsetTop;
1803 }
1804 function qe(e) {
1805 return e.mover.offsetHeight - e.lineSpace.offsetHeight;
1806 }
1807 function Ge(e) {
1808 if (e.cachedPaddingH) return e.cachedPaddingH;
1809 var t = qi(e.measure, ji("pre", "x")), n = window.getComputedStyle ? window.getComputedStyle(t) : t.currentStyle, r = {
1810 left: parseInt(n.paddingLeft),
1811 right: parseInt(n.paddingRight)
1812 };
1813 return isNaN(r.left) || isNaN(r.right) || (e.cachedPaddingH = r), r;
1814 }
1815 function Ye(e) {
1816 return Da - e.display.nativeBarWidth;
1817 }
1818 function $e(e) {
1819 return e.display.scroller.clientWidth - Ye(e) - e.display.barWidth;
1820 }
1821 function Ve(e) {
1822 return e.display.scroller.clientHeight - Ye(e) - e.display.barHeight;
1823 }
1824 function Ke(e, t, n) {
1825 var r = e.options.lineWrapping, i = r && $e(e);
1826 if (!t.measure.heights || r && t.measure.width != i) {
1827 var o = t.measure.heights = [];
1828 if (r) {
1829 t.measure.width = i;
1830 for (var a = t.text.firstChild.getClientRects(), l = 0; l < a.length - 1; l++) {
1831 var s = a[l], c = a[l + 1];
1832 Math.abs(s.bottom - c.bottom) > 2 && o.push((s.bottom + c.top) / 2 - n.top);
1833 }
1834 }
1835 o.push(n.bottom - n.top);
1836 }
1837 }
1838 function Xe(e, t, n) {
1839 if (e.line == t) return {
1840 map: e.measure.map,
1841 cache: e.measure.cache
1842 };
1843 for (var r = 0; r < e.rest.length; r++) if (e.rest[r] == t) return {
1844 map: e.measure.maps[r],
1845 cache: e.measure.caches[r]
1846 };
1847 for (r = 0; r < e.rest.length; r++) if (ti(e.rest[r]) > n) return {
1848 map: e.measure.maps[r],
1849 cache: e.measure.caches[r],
1850 before: !0
1851 };
1852 }
1853 function Ze(e, t) {
1854 var n = ti(t = yr(t)), r = e.display.externalMeasured = new Pt(e.doc, t, n);
1855 r.lineN = n;
1856 var i = r.built = Br(e, r);
1857 return r.text = i.pre, qi(e.display.lineMeasure, i.pre), r;
1858 }
1859 function Je(e, t, n, r) {
1860 return tt(e, et(e, t), n, r);
1861 }
1862 function Qe(e, t) {
1863 if (t >= e.display.viewFrom && t < e.display.viewTo) return e.display.view[Bt(e, t)];
1864 var n = e.display.externalMeasured;
1865 return n && t >= n.lineN && t < n.lineN + n.size ? n : void 0;
1866 }
1867 function et(e, t) {
1868 var n = ti(t), r = Qe(e, n);
1869 r && !r.text ? r = null : r && r.changes && (D(e, r, n, P(e)), e.curOp.forceUpdate = !0),
1870 r || (r = Ze(e, t));
1871 var i = Xe(r, t, n);
1872 return {
1873 line: t,
1874 view: r,
1875 rect: null,
1876 map: i.map,
1877 cache: i.cache,
1878 before: i.before,
1879 hasHeights: !1
1880 };
1881 }
1882 function tt(e, t, n, r, i) {
1883 t.before && (n = -1);
1884 var o, a = n + (r || "");
1885 return t.cache.hasOwnProperty(a) ? o = t.cache[a] : (t.rect || (t.rect = t.view.text.getBoundingClientRect()),
1886 t.hasHeights || (Ke(e, t.view, t.rect), t.hasHeights = !0), (o = rt(e, t, n, r)).bogus || (t.cache[a] = o)),
1887 {
1888 left: o.left,
1889 right: o.right,
1890 top: i ? o.rtop : o.top,
1891 bottom: i ? o.rbottom : o.bottom
1892 };
1893 }
1894 function nt(e, t, n) {
1895 for (var r, i, o, a, l = 0; l < e.length; l += 3) {
1896 var s = e[l], c = e[l + 1];
1897 if (s > t ? (i = 0, o = 1, a = "left") : c > t ? o = 1 + (i = t - s) : (l == e.length - 3 || t == c && e[l + 3] > t) && (i = (o = c - s) - 1,
1898 t >= c && (a = "right")), null != i) {
1899 if (r = e[l + 2], s == c && n == (r.insertLeft ? "left" : "right") && (a = n), "left" == n && 0 == i) for (;l && e[l - 2] == e[l - 3] && e[l - 1].insertLeft; ) r = e[2 + (l -= 3)],
1900 a = "left";
1901 if ("right" == n && i == c - s) for (;l < e.length - 3 && e[l + 3] == e[l + 4] && !e[l + 5].insertLeft; ) r = e[(l += 3) + 2],
1902 a = "right";
1903 break;
1904 }
1905 }
1906 return {
1907 node: r,
1908 start: i,
1909 end: o,
1910 collapse: a,
1911 coverStart: s,
1912 coverEnd: c
1913 };
1914 }
1915 function rt(e, t, n, r) {
1916 var i, o = nt(t.map, n, r), a = o.node, l = o.start, s = o.end, c = o.collapse;
1917 if (3 == a.nodeType) {
1918 for (var u = 0; 4 > u; u++) {
1919 for (;l && zi(t.line.text.charAt(o.coverStart + l)); ) --l;
1920 for (;o.coverStart + s < o.coverEnd && zi(t.line.text.charAt(o.coverStart + s)); ) ++s;
1921 if ((i = xo && 9 > bo && 0 == l && s == o.coverEnd - o.coverStart ? a.parentNode.getBoundingClientRect() : xo && e.options.lineWrapping ? (f = qa(a, l, s).getClientRects()).length ? f["right" == r ? f.length - 1 : 0] : qo : qa(a, l, s).getBoundingClientRect() || qo).left || i.right || 0 == l) break;
1922 s = l, l -= 1, c = "right";
1923 }
1924 xo && 11 > bo && (i = it(e.display.measure, i));
1925 } else {
1926 var f;
1927 l > 0 && (c = r = "right"), i = e.options.lineWrapping && (f = a.getClientRects()).length > 1 ? f["right" == r ? f.length - 1 : 0] : a.getBoundingClientRect();
1928 }
1929 if (xo && 9 > bo && !l && (!i || !i.left && !i.right)) {
1930 var h = a.parentNode.getClientRects()[0];
1931 i = h ? {
1932 left: h.left,
1933 right: h.left + xt(e.display),
1934 top: h.top,
1935 bottom: h.bottom
1936 } : qo;
1937 }
1938 var d = i.top - t.rect.top, p = i.bottom - t.rect.top, m = (d + p) / 2, g = t.view.measure.heights;
1939 for (u = 0; u < g.length - 1 && !(m < g[u]); u++) ;
1940 var v = u ? g[u - 1] : 0, y = g[u], x = {
1941 left: ("right" == c ? i.right : i.left) - t.rect.left,
1942 right: ("left" == c ? i.left : i.right) - t.rect.left,
1943 top: v,
1944 bottom: y
1945 };
1946 return i.left || i.right || (x.bogus = !0), e.options.singleCursorHeightPerLine || (x.rtop = d,
1947 x.rbottom = p), x;
1948 }
1949 function it(e, t) {
1950 if (!window.screen || null == screen.logicalXDPI || screen.logicalXDPI == screen.deviceXDPI || !Qi(e)) return t;
1951 var n = screen.logicalXDPI / screen.deviceXDPI, r = screen.logicalYDPI / screen.deviceYDPI;
1952 return {
1953 left: t.left * n,
1954 right: t.right * n,
1955 top: t.top * r,
1956 bottom: t.bottom * r
1957 };
1958 }
1959 function ot(e) {
1960 if (e.measure && (e.measure.cache = {}, e.measure.heights = null, e.rest)) for (var t = 0; t < e.rest.length; t++) e.measure.caches[t] = {};
1961 }
1962 function at(e) {
1963 e.display.externalMeasure = null, Ui(e.display.lineMeasure);
1964 for (var t = 0; t < e.display.view.length; t++) ot(e.display.view[t]);
1965 }
1966 function lt(e) {
1967 at(e), e.display.cachedCharWidth = e.display.cachedTextHeight = e.display.cachedPaddingH = null,
1968 e.options.lineWrapping || (e.display.maxLineChanged = !0), e.display.lineNumChars = null;
1969 }
1970 function st() {
1971 return window.pageXOffset || (document.documentElement || document.body).scrollLeft;
1972 }
1973 function ct() {
1974 return window.pageYOffset || (document.documentElement || document.body).scrollTop;
1975 }
1976 function ut(e, t, n, r) {
1977 if (t.widgets) for (var i = 0; i < t.widgets.length; ++i) if (t.widgets[i].above) {
1978 var o = Lr(t.widgets[i]);
1979 n.top += o, n.bottom += o;
1980 }
1981 if ("line" == r) return n;
1982 r || (r = "local");
1983 var a = ri(t);
1984 if ("local" == r ? a += Ue(e.display) : a -= e.display.viewOffset, "page" == r || "window" == r) {
1985 var l = e.display.lineSpace.getBoundingClientRect();
1986 a += l.top + ("window" == r ? 0 : ct());
1987 var s = l.left + ("window" == r ? 0 : st());
1988 n.left += s, n.right += s;
1989 }
1990 return n.top += a, n.bottom += a, n;
1991 }
1992 function ft(e, t, n) {
1993 if ("div" == n) return t;
1994 var r = t.left, i = t.top;
1995 if ("page" == n) r -= st(), i -= ct(); else if ("local" == n || !n) {
1996 var o = e.display.sizer.getBoundingClientRect();
1997 r += o.left, i += o.top;
1998 }
1999 var a = e.display.lineSpace.getBoundingClientRect();
2000 return {
2001 left: r - a.left,
2002 top: i - a.top
2003 };
2004 }
2005 function ht(e, t, n, r, i) {
2006 return r || (r = Zr(e.doc, t.line)), ut(e, r, Je(e, r, t.ch, i), n);
2007 }
2008 function dt(e, t, n, r, i, o) {
2009 function a(t, a) {
2010 var l = tt(e, i, t, a ? "right" : "left", o);
2011 return a ? l.left = l.right : l.right = l.left, ut(e, r, l, n);
2012 }
2013 function l(e, t) {
2014 var n = s[t], r = n.level % 2;
2015 return e == to(n) && t && n.level < s[t - 1].level ? (e = no(n = s[--t]) - (n.level % 2 ? 0 : 1),
2016 r = !0) : e == no(n) && t < s.length - 1 && n.level < s[t + 1].level && (e = to(n = s[++t]) - n.level % 2,
2017 r = !1), r && e == n.to && e > n.from ? a(e - 1) : a(e, r);
2018 }
2019 r = r || Zr(e.doc, t.line), i || (i = et(e, r));
2020 var s = ii(r), c = t.ch;
2021 if (!s) return a(c);
2022 var f = l(c, co(s, c));
2023 return null != al && (f.other = l(c, al)), f;
2024 }
2025 function pt(e, t) {
2026 var n = 0;
2027 t = me(e.doc, t), e.options.lineWrapping || (n = xt(e.display) * t.ch);
2028 var r = Zr(e.doc, t.line), i = ri(r) + Ue(e.display);
2029 return {
2030 left: n,
2031 right: n,
2032 top: i,
2033 bottom: i + r.height
2034 };
2035 }
2036 function mt(e, t, n, r) {
2037 var i = Bo(e, t);
2038 return i.xRel = r, n && (i.outside = !0), i;
2039 }
2040 function gt(e, t, n) {
2041 var r = e.doc;
2042 if (0 > (n += e.display.viewOffset)) return mt(r.first, 0, !0, -1);
2043 var i = ni(r, n), o = r.first + r.size - 1;
2044 if (i > o) return mt(r.first + r.size - 1, Zr(r, o).text.length, !0, 1);
2045 0 > t && (t = 0);
2046 for (var a = Zr(r, i); ;) {
2047 var l = vt(e, a, i, t, n), s = gr(a), c = s && s.find(0, !0);
2048 if (!s || !(l.ch > c.from.ch || l.ch == c.from.ch && l.xRel > 0)) return l;
2049 i = ti(a = c.to.line);
2050 }
2051 }
2052 function vt(e, t, n, r, i) {
2053 function o(r) {
2054 var i = dt(e, Bo(n, r), "line", t, c);
2055 return l = !0, a > i.bottom ? i.left - s : a < i.top ? i.left + s : (l = !1, i.left);
2056 }
2057 var a = i - ri(t), l = !1, s = 2 * e.display.wrapper.clientWidth, c = et(e, t), u = ii(t), f = t.text.length, h = ro(t), d = io(t), p = o(h), m = l, g = o(d), v = l;
2058 if (r > g) return mt(n, d, v, 1);
2059 for (;;) {
2060 if (u ? d == h || d == fo(t, h, 1) : 1 >= d - h) {
2061 for (var y = p > r || g - r >= r - p ? h : d, x = r - (y == h ? p : g); zi(t.text.charAt(y)); ) ++y;
2062 return mt(n, y, y == h ? m : v, -1 > x ? -1 : x > 1 ? 1 : 0);
2063 }
2064 var w = Math.ceil(f / 2), k = h + w;
2065 if (u) {
2066 k = h;
2067 for (var S = 0; w > S; ++S) k = fo(t, k, 1);
2068 }
2069 var C = o(k);
2070 C > r ? (d = k, g = C, (v = l) && (g += 1e3), f = w) : (h = k, p = C, m = l, f -= w);
2071 }
2072 }
2073 function yt(e) {
2074 if (null != e.cachedTextHeight) return e.cachedTextHeight;
2075 if (null == zo) {
2076 zo = ji("pre");
2077 for (var t = 0; 49 > t; ++t) zo.appendChild(document.createTextNode("x")), zo.appendChild(ji("br"));
2078 zo.appendChild(document.createTextNode("x"));
2079 }
2080 qi(e.measure, zo);
2081 var n = zo.offsetHeight / 50;
2082 return n > 3 && (e.cachedTextHeight = n), Ui(e.measure), n || 1;
2083 }
2084 function xt(e) {
2085 if (null != e.cachedCharWidth) return e.cachedCharWidth;
2086 var t = ji("span", "xxxxxxxxxx"), n = ji("pre", [ t ]);
2087 qi(e.measure, n);
2088 var r = t.getBoundingClientRect(), i = (r.right - r.left) / 10;
2089 return i > 2 && (e.cachedCharWidth = i), i || 10;
2090 }
2091 function bt(e) {
2092 e.curOp = {
2093 cm: e,
2094 viewChanged: !1,
2095 startHeight: e.doc.height,
2096 forceUpdate: !1,
2097 updateInput: null,
2098 typing: !1,
2099 changeObjs: null,
2100 cursorActivityHandlers: null,
2101 cursorActivityCalled: 0,
2102 selectionChanged: !1,
2103 updateMaxLine: !1,
2104 scrollLeft: null,
2105 scrollTop: null,
2106 scrollToPos: null,
2107 focus: !1,
2108 id: ++Yo
2109 }, Go ? Go.ops.push(e.curOp) : e.curOp.ownsGroup = Go = {
2110 ops: [ e.curOp ],
2111 delayedCallbacks: []
2112 };
2113 }
2114 function wt(e) {
2115 var t = e.delayedCallbacks, n = 0;
2116 do {
2117 for (;n < t.length; n++) t[n].call(null);
2118 for (var r = 0; r < e.ops.length; r++) {
2119 var i = e.ops[r];
2120 if (i.cursorActivityHandlers) for (;i.cursorActivityCalled < i.cursorActivityHandlers.length; ) i.cursorActivityHandlers[i.cursorActivityCalled++].call(null, i.cm);
2121 }
2122 } while (n < t.length);
2123 }
2124 function kt(e) {
2125 var n = e.curOp.ownsGroup;
2126 if (n) try {
2127 wt(n);
2128 } finally {
2129 Go = null;
2130 for (var r = 0; r < n.ops.length; r++) n.ops[r].cm.curOp = null;
2131 St(n);
2132 }
2133 }
2134 function St(e) {
2135 for (var t = e.ops, n = 0; n < t.length; n++) Ct(t[n]);
2136 for (n = 0; n < t.length; n++) Lt(t[n]);
2137 for (n = 0; n < t.length; n++) Tt(t[n]);
2138 for (n = 0; n < t.length; n++) Mt(t[n]);
2139 for (n = 0; n < t.length; n++) Nt(t[n]);
2140 }
2141 function Ct(e) {
2142 var t = e.cm, n = t.display;
2143 T(t), e.updateMaxLine && h(t), e.mustUpdate = e.viewChanged || e.forceUpdate || null != e.scrollTop || e.scrollToPos && (e.scrollToPos.from.line < n.viewFrom || e.scrollToPos.to.line >= n.viewTo) || n.maxLineChanged && t.options.lineWrapping,
2144 e.update = e.mustUpdate && new L(t, e.mustUpdate && {
2145 top: e.scrollTop,
2146 ensure: e.scrollToPos
2147 }, e.forceUpdate);
2148 }
2149 function Lt(e) {
2150 e.updatedDisplay = e.mustUpdate && M(e.cm, e.update);
2151 }
2152 function Tt(e) {
2153 var t = e.cm, n = t.display;
2154 e.updatedDisplay && O(t), e.barMeasure = p(t), n.maxLineChanged && !t.options.lineWrapping && (e.adjustWidthTo = Je(t, n.maxLine, n.maxLine.text.length).left + 3,
2155 t.display.sizerWidth = e.adjustWidthTo, e.barMeasure.scrollWidth = Math.max(n.scroller.clientWidth, n.sizer.offsetLeft + e.adjustWidthTo + Ye(t) + t.display.barWidth),
2156 e.maxScrollLeft = Math.max(0, n.sizer.offsetLeft + e.adjustWidthTo - $e(t))), (e.updatedDisplay || e.selectionChanged) && (e.preparedSelection = n.input.prepareSelection(e.focus));
2157 }
2158 function Mt(e) {
2159 var t = e.cm;
2160 null != e.adjustWidthTo && (t.display.sizer.style.minWidth = e.adjustWidthTo + "px",
2161 e.maxScrollLeft < t.doc.scrollLeft && on(t, Math.min(t.display.scroller.scrollLeft, e.maxScrollLeft), !0),
2162 t.display.maxLineChanged = !1);
2163 var n = e.focus && e.focus == Gi() && (!document.hasFocus || document.hasFocus());
2164 e.preparedSelection && t.display.input.showSelection(e.preparedSelection, n), (e.updatedDisplay || e.startHeight != t.doc.height) && y(t, e.barMeasure),
2165 e.updatedDisplay && E(t, e.barMeasure), e.selectionChanged && Be(t), t.state.focused && e.updateInput && t.display.input.reset(e.typing),
2166 n && X(e.cm);
2167 }
2168 function Nt(e) {
2169 var t = e.cm, n = t.display, r = t.doc;
2170 if (e.updatedDisplay && N(t, e.update), null == n.wheelStartX || null == e.scrollTop && null == e.scrollLeft && !e.scrollToPos || (n.wheelStartX = n.wheelStartY = null),
2171 null == e.scrollTop || n.scroller.scrollTop == e.scrollTop && !e.forceScroll || (r.scrollTop = Math.max(0, Math.min(n.scroller.scrollHeight - n.scroller.clientHeight, e.scrollTop)),
2172 n.scrollbars.setScrollTop(r.scrollTop), n.scroller.scrollTop = r.scrollTop), null == e.scrollLeft || n.scroller.scrollLeft == e.scrollLeft && !e.forceScroll || (r.scrollLeft = Math.max(0, Math.min(n.scroller.scrollWidth - n.scroller.clientWidth, e.scrollLeft)),
2173 n.scrollbars.setScrollLeft(r.scrollLeft), n.scroller.scrollLeft = r.scrollLeft,
2174 w(t)), e.scrollToPos) {
2175 var i = Rn(t, me(r, e.scrollToPos.from), me(r, e.scrollToPos.to), e.scrollToPos.margin);
2176 e.scrollToPos.isCursor && t.state.focused && Pn(t, i);
2177 }
2178 var o = e.maybeHiddenMarkers, a = e.maybeUnhiddenMarkers;
2179 if (o) for (var l = 0; l < o.length; ++l) o[l].lines.length || Pa(o[l], "hide");
2180 if (a) for (l = 0; l < a.length; ++l) a[l].lines.length && Pa(a[l], "unhide");
2181 n.wrapper.offsetHeight && (r.scrollTop = t.display.scroller.scrollTop), e.changeObjs && Pa(t, "changes", t, e.changeObjs),
2182 e.update && e.update.finish();
2183 }
2184 function At(e, t) {
2185 if (e.curOp) return t();
2186 bt(e);
2187 try {
2188 return t();
2189 } finally {
2190 kt(e);
2191 }
2192 }
2193 function Et(e, t) {
2194 return function() {
2195 if (e.curOp) return t.apply(e, arguments);
2196 bt(e);
2197 try {
2198 return t.apply(e, arguments);
2199 } finally {
2200 kt(e);
2201 }
2202 };
2203 }
2204 function Ot(e) {
2205 return function() {
2206 if (this.curOp) return e.apply(this, arguments);
2207 bt(this);
2208 try {
2209 return e.apply(this, arguments);
2210 } finally {
2211 kt(this);
2212 }
2213 };
2214 }
2215 function It(e) {
2216 return function() {
2217 var t = this.cm;
2218 if (!t || t.curOp) return e.apply(this, arguments);
2219 bt(t);
2220 try {
2221 return e.apply(this, arguments);
2222 } finally {
2223 kt(t);
2224 }
2225 };
2226 }
2227 function Pt(e, t, n) {
2228 this.line = t, this.rest = xr(t), this.size = this.rest ? ti(Ii(this.rest)) - n + 1 : 1,
2229 this.node = this.text = null, this.hidden = kr(e, t);
2230 }
2231 function Rt(e, t, n) {
2232 for (var r, i = [], o = t; n > o; o = r) {
2233 var a = new Pt(e.doc, Zr(e.doc, o), o);
2234 r = o + a.size, i.push(a);
2235 }
2236 return i;
2237 }
2238 function Dt(e, t, n, r) {
2239 null == t && (t = e.doc.first), null == n && (n = e.doc.first + e.doc.size), r || (r = 0);
2240 var i = e.display;
2241 if (r && n < i.viewTo && (null == i.updateLineNumbers || i.updateLineNumbers > t) && (i.updateLineNumbers = t),
2242 e.curOp.viewChanged = !0, t >= i.viewTo) Wo && br(e.doc, t) < i.viewTo && Wt(e); else if (n <= i.viewFrom) Wo && wr(e.doc, n + r) > i.viewFrom ? Wt(e) : (i.viewFrom += r,
2243 i.viewTo += r); else if (t <= i.viewFrom && n >= i.viewTo) Wt(e); else if (t <= i.viewFrom) (o = _t(e, n, n + r, 1)) ? (i.view = i.view.slice(o.index),
2244 i.viewFrom = o.lineN, i.viewTo += r) : Wt(e); else if (n >= i.viewTo) {
2245 var o;
2246 (o = _t(e, t, t, -1)) ? (i.view = i.view.slice(0, o.index), i.viewTo = o.lineN) : Wt(e);
2247 } else {
2248 var a = _t(e, t, t, -1), l = _t(e, n, n + r, 1);
2249 a && l ? (i.view = i.view.slice(0, a.index).concat(Rt(e, a.lineN, l.lineN)).concat(i.view.slice(l.index)),
2250 i.viewTo += r) : Wt(e);
2251 }
2252 var s = i.externalMeasured;
2253 s && (n < s.lineN ? s.lineN += r : t < s.lineN + s.size && (i.externalMeasured = null));
2254 }
2255 function Ht(e, t, n) {
2256 e.curOp.viewChanged = !0;
2257 var r = e.display, i = e.display.externalMeasured;
2258 if (i && t >= i.lineN && t < i.lineN + i.size && (r.externalMeasured = null), !(t < r.viewFrom || t >= r.viewTo)) {
2259 var o = r.view[Bt(e, t)];
2260 if (null != o.node) {
2261 var a = o.changes || (o.changes = []);
2262 -1 == Pi(a, n) && a.push(n);
2263 }
2264 }
2265 }
2266 function Wt(e) {
2267 e.display.viewFrom = e.display.viewTo = e.doc.first, e.display.view = [], e.display.viewOffset = 0;
2268 }
2269 function Bt(e, t) {
2270 if (t >= e.display.viewTo) return null;
2271 if (0 > (t -= e.display.viewFrom)) return null;
2272 for (var n = e.display.view, r = 0; r < n.length; r++) if (0 > (t -= n[r].size)) return r;
2273 }
2274 function _t(e, t, n, r) {
2275 var i, o = Bt(e, t), a = e.display.view;
2276 if (!Wo || n == e.doc.first + e.doc.size) return {
2277 index: o,
2278 lineN: n
2279 };
2280 for (var l = 0, s = e.display.viewFrom; o > l; l++) s += a[l].size;
2281 if (s != t) {
2282 if (r > 0) {
2283 if (o == a.length - 1) return null;
2284 i = s + a[o].size - t, o++;
2285 } else i = s - t;
2286 t += i, n += i;
2287 }
2288 for (;br(e.doc, n) != n; ) {
2289 if (o == (0 > r ? 0 : a.length - 1)) return null;
2290 n += r * a[o - (0 > r ? 1 : 0)].size, o += r;
2291 }
2292 return {
2293 index: o,
2294 lineN: n
2295 };
2296 }
2297 function Ft(e, t, n) {
2298 var r = e.display;
2299 0 == r.view.length || t >= r.viewTo || n <= r.viewFrom ? (r.view = Rt(e, t, n),
2300 r.viewFrom = t) : (r.viewFrom > t ? r.view = Rt(e, t, r.viewFrom).concat(r.view) : r.viewFrom < t && (r.view = r.view.slice(Bt(e, t))),
2301 r.viewFrom = t, r.viewTo < n ? r.view = r.view.concat(Rt(e, r.viewTo, n)) : r.viewTo > n && (r.view = r.view.slice(0, Bt(e, n)))),
2302 r.viewTo = n;
2303 }
2304 function zt(e) {
2305 for (var t = e.display.view, n = 0, r = 0; r < t.length; r++) {
2306 var i = t[r];
2307 i.hidden || i.node && !i.changes || ++n;
2308 }
2309 return n;
2310 }
2311 function jt(e) {
2312 function t() {
2313 i.activeTouch && (o = setTimeout((function() {
2314 i.activeTouch = null;
2315 }), 1e3), (a = i.activeTouch).end = +new Date);
2316 }
2317 function n(e) {
2318 if (1 != e.touches.length) return !1;
2319 var t = e.touches[0];
2320 return t.radiusX <= 1 && t.radiusY <= 1;
2321 }
2322 function r(e, t) {
2323 if (null == t.left) return !0;
2324 var n = t.left - e.left, r = t.top - e.top;
2325 return n * n + r * r > 400;
2326 }
2327 var i = e.display;
2328 Ea(i.scroller, "mousedown", Et(e, $t)), Ea(i.scroller, "dblclick", xo && 11 > bo ? Et(e, (function(t) {
2329 if (!Ti(e, t)) {
2330 var n = Yt(e, t);
2331 if (n && !Jt(e, t) && !Gt(e.display, t)) {
2332 Ma(t);
2333 var r = e.findWordAt(n);
2334 be(e.doc, r.anchor, r.head);
2335 }
2336 }
2337 })) : function(t) {
2338 Ti(e, t) || Ma(t);
2339 }), Do || Ea(i.scroller, "contextmenu", (function(t) {
2340 xn(e, t);
2341 }));
2342 var o, a = {
2343 end: 0
2344 };
2345 Ea(i.scroller, "touchstart", (function(t) {
2346 if (!Ti(e, t) && !n(t)) {
2347 clearTimeout(o);
2348 var r = +new Date;
2349 i.activeTouch = {
2350 start: r,
2351 moved: !1,
2352 prev: r - a.end <= 300 ? a : null
2353 }, 1 == t.touches.length && (i.activeTouch.left = t.touches[0].pageX, i.activeTouch.top = t.touches[0].pageY);
2354 }
2355 })), Ea(i.scroller, "touchmove", (function() {
2356 i.activeTouch && (i.activeTouch.moved = !0);
2357 })), Ea(i.scroller, "touchend", (function(n) {
2358 var o = i.activeTouch;
2359 if (o && !Gt(i, n) && null != o.left && !o.moved && new Date - o.start < 300) {
2360 var a, l = e.coordsChar(i.activeTouch, "page");
2361 a = !o.prev || r(o, o.prev) ? new fe(l, l) : !o.prev.prev || r(o, o.prev.prev) ? e.findWordAt(l) : new fe(Bo(l.line, 0), me(e.doc, Bo(l.line + 1, 0))),
2362 e.setSelection(a.anchor, a.head), e.focus(), Ma(n);
2363 }
2364 t();
2365 })), Ea(i.scroller, "touchcancel", t), Ea(i.scroller, "scroll", (function() {
2366 i.scroller.clientHeight && (rn(e, i.scroller.scrollTop), on(e, i.scroller.scrollLeft, !0),
2367 Pa(e, "scroll", e));
2368 })), Ea(i.scroller, "mousewheel", (function(t) {
2369 an(e, t);
2370 })), Ea(i.scroller, "DOMMouseScroll", (function(t) {
2371 an(e, t);
2372 })), Ea(i.wrapper, "scroll", (function() {
2373 i.wrapper.scrollTop = i.wrapper.scrollLeft = 0;
2374 })), i.dragFunctions = {
2375 enter: function(t) {
2376 Ti(e, t) || Aa(t);
2377 },
2378 over: function(t) {
2379 Ti(e, t) || (tn(e, t), Aa(t));
2380 },
2381 start: function(t) {
2382 en(e, t);
2383 },
2384 drop: Et(e, Qt),
2385 leave: function(t) {
2386 Ti(e, t) || nn(e);
2387 }
2388 };
2389 var l = i.input.getField();
2390 Ea(l, "keyup", (function(t) {
2391 pn.call(e, t);
2392 })), Ea(l, "keydown", Et(e, hn)), Ea(l, "keypress", Et(e, mn)), Ea(l, "focus", Bi(vn, e)),
2393 Ea(l, "blur", Bi(yn, e));
2394 }
2395 function Ut(t, n, r) {
2396 if (!n != !(r && r != e.Init)) {
2397 var o = t.display.dragFunctions, a = n ? Ea : Ia;
2398 a(t.display.scroller, "dragstart", o.start), a(t.display.scroller, "dragenter", o.enter),
2399 a(t.display.scroller, "dragover", o.over), a(t.display.scroller, "dragleave", o.leave),
2400 a(t.display.scroller, "drop", o.drop);
2401 }
2402 }
2403 function qt(e) {
2404 var t = e.display;
2405 t.lastWrapHeight == t.wrapper.clientHeight && t.lastWrapWidth == t.wrapper.clientWidth || (t.cachedCharWidth = t.cachedTextHeight = t.cachedPaddingH = null,
2406 t.scrollbarsClipped = !1, e.setSize());
2407 }
2408 function Gt(e, t) {
2409 for (var n = wi(t); n != e.wrapper; n = n.parentNode) if (!n || 1 == n.nodeType && "true" == n.getAttribute("cm-ignore-events") || n.parentNode == e.sizer && n != e.mover) return !0;
2410 }
2411 function Yt(e, t, n, r) {
2412 var i = e.display;
2413 if (!n && "true" == wi(t).getAttribute("cm-not-content")) return null;
2414 var o, a, l = i.lineSpace.getBoundingClientRect();
2415 try {
2416 o = t.clientX - l.left, a = t.clientY - l.top;
2417 } catch (t) {
2418 return null;
2419 }
2420 var s, c = gt(e, o, a);
2421 if (r && 1 == c.xRel && (s = Zr(e.doc, c.line).text).length == c.ch) {
2422 var u = Fa(s, s.length, e.options.tabSize) - s.length;
2423 c = Bo(c.line, Math.max(0, Math.round((o - Ge(e.display).left) / xt(e.display)) - u));
2424 }
2425 return c;
2426 }
2427 function $t(e) {
2428 var t = this, n = t.display;
2429 if (!(Ti(t, e) || n.activeTouch && n.input.supportsTouch())) {
2430 if (n.shift = e.shiftKey, Gt(n, e)) return void (wo || (n.scroller.draggable = !1,
2431 setTimeout((function() {
2432 n.scroller.draggable = !0;
2433 }), 100)));
2434 if (!Jt(t, e)) {
2435 var r = Yt(t, e);
2436 switch (window.focus(), ki(e)) {
2437 case 1:
2438 t.state.selectingText ? t.state.selectingText(e) : r ? Vt(t, e, r) : wi(e) == n.scroller && Ma(e);
2439 break;
2440
2441 case 2:
2442 wo && (t.state.lastMiddleDown = +new Date), r && be(t.doc, r), setTimeout((function() {
2443 n.input.focus();
2444 }), 20), Ma(e);
2445 break;
2446
2447 case 3:
2448 Do ? xn(t, e) : gn(t);
2449 }
2450 }
2451 }
2452 }
2453 function Vt(e, t, n) {
2454 xo ? setTimeout(Bi(X, e), 0) : e.curOp.focus = Gi();
2455 var r, i = +new Date;
2456 Uo && Uo.time > i - 400 && 0 == _o(Uo.pos, n) ? r = "triple" : jo && jo.time > i - 400 && 0 == _o(jo.pos, n) ? (r = "double",
2457 Uo = {
2458 time: i,
2459 pos: n
2460 }) : (r = "single", jo = {
2461 time: i,
2462 pos: n
2463 });
2464 var o, a = e.doc.sel, l = Eo ? t.metaKey : t.ctrlKey;
2465 e.options.dragDrop && el && !e.isReadOnly() && "single" == r && (o = a.contains(n)) > -1 && (_o((o = a.ranges[o]).from(), n) < 0 || n.xRel > 0) && (_o(o.to(), n) > 0 || n.xRel < 0) ? Kt(e, t, n, l) : Xt(e, t, n, r, l);
2466 }
2467 function Kt(e, t, n, r) {
2468 var i = e.display, o = +new Date, a = Et(e, (function(l) {
2469 wo && (i.scroller.draggable = !1), e.state.draggingText = !1, Ia(document, "mouseup", a),
2470 Ia(i.scroller, "drop", a), Math.abs(t.clientX - l.clientX) + Math.abs(t.clientY - l.clientY) < 10 && (Ma(l),
2471 !r && +new Date - 200 < o && be(e.doc, n), wo || xo && 9 == bo ? setTimeout((function() {
2472 document.body.focus(), i.input.focus();
2473 }), 20) : i.input.focus());
2474 }));
2475 wo && (i.scroller.draggable = !0), e.state.draggingText = a, i.scroller.dragDrop && i.scroller.dragDrop(),
2476 Ea(document, "mouseup", a), Ea(i.scroller, "drop", a);
2477 }
2478 function Xt(e, t, n, r, i) {
2479 function o(t) {
2480 if (0 != _o(g, t)) if (g = t, "rect" == r) {
2481 for (var i = [], o = e.options.tabSize, a = Fa(Zr(c, n.line).text, n.ch, o), l = Fa(Zr(c, t.line).text, t.ch, o), s = Math.min(a, l), d = Math.max(a, l), p = Math.min(n.line, t.line), m = Math.min(e.lastLine(), Math.max(n.line, t.line)); m >= p; p++) {
2482 var v = Zr(c, p).text, y = za(v, s, o);
2483 s == d ? i.push(new fe(Bo(p, y), Bo(p, y))) : v.length > y && i.push(new fe(Bo(p, y), Bo(p, za(v, d, o))));
2484 }
2485 i.length || i.push(new fe(n, n)), Te(c, he(h.ranges.slice(0, f).concat(i), f), {
2486 origin: "*mouse",
2487 scroll: !1
2488 }), e.scrollIntoView(t);
2489 } else {
2490 var x = u, b = x.anchor, w = t;
2491 if ("single" != r) {
2492 if ("double" == r) var k = e.findWordAt(t); else k = new fe(Bo(t.line, 0), me(c, Bo(t.line + 1, 0)));
2493 _o(k.anchor, b) > 0 ? (w = k.head, b = K(x.from(), k.anchor)) : (w = k.anchor, b = V(x.to(), k.head));
2494 }
2495 (i = h.ranges.slice(0))[f] = new fe(me(c, b), w), Te(c, he(i, f), Ba);
2496 }
2497 }
2498 function a(t) {
2499 var n = ++y, i = Yt(e, t, !0, "rect" == r);
2500 if (i) if (0 != _o(i, g)) {
2501 e.curOp.focus = Gi(), o(i);
2502 var l = b(s, c);
2503 (i.line >= l.to || i.line < l.from) && setTimeout(Et(e, (function() {
2504 y == n && a(t);
2505 })), 150);
2506 } else {
2507 var u = t.clientY < v.top ? -20 : t.clientY > v.bottom ? 20 : 0;
2508 u && setTimeout(Et(e, (function() {
2509 y == n && (s.scroller.scrollTop += u, a(t));
2510 })), 50);
2511 }
2512 }
2513 function l(t) {
2514 e.state.selectingText = !1, y = 1 / 0, Ma(t), s.input.focus(), Ia(document, "mousemove", x),
2515 Ia(document, "mouseup", w), c.history.lastSelOrigin = null;
2516 }
2517 var s = e.display, c = e.doc;
2518 Ma(t);
2519 var u, f, h = c.sel, d = h.ranges;
2520 if (i && !t.shiftKey ? (f = c.sel.contains(n), u = f > -1 ? d[f] : new fe(n, n)) : (u = c.sel.primary(),
2521 f = c.sel.primIndex), Oo ? t.shiftKey && t.metaKey : t.altKey) r = "rect", i || (u = new fe(n, n)),
2522 n = Yt(e, t, !0, !0), f = -1; else if ("double" == r) {
2523 var p = e.findWordAt(n);
2524 u = e.display.shift || c.extend ? xe(c, u, p.anchor, p.head) : p;
2525 } else if ("triple" == r) {
2526 var m = new fe(Bo(n.line, 0), me(c, Bo(n.line + 1, 0)));
2527 u = e.display.shift || c.extend ? xe(c, u, m.anchor, m.head) : m;
2528 } else u = xe(c, u, n);
2529 i ? -1 == f ? (f = d.length, Te(c, he(d.concat([ u ]), f), {
2530 scroll: !1,
2531 origin: "*mouse"
2532 })) : d.length > 1 && d[f].empty() && "single" == r && !t.shiftKey ? (Te(c, he(d.slice(0, f).concat(d.slice(f + 1)), 0), {
2533 scroll: !1,
2534 origin: "*mouse"
2535 }), h = c.sel) : ke(c, f, u, Ba) : (f = 0, Te(c, new ue([ u ], 0), Ba), h = c.sel);
2536 var g = n, v = s.wrapper.getBoundingClientRect(), y = 0, x = Et(e, (function(e) {
2537 ki(e) ? a(e) : l(e);
2538 })), w = Et(e, l);
2539 e.state.selectingText = w, Ea(document, "mousemove", x), Ea(document, "mouseup", w);
2540 }
2541 function Zt(e, t, n, r) {
2542 try {
2543 var i = t.clientX, o = t.clientY;
2544 } catch (t) {
2545 return !1;
2546 }
2547 if (i >= Math.floor(e.display.gutters.getBoundingClientRect().right)) return !1;
2548 r && Ma(t);
2549 var a = e.display, l = a.lineDiv.getBoundingClientRect();
2550 if (o > l.bottom || !Ni(e, n)) return bi(t);
2551 o -= l.top - a.viewOffset;
2552 for (var s = 0; s < e.options.gutters.length; ++s) {
2553 var c = a.gutters.childNodes[s];
2554 if (c && c.getBoundingClientRect().right >= i) {
2555 var u = ni(e.doc, o), f = e.options.gutters[s];
2556 return Pa(e, n, e, u, f, t), bi(t);
2557 }
2558 }
2559 }
2560 function Jt(e, t) {
2561 return Zt(e, t, "gutterClick", !0);
2562 }
2563 function Qt(e) {
2564 var t = this;
2565 if (nn(t), !Ti(t, e) && !Gt(t.display, e)) {
2566 Ma(e), xo && ($o = +new Date);
2567 var n = Yt(t, e, !0), r = e.dataTransfer.files;
2568 if (n && !t.isReadOnly()) if (r && r.length && window.FileReader && window.File) for (var i = r.length, o = Array(i), a = 0, l = function(e, r) {
2569 if (!t.options.allowDropFileTypes || -1 != Pi(t.options.allowDropFileTypes, e.type)) {
2570 var l = new FileReader;
2571 l.onload = Et(t, (function() {
2572 var e = l.result;
2573 if (/[\x00-\x08\x0e-\x1f]{2}/.test(e) && (e = ""), o[r] = e, ++a == i) {
2574 var s = {
2575 from: n = me(t.doc, n),
2576 to: n,
2577 text: t.doc.splitLines(o.join(t.doc.lineSeparator())),
2578 origin: "paste"
2579 };
2580 Tn(t.doc, s), Le(t.doc, de(n, Qo(s)));
2581 }
2582 })), l.readAsText(e);
2583 }
2584 }, s = 0; i > s; ++s) l(r[s], s); else {
2585 if (t.state.draggingText && t.doc.sel.contains(n) > -1) return t.state.draggingText(e),
2586 void setTimeout((function() {
2587 t.display.input.focus();
2588 }), 20);
2589 try {
2590 if (o = e.dataTransfer.getData("Text")) {
2591 if (t.state.draggingText && !(Eo ? e.altKey : e.ctrlKey)) var c = t.listSelections();
2592 if (Me(t.doc, de(n, n)), c) for (s = 0; s < c.length; ++s) In(t.doc, "", c[s].anchor, c[s].head, "drag");
2593 t.replaceSelection(o, "around", "paste"), t.display.input.focus();
2594 }
2595 } catch (e) {}
2596 }
2597 }
2598 }
2599 function en(e, t) {
2600 if (xo && (!e.state.draggingText || +new Date - $o < 100)) Aa(t); else if (!Ti(e, t) && !Gt(e.display, t) && (t.dataTransfer.setData("Text", e.getSelection()),
2601 t.dataTransfer.effectAllowed = "copyMove", t.dataTransfer.setDragImage && !Lo)) {
2602 var n = ji("img", null, null, "position: fixed; left: 0; top: 0;");
2603 n.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
2604 Co && (n.width = n.height = 1, e.display.wrapper.appendChild(n), n._top = n.offsetTop),
2605 t.dataTransfer.setDragImage(n, 0, 0), Co && n.parentNode.removeChild(n);
2606 }
2607 }
2608 function tn(e, t) {
2609 var n = Yt(e, t);
2610 if (n) {
2611 var r = document.createDocumentFragment();
2612 He(e, n, r), e.display.dragCursor || (e.display.dragCursor = ji("div", null, "CodeMirror-cursors CodeMirror-dragcursors"),
2613 e.display.lineSpace.insertBefore(e.display.dragCursor, e.display.cursorDiv)), qi(e.display.dragCursor, r);
2614 }
2615 }
2616 function nn(e) {
2617 e.display.dragCursor && (e.display.lineSpace.removeChild(e.display.dragCursor),
2618 e.display.dragCursor = null);
2619 }
2620 function rn(e, t) {
2621 Math.abs(e.doc.scrollTop - t) < 2 || (e.doc.scrollTop = t, go || A(e, {
2622 top: t
2623 }), e.display.scroller.scrollTop != t && (e.display.scroller.scrollTop = t), e.display.scrollbars.setScrollTop(t),
2624 go && A(e), _e(e, 100));
2625 }
2626 function on(e, t, n) {
2627 (n ? t == e.doc.scrollLeft : Math.abs(e.doc.scrollLeft - t) < 2) || (t = Math.min(t, e.display.scroller.scrollWidth - e.display.scroller.clientWidth),
2628 e.doc.scrollLeft = t, w(e), e.display.scroller.scrollLeft != t && (e.display.scroller.scrollLeft = t),
2629 e.display.scrollbars.setScrollLeft(t));
2630 }
2631 function an(e, t) {
2632 var n = Xo(t), r = n.x, i = n.y, o = e.display, a = o.scroller, l = a.scrollWidth > a.clientWidth, s = a.scrollHeight > a.clientHeight;
2633 if (r && l || i && s) {
2634 if (i && Eo && wo) e: for (var c = t.target, u = o.view; c != a; c = c.parentNode) for (var f = 0; f < u.length; f++) if (u[f].node == c) {
2635 e.display.currentWheelTarget = c;
2636 break e;
2637 }
2638 if (r && !go && !Co && null != Ko) return i && s && rn(e, Math.max(0, Math.min(a.scrollTop + i * Ko, a.scrollHeight - a.clientHeight))),
2639 on(e, Math.max(0, Math.min(a.scrollLeft + r * Ko, a.scrollWidth - a.clientWidth))),
2640 (!i || i && s) && Ma(t), void (o.wheelStartX = null);
2641 if (i && null != Ko) {
2642 var h = i * Ko, d = e.doc.scrollTop, p = d + o.wrapper.clientHeight;
2643 0 > h ? d = Math.max(0, d + h - 50) : p = Math.min(e.doc.height, p + h + 50), A(e, {
2644 top: d,
2645 bottom: p
2646 });
2647 }
2648 20 > Vo && (null == o.wheelStartX ? (o.wheelStartX = a.scrollLeft, o.wheelStartY = a.scrollTop,
2649 o.wheelDX = r, o.wheelDY = i, setTimeout((function() {
2650 if (null != o.wheelStartX) {
2651 var e = a.scrollLeft - o.wheelStartX, t = a.scrollTop - o.wheelStartY, n = t && o.wheelDY && t / o.wheelDY || e && o.wheelDX && e / o.wheelDX;
2652 o.wheelStartX = o.wheelStartY = null, n && (Ko = (Ko * Vo + n) / (Vo + 1), ++Vo);
2653 }
2654 }), 200)) : (o.wheelDX += r, o.wheelDY += i));
2655 }
2656 }
2657 function ln(e, t, n) {
2658 if ("string" == typeof t && !(t = ua[t])) return !1;
2659 e.display.input.ensurePolled();
2660 var r = e.display.shift, i = !1;
2661 try {
2662 e.isReadOnly() && (e.state.suppressEdits = !0), n && (e.display.shift = !1), i = t(e) != Ha;
2663 } finally {
2664 e.display.shift = r, e.state.suppressEdits = !1;
2665 }
2666 return i;
2667 }
2668 function sn(e, t, n) {
2669 for (var r = 0; r < e.state.keyMaps.length; r++) {
2670 var i = ha(t, e.state.keyMaps[r], n, e);
2671 if (i) return i;
2672 }
2673 return e.options.extraKeys && ha(t, e.options.extraKeys, n, e) || ha(t, e.options.keyMap, n, e);
2674 }
2675 function cn(e, t, n, r) {
2676 var i = e.state.keySeq;
2677 if (i) {
2678 if (da(t)) return "handled";
2679 Zo.set(50, (function() {
2680 e.state.keySeq == i && (e.state.keySeq = null, e.display.input.reset());
2681 })), t = i + " " + t;
2682 }
2683 var o = sn(e, t, r);
2684 return "multi" == o && (e.state.keySeq = t), "handled" == o && Ci(e, "keyHandled", e, t, n),
2685 "handled" != o && "multi" != o || (Ma(n), Be(e)), i && !o && /\'$/.test(t) ? (Ma(n),
2686 !0) : !!o;
2687 }
2688 function un(e, t) {
2689 var n = pa(t, !0);
2690 return !!n && (t.shiftKey && !e.state.keySeq ? cn(e, "Shift-" + n, t, (function(t) {
2691 return ln(e, t, !0);
2692 })) || cn(e, n, t, (function(t) {
2693 return ("string" == typeof t ? /^go[A-Z]/.test(t) : t.motion) ? ln(e, t) : void 0;
2694 })) : cn(e, n, t, (function(t) {
2695 return ln(e, t);
2696 })));
2697 }
2698 function fn(e, t, n) {
2699 return cn(e, "'" + n + "'", t, (function(t) {
2700 return ln(e, t, !0);
2701 }));
2702 }
2703 function hn(e) {
2704 var t = this;
2705 if (t.curOp.focus = Gi(), !Ti(t, e)) {
2706 xo && 11 > bo && 27 == e.keyCode && (e.returnValue = !1);
2707 var n = e.keyCode;
2708 t.display.shift = 16 == n || e.shiftKey;
2709 var r = un(t, e);
2710 Co && (Jo = r ? n : null, !r && 88 == n && !rl && (Eo ? e.metaKey : e.ctrlKey) && t.replaceSelection("", null, "cut")),
2711 18 != n || /\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className) || dn(t);
2712 }
2713 }
2714 function dn(e) {
2715 function t(e) {
2716 18 != e.keyCode && e.altKey || (Za(n, "CodeMirror-crosshair"), Ia(document, "keyup", t),
2717 Ia(document, "mouseover", t));
2718 }
2719 var n = e.display.lineDiv;
2720 Ja(n, "CodeMirror-crosshair"), Ea(document, "keyup", t), Ea(document, "mouseover", t);
2721 }
2722 function pn(e) {
2723 16 == e.keyCode && (this.doc.sel.shift = !1), Ti(this, e);
2724 }
2725 function mn(e) {
2726 var t = this;
2727 if (!(Gt(t.display, e) || Ti(t, e) || e.ctrlKey && !e.altKey || Eo && e.metaKey)) {
2728 var n = e.keyCode, r = e.charCode;
2729 if (Co && n == Jo) return Jo = null, void Ma(e);
2730 Co && (!e.which || e.which < 10) && un(t, e) || fn(t, e, String.fromCharCode(null == r ? n : r)) || t.display.input.onKeyPress(e);
2731 }
2732 }
2733 function gn(e) {
2734 e.state.delayingBlurEvent = !0, setTimeout((function() {
2735 e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1, yn(e));
2736 }), 100);
2737 }
2738 function vn(e) {
2739 e.state.delayingBlurEvent && (e.state.delayingBlurEvent = !1), "nocursor" != e.options.readOnly && (e.state.focused || (Pa(e, "focus", e),
2740 e.state.focused = !0, Ja(e.display.wrapper, "CodeMirror-focused"), e.curOp || e.display.selForContextMenu == e.doc.sel || (e.display.input.reset(),
2741 wo && setTimeout((function() {
2742 e.display.input.reset(!0);
2743 }), 20)), e.display.input.receivedFocus()), Be(e));
2744 }
2745 function yn(e) {
2746 e.state.delayingBlurEvent || (e.state.focused && (Pa(e, "blur", e), e.state.focused = !1,
2747 Za(e.display.wrapper, "CodeMirror-focused")), clearInterval(e.display.blinker),
2748 setTimeout((function() {
2749 e.state.focused || (e.display.shift = !1);
2750 }), 150));
2751 }
2752 function xn(e, t) {
2753 Gt(e.display, t) || bn(e, t) || Ti(e, t, "contextmenu") || e.display.input.onContextMenu(t);
2754 }
2755 function bn(e, t) {
2756 return !!Ni(e, "gutterContextMenu") && Zt(e, t, "gutterContextMenu", !1);
2757 }
2758 function wn(e, t) {
2759 if (_o(e, t.from) < 0) return e;
2760 if (_o(e, t.to) <= 0) return Qo(t);
2761 var n = e.line + t.text.length - (t.to.line - t.from.line) - 1, r = e.ch;
2762 return e.line == t.to.line && (r += Qo(t).ch - t.to.ch), Bo(n, r);
2763 }
2764 function kn(e, t) {
2765 for (var n = [], r = 0; r < e.sel.ranges.length; r++) {
2766 var i = e.sel.ranges[r];
2767 n.push(new fe(wn(i.anchor, t), wn(i.head, t)));
2768 }
2769 return he(n, e.sel.primIndex);
2770 }
2771 function Sn(e, t, n) {
2772 return e.line == t.line ? Bo(n.line, e.ch - t.ch + n.ch) : Bo(n.line + (e.line - t.line), e.ch);
2773 }
2774 function Cn(e, t, n) {
2775 for (var r = [], i = Bo(e.first, 0), o = i, a = 0; a < t.length; a++) {
2776 var l = t[a], s = Sn(l.from, i, o), c = Sn(Qo(l), i, o);
2777 if (i = l.to, o = c, "around" == n) {
2778 var u = e.sel.ranges[a], f = _o(u.head, u.anchor) < 0;
2779 r[a] = new fe(f ? c : s, f ? s : c);
2780 } else r[a] = new fe(s, s);
2781 }
2782 return new ue(r, e.sel.primIndex);
2783 }
2784 function Ln(e, t, n) {
2785 var r = {
2786 canceled: !1,
2787 from: t.from,
2788 to: t.to,
2789 text: t.text,
2790 origin: t.origin,
2791 cancel: function() {
2792 this.canceled = !0;
2793 }
2794 };
2795 return n && (r.update = function(t, n, r, i) {
2796 t && (this.from = me(e, t)), n && (this.to = me(e, n)), r && (this.text = r), void 0 !== i && (this.origin = i);
2797 }), Pa(e, "beforeChange", e, r), e.cm && Pa(e.cm, "beforeChange", e.cm, r), r.canceled ? null : {
2798 from: r.from,
2799 to: r.to,
2800 text: r.text,
2801 origin: r.origin
2802 };
2803 }
2804 function Tn(e, t, n) {
2805 if (e.cm) {
2806 if (!e.cm.curOp) return Et(e.cm, Tn)(e, t, n);
2807 if (e.cm.state.suppressEdits) return;
2808 }
2809 if (!(Ni(e, "beforeChange") || e.cm && Ni(e.cm, "beforeChange")) || (t = Ln(e, t, !0))) {
2810 var r = Ho && !n && sr(e, t.from, t.to);
2811 if (r) for (var i = r.length - 1; i >= 0; --i) Mn(e, {
2812 from: r[i].from,
2813 to: r[i].to,
2814 text: i ? [ "" ] : t.text
2815 }); else Mn(e, t);
2816 }
2817 }
2818 function Mn(e, t) {
2819 if (1 != t.text.length || "" != t.text[0] || 0 != _o(t.from, t.to)) {
2820 var n = kn(e, t);
2821 ci(e, t, n, e.cm ? e.cm.curOp.id : NaN), En(e, t, n, or(e, t));
2822 var r = [];
2823 Kr(e, (function(e, n) {
2824 n || -1 != Pi(r, e.history) || (xi(e.history, t), r.push(e.history)), En(e, t, null, or(e, t));
2825 }));
2826 }
2827 }
2828 function Nn(e, t, n) {
2829 if (!e.cm || !e.cm.state.suppressEdits) {
2830 for (var r, i = e.history, o = e.sel, a = "undo" == t ? i.done : i.undone, l = "undo" == t ? i.undone : i.done, s = 0; s < a.length && (r = a[s],
2831 n ? !r.ranges || r.equals(e.sel) : r.ranges); s++) ;
2832 if (s != a.length) {
2833 for (i.lastOrigin = i.lastSelOrigin = null; (r = a.pop()).ranges; ) {
2834 if (hi(r, l), n && !r.equals(e.sel)) return void Te(e, r, {
2835 clearRedo: !1
2836 });
2837 o = r;
2838 }
2839 var c = [];
2840 hi(o, l), l.push({
2841 changes: c,
2842 generation: i.generation
2843 }), i.generation = r.generation || ++i.maxGeneration;
2844 var u = Ni(e, "beforeChange") || e.cm && Ni(e.cm, "beforeChange");
2845 for (s = r.changes.length - 1; s >= 0; --s) {
2846 var f = r.changes[s];
2847 if (f.origin = t, u && !Ln(e, f, !1)) return void (a.length = 0);
2848 c.push(ai(e, f));
2849 var h = s ? kn(e, f) : Ii(a);
2850 En(e, f, h, lr(e, f)), !s && e.cm && e.cm.scrollIntoView({
2851 from: f.from,
2852 to: Qo(f)
2853 });
2854 var d = [];
2855 Kr(e, (function(e, t) {
2856 t || -1 != Pi(d, e.history) || (xi(e.history, f), d.push(e.history)), En(e, f, null, lr(e, f));
2857 }));
2858 }
2859 }
2860 }
2861 }
2862 function An(e, t) {
2863 if (0 != t && (e.first += t, e.sel = new ue(Ri(e.sel.ranges, (function(e) {
2864 return new fe(Bo(e.anchor.line + t, e.anchor.ch), Bo(e.head.line + t, e.head.ch));
2865 })), e.sel.primIndex), e.cm)) {
2866 Dt(e.cm, e.first, e.first - t, t);
2867 for (var n = e.cm.display, r = n.viewFrom; r < n.viewTo; r++) Ht(e.cm, r, "gutter");
2868 }
2869 }
2870 function En(e, t, n, r) {
2871 if (e.cm && !e.cm.curOp) return Et(e.cm, En)(e, t, n, r);
2872 if (t.to.line < e.first) An(e, t.text.length - 1 - (t.to.line - t.from.line)); else if (!(t.from.line > e.lastLine())) {
2873 if (t.from.line < e.first) {
2874 var i = t.text.length - 1 - (e.first - t.from.line);
2875 An(e, i), t = {
2876 from: Bo(e.first, 0),
2877 to: Bo(t.to.line + i, t.to.ch),
2878 text: [ Ii(t.text) ],
2879 origin: t.origin
2880 };
2881 }
2882 var o = e.lastLine();
2883 t.to.line > o && (t = {
2884 from: t.from,
2885 to: Bo(o, Zr(e, o).text.length),
2886 text: [ t.text[0] ],
2887 origin: t.origin
2888 }), t.removed = Jr(e, t.from, t.to), n || (n = kn(e, t)), e.cm ? On(e.cm, t, r) : Yr(e, t, r),
2889 Me(e, n, Wa);
2890 }
2891 }
2892 function On(e, t, n) {
2893 var r = e.doc, i = e.display, a = t.from, l = t.to, s = !1, c = a.line;
2894 e.options.lineWrapping || (c = ti(yr(Zr(r, a.line))), r.iter(c, l.line + 1, (function(e) {
2895 return e == i.maxLine ? (s = !0, !0) : void 0;
2896 }))), r.sel.contains(t.from, t.to) > -1 && Mi(e), Yr(r, t, n, o(e)), e.options.lineWrapping || (r.iter(c, a.line + t.text.length, (function(e) {
2897 var t = f(e);
2898 t > i.maxLineLength && (i.maxLine = e, i.maxLineLength = t, i.maxLineChanged = !0,
2899 s = !1);
2900 })), s && (e.curOp.updateMaxLine = !0)), r.frontier = Math.min(r.frontier, a.line),
2901 _e(e, 400);
2902 var u = t.text.length - (l.line - a.line) - 1;
2903 t.full ? Dt(e) : a.line != l.line || 1 != t.text.length || Gr(e.doc, t) ? Dt(e, a.line, l.line + 1, u) : Ht(e, a.line, "text");
2904 var h = Ni(e, "changes"), d = Ni(e, "change");
2905 if (d || h) {
2906 var p = {
2907 from: a,
2908 to: l,
2909 text: t.text,
2910 removed: t.removed,
2911 origin: t.origin
2912 };
2913 d && Ci(e, "change", e, p), h && (e.curOp.changeObjs || (e.curOp.changeObjs = [])).push(p);
2914 }
2915 e.display.selForContextMenu = null;
2916 }
2917 function In(e, t, n, r, i) {
2918 if (r || (r = n), _o(r, n) < 0) {
2919 var o = r;
2920 r = n, n = o;
2921 }
2922 "string" == typeof t && (t = e.splitLines(t)), Tn(e, {
2923 from: n,
2924 to: r,
2925 text: t,
2926 origin: i
2927 });
2928 }
2929 function Pn(e, t) {
2930 if (!Ti(e, "scrollCursorIntoView")) {
2931 var n = e.display, r = n.sizer.getBoundingClientRect(), i = null;
2932 if (t.top + r.top < 0 ? i = !0 : t.bottom + r.top > (window.innerHeight || document.documentElement.clientHeight) && (i = !1),
2933 null != i && !Mo) {
2934 var o = ji("div", "​", null, "position: absolute; top: " + (t.top - n.viewOffset - Ue(e.display)) + "px; height: " + (t.bottom - t.top + Ye(e) + n.barHeight) + "px; left: " + t.left + "px; width: 2px;");
2935 e.display.lineSpace.appendChild(o), o.scrollIntoView(i), e.display.lineSpace.removeChild(o);
2936 }
2937 }
2938 }
2939 function Rn(e, t, n, r) {
2940 null == r && (r = 0);
2941 for (var i = 0; 5 > i; i++) {
2942 var o = !1, a = dt(e, t), l = n && n != t ? dt(e, n) : a, s = Hn(e, Math.min(a.left, l.left), Math.min(a.top, l.top) - r, Math.max(a.left, l.left), Math.max(a.bottom, l.bottom) + r), c = e.doc.scrollTop, u = e.doc.scrollLeft;
2943 if (null != s.scrollTop && (rn(e, s.scrollTop), Math.abs(e.doc.scrollTop - c) > 1 && (o = !0)),
2944 null != s.scrollLeft && (on(e, s.scrollLeft), Math.abs(e.doc.scrollLeft - u) > 1 && (o = !0)),
2945 !o) break;
2946 }
2947 return a;
2948 }
2949 function Dn(e, t, n, r, i) {
2950 var o = Hn(e, t, n, r, i);
2951 null != o.scrollTop && rn(e, o.scrollTop), null != o.scrollLeft && on(e, o.scrollLeft);
2952 }
2953 function Hn(e, t, n, r, i) {
2954 var o = e.display, a = yt(e.display);
2955 0 > n && (n = 0);
2956 var l = e.curOp && null != e.curOp.scrollTop ? e.curOp.scrollTop : o.scroller.scrollTop, s = Ve(e), c = {};
2957 i - n > s && (i = n + s);
2958 var u = e.doc.height + qe(o), f = a > n, h = i > u - a;
2959 if (l > n) c.scrollTop = f ? 0 : n; else if (i > l + s) {
2960 var d = Math.min(n, (h ? u : i) - s);
2961 d != l && (c.scrollTop = d);
2962 }
2963 var p = e.curOp && null != e.curOp.scrollLeft ? e.curOp.scrollLeft : o.scroller.scrollLeft, m = $e(e) - (e.options.fixedGutter ? o.gutters.offsetWidth : 0), g = r - t > m;
2964 return g && (r = t + m), 10 > t ? c.scrollLeft = 0 : p > t ? c.scrollLeft = Math.max(0, t - (g ? 0 : 10)) : r > m + p - 3 && (c.scrollLeft = r + (g ? 0 : 10) - m),
2965 c;
2966 }
2967 function Wn(e, t, n) {
2968 null == t && null == n || _n(e), null != t && (e.curOp.scrollLeft = (null == e.curOp.scrollLeft ? e.doc.scrollLeft : e.curOp.scrollLeft) + t),
2969 null != n && (e.curOp.scrollTop = (null == e.curOp.scrollTop ? e.doc.scrollTop : e.curOp.scrollTop) + n);
2970 }
2971 function Bn(e) {
2972 _n(e);
2973 var t = e.getCursor(), n = t, r = t;
2974 e.options.lineWrapping || (n = t.ch ? Bo(t.line, t.ch - 1) : t, r = Bo(t.line, t.ch + 1)),
2975 e.curOp.scrollToPos = {
2976 from: n,
2977 to: r,
2978 margin: e.options.cursorScrollMargin,
2979 isCursor: !0
2980 };
2981 }
2982 function _n(e) {
2983 var t = e.curOp.scrollToPos;
2984 if (t) {
2985 e.curOp.scrollToPos = null;
2986 var n = pt(e, t.from), r = pt(e, t.to), i = Hn(e, Math.min(n.left, r.left), Math.min(n.top, r.top) - t.margin, Math.max(n.right, r.right), Math.max(n.bottom, r.bottom) + t.margin);
2987 e.scrollTo(i.scrollLeft, i.scrollTop);
2988 }
2989 }
2990 function Fn(e, t, n, r) {
2991 var i, o = e.doc;
2992 null == n && (n = "add"), "smart" == n && (o.mode.indent ? i = je(e, t) : n = "prev");
2993 var a = e.options.tabSize, l = Zr(o, t), s = Fa(l.text, null, a);
2994 l.stateAfter && (l.stateAfter = null);
2995 var c, u = l.text.match(/^\s*/)[0];
2996 if (r || /\S/.test(l.text)) {
2997 if ("smart" == n && ((c = o.mode.indent(i, l.text.slice(u.length), l.text)) == Ha || c > 150)) {
2998 if (!r) return;
2999 n = "prev";
3000 }
3001 } else c = 0, n = "not";
3002 "prev" == n ? c = t > o.first ? Fa(Zr(o, t - 1).text, null, a) : 0 : "add" == n ? c = s + e.options.indentUnit : "subtract" == n ? c = s - e.options.indentUnit : "number" == typeof n && (c = s + n),
3003 c = Math.max(0, c);
3004 var f = "", h = 0;
3005 if (e.options.indentWithTabs) for (var d = Math.floor(c / a); d; --d) h += a, f += "\t";
3006 if (c > h && (f += Oi(c - h)), f != u) return In(o, f, Bo(t, 0), Bo(t, u.length), "+input"),
3007 l.stateAfter = null, !0;
3008 for (d = 0; d < o.sel.ranges.length; d++) {
3009 var p = o.sel.ranges[d];
3010 if (p.head.line == t && p.head.ch < u.length) {
3011 ke(o, d, new fe(h = Bo(t, u.length), h));
3012 break;
3013 }
3014 }
3015 }
3016 function zn(e, t, n, r) {
3017 var i = t, o = t;
3018 return "number" == typeof t ? o = Zr(e, pe(e, t)) : i = ti(t), null == i ? null : (r(o, i) && e.cm && Ht(e.cm, i, n),
3019 o);
3020 }
3021 function jn(e, t) {
3022 for (var n = e.doc.sel.ranges, r = [], i = 0; i < n.length; i++) {
3023 for (var o = t(n[i]); r.length && _o(o.from, Ii(r).to) <= 0; ) {
3024 var a = r.pop();
3025 if (_o(a.from, o.from) < 0) {
3026 o.from = a.from;
3027 break;
3028 }
3029 }
3030 r.push(o);
3031 }
3032 At(e, (function() {
3033 for (var t = r.length - 1; t >= 0; t--) In(e.doc, "", r[t].from, r[t].to, "+delete");
3034 Bn(e);
3035 }));
3036 }
3037 function Un(e, t, n, r, i) {
3038 function o() {
3039 var t = l + n;
3040 return !(t < e.first || t >= e.first + e.size) && (l = t, u = Zr(e, t));
3041 }
3042 function a(e) {
3043 var t = (i ? fo : ho)(u, s, n, !0);
3044 if (null == t) {
3045 if (e || !o()) return !1;
3046 s = i ? (0 > n ? io : ro)(u) : 0 > n ? u.text.length : 0;
3047 } else s = t;
3048 return !0;
3049 }
3050 var l = t.line, s = t.ch, c = n, u = Zr(e, l);
3051 if ("char" == r) a(); else if ("column" == r) a(!0); else if ("word" == r || "group" == r) for (var f = null, h = "group" == r, d = e.cm && e.cm.getHelper(t, "wordChars"), p = !0; !(0 > n) || a(!p); p = !1) {
3052 var m = u.text.charAt(s) || "\n", g = _i(m, d) ? "w" : h && "\n" == m ? "n" : !h || /\s/.test(m) ? null : "p";
3053 if (!h || p || g || (g = "s"), f && f != g) {
3054 0 > n && (n = 1, a());
3055 break;
3056 }
3057 if (g && (f = g), n > 0 && !a(!p)) break;
3058 }
3059 var v = Ie(e, Bo(l, s), t, c, !0);
3060 return _o(t, v) || (v.hitSide = !0), v;
3061 }
3062 function qn(e, t, n, r) {
3063 var i, o = e.doc, a = t.left;
3064 if ("page" == r) {
3065 var l = Math.min(e.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
3066 i = t.top + n * (l - (0 > n ? 1.5 : .5) * yt(e.display));
3067 } else "line" == r && (i = n > 0 ? t.bottom + 3 : t.top - 3);
3068 for (;;) {
3069 var s = gt(e, a, i);
3070 if (!s.outside) break;
3071 if (0 > n ? 0 >= i : i >= o.height) {
3072 s.hitSide = !0;
3073 break;
3074 }
3075 i += 5 * n;
3076 }
3077 return s;
3078 }
3079 function Gn(t, n, r, i) {
3080 e.defaults[t] = n, r && (ta[t] = i ? function(e, t, n) {
3081 n != na && r(e, t, n);
3082 } : r);
3083 }
3084 function Yn(e) {
3085 for (var t, n, r, i, o = e.split(/-(?!$)/), a = (e = o[o.length - 1], 0); a < o.length - 1; a++) {
3086 var l = o[a];
3087 if (/^(cmd|meta|m)$/i.test(l)) i = !0; else if (/^a(lt)?$/i.test(l)) t = !0; else if (/^(c|ctrl|control)$/i.test(l)) n = !0; else {
3088 if (!/^s(hift)$/i.test(l)) throw new Error("Unrecognized modifier name: " + l);
3089 r = !0;
3090 }
3091 }
3092 return t && (e = "Alt-" + e), n && (e = "Ctrl-" + e), i && (e = "Cmd-" + e), r && (e = "Shift-" + e),
3093 e;
3094 }
3095 function $n(e) {
3096 return "string" == typeof e ? fa[e] : e;
3097 }
3098 function Vn(e, t, n, r, i) {
3099 if (r && r.shared) return Kn(e, t, n, r, i);
3100 if (e.cm && !e.cm.curOp) return Et(e.cm, Vn)(e, t, n, r, i);
3101 var o = new va(e, i), a = _o(t, n);
3102 if (r && Wi(r, o, !1), a > 0 || 0 == a && !1 !== o.clearWhenEmpty) return o;
3103 if (o.replacedWith && (o.collapsed = !0, o.widgetNode = ji("span", [ o.replacedWith ], "CodeMirror-widget"),
3104 r.handleMouseEvents || o.widgetNode.setAttribute("cm-ignore-events", "true"), r.insertLeft && (o.widgetNode.insertLeft = !0)),
3105 o.collapsed) {
3106 if (vr(e, t.line, t, n, o) || t.line != n.line && vr(e, n.line, t, n, o)) throw new Error("Inserting collapsed marker partially overlapping an existing one");
3107 Wo = !0;
3108 }
3109 o.addToHistory && ci(e, {
3110 from: t,
3111 to: n,
3112 origin: "markText"
3113 }, e.sel, NaN);
3114 var l, s = t.line, c = e.cm;
3115 if (e.iter(s, n.line + 1, (function(e) {
3116 c && o.collapsed && !c.options.lineWrapping && yr(e) == c.display.maxLine && (l = !0),
3117 o.collapsed && s != t.line && ei(e, 0), nr(e, new Qn(o, s == t.line ? t.ch : null, s == n.line ? n.ch : null)),
3118 ++s;
3119 })), o.collapsed && e.iter(t.line, n.line + 1, (function(t) {
3120 kr(e, t) && ei(t, 0);
3121 })), o.clearOnEnter && Ea(o, "beforeCursorEnter", (function() {
3122 o.clear();
3123 })), o.readOnly && (Ho = !0, (e.history.done.length || e.history.undone.length) && e.clearHistory()),
3124 o.collapsed && (o.id = ++ga, o.atomic = !0), c) {
3125 if (l && (c.curOp.updateMaxLine = !0), o.collapsed) Dt(c, t.line, n.line + 1); else if (o.className || o.title || o.startStyle || o.endStyle || o.css) for (var u = t.line; u <= n.line; u++) Ht(c, u, "text");
3126 o.atomic && Ae(c.doc), Ci(c, "markerAdded", c, o);
3127 }
3128 return o;
3129 }
3130 function Kn(e, t, n, r, i) {
3131 (r = Wi(r)).shared = !1;
3132 var o = [ Vn(e, t, n, r, i) ], a = o[0], l = r.widgetNode;
3133 return Kr(e, (function(e) {
3134 l && (r.widgetNode = l.cloneNode(!0)), o.push(Vn(e, me(e, t), me(e, n), r, i));
3135 for (var s = 0; s < e.linked.length; ++s) if (e.linked[s].isParent) return;
3136 a = Ii(o);
3137 })), new ya(o, a);
3138 }
3139 function Xn(e) {
3140 return e.findMarks(Bo(e.first, 0), e.clipPos(Bo(e.lastLine())), (function(e) {
3141 return e.parent;
3142 }));
3143 }
3144 function Zn(e, t) {
3145 for (var n = 0; n < t.length; n++) {
3146 var r = t[n], i = r.find(), o = e.clipPos(i.from), a = e.clipPos(i.to);
3147 if (_o(o, a)) {
3148 var l = Vn(e, o, a, r.primary, r.primary.type);
3149 r.markers.push(l), l.parent = r;
3150 }
3151 }
3152 }
3153 function Jn(e) {
3154 for (var t = 0; t < e.length; t++) {
3155 var n = e[t], r = [ n.primary.doc ];
3156 Kr(n.primary.doc, (function(e) {
3157 r.push(e);
3158 }));
3159 for (var i = 0; i < n.markers.length; i++) {
3160 var o = n.markers[i];
3161 -1 == Pi(r, o.doc) && (o.parent = null, n.markers.splice(i--, 1));
3162 }
3163 }
3164 }
3165 function Qn(e, t, n) {
3166 this.marker = e, this.from = t, this.to = n;
3167 }
3168 function er(e, t) {
3169 if (e) for (var n = 0; n < e.length; ++n) {
3170 var r = e[n];
3171 if (r.marker == t) return r;
3172 }
3173 }
3174 function tr(e, t) {
3175 for (var n, r = 0; r < e.length; ++r) e[r] != t && (n || (n = [])).push(e[r]);
3176 return n;
3177 }
3178 function nr(e, t) {
3179 e.markedSpans = e.markedSpans ? e.markedSpans.concat([ t ]) : [ t ], t.marker.attachLine(e);
3180 }
3181 function rr(e, t, n) {
3182 if (e) for (var r, i = 0; i < e.length; ++i) {
3183 var o = e[i], a = o.marker;
3184 if (null == o.from || (a.inclusiveLeft ? o.from <= t : o.from < t) || o.from == t && "bookmark" == a.type && (!n || !o.marker.insertLeft)) {
3185 var s = null == o.to || (a.inclusiveRight ? o.to >= t : o.to > t);
3186 (r || (r = [])).push(new Qn(a, o.from, s ? null : o.to));
3187 }
3188 }
3189 return r;
3190 }
3191 function ir(e, t, n) {
3192 if (e) for (var r, i = 0; i < e.length; ++i) {
3193 var o = e[i], a = o.marker;
3194 if (null == o.to || (a.inclusiveRight ? o.to >= t : o.to > t) || o.from == t && "bookmark" == a.type && (!n || o.marker.insertLeft)) {
3195 var s = null == o.from || (a.inclusiveLeft ? o.from <= t : o.from < t);
3196 (r || (r = [])).push(new Qn(a, s ? null : o.from - t, null == o.to ? null : o.to - t));
3197 }
3198 }
3199 return r;
3200 }
3201 function or(e, t) {
3202 if (t.full) return null;
3203 var n = ve(e, t.from.line) && Zr(e, t.from.line).markedSpans, r = ve(e, t.to.line) && Zr(e, t.to.line).markedSpans;
3204 if (!n && !r) return null;
3205 var i = t.from.ch, o = t.to.ch, a = 0 == _o(t.from, t.to), l = rr(n, i, a), s = ir(r, o, a), c = 1 == t.text.length, u = Ii(t.text).length + (c ? i : 0);
3206 if (l) for (var f = 0; f < l.length; ++f) null == (h = l[f]).to && ((d = er(s, h.marker)) ? c && (h.to = null == d.to ? null : d.to + u) : h.to = i);
3207 if (s) for (f = 0; f < s.length; ++f) {
3208 var h, d;
3209 null != (h = s[f]).to && (h.to += u), null == h.from ? (d = er(l, h.marker)) || (h.from = u,
3210 c && (l || (l = [])).push(h)) : (h.from += u, c && (l || (l = [])).push(h));
3211 }
3212 l && (l = ar(l)), s && s != l && (s = ar(s));
3213 var p = [ l ];
3214 if (!c) {
3215 var m, g = t.text.length - 2;
3216 if (g > 0 && l) for (f = 0; f < l.length; ++f) null == l[f].to && (m || (m = [])).push(new Qn(l[f].marker, null, null));
3217 for (f = 0; g > f; ++f) p.push(m);
3218 p.push(s);
3219 }
3220 return p;
3221 }
3222 function ar(e) {
3223 for (var t = 0; t < e.length; ++t) {
3224 var n = e[t];
3225 null != n.from && n.from == n.to && !1 !== n.marker.clearWhenEmpty && e.splice(t--, 1);
3226 }
3227 return e.length ? e : null;
3228 }
3229 function lr(e, t) {
3230 var n = mi(e, t), r = or(e, t);
3231 if (!n) return r;
3232 if (!r) return n;
3233 for (var i = 0; i < n.length; ++i) {
3234 var o = n[i], a = r[i];
3235 if (o && a) e: for (var l = 0; l < a.length; ++l) {
3236 for (var s = a[l], c = 0; c < o.length; ++c) if (o[c].marker == s.marker) continue e;
3237 o.push(s);
3238 } else a && (n[i] = a);
3239 }
3240 return n;
3241 }
3242 function sr(e, t, n) {
3243 var r = null;
3244 if (e.iter(t.line, n.line + 1, (function(e) {
3245 if (e.markedSpans) for (var t = 0; t < e.markedSpans.length; ++t) {
3246 var n = e.markedSpans[t].marker;
3247 !n.readOnly || r && -1 != Pi(r, n) || (r || (r = [])).push(n);
3248 }
3249 })), !r) return null;
3250 for (var i = [ {
3251 from: t,
3252 to: n
3253 } ], o = 0; o < r.length; ++o) for (var a = r[o], l = a.find(0), s = 0; s < i.length; ++s) {
3254 var c = i[s];
3255 if (!(_o(c.to, l.from) < 0 || _o(c.from, l.to) > 0)) {
3256 var u = [ s, 1 ], f = _o(c.from, l.from), h = _o(c.to, l.to);
3257 (0 > f || !a.inclusiveLeft && !f) && u.push({
3258 from: c.from,
3259 to: l.from
3260 }), (h > 0 || !a.inclusiveRight && !h) && u.push({
3261 from: l.to,
3262 to: c.to
3263 }), i.splice.apply(i, u), s += u.length - 1;
3264 }
3265 }
3266 return i;
3267 }
3268 function cr(e) {
3269 var t = e.markedSpans;
3270 if (t) {
3271 for (var n = 0; n < t.length; ++n) t[n].marker.detachLine(e);
3272 e.markedSpans = null;
3273 }
3274 }
3275 function ur(e, t) {
3276 if (t) {
3277 for (var n = 0; n < t.length; ++n) t[n].marker.attachLine(e);
3278 e.markedSpans = t;
3279 }
3280 }
3281 function fr(e) {
3282 return e.inclusiveLeft ? -1 : 0;
3283 }
3284 function hr(e) {
3285 return e.inclusiveRight ? 1 : 0;
3286 }
3287 function dr(e, t) {
3288 var n = e.lines.length - t.lines.length;
3289 if (0 != n) return n;
3290 var r = e.find(), i = t.find(), o = _o(r.from, i.from) || fr(e) - fr(t);
3291 if (o) return -o;
3292 var a = _o(r.to, i.to) || hr(e) - hr(t);
3293 return a || t.id - e.id;
3294 }
3295 function pr(e, t) {
3296 var n, r = Wo && e.markedSpans;
3297 if (r) for (var i, o = 0; o < r.length; ++o) (i = r[o]).marker.collapsed && null == (t ? i.from : i.to) && (!n || dr(n, i.marker) < 0) && (n = i.marker);
3298 return n;
3299 }
3300 function mr(e) {
3301 return pr(e, !0);
3302 }
3303 function gr(e) {
3304 return pr(e, !1);
3305 }
3306 function vr(e, t, n, r, i) {
3307 var o = Zr(e, t), a = Wo && o.markedSpans;
3308 if (a) for (var l = 0; l < a.length; ++l) {
3309 var s = a[l];
3310 if (s.marker.collapsed) {
3311 var c = s.marker.find(0), u = _o(c.from, n) || fr(s.marker) - fr(i), f = _o(c.to, r) || hr(s.marker) - hr(i);
3312 if (!(u >= 0 && 0 >= f || 0 >= u && f >= 0) && (0 >= u && (s.marker.inclusiveRight && i.inclusiveLeft ? _o(c.to, n) >= 0 : _o(c.to, n) > 0) || u >= 0 && (s.marker.inclusiveRight && i.inclusiveLeft ? _o(c.from, r) <= 0 : _o(c.from, r) < 0))) return !0;
3313 }
3314 }
3315 }
3316 function yr(e) {
3317 for (var t; t = mr(e); ) e = t.find(-1, !0).line;
3318 return e;
3319 }
3320 function xr(e) {
3321 for (var t, n; t = gr(e); ) e = t.find(1, !0).line, (n || (n = [])).push(e);
3322 return n;
3323 }
3324 function br(e, t) {
3325 var n = Zr(e, t), r = yr(n);
3326 return n == r ? t : ti(r);
3327 }
3328 function wr(e, t) {
3329 if (t > e.lastLine()) return t;
3330 var n, r = Zr(e, t);
3331 if (!kr(e, r)) return t;
3332 for (;n = gr(r); ) r = n.find(1, !0).line;
3333 return ti(r) + 1;
3334 }
3335 function kr(e, t) {
3336 var n = Wo && t.markedSpans;
3337 if (n) for (var r, i = 0; i < n.length; ++i) if ((r = n[i]).marker.collapsed) {
3338 if (null == r.from) return !0;
3339 if (!r.marker.widgetNode && 0 == r.from && r.marker.inclusiveLeft && Sr(e, t, r)) return !0;
3340 }
3341 }
3342 function Sr(e, t, n) {
3343 if (null == n.to) {
3344 var r = n.marker.find(1, !0);
3345 return Sr(e, r.line, er(r.line.markedSpans, n.marker));
3346 }
3347 if (n.marker.inclusiveRight && n.to == t.text.length) return !0;
3348 for (var i, o = 0; o < t.markedSpans.length; ++o) if ((i = t.markedSpans[o]).marker.collapsed && !i.marker.widgetNode && i.from == n.to && (null == i.to || i.to != n.from) && (i.marker.inclusiveLeft || n.marker.inclusiveRight) && Sr(e, t, i)) return !0;
3349 }
3350 function Cr(e, t, n) {
3351 ri(t) < (e.curOp && e.curOp.scrollTop || e.doc.scrollTop) && Wn(e, null, n);
3352 }
3353 function Lr(e) {
3354 if (null != e.height) return e.height;
3355 var t = e.doc.cm;
3356 if (!t) return 0;
3357 if (!Va(document.body, e.node)) {
3358 var n = "position: relative;";
3359 e.coverGutter && (n += "margin-left: -" + t.display.gutters.offsetWidth + "px;"),
3360 e.noHScroll && (n += "width: " + t.display.wrapper.clientWidth + "px;"), qi(t.display.measure, ji("div", [ e.node ], null, n));
3361 }
3362 return e.height = e.node.parentNode.offsetHeight;
3363 }
3364 function Tr(e, t, n, r) {
3365 var i = new xa(e, n, r), o = e.cm;
3366 return o && i.noHScroll && (o.display.alignWidgets = !0), zn(e, t, "widget", (function(t) {
3367 var n = t.widgets || (t.widgets = []);
3368 if (null == i.insertAt ? n.push(i) : n.splice(Math.min(n.length - 1, Math.max(0, i.insertAt)), 0, i),
3369 i.line = t, o && !kr(e, t)) {
3370 var r = ri(t) < e.scrollTop;
3371 ei(t, t.height + Lr(i)), r && Wn(o, null, i.height), o.curOp.forceUpdate = !0;
3372 }
3373 return !0;
3374 })), i;
3375 }
3376 function Mr(e, t, n, r) {
3377 e.text = t, e.stateAfter && (e.stateAfter = null), e.styles && (e.styles = null),
3378 null != e.order && (e.order = null), cr(e), ur(e, n);
3379 var i = r ? r(e) : 1;
3380 i != e.height && ei(e, i);
3381 }
3382 function Nr(e) {
3383 e.parent = null, cr(e);
3384 }
3385 function Ar(e, t) {
3386 if (e) for (;;) {
3387 var n = e.match(/(?:^|\s+)line-(background-)?(\S+)/);
3388 if (!n) break;
3389 e = e.slice(0, n.index) + e.slice(n.index + n[0].length);
3390 var r = n[1] ? "bgClass" : "textClass";
3391 null == t[r] ? t[r] = n[2] : new RegExp("(?:^|s)" + n[2] + "(?:$|s)").test(t[r]) || (t[r] += " " + n[2]);
3392 }
3393 return e;
3394 }
3395 function Er(t, n) {
3396 if (t.blankLine) return t.blankLine(n);
3397 if (t.innerMode) {
3398 var r = e.innerMode(t, n);
3399 return r.mode.blankLine ? r.mode.blankLine(r.state) : void 0;
3400 }
3401 }
3402 function Or(t, n, r, i) {
3403 for (var o = 0; 10 > o; o++) {
3404 i && (i[0] = e.innerMode(t, r).mode);
3405 var a = t.token(n, r);
3406 if (n.pos > n.start) return a;
3407 }
3408 throw new Error("Mode " + t.name + " failed to advance stream.");
3409 }
3410 function Ir(e, t, n, r) {
3411 function i(e) {
3412 return {
3413 start: f.start,
3414 end: f.pos,
3415 string: f.current(),
3416 type: o || null,
3417 state: e ? sa(a.mode, u) : u
3418 };
3419 }
3420 var o, a = e.doc, l = a.mode;
3421 t = me(a, t);
3422 var s, c = Zr(a, t.line), u = je(e, t.line, n), f = new ma(c.text, e.options.tabSize);
3423 for (r && (s = []); (r || f.pos < t.ch) && !f.eol(); ) f.start = f.pos, o = Or(l, f, u),
3424 r && s.push(i(!0));
3425 return r ? s : i();
3426 }
3427 function Pr(e, t, n, r, i, o, a) {
3428 var l = n.flattenSpans;
3429 null == l && (l = e.options.flattenSpans);
3430 var s, c = 0, u = null, f = new ma(t, e.options.tabSize), h = e.options.addModeClass && [ null ];
3431 for ("" == t && Ar(Er(n, r), o); !f.eol(); ) {
3432 if (f.pos > e.options.maxHighlightLength ? (l = !1, a && Hr(e, t, r, f.pos), f.pos = t.length,
3433 s = null) : s = Ar(Or(n, f, r, h), o), h) {
3434 var d = h[0].name;
3435 d && (s = "m-" + (s ? d + " " + s : d));
3436 }
3437 if (!l || u != s) {
3438 for (;c < f.start; ) i(c = Math.min(f.start, c + 5e4), u);
3439 u = s;
3440 }
3441 f.start = f.pos;
3442 }
3443 for (;c < f.pos; ) {
3444 var p = Math.min(f.pos, c + 5e4);
3445 i(p, u), c = p;
3446 }
3447 }
3448 function Rr(e, t, n, r) {
3449 var i = [ e.state.modeGen ], o = {};
3450 Pr(e, t.text, e.doc.mode, n, (function(e, t) {
3451 i.push(e, t);
3452 }), o, r);
3453 for (var a = 0; a < e.state.overlays.length; ++a) {
3454 var l = e.state.overlays[a], s = 1, c = 0;
3455 Pr(e, t.text, l.mode, !0, (function(e, t) {
3456 for (var n = s; e > c; ) {
3457 var r = i[s];
3458 r > e && i.splice(s, 1, e, i[s + 1], r), s += 2, c = Math.min(e, r);
3459 }
3460 if (t) if (l.opaque) i.splice(n, s - n, e, "cm-overlay " + t), s = n + 2; else for (;s > n; n += 2) {
3461 var o = i[n + 1];
3462 i[n + 1] = (o ? o + " " : "") + "cm-overlay " + t;
3463 }
3464 }), o);
3465 }
3466 return {
3467 styles: i,
3468 classes: o.bgClass || o.textClass ? o : null
3469 };
3470 }
3471 function Dr(e, t, n) {
3472 if (!t.styles || t.styles[0] != e.state.modeGen) {
3473 var r = je(e, ti(t)), i = Rr(e, t, t.text.length > e.options.maxHighlightLength ? sa(e.doc.mode, r) : r);
3474 t.stateAfter = r, t.styles = i.styles, i.classes ? t.styleClasses = i.classes : t.styleClasses && (t.styleClasses = null),
3475 n === e.doc.frontier && e.doc.frontier++;
3476 }
3477 return t.styles;
3478 }
3479 function Hr(e, t, n, r) {
3480 var i = e.doc.mode, o = new ma(t, e.options.tabSize);
3481 for (o.start = o.pos = r || 0, "" == t && Er(i, n); !o.eol(); ) Or(i, o, n), o.start = o.pos;
3482 }
3483 function Wr(e, t) {
3484 if (!e || /^\s*$/.test(e)) return null;
3485 var n = t.addModeClass ? ka : wa;
3486 return n[e] || (n[e] = e.replace(/\S+/g, "cm-$&"));
3487 }
3488 function Br(e, t) {
3489 var n = ji("span", null, null, wo ? "padding-right: .1px" : null), r = {
3490 pre: ji("pre", [ n ], "CodeMirror-line"),
3491 content: n,
3492 col: 0,
3493 pos: 0,
3494 cm: e,
3495 splitSpaces: (xo || wo) && e.getOption("lineWrapping")
3496 };
3497 t.measure = {};
3498 for (var i = 0; i <= (t.rest ? t.rest.length : 0); i++) {
3499 var o, a = i ? t.rest[i - 1] : t.line;
3500 r.pos = 0, r.addToken = Fr, Ji(e.display.measure) && (o = ii(a)) && (r.addToken = jr(r.addToken, o)),
3501 r.map = [], qr(a, r, Dr(e, a, t != e.display.externalMeasured && ti(a))), a.styleClasses && (a.styleClasses.bgClass && (r.bgClass = $i(a.styleClasses.bgClass, r.bgClass || "")),
3502 a.styleClasses.textClass && (r.textClass = $i(a.styleClasses.textClass, r.textClass || ""))),
3503 0 == r.map.length && r.map.push(0, 0, r.content.appendChild(Zi(e.display.measure))),
3504 0 == i ? (t.measure.map = r.map, t.measure.cache = {}) : ((t.measure.maps || (t.measure.maps = [])).push(r.map),
3505 (t.measure.caches || (t.measure.caches = [])).push({}));
3506 }
3507 if (wo) {
3508 var s = r.content.lastChild;
3509 (/\bcm-tab\b/.test(s.className) || s.querySelector && s.querySelector(".cm-tab")) && (r.content.className = "cm-tab-wrap-hack");
3510 }
3511 return Pa(e, "renderLine", e, t.line, r.pre), r.pre.className && (r.textClass = $i(r.pre.className, r.textClass || "")),
3512 r;
3513 }
3514 function _r(e) {
3515 var t = ji("span", "•", "cm-invalidchar");
3516 return t.title = "\\u" + e.charCodeAt(0).toString(16), t.setAttribute("aria-label", t.title),
3517 t;
3518 }
3519 function Fr(e, t, n, r, i, o, a) {
3520 if (t) {
3521 var l = e.splitSpaces ? t.replace(/ {3,}/g, zr) : t, s = e.cm.state.specialChars, c = !1;
3522 if (s.test(t)) for (var u = document.createDocumentFragment(), f = 0; ;) {
3523 s.lastIndex = f;
3524 var h = s.exec(t), d = h ? h.index - f : t.length - f;
3525 if (d) {
3526 var p = document.createTextNode(l.slice(f, f + d));
3527 xo && 9 > bo ? u.appendChild(ji("span", [ p ])) : u.appendChild(p), e.map.push(e.pos, e.pos + d, p),
3528 e.col += d, e.pos += d;
3529 }
3530 if (!h) break;
3531 if (f += d + 1, "\t" == h[0]) {
3532 var m = e.cm.options.tabSize, g = m - e.col % m;
3533 (p = u.appendChild(ji("span", Oi(g), "cm-tab"))).setAttribute("role", "presentation"),
3534 p.setAttribute("cm-text", "\t"), e.col += g;
3535 } else "\r" == h[0] || "\n" == h[0] ? ((p = u.appendChild(ji("span", "\r" == h[0] ? "␍" : "␤", "cm-invalidchar"))).setAttribute("cm-text", h[0]),
3536 e.col += 1) : ((p = e.cm.options.specialCharPlaceholder(h[0])).setAttribute("cm-text", h[0]),
3537 xo && 9 > bo ? u.appendChild(ji("span", [ p ])) : u.appendChild(p), e.col += 1);
3538 e.map.push(e.pos, e.pos + 1, p), e.pos++;
3539 } else e.col += t.length, u = document.createTextNode(l), e.map.push(e.pos, e.pos + t.length, u),
3540 xo && 9 > bo && (c = !0), e.pos += t.length;
3541 if (n || r || i || c || a) {
3542 var v = n || "";
3543 r && (v += r), i && (v += i);
3544 var y = ji("span", [ u ], v, a);
3545 return o && (y.title = o), e.content.appendChild(y);
3546 }
3547 e.content.appendChild(u);
3548 }
3549 }
3550 function zr(e) {
3551 for (var t = " ", n = 0; n < e.length - 2; ++n) t += n % 2 ? " " : " ";
3552 return t + " ";
3553 }
3554 function jr(e, t) {
3555 return function(n, r, i, o, a, l, s) {
3556 i = i ? i + " cm-force-border" : "cm-force-border";
3557 for (var c = n.pos, u = c + r.length; ;) {
3558 for (var f = 0; f < t.length; f++) {
3559 var h = t[f];
3560 if (h.to > c && h.from <= c) break;
3561 }
3562 if (h.to >= u) return e(n, r, i, o, a, l, s);
3563 e(n, r.slice(0, h.to - c), i, o, null, l, s), o = null, r = r.slice(h.to - c), c = h.to;
3564 }
3565 };
3566 }
3567 function Ur(e, t, n, r) {
3568 var i = !r && n.widgetNode;
3569 i && e.map.push(e.pos, e.pos + t, i), !r && e.cm.display.input.needsContentAttribute && (i || (i = e.content.appendChild(document.createElement("span"))),
3570 i.setAttribute("cm-marker", n.id)), i && (e.cm.display.input.setUneditable(i), e.content.appendChild(i)),
3571 e.pos += t;
3572 }
3573 function qr(e, t, n) {
3574 var r = e.markedSpans, i = e.text, o = 0;
3575 if (r) for (var a, l, s, c, u, f, h, d = i.length, p = 0, m = 1, g = "", v = 0; ;) {
3576 if (v == p) {
3577 s = c = u = f = l = "", h = null, v = 1 / 0;
3578 for (var y, x = [], b = 0; b < r.length; ++b) {
3579 var w = r[b], k = w.marker;
3580 "bookmark" == k.type && w.from == p && k.widgetNode ? x.push(k) : w.from <= p && (null == w.to || w.to > p || k.collapsed && w.to == p && w.from == p) ? (null != w.to && w.to != p && v > w.to && (v = w.to,
3581 c = ""), k.className && (s += " " + k.className), k.css && (l = (l ? l + ";" : "") + k.css),
3582 k.startStyle && w.from == p && (u += " " + k.startStyle), k.endStyle && w.to == v && (y || (y = [])).push(k.endStyle, w.to),
3583 k.title && !f && (f = k.title), k.collapsed && (!h || dr(h.marker, k) < 0) && (h = w)) : w.from > p && v > w.from && (v = w.from);
3584 }
3585 if (y) for (b = 0; b < y.length; b += 2) y[b + 1] == v && (c += " " + y[b]);
3586 if (!h || h.from == p) for (b = 0; b < x.length; ++b) Ur(t, 0, x[b]);
3587 if (h && (h.from || 0) == p) {
3588 if (Ur(t, (null == h.to ? d + 1 : h.to) - p, h.marker, null == h.from), null == h.to) return;
3589 h.to == p && (h = !1);
3590 }
3591 }
3592 if (p >= d) break;
3593 for (var S = Math.min(d, v); ;) {
3594 if (g) {
3595 var C = p + g.length;
3596 if (!h) {
3597 var L = C > S ? g.slice(0, S - p) : g;
3598 t.addToken(t, L, a ? a + s : s, u, p + L.length == v ? c : "", f, l);
3599 }
3600 if (C >= S) {
3601 g = g.slice(S - p), p = S;
3602 break;
3603 }
3604 p = C, u = "";
3605 }
3606 g = i.slice(o, o = n[m++]), a = Wr(n[m++], t.cm.options);
3607 }
3608 } else for (m = 1; m < n.length; m += 2) t.addToken(t, i.slice(o, o = n[m]), Wr(n[m + 1], t.cm.options));
3609 }
3610 function Gr(e, t) {
3611 return 0 == t.from.ch && 0 == t.to.ch && "" == Ii(t.text) && (!e.cm || e.cm.options.wholeLineUpdateBefore);
3612 }
3613 function Yr(e, t, n, r) {
3614 function i(e) {
3615 return n ? n[e] : null;
3616 }
3617 function o(e, n, i) {
3618 Mr(e, n, i, r), Ci(e, "change", e, t);
3619 }
3620 function a(e, t) {
3621 for (var n = e, o = []; t > n; ++n) o.push(new ba(c[n], i(n), r));
3622 return o;
3623 }
3624 var l = t.from, s = t.to, c = t.text, u = Zr(e, l.line), f = Zr(e, s.line), h = Ii(c), d = i(c.length - 1), p = s.line - l.line;
3625 if (t.full) e.insert(0, a(0, c.length)), e.remove(c.length, e.size - c.length); else if (Gr(e, t)) {
3626 var m = a(0, c.length - 1);
3627 o(f, f.text, d), p && e.remove(l.line, p), m.length && e.insert(l.line, m);
3628 } else u == f ? 1 == c.length ? o(u, u.text.slice(0, l.ch) + h + u.text.slice(s.ch), d) : ((m = a(1, c.length - 1)).push(new ba(h + u.text.slice(s.ch), d, r)),
3629 o(u, u.text.slice(0, l.ch) + c[0], i(0)), e.insert(l.line + 1, m)) : 1 == c.length ? (o(u, u.text.slice(0, l.ch) + c[0] + f.text.slice(s.ch), i(0)),
3630 e.remove(l.line + 1, p)) : (o(u, u.text.slice(0, l.ch) + c[0], i(0)), o(f, h + f.text.slice(s.ch), d),
3631 m = a(1, c.length - 1), p > 1 && e.remove(l.line + 1, p - 1), e.insert(l.line + 1, m));
3632 Ci(e, "change", e, t);
3633 }
3634 function $r(e) {
3635 this.lines = e, this.parent = null;
3636 for (var t = 0, n = 0; t < e.length; ++t) e[t].parent = this, n += e[t].height;
3637 this.height = n;
3638 }
3639 function Vr(e) {
3640 this.children = e;
3641 for (var t = 0, n = 0, r = 0; r < e.length; ++r) {
3642 var i = e[r];
3643 t += i.chunkSize(), n += i.height, i.parent = this;
3644 }
3645 this.size = t, this.height = n, this.parent = null;
3646 }
3647 function Kr(e, t, n) {
3648 function r(e, i, o) {
3649 if (e.linked) for (var a = 0; a < e.linked.length; ++a) {
3650 var l = e.linked[a];
3651 if (l.doc != i) {
3652 var s = o && l.sharedHist;
3653 n && !s || (t(l.doc, s), r(l.doc, e, s));
3654 }
3655 }
3656 }
3657 r(e, null, !0);
3658 }
3659 function Xr(e, t) {
3660 if (t.cm) throw new Error("This document is already in use.");
3661 e.doc = t, t.cm = e, a(e), n(e), e.options.lineWrapping || h(e), e.options.mode = t.modeOption,
3662 Dt(e);
3663 }
3664 function Zr(e, t) {
3665 if (0 > (t -= e.first) || t >= e.size) throw new Error("There is no line " + (t + e.first) + " in the document.");
3666 for (var n = e; !n.lines; ) for (var r = 0; ;++r) {
3667 var i = n.children[r], o = i.chunkSize();
3668 if (o > t) {
3669 n = i;
3670 break;
3671 }
3672 t -= o;
3673 }
3674 return n.lines[t];
3675 }
3676 function Jr(e, t, n) {
3677 var r = [], i = t.line;
3678 return e.iter(t.line, n.line + 1, (function(e) {
3679 var o = e.text;
3680 i == n.line && (o = o.slice(0, n.ch)), i == t.line && (o = o.slice(t.ch)), r.push(o),
3681 ++i;
3682 })), r;
3683 }
3684 function Qr(e, t, n) {
3685 var r = [];
3686 return e.iter(t, n, (function(e) {
3687 r.push(e.text);
3688 })), r;
3689 }
3690 function ei(e, t) {
3691 var n = t - e.height;
3692 if (n) for (var r = e; r; r = r.parent) r.height += n;
3693 }
3694 function ti(e) {
3695 if (null == e.parent) return null;
3696 for (var t = e.parent, n = Pi(t.lines, e), r = t.parent; r; t = r, r = r.parent) for (var i = 0; r.children[i] != t; ++i) n += r.children[i].chunkSize();
3697 return n + t.first;
3698 }
3699 function ni(e, t) {
3700 var n = e.first;
3701 e: do {
3702 for (var r = 0; r < e.children.length; ++r) {
3703 var i = e.children[r], o = i.height;
3704 if (o > t) {
3705 e = i;
3706 continue e;
3707 }
3708 t -= o, n += i.chunkSize();
3709 }
3710 return n;
3711 } while (!e.lines);
3712 for (r = 0; r < e.lines.length; ++r) {
3713 var l = e.lines[r].height;
3714 if (l > t) break;
3715 t -= l;
3716 }
3717 return n + r;
3718 }
3719 function ri(e) {
3720 for (var t = 0, n = (e = yr(e)).parent, r = 0; r < n.lines.length; ++r) {
3721 var i = n.lines[r];
3722 if (i == e) break;
3723 t += i.height;
3724 }
3725 for (var o = n.parent; o; o = (n = o).parent) for (r = 0; r < o.children.length; ++r) {
3726 var a = o.children[r];
3727 if (a == n) break;
3728 t += a.height;
3729 }
3730 return t;
3731 }
3732 function ii(e) {
3733 var t = e.order;
3734 return null == t && (t = e.order = ll(e.text)), t;
3735 }
3736 function oi(e) {
3737 this.done = [], this.undone = [], this.undoDepth = 1 / 0, this.lastModTime = this.lastSelTime = 0,
3738 this.lastOp = this.lastSelOp = null, this.lastOrigin = this.lastSelOrigin = null,
3739 this.generation = this.maxGeneration = e || 1;
3740 }
3741 function ai(e, t) {
3742 var n = {
3743 from: $(t.from),
3744 to: Qo(t),
3745 text: Jr(e, t.from, t.to)
3746 };
3747 return di(e, n, t.from.line, t.to.line + 1), Kr(e, (function(e) {
3748 di(e, n, t.from.line, t.to.line + 1);
3749 }), !0), n;
3750 }
3751 function li(e) {
3752 for (;e.length && Ii(e).ranges; ) e.pop();
3753 }
3754 function si(e, t) {
3755 return t ? (li(e.done), Ii(e.done)) : e.done.length && !Ii(e.done).ranges ? Ii(e.done) : e.done.length > 1 && !e.done[e.done.length - 2].ranges ? (e.done.pop(),
3756 Ii(e.done)) : void 0;
3757 }
3758 function ci(e, t, n, r) {
3759 var i = e.history;
3760 i.undone.length = 0;
3761 var o, a = +new Date;
3762 if ((i.lastOp == r || i.lastOrigin == t.origin && t.origin && ("+" == t.origin.charAt(0) && e.cm && i.lastModTime > a - e.cm.options.historyEventDelay || "*" == t.origin.charAt(0))) && (o = si(i, i.lastOp == r))) {
3763 var l = Ii(o.changes);
3764 0 == _o(t.from, t.to) && 0 == _o(t.from, l.to) ? l.to = Qo(t) : o.changes.push(ai(e, t));
3765 } else {
3766 var s = Ii(i.done);
3767 for (s && s.ranges || hi(e.sel, i.done), o = {
3768 changes: [ ai(e, t) ],
3769 generation: i.generation
3770 }, i.done.push(o); i.done.length > i.undoDepth; ) i.done.shift(), i.done[0].ranges || i.done.shift();
3771 }
3772 i.done.push(n), i.generation = ++i.maxGeneration, i.lastModTime = i.lastSelTime = a,
3773 i.lastOp = i.lastSelOp = r, i.lastOrigin = i.lastSelOrigin = t.origin, l || Pa(e, "historyAdded");
3774 }
3775 function ui(e, t, n, r) {
3776 var i = t.charAt(0);
3777 return "*" == i || "+" == i && n.ranges.length == r.ranges.length && n.somethingSelected() == r.somethingSelected() && new Date - e.history.lastSelTime <= (e.cm ? e.cm.options.historyEventDelay : 500);
3778 }
3779 function fi(e, t, n, r) {
3780 var i = e.history, o = r && r.origin;
3781 n == i.lastSelOp || o && i.lastSelOrigin == o && (i.lastModTime == i.lastSelTime && i.lastOrigin == o || ui(e, o, Ii(i.done), t)) ? i.done[i.done.length - 1] = t : hi(t, i.done),
3782 i.lastSelTime = +new Date, i.lastSelOrigin = o, i.lastSelOp = n, r && !1 !== r.clearRedo && li(i.undone);
3783 }
3784 function hi(e, t) {
3785 var n = Ii(t);
3786 n && n.ranges && n.equals(e) || t.push(e);
3787 }
3788 function di(e, t, n, r) {
3789 var i = t["spans_" + e.id], o = 0;
3790 e.iter(Math.max(e.first, n), Math.min(e.first + e.size, r), (function(n) {
3791 n.markedSpans && ((i || (i = t["spans_" + e.id] = {}))[o] = n.markedSpans), ++o;
3792 }));
3793 }
3794 function pi(e) {
3795 if (!e) return null;
3796 for (var t, n = 0; n < e.length; ++n) e[n].marker.explicitlyCleared ? t || (t = e.slice(0, n)) : t && t.push(e[n]);
3797 return t ? t.length ? t : null : e;
3798 }
3799 function mi(e, t) {
3800 var n = t["spans_" + e.id];
3801 if (!n) return null;
3802 for (var r = 0, i = []; r < t.text.length; ++r) i.push(pi(n[r]));
3803 return i;
3804 }
3805 function gi(e, t, n) {
3806 for (var r = 0, i = []; r < e.length; ++r) {
3807 var o = e[r];
3808 if (o.ranges) i.push(n ? ue.prototype.deepCopy.call(o) : o); else {
3809 var a = o.changes, l = [];
3810 i.push({
3811 changes: l
3812 });
3813 for (var s = 0; s < a.length; ++s) {
3814 var c, u = a[s];
3815 if (l.push({
3816 from: u.from,
3817 to: u.to,
3818 text: u.text
3819 }), t) for (var f in u) (c = f.match(/^spans_(\d+)$/)) && Pi(t, Number(c[1])) > -1 && (Ii(l)[f] = u[f],
3820 delete u[f]);
3821 }
3822 }
3823 }
3824 return i;
3825 }
3826 function vi(e, t, n, r) {
3827 n < e.line ? e.line += r : t < e.line && (e.line = t, e.ch = 0);
3828 }
3829 function yi(e, t, n, r) {
3830 for (var i = 0; i < e.length; ++i) {
3831 var o = e[i], a = !0;
3832 if (o.ranges) {
3833 o.copied || ((o = e[i] = o.deepCopy()).copied = !0);
3834 for (var l = 0; l < o.ranges.length; l++) vi(o.ranges[l].anchor, t, n, r), vi(o.ranges[l].head, t, n, r);
3835 } else {
3836 for (l = 0; l < o.changes.length; ++l) {
3837 var s = o.changes[l];
3838 if (n < s.from.line) s.from = Bo(s.from.line + r, s.from.ch), s.to = Bo(s.to.line + r, s.to.ch); else if (t <= s.to.line) {
3839 a = !1;
3840 break;
3841 }
3842 }
3843 a || (e.splice(0, i + 1), i = 0);
3844 }
3845 }
3846 }
3847 function xi(e, t) {
3848 var n = t.from.line, r = t.to.line, i = t.text.length - (r - n) - 1;
3849 yi(e.done, n, r, i), yi(e.undone, n, r, i);
3850 }
3851 function bi(e) {
3852 return null != e.defaultPrevented ? e.defaultPrevented : 0 == e.returnValue;
3853 }
3854 function wi(e) {
3855 return e.target || e.srcElement;
3856 }
3857 function ki(e) {
3858 var t = e.which;
3859 return null == t && (1 & e.button ? t = 1 : 2 & e.button ? t = 3 : 4 & e.button && (t = 2)),
3860 Eo && e.ctrlKey && 1 == t && (t = 3), t;
3861 }
3862 function Si(e, t, n) {
3863 var r = e._handlers && e._handlers[t];
3864 return n ? r && r.length > 0 ? r.slice() : Oa : r || Oa;
3865 }
3866 function Ci(e, t) {
3867 function n(e) {
3868 return function() {
3869 e.apply(null, o);
3870 };
3871 }
3872 var r = Si(e, t, !1);
3873 if (r.length) {
3874 var i, o = Array.prototype.slice.call(arguments, 2);
3875 Go ? i = Go.delayedCallbacks : Ra ? i = Ra : (i = Ra = [], setTimeout(Li, 0));
3876 for (var a = 0; a < r.length; ++a) i.push(n(r[a]));
3877 }
3878 }
3879 function Li() {
3880 var e = Ra;
3881 Ra = null;
3882 for (var t = 0; t < e.length; ++t) e[t]();
3883 }
3884 function Ti(e, t, n) {
3885 return "string" == typeof t && (t = {
3886 type: t,
3887 preventDefault: function() {
3888 this.defaultPrevented = !0;
3889 }
3890 }), Pa(e, n || t.type, e, t), bi(t) || t.codemirrorIgnore;
3891 }
3892 function Mi(e) {
3893 var t = e._handlers && e._handlers.cursorActivity;
3894 if (t) for (var n = e.curOp.cursorActivityHandlers || (e.curOp.cursorActivityHandlers = []), r = 0; r < t.length; ++r) -1 == Pi(n, t[r]) && n.push(t[r]);
3895 }
3896 function Ni(e, t) {
3897 return Si(e, t).length > 0;
3898 }
3899 function Ai(e) {
3900 e.prototype.on = function(e, t) {
3901 Ea(this, e, t);
3902 }, e.prototype.off = function(e, t) {
3903 Ia(this, e, t);
3904 };
3905 }
3906 function Ei() {
3907 this.id = null;
3908 }
3909 function Oi(e) {
3910 for (;ja.length <= e; ) ja.push(Ii(ja) + " ");
3911 return ja[e];
3912 }
3913 function Ii(e) {
3914 return e[e.length - 1];
3915 }
3916 function Pi(e, t) {
3917 for (var n = 0; n < e.length; ++n) if (e[n] == t) return n;
3918 return -1;
3919 }
3920 function Ri(e, t) {
3921 for (var n = [], r = 0; r < e.length; r++) n[r] = t(e[r], r);
3922 return n;
3923 }
3924 function Di() {}
3925 function Hi(e, t) {
3926 var n;
3927 return Object.create ? n = Object.create(e) : (Di.prototype = e, n = new Di), t && Wi(t, n),
3928 n;
3929 }
3930 function Wi(e, t, n) {
3931 for (var r in t || (t = {}), e) !e.hasOwnProperty(r) || !1 === n && t.hasOwnProperty(r) || (t[r] = e[r]);
3932 return t;
3933 }
3934 function Bi(e) {
3935 var t = Array.prototype.slice.call(arguments, 1);
3936 return function() {
3937 return e.apply(null, t);
3938 };
3939 }
3940 function _i(e, t) {
3941 return t ? !!(t.source.indexOf("\\w") > -1 && Ya(e)) || t.test(e) : Ya(e);
3942 }
3943 function Fi(e) {
3944 for (var t in e) if (e.hasOwnProperty(t) && e[t]) return !1;
3945 return !0;
3946 }
3947 function zi(e) {
3948 return e.charCodeAt(0) >= 768 && $a.test(e);
3949 }
3950 function ji(e, t, n, r) {
3951 var i = document.createElement(e);
3952 if (n && (i.className = n), r && (i.style.cssText = r), "string" == typeof t) i.appendChild(document.createTextNode(t)); else if (t) for (var o = 0; o < t.length; ++o) i.appendChild(t[o]);
3953 return i;
3954 }
3955 function Ui(e) {
3956 for (var t = e.childNodes.length; t > 0; --t) e.removeChild(e.firstChild);
3957 return e;
3958 }
3959 function qi(e, t) {
3960 return Ui(e).appendChild(t);
3961 }
3962 function Gi() {
3963 for (var e = document.activeElement; e && e.root && e.root.activeElement; ) e = e.root.activeElement;
3964 return e;
3965 }
3966 function Yi(e) {
3967 return new RegExp("(^|\\s)" + e + "(?:$|\\s)\\s*");
3968 }
3969 function $i(e, t) {
3970 for (var n = e.split(" "), r = 0; r < n.length; r++) n[r] && !Yi(n[r]).test(t) && (t += " " + n[r]);
3971 return t;
3972 }
3973 function Vi(e) {
3974 if (document.body.getElementsByClassName) for (var t = document.body.getElementsByClassName("CodeMirror"), n = 0; n < t.length; n++) {
3975 var r = t[n].CodeMirror;
3976 r && e(r);
3977 }
3978 }
3979 function Ki() {
3980 Qa || (Xi(), Qa = !0);
3981 }
3982 function Xi() {
3983 var e;
3984 Ea(window, "resize", (function() {
3985 null == e && (e = setTimeout((function() {
3986 e = null, Vi(qt);
3987 }), 100));
3988 })), Ea(window, "blur", (function() {
3989 Vi(yn);
3990 }));
3991 }
3992 function Zi(e) {
3993 if (null == Ka) {
3994 var t = ji("span", "​");
3995 qi(e, ji("span", [ t, document.createTextNode("x") ])), 0 != e.firstChild.offsetHeight && (Ka = t.offsetWidth <= 1 && t.offsetHeight > 2 && !(xo && 8 > bo));
3996 }
3997 var n = Ka ? ji("span", "​") : ji("span", " ", null, "display: inline-block; width: 1px; margin-right: -1px");
3998 return n.setAttribute("cm-text", ""), n;
3999 }
4000 function Ji(e) {
4001 if (null != Xa) return Xa;
4002 var t = qi(e, document.createTextNode("AخA")), n = qa(t, 0, 1).getBoundingClientRect();
4003 if (!n || n.left == n.right) return !1;
4004 var r = qa(t, 1, 2).getBoundingClientRect();
4005 return Xa = r.right - n.right < 3;
4006 }
4007 function Qi(e) {
4008 if (null != il) return il;
4009 var t = qi(e, ji("span", "x")), n = t.getBoundingClientRect(), r = qa(t, 0, 1).getBoundingClientRect();
4010 return il = Math.abs(n.left - r.left) > 1;
4011 }
4012 function eo(e, t, n, r) {
4013 if (!e) return r(t, n, "ltr");
4014 for (var i = !1, o = 0; o < e.length; ++o) {
4015 var a = e[o];
4016 (a.from < n && a.to > t || t == n && a.to == t) && (r(Math.max(a.from, t), Math.min(a.to, n), 1 == a.level ? "rtl" : "ltr"),
4017 i = !0);
4018 }
4019 i || r(t, n, "ltr");
4020 }
4021 function to(e) {
4022 return e.level % 2 ? e.to : e.from;
4023 }
4024 function no(e) {
4025 return e.level % 2 ? e.from : e.to;
4026 }
4027 function ro(e) {
4028 var t = ii(e);
4029 return t ? to(t[0]) : 0;
4030 }
4031 function io(e) {
4032 var t = ii(e);
4033 return t ? no(Ii(t)) : e.text.length;
4034 }
4035 function oo(e, t) {
4036 var n = Zr(e.doc, t), r = yr(n);
4037 r != n && (t = ti(r));
4038 var i = ii(r), o = i ? i[0].level % 2 ? io(r) : ro(r) : 0;
4039 return Bo(t, o);
4040 }
4041 function ao(e, t) {
4042 for (var n, r = Zr(e.doc, t); n = gr(r); ) r = n.find(1, !0).line, t = null;
4043 var i = ii(r), o = i ? i[0].level % 2 ? ro(r) : io(r) : r.text.length;
4044 return Bo(null == t ? ti(r) : t, o);
4045 }
4046 function lo(e, t) {
4047 var n = oo(e, t.line), r = Zr(e.doc, n.line), i = ii(r);
4048 if (!i || 0 == i[0].level) {
4049 var o = Math.max(0, r.text.search(/\S/)), a = t.line == n.line && t.ch <= o && t.ch;
4050 return Bo(n.line, a ? 0 : o);
4051 }
4052 return n;
4053 }
4054 function so(e, t, n) {
4055 var r = e[0].level;
4056 return t == r || n != r && n > t;
4057 }
4058 function co(e, t) {
4059 al = null;
4060 for (var n, r = 0; r < e.length; ++r) {
4061 var i = e[r];
4062 if (i.from < t && i.to > t) return r;
4063 if (i.from == t || i.to == t) {
4064 if (null != n) return so(e, i.level, e[n].level) ? (i.from != i.to && (al = n),
4065 r) : (i.from != i.to && (al = r), n);
4066 n = r;
4067 }
4068 }
4069 return n;
4070 }
4071 function uo(e, t, n, r) {
4072 if (!r) return t + n;
4073 do {
4074 t += n;
4075 } while (t > 0 && zi(e.text.charAt(t)));
4076 return t;
4077 }
4078 function fo(e, t, n, r) {
4079 var i = ii(e);
4080 if (!i) return ho(e, t, n, r);
4081 for (var o = co(i, t), a = i[o], l = uo(e, t, a.level % 2 ? -n : n, r); ;) {
4082 if (l > a.from && l < a.to) return l;
4083 if (l == a.from || l == a.to) return co(i, l) == o ? l : n > 0 == (a = i[o += n]).level % 2 ? a.to : a.from;
4084 if (!(a = i[o += n])) return null;
4085 l = n > 0 == a.level % 2 ? uo(e, a.to, -1, r) : uo(e, a.from, 1, r);
4086 }
4087 }
4088 function ho(e, t, n, r) {
4089 var i = t + n;
4090 if (r) for (;i > 0 && zi(e.text.charAt(i)); ) i += n;
4091 return 0 > i || i > e.text.length ? null : i;
4092 }
4093 var po = navigator.userAgent, mo = navigator.platform, go = /gecko\/\d/i.test(po), vo = /MSIE \d/.test(po), yo = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(po), xo = vo || yo, bo = xo && (vo ? document.documentMode || 6 : yo[1]), wo = /WebKit\//.test(po), ko = wo && /Qt\/\d+\.\d+/.test(po), So = /Chrome\//.test(po), Co = /Opera\//.test(po), Lo = /Apple Computer/.test(navigator.vendor), To = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(po), Mo = /PhantomJS/.test(po), No = /AppleWebKit/.test(po) && /Mobile\/\w+/.test(po), Ao = No || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(po), Eo = No || /Mac/.test(mo), Oo = /\bCrOS\b/.test(po), Io = /win/i.test(mo), Po = Co && po.match(/Version\/(\d*\.\d*)/);
4094 Po && (Po = Number(Po[1])), Po && Po >= 15 && (Co = !1, wo = !0);
4095 var Ro = Eo && (ko || Co && (null == Po || 12.11 > Po)), Do = go || xo && bo >= 9, Ho = !1, Wo = !1;
4096 m.prototype = Wi({
4097 update: function(e) {
4098 var t = e.scrollWidth > e.clientWidth + 1, n = e.scrollHeight > e.clientHeight + 1, r = e.nativeBarWidth;
4099 if (n) {
4100 this.vert.style.display = "block", this.vert.style.bottom = t ? r + "px" : "0";
4101 var i = e.viewHeight - (t ? r : 0);
4102 this.vert.firstChild.style.height = Math.max(0, e.scrollHeight - e.clientHeight + i) + "px";
4103 } else this.vert.style.display = "", this.vert.firstChild.style.height = "0";
4104 if (t) {
4105 this.horiz.style.display = "block", this.horiz.style.right = n ? r + "px" : "0",
4106 this.horiz.style.left = e.barLeft + "px";
4107 var o = e.viewWidth - e.barLeft - (n ? r : 0);
4108 this.horiz.firstChild.style.width = e.scrollWidth - e.clientWidth + o + "px";
4109 } else this.horiz.style.display = "", this.horiz.firstChild.style.width = "0";
4110 return !this.checkedZeroWidth && e.clientHeight > 0 && (0 == r && this.zeroWidthHack(),
4111 this.checkedZeroWidth = !0), {
4112 right: n ? r : 0,
4113 bottom: t ? r : 0
4114 };
4115 },
4116 setScrollLeft: function(e) {
4117 this.horiz.scrollLeft != e && (this.horiz.scrollLeft = e), this.disableHoriz && this.enableZeroWidthBar(this.horiz, this.disableHoriz);
4118 },
4119 setScrollTop: function(e) {
4120 this.vert.scrollTop != e && (this.vert.scrollTop = e), this.disableVert && this.enableZeroWidthBar(this.vert, this.disableVert);
4121 },
4122 zeroWidthHack: function() {
4123 var e = Eo && !To ? "12px" : "18px";
4124 this.horiz.style.height = this.vert.style.width = e, this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none",
4125 this.disableHoriz = new Ei, this.disableVert = new Ei;
4126 },
4127 enableZeroWidthBar: function(e, t) {
4128 function n() {
4129 var r = e.getBoundingClientRect();
4130 document.elementFromPoint(r.left + 1, r.bottom - 1) != e ? e.style.pointerEvents = "none" : t.set(1e3, n);
4131 }
4132 e.style.pointerEvents = "auto", t.set(1e3, n);
4133 },
4134 clear: function() {
4135 var e = this.horiz.parentNode;
4136 e.removeChild(this.horiz), e.removeChild(this.vert);
4137 }
4138 }, m.prototype), g.prototype = Wi({
4139 update: function() {
4140 return {
4141 bottom: 0,
4142 right: 0
4143 };
4144 },
4145 setScrollLeft: function() {},
4146 setScrollTop: function() {},
4147 clear: function() {}
4148 }, g.prototype), e.scrollbarModel = {
4149 native: m,
4150 null: g
4151 }, L.prototype.signal = function(e, t) {
4152 Ni(e, t) && this.events.push(arguments);
4153 }, L.prototype.finish = function() {
4154 for (var e = 0; e < this.events.length; e++) Pa.apply(null, this.events[e]);
4155 };
4156 var Bo = e.Pos = function(e, t) {
4157 return this instanceof Bo ? (this.line = e, void (this.ch = t)) : new Bo(e, t);
4158 }, _o = e.cmpPos = function(e, t) {
4159 return e.line - t.line || e.ch - t.ch;
4160 }, Fo = null;
4161 ne.prototype = Wi({
4162 init: function(e) {
4163 function t(e) {
4164 if (!Ti(r, e)) {
4165 if (r.somethingSelected()) Fo = {
4166 lineWise: !1,
4167 text: r.getSelections()
4168 }, n.inaccurateSelection && (n.prevInput = "", n.inaccurateSelection = !1, o.value = Fo.text.join("\n"),
4169 Ua(o)); else {
4170 if (!r.options.lineWiseCopyCut) return;
4171 var t = ee(r);
4172 Fo = {
4173 lineWise: !0,
4174 text: t.text
4175 }, "cut" == e.type ? r.setSelections(t.ranges, null, Wa) : (n.prevInput = "", o.value = t.text.join("\n"),
4176 Ua(o));
4177 }
4178 "cut" == e.type && (r.state.cutIncoming = !0);
4179 }
4180 }
4181 var n = this, r = this.cm, i = this.wrapper = re(), o = this.textarea = i.firstChild;
4182 e.wrapper.insertBefore(i, e.wrapper.firstChild), No && (o.style.width = "0px"),
4183 Ea(o, "input", (function() {
4184 xo && bo >= 9 && n.hasSelection && (n.hasSelection = null), n.poll();
4185 })), Ea(o, "paste", (function(e) {
4186 Ti(r, e) || J(e, r) || (r.state.pasteIncoming = !0, n.fastPoll());
4187 })), Ea(o, "cut", t), Ea(o, "copy", t), Ea(e.scroller, "paste", (function(t) {
4188 Gt(e, t) || Ti(r, t) || (r.state.pasteIncoming = !0, n.focus());
4189 })), Ea(e.lineSpace, "selectstart", (function(t) {
4190 Gt(e, t) || Ma(t);
4191 })), Ea(o, "compositionstart", (function() {
4192 var e = r.getCursor("from");
4193 n.composing && n.composing.range.clear(), n.composing = {
4194 start: e,
4195 range: r.markText(e, r.getCursor("to"), {
4196 className: "CodeMirror-composing"
4197 })
4198 };
4199 })), Ea(o, "compositionend", (function() {
4200 n.composing && (n.poll(), n.composing.range.clear(), n.composing = null);
4201 }));
4202 },
4203 prepareSelection: function() {
4204 var e = this.cm, t = e.display, n = e.doc, r = De(e);
4205 if (e.options.moveInputWithCursor) {
4206 var i = dt(e, n.sel.primary().head, "div"), o = t.wrapper.getBoundingClientRect(), a = t.lineDiv.getBoundingClientRect();
4207 r.teTop = Math.max(0, Math.min(t.wrapper.clientHeight - 10, i.top + a.top - o.top)),
4208 r.teLeft = Math.max(0, Math.min(t.wrapper.clientWidth - 10, i.left + a.left - o.left));
4209 }
4210 return r;
4211 },
4212 showSelection: function(e) {
4213 var n = this.cm.display;
4214 qi(n.cursorDiv, e.cursors), qi(n.selectionDiv, e.selection), null != e.teTop && (this.wrapper.style.top = e.teTop + "px",
4215 this.wrapper.style.left = e.teLeft + "px");
4216 },
4217 reset: function(e) {
4218 if (!this.contextMenuPending) {
4219 var t, n, r = this.cm, i = r.doc;
4220 if (r.somethingSelected()) {
4221 this.prevInput = "";
4222 var o = i.sel.primary(), a = (t = rl && (o.to().line - o.from().line > 100 || (n = r.getSelection()).length > 1e3)) ? "-" : n || r.getSelection();
4223 this.textarea.value = a, r.state.focused && Ua(this.textarea), xo && bo >= 9 && (this.hasSelection = a);
4224 } else e || (this.prevInput = this.textarea.value = "", xo && bo >= 9 && (this.hasSelection = null));
4225 this.inaccurateSelection = t;
4226 }
4227 },
4228 getField: function() {
4229 return this.textarea;
4230 },
4231 supportsTouch: function() {
4232 return !1;
4233 },
4234 focus: function() {
4235 if ("nocursor" != this.cm.options.readOnly && (!Ao || Gi() != this.textarea)) try {
4236 this.textarea.focus();
4237 } catch (e) {}
4238 },
4239 blur: function() {
4240 this.textarea.blur();
4241 },
4242 resetPosition: function() {
4243 this.wrapper.style.top = this.wrapper.style.left = 0;
4244 },
4245 receivedFocus: function() {
4246 this.slowPoll();
4247 },
4248 slowPoll: function() {
4249 var e = this;
4250 e.pollingFast || e.polling.set(this.cm.options.pollInterval, (function() {
4251 e.poll(), e.cm.state.focused && e.slowPoll();
4252 }));
4253 },
4254 fastPoll: function() {
4255 function e() {
4256 n.poll() || t ? (n.pollingFast = !1, n.slowPoll()) : (t = !0, n.polling.set(60, e));
4257 }
4258 var t = !1, n = this;
4259 n.pollingFast = !0, n.polling.set(20, e);
4260 },
4261 poll: function() {
4262 var e = this.cm, t = this.textarea, n = this.prevInput;
4263 if (this.contextMenuPending || !e.state.focused || nl(t) && !n && !this.composing || e.isReadOnly() || e.options.disableInput || e.state.keySeq) return !1;
4264 var r = t.value;
4265 if (r == n && !e.somethingSelected()) return !1;
4266 if (xo && bo >= 9 && this.hasSelection === r || Eo && /[\uf700-\uf7ff]/.test(r)) return e.display.input.reset(),
4267 !1;
4268 if (e.doc.sel == e.display.selForContextMenu) {
4269 var i = r.charCodeAt(0);
4270 if (8203 != i || n || (n = "​"), 8666 == i) return this.reset(), this.cm.execCommand("undo");
4271 }
4272 for (var o = 0, a = Math.min(n.length, r.length); a > o && n.charCodeAt(o) == r.charCodeAt(o); ) ++o;
4273 var l = this;
4274 return At(e, (function() {
4275 Z(e, r.slice(o), n.length - o, null, l.composing ? "*compose" : null), r.length > 1e3 || r.indexOf("\n") > -1 ? t.value = l.prevInput = "" : l.prevInput = r,
4276 l.composing && (l.composing.range.clear(), l.composing.range = e.markText(l.composing.start, e.getCursor("to"), {
4277 className: "CodeMirror-composing"
4278 }));
4279 })), !0;
4280 },
4281 ensurePolled: function() {
4282 this.pollingFast && this.poll() && (this.pollingFast = !1);
4283 },
4284 onKeyPress: function() {
4285 xo && bo >= 9 && (this.hasSelection = null), this.fastPoll();
4286 },
4287 onContextMenu: function(e) {
4288 function t() {
4289 if (null != a.selectionStart) {
4290 var e = i.somethingSelected(), t = "​" + (e ? a.value : "");
4291 a.value = "⇚", a.value = t, r.prevInput = e ? "" : "​", a.selectionStart = 1, a.selectionEnd = t.length,
4292 o.selForContextMenu = i.doc.sel;
4293 }
4294 }
4295 function n() {
4296 if (r.contextMenuPending = !1, r.wrapper.style.cssText = f, a.style.cssText = u,
4297 xo && 9 > bo && o.scrollbars.setScrollTop(o.scroller.scrollTop = s), null != a.selectionStart) {
4298 (!xo || xo && 9 > bo) && t();
4299 var e = 0, n = function() {
4300 o.selForContextMenu == i.doc.sel && 0 == a.selectionStart && a.selectionEnd > 0 && "​" == r.prevInput ? Et(i, ua.selectAll)(i) : e++ < 10 ? o.detectingSelectAll = setTimeout(n, 500) : o.input.reset();
4301 };
4302 o.detectingSelectAll = setTimeout(n, 200);
4303 }
4304 }
4305 var r = this, i = r.cm, o = i.display, a = r.textarea, l = Yt(i, e), s = o.scroller.scrollTop;
4306 if (l && !Co) {
4307 i.options.resetSelectionOnContextMenu && -1 == i.doc.sel.contains(l) && Et(i, Te)(i.doc, de(l), Wa);
4308 var u = a.style.cssText, f = r.wrapper.style.cssText;
4309 r.wrapper.style.cssText = "position: absolute";
4310 var h = r.wrapper.getBoundingClientRect();
4311 if (a.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - h.top - 5) + "px; left: " + (e.clientX - h.left - 5) + "px; z-index: 1000; background: " + (xo ? "rgba(255, 255, 255, .05)" : "transparent") + "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",
4312 wo) var d = window.scrollY;
4313 if (o.input.focus(), wo && window.scrollTo(null, d), o.input.reset(), i.somethingSelected() || (a.value = r.prevInput = " "),
4314 r.contextMenuPending = !0, o.selForContextMenu = i.doc.sel, clearTimeout(o.detectingSelectAll),
4315 xo && bo >= 9 && t(), Do) {
4316 Aa(e);
4317 var p = function() {
4318 Ia(window, "mouseup", p), setTimeout(n, 20);
4319 };
4320 Ea(window, "mouseup", p);
4321 } else setTimeout(n, 50);
4322 }
4323 },
4324 readOnlyChanged: function(e) {
4325 e || this.reset();
4326 },
4327 setUneditable: Di,
4328 needsContentAttribute: !1
4329 }, ne.prototype), ie.prototype = Wi({
4330 init: function(e) {
4331 function t(e) {
4332 if (!Ti(r, e)) {
4333 if (r.somethingSelected()) Fo = {
4334 lineWise: !1,
4335 text: r.getSelections()
4336 }, "cut" == e.type && r.replaceSelection("", null, "cut"); else {
4337 if (!r.options.lineWiseCopyCut) return;
4338 var t = ee(r);
4339 Fo = {
4340 lineWise: !0,
4341 text: t.text
4342 }, "cut" == e.type && r.operation((function() {
4343 r.setSelections(t.ranges, 0, Wa), r.replaceSelection("", null, "cut");
4344 }));
4345 }
4346 if (e.clipboardData && !No) e.preventDefault(), e.clipboardData.clearData(), e.clipboardData.setData("text/plain", Fo.text.join("\n")); else {
4347 var n = re(), i = n.firstChild;
4348 r.display.lineSpace.insertBefore(n, r.display.lineSpace.firstChild), i.value = Fo.text.join("\n");
4349 var o = document.activeElement;
4350 Ua(i), setTimeout((function() {
4351 r.display.lineSpace.removeChild(n), o.focus();
4352 }), 50);
4353 }
4354 }
4355 }
4356 var n = this, r = n.cm, i = n.div = e.lineDiv;
4357 te(i), Ea(i, "paste", (function(e) {
4358 Ti(r, e) || J(e, r);
4359 })), Ea(i, "compositionstart", (function(e) {
4360 var t = e.data;
4361 if (n.composing = {
4362 sel: r.doc.sel,
4363 data: t,
4364 startData: t
4365 }, t) {
4366 var i = r.doc.sel.primary(), a = r.getLine(i.head.line).indexOf(t, Math.max(0, i.head.ch - t.length));
4367 a > -1 && a <= i.head.ch && (n.composing.sel = de(Bo(i.head.line, a), Bo(i.head.line, a + t.length)));
4368 }
4369 })), Ea(i, "compositionupdate", (function(e) {
4370 n.composing.data = e.data;
4371 })), Ea(i, "compositionend", (function(e) {
4372 var t = n.composing;
4373 t && (e.data == t.startData || /\u200b/.test(e.data) || (t.data = e.data), setTimeout((function() {
4374 t.handled || n.applyComposition(t), n.composing == t && (n.composing = null);
4375 }), 50));
4376 })), Ea(i, "touchstart", (function() {
4377 n.forceCompositionEnd();
4378 })), Ea(i, "input", (function() {
4379 n.composing || !r.isReadOnly() && n.pollContent() || At(n.cm, (function() {
4380 Dt(r);
4381 }));
4382 })), Ea(i, "copy", t), Ea(i, "cut", t);
4383 },
4384 prepareSelection: function() {
4385 var e = De(this.cm, !1);
4386 return e.focus = this.cm.state.focused, e;
4387 },
4388 showSelection: function(e, t) {
4389 e && this.cm.display.view.length && ((e.focus || t) && this.showPrimarySelection(),
4390 this.showMultipleSelections(e));
4391 },
4392 showPrimarySelection: function() {
4393 var e = window.getSelection(), t = this.cm.doc.sel.primary(), n = le(this.cm, e.anchorNode, e.anchorOffset), r = le(this.cm, e.focusNode, e.focusOffset);
4394 if (!n || n.bad || !r || r.bad || 0 != _o(K(n, r), t.from()) || 0 != _o(V(n, r), t.to())) {
4395 var i = oe(this.cm, t.from()), o = oe(this.cm, t.to());
4396 if (i || o) {
4397 var a = this.cm.display.view, l = e.rangeCount && e.getRangeAt(0);
4398 if (i) {
4399 if (!o) {
4400 var s = a[a.length - 1].measure, c = s.maps ? s.maps[s.maps.length - 1] : s.map;
4401 o = {
4402 node: c[c.length - 1],
4403 offset: c[c.length - 2] - c[c.length - 3]
4404 };
4405 }
4406 } else i = {
4407 node: a[0].measure.map[2],
4408 offset: 0
4409 };
4410 try {
4411 var u = qa(i.node, i.offset, o.offset, o.node);
4412 } catch (f) {}
4413 u && (!go && this.cm.state.focused ? (e.collapse(i.node, i.offset), u.collapsed || e.addRange(u)) : (e.removeAllRanges(),
4414 e.addRange(u)), l && null == e.anchorNode ? e.addRange(l) : go && this.startGracePeriod()),
4415 this.rememberSelection();
4416 }
4417 }
4418 },
4419 startGracePeriod: function() {
4420 var e = this;
4421 clearTimeout(this.gracePeriod), this.gracePeriod = setTimeout((function() {
4422 e.gracePeriod = !1, e.selectionChanged() && e.cm.operation((function() {
4423 e.cm.curOp.selectionChanged = !0;
4424 }));
4425 }), 20);
4426 },
4427 showMultipleSelections: function(e) {
4428 qi(this.cm.display.cursorDiv, e.cursors), qi(this.cm.display.selectionDiv, e.selection);
4429 },
4430 rememberSelection: function() {
4431 var e = window.getSelection();
4432 this.lastAnchorNode = e.anchorNode, this.lastAnchorOffset = e.anchorOffset, this.lastFocusNode = e.focusNode,
4433 this.lastFocusOffset = e.focusOffset;
4434 },
4435 selectionInEditor: function() {
4436 var e = window.getSelection();
4437 if (!e.rangeCount) return !1;
4438 var t = e.getRangeAt(0).commonAncestorContainer;
4439 return Va(this.div, t);
4440 },
4441 focus: function() {
4442 "nocursor" != this.cm.options.readOnly && this.div.focus();
4443 },
4444 blur: function() {
4445 this.div.blur();
4446 },
4447 getField: function() {
4448 return this.div;
4449 },
4450 supportsTouch: function() {
4451 return !0;
4452 },
4453 receivedFocus: function() {
4454 function e() {
4455 t.cm.state.focused && (t.pollSelection(), t.polling.set(t.cm.options.pollInterval, e));
4456 }
4457 var t = this;
4458 this.selectionInEditor() ? this.pollSelection() : At(this.cm, (function() {
4459 t.cm.curOp.selectionChanged = !0;
4460 })), this.polling.set(this.cm.options.pollInterval, e);
4461 },
4462 selectionChanged: function() {
4463 var e = window.getSelection();
4464 return e.anchorNode != this.lastAnchorNode || e.anchorOffset != this.lastAnchorOffset || e.focusNode != this.lastFocusNode || e.focusOffset != this.lastFocusOffset;
4465 },
4466 pollSelection: function() {
4467 if (!this.composing && !this.gracePeriod && this.selectionChanged()) {
4468 var e = window.getSelection(), t = this.cm;
4469 this.rememberSelection();
4470 var n = le(t, e.anchorNode, e.anchorOffset), r = le(t, e.focusNode, e.focusOffset);
4471 n && r && At(t, (function() {
4472 Te(t.doc, de(n, r), Wa), (n.bad || r.bad) && (t.curOp.selectionChanged = !0);
4473 }));
4474 }
4475 },
4476 pollContent: function() {
4477 var o, e = this.cm, t = e.display, n = e.doc.sel.primary(), r = n.from(), i = n.to();
4478 if (r.line < t.viewFrom || i.line > t.viewTo - 1) return !1;
4479 if (r.line == t.viewFrom || 0 == (o = Bt(e, r.line))) var a = ti(t.view[0].line), l = t.view[0].node; else a = ti(t.view[o].line),
4480 l = t.view[o - 1].node.nextSibling;
4481 var s = Bt(e, i.line);
4482 if (s == t.view.length - 1) var c = t.viewTo - 1, u = t.lineDiv.lastChild; else c = ti(t.view[s + 1].line) - 1,
4483 u = t.view[s + 1].node.previousSibling;
4484 for (var f = e.doc.splitLines(ce(e, l, u, a, c)), h = Jr(e.doc, Bo(a, 0), Bo(c, Zr(e.doc, c).text.length)); f.length > 1 && h.length > 1; ) if (Ii(f) == Ii(h)) f.pop(),
4485 h.pop(), c--; else {
4486 if (f[0] != h[0]) break;
4487 f.shift(), h.shift(), a++;
4488 }
4489 for (var d = 0, p = 0, m = f[0], g = h[0], v = Math.min(m.length, g.length); v > d && m.charCodeAt(d) == g.charCodeAt(d); ) ++d;
4490 for (var y = Ii(f), x = Ii(h), b = Math.min(y.length - (1 == f.length ? d : 0), x.length - (1 == h.length ? d : 0)); b > p && y.charCodeAt(y.length - p - 1) == x.charCodeAt(x.length - p - 1); ) ++p;
4491 f[f.length - 1] = y.slice(0, y.length - p), f[0] = f[0].slice(d);
4492 var w = Bo(a, d), k = Bo(c, h.length ? Ii(h).length - p : 0);
4493 return f.length > 1 || f[0] || _o(w, k) ? (In(e.doc, f, w, k, "+input"), !0) : void 0;
4494 },
4495 ensurePolled: function() {
4496 this.forceCompositionEnd();
4497 },
4498 reset: function() {
4499 this.forceCompositionEnd();
4500 },
4501 forceCompositionEnd: function() {
4502 this.composing && !this.composing.handled && (this.applyComposition(this.composing),
4503 this.composing.handled = !0, this.div.blur(), this.div.focus());
4504 },
4505 applyComposition: function(e) {
4506 this.cm.isReadOnly() ? Et(this.cm, Dt)(this.cm) : e.data && e.data != e.startData && Et(this.cm, Z)(this.cm, e.data, 0, e.sel);
4507 },
4508 setUneditable: function(e) {
4509 e.contentEditable = "false";
4510 },
4511 onKeyPress: function(e) {
4512 e.preventDefault(), this.cm.isReadOnly() || Et(this.cm, Z)(this.cm, String.fromCharCode(null == e.charCode ? e.keyCode : e.charCode), 0);
4513 },
4514 readOnlyChanged: function(e) {
4515 this.div.contentEditable = String("nocursor" != e);
4516 },
4517 onContextMenu: Di,
4518 resetPosition: Di,
4519 needsContentAttribute: !0
4520 }, ie.prototype), e.inputStyles = {
4521 textarea: ne,
4522 contenteditable: ie
4523 }, ue.prototype = {
4524 primary: function() {
4525 return this.ranges[this.primIndex];
4526 },
4527 equals: function(e) {
4528 if (e == this) return !0;
4529 if (e.primIndex != this.primIndex || e.ranges.length != this.ranges.length) return !1;
4530 for (var t = 0; t < this.ranges.length; t++) {
4531 var n = this.ranges[t], r = e.ranges[t];
4532 if (0 != _o(n.anchor, r.anchor) || 0 != _o(n.head, r.head)) return !1;
4533 }
4534 return !0;
4535 },
4536 deepCopy: function() {
4537 for (var e = [], t = 0; t < this.ranges.length; t++) e[t] = new fe($(this.ranges[t].anchor), $(this.ranges[t].head));
4538 return new ue(e, this.primIndex);
4539 },
4540 somethingSelected: function() {
4541 for (var e = 0; e < this.ranges.length; e++) if (!this.ranges[e].empty()) return !0;
4542 return !1;
4543 },
4544 contains: function(e, t) {
4545 t || (t = e);
4546 for (var n = 0; n < this.ranges.length; n++) {
4547 var r = this.ranges[n];
4548 if (_o(t, r.from()) >= 0 && _o(e, r.to()) <= 0) return n;
4549 }
4550 return -1;
4551 }
4552 }, fe.prototype = {
4553 from: function() {
4554 return K(this.anchor, this.head);
4555 },
4556 to: function() {
4557 return V(this.anchor, this.head);
4558 },
4559 empty: function() {
4560 return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;
4561 }
4562 };
4563 var zo, jo, Uo, qo = {
4564 left: 0,
4565 right: 0,
4566 top: 0,
4567 bottom: 0
4568 }, Go = null, Yo = 0, $o = 0, Vo = 0, Ko = null;
4569 xo ? Ko = -.53 : go ? Ko = 15 : So ? Ko = -.7 : Lo && (Ko = -1 / 3);
4570 var Xo = function(e) {
4571 var t = e.wheelDeltaX, n = e.wheelDeltaY;
4572 return null == t && e.detail && e.axis == e.HORIZONTAL_AXIS && (t = e.detail), null == n && e.detail && e.axis == e.VERTICAL_AXIS ? n = e.detail : null == n && (n = e.wheelDelta),
4573 {
4574 x: t,
4575 y: n
4576 };
4577 };
4578 e.wheelEventPixels = function(e) {
4579 var t = Xo(e);
4580 return t.x *= Ko, t.y *= Ko, t;
4581 };
4582 var Zo = new Ei, Jo = null, Qo = e.changeEnd = function(e) {
4583 return e.text ? Bo(e.from.line + e.text.length - 1, Ii(e.text).length + (1 == e.text.length ? e.from.ch : 0)) : e.to;
4584 };
4585 e.prototype = {
4586 constructor: e,
4587 focus: function() {
4588 window.focus(), this.display.input.focus();
4589 },
4590 setOption: function(e, t) {
4591 var n = this.options, r = n[e];
4592 n[e] == t && "mode" != e || (n[e] = t, ta.hasOwnProperty(e) && Et(this, ta[e])(this, t, r));
4593 },
4594 getOption: function(e) {
4595 return this.options[e];
4596 },
4597 getDoc: function() {
4598 return this.doc;
4599 },
4600 addKeyMap: function(e, t) {
4601 this.state.keyMaps[t ? "push" : "unshift"]($n(e));
4602 },
4603 removeKeyMap: function(e) {
4604 for (var t = this.state.keyMaps, n = 0; n < t.length; ++n) if (t[n] == e || t[n].name == e) return t.splice(n, 1),
4605 !0;
4606 },
4607 addOverlay: Ot((function(t, n) {
4608 var r = t.token ? t : e.getMode(this.options, t);
4609 if (r.startState) throw new Error("Overlays may not be stateful.");
4610 this.state.overlays.push({
4611 mode: r,
4612 modeSpec: t,
4613 opaque: n && n.opaque
4614 }), this.state.modeGen++, Dt(this);
4615 })),
4616 removeOverlay: Ot((function(e) {
4617 for (var t = this.state.overlays, n = 0; n < t.length; ++n) {
4618 var r = t[n].modeSpec;
4619 if (r == e || "string" == typeof e && r.name == e) return t.splice(n, 1), this.state.modeGen++,
4620 void Dt(this);
4621 }
4622 })),
4623 indentLine: Ot((function(e, t, n) {
4624 "string" != typeof t && "number" != typeof t && (t = null == t ? this.options.smartIndent ? "smart" : "prev" : t ? "add" : "subtract"),
4625 ve(this.doc, e) && Fn(this, e, t, n);
4626 })),
4627 indentSelection: Ot((function(e) {
4628 for (var t = this.doc.sel.ranges, n = -1, r = 0; r < t.length; r++) {
4629 var i = t[r];
4630 if (i.empty()) i.head.line > n && (Fn(this, i.head.line, e, !0), n = i.head.line,
4631 r == this.doc.sel.primIndex && Bn(this)); else {
4632 var o = i.from(), a = i.to(), l = Math.max(n, o.line);
4633 n = Math.min(this.lastLine(), a.line - (a.ch ? 0 : 1)) + 1;
4634 for (var s = l; n > s; ++s) Fn(this, s, e);
4635 var c = this.doc.sel.ranges;
4636 0 == o.ch && t.length == c.length && c[r].from().ch > 0 && ke(this.doc, r, new fe(o, c[r].to()), Wa);
4637 }
4638 }
4639 })),
4640 getTokenAt: function(e, t) {
4641 return Ir(this, e, t);
4642 },
4643 getLineTokens: function(e, t) {
4644 return Ir(this, Bo(e), t, !0);
4645 },
4646 getTokenTypeAt: function(e) {
4647 e = me(this.doc, e);
4648 var t, n = Dr(this, Zr(this.doc, e.line)), r = 0, i = (n.length - 1) / 2, o = e.ch;
4649 if (0 == o) t = n[2]; else for (;;) {
4650 var a = r + i >> 1;
4651 if ((a ? n[2 * a - 1] : 0) >= o) i = a; else {
4652 if (!(n[2 * a + 1] < o)) {
4653 t = n[2 * a + 2];
4654 break;
4655 }
4656 r = a + 1;
4657 }
4658 }
4659 var l = t ? t.indexOf("cm-overlay ") : -1;
4660 return 0 > l ? t : 0 == l ? null : t.slice(0, l - 1);
4661 },
4662 getModeAt: function(t) {
4663 var n = this.doc.mode;
4664 return n.innerMode ? e.innerMode(n, this.getTokenAt(t).state).mode : n;
4665 },
4666 getHelper: function(e, t) {
4667 return this.getHelpers(e, t)[0];
4668 },
4669 getHelpers: function(e, t) {
4670 var n = [];
4671 if (!la.hasOwnProperty(t)) return n;
4672 var r = la[t], i = this.getModeAt(e);
4673 if ("string" == typeof i[t]) r[i[t]] && n.push(r[i[t]]); else if (i[t]) for (var o = 0; o < i[t].length; o++) {
4674 var a = r[i[t][o]];
4675 a && n.push(a);
4676 } else i.helperType && r[i.helperType] ? n.push(r[i.helperType]) : r[i.name] && n.push(r[i.name]);
4677 for (o = 0; o < r._global.length; o++) {
4678 var l = r._global[o];
4679 l.pred(i, this) && -1 == Pi(n, l.val) && n.push(l.val);
4680 }
4681 return n;
4682 },
4683 getStateAfter: function(e, t) {
4684 var n = this.doc;
4685 return je(this, (e = pe(n, null == e ? n.first + n.size - 1 : e)) + 1, t);
4686 },
4687 cursorCoords: function(e, t) {
4688 var r = this.doc.sel.primary();
4689 return dt(this, null == e ? r.head : "object" == typeof e ? me(this.doc, e) : e ? r.from() : r.to(), t || "page");
4690 },
4691 charCoords: function(e, t) {
4692 return ht(this, me(this.doc, e), t || "page");
4693 },
4694 coordsChar: function(e, t) {
4695 return gt(this, (e = ft(this, e, t || "page")).left, e.top);
4696 },
4697 lineAtHeight: function(e, t) {
4698 return e = ft(this, {
4699 top: e,
4700 left: 0
4701 }, t || "page").top, ni(this.doc, e + this.display.viewOffset);
4702 },
4703 heightAtLine: function(e, t) {
4704 var n, r = !1;
4705 if ("number" == typeof e) {
4706 var i = this.doc.first + this.doc.size - 1;
4707 e < this.doc.first ? e = this.doc.first : e > i && (e = i, r = !0), n = Zr(this.doc, e);
4708 } else n = e;
4709 return ut(this, n, {
4710 top: 0,
4711 left: 0
4712 }, t || "page").top + (r ? this.doc.height - ri(n) : 0);
4713 },
4714 defaultTextHeight: function() {
4715 return yt(this.display);
4716 },
4717 defaultCharWidth: function() {
4718 return xt(this.display);
4719 },
4720 setGutterMarker: Ot((function(e, t, n) {
4721 return zn(this.doc, e, "gutter", (function(e) {
4722 var r = e.gutterMarkers || (e.gutterMarkers = {});
4723 return r[t] = n, !n && Fi(r) && (e.gutterMarkers = null), !0;
4724 }));
4725 })),
4726 clearGutter: Ot((function(e) {
4727 var t = this, n = t.doc, r = n.first;
4728 n.iter((function(n) {
4729 n.gutterMarkers && n.gutterMarkers[e] && (n.gutterMarkers[e] = null, Ht(t, r, "gutter"),
4730 Fi(n.gutterMarkers) && (n.gutterMarkers = null)), ++r;
4731 }));
4732 })),
4733 lineInfo: function(e) {
4734 if ("number" == typeof e) {
4735 if (!ve(this.doc, e)) return null;
4736 var t = e;
4737 if (!(e = Zr(this.doc, e))) return null;
4738 } else if (null == (t = ti(e))) return null;
4739 return {
4740 line: t,
4741 handle: e,
4742 text: e.text,
4743 gutterMarkers: e.gutterMarkers,
4744 textClass: e.textClass,
4745 bgClass: e.bgClass,
4746 wrapClass: e.wrapClass,
4747 widgets: e.widgets
4748 };
4749 },
4750 getViewport: function() {
4751 return {
4752 from: this.display.viewFrom,
4753 to: this.display.viewTo
4754 };
4755 },
4756 addWidget: function(e, t, n, r, i) {
4757 var o = this.display, a = (e = dt(this, me(this.doc, e))).bottom, l = e.left;
4758 if (t.style.position = "absolute", t.setAttribute("cm-ignore-events", "true"), this.display.input.setUneditable(t),
4759 o.sizer.appendChild(t), "over" == r) a = e.top; else if ("above" == r || "near" == r) {
4760 var s = Math.max(o.wrapper.clientHeight, this.doc.height), c = Math.max(o.sizer.clientWidth, o.lineSpace.clientWidth);
4761 ("above" == r || e.bottom + t.offsetHeight > s) && e.top > t.offsetHeight ? a = e.top - t.offsetHeight : e.bottom + t.offsetHeight <= s && (a = e.bottom),
4762 l + t.offsetWidth > c && (l = c - t.offsetWidth);
4763 }
4764 t.style.top = a + "px", t.style.left = t.style.right = "", "right" == i ? (l = o.sizer.clientWidth - t.offsetWidth,
4765 t.style.right = "0px") : ("left" == i ? l = 0 : "middle" == i && (l = (o.sizer.clientWidth - t.offsetWidth) / 2),
4766 t.style.left = l + "px"), n && Dn(this, l, a, l + t.offsetWidth, a + t.offsetHeight);
4767 },
4768 triggerOnKeyDown: Ot(hn),
4769 triggerOnKeyPress: Ot(mn),
4770 triggerOnKeyUp: pn,
4771 execCommand: function(e) {
4772 return ua.hasOwnProperty(e) ? ua[e].call(null, this) : void 0;
4773 },
4774 triggerElectric: Ot((function(e) {
4775 Q(this, e);
4776 })),
4777 findPosH: function(e, t, n, r) {
4778 var i = 1;
4779 0 > t && (i = -1, t = -t);
4780 for (var o = 0, a = me(this.doc, e); t > o && !(a = Un(this.doc, a, i, n, r)).hitSide; ++o) ;
4781 return a;
4782 },
4783 moveH: Ot((function(e, t) {
4784 var n = this;
4785 n.extendSelectionsBy((function(r) {
4786 return n.display.shift || n.doc.extend || r.empty() ? Un(n.doc, r.head, e, t, n.options.rtlMoveVisually) : 0 > e ? r.from() : r.to();
4787 }), _a);
4788 })),
4789 deleteH: Ot((function(e, t) {
4790 var n = this.doc.sel, r = this.doc;
4791 n.somethingSelected() ? r.replaceSelection("", null, "+delete") : jn(this, (function(n) {
4792 var i = Un(r, n.head, e, t, !1);
4793 return 0 > e ? {
4794 from: i,
4795 to: n.head
4796 } : {
4797 from: n.head,
4798 to: i
4799 };
4800 }));
4801 })),
4802 findPosV: function(e, t, n, r) {
4803 var i = 1, o = r;
4804 0 > t && (i = -1, t = -t);
4805 for (var a = 0, l = me(this.doc, e); t > a; ++a) {
4806 var s = dt(this, l, "div");
4807 if (null == o ? o = s.left : s.left = o, (l = qn(this, s, i, n)).hitSide) break;
4808 }
4809 return l;
4810 },
4811 moveV: Ot((function(e, t) {
4812 var n = this, r = this.doc, i = [], o = !n.display.shift && !r.extend && r.sel.somethingSelected();
4813 if (r.extendSelectionsBy((function(a) {
4814 if (o) return 0 > e ? a.from() : a.to();
4815 var l = dt(n, a.head, "div");
4816 null != a.goalColumn && (l.left = a.goalColumn), i.push(l.left);
4817 var s = qn(n, l, e, t);
4818 return "page" == t && a == r.sel.primary() && Wn(n, null, ht(n, s, "div").top - l.top),
4819 s;
4820 }), _a), i.length) for (var a = 0; a < r.sel.ranges.length; a++) r.sel.ranges[a].goalColumn = i[a];
4821 })),
4822 findWordAt: function(e) {
4823 var n = Zr(this.doc, e.line).text, r = e.ch, i = e.ch;
4824 if (n) {
4825 var o = this.getHelper(e, "wordChars");
4826 (e.xRel < 0 || i == n.length) && r ? --r : ++i;
4827 for (var a = n.charAt(r), l = _i(a, o) ? function(e) {
4828 return _i(e, o);
4829 } : /\s/.test(a) ? function(e) {
4830 return /\s/.test(e);
4831 } : function(e) {
4832 return !/\s/.test(e) && !_i(e);
4833 }; r > 0 && l(n.charAt(r - 1)); ) --r;
4834 for (;i < n.length && l(n.charAt(i)); ) ++i;
4835 }
4836 return new fe(Bo(e.line, r), Bo(e.line, i));
4837 },
4838 toggleOverwrite: function(e) {
4839 null != e && e == this.state.overwrite || ((this.state.overwrite = !this.state.overwrite) ? Ja(this.display.cursorDiv, "CodeMirror-overwrite") : Za(this.display.cursorDiv, "CodeMirror-overwrite"),
4840 Pa(this, "overwriteToggle", this, this.state.overwrite));
4841 },
4842 hasFocus: function() {
4843 return this.display.input.getField() == Gi();
4844 },
4845 isReadOnly: function() {
4846 return !(!this.options.readOnly && !this.doc.cantEdit);
4847 },
4848 scrollTo: Ot((function(e, t) {
4849 null == e && null == t || _n(this), null != e && (this.curOp.scrollLeft = e), null != t && (this.curOp.scrollTop = t);
4850 })),
4851 getScrollInfo: function() {
4852 var e = this.display.scroller;
4853 return {
4854 left: e.scrollLeft,
4855 top: e.scrollTop,
4856 height: e.scrollHeight - Ye(this) - this.display.barHeight,
4857 width: e.scrollWidth - Ye(this) - this.display.barWidth,
4858 clientHeight: Ve(this),
4859 clientWidth: $e(this)
4860 };
4861 },
4862 scrollIntoView: Ot((function(e, t) {
4863 if (null == e ? (e = {
4864 from: this.doc.sel.primary().head,
4865 to: null
4866 }, null == t && (t = this.options.cursorScrollMargin)) : "number" == typeof e ? e = {
4867 from: Bo(e, 0),
4868 to: null
4869 } : null == e.from && (e = {
4870 from: e,
4871 to: null
4872 }), e.to || (e.to = e.from), e.margin = t || 0, null != e.from.line) _n(this), this.curOp.scrollToPos = e; else {
4873 var n = Hn(this, Math.min(e.from.left, e.to.left), Math.min(e.from.top, e.to.top) - e.margin, Math.max(e.from.right, e.to.right), Math.max(e.from.bottom, e.to.bottom) + e.margin);
4874 this.scrollTo(n.scrollLeft, n.scrollTop);
4875 }
4876 })),
4877 setSize: Ot((function(e, t) {
4878 function n(e) {
4879 return "number" == typeof e || /^\d+$/.test(String(e)) ? e + "px" : e;
4880 }
4881 var r = this;
4882 null != e && (r.display.wrapper.style.width = n(e)), null != t && (r.display.wrapper.style.height = n(t)),
4883 r.options.lineWrapping && at(this);
4884 var i = r.display.viewFrom;
4885 r.doc.iter(i, r.display.viewTo, (function(e) {
4886 if (e.widgets) for (var t = 0; t < e.widgets.length; t++) if (e.widgets[t].noHScroll) {
4887 Ht(r, i, "widget");
4888 break;
4889 }
4890 ++i;
4891 })), r.curOp.forceUpdate = !0, Pa(r, "refresh", this);
4892 })),
4893 operation: function(e) {
4894 return At(this, e);
4895 },
4896 refresh: Ot((function() {
4897 var e = this.display.cachedTextHeight;
4898 Dt(this), this.curOp.forceUpdate = !0, lt(this), this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop),
4899 u(this), (null == e || Math.abs(e - yt(this.display)) > .5) && a(this), Pa(this, "refresh", this);
4900 })),
4901 swapDoc: Ot((function(e) {
4902 var t = this.doc;
4903 return t.cm = null, Xr(this, e), lt(this), this.display.input.reset(), this.scrollTo(e.scrollLeft, e.scrollTop),
4904 this.curOp.forceScroll = !0, Ci(this, "swapDoc", this, t), t;
4905 })),
4906 getInputField: function() {
4907 return this.display.input.getField();
4908 },
4909 getWrapperElement: function() {
4910 return this.display.wrapper;
4911 },
4912 getScrollerElement: function() {
4913 return this.display.scroller;
4914 },
4915 getGutterElement: function() {
4916 return this.display.gutters;
4917 }
4918 }, Ai(e);
4919 var ea = e.defaults = {}, ta = e.optionHandlers = {}, na = e.Init = {
4920 toString: function() {
4921 return "CodeMirror.Init";
4922 }
4923 };
4924 Gn("value", "", (function(e, t) {
4925 e.setValue(t);
4926 }), !0), Gn("mode", null, (function(e, t) {
4927 e.doc.modeOption = t, n(e);
4928 }), !0), Gn("indentUnit", 2, n, !0), Gn("indentWithTabs", !1), Gn("smartIndent", !0),
4929 Gn("tabSize", 4, (function(e) {
4930 r(e), lt(e), Dt(e);
4931 }), !0), Gn("lineSeparator", null, (function(e, t) {
4932 if (e.doc.lineSep = t, t) {
4933 var n = [], r = e.doc.first;
4934 e.doc.iter((function(e) {
4935 for (var i = 0; ;) {
4936 var o = e.text.indexOf(t, i);
4937 if (-1 == o) break;
4938 i = o + t.length, n.push(Bo(r, o));
4939 }
4940 r++;
4941 }));
4942 for (var i = n.length - 1; i >= 0; i--) In(e.doc, t, n[i], Bo(n[i].line, n[i].ch + t.length));
4943 }
4944 })), Gn("specialChars", /[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, (function(t, n, r) {
4945 t.state.specialChars = new RegExp(n.source + (n.test("\t") ? "" : "|\t"), "g"),
4946 r != e.Init && t.refresh();
4947 })), Gn("specialCharPlaceholder", _r, (function(e) {
4948 e.refresh();
4949 }), !0), Gn("electricChars", !0), Gn("inputStyle", Ao ? "contenteditable" : "textarea", (function() {
4950 throw new Error("inputStyle can not (yet) be changed in a running editor");
4951 }), !0), Gn("rtlMoveVisually", !Io), Gn("wholeLineUpdateBefore", !0), Gn("theme", "default", (function(e) {
4952 l(e), s(e);
4953 }), !0), Gn("keyMap", "default", (function(t, n, r) {
4954 var i = $n(n), o = r != e.Init && $n(r);
4955 o && o.detach && o.detach(t, i), i.attach && i.attach(t, o || null);
4956 })), Gn("extraKeys", null), Gn("lineWrapping", !1, i, !0), Gn("gutters", [], (function(e) {
4957 d(e.options), s(e);
4958 }), !0), Gn("fixedGutter", !0, (function(e, t) {
4959 e.display.gutters.style.left = t ? C(e.display) + "px" : "0", e.refresh();
4960 }), !0), Gn("coverGutterNextToScrollbar", !1, (function(e) {
4961 y(e);
4962 }), !0), Gn("scrollbarStyle", "native", (function(e) {
4963 v(e), y(e), e.display.scrollbars.setScrollTop(e.doc.scrollTop), e.display.scrollbars.setScrollLeft(e.doc.scrollLeft);
4964 }), !0), Gn("lineNumbers", !1, (function(e) {
4965 d(e.options), s(e);
4966 }), !0), Gn("firstLineNumber", 1, s, !0), Gn("lineNumberFormatter", (function(e) {
4967 return e;
4968 }), s, !0), Gn("showCursorWhenSelecting", !1, Re, !0), Gn("resetSelectionOnContextMenu", !0),
4969 Gn("lineWiseCopyCut", !0), Gn("readOnly", !1, (function(e, t) {
4970 "nocursor" == t ? (yn(e), e.display.input.blur(), e.display.disabled = !0) : e.display.disabled = !1,
4971 e.display.input.readOnlyChanged(t);
4972 })), Gn("disableInput", !1, (function(e, t) {
4973 t || e.display.input.reset();
4974 }), !0), Gn("dragDrop", !0, Ut), Gn("allowDropFileTypes", null), Gn("cursorBlinkRate", 530),
4975 Gn("cursorScrollMargin", 0), Gn("cursorHeight", 1, Re, !0), Gn("singleCursorHeightPerLine", !0, Re, !0),
4976 Gn("workTime", 100), Gn("workDelay", 100), Gn("flattenSpans", !0, r, !0), Gn("addModeClass", !1, r, !0),
4977 Gn("pollInterval", 100), Gn("undoDepth", 200, (function(e, t) {
4978 e.doc.history.undoDepth = t;
4979 })), Gn("historyEventDelay", 1250), Gn("viewportMargin", 10, (function(e) {
4980 e.refresh();
4981 }), !0), Gn("maxHighlightLength", 1e4, r, !0), Gn("moveInputWithCursor", !0, (function(e, t) {
4982 t || e.display.input.resetPosition();
4983 })), Gn("tabindex", null, (function(e, t) {
4984 e.display.input.getField().tabIndex = t || "";
4985 })), Gn("autofocus", null);
4986 var ra = e.modes = {}, ia = e.mimeModes = {};
4987 e.defineMode = function(t, n) {
4988 e.defaults.mode || "null" == t || (e.defaults.mode = t), arguments.length > 2 && (n.dependencies = Array.prototype.slice.call(arguments, 2)),
4989 ra[t] = n;
4990 }, e.defineMIME = function(e, t) {
4991 ia[e] = t;
4992 }, e.resolveMode = function(t) {
4993 if ("string" == typeof t && ia.hasOwnProperty(t)) t = ia[t]; else if (t && "string" == typeof t.name && ia.hasOwnProperty(t.name)) {
4994 var n = ia[t.name];
4995 "string" == typeof n && (n = {
4996 name: n
4997 }), (t = Hi(n, t)).name = n.name;
4998 } else if ("string" == typeof t && /^[\w\-]+\/[\w\-]+\+xml$/.test(t)) return e.resolveMode("application/xml");
4999 return "string" == typeof t ? {
5000 name: t
5001 } : t || {
5002 name: "null"
5003 };
5004 }, e.getMode = function(t, n) {
5005 n = e.resolveMode(n);
5006 var r = ra[n.name];
5007 if (!r) return e.getMode(t, "text/plain");
5008 var i = r(t, n);
5009 if (oa.hasOwnProperty(n.name)) {
5010 var o = oa[n.name];
5011 for (var a in o) o.hasOwnProperty(a) && (i.hasOwnProperty(a) && (i["_" + a] = i[a]),
5012 i[a] = o[a]);
5013 }
5014 if (i.name = n.name, n.helperType && (i.helperType = n.helperType), n.modeProps) for (var a in n.modeProps) i[a] = n.modeProps[a];
5015 return i;
5016 }, e.defineMode("null", (function() {
5017 return {
5018 token: function(e) {
5019 e.skipToEnd();
5020 }
5021 };
5022 })), e.defineMIME("text/plain", "null");
5023 var oa = e.modeExtensions = {};
5024 e.extendMode = function(e, t) {
5025 Wi(t, oa.hasOwnProperty(e) ? oa[e] : oa[e] = {});
5026 }, e.defineExtension = function(t, n) {
5027 e.prototype[t] = n;
5028 }, e.defineDocExtension = function(e, t) {
5029 Ca.prototype[e] = t;
5030 }, e.defineOption = Gn;
5031 var aa = [];
5032 e.defineInitHook = function(e) {
5033 aa.push(e);
5034 };
5035 var la = e.helpers = {};
5036 e.registerHelper = function(t, n, r) {
5037 la.hasOwnProperty(t) || (la[t] = e[t] = {
5038 _global: []
5039 }), la[t][n] = r;
5040 }, e.registerGlobalHelper = function(t, n, r, i) {
5041 e.registerHelper(t, n, i), la[t]._global.push({
5042 pred: r,
5043 val: i
5044 });
5045 };
5046 var sa = e.copyState = function(e, t) {
5047 if (!0 === t) return t;
5048 if (e.copyState) return e.copyState(t);
5049 var n = {};
5050 for (var r in t) {
5051 var i = t[r];
5052 i instanceof Array && (i = i.concat([])), n[r] = i;
5053 }
5054 return n;
5055 }, ca = e.startState = function(e, t, n) {
5056 return !e.startState || e.startState(t, n);
5057 };
5058 e.innerMode = function(e, t) {
5059 for (;e.innerMode; ) {
5060 var n = e.innerMode(t);
5061 if (!n || n.mode == e) break;
5062 t = n.state, e = n.mode;
5063 }
5064 return n || {
5065 mode: e,
5066 state: t
5067 };
5068 };
5069 var ua = e.commands = {
5070 selectAll: function(e) {
5071 e.setSelection(Bo(e.firstLine(), 0), Bo(e.lastLine()), Wa);
5072 },
5073 singleSelection: function(e) {
5074 e.setSelection(e.getCursor("anchor"), e.getCursor("head"), Wa);
5075 },
5076 killLine: function(e) {
5077 jn(e, (function(t) {
5078 if (t.empty()) {
5079 var n = Zr(e.doc, t.head.line).text.length;
5080 return t.head.ch == n && t.head.line < e.lastLine() ? {
5081 from: t.head,
5082 to: Bo(t.head.line + 1, 0)
5083 } : {
5084 from: t.head,
5085 to: Bo(t.head.line, n)
5086 };
5087 }
5088 return {
5089 from: t.from(),
5090 to: t.to()
5091 };
5092 }));
5093 },
5094 deleteLine: function(e) {
5095 jn(e, (function(t) {
5096 return {
5097 from: Bo(t.from().line, 0),
5098 to: me(e.doc, Bo(t.to().line + 1, 0))
5099 };
5100 }));
5101 },
5102 delLineLeft: function(e) {
5103 jn(e, (function(e) {
5104 return {
5105 from: Bo(e.from().line, 0),
5106 to: e.from()
5107 };
5108 }));
5109 },
5110 delWrappedLineLeft: function(e) {
5111 jn(e, (function(t) {
5112 var n = e.charCoords(t.head, "div").top + 5;
5113 return {
5114 from: e.coordsChar({
5115 left: 0,
5116 top: n
5117 }, "div"),
5118 to: t.from()
5119 };
5120 }));
5121 },
5122 delWrappedLineRight: function(e) {
5123 jn(e, (function(t) {
5124 var n = e.charCoords(t.head, "div").top + 5, r = e.coordsChar({
5125 left: e.display.lineDiv.offsetWidth + 100,
5126 top: n
5127 }, "div");
5128 return {
5129 from: t.from(),
5130 to: r
5131 };
5132 }));
5133 },
5134 undo: function(e) {
5135 e.undo();
5136 },
5137 redo: function(e) {
5138 e.redo();
5139 },
5140 undoSelection: function(e) {
5141 e.undoSelection();
5142 },
5143 redoSelection: function(e) {
5144 e.redoSelection();
5145 },
5146 goDocStart: function(e) {
5147 e.extendSelection(Bo(e.firstLine(), 0));
5148 },
5149 goDocEnd: function(e) {
5150 e.extendSelection(Bo(e.lastLine()));
5151 },
5152 goLineStart: function(e) {
5153 e.extendSelectionsBy((function(t) {
5154 return oo(e, t.head.line);
5155 }), {
5156 origin: "+move",
5157 bias: 1
5158 });
5159 },
5160 goLineStartSmart: function(e) {
5161 e.extendSelectionsBy((function(t) {
5162 return lo(e, t.head);
5163 }), {
5164 origin: "+move",
5165 bias: 1
5166 });
5167 },
5168 goLineEnd: function(e) {
5169 e.extendSelectionsBy((function(t) {
5170 return ao(e, t.head.line);
5171 }), {
5172 origin: "+move",
5173 bias: -1
5174 });
5175 },
5176 goLineRight: function(e) {
5177 e.extendSelectionsBy((function(t) {
5178 var n = e.charCoords(t.head, "div").top + 5;
5179 return e.coordsChar({
5180 left: e.display.lineDiv.offsetWidth + 100,
5181 top: n
5182 }, "div");
5183 }), _a);
5184 },
5185 goLineLeft: function(e) {
5186 e.extendSelectionsBy((function(t) {
5187 var n = e.charCoords(t.head, "div").top + 5;
5188 return e.coordsChar({
5189 left: 0,
5190 top: n
5191 }, "div");
5192 }), _a);
5193 },
5194 goLineLeftSmart: function(e) {
5195 e.extendSelectionsBy((function(t) {
5196 var n = e.charCoords(t.head, "div").top + 5, r = e.coordsChar({
5197 left: 0,
5198 top: n
5199 }, "div");
5200 return r.ch < e.getLine(r.line).search(/\S/) ? lo(e, t.head) : r;
5201 }), _a);
5202 },
5203 goLineUp: function(e) {
5204 e.moveV(-1, "line");
5205 },
5206 goLineDown: function(e) {
5207 e.moveV(1, "line");
5208 },
5209 goPageUp: function(e) {
5210 e.moveV(-1, "page");
5211 },
5212 goPageDown: function(e) {
5213 e.moveV(1, "page");
5214 },
5215 goCharLeft: function(e) {
5216 e.moveH(-1, "char");
5217 },
5218 goCharRight: function(e) {
5219 e.moveH(1, "char");
5220 },
5221 goColumnLeft: function(e) {
5222 e.moveH(-1, "column");
5223 },
5224 goColumnRight: function(e) {
5225 e.moveH(1, "column");
5226 },
5227 goWordLeft: function(e) {
5228 e.moveH(-1, "word");
5229 },
5230 goGroupRight: function(e) {
5231 e.moveH(1, "group");
5232 },
5233 goGroupLeft: function(e) {
5234 e.moveH(-1, "group");
5235 },
5236 goWordRight: function(e) {
5237 e.moveH(1, "word");
5238 },
5239 delCharBefore: function(e) {
5240 e.deleteH(-1, "char");
5241 },
5242 delCharAfter: function(e) {
5243 e.deleteH(1, "char");
5244 },
5245 delWordBefore: function(e) {
5246 e.deleteH(-1, "word");
5247 },
5248 delWordAfter: function(e) {
5249 e.deleteH(1, "word");
5250 },
5251 delGroupBefore: function(e) {
5252 e.deleteH(-1, "group");
5253 },
5254 delGroupAfter: function(e) {
5255 e.deleteH(1, "group");
5256 },
5257 indentAuto: function(e) {
5258 e.indentSelection("smart");
5259 },
5260 indentMore: function(e) {
5261 e.indentSelection("add");
5262 },
5263 indentLess: function(e) {
5264 e.indentSelection("subtract");
5265 },
5266 insertTab: function(e) {
5267 e.replaceSelection("\t");
5268 },
5269 insertSoftTab: function(e) {
5270 for (var t = [], n = e.listSelections(), r = e.options.tabSize, i = 0; i < n.length; i++) {
5271 var o = n[i].from(), a = Fa(e.getLine(o.line), o.ch, r);
5272 t.push(Oi(r - a % r));
5273 }
5274 e.replaceSelections(t);
5275 },
5276 defaultTab: function(e) {
5277 e.somethingSelected() ? e.indentSelection("add") : e.execCommand("insertTab");
5278 },
5279 transposeChars: function(e) {
5280 At(e, (function() {
5281 for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) {
5282 var i = t[r].head, o = Zr(e.doc, i.line).text;
5283 if (o) if (i.ch == o.length && (i = new Bo(i.line, i.ch - 1)), i.ch > 0) i = new Bo(i.line, i.ch + 1),
5284 e.replaceRange(o.charAt(i.ch - 1) + o.charAt(i.ch - 2), Bo(i.line, i.ch - 2), i, "+transpose"); else if (i.line > e.doc.first) {
5285 var a = Zr(e.doc, i.line - 1).text;
5286 a && e.replaceRange(o.charAt(0) + e.doc.lineSeparator() + a.charAt(a.length - 1), Bo(i.line - 1, a.length - 1), Bo(i.line, 1), "+transpose");
5287 }
5288 n.push(new fe(i, i));
5289 }
5290 e.setSelections(n);
5291 }));
5292 },
5293 newlineAndIndent: function(e) {
5294 At(e, (function() {
5295 for (var t = e.listSelections().length, n = 0; t > n; n++) {
5296 var r = e.listSelections()[n];
5297 e.replaceRange(e.doc.lineSeparator(), r.anchor, r.head, "+input"), e.indentLine(r.from().line + 1, null, !0);
5298 }
5299 Bn(e);
5300 }));
5301 },
5302 openLine: function(e) {
5303 e.replaceSelection("\n", "start");
5304 },
5305 toggleOverwrite: function(e) {
5306 e.toggleOverwrite();
5307 }
5308 }, fa = e.keyMap = {};
5309 fa.basic = {
5310 Left: "goCharLeft",
5311 Right: "goCharRight",
5312 Up: "goLineUp",
5313 Down: "goLineDown",
5314 End: "goLineEnd",
5315 Home: "goLineStartSmart",
5316 PageUp: "goPageUp",
5317 PageDown: "goPageDown",
5318 Delete: "delCharAfter",
5319 Backspace: "delCharBefore",
5320 "Shift-Backspace": "delCharBefore",
5321 Tab: "defaultTab",
5322 "Shift-Tab": "indentAuto",
5323 Enter: "newlineAndIndent",
5324 Insert: "toggleOverwrite",
5325 Esc: "singleSelection"
5326 }, fa.pcDefault = {
5327 "Ctrl-A": "selectAll",
5328 "Ctrl-D": "deleteLine",
5329 "Ctrl-Z": "undo",
5330 "Shift-Ctrl-Z": "redo",
5331 "Ctrl-Y": "redo",
5332 "Ctrl-Home": "goDocStart",
5333 "Ctrl-End": "goDocEnd",
5334 "Ctrl-Up": "goLineUp",
5335 "Ctrl-Down": "goLineDown",
5336 "Ctrl-Left": "goGroupLeft",
5337 "Ctrl-Right": "goGroupRight",
5338 "Alt-Left": "goLineStart",
5339 "Alt-Right": "goLineEnd",
5340 "Ctrl-Backspace": "delGroupBefore",
5341 "Ctrl-Delete": "delGroupAfter",
5342 "Ctrl-S": "save",
5343 "Ctrl-F": "find",
5344 "Ctrl-G": "findNext",
5345 "Shift-Ctrl-G": "findPrev",
5346 "Shift-Ctrl-F": "replace",
5347 "Shift-Ctrl-R": "replaceAll",
5348 "Ctrl-[": "indentLess",
5349 "Ctrl-]": "indentMore",
5350 "Ctrl-U": "undoSelection",
5351 "Shift-Ctrl-U": "redoSelection",
5352 "Alt-U": "redoSelection",
5353 fallthrough: "basic"
5354 }, fa.emacsy = {
5355 "Ctrl-F": "goCharRight",
5356 "Ctrl-B": "goCharLeft",
5357 "Ctrl-P": "goLineUp",
5358 "Ctrl-N": "goLineDown",
5359 "Alt-F": "goWordRight",
5360 "Alt-B": "goWordLeft",
5361 "Ctrl-A": "goLineStart",
5362 "Ctrl-E": "goLineEnd",
5363 "Ctrl-V": "goPageDown",
5364 "Shift-Ctrl-V": "goPageUp",
5365 "Ctrl-D": "delCharAfter",
5366 "Ctrl-H": "delCharBefore",
5367 "Alt-D": "delWordAfter",
5368 "Alt-Backspace": "delWordBefore",
5369 "Ctrl-K": "killLine",
5370 "Ctrl-T": "transposeChars",
5371 "Ctrl-O": "openLine"
5372 }, fa.macDefault = {
5373 "Cmd-A": "selectAll",
5374 "Cmd-D": "deleteLine",
5375 "Cmd-Z": "undo",
5376 "Shift-Cmd-Z": "redo",
5377 "Cmd-Y": "redo",
5378 "Cmd-Home": "goDocStart",
5379 "Cmd-Up": "goDocStart",
5380 "Cmd-End": "goDocEnd",
5381 "Cmd-Down": "goDocEnd",
5382 "Alt-Left": "goGroupLeft",
5383 "Alt-Right": "goGroupRight",
5384 "Cmd-Left": "goLineLeft",
5385 "Cmd-Right": "goLineRight",
5386 "Alt-Backspace": "delGroupBefore",
5387 "Ctrl-Alt-Backspace": "delGroupAfter",
5388 "Alt-Delete": "delGroupAfter",
5389 "Cmd-S": "save",
5390 "Cmd-F": "find",
5391 "Cmd-G": "findNext",
5392 "Shift-Cmd-G": "findPrev",
5393 "Cmd-Alt-F": "replace",
5394 "Shift-Cmd-Alt-F": "replaceAll",
5395 "Cmd-[": "indentLess",
5396 "Cmd-]": "indentMore",
5397 "Cmd-Backspace": "delWrappedLineLeft",
5398 "Cmd-Delete": "delWrappedLineRight",
5399 "Cmd-U": "undoSelection",
5400 "Shift-Cmd-U": "redoSelection",
5401 "Ctrl-Up": "goDocStart",
5402 "Ctrl-Down": "goDocEnd",
5403 fallthrough: [ "basic", "emacsy" ]
5404 }, fa.default = Eo ? fa.macDefault : fa.pcDefault, e.normalizeKeyMap = function(e) {
5405 var t = {};
5406 for (var n in e) if (e.hasOwnProperty(n)) {
5407 var r = e[n];
5408 if (/^(name|fallthrough|(de|at)tach)$/.test(n)) continue;
5409 if ("..." == r) {
5410 delete e[n];
5411 continue;
5412 }
5413 for (var i = Ri(n.split(" "), Yn), o = 0; o < i.length; o++) {
5414 var a, l;
5415 o == i.length - 1 ? (l = i.join(" "), a = r) : (l = i.slice(0, o + 1).join(" "),
5416 a = "...");
5417 var s = t[l];
5418 if (s) {
5419 if (s != a) throw new Error("Inconsistent bindings for " + l);
5420 } else t[l] = a;
5421 }
5422 delete e[n];
5423 }
5424 for (var c in t) e[c] = t[c];
5425 return e;
5426 };
5427 var ha = e.lookupKey = function(e, t, n, r) {
5428 var i = (t = $n(t)).call ? t.call(e, r) : t[e];
5429 if (!1 === i) return "nothing";
5430 if ("..." === i) return "multi";
5431 if (null != i && n(i)) return "handled";
5432 if (t.fallthrough) {
5433 if ("[object Array]" != Object.prototype.toString.call(t.fallthrough)) return ha(e, t.fallthrough, n, r);
5434 for (var o = 0; o < t.fallthrough.length; o++) {
5435 var a = ha(e, t.fallthrough[o], n, r);
5436 if (a) return a;
5437 }
5438 }
5439 }, da = e.isModifierKey = function(e) {
5440 var t = "string" == typeof e ? e : ol[e.keyCode];
5441 return "Ctrl" == t || "Alt" == t || "Shift" == t || "Mod" == t;
5442 }, pa = e.keyName = function(e, t) {
5443 if (Co && 34 == e.keyCode && e.char) return !1;
5444 var n = ol[e.keyCode], r = n;
5445 return null != r && !e.altGraphKey && (e.altKey && "Alt" != n && (r = "Alt-" + r),
5446 (Ro ? e.metaKey : e.ctrlKey) && "Ctrl" != n && (r = "Ctrl-" + r), (Ro ? e.ctrlKey : e.metaKey) && "Cmd" != n && (r = "Cmd-" + r),
5447 !t && e.shiftKey && "Shift" != n && (r = "Shift-" + r), r);
5448 };
5449 e.fromTextArea = function(t, n) {
5450 function r() {
5451 t.value = c.getValue();
5452 }
5453 if ((n = n ? Wi(n) : {}).value = t.value, !n.tabindex && t.tabIndex && (n.tabindex = t.tabIndex),
5454 !n.placeholder && t.placeholder && (n.placeholder = t.placeholder), null == n.autofocus) {
5455 var i = Gi();
5456 n.autofocus = i == t || null != t.getAttribute("autofocus") && i == document.body;
5457 }
5458 if (t.form && (Ea(t.form, "submit", r), !n.leaveSubmitMethodAlone)) {
5459 var o = t.form, a = o.submit;
5460 try {
5461 var l = o.submit = function() {
5462 r(), o.submit = a, o.submit(), o.submit = l;
5463 };
5464 } catch (s) {}
5465 }
5466 n.finishInit = function(e) {
5467 e.save = r, e.getTextArea = function() {
5468 return t;
5469 }, e.toTextArea = function() {
5470 e.toTextArea = isNaN, r(), t.parentNode.removeChild(e.getWrapperElement()), t.style.display = "",
5471 t.form && (Ia(t.form, "submit", r), "function" == typeof t.form.submit && (t.form.submit = a));
5472 };
5473 }, t.style.display = "none";
5474 var c = e((function(e) {
5475 t.parentNode.insertBefore(e, t.nextSibling);
5476 }), n);
5477 return c;
5478 };
5479 var ma = e.StringStream = function(e, t) {
5480 this.pos = this.start = 0, this.string = e, this.tabSize = t || 8, this.lastColumnPos = this.lastColumnValue = 0,
5481 this.lineStart = 0;
5482 };
5483 ma.prototype = {
5484 eol: function() {
5485 return this.pos >= this.string.length;
5486 },
5487 sol: function() {
5488 return this.pos == this.lineStart;
5489 },
5490 peek: function() {
5491 return this.string.charAt(this.pos) || void 0;
5492 },
5493 next: function() {
5494 return this.pos < this.string.length ? this.string.charAt(this.pos++) : void 0;
5495 },
5496 eat: function(e) {
5497 var t = this.string.charAt(this.pos);
5498 if ("string" == typeof e) var n = t == e; else n = t && (e.test ? e.test(t) : e(t));
5499 return n ? (++this.pos, t) : void 0;
5500 },
5501 eatWhile: function(e) {
5502 for (var t = this.pos; this.eat(e); ) ;
5503 return this.pos > t;
5504 },
5505 eatSpace: function() {
5506 for (var e = this.pos; /[\s\u00a0]/.test(this.string.charAt(this.pos)); ) ++this.pos;
5507 return this.pos > e;
5508 },
5509 skipToEnd: function() {
5510 this.pos = this.string.length;
5511 },
5512 skipTo: function(e) {
5513 var t = this.string.indexOf(e, this.pos);
5514 return t > -1 ? (this.pos = t, !0) : void 0;
5515 },
5516 backUp: function(e) {
5517 this.pos -= e;
5518 },
5519 column: function() {
5520 return this.lastColumnPos < this.start && (this.lastColumnValue = Fa(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue),
5521 this.lastColumnPos = this.start), this.lastColumnValue - (this.lineStart ? Fa(this.string, this.lineStart, this.tabSize) : 0);
5522 },
5523 indentation: function() {
5524 return Fa(this.string, null, this.tabSize) - (this.lineStart ? Fa(this.string, this.lineStart, this.tabSize) : 0);
5525 },
5526 match: function(e, t, n) {
5527 if ("string" != typeof e) {
5528 var r = this.string.slice(this.pos).match(e);
5529 return r && r.index > 0 ? null : (r && !1 !== t && (this.pos += r[0].length), r);
5530 }
5531 var i = function(e) {
5532 return n ? e.toLowerCase() : e;
5533 };
5534 return i(this.string.substr(this.pos, e.length)) == i(e) ? (!1 !== t && (this.pos += e.length),
5535 !0) : void 0;
5536 },
5537 current: function() {
5538 return this.string.slice(this.start, this.pos);
5539 },
5540 hideFirstChars: function(e, t) {
5541 this.lineStart += e;
5542 try {
5543 return t();
5544 } finally {
5545 this.lineStart -= e;
5546 }
5547 }
5548 };
5549 var ga = 0, va = e.TextMarker = function(e, t) {
5550 this.lines = [], this.type = t, this.doc = e, this.id = ++ga;
5551 };
5552 Ai(va), va.prototype.clear = function() {
5553 if (!this.explicitlyCleared) {
5554 var e = this.doc.cm, t = e && !e.curOp;
5555 if (t && bt(e), Ni(this, "clear")) {
5556 var n = this.find();
5557 n && Ci(this, "clear", n.from, n.to);
5558 }
5559 for (var r = null, i = null, o = 0; o < this.lines.length; ++o) {
5560 var a = this.lines[o], l = er(a.markedSpans, this);
5561 e && !this.collapsed ? Ht(e, ti(a), "text") : e && (null != l.to && (i = ti(a)),
5562 null != l.from && (r = ti(a))), a.markedSpans = tr(a.markedSpans, l), null == l.from && this.collapsed && !kr(this.doc, a) && e && ei(a, yt(e.display));
5563 }
5564 if (e && this.collapsed && !e.options.lineWrapping) for (o = 0; o < this.lines.length; ++o) {
5565 var s = yr(this.lines[o]), c = f(s);
5566 c > e.display.maxLineLength && (e.display.maxLine = s, e.display.maxLineLength = c,
5567 e.display.maxLineChanged = !0);
5568 }
5569 null != r && e && this.collapsed && Dt(e, r, i + 1), this.lines.length = 0, this.explicitlyCleared = !0,
5570 this.atomic && this.doc.cantEdit && (this.doc.cantEdit = !1, e && Ae(e.doc)), e && Ci(e, "markerCleared", e, this),
5571 t && kt(e), this.parent && this.parent.clear();
5572 }
5573 }, va.prototype.find = function(e, t) {
5574 null == e && "bookmark" == this.type && (e = 1);
5575 for (var n, r, i = 0; i < this.lines.length; ++i) {
5576 var o = this.lines[i], a = er(o.markedSpans, this);
5577 if (null != a.from && (n = Bo(t ? o : ti(o), a.from), -1 == e)) return n;
5578 if (null != a.to && (r = Bo(t ? o : ti(o), a.to), 1 == e)) return r;
5579 }
5580 return n && {
5581 from: n,
5582 to: r
5583 };
5584 }, va.prototype.changed = function() {
5585 var e = this.find(-1, !0), t = this, n = this.doc.cm;
5586 e && n && At(n, (function() {
5587 var r = e.line, i = ti(e.line), o = Qe(n, i);
5588 if (o && (ot(o), n.curOp.selectionChanged = n.curOp.forceUpdate = !0), n.curOp.updateMaxLine = !0,
5589 !kr(t.doc, r) && null != t.height) {
5590 var a = t.height;
5591 t.height = null;
5592 var l = Lr(t) - a;
5593 l && ei(r, r.height + l);
5594 }
5595 }));
5596 }, va.prototype.attachLine = function(e) {
5597 if (!this.lines.length && this.doc.cm) {
5598 var t = this.doc.cm.curOp;
5599 t.maybeHiddenMarkers && -1 != Pi(t.maybeHiddenMarkers, this) || (t.maybeUnhiddenMarkers || (t.maybeUnhiddenMarkers = [])).push(this);
5600 }
5601 this.lines.push(e);
5602 }, va.prototype.detachLine = function(e) {
5603 if (this.lines.splice(Pi(this.lines, e), 1), !this.lines.length && this.doc.cm) {
5604 var t = this.doc.cm.curOp;
5605 (t.maybeHiddenMarkers || (t.maybeHiddenMarkers = [])).push(this);
5606 }
5607 }, ga = 0;
5608 var ya = e.SharedTextMarker = function(e, t) {
5609 this.markers = e, this.primary = t;
5610 for (var n = 0; n < e.length; ++n) e[n].parent = this;
5611 };
5612 Ai(ya), ya.prototype.clear = function() {
5613 if (!this.explicitlyCleared) {
5614 this.explicitlyCleared = !0;
5615 for (var e = 0; e < this.markers.length; ++e) this.markers[e].clear();
5616 Ci(this, "clear");
5617 }
5618 }, ya.prototype.find = function(e, t) {
5619 return this.primary.find(e, t);
5620 };
5621 var xa = e.LineWidget = function(e, t, n) {
5622 if (n) for (var r in n) n.hasOwnProperty(r) && (this[r] = n[r]);
5623 this.doc = e, this.node = t;
5624 };
5625 Ai(xa), xa.prototype.clear = function() {
5626 var e = this.doc.cm, t = this.line.widgets, n = this.line, r = ti(n);
5627 if (null != r && t) {
5628 for (var i = 0; i < t.length; ++i) t[i] == this && t.splice(i--, 1);
5629 t.length || (n.widgets = null);
5630 var o = Lr(this);
5631 ei(n, Math.max(0, n.height - o)), e && At(e, (function() {
5632 Cr(e, n, -o), Ht(e, r, "widget");
5633 }));
5634 }
5635 }, xa.prototype.changed = function() {
5636 var e = this.height, t = this.doc.cm, n = this.line;
5637 this.height = null;
5638 var r = Lr(this) - e;
5639 r && (ei(n, n.height + r), t && At(t, (function() {
5640 t.curOp.forceUpdate = !0, Cr(t, n, r);
5641 })));
5642 };
5643 var ba = e.Line = function(e, t, n) {
5644 this.text = e, ur(this, t), this.height = n ? n(this) : 1;
5645 };
5646 Ai(ba), ba.prototype.lineNo = function() {
5647 return ti(this);
5648 };
5649 var wa = {}, ka = {};
5650 $r.prototype = {
5651 chunkSize: function() {
5652 return this.lines.length;
5653 },
5654 removeInner: function(e, t) {
5655 for (var n = e, r = e + t; r > n; ++n) {
5656 var i = this.lines[n];
5657 this.height -= i.height, Nr(i), Ci(i, "delete");
5658 }
5659 this.lines.splice(e, t);
5660 },
5661 collapse: function(e) {
5662 e.push.apply(e, this.lines);
5663 },
5664 insertInner: function(e, t, n) {
5665 this.height += n, this.lines = this.lines.slice(0, e).concat(t).concat(this.lines.slice(e));
5666 for (var r = 0; r < t.length; ++r) t[r].parent = this;
5667 },
5668 iterN: function(e, t, n) {
5669 for (var r = e + t; r > e; ++e) if (n(this.lines[e])) return !0;
5670 }
5671 }, Vr.prototype = {
5672 chunkSize: function() {
5673 return this.size;
5674 },
5675 removeInner: function(e, t) {
5676 this.size -= t;
5677 for (var n = 0; n < this.children.length; ++n) {
5678 var r = this.children[n], i = r.chunkSize();
5679 if (i > e) {
5680 var o = Math.min(t, i - e), a = r.height;
5681 if (r.removeInner(e, o), this.height -= a - r.height, i == o && (this.children.splice(n--, 1),
5682 r.parent = null), 0 == (t -= o)) break;
5683 e = 0;
5684 } else e -= i;
5685 }
5686 if (this.size - t < 25 && (this.children.length > 1 || !(this.children[0] instanceof $r))) {
5687 var l = [];
5688 this.collapse(l), this.children = [ new $r(l) ], this.children[0].parent = this;
5689 }
5690 },
5691 collapse: function(e) {
5692 for (var t = 0; t < this.children.length; ++t) this.children[t].collapse(e);
5693 },
5694 insertInner: function(e, t, n) {
5695 this.size += t.length, this.height += n;
5696 for (var r = 0; r < this.children.length; ++r) {
5697 var i = this.children[r], o = i.chunkSize();
5698 if (o >= e) {
5699 if (i.insertInner(e, t, n), i.lines && i.lines.length > 50) {
5700 for (var a = i.lines.length % 25 + 25, l = a; l < i.lines.length; ) {
5701 var s = new $r(i.lines.slice(l, l += 25));
5702 i.height -= s.height, this.children.splice(++r, 0, s), s.parent = this;
5703 }
5704 i.lines = i.lines.slice(0, a), this.maybeSpill();
5705 }
5706 break;
5707 }
5708 e -= o;
5709 }
5710 },
5711 maybeSpill: function() {
5712 if (!(this.children.length <= 10)) {
5713 var e = this;
5714 do {
5715 var n = new Vr(e.children.splice(e.children.length - 5, 5));
5716 if (e.parent) {
5717 e.size -= n.size, e.height -= n.height;
5718 var r = Pi(e.parent.children, e);
5719 e.parent.children.splice(r + 1, 0, n);
5720 } else {
5721 var i = new Vr(e.children);
5722 i.parent = e, e.children = [ i, n ], e = i;
5723 }
5724 n.parent = e.parent;
5725 } while (e.children.length > 10);
5726 e.parent.maybeSpill();
5727 }
5728 },
5729 iterN: function(e, t, n) {
5730 for (var r = 0; r < this.children.length; ++r) {
5731 var i = this.children[r], o = i.chunkSize();
5732 if (o > e) {
5733 var a = Math.min(t, o - e);
5734 if (i.iterN(e, a, n)) return !0;
5735 if (0 == (t -= a)) break;
5736 e = 0;
5737 } else e -= o;
5738 }
5739 }
5740 };
5741 var Sa = 0, Ca = e.Doc = function(e, t, n, r) {
5742 if (!(this instanceof Ca)) return new Ca(e, t, n, r);
5743 null == n && (n = 0), Vr.call(this, [ new $r([ new ba("", null) ]) ]), this.first = n,
5744 this.scrollTop = this.scrollLeft = 0, this.cantEdit = !1, this.cleanGeneration = 1,
5745 this.frontier = n;
5746 var i = Bo(n, 0);
5747 this.sel = de(i), this.history = new oi(null), this.id = ++Sa, this.modeOption = t,
5748 this.lineSep = r, this.extend = !1, "string" == typeof e && (e = this.splitLines(e)),
5749 Yr(this, {
5750 from: i,
5751 to: i,
5752 text: e
5753 }), Te(this, de(i), Wa);
5754 };
5755 Ca.prototype = Hi(Vr.prototype, {
5756 constructor: Ca,
5757 iter: function(e, t, n) {
5758 n ? this.iterN(e - this.first, t - e, n) : this.iterN(this.first, this.first + this.size, e);
5759 },
5760 insert: function(e, t) {
5761 for (var n = 0, r = 0; r < t.length; ++r) n += t[r].height;
5762 this.insertInner(e - this.first, t, n);
5763 },
5764 remove: function(e, t) {
5765 this.removeInner(e - this.first, t);
5766 },
5767 getValue: function(e) {
5768 var t = Qr(this, this.first, this.first + this.size);
5769 return !1 === e ? t : t.join(e || this.lineSeparator());
5770 },
5771 setValue: It((function(e) {
5772 var t = Bo(this.first, 0), n = this.first + this.size - 1;
5773 Tn(this, {
5774 from: t,
5775 to: Bo(n, Zr(this, n).text.length),
5776 text: this.splitLines(e),
5777 origin: "setValue",
5778 full: !0
5779 }, !0), Te(this, de(t));
5780 })),
5781 replaceRange: function(e, t, n, r) {
5782 In(this, e, t = me(this, t), n = n ? me(this, n) : t, r);
5783 },
5784 getRange: function(e, t, n) {
5785 var r = Jr(this, me(this, e), me(this, t));
5786 return !1 === n ? r : r.join(n || this.lineSeparator());
5787 },
5788 getLine: function(e) {
5789 var t = this.getLineHandle(e);
5790 return t && t.text;
5791 },
5792 getLineHandle: function(e) {
5793 return ve(this, e) ? Zr(this, e) : void 0;
5794 },
5795 getLineNumber: function(e) {
5796 return ti(e);
5797 },
5798 getLineHandleVisualStart: function(e) {
5799 return "number" == typeof e && (e = Zr(this, e)), yr(e);
5800 },
5801 lineCount: function() {
5802 return this.size;
5803 },
5804 firstLine: function() {
5805 return this.first;
5806 },
5807 lastLine: function() {
5808 return this.first + this.size - 1;
5809 },
5810 clipPos: function(e) {
5811 return me(this, e);
5812 },
5813 getCursor: function(e) {
5814 var n = this.sel.primary();
5815 return null == e || "head" == e ? n.head : "anchor" == e ? n.anchor : "end" == e || "to" == e || !1 === e ? n.to() : n.from();
5816 },
5817 listSelections: function() {
5818 return this.sel.ranges;
5819 },
5820 somethingSelected: function() {
5821 return this.sel.somethingSelected();
5822 },
5823 setCursor: It((function(e, t, n) {
5824 Se(this, me(this, "number" == typeof e ? Bo(e, t || 0) : e), null, n);
5825 })),
5826 setSelection: It((function(e, t, n) {
5827 Se(this, me(this, e), me(this, t || e), n);
5828 })),
5829 extendSelection: It((function(e, t, n) {
5830 be(this, me(this, e), t && me(this, t), n);
5831 })),
5832 extendSelections: It((function(e, t) {
5833 we(this, ye(this, e), t);
5834 })),
5835 extendSelectionsBy: It((function(e, t) {
5836 we(this, ye(this, Ri(this.sel.ranges, e)), t);
5837 })),
5838 setSelections: It((function(e, t, n) {
5839 if (e.length) {
5840 for (var r = 0, i = []; r < e.length; r++) i[r] = new fe(me(this, e[r].anchor), me(this, e[r].head));
5841 null == t && (t = Math.min(e.length - 1, this.sel.primIndex)), Te(this, he(i, t), n);
5842 }
5843 })),
5844 addSelection: It((function(e, t, n) {
5845 var r = this.sel.ranges.slice(0);
5846 r.push(new fe(me(this, e), me(this, t || e))), Te(this, he(r, r.length - 1), n);
5847 })),
5848 getSelection: function(e) {
5849 for (var t, n = this.sel.ranges, r = 0; r < n.length; r++) {
5850 var i = Jr(this, n[r].from(), n[r].to());
5851 t = t ? t.concat(i) : i;
5852 }
5853 return !1 === e ? t : t.join(e || this.lineSeparator());
5854 },
5855 getSelections: function(e) {
5856 for (var t = [], n = this.sel.ranges, r = 0; r < n.length; r++) {
5857 var i = Jr(this, n[r].from(), n[r].to());
5858 !1 !== e && (i = i.join(e || this.lineSeparator())), t[r] = i;
5859 }
5860 return t;
5861 },
5862 replaceSelection: function(e, t, n) {
5863 for (var r = [], i = 0; i < this.sel.ranges.length; i++) r[i] = e;
5864 this.replaceSelections(r, t, n || "+input");
5865 },
5866 replaceSelections: It((function(e, t, n) {
5867 for (var r = [], i = this.sel, o = 0; o < i.ranges.length; o++) {
5868 var a = i.ranges[o];
5869 r[o] = {
5870 from: a.from(),
5871 to: a.to(),
5872 text: this.splitLines(e[o]),
5873 origin: n
5874 };
5875 }
5876 var l = t && "end" != t && Cn(this, r, t);
5877 for (o = r.length - 1; o >= 0; o--) Tn(this, r[o]);
5878 l ? Le(this, l) : this.cm && Bn(this.cm);
5879 })),
5880 undo: It((function() {
5881 Nn(this, "undo");
5882 })),
5883 redo: It((function() {
5884 Nn(this, "redo");
5885 })),
5886 undoSelection: It((function() {
5887 Nn(this, "undo", !0);
5888 })),
5889 redoSelection: It((function() {
5890 Nn(this, "redo", !0);
5891 })),
5892 setExtending: function(e) {
5893 this.extend = e;
5894 },
5895 getExtending: function() {
5896 return this.extend;
5897 },
5898 historySize: function() {
5899 for (var e = this.history, t = 0, n = 0, r = 0; r < e.done.length; r++) e.done[r].ranges || ++t;
5900 for (r = 0; r < e.undone.length; r++) e.undone[r].ranges || ++n;
5901 return {
5902 undo: t,
5903 redo: n
5904 };
5905 },
5906 clearHistory: function() {
5907 this.history = new oi(this.history.maxGeneration);
5908 },
5909 markClean: function() {
5910 this.cleanGeneration = this.changeGeneration(!0);
5911 },
5912 changeGeneration: function(e) {
5913 return e && (this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null),
5914 this.history.generation;
5915 },
5916 isClean: function(e) {
5917 return this.history.generation == (e || this.cleanGeneration);
5918 },
5919 getHistory: function() {
5920 return {
5921 done: gi(this.history.done),
5922 undone: gi(this.history.undone)
5923 };
5924 },
5925 setHistory: function(e) {
5926 var t = this.history = new oi(this.history.maxGeneration);
5927 t.done = gi(e.done.slice(0), null, !0), t.undone = gi(e.undone.slice(0), null, !0);
5928 },
5929 addLineClass: It((function(e, t, n) {
5930 return zn(this, e, "gutter" == t ? "gutter" : "class", (function(e) {
5931 var r = "text" == t ? "textClass" : "background" == t ? "bgClass" : "gutter" == t ? "gutterClass" : "wrapClass";
5932 if (e[r]) {
5933 if (Yi(n).test(e[r])) return !1;
5934 e[r] += " " + n;
5935 } else e[r] = n;
5936 return !0;
5937 }));
5938 })),
5939 removeLineClass: It((function(e, t, n) {
5940 return zn(this, e, "gutter" == t ? "gutter" : "class", (function(e) {
5941 var r = "text" == t ? "textClass" : "background" == t ? "bgClass" : "gutter" == t ? "gutterClass" : "wrapClass", i = e[r];
5942 if (!i) return !1;
5943 if (null == n) e[r] = null; else {
5944 var o = i.match(Yi(n));
5945 if (!o) return !1;
5946 var a = o.index + o[0].length;
5947 e[r] = i.slice(0, o.index) + (o.index && a != i.length ? " " : "") + i.slice(a) || null;
5948 }
5949 return !0;
5950 }));
5951 })),
5952 addLineWidget: It((function(e, t, n) {
5953 return Tr(this, e, t, n);
5954 })),
5955 removeLineWidget: function(e) {
5956 e.clear();
5957 },
5958 markText: function(e, t, n) {
5959 return Vn(this, me(this, e), me(this, t), n, n && n.type || "range");
5960 },
5961 setBookmark: function(e, t) {
5962 var n = {
5963 replacedWith: t && (null == t.nodeType ? t.widget : t),
5964 insertLeft: t && t.insertLeft,
5965 clearWhenEmpty: !1,
5966 shared: t && t.shared,
5967 handleMouseEvents: t && t.handleMouseEvents
5968 };
5969 return Vn(this, e = me(this, e), e, n, "bookmark");
5970 },
5971 findMarksAt: function(e) {
5972 var t = [], n = Zr(this, (e = me(this, e)).line).markedSpans;
5973 if (n) for (var r = 0; r < n.length; ++r) {
5974 var i = n[r];
5975 (null == i.from || i.from <= e.ch) && (null == i.to || i.to >= e.ch) && t.push(i.marker.parent || i.marker);
5976 }
5977 return t;
5978 },
5979 findMarks: function(e, t, n) {
5980 e = me(this, e), t = me(this, t);
5981 var r = [], i = e.line;
5982 return this.iter(e.line, t.line + 1, (function(o) {
5983 var a = o.markedSpans;
5984 if (a) for (var l = 0; l < a.length; l++) {
5985 var s = a[l];
5986 null != s.to && i == e.line && e.ch >= s.to || null == s.from && i != e.line || null != s.from && i == t.line && s.from >= t.ch || n && !n(s.marker) || r.push(s.marker.parent || s.marker);
5987 }
5988 ++i;
5989 })), r;
5990 },
5991 getAllMarks: function() {
5992 var e = [];
5993 return this.iter((function(t) {
5994 var n = t.markedSpans;
5995 if (n) for (var r = 0; r < n.length; ++r) null != n[r].from && e.push(n[r].marker);
5996 })), e;
5997 },
5998 posFromIndex: function(e) {
5999 var t, n = this.first, r = this.lineSeparator().length;
6000 return this.iter((function(i) {
6001 var o = i.text.length + r;
6002 return o > e ? (t = e, !0) : (e -= o, void ++n);
6003 })), me(this, Bo(n, t));
6004 },
6005 indexFromPos: function(e) {
6006 var t = (e = me(this, e)).ch;
6007 if (e.line < this.first || e.ch < 0) return 0;
6008 var n = this.lineSeparator().length;
6009 return this.iter(this.first, e.line, (function(e) {
6010 t += e.text.length + n;
6011 })), t;
6012 },
6013 copy: function(e) {
6014 var t = new Ca(Qr(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep);
6015 return t.scrollTop = this.scrollTop, t.scrollLeft = this.scrollLeft, t.sel = this.sel,
6016 t.extend = !1, e && (t.history.undoDepth = this.history.undoDepth, t.setHistory(this.getHistory())),
6017 t;
6018 },
6019 linkedDoc: function(e) {
6020 e || (e = {});
6021 var t = this.first, n = this.first + this.size;
6022 null != e.from && e.from > t && (t = e.from), null != e.to && e.to < n && (n = e.to);
6023 var r = new Ca(Qr(this, t, n), e.mode || this.modeOption, t, this.lineSep);
6024 return e.sharedHist && (r.history = this.history), (this.linked || (this.linked = [])).push({
6025 doc: r,
6026 sharedHist: e.sharedHist
6027 }), r.linked = [ {
6028 doc: this,
6029 isParent: !0,
6030 sharedHist: e.sharedHist
6031 } ], Zn(r, Xn(this)), r;
6032 },
6033 unlinkDoc: function(t) {
6034 if (t instanceof e && (t = t.doc), this.linked) for (var n = 0; n < this.linked.length; ++n) if (this.linked[n].doc == t) {
6035 this.linked.splice(n, 1), t.unlinkDoc(this), Jn(Xn(this));
6036 break;
6037 }
6038 if (t.history == this.history) {
6039 var i = [ t.id ];
6040 Kr(t, (function(e) {
6041 i.push(e.id);
6042 }), !0), t.history = new oi(null), t.history.done = gi(this.history.done, i), t.history.undone = gi(this.history.undone, i);
6043 }
6044 },
6045 iterLinkedDocs: function(e) {
6046 Kr(this, e);
6047 },
6048 getMode: function() {
6049 return this.mode;
6050 },
6051 getEditor: function() {
6052 return this.cm;
6053 },
6054 splitLines: function(e) {
6055 return this.lineSep ? e.split(this.lineSep) : tl(e);
6056 },
6057 lineSeparator: function() {
6058 return this.lineSep || "\n";
6059 }
6060 }), Ca.prototype.eachLine = Ca.prototype.iter;
6061 var La = "iter insert remove copy getEditor constructor".split(" ");
6062 for (var Ta in Ca.prototype) Ca.prototype.hasOwnProperty(Ta) && Pi(La, Ta) < 0 && (e.prototype[Ta] = function(e) {
6063 return function() {
6064 return e.apply(this.doc, arguments);
6065 };
6066 }(Ca.prototype[Ta]));
6067 Ai(Ca);
6068 var Ma = e.e_preventDefault = function(e) {
6069 e.preventDefault ? e.preventDefault() : e.returnValue = !1;
6070 }, Na = e.e_stopPropagation = function(e) {
6071 e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0;
6072 }, Aa = e.e_stop = function(e) {
6073 Ma(e), Na(e);
6074 }, Ea = e.on = function(e, t, n) {
6075 if (e.addEventListener) e.addEventListener(t, n, !1); else if (e.attachEvent) e.attachEvent("on" + t, n); else {
6076 var r = e._handlers || (e._handlers = {});
6077 (r[t] || (r[t] = [])).push(n);
6078 }
6079 }, Oa = [], Ia = e.off = function(e, t, n) {
6080 if (e.removeEventListener) e.removeEventListener(t, n, !1); else if (e.detachEvent) e.detachEvent("on" + t, n); else for (var r = Si(e, t, !1), i = 0; i < r.length; ++i) if (r[i] == n) {
6081 r.splice(i, 1);
6082 break;
6083 }
6084 }, Pa = e.signal = function(e, t) {
6085 var n = Si(e, t, !0);
6086 if (n.length) for (var r = Array.prototype.slice.call(arguments, 2), i = 0; i < n.length; ++i) n[i].apply(null, r);
6087 }, Ra = null, Da = 30, Ha = e.Pass = {
6088 toString: function() {
6089 return "CodeMirror.Pass";
6090 }
6091 }, Wa = {
6092 scroll: !1
6093 }, Ba = {
6094 origin: "*mouse"
6095 }, _a = {
6096 origin: "+move"
6097 };
6098 Ei.prototype.set = function(e, t) {
6099 clearTimeout(this.id), this.id = setTimeout(t, e);
6100 };
6101 var Fa = e.countColumn = function(e, t, n, r, i) {
6102 null == t && -1 == (t = e.search(/[^\s\u00a0]/)) && (t = e.length);
6103 for (var o = r || 0, a = i || 0; ;) {
6104 var l = e.indexOf("\t", o);
6105 if (0 > l || l >= t) return a + (t - o);
6106 a += l - o, a += n - a % n, o = l + 1;
6107 }
6108 }, za = e.findColumn = function(e, t, n) {
6109 for (var r = 0, i = 0; ;) {
6110 var o = e.indexOf("\t", r);
6111 -1 == o && (o = e.length);
6112 var a = o - r;
6113 if (o == e.length || i + a >= t) return r + Math.min(a, t - i);
6114 if (i += o - r, r = o + 1, (i += n - i % n) >= t) return r;
6115 }
6116 }, ja = [ "" ], Ua = function(e) {
6117 e.select();
6118 };
6119 No ? Ua = function(e) {
6120 e.selectionStart = 0, e.selectionEnd = e.value.length;
6121 } : xo && (Ua = function(e) {
6122 try {
6123 e.select();
6124 } catch (t) {}
6125 });
6126 var qa, Ga = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, Ya = e.isWordChar = function(e) {
6127 return /\w/.test(e) || e > "€" && (e.toUpperCase() != e.toLowerCase() || Ga.test(e));
6128 }, $a = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
6129 qa = document.createRange ? function(e, t, n, r) {
6130 var i = document.createRange();
6131 return i.setEnd(r || e, n), i.setStart(e, t), i;
6132 } : function(e, t, n) {
6133 var r = document.body.createTextRange();
6134 try {
6135 r.moveToElementText(e.parentNode);
6136 } catch (i) {
6137 return r;
6138 }
6139 return r.collapse(!0), r.moveEnd("character", n), r.moveStart("character", t), r;
6140 };
6141 var Va = e.contains = function(e, t) {
6142 if (3 == t.nodeType && (t = t.parentNode), e.contains) return e.contains(t);
6143 do {
6144 if (11 == t.nodeType && (t = t.host), t == e) return !0;
6145 } while (t = t.parentNode);
6146 };
6147 xo && 11 > bo && (Gi = function() {
6148 try {
6149 return document.activeElement;
6150 } catch (e) {
6151 return document.body;
6152 }
6153 });
6154 var Ka, Xa, Za = e.rmClass = function(e, t) {
6155 var n = e.className, r = Yi(t).exec(n);
6156 if (r) {
6157 var i = n.slice(r.index + r[0].length);
6158 e.className = n.slice(0, r.index) + (i ? r[1] + i : "");
6159 }
6160 }, Ja = e.addClass = function(e, t) {
6161 var n = e.className;
6162 Yi(t).test(n) || (e.className += (n ? " " : "") + t);
6163 }, Qa = !1, el = function() {
6164 if (xo && 9 > bo) return !1;
6165 var e = ji("div");
6166 return "draggable" in e || "dragDrop" in e;
6167 }(), tl = e.splitLines = 3 != "\n\nb".split(/\n/).length ? function(e) {
6168 for (var t = 0, n = [], r = e.length; r >= t; ) {
6169 var i = e.indexOf("\n", t);
6170 -1 == i && (i = e.length);
6171 var o = e.slice(t, "\r" == e.charAt(i - 1) ? i - 1 : i), a = o.indexOf("\r");
6172 -1 != a ? (n.push(o.slice(0, a)), t += a + 1) : (n.push(o), t = i + 1);
6173 }
6174 return n;
6175 } : function(e) {
6176 return e.split(/\r\n?|\n/);
6177 }, nl = window.getSelection ? function(e) {
6178 try {
6179 return e.selectionStart != e.selectionEnd;
6180 } catch (t) {
6181 return !1;
6182 }
6183 } : function(e) {
6184 try {
6185 var t = e.ownerDocument.selection.createRange();
6186 } catch (n) {}
6187 return !(!t || t.parentElement() != e) && 0 != t.compareEndPoints("StartToEnd", t);
6188 }, rl = function() {
6189 var e = ji("div");
6190 return "oncopy" in e || (e.setAttribute("oncopy", "return;"), "function" == typeof e.oncopy);
6191 }(), il = null, ol = e.keyNames = {
6192 3: "Enter",
6193 8: "Backspace",
6194 9: "Tab",
6195 13: "Enter",
6196 16: "Shift",
6197 17: "Ctrl",
6198 18: "Alt",
6199 19: "Pause",
6200 20: "CapsLock",
6201 27: "Esc",
6202 32: "Space",
6203 33: "PageUp",
6204 34: "PageDown",
6205 35: "End",
6206 36: "Home",
6207 37: "Left",
6208 38: "Up",
6209 39: "Right",
6210 40: "Down",
6211 44: "PrintScrn",
6212 45: "Insert",
6213 46: "Delete",
6214 59: ";",
6215 61: "=",
6216 91: "Mod",
6217 92: "Mod",
6218 93: "Mod",
6219 106: "*",
6220 107: "=",
6221 109: "-",
6222 110: ".",
6223 111: "/",
6224 127: "Delete",
6225 173: "-",
6226 186: ";",
6227 187: "=",
6228 188: ",",
6229 189: "-",
6230 190: ".",
6231 191: "/",
6232 192: "`",
6233 219: "[",
6234 220: "\\",
6235 221: "]",
6236 222: "'",
6237 63232: "Up",
6238 63233: "Down",
6239 63234: "Left",
6240 63235: "Right",
6241 63272: "Delete",
6242 63273: "Home",
6243 63275: "End",
6244 63276: "PageUp",
6245 63277: "PageDown",
6246 63302: "Insert"
6247 };
6248 !function() {
6249 for (var e = 0; 10 > e; e++) ol[e + 48] = ol[e + 96] = String(e);
6250 for (e = 65; 90 >= e; e++) ol[e] = String.fromCharCode(e);
6251 for (e = 1; 12 >= e; e++) ol[e + 111] = ol[e + 63235] = "F" + e;
6252 }();
6253 var al, ll = function() {
6254 function e(e) {
6255 return 247 >= e ? n.charAt(e) : e >= 1424 && 1524 >= e ? "R" : e >= 1536 && 1773 >= e ? r.charAt(e - 1536) : e >= 1774 && 2220 >= e ? "r" : e >= 8192 && 8203 >= e ? "w" : 8204 == e ? "b" : "L";
6256 }
6257 function t(e, t, n) {
6258 this.level = e, this.from = t, this.to = n;
6259 }
6260 var n = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN", r = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm", i = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/, o = /[stwN]/, a = /[LRr]/, l = /[Lb1n]/, s = /[1n]/, c = "L";
6261 return function(n) {
6262 if (!i.test(n)) return !1;
6263 for (var u = n.length, f = [], h = 0; u > h; ++h) f.push(r = e(n.charCodeAt(h)));
6264 h = 0;
6265 for (var d = c; u > h; ++h) "m" == (r = f[h]) ? f[h] = d : d = r;
6266 h = 0;
6267 for (var p = c; u > h; ++h) "1" == (r = f[h]) && "r" == p ? f[h] = "n" : a.test(r) && (p = r,
6268 "r" == r && (f[h] = "R"));
6269 for (h = 1, d = f[0]; u - 1 > h; ++h) "+" == (r = f[h]) && "1" == d && "1" == f[h + 1] ? f[h] = "1" : "," != r || d != f[h + 1] || "1" != d && "n" != d || (f[h] = d),
6270 d = r;
6271 for (h = 0; u > h; ++h) if ("," == (r = f[h])) f[h] = "N"; else if ("%" == r) {
6272 for (var m = h + 1; u > m && "%" == f[m]; ++m) ;
6273 for (var g = h && "!" == f[h - 1] || u > m && "1" == f[m] ? "1" : "N", v = h; m > v; ++v) f[v] = g;
6274 h = m - 1;
6275 }
6276 for (h = 0, p = c; u > h; ++h) {
6277 var r = f[h];
6278 "L" == p && "1" == r ? f[h] = "L" : a.test(r) && (p = r);
6279 }
6280 for (h = 0; u > h; ++h) if (o.test(f[h])) {
6281 for (m = h + 1; u > m && o.test(f[m]); ++m) ;
6282 var y = "L" == (h ? f[h - 1] : c), x = "L" == (u > m ? f[m] : c);
6283 for (g = y || x ? "L" : "R", v = h; m > v; ++v) f[v] = g;
6284 h = m - 1;
6285 }
6286 var b, w = [];
6287 for (h = 0; u > h; ) if (l.test(f[h])) {
6288 var k = h;
6289 for (++h; u > h && l.test(f[h]); ++h) ;
6290 w.push(new t(0, k, h));
6291 } else {
6292 var S = h, C = w.length;
6293 for (++h; u > h && "L" != f[h]; ++h) ;
6294 for (v = S; h > v; ) if (s.test(f[v])) {
6295 v > S && w.splice(C, 0, new t(1, S, v));
6296 var L = v;
6297 for (++v; h > v && s.test(f[v]); ++v) ;
6298 w.splice(C, 0, new t(2, L, v)), S = v;
6299 } else ++v;
6300 h > S && w.splice(C, 0, new t(1, S, h));
6301 }
6302 return 1 == w[0].level && (b = n.match(/^\s+/)) && (w[0].from = b[0].length, w.unshift(new t(0, 0, b[0].length))),
6303 1 == Ii(w).level && (b = n.match(/\s+$/)) && (Ii(w).to -= b[0].length, w.push(new t(0, u - b[0].length, u))),
6304 2 == w[0].level && w.unshift(new t(1, w[0].to, w[0].to)), w[0].level != Ii(w).level && w.push(new t(w[0].level, u, u)),
6305 w;
6306 };
6307 }();
6308 return e.version = "5.15.2", e;
6309 }));
6310 }, {} ],
6311 11: [ function(t, n, r) {
6312 var i;
6313 i = function(e) {
6314 "use strict";
6315 var t = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;
6316 e.defineMode("gfm", (function(n, r) {
6317 function i(e) {
6318 return e.code = !1, null;
6319 }
6320 var o = 0, a = {
6321 startState: function() {
6322 return {
6323 code: !1,
6324 codeBlock: !1,
6325 ateSpace: !1
6326 };
6327 },
6328 copyState: function(e) {
6329 return {
6330 code: e.code,
6331 codeBlock: e.codeBlock,
6332 ateSpace: e.ateSpace
6333 };
6334 },
6335 token: function(e, n) {
6336 if (n.combineTokens = null, n.codeBlock) return e.match(/^```+/) ? (n.codeBlock = !1,
6337 null) : (e.skipToEnd(), null);
6338 if (e.sol() && (n.code = !1), e.sol() && e.match(/^```+/)) return e.skipToEnd(),
6339 n.codeBlock = !0, null;
6340 if ("`" === e.peek()) {
6341 e.next();
6342 var i = e.pos;
6343 e.eatWhile("`");
6344 var a = 1 + e.pos - i;
6345 return n.code ? a === o && (n.code = !1) : (o = a, n.code = !0), null;
6346 }
6347 if (n.code) return e.next(), null;
6348 if (e.eatSpace()) return n.ateSpace = !0, null;
6349 if ((e.sol() || n.ateSpace) && (n.ateSpace = !1, !1 !== r.gitHubSpice)) {
6350 if (e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) return n.combineTokens = !0,
6351 "link";
6352 if (e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) return n.combineTokens = !0,
6353 "link";
6354 }
6355 return e.match(t) && "](" != e.string.slice(e.start - 2, e.start) && (0 == e.start || /\W/.test(e.string.charAt(e.start - 1))) ? (n.combineTokens = !0,
6356 "link") : (e.next(), null);
6357 },
6358 blankLine: i
6359 }, l = {
6360 underscoresBreakWords: !1,
6361 taskLists: !0,
6362 fencedCodeBlocks: "```",
6363 strikethrough: !0
6364 };
6365 for (var s in r) l[s] = r[s];
6366 return l.name = "markdown", e.overlayMode(e.getMode(n, l), a);
6367 }), "markdown"), e.defineMIME("text/x-gfm", "gfm");
6368 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror"), t("../markdown/markdown"), t("../../addon/mode/overlay")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror", "../markdown/markdown", "../../addon/mode/overlay" ], i) : i(CodeMirror);
6369 }, {
6370 "../../addon/mode/overlay": 8,
6371 "../../lib/codemirror": 10,
6372 "../markdown/markdown": 12
6373 } ],
6374 12: [ function(t, n, r) {
6375 var i;
6376 i = function(e) {
6377 "use strict";
6378 e.defineMode("markdown", (function(t, n) {
6379 function r(n) {
6380 if (e.findModeByName) {
6381 var r = e.findModeByName(n);
6382 r && (n = r.mime || r.mimes[0]);
6383 }
6384 var i = e.getMode(t, n);
6385 return "null" == i.name ? null : i;
6386 }
6387 function i(e, t, n) {
6388 return t.f = t.inline = n, n(e, t);
6389 }
6390 function o(e, t, n) {
6391 return t.f = t.block = n, n(e, t);
6392 }
6393 function a(e) {
6394 return !e || !/\S/.test(e.string);
6395 }
6396 function l(e) {
6397 return e.linkTitle = !1, e.em = !1, e.strong = !1, e.strikethrough = !1, e.quote = 0,
6398 e.indentedCode = !1, k && e.f == c && (e.f = p, e.block = s), e.trailingSpace = 0,
6399 e.trailingSpaceNewLine = !1, e.prevLine = e.thisLine, e.thisLine = null, null;
6400 }
6401 function s(t, o) {
6402 var l = t.sol(), s = !1 !== o.list, c = o.indentedCode;
6403 o.indentedCode = !1, s && (o.indentationDiff >= 0 ? (o.indentationDiff < 4 && (o.indentation -= o.indentationDiff),
6404 o.list = null) : o.indentation > 0 ? o.list = null : o.list = !1);
6405 var f = null;
6406 if (o.indentationDiff >= 4) return t.skipToEnd(), c || a(o.prevLine) ? (o.indentation -= 4,
6407 o.indentedCode = !0, S.code) : null;
6408 if (t.eatSpace()) return null;
6409 if ((f = t.match(A)) && f[1].length <= 6) return o.header = f[1].length, n.highlightFormatting && (o.formatting = "header"),
6410 o.f = o.inline, h(o);
6411 if (!(a(o.prevLine) || o.quote || s || c) && (f = t.match(E))) return o.header = "=" == f[0].charAt(0) ? 1 : 2,
6412 n.highlightFormatting && (o.formatting = "header"), o.f = o.inline, h(o);
6413 if (t.eat(">")) return o.quote = l ? 1 : o.quote + 1, n.highlightFormatting && (o.formatting = "quote"),
6414 t.eatSpace(), h(o);
6415 if ("[" === t.peek()) return i(t, o, y);
6416 if (t.match(L, !0)) return o.hr = !0, S.hr;
6417 if ((a(o.prevLine) || s) && (t.match(T, !1) || t.match(M, !1))) {
6418 var d = null;
6419 for (t.match(T, !0) ? d = "ul" : (t.match(M, !0), d = "ol"), o.indentation = t.column() + t.current().length,
6420 o.list = !0; o.listStack && t.column() < o.listStack[o.listStack.length - 1]; ) o.listStack.pop();
6421 return o.listStack.push(o.indentation), n.taskLists && t.match(N, !1) && (o.taskList = !0),
6422 o.f = o.inline, n.highlightFormatting && (o.formatting = [ "list", "list-" + d ]),
6423 h(o);
6424 }
6425 return n.fencedCodeBlocks && (f = t.match(I, !0)) ? (o.fencedChars = f[1], o.localMode = r(f[2]),
6426 o.localMode && (o.localState = e.startState(o.localMode)), o.f = o.block = u, n.highlightFormatting && (o.formatting = "code-block"),
6427 o.code = -1, h(o)) : i(t, o, o.inline);
6428 }
6429 function c(t, n) {
6430 var r = w.token(t, n.htmlState);
6431 if (!k) {
6432 var i = e.innerMode(w, n.htmlState);
6433 ("xml" == i.mode.name && null === i.state.tagStart && !i.state.context && i.state.tokenize.isInText || n.md_inside && t.current().indexOf(">") > -1) && (n.f = p,
6434 n.block = s, n.htmlState = null);
6435 }
6436 return r;
6437 }
6438 function u(e, t) {
6439 return t.fencedChars && e.match(t.fencedChars, !1) ? (t.localMode = t.localState = null,
6440 t.f = t.block = f, null) : t.localMode ? t.localMode.token(e, t.localState) : (e.skipToEnd(),
6441 S.code);
6442 }
6443 function f(e, t) {
6444 e.match(t.fencedChars), t.block = s, t.f = p, t.fencedChars = null, n.highlightFormatting && (t.formatting = "code-block"),
6445 t.code = 1;
6446 var r = h(t);
6447 return t.code = 0, r;
6448 }
6449 function h(e) {
6450 var t = [];
6451 if (e.formatting) {
6452 t.push(S.formatting), "string" == typeof e.formatting && (e.formatting = [ e.formatting ]);
6453 for (var r = 0; r < e.formatting.length; r++) t.push(S.formatting + "-" + e.formatting[r]),
6454 "header" === e.formatting[r] && t.push(S.formatting + "-" + e.formatting[r] + "-" + e.header),
6455 "quote" === e.formatting[r] && (!n.maxBlockquoteDepth || n.maxBlockquoteDepth >= e.quote ? t.push(S.formatting + "-" + e.formatting[r] + "-" + e.quote) : t.push("error"));
6456 }
6457 if (e.taskOpen) return t.push("meta"), t.length ? t.join(" ") : null;
6458 if (e.taskClosed) return t.push("property"), t.length ? t.join(" ") : null;
6459 if (e.linkHref ? t.push(S.linkHref, "url") : (e.strong && t.push(S.strong), e.em && t.push(S.em),
6460 e.strikethrough && t.push(S.strikethrough), e.linkText && t.push(S.linkText), e.code && t.push(S.code)),
6461 e.header && t.push(S.header, S.header + "-" + e.header), e.quote && (t.push(S.quote),
6462 !n.maxBlockquoteDepth || n.maxBlockquoteDepth >= e.quote ? t.push(S.quote + "-" + e.quote) : t.push(S.quote + "-" + n.maxBlockquoteDepth)),
6463 !1 !== e.list) {
6464 var i = (e.listStack.length - 1) % 3;
6465 i ? 1 === i ? t.push(S.list2) : t.push(S.list3) : t.push(S.list1);
6466 }
6467 return e.trailingSpaceNewLine ? t.push("trailing-space-new-line") : e.trailingSpace && t.push("trailing-space-" + (e.trailingSpace % 2 ? "a" : "b")),
6468 t.length ? t.join(" ") : null;
6469 }
6470 function d(e, t) {
6471 return e.match(O, !0) ? h(t) : void 0;
6472 }
6473 function p(t, r) {
6474 var i = r.text(t, r);
6475 if (void 0 !== i) return i;
6476 if (r.list) return r.list = null, h(r);
6477 if (r.taskList) return "x" !== t.match(N, !0)[1] ? r.taskOpen = !0 : r.taskClosed = !0,
6478 n.highlightFormatting && (r.formatting = "task"), r.taskList = !1, h(r);
6479 if (r.taskOpen = !1, r.taskClosed = !1, r.header && t.match(/^#+$/, !0)) return n.highlightFormatting && (r.formatting = "header"),
6480 h(r);
6481 var l = t.sol(), s = t.next();
6482 if (r.linkTitle) {
6483 r.linkTitle = !1;
6484 var u = s;
6485 "(" === s && (u = ")");
6486 var f = "^\\s*(?:[^" + (u = (u + "").replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1")) + "\\\\]+|\\\\\\\\|\\\\.)" + u;
6487 if (t.match(new RegExp(f), !0)) return S.linkHref;
6488 }
6489 if ("`" === s) {
6490 var d = r.formatting;
6491 n.highlightFormatting && (r.formatting = "code"), t.eatWhile("`");
6492 var p = t.current().length;
6493 if (0 == r.code) return r.code = p, h(r);
6494 if (p == r.code) {
6495 var v = h(r);
6496 return r.code = 0, v;
6497 }
6498 return r.formatting = d, h(r);
6499 }
6500 if (r.code) return h(r);
6501 if ("\\" === s && (t.next(), n.highlightFormatting)) {
6502 var y = h(r), x = S.formatting + "-escape";
6503 return y ? y + " " + x : x;
6504 }
6505 if ("!" === s && t.match(/\[[^\]]*\] ?(?:\(|\[)/, !1)) return t.match(/\[[^\]]*\]/),
6506 r.inline = r.f = g, S.image;
6507 if ("[" === s && t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, !1)) return r.linkText = !0,
6508 n.highlightFormatting && (r.formatting = "link"), h(r);
6509 if ("]" === s && r.linkText && t.match(/\(.*?\)| ?\[.*?\]/, !1)) {
6510 n.highlightFormatting && (r.formatting = "link");
6511 var y = h(r);
6512 return r.linkText = !1, r.inline = r.f = g, y;
6513 }
6514 if ("<" === s && t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, !1)) return r.f = r.inline = m,
6515 n.highlightFormatting && (r.formatting = "link"), (y = h(r)) ? y += " " : y = "",
6516 y + S.linkInline;
6517 if ("<" === s && t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, !1)) return r.f = r.inline = m,
6518 n.highlightFormatting && (r.formatting = "link"), (y = h(r)) ? y += " " : y = "",
6519 y + S.linkEmail;
6520 if ("<" === s && t.match(/^(!--|\w)/, !1)) {
6521 var b = t.string.indexOf(">", t.pos);
6522 if (-1 != b) {
6523 var k = t.string.substring(t.start, b);
6524 /markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(k) && (r.md_inside = !0);
6525 }
6526 return t.backUp(1), r.htmlState = e.startState(w), o(t, r, c);
6527 }
6528 if ("<" === s && t.match(/^\/\w*?>/)) return r.md_inside = !1, "tag";
6529 var C = !1;
6530 if (!n.underscoresBreakWords && "_" === s && "_" !== t.peek() && t.match(/(\w)/, !1)) {
6531 var L = t.pos - 2;
6532 if (L >= 0) {
6533 var T = t.string.charAt(L);
6534 "_" !== T && T.match(/(\w)/, !1) && (C = !0);
6535 }
6536 }
6537 if ("*" === s || "_" === s && !C) if (l && " " === t.peek()) ; else {
6538 if (r.strong === s && t.eat(s)) return n.highlightFormatting && (r.formatting = "strong"),
6539 v = h(r), r.strong = !1, v;
6540 if (!r.strong && t.eat(s)) return r.strong = s, n.highlightFormatting && (r.formatting = "strong"),
6541 h(r);
6542 if (r.em === s) return n.highlightFormatting && (r.formatting = "em"), v = h(r),
6543 r.em = !1, v;
6544 if (!r.em) return r.em = s, n.highlightFormatting && (r.formatting = "em"), h(r);
6545 } else if (" " === s && (t.eat("*") || t.eat("_"))) {
6546 if (" " === t.peek()) return h(r);
6547 t.backUp(1);
6548 }
6549 if (n.strikethrough) if ("~" === s && t.eatWhile(s)) {
6550 if (r.strikethrough) return n.highlightFormatting && (r.formatting = "strikethrough"),
6551 v = h(r), r.strikethrough = !1, v;
6552 if (t.match(/^[^\s]/, !1)) return r.strikethrough = !0, n.highlightFormatting && (r.formatting = "strikethrough"),
6553 h(r);
6554 } else if (" " === s && t.match(/^~~/, !0)) {
6555 if (" " === t.peek()) return h(r);
6556 t.backUp(2);
6557 }
6558 return " " === s && (t.match(/ +$/, !1) ? r.trailingSpace++ : r.trailingSpace && (r.trailingSpaceNewLine = !0)),
6559 h(r);
6560 }
6561 function m(e, t) {
6562 if (">" === e.next()) {
6563 t.f = t.inline = p, n.highlightFormatting && (t.formatting = "link");
6564 var i = h(t);
6565 return i ? i += " " : i = "", i + S.linkInline;
6566 }
6567 return e.match(/^[^>]+/, !0), S.linkInline;
6568 }
6569 function g(e, t) {
6570 if (e.eatSpace()) return null;
6571 var r = e.next();
6572 return "(" === r || "[" === r ? (t.f = t.inline = v("(" === r ? ")" : "]", 0), n.highlightFormatting && (t.formatting = "link-string"),
6573 t.linkHref = !0, h(t)) : "error";
6574 }
6575 function v(e) {
6576 return function(t, r) {
6577 if (t.next() === e) {
6578 r.f = r.inline = p, n.highlightFormatting && (r.formatting = "link-string");
6579 var o = h(r);
6580 return r.linkHref = !1, o;
6581 }
6582 return t.match(P[e]), r.linkHref = !0, h(r);
6583 };
6584 }
6585 function y(e, t) {
6586 return e.match(/^([^\]\\]|\\.)*\]:/, !1) ? (t.f = x, e.next(), n.highlightFormatting && (t.formatting = "link"),
6587 t.linkText = !0, h(t)) : i(e, t, p);
6588 }
6589 function x(e, t) {
6590 if (e.match(/^\]:/, !0)) {
6591 t.f = t.inline = b, n.highlightFormatting && (t.formatting = "link");
6592 var r = h(t);
6593 return t.linkText = !1, r;
6594 }
6595 return e.match(/^([^\]\\]|\\.)+/, !0), S.linkText;
6596 }
6597 function b(e, t) {
6598 return e.eatSpace() ? null : (e.match(/^[^\s]+/, !0), void 0 === e.peek() ? t.linkTitle = !0 : e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, !0),
6599 t.f = t.inline = p, S.linkHref + " url");
6600 }
6601 var w = e.getMode(t, "text/html"), k = "null" == w.name;
6602 void 0 === n.highlightFormatting && (n.highlightFormatting = !1), void 0 === n.maxBlockquoteDepth && (n.maxBlockquoteDepth = 0),
6603 void 0 === n.underscoresBreakWords && (n.underscoresBreakWords = !0), void 0 === n.taskLists && (n.taskLists = !1),
6604 void 0 === n.strikethrough && (n.strikethrough = !1), void 0 === n.tokenTypeOverrides && (n.tokenTypeOverrides = {});
6605 var S = {
6606 header: "header",
6607 code: "comment",
6608 quote: "quote",
6609 list1: "variable-2",
6610 list2: "variable-3",
6611 list3: "keyword",
6612 hr: "hr",
6613 image: "tag",
6614 formatting: "formatting",
6615 linkInline: "link",
6616 linkEmail: "link",
6617 linkText: "link",
6618 linkHref: "string",
6619 em: "em",
6620 strong: "strong",
6621 strikethrough: "strikethrough"
6622 };
6623 for (var C in S) S.hasOwnProperty(C) && n.tokenTypeOverrides[C] && (S[C] = n.tokenTypeOverrides[C]);
6624 var L = /^([*\-_])(?:\s*\1){2,}\s*$/, T = /^[*\-+]\s+/, M = /^[0-9]+([.)])\s+/, N = /^\[(x| )\](?=\s)/, A = n.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/, E = /^ *(?:\={1,}|-{1,})\s*$/, O = /^[^#!\[\]*_\\<>` "'(~]+/, I = new RegExp("^(" + (!0 === n.fencedCodeBlocks ? "~~~+|```+" : n.fencedCodeBlocks) + ")[ \\t]*([\\w+#-]*)"), P = {
6625 ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
6626 "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/
6627 }, R = {
6628 startState: function() {
6629 return {
6630 f: s,
6631 prevLine: null,
6632 thisLine: null,
6633 block: s,
6634 htmlState: null,
6635 indentation: 0,
6636 inline: p,
6637 text: d,
6638 formatting: !1,
6639 linkText: !1,
6640 linkHref: !1,
6641 linkTitle: !1,
6642 code: 0,
6643 em: !1,
6644 strong: !1,
6645 header: 0,
6646 hr: !1,
6647 taskList: !1,
6648 list: !1,
6649 listStack: [],
6650 quote: 0,
6651 trailingSpace: 0,
6652 trailingSpaceNewLine: !1,
6653 strikethrough: !1,
6654 fencedChars: null
6655 };
6656 },
6657 copyState: function(t) {
6658 return {
6659 f: t.f,
6660 prevLine: t.prevLine,
6661 thisLine: t.thisLine,
6662 block: t.block,
6663 htmlState: t.htmlState && e.copyState(w, t.htmlState),
6664 indentation: t.indentation,
6665 localMode: t.localMode,
6666 localState: t.localMode ? e.copyState(t.localMode, t.localState) : null,
6667 inline: t.inline,
6668 text: t.text,
6669 formatting: !1,
6670 linkTitle: t.linkTitle,
6671 code: t.code,
6672 em: t.em,
6673 strong: t.strong,
6674 strikethrough: t.strikethrough,
6675 header: t.header,
6676 hr: t.hr,
6677 taskList: t.taskList,
6678 list: t.list,
6679 listStack: t.listStack.slice(0),
6680 quote: t.quote,
6681 indentedCode: t.indentedCode,
6682 trailingSpace: t.trailingSpace,
6683 trailingSpaceNewLine: t.trailingSpaceNewLine,
6684 md_inside: t.md_inside,
6685 fencedChars: t.fencedChars
6686 };
6687 },
6688 token: function(e, t) {
6689 if (t.formatting = !1, e != t.thisLine) {
6690 var n = t.header || t.hr;
6691 if (t.header = 0, t.hr = !1, e.match(/^\s*$/, !0) || n) {
6692 if (l(t), !n) return null;
6693 t.prevLine = null;
6694 }
6695 t.prevLine = t.thisLine, t.thisLine = e, t.taskList = !1, t.trailingSpace = 0, t.trailingSpaceNewLine = !1,
6696 t.f = t.block;
6697 var r = e.match(/^\s*/, !0)[0].replace(/\t/g, " ").length;
6698 if (t.indentationDiff = Math.min(r - t.indentation, 4), t.indentation = t.indentation + t.indentationDiff,
6699 r > 0) return null;
6700 }
6701 return t.f(e, t);
6702 },
6703 innerMode: function(e) {
6704 return e.block == c ? {
6705 state: e.htmlState,
6706 mode: w
6707 } : e.localState ? {
6708 state: e.localState,
6709 mode: e.localMode
6710 } : {
6711 state: e,
6712 mode: R
6713 };
6714 },
6715 blankLine: l,
6716 getType: h,
6717 fold: "markdown"
6718 };
6719 return R;
6720 }), "xml"), e.defineMIME("text/x-markdown", "markdown");
6721 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror"), t("../xml/xml"), t("../meta")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror", "../xml/xml", "../meta" ], i) : i(CodeMirror);
6722 }, {
6723 "../../lib/codemirror": 10,
6724 "../meta": 13,
6725 "../xml/xml": 14
6726 } ],
6727 13: [ function(t, n, r) {
6728 var i;
6729 i = function(e) {
6730 "use strict";
6731 e.modeInfo = [ {
6732 name: "APL",
6733 mime: "text/apl",
6734 mode: "apl",
6735 ext: [ "dyalog", "apl" ]
6736 }, {
6737 name: "PGP",
6738 mimes: [ "application/pgp", "application/pgp-keys", "application/pgp-signature" ],
6739 mode: "asciiarmor",
6740 ext: [ "pgp" ]
6741 }, {
6742 name: "ASN.1",
6743 mime: "text/x-ttcn-asn",
6744 mode: "asn.1",
6745 ext: [ "asn", "asn1" ]
6746 }, {
6747 name: "Asterisk",
6748 mime: "text/x-asterisk",
6749 mode: "asterisk",
6750 file: /^extensions\.conf$/i
6751 }, {
6752 name: "Brainfuck",
6753 mime: "text/x-brainfuck",
6754 mode: "brainfuck",
6755 ext: [ "b", "bf" ]
6756 }, {
6757 name: "C",
6758 mime: "text/x-csrc",
6759 mode: "clike",
6760 ext: [ "c", "h" ]
6761 }, {
6762 name: "C++",
6763 mime: "text/x-c++src",
6764 mode: "clike",
6765 ext: [ "cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx" ],
6766 alias: [ "cpp" ]
6767 }, {
6768 name: "Cobol",
6769 mime: "text/x-cobol",
6770 mode: "cobol",
6771 ext: [ "cob", "cpy" ]
6772 }, {
6773 name: "C#",
6774 mime: "text/x-csharp",
6775 mode: "clike",
6776 ext: [ "cs" ],
6777 alias: [ "csharp" ]
6778 }, {
6779 name: "Clojure",
6780 mime: "text/x-clojure",
6781 mode: "clojure",
6782 ext: [ "clj", "cljc", "cljx" ]
6783 }, {
6784 name: "ClojureScript",
6785 mime: "text/x-clojurescript",
6786 mode: "clojure",
6787 ext: [ "cljs" ]
6788 }, {
6789 name: "Closure Stylesheets (GSS)",
6790 mime: "text/x-gss",
6791 mode: "css",
6792 ext: [ "gss" ]
6793 }, {
6794 name: "CMake",
6795 mime: "text/x-cmake",
6796 mode: "cmake",
6797 ext: [ "cmake", "cmake.in" ],
6798 file: /^CMakeLists.txt$/
6799 }, {
6800 name: "CoffeeScript",
6801 mime: "text/x-coffeescript",
6802 mode: "coffeescript",
6803 ext: [ "coffee" ],
6804 alias: [ "coffee", "coffee-script" ]
6805 }, {
6806 name: "Common Lisp",
6807 mime: "text/x-common-lisp",
6808 mode: "commonlisp",
6809 ext: [ "cl", "lisp", "el" ],
6810 alias: [ "lisp" ]
6811 }, {
6812 name: "Cypher",
6813 mime: "application/x-cypher-query",
6814 mode: "cypher",
6815 ext: [ "cyp", "cypher" ]
6816 }, {
6817 name: "Cython",
6818 mime: "text/x-cython",
6819 mode: "python",
6820 ext: [ "pyx", "pxd", "pxi" ]
6821 }, {
6822 name: "Crystal",
6823 mime: "text/x-crystal",
6824 mode: "crystal",
6825 ext: [ "cr" ]
6826 }, {
6827 name: "CSS",
6828 mime: "text/css",
6829 mode: "css",
6830 ext: [ "css" ]
6831 }, {
6832 name: "CQL",
6833 mime: "text/x-cassandra",
6834 mode: "sql",
6835 ext: [ "cql" ]
6836 }, {
6837 name: "D",
6838 mime: "text/x-d",
6839 mode: "d",
6840 ext: [ "d" ]
6841 }, {
6842 name: "Dart",
6843 mimes: [ "application/dart", "text/x-dart" ],
6844 mode: "dart",
6845 ext: [ "dart" ]
6846 }, {
6847 name: "diff",
6848 mime: "text/x-diff",
6849 mode: "diff",
6850 ext: [ "diff", "patch" ]
6851 }, {
6852 name: "Django",
6853 mime: "text/x-django",
6854 mode: "django"
6855 }, {
6856 name: "Dockerfile",
6857 mime: "text/x-dockerfile",
6858 mode: "dockerfile",
6859 file: /^Dockerfile$/
6860 }, {
6861 name: "DTD",
6862 mime: "application/xml-dtd",
6863 mode: "dtd",
6864 ext: [ "dtd" ]
6865 }, {
6866 name: "Dylan",
6867 mime: "text/x-dylan",
6868 mode: "dylan",
6869 ext: [ "dylan", "dyl", "intr" ]
6870 }, {
6871 name: "EBNF",
6872 mime: "text/x-ebnf",
6873 mode: "ebnf"
6874 }, {
6875 name: "ECL",
6876 mime: "text/x-ecl",
6877 mode: "ecl",
6878 ext: [ "ecl" ]
6879 }, {
6880 name: "edn",
6881 mime: "application/edn",
6882 mode: "clojure",
6883 ext: [ "edn" ]
6884 }, {
6885 name: "Eiffel",
6886 mime: "text/x-eiffel",
6887 mode: "eiffel",
6888 ext: [ "e" ]
6889 }, {
6890 name: "Elm",
6891 mime: "text/x-elm",
6892 mode: "elm",
6893 ext: [ "elm" ]
6894 }, {
6895 name: "Embedded Javascript",
6896 mime: "application/x-ejs",
6897 mode: "htmlembedded",
6898 ext: [ "ejs" ]
6899 }, {
6900 name: "Embedded Ruby",
6901 mime: "application/x-erb",
6902 mode: "htmlembedded",
6903 ext: [ "erb" ]
6904 }, {
6905 name: "Erlang",
6906 mime: "text/x-erlang",
6907 mode: "erlang",
6908 ext: [ "erl" ]
6909 }, {
6910 name: "Factor",
6911 mime: "text/x-factor",
6912 mode: "factor",
6913 ext: [ "factor" ]
6914 }, {
6915 name: "FCL",
6916 mime: "text/x-fcl",
6917 mode: "fcl"
6918 }, {
6919 name: "Forth",
6920 mime: "text/x-forth",
6921 mode: "forth",
6922 ext: [ "forth", "fth", "4th" ]
6923 }, {
6924 name: "Fortran",
6925 mime: "text/x-fortran",
6926 mode: "fortran",
6927 ext: [ "f", "for", "f77", "f90" ]
6928 }, {
6929 name: "F#",
6930 mime: "text/x-fsharp",
6931 mode: "mllike",
6932 ext: [ "fs" ],
6933 alias: [ "fsharp" ]
6934 }, {
6935 name: "Gas",
6936 mime: "text/x-gas",
6937 mode: "gas",
6938 ext: [ "s" ]
6939 }, {
6940 name: "Gherkin",
6941 mime: "text/x-feature",
6942 mode: "gherkin",
6943 ext: [ "feature" ]
6944 }, {
6945 name: "GitHub Flavored Markdown",
6946 mime: "text/x-gfm",
6947 mode: "gfm",
6948 file: /^(readme|contributing|history).md$/i
6949 }, {
6950 name: "Go",
6951 mime: "text/x-go",
6952 mode: "go",
6953 ext: [ "go" ]
6954 }, {
6955 name: "Groovy",
6956 mime: "text/x-groovy",
6957 mode: "groovy",
6958 ext: [ "groovy", "gradle" ]
6959 }, {
6960 name: "HAML",
6961 mime: "text/x-haml",
6962 mode: "haml",
6963 ext: [ "haml" ]
6964 }, {
6965 name: "Haskell",
6966 mime: "text/x-haskell",
6967 mode: "haskell",
6968 ext: [ "hs" ]
6969 }, {
6970 name: "Haskell (Literate)",
6971 mime: "text/x-literate-haskell",
6972 mode: "haskell-literate",
6973 ext: [ "lhs" ]
6974 }, {
6975 name: "Haxe",
6976 mime: "text/x-haxe",
6977 mode: "haxe",
6978 ext: [ "hx" ]
6979 }, {
6980 name: "HXML",
6981 mime: "text/x-hxml",
6982 mode: "haxe",
6983 ext: [ "hxml" ]
6984 }, {
6985 name: "ASP.NET",
6986 mime: "application/x-aspx",
6987 mode: "htmlembedded",
6988 ext: [ "aspx" ],
6989 alias: [ "asp", "aspx" ]
6990 }, {
6991 name: "HTML",
6992 mime: "text/html",
6993 mode: "htmlmixed",
6994 ext: [ "html", "htm" ],
6995 alias: [ "xhtml" ]
6996 }, {
6997 name: "HTTP",
6998 mime: "message/http",
6999 mode: "http"
7000 }, {
7001 name: "IDL",
7002 mime: "text/x-idl",
7003 mode: "idl",
7004 ext: [ "pro" ]
7005 }, {
7006 name: "Jade",
7007 mime: "text/x-jade",
7008 mode: "jade",
7009 ext: [ "jade" ]
7010 }, {
7011 name: "Java",
7012 mime: "text/x-java",
7013 mode: "clike",
7014 ext: [ "java" ]
7015 }, {
7016 name: "Java Server Pages",
7017 mime: "application/x-jsp",
7018 mode: "htmlembedded",
7019 ext: [ "jsp" ],
7020 alias: [ "jsp" ]
7021 }, {
7022 name: "JavaScript",
7023 mimes: [ "text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript" ],
7024 mode: "javascript",
7025 ext: [ "js" ],
7026 alias: [ "ecmascript", "js", "node" ]
7027 }, {
7028 name: "JSON",
7029 mimes: [ "application/json", "application/x-json" ],
7030 mode: "javascript",
7031 ext: [ "json", "map" ],
7032 alias: [ "json5" ]
7033 }, {
7034 name: "JSON-LD",
7035 mime: "application/ld+json",
7036 mode: "javascript",
7037 ext: [ "jsonld" ],
7038 alias: [ "jsonld" ]
7039 }, {
7040 name: "JSX",
7041 mime: "text/jsx",
7042 mode: "jsx",
7043 ext: [ "jsx" ]
7044 }, {
7045 name: "Jinja2",
7046 mime: "null",
7047 mode: "jinja2"
7048 }, {
7049 name: "Julia",
7050 mime: "text/x-julia",
7051 mode: "julia",
7052 ext: [ "jl" ]
7053 }, {
7054 name: "Kotlin",
7055 mime: "text/x-kotlin",
7056 mode: "clike",
7057 ext: [ "kt" ]
7058 }, {
7059 name: "LESS",
7060 mime: "text/x-less",
7061 mode: "css",
7062 ext: [ "less" ]
7063 }, {
7064 name: "LiveScript",
7065 mime: "text/x-livescript",
7066 mode: "livescript",
7067 ext: [ "ls" ],
7068 alias: [ "ls" ]
7069 }, {
7070 name: "Lua",
7071 mime: "text/x-lua",
7072 mode: "lua",
7073 ext: [ "lua" ]
7074 }, {
7075 name: "Markdown",
7076 mime: "text/x-markdown",
7077 mode: "markdown",
7078 ext: [ "markdown", "md", "mkd" ]
7079 }, {
7080 name: "mIRC",
7081 mime: "text/mirc",
7082 mode: "mirc"
7083 }, {
7084 name: "MariaDB SQL",
7085 mime: "text/x-mariadb",
7086 mode: "sql"
7087 }, {
7088 name: "Mathematica",
7089 mime: "text/x-mathematica",
7090 mode: "mathematica",
7091 ext: [ "m", "nb" ]
7092 }, {
7093 name: "Modelica",
7094 mime: "text/x-modelica",
7095 mode: "modelica",
7096 ext: [ "mo" ]
7097 }, {
7098 name: "MUMPS",
7099 mime: "text/x-mumps",
7100 mode: "mumps",
7101 ext: [ "mps" ]
7102 }, {
7103 name: "MS SQL",
7104 mime: "text/x-mssql",
7105 mode: "sql"
7106 }, {
7107 name: "mbox",
7108 mime: "application/mbox",
7109 mode: "mbox",
7110 ext: [ "mbox" ]
7111 }, {
7112 name: "MySQL",
7113 mime: "text/x-mysql",
7114 mode: "sql"
7115 }, {
7116 name: "Nginx",
7117 mime: "text/x-nginx-conf",
7118 mode: "nginx",
7119 file: /nginx.*\.conf$/i
7120 }, {
7121 name: "NSIS",
7122 mime: "text/x-nsis",
7123 mode: "nsis",
7124 ext: [ "nsh", "nsi" ]
7125 }, {
7126 name: "NTriples",
7127 mime: "text/n-triples",
7128 mode: "ntriples",
7129 ext: [ "nt" ]
7130 }, {
7131 name: "Objective C",
7132 mime: "text/x-objectivec",
7133 mode: "clike",
7134 ext: [ "m", "mm" ],
7135 alias: [ "objective-c", "objc" ]
7136 }, {
7137 name: "OCaml",
7138 mime: "text/x-ocaml",
7139 mode: "mllike",
7140 ext: [ "ml", "mli", "mll", "mly" ]
7141 }, {
7142 name: "Octave",
7143 mime: "text/x-octave",
7144 mode: "octave",
7145 ext: [ "m" ]
7146 }, {
7147 name: "Oz",
7148 mime: "text/x-oz",
7149 mode: "oz",
7150 ext: [ "oz" ]
7151 }, {
7152 name: "Pascal",
7153 mime: "text/x-pascal",
7154 mode: "pascal",
7155 ext: [ "p", "pas" ]
7156 }, {
7157 name: "PEG.js",
7158 mime: "null",
7159 mode: "pegjs",
7160 ext: [ "jsonld" ]
7161 }, {
7162 name: "Perl",
7163 mime: "text/x-perl",
7164 mode: "perl",
7165 ext: [ "pl", "pm" ]
7166 }, {
7167 name: "PHP",
7168 mime: "application/x-httpd-php",
7169 mode: "php",
7170 ext: [ "php", "php3", "php4", "php5", "phtml" ]
7171 }, {
7172 name: "Pig",
7173 mime: "text/x-pig",
7174 mode: "pig",
7175 ext: [ "pig" ]
7176 }, {
7177 name: "Plain Text",
7178 mime: "text/plain",
7179 mode: "null",
7180 ext: [ "txt", "text", "conf", "def", "list", "log" ]
7181 }, {
7182 name: "PLSQL",
7183 mime: "text/x-plsql",
7184 mode: "sql",
7185 ext: [ "pls" ]
7186 }, {
7187 name: "PowerShell",
7188 mime: "application/x-powershell",
7189 mode: "powershell",
7190 ext: [ "ps1", "psd1", "psm1" ]
7191 }, {
7192 name: "Properties files",
7193 mime: "text/x-properties",
7194 mode: "properties",
7195 ext: [ "properties", "ini", "in" ],
7196 alias: [ "ini", "properties" ]
7197 }, {
7198 name: "ProtoBuf",
7199 mime: "text/x-protobuf",
7200 mode: "protobuf",
7201 ext: [ "proto" ]
7202 }, {
7203 name: "Python",
7204 mime: "text/x-python",
7205 mode: "python",
7206 ext: [ "BUILD", "bzl", "py", "pyw" ],
7207 file: /^(BUCK|BUILD)$/
7208 }, {
7209 name: "Puppet",
7210 mime: "text/x-puppet",
7211 mode: "puppet",
7212 ext: [ "pp" ]
7213 }, {
7214 name: "Q",
7215 mime: "text/x-q",
7216 mode: "q",
7217 ext: [ "q" ]
7218 }, {
7219 name: "R",
7220 mime: "text/x-rsrc",
7221 mode: "r",
7222 ext: [ "r" ],
7223 alias: [ "rscript" ]
7224 }, {
7225 name: "reStructuredText",
7226 mime: "text/x-rst",
7227 mode: "rst",
7228 ext: [ "rst" ],
7229 alias: [ "rst" ]
7230 }, {
7231 name: "RPM Changes",
7232 mime: "text/x-rpm-changes",
7233 mode: "rpm"
7234 }, {
7235 name: "RPM Spec",
7236 mime: "text/x-rpm-spec",
7237 mode: "rpm",
7238 ext: [ "spec" ]
7239 }, {
7240 name: "Ruby",
7241 mime: "text/x-ruby",
7242 mode: "ruby",
7243 ext: [ "rb" ],
7244 alias: [ "jruby", "macruby", "rake", "rb", "rbx" ]
7245 }, {
7246 name: "Rust",
7247 mime: "text/x-rustsrc",
7248 mode: "rust",
7249 ext: [ "rs" ]
7250 }, {
7251 name: "SAS",
7252 mime: "text/x-sas",
7253 mode: "sas",
7254 ext: [ "sas" ]
7255 }, {
7256 name: "Sass",
7257 mime: "text/x-sass",
7258 mode: "sass",
7259 ext: [ "sass" ]
7260 }, {
7261 name: "Scala",
7262 mime: "text/x-scala",
7263 mode: "clike",
7264 ext: [ "scala" ]
7265 }, {
7266 name: "Scheme",
7267 mime: "text/x-scheme",
7268 mode: "scheme",
7269 ext: [ "scm", "ss" ]
7270 }, {
7271 name: "SCSS",
7272 mime: "text/x-scss",
7273 mode: "css",
7274 ext: [ "scss" ]
7275 }, {
7276 name: "Shell",
7277 mime: "text/x-sh",
7278 mode: "shell",
7279 ext: [ "sh", "ksh", "bash" ],
7280 alias: [ "bash", "sh", "zsh" ],
7281 file: /^PKGBUILD$/
7282 }, {
7283 name: "Sieve",
7284 mime: "application/sieve",
7285 mode: "sieve",
7286 ext: [ "siv", "sieve" ]
7287 }, {
7288 name: "Slim",
7289 mimes: [ "text/x-slim", "application/x-slim" ],
7290 mode: "slim",
7291 ext: [ "slim" ]
7292 }, {
7293 name: "Smalltalk",
7294 mime: "text/x-stsrc",
7295 mode: "smalltalk",
7296 ext: [ "st" ]
7297 }, {
7298 name: "Smarty",
7299 mime: "text/x-smarty",
7300 mode: "smarty",
7301 ext: [ "tpl" ]
7302 }, {
7303 name: "Solr",
7304 mime: "text/x-solr",
7305 mode: "solr"
7306 }, {
7307 name: "Soy",
7308 mime: "text/x-soy",
7309 mode: "soy",
7310 ext: [ "soy" ],
7311 alias: [ "closure template" ]
7312 }, {
7313 name: "SPARQL",
7314 mime: "application/sparql-query",
7315 mode: "sparql",
7316 ext: [ "rq", "sparql" ],
7317 alias: [ "sparul" ]
7318 }, {
7319 name: "Spreadsheet",
7320 mime: "text/x-spreadsheet",
7321 mode: "spreadsheet",
7322 alias: [ "excel", "formula" ]
7323 }, {
7324 name: "SQL",
7325 mime: "text/x-sql",
7326 mode: "sql",
7327 ext: [ "sql" ]
7328 }, {
7329 name: "Squirrel",
7330 mime: "text/x-squirrel",
7331 mode: "clike",
7332 ext: [ "nut" ]
7333 }, {
7334 name: "Swift",
7335 mime: "text/x-swift",
7336 mode: "swift",
7337 ext: [ "swift" ]
7338 }, {
7339 name: "sTeX",
7340 mime: "text/x-stex",
7341 mode: "stex"
7342 }, {
7343 name: "LaTeX",
7344 mime: "text/x-latex",
7345 mode: "stex",
7346 ext: [ "text", "ltx" ],
7347 alias: [ "tex" ]
7348 }, {
7349 name: "SystemVerilog",
7350 mime: "text/x-systemverilog",
7351 mode: "verilog",
7352 ext: [ "v" ]
7353 }, {
7354 name: "Tcl",
7355 mime: "text/x-tcl",
7356 mode: "tcl",
7357 ext: [ "tcl" ]
7358 }, {
7359 name: "Textile",
7360 mime: "text/x-textile",
7361 mode: "textile",
7362 ext: [ "textile" ]
7363 }, {
7364 name: "TiddlyWiki ",
7365 mime: "text/x-tiddlywiki",
7366 mode: "tiddlywiki"
7367 }, {
7368 name: "Tiki wiki",
7369 mime: "text/tiki",
7370 mode: "tiki"
7371 }, {
7372 name: "TOML",
7373 mime: "text/x-toml",
7374 mode: "toml",
7375 ext: [ "toml" ]
7376 }, {
7377 name: "Tornado",
7378 mime: "text/x-tornado",
7379 mode: "tornado"
7380 }, {
7381 name: "troff",
7382 mime: "text/troff",
7383 mode: "troff",
7384 ext: [ "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
7385 }, {
7386 name: "TTCN",
7387 mime: "text/x-ttcn",
7388 mode: "ttcn",
7389 ext: [ "ttcn", "ttcn3", "ttcnpp" ]
7390 }, {
7391 name: "TTCN_CFG",
7392 mime: "text/x-ttcn-cfg",
7393 mode: "ttcn-cfg",
7394 ext: [ "cfg" ]
7395 }, {
7396 name: "Turtle",
7397 mime: "text/turtle",
7398 mode: "turtle",
7399 ext: [ "ttl" ]
7400 }, {
7401 name: "TypeScript",
7402 mime: "application/typescript",
7403 mode: "javascript",
7404 ext: [ "ts" ],
7405 alias: [ "ts" ]
7406 }, {
7407 name: "Twig",
7408 mime: "text/x-twig",
7409 mode: "twig"
7410 }, {
7411 name: "Web IDL",
7412 mime: "text/x-webidl",
7413 mode: "webidl",
7414 ext: [ "webidl" ]
7415 }, {
7416 name: "VB.NET",
7417 mime: "text/x-vb",
7418 mode: "vb",
7419 ext: [ "vb" ]
7420 }, {
7421 name: "VBScript",
7422 mime: "text/vbscript",
7423 mode: "vbscript",
7424 ext: [ "vbs" ]
7425 }, {
7426 name: "Velocity",
7427 mime: "text/velocity",
7428 mode: "velocity",
7429 ext: [ "vtl" ]
7430 }, {
7431 name: "Verilog",
7432 mime: "text/x-verilog",
7433 mode: "verilog",
7434 ext: [ "v" ]
7435 }, {
7436 name: "VHDL",
7437 mime: "text/x-vhdl",
7438 mode: "vhdl",
7439 ext: [ "vhd", "vhdl" ]
7440 }, {
7441 name: "XML",
7442 mimes: [ "application/xml", "text/xml" ],
7443 mode: "xml",
7444 ext: [ "xml", "xsl", "xsd" ],
7445 alias: [ "rss", "wsdl", "xsd" ]
7446 }, {
7447 name: "XQuery",
7448 mime: "application/xquery",
7449 mode: "xquery",
7450 ext: [ "xy", "xquery" ]
7451 }, {
7452 name: "Yacas",
7453 mime: "text/x-yacas",
7454 mode: "yacas",
7455 ext: [ "ys" ]
7456 }, {
7457 name: "YAML",
7458 mime: "text/x-yaml",
7459 mode: "yaml",
7460 ext: [ "yaml", "yml" ],
7461 alias: [ "yml" ]
7462 }, {
7463 name: "Z80",
7464 mime: "text/x-z80",
7465 mode: "z80",
7466 ext: [ "z80" ]
7467 }, {
7468 name: "mscgen",
7469 mime: "text/x-mscgen",
7470 mode: "mscgen",
7471 ext: [ "mscgen", "mscin", "msc" ]
7472 }, {
7473 name: "xu",
7474 mime: "text/x-xu",
7475 mode: "mscgen",
7476 ext: [ "xu" ]
7477 }, {
7478 name: "msgenny",
7479 mime: "text/x-msgenny",
7480 mode: "mscgen",
7481 ext: [ "msgenny" ]
7482 } ];
7483 for (var t = 0; t < e.modeInfo.length; t++) {
7484 var n = e.modeInfo[t];
7485 n.mimes && (n.mime = n.mimes[0]);
7486 }
7487 e.findModeByMIME = function(t) {
7488 t = t.toLowerCase();
7489 for (var n = 0; n < e.modeInfo.length; n++) {
7490 var r = e.modeInfo[n];
7491 if (r.mime == t) return r;
7492 if (r.mimes) for (var i = 0; i < r.mimes.length; i++) if (r.mimes[i] == t) return r;
7493 }
7494 }, e.findModeByExtension = function(t) {
7495 for (var n = 0; n < e.modeInfo.length; n++) {
7496 var r = e.modeInfo[n];
7497 if (r.ext) for (var i = 0; i < r.ext.length; i++) if (r.ext[i] == t) return r;
7498 }
7499 }, e.findModeByFileName = function(t) {
7500 for (var n = 0; n < e.modeInfo.length; n++) {
7501 var r = e.modeInfo[n];
7502 if (r.file && r.file.test(t)) return r;
7503 }
7504 var i = t.lastIndexOf("."), o = i > -1 && t.substring(i + 1, t.length);
7505 return o ? e.findModeByExtension(o) : void 0;
7506 }, e.findModeByName = function(t) {
7507 t = t.toLowerCase();
7508 for (var n = 0; n < e.modeInfo.length; n++) {
7509 var r = e.modeInfo[n];
7510 if (r.name.toLowerCase() == t) return r;
7511 if (r.alias) for (var i = 0; i < r.alias.length; i++) if (r.alias[i].toLowerCase() == t) return r;
7512 }
7513 };
7514 }, "object" == typeof r && "object" == typeof n ? i(t("../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../lib/codemirror" ], i) : i(CodeMirror);
7515 }, {
7516 "../lib/codemirror": 10
7517 } ],
7518 14: [ function(t, n, r) {
7519 var i;
7520 i = function(e) {
7521 "use strict";
7522 var t = {
7523 autoSelfClosers: {
7524 area: !0,
7525 base: !0,
7526 br: !0,
7527 col: !0,
7528 command: !0,
7529 embed: !0,
7530 frame: !0,
7531 hr: !0,
7532 img: !0,
7533 input: !0,
7534 keygen: !0,
7535 link: !0,
7536 meta: !0,
7537 param: !0,
7538 source: !0,
7539 track: !0,
7540 wbr: !0,
7541 menuitem: !0
7542 },
7543 implicitlyClosed: {
7544 dd: !0,
7545 li: !0,
7546 optgroup: !0,
7547 option: !0,
7548 p: !0,
7549 rp: !0,
7550 rt: !0,
7551 tbody: !0,
7552 td: !0,
7553 tfoot: !0,
7554 th: !0,
7555 tr: !0
7556 },
7557 contextGrabbers: {
7558 dd: {
7559 dd: !0,
7560 dt: !0
7561 },
7562 dt: {
7563 dd: !0,
7564 dt: !0
7565 },
7566 li: {
7567 li: !0
7568 },
7569 option: {
7570 option: !0,
7571 optgroup: !0
7572 },
7573 optgroup: {
7574 optgroup: !0
7575 },
7576 p: {
7577 address: !0,
7578 article: !0,
7579 aside: !0,
7580 blockquote: !0,
7581 dir: !0,
7582 div: !0,
7583 dl: !0,
7584 fieldset: !0,
7585 footer: !0,
7586 form: !0,
7587 h1: !0,
7588 h2: !0,
7589 h3: !0,
7590 h4: !0,
7591 h5: !0,
7592 h6: !0,
7593 header: !0,
7594 hgroup: !0,
7595 hr: !0,
7596 menu: !0,
7597 nav: !0,
7598 ol: !0,
7599 p: !0,
7600 pre: !0,
7601 section: !0,
7602 table: !0,
7603 ul: !0
7604 },
7605 rp: {
7606 rp: !0,
7607 rt: !0
7608 },
7609 rt: {
7610 rp: !0,
7611 rt: !0
7612 },
7613 tbody: {
7614 tbody: !0,
7615 tfoot: !0
7616 },
7617 td: {
7618 td: !0,
7619 th: !0
7620 },
7621 tfoot: {
7622 tbody: !0
7623 },
7624 th: {
7625 td: !0,
7626 th: !0
7627 },
7628 thead: {
7629 tbody: !0,
7630 tfoot: !0
7631 },
7632 tr: {
7633 tr: !0
7634 }
7635 },
7636 doNotIndent: {
7637 pre: !0
7638 },
7639 allowUnquoted: !0,
7640 allowMissing: !0,
7641 caseFold: !0
7642 }, n = {
7643 autoSelfClosers: {},
7644 implicitlyClosed: {},
7645 contextGrabbers: {},
7646 doNotIndent: {},
7647 allowUnquoted: !1,
7648 allowMissing: !1,
7649 caseFold: !1
7650 };
7651 e.defineMode("xml", (function(r, i) {
7652 function o(e, t) {
7653 function n(n) {
7654 return t.tokenize = n, n(e, t);
7655 }
7656 var r = e.next();
7657 return "<" == r ? e.eat("!") ? e.eat("[") ? e.match("CDATA[") ? n(s("atom", "]]>")) : null : e.match("--") ? n(s("comment", "--\x3e")) : e.match("DOCTYPE", !0, !0) ? (e.eatWhile(/[\w\._\-]/),
7658 n(c(1))) : null : e.eat("?") ? (e.eatWhile(/[\w\._\-]/), t.tokenize = s("meta", "?>"),
7659 "meta") : (T = e.eat("/") ? "closeTag" : "openTag", t.tokenize = a, "tag bracket") : "&" == r ? (e.eat("#") ? e.eat("x") ? e.eatWhile(/[a-fA-F\d]/) && e.eat(";") : e.eatWhile(/[\d]/) && e.eat(";") : e.eatWhile(/[\w\.\-:]/) && e.eat(";")) ? "atom" : "error" : (e.eatWhile(/[^&<]/),
7660 null);
7661 }
7662 function a(e, t) {
7663 var n = e.next();
7664 if (">" == n || "/" == n && e.eat(">")) return t.tokenize = o, T = ">" == n ? "endTag" : "selfcloseTag",
7665 "tag bracket";
7666 if ("=" == n) return T = "equals", null;
7667 if ("<" == n) {
7668 t.tokenize = o, t.state = d, t.tagName = t.tagStart = null;
7669 var r = t.tokenize(e, t);
7670 return r ? r + " tag error" : "tag error";
7671 }
7672 return /[\'\"]/.test(n) ? (t.tokenize = l(n), t.stringStartCol = e.column(), t.tokenize(e, t)) : (e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),
7673 "word");
7674 }
7675 function l(e) {
7676 var t = function(t, n) {
7677 for (;!t.eol(); ) if (t.next() == e) {
7678 n.tokenize = a;
7679 break;
7680 }
7681 return "string";
7682 };
7683 return t.isInAttribute = !0, t;
7684 }
7685 function s(e, t) {
7686 return function(n, r) {
7687 for (;!n.eol(); ) {
7688 if (n.match(t)) {
7689 r.tokenize = o;
7690 break;
7691 }
7692 n.next();
7693 }
7694 return e;
7695 };
7696 }
7697 function c(e) {
7698 return function(t, n) {
7699 for (var r; null != (r = t.next()); ) {
7700 if ("<" == r) return n.tokenize = c(e + 1), n.tokenize(t, n);
7701 if (">" == r) {
7702 if (1 == e) {
7703 n.tokenize = o;
7704 break;
7705 }
7706 return n.tokenize = c(e - 1), n.tokenize(t, n);
7707 }
7708 }
7709 return "meta";
7710 };
7711 }
7712 function u(e, t, n) {
7713 this.prev = e.context, this.tagName = t, this.indent = e.indented, this.startOfLine = n,
7714 (S.doNotIndent.hasOwnProperty(t) || e.context && e.context.noIndent) && (this.noIndent = !0);
7715 }
7716 function f(e) {
7717 e.context && (e.context = e.context.prev);
7718 }
7719 function h(e, t) {
7720 for (var n; ;) {
7721 if (!e.context) return;
7722 if (n = e.context.tagName, !S.contextGrabbers.hasOwnProperty(n) || !S.contextGrabbers[n].hasOwnProperty(t)) return;
7723 f(e);
7724 }
7725 }
7726 function d(e, t, n) {
7727 return "openTag" == e ? (n.tagStart = t.column(), p) : "closeTag" == e ? m : d;
7728 }
7729 function p(e, t, n) {
7730 return "word" == e ? (n.tagName = t.current(), M = "tag", y) : (M = "error", p);
7731 }
7732 function m(e, t, n) {
7733 if ("word" == e) {
7734 var r = t.current();
7735 return n.context && n.context.tagName != r && S.implicitlyClosed.hasOwnProperty(n.context.tagName) && f(n),
7736 n.context && n.context.tagName == r || !1 === S.matchClosing ? (M = "tag", g) : (M = "tag error",
7737 v);
7738 }
7739 return M = "error", v;
7740 }
7741 function g(e, t, n) {
7742 return "endTag" != e ? (M = "error", g) : (f(n), d);
7743 }
7744 function v(e, t, n) {
7745 return M = "error", g(e, t, n);
7746 }
7747 function y(e, t, n) {
7748 if ("word" == e) return M = "attribute", x;
7749 if ("endTag" == e || "selfcloseTag" == e) {
7750 var r = n.tagName, i = n.tagStart;
7751 return n.tagName = n.tagStart = null, "selfcloseTag" == e || S.autoSelfClosers.hasOwnProperty(r) ? h(n, r) : (h(n, r),
7752 n.context = new u(n, r, i == n.indented)), d;
7753 }
7754 return M = "error", y;
7755 }
7756 function x(e, t, n) {
7757 return "equals" == e ? b : (S.allowMissing || (M = "error"), y(e, t, n));
7758 }
7759 function b(e, t, n) {
7760 return "string" == e ? w : "word" == e && S.allowUnquoted ? (M = "string", y) : (M = "error",
7761 y(e, t, n));
7762 }
7763 function w(e, t, n) {
7764 return "string" == e ? w : y(e, t, n);
7765 }
7766 var T, M, k = r.indentUnit, S = {}, C = i.htmlMode ? t : n;
7767 for (var L in C) S[L] = C[L];
7768 for (var L in i) S[L] = i[L];
7769 return o.isInText = !0, {
7770 startState: function(e) {
7771 var t = {
7772 tokenize: o,
7773 state: d,
7774 indented: e || 0,
7775 tagName: null,
7776 tagStart: null,
7777 context: null
7778 };
7779 return null != e && (t.baseIndent = e), t;
7780 },
7781 token: function(e, t) {
7782 if (!t.tagName && e.sol() && (t.indented = e.indentation()), e.eatSpace()) return null;
7783 T = null;
7784 var n = t.tokenize(e, t);
7785 return (n || T) && "comment" != n && (M = null, t.state = t.state(T || n, e, t),
7786 M && (n = "error" == M ? n + " error" : M)), n;
7787 },
7788 indent: function(t, n, r) {
7789 var i = t.context;
7790 if (t.tokenize.isInAttribute) return t.tagStart == t.indented ? t.stringStartCol + 1 : t.indented + k;
7791 if (i && i.noIndent) return e.Pass;
7792 if (t.tokenize != a && t.tokenize != o) return r ? r.match(/^(\s*)/)[0].length : 0;
7793 if (t.tagName) return !1 !== S.multilineTagIndentPastTag ? t.tagStart + t.tagName.length + 2 : t.tagStart + k * (S.multilineTagIndentFactor || 1);
7794 if (S.alignCDATA && /<!\[CDATA\[/.test(n)) return 0;
7795 var l = n && /^<(\/)?([\w_:\.-]*)/.exec(n);
7796 if (l && l[1]) for (;i; ) {
7797 if (i.tagName == l[2]) {
7798 i = i.prev;
7799 break;
7800 }
7801 if (!S.implicitlyClosed.hasOwnProperty(i.tagName)) break;
7802 i = i.prev;
7803 } else if (l) for (;i; ) {
7804 var s = S.contextGrabbers[i.tagName];
7805 if (!s || !s.hasOwnProperty(l[2])) break;
7806 i = i.prev;
7807 }
7808 for (;i && i.prev && !i.startOfLine; ) i = i.prev;
7809 return i ? i.indent + k : t.baseIndent || 0;
7810 },
7811 electricInput: /<\/[\s\w:]+>$/,
7812 blockCommentStart: "\x3c!--",
7813 blockCommentEnd: "--\x3e",
7814 configuration: S.htmlMode ? "html" : "xml",
7815 helperType: S.htmlMode ? "html" : "xml",
7816 skipAttribute: function(e) {
7817 e.state == b && (e.state = y);
7818 }
7819 };
7820 })), e.defineMIME("text/xml", "xml"), e.defineMIME("application/xml", "xml"), e.mimeModes.hasOwnProperty("text/html") || e.defineMIME("text/html", {
7821 name: "xml",
7822 htmlMode: !0
7823 });
7824 }, "object" == typeof r && "object" == typeof n ? i(t("../../lib/codemirror")) : "function" == typeof e && e.amd ? e([ "../../lib/codemirror" ], i) : i(CodeMirror);
7825 }, {
7826 "../../lib/codemirror": 10
7827 } ],
7828 15: [ function(e, t, n) {
7829 n.read = function(e, t, n, r, i) {
7830 var o, a, l = 8 * i - r - 1, s = (1 << l) - 1, c = s >> 1, u = -7, f = n ? i - 1 : 0, h = n ? -1 : 1, d = e[t + f];
7831 for (f += h, o = d & (1 << -u) - 1, d >>= -u, u += l; u > 0; o = 256 * o + e[t + f],
7832 f += h, u -= 8) ;
7833 for (a = o & (1 << -u) - 1, o >>= -u, u += r; u > 0; a = 256 * a + e[t + f], f += h,
7834 u -= 8) ;
7835 if (0 === o) o = 1 - c; else {
7836 if (o === s) return a ? NaN : 1 / 0 * (d ? -1 : 1);
7837 a += Math.pow(2, r), o -= c;
7838 }
7839 return (d ? -1 : 1) * a * Math.pow(2, o - r);
7840 }, n.write = function(e, t, n, r, i, o) {
7841 var a, l, s, c = 8 * o - i - 1, u = (1 << c) - 1, f = u >> 1, h = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = r ? 0 : o - 1, p = r ? 1 : -1, m = 0 > t || 0 === t && 0 > 1 / t ? 1 : 0;
7842 for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (l = isNaN(t) ? 1 : 0, a = u) : (a = Math.floor(Math.log(t) / Math.LN2),
7843 t * (s = Math.pow(2, -a)) < 1 && (a--, s *= 2), (t += a + f >= 1 ? h / s : h * Math.pow(2, 1 - f)) * s >= 2 && (a++,
7844 s /= 2), a + f >= u ? (l = 0, a = u) : a + f >= 1 ? (l = (t * s - 1) * Math.pow(2, i),
7845 a += f) : (l = t * Math.pow(2, f - 1) * Math.pow(2, i), a = 0)); i >= 8; e[n + d] = 255 & l,
7846 d += p, l /= 256, i -= 8) ;
7847 for (a = a << i | l, c += i; c > 0; e[n + d] = 255 & a, d += p, a /= 256, c -= 8) ;
7848 e[n + d - p] |= 128 * m;
7849 };
7850 }, {} ],
7851 16: [ function(e, t, n) {
7852 var r = {}.toString;
7853 t.exports = Array.isArray || function(e) {
7854 return "[object Array]" == r.call(e);
7855 };
7856 }, {} ],
7857 17: [ function(t, n, r) {
7858 (function(t) {
7859 (function() {
7860 function t(e) {
7861 this.tokens = [], this.tokens.links = {}, this.options = e || h.defaults, this.rules = d.normal,
7862 this.options.gfm && (this.options.tables ? this.rules = d.tables : this.rules = d.gfm);
7863 }
7864 function i(e, t) {
7865 if (this.options = t || h.defaults, this.links = e, this.rules = p.normal, this.renderer = this.options.renderer || new o,
7866 this.renderer.options = this.options, !this.links) throw new Error("Tokens array requires a `links` property.");
7867 this.options.gfm ? this.options.breaks ? this.rules = p.breaks : this.rules = p.gfm : this.options.pedantic && (this.rules = p.pedantic);
7868 }
7869 function o(e) {
7870 this.options = e || {};
7871 }
7872 function a(e) {
7873 this.tokens = [], this.token = null, this.options = e || h.defaults, this.options.renderer = this.options.renderer || new o,
7874 this.renderer = this.options.renderer, this.renderer.options = this.options;
7875 }
7876 function l(e, t) {
7877 return e.replace(t ? /&/g : /&(?!#?\w+;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7878 }
7879 function s(e) {
7880 return e.replace(/&([#\w]+);/g, (function(e, t) {
7881 return "colon" === (t = t.toLowerCase()) ? ":" : "#" === t.charAt(0) ? "x" === t.charAt(1) ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : "";
7882 }));
7883 }
7884 function c(e, t) {
7885 return e = e.source, t = t || "", function n(r, i) {
7886 return r ? (i = (i = i.source || i).replace(/(^|[^\[])\^/g, "$1"), e = e.replace(r, i),
7887 n) : new RegExp(e, t);
7888 };
7889 }
7890 function u() {}
7891 function f(e) {
7892 for (var t, n, r = 1; r < arguments.length; r++) for (n in t = arguments[r]) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
7893 return e;
7894 }
7895 function h(e, n, r) {
7896 if (r || "function" == typeof n) {
7897 r || (r = n, n = null);
7898 var i, o, s = (n = f({}, h.defaults, n || {})).highlight, c = 0;
7899 try {
7900 i = t.lex(e, n);
7901 } catch (u) {
7902 return r(u);
7903 }
7904 o = i.length;
7905 var d = function(e) {
7906 if (e) return n.highlight = s, r(e);
7907 var t;
7908 try {
7909 t = a.parse(i, n);
7910 } catch (o) {
7911 e = o;
7912 }
7913 return n.highlight = s, e ? r(e) : r(null, t);
7914 };
7915 if (!s || s.length < 3) return d();
7916 if (delete n.highlight, !o) return d();
7917 for (;c < i.length; c++) !function(e) {
7918 "code" !== e.type ? --o || d() : s(e.text, e.lang, (function(t, n) {
7919 return t ? d(t) : null == n || n === e.text ? --o || d() : (e.text = n, e.escaped = !0,
7920 void (--o || d()));
7921 }));
7922 }(i[c]);
7923 } else try {
7924 return n && (n = f({}, h.defaults, n)), a.parse(t.lex(e, n), n);
7925 } catch (u) {
7926 if (u.message += "\nPlease report this to https://github.com/chjj/marked.", (n || h.defaults).silent) return "<p>An error occured:</p><pre>" + l(u.message + "", !0) + "</pre>";
7927 throw u;
7928 }
7929 }
7930 var d = {
7931 newline: /^\n+/,
7932 code: /^( {4}[^\n]+\n*)+/,
7933 fences: u,
7934 hr: /^( *[-*_]){3,} *(?:\n+|$)/,
7935 heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
7936 nptable: u,
7937 lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
7938 blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
7939 list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
7940 html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
7941 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
7942 table: u,
7943 paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
7944 text: /^[^\n]+/,
7945 bullet: /(?:[*+-]|\d+\.)/,
7946 item: /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/
7947 };
7948 d.item = c(d.item, "gm")(/bull/g, d.bullet)(), d.list = c(d.list)(/bull/g, d.bullet)("hr", "\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def", "\\n+(?=" + d.def.source + ")")(),
7949 d.blockquote = c(d.blockquote)("def", d.def)(), d._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+(?!:/|[^\\w\\s@]*@)\\b",
7950 d.html = c(d.html)("comment", /<!--[\s\S]*?-->/)("closed", /<(tag)[\s\S]+?<\/\1>/)("closing", /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g, d._tag)(),
7951 d.paragraph = c(d.paragraph)("hr", d.hr)("heading", d.heading)("lheading", d.lheading)("blockquote", d.blockquote)("tag", "<" + d._tag)("def", d.def)(),
7952 d.normal = f({}, d), d.gfm = f({}, d.normal, {
7953 fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,
7954 paragraph: /^/,
7955 heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/
7956 }), d.gfm.paragraph = c(d.paragraph)("(?!", "(?!" + d.gfm.fences.source.replace("\\1", "\\2") + "|" + d.list.source.replace("\\1", "\\3") + "|")(),
7957 d.tables = f({}, d.gfm, {
7958 nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
7959 table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
7960 }), t.rules = d, t.lex = function(e, n) {
7961 return new t(n).lex(e);
7962 }, t.prototype.lex = function(e) {
7963 return e = e.replace(/\r\n|\r/g, "\n").replace(/\t/g, " ").replace(/\u00a0/g, " ").replace(/\u2424/g, "\n"),
7964 this.token(e, !0);
7965 }, t.prototype.token = function(e, t, n) {
7966 var r, i, o, a, l, s, c, u, f;
7967 for (e = e.replace(/^ +$/gm, ""); e; ) if ((o = this.rules.newline.exec(e)) && (e = e.substring(o[0].length),
7968 o[0].length > 1 && this.tokens.push({
7969 type: "space"
7970 })), o = this.rules.code.exec(e)) e = e.substring(o[0].length), o = o[0].replace(/^ {4}/gm, ""),
7971 this.tokens.push({
7972 type: "code",
7973 text: this.options.pedantic ? o : o.replace(/\n+$/, "")
7974 }); else if (o = this.rules.fences.exec(e)) e = e.substring(o[0].length), this.tokens.push({
7975 type: "code",
7976 lang: o[2],
7977 text: o[3] || ""
7978 }); else if (o = this.rules.heading.exec(e)) e = e.substring(o[0].length), this.tokens.push({
7979 type: "heading",
7980 depth: o[1].length,
7981 text: o[2]
7982 }); else if (t && (o = this.rules.nptable.exec(e))) {
7983 for (e = e.substring(o[0].length), s = {
7984 type: "table",
7985 header: o[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),
7986 align: o[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
7987 cells: o[3].replace(/\n$/, "").split("\n")
7988 }, u = 0; u < s.align.length; u++) /^ *-+: *$/.test(s.align[u]) ? s.align[u] = "right" : /^ *:-+: *$/.test(s.align[u]) ? s.align[u] = "center" : /^ *:-+ *$/.test(s.align[u]) ? s.align[u] = "left" : s.align[u] = null;
7989 for (u = 0; u < s.cells.length; u++) s.cells[u] = s.cells[u].split(/ *\| */);
7990 this.tokens.push(s);
7991 } else if (o = this.rules.lheading.exec(e)) e = e.substring(o[0].length), this.tokens.push({
7992 type: "heading",
7993 depth: "=" === o[2] ? 1 : 2,
7994 text: o[1]
7995 }); else if (o = this.rules.hr.exec(e)) e = e.substring(o[0].length), this.tokens.push({
7996 type: "hr"
7997 }); else if (o = this.rules.blockquote.exec(e)) e = e.substring(o[0].length), this.tokens.push({
7998 type: "blockquote_start"
7999 }), o = o[0].replace(/^ *> ?/gm, ""), this.token(o, t, !0), this.tokens.push({
8000 type: "blockquote_end"
8001 }); else if (o = this.rules.list.exec(e)) {
8002 for (e = e.substring(o[0].length), a = o[2], this.tokens.push({
8003 type: "list_start",
8004 ordered: a.length > 1
8005 }), r = !1, f = (o = o[0].match(this.rules.item)).length, u = 0; f > u; u++) c = (s = o[u]).length,
8006 ~(s = s.replace(/^ *([*+-]|\d+\.) +/, "")).indexOf("\n ") && (c -= s.length, s = this.options.pedantic ? s.replace(/^ {1,4}/gm, "") : s.replace(new RegExp("^ {1," + c + "}", "gm"), "")),
8007 this.options.smartLists && u !== f - 1 && (a === (l = d.bullet.exec(o[u + 1])[0]) || a.length > 1 && l.length > 1 || (e = o.slice(u + 1).join("\n") + e,
8008 u = f - 1)), i = r || /\n\n(?!\s*$)/.test(s), u !== f - 1 && (r = "\n" === s.charAt(s.length - 1),
8009 i || (i = r)), this.tokens.push({
8010 type: i ? "loose_item_start" : "list_item_start"
8011 }), this.token(s, !1, n), this.tokens.push({
8012 type: "list_item_end"
8013 });
8014 this.tokens.push({
8015 type: "list_end"
8016 });
8017 } else if (o = this.rules.html.exec(e)) e = e.substring(o[0].length), this.tokens.push({
8018 type: this.options.sanitize ? "paragraph" : "html",
8019 pre: !this.options.sanitizer && ("pre" === o[1] || "script" === o[1] || "style" === o[1]),
8020 text: o[0]
8021 }); else if (!n && t && (o = this.rules.def.exec(e))) e = e.substring(o[0].length),
8022 this.tokens.links[o[1].toLowerCase()] = {
8023 href: o[2],
8024 title: o[3]
8025 }; else if (t && (o = this.rules.table.exec(e))) {
8026 for (e = e.substring(o[0].length), s = {
8027 type: "table",
8028 header: o[1].replace(/^ *| *\| *$/g, "").split(/ *\| */),
8029 align: o[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
8030 cells: o[3].replace(/(?: *\| *)?\n$/, "").split("\n")
8031 }, u = 0; u < s.align.length; u++) /^ *-+: *$/.test(s.align[u]) ? s.align[u] = "right" : /^ *:-+: *$/.test(s.align[u]) ? s.align[u] = "center" : /^ *:-+ *$/.test(s.align[u]) ? s.align[u] = "left" : s.align[u] = null;
8032 for (u = 0; u < s.cells.length; u++) s.cells[u] = s.cells[u].replace(/^ *\| *| *\| *$/g, "").split(/ *\| */);
8033 this.tokens.push(s);
8034 } else if (t && (o = this.rules.paragraph.exec(e))) e = e.substring(o[0].length),
8035 this.tokens.push({
8036 type: "paragraph",
8037 text: "\n" === o[1].charAt(o[1].length - 1) ? o[1].slice(0, -1) : o[1]
8038 }); else if (o = this.rules.text.exec(e)) e = e.substring(o[0].length), this.tokens.push({
8039 type: "text",
8040 text: o[0]
8041 }); else if (e) throw new Error("Infinite loop on byte: " + e.charCodeAt(0));
8042 return this.tokens;
8043 };
8044 var p = {
8045 escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
8046 autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
8047 url: u,
8048 tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
8049 link: /^!?\[(inside)\]\(href\)/,
8050 reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
8051 nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
8052 strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
8053 em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
8054 code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
8055 br: /^ {2,}\n(?!\s*$)/,
8056 del: u,
8057 text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,
8058 _inside: /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,
8059 _href: /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/
8060 };
8061 p.link = c(p.link)("inside", p._inside)("href", p._href)(), p.reflink = c(p.reflink)("inside", p._inside)(),
8062 p.normal = f({}, p), p.pedantic = f({}, p.normal, {
8063 strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
8064 em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
8065 }), p.gfm = f({}, p.normal, {
8066 escape: c(p.escape)("])", "~|])")(),
8067 url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
8068 del: /^~~(?=\S)([\s\S]*?\S)~~/,
8069 text: c(p.text)("]|", "~]|")("|", "|https?://|")()
8070 }), p.breaks = f({}, p.gfm, {
8071 br: c(p.br)("{2,}", "*")(),
8072 text: c(p.gfm.text)("{2,}", "*")()
8073 }), i.rules = p, i.output = function(e, t, n) {
8074 return new i(t, n).output(e);
8075 }, i.prototype.output = function(e) {
8076 for (var t, n, r, i, o = ""; e; ) if (i = this.rules.escape.exec(e)) e = e.substring(i[0].length),
8077 o += i[1]; else if (i = this.rules.autolink.exec(e)) e = e.substring(i[0].length),
8078 "@" === i[2] ? (n = ":" === i[1].charAt(6) ? this.mangle(i[1].substring(7)) : this.mangle(i[1]),
8079 r = this.mangle("mailto:") + n) : r = n = l(i[1]), o += this.renderer.link(r, null, n); else if (this.inLink || !(i = this.rules.url.exec(e))) {
8080 if (i = this.rules.tag.exec(e)) !this.inLink && /^<a /i.test(i[0]) ? this.inLink = !0 : this.inLink && /^<\/a>/i.test(i[0]) && (this.inLink = !1),
8081 e = e.substring(i[0].length), o += this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(i[0]) : l(i[0]) : i[0]; else if (i = this.rules.link.exec(e)) e = e.substring(i[0].length),
8082 this.inLink = !0, o += this.outputLink(i, {
8083 href: i[2],
8084 title: i[3]
8085 }), this.inLink = !1; else if ((i = this.rules.reflink.exec(e)) || (i = this.rules.nolink.exec(e))) {
8086 if (e = e.substring(i[0].length), t = (i[2] || i[1]).replace(/\s+/g, " "), !(t = this.links[t.toLowerCase()]) || !t.href) {
8087 o += i[0].charAt(0), e = i[0].substring(1) + e;
8088 continue;
8089 }
8090 this.inLink = !0, o += this.outputLink(i, t), this.inLink = !1;
8091 } else if (i = this.rules.strong.exec(e)) e = e.substring(i[0].length), o += this.renderer.strong(this.output(i[2] || i[1])); else if (i = this.rules.em.exec(e)) e = e.substring(i[0].length),
8092 o += this.renderer.em(this.output(i[2] || i[1])); else if (i = this.rules.code.exec(e)) e = e.substring(i[0].length),
8093 o += this.renderer.codespan(l(i[2], !0)); else if (i = this.rules.br.exec(e)) e = e.substring(i[0].length),
8094 o += this.renderer.br(); else if (i = this.rules.del.exec(e)) e = e.substring(i[0].length),
8095 o += this.renderer.del(this.output(i[1])); else if (i = this.rules.text.exec(e)) e = e.substring(i[0].length),
8096 o += this.renderer.text(l(this.smartypants(i[0]))); else if (e) throw new Error("Infinite loop on byte: " + e.charCodeAt(0));
8097 } else e = e.substring(i[0].length), r = n = l(i[1]), o += this.renderer.link(r, null, n);
8098 return o;
8099 }, i.prototype.outputLink = function(e, t) {
8100 var n = l(t.href), r = t.title ? l(t.title) : null;
8101 return "!" !== e[0].charAt(0) ? this.renderer.link(n, r, this.output(e[1])) : this.renderer.image(n, r, l(e[1]));
8102 }, i.prototype.smartypants = function(e) {
8103 return this.options.smartypants ? e.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014\/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…") : e;
8104 }, i.prototype.mangle = function(e) {
8105 if (!this.options.mangle) return e;
8106 for (var t, n = "", r = e.length, i = 0; r > i; i++) t = e.charCodeAt(i), Math.random() > .5 && (t = "x" + t.toString(16)),
8107 n += "&#" + t + ";";
8108 return n;
8109 }, o.prototype.code = function(e, t, n) {
8110 if (this.options.highlight) {
8111 var r = this.options.highlight(e, t);
8112 null != r && r !== e && (n = !0, e = r);
8113 }
8114 return t ? '<pre><code class="' + this.options.langPrefix + l(t, !0) + '">' + (n ? e : l(e, !0)) + "\n</code></pre>\n" : "<pre><code>" + (n ? e : l(e, !0)) + "\n</code></pre>";
8115 }, o.prototype.blockquote = function(e) {
8116 return "<blockquote>\n" + e + "</blockquote>\n";
8117 }, o.prototype.html = function(e) {
8118 return e;
8119 }, o.prototype.heading = function(e, t, n) {
8120 return "<h" + t + ' id="' + this.options.headerPrefix + n.toLowerCase().replace(/[^\w]+/g, "-") + '">' + e + "</h" + t + ">\n";
8121 }, o.prototype.hr = function() {
8122 return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
8123 }, o.prototype.list = function(e, t) {
8124 var n = t ? "ol" : "ul";
8125 return "<" + n + ">\n" + e + "</" + n + ">\n";
8126 }, o.prototype.listitem = function(e) {
8127 return "<li>" + e + "</li>\n";
8128 }, o.prototype.paragraph = function(e) {
8129 return "<p>" + e + "</p>\n";
8130 }, o.prototype.table = function(e, t) {
8131 return "<table>\n<thead>\n" + e + "</thead>\n<tbody>\n" + t + "</tbody>\n</table>\n";
8132 }, o.prototype.tablerow = function(e) {
8133 return "<tr>\n" + e + "</tr>\n";
8134 }, o.prototype.tablecell = function(e, t) {
8135 var n = t.header ? "th" : "td";
8136 return (t.align ? "<" + n + ' style="text-align:' + t.align + '">' : "<" + n + ">") + e + "</" + n + ">\n";
8137 }, o.prototype.strong = function(e) {
8138 return "<strong>" + e + "</strong>";
8139 }, o.prototype.em = function(e) {
8140 return "<em>" + e + "</em>";
8141 }, o.prototype.codespan = function(e) {
8142 return "<code>" + e + "</code>";
8143 }, o.prototype.br = function() {
8144 return this.options.xhtml ? "<br/>" : "<br>";
8145 }, o.prototype.del = function(e) {
8146 return "<del>" + e + "</del>";
8147 }, o.prototype.link = function(e, t, n) {
8148 if (this.options.sanitize) {
8149 try {
8150 var r = decodeURIComponent(s(e)).replace(/[^\w:]/g, "").toLowerCase();
8151 } catch (i) {
8152 return "";
8153 }
8154 if (0 === r.indexOf("javascript:") || 0 === r.indexOf("vbscript:")) return "";
8155 }
8156 var o = '<a href="' + e + '"';
8157 return t && (o += ' title="' + t + '"'), o + ">" + n + "</a>";
8158 }, o.prototype.image = function(e, t, n) {
8159 var r = '<img src="' + e + '" alt="' + n + '"';
8160 return t && (r += ' title="' + t + '"'), r + (this.options.xhtml ? "/>" : ">");
8161 }, o.prototype.text = function(e) {
8162 return e;
8163 }, a.parse = function(e, t, n) {
8164 return new a(t, n).parse(e);
8165 }, a.prototype.parse = function(e) {
8166 this.inline = new i(e.links, this.options, this.renderer), this.tokens = e.reverse();
8167 for (var t = ""; this.next(); ) t += this.tok();
8168 return t;
8169 }, a.prototype.next = function() {
8170 return this.token = this.tokens.pop();
8171 }, a.prototype.peek = function() {
8172 return this.tokens[this.tokens.length - 1] || 0;
8173 }, a.prototype.parseText = function() {
8174 for (var e = this.token.text; "text" === this.peek().type; ) e += "\n" + this.next().text;
8175 return this.inline.output(e);
8176 }, a.prototype.tok = function() {
8177 switch (this.token.type) {
8178 case "space":
8179 return "";
8180
8181 case "hr":
8182 return this.renderer.hr();
8183
8184 case "heading":
8185 return this.renderer.heading(this.inline.output(this.token.text), this.token.depth, this.token.text);
8186
8187 case "code":
8188 return this.renderer.code(this.token.text, this.token.lang, this.token.escaped);
8189
8190 case "table":
8191 var e, t, n, i, o = "", a = "";
8192 for (n = "", e = 0; e < this.token.header.length; e++) this.token.align[e], n += this.renderer.tablecell(this.inline.output(this.token.header[e]), {
8193 header: !0,
8194 align: this.token.align[e]
8195 });
8196 for (o += this.renderer.tablerow(n), e = 0; e < this.token.cells.length; e++) {
8197 for (t = this.token.cells[e], n = "", i = 0; i < t.length; i++) n += this.renderer.tablecell(this.inline.output(t[i]), {
8198 header: !1,
8199 align: this.token.align[i]
8200 });
8201 a += this.renderer.tablerow(n);
8202 }
8203 return this.renderer.table(o, a);
8204
8205 case "blockquote_start":
8206 for (a = ""; "blockquote_end" !== this.next().type; ) a += this.tok();
8207 return this.renderer.blockquote(a);
8208
8209 case "list_start":
8210 a = "";
8211 for (var l = this.token.ordered; "list_end" !== this.next().type; ) a += this.tok();
8212 return this.renderer.list(a, l);
8213
8214 case "list_item_start":
8215 for (a = ""; "list_item_end" !== this.next().type; ) a += "text" === this.token.type ? this.parseText() : this.tok();
8216 return this.renderer.listitem(a);
8217
8218 case "loose_item_start":
8219 for (a = ""; "list_item_end" !== this.next().type; ) a += this.tok();
8220 return this.renderer.listitem(a);
8221
8222 case "html":
8223 var s = this.token.pre || this.options.pedantic ? this.token.text : this.inline.output(this.token.text);
8224 return this.renderer.html(s);
8225
8226 case "paragraph":
8227 return this.renderer.paragraph(this.inline.output(this.token.text));
8228
8229 case "text":
8230 return this.renderer.paragraph(this.parseText());
8231 }
8232 }, u.exec = u, h.options = h.setOptions = function(e) {
8233 return f(h.defaults, e), h;
8234 }, h.defaults = {
8235 gfm: !0,
8236 tables: !0,
8237 breaks: !1,
8238 pedantic: !1,
8239 sanitize: !1,
8240 sanitizer: null,
8241 mangle: !0,
8242 smartLists: !1,
8243 silent: !1,
8244 highlight: null,
8245 langPrefix: "lang-",
8246 smartypants: !1,
8247 headerPrefix: "",
8248 renderer: new o,
8249 xhtml: !1
8250 }, h.Parser = a, h.parser = a.parse, h.Renderer = o, h.Lexer = t, h.lexer = t.lex,
8251 h.InlineLexer = i, h.inlineLexer = i.output, h.parse = h, void 0 !== n && "object" == typeof r ? n.exports = h : "function" == typeof e && e.amd ? e((function() {
8252 return h;
8253 })) : this.marked = h;
8254 }).call(function() {
8255 return this || ("undefined" != typeof window ? window : t);
8256 }());
8257 }).call(this, void 0 !== __webpack_require__.g ? __webpack_require__.g : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
8258 }, {} ],
8259 18: [ function(e, t, n) {
8260 (function(n, r) {
8261 "use strict";
8262 var i = function(e, t, n, i) {
8263 if (i = i || {}, this.dictionary = null, this.rules = {}, this.dictionaryTable = {},
8264 this.compoundRules = [], this.compoundRuleCodes = {}, this.replacementTable = [],
8265 this.flags = i.flags || {}, e) {
8266 if (this.dictionary = e, "undefined" != typeof window && "chrome" in window && "extension" in window.chrome && "getURL" in window.chrome.extension) t || (t = this._readFile(chrome.extension.getURL("lib/typo/dictionaries/" + e + "/" + e + ".aff"))),
8267 n || (n = this._readFile(chrome.extension.getURL("lib/typo/dictionaries/" + e + "/" + e + ".dic"))); else {
8268 if (i.dictionaryPath) var o = i.dictionaryPath; else o = void 0 !== r ? r + "/dictionaries" : "./dictionaries";
8269 t || (t = this._readFile(o + "/" + e + "/" + e + ".aff")), n || (n = this._readFile(o + "/" + e + "/" + e + ".dic"));
8270 }
8271 this.rules = this._parseAFF(t), this.compoundRuleCodes = {};
8272 for (var a = 0, l = this.compoundRules.length; l > a; a++) for (var s = this.compoundRules[a], c = 0, u = s.length; u > c; c++) this.compoundRuleCodes[s[c]] = [];
8273 for (var a in "ONLYINCOMPOUND" in this.flags && (this.compoundRuleCodes[this.flags.ONLYINCOMPOUND] = []),
8274 this.dictionaryTable = this._parseDIC(n), this.compoundRuleCodes) 0 == this.compoundRuleCodes[a].length && delete this.compoundRuleCodes[a];
8275 for (a = 0, l = this.compoundRules.length; l > a; a++) {
8276 var f = this.compoundRules[a], h = "";
8277 for (c = 0, u = f.length; u > c; c++) {
8278 var d = f[c];
8279 h += d in this.compoundRuleCodes ? "(" + this.compoundRuleCodes[d].join("|") + ")" : d;
8280 }
8281 this.compoundRules[a] = new RegExp(h, "i");
8282 }
8283 }
8284 return this;
8285 };
8286 i.prototype = {
8287 load: function(e) {
8288 for (var t in e) this[t] = e[t];
8289 return this;
8290 },
8291 _readFile: function(t, r) {
8292 if (r || (r = "utf8"), "undefined" != typeof XMLHttpRequest) {
8293 var i = new XMLHttpRequest;
8294 return i.open("GET", t, !1), i.overrideMimeType && i.overrideMimeType("text/plain; charset=" + r),
8295 i.send(null), i.responseText;
8296 }
8297 if (void 0 !== e) {
8298 var o = e("fs");
8299 try {
8300 if (o.existsSync(t)) {
8301 var a = o.statSync(t), l = o.openSync(t, "r"), s = new n(a.size);
8302 return o.readSync(l, s, 0, s.length, null), s.toString(r, 0, s.length);
8303 }
8304 } catch (c) {
8305 return "";
8306 }
8307 }
8308 },
8309 _parseAFF: function(e) {
8310 for (var t = {}, n = (e = this._removeAffixComments(e)).split("\n"), r = 0, i = n.length; i > r; r++) {
8311 var a = (o = n[r]).split(/\s+/), l = a[0];
8312 if ("PFX" == l || "SFX" == l) {
8313 for (var s = a[1], c = a[2], f = [], h = r + 1, d = r + 1 + (u = parseInt(a[3], 10)); d > h; h++) {
8314 var m = (p = (o = n[h]).split(/\s+/))[2], g = p[3].split("/"), v = g[0];
8315 "0" === v && (v = "");
8316 var y = this.parseRuleCodes(g[1]), x = p[4], b = {};
8317 b.add = v, y.length > 0 && (b.continuationClasses = y), "." !== x && (b.match = "SFX" === l ? new RegExp(x + "$") : new RegExp("^" + x)),
8318 "0" != m && (b.remove = "SFX" === l ? new RegExp(m + "$") : m), f.push(b);
8319 }
8320 t[s] = {
8321 type: l,
8322 combineable: "Y" == c,
8323 entries: f
8324 }, r += u;
8325 } else if ("COMPOUNDRULE" === l) {
8326 var u;
8327 for (h = r + 1, d = r + 1 + (u = parseInt(a[1], 10)); d > h; h++) {
8328 var o, p = (o = n[h]).split(/\s+/);
8329 this.compoundRules.push(p[1]);
8330 }
8331 r += u;
8332 } else "REP" === l ? 3 === (p = o.split(/\s+/)).length && this.replacementTable.push([ p[1], p[2] ]) : this.flags[l] = a[1];
8333 }
8334 return t;
8335 },
8336 _removeAffixComments: function(e) {
8337 return (e = (e = (e = e.replace(/#.*$/gm, "")).replace(/^\s\s*/m, "").replace(/\s\s*$/m, "")).replace(/\n{2,}/g, "\n")).replace(/^\s\s*/, "").replace(/\s\s*$/, "");
8338 },
8339 _parseDIC: function(e) {
8340 function t(e, t) {
8341 e in r && "object" == typeof r[e] || (r[e] = []), r[e].push(t);
8342 }
8343 for (var n = (e = this._removeDicComments(e)).split("\n"), r = {}, i = 1, o = n.length; o > i; i++) {
8344 var l = n[i].split("/", 2), s = l[0];
8345 if (l.length > 1) {
8346 var c = this.parseRuleCodes(l[1]);
8347 "NEEDAFFIX" in this.flags && -1 != c.indexOf(this.flags.NEEDAFFIX) || t(s, c);
8348 for (var u = 0, f = c.length; f > u; u++) {
8349 var h = c[u], d = this.rules[h];
8350 if (d) for (var p = this._applyRule(s, d), m = 0, g = p.length; g > m; m++) {
8351 var v = p[m];
8352 if (t(v, []), d.combineable) for (var y = u + 1; f > y; y++) {
8353 var x = c[y], b = this.rules[x];
8354 if (b && b.combineable && d.type != b.type) for (var w = this._applyRule(v, b), k = 0, S = w.length; S > k; k++) t(w[k], []);
8355 }
8356 }
8357 h in this.compoundRuleCodes && this.compoundRuleCodes[h].push(s);
8358 }
8359 } else t(s.trim(), []);
8360 }
8361 return r;
8362 },
8363 _removeDicComments: function(e) {
8364 return e.replace(/^\t.*$/gm, "");
8365 },
8366 parseRuleCodes: function(e) {
8367 if (!e) return [];
8368 if (!("FLAG" in this.flags)) return e.split("");
8369 if ("long" === this.flags.FLAG) {
8370 for (var t = [], n = 0, r = e.length; r > n; n += 2) t.push(e.substr(n, 2));
8371 return t;
8372 }
8373 return "num" === this.flags.FLAG ? textCode.split(",") : void 0;
8374 },
8375 _applyRule: function(e, t) {
8376 for (var n = t.entries, r = [], i = 0, o = n.length; o > i; i++) {
8377 var a = n[i];
8378 if (!a.match || e.match(a.match)) {
8379 var l = e;
8380 if (a.remove && (l = l.replace(a.remove, "")), "SFX" === t.type ? l += a.add : l = a.add + l,
8381 r.push(l), "continuationClasses" in a) for (var s = 0, c = a.continuationClasses.length; c > s; s++) {
8382 var u = this.rules[a.continuationClasses[s]];
8383 u && (r = r.concat(this._applyRule(l, u)));
8384 }
8385 }
8386 }
8387 return r;
8388 },
8389 check: function(e) {
8390 var t = e.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
8391 if (this.checkExact(t)) return !0;
8392 if (t.toUpperCase() === t) {
8393 var n = t[0] + t.substring(1).toLowerCase();
8394 if (this.hasFlag(n, "KEEPCASE")) return !1;
8395 if (this.checkExact(n)) return !0;
8396 }
8397 var r = t.toLowerCase();
8398 if (r !== t) {
8399 if (this.hasFlag(r, "KEEPCASE")) return !1;
8400 if (this.checkExact(r)) return !0;
8401 }
8402 return !1;
8403 },
8404 checkExact: function(e) {
8405 var t = this.dictionaryTable[e];
8406 if (void 0 === t) {
8407 if ("COMPOUNDMIN" in this.flags && e.length >= this.flags.COMPOUNDMIN) for (var n = 0, r = this.compoundRules.length; r > n; n++) if (e.match(this.compoundRules[n])) return !0;
8408 return !1;
8409 }
8410 if ("object" == typeof t) {
8411 for (n = 0, r = t.length; r > n; n++) if (!this.hasFlag(e, "ONLYINCOMPOUND", t[n])) return !0;
8412 return !1;
8413 }
8414 },
8415 hasFlag: function(e, t, n) {
8416 return !(!(t in this.flags) || (void 0 === n && (n = Array.prototype.concat.apply([], this.dictionaryTable[e])),
8417 !n || -1 === n.indexOf(this.flags[t])));
8418 },
8419 alphabet: "",
8420 suggest: function(e, t) {
8421 function n(e) {
8422 for (var t = [], n = 0, r = e.length; r > n; n++) {
8423 for (var i = e[n], o = [], a = 0, l = i.length + 1; l > a; a++) o.push([ i.substring(0, a), i.substring(a, i.length) ]);
8424 var s = [];
8425 for (a = 0, l = o.length; l > a; a++) (u = o[a])[1] && s.push(u[0] + u[1].substring(1));
8426 var f = [];
8427 for (a = 0, l = o.length; l > a; a++) (u = o[a])[1].length > 1 && f.push(u[0] + u[1][1] + u[1][0] + u[1].substring(2));
8428 var h = [];
8429 for (a = 0, l = o.length; l > a; a++) if ((u = o[a])[1]) for (var d = 0, p = c.alphabet.length; p > d; d++) h.push(u[0] + c.alphabet[d] + u[1].substring(1));
8430 var m = [];
8431 for (a = 0, l = o.length; l > a; a++) {
8432 var u;
8433 if ((u = o[a])[1]) for (d = 0, p = c.alphabet.length; p > d; d++) h.push(u[0] + c.alphabet[d] + u[1]);
8434 }
8435 t = (t = (t = (t = t.concat(s)).concat(f)).concat(h)).concat(m);
8436 }
8437 return t;
8438 }
8439 function r(e) {
8440 for (var t = [], n = 0; n < e.length; n++) c.check(e[n]) && t.push(e[n]);
8441 return t;
8442 }
8443 function i(e) {
8444 function i(e, t) {
8445 return e[1] < t[1] ? -1 : 1;
8446 }
8447 for (var o = n([ e ]), a = n(o), l = r(o).concat(r(a)), s = {}, u = 0, f = l.length; f > u; u++) l[u] in s ? s[l[u]] += 1 : s[l[u]] = 1;
8448 var h = [];
8449 for (var u in s) h.push([ u, s[u] ]);
8450 h.sort(i).reverse();
8451 var d = [];
8452 for (u = 0, f = Math.min(t, h.length); f > u; u++) c.hasFlag(h[u][0], "NOSUGGEST") || d.push(h[u][0]);
8453 return d;
8454 }
8455 if (t || (t = 5), this.check(e)) return [];
8456 for (var o = 0, a = this.replacementTable.length; a > o; o++) {
8457 var l = this.replacementTable[o];
8458 if (-1 !== e.indexOf(l[0])) {
8459 var s = e.replace(l[0], l[1]);
8460 if (this.check(s)) return [ s ];
8461 }
8462 }
8463 var c = this;
8464 return c.alphabet = "abcdefghijklmnopqrstuvwxyz", i(e);
8465 }
8466 }, void 0 !== t && (t.exports = i);
8467 }).call(this, e("buffer").Buffer, "/node_modules/typo-js");
8468 }, {
8469 buffer: 3,
8470 fs: 2
8471 } ],
8472 19: [ function(e, t, n) {
8473 var r = e("codemirror");
8474 r.commands.tabAndIndentMarkdownList = function(e) {
8475 var n = e.listSelections()[0].head;
8476 if (!1 !== e.getStateAfter(n.line).list) e.execCommand("indentMore"); else if (e.options.indentWithTabs) e.execCommand("insertTab"); else {
8477 var o = Array(e.options.tabSize + 1).join(" ");
8478 e.replaceSelection(o);
8479 }
8480 }, r.commands.shiftTabAndUnindentMarkdownList = function(e) {
8481 var n = e.listSelections()[0].head;
8482 if (!1 !== e.getStateAfter(n.line).list) e.execCommand("indentLess"); else if (e.options.indentWithTabs) e.execCommand("insertTab"); else {
8483 var o = Array(e.options.tabSize + 1).join(" ");
8484 e.replaceSelection(o);
8485 }
8486 };
8487 }, {
8488 codemirror: 10
8489 } ],
8490 20: [ function(e, t, n) {
8491 "use strict";
8492 function r(e) {
8493 return U ? e.replace("Ctrl", "Cmd") : e.replace("Cmd", "Ctrl");
8494 }
8495 function i(e, t, n) {
8496 e = e || {};
8497 var r = document.createElement("a");
8498 return t = null == t || t, e.title && t && (r.title = a(e.title, e.action, n), U && (r.title = r.title.replace("Ctrl", "⌘"),
8499 r.title = r.title.replace("Alt", "⌥"))), r.tabIndex = -1, r.className = e.className,
8500 r;
8501 }
8502 function o() {
8503 var e = document.createElement("i");
8504 return e.className = "separator", e.innerHTML = "|", e;
8505 }
8506 function a(e, t, n) {
8507 var i, o = e;
8508 return t && n[i = Y(t)] && (o += " (" + r(n[i]) + ")"), o;
8509 }
8510 function l(e, t) {
8511 t = t || e.getCursor("start");
8512 var n = e.getTokenAt(t);
8513 if (!n.type) return {};
8514 for (var r, i, o = n.type.split(" "), a = {}, l = 0; l < o.length; l++) "strong" === (r = o[l]) ? a.bold = !0 : "variable-2" === r ? (i = e.getLine(t.line),
8515 /^\s*\d+\.\s/.test(i) ? a["ordered-list"] = !0 : a["unordered-list"] = !0) : "atom" === r ? a.quote = !0 : "em" === r ? a.italic = !0 : "quote" === r ? a.quote = !0 : "strikethrough" === r ? a.strikethrough = !0 : "comment" === r ? a.code = !0 : "link" === r ? a.link = !0 : "tag" === r ? a.image = !0 : r.match(/^header(\-[1-6])?$/) && (a[r.replace("header", "heading")] = !0);
8516 return a;
8517 }
8518 function s(e) {
8519 var t = e.codemirror;
8520 t.setOption("fullScreen", !t.getOption("fullScreen")), t.getOption("fullScreen") ? (V = document.body.style.overflow,
8521 document.body.style.overflow = "hidden") : document.body.style.overflow = V;
8522 var n = t.getWrapperElement();
8523 /fullscreen/.test(n.previousSibling.className) ? n.previousSibling.className = n.previousSibling.className.replace(/\s*fullscreen\b/, "") : n.previousSibling.className += " fullscreen";
8524 var r = e.toolbarElements.fullscreen;
8525 /active/.test(r.className) ? r.className = r.className.replace(/\s*active\s*/g, "") : r.className += " active";
8526 var i = t.getWrapperElement().nextSibling;
8527 /editor-preview-active-side/.test(i.className) && N(e);
8528 }
8529 function c(e) {
8530 P(e, "bold", e.options.blockStyles.bold);
8531 }
8532 function u(e) {
8533 P(e, "italic", e.options.blockStyles.italic);
8534 }
8535 function f(e) {
8536 P(e, "strikethrough", "~~");
8537 }
8538 function h(e) {
8539 function t(e) {
8540 if ("object" != typeof e) throw "fencing_line() takes a 'line' object (not a line number, or line text). Got: " + typeof e + ": " + e;
8541 return e.styles && e.styles[2] && -1 !== e.styles[2].indexOf("formatting-code-block");
8542 }
8543 function n(e) {
8544 return e.state.base.base || e.state.base;
8545 }
8546 function r(e, r, i, o, a) {
8547 i = i || e.getLineHandle(r), o = o || e.getTokenAt({
8548 line: r,
8549 ch: 1
8550 }), a = a || !!i.text && e.getTokenAt({
8551 line: r,
8552 ch: i.text.length - 1
8553 });
8554 var l = o.type ? o.type.split(" ") : [];
8555 return a && n(a).indentedCode ? "indented" : -1 !== l.indexOf("comment") && (n(o).fencedChars || n(a).fencedChars || t(i) ? "fenced" : "single");
8556 }
8557 function i(e, t, n, r) {
8558 var i = t.line + 1, o = n.line + 1, a = t.line !== n.line, l = r + "\n", s = "\n" + r;
8559 a && o++, a && 0 === n.ch && (s = r + "\n", o--), E(e, !1, [ l, s ]), e.setSelection({
8560 line: i,
8561 ch: 0
8562 }, {
8563 line: o,
8564 ch: 0
8565 });
8566 }
8567 var o, a, l, s = e.options.blockStyles.code, c = e.codemirror, u = c.getCursor("start"), f = c.getCursor("end"), h = c.getTokenAt({
8568 line: u.line,
8569 ch: u.ch || 1
8570 }), d = c.getLineHandle(u.line), p = r(c, u.line, d, h);
8571 if ("single" === p) {
8572 var m = d.text.slice(0, u.ch).replace("`", ""), g = d.text.slice(u.ch).replace("`", "");
8573 c.replaceRange(m + g, {
8574 line: u.line,
8575 ch: 0
8576 }, {
8577 line: u.line,
8578 ch: 99999999999999
8579 }), u.ch--, u !== f && f.ch--, c.setSelection(u, f), c.focus();
8580 } else if ("fenced" === p) if (u.line !== f.line || u.ch !== f.ch) {
8581 for (o = u.line; o >= 0 && !t(d = c.getLineHandle(o)); o--) ;
8582 var v, y, x, b, k = n(c.getTokenAt({
8583 line: o,
8584 ch: 1
8585 })).fencedChars;
8586 t(c.getLineHandle(u.line)) ? (v = "", y = u.line) : t(c.getLineHandle(u.line - 1)) ? (v = "",
8587 y = u.line - 1) : (v = k + "\n", y = u.line), t(c.getLineHandle(f.line)) ? (x = "",
8588 b = f.line, 0 === f.ch && (b += 1)) : 0 !== f.ch && t(c.getLineHandle(f.line + 1)) ? (x = "",
8589 b = f.line + 1) : (x = k + "\n", b = f.line + 1), 0 === f.ch && (b -= 1), c.operation((function() {
8590 c.replaceRange(x, {
8591 line: b,
8592 ch: 0
8593 }, {
8594 line: b + (x ? 0 : 1),
8595 ch: 0
8596 }), c.replaceRange(v, {
8597 line: y,
8598 ch: 0
8599 }, {
8600 line: y + (v ? 0 : 1),
8601 ch: 0
8602 });
8603 })), c.setSelection({
8604 line: y + (v ? 1 : 0),
8605 ch: 0
8606 }, {
8607 line: b + (v ? 1 : -1),
8608 ch: 0
8609 }), c.focus();
8610 } else {
8611 var S = u.line;
8612 if (t(c.getLineHandle(u.line)) && ("fenced" === r(c, u.line + 1) ? (o = u.line,
8613 S = u.line + 1) : (a = u.line, S = u.line - 1)), void 0 === o) for (o = S; o >= 0 && !t(d = c.getLineHandle(o)); o--) ;
8614 if (void 0 === a) for (l = c.lineCount(), a = S; l > a && !t(d = c.getLineHandle(a)); a++) ;
8615 c.operation((function() {
8616 c.replaceRange("", {
8617 line: o,
8618 ch: 0
8619 }, {
8620 line: o + 1,
8621 ch: 0
8622 }), c.replaceRange("", {
8623 line: a - 1,
8624 ch: 0
8625 }, {
8626 line: a,
8627 ch: 0
8628 });
8629 })), c.focus();
8630 } else if ("indented" === p) {
8631 if (u.line !== f.line || u.ch !== f.ch) o = u.line, a = f.line, 0 === f.ch && a--; else {
8632 for (o = u.line; o >= 0; o--) if (!(d = c.getLineHandle(o)).text.match(/^\s*$/) && "indented" !== r(c, o, d)) {
8633 o += 1;
8634 break;
8635 }
8636 for (l = c.lineCount(), a = u.line; l > a; a++) if (!(d = c.getLineHandle(a)).text.match(/^\s*$/) && "indented" !== r(c, a, d)) {
8637 a -= 1;
8638 break;
8639 }
8640 }
8641 var C = c.getLineHandle(a + 1), L = C && c.getTokenAt({
8642 line: a + 1,
8643 ch: C.text.length - 1
8644 });
8645 L && n(L).indentedCode && c.replaceRange("\n", {
8646 line: a + 1,
8647 ch: 0
8648 });
8649 for (var M = o; a >= M; M++) c.indentLine(M, "subtract");
8650 c.focus();
8651 } else {
8652 var N = u.line === f.line && u.ch === f.ch && 0 === u.ch, A = u.line !== f.line;
8653 N || A ? i(c, u, f, s) : E(c, !1, [ "`", "`" ]);
8654 }
8655 }
8656 function d(e) {
8657 I(e.codemirror, "quote");
8658 }
8659 function p(e) {
8660 O(e.codemirror, "smaller");
8661 }
8662 function m(e) {
8663 O(e.codemirror, "bigger");
8664 }
8665 function g(e) {
8666 O(e.codemirror, void 0, 1);
8667 }
8668 function v(e) {
8669 O(e.codemirror, void 0, 2);
8670 }
8671 function y(e) {
8672 O(e.codemirror, void 0, 3);
8673 }
8674 function x(e) {
8675 I(e.codemirror, "unordered-list");
8676 }
8677 function b(e) {
8678 I(e.codemirror, "ordered-list");
8679 }
8680 function w(e) {
8681 R(e.codemirror);
8682 }
8683 function k(e) {
8684 var t = e.codemirror, n = l(t), r = e.options, i = "http://";
8685 return !(r.promptURLs && (i = prompt(r.promptTexts.link), !i)) && void E(t, n.link, r.insertTexts.link, i);
8686 }
8687 function S(e) {
8688 var t = e.codemirror, n = l(t), r = e.options, i = "http://";
8689 return !(r.promptURLs && (i = prompt(r.promptTexts.image), !i)) && void E(t, n.image, r.insertTexts.image, i);
8690 }
8691 function C(e) {
8692 var t = e.codemirror, n = l(t), r = e.options;
8693 E(t, n.table, r.insertTexts.table);
8694 }
8695 function L(e) {
8696 var t = e.codemirror, n = l(t), r = e.options;
8697 E(t, n.image, r.insertTexts.horizontalRule);
8698 }
8699 function T(e) {
8700 var t = e.codemirror;
8701 t.undo(), t.focus();
8702 }
8703 function M(e) {
8704 var t = e.codemirror;
8705 t.redo(), t.focus();
8706 }
8707 function N(e) {
8708 var t = e.codemirror, n = t.getWrapperElement(), r = n.nextSibling, i = e.toolbarElements["side-by-side"], o = !1;
8709 /editor-preview-active-side/.test(r.className) ? (r.className = r.className.replace(/\s*editor-preview-active-side\s*/g, ""),
8710 i.className = i.className.replace(/\s*active\s*/g, ""), n.className = n.className.replace(/\s*CodeMirror-sided\s*/g, " ")) : (setTimeout((function() {
8711 t.getOption("fullScreen") || s(e), r.className += " editor-preview-active-side";
8712 }), 1), i.className += " active", n.className += " CodeMirror-sided", o = !0);
8713 var a = n.lastChild;
8714 if (/editor-preview-active/.test(a.className)) {
8715 a.className = a.className.replace(/\s*editor-preview-active\s*/g, "");
8716 var l = e.toolbarElements.preview, c = n.previousSibling;
8717 l.className = l.className.replace(/\s*active\s*/g, ""), c.className = c.className.replace(/\s*disabled-for-preview*/g, "");
8718 }
8719 var u = function() {
8720 r.innerHTML = e.options.previewRender(e.value(), r);
8721 };
8722 t.sideBySideRenderingFunction || (t.sideBySideRenderingFunction = u), o ? (r.innerHTML = e.options.previewRender(e.value(), r),
8723 t.on("update", t.sideBySideRenderingFunction)) : t.off("update", t.sideBySideRenderingFunction),
8724 t.refresh();
8725 }
8726 function A(e) {
8727 var t = e.codemirror, n = t.getWrapperElement(), r = n.previousSibling, i = !!e.options.toolbar && e.toolbarElements.preview, o = n.lastChild;
8728 o && /editor-preview/.test(o.className) || ((o = document.createElement("div")).className = "editor-preview",
8729 n.appendChild(o)), /editor-preview-active/.test(o.className) ? (o.className = o.className.replace(/\s*editor-preview-active\s*/g, ""),
8730 i && (i.className = i.className.replace(/\s*active\s*/g, ""), r.className = r.className.replace(/\s*disabled-for-preview*/g, ""))) : (setTimeout((function() {
8731 o.className += " editor-preview-active";
8732 }), 1), i && (i.className += " active", r.className += " disabled-for-preview")),
8733 o.innerHTML = e.options.previewRender(e.value(), o);
8734 var a = t.getWrapperElement().nextSibling;
8735 /editor-preview-active-side/.test(a.className) && N(e);
8736 }
8737 function E(e, t, n, r) {
8738 if (!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)) {
8739 var i, o = n[0], a = n[1], l = e.getCursor("start"), s = e.getCursor("end");
8740 r && (a = a.replace("#url#", r)), t ? (o = (i = e.getLine(l.line)).slice(0, l.ch),
8741 a = i.slice(l.ch), e.replaceRange(o + a, {
8742 line: l.line,
8743 ch: 0
8744 })) : (i = e.getSelection(), e.replaceSelection(o + i + a), l.ch += o.length, l !== s && (s.ch += o.length)),
8745 e.setSelection(l, s), e.focus();
8746 }
8747 }
8748 function O(e, t, n) {
8749 if (!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)) {
8750 for (var r = e.getCursor("start"), i = e.getCursor("end"), o = r.line; o <= i.line; o++) !function(r) {
8751 var i = e.getLine(r), o = i.search(/[^#]/);
8752 i = void 0 !== t ? 0 >= o ? "bigger" == t ? "###### " + i : "# " + i : 6 == o && "smaller" == t ? i.substr(7) : 1 == o && "bigger" == t ? i.substr(2) : "bigger" == t ? i.substr(1) : "#" + i : 1 == n ? 0 >= o ? "# " + i : o == n ? i.substr(o + 1) : "# " + i.substr(o + 1) : 2 == n ? 0 >= o ? "## " + i : o == n ? i.substr(o + 1) : "## " + i.substr(o + 1) : 0 >= o ? "### " + i : o == n ? i.substr(o + 1) : "### " + i.substr(o + 1),
8753 e.replaceRange(i, {
8754 line: r,
8755 ch: 0
8756 }, {
8757 line: r,
8758 ch: 99999999999999
8759 });
8760 }(o);
8761 e.focus();
8762 }
8763 }
8764 function I(e, t) {
8765 if (!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)) {
8766 for (var n = l(e), r = e.getCursor("start"), i = e.getCursor("end"), o = {
8767 quote: /^(\s*)\>\s+/,
8768 "unordered-list": /^(\s*)(\*|\-|\+)\s+/,
8769 "ordered-list": /^(\s*)\d+\.\s+/
8770 }, a = {
8771 quote: "> ",
8772 "unordered-list": "* ",
8773 "ordered-list": "1. "
8774 }, s = r.line; s <= i.line; s++) !function(r) {
8775 var i = e.getLine(r);
8776 i = n[t] ? i.replace(o[t], "$1") : a[t] + i, e.replaceRange(i, {
8777 line: r,
8778 ch: 0
8779 }, {
8780 line: r,
8781 ch: 99999999999999
8782 });
8783 }(s);
8784 e.focus();
8785 }
8786 }
8787 function P(e, t, n, r) {
8788 if (!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)) {
8789 r = void 0 === r ? n : r;
8790 var i, o = e.codemirror, a = l(o), s = n, c = r, u = o.getCursor("start"), f = o.getCursor("end");
8791 a[t] ? (s = (i = o.getLine(u.line)).slice(0, u.ch), c = i.slice(u.ch), "bold" == t ? (s = s.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/, ""),
8792 c = c.replace(/(\*\*|__)/, "")) : "italic" == t ? (s = s.replace(/(\*|_)(?![\s\S]*(\*|_))/, ""),
8793 c = c.replace(/(\*|_)/, "")) : "strikethrough" == t && (s = s.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/, ""),
8794 c = c.replace(/(\*\*|~~)/, "")), o.replaceRange(s + c, {
8795 line: u.line,
8796 ch: 0
8797 }, {
8798 line: u.line,
8799 ch: 99999999999999
8800 }), "bold" == t || "strikethrough" == t ? (u.ch -= 2, u !== f && (f.ch -= 2)) : "italic" == t && (u.ch -= 1,
8801 u !== f && (f.ch -= 1))) : (i = o.getSelection(), "bold" == t ? i = (i = i.split("**").join("")).split("__").join("") : "italic" == t ? i = (i = i.split("*").join("")).split("_").join("") : "strikethrough" == t && (i = i.split("~~").join("")),
8802 o.replaceSelection(s + i + c), u.ch += n.length, f.ch = u.ch + i.length), o.setSelection(u, f),
8803 o.focus();
8804 }
8805 }
8806 function R(e) {
8807 if (!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)) for (var t, n = e.getCursor("start"), r = e.getCursor("end"), i = n.line; i <= r.line; i++) t = (t = e.getLine(i)).replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/, ""),
8808 e.replaceRange(t, {
8809 line: i,
8810 ch: 0
8811 }, {
8812 line: i,
8813 ch: 99999999999999
8814 });
8815 }
8816 function D(e, t) {
8817 for (var n in t) t.hasOwnProperty(n) && (t[n] instanceof Array ? e[n] = t[n].concat(e[n] instanceof Array ? e[n] : []) : null !== t[n] && "object" == typeof t[n] && t[n].constructor === Object ? e[n] = D(e[n] || {}, t[n]) : e[n] = t[n]);
8818 return e;
8819 }
8820 function H(e) {
8821 for (var t = 1; t < arguments.length; t++) e = D(e, arguments[t]);
8822 return e;
8823 }
8824 function W(e) {
8825 var t = /[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g, n = e.match(t), r = 0;
8826 if (null === n) return r;
8827 for (var i = 0; i < n.length; i++) r += n[i].charCodeAt(0) >= 19968 ? n[i].length : 1;
8828 return r;
8829 }
8830 function B(e) {
8831 (e = e || {}).parent = this;
8832 var t = !0;
8833 if (!1 === e.autoDownloadFontAwesome && (t = !1), !0 !== e.autoDownloadFontAwesome) for (var n = document.styleSheets, r = 0; r < n.length; r++) n[r].href && n[r].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/") > -1 && (t = !1);
8834 if (t) {
8835 var i = document.createElement("link");
8836 i.rel = "stylesheet", i.href = "https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",
8837 document.getElementsByTagName("head")[0].appendChild(i);
8838 }
8839 if (e.element) this.element = e.element; else if (null === e.element) return;
8840 if (void 0 === e.toolbar) for (var o in e.toolbar = [], K) K.hasOwnProperty(o) && (-1 != o.indexOf("separator-") && e.toolbar.push("|"),
8841 (!0 === K[o].default || e.showIcons && e.showIcons.constructor === Array && -1 != e.showIcons.indexOf(o)) && e.toolbar.push(o));
8842 e.hasOwnProperty("status") || (e.status = [ "autosave", "lines", "words", "cursor" ]),
8843 e.previewRender || (e.previewRender = function(e) {
8844 return this.parent.markdown(e);
8845 }), e.parsingConfig = H({
8846 highlightFormatting: !0
8847 }, e.parsingConfig || {}), e.insertTexts = H({}, X, e.insertTexts || {}), e.promptTexts = Z,
8848 e.blockStyles = H({}, J, e.blockStyles || {}), e.shortcuts = H({}, G, e.shortcuts || {}),
8849 null != e.autosave && null != e.autosave.unique_id && "" != e.autosave.unique_id && (e.autosave.uniqueId = e.autosave.unique_id),
8850 this.options = e, this.render(), !e.initialValue || this.options.autosave && !0 === this.options.autosave.foundSavedValue || this.value(e.initialValue);
8851 }
8852 function _() {
8853 if ("object" != typeof localStorage) return !1;
8854 try {
8855 localStorage.setItem("smde_localStorage", 1), localStorage.removeItem("smde_localStorage");
8856 } catch (e) {
8857 return !1;
8858 }
8859 return !0;
8860 }
8861 var F = e("codemirror");
8862 e("codemirror/addon/edit/continuelist.js"), e("./codemirror/tablist"), e("codemirror/addon/display/fullscreen.js"),
8863 e("codemirror/mode/markdown/markdown.js"), e("codemirror/addon/mode/overlay.js"),
8864 e("codemirror/addon/display/placeholder.js"), e("codemirror/addon/selection/mark-selection.js"),
8865 e("codemirror/mode/gfm/gfm.js"), e("codemirror/mode/xml/xml.js");
8866 var z = e("codemirror-spell-checker"), j = e("marked"), U = /Mac/.test(navigator.platform), q = {
8867 toggleBold: c,
8868 toggleItalic: u,
8869 drawLink: k,
8870 toggleHeadingSmaller: p,
8871 toggleHeadingBigger: m,
8872 drawImage: S,
8873 toggleBlockquote: d,
8874 toggleOrderedList: b,
8875 toggleUnorderedList: x,
8876 toggleCodeBlock: h,
8877 togglePreview: A,
8878 toggleStrikethrough: f,
8879 toggleHeading1: g,
8880 toggleHeading2: v,
8881 toggleHeading3: y,
8882 cleanBlock: w,
8883 drawTable: C,
8884 drawHorizontalRule: L,
8885 undo: T,
8886 redo: M,
8887 toggleSideBySide: N,
8888 toggleFullScreen: s
8889 }, G = {
8890 toggleBold: "Cmd-B",
8891 toggleItalic: "Cmd-I",
8892 drawLink: "Cmd-K",
8893 toggleHeadingSmaller: "Cmd-H",
8894 toggleHeadingBigger: "Shift-Cmd-H",
8895 cleanBlock: "Cmd-E",
8896 drawImage: "Cmd-Alt-I",
8897 toggleBlockquote: "Cmd-'",
8898 toggleOrderedList: "Cmd-Alt-L",
8899 toggleUnorderedList: "Cmd-L",
8900 toggleCodeBlock: "Cmd-Alt-C",
8901 togglePreview: "Cmd-P",
8902 toggleSideBySide: "F9",
8903 toggleFullScreen: "F11"
8904 }, Y = function(e) {
8905 for (var t in q) if (q[t] === e) return t;
8906 return null;
8907 }, $ = function() {
8908 var e = !1;
8909 return function(t) {
8910 (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4))) && (e = !0);
8911 }(navigator.userAgent || navigator.vendor || window.opera), e;
8912 }, V = "", K = {
8913 bold: {
8914 name: "bold",
8915 action: c,
8916 className: "fa fa-bold",
8917 title: "Bold",
8918 default: !0
8919 },
8920 italic: {
8921 name: "italic",
8922 action: u,
8923 className: "fa fa-italic",
8924 title: "Italic",
8925 default: !0
8926 },
8927 strikethrough: {
8928 name: "strikethrough",
8929 action: f,
8930 className: "fa fa-strikethrough",
8931 title: "Strikethrough"
8932 },
8933 heading: {
8934 name: "heading",
8935 action: p,
8936 className: "fa fa-header",
8937 title: "Heading",
8938 default: !0
8939 },
8940 "heading-smaller": {
8941 name: "heading-smaller",
8942 action: p,
8943 className: "fa fa-header fa-header-x fa-header-smaller",
8944 title: "Smaller Heading"
8945 },
8946 "heading-bigger": {
8947 name: "heading-bigger",
8948 action: m,
8949 className: "fa fa-header fa-header-x fa-header-bigger",
8950 title: "Bigger Heading"
8951 },
8952 "heading-1": {
8953 name: "heading-1",
8954 action: g,
8955 className: "fa fa-header fa-header-x fa-header-1",
8956 title: "Big Heading"
8957 },
8958 "heading-2": {
8959 name: "heading-2",
8960 action: v,
8961 className: "fa fa-header fa-header-x fa-header-2",
8962 title: "Medium Heading"
8963 },
8964 "heading-3": {
8965 name: "heading-3",
8966 action: y,
8967 className: "fa fa-header fa-header-x fa-header-3",
8968 title: "Small Heading"
8969 },
8970 "separator-1": {
8971 name: "separator-1"
8972 },
8973 code: {
8974 name: "code",
8975 action: h,
8976 className: "fa fa-code",
8977 title: "Code"
8978 },
8979 quote: {
8980 name: "quote",
8981 action: d,
8982 className: "fa fa-quote-left",
8983 title: "Quote",
8984 default: !0
8985 },
8986 "unordered-list": {
8987 name: "unordered-list",
8988 action: x,
8989 className: "fa fa-list-ul",
8990 title: "Generic List",
8991 default: !0
8992 },
8993 "ordered-list": {
8994 name: "ordered-list",
8995 action: b,
8996 className: "fa fa-list-ol",
8997 title: "Numbered List",
8998 default: !0
8999 },
9000 "clean-block": {
9001 name: "clean-block",
9002 action: w,
9003 className: "fa fa-eraser fa-clean-block",
9004 title: "Clean block"
9005 },
9006 "separator-2": {
9007 name: "separator-2"
9008 },
9009 link: {
9010 name: "link",
9011 action: k,
9012 className: "fa fa-link",
9013 title: "Create Link",
9014 default: !0
9015 },
9016 image: {
9017 name: "image",
9018 action: S,
9019 className: "fa fa-picture-o",
9020 title: "Insert Image",
9021 default: !0
9022 },
9023 table: {
9024 name: "table",
9025 action: C,
9026 className: "fa fa-table",
9027 title: "Insert Table"
9028 },
9029 "horizontal-rule": {
9030 name: "horizontal-rule",
9031 action: L,
9032 className: "fa fa-minus",
9033 title: "Insert Horizontal Line"
9034 },
9035 "separator-3": {
9036 name: "separator-3"
9037 },
9038 preview: {
9039 name: "preview",
9040 action: A,
9041 className: "fa fa-eye no-disable",
9042 title: "Toggle Preview",
9043 default: !0
9044 },
9045 "side-by-side": {
9046 name: "side-by-side",
9047 action: N,
9048 className: "fa fa-columns no-disable no-mobile",
9049 title: "Toggle Side by Side",
9050 default: !0
9051 },
9052 fullscreen: {
9053 name: "fullscreen",
9054 action: s,
9055 className: "fa fa-arrows-alt no-disable no-mobile",
9056 title: "Toggle Fullscreen",
9057 default: !0
9058 },
9059 "separator-4": {
9060 name: "separator-4"
9061 },
9062 guide: {
9063 name: "guide",
9064 action: "https://simplemde.com/markdown-guide",
9065 className: "fa fa-question-circle",
9066 title: "Markdown Guide",
9067 default: !0
9068 },
9069 "separator-5": {
9070 name: "separator-5"
9071 },
9072 undo: {
9073 name: "undo",
9074 action: T,
9075 className: "fa fa-undo no-disable",
9076 title: "Undo"
9077 },
9078 redo: {
9079 name: "redo",
9080 action: M,
9081 className: "fa fa-repeat no-disable",
9082 title: "Redo"
9083 }
9084 }, X = {
9085 link: [ "[", "](#url#)" ],
9086 image: [ "![](", "#url#)" ],
9087 table: [ "", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n" ],
9088 horizontalRule: [ "", "\n\n-----\n\n" ]
9089 }, Z = {
9090 link: "URL for the link:",
9091 image: "URL of the image:"
9092 }, J = {
9093 bold: "**",
9094 code: "```",
9095 italic: "*"
9096 };
9097 B.prototype.markdown = function(e) {
9098 if (j) {
9099 var t = {};
9100 return this.options && this.options.renderingConfig && !1 === this.options.renderingConfig.singleLineBreaks ? t.breaks = !1 : t.breaks = !0,
9101 this.options && this.options.renderingConfig && !0 === this.options.renderingConfig.codeSyntaxHighlighting && window.hljs && (t.highlight = function(e) {
9102 return window.hljs.highlightAuto(e).value;
9103 }), j.setOptions(t), j(e);
9104 }
9105 }, B.prototype.render = function(e) {
9106 if (e || (e = this.element || document.getElementsByTagName("textarea")[0]), !this._rendered || this._rendered !== e) {
9107 this.element = e;
9108 var a, l, t = this.options, n = this, i = {};
9109 for (var o in t.shortcuts) null !== t.shortcuts[o] && null !== q[o] && function(e) {
9110 i[r(t.shortcuts[e])] = function() {
9111 q[e](n);
9112 };
9113 }(o);
9114 if (i.Enter = "newlineAndIndentContinueMarkdownList", i.Tab = "tabAndIndentMarkdownList",
9115 i["Shift-Tab"] = "shiftTabAndUnindentMarkdownList", i.Esc = function(e) {
9116 e.getOption("fullScreen") && s(n);
9117 }, document.addEventListener("keydown", (function(e) {
9118 27 == (e = e || window.event).keyCode && n.codemirror.getOption("fullScreen") && s(n);
9119 }), !1), !1 !== t.spellChecker ? (a = "spell-checker", (l = t.parsingConfig).name = "gfm",
9120 l.gitHubSpice = !1, z({
9121 codeMirrorInstance: F
9122 })) : ((a = t.parsingConfig).name = "gfm", a.gitHubSpice = !1), this.codemirror = F.fromTextArea(e, {
9123 mode: a,
9124 backdrop: l,
9125 theme: "paper",
9126 tabSize: null != t.tabSize ? t.tabSize : 2,
9127 indentUnit: null != t.tabSize ? t.tabSize : 2,
9128 indentWithTabs: !1 !== t.indentWithTabs,
9129 lineNumbers: !1,
9130 autofocus: !0 === t.autofocus,
9131 extraKeys: i,
9132 lineWrapping: !1 !== t.lineWrapping,
9133 allowDropFileTypes: [ "text/plain" ],
9134 placeholder: t.placeholder || e.getAttribute("placeholder") || "",
9135 styleSelectedText: null == t.styleSelectedText || t.styleSelectedText
9136 }), !0 === t.forceSync) {
9137 var c = this.codemirror;
9138 c.on("change", (function() {
9139 c.save();
9140 }));
9141 }
9142 this.gui = {}, !1 !== t.toolbar && (this.gui.toolbar = this.createToolbar()), !1 !== t.status && (this.gui.statusbar = this.createStatusbar()),
9143 null != t.autosave && !0 === t.autosave.enabled && this.autosave(), this.gui.sideBySide = this.createSideBySide(),
9144 this._rendered = this.element;
9145 var u = this.codemirror;
9146 setTimeout(function() {
9147 u.refresh();
9148 }.bind(u), 0);
9149 }
9150 }, B.prototype.autosave = function() {
9151 if (_()) {
9152 var e = this;
9153 if (null == this.options.autosave.uniqueId || "" == this.options.autosave.uniqueId) return;
9154 null != e.element.form && null != e.element.form && e.element.form.addEventListener("submit", (function() {
9155 localStorage.removeItem("smde_" + e.options.autosave.uniqueId);
9156 })), !0 !== this.options.autosave.loaded && ("string" == typeof localStorage.getItem("smde_" + this.options.autosave.uniqueId) && "" != localStorage.getItem("smde_" + this.options.autosave.uniqueId) && (this.codemirror.setValue(localStorage.getItem("smde_" + this.options.autosave.uniqueId)),
9157 this.options.autosave.foundSavedValue = !0), this.options.autosave.loaded = !0),
9158 localStorage.setItem("smde_" + this.options.autosave.uniqueId, e.value());
9159 var t = document.getElementById("autosaved");
9160 if (null != t && null != t && "" != t) {
9161 var n = new Date, r = n.getHours(), i = n.getMinutes(), o = "am", a = r;
9162 a >= 12 && (a = r - 12, o = "pm"), 0 == a && (a = 12), i = 10 > i ? "0" + i : i,
9163 t.innerHTML = "Autosaved: " + a + ":" + i + " " + o;
9164 }
9165 this.autosaveTimeoutId = setTimeout((function() {
9166 e.autosave();
9167 }), this.options.autosave.delay || 1e4);
9168 }
9169 }, B.prototype.clearAutosavedValue = function() {
9170 if (_()) {
9171 if (null == this.options.autosave || null == this.options.autosave.uniqueId || "" == this.options.autosave.uniqueId) return;
9172 localStorage.removeItem("smde_" + this.options.autosave.uniqueId);
9173 }
9174 }, B.prototype.createSideBySide = function() {
9175 var e = this.codemirror, t = e.getWrapperElement(), n = t.nextSibling;
9176 n && /editor-preview-side/.test(n.className) || ((n = document.createElement("div")).className = "editor-preview-side",
9177 t.parentNode.insertBefore(n, t.nextSibling));
9178 var r = !1, i = !1;
9179 return e.on("scroll", (function(e) {
9180 if (r) r = !1; else {
9181 i = !0;
9182 var t = e.getScrollInfo().height - e.getScrollInfo().clientHeight, o = parseFloat(e.getScrollInfo().top) / t, a = (n.scrollHeight - n.clientHeight) * o;
9183 n.scrollTop = a;
9184 }
9185 })), n.onscroll = function() {
9186 if (i) i = !1; else {
9187 r = !0;
9188 var t = n.scrollHeight - n.clientHeight, o = parseFloat(n.scrollTop) / t, a = (e.getScrollInfo().height - e.getScrollInfo().clientHeight) * o;
9189 e.scrollTo(0, a);
9190 }
9191 }, n;
9192 }, B.prototype.createToolbar = function(e) {
9193 if ((e = e || this.options.toolbar) && 0 !== e.length) {
9194 var t;
9195 for (t = 0; t < e.length; t++) null != K[e[t]] && (e[t] = K[e[t]]);
9196 var n = document.createElement("div");
9197 n.className = "editor-toolbar";
9198 var r = this, a = {};
9199 for (r.toolbar = e, t = 0; t < e.length; t++) if (("guide" != e[t].name || !1 !== r.options.toolbarGuideIcon) && !(r.options.hideIcons && -1 != r.options.hideIcons.indexOf(e[t].name) || ("fullscreen" == e[t].name || "side-by-side" == e[t].name) && $())) {
9200 if ("|" === e[t]) {
9201 for (var s = !1, c = t + 1; c < e.length; c++) "|" === e[c] || r.options.hideIcons && -1 != r.options.hideIcons.indexOf(e[c].name) || (s = !0);
9202 if (!s) continue;
9203 }
9204 !function(e) {
9205 var t;
9206 t = "|" === e ? o() : i(e, r.options.toolbarTips, r.options.shortcuts), e.action && ("function" == typeof e.action ? t.onclick = function(t) {
9207 t.preventDefault(), e.action(r);
9208 } : "string" == typeof e.action && (t.href = e.action, t.target = "_blank")), a[e.name || e] = t,
9209 n.appendChild(t);
9210 }(e[t]);
9211 }
9212 r.toolbarElements = a;
9213 var u = this.codemirror;
9214 u.on("cursorActivity", (function() {
9215 var e = l(u);
9216 for (var t in a) !function(t) {
9217 var n = a[t];
9218 e[t] ? n.className += " active" : "fullscreen" != t && "side-by-side" != t && (n.className = n.className.replace(/\s*active\s*/g, ""));
9219 }(t);
9220 }));
9221 var f = u.getWrapperElement();
9222 return f.parentNode.insertBefore(n, f), n;
9223 }
9224 }, B.prototype.createStatusbar = function(e) {
9225 e = e || this.options.status;
9226 var t = this.options, n = this.codemirror;
9227 if (e && 0 !== e.length) {
9228 var r, i, o, a = [];
9229 for (r = 0; r < e.length; r++) if (i = void 0, o = void 0, "object" == typeof e[r]) a.push({
9230 className: e[r].className,
9231 defaultValue: e[r].defaultValue,
9232 onUpdate: e[r].onUpdate
9233 }); else {
9234 var l = e[r];
9235 "words" === l ? (o = function(e) {
9236 e.innerHTML = W(n.getValue());
9237 }, i = function(e) {
9238 e.innerHTML = W(n.getValue());
9239 }) : "lines" === l ? (o = function(e) {
9240 e.innerHTML = n.lineCount();
9241 }, i = function(e) {
9242 e.innerHTML = n.lineCount();
9243 }) : "cursor" === l ? (o = function(e) {
9244 e.innerHTML = "0:0";
9245 }, i = function(e) {
9246 var t = n.getCursor();
9247 e.innerHTML = t.line + ":" + t.ch;
9248 }) : "autosave" === l && (o = function(e) {
9249 null != t.autosave && !0 === t.autosave.enabled && e.setAttribute("id", "autosaved");
9250 }), a.push({
9251 className: l,
9252 defaultValue: o,
9253 onUpdate: i
9254 });
9255 }
9256 var s = document.createElement("div");
9257 for (s.className = "editor-statusbar", r = 0; r < a.length; r++) {
9258 var c = a[r], u = document.createElement("span");
9259 u.className = c.className, "function" == typeof c.defaultValue && c.defaultValue(u),
9260 "function" == typeof c.onUpdate && this.codemirror.on("update", function(e, t) {
9261 return function() {
9262 t.onUpdate(e);
9263 };
9264 }(u, c)), s.appendChild(u);
9265 }
9266 var f = this.codemirror.getWrapperElement();
9267 return f.parentNode.insertBefore(s, f.nextSibling), s;
9268 }
9269 }, B.prototype.value = function(e) {
9270 return void 0 === e ? this.codemirror.getValue() : (this.codemirror.getDoc().setValue(e),
9271 this);
9272 }, B.toggleBold = c, B.toggleItalic = u, B.toggleStrikethrough = f, B.toggleBlockquote = d,
9273 B.toggleHeadingSmaller = p, B.toggleHeadingBigger = m, B.toggleHeading1 = g, B.toggleHeading2 = v,
9274 B.toggleHeading3 = y, B.toggleCodeBlock = h, B.toggleUnorderedList = x, B.toggleOrderedList = b,
9275 B.cleanBlock = w, B.drawLink = k, B.drawImage = S, B.drawTable = C, B.drawHorizontalRule = L,
9276 B.undo = T, B.redo = M, B.togglePreview = A, B.toggleSideBySide = N, B.toggleFullScreen = s,
9277 B.prototype.toggleBold = function() {
9278 c(this);
9279 }, B.prototype.toggleItalic = function() {
9280 u(this);
9281 }, B.prototype.toggleStrikethrough = function() {
9282 f(this);
9283 }, B.prototype.toggleBlockquote = function() {
9284 d(this);
9285 }, B.prototype.toggleHeadingSmaller = function() {
9286 p(this);
9287 }, B.prototype.toggleHeadingBigger = function() {
9288 m(this);
9289 }, B.prototype.toggleHeading1 = function() {
9290 g(this);
9291 }, B.prototype.toggleHeading2 = function() {
9292 v(this);
9293 }, B.prototype.toggleHeading3 = function() {
9294 y(this);
9295 }, B.prototype.toggleCodeBlock = function() {
9296 h(this);
9297 }, B.prototype.toggleUnorderedList = function() {
9298 x(this);
9299 }, B.prototype.toggleOrderedList = function() {
9300 b(this);
9301 }, B.prototype.cleanBlock = function() {
9302 w(this);
9303 }, B.prototype.drawLink = function() {
9304 k(this);
9305 }, B.prototype.drawImage = function() {
9306 S(this);
9307 }, B.prototype.drawTable = function() {
9308 C(this);
9309 }, B.prototype.drawHorizontalRule = function() {
9310 L(this);
9311 }, B.prototype.undo = function() {
9312 T(this);
9313 }, B.prototype.redo = function() {
9314 M(this);
9315 }, B.prototype.togglePreview = function() {
9316 A(this);
9317 }, B.prototype.toggleSideBySide = function() {
9318 N(this);
9319 }, B.prototype.toggleFullScreen = function() {
9320 s(this);
9321 }, B.prototype.isPreviewActive = function() {
9322 var n = this.codemirror.getWrapperElement().lastChild;
9323 return /editor-preview-active/.test(n.className);
9324 }, B.prototype.isSideBySideActive = function() {
9325 var n = this.codemirror.getWrapperElement().nextSibling;
9326 return /editor-preview-active-side/.test(n.className);
9327 }, B.prototype.isFullscreenActive = function() {
9328 return this.codemirror.getOption("fullScreen");
9329 }, B.prototype.getState = function() {
9330 return l(this.codemirror);
9331 }, B.prototype.toTextArea = function() {
9332 var e = this.codemirror, t = e.getWrapperElement();
9333 t.parentNode && (this.gui.toolbar && t.parentNode.removeChild(this.gui.toolbar),
9334 this.gui.statusbar && t.parentNode.removeChild(this.gui.statusbar), this.gui.sideBySide && t.parentNode.removeChild(this.gui.sideBySide)),
9335 e.toTextArea(), this.autosaveTimeoutId && (clearTimeout(this.autosaveTimeoutId),
9336 this.autosaveTimeoutId = void 0, this.clearAutosavedValue());
9337 }, t.exports = B;
9338 }, {
9339 "./codemirror/tablist": 19,
9340 codemirror: 10,
9341 "codemirror-spell-checker": 4,
9342 "codemirror/addon/display/fullscreen.js": 5,
9343 "codemirror/addon/display/placeholder.js": 6,
9344 "codemirror/addon/edit/continuelist.js": 7,
9345 "codemirror/addon/mode/overlay.js": 8,
9346 "codemirror/addon/selection/mark-selection.js": 9,
9347 "codemirror/mode/gfm/gfm.js": 11,
9348 "codemirror/mode/markdown/markdown.js": 12,
9349 "codemirror/mode/xml/xml.js": 14,
9350 marked: 17
9351 } ]
9352 }, {}, [ 20 ])(20);
9353 },
9354 8416: module => {
9355 function deepFreeze(obj) {
9356 return obj instanceof Map ? obj.clear = obj.delete = obj.set = function() {
9357 throw new Error("map is read-only");
9358 } : obj instanceof Set && (obj.add = obj.clear = obj.delete = function() {
9359 throw new Error("set is read-only");
9360 }), Object.freeze(obj), Object.getOwnPropertyNames(obj).forEach((name => {
9361 const prop = obj[name], type = typeof prop;
9362 "object" !== type && "function" !== type || Object.isFrozen(prop) || deepFreeze(prop);
9363 })), obj;
9364 }
9365 class Response {
9366 constructor(mode) {
9367 void 0 === mode.data && (mode.data = {}), this.data = mode.data, this.isMatchIgnored = !1;
9368 }
9369 ignoreMatch() {
9370 this.isMatchIgnored = !0;
9371 }
9372 }
9373 function escapeHTML(value) {
9374 return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
9375 }
9376 function inherit$1(original, ...objects) {
9377 const result = Object.create(null);
9378 for (const key in original) result[key] = original[key];
9379 return objects.forEach((function(obj) {
9380 for (const key in obj) result[key] = obj[key];
9381 })), result;
9382 }
9383 const emitsWrappingTags = node => !!node.scope;
9384 class HTMLRenderer {
9385 constructor(parseTree, options) {
9386 this.buffer = "", this.classPrefix = options.classPrefix, parseTree.walk(this);
9387 }
9388 addText(text) {
9389 this.buffer += escapeHTML(text);
9390 }
9391 openNode(node) {
9392 if (!emitsWrappingTags(node)) return;
9393 const className = ((name, {prefix}) => {
9394 if (name.startsWith("language:")) return name.replace("language:", "language-");
9395 if (name.includes(".")) {
9396 const pieces = name.split(".");
9397 return [ `${prefix}${pieces.shift()}`, ...pieces.map(((x, i) => `${x}${"_".repeat(i + 1)}`)) ].join(" ");
9398 }
9399 return `${prefix}${name}`;
9400 })(node.scope, {
9401 prefix: this.classPrefix
9402 });
9403 this.span(className);
9404 }
9405 closeNode(node) {
9406 emitsWrappingTags(node) && (this.buffer += "</span>");
9407 }
9408 value() {
9409 return this.buffer;
9410 }
9411 span(className) {
9412 this.buffer += `<span class="${className}">`;
9413 }
9414 }
9415 const newNode = (opts = {}) => {
9416 const result = {
9417 children: []
9418 };
9419 return Object.assign(result, opts), result;
9420 };
9421 class TokenTree {
9422 constructor() {
9423 this.rootNode = newNode(), this.stack = [ this.rootNode ];
9424 }
9425 get top() {
9426 return this.stack[this.stack.length - 1];
9427 }
9428 get root() {
9429 return this.rootNode;
9430 }
9431 add(node) {
9432 this.top.children.push(node);
9433 }
9434 openNode(scope) {
9435 const node = newNode({
9436 scope
9437 });
9438 this.add(node), this.stack.push(node);
9439 }
9440 closeNode() {
9441 if (this.stack.length > 1) return this.stack.pop();
9442 }
9443 closeAllNodes() {
9444 for (;this.closeNode(); ) ;
9445 }
9446 toJSON() {
9447 return JSON.stringify(this.rootNode, null, 4);
9448 }
9449 walk(builder) {
9450 return this.constructor._walk(builder, this.rootNode);
9451 }
9452 static _walk(builder, node) {
9453 return "string" == typeof node ? builder.addText(node) : node.children && (builder.openNode(node),
9454 node.children.forEach((child => this._walk(builder, child))), builder.closeNode(node)),
9455 builder;
9456 }
9457 static _collapse(node) {
9458 "string" != typeof node && node.children && (node.children.every((el => "string" == typeof el)) ? node.children = [ node.children.join("") ] : node.children.forEach((child => {
9459 TokenTree._collapse(child);
9460 })));
9461 }
9462 }
9463 class TokenTreeEmitter extends TokenTree {
9464 constructor(options) {
9465 super(), this.options = options;
9466 }
9467 addText(text) {
9468 "" !== text && this.add(text);
9469 }
9470 startScope(scope) {
9471 this.openNode(scope);
9472 }
9473 endScope() {
9474 this.closeNode();
9475 }
9476 __addSublanguage(emitter, name) {
9477 const node = emitter.root;
9478 name && (node.scope = `language:${name}`), this.add(node);
9479 }
9480 toHTML() {
9481 return new HTMLRenderer(this, this.options).value();
9482 }
9483 finalize() {
9484 return this.closeAllNodes(), !0;
9485 }
9486 }
9487 function source(re) {
9488 return re ? "string" == typeof re ? re : re.source : null;
9489 }
9490 function lookahead(re) {
9491 return concat("(?=", re, ")");
9492 }
9493 function anyNumberOfTimes(re) {
9494 return concat("(?:", re, ")*");
9495 }
9496 function optional(re) {
9497 return concat("(?:", re, ")?");
9498 }
9499 function concat(...args) {
9500 return args.map((x => source(x))).join("");
9501 }
9502 function either(...args) {
9503 const opts = function(args) {
9504 const opts = args[args.length - 1];
9505 return "object" == typeof opts && opts.constructor === Object ? (args.splice(args.length - 1, 1),
9506 opts) : {};
9507 }(args);
9508 return "(" + (opts.capture ? "" : "?:") + args.map((x => source(x))).join("|") + ")";
9509 }
9510 function countMatchGroups(re) {
9511 return new RegExp(re.toString() + "|").exec("").length - 1;
9512 }
9513 const BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
9514 function _rewriteBackreferences(regexps, {joinWith}) {
9515 let numCaptures = 0;
9516 return regexps.map((regex => {
9517 numCaptures += 1;
9518 const offset = numCaptures;
9519 let re = source(regex), out = "";
9520 for (;re.length > 0; ) {
9521 const match = BACKREF_RE.exec(re);
9522 if (!match) {
9523 out += re;
9524 break;
9525 }
9526 out += re.substring(0, match.index), re = re.substring(match.index + match[0].length),
9527 "\\" === match[0][0] && match[1] ? out += "\\" + String(Number(match[1]) + offset) : (out += match[0],
9528 "(" === match[0] && numCaptures++);
9529 }
9530 return out;
9531 })).map((re => `(${re})`)).join(joinWith);
9532 }
9533 const C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", BACKSLASH_ESCAPE = {
9534 begin: "\\\\[\\s\\S]",
9535 relevance: 0
9536 }, APOS_STRING_MODE = {
9537 scope: "string",
9538 begin: "'",
9539 end: "'",
9540 illegal: "\\n",
9541 contains: [ BACKSLASH_ESCAPE ]
9542 }, QUOTE_STRING_MODE = {
9543 scope: "string",
9544 begin: '"',
9545 end: '"',
9546 illegal: "\\n",
9547 contains: [ BACKSLASH_ESCAPE ]
9548 }, COMMENT = function(begin, end, modeOptions = {}) {
9549 const mode = inherit$1({
9550 scope: "comment",
9551 begin,
9552 end,
9553 contains: []
9554 }, modeOptions);
9555 mode.contains.push({
9556 scope: "doctag",
9557 begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
9558 end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
9559 excludeBegin: !0,
9560 relevance: 0
9561 });
9562 const ENGLISH_WORD = either("I", "a", "is", "so", "us", "to", "at", "if", "in", "it", "on", /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, /[A-Za-z]+[-][a-z]+/, /[A-Za-z][a-z]{2,}/);
9563 return mode.contains.push({
9564 begin: concat(/[ ]+/, "(", ENGLISH_WORD, /[.]?[:]?([.][ ]|[ ])/, "){3}")
9565 }), mode;
9566 }, C_LINE_COMMENT_MODE = COMMENT("//", "$"), C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/"), HASH_COMMENT_MODE = COMMENT("#", "$"), NUMBER_MODE = {
9567 scope: "number",
9568 begin: "\\b\\d+(\\.\\d+)?",
9569 relevance: 0
9570 }, C_NUMBER_MODE = {
9571 scope: "number",
9572 begin: C_NUMBER_RE,
9573 relevance: 0
9574 }, BINARY_NUMBER_MODE = {
9575 scope: "number",
9576 begin: "\\b(0b[01]+)",
9577 relevance: 0
9578 }, REGEXP_MODE = {
9579 scope: "regexp",
9580 begin: /\/(?=[^/\n]*\/)/,
9581 end: /\/[gimuy]*/,
9582 contains: [ BACKSLASH_ESCAPE, {
9583 begin: /\[/,
9584 end: /\]/,
9585 relevance: 0,
9586 contains: [ BACKSLASH_ESCAPE ]
9587 } ]
9588 }, TITLE_MODE = {
9589 scope: "title",
9590 begin: "[a-zA-Z]\\w*",
9591 relevance: 0
9592 }, UNDERSCORE_TITLE_MODE = {
9593 scope: "title",
9594 begin: "[a-zA-Z_]\\w*",
9595 relevance: 0
9596 }, METHOD_GUARD = {
9597 begin: "\\.\\s*[a-zA-Z_]\\w*",
9598 relevance: 0
9599 };
9600 var MODES = Object.freeze({
9601 __proto__: null,
9602 APOS_STRING_MODE,
9603 BACKSLASH_ESCAPE,
9604 BINARY_NUMBER_MODE,
9605 BINARY_NUMBER_RE: "\\b(0b[01]+)",
9606 COMMENT,
9607 C_BLOCK_COMMENT_MODE,
9608 C_LINE_COMMENT_MODE,
9609 C_NUMBER_MODE,
9610 C_NUMBER_RE,
9611 END_SAME_AS_BEGIN: function(mode) {
9612 return Object.assign(mode, {
9613 "on:begin": (m, resp) => {
9614 resp.data._beginMatch = m[1];
9615 },
9616 "on:end": (m, resp) => {
9617 resp.data._beginMatch !== m[1] && resp.ignoreMatch();
9618 }
9619 });
9620 },
9621 HASH_COMMENT_MODE,
9622 IDENT_RE: "[a-zA-Z]\\w*",
9623 MATCH_NOTHING_RE: /\b\B/,
9624 METHOD_GUARD,
9625 NUMBER_MODE,
9626 NUMBER_RE: "\\b\\d+(\\.\\d+)?",
9627 PHRASAL_WORDS_MODE: {
9628 begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
9629 },
9630 QUOTE_STRING_MODE,
9631 REGEXP_MODE,
9632 RE_STARTERS_RE: "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",
9633 SHEBANG: (opts = {}) => {
9634 const beginShebang = /^#![ ]*\//;
9635 return opts.binary && (opts.begin = concat(beginShebang, /.*\b/, opts.binary, /\b.*/)),
9636 inherit$1({
9637 scope: "meta",
9638 begin: beginShebang,
9639 end: /$/,
9640 relevance: 0,
9641 "on:begin": (m, resp) => {
9642 0 !== m.index && resp.ignoreMatch();
9643 }
9644 }, opts);
9645 },
9646 TITLE_MODE,
9647 UNDERSCORE_IDENT_RE: "[a-zA-Z_]\\w*",
9648 UNDERSCORE_TITLE_MODE
9649 });
9650 function skipIfHasPrecedingDot(match, response) {
9651 "." === match.input[match.index - 1] && response.ignoreMatch();
9652 }
9653 function scopeClassName(mode, _parent) {
9654 void 0 !== mode.className && (mode.scope = mode.className, delete mode.className);
9655 }
9656 function beginKeywords(mode, parent) {
9657 parent && mode.beginKeywords && (mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)",
9658 mode.__beforeBegin = skipIfHasPrecedingDot, mode.keywords = mode.keywords || mode.beginKeywords,
9659 delete mode.beginKeywords, void 0 === mode.relevance && (mode.relevance = 0));
9660 }
9661 function compileIllegal(mode, _parent) {
9662 Array.isArray(mode.illegal) && (mode.illegal = either(...mode.illegal));
9663 }
9664 function compileMatch(mode, _parent) {
9665 if (mode.match) {
9666 if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
9667 mode.begin = mode.match, delete mode.match;
9668 }
9669 }
9670 function compileRelevance(mode, _parent) {
9671 void 0 === mode.relevance && (mode.relevance = 1);
9672 }
9673 const beforeMatchExt = (mode, parent) => {
9674 if (!mode.beforeMatch) return;
9675 if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
9676 const originalMode = Object.assign({}, mode);
9677 Object.keys(mode).forEach((key => {
9678 delete mode[key];
9679 })), mode.keywords = originalMode.keywords, mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin)),
9680 mode.starts = {
9681 relevance: 0,
9682 contains: [ Object.assign(originalMode, {
9683 endsParent: !0
9684 }) ]
9685 }, mode.relevance = 0, delete originalMode.beforeMatch;
9686 }, COMMON_KEYWORDS = [ "of", "and", "for", "in", "not", "or", "if", "then", "parent", "list", "value" ], DEFAULT_KEYWORD_SCOPE = "keyword";
9687 function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
9688 const compiledKeywords = Object.create(null);
9689 return "string" == typeof rawKeywords ? compileList(scopeName, rawKeywords.split(" ")) : Array.isArray(rawKeywords) ? compileList(scopeName, rawKeywords) : Object.keys(rawKeywords).forEach((function(scopeName) {
9690 Object.assign(compiledKeywords, compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName));
9691 })), compiledKeywords;
9692 function compileList(scopeName, keywordList) {
9693 caseInsensitive && (keywordList = keywordList.map((x => x.toLowerCase()))), keywordList.forEach((function(keyword) {
9694 const pair = keyword.split("|");
9695 compiledKeywords[pair[0]] = [ scopeName, scoreForKeyword(pair[0], pair[1]) ];
9696 }));
9697 }
9698 }
9699 function scoreForKeyword(keyword, providedScore) {
9700 return providedScore ? Number(providedScore) : function(keyword) {
9701 return COMMON_KEYWORDS.includes(keyword.toLowerCase());
9702 }(keyword) ? 0 : 1;
9703 }
9704 const seenDeprecations = {}, error = message => {}, deprecated = (version, message) => {
9705 seenDeprecations[`${version}/${message}`] || (seenDeprecations[`${version}/${message}`] = !0);
9706 }, MultiClassError = new Error;
9707 function remapScopeNames(mode, regexes, {key}) {
9708 let offset = 0;
9709 const scopeNames = mode[key], emit = {}, positions = {};
9710 for (let i = 1; i <= regexes.length; i++) positions[i + offset] = scopeNames[i],
9711 emit[i + offset] = !0, offset += countMatchGroups(regexes[i - 1]);
9712 mode[key] = positions, mode[key]._emit = emit, mode[key]._multi = !0;
9713 }
9714 function MultiClass(mode) {
9715 !function(mode) {
9716 mode.scope && "object" == typeof mode.scope && null !== mode.scope && (mode.beginScope = mode.scope,
9717 delete mode.scope);
9718 }(mode), "string" == typeof mode.beginScope && (mode.beginScope = {
9719 _wrap: mode.beginScope
9720 }), "string" == typeof mode.endScope && (mode.endScope = {
9721 _wrap: mode.endScope
9722 }), function(mode) {
9723 if (Array.isArray(mode.begin)) {
9724 if (mode.skip || mode.excludeBegin || mode.returnBegin) throw error("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),
9725 MultiClassError;
9726 if ("object" != typeof mode.beginScope || null === mode.beginScope) throw error("beginScope must be object"),
9727 MultiClassError;
9728 remapScopeNames(mode, mode.begin, {
9729 key: "beginScope"
9730 }), mode.begin = _rewriteBackreferences(mode.begin, {
9731 joinWith: ""
9732 });
9733 }
9734 }(mode), function(mode) {
9735 if (Array.isArray(mode.end)) {
9736 if (mode.skip || mode.excludeEnd || mode.returnEnd) throw error("skip, excludeEnd, returnEnd not compatible with endScope: {}"),
9737 MultiClassError;
9738 if ("object" != typeof mode.endScope || null === mode.endScope) throw error("endScope must be object"),
9739 MultiClassError;
9740 remapScopeNames(mode, mode.end, {
9741 key: "endScope"
9742 }), mode.end = _rewriteBackreferences(mode.end, {
9743 joinWith: ""
9744 });
9745 }
9746 }(mode);
9747 }
9748 function compileLanguage(language) {
9749 function langRe(value, global) {
9750 return new RegExp(source(value), "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : ""));
9751 }
9752 class MultiRegex {
9753 constructor() {
9754 this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
9755 }
9756 addRule(re, opts) {
9757 opts.position = this.position++, this.matchIndexes[this.matchAt] = opts, this.regexes.push([ opts, re ]),
9758 this.matchAt += countMatchGroups(re) + 1;
9759 }
9760 compile() {
9761 0 === this.regexes.length && (this.exec = () => null);
9762 const terminators = this.regexes.map((el => el[1]));
9763 this.matcherRe = langRe(_rewriteBackreferences(terminators, {
9764 joinWith: "|"
9765 }), !0), this.lastIndex = 0;
9766 }
9767 exec(s) {
9768 this.matcherRe.lastIndex = this.lastIndex;
9769 const match = this.matcherRe.exec(s);
9770 if (!match) return null;
9771 const i = match.findIndex(((el, i) => i > 0 && void 0 !== el)), matchData = this.matchIndexes[i];
9772 return match.splice(0, i), Object.assign(match, matchData);
9773 }
9774 }
9775 class ResumableMultiRegex {
9776 constructor() {
9777 this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
9778 }
9779 getMatcher(index) {
9780 if (this.multiRegexes[index]) return this.multiRegexes[index];
9781 const matcher = new MultiRegex;
9782 return this.rules.slice(index).forEach((([re, opts]) => matcher.addRule(re, opts))),
9783 matcher.compile(), this.multiRegexes[index] = matcher, matcher;
9784 }
9785 resumingScanAtSamePosition() {
9786 return 0 !== this.regexIndex;
9787 }
9788 considerAll() {
9789 this.regexIndex = 0;
9790 }
9791 addRule(re, opts) {
9792 this.rules.push([ re, opts ]), "begin" === opts.type && this.count++;
9793 }
9794 exec(s) {
9795 const m = this.getMatcher(this.regexIndex);
9796 m.lastIndex = this.lastIndex;
9797 let result = m.exec(s);
9798 if (this.resumingScanAtSamePosition()) if (result && result.index === this.lastIndex) ; else {
9799 const m2 = this.getMatcher(0);
9800 m2.lastIndex = this.lastIndex + 1, result = m2.exec(s);
9801 }
9802 return result && (this.regexIndex += result.position + 1, this.regexIndex === this.count && this.considerAll()),
9803 result;
9804 }
9805 }
9806 if (language.compilerExtensions || (language.compilerExtensions = []), language.contains && language.contains.includes("self")) throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
9807 return language.classNameAliases = inherit$1(language.classNameAliases || {}), function compileMode(mode, parent) {
9808 const cmode = mode;
9809 if (mode.isCompiled) return cmode;
9810 [ scopeClassName, compileMatch, MultiClass, beforeMatchExt ].forEach((ext => ext(mode, parent))),
9811 language.compilerExtensions.forEach((ext => ext(mode, parent))), mode.__beforeBegin = null,
9812 [ beginKeywords, compileIllegal, compileRelevance ].forEach((ext => ext(mode, parent))),
9813 mode.isCompiled = !0;
9814 let keywordPattern = null;
9815 return "object" == typeof mode.keywords && mode.keywords.$pattern && (mode.keywords = Object.assign({}, mode.keywords),
9816 keywordPattern = mode.keywords.$pattern, delete mode.keywords.$pattern), keywordPattern = keywordPattern || /\w+/,
9817 mode.keywords && (mode.keywords = compileKeywords(mode.keywords, language.case_insensitive)),
9818 cmode.keywordPatternRe = langRe(keywordPattern, !0), parent && (mode.begin || (mode.begin = /\B|\b/),
9819 cmode.beginRe = langRe(cmode.begin), mode.end || mode.endsWithParent || (mode.end = /\B|\b/),
9820 mode.end && (cmode.endRe = langRe(cmode.end)), cmode.terminatorEnd = source(cmode.end) || "",
9821 mode.endsWithParent && parent.terminatorEnd && (cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd)),
9822 mode.illegal && (cmode.illegalRe = langRe(mode.illegal)), mode.contains || (mode.contains = []),
9823 mode.contains = [].concat(...mode.contains.map((function(c) {
9824 return function(mode) {
9825 mode.variants && !mode.cachedVariants && (mode.cachedVariants = mode.variants.map((function(variant) {
9826 return inherit$1(mode, {
9827 variants: null
9828 }, variant);
9829 })));
9830 if (mode.cachedVariants) return mode.cachedVariants;
9831 if (dependencyOnParent(mode)) return inherit$1(mode, {
9832 starts: mode.starts ? inherit$1(mode.starts) : null
9833 });
9834 if (Object.isFrozen(mode)) return inherit$1(mode);
9835 return mode;
9836 }("self" === c ? mode : c);
9837 }))), mode.contains.forEach((function(c) {
9838 compileMode(c, cmode);
9839 })), mode.starts && compileMode(mode.starts, parent), cmode.matcher = function(mode) {
9840 const mm = new ResumableMultiRegex;
9841 return mode.contains.forEach((term => mm.addRule(term.begin, {
9842 rule: term,
9843 type: "begin"
9844 }))), mode.terminatorEnd && mm.addRule(mode.terminatorEnd, {
9845 type: "end"
9846 }), mode.illegal && mm.addRule(mode.illegal, {
9847 type: "illegal"
9848 }), mm;
9849 }(cmode), cmode;
9850 }(language);
9851 }
9852 function dependencyOnParent(mode) {
9853 return !!mode && (mode.endsWithParent || dependencyOnParent(mode.starts));
9854 }
9855 class HTMLInjectionError extends Error {
9856 constructor(reason, html) {
9857 super(reason), this.name = "HTMLInjectionError", this.html = html;
9858 }
9859 }
9860 const escape = escapeHTML, inherit = inherit$1, NO_MATCH = Symbol("nomatch"), HLJS = function(hljs) {
9861 const languages = Object.create(null), aliases = Object.create(null), plugins = [];
9862 let SAFE_MODE = !0;
9863 const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?", PLAINTEXT_LANGUAGE = {
9864 disableAutodetect: !0,
9865 name: "Plain text",
9866 contains: []
9867 };
9868 let options = {
9869 ignoreUnescapedHTML: !1,
9870 throwUnescapedHTML: !1,
9871 noHighlightRe: /^(no-?highlight)$/i,
9872 languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
9873 classPrefix: "hljs-",
9874 cssSelector: "pre code",
9875 languages: null,
9876 __emitter: TokenTreeEmitter
9877 };
9878 function shouldNotHighlight(languageName) {
9879 return options.noHighlightRe.test(languageName);
9880 }
9881 function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
9882 let code = "", languageName = "";
9883 "object" == typeof optionsOrCode ? (code = codeOrLanguageName, ignoreIllegals = optionsOrCode.ignoreIllegals,
9884 languageName = optionsOrCode.language) : (deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated."),
9885 deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),
9886 languageName = codeOrLanguageName, code = optionsOrCode), void 0 === ignoreIllegals && (ignoreIllegals = !0);
9887 const context = {
9888 code,
9889 language: languageName
9890 };
9891 fire("before:highlight", context);
9892 const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);
9893 return result.code = context.code, fire("after:highlight", result), result;
9894 }
9895 function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
9896 const keywordHits = Object.create(null);
9897 function processKeywords() {
9898 if (!top.keywords) return void emitter.addText(modeBuffer);
9899 let lastIndex = 0;
9900 top.keywordPatternRe.lastIndex = 0;
9901 let match = top.keywordPatternRe.exec(modeBuffer), buf = "";
9902 for (;match; ) {
9903 buf += modeBuffer.substring(lastIndex, match.index);
9904 const word = language.case_insensitive ? match[0].toLowerCase() : match[0], data = (matchText = word,
9905 top.keywords[matchText]);
9906 if (data) {
9907 const [kind, keywordRelevance] = data;
9908 if (emitter.addText(buf), buf = "", keywordHits[word] = (keywordHits[word] || 0) + 1,
9909 keywordHits[word] <= 7 && (relevance += keywordRelevance), kind.startsWith("_")) buf += match[0]; else {
9910 const cssClass = language.classNameAliases[kind] || kind;
9911 emitKeyword(match[0], cssClass);
9912 }
9913 } else buf += match[0];
9914 lastIndex = top.keywordPatternRe.lastIndex, match = top.keywordPatternRe.exec(modeBuffer);
9915 }
9916 var matchText;
9917 buf += modeBuffer.substring(lastIndex), emitter.addText(buf);
9918 }
9919 function processBuffer() {
9920 null != top.subLanguage ? function() {
9921 if ("" === modeBuffer) return;
9922 let result = null;
9923 if ("string" == typeof top.subLanguage) {
9924 if (!languages[top.subLanguage]) return void emitter.addText(modeBuffer);
9925 result = _highlight(top.subLanguage, modeBuffer, !0, continuations[top.subLanguage]),
9926 continuations[top.subLanguage] = result._top;
9927 } else result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
9928 top.relevance > 0 && (relevance += result.relevance), emitter.__addSublanguage(result._emitter, result.language);
9929 }() : processKeywords(), modeBuffer = "";
9930 }
9931 function emitKeyword(keyword, scope) {
9932 "" !== keyword && (emitter.startScope(scope), emitter.addText(keyword), emitter.endScope());
9933 }
9934 function emitMultiClass(scope, match) {
9935 let i = 1;
9936 const max = match.length - 1;
9937 for (;i <= max; ) {
9938 if (!scope._emit[i]) {
9939 i++;
9940 continue;
9941 }
9942 const klass = language.classNameAliases[scope[i]] || scope[i], text = match[i];
9943 klass ? emitKeyword(text, klass) : (modeBuffer = text, processKeywords(), modeBuffer = ""),
9944 i++;
9945 }
9946 }
9947 function startNewMode(mode, match) {
9948 return mode.scope && "string" == typeof mode.scope && emitter.openNode(language.classNameAliases[mode.scope] || mode.scope),
9949 mode.beginScope && (mode.beginScope._wrap ? (emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap),
9950 modeBuffer = "") : mode.beginScope._multi && (emitMultiClass(mode.beginScope, match),
9951 modeBuffer = "")), top = Object.create(mode, {
9952 parent: {
9953 value: top
9954 }
9955 }), top;
9956 }
9957 function endOfMode(mode, match, matchPlusRemainder) {
9958 let matched = function(re, lexeme) {
9959 const match = re && re.exec(lexeme);
9960 return match && 0 === match.index;
9961 }(mode.endRe, matchPlusRemainder);
9962 if (matched) {
9963 if (mode["on:end"]) {
9964 const resp = new Response(mode);
9965 mode["on:end"](match, resp), resp.isMatchIgnored && (matched = !1);
9966 }
9967 if (matched) {
9968 for (;mode.endsParent && mode.parent; ) mode = mode.parent;
9969 return mode;
9970 }
9971 }
9972 if (mode.endsWithParent) return endOfMode(mode.parent, match, matchPlusRemainder);
9973 }
9974 function doIgnore(lexeme) {
9975 return 0 === top.matcher.regexIndex ? (modeBuffer += lexeme[0], 1) : (resumeScanAtSamePosition = !0,
9976 0);
9977 }
9978 function doEndMatch(match) {
9979 const lexeme = match[0], matchPlusRemainder = codeToHighlight.substring(match.index), endMode = endOfMode(top, match, matchPlusRemainder);
9980 if (!endMode) return NO_MATCH;
9981 const origin = top;
9982 top.endScope && top.endScope._wrap ? (processBuffer(), emitKeyword(lexeme, top.endScope._wrap)) : top.endScope && top.endScope._multi ? (processBuffer(),
9983 emitMultiClass(top.endScope, match)) : origin.skip ? modeBuffer += lexeme : (origin.returnEnd || origin.excludeEnd || (modeBuffer += lexeme),
9984 processBuffer(), origin.excludeEnd && (modeBuffer = lexeme));
9985 do {
9986 top.scope && emitter.closeNode(), top.skip || top.subLanguage || (relevance += top.relevance),
9987 top = top.parent;
9988 } while (top !== endMode.parent);
9989 return endMode.starts && startNewMode(endMode.starts, match), origin.returnEnd ? 0 : lexeme.length;
9990 }
9991 let lastMatch = {};
9992 function processLexeme(textBeforeMatch, match) {
9993 const lexeme = match && match[0];
9994 if (modeBuffer += textBeforeMatch, null == lexeme) return processBuffer(), 0;
9995 if ("begin" === lastMatch.type && "end" === match.type && lastMatch.index === match.index && "" === lexeme) {
9996 if (modeBuffer += codeToHighlight.slice(match.index, match.index + 1), !SAFE_MODE) {
9997 const err = new Error(`0 width match regex (${languageName})`);
9998 throw err.languageName = languageName, err.badRule = lastMatch.rule, err;
9999 }
10000 return 1;
10001 }
10002 if (lastMatch = match, "begin" === match.type) return function(match) {
10003 const lexeme = match[0], newMode = match.rule, resp = new Response(newMode), beforeCallbacks = [ newMode.__beforeBegin, newMode["on:begin"] ];
10004 for (const cb of beforeCallbacks) if (cb && (cb(match, resp), resp.isMatchIgnored)) return doIgnore(lexeme);
10005 return newMode.skip ? modeBuffer += lexeme : (newMode.excludeBegin && (modeBuffer += lexeme),
10006 processBuffer(), newMode.returnBegin || newMode.excludeBegin || (modeBuffer = lexeme)),
10007 startNewMode(newMode, match), newMode.returnBegin ? 0 : lexeme.length;
10008 }(match);
10009 if ("illegal" === match.type && !ignoreIllegals) {
10010 const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || "<unnamed>") + '"');
10011 throw err.mode = top, err;
10012 }
10013 if ("end" === match.type) {
10014 const processed = doEndMatch(match);
10015 if (processed !== NO_MATCH) return processed;
10016 }
10017 if ("illegal" === match.type && "" === lexeme) return 1;
10018 if (iterations > 1e5 && iterations > 3 * match.index) {
10019 throw new Error("potential infinite loop, way more iterations than matches");
10020 }
10021 return modeBuffer += lexeme, lexeme.length;
10022 }
10023 const language = getLanguage(languageName);
10024 if (!language) throw error(LANGUAGE_NOT_FOUND.replace("{}", languageName)), new Error('Unknown language: "' + languageName + '"');
10025 const md = compileLanguage(language);
10026 let result = "", top = continuation || md;
10027 const continuations = {}, emitter = new options.__emitter(options);
10028 !function() {
10029 const list = [];
10030 for (let current = top; current !== language; current = current.parent) current.scope && list.unshift(current.scope);
10031 list.forEach((item => emitter.openNode(item)));
10032 }();
10033 let modeBuffer = "", relevance = 0, index = 0, iterations = 0, resumeScanAtSamePosition = !1;
10034 try {
10035 if (language.__emitTokens) language.__emitTokens(codeToHighlight, emitter); else {
10036 for (top.matcher.considerAll(); ;) {
10037 iterations++, resumeScanAtSamePosition ? resumeScanAtSamePosition = !1 : top.matcher.considerAll(),
10038 top.matcher.lastIndex = index;
10039 const match = top.matcher.exec(codeToHighlight);
10040 if (!match) break;
10041 const processedCount = processLexeme(codeToHighlight.substring(index, match.index), match);
10042 index = match.index + processedCount;
10043 }
10044 processLexeme(codeToHighlight.substring(index));
10045 }
10046 return emitter.finalize(), result = emitter.toHTML(), {
10047 language: languageName,
10048 value: result,
10049 relevance,
10050 illegal: !1,
10051 _emitter: emitter,
10052 _top: top
10053 };
10054 } catch (err) {
10055 if (err.message && err.message.includes("Illegal")) return {
10056 language: languageName,
10057 value: escape(codeToHighlight),
10058 illegal: !0,
10059 relevance: 0,
10060 _illegalBy: {
10061 message: err.message,
10062 index,
10063 context: codeToHighlight.slice(index - 100, index + 100),
10064 mode: err.mode,
10065 resultSoFar: result
10066 },
10067 _emitter: emitter
10068 };
10069 if (SAFE_MODE) return {
10070 language: languageName,
10071 value: escape(codeToHighlight),
10072 illegal: !1,
10073 relevance: 0,
10074 errorRaised: err,
10075 _emitter: emitter,
10076 _top: top
10077 };
10078 throw err;
10079 }
10080 }
10081 function highlightAuto(code, languageSubset) {
10082 languageSubset = languageSubset || options.languages || Object.keys(languages);
10083 const plaintext = function(code) {
10084 const result = {
10085 value: escape(code),
10086 illegal: !1,
10087 relevance: 0,
10088 _top: PLAINTEXT_LANGUAGE,
10089 _emitter: new options.__emitter(options)
10090 };
10091 return result._emitter.addText(code), result;
10092 }(code), results = languageSubset.filter(getLanguage).filter(autoDetection).map((name => _highlight(name, code, !1)));
10093 results.unshift(plaintext);
10094 const sorted = results.sort(((a, b) => {
10095 if (a.relevance !== b.relevance) return b.relevance - a.relevance;
10096 if (a.language && b.language) {
10097 if (getLanguage(a.language).supersetOf === b.language) return 1;
10098 if (getLanguage(b.language).supersetOf === a.language) return -1;
10099 }
10100 return 0;
10101 })), [best, secondBest] = sorted, result = best;
10102 return result.secondBest = secondBest, result;
10103 }
10104 function highlightElement(element) {
10105 let node = null;
10106 const language = function(block) {
10107 let classes = block.className + " ";
10108 classes += block.parentNode ? block.parentNode.className : "";
10109 const match = options.languageDetectRe.exec(classes);
10110 if (match) {
10111 const language = getLanguage(match[1]);
10112 return language || LANGUAGE_NOT_FOUND.replace("{}", match[1]), language ? match[1] : "no-highlight";
10113 }
10114 return classes.split(/\s+/).find((_class => shouldNotHighlight(_class) || getLanguage(_class)));
10115 }(element);
10116 if (shouldNotHighlight(language)) return;
10117 if (fire("before:highlightElement", {
10118 el: element,
10119 language
10120 }), element.dataset.highlighted) return;
10121 if (element.children.length > 0 && (options.ignoreUnescapedHTML, options.throwUnescapedHTML)) {
10122 throw new HTMLInjectionError("One of your code blocks includes unescaped HTML.", element.innerHTML);
10123 }
10124 node = element;
10125 const text = node.textContent, result = language ? highlight(text, {
10126 language,
10127 ignoreIllegals: !0
10128 }) : highlightAuto(text);
10129 element.innerHTML = result.value, element.dataset.highlighted = "yes", function(element, currentLang, resultLang) {
10130 const language = currentLang && aliases[currentLang] || resultLang;
10131 element.classList.add("hljs"), element.classList.add(`language-${language}`);
10132 }(element, language, result.language), element.result = {
10133 language: result.language,
10134 re: result.relevance,
10135 relevance: result.relevance
10136 }, result.secondBest && (element.secondBest = {
10137 language: result.secondBest.language,
10138 relevance: result.secondBest.relevance
10139 }), fire("after:highlightElement", {
10140 el: element,
10141 result,
10142 text
10143 });
10144 }
10145 let wantsHighlight = !1;
10146 function highlightAll() {
10147 if ("loading" === document.readyState) return void (wantsHighlight = !0);
10148 document.querySelectorAll(options.cssSelector).forEach(highlightElement);
10149 }
10150 function getLanguage(name) {
10151 return name = (name || "").toLowerCase(), languages[name] || languages[aliases[name]];
10152 }
10153 function registerAliases(aliasList, {languageName}) {
10154 "string" == typeof aliasList && (aliasList = [ aliasList ]), aliasList.forEach((alias => {
10155 aliases[alias.toLowerCase()] = languageName;
10156 }));
10157 }
10158 function autoDetection(name) {
10159 const lang = getLanguage(name);
10160 return lang && !lang.disableAutodetect;
10161 }
10162 function fire(event, args) {
10163 const cb = event;
10164 plugins.forEach((function(plugin) {
10165 plugin[cb] && plugin[cb](args);
10166 }));
10167 }
10168 "undefined" != typeof window && window.addEventListener && window.addEventListener("DOMContentLoaded", (function() {
10169 wantsHighlight && highlightAll();
10170 }), !1), Object.assign(hljs, {
10171 highlight,
10172 highlightAuto,
10173 highlightAll,
10174 highlightElement,
10175 highlightBlock: function(el) {
10176 return deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0"),
10177 deprecated("10.7.0", "Please use highlightElement now."), highlightElement(el);
10178 },
10179 configure: function(userOptions) {
10180 options = inherit(options, userOptions);
10181 },
10182 initHighlighting: () => {
10183 highlightAll(), deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
10184 },
10185 initHighlightingOnLoad: function() {
10186 highlightAll(), deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
10187 },
10188 registerLanguage: function(languageName, languageDefinition) {
10189 let lang = null;
10190 try {
10191 lang = languageDefinition(hljs);
10192 } catch (error$1) {
10193 if (error("Language definition for '{}' could not be registered.".replace("{}", languageName)),
10194 !SAFE_MODE) throw error$1;
10195 error(error$1), lang = PLAINTEXT_LANGUAGE;
10196 }
10197 lang.name || (lang.name = languageName), languages[languageName] = lang, lang.rawDefinition = languageDefinition.bind(null, hljs),
10198 lang.aliases && registerAliases(lang.aliases, {
10199 languageName
10200 });
10201 },
10202 unregisterLanguage: function(languageName) {
10203 delete languages[languageName];
10204 for (const alias of Object.keys(aliases)) aliases[alias] === languageName && delete aliases[alias];
10205 },
10206 listLanguages: function() {
10207 return Object.keys(languages);
10208 },
10209 getLanguage,
10210 registerAliases,
10211 autoDetection,
10212 inherit,
10213 addPlugin: function(plugin) {
10214 !function(plugin) {
10215 plugin["before:highlightBlock"] && !plugin["before:highlightElement"] && (plugin["before:highlightElement"] = data => {
10216 plugin["before:highlightBlock"](Object.assign({
10217 block: data.el
10218 }, data));
10219 }), plugin["after:highlightBlock"] && !plugin["after:highlightElement"] && (plugin["after:highlightElement"] = data => {
10220 plugin["after:highlightBlock"](Object.assign({
10221 block: data.el
10222 }, data));
10223 });
10224 }(plugin), plugins.push(plugin);
10225 },
10226 removePlugin: function(plugin) {
10227 const index = plugins.indexOf(plugin);
10228 -1 !== index && plugins.splice(index, 1);
10229 }
10230 }), hljs.debugMode = function() {
10231 SAFE_MODE = !1;
10232 }, hljs.safeMode = function() {
10233 SAFE_MODE = !0;
10234 }, hljs.versionString = "11.10.0", hljs.regex = {
10235 concat,
10236 lookahead,
10237 either,
10238 optional,
10239 anyNumberOfTimes
10240 };
10241 for (const key in MODES) "object" == typeof MODES[key] && deepFreeze(MODES[key]);
10242 return Object.assign(hljs, MODES), hljs;
10243 }, highlight = HLJS({});
10244 highlight.newInstance = () => HLJS({}), module.exports = highlight, highlight.HighlightJS = highlight,
10245 highlight.default = highlight;
10246 }
10247 }, __webpack_module_cache__ = {};
10248 function __webpack_require__(moduleId) {
10249 var cachedModule = __webpack_module_cache__[moduleId];
10250 if (void 0 !== cachedModule) return cachedModule.exports;
10251 var module = __webpack_module_cache__[moduleId] = {
10252 exports: {}
10253 };
10254 return __webpack_modules__[moduleId](module, module.exports, __webpack_require__),
10255 module.exports;
10256 }
10257 __webpack_require__.n = module => {
10258 var getter = module && module.__esModule ? () => module.default : () => module;
10259 return __webpack_require__.d(getter, {
10260 a: getter
10261 }), getter;
10262 }, __webpack_require__.d = (exports, definition) => {
10263 for (var key in definition) __webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
10264 enumerable: !0,
10265 get: definition[key]
10266 });
10267 }, __webpack_require__.g = function() {
10268 if ("object" == typeof globalThis) return globalThis;
10269 try {
10270 return this || new Function("return this")();
10271 } catch (e) {
10272 if ("object" == typeof window) return window;
10273 }
10274 }(), __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop),
10275 (() => {
10276 "use strict";
10277 function _typeof(o) {
10278 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
10279 return typeof o;
10280 } : function(o) {
10281 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10282 }, _typeof(o);
10283 }
10284 function _defineProperties(e, r) {
10285 for (var t = 0; t < r.length; t++) {
10286 var o = r[t];
10287 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
10288 Object.defineProperty(e, _toPropertyKey(o.key), o);
10289 }
10290 }
10291 function _createClass(e, r, t) {
10292 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
10293 writable: !1
10294 }), e;
10295 }
10296 function _defineProperty(e, r, t) {
10297 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
10298 value: t,
10299 enumerable: !0,
10300 configurable: !0,
10301 writable: !0
10302 }) : e[r] = t, e;
10303 }
10304 function _toPropertyKey(t) {
10305 var i = function(t, r) {
10306 if ("object" != _typeof(t) || !t) return t;
10307 var e = t[Symbol.toPrimitive];
10308 if (void 0 !== e) {
10309 var i = e.call(t, r || "default");
10310 if ("object" != _typeof(i)) return i;
10311 throw new TypeError("@@toPrimitive must return a primitive value.");
10312 }
10313 return ("string" === r ? String : Number)(t);
10314 }(t, "string");
10315 return "symbol" == _typeof(i) ? i : i + "";
10316 }
10317 const wp_picker = _createClass((function Modal() {
10318 var _this = this;
10319 !function(a, n) {
10320 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
10321 }(this, Modal), _defineProperty(this, "listeners", (function() {
10322 _this.triggers.forEach((function(el) {
10323 el.addEventListener("click", _this.openModal, !1);
10324 })), _this.clearButtons.forEach((function(el) {
10325 el.addEventListener("click", _this.clear, !1);
10326 }));
10327 })), _defineProperty(this, "clear", (function(e) {
10328 var root = e.currentTarget.parentNode;
10329 root.querySelector("input").value = "", root.querySelector(".ag-preview").innerHTML = "",
10330 root.querySelector("input").dispatchEvent(new Event("change"));
10331 })), _defineProperty(this, "openModal", (function(e) {
10332 var file_frame = void 0, root = e.currentTarget.parentNode, types = root.querySelector("input").name.match(/logo/) ? [ "image" ] : [ "image", "video" ], selected = root.querySelector("input").value, preview = root.querySelector(".ag-preview");
10333 if ("undefined" != typeof wp && wp.media && wp.media.editor && file_frame) return file_frame.uploader.param("post_id", selected),
10334 void file_frame.open();
10335 file_frame = wp.media.frames.select_image = wp.media({
10336 title: "Select image",
10337 button: {
10338 text: "Add image"
10339 },
10340 library: {
10341 type: types
10342 },
10343 multiple: !1,
10344 post_id: selected
10345 }), wp.media.model.settings.post.id = parseInt(selected), file_frame.on("select", (function() {
10346 var image = file_frame.state().get("selection").first().toJSON(), url = image.url, id = image.id, mime = image.mime;
10347 preview.innerHTML = "", root.querySelector("input").value = id, root.querySelector("input").dispatchEvent(new Event("change"));
10348 var img = document.createElement(mime.match(/video/) ? "video" : "img");
10349 img.src = url, preview.appendChild(img);
10350 })), file_frame.open();
10351 })), this.triggers = document.querySelectorAll("[data-modal]"), this.clearButtons = document.querySelectorAll(".ag-media-clear"),
10352 this.listeners();
10353 }));
10354 function LinkPicker_typeof(o) {
10355 return LinkPicker_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
10356 return typeof o;
10357 } : function(o) {
10358 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10359 }, LinkPicker_typeof(o);
10360 }
10361 function LinkPicker_defineProperties(e, r) {
10362 for (var t = 0; t < r.length; t++) {
10363 var o = r[t];
10364 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
10365 Object.defineProperty(e, LinkPicker_toPropertyKey(o.key), o);
10366 }
10367 }
10368 function LinkPicker_createClass(e, r, t) {
10369 return r && LinkPicker_defineProperties(e.prototype, r), t && LinkPicker_defineProperties(e, t),
10370 Object.defineProperty(e, "prototype", {
10371 writable: !1
10372 }), e;
10373 }
10374 function LinkPicker_defineProperty(e, r, t) {
10375 return (r = LinkPicker_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
10376 value: t,
10377 enumerable: !0,
10378 configurable: !0,
10379 writable: !0
10380 }) : e[r] = t, e;
10381 }
10382 function LinkPicker_toPropertyKey(t) {
10383 var i = function(t, r) {
10384 if ("object" != LinkPicker_typeof(t) || !t) return t;
10385 var e = t[Symbol.toPrimitive];
10386 if (void 0 !== e) {
10387 var i = e.call(t, r || "default");
10388 if ("object" != LinkPicker_typeof(i)) return i;
10389 throw new TypeError("@@toPrimitive must return a primitive value.");
10390 }
10391 return ("string" === r ? String : Number)(t);
10392 }(t, "string");
10393 return "symbol" == LinkPicker_typeof(i) ? i : i + "";
10394 }
10395 var LinkPicker = LinkPicker_createClass((function LinkPicker() {
10396 var selector, eventType, childSelector, eventHandler, _this = this;
10397 (function(a, n) {
10398 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
10399 }(this, LinkPicker), LinkPicker_defineProperty(this, "open", (function(e) {
10400 _this.input = e.target.parentNode.querySelector("input"), wpLink.open("wpwrap");
10401 })), LinkPicker_defineProperty(this, "update", (function(e) {
10402 var href = wpLink.getAttrs().href;
10403 _this.input.value = href;
10404 var display = _this.input.parentNode.querySelector(".link-display");
10405 return display ? display.textContent = href : ((display = document.createElement("span")).className = "link-display",
10406 display.textContent = href, _this.input.insertAdjacentElement("afterend", display)),
10407 href && _this.appendButton(e.target), !0;
10408 })), LinkPicker_defineProperty(this, "appendButton", (function() {
10409 if (!_this.input.parentNode.querySelector(".button--remove")) {
10410 var button = document.createElement("button");
10411 button.type = "button", button.className = "button button--remove", button.textContent = "Remove link",
10412 _this.input.insertAdjacentElement("beforebegin", button);
10413 }
10414 })), LinkPicker_defineProperty(this, "clear", (function(e) {
10415 e.target.parentNode.querySelector("input").value = "", e.target.parentNode.removeChild(e.target.parentNode.querySelector(".link-display")),
10416 e.target.parentNode.removeChild(e.target);
10417 })), this.modal = document.getElementById("wp-link-wrap"), this.modal) && (this.modal.classList.add("ag_link-modal"),
10418 this.select = this.modal.querySelector("#wp-link-submit"), this.select.addEventListener("click", this.update),
10419 Array.from(document.querySelectorAll(".button--link")).forEach((function(button) {
10420 button.addEventListener("click", _this.open);
10421 })), selector = "#wpwrap", eventType = "click", childSelector = ".ag-field--link .button--remove",
10422 eventHandler = this.clear, Array.from(document.querySelectorAll(selector)).forEach((function(element) {
10423 element.addEventListener(eventType, (function(eventOnElement) {
10424 eventOnElement.target.matches(childSelector) && eventHandler(eventOnElement);
10425 }));
10426 })));
10427 })), simplemde_min = __webpack_require__(4302), simplemde_min_default = __webpack_require__.n(simplemde_min);
10428 const es_core = __webpack_require__(8416), TAGS = [ "a", "abbr", "address", "article", "aside", "audio", "b", "blockquote", "body", "button", "canvas", "caption", "cite", "code", "dd", "del", "details", "dfn", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "mark", "menu", "nav", "object", "ol", "optgroup", "option", "p", "picture", "q", "quote", "samp", "section", "select", "source", "span", "strong", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "ul", "var", "video", "defs", "g", "marker", "mask", "pattern", "svg", "switch", "symbol", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feFlood", "feGaussianBlur", "feImage", "feMerge", "feMorphology", "feOffset", "feSpecularLighting", "feTile", "feTurbulence", "linearGradient", "radialGradient", "stop", "circle", "ellipse", "image", "line", "path", "polygon", "polyline", "rect", "text", "use", "textPath", "tspan", "foreignObject", "clipPath" ], MEDIA_FEATURES = [ "any-hover", "any-pointer", "aspect-ratio", "color", "color-gamut", "color-index", "device-aspect-ratio", "device-height", "device-width", "display-mode", "forced-colors", "grid", "height", "hover", "inverted-colors", "monochrome", "orientation", "overflow-block", "overflow-inline", "pointer", "prefers-color-scheme", "prefers-contrast", "prefers-reduced-motion", "prefers-reduced-transparency", "resolution", "scan", "scripting", "update", "width", "min-width", "max-width", "min-height", "max-height" ].sort().reverse(), PSEUDO_CLASSES = [ "active", "any-link", "blank", "checked", "current", "default", "defined", "dir", "disabled", "drop", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "future", "focus", "focus-visible", "focus-within", "has", "host", "host-context", "hover", "indeterminate", "in-range", "invalid", "is", "lang", "last-child", "last-of-type", "left", "link", "local-link", "not", "nth-child", "nth-col", "nth-last-child", "nth-last-col", "nth-last-of-type", "nth-of-type", "only-child", "only-of-type", "optional", "out-of-range", "past", "placeholder-shown", "read-only", "read-write", "required", "right", "root", "scope", "target", "target-within", "user-invalid", "valid", "visited", "where" ].sort().reverse(), PSEUDO_ELEMENTS = [ "after", "backdrop", "before", "cue", "cue-region", "first-letter", "first-line", "grammar-error", "marker", "part", "placeholder", "selection", "slotted", "spelling-error" ].sort().reverse(), ATTRIBUTES = [ "accent-color", "align-content", "align-items", "align-self", "alignment-baseline", "all", "animation", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timing-function", "appearance", "backface-visibility", "background", "background-attachment", "background-blend-mode", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-repeat", "background-size", "baseline-shift", "block-size", "border", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-style", "border-block-width", "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source", "border-image-width", "border-inline", "border-inline-color", "border-inline-end", "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", "border-inline-style", "border-inline-width", "border-left", "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right", "border-end-end-radius", "border-end-start-radius", "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-start-end-radius", "border-start-start-radius", "border-style", "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style", "border-top-width", "border-width", "bottom", "box-decoration-break", "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", "cx", "cy", "caption-side", "caret-color", "clear", "clip", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "color-scheme", "column-count", "column-fill", "column-gap", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "column-span", "column-width", "columns", "contain", "content", "content-visibility", "counter-increment", "counter-reset", "cue", "cue-after", "cue-before", "cursor", "direction", "display", "dominant-baseline", "empty-cells", "enable-background", "fill", "fill-opacity", "fill-rule", "filter", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "flow", "flood-color", "flood-opacity", "font", "font-display", "font-family", "font-feature-settings", "font-kerning", "font-language-override", "font-size", "font-size-adjust", "font-smoothing", "font-stretch", "font-style", "font-synthesis", "font-variant", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant-position", "font-variation-settings", "font-weight", "gap", "glyph-orientation-horizontal", "glyph-orientation-vertical", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", "grid-template-rows", "hanging-punctuation", "height", "hyphens", "icon", "image-orientation", "image-rendering", "image-resolution", "ime-mode", "inline-size", "inset", "inset-block", "inset-block-end", "inset-block-start", "inset-inline", "inset-inline-end", "inset-inline-start", "isolation", "kerning", "justify-content", "justify-items", "justify-self", "left", "letter-spacing", "lighting-color", "line-break", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", "marker", "marker-end", "marker-mid", "marker-start", "mask", "margin", "margin-block", "margin-block-end", "margin-block-start", "margin-bottom", "margin-inline", "margin-inline-end", "margin-inline-start", "margin-left", "margin-right", "margin-top", "marks", "mask", "mask-border", "mask-border-mode", "mask-border-outset", "mask-border-repeat", "mask-border-slice", "mask-border-source", "mask-border-width", "mask-clip", "mask-composite", "mask-image", "mask-mode", "mask-origin", "mask-position", "mask-repeat", "mask-size", "mask-type", "max-block-size", "max-height", "max-inline-size", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width", "mix-blend-mode", "nav-down", "nav-index", "nav-left", "nav-right", "nav-up", "none", "normal", "object-fit", "object-position", "opacity", "order", "orphans", "outline", "outline-color", "outline-offset", "outline-style", "outline-width", "overflow", "overflow-wrap", "overflow-x", "overflow-y", "padding", "padding-block", "padding-block-end", "padding-block-start", "padding-bottom", "padding-inline", "padding-inline-end", "padding-inline-start", "padding-left", "padding-right", "padding-top", "page-break-after", "page-break-before", "page-break-inside", "pause", "pause-after", "pause-before", "perspective", "perspective-origin", "pointer-events", "position", "quotes", "r", "resize", "rest", "rest-after", "rest-before", "right", "rotate", "row-gap", "scale", "scroll-margin", "scroll-margin-block", "scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-bottom", "scroll-margin-inline", "scroll-margin-inline-end", "scroll-margin-inline-start", "scroll-margin-left", "scroll-margin-right", "scroll-margin-top", "scroll-padding", "scroll-padding-block", "scroll-padding-block-end", "scroll-padding-block-start", "scroll-padding-bottom", "scroll-padding-inline", "scroll-padding-inline-end", "scroll-padding-inline-start", "scroll-padding-left", "scroll-padding-right", "scroll-padding-top", "scroll-snap-align", "scroll-snap-stop", "scroll-snap-type", "scrollbar-color", "scrollbar-gutter", "scrollbar-width", "shape-image-threshold", "shape-margin", "shape-outside", "shape-rendering", "stop-color", "stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "speak", "speak-as", "src", "tab-size", "table-layout", "text-anchor", "text-align", "text-align-all", "text-align-last", "text-combine-upright", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-skip-ink", "text-decoration-style", "text-decoration-thickness", "text-emphasis", "text-emphasis-color", "text-emphasis-position", "text-emphasis-style", "text-indent", "text-justify", "text-orientation", "text-overflow", "text-rendering", "text-shadow", "text-transform", "text-underline-offset", "text-underline-position", "top", "transform", "transform-box", "transform-origin", "transform-style", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "translate", "unicode-bidi", "vector-effect", "vertical-align", "visibility", "voice-balance", "voice-duration", "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", "voice-volume", "white-space", "widows", "width", "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "x", "y", "z-index" ].sort().reverse();
10429 function css(hljs) {
10430 const regex = hljs.regex, modes = (hljs => ({
10431 IMPORTANT: {
10432 scope: "meta",
10433 begin: "!important"
10434 },
10435 BLOCK_COMMENT: hljs.C_BLOCK_COMMENT_MODE,
10436 HEXCOLOR: {
10437 scope: "number",
10438 begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
10439 },
10440 FUNCTION_DISPATCH: {
10441 className: "built_in",
10442 begin: /[\w-]+(?=\()/
10443 },
10444 ATTRIBUTE_SELECTOR_MODE: {
10445 scope: "selector-attr",
10446 begin: /\[/,
10447 end: /\]/,
10448 illegal: "$",
10449 contains: [ hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE ]
10450 },
10451 CSS_NUMBER_MODE: {
10452 scope: "number",
10453 begin: hljs.NUMBER_RE + "(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",
10454 relevance: 0
10455 },
10456 CSS_VARIABLE: {
10457 className: "attr",
10458 begin: /--[A-Za-z_][A-Za-z0-9_-]*/
10459 }
10460 }))(hljs), STRINGS = [ hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE ];
10461 return {
10462 name: "CSS",
10463 case_insensitive: !0,
10464 illegal: /[=|'\$]/,
10465 keywords: {
10466 keyframePosition: "from to"
10467 },
10468 classNameAliases: {
10469 keyframePosition: "selector-tag"
10470 },
10471 contains: [ modes.BLOCK_COMMENT, {
10472 begin: /-(webkit|moz|ms|o)-(?=[a-z])/
10473 }, modes.CSS_NUMBER_MODE, {
10474 className: "selector-id",
10475 begin: /#[A-Za-z0-9_-]+/,
10476 relevance: 0
10477 }, {
10478 className: "selector-class",
10479 begin: "\\.[a-zA-Z-][a-zA-Z0-9_-]*",
10480 relevance: 0
10481 }, modes.ATTRIBUTE_SELECTOR_MODE, {
10482 className: "selector-pseudo",
10483 variants: [ {
10484 begin: ":(" + PSEUDO_CLASSES.join("|") + ")"
10485 }, {
10486 begin: ":(:)?(" + PSEUDO_ELEMENTS.join("|") + ")"
10487 } ]
10488 }, modes.CSS_VARIABLE, {
10489 className: "attribute",
10490 begin: "\\b(" + ATTRIBUTES.join("|") + ")\\b"
10491 }, {
10492 begin: /:/,
10493 end: /[;}{]/,
10494 contains: [ modes.BLOCK_COMMENT, modes.HEXCOLOR, modes.IMPORTANT, modes.CSS_NUMBER_MODE, ...STRINGS, {
10495 begin: /(url|data-uri)\(/,
10496 end: /\)/,
10497 relevance: 0,
10498 keywords: {
10499 built_in: "url data-uri"
10500 },
10501 contains: [ ...STRINGS, {
10502 className: "string",
10503 begin: /[^)]/,
10504 endsWithParent: !0,
10505 excludeEnd: !0
10506 } ]
10507 }, modes.FUNCTION_DISPATCH ]
10508 }, {
10509 begin: regex.lookahead(/@/),
10510 end: "[{;]",
10511 relevance: 0,
10512 illegal: /:/,
10513 contains: [ {
10514 className: "keyword",
10515 begin: /@-?\w[\w]*(-\w+)*/
10516 }, {
10517 begin: /\s/,
10518 endsWithParent: !0,
10519 excludeEnd: !0,
10520 relevance: 0,
10521 keywords: {
10522 $pattern: /[a-z-]+/,
10523 keyword: "and or not only",
10524 attribute: MEDIA_FEATURES.join(" ")
10525 },
10526 contains: [ {
10527 begin: /[a-z-]+(?=:)/,
10528 className: "attribute"
10529 }, ...STRINGS, modes.CSS_NUMBER_MODE ]
10530 } ]
10531 }, {
10532 className: "selector-tag",
10533 begin: "\\b(" + TAGS.join("|") + ")\\b"
10534 } ]
10535 };
10536 }
10537 var reactive, effect, release, raw, flushPending = !1, flushing = !1, queue = [], lastFlushedIndex = -1;
10538 function scheduler(callback) {
10539 !function(job) {
10540 queue.includes(job) || queue.push(job);
10541 flushing || flushPending || (flushPending = !0, queueMicrotask(flushJobs));
10542 }(callback);
10543 }
10544 function dequeueJob(job) {
10545 let index = queue.indexOf(job);
10546 -1 !== index && index > lastFlushedIndex && queue.splice(index, 1);
10547 }
10548 function flushJobs() {
10549 flushPending = !1, flushing = !0;
10550 for (let i = 0; i < queue.length; i++) queue[i](), lastFlushedIndex = i;
10551 queue.length = 0, lastFlushedIndex = -1, flushing = !1;
10552 }
10553 var shouldSchedule = !0;
10554 function overrideEffect(override) {
10555 effect = override;
10556 }
10557 function watch(getter, callback) {
10558 let oldValue, firstTime = !0, effectReference = effect((() => {
10559 let value = getter();
10560 JSON.stringify(value), firstTime ? oldValue = value : queueMicrotask((() => {
10561 callback(value, oldValue), oldValue = value;
10562 })), firstTime = !1;
10563 }));
10564 return () => release(effectReference);
10565 }
10566 var onAttributeAddeds = [], onElRemoveds = [], onElAddeds = [];
10567 function onElRemoved(el, callback) {
10568 "function" == typeof callback ? (el._x_cleanups || (el._x_cleanups = []), el._x_cleanups.push(callback)) : (callback = el,
10569 onElRemoveds.push(callback));
10570 }
10571 function onAttributesAdded(callback) {
10572 onAttributeAddeds.push(callback);
10573 }
10574 function onAttributeRemoved(el, name, callback) {
10575 el._x_attributeCleanups || (el._x_attributeCleanups = {}), el._x_attributeCleanups[name] || (el._x_attributeCleanups[name] = []),
10576 el._x_attributeCleanups[name].push(callback);
10577 }
10578 function cleanupAttributes(el, names) {
10579 el._x_attributeCleanups && Object.entries(el._x_attributeCleanups).forEach((([name, value]) => {
10580 (void 0 === names || names.includes(name)) && (value.forEach((i => i())), delete el._x_attributeCleanups[name]);
10581 }));
10582 }
10583 var observer = new MutationObserver(onMutate), currentlyObserving = !1;
10584 function startObservingMutations() {
10585 observer.observe(document, {
10586 subtree: !0,
10587 childList: !0,
10588 attributes: !0,
10589 attributeOldValue: !0
10590 }), currentlyObserving = !0;
10591 }
10592 function stopObservingMutations() {
10593 !function() {
10594 let records = observer.takeRecords();
10595 queuedMutations.push((() => records.length > 0 && onMutate(records)));
10596 let queueLengthWhenTriggered = queuedMutations.length;
10597 queueMicrotask((() => {
10598 if (queuedMutations.length === queueLengthWhenTriggered) for (;queuedMutations.length > 0; ) queuedMutations.shift()();
10599 }));
10600 }(), observer.disconnect(), currentlyObserving = !1;
10601 }
10602 var queuedMutations = [];
10603 function mutateDom(callback) {
10604 if (!currentlyObserving) return callback();
10605 stopObservingMutations();
10606 let result = callback();
10607 return startObservingMutations(), result;
10608 }
10609 var isCollecting = !1, deferredMutations = [];
10610 function onMutate(mutations) {
10611 if (isCollecting) return void (deferredMutations = deferredMutations.concat(mutations));
10612 let addedNodes = new Set, removedNodes = new Set, addedAttributes = new Map, removedAttributes = new Map;
10613 for (let i = 0; i < mutations.length; i++) if (!mutations[i].target._x_ignoreMutationObserver && ("childList" === mutations[i].type && (mutations[i].addedNodes.forEach((node => 1 === node.nodeType && addedNodes.add(node))),
10614 mutations[i].removedNodes.forEach((node => 1 === node.nodeType && removedNodes.add(node)))),
10615 "attributes" === mutations[i].type)) {
10616 let el = mutations[i].target, name = mutations[i].attributeName, oldValue = mutations[i].oldValue, add2 = () => {
10617 addedAttributes.has(el) || addedAttributes.set(el, []), addedAttributes.get(el).push({
10618 name,
10619 value: el.getAttribute(name)
10620 });
10621 }, remove = () => {
10622 removedAttributes.has(el) || removedAttributes.set(el, []), removedAttributes.get(el).push(name);
10623 };
10624 el.hasAttribute(name) && null === oldValue ? add2() : el.hasAttribute(name) ? (remove(),
10625 add2()) : remove();
10626 }
10627 removedAttributes.forEach(((attrs, el) => {
10628 cleanupAttributes(el, attrs);
10629 })), addedAttributes.forEach(((attrs, el) => {
10630 onAttributeAddeds.forEach((i => i(el, attrs)));
10631 }));
10632 for (let node of removedNodes) addedNodes.has(node) || onElRemoveds.forEach((i => i(node)));
10633 addedNodes.forEach((node => {
10634 node._x_ignoreSelf = !0, node._x_ignore = !0;
10635 }));
10636 for (let node of addedNodes) removedNodes.has(node) || node.isConnected && (delete node._x_ignoreSelf,
10637 delete node._x_ignore, onElAddeds.forEach((i => i(node))), node._x_ignore = !0,
10638 node._x_ignoreSelf = !0);
10639 addedNodes.forEach((node => {
10640 delete node._x_ignoreSelf, delete node._x_ignore;
10641 })), addedNodes = null, removedNodes = null, addedAttributes = null, removedAttributes = null;
10642 }
10643 function scope(node) {
10644 return mergeProxies(closestDataStack(node));
10645 }
10646 function addScopeToNode(node, data2, referenceNode) {
10647 return node._x_dataStack = [ data2, ...closestDataStack(referenceNode || node) ],
10648 () => {
10649 node._x_dataStack = node._x_dataStack.filter((i => i !== data2));
10650 };
10651 }
10652 function closestDataStack(node) {
10653 return node._x_dataStack ? node._x_dataStack : "function" == typeof ShadowRoot && node instanceof ShadowRoot ? closestDataStack(node.host) : node.parentNode ? closestDataStack(node.parentNode) : [];
10654 }
10655 function mergeProxies(objects) {
10656 return new Proxy({
10657 objects
10658 }, mergeProxyTrap);
10659 }
10660 var mergeProxyTrap = {
10661 ownKeys: ({objects}) => Array.from(new Set(objects.flatMap((i => Object.keys(i))))),
10662 has: ({objects}, name) => name != Symbol.unscopables && objects.some((obj => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name))),
10663 get: ({objects}, name, thisProxy) => "toJSON" == name ? collapseProxies : Reflect.get(objects.find((obj => Reflect.has(obj, name))) || {}, name, thisProxy),
10664 set({objects}, name, value, thisProxy) {
10665 const target = objects.find((obj => Object.prototype.hasOwnProperty.call(obj, name))) || objects[objects.length - 1], descriptor = Object.getOwnPropertyDescriptor(target, name);
10666 return descriptor?.set && descriptor?.get ? descriptor.set.call(thisProxy, value) || !0 : Reflect.set(target, name, value);
10667 }
10668 };
10669 function collapseProxies() {
10670 return Reflect.ownKeys(this).reduce(((acc, key) => (acc[key] = Reflect.get(this, key),
10671 acc)), {});
10672 }
10673 function initInterceptors(data2) {
10674 let recurse = (obj, basePath = "") => {
10675 Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach((([key, {value, enumerable}]) => {
10676 if (!1 === enumerable || void 0 === value) return;
10677 if ("object" == typeof value && null !== value && value.__v_skip) return;
10678 let path = "" === basePath ? key : `${basePath}.${key}`;
10679 var val;
10680 "object" == typeof value && null !== value && value._x_interceptor ? obj[key] = value.initialize(data2, path, key) : "object" != typeof (val = value) || Array.isArray(val) || null === val || value === obj || value instanceof Element || recurse(value, path);
10681 }));
10682 };
10683 return recurse(data2);
10684 }
10685 function interceptor(callback, mutateObj = () => {}) {
10686 let obj = {
10687 initialValue: void 0,
10688 _x_interceptor: !0,
10689 initialize(data2, path, key) {
10690 return callback(this.initialValue, (() => function(obj, path) {
10691 return path.split(".").reduce(((carry, segment) => carry[segment]), obj);
10692 }(data2, path)), (value => set(data2, path, value)), path, key);
10693 }
10694 };
10695 return mutateObj(obj), initialValue => {
10696 if ("object" == typeof initialValue && null !== initialValue && initialValue._x_interceptor) {
10697 let initialize = obj.initialize.bind(obj);
10698 obj.initialize = (data2, path, key) => {
10699 let innerValue = initialValue.initialize(data2, path, key);
10700 return obj.initialValue = innerValue, initialize(data2, path, key);
10701 };
10702 } else obj.initialValue = initialValue;
10703 return obj;
10704 };
10705 }
10706 function set(obj, path, value) {
10707 if ("string" == typeof path && (path = path.split(".")), 1 !== path.length) {
10708 if (0 === path.length) throw error;
10709 return obj[path[0]] || (obj[path[0]] = {}), set(obj[path[0]], path.slice(1), value);
10710 }
10711 obj[path[0]] = value;
10712 }
10713 var magics = {};
10714 function magic(name, callback) {
10715 magics[name] = callback;
10716 }
10717 function injectMagics(obj, el) {
10718 return Object.entries(magics).forEach((([name, callback]) => {
10719 let memoizedUtilities = null;
10720 Object.defineProperty(obj, `$${name}`, {
10721 get: () => callback(el, function() {
10722 if (memoizedUtilities) return memoizedUtilities;
10723 {
10724 let [utilities, cleanup2] = getElementBoundUtilities(el);
10725 return memoizedUtilities = {
10726 interceptor,
10727 ...utilities
10728 }, onElRemoved(el, cleanup2), memoizedUtilities;
10729 }
10730 }()),
10731 enumerable: !1
10732 });
10733 })), obj;
10734 }
10735 function tryCatch(el, expression, callback, ...args) {
10736 try {
10737 return callback(...args);
10738 } catch (e) {
10739 handleError(e, el, expression);
10740 }
10741 }
10742 function handleError(error2, el, expression = void 0) {
10743 error2 = Object.assign(error2 ?? {
10744 message: "No error message given."
10745 }, {
10746 el,
10747 expression
10748 }), setTimeout((() => {
10749 throw error2;
10750 }), 0);
10751 }
10752 var shouldAutoEvaluateFunctions = !0;
10753 function dontAutoEvaluateFunctions(callback) {
10754 let cache = shouldAutoEvaluateFunctions;
10755 shouldAutoEvaluateFunctions = !1;
10756 let result = callback();
10757 return shouldAutoEvaluateFunctions = cache, result;
10758 }
10759 function evaluate(el, expression, extras = {}) {
10760 let result;
10761 return evaluateLater(el, expression)((value => result = value), extras), result;
10762 }
10763 function evaluateLater(...args) {
10764 return theEvaluatorFunction(...args);
10765 }
10766 var theEvaluatorFunction = normalEvaluator;
10767 function normalEvaluator(el, expression) {
10768 let overriddenMagics = {};
10769 injectMagics(overriddenMagics, el);
10770 let dataStack = [ overriddenMagics, ...closestDataStack(el) ], evaluator = "function" == typeof expression ? function(dataStack, func) {
10771 return (receiver = () => {}, {scope: scope2 = {}, params = []} = {}) => {
10772 runIfTypeOfFunction(receiver, func.apply(mergeProxies([ scope2, ...dataStack ]), params));
10773 };
10774 }(dataStack, expression) : function(dataStack, expression, el) {
10775 let func = function(expression, el) {
10776 if (evaluatorMemo[expression]) return evaluatorMemo[expression];
10777 let AsyncFunction = Object.getPrototypeOf((async function() {})).constructor, rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression;
10778 const safeAsyncFunction = () => {
10779 try {
10780 let func2 = new AsyncFunction([ "__self", "scope" ], `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`);
10781 return Object.defineProperty(func2, "name", {
10782 value: `[Alpine] ${expression}`
10783 }), func2;
10784 } catch (error2) {
10785 return handleError(error2, el, expression), Promise.resolve();
10786 }
10787 };
10788 let func = safeAsyncFunction();
10789 return evaluatorMemo[expression] = func, func;
10790 }(expression, el);
10791 return (receiver = () => {}, {scope: scope2 = {}, params = []} = {}) => {
10792 func.result = void 0, func.finished = !1;
10793 let completeScope = mergeProxies([ scope2, ...dataStack ]);
10794 if ("function" == typeof func) {
10795 let promise = func(func, completeScope).catch((error2 => handleError(error2, el, expression)));
10796 func.finished ? (runIfTypeOfFunction(receiver, func.result, completeScope, params, el),
10797 func.result = void 0) : promise.then((result => {
10798 runIfTypeOfFunction(receiver, result, completeScope, params, el);
10799 })).catch((error2 => handleError(error2, el, expression))).finally((() => func.result = void 0));
10800 }
10801 };
10802 }(dataStack, expression, el);
10803 return tryCatch.bind(null, el, expression, evaluator);
10804 }
10805 var evaluatorMemo = {};
10806 function runIfTypeOfFunction(receiver, value, scope2, params, el) {
10807 if (shouldAutoEvaluateFunctions && "function" == typeof value) {
10808 let result = value.apply(scope2, params);
10809 result instanceof Promise ? result.then((i => runIfTypeOfFunction(receiver, i, scope2, params))).catch((error2 => handleError(error2, el, value))) : receiver(result);
10810 } else "object" == typeof value && value instanceof Promise ? value.then((i => receiver(i))) : receiver(value);
10811 }
10812 var prefixAsString = "x-";
10813 function prefix(subject = "") {
10814 return prefixAsString + subject;
10815 }
10816 var directiveHandlers = {};
10817 function directive(name, callback) {
10818 return directiveHandlers[name] = callback, {
10819 before(directive2) {
10820 if (!directiveHandlers[directive2]) return;
10821 const pos = directiveOrder.indexOf(directive2);
10822 directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name);
10823 }
10824 };
10825 }
10826 function directives(el, attributes, originalAttributeOverride) {
10827 if (attributes = Array.from(attributes), el._x_virtualDirectives) {
10828 let vAttributes = Object.entries(el._x_virtualDirectives).map((([name, value]) => ({
10829 name,
10830 value
10831 }))), staticAttributes = attributesOnly(vAttributes);
10832 vAttributes = vAttributes.map((attribute => staticAttributes.find((attr => attr.name === attribute.name)) ? {
10833 name: `x-bind:${attribute.name}`,
10834 value: `"${attribute.value}"`
10835 } : attribute)), attributes = attributes.concat(vAttributes);
10836 }
10837 let transformedAttributeMap = {}, directives2 = attributes.map(toTransformedAttributes(((newName, oldName) => transformedAttributeMap[newName] = oldName))).filter(outNonAlpineAttributes).map(function(transformedAttributeMap, originalAttributeOverride) {
10838 return ({name, value}) => {
10839 let typeMatch = name.match(alpineAttributeRegex()), valueMatch = name.match(/:([a-zA-Z0-9\-_:]+)/), modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || [], original = originalAttributeOverride || transformedAttributeMap[name] || name;
10840 return {
10841 type: typeMatch ? typeMatch[1] : null,
10842 value: valueMatch ? valueMatch[1] : null,
10843 modifiers: modifiers.map((i => i.replace(".", ""))),
10844 expression: value,
10845 original
10846 };
10847 };
10848 }(transformedAttributeMap, originalAttributeOverride)).sort(byPriority);
10849 return directives2.map((directive2 => function(el, directive2) {
10850 let noop = () => {}, handler4 = directiveHandlers[directive2.type] || noop, [utilities, cleanup2] = getElementBoundUtilities(el);
10851 onAttributeRemoved(el, directive2.original, cleanup2);
10852 let fullHandler = () => {
10853 el._x_ignore || el._x_ignoreSelf || (handler4.inline && handler4.inline(el, directive2, utilities),
10854 handler4 = handler4.bind(handler4, el, directive2, utilities), isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4());
10855 };
10856 return fullHandler.runCleanups = cleanup2, fullHandler;
10857 }(el, directive2)));
10858 }
10859 function attributesOnly(attributes) {
10860 return Array.from(attributes).map(toTransformedAttributes()).filter((attr => !outNonAlpineAttributes(attr)));
10861 }
10862 var isDeferringHandlers = !1, directiveHandlerStacks = new Map, currentHandlerStackKey = Symbol();
10863 function getElementBoundUtilities(el) {
10864 let cleanups = [], [effect3, cleanupEffect] = function(el) {
10865 let cleanup2 = () => {};
10866 return [ callback => {
10867 let effectReference = effect(callback);
10868 return el._x_effects || (el._x_effects = new Set, el._x_runEffects = () => {
10869 el._x_effects.forEach((i => i()));
10870 }), el._x_effects.add(effectReference), cleanup2 = () => {
10871 void 0 !== effectReference && (el._x_effects.delete(effectReference), release(effectReference));
10872 }, effectReference;
10873 }, () => {
10874 cleanup2();
10875 } ];
10876 }(el);
10877 cleanups.push(cleanupEffect);
10878 return [ {
10879 Alpine: alpine_default,
10880 effect: effect3,
10881 cleanup: callback => cleanups.push(callback),
10882 evaluateLater: evaluateLater.bind(evaluateLater, el),
10883 evaluate: evaluate.bind(evaluate, el)
10884 }, () => cleanups.forEach((i => i())) ];
10885 }
10886 var startingWith = (subject, replacement) => ({name, value}) => (name.startsWith(subject) && (name = name.replace(subject, replacement)),
10887 {
10888 name,
10889 value
10890 });
10891 function toTransformedAttributes(callback = () => {}) {
10892 return ({name, value}) => {
10893 let {name: newName, value: newValue} = attributeTransformers.reduce(((carry, transform) => transform(carry)), {
10894 name,
10895 value
10896 });
10897 return newName !== name && callback(newName, name), {
10898 name: newName,
10899 value: newValue
10900 };
10901 };
10902 }
10903 var attributeTransformers = [];
10904 function mapAttributes(callback) {
10905 attributeTransformers.push(callback);
10906 }
10907 function outNonAlpineAttributes({name}) {
10908 return alpineAttributeRegex().test(name);
10909 }
10910 var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`);
10911 var DEFAULT = "DEFAULT", directiveOrder = [ "ignore", "ref", "data", "id", "anchor", "bind", "init", "for", "model", "modelable", "transition", "show", "if", DEFAULT, "teleport" ];
10912 function byPriority(a, b) {
10913 let typeA = -1 === directiveOrder.indexOf(a.type) ? DEFAULT : a.type, typeB = -1 === directiveOrder.indexOf(b.type) ? DEFAULT : b.type;
10914 return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
10915 }
10916 function dispatch(el, name, detail = {}) {
10917 el.dispatchEvent(new CustomEvent(name, {
10918 detail,
10919 bubbles: !0,
10920 composed: !0,
10921 cancelable: !0
10922 }));
10923 }
10924 function walk(el, callback) {
10925 if ("function" == typeof ShadowRoot && el instanceof ShadowRoot) return void Array.from(el.children).forEach((el2 => walk(el2, callback)));
10926 let skip = !1;
10927 if (callback(el, (() => skip = !0)), skip) return;
10928 let node = el.firstElementChild;
10929 for (;node; ) walk(node, callback), node = node.nextElementSibling;
10930 }
10931 var rootSelectorCallbacks = [], initSelectorCallbacks = [];
10932 function rootSelectors() {
10933 return rootSelectorCallbacks.map((fn => fn()));
10934 }
10935 function allSelectors() {
10936 return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn => fn()));
10937 }
10938 function addRootSelector(selectorCallback) {
10939 rootSelectorCallbacks.push(selectorCallback);
10940 }
10941 function addInitSelector(selectorCallback) {
10942 initSelectorCallbacks.push(selectorCallback);
10943 }
10944 function closestRoot(el, includeInitSelectors = !1) {
10945 return findClosest(el, (element => {
10946 if ((includeInitSelectors ? allSelectors() : rootSelectors()).some((selector => element.matches(selector)))) return !0;
10947 }));
10948 }
10949 function findClosest(el, callback) {
10950 if (el) {
10951 if (callback(el)) return el;
10952 if (el._x_teleportBack && (el = el._x_teleportBack), el.parentElement) return findClosest(el.parentElement, callback);
10953 }
10954 }
10955 var initInterceptors2 = [];
10956 function initTree(el, walker = walk, intercept = () => {}) {
10957 !function(callback) {
10958 isDeferringHandlers = !0;
10959 let key = Symbol();
10960 currentHandlerStackKey = key, directiveHandlerStacks.set(key, []);
10961 let flushHandlers = () => {
10962 for (;directiveHandlerStacks.get(key).length; ) directiveHandlerStacks.get(key).shift()();
10963 directiveHandlerStacks.delete(key);
10964 };
10965 callback(flushHandlers), isDeferringHandlers = !1, flushHandlers();
10966 }((() => {
10967 walker(el, ((el2, skip) => {
10968 intercept(el2, skip), initInterceptors2.forEach((i => i(el2, skip))), directives(el2, el2.attributes).forEach((handle => handle())),
10969 el2._x_ignore && skip();
10970 }));
10971 }));
10972 }
10973 function destroyTree(root, walker = walk) {
10974 walker(root, (el => {
10975 cleanupAttributes(el), function(el) {
10976 if (el._x_cleanups) for (;el._x_cleanups.length; ) el._x_cleanups.pop()();
10977 }(el);
10978 }));
10979 }
10980 var tickStack = [], isHolding = !1;
10981 function nextTick(callback = () => {}) {
10982 return queueMicrotask((() => {
10983 isHolding || setTimeout((() => {
10984 releaseNextTicks();
10985 }));
10986 })), new Promise((res => {
10987 tickStack.push((() => {
10988 callback(), res();
10989 }));
10990 }));
10991 }
10992 function releaseNextTicks() {
10993 for (isHolding = !1; tickStack.length; ) tickStack.shift()();
10994 }
10995 function setClasses(el, value) {
10996 return Array.isArray(value) ? setClassesFromString(el, value.join(" ")) : "object" == typeof value && null !== value ? function(el, classObject) {
10997 let split = classString => classString.split(" ").filter(Boolean), forAdd = Object.entries(classObject).flatMap((([classString, bool]) => !!bool && split(classString))).filter(Boolean), forRemove = Object.entries(classObject).flatMap((([classString, bool]) => !bool && split(classString))).filter(Boolean), added = [], removed = [];
10998 return forRemove.forEach((i => {
10999 el.classList.contains(i) && (el.classList.remove(i), removed.push(i));
11000 })), forAdd.forEach((i => {
11001 el.classList.contains(i) || (el.classList.add(i), added.push(i));
11002 })), () => {
11003 removed.forEach((i => el.classList.add(i))), added.forEach((i => el.classList.remove(i)));
11004 };
11005 }(el, value) : "function" == typeof value ? setClasses(el, value()) : setClassesFromString(el, value);
11006 }
11007 function setClassesFromString(el, classString) {
11008 return classString = !0 === classString ? classString = "" : classString || "",
11009 classes = classString.split(" ").filter((i => !el.classList.contains(i))).filter(Boolean),
11010 el.classList.add(...classes), () => {
11011 el.classList.remove(...classes);
11012 };
11013 var classes;
11014 }
11015 function setStyles(el, value) {
11016 return "object" == typeof value && null !== value ? function(el, value) {
11017 let previousStyles = {};
11018 return Object.entries(value).forEach((([key, value2]) => {
11019 previousStyles[key] = el.style[key], key.startsWith("--") || (key = key.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()),
11020 el.style.setProperty(key, value2);
11021 })), setTimeout((() => {
11022 0 === el.style.length && el.removeAttribute("style");
11023 })), () => {
11024 setStyles(el, previousStyles);
11025 };
11026 }(el, value) : function(el, value) {
11027 let cache = el.getAttribute("style", value);
11028 return el.setAttribute("style", value), () => {
11029 el.setAttribute("style", cache || "");
11030 };
11031 }(el, value);
11032 }
11033 function once(callback, fallback = () => {}) {
11034 let called = !1;
11035 return function() {
11036 called ? fallback.apply(this, arguments) : (called = !0, callback.apply(this, arguments));
11037 };
11038 }
11039 function registerTransitionObject(el, setFunction, defaultValue = {}) {
11040 el._x_transition || (el._x_transition = {
11041 enter: {
11042 during: defaultValue,
11043 start: defaultValue,
11044 end: defaultValue
11045 },
11046 leave: {
11047 during: defaultValue,
11048 start: defaultValue,
11049 end: defaultValue
11050 },
11051 in(before = () => {}, after = () => {}) {
11052 transition(el, setFunction, {
11053 during: this.enter.during,
11054 start: this.enter.start,
11055 end: this.enter.end
11056 }, before, after);
11057 },
11058 out(before = () => {}, after = () => {}) {
11059 transition(el, setFunction, {
11060 during: this.leave.during,
11061 start: this.leave.start,
11062 end: this.leave.end
11063 }, before, after);
11064 }
11065 });
11066 }
11067 function closestHide(el) {
11068 let parent = el.parentNode;
11069 if (parent) return parent._x_hidePromise ? parent : closestHide(parent);
11070 }
11071 function transition(el, setFunction, {during, start: start2, end} = {}, before = () => {}, after = () => {}) {
11072 if (el._x_transitioning && el._x_transitioning.cancel(), 0 === Object.keys(during).length && 0 === Object.keys(start2).length && 0 === Object.keys(end).length) return before(),
11073 void after();
11074 let undoStart, undoDuring, undoEnd;
11075 !function(el, stages) {
11076 let interrupted, reachedBefore, reachedEnd, finish = once((() => {
11077 mutateDom((() => {
11078 interrupted = !0, reachedBefore || stages.before(), reachedEnd || (stages.end(),
11079 releaseNextTicks()), stages.after(), el.isConnected && stages.cleanup(), delete el._x_transitioning;
11080 }));
11081 }));
11082 el._x_transitioning = {
11083 beforeCancels: [],
11084 beforeCancel(callback) {
11085 this.beforeCancels.push(callback);
11086 },
11087 cancel: once((function() {
11088 for (;this.beforeCancels.length; ) this.beforeCancels.shift()();
11089 finish();
11090 })),
11091 finish
11092 }, mutateDom((() => {
11093 stages.start(), stages.during();
11094 })), isHolding = !0, requestAnimationFrame((() => {
11095 if (interrupted) return;
11096 let duration = 1e3 * Number(getComputedStyle(el).transitionDuration.replace(/,.*/, "").replace("s", "")), delay = 1e3 * Number(getComputedStyle(el).transitionDelay.replace(/,.*/, "").replace("s", ""));
11097 0 === duration && (duration = 1e3 * Number(getComputedStyle(el).animationDuration.replace("s", ""))),
11098 mutateDom((() => {
11099 stages.before();
11100 })), reachedBefore = !0, requestAnimationFrame((() => {
11101 interrupted || (mutateDom((() => {
11102 stages.end();
11103 })), releaseNextTicks(), setTimeout(el._x_transitioning.finish, duration + delay),
11104 reachedEnd = !0);
11105 }));
11106 }));
11107 }(el, {
11108 start() {
11109 undoStart = setFunction(el, start2);
11110 },
11111 during() {
11112 undoDuring = setFunction(el, during);
11113 },
11114 before,
11115 end() {
11116 undoStart(), undoEnd = setFunction(el, end);
11117 },
11118 after,
11119 cleanup() {
11120 undoDuring(), undoEnd();
11121 }
11122 });
11123 }
11124 function modifierValue(modifiers, key, fallback) {
11125 if (-1 === modifiers.indexOf(key)) return fallback;
11126 const rawValue = modifiers[modifiers.indexOf(key) + 1];
11127 if (!rawValue) return fallback;
11128 if ("scale" === key && isNaN(rawValue)) return fallback;
11129 if ("duration" === key || "delay" === key) {
11130 let match = rawValue.match(/([0-9]+)ms/);
11131 if (match) return match[1];
11132 }
11133 return "origin" === key && [ "top", "right", "left", "center", "bottom" ].includes(modifiers[modifiers.indexOf(key) + 2]) ? [ rawValue, modifiers[modifiers.indexOf(key) + 2] ].join(" ") : rawValue;
11134 }
11135 directive("transition", ((el, {value, modifiers, expression}, {evaluate: evaluate2}) => {
11136 "function" == typeof expression && (expression = evaluate2(expression)), !1 !== expression && (expression && "boolean" != typeof expression ? function(el, classString, stage) {
11137 registerTransitionObject(el, setClasses, "");
11138 let directiveStorageMap = {
11139 enter: classes => {
11140 el._x_transition.enter.during = classes;
11141 },
11142 "enter-start": classes => {
11143 el._x_transition.enter.start = classes;
11144 },
11145 "enter-end": classes => {
11146 el._x_transition.enter.end = classes;
11147 },
11148 leave: classes => {
11149 el._x_transition.leave.during = classes;
11150 },
11151 "leave-start": classes => {
11152 el._x_transition.leave.start = classes;
11153 },
11154 "leave-end": classes => {
11155 el._x_transition.leave.end = classes;
11156 }
11157 };
11158 directiveStorageMap[stage](classString);
11159 }(el, expression, value) : function(el, modifiers, stage) {
11160 registerTransitionObject(el, setStyles);
11161 let doesntSpecify = !modifiers.includes("in") && !modifiers.includes("out") && !stage, transitioningIn = doesntSpecify || modifiers.includes("in") || [ "enter" ].includes(stage), transitioningOut = doesntSpecify || modifiers.includes("out") || [ "leave" ].includes(stage);
11162 modifiers.includes("in") && !doesntSpecify && (modifiers = modifiers.filter(((i, index) => index < modifiers.indexOf("out"))));
11163 modifiers.includes("out") && !doesntSpecify && (modifiers = modifiers.filter(((i, index) => index > modifiers.indexOf("out"))));
11164 let wantsAll = !modifiers.includes("opacity") && !modifiers.includes("scale"), wantsOpacity = wantsAll || modifiers.includes("opacity"), wantsScale = wantsAll || modifiers.includes("scale"), opacityValue = wantsOpacity ? 0 : 1, scaleValue = wantsScale ? modifierValue(modifiers, "scale", 95) / 100 : 1, delay = modifierValue(modifiers, "delay", 0) / 1e3, origin = modifierValue(modifiers, "origin", "center"), property = "opacity, transform", durationIn = modifierValue(modifiers, "duration", 150) / 1e3, durationOut = modifierValue(modifiers, "duration", 75) / 1e3, easing = "cubic-bezier(0.4, 0.0, 0.2, 1)";
11165 transitioningIn && (el._x_transition.enter.during = {
11166 transformOrigin: origin,
11167 transitionDelay: `${delay}s`,
11168 transitionProperty: property,
11169 transitionDuration: `${durationIn}s`,
11170 transitionTimingFunction: easing
11171 }, el._x_transition.enter.start = {
11172 opacity: opacityValue,
11173 transform: `scale(${scaleValue})`
11174 }, el._x_transition.enter.end = {
11175 opacity: 1,
11176 transform: "scale(1)"
11177 });
11178 transitioningOut && (el._x_transition.leave.during = {
11179 transformOrigin: origin,
11180 transitionDelay: `${delay}s`,
11181 transitionProperty: property,
11182 transitionDuration: `${durationOut}s`,
11183 transitionTimingFunction: easing
11184 }, el._x_transition.leave.start = {
11185 opacity: 1,
11186 transform: "scale(1)"
11187 }, el._x_transition.leave.end = {
11188 opacity: opacityValue,
11189 transform: `scale(${scaleValue})`
11190 });
11191 }(el, modifiers, value));
11192 })), window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) {
11193 const nextTick2 = "visible" === document.visibilityState ? requestAnimationFrame : setTimeout;
11194 let clickAwayCompatibleShow = () => nextTick2(show);
11195 value ? el._x_transition && (el._x_transition.enter || el._x_transition.leave) ? el._x_transition.enter && (Object.entries(el._x_transition.enter.during).length || Object.entries(el._x_transition.enter.start).length || Object.entries(el._x_transition.enter.end).length) ? el._x_transition.in(show) : clickAwayCompatibleShow() : el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow() : (el._x_hidePromise = el._x_transition ? new Promise(((resolve, reject) => {
11196 el._x_transition.out((() => {}), (() => resolve(hide))), el._x_transitioning && el._x_transitioning.beforeCancel((() => reject({
11197 isFromCancelledTransition: !0
11198 })));
11199 })) : Promise.resolve(hide), queueMicrotask((() => {
11200 let closest = closestHide(el);
11201 closest ? (closest._x_hideChildren || (closest._x_hideChildren = []), closest._x_hideChildren.push(el)) : nextTick2((() => {
11202 let hideAfterChildren = el2 => {
11203 let carry = Promise.all([ el2._x_hidePromise, ...(el2._x_hideChildren || []).map(hideAfterChildren) ]).then((([i]) => i?.()));
11204 return delete el2._x_hidePromise, delete el2._x_hideChildren, carry;
11205 };
11206 hideAfterChildren(el).catch((e => {
11207 if (!e.isFromCancelledTransition) throw e;
11208 }));
11209 }));
11210 })));
11211 };
11212 var isCloning = !1;
11213 function skipDuringClone(callback, fallback = () => {}) {
11214 return (...args) => isCloning ? fallback(...args) : callback(...args);
11215 }
11216 var interceptors = [];
11217 function interceptClone(callback) {
11218 interceptors.push(callback);
11219 }
11220 var isCloningLegacy = !1;
11221 function dontRegisterReactiveSideEffects(callback) {
11222 let cache = effect;
11223 overrideEffect(((callback2, el) => {
11224 let storedEffect = cache(callback2);
11225 return release(storedEffect), () => {};
11226 })), callback(), overrideEffect(cache);
11227 }
11228 function bind(el, name, value, modifiers = []) {
11229 switch (el._x_bindings || (el._x_bindings = reactive({})), el._x_bindings[name] = value,
11230 name = modifiers.includes("camel") ? name.toLowerCase().replace(/-(\w)/g, ((match, char) => char.toUpperCase())) : name) {
11231 case "value":
11232 !function(el, value) {
11233 if ("radio" === el.type) void 0 === el.attributes.value && (el.value = value), window.fromModel && (el.checked = "boolean" == typeof value ? safeParseBoolean(el.value) === value : checkedAttrLooseCompare(el.value, value)); else if ("checkbox" === el.type) Number.isInteger(value) ? el.value = value : Array.isArray(value) || "boolean" == typeof value || [ null, void 0 ].includes(value) ? Array.isArray(value) ? el.checked = value.some((val => checkedAttrLooseCompare(val, el.value))) : el.checked = !!value : el.value = String(value); else if ("SELECT" === el.tagName) !function(el, value) {
11234 const arrayWrappedValue = [].concat(value).map((value2 => value2 + ""));
11235 Array.from(el.options).forEach((option => {
11236 option.selected = arrayWrappedValue.includes(option.value);
11237 }));
11238 }(el, value); else {
11239 if (el.value === value) return;
11240 el.value = void 0 === value ? "" : value;
11241 }
11242 }(el, value);
11243 break;
11244
11245 case "style":
11246 !function(el, value) {
11247 el._x_undoAddedStyles && el._x_undoAddedStyles();
11248 el._x_undoAddedStyles = setStyles(el, value);
11249 }(el, value);
11250 break;
11251
11252 case "class":
11253 !function(el, value) {
11254 el._x_undoAddedClasses && el._x_undoAddedClasses();
11255 el._x_undoAddedClasses = setClasses(el, value);
11256 }(el, value);
11257 break;
11258
11259 case "selected":
11260 case "checked":
11261 !function(el, name, value) {
11262 bindAttribute(el, name, value), function(el, propName, value) {
11263 el[propName] !== value && (el[propName] = value);
11264 }(el, name, value);
11265 }(el, name, value);
11266 break;
11267
11268 default:
11269 bindAttribute(el, name, value);
11270 }
11271 }
11272 function bindAttribute(el, name, value) {
11273 [ null, void 0, !1 ].includes(value) && function(name) {
11274 return ![ "aria-pressed", "aria-checked", "aria-expanded", "aria-selected" ].includes(name);
11275 }(name) ? el.removeAttribute(name) : (isBooleanAttr(name) && (value = name), function(el, attrName, value) {
11276 el.getAttribute(attrName) != value && el.setAttribute(attrName, value);
11277 }(el, name, value));
11278 }
11279 function checkedAttrLooseCompare(valueA, valueB) {
11280 return valueA == valueB;
11281 }
11282 function safeParseBoolean(rawValue) {
11283 return !![ 1, "1", "true", "on", "yes", !0 ].includes(rawValue) || ![ 0, "0", "false", "off", "no", !1 ].includes(rawValue) && (rawValue ? Boolean(rawValue) : null);
11284 }
11285 function isBooleanAttr(attrName) {
11286 return [ "disabled", "checked", "required", "readonly", "open", "selected", "autofocus", "itemscope", "multiple", "novalidate", "allowfullscreen", "allowpaymentrequest", "formnovalidate", "autoplay", "controls", "loop", "muted", "playsinline", "default", "ismap", "reversed", "async", "defer", "nomodule" ].includes(attrName);
11287 }
11288 function getAttributeBinding(el, name, fallback) {
11289 let attr = el.getAttribute(name);
11290 return null === attr ? "function" == typeof fallback ? fallback() : fallback : "" === attr || (isBooleanAttr(name) ? !![ name, "true" ].includes(attr) : attr);
11291 }
11292 function debounce(func, wait) {
11293 var timeout;
11294 return function() {
11295 var context = this, args = arguments;
11296 clearTimeout(timeout), timeout = setTimeout((function() {
11297 timeout = null, func.apply(context, args);
11298 }), wait);
11299 };
11300 }
11301 function throttle(func, limit) {
11302 let inThrottle;
11303 return function() {
11304 let context = this, args = arguments;
11305 inThrottle || (func.apply(context, args), inThrottle = !0, setTimeout((() => inThrottle = !1), limit));
11306 };
11307 }
11308 function entangle({get: outerGet, set: outerSet}, {get: innerGet, set: innerSet}) {
11309 let outerHash, innerHash, firstRun = !0, reference = effect((() => {
11310 let outer = outerGet(), inner = innerGet();
11311 if (firstRun) innerSet(cloneIfObject(outer)), firstRun = !1; else {
11312 let outerHashLatest = JSON.stringify(outer), innerHashLatest = JSON.stringify(inner);
11313 outerHashLatest !== outerHash ? innerSet(cloneIfObject(outer)) : outerHashLatest !== innerHashLatest && outerSet(cloneIfObject(inner));
11314 }
11315 outerHash = JSON.stringify(outerGet()), innerHash = JSON.stringify(innerGet());
11316 }));
11317 return () => {
11318 release(reference);
11319 };
11320 }
11321 function cloneIfObject(value) {
11322 return "object" == typeof value ? JSON.parse(JSON.stringify(value)) : value;
11323 }
11324 var stores = {}, isReactive = !1;
11325 var binds = {};
11326 function applyBindingsObject(el, obj, original) {
11327 let cleanupRunners = [];
11328 for (;cleanupRunners.length; ) cleanupRunners.pop()();
11329 let attributes = Object.entries(obj).map((([name, value]) => ({
11330 name,
11331 value
11332 }))), staticAttributes = attributesOnly(attributes);
11333 return attributes = attributes.map((attribute => staticAttributes.find((attr => attr.name === attribute.name)) ? {
11334 name: `x-bind:${attribute.name}`,
11335 value: `"${attribute.value}"`
11336 } : attribute)), directives(el, attributes, original).map((handle => {
11337 cleanupRunners.push(handle.runCleanups), handle();
11338 })), () => {
11339 for (;cleanupRunners.length; ) cleanupRunners.pop()();
11340 };
11341 }
11342 var datas = {};
11343 var alpine_default = {
11344 get reactive() {
11345 return reactive;
11346 },
11347 get release() {
11348 return release;
11349 },
11350 get effect() {
11351 return effect;
11352 },
11353 get raw() {
11354 return raw;
11355 },
11356 version: "3.14.1",
11357 flushAndStopDeferringMutations: function() {
11358 isCollecting = !1, onMutate(deferredMutations), deferredMutations = [];
11359 },
11360 dontAutoEvaluateFunctions,
11361 disableEffectScheduling: function(callback) {
11362 shouldSchedule = !1, callback(), shouldSchedule = !0;
11363 },
11364 startObservingMutations,
11365 stopObservingMutations,
11366 setReactivityEngine: function(engine) {
11367 reactive = engine.reactive, release = engine.release, effect = callback => engine.effect(callback, {
11368 scheduler: task => {
11369 shouldSchedule ? scheduler(task) : task();
11370 }
11371 }), raw = engine.raw;
11372 },
11373 onAttributeRemoved,
11374 onAttributesAdded,
11375 closestDataStack,
11376 skipDuringClone,
11377 onlyDuringClone: function(callback) {
11378 return (...args) => isCloning && callback(...args);
11379 },
11380 addRootSelector,
11381 addInitSelector,
11382 interceptClone,
11383 addScopeToNode,
11384 deferMutations: function() {
11385 isCollecting = !0;
11386 },
11387 mapAttributes,
11388 evaluateLater,
11389 interceptInit: function(callback) {
11390 initInterceptors2.push(callback);
11391 },
11392 setEvaluator: function(newEvaluator) {
11393 theEvaluatorFunction = newEvaluator;
11394 },
11395 mergeProxies,
11396 extractProp: function(el, name, fallback, extract = !0) {
11397 if (el._x_bindings && void 0 !== el._x_bindings[name]) return el._x_bindings[name];
11398 if (el._x_inlineBindings && void 0 !== el._x_inlineBindings[name]) {
11399 let binding = el._x_inlineBindings[name];
11400 return binding.extract = extract, dontAutoEvaluateFunctions((() => evaluate(el, binding.expression)));
11401 }
11402 return getAttributeBinding(el, name, fallback);
11403 },
11404 findClosest,
11405 onElRemoved,
11406 closestRoot,
11407 destroyTree,
11408 interceptor,
11409 transition,
11410 setStyles,
11411 mutateDom,
11412 directive,
11413 entangle,
11414 throttle,
11415 debounce,
11416 evaluate,
11417 initTree,
11418 nextTick,
11419 prefixed: prefix,
11420 prefix: function(newPrefix) {
11421 prefixAsString = newPrefix;
11422 },
11423 plugin: function(callback) {
11424 (Array.isArray(callback) ? callback : [ callback ]).forEach((i => i(alpine_default)));
11425 },
11426 magic,
11427 store: function(name, value) {
11428 if (isReactive || (stores = reactive(stores), isReactive = !0), void 0 === value) return stores[name];
11429 stores[name] = value, "object" == typeof value && null !== value && value.hasOwnProperty("init") && "function" == typeof value.init && stores[name].init(),
11430 initInterceptors(stores[name]);
11431 },
11432 start: function() {
11433 var callback;
11434 document.body, dispatch(document, "alpine:init"), dispatch(document, "alpine:initializing"),
11435 startObservingMutations(), callback = el => initTree(el, walk), onElAddeds.push(callback),
11436 onElRemoved((el => destroyTree(el))), onAttributesAdded(((el, attrs) => {
11437 directives(el, attrs).forEach((handle => handle()));
11438 })), Array.from(document.querySelectorAll(allSelectors().join(","))).filter((el => !closestRoot(el.parentElement, !0))).forEach((el => {
11439 initTree(el);
11440 })), dispatch(document, "alpine:initialized"), setTimeout((() => {
11441 [ [ "ui", "dialog", [ "[x-dialog], [x-popover]" ] ], [ "anchor", "anchor", [ "[x-anchor]" ] ], [ "sort", "sort", [ "[x-sort]" ] ] ].forEach((([plugin2, directive2, selectors]) => {
11442 var name;
11443 name = directive2, Object.keys(directiveHandlers).includes(name) || selectors.some((selector => {
11444 if (document.querySelector(selector)) return !0;
11445 }));
11446 }));
11447 }));
11448 },
11449 clone: function(oldEl, newEl) {
11450 newEl._x_dataStack || (newEl._x_dataStack = oldEl._x_dataStack), isCloning = !0,
11451 isCloningLegacy = !0, dontRegisterReactiveSideEffects((() => {
11452 !function(el) {
11453 let hasRunThroughFirstEl = !1;
11454 initTree(el, ((el2, callback) => {
11455 walk(el2, ((el3, skip) => {
11456 if (hasRunThroughFirstEl && function(el) {
11457 return rootSelectors().some((selector => el.matches(selector)));
11458 }(el3)) return skip();
11459 hasRunThroughFirstEl = !0, callback(el3, skip);
11460 }));
11461 }));
11462 }(newEl);
11463 })), isCloning = !1, isCloningLegacy = !1;
11464 },
11465 cloneNode: function(from, to) {
11466 interceptors.forEach((i => i(from, to))), isCloning = !0, dontRegisterReactiveSideEffects((() => {
11467 initTree(to, ((el, callback) => {
11468 callback(el, (() => {}));
11469 }));
11470 })), isCloning = !1;
11471 },
11472 bound: function(el, name, fallback) {
11473 return el._x_bindings && void 0 !== el._x_bindings[name] ? el._x_bindings[name] : getAttributeBinding(el, name, fallback);
11474 },
11475 $data: scope,
11476 watch,
11477 walk,
11478 data: function(name, callback) {
11479 datas[name] = callback;
11480 },
11481 bind: function(name, bindings) {
11482 let getBindings = "function" != typeof bindings ? () => bindings : bindings;
11483 return name instanceof Element ? applyBindingsObject(name, getBindings()) : (binds[name] = getBindings,
11484 () => {});
11485 }
11486 };
11487 function makeMap(str, expectsLowerCase) {
11488 const map = Object.create(null), list = str.split(",");
11489 for (let i = 0; i < list.length; i++) map[list[i]] = !0;
11490 return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
11491 }
11492 var activeEffect, EMPTY_OBJ = Object.freeze({}), module_esm_hasOwnProperty = (Object.freeze([]),
11493 Object.prototype.hasOwnProperty), hasOwn = (val, key) => module_esm_hasOwnProperty.call(val, key), isArray = Array.isArray, isMap = val => "[object Map]" === toTypeString(val), isSymbol = val => "symbol" == typeof val, isObject = val => null !== val && "object" == typeof val, objectToString = Object.prototype.toString, toTypeString = value => objectToString.call(value), toRawType = value => toTypeString(value).slice(8, -1), isIntegerKey = key => "string" == typeof key && "NaN" !== key && "-" !== key[0] && "" + parseInt(key, 10) === key, cacheStringFunction = fn => {
11494 const cache = Object.create(null);
11495 return str => cache[str] || (cache[str] = fn(str));
11496 }, camelizeRE = /-(\w)/g, hyphenateRE = (cacheStringFunction((str => str.replace(camelizeRE, ((_, c) => c ? c.toUpperCase() : "")))),
11497 /\B([A-Z])/g), capitalize = (cacheStringFunction((str => str.replace(hyphenateRE, "-$1").toLowerCase())),
11498 cacheStringFunction((str => str.charAt(0).toUpperCase() + str.slice(1)))), hasChanged = (cacheStringFunction((str => str ? `on${capitalize(str)}` : "")),
11499 (value, oldValue) => value !== oldValue && (value == value || oldValue == oldValue)), targetMap = new WeakMap, effectStack = [], ITERATE_KEY = Symbol("iterate"), MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
11500 var uid = 0;
11501 function cleanup(effect3) {
11502 const {deps} = effect3;
11503 if (deps.length) {
11504 for (let i = 0; i < deps.length; i++) deps[i].delete(effect3);
11505 deps.length = 0;
11506 }
11507 }
11508 var shouldTrack = !0, trackStack = [];
11509 function resetTracking() {
11510 const last = trackStack.pop();
11511 shouldTrack = void 0 === last || last;
11512 }
11513 function track(target, type, key) {
11514 if (!shouldTrack || void 0 === activeEffect) return;
11515 let depsMap = targetMap.get(target);
11516 depsMap || targetMap.set(target, depsMap = new Map);
11517 let dep = depsMap.get(key);
11518 dep || depsMap.set(key, dep = new Set), dep.has(activeEffect) || (dep.add(activeEffect),
11519 activeEffect.deps.push(dep), activeEffect.options.onTrack && activeEffect.options.onTrack({
11520 effect: activeEffect,
11521 target,
11522 type,
11523 key
11524 }));
11525 }
11526 function trigger(target, type, key, newValue, oldValue, oldTarget) {
11527 const depsMap = targetMap.get(target);
11528 if (!depsMap) return;
11529 const effects = new Set, add2 = effectsToAdd => {
11530 effectsToAdd && effectsToAdd.forEach((effect3 => {
11531 (effect3 !== activeEffect || effect3.allowRecurse) && effects.add(effect3);
11532 }));
11533 };
11534 if ("clear" === type) depsMap.forEach(add2); else if ("length" === key && isArray(target)) depsMap.forEach(((dep, key2) => {
11535 ("length" === key2 || key2 >= newValue) && add2(dep);
11536 })); else switch (void 0 !== key && add2(depsMap.get(key)), type) {
11537 case "add":
11538 isArray(target) ? isIntegerKey(key) && add2(depsMap.get("length")) : (add2(depsMap.get(ITERATE_KEY)),
11539 isMap(target) && add2(depsMap.get(MAP_KEY_ITERATE_KEY)));
11540 break;
11541
11542 case "delete":
11543 isArray(target) || (add2(depsMap.get(ITERATE_KEY)), isMap(target) && add2(depsMap.get(MAP_KEY_ITERATE_KEY)));
11544 break;
11545
11546 case "set":
11547 isMap(target) && add2(depsMap.get(ITERATE_KEY));
11548 }
11549 effects.forEach((effect3 => {
11550 effect3.options.onTrigger && effect3.options.onTrigger({
11551 effect: effect3,
11552 target,
11553 key,
11554 type,
11555 newValue,
11556 oldValue,
11557 oldTarget
11558 }), effect3.options.scheduler ? effect3.options.scheduler(effect3) : effect3();
11559 }));
11560 }
11561 var isNonTrackableKeys = makeMap("__proto__,__v_isRef,__isVue"), builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key => Symbol[key])).filter(isSymbol)), get2 = createGetter(), readonlyGet = createGetter(!0), arrayInstrumentations = createArrayInstrumentations();
11562 function createArrayInstrumentations() {
11563 const instrumentations = {};
11564 return [ "includes", "indexOf", "lastIndexOf" ].forEach((key => {
11565 instrumentations[key] = function(...args) {
11566 const arr = toRaw(this);
11567 for (let i = 0, l = this.length; i < l; i++) track(arr, "get", i + "");
11568 const res = arr[key](...args);
11569 return -1 === res || !1 === res ? arr[key](...args.map(toRaw)) : res;
11570 };
11571 })), [ "push", "pop", "shift", "unshift", "splice" ].forEach((key => {
11572 instrumentations[key] = function(...args) {
11573 trackStack.push(shouldTrack), shouldTrack = !1;
11574 const res = toRaw(this)[key].apply(this, args);
11575 return resetTracking(), res;
11576 };
11577 })), instrumentations;
11578 }
11579 function createGetter(isReadonly = !1, shallow = !1) {
11580 return function(target, key, receiver) {
11581 if ("__v_isReactive" === key) return !isReadonly;
11582 if ("__v_isReadonly" === key) return isReadonly;
11583 if ("__v_raw" === key && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) return target;
11584 const targetIsArray = isArray(target);
11585 if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) return Reflect.get(arrayInstrumentations, key, receiver);
11586 const res = Reflect.get(target, key, receiver);
11587 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) return res;
11588 if (isReadonly || track(target, "get", key), shallow) return res;
11589 if (isRef(res)) {
11590 return !targetIsArray || !isIntegerKey(key) ? res.value : res;
11591 }
11592 return isObject(res) ? isReadonly ? readonly(res) : reactive2(res) : res;
11593 };
11594 }
11595 function createSetter(shallow = !1) {
11596 return function(target, key, value, receiver) {
11597 let oldValue = target[key];
11598 if (!shallow && (value = toRaw(value), oldValue = toRaw(oldValue), !isArray(target) && isRef(oldValue) && !isRef(value))) return oldValue.value = value,
11599 !0;
11600 const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key), result = Reflect.set(target, key, value, receiver);
11601 return target === toRaw(receiver) && (hadKey ? hasChanged(value, oldValue) && trigger(target, "set", key, value, oldValue) : trigger(target, "add", key, value)),
11602 result;
11603 };
11604 }
11605 var mutableHandlers = {
11606 get: get2,
11607 set: createSetter(),
11608 deleteProperty: function(target, key) {
11609 const hadKey = hasOwn(target, key), oldValue = target[key], result = Reflect.deleteProperty(target, key);
11610 return result && hadKey && trigger(target, "delete", key, void 0, oldValue), result;
11611 },
11612 has: function(target, key) {
11613 const result = Reflect.has(target, key);
11614 return isSymbol(key) && builtInSymbols.has(key) || track(target, "has", key), result;
11615 },
11616 ownKeys: function(target) {
11617 return track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY), Reflect.ownKeys(target);
11618 }
11619 }, readonlyHandlers = {
11620 get: readonlyGet,
11621 set: (target, key) => !0,
11622 deleteProperty: (target, key) => !0
11623 }, toReactive = value => isObject(value) ? reactive2(value) : value, toReadonly = value => isObject(value) ? readonly(value) : value, toShallow = value => value, getProto = v => Reflect.getPrototypeOf(v);
11624 function get$1(target, key, isReadonly = !1, isShallow = !1) {
11625 const rawTarget = toRaw(target = target.__v_raw), rawKey = toRaw(key);
11626 key !== rawKey && !isReadonly && track(rawTarget, "get", key), !isReadonly && track(rawTarget, "get", rawKey);
11627 const {has: has2} = getProto(rawTarget), wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
11628 return has2.call(rawTarget, key) ? wrap(target.get(key)) : has2.call(rawTarget, rawKey) ? wrap(target.get(rawKey)) : void (target !== rawTarget && target.get(key));
11629 }
11630 function has$1(key, isReadonly = !1) {
11631 const target = this.__v_raw, rawTarget = toRaw(target), rawKey = toRaw(key);
11632 return key !== rawKey && !isReadonly && track(rawTarget, "has", key), !isReadonly && track(rawTarget, "has", rawKey),
11633 key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
11634 }
11635 function size(target, isReadonly = !1) {
11636 return target = target.__v_raw, !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY),
11637 Reflect.get(target, "size", target);
11638 }
11639 function add(value) {
11640 value = toRaw(value);
11641 const target = toRaw(this);
11642 return getProto(target).has.call(target, value) || (target.add(value), trigger(target, "add", value, value)),
11643 this;
11644 }
11645 function set$1(key, value) {
11646 value = toRaw(value);
11647 const target = toRaw(this), {has: has2, get: get3} = getProto(target);
11648 let hadKey = has2.call(target, key);
11649 hadKey ? checkIdentityKeys(target, has2, key) : (key = toRaw(key), hadKey = has2.call(target, key));
11650 const oldValue = get3.call(target, key);
11651 return target.set(key, value), hadKey ? hasChanged(value, oldValue) && trigger(target, "set", key, value, oldValue) : trigger(target, "add", key, value),
11652 this;
11653 }
11654 function deleteEntry(key) {
11655 const target = toRaw(this), {has: has2, get: get3} = getProto(target);
11656 let hadKey = has2.call(target, key);
11657 hadKey ? checkIdentityKeys(target, has2, key) : (key = toRaw(key), hadKey = has2.call(target, key));
11658 const oldValue = get3 ? get3.call(target, key) : void 0, result = target.delete(key);
11659 return hadKey && trigger(target, "delete", key, void 0, oldValue), result;
11660 }
11661 function clear() {
11662 const target = toRaw(this), hadItems = 0 !== target.size, oldTarget = isMap(target) ? new Map(target) : new Set(target), result = target.clear();
11663 return hadItems && trigger(target, "clear", void 0, void 0, oldTarget), result;
11664 }
11665 function createForEach(isReadonly, isShallow) {
11666 return function(callback, thisArg) {
11667 const observed = this, target = observed.__v_raw, rawTarget = toRaw(target), wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
11668 return !isReadonly && track(rawTarget, "iterate", ITERATE_KEY), target.forEach(((value, key) => callback.call(thisArg, wrap(value), wrap(key), observed)));
11669 };
11670 }
11671 function createIterableMethod(method, isReadonly, isShallow) {
11672 return function(...args) {
11673 const target = this.__v_raw, rawTarget = toRaw(target), targetIsMap = isMap(rawTarget), isPair = "entries" === method || method === Symbol.iterator && targetIsMap, isKeyOnly = "keys" === method && targetIsMap, innerIterator = target[method](...args), wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
11674 return !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY),
11675 {
11676 next() {
11677 const {value, done} = innerIterator.next();
11678 return done ? {
11679 value,
11680 done
11681 } : {
11682 value: isPair ? [ wrap(value[0]), wrap(value[1]) ] : wrap(value),
11683 done
11684 };
11685 },
11686 [Symbol.iterator]() {
11687 return this;
11688 }
11689 };
11690 };
11691 }
11692 function createReadonlyMethod(type) {
11693 return function(...args) {
11694 args[0] && args[0];
11695 return "delete" !== type && this;
11696 };
11697 }
11698 function createInstrumentations() {
11699 const mutableInstrumentations2 = {
11700 get(key) {
11701 return get$1(this, key);
11702 },
11703 get size() {
11704 return size(this);
11705 },
11706 has: has$1,
11707 add,
11708 set: set$1,
11709 delete: deleteEntry,
11710 clear,
11711 forEach: createForEach(!1, !1)
11712 }, shallowInstrumentations2 = {
11713 get(key) {
11714 return get$1(this, key, !1, !0);
11715 },
11716 get size() {
11717 return size(this);
11718 },
11719 has: has$1,
11720 add,
11721 set: set$1,
11722 delete: deleteEntry,
11723 clear,
11724 forEach: createForEach(!1, !0)
11725 }, readonlyInstrumentations2 = {
11726 get(key) {
11727 return get$1(this, key, !0);
11728 },
11729 get size() {
11730 return size(this, !0);
11731 },
11732 has(key) {
11733 return has$1.call(this, key, !0);
11734 },
11735 add: createReadonlyMethod("add"),
11736 set: createReadonlyMethod("set"),
11737 delete: createReadonlyMethod("delete"),
11738 clear: createReadonlyMethod("clear"),
11739 forEach: createForEach(!0, !1)
11740 }, shallowReadonlyInstrumentations2 = {
11741 get(key) {
11742 return get$1(this, key, !0, !0);
11743 },
11744 get size() {
11745 return size(this, !0);
11746 },
11747 has(key) {
11748 return has$1.call(this, key, !0);
11749 },
11750 add: createReadonlyMethod("add"),
11751 set: createReadonlyMethod("set"),
11752 delete: createReadonlyMethod("delete"),
11753 clear: createReadonlyMethod("clear"),
11754 forEach: createForEach(!0, !0)
11755 };
11756 return [ "keys", "values", "entries", Symbol.iterator ].forEach((method => {
11757 mutableInstrumentations2[method] = createIterableMethod(method, !1, !1), readonlyInstrumentations2[method] = createIterableMethod(method, !0, !1),
11758 shallowInstrumentations2[method] = createIterableMethod(method, !1, !0), shallowReadonlyInstrumentations2[method] = createIterableMethod(method, !0, !0);
11759 })), [ mutableInstrumentations2, readonlyInstrumentations2, shallowInstrumentations2, shallowReadonlyInstrumentations2 ];
11760 }
11761 var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = createInstrumentations();
11762 function createInstrumentationGetter(isReadonly, shallow) {
11763 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
11764 return (target, key, receiver) => "__v_isReactive" === key ? !isReadonly : "__v_isReadonly" === key ? isReadonly : "__v_raw" === key ? target : Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
11765 }
11766 var mutableCollectionHandlers = {
11767 get: createInstrumentationGetter(!1, !1)
11768 }, readonlyCollectionHandlers = {
11769 get: createInstrumentationGetter(!0, !1)
11770 };
11771 function checkIdentityKeys(target, has2, key) {
11772 const rawKey = toRaw(key);
11773 if (rawKey !== key && has2.call(target, rawKey)) {
11774 toRawType(target);
11775 }
11776 }
11777 var reactiveMap = new WeakMap, shallowReactiveMap = new WeakMap, readonlyMap = new WeakMap, shallowReadonlyMap = new WeakMap;
11778 function reactive2(target) {
11779 return target && target.__v_isReadonly ? target : createReactiveObject(target, !1, mutableHandlers, mutableCollectionHandlers, reactiveMap);
11780 }
11781 function readonly(target) {
11782 return createReactiveObject(target, !0, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
11783 }
11784 function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
11785 if (!isObject(target)) return target;
11786 if (target.__v_raw && (!isReadonly || !target.__v_isReactive)) return target;
11787 const existingProxy = proxyMap.get(target);
11788 if (existingProxy) return existingProxy;
11789 const targetType = (value = target).__v_skip || !Object.isExtensible(value) ? 0 : function(rawType) {
11790 switch (rawType) {
11791 case "Object":
11792 case "Array":
11793 return 1;
11794
11795 case "Map":
11796 case "Set":
11797 case "WeakMap":
11798 case "WeakSet":
11799 return 2;
11800
11801 default:
11802 return 0;
11803 }
11804 }(toRawType(value));
11805 var value;
11806 if (0 === targetType) return target;
11807 const proxy = new Proxy(target, 2 === targetType ? collectionHandlers : baseHandlers);
11808 return proxyMap.set(target, proxy), proxy;
11809 }
11810 function toRaw(observed) {
11811 return observed && toRaw(observed.__v_raw) || observed;
11812 }
11813 function isRef(r) {
11814 return Boolean(r && !0 === r.__v_isRef);
11815 }
11816 magic("nextTick", (() => nextTick)), magic("dispatch", (el => dispatch.bind(dispatch, el))),
11817 magic("watch", ((el, {evaluateLater: evaluateLater2, cleanup: cleanup2}) => (key, callback) => {
11818 let evaluate2 = evaluateLater2(key), unwatch = watch((() => {
11819 let value;
11820 return evaluate2((i => value = i)), value;
11821 }), callback);
11822 cleanup2(unwatch);
11823 })), magic("store", (function() {
11824 return stores;
11825 })), magic("data", (el => scope(el))), magic("root", (el => closestRoot(el))), magic("refs", (el => (el._x_refs_proxy || (el._x_refs_proxy = mergeProxies(function(el) {
11826 let refObjects = [];
11827 return findClosest(el, (i => {
11828 i._x_refs && refObjects.push(i._x_refs);
11829 })), refObjects;
11830 }(el))), el._x_refs_proxy)));
11831 var globalIdMemo = {};
11832 function findAndIncrementId(name) {
11833 return globalIdMemo[name] || (globalIdMemo[name] = 0), ++globalIdMemo[name];
11834 }
11835 function warnMissingPluginMagic(name, magicName, slug) {
11836 magic(magicName, (el => {}));
11837 }
11838 magic("id", ((el, {cleanup: cleanup2}) => (name, key = null) => function(el, cacheKey, cleanup2, callback) {
11839 el._x_id || (el._x_id = {});
11840 if (el._x_id[cacheKey]) return el._x_id[cacheKey];
11841 let output = callback();
11842 return el._x_id[cacheKey] = output, cleanup2((() => {
11843 delete el._x_id[cacheKey];
11844 })), output;
11845 }(el, `${name}${key ? `-${key}` : ""}`, cleanup2, (() => {
11846 let root = function(el, name) {
11847 return findClosest(el, (element => {
11848 if (element._x_ids && element._x_ids[name]) return !0;
11849 }));
11850 }(el, name), id = root ? root._x_ids[name] : findAndIncrementId(name);
11851 return key ? `${name}-${id}-${key}` : `${name}-${id}`;
11852 })))), interceptClone(((from, to) => {
11853 from._x_id && (to._x_id = from._x_id);
11854 })), magic("el", (el => el)), warnMissingPluginMagic("Focus", "focus", "focus"),
11855 warnMissingPluginMagic("Persist", "persist", "persist"), directive("modelable", ((el, {expression}, {effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2}) => {
11856 let func = evaluateLater2(expression), innerGet = () => {
11857 let result;
11858 return func((i => result = i)), result;
11859 }, evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`), innerSet = val => evaluateInnerSet((() => {}), {
11860 scope: {
11861 __placeholder: val
11862 }
11863 }), initialValue = innerGet();
11864 innerSet(initialValue), queueMicrotask((() => {
11865 if (!el._x_model) return;
11866 el._x_removeModelListeners.default();
11867 let outerGet = el._x_model.get, outerSet = el._x_model.set, releaseEntanglement = entangle({
11868 get: () => outerGet(),
11869 set(value) {
11870 outerSet(value);
11871 }
11872 }, {
11873 get: () => innerGet(),
11874 set(value) {
11875 innerSet(value);
11876 }
11877 });
11878 cleanup2(releaseEntanglement);
11879 }));
11880 })), directive("teleport", ((el, {modifiers, expression}, {cleanup: cleanup2}) => {
11881 el.tagName.toLowerCase();
11882 let target = getTarget(expression), clone2 = el.content.cloneNode(!0).firstElementChild;
11883 el._x_teleport = clone2, clone2._x_teleportBack = el, el.setAttribute("data-teleport-template", !0),
11884 clone2.setAttribute("data-teleport-target", !0), el._x_forwardEvents && el._x_forwardEvents.forEach((eventName => {
11885 clone2.addEventListener(eventName, (e => {
11886 e.stopPropagation(), el.dispatchEvent(new e.constructor(e.type, e));
11887 }));
11888 })), addScopeToNode(clone2, {}, el);
11889 let placeInDom = (clone3, target2, modifiers2) => {
11890 modifiers2.includes("prepend") ? target2.parentNode.insertBefore(clone3, target2) : modifiers2.includes("append") ? target2.parentNode.insertBefore(clone3, target2.nextSibling) : target2.appendChild(clone3);
11891 };
11892 mutateDom((() => {
11893 placeInDom(clone2, target, modifiers), skipDuringClone((() => {
11894 initTree(clone2), clone2._x_ignore = !0;
11895 }))();
11896 })), el._x_teleportPutBack = () => {
11897 let target2 = getTarget(expression);
11898 mutateDom((() => {
11899 placeInDom(el._x_teleport, target2, modifiers);
11900 }));
11901 }, cleanup2((() => clone2.remove()));
11902 }));
11903 var teleportContainerDuringClone = document.createElement("div");
11904 function getTarget(expression) {
11905 let target = skipDuringClone((() => document.querySelector(expression)), (() => teleportContainerDuringClone))();
11906 return target;
11907 }
11908 var handler = () => {};
11909 function module_esm_on(el, event, modifiers, callback) {
11910 let listenerTarget = el, handler4 = e => callback(e), options = {}, wrapHandler = (callback2, wrapper) => e => wrapper(callback2, e);
11911 if (modifiers.includes("dot") && (event = event.replace(/-/g, ".")), modifiers.includes("camel") && (event = function(subject) {
11912 return subject.toLowerCase().replace(/-(\w)/g, ((match, char) => char.toUpperCase()));
11913 }(event)), modifiers.includes("passive") && (options.passive = !0), modifiers.includes("capture") && (options.capture = !0),
11914 modifiers.includes("window") && (listenerTarget = window), modifiers.includes("document") && (listenerTarget = document),
11915 modifiers.includes("debounce")) {
11916 let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait", wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
11917 handler4 = debounce(handler4, wait);
11918 }
11919 if (modifiers.includes("throttle")) {
11920 let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait", wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
11921 handler4 = throttle(handler4, wait);
11922 }
11923 return modifiers.includes("prevent") && (handler4 = wrapHandler(handler4, ((next, e) => {
11924 e.preventDefault(), next(e);
11925 }))), modifiers.includes("stop") && (handler4 = wrapHandler(handler4, ((next, e) => {
11926 e.stopPropagation(), next(e);
11927 }))), modifiers.includes("once") && (handler4 = wrapHandler(handler4, ((next, e) => {
11928 next(e), listenerTarget.removeEventListener(event, handler4, options);
11929 }))), (modifiers.includes("away") || modifiers.includes("outside")) && (listenerTarget = document,
11930 handler4 = wrapHandler(handler4, ((next, e) => {
11931 el.contains(e.target) || !1 !== e.target.isConnected && (el.offsetWidth < 1 && el.offsetHeight < 1 || !1 !== el._x_isShown && next(e));
11932 }))), modifiers.includes("self") && (handler4 = wrapHandler(handler4, ((next, e) => {
11933 e.target === el && next(e);
11934 }))), (function(event) {
11935 return [ "keydown", "keyup" ].includes(event);
11936 }(event) || isClickEvent(event)) && (handler4 = wrapHandler(handler4, ((next, e) => {
11937 (function(e, modifiers) {
11938 let keyModifiers = modifiers.filter((i => ![ "window", "document", "prevent", "stop", "once", "capture", "self", "away", "outside", "passive" ].includes(i)));
11939 if (keyModifiers.includes("debounce")) {
11940 let debounceIndex = keyModifiers.indexOf("debounce");
11941 keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
11942 }
11943 if (keyModifiers.includes("throttle")) {
11944 let debounceIndex = keyModifiers.indexOf("throttle");
11945 keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
11946 }
11947 if (0 === keyModifiers.length) return !1;
11948 if (1 === keyModifiers.length && keyToModifiers(e.key).includes(keyModifiers[0])) return !1;
11949 const selectedSystemKeyModifiers = [ "ctrl", "shift", "alt", "meta", "cmd", "super" ].filter((modifier => keyModifiers.includes(modifier)));
11950 if (keyModifiers = keyModifiers.filter((i => !selectedSystemKeyModifiers.includes(i))),
11951 selectedSystemKeyModifiers.length > 0) {
11952 if (selectedSystemKeyModifiers.filter((modifier => ("cmd" !== modifier && "super" !== modifier || (modifier = "meta"),
11953 e[`${modifier}Key`]))).length === selectedSystemKeyModifiers.length) {
11954 if (isClickEvent(e.type)) return !1;
11955 if (keyToModifiers(e.key).includes(keyModifiers[0])) return !1;
11956 }
11957 }
11958 return !0;
11959 })(e, modifiers) || next(e);
11960 }))), listenerTarget.addEventListener(event, handler4, options), () => {
11961 listenerTarget.removeEventListener(event, handler4, options);
11962 };
11963 }
11964 function isNumeric(subject) {
11965 return !Array.isArray(subject) && !isNaN(subject);
11966 }
11967 function isClickEvent(event) {
11968 return [ "contextmenu", "click", "mouse" ].some((i => event.includes(i)));
11969 }
11970 function keyToModifiers(key) {
11971 if (!key) return [];
11972 var subject;
11973 key = [ " ", "_" ].includes(subject = key) ? subject : subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
11974 let modifierToKeyMap = {
11975 ctrl: "control",
11976 slash: "/",
11977 space: " ",
11978 spacebar: " ",
11979 cmd: "meta",
11980 esc: "escape",
11981 up: "arrow-up",
11982 down: "arrow-down",
11983 left: "arrow-left",
11984 right: "arrow-right",
11985 period: ".",
11986 comma: ",",
11987 equal: "=",
11988 minus: "-",
11989 underscore: "_"
11990 };
11991 return modifierToKeyMap[key] = key, Object.keys(modifierToKeyMap).map((modifier => {
11992 if (modifierToKeyMap[modifier] === key) return modifier;
11993 })).filter((modifier => modifier));
11994 }
11995 function getInputValue(el, modifiers, event, currentValue) {
11996 return mutateDom((() => {
11997 if (event instanceof CustomEvent && void 0 !== event.detail) return null !== event.detail && void 0 !== event.detail ? event.detail : event.target.value;
11998 if ("checkbox" === el.type) {
11999 if (Array.isArray(currentValue)) {
12000 let newValue = null;
12001 return newValue = modifiers.includes("number") ? safeParseNumber(event.target.value) : modifiers.includes("boolean") ? safeParseBoolean(event.target.value) : event.target.value,
12002 event.target.checked ? currentValue.includes(newValue) ? currentValue : currentValue.concat([ newValue ]) : currentValue.filter((el2 => !(el2 == newValue)));
12003 }
12004 return event.target.checked;
12005 }
12006 if ("select" === el.tagName.toLowerCase() && el.multiple) return modifiers.includes("number") ? Array.from(event.target.selectedOptions).map((option => safeParseNumber(option.value || option.text))) : modifiers.includes("boolean") ? Array.from(event.target.selectedOptions).map((option => safeParseBoolean(option.value || option.text))) : Array.from(event.target.selectedOptions).map((option => option.value || option.text));
12007 {
12008 let newValue;
12009 return newValue = "radio" === el.type ? event.target.checked ? event.target.value : currentValue : event.target.value,
12010 modifiers.includes("number") ? safeParseNumber(newValue) : modifiers.includes("boolean") ? safeParseBoolean(newValue) : modifiers.includes("trim") ? newValue.trim() : newValue;
12011 }
12012 }));
12013 }
12014 function safeParseNumber(rawValue) {
12015 let number = rawValue ? parseFloat(rawValue) : null;
12016 return subject = number, Array.isArray(subject) || isNaN(subject) ? rawValue : number;
12017 var subject;
12018 }
12019 function isGetterSetter(value) {
12020 return null !== value && "object" == typeof value && "function" == typeof value.get && "function" == typeof value.set;
12021 }
12022 handler.inline = (el, {modifiers}, {cleanup: cleanup2}) => {
12023 modifiers.includes("self") ? el._x_ignoreSelf = !0 : el._x_ignore = !0, cleanup2((() => {
12024 modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore;
12025 }));
12026 }, directive("ignore", handler), directive("effect", skipDuringClone(((el, {expression}, {effect: effect3}) => {
12027 effect3(evaluateLater(el, expression));
12028 }))), directive("model", ((el, {modifiers, expression}, {effect: effect3, cleanup: cleanup2}) => {
12029 let scopeTarget = el;
12030 modifiers.includes("parent") && (scopeTarget = el.parentNode);
12031 let evaluateSet, evaluateGet = evaluateLater(scopeTarget, expression);
12032 evaluateSet = "string" == typeof expression ? evaluateLater(scopeTarget, `${expression} = __placeholder`) : "function" == typeof expression && "string" == typeof expression() ? evaluateLater(scopeTarget, `${expression()} = __placeholder`) : () => {};
12033 let getValue = () => {
12034 let result;
12035 return evaluateGet((value => result = value)), isGetterSetter(result) ? result.get() : result;
12036 }, setValue = value => {
12037 let result;
12038 evaluateGet((value2 => result = value2)), isGetterSetter(result) ? result.set(value) : evaluateSet((() => {}), {
12039 scope: {
12040 __placeholder: value
12041 }
12042 });
12043 };
12044 "string" == typeof expression && "radio" === el.type && mutateDom((() => {
12045 el.hasAttribute("name") || el.setAttribute("name", expression);
12046 }));
12047 var event = "select" === el.tagName.toLowerCase() || [ "checkbox", "radio" ].includes(el.type) || modifiers.includes("lazy") ? "change" : "input";
12048 let removeListener = isCloning ? () => {} : module_esm_on(el, event, modifiers, (e => {
12049 setValue(getInputValue(el, modifiers, e, getValue()));
12050 }));
12051 if (modifiers.includes("fill") && ([ void 0, null, "" ].includes(getValue()) || "checkbox" === el.type && Array.isArray(getValue()) || "select" === el.tagName.toLowerCase() && el.multiple) && setValue(getInputValue(el, modifiers, {
12052 target: el
12053 }, getValue())), el._x_removeModelListeners || (el._x_removeModelListeners = {}),
12054 el._x_removeModelListeners.default = removeListener, cleanup2((() => el._x_removeModelListeners.default())),
12055 el.form) {
12056 let removeResetListener = module_esm_on(el.form, "reset", [], (e => {
12057 nextTick((() => el._x_model && el._x_model.set(getInputValue(el, modifiers, {
12058 target: el
12059 }, getValue()))));
12060 }));
12061 cleanup2((() => removeResetListener()));
12062 }
12063 el._x_model = {
12064 get: () => getValue(),
12065 set(value) {
12066 setValue(value);
12067 }
12068 }, el._x_forceModelUpdate = value => {
12069 void 0 === value && "string" == typeof expression && expression.match(/\./) && (value = ""),
12070 window.fromModel = !0, mutateDom((() => bind(el, "value", value))), delete window.fromModel;
12071 }, effect3((() => {
12072 let value = getValue();
12073 modifiers.includes("unintrusive") && document.activeElement.isSameNode(el) || el._x_forceModelUpdate(value);
12074 }));
12075 })), directive("cloak", (el => queueMicrotask((() => mutateDom((() => el.removeAttribute(prefix("cloak")))))))),
12076 addInitSelector((() => `[${prefix("init")}]`)), directive("init", skipDuringClone(((el, {expression}, {evaluate: evaluate2}) => "string" == typeof expression ? !!expression.trim() && evaluate2(expression, {}, !1) : evaluate2(expression, {}, !1)))),
12077 directive("text", ((el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
12078 let evaluate2 = evaluateLater2(expression);
12079 effect3((() => {
12080 evaluate2((value => {
12081 mutateDom((() => {
12082 el.textContent = value;
12083 }));
12084 }));
12085 }));
12086 })), directive("html", ((el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
12087 let evaluate2 = evaluateLater2(expression);
12088 effect3((() => {
12089 evaluate2((value => {
12090 mutateDom((() => {
12091 el.innerHTML = value, el._x_ignoreSelf = !0, initTree(el), delete el._x_ignoreSelf;
12092 }));
12093 }));
12094 }));
12095 })), mapAttributes(startingWith(":", prefix("bind:")));
12096 var handler2 = (el, {value, modifiers, expression, original}, {effect: effect3, cleanup: cleanup2}) => {
12097 if (!value) {
12098 let bindingProviders = {};
12099 return obj = bindingProviders, Object.entries(binds).forEach((([name, callback]) => {
12100 Object.defineProperty(obj, name, {
12101 get: () => (...args) => callback(...args)
12102 });
12103 })), void evaluateLater(el, expression)((bindings => {
12104 applyBindingsObject(el, bindings, original);
12105 }), {
12106 scope: bindingProviders
12107 });
12108 }
12109 var obj;
12110 if ("key" === value) return function(el, expression) {
12111 el._x_keyExpression = expression;
12112 }(el, expression);
12113 if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) return;
12114 let evaluate2 = evaluateLater(el, expression);
12115 effect3((() => evaluate2((result => {
12116 void 0 === result && "string" == typeof expression && expression.match(/\./) && (result = ""),
12117 mutateDom((() => bind(el, value, result, modifiers)));
12118 })))), cleanup2((() => {
12119 el._x_undoAddedClasses && el._x_undoAddedClasses(), el._x_undoAddedStyles && el._x_undoAddedStyles();
12120 }));
12121 };
12122 function getIterationScopeVariables(iteratorNames, item, index, items) {
12123 let scopeVariables = {};
12124 if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) {
12125 iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i => i.trim())).forEach(((name, i) => {
12126 scopeVariables[name] = item[i];
12127 }));
12128 } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && "object" == typeof item) {
12129 iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i => i.trim())).forEach((name => {
12130 scopeVariables[name] = item[name];
12131 }));
12132 } else scopeVariables[iteratorNames.item] = item;
12133 return iteratorNames.index && (scopeVariables[iteratorNames.index] = index), iteratorNames.collection && (scopeVariables[iteratorNames.collection] = items),
12134 scopeVariables;
12135 }
12136 function handler3() {}
12137 function warnMissingPluginDirective(name, directiveName, slug) {
12138 directive(directiveName, (el => {}));
12139 }
12140 handler2.inline = (el, {value, modifiers, expression}) => {
12141 value && (el._x_inlineBindings || (el._x_inlineBindings = {}), el._x_inlineBindings[value] = {
12142 expression,
12143 extract: !1
12144 });
12145 }, directive("bind", handler2), addRootSelector((() => `[${prefix("data")}]`)),
12146 directive("data", ((el, {expression}, {cleanup: cleanup2}) => {
12147 if (function(el) {
12148 return !!isCloning && (!!isCloningLegacy || el.hasAttribute("data-has-alpine-state"));
12149 }(el)) return;
12150 expression = "" === expression ? "{}" : expression;
12151 let magicContext = {};
12152 injectMagics(magicContext, el);
12153 let dataProviderContext = {};
12154 var obj, context;
12155 obj = dataProviderContext, context = magicContext, Object.entries(datas).forEach((([name, callback]) => {
12156 Object.defineProperty(obj, name, {
12157 get: () => (...args) => callback.bind(context)(...args),
12158 enumerable: !1
12159 });
12160 }));
12161 let data2 = evaluate(el, expression, {
12162 scope: dataProviderContext
12163 });
12164 void 0 !== data2 && !0 !== data2 || (data2 = {}), injectMagics(data2, el);
12165 let reactiveData = reactive(data2);
12166 initInterceptors(reactiveData);
12167 let undo = addScopeToNode(el, reactiveData);
12168 reactiveData.init && evaluate(el, reactiveData.init), cleanup2((() => {
12169 reactiveData.destroy && evaluate(el, reactiveData.destroy), undo();
12170 }));
12171 })), interceptClone(((from, to) => {
12172 from._x_dataStack && (to._x_dataStack = from._x_dataStack, to.setAttribute("data-has-alpine-state", !0));
12173 })), directive("show", ((el, {modifiers, expression}, {effect: effect3}) => {
12174 let evaluate2 = evaluateLater(el, expression);
12175 el._x_doHide || (el._x_doHide = () => {
12176 mutateDom((() => {
12177 el.style.setProperty("display", "none", modifiers.includes("important") ? "important" : void 0);
12178 }));
12179 }), el._x_doShow || (el._x_doShow = () => {
12180 mutateDom((() => {
12181 1 === el.style.length && "none" === el.style.display ? el.removeAttribute("style") : el.style.removeProperty("display");
12182 }));
12183 });
12184 let oldValue, hide = () => {
12185 el._x_doHide(), el._x_isShown = !1;
12186 }, show = () => {
12187 el._x_doShow(), el._x_isShown = !0;
12188 }, clickAwayCompatibleShow = () => setTimeout(show), toggle = once((value => value ? show() : hide()), (value => {
12189 "function" == typeof el._x_toggleAndCascadeWithTransitions ? el._x_toggleAndCascadeWithTransitions(el, value, show, hide) : value ? clickAwayCompatibleShow() : hide();
12190 })), firstTime = !0;
12191 effect3((() => evaluate2((value => {
12192 (firstTime || value !== oldValue) && (modifiers.includes("immediate") && (value ? clickAwayCompatibleShow() : hide()),
12193 toggle(value), oldValue = value, firstTime = !1);
12194 }))));
12195 })), directive("for", ((el, {expression}, {effect: effect3, cleanup: cleanup2}) => {
12196 let iteratorNames = function(expression) {
12197 let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/, stripParensRE = /^\s*\(|\)\s*$/g, forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/, inMatch = expression.match(forAliasRE);
12198 if (!inMatch) return;
12199 let res = {};
12200 res.items = inMatch[2].trim();
12201 let item = inMatch[1].replace(stripParensRE, "").trim(), iteratorMatch = item.match(forIteratorRE);
12202 iteratorMatch ? (res.item = item.replace(forIteratorRE, "").trim(), res.index = iteratorMatch[1].trim(),
12203 iteratorMatch[2] && (res.collection = iteratorMatch[2].trim())) : res.item = item;
12204 return res;
12205 }(expression), evaluateItems = evaluateLater(el, iteratorNames.items), evaluateKey = evaluateLater(el, el._x_keyExpression || "index");
12206 el._x_prevKeys = [], el._x_lookup = {}, effect3((() => function(el, iteratorNames, evaluateItems, evaluateKey) {
12207 let isObject2 = i => "object" == typeof i && !Array.isArray(i), templateEl = el;
12208 evaluateItems((items => {
12209 var subject;
12210 subject = items, !Array.isArray(subject) && !isNaN(subject) && items >= 0 && (items = Array.from(Array(items).keys(), (i => i + 1))),
12211 void 0 === items && (items = []);
12212 let lookup = el._x_lookup, prevKeys = el._x_prevKeys, scopes = [], keys = [];
12213 if (isObject2(items)) items = Object.entries(items).map((([key, value]) => {
12214 let scope2 = getIterationScopeVariables(iteratorNames, value, key, items);
12215 evaluateKey((value2 => {
12216 keys.includes(value2), keys.push(value2);
12217 }), {
12218 scope: {
12219 index: key,
12220 ...scope2
12221 }
12222 }), scopes.push(scope2);
12223 })); else for (let i = 0; i < items.length; i++) {
12224 let scope2 = getIterationScopeVariables(iteratorNames, items[i], i, items);
12225 evaluateKey((value => {
12226 keys.includes(value), keys.push(value);
12227 }), {
12228 scope: {
12229 index: i,
12230 ...scope2
12231 }
12232 }), scopes.push(scope2);
12233 }
12234 let adds = [], moves = [], removes = [], sames = [];
12235 for (let i = 0; i < prevKeys.length; i++) {
12236 let key = prevKeys[i];
12237 -1 === keys.indexOf(key) && removes.push(key);
12238 }
12239 prevKeys = prevKeys.filter((key => !removes.includes(key)));
12240 let lastKey = "template";
12241 for (let i = 0; i < keys.length; i++) {
12242 let key = keys[i], prevIndex = prevKeys.indexOf(key);
12243 if (-1 === prevIndex) prevKeys.splice(i, 0, key), adds.push([ lastKey, i ]); else if (prevIndex !== i) {
12244 let keyInSpot = prevKeys.splice(i, 1)[0], keyForSpot = prevKeys.splice(prevIndex - 1, 1)[0];
12245 prevKeys.splice(i, 0, keyForSpot), prevKeys.splice(prevIndex, 0, keyInSpot), moves.push([ keyInSpot, keyForSpot ]);
12246 } else sames.push(key);
12247 lastKey = key;
12248 }
12249 for (let i = 0; i < removes.length; i++) {
12250 let key = removes[i];
12251 lookup[key]._x_effects && lookup[key]._x_effects.forEach(dequeueJob), lookup[key].remove(),
12252 lookup[key] = null, delete lookup[key];
12253 }
12254 for (let i = 0; i < moves.length; i++) {
12255 let [keyInSpot, keyForSpot] = moves[i], elInSpot = lookup[keyInSpot], elForSpot = lookup[keyForSpot], marker = document.createElement("div");
12256 mutateDom((() => {
12257 elForSpot.after(marker), elInSpot.after(elForSpot), elForSpot._x_currentIfEl && elForSpot.after(elForSpot._x_currentIfEl),
12258 marker.before(elInSpot), elInSpot._x_currentIfEl && elInSpot.after(elInSpot._x_currentIfEl),
12259 marker.remove();
12260 })), elForSpot._x_refreshXForScope(scopes[keys.indexOf(keyForSpot)]);
12261 }
12262 for (let i = 0; i < adds.length; i++) {
12263 let [lastKey2, index] = adds[i], lastEl = "template" === lastKey2 ? templateEl : lookup[lastKey2];
12264 lastEl._x_currentIfEl && (lastEl = lastEl._x_currentIfEl);
12265 let scope2 = scopes[index], key = keys[index], clone2 = document.importNode(templateEl.content, !0).firstElementChild, reactiveScope = reactive(scope2);
12266 addScopeToNode(clone2, reactiveScope, templateEl), clone2._x_refreshXForScope = newScope => {
12267 Object.entries(newScope).forEach((([key2, value]) => {
12268 reactiveScope[key2] = value;
12269 }));
12270 }, mutateDom((() => {
12271 lastEl.after(clone2), skipDuringClone((() => initTree(clone2)))();
12272 })), lookup[key] = clone2;
12273 }
12274 for (let i = 0; i < sames.length; i++) lookup[sames[i]]._x_refreshXForScope(scopes[keys.indexOf(sames[i])]);
12275 templateEl._x_prevKeys = keys;
12276 }));
12277 }(el, iteratorNames, evaluateItems, evaluateKey))), cleanup2((() => {
12278 Object.values(el._x_lookup).forEach((el2 => el2.remove())), delete el._x_prevKeys,
12279 delete el._x_lookup;
12280 }));
12281 })), handler3.inline = (el, {expression}, {cleanup: cleanup2}) => {
12282 let root = closestRoot(el);
12283 root._x_refs || (root._x_refs = {}), root._x_refs[expression] = el, cleanup2((() => delete root._x_refs[expression]));
12284 }, directive("ref", handler3), directive("if", ((el, {expression}, {effect: effect3, cleanup: cleanup2}) => {
12285 el.tagName.toLowerCase();
12286 let evaluate2 = evaluateLater(el, expression);
12287 effect3((() => evaluate2((value => {
12288 value ? (() => {
12289 if (el._x_currentIfEl) return el._x_currentIfEl;
12290 let clone2 = el.content.cloneNode(!0).firstElementChild;
12291 addScopeToNode(clone2, {}, el), mutateDom((() => {
12292 el.after(clone2), skipDuringClone((() => initTree(clone2)))();
12293 })), el._x_currentIfEl = clone2, el._x_undoIf = () => {
12294 walk(clone2, (node => {
12295 node._x_effects && node._x_effects.forEach(dequeueJob);
12296 })), clone2.remove(), delete el._x_currentIfEl;
12297 };
12298 })() : el._x_undoIf && (el._x_undoIf(), delete el._x_undoIf);
12299 })))), cleanup2((() => el._x_undoIf && el._x_undoIf()));
12300 })), directive("id", ((el, {expression}, {evaluate: evaluate2}) => {
12301 evaluate2(expression).forEach((name => function(el, name) {
12302 el._x_ids || (el._x_ids = {}), el._x_ids[name] || (el._x_ids[name] = findAndIncrementId(name));
12303 }(el, name)));
12304 })), interceptClone(((from, to) => {
12305 from._x_ids && (to._x_ids = from._x_ids);
12306 })), mapAttributes(startingWith("@", prefix("on:"))), directive("on", skipDuringClone(((el, {value, modifiers, expression}, {cleanup: cleanup2}) => {
12307 let evaluate2 = expression ? evaluateLater(el, expression) : () => {};
12308 "template" === el.tagName.toLowerCase() && (el._x_forwardEvents || (el._x_forwardEvents = []),
12309 el._x_forwardEvents.includes(value) || el._x_forwardEvents.push(value));
12310 let removeListener = module_esm_on(el, value, modifiers, (e => {
12311 evaluate2((() => {}), {
12312 scope: {
12313 $event: e
12314 },
12315 params: [ e ]
12316 });
12317 }));
12318 cleanup2((() => removeListener()));
12319 }))), warnMissingPluginDirective("Collapse", "collapse", "collapse"), warnMissingPluginDirective("Intersect", "intersect", "intersect"),
12320 warnMissingPluginDirective("Focus", "trap", "focus"), warnMissingPluginDirective("Mask", "mask", "mask"),
12321 alpine_default.setEvaluator(normalEvaluator), alpine_default.setReactivityEngine({
12322 reactive: reactive2,
12323 effect: function(fn, options = EMPTY_OBJ) {
12324 (function(fn) {
12325 return fn && !0 === fn._isEffect;
12326 })(fn) && (fn = fn.raw);
12327 const effect3 = function(fn, options) {
12328 const effect3 = function() {
12329 if (!effect3.active) return fn();
12330 if (!effectStack.includes(effect3)) {
12331 cleanup(effect3);
12332 try {
12333 return trackStack.push(shouldTrack), shouldTrack = !0, effectStack.push(effect3),
12334 activeEffect = effect3, fn();
12335 } finally {
12336 effectStack.pop(), resetTracking(), activeEffect = effectStack[effectStack.length - 1];
12337 }
12338 }
12339 };
12340 return effect3.id = uid++, effect3.allowRecurse = !!options.allowRecurse, effect3._isEffect = !0,
12341 effect3.active = !0, effect3.raw = fn, effect3.deps = [], effect3.options = options,
12342 effect3;
12343 }(fn, options);
12344 return options.lazy || effect3(), effect3;
12345 },
12346 release: function(effect3) {
12347 effect3.active && (cleanup(effect3), effect3.options.onStop && effect3.options.onStop(),
12348 effect3.active = !1);
12349 },
12350 raw: toRaw
12351 });
12352 var module_default = alpine_default, ACCORDIONS = Array.from(document.querySelectorAll(".ag-accordion__trigger")), ACTIVE_CLASS = "ag-accordion__trigger--active", accordion = function() {
12353 ACCORDIONS.forEach((function(header) {
12354 header.addEventListener("click", (function(e) {
12355 !function(el) {
12356 ACCORDIONS.forEach((function(h) {
12357 h !== el && h.parentElement === el.parentElement && (h.classList.remove(ACTIVE_CLASS),
12358 h.nextElementSibling.style.maxHeight = 0);
12359 }));
12360 var panel = el.nextElementSibling;
12361 el.classList.contains(ACTIVE_CLASS) ? (el.classList.remove(ACTIVE_CLASS), panel.style.maxHeight = null) : (el.classList.add(ACTIVE_CLASS),
12362 panel.style.maxHeight = "".concat(panel.scrollHeight, "px"));
12363 }(e.currentTarget);
12364 }));
12365 }));
12366 };
12367 function Paginator_typeof(o) {
12368 return Paginator_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
12369 return typeof o;
12370 } : function(o) {
12371 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
12372 }, Paginator_typeof(o);
12373 }
12374 function _slicedToArray(r, e) {
12375 return function(r) {
12376 if (Array.isArray(r)) return r;
12377 }(r) || function(r, l) {
12378 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
12379 if (null != t) {
12380 var e, n, i, u, a = [], f = !0, o = !1;
12381 try {
12382 if (i = (t = t.call(r)).next, 0 === l) {
12383 if (Object(t) !== t) return;
12384 f = !1;
12385 } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
12386 } catch (r) {
12387 o = !0, n = r;
12388 } finally {
12389 try {
12390 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
12391 } finally {
12392 if (o) throw n;
12393 }
12394 }
12395 return a;
12396 }
12397 }(r, e) || function(r, a) {
12398 if (r) {
12399 if ("string" == typeof r) return _arrayLikeToArray(r, a);
12400 var t = {}.toString.call(r).slice(8, -1);
12401 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
12402 }
12403 }(r, e) || function() {
12404 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12405 }();
12406 }
12407 function _arrayLikeToArray(r, a) {
12408 (null == a || a > r.length) && (a = r.length);
12409 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
12410 return n;
12411 }
12412 function _regeneratorRuntime() {
12413 _regeneratorRuntime = function() {
12414 return e;
12415 };
12416 var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t, e, r) {
12417 t[e] = r.value;
12418 }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag";
12419 function define(t, e, r) {
12420 return Object.defineProperty(t, e, {
12421 value: r,
12422 enumerable: !0,
12423 configurable: !0,
12424 writable: !0
12425 }), t[e];
12426 }
12427 try {
12428 define({}, "");
12429 } catch (t) {
12430 define = function(t, e, r) {
12431 return t[e] = r;
12432 };
12433 }
12434 function wrap(t, e, r, n) {
12435 var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []);
12436 return o(a, "_invoke", {
12437 value: makeInvokeMethod(t, r, c)
12438 }), a;
12439 }
12440 function tryCatch(t, e, r) {
12441 try {
12442 return {
12443 type: "normal",
12444 arg: t.call(e, r)
12445 };
12446 } catch (t) {
12447 return {
12448 type: "throw",
12449 arg: t
12450 };
12451 }
12452 }
12453 e.wrap = wrap;
12454 var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
12455 function Generator() {}
12456 function GeneratorFunction() {}
12457 function GeneratorFunctionPrototype() {}
12458 var p = {};
12459 define(p, a, (function() {
12460 return this;
12461 }));
12462 var d = Object.getPrototypeOf, v = d && d(d(values([])));
12463 v && v !== r && n.call(v, a) && (p = v);
12464 var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
12465 function defineIteratorMethods(t) {
12466 [ "next", "throw", "return" ].forEach((function(e) {
12467 define(t, e, (function(t) {
12468 return this._invoke(e, t);
12469 }));
12470 }));
12471 }
12472 function AsyncIterator(t, e) {
12473 function invoke(r, o, i, a) {
12474 var c = tryCatch(t[r], t, o);
12475 if ("throw" !== c.type) {
12476 var u = c.arg, h = u.value;
12477 return h && "object" == Paginator_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then((function(t) {
12478 invoke("next", t, i, a);
12479 }), (function(t) {
12480 invoke("throw", t, i, a);
12481 })) : e.resolve(h).then((function(t) {
12482 u.value = t, i(u);
12483 }), (function(t) {
12484 return invoke("throw", t, i, a);
12485 }));
12486 }
12487 a(c.arg);
12488 }
12489 var r;
12490 o(this, "_invoke", {
12491 value: function(t, n) {
12492 function callInvokeWithMethodAndArg() {
12493 return new e((function(e, r) {
12494 invoke(t, n, e, r);
12495 }));
12496 }
12497 return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
12498 }
12499 });
12500 }
12501 function makeInvokeMethod(e, r, n) {
12502 var o = h;
12503 return function(i, a) {
12504 if (o === f) throw Error("Generator is already running");
12505 if (o === s) {
12506 if ("throw" === i) throw a;
12507 return {
12508 value: t,
12509 done: !0
12510 };
12511 }
12512 for (n.method = i, n.arg = a; ;) {
12513 var c = n.delegate;
12514 if (c) {
12515 var u = maybeInvokeDelegate(c, n);
12516 if (u) {
12517 if (u === y) continue;
12518 return u;
12519 }
12520 }
12521 if ("next" === n.method) n.sent = n._sent = n.arg; else if ("throw" === n.method) {
12522 if (o === h) throw o = s, n.arg;
12523 n.dispatchException(n.arg);
12524 } else "return" === n.method && n.abrupt("return", n.arg);
12525 o = f;
12526 var p = tryCatch(e, r, n);
12527 if ("normal" === p.type) {
12528 if (o = n.done ? s : l, p.arg === y) continue;
12529 return {
12530 value: p.arg,
12531 done: n.done
12532 };
12533 }
12534 "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
12535 }
12536 };
12537 }
12538 function maybeInvokeDelegate(e, r) {
12539 var n = r.method, o = e.iterator[n];
12540 if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return",
12541 r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw",
12542 r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
12543 var i = tryCatch(o, e.iterator, r.arg);
12544 if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null,
12545 y;
12546 var a = i.arg;
12547 return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next",
12548 r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"),
12549 r.delegate = null, y);
12550 }
12551 function pushTryEntry(t) {
12552 var e = {
12553 tryLoc: t[0]
12554 };
12555 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]),
12556 this.tryEntries.push(e);
12557 }
12558 function resetTryEntry(t) {
12559 var e = t.completion || {};
12560 e.type = "normal", delete e.arg, t.completion = e;
12561 }
12562 function Context(t) {
12563 this.tryEntries = [ {
12564 tryLoc: "root"
12565 } ], t.forEach(pushTryEntry, this), this.reset(!0);
12566 }
12567 function values(e) {
12568 if (e || "" === e) {
12569 var r = e[a];
12570 if (r) return r.call(e);
12571 if ("function" == typeof e.next) return e;
12572 if (!isNaN(e.length)) {
12573 var o = -1, i = function next() {
12574 for (;++o < e.length; ) if (n.call(e, o)) return next.value = e[o], next.done = !1,
12575 next;
12576 return next.value = t, next.done = !0, next;
12577 };
12578 return i.next = i;
12579 }
12580 }
12581 throw new TypeError(Paginator_typeof(e) + " is not iterable");
12582 }
12583 return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
12584 value: GeneratorFunctionPrototype,
12585 configurable: !0
12586 }), o(GeneratorFunctionPrototype, "constructor", {
12587 value: GeneratorFunction,
12588 configurable: !0
12589 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"),
12590 e.isGeneratorFunction = function(t) {
12591 var e = "function" == typeof t && t.constructor;
12592 return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
12593 }, e.mark = function(t) {
12594 return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype,
12595 define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
12596 }, e.awrap = function(t) {
12597 return {
12598 __await: t
12599 };
12600 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, (function() {
12601 return this;
12602 })), e.AsyncIterator = AsyncIterator, e.async = function(t, r, n, o, i) {
12603 void 0 === i && (i = Promise);
12604 var a = new AsyncIterator(wrap(t, r, n, o), i);
12605 return e.isGeneratorFunction(r) ? a : a.next().then((function(t) {
12606 return t.done ? t.value : a.next();
12607 }));
12608 }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, (function() {
12609 return this;
12610 })), define(g, "toString", (function() {
12611 return "[object Generator]";
12612 })), e.keys = function(t) {
12613 var e = Object(t), r = [];
12614 for (var n in e) r.push(n);
12615 return r.reverse(), function next() {
12616 for (;r.length; ) {
12617 var t = r.pop();
12618 if (t in e) return next.value = t, next.done = !1, next;
12619 }
12620 return next.done = !0, next;
12621 };
12622 }, e.values = values, Context.prototype = {
12623 constructor: Context,
12624 reset: function(e) {
12625 if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null,
12626 this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
12627 },
12628 stop: function() {
12629 this.done = !0;
12630 var t = this.tryEntries[0].completion;
12631 if ("throw" === t.type) throw t.arg;
12632 return this.rval;
12633 },
12634 dispatchException: function(e) {
12635 if (this.done) throw e;
12636 var r = this;
12637 function handle(n, o) {
12638 return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t),
12639 !!o;
12640 }
12641 for (var o = this.tryEntries.length - 1; o >= 0; --o) {
12642 var i = this.tryEntries[o], a = i.completion;
12643 if ("root" === i.tryLoc) return handle("end");
12644 if (i.tryLoc <= this.prev) {
12645 var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc");
12646 if (c && u) {
12647 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
12648 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
12649 } else if (c) {
12650 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
12651 } else {
12652 if (!u) throw Error("try statement without catch or finally");
12653 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
12654 }
12655 }
12656 }
12657 },
12658 abrupt: function(t, e) {
12659 for (var r = this.tryEntries.length - 1; r >= 0; --r) {
12660 var o = this.tryEntries[r];
12661 if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
12662 var i = o;
12663 break;
12664 }
12665 }
12666 i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
12667 var a = i ? i.completion : {};
12668 return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc,
12669 y) : this.complete(a);
12670 },
12671 complete: function(t, e) {
12672 if ("throw" === t.type) throw t.arg;
12673 return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg,
12674 this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e),
12675 y;
12676 },
12677 finish: function(t) {
12678 for (var e = this.tryEntries.length - 1; e >= 0; --e) {
12679 var r = this.tryEntries[e];
12680 if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r),
12681 y;
12682 }
12683 },
12684 catch: function(t) {
12685 for (var e = this.tryEntries.length - 1; e >= 0; --e) {
12686 var r = this.tryEntries[e];
12687 if (r.tryLoc === t) {
12688 var n = r.completion;
12689 if ("throw" === n.type) {
12690 var o = n.arg;
12691 resetTryEntry(r);
12692 }
12693 return o;
12694 }
12695 }
12696 throw Error("illegal catch attempt");
12697 },
12698 delegateYield: function(e, r, n) {
12699 return this.delegate = {
12700 iterator: values(e),
12701 resultName: r,
12702 nextLoc: n
12703 }, "next" === this.method && (this.arg = t), y;
12704 }
12705 }, e;
12706 }
12707 function asyncGeneratorStep(n, t, e, r, o, a, c) {
12708 try {
12709 var i = n[a](c), u = i.value;
12710 } catch (n) {
12711 return void e(n);
12712 }
12713 i.done ? t(u) : Promise.resolve(u).then(r, o);
12714 }
12715 function _asyncToGenerator(n) {
12716 return function() {
12717 var t = this, e = arguments;
12718 return new Promise((function(r, o) {
12719 var a = n.apply(t, e);
12720 function _next(n) {
12721 asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
12722 }
12723 function _throw(n) {
12724 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
12725 }
12726 _next(void 0);
12727 }));
12728 };
12729 }
12730 __webpack_require__.g.age_gate_pagination = function(taxonomy) {
12731 return {
12732 loading: !0,
12733 current: 1,
12734 selected: {},
12735 data: [],
12736 selectedstring: "",
12737 selectedCount: 0,
12738 total: 0,
12739 pages: 0,
12740 taxonomy,
12741 objects: 0,
12742 formattedTotal: 0,
12743 searchTerm: null,
12744 searchText: "",
12745 initialised: !1,
12746 page: function(_page) {
12747 var _this = this;
12748 return _asyncToGenerator(_regeneratorRuntime().mark((function _callee() {
12749 var _ag_admin, rest, nonce, data, q, response, terms, current, total, pages, objects;
12750 return _regeneratorRuntime().wrap((function(_context) {
12751 for (;;) switch (_context.prev = _context.next) {
12752 case 0:
12753 return _this.loading = !0, _ag_admin = ag_admin, rest = _ag_admin.rest, nonce = _ag_admin.nonce,
12754 (data = new FormData).append("taxonomy", _this.taxonomy), data.append("page", _page),
12755 data.append("t", Date.now()), _this.searchTerm && data.append("search", _this.searchTerm),
12756 q = new URLSearchParams(data).toString(), _context.next = 10, fetch("".concat(rest, "?").concat(q), {
12757 headers: {
12758 "X-WP-Nonce": nonce
12759 }
12760 });
12761
12762 case 10:
12763 return _context.next = 12, _context.sent.json();
12764
12765 case 12:
12766 response = _context.sent, terms = response.data, current = response.page, total = response.total,
12767 pages = response.pages, objects = response.objects, _this.objects = objects, _this.data = terms,
12768 _this.current = current, _this.total = total, _this.pages = pages, _this.formattedTotal = Intl.NumberFormat().format(objects * total),
12769 _this.loading = !1, _this.initialised = !0;
12770
12771 case 22:
12772 case "end":
12773 return _context.stop();
12774 }
12775 }), _callee);
12776 })))();
12777 },
12778 init: function() {
12779 var _this2 = this;
12780 return _asyncToGenerator(_regeneratorRuntime().mark((function _callee2() {
12781 var _ag_admin2, rest, nonce, data, q, selected, _ag_content_params, load_error;
12782 return _regeneratorRuntime().wrap((function(_context2) {
12783 for (;;) switch (_context2.prev = _context2.next) {
12784 case 0:
12785 return _this2.$watch("selected", (function(value) {})), _this2.$watch("selected", (function(value) {
12786 _this2.selectedstring = JSON.stringify(Object.fromEntries(Object.entries(value).filter((function(_ref) {
12787 return _slicedToArray(_ref, 2)[1];
12788 })))), _this2.selectedCount = Object.keys(Object.fromEntries(Object.entries(value).filter((function(_ref3) {
12789 return _slicedToArray(_ref3, 2)[1];
12790 })))).length;
12791 })), _ag_admin2 = ag_admin, rest = _ag_admin2.rest, nonce = _ag_admin2.nonce, (data = new FormData).append("taxonomy", _this2.taxonomy),
12792 data.append("t", Date.now()), q = new URLSearchParams(data).toString(), _context2.prev = 7,
12793 _context2.next = 10, fetch("".concat(rest, "/selected?").concat(q), {
12794 headers: {
12795 "X-WP-Nonce": nonce
12796 }
12797 });
12798
12799 case 10:
12800 return _context2.next = 12, _context2.sent.json();
12801
12802 case 12:
12803 selected = _context2.sent, _this2.selected = Object.keys(selected).length ? selected : {},
12804 _context2.next = 22;
12805 break;
12806
12807 case 16:
12808 _context2.prev = 16, _context2.t0 = _context2.catch(7), _ag_content_params = ag_content_params,
12809 load_error = _ag_content_params.load_error, document.querySelector(".wrap h2").insertAdjacentHTML("afterend", '<div class="notice notice-error"><p><strong>'.concat(load_error, "</strong></p></div>")),
12810 window.scrollTo({
12811 top: 0,
12812 left: 0,
12813 behavior: "smooth"
12814 }), _this2.selected = {};
12815
12816 case 22:
12817 _this2.$watch("searchTerm", (function(value) {
12818 return _this2.page(1);
12819 })), _this2.page(1);
12820
12821 case 24:
12822 case "end":
12823 return _context2.stop();
12824 }
12825 }), _callee2, null, [ [ 7, 16 ] ]);
12826 })))();
12827 },
12828 all: function() {
12829 var _this3 = this;
12830 return _asyncToGenerator(_regeneratorRuntime().mark((function _callee3() {
12831 var _ag_admin3, rest, nonce, data, q, selected;
12832 return _regeneratorRuntime().wrap((function(_context3) {
12833 for (;;) switch (_context3.prev = _context3.next) {
12834 case 0:
12835 if (!Object.keys(_this3.selected).length) {
12836 _context3.next = 3;
12837 break;
12838 }
12839 return _this3.selected = {}, _context3.abrupt("return");
12840
12841 case 3:
12842 return _this3.loading = !0, _ag_admin3 = ag_admin, rest = _ag_admin3.rest, nonce = _ag_admin3.nonce,
12843 (data = new FormData).append("taxonomy", _this3.taxonomy), data.append("t", Date.now()),
12844 _this3.searchTerm && data.append("search", _this3.searchTerm), q = new URLSearchParams(data).toString(),
12845 _context3.next = 12, fetch("".concat(rest, "/select-all?").concat(q), {
12846 headers: {
12847 "X-WP-Nonce": nonce
12848 }
12849 });
12850
12851 case 12:
12852 return _context3.next = 14, _context3.sent.json();
12853
12854 case 14:
12855 selected = _context3.sent, _this3.selected = Object.keys(selected).length ? selected : {},
12856 _this3.loading = !1;
12857
12858 case 17:
12859 case "end":
12860 return _context3.stop();
12861 }
12862 }), _callee3);
12863 })))();
12864 },
12865 search: function(term) {
12866 this.searchTerm = term, term || (this.searchText = "");
12867 }
12868 };
12869 }, window.addEventListener("DOMContentLoaded", (function() {
12870 accordion(), es_core.registerLanguage("css", css), document.querySelectorAll(".language-css").forEach((function(el) {
12871 es_core.highlightElement(el);
12872 })), window.Alpine = module_default, module_default.start(), new wp_picker, new LinkPicker,
12873 document.querySelectorAll('[name="ag_settings[all]"]').forEach((function(toggle) {
12874 toggle.addEventListener("change", (function(e) {
12875 toggle.closest("table").querySelectorAll('[type="checkbox"]').forEach((function(input) {
12876 return input.checked = toggle.checked;
12877 }));
12878 }));
12879 })), document.querySelectorAll(".ag-file").forEach((function(file) {
12880 file.addEventListener("change", (function(e) {
12881 return file.parentNode.querySelector(".ag-file-custom").dataset.text = e.target.files[0].name;
12882 }));
12883 }));
12884 var paramsString = window.location.search, searchParams = new URLSearchParams(paramsString);
12885 searchParams.delete("m"), history.replaceState(null, "", "admin.php?".concat(searchParams.toString())),
12886 Array.from(document.querySelectorAll(".ag-rte")).forEach((function(editor) {
12887 new (simplemde_min_default())({
12888 element: editor,
12889 spellChecker: !1,
12890 forceSync: !0
12891 });
12892 })), Array.from(document.querySelectorAll(".ag-form__reset")).forEach((function(frm) {})),
12893 Array.from(document.querySelectorAll(".ag-remove-legacy-css")).forEach((function(button) {
12894 button.addEventListener("click", (function(e) {
12895 if (confirm("Are you sure?")) {
12896 var ajaxurl = window.ajaxurl, data = new FormData;
12897 data.append("action", "ag_clear_legacy_css"), data.append("nonce", e.currentTarget.dataset.id),
12898 fetch(ajaxurl, {
12899 method: "POST",
12900 body: data
12901 }).then((function(r) {
12902 var status = r.status;
12903 if (200 !== status) throw new Error(status);
12904 return r.json();
12905 })).then((function(data) {
12906 window.location.reload();
12907 })).catch((function(resp) {
12908 alert("Failed to execute request");
12909 }));
12910 }
12911 }));
12912 }));
12913 }));
12914 })();
12915 })();