| "use strict";if("undefined"!=typeof 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(r){var o=r.stack.split("\n");t=o.length>=3?o[2].replace(/^\s*at\s+/,""):o[1].replace(/^\s*global code@/,"")}for(var i=0;i<arguments.length;i++){var s=arguments[i];if(s instanceof Array)lib.rtdep.apply(lib,s);else{var n=this.runtimeDependencies_[s];n||(n=this.runtimeDependencies_[s]=[]),n.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_,o=function(){if(r.length){var i=r.shift();t&&t("init: "+i[0]),i[1](lib.f.alarm(o))}else e()};if("function"!=typeof e)throw new Error("Missing or invalid argument: onInit");lib.ensureRuntimeDependencies_(),setTimeout(o,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){return e=(257*Math.min(e,255)).toString(16),lib.f.zpad(e,4)}var r=e.match(lib.colors.re_.rgbx);return r?"rgb:"+t(r[1])+"/"+t(r[2])+"/"+t(r[3]):null},lib.colors.x11HexToCSS=function(e){function t(e){return e=parseInt(e,16),2==r?e:1==r?e<<4:e>>4*(r-2)}if(!e.startsWith("#"))return null;if(e=e.substr(1),-1==[3,6,9,12].indexOf(e.length))return null;if(e.match(/[^a-f0-9]/i))return null;var r=e.length/3,o=e.substr(0,r),i=e.substr(r,r),s=e.substr(r+r,r);return lib.colors.arrayToRGBA([o,i,s].map(t))},lib.colors.x11ToCSS=function(e){function t(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))}var r=e.match(lib.colors.re_.x11rgb);return r?(r.splice(0,1),lib.colors.arrayToRGBA(r.map(t))):e.startsWith("#")?lib.colors.x11HexToCSS(e):lib.colors.nameToRGB(e)},lib.colors.hexToRGB=function(e){function t(e){4==e.length&&(e=e.replace(r,function(e,t,r,o){return"#"+t+t+r+r+o+o}));var t=e.match(o);return t?"rgb("+parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16)+")":null}var r=lib.colors.re_.hex16,o=lib.colors.re_.hex24;if(e instanceof Array)for(var i=0;i<e.length;i++)e[i]=t(e[i]);else e=t(e);return e},lib.colors.rgbToHex=function(e){function t(e){var t=lib.colors.crackRGB(e);return t?"#"+lib.f.zpad((parseInt(t[0])<<16|parseInt(t[1])<<8|parseInt(t[2])<<0).toString(16),6):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.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;4>s;++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)){var t=e.match(lib.colors.re_.rgba);if(t)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(),e in lib.colors.colorNames?lib.colors.colorNames[e]:(e=e.replace(/\s+/g,""),e 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("undefined"==typeof 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={"<":"<",">":">","&":"&",'"':""","'":"'"};return e.replace(/[<>&\"\']/g,function(e){return t[e]})}},lib.f.getAcceptLanguages=function(e){lib.f.getAcceptLanguages.chromeSupported()?chrome.i18n.getAcceptLanguages(e):setTimeout(function(){e([navigator.language.replace(/-/g,"_")])},0)},lib.f.getAcceptLanguages.chromeSupported=function(){return window.chrome&&chrome.i18n},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 lib.f.getURL.chromeSupported()?chrome.runtime.getURL(e):e},lib.f.getURL.chromeSupported=function(){return window.chrome&&chrome.runtime&&chrome.runtime.getURL},lib.f.clamp=function(e,t,r){return t>e?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(o){t=o.stack.split("\n")}for(var i={},s=r;s<t.length;s++)i[s-r]=t[s].replace(/^\s*at\s+/,"");return i},lib.f.smartFloorDivide=function(e,t){var r=e/t,o=Math.ceil(r);return 1e-4>o-r?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(){return 200!=o.status?void(r&&r(o.status)):(this.addMessages(JSON.parse(o.responseText)),void t())}.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),"undefined"==typeof r?e:r;return t?(t instanceof Array||(t=[t]),this.replaceReferences(o,t)):o},lib.MessageManager.prototype.processI18nAttributes=function(e){function t(e){return e.replace(/-/g,"_").toUpperCase()}for(var r=e.querySelectorAll("[i18n]"),o=0;o<r.length;o++){var i=r[o],s=i.getAttribute("i18n");if(s){try{s=JSON.parse(s)}catch(n){throw console.error("Can't parse "+i.tagName+"#"+i.id+": "+s),n}for(var a in s){var l=s[a];"$"==l.substr(0,1)&&(l=t(i.getAttribute(l.substr(1))+"_"+a));var h=this.get(l);"_"==a?i.textContent=h:i.setAttribute(a,h)}}}},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(var 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){var r=this.getChild(e,t);r.resetAll();var o=this.get(e),i=o.indexOf(t);-1!=i&&(o.splice(i,1),this.set(e,o)),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("undefined"==typeof 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(var 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){function r(){0==--o&&t&&t()}for(var o=0,i=this.get(e),s=Object.keys(this.childLists_[e]),n=(lib.PreferenceManager.diffChildLists(i,s),0);n<i.length;n++){var a=i[n],l=s.indexOf(a);if(l>=0&&s.splice(l,1),!this.childLists_[e][a]){var h=this.childFactories_[e](this,a);if(!h){console.warn("Unable to restore child: "+e+": "+a);continue}h.trace=this.trace,this.childLists_[e][a]=h,o++,h.readStorage(r)}}for(var n=0;n<s.length;n++)delete this.childLists_[e][s[n]];!o&&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 typeof e==typeof t&&/^(undefined|boolean|number|string)$/.test(typeof e)?e!==t:!0},lib.PreferenceManager.prototype.changeDefault=function(e,t){var r=this.prefRecords_[e];if(!r)throw new Error("Unknown preference: "+e);if(this.diff(r.defaultValue,t)){if(r.currentValue!==this.DEFAULT_VALUE)return void(r.defaultValue=t);r.defaultValue=t,this.notifyChange_(e)}},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)&&("undefined"==typeof i?o.currentValue=o.DEFAULT_VALUE:o.currentValue=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("undefined"==typeof 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("undefined"==typeof 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(o){}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(n){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(o){}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(n){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.prototype.testPreamble=function(e,t){},lib.TestManager.prototype.testPostamble=function(e,t){},lib.TestManager.Log=function(e){this.save=!1,this.data="",this.logFunction_=e||function(e){this.save&&(this.data+=e+"\n"),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){return e?(this.duration=new Date-this.startDate,this.log.popPrefix(),this.log.println("} "+this.passes.length+" passed, "+this.failures.length+" failed, "+this.msToSeconds_(this.duration)),this.log.println(""),this.summarize(),window.onerror=null,void this.testManager.onTestRunComplete(this)):void setTimeout(this.onTestRunComplete_.bind(this),0,!0)},lib.TestManager.TestRun.prototype.onResultComplete=function(e){try{this.testManager.testPostamble(e,this.cx),e.suite.postamble(e,this.ctx)}catch(t){this.log.println("Unexpected exception in postamble: "+(t.stack?t.stack:t)),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(r){return this.log.println("Exception during setup: "+(r.stack?r.stack:r)),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),this.testManager.testPreamble(this.currentResult,this.cx),t.preamble(this.currentResult,this.cx),this.testQueue_.shift()}catch(r){return this.log.println("Unexpected exception during test preamble: "+(r.stack?r.stack:r)),this.log.popPrefix(),this.log.println("}"),this.panic=!0,void this.onTestRunComplete_()}try{this.currentResult.run()}catch(r){this.log.println("Unexpected exception during test run: "+(r.stack?r.stack:r)),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){var t=(e/1e3).toFixed(2);return t+"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.arrayEQ_=function(e,t){if(!e||!t)return!e&&!t;if(e.length!=t.length)return!1;for(var r=0;r<e.length;++r)if(e[r]!=t[r])return!1;return!0},lib.TestManager.Result.prototype.assertEQ=function(e,t,r){function o(e){if("number"==typeof e)return e;var t=String(e),r=t.split("\n").map(function(e){return JSON.stringify(e)});return r.length>1?"\n"+r.join("\n"):r.join("\n")}if(e!==t&&!(t instanceof Array&&this.arrayEQ_(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(e!==!0){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(t){var r=t.stack.split("\n")[e+2],o=r.match(/([^\/]+:\d+):\d+\)?$/);return o?o[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)127>=o?t+=e.charAt(r):o>=192&&223>=o?(this.codePoint=o-192,this.bytesLeft=1,this.lowerBound=128):o>=224&&239>=o?(this.codePoint=o-224,this.bytesLeft=2,this.lowerBound=2048):o>=240&&247>=o?(this.codePoint=o-240,this.bytesLeft=3,this.lowerBound=65536):o>=248&&251>=o?(this.codePoint=o-248,this.bytesLeft=4,this.lowerBound=2097152):o>=252&&253>=o?(this.codePoint=o-252,this.bytesLeft=5,this.lowerBound=67108864):t+="�";else if(o>=128&&191>=o){if(this.bytesLeft--,this.codePoint=(this.codePoint<<6)+(o-128),0==this.bytesLeft){var i=this.codePoint;i<this.lowerBound||i>=55296&&57343>=i||i>1114111?t+="�":65536>i?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode(55296+(i>>>10&1023),56320+(1023&i)))}}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(o>=56320&&57343>=o)o=65533;else if(o>=55296&&56319>=o)if(r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&57343>=i?(o=65536+((1023&o)<<10)+(1023&i),r++):o=65533}else o=65533;var s;if(127>=o)t+=e.charAt(r);else for(2047>=o?(t+=String.fromCharCode(192|o>>>6),s=1):65535>=o?(t+=String.fromCharCode(224|o>>>12),s=2):(t+=String.fromCharCode(240|o>>>18),s=3);s>0;)s--,t+=String.fromCharCode(128|o>>>6*s&63)}return t},String.prototype.codePointAt||!function(){var e=function(e){if(null==this)throw TypeError();var t=String(this),r=t.length,o=e?Number(e):0;if(o!=o&&(o=0),0>o||o>=r)return void 0;var i,s=t.charCodeAt(o);return s>=55296&&56319>=s&&r>o+1&&(i=t.charCodeAt(o+1),i>=56320&&57343>=i)?1024*(s-55296)+i-56320+65536:s};Object.defineProperty?Object.defineProperty(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}(),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:32>e||e>=127&&160>e?lib.wc.controlWidth:127>e?1:lib.wc.isSpace(e)?0:1+(e>=4352&&(4447>=e||9001==e||9002==e||e>=11904&&42191>=e&&12351!=e||e>=44032&&55203>=e||e>=63744&&64255>=e||e>=65040&&65049>=e||e>=65072&&65135>=e||e>=65280&&65376>=e||e>=65504&&65510>=e||e>=131072&&196605>=e||e>=196608&&262141>=e))},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;){var i=e.codePointAt(o);if(t=lib.wc.charWidth(i),0>t)return-1;r+=t,o+=65535>=i?1:2}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)),!(s>t));o++);if(void 0!=r){for(i=o,s=0;i<e.length&&r>s;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.11"),lib.resource.add("libdot/changelog/date","text/plain","2017-04-17"),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)}function r(r){r&&window.chrome?chrome.windows.get(r.windowId,null,t):(hterm.windowType="normal",setTimeout(e,0))}if(!hterm.defaultStorage){var o=navigator.userAgent.match(/\sChrome\/(\d\d)/),i=o?parseInt(o[1]):-1;window.chrome&&chrome.storage&&chrome.storage.sync&&i>21?hterm.defaultStorage=new lib.Storage.Chrome(chrome.storage.sync):hterm.defaultStorage=new lib.Storage.Local}var s=!1;if(window.chrome&&chrome.runtime&&chrome.runtime.getManifest){var n=chrome.runtime.getManifest();s=n.app&&n.app.background}s?setTimeout(t.bind(null,{type:"popup"}),0):window.chrome&&chrome.tabs?chrome.tabs.getCurrent(r):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(t){}},hterm.pasteFromClipboard=function(e){try{e.execCommand("paste")}catch(t){}},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){return"ipc-init-ok"!=e.data.name?void console.log("Unknown message from frame:",e.data):(this.sendTerminalInfo_(),this.messageChannel_.port1.onmessage=this.onMessage.bind(this),void this.onLoad())},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.url,[this.messageChannel_.port2])},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)return void console.error("Frame already visible");var r="16px",o=hterm.getClientSize(this.div_),i=e("width",640),s=e("height",480),n=((o.width-i)/2,(o.height-s)/2,this.terminal_.document_),a=this.container_=n.createElement("div");a.style.cssText="position: absolute;display: -webkit-flex;-webkit-flex-direction: column;top: 10%;left: 4%;width: 90%;height: 80%;box-shadow: 0 0 2px "+this.terminal_.getForegroundColor()+";border: 2px "+this.terminal_.getForegroundColor()+" solid;";var l=n.createElement("div");l.style.cssText="display: -webkit-flex;-webkit-justify-content: flex-end;height: "+r+";background-color: "+this.terminal_.getForegroundColor()+";color: "+this.terminal_.getBackgroundColor()+";font-size: 16px;font-family: "+this.terminal_.getFontFamily(),a.appendChild(l);var h=this.iframe_=n.createElement("iframe");h.onload=this.onLoad_.bind(this),h.style.cssText="display: -webkit-flex;-webkit-flex: 1;width: 100%",h.setAttribute("src",this.url),h.setAttribute("seamless",!0),a.appendChild(h),this.div_.appendChild(a)},lib.rtdep("hterm.Keyboard.KeyMap"),hterm.Keyboard=function(e){this.terminal=e,this.keyboardElement_=null,this.handlers_=[["focusout",this.onFocusOut_.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.bindings=new hterm.Keyboard.Bindings(this),this.altGrMode="none",this.shiftInsertPaste=!0,this.homeKeysScroll=!1,this.pageKeysScroll=!1,this.ctrlPlusMinusZeroZoom=!0,this.ctrlCCopy=!1,this.ctrlVPaste=!1,this.applicationKeypad=!1,this.applicationCursor=!1,this.backspaceSendsBackspace=!1,this.characterEncoding="utf-8",this.metaSendsEscape=!0,this.passMetaV=!0,this.altSendsWhat="escape",this.altIsMeta=!1,this.altBackspaceIsMetaBackspace=!1,this.altKeyPressed=0,this.mediaKeysAreFKeys=!1,this.previousAltSendsWhat_=null},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,r=String.fromCharCode(e.which),o=r.toLowerCase();if(!e.ctrlKey&&!e.metaKey||"c"!=o&&"v"!=o){if(e.altKey&&"browser-key"==this.altSendsWhat&&0==e.charCode){var i=String.fromCharCode(e.keyCode);e.shiftKey||(i=i.toLowerCase()),t=i.charCodeAt(0)+128}else e.charCode>=32&&(i=e.charCode);i&&this.terminal.onVTKeystroke(String.fromCharCode(i)),e.preventDefault(),e.stopPropagation()}},hterm.Keyboard.prototype.preventChromeAppNonCtrlShiftDefault_=function(e){window.chrome&&window.chrome.app&&window.chrome.app.window&&(e.ctrlKey&&e.shiftKey||e.preventDefault())},hterm.Keyboard.prototype.onFocusOut_=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.preventChromeAppNonCtrlShiftDefault_(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.preventChromeAppNonCtrlShiftDefault_(e);var r=this.keyMap.keyDefs[e.keyCode];if(!r)return void console.warn("No definition for keyCode: "+e.keyCode);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?!1: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;d=t(h?"control":c?"alt":u?"meta":"normal");var p=!e.maskShiftKey&&e.shiftKey,m={keyCode:e.keyCode,shift:e.shiftKey,ctrl:h,alt:c,meta:u},b=this.bindings.getBinding(m);if(b&&(p=h=c=u=!1,o="normal",d=b.action,"function"==typeof d&&(d=d.call(this,this.terminal,m))),c&&"browser-key"==this.altSendsWhat&&d==n&&(d=a),d!==a&&(d!==n||h||c||u)&&(d===l&&(c=h=!1,d=r.normal,"function"==typeof d&&(d=d.apply(this.keyMap,[e,r])),d==n&&2==r.keyCap.length&&(d=r.keyCap.substr(p?1:0,1))),e.preventDefault(),e.stopPropagation(),d!==s)){if(d!==n&&"string"!=typeof d)return void console.warn("Invalid action: "+JSON.stringify(d));if("control"==o?h=!1:"alt"==o?c=!1:"meta"==o&&(u=!1),"["==d.substr(0,2)&&(c||h||p)){var f;!p||c||h?!c||p||h?p&&c&&!h?f=";4":!h||p||c?p&&h&&!c?f=";6":c&&h&&!p?f=";7":p&&c&&h&&(f=";8"):f=";5":f=";3":f=";2",d=3==d.length?"[1"+f+d.substr(2,1):d.substr(0,d.length-1)+f+d.substr(d.length-1)}else{if(d===n&&(d=r.keyCap.substr(p?1:0,1),h)){var y=r.keyCap.substr(0,1),_=y.charCodeAt(0);_>=64&&95>=_&&(d=String.fromCharCode(_-64))}if(c&&"8-bit"==this.altSendsWhat&&1==d.length){var _=d.charCodeAt(0)+128;d=String.fromCharCode(_)}(c&&"escape"==this.altSendsWhat||u&&this.metaSendsEscape)&&(d=""+d)}this.terminal.onVTKeystroke(d)}},hterm.Keyboard.Bindings=function(){this.bindings_={}},hterm.Keyboard.Bindings.prototype.clear=function(){this.bindings_={}},hterm.Keyboard.Bindings.prototype.addBinding_=function(e,t){var r=null,o=this.bindings_[e.keyCode];if(o)for(var i=0;i<o.length;i++)if(o[i].keyPattern.matchKeyPattern(e)){r=o[i];break}r?r.action=t:(r={keyPattern:e,action:t},o?(this.bindings_[e.keyCode].push(r),o.sort(function(e,t){return hterm.Keyboard.KeyPattern.sortCompare(e.keyPattern,t.keyPattern)})):this.bindings_[e.keyCode]=[r])},hterm.Keyboard.Bindings.prototype.addBinding=function(e,t){if("string"!=typeof e)return void this.addBinding_(e,t);var r=new hterm.Parser;r.reset(e);var o;try{o=r.parseKeySequence()}catch(i){return void console.error(i)}if(!r.isComplete())return void console.error(r.error("Expected end of sequence: "+o));if("string"==typeof t){r.reset(t);try{t=r.parseKeyAction()}catch(i){return void console.error(i)}}return r.isComplete()?void this.addBinding_(new hterm.Keyboard.KeyPattern(o),t):void console.error(r.error("Expected end of sequence: "+o))},hterm.Keyboard.Bindings.prototype.addBindings=function(e){for(var t in e)this.addBinding(t,e[t])},hterm.Keyboard.Bindings.prototype.getBinding=function(e){var t=this.bindings_[e.keyCode];if(!t)return null;for(var r=0;r<t.length;r++){var o=t[r];if(o.keyPattern.matchKeyDown(e))return o}return null},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.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){var s=o.shiftKey||o.ctrlKey||o.altKey||o.metaKey||!h.keyboard.applicationCursor?t:r;return e(s,o,i)}}function r(t,r){return function(o,i){var s=h.keyboard.backspaceSendsBackspace?r:t;return e(s,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){var s=o.altKey?r:t;return e(s,o,i)}}function s(t,r){return function(o,i){var s=o.shiftKey||o.ctrlKey||o.altKey||o.metaKey?r:t;return e(s,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="",u="[",g="O",d=hterm.Keyboard.KeyActions.CANCEL,p=hterm.Keyboard.KeyActions.DEFAULT,m=hterm.Keyboard.KeyActions.PASS,b=hterm.Keyboard.KeyActions.STRIP;this.addKeyDefs([0,"[UNKNOWN]",m,m,m,m],[27,"[ESC]",c,p,p,p],[112,"[F1]",s(g+"P",u+"P"),p,u+"23~",p],[113,"[F2]",s(g+"Q",u+"Q"),p,u+"24~",p],[114,"[F3]",s(g+"R",u+"R"),p,u+"25~",p],[115,"[F4]",s(g+"S",u+"S"),p,u+"26~",p],[116,"[F5]",u+"15~",p,u+"28~",p],[117,"[F6]",u+"17~",p,u+"29~",p],[118,"[F7]",u+"18~",p,u+"31~",p],[119,"[F8]",u+"19~",p,u+"32~",p],[120,"[F9]",u+"20~",p,u+"33~",p],[121,"[F10]",u+"21~",p,u+"34~",p],[122,"[F11]",u+"23~",p,u+"42~",p],[123,"[F12]",u+"24~",p,u+"43~",p],[192,"`~",p,o(n("@"),n("^")),p,m],[49,"1!",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[50,"2@",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[51,"3#",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[52,"4$",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[53,"5%",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[54,"6^",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[55,"7&",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[56,"8*",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[57,"9(",p,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[48,"0)",p,a("onPlusMinusZero_"),a("onAltNum_"),a("onPlusMinusZero_")],[189,"-_",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[187,"=+",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[173,"-_",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[61,"=+",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[171,"+*",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[8,"[BKSP]",r("","\b"),r("\b",""),p,p],[9,"[TAB]",o(" ",u+"Z"),b,m,p],[81,"qQ",p,n("Q"),p,p],[87,"wW",p,n("W"),p,p],[69,"eE",p,n("E"),p,p],[82,"rR",p,n("R"),p,p],[84,"tT",p,n("T"),p,p],[89,"yY",p,n("Y"),p,p],[85,"uU",p,n("U"),p,p],[73,"iI",p,n("I"),p,p],[79,"oO",p,n("O"),p,p],[80,"pP",p,n("P"),p,p],[219,"[{",p,n("["),p,p],[221,"]}",p,n("]"),p,p],[220,"\\|",p,n("\\"),p,p],[20,"[CAPS]",m,m,m,p],[65,"aA",p,n("A"),p,p],[83,"sS",p,n("S"),p,p],[68,"dD",p,n("D"),p,p],[70,"fF",p,n("F"),p,p],[71,"gG",p,n("G"),p,p],[72,"hH",p,n("H"),p,p],[74,"jJ",p,o(n("J"),m),p,p],[75,"kK",p,o(n("K"),a("onClear_")),p,p],[76,"lL",p,o(n("L"),m),p,p],[186,";:",p,b,p,p],[222,"'\"",p,b,p,p],[13,"[ENTER]","\r",d,d,p],[16,"[SHIFT]",m,m,m,p],[90,"zZ",p,n("Z"),p,p],[88,"xX",p,n("X"),p,p],[67,"cC",p,a("onCtrlC_"),p,a("onMetaC_")],[86,"vV",p,a("onCtrlV_"),p,a("onMetaV_")],[66,"bB",p,o(n("B"),m),p,o(p,m)],[78,"nN",p,a("onCtrlN_"),p,a("onMetaN_")],[77,"mM",p,n("M"),p,p],[188,",<",p,i(b,m),p,p],[190,".>",p,i(b,m),p,p],[191,"/?",p,o(n("_"),n("?")),p,p],[17,"[CTRL]",m,m,m,m],[18,"[ALT]",m,m,m,m],[91,"[LAPL]",m,m,m,m],[32," ",p,n("@"),p,p],[92,"[RAPL]",m,m,m,m],[93,"[RMENU]",m,m,m,m],[42,"[PRTSCR]",m,m,m,m],[145,"[SCRLK]",m,m,m,m],[19,"[BREAK]",m,m,m,m],[45,"[INSERT]",a("onKeyInsert_"),p,p,p],[36,"[HOME]",a("onKeyHome_"),p,p,p],[33,"[PGUP]",a("onKeyPageUp_"),p,p,p],[46,"[DEL]",a("onKeyDel_"),p,p,p],[35,"[END]",a("onKeyEnd_"),p,p,p],[34,"[PGDOWN]",a("onKeyPageDown_"),p,p,p],[38,"[UP]",t(u+"A",g+"A"),p,p,p],[40,"[DOWN]",t(u+"B",g+"B"),p,p,p],[39,"[RIGHT]",t(u+"C",g+"C"),p,p,p],[37,"[LEFT]",t(u+"D",g+"D"),p,p,p],[144,"[NUMLOCK]",m,m,m,m],[96,"[KP0]",p,p,p,p],[97,"[KP1]",p,p,p,p],[98,"[KP2]",p,p,p,p],[99,"[KP3]",p,p,p,p],[100,"[KP4]",p,p,p,p],[101,"[KP5]",p,p,p,p],[102,"[KP6]",p,p,p,p],[103,"[KP7]",p,p,p,p],[104,"[KP8]",p,p,p,p],[105,"[KP9]",p,p,p,p],[107,"[KP+]",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[109,"[KP-]",p,a("onPlusMinusZero_"),p,a("onPlusMinusZero_")],[106,"[KP*]",p,p,p,p],[111,"[KP/]",p,p,p,p],[110,"[KP.]",p,p,p,p],[166,"[BACK]",l(s(g+"P",u+"P")),p,u+"23~",p],[167,"[FWD]",l(s(g+"Q",u+"Q")),p,u+"24~",p],[168,"[RELOAD]",l(s(g+"R",u+"R")),p,u+"25~",p],[183,"[FSCR]",l(s(g+"S",u+"S")),p,u+"26~",p],[182,"[WINS]",l(u+"15~"),p,u+"28~",p],[216,"[BRIT-]",l(u+"17~"),p,u+"29~",p],[217,"[BRIT+]",l(u+"18~"),p,u+"31~",p])},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),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||"[KP-]"==t.keyCap?o-=1:o+=1,this.keyboard.terminal.setFontSize(o)}return hterm.Keyboard.KeyActions.CANCEL},hterm.Keyboard.KeyPattern=function(e){this.wildcardCount=0,this.keyCode=e.keyCode,hterm.Keyboard.KeyPattern.modifiers.forEach(function(t){this[t]=e[t]||!1,"*"==this[t]&&this.wildcardCount++}.bind(this))},hterm.Keyboard.KeyPattern.modifiers=["shift","ctrl","alt","meta"],hterm.Keyboard.KeyPattern.sortCompare=function(e,t){return e.wildcardCount<t.wildcardCount?-1:e.wildcardCount>t.wildcardCount?1:0},hterm.Keyboard.KeyPattern.prototype.match_=function(e,t){if(this.keyCode!=e.keyCode)return!1;var r=!0;return hterm.Keyboard.KeyPattern.modifiers.forEach(function(o){var i=o in e?e[o]:!1;r&&(t||"*"!=this[o])&&this[o]!=i&&(r=!1)}.bind(this)),r},hterm.Keyboard.KeyPattern.prototype.matchKeyDown=function(e){return this.match_(e,!1)},hterm.Keyboard.KeyPattern.prototype.matchKeyPattern=function(e){return this.match_(e,!0)},hterm.Options=function(e){this.wraparound=e?e.wraparound:!0,this.reverseWraparound=e?e.reverseWraparound:!1,this.originMode=e?e.originMode:!1,this.autoCarriageReturn=e?e.autoCarriageReturn:!1,this.cursorVisible=e?e.cursorVisible:!1,this.cursorBlink=e?e.cursorBlink:!1,this.insertMode=e?e.insertMode:!1,this.reverseVideo=e?e.reverseVideo:!1,this.bracketedPaste=e?e.bracketedPaste:!1},lib.rtdep("hterm.Keyboard.KeyActions"),hterm.Parser=function(){this.source="",this.pos=0,this.ch=null},hterm.Parser.prototype.error=function(e){return new Error("Parse error at "+this.pos+": "+e)},hterm.Parser.prototype.isComplete=function(){return this.pos==this.source.length},hterm.Parser.prototype.reset=function(e,t){this.source=e,this.pos=t||0,this.ch=e.substr(0,1)},hterm.Parser.prototype.parseKeySequence=function(){var e={keyCode:null};for(var t in hterm.Parser.identifiers.modifierKeys)e[hterm.Parser.identifiers.modifierKeys[t]]=!1;for(;this.pos<this.source.length;){this.skipSpace();var r=this.parseToken();if("integer"==r.type)e.keyCode=r.value;else if("identifier"==r.type)if(r.value in hterm.Parser.identifiers.modifierKeys){var o=hterm.Parser.identifiers.modifierKeys[r.value];if(e[o]&&"*"!=e[o])throw this.error("Duplicate modifier: "+r.value);e[o]=!0}else{if(!(r.value in hterm.Parser.identifiers.keyCodes))throw this.error("Unknown key: "+r.value);e.keyCode=hterm.Parser.identifiers.keyCodes[r.value]}else{if("symbol"!=r.type)throw this.error("Expected integer or identifier");if("*"!=r.value)throw this.error("Unexpected symbol: "+r.value);for(var i in hterm.Parser.identifiers.modifierKeys){var s=hterm.Parser.identifiers.modifierKeys[i];e[s]||(e[s]="*")}}if(this.skipSpace(),"-"!=this.ch)break;if(null!=e.keyCode)throw this.error("Extra definition after target key");this.advance(1)}if(null==e.keyCode)throw this.error("Missing target key");return e},hterm.Parser.prototype.parseKeyAction=function(){this.skipSpace();var e=this.parseToken();if("string"==e.type)return e.value;if("identifier"==e.type){if(e.value in hterm.Parser.identifiers.actions)return hterm.Parser.identifiers.actions[e.value];throw this.error("Unknown key action: "+e.value)}throw this.error("Expected string or identifier")},hterm.Parser.prototype.peekString=function(){return"'"==this.ch||'"'==this.ch},hterm.Parser.prototype.peekIdentifier=function(){return this.ch.match(/[a-z_]/i)},hterm.Parser.prototype.peekInteger=function(){return this.ch.match(/[0-9]/)},hterm.Parser.prototype.parseToken=function(){if("*"==this.ch){var e={type:"symbol",value:this.ch};return this.advance(1),e}if(this.peekIdentifier())return{type:"identifier",value:this.parseIdentifier()};if(this.peekString())return{type:"string",value:this.parseString()};if(this.peekInteger())return{type:"integer",value:this.parseInteger()};throw this.error("Unexpected token")},hterm.Parser.prototype.parseIdentifier=function(){if(!this.peekIdentifier())throw this.error("Expected identifier");return this.parsePattern(/[a-z0-9_]+/gi)},hterm.Parser.prototype.parseInteger=function(){return"0"==this.ch&&this.pos<this.source.length-1&&"x"==this.source.substr(this.pos+1,1)?parseInt(this.parsePattern(/0x[0-9a-f]+/gi)):parseInt(this.parsePattern(/\d+/g))},hterm.Parser.prototype.parseString=function(){var e="",t=this.ch;if('"'!=t&&"'"!=t)throw this.error("String expected");this.advance(1);for(var r=new RegExp("[\\\\"+t+"]","g");this.pos<this.source.length;){if(r.lastIndex=this.pos,!r.exec(this.source))throw this.error("Unterminated string literal");if(e+=this.source.substring(this.pos,r.lastIndex-1),this.advance(r.lastIndex-this.pos-1),'"'!=t||"\\"!=this.ch)if("'"!=t||"\\"!=this.ch){if(this.ch==t)return this.advance(1),e}else e+=this.ch,this.advance(1);else this.advance(1),e+=this.parseEscape()}throw this.error("Unterminated string literal")},hterm.Parser.prototype.parseEscape=function(){var e={'"':'"',"'":"'","\\":"\\",a:"",b:"\b",e:"",f:"\f",n:"\n",r:"\r",t:" ",v:"",x:function(){var e=this.parsePattern(/[a-z0-9]{2}/gi);return String.fromCharCode(parseInt(e,16))},u:function(){var e=this.parsePattern(/[a-z0-9]{4}/gi);return String.fromCharCode(parseInt(e,16))}};if(!(this.ch in e))throw this.error("Unknown escape: "+this.ch);var t=e[this.ch];return this.advance(1),"function"==typeof t&&(t=t.call(this)),t},hterm.Parser.prototype.parsePattern=function(e){if(!e.global)throw this.error("Internal error: Span patterns must be global");e.lastIndex=this.pos;var t=e.exec(this.source);if(!t||e.lastIndex-t[0].length!=this.pos)throw this.error("Expected match for: "+e);return this.pos=e.lastIndex-1,this.advance(1),t[0]},hterm.Parser.prototype.advance=function(e){this.pos+=e,this.ch=this.source.substr(this.pos,1)},hterm.Parser.prototype.skipSpace=function(e){if(/\s/.test(this.ch)){var t=/\s+/gm;t.lastIndex=this.pos;var r=this.source;if(t.exec(r)&&(this.pos=t.lastIndex),this.ch=this.source.substr(this.pos,1),e&&-1==this.ch.indexOf(e))throw this.error("Expected one of "+e+", found: "+this.ch)}},hterm.Parser.identifiers={},hterm.Parser.identifiers.modifierKeys={Shift:"shift",Ctrl:"ctrl",Alt:"alt",Meta:"meta"},hterm.Parser.identifiers.keyCodes={ESC:27,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,ZERO:48,BACKSPACE:8,TAB:9,Q:81,W:87,E:69,R:82,T:84,Y:89,U:85,I:73,O:79,P:80,CAPSLOCK:20,A:65,S:83,D:68,F:70,G:71,H:72,J:74,K:75,L:76,ENTER:13,Z:90,X:88,C:67,V:86,B:66,N:78,M:77,SPACE:32,PRINT_SCREEN:42,SCROLL_LOCK:145,BREAK:19,INSERT:45,HOME:36,PGUP:33,DEL:46,END:35,PGDOWN:34,UP:38,DOWN:40,RIGHT:39,LEFT:37,NUMLOCK:144,KP0:96,KP1:97,KP2:98,KP3:99,KP4:100,KP5:101,KP6:102,KP7:103,KP8:104,KP9:105,KP_PLUS:107,KP_MINUS:109,KP_STAR:106,KP_DIVIDE:111,KP_DECIMAL:110,NAVIGATE_BACK:166,NAVIGATE_FORWARD:167,RELOAD:168,FULL_SCREEN:183,WINDOW_OVERVIEW:182,BRIGHTNESS_UP:216,BRIGHTNESS_DOWN:217},hterm.Parser.identifiers.actions={CANCEL:hterm.Keyboard.KeyActions.CANCEL,DEFAULT:hterm.Keyboard.KeyActions.DEFAULT,PASS:hterm.Keyboard.KeyActions.PASS,scrollPageUp:function(e){return e.scrollPageUp(),hterm.Keyboard.KeyActions.CANCEL},scrollPageDown:function(e){return e.scrollPageDown(),hterm.Keyboard.KeyActions.CANCEL},scrollToTop:function(e){return e.scrollEnd(),hterm.Keyboard.KeyActions.CANCEL},scrollToBottom:function(e){return e.scrollEnd(),hterm.Keyboard.KeyActions.CANCEL},clearScrollback:function(e){return e.wipeContents(),hterm.Keyboard.KeyActions.CANCEL}},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][1])}.bind(this))},hterm.PreferenceManager.categories={},hterm.PreferenceManager.categories.Keyboard="Keyboard",hterm.PreferenceManager.categories.Appearance="Appearance",hterm.PreferenceManager.categories.CopyPaste="CopyPaste",hterm.PreferenceManager.categories.Sounds="Sounds",hterm.PreferenceManager.categories.Scrolling="Scrolling",hterm.PreferenceManager.categories.Encoding="Encoding",hterm.PreferenceManager.categories.Miscellaneous="Miscellaneous",hterm.PreferenceManager.categoryDefinitions=[{id:hterm.PreferenceManager.categories.Appearance,text:"Appearance (fonts, colors, images)"},{id:hterm.PreferenceManager.categories.CopyPaste,text:"Copy & Paste"},{id:hterm.PreferenceManager.categories.Encoding,text:"Encoding"},{id:hterm.PreferenceManager.categories.Keyboard,text:"Keyboard"},{id:hterm.PreferenceManager.categories.Scrolling,text:"Scrolling"},{id:hterm.PreferenceManager.categories.Sounds,text:"Sounds"},{id:hterm.PreferenceManager.categories.Miscellaneous,text:"Misc."}],hterm.PreferenceManager.defaultPreferences={"alt-gr-mode":[hterm.PreferenceManager.categories.Keyboard,null,[null,"none","ctrl-alt","left-alt","right-alt"],"Select an AltGr detection hack^Wheuristic.\n\n'null': Autodetect based on navigator.language:\n 'en-us' => 'none', else => 'right-alt'\n'none': Disable any AltGr related munging.\n'ctrl-alt': Assume Ctrl+Alt means AltGr.\n'left-alt': Assume left Alt means AltGr.\n'right-alt': Assume right Alt means AltGr.\n"],"alt-backspace-is-meta-backspace":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If set, undoes the Chrome OS Alt-Backspace->DEL remap, so that alt-backspace indeed is alt-backspace."],"alt-is-meta":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Set whether the alt key acts as a meta key or as a distinct alt key."],"alt-sends-what":[hterm.PreferenceManager.categories.Keyboard,"escape",["escape","8-bit","browser-key"],"Controls how the alt key is handled.\n\n escape....... Send an ESC prefix.\n 8-bit........ Add 128 to the unshifted character as in xterm.\n browser-key.. Wait for the keypress event and see what the browser \n says. (This won't work well on platforms where the \n browser performs a default action for some alt sequences.)"],"audible-bell-sound":[hterm.PreferenceManager.categories.Sounds,"lib-resource:hterm/audio/bell","url","URL of the terminal bell sound. Empty string for no audible bell."],"desktop-notification-bell":[hterm.PreferenceManager.categories.Sounds,!1,"bool",'If true, terminal bells in the background will create a Web Notification. https://www.w3.org/TR/notifications/\n\nDisplaying notifications requires permission from the user. When this option is set to true, hterm will attempt to ask the user for permission if necessary. Note browsers may not show this permission request if it did not originate from a user action.\n\nChrome extensions with the "notifications" permission have permission to display notifications.'],"background-color":[hterm.PreferenceManager.categories.Appearance,"rgb(16, 16, 16)","color","The background color for text with no other color attributes."],"background-image":[hterm.PreferenceManager.categories.Appearance,"","string","CSS value of the background image. Empty string for no image.\n\nFor example:\n url(https://goo.gl/anedTK)\n linear-gradient(top bottom, blue, red)"],"background-size":[hterm.PreferenceManager.categories.Appearance,"","string","CSS value of the background image size. Defaults to none."],"background-position":[hterm.PreferenceManager.categories.Appearance,"","string","CSS value of the background image position.\n\nFor example:\n 10% 10%\n center"],"backspace-sends-backspace":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, the backspace should send BS ('\\x08', aka ^H). Otherwise the backspace key should send '\\x7f'."],"character-map-overrides":[hterm.PreferenceManager.categories.Appearance,null,"value",'This is specified as an object. It is a sparse array, where each property is the character set code and the value is an object that is a sparse array itself. In that sparse array, each property is the received character and the value is the displayed character.\n\nFor example:\n {"0":{"+":"\\u2192",",":"\\u2190","-":"\\u2191",".":"\\u2193", "0":"\\u2588"}}'],"close-on-exit":[hterm.PreferenceManager.categories.Miscellaneous,!0,"bool","Whether or not to close the window when the command exits."],"cursor-blink":[hterm.PreferenceManager.categories.Appearance,!1,"bool","Whether or not to blink the cursor by default."],"cursor-blink-cycle":[hterm.PreferenceManager.categories.Appearance,[1e3,500],"value","The cursor blink rate in milliseconds.\n\nA two element array, the first of which is how long the cursor should be on, second is how long it should be off."],"cursor-color":[hterm.PreferenceManager.categories.Appearance,"rgba(255, 0, 0, 0.5)","color","The color of the visible cursor."],"color-palette-overrides":[hterm.PreferenceManager.categories.Appearance,null,"value","Override colors in the default palette.\n\nThis can be specified as an array or an object. If specified as an object it is assumed to be a sparse array, where each property is a numeric index into the color palette.\n\nValues can be specified as almost any css color value. This includes #RGB, #RRGGBB, rgb(...), rgba(...), and any color names that are also part of the stock X11 rgb.txt file.\n\nYou can use 'null' to specify that the default value should be not be changed. This is useful for skipping a small number of indices when the value is specified as an array."],"copy-on-select":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Automatically copy mouse selection to the clipboard."],"use-default-window-copy":[hterm.PreferenceManager.categories.CopyPaste,!1,"bool","Whether to use the default window copy behavior"],"clear-selection-after-copy":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Whether to clear the selection after copying."],"ctrl-plus-minus-zero-zoom":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","If true, Ctrl-Plus/Minus/Zero controls zoom.\nIf false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_, Ctrl-Plus/Zero do nothing."],"ctrl-c-copy":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Ctrl+C copies if true, send ^C to host if false.\nCtrl+Shift+C sends ^C to host if true, copies if false."],"ctrl-v-paste":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Ctrl+V pastes if true, send ^V to host if false.\nCtrl+Shift+V sends ^V to host if true, pastes if false."],"east-asian-ambiguous-as-two-column":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Set whether East Asian Ambiguous characters have two column width."],"enable-8-bit-control":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","True to enable 8-bit control characters, false to ignore them.\n\nWe'll respect the two-byte versions of these control characters regardless of this setting."],"enable-bold":[hterm.PreferenceManager.categories.Appearance,null,"tristate","True if we should use bold weight font for text with the bold/bright attribute. False to use the normal weight font. Null to autodetect."], |
| "enable-bold-as-bright":[hterm.PreferenceManager.categories.Appearance,!0,"bool","True if we should use bright colors (8-15 on a 16 color palette) for any text with the bold attribute. False otherwise."],"enable-blink":[hterm.PreferenceManager.categories.Appearance,!0,"bool","True if we should respect the blink attribute. False to ignore it. "],"enable-clipboard-notice":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Show a message in the terminal when the host writes to the clipboard."],"enable-clipboard-write":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Allow the host to write directly to the system clipboard."],"enable-dec12":[hterm.PreferenceManager.categories.Miscellaneous,!1,"bool","Respect the host's attempt to change the cursor blink status using DEC Private Mode 12."],environment:[hterm.PreferenceManager.categories.Miscellaneous,{TERM:"xterm-256color"},"value","The default environment variables, as an object."],"font-family":[hterm.PreferenceManager.categories.Appearance,'"DejaVu Sans Mono", "Everson Mono", FreeMono, "Menlo", "Terminal", monospace',"string","Default font family for the terminal text."],"font-size":[hterm.PreferenceManager.categories.Appearance,15,"int","The default font size in pixels."],"font-smoothing":[hterm.PreferenceManager.categories.Appearance,"antialiased","string","CSS font-smoothing property."],"foreground-color":[hterm.PreferenceManager.categories.Appearance,"rgb(240, 240, 240)","color","The foreground color for text with no other color attributes."],"home-keys-scroll":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, home/end will control the terminal scrollbar and shift home/end will send the VT keycodes. If false then home/end sends VT codes and shift home/end scrolls."],keybindings:[hterm.PreferenceManager.categories.Keyboard,null,"value",'A map of key sequence to key actions. Key sequences include zero or more modifier keys followed by a key code. Key codes can be decimal or hexadecimal numbers, or a key identifier. Key actions can be specified a string to send to the host, or an action identifier. For a full list of key code and action identifiers, see https://goo.gl/8AoD09.\n\nSample keybindings:\n{ "Ctrl-Alt-K": "clearScrollback",\n "Ctrl-Shift-L": "PASS",\n "Ctrl-H": "\'HELLO\\n\'"\n}'],"max-string-sequence":[hterm.PreferenceManager.categories.Encoding,1e5,"int","Max length of a DCS, OSC, PM, or APS sequence before we give up and ignore the code."],"media-keys-are-fkeys":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, convert media keys to their Fkey equivalent. If false, let the browser handle the keys."],"meta-sends-escape":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","Set whether the meta key sends a leading escape or not."],"mouse-paste-button":[hterm.PreferenceManager.categories.CopyPaste,null,[null,0,1,2,3,4,5,6],"Mouse paste button, or null to autodetect.\n\nFor autodetect, we'll try to enable middle button paste for non-X11 platforms. On X11 we move it to button 3."],"page-keys-scroll":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, page up/down will control the terminal scrollbar and shift page up/down will send the VT keycodes. If false then page up/down sends VT codes and shift page up/down scrolls."],"pass-alt-number":[hterm.PreferenceManager.categories.Keyboard,null,"tristate","Set whether we should pass Alt-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Alt-1..9 will be handled by the browser. If false, Alt-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],"pass-ctrl-number":[hterm.PreferenceManager.categories.Keyboard,null,"tristate","Set whether we should pass Ctrl-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Ctrl-1..9 will be handled by the browser. If false, Ctrl-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],"pass-meta-number":[hterm.PreferenceManager.categories.Keyboard,null,"tristate","Set whether we should pass Meta-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Meta-1..9 will be handled by the browser. If false, Meta-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],"pass-meta-v":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","Set whether meta-V gets passed to host."],"receive-encoding":[hterm.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the expected encoding for data received from the host.\n\nValid values are 'utf-8' and 'raw'."],"scroll-on-keystroke":[hterm.PreferenceManager.categories.Scrolling,!0,"bool","If true, scroll to the bottom on any keystroke."],"scroll-on-output":[hterm.PreferenceManager.categories.Scrolling,!1,"bool","If true, scroll to the bottom on terminal output."],"scrollbar-visible":[hterm.PreferenceManager.categories.Scrolling,!0,"bool","The vertical scrollbar mode."],"scroll-wheel-move-multiplier":[hterm.PreferenceManager.categories.Scrolling,1,"int","The multiplier for the pixel delta in mousewheel event caused by the scroll wheel. Alters how fast the page scrolls."],"send-encoding":[hterm.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the encoding for data sent to host."],"shift-insert-paste":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","Shift + Insert pastes if true, sent to host if false."],"user-css":[hterm.PreferenceManager.categories.Appearance,"","url","URL of user stylesheet to include in the terminal document."]},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(0>o)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)return void console.warn("Attempt to set cursor position on empty screen.");e>=this.rowsArray.length?(console.error("Row out of bounds: "+e),e=this.rowsArray.length-1):0>e&&(console.error("Row out of bounds: "+e),e=0),t>=this.columnCount_?(console.error("Column out of bounds: "+t),t=this.columnCount_-1):0>t&&(console.error("Column out of bounds: "+t),t=0),this.cursorPosition.overflow=!1;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}},hterm.Screen.prototype.syncSelectionCaret=function(e){try{e.collapse(this.cursorNode_,this.cursorOffset_)}catch(t){}},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_)return void(this.cursorPosition.column>=this.columnCount_&&(this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1),this.cursorPosition.overflow=!0));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(0>s){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 0==s?t.textContent=r+e:0==i?t.textContent=e+r:t.textContent=hterm.TextAttributes.nodeSubstr(t,0,i)+e+hterm.TextAttributes.nodeSubstr(t,i),void(this.cursorOffset_+=o);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));var h=this.textAttributes.createContainer(e);return this.cursorRowNode_.insertBefore(h,t),this.cursorNode_=h,void(this.cursorOffset_=o)}if(0==s){var c=t.nextSibling;if(c&&this.textAttributes.matchesContainer(c))return c.textContent=e+c.textContent,this.cursorNode_=c,void(this.cursorOffset_=lib.wc.strWidth(e));var h=this.textAttributes.createContainer(e);return this.cursorRowNode_.insertBefore(h,c),this.cursorNode_=h,void(this.cursorOffset_=hterm.TextAttributes.nodeWidth(h))}this.splitNode_(t,i);var h=this.textAttributes.createContainer(e);this.cursorRowNode_.insertBefore(h,t.nextSibling),this.cursorNode_=h,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);return this.textAttributes.matchesContainer(this.cursorNode_)&&this.cursorNode_.textContent.substr(this.cursorOffset_)==e?(this.cursorOffset_+=r,void(this.cursorPosition.column+=r)):(this.deleteChars(Math.min(r,t)),void this.insertString(e))},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),!e)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,i>r&&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(i>=t)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="[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:`]",n="[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:~.`]",a="[^\\s\\[\\](){}<>\"'\\^]*",l=this.getLineText_(r),h=lib.wc.substring(l,0,i),c=new RegExp(s+a+"$"),u=h.search(c);if(!(-1==u||u>o)){var g=lib.wc.substring(l,o,lib.wc.strWidth(l)),d=new RegExp("^"+a+n),p=g.match(d);if(p){var m=o+lib.wc.strWidth(p[0]);-1==m||i>m||(this.setRange_(r,u,m,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)return void console.error("Selection anchor is not rooted in a row node: "+o.anchorNode.nodeName);for(var s=o.focusNode;s&&!("rowIndex"in s);)s=s.parentNode;if(!s)return void console.error("Selection focus is not rooted in a row node: "+o.focusNode.nodeName);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}},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;cursor: text;-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("role","textbox"),this.screen_.setAttribute("tabindex","-1"),this.screen_.style.cssText="display: block;font-family: monospace;font-size: 15px;font-variant-ligatures: none;height: 100%;overflow-y: scroll; overflow-x: hidden;white-space: pre;width: 100%;outline: none !important",t.body.appendChild(this.screen_),this.screen_.addEventListener("scroll",this.onScroll_.bind(this)),this.screen_.addEventListener("mousewheel",this.onScrollWheel_.bind(this)),this.screen_.addEventListener("DOMMouseScroll",this.onScrollWheel_.bind(this)),this.screen_.addEventListener("copy",this.onCopy_.bind(this)),this.screen_.addEventListener("paste",this.onPaste_.bind(this)),t.body.addEventListener("keydown",this.onBodyKeyDown_.bind(this)),this.rowNodes_=t.createElement("div"),this.rowNodes_.style.cssText="display: block;position: fixed;overflow: hidden;-webkit-user-select: text;-moz-user-select: text;",this.screen_.appendChild(this.rowNodes_),this.topSelectBag_=t.createElement("x-select-bag"),this.topSelectBag_.style.cssText="display: block;overflow: hidden;white-space: pre;",this.bottomSelectBag_=this.topSelectBag_.cloneNode(),this.topFold_=t.createElement("x-fold"),this.topFold_.style.cssText="display: block;",this.rowNodes_.appendChild(this.topFold_),this.bottomFold_=this.topFold_.cloneNode(),this.rowNodes_.appendChild(this.bottomFold_),this.scrollArea_=t.createElement("div"),this.scrollArea_.style.cssText="visibility: hidden",this.screen_.appendChild(this.scrollArea_);var o="http://www.w3.org/2000/svg";this.svg_=this.div_.ownerDocument.createElementNS(o,"svg"),this.svg_.setAttribute("xmlns",o),this.svg_.setAttribute("version","1.1"),this.svg_.style.cssText="position: absolute;top: 0;left: 0;visibility: hidden",this.pasteTarget_=t.createElement("textarea"),this.pasteTarget_.setAttribute("tabindex","-1"),this.pasteTarget_.style.cssText="position: absolute;height: 1px;width: 1px;left: 0px; bottom: 0px;opacity: 0",this.pasteTarget_.contentEditable=!0,this.screen_.appendChild(this.pasteTarget_),this.pasteTarget_.addEventListener("textInput",this.handlePasteTargetTextInput_.bind(this)),this.resize()},hterm.ScrollPort.prototype.setFontFamily=function(e,t){this.screen_.style.fontFamily=e,t?this.screen_.style.webkitFontSmoothing=t:this.screen_.style.webkitFontSmoothing="",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){this.screen_.style.color=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){var t=100,r="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";if(!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");for(var o=""+r,i=0;t-1>i;++i)o+=String.fromCharCode(13)+r;this.rulerSpan_.innerHTML=o,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 s=hterm.getClientSize(this.rulerSpan_),n=new hterm.Size(s.width/r.length,s.height/t);return this.ruler_.appendChild(this.rulerBaseline_),n.baseline=this.rulerBaseline_.offsetTop,this.ruler_.removeChild(this.rulerBaseline_),this.rowNodes_.removeChild(this.ruler_),this.div_.ownerDocument.body.appendChild(this.svg_),n.zoomFactor=this.svg_.currentScale,this.div_.ownerDocument.body.removeChild(this.svg_),n},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)return void(this.rowNodes_.firstChild!=this.topFold_&&this.rowNodes_.insertBefore(this.topFold_,this.rowNodes_.firstChild));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)return void(this.rowNodes_.lastChild!=this.bottomFold_&&this.rowNodes_.appendChild(this.bottomFold_));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;l>h;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{var u=this.fetchRowNode_(c);if(!u){console.log("Couldn't fetch row index: "+c);break}this.rowNodes_.insertBefore(u,a)}else a=a.nextSibling;else{var u=this.fetchRowNode_(c);if(!u){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&&(t=0),this.screen_.scrollTop!=t&&(this.screen_.scrollTop=t)},hterm.ScrollPort.prototype.getTopRowIndex=function(){return Math.round(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();return t.width!=this.lastScreenWidth_||t.height!=this.lastScreenHeight_?void this.resize():(this.redraw_(),void this.publish("scroll",{scrollPort:this}))},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;0>r&&(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),r=t.toLowerCase();(e.ctrlKey||e.metaKey)&&"v"==r&&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.defeatMouseReports_=!1,this.bellAudio_=this.document_.createElement("audio"),this.bellAudio_.setAttribute("preload","auto"),this.bellNotificationList_=[],this.desktopNotificationBell_=!1,this.savedOptions_={},this.options_=new hterm.Options,this.timeouts_={},this.vt=new hterm.VT(this),this.keyboard=new hterm.Keyboard(this),this.io=new hterm.Terminal.IO(this),this.enableMouseDragScroll=!0,this.copyOnSelect=null,this.mousePasteButton=null,this.useDefaultWindowCopy=!1,this.clearSelectionAfterCopy=!0,this.realizeSize_(80,24),this.setDefaultTabStops(),this.setProfile(e||"default",function(){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))return void console.warn("Preference character-map-modifications is not an object: "+e);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)}},"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:"number"==typeof e?r.cursorBlinkCycle_=[e,e]:r.cursorBlinkCycle_=[100,100]},"cursor-color":function(e){r.setCursorColor(e)},"color-palette-overrides":function(e){if(!(null==e||e instanceof Object||e instanceof Array))return void console.warn("Preference color-palette-overrides is not an array or object: "+e);if(lib.colors.colorPalette=lib.colors.stockColorPalette.concat(),e)for(var t in e){var o=parseInt(t);if(isNaN(o)||0>o||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()},"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-blink":function(e){r.syncBlinkState()},"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},keybindings:function(e){if(r.keyboard.bindings.clear(),e){if(!(e instanceof Object))return void console.error("Error in keybindings preference: Expected object");try{r.keyboard.bindings.addBindings(e)}catch(t){console.error("Error in keybindings preference: "+t)}}},"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){if(null==e){var t=window.navigator.userAgent.match(/Mac OS X/);e=!t&&"popup"!=hterm.windowType}r.passAltNumber=e},"pass-ctrl-number":function(e){if(null==e){var t=window.navigator.userAgent.match(/Mac OS X/);e=!t&&"popup"!=hterm.windowType}r.passCtrlNumber=e},"pass-meta-number":function(e){if(null==e){var t=window.navigator.userAgent.match(/Mac OS X/);e=t&&"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"!=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)return void(this.mousePasteButton=e);var t=navigator.userAgent.match(/\(X11;\s+(\S+)/);t&&"CrOS"!=t[2]?this.mousePasteButton=3:this.mousePasteButton=2},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.syncBlinkState=function(){this.document_.documentElement.style.setProperty("--hterm-blink-node-duration",this.prefs_.get("enable-blink")?"0.7s":"0")},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){return null==e?void(this.div_.style.width="100%"):(this.div_.style.width=Math.ceil(this.scrollPort_.characterSize.width*e+this.scrollPort_.currentScrollbarWidthPx)+"px",this.realizeSize_(e,this.screenSize.height),void this.scheduleSyncCursorPosition_())},hterm.Terminal.prototype.setHeight=function(e){return null==e?void(this.div_.style.height="100%"):(this.div_.style.height=this.scrollPort_.characterSize.height*e+"px",this.realizeSize_(this.screenSize.width,e),void this.scheduleSyncCursorPosition_())},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(0>=e)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(0>=e)throw new Error("Attempt to realize bad height: "+e);var t=e-this.screen_.getHeight();this.screenSize.height=e;var r=this.saveCursor();if(0>t){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){var t=e||0,r=this.tabWidth;t=t-1-(t-1)%r+r;for(var o=t;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;}:root { --hterm-blink-node-duration: 0.7s;}@keyframes blink { from { opacity: 1.0; } to { opacity: 0.0; }}.blink-node { animation-name: blink; animation-duration: var(--hterm-blink-node-duration); animation-iteration-count: infinite; animation-timing-function: ease-in-out; animation-direction: alternate;}",this.document_.head.appendChild(o);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_),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;t>o;o++){var i=this.getRowNode(o);r.push(i.textContent),t-1>o&&!i.getAttribute("line-overflow")&&r.push("\n")}return r.join("")},hterm.Terminal.prototype.getRowText=function(e){var t=this.getRowNode(e);return t.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;e>o;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;r>e?(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;t>s;s++)o.rowsArray[s].rowIndex=i+s},hterm.Terminal.prototype.print=function(e){for(var t=0,r=lib.wc.strWidth(e);r>t;){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;t>=r;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;r>o;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();e=Math.min(e,r-t);var o=r-t-e+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;e=Math.min(e,i);var s=o-e+1;e!=i&&this.moveRows_(r,e,s);for(var n=0;e>n;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(){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>e)){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>o&&(r=r-Math.floor(e/this.screenSize.width)-1,0>r&&(r=this.screenSize.height+r%this.screenSize.height),o=this.screenSize.width+o%this.screenSize.width),this.setCursorPosition(Math.max(r,0),o)}else{var o=Math.max(t-e,0);this.setCursorColumn(o)}}},hterm.Terminal.prototype.cursorRight=function(e){if(e=e||1,!(1>e)){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)return void(this.cursorNode_.style.top=-this.scrollPort_.characterSize.height+"px");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_.addEventListener("click",function(e){this.parentNode.removeChild(this)})}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(r=e.endNode,"X-ROW"!=r.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.openUrl=function(e){var t=window.open(e,"_blank");t.focus()},hterm.Terminal.prototype.openSelectedUrl_=function(){var e=this.getSelectionText();null==e&&(this.screen_.expandSelection(this.document_.getSelection()),e=this.getSelectionText()),e.length>2048||e.search(/[\s\[\](){}<>"'\\^`]/)>=0||(e.search("^[a-zA-Z][a-zA-Z0-9+.-]*://")<0&&(e="http://"+e),this.openUrl(e))},hterm.Terminal.prototype.onMouse_=function(e){if(!e.processedByTerminalHandler_){var t=!this.defeatMouseReports_&&this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED;if(e.processedByTerminalHandler_=!0,e.terminalRow=parseInt((e.clientY-this.scrollPort_.visibleRowTopMargin)/this.scrollPort_.characterSize.height)+1,e.terminalColumn=parseInt(e.clientX/this.scrollPort_.characterSize.width)+1,!("mousedown"==e.type&&e.terminalColumn>this.screenSize.width)){if(this.options_.cursorVisible&&!t&&(e.terminalRow-1==this.screen_.cursorPosition.row&&e.terminalColumn-1==this.screen_.cursorPosition.column?this.cursorNode_.style.display="none":"none"==this.cursorNode_.style.display&&(this.cursorNode_.style.display="")),"mousedown"==e.type&&(e.altKey||!t?(this.defeatMouseReports_=!0,this.setSelectionEnabled(!0)):(this.defeatMouseReports_=!1,this.document_.getSelection().collapseToEnd(),this.setSelectionEnabled(!1),e.preventDefault())),t)this.scrollBlockerNode_.engaged||("mousedown"==e.type?(this.scrollBlockerNode_.engaged=!0,this.scrollBlockerNode_.style.top=e.clientY-5+"px",this.scrollBlockerNode_.style.left=e.clientX-5+"px"):"mousemove"==e.type&&(this.document_.getSelection().collapseToEnd(),e.preventDefault())),this.onMouse(e);else{if("dblclick"==e.type&&this.copyOnSelect&&(this.screen_.expandSelection(this.document_.getSelection()),this.copySelectionToClipboard(this.document_)),"click"==e.type&&!e.shiftKey&&e.ctrlKey)return clearTimeout(this.timeouts_.openUrl),void(this.timeouts_.openUrl=setTimeout(this.openSelectedUrl_.bind(this),500));"mousedown"==e.type&&e.which==this.mousePasteButton&&this.paste(),"mouseup"==e.type&&1==e.which&&this.copyOnSelect&&!this.document_.getSelection().isCollapsed&&this.copySelectionToClipboard(this.document_),"mousemove"!=e.type&&"mouseup"!=e.type||!this.scrollBlockerNode_.engaged||(this.scrollBlockerNode_.engaged=!1,this.scrollBlockerNode_.style.top="-99px")}"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.defeatMouseReports_=!1)}}},hterm.Terminal.prototype.onMouse=function(e){},hterm.Terminal.prototype.onFocusChange_=function(e){this.cursorNode_.setAttribute("focus",e),this.restyleCursor_(),e===!0&&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)||0,t=lib.f.smartFloorDivide(this.scrollPort_.getScreenHeight(),this.scrollPort_.characterSize.height)||0;if(!(0>=e||0>=t)){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(){return this.options_.cursorBlink?void("false"==this.cursorNode_.getAttribute("focus")||"0"==this.cursorNode_.style.opacity?(this.cursorNode_.style.opacity="1",this.timeouts_.cursorBlink=setTimeout(this.myOnCursorBlink_,this.cursorBlinkCycle_[0])):(this.cursorNode_.style.opacity="0",this.timeouts_.cursorBlink=setTimeout(this.myOnCursorBlink_,this.cursorBlinkCycle_[1]))):void delete this.timeouts_.cursorBlink},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){if(this.isDefault())return this.document_.createTextNode(e);var t=this.document_.createElement("span"),r=t.style,o=[];this.foreground!=this.DEFAULT_COLOR&&(r.color=this.foreground),this.background!=this.DEFAULT_COLOR&&(r.backgroundColor=this.background),this.enableBold&&this.bold&&(r.fontWeight="bold"),this.faint&&(t.faint=!0),this.italic&&(r.fontStyle="italic"),this.blink&&(o.push("blink-node"),t.blinkNode=!0);var i="";return this.underline&&(i+=" underline",t.underline=!0),this.strikethrough&&(i+=" line-through",t.strikethrough=!0),i&&(r.textDecoration=i),this.wcNode&&(o.push("wc-node"),t.wcNode=!0),null!=this.tileData&&(o.push("tile"),o.push("tile_"+this.tileData),t.tileNode=!0),e&&(t.textContent=e),o.length&&(t.className=o.join(" ")),t},hterm.TextAttributes.prototype.matchesContainer=function(e){if("string"==typeof e||3==e.nodeType)return this.isDefault();var t=e.style;return!(this.wcNode||e.wcNode||null!=this.tileData||e.tileNode||this.foreground!=t.color||this.background!=t.backgroundColor||(this.enableBold&&this.bold)!=!!t.fontWeight||this.blink!=e.blinkNode||this.italic!=!!t.fontStyle||!!this.underline!=!!e.underline||!!this.strikethrough!=!!e.strikethrough)},hterm.TextAttributes.prototype.setDefaults=function(e,t){this.defaultForeground=e,this.defaultBackground=t,this.syncColors()},hterm.TextAttributes.prototype.syncColors=function(){function e(e){return 8>e?e+8:e}var t=this.foregroundSource,r=this.backgroundSource,o=this.DEFAULT_COLOR,i=this.DEFAULT_COLOR;if(this.inverse&&(t=this.backgroundSource,r=this.foregroundSource,o=this.defaultBackground,i=this.defaultForeground),this.enableBoldAsBright&&this.bold&&t!=this.SRC_DEFAULT&&t!=this.SRC_RGB&&(t=e(t)),this.invisible&&(t=r,o=this.defaultBackground),t!=this.SRC_RGB&&(this.foreground=t==this.SRC_DEFAULT?o:this.colorPalette[t]),this.faint&&!this.invisible){var s=this.foreground==this.DEFAULT_COLOR?this.defaultForeground:this.foreground;this.foreground=lib.colors.mix(s,"rgb(0, 0, 0)",.3333)}r!=this.SRC_RGB&&(this.background=r==this.SRC_DEFAULT?i:this.colorPalette[r])},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;){var s=e.codePointAt(i),n=65535>=s?1:2;128>s||1==lib.wc.charWidth(s)?o+=n:(o&&t.push({str:e.substr(r,o)}),t.push({str:e.substr(i,n),wcNode:!0}),r=i+n,o=0),i+=n}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,"undefined"!=typeof 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=(e.wheelDeltaY>0?0:1)+96,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"&&"9">=t?this.trailingModifier_?e.resetParseFunction():r.length?r[r.length-1]+=t:r[0]=t:t>=" "&&"?">=t&&":"!=t?r.length?this.trailingModifier_+=t:this.leadingModifier_+=t:this.cc1Pattern_.test(t)?this.dispatch("CC1",t,e):e.resetParseFunction(),e.advance(1)},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];return o?o==hterm.VT.ignore?void(this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t))):"CC1"==e&&t>""&&!this.enable8BitControl?void console.warn("Ignoring 8-bit control code: 0x"+t.charCodeAt(0).toString(16)):void o.apply(this,[r,t]):void(this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t)))},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["\x00"]=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[" "]=function(){this.terminal.forwardTabStop()},hterm.VT.CC1["\n"]=function(){this.terminal.formFeed()},hterm.VT.CC1[""]=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){"G1"==this.GL&&(this.GL="G0"),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){var t=e.consumeChar();"8"==t&&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();return""==r?(e.resetParseFunction(),void e.func()):(r in hterm.VT.CharacterMap.maps?"("==t?this.G0=hterm.VT.CharacterMap.maps[r]:")"==t||"-"==t?this.G1=hterm.VT.CharacterMap.maps[r]:"*"==t||"."==t?this.G2=hterm.VT.CharacterMap.maps[r]:("+"==t||"/"==t)&&(this.G3=hterm.VT.CharacterMap.maps[r]):this.warnUnimplemented&&console.log('Invalid character set for "'+t+'": '+r),void e.resetParseFunction())}},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;r>s;++s){var n=parseInt(t[2*s]),a=t[2*s+1];n>=o.length||("?"!=a?(a=lib.colors.x11ToCSS(a),a&&(o[n]=a)):(a=lib.colors.rgbToX11(o[n]),a&&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)return void console.warn("Could not parse OSC 50 args: "+e.args[0]);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)}},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;t>r;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;t>r;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){if(e.args.length<t+5||"2"!=e.args[t+1])return null;var r=e.iarg(t+2,0),o=e.iarg(t+3,0),i=e.iarg(t+4,0);return"rgb("+r+" ,"+o+" ,"+i+")"}var o=this.terminal.getTextAttributes();if(!e.args.length)return void o.reset();for(var i=0;i<e.args.length;i++){var s=e.iarg(i,0);if(30>s)0==s?o.reset():1==s?o.bold=!0:2==s?o.faint=!0:3==s?o.italic=!0:4==s?o.underline=!0:5==s?o.blink=!0:7==s?o.inverse=!0:8==s?o.invisible=!0:9==s?o.strikethrough=!0:22==s?(o.bold=!1,o.faint=!1):23==s?o.italic=!1:24==s?o.underline=!1:25==s?o.blink=!1:27==s?o.inverse=!1:28==s?o.invisible=!1:29==s&&(o.strikethrough=!1);else if(50>s)if(38>s)o.foregroundSource=s-30;else if(38==s){var n=r(i);if(null!=n)o.foregroundSource=o.SRC_RGB,o.foreground=n,i+=5;else{var a=t(i);if(null==a)break;if(i+=2,a>=o.colorPalette.length)continue;o.foregroundSource=a}}else if(39==s)o.foregroundSource=o.SRC_DEFAULT;else if(48>s)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&&97>=s?o.foregroundSource=s-90+8:s>=100&&107>=s&&(o.backgroundSource=s-100+8)}o.setDefaults(this.terminal.getForegroundColor(),this.terminal.getBackgroundColor())},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",{"#":"£","@":"¾","[":"IJ","\\":"½","]":"|","{":"¨","|":"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","Tue, 25 Apr 2017 15:12:45 +0000"),lib.resource.add("hterm/changelog/version","text/plain","1.62"),lib.resource.add("hterm/changelog/date","text/plain","2017-04-17"),lib.resource.add("hterm/git/HEAD","text/plain","git rev-parse HEAD"); |