blob: 208526d98cee5bcb932ea17a274f1d227197a3c9 [file] [log] [blame]
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07001'use strict';
2if ('undefined' != typeof lib) throw new Error('Global "lib" object already exists.');
3var lib = {};
4lib.runtimeDependencies_ = {}, lib.initCallbacks_ = [], lib.rtdep = function(e) {
5 var t;
6 try {
7 throw new Error;
8 }
9 catch (r) {
10 var o = r.stack.split('\n');
11 t = o.length >= 3 ? o[2].replace(/^\s*at\s+/, '') : o[1].replace(/^\s*global code@/, '');
12 }
13 for (var i = 0; i < arguments.length; i++) {
14 var s = arguments[i];
15 if (s instanceof Array) lib.rtdep.apply(lib, s);
16 else {
17 var n = this.runtimeDependencies_[s];
18 n || (n = this.runtimeDependencies_[s] = []), n.push(t);
19 }
20 }
21};, lib.ensureRuntimeDependencies_ = function() {
22 var e = !0;
23 for (var t in lib.runtimeDependencies_)
24 for (var r = lib.runtimeDependencies_[t], o = t.split('.'), i = window || self, s = 0; s < o.length; s++) {
25 if (!(o[s] in i)) {
26 console.warn('Missing "' + t + '" is needed by', r), e = !1;
27 break;
28 }
29 i = i[o[s]];
30 }
31 if (!e) throw new Error('Failed runtime dependency check');
32};, lib.registerInit = function(e, t) {
33 return lib.initCallbacks_.push([e, t]), t;
34};, lib.init = function(e, t) {
35 var r = lib.initCallbacks_,
36 o = function() {
37 if (r.length) {
38 var i = r.shift();
39 t && t('init: ' + i[0]), i[1](lib.f.alarm(o));
40 }
41 else e();
42 };
43 if ('function' != typeof e) throw new Error('Missing or invalid argument: onInit');
44 lib.ensureRuntimeDependencies_(), setTimeout(o, 0);
45};, lib.colors = {}, lib.colors.re_ = {
46 hex16: /#([a-f0-9])([a-f0-9])([a-f0-9])/i,
47 hex24: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,
48 rgb: new RegExp('^/s*rgb/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*/)/s*$'.replace(/\//g, '\\'), 'i'),
49 rgba: new RegExp('^/s*rgba/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)/)/s*$'.replace(/\//g, '\\'), 'i'),
50 rgbx: new RegExp('^/s*rgba?/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)?/)/s*$'.replace(/\//g, '\\'), 'i'),
51 x11rgb: /^\s*rgb:([a-f0-9]{1,4})\/([a-f0-9]{1,4})\/([a-f0-9]{1,4})\s*$/i,
52 name: /[a-z][a-z0-9\s]+/
53}, lib.colors.rgbToX11 = function(e) {
54 function t(e) {
55 return e = (257 * Math.min(e, 255)).toString(16), lib.f.zpad(e, 4);
56 }
57 var r = e.match(lib.colors.re_.rgbx);
58 return r ? 'rgb:' + t(r[1]) + '/' + t(r[2]) + '/' + t(r[3]) : null;
59};, lib.colors.x11HexToCSS = function(e) {
60 function t(e) {
61 return e = parseInt(e, 16), 2 == r ? e : 1 == r ? e << 4 : e >> 4 * (r - 2)
62 }
63 if (!e.startsWith('#')) return null;
64 if (e = e.substr(1), -1 == [3, 6, 9, 12].indexOf(e.length)) return null;
65 if (e.match(/[^a-f0-9]/i)) return null;
66 var r = e.length / 3,
67 o = e.substr(0, r),
68 i = e.substr(r, r),
69 s = e.substr(r + r, r);
70 return lib.colors.arrayToRGBA([o, i, s].map(t));
71};, lib.colors.x11ToCSS = function(e) {
72 function t(e) {
73 return 1 == e.length ? parseInt(e + e, 16) : 2 == e.length ? parseInt(e, 16) : (3 == e.length && (e += e.substr(2)), Math.round(parseInt(e, 16) / 257))
74 }
75 var r = e.match(lib.colors.re_.x11rgb);
76 return r ? (r.splice(0, 1), lib.colors.arrayToRGBA(r.map(t))) : e.startsWith('#') ? lib.colors.x11HexToCSS(e) : lib.colors.nameToRGB(e)
77};, lib.colors.hexToRGB = function(e) {
78 function t(e) {
79 4 == e.length && (e = e.replace(r, function(e, t, r, o) {
80 return '#' + t + t + r + r + o + o;
81 }));
82 var t = e.match(o);
83 return t ? 'rgb(' + parseInt(t[1], 16) + ', ' + parseInt(t[2], 16) + ', ' + parseInt(t[3], 16) + ')' : null;
84 }
85 var r = lib.colors.re_.hex16,
86 o = lib.colors.re_.hex24;
87 if (e instanceof Array)
88 for (var i = 0; i < e.length; i++) e[i] = t(e[i]);
89 else e = t(e);
90 return e;
91};, lib.colors.rgbToHex = function(e) {
92 function t(e) {
93 var t = lib.colors.crackRGB(e);
94 return t ? '#' + lib.f.zpad((parseInt(t[0]) << 16 | parseInt(t[1]) << 8 | parseInt(t[2]) << 0).toString(16), 6) : null;
95 }
96 if (e instanceof Array)
97 for (var r = 0; r < e.length; r++) e[r] = t(e[r]);
98 else e = t(e);
99 return e;
100};, lib.colors.normalizeCSS = function(e) {
101 return '#' == e.substr(0, 1) ? lib.colors.hexToRGB(e) : lib.colors.re_.rgbx.test(e) ? e : lib.colors.nameToRGB(e)
102};, lib.colors.arrayToRGBA = function(e) {
103 var t = e.length > 3 ? e[3] : 1;
104 return 'rgba(' + e[0] + ', ' + e[1] + ', ' + e[2] + ', ' + t + ')';
105};, lib.colors.setAlpha = function(e, t) {
106 var r = lib.colors.crackRGB(e);
107 return r[3] = t, lib.colors.arrayToRGBA(r);
108};, lib.colors.mix = function(e, t, r) {
109 for (var o = lib.colors.crackRGB(e), i = lib.colors.crackRGB(t), s = 0; 4 > s; ++s) {
110 var n = i[s] - o[s];
111 o[s] = Math.round(parseInt(o[s]) + n * r);
112 }
113 return lib.colors.arrayToRGBA(o);
114};, lib.colors.crackRGB = function(e) {
115 if ('rgba' == e.substr(0, 4)) {
116 var t = e.match(lib.colors.re_.rgba);
117 if (t) return t.shift(), t;
118 }
119 else {
120 var t = e.match(lib.colors.re_.rgb);
121 if (t) return t.shift(), t.push(1), t;
122 }
123 return console.error("Couldn't crack: " + e), null;
124};, lib.colors.nameToRGB = function(e) {
125 return e in lib.colors.colorNames ? lib.colors.colorNames[e] : (e = e.toLowerCase(), e in lib.colors.colorNames ? lib.colors.colorNames[e] : (e = e.replace(/\s+/g, ''), e in lib.colors.colorNames ? lib.colors.colorNames[e] : null));
126};, lib.colors.stockColorPalette = lib.colors.hexToRGB(['#000000', '#CC0000', '#4E9A06', '#C4A000', '#3465A4', '#75507B', '#06989A', '#D3D7CF', '#555753', '#EF2929', '#00BA13', '#FCE94F', '#729FCF', '#F200CB', '#00B5BD', '#EEEEEC', '#000000', '#00005F', '#000087', '#0000AF', '#0000D7', '#0000FF', '#005F00', '#005F5F', '#005F87', '#005FAF', '#005FD7', '#005FFF', '#008700', '#00875F', '#008787', '#0087AF', '#0087D7', '#0087FF', '#00AF00', '#00AF5F', '#00AF87', '#00AFAF', '#00AFD7', '#00AFFF', '#00D700', '#00D75F', '#00D787', '#00D7AF', '#00D7D7', '#00D7FF', '#00FF00', '#00FF5F', '#00FF87', '#00FFAF', '#00FFD7', '#00FFFF', '#5F0000', '#5F005F', '#5F0087', '#5F00AF', '#5F00D7', '#5F00FF', '#5F5F00', '#5F5F5F', '#5F5F87', '#5F5FAF', '#5F5FD7', '#5F5FFF', '#5F8700', '#5F875F', '#5F8787', '#5F87AF', '#5F87D7', '#5F87FF', '#5FAF00', '#5FAF5F', '#5FAF87', '#5FAFAF', '#5FAFD7', '#5FAFFF', '#5FD700', '#5FD75F', '#5FD787', '#5FD7AF', '#5FD7D7', '#5FD7FF', '#5FFF00', '#5FFF5F', '#5FFF87', '#5FFFAF', '#5FFFD7', '#5FFFFF', '#870000', '#87005F', '#870087', '#8700AF', '#8700D7', '#8700FF', '#875F00', '#875F5F', '#875F87', '#875FAF', '#875FD7', '#875FFF', '#878700', '#87875F', '#878787', '#8787AF', '#8787D7', '#8787FF', '#87AF00', '#87AF5F', '#87AF87', '#87AFAF', '#87AFD7', '#87AFFF', '#87D700', '#87D75F', '#87D787', '#87D7AF', '#87D7D7', '#87D7FF', '#87FF00', '#87FF5F', '#87FF87', '#87FFAF', '#87FFD7', '#87FFFF', '#AF0000', '#AF005F', '#AF0087', '#AF00AF', '#AF00D7', '#AF00FF', '#AF5F00', '#AF5F5F', '#AF5F87', '#AF5FAF', '#AF5FD7', '#AF5FFF', '#AF8700', '#AF875F', '#AF8787', '#AF87AF', '#AF87D7', '#AF87FF', '#AFAF00', '#AFAF5F', '#AFAF87', '#AFAFAF', '#AFAFD7', '#AFAFFF', '#AFD700', '#AFD75F', '#AFD787', '#AFD7AF', '#AFD7D7', '#AFD7FF', '#AFFF00', '#AFFF5F', '#AFFF87', '#AFFFAF', '#AFFFD7', '#AFFFFF', '#D70000', '#D7005F', '#D70087', '#D700AF', '#D700D7', '#D700FF', '#D75F00', '#D75F5F', '#D75F87', '#D75FAF', '#D75FD7', '#D75FFF', '#D78700', '#D7875F', '#D78787', '#D787AF', '#D787D7', '#D787FF', '#D7AF00', '#D7AF5F', '#D7AF87', '#D7AFAF', '#D7AFD7', '#D7AFFF', '#D7D700', '#D7D75F', '#D7D787', '#D7D7AF', '#D7D7D7', '#D7D7FF', '#D7FF00', '#D7FF5F', '#D7FF87', '#D7FFAF', '#D7FFD7', '#D7FFFF', '#FF0000', '#FF005F', '#FF0087', '#FF00AF', '#FF00D7', '#FF00FF', '#FF5F00', '#FF5F5F', '#FF5F87', '#FF5FAF', '#FF5FD7', '#FF5FFF', '#FF8700', '#FF875F', '#FF8787', '#FF87AF', '#FF87D7', '#FF87FF', '#FFAF00', '#FFAF5F', '#FFAF87', '#FFAFAF', '#FFAFD7', '#FFAFFF', '#FFD700', '#FFD75F', '#FFD787', '#FFD7AF', '#FFD7D7', '#FFD7FF', '#FFFF00', '#FFFF5F', '#FFFF87', '#FFFFAF', '#FFFFD7', '#FFFFFF', '#080808', '#121212', '#1C1C1C', '#262626', '#303030', '#3A3A3A', '#444444', '#4E4E4E', '#585858', '#626262', '#6C6C6C', '#767676', '#808080', '#8A8A8A', '#949494', '#9E9E9E', '#A8A8A8', '#B2B2B2', '#BCBCBC', '#C6C6C6', '#D0D0D0', '#DADADA', '#E4E4E4', '#EEEEEE']), lib.colors.colorPalette = lib.colors.stockColorPalette, lib.colors.colorNames = {
127 aliceblue: 'rgb(240, 248, 255)',
128 antiquewhite: 'rgb(250, 235, 215)',
129 antiquewhite1: 'rgb(255, 239, 219)',
130 antiquewhite2: 'rgb(238, 223, 204)',
131 antiquewhite3: 'rgb(205, 192, 176)',
132 antiquewhite4: 'rgb(139, 131, 120)',
133 aquamarine: 'rgb(127, 255, 212)',
134 aquamarine1: 'rgb(127, 255, 212)',
135 aquamarine2: 'rgb(118, 238, 198)',
136 aquamarine3: 'rgb(102, 205, 170)',
137 aquamarine4: 'rgb(69, 139, 116)',
138 azure: 'rgb(240, 255, 255)',
139 azure1: 'rgb(240, 255, 255)',
140 azure2: 'rgb(224, 238, 238)',
141 azure3: 'rgb(193, 205, 205)',
142 azure4: 'rgb(131, 139, 139)',
143 beige: 'rgb(245, 245, 220)',
144 bisque: 'rgb(255, 228, 196)',
145 bisque1: 'rgb(255, 228, 196)',
146 bisque2: 'rgb(238, 213, 183)',
147 bisque3: 'rgb(205, 183, 158)',
148 bisque4: 'rgb(139, 125, 107)',
149 black: 'rgb(0, 0, 0)',
150 blanchedalmond: 'rgb(255, 235, 205)',
151 blue: 'rgb(0, 0, 255)',
152 blue1: 'rgb(0, 0, 255)',
153 blue2: 'rgb(0, 0, 238)',
154 blue3: 'rgb(0, 0, 205)',
155 blue4: 'rgb(0, 0, 139)',
156 blueviolet: 'rgb(138, 43, 226)',
157 brown: 'rgb(165, 42, 42)',
158 brown1: 'rgb(255, 64, 64)',
159 brown2: 'rgb(238, 59, 59)',
160 brown3: 'rgb(205, 51, 51)',
161 brown4: 'rgb(139, 35, 35)',
162 burlywood: 'rgb(222, 184, 135)',
163 burlywood1: 'rgb(255, 211, 155)',
164 burlywood2: 'rgb(238, 197, 145)',
165 burlywood3: 'rgb(205, 170, 125)',
166 burlywood4: 'rgb(139, 115, 85)',
167 cadetblue: 'rgb(95, 158, 160)',
168 cadetblue1: 'rgb(152, 245, 255)',
169 cadetblue2: 'rgb(142, 229, 238)',
170 cadetblue3: 'rgb(122, 197, 205)',
171 cadetblue4: 'rgb(83, 134, 139)',
172 chartreuse: 'rgb(127, 255, 0)',
173 chartreuse1: 'rgb(127, 255, 0)',
174 chartreuse2: 'rgb(118, 238, 0)',
175 chartreuse3: 'rgb(102, 205, 0)',
176 chartreuse4: 'rgb(69, 139, 0)',
177 chocolate: 'rgb(210, 105, 30)',
178 chocolate1: 'rgb(255, 127, 36)',
179 chocolate2: 'rgb(238, 118, 33)',
180 chocolate3: 'rgb(205, 102, 29)',
181 chocolate4: 'rgb(139, 69, 19)',
182 coral: 'rgb(255, 127, 80)',
183 coral1: 'rgb(255, 114, 86)',
184 coral2: 'rgb(238, 106, 80)',
185 coral3: 'rgb(205, 91, 69)',
186 coral4: 'rgb(139, 62, 47)',
187 cornflowerblue: 'rgb(100, 149, 237)',
188 cornsilk: 'rgb(255, 248, 220)',
189 cornsilk1: 'rgb(255, 248, 220)',
190 cornsilk2: 'rgb(238, 232, 205)',
191 cornsilk3: 'rgb(205, 200, 177)',
192 cornsilk4: 'rgb(139, 136, 120)',
193 cyan: 'rgb(0, 255, 255)',
194 cyan1: 'rgb(0, 255, 255)',
195 cyan2: 'rgb(0, 238, 238)',
196 cyan3: 'rgb(0, 205, 205)',
197 cyan4: 'rgb(0, 139, 139)',
198 darkblue: 'rgb(0, 0, 139)',
199 darkcyan: 'rgb(0, 139, 139)',
200 darkgoldenrod: 'rgb(184, 134, 11)',
201 darkgoldenrod1: 'rgb(255, 185, 15)',
202 darkgoldenrod2: 'rgb(238, 173, 14)',
203 darkgoldenrod3: 'rgb(205, 149, 12)',
204 darkgoldenrod4: 'rgb(139, 101, 8)',
205 darkgray: 'rgb(169, 169, 169)',
206 darkgreen: 'rgb(0, 100, 0)',
207 darkgrey: 'rgb(169, 169, 169)',
208 darkkhaki: 'rgb(189, 183, 107)',
209 darkmagenta: 'rgb(139, 0, 139)',
210 darkolivegreen: 'rgb(85, 107, 47)',
211 darkolivegreen1: 'rgb(202, 255, 112)',
212 darkolivegreen2: 'rgb(188, 238, 104)',
213 darkolivegreen3: 'rgb(162, 205, 90)',
214 darkolivegreen4: 'rgb(110, 139, 61)',
215 darkorange: 'rgb(255, 140, 0)',
216 darkorange1: 'rgb(255, 127, 0)',
217 darkorange2: 'rgb(238, 118, 0)',
218 darkorange3: 'rgb(205, 102, 0)',
219 darkorange4: 'rgb(139, 69, 0)',
220 darkorchid: 'rgb(153, 50, 204)',
221 darkorchid1: 'rgb(191, 62, 255)',
222 darkorchid2: 'rgb(178, 58, 238)',
223 darkorchid3: 'rgb(154, 50, 205)',
224 darkorchid4: 'rgb(104, 34, 139)',
225 darkred: 'rgb(139, 0, 0)',
226 darksalmon: 'rgb(233, 150, 122)',
227 darkseagreen: 'rgb(143, 188, 143)',
228 darkseagreen1: 'rgb(193, 255, 193)',
229 darkseagreen2: 'rgb(180, 238, 180)',
230 darkseagreen3: 'rgb(155, 205, 155)',
231 darkseagreen4: 'rgb(105, 139, 105)',
232 darkslateblue: 'rgb(72, 61, 139)',
233 darkslategray: 'rgb(47, 79, 79)',
234 darkslategray1: 'rgb(151, 255, 255)',
235 darkslategray2: 'rgb(141, 238, 238)',
236 darkslategray3: 'rgb(121, 205, 205)',
237 darkslategray4: 'rgb(82, 139, 139)',
238 darkslategrey: 'rgb(47, 79, 79)',
239 darkturquoise: 'rgb(0, 206, 209)',
240 darkviolet: 'rgb(148, 0, 211)',
241 debianred: 'rgb(215, 7, 81)',
242 deeppink: 'rgb(255, 20, 147)',
243 deeppink1: 'rgb(255, 20, 147)',
244 deeppink2: 'rgb(238, 18, 137)',
245 deeppink3: 'rgb(205, 16, 118)',
246 deeppink4: 'rgb(139, 10, 80)',
247 deepskyblue: 'rgb(0, 191, 255)',
248 deepskyblue1: 'rgb(0, 191, 255)',
249 deepskyblue2: 'rgb(0, 178, 238)',
250 deepskyblue3: 'rgb(0, 154, 205)',
251 deepskyblue4: 'rgb(0, 104, 139)',
252 dimgray: 'rgb(105, 105, 105)',
253 dimgrey: 'rgb(105, 105, 105)',
254 dodgerblue: 'rgb(30, 144, 255)',
255 dodgerblue1: 'rgb(30, 144, 255)',
256 dodgerblue2: 'rgb(28, 134, 238)',
257 dodgerblue3: 'rgb(24, 116, 205)',
258 dodgerblue4: 'rgb(16, 78, 139)',
259 firebrick: 'rgb(178, 34, 34)',
260 firebrick1: 'rgb(255, 48, 48)',
261 firebrick2: 'rgb(238, 44, 44)',
262 firebrick3: 'rgb(205, 38, 38)',
263 firebrick4: 'rgb(139, 26, 26)',
264 floralwhite: 'rgb(255, 250, 240)',
265 forestgreen: 'rgb(34, 139, 34)',
266 gainsboro: 'rgb(220, 220, 220)',
267 ghostwhite: 'rgb(248, 248, 255)',
268 gold: 'rgb(255, 215, 0)',
269 gold1: 'rgb(255, 215, 0)',
270 gold2: 'rgb(238, 201, 0)',
271 gold3: 'rgb(205, 173, 0)',
272 gold4: 'rgb(139, 117, 0)',
273 goldenrod: 'rgb(218, 165, 32)',
274 goldenrod1: 'rgb(255, 193, 37)',
275 goldenrod2: 'rgb(238, 180, 34)',
276 goldenrod3: 'rgb(205, 155, 29)',
277 goldenrod4: 'rgb(139, 105, 20)',
278 gray: 'rgb(190, 190, 190)',
279 gray0: 'rgb(0, 0, 0)',
280 gray1: 'rgb(3, 3, 3)',
281 gray10: 'rgb(26, 26, 26)',
282 gray100: 'rgb(255, 255, 255)',
283 gray11: 'rgb(28, 28, 28)',
284 gray12: 'rgb(31, 31, 31)',
285 gray13: 'rgb(33, 33, 33)',
286 gray14: 'rgb(36, 36, 36)',
287 gray15: 'rgb(38, 38, 38)',
288 gray16: 'rgb(41, 41, 41)',
289 gray17: 'rgb(43, 43, 43)',
290 gray18: 'rgb(46, 46, 46)',
291 gray19: 'rgb(48, 48, 48)',
292 gray2: 'rgb(5, 5, 5)',
293 gray20: 'rgb(51, 51, 51)',
294 gray21: 'rgb(54, 54, 54)',
295 gray22: 'rgb(56, 56, 56)',
296 gray23: 'rgb(59, 59, 59)',
297 gray24: 'rgb(61, 61, 61)',
298 gray25: 'rgb(64, 64, 64)',
299 gray26: 'rgb(66, 66, 66)',
300 gray27: 'rgb(69, 69, 69)',
301 gray28: 'rgb(71, 71, 71)',
302 gray29: 'rgb(74, 74, 74)',
303 gray3: 'rgb(8, 8, 8)',
304 gray30: 'rgb(77, 77, 77)',
305 gray31: 'rgb(79, 79, 79)',
306 gray32: 'rgb(82, 82, 82)',
307 gray33: 'rgb(84, 84, 84)',
308 gray34: 'rgb(87, 87, 87)',
309 gray35: 'rgb(89, 89, 89)',
310 gray36: 'rgb(92, 92, 92)',
311 gray37: 'rgb(94, 94, 94)',
312 gray38: 'rgb(97, 97, 97)',
313 gray39: 'rgb(99, 99, 99)',
314 gray4: 'rgb(10, 10, 10)',
315 gray40: 'rgb(102, 102, 102)',
316 gray41: 'rgb(105, 105, 105)',
317 gray42: 'rgb(107, 107, 107)',
318 gray43: 'rgb(110, 110, 110)',
319 gray44: 'rgb(112, 112, 112)',
320 gray45: 'rgb(115, 115, 115)',
321 gray46: 'rgb(117, 117, 117)',
322 gray47: 'rgb(120, 120, 120)',
323 gray48: 'rgb(122, 122, 122)',
324 gray49: 'rgb(125, 125, 125)',
325 gray5: 'rgb(13, 13, 13)',
326 gray50: 'rgb(127, 127, 127)',
327 gray51: 'rgb(130, 130, 130)',
328 gray52: 'rgb(133, 133, 133)',
329 gray53: 'rgb(135, 135, 135)',
330 gray54: 'rgb(138, 138, 138)',
331 gray55: 'rgb(140, 140, 140)',
332 gray56: 'rgb(143, 143, 143)',
333 gray57: 'rgb(145, 145, 145)',
334 gray58: 'rgb(148, 148, 148)',
335 gray59: 'rgb(150, 150, 150)',
336 gray6: 'rgb(15, 15, 15)',
337 gray60: 'rgb(153, 153, 153)',
338 gray61: 'rgb(156, 156, 156)',
339 gray62: 'rgb(158, 158, 158)',
340 gray63: 'rgb(161, 161, 161)',
341 gray64: 'rgb(163, 163, 163)',
342 gray65: 'rgb(166, 166, 166)',
343 gray66: 'rgb(168, 168, 168)',
344 gray67: 'rgb(171, 171, 171)',
345 gray68: 'rgb(173, 173, 173)',
346 gray69: 'rgb(176, 176, 176)',
347 gray7: 'rgb(18, 18, 18)',
348 gray70: 'rgb(179, 179, 179)',
349 gray71: 'rgb(181, 181, 181)',
350 gray72: 'rgb(184, 184, 184)',
351 gray73: 'rgb(186, 186, 186)',
352 gray74: 'rgb(189, 189, 189)',
353 gray75: 'rgb(191, 191, 191)',
354 gray76: 'rgb(194, 194, 194)',
355 gray77: 'rgb(196, 196, 196)',
356 gray78: 'rgb(199, 199, 199)',
357 gray79: 'rgb(201, 201, 201)',
358 gray8: 'rgb(20, 20, 20)',
359 gray80: 'rgb(204, 204, 204)',
360 gray81: 'rgb(207, 207, 207)',
361 gray82: 'rgb(209, 209, 209)',
362 gray83: 'rgb(212, 212, 212)',
363 gray84: 'rgb(214, 214, 214)',
364 gray85: 'rgb(217, 217, 217)',
365 gray86: 'rgb(219, 219, 219)',
366 gray87: 'rgb(222, 222, 222)',
367 gray88: 'rgb(224, 224, 224)',
368 gray89: 'rgb(227, 227, 227)',
369 gray9: 'rgb(23, 23, 23)',
370 gray90: 'rgb(229, 229, 229)',
371 gray91: 'rgb(232, 232, 232)',
372 gray92: 'rgb(235, 235, 235)',
373 gray93: 'rgb(237, 237, 237)',
374 gray94: 'rgb(240, 240, 240)',
375 gray95: 'rgb(242, 242, 242)',
376 gray96: 'rgb(245, 245, 245)',
377 gray97: 'rgb(247, 247, 247)',
378 gray98: 'rgb(250, 250, 250)',
379 gray99: 'rgb(252, 252, 252)',
380 green: 'rgb(0, 255, 0)',
381 green1: 'rgb(0, 255, 0)',
382 green2: 'rgb(0, 238, 0)',
383 green3: 'rgb(0, 205, 0)',
384 green4: 'rgb(0, 139, 0)',
385 greenyellow: 'rgb(173, 255, 47)',
386 grey: 'rgb(190, 190, 190)',
387 grey0: 'rgb(0, 0, 0)',
388 grey1: 'rgb(3, 3, 3)',
389 grey10: 'rgb(26, 26, 26)',
390 grey100: 'rgb(255, 255, 255)',
391 grey11: 'rgb(28, 28, 28)',
392 grey12: 'rgb(31, 31, 31)',
393 grey13: 'rgb(33, 33, 33)',
394 grey14: 'rgb(36, 36, 36)',
395 grey15: 'rgb(38, 38, 38)',
396 grey16: 'rgb(41, 41, 41)',
397 grey17: 'rgb(43, 43, 43)',
398 grey18: 'rgb(46, 46, 46)',
399 grey19: 'rgb(48, 48, 48)',
400 grey2: 'rgb(5, 5, 5)',
401 grey20: 'rgb(51, 51, 51)',
402 grey21: 'rgb(54, 54, 54)',
403 grey22: 'rgb(56, 56, 56)',
404 grey23: 'rgb(59, 59, 59)',
405 grey24: 'rgb(61, 61, 61)',
406 grey25: 'rgb(64, 64, 64)',
407 grey26: 'rgb(66, 66, 66)',
408 grey27: 'rgb(69, 69, 69)',
409 grey28: 'rgb(71, 71, 71)',
410 grey29: 'rgb(74, 74, 74)',
411 grey3: 'rgb(8, 8, 8)',
412 grey30: 'rgb(77, 77, 77)',
413 grey31: 'rgb(79, 79, 79)',
414 grey32: 'rgb(82, 82, 82)',
415 grey33: 'rgb(84, 84, 84)',
416 grey34: 'rgb(87, 87, 87)',
417 grey35: 'rgb(89, 89, 89)',
418 grey36: 'rgb(92, 92, 92)',
419 grey37: 'rgb(94, 94, 94)',
420 grey38: 'rgb(97, 97, 97)',
421 grey39: 'rgb(99, 99, 99)',
422 grey4: 'rgb(10, 10, 10)',
423 grey40: 'rgb(102, 102, 102)',
424 grey41: 'rgb(105, 105, 105)',
425 grey42: 'rgb(107, 107, 107)',
426 grey43: 'rgb(110, 110, 110)',
427 grey44: 'rgb(112, 112, 112)',
428 grey45: 'rgb(115, 115, 115)',
429 grey46: 'rgb(117, 117, 117)',
430 grey47: 'rgb(120, 120, 120)',
431 grey48: 'rgb(122, 122, 122)',
432 grey49: 'rgb(125, 125, 125)',
433 grey5: 'rgb(13, 13, 13)',
434 grey50: 'rgb(127, 127, 127)',
435 grey51: 'rgb(130, 130, 130)',
436 grey52: 'rgb(133, 133, 133)',
437 grey53: 'rgb(135, 135, 135)',
438 grey54: 'rgb(138, 138, 138)',
439 grey55: 'rgb(140, 140, 140)',
440 grey56: 'rgb(143, 143, 143)',
441 grey57: 'rgb(145, 145, 145)',
442 grey58: 'rgb(148, 148, 148)',
443 grey59: 'rgb(150, 150, 150)',
444 grey6: 'rgb(15, 15, 15)',
445 grey60: 'rgb(153, 153, 153)',
446 grey61: 'rgb(156, 156, 156)',
447 grey62: 'rgb(158, 158, 158)',
448 grey63: 'rgb(161, 161, 161)',
449 grey64: 'rgb(163, 163, 163)',
450 grey65: 'rgb(166, 166, 166)',
451 grey66: 'rgb(168, 168, 168)',
452 grey67: 'rgb(171, 171, 171)',
453 grey68: 'rgb(173, 173, 173)',
454 grey69: 'rgb(176, 176, 176)',
455 grey7: 'rgb(18, 18, 18)',
456 grey70: 'rgb(179, 179, 179)',
457 grey71: 'rgb(181, 181, 181)',
458 grey72: 'rgb(184, 184, 184)',
459 grey73: 'rgb(186, 186, 186)',
460 grey74: 'rgb(189, 189, 189)',
461 grey75: 'rgb(191, 191, 191)',
462 grey76: 'rgb(194, 194, 194)',
463 grey77: 'rgb(196, 196, 196)',
464 grey78: 'rgb(199, 199, 199)',
465 grey79: 'rgb(201, 201, 201)',
466 grey8: 'rgb(20, 20, 20)',
467 grey80: 'rgb(204, 204, 204)',
468 grey81: 'rgb(207, 207, 207)',
469 grey82: 'rgb(209, 209, 209)',
470 grey83: 'rgb(212, 212, 212)',
471 grey84: 'rgb(214, 214, 214)',
472 grey85: 'rgb(217, 217, 217)',
473 grey86: 'rgb(219, 219, 219)',
474 grey87: 'rgb(222, 222, 222)',
475 grey88: 'rgb(224, 224, 224)',
476 grey89: 'rgb(227, 227, 227)',
477 grey9: 'rgb(23, 23, 23)',
478 grey90: 'rgb(229, 229, 229)',
479 grey91: 'rgb(232, 232, 232)',
480 grey92: 'rgb(235, 235, 235)',
481 grey93: 'rgb(237, 237, 237)',
482 grey94: 'rgb(240, 240, 240)',
483 grey95: 'rgb(242, 242, 242)',
484 grey96: 'rgb(245, 245, 245)',
485 grey97: 'rgb(247, 247, 247)',
486 grey98: 'rgb(250, 250, 250)',
487 grey99: 'rgb(252, 252, 252)',
488 honeydew: 'rgb(240, 255, 240)',
489 honeydew1: 'rgb(240, 255, 240)',
490 honeydew2: 'rgb(224, 238, 224)',
491 honeydew3: 'rgb(193, 205, 193)',
492 honeydew4: 'rgb(131, 139, 131)',
493 hotpink: 'rgb(255, 105, 180)',
494 hotpink1: 'rgb(255, 110, 180)',
495 hotpink2: 'rgb(238, 106, 167)',
496 hotpink3: 'rgb(205, 96, 144)',
497 hotpink4: 'rgb(139, 58, 98)',
498 indianred: 'rgb(205, 92, 92)',
499 indianred1: 'rgb(255, 106, 106)',
500 indianred2: 'rgb(238, 99, 99)',
501 indianred3: 'rgb(205, 85, 85)',
502 indianred4: 'rgb(139, 58, 58)',
503 ivory: 'rgb(255, 255, 240)',
504 ivory1: 'rgb(255, 255, 240)',
505 ivory2: 'rgb(238, 238, 224)',
506 ivory3: 'rgb(205, 205, 193)',
507 ivory4: 'rgb(139, 139, 131)',
508 khaki: 'rgb(240, 230, 140)',
509 khaki1: 'rgb(255, 246, 143)',
510 khaki2: 'rgb(238, 230, 133)',
511 khaki3: 'rgb(205, 198, 115)',
512 khaki4: 'rgb(139, 134, 78)',
513 lavender: 'rgb(230, 230, 250)',
514 lavenderblush: 'rgb(255, 240, 245)',
515 lavenderblush1: 'rgb(255, 240, 245)',
516 lavenderblush2: 'rgb(238, 224, 229)',
517 lavenderblush3: 'rgb(205, 193, 197)',
518 lavenderblush4: 'rgb(139, 131, 134)',
519 lawngreen: 'rgb(124, 252, 0)',
520 lemonchiffon: 'rgb(255, 250, 205)',
521 lemonchiffon1: 'rgb(255, 250, 205)',
522 lemonchiffon2: 'rgb(238, 233, 191)',
523 lemonchiffon3: 'rgb(205, 201, 165)',
524 lemonchiffon4: 'rgb(139, 137, 112)',
525 lightblue: 'rgb(173, 216, 230)',
526 lightblue1: 'rgb(191, 239, 255)',
527 lightblue2: 'rgb(178, 223, 238)',
528 lightblue3: 'rgb(154, 192, 205)',
529 lightblue4: 'rgb(104, 131, 139)',
530 lightcoral: 'rgb(240, 128, 128)',
531 lightcyan: 'rgb(224, 255, 255)',
532 lightcyan1: 'rgb(224, 255, 255)',
533 lightcyan2: 'rgb(209, 238, 238)',
534 lightcyan3: 'rgb(180, 205, 205)',
535 lightcyan4: 'rgb(122, 139, 139)',
536 lightgoldenrod: 'rgb(238, 221, 130)',
537 lightgoldenrod1: 'rgb(255, 236, 139)',
538 lightgoldenrod2: 'rgb(238, 220, 130)',
539 lightgoldenrod3: 'rgb(205, 190, 112)',
540 lightgoldenrod4: 'rgb(139, 129, 76)',
541 lightgoldenrodyellow: 'rgb(250, 250, 210)',
542 lightgray: 'rgb(211, 211, 211)',
543 lightgreen: 'rgb(144, 238, 144)',
544 lightgrey: 'rgb(211, 211, 211)',
545 lightpink: 'rgb(255, 182, 193)',
546 lightpink1: 'rgb(255, 174, 185)',
547 lightpink2: 'rgb(238, 162, 173)',
548 lightpink3: 'rgb(205, 140, 149)',
549 lightpink4: 'rgb(139, 95, 101)',
550 lightsalmon: 'rgb(255, 160, 122)',
551 lightsalmon1: 'rgb(255, 160, 122)',
552 lightsalmon2: 'rgb(238, 149, 114)',
553 lightsalmon3: 'rgb(205, 129, 98)',
554 lightsalmon4: 'rgb(139, 87, 66)',
555 lightseagreen: 'rgb(32, 178, 170)',
556 lightskyblue: 'rgb(135, 206, 250)',
557 lightskyblue1: 'rgb(176, 226, 255)',
558 lightskyblue2: 'rgb(164, 211, 238)',
559 lightskyblue3: 'rgb(141, 182, 205)',
560 lightskyblue4: 'rgb(96, 123, 139)',
561 lightslateblue: 'rgb(132, 112, 255)',
562 lightslategray: 'rgb(119, 136, 153)',
563 lightslategrey: 'rgb(119, 136, 153)',
564 lightsteelblue: 'rgb(176, 196, 222)',
565 lightsteelblue1: 'rgb(202, 225, 255)',
566 lightsteelblue2: 'rgb(188, 210, 238)',
567 lightsteelblue3: 'rgb(162, 181, 205)',
568 lightsteelblue4: 'rgb(110, 123, 139)',
569 lightyellow: 'rgb(255, 255, 224)',
570 lightyellow1: 'rgb(255, 255, 224)',
571 lightyellow2: 'rgb(238, 238, 209)',
572 lightyellow3: 'rgb(205, 205, 180)',
573 lightyellow4: 'rgb(139, 139, 122)',
574 limegreen: 'rgb(50, 205, 50)',
575 linen: 'rgb(250, 240, 230)',
576 magenta: 'rgb(255, 0, 255)',
577 magenta1: 'rgb(255, 0, 255)',
578 magenta2: 'rgb(238, 0, 238)',
579 magenta3: 'rgb(205, 0, 205)',
580 magenta4: 'rgb(139, 0, 139)',
581 maroon: 'rgb(176, 48, 96)',
582 maroon1: 'rgb(255, 52, 179)',
583 maroon2: 'rgb(238, 48, 167)',
584 maroon3: 'rgb(205, 41, 144)',
585 maroon4: 'rgb(139, 28, 98)',
586 mediumaquamarine: 'rgb(102, 205, 170)',
587 mediumblue: 'rgb(0, 0, 205)',
588 mediumorchid: 'rgb(186, 85, 211)',
589 mediumorchid1: 'rgb(224, 102, 255)',
590 mediumorchid2: 'rgb(209, 95, 238)',
591 mediumorchid3: 'rgb(180, 82, 205)',
592 mediumorchid4: 'rgb(122, 55, 139)',
593 mediumpurple: 'rgb(147, 112, 219)',
594 mediumpurple1: 'rgb(171, 130, 255)',
595 mediumpurple2: 'rgb(159, 121, 238)',
596 mediumpurple3: 'rgb(137, 104, 205)',
597 mediumpurple4: 'rgb(93, 71, 139)',
598 mediumseagreen: 'rgb(60, 179, 113)',
599 mediumslateblue: 'rgb(123, 104, 238)',
600 mediumspringgreen: 'rgb(0, 250, 154)',
601 mediumturquoise: 'rgb(72, 209, 204)',
602 mediumvioletred: 'rgb(199, 21, 133)',
603 midnightblue: 'rgb(25, 25, 112)',
604 mintcream: 'rgb(245, 255, 250)',
605 mistyrose: 'rgb(255, 228, 225)',
606 mistyrose1: 'rgb(255, 228, 225)',
607 mistyrose2: 'rgb(238, 213, 210)',
608 mistyrose3: 'rgb(205, 183, 181)',
609 mistyrose4: 'rgb(139, 125, 123)',
610 moccasin: 'rgb(255, 228, 181)',
611 navajowhite: 'rgb(255, 222, 173)',
612 navajowhite1: 'rgb(255, 222, 173)',
613 navajowhite2: 'rgb(238, 207, 161)',
614 navajowhite3: 'rgb(205, 179, 139)',
615 navajowhite4: 'rgb(139, 121, 94)',
616 navy: 'rgb(0, 0, 128)',
617 navyblue: 'rgb(0, 0, 128)',
618 oldlace: 'rgb(253, 245, 230)',
619 olivedrab: 'rgb(107, 142, 35)',
620 olivedrab1: 'rgb(192, 255, 62)',
621 olivedrab2: 'rgb(179, 238, 58)',
622 olivedrab3: 'rgb(154, 205, 50)',
623 olivedrab4: 'rgb(105, 139, 34)',
624 orange: 'rgb(255, 165, 0)',
625 orange1: 'rgb(255, 165, 0)',
626 orange2: 'rgb(238, 154, 0)',
627 orange3: 'rgb(205, 133, 0)',
628 orange4: 'rgb(139, 90, 0)',
629 orangered: 'rgb(255, 69, 0)',
630 orangered1: 'rgb(255, 69, 0)',
631 orangered2: 'rgb(238, 64, 0)',
632 orangered3: 'rgb(205, 55, 0)',
633 orangered4: 'rgb(139, 37, 0)',
634 orchid: 'rgb(218, 112, 214)',
635 orchid1: 'rgb(255, 131, 250)',
636 orchid2: 'rgb(238, 122, 233)',
637 orchid3: 'rgb(205, 105, 201)',
638 orchid4: 'rgb(139, 71, 137)',
639 palegoldenrod: 'rgb(238, 232, 170)',
640 palegreen: 'rgb(152, 251, 152)',
641 palegreen1: 'rgb(154, 255, 154)',
642 palegreen2: 'rgb(144, 238, 144)',
643 palegreen3: 'rgb(124, 205, 124)',
644 palegreen4: 'rgb(84, 139, 84)',
645 paleturquoise: 'rgb(175, 238, 238)',
646 paleturquoise1: 'rgb(187, 255, 255)',
647 paleturquoise2: 'rgb(174, 238, 238)',
648 paleturquoise3: 'rgb(150, 205, 205)',
649 paleturquoise4: 'rgb(102, 139, 139)',
650 palevioletred: 'rgb(219, 112, 147)',
651 palevioletred1: 'rgb(255, 130, 171)',
652 palevioletred2: 'rgb(238, 121, 159)',
653 palevioletred3: 'rgb(205, 104, 137)',
654 palevioletred4: 'rgb(139, 71, 93)',
655 papayawhip: 'rgb(255, 239, 213)',
656 peachpuff: 'rgb(255, 218, 185)',
657 peachpuff1: 'rgb(255, 218, 185)',
658 peachpuff2: 'rgb(238, 203, 173)',
659 peachpuff3: 'rgb(205, 175, 149)',
660 peachpuff4: 'rgb(139, 119, 101)',
661 peru: 'rgb(205, 133, 63)',
662 pink: 'rgb(255, 192, 203)',
663 pink1: 'rgb(255, 181, 197)',
664 pink2: 'rgb(238, 169, 184)',
665 pink3: 'rgb(205, 145, 158)',
666 pink4: 'rgb(139, 99, 108)',
667 plum: 'rgb(221, 160, 221)',
668 plum1: 'rgb(255, 187, 255)',
669 plum2: 'rgb(238, 174, 238)',
670 plum3: 'rgb(205, 150, 205)',
671 plum4: 'rgb(139, 102, 139)',
672 powderblue: 'rgb(176, 224, 230)',
673 purple: 'rgb(160, 32, 240)',
674 purple1: 'rgb(155, 48, 255)',
675 purple2: 'rgb(145, 44, 238)',
676 purple3: 'rgb(125, 38, 205)',
677 purple4: 'rgb(85, 26, 139)',
678 red: 'rgb(255, 0, 0)',
679 red1: 'rgb(255, 0, 0)',
680 red2: 'rgb(238, 0, 0)',
681 red3: 'rgb(205, 0, 0)',
682 red4: 'rgb(139, 0, 0)',
683 rosybrown: 'rgb(188, 143, 143)',
684 rosybrown1: 'rgb(255, 193, 193)',
685 rosybrown2: 'rgb(238, 180, 180)',
686 rosybrown3: 'rgb(205, 155, 155)',
687 rosybrown4: 'rgb(139, 105, 105)',
688 royalblue: 'rgb(65, 105, 225)',
689 royalblue1: 'rgb(72, 118, 255)',
690 royalblue2: 'rgb(67, 110, 238)',
691 royalblue3: 'rgb(58, 95, 205)',
692 royalblue4: 'rgb(39, 64, 139)',
693 saddlebrown: 'rgb(139, 69, 19)',
694 salmon: 'rgb(250, 128, 114)',
695 salmon1: 'rgb(255, 140, 105)',
696 salmon2: 'rgb(238, 130, 98)',
697 salmon3: 'rgb(205, 112, 84)',
698 salmon4: 'rgb(139, 76, 57)',
699 sandybrown: 'rgb(244, 164, 96)',
700 seagreen: 'rgb(46, 139, 87)',
701 seagreen1: 'rgb(84, 255, 159)',
702 seagreen2: 'rgb(78, 238, 148)',
703 seagreen3: 'rgb(67, 205, 128)',
704 seagreen4: 'rgb(46, 139, 87)',
705 seashell: 'rgb(255, 245, 238)',
706 seashell1: 'rgb(255, 245, 238)',
707 seashell2: 'rgb(238, 229, 222)',
708 seashell3: 'rgb(205, 197, 191)',
709 seashell4: 'rgb(139, 134, 130)',
710 sienna: 'rgb(160, 82, 45)',
711 sienna1: 'rgb(255, 130, 71)',
712 sienna2: 'rgb(238, 121, 66)',
713 sienna3: 'rgb(205, 104, 57)',
714 sienna4: 'rgb(139, 71, 38)',
715 skyblue: 'rgb(135, 206, 235)',
716 skyblue1: 'rgb(135, 206, 255)',
717 skyblue2: 'rgb(126, 192, 238)',
718 skyblue3: 'rgb(108, 166, 205)',
719 skyblue4: 'rgb(74, 112, 139)',
720 slateblue: 'rgb(106, 90, 205)',
721 slateblue1: 'rgb(131, 111, 255)',
722 slateblue2: 'rgb(122, 103, 238)',
723 slateblue3: 'rgb(105, 89, 205)',
724 slateblue4: 'rgb(71, 60, 139)',
725 slategray: 'rgb(112, 128, 144)',
726 slategray1: 'rgb(198, 226, 255)',
727 slategray2: 'rgb(185, 211, 238)',
728 slategray3: 'rgb(159, 182, 205)',
729 slategray4: 'rgb(108, 123, 139)',
730 slategrey: 'rgb(112, 128, 144)',
731 snow: 'rgb(255, 250, 250)',
732 snow1: 'rgb(255, 250, 250)',
733 snow2: 'rgb(238, 233, 233)',
734 snow3: 'rgb(205, 201, 201)',
735 snow4: 'rgb(139, 137, 137)',
736 springgreen: 'rgb(0, 255, 127)',
737 springgreen1: 'rgb(0, 255, 127)',
738 springgreen2: 'rgb(0, 238, 118)',
739 springgreen3: 'rgb(0, 205, 102)',
740 springgreen4: 'rgb(0, 139, 69)',
741 steelblue: 'rgb(70, 130, 180)',
742 steelblue1: 'rgb(99, 184, 255)',
743 steelblue2: 'rgb(92, 172, 238)',
744 steelblue3: 'rgb(79, 148, 205)',
745 steelblue4: 'rgb(54, 100, 139)',
746 tan: 'rgb(210, 180, 140)',
747 tan1: 'rgb(255, 165, 79)',
748 tan2: 'rgb(238, 154, 73)',
749 tan3: 'rgb(205, 133, 63)',
750 tan4: 'rgb(139, 90, 43)',
751 thistle: 'rgb(216, 191, 216)',
752 thistle1: 'rgb(255, 225, 255)',
753 thistle2: 'rgb(238, 210, 238)',
754 thistle3: 'rgb(205, 181, 205)',
755 thistle4: 'rgb(139, 123, 139)',
756 tomato: 'rgb(255, 99, 71)',
757 tomato1: 'rgb(255, 99, 71)',
758 tomato2: 'rgb(238, 92, 66)',
759 tomato3: 'rgb(205, 79, 57)',
760 tomato4: 'rgb(139, 54, 38)',
761 turquoise: 'rgb(64, 224, 208)',
762 turquoise1: 'rgb(0, 245, 255)',
763 turquoise2: 'rgb(0, 229, 238)',
764 turquoise3: 'rgb(0, 197, 205)',
765 turquoise4: 'rgb(0, 134, 139)',
766 violet: 'rgb(238, 130, 238)',
767 violetred: 'rgb(208, 32, 144)',
768 violetred1: 'rgb(255, 62, 150)',
769 violetred2: 'rgb(238, 58, 140)',
770 violetred3: 'rgb(205, 50, 120)',
771 violetred4: 'rgb(139, 34, 82)',
772 wheat: 'rgb(245, 222, 179)',
773 wheat1: 'rgb(255, 231, 186)',
774 wheat2: 'rgb(238, 216, 174)',
775 wheat3: 'rgb(205, 186, 150)',
776 wheat4: 'rgb(139, 126, 102)',
777 white: 'rgb(255, 255, 255)',
778 whitesmoke: 'rgb(245, 245, 245)',
779 yellow: 'rgb(255, 255, 0)',
780 yellow1: 'rgb(255, 255, 0)',
781 yellow2: 'rgb(238, 238, 0)',
782 yellow3: 'rgb(205, 205, 0)',
783 yellow4: 'rgb(139, 139, 0)',
784 yellowgreen: 'rgb(154, 205, 50)'
785}, lib.f = {}, lib.f.replaceVars = function(e, t) {
786 return e.replace(/%([a-z]*)\(([^\)]+)\)/gi, function(e, r, o) {
787 if ('undefined' == typeof t[o]) throw 'Unknown variable: ' + o;
788 var i = t[o];
789 if (r in lib.f.replaceVars.functions) i = lib.f.replaceVars.functions[r](i);
790 else if (r) throw 'Unknown escape function: ' + r;
791 return i;
792 });
793};, lib.f.replaceVars.functions = {
794 encodeURI: encodeURI,
795 encodeURIComponent: encodeURIComponent,
796 escapeHTML: function(e) {
797 var t = {
798 '<': '&lt;',
799 '>': '&gt;',
800 '&': '&amp;',
801 '"': '&quot;',
802 "'": '&#39;'
803 };
804 return e.replace(/[<>&\"\']/g, function(e) {
805 return t[e];
806 });
807 }
808}, lib.f.getAcceptLanguages = function(e) {
809 lib.f.getAcceptLanguages.chromeSupported() ? chrome.i18n.getAcceptLanguages(e) : setTimeout(function() {
810 e([navigator.language.replace(/-/g, '_')]);
811 }, 0);
812};, lib.f.getAcceptLanguages.chromeSupported = function() {
813 return window.chrome && chrome.i18n;
814};, lib.f.parseQuery = function(e) {
815 '?' == e.substr(0, 1) && (e = e.substr(1));
816 for (var t = {}, r = e.split('&'), o = 0; o < r.length; o++) {
817 var i = r[o].split('=');
818 t[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
819 }
820 return t;
821};, lib.f.getURL = function(e) {
822 return lib.f.getURL.chromeSupported() ? chrome.runtime.getURL(e) : e;
823};, lib.f.getURL.chromeSupported = function() {
824 return window.chrome && chrome.runtime && chrome.runtime.getURL;
825};, lib.f.clamp = function(e, t, r) {
826 return t > e ? t : e > r ? r : e
827};, lib.f.lpad = function(e, t, r) {
828 for (e = String(e), r = r || ' '; e.length < t;) e = r + e;
829 return e;
830};, lib.f.zpad = function(e, t) {
831 return lib.f.lpad(e, t, '0');
832};, lib.f.getWhitespace = function(e) {
833 if (0 >= e) return '';
834 var t = this.getWhitespace;
835 for (t.whitespace || (t.whitespace = ' '); e > t.whitespace.length;) t.whitespace += t.whitespace;
836 return t.whitespace.substr(0, e);
837};, lib.f.alarm = function(e, t) {
838 var r = t || 5e3,
839 o = lib.f.getStack(1);
840 return function() {
841 var t = setTimeout(function() {
842 var i = 'string' == typeof e ? i : e.name;
843 i = i ? ': ' + i : '', console.warn('lib.f.alarm: timeout expired: ' + r / 1e3 + 's' + i), console.log(o), t = null;
844 }, r),
845 i = function(e) {
846 return function() {
847 return t && (clearTimeout(t), t = null), e.apply(null, arguments);
848 }
849 };
850 return 'string' == typeof e ? i : i(e);
851 }();
852};, lib.f.getStack = function(e) {
853 var t, r = e ? e + 2 : 2;
854 try {
855 throw new Error;
856 }
857 catch (o) {
858 t = o.stack.split('\n');
859 }
860 for (var i = {}, s = r; s < t.length; s++) i[s - r] = t[s].replace(/^\s*at\s+/, '');
861 return i;
862};, lib.f.smartFloorDivide = function(e, t) {
863 var r = e / t,
864 o = Math.ceil(r);
865 return 1e-4 > o - r ? o : Math.floor(r);
866};, lib.MessageManager = function(e) {
867 this.languages_ = e.map(function(e) {
868 return e.replace(/-/g, '_');
869 }), -1 == this.languages_.indexOf('en') && this.languages_.unshift('en'), this.messages = {};
870};, lib.MessageManager.prototype.addMessages = function(e) {
871 for (var t in e) {
872 var r = e[t];
873 r.placeholders ? this.messages[t] = r.message.replace(/\$([a-z][^\s\$]+)\$/gi, function(r, o) {
874 return e[t].placeholders[o.toLowerCase()].content;
875 }) : this.messages[t] = r.message;
876 }
877};, lib.MessageManager.prototype.findAndLoadMessages = function(e, t) {
878 function r(e) {
879 e ? i = o.shift() : s = o.shift(), o.length ? n() : t(i, s);
880 }
881 var o = this.languages_.concat(),
882 i = [],
883 s = [],
884 n = function() {
885 this.loadMessages(this.replaceReferences(e, o), r.bind(this, !0), r.bind(this, !1));
886 }.bind(this);
887 n();
888};, lib.MessageManager.prototype.loadMessages = function(e, t, r) {
889 var o = new XMLHttpRequest;
890 o.onloadend = function() {
891 return 200 != o.status ? void(r && r(o.status)) : (this.addMessages(JSON.parse(o.responseText)), void t());
892 }.bind(this), o.open('GET', e), o.send();
893};, lib.MessageManager.replaceReferences = function(e, t) {
894 return e.replace(/\$(\d+)/g, function(e, r) {
895 return t[r - 1];
896 });
897};, lib.MessageManager.prototype.replaceReferences = lib.MessageManager.replaceReferences, lib.MessageManager.prototype.get = function(e, t, r) {
898 var o;
899 if (e in this.messages) o = this.messages[e];
900 else if (window.chrome.i18n && (o = chrome.i18n.getMessage(e)), !o) return console.warn('Unknown message: ' + e), 'undefined' == typeof r ? e : r;
901 return t ? (t instanceof Array || (t = [t]), this.replaceReferences(o, t)) : o;
902};, lib.MessageManager.prototype.processI18nAttributes = function(e) {
903 function t(e) {
904 return e.replace(/-/g, '_').toUpperCase();
905 }
906 for (var r = e.querySelectorAll('[i18n]'), o = 0; o < r.length; o++) {
907 var i = r[o],
908 s = i.getAttribute('i18n');
909 if (s) {
910 try {
911 s = JSON.parse(s);
912 }
913 catch (n) {
914 throw console.error("Can't parse " + i.tagName + '#' + i.id + ': ' + s), n;
915 }
916 for (var a in s) {
917 var l = s[a];
918 '$' == l.substr(0, 1) && (l = t(i.getAttribute(l.substr(1)) + '_' + a));
919 var h = this.get(l);
920 '_' == a ? i.textContent = h : i.setAttribute(a, h);
921 }
922 }
923 }
924};, lib.PreferenceManager = function(e, t) {
925 this.storage = e, this.storageObserver_ = this.onStorageChange_.bind(this), this.isActive_ = !1, this.activate(), this.trace = !1;
926 var r = t || '/';
927 '/' != r.substr(r.length - 1) && (r += '/'), this.prefix = r, this.prefRecords_ = {}, this.globalObservers_ = [], this.childFactories_ = {}, this.childLists_ = {};
928};, lib.PreferenceManager.prototype.DEFAULT_VALUE = new String('DEFAULT'), lib.PreferenceManager.Record = function(e, t) {
929 this.name = e, this.defaultValue = t, this.currentValue = this.DEFAULT_VALUE, this.observers = [];
930};, lib.PreferenceManager.Record.prototype.DEFAULT_VALUE = lib.PreferenceManager.prototype.DEFAULT_VALUE, lib.PreferenceManager.Record.prototype.addObserver = function(e) {
931 this.observers.push(e);
932};, lib.PreferenceManager.Record.prototype.removeObserver = function(e) {
933 var t = this.observers.indexOf(e);
934 t >= 0 && this.observers.splice(t, 1);
935};, lib.PreferenceManager.Record.prototype.get = function() {
936 return this.currentValue === this.DEFAULT_VALUE ? /^(string|number)$/.test(typeof this.defaultValue) ? this.defaultValue : 'object' == typeof this.defaultValue ? JSON.parse(JSON.stringify(this.defaultValue)) : this.defaultValue : this.currentValue
937};, lib.PreferenceManager.prototype.deactivate = function() {
938 if (!this.isActive_) throw new Error('Not activated');
939 this.isActive_ = !1, this.storage.removeObserver(this.storageObserver_);
940};, lib.PreferenceManager.prototype.activate = function() {
941 if (this.isActive_) throw new Error('Already activated');
942 this.isActive_ = !0, this.storage.addObserver(this.storageObserver_);
943};, lib.PreferenceManager.prototype.readStorage = function(e) {
944 function t() {
945 0 == --r && e && e();
946 }
947 var r = 0,
948 o = Object.keys(this.prefRecords_).map(function(e) {
949 return this.prefix + e;
950 }.bind(this));
951 this.trace && console.log('Preferences read: ' + this.prefix),
952 this.storage.getItems(o, function(o) {
953 var i = this.prefix.length;
954 for (var s in o) {
955 var n = o[s],
956 a = s.substr(i),
957 l = a in this.childLists_ && JSON.stringify(n) != JSON.stringify(this.prefRecords_[a].currentValue);
958 this.prefRecords_[a].currentValue = n, l && (r++, this.syncChildList(a, t));
959 }
960 0 == r && e && setTimeout(e);
961 }.bind(this));
962};, lib.PreferenceManager.prototype.definePreference = function(e, t, r) {
963 var o = this.prefRecords_[e];
964 o ? this.changeDefault(e, t) : o = this.prefRecords_[e] = new lib.PreferenceManager.Record(e, t), r && o.addObserver(r);
965};, lib.PreferenceManager.prototype.definePreferences = function(e) {
966 for (var t = 0; t < e.length; t++) this.definePreference(e[t][0], e[t][1], e[t][2]);
967};, lib.PreferenceManager.prototype.defineChildren = function(e, t) {
968 this.definePreference(e, [], this.onChildListChange_.bind(this, e)), this.childFactories_[e] = t, this.childLists_[e] = {};
969};, lib.PreferenceManager.prototype.addObservers = function(e, t) {
970 if (e && 'function' != typeof e) throw new Error('Invalid param: globals');
971 if (e && this.globalObservers_.push(e), t)
972 for (var r in t) {
973 if (!(r in this.prefRecords_)) throw new Error('Unknown preference: ' + r);
974 this.prefRecords_[r].addObserver(t[r]);
975 }
976};, lib.PreferenceManager.prototype.notifyAll = function() {
977 for (var e in this.prefRecords_) this.notifyChange_(e);
978};, lib.PreferenceManager.prototype.notifyChange_ = function(e) {
979 var t = this.prefRecords_[e];
980 if (!t) throw new Error('Unknown preference: ' + e);
981 for (var r = t.get(), o = 0; o < this.globalObservers_.length; o++) this.globalObservers_[o](e, r);
982 for (var o = 0; o < t.observers.length; o++) t.observers[o](r, e, this);
983};, lib.PreferenceManager.prototype.createChild = function(e, t, r) {
984 var o, i = this.get(e);
985 if (r) {
986 if (o = r, -1 != i.indexOf(o)) throw new Error('Duplicate child: ' + e + ': ' + o);
987 }
988 else
989 for (; !o || -1 != i.indexOf(o);) o = Math.floor(65535 * Math.random() + 1).toString(16), o = lib.f.zpad(o, 4), t && (o = t + ':' + o);
990 var s = this.childFactories_[e](this, o);
991 return s.trace = this.trace, s.resetAll(), this.childLists_[e][o] = s, i.push(o), this.set(e, i), s;
992};, lib.PreferenceManager.prototype.removeChild = function(e, t) {
993 var r = this.getChild(e, t);
994 r.resetAll();
995 var o = this.get(e),
996 i = o.indexOf(t); - 1 != i && (o.splice(i, 1), this.set(e, o)), delete this.childLists_[e][t];
997};, lib.PreferenceManager.prototype.getChild = function(e, t, r) {
998 if (!(e in this.childLists_)) throw new Error('Unknown child list: ' + e);
999 var o = this.childLists_[e];
1000 if (!(t in o)) {
1001 if ('undefined' == typeof r) throw new Error('Unknown "' + e + '" child: ' + t);
1002 return r;
1003 }
1004 return o[t];
1005};, lib.PreferenceManager.diffChildLists = function(e, t) {
1006 for (var r = {
1007 added: {},
1008 removed: {},
1009 common: {}
1010 }, o = 0; o < e.length; o++) - 1 != t.indexOf(e[o]) ? r.common[e[o]] = !0 : r.added[e[o]] = !0;
1011 for (var o = 0; o < t.length; o++) t[o] in r.added || t[o] in r.common || (r.removed[t[o]] = !0);
1012 return r;
1013};, lib.PreferenceManager.prototype.syncChildList = function(e, t) {
1014 function r() {
1015 0 == --o && t && t();
1016 }
1017 for (var o = 0, i = this.get(e), s = Object.keys(this.childLists_[e]), n = (lib.PreferenceManager.diffChildLists(i, s), 0); n < i.length; n++) {
1018 var a = i[n],
1019 l = s.indexOf(a);
1020 if (l >= 0 && s.splice(l, 1), !this.childLists_[e][a]) {
1021 var h = this.childFactories_[e](this, a);
1022 if (!h) {
1023 console.warn('Unable to restore child: ' + e + ': ' + a);
1024 continue;
1025 }
1026 h.trace = this.trace, this.childLists_[e][a] = h, o++, h.readStorage(r);
1027 }
1028 }
1029 for (var n = 0; n < s.length; n++) delete this.childLists_[e][s[n]];
1030 !o && t && setTimeout(t);
1031};, lib.PreferenceManager.prototype.reset = function(e) {
1032 var t = this.prefRecords_[e];
1033 if (!t) throw new Error('Unknown preference: ' + e);
1034 this.storage.removeItem(this.prefix + e), t.currentValue !== this.DEFAULT_VALUE && (t.currentValue = this.DEFAULT_VALUE, this.notifyChange_(e));
1035};, lib.PreferenceManager.prototype.resetAll = function() {
1036 var e = [];
1037 for (var t in this.childLists_) {
1038 var r = this.childLists_[t];
1039 for (var o in r) r[o].resetAll();
1040 }
1041 for (var i in this.prefRecords_) this.prefRecords_[i].currentValue !== this.DEFAULT_VALUE && (this.prefRecords_[i].currentValue = this.DEFAULT_VALUE, e.push(i));
1042 var s = Object.keys(this.prefRecords_).map(function(e) {
1043 return this.prefix + e;
1044 }.bind(this));
1045 this.storage.removeItems(s), e.forEach(this.notifyChange_.bind(this));
1046};, lib.PreferenceManager.prototype.diff = function(e, t) {
1047 return typeof e == typeof t && /^(undefined|boolean|number|string)$/.test(typeof e) ? e !== t : !0;
1048};, lib.PreferenceManager.prototype.changeDefault = function(e, t) {
1049 var r = this.prefRecords_[e];
1050 if (!r) throw new Error('Unknown preference: ' + e);
1051 if (this.diff(r.defaultValue, t)) {
1052 if (r.currentValue !== this.DEFAULT_VALUE) return void(r.defaultValue = t);
1053 r.defaultValue = t, this.notifyChange_(e);
1054 }
1055};, lib.PreferenceManager.prototype.changeDefaults = function(e) {
1056 for (var t in e) this.changeDefault(t, e[t]);
1057};, lib.PreferenceManager.prototype.set = function(e, t) {
1058 var r = this.prefRecords_[e];
1059 if (!r) throw new Error('Unknown preference: ' + e);
1060 var o = r.get();
1061 this.diff(o, t) && (this.diff(r.defaultValue, t) ? (r.currentValue = t, this.storage.setItem(this.prefix + e, t)) : (r.currentValue = this.DEFAULT_VALUE, this.storage.removeItem(this.prefix + e)), setTimeout(this.notifyChange_.bind(this, e), 0));
1062};, lib.PreferenceManager.prototype.get = function(e) {
1063 var t = this.prefRecords_[e];
1064 if (!t) throw new Error('Unknown preference: ' + e);
1065 return t.get();
1066};, lib.PreferenceManager.prototype.exportAsJson = function() {
1067 var e = {};
1068 for (var t in this.prefRecords_)
1069 if (t in this.childLists_) {
1070 e[t] = [];
1071 for (var r = this.get(t), o = 0; o < r.length; o++) {
1072 var i = r[o];
1073 e[t].push({
1074 id: i,
1075 json: this.getChild(t, i).exportAsJson()
1076 });
1077 }
1078 }
1079 else {
1080 var s = this.prefRecords_[t];
1081 s.currentValue != this.DEFAULT_VALUE && (e[t] = s.currentValue);
1082 }
1083 return e;
1084};, lib.PreferenceManager.prototype.importFromJson = function(e) {
1085 for (var t in e)
1086 if (t in this.childLists_)
1087 for (var r = e[t], o = 0; o < r.length; o++) {
1088 var i = r[o].id,
1089 s = this.childLists_[t][i];
1090 s || (s = this.createChild(t, null, i)), s.importFromJson(r[o].json);
1091 }
1092 else this.set(t, e[t]);
1093};, lib.PreferenceManager.prototype.onChildListChange_ = function(e) {
1094 this.syncChildList(e);
1095};, lib.PreferenceManager.prototype.onStorageChange_ = function(e) {
1096 for (var t in e)
1097 if (!this.prefix || 0 == t.lastIndexOf(this.prefix, 0)) {
1098 var r = t.substr(this.prefix.length);
1099 if (r in this.prefRecords_) {
1100 var o = this.prefRecords_[r],
1101 i = e[t].newValue,
1102 s = o.currentValue;
1103 s === o.DEFAULT_VALUE && (s = void 0), this.diff(s, i) && ('undefined' == typeof i ? o.currentValue = o.DEFAULT_VALUE : o.currentValue = i, this.notifyChange_(r));
1104 }
1105 }
1106};, lib.resource = {
1107 resources_: {}
1108}, lib.resource.add = function(e, t, r) {
1109 lib.resource.resources_[e] = {
1110 type: t,
1111 name: e,
1112 data: r
1113 };
1114};, lib.resource.get = function(e, t) {
1115 if (!(e in lib.resource.resources_)) {
1116 if ('undefined' == typeof t) throw 'Unknown resource: ' + e;
1117 return t;
1118 }
1119 return lib.resource.resources_[e];
1120};, lib.resource.getData = function(e, t) {
1121 if (!(e in lib.resource.resources_)) {
1122 if ('undefined' == typeof t) throw 'Unknown resource: ' + e;
1123 return t;
1124 }
1125 return lib.resource.resources_[e].data;
1126};, lib.resource.getDataUrl = function(e, t) {
1127 var r = lib.resource.get(e, t);
1128 return 'data:' + r.type + ',' + r.data;
1129};, lib.Storage = new Object, lib.Storage.Chrome = function(e) {
1130 this.storage_ = e, this.observers_ = [], chrome.storage.onChanged.addListener(this.onChanged_.bind(this));
1131};, lib.Storage.Chrome.prototype.onChanged_ = function(e, t) {
1132 if (chrome.storage[t] == this.storage_)
1133 for (var r = 0; r < this.observers_.length; r++) this.observers_[r](e);
1134};, lib.Storage.Chrome.prototype.addObserver = function(e) {
1135 this.observers_.push(e);
1136};, lib.Storage.Chrome.prototype.removeObserver = function(e) {
1137 var t = this.observers_.indexOf(e); - 1 != t && this.observers_.splice(t, 1);
1138};, lib.Storage.Chrome.prototype.clear = function(e) {
1139 this.storage_.clear(), e && setTimeout(e, 0);
1140};, lib.Storage.Chrome.prototype.getItem = function(e, t) {
1141 this.storage_.get(e, t);
1142};, lib.Storage.Chrome.prototype.getItems = function(e, t) {
1143 this.storage_.get(e, t);
1144};, lib.Storage.Chrome.prototype.setItem = function(e, t, r) {
1145 var o = {};
1146 o[e] = t, this.storage_.set(o, r);
1147};, lib.Storage.Chrome.prototype.setItems = function(e, t) {
1148 this.storage_.set(e, t);
1149};, lib.Storage.Chrome.prototype.removeItem = function(e, t) {
1150 this.storage_.remove(e, t);
1151};, lib.Storage.Chrome.prototype.removeItems = function(e, t) {
1152 this.storage_.remove(e, t);
1153};, lib.Storage.Local = function() {
1154 this.observers_ = [], this.storage_ = window.localStorage, window.addEventListener('storage', this.onStorage_.bind(this));
1155};, lib.Storage.Local.prototype.onStorage_ = function(e) {
1156 if (e.storageArea == this.storage_) {
1157 var t = e.oldValue ? JSON.parse(e.oldValue) : '',
1158 r = e.newValue ? JSON.parse(e.newValue) : '',
1159 o = {};
1160 o[e.key] = {
1161 oldValue: t,
1162 newValue: r
1163 };
1164 for (var i = 0; i < this.observers_.length; i++) this.observers_[i](o);
1165 }
1166};, lib.Storage.Local.prototype.addObserver = function(e) {
1167 this.observers_.push(e);
1168};, lib.Storage.Local.prototype.removeObserver = function(e) {
1169 var t = this.observers_.indexOf(e); - 1 != t && this.observers_.splice(t, 1);
1170};, lib.Storage.Local.prototype.clear = function(e) {
1171 this.storage_.clear(), e && setTimeout(e, 0);
1172};, lib.Storage.Local.prototype.getItem = function(e, t) {
1173 var r = this.storage_.getItem(e);
1174 if ('string' == typeof r) try {
1175 r = JSON.parse(r);
1176 }
1177 catch (o) {}
1178 setTimeout(t.bind(null, r), 0);
1179};, lib.Storage.Local.prototype.getItems = function(e, t) {
1180 for (var r = {}, o = e.length - 1; o >= 0; o--) {
1181 var i = e[o],
1182 s = this.storage_.getItem(i);
1183 if ('string' == typeof s) try {
1184 r[i] = JSON.parse(s);
1185 }
1186 catch (n) {
1187 r[i] = s;
1188 }
1189 else e.splice(o, 1);
1190 }
1191 setTimeout(t.bind(null, r), 0);
1192};, lib.Storage.Local.prototype.setItem = function(e, t, r) {
1193 this.storage_.setItem(e, JSON.stringify(t)), r && setTimeout(r, 0);
1194};, lib.Storage.Local.prototype.setItems = function(e, t) {
1195 for (var r in e) this.storage_.setItem(r, JSON.stringify(e[r]));
1196 t && setTimeout(t, 0);
1197};, lib.Storage.Local.prototype.removeItem = function(e, t) {
1198 this.storage_.removeItem(e), t && setTimeout(t, 0);
1199};, lib.Storage.Local.prototype.removeItems = function(e, t) {
1200 for (var r = 0; r < e.length; r++) this.storage_.removeItem(e[r]);
1201 t && setTimeout(t, 0);
1202};, lib.Storage.Memory = function() {
1203 this.observers_ = [], this.storage_ = {};
1204};, lib.Storage.Memory.prototype.addObserver = function(e) {
1205 this.observers_.push(e);
1206};, lib.Storage.Memory.prototype.removeObserver = function(e) {
1207 var t = this.observers_.indexOf(e); - 1 != t && this.observers_.splice(t, 1);
1208};, lib.Storage.Memory.prototype.clear = function(e) {
1209 var t = {};
1210 for (var r in this.storage_) t[r] = {
1211 oldValue: this.storage_[r],
1212 newValue: void 0
1213 };
1214 this.storage_ = {}, setTimeout(function() {
1215 for (var e = 0; e < this.observers_.length; e++) this.observers_[e](t);
1216 }.bind(this), 0), e && setTimeout(e, 0);
1217};, lib.Storage.Memory.prototype.getItem = function(e, t) {
1218 var r = this.storage_[e];
1219 if ('string' == typeof r) try {
1220 r = JSON.parse(r);
1221 }
1222 catch (o) {}
1223 setTimeout(t.bind(null, r), 0);
1224};, lib.Storage.Memory.prototype.getItems = function(e, t) {
1225 for (var r = {}, o = e.length - 1; o >= 0; o--) {
1226 var i = e[o],
1227 s = this.storage_[i];
1228 if ('string' == typeof s) try {
1229 r[i] = JSON.parse(s);
1230 }
1231 catch (n) {
1232 r[i] = s;
1233 }
1234 else e.splice(o, 1);
1235 }
1236 setTimeout(t.bind(null, r), 0);
1237};, lib.Storage.Memory.prototype.setItem = function(e, t, r) {
1238 var o = this.storage_[e];
1239 this.storage_[e] = JSON.stringify(t);
1240 var i = {};
1241 i[e] = {
1242 oldValue: o,
1243 newValue: t
1244 }, setTimeout(function() {
1245 for (var e = 0; e < this.observers_.length; e++) this.observers_[e](i);
1246 }.bind(this), 0), r && setTimeout(r, 0);
1247};, lib.Storage.Memory.prototype.setItems = function(e, t) {
1248 var r = {};
1249 for (var o in e) r[o] = {
1250 oldValue: this.storage_[o],
1251 newValue: e[o]
1252 }, this.storage_[o] = JSON.stringify(e[o]);
1253 setTimeout(function() {
1254 for (var e = 0; e < this.observers_.length; e++) this.observers_[e](r);
1255 }.bind(this)), t && setTimeout(t, 0);
1256};, lib.Storage.Memory.prototype.removeItem = function(e, t) {
1257 delete this.storage_[e], t && setTimeout(t, 0);
1258};, lib.Storage.Memory.prototype.removeItems = function(e, t) {
1259 for (var r = 0; r < e.length; r++) delete this.storage_[e[r]];
1260 t && setTimeout(t, 0);
1261};, lib.TestManager = function(e) {
1262 this.log = e || new lib.TestManager.Log;
1263};, lib.TestManager.prototype.createTestRun = function(e) {
1264 return new lib.TestManager.TestRun(this, e);
1265};, lib.TestManager.prototype.onTestRunComplete = function(e) {};, lib.TestManager.prototype.testPreamble = function(e, t) {};, lib.TestManager.prototype.testPostamble = function(e, t) {};, lib.TestManager.Log = function(e) {
1266 this.save = !1, this.data = '', this.logFunction_ = e || function(e) {
1267 this.save && (this.data += e + '\n'), console.log(e);
1268 };, this.pending_ = '', this.prefix_ = '', this.prefixStack_ = [];
1269};, lib.TestManager.Log.prototype.pushPrefix = function(e) {
1270 this.prefixStack_.push(e), this.prefix_ = this.prefixStack_.join('');
1271};, lib.TestManager.Log.prototype.popPrefix = function() {
1272 this.prefixStack_.pop(), this.prefix_ = this.prefixStack_.join('');
1273};, lib.TestManager.Log.prototype.print = function(e) {
1274 this.pending_ ? this.pending_ += e : this.pending_ = this.prefix_ + e;
1275};, lib.TestManager.Log.prototype.println = function(e) {
1276 this.pending_ && this.flush(), this.logFunction_(this.prefix_ + e);
1277};, lib.TestManager.Log.prototype.flush = function() {
1278 this.pending_ && (this.logFunction_(this.pending_), this.pending_ = '');
1279};, lib.TestManager.Suite = function(e) {
1280 function t(t, r) {
1281 this.testManager_ = t, this.suiteName = e, this.setup(r);
1282 }
1283 return t.suiteName = e, t.addTest = lib.TestManager.Suite.addTest, t.disableTest = lib.TestManager.Suite.disableTest, t.getTest = lib.TestManager.Suite.getTest, t.getTestList = lib.TestManager.Suite.getTestList, t.testList_ = [], t.testMap_ = {}, t.prototype = {
1284 __proto__: lib.TestManager.Suite.prototype
1285 }, lib.TestManager.Suite.subclasses.push(t), t;
1286};, lib.TestManager.Suite.subclasses = [], lib.TestManager.Suite.addTest = function(e, t) {
1287 if (e in this.testMap_) throw 'Duplicate test name: ' + e;
1288 var r = new lib.TestManager.Test(this, e, t);
1289 this.testMap_[e] = r, this.testList_.push(r);
1290};, lib.TestManager.Suite.disableTest = function(e, t) {
1291 if (e in this.testMap_) throw 'Duplicate test name: ' + e;
1292 var r = new lib.TestManager.Test(this, e, t);
1293 console.log('Disabled test: ' + r.fullName);
1294};, lib.TestManager.Suite.getTest = function(e) {
1295 return this.testMap_[e];
1296};, lib.TestManager.Suite.getTestList = function() {
1297 return this.testList_;
1298};, lib.TestManager.Suite.prototype.setDefaults = function(e, t) {
1299 for (var r in t) this[r] = r in e ? e[r] : t[r];
1300};, lib.TestManager.Suite.prototype.setup = function(e) {};, lib.TestManager.Suite.prototype.preamble = function(e, t) {};, lib.TestManager.Suite.prototype.postamble = function(e, t) {};, lib.TestManager.Test = function(e, t, r) {
1301 this.suiteClass = e, this.testName = t, this.fullName = e.suiteName + '[' + t + ']', this.testFunction_ = r;
1302};, lib.TestManager.Test.prototype.run = function(e) {
1303 try {
1304 this.testFunction_.apply(e.suite, [e, e.testRun.cx]);
1305 }
1306 catch (t) {
1307 if (t instanceof lib.TestManager.Result.TestComplete) return;
1308 e.println('Test raised an exception: ' + t), t.stack && (t.stack instanceof Array ? e.println(t.stack.join('\n')) : e.println(t.stack)), e.completeTest_(e.FAILED, !1);
1309 }
1310};, lib.TestManager.TestRun = function(e, t) {
1311 this.testManager = e, this.log = e.log, this.cx = t || {}, this.failures = [], this.passes = [], this.startDate = null, this.duration = null, this.currentResult = null, this.maxFailures = 0, this.panic = !1, this.testQueue_ = [];
1312};, lib.TestManager.TestRun.prototype.ALL_TESTS = new String('<all-tests>'), lib.TestManager.TestRun.prototype.selectTest = function(e) {
1313 this.testQueue_.push(e);
1314};, lib.TestManager.TestRun.prototype.selectSuite = function(e, t) {
1315 for (var r = t || this.ALL_TESTS, o = 0, i = e.getTestList(), s = 0; s < i.length; s++) {
1316 var n = i[s];
1317 if (r !== this.ALL_TESTS)
1318 if (r instanceof RegExp) {
1319 if (!r.test(n.testName)) continue;
1320 }
1321 else if (n.testName != r) continue;
1322 this.selectTest(n), o++;
1323 }
1324 return o;
1325};, lib.TestManager.TestRun.prototype.selectPattern = function(e) {
1326 for (var t = 0, r = 0; r < lib.TestManager.Suite.subclasses.length; r++) t += this.selectSuite(lib.TestManager.Suite.subclasses[r], e);
1327 return t || this.log.println('No tests matched selection criteria: ' + e), t;
1328};, lib.TestManager.TestRun.prototype.onUncaughtException_ = function(e, t, r) {
1329 if (0 == e.indexOf('Uncaught lib.TestManager.Result.TestComplete') || -1 != e.indexOf('status: passed')) return !0;
1330 if (this.currentResult && e != 'Uncaught ' + this.currentResult.expectedErrorMessage_) {
1331 var o = 'during';
1332 return this.currentResult.status != this.currentResult.PENDING && (o = 'after'), this.log.println('Uncaught exception ' + o + ' test case: ' + this.currentResult.test.fullName), this.log.println(e + ', ' + t + ':' + r), this.currentResult.completeTest_(this.currentResult.FAILED, !1), !1;
1333 }
1334};, lib.TestManager.TestRun.prototype.onTestRunComplete_ = function(e) {
1335 return e ? (this.duration = new Date - this.startDate, this.log.popPrefix(), this.log.println('} ' + this.passes.length + ' passed, ' + this.failures.length + ' failed, ' + this.msToSeconds_(this.duration)), this.log.println(''), this.summarize(), window.onerror = null, void this.testManager.onTestRunComplete(this)) : void setTimeout(this.onTestRunComplete_.bind(this), 0, !0);
1336};, lib.TestManager.TestRun.prototype.onResultComplete = function(e) {
1337 try {
1338 this.testManager.testPostamble(e, this.cx), e.suite.postamble(e, this.ctx);
1339 }
1340 catch (t) {
1341 this.log.println('Unexpected exception in postamble: ' + (t.stack ? t.stack : t)), this.panic = !0;
1342 }
1343 if (this.log.popPrefix(), this.log.print('} ' + e.status + ', ' + this.msToSeconds_(e.duration)), this.log.flush(), e.status == e.FAILED) this.failures.push(e), this.currentSuite = null;
1344 else {
1345 if (e.status != e.PASSED) return this.log.println('Unknown result status: ' + e.test.fullName + ': ' + e.status), this.panic = !0;
1346 this.passes.push(e);
1347 }
1348 this.runNextTest_();
1349};, lib.TestManager.TestRun.prototype.onResultReComplete = function(e, t) {
1350 this.log.println('Late complete for test: ' + e.test.fullName + ': ' + t);
1351 var r = this.passes.indexOf(e);
1352 r >= 0 && (this.passes.splice(r, 1), this.failures.push(e));
1353};, lib.TestManager.TestRun.prototype.runNextTest_ = function() {
1354 if (this.panic || !this.testQueue_.length) return this.onTestRunComplete_();
1355 if (this.maxFailures && this.failures.length >= this.maxFailures) return this.log.println('Maximum failure count reached, aborting test run.'), this.onTestRunComplete_();
1356 var e = this.testQueue_[0],
1357 t = this.currentResult ? this.currentResult.suite : null;
1358 try {
1359 t && t instanceof e.suiteClass || (this.log.println('Initializing suite: ' + e.suiteClass.suiteName), t = new e.suiteClass(this.testManager, this.cx));
1360 }
1361 catch (r) {
1362 return this.log.println('Exception during setup: ' + (r.stack ? r.stack : r)), this.panic = !0, void this.onTestRunComplete_();
1363 }
1364 try {
1365 this.log.print('Test: ' + e.fullName + ' {'), this.log.pushPrefix(' '), this.currentResult = new lib.TestManager.Result(this, t, e), this.testManager.testPreamble(this.currentResult, this.cx), t.preamble(this.currentResult, this.cx), this.testQueue_.shift();
1366 }
1367 catch (r) {
1368 return this.log.println('Unexpected exception during test preamble: ' + (r.stack ? r.stack : r)), this.log.popPrefix(), this.log.println('}'), this.panic = !0, void this.onTestRunComplete_();
1369 }
1370 try {
1371 this.currentResult.run();
1372 }
1373 catch (r) {
1374 this.log.println('Unexpected exception during test run: ' + (r.stack ? r.stack : r)), this.panic = !0;
1375 }
1376};, lib.TestManager.TestRun.prototype.run = function() {
1377 this.log.println('Running ' + this.testQueue_.length + ' test(s) {'), this.log.pushPrefix(' '), window.onerror = this.onUncaughtException_.bind(this), this.startDate = new Date, this.runNextTest_();
1378};, lib.TestManager.TestRun.prototype.msToSeconds_ = function(e) {
1379 var t = (e / 1e3).toFixed(2);
1380 return t + 's';
1381};, lib.TestManager.TestRun.prototype.summarize = function() {
1382 if (this.failures.length)
1383 for (var e = 0; e < this.failures.length; e++) this.log.println('FAILED: ' + this.failures[e].test.fullName);
1384 this.testQueue_.length && this.log.println('Test run incomplete: ' + this.testQueue_.length + ' test(s) were not run.');
1385};, lib.TestManager.Result = function(e, t, r) {
1386 this.testRun = e, this.suite = t, this.test = r, this.startDate = null, this.duration = null, this.status = this.PENDING, this.expectedErrorMessage_ = null;
1387};, lib.TestManager.Result.prototype.PENDING = 'pending', lib.TestManager.Result.prototype.FAILED = 'FAILED', lib.TestManager.Result.prototype.PASSED = 'passed', lib.TestManager.Result.TestComplete = function(e) {
1388 this.result = e;
1389};, lib.TestManager.Result.TestComplete.prototype.toString = function() {
1390 return 'lib.TestManager.Result.TestComplete: ' + this.result.test.fullName + ', status: ' + this.result.status;
1391};, lib.TestManager.Result.prototype.run = function() {
1392 this.startDate = new Date, this.test.run(this), this.status != this.PENDING || this.timeout_ || (this.println('Test did not return a value and did not request more time.'), this.completeTest_(this.FAILED, !1));
1393};, lib.TestManager.Result.prototype.expectErrorMessage = function(e) {
1394 this.expectedErrorMessage_ = e;
1395};, lib.TestManager.Result.prototype.onTimeout_ = function() {
1396 this.timeout_ = null, this.status == this.PENDING && (this.println('Test timed out.'), this.completeTest_(this.FAILED, !1));
1397};, lib.TestManager.Result.prototype.requestTime = function(e) {
1398 this.timeout_ && clearTimeout(this.timeout_), this.timeout_ = setTimeout(this.onTimeout_.bind(this), e);
1399};, lib.TestManager.Result.prototype.completeTest_ = function(e, t) {
1400 if (this.status == this.PENDING ? (this.duration = new Date - this.startDate, this.status = e, this.testRun.onResultComplete(this)) : this.testRun.onResultReComplete(this, e), arguments.length < 2 || t) throw new lib.TestManager.Result.TestComplete(this);
1401};, lib.TestManager.Result.prototype.arrayEQ_ = function(e, t) {
1402 if (!e || !t) return !e && !t;
1403 if (e.length != t.length) return !1;
1404 for (var r = 0; r < e.length; ++r)
1405 if (e[r] != t[r]) return !1;
1406 return !0;
1407};, lib.TestManager.Result.prototype.assertEQ = function(e, t, r) {
1408 function o(e) {
1409 if ('number' == typeof e) return e;
1410 var t = String(e),
1411 r = t.split('\n').map(function(e) {
1412 return JSON.stringify(e);
1413 });
1414 return r.length > 1 ? '\n' + r.join('\n') : r.join('\n');
1415 }
1416 if (e !== t && !(t instanceof Array && this.arrayEQ_(e, t))) {
1417 var i = r ? '[' + r + ']' : '';
1418 this.fail('assertEQ' + i + ': ' + this.getCallerLocation_(1) + ': ' + o(e) + ' !== ' + o(t));
1419 }
1420};, lib.TestManager.Result.prototype.assert = function(e, t) {
1421 if (e !== !0) {
1422 var r = t ? '[' + t + ']' : '';
1423 this.fail('assert' + r + ': ' + this.getCallerLocation_(1) + ': ' + String(e));
1424 }
1425};, lib.TestManager.Result.prototype.getCallerLocation_ = function(e) {
1426 try {
1427 throw new Error;
1428 }
1429 catch (t) {
1430 var r = t.stack.split('\n')[e + 2],
1431 o = r.match(/([^\/]+:\d+):\d+\)?$/);
1432 return o ? o[1] : '???';
1433 }
1434};, lib.TestManager.Result.prototype.println = function(e) {
1435 this.testRun.log.println(e);
1436};, lib.TestManager.Result.prototype.fail = function(e) {
1437 arguments.length && this.println(e), this.completeTest_(this.FAILED, !0);
1438};, lib.TestManager.Result.prototype.pass = function() {
1439 this.completeTest_(this.PASSED, !0);
1440};, lib.UTF8Decoder = function() {
1441 this.bytesLeft = 0, this.codePoint = 0, this.lowerBound = 0;
1442};, lib.UTF8Decoder.prototype.decode = function(e) {
1443 for (var t = '', r = 0; r < e.length; r++) {
1444 var o = e.charCodeAt(r);
1445 if (0 == this.bytesLeft) 127 >= o ? t += e.charAt(r) : o >= 192 && 223 >= o ? (this.codePoint = o - 192, this.bytesLeft = 1, this.lowerBound = 128) : o >= 224 && 239 >= o ? (this.codePoint = o - 224, this.bytesLeft = 2, this.lowerBound = 2048) : o >= 240 && 247 >= o ? (this.codePoint = o - 240, this.bytesLeft = 3, this.lowerBound = 65536) : o >= 248 && 251 >= o ? (this.codePoint = o - 248, this.bytesLeft = 4, this.lowerBound = 2097152) : o >= 252 && 253 >= o ? (this.codePoint = o - 252, this.bytesLeft = 5, this.lowerBound = 67108864) : t += '�';
1446 else if (o >= 128 && 191 >= o) {
1447 if (this.bytesLeft--, this.codePoint = (this.codePoint << 6) + (o - 128), 0 == this.bytesLeft) {
1448 var i = this.codePoint;
1449 i < this.lowerBound || i >= 55296 && 57343 >= i || i > 1114111 ? t += '�' : 65536 > i ? t += String.fromCharCode(i) : (i -= 65536, t += String.fromCharCode(55296 + (i >>> 10 & 1023), 56320 + (1023 & i)))
1450 }
1451 }
1452 else t += '�', this.bytesLeft = 0, r--;
1453 }
1454 return t;
1455};, lib.decodeUTF8 = function(e) {
1456 return (new lib.UTF8Decoder).decode(e);
1457};, lib.encodeUTF8 = function(e) {
1458 for (var t = '', r = 0; r < e.length; r++) {
1459 var o = e.charCodeAt(r);
1460 if (o >= 56320 && 57343 >= o) o = 65533;
1461 else if (o >= 55296 && 56319 >= o)
1462 if (r + 1 < e.length) {
1463 var i = e.charCodeAt(r + 1);
1464 i >= 56320 && 57343 >= i ? (o = 65536 + ((1023 & o) << 10) + (1023 & i), r++) : o = 65533;
1465 }
1466 else o = 65533;
1467 var s;
1468 if (127 >= o) t += e.charAt(r);
1469 else
1470 for (2047 >= o ? (t += String.fromCharCode(192 | o >>> 6), s = 1) : 65535 >= o ? (t += String.fromCharCode(224 | o >>> 12), s = 2) : (t += String.fromCharCode(240 | o >>> 18), s = 3); s > 0;) s--, t += String.fromCharCode(128 | o >>> 6 * s & 63);
1471 }
1472 return t;
1473};, String.prototype.codePointAt || ! function() {
1474 var e = function(e) {
1475 if (null == this) throw TypeError();
1476 var t = String(this),
1477 r = t.length,
1478 o = e ? Number(e) : 0;
1479 if (o != o && (o = 0), 0 > o || o >= r) return void 0;
1480 var i, s = t.charCodeAt(o);
1481 return s >= 55296 && 56319 >= s && r > o + 1 && (i = t.charCodeAt(o + 1), i >= 56320 && 57343 >= i) ? 1024 * (s - 55296) + i - 56320 + 65536 : s;
1482 };
1483 Object.defineProperty ? Object.defineProperty(String.prototype, 'codePointAt', {
1484 value: e,
1485 configurable: !0,
1486 writable: !0
1487 }) : String.prototype.codePointAt = e;
1488}(), lib.wc = {}, lib.wc.nulWidth = 0, lib.wc.controlWidth = 0, lib.wc.regardCjkAmbiguous = !1, lib.wc.cjkAmbiguousWidth = 2, lib.wc.combining = [
1489 [768, 879],
1490 [1155, 1158],
1491 [1160, 1161],
1492 [1425, 1469],
1493 [1471, 1471],
1494 [1473, 1474],
1495 [1476, 1477],
1496 [1479, 1479],
1497 [1536, 1539],
1498 [1552, 1557],
1499 [1611, 1630],
1500 [1648, 1648],
1501 [1750, 1764],
1502 [1767, 1768],
1503 [1770, 1773],
1504 [1807, 1807],
1505 [1809, 1809],
1506 [1840, 1866],
1507 [1958, 1968],
1508 [2027, 2035],
1509 [2305, 2306],
1510 [2364, 2364],
1511 [2369, 2376],
1512 [2381, 2381],
1513 [2385, 2388],
1514 [2402, 2403],
1515 [2433, 2433],
1516 [2492, 2492],
1517 [2497, 2500],
1518 [2509, 2509],
1519 [2530, 2531],
1520 [2561, 2562],
1521 [2620, 2620],
1522 [2625, 2626],
1523 [2631, 2632],
1524 [2635, 2637],
1525 [2672, 2673],
1526 [2689, 2690],
1527 [2748, 2748],
1528 [2753, 2757],
1529 [2759, 2760],
1530 [2765, 2765],
1531 [2786, 2787],
1532 [2817, 2817],
1533 [2876, 2876],
1534 [2879, 2879],
1535 [2881, 2883],
1536 [2893, 2893],
1537 [2902, 2902],
1538 [2946, 2946],
1539 [3008, 3008],
1540 [3021, 3021],
1541 [3134, 3136],
1542 [3142, 3144],
1543 [3146, 3149],
1544 [3157, 3158],
1545 [3260, 3260],
1546 [3263, 3263],
1547 [3270, 3270],
1548 [3276, 3277],
1549 [3298, 3299],
1550 [3393, 3395],
1551 [3405, 3405],
1552 [3530, 3530],
1553 [3538, 3540],
1554 [3542, 3542],
1555 [3633, 3633],
1556 [3636, 3642],
1557 [3655, 3662],
1558 [3761, 3761],
1559 [3764, 3769],
1560 [3771, 3772],
1561 [3784, 3789],
1562 [3864, 3865],
1563 [3893, 3893],
1564 [3895, 3895],
1565 [3897, 3897],
1566 [3953, 3966],
1567 [3968, 3972],
1568 [3974, 3975],
1569 [3984, 3991],
1570 [3993, 4028],
1571 [4038, 4038],
1572 [4141, 4144],
1573 [4146, 4146],
1574 [4150, 4151],
1575 [4153, 4153],
1576 [4184, 4185],
1577 [4448, 4607],
1578 [4959, 4959],
1579 [5906, 5908],
1580 [5938, 5940],
1581 [5970, 5971],
1582 [6002, 6003],
1583 [6068, 6069],
1584 [6071, 6077],
1585 [6086, 6086],
1586 [6089, 6099],
1587 [6109, 6109],
1588 [6155, 6157],
1589 [6313, 6313],
1590 [6432, 6434],
1591 [6439, 6440],
1592 [6450, 6450],
1593 [6457, 6459],
1594 [6679, 6680],
1595 [6912, 6915],
1596 [6964, 6964],
1597 [6966, 6970],
1598 [6972, 6972],
1599 [6978, 6978],
1600 [7019, 7027],
1601 [7616, 7626],
1602 [7678, 7679],
1603 [8203, 8207],
1604 [8234, 8238],
1605 [8288, 8291],
1606 [8298, 8303],
1607 [8400, 8431],
1608 [12330, 12335],
1609 [12441, 12442],
1610 [43014, 43014],
1611 [43019, 43019],
1612 [43045, 43046],
1613 [64286, 64286],
1614 [65024, 65039],
1615 [65056, 65059],
1616 [65279, 65279],
1617 [65529, 65531],
1618 [68097, 68099],
1619 [68101, 68102],
1620 [68108, 68111],
1621 [68152, 68154],
1622 [68159, 68159],
1623 [119143, 119145],
1624 [119155, 119170],
1625 [119173, 119179],
1626 [119210, 119213],
1627 [119362, 119364],
1628 [917505, 917505],
1629 [917536, 917631],
1630 [917760, 917999]
1631], lib.wc.ambiguous = [
1632 [161, 161],
1633 [164, 164],
1634 [167, 168],
1635 [170, 170],
1636 [174, 174],
1637 [176, 180],
1638 [182, 186],
1639 [188, 191],
1640 [198, 198],
1641 [208, 208],
1642 [215, 216],
1643 [222, 225],
1644 [230, 230],
1645 [232, 234],
1646 [236, 237],
1647 [240, 240],
1648 [242, 243],
1649 [247, 250],
1650 [252, 252],
1651 [254, 254],
1652 [257, 257],
1653 [273, 273],
1654 [275, 275],
1655 [283, 283],
1656 [294, 295],
1657 [299, 299],
1658 [305, 307],
1659 [312, 312],
1660 [319, 322],
1661 [324, 324],
1662 [328, 331],
1663 [333, 333],
1664 [338, 339],
1665 [358, 359],
1666 [363, 363],
1667 [462, 462],
1668 [464, 464],
1669 [466, 466],
1670 [468, 468],
1671 [470, 470],
1672 [472, 472],
1673 [474, 474],
1674 [476, 476],
1675 [593, 593],
1676 [609, 609],
1677 [708, 708],
1678 [711, 711],
1679 [713, 715],
1680 [717, 717],
1681 [720, 720],
1682 [728, 731],
1683 [733, 733],
1684 [735, 735],
1685 [913, 929],
1686 [931, 937],
1687 [945, 961],
1688 [963, 969],
1689 [1025, 1025],
1690 [1040, 1103],
1691 [1105, 1105],
1692 [8208, 8208],
1693 [8211, 8214],
1694 [8216, 8217],
1695 [8220, 8221],
1696 [8224, 8226],
1697 [8228, 8231],
1698 [8240, 8240],
1699 [8242, 8243],
1700 [8245, 8245],
1701 [8251, 8251],
1702 [8254, 8254],
1703 [8308, 8308],
1704 [8319, 8319],
1705 [8321, 8324],
1706 [8364, 8364],
1707 [8451, 8451],
1708 [8453, 8453],
1709 [8457, 8457],
1710 [8467, 8467],
1711 [8470, 8470],
1712 [8481, 8482],
1713 [8486, 8486],
1714 [8491, 8491],
1715 [8531, 8532],
1716 [8539, 8542],
1717 [8544, 8555],
1718 [8560, 8569],
1719 [8592, 8601],
1720 [8632, 8633],
1721 [8658, 8658],
1722 [8660, 8660],
1723 [8679, 8679],
1724 [8704, 8704],
1725 [8706, 8707],
1726 [8711, 8712],
1727 [8715, 8715],
1728 [8719, 8719],
1729 [8721, 8721],
1730 [8725, 8725],
1731 [8730, 8730],
1732 [8733, 8736],
1733 [8739, 8739],
1734 [8741, 8741],
1735 [8743, 8748],
1736 [8750, 8750],
1737 [8756, 8759],
1738 [8764, 8765],
1739 [8776, 8776],
1740 [8780, 8780],
1741 [8786, 8786],
1742 [8800, 8801],
1743 [8804, 8807],
1744 [8810, 8811],
1745 [8814, 8815],
1746 [8834, 8835],
1747 [8838, 8839],
1748 [8853, 8853],
1749 [8857, 8857],
1750 [8869, 8869],
1751 [8895, 8895],
1752 [8978, 8978],
1753 [9312, 9449],
1754 [9451, 9547],
1755 [9552, 9587],
1756 [9600, 9615],
1757 [9618, 9621],
1758 [9632, 9633],
1759 [9635, 9641],
1760 [9650, 9651],
1761 [9654, 9655],
1762 [9660, 9661],
1763 [9664, 9665],
1764 [9670, 9672],
1765 [9675, 9675],
1766 [9678, 9681],
1767 [9698, 9701],
1768 [9711, 9711],
1769 [9733, 9734],
1770 [9737, 9737],
1771 [9742, 9743],
1772 [9748, 9749],
1773 [9756, 9756],
1774 [9758, 9758],
1775 [9792, 9792],
1776 [9794, 9794],
1777 [9824, 9825],
1778 [9827, 9829],
1779 [9831, 9834],
1780 [9836, 9837],
1781 [9839, 9839],
1782 [10045, 10045],
1783 [10102, 10111],
1784 [57344, 63743],
1785 [65533, 65533],
1786 [983040, 1048573],
1787 [1048576, 1114109]
1788], lib.wc.isSpace = function(e) {
1789 var t, r = 0,
1790 o = lib.wc.combining.length - 1;
1791 if (e < lib.wc.combining[0][0] || e > lib.wc.combining[o][1]) return !1;
1792 for (; o >= r;)
1793 if (t = Math.floor((r + o) / 2), e > lib.wc.combining[t][1]) r = t + 1;
1794 else {
1795 if (!(e < lib.wc.combining[t][0])) return !0;
1796 o = t - 1;
1797 }
1798 return !1;
1799};, lib.wc.isCjkAmbiguous = function(e) {
1800 var t, r = 0,
1801 o = lib.wc.ambiguous.length - 1;
1802 if (e < lib.wc.ambiguous[0][0] || e > lib.wc.ambiguous[o][1]) return !1;
1803 for (; o >= r;)
1804 if (t = Math.floor((r + o) / 2), e > lib.wc.ambiguous[t][1]) r = t + 1;
1805 else {
1806 if (!(e < lib.wc.ambiguous[t][0])) return !0;
1807 o = t - 1;
1808 }
1809 return !1;
1810};, lib.wc.charWidth = function(e) {
1811 return lib.wc.regardCjkAmbiguous ? lib.wc.charWidthRegardAmbiguous(e) : lib.wc.charWidthDisregardAmbiguous(e);
1812};, lib.wc.charWidthDisregardAmbiguous = function(e) {
1813 return 0 === e ? lib.wc.nulWidth : 32 > e || e >= 127 && 160 > e ? lib.wc.controlWidth : 127 > e ? 1 : lib.wc.isSpace(e) ? 0 : 1 + (e >= 4352 && (4447 >= e || 9001 == e || 9002 == e || e >= 11904 && 42191 >= e && 12351 != e || e >= 44032 && 55203 >= e || e >= 63744 && 64255 >= e || e >= 65040 && 65049 >= e || e >= 65072 && 65135 >= e || e >= 65280 && 65376 >= e || e >= 65504 && 65510 >= e || e >= 131072 && 196605 >= e || e >= 196608 && 262141 >= e))
1814};, lib.wc.charWidthRegardAmbiguous = function(e) {
1815 return lib.wc.isCjkAmbiguous(e) ? lib.wc.cjkAmbiguousWidth : lib.wc.charWidthDisregardAmbiguous(e);
1816};, lib.wc.strWidth = function(e) {
1817 for (var t, r = 0, o = 0; o < e.length;) {
1818 var i = e.codePointAt(o);
1819 if (t = lib.wc.charWidth(i), 0 > t) return -1;
1820 r += t, o += 65535 >= i ? 1 : 2;
1821 }
1822 return r;
1823};, lib.wc.substr = function(e, t, r) {
1824 var o, i, s;
1825 for (o = 0, s = 0; o < e.length && (s += lib.wc.charWidth(e.charCodeAt(o)), !(s > t)); o++);
1826 if (void 0 != r) {
1827 for (i = o, s = 0; i < e.length && r > s; s += lib.wc.charWidth(e.charCodeAt(i)), i++);
1828 return s > r && i--, e.substring(o, i);
1829 }
1830 return e.substr(o);
1831};, lib.wc.substring = function(e, t, r) {
1832 return lib.wc.substr(e, t, r - t);
1833};, lib.resource.add('libdot/changelog/version', 'text/plain', '1.11'), lib.resource.add('libdot/changelog/date', 'text/plain', '2017-04-17'), lib.rtdep('lib.Storage');
1834var hterm = {};
1835hterm.windowType = null, hterm.zoomWarningMessage = 'ZOOM != 100%', hterm.notifyCopyMessage = '✂', hterm.desktopNotificationTitle = '♪ %(title) ♪', hterm.testDeps = ['hterm.ScrollPort.Tests', 'hterm.Screen.Tests', 'hterm.Terminal.Tests', 'hterm.VT.Tests', 'hterm.VT.CannedTests'], lib.registerInit('hterm', function(e) {
1836 function t(t) {
1837 hterm.windowType = t.type, setTimeout(e, 0);
1838 }
1839
1840 function r(r) {
1841 r && window.chrome ? chrome.windows.get(r.windowId, null, t) : (hterm.windowType = 'normal', setTimeout(e, 0));
1842 }
1843 if (!hterm.defaultStorage) {
1844 var o = navigator.userAgent.match(/\sChrome\/(\d\d)/),
1845 i = o ? parseInt(o[1]) : -1;
1846 window.chrome && chrome.storage && chrome.storage.sync && i > 21 ? hterm.defaultStorage = new lib.Storage.Chrome(chrome.storage.sync) : hterm.defaultStorage = new lib.Storage.Local;
1847 }
1848 var s = !1;
1849 if (window.chrome && chrome.runtime && chrome.runtime.getManifest) {
1850 var n = chrome.runtime.getManifest();
1851 s = n.app && n.app.background;
1852 }
1853 s ? setTimeout(t.bind(null, {
1854 type: 'popup'
1855 }), 0) : window.chrome && chrome.tabs ? chrome.tabs.getCurrent(r) : setTimeout(t.bind(null, {
1856 type: 'normal'
1857 }), 0)
1858}), hterm.getClientSize = function(e) {
1859 return e.getBoundingClientRect();
1860};, hterm.getClientWidth = function(e) {
1861 return e.getBoundingClientRect().width;
1862};, hterm.getClientHeight = function(e) {
1863 return e.getBoundingClientRect().height;
1864};, hterm.copySelectionToClipboard = function(e) {
1865 try {
1866 e.execCommand('copy');
1867 }
1868 catch (t) {}
1869};, hterm.pasteFromClipboard = function(e) {
1870 try {
1871 e.execCommand('paste');
1872 }
1873 catch (t) {}
1874};, hterm.Size = function(e, t) {
1875 this.width = e, this.height = t;
1876};, hterm.Size.prototype.resize = function(e, t) {
1877 this.width = e, this.height = t;
1878};, hterm.Size.prototype.clone = function() {
1879 return new hterm.Size(this.width, this.height);
1880};, hterm.Size.prototype.setTo = function(e) {
1881 this.width = e.width, this.height = e.height;
1882};, hterm.Size.prototype.equals = function(e) {
1883 return this.width == e.width && this.height == e.height;
1884};, hterm.Size.prototype.toString = function() {
1885 return '[hterm.Size: ' + this.width + ', ' + this.height + ']';
1886};, hterm.RowCol = function(e, t, r) {
1887 this.row = e, this.column = t, this.overflow = !!r;
1888};, hterm.RowCol.prototype.move = function(e, t, r) {
1889 this.row = e, this.column = t, this.overflow = !!r;
1890};, hterm.RowCol.prototype.clone = function() {
1891 return new hterm.RowCol(this.row, this.column, this.overflow);
1892};, hterm.RowCol.prototype.setTo = function(e) {
1893 this.row = e.row, this.column = e.column, this.overflow = e.overflow;
1894};, hterm.RowCol.prototype.equals = function(e) {
1895 return this.row == e.row && this.column == e.column && this.overflow == e.overflow;
1896};, hterm.RowCol.prototype.toString = function() {
1897 return '[hterm.RowCol: ' + this.row + ', ' + this.column + ', ' + this.overflow + ']';
1898};, lib.rtdep('lib.f'), hterm.Frame = function(e, t, r) {
1899 this.terminal_ = e, this.div_ = e.div_, this.url = t, this.options = r || {}, this.iframe_ = null, this.container_ = null, this.messageChannel_ = null;
1900};, hterm.Frame.prototype.onMessage_ = function(e) {
1901 return 'ipc-init-ok' != e.data.name ? void console.log('Unknown message from frame:', e.data) : (this.sendTerminalInfo_(), this.messageChannel_.port1.onmessage = this.onMessage.bind(this), void this.onLoad());
1902};, hterm.Frame.prototype.onMessage = function() {};, hterm.Frame.prototype.onLoad_ = function() {
1903 this.messageChannel_ = new MessageChannel, this.messageChannel_.port1.onmessage = this.onMessage_.bind(this), this.messageChannel_.port1.start(), this.iframe_.contentWindow.postMessage({
1904 name: 'ipc-init',
1905 argv: [{
1906 messagePort: this.messageChannel_.port2
1907 }]
1908 }, this.url, [this.messageChannel_.port2]);
1909};, hterm.Frame.prototype.onLoad = function() {};, hterm.Frame.prototype.sendTerminalInfo_ = function() {
1910 lib.f.getAcceptLanguages(function(e) {
1911 this.postMessage('terminal-info', [{
1912 acceptLanguages: e,
1913 foregroundColor: this.terminal_.getForegroundColor(),
1914 backgroundColor: this.terminal_.getBackgroundColor(),
1915 cursorColor: this.terminal_.getCursorColor(),
1916 fontSize: this.terminal_.getFontSize(),
1917 fontFamily: this.terminal_.getFontFamily(),
1918 baseURL: lib.f.getURL('/')
1919 }]);
1920 }.bind(this));
1921};, hterm.Frame.prototype.onCloseClicked_ = function() {
1922 this.close();
1923};, hterm.Frame.prototype.close = function() {
1924 this.container_ && this.container_.parentNode && (this.container_.parentNode.removeChild(this.container_), this.onClose());
1925};, hterm.Frame.prototype.onClose = function() {};, hterm.Frame.prototype.postMessage = function(e, t) {
1926 if (!this.messageChannel_) throw new Error('Message channel is not set up.');
1927 this.messageChannel_.port1.postMessage({
1928 name: e,
1929 argv: t
1930 });
1931};, hterm.Frame.prototype.show = function() {
1932 function e(e, r) {
1933 return e in t.options ? t.options[e] : r;
1934 }
1935 var t = this,
1936 t = this;
1937 if (this.container_ && this.container_.parentNode) return void console.error('Frame already visible');
1938 var r = '16px',
1939 o = hterm.getClientSize(this.div_),
1940 i = e('width', 640),
1941 s = e('height', 480),
1942 n = ((o.width - i) / 2, (o.height - s) / 2, this.terminal_.document_),
1943 a = this.container_ = n.createElement('div');
1944 a.style.cssText = 'position: absolute;display: -webkit-flex;-webkit-flex-direction: column;top: 10%;left: 4%;width: 90%;height: 80%;box-shadow: 0 0 2px ' + this.terminal_.getForegroundColor() + ';border: 2px ' + this.terminal_.getForegroundColor() + ' solid;';
1945 var l = n.createElement('div');
1946 l.style.cssText = 'display: -webkit-flex;-webkit-justify-content: flex-end;height: ' + r + ';background-color: ' + this.terminal_.getForegroundColor() + ';color: ' + this.terminal_.getBackgroundColor() + ';font-size: 16px;font-family: ' + this.terminal_.getFontFamily(), a.appendChild(l);
1947 var h = this.iframe_ = n.createElement('iframe');
1948 h.onload = this.onLoad_.bind(this), h.style.cssText = 'display: -webkit-flex;-webkit-flex: 1;width: 100%', h.setAttribute('src', this.url), h.setAttribute('seamless', !0), a.appendChild(h), this.div_.appendChild(a);
1949};, lib.rtdep('hterm.Keyboard.KeyMap'), hterm.Keyboard = function(e) {
1950 this.terminal = e, this.keyboardElement_ = null, this.handlers_ = [
1951 ['focusout', this.onFocusOut_.bind(this)],
1952 ['keydown', this.onKeyDown_.bind(this)],
1953 ['keypress', this.onKeyPress_.bind(this)],
1954 ['keyup', this.onKeyUp_.bind(this)],
1955 ['textInput', this.onTextInput_.bind(this)]
1956 ], this.keyMap = new hterm.Keyboard.KeyMap(this), this.bindings = new hterm.Keyboard.Bindings(this), this.altGrMode = 'none', this.shiftInsertPaste = !0, this.homeKeysScroll = !1, this.pageKeysScroll = !1, this.ctrlPlusMinusZeroZoom = !0, this.ctrlCCopy = !1, this.ctrlVPaste = !1, this.applicationKeypad = !1, this.applicationCursor = !1, this.backspaceSendsBackspace = !1, this.characterEncoding = 'utf-8', this.metaSendsEscape = !0, this.passMetaV = !0, this.altSendsWhat = 'escape', this.altIsMeta = !1, this.altBackspaceIsMetaBackspace = !1, this.altKeyPressed = 0, this.mediaKeysAreFKeys = !1, this.previousAltSendsWhat_ = null;
1957};, hterm.Keyboard.KeyActions = {
1958 CANCEL: new String('CANCEL'),
1959 DEFAULT: new String('DEFAULT'),
1960 PASS: new String('PASS'),
1961 STRIP: new String('STRIP')
1962}, hterm.Keyboard.prototype.encode = function(e) {
1963 return 'utf-8' == this.characterEncoding ? this.terminal.vt.encodeUTF8(e) : e;
1964};, hterm.Keyboard.prototype.installKeyboard = function(e) {
1965 if (e != this.keyboardElement_) {
1966 e && this.keyboardElement_ && this.installKeyboard(null);
1967 for (var t = 0; t < this.handlers_.length; t++) {
1968 var r = this.handlers_[t];
1969 e ? e.addEventListener(r[0], r[1]) : this.keyboardElement_.removeEventListener(r[0], r[1]);
1970 }
1971 this.keyboardElement_ = e;
1972 }
1973};, hterm.Keyboard.prototype.uninstallKeyboard = function() {
1974 this.installKeyboard(null);
1975};, hterm.Keyboard.prototype.onTextInput_ = function(e) {
1976 e.data && e.data.split('').forEach(this.terminal.onVTKeystroke.bind(this.terminal));
1977};, hterm.Keyboard.prototype.onKeyPress_ = function(e) {
1978 var t, r = String.fromCharCode(e.which),
1979 o = r.toLowerCase();
1980 if (!e.ctrlKey && !e.metaKey || 'c' != o && 'v' != o) {
1981 if (e.altKey && 'browser-key' == this.altSendsWhat && 0 == e.charCode) {
1982 var i = String.fromCharCode(e.keyCode);
1983 e.shiftKey || (i = i.toLowerCase()), t = i.charCodeAt(0) + 128;
1984 }
1985 else e.charCode >= 32 && (i = e.charCode);
1986 i && this.terminal.onVTKeystroke(String.fromCharCode(i)), e.preventDefault(), e.stopPropagation();
1987 }
1988};, hterm.Keyboard.prototype.preventChromeAppNonCtrlShiftDefault_ = function(e) {
1989 window.chrome && window.chrome.app && window.chrome.app.window && (e.ctrlKey && e.shiftKey || e.preventDefault());
1990};, hterm.Keyboard.prototype.onFocusOut_ = function(e) {
1991 this.altKeyPressed = 0;
1992};, hterm.Keyboard.prototype.onKeyUp_ = function(e) {
1993 18 == e.keyCode && (this.altKeyPressed = this.altKeyPressed & ~(1 << e.location - 1)), 27 == e.keyCode && this.preventChromeAppNonCtrlShiftDefault_(e);
1994};, hterm.Keyboard.prototype.onKeyDown_ = function(e) {
1995 function t(s) {
1996 o = s;
1997 var a = r[s];
1998 return 'function' == typeof a && (a = a.apply(i.keyMap, [e, r])), a === n && 'normal' != s && (a = t('normal')), a;
1999 }
2000 18 == e.keyCode && (this.altKeyPressed = this.altKeyPressed | 1 << e.location - 1), 27 == e.keyCode && this.preventChromeAppNonCtrlShiftDefault_(e);
2001 var r = this.keyMap.keyDefs[e.keyCode];
2002 if (!r) return void console.warn('No definition for keyCode: ' + e.keyCode);
2003 var o = null,
2004 i = this,
2005 s = hterm.Keyboard.KeyActions.CANCEL,
2006 n = hterm.Keyboard.KeyActions.DEFAULT,
2007 a = hterm.Keyboard.KeyActions.PASS,
2008 l = hterm.Keyboard.KeyActions.STRIP,
2009 h = e.ctrlKey,
2010 c = this.altIsMeta ? !1 : e.altKey,
2011 u = this.altIsMeta ? e.altKey || e.metaKey : e.metaKey,
2012 g = !/^\[\w+\]$/.test(r.keyCap);
2013 switch (this.altGrMode) {
2014 case 'ctrl-alt':
2015 g && h && c && (h = !1, c = !1);
2016 break;
2017 case 'right-alt':
2018 g && 2 & this.terminal.keyboard.altKeyPressed && (h = !1, c = !1);
2019 break;
2020 case 'left-alt':
2021 g && 1 & this.terminal.keyboard.altKeyPressed && (h = !1, c = !1);
2022 }
2023 var d;
2024 d = t(h ? 'control' : c ? 'alt' : u ? 'meta' : 'normal');
2025 var p = !e.maskShiftKey && e.shiftKey,
2026 m = {
2027 keyCode: e.keyCode,
2028 shift: e.shiftKey,
2029 ctrl: h,
2030 alt: c,
2031 meta: u
2032 },
2033 b = this.bindings.getBinding(m);
2034 if (b && (p = h = c = u = !1, o = 'normal', d = b.action, 'function' == typeof d && (d = d.call(this, this.terminal, m))), c && 'browser-key' == this.altSendsWhat && d == n && (d = a), d !== a && (d !== n || h || c || u) && (d === l && (c = h = !1, d = r.normal, 'function' == typeof d && (d = d.apply(this.keyMap, [e, r])), d == n && 2 == r.keyCap.length && (d = r.keyCap.substr(p ? 1 : 0, 1))), e.preventDefault(), e.stopPropagation(), d !== s)) {
2035 if (d !== n && 'string' != typeof d) return void console.warn('Invalid action: ' + JSON.stringify(d));
2036 if ('control' == o ? h = !1 : 'alt' == o ? c = !1 : 'meta' == o && (u = !1), '[' == d.substr(0, 2) && (c || h || p)) {
2037 var f;
2038 !p || c || h ? !c || p || h ? p && c && !h ? f = ';4' : !h || p || c ? p && h && !c ? f = ';6' : c && h && !p ? f = ';7' : p && c && h && (f = ';8') : f = ';5' : f = ';3' : f = ';2', d = 3 == d.length ? '[1' + f + d.substr(2, 1) : d.substr(0, d.length - 1) + f + d.substr(d.length - 1);
2039 }
2040 else {
2041 if (d === n && (d = r.keyCap.substr(p ? 1 : 0, 1), h)) {
2042 var y = r.keyCap.substr(0, 1),
2043 _ = y.charCodeAt(0);
2044 _ >= 64 && 95 >= _ && (d = String.fromCharCode(_ - 64));
2045 }
2046 if (c && '8-bit' == this.altSendsWhat && 1 == d.length) {
2047 var _ = d.charCodeAt(0) + 128;
2048 d = String.fromCharCode(_);
2049 }(c && 'escape' == this.altSendsWhat || u && this.metaSendsEscape) && (d = '' + d);
2050 }
2051 this.terminal.onVTKeystroke(d);
2052 }
2053};, hterm.Keyboard.Bindings = function() {
2054 this.bindings_ = {};
2055};, hterm.Keyboard.Bindings.prototype.clear = function() {
2056 this.bindings_ = {};
2057};, hterm.Keyboard.Bindings.prototype.addBinding_ = function(e, t) {
2058 var r = null,
2059 o = this.bindings_[e.keyCode];
2060 if (o)
2061 for (var i = 0; i < o.length; i++)
2062 if (o[i].keyPattern.matchKeyPattern(e)) {
2063 r = o[i];
2064 break;
2065 }
2066 r ? r.action = t : (r = {
2067 keyPattern: e,
2068 action: t
2069 }, o ? (this.bindings_[e.keyCode].push(r), o.sort(function(e, t) {
2070 return hterm.Keyboard.KeyPattern.sortCompare(e.keyPattern, t.keyPattern);
2071 })) : this.bindings_[e.keyCode] = [r]);
2072};, hterm.Keyboard.Bindings.prototype.addBinding = function(e, t) {
2073 if ('string' != typeof e) return void this.addBinding_(e, t);
2074 var r = new hterm.Parser;
2075 r.reset(e);
2076 var o;
2077 try {
2078 o = r.parseKeySequence();
2079 }
2080 catch (i) {
2081 return void console.error(i);
2082 }
2083 if (!r.isComplete()) return void console.error(r.error('Expected end of sequence: ' + o));
2084 if ('string' == typeof t) {
2085 r.reset(t);
2086 try {
2087 t = r.parseKeyAction();
2088 }
2089 catch (i) {
2090 return void console.error(i);
2091 }
2092 }
2093 return r.isComplete() ? void this.addBinding_(new hterm.Keyboard.KeyPattern(o), t) : void console.error(r.error('Expected end of sequence: ' + o));
2094};, hterm.Keyboard.Bindings.prototype.addBindings = function(e) {
2095 for (var t in e) this.addBinding(t, e[t]);
2096};, hterm.Keyboard.Bindings.prototype.getBinding = function(e) {
2097 var t = this.bindings_[e.keyCode];
2098 if (!t) return null;
2099 for (var r = 0; r < t.length; r++) {
2100 var o = t[r];
2101 if (o.keyPattern.matchKeyDown(e)) return o;
2102 }
2103 return null;
2104};, lib.rtdep('hterm.Keyboard.KeyActions'), hterm.Keyboard.KeyMap = function(e) {
2105 this.keyboard = e, this.keyDefs = {}, this.reset();
2106};, hterm.Keyboard.KeyMap.prototype.addKeyDef = function(e, t) {
2107 e in this.keyDefs && console.warn('Duplicate keyCode: ' + e), this.keyDefs[e] = t;
2108};, hterm.Keyboard.KeyMap.prototype.addKeyDefs = function(e) {
2109 for (var t = 0; t < arguments.length; t++) this.addKeyDef(arguments[t][0], {
2110 keyCap: arguments[t][1],
2111 normal: arguments[t][2],
2112 control: arguments[t][3],
2113 alt: arguments[t][4],
2114 meta: arguments[t][5]
2115 });
2116};, hterm.Keyboard.KeyMap.prototype.reset = function() {
2117 function e(e, t, r) {
2118 return 'function' == typeof e ? e.apply(h, [t, r]) : e;
2119 }
2120
2121 function t(t, r) {
2122 return function(o, i) {
2123 var s = o.shiftKey || o.ctrlKey || o.altKey || o.metaKey || !h.keyboard.applicationCursor ? t : r;
2124 return e(s, o, i);
2125 }
2126 }
2127
2128 function r(t, r) {
2129 return function(o, i) {
2130 var s = h.keyboard.backspaceSendsBackspace ? r : t;
2131 return e(s, o, i);
2132 }
2133 }
2134
2135 function o(t, r) {
2136 return function(o, i) {
2137 var s = o.shiftKey ? r : t;
2138 return o.maskShiftKey = !0, e(s, o, i);
2139 }
2140 }
2141
2142 function i(t, r) {
2143 return function(o, i) {
2144 var s = o.altKey ? r : t;
2145 return e(s, o, i);
2146 }
2147 }
2148
2149 function s(t, r) {
2150 return function(o, i) {
2151 var s = o.shiftKey || o.ctrlKey || o.altKey || o.metaKey ? r : t;
2152 return e(s, o, i);
2153 }
2154 }
2155
2156 function n(e) {
2157 return String.fromCharCode(e.charCodeAt(0) - 64);
2158 }
2159
2160 function a(e) {
2161 return function(t, r) {
2162 return this[e](t, r);
2163 }
2164 }
2165
2166 function l(t) {
2167 return function(r, o) {
2168 return h.keyboard.mediaKeysAreFKeys ? e(t, r, o) : 166 == r.keyCode || 167 == r.keyCode || 168 == r.keyCode ? hterm.Keyboard.KeyActions.CANCEL : hterm.Keyboard.KeyActions.PASS
2169 }
2170 }
2171 this.keyDefs = {};
2172 var h = this,
2173 c = '',
2174 u = '[',
2175 g = 'O',
2176 d = hterm.Keyboard.KeyActions.CANCEL,
2177 p = hterm.Keyboard.KeyActions.DEFAULT,
2178 m = hterm.Keyboard.KeyActions.PASS,
2179 b = hterm.Keyboard.KeyActions.STRIP;
2180 this.addKeyDefs([0, '[UNKNOWN]', m, m, m, m], [27, '[ESC]', c, p, p, p], [112, '[F1]', s(g + 'P', u + 'P'), p, u + '23~', p], [113, '[F2]', s(g + 'Q', u + 'Q'), p, u + '24~', p], [114, '[F3]', s(g + 'R', u + 'R'), p, u + '25~', p], [115, '[F4]', s(g + 'S', u + 'S'), p, u + '26~', p], [116, '[F5]', u + '15~', p, u + '28~', p], [117, '[F6]', u + '17~', p, u + '29~', p], [118, '[F7]', u + '18~', p, u + '31~', p], [119, '[F8]', u + '19~', p, u + '32~', p], [120, '[F9]', u + '20~', p, u + '33~', p], [121, '[F10]', u + '21~', p, u + '34~', p], [122, '[F11]', u + '23~', p, u + '42~', p], [123, '[F12]', u + '24~', p, u + '43~', p], [192, '`~', p, o(n('@'), n('^')), p, m], [49, '1!', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [50, '2@', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [51, '3#', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [52, '4$', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [53, '5%', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [54, '6^', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [55, '7&', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [56, '8*', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [57, '9(', p, a('onCtrlNum_'), a('onAltNum_'), a('onMetaNum_')], [48, '0)', p, a('onPlusMinusZero_'), a('onAltNum_'), a('onPlusMinusZero_')], [189, '-_', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [187, '=+', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [173, '-_', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [61, '=+', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [171, '+*', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [8, '[BKSP]', r('', '\b'), r('\b', ''), p, p], [9, '[TAB]', o(' ', u + 'Z'), b, m, p], [81, 'qQ', p, n('Q'), p, p], [87, 'wW', p, n('W'), p, p], [69, 'eE', p, n('E'), p, p], [82, 'rR', p, n('R'), p, p], [84, 'tT', p, n('T'), p, p], [89, 'yY', p, n('Y'), p, p], [85, 'uU', p, n('U'), p, p], [73, 'iI', p, n('I'), p, p], [79, 'oO', p, n('O'), p, p], [80, 'pP', p, n('P'), p, p], [219, '[{', p, n('['), p, p], [221, ']}', p, n(']'), p, p], [220, '\\|', p, n('\\'), p, p], [20, '[CAPS]', m, m, m, p], [65, 'aA', p, n('A'), p, p], [83, 'sS', p, n('S'), p, p], [68, 'dD', p, n('D'), p, p], [70, 'fF', p, n('F'), p, p], [71, 'gG', p, n('G'), p, p], [72, 'hH', p, n('H'), p, p], [74, 'jJ', p, o(n('J'), m), p, p], [75, 'kK', p, o(n('K'), a('onClear_')), p, p], [76, 'lL', p, o(n('L'), m), p, p], [186, ';:', p, b, p, p], [222, "'\"", p, b, p, p], [13, '[ENTER]', '\r', d, d, p], [16, '[SHIFT]', m, m, m, p], [90, 'zZ', p, n('Z'), p, p], [88, 'xX', p, n('X'), p, p], [67, 'cC', p, a('onCtrlC_'), p, a('onMetaC_')], [86, 'vV', p, a('onCtrlV_'), p, a('onMetaV_')], [66, 'bB', p, o(n('B'), m), p, o(p, m)], [78, 'nN', p, a('onCtrlN_'), p, a('onMetaN_')], [77, 'mM', p, n('M'), p, p], [188, ',<', p, i(b, m), p, p], [190, '.>', p, i(b, m), p, p], [191, '/?', p, o(n('_'), n('?')), p, p], [17, '[CTRL]', m, m, m, m], [18, '[ALT]', m, m, m, m], [91, '[LAPL]', m, m, m, m], [32, ' ', p, n('@'), p, p], [92, '[RAPL]', m, m, m, m], [93, '[RMENU]', m, m, m, m], [42, '[PRTSCR]', m, m, m, m], [145, '[SCRLK]', m, m, m, m], [19, '[BREAK]', m, m, m, m], [45, '[INSERT]', a('onKeyInsert_'), p, p, p], [36, '[HOME]', a('onKeyHome_'), p, p, p], [33, '[PGUP]', a('onKeyPageUp_'), p, p, p], [46, '[DEL]', a('onKeyDel_'), p, p, p], [35, '[END]', a('onKeyEnd_'), p, p, p], [34, '[PGDOWN]', a('onKeyPageDown_'), p, p, p], [38, '[UP]', t(u + 'A', g + 'A'), p, p, p], [40, '[DOWN]', t(u + 'B', g + 'B'), p, p, p], [39, '[RIGHT]', t(u + 'C', g + 'C'), p, p, p], [37, '[LEFT]', t(u + 'D', g + 'D'), p, p, p], [144, '[NUMLOCK]', m, m, m, m], [96, '[KP0]', p, p, p, p], [97, '[KP1]', p, p, p, p], [98, '[KP2]', p, p, p, p], [99, '[KP3]', p, p, p, p], [100, '[KP4]', p, p, p, p], [101, '[KP5]', p, p, p, p], [102, '[KP6]', p, p, p, p], [103, '[KP7]', p, p, p, p], [104, '[KP8]', p, p, p, p], [105, '[KP9]', p, p, p, p], [107, '[KP+]', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [109, '[KP-]', p, a('onPlusMinusZero_'), p, a('onPlusMinusZero_')], [106, '[KP*]', p, p, p, p], [111, '[KP/]', p, p, p, p], [110, '[KP.]', p, p, p, p], [166, '[BACK]', l(s(g + 'P', u + 'P')), p, u + '23~', p], [167, '[FWD]', l(s(g + 'Q', u + 'Q')), p, u + '24~', p], [168, '[RELOAD]', l(s(g + 'R', u + 'R')), p, u + '25~', p], [183, '[FSCR]', l(s(g + 'S', u + 'S')), p, u + '26~', p], [182, '[WINS]', l(u + '15~'), p, u + '28~', p], [216, '[BRIT-]', l(u + '17~'), p, u + '29~', p], [217, '[BRIT+]', l(u + '18~'), p, u + '31~', p]);
2181};, hterm.Keyboard.KeyMap.prototype.onKeyInsert_ = function(e) {
2182 return this.keyboard.shiftInsertPaste && e.shiftKey ? hterm.Keyboard.KeyActions.PASS : '[2~';
2183};, hterm.Keyboard.KeyMap.prototype.onKeyHome_ = function(e) {
2184 return !this.keyboard.homeKeysScroll ^ e.shiftKey ? e.altey || e.ctrlKey || e.shiftKey || !this.keyboard.applicationCursor ? '' : 'OH' : (this.keyboard.terminal.scrollHome(), hterm.Keyboard.KeyActions.CANCEL);
2185};, hterm.Keyboard.KeyMap.prototype.onKeyEnd_ = function(e) {
2186 return !this.keyboard.homeKeysScroll ^ e.shiftKey ? e.altKey || e.ctrlKey || e.shiftKey || !this.keyboard.applicationCursor ? '' : 'OF' : (this.keyboard.terminal.scrollEnd(), hterm.Keyboard.KeyActions.CANCEL);
2187};, hterm.Keyboard.KeyMap.prototype.onKeyPageUp_ = function(e) {
2188 return !this.keyboard.pageKeysScroll ^ e.shiftKey ? '[5~' : (this.keyboard.terminal.scrollPageUp(), hterm.Keyboard.KeyActions.CANCEL);
2189};, hterm.Keyboard.KeyMap.prototype.onKeyDel_ = function(e) {
2190 return this.keyboard.altBackspaceIsMetaBackspace && this.keyboard.altKeyPressed && !e.altKey ? '' : '[3~';
2191};, hterm.Keyboard.KeyMap.prototype.onKeyPageDown_ = function(e) {
2192 return !this.keyboard.pageKeysScroll ^ e.shiftKey ? '[6~' : (this.keyboard.terminal.scrollPageDown(), hterm.Keyboard.KeyActions.CANCEL);
2193};, hterm.Keyboard.KeyMap.prototype.onClear_ = function(e, t) {
2194 return this.keyboard.terminal.wipeContents(), hterm.Keyboard.KeyActions.CANCEL;
2195};, hterm.Keyboard.KeyMap.prototype.onCtrlNum_ = function(e, t) {
2196 function r(e) {
2197 return String.fromCharCode(e.charCodeAt(0) - 64);
2198 }
2199 if (this.keyboard.terminal.passCtrlNumber && !e.shiftKey) return hterm.Keyboard.KeyActions.PASS;
2200 switch (t.keyCap.substr(0, 1)) {
2201 case '1':
2202 return '1';
2203 case '2':
2204 return r('@');
2205 case '3':
2206 return r('[');
2207 case '4':
2208 return r('\\');
2209 case '5':
2210 return r(']');
2211 case '6':
2212 return r('^');
2213 case '7':
2214 return r('_');
2215 case '8':
2216 return '';
2217 case '9':
2218 return '9';
2219 }
2220};, hterm.Keyboard.KeyMap.prototype.onAltNum_ = function(e, t) {
2221 return this.keyboard.terminal.passAltNumber && !e.shiftKey ? hterm.Keyboard.KeyActions.PASS : hterm.Keyboard.KeyActions.DEFAULT;
2222};, hterm.Keyboard.KeyMap.prototype.onMetaNum_ = function(e, t) {
2223 return this.keyboard.terminal.passMetaNumber && !e.shiftKey ? hterm.Keyboard.KeyActions.PASS : hterm.Keyboard.KeyActions.DEFAULT;
2224};, hterm.Keyboard.KeyMap.prototype.onCtrlC_ = function(e, t) {
2225 var r = this.keyboard.terminal.getDocument().getSelection();
2226 if (!r.isCollapsed) {
2227 if (this.keyboard.ctrlCCopy && !e.shiftKey) return this.keyboard.terminal.clearSelectionAfterCopy && setTimeout(r.collapseToEnd.bind(r), 50), hterm.Keyboard.KeyActions.PASS;
2228 if (!this.keyboard.ctrlCCopy && e.shiftKey) return this.keyboard.terminal.clearSelectionAfterCopy && setTimeout(r.collapseToEnd.bind(r), 50), this.keyboard.terminal.copySelectionToClipboard(), hterm.Keyboard.KeyActions.CANCEL;
2229 }
2230 return '';
2231};, hterm.Keyboard.KeyMap.prototype.onCtrlN_ = function(e, t) {
2232 return e.shiftKey ? (window.open(document.location.href, '', 'chrome=no,close=yes,resize=yes,scrollbars=yes,minimizable=yes,width=' + window.innerWidth + ',height=' + window.innerHeight), hterm.Keyboard.KeyActions.CANCEL) : '';
2233};, hterm.Keyboard.KeyMap.prototype.onCtrlV_ = function(e, t) {
2234 return !e.shiftKey && this.keyboard.ctrlVPaste || e.shiftKey && !this.keyboard.ctrlVPaste ? hterm.Keyboard.KeyActions.PASS : '';
2235};, hterm.Keyboard.KeyMap.prototype.onMetaN_ = function(e, t) {
2236 return e.shiftKey ? (window.open(document.location.href, '', 'chrome=no,close=yes,resize=yes,scrollbars=yes,minimizable=yes,width=' + window.outerWidth + ',height=' + window.outerHeight), hterm.Keyboard.KeyActions.CANCEL) : hterm.Keyboard.KeyActions.DEFAULT;
2237};, hterm.Keyboard.KeyMap.prototype.onMetaC_ = function(e, t) {
2238 var r = this.keyboard.terminal.getDocument();
2239 return e.shiftKey || r.getSelection().isCollapsed ? t.keyCap.substr(e.shiftKey ? 1 : 0, 1) : (this.keyboard.terminal.clearSelectionAfterCopy && setTimeout(function() {
2240 r.getSelection().collapseToEnd();
2241 }, 50), hterm.Keyboard.KeyActions.PASS);
2242};, hterm.Keyboard.KeyMap.prototype.onMetaV_ = function(e, t) {
2243 return e.shiftKey ? hterm.Keyboard.KeyActions.PASS : this.keyboard.passMetaV ? hterm.Keyboard.KeyActions.PASS : hterm.Keyboard.KeyActions.DEFAULT
2244};, hterm.Keyboard.KeyMap.prototype.onPlusMinusZero_ = function(e, t) {
2245 if (!(this.keyboard.ctrlPlusMinusZeroZoom ^ e.shiftKey)) return '-_' == t.keyCap ? '' : hterm.Keyboard.KeyActions.CANCEL;
2246 if (1 != this.keyboard.terminal.getZoomFactor()) return hterm.Keyboard.KeyActions.PASS;
2247 var r = t.keyCap.substr(0, 1);
2248 if ('0' == r) this.keyboard.terminal.setFontSize(0);
2249 else {
2250 var o = this.keyboard.terminal.getFontSize();
2251 '-' == r || '[KP-]' == t.keyCap ? o -= 1 : o += 1, this.keyboard.terminal.setFontSize(o);
2252 }
2253 return hterm.Keyboard.KeyActions.CANCEL;
2254};, hterm.Keyboard.KeyPattern = function(e) {
2255 this.wildcardCount = 0, this.keyCode = e.keyCode, hterm.Keyboard.KeyPattern.modifiers.forEach(function(t) {
2256 this[t] = e[t] || !1, '*' == this[t] && this.wildcardCount++;
2257 }.bind(this));
2258};, hterm.Keyboard.KeyPattern.modifiers = ['shift', 'ctrl', 'alt', 'meta'], hterm.Keyboard.KeyPattern.sortCompare = function(e, t) {
2259 return e.wildcardCount < t.wildcardCount ? -1 : e.wildcardCount > t.wildcardCount ? 1 : 0
2260};, hterm.Keyboard.KeyPattern.prototype.match_ = function(e, t) {
2261 if (this.keyCode != e.keyCode) return !1;
2262 var r = !0;
2263 return hterm.Keyboard.KeyPattern.modifiers.forEach(function(o) {
2264 var i = o in e ? e[o] : !1;
2265 r && (t || '*' != this[o]) && this[o] != i && (r = !1);
2266 }.bind(this)), r;
2267};, hterm.Keyboard.KeyPattern.prototype.matchKeyDown = function(e) {
2268 return this.match_(e, !1);
2269};, hterm.Keyboard.KeyPattern.prototype.matchKeyPattern = function(e) {
2270 return this.match_(e, !0);
2271};, hterm.Options = function(e) {
2272 this.wraparound = e ? e.wraparound : !0, this.reverseWraparound = e ? e.reverseWraparound : !1, this.originMode = e ? e.originMode : !1, this.autoCarriageReturn = e ? e.autoCarriageReturn : !1, this.cursorVisible = e ? e.cursorVisible : !1, this.cursorBlink = e ? e.cursorBlink : !1, this.insertMode = e ? e.insertMode : !1, this.reverseVideo = e ? e.reverseVideo : !1, this.bracketedPaste = e ? e.bracketedPaste : !1;
2273};, lib.rtdep('hterm.Keyboard.KeyActions'), hterm.Parser = function() {
2274 this.source = '', this.pos = 0, this.ch = null;
2275};, hterm.Parser.prototype.error = function(e) {
2276 return new Error('Parse error at ' + this.pos + ': ' + e);
2277};, hterm.Parser.prototype.isComplete = function() {
2278 return this.pos == this.source.length;
2279};, hterm.Parser.prototype.reset = function(e, t) {
2280 this.source = e, this.pos = t || 0, this.ch = e.substr(0, 1);
2281};, hterm.Parser.prototype.parseKeySequence = function() {
2282 var e = {
2283 keyCode: null
2284 };
2285 for (var t in hterm.Parser.identifiers.modifierKeys) e[hterm.Parser.identifiers.modifierKeys[t]] = !1;
2286 for (; this.pos < this.source.length;) {
2287 this.skipSpace();
2288 var r = this.parseToken();
2289 if ('integer' == r.type) e.keyCode = r.value;
2290 else if ('identifier' == r.type)
2291 if (r.value in hterm.Parser.identifiers.modifierKeys) {
2292 var o = hterm.Parser.identifiers.modifierKeys[r.value];
2293 if (e[o] && '*' != e[o]) throw this.error('Duplicate modifier: ' + r.value);
2294 e[o] = !0;
2295 }
2296 else {
2297 if (!(r.value in hterm.Parser.identifiers.keyCodes)) throw this.error('Unknown key: ' + r.value);
2298 e.keyCode = hterm.Parser.identifiers.keyCodes[r.value];
2299 }
2300 else {
2301 if ('symbol' != r.type) throw this.error('Expected integer or identifier');
2302 if ('*' != r.value) throw this.error('Unexpected symbol: ' + r.value);
2303 for (var i in hterm.Parser.identifiers.modifierKeys) {
2304 var s = hterm.Parser.identifiers.modifierKeys[i];
2305 e[s] || (e[s] = '*');
2306 }
2307 }
2308 if (this.skipSpace(), '-' != this.ch) break;
2309 if (null != e.keyCode) throw this.error('Extra definition after target key');
2310 this.advance(1);
2311 }
2312 if (null == e.keyCode) throw this.error('Missing target key');
2313 return e;
2314};, hterm.Parser.prototype.parseKeyAction = function() {
2315 this.skipSpace();
2316 var e = this.parseToken();
2317 if ('string' == e.type) return e.value;
2318 if ('identifier' == e.type) {
2319 if (e.value in hterm.Parser.identifiers.actions) return hterm.Parser.identifiers.actions[e.value];
2320 throw this.error('Unknown key action: ' + e.value);
2321 }
2322 throw this.error('Expected string or identifier');
2323};, hterm.Parser.prototype.peekString = function() {
2324 return "'" == this.ch || '"' == this.ch;
2325};, hterm.Parser.prototype.peekIdentifier = function() {
2326 return this.ch.match(/[a-z_]/i);
2327};, hterm.Parser.prototype.peekInteger = function() {
2328 return this.ch.match(/[0-9]/);
2329};, hterm.Parser.prototype.parseToken = function() {
2330 if ('*' == this.ch) {
2331 var e = {
2332 type: 'symbol',
2333 value: this.ch
2334 };
2335 return this.advance(1), e;
2336 }
2337 if (this.peekIdentifier()) return {
2338 type: 'identifier',
2339 value: this.parseIdentifier()
2340 };
2341 if (this.peekString()) return {
2342 type: 'string',
2343 value: this.parseString()
2344 };
2345 if (this.peekInteger()) return {
2346 type: 'integer',
2347 value: this.parseInteger()
2348 };
2349 throw this.error('Unexpected token');
2350};, hterm.Parser.prototype.parseIdentifier = function() {
2351 if (!this.peekIdentifier()) throw this.error('Expected identifier');
2352 return this.parsePattern(/[a-z0-9_]+/gi);
2353};, hterm.Parser.prototype.parseInteger = function() {
2354 return '0' == this.ch && this.pos < this.source.length - 1 && 'x' == this.source.substr(this.pos + 1, 1) ? parseInt(this.parsePattern(/0x[0-9a-f]+/gi)) : parseInt(this.parsePattern(/\d+/g));
2355};, hterm.Parser.prototype.parseString = function() {
2356 var e = '',
2357 t = this.ch;
2358 if ('"' != t && "'" != t) throw this.error('String expected');
2359 this.advance(1);
2360 for (var r = new RegExp('[\\\\' + t + ']', 'g'); this.pos < this.source.length;) {
2361 if (r.lastIndex = this.pos, !r.exec(this.source)) throw this.error('Unterminated string literal');
2362 if (e += this.source.substring(this.pos, r.lastIndex - 1), this.advance(r.lastIndex - this.pos - 1), '"' != t || '\\' != this.ch)
2363 if ("'" != t || '\\' != this.ch) {
2364 if (this.ch == t) return this.advance(1), e;
2365 }
2366 else e += this.ch, this.advance(1);
2367 else this.advance(1), e += this.parseEscape();
2368 }
2369 throw this.error('Unterminated string literal');
2370};, hterm.Parser.prototype.parseEscape = function() {
2371 var e = {
2372 '"': '"',
2373 "'": "'",
2374 '\\': '\\',
2375 a: '',
2376 b: '\b',
2377 e: '',
2378 f: '\f',
2379 n: '\n',
2380 r: '\r',
2381 t: ' ',
2382 v: ' ',
2383 x: function() {
2384 var e = this.parsePattern(/[a-z0-9]{2}/gi);
2385 return String.fromCharCode(parseInt(e, 16));
2386 },
2387 u: function() {
2388 var e = this.parsePattern(/[a-z0-9]{4}/gi);
2389 return String.fromCharCode(parseInt(e, 16));
2390 }
2391 };
2392 if (!(this.ch in e)) throw this.error('Unknown escape: ' + this.ch);
2393 var t = e[this.ch];
2394 return this.advance(1), 'function' == typeof t && (t = t.call(this)), t;
2395};, hterm.Parser.prototype.parsePattern = function(e) {
2396 if (!e.global) throw this.error('Internal error: Span patterns must be global');
2397 e.lastIndex = this.pos;
2398 var t = e.exec(this.source);
2399 if (!t || e.lastIndex - t[0].length != this.pos) throw this.error('Expected match for: ' + e);
2400 return this.pos = e.lastIndex - 1, this.advance(1), t[0];
2401};, hterm.Parser.prototype.advance = function(e) {
2402 this.pos += e, this.ch = this.source.substr(this.pos, 1);
2403};, hterm.Parser.prototype.skipSpace = function(e) {
2404 if (/\s/.test(this.ch)) {
2405 var t = /\s+/gm;
2406 t.lastIndex = this.pos;
2407 var r = this.source;
2408 if (t.exec(r) && (this.pos = t.lastIndex), this.ch = this.source.substr(this.pos, 1), e && -1 == this.ch.indexOf(e)) throw this.error('Expected one of ' + e + ', found: ' + this.ch);
2409 }
2410};, hterm.Parser.identifiers = {}, hterm.Parser.identifiers.modifierKeys = {
2411 Shift: 'shift',
2412 Ctrl: 'ctrl',
2413 Alt: 'alt',
2414 Meta: 'meta'
2415}, hterm.Parser.identifiers.keyCodes = {
2416 ESC: 27,
2417 F1: 112,
2418 F2: 113,
2419 F3: 114,
2420 F4: 115,
2421 F5: 116,
2422 F6: 117,
2423 F7: 118,
2424 F8: 119,
2425 F9: 120,
2426 F10: 121,
2427 F11: 122,
2428 F12: 123,
2429 ONE: 49,
2430 TWO: 50,
2431 THREE: 51,
2432 FOUR: 52,
2433 FIVE: 53,
2434 SIX: 54,
2435 SEVEN: 55,
2436 EIGHT: 56,
2437 NINE: 57,
2438 ZERO: 48,
2439 BACKSPACE: 8,
2440 TAB: 9,
2441 Q: 81,
2442 W: 87,
2443 E: 69,
2444 R: 82,
2445 T: 84,
2446 Y: 89,
2447 U: 85,
2448 I: 73,
2449 O: 79,
2450 P: 80,
2451 CAPSLOCK: 20,
2452 A: 65,
2453 S: 83,
2454 D: 68,
2455 F: 70,
2456 G: 71,
2457 H: 72,
2458 J: 74,
2459 K: 75,
2460 L: 76,
2461 ENTER: 13,
2462 Z: 90,
2463 X: 88,
2464 C: 67,
2465 V: 86,
2466 B: 66,
2467 N: 78,
2468 M: 77,
2469 SPACE: 32,
2470 PRINT_SCREEN: 42,
2471 SCROLL_LOCK: 145,
2472 BREAK: 19,
2473 INSERT: 45,
2474 HOME: 36,
2475 PGUP: 33,
2476 DEL: 46,
2477 END: 35,
2478 PGDOWN: 34,
2479 UP: 38,
2480 DOWN: 40,
2481 RIGHT: 39,
2482 LEFT: 37,
2483 NUMLOCK: 144,
2484 KP0: 96,
2485 KP1: 97,
2486 KP2: 98,
2487 KP3: 99,
2488 KP4: 100,
2489 KP5: 101,
2490 KP6: 102,
2491 KP7: 103,
2492 KP8: 104,
2493 KP9: 105,
2494 KP_PLUS: 107,
2495 KP_MINUS: 109,
2496 KP_STAR: 106,
2497 KP_DIVIDE: 111,
2498 KP_DECIMAL: 110,
2499 NAVIGATE_BACK: 166,
2500 NAVIGATE_FORWARD: 167,
2501 RELOAD: 168,
2502 FULL_SCREEN: 183,
2503 WINDOW_OVERVIEW: 182,
2504 BRIGHTNESS_UP: 216,
2505 BRIGHTNESS_DOWN: 217
2506}, hterm.Parser.identifiers.actions = {
2507 CANCEL: hterm.Keyboard.KeyActions.CANCEL,
2508 DEFAULT: hterm.Keyboard.KeyActions.DEFAULT,
2509 PASS: hterm.Keyboard.KeyActions.PASS,
2510 scrollPageUp: function(e) {
2511 return e.scrollPageUp(), hterm.Keyboard.KeyActions.CANCEL;
2512 },
2513 scrollPageDown: function(e) {
2514 return e.scrollPageDown(), hterm.Keyboard.KeyActions.CANCEL;
2515 },
2516 scrollToTop: function(e) {
2517 return e.scrollEnd(), hterm.Keyboard.KeyActions.CANCEL;
2518 },
2519 scrollToBottom: function(e) {
2520 return e.scrollEnd(), hterm.Keyboard.KeyActions.CANCEL;
2521 },
2522 clearScrollback: function(e) {
2523 return e.wipeContents(), hterm.Keyboard.KeyActions.CANCEL;
2524 }
2525}, lib.rtdep('lib.f', 'lib.Storage'), hterm.PreferenceManager = function(e) {
2526 lib.PreferenceManager.call(this, hterm.defaultStorage, '/hterm/profiles/' + e);
2527 var t = hterm.PreferenceManager.defaultPreferences;
2528 Object.keys(t).forEach(function(e) {
2529 this.definePreference(e, t[e][1]);
2530 }.bind(this));
2531};, hterm.PreferenceManager.categories = {}, hterm.PreferenceManager.categories.Keyboard = 'Keyboard', hterm.PreferenceManager.categories.Appearance = 'Appearance', hterm.PreferenceManager.categories.CopyPaste = 'CopyPaste', hterm.PreferenceManager.categories.Sounds = 'Sounds', hterm.PreferenceManager.categories.Scrolling = 'Scrolling', hterm.PreferenceManager.categories.Encoding = 'Encoding', hterm.PreferenceManager.categories.Miscellaneous = 'Miscellaneous', hterm.PreferenceManager.categoryDefinitions = [{
2532 id: hterm.PreferenceManager.categories.Appearance,
2533 text: 'Appearance (fonts, colors, images)'
2534}, {
2535 id: hterm.PreferenceManager.categories.CopyPaste,
2536 text: 'Copy & Paste'
2537}, {
2538 id: hterm.PreferenceManager.categories.Encoding,
2539 text: 'Encoding'
2540}, {
2541 id: hterm.PreferenceManager.categories.Keyboard,
2542 text: 'Keyboard'
2543}, {
2544 id: hterm.PreferenceManager.categories.Scrolling,
2545 text: 'Scrolling'
2546}, {
2547 id: hterm.PreferenceManager.categories.Sounds,
2548 text: 'Sounds'
2549}, {
2550 id: hterm.PreferenceManager.categories.Miscellaneous,
2551 text: 'Misc.'
2552}], hterm.PreferenceManager.defaultPreferences = {
2553 'alt-gr-mode': [hterm.PreferenceManager.categories.Keyboard, null, [null, 'none', 'ctrl-alt', 'left-alt', 'right-alt'], "Select an AltGr detection hack^Wheuristic.\n\n'null': Autodetect based on navigator.language:\n 'en-us' => 'none', else => 'right-alt'\n'none': Disable any AltGr related munging.\n'ctrl-alt': Assume Ctrl+Alt means AltGr.\n'left-alt': Assume left Alt means AltGr.\n'right-alt': Assume right Alt means AltGr.\n"],
2554 'alt-backspace-is-meta-backspace': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'If set, undoes the Chrome OS Alt-Backspace->DEL remap, so that alt-backspace indeed is alt-backspace.'],
2555 'alt-is-meta': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'Set whether the alt key acts as a meta key or as a distinct alt key.'],
2556 'alt-sends-what': [hterm.PreferenceManager.categories.Keyboard, 'escape', ['escape', '8-bit', 'browser-key'], "Controls how the alt key is handled.\n\n escape....... Send an ESC prefix.\n 8-bit........ Add 128 to the unshifted character as in xterm.\n browser-key.. Wait for the keypress event and see what the browser \n says. (This won't work well on platforms where the \n browser performs a default action for some alt sequences.)"],
2557 'audible-bell-sound': [hterm.PreferenceManager.categories.Sounds, 'lib-resource:hterm/audio/bell', 'url', 'URL of the terminal bell sound. Empty string for no audible bell.'],
2558 'desktop-notification-bell': [hterm.PreferenceManager.categories.Sounds, !1, 'bool', 'If true, terminal bells in the background will create a Web Notification. https://www.w3.org/TR/notifications/\n\nDisplaying notifications requires permission from the user. When this option is set to true, hterm will attempt to ask the user for permission if necessary. Note browsers may not show this permission request if it did not originate from a user action.\n\nChrome extensions with the "notifications" permission have permission to display notifications.'],
2559 'background-color': [hterm.PreferenceManager.categories.Appearance, 'rgb(16, 16, 16)', 'color', 'The background color for text with no other color attributes.'],
2560 'background-image': [hterm.PreferenceManager.categories.Appearance, '', 'string', 'CSS value of the background image. Empty string for no image.\n\nFor example:\n url(https://goo.gl/anedTK)\n linear-gradient(top bottom, blue, red)'],
2561 'background-size': [hterm.PreferenceManager.categories.Appearance, '', 'string', 'CSS value of the background image size. Defaults to none.'],
2562 'background-position': [hterm.PreferenceManager.categories.Appearance, '', 'string', 'CSS value of the background image position.\n\nFor example:\n 10% 10%\n center'],
2563 'backspace-sends-backspace': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', "If true, the backspace should send BS ('\\x08', aka ^H). Otherwise the backspace key should send '\\x7f'."],
2564 'character-map-overrides': [hterm.PreferenceManager.categories.Appearance, null, 'value', 'This is specified as an object. It is a sparse array, where each property is the character set code and the value is an object that is a sparse array itself. In that sparse array, each property is the received character and the value is the displayed character.\n\nFor example:\n {"0":{"+":"\\u2192",",":"\\u2190","-":"\\u2191",".":"\\u2193", "0":"\\u2588"}}'],
2565 'close-on-exit': [hterm.PreferenceManager.categories.Miscellaneous, !0, 'bool', 'Whether or not to close the window when the command exits.'],
2566 'cursor-blink': [hterm.PreferenceManager.categories.Appearance, !1, 'bool', 'Whether or not to blink the cursor by default.'],
2567 'cursor-blink-cycle': [hterm.PreferenceManager.categories.Appearance, [1e3, 500], 'value', 'The cursor blink rate in milliseconds.\n\nA two element array, the first of which is how long the cursor should be on, second is how long it should be off.'],
2568 'cursor-color': [hterm.PreferenceManager.categories.Appearance, 'rgba(255, 0, 0, 0.5)', 'color', 'The color of the visible cursor.'],
2569 'color-palette-overrides': [hterm.PreferenceManager.categories.Appearance, null, 'value', "Override colors in the default palette.\n\nThis can be specified as an array or an object. If specified as an object it is assumed to be a sparse array, where each property is a numeric index into the color palette.\n\nValues can be specified as almost any css color value. This includes #RGB, #RRGGBB, rgb(...), rgba(...), and any color names that are also part of the stock X11 rgb.txt file.\n\nYou can use 'null' to specify that the default value should be not be changed. This is useful for skipping a small number of indices when the value is specified as an array."],
2570 'copy-on-select': [hterm.PreferenceManager.categories.CopyPaste, !0, 'bool', 'Automatically copy mouse selection to the clipboard.'],
2571 'use-default-window-copy': [hterm.PreferenceManager.categories.CopyPaste, !1, 'bool', 'Whether to use the default window copy behavior'],
2572 'clear-selection-after-copy': [hterm.PreferenceManager.categories.CopyPaste, !0, 'bool', 'Whether to clear the selection after copying.'],
2573 'ctrl-plus-minus-zero-zoom': [hterm.PreferenceManager.categories.Keyboard, !0, 'bool', 'If true, Ctrl-Plus/Minus/Zero controls zoom.\nIf false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_, Ctrl-Plus/Zero do nothing.'],
2574 'ctrl-c-copy': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'Ctrl+C copies if true, send ^C to host if false.\nCtrl+Shift+C sends ^C to host if true, copies if false.'],
2575 'ctrl-v-paste': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'Ctrl+V pastes if true, send ^V to host if false.\nCtrl+Shift+V sends ^V to host if true, pastes if false.'],
2576 'east-asian-ambiguous-as-two-column': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'Set whether East Asian Ambiguous characters have two column width.'],
2577 'enable-8-bit-control': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', "True to enable 8-bit control characters, false to ignore them.\n\nWe'll respect the two-byte versions of these control characters regardless of this setting."],
2578 'enable-bold': [hterm.PreferenceManager.categories.Appearance, null, 'tristate', 'True if we should use bold weight font for text with the bold/bright attribute. False to use the normal weight font. Null to autodetect.'],
2579 'enable-bold-as-bright': [hterm.PreferenceManager.categories.Appearance, !0, 'bool', 'True if we should use bright colors (8-15 on a 16 color palette) for any text with the bold attribute. False otherwise.'],
2580 'enable-blink': [hterm.PreferenceManager.categories.Appearance, !0, 'bool', 'True if we should respect the blink attribute. False to ignore it. '],
2581 'enable-clipboard-notice': [hterm.PreferenceManager.categories.CopyPaste, !0, 'bool', 'Show a message in the terminal when the host writes to the clipboard.'],
2582 'enable-clipboard-write': [hterm.PreferenceManager.categories.CopyPaste, !0, 'bool', 'Allow the host to write directly to the system clipboard.'],
2583 'enable-dec12': [hterm.PreferenceManager.categories.Miscellaneous, !1, 'bool', "Respect the host's attempt to change the cursor blink status using DEC Private Mode 12."],
2584 environment: [hterm.PreferenceManager.categories.Miscellaneous, {
2585 TERM: 'xterm-256color'
2586 }, 'value', 'The default environment variables, as an object.'],
2587 'font-family': [hterm.PreferenceManager.categories.Appearance, '"DejaVu Sans Mono", "Everson Mono", FreeMono, "Menlo", "Terminal", monospace', 'string', 'Default font family for the terminal text.'],
2588 'font-size': [hterm.PreferenceManager.categories.Appearance, 15, 'int', 'The default font size in pixels.'],
2589 'font-smoothing': [hterm.PreferenceManager.categories.Appearance, 'antialiased', 'string', 'CSS font-smoothing property.'],
2590 'foreground-color': [hterm.PreferenceManager.categories.Appearance, 'rgb(240, 240, 240)', 'color', 'The foreground color for text with no other color attributes.'],
2591 'home-keys-scroll': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'If true, home/end will control the terminal scrollbar and shift home/end will send the VT keycodes. If false then home/end sends VT codes and shift home/end scrolls.'],
2592 keybindings: [hterm.PreferenceManager.categories.Keyboard, null, 'value', 'A map of key sequence to key actions. Key sequences include zero or more modifier keys followed by a key code. Key codes can be decimal or hexadecimal numbers, or a key identifier. Key actions can be specified a string to send to the host, or an action identifier. For a full list of key code and action identifiers, see https://goo.gl/8AoD09.\n\nSample keybindings:\n{ "Ctrl-Alt-K": "clearScrollback",\n "Ctrl-Shift-L": "PASS",\n "Ctrl-H": "\'HELLO\\n\'"\n}'],
2593 'max-string-sequence': [hterm.PreferenceManager.categories.Encoding, 1e5, 'int', 'Max length of a DCS, OSC, PM, or APS sequence before we give up and ignore the code.'],
2594 'media-keys-are-fkeys': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'If true, convert media keys to their Fkey equivalent. If false, let the browser handle the keys.'],
2595 'meta-sends-escape': [hterm.PreferenceManager.categories.Keyboard, !0, 'bool', 'Set whether the meta key sends a leading escape or not.'],
2596 'mouse-paste-button': [hterm.PreferenceManager.categories.CopyPaste, null, [null, 0, 1, 2, 3, 4, 5, 6], "Mouse paste button, or null to autodetect.\n\nFor autodetect, we'll try to enable middle button paste for non-X11 platforms. On X11 we move it to button 3."],
2597 'page-keys-scroll': [hterm.PreferenceManager.categories.Keyboard, !1, 'bool', 'If true, page up/down will control the terminal scrollbar and shift page up/down will send the VT keycodes. If false then page up/down sends VT codes and shift page up/down scrolls.'],
2598 'pass-alt-number': [hterm.PreferenceManager.categories.Keyboard, null, 'tristate', "Set whether we should pass Alt-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Alt-1..9 will be handled by the browser. If false, Alt-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],
2599 'pass-ctrl-number': [hterm.PreferenceManager.categories.Keyboard, null, 'tristate', "Set whether we should pass Ctrl-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Ctrl-1..9 will be handled by the browser. If false, Ctrl-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],
2600 'pass-meta-number': [hterm.PreferenceManager.categories.Keyboard, null, 'tristate', "Set whether we should pass Meta-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Meta-1..9 will be handled by the browser. If false, Meta-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],
2601 'pass-meta-v': [hterm.PreferenceManager.categories.Keyboard, !0, 'bool', 'Set whether meta-V gets passed to host.'],
2602 'receive-encoding': [hterm.PreferenceManager.categories.Encoding, 'utf-8', ['utf-8', 'raw'], "Set the expected encoding for data received from the host.\n\nValid values are 'utf-8' and 'raw'."],
2603 'scroll-on-keystroke': [hterm.PreferenceManager.categories.Scrolling, !0, 'bool', 'If true, scroll to the bottom on any keystroke.'],
2604 'scroll-on-output': [hterm.PreferenceManager.categories.Scrolling, !1, 'bool', 'If true, scroll to the bottom on terminal output.'],
2605 'scrollbar-visible': [hterm.PreferenceManager.categories.Scrolling, !0, 'bool', 'The vertical scrollbar mode.'],
2606 'scroll-wheel-move-multiplier': [hterm.PreferenceManager.categories.Scrolling, 1, 'int', 'The multiplier for the pixel delta in mousewheel event caused by the scroll wheel. Alters how fast the page scrolls.'],
2607 'send-encoding': [hterm.PreferenceManager.categories.Encoding, 'utf-8', ['utf-8', 'raw'], 'Set the encoding for data sent to host.'],
2608 'shift-insert-paste': [hterm.PreferenceManager.categories.Keyboard, !0, 'bool', 'Shift + Insert pastes if true, sent to host if false.'],
2609 'user-css': [hterm.PreferenceManager.categories.Appearance, '', 'url', 'URL of user stylesheet to include in the terminal document.']
2610}, hterm.PreferenceManager.prototype = {
2611 __proto__: lib.PreferenceManager.prototype
2612}, hterm.PubSub = function() {
2613 this.observers_ = {};
2614};, hterm.PubSub.addBehavior = function(e) {
2615 var t = new hterm.PubSub;
2616 for (var r in hterm.PubSub.prototype) e[r] = hterm.PubSub.prototype[r].bind(t);
2617};, hterm.PubSub.prototype.subscribe = function(e, t) {
2618 e in this.observers_ || (this.observers_[e] = []), this.observers_[e].push(t);
2619};, hterm.PubSub.prototype.unsubscribe = function(e, t) {
2620 var r = this.observers_[e];
2621 if (!r) throw 'Invalid subject: ' + e;
2622 var o = r.indexOf(t);
2623 if (0 > o) throw 'Not subscribed: ' + e;
2624 r.splice(o, 1);
2625};, hterm.PubSub.prototype.publish = function(e, t, r) {
2626 function o(e) {
2627 e < i.length - 1 && setTimeout(o, 0, e + 1), i[e](t);
2628 }
2629 var i = this.observers_[e];
2630 i && (i = [].concat(i)), r && (i ? i.push(r) : i = [r]), i && setTimeout(o, 0, 0);
2631};, lib.rtdep('lib.f', 'lib.wc', 'hterm.RowCol', 'hterm.Size', 'hterm.TextAttributes'), hterm.Screen = function(e) {
2632 this.rowsArray = [], this.columnCount_ = e || 80, this.textAttributes = new hterm.TextAttributes(window.document), this.cursorPosition = new hterm.RowCol(0, 0), this.cursorRowNode_ = null, this.cursorNode_ = null, this.cursorOffset_ = null;
2633};, hterm.Screen.prototype.getSize = function() {
2634 return new hterm.Size(this.columnCount_, this.rowsArray.length);
2635};, hterm.Screen.prototype.getHeight = function() {
2636 return this.rowsArray.length;
2637};, hterm.Screen.prototype.getWidth = function() {
2638 return this.columnCount_;
2639};, hterm.Screen.prototype.setColumnCount = function(e) {
2640 this.columnCount_ = e, this.cursorPosition.column >= e && this.setCursorPosition(this.cursorPosition.row, e - 1);
2641};, hterm.Screen.prototype.shiftRow = function() {
2642 return this.shiftRows(1)[0];
2643};, hterm.Screen.prototype.shiftRows = function(e) {
2644 return this.rowsArray.splice(0, e);
2645};, hterm.Screen.prototype.unshiftRow = function(e) {
2646 this.rowsArray.splice(0, 0, e);
2647};, hterm.Screen.prototype.unshiftRows = function(e) {
2648 this.rowsArray.unshift.apply(this.rowsArray, e);
2649};, hterm.Screen.prototype.popRow = function() {
2650 return this.popRows(1)[0];
2651};, hterm.Screen.prototype.popRows = function(e) {
2652 return this.rowsArray.splice(this.rowsArray.length - e, e);
2653};, hterm.Screen.prototype.pushRow = function(e) {
2654 this.rowsArray.push(e);
2655};, hterm.Screen.prototype.pushRows = function(e) {
2656 e.push.apply(this.rowsArray, e);
2657};, hterm.Screen.prototype.insertRow = function(e, t) {
2658 this.rowsArray.splice(e, 0, t);
2659};, hterm.Screen.prototype.insertRows = function(e, t) {
2660 for (var r = 0; r < t.length; r++) this.rowsArray.splice(e + r, 0, t[r]);
2661};, hterm.Screen.prototype.removeRow = function(e) {
2662 return this.rowsArray.splice(e, 1)[0];
2663};, hterm.Screen.prototype.removeRows = function(e, t) {
2664 return this.rowsArray.splice(e, t);
2665};, hterm.Screen.prototype.invalidateCursorPosition = function() {
2666 this.cursorPosition.move(0, 0), this.cursorRowNode_ = null, this.cursorNode_ = null, this.cursorOffset_ = null;
2667};, hterm.Screen.prototype.clearCursorRow = function() {
2668 this.cursorRowNode_.innerHTML = '', this.cursorRowNode_.removeAttribute('line-overflow'), this.cursorOffset_ = 0, this.cursorPosition.column = 0, this.cursorPosition.overflow = !1;
2669 var e;
2670 e = this.textAttributes.isDefault() ? '' : lib.f.getWhitespace(this.columnCount_);
2671 var t = this.textAttributes.inverse;
2672 this.textAttributes.inverse = !1, this.textAttributes.syncColors();
2673 var r = this.textAttributes.createContainer(e);
2674 this.cursorRowNode_.appendChild(r), this.cursorNode_ = r, this.textAttributes.inverse = t, this.textAttributes.syncColors();
2675};, hterm.Screen.prototype.commitLineOverflow = function() {
2676 this.cursorRowNode_.setAttribute('line-overflow', !0);
2677};, hterm.Screen.prototype.setCursorPosition = function(e, t) {
2678 if (!this.rowsArray.length) return void console.warn('Attempt to set cursor position on empty screen.');
2679 e >= this.rowsArray.length ? (console.error('Row out of bounds: ' + e), e = this.rowsArray.length - 1) : 0 > e && (console.error('Row out of bounds: ' + e), e = 0), t >= this.columnCount_ ? (console.error('Column out of bounds: ' + t), t = this.columnCount_ - 1) : 0 > t && (console.error('Column out of bounds: ' + t), t = 0), this.cursorPosition.overflow = !1;
2680 var r = this.rowsArray[e],
2681 o = r.firstChild;
2682 o || (o = r.ownerDocument.createTextNode(''), r.appendChild(o));
2683 var i = 0;
2684 for (r == this.cursorRowNode_ ? t >= this.cursorPosition.column - this.cursorOffset_ && (o = this.cursorNode_, i = this.cursorPosition.column - this.cursorOffset_) : this.cursorRowNode_ = r, this.cursorPosition.move(e, t); o;) {
2685 var s = t - i,
2686 n = hterm.TextAttributes.nodeWidth(o);
2687 if (!o.nextSibling || n > s) return this.cursorNode_ = o, void(this.cursorOffset_ = s);
2688 i += n, o = o.nextSibling;
2689 }
2690};, hterm.Screen.prototype.syncSelectionCaret = function(e) {
2691 try {
2692 e.collapse(this.cursorNode_, this.cursorOffset_);
2693 }
2694 catch (t) {}
2695};, hterm.Screen.prototype.splitNode_ = function(e, t) {
2696 var r = e.cloneNode(!1),
2697 o = e.textContent;
2698 e.textContent = hterm.TextAttributes.nodeSubstr(e, 0, t), r.textContent = lib.wc.substr(o, t), r.textContent && e.parentNode.insertBefore(r, e.nextSibling), e.textContent || e.parentNode.removeChild(e);
2699};, hterm.Screen.prototype.maybeClipCurrentRow = function() {
2700 var e = hterm.TextAttributes.nodeWidth(this.cursorRowNode_);
2701 if (e <= this.columnCount_) return void(this.cursorPosition.column >= this.columnCount_ && (this.setCursorPosition(this.cursorPosition.row, this.columnCount_ - 1), this.cursorPosition.overflow = !0));
2702 var t = this.cursorPosition.column;
2703 this.setCursorPosition(this.cursorPosition.row, this.columnCount_ - 1), e = hterm.TextAttributes.nodeWidth(this.cursorNode_), this.cursorOffset_ < e - 1 && (this.cursorNode_.textContent = hterm.TextAttributes.nodeSubstr(this.cursorNode_, 0, this.cursorOffset_ + 1));
2704 for (var r = this.cursorRowNode_, o = this.cursorNode_.nextSibling; o;) r.removeChild(o), o = this.cursorNode_.nextSibling;
2705 t < this.columnCount_ ? this.setCursorPosition(this.cursorPosition.row, t) : this.cursorPosition.overflow = !0;
2706};, hterm.Screen.prototype.insertString = function(e) {
2707 var t = this.cursorNode_,
2708 r = t.textContent;
2709 this.cursorRowNode_.removeAttribute('line-overflow');
2710 var o = lib.wc.strWidth(e);
2711 this.cursorPosition.column += o;
2712 var i = this.cursorOffset_,
2713 s = hterm.TextAttributes.nodeWidth(t) - i;
2714 if (0 > s) {
2715 var n = lib.f.getWhitespace(-s);
2716 if (this.textAttributes.underline || this.textAttributes.strikethrough || this.textAttributes.background || this.textAttributes.wcNode || null != this.textAttributes.tileData)
2717 if (3 != t.nodeType && (t.wcNode || t.tileNode || t.style.textDecoration || t.style.backgroundColor)) {
2718 var a = t.ownerDocument.createTextNode(n);
2719 this.cursorRowNode_.insertBefore(a, t.nextSibling), this.cursorNode_ = t = a, this.cursorOffset_ = i = -s, r = n;
2720 }
2721 else t.textContent = r += n;
2722 else e = n + e;
2723 s = 0;
2724 }
2725 if (this.textAttributes.matchesContainer(t)) return 0 == s ? t.textContent = r + e : 0 == i ? t.textContent = e + r : t.textContent = hterm.TextAttributes.nodeSubstr(t, 0, i) + e + hterm.TextAttributes.nodeSubstr(t, i), void(this.cursorOffset_ += o);
2726 if (0 == i) {
2727 var l = t.previousSibling;
2728 if (l && this.textAttributes.matchesContainer(l)) return l.textContent += e, this.cursorNode_ = l, void(this.cursorOffset_ = lib.wc.strWidth(l.textContent));
2729 var h = this.textAttributes.createContainer(e);
2730 return this.cursorRowNode_.insertBefore(h, t), this.cursorNode_ = h, void(this.cursorOffset_ = o);
2731 }
2732 if (0 == s) {
2733 var c = t.nextSibling;
2734 if (c && this.textAttributes.matchesContainer(c)) return c.textContent = e + c.textContent, this.cursorNode_ = c, void(this.cursorOffset_ = lib.wc.strWidth(e));
2735 var h = this.textAttributes.createContainer(e);
2736 return this.cursorRowNode_.insertBefore(h, c), this.cursorNode_ = h, void(this.cursorOffset_ = hterm.TextAttributes.nodeWidth(h));
2737 }
2738 this.splitNode_(t, i);
2739 var h = this.textAttributes.createContainer(e);
2740 this.cursorRowNode_.insertBefore(h, t.nextSibling), this.cursorNode_ = h, this.cursorOffset_ = o;
2741};, hterm.Screen.prototype.overwriteString = function(e) {
2742 var t = this.columnCount_ - this.cursorPosition.column;
2743 if (!t) return [e];
2744 var r = lib.wc.strWidth(e);
2745 return this.textAttributes.matchesContainer(this.cursorNode_) && this.cursorNode_.textContent.substr(this.cursorOffset_) == e ? (this.cursorOffset_ += r, void(this.cursorPosition.column += r)) : (this.deleteChars(Math.min(r, t)), void this.insertString(e));
2746};, hterm.Screen.prototype.deleteChars = function(e) {
2747 var t = this.cursorNode_,
2748 r = this.cursorOffset_,
2749 o = this.cursorPosition.column;
2750 if (e = Math.min(e, this.columnCount_ - o), !e) return 0;
2751 for (var i, s, n = e; t && e;) {
2752 if (i = hterm.TextAttributes.nodeWidth(t), t.textContent = hterm.TextAttributes.nodeSubstr(t, 0, r) + hterm.TextAttributes.nodeSubstr(t, r + e), s = hterm.TextAttributes.nodeWidth(t), e -= i - s, i > r && s && i == s) {
2753 var a = this.textAttributes.createContainer(' ');
2754 t.parentNode.insertBefore(a, t.nextSibling), t.textContent = '', s = 0, e -= 1;
2755 }
2756 var l = t.nextSibling;
2757 0 == s && t != this.cursorNode_ && t.parentNode.removeChild(t), t = l, r = 0;
2758 }
2759 if (3 != this.cursorNode_.nodeType && !this.cursorNode_.textContent) {
2760 var h = this.cursorNode_;
2761 if (h.previousSibling) this.cursorNode_ = h.previousSibling, this.cursorOffset_ = hterm.TextAttributes.nodeWidth(h.previousSibling);
2762 else if (h.nextSibling) this.cursorNode_ = h.nextSibling, this.cursorOffset_ = 0;
2763 else {
2764 var c = this.cursorRowNode_.ownerDocument.createTextNode('');
2765 this.cursorRowNode_.appendChild(c), this.cursorNode_ = c, this.cursorOffset_ = 0;
2766 }
2767 this.cursorRowNode_.removeChild(h);
2768 }
2769 return n;
2770};, hterm.Screen.prototype.getLineStartRow_ = function(e) {
2771 for (; e.previousSibling && e.previousSibling.hasAttribute('line-overflow');) e = e.previousSibling;
2772 return e;
2773};, hterm.Screen.prototype.getLineText_ = function(e) {
2774 for (var t = ''; e && (t += e.textContent, e.hasAttribute('line-overflow'));) e = e.nextSibling;
2775 return t;
2776};, hterm.Screen.prototype.getXRowAncestor_ = function(e) {
2777 for (; e && 'X-ROW' !== e.nodeName;) e = e.parentNode;
2778 return e;
2779};, hterm.Screen.prototype.getPositionWithOverflow_ = function(e, t, r) {
2780 if (!t) return -1;
2781 var o = this.getXRowAncestor_(t);
2782 if (!o) return -1;
2783 for (var i = 0; o != e;) {
2784 if (i += hterm.TextAttributes.nodeWidth(e), !e.hasAttribute('line-overflow') || !e.nextSibling) return -1;
2785 e = e.nextSibling;
2786 }
2787 return i + this.getPositionWithinRow_(e, t, r);
2788};, hterm.Screen.prototype.getPositionWithinRow_ = function(e, t, r) {
2789 if (t.parentNode != e) return this.getPositionWithinRow_(t.parentNode, t, r) + this.getPositionWithinRow_(e, t.parentNode, 0);
2790 for (var o = 0, i = 0; i < e.childNodes.length; i++) {
2791 var s = e.childNodes[i];
2792 if (s == t) return o + r;
2793 o += hterm.TextAttributes.nodeWidth(s);
2794 }
2795 return -1;
2796};, hterm.Screen.prototype.getNodeAndOffsetWithOverflow_ = function(e, t) {
2797 for (; e && t > hterm.TextAttributes.nodeWidth(e);) {
2798 if (!e.hasAttribute('line-overflow') || !e.nextSibling) return -1;
2799 t -= hterm.TextAttributes.nodeWidth(e), e = e.nextSibling;
2800 }
2801 return this.getNodeAndOffsetWithinRow_(e, t);
2802};, hterm.Screen.prototype.getNodeAndOffsetWithinRow_ = function(e, t) {
2803 for (var r = 0; r < e.childNodes.length; r++) {
2804 var o = e.childNodes[r],
2805 i = hterm.TextAttributes.nodeWidth(o);
2806 if (i >= t) return 'SPAN' === o.nodeName ? this.getNodeAndOffsetWithinRow_(o, t) : [o, t];
2807 t -= i;
2808 }
2809 return null;
2810};, hterm.Screen.prototype.setRange_ = function(e, t, r, o) {
2811 var i = this.getNodeAndOffsetWithOverflow_(e, t);
2812 if (null != i) {
2813 var s = this.getNodeAndOffsetWithOverflow_(e, r);
2814 null != s && (o.setStart(i[0], i[1]), o.setEnd(s[0], s[1]));
2815 }
2816};, hterm.Screen.prototype.expandSelection = function(e) {
2817 if (e) {
2818 var t = e.getRangeAt(0);
2819 if (t && !t.toString().match(/\s/)) {
2820 var r = this.getLineStartRow_(this.getXRowAncestor_(t.startContainer));
2821 if (r) {
2822 var o = this.getPositionWithOverflow_(r, t.startContainer, t.startOffset);
2823 if (-1 != o) {
2824 var i = this.getPositionWithOverflow_(r, t.endContainer, t.endOffset);
2825 if (-1 != i) {
2826 var s = "[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:`]",
2827 n = "[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:~.`]",
2828 a = "[^\\s\\[\\](){}<>\"'\\^]*",
2829 l = this.getLineText_(r),
2830 h = lib.wc.substring(l, 0, i),
2831 c = new RegExp(s + a + '$'),
2832 u = h.search(c);
2833 if (!(-1 == u || u > o)) {
2834 var g = lib.wc.substring(l, o, lib.wc.strWidth(l)),
2835 d = new RegExp('^' + a + n),
2836 p = g.match(d);
2837 if (p) {
2838 var m = o + lib.wc.strWidth(p[0]); - 1 == m || i > m || (this.setRange_(r, u, m, t), e.addRange(t));
2839 }
2840 }
2841 }
2842 }
2843 }
2844 }
2845 }
2846};, lib.rtdep('lib.f', 'hterm.PubSub', 'hterm.Size'), hterm.ScrollPort = function(e) {
2847 hterm.PubSub.addBehavior(this), this.rowProvider_ = e, this.characterSize = new hterm.Size(10, 10), this.ruler_ = null, this.selection = new hterm.ScrollPort.Selection(this), this.currentRowNodeCache_ = null, this.previousRowNodeCache_ = {}, this.lastScreenWidth_ = null, this.lastScreenHeight_ = null, this.selectionEnabled_ = !0, this.lastRowCount_ = 0, this.scrollWheelMultiplier_ = 1, this.isScrolledEnd = !0, this.xrowCssRule_ = null, this.currentScrollbarWidthPx = 16, this.ctrlVPaste = !1, this.div_ = null, this.document_ = null, this.timeouts_ = {}, this.observers_ = {}, this.DEBUG_ = !1;
2848};, hterm.ScrollPort.Selection = function(e) {
2849 this.scrollPort_ = e, this.startRow = null, this.endRow = null, this.isMultiline = null, this.isCollapsed = null;
2850};, hterm.ScrollPort.Selection.prototype.findFirstChild = function(e, t) {
2851 for (var r = e.firstChild; r;) {
2852 if (-1 != t.indexOf(r)) return r;
2853 if (r.childNodes.length) {
2854 var o = this.findFirstChild(r, t);
2855 if (o) return o;
2856 }
2857 r = r.nextSibling;
2858 }
2859 return null;
2860};, hterm.ScrollPort.Selection.prototype.sync = function() {
2861 function e() {
2862 r.startRow = i, r.startNode = o.anchorNode, r.startOffset = o.anchorOffset, r.endRow = s, r.endNode = o.focusNode, r.endOffset = o.focusOffset;
2863 }
2864
2865 function t() {
2866 r.startRow = s, r.startNode = o.focusNode, r.startOffset = o.focusOffset, r.endRow = i, r.endNode = o.anchorNode, r.endOffset = o.anchorOffset;
2867 }
2868 var r = this,
2869 o = this.scrollPort_.getDocument().getSelection();
2870 if (this.startRow = null, this.endRow = null, this.isMultiline = null, this.isCollapsed = !o || o.isCollapsed, !this.isCollapsed) {
2871 for (var i = o.anchorNode; i && !('rowIndex' in i);) i = i.parentNode;
2872 if (!i) return void console.error('Selection anchor is not rooted in a row node: ' + o.anchorNode.nodeName);
2873 for (var s = o.focusNode; s && !('rowIndex' in s);) s = s.parentNode;
2874 if (!s) return void console.error('Selection focus is not rooted in a row node: ' + o.focusNode.nodeName);
2875 if (i.rowIndex < s.rowIndex) e();
2876 else if (i.rowIndex > s.rowIndex) t();
2877 else if (o.focusNode == o.anchorNode) o.anchorOffset < o.focusOffset ? e() : t();
2878 else {
2879 var n = this.findFirstChild(i, [o.anchorNode, o.focusNode]);
2880 if (!n) throw new Error('Unexpected error syncing selection.');
2881 n == o.anchorNode ? e() : t();
2882 }
2883 this.isMultiline = i.rowIndex != s.rowIndex;
2884 }
2885};, hterm.ScrollPort.prototype.decorate = function(e) {
2886 this.div_ = e, this.iframe_ = e.ownerDocument.createElement('iframe'), this.iframe_.style.cssText = 'border: 0;height: 100%;position: absolute;width: 100%', 'mozInnerScreenX' in window && (this.iframe_.src = '#'), e.appendChild(this.iframe_), this.iframe_.contentWindow.addEventListener('resize', this.onResize_.bind(this));
2887 var t = this.document_ = this.iframe_.contentDocument;
2888 t.body.style.cssText = 'margin: 0px;padding: 0px;height: 100%;width: 100%;overflow: hidden;cursor: text;-webkit-user-select: none;-moz-user-select: none;';
2889 var r = t.createElement('style');
2890 r.textContent = 'x-row {}', t.head.appendChild(r), this.xrowCssRule_ = t.styleSheets[0].cssRules[0], this.xrowCssRule_.style.display = 'block', this.userCssLink_ = t.createElement('link'), this.userCssLink_.setAttribute('rel', 'stylesheet'), this.screen_ = t.createElement('x-screen'), this.screen_.setAttribute('role', 'textbox'), this.screen_.setAttribute('tabindex', '-1'), this.screen_.style.cssText = 'display: block;font-family: monospace;font-size: 15px;font-variant-ligatures: none;height: 100%;overflow-y: scroll; overflow-x: hidden;white-space: pre;width: 100%;outline: none !important', t.body.appendChild(this.screen_), this.screen_.addEventListener('scroll', this.onScroll_.bind(this)), this.screen_.addEventListener('mousewheel', this.onScrollWheel_.bind(this)), this.screen_.addEventListener('DOMMouseScroll', this.onScrollWheel_.bind(this)), this.screen_.addEventListener('copy', this.onCopy_.bind(this)), this.screen_.addEventListener('paste', this.onPaste_.bind(this)), t.body.addEventListener('keydown', this.onBodyKeyDown_.bind(this)), this.rowNodes_ = t.createElement('div'), this.rowNodes_.style.cssText = 'display: block;position: fixed;overflow: hidden;-webkit-user-select: text;-moz-user-select: text;', this.screen_.appendChild(this.rowNodes_), this.topSelectBag_ = t.createElement('x-select-bag'), this.topSelectBag_.style.cssText = 'display: block;overflow: hidden;white-space: pre;', this.bottomSelectBag_ = this.topSelectBag_.cloneNode(), this.topFold_ = t.createElement('x-fold'), this.topFold_.style.cssText = 'display: block;', this.rowNodes_.appendChild(this.topFold_), this.bottomFold_ = this.topFold_.cloneNode(), this.rowNodes_.appendChild(this.bottomFold_), this.scrollArea_ = t.createElement('div'), this.scrollArea_.style.cssText = 'visibility: hidden', this.screen_.appendChild(this.scrollArea_);
2891 var o = 'http://www.w3.org/2000/svg';
2892 this.svg_ = this.div_.ownerDocument.createElementNS(o, 'svg'), this.svg_.setAttribute('xmlns', o), this.svg_.setAttribute('version', '1.1'), this.svg_.style.cssText = 'position: absolute;top: 0;left: 0;visibility: hidden', this.pasteTarget_ = t.createElement('textarea'), this.pasteTarget_.setAttribute('tabindex', '-1'), this.pasteTarget_.style.cssText = 'position: absolute;height: 1px;width: 1px;left: 0px; bottom: 0px;opacity: 0', this.pasteTarget_.contentEditable = !0, this.screen_.appendChild(this.pasteTarget_), this.pasteTarget_.addEventListener('textInput', this.handlePasteTargetTextInput_.bind(this)), this.resize();
2893};, hterm.ScrollPort.prototype.setFontFamily = function(e, t) {
2894 this.screen_.style.fontFamily = e, t ? this.screen_.style.webkitFontSmoothing = t : this.screen_.style.webkitFontSmoothing = '', this.syncCharacterSize();
2895};, hterm.ScrollPort.prototype.getFontFamily = function() {
2896 return this.screen_.style.fontFamily;
2897};, hterm.ScrollPort.prototype.setUserCss = function(e) {
2898 e ? (this.userCssLink_.setAttribute('href', e), this.userCssLink_.parentNode || this.document_.head.appendChild(this.userCssLink_)) : this.userCssLink_.parentNode && this.document_.head.removeChild(this.userCssLink_);
2899};, hterm.ScrollPort.prototype.focus = function() {
2900 this.iframe_.focus(), this.screen_.focus();
2901};, hterm.ScrollPort.prototype.getForegroundColor = function() {
2902 return this.screen_.style.color;
2903};, hterm.ScrollPort.prototype.setForegroundColor = function(e) {
2904 this.screen_.style.color = e;
2905};, hterm.ScrollPort.prototype.getBackgroundColor = function() {
2906 return this.screen_.style.backgroundColor;
2907};, hterm.ScrollPort.prototype.setBackgroundColor = function(e) {
2908 this.screen_.style.backgroundColor = e;
2909};, hterm.ScrollPort.prototype.setBackgroundImage = function(e) {
2910 this.screen_.style.backgroundImage = e;
2911};, hterm.ScrollPort.prototype.setBackgroundSize = function(e) {
2912 this.screen_.style.backgroundSize = e;
2913};, hterm.ScrollPort.prototype.setBackgroundPosition = function(e) {
2914 this.screen_.style.backgroundPosition = e;
2915};, hterm.ScrollPort.prototype.setCtrlVPaste = function(e) {
2916 this.ctrlVPaste = e;
2917};, hterm.ScrollPort.prototype.getScreenSize = function() {
2918 var e = hterm.getClientSize(this.screen_);
2919 return {
2920 height: e.height,
2921 width: e.width - this.currentScrollbarWidthPx
2922 };
2923};, hterm.ScrollPort.prototype.getScreenWidth = function() {
2924 return this.getScreenSize().width;
2925};, hterm.ScrollPort.prototype.getScreenHeight = function() {
2926 return this.getScreenSize().height;
2927};, hterm.ScrollPort.prototype.getDocument = function() {
2928 return this.document_;
2929};, hterm.ScrollPort.prototype.getScreenNode = function() {
2930 return this.screen_;
2931};, hterm.ScrollPort.prototype.resetCache = function() {
2932 this.currentRowNodeCache_ = null, this.previousRowNodeCache_ = {};
2933};, hterm.ScrollPort.prototype.setRowProvider = function(e) {
2934 this.resetCache(), this.rowProvider_ = e, this.scheduleRedraw();
2935};, hterm.ScrollPort.prototype.invalidate = function() {
2936 for (var e = this.topFold_.nextSibling; e != this.bottomFold_;) {
2937 var t = e.nextSibling;
2938 e.parentElement.removeChild(e), e = t;
2939 }
2940 this.previousRowNodeCache_ = null;
2941 var r = this.getTopRowIndex(),
2942 o = this.getBottomRowIndex(r);
2943 this.drawVisibleRows_(r, o);
2944};, hterm.ScrollPort.prototype.scheduleInvalidate = function() {
2945 if (!this.timeouts_.invalidate) {
2946 var e = this;
2947 this.timeouts_.invalidate = setTimeout(function() {
2948 delete e.timeouts_.invalidate, e.invalidate();
2949 }, 0);
2950 }
2951};, hterm.ScrollPort.prototype.setFontSize = function(e) {
2952 this.screen_.style.fontSize = e + 'px', this.syncCharacterSize();
2953};, hterm.ScrollPort.prototype.getFontSize = function() {
2954 return parseInt(this.screen_.style.fontSize);
2955};, hterm.ScrollPort.prototype.measureCharacterSize = function(e) {
2956 var t = 100,
2957 r = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
2958 if (!this.ruler_) {
2959 this.ruler_ = this.document_.createElement('div'), this.ruler_.style.cssText = 'position: absolute;top: 0;left: 0;visibility: hidden;height: auto !important;width: auto !important;', this.rulerSpan_ = this.document_.createElement('span');
2960 for (var o = '' + r, i = 0; t - 1 > i; ++i) o += String.fromCharCode(13) + r;
2961 this.rulerSpan_.innerHTML = o, this.ruler_.appendChild(this.rulerSpan_), this.rulerBaseline_ = this.document_.createElement('span'), this.rulerBaseline_.style.fontSize = '0px', this.rulerBaseline_.textContent = 'X';
2962 }
2963 this.rulerSpan_.style.fontWeight = e || '', this.rowNodes_.appendChild(this.ruler_);
2964 var s = hterm.getClientSize(this.rulerSpan_),
2965 n = new hterm.Size(s.width / r.length, s.height / t);
2966 return this.ruler_.appendChild(this.rulerBaseline_), n.baseline = this.rulerBaseline_.offsetTop, this.ruler_.removeChild(this.rulerBaseline_), this.rowNodes_.removeChild(this.ruler_), this.div_.ownerDocument.body.appendChild(this.svg_), n.zoomFactor = this.svg_.currentScale, this.div_.ownerDocument.body.removeChild(this.svg_), n;
2967};, hterm.ScrollPort.prototype.syncCharacterSize = function() {
2968 this.characterSize = this.measureCharacterSize();
2969 var e = this.characterSize.height + 'px';
2970 this.xrowCssRule_.style.height = e, this.topSelectBag_.style.height = e, this.bottomSelectBag_.style.height = e, this.resize(), this.DEBUG_ && (this.document_.body.style.paddingTop = this.document_.body.style.paddingBottom = 3 * this.characterSize.height + 'px');
2971};, hterm.ScrollPort.prototype.resize = function() {
2972 this.currentScrollbarWidthPx = hterm.getClientWidth(this.screen_) - this.screen_.clientWidth, this.syncScrollHeight(), this.syncRowNodesDimensions_();
2973 var e = this;
2974 this.publish('resize', {
2975 scrollPort: this
2976 }, function() {
2977 e.scrollRowToBottom(e.rowProvider_.getRowCount()), e.scheduleRedraw();
2978 });
2979};, hterm.ScrollPort.prototype.syncRowNodesDimensions_ = function() {
2980 var e = this.getScreenSize();
2981 this.lastScreenWidth_ = e.width, this.lastScreenHeight_ = e.height, this.visibleRowCount = lib.f.smartFloorDivide(e.height, this.characterSize.height);
2982 var t = this.visibleRowCount * this.characterSize.height;
2983 this.visibleRowTopMargin = 0, this.visibleRowBottomMargin = e.height - t, this.topFold_.style.marginBottom = this.visibleRowTopMargin + 'px';
2984 for (var r = 0, o = this.topFold_.previousSibling; o;) r += hterm.getClientHeight(o), o = o.previousSibling;
2985 this.rowNodes_.style.width = e.width + 'px', this.rowNodes_.style.height = t + r + 'px', this.rowNodes_.style.left = this.screen_.offsetLeft + 'px', this.rowNodes_.style.top = this.screen_.offsetTop - r + 'px';
2986};, hterm.ScrollPort.prototype.syncScrollHeight = function() {
2987 this.lastRowCount_ = this.rowProvider_.getRowCount(), this.scrollArea_.style.height = this.characterSize.height * this.lastRowCount_ + this.visibleRowTopMargin + this.visibleRowBottomMargin + 'px';
2988};, hterm.ScrollPort.prototype.scheduleRedraw = function() {
2989 if (!this.timeouts_.redraw) {
2990 var e = this;
2991 this.timeouts_.redraw = setTimeout(function() {
2992 delete e.timeouts_.redraw, e.redraw_();
2993 }, 0);
2994 }
2995};, hterm.ScrollPort.prototype.redraw_ = function() {
2996 this.resetSelectBags_(), this.selection.sync(), this.syncScrollHeight(), this.currentRowNodeCache_ = {};
2997 var e = this.getTopRowIndex(),
2998 t = this.getBottomRowIndex(e);
2999 this.drawTopFold_(e), this.drawBottomFold_(t), this.drawVisibleRows_(e, t), this.syncRowNodesDimensions_(), this.previousRowNodeCache_ = this.currentRowNodeCache_, this.currentRowNodeCache_ = null, this.isScrolledEnd = this.getTopRowIndex() + this.visibleRowCount >= this.lastRowCount_;
3000};, hterm.ScrollPort.prototype.drawTopFold_ = function(e) {
3001 if (!this.selection.startRow || this.selection.startRow.rowIndex >= e) return void(this.rowNodes_.firstChild != this.topFold_ && this.rowNodes_.insertBefore(this.topFold_, this.rowNodes_.firstChild));
3002 if (!this.selection.isMultiline || this.selection.endRow.rowIndex >= e) this.selection.startRow.nextSibling != this.topFold_ && this.rowNodes_.insertBefore(this.topFold_, this.selection.startRow.nextSibling);
3003 else
3004 for (this.selection.endRow.nextSibling != this.topFold_ && this.rowNodes_.insertBefore(this.topFold_, this.selection.endRow.nextSibling); this.selection.startRow.nextSibling != this.selection.endRow;) this.rowNodes_.removeChild(this.selection.startRow.nextSibling);
3005 for (; this.rowNodes_.firstChild != this.selection.startRow;) this.rowNodes_.removeChild(this.rowNodes_.firstChild);
3006};, hterm.ScrollPort.prototype.drawBottomFold_ = function(e) {
3007 if (!this.selection.endRow || this.selection.endRow.rowIndex <= e) return void(this.rowNodes_.lastChild != this.bottomFold_ && this.rowNodes_.appendChild(this.bottomFold_));
3008 if (!this.selection.isMultiline || this.selection.startRow.rowIndex <= e) this.bottomFold_.nextSibling != this.selection.endRow && this.rowNodes_.insertBefore(this.bottomFold_, this.selection.endRow);
3009 else
3010 for (this.bottomFold_.nextSibling != this.selection.startRow && this.rowNodes_.insertBefore(this.bottomFold_, this.selection.startRow); this.selection.startRow.nextSibling != this.selection.endRow;) this.rowNodes_.removeChild(this.selection.startRow.nextSibling);
3011 for (; this.rowNodes_.lastChild != this.selection.endRow;) this.rowNodes_.removeChild(this.rowNodes_.lastChild);
3012};, hterm.ScrollPort.prototype.drawVisibleRows_ = function(e, t) {
3013 function r(e, t) {
3014 for (; e != t;) {
3015 if (!e) throw 'Did not encounter target node';
3016 if (e == o.bottomFold_) throw 'Encountered bottom fold before target node';
3017 var r = e;
3018 e = e.nextSibling, r.parentNode.removeChild(r);
3019 }
3020 }
3021 for (var o = this, i = this.selection.startRow, s = this.selection.endRow, n = this.bottomFold_, a = this.topFold_.nextSibling, l = Math.min(this.visibleRowCount, this.rowProvider_.getRowCount()), h = 0; l > h; h++) {
3022 var c = e + h;
3023 if (a != n)
3024 if (a.rowIndex != c)
3025 if (i && i.rowIndex == c) r(a, i), a = i.nextSibling;
3026 else if (s && s.rowIndex == c) r(a, s), a = s.nextSibling;
3027 else if (a != i && a != s) {
3028 var u = this.fetchRowNode_(c);
3029 if (!u) {
3030 console.log("Couldn't fetch row index: " + c);
3031 break;
3032 }
3033 a != u ? (this.rowNodes_.insertBefore(u, a), !u.nextSibling, this.rowNodes_.removeChild(a), a = u.nextSibling) : a = a.nextSibling;
3034 }
3035 else {
3036 var u = this.fetchRowNode_(c);
3037 if (!u) {
3038 console.log("Couldn't fetch row index: " + c);
3039 break;
3040 }
3041 this.rowNodes_.insertBefore(u, a);
3042 }
3043 else a = a.nextSibling;
3044 else {
3045 var u = this.fetchRowNode_(c);
3046 if (!u) {
3047 console.log("Couldn't fetch row index: " + c);
3048 break;
3049 }
3050 this.rowNodes_.insertBefore(u, a);
3051 }
3052 }
3053 a != this.bottomFold_ && r(a, n);
3054};, hterm.ScrollPort.prototype.resetSelectBags_ = function() {
3055 this.topSelectBag_.parentNode && (this.topSelectBag_.textContent = '', this.topSelectBag_.parentNode.removeChild(this.topSelectBag_)), this.bottomSelectBag_.parentNode && (this.bottomSelectBag_.textContent = '', this.bottomSelectBag_.parentNode.removeChild(this.bottomSelectBag_));
3056};, hterm.ScrollPort.prototype.cacheRowNode_ = function(e) {
3057 this.currentRowNodeCache_[e.rowIndex] = e;
3058};, hterm.ScrollPort.prototype.fetchRowNode_ = function(e) {
3059 var t;
3060 return t = this.previousRowNodeCache_ && e in this.previousRowNodeCache_ ? this.previousRowNodeCache_[e] : this.rowProvider_.getRowNode(e), this.currentRowNodeCache_ && this.cacheRowNode_(t), t;
3061};, hterm.ScrollPort.prototype.selectAll = function() {
3062 var e;
3063 if (0 != this.topFold_.nextSibling.rowIndex) {
3064 for (; this.topFold_.previousSibling;) this.rowNodes_.removeChild(this.topFold_.previousSibling);
3065 e = this.fetchRowNode_(0), this.rowNodes_.insertBefore(e, this.topFold_), this.syncRowNodesDimensions_();
3066 }
3067 else e = this.topFold_.nextSibling;
3068 var t, r = this.rowProvider_.getRowCount() - 1;
3069 if (this.bottomFold_.previousSibling.rowIndex != r) {
3070 for (; this.bottomFold_.nextSibling;) this.rowNodes_.removeChild(this.bottomFold_.nextSibling);
3071 t = this.fetchRowNode_(r), this.rowNodes_.appendChild(t);
3072 }
3073 else t = this.bottomFold_.previousSibling.rowIndex;
3074 var o = this.document_.getSelection();
3075 o.collapse(e, 0), o.extend(t, t.childNodes.length), this.selection.sync();
3076};, hterm.ScrollPort.prototype.getScrollMax_ = function(e) {
3077 return hterm.getClientHeight(this.scrollArea_) + this.visibleRowTopMargin + this.visibleRowBottomMargin - hterm.getClientHeight(this.screen_);
3078};, hterm.ScrollPort.prototype.scrollRowToTop = function(e) {
3079 this.syncScrollHeight(), this.isScrolledEnd = e + this.visibleRowCount >= this.lastRowCount_;
3080 var t = e * this.characterSize.height + this.visibleRowTopMargin,
3081 r = this.getScrollMax_();
3082 t > r && (t = r), this.screen_.scrollTop != t && (this.screen_.scrollTop = t, this.scheduleRedraw());
3083};, hterm.ScrollPort.prototype.scrollRowToBottom = function(e) {
3084 this.syncScrollHeight(), this.isScrolledEnd = e + this.visibleRowCount >= this.lastRowCount_;
3085 var t = e * this.characterSize.height + this.visibleRowTopMargin + this.visibleRowBottomMargin;
3086 t -= this.visibleRowCount * this.characterSize.height, 0 > t && (t = 0), this.screen_.scrollTop != t && (this.screen_.scrollTop = t);
3087};, hterm.ScrollPort.prototype.getTopRowIndex = function() {
3088 return Math.round(this.screen_.scrollTop / this.characterSize.height);
3089};, hterm.ScrollPort.prototype.getBottomRowIndex = function(e) {
3090 return e + this.visibleRowCount - 1;
3091};, hterm.ScrollPort.prototype.onScroll_ = function(e) {
3092 var t = this.getScreenSize();
3093 return t.width != this.lastScreenWidth_ || t.height != this.lastScreenHeight_ ? void this.resize() : (this.redraw_(), void this.publish('scroll', {
3094 scrollPort: this
3095 }));
3096};, hterm.ScrollPort.prototype.onScrollWheel = function(e) {};, hterm.ScrollPort.prototype.onScrollWheel_ = function(e) {
3097 if (this.onScrollWheel(e), !e.defaultPrevented) {
3098 var t = 'DOMMouseScroll' == e.type ? -1 * e.detail : e.wheelDeltaY;
3099 t *= this.scrollWheelMultiplier_;
3100 var r = this.screen_.scrollTop - t;
3101 0 > r && (r = 0);
3102 var o = this.getScrollMax_();
3103 r > o && (r = o), r != this.screen_.scrollTop && (this.screen_.scrollTop = r, e.preventDefault());
3104 }
3105};, hterm.ScrollPort.prototype.onResize_ = function(e) {
3106 this.syncCharacterSize(), this.resize();
3107};, hterm.ScrollPort.prototype.onCopy = function(e) {};, hterm.ScrollPort.prototype.onCopy_ = function(e) {
3108 if (this.onCopy(e), !e.defaultPrevented && (this.resetSelectBags_(), this.selection.sync(), this.selection.startRow && !(this.selection.endRow.rowIndex - this.selection.startRow.rowIndex < 2))) {
3109 var t = this.getTopRowIndex(),
3110 r = this.getBottomRowIndex(t);
3111 if (this.selection.startRow.rowIndex < t) {
3112 var o;
3113 o = this.selection.endRow.rowIndex < t ? this.selection.endRow.rowIndex : this.topFold_.nextSibling.rowIndex, this.topSelectBag_.textContent = this.rowProvider_.getRowsText(this.selection.startRow.rowIndex + 1, o), this.rowNodes_.insertBefore(this.topSelectBag_, this.selection.startRow.nextSibling), this.syncRowNodesDimensions_();
3114 }
3115 if (this.selection.endRow.rowIndex > r) {
3116 var i;
3117 i = this.selection.startRow.rowIndex > r ? this.selection.startRow.rowIndex + 1 : this.bottomFold_.previousSibling.rowIndex + 1, this.bottomSelectBag_.textContent = this.rowProvider_.getRowsText(i, this.selection.endRow.rowIndex), this.rowNodes_.insertBefore(this.bottomSelectBag_, this.selection.endRow);
3118 }
3119 }
3120};, hterm.ScrollPort.prototype.onBodyKeyDown_ = function(e) {
3121 if (this.ctrlVPaste) {
3122 var t = String.fromCharCode(e.which),
3123 r = t.toLowerCase();
3124 (e.ctrlKey || e.metaKey) && 'v' == r && this.pasteTarget_.focus();
3125 }
3126};, hterm.ScrollPort.prototype.onPaste_ = function(e) {
3127 this.pasteTarget_.focus();
3128 var t = this;
3129 setTimeout(function() {
3130 t.publish('paste', {
3131 text: t.pasteTarget_.value
3132 }), t.pasteTarget_.value = '', t.screen_.focus();
3133 }, 0);
3134};, hterm.ScrollPort.prototype.handlePasteTargetTextInput_ = function(e) {
3135 e.stopPropagation();
3136};, hterm.ScrollPort.prototype.setScrollbarVisible = function(e) {
3137 this.screen_.style.overflowY = e ? 'scroll' : 'hidden';
3138};, hterm.ScrollPort.prototype.setScrollWheelMoveMultipler = function(e) {
3139 this.scrollWheelMultiplier_ = e;
3140};, lib.rtdep('lib.colors', 'lib.PreferenceManager', 'lib.resource', 'lib.wc', 'lib.f', 'hterm.Keyboard', 'hterm.Options', 'hterm.PreferenceManager', 'hterm.Screen', 'hterm.ScrollPort', 'hterm.Size', 'hterm.TextAttributes', 'hterm.VT'), hterm.Terminal = function(e) {
3141 this.profileId_ = null, this.primaryScreen_ = new hterm.Screen, this.alternateScreen_ = new hterm.Screen, this.screen_ = this.primaryScreen_, this.screenSize = new hterm.Size(0, 0), this.scrollPort_ = new hterm.ScrollPort(this), this.scrollPort_.subscribe('resize', this.onResize_.bind(this)), this.scrollPort_.subscribe('scroll', this.onScroll_.bind(this)), this.scrollPort_.subscribe('paste', this.onPaste_.bind(this)), this.scrollPort_.onCopy = this.onCopy_.bind(this), this.div_ = null, this.document_ = window.document, this.scrollbackRows_ = [], this.tabStops_ = [], this.defaultTabStops = !0, this.vtScrollTop_ = null, this.vtScrollBottom_ = null, this.cursorNode_ = null, this.cursorShape_ = hterm.Terminal.cursorShape.BLOCK, this.cursorColor_ = null, this.cursorBlinkCycle_ = [100, 100], this.myOnCursorBlink_ = this.onCursorBlink_.bind(this), this.backgroundColor_ = null, this.foregroundColor_ = null, this.scrollOnOutput_ = null, this.scrollOnKeystroke_ = null, this.defeatMouseReports_ = !1, this.bellAudio_ = this.document_.createElement('audio'), this.bellAudio_.setAttribute('preload', 'auto'), this.bellNotificationList_ = [], this.desktopNotificationBell_ = !1, this.savedOptions_ = {}, this.options_ = new hterm.Options, this.timeouts_ = {}, this.vt = new hterm.VT(this), this.keyboard = new hterm.Keyboard(this), this.io = new hterm.Terminal.IO(this), this.enableMouseDragScroll = !0, this.copyOnSelect = null, this.mousePasteButton = null, this.useDefaultWindowCopy = !1, this.clearSelectionAfterCopy = !0, this.realizeSize_(80, 24), this.setDefaultTabStops(), this.setProfile(e || 'default', function() {
3142 this.onTerminalReady();
3143 }.bind(this));
3144};, hterm.Terminal.cursorShape = {
3145 BLOCK: 'BLOCK',
3146 BEAM: 'BEAM',
3147 UNDERLINE: 'UNDERLINE'
3148}, hterm.Terminal.prototype.onTerminalReady = function() {};, hterm.Terminal.prototype.tabWidth = 8, hterm.Terminal.prototype.setProfile = function(e, t) {
3149 this.profileId_ = e.replace(/\//g, '');
3150 var r = this;
3151 this.prefs_ && this.prefs_.deactivate(), this.prefs_ = new hterm.PreferenceManager(this.profileId_), this.prefs_.addObservers(null, {
3152 'alt-gr-mode': function(e) {
3153 e = null == e ? 'en-us' == navigator.language.toLowerCase() ? 'none' : 'right-alt' : 'string' == typeof e ? e.toLowerCase() : 'none', /^(none|ctrl-alt|left-alt|right-alt)$/.test(e) || (e = 'none'), r.keyboard.altGrMode = e;
3154 },
3155 'alt-backspace-is-meta-backspace': function(e) {
3156 r.keyboard.altBackspaceIsMetaBackspace = e;
3157 },
3158 'alt-is-meta': function(e) {
3159 r.keyboard.altIsMeta = e;
3160 },
3161 'alt-sends-what': function(e) {
3162 /^(escape|8-bit|browser-key)$/.test(e) || (e = 'escape'), r.keyboard.altSendsWhat = e;
3163 },
3164 'audible-bell-sound': function(e) {
3165 var t = e.match(/^lib-resource:(\S+)/);
3166 t ? r.bellAudio_.setAttribute('src', lib.resource.getDataUrl(t[1])) : r.bellAudio_.setAttribute('src', e);
3167 },
3168 'desktop-notification-bell': function(e) {
3169 e && Notification ? (r.desktopNotificationBell_ = 'granted' === Notification.permission, r.desktopNotificationBell_ || console.warn('desktop-notification-bell is true but we do not have permission to display notifications.')) : r.desktopNotificationBell_ = !1;
3170 },
3171 'background-color': function(e) {
3172 r.setBackgroundColor(e);
3173 },
3174 'background-image': function(e) {
3175 r.scrollPort_.setBackgroundImage(e);
3176 },
3177 'background-size': function(e) {
3178 r.scrollPort_.setBackgroundSize(e);
3179 },
3180 'background-position': function(e) {
3181 r.scrollPort_.setBackgroundPosition(e);
3182 },
3183 'backspace-sends-backspace': function(e) {
3184 r.keyboard.backspaceSendsBackspace = e;
3185 },
3186 'character-map-overrides': function(e) {
3187 if (!(null == e || e instanceof Object)) return void console.warn('Preference character-map-modifications is not an object: ' + e);
3188 for (var t in e) {
3189 var r = hterm.VT.CharacterMap.maps[t].glmap;
3190 for (var o in e[t]) r[o] = e[t][o];
3191 hterm.VT.CharacterMap.maps[t].reset(r);
3192 }
3193 },
3194 'cursor-blink': function(e) {
3195 r.setCursorBlink(!!e);
3196 },
3197 'cursor-blink-cycle': function(e) {
3198 e instanceof Array && 'number' == typeof e[0] && 'number' == typeof e[1] ? r.cursorBlinkCycle_ = e : 'number' == typeof e ? r.cursorBlinkCycle_ = [e, e] : r.cursorBlinkCycle_ = [100, 100]
3199 },
3200 'cursor-color': function(e) {
3201 r.setCursorColor(e);
3202 },
3203 'color-palette-overrides': function(e) {
3204 if (!(null == e || e instanceof Object || e instanceof Array)) return void console.warn('Preference color-palette-overrides is not an array or object: ' + e);
3205 if (lib.colors.colorPalette = lib.colors.stockColorPalette.concat(), e)
3206 for (var t in e) {
3207 var o = parseInt(t);
3208 if (isNaN(o) || 0 > o || o > 255) console.log('Invalid value in palette: ' + t + ': ' + e[t]);
3209 else if (e[o]) {
3210 var i = lib.colors.normalizeCSS(e[o]);
3211 i && (lib.colors.colorPalette[o] = i);
3212 }
3213 }
3214 r.primaryScreen_.textAttributes.resetColorPalette(), r.alternateScreen_.textAttributes.resetColorPalette();
3215 },
3216 'copy-on-select': function(e) {
3217 r.copyOnSelect = !!e;
3218 },
3219 'use-default-window-copy': function(e) {
3220 r.useDefaultWindowCopy = !!e;
3221 },
3222 'clear-selection-after-copy': function(e) {
3223 r.clearSelectionAfterCopy = !!e;
3224 },
3225 'ctrl-plus-minus-zero-zoom': function(e) {
3226 r.keyboard.ctrlPlusMinusZeroZoom = e;
3227 },
3228 'ctrl-c-copy': function(e) {
3229 r.keyboard.ctrlCCopy = e;
3230 },
3231 'ctrl-v-paste': function(e) {
3232 r.keyboard.ctrlVPaste = e, r.scrollPort_.setCtrlVPaste(e);
3233 },
3234 'east-asian-ambiguous-as-two-column': function(e) {
3235 lib.wc.regardCjkAmbiguous = e;
3236 },
3237 'enable-8-bit-control': function(e) {
3238 r.vt.enable8BitControl = !!e;
3239 },
3240 'enable-bold': function(e) {
3241 r.syncBoldSafeState();
3242 },
3243 'enable-bold-as-bright': function(e) {
3244 r.primaryScreen_.textAttributes.enableBoldAsBright = !!e, r.alternateScreen_.textAttributes.enableBoldAsBright = !!e;
3245 },
3246 'enable-blink': function(e) {
3247 r.syncBlinkState();
3248 },
3249 'enable-clipboard-write': function(e) {
3250 r.vt.enableClipboardWrite = !!e;
3251 },
3252 'enable-dec12': function(e) {
3253 r.vt.enableDec12 = !!e;
3254 },
3255 'font-family': function(e) {
3256 r.syncFontFamily();
3257 },
3258 'font-size': function(e) {
3259 r.setFontSize(e);
3260 },
3261 'font-smoothing': function(e) {
3262 r.syncFontFamily();
3263 },
3264 'foreground-color': function(e) {
3265 r.setForegroundColor(e);
3266 },
3267 'home-keys-scroll': function(e) {
3268 r.keyboard.homeKeysScroll = e;
3269 },
3270 keybindings: function(e) {
3271 if (r.keyboard.bindings.clear(), e) {
3272 if (!(e instanceof Object)) return void console.error('Error in keybindings preference: Expected object');
3273 try {
3274 r.keyboard.bindings.addBindings(e);
3275 }
3276 catch (t) {
3277 console.error('Error in keybindings preference: ' + t);
3278 }
3279 }
3280 },
3281 'max-string-sequence': function(e) {
3282 r.vt.maxStringSequence = e;
3283 },
3284 'media-keys-are-fkeys': function(e) {
3285 r.keyboard.mediaKeysAreFKeys = e;
3286 },
3287 'meta-sends-escape': function(e) {
3288 r.keyboard.metaSendsEscape = e;
3289 },
3290 'mouse-paste-button': function(e) {
3291 r.syncMousePasteButton();
3292 },
3293 'page-keys-scroll': function(e) {
3294 r.keyboard.pageKeysScroll = e;
3295 },
3296 'pass-alt-number': function(e) {
3297 if (null == e) {
3298 var t = window.navigator.userAgent.match(/Mac OS X/);
3299 e = !t && 'popup' != hterm.windowType;
3300 }
3301 r.passAltNumber = e;
3302 },
3303 'pass-ctrl-number': function(e) {
3304 if (null == e) {
3305 var t = window.navigator.userAgent.match(/Mac OS X/);
3306 e = !t && 'popup' != hterm.windowType;
3307 }
3308 r.passCtrlNumber = e;
3309 },
3310 'pass-meta-number': function(e) {
3311 if (null == e) {
3312 var t = window.navigator.userAgent.match(/Mac OS X/);
3313 e = t && 'popup' != hterm.windowType;
3314 }
3315 r.passMetaNumber = e;
3316 },
3317 'pass-meta-v': function(e) {
3318 r.keyboard.passMetaV = e;
3319 },
3320 'receive-encoding': function(e) {
3321 /^(utf-8|raw)$/.test(e) || (console.warn('Invalid value for "receive-encoding": ' + e), e = 'utf-8'), r.vt.characterEncoding = e;
3322 },
3323 'scroll-on-keystroke': function(e) {
3324 r.scrollOnKeystroke_ = e;
3325 },
3326 'scroll-on-output': function(e) {
3327 r.scrollOnOutput_ = e;
3328 },
3329 'scrollbar-visible': function(e) {
3330 r.setScrollbarVisible(e);
3331 },
3332 'scroll-wheel-move-multiplier': function(e) {
3333 r.setScrollWheelMoveMultipler(e);
3334 },
3335 'send-encoding': function(e) {
3336 /^(utf-8|raw)$/.test(e) || (console.warn('Invalid value for "send-encoding": ' + e), e = 'utf-8'), r.keyboard.characterEncoding = e;
3337 },
3338 'shift-insert-paste': function(e) {
3339 r.keyboard.shiftInsertPaste = e;
3340 },
3341 'user-css': function(e) {
3342 r.scrollPort_.setUserCss(e);
3343 }
3344 }), this.prefs_.readStorage(function() {
3345 this.prefs_.notifyAll(), t && t();
3346 }.bind(this));
3347};, hterm.Terminal.prototype.getPrefs = function() {
3348 return this.prefs_;
3349};, hterm.Terminal.prototype.setBracketedPaste = function(e) {
3350 this.options_.bracketedPaste = e;
3351};, hterm.Terminal.prototype.setCursorColor = function(e) {
3352 this.cursorColor_ = e, this.cursorNode_.style.backgroundColor = e, this.cursorNode_.style.borderColor = e;
3353};, hterm.Terminal.prototype.getCursorColor = function() {
3354 return this.cursorColor_;
3355};, hterm.Terminal.prototype.setSelectionEnabled = function(e) {
3356 this.enableMouseDragScroll = e;
3357};, hterm.Terminal.prototype.setBackgroundColor = function(e) {
3358 this.backgroundColor_ = lib.colors.normalizeCSS(e), this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_, this.backgroundColor_), this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_, this.backgroundColor_), this.scrollPort_.setBackgroundColor(e);
3359};, hterm.Terminal.prototype.getBackgroundColor = function() {
3360 return this.backgroundColor_;
3361};, hterm.Terminal.prototype.setForegroundColor = function(e) {
3362 this.foregroundColor_ = lib.colors.normalizeCSS(e), this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_, this.backgroundColor_), this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_, this.backgroundColor_), this.scrollPort_.setForegroundColor(e);
3363};, hterm.Terminal.prototype.getForegroundColor = function() {
3364 return this.foregroundColor_;
3365};, hterm.Terminal.prototype.runCommandClass = function(e, t) {
3366 var r = this.prefs_.get('environment');
3367 ('object' != typeof r || null == r) && (r = {});
3368 var o = this;
3369 this.command = new e({
3370 argString: t || '',
3371 io: this.io.push(),
3372 environment: r,
3373 onExit: function(e) {
3374 o.io.pop(), o.uninstallKeyboard(), o.prefs_.get('close-on-exit') && window.close();
3375 }
3376 }), this.installKeyboard(), this.command.run();
3377};, hterm.Terminal.prototype.isPrimaryScreen = function() {
3378 return this.screen_ == this.primaryScreen_;
3379};, hterm.Terminal.prototype.installKeyboard = function() {
3380 this.keyboard.installKeyboard(this.scrollPort_.getDocument().body);
3381};, hterm.Terminal.prototype.uninstallKeyboard = function() {
3382 this.keyboard.installKeyboard(null);
3383};, hterm.Terminal.prototype.setFontSize = function(e) {
3384 0 === e && (e = this.prefs_.get('font-size')), this.scrollPort_.setFontSize(e), this.wcCssRule_ && (this.wcCssRule_.style.width = 2 * this.scrollPort_.characterSize.width + 'px');
3385};, hterm.Terminal.prototype.getFontSize = function() {
3386 return this.scrollPort_.getFontSize();
3387};, hterm.Terminal.prototype.getFontFamily = function() {
3388 return this.scrollPort_.getFontFamily();
3389};, hterm.Terminal.prototype.syncFontFamily = function() {
3390 this.scrollPort_.setFontFamily(this.prefs_.get('font-family'), this.prefs_.get('font-smoothing')), this.syncBoldSafeState();
3391};, hterm.Terminal.prototype.syncMousePasteButton = function() {
3392 var e = this.prefs_.get('mouse-paste-button');
3393 if ('number' == typeof e) return void(this.mousePasteButton = e);
3394 var t = navigator.userAgent.match(/\(X11;\s+(\S+)/);
3395 t && 'CrOS' != t[2] ? this.mousePasteButton = 3 : this.mousePasteButton = 2;
3396};, hterm.Terminal.prototype.syncBoldSafeState = function() {
3397 var e = this.prefs_.get('enable-bold');
3398 if (null !== e) return this.primaryScreen_.textAttributes.enableBold = e, void(this.alternateScreen_.textAttributes.enableBold = e);
3399 var t = this.scrollPort_.measureCharacterSize(),
3400 r = this.scrollPort_.measureCharacterSize('bold'),
3401 o = t.equals(r);
3402 o || console.warn('Bold characters disabled: Size of bold weight differs from normal. Font family is: ' + this.scrollPort_.getFontFamily()), this.primaryScreen_.textAttributes.enableBold = o, this.alternateScreen_.textAttributes.enableBold = o;
3403};, hterm.Terminal.prototype.syncBlinkState = function() {
3404 this.document_.documentElement.style.setProperty('--hterm-blink-node-duration', this.prefs_.get('enable-blink') ? '0.7s' : '0');
3405};, hterm.Terminal.prototype.saveCursor = function() {
3406 return this.screen_.cursorPosition.clone();
3407};, hterm.Terminal.prototype.getTextAttributes = function() {
3408 return this.screen_.textAttributes;
3409};, hterm.Terminal.prototype.setTextAttributes = function(e) {
3410 this.screen_.textAttributes = e;
3411};, hterm.Terminal.prototype.getZoomFactor = function() {
3412 return this.scrollPort_.characterSize.zoomFactor;
3413};, hterm.Terminal.prototype.setWindowTitle = function(e) {
3414 window.document.title = e;
3415};, hterm.Terminal.prototype.restoreCursor = function(e) {
3416 var t = lib.f.clamp(e.row, 0, this.screenSize.height - 1),
3417 r = lib.f.clamp(e.column, 0, this.screenSize.width - 1);
3418 this.screen_.setCursorPosition(t, r), (e.column > r || e.column == r && e.overflow) && (this.screen_.cursorPosition.overflow = !0);
3419};, hterm.Terminal.prototype.clearCursorOverflow = function() {
3420 this.screen_.cursorPosition.overflow = !1;
3421};, hterm.Terminal.prototype.setCursorShape = function(e) {
3422 this.cursorShape_ = e, this.restyleCursor_();
3423};, hterm.Terminal.prototype.getCursorShape = function() {
3424 return this.cursorShape_;
3425};, hterm.Terminal.prototype.setWidth = function(e) {
3426 return null == e ? void(this.div_.style.width = '100%') : (this.div_.style.width = Math.ceil(this.scrollPort_.characterSize.width * e + this.scrollPort_.currentScrollbarWidthPx) + 'px', this.realizeSize_(e, this.screenSize.height), void this.scheduleSyncCursorPosition_());
3427};, hterm.Terminal.prototype.setHeight = function(e) {
3428 return null == e ? void(this.div_.style.height = '100%') : (this.div_.style.height = this.scrollPort_.characterSize.height * e + 'px', this.realizeSize_(this.screenSize.width, e), void this.scheduleSyncCursorPosition_());
3429};, hterm.Terminal.prototype.realizeSize_ = function(e, t) {
3430 e != this.screenSize.width && this.realizeWidth_(e), t != this.screenSize.height && this.realizeHeight_(t), this.io.onTerminalResize_(e, t);
3431};, hterm.Terminal.prototype.realizeWidth_ = function(e) {
3432 if (0 >= e) throw new Error('Attempt to realize bad width: ' + e);
3433 var t = e - this.screen_.getWidth();
3434 if (this.screenSize.width = e, this.screen_.setColumnCount(e), t > 0) this.defaultTabStops && this.setDefaultTabStops(this.screenSize.width - t);
3435 else
3436 for (var r = this.tabStops_.length - 1; r >= 0 && !(this.tabStops_[r] < e); r--) this.tabStops_.pop();
3437 this.screen_.setColumnCount(this.screenSize.width);
3438};, hterm.Terminal.prototype.realizeHeight_ = function(e) {
3439 if (0 >= e) throw new Error('Attempt to realize bad height: ' + e);
3440 var t = e - this.screen_.getHeight();
3441 this.screenSize.height = e;
3442 var r = this.saveCursor();
3443 if (0 > t) {
3444 for (t *= -1; t;) {
3445 var o = this.getRowCount() - 1;
3446 if (o - this.scrollbackRows_.length == r.row) break;
3447 if (this.getRowText(o)) break;
3448 this.screen_.popRow(), t--;
3449 }
3450 var i = this.screen_.shiftRows(t);
3451 this.scrollbackRows_.push.apply(this.scrollbackRows_, i), r.row = Math.max(r.row - t, 0);
3452 }
3453 else if (t > 0) {
3454 if (t <= this.scrollbackRows_.length) {
3455 var s = Math.min(t, this.scrollbackRows_.length),
3456 n = this.scrollbackRows_.splice(this.scrollbackRows_.length - s, s);
3457 this.screen_.unshiftRows(n), t -= s, r.row += s;
3458 }
3459 t && this.appendRows_(t);
3460 }
3461 this.setVTScrollRegion(null, null), this.restoreCursor(r);
3462};, hterm.Terminal.prototype.scrollHome = function() {
3463 this.scrollPort_.scrollRowToTop(0);
3464};, hterm.Terminal.prototype.scrollEnd = function() {
3465 this.scrollPort_.scrollRowToBottom(this.getRowCount());
3466};, hterm.Terminal.prototype.scrollPageUp = function() {
3467 var e = this.scrollPort_.getTopRowIndex();
3468 this.scrollPort_.scrollRowToTop(e - this.screenSize.height + 1);
3469};, hterm.Terminal.prototype.scrollPageDown = function() {
3470 var e = this.scrollPort_.getTopRowIndex();
3471 this.scrollPort_.scrollRowToTop(e + this.screenSize.height - 1);
3472};, hterm.Terminal.prototype.wipeContents = function() {
3473 this.scrollbackRows_.length = 0, this.scrollPort_.resetCache(), [this.primaryScreen_, this.alternateScreen_].forEach(function(e) {
3474 var t = e.getHeight();
3475 t > 0 && (this.renumberRows_(0, t), this.clearHome(e));
3476 }.bind(this)), this.syncCursorPosition_(), this.scrollPort_.invalidate();
3477};, hterm.Terminal.prototype.reset = function() {
3478 this.clearAllTabStops(), this.setDefaultTabStops(), this.clearHome(this.primaryScreen_), this.primaryScreen_.textAttributes.reset(), this.clearHome(this.alternateScreen_), this.alternateScreen_.textAttributes.reset(), this.setCursorBlink(!!this.prefs_.get('cursor-blink')), this.vt.reset(), this.softReset();
3479};, hterm.Terminal.prototype.softReset = function() {
3480 this.options_ = new hterm.Options, this.options_.cursorBlink = !!this.timeouts_.cursorBlink, this.primaryScreen_.textAttributes.resetColorPalette(), this.alternateScreen_.textAttributes.resetColorPalette(), this.setVTScrollRegion(null, null), this.setCursorVisible(!0);
3481};, hterm.Terminal.prototype.forwardTabStop = function() {
3482 for (var e = this.screen_.cursorPosition.column, t = 0; t < this.tabStops_.length; t++)
3483 if (this.tabStops_[t] > e) return void this.setCursorColumn(this.tabStops_[t]);
3484 var r = this.screen_.cursorPosition.overflow;
3485 this.setCursorColumn(this.screenSize.width - 1), this.screen_.cursorPosition.overflow = r;
3486};, hterm.Terminal.prototype.backwardTabStop = function() {
3487 for (var e = this.screen_.cursorPosition.column, t = this.tabStops_.length - 1; t >= 0; t--)
3488 if (this.tabStops_[t] < e) return void this.setCursorColumn(this.tabStops_[t]);
3489 this.setCursorColumn(1);
3490};, hterm.Terminal.prototype.setTabStop = function(e) {
3491 for (var t = this.tabStops_.length - 1; t >= 0; t--) {
3492 if (this.tabStops_[t] == e) return;
3493 if (this.tabStops_[t] < e) return void this.tabStops_.splice(t + 1, 0, e);
3494 }
3495 this.tabStops_.splice(0, 0, e);
3496};, hterm.Terminal.prototype.clearTabStopAtCursor = function() {
3497 var e = this.screen_.cursorPosition.column,
3498 t = this.tabStops_.indexOf(e); - 1 != t && this.tabStops_.splice(t, 1);
3499};, hterm.Terminal.prototype.clearAllTabStops = function() {
3500 this.tabStops_.length = 0, this.defaultTabStops = !1;
3501};, hterm.Terminal.prototype.setDefaultTabStops = function(e) {
3502 var t = e || 0,
3503 r = this.tabWidth;
3504 t = t - 1 - (t - 1) % r + r;
3505 for (var o = t; o < this.screenSize.width; o += r) this.setTabStop(o);
3506 this.defaultTabStops = !0;
3507};, hterm.Terminal.prototype.interpret = function(e) {
3508 this.vt.interpret(e), this.scheduleSyncCursorPosition_();
3509};, hterm.Terminal.prototype.decorate = function(e) {
3510 this.div_ = e, this.scrollPort_.decorate(e), this.scrollPort_.setBackgroundImage(this.prefs_.get('background-image')), this.scrollPort_.setBackgroundSize(this.prefs_.get('background-size')), this.scrollPort_.setBackgroundPosition(this.prefs_.get('background-position')), this.scrollPort_.setUserCss(this.prefs_.get('user-css')), this.div_.focus = this.focus.bind(this), this.setFontSize(this.prefs_.get('font-size')), this.syncFontFamily(), this.setScrollbarVisible(this.prefs_.get('scrollbar-visible')), this.setScrollWheelMoveMultipler(this.prefs_.get('scroll-wheel-move-multiplier')), this.document_ = this.scrollPort_.getDocument(), this.document_.body.oncontextmenu = function() {
3511 return !1;
3512 };
3513 var t = this.onMouse_.bind(this),
3514 r = this.scrollPort_.getScreenNode();
3515 r.addEventListener('mousedown', t), r.addEventListener('mouseup', t), r.addEventListener('mousemove', t), this.scrollPort_.onScrollWheel = t, r.addEventListener('focus', this.onFocusChange_.bind(this, !0)), r.addEventListener('mousedown', function() {
3516 setTimeout(this.onFocusChange_.bind(this, !0));
3517 }.bind(this)), r.addEventListener('blur', this.onFocusChange_.bind(this, !1));
3518 var o = this.document_.createElement('style');
3519 o.textContent = '.cursor-node[focus="false"] { box-sizing: border-box; background-color: transparent !important; border-width: 2px; border-style: solid;}.wc-node { display: inline-block; text-align: center; width: ' + 2 * this.scrollPort_.characterSize.width + 'px;}:root { --hterm-blink-node-duration: 0.7s;}@keyframes blink { from { opacity: 1.0; } to { opacity: 0.0; }}.blink-node { animation-name: blink; animation-duration: var(--hterm-blink-node-duration); animation-iteration-count: infinite; animation-timing-function: ease-in-out; animation-direction: alternate;}', this.document_.head.appendChild(o);
3520 var i = this.document_.styleSheets,
3521 s = i[i.length - 1].cssRules;
3522 this.wcCssRule_ = s[s.length - 1], this.cursorNode_ = this.document_.createElement('div'), this.cursorNode_.className = 'cursor-node', this.cursorNode_.style.cssText = 'position: absolute;top: -99px;display: block;width: ' + this.scrollPort_.characterSize.width + 'px;height: ' + this.scrollPort_.characterSize.height + 'px;-webkit-transition: opacity, background-color 100ms linear;-moz-transition: opacity, background-color 100ms linear;', this.setCursorColor(this.prefs_.get('cursor-color')), this.setCursorBlink(!!this.prefs_.get('cursor-blink')), this.restyleCursor_(), this.document_.body.appendChild(this.cursorNode_), this.scrollBlockerNode_ = this.document_.createElement('div'), this.scrollBlockerNode_.style.cssText = 'position: absolute;top: -99px;display: block;width: 10px;height: 10px;', this.document_.body.appendChild(this.scrollBlockerNode_), this.scrollPort_.onScrollWheel = t, ['mousedown', 'mouseup', 'mousemove', 'click', 'dblclick'].forEach(function(e) {
3523 this.scrollBlockerNode_.addEventListener(e, t), this.cursorNode_.addEventListener(e, t), this.document_.addEventListener(e, t);
3524 }.bind(this)), this.cursorNode_.addEventListener('mousedown', function() {
3525 setTimeout(this.focus.bind(this));
3526 }.bind(this)), this.setReverseVideo(!1), this.scrollPort_.focus(), this.scrollPort_.scheduleRedraw();
3527};, hterm.Terminal.prototype.getDocument = function() {
3528 return this.document_;
3529};, hterm.Terminal.prototype.focus = function() {
3530 this.scrollPort_.focus();
3531};, hterm.Terminal.prototype.getRowNode = function(e) {
3532 if (e < this.scrollbackRows_.length) return this.scrollbackRows_[e];
3533 var t = e - this.scrollbackRows_.length;
3534 return this.screen_.rowsArray[t];
3535};, hterm.Terminal.prototype.getRowsText = function(e, t) {
3536 for (var r = [], o = e; t > o; o++) {
3537 var i = this.getRowNode(o);
3538 r.push(i.textContent), t - 1 > o && !i.getAttribute('line-overflow') && r.push('\n');
3539 }
3540 return r.join('');
3541};, hterm.Terminal.prototype.getRowText = function(e) {
3542 var t = this.getRowNode(e);
3543 return t.textContent;
3544};, hterm.Terminal.prototype.getRowCount = function() {
3545 return this.scrollbackRows_.length + this.screen_.rowsArray.length;
3546};, hterm.Terminal.prototype.appendRows_ = function(e) {
3547 for (var t = this.screen_.rowsArray.length, r = this.scrollbackRows_.length + t, o = 0; e > o; o++) {
3548 var i = this.document_.createElement('x-row');
3549 i.appendChild(this.document_.createTextNode('')), i.rowIndex = r + o, this.screen_.pushRow(i);
3550 }
3551 var s = this.screen_.rowsArray.length - this.screenSize.height;
3552 if (s > 0) {
3553 var n = this.screen_.shiftRows(s);
3554 Array.prototype.push.apply(this.scrollbackRows_, n), this.scrollPort_.isScrolledEnd && this.scheduleScrollDown_();
3555 }
3556 t >= this.screen_.rowsArray.length && (t = this.screen_.rowsArray.length - 1), this.setAbsoluteCursorPosition(t, 0);
3557};, hterm.Terminal.prototype.moveRows_ = function(e, t, r) {
3558 var o = this.screen_.removeRows(e, t);
3559 this.screen_.insertRows(r, o);
3560 var i, s;
3561 r > e ? (i = e, s = r + t) : (i = r, s = e + t), this.renumberRows_(i, s), this.scrollPort_.scheduleInvalidate();
3562};, hterm.Terminal.prototype.renumberRows_ = function(e, t, r) {
3563 for (var o = r || this.screen_, i = this.scrollbackRows_.length, s = e; t > s; s++) o.rowsArray[s].rowIndex = i + s;
3564};, hterm.Terminal.prototype.print = function(e) {
3565 for (var t = 0, r = lib.wc.strWidth(e); r > t;) {
3566 this.options_.wraparound && this.screen_.cursorPosition.overflow && (this.screen_.commitLineOverflow(), this.newLine());
3567 var o, i = r - t,
3568 s = !1;
3569 this.screen_.cursorPosition.column + i >= this.screenSize.width && (s = !0, i = this.screenSize.width - this.screen_.cursorPosition.column), s && !this.options_.wraparound ? (o = lib.wc.substr(e, t, i - 1) + lib.wc.substr(e, r - 1), i = r) : o = lib.wc.substr(e, t, i);
3570 for (var n = hterm.TextAttributes.splitWidecharString(o), a = 0; a < n.length; a++) n[a].wcNode && (this.screen_.textAttributes.wcNode = !0), this.options_.insertMode ? this.screen_.insertString(n[a].str) : this.screen_.overwriteString(n[a].str), this.screen_.textAttributes.wcNode = !1;
3571 this.screen_.maybeClipCurrentRow(), t += i;
3572 }
3573 this.scheduleSyncCursorPosition_(), this.scrollOnOutput_ && this.scrollPort_.scrollRowToBottom(this.getRowCount());
3574};, hterm.Terminal.prototype.setVTScrollRegion = function(e, t) {
3575 0 == e && t == this.screenSize.height - 1 ? (this.vtScrollTop_ = null, this.vtScrollBottom_ = null) : (this.vtScrollTop_ = e, this.vtScrollBottom_ = t);
3576};, hterm.Terminal.prototype.getVTScrollTop = function() {
3577 return null != this.vtScrollTop_ ? this.vtScrollTop_ : 0;
3578};, hterm.Terminal.prototype.getVTScrollBottom = function() {
3579 return null != this.vtScrollBottom_ ? this.vtScrollBottom_ : this.screenSize.height - 1;
3580};, hterm.Terminal.prototype.newLine = function() {
3581 var e = this.screen_.cursorPosition.row == this.screen_.rowsArray.length - 1;
3582 null != this.vtScrollBottom_ ? this.screen_.cursorPosition.row == this.vtScrollBottom_ ? (this.vtScrollUp(1), this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, 0)) : e ? this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, 0) : this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row + 1, 0) : e ? this.appendRows_(1) : this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row + 1, 0)
3583};, hterm.Terminal.prototype.lineFeed = function() {
3584 var e = this.screen_.cursorPosition.column;
3585 this.newLine(), this.setCursorColumn(e);
3586};, hterm.Terminal.prototype.formFeed = function() {
3587 this.options_.autoCarriageReturn ? this.newLine() : this.lineFeed();
3588};, hterm.Terminal.prototype.reverseLineFeed = function() {
3589 var e = this.getVTScrollTop(),
3590 t = this.screen_.cursorPosition.row;
3591 t == e ? this.insertLines(1) : this.setAbsoluteCursorRow(t - 1);
3592};, hterm.Terminal.prototype.eraseToLeft = function() {
3593 var e = this.saveCursor();
3594 this.setCursorColumn(0), this.screen_.overwriteString(lib.f.getWhitespace(e.column + 1)), this.restoreCursor(e);
3595};, hterm.Terminal.prototype.eraseToRight = function(e) {
3596 if (!this.screen_.cursorPosition.overflow) {
3597 var t = this.screenSize.width - this.screen_.cursorPosition.column,
3598 r = e ? Math.min(e, t) : t;
3599 if (this.screen_.textAttributes.background === this.screen_.textAttributes.DEFAULT_COLOR) {
3600 var o = this.screen_.rowsArray[this.screen_.cursorPosition.row];
3601 if (hterm.TextAttributes.nodeWidth(o) <= this.screen_.cursorPosition.column + r) return this.screen_.deleteChars(r), void this.clearCursorOverflow();
3602 }
3603 var i = this.saveCursor();
3604 this.screen_.overwriteString(lib.f.getWhitespace(r)), this.restoreCursor(i), this.clearCursorOverflow();
3605 }
3606};, hterm.Terminal.prototype.eraseLine = function() {
3607 var e = this.saveCursor();
3608 this.screen_.clearCursorRow(), this.restoreCursor(e), this.clearCursorOverflow();
3609};, hterm.Terminal.prototype.eraseAbove = function() {
3610 var e = this.saveCursor();
3611 this.eraseToLeft();
3612 for (var t = 0; t < e.row; t++) this.setAbsoluteCursorPosition(t, 0), this.screen_.clearCursorRow();
3613 this.restoreCursor(e), this.clearCursorOverflow();
3614};, hterm.Terminal.prototype.eraseBelow = function() {
3615 var e = this.saveCursor();
3616 this.eraseToRight();
3617 for (var t = this.screenSize.height - 1, r = e.row + 1; t >= r; r++) this.setAbsoluteCursorPosition(r, 0), this.screen_.clearCursorRow();
3618 this.restoreCursor(e), this.clearCursorOverflow();
3619};, hterm.Terminal.prototype.fill = function(e) {
3620 var t = this.saveCursor();
3621 this.setAbsoluteCursorPosition(0, 0);
3622 for (var r = 0; r < this.screenSize.height; r++)
3623 for (var o = 0; o < this.screenSize.width; o++) this.setAbsoluteCursorPosition(r, o), this.screen_.overwriteString(e);
3624 this.restoreCursor(t);
3625};, hterm.Terminal.prototype.clearHome = function(e) {
3626 var t = e || this.screen_,
3627 r = t.getHeight();
3628 if (0 != r) {
3629 for (var o = 0; r > o; o++) t.setCursorPosition(o, 0), t.clearCursorRow();
3630 t.setCursorPosition(0, 0);
3631 }
3632};, hterm.Terminal.prototype.clear = function(e) {
3633 var t = e || this.screen_,
3634 r = t.cursorPosition.clone();
3635 this.clearHome(t), t.setCursorPosition(r.row, r.column);
3636};, hterm.Terminal.prototype.insertLines = function(e) {
3637 var t = this.screen_.cursorPosition.row,
3638 r = this.getVTScrollBottom();
3639 e = Math.min(e, r - t);
3640 var o = r - t - e + 1;
3641 o && this.moveRows_(t, o, t + e);
3642 for (var i = e - 1; i >= 0; i--) this.setAbsoluteCursorPosition(t + i, 0), this.screen_.clearCursorRow();
3643};, hterm.Terminal.prototype.deleteLines = function(e) {
3644 var t = this.saveCursor(),
3645 r = t.row,
3646 o = this.getVTScrollBottom(),
3647 i = o - r + 1;
3648 e = Math.min(e, i);
3649 var s = o - e + 1;
3650 e != i && this.moveRows_(r, e, s);
3651 for (var n = 0; e > n; n++) this.setAbsoluteCursorPosition(s + n, 0), this.screen_.clearCursorRow();
3652 this.restoreCursor(t), this.clearCursorOverflow();
3653};, hterm.Terminal.prototype.insertSpace = function(e) {
3654 var t = this.saveCursor(),
3655 r = lib.f.getWhitespace(e || 1);
3656 this.screen_.insertString(r), this.screen_.maybeClipCurrentRow(), this.restoreCursor(t), this.clearCursorOverflow();
3657};, hterm.Terminal.prototype.deleteChars = function(e) {
3658 var t = this.screen_.deleteChars(e);
3659 if (t && !this.screen_.textAttributes.isDefault()) {
3660 var r = this.saveCursor();
3661 this.setCursorColumn(this.screenSize.width - t), this.screen_.insertString(lib.f.getWhitespace(t)), this.restoreCursor(r);
3662 }
3663 this.clearCursorOverflow();
3664};, hterm.Terminal.prototype.vtScrollUp = function(e) {
3665 var t = this.saveCursor();
3666 this.setAbsoluteCursorRow(this.getVTScrollTop()), this.deleteLines(e), this.restoreCursor(t);
3667};, hterm.Terminal.prototype.vtScrollDown = function(e) {
3668 var t = this.saveCursor();
3669 this.setAbsoluteCursorPosition(this.getVTScrollTop(), 0), this.insertLines(e), this.restoreCursor(t);
3670};, hterm.Terminal.prototype.setCursorPosition = function(e, t) {
3671 this.options_.originMode ? this.setRelativeCursorPosition(e, t) : this.setAbsoluteCursorPosition(e, t);
3672};, hterm.Terminal.prototype.setRelativeCursorPosition = function(e, t) {
3673 var r = this.getVTScrollTop();
3674 e = lib.f.clamp(e + r, r, this.getVTScrollBottom()), t = lib.f.clamp(t, 0, this.screenSize.width - 1), this.screen_.setCursorPosition(e, t);
3675};, hterm.Terminal.prototype.setAbsoluteCursorPosition = function(e, t) {
3676 e = lib.f.clamp(e, 0, this.screenSize.height - 1), t = lib.f.clamp(t, 0, this.screenSize.width - 1), this.screen_.setCursorPosition(e, t);
3677};, hterm.Terminal.prototype.setCursorColumn = function(e) {
3678 this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row, e);
3679};, hterm.Terminal.prototype.getCursorColumn = function() {
3680 return this.screen_.cursorPosition.column;
3681};, hterm.Terminal.prototype.setAbsoluteCursorRow = function(e) {
3682 this.setAbsoluteCursorPosition(e, this.screen_.cursorPosition.column);
3683};, hterm.Terminal.prototype.getCursorRow = function() {
3684 return this.screen_.cursorPosition.row;
3685};, hterm.Terminal.prototype.scheduleRedraw_ = function() {
3686 if (!this.timeouts_.redraw) {
3687 var e = this;
3688 this.timeouts_.redraw = setTimeout(function() {
3689 delete e.timeouts_.redraw, e.scrollPort_.redraw_();
3690 }, 0);
3691 }
3692};, hterm.Terminal.prototype.scheduleScrollDown_ = function() {
3693 if (!this.timeouts_.scrollDown) {
3694 var e = this;
3695 this.timeouts_.scrollDown = setTimeout(function() {
3696 delete e.timeouts_.scrollDown, e.scrollPort_.scrollRowToBottom(e.getRowCount());
3697 }, 10);
3698 }
3699};, hterm.Terminal.prototype.cursorUp = function(e) {
3700 return this.cursorDown(-(e || 1));
3701};, hterm.Terminal.prototype.cursorDown = function(e) {
3702 e = e || 1;
3703 var t = this.options_.originMode ? this.getVTScrollTop() : 0,
3704 r = this.options_.originMode ? this.getVTScrollBottom() : this.screenSize.height - 1,
3705 o = lib.f.clamp(this.screen_.cursorPosition.row + e, t, r);
3706 this.setAbsoluteCursorRow(o);
3707};, hterm.Terminal.prototype.cursorLeft = function(e) {
3708 if (e = e || 1, !(1 > e)) {
3709 var t = this.screen_.cursorPosition.column;
3710 if (this.options_.reverseWraparound) {
3711 if (this.screen_.cursorPosition.overflow && (e--, this.clearCursorOverflow(), !e)) return;
3712 var r = this.screen_.cursorPosition.row,
3713 o = t - e;
3714 0 > o && (r = r - Math.floor(e / this.screenSize.width) - 1, 0 > r && (r = this.screenSize.height + r % this.screenSize.height), o = this.screenSize.width + o % this.screenSize.width), this.setCursorPosition(Math.max(r, 0), o);
3715 }
3716 else {
3717 var o = Math.max(t - e, 0);
3718 this.setCursorColumn(o);
3719 }
3720 }
3721};, hterm.Terminal.prototype.cursorRight = function(e) {
3722 if (e = e || 1, !(1 > e)) {
3723 var t = lib.f.clamp(this.screen_.cursorPosition.column + e, 0, this.screenSize.width - 1);
3724 this.setCursorColumn(t);
3725 }
3726};, hterm.Terminal.prototype.setReverseVideo = function(e) {
3727 this.options_.reverseVideo = e, e ? (this.scrollPort_.setForegroundColor(this.prefs_.get('background-color')), this.scrollPort_.setBackgroundColor(this.prefs_.get('foreground-color'))) : (this.scrollPort_.setForegroundColor(this.prefs_.get('foreground-color')), this.scrollPort_.setBackgroundColor(this.prefs_.get('background-color')));
3728};, hterm.Terminal.prototype.ringBell = function() {
3729 this.cursorNode_.style.backgroundColor = this.scrollPort_.getForegroundColor();
3730 var e = this;
3731 if (setTimeout(function() {
3732 e.cursorNode_.style.backgroundColor = e.prefs_.get('cursor-color');
3733 }, 200), !this.bellSquelchTimeout_ && (this.bellAudio_.getAttribute('src') ? (this.bellAudio_.play(), this.bellSequelchTimeout_ = setTimeout(function() {
3734 delete this.bellSquelchTimeout_;
3735 }.bind(this), 500)) : delete this.bellSquelchTimeout_, this.desktopNotificationBell_ && !this.document_.hasFocus())) {
3736 var t = new Notification(lib.f.replaceVars(hterm.desktopNotificationTitle, {
3737 title: window.document.title || 'hterm'
3738 }));
3739 this.bellNotificationList_.push(t), t.onclick = function() {
3740 e.closeBellNotifications_();
3741 };
3742 }
3743};, hterm.Terminal.prototype.setOriginMode = function(e) {
3744 this.options_.originMode = e, this.setCursorPosition(0, 0);
3745};, hterm.Terminal.prototype.setInsertMode = function(e) {
3746 this.options_.insertMode = e;
3747};, hterm.Terminal.prototype.setAutoCarriageReturn = function(e) {
3748 this.options_.autoCarriageReturn = e;
3749};, hterm.Terminal.prototype.setWraparound = function(e) {
3750 this.options_.wraparound = e;
3751};, hterm.Terminal.prototype.setReverseWraparound = function(e) {
3752 this.options_.reverseWraparound = e;
3753};, hterm.Terminal.prototype.setAlternateMode = function(e) {
3754 var t = this.saveCursor();
3755 if (this.screen_ = e ? this.alternateScreen_ : this.primaryScreen_, this.screen_.rowsArray.length && this.screen_.rowsArray[0].rowIndex != this.scrollbackRows_.length)
3756 for (var r = this.scrollbackRows_.length, o = this.screen_.rowsArray, i = 0; i < o.length; i++) o[i].rowIndex = r + i;
3757 this.realizeWidth_(this.screenSize.width), this.realizeHeight_(this.screenSize.height), this.scrollPort_.syncScrollHeight(), this.scrollPort_.invalidate(), this.restoreCursor(t), this.scrollPort_.resize();
3758};, hterm.Terminal.prototype.setCursorBlink = function(e) {
3759 this.options_.cursorBlink = e, !e && this.timeouts_.cursorBlink && (clearTimeout(this.timeouts_.cursorBlink), delete this.timeouts_.cursorBlink), this.options_.cursorVisible && this.setCursorVisible(!0);
3760};, hterm.Terminal.prototype.setCursorVisible = function(e) {
3761 if (this.options_.cursorVisible = e, !e) return this.timeouts_.cursorBlink && (clearTimeout(this.timeouts_.cursorBlink), delete this.timeouts_.cursorBlink), void(this.cursorNode_.style.opacity = '0');
3762 if (this.syncCursorPosition_(), this.cursorNode_.style.opacity = '1', this.options_.cursorBlink) {
3763 if (this.timeouts_.cursorBlink) return;
3764 this.onCursorBlink_();
3765 }
3766 else this.timeouts_.cursorBlink && (clearTimeout(this.timeouts_.cursorBlink), delete this.timeouts_.cursorBlink);
3767};, hterm.Terminal.prototype.syncCursorPosition_ = function() {
3768 var e = this.scrollPort_.getTopRowIndex(),
3769 t = this.scrollPort_.getBottomRowIndex(e),
3770 r = this.scrollbackRows_.length + this.screen_.cursorPosition.row;
3771 if (r > t) return void(this.cursorNode_.style.top = -this.scrollPort_.characterSize.height + 'px');
3772 this.options_.cursorVisible && 'none' == this.cursorNode_.style.display && (this.cursorNode_.style.display = ''), this.cursorNode_.style.top = this.scrollPort_.visibleRowTopMargin + this.scrollPort_.characterSize.height * (r - e) + 'px', this.cursorNode_.style.left = this.scrollPort_.characterSize.width * this.screen_.cursorPosition.column + 'px', this.cursorNode_.setAttribute('title', '(' + this.screen_.cursorPosition.row + ', ' + this.screen_.cursorPosition.column + ')');
3773 var o = this.document_.getSelection();
3774 o && o.isCollapsed && this.screen_.syncSelectionCaret(o);
3775};, hterm.Terminal.prototype.restyleCursor_ = function() {
3776 var e = this.cursorShape_;
3777 'false' == this.cursorNode_.getAttribute('focus') && (e = hterm.Terminal.cursorShape.BLOCK);
3778 var t = this.cursorNode_.style;
3779 switch (t.width = this.scrollPort_.characterSize.width + 'px', e) {
3780 case hterm.Terminal.cursorShape.BEAM:
3781 t.height = this.scrollPort_.characterSize.height + 'px', t.backgroundColor = 'transparent', t.borderBottomStyle = null, t.borderLeftStyle = 'solid';
3782 break;
3783 case hterm.Terminal.cursorShape.UNDERLINE:
3784 t.height = this.scrollPort_.characterSize.baseline + 'px', t.backgroundColor = 'transparent', t.borderBottomStyle = 'solid', t.borderLeftStyle = null;
3785 break;
3786 default:
3787 t.height = this.scrollPort_.characterSize.height + 'px', t.backgroundColor = this.cursorColor_, t.borderBottomStyle = null, t.borderLeftStyle = null;
3788 }
3789};, hterm.Terminal.prototype.scheduleSyncCursorPosition_ = function() {
3790 if (!this.timeouts_.syncCursor) {
3791 var e = this;
3792 this.timeouts_.syncCursor = setTimeout(function() {
3793 e.syncCursorPosition_(), delete e.timeouts_.syncCursor;
3794 }, 0);
3795 }
3796};, hterm.Terminal.prototype.showZoomWarning_ = function(e) {
3797 if (!this.zoomWarningNode_) {
3798 if (!e) return;
3799 this.zoomWarningNode_ = this.document_.createElement('div'), this.zoomWarningNode_.style.cssText = 'color: black;background-color: #ff2222;font-size: large;border-radius: 8px;opacity: 0.75;padding: 0.2em 0.5em 0.2em 0.5em;top: 0.5em;right: 1.2em;position: absolute;-webkit-text-size-adjust: none;-webkit-user-select: none;-moz-text-size-adjust: none;-moz-user-select: none;', this.zoomWarningNode_.addEventListener('click', function(e) {
3800 this.parentNode.removeChild(this);
3801 });
3802 }
3803 this.zoomWarningNode_.textContent = lib.MessageManager.replaceReferences(hterm.zoomWarningMessage, [parseInt(100 * this.scrollPort_.characterSize.zoomFactor)]), this.zoomWarningNode_.style.fontFamily = this.prefs_.get('font-family'), e ? this.zoomWarningNode_.parentNode || this.div_.parentNode.appendChild(this.zoomWarningNode_) : this.zoomWarningNode_.parentNode && this.zoomWarningNode_.parentNode.removeChild(this.zoomWarningNode_);
3804};, hterm.Terminal.prototype.showOverlay = function(e, t) {
3805 if (!this.overlayNode_) {
3806 if (!this.div_) return;
3807 this.overlayNode_ = this.document_.createElement('div'), this.overlayNode_.style.cssText = 'border-radius: 15px;font-size: xx-large;opacity: 0.75;padding: 0.2em 0.5em 0.2em 0.5em;position: absolute;-webkit-user-select: none;-webkit-transition: opacity 180ms ease-in;-moz-user-select: none;-moz-transition: opacity 180ms ease-in;', this.overlayNode_.addEventListener('mousedown', function(e) {
3808 e.preventDefault(), e.stopPropagation();
3809 }, !0);
3810 }
3811 this.overlayNode_.style.color = this.prefs_.get('background-color'), this.overlayNode_.style.backgroundColor = this.prefs_.get('foreground-color'), this.overlayNode_.style.fontFamily = this.prefs_.get('font-family'), this.overlayNode_.textContent = e, this.overlayNode_.style.opacity = '0.75', this.overlayNode_.parentNode || this.div_.appendChild(this.overlayNode_);
3812 var r = hterm.getClientSize(this.div_),
3813 o = hterm.getClientSize(this.overlayNode_);
3814 this.overlayNode_.style.top = (r.height - o.height) / 2 + 'px', this.overlayNode_.style.left = (r.width - o.width - this.scrollPort_.currentScrollbarWidthPx) / 2 + 'px';
3815 var i = this;
3816 this.overlayTimeout_ && clearTimeout(this.overlayTimeout_), null !== t && (this.overlayTimeout_ = setTimeout(function() {
3817 i.overlayNode_.style.opacity = '0', i.overlayTimeout_ = setTimeout(function() {
3818 i.overlayNode_.parentNode && i.overlayNode_.parentNode.removeChild(i.overlayNode_), i.overlayTimeout_ = null, i.overlayNode_.style.opacity = '0.75';
3819 }, 200);
3820 }, t || 1500));
3821};, hterm.Terminal.prototype.paste = function() {
3822 hterm.pasteFromClipboard(this.document_);
3823};, hterm.Terminal.prototype.copyStringToClipboard = function(e) {
3824 this.prefs_.get('enable-clipboard-notice') && setTimeout(this.showOverlay.bind(this, hterm.notifyCopyMessage, 500), 200);
3825 var t = this.document_.createElement('pre');
3826 t.textContent = e, t.style.cssText = '-webkit-user-select: text;-moz-user-select: text;position: absolute;top: -99px', this.document_.body.appendChild(t);
3827 var r = this.document_.getSelection(),
3828 o = r.anchorNode,
3829 i = r.anchorOffset,
3830 s = r.focusNode,
3831 n = r.focusOffset;
3832 r.selectAllChildren(t), hterm.copySelectionToClipboard(this.document_), r.extend && (r.collapse(o, i), r.extend(s, n)), t.parentNode.removeChild(t);
3833};, hterm.Terminal.prototype.getSelectionText = function() {
3834 var e = this.scrollPort_.selection;
3835 if (e.sync(), e.isCollapsed) return null;
3836 var t = e.startOffset,
3837 r = e.startNode;
3838 if ('X-ROW' != r.nodeName)
3839 for ('#text' == r.nodeName && 'SPAN' == r.parentNode.nodeName && (r = r.parentNode); r.previousSibling;) r = r.previousSibling, t += hterm.TextAttributes.nodeWidth(r);
3840 var o = hterm.TextAttributes.nodeWidth(e.endNode) - e.endOffset;
3841 if (r = e.endNode, 'X-ROW' != r.nodeName)
3842 for ('#text' == r.nodeName && 'SPAN' == r.parentNode.nodeName && (r = r.parentNode); r.nextSibling;) r = r.nextSibling, o += hterm.TextAttributes.nodeWidth(r);
3843 var i = this.getRowsText(e.startRow.rowIndex, e.endRow.rowIndex + 1);
3844 return lib.wc.substring(i, t, lib.wc.strWidth(i) - o);
3845};, hterm.Terminal.prototype.copySelectionToClipboard = function() {
3846 var e = this.getSelectionText();
3847 null != e && this.copyStringToClipboard(e);
3848};, hterm.Terminal.prototype.overlaySize = function() {
3849 this.showOverlay(this.screenSize.width + 'x' + this.screenSize.height);
3850};, hterm.Terminal.prototype.onVTKeystroke = function(e) {
3851 this.scrollOnKeystroke_ && this.scrollPort_.scrollRowToBottom(this.getRowCount()), this.io.onVTKeystroke(this.keyboard.encode(e));
3852};, hterm.Terminal.prototype.openUrl = function(e) {
3853 var t = window.open(e, '_blank');
3854 t.focus();
3855};, hterm.Terminal.prototype.openSelectedUrl_ = function() {
3856 var e = this.getSelectionText();
3857 null == e && (this.screen_.expandSelection(this.document_.getSelection()), e = this.getSelectionText()), e.length > 2048 || e.search(/[\s\[\](){}<>"'\\^`]/) >= 0 || (e.search('^[a-zA-Z][a-zA-Z0-9+.-]*://') < 0 && (e = 'http://' + e), this.openUrl(e));
3858};, hterm.Terminal.prototype.onMouse_ = function(e) {
3859 if (!e.processedByTerminalHandler_) {
3860 var t = !this.defeatMouseReports_ && this.vt.mouseReport != this.vt.MOUSE_REPORT_DISABLED;
3861 if (e.processedByTerminalHandler_ = !0, e.terminalRow = parseInt((e.clientY - this.scrollPort_.visibleRowTopMargin) / this.scrollPort_.characterSize.height) + 1, e.terminalColumn = parseInt(e.clientX / this.scrollPort_.characterSize.width) + 1, !('mousedown' == e.type && e.terminalColumn > this.screenSize.width)) {
3862 if (this.options_.cursorVisible && !t && (e.terminalRow - 1 == this.screen_.cursorPosition.row && e.terminalColumn - 1 == this.screen_.cursorPosition.column ? this.cursorNode_.style.display = 'none' : 'none' == this.cursorNode_.style.display && (this.cursorNode_.style.display = '')), 'mousedown' == e.type && (e.altKey || !t ? (this.defeatMouseReports_ = !0, this.setSelectionEnabled(!0)) : (this.defeatMouseReports_ = !1, this.document_.getSelection().collapseToEnd(), this.setSelectionEnabled(!1), e.preventDefault())), t) this.scrollBlockerNode_.engaged || ('mousedown' == e.type ? (this.scrollBlockerNode_.engaged = !0, this.scrollBlockerNode_.style.top = e.clientY - 5 + 'px', this.scrollBlockerNode_.style.left = e.clientX - 5 + 'px') : 'mousemove' == e.type && (this.document_.getSelection().collapseToEnd(), e.preventDefault())), this.onMouse(e);
3863 else {
3864 if ('dblclick' == e.type && this.copyOnSelect && (this.screen_.expandSelection(this.document_.getSelection()), this.copySelectionToClipboard(this.document_)), 'click' == e.type && !e.shiftKey && e.ctrlKey) return clearTimeout(this.timeouts_.openUrl), void(this.timeouts_.openUrl = setTimeout(this.openSelectedUrl_.bind(this), 500));
3865 'mousedown' == e.type && e.which == this.mousePasteButton && this.paste(), 'mouseup' == e.type && 1 == e.which && this.copyOnSelect && !this.document_.getSelection().isCollapsed && this.copySelectionToClipboard(this.document_), 'mousemove' != e.type && 'mouseup' != e.type || !this.scrollBlockerNode_.engaged || (this.scrollBlockerNode_.engaged = !1, this.scrollBlockerNode_.style.top = '-99px');
3866 }
3867 'mouseup' == e.type && this.document_.getSelection().isCollapsed && (this.defeatMouseReports_ = !1);
3868 }
3869 }
3870};, hterm.Terminal.prototype.onMouse = function(e) {};, hterm.Terminal.prototype.onFocusChange_ = function(e) {
3871 this.cursorNode_.setAttribute('focus', e), this.restyleCursor_(), e === !0 && this.closeBellNotifications_();
3872};, hterm.Terminal.prototype.onScroll_ = function() {
3873 this.scheduleSyncCursorPosition_();
3874};, hterm.Terminal.prototype.onPaste_ = function(e) {
3875 var t = e.text.replace(/\n/gm, '\r');
3876 t = this.keyboard.encode(t), this.options_.bracketedPaste && (t = '[200~' + t + '[201~'), this.io.sendString(t);
3877};, hterm.Terminal.prototype.onCopy_ = function(e) {
3878 this.useDefaultWindowCopy || (e.preventDefault(), setTimeout(this.copySelectionToClipboard.bind(this), 0));
3879};, hterm.Terminal.prototype.onResize_ = function() {
3880 var e = Math.floor(this.scrollPort_.getScreenWidth() / this.scrollPort_.characterSize.width) || 0,
3881 t = lib.f.smartFloorDivide(this.scrollPort_.getScreenHeight(), this.scrollPort_.characterSize.height) || 0;
3882 if (!(0 >= e || 0 >= t)) {
3883 var r = e != this.screenSize.width || t != this.screenSize.height;
3884 this.realizeSize_(e, t), this.showZoomWarning_(1 != this.scrollPort_.characterSize.zoomFactor), r && this.overlaySize(), this.restyleCursor_(), this.scheduleSyncCursorPosition_();
3885 }
3886};, hterm.Terminal.prototype.onCursorBlink_ = function() {
3887 return this.options_.cursorBlink ? void('false' == this.cursorNode_.getAttribute('focus') || '0' == this.cursorNode_.style.opacity ? (this.cursorNode_.style.opacity = '1', this.timeouts_.cursorBlink = setTimeout(this.myOnCursorBlink_, this.cursorBlinkCycle_[0])) : (this.cursorNode_.style.opacity = '0', this.timeouts_.cursorBlink = setTimeout(this.myOnCursorBlink_, this.cursorBlinkCycle_[1]))) : void delete this.timeouts_.cursorBlink;
3888};, hterm.Terminal.prototype.setScrollbarVisible = function(e) {
3889 this.scrollPort_.setScrollbarVisible(e);
3890};, hterm.Terminal.prototype.setScrollWheelMoveMultipler = function(e) {
3891 this.scrollPort_.setScrollWheelMoveMultipler(e);
3892};, hterm.Terminal.prototype.closeBellNotifications_ = function() {
3893 this.bellNotificationList_.forEach(function(e) {
3894 e.close();
3895 }), this.bellNotificationList_.length = 0;
3896};, lib.rtdep('lib.encodeUTF8'), hterm.Terminal.IO = function(e) {
3897 this.terminal_ = e, this.previousIO_ = null;
3898};, hterm.Terminal.IO.prototype.showOverlay = function(e, t) {
3899 this.terminal_.showOverlay(e, t);
3900};, hterm.Terminal.IO.prototype.createFrame = function(e, t) {
3901 return new hterm.Frame(this.terminal_, e, t);
3902};, hterm.Terminal.IO.prototype.setTerminalProfile = function(e) {
3903 this.terminal_.setProfile(e);
3904};, hterm.Terminal.IO.prototype.push = function() {
3905 var e = new hterm.Terminal.IO(this.terminal_);
3906 return e.keyboardCaptured_ = this.keyboardCaptured_, e.columnCount = this.columnCount, e.rowCount = this.rowCount, e.previousIO_ = this.terminal_.io, this.terminal_.io = e, e;
3907};, hterm.Terminal.IO.prototype.pop = function() {
3908 this.terminal_.io = this.previousIO_;
3909};, hterm.Terminal.IO.prototype.sendString = function(e) {
3910 console.log('Unhandled sendString: ' + e);
3911};, hterm.Terminal.IO.prototype.onVTKeystroke = function(e) {
3912 console.log('Unobserverd VT keystroke: ' + JSON.stringify(e));
3913};, hterm.Terminal.IO.prototype.onTerminalResize_ = function(e, t) {
3914 for (var r = this; r;) r.columnCount = e, r.rowCount = t, r = r.previousIO_;
3915 this.onTerminalResize(e, t);
3916};, hterm.Terminal.IO.prototype.onTerminalResize = function(e, t) {};, hterm.Terminal.IO.prototype.writeUTF8 = function(e) {
3917 if (this.terminal_.io != this) throw 'Attempt to print from inactive IO object.';
3918 this.terminal_.interpret(e);
3919};, hterm.Terminal.IO.prototype.writelnUTF8 = function(e) {
3920 if (this.terminal_.io != this) throw 'Attempt to print from inactive IO object.';
3921 this.terminal_.interpret(e + '\r\n');
3922};, hterm.Terminal.IO.prototype.print = hterm.Terminal.IO.prototype.writeUTF16 = function(e) {
3923 this.writeUTF8(lib.encodeUTF8(e));
3924};, hterm.Terminal.IO.prototype.println = hterm.Terminal.IO.prototype.writelnUTF16 = function(e) {
3925 this.writelnUTF8(lib.encodeUTF8(e));
3926};, lib.rtdep('lib.colors'), hterm.TextAttributes = function(e) {
3927 this.document_ = e, this.foregroundSource = this.SRC_DEFAULT, this.backgroundSource = this.SRC_DEFAULT, this.foreground = this.DEFAULT_COLOR, this.background = this.DEFAULT_COLOR, this.defaultForeground = 'rgb(255, 255, 255)', this.defaultBackground = 'rgb(0, 0, 0)', this.bold = !1, this.faint = !1, this.italic = !1, this.blink = !1, this.underline = !1, this.strikethrough = !1, this.inverse = !1, this.invisible = !1, this.wcNode = !1, this.tileData = null, this.colorPalette = null, this.resetColorPalette();
3928};, hterm.TextAttributes.prototype.enableBold = !0, hterm.TextAttributes.prototype.enableBoldAsBright = !0, hterm.TextAttributes.prototype.DEFAULT_COLOR = new String(''), hterm.TextAttributes.prototype.SRC_DEFAULT = 'default', hterm.TextAttributes.prototype.SRC_RGB = 'rgb', hterm.TextAttributes.prototype.setDocument = function(e) {
3929 this.document_ = e;
3930};, hterm.TextAttributes.prototype.clone = function() {
3931 var e = new hterm.TextAttributes(null);
3932 for (var t in this) e[t] = this[t];
3933 return e.colorPalette = this.colorPalette.concat(), e;
3934};, hterm.TextAttributes.prototype.reset = function() {
3935 this.foregroundSource = this.SRC_DEFAULT, this.backgroundSource = this.SRC_DEFAULT, this.foreground = this.DEFAULT_COLOR, this.background = this.DEFAULT_COLOR, this.bold = !1, this.faint = !1, this.italic = !1, this.blink = !1, this.underline = !1, this.strikethrough = !1, this.inverse = !1, this.invisible = !1, this.wcNode = !1;
3936};, hterm.TextAttributes.prototype.resetColorPalette = function() {
3937 this.colorPalette = lib.colors.colorPalette.concat(), this.syncColors();
3938};, hterm.TextAttributes.prototype.isDefault = function() {
3939 return !(this.foregroundSource != this.SRC_DEFAULT || this.backgroundSource != this.SRC_DEFAULT || this.bold || this.faint || this.italic || this.blink || this.underline || this.strikethrough || this.inverse || this.invisible || this.wcNode || null != this.tileData);
3940};, hterm.TextAttributes.prototype.createContainer = function(e) {
3941 if (this.isDefault()) return this.document_.createTextNode(e);
3942 var t = this.document_.createElement('span'),
3943 r = t.style,
3944 o = [];
3945 this.foreground != this.DEFAULT_COLOR && (r.color = this.foreground), this.background != this.DEFAULT_COLOR && (r.backgroundColor = this.background), this.enableBold && this.bold && (r.fontWeight = 'bold'), this.faint && (t.faint = !0), this.italic && (r.fontStyle = 'italic'), this.blink && (o.push('blink-node'), t.blinkNode = !0);
3946 var i = '';
3947 return this.underline && (i += ' underline', t.underline = !0), this.strikethrough && (i += ' line-through', t.strikethrough = !0), i && (r.textDecoration = i), this.wcNode && (o.push('wc-node'), t.wcNode = !0), null != this.tileData && (o.push('tile'), o.push('tile_' + this.tileData), t.tileNode = !0), e && (t.textContent = e), o.length && (t.className = o.join(' ')), t;
3948};, hterm.TextAttributes.prototype.matchesContainer = function(e) {
3949 if ('string' == typeof e || 3 == e.nodeType) return this.isDefault();
3950 var t = e.style;
3951 return !(this.wcNode || e.wcNode || null != this.tileData || e.tileNode || this.foreground != t.color || this.background != t.backgroundColor || (this.enableBold && this.bold) != !!t.fontWeight || this.blink != e.blinkNode || this.italic != !!t.fontStyle || !!this.underline != !!e.underline || !!this.strikethrough != !!e.strikethrough);
3952};, hterm.TextAttributes.prototype.setDefaults = function(e, t) {
3953 this.defaultForeground = e, this.defaultBackground = t, this.syncColors();
3954};, hterm.TextAttributes.prototype.syncColors = function() {
3955 function e(e) {
3956 return 8 > e ? e + 8 : e;
3957 }
3958 var t = this.foregroundSource,
3959 r = this.backgroundSource,
3960 o = this.DEFAULT_COLOR,
3961 i = this.DEFAULT_COLOR;
3962 if (this.inverse && (t = this.backgroundSource, r = this.foregroundSource, o = this.defaultBackground, i = this.defaultForeground), this.enableBoldAsBright && this.bold && t != this.SRC_DEFAULT && t != this.SRC_RGB && (t = e(t)), this.invisible && (t = r, o = this.defaultBackground), t != this.SRC_RGB && (this.foreground = t == this.SRC_DEFAULT ? o : this.colorPalette[t]), this.faint && !this.invisible) {
3963 var s = this.foreground == this.DEFAULT_COLOR ? this.defaultForeground : this.foreground;
3964 this.foreground = lib.colors.mix(s, 'rgb(0, 0, 0)', .3333);
3965 }
3966 r != this.SRC_RGB && (this.background = r == this.SRC_DEFAULT ? i : this.colorPalette[r]);
3967};, hterm.TextAttributes.containersMatch = function(e, t) {
3968 if ('string' == typeof e) return hterm.TextAttributes.containerIsDefault(t);
3969 if (e.nodeType != t.nodeType) return !1;
3970 if (3 == e.nodeType) return !0;
3971 var r = e.style,
3972 o = t.style;
3973 return r.color == o.color && r.backgroundColor == o.backgroundColor && r.fontWeight == o.fontWeight && r.fontStyle == o.fontStyle && r.textDecoration == o.textDecoration;
3974};, hterm.TextAttributes.containerIsDefault = function(e) {
3975 return 'string' == typeof e || 3 == e.nodeType;
3976};, hterm.TextAttributes.nodeWidth = function(e) {
3977 return e.wcNode ? lib.wc.strWidth(e.textContent) : e.textContent.length;
3978};, hterm.TextAttributes.nodeSubstr = function(e, t, r) {
3979 return e.wcNode ? lib.wc.substr(e.textContent, t, r) : e.textContent.substr(t, r);
3980};, hterm.TextAttributes.nodeSubstring = function(e, t, r) {
3981 return e.wcNode ? lib.wc.substring(e.textContent, t, r) : e.textContent.substring(t, r);
3982};, hterm.TextAttributes.splitWidecharString = function(e) {
3983 for (var t = [], r = 0, o = 0, i = 0; i < e.length;) {
3984 var s = e.codePointAt(i),
3985 n = 65535 >= s ? 1 : 2;
3986 128 > s || 1 == lib.wc.charWidth(s) ? o += n : (o && t.push({
3987 str: e.substr(r, o)
3988 }), t.push({
3989 str: e.substr(i, n),
3990 wcNode: !0
3991 }), r = i + n, o = 0), i += n;
3992 }
3993 return o && t.push({
3994 str: e.substr(r, o)
3995 }), t;
3996};, lib.rtdep('lib.colors', 'lib.f', 'lib.UTF8Decoder', 'hterm.VT.CharacterMap'), hterm.VT = function(e) {
3997 this.terminal = e, e.onMouse = this.onTerminalMouse_.bind(this), this.mouseReport = this.MOUSE_REPORT_DISABLED, this.parseState_ = new hterm.VT.ParseState(this.parseUnknown_), this.leadingModifier_ = '', this.trailingModifier_ = '', this.allowColumnWidthChanges_ = !1, this.oscTimeLimit_ = 2e4;
3998 var t = Object.keys(hterm.VT.CC1).map(function(e) {
3999 return '\\x' + lib.f.zpad(e.charCodeAt().toString(16), 2);
4000 }).join('');
4001 this.cc1Pattern_ = new RegExp('[' + t + ']'), this.utf8Decoder_ = new lib.UTF8Decoder, this.enable8BitControl = !1, this.enableClipboardWrite = !0, this.enableDec12 = !1, this.characterEncoding = 'utf-8', this.maxStringSequence = 1024, this.warnUnimplemented = !0, this.G0 = hterm.VT.CharacterMap.maps.B, this.G1 = hterm.VT.CharacterMap.maps[0], this.G2 = hterm.VT.CharacterMap.maps.B, this.G3 = hterm.VT.CharacterMap.maps.B, this.GL = 'G0', this.GR = 'G0', this.savedState_ = new hterm.VT.CursorState(this);
4002};, hterm.VT.prototype.MOUSE_REPORT_DISABLED = 0, hterm.VT.prototype.MOUSE_REPORT_CLICK = 1, hterm.VT.prototype.MOUSE_REPORT_DRAG = 3, hterm.VT.ParseState = function(e, t) {
4003 this.defaultFunction = e, this.buf = t || null, this.pos = 0, this.func = e, this.args = [];
4004};, hterm.VT.ParseState.prototype.reset = function(e) {
4005 this.resetParseFunction(), this.resetBuf(e || ''), this.resetArguments();
4006};, hterm.VT.ParseState.prototype.resetParseFunction = function() {
4007 this.func = this.defaultFunction;
4008};, hterm.VT.ParseState.prototype.resetBuf = function(e) {
4009 this.buf = 'string' == typeof e ? e : null, this.pos = 0;
4010};, hterm.VT.ParseState.prototype.resetArguments = function(e) {
4011 this.args.length = 0, 'undefined' != typeof e && (this.args[0] = e);
4012};, hterm.VT.ParseState.prototype.iarg = function(e, t) {
4013 var r = this.args[e];
4014 if (r) {
4015 var o = parseInt(r, 10);
4016 return 0 == o && (o = t), o;
4017 }
4018 return t;
4019};, hterm.VT.ParseState.prototype.advance = function(e) {
4020 this.pos += e;
4021};, hterm.VT.ParseState.prototype.peekRemainingBuf = function() {
4022 return this.buf.substr(this.pos);
4023};, hterm.VT.ParseState.prototype.peekChar = function() {
4024 return this.buf.substr(this.pos, 1);
4025};, hterm.VT.ParseState.prototype.consumeChar = function() {
4026 return this.buf.substr(this.pos++, 1);
4027};, hterm.VT.ParseState.prototype.isComplete = function() {
4028 return null == this.buf || this.buf.length <= this.pos;
4029};, hterm.VT.CursorState = function(e) {
4030 this.vt_ = e, this.save();
4031};, hterm.VT.CursorState.prototype.save = function() {
4032 this.cursor = this.vt_.terminal.saveCursor(), this.textAttributes = this.vt_.terminal.getTextAttributes().clone(), this.GL = this.vt_.GL, this.GR = this.vt_.GR, this.G0 = this.vt_.G0, this.G1 = this.vt_.G1, this.G2 = this.vt_.G2, this.G3 = this.vt_.G3;
4033};, hterm.VT.CursorState.prototype.restore = function() {
4034 this.vt_.terminal.restoreCursor(this.cursor), this.vt_.terminal.setTextAttributes(this.textAttributes.clone()), this.vt_.GL = this.GL, this.vt_.GR = this.GR, this.vt_.G0 = this.G0, this.vt_.G1 = this.G1, this.vt_.G2 = this.G2, this.vt_.G3 = this.G3;
4035};, hterm.VT.prototype.reset = function() {
4036 this.G0 = hterm.VT.CharacterMap.maps.B, this.G1 = hterm.VT.CharacterMap.maps[0], this.G2 = hterm.VT.CharacterMap.maps.B, this.G3 = hterm.VT.CharacterMap.maps.B, this.GL = 'G0', this.GR = 'G0', this.savedState_ = new hterm.VT.CursorState(this), this.mouseReport = this.MOUSE_REPORT_DISABLED;
4037};, hterm.VT.prototype.onTerminalMouse_ = function(e) {
4038 if (this.mouseReport != this.MOUSE_REPORT_DISABLED) {
4039 var t, r = 0;
4040 e.shiftKey && (r |= 4), (e.metaKey || this.terminal.keyboard.altIsMeta && e.altKey) && (r |= 8), e.ctrlKey && (r |= 16);
4041 var o = String.fromCharCode(lib.f.clamp(e.terminalColumn + 32, 32, 255)),
4042 i = String.fromCharCode(lib.f.clamp(e.terminalRow + 32, 32, 255));
4043 switch (e.type) {
4044 case 'mousewheel':
4045 s = (e.wheelDeltaY > 0 ? 0 : 1) + 96, s |= r, t = '' + String.fromCharCode(s) + o + i, e.preventDefault();
4046 break;
4047 case 'mousedown':
4048 var s = Math.min(e.which - 1, 2) + 32;
4049 s |= r, t = '' + String.fromCharCode(s) + o + i;
4050 break;
4051 case 'mouseup':
4052 t = '#' + o + i;
4053 break;
4054 case 'mousemove':
4055 this.mouseReport == this.MOUSE_REPORT_DRAG && e.which && (s = 32 + Math.min(e.which - 1, 2), s += 32, s |= r, t = '' + String.fromCharCode(s) + o + i);
4056 break;
4057 case 'click':
4058 case 'dblclick':
4059 break;
4060 default:
4061 console.error('Unknown mouse event: ' + e.type, e);
4062 }
4063 t && this.terminal.io.sendString(t);
4064 }
4065};, hterm.VT.prototype.interpret = function(e) {
4066 for (this.parseState_.resetBuf(this.decode(e)); !this.parseState_.isComplete();) {
4067 var t = this.parseState_.func,
4068 r = this.parseState_.pos,
4069 e = this.parseState_.buf;
4070 if (this.parseState_.func.call(this, this.parseState_), this.parseState_.func == t && this.parseState_.pos == r && this.parseState_.buf == e) throw 'Parser did not alter the state!';
4071 }
4072};, hterm.VT.prototype.decode = function(e) {
4073 return 'utf-8' == this.characterEncoding ? this.decodeUTF8(e) : e;
4074};, hterm.VT.prototype.encodeUTF8 = function(e) {
4075 return lib.encodeUTF8(e);
4076};, hterm.VT.prototype.decodeUTF8 = function(e) {
4077 return this.utf8Decoder_.decode(e);
4078};, hterm.VT.prototype.parseUnknown_ = function(e) {
4079 function t(e) {
4080 r[r.GL].GL && (e = r[r.GL].GL(e)), r[r.GR].GR && (e = r[r.GR].GR(e)), r.terminal.print(e);
4081 }
4082 var r = this,
4083 o = e.peekRemainingBuf(),
4084 i = o.search(this.cc1Pattern_);
4085 return 0 == i ? (this.dispatch('CC1', o.substr(0, 1), e), void e.advance(1)) : -1 == i ? (t(o), void e.reset()) : (t(o.substr(0, i)), this.dispatch('CC1', o.substr(i, 1), e), void e.advance(i + 1))
4086};, hterm.VT.prototype.parseCSI_ = function(e) {
4087 var t = e.peekChar(),
4088 r = e.args;
4089 t >= '@' && '~' >= t ? (this.dispatch('CSI', this.leadingModifier_ + this.trailingModifier_ + t, e), e.resetParseFunction()) : ';' == t ? this.trailingModifier_ ? e.resetParseFunction() : (r.length || r.push(''), r.push('')) : t >= '0' && '9' >= t ? this.trailingModifier_ ? e.resetParseFunction() : r.length ? r[r.length - 1] += t : r[0] = t : t >= ' ' && '?' >= t && ':' != t ? r.length ? this.trailingModifier_ += t : this.leadingModifier_ += t : this.cc1Pattern_.test(t) ? this.dispatch('CC1', t, e) : e.resetParseFunction(), e.advance(1);
4090};, hterm.VT.prototype.parseUntilStringTerminator_ = function(e) {
4091 var t = e.peekRemainingBuf(),
4092 r = t.search(/(\x1b\\|\x07)/),
4093 o = e.args;
4094 if (o.length || (o[0] = '', o[1] = new Date), -1 == r) {
4095 o[0] += t;
4096 var i;
4097 return o[0].length > this.maxStringSequence && (i = 'too long: ' + o[0].length), -1 != o[0].indexOf('') && (i = 'embedded escape: ' + o[0].indexOf('')), new Date - o[1] > this.oscTimeLimit_ && (i = 'timeout expired: ' + new Date - o[1]), i ? (console.log('parseUntilStringTerminator_: aborting: ' + i, o[0]), e.reset(o[0]), !1) : (e.advance(t.length), !0);
4098 }
4099 return o[0].length + r > this.maxStringSequence ? (e.reset(o[0] + t), !1) : (o[0] += t.substr(0, r), e.resetParseFunction(), e.advance(r + ('' == t.substr(r, 1) ? 2 : 1)), !0);
4100};, hterm.VT.prototype.dispatch = function(e, t, r) {
4101 var o = hterm.VT[e][t];
4102 return o ? o == hterm.VT.ignore ? void(this.warnUnimplemented && console.warn('Ignored ' + e + ' code: ' + JSON.stringify(t))) : 'CC1' == e && t > '' && !this.enable8BitControl ? void console.warn('Ignoring 8-bit control code: 0x' + t.charCodeAt(0).toString(16)) : void o.apply(this, [r, t]) : void(this.warnUnimplemented && console.warn('Unknown ' + e + ' code: ' + JSON.stringify(t)))
4103};, hterm.VT.prototype.setANSIMode = function(e, t) {
4104 '4' == e ? this.terminal.setInsertMode(t) : '20' == e ? this.terminal.setAutoCarriageReturn(t) : this.warnUnimplemented && console.warn('Unimplemented ANSI Mode: ' + e)
4105};, hterm.VT.prototype.setDECMode = function(e, t) {
4106 switch (e) {
4107 case '1':
4108 this.terminal.keyboard.applicationCursor = t;
4109 break;
4110 case '3':
4111 this.allowColumnWidthChanges_ && (this.terminal.setWidth(t ? 132 : 80), this.terminal.clearHome(), this.terminal.setVTScrollRegion(null, null));
4112 break;
4113 case '5':
4114 this.terminal.setReverseVideo(t);
4115 break;
4116 case '6':
4117 this.terminal.setOriginMode(t);
4118 break;
4119 case '7':
4120 this.terminal.setWraparound(t);
4121 break;
4122 case '12':
4123 this.enableDec12 && this.terminal.setCursorBlink(t);
4124 break;
4125 case '25':
4126 this.terminal.setCursorVisible(t);
4127 break;
4128 case '40':
4129 this.terminal.allowColumnWidthChanges_ = t;
4130 break;
4131 case '45':
4132 this.terminal.setReverseWraparound(t);
4133 break;
4134 case '67':
4135 this.terminal.keyboard.backspaceSendsBackspace = t;
4136 break;
4137 case '1000':
4138 this.mouseReport = t ? this.MOUSE_REPORT_CLICK : this.MOUSE_REPORT_DISABLED;
4139 break;
4140 case '1002':
4141 this.mouseReport = t ? this.MOUSE_REPORT_DRAG : this.MOUSE_REPORT_DISABLED;
4142 break;
4143 case '1010':
4144 this.terminal.scrollOnOutput = t;
4145 break;
4146 case '1011':
4147 this.terminal.scrollOnKeystroke = t;
4148 break;
4149 case '1036':
4150 this.terminal.keyboard.metaSendsEscape = t;
4151 break;
4152 case '1039':
4153 t ? this.terminal.keyboard.previousAltSendsWhat_ || (this.terminal.keyboard.previousAltSendsWhat_ = this.terminal.keyboard.altSendsWhat, this.terminal.keyboard.altSendsWhat = 'escape') : this.terminal.keyboard.previousAltSendsWhat_ && (this.terminal.keyboard.altSendsWhat = this.terminal.keyboard.previousAltSendsWhat_, this.terminal.keyboard.previousAltSendsWhat_ = null);
4154 break;
4155 case '47':
4156 case '1047':
4157 this.terminal.setAlternateMode(t);
4158 break;
4159 case '1048':
4160 this.savedState_.save();
4161 case '1049':
4162 t ? (this.savedState_.save(), this.terminal.setAlternateMode(t), this.terminal.clear()) : (this.terminal.setAlternateMode(t), this.savedState_.restore());
4163 break;
4164 case '2004':
4165 this.terminal.setBracketedPaste(t);
4166 break;
4167 default:
4168 this.warnUnimplemented && console.warn('Unimplemented DEC Private Mode: ' + e);
4169 }
4170};, hterm.VT.ignore = function() {};, hterm.VT.CC1 = {}, hterm.VT.ESC = {}, hterm.VT.CSI = {}, hterm.VT.OSC = {}, hterm.VT.VT52 = {}, hterm.VT.CC1['\x00'] = function() {};, hterm.VT.CC1[''] = hterm.VT.ignore, hterm.VT.CC1[''] = function() {
4171 this.terminal.ringBell();
4172};, hterm.VT.CC1['\b'] = function() {
4173 this.terminal.cursorLeft(1);
4174};, hterm.VT.CC1[' '] = function() {
4175 this.terminal.forwardTabStop();
4176};, hterm.VT.CC1['\n'] = function() {
4177 this.terminal.formFeed();
4178};, hterm.VT.CC1[' '] = hterm.VT.CC1['\n'], hterm.VT.CC1['\f'] = function() {
4179 this.terminal.formFeed();
4180};, hterm.VT.CC1['\r'] = function() {
4181 this.terminal.setCursorColumn(0);
4182};, hterm.VT.CC1[''] = function() {
4183 this.GL = 'G1';
4184};, hterm.VT.CC1[''] = function() {
4185 this.GL = 'G0';
4186};, hterm.VT.CC1[''] = hterm.VT.ignore, hterm.VT.CC1[''] = hterm.VT.ignore, hterm.VT.CC1[''] = function(e) {
4187 'G1' == this.GL && (this.GL = 'G0'), e.resetParseFunction(), this.terminal.print('?');
4188};, hterm.VT.CC1[''] = hterm.VT.CC1[''], hterm.VT.CC1[''] = function(e) {
4189 function t(e) {
4190 var r = e.consumeChar();
4191 '' != r && (this.dispatch('ESC', r, e), e.func == t && e.resetParseFunction());
4192 }
4193 e.func = t;
4194};, hterm.VT.CC1[''] = hterm.VT.ignore, hterm.VT.CC1['„'] = hterm.VT.ESC.D = function() {
4195 this.terminal.lineFeed();
4196};, hterm.VT.CC1['…'] = hterm.VT.ESC.E = function() {
4197 this.terminal.setCursorColumn(0), this.terminal.cursorDown(1);
4198};, hterm.VT.CC1['ˆ'] = hterm.VT.ESC.H = function() {
4199 this.terminal.setTabStop(this.terminal.getCursorColumn());
4200};, hterm.VT.CC1[''] = hterm.VT.ESC.M = function() {
4201 this.terminal.reverseLineFeed();
4202};, hterm.VT.CC1['Ž'] = hterm.VT.ESC.N = hterm.VT.ignore, hterm.VT.CC1[''] = hterm.VT.ESC.O = hterm.VT.ignore, hterm.VT.CC1[''] = hterm.VT.ESC.P = function(e) {
4203 e.resetArguments(), e.func = this.parseUntilStringTerminator_;
4204};, hterm.VT.CC1['–'] = hterm.VT.ESC.V = hterm.VT.ignore, hterm.VT.CC1['—'] = hterm.VT.ESC.W = hterm.VT.ignore, hterm.VT.CC1['˜'] = hterm.VT.ESC.X = hterm.VT.ignore, hterm.VT.CC1['š'] = hterm.VT.ESC.Z = function() {
4205 this.terminal.io.sendString('[?1;2c');
4206};, hterm.VT.CC1['›'] = hterm.VT.ESC['['] = function(e) {
4207 e.resetArguments(), this.leadingModifier_ = '',
4208 this.trailingModifier_ = '', e.func = this.parseCSI_;
4209};, hterm.VT.CC1['œ'] = hterm.VT.ESC['\\'] = hterm.VT.ignore, hterm.VT.CC1[''] = hterm.VT.ESC[']'] = function(e) {
4210 function t(e) {
4211 if (this.parseUntilStringTerminator_(e) && e.func != t) {
4212 var r = e.args[0].match(/^(\d+);(.*)$/);
4213 r ? (e.args[0] = r[2], this.dispatch('OSC', r[1], e)) : console.warn('Invalid OSC: ' + JSON.stringify(e.args[0]));
4214 }
4215 }
4216 e.resetArguments(), e.func = t;
4217};, hterm.VT.CC1['ž'] = hterm.VT.ESC['^'] = function(e) {
4218 e.resetArguments(), e.func = this.parseUntilStringTerminator_;
4219};, hterm.VT.CC1['Ÿ'] = hterm.VT.ESC._ = function(e) {
4220 e.resetArguments(), e.func = this.parseUntilStringTerminator_;
4221};, hterm.VT.ESC[' '] = function(e) {
4222 e.func = function(e) {
4223 var t = e.consumeChar();
4224 this.warnUnimplemented && console.warn('Unimplemented sequence: ESC 0x20 ' + t), e.resetParseFunction();
4225 };
4226};, hterm.VT.ESC['#'] = function(e) {
4227 e.func = function(e) {
4228 var t = e.consumeChar();
4229 '8' == t && this.terminal.fill('E'), e.resetParseFunction();
4230 };
4231};, hterm.VT.ESC['%'] = function(e) {
4232 e.func = function(e) {
4233 var t = e.consumeChar();
4234 '@' != t && 'G' != t && this.warnUnimplemented && console.warn('Unknown ESC % argument: ' + JSON.stringify(t)), e.resetParseFunction();
4235 };
4236};, hterm.VT.ESC['('] = hterm.VT.ESC[')'] = hterm.VT.ESC['*'] = hterm.VT.ESC['+'] = hterm.VT.ESC['-'] = hterm.VT.ESC['.'] = hterm.VT.ESC['/'] = function(e, t) {
4237 e.func = function(e) {
4238 var r = e.consumeChar();
4239 return '' == r ? (e.resetParseFunction(), void e.func()) : (r in hterm.VT.CharacterMap.maps ? '(' == t ? this.G0 = hterm.VT.CharacterMap.maps[r] : ')' == t || '-' == t ? this.G1 = hterm.VT.CharacterMap.maps[r] : '*' == t || '.' == t ? this.G2 = hterm.VT.CharacterMap.maps[r] : ('+' == t || '/' == t) && (this.G3 = hterm.VT.CharacterMap.maps[r]) : this.warnUnimplemented && console.log('Invalid character set for "' + t + '": ' + r), void e.resetParseFunction());
4240 };
4241};, hterm.VT.ESC[6] = hterm.VT.ignore, hterm.VT.ESC[7] = function() {
4242 this.savedState_.save();
4243};, hterm.VT.ESC[8] = function() {
4244 this.savedState_.restore();
4245};, hterm.VT.ESC[9] = hterm.VT.ignore, hterm.VT.ESC['='] = function() {
4246 this.terminal.keyboard.applicationKeypad = !0;
4247};, hterm.VT.ESC['>'] = function() {
4248 this.terminal.keyboard.applicationKeypad = !1;
4249};, hterm.VT.ESC.F = hterm.VT.ignore, hterm.VT.ESC.c = function() {
4250 this.reset(), this.terminal.reset();
4251};, hterm.VT.ESC.l = hterm.VT.ESC.m = hterm.VT.ignore, hterm.VT.ESC.n = function() {
4252 this.GL = 'G2';
4253};, hterm.VT.ESC.o = function() {
4254 this.GL = 'G3';
4255};, hterm.VT.ESC['|'] = function() {
4256 this.GR = 'G3';
4257};, hterm.VT.ESC['}'] = function() {
4258 this.GR = 'G2';
4259};, hterm.VT.ESC['~'] = function() {
4260 this.GR = 'G1';
4261};, hterm.VT.OSC[0] = function(e) {
4262 this.terminal.setWindowTitle(e.args[0]);
4263};, hterm.VT.OSC[2] = hterm.VT.OSC[0], hterm.VT.OSC[4] = function(e) {
4264 for (var t = e.args[0].split(';'), r = parseInt(t.length / 2), o = this.terminal.getTextAttributes().colorPalette, i = [], s = 0; r > s; ++s) {
4265 var n = parseInt(t[2 * s]),
4266 a = t[2 * s + 1];
4267 n >= o.length || ('?' != a ? (a = lib.colors.x11ToCSS(a), a && (o[n] = a)) : (a = lib.colors.rgbToX11(o[n]), a && i.push(n + ';' + a)));
4268 }
4269 i.length && this.terminal.io.sendString(']4;' + i.join(';') + '');
4270};, hterm.VT.OSC[50] = function(e) {
4271 var t = e.args[0].match(/CursorShape=(.)/i);
4272 if (!t) return void console.warn('Could not parse OSC 50 args: ' + e.args[0]);
4273 switch (t[1]) {
4274 case '1':
4275 this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);
4276 break;
4277 case '2':
4278 this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);
4279 break;
4280 default:
4281 this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK);
4282 }
4283};, hterm.VT.OSC[52] = function(e) {
4284 var t = e.args[0].match(/^[cps01234567]*;(.*)/);
4285 if (t) {
4286 var r = window.atob(t[1]);
4287 r && this.terminal.copyStringToClipboard(this.decode(r));
4288 }
4289};, hterm.VT.CSI['@'] = function(e) {
4290 this.terminal.insertSpace(e.iarg(0, 1));
4291};, hterm.VT.CSI.A = function(e) {
4292 this.terminal.cursorUp(e.iarg(0, 1));
4293};, hterm.VT.CSI.B = function(e) {
4294 this.terminal.cursorDown(e.iarg(0, 1));
4295};, hterm.VT.CSI.C = function(e) {
4296 this.terminal.cursorRight(e.iarg(0, 1));
4297};, hterm.VT.CSI.D = function(e) {
4298 this.terminal.cursorLeft(e.iarg(0, 1));
4299};, hterm.VT.CSI.E = function(e) {
4300 this.terminal.cursorDown(e.iarg(0, 1)), this.terminal.setCursorColumn(0);
4301};, hterm.VT.CSI.F = function(e) {
4302 this.terminal.cursorUp(e.iarg(0, 1)), this.terminal.setCursorColumn(0);
4303};, hterm.VT.CSI.G = function(e) {
4304 this.terminal.setCursorColumn(e.iarg(0, 1) - 1);
4305};, hterm.VT.CSI.H = function(e) {
4306 this.terminal.setCursorPosition(e.iarg(0, 1) - 1, e.iarg(1, 1) - 1);
4307};, hterm.VT.CSI.I = function(e) {
4308 var t = e.iarg(0, 1);
4309 t = lib.f.clamp(t, 1, this.terminal.screenSize.width);
4310 for (var r = 0; t > r; r++) this.terminal.forwardTabStop();
4311};, hterm.VT.CSI.J = hterm.VT.CSI['?J'] = function(e, t) {
4312 var r = e.args[0];
4313 r && '0' != r ? '1' == r ? this.terminal.eraseAbove() : '2' == r ? this.terminal.clear() : '3' == r && this.terminal.clear() : this.terminal.eraseBelow()
4314};, hterm.VT.CSI.K = hterm.VT.CSI['?K'] = function(e, t) {
4315 var r = e.args[0];
4316 r && '0' != r ? '1' == r ? this.terminal.eraseToLeft() : '2' == r && this.terminal.eraseLine() : this.terminal.eraseToRight();
4317};, hterm.VT.CSI.L = function(e) {
4318 this.terminal.insertLines(e.iarg(0, 1));
4319};, hterm.VT.CSI.M = function(e) {
4320 this.terminal.deleteLines(e.iarg(0, 1));
4321};, hterm.VT.CSI.P = function(e) {
4322 this.terminal.deleteChars(e.iarg(0, 1));
4323};, hterm.VT.CSI.S = function(e) {
4324 this.terminal.vtScrollUp(e.iarg(0, 1));
4325};, hterm.VT.CSI.T = function(e) {
4326 e.args.length <= 1 && this.terminal.vtScrollDown(e.iarg(0, 1));
4327};, hterm.VT.CSI['>T'] = hterm.VT.ignore, hterm.VT.CSI.X = function(e) {
4328 this.terminal.eraseToRight(e.iarg(0, 1));
4329};, hterm.VT.CSI.Z = function(e) {
4330 var t = e.iarg(0, 1);
4331 t = lib.f.clamp(t, 1, this.terminal.screenSize.width);
4332 for (var r = 0; t > r; r++) this.terminal.backwardTabStop();
4333};, hterm.VT.CSI['`'] = function(e) {
4334 this.terminal.setCursorColumn(e.iarg(0, 1) - 1);
4335};, hterm.VT.CSI.b = hterm.VT.ignore, hterm.VT.CSI.c = function(e) {
4336 e.args[0] && '0' != e.args[0] || this.terminal.io.sendString('[?1;2c');
4337};, hterm.VT.CSI['>c'] = function(e) {
4338 this.terminal.io.sendString('[>0;256;0c');
4339};, hterm.VT.CSI.d = function(e) {
4340 this.terminal.setAbsoluteCursorRow(e.iarg(0, 1) - 1);
4341};, hterm.VT.CSI.f = hterm.VT.CSI.H, hterm.VT.CSI.g = function(e) {
4342 e.args[0] && '0' != e.args[0] ? '3' == e.args[0] && this.terminal.clearAllTabStops() : this.terminal.clearTabStopAtCursor(!1);
4343};, hterm.VT.CSI.h = function(e) {
4344 for (var t = 0; t < e.args.length; t++) this.setANSIMode(e.args[t], !0);
4345};, hterm.VT.CSI['?h'] = function(e) {
4346 for (var t = 0; t < e.args.length; t++) this.setDECMode(e.args[t], !0);
4347};, hterm.VT.CSI.i = hterm.VT.CSI['?i'] = hterm.VT.ignore, hterm.VT.CSI.l = function(e) {
4348 for (var t = 0; t < e.args.length; t++) this.setANSIMode(e.args[t], !1);
4349};, hterm.VT.CSI['?l'] = function(e) {
4350 for (var t = 0; t < e.args.length; t++) this.setDECMode(e.args[t], !1);
4351};, hterm.VT.CSI.m = function(e) {
4352 function t(t) {
4353 return e.args.length < t + 2 || '5' != e.args[t + 1] ? null : e.iarg(t + 2, 0);
4354 }
4355
4356 function r(t) {
4357 if (e.args.length < t + 5 || '2' != e.args[t + 1]) return null;
4358 var r = e.iarg(t + 2, 0),
4359 o = e.iarg(t + 3, 0),
4360 i = e.iarg(t + 4, 0);
4361 return 'rgb(' + r + ' ,' + o + ' ,' + i + ')';
4362 }
4363 var o = this.terminal.getTextAttributes();
4364 if (!e.args.length) return void o.reset();
4365 for (var i = 0; i < e.args.length; i++) {
4366 var s = e.iarg(i, 0);
4367 if (30 > s) 0 == s ? o.reset() : 1 == s ? o.bold = !0 : 2 == s ? o.faint = !0 : 3 == s ? o.italic = !0 : 4 == s ? o.underline = !0 : 5 == s ? o.blink = !0 : 7 == s ? o.inverse = !0 : 8 == s ? o.invisible = !0 : 9 == s ? o.strikethrough = !0 : 22 == s ? (o.bold = !1, o.faint = !1) : 23 == s ? o.italic = !1 : 24 == s ? o.underline = !1 : 25 == s ? o.blink = !1 : 27 == s ? o.inverse = !1 : 28 == s ? o.invisible = !1 : 29 == s && (o.strikethrough = !1);
4368 else if (50 > s)
4369 if (38 > s) o.foregroundSource = s - 30;
4370 else if (38 == s) {
4371 var n = r(i);
4372 if (null != n) o.foregroundSource = o.SRC_RGB, o.foreground = n, i += 5;
4373 else {
4374 var a = t(i);
4375 if (null == a) break;
4376 if (i += 2, a >= o.colorPalette.length) continue;
4377 o.foregroundSource = a;
4378 }
4379 }
4380 else if (39 == s) o.foregroundSource = o.SRC_DEFAULT;
4381 else if (48 > s) o.backgroundSource = s - 40;
4382 else if (48 == s) {
4383 var n = r(i);
4384 if (null != n) o.backgroundSource = o.SRC_RGB, o.background = n, i += 5;
4385 else {
4386 var a = t(i);
4387 if (null == a) break;
4388 if (i += 2, a >= o.colorPalette.length) continue;
4389 o.backgroundSource = a;
4390 }
4391 }
4392 else o.backgroundSource = o.SRC_DEFAULT;
4393 else s >= 90 && 97 >= s ? o.foregroundSource = s - 90 + 8 : s >= 100 && 107 >= s && (o.backgroundSource = s - 100 + 8);
4394 }
4395 o.setDefaults(this.terminal.getForegroundColor(), this.terminal.getBackgroundColor());
4396};, hterm.VT.CSI['>m'] = hterm.VT.ignore, hterm.VT.CSI.n = function(e) {
4397 if ('5' == e.args[0]) this.terminal.io.sendString('0n');
4398 else if ('6' == e.args[0]) {
4399 var t = this.terminal.getCursorRow() + 1,
4400 r = this.terminal.getCursorColumn() + 1;
4401 this.terminal.io.sendString('[' + t + ';' + r + 'R');
4402 }
4403};, hterm.VT.CSI['>n'] = hterm.VT.ignore, hterm.VT.CSI['?n'] = function(e) {
4404 if ('6' == e.args[0]) {
4405 var t = this.terminal.getCursorRow() + 1,
4406 r = this.terminal.getCursorColumn() + 1;
4407 this.terminal.io.sendString('[' + t + ';' + r + 'R');
4408 }
4409 else '15' == e.args[0] ? this.terminal.io.sendString('[?11n') : '25' == e.args[0] ? this.terminal.io.sendString('[?21n') : '26' == e.args[0] ? this.terminal.io.sendString('[?12;1;0;0n') : '53' == e.args[0] && this.terminal.io.sendString('[?50n')
4410};, hterm.VT.CSI['>p'] = hterm.VT.ignore, hterm.VT.CSI['!p'] = function() {
4411 this.reset(), this.terminal.softReset();
4412};, hterm.VT.CSI.$p = hterm.VT.ignore, hterm.VT.CSI['?$p'] = hterm.VT.ignore, hterm.VT.CSI['"p'] = hterm.VT.ignore, hterm.VT.CSI.q = hterm.VT.ignore, hterm.VT.CSI[' q'] = function(e) {
4413 var t = e.args[0];
4414 '0' == t || '1' == t ? (this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK), this.terminal.setCursorBlink(!0)) : '2' == t ? (this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK), this.terminal.setCursorBlink(!1)) : '3' == t ? (this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE), this.terminal.setCursorBlink(!0)) : '4' == t ? (this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE), this.terminal.setCursorBlink(!1)) : console.warn('Unknown cursor style: ' + t)
4415};, hterm.VT.CSI['"q'] = hterm.VT.ignore, hterm.VT.CSI.r = function(e) {
4416 var t = e.args,
4417 r = t[0] ? parseInt(t[0], 10) - 1 : null,
4418 o = t[1] ? parseInt(t[1], 10) - 1 : null;
4419 this.terminal.setVTScrollRegion(r, o), this.terminal.setCursorPosition(0, 0);
4420};, hterm.VT.CSI['?r'] = hterm.VT.ignore, hterm.VT.CSI.$r = hterm.VT.ignore, hterm.VT.CSI.s = function() {
4421 this.savedState_.save();
4422};, hterm.VT.CSI['?s'] = hterm.VT.ignore, hterm.VT.CSI.t = hterm.VT.ignore, hterm.VT.CSI.$t = hterm.VT.ignore, hterm.VT.CSI['>t'] = hterm.VT.ignore, hterm.VT.CSI[' t'] = hterm.VT.ignore, hterm.VT.CSI.u = function() {
4423 this.savedState_.restore();
4424};, hterm.VT.CSI[' u'] = hterm.VT.ignore, hterm.VT.CSI.$v = hterm.VT.ignore, hterm.VT.CSI["'w"] = hterm.VT.ignore, hterm.VT.CSI.x = hterm.VT.ignore, hterm.VT.CSI['*x'] = hterm.VT.ignore, hterm.VT.CSI.$x = hterm.VT.ignore, hterm.VT.CSI.z = function(e) {
4425 if (!(e.args.length < 1)) {
4426 var t = e.args[0];
4427 if ('0' == t) {
4428 if (e.args.length < 2) return;
4429 this.terminal.getTextAttributes().tileData = e.args[1];
4430 }
4431 else '1' == t && (this.terminal.getTextAttributes().tileData = null);
4432 }
4433};, hterm.VT.CSI["'z"] = hterm.VT.ignore, hterm.VT.CSI.$z = hterm.VT.ignore, hterm.VT.CSI["'{"] = hterm.VT.ignore, hterm.VT.CSI["'|"] = hterm.VT.ignore, hterm.VT.CSI[' }'] = hterm.VT.ignore, hterm.VT.CSI[' ~'] = hterm.VT.ignore, lib.rtdep('lib.f'), hterm.VT.CharacterMap = function(e, t) {
4434 this.name = e, this.GL = null, this.GR = null, t && this.reset(t);
4435};, hterm.VT.CharacterMap.prototype.reset = function(e) {
4436 this.glmap = e;
4437 var t = Object.keys(this.glmap).map(function(e) {
4438 return '\\x' + lib.f.zpad(e.charCodeAt(0).toString(16));
4439 });
4440 this.glre = new RegExp('[' + t.join('') + ']', 'g'), this.grmap = {}, t.forEach(function(e) {
4441 var t = String.fromCharCode(128 & e.charCodeAt(0));
4442 this.grmap[t] = this.glmap[e];
4443 }.bind(this));
4444 var r = Object.keys(this.grmap).map(function(e) {
4445 return '\\x' + lib.f.zpad(e.charCodeAt(0).toString(16), 2);
4446 });
4447 this.grre = new RegExp('[' + r.join('') + ']', 'g'), this.GL = function(e) {
4448 return e.replace(this.glre, function(e) {
4449 return this.glmap[e];
4450 }.bind(this));
4451 }.bind(this), this.GR = function(e) {
4452 return e.replace(this.grre, function(e) {
4453 return this.grmap[e];
4454 }.bind(this));
4455 }.bind(this);
4456};, hterm.VT.CharacterMap.maps = {}, hterm.VT.CharacterMap.maps[0] = new hterm.VT.CharacterMap('graphic', {
4457 '`': '◆',
4458 a: '▒',
4459 b: '␉',
4460 c: '␌',
4461 d: '␍',
4462 e: '␊',
4463 f: '°',
4464 g: '±',
4465 h: '␤',
4466 i: '␋',
4467 j: '┘',
4468 k: '┐',
4469 l: '┌',
4470 m: '└',
4471 n: '┼',
4472 o: '⎺',
4473 p: '⎻',
4474 q: '─',
4475 r: '⎼',
4476 s: '⎽',
4477 t: '├',
4478 u: '┤',
4479 v: '┴',
4480 w: '┬',
4481 x: '│',
4482 y: '≤',
4483 z: '≥',
4484 '{': 'π',
4485 '|': '≠',
4486 '}': '£',
4487 '~': '·'
4488}), hterm.VT.CharacterMap.maps.A = new hterm.VT.CharacterMap('british', {
4489 '#': '£'
4490}), hterm.VT.CharacterMap.maps.B = new hterm.VT.CharacterMap('us', null), hterm.VT.CharacterMap.maps[4] = new hterm.VT.CharacterMap('dutch', {
4491 '#': '£',
4492 '@': '¾',
4493 '[': 'IJ',
4494 '\\': '½',
4495 ']': '|',
4496 '{': '¨',
4497 '|': 'f',
4498 '}': '¼',
4499 '~': '´'
4500}), hterm.VT.CharacterMap.maps.C = hterm.VT.CharacterMap.maps[5] = new hterm.VT.CharacterMap('finnish', {
4501 '[': 'Ä',
4502 '\\': 'Ö',
4503 ']': 'Å',
4504 '^': 'Ü',
4505 '`': 'é',
4506 '{': 'ä',
4507 '|': 'ö',
4508 '}': 'å',
4509 '~': 'ü'
4510}), hterm.VT.CharacterMap.maps.R = new hterm.VT.CharacterMap('french', {
4511 '#': '£',
4512 '@': 'à',
4513 '[': '°',
4514 '\\': 'ç',
4515 ']': '§',
4516 '{': 'é',
4517 '|': 'ù',
4518 '}': 'è',
4519 '~': '¨'
4520}), hterm.VT.CharacterMap.maps.Q = new hterm.VT.CharacterMap('french canadian', {
4521 '@': 'à',
4522 '[': 'â',
4523 '\\': 'ç',
4524 ']': 'ê',
4525 '^': 'î',
4526 '`': 'ô',
4527 '{': 'é',
4528 '|': 'ù',
4529 '}': 'è',
4530 '~': 'û'
4531}), hterm.VT.CharacterMap.maps.K = new hterm.VT.CharacterMap('german', {
4532 '@': '§',
4533 '[': 'Ä',
4534 '\\': 'Ö',
4535 ']': 'Ü',
4536 '{': 'ä',
4537 '|': 'ö',
4538 '}': 'ü',
4539 '~': 'ß'
4540}), hterm.VT.CharacterMap.maps.Y = new hterm.VT.CharacterMap('italian', {
4541 '#': '£',
4542 '@': '§',
4543 '[': '°',
4544 '\\': 'ç',
4545 ']': 'é',
4546 '`': 'ù',
4547 '{': 'à',
4548 '|': 'ò',
4549 '}': 'è',
4550 '~': 'ì'
4551}), hterm.VT.CharacterMap.maps.E = hterm.VT.CharacterMap.maps[6] = new hterm.VT.CharacterMap('norwegian/danish', {
4552 '@': 'Ä',
4553 '[': 'Æ',
4554 '\\': 'Ø',
4555 ']': 'Å',
4556 '^': 'Ü',
4557 '`': 'ä',
4558 '{': 'æ',
4559 '|': 'ø',
4560 '}': 'å',
4561 '~': 'ü'
4562}), hterm.VT.CharacterMap.maps.Z = new hterm.VT.CharacterMap('spanish', {
4563 '#': '£',
4564 '@': '§',
4565 '[': '¡',
4566 '\\': 'Ñ',
4567 ']': '¿',
4568 '{': '°',
4569 '|': 'ñ',
4570 '}': 'ç'
4571}), hterm.VT.CharacterMap.maps[7] = hterm.VT.CharacterMap.maps.H = new hterm.VT.CharacterMap('swedish', {
4572 '@': 'É',
4573 '[': 'Ä',
4574 '\\': 'Ö',
4575 ']': 'Å',
4576 '^': 'Ü',
4577 '`': 'é',
4578 '{': 'ä',
4579 '|': 'ö',
4580 '}': 'å',
4581 '~': 'ü'
4582}), hterm.VT.CharacterMap.maps['='] = new hterm.VT.CharacterMap('swiss', {
4583 '#': 'ù',
4584 '@': 'à',
4585 '[': 'é',
4586 '\\': 'ç',
4587 ']': 'ê',
4588 '^': 'î',
4589 _: 'è',
4590 '`': 'ô',
4591 '{': 'ä',
4592 '|': 'ö',
4593 '}': 'ü',
4594 '~': 'û'
4595}), lib.resource.add('hterm/audio/bell', 'audio/ogg;base64', 'T2dnUwACAAAAAAAAAADhqW5KAAAAAMFvEjYBHgF2b3JiaXMAAAAAAYC7AAAAAAAAAHcBAAAAAAC4AU9nZ1MAAAAAAAAAAAAA4aluSgEAAAAAesI3EC3//////////////////8kDdm9yYmlzHQAAAFhpcGguT3JnIGxpYlZvcmJpcyBJIDIwMDkwNzA5AAAAAAEFdm9yYmlzKUJDVgEACAAAADFMIMWA0JBVAAAQAABgJCkOk2ZJKaWUoSh5mJRISSmllMUwiZiUicUYY4wxxhhjjDHGGGOMIDRkFQAABACAKAmOo+ZJas45ZxgnjnKgOWlOOKcgB4pR4DkJwvUmY26mtKZrbs4pJQgNWQUAAAIAQEghhRRSSCGFFGKIIYYYYoghhxxyyCGnnHIKKqigggoyyCCDTDLppJNOOumoo4466ii00EILLbTSSkwx1VZjrr0GXXxzzjnnnHPOOeecc84JQkNWAQAgAAAEQgYZZBBCCCGFFFKIKaaYcgoyyIDQkFUAACAAgAAAAABHkRRJsRTLsRzN0SRP8ixREzXRM0VTVE1VVVVVdV1XdmXXdnXXdn1ZmIVbuH1ZuIVb2IVd94VhGIZhGIZhGIZh+H3f933f930gNGQVACABAKAjOZbjKaIiGqLiOaIDhIasAgBkAAAEACAJkiIpkqNJpmZqrmmbtmirtm3LsizLsgyEhqwCAAABAAQAAAAAAKBpmqZpmqZpmqZpmqZpmqZpmqZpmmZZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZlmVZQGjIKgBAAgBAx3Ecx3EkRVIkx3IsBwgNWQUAyAAACABAUizFcjRHczTHczzHczxHdETJlEzN9EwPCA1ZBQAAAgAIAAAAAABAMRzFcRzJ0SRPUi3TcjVXcz3Xc03XdV1XVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVYHQkFUAAAQAACGdZpZqgAgzkGEgNGQVAIAAAAAYoQhDDAgNWQUAAAQAAIih5CCa0JrzzTkOmuWgqRSb08GJVJsnuamYm3POOeecbM4Z45xzzinKmcWgmdCac85JDJqloJnQmnPOeRKbB62p0ppzzhnnnA7GGWGcc85p0poHqdlYm3POWdCa5qi5FJtzzomUmye1uVSbc84555xzzjnnnHPOqV6czsE54Zxzzonam2u5CV2cc875ZJzuzQnhnHPOOeecc84555xzzglCQ1YBAEAAAARh2BjGnYIgfY4GYhQhpiGTHnSPDpOgMcgppB6NjkZKqYNQUhknpXSC0JBVAAAgAACEEFJIIYUUUkghhRRSSCGGGGKIIaeccgoqqKSSiirKKLPMMssss8wyy6zDzjrrsMMQQwwxtNJKLDXVVmONteaec645SGultdZaK6WUUkoppSA0ZBUAAAIAQCBkkEEGGYUUUkghhphyyimnoIIKCA1ZBQAAAgAIAAAA8CTPER3RER3RER3RER3RER3P8RxREiVREiXRMi1TMz1VVFVXdm1Zl3Xbt4Vd2HXf133f141fF4ZlWZZlWZZlWZZlWZZlWZZlCUJDVgEAIAAAAEIIIYQUUkghhZRijDHHnINOQgmB0JBVAAAgAIAAAAAAR3EUx5EcyZEkS7IkTdIszfI0T/M00RNFUTRNUxVd0RV10xZlUzZd0zVl01Vl1XZl2bZlW7d9WbZ93/d93/d93/d93/d939d1IDRkFQAgAQCgIzmSIimSIjmO40iSBISGrAIAZAAABACgKI7iOI4jSZIkWZImeZZniZqpmZ7pqaIKhIasAgAAAQAEAAAAAACgaIqnmIqniIrniI4oiZZpiZqquaJsyq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7rukBoyCoAQAIAQEdyJEdyJEVSJEVyJAcIDVkFAMgAAAgAwDEcQ1Ikx7IsTfM0T/M00RM90TM9VXRFFwgNWQUAAAIACAAAAAAAwJAMS7EczdEkUVIt1VI11VItVVQ9VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV1TRN0zSB0JCVAAAZAAAjQQYZhBCKcpBCbj1YCDHmJAWhOQahxBiEpxAzDDkNInSQQSc9uJI5wwzz4FIoFURMg40lN44gDcKmXEnlOAhCQ1YEAFEAAIAxyDHEGHLOScmgRM4xCZ2UyDknpZPSSSktlhgzKSWmEmPjnKPSScmklBhLip2kEmOJrQAAgAAHAIAAC6HQkBUBQBQAAGIMUgophZRSzinmkFLKMeUcUko5p5xTzjkIHYTKMQadgxAppRxTzinHHITMQeWcg9BBKAAAIMABACDAQig0ZEUAECcA4HAkz5M0SxQlSxNFzxRl1xNN15U0zTQ1UVRVyxNV1VRV2xZNVbYlTRNNTfRUVRNFVRVV05ZNVbVtzzRl2VRV3RZV1bZl2xZ+V5Z13zNNWRZV1dZNVbV115Z9X9ZtXZg0zTQ1UVRVTRRV1VRV2zZV17Y1UXRVUVVlWVRVWXZlWfdVV9Z9SxRV1VNN2RVVVbZV2fVtVZZ94XRVXVdl2fdVWRZ+W9eF4fZ94RhV1dZN19V1VZZ9YdZlYbd13yhpmmlqoqiqmiiqqqmqtm2qrq1bouiqoqrKsmeqrqzKsq+rrmzrmiiqrqiqsiyqqiyrsqz7qizrtqiquq3KsrCbrqvrtu8LwyzrunCqrq6rsuz7qizruq3rxnHrujB8pinLpqvquqm6um7runHMtm0co6rqvirLwrDKsu/rui+0dSFRVXXdlF3jV2VZ921fd55b94WybTu/rfvKceu60vg5z28cubZtHLNuG7+t+8bzKz9hOI6lZ5q2baqqrZuqq+uybivDrOtCUVV9XZVl3zddWRdu3zeOW9eNoqrquirLvrDKsjHcxm8cuzAcXds2jlvXnbKtC31jyPcJz2vbxnH7OuP2daOvDAnHjwAAgAEHAIAAE8pAoSErAoA4AQAGIecUUxAqxSB0EFLqIKRUMQYhc05KxRyUUEpqIZTUKsYgVI5JyJyTEkpoKZTSUgehpVBKa6GU1lJrsabUYu0gpBZKaS2U0lpqqcbUWowRYxAy56RkzkkJpbQWSmktc05K56CkDkJKpaQUS0otVsxJyaCj0kFIqaQSU0mptVBKa6WkFktKMbYUW24x1hxKaS2kEltJKcYUU20txpojxiBkzknJnJMSSmktlNJa5ZiUDkJKmYOSSkqtlZJSzJyT0kFIqYOOSkkptpJKTKGU1kpKsYVSWmwx1pxSbDWU0lpJKcaSSmwtxlpbTLV1EFoLpbQWSmmttVZraq3GUEprJaUYS0qxtRZrbjHmGkppraQSW0mpxRZbji3GmlNrNabWam4x5hpbbT3WmnNKrdbUUo0txppjbb3VmnvvIKQWSmktlNJiai3G1mKtoZTWSiqxlZJabDHm2lqMOZTSYkmpxZJSjC3GmltsuaaWamwx5ppSi7Xm2nNsNfbUWqwtxppTS7XWWnOPufVWAADAgAMAQIAJZaDQkJUAQBQAAEGIUs5JaRByzDkqCULMOSepckxCKSlVzEEIJbXOOSkpxdY5CCWlFksqLcVWaykptRZrLQAAoMABACDABk2JxQEKDVkJAEQBACDGIMQYhAYZpRiD0BikFGMQIqUYc05KpRRjzknJGHMOQioZY85BKCmEUEoqKYUQSkklpQIAAAocAAACbNCUWByg0JAVAUAUAABgDGIMMYYgdFQyKhGETEonqYEQWgutddZSa6XFzFpqrbTYQAithdYySyXG1FpmrcSYWisAAOzAAQDswEIoNGQlAJAHAEAYoxRjzjlnEGLMOegcNAgx5hyEDirGnIMOQggVY85BCCGEzDkIIYQQQuYchBBCCKGDEEIIpZTSQQghhFJK6SCEEEIppXQQQgihlFIKAAAqcAAACLBRZHOCkaBCQ1YCAHkAAIAxSjkHoZRGKcYglJJSoxRjEEpJqXIMQikpxVY5B6GUlFrsIJTSWmw1dhBKaS3GWkNKrcVYa64hpdZirDXX1FqMteaaa0otxlprzbkAANwFBwCwAxtFNicYCSo0ZCUAkAcAgCCkFGOMMYYUYoox55xDCCnFmHPOKaYYc84555RijDnnnHOMMeecc845xphzzjnnHHPOOeecc44555xzzjnnnHPOOeecc84555xzzgkAACpwAAAIsFFkc4KRoEJDVgIAqQAAABFWYowxxhgbCDHGGGOMMUYSYowxxhhjbDHGGGOMMcaYYowxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGFtrrbXWWmuttdZaa6211lprrQBAvwoHAP8HG1ZHOCkaCyw0ZCUAEA4AABjDmHOOOQYdhIYp6KSEDkIIoUNKOSglhFBKKSlzTkpKpaSUWkqZc1JSKiWlllLqIKTUWkottdZaByWl1lJqrbXWOgiltNRaa6212EFIKaXWWostxlBKSq212GKMNYZSUmqtxdhirDGk0lJsLcYYY6yhlNZaazHGGGstKbXWYoy1xlprSam11mKLNdZaCwDgbnAAgEiwcYaVpLPC0eBCQ1YCACEBAARCjDnnnHMQQgghUoox56CDEEIIIURKMeYcdBBCCCGEjDHnoIMQQgghhJAx5hx0EEIIIYQQOucchBBCCKGEUkrnHHQQQgghlFBC6SCEEEIIoYRSSikdhBBCKKGEUkopJYQQQgmllFJKKaWEEEIIoYQSSimllBBCCKWUUkoppZQSQgghlFJKKaWUUkIIoZRQSimllFJKCCGEUkoppZRSSgkhhFBKKaWUUkopIYQSSimllFJKKaUAAIADBwCAACPoJKPKImw04cIDUGjISgCADAAAcdhq6ynWyCDFnISWS4SQchBiLhFSijlHsWVIGcUY1ZQxpRRTUmvonGKMUU+dY0oxw6yUVkookYLScqy1dswBAAAgCAAwECEzgUABFBjIAIADhAQpAKCwwNAxXAQE5BIyCgwKx4Rz0mkDABCEyAyRiFgMEhOqgaJiOgBYXGDIB4AMjY20iwvoMsAFXdx1IIQgBCGIxQEUkICDE2544g1PuMEJOkWlDgIAAAAA4AAAHgAAkg0gIiKaOY4Ojw+QEJERkhKTE5QAAAAAALABgA8AgCQFiIiIZo6jw+MDJERkhKTE5AQlAAAAAAAAAAAACAgIAAAAAAAEAAAACAhPZ2dTAAQYOwAAAAAAAOGpbkoCAAAAmc74DRgyNjM69TAzOTk74dnLubewsbagmZiNp4d0KbsExSY/I3XUTwJgkeZdn1HY4zoj33/q9DFtv3Ui1/jmx7lCUtPt18/sYf9MkgAsAGRBd3gMGP4sU+qCPYBy9VrA3YqJosW3W2/ef1iO/u3cg8ZG/57jU+pPmbGEJUgkfnaI39DbPqxddZphbMRmCc5rKlkUMkyx8iIoug5dJv1OYH9a59c+3Gevqc7Z2XFdDjL/qHztRfjWEWxJ/aiGezjohu9HsCZdQBKbiH0VtU/3m85lDG2T/+xkZcYnX+E+aqzv/xTgOoTFG+x7SNqQ4N+oAABSxuVXw77Jd5bmmTmuJakX7509HH0kGYKvARPpwfOSAPySPAc2EkneDwB2HwAAJlQDYK5586N79GJCjx4+p6aDUd27XSvRyXLJkIC5YZ1jLv5lpOhZTz0s+DmnF1diptrnM6UDgIW11Xh8cHTd0/SmbgOAdxcyWwMAAGIrZ3fNSfZbzKiYrK4+tPqtnMVLOeWOG2kVvUY+p2PJ/hkCl5aFRO4TLGYPZcIU3vYM1hohS4jHFlnyW/2T5J7kGsShXWT8N05V+3C/GPqJ1QdWisGPxEzHqXISBPIinWDUt7IeJv/f5OtzBxpTzZZQ+CYEhHXfqG4aABQli72GJhN4oJv+hXcApAJSErAW8G2raAX4NUcABnVt77CzZAB+LsHcVe+Q4h+QB1wh/ZrJTPxSBdI8mgTeAdTsQOoFUEng9BHcVPhxSRRYkKWZJXOFYP6V4AEripJoEjXgA2wJRZHSExmJDm8F0A6gEXsg5a4ZsALItrMB7+fh7UKLvYWSdtsDwFf1mzYzS1F82N1h2Oyt2e76B1QdS0SAsQigLPMOgJS9JRC7hFXA6kUsLFNKD5cA5cTRvgSqPc3Fl99xW3QTi/MHR8DEm6WnvaVQATwRqRKjywQ9BrrhugR2AKTsPQeQckrAOgDOhbTESyrXQ50CkNpXdtWjW7W2/3UjeX3U95gIdalfRAoAmqUEiwp53hCdcCwlg47fcbfzlmQMAgaBkh7c+fcDgF+ifwDXfzegLPcLYJsAAJQArTXjnh/uXGy3v1Hk3pV6/3t5ruW81f6prfbM2Q3WNVy98BwUtbCwhFhAWuPev6Oe/4ZaFQUcgKrVs4defzh1TADA1DEh5b3VlDaECw5b+bPfkKos3tIAue3vJZOih3ga3l6O3PSfIkrLv0PAS86PPdL7g8oc2KteNFKKzKRehOv2gJoFLBPXmaXvPBQILgJon0bbWBszrYZYYwE7jl2j+vTdU7Vpk21LiU0QajPkywAAHqbUC0/YsYOdb4e6BOp7E0cCi04Ao/TgD8ZVAMid6h/A8IeBNkp6/xsAACZELEYIk+yvI6Qz1NN6lIftB/6IMWjWJNOqPTMedAmyaj6Es0QBklJpiSWWHnQ2CoYbGWAmt+0gLQBFKCBnp2QUUQZ/1thtZDBJUpFWY82z34ocorB62oX7qB5y0oPAv/foxH25wVmgIHf2xFOr8leZcBq1Kx3ZvCq9Bga639AxuHuPNL/71YCF4EywJpqHFAX6XF0sjVbuANnvvdLcrufYwOM/iDa6iA468AYAAB6mNBMXcgTD8HSRqJ4vw8CjAlCEPACASlX/APwPOJKl9xQAAAPmnev2eWp33Xgyw3Dvfz6myGk3oyP8YTKsCOvzAgALQi0o1c6Nzs2O2Pg2h4ACIJAgAGP0aNn5x0BDgVfH7u2TtyfDcRIuYAyQhBF/lvSRAttgA6TPbWZA9gaUrZWAUEAA+Dx47Q3/r87HxUUqZmB0BmUuMlojFjHt1gDunnvuX8MImsjSq5WkzSzGS62OEIlOufWWezxWpv6FBgDgJVltfXFYtNAAnqU0xQoD0YLiXo5cF5QV4CnY1tBLAkZCOABAhbk/AM+/AwSCCdlWAAAMcFjS7owb8GVDzveDiZvznbt2tF4bL5odN1YKl88TAEABCZvufq9YCTBtMwVAQUEAwGtNltzSaHvADYC3TxLVjqiRA+OZAMhzcqEgRcAOwoCgvdTxsTHLQEF6+oOb2+PAI8ciPQcXg7pOY+LjxQSv2fjmFuj34gGwz310/bGK6z3xgT887eomWULEaDd04wHetYxdjcgV2SxvSwn0VoZXJRqkRC5ASQ/muVoAUsX7AgAQMBNaVwAAlABRxT/1PmfqLqSRNDbhXb07berpB3b94jpuWEZjBCD2OcdXFpCKEgCDfcFPMw8AAADUwT4lnUm50lmwrpMMhPQIKj6u0E8fr2vGBngMNdIlrZsigjahljud6AFVg+tzXwUnXL3TJLpajaWKA4VAAAAMiFfqJgKAZ08XrtS3dxtQNYcpPvYEG8ClvrQRJgBephwnNWJjtGqmp6VEPSvBe7EBiU3qgJbQAwD4Le8LAMDMhHbNAAAlgK+tFs5O+YyJc9yCnJa3rxLPulGnxwsXV9Fsk2k4PisCAHC8FkwbGE9gJQAAoMnyksj0CdFMZLLgoz8M+FxziwYBgIx+zHiCBAKAlBKNpF1sO9JpVcyEi9ar15YlHgrut5fPJnkdJ6vEwZPyAHQBIEDUrlMcBAAd2KAS0Qq+JwRsE4AJZtMnAD6GnOYwYlOIZvtzUNdjreB7fiMkWI0CmBB6AIAKc38A9osEFlTSGECB+cbeRDC0aRpLHqNPplcK/76Lxn2rpmqyXsYJWRi/FQAAAKBQk9MCAOibrQBQADCDsqpooPutd+05Ce9g6iEdiYXgVmQAI4+4wskEBEiBloNQ6Ki0/KTQ0QjWfjxzi+AeuXKoMjEVfQOZzr0y941qLgM2AExvbZOqcxZ6J6krlrj4y2j9AdgKDx6GnJsVLhbc42uq584+ouSdNBpoCiCVHrz+WzUA/DDtD8ATgA3h0lMCAAzcFv+S+fSSNkeYWlTpb34mf2RfmqqJeMeklhHAfu7VoAEACgAApKRktL+KkQDWMwYCUAAAAHCKsp80xhp91UjqQBw3x45cetqkjQEyu3G9B6N+R650Uq8OVig7wOm6Wun0ea4lKDPoabJs6aLqgbhPzpv4KR4iODilw88ZpY7q1IOMcbASAOAVtmcCnobcrkG4KGS7/ZnskVWRNF9J0RUHKOnByy9WA8Dv6L4AAARMCQUA4GritfVM2lcZfH3Q3T/vZ47J2YHhcmBazjfdyuV25gLAzrc0cwAAAAAYCh6PdwAAAGyWjFW4yScjaWa2mGcofHxWxewKALglWBpLUvwwk+UOh5eNGyUOs1/EF+pZr+ud5OzoGwYdAABg2p52LiSgAY/ZVlOmilEgHn6G3OcwYjzI7vOj1t6xsx4S3lBY96EUQBF6AIBAmPYH4PoGYCoJAADWe+OZJZi7/x76/yH7Lzf9M5XzRKnFPmveMsilQHwVAAAAAKB3LQD8PCIAAADga0QujBLywzeJ4a6Z/ERVBAUlAEDqvoM7BQBAuAguzFqILtmjH3Kd4wfKobnOhA3z85qWoRPm9hwoOHoDAAlCbwDAA56FHAuXflHo3fe2ttG9XUDeA9YmYCBQ0oPr/1QC8IvuCwAAApbUAQCK22MmE3O78VAbHQT9PIPNoT9zNc3l2Oe7TAVLANBufT8MAQAAAGzT4PS8AQAAoELGHb2uaCwwEv1EWhFriUkbAaAZ27/fVZnTZXbWz3BwWpjUaMZKRj7dZ0J//gUeTdpVEwAAZOFsNxKAjQSgA+ABPoY8Jj5y2wje81jsXc/1TOQWTDYZBmAkNDiqVwuA2NJ9AQAAEBKAt9Vrsfs/2N19MO91S9rd8EHTZHnzC5MYmfQEACy/FBcAAADA5c4gi4z8RANs/m6FNXVo9DV46JG1BBDukqlw/Va5G7QbuGVSI+2aZaoLXJrdVj2zlC9Z5QEAEFz/5QzgVZwAAAAA/oXcxyC6WfTu+09Ve/c766J4VTAGUFmA51+VANKi/QPoPwYgYAkA715OH4S0s5KDHvj99MMq8TPFc3roKZnGOoT1bmIhVgc7XAMBAAAAAMAW1VbQw3gapzOpJd+Kd2fc4iSO62fJv9+movui1wUNPAj059N3OVxzk4gV73PmE8FIA2F5mRq37Evc76vLXfF4rD5UJJAw46hW6LZCb5sNLdx+kzMCAAB+hfy95+965ZCLP7B3/VlTHCvDEKtQhTm4KiCgAEAbrfbWTPssAAAAXpee1tVrozYYn41wD1aeYtkKfswN5/SXPO0JDnhO/4laUortv/s412fybe/nONdncoCHnBVliu0CQGBWlPY/5Kwom2L/kruPM6Q7oz4tvDQy+bZ3HzOi+gNHA4DZEgA='), lib.resource.add('hterm/concat/date', 'text/plain', 'Tue, 25 Apr 2017 15:12:45 +0000'), lib.resource.add('hterm/changelog/version', 'text/plain', '1.62'), lib.resource.add('hterm/changelog/date', 'text/plain', '2017-04-17'), lib.resource.add('hterm/git/HEAD', 'text/plain', 'git rev-parse HEAD');