text: "use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function handler(e){return e.returnValue="Are you sure?",e.returnValue}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};if(void 0!==lib)throw new Error('Global "lib" object already exists.');var lib={};lib.runtimeDependencies_={},lib.initCallbacks_=[],lib.rtdep=function(e){var t;try{throw new Error}catch(e){var r=e.stack.split("\n");t=r.length>=3?r[2].replace(/^\s*at\s+/,""):r[1].replace(/^\s*global code@/,"")}for(var o=0;o<arguments.length;o++){var i=arguments[o];if(i instanceof Array)lib.rtdep.apply(lib,i);else{var s=this.runtimeDependencies_[i];s||(s=this.runtimeDependencies_[i]=[]),s.push(t)}}},lib.ensureRuntimeDependencies_=function(){var e=!0;for(var t in lib.runtimeDependencies_)for(var r=lib.runtimeDependencies_[t],o=t.split("."),i=window||self,s=0;s<o.length;s++){if(!(o[s]in i)){console.warn('Missing "'+t+'" is needed by',r),e=!1;break}i=i[o[s]]}if(!e)throw new Error("Failed runtime dependency check")},lib.registerInit=function(e,t){return lib.initCallbacks_.push([e,t]),t},lib.init=function(e,t){var r=lib.initCallbacks_;if("function"!=typeof e)throw new Error("Missing or invalid argument: onInit");lib.ensureRuntimeDependencies_(),setTimeout(function o(){if(r.length){var i=r.shift();t&&t("init: "+i[0]),i[1](lib.f.alarm(o))}else e()},0)},lib.colors={},lib.colors.re_={hex16:/#([a-f0-9])([a-f0-9])([a-f0-9])/i,hex24:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,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"),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"),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"),x11rgb:/^\s*rgb:([a-f0-9]{1,4})\/([a-f0-9]{1,4})\/([a-f0-9]{1,4})\s*$/i,name:/[a-z][a-z0-9\s]+/},lib.colors.rgbToX11=function(e){function t(e){for(e=(257*Math.min(e,255)).toString(16);e.length<4;)e="0"+e;return e}var r=e.match(lib.colors.re_.rgbx);return r?"rgb:"+t(r[1])+"/"+t(r[2])+"/"+t(r[3]):null},lib.colors.x11ToCSS=function(e){var t=e.match(lib.colors.re_.x11rgb);return t?(t.splice(0,1),lib.colors.arrayToRGBA(t.map(function(e){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))}))):lib.colors.nameToRGB(e)},lib.colors.hexToRGB=function(e){function t(e){var t=4==e.length?lib.colors.re_.hex16:lib.colors.re_.hex24,r=e.match(t);return r?"rgb("+parseInt(r[1],16)+", "+parseInt(r[2],16)+", "+parseInt(r[3],16)+")":null}if(e instanceof Array)for(var r=0;r<e.length;r++)e[r]=t(e[r]);else e=t(e);return e},lib.colors.rgbToHex=function(e){function t(e){var t=lib.colors.crackRGB(e);return"#"+lib.f.zpad((parseInt(t[0])<<16|parseInt(t[1])<<8|parseInt(t[2])<<0).toString(16),6)}if(e instanceof Array)for(var r=0;r<e.length;r++)e[r]=t(e[r]);else e=t(e);return e},lib.colors.normalizeCSS=function(e){return"#"==e.substr(0,1)?lib.colors.hexToRGB(e):lib.colors.re_.rgbx.test(e)?e:lib.colors.nameToRGB(e)},lib.colors.arrayToRGBA=function(e){var t=e.length>3?e[3]:1;return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+t+")"},lib.colors.setAlpha=function(e,t){var r=lib.colors.crackRGB(e);return r[3]=t,lib.colors.arrayToRGBA(r)},lib.colors.mix=function(e,t,r){for(var o=lib.colors.crackRGB(e),i=lib.colors.crackRGB(t),s=0;s<4;++s){var n=i[s]-o[s];o[s]=Math.round(parseInt(o[s])+n*r)}return lib.colors.arrayToRGBA(o)},lib.colors.crackRGB=function(e){if("rgba"==e.substr(0,4)){if(t=e.match(lib.colors.re_.rgba))return t.shift(),t}else{var t=e.match(lib.colors.re_.rgb);if(t)return t.shift(),t.push(1),t}return console.error("Couldn't crack: "+e),null},lib.colors.nameToRGB=function(e){return e in lib.colors.colorNames?lib.colors.colorNames[e]:(e=e.toLowerCase())in lib.colors.colorNames?lib.colors.colorNames[e]:(e=e.replace(/\s+/g,""))in lib.colors.colorNames?lib.colors.colorNames[e]:null},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={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",antiquewhite1:"rgb(255, 239, 219)",antiquewhite2:"rgb(238, 223, 204)",antiquewhite3:"rgb(205, 192, 176)",antiquewhite4:"rgb(139, 131, 120)",aquamarine:"rgb(127, 255, 212)",aquamarine1:"rgb(127, 255, 212)",aquamarine2:"rgb(118, 238, 198)",aquamarine3:"rgb(102, 205, 170)",aquamarine4:"rgb(69, 139, 116)",azure:"rgb(240, 255, 255)",azure1:"rgb(240, 255, 255)",azure2:"rgb(224, 238, 238)",azure3:"rgb(193, 205, 205)",azure4:"rgb(131, 139, 139)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",bisque1:"rgb(255, 228, 196)",bisque2:"rgb(238, 213, 183)",bisque3:"rgb(205, 183, 158)",bisque4:"rgb(139, 125, 107)",black:"rgb(0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb(0, 0, 255)",blue1:"rgb(0, 0, 255)",blue2:"rgb(0, 0, 238)",blue3:"rgb(0, 0, 205)",blue4:"rgb(0, 0, 139)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",brown1:"rgb(255, 64, 64)",brown2:"rgb(238, 59, 59)",brown3:"rgb(205, 51, 51)",brown4:"rgb(139, 35, 35)",burlywood:"rgb(222, 184, 135)",burlywood1:"rgb(255, 211, 155)",burlywood2:"rgb(238, 197, 145)",burlywood3:"rgb(205, 170, 125)",burlywood4:"rgb(139, 115, 85)",cadetblue:"rgb(95, 158, 160)",cadetblue1:"rgb(152, 245, 255)",cadetblue2:"rgb(142, 229, 238)",cadetblue3:"rgb(122, 197, 205)",cadetblue4:"rgb(83, 134, 139)",chartreuse:"rgb(127, 255, 0)",chartreuse1:"rgb(127, 255, 0)",chartreuse2:"rgb(118, 238, 0)",chartreuse3:"rgb(102, 205, 0)",chartreuse4:"rgb(69, 139, 0)",chocolate:"rgb(210, 105, 30)",chocolate1:"rgb(255, 127, 36)",chocolate2:"rgb(238, 118, 33)",chocolate3:"rgb(205, 102, 29)",chocolate4:"rgb(139, 69, 19)",coral:"rgb(255, 127, 80)",coral1:"rgb(255, 114, 86)",coral2:"rgb(238, 106, 80)",coral3:"rgb(205, 91, 69)",coral4:"rgb(139, 62, 47)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",cornsilk1:"rgb(255, 248, 220)",cornsilk2:"rgb(238, 232, 205)",cornsilk3:"rgb(205, 200, 177)",cornsilk4:"rgb(139, 136, 120)",cyan:"rgb(0, 255, 255)",cyan1:"rgb(0, 255, 255)",cyan2:"rgb(0, 238, 238)",cyan3:"rgb(0, 205, 205)",cyan4:"rgb(0, 139, 139)",darkblue:"rgb(0, 0, 139)",darkcyan:"rgb(0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgoldenrod1:"rgb(255, 185, 15)",darkgoldenrod2:"rgb(238, 173, 14)",darkgoldenrod3:"rgb(205, 149, 12)",darkgoldenrod4:"rgb(139, 101, 8)",darkgray:"rgb(169, 169, 169)",darkgreen:"rgb(0, 100, 0)",darkgrey:"rgb(169, 169, 169)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb(85, 107, 47)",darkolivegreen1:"rgb(202, 255, 112)",darkolivegreen2:"rgb(188, 238, 104)",darkolivegreen3:"rgb(162, 205, 90)",darkolivegreen4:"rgb(110, 139, 61)",darkorange:"rgb(255, 140, 0)",darkorange1:"rgb(255, 127, 0)",darkorange2:"rgb(238, 118, 0)",darkorange3:"rgb(205, 102, 0)",darkorange4:"rgb(139, 69, 0)",darkorchid:"rgb(153, 50, 204)",darkorchid1:"rgb(191, 62, 255)",darkorchid2:"rgb(178, 58, 238)",darkorchid3:"rgb(154, 50, 205)",darkorchid4:"rgb(104, 34, 139)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkseagreen1:"rgb(193, 255, 193)",darkseagreen2:"rgb(180, 238, 180)",darkseagreen3:"rgb(155, 205, 155)",darkseagreen4:"rgb(105, 139, 105)",darkslateblue:"rgb(72, 61, 139)",darkslategray:"rgb(47, 79, 79)",darkslategray1:"rgb(151, 255, 255)",darkslategray2:"rgb(141, 238, 238)",darkslategray3:"rgb(121, 205, 205)",darkslategray4:"rgb(82, 139, 139)",darkslategrey:"rgb(47, 79, 79)",darkturquoise:"rgb(0, 206, 209)",darkviolet:"rgb(148, 0, 211)",debianred:"rgb(215, 7, 81)",deeppink:"rgb(255, 20, 147)",deeppink1:"rgb(255, 20, 147)",deeppink2:"rgb(238, 18, 137)",deeppink3:"rgb(205, 16, 118)",deeppink4:"rgb(139, 10, 80)",deepskyblue:"rgb(0, 191, 255)",deepskyblue1:"rgb(0, 191, 255)",deepskyblue2:"rgb(0, 178, 238)",deepskyblue3:"rgb(0, 154, 205)",deepskyblue4:"rgb(0, 104, 139)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb(30, 144, 255)",dodgerblue1:"rgb(30, 144, 255)",dodgerblue2:"rgb(28, 134, 238)",dodgerblue3:"rgb(24, 116, 205)",dodgerblue4:"rgb(16, 78, 139)",firebrick:"rgb(178, 34, 34)",firebrick1:"rgb(255, 48, 48)",firebrick2:"rgb(238, 44, 44)",firebrick3:"rgb(205, 38, 38)",firebrick4:"rgb(139, 26, 26)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb(34, 139, 34)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",gold1:"rgb(255, 215, 0)",gold2:"rgb(238, 201, 0)",gold3:"rgb(205, 173, 0)",gold4:"rgb(139, 117, 0)",goldenrod:"rgb(218, 165, 32)",goldenrod1:"rgb(255, 193, 37)",goldenrod2:"rgb(238, 180, 34)",goldenrod3:"rgb(205, 155, 29)",goldenrod4:"rgb(139, 105, 20)",gray:"rgb(190, 190, 190)",gray0:"rgb(0, 0, 0)",gray1:"rgb(3, 3, 3)",gray10:"rgb(26, 26, 26)",gray100:"rgb(255, 255, 255)",gray11:"rgb(28, 28, 28)",gray12:"rgb(31, 31, 31)",gray13:"rgb(33, 33, 33)",gray14:"rgb(36, 36, 36)",gray15:"rgb(38, 38, 38)",gray16:"rgb(41, 41, 41)",gray17:"rgb(43, 43, 43)",gray18:"rgb(46, 46, 46)",gray19:"rgb(48, 48, 48)",gray2:"rgb(5, 5, 5)",gray20:"rgb(51, 51, 51)",gray21:"rgb(54, 54, 54)",gray22:"rgb(56, 56, 56)",gray23:"rgb(59, 59, 59)",gray24:"rgb(61, 61, 61)",gray25:"rgb(64, 64, 64)",gray26:"rgb(66, 66, 66)",gray27:"rgb(69, 69, 69)",gray28:"rgb(71, 71, 71)",gray29:"rgb(74, 74, 74)",gray3:"rgb(8, 8, 8)",gray30:"rgb(77, 77, 77)",gray31:"rgb(79, 79, 79)",gray32:"rgb(82, 82, 82)",gray33:"rgb(84, 84, 84)",gray34:"rgb(87, 87, 87)",gray35:"rgb(89, 89, 89)",gray36:"rgb(92, 92, 92)",gray37:"rgb(94, 94, 94)",gray38:"rgb(97, 97, 97)",gray39:"rgb(99, 99, 99)",gray4:"rgb(10, 10, 10)",gray40:"rgb(102, 102, 102)",gray41:"rgb(105, 105, 105)",gray42:"rgb(107, 107, 107)",gray43:"rgb(110, 110, 110)",gray44:"rgb(112, 112, 112)",gray45:"rgb(115, 115, 115)",gray46:"rgb(117, 117, 117)",gray47:"rgb(120, 120, 120)",gray48:"rgb(122, 122, 122)",gray49:"rgb(125, 125, 125)",gray5:"rgb(13, 13, 13)",gray50:"rgb(127, 127, 127)",gray51:"rgb(130, 130, 130)",gray52:"rgb(133, 133, 133)",gray53:"rgb(135, 135, 135)",gray54:"rgb(138, 138, 138)",gray55:"rgb(140, 140, 140)",gray56:"rgb(143, 143, 143)",gray57:"rgb(145, 145, 145)",gray58:"rgb(148, 148, 148)",gray59:"rgb(150, 150, 150)",gray6:"rgb(15, 15, 15)",gray60:"rgb(153, 153, 153)",gray61:"rgb(156, 156, 156)",gray62:"rgb(158, 158, 158)",gray63:"rgb(161, 161, 161)",gray64:"rgb(163, 163, 163)",gray65:"rgb(166, 166, 166)",gray66:"rgb(168, 168, 168)",gray67:"rgb(171, 171, 171)",gray68:"rgb(173, 173, 173)",gray69:"rgb(176, 176, 176)",gray7:"rgb(18, 18, 18)",gray70:"rgb(179, 179, 179)",gray71:"rgb(181, 181, 181)",gray72:"rgb(184, 184, 184)",gray73:"rgb(186, 186, 186)",gray74:"rgb(189, 189, 189)",gray75:"rgb(191, 191, 191)",gray76:"rgb(194, 194, 194)",gray77:"rgb(196, 196, 196)",gray78:"rgb(199, 199, 199)",gray79:"rgb(201, 201, 201)",gray8:"rgb(20, 20, 20)",gray80:"rgb(204, 204, 204)",gray81:"rgb(207, 207, 207)",gray82:"rgb(209, 209, 209)",gray83:"rgb(212, 212, 212)",gray84:"rgb(214, 214, 214)",gray85:"rgb(217, 217, 217)",gray86:"rgb(219, 219, 219)",gray87:"rgb(222, 222, 222)",gray88:"rgb(224, 224, 224)",gray89:"rgb(227, 227, 227)",gray9:"rgb(23, 23, 23)",gray90:"rgb(229, 229, 229)",gray91:"rgb(232, 232, 232)",gray92:"rgb(235, 235, 235)",gray93:"rgb(237, 237, 237)",gray94:"rgb(240, 240, 240)",gray95:"rgb(242, 242, 242)",gray96:"rgb(245, 245, 245)",gray97:"rgb(247, 247, 247)",gray98:"rgb(250, 250, 250)",gray99:"rgb(252, 252, 252)",green:"rgb(0, 255, 0)",green1:"rgb(0, 255, 0)",green2:"rgb(0, 238, 0)",green3:"rgb(0, 205, 0)",green4:"rgb(0, 139, 0)",greenyellow:"rgb(173, 255, 47)",grey:"rgb(190, 190, 190)",grey0:"rgb(0, 0, 0)",grey1:"rgb(3, 3, 3)",grey10:"rgb(26, 26, 26)",grey100:"rgb(255, 255, 255)",grey11:"rgb(28, 28, 28)",grey12:"rgb(31, 31, 31)",grey13:"rgb(33, 33, 33)",grey14:"rgb(36, 36, 36)",grey15:"rgb(38, 38, 38)",grey16:"rgb(41, 41, 41)",grey17:"rgb(43, 43, 43)",grey18:"rgb(46, 46, 46)",grey19:"rgb(48, 48, 48)",grey2:"rgb(5, 5, 5)",grey20:"rgb(51, 51, 51)",grey21:"rgb(54, 54, 54)",grey22:"rgb(56, 56, 56)",grey23:"rgb(59, 59, 59)",grey24:"rgb(61, 61, 61)",grey25:"rgb(64, 64, 64)",grey26:"rgb(66, 66, 66)",grey27:"rgb(69, 69, 69)",grey28:"rgb(71, 71, 71)",grey29:"rgb(74, 74, 74)",grey3:"rgb(8, 8, 8)",grey30:"rgb(77, 77, 77)",grey31:"rgb(79, 79, 79)",grey32:"rgb(82, 82, 82)",grey33:"rgb(84, 84, 84)",grey34:"rgb(87, 87, 87)",grey35:"rgb(89, 89, 89)",grey36:"rgb(92, 92, 92)",grey37:"rgb(94, 94, 94)",grey38:"rgb(97, 97, 97)",grey39:"rgb(99, 99, 99)",grey4:"rgb(10, 10, 10)",grey40:"rgb(102, 102, 102)",grey41:"rgb(105, 105, 105)",grey42:"rgb(107, 107, 107)",grey43:"rgb(110, 110, 110)",grey44:"rgb(112, 112, 112)",grey45:"rgb(115, 115, 115)",grey46:"rgb(117, 117, 117)",grey47:"rgb(120, 120, 120)",grey48:"rgb(122, 122, 122)",grey49:"rgb(125, 125, 125)",grey5:"rgb(13, 13, 13)",grey50:"rgb(127, 127, 127)",grey51:"rgb(130, 130, 130)",grey52:"rgb(133, 133, 133)",grey53:"rgb(135, 135, 135)",grey54:"rgb(138, 138, 138)",grey55:"rgb(140, 140, 140)",grey56:"rgb(143, 143, 143)",grey57:"rgb(145, 145, 145)",grey58:"rgb(148, 148, 148)",grey59:"rgb(150, 150, 150)",grey6:"rgb(15, 15, 15)",grey60:"rgb(153, 153, 153)",grey61:"rgb(156, 156, 156)",grey62:"rgb(158, 158, 158)",grey63:"rgb(161, 161, 161)",grey64:"rgb(163, 163, 163)",grey65:"rgb(166, 166, 166)",grey66:"rgb(168, 168, 168)",grey67:"rgb(171, 171, 171)",grey68:"rgb(173, 173, 173)",grey69:"rgb(176, 176, 176)",grey7:"rgb(18, 18, 18)",grey70:"rgb(179, 179, 179)",grey71:"rgb(181, 181, 181)",grey72:"rgb(184, 184, 184)",grey73:"rgb(186, 186, 186)",grey74:"rgb(189, 189, 189)",grey75:"rgb(191, 191, 191)",grey76:"rgb(194, 194, 194)",grey77:"rgb(196, 196, 196)",grey78:"rgb(199, 199, 199)",grey79:"rgb(201, 201, 201)",grey8:"rgb(20, 20, 20)",grey80:"rgb(204, 204, 204)",grey81:"rgb(207, 207, 207)",grey82:"rgb(209, 209, 209)",grey83:"rgb(212, 212, 212)",grey84:"rgb(214, 214, 214)",grey85:"rgb(217, 217, 217)",grey86:"rgb(219, 219, 219)",grey87:"rgb(222, 222, 222)",grey88:"rgb(224, 224, 224)",grey89:"rgb(227, 227, 227)",grey9:"rgb(23, 23, 23)",grey90:"rgb(229, 229, 229)",grey91:"rgb(232, 232, 232)",grey92:"rgb(235, 235, 235)",grey93:"rgb(237, 237, 237)",grey94:"rgb(240, 240, 240)",grey95:"rgb(242, 242, 242)",grey96:"rgb(245, 245, 245)",grey97:"rgb(247, 247, 247)",grey98:"rgb(250, 250, 250)",grey99:"rgb(252, 252, 252)",honeydew:"rgb(240, 255, 240)",honeydew1:"rgb(240, 255, 240)",honeydew2:"rgb(224, 238, 224)",honeydew3:"rgb(193, 205, 193)",honeydew4:"rgb(131, 139, 131)",hotpink:"rgb(255, 105, 180)",hotpink1:"rgb(255, 110, 180)",hotpink2:"rgb(238, 106, 167)",hotpink3:"rgb(205, 96, 144)",hotpink4:"rgb(139, 58, 98)",indianred:"rgb(205, 92, 92)",indianred1:"rgb(255, 106, 106)",indianred2:"rgb(238, 99, 99)",indianred3:"rgb(205, 85, 85)",indianred4:"rgb(139, 58, 58)",ivory:"rgb(255, 255, 240)",ivory1:"rgb(255, 255, 240)",ivory2:"rgb(238, 238, 224)",ivory3:"rgb(205, 205, 193)",ivory4:"rgb(139, 139, 131)",khaki:"rgb(240, 230, 140)",khaki1:"rgb(255, 246, 143)",khaki2:"rgb(238, 230, 133)",khaki3:"rgb(205, 198, 115)",khaki4:"rgb(139, 134, 78)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lavenderblush1:"rgb(255, 240, 245)",lavenderblush2:"rgb(238, 224, 229)",lavenderblush3:"rgb(205, 193, 197)",lavenderblush4:"rgb(139, 131, 134)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lemonchiffon1:"rgb(255, 250, 205)",lemonchiffon2:"rgb(238, 233, 191)",lemonchiffon3:"rgb(205, 201, 165)",lemonchiffon4:"rgb(139, 137, 112)",lightblue:"rgb(173, 216, 230)",lightblue1:"rgb(191, 239, 255)",lightblue2:"rgb(178, 223, 238)",lightblue3:"rgb(154, 192, 205)",lightblue4:"rgb(104, 131, 139)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightcyan1:"rgb(224, 255, 255)",lightcyan2:"rgb(209, 238, 238)",lightcyan3:"rgb(180, 205, 205)",lightcyan4:"rgb(122, 139, 139)",lightgoldenrod:"rgb(238, 221, 130)",lightgoldenrod1:"rgb(255, 236, 139)",lightgoldenrod2:"rgb(238, 220, 130)",lightgoldenrod3:"rgb(205, 190, 112)",lightgoldenrod4:"rgb(139, 129, 76)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgray:"rgb(211, 211, 211)",lightgreen:"rgb(144, 238, 144)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightpink1:"rgb(255, 174, 185)",lightpink2:"rgb(238, 162, 173)",lightpink3:"rgb(205, 140, 149)",lightpink4:"rgb(139, 95, 101)",lightsalmon:"rgb(255, 160, 122)",lightsalmon1:"rgb(255, 160, 122)",lightsalmon2:"rgb(238, 149, 114)",lightsalmon3:"rgb(205, 129, 98)",lightsalmon4:"rgb(139, 87, 66)",lightseagreen:"rgb(32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightskyblue1:"rgb(176, 226, 255)",lightskyblue2:"rgb(164, 211, 238)",lightskyblue3:"rgb(141, 182, 205)",lightskyblue4:"rgb(96, 123, 139)",lightslateblue:"rgb(132, 112, 255)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightsteelblue1:"rgb(202, 225, 255)",lightsteelblue2:"rgb(188, 210, 238)",lightsteelblue3:"rgb(162, 181, 205)",lightsteelblue4:"rgb(110, 123, 139)",lightyellow:"rgb(255, 255, 224)",lightyellow1:"rgb(255, 255, 224)",lightyellow2:"rgb(238, 238, 209)",lightyellow3:"rgb(205, 205, 180)",lightyellow4:"rgb(139, 139, 122)",limegreen:"rgb(50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",magenta1:"rgb(255, 0, 255)",magenta2:"rgb(238, 0, 238)",magenta3:"rgb(205, 0, 205)",magenta4:"rgb(139, 0, 139)",maroon:"rgb(176, 48, 96)",maroon1:"rgb(255, 52, 179)",maroon2:"rgb(238, 48, 167)",maroon3:"rgb(205, 41, 144)",maroon4:"rgb(139, 28, 98)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb(0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumorchid1:"rgb(224, 102, 255)",mediumorchid2:"rgb(209, 95, 238)",mediumorchid3:"rgb(180, 82, 205)",mediumorchid4:"rgb(122, 55, 139)",mediumpurple:"rgb(147, 112, 219)",mediumpurple1:"rgb(171, 130, 255)",mediumpurple2:"rgb(159, 121, 238)",mediumpurple3:"rgb(137, 104, 205)",mediumpurple4:"rgb(93, 71, 139)",mediumseagreen:"rgb(60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb(0, 250, 154)",mediumturquoise:"rgb(72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb(25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",mistyrose1:"rgb(255, 228, 225)",mistyrose2:"rgb(238, 213, 210)",mistyrose3:"rgb(205, 183, 181)",mistyrose4:"rgb(139, 125, 123)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navajowhite1:"rgb(255, 222, 173)",navajowhite2:"rgb(238, 207, 161)",navajowhite3:"rgb(205, 179, 139)",navajowhite4:"rgb(139, 121, 94)",navy:"rgb(0, 0, 128)",navyblue:"rgb(0, 0, 128)",oldlace:"rgb(253, 245, 230)",olivedrab:"rgb(107, 142, 35)",olivedrab1:"rgb(192, 255, 62)",olivedrab2:"rgb(179, 238, 58)",olivedrab3:"rgb(154, 205, 50)",olivedrab4:"rgb(105, 139, 34)",orange:"rgb(255, 165, 0)",orange1:"rgb(255, 165, 0)",orange2:"rgb(238, 154, 0)",orange3:"rgb(205, 133, 0)",orange4:"rgb(139, 90, 0)",orangered:"rgb(255, 69, 0)",orangered1:"rgb(255, 69, 0)",orangered2:"rgb(238, 64, 0)",orangered3:"rgb(205, 55, 0)",orangered4:"rgb(139, 37, 0)",orchid:"rgb(218, 112, 214)",orchid1:"rgb(255, 131, 250)",orchid2:"rgb(238, 122, 233)",orchid3:"rgb(205, 105, 201)",orchid4:"rgb(139, 71, 137)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",palegreen1:"rgb(154, 255, 154)",palegreen2:"rgb(144, 238, 144)",palegreen3:"rgb(124, 205, 124)",palegreen4:"rgb(84, 139, 84)",paleturquoise:"rgb(175, 238, 238)",paleturquoise1:"rgb(187, 255, 255)",paleturquoise2:"rgb(174, 238, 238)",paleturquoise3:"rgb(150, 205, 205)",paleturquoise4:"rgb(102, 139, 139)",palevioletred:"rgb(219, 112, 147)",palevioletred1:"rgb(255, 130, 171)",palevioletred2:"rgb(238, 121, 159)",palevioletred3:"rgb(205, 104, 137)",palevioletred4:"rgb(139, 71, 93)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peachpuff1:"rgb(255, 218, 185)",peachpuff2:"rgb(238, 203, 173)",peachpuff3:"rgb(205, 175, 149)",peachpuff4:"rgb(139, 119, 101)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",pink1:"rgb(255, 181, 197)",pink2:"rgb(238, 169, 184)",pink3:"rgb(205, 145, 158)",pink4:"rgb(139, 99, 108)",plum:"rgb(221, 160, 221)",plum1:"rgb(255, 187, 255)",plum2:"rgb(238, 174, 238)",plum3:"rgb(205, 150, 205)",plum4:"rgb(139, 102, 139)",powderblue:"rgb(176, 224, 230)",purple:"rgb(160, 32, 240)",purple1:"rgb(155, 48, 255)",purple2:"rgb(145, 44, 238)",purple3:"rgb(125, 38, 205)",purple4:"rgb(85, 26, 139)",red:"rgb(255, 0, 0)",red1:"rgb(255, 0, 0)",red2:"rgb(238, 0, 0)",red3:"rgb(205, 0, 0)",red4:"rgb(139, 0, 0)",rosybrown:"rgb(188, 143, 143)",rosybrown1:"rgb(255, 193, 193)",rosybrown2:"rgb(238, 180, 180)",rosybrown3:"rgb(205, 155, 155)",rosybrown4:"rgb(139, 105, 105)",royalblue:"rgb(65, 105, 225)",royalblue1:"rgb(72, 118, 255)",royalblue2:"rgb(67, 110, 238)",royalblue3:"rgb(58, 95, 205)",royalblue4:"rgb(39, 64, 139)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",salmon1:"rgb(255, 140, 105)",salmon2:"rgb(238, 130, 98)",salmon3:"rgb(205, 112, 84)",salmon4:"rgb(139, 76, 57)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb(46, 139, 87)",seagreen1:"rgb(84, 255, 159)",seagreen2:"rgb(78, 238, 148)",seagreen3:"rgb(67, 205, 128)",seagreen4:"rgb(46, 139, 87)",seashell:"rgb(255, 245, 238)",seashell1:"rgb(255, 245, 238)",seashell2:"rgb(238, 229, 222)",seashell3:"rgb(205, 197, 191)",seashell4:"rgb(139, 134, 130)",sienna:"rgb(160, 82, 45)",sienna1:"rgb(255, 130, 71)",sienna2:"rgb(238, 121, 66)",sienna3:"rgb(205, 104, 57)",sienna4:"rgb(139, 71, 38)",skyblue:"rgb(135, 206, 235)",skyblue1:"rgb(135, 206, 255)",skyblue2:"rgb(126, 192, 238)",skyblue3:"rgb(108, 166, 205)",skyblue4:"rgb(74, 112, 139)",slateblue:"rgb(106, 90, 205)",slateblue1:"rgb(131, 111, 255)",slateblue2:"rgb(122, 103, 238)",slateblue3:"rgb(105, 89, 205)",slateblue4:"rgb(71, 60, 139)",slategray:"rgb(112, 128, 144)",slategray1:"rgb(198, 226, 255)",slategray2:"rgb(185, 211, 238)",slategray3:"rgb(159, 182, 205)",slategray4:"rgb(108, 123, 139)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",snow1:"rgb(255, 250, 250)",snow2:"rgb(238, 233, 233)",snow3:"rgb(205, 201, 201)",snow4:"rgb(139, 137, 137)",springgreen:"rgb(0, 255, 127)",springgreen1:"rgb(0, 255, 127)",springgreen2:"rgb(0, 238, 118)",springgreen3:"rgb(0, 205, 102)",springgreen4:"rgb(0, 139, 69)",steelblue:"rgb(70, 130, 180)",steelblue1:"rgb(99, 184, 255)",steelblue2:"rgb(92, 172, 238)",steelblue3:"rgb(79, 148, 205)",steelblue4:"rgb(54, 100, 139)",tan:"rgb(210, 180, 140)",tan1:"rgb(255, 165, 79)",tan2:"rgb(238, 154, 73)",tan3:"rgb(205, 133, 63)",tan4:"rgb(139, 90, 43)",thistle:"rgb(216, 191, 216)",thistle1:"rgb(255, 225, 255)",thistle2:"rgb(238, 210, 238)",thistle3:"rgb(205, 181, 205)",thistle4:"rgb(139, 123, 139)",tomato:"rgb(255, 99, 71)",tomato1:"rgb(255, 99, 71)",tomato2:"rgb(238, 92, 66)",tomato3:"rgb(205, 79, 57)",tomato4:"rgb(139, 54, 38)",turquoise:"rgb(64, 224, 208)",turquoise1:"rgb(0, 245, 255)",turquoise2:"rgb(0, 229, 238)",turquoise3:"rgb(0, 197, 205)",turquoise4:"rgb(0, 134, 139)",violet:"rgb(238, 130, 238)",violetred:"rgb(208, 32, 144)",violetred1:"rgb(255, 62, 150)",violetred2:"rgb(238, 58, 140)",violetred3:"rgb(205, 50, 120)",violetred4:"rgb(139, 34, 82)",wheat:"rgb(245, 222, 179)",wheat1:"rgb(255, 231, 186)",wheat2:"rgb(238, 216, 174)",wheat3:"rgb(205, 186, 150)",wheat4:"rgb(139, 126, 102)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellow1:"rgb(255, 255, 0)",yellow2:"rgb(238, 238, 0)",yellow3:"rgb(205, 205, 0)",yellow4:"rgb(139, 139, 0)",yellowgreen:"rgb(154, 205, 50)"},lib.f={},lib.f.replaceVars=function(e,t){return e.replace(/%([a-z]*)\(([^\)]+)\)/gi,function(e,r,o){if(void 0===t[o])throw"Unknown variable: "+o;var i=t[o];if(r in lib.f.replaceVars.functions)i=lib.f.replaceVars.functions[r](i);else if(r)throw"Unknown escape function: "+r;return i})},lib.f.replaceVars.functions={encodeURI:encodeURI,encodeURIComponent:encodeURIComponent,escapeHTML:function(e){var t={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"};return e.replace(/[<>&\"\']/g,function(e){return t[e]})}},lib.f.getAcceptLanguages=function(e){window.chrome&&chrome.i18n?chrome.i18n.getAcceptLanguages(e):setTimeout(function(){e([navigator.language.replace(/-/g,"_")])},0)},lib.f.parseQuery=function(e){"?"==e.substr(0,1)&&(e=e.substr(1));for(var t={},r=e.split("&"),o=0;o<r.length;o++){var i=r[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t},lib.f.getURL=function(e){return window.chrome&&chrome.runtime&&chrome.runtime.getURL?chrome.runtime.getURL(e):e},lib.f.clamp=function(e,t,r){return e<t?t:e>r?r:e},lib.f.lpad=function(e,t,r){for(e=String(e),r=r||" ";e.length<t;)e=r+e;return e},lib.f.zpad=function(e,t){return lib.f.lpad(e,t,"0")},lib.f.getWhitespace=function(e){if(0==e)return"";var t=this.getWhitespace;for(t.whitespace||(t.whitespace="          ");e>t.whitespace.length;)t.whitespace+=t.whitespace;return t.whitespace.substr(0,e)},lib.f.alarm=function(e,t){var r=t||5e3,o=lib.f.getStack(1);return function(){var t=setTimeout(function(){var i="string"==typeof e?i:e.name;i=i?": "+i:"",console.warn("lib.f.alarm: timeout expired: "+r/1e3+"s"+i),console.log(o),t=null},r),i=function(e){return function(){return t&&(clearTimeout(t),t=null),e.apply(null,arguments)}};return"string"==typeof e?i:i(e)}()},lib.f.getStack=function(e){var t,r=e?e+2:2;try{throw new Error}catch(e){t=e.stack.split("\n")}for(var o={},i=r;i<t.length;i++)o[i-r]=t[i].replace(/^\s*at\s+/,"");return o},lib.f.smartFloorDivide=function(e,t){var r=e/t,o=Math.ceil(r);return o-r<1e-4?o:Math.floor(r)},lib.MessageManager=function(e){this.languages_=e.map(function(e){return e.replace(/-/g,"_")}),-1==this.languages_.indexOf("en")&&this.languages_.unshift("en"),this.messages={}},lib.MessageManager.prototype.addMessages=function(e){for(var t in e){var r=e[t];r.placeholders?this.messages[t]=r.message.replace(/\$([a-z][^\s\$]+)\$/gi,function(r,o){return e[t].placeholders[o.toLowerCase()].content}):this.messages[t]=r.message}},lib.MessageManager.prototype.findAndLoadMessages=function(e,t){function r(e){e?i=o.shift():s=o.shift(),o.length?n():t(i,s)}var o=this.languages_.concat(),i=[],s=[],n=function(){this.loadMessages(this.replaceReferences(e,o),r.bind(this,!0),r.bind(this,!1))}.bind(this);n()},lib.MessageManager.prototype.loadMessages=function(e,t,r){var o=new XMLHttpRequest;o.onloadend=function(){200==o.status?(this.addMessages(JSON.parse(o.responseText)),t()):r&&r(o.status)}.bind(this),o.open("GET",e),o.send()},lib.MessageManager.replaceReferences=function(e,t){return e.replace(/\$(\d+)/g,function(e,r){return t[r-1]})},lib.MessageManager.prototype.replaceReferences=lib.MessageManager.replaceReferences,lib.MessageManager.prototype.get=function(e,t,r){var o;if(e in this.messages)o=this.messages[e];else if(window.chrome.i18n&&(o=chrome.i18n.getMessage(e)),!o)return console.warn("Unknown message: "+e),void 0===r?e:r;return t?(t instanceof Array||(t=[t]),this.replaceReferences(o,t)):o},lib.MessageManager.prototype.processI18nAttributes=function(e){for(var t=e.querySelectorAll("[i18n]"),r=0;r<t.length;r++){var o=t[r],i=o.getAttribute("i18n");if(i){try{i=JSON.parse(i)}catch(e){throw console.error("Can't parse "+o.tagName+"#"+o.id+": "+i),e}for(var s in i){var n=i[s];"$"==n.substr(0,1)&&(n=(o.getAttribute(n.substr(1))+"_"+s).replace(/-/g,"_").toUpperCase());var a=this.get(n);"_"==s?o.textContent=a:o.setAttribute(s,a)}}}},lib.PreferenceManager=function(e,t){this.storage=e,this.storageObserver_=this.onStorageChange_.bind(this),this.isActive_=!1,this.activate(),this.trace=!1;var r=t||"/";"/"!=r.substr(r.length-1)&&(r+="/"),this.prefix=r,this.prefRecords_={},this.globalObservers_=[],this.childFactories_={},this.childLists_={}},lib.PreferenceManager.prototype.DEFAULT_VALUE=new String("DEFAULT"),lib.PreferenceManager.Record=function(e,t){this.name=e,this.defaultValue=t,this.currentValue=this.DEFAULT_VALUE,this.observers=[]},lib.PreferenceManager.Record.prototype.DEFAULT_VALUE=lib.PreferenceManager.prototype.DEFAULT_VALUE,lib.PreferenceManager.Record.prototype.addObserver=function(e){this.observers.push(e)},lib.PreferenceManager.Record.prototype.removeObserver=function(e){var t=this.observers.indexOf(e);t>=0&&this.observers.splice(t,1)},lib.PreferenceManager.Record.prototype.get=function(){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},lib.PreferenceManager.prototype.deactivate=function(){if(!this.isActive_)throw new Error("Not activated");this.isActive_=!1,this.storage.removeObserver(this.storageObserver_)},lib.PreferenceManager.prototype.activate=function(){if(this.isActive_)throw new Error("Already activated");this.isActive_=!0,this.storage.addObserver(this.storageObserver_)},lib.PreferenceManager.prototype.readStorage=function(e){function t(){0==--r&&e&&e()}var r=0,o=Object.keys(this.prefRecords_).map(function(e){return this.prefix+e}.bind(this));this.trace&&console.log("Preferences read: "+this.prefix),this.storage.getItems(o,function(o){var i=this.prefix.length;for(var s in o){var n=o[s],a=s.substr(i),l=a in this.childLists_&&JSON.stringify(n)!=JSON.stringify(this.prefRecords_[a].currentValue);this.prefRecords_[a].currentValue=n,l&&(r++,this.syncChildList(a,t))}0==r&&e&&setTimeout(e)}.bind(this))},lib.PreferenceManager.prototype.definePreference=function(e,t,r){var o=this.prefRecords_[e];o?this.changeDefault(e,t):o=this.prefRecords_[e]=new lib.PreferenceManager.Record(e,t),r&&o.addObserver(r)},lib.PreferenceManager.prototype.definePreferences=function(e){for(var t=0;t<e.length;t++)this.definePreference(e[t][0],e[t][1],e[t][2])},lib.PreferenceManager.prototype.defineChildren=function(e,t){this.definePreference(e,[],this.onChildListChange_.bind(this,e)),this.childFactories_[e]=t,this.childLists_[e]={}},lib.PreferenceManager.prototype.addObservers=function(e,t){if(e&&"function"!=typeof e)throw new Error("Invalid param: globals");if(e&&this.globalObservers_.push(e),t)for(var r in t){if(!(r in this.prefRecords_))throw new Error("Unknown preference: "+r);this.prefRecords_[r].addObserver(t[r])}},lib.PreferenceManager.prototype.notifyAll=function(){for(var e in this.prefRecords_)this.notifyChange_(e)},lib.PreferenceManager.prototype.notifyChange_=function(e){var t=this.prefRecords_[e];if(!t)throw new Error("Unknown preference: "+e);for(var r=t.get(),o=0;o<this.globalObservers_.length;o++)this.globalObservers_[o](e,r);for(o=0;o<t.observers.length;o++)t.observers[o](r,e,this)},lib.PreferenceManager.prototype.createChild=function(e,t,r){var o,i=this.get(e);if(r){if(o=r,-1!=i.indexOf(o))throw new Error("Duplicate child: "+e+": "+o)}else 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);var s=this.childFactories_[e](this,o);return s.trace=this.trace,s.resetAll(),this.childLists_[e][o]=s,i.push(o),this.set(e,i),s},lib.PreferenceManager.prototype.removeChild=function(e,t){this.getChild(e,t).resetAll();var r=this.get(e),o=r.indexOf(t);-1!=o&&(r.splice(o,1),this.set(e,r)),delete this.childLists_[e][t]},lib.PreferenceManager.prototype.getChild=function(e,t,r){if(!(e in this.childLists_))throw new Error("Unknown child list: "+e);var o=this.childLists_[e];if(!(t in o)){if(void 0===r)throw new Error('Unknown "'+e+'" child: '+t);return r}return o[t]},lib.PreferenceManager.diffChildLists=function(e,t){for(var r={added:{},removed:{},common:{}},o=0;o<e.length;o++)-1!=t.indexOf(e[o])?r.common[e[o]]=!0:r.added[e[o]]=!0;for(o=0;o<t.length;o++)t[o]in r.added||t[o]in r.common||(r.removed[t[o]]=!0);return r},lib.PreferenceManager.prototype.syncChildList=function(e,t){for(var r=0,o=this.get(e),i=Object.keys(this.childLists_[e]),s=(lib.PreferenceManager.diffChildLists(o,i),0);s<o.length;s++){var n=o[s],a=i.indexOf(n);if(a>=0&&i.splice(a,1),!this.childLists_[e][n]){var l=this.childFactories_[e](this,n);if(!l){console.warn("Unable to restore child: "+e+": "+n);continue}l.trace=this.trace,this.childLists_[e][n]=l,r++,l.readStorage(function(){0==--r&&t&&t()})}}for(s=0;s<i.length;s++)delete this.childLists_[e][i[s]];!r&&t&&setTimeout(t)},lib.PreferenceManager.prototype.reset=function(e){var t=this.prefRecords_[e];if(!t)throw new Error("Unknown preference: "+e);this.storage.removeItem(this.prefix+e),t.currentValue!==this.DEFAULT_VALUE&&(t.currentValue=this.DEFAULT_VALUE,this.notifyChange_(e))},lib.PreferenceManager.prototype.resetAll=function(){var e=[];for(var t in this.childLists_){var r=this.childLists_[t];for(var o in r)r[o].resetAll()}for(var i in this.prefRecords_)this.prefRecords_[i].currentValue!==this.DEFAULT_VALUE&&(this.prefRecords_[i].currentValue=this.DEFAULT_VALUE,e.push(i));var s=Object.keys(this.prefRecords_).map(function(e){return this.prefix+e}.bind(this));this.storage.removeItems(s),e.forEach(this.notifyChange_.bind(this))},lib.PreferenceManager.prototype.diff=function(e,t){return(void 0===e?"undefined":_typeof(e))!==(void 0===t?"undefined":_typeof(t))||!/^(undefined|boolean|number|string)$/.test(void 0===e?"undefined":_typeof(e))||e!==t},lib.PreferenceManager.prototype.changeDefault=function(e,t){var r=this.prefRecords_[e];if(!r)throw new Error("Unknown preference: "+e);this.diff(r.defaultValue,t)&&(r.currentValue===this.DEFAULT_VALUE?(r.defaultValue=t,this.notifyChange_(e)):r.defaultValue=t)},lib.PreferenceManager.prototype.changeDefaults=function(e){for(var t in e)this.changeDefault(t,e[t])},lib.PreferenceManager.prototype.set=function(e,t){var r=this.prefRecords_[e];if(!r)throw new Error("Unknown preference: "+e);var o=r.get();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))},lib.PreferenceManager.prototype.get=function(e){var t=this.prefRecords_[e];if(!t)throw new Error("Unknown preference: "+e);return t.get()},lib.PreferenceManager.prototype.exportAsJson=function(){var e={};for(var t in this.prefRecords_)if(t in this.childLists_){e[t]=[];for(var r=this.get(t),o=0;o<r.length;o++){var i=r[o];e[t].push({id:i,json:this.getChild(t,i).exportAsJson()})}}else{var s=this.prefRecords_[t];s.currentValue!=this.DEFAULT_VALUE&&(e[t]=s.currentValue)}return e},lib.PreferenceManager.prototype.importFromJson=function(e){for(var t in e)if(t in this.childLists_)for(var r=e[t],o=0;o<r.length;o++){var i=r[o].id,s=this.childLists_[t][i];s||(s=this.createChild(t,null,i)),s.importFromJson(r[o].json)}else this.set(t,e[t])},lib.PreferenceManager.prototype.onChildListChange_=function(e){this.syncChildList(e)},lib.PreferenceManager.prototype.onStorageChange_=function(e){for(var t in e)if(!this.prefix||0==t.lastIndexOf(this.prefix,0)){var r=t.substr(this.prefix.length);if(r in this.prefRecords_){var o=this.prefRecords_[r],i=e[t].newValue,s=o.currentValue;s===o.DEFAULT_VALUE&&(s=void 0),this.diff(s,i)&&(o.currentValue=void 0===i?o.DEFAULT_VALUE:i,this.notifyChange_(r))}}},lib.resource={resources_:{}},lib.resource.add=function(e,t,r){lib.resource.resources_[e]={type:t,name:e,data:r}},lib.resource.get=function(e,t){if(!(e in lib.resource.resources_)){if(void 0===t)throw"Unknown resource: "+e;return t}return lib.resource.resources_[e]},lib.resource.getData=function(e,t){if(!(e in lib.resource.resources_)){if(void 0===t)throw"Unknown resource: "+e;return t}return lib.resource.resources_[e].data},lib.resource.getDataUrl=function(e,t){var r=lib.resource.get(e,t);return"data:"+r.type+","+r.data},lib.Storage=new Object,lib.Storage.Chrome=function(e){this.storage_=e,this.observers_=[],chrome.storage.onChanged.addListener(this.onChanged_.bind(this))},lib.Storage.Chrome.prototype.onChanged_=function(e,t){if(chrome.storage[t]==this.storage_)for(var r=0;r<this.observers_.length;r++)this.observers_[r](e)},lib.Storage.Chrome.prototype.addObserver=function(e){this.observers_.push(e)},lib.Storage.Chrome.prototype.removeObserver=function(e){var t=this.observers_.indexOf(e);-1!=t&&this.observers_.splice(t,1)},lib.Storage.Chrome.prototype.clear=function(e){this.storage_.clear(),e&&setTimeout(e,0)},lib.Storage.Chrome.prototype.getItem=function(e,t){this.storage_.get(e,t)},lib.Storage.Chrome.prototype.getItems=function(e,t){this.storage_.get(e,t)},lib.Storage.Chrome.prototype.setItem=function(e,t,r){var o={};o[e]=t,this.storage_.set(o,r)},lib.Storage.Chrome.prototype.setItems=function(e,t){this.storage_.set(e,t)},lib.Storage.Chrome.prototype.removeItem=function(e,t){this.storage_.remove(e,t)},lib.Storage.Chrome.prototype.removeItems=function(e,t){this.storage_.remove(e,t)},lib.Storage.Local=function(){this.observers_=[],this.storage_=window.localStorage,window.addEventListener("storage",this.onStorage_.bind(this))},lib.Storage.Local.prototype.onStorage_=function(e){if(e.storageArea==this.storage_){var t=e.oldValue?JSON.parse(e.oldValue):"",r=e.newValue?JSON.parse(e.newValue):"",o={};o[e.key]={oldValue:t,newValue:r};for(var i=0;i<this.observers_.length;i++)this.observers_[i](o)}},lib.Storage.Local.prototype.addObserver=function(e){this.observers_.push(e)},lib.Storage.Local.prototype.removeObserver=function(e){var t=this.observers_.indexOf(e);-1!=t&&this.observers_.splice(t,1)},lib.Storage.Local.prototype.clear=function(e){this.storage_.clear(),e&&setTimeout(e,0)},lib.Storage.Local.prototype.getItem=function(e,t){var r=this.storage_.getItem(e);if("string"==typeof r)try{r=JSON.parse(r)}catch(e){}setTimeout(t.bind(null,r),0)},lib.Storage.Local.prototype.getItems=function(e,t){for(var r={},o=e.length-1;o>=0;o--){var i=e[o],s=this.storage_.getItem(i);if("string"==typeof s)try{r[i]=JSON.parse(s)}catch(e){r[i]=s}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},lib.Storage.Local.prototype.setItem=function(e,t,r){this.storage_.setItem(e,JSON.stringify(t)),r&&setTimeout(r,0)},lib.Storage.Local.prototype.setItems=function(e,t){for(var r in e)this.storage_.setItem(r,JSON.stringify(e[r]));t&&setTimeout(t,0)},lib.Storage.Local.prototype.removeItem=function(e,t){this.storage_.removeItem(e),t&&setTimeout(t,0)},lib.Storage.Local.prototype.removeItems=function(e,t){for(var r=0;r<e.length;r++)this.storage_.removeItem(e[r]);t&&setTimeout(t,0)},lib.Storage.Memory=function(){this.observers_=[],this.storage_={}},lib.Storage.Memory.prototype.addObserver=function(e){this.observers_.push(e)},lib.Storage.Memory.prototype.removeObserver=function(e){var t=this.observers_.indexOf(e);-1!=t&&this.observers_.splice(t,1)},lib.Storage.Memory.prototype.clear=function(e){var t={};for(var r in this.storage_)t[r]={oldValue:this.storage_[r],newValue:void 0};this.storage_={},setTimeout(function(){for(var e=0;e<this.observers_.length;e++)this.observers_[e](t)}.bind(this),0),e&&setTimeout(e,0)},lib.Storage.Memory.prototype.getItem=function(e,t){var r=this.storage_[e];if("string"==typeof r)try{r=JSON.parse(r)}catch(e){}setTimeout(t.bind(null,r),0)},lib.Storage.Memory.prototype.getItems=function(e,t){for(var r={},o=e.length-1;o>=0;o--){var i=e[o],s=this.storage_[i];if("string"==typeof s)try{r[i]=JSON.parse(s)}catch(e){r[i]=s}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},lib.Storage.Memory.prototype.setItem=function(e,t,r){var o=this.storage_[e];this.storage_[e]=JSON.stringify(t);var i={};i[e]={oldValue:o,newValue:t},setTimeout(function(){for(var e=0;e<this.observers_.length;e++)this.observers_[e](i)}.bind(this),0),r&&setTimeout(r,0)},lib.Storage.Memory.prototype.setItems=function(e,t){var r={};for(var o in e)r[o]={oldValue:this.storage_[o],newValue:e[o]},this.storage_[o]=JSON.stringify(e[o]);setTimeout(function(){for(var e=0;e<this.observers_.length;e++)this.observers_[e](r)}.bind(this)),t&&setTimeout(t,0)},lib.Storage.Memory.prototype.removeItem=function(e,t){delete this.storage_[e],t&&setTimeout(t,0)},lib.Storage.Memory.prototype.removeItems=function(e,t){for(var r=0;r<e.length;r++)delete this.storage_[e[r]];t&&setTimeout(t,0)},lib.TestManager=function(e){this.log=e||new lib.TestManager.Log},lib.TestManager.prototype.createTestRun=function(e){return new lib.TestManager.TestRun(this,e)},lib.TestManager.prototype.onTestRunComplete=function(e){},lib.TestManager.Log=function(e){this.logFunction_=e||function(e){console.log(e)},this.pending_="",this.prefix_="",this.prefixStack_=[]},lib.TestManager.Log.prototype.pushPrefix=function(e){this.prefixStack_.push(e),this.prefix_=this.prefixStack_.join("")},lib.TestManager.Log.prototype.popPrefix=function(){this.prefixStack_.pop(),this.prefix_=this.prefixStack_.join("")},lib.TestManager.Log.prototype.print=function(e){this.pending_?this.pending_+=e:this.pending_=this.prefix_+e},lib.TestManager.Log.prototype.println=function(e){this.pending_&&this.flush(),this.logFunction_(this.prefix_+e)},lib.TestManager.Log.prototype.flush=function(){this.pending_&&(this.logFunction_(this.pending_),this.pending_="")},lib.TestManager.Suite=function(e){function t(t,r){this.testManager_=t,this.suiteName=e,this.setup(r)}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={__proto__:lib.TestManager.Suite.prototype},lib.TestManager.Suite.subclasses.push(t),t},lib.TestManager.Suite.subclasses=[],lib.TestManager.Suite.addTest=function(e,t){if(e in this.testMap_)throw"Duplicate test name: "+e;var r=new lib.TestManager.Test(this,e,t);this.testMap_[e]=r,this.testList_.push(r)},lib.TestManager.Suite.disableTest=function(e,t){if(e in this.testMap_)throw"Duplicate test name: "+e;var r=new lib.TestManager.Test(this,e,t);console.log("Disabled test: "+r.fullName)},lib.TestManager.Suite.getTest=function(e){return this.testMap_[e]},lib.TestManager.Suite.getTestList=function(){return this.testList_},lib.TestManager.Suite.prototype.setDefaults=function(e,t){for(var r in t)this[r]=r in e?e[r]:t[r]},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){this.suiteClass=e,this.testName=t,this.fullName=e.suiteName+"["+t+"]",this.testFunction_=r},lib.TestManager.Test.prototype.run=function(e){try{this.testFunction_.apply(e.suite,[e,e.testRun.cx])}catch(t){if(t instanceof lib.TestManager.Result.TestComplete)return;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)}},lib.TestManager.TestRun=function(e,t){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_=[]},lib.TestManager.TestRun.prototype.ALL_TESTS=new String("<all-tests>"),lib.TestManager.TestRun.prototype.selectTest=function(e){this.testQueue_.push(e)},lib.TestManager.TestRun.prototype.selectSuite=function(e,t){for(var r=t||this.ALL_TESTS,o=0,i=e.getTestList(),s=0;s<i.length;s++){var n=i[s];if(r!==this.ALL_TESTS)if(r instanceof RegExp){if(!r.test(n.testName))continue}else if(n.testName!=r)continue;this.selectTest(n),o++}return o},lib.TestManager.TestRun.prototype.selectPattern=function(e){for(var t=0,r=0;r<lib.TestManager.Suite.subclasses.length;r++)t+=this.selectSuite(lib.TestManager.Suite.subclasses[r],e);return t||this.log.println("No tests matched selection criteria: "+e),t},lib.TestManager.TestRun.prototype.onUncaughtException_=function(e,t,r){if(0==e.indexOf("Uncaught lib.TestManager.Result.TestComplete")||-1!=e.indexOf("status: passed"))return!0;if(this.currentResult&&e!="Uncaught "+this.currentResult.expectedErrorMessage_){var o="during";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}},lib.TestManager.TestRun.prototype.onTestRunComplete_=function(e){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,this.testManager.onTestRunComplete(this)):setTimeout(this.onTestRunComplete_.bind(this),0,!0)},lib.TestManager.TestRun.prototype.onResultComplete=function(e){try{e.suite.postamble()}catch(e){this.log.println("Unexpected exception in postamble: "+(e.stack?e.stack:e)),this.panic=!0}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;else{if(e.status!=e.PASSED)return this.log.println("Unknown result status: "+e.test.fullName+": "+e.status),this.panic=!0;this.passes.push(e)}this.runNextTest_()},lib.TestManager.TestRun.prototype.onResultReComplete=function(e,t){this.log.println("Late complete for test: "+e.test.fullName+": "+t);var r=this.passes.indexOf(e);r>=0&&(this.passes.splice(r,1),this.failures.push(e))},lib.TestManager.TestRun.prototype.runNextTest_=function(){if(this.panic||!this.testQueue_.length)return this.onTestRunComplete_();if(this.maxFailures&&this.failures.length>=this.maxFailures)return this.log.println("Maximum failure count reached, aborting test run."),this.onTestRunComplete_();var e=this.testQueue_[0],t=this.currentResult?this.currentResult.suite:null;try{t&&t instanceof e.suiteClass||(this.log.println("Initializing suite: "+e.suiteClass.suiteName),t=new e.suiteClass(this.testManager,this.cx))}catch(e){return this.log.println("Exception during setup: "+(e.stack?e.stack:e)),this.panic=!0,void this.onTestRunComplete_()}try{this.log.print("Test: "+e.fullName+" {"),this.log.pushPrefix("  "),this.currentResult=new lib.TestManager.Result(this,t,e),t.preamble(this.currentResult,this.cx),this.testQueue_.shift()}catch(e){return this.log.println("Unexpected exception during test preamble: "+(e.stack?e.stack:e)),this.log.popPrefix(),this.log.println("}"),this.panic=!0,void this.onTestRunComplete_()}try{this.currentResult.run()}catch(e){this.log.println("Unexpected exception during test run: "+(e.stack?e.stack:e)),this.panic=!0}},lib.TestManager.TestRun.prototype.run=function(){this.log.println("Running "+this.testQueue_.length+" test(s) {"),this.log.pushPrefix("  "),window.onerror=this.onUncaughtException_.bind(this),this.startDate=new Date,this.runNextTest_()},lib.TestManager.TestRun.prototype.msToSeconds_=function(e){return(e/1e3).toFixed(2)+"s"},lib.TestManager.TestRun.prototype.summarize=function(){if(this.failures.length)for(var e=0;e<this.failures.length;e++)this.log.println("FAILED: "+this.failures[e].test.fullName);this.testQueue_.length&&this.log.println("Test run incomplete: "+this.testQueue_.length+" test(s) were not run.")},lib.TestManager.Result=function(e,t,r){this.testRun=e,this.suite=t,this.test=r,this.startDate=null,this.duration=null,this.status=this.PENDING,this.expectedErrorMessage_=null},lib.TestManager.Result.prototype.PENDING="pending",lib.TestManager.Result.prototype.FAILED="FAILED",lib.TestManager.Result.prototype.PASSED="passed",lib.TestManager.Result.TestComplete=function(e){this.result=e},lib.TestManager.Result.TestComplete.prototype.toString=function(){return"lib.TestManager.Result.TestComplete: "+this.result.test.fullName+", status: "+this.result.status},lib.TestManager.Result.prototype.run=function(){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))},lib.TestManager.Result.prototype.expectErrorMessage=function(e){this.expectedErrorMessage_=e},lib.TestManager.Result.prototype.onTimeout_=function(){this.timeout_=null,this.status==this.PENDING&&(this.println("Test timed out."),this.completeTest_(this.FAILED,!1))},lib.TestManager.Result.prototype.requestTime=function(e){this.timeout_&&clearTimeout(this.timeout_),this.timeout_=setTimeout(this.onTimeout_.bind(this),e)},lib.TestManager.Result.prototype.completeTest_=function(e,t){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)},lib.TestManager.Result.prototype.assertEQ=function(e,t,r){function o(e){if("number"==typeof e)return e;var t=String(e).split("\n").map(function(e){return JSON.stringify(e)});return t.length>1?"\n"+t.join("\n"):t.join("\n")}if(e!==t){var i=r?"["+r+"]":"";this.fail("assertEQ"+i+": "+this.getCallerLocation_(1)+": "+o(e)+" !== "+o(t))}},lib.TestManager.Result.prototype.assert=function(e,t){if(!0!==e){var r=t?"["+t+"]":"";this.fail("assert"+r+": "+this.getCallerLocation_(1)+": "+String(e))}},lib.TestManager.Result.prototype.getCallerLocation_=function(e){try{throw new Error}catch(r){var t=r.stack.split("\n")[e+2].match(/([^/]+:\d+):\d+\)?$/);return t?t[1]:"???"}},lib.TestManager.Result.prototype.println=function(e){this.testRun.log.println(e)},lib.TestManager.Result.prototype.fail=function(e){arguments.length&&this.println(e),this.completeTest_(this.FAILED,!0)},lib.TestManager.Result.prototype.pass=function(){this.completeTest_(this.PASSED,!0)},lib.UTF8Decoder=function(){this.bytesLeft=0,this.codePoint=0,this.lowerBound=0},lib.UTF8Decoder.prototype.decode=function(e){for(var t="",r=0;r<e.length;r++){var o=e.charCodeAt(r);if(0==this.bytesLeft)o<=127?t+=e.charAt(r):192<=o&&o<=223?(this.codePoint=o-192,this.bytesLeft=1,this.lowerBound=128):224<=o&&o<=239?(this.codePoint=o-224,this.bytesLeft=2,this.lowerBound=2048):240<=o&&o<=247?(this.codePoint=o-240,this.bytesLeft=3,this.lowerBound=65536):248<=o&&o<=251?(this.codePoint=o-248,this.bytesLeft=4,this.lowerBound=2097152):252<=o&&o<=253?(this.codePoint=o-252,this.bytesLeft=5,this.lowerBound=67108864):t+="�";else if(128<=o&&o<=191){if(this.bytesLeft--,this.codePoint=(this.codePoint<<6)+(o-128),0==this.bytesLeft){var i=this.codePoint;i<this.lowerBound||55296<=i&&i<=57343||i>1114111?t+="�":i<65536?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode(55296+(i>>>10&1023),56320+(1023&i)))}}else t+="�",this.bytesLeft=0,r--}return t},lib.decodeUTF8=function(e){return(new lib.UTF8Decoder).decode(e)},lib.encodeUTF8=function(e){for(var t="",r=0;r<e.length;r++){var o=e.charCodeAt(r);if(56320<=o&&o<=57343)o=65533;else if(55296<=o&&o<=56319)if(r+1<e.length){var i=e.charCodeAt(r+1);56320<=i&&i<=57343?(o=65536+((1023&o)<<10)+(1023&i),r++):o=65533}else o=65533;var s;if(o<=127)t+=e.charAt(r);else for(o<=2047?(t+=String.fromCharCode(192|o>>>6),s=1):o<=65535?(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)}return t},lib.wc={},lib.wc.nulWidth=0,lib.wc.controlWidth=0,lib.wc.regardCjkAmbiguous=!1,lib.wc.cjkAmbiguousWidth=2,lib.wc.combining=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],lib.wc.ambiguous=[[161,161],[164,164],[167,168],[170,170],[174,174],[176,180],[182,186],[188,191],[198,198],[208,208],[215,216],[222,225],[230,230],[232,234],[236,237],[240,240],[242,243],[247,250],[252,252],[254,254],[257,257],[273,273],[275,275],[283,283],[294,295],[299,299],[305,307],[312,312],[319,322],[324,324],[328,331],[333,333],[338,339],[358,359],[363,363],[462,462],[464,464],[466,466],[468,468],[470,470],[472,472],[474,474],[476,476],[593,593],[609,609],[708,708],[711,711],[713,715],[717,717],[720,720],[728,731],[733,733],[735,735],[913,929],[931,937],[945,961],[963,969],[1025,1025],[1040,1103],[1105,1105],[8208,8208],[8211,8214],[8216,8217],[8220,8221],[8224,8226],[8228,8231],[8240,8240],[8242,8243],[8245,8245],[8251,8251],[8254,8254],[8308,8308],[8319,8319],[8321,8324],[8364,8364],[8451,8451],[8453,8453],[8457,8457],[8467,8467],[8470,8470],[8481,8482],[8486,8486],[8491,8491],[8531,8532],[8539,8542],[8544,8555],[8560,8569],[8592,8601],[8632,8633],[8658,8658],[8660,8660],[8679,8679],[8704,8704],[8706,8707],[8711,8712],[8715,8715],[8719,8719],[8721,8721],[8725,8725],[8730,8730],[8733,8736],[8739,8739],[8741,8741],[8743,8748],[8750,8750],[8756,8759],[8764,8765],[8776,8776],[8780,8780],[8786,8786],[8800,8801],[8804,8807],[8810,8811],[8814,8815],[8834,8835],[8838,8839],[8853,8853],[8857,8857],[8869,8869],[8895,8895],[8978,8978],[9312,9449],[9451,9547],[9552,9587],[9600,9615],[9618,9621],[9632,9633],[9635,9641],[9650,9651],[9654,9655],[9660,9661],[9664,9665],[9670,9672],[9675,9675],[9678,9681],[9698,9701],[9711,9711],[9733,9734],[9737,9737],[9742,9743],[9748,9749],[9756,9756],[9758,9758],[9792,9792],[9794,9794],[9824,9825],[9827,9829],[9831,9834],[9836,9837],[9839,9839],[10045,10045],[10102,10111],[57344,63743],[65533,65533],[983040,1048573],[1048576,1114109]],lib.wc.isSpace=function(e){var t,r=0,o=lib.wc.combining.length-1;if(e<lib.wc.combining[0][0]||e>lib.wc.combining[o][1])return!1;for(;o>=r;)if(t=Math.floor((r+o)/2),e>lib.wc.combining[t][1])r=t+1;else{if(!(e<lib.wc.combining[t][0]))return!0;o=t-1}return!1},lib.wc.isCjkAmbiguous=function(e){var t,r=0,o=lib.wc.ambiguous.length-1;if(e<lib.wc.ambiguous[0][0]||e>lib.wc.ambiguous[o][1])return!1;for(;o>=r;)if(t=Math.floor((r+o)/2),e>lib.wc.ambiguous[t][1])r=t+1;else{if(!(e<lib.wc.ambiguous[t][0]))return!0;o=t-1}return!1},lib.wc.charWidth=function(e){return lib.wc.regardCjkAmbiguous?lib.wc.charWidthRegardAmbiguous(e):lib.wc.charWidthDisregardAmbiguous(e)},lib.wc.charWidthDisregardAmbiguous=function(e){return 0===e?lib.wc.nulWidth:e<32||e>=127&&e<160?lib.wc.controlWidth:e<127?1:lib.wc.isSpace(e)?0:1+(e>=4352&&(e<=4447||9001==e||9002==e||e>=11904&&e<=42191&&12351!=e||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141))},lib.wc.charWidthRegardAmbiguous=function(e){return lib.wc.isCjkAmbiguous(e)?lib.wc.cjkAmbiguousWidth:lib.wc.charWidthDisregardAmbiguous(e)},lib.wc.strWidth=function(e){for(var t,r=0,o=0;o<e.length;o++){if((t=lib.wc.charWidth(e.charCodeAt(o)))<0)return-1;r+=t}return r},lib.wc.substr=function(e,t,r){var o,i,s;for(o=0,s=0;o<e.length&&!((s+=lib.wc.charWidth(e.charCodeAt(o)))>t);o++);if(void 0!=r){for(i=o,s=0;i<e.length&&s<r;s+=lib.wc.charWidth(e.charCodeAt(i)),i++);return s>r&&i--,e.substring(o,i)}return e.substr(o)},lib.wc.substring=function(e,t,r){return lib.wc.substr(e,t,r-t)},lib.resource.add("libdot/changelog/version","text/plain","1.9"),lib.resource.add("libdot/changelog/date","text/plain","2014-05-27"),lib.rtdep("lib.Storage");var hterm={};hterm.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){function t(t){hterm.windowType=t.type,setTimeout(e,0)}if(!hterm.defaultStorage){var r=navigator.userAgent.match(/\sChrome\/(\d\d)/),o=r?parseInt(r[1]):-1;window.chrome&&chrome.storage&&chrome.storage.sync&&o>21?hterm.defaultStorage=new lib.Storage.Chrome(chrome.storage.sync):hterm.defaultStorage=new lib.Storage.Local}s=!1;if(window.chrome&&chrome.runtime&&chrome.runtime.getManifest)var i=chrome.runtime.getManifest(),s=i.app&&i.app.background;s?setTimeout(t.bind(null,{type:"popup"}),0):window.chrome&&chrome.tabs?chrome.tabs.getCurrent(function(r){r&&window.chrome?chrome.windows.get(r.windowId,null,t):(hterm.windowType="normal",setTimeout(e,0))}):setTimeout(t.bind(null,{type:"normal"}),0)}),hterm.getClientSize=function(e){return e.getBoundingClientRect()},hterm.getClientWidth=function(e){return e.getBoundingClientRect().width},hterm.getClientHeight=function(e){return e.getBoundingClientRect().height},hterm.copySelectionToClipboard=function(e){try{e.execCommand("copy")}catch(e){}},hterm.pasteFromClipboard=function(e){try{e.execCommand("paste")}catch(e){}},hterm.Size=function(e,t){this.width=e,this.height=t},hterm.Size.prototype.resize=function(e,t){this.width=e,this.height=t},hterm.Size.prototype.clone=function(){return new hterm.Size(this.width,this.height)},hterm.Size.prototype.setTo=function(e){this.width=e.width,this.height=e.height},hterm.Size.prototype.equals=function(e){return this.width==e.width&&this.height==e.height},hterm.Size.prototype.toString=function(){return"[hterm.Size: "+this.width+", "+this.height+"]"},hterm.RowCol=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},hterm.RowCol.prototype.move=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},hterm.RowCol.prototype.clone=function(){return new hterm.RowCol(this.row,this.column,this.overflow)},hterm.RowCol.prototype.setTo=function(e){this.row=e.row,this.column=e.column,this.overflow=e.overflow},hterm.RowCol.prototype.equals=function(e){return this.row==e.row&&this.column==e.column&&this.overflow==e.overflow},hterm.RowCol.prototype.toString=function(){return"[hterm.RowCol: "+this.row+", "+this.column+", "+this.overflow+"]"},lib.rtdep("lib.f"),hterm.Frame=function(e,t,r){this.terminal_=e,this.div_=e.div_,this.url=t,this.options=r||{},this.iframe_=null,this.container_=null,this.messageChannel_=null},hterm.Frame.prototype.onMessage_=function(e){"ipc-init-ok"==e.data.name?(this.sendTerminalInfo_(),this.messageChannel_.port1.onmessage=this.onMessage.bind(this),this.onLoad()):console.log("Unknown message from frame:",e.data)},hterm.Frame.prototype.onMessage=function(){},hterm.Frame.prototype.onLoad_=function(){this.messageChannel_=new MessageChannel,this.messageChannel_.port1.onmessage=this.onMessage_.bind(this),this.messageChannel_.port1.start(),this.iframe_.contentWindow.postMessage({name:"ipc-init",argv:[{messagePort:this.messageChannel_.port2}]},[this.messageChannel_.port2],this.url)},hterm.Frame.prototype.onLoad=function(){},hterm.Frame.prototype.sendTerminalInfo_=function(){lib.f.getAcceptLanguages(function(e){this.postMessage("terminal-info",[{acceptLanguages:e,foregroundColor:this.terminal_.getForegroundColor(),backgroundColor:this.terminal_.getBackgroundColor(),cursorColor:this.terminal_.getCursorColor(),fontSize:this.terminal_.getFontSize(),fontFamily:this.terminal_.getFontFamily(),baseURL:lib.f.getURL("/")}])}.bind(this))},hterm.Frame.prototype.onCloseClicked_=function(){this.close()},hterm.Frame.prototype.close=function(){this.container_&&this.container_.parentNode&&(this.container_.parentNode.removeChild(this.container_),this.onClose())},hterm.Frame.prototype.onClose=function(){},hterm.Frame.prototype.postMessage=function(e,t){if(!this.messageChannel_)throw new Error("Message channel is not set up.");this.messageChannel_.port1.postMessage({name:e,argv:t})},hterm.Frame.prototype.show=function(){function e(e,r){return e in t.options?t.options[e]:r}var t=this,t=this;if(this.container_&&this.container_.parentNode)console.error("Frame already visible");else{var r=hterm.getClientSize(this.div_),o=e("width",640),i=e("height",480),s=(r.width,r.height,this.terminal_.document_),n=this.container_=s.createElement("div");n.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;";var a=s.createElement("div");a.style.cssText="display: -webkit-flex;-webkit-justify-content: flex-end;height: 16px;background-color: "+this.terminal_.getForegroundColor()+";color: "+this.terminal_.getBackgroundColor()+";font-size: 16px;font-family: "+this.terminal_.getFontFamily(),n.appendChild(a);var l=this.iframe_=s.createElement("iframe");l.onload=this.onLoad_.bind(this),l.style.cssText="display: -webkit-flex;-webkit-flex: 1;width: 100%",l.setAttribute("src",this.url),l.setAttribute("seamless",!0),n.appendChild(l),this.div_.appendChild(n)}},lib.rtdep("hterm.Keyboard.KeyMap"),hterm.Keyboard=function(e){this.terminal=e,this.keyboardElement_=null,this.handlers_=[["blur",this.onBlur_.bind(this)],["keydown",this.onKeyDown_.bind(this)],["keypress",this.onKeyPress_.bind(this)],["keyup",this.onKeyUp_.bind(this)],["textInput",this.onTextInput_.bind(this)]],this.keyMap=new hterm.Keyboard.KeyMap(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},hterm.Keyboard.KeyActions={CANCEL:new String("CANCEL"),DEFAULT:new String("DEFAULT"),PASS:new String("PASS"),STRIP:new String("STRIP")},hterm.Keyboard.prototype.encode=function(e){return"utf-8"==this.characterEncoding?this.terminal.vt.encodeUTF8(e):e},hterm.Keyboard.prototype.installKeyboard=function(e){if(e!=this.keyboardElement_){e&&this.keyboardElement_&&this.installKeyboard(null);for(var t=0;t<this.handlers_.length;t++){var r=this.handlers_[t];e?e.addEventListener(r[0],r[1]):this.keyboardElement_.removeEventListener(r[0],r[1])}this.keyboardElement_=e}},hterm.Keyboard.prototype.uninstallKeyboard=function(){this.installKeyboard(null)},hterm.Keyboard.prototype.onTextInput_=function(e){e.data&&e.data.split("").forEach(this.terminal.onVTKeystroke.bind(this.terminal))},hterm.Keyboard.prototype.onKeyPress_=function(e){var t=String.fromCharCode(e.which).toLowerCase();if(!e.ctrlKey&&!e.metaKey||"c"!=t&&"v"!=t){if(e.altKey&&"browser-key"==this.altSendsWhat&&0==e.charCode){var r=String.fromCharCode(e.keyCode);e.shiftKey||(r=r.toLowerCase()),r.charCodeAt(0)+128}else e.charCode>=32&&(r=e.charCode);r&&this.terminal.onVTKeystroke(String.fromCharCode(r)),e.preventDefault(),e.stopPropagation()}},hterm.Keyboard.prototype.preventChromeAppNonShiftDefault_=function(e){window.chrome&&window.chrome.app&&window.chrome.app.window&&(e.shiftKey||e.preventDefault())},hterm.Keyboard.prototype.onBlur_=function(e){this.altKeyPressed=0},hterm.Keyboard.prototype.onKeyUp_=function(e){18==e.keyCode&&(this.altKeyPressed=this.altKeyPressed&~(1<<e.location-1)),27==e.keyCode&&this.preventChromeAppNonShiftDefault_(e)},hterm.Keyboard.prototype.onKeyDown_=function(e){function t(s){o=s;var a=r[s];return"function"==typeof a&&(a=a.apply(i.keyMap,[e,r])),a===n&&"normal"!=s&&(a=t("normal")),a}18==e.keyCode&&(this.altKeyPressed=this.altKeyPressed|1<<e.location-1),27==e.keyCode&&this.preventChromeAppNonShiftDefault_(e);var r=this.keyMap.keyDefs[e.keyCode];if(r){var o=null,i=this,s=hterm.Keyboard.KeyActions.CANCEL,n=hterm.Keyboard.KeyActions.DEFAULT,a=hterm.Keyboard.KeyActions.PASS,l=hterm.Keyboard.KeyActions.STRIP,h=e.ctrlKey,c=!this.altIsMeta&&e.altKey,u=this.altIsMeta?e.altKey||e.metaKey:e.metaKey,g=!/^\[\w+\]$/.test(r.keyCap);switch(this.altGrMode){case"ctrl-alt":g&&h&&c&&(h=!1,c=!1);break;case"right-alt":g&&2&this.terminal.keyboard.altKeyPressed&&(h=!1,c=!1);break;case"left-alt":g&&1&this.terminal.keyboard.altKeyPressed&&(h=!1,c=!1)}var d;if(d=t(h?"control":c?"alt":u?"meta":"normal"),c&&"browser-key"==this.altSendsWhat&&d==n&&(d=a),d!==a&&(d!==n||h||c||u)&&(d===l&&(c=h=!1,"function"==typeof(d=r.normal)&&(d=d.apply(this.keyMap,[e,r])),d==n&&2==r.keyCap.length&&(d=r.keyCap.substr(e.shiftKey?1:0,1))),e.preventDefault(),e.stopPropagation(),d!==s))if(d===n||"string"==typeof d){"control"==o?h=!1:"alt"==o?c=!1:"meta"==o&&(u=!1);var p=!e.maskShiftKey&&e.shiftKey;if("["==d.substr(0,2)&&(c||h||p)){var m;!p||c||h?!c||p||h?p&&c&&!h?m=";4":!h||p||c?p&&h&&!c?m=";6":c&&h&&!p?m=";7":p&&c&&h&&(m=";8"):m=";5":m=";3":m=";2",d=3==d.length?"[1"+m+d.substr(2,1):d.substr(0,d.length-1)+m+d.substr(d.length-1)}else{if(d===n&&(d=r.keyCap.substr(e.shiftKey?1:0,1),h&&(b=r.keyCap.substr(0,1).charCodeAt(0))>=64&&b<=95&&(d=String.fromCharCode(b-64))),c&&"8-bit"==this.altSendsWhat&&1==d.length){var b=d.charCodeAt(0)+128;d=String.fromCharCode(b)}(c&&"escape"==this.altSendsWhat||u&&this.metaSendsEscape)&&(d=""+d)}this.terminal.onVTKeystroke(d)}else console.warn("Invalid action: "+JSON.stringify(d))}else console.warn("No definition for keyCode: "+e.keyCode)},lib.rtdep("hterm.Keyboard.KeyActions"),hterm.Keyboard.KeyMap=function(e){this.keyboard=e,this.keyDefs={},this.reset()},hterm.Keyboard.KeyMap.prototype.addKeyDef=function(e,t){e in this.keyDefs&&console.warn("Duplicate keyCode: "+e),this.keyDefs[e]=t},hterm.Keyboard.KeyMap.prototype.addKeyDefs=function(e){for(var t=0;t<arguments.length;t++)this.addKeyDef(arguments[t][0],{keyCap:arguments[t][1],normal:arguments[t][2],control:arguments[t][3],alt:arguments[t][4],meta:arguments[t][5]})},hterm.Keyboard.KeyMap.prototype={__proto__:hterm.Keyboard.KeyMap.prototype},hterm.Keyboard.KeyMap.prototype.reset=function(){function e(e,t,r){return"function"==typeof e?e.apply(h,[t,r]):e}function t(t,r){return function(o,i){return e(o.shiftKey||o.ctrlKey||o.altKey||o.metaKey||!h.keyboard.applicationCursor?t:r,o,i)}}function r(t,r){return function(o,i){return e(h.keyboard.backspaceSendsBackspace?r:t,o,i)}}function o(t,r){return function(o,i){var s=o.shiftKey?r:t;return o.maskShiftKey=!0,e(s,o,i)}}function i(t,r){return function(o,i){return e(o.altKey?r:t,o,i)}}function s(t,r){return function(o,i){return e(o.shiftKey||o.ctrlKey||o.altKey||o.metaKey?r:t,o,i)}}function n(e){return String.fromCharCode(e.charCodeAt(0)-64)}function a(e){return function(t,r){return this[e](t,r)}}function l(t){return function(r,o){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}}this.keyDefs={};var h=this,c=hterm.Keyboard.KeyActions.CANCEL,u=hterm.Keyboard.KeyActions.DEFAULT,g=hterm.Keyboard.KeyActions.PASS,d=hterm.Keyboard.KeyActions.STRIP;this.addKeyDefs([0,"[UNKNOWN]",g,g,g,g],[27,"[ESC]","",u,u,u],[112,"[F1]",s("OP","[P"),u,"[23~",u],[113,"[F2]",s("OQ","[Q"),u,"[24~",u],[114,"[F3]",s("OR","[R"),u,"[25~",u],[115,"[F4]",s("OS","[S"),u,"[26~",u],[116,"[F5]","[15~",u,"[28~",u],[117,"[F6]","[17~",u,"[29~",u],[118,"[F7]","[18~",u,"[31~",u],[119,"[F8]","[19~",u,"[32~",u],[120,"[F9]","[20~",u,"[33~",u],[121,"[F10]","[21~",u,"[34~",u],[122,"[F11]","[23~",u,"[42~",u],[123,"[F12]","[24~",u,"[43~",u],[192,"`~",u,o(n("@"),n("^")),u,g],[49,"1!",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[50,"2@",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[51,"3#",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[52,"4$",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[53,"5%",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[54,"6^",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[55,"7&",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[56,"8*",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[57,"9(",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[48,"0)",u,a("onPlusMinusZero_"),a("onAltNum_"),a("onPlusMinusZero_")],[189,"-_",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[187,"=+",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[173,"-_",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[61,"=+",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[171,"+*",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[8,"[BKSP]",r("","\b"),r("\b",""),u,u],[9,"[TAB]",o("\t","[Z"),d,g,u],[81,"qQ",u,n("Q"),u,u],[87,"wW",u,n("W"),u,u],[69,"eE",u,n("E"),u,u],[82,"rR",u,n("R"),u,u],[84,"tT",u,n("T"),u,u],[89,"yY",u,n("Y"),u,u],[85,"uU",u,n("U"),u,u],[73,"iI",u,n("I"),u,u],[79,"oO",u,n("O"),u,u],[80,"pP",u,n("P"),u,u],[219,"[{",u,n("["),u,u],[221,"]}",u,n("]"),u,u],[220,"\\|",u,n("\\"),u,u],[20,"[CAPS]",g,g,g,u],[65,"aA",u,n("A"),u,u],[83,"sS",u,n("S"),u,u],[68,"dD",u,n("D"),u,u],[70,"fF",u,n("F"),u,u],[71,"gG",u,n("G"),u,u],[72,"hH",u,n("H"),u,u],[74,"jJ",u,o(n("J"),g),u,u],[75,"kK",u,o(n("K"),a("onClear_")),u,u],[76,"lL",u,o(n("L"),g),u,u],[186,";:",u,d,u,u],[222,"'\"",u,d,u,u],[13,"[ENTER]","\r",c,c,u],[16,"[SHIFT]",g,g,g,u],[90,"zZ",u,n("Z"),u,u],[88,"xX",u,n("X"),u,u],[67,"cC",u,a("onCtrlC_"),u,a("onMetaC_")],[86,"vV",u,a("onCtrlV_"),u,a("onMetaV_")],[66,"bB",u,o(n("B"),g),u,o(u,g)],[78,"nN",u,a("onCtrlN_"),u,a("onMetaN_")],[77,"mM",u,n("M"),u,u],[188,",<",u,i(d,g),u,u],[190,".>",u,i(d,g),u,u],[191,"/?",u,o(n("_"),n("?")),u,u],[17,"[CTRL]",g,g,g,g],[18,"[ALT]",g,g,g,g],[91,"[LAPL]",g,g,g,g],[32," ",u,n("@"),u,u],[92,"[RAPL]",g,g,g,g],[93,"[RMENU]",g,g,g,g],[42,"[PRTSCR]",g,g,g,g],[145,"[SCRLK]",g,g,g,g],[19,"[BREAK]",g,g,g,g],[45,"[INSERT]",a("onKeyInsert_"),u,u,u],[36,"[HOME]",a("onKeyHome_"),u,u,u],[33,"[PGUP]",a("onKeyPageUp_"),u,u,u],[46,"[DEL]",a("onKeyDel_"),u,u,u],[35,"[END]",a("onKeyEnd_"),u,u,u],[34,"[PGDOWN]",a("onKeyPageDown_"),u,u,u],[38,"[UP]",t("[A","OA"),u,u,u],[40,"[DOWN]",t("[B","OB"),u,u,u],[39,"[RIGHT]",t("[C","OC"),u,u,u],[37,"[LEFT]",t("[D","OD"),u,u,u],[144,"[NUMLOCK]",g,g,g,g],[96,"[KP0]",u,u,u,u],[97,"[KP1]",u,u,u,u],[98,"[KP2]",u,u,u,u],[99,"[KP3]",u,u,u,u],[100,"[KP4]",u,u,u,u],[101,"[KP5]",u,u,u,u],[102,"[KP6]",u,u,u,u],[103,"[KP7]",u,u,u,u],[104,"[KP8]",u,u,u,u],[105,"[KP9]",u,u,u,u],[107,"[KP+]",u,u,u,u],[109,"[KP-]",u,u,u,u],[106,"[KP*]",u,u,u,u],[111,"[KP/]",u,u,u,u],[110,"[KP.]",u,u,u,u],[166,"[BACK]",l(s("OP","[P")),u,"[23~",u],[167,"[FWD]",l(s("OQ","[Q")),u,"[24~",u],[168,"[RELOAD]",l(s("OR","[R")),u,"[25~",u],[183,"[FSCR]",l(s("OS","[S")),u,"[26~",u],[182,"[WINS]",l("[15~"),u,"[28~",u],[216,"[BRIT-]",l("[17~"),u,"[29~",u],[217,"[BRIT+]",l("[18~"),u,"[31~",u])},hterm.Keyboard.KeyMap.prototype.onKeyInsert_=function(e){return this.keyboard.shiftInsertPaste&&e.shiftKey?hterm.Keyboard.KeyActions.PASS:"[2~"},hterm.Keyboard.KeyMap.prototype.onKeyHome_=function(e){return!this.keyboard.homeKeysScroll^e.shiftKey?e.altey||e.ctrlKey||e.shiftKey||!this.keyboard.applicationCursor?"[H":"OH":(this.keyboard.terminal.scrollHome(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyEnd_=function(e){return!this.keyboard.homeKeysScroll^e.shiftKey?e.altKey||e.ctrlKey||e.shiftKey||!this.keyboard.applicationCursor?"[F":"OF":(this.keyboard.terminal.scrollEnd(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyPageUp_=function(e){return!this.keyboard.pageKeysScroll^e.shiftKey?"[5~":(this.keyboard.terminal.scrollPageUp(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyDel_=function(e){return this.keyboard.altBackspaceIsMetaBackspace&&this.keyboard.altKeyPressed&&!e.altKey?"":"[3~"},hterm.Keyboard.KeyMap.prototype.onKeyPageDown_=function(e){return!this.keyboard.pageKeysScroll^e.shiftKey?"[6~":(this.keyboard.terminal.scrollPageDown(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onClear_=function(e,t){return this.keyboard.terminal.wipeContents(),hterm.Keyboard.KeyActions.CANCEL},hterm.Keyboard.KeyMap.prototype.onCtrlNum_=function(e,t){function r(e){return String.fromCharCode(e.charCodeAt(0)-64)}if(this.keyboard.terminal.passCtrlNumber&&!e.shiftKey)return hterm.Keyboard.KeyActions.PASS;switch(t.keyCap.substr(0,1)){case"1":return"1";case"2":return r("@");case"3":return r("[");case"4":return r("\\");case"5":return r("]");case"6":return r("^");case"7":return r("_");case"8":return"";case"9":return"9"}},hterm.Keyboard.KeyMap.prototype.onAltNum_=function(e,t){return this.keyboard.terminal.passAltNumber&&!e.shiftKey?hterm.Keyboard.KeyActions.PASS:hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onMetaNum_=function(e,t){return this.keyboard.terminal.passMetaNumber&&!e.shiftKey?hterm.Keyboard.KeyActions.PASS:hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onCtrlC_=function(e,t){var r=this.keyboard.terminal.getDocument().getSelection();if(!r.isCollapsed){if(this.keyboard.ctrlCCopy&&!e.shiftKey)return this.keyboard.terminal.clearSelectionAfterCopy&&setTimeout(r.collapseToEnd.bind(r),50),this.keyboard.terminal.prefs_.get("enable-clipboard-notice")&&setTimeout(this.keyboard.terminal.showOverlay.bind(this.keyboard.terminal,hterm.notifyCopyMessage,500),200),hterm.Keyboard.KeyActions.PASS;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}return""},hterm.Keyboard.KeyMap.prototype.onCtrlN_=function(e,t){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):""},hterm.Keyboard.KeyMap.prototype.onCtrlV_=function(e,t){return!e.shiftKey&&this.keyboard.ctrlVPaste||e.shiftKey&&!this.keyboard.ctrlVPaste?hterm.Keyboard.KeyActions.PASS:""},hterm.Keyboard.KeyMap.prototype.onMetaN_=function(e,t){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},hterm.Keyboard.KeyMap.prototype.onMetaC_=function(e,t){var r=this.keyboard.terminal.getDocument();return e.shiftKey||r.getSelection().isCollapsed?t.keyCap.substr(e.shiftKey?1:0,1):(this.keyboard.terminal.clearSelectionAfterCopy&&setTimeout(function(){r.getSelection().collapseToEnd()},50),hterm.Keyboard.KeyActions.PASS)},hterm.Keyboard.KeyMap.prototype.onMetaV_=function(e,t){return e.shiftKey?hterm.Keyboard.KeyActions.PASS:this.keyboard.passMetaV?hterm.Keyboard.KeyActions.PASS:hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onPlusMinusZero_=function(e,t){if(!(this.keyboard.ctrlPlusMinusZeroZoom^e.shiftKey))return"-_"==t.keyCap?"":hterm.Keyboard.KeyActions.CANCEL;if(1!=this.keyboard.terminal.getZoomFactor())return hterm.Keyboard.KeyActions.PASS;var r=t.keyCap.substr(0,1);if("0"==r)this.keyboard.terminal.setFontSize(0);else{var o=this.keyboard.terminal.getFontSize();"-"==r?o-=1:o+=1,this.keyboard.terminal.setFontSize(o)}return hterm.Keyboard.KeyActions.CANCEL},hterm.Options=function(e){this.wraparound=!e||e.wraparound,this.reverseWraparound=!!e&&e.reverseWraparound,this.originMode=!!e&&e.originMode,this.autoCarriageReturn=!!e&&e.autoCarriageReturn,this.cursorVisible=!!e&&e.cursorVisible,this.cursorBlink=!!e&&e.cursorBlink,this.insertMode=!!e&&e.insertMode,this.reverseVideo=!!e&&e.reverseVideo,this.bracketedPaste=!!e&&e.bracketedPaste},lib.rtdep("lib.f","lib.Storage"),hterm.PreferenceManager=function(e){lib.PreferenceManager.call(this,hterm.defaultStorage,"/hterm/profiles/"+e);var t=hterm.PreferenceManager.defaultPreferences;Object.keys(t).forEach(function(e){this.definePreference(e,t[e])}.bind(this))},hterm.PreferenceManager.defaultPreferences={"alt-gr-mode":null,"alt-backspace-is-meta-backspace":!1,"alt-is-meta":!1,"alt-sends-what":"escape","audible-bell-sound":"lib-resource:hterm/audio/bell","desktop-notification-bell":!1,"background-color":"rgb(16, 16, 16)","background-image":"","background-size":"","background-position":"","backspace-sends-backspace":!1,"character-map-overrides":null,"close-on-exit":!0,"cursor-blink":!1,"cursor-blink-cycle":[1e3,500],"cursor-color":"rgba(255, 0, 0, 0.5)","color-palette-overrides":null,"copy-on-select":!0,"use-default-window-copy":!1,"clear-selection-after-copy":!0,"ctrl-plus-minus-zero-zoom":!0,"ctrl-c-copy":!1,"ctrl-v-paste":!1,"east-asian-ambiguous-as-two-column":!1,"enable-8-bit-control":!1,"enable-bold":null,"enable-bold-as-bright":!0,"enable-clipboard-notice":!0,"enable-clipboard-write":!0,"enable-dec12":!1,environment:{TERM:"xterm-256color"},"font-family":'"DejaVu Sans Mono", "Everson Mono", FreeMono, "Menlo", "Terminal", monospace',"font-size":15,"font-smoothing":"antialiased","foreground-color":"rgb(240, 240, 240)","home-keys-scroll":!1,"max-string-sequence":1e5,"media-keys-are-fkeys":!1,"meta-sends-escape":!0,"mouse-paste-button":null,"page-keys-scroll":!1,"pass-alt-number":null,"pass-ctrl-number":null,"pass-meta-number":null,"pass-meta-v":!0,"receive-encoding":"utf-8","scroll-on-keystroke":!0,"scroll-on-output":!1,"scrollbar-visible":!0,"scroll-wheel-move-multiplier":1,"send-encoding":"utf-8","shift-insert-paste":!0,"user-css":""},hterm.PreferenceManager.prototype={__proto__:lib.PreferenceManager.prototype},hterm.PubSub=function(){this.observers_={}},hterm.PubSub.addBehavior=function(e){var t=new hterm.PubSub;for(var r in hterm.PubSub.prototype)e[r]=hterm.PubSub.prototype[r].bind(t)},hterm.PubSub.prototype.subscribe=function(e,t){e in this.observers_||(this.observers_[e]=[]),this.observers_[e].push(t)},hterm.PubSub.prototype.unsubscribe=function(e,t){var r=this.observers_[e];if(!r)throw"Invalid subject: "+e;var o=r.indexOf(t);if(o<0)throw"Not subscribed: "+e;r.splice(o,1)},hterm.PubSub.prototype.publish=function(e,t,r){function o(e){e<i.length-1&&setTimeout(o,0,e+1),i[e](t)}var i=this.observers_[e];i&&(i=[].concat(i)),r&&(i?i.push(r):i=[r]),i&&setTimeout(o,0,0)},lib.rtdep("lib.f","lib.wc","hterm.RowCol","hterm.Size","hterm.TextAttributes"),hterm.Screen=function(e){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},hterm.Screen.prototype.getSize=function(){return new hterm.Size(this.columnCount_,this.rowsArray.length)},hterm.Screen.prototype.getHeight=function(){return this.rowsArray.length},hterm.Screen.prototype.getWidth=function(){return this.columnCount_},hterm.Screen.prototype.setColumnCount=function(e){this.columnCount_=e,this.cursorPosition.column>=e&&this.setCursorPosition(this.cursorPosition.row,e-1)},hterm.Screen.prototype.shiftRow=function(){return this.shiftRows(1)[0]},hterm.Screen.prototype.shiftRows=function(e){return this.rowsArray.splice(0,e)},hterm.Screen.prototype.unshiftRow=function(e){this.rowsArray.splice(0,0,e)},hterm.Screen.prototype.unshiftRows=function(e){this.rowsArray.unshift.apply(this.rowsArray,e)},hterm.Screen.prototype.popRow=function(){return this.popRows(1)[0]},hterm.Screen.prototype.popRows=function(e){return this.rowsArray.splice(this.rowsArray.length-e,e)},hterm.Screen.prototype.pushRow=function(e){this.rowsArray.push(e)},hterm.Screen.prototype.pushRows=function(e){e.push.apply(this.rowsArray,e)},hterm.Screen.prototype.insertRow=function(e,t){this.rowsArray.splice(e,0,t)},hterm.Screen.prototype.insertRows=function(e,t){for(var r=0;r<t.length;r++)this.rowsArray.splice(e+r,0,t[r])},hterm.Screen.prototype.removeRow=function(e){return this.rowsArray.splice(e,1)[0]},hterm.Screen.prototype.removeRows=function(e,t){return this.rowsArray.splice(e,t)},hterm.Screen.prototype.invalidateCursorPosition=function(){this.cursorPosition.move(0,0),this.cursorRowNode_=null,this.cursorNode_=null,this.cursorOffset_=null},hterm.Screen.prototype.clearCursorRow=function(){this.cursorRowNode_.innerHTML="",this.cursorRowNode_.removeAttribute("line-overflow"),this.cursorOffset_=0,this.cursorPosition.column=0,this.cursorPosition.overflow=!1;var e;e=this.textAttributes.isDefault()?"":lib.f.getWhitespace(this.columnCount_);var t=this.textAttributes.inverse;this.textAttributes.inverse=!1,this.textAttributes.syncColors();var r=this.textAttributes.createContainer(e);this.cursorRowNode_.appendChild(r),this.cursorNode_=r,this.textAttributes.inverse=t,this.textAttributes.syncColors()},hterm.Screen.prototype.commitLineOverflow=function(){this.cursorRowNode_.setAttribute("line-overflow",!0)},hterm.Screen.prototype.setCursorPosition=function(e,t){if(this.rowsArray.length){e>=this.rowsArray.length?(console.error("Row out of bounds: "+e),e=this.rowsArray.length-1):e<0&&(console.error("Row out of bounds: "+e),e=0),t>=this.columnCount_?(console.error("Column out of bounds: "+t),t=this.columnCount_-1):t<0&&(console.error("Column out of bounds: "+t),t=0),this.cursorPosition.overflow=!1;var r=this.rowsArray[e],o=r.firstChild;o||(o=r.ownerDocument.createTextNode(""),r.appendChild(o));var i=0;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;){var s=t-i,n=hterm.TextAttributes.nodeWidth(o);if(!o.nextSibling||n>s)return this.cursorNode_=o,void(this.cursorOffset_=s);i+=n,o=o.nextSibling}}else console.warn("Attempt to set cursor position on empty screen.")},hterm.Screen.prototype.syncSelectionCaret=function(e){try{e.collapse(this.cursorNode_,this.cursorOffset_)}catch(e){}},hterm.Screen.prototype.splitNode_=function(e,t){var r=e.cloneNode(!1),o=e.textContent;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)},hterm.Screen.prototype.maybeClipCurrentRow=function(){var e=hterm.TextAttributes.nodeWidth(this.cursorRowNode_);if(e<=this.columnCount_)this.cursorPosition.column>=this.columnCount_&&(this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1),this.cursorPosition.overflow=!0);else{var t=this.cursorPosition.column;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));for(var r=this.cursorRowNode_,o=this.cursorNode_.nextSibling;o;)r.removeChild(o),o=this.cursorNode_.nextSibling;t<this.columnCount_?this.setCursorPosition(this.cursorPosition.row,t):this.cursorPosition.overflow=!0}},hterm.Screen.prototype.insertString=function(e){var t=this.cursorNode_,r=t.textContent;this.cursorRowNode_.removeAttribute("line-overflow");var o=lib.wc.strWidth(e);this.cursorPosition.column+=o;var i=this.cursorOffset_,s=hterm.TextAttributes.nodeWidth(t)-i;if(s<0){var n=lib.f.getWhitespace(-s);if(this.textAttributes.underline||this.textAttributes.strikethrough||this.textAttributes.background||this.textAttributes.wcNode||null!=this.textAttributes.tileData)if(3!=t.nodeType&&(t.wcNode||t.tileNode||t.style.textDecoration||t.style.backgroundColor)){var a=t.ownerDocument.createTextNode(n);this.cursorRowNode_.insertBefore(a,t.nextSibling),this.cursorNode_=t=a,this.cursorOffset_=i=-s,r=n}else t.textContent=r+=n;else e=n+e;s=0}if(this.textAttributes.matchesContainer(t))return t.textContent=0==s?r+e:0==i?e+r:hterm.TextAttributes.nodeSubstr(t,0,i)+e+hterm.TextAttributes.nodeSubstr(t,i),void(this.cursorOffset_+=o);if(0==i){var l=t.previousSibling;if(l&&this.textAttributes.matchesContainer(l))return l.textContent+=e,this.cursorNode_=l,void(this.cursorOffset_=lib.wc.strWidth(l.textContent));c=this.textAttributes.createContainer(e);return this.cursorRowNode_.insertBefore(c,t),this.cursorNode_=c,void(this.cursorOffset_=o)}if(0==s){var h=t.nextSibling;if(h&&this.textAttributes.matchesContainer(h))return h.textContent=e+h.textContent,this.cursorNode_=h,void(this.cursorOffset_=lib.wc.strWidth(e));c=this.textAttributes.createContainer(e);return this.cursorRowNode_.insertBefore(c,h),this.cursorNode_=c,void(this.cursorOffset_=hterm.TextAttributes.nodeWidth(c))}this.splitNode_(t,i);var c=this.textAttributes.createContainer(e);this.cursorRowNode_.insertBefore(c,t.nextSibling),this.cursorNode_=c,this.cursorOffset_=o},hterm.Screen.prototype.overwriteString=function(e){var t=this.columnCount_-this.cursorPosition.column;if(!t)return[e];var r=lib.wc.strWidth(e);if(this.textAttributes.matchesContainer(this.cursorNode_)&&this.cursorNode_.textContent.substr(this.cursorOffset_)==e)return this.cursorOffset_+=r,void(this.cursorPosition.column+=r);this.deleteChars(Math.min(r,t)),this.insertString(e)},hterm.Screen.prototype.deleteChars=function(e){var t=this.cursorNode_,r=this.cursorOffset_,o=this.cursorPosition.column;if(!(e=Math.min(e,this.columnCount_-o)))return 0;for(var i,s,n=e;t&&e;){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,r<i&&s&&i==s){var a=this.textAttributes.createContainer(" ");t.parentNode.insertBefore(a,t.nextSibling),t.textContent="",s=0,e-=1}var l=t.nextSibling;0==s&&t!=this.cursorNode_&&t.parentNode.removeChild(t),t=l,r=0}if(3!=this.cursorNode_.nodeType&&!this.cursorNode_.textContent){var h=this.cursorNode_;if(h.previousSibling)this.cursorNode_=h.previousSibling,this.cursorOffset_=hterm.TextAttributes.nodeWidth(h.previousSibling);else if(h.nextSibling)this.cursorNode_=h.nextSibling,this.cursorOffset_=0;else{var c=this.cursorRowNode_.ownerDocument.createTextNode("");this.cursorRowNode_.appendChild(c),this.cursorNode_=c,this.cursorOffset_=0}this.cursorRowNode_.removeChild(h)}return n},hterm.Screen.prototype.getLineStartRow_=function(e){for(;e.previousSibling&&e.previousSibling.hasAttribute("line-overflow");)e=e.previousSibling;return e},hterm.Screen.prototype.getLineText_=function(e){for(var t="";e&&(t+=e.textContent,e.hasAttribute("line-overflow"));)e=e.nextSibling;return t},hterm.Screen.prototype.getXRowAncestor_=function(e){for(;e&&"X-ROW"!==e.nodeName;)e=e.parentNode;return e},hterm.Screen.prototype.getPositionWithOverflow_=function(e,t,r){if(!t)return-1;var o=this.getXRowAncestor_(t);if(!o)return-1;for(var i=0;o!=e;){if(i+=hterm.TextAttributes.nodeWidth(e),!e.hasAttribute("line-overflow")||!e.nextSibling)return-1;e=e.nextSibling}return i+this.getPositionWithinRow_(e,t,r)},hterm.Screen.prototype.getPositionWithinRow_=function(e,t,r){if(t.parentNode!=e)return this.getPositionWithinRow_(t.parentNode,t,r)+this.getPositionWithinRow_(e,t.parentNode,0);for(var o=0,i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(s==t)return o+r;o+=hterm.TextAttributes.nodeWidth(s)}return-1},hterm.Screen.prototype.getNodeAndOffsetWithOverflow_=function(e,t){for(;e&&t>hterm.TextAttributes.nodeWidth(e);){if(!e.hasAttribute("line-overflow")||!e.nextSibling)return-1;t-=hterm.TextAttributes.nodeWidth(e),e=e.nextSibling}return this.getNodeAndOffsetWithinRow_(e,t)},hterm.Screen.prototype.getNodeAndOffsetWithinRow_=function(e,t){for(var r=0;r<e.childNodes.length;r++){var o=e.childNodes[r],i=hterm.TextAttributes.nodeWidth(o);if(t<=i)return"SPAN"===o.nodeName?this.getNodeAndOffsetWithinRow_(o,t):[o,t];t-=i}return null},hterm.Screen.prototype.setRange_=function(e,t,r,o){var i=this.getNodeAndOffsetWithOverflow_(e,t);if(null!=i){var s=this.getNodeAndOffsetWithOverflow_(e,r);null!=s&&(o.setStart(i[0],i[1]),o.setEnd(s[0],s[1]))}},hterm.Screen.prototype.expandSelection=function(e){if(e){var t=e.getRangeAt(0);if(t&&!t.toString().match(/\s/)){var r=this.getLineStartRow_(this.getXRowAncestor_(t.startContainer));if(r){var o=this.getPositionWithOverflow_(r,t.startContainer,t.startOffset);if(-1!=o){var i=this.getPositionWithOverflow_(r,t.endContainer,t.endOffset);if(-1!=i){var s=this.getLineText_(r),n=lib.wc.substring(s,0,i),a=new RegExp("[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:`][^\\s\\[\\](){}<>\"'\\^]*$"),l=n.search(a);if(!(-1==l||l>o)){var h=lib.wc.substring(s,o,lib.wc.strWidth(s)),c=new RegExp("^[^\\s\\[\\](){}<>\"'\\^]*[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:~.`]"),u=h.match(c);if(u){var g=o+lib.wc.strWidth(u[0]);-1==g||g<i||(this.setRange_(r,l,g,t),e.addRange(t))}}}}}}}},lib.rtdep("lib.f","hterm.PubSub","hterm.Size"),hterm.ScrollPort=function(e){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},hterm.ScrollPort.Selection=function(e){this.scrollPort_=e,this.startRow=null,this.endRow=null,this.isMultiline=null,this.isCollapsed=null},hterm.ScrollPort.Selection.prototype.findFirstChild=function(e,t){for(var r=e.firstChild;r;){if(-1!=t.indexOf(r))return r;if(r.childNodes.length){var o=this.findFirstChild(r,t);if(o)return o}r=r.nextSibling}return null},hterm.ScrollPort.Selection.prototype.sync=function(){function e(){r.startRow=i,r.startNode=o.anchorNode,r.startOffset=o.anchorOffset,r.endRow=s,r.endNode=o.focusNode,r.endOffset=o.focusOffset}function t(){r.startRow=s,r.startNode=o.focusNode,r.startOffset=o.focusOffset,r.endRow=i,r.endNode=o.anchorNode,r.endOffset=o.anchorOffset}var r=this,o=this.scrollPort_.getDocument().getSelection();if(this.startRow=null,this.endRow=null,this.isMultiline=null,this.isCollapsed=!o||o.isCollapsed,!this.isCollapsed){for(var i=o.anchorNode;i&&!("rowIndex"in i);)i=i.parentNode;if(i){for(var s=o.focusNode;s&&!("rowIndex"in s);)s=s.parentNode;if(s){if(i.rowIndex<s.rowIndex)e();else if(i.rowIndex>s.rowIndex)t();else if(o.focusNode==o.anchorNode)o.anchorOffset<o.focusOffset?e():t();else{var n=this.findFirstChild(i,[o.anchorNode,o.focusNode]);if(!n)throw new Error("Unexpected error syncing selection.");n==o.anchorNode?e():t()}this.isMultiline=i.rowIndex!=s.rowIndex}else console.error("Selection focus is not rooted in a row node: "+o.focusNode.nodeName)}else console.error("Selection anchor is not rooted in a row node: "+o.anchorNode.nodeName)}},hterm.ScrollPort.prototype.decorate=function(e){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));var t=this.document_=this.iframe_.contentDocument;t.body.style.cssText="margin: 0px;padding: 0px;height: 100%;width: 100%;overflow: hidden;-webkit-user-select: none;-moz-user-select: none;";var r=t.createElement("style");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("contenteditable","true"),this.screen_.setAttribute("spellcheck","false"),this.screen_.setAttribute("autocorrect","false"),this.screen_.setAttribute("autocomplete","false"),this.screen_.setAttribute("role","textbox"),this.screen_.setAttribute("tabindex","-1"),this.screen_.style.cssText="display: block;font-family: monospace;font-size: 15px;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_),this.svg_=this.div_.ownerDocument.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg_.setAttribute("xmlns","http://www.w3.org/2000/svg"),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()},hterm.ScrollPort.prototype.setFontFamily=function(e,t){this.screen_.style.fontFamily=e,this.screen_.style.webkitFontSmoothing=t||"",this.syncCharacterSize()},hterm.ScrollPort.prototype.getFontFamily=function(){return this.screen_.style.fontFamily},hterm.ScrollPort.prototype.setUserCss=function(e){e?(this.userCssLink_.setAttribute("href",e),this.userCssLink_.parentNode||this.document_.head.appendChild(this.userCssLink_)):this.userCssLink_.parentNode&&this.document_.head.removeChild(this.userCssLink_)},hterm.ScrollPort.prototype.focus=function(){this.iframe_.focus(),this.screen_.focus()},hterm.ScrollPort.prototype.getForegroundColor=function(){return this.screen_.style.color},hterm.ScrollPort.prototype.setForegroundColor=function(e){},hterm.ScrollPort.prototype.getBackgroundColor=function(){return this.screen_.style.backgroundColor},hterm.ScrollPort.prototype.setBackgroundColor=function(e){this.screen_.style.backgroundColor=e},hterm.ScrollPort.prototype.setBackgroundImage=function(e){this.screen_.style.backgroundImage=e},hterm.ScrollPort.prototype.setBackgroundSize=function(e){this.screen_.style.backgroundSize=e},hterm.ScrollPort.prototype.setBackgroundPosition=function(e){this.screen_.style.backgroundPosition=e},hterm.ScrollPort.prototype.setCtrlVPaste=function(e){this.ctrlVPaste=e},hterm.ScrollPort.prototype.getScreenSize=function(){var e=hterm.getClientSize(this.screen_);return{height:e.height,width:e.width-this.currentScrollbarWidthPx}},hterm.ScrollPort.prototype.getScreenWidth=function(){return this.getScreenSize().width},hterm.ScrollPort.prototype.getScreenHeight=function(){return this.getScreenSize().height},hterm.ScrollPort.prototype.getDocument=function(){return this.document_},hterm.ScrollPort.prototype.getScreenNode=function(){return this.screen_},hterm.ScrollPort.prototype.resetCache=function(){this.currentRowNodeCache_=null,this.previousRowNodeCache_={}},hterm.ScrollPort.prototype.setRowProvider=function(e){this.resetCache(),this.rowProvider_=e,this.scheduleRedraw()},hterm.ScrollPort.prototype.invalidate=function(){for(var e=this.topFold_.nextSibling;e!=this.bottomFold_;){var t=e.nextSibling;e.parentElement.removeChild(e),e=t}this.previousRowNodeCache_=null;var r=this.getTopRowIndex(),o=this.getBottomRowIndex(r);this.drawVisibleRows_(r,o)},hterm.ScrollPort.prototype.scheduleInvalidate=function(){if(!this.timeouts_.invalidate){var e=this;this.timeouts_.invalidate=setTimeout(function(){delete e.timeouts_.invalidate,e.invalidate()},0)}},hterm.ScrollPort.prototype.setFontSize=function(e){this.screen_.style.fontSize=e+"px",this.syncCharacterSize()},hterm.ScrollPort.prototype.getFontSize=function(){return parseInt(this.screen_.style.fontSize)},hterm.ScrollPort.prototype.measureCharacterSize=function(e){this.ruler_||(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"),this.rulerSpan_.textContent="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",this.ruler_.appendChild(this.rulerSpan_),this.rulerBaseline_=this.document_.createElement("span"),this.rulerBaseline_.style.fontSize="0px",this.rulerBaseline_.textContent="X"),this.rulerSpan_.style.fontWeight=e||"",this.rowNodes_.appendChild(this.ruler_);var t=hterm.getClientSize(this.rulerSpan_),r=new hterm.Size(t.width/this.ruler_.textContent.length,t.height);return this.ruler_.appendChild(this.rulerBaseline_),r.baseline=this.rulerBaseline_.offsetTop,this.ruler_.removeChild(this.rulerBaseline_),this.rowNodes_.removeChild(this.ruler_),this.div_.ownerDocument.body.appendChild(this.svg_),r.zoomFactor=this.svg_.currentScale,this.div_.ownerDocument.body.removeChild(this.svg_),r},hterm.ScrollPort.prototype.syncCharacterSize=function(){this.characterSize=this.measureCharacterSize();var e=this.characterSize.height+"px";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")},hterm.ScrollPort.prototype.resize=function(){this.currentScrollbarWidthPx=hterm.getClientWidth(this.screen_)-this.screen_.clientWidth,this.syncScrollHeight(),this.syncRowNodesDimensions_();var e=this;this.publish("resize",{scrollPort:this},function(){e.scrollRowToBottom(e.rowProvider_.getRowCount()),e.scheduleRedraw()})},hterm.ScrollPort.prototype.syncRowNodesDimensions_=function(){var e=this.getScreenSize();this.lastScreenWidth_=e.width,this.lastScreenHeight_=e.height,this.visibleRowCount=lib.f.smartFloorDivide(e.height,this.characterSize.height);var t=this.visibleRowCount*this.characterSize.height;this.visibleRowTopMargin=0,this.visibleRowBottomMargin=e.height-t,this.topFold_.style.marginBottom=this.visibleRowTopMargin+"px";for(var r=0,o=this.topFold_.previousSibling;o;)r+=hterm.getClientHeight(o),o=o.previousSibling;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"},hterm.ScrollPort.prototype.syncScrollHeight=function(){this.lastRowCount_=this.rowProvider_.getRowCount(),this.scrollArea_.style.height=this.characterSize.height*this.lastRowCount_+this.visibleRowTopMargin+this.visibleRowBottomMargin+"px"},hterm.ScrollPort.prototype.scheduleRedraw=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout(function(){delete e.timeouts_.redraw,e.redraw_()},0)}},hterm.ScrollPort.prototype.redraw_=function(){this.resetSelectBags_(),this.selection.sync(),this.syncScrollHeight(),this.currentRowNodeCache_={};var e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);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_},hterm.ScrollPort.prototype.drawTopFold_=function(e){if(!this.selection.startRow||this.selection.startRow.rowIndex>=e)this.rowNodes_.firstChild!=this.topFold_&&this.rowNodes_.insertBefore(this.topFold_,this.rowNodes_.firstChild);else{if(!this.selection.isMultiline||this.selection.endRow.rowIndex>=e)this.selection.startRow.nextSibling!=this.topFold_&&this.rowNodes_.insertBefore(this.topFold_,this.selection.startRow.nextSibling);else 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);for(;this.rowNodes_.firstChild!=this.selection.startRow;)this.rowNodes_.removeChild(this.rowNodes_.firstChild)}},hterm.ScrollPort.prototype.drawBottomFold_=function(e){if(!this.selection.endRow||this.selection.endRow.rowIndex<=e)this.rowNodes_.lastChild!=this.bottomFold_&&this.rowNodes_.appendChild(this.bottomFold_);else{if(!this.selection.isMultiline||this.selection.startRow.rowIndex<=e)this.bottomFold_.nextSibling!=this.selection.endRow&&this.rowNodes_.insertBefore(this.bottomFold_,this.selection.endRow);else 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);for(;this.rowNodes_.lastChild!=this.selection.endRow;)this.rowNodes_.removeChild(this.rowNodes_.lastChild)}},hterm.ScrollPort.prototype.drawVisibleRows_=function(e,t){function r(e,t){for(;e!=t;){if(!e)throw"Did not encounter target node";if(e==o.bottomFold_)throw"Encountered bottom fold before target node";var r=e;e=e.nextSibling,r.parentNode.removeChild(r)}}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;h<l;h++){var c=e+h;if(a!=n)if(a.rowIndex!=c)if(i&&i.rowIndex==c)r(a,i),a=i.nextSibling;else if(s&&s.rowIndex==c)r(a,s),a=s.nextSibling;else if(a!=i&&a!=s){var u=this.fetchRowNode_(c);if(!u){console.log("Couldn't fetch row index: "+c);break}a!=u?(this.rowNodes_.insertBefore(u,a),u.nextSibling,this.rowNodes_.removeChild(a),a=u.nextSibling):a=a.nextSibling}else{if(!(u=this.fetchRowNode_(c))){console.log("Couldn't fetch row index: "+c);break}this.rowNodes_.insertBefore(u,a)}else a=a.nextSibling;else{if(!(u=this.fetchRowNode_(c))){console.log("Couldn't fetch row index: "+c);break}this.rowNodes_.insertBefore(u,a)}}a!=this.bottomFold_&&r(a,n)},hterm.ScrollPort.prototype.resetSelectBags_=function(){this.topSelectBag_.parentNode&&(this.topSelectBag_.textContent="",this.topSelectBag_.parentNode.removeChild(this.topSelectBag_)),this.bottomSelectBag_.parentNode&&(this.bottomSelectBag_.textContent="",this.bottomSelectBag_.parentNode.removeChild(this.bottomSelectBag_))},hterm.ScrollPort.prototype.cacheRowNode_=function(e){this.currentRowNodeCache_[e.rowIndex]=e},hterm.ScrollPort.prototype.fetchRowNode_=function(e){var t;return t=this.previousRowNodeCache_&&e in this.previousRowNodeCache_?this.previousRowNodeCache_[e]:this.rowProvider_.getRowNode(e),this.currentRowNodeCache_&&this.cacheRowNode_(t),t},hterm.ScrollPort.prototype.selectAll=function(){var e;if(0!=this.topFold_.nextSibling.rowIndex){for(;this.topFold_.previousSibling;)this.rowNodes_.removeChild(this.topFold_.previousSibling);e=this.fetchRowNode_(0),this.rowNodes_.insertBefore(e,this.topFold_),this.syncRowNodesDimensions_()}else e=this.topFold_.nextSibling;var t,r=this.rowProvider_.getRowCount()-1;if(this.bottomFold_.previousSibling.rowIndex!=r){for(;this.bottomFold_.nextSibling;)this.rowNodes_.removeChild(this.bottomFold_.nextSibling);t=this.fetchRowNode_(r),this.rowNodes_.appendChild(t)}else t=this.bottomFold_.previousSibling.rowIndex;var o=this.document_.getSelection();o.collapse(e,0),o.extend(t,t.childNodes.length),this.selection.sync()},hterm.ScrollPort.prototype.getScrollMax_=function(e){return hterm.getClientHeight(this.scrollArea_)+this.visibleRowTopMargin+this.visibleRowBottomMargin-hterm.getClientHeight(this.screen_)},hterm.ScrollPort.prototype.scrollRowToTop=function(e){this.syncScrollHeight(),this.isScrolledEnd=e+this.visibleRowCount>=this.lastRowCount_;var t=e*this.characterSize.height+this.visibleRowTopMargin,r=this.getScrollMax_();t>r&&(t=r),this.screen_.scrollTop!=t&&(this.screen_.scrollTop=t,this.scheduleRedraw())},hterm.ScrollPort.prototype.scrollRowToBottom=function(e){this.syncScrollHeight(),this.isScrolledEnd=e+this.visibleRowCount>=this.lastRowCount_;var t=e*this.characterSize.height+this.visibleRowTopMargin+this.visibleRowBottomMargin;(t-=this.visibleRowCount*this.characterSize.height)<0&&(t=0),this.screen_.scrollTop!=t&&(this.screen_.scrollTop=t)},hterm.ScrollPort.prototype.getTopRowIndex=function(){return lib.f.smartFloorDivide(this.screen_.scrollTop,this.characterSize.height)},hterm.ScrollPort.prototype.getBottomRowIndex=function(e){return e+this.visibleRowCount-1},hterm.ScrollPort.prototype.onScroll_=function(e){var t=this.getScreenSize();t.width==this.lastScreenWidth_&&t.height==this.lastScreenHeight_?(this.redraw_(),this.publish("scroll",{scrollPort:this})):this.resize()},hterm.ScrollPort.prototype.onScrollWheel=function(e){},hterm.ScrollPort.prototype.onScrollWheel_=function(e){if(this.onScrollWheel(e),!e.defaultPrevented){var t="DOMMouseScroll"==e.type?-1*e.detail:e.wheelDeltaY;t*=this.scrollWheelMultiplier_;var r=this.screen_.scrollTop-t;r<0&&(r=0);var o=this.getScrollMax_();r>o&&(r=o),r!=this.screen_.scrollTop&&(this.screen_.scrollTop=r,e.preventDefault())}},hterm.ScrollPort.prototype.onResize_=function(e){this.syncCharacterSize(),this.resize()},hterm.ScrollPort.prototype.onCopy=function(e){},hterm.ScrollPort.prototype.onCopy_=function(e){if(this.onCopy(e),!e.defaultPrevented&&(this.resetSelectBags_(),this.selection.sync(),this.selection.startRow&&!(this.selection.endRow.rowIndex-this.selection.startRow.rowIndex<2))){var t=this.getTopRowIndex(),r=this.getBottomRowIndex(t);if(this.selection.startRow.rowIndex<t){var o;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_()}if(this.selection.endRow.rowIndex>r){var i;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)}}},hterm.ScrollPort.prototype.onBodyKeyDown_=function(e){if(this.ctrlVPaste){var t=String.fromCharCode(e.which).toLowerCase();(e.ctrlKey||e.metaKey)&&"v"==t&&this.pasteTarget_.focus()}},hterm.ScrollPort.prototype.onPaste_=function(e){this.pasteTarget_.focus();var t=this;setTimeout(function(){t.publish("paste",{text:t.pasteTarget_.value}),t.pasteTarget_.value="",t.screen_.focus()},0)},hterm.ScrollPort.prototype.handlePasteTargetTextInput_=function(e){e.stopPropagation()},hterm.ScrollPort.prototype.setScrollbarVisible=function(e){this.screen_.style.overflowY=e?"scroll":"hidden"},hterm.ScrollPort.prototype.setScrollWheelMoveMultipler=function(e){this.scrollWheelMultiplier_=e},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){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.reportMouseEvents_=!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(){this.onTerminalReady()}.bind(this))},hterm.Terminal.cursorShape={BLOCK:"BLOCK",BEAM:"BEAM",UNDERLINE:"UNDERLINE"},hterm.Terminal.prototype.onTerminalReady=function(){},hterm.Terminal.prototype.tabWidth=8,hterm.Terminal.prototype.setProfile=function(e,t){this.profileId_=e.replace(/\//g,"");var r=this;this.prefs_&&this.prefs_.deactivate(),this.prefs_=new hterm.PreferenceManager(this.profileId_),this.prefs_.addObservers(null,{"alt-gr-mode":function(e){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},"alt-backspace-is-meta-backspace":function(e){r.keyboard.altBackspaceIsMetaBackspace=e},"alt-is-meta":function(e){r.keyboard.altIsMeta=e},"alt-sends-what":function(e){/^(escape|8-bit|browser-key)$/.test(e)||(e="escape"),r.keyboard.altSendsWhat=e},"audible-bell-sound":function(e){var t=e.match(/^lib-resource:(\S+)/);t?r.bellAudio_.setAttribute("src",lib.resource.getDataUrl(t[1])):r.bellAudio_.setAttribute("src",e)},"desktop-notification-bell":function(e){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},"background-color":function(e){r.setBackgroundColor(e)},"background-image":function(e){r.scrollPort_.setBackgroundImage(e)},"background-size":function(e){r.scrollPort_.setBackgroundSize(e)},"background-position":function(e){r.scrollPort_.setBackgroundPosition(e)},"backspace-sends-backspace":function(e){r.keyboard.backspaceSendsBackspace=e},"character-map-overrides":function(e){if(null==e||e instanceof Object)for(var t in e){var r=hterm.VT.CharacterMap.maps[t].glmap;for(var o in e[t])r[o]=e[t][o];hterm.VT.CharacterMap.maps[t].reset(r)}else console.warn("Preference character-map-modifications is not an object: "+e)},"cursor-blink":function(e){r.setCursorBlink(!!e)},"cursor-blink-cycle":function(e){e instanceof Array&&"number"==typeof e[0]&&"number"==typeof e[1]?r.cursorBlinkCycle_=e:r.cursorBlinkCycle_="number"==typeof e?[e,e]:[100,100]},"cursor-color":function(e){r.setCursorColor(e)},"color-palette-overrides":function(e){if(null==e||e instanceof Object||e instanceof Array){if(lib.colors.colorPalette=lib.colors.stockColorPalette.concat(),e)for(var t in e){var o=parseInt(t);if(isNaN(o)||o<0||o>255)console.log("Invalid value in palette: "+t+": "+e[t]);else if(e[o]){var i=lib.colors.normalizeCSS(e[o]);i&&(lib.colors.colorPalette[o]=i)}}r.primaryScreen_.textAttributes.resetColorPalette(),r.alternateScreen_.textAttributes.resetColorPalette()}else console.warn("Preference color-palette-overrides is not an array or object: "+e)},"copy-on-select":function(e){r.copyOnSelect=!!e},"use-default-window-copy":function(e){r.useDefaultWindowCopy=!!e},"clear-selection-after-copy":function(e){r.clearSelectionAfterCopy=!!e},"ctrl-plus-minus-zero-zoom":function(e){r.keyboard.ctrlPlusMinusZeroZoom=e},"ctrl-c-copy":function(e){r.keyboard.ctrlCCopy=e},"ctrl-v-paste":function(e){r.keyboard.ctrlVPaste=e,r.scrollPort_.setCtrlVPaste(e)},"east-asian-ambiguous-as-two-column":function(e){lib.wc.regardCjkAmbiguous=e},"enable-8-bit-control":function(e){r.vt.enable8BitControl=!!e},"enable-bold":function(e){r.syncBoldSafeState()},"enable-bold-as-bright":function(e){r.primaryScreen_.textAttributes.enableBoldAsBright=!!e,r.alternateScreen_.textAttributes.enableBoldAsBright=!!e},"enable-clipboard-write":function(e){r.vt.enableClipboardWrite=!!e},"enable-dec12":function(e){r.vt.enableDec12=!!e},"font-family":function(e){r.syncFontFamily()},"font-size":function(e){r.setFontSize(e)},"font-smoothing":function(e){r.syncFontFamily()},"foreground-color":function(e){r.setForegroundColor(e)},"home-keys-scroll":function(e){r.keyboard.homeKeysScroll=e},"max-string-sequence":function(e){r.vt.maxStringSequence=e},"media-keys-are-fkeys":function(e){r.keyboard.mediaKeysAreFKeys=e},"meta-sends-escape":function(e){r.keyboard.metaSendsEscape=e},"mouse-paste-button":function(e){r.syncMousePasteButton()},"page-keys-scroll":function(e){r.keyboard.pageKeysScroll=e},"pass-alt-number":function(e){null==e&&(e=!window.navigator.userAgent.match(/Mac OS X/)&&"popup"!=hterm.windowType),r.passAltNumber=e},"pass-ctrl-number":function(e){null==e&&(e=!window.navigator.userAgent.match(/Mac OS X/)&&"popup"!=hterm.windowType),r.passCtrlNumber=e},"pass-meta-number":function(e){null==e&&(e=window.navigator.userAgent.match(/Mac OS X/)&&"popup"!=hterm.windowType),r.passMetaNumber=e},"pass-meta-v":function(e){r.keyboard.passMetaV=e},"receive-encoding":function(e){/^(utf-8|raw)$/.test(e)||(console.warn('Invalid value for "receive-encoding": '+e),e="utf-8"),r.vt.characterEncoding=e},"scroll-on-keystroke":function(e){r.scrollOnKeystroke_=e},"scroll-on-output":function(e){r.scrollOnOutput_=e},"scrollbar-visible":function(e){r.setScrollbarVisible(e)},"scroll-wheel-move-multiplier":function(e){r.setScrollWheelMoveMultipler(e)},"send-encoding":function(e){/^(utf-8|raw)$/.test(e)||(console.warn('Invalid value for "send-encoding": '+e),e="utf-8"),r.keyboard.characterEncoding=e},"shift-insert-paste":function(e){r.keyboard.shiftInsertPaste=e},"user-css":function(e){r.scrollPort_.setUserCss(e)}}),this.prefs_.readStorage(function(){this.prefs_.notifyAll(),t&&t()}.bind(this))},hterm.Terminal.prototype.getPrefs=function(){return this.prefs_},hterm.Terminal.prototype.setBracketedPaste=function(e){this.options_.bracketedPaste=e},hterm.Terminal.prototype.setCursorColor=function(e){this.cursorColor_=e,this.cursorNode_.style.backgroundColor=e,this.cursorNode_.style.borderColor=e},hterm.Terminal.prototype.getCursorColor=function(){return this.cursorColor_},hterm.Terminal.prototype.setSelectionEnabled=function(e){this.enableMouseDragScroll=e},hterm.Terminal.prototype.setBackgroundColor=function(e){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)},hterm.Terminal.prototype.getBackgroundColor=function(){return this.backgroundColor_},hterm.Terminal.prototype.setForegroundColor=function(e){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)},hterm.Terminal.prototype.getForegroundColor=function(){return this.foregroundColor_},hterm.Terminal.prototype.runCommandClass=function(e,t){var r=this.prefs_.get("environment");"object"==(void 0===r?"undefined":_typeof(r))&&null!=r||(r={});var o=this;this.command=new e({argString:t||"",io:this.io.push(),environment:r,onExit:function(e){o.io.pop(),o.uninstallKeyboard(),o.prefs_.get("close-on-exit")&&window.close()}}),this.installKeyboard(),this.command.run()},hterm.Terminal.prototype.isPrimaryScreen=function(){return this.screen_==this.primaryScreen_},hterm.Terminal.prototype.installKeyboard=function(){this.keyboard.installKeyboard(this.scrollPort_.getDocument().body)},hterm.Terminal.prototype.uninstallKeyboard=function(){this.keyboard.installKeyboard(null)},hterm.Terminal.prototype.setFontSize=function(e){0===e&&(e=this.prefs_.get("font-size")),this.scrollPort_.setFontSize(e),this.wcCssRule_&&(this.wcCssRule_.style.width=2*this.scrollPort_.characterSize.width+"px")},hterm.Terminal.prototype.getFontSize=function(){return this.scrollPort_.getFontSize()},hterm.Terminal.prototype.getFontFamily=function(){return this.scrollPort_.getFontFamily()},hterm.Terminal.prototype.syncFontFamily=function(){this.scrollPort_.setFontFamily(this.prefs_.get("font-family"),this.prefs_.get("font-smoothing")),this.syncBoldSafeState()},hterm.Terminal.prototype.syncMousePasteButton=function(){var e=this.prefs_.get("mouse-paste-button");if("number"!=typeof e){var t=navigator.userAgent.match(/\(X11;\s+(\S+)/);t&&"CrOS"!=t[2]?this.mousePasteButton=3:this.mousePasteButton=2}else this.mousePasteButton=e},hterm.Terminal.prototype.syncBoldSafeState=function(){var e=this.prefs_.get("enable-bold");if(null!==e)return this.primaryScreen_.textAttributes.enableBold=e,void(this.alternateScreen_.textAttributes.enableBold=e);var t=this.scrollPort_.measureCharacterSize(),r=this.scrollPort_.measureCharacterSize("bold"),o=t.equals(r);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},hterm.Terminal.prototype.saveCursor=function(){return this.screen_.cursorPosition.clone()},hterm.Terminal.prototype.getTextAttributes=function(){return this.screen_.textAttributes},hterm.Terminal.prototype.setTextAttributes=function(e){this.screen_.textAttributes=e},hterm.Terminal.prototype.getZoomFactor=function(){return this.scrollPort_.characterSize.zoomFactor},hterm.Terminal.prototype.setWindowTitle=function(e){window.document.title=e},hterm.Terminal.prototype.restoreCursor=function(e){var t=lib.f.clamp(e.row,0,this.screenSize.height-1),r=lib.f.clamp(e.column,0,this.screenSize.width-1);this.screen_.setCursorPosition(t,r),(e.column>r||e.column==r&&e.overflow)&&(this.screen_.cursorPosition.overflow=!0)},hterm.Terminal.prototype.clearCursorOverflow=function(){this.screen_.cursorPosition.overflow=!1},hterm.Terminal.prototype.setCursorShape=function(e){this.cursorShape_=e,this.restyleCursor_()},hterm.Terminal.prototype.getCursorShape=function(){return this.cursorShape_},hterm.Terminal.prototype.setWidth=function(e){null!=e?(this.div_.style.width=Math.ceil(this.scrollPort_.characterSize.width*e+this.scrollPort_.currentScrollbarWidthPx)+"px",this.realizeSize_(e,this.screenSize.height),this.scheduleSyncCursorPosition_()):this.div_.style.width="100%"},hterm.Terminal.prototype.setHeight=function(e){null!=e?(this.div_.style.height=this.scrollPort_.characterSize.height*e+"px",this.realizeSize_(this.screenSize.width,e),this.scheduleSyncCursorPosition_()):this.div_.style.height="100%"},hterm.Terminal.prototype.realizeSize_=function(e,t){e!=this.screenSize.width&&this.realizeWidth_(e),t!=this.screenSize.height&&this.realizeHeight_(t),this.io.onTerminalResize_(e,t)},hterm.Terminal.prototype.realizeWidth_=function(e){if(e<=0)throw new Error("Attempt to realize bad width: "+e);var t=e-this.screen_.getWidth();if(this.screenSize.width=e,this.screen_.setColumnCount(e),t>0)this.defaultTabStops&&this.setDefaultTabStops(this.screenSize.width-t);else for(var r=this.tabStops_.length-1;r>=0&&!(this.tabStops_[r]<e);r--)this.tabStops_.pop();this.screen_.setColumnCount(this.screenSize.width)},hterm.Terminal.prototype.realizeHeight_=function(e){if(e<=0)throw new Error("Attempt to realize bad height: "+e);var t=e-this.screen_.getHeight();this.screenSize.height=e;var r=this.saveCursor();if(t<0){for(t*=-1;t;){var o=this.getRowCount()-1;if(o-this.scrollbackRows_.length==r.row)break;if(this.getRowText(o))break;this.screen_.popRow(),t--}var i=this.screen_.shiftRows(t);this.scrollbackRows_.push.apply(this.scrollbackRows_,i),r.row=Math.max(r.row-t,0)}else if(t>0){if(t<=this.scrollbackRows_.length){var s=Math.min(t,this.scrollbackRows_.length),n=this.scrollbackRows_.splice(this.scrollbackRows_.length-s,s);this.screen_.unshiftRows(n),t-=s,r.row+=s}t&&this.appendRows_(t)}this.setVTScrollRegion(null,null),this.restoreCursor(r)},hterm.Terminal.prototype.scrollHome=function(){this.scrollPort_.scrollRowToTop(0)},hterm.Terminal.prototype.scrollEnd=function(){this.scrollPort_.scrollRowToBottom(this.getRowCount())},hterm.Terminal.prototype.scrollPageUp=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e-this.screenSize.height+1)},hterm.Terminal.prototype.scrollPageDown=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e+this.screenSize.height-1)},hterm.Terminal.prototype.wipeContents=function(){this.scrollbackRows_.length=0,this.scrollPort_.resetCache(),[this.primaryScreen_,this.alternateScreen_].forEach(function(e){var t=e.getHeight();t>0&&(this.renumberRows_(0,t),this.clearHome(e))}.bind(this)),this.syncCursorPosition_(),this.scrollPort_.invalidate()},hterm.Terminal.prototype.reset=function(){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()},hterm.Terminal.prototype.softReset=function(){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)},hterm.Terminal.prototype.forwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=0;t<this.tabStops_.length;t++)if(this.tabStops_[t]>e)return void this.setCursorColumn(this.tabStops_[t]);var r=this.screen_.cursorPosition.overflow;this.setCursorColumn(this.screenSize.width-1),this.screen_.cursorPosition.overflow=r},hterm.Terminal.prototype.backwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=this.tabStops_.length-1;t>=0;t--)if(this.tabStops_[t]<e)return void this.setCursorColumn(this.tabStops_[t]);this.setCursorColumn(1)},hterm.Terminal.prototype.setTabStop=function(e){for(var t=this.tabStops_.length-1;t>=0;t--){if(this.tabStops_[t]==e)return;if(this.tabStops_[t]<e)return void this.tabStops_.splice(t+1,0,e)}this.tabStops_.splice(0,0,e)},hterm.Terminal.prototype.clearTabStopAtCursor=function(){var e=this.screen_.cursorPosition.column,t=this.tabStops_.indexOf(e);-1!=t&&this.tabStops_.splice(t,1)},hterm.Terminal.prototype.clearAllTabStops=function(){this.tabStops_.length=0,this.defaultTabStops=!1},hterm.Terminal.prototype.setDefaultTabStops=function(e){for(var t=e||0,r=this.tabWidth,o=t=t-1-(t-1)%r+r;o<this.screenSize.width;o+=r)this.setTabStop(o);this.defaultTabStops=!0},hterm.Terminal.prototype.interpret=function(e){this.vt.interpret(e),this.scheduleSyncCursorPosition_()},hterm.Terminal.prototype.decorate=function(e){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(){return!1};var t=this.onMouse_.bind(this),r=this.scrollPort_.getScreenNode();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(){setTimeout(this.onFocusChange_.bind(this,!0))}.bind(this)),r.addEventListener("blur",this.onFocusChange_.bind(this,!1));var o=this.document_.createElement("style");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;}",this.document_.head.appendChild(o);var i=this.document_.styleSheets,s=i[i.length-1].cssRules;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_);t=this.onMouse_.bind(this);this.scrollPort_.onScrollWheel=t,["mousedown","mouseup","mousemove","click","dblclick"].forEach(function(e){this.scrollBlockerNode_.addEventListener(e,t),this.cursorNode_.addEventListener(e,t),this.document_.addEventListener(e,t)}.bind(this)),this.cursorNode_.addEventListener("mousedown",function(){setTimeout(this.focus.bind(this))}.bind(this)),this.setReverseVideo(!1),this.scrollPort_.focus(),this.scrollPort_.scheduleRedraw()},hterm.Terminal.prototype.getDocument=function(){return this.document_},hterm.Terminal.prototype.focus=function(){this.scrollPort_.focus()},hterm.Terminal.prototype.getRowNode=function(e){if(e<this.scrollbackRows_.length)return this.scrollbackRows_[e];var t=e-this.scrollbackRows_.length;return this.screen_.rowsArray[t]},hterm.Terminal.prototype.getRowsText=function(e,t){for(var r=[],o=e;o<t;o++){var i=this.getRowNode(o);r.push(i.textContent),o<t-1&&!i.getAttribute("line-overflow")&&r.push("\n")}return r.join("")},hterm.Terminal.prototype.getRowText=function(e){return this.getRowNode(e).textContent},hterm.Terminal.prototype.getRowCount=function(){return this.scrollbackRows_.length+this.screen_.rowsArray.length},hterm.Terminal.prototype.appendRows_=function(e){for(var t=this.screen_.rowsArray.length,r=this.scrollbackRows_.length+t,o=0;o<e;o++){var i=this.document_.createElement("x-row");i.appendChild(this.document_.createTextNode("")),i.rowIndex=r+o,this.screen_.pushRow(i)}var s=this.screen_.rowsArray.length-this.screenSize.height;if(s>0){var n=this.screen_.shiftRows(s);Array.prototype.push.apply(this.scrollbackRows_,n),this.scrollPort_.isScrolledEnd&&this.scheduleScrollDown_()}t>=this.screen_.rowsArray.length&&(t=this.screen_.rowsArray.length-1),this.setAbsoluteCursorPosition(t,0)},hterm.Terminal.prototype.moveRows_=function(e,t,r){var o=this.screen_.removeRows(e,t);this.screen_.insertRows(r,o);var i,s;e<r?(i=e,s=r+t):(i=r,s=e+t),this.renumberRows_(i,s),this.scrollPort_.scheduleInvalidate()},hterm.Terminal.prototype.renumberRows_=function(e,t,r){for(var o=r||this.screen_,i=this.scrollbackRows_.length,s=e;s<t;s++)o.rowsArray[s].rowIndex=i+s},hterm.Terminal.prototype.print=function(e){for(var t=0,r=lib.wc.strWidth(e);t<r;){this.options_.wraparound&&this.screen_.cursorPosition.overflow&&(this.screen_.commitLineOverflow(),this.newLine());var o,i=r-t,s=!1;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);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;this.screen_.maybeClipCurrentRow(),t+=i}this.scheduleSyncCursorPosition_(),this.scrollOnOutput_&&this.scrollPort_.scrollRowToBottom(this.getRowCount())},hterm.Terminal.prototype.setVTScrollRegion=function(e,t){0==e&&t==this.screenSize.height-1?(this.vtScrollTop_=null,this.vtScrollBottom_=null):(this.vtScrollTop_=e,this.vtScrollBottom_=t)},hterm.Terminal.prototype.getVTScrollTop=function(){return null!=this.vtScrollTop_?this.vtScrollTop_:0},hterm.Terminal.prototype.getVTScrollBottom=function(){return null!=this.vtScrollBottom_?this.vtScrollBottom_:this.screenSize.height-1},hterm.Terminal.prototype.newLine=function(){var e=this.screen_.cursorPosition.row==this.screen_.rowsArray.length-1;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)},hterm.Terminal.prototype.lineFeed=function(){var e=this.screen_.cursorPosition.column;this.newLine(),this.setCursorColumn(e)},hterm.Terminal.prototype.formFeed=function(){this.options_.autoCarriageReturn?this.newLine():this.lineFeed()},hterm.Terminal.prototype.reverseLineFeed=function(){var e=this.getVTScrollTop(),t=this.screen_.cursorPosition.row;t==e?this.insertLines(1):this.setAbsoluteCursorRow(t-1)},hterm.Terminal.prototype.eraseToLeft=function(){var e=this.saveCursor();this.setCursorColumn(0),this.screen_.overwriteString(lib.f.getWhitespace(e.column+1)),this.restoreCursor(e)},hterm.Terminal.prototype.eraseToRight=function(e){if(!this.screen_.cursorPosition.overflow){var t=this.screenSize.width-this.screen_.cursorPosition.column,r=e?Math.min(e,t):t;if(this.screen_.textAttributes.background===this.screen_.textAttributes.DEFAULT_COLOR){var o=this.screen_.rowsArray[this.screen_.cursorPosition.row];if(hterm.TextAttributes.nodeWidth(o)<=this.screen_.cursorPosition.column+r)return this.screen_.deleteChars(r),void this.clearCursorOverflow()}var i=this.saveCursor();this.screen_.overwriteString(lib.f.getWhitespace(r)),this.restoreCursor(i),this.clearCursorOverflow()}},hterm.Terminal.prototype.eraseLine=function(){var e=this.saveCursor();this.screen_.clearCursorRow(),this.restoreCursor(e),this.clearCursorOverflow()},hterm.Terminal.prototype.eraseAbove=function(){var e=this.saveCursor();this.eraseToLeft();for(var t=0;t<e.row;t++)this.setAbsoluteCursorPosition(t,0),this.screen_.clearCursorRow();this.restoreCursor(e),this.clearCursorOverflow()},hterm.Terminal.prototype.eraseBelow=function(){var e=this.saveCursor();this.eraseToRight();for(var t=this.screenSize.height-1,r=e.row+1;r<=t;r++)this.setAbsoluteCursorPosition(r,0),this.screen_.clearCursorRow();this.restoreCursor(e),this.clearCursorOverflow()},hterm.Terminal.prototype.fill=function(e){var t=this.saveCursor();this.setAbsoluteCursorPosition(0,0);for(var r=0;r<this.screenSize.height;r++)for(var o=0;o<this.screenSize.width;o++)this.setAbsoluteCursorPosition(r,o),this.screen_.overwriteString(e);this.restoreCursor(t)},hterm.Terminal.prototype.clearHome=function(e){var t=e||this.screen_,r=t.getHeight();if(0!=r){for(var o=0;o<r;o++)t.setCursorPosition(o,0),t.clearCursorRow();t.setCursorPosition(0,0)}},hterm.Terminal.prototype.clear=function(e){var t=e||this.screen_,r=t.cursorPosition.clone();this.clearHome(t),t.setCursorPosition(r.row,r.column)},hterm.Terminal.prototype.insertLines=function(e){var t=this.screen_.cursorPosition.row,r=this.getVTScrollBottom(),o=r-t-(e=Math.min(e,r-t))+1;o&&this.moveRows_(t,o,t+e);for(var i=e-1;i>=0;i--)this.setAbsoluteCursorPosition(t+i,0),this.screen_.clearCursorRow()},hterm.Terminal.prototype.deleteLines=function(e){var t=this.saveCursor(),r=t.row,o=this.getVTScrollBottom(),i=o-r+1,s=o-(e=Math.min(e,i))+1;e!=i&&this.moveRows_(r,e,s);for(var n=0;n<e;n++)this.setAbsoluteCursorPosition(s+n,0),this.screen_.clearCursorRow();this.restoreCursor(t),this.clearCursorOverflow()},hterm.Terminal.prototype.insertSpace=function(e){var t=this.saveCursor(),r=lib.f.getWhitespace(e||1);this.screen_.insertString(r),this.screen_.maybeClipCurrentRow(),this.restoreCursor(t),this.clearCursorOverflow()},hterm.Terminal.prototype.deleteChars=function(e){var t=this.screen_.deleteChars(e);if(t&&!this.screen_.textAttributes.isDefault()){var r=this.saveCursor();this.setCursorColumn(this.screenSize.width-t),this.screen_.insertString(lib.f.getWhitespace(t)),this.restoreCursor(r)}this.clearCursorOverflow()},hterm.Terminal.prototype.vtScrollUp=function(e){var t=this.saveCursor();this.setAbsoluteCursorRow(this.getVTScrollTop()),this.deleteLines(e),this.restoreCursor(t)},hterm.Terminal.prototype.vtScrollDown=function(e){var t=this.saveCursor();this.setAbsoluteCursorPosition(this.getVTScrollTop(),0),this.insertLines(e),this.restoreCursor(t)},hterm.Terminal.prototype.setCursorPosition=function(e,t){this.options_.originMode?this.setRelativeCursorPosition(e,t):this.setAbsoluteCursorPosition(e,t)},hterm.Terminal.prototype.setRelativeCursorPosition=function(e,t){var r=this.getVTScrollTop();e=lib.f.clamp(e+r,r,this.getVTScrollBottom()),t=lib.f.clamp(t,0,this.screenSize.width-1),this.screen_.setCursorPosition(e,t)},hterm.Terminal.prototype.setAbsoluteCursorPosition=function(e,t){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)},hterm.Terminal.prototype.setCursorColumn=function(e){this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row,e)},hterm.Terminal.prototype.getCursorColumn=function(){return this.screen_.cursorPosition.column},hterm.Terminal.prototype.setAbsoluteCursorRow=function(e){this.setAbsoluteCursorPosition(e,this.screen_.cursorPosition.column)},hterm.Terminal.prototype.getCursorRow=function(e){return this.screen_.cursorPosition.row},hterm.Terminal.prototype.scheduleRedraw_=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout(function(){delete e.timeouts_.redraw,e.scrollPort_.redraw_()},0)}},hterm.Terminal.prototype.scheduleScrollDown_=function(){if(!this.timeouts_.scrollDown){var e=this;this.timeouts_.scrollDown=setTimeout(function(){delete e.timeouts_.scrollDown,e.scrollPort_.scrollRowToBottom(e.getRowCount())},10)}},hterm.Terminal.prototype.cursorUp=function(e){return this.cursorDown(-(e||1))},hterm.Terminal.prototype.cursorDown=function(e){e=e||1;var t=this.options_.originMode?this.getVTScrollTop():0,r=this.options_.originMode?this.getVTScrollBottom():this.screenSize.height-1,o=lib.f.clamp(this.screen_.cursorPosition.row+e,t,r);this.setAbsoluteCursorRow(o)},hterm.Terminal.prototype.cursorLeft=function(e){if(!((e=e||1)<1)){var t=this.screen_.cursorPosition.column;if(this.options_.reverseWraparound){if(this.screen_.cursorPosition.overflow&&(e--,this.clearCursorOverflow(),!e))return;var r=this.screen_.cursorPosition.row;(o=t-e)<0&&((r=r-Math.floor(e/this.screenSize.width)-1)<0&&(r=this.screenSize.height+r%this.screenSize.height),o=this.screenSize.width+o%this.screenSize.width),this.setCursorPosition(Math.max(r,0),o)}else{var o=Math.max(t-e,0);this.setCursorColumn(o)}}},hterm.Terminal.prototype.cursorRight=function(e){if(!((e=e||1)<1)){var t=lib.f.clamp(this.screen_.cursorPosition.column+e,0,this.screenSize.width-1);this.setCursorColumn(t)}},hterm.Terminal.prototype.setReverseVideo=function(e){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")))},hterm.Terminal.prototype.ringBell=function(){this.cursorNode_.style.backgroundColor=this.scrollPort_.getForegroundColor();var e=this;if(setTimeout(function(){e.cursorNode_.style.backgroundColor=e.prefs_.get("cursor-color")},200),!this.bellSquelchTimeout_&&(this.bellAudio_.getAttribute("src")?(this.bellAudio_.play(),this.bellSequelchTimeout_=setTimeout(function(){delete this.bellSquelchTimeout_}.bind(this),500)):delete this.bellSquelchTimeout_,this.desktopNotificationBell_&&!this.document_.hasFocus())){var t=new Notification(lib.f.replaceVars(hterm.desktopNotificationTitle,{title:window.document.title||"hterm"}));this.bellNotificationList_.push(t),t.onclick=function(){e.closeBellNotifications_()}}},hterm.Terminal.prototype.setOriginMode=function(e){this.options_.originMode=e,this.setCursorPosition(0,0)},hterm.Terminal.prototype.setInsertMode=function(e){this.options_.insertMode=e},hterm.Terminal.prototype.setAutoCarriageReturn=function(e){this.options_.autoCarriageReturn=e},hterm.Terminal.prototype.setWraparound=function(e){this.options_.wraparound=e},hterm.Terminal.prototype.setReverseWraparound=function(e){this.options_.reverseWraparound=e},hterm.Terminal.prototype.setAlternateMode=function(e){var t=this.saveCursor();if(this.screen_=e?this.alternateScreen_:this.primaryScreen_,this.screen_.rowsArray.length&&this.screen_.rowsArray[0].rowIndex!=this.scrollbackRows_.length)for(var r=this.scrollbackRows_.length,o=this.screen_.rowsArray,i=0;i<o.length;i++)o[i].rowIndex=r+i;this.realizeWidth_(this.screenSize.width),this.realizeHeight_(this.screenSize.height),this.scrollPort_.syncScrollHeight(),this.scrollPort_.invalidate(),this.restoreCursor(t),this.scrollPort_.resize()},hterm.Terminal.prototype.setCursorBlink=function(e){this.options_.cursorBlink=e,!e&&this.timeouts_.cursorBlink&&(clearTimeout(this.timeouts_.cursorBlink),delete this.timeouts_.cursorBlink),this.options_.cursorVisible&&this.setCursorVisible(!0)},hterm.Terminal.prototype.setCursorVisible=function(e){if(this.options_.cursorVisible=e,!e)return this.timeouts_.cursorBlink&&(clearTimeout(this.timeouts_.cursorBlink),delete this.timeouts_.cursorBlink),void(this.cursorNode_.style.opacity="0");if(this.syncCursorPosition_(),this.cursorNode_.style.opacity="1",this.options_.cursorBlink){if(this.timeouts_.cursorBlink)return;this.onCursorBlink_()}else this.timeouts_.cursorBlink&&(clearTimeout(this.timeouts_.cursorBlink),delete this.timeouts_.cursorBlink)},hterm.Terminal.prototype.syncCursorPosition_=function(){var e=this.scrollPort_.getTopRowIndex(),t=this.scrollPort_.getBottomRowIndex(e),r=this.scrollbackRows_.length+this.screen_.cursorPosition.row;if(r>t)this.cursorNode_.style.top=-this.scrollPort_.characterSize.height+"px";else{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+")");var o=this.document_.getSelection();o&&o.isCollapsed&&this.screen_.syncSelectionCaret(o)}},hterm.Terminal.prototype.restyleCursor_=function(){var e=this.cursorShape_;"false"==this.cursorNode_.getAttribute("focus")&&(e=hterm.Terminal.cursorShape.BLOCK);var t=this.cursorNode_.style;switch(t.width=this.scrollPort_.characterSize.width+"px",e){case hterm.Terminal.cursorShape.BEAM:t.height=this.scrollPort_.characterSize.height+"px",t.backgroundColor="transparent",t.borderBottomStyle=null,t.borderLeftStyle="solid";break;case hterm.Terminal.cursorShape.UNDERLINE:t.height=this.scrollPort_.characterSize.baseline+"px",t.backgroundColor="transparent",t.borderBottomStyle="solid",t.borderLeftStyle=null;break;default:t.height=this.scrollPort_.characterSize.height+"px",t.backgroundColor=this.cursorColor_,t.borderBottomStyle=null,t.borderLeftStyle=null}},hterm.Terminal.prototype.scheduleSyncCursorPosition_=function(){if(!this.timeouts_.syncCursor){var e=this;this.timeouts_.syncCursor=setTimeout(function(){e.syncCursorPosition_(),delete e.timeouts_.syncCursor},0)}},hterm.Terminal.prototype.showZoomWarning_=function(e){if(!this.zoomWarningNode_){if(!e)return;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_.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_)},hterm.Terminal.prototype.showOverlay=function(e,t){if(!this.overlayNode_){if(!this.div_)return;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){e.preventDefault(),e.stopPropagation()},!0)}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_);var r=hterm.getClientSize(this.div_),o=hterm.getClientSize(this.overlayNode_);this.overlayNode_.style.top=(r.height-o.height)/2+"px",this.overlayNode_.style.left=(r.width-o.width-this.scrollPort_.currentScrollbarWidthPx)/2+"px";var i=this;this.overlayTimeout_&&clearTimeout(this.overlayTimeout_),null!==t&&(this.overlayTimeout_=setTimeout(function(){i.overlayNode_.style.opacity="0",i.overlayTimeout_=setTimeout(function(){i.overlayNode_.parentNode&&i.overlayNode_.parentNode.removeChild(i.overlayNode_),i.overlayTimeout_=null,i.overlayNode_.style.opacity="0.75"},200)},t||1500))},hterm.Terminal.prototype.paste=function(){hterm.pasteFromClipboard(this.document_)},hterm.Terminal.prototype.copyStringToClipboard=function(e){this.prefs_.get("enable-clipboard-notice")&&setTimeout(this.showOverlay.bind(this,hterm.notifyCopyMessage,500),200);var t=this.document_.createElement("pre");t.textContent=e,t.style.cssText="-webkit-user-select: text;-moz-user-select: text;position: absolute;top: -99px",this.document_.body.appendChild(t);var r=this.document_.getSelection(),o=r.anchorNode,i=r.anchorOffset,s=r.focusNode,n=r.focusOffset;r.selectAllChildren(t),hterm.copySelectionToClipboard(this.document_),r.extend&&(r.collapse(o,i),r.extend(s,n)),t.parentNode.removeChild(t)},hterm.Terminal.prototype.getSelectionText=function(){var e=this.scrollPort_.selection;if(e.sync(),e.isCollapsed)return null;var t=e.startOffset,r=e.startNode;if("X-ROW"!=r.nodeName)for("#text"==r.nodeName&&"SPAN"==r.parentNode.nodeName&&(r=r.parentNode);r.previousSibling;)r=r.previousSibling,t+=hterm.TextAttributes.nodeWidth(r);var o=hterm.TextAttributes.nodeWidth(e.endNode)-e.endOffset;if("X-ROW"!=(r=e.endNode).nodeName)for("#text"==r.nodeName&&"SPAN"==r.parentNode.nodeName&&(r=r.parentNode);r.nextSibling;)r=r.nextSibling,o+=hterm.TextAttributes.nodeWidth(r);var i=this.getRowsText(e.startRow.rowIndex,e.endRow.rowIndex+1);return lib.wc.substring(i,t,lib.wc.strWidth(i)-o)},hterm.Terminal.prototype.copySelectionToClipboard=function(){var e=this.getSelectionText();null!=e&&this.copyStringToClipboard(e)},hterm.Terminal.prototype.overlaySize=function(){this.showOverlay(this.screenSize.width+"x"+this.screenSize.height)},hterm.Terminal.prototype.onVTKeystroke=function(e){this.scrollOnKeystroke_&&this.scrollPort_.scrollRowToBottom(this.getRowCount()),this.io.onVTKeystroke(this.keyboard.encode(e))},hterm.Terminal.prototype.onMouse_=function(e){e.processedByTerminalHandler_||(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||(this.options_.cursorVisible&&this.vt.mouseReport==this.vt.MOUSE_REPORT_DISABLED&&(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||this.vt.mouseReport==this.vt.MOUSE_REPORT_DISABLED?(this.reportMouseEvents_=!1,this.setSelectionEnabled(!0)):(this.reportMouseEvents_=!0,this.document_.getSelection().collapseToEnd(),this.setSelectionEnabled(!1),e.preventDefault())),this.reportMouseEvents_?(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)):("dblclick"==e.type&&(this.screen_.expandSelection(this.document_.getSelection()),hterm.copySelectionToClipboard(this.document_)),"mousedown"==e.type&&e.which==this.mousePasteButton&&this.paste(),"mouseup"==e.type&&1==e.which&&this.copyOnSelect&&!this.document_.getSelection().isCollapsed&&hterm.copySelectionToClipboard(this.document_),"mousemove"!=e.type&&"mouseup"!=e.type||!this.scrollBlockerNode_.engaged||(this.scrollBlockerNode_.engaged=!1,this.scrollBlockerNode_.style.top="-99px")),"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.reportMouseEvents_=this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED)))},hterm.Terminal.prototype.onMouse=function(e){},hterm.Terminal.prototype.onFocusChange_=function(e){this.cursorNode_.setAttribute("focus",e),this.restyleCursor_(),!0===e&&this.closeBellNotifications_()},hterm.Terminal.prototype.onScroll_=function(){this.scheduleSyncCursorPosition_()},hterm.Terminal.prototype.onPaste_=function(e){var t=e.text.replace(/\n/gm,"\r");t=this.keyboard.encode(t),this.options_.bracketedPaste&&(t="[200~"+t+"[201~"),this.io.sendString(t)},hterm.Terminal.prototype.onCopy_=function(e){this.useDefaultWindowCopy||(e.preventDefault(),setTimeout(this.copySelectionToClipboard.bind(this),0))},hterm.Terminal.prototype.onResize_=function(){var e=Math.floor(this.scrollPort_.getScreenWidth()/this.scrollPort_.characterSize.width),t=lib.f.smartFloorDivide(this.scrollPort_.getScreenHeight(),this.scrollPort_.characterSize.height);if(!(e<=0||t<=0)){var r=e!=this.screenSize.width||t!=this.screenSize.height;this.realizeSize_(e,t),this.showZoomWarning_(1!=this.scrollPort_.characterSize.zoomFactor),r&&this.overlaySize(),this.restyleCursor_(),this.scheduleSyncCursorPosition_()}},hterm.Terminal.prototype.onCursorBlink_=function(){this.options_.cursorBlink?"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])):delete this.timeouts_.cursorBlink},hterm.Terminal.prototype.setScrollbarVisible=function(e){this.scrollPort_.setScrollbarVisible(e)},hterm.Terminal.prototype.setScrollWheelMoveMultipler=function(e){this.scrollPort_.setScrollWheelMoveMultipler(e)},hterm.Terminal.prototype.closeBellNotifications_=function(){this.bellNotificationList_.forEach(function(e){e.close()}),this.bellNotificationList_.length=0},lib.rtdep("lib.encodeUTF8"),hterm.Terminal.IO=function(e){this.terminal_=e,this.previousIO_=null},hterm.Terminal.IO.prototype.showOverlay=function(e,t){this.terminal_.showOverlay(e,t)},hterm.Terminal.IO.prototype.createFrame=function(e,t){return new hterm.Frame(this.terminal_,e,t)},hterm.Terminal.IO.prototype.setTerminalProfile=function(e){this.terminal_.setProfile(e)},hterm.Terminal.IO.prototype.push=function(){var e=new hterm.Terminal.IO(this.terminal_);return e.keyboardCaptured_=this.keyboardCaptured_,e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.previousIO_=this.terminal_.io,this.terminal_.io=e,e},hterm.Terminal.IO.prototype.pop=function(){this.terminal_.io=this.previousIO_},hterm.Terminal.IO.prototype.sendString=function(e){console.log("Unhandled sendString: "+e)},hterm.Terminal.IO.prototype.onVTKeystroke=function(e){console.log("Unobserverd VT keystroke: "+JSON.stringify(e))},hterm.Terminal.IO.prototype.onTerminalResize_=function(e,t){for(var r=this;r;)r.columnCount=e,r.rowCount=t,r=r.previousIO_;this.onTerminalResize(e,t)},hterm.Terminal.IO.prototype.onTerminalResize=function(e,t){},hterm.Terminal.IO.prototype.writeUTF8=function(e){if(this.terminal_.io!=this)throw"Attempt to print from inactive IO object.";this.terminal_.interpret(e)},hterm.Terminal.IO.prototype.writelnUTF8=function(e){if(this.terminal_.io!=this)throw"Attempt to print from inactive IO object.";this.terminal_.interpret(e+"\r\n")},hterm.Terminal.IO.prototype.print=hterm.Terminal.IO.prototype.writeUTF16=function(e){this.writeUTF8(lib.encodeUTF8(e))},hterm.Terminal.IO.prototype.println=hterm.Terminal.IO.prototype.writelnUTF16=function(e){this.writelnUTF8(lib.encodeUTF8(e))},lib.rtdep("lib.colors"),hterm.TextAttributes=function(e){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()},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){this.document_=e},hterm.TextAttributes.prototype.clone=function(){var e=new hterm.TextAttributes(null);for(var t in this)e[t]=this[t];return e.colorPalette=this.colorPalette.concat(),e},hterm.TextAttributes.prototype.reset=function(){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},hterm.TextAttributes.prototype.resetColorPalette=function(){this.colorPalette=lib.colors.colorPalette.concat(),this.syncColors()},hterm.TextAttributes.prototype.isDefault=function(){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)},hterm.TextAttributes.prototype.createContainer=function(e){var t=this.document_.createElement("span"),r=t.style;this.foreground!=this.DEFAULT_COLOR?r.color=this.foreground:r.color=this.defaultForeground,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&&(r.fontStyle="italic");var o="";return this.underline&&(o+=" underline",t.underline=!0),this.strikethrough&&(o+=" line-through",t.strikethrough=!0),o&&(r.textDecoration=o),this.wcNode&&(t.className="wc-node",t.wcNode=!0),null!=this.tileData&&(t.className+=" tile tile_"+this.tileData,t.tileNode=!0),e&&(t.textContent=e),t},hterm.TextAttributes.prototype.matchesContainer=function(e){return!1},hterm.TextAttributes.prototype.setDefaults=function(e,t){this.defaultForeground=e,this.defaultBackground=t,this.syncColors()},hterm.TextAttributes.prototype.syncColors=function(){var e=this.foregroundSource,t=this.backgroundSource,r=this.DEFAULT_COLOR,o=this.DEFAULT_COLOR;if(this.inverse&&(e=this.backgroundSource,t=this.foregroundSource,r=this.defaultBackground,o=this.defaultForeground),this.enableBoldAsBright&&this.bold&&e!=this.SRC_DEFAULT&&e!=this.SRC_RGB&&(e=function(e){return e<8?e+8:e}(e)),this.invisible&&(e=t,r=this.defaultBackground),e!=this.SRC_RGB&&(this.foreground=e==this.SRC_DEFAULT?r:this.colorPalette[e]),this.faint&&!this.invisible){var i=this.foreground==this.DEFAULT_COLOR?this.defaultForeground:this.foreground;this.foreground=lib.colors.mix(i,"rgb(0, 0, 0)",.3333)}t!=this.SRC_RGB&&(this.background=t==this.SRC_DEFAULT?o:this.colorPalette[t])},hterm.TextAttributes.containersMatch=function(e,t){if("string"==typeof e)return hterm.TextAttributes.containerIsDefault(t);if(e.nodeType!=t.nodeType)return!1;if(3==e.nodeType)return!0;var r=e.style,o=t.style;return r.color==o.color&&r.backgroundColor==o.backgroundColor&&r.fontWeight==o.fontWeight&&r.fontStyle==o.fontStyle&&r.textDecoration==o.textDecoration},hterm.TextAttributes.containerIsDefault=function(e){return"string"==typeof e||3==e.nodeType},hterm.TextAttributes.nodeWidth=function(e){return e.wcNode?lib.wc.strWidth(e.textContent):e.textContent.length},hterm.TextAttributes.nodeSubstr=function(e,t,r){return e.wcNode?lib.wc.substr(e.textContent,t,r):e.textContent.substr(t,r)},hterm.TextAttributes.nodeSubstring=function(e,t,r){return e.wcNode?lib.wc.substring(e.textContent,t,r):e.textContent.substring(t,r)},hterm.TextAttributes.splitWidecharString=function(e){for(var t=[],r=0,o=0,i=0;i<e.length;i++){var s=e.charCodeAt(i);s<128||1==lib.wc.charWidth(s)?o++:(o&&t.push({str:e.substr(r,o)}),t.push({str:e.substr(i,1),wcNode:!0}),r=i+1,o=0)}return o&&t.push({str:e.substr(r,o)}),t},lib.rtdep("lib.colors","lib.f","lib.UTF8Decoder","hterm.VT.CharacterMap"),hterm.VT=function(e){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;var t=Object.keys(hterm.VT.CC1).map(function(e){return"\\x"+lib.f.zpad(e.charCodeAt().toString(16),2)}).join("");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)},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){this.defaultFunction=e,this.buf=t||null,this.pos=0,this.func=e,this.args=[]},hterm.VT.ParseState.prototype.reset=function(e){this.resetParseFunction(),this.resetBuf(e||""),this.resetArguments()},hterm.VT.ParseState.prototype.resetParseFunction=function(){this.func=this.defaultFunction},hterm.VT.ParseState.prototype.resetBuf=function(e){this.buf="string"==typeof e?e:null,this.pos=0},hterm.VT.ParseState.prototype.resetArguments=function(e){this.args.length=0,void 0!==e&&(this.args[0]=e)},hterm.VT.ParseState.prototype.iarg=function(e,t){var r=this.args[e];if(r){var o=parseInt(r,10);return 0==o&&(o=t),o}return t},hterm.VT.ParseState.prototype.advance=function(e){this.pos+=e},hterm.VT.ParseState.prototype.peekRemainingBuf=function(){return this.buf.substr(this.pos)},hterm.VT.ParseState.prototype.peekChar=function(){return this.buf.substr(this.pos,1)},hterm.VT.ParseState.prototype.consumeChar=function(){return this.buf.substr(this.pos++,1)},hterm.VT.ParseState.prototype.isComplete=function(){return null==this.buf||this.buf.length<=this.pos},hterm.VT.CursorState=function(e){this.vt_=e,this.save()},hterm.VT.CursorState.prototype.save=function(){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},hterm.VT.CursorState.prototype.restore=function(){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},hterm.VT.prototype.reset=function(){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},hterm.VT.prototype.onTerminalMouse_=function(e){if(this.mouseReport!=this.MOUSE_REPORT_DISABLED){var t,r=0;e.shiftKey&&(r|=4),(e.metaKey||this.terminal.keyboard.altIsMeta&&e.altKey)&&(r|=8),e.ctrlKey&&(r|=16);var o=String.fromCharCode(lib.f.clamp(e.terminalColumn+32,32,255)),i=String.fromCharCode(lib.f.clamp(e.terminalRow+32,32,255));switch(e.type){case"mousewheel":s=96+(e.wheelDeltaY>0?0:1),s|=r,t="[M"+String.fromCharCode(s)+o+i,e.preventDefault();break;case"mousedown":var s=Math.min(e.which-1,2)+32;s|=r,t="[M"+String.fromCharCode(s)+o+i;break;case"mouseup":t="[M#"+o+i;break;case"mousemove":this.mouseReport==this.MOUSE_REPORT_DRAG&&e.which&&(s=32+Math.min(e.which-1,2),s+=32,s|=r,t="[M"+String.fromCharCode(s)+o+i);break;case"click":case"dblclick":break;default:console.error("Unknown mouse event: "+e.type,e)}t&&this.terminal.io.sendString(t)}},hterm.VT.prototype.interpret=function(e){for(this.parseState_.resetBuf(this.decode(e));!this.parseState_.isComplete();){var t=this.parseState_.func,r=this.parseState_.pos,e=this.parseState_.buf;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!"}},hterm.VT.prototype.decode=function(e){return"utf-8"==this.characterEncoding?this.decodeUTF8(e):e},hterm.VT.prototype.encodeUTF8=function(e){return lib.encodeUTF8(e)},hterm.VT.prototype.decodeUTF8=function(e){return this.utf8Decoder_.decode(e)},hterm.VT.prototype.parseUnknown_=function(e){function t(e){r[r.GL].GL&&(e=r[r.GL].GL(e)),r[r.GR].GR&&(e=r[r.GR].GR(e)),r.terminal.print(e)}var r=this,o=e.peekRemainingBuf(),i=o.search(this.cc1Pattern_);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))},hterm.VT.prototype.parseCSI_=function(e){var t=e.peekChar(),r=e.args;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"&&t<="9"?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)},hterm.VT.prototype.parseUntilStringTerminator_=function(e){var t=e.peekRemainingBuf(),r=t.search(/(\x1b\\|\x07)/),o=e.args;if(o.length||(o[0]="",o[1]=new Date),-1==r){o[0]+=t;var i;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)}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)},hterm.VT.prototype.dispatch=function(e,t,r){var o=hterm.VT[e][t];o?o!=hterm.VT.ignore?"CC1"==e&&t>""&&!this.enable8BitControl?console.warn("Ignoring 8-bit control code: 0x"+t.charCodeAt(0).toString(16)):o.apply(this,[r,t]):this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t))},hterm.VT.prototype.setANSIMode=function(e,t){"4"==e?this.terminal.setInsertMode(t):"20"==e?this.terminal.setAutoCarriageReturn(t):this.warnUnimplemented&&console.warn("Unimplemented ANSI Mode: "+e)},hterm.VT.prototype.setDECMode=function(e,t){switch(e){case"1":this.terminal.keyboard.applicationCursor=t;break;case"3":this.allowColumnWidthChanges_&&(this.terminal.setWidth(t?132:80),this.terminal.clearHome(),this.terminal.setVTScrollRegion(null,null));break;case"5":this.terminal.setReverseVideo(t);break;case"6":this.terminal.setOriginMode(t);break;case"7":this.terminal.setWraparound(t);break;case"12":this.enableDec12&&this.terminal.setCursorBlink(t);break;case"25":this.terminal.setCursorVisible(t);break;case"40":this.terminal.allowColumnWidthChanges_=t;break;case"45":this.terminal.setReverseWraparound(t);break;case"67":this.terminal.keyboard.backspaceSendsBackspace=t;break;case"1000":this.mouseReport=t?this.MOUSE_REPORT_CLICK:this.MOUSE_REPORT_DISABLED;break;case"1002":this.mouseReport=t?this.MOUSE_REPORT_DRAG:this.MOUSE_REPORT_DISABLED;break;case"1010":this.terminal.scrollOnOutput=t;break;case"1011":this.terminal.scrollOnKeystroke=t;break;case"1036":this.terminal.keyboard.metaSendsEscape=t;break;case"1039":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);break;case"47":case"1047":this.terminal.setAlternateMode(t);break;case"1048":this.savedState_.save();case"1049":t?(this.savedState_.save(),this.terminal.setAlternateMode(t),this.terminal.clear()):(this.terminal.setAlternateMode(t),this.savedState_.restore());break;case"2004":this.terminal.setBracketedPaste(t);break;default:this.warnUnimplemented&&console.warn("Unimplemented DEC Private Mode: "+e)}},hterm.VT.ignore=function(){},hterm.VT.CC1={},hterm.VT.ESC={},hterm.VT.CSI={},hterm.VT.OSC={},hterm.VT.VT52={},hterm.VT.CC1["\0"]=function(){},hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=function(){this.terminal.ringBell()},hterm.VT.CC1["\b"]=function(){this.terminal.cursorLeft(1)},hterm.VT.CC1["\t"]=function(){this.terminal.forwardTabStop()},hterm.VT.CC1["\n"]=function(){this.terminal.formFeed()},hterm.VT.CC1["\v"]=hterm.VT.CC1["\n"],hterm.VT.CC1["\f"]=function(){this.terminal.formFeed()},hterm.VT.CC1["\r"]=function(){this.terminal.setCursorColumn(0)},hterm.VT.CC1[""]=function(){this.GL="G1"},hterm.VT.CC1[""]=function(){this.GL="G0"},hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=function(e){e.resetParseFunction(),this.terminal.print("?")},hterm.VT.CC1[""]=hterm.VT.CC1[""],hterm.VT.CC1[""]=function(e){function t(e){var r=e.consumeChar();""!=r&&(this.dispatch("ESC",r,e),e.func==t&&e.resetParseFunction())}e.func=t},hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ESC.D=function(){this.terminal.lineFeed()},hterm.VT.CC1[""]=hterm.VT.ESC.E=function(){this.terminal.setCursorColumn(0),this.terminal.cursorDown(1)},hterm.VT.CC1[""]=hterm.VT.ESC.H=function(){this.terminal.setTabStop(this.terminal.getCursorColumn())},hterm.VT.CC1[""]=hterm.VT.ESC.M=function(){this.terminal.reverseLineFeed()},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){e.resetArguments(),e.func=this.parseUntilStringTerminator_},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(){this.terminal.io.sendString("[?1;2c")},hterm.VT.CC1[""]=hterm.VT.ESC["["]=function(e){e.resetArguments(),this.leadingModifier_="",this.trailingModifier_="",e.func=this.parseCSI_},hterm.VT.CC1[""]=hterm.VT.ESC["\\"]=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ESC["]"]=function(e){function t(e){if(this.parseUntilStringTerminator_(e)&&e.func!=t){var r=e.args[0].match(/^(\d+);(.*)$/);r?(e.args[0]=r[2],this.dispatch("OSC",r[1],e)):console.warn("Invalid OSC: "+JSON.stringify(e.args[0]))}}e.resetArguments(),e.func=t},hterm.VT.CC1[""]=hterm.VT.ESC["^"]=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},hterm.VT.CC1[""]=hterm.VT.ESC._=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},hterm.VT.ESC[" "]=function(e){e.func=function(e){var t=e.consumeChar();this.warnUnimplemented&&console.warn("Unimplemented sequence: ESC 0x20 "+t),e.resetParseFunction()}},hterm.VT.ESC["#"]=function(e){e.func=function(e){"8"==e.consumeChar()&&this.terminal.fill("E"),e.resetParseFunction()}},hterm.VT.ESC["%"]=function(e){e.func=function(e){var t=e.consumeChar();"@"!=t&&"G"!=t&&this.warnUnimplemented&&console.warn("Unknown ESC % argument: "+JSON.stringify(t)),e.resetParseFunction()}},hterm.VT.ESC["("]=hterm.VT.ESC[")"]=hterm.VT.ESC["*"]=hterm.VT.ESC["+"]=hterm.VT.ESC["-"]=hterm.VT.ESC["."]=hterm.VT.ESC["/"]=function(e,t){e.func=function(e){var r=e.consumeChar();if(""==r)return 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),e.resetParseFunction()}},hterm.VT.ESC[6]=hterm.VT.ignore,hterm.VT.ESC[7]=function(){this.savedState_.save()},hterm.VT.ESC[8]=function(){this.savedState_.restore()},hterm.VT.ESC[9]=hterm.VT.ignore,hterm.VT.ESC["="]=function(){this.terminal.keyboard.applicationKeypad=!0},hterm.VT.ESC[">"]=function(){this.terminal.keyboard.applicationKeypad=!1},hterm.VT.ESC.F=hterm.VT.ignore,hterm.VT.ESC.c=function(){this.reset(),this.terminal.reset()},hterm.VT.ESC.l=hterm.VT.ESC.m=hterm.VT.ignore,hterm.VT.ESC.n=function(){this.GL="G2"},hterm.VT.ESC.o=function(){this.GL="G3"},hterm.VT.ESC["|"]=function(){this.GR="G3"},hterm.VT.ESC["}"]=function(){this.GR="G2"},hterm.VT.ESC["~"]=function(){this.GR="G1"},hterm.VT.OSC[0]=function(e){this.terminal.setWindowTitle(e.args[0])},hterm.VT.OSC[2]=hterm.VT.OSC[0],hterm.VT.OSC[4]=function(e){for(var t=e.args[0].split(";"),r=parseInt(t.length/2),o=this.terminal.getTextAttributes().colorPalette,i=[],s=0;s<r;++s){var n=parseInt(t[2*s]),a=t[2*s+1];n>=o.length||("?"!=a?(a=lib.colors.x11ToCSS(a))&&(o[n]=a):(a=lib.colors.rgbToX11(o[n]))&&i.push(n+";"+a))}i.length&&this.terminal.io.sendString("]4;"+i.join(";")+"")},hterm.VT.OSC[50]=function(e){var t=e.args[0].match(/CursorShape=(.)/i);if(t)switch(t[1]){case"1":this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);break;case"2":this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);break;default:this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK)}else console.warn("Could not parse OSC 50 args: "+e.args[0])},hterm.VT.OSC[52]=function(e){var t=e.args[0].match(/^[cps01234567]*;(.*)/);if(t){var r=window.atob(t[1]);r&&this.terminal.copyStringToClipboard(this.decode(r))}},hterm.VT.CSI["@"]=function(e){this.terminal.insertSpace(e.iarg(0,1))},hterm.VT.CSI.A=function(e){this.terminal.cursorUp(e.iarg(0,1))},hterm.VT.CSI.B=function(e){this.terminal.cursorDown(e.iarg(0,1))},hterm.VT.CSI.C=function(e){this.terminal.cursorRight(e.iarg(0,1))},hterm.VT.CSI.D=function(e){this.terminal.cursorLeft(e.iarg(0,1))},hterm.VT.CSI.E=function(e){this.terminal.cursorDown(e.iarg(0,1)),this.terminal.setCursorColumn(0)},hterm.VT.CSI.F=function(e){this.terminal.cursorUp(e.iarg(0,1)),this.terminal.setCursorColumn(0)},hterm.VT.CSI.G=function(e){this.terminal.setCursorColumn(e.iarg(0,1)-1)},hterm.VT.CSI.H=function(e){this.terminal.setCursorPosition(e.iarg(0,1)-1,e.iarg(1,1)-1)},hterm.VT.CSI.I=function(e){var t=e.iarg(0,1);t=lib.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;r<t;r++)this.terminal.forwardTabStop()},hterm.VT.CSI.J=hterm.VT.CSI["?J"]=function(e,t){var r=e.args[0];r&&"0"!=r?"1"==r?this.terminal.eraseAbove():"2"==r?this.terminal.clear():"3"==r&&this.terminal.clear():this.terminal.eraseBelow()},hterm.VT.CSI.K=hterm.VT.CSI["?K"]=function(e,t){var r=e.args[0];r&&"0"!=r?"1"==r?this.terminal.eraseToLeft():"2"==r&&this.terminal.eraseLine():this.terminal.eraseToRight()},hterm.VT.CSI.L=function(e){this.terminal.insertLines(e.iarg(0,1))},hterm.VT.CSI.M=function(e){this.terminal.deleteLines(e.iarg(0,1))},hterm.VT.CSI.P=function(e){this.terminal.deleteChars(e.iarg(0,1))},hterm.VT.CSI.S=function(e){this.terminal.vtScrollUp(e.iarg(0,1))},hterm.VT.CSI.T=function(e){e.args.length<=1&&this.terminal.vtScrollDown(e.iarg(0,1))},hterm.VT.CSI[">T"]=hterm.VT.ignore,hterm.VT.CSI.X=function(e){this.terminal.eraseToRight(e.iarg(0,1))},hterm.VT.CSI.Z=function(e){var t=e.iarg(0,1);t=lib.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;r<t;r++)this.terminal.backwardTabStop()},hterm.VT.CSI["`"]=function(e){this.terminal.setCursorColumn(e.iarg(0,1)-1)},hterm.VT.CSI.b=hterm.VT.ignore,hterm.VT.CSI.c=function(e){e.args[0]&&"0"!=e.args[0]||this.terminal.io.sendString("[?1;2c")},hterm.VT.CSI[">c"]=function(e){this.terminal.io.sendString("[>0;256;0c")},hterm.VT.CSI.d=function(e){this.terminal.setAbsoluteCursorRow(e.iarg(0,1)-1)},hterm.VT.CSI.f=hterm.VT.CSI.H,hterm.VT.CSI.g=function(e){e.args[0]&&"0"!=e.args[0]?"3"==e.args[0]&&this.terminal.clearAllTabStops():this.terminal.clearTabStopAtCursor(!1)},hterm.VT.CSI.h=function(e){for(var t=0;t<e.args.length;t++)this.setANSIMode(e.args[t],!0)},hterm.VT.CSI["?h"]=function(e){for(var t=0;t<e.args.length;t++)this.setDECMode(e.args[t],!0)},hterm.VT.CSI.i=hterm.VT.CSI["?i"]=hterm.VT.ignore,hterm.VT.CSI.l=function(e){for(var t=0;t<e.args.length;t++)this.setANSIMode(e.args[t],!1)},hterm.VT.CSI["?l"]=function(e){for(var t=0;t<e.args.length;t++)this.setDECMode(e.args[t],!1)},hterm.VT.CSI.m=function(e){function t(t){return e.args.length<t+2||"5"!=e.args[t+1]?null:e.iarg(t+2,0)}function r(t){return e.args.length<t+5||"2"!=e.args[t+1]?null:"rgb("+e.iarg(t+2,0)+" ,"+e.iarg(t+3,0)+" ,"+e.iarg(t+4,0)+")"}var o=this.terminal.getTextAttributes();if(e.args.length){for(var i=0;i<e.args.length;i++){var s=e.iarg(i,0);if(s<30)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);else if(s<50)if(s<38)o.foregroundSource=s-30;else if(38==s)if(null!=(n=r(i)))o.foregroundSource=o.SRC_RGB,o.foreground=n,i+=5;else{if(null==(a=t(i)))break;if(i+=2,a>=o.colorPalette.length)continue;o.foregroundSource=a}else if(39==s)o.foregroundSource=o.SRC_DEFAULT;else if(s<48)o.backgroundSource=s-40;else if(48==s){var n=r(i);if(null!=n)o.backgroundSource=o.SRC_RGB,o.background=n,i+=5;else{var a=t(i);if(null==a)break;if(i+=2,a>=o.colorPalette.length)continue;o.backgroundSource=a}}else o.backgroundSource=o.SRC_DEFAULT;else s>=90&&s<=97?o.foregroundSource=s-90+8:s>=100&&s<=107&&(o.backgroundSource=s-100+8)}o.setDefaults(this.terminal.getForegroundColor(),this.terminal.getBackgroundColor())}else o.reset()},hterm.VT.CSI[">m"]=hterm.VT.ignore,hterm.VT.CSI.n=function(e){if("5"==e.args[0])this.terminal.io.sendString("0n");else if("6"==e.args[0]){var t=this.terminal.getCursorRow()+1,r=this.terminal.getCursorColumn()+1;this.terminal.io.sendString("["+t+";"+r+"R")}},hterm.VT.CSI[">n"]=hterm.VT.ignore,hterm.VT.CSI["?n"]=function(e){if("6"==e.args[0]){var t=this.terminal.getCursorRow()+1,r=this.terminal.getCursorColumn()+1;this.terminal.io.sendString("["+t+";"+r+"R")}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")},hterm.VT.CSI[">p"]=hterm.VT.ignore,hterm.VT.CSI["!p"]=function(){this.reset(),this.terminal.softReset()},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){var t=e.args[0];"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)},hterm.VT.CSI['"q']=hterm.VT.ignore,hterm.VT.CSI.r=function(e){var t=e.args,r=t[0]?parseInt(t[0],10)-1:null,o=t[1]?parseInt(t[1],10)-1:null;this.terminal.setVTScrollRegion(r,o),this.terminal.setCursorPosition(0,0)},hterm.VT.CSI["?r"]=hterm.VT.ignore,hterm.VT.CSI.$r=hterm.VT.ignore,hterm.VT.CSI.s=function(){this.savedState_.save()},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(){this.savedState_.restore()},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){if(!(e.args.length<1)){var t=e.args[0];if("0"==t){if(e.args.length<2)return;this.terminal.getTextAttributes().tileData=e.args[1]}else"1"==t&&(this.terminal.getTextAttributes().tileData=null)}},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){this.name=e,this.GL=null,this.GR=null,t&&this.reset(t)},hterm.VT.CharacterMap.prototype.reset=function(e){this.glmap=e;var t=Object.keys(this.glmap).map(function(e){return"\\x"+lib.f.zpad(e.charCodeAt(0).toString(16))});this.glre=new RegExp("["+t.join("")+"]","g"),this.grmap={},t.forEach(function(e){var t=String.fromCharCode(128&e.charCodeAt(0));this.grmap[t]=this.glmap[e]}.bind(this));var r=Object.keys(this.grmap).map(function(e){return"\\x"+lib.f.zpad(e.charCodeAt(0).toString(16),2)});this.grre=new RegExp("["+r.join("")+"]","g"),this.GL=function(e){return e.replace(this.glre,function(e){return this.glmap[e]}.bind(this))}.bind(this),this.GR=function(e){return e.replace(this.grre,function(e){return this.grmap[e]}.bind(this))}.bind(this)},hterm.VT.CharacterMap.maps={},hterm.VT.CharacterMap.maps[0]=new hterm.VT.CharacterMap("graphic",{"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"}),hterm.VT.CharacterMap.maps.A=new hterm.VT.CharacterMap("british",{"#":"£"}),hterm.VT.CharacterMap.maps.B=new hterm.VT.CharacterMap("us",null),hterm.VT.CharacterMap.maps[4]=new hterm.VT.CharacterMap("dutch",{"#":"£","@":"¾","[":"Ĳ","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"}),hterm.VT.CharacterMap.maps.C=hterm.VT.CharacterMap.maps[5]=new hterm.VT.CharacterMap("finnish",{"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),hterm.VT.CharacterMap.maps.R=new hterm.VT.CharacterMap("french",{"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"}),hterm.VT.CharacterMap.maps.Q=new hterm.VT.CharacterMap("french canadian",{"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"}),hterm.VT.CharacterMap.maps.K=new hterm.VT.CharacterMap("german",{"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"}),hterm.VT.CharacterMap.maps.Y=new hterm.VT.CharacterMap("italian",{"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"}),hterm.VT.CharacterMap.maps.E=hterm.VT.CharacterMap.maps[6]=new hterm.VT.CharacterMap("norwegian/danish",{"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"}),hterm.VT.CharacterMap.maps.Z=new hterm.VT.CharacterMap("spanish",{"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"}),hterm.VT.CharacterMap.maps[7]=hterm.VT.CharacterMap.maps.H=new hterm.VT.CharacterMap("swedish",{"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),hterm.VT.CharacterMap.maps["="]=new hterm.VT.CharacterMap("swiss",{"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}),lib.resource.add("hterm/audio/bell","audio/ogg;base64","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"),lib.resource.add("hterm/concat/date","text/plain","Fri, 03 Apr 2015 09:02:15 +0000"),lib.resource.add("hterm/changelog/version","text/plain","1.54"),lib.resource.add("hterm/changelog/date","text/plain","2015-03-19"),lib.resource.add("hterm/git/HEAD","text/plain","5db5b0ceefff97ce8b7a97edd3f5ba6857db54cf");var socket=io(location.origin,{path:"/wetty/socket.io"}),term=void 0,buf="",Wetty=function(){function e(t){_classCallCheck(this,e),this.argv_=t,this.io=null,this.pid_=-1}return _createClass(e,[{key:"run",value:function(){this.io=this.argv_.io.push(),this.io.onVTKeystroke=this.sendString_.bind(this),this.io.sendString=this.sendString_.bind(this),this.io.onTerminalResize=this.onTerminalResize.bind(this)}},{key:"sendString_",value:function(e){socket.emit("input",e)}},{key:"onTerminalResize",value:function(e,t){socket.emit("resize",{col:e,row:t})}}]),e}();socket.on("connect",function(){document.getElementById("overlay").style.display="none",window.addEventListener("beforeunload",handler,!1),lib.init(function(){hterm.defaultStorage=new lib.Storage.Local,term=new hterm.Terminal,window.term=term,term.decorate(document.getElementById("terminal")),term.setCursorPosition(0,0),term.setCursorVisible(!0),term.prefs_.set("ctrl-c-copy",!0),term.prefs_.set("ctrl-v-paste",!0),term.prefs_.set("use-default-window-copy",!0),term.prefs_.set("send-encoding","raw"),term.prefs_.set("receive-encoding","raw"),term.prefs_.set("font-size",14),term.scrollPort_.screen_.setAttribute("spellcheck","false"),term.scrollPort_.screen_.setAttribute("autocorrect","false"),term.scrollPort_.screen_.setAttribute("autocomplete","false"),term.scrollPort_.screen_.setAttribute("contenteditable","false"),term.runCommandClass(Wetty,document.location.hash.substr(1)),socket.emit("resize",{col:term.screenSize.width,row:term.screenSize.height}),buf&&""!==buf&&(term.io.writeUTF8(buf),buf="")})}),socket.on("output",function(e){term?term.io.writeUTF8(e):buf+=e}),socket.on("logout",function(){document.getElementById("overlay").style.display="block",window.removeEventListener("beforeunload",handler,!1)}),socket.on("disconnect",function(){document.getElementById("overlay").style.display="block",window.removeEventListener("beforeunload",handler,!1)});