How to use userAgent method in Puppeteer

Best JavaScript code snippet using puppeteer

prompt-service.js

Source:prompt-service.js Github

copy

Full Screen

1var $jscomp = $jscomp || {};2$jscomp.scope = {};3$jscomp.checkStringArgs = function(a, b, c) {4 if (null == a) {5 throw new TypeError("The 'this' value for String.prototype." + c + " must not be null or undefined");6 }7 if (b instanceof RegExp) {8 throw new TypeError("First argument to String.prototype." + c + " must not be a regular expression");9 }10 return a + "";11};12$jscomp.ASSUME_ES5 = !1;13$jscomp.ASSUME_NO_NATIVE_MAP = !1;14$jscomp.ASSUME_NO_NATIVE_SET = !1;15$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {16 a != Array.prototype && a != Object.prototype && (a[b] = c.value);17};18$jscomp.getGlobal = function(a) {19 return "undefined" != typeof window && window === a ? a : "undefined" != typeof global && null != global ? global : a;20};21$jscomp.global = $jscomp.getGlobal(this);22$jscomp.polyfill = function(a, b, c, d) {23 if (b) {24 c = $jscomp.global;25 a = a.split(".");26 for (d = 0; d < a.length - 1; d++) {27 var e = a[d];28 e in c || (c[e] = {});29 c = c[e];30 }31 a = a[a.length - 1];32 d = c[a];33 b = b(d);34 b != d && null != b && $jscomp.defineProperty(c, a, {configurable:!0, writable:!0, value:b});35 }36};37$jscomp.polyfill("String.prototype.repeat", function(a) {38 return a ? a : function(a) {39 var b = $jscomp.checkStringArgs(this, null, "repeat");40 if (0 > a || 1342177279 < a) {41 throw new RangeError("Invalid count value");42 }43 a |= 0;44 for (var d = ""; a;) {45 if (a & 1 && (d += b), a >>>= 1) {46 b += b;47 }48 }49 return d;50 };51}, "es6-impl", "es3");52$jscomp.findInternal = function(a, b, c) {53 a instanceof String && (a = String(a));54 for (var d = a.length, e = 0; e < d; e++) {55 var f = a[e];56 if (b.call(c, f, e, a)) {57 return {i:e, v:f};58 }59 }60 return {i:-1, v:void 0};61};62$jscomp.polyfill("Array.prototype.findIndex", function(a) {63 return a ? a : function(a, c) {64 return $jscomp.findInternal(this, a, c).i;65 };66}, "es6-impl", "es3");67$jscomp.polyfill("Array.prototype.find", function(a) {68 return a ? a : function(a, c) {69 return $jscomp.findInternal(this, a, c).v;70 };71}, "es6-impl", "es3");72var COMPILED = !0, goog = goog || {};73goog.global = this;74goog.isDef = function(a) {75 return void 0 !== a;76};77goog.isString = function(a) {78 return "string" == typeof a;79};80goog.isBoolean = function(a) {81 return "boolean" == typeof a;82};83goog.isNumber = function(a) {84 return "number" == typeof a;85};86goog.exportPath_ = function(a, b, c) {87 a = a.split(".");88 c = c || goog.global;89 a[0] in c || !c.execScript || c.execScript("var " + a[0]);90 for (var d; a.length && (d = a.shift());) {91 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] && c[d] !== Object.prototype[d] ? c[d] : c[d] = {};92 }93};94goog.define = function(a, b) {95 COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && void 0 === goog.global.CLOSURE_UNCOMPILED_DEFINES.nodeType && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? b = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && void 0 === goog.global.CLOSURE_DEFINES.nodeType && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (b = goog.global.CLOSURE_DEFINES[a]));96 goog.exportPath_(a, b);97};98goog.DEBUG = !0;99goog.LOCALE = "en";100goog.TRUSTED_SITE = !0;101goog.STRICT_MODE_COMPATIBLE = !1;102goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG;103goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1;104goog.provide = function(a) {105 if (goog.isInModuleLoader_()) {106 throw Error("goog.provide can not be used within a goog.module.");107 }108 if (!COMPILED && goog.isProvided_(a)) {109 throw Error('Namespace "' + a + '" already declared.');110 }111 goog.constructNamespace_(a);112};113goog.constructNamespace_ = function(a, b) {114 if (!COMPILED) {115 delete goog.implicitNamespaces_[a];116 for (var c = a; (c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);) {117 goog.implicitNamespaces_[c] = !0;118 }119 }120 goog.exportPath_(a, b);121};122goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;123goog.module = function(a) {124 if (!goog.isString(a) || !a || -1 == a.search(goog.VALID_MODULE_RE_)) {125 throw Error("Invalid module identifier");126 }127 if (!goog.isInModuleLoader_()) {128 throw Error("Module " + a + " has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");129 }130 if (goog.moduleLoaderState_.moduleName) {131 throw Error("goog.module may only be called once per module.");132 }133 goog.moduleLoaderState_.moduleName = a;134 if (!COMPILED) {135 if (goog.isProvided_(a)) {136 throw Error('Namespace "' + a + '" already declared.');137 }138 delete goog.implicitNamespaces_[a];139 }140};141goog.module.get = function(a) {142 return goog.module.getInternal_(a);143};144goog.module.getInternal_ = function(a) {145 if (!COMPILED) {146 if (a in goog.loadedModules_) {147 return goog.loadedModules_[a];148 }149 if (!goog.implicitNamespaces_[a]) {150 return a = goog.getObjectByName(a), null != a ? a : null;151 }152 }153 return null;154};155goog.moduleLoaderState_ = null;156goog.isInModuleLoader_ = function() {157 return null != goog.moduleLoaderState_;158};159goog.module.declareLegacyNamespace = function() {160 if (!COMPILED && !goog.isInModuleLoader_()) {161 throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");162 }163 if (!COMPILED && !goog.moduleLoaderState_.moduleName) {164 throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");165 }166 goog.moduleLoaderState_.declareLegacyNamespace = !0;167};168goog.setTestOnly = function(a) {169 if (goog.DISALLOW_TEST_ONLY_CODE) {170 throw a = a || "", Error("Importing test-only code into non-debug environment" + (a ? ": " + a : "."));171 }172};173goog.forwardDeclare = function(a) {174};175COMPILED || (goog.isProvided_ = function(a) {176 return a in goog.loadedModules_ || !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a));177}, goog.implicitNamespaces_ = {"goog.module":!0});178goog.getObjectByName = function(a, b) {179 a = a.split(".");180 b = b || goog.global;181 for (var c; c = a.shift();) {182 if (goog.isDefAndNotNull(b[c])) {183 b = b[c];184 } else {185 return null;186 }187 }188 return b;189};190goog.globalize = function(a, b) {191 b = b || goog.global;192 for (var c in a) {193 b[c] = a[c];194 }195};196goog.addDependency = function(a, b, c, d) {197 if (goog.DEPENDENCIES_ENABLED) {198 var e;199 a = a.replace(/\\/g, "/");200 var f = goog.dependencies_;201 d && "boolean" !== typeof d || (d = d ? {module:"goog"} : {});202 for (var g = 0; e = b[g]; g++) {203 f.nameToPath[e] = a, f.loadFlags[a] = d;204 }205 for (d = 0; b = c[d]; d++) {206 a in f.requires || (f.requires[a] = {}), f.requires[a][b] = !0;207 }208 }209};210goog.ENABLE_DEBUG_LOADER = !0;211goog.logToConsole_ = function(a) {212 goog.global.console && goog.global.console.error(a);213};214goog.require = function(a) {215 if (!COMPILED) {216 goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_ && goog.maybeProcessDeferredDep_(a);217 if (goog.isProvided_(a)) {218 if (goog.isInModuleLoader_()) {219 return goog.module.getInternal_(a);220 }221 } else {222 if (goog.ENABLE_DEBUG_LOADER) {223 var b = goog.getPathFromDeps_(a);224 if (b) {225 goog.writeScripts_(b);226 } else {227 throw a = "goog.require could not find: " + a, goog.logToConsole_(a), Error(a);228 }229 }230 }231 return null;232 }233};234goog.basePath = "";235goog.nullFunction = function() {236};237goog.abstractMethod = function() {238 throw Error("unimplemented abstract method");239};240goog.addSingletonGetter = function(a) {241 a.instance_ = void 0;242 a.getInstance = function() {243 if (a.instance_) {244 return a.instance_;245 }246 goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);247 return a.instance_ = new a;248 };249};250goog.instantiatedSingletons_ = [];251goog.LOAD_MODULE_USING_EVAL = !0;252goog.SEAL_MODULE_EXPORTS = goog.DEBUG;253goog.loadedModules_ = {};254goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;255goog.TRANSPILE = "detect";256goog.TRANSPILER = "transpile.js";257goog.DEPENDENCIES_ENABLED && (goog.dependencies_ = {loadFlags:{}, nameToPath:{}, requires:{}, visited:{}, written:{}, deferred:{}}, goog.inHtmlDocument_ = function() {258 var a = goog.global.document;259 return null != a && "write" in a;260}, goog.findBasePath_ = function() {261 if (goog.isDef(goog.global.CLOSURE_BASE_PATH) && goog.isString(goog.global.CLOSURE_BASE_PATH)) {262 goog.basePath = goog.global.CLOSURE_BASE_PATH;263 } else {264 if (goog.inHtmlDocument_()) {265 var a = goog.global.document;266 var b = a.currentScript;267 a = b ? [b] : a.getElementsByTagName("SCRIPT");268 for (b = a.length - 1; 0 <= b; --b) {269 var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d;270 if ("base.js" == c.substr(d - 7, 7)) {271 goog.basePath = c.substr(0, d - 7);272 break;273 }274 }275 }276 }277}, goog.importScript_ = function(a, b) {278 (goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_)(a, b) && (goog.dependencies_.written[a] = !0);279}, goog.IS_OLD_IE_ = !(goog.global.atob || !goog.global.document || !goog.global.document.all), goog.oldIeWaiting_ = !1, goog.importProcessedScript_ = function(a, b, c) {280 goog.importScript_("", 'goog.retrieveAndExec_("' + a + '", ' + b + ", " + c + ");");281}, goog.queuedModules_ = [], goog.wrapModule_ = function(a, b) {282 return goog.LOAD_MODULE_USING_EVAL && goog.isDef(goog.global.JSON) ? "goog.loadModule(" + goog.global.JSON.stringify(b + "\n//# sourceURL=" + a + "\n") + ");" : 'goog.loadModule(function(exports) {"use strict";' + b + "\n;return exports});\n//# sourceURL=" + a + "\n";283}, goog.loadQueuedModules_ = function() {284 var a = goog.queuedModules_.length;285 if (0 < a) {286 var b = goog.queuedModules_;287 goog.queuedModules_ = [];288 for (var c = 0; c < a; c++) {289 goog.maybeProcessDeferredPath_(b[c]);290 }291 }292 goog.oldIeWaiting_ = !1;293}, goog.maybeProcessDeferredDep_ = function(a) {294 goog.isDeferredModule_(a) && goog.allDepsAreAvailable_(a) && (a = goog.getPathFromDeps_(a), goog.maybeProcessDeferredPath_(goog.basePath + a));295}, goog.isDeferredModule_ = function(a) {296 var b = (a = goog.getPathFromDeps_(a)) && goog.dependencies_.loadFlags[a] || {}, c = b.lang || "es3";297 return a && ("goog" == b.module || goog.needsTranspile_(c)) ? goog.basePath + a in goog.dependencies_.deferred : !1;298}, goog.allDepsAreAvailable_ = function(a) {299 if ((a = goog.getPathFromDeps_(a)) && a in goog.dependencies_.requires) {300 for (var b in goog.dependencies_.requires[a]) {301 if (!goog.isProvided_(b) && !goog.isDeferredModule_(b)) {302 return !1;303 }304 }305 }306 return !0;307}, goog.maybeProcessDeferredPath_ = function(a) {308 if (a in goog.dependencies_.deferred) {309 var b = goog.dependencies_.deferred[a];310 delete goog.dependencies_.deferred[a];311 goog.globalEval(b);312 }313}, goog.loadModuleFromUrl = function(a) {314 goog.retrieveAndExec_(a, !0, !1);315}, goog.writeScriptSrcNode_ = function(a) {316 goog.global.document.write('<script type="text/javascript" src="' + a + '">\x3c/script>');317}, goog.appendScriptSrcNode_ = function(a) {318 var b = goog.global.document, c = b.createElement("script");319 c.type = "text/javascript";320 c.src = a;321 c.defer = !1;322 c.async = !1;323 b.head.appendChild(c);324}, goog.writeScriptTag_ = function(a, b) {325 if (goog.inHtmlDocument_()) {326 var c = goog.global.document;327 if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && "complete" == c.readyState) {328 if (/\bdeps.js$/.test(a)) {329 return !1;330 }331 throw Error('Cannot write "' + a + '" after document load');332 }333 void 0 === b ? goog.IS_OLD_IE_ ? (goog.oldIeWaiting_ = !0, b = " onreadystatechange='goog.onScriptLoad_(this, " + ++goog.lastNonModuleScriptIndex_ + ")' ", c.write('<script type="text/javascript" src="' + a + '"' + b + ">\x3c/script>")) : goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING ? goog.appendScriptSrcNode_(a) : goog.writeScriptSrcNode_(a) : c.write('<script type="text/javascript">' + goog.protectScriptTag_(b) + "\x3c/script>");334 return !0;335 }336 return !1;337}, goog.protectScriptTag_ = function(a) {338 return a.replace(/<\/(SCRIPT)/ig, "\\x3c/$1");339}, goog.needsTranspile_ = function(a) {340 if ("always" == goog.TRANSPILE) {341 return !0;342 }343 if ("never" == goog.TRANSPILE) {344 return !1;345 }346 goog.requiresTranspilation_ || (goog.requiresTranspilation_ = goog.createRequiresTranspilation_());347 if (a in goog.requiresTranspilation_) {348 return goog.requiresTranspilation_[a];349 }350 throw Error("Unknown language mode: " + a);351}, goog.requiresTranspilation_ = null, goog.lastNonModuleScriptIndex_ = 0, goog.onScriptLoad_ = function(a, b) {352 "complete" == a.readyState && goog.lastNonModuleScriptIndex_ == b && goog.loadQueuedModules_();353 return !0;354}, goog.writeScripts_ = function(a) {355 function b(a) {356 if (!(a in e.written || a in e.visited)) {357 e.visited[a] = !0;358 if (a in e.requires) {359 for (var f in e.requires[a]) {360 if (!goog.isProvided_(f)) {361 if (f in e.nameToPath) {362 b(e.nameToPath[f]);363 } else {364 throw Error("Undefined nameToPath for " + f);365 }366 }367 }368 }369 a in d || (d[a] = !0, c.push(a));370 }371 }372 var c = [], d = {}, e = goog.dependencies_;373 b(a);374 for (var f = 0; f < c.length; f++) {375 a = c[f], goog.dependencies_.written[a] = !0;376 }377 var g = goog.moduleLoaderState_;378 goog.moduleLoaderState_ = null;379 for (f = 0; f < c.length; f++) {380 if (a = c[f]) {381 var h = e.loadFlags[a] || {}, k = goog.needsTranspile_(h.lang || "es3");382 "goog" == h.module || k ? goog.importProcessedScript_(goog.basePath + a, "goog" == h.module, k) : goog.importScript_(goog.basePath + a);383 } else {384 throw goog.moduleLoaderState_ = g, Error("Undefined script input");385 }386 }387 goog.moduleLoaderState_ = g;388}, goog.getPathFromDeps_ = function(a) {389 return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null;390}, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js"));391goog.hasBadLetScoping = null;392goog.useSafari10Workaround = function() {393 if (null == goog.hasBadLetScoping) {394 try {395 var a = !eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";');396 } catch (b) {397 a = !1;398 }399 goog.hasBadLetScoping = a;400 }401 return goog.hasBadLetScoping;402};403goog.workaroundSafari10EvalBug = function(a) {404 return "(function(){" + a + "\n;})();\n";405};406goog.loadModule = function(a) {407 var b = goog.moduleLoaderState_;408 try {409 goog.moduleLoaderState_ = {moduleName:void 0, declareLegacyNamespace:!1};410 if (goog.isFunction(a)) {411 var c = a.call(void 0, {});412 } else {413 if (goog.isString(a)) {414 goog.useSafari10Workaround() && (a = goog.workaroundSafari10EvalBug(a)), c = goog.loadModuleFromSource_.call(void 0, a);415 } else {416 throw Error("Invalid module definition");417 }418 }419 var d = goog.moduleLoaderState_.moduleName;420 if (!goog.isString(d) || !d) {421 throw Error('Invalid module name "' + d + '"');422 }423 goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(d, c) : goog.SEAL_MODULE_EXPORTS && Object.seal && "object" == typeof c && null != c && Object.seal(c);424 goog.loadedModules_[d] = c;425 } finally {426 goog.moduleLoaderState_ = b;427 }428};429goog.loadModuleFromSource_ = function(a) {430 eval(a);431 return {};432};433goog.normalizePath_ = function(a) {434 a = a.split("/");435 for (var b = 0; b < a.length;) {436 "." == a[b] ? a.splice(b, 1) : b && ".." == a[b] && a[b - 1] && ".." != a[b - 1] ? a.splice(--b, 2) : b++;437 }438 return a.join("/");439};440goog.loadFileSync_ = function(a) {441 if (goog.global.CLOSURE_LOAD_FILE_SYNC) {442 return goog.global.CLOSURE_LOAD_FILE_SYNC(a);443 }444 try {445 var b = new goog.global.XMLHttpRequest;446 b.open("get", a, !1);447 b.send();448 return 0 == b.status || 200 == b.status ? b.responseText : null;449 } catch (c) {450 return null;451 }452};453goog.retrieveAndExec_ = function(a, b, c) {454 if (!COMPILED) {455 var d = a;456 a = goog.normalizePath_(a);457 var e = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_, f = goog.loadFileSync_(a);458 if (null == f) {459 throw Error('Load of "' + a + '" failed');460 }461 c && (f = goog.transpile_.call(goog.global, f, a));462 f = b ? goog.wrapModule_(a, f) : f + ("\n//# sourceURL=" + a);463 goog.IS_OLD_IE_ && goog.oldIeWaiting_ ? (goog.dependencies_.deferred[d] = f, goog.queuedModules_.push(d)) : e(a, f);464 }465};466goog.transpile_ = function(a, b) {467 var c = goog.global.$jscomp;468 c || (goog.global.$jscomp = c = {});469 var d = c.transpile;470 if (!d) {471 var e = goog.basePath + goog.TRANSPILER, f = goog.loadFileSync_(e);472 if (f) {473 eval(f + "\n//# sourceURL=" + e);474 if (goog.global.$gwtExport && goog.global.$gwtExport.$jscomp && !goog.global.$gwtExport.$jscomp.transpile) {475 throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: ' + JSON.stringify(goog.global.$gwtExport));476 }477 goog.global.$jscomp.transpile = goog.global.$gwtExport.$jscomp.transpile;478 c = goog.global.$jscomp;479 d = c.transpile;480 }481 }482 d || (d = c.transpile = function(a, b) {483 goog.logToConsole_(b + " requires transpilation but no transpiler was found.");484 return a;485 });486 return d(a, b);487};488goog.typeOf = function(a) {489 var b = typeof a;490 if ("object" == b) {491 if (a) {492 if (a instanceof Array) {493 return "array";494 }495 if (a instanceof Object) {496 return b;497 }498 var c = Object.prototype.toString.call(a);499 if ("[object Window]" == c) {500 return "object";501 }502 if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) {503 return "array";504 }505 if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) {506 return "function";507 }508 } else {509 return "null";510 }511 } else {512 if ("function" == b && "undefined" == typeof a.call) {513 return "object";514 }515 }516 return b;517};518goog.isNull = function(a) {519 return null === a;520};521goog.isDefAndNotNull = function(a) {522 return null != a;523};524goog.isArray = function(a) {525 return "array" == goog.typeOf(a);526};527goog.isArrayLike = function(a) {528 var b = goog.typeOf(a);529 return "array" == b || "object" == b && "number" == typeof a.length;530};531goog.isDateLike = function(a) {532 return goog.isObject(a) && "function" == typeof a.getFullYear;533};534goog.isFunction = function(a) {535 return "function" == goog.typeOf(a);536};537goog.isObject = function(a) {538 var b = typeof a;539 return "object" == b && null != a || "function" == b;540};541goog.getUid = function(a) {542 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_);543};544goog.hasUid = function(a) {545 return !!a[goog.UID_PROPERTY_];546};547goog.removeUid = function(a) {548 null !== a && "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);549 try {550 delete a[goog.UID_PROPERTY_];551 } catch (b) {552 }553};554goog.UID_PROPERTY_ = "closure_uid_" + (1e9 * Math.random() >>> 0);555goog.uidCounter_ = 0;556goog.getHashCode = goog.getUid;557goog.removeHashCode = goog.removeUid;558goog.cloneObject = function(a) {559 var b = goog.typeOf(a);560 if ("object" == b || "array" == b) {561 if (a.clone) {562 return a.clone();563 }564 var b = "array" == b ? [] : {}, c;565 for (c in a) {566 b[c] = goog.cloneObject(a[c]);567 }568 return b;569 }570 return a;571};572goog.bindNative_ = function(a, b, c) {573 return a.call.apply(a.bind, arguments);574};575goog.bindJs_ = function(a, b, c) {576 if (!a) {577 throw Error();578 }579 if (2 < arguments.length) {580 var d = Array.prototype.slice.call(arguments, 2);581 return function() {582 var c = Array.prototype.slice.call(arguments);583 Array.prototype.unshift.apply(c, d);584 return a.apply(b, c);585 };586 }587 return function() {588 return a.apply(b, arguments);589 };590};591goog.bind = function(a, b, c) {592 Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_;593 return goog.bind.apply(null, arguments);594};595goog.partial = function(a, b) {596 var c = Array.prototype.slice.call(arguments, 1);597 return function() {598 var b = c.slice();599 b.push.apply(b, arguments);600 return a.apply(this, b);601 };602};603goog.mixin = function(a, b) {604 for (var c in b) {605 a[c] = b[c];606 }607};608goog.now = goog.TRUSTED_SITE && Date.now || function() {609 return +new Date;610};611goog.globalEval = function(a) {612 if (goog.global.execScript) {613 goog.global.execScript(a, "JavaScript");614 } else {615 if (goog.global.eval) {616 if (null == goog.evalWorksForGlobals_) {617 if (goog.global.eval("var _evalTest_ = 1;"), "undefined" != typeof goog.global._evalTest_) {618 try {619 delete goog.global._evalTest_;620 } catch (d) {621 }622 goog.evalWorksForGlobals_ = !0;623 } else {624 goog.evalWorksForGlobals_ = !1;625 }626 }627 if (goog.evalWorksForGlobals_) {628 goog.global.eval(a);629 } else {630 var b = goog.global.document, c = b.createElement("SCRIPT");631 c.type = "text/javascript";632 c.defer = !1;633 c.appendChild(b.createTextNode(a));634 b.body.appendChild(c);635 b.body.removeChild(c);636 }637 } else {638 throw Error("goog.globalEval not available");639 }640 }641};642goog.evalWorksForGlobals_ = null;643goog.getCssName = function(a, b) {644 if ("." == String(a).charAt(0)) {645 throw Error('className passed in goog.getCssName must not start with ".". You passed: ' + a);646 }647 var c = function(a) {648 return goog.cssNameMapping_[a] || a;649 }, d = function(a) {650 a = a.split("-");651 for (var b = [], d = 0; d < a.length; d++) {652 b.push(c(a[d]));653 }654 return b.join("-");655 }, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) {656 return a;657 };658 a = b ? a + "-" + d(b) : d(a);659 return goog.global.CLOSURE_CSS_NAME_MAP_FN ? goog.global.CLOSURE_CSS_NAME_MAP_FN(a) : a;660};661goog.setCssNameMapping = function(a, b) {662 goog.cssNameMapping_ = a;663 goog.cssNameMappingStyle_ = b;664};665!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);666goog.getMsg = function(a, b) {667 b && (a = a.replace(/\{\$([^}]+)}/g, function(a, d) {668 return null != b && d in b ? b[d] : a;669 }));670 return a;671};672goog.getMsgWithFallback = function(a, b) {673 return a;674};675goog.exportSymbol = function(a, b, c) {676 goog.exportPath_(a, b, c);677};678goog.exportProperty = function(a, b, c) {679 a[b] = c;680};681goog.inherits = function(a, b) {682 function c() {683 }684 c.prototype = b.prototype;685 a.superClass_ = b.prototype;686 a.prototype = new c;687 a.prototype.constructor = a;688 a.base = function(a, c, f) {689 for (var d = Array(arguments.length - 2), e = 2; e < arguments.length; e++) {690 d[e - 2] = arguments[e];691 }692 return b.prototype[c].apply(a, d);693 };694};695goog.base = function(a, b, c) {696 var d = arguments.callee.caller;697 if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d) {698 throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");699 }700 if (d.superClass_) {701 for (var e = Array(arguments.length - 1), f = 1; f < arguments.length; f++) {702 e[f - 1] = arguments[f];703 }704 return d.superClass_.constructor.apply(a, e);705 }706 e = Array(arguments.length - 2);707 for (f = 2; f < arguments.length; f++) {708 e[f - 2] = arguments[f];709 }710 for (var f = !1, g = a.constructor; g; g = g.superClass_ && g.superClass_.constructor) {711 if (g.prototype[b] === d) {712 f = !0;713 } else {714 if (f) {715 return g.prototype[b].apply(a, e);716 }717 }718 }719 if (a[b] === d) {720 return a.constructor.prototype[b].apply(a, e);721 }722 throw Error("goog.base called from a method of one name to a method of a different name");723};724goog.scope = function(a) {725 if (goog.isInModuleLoader_()) {726 throw Error("goog.scope is not supported within a goog.module.");727 }728 a.call(goog.global);729};730COMPILED || (goog.global.COMPILED = COMPILED);731goog.defineClass = function(a, b) {732 var c = b.constructor, d = b.statics;733 c && c != Object.prototype.constructor || (c = function() {734 throw Error("cannot instantiate an interface (no constructor defined).");735 });736 c = goog.defineClass.createSealingConstructor_(c, a);737 a && goog.inherits(c, a);738 delete b.constructor;739 delete b.statics;740 goog.defineClass.applyProperties_(c.prototype, b);741 null != d && (d instanceof Function ? d(c) : goog.defineClass.applyProperties_(c, d));742 return c;743};744goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG;745goog.defineClass.createSealingConstructor_ = function(a, b) {746 if (!goog.defineClass.SEAL_CLASS_INSTANCES) {747 return a;748 }749 var c = !goog.defineClass.isUnsealable_(b), d = function() {750 var b = a.apply(this, arguments) || this;751 b[goog.UID_PROPERTY_] = b[goog.UID_PROPERTY_];752 this.constructor === d && c && Object.seal instanceof Function && Object.seal(b);753 return b;754 };755 return d;756};757goog.defineClass.isUnsealable_ = function(a) {758 return a && a.prototype && a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_];759};760goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");761goog.defineClass.applyProperties_ = function(a, b) {762 for (var c in b) {763 Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);764 }765 for (var d = 0; d < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; d++) {766 c = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d], Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);767 }768};769goog.tagUnsealableClass = function(a) {770 !COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES && (a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = !0);771};772goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable";773goog.createRequiresTranspilation_ = function() {774 function a(a, b) {775 d ? c[a] = !0 : b() ? c[a] = !1 : d = c[a] = !0;776 }777 function b(a) {778 try {779 return !!eval(a);780 } catch (g) {781 return !1;782 }783 }784 var c = {es3:!1}, d = !1, e = goog.global.navigator && goog.global.navigator.userAgent ? goog.global.navigator.userAgent : "";785 a("es5", function() {786 return b("[1,].length==1");787 });788 a("es6", function() {789 var a = e.match(/Edge\/(\d+)(\.\d)*/i);790 return a && 15 > Number(a[1]) ? !1 : b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()');791 });792 a("es6-impl", function() {793 return !0;794 });795 a("es7", function() {796 return b("2 ** 2 == 4");797 });798 a("es8", function() {799 return b("async () => 1, true");800 });801 return c;802};803var fxdriver = {error:{}}, WebDriverError = function(a, b, c) {804 if (b instanceof Error) {805 var d = b.message;806 b = b.stack;807 } else {808 d = b.toString(), b = Error(d).stack.split("\n"), b.shift(), b = b.join("\n");809 }810 this.additionalFields = [];811 if (c) {812 for (var e in c) {813 this.additionalFields.push(e), this[e] = c[e];814 }815 }816 this.code = a;817 this.message = d;818 this.stack = b;819 this.isWebDriverError = !0;820};821fxdriver.error.toJSON = function(a) {822 var b = [], c = {message:a.message ? a.message : a.toString(), stackTrace:b};823 if (a.stack) {824 for (var d = a.stack.replace(/\s*$/, "").split("\n"), e = d.shift(); e; e = d.shift()) {825 var f = e.match(/(.*):(\d+):(\d+)$/);826 if (f) {827 e = f[1];828 var g = Number(f[2]);829 var h = Number(f[3]);830 } else {831 f = e.match(/(.*):(\d+)$/), e = f[1], g = Number(f[2]);832 }833 (f = e.match(/^([\w./<$]+)?(?:\(.*\))?@(.+)?$/)) ? b.push({methodName:f[1], fileName:f[2], lineNumber:g, columnNumber:h}) : b.push({methodName:e, fileName:"?", lineNumber:"?", columnNumber:"?"});834 }835 }836 if (a.additionalFields && a.additionalFields.length) {837 for (b = 0; b < a.additionalFields.length; ++b) {838 c[a.additionalFields[b]] = a[a.additionalFields[b]];839 }840 }841 return c;842};843var bot = {ErrorCode:{SUCCESS:0, NO_SUCH_ELEMENT:7, NO_SUCH_FRAME:8, UNKNOWN_COMMAND:9, UNSUPPORTED_OPERATION:9, STALE_ELEMENT_REFERENCE:10, ELEMENT_NOT_VISIBLE:11, INVALID_ELEMENT_STATE:12, UNKNOWN_ERROR:13, ELEMENT_NOT_SELECTABLE:15, JAVASCRIPT_ERROR:17, XPATH_LOOKUP_ERROR:19, TIMEOUT:21, NO_SUCH_WINDOW:23, INVALID_COOKIE_DOMAIN:24, UNABLE_TO_SET_COOKIE:25, UNEXPECTED_ALERT_OPEN:26, NO_SUCH_ALERT:27, SCRIPT_TIMEOUT:28, INVALID_ELEMENT_COORDINATES:29, IME_NOT_AVAILABLE:30, IME_ENGINE_ACTIVATION_FAILED:31, 844INVALID_SELECTOR_ERROR:32, SESSION_NOT_CREATED:33, MOVE_TARGET_OUT_OF_BOUNDS:34, SQL_DATABASE_ERROR:35, INVALID_XPATH_SELECTOR:51, INVALID_XPATH_SELECTOR_RETURN_TYPE:52, INVALID_ARGUMENT:61, METHOD_NOT_ALLOWED:405}, Error:function(a, b) {845 this.code = a;846 this.state = bot.Error.CODE_TO_STATE_[a] || bot.Error.State.UNKNOWN_ERROR;847 this.message = b || "";848 a = this.state.replace(/((?:^|\s+)[a-z])/g, function(a) {849 return a.toUpperCase().replace(/^[\s\xa0]+/g, "");850 });851 b = a.length - 5;852 if (0 > b || a.indexOf("Error", b) != b) {853 a += "Error";854 }855 this.name = a;856 a = Error(this.message);857 a.name = this.name;858 this.stack = a.stack || "";859}};860goog.inherits(bot.Error, Error);861bot.Error.State = {ELEMENT_NOT_SELECTABLE:"element not selectable", ELEMENT_NOT_VISIBLE:"element not visible", INVALID_ARGUMENT:"invalid argument", INVALID_COOKIE_DOMAIN:"invalid cookie domain", INVALID_ELEMENT_COORDINATES:"invalid element coordinates", INVALID_ELEMENT_STATE:"invalid element state", INVALID_SELECTOR:"invalid selector", INVALID_SESSION_ID:"invalid session id", JAVASCRIPT_ERROR:"javascript error", MOVE_TARGET_OUT_OF_BOUNDS:"move target out of bounds", NO_SUCH_ALERT:"no such alert", 862NO_SUCH_ELEMENT:"no such element", NO_SUCH_FRAME:"no such frame", NO_SUCH_WINDOW:"no such window", SCRIPT_TIMEOUT:"script timeout", SESSION_NOT_CREATED:"session not created", STALE_ELEMENT_REFERENCE:"stale element reference", TIMEOUT:"timeout", UNABLE_TO_SET_COOKIE:"unable to set cookie", UNEXPECTED_ALERT_OPEN:"unexpected alert open", UNKNOWN_COMMAND:"unknown command", UNKNOWN_ERROR:"unknown error", UNKNOWN_METHOD:"unknown method", UNSUPPORTED_OPERATION:"unsupported operation"};863bot.Error.CODE_TO_STATE_ = {};864bot.Error.CODE_TO_STATE_[bot.ErrorCode.ELEMENT_NOT_SELECTABLE] = bot.Error.State.ELEMENT_NOT_SELECTABLE;865bot.Error.CODE_TO_STATE_[bot.ErrorCode.ELEMENT_NOT_VISIBLE] = bot.Error.State.ELEMENT_NOT_VISIBLE;866bot.Error.CODE_TO_STATE_[bot.ErrorCode.IME_ENGINE_ACTIVATION_FAILED] = bot.Error.State.UNKNOWN_ERROR;867bot.Error.CODE_TO_STATE_[bot.ErrorCode.IME_NOT_AVAILABLE] = bot.Error.State.UNKNOWN_ERROR;868bot.Error.CODE_TO_STATE_[bot.ErrorCode.INVALID_COOKIE_DOMAIN] = bot.Error.State.INVALID_COOKIE_DOMAIN;869bot.Error.CODE_TO_STATE_[bot.ErrorCode.INVALID_ELEMENT_COORDINATES] = bot.Error.State.INVALID_ELEMENT_COORDINATES;870bot.Error.CODE_TO_STATE_[bot.ErrorCode.INVALID_ELEMENT_STATE] = bot.Error.State.INVALID_ELEMENT_STATE;871bot.Error.CODE_TO_STATE_[bot.ErrorCode.INVALID_SELECTOR_ERROR] = bot.Error.State.INVALID_SELECTOR;872bot.Error.CODE_TO_STATE_[bot.ErrorCode.INVALID_XPATH_SELECTOR] = bot.Error.State.INVALID_SELECTOR;873bot.Error.CODE_TO_STATE_[bot.ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPE] = bot.Error.State.INVALID_SELECTOR;874bot.Error.CODE_TO_STATE_[bot.ErrorCode.JAVASCRIPT_ERROR] = bot.Error.State.JAVASCRIPT_ERROR;875bot.Error.CODE_TO_STATE_[bot.ErrorCode.METHOD_NOT_ALLOWED] = bot.Error.State.UNSUPPORTED_OPERATION;876bot.Error.CODE_TO_STATE_[bot.ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS] = bot.Error.State.MOVE_TARGET_OUT_OF_BOUNDS;877bot.Error.CODE_TO_STATE_[bot.ErrorCode.NO_SUCH_ALERT] = bot.Error.State.NO_SUCH_ALERT;878bot.Error.CODE_TO_STATE_[bot.ErrorCode.NO_SUCH_ELEMENT] = bot.Error.State.NO_SUCH_ELEMENT;879bot.Error.CODE_TO_STATE_[bot.ErrorCode.NO_SUCH_FRAME] = bot.Error.State.NO_SUCH_FRAME;880bot.Error.CODE_TO_STATE_[bot.ErrorCode.NO_SUCH_WINDOW] = bot.Error.State.NO_SUCH_WINDOW;881bot.Error.CODE_TO_STATE_[bot.ErrorCode.SCRIPT_TIMEOUT] = bot.Error.State.SCRIPT_TIMEOUT;882bot.Error.CODE_TO_STATE_[bot.ErrorCode.SESSION_NOT_CREATED] = bot.Error.State.SESSION_NOT_CREATED;883bot.Error.CODE_TO_STATE_[bot.ErrorCode.STALE_ELEMENT_REFERENCE] = bot.Error.State.STALE_ELEMENT_REFERENCE;884bot.Error.CODE_TO_STATE_[bot.ErrorCode.TIMEOUT] = bot.Error.State.TIMEOUT;885bot.Error.CODE_TO_STATE_[bot.ErrorCode.UNABLE_TO_SET_COOKIE] = bot.Error.State.UNABLE_TO_SET_COOKIE;886bot.Error.CODE_TO_STATE_[bot.ErrorCode.UNEXPECTED_ALERT_OPEN] = bot.Error.State.UNEXPECTED_ALERT_OPEN;887bot.Error.CODE_TO_STATE_[bot.ErrorCode.UNKNOWN_ERROR] = bot.Error.State.UNKNOWN_ERROR;888bot.Error.CODE_TO_STATE_[bot.ErrorCode.UNSUPPORTED_OPERATION] = bot.Error.State.UNKNOWN_COMMAND;889bot.Error.prototype.isAutomationError = !0;890goog.DEBUG && (bot.Error.prototype.toString = function() {891 return this.name + ": " + this.message;892});893fxdriver.Timer = function() {894 this.timer = null;895};896fxdriver.Timer.prototype.setTimeout = function(a, b) {897 var c = Components.interfaces;898 b = b || 10;899 this.timer = Components.classes["@mozilla.org/timer;1"].createInstance(c.nsITimer);900 this.timer.initWithCallback({notify:function() {901 a.apply(null);902 }}, b, c.nsITimer.TYPE_ONE_SHOT);903};904fxdriver.Timer.prototype.runWhenTrue = function(a, b, c, d) {905 var e = c, f = this, g = function() {906 var c = a();907 0 <= e && !c ? (e -= 100, f.setTimeout(g, 100)) : 0 >= e ? d() : b(c);908 };909 g();910};911fxdriver.Timer.prototype.cancel = function() {912 this.timer && this.timer.cancel();913};914goog.debug = {};915goog.debug.Error = function(a) {916 if (Error.captureStackTrace) {917 Error.captureStackTrace(this, goog.debug.Error);918 } else {919 var b = Error().stack;920 b && (this.stack = b);921 }922 a && (this.message = String(a));923 this.reportErrorToServer = !0;924};925goog.inherits(goog.debug.Error, Error);926goog.debug.Error.prototype.name = "CustomError";927goog.debug.LogRecord = function(a, b, c, d, e) {928 this.reset(a, b, c, d, e);929};930goog.debug.LogRecord.prototype.sequenceNumber_ = 0;931goog.debug.LogRecord.prototype.exception_ = null;932goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS = !0;933goog.debug.LogRecord.nextSequenceNumber_ = 0;934goog.debug.LogRecord.prototype.reset = function(a, b, c, d, e) {935 goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS && (this.sequenceNumber_ = "number" == typeof e ? e : goog.debug.LogRecord.nextSequenceNumber_++);936 this.time_ = d || goog.now();937 this.level_ = a;938 this.msg_ = b;939 this.loggerName_ = c;940 delete this.exception_;941};942goog.debug.LogRecord.prototype.getLoggerName = function() {943 return this.loggerName_;944};945goog.debug.LogRecord.prototype.getException = function() {946 return this.exception_;947};948goog.debug.LogRecord.prototype.setException = function(a) {949 this.exception_ = a;950};951goog.debug.LogRecord.prototype.setLoggerName = function(a) {952 this.loggerName_ = a;953};954goog.debug.LogRecord.prototype.getLevel = function() {955 return this.level_;956};957goog.debug.LogRecord.prototype.setLevel = function(a) {958 this.level_ = a;959};960goog.debug.LogRecord.prototype.getMessage = function() {961 return this.msg_;962};963goog.debug.LogRecord.prototype.setMessage = function(a) {964 this.msg_ = a;965};966goog.debug.LogRecord.prototype.getMillis = function() {967 return this.time_;968};969goog.debug.LogRecord.prototype.setMillis = function(a) {970 this.time_ = a;971};972goog.debug.LogRecord.prototype.getSequenceNumber = function() {973 return this.sequenceNumber_;974};975goog.dom = {};976goog.dom.NodeType = {ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, ENTITY_REFERENCE:5, ENTITY:6, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9, DOCUMENT_TYPE:10, DOCUMENT_FRAGMENT:11, NOTATION:12};977goog.object = {};978goog.object.is = function(a, b) {979 return a === b ? 0 !== a || 1 / a === 1 / b : a !== a && b !== b;980};981goog.object.forEach = function(a, b, c) {982 for (var d in a) {983 b.call(c, a[d], d, a);984 }985};986goog.object.filter = function(a, b, c) {987 var d = {}, e;988 for (e in a) {989 b.call(c, a[e], e, a) && (d[e] = a[e]);990 }991 return d;992};993goog.object.map = function(a, b, c) {994 var d = {}, e;995 for (e in a) {996 d[e] = b.call(c, a[e], e, a);997 }998 return d;999};1000goog.object.some = function(a, b, c) {1001 for (var d in a) {1002 if (b.call(c, a[d], d, a)) {1003 return !0;1004 }1005 }1006 return !1;1007};1008goog.object.every = function(a, b, c) {1009 for (var d in a) {1010 if (!b.call(c, a[d], d, a)) {1011 return !1;1012 }1013 }1014 return !0;1015};1016goog.object.getCount = function(a) {1017 var b = 0, c;1018 for (c in a) {1019 b++;1020 }1021 return b;1022};1023goog.object.getAnyKey = function(a) {1024 for (var b in a) {1025 return b;1026 }1027};1028goog.object.getAnyValue = function(a) {1029 for (var b in a) {1030 return a[b];1031 }1032};1033goog.object.contains = function(a, b) {1034 return goog.object.containsValue(a, b);1035};1036goog.object.getValues = function(a) {1037 var b = [], c = 0, d;1038 for (d in a) {1039 b[c++] = a[d];1040 }1041 return b;1042};1043goog.object.getKeys = function(a) {1044 var b = [], c = 0, d;1045 for (d in a) {1046 b[c++] = d;1047 }1048 return b;1049};1050goog.object.getValueByKeys = function(a, b) {1051 for (var c = goog.isArrayLike(b), d = c ? b : arguments, c = c ? 0 : 1; c < d.length && (a = a[d[c]], goog.isDef(a)); c++) {1052 }1053 return a;1054};1055goog.object.containsKey = function(a, b) {1056 return null !== a && b in a;1057};1058goog.object.containsValue = function(a, b) {1059 for (var c in a) {1060 if (a[c] == b) {1061 return !0;1062 }1063 }1064 return !1;1065};1066goog.object.findKey = function(a, b, c) {1067 for (var d in a) {1068 if (b.call(c, a[d], d, a)) {1069 return d;1070 }1071 }1072};1073goog.object.findValue = function(a, b, c) {1074 return (b = goog.object.findKey(a, b, c)) && a[b];1075};1076goog.object.isEmpty = function(a) {1077 for (var b in a) {1078 return !1;1079 }1080 return !0;1081};1082goog.object.clear = function(a) {1083 for (var b in a) {1084 delete a[b];1085 }1086};1087goog.object.remove = function(a, b) {1088 var c;1089 (c = b in a) && delete a[b];1090 return c;1091};1092goog.object.add = function(a, b, c) {1093 if (null !== a && b in a) {1094 throw Error('The object already contains the key "' + b + '"');1095 }1096 goog.object.set(a, b, c);1097};1098goog.object.get = function(a, b, c) {1099 return null !== a && b in a ? a[b] : c;1100};1101goog.object.set = function(a, b, c) {1102 a[b] = c;1103};1104goog.object.setIfUndefined = function(a, b, c) {1105 return b in a ? a[b] : a[b] = c;1106};1107goog.object.setWithReturnValueIfNotSet = function(a, b, c) {1108 if (b in a) {1109 return a[b];1110 }1111 c = c();1112 return a[b] = c;1113};1114goog.object.equals = function(a, b) {1115 for (var c in a) {1116 if (!(c in b) || a[c] !== b[c]) {1117 return !1;1118 }1119 }1120 for (c in b) {1121 if (!(c in a)) {1122 return !1;1123 }1124 }1125 return !0;1126};1127goog.object.clone = function(a) {1128 var b = {}, c;1129 for (c in a) {1130 b[c] = a[c];1131 }1132 return b;1133};1134goog.object.unsafeClone = function(a) {1135 var b = goog.typeOf(a);1136 if ("object" == b || "array" == b) {1137 if (goog.isFunction(a.clone)) {1138 return a.clone();1139 }1140 var b = "array" == b ? [] : {}, c;1141 for (c in a) {1142 b[c] = goog.object.unsafeClone(a[c]);1143 }1144 return b;1145 }1146 return a;1147};1148goog.object.transpose = function(a) {1149 var b = {}, c;1150 for (c in a) {1151 b[a[c]] = c;1152 }1153 return b;1154};1155goog.object.PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");1156goog.object.extend = function(a, b) {1157 for (var c, d, e = 1; e < arguments.length; e++) {1158 d = arguments[e];1159 for (c in d) {1160 a[c] = d[c];1161 }1162 for (var f = 0; f < goog.object.PROTOTYPE_FIELDS_.length; f++) {1163 c = goog.object.PROTOTYPE_FIELDS_[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]);1164 }1165 }1166};1167goog.object.create = function(a) {1168 var b = arguments.length;1169 if (1 == b && goog.isArray(arguments[0])) {1170 return goog.object.create.apply(null, arguments[0]);1171 }1172 if (b % 2) {1173 throw Error("Uneven number of arguments");1174 }1175 for (var c = {}, d = 0; d < b; d += 2) {1176 c[arguments[d]] = arguments[d + 1];1177 }1178 return c;1179};1180goog.object.createSet = function(a) {1181 var b = arguments.length;1182 if (1 == b && goog.isArray(arguments[0])) {1183 return goog.object.createSet.apply(null, arguments[0]);1184 }1185 for (var c = {}, d = 0; d < b; d++) {1186 c[arguments[d]] = !0;1187 }1188 return c;1189};1190goog.object.createImmutableView = function(a) {1191 var b = a;1192 Object.isFrozen && !Object.isFrozen(a) && (b = Object.create(a), Object.freeze(b));1193 return b;1194};1195goog.object.isImmutableView = function(a) {1196 return !!Object.isFrozen && Object.isFrozen(a);1197};1198goog.object.getAllPropertyNames = function(a, b, c) {1199 if (!a) {1200 return [];1201 }1202 if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {1203 return goog.object.getKeys(a);1204 }1205 for (var d = {}; a && (a !== Object.prototype || b) && (a !== Function.prototype || c);) {1206 for (var e = Object.getOwnPropertyNames(a), f = 0; f < e.length; f++) {1207 d[e[f]] = !0;1208 }1209 a = Object.getPrototypeOf(a);1210 }1211 return goog.object.getKeys(d);1212};1213goog.reflect = {};1214goog.reflect.object = function(a, b) {1215 return b;1216};1217goog.reflect.objectProperty = function(a, b) {1218 return a;1219};1220goog.reflect.sinkValue = function(a) {1221 goog.reflect.sinkValue[" "](a);1222 return a;1223};1224goog.reflect.sinkValue[" "] = goog.nullFunction;1225goog.reflect.canAccessProperty = function(a, b) {1226 try {1227 return goog.reflect.sinkValue(a[b]), !0;1228 } catch (c) {1229 }1230 return !1;1231};1232goog.reflect.cache = function(a, b, c, d) {1233 d = d ? d(b) : b;1234 return Object.prototype.hasOwnProperty.call(a, d) ? a[d] : a[d] = c(b);1235};1236goog.string = {};1237goog.string.DETECT_DOUBLE_ESCAPING = !1;1238goog.string.FORCE_NON_DOM_HTML_UNESCAPING = !1;1239goog.string.Unicode = {NBSP:"\u00a0"};1240goog.string.startsWith = function(a, b) {1241 return 0 == a.lastIndexOf(b, 0);1242};1243goog.string.endsWith = function(a, b) {1244 var c = a.length - b.length;1245 return 0 <= c && a.indexOf(b, c) == c;1246};1247goog.string.caseInsensitiveStartsWith = function(a, b) {1248 return 0 == goog.string.caseInsensitiveCompare(b, a.substr(0, b.length));1249};1250goog.string.caseInsensitiveEndsWith = function(a, b) {1251 return 0 == goog.string.caseInsensitiveCompare(b, a.substr(a.length - b.length, b.length));1252};1253goog.string.caseInsensitiveEquals = function(a, b) {1254 return a.toLowerCase() == b.toLowerCase();1255};1256goog.string.subs = function(a, b) {1257 for (var c = a.split("%s"), d = "", e = Array.prototype.slice.call(arguments, 1); e.length && 1 < c.length;) {1258 d += c.shift() + e.shift();1259 }1260 return d + c.join("%s");1261};1262goog.string.collapseWhitespace = function(a) {1263 return a.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "");1264};1265goog.string.isEmptyOrWhitespace = function(a) {1266 return /^[\s\xa0]*$/.test(a);1267};1268goog.string.isEmptyString = function(a) {1269 return 0 == a.length;1270};1271goog.string.isEmpty = goog.string.isEmptyOrWhitespace;1272goog.string.isEmptyOrWhitespaceSafe = function(a) {1273 return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(a));1274};1275goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe;1276goog.string.isBreakingWhitespace = function(a) {1277 return !/[^\t\n\r ]/.test(a);1278};1279goog.string.isAlpha = function(a) {1280 return !/[^a-zA-Z]/.test(a);1281};1282goog.string.isNumeric = function(a) {1283 return !/[^0-9]/.test(a);1284};1285goog.string.isAlphaNumeric = function(a) {1286 return !/[^a-zA-Z0-9]/.test(a);1287};1288goog.string.isSpace = function(a) {1289 return " " == a;1290};1291goog.string.isUnicodeChar = function(a) {1292 return 1 == a.length && " " <= a && "~" >= a || "\u0080" <= a && "\ufffd" >= a;1293};1294goog.string.stripNewlines = function(a) {1295 return a.replace(/(\r\n|\r|\n)+/g, " ");1296};1297goog.string.canonicalizeNewlines = function(a) {1298 return a.replace(/(\r\n|\r|\n)/g, "\n");1299};1300goog.string.normalizeWhitespace = function(a) {1301 return a.replace(/\xa0|\s/g, " ");1302};1303goog.string.normalizeSpaces = function(a) {1304 return a.replace(/\xa0|[ \t]+/g, " ");1305};1306goog.string.collapseBreakingSpaces = function(a) {1307 return a.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, "");1308};1309goog.string.trim = goog.TRUSTED_SITE && String.prototype.trim ? function(a) {1310 return a.trim();1311} : function(a) {1312 return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");1313};1314goog.string.trimLeft = function(a) {1315 return a.replace(/^[\s\xa0]+/, "");1316};1317goog.string.trimRight = function(a) {1318 return a.replace(/[\s\xa0]+$/, "");1319};1320goog.string.caseInsensitiveCompare = function(a, b) {1321 a = String(a).toLowerCase();1322 b = String(b).toLowerCase();1323 return a < b ? -1 : a == b ? 0 : 1;1324};1325goog.string.numberAwareCompare_ = function(a, b, c) {1326 if (a == b) {1327 return 0;1328 }1329 if (!a) {1330 return -1;1331 }1332 if (!b) {1333 return 1;1334 }1335 for (var d = a.toLowerCase().match(c), e = b.toLowerCase().match(c), f = Math.min(d.length, e.length), g = 0; g < f; g++) {1336 c = d[g];1337 var h = e[g];1338 if (c != h) {1339 return a = parseInt(c, 10), !isNaN(a) && (b = parseInt(h, 10), !isNaN(b) && a - b) ? a - b : c < h ? -1 : 1;1340 }1341 }1342 return d.length != e.length ? d.length - e.length : a < b ? -1 : 1;1343};1344goog.string.intAwareCompare = function(a, b) {1345 return goog.string.numberAwareCompare_(a, b, /\d+|\D+/g);1346};1347goog.string.floatAwareCompare = function(a, b) {1348 return goog.string.numberAwareCompare_(a, b, /\d+|\.\d+|\D+/g);1349};1350goog.string.numerateCompare = goog.string.floatAwareCompare;1351goog.string.urlEncode = function(a) {1352 return encodeURIComponent(String(a));1353};1354goog.string.urlDecode = function(a) {1355 return decodeURIComponent(a.replace(/\+/g, " "));1356};1357goog.string.newLineToBr = function(a, b) {1358 return a.replace(/(\r\n|\r|\n)/g, b ? "<br />" : "<br>");1359};1360goog.string.htmlEscape = function(a, b) {1361 if (b) {1362 a = a.replace(goog.string.AMP_RE_, "&amp;").replace(goog.string.LT_RE_, "&lt;").replace(goog.string.GT_RE_, "&gt;").replace(goog.string.QUOT_RE_, "&quot;").replace(goog.string.SINGLE_QUOTE_RE_, "&#39;").replace(goog.string.NULL_RE_, "&#0;"), goog.string.DETECT_DOUBLE_ESCAPING && (a = a.replace(goog.string.E_RE_, "&#101;"));1363 } else {1364 if (!goog.string.ALL_RE_.test(a)) {1365 return a;1366 }1367 -1 != a.indexOf("&") && (a = a.replace(goog.string.AMP_RE_, "&amp;"));1368 -1 != a.indexOf("<") && (a = a.replace(goog.string.LT_RE_, "&lt;"));1369 -1 != a.indexOf(">") && (a = a.replace(goog.string.GT_RE_, "&gt;"));1370 -1 != a.indexOf('"') && (a = a.replace(goog.string.QUOT_RE_, "&quot;"));1371 -1 != a.indexOf("'") && (a = a.replace(goog.string.SINGLE_QUOTE_RE_, "&#39;"));1372 -1 != a.indexOf("\x00") && (a = a.replace(goog.string.NULL_RE_, "&#0;"));1373 goog.string.DETECT_DOUBLE_ESCAPING && -1 != a.indexOf("e") && (a = a.replace(goog.string.E_RE_, "&#101;"));1374 }1375 return a;1376};1377goog.string.AMP_RE_ = /&/g;1378goog.string.LT_RE_ = /</g;1379goog.string.GT_RE_ = />/g;1380goog.string.QUOT_RE_ = /"/g;1381goog.string.SINGLE_QUOTE_RE_ = /'/g;1382goog.string.NULL_RE_ = /\x00/g;1383goog.string.E_RE_ = /e/g;1384goog.string.ALL_RE_ = goog.string.DETECT_DOUBLE_ESCAPING ? /[\x00&<>"'e]/ : /[\x00&<>"']/;1385goog.string.unescapeEntities = function(a) {1386 return goog.string.contains(a, "&") ? !goog.string.FORCE_NON_DOM_HTML_UNESCAPING && "document" in goog.global ? goog.string.unescapeEntitiesUsingDom_(a) : goog.string.unescapePureXmlEntities_(a) : a;1387};1388goog.string.unescapeEntitiesWithDocument = function(a, b) {1389 return goog.string.contains(a, "&") ? goog.string.unescapeEntitiesUsingDom_(a, b) : a;1390};1391goog.string.unescapeEntitiesUsingDom_ = function(a, b) {1392 var c = {"&amp;":"&", "&lt;":"<", "&gt;":">", "&quot;":'"'};1393 var d = b ? b.createElement("div") : goog.global.document.createElement("div");1394 return a.replace(goog.string.HTML_ENTITY_PATTERN_, function(a, b) {1395 var e = c[a];1396 if (e) {1397 return e;1398 }1399 "#" == b.charAt(0) && (b = Number("0" + b.substr(1)), isNaN(b) || (e = String.fromCharCode(b)));1400 e || (d.innerHTML = a + " ", e = d.firstChild.nodeValue.slice(0, -1));1401 return c[a] = e;1402 });1403};1404goog.string.unescapePureXmlEntities_ = function(a) {1405 return a.replace(/&([^;]+);/g, function(a, c) {1406 switch(c) {1407 case "amp":1408 return "&";1409 case "lt":1410 return "<";1411 case "gt":1412 return ">";1413 case "quot":1414 return '"';1415 default:1416 return "#" != c.charAt(0) || (c = Number("0" + c.substr(1)), isNaN(c)) ? a : String.fromCharCode(c);1417 }1418 });1419};1420goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;1421goog.string.whitespaceEscape = function(a, b) {1422 return goog.string.newLineToBr(a.replace(/ /g, " &#160;"), b);1423};1424goog.string.preserveSpaces = function(a) {1425 return a.replace(/(^|[\n ]) /g, "$1" + goog.string.Unicode.NBSP);1426};1427goog.string.stripQuotes = function(a, b) {1428 for (var c = b.length, d = 0; d < c; d++) {1429 var e = 1 == c ? b : b.charAt(d);1430 if (a.charAt(0) == e && a.charAt(a.length - 1) == e) {1431 return a.substring(1, a.length - 1);1432 }1433 }1434 return a;1435};1436goog.string.truncate = function(a, b, c) {1437 c && (a = goog.string.unescapeEntities(a));1438 a.length > b && (a = a.substring(0, b - 3) + "...");1439 c && (a = goog.string.htmlEscape(a));1440 return a;1441};1442goog.string.truncateMiddle = function(a, b, c, d) {1443 c && (a = goog.string.unescapeEntities(a));1444 if (d && a.length > b) {1445 d > b && (d = b);1446 var e = a.length - d;1447 a = a.substring(0, b - d) + "..." + a.substring(e);1448 } else {1449 a.length > b && (d = Math.floor(b / 2), e = a.length - d, a = a.substring(0, d + b % 2) + "..." + a.substring(e));1450 }1451 c && (a = goog.string.htmlEscape(a));1452 return a;1453};1454goog.string.specialEscapeChars_ = {"\x00":"\\0", "\b":"\\b", "\f":"\\f", "\n":"\\n", "\r":"\\r", "\t":"\\t", "\x0B":"\\x0B", '"':'\\"', "\\":"\\\\", "<":"<"};1455goog.string.jsEscapeCache_ = {"'":"\\'"};1456goog.string.quote = function(a) {1457 a = String(a);1458 for (var b = ['"'], c = 0; c < a.length; c++) {1459 var d = a.charAt(c), e = d.charCodeAt(0);1460 b[c + 1] = goog.string.specialEscapeChars_[d] || (31 < e && 127 > e ? d : goog.string.escapeChar(d));1461 }1462 b.push('"');1463 return b.join("");1464};1465goog.string.escapeString = function(a) {1466 for (var b = [], c = 0; c < a.length; c++) {1467 b[c] = goog.string.escapeChar(a.charAt(c));1468 }1469 return b.join("");1470};1471goog.string.escapeChar = function(a) {1472 if (a in goog.string.jsEscapeCache_) {1473 return goog.string.jsEscapeCache_[a];1474 }1475 if (a in goog.string.specialEscapeChars_) {1476 return goog.string.jsEscapeCache_[a] = goog.string.specialEscapeChars_[a];1477 }1478 var b = a.charCodeAt(0);1479 if (31 < b && 127 > b) {1480 var c = a;1481 } else {1482 if (256 > b) {1483 if (c = "\\x", 16 > b || 256 < b) {1484 c += "0";1485 }1486 } else {1487 c = "\\u", 4096 > b && (c += "0");1488 }1489 c += b.toString(16).toUpperCase();1490 }1491 return goog.string.jsEscapeCache_[a] = c;1492};1493goog.string.contains = function(a, b) {1494 return -1 != a.indexOf(b);1495};1496goog.string.caseInsensitiveContains = function(a, b) {1497 return goog.string.contains(a.toLowerCase(), b.toLowerCase());1498};1499goog.string.countOf = function(a, b) {1500 return a && b ? a.split(b).length - 1 : 0;1501};1502goog.string.removeAt = function(a, b, c) {1503 var d = a;1504 0 <= b && b < a.length && 0 < c && (d = a.substr(0, b) + a.substr(b + c, a.length - b - c));1505 return d;1506};1507goog.string.remove = function(a, b) {1508 return a.replace(b, "");1509};1510goog.string.removeAll = function(a, b) {1511 b = new RegExp(goog.string.regExpEscape(b), "g");1512 return a.replace(b, "");1513};1514goog.string.replaceAll = function(a, b, c) {1515 b = new RegExp(goog.string.regExpEscape(b), "g");1516 return a.replace(b, c.replace(/\$/g, "$$$$"));1517};1518goog.string.regExpEscape = function(a) {1519 return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08");1520};1521goog.string.repeat = String.prototype.repeat ? function(a, b) {1522 return a.repeat(b);1523} : function(a, b) {1524 return Array(b + 1).join(a);1525};1526goog.string.padNumber = function(a, b, c) {1527 a = goog.isDef(c) ? a.toFixed(c) : String(a);1528 c = a.indexOf(".");1529 -1 == c && (c = a.length);1530 return goog.string.repeat("0", Math.max(0, b - c)) + a;1531};1532goog.string.makeSafe = function(a) {1533 return null == a ? "" : String(a);1534};1535goog.string.buildString = function(a) {1536 return Array.prototype.join.call(arguments, "");1537};1538goog.string.getRandomString = function() {1539 return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ goog.now()).toString(36);1540};1541goog.string.compareVersions = function(a, b) {1542 var c = 0;1543 a = goog.string.trim(String(a)).split(".");1544 b = goog.string.trim(String(b)).split(".");1545 for (var d = Math.max(a.length, b.length), e = 0; 0 == c && e < d; e++) {1546 var f = a[e] || "", g = b[e] || "";1547 do {1548 f = /(\d*)(\D*)(.*)/.exec(f) || ["", "", "", ""];1549 g = /(\d*)(\D*)(.*)/.exec(g) || ["", "", "", ""];1550 if (0 == f[0].length && 0 == g[0].length) {1551 break;1552 }1553 var c = 0 == f[1].length ? 0 : parseInt(f[1], 10), h = 0 == g[1].length ? 0 : parseInt(g[1], 10), c = goog.string.compareElements_(c, h) || goog.string.compareElements_(0 == f[2].length, 0 == g[2].length) || goog.string.compareElements_(f[2], g[2]), f = f[3], g = g[3];1554 } while (0 == c);1555 }1556 return c;1557};1558goog.string.compareElements_ = function(a, b) {1559 return a < b ? -1 : a > b ? 1 : 0;1560};1561goog.string.hashCode = function(a) {1562 for (var b = 0, c = 0; c < a.length; ++c) {1563 b = 31 * b + a.charCodeAt(c) >>> 0;1564 }1565 return b;1566};1567goog.string.uniqueStringCounter_ = 2147483648 * Math.random() | 0;1568goog.string.createUniqueString = function() {1569 return "goog_" + goog.string.uniqueStringCounter_++;1570};1571goog.string.toNumber = function(a) {1572 var b = Number(a);1573 return 0 == b && goog.string.isEmptyOrWhitespace(a) ? NaN : b;1574};1575goog.string.isLowerCamelCase = function(a) {1576 return /^[a-z]+([A-Z][a-z]*)*$/.test(a);1577};1578goog.string.isUpperCamelCase = function(a) {1579 return /^([A-Z][a-z]*)+$/.test(a);1580};1581goog.string.toCamelCase = function(a) {1582 return String(a).replace(/\-([a-z])/g, function(a, c) {1583 return c.toUpperCase();1584 });1585};1586goog.string.toSelectorCase = function(a) {1587 return String(a).replace(/([A-Z])/g, "-$1").toLowerCase();1588};1589goog.string.toTitleCase = function(a, b) {1590 b = goog.isString(b) ? goog.string.regExpEscape(b) : "\\s";1591 return a.replace(new RegExp("(^" + (b ? "|[" + b + "]+" : "") + ")([a-z])", "g"), function(a, b, e) {1592 return b + e.toUpperCase();1593 });1594};1595goog.string.capitalize = function(a) {1596 return String(a.charAt(0)).toUpperCase() + String(a.substr(1)).toLowerCase();1597};1598goog.string.parseInt = function(a) {1599 isFinite(a) && (a = String(a));1600 return goog.isString(a) ? /^\s*-?0x/i.test(a) ? parseInt(a, 16) : parseInt(a, 10) : NaN;1601};1602goog.string.splitLimit = function(a, b, c) {1603 a = a.split(b);1604 for (var d = []; 0 < c && a.length;) {1605 d.push(a.shift()), c--;1606 }1607 a.length && d.push(a.join(b));1608 return d;1609};1610goog.string.lastComponent = function(a, b) {1611 if (b) {1612 "string" == typeof b && (b = [b]);1613 } else {1614 return a;1615 }1616 for (var c = -1, d = 0; d < b.length; d++) {1617 if ("" != b[d]) {1618 var e = a.lastIndexOf(b[d]);1619 e > c && (c = e);1620 }1621 }1622 return -1 == c ? a : a.slice(c + 1);1623};1624goog.string.editDistance = function(a, b) {1625 var c = [], d = [];1626 if (a == b) {1627 return 0;1628 }1629 if (!a.length || !b.length) {1630 return Math.max(a.length, b.length);1631 }1632 for (var e = 0; e < b.length + 1; e++) {1633 c[e] = e;1634 }1635 for (e = 0; e < a.length; e++) {1636 d[0] = e + 1;1637 for (var f = 0; f < b.length; f++) {1638 d[f + 1] = Math.min(d[f] + 1, c[f + 1] + 1, c[f] + Number(a[e] != b[f]));1639 }1640 for (f = 0; f < c.length; f++) {1641 c[f] = d[f];1642 }1643 }1644 return d[b.length];1645};1646goog.asserts = {};1647goog.asserts.ENABLE_ASSERTS = goog.DEBUG;1648goog.asserts.AssertionError = function(a, b) {1649 b.unshift(a);1650 goog.debug.Error.call(this, goog.string.subs.apply(null, b));1651 b.shift();1652 this.messagePattern = a;1653};1654goog.inherits(goog.asserts.AssertionError, goog.debug.Error);1655goog.asserts.AssertionError.prototype.name = "AssertionError";1656goog.asserts.DEFAULT_ERROR_HANDLER = function(a) {1657 throw a;1658};1659goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;1660goog.asserts.doAssertFailure_ = function(a, b, c, d) {1661 var e = "Assertion failed";1662 if (c) {1663 e += ": " + c;1664 var f = d;1665 } else {1666 a && (e += ": " + a, f = b);1667 }1668 a = new goog.asserts.AssertionError("" + e, f || []);1669 goog.asserts.errorHandler_(a);1670};1671goog.asserts.setErrorHandler = function(a) {1672 goog.asserts.ENABLE_ASSERTS && (goog.asserts.errorHandler_ = a);1673};1674goog.asserts.assert = function(a, b, c) {1675 goog.asserts.ENABLE_ASSERTS && !a && goog.asserts.doAssertFailure_("", null, b, Array.prototype.slice.call(arguments, 2));1676 return a;1677};1678goog.asserts.fail = function(a, b) {1679 goog.asserts.ENABLE_ASSERTS && goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1)));1680};1681goog.asserts.assertNumber = function(a, b, c) {1682 goog.asserts.ENABLE_ASSERTS && !goog.isNumber(a) && goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1683 return a;1684};1685goog.asserts.assertString = function(a, b, c) {1686 goog.asserts.ENABLE_ASSERTS && !goog.isString(a) && goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1687 return a;1688};1689goog.asserts.assertFunction = function(a, b, c) {1690 goog.asserts.ENABLE_ASSERTS && !goog.isFunction(a) && goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1691 return a;1692};1693goog.asserts.assertObject = function(a, b, c) {1694 goog.asserts.ENABLE_ASSERTS && !goog.isObject(a) && goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1695 return a;1696};1697goog.asserts.assertArray = function(a, b, c) {1698 goog.asserts.ENABLE_ASSERTS && !goog.isArray(a) && goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1699 return a;1700};1701goog.asserts.assertBoolean = function(a, b, c) {1702 goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(a) && goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1703 return a;1704};1705goog.asserts.assertElement = function(a, b, c) {1706 !goog.asserts.ENABLE_ASSERTS || goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT || goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2));1707 return a;1708};1709goog.asserts.assertInstanceof = function(a, b, c, d) {1710 !goog.asserts.ENABLE_ASSERTS || a instanceof b || goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.", [goog.asserts.getType_(b), goog.asserts.getType_(a)], c, Array.prototype.slice.call(arguments, 3));1711 return a;1712};1713goog.asserts.assertObjectPrototypeIsIntact = function() {1714 for (var a in Object.prototype) {1715 goog.asserts.fail(a + " should not be enumerable in Object.prototype.");1716 }1717};1718goog.asserts.getType_ = function(a) {1719 return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a;1720};1721goog.labs = {};1722goog.labs.userAgent = {};1723goog.labs.userAgent.util = {};1724goog.labs.userAgent.util.getNativeUserAgentString_ = function() {1725 var a = goog.labs.userAgent.util.getNavigator_();1726 return a && (a = a.userAgent) ? a : "";1727};1728goog.labs.userAgent.util.getNavigator_ = function() {1729 return goog.global.navigator;1730};1731goog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_();1732goog.labs.userAgent.util.setUserAgent = function(a) {1733 goog.labs.userAgent.util.userAgent_ = a || goog.labs.userAgent.util.getNativeUserAgentString_();1734};1735goog.labs.userAgent.util.getUserAgent = function() {1736 return goog.labs.userAgent.util.userAgent_;1737};1738goog.labs.userAgent.util.matchUserAgent = function(a) {1739 var b = goog.labs.userAgent.util.getUserAgent();1740 return goog.string.contains(b, a);1741};1742goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(a) {1743 var b = goog.labs.userAgent.util.getUserAgent();1744 return goog.string.caseInsensitiveContains(b, a);1745};1746goog.labs.userAgent.util.extractVersionTuples = function(a) {1747 for (var b = /(\w[\w ]+)\/([^\s]+)\s*(?:\((.*?)\))?/g, c = [], d; d = b.exec(a);) {1748 c.push([d[1], d[2], d[3] || void 0]);1749 }1750 return c;1751};1752goog.array = {};1753goog.NATIVE_ARRAY_PROTOTYPES = goog.TRUSTED_SITE;1754goog.array.ASSUME_NATIVE_FUNCTIONS = !1;1755goog.array.peek = function(a) {1756 return a[a.length - 1];1757};1758goog.array.last = goog.array.peek;1759goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function(a, b, c) {1760 goog.asserts.assert(null != a.length);1761 return Array.prototype.indexOf.call(a, b, c);1762} : function(a, b, c) {1763 c = null == c ? 0 : 0 > c ? Math.max(0, a.length + c) : c;1764 if (goog.isString(a)) {1765 return goog.isString(b) && 1 == b.length ? a.indexOf(b, c) : -1;1766 }1767 for (; c < a.length; c++) {1768 if (c in a && a[c] === b) {1769 return c;1770 }1771 }1772 return -1;1773};1774goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function(a, b, c) {1775 goog.asserts.assert(null != a.length);1776 return Array.prototype.lastIndexOf.call(a, b, null == c ? a.length - 1 : c);1777} : function(a, b, c) {1778 c = null == c ? a.length - 1 : c;1779 0 > c && (c = Math.max(0, a.length + c));1780 if (goog.isString(a)) {1781 return goog.isString(b) && 1 == b.length ? a.lastIndexOf(b, c) : -1;1782 }1783 for (; 0 <= c; c--) {1784 if (c in a && a[c] === b) {1785 return c;1786 }1787 }1788 return -1;1789};1790goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function(a, b, c) {1791 goog.asserts.assert(null != a.length);1792 Array.prototype.forEach.call(a, b, c);1793} : function(a, b, c) {1794 for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) {1795 f in e && b.call(c, e[f], f, a);1796 }1797};1798goog.array.forEachRight = function(a, b, c) {1799 for (var d = a.length, e = goog.isString(a) ? a.split("") : a, d = d - 1; 0 <= d; --d) {1800 d in e && b.call(c, e[d], d, a);1801 }1802};1803goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function(a, b, c) {1804 goog.asserts.assert(null != a.length);1805 return Array.prototype.filter.call(a, b, c);1806} : function(a, b, c) {1807 for (var d = a.length, e = [], f = 0, g = goog.isString(a) ? a.split("") : a, h = 0; h < d; h++) {1808 if (h in g) {1809 var k = g[h];1810 b.call(c, k, h, a) && (e[f++] = k);1811 }1812 }1813 return e;1814};1815goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function(a, b, c) {1816 goog.asserts.assert(null != a.length);1817 return Array.prototype.map.call(a, b, c);1818} : function(a, b, c) {1819 for (var d = a.length, e = Array(d), f = goog.isString(a) ? a.split("") : a, g = 0; g < d; g++) {1820 g in f && (e[g] = b.call(c, f[g], g, a));1821 }1822 return e;1823};1824goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function(a, b, c, d) {1825 goog.asserts.assert(null != a.length);1826 d && (b = goog.bind(b, d));1827 return Array.prototype.reduce.call(a, b, c);1828} : function(a, b, c, d) {1829 var e = c;1830 goog.array.forEach(a, function(c, g) {1831 e = b.call(d, e, c, g, a);1832 });1833 return e;1834};1835goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function(a, b, c, d) {1836 goog.asserts.assert(null != a.length);1837 goog.asserts.assert(null != b);1838 d && (b = goog.bind(b, d));1839 return Array.prototype.reduceRight.call(a, b, c);1840} : function(a, b, c, d) {1841 var e = c;1842 goog.array.forEachRight(a, function(c, g) {1843 e = b.call(d, e, c, g, a);1844 });1845 return e;1846};1847goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function(a, b, c) {1848 goog.asserts.assert(null != a.length);1849 return Array.prototype.some.call(a, b, c);1850} : function(a, b, c) {1851 for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) {1852 if (f in e && b.call(c, e[f], f, a)) {1853 return !0;1854 }1855 }1856 return !1;1857};1858goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function(a, b, c) {1859 goog.asserts.assert(null != a.length);1860 return Array.prototype.every.call(a, b, c);1861} : function(a, b, c) {1862 for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) {1863 if (f in e && !b.call(c, e[f], f, a)) {1864 return !1;1865 }1866 }1867 return !0;1868};1869goog.array.count = function(a, b, c) {1870 var d = 0;1871 goog.array.forEach(a, function(a, f, g) {1872 b.call(c, a, f, g) && ++d;1873 }, c);1874 return d;1875};1876goog.array.find = function(a, b, c) {1877 b = goog.array.findIndex(a, b, c);1878 return 0 > b ? null : goog.isString(a) ? a.charAt(b) : a[b];1879};1880goog.array.findIndex = function(a, b, c) {1881 for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) {1882 if (f in e && b.call(c, e[f], f, a)) {1883 return f;1884 }1885 }1886 return -1;1887};1888goog.array.findRight = function(a, b, c) {1889 b = goog.array.findIndexRight(a, b, c);1890 return 0 > b ? null : goog.isString(a) ? a.charAt(b) : a[b];1891};1892goog.array.findIndexRight = function(a, b, c) {1893 for (var d = a.length, e = goog.isString(a) ? a.split("") : a, d = d - 1; 0 <= d; d--) {1894 if (d in e && b.call(c, e[d], d, a)) {1895 return d;1896 }1897 }1898 return -1;1899};1900goog.array.contains = function(a, b) {1901 return 0 <= goog.array.indexOf(a, b);1902};1903goog.array.isEmpty = function(a) {1904 return 0 == a.length;1905};1906goog.array.clear = function(a) {1907 if (!goog.isArray(a)) {1908 for (var b = a.length - 1; 0 <= b; b--) {1909 delete a[b];1910 }1911 }1912 a.length = 0;1913};1914goog.array.insert = function(a, b) {1915 goog.array.contains(a, b) || a.push(b);1916};1917goog.array.insertAt = function(a, b, c) {1918 goog.array.splice(a, c, 0, b);1919};1920goog.array.insertArrayAt = function(a, b, c) {1921 goog.partial(goog.array.splice, a, c, 0).apply(null, b);1922};1923goog.array.insertBefore = function(a, b, c) {1924 var d;1925 2 == arguments.length || 0 > (d = goog.array.indexOf(a, c)) ? a.push(b) : goog.array.insertAt(a, b, d);1926};1927goog.array.remove = function(a, b) {1928 b = goog.array.indexOf(a, b);1929 var c;1930 (c = 0 <= b) && goog.array.removeAt(a, b);1931 return c;1932};1933goog.array.removeLast = function(a, b) {1934 b = goog.array.lastIndexOf(a, b);1935 return 0 <= b ? (goog.array.removeAt(a, b), !0) : !1;1936};1937goog.array.removeAt = function(a, b) {1938 goog.asserts.assert(null != a.length);1939 return 1 == Array.prototype.splice.call(a, b, 1).length;1940};1941goog.array.removeIf = function(a, b, c) {1942 b = goog.array.findIndex(a, b, c);1943 return 0 <= b ? (goog.array.removeAt(a, b), !0) : !1;1944};1945goog.array.removeAllIf = function(a, b, c) {1946 var d = 0;1947 goog.array.forEachRight(a, function(e, f) {1948 b.call(c, e, f, a) && goog.array.removeAt(a, f) && d++;1949 });1950 return d;1951};1952goog.array.concat = function(a) {1953 return Array.prototype.concat.apply([], arguments);1954};1955goog.array.join = function(a) {1956 return Array.prototype.concat.apply([], arguments);1957};1958goog.array.toArray = function(a) {1959 var b = a.length;1960 if (0 < b) {1961 for (var c = Array(b), d = 0; d < b; d++) {1962 c[d] = a[d];1963 }1964 return c;1965 }1966 return [];1967};1968goog.array.clone = goog.array.toArray;1969goog.array.extend = function(a, b) {1970 for (var c = 1; c < arguments.length; c++) {1971 var d = arguments[c];1972 if (goog.isArrayLike(d)) {1973 var e = a.length || 0, f = d.length || 0;1974 a.length = e + f;1975 for (var g = 0; g < f; g++) {1976 a[e + g] = d[g];1977 }1978 } else {1979 a.push(d);1980 }1981 }1982};1983goog.array.splice = function(a, b, c, d) {1984 goog.asserts.assert(null != a.length);1985 return Array.prototype.splice.apply(a, goog.array.slice(arguments, 1));1986};1987goog.array.slice = function(a, b, c) {1988 goog.asserts.assert(null != a.length);1989 return 2 >= arguments.length ? Array.prototype.slice.call(a, b) : Array.prototype.slice.call(a, b, c);1990};1991goog.array.removeDuplicates = function(a, b, c) {1992 b = b || a;1993 var d = function(a) {1994 return goog.isObject(a) ? "o" + goog.getUid(a) : (typeof a).charAt(0) + a;1995 };1996 c = c || d;1997 for (var d = {}, e = 0, f = 0; f < a.length;) {1998 var g = a[f++], h = c(g);1999 Object.prototype.hasOwnProperty.call(d, h) || (d[h] = !0, b[e++] = g);2000 }2001 b.length = e;2002};2003goog.array.binarySearch = function(a, b, c) {2004 return goog.array.binarySearch_(a, c || goog.array.defaultCompare, !1, b);2005};2006goog.array.binarySelect = function(a, b, c) {2007 return goog.array.binarySearch_(a, b, !0, void 0, c);2008};2009goog.array.binarySearch_ = function(a, b, c, d, e) {2010 for (var f = 0, g = a.length, h; f < g;) {2011 var k = f + g >> 1;2012 var l = c ? b.call(e, a[k], k, a) : b(d, a[k]);2013 0 < l ? f = k + 1 : (g = k, h = !l);2014 }2015 return h ? f : ~f;2016};2017goog.array.sort = function(a, b) {2018 a.sort(b || goog.array.defaultCompare);2019};2020goog.array.stableSort = function(a, b) {2021 for (var c = Array(a.length), d = 0; d < a.length; d++) {2022 c[d] = {index:d, value:a[d]};2023 }2024 var e = b || goog.array.defaultCompare;2025 goog.array.sort(c, function(a, b) {2026 return e(a.value, b.value) || a.index - b.index;2027 });2028 for (d = 0; d < a.length; d++) {2029 a[d] = c[d].value;2030 }2031};2032goog.array.sortByKey = function(a, b, c) {2033 var d = c || goog.array.defaultCompare;2034 goog.array.sort(a, function(a, c) {2035 return d(b(a), b(c));2036 });2037};2038goog.array.sortObjectsByKey = function(a, b, c) {2039 goog.array.sortByKey(a, function(a) {2040 return a[b];2041 }, c);2042};2043goog.array.isSorted = function(a, b, c) {2044 b = b || goog.array.defaultCompare;2045 for (var d = 1; d < a.length; d++) {2046 var e = b(a[d - 1], a[d]);2047 if (0 < e || 0 == e && c) {2048 return !1;2049 }2050 }2051 return !0;2052};2053goog.array.equals = function(a, b, c) {2054 if (!goog.isArrayLike(a) || !goog.isArrayLike(b) || a.length != b.length) {2055 return !1;2056 }2057 var d = a.length;2058 c = c || goog.array.defaultCompareEquality;2059 for (var e = 0; e < d; e++) {2060 if (!c(a[e], b[e])) {2061 return !1;2062 }2063 }2064 return !0;2065};2066goog.array.compare3 = function(a, b, c) {2067 c = c || goog.array.defaultCompare;2068 for (var d = Math.min(a.length, b.length), e = 0; e < d; e++) {2069 var f = c(a[e], b[e]);2070 if (0 != f) {2071 return f;2072 }2073 }2074 return goog.array.defaultCompare(a.length, b.length);2075};2076goog.array.defaultCompare = function(a, b) {2077 return a > b ? 1 : a < b ? -1 : 0;2078};2079goog.array.inverseDefaultCompare = function(a, b) {2080 return -goog.array.defaultCompare(a, b);2081};2082goog.array.defaultCompareEquality = function(a, b) {2083 return a === b;2084};2085goog.array.binaryInsert = function(a, b, c) {2086 c = goog.array.binarySearch(a, b, c);2087 return 0 > c ? (goog.array.insertAt(a, b, -(c + 1)), !0) : !1;2088};2089goog.array.binaryRemove = function(a, b, c) {2090 b = goog.array.binarySearch(a, b, c);2091 return 0 <= b ? goog.array.removeAt(a, b) : !1;2092};2093goog.array.bucket = function(a, b, c) {2094 for (var d = {}, e = 0; e < a.length; e++) {2095 var f = a[e], g = b.call(c, f, e, a);2096 goog.isDef(g) && (d[g] || (d[g] = [])).push(f);2097 }2098 return d;2099};2100goog.array.toObject = function(a, b, c) {2101 var d = {};2102 goog.array.forEach(a, function(e, f) {2103 d[b.call(c, e, f, a)] = e;2104 });2105 return d;2106};2107goog.array.range = function(a, b, c) {2108 var d = [], e = 0, f = a;2109 c = c || 1;2110 void 0 !== b && (e = a, f = b);2111 if (0 > c * (f - e)) {2112 return [];2113 }2114 if (0 < c) {2115 for (a = e; a < f; a += c) {2116 d.push(a);2117 }2118 } else {2119 for (a = e; a > f; a += c) {2120 d.push(a);2121 }2122 }2123 return d;2124};2125goog.array.repeat = function(a, b) {2126 for (var c = [], d = 0; d < b; d++) {2127 c[d] = a;2128 }2129 return c;2130};2131goog.array.flatten = function(a) {2132 for (var b = [], c = 0; c < arguments.length; c++) {2133 var d = arguments[c];2134 if (goog.isArray(d)) {2135 for (var e = 0; e < d.length; e += 8192) {2136 for (var f = goog.array.slice(d, e, e + 8192), f = goog.array.flatten.apply(null, f), g = 0; g < f.length; g++) {2137 b.push(f[g]);2138 }2139 }2140 } else {2141 b.push(d);2142 }2143 }2144 return b;2145};2146goog.array.rotate = function(a, b) {2147 goog.asserts.assert(null != a.length);2148 a.length && (b %= a.length, 0 < b ? Array.prototype.unshift.apply(a, a.splice(-b, b)) : 0 > b && Array.prototype.push.apply(a, a.splice(0, -b)));2149 return a;2150};2151goog.array.moveItem = function(a, b, c) {2152 goog.asserts.assert(0 <= b && b < a.length);2153 goog.asserts.assert(0 <= c && c < a.length);2154 b = Array.prototype.splice.call(a, b, 1);2155 Array.prototype.splice.call(a, c, 0, b[0]);2156};2157goog.array.zip = function(a) {2158 if (!arguments.length) {2159 return [];2160 }2161 for (var b = [], c = arguments[0].length, d = 1; d < arguments.length; d++) {2162 arguments[d].length < c && (c = arguments[d].length);2163 }2164 for (d = 0; d < c; d++) {2165 for (var e = [], f = 0; f < arguments.length; f++) {2166 e.push(arguments[f][d]);2167 }2168 b.push(e);2169 }2170 return b;2171};2172goog.array.shuffle = function(a, b) {2173 b = b || Math.random;2174 for (var c = a.length - 1; 0 < c; c--) {2175 var d = Math.floor(b() * (c + 1)), e = a[c];2176 a[c] = a[d];2177 a[d] = e;2178 }2179};2180goog.array.copyByIndex = function(a, b) {2181 var c = [];2182 goog.array.forEach(b, function(b) {2183 c.push(a[b]);2184 });2185 return c;2186};2187goog.array.concatMap = function(a, b, c) {2188 return goog.array.concat.apply([], goog.array.map(a, b, c));2189};2190goog.debug.LogBuffer = function() {2191 goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(), "Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY.");2192 this.clear();2193};2194goog.debug.LogBuffer.getInstance = function() {2195 goog.debug.LogBuffer.instance_ || (goog.debug.LogBuffer.instance_ = new goog.debug.LogBuffer);2196 return goog.debug.LogBuffer.instance_;2197};2198goog.debug.LogBuffer.CAPACITY = 0;2199goog.debug.LogBuffer.prototype.addRecord = function(a, b, c) {2200 var d = (this.curIndex_ + 1) % goog.debug.LogBuffer.CAPACITY;2201 this.curIndex_ = d;2202 if (this.isFull_) {2203 return d = this.buffer_[d], d.reset(a, b, c), d;2204 }2205 this.isFull_ = d == goog.debug.LogBuffer.CAPACITY - 1;2206 return this.buffer_[d] = new goog.debug.LogRecord(a, b, c);2207};2208goog.debug.LogBuffer.isBufferingEnabled = function() {2209 return 0 < goog.debug.LogBuffer.CAPACITY;2210};2211goog.debug.LogBuffer.prototype.clear = function() {2212 this.buffer_ = Array(goog.debug.LogBuffer.CAPACITY);2213 this.curIndex_ = -1;2214 this.isFull_ = !1;2215};2216goog.debug.LogBuffer.prototype.forEachRecord = function(a) {2217 var b = this.buffer_;2218 if (b[0]) {2219 var c = this.curIndex_, d = this.isFull_ ? c : -1;2220 do {2221 d = (d + 1) % goog.debug.LogBuffer.CAPACITY, a(b[d]);2222 } while (d != c);2223 }2224};2225goog.labs.userAgent.platform = {};2226goog.labs.userAgent.platform.isAndroid = function() {2227 return goog.labs.userAgent.util.matchUserAgent("Android");2228};2229goog.labs.userAgent.platform.isIpod = function() {2230 return goog.labs.userAgent.util.matchUserAgent("iPod");2231};2232goog.labs.userAgent.platform.isIphone = function() {2233 return goog.labs.userAgent.util.matchUserAgent("iPhone") && !goog.labs.userAgent.util.matchUserAgent("iPod") && !goog.labs.userAgent.util.matchUserAgent("iPad");2234};2235goog.labs.userAgent.platform.isIpad = function() {2236 return goog.labs.userAgent.util.matchUserAgent("iPad");2237};2238goog.labs.userAgent.platform.isIos = function() {2239 return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpad() || goog.labs.userAgent.platform.isIpod();2240};2241goog.labs.userAgent.platform.isMacintosh = function() {2242 return goog.labs.userAgent.util.matchUserAgent("Macintosh");2243};2244goog.labs.userAgent.platform.isLinux = function() {2245 return goog.labs.userAgent.util.matchUserAgent("Linux");2246};2247goog.labs.userAgent.platform.isWindows = function() {2248 return goog.labs.userAgent.util.matchUserAgent("Windows");2249};2250goog.labs.userAgent.platform.isChromeOS = function() {2251 return goog.labs.userAgent.util.matchUserAgent("CrOS");2252};2253goog.labs.userAgent.platform.getVersion = function() {2254 var a = goog.labs.userAgent.util.getUserAgent();2255 var b = "";2256 goog.labs.userAgent.platform.isWindows() ? (b = /Windows (?:NT|Phone) ([0-9.]+)/, b = (a = b.exec(a)) ? a[1] : "0.0") : goog.labs.userAgent.platform.isIos() ? (b = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/, b = (a = b.exec(a)) && a[1].replace(/_/g, ".")) : goog.labs.userAgent.platform.isMacintosh() ? (b = /Mac OS X ([0-9_.]+)/, b = (a = b.exec(a)) ? a[1].replace(/_/g, ".") : "10") : goog.labs.userAgent.platform.isAndroid() ? (b = /Android\s+([^\);]+)(\)|;)/, b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isChromeOS() && 2257 (b = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/, b = (a = b.exec(a)) && a[1]);2258 return b || "";2259};2260goog.labs.userAgent.platform.isVersionOrHigher = function(a) {2261 return 0 <= goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(), a);2262};2263goog.labs.userAgent.browser = {};2264goog.labs.userAgent.browser.matchOpera_ = function() {2265 return goog.labs.userAgent.util.matchUserAgent("Opera");2266};2267goog.labs.userAgent.browser.matchIE_ = function() {2268 return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE");2269};2270goog.labs.userAgent.browser.matchEdge_ = function() {2271 return goog.labs.userAgent.util.matchUserAgent("Edge");2272};2273goog.labs.userAgent.browser.matchFirefox_ = function() {2274 return goog.labs.userAgent.util.matchUserAgent("Firefox");2275};2276goog.labs.userAgent.browser.matchSafari_ = function() {2277 return goog.labs.userAgent.util.matchUserAgent("Safari") && !(goog.labs.userAgent.browser.matchChrome_() || goog.labs.userAgent.browser.matchCoast_() || goog.labs.userAgent.browser.matchOpera_() || goog.labs.userAgent.browser.matchEdge_() || goog.labs.userAgent.browser.isSilk() || goog.labs.userAgent.util.matchUserAgent("Android"));2278};2279goog.labs.userAgent.browser.matchCoast_ = function() {2280 return goog.labs.userAgent.util.matchUserAgent("Coast");2281};2282goog.labs.userAgent.browser.matchIosWebview_ = function() {2283 return (goog.labs.userAgent.util.matchUserAgent("iPad") || goog.labs.userAgent.util.matchUserAgent("iPhone")) && !goog.labs.userAgent.browser.matchSafari_() && !goog.labs.userAgent.browser.matchChrome_() && !goog.labs.userAgent.browser.matchCoast_() && goog.labs.userAgent.util.matchUserAgent("AppleWebKit");2284};2285goog.labs.userAgent.browser.matchChrome_ = function() {2286 return (goog.labs.userAgent.util.matchUserAgent("Chrome") || goog.labs.userAgent.util.matchUserAgent("CriOS")) && !goog.labs.userAgent.browser.matchEdge_();2287};2288goog.labs.userAgent.browser.matchAndroidBrowser_ = function() {2289 return goog.labs.userAgent.util.matchUserAgent("Android") && !(goog.labs.userAgent.browser.isChrome() || goog.labs.userAgent.browser.isFirefox() || goog.labs.userAgent.browser.isOpera() || goog.labs.userAgent.browser.isSilk());2290};2291goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_;2292goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_;2293goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdge_;2294goog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_;2295goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_;2296goog.labs.userAgent.browser.isCoast = goog.labs.userAgent.browser.matchCoast_;2297goog.labs.userAgent.browser.isIosWebview = goog.labs.userAgent.browser.matchIosWebview_;2298goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_;2299goog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_;2300goog.labs.userAgent.browser.isSilk = function() {2301 return goog.labs.userAgent.util.matchUserAgent("Silk");2302};2303goog.labs.userAgent.browser.getVersion = function() {2304 function a(a) {2305 a = goog.array.find(a, d);2306 return c[a] || "";2307 }2308 var b = goog.labs.userAgent.util.getUserAgent();2309 if (goog.labs.userAgent.browser.isIE()) {2310 return goog.labs.userAgent.browser.getIEVersion_(b);2311 }2312 var b = goog.labs.userAgent.util.extractVersionTuples(b), c = {};2313 goog.array.forEach(b, function(a) {2314 c[a[0]] = a[1];2315 });2316 var d = goog.partial(goog.object.containsKey, c);2317 return goog.labs.userAgent.browser.isOpera() ? a(["Version", "Opera"]) : goog.labs.userAgent.browser.isEdge() ? a(["Edge"]) : goog.labs.userAgent.browser.isChrome() ? a(["Chrome", "CriOS"]) : (b = b[2]) && b[1] || "";2318};2319goog.labs.userAgent.browser.isVersionOrHigher = function(a) {2320 return 0 <= goog.string.compareVersions(goog.labs.userAgent.browser.getVersion(), a);2321};2322goog.labs.userAgent.browser.getIEVersion_ = function(a) {2323 var b = /rv: *([\d\.]*)/.exec(a);2324 if (b && b[1]) {2325 return b[1];2326 }2327 var b = "", c = /MSIE +([\d\.]+)/.exec(a);2328 if (c && c[1]) {2329 if (a = /Trident\/(\d.\d)/.exec(a), "7.0" == c[1]) {2330 if (a && a[1]) {2331 switch(a[1]) {2332 case "4.0":2333 b = "8.0";2334 break;2335 case "5.0":2336 b = "9.0";2337 break;2338 case "6.0":2339 b = "10.0";2340 break;2341 case "7.0":2342 b = "11.0";2343 }2344 } else {2345 b = "7.0";2346 }2347 } else {2348 b = c[1];2349 }2350 }2351 return b;2352};2353goog.labs.userAgent.engine = {};2354goog.labs.userAgent.engine.isPresto = function() {2355 return goog.labs.userAgent.util.matchUserAgent("Presto");2356};2357goog.labs.userAgent.engine.isTrident = function() {2358 return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE");2359};2360goog.labs.userAgent.engine.isEdge = function() {2361 return goog.labs.userAgent.util.matchUserAgent("Edge");2362};2363goog.labs.userAgent.engine.isWebKit = function() {2364 return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit") && !goog.labs.userAgent.engine.isEdge();2365};2366goog.labs.userAgent.engine.isGecko = function() {2367 return goog.labs.userAgent.util.matchUserAgent("Gecko") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident() && !goog.labs.userAgent.engine.isEdge();2368};2369goog.labs.userAgent.engine.getVersion = function() {2370 var a = goog.labs.userAgent.util.getUserAgent();2371 if (a) {2372 var a = goog.labs.userAgent.util.extractVersionTuples(a), b = goog.labs.userAgent.engine.getEngineTuple_(a);2373 if (b) {2374 return "Gecko" == b[0] ? goog.labs.userAgent.engine.getVersionForKey_(a, "Firefox") : b[1];2375 }2376 var a = a[0], c;2377 if (a && (c = a[2]) && (c = /Trident\/([^\s;]+)/.exec(c))) {2378 return c[1];2379 }2380 }2381 return "";2382};2383goog.labs.userAgent.engine.getEngineTuple_ = function(a) {2384 if (!goog.labs.userAgent.engine.isEdge()) {2385 return a[1];2386 }2387 for (var b = 0; b < a.length; b++) {2388 var c = a[b];2389 if ("Edge" == c[0]) {2390 return c;2391 }2392 }2393};2394goog.labs.userAgent.engine.isVersionOrHigher = function(a) {2395 return 0 <= goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), a);2396};2397goog.labs.userAgent.engine.getVersionForKey_ = function(a, b) {2398 return (a = goog.array.find(a, function(a) {2399 return b == a[0];2400 })) && a[1] || "";2401};2402goog.userAgent = {};2403goog.userAgent.ASSUME_IE = !1;2404goog.userAgent.ASSUME_EDGE = !1;2405goog.userAgent.ASSUME_GECKO = !0;2406goog.userAgent.ASSUME_WEBKIT = !1;2407goog.userAgent.ASSUME_MOBILE_WEBKIT = !1;2408goog.userAgent.ASSUME_OPERA = !1;2409goog.userAgent.ASSUME_ANY_VERSION = !1;2410goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA;2411goog.userAgent.getUserAgentString = function() {2412 return goog.labs.userAgent.util.getUserAgent();2413};2414goog.userAgent.getNavigator = function() {2415 return goog.global.navigator || null;2416};2417goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera();2418goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE();2419goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_EDGE : goog.labs.userAgent.engine.isEdge();2420goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE;2421goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko();2422goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit();2423goog.userAgent.isMobile_ = function() {2424 return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent("Mobile");2425};2426goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_();2427goog.userAgent.SAFARI = goog.userAgent.WEBKIT;2428goog.userAgent.determinePlatform_ = function() {2429 var a = goog.userAgent.getNavigator();2430 return a && a.platform || "";2431};2432goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();2433goog.userAgent.ASSUME_MAC = !1;2434goog.userAgent.ASSUME_WINDOWS = !1;2435goog.userAgent.ASSUME_LINUX = !1;2436goog.userAgent.ASSUME_X11 = !1;2437goog.userAgent.ASSUME_ANDROID = !1;2438goog.userAgent.ASSUME_IPHONE = !1;2439goog.userAgent.ASSUME_IPAD = !1;2440goog.userAgent.ASSUME_IPOD = !1;2441goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD;2442goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.labs.userAgent.platform.isMacintosh();2443goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.labs.userAgent.platform.isWindows();2444goog.userAgent.isLegacyLinux_ = function() {2445 return goog.labs.userAgent.platform.isLinux() || goog.labs.userAgent.platform.isChromeOS();2446};2447goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.isLegacyLinux_();2448goog.userAgent.isX11_ = function() {2449 var a = goog.userAgent.getNavigator();2450 return !!a && goog.string.contains(a.appVersion || "", "X11");2451};2452goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.isX11_();2453goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.labs.userAgent.platform.isAndroid();2454goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.labs.userAgent.platform.isIphone();2455goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();2456goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIpod();2457goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIos();2458goog.userAgent.determineVersion_ = function() {2459 var a = "", b = goog.userAgent.getVersionRegexResult_();2460 b && (a = b ? b[1] : "");2461 return goog.userAgent.IE && (b = goog.userAgent.getDocumentMode_(), null != b && b > parseFloat(a)) ? String(b) : a;2462};2463goog.userAgent.getVersionRegexResult_ = function() {2464 var a = goog.userAgent.getUserAgentString();2465 if (goog.userAgent.GECKO) {2466 return /rv\:([^\);]+)(\)|;)/.exec(a);2467 }2468 if (goog.userAgent.EDGE) {2469 return /Edge\/([\d\.]+)/.exec(a);2470 }2471 if (goog.userAgent.IE) {2472 return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);2473 }2474 if (goog.userAgent.WEBKIT) {2475 return /WebKit\/(\S+)/.exec(a);2476 }2477 if (goog.userAgent.OPERA) {2478 return /(?:Version)[ \/]?(\S+)/.exec(a);2479 }2480};2481goog.userAgent.getDocumentMode_ = function() {2482 var a = goog.global.document;2483 return a ? a.documentMode : void 0;2484};2485goog.userAgent.VERSION = goog.userAgent.determineVersion_();2486goog.userAgent.compare = function(a, b) {2487 return goog.string.compareVersions(a, b);2488};2489goog.userAgent.isVersionOrHigherCache_ = {};2490goog.userAgent.isVersionOrHigher = function(a) {2491 return goog.userAgent.ASSUME_ANY_VERSION || goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_, a, function() {2492 return 0 <= goog.string.compareVersions(goog.userAgent.VERSION, a);2493 });2494};2495goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher;2496goog.userAgent.isDocumentModeOrHigher = function(a) {2497 return Number(goog.userAgent.DOCUMENT_MODE) >= a;2498};2499goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher;2500goog.userAgent.DOCUMENT_MODE = function() {2501 var a = goog.global.document, b = goog.userAgent.getDocumentMode_();2502 if (a && goog.userAgent.IE) {2503 return b || ("CSS1Compat" == a.compatMode ? parseInt(goog.userAgent.VERSION, 10) : 5);2504 }2505}();2506goog.debug.LOGGING_ENABLED = goog.DEBUG;2507goog.debug.FORCE_SLOPPY_STACKS = !1;2508goog.debug.catchErrors = function(a, b, c) {2509 c = c || goog.global;2510 var d = c.onerror, e = !!b;2511 goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("535.3") && (e = !e);2512 c.onerror = function(b, c, h, k, l) {2513 d && d(b, c, h, k, l);2514 a({message:b, fileName:c, line:h, col:k, error:l});2515 return e;2516 };2517};2518goog.debug.expose = function(a, b) {2519 if ("undefined" == typeof a) {2520 return "undefined";2521 }2522 if (null == a) {2523 return "NULL";2524 }2525 var c = [], d;2526 for (d in a) {2527 if (b || !goog.isFunction(a[d])) {2528 var e = d + " = ";2529 try {2530 e += a[d];2531 } catch (f) {2532 e += "*** " + f + " ***";2533 }2534 c.push(e);2535 }2536 }2537 return c.join("\n");2538};2539goog.debug.deepExpose = function(a, b) {2540 var c = [], d = [], e = {}, f = function(a, h) {2541 var g = h + " ";2542 try {2543 if (goog.isDef(a)) {2544 if (goog.isNull(a)) {2545 c.push("NULL");2546 } else {2547 if (goog.isString(a)) {2548 c.push('"' + a.replace(/\n/g, "\n" + h) + '"');2549 } else {2550 if (goog.isFunction(a)) {2551 c.push(String(a).replace(/\n/g, "\n" + h));2552 } else {2553 if (goog.isObject(a)) {2554 goog.hasUid(a) || d.push(a);2555 var l = goog.getUid(a);2556 if (e[l]) {2557 c.push("*** reference loop detected (id=" + l + ") ***");2558 } else {2559 e[l] = !0;2560 c.push("{");2561 for (var m in a) {2562 if (b || !goog.isFunction(a[m])) {2563 c.push("\n"), c.push(g), c.push(m + " = "), f(a[m], g);2564 }2565 }2566 c.push("\n" + h + "}");2567 delete e[l];2568 }2569 } else {2570 c.push(a);2571 }2572 }2573 }2574 }2575 } else {2576 c.push("undefined");2577 }2578 } catch (n) {2579 c.push("*** " + n + " ***");2580 }2581 };2582 f(a, "");2583 for (a = 0; a < d.length; a++) {2584 goog.removeUid(d[a]);2585 }2586 return c.join("");2587};2588goog.debug.exposeArray = function(a) {2589 for (var b = [], c = 0; c < a.length; c++) {2590 goog.isArray(a[c]) ? b.push(goog.debug.exposeArray(a[c])) : b.push(a[c]);2591 }2592 return "[ " + b.join(", ") + " ]";2593};2594goog.debug.normalizeErrorObject = function(a) {2595 var b = goog.getObjectByName("window.location.href");2596 if (goog.isString(a)) {2597 return {message:a, name:"Unknown error", lineNumber:"Not available", fileName:b, stack:"Not available"};2598 }2599 var c = !1;2600 try {2601 var d = a.lineNumber || a.line || "Not available";2602 } catch (f) {2603 d = "Not available", c = !0;2604 }2605 try {2606 var e = a.fileName || a.filename || a.sourceURL || goog.global.$googDebugFname || b;2607 } catch (f) {2608 e = "Not available", c = !0;2609 }2610 return !c && a.lineNumber && a.fileName && a.stack && a.message && a.name ? a : {message:a.message || "Not available", name:a.name || "UnknownError", lineNumber:d, fileName:e, stack:a.stack || "Not available"};2611};2612goog.debug.enhanceError = function(a, b) {2613 a instanceof Error || (a = Error(a), Error.captureStackTrace && Error.captureStackTrace(a, goog.debug.enhanceError));2614 a.stack || (a.stack = goog.debug.getStacktrace(goog.debug.enhanceError));2615 if (b) {2616 for (var c = 0; a["message" + c];) {2617 ++c;2618 }2619 a["message" + c] = String(b);2620 }2621 return a;2622};2623goog.debug.getStacktraceSimple = function(a) {2624 if (!goog.debug.FORCE_SLOPPY_STACKS) {2625 var b = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);2626 if (b) {2627 return b;2628 }2629 }2630 for (var b = [], c = arguments.callee.caller, d = 0; c && (!a || d < a);) {2631 b.push(goog.debug.getFunctionName(c));2632 b.push("()\n");2633 try {2634 c = c.caller;2635 } catch (e) {2636 b.push("[exception trying to get caller]\n");2637 break;2638 }2639 d++;2640 if (d >= goog.debug.MAX_STACK_DEPTH) {2641 b.push("[...long stack...]");2642 break;2643 }2644 }2645 a && d >= a ? b.push("[...reached max depth limit...]") : b.push("[end]");2646 return b.join("");2647};2648goog.debug.MAX_STACK_DEPTH = 50;2649goog.debug.getNativeStackTrace_ = function(a) {2650 var b = Error();2651 if (Error.captureStackTrace) {2652 return Error.captureStackTrace(b, a), String(b.stack);2653 }2654 try {2655 throw b;2656 } catch (c) {2657 b = c;2658 }2659 return (a = b.stack) ? String(a) : null;2660};2661goog.debug.getStacktrace = function(a) {2662 var b;2663 goog.debug.FORCE_SLOPPY_STACKS || (b = goog.debug.getNativeStackTrace_(a || goog.debug.getStacktrace));2664 b || (b = goog.debug.getStacktraceHelper_(a || arguments.callee.caller, []));2665 return b;2666};2667goog.debug.getStacktraceHelper_ = function(a, b) {2668 var c = [];2669 if (goog.array.contains(b, a)) {2670 c.push("[...circular reference...]");2671 } else {2672 if (a && b.length < goog.debug.MAX_STACK_DEPTH) {2673 c.push(goog.debug.getFunctionName(a) + "(");2674 for (var d = a.arguments, e = 0; d && e < d.length; e++) {2675 0 < e && c.push(", ");2676 var f = d[e];2677 switch(typeof f) {2678 case "object":2679 f = f ? "object" : "null";2680 break;2681 case "string":2682 break;2683 case "number":2684 f = String(f);2685 break;2686 case "boolean":2687 f = f ? "true" : "false";2688 break;2689 case "function":2690 f = (f = goog.debug.getFunctionName(f)) ? f : "[fn]";2691 break;2692 default:2693 f = typeof f;2694 }2695 40 < f.length && (f = f.substr(0, 40) + "...");2696 c.push(f);2697 }2698 b.push(a);2699 c.push(")\n");2700 try {2701 c.push(goog.debug.getStacktraceHelper_(a.caller, b));2702 } catch (g) {2703 c.push("[exception trying to get caller]\n");2704 }2705 } else {2706 a ? c.push("[...long stack...]") : c.push("[end]");2707 }2708 }2709 return c.join("");2710};2711goog.debug.setFunctionResolver = function(a) {2712 goog.debug.fnNameResolver_ = a;2713};2714goog.debug.getFunctionName = function(a) {2715 if (goog.debug.fnNameCache_[a]) {2716 return goog.debug.fnNameCache_[a];2717 }2718 if (goog.debug.fnNameResolver_) {2719 var b = goog.debug.fnNameResolver_(a);2720 if (b) {2721 return goog.debug.fnNameCache_[a] = b;2722 }2723 }2724 a = String(a);2725 goog.debug.fnNameCache_[a] || (b = /function ([^\(]+)/.exec(a), goog.debug.fnNameCache_[a] = b ? b[1] : "[Anonymous]");2726 return goog.debug.fnNameCache_[a];2727};2728goog.debug.makeWhitespaceVisible = function(a) {2729 return a.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]");2730};2731goog.debug.runtimeType = function(a) {2732 return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a;2733};2734goog.debug.fnNameCache_ = {};2735goog.userAgent.product = {};2736goog.userAgent.product.ASSUME_FIREFOX = !1;2737goog.userAgent.product.ASSUME_IPHONE = !1;2738goog.userAgent.product.ASSUME_IPAD = !1;2739goog.userAgent.product.ASSUME_ANDROID = !1;2740goog.userAgent.product.ASSUME_CHROME = !1;2741goog.userAgent.product.ASSUME_SAFARI = !1;2742goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_OPERA || goog.userAgent.product.ASSUME_FIREFOX || goog.userAgent.product.ASSUME_IPHONE || goog.userAgent.product.ASSUME_IPAD || goog.userAgent.product.ASSUME_ANDROID || goog.userAgent.product.ASSUME_CHROME || goog.userAgent.product.ASSUME_SAFARI;2743goog.userAgent.product.OPERA = goog.userAgent.OPERA;2744goog.userAgent.product.IE = goog.userAgent.IE;2745goog.userAgent.product.EDGE = goog.userAgent.EDGE;2746goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_FIREFOX : goog.labs.userAgent.browser.isFirefox();2747goog.userAgent.product.isIphoneOrIpod_ = function() {2748 return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpod();2749};2750goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPHONE : goog.userAgent.product.isIphoneOrIpod_();2751goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();2752goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_ANDROID : goog.labs.userAgent.browser.isAndroidBrowser();2753goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CHROME : goog.labs.userAgent.browser.isChrome();2754goog.userAgent.product.isSafariDesktop_ = function() {2755 return goog.labs.userAgent.browser.isSafari() && !goog.labs.userAgent.platform.isIos();2756};2757goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_SAFARI : goog.userAgent.product.isSafariDesktop_();2758goog.debug.Logger = function(a) {2759 this.name_ = a;2760 this.handlers_ = this.children_ = this.level_ = this.parent_ = null;2761};2762goog.debug.Logger.ROOT_LOGGER_NAME = "";2763goog.debug.Logger.ENABLE_HIERARCHY = !0;2764goog.debug.Logger.ENABLE_HIERARCHY || (goog.debug.Logger.rootHandlers_ = []);2765goog.debug.Logger.Level = function(a, b) {2766 this.name = a;2767 this.value = b;2768};2769goog.debug.Logger.Level.prototype.toString = function() {2770 return this.name;2771};2772goog.debug.Logger.Level.OFF = new goog.debug.Logger.Level("OFF", Infinity);2773goog.debug.Logger.Level.SHOUT = new goog.debug.Logger.Level("SHOUT", 1200);2774goog.debug.Logger.Level.SEVERE = new goog.debug.Logger.Level("SEVERE", 1000);2775goog.debug.Logger.Level.WARNING = new goog.debug.Logger.Level("WARNING", 900);2776goog.debug.Logger.Level.INFO = new goog.debug.Logger.Level("INFO", 800);2777goog.debug.Logger.Level.CONFIG = new goog.debug.Logger.Level("CONFIG", 700);2778goog.debug.Logger.Level.FINE = new goog.debug.Logger.Level("FINE", 500);2779goog.debug.Logger.Level.FINER = new goog.debug.Logger.Level("FINER", 400);2780goog.debug.Logger.Level.FINEST = new goog.debug.Logger.Level("FINEST", 300);2781goog.debug.Logger.Level.ALL = new goog.debug.Logger.Level("ALL", 0);2782goog.debug.Logger.Level.PREDEFINED_LEVELS = [goog.debug.Logger.Level.OFF, goog.debug.Logger.Level.SHOUT, goog.debug.Logger.Level.SEVERE, goog.debug.Logger.Level.WARNING, goog.debug.Logger.Level.INFO, goog.debug.Logger.Level.CONFIG, goog.debug.Logger.Level.FINE, goog.debug.Logger.Level.FINER, goog.debug.Logger.Level.FINEST, goog.debug.Logger.Level.ALL];2783goog.debug.Logger.Level.predefinedLevelsCache_ = null;2784goog.debug.Logger.Level.createPredefinedLevelsCache_ = function() {2785 goog.debug.Logger.Level.predefinedLevelsCache_ = {};2786 for (var a = 0, b; b = goog.debug.Logger.Level.PREDEFINED_LEVELS[a]; a++) {2787 goog.debug.Logger.Level.predefinedLevelsCache_[b.value] = b, goog.debug.Logger.Level.predefinedLevelsCache_[b.name] = b;2788 }2789};2790goog.debug.Logger.Level.getPredefinedLevel = function(a) {2791 goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_();2792 return goog.debug.Logger.Level.predefinedLevelsCache_[a] || null;2793};2794goog.debug.Logger.Level.getPredefinedLevelByValue = function(a) {2795 goog.debug.Logger.Level.predefinedLevelsCache_ || goog.debug.Logger.Level.createPredefinedLevelsCache_();2796 if (a in goog.debug.Logger.Level.predefinedLevelsCache_) {2797 return goog.debug.Logger.Level.predefinedLevelsCache_[a];2798 }2799 for (var b = 0; b < goog.debug.Logger.Level.PREDEFINED_LEVELS.length; ++b) {2800 var c = goog.debug.Logger.Level.PREDEFINED_LEVELS[b];2801 if (c.value <= a) {2802 return c;2803 }2804 }2805 return null;2806};2807goog.debug.Logger.getLogger = function(a) {2808 return goog.debug.LogManager.getLogger(a);2809};2810goog.debug.Logger.logToProfilers = function(a) {2811 goog.global.console && (goog.global.console.timeStamp ? goog.global.console.timeStamp(a) : goog.global.console.markTimeline && goog.global.console.markTimeline(a));2812 goog.global.msWriteProfilerMark && goog.global.msWriteProfilerMark(a);2813};2814goog.debug.Logger.prototype.getName = function() {2815 return this.name_;2816};2817goog.debug.Logger.prototype.addHandler = function(a) {2818 goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? (this.handlers_ || (this.handlers_ = []), this.handlers_.push(a)) : (goog.asserts.assert(!this.name_, "Cannot call addHandler on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."), goog.debug.Logger.rootHandlers_.push(a)));2819};2820goog.debug.Logger.prototype.removeHandler = function(a) {2821 if (goog.debug.LOGGING_ENABLED) {2822 var b = goog.debug.Logger.ENABLE_HIERARCHY ? this.handlers_ : goog.debug.Logger.rootHandlers_;2823 return !!b && goog.array.remove(b, a);2824 }2825 return !1;2826};2827goog.debug.Logger.prototype.getParent = function() {2828 return this.parent_;2829};2830goog.debug.Logger.prototype.getChildren = function() {2831 this.children_ || (this.children_ = {});2832 return this.children_;2833};2834goog.debug.Logger.prototype.setLevel = function(a) {2835 goog.debug.LOGGING_ENABLED && (goog.debug.Logger.ENABLE_HIERARCHY ? this.level_ = a : (goog.asserts.assert(!this.name_, "Cannot call setLevel() on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."), goog.debug.Logger.rootLevel_ = a));2836};2837goog.debug.Logger.prototype.getLevel = function() {2838 return goog.debug.LOGGING_ENABLED ? this.level_ : goog.debug.Logger.Level.OFF;2839};2840goog.debug.Logger.prototype.getEffectiveLevel = function() {2841 if (!goog.debug.LOGGING_ENABLED) {2842 return goog.debug.Logger.Level.OFF;2843 }2844 if (!goog.debug.Logger.ENABLE_HIERARCHY) {2845 return goog.debug.Logger.rootLevel_;2846 }2847 if (this.level_) {2848 return this.level_;2849 }2850 if (this.parent_) {2851 return this.parent_.getEffectiveLevel();2852 }2853 goog.asserts.fail("Root logger has no level set.");2854 return null;2855};2856goog.debug.Logger.prototype.isLoggable = function(a) {2857 return goog.debug.LOGGING_ENABLED && a.value >= this.getEffectiveLevel().value;2858};2859goog.debug.Logger.prototype.log = function(a, b, c) {2860 goog.debug.LOGGING_ENABLED && this.isLoggable(a) && (goog.isFunction(b) && (b = b()), this.doLogRecord_(this.getLogRecord(a, b, c)));2861};2862goog.debug.Logger.prototype.getLogRecord = function(a, b, c) {2863 a = goog.debug.LogBuffer.isBufferingEnabled() ? goog.debug.LogBuffer.getInstance().addRecord(a, b, this.name_) : new goog.debug.LogRecord(a, String(b), this.name_);2864 c && a.setException(c);2865 return a;2866};2867goog.debug.Logger.prototype.shout = function(a, b) {2868 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SHOUT, a, b);2869};2870goog.debug.Logger.prototype.severe = function(a, b) {2871 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.SEVERE, a, b);2872};2873goog.debug.Logger.prototype.warning = function(a, b) {2874 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.WARNING, a, b);2875};2876goog.debug.Logger.prototype.info = function(a, b) {2877 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.INFO, a, b);2878};2879goog.debug.Logger.prototype.config = function(a, b) {2880 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.CONFIG, a, b);2881};2882goog.debug.Logger.prototype.fine = function(a, b) {2883 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINE, a, b);2884};2885goog.debug.Logger.prototype.finer = function(a, b) {2886 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINER, a, b);2887};2888goog.debug.Logger.prototype.finest = function(a, b) {2889 goog.debug.LOGGING_ENABLED && this.log(goog.debug.Logger.Level.FINEST, a, b);2890};2891goog.debug.Logger.prototype.logRecord = function(a) {2892 goog.debug.LOGGING_ENABLED && this.isLoggable(a.getLevel()) && this.doLogRecord_(a);2893};2894goog.debug.Logger.prototype.doLogRecord_ = function(a) {2895 goog.debug.Logger.logToProfilers("log:" + a.getMessage());2896 if (goog.debug.Logger.ENABLE_HIERARCHY) {2897 for (var b = this; b;) {2898 b.callPublish_(a), b = b.getParent();2899 }2900 } else {2901 for (var b = 0, c; c = goog.debug.Logger.rootHandlers_[b++];) {2902 c(a);2903 }2904 }2905};2906goog.debug.Logger.prototype.callPublish_ = function(a) {2907 if (this.handlers_) {2908 for (var b = 0, c; c = this.handlers_[b]; b++) {2909 c(a);2910 }2911 }2912};2913goog.debug.Logger.prototype.setParent_ = function(a) {2914 this.parent_ = a;2915};2916goog.debug.Logger.prototype.addChild_ = function(a, b) {2917 this.getChildren()[a] = b;2918};2919goog.debug.LogManager = {};2920goog.debug.LogManager.loggers_ = {};2921goog.debug.LogManager.rootLogger_ = null;2922goog.debug.LogManager.initialize = function() {2923 goog.debug.LogManager.rootLogger_ || (goog.debug.LogManager.rootLogger_ = new goog.debug.Logger(goog.debug.Logger.ROOT_LOGGER_NAME), goog.debug.LogManager.loggers_[goog.debug.Logger.ROOT_LOGGER_NAME] = goog.debug.LogManager.rootLogger_, goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG));2924};2925goog.debug.LogManager.getLoggers = function() {2926 return goog.debug.LogManager.loggers_;2927};2928goog.debug.LogManager.getRoot = function() {2929 goog.debug.LogManager.initialize();2930 return goog.debug.LogManager.rootLogger_;2931};2932goog.debug.LogManager.getLogger = function(a) {2933 goog.debug.LogManager.initialize();2934 return goog.debug.LogManager.loggers_[a] || goog.debug.LogManager.createLogger_(a);2935};2936goog.debug.LogManager.createFunctionForCatchErrors = function(a) {2937 return function(b) {2938 (a || goog.debug.LogManager.getRoot()).severe("Error: " + b.message + " (" + b.fileName + " @ Line: " + b.line + ")");2939 };2940};2941goog.debug.LogManager.createLogger_ = function(a) {2942 var b = new goog.debug.Logger(a);2943 if (goog.debug.Logger.ENABLE_HIERARCHY) {2944 var c = a.lastIndexOf("."), d = a.substr(0, c), c = a.substr(c + 1), d = goog.debug.LogManager.getLogger(d);2945 d.addChild_(c, b);2946 b.setParent_(d);2947 }2948 return goog.debug.LogManager.loggers_[a] = b;2949};2950goog.userAgent.product.determineVersion_ = function() {2951 if (goog.userAgent.product.FIREFOX) {2952 return goog.userAgent.product.getFirstRegExpGroup_(/Firefox\/([0-9.]+)/);2953 }2954 if (goog.userAgent.product.IE || goog.userAgent.product.EDGE || goog.userAgent.product.OPERA) {2955 return goog.userAgent.VERSION;2956 }2957 if (goog.userAgent.product.CHROME) {2958 return goog.labs.userAgent.platform.isIos() ? goog.userAgent.product.getFirstRegExpGroup_(/CriOS\/([0-9.]+)/) : goog.userAgent.product.getFirstRegExpGroup_(/Chrome\/([0-9.]+)/);2959 }2960 if (goog.userAgent.product.SAFARI && !goog.labs.userAgent.platform.isIos()) {2961 return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);2962 }2963 if (goog.userAgent.product.IPHONE || goog.userAgent.product.IPAD) {2964 var a = goog.userAgent.product.execRegExp_(/Version\/(\S+).*Mobile\/(\S+)/);2965 if (a) {2966 return a[1] + "." + a[2];2967 }2968 } else {2969 if (goog.userAgent.product.ANDROID) {2970 return (a = goog.userAgent.product.getFirstRegExpGroup_(/Android\s+([0-9.]+)/)) ? a : goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);2971 }2972 }2973 return "";2974};2975goog.userAgent.product.getFirstRegExpGroup_ = function(a) {2976 return (a = goog.userAgent.product.execRegExp_(a)) ? a[1] : "";2977};2978goog.userAgent.product.execRegExp_ = function(a) {2979 return a.exec(goog.userAgent.getUserAgentString());2980};2981goog.userAgent.product.VERSION = goog.userAgent.product.determineVersion_();2982goog.userAgent.product.isVersion = function(a) {2983 return 0 <= goog.string.compareVersions(goog.userAgent.product.VERSION, a);2984};2985bot.userAgent = {};2986bot.userAgent.isEngineVersion = function(a) {2987 return bot.userAgent.FIREFOX_EXTENSION ? bot.userAgent.FIREFOX_EXTENSION_IS_ENGINE_VERSION_(a) : goog.userAgent.IE ? 0 <= goog.string.compareVersions(goog.userAgent.DOCUMENT_MODE, a) : goog.userAgent.isVersionOrHigher(a);2988};2989bot.userAgent.isProductVersion = function(a) {2990 return bot.userAgent.FIREFOX_EXTENSION ? bot.userAgent.FIREFOX_EXTENSION_IS_PRODUCT_VERSION_(a) : goog.userAgent.product.ANDROID ? 0 <= goog.string.compareVersions(bot.userAgent.ANDROID_VERSION_, a) : goog.userAgent.product.isVersion(a);2991};2992bot.userAgent.FIREFOX_EXTENSION = function() {2993 if (!goog.userAgent.GECKO) {2994 return !1;2995 }2996 var a = goog.global.Components;2997 if (!a) {2998 return !1;2999 }3000 try {3001 if (!a.classes) {3002 return !1;3003 }3004 } catch (f) {3005 return !1;3006 }3007 var b = a.classes, a = a.interfaces, c = b["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator), b = b["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo), d = b.platformVersion, e = b.version;3008 bot.userAgent.FIREFOX_EXTENSION_IS_ENGINE_VERSION_ = function(a) {3009 return 0 <= c.compare(d, "" + a);3010 };3011 bot.userAgent.FIREFOX_EXTENSION_IS_PRODUCT_VERSION_ = function(a) {3012 return 0 <= c.compare(e, "" + a);3013 };3014 return !0;3015}();3016bot.userAgent.WEBEXTENSION = function() {3017 try {3018 return !!(goog.global.chrome || goog.global.browser).extension;3019 } catch (a) {3020 return !1;3021 }3022}();3023bot.userAgent.IOS = goog.userAgent.product.IPAD || goog.userAgent.product.IPHONE;3024bot.userAgent.MOBILE = bot.userAgent.IOS || goog.userAgent.product.ANDROID;3025bot.userAgent.ANDROID_VERSION_ = function() {3026 if (goog.userAgent.product.ANDROID) {3027 var a = goog.userAgent.getUserAgentString();3028 return (a = /Android\s+([0-9\.]+)/.exec(a)) ? a[1] : "0";3029 }3030 return "0";3031}();3032bot.userAgent.IE_DOC_PRE8 = goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(8);3033bot.userAgent.IE_DOC_9 = goog.userAgent.isDocumentModeOrHigher(9);3034bot.userAgent.IE_DOC_PRE9 = goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9);3035bot.userAgent.IE_DOC_10 = goog.userAgent.isDocumentModeOrHigher(10);3036bot.userAgent.IE_DOC_PRE10 = goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(10);3037bot.userAgent.ANDROID_PRE_GINGERBREAD = goog.userAgent.product.ANDROID && !bot.userAgent.isProductVersion(2.3);3038bot.userAgent.ANDROID_PRE_ICECREAMSANDWICH = goog.userAgent.product.ANDROID && !bot.userAgent.isProductVersion(4);3039bot.userAgent.SAFARI_6 = goog.userAgent.product.SAFARI && bot.userAgent.isProductVersion(6);3040bot.userAgent.WINDOWS_PHONE = goog.userAgent.IE && -1 != goog.userAgent.getUserAgentString().indexOf("IEMobile");3041goog.log = {};3042goog.log.ENABLED = goog.debug.LOGGING_ENABLED;3043goog.log.ROOT_LOGGER_NAME = goog.debug.Logger.ROOT_LOGGER_NAME;3044goog.log.Logger = goog.debug.Logger;3045goog.log.Level = goog.debug.Logger.Level;3046goog.log.LogRecord = goog.debug.LogRecord;3047goog.log.getLogger = function(a, b) {3048 return goog.log.ENABLED ? (a = goog.debug.LogManager.getLogger(a), b && a && a.setLevel(b), a) : null;3049};3050goog.log.addHandler = function(a, b) {3051 goog.log.ENABLED && a && a.addHandler(b);3052};3053goog.log.removeHandler = function(a, b) {3054 return goog.log.ENABLED && a ? a.removeHandler(b) : !1;3055};3056goog.log.log = function(a, b, c, d) {3057 goog.log.ENABLED && a && a.log(b, c, d);3058};3059goog.log.error = function(a, b, c) {3060 goog.log.ENABLED && a && a.severe(b, c);3061};3062goog.log.warning = function(a, b, c) {3063 goog.log.ENABLED && a && a.warning(b, c);3064};3065goog.log.info = function(a, b, c) {3066 goog.log.ENABLED && a && a.info(b, c);3067};3068goog.log.fine = function(a, b, c) {3069 goog.log.ENABLED && a && a.fine(b, c);3070};3071fxdriver.moz = {};3072var CC = Components.classes, CI = Components.interfaces, CR = Components.results, CU = Components.utils;3073fxdriver.moz.load = function(a) {3074 Components.utils["import"]("resource://gre/modules/XPCOMUtils.jsm");3075};3076fxdriver.moz.getService = function(a, b) {3077 var c = CC[a];3078 if (void 0 == c) {3079 throw Error("Cannot create component " + a);3080 }3081 return c.getService(CI[b]);3082};3083fxdriver.moz.queryInterface = function(a, b) {3084 return function(c) {3085 if (!c) {3086 return CR.NS_ERROR_NO_INTERFACE;3087 }3088 if (c.equals(CI.nsISupports) || goog.array.reduce(b, function(a, b) {3089 return b ? a || b.equals(c) : a;3090 }, !1)) {3091 return a;3092 }3093 throw CR.NS_ERROR_NO_INTERFACE;3094 };3095};3096fxdriver.moz.unwrap = function(a) {3097 if (!goog.isDefAndNotNull(a) || a.__fxdriver_unwrapped) {3098 return a;3099 }3100 if (a.wrappedJSObject) {3101 return fxdriver.moz.markUnwrapped_(a.wrappedJSObject), a.wrappedJSObject;3102 }3103 try {3104 if (a == XPCNativeWrapper(a)) {3105 var b = XPCNativeWrapper.unwrap(a), b = b ? b : a;3106 fxdriver.moz.markUnwrapped_(b);3107 return b;3108 }3109 } catch (c) {3110 }3111 return a;3112};3113fxdriver.moz.markUnwrapped_ = function(a) {3114 Object.defineProperty(a, "__fxdriver_unwrapped", {enumerable:!1, configurable:!0, writable:!0, value:!0});3115};3116fxdriver.moz.unwrapXpcOnly = function(a) {3117 if (XPCNativeWrapper && "unwrap" in XPCNativeWrapper) {3118 try {3119 return XPCNativeWrapper.unwrap(a);3120 } catch (b) {3121 goog.log.warning(goog.log.getLogger("fxdriver.moz"), "Unwrap From XPC only failed", b);3122 }3123 }3124 return a;3125};3126fxdriver.moz.unwrapFor4 = function(a) {3127 return bot.userAgent.isProductVersion(4) ? fxdriver.moz.unwrap(a) : a;3128};3129fxdriver.utils = {};3130fxdriver.moz.queryInterface = function(a, b) {3131 return function(c) {3132 if (!c) {3133 return CR.NS_ERROR_NO_INTERFACE;3134 }3135 if (c.equals(CI.nsISupports) || goog.array.reduce(b, function(a, b) {3136 return b ? a || b.equals(c) : a;3137 }, !1)) {3138 return a;3139 }3140 throw CR.NS_ERROR_NO_INTERFACE;3141 };3142};3143fxdriver.utils.windowMediator = function() {3144 var a = CC["@mozilla.org/appshell/window-mediator;1"];3145 if (!a) {3146 throw new bot.Error(bot.ErrorCode.UNKNOWN_COMMAND);3147 }3148 return a.getService(CI.nsIWindowMediator);3149};3150fxdriver.utils.getChromeWindow = function(a) {3151 return a.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIWebNavigation).QueryInterface(CI.nsIDocShellTreeItem).rootTreeItem.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIDOMWindow).QueryInterface(CI.nsIDOMChromeWindow);3152};3153fxdriver.utils.getUniqueId = function() {3154 fxdriver.utils._generator || (fxdriver.utils._generator = fxdriver.moz.getService("@mozilla.org/uuid-generator;1", "nsIUUIDGenerator"));3155 return fxdriver.utils._generator.generateUUID().toString();3156};3157fxdriver.utils.newCoordinates = function(a, b, c) {3158 return {QueryInterface:function(a) {3159 if (a.equals(Components.interfaces.wdICoordinate) || a.equals(Components.interfaces.nsISupports)) {3160 return this;3161 }3162 throw Components.results.NS_NOINTERFACE;3163 }, auxiliary:a, x:b, y:c};3164};3165fxdriver.modals = {};3166fxdriver.modals.LOG_ = goog.log.getLogger("fxdriver.modals");3167fxdriver.modals.isModalPresent = function(a, b) {3168 fxdriver.modaltimer = new fxdriver.Timer;3169 fxdriver.modaltimer.runWhenTrue(function() {3170 var a = fxdriver.modals.find_();3171 return a && a.document && a.document.getElementsByTagName("dialog")[0];3172 }, function() {3173 a(!0);3174 }, b, function() {3175 a(!1);3176 });3177};3178fxdriver.modals.acceptAlert = function(a) {3179 var b = fxdriver.modals.find_();3180 fxdriver.modals.findButton_(b, "accept").click();3181 fxdriver.modals.clearFlag_(a);3182};3183fxdriver.modals.dismissAlert = function(a) {3184 var b = fxdriver.modals.find_(), c = fxdriver.modals.findButton_(b, "cancel");3185 c || (goog.log.info(fxdriver.modals.LOG_, "No cancel button Falling back to the accept button"), c = fxdriver.modals.findButton_(b, "accept"));3186 c.click();3187 fxdriver.modals.clearFlag_(a);3188};3189fxdriver.modals.getText = function(a) {3190 return a.modalOpen;3191};3192fxdriver.modals.setValue = function(a) {3193 var b = fxdriver.modals.find_().document.getElementById("loginTextbox");3194 try {3195 var c = !1;3196 if (c = bot.userAgent.isProductVersion(8) ? 0 != b.clientHeight : -1 < b.selectionStart) {3197 b.value = a;3198 return;3199 }3200 } catch (d) {3201 }3202 throw new WebDriverError(bot.ErrorCode.ELEMENT_NOT_VISIBLE, "Alert did not have a text box");3203};3204fxdriver.modals.find_ = function() {3205 var a = fxdriver.utils.windowMediator().getMostRecentWindow(""), a = fxdriver.moz.unwrap(a);3206 return a.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIWebNavigation).QueryInterface(CI.nsIDocShellTreeItem).treeOwner.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIWebBrowserChrome).isWindowModal() ? a : null;3207};3208fxdriver.modals.findButton_ = function(a, b) {3209 return a.document.getElementsByTagName("dialog")[0].getButton(b);3210};3211fxdriver.modals.setFlag = function(a, b) {3212 a.modalOpen = b;3213};3214fxdriver.modals.clearFlag_ = function(a) {3215 fxdriver.modals.setFlag(a, !1);3216};3217fxdriver.modals.findAssociatedDriver_ = function(a) {3218 CC["@mozilla.org/embedcomp/window-watcher;1"].getService(CI.nsIWindowWatcher);3219 for (var b = CC["@mozilla.org/appshell/window-mediator;1"].getService(CI.nsIWindowMediator).getEnumerator("navigator:browser"); b.hasMoreElements();) {3220 var c = b.getNext().QueryInterface(CI.nsIDOMWindow);3221 if (c.content == a || c.content.top == a.top) {3222 return c.fxdriver;3223 }3224 }3225 goog.log.info(fxdriver.modals.LOG_, "Unable to find the associated driver");3226};3227fxdriver.modals.signalOpenModal = function(a, b) {3228 goog.log.info(fxdriver.modals.LOG_, "signalOpenModal");3229 if ((a = fxdriver.modals.findAssociatedDriver_(a)) && a.response_) {3230 fxdriver.modals.setFlag(a, b);3231 var c = a.response_;3232 "executeAsyncScript" != c.name || c.responseSent_ ? (c.value = b, c.send()) : fxdriver.modals.closeUnhandledAlert(c, a, !1);3233 }3234};3235fxdriver.modals.asAcceptableAlertValue = function(a) {3236 return "accept" == a || "ignore" == a ? a : "dismiss";3237};3238fxdriver.modals.configure = function(a) {3239 var b = fxdriver.moz.getService("@mozilla.org/preferences-service;1", "nsIPrefBranch");3240 a = fxdriver.modals.asAcceptableAlertValue(a);3241 b.setCharPref("webdriver_unexpected_alert_behaviour", a);3242};3243fxdriver.modals.getUnexpectedAlertBehaviour = function() {3244 var a = fxdriver.moz.getService("@mozilla.org/preferences-service;1", "nsIPrefBranch");3245 if (!a.prefHasUserValue("webdriver_unexpected_alert_behaviour")) {3246 return "dismiss";3247 }3248 a = a.getCharPref("webdriver_unexpected_alert_behaviour");3249 return fxdriver.modals.asAcceptableAlertValue(a);3250};3251fxdriver.modals.closeUnhandledAlert = function(a, b, c) {3252 var d = b.modalOpen;3253 fxdriver.modals.isModalPresent(function(e) {3254 var f = "Unexpected modal dialog (text: " + d + ")";3255 if (e) {3256 try {3257 c ? fxdriver.modals.acceptAlert(b) : fxdriver.modals.dismissAlert(b);3258 } catch (g) {3259 f += " The alert could not be closed. The browser may be in a wildly inconsistent state, and the alert may still be open. This is not good. If you can reliably reproduce this, please report a new issue at https://github.com/SeleniumHQ/selenium/issues with reproduction steps. Exception message: " + g;3260 }3261 } else {3262 f += " The alert disappeared before it could be closed.";3263 }3264 a.sendError(new WebDriverError(bot.ErrorCode.UNEXPECTED_ALERT_OPEN, f, {alert:{text:d}}));3265 }, 2000);3266};3267var EXCLUDED_NAMES = "QueryInterface alert alertCheck confirm confirmCheck confirmEx getPrompt prompt promptPassword promptUsernameAndPassword select".split(" ");3268function addInterfaces(a, b, c) {3269 goog.array.forEach(c, function(c) {3270 try {3271 var d = b.QueryInterface(c), f;3272 for (f in d) {3273 goog.array.contains(EXCLUDED_NAMES, f.toString()) || (a[f] = d[f]);3274 }3275 } catch (g) {3276 }3277 });3278}3279function ObservingAlert(a, b) {3280 this.parentWindow_ = a;3281 a = [CI.nsIPrompt, CI.nsIAuthPrompt, CI.nsIAuthPrompt2, CI.nsIWritablePropertyBag2];3282 addInterfaces(this, b, a);3283 this.delegate_ = b;3284 this.QueryInterface = fxdriver.moz.queryInterface(this, a);3285}3286ObservingAlert.prototype.alert = function(a, b) {3287 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3288 this.delegate_.alert(a, b);3289};3290ObservingAlert.prototype.alertCheck = function(a, b, c, d) {3291 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3292 this.delegate_.alertCheck(a, b, c, d);3293};3294ObservingAlert.prototype.confirm = function(a, b) {3295 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3296 return this.delegate_.confirm(a, b);3297};3298ObservingAlert.prototype.confirmCheck = function(a, b, c, d) {3299 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3300 return this.delegate_.confirmCheck(a, b, c, d);3301};3302ObservingAlert.prototype.confirmEx = function(a, b, c, d, e, f, g, h) {3303 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3304 return this.delegate_.confirmEx(a, b, c, d, e, f, g, h);3305};3306ObservingAlert.prototype.prompt = function(a, b, c, d, e) {3307 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3308 return this.delegate_.prompt(a, b, c, d, e);3309};3310ObservingAlert.prototype.promptPassword = function(a, b, c, d, e) {3311 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3312 return this.delegate_.promptPassword(a, b, c, d, e);3313};3314ObservingAlert.prototype.promptUsernameAndPassword = function(a, b, c, d, e, f) {3315 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3316 return this.delegate_.promptUsernameAndPassword(a, b, c, d, e, f);3317};3318ObservingAlert.prototype.select = function(a, b, c, d, e) {3319 fxdriver.modals.signalOpenModal(this.parentWindow_, b);3320 return this.delegate_.select(a, b, c, d, e);3321};3322function DrivenPromptService() {3323 goog.log.info(DrivenPromptService.LOG_, "Spoofing prompt service");3324 var a = function(a, b) {3325 for (var c = 0; c < b.length; c++) {3326 var d = Components.classesByID[b[c]];3327 if (d && (d = d.getService())) {3328 try {3329 var g = d.QueryInterface(a);3330 goog.log.info(DrivenPromptService.LOG_, "Found implementation at: " + b[c]);3331 return g;3332 } catch (h) {3333 }3334 }3335 }3336 return null;3337 }, b = a(CI.nsIPromptService2, ["{7ad1b327-6dfa-46ec-9234-f2a620ea7e00}", "{A2112D6A-0E28-421f-B46A-25C0B308CBD0}"]), a = a(CI.nsIPromptFactory, ["{1c978d25-b37f-43a8-a2d6-0c7a239ead87}"]);3338 b || goog.log.info(DrivenPromptService.LOG_, "Unable to locate original prompt service");3339 a || goog.log.info(DrivenPromptService.LOG_, "Unable to locate original prompter");3340 this.delegate_ = a ? a : b;3341 addInterfaces(this, this.delegate_, [CI.nsIPromptFactory, CI.nsIPromptService, CI.nsIPromptService2]);3342 this.QueryInterface = fxdriver.moz.queryInterface(this, [CI.nsIPromptFactory, CI.nsIPromptService, CI.nsIPromptService2]);3343 goog.log.info(DrivenPromptService.LOG_, "Finished initializing spoofed prompt service");3344}3345DrivenPromptService.LOG_ = goog.log.getLogger("fxdriver.DrivenPromptService");3346DrivenPromptService.prototype = {BUTTON_POS_0:1, BUTTON_POS_1:256, BUTTON_POS_2:65536, BUTTON_TITLE_OK:1, BUTTON_TITLE_CANCEL:2, BUTTON_TITLE_YES:3, BUTTON_TITLE_NO:4, BUTTON_TITLE_SAVE:5, BUTTON_TITLE_DONT_SAVE:6, BUTTON_TITLE_REVERT:7, BUTTON_TITLE_IS_STRING:127, BUTTON_POS_0_DEFAULT:0, BUTTON_POS_1_DEFAULT:16777216, BUTTON_POS_2_DEFAULT:33554432, BUTTON_DELAY_ENABLE:67108864, STD_OK_CANCEL_BUTTONS:this.BUTTON_TITLE_OK * this.BUTTON_POS_0 + this.BUTTON_TITLE_CANCEL * this.BUTTON_POS_1, STD_YES_NO_BUTTONS:this.BUTTON_TITLE_YES * 3347this.BUTTON_POS_0 + this.BUTTON_TITLE_NO * this.BUTTON_POS_1};3348DrivenPromptService.prototype.alert = function(a, b, c) {3349 fxdriver.modals.signalOpenModal(a, c);3350 return this.delegate_.QueryInterface(CI.nsIPromptService2).alert(a, b, c);3351};3352DrivenPromptService.prototype.alertCheck = function(a, b, c, d, e) {3353 fxdriver.modals.signalOpenModal(a, c);3354 return this.delegate_.QueryInterface(CI.nsIPromptService2).alertCheck(a, b, c, d, e);3355};3356DrivenPromptService.prototype.confirm = function(a, b, c) {3357 fxdriver.modals.signalOpenModal(a, c);3358 return this.delegate_.QueryInterface(CI.nsIPromptService2).confirm(a, b, c);3359};3360DrivenPromptService.prototype.confirmCheck = function(a, b, c, d, e) {3361 fxdriver.modals.signalOpenModal(a, c);3362 return this.delegate_.QueryInterface(CI.nsIPromptService2).confirmCheck(a, b, c, d, e);3363};3364DrivenPromptService.prototype.confirmEx = function(a, b, c, d, e, f, g, h, k) {3365 fxdriver.modals.signalOpenModal(a, c);3366 return this.delegate_.QueryInterface(CI.nsIPromptService2).confirmEx(a, b, c, d, e, f, g, h, k);3367};3368DrivenPromptService.prototype.prompt = function(a, b, c, d, e, f) {3369 fxdriver.modals.signalOpenModal(a, c);3370 return this.delegate_.QueryInterface(CI.nsIPromptService2).prompt(a, b, c, d, e, f);3371};3372DrivenPromptService.prototype.promptUsernameAndPassword = function(a, b, c, d, e, f, g) {3373 return this.delegate_.QueryInterface(CI.nsIPromptService2).promptUsernameAndPassword(a, b, c, d, e, f, g);3374};3375DrivenPromptService.prototype.promptPassword = function(a, b, c, d, e, f) {3376 return this.delegate_.QueryInterface(CI.nsIPromptService2).promptPassword(a, b, c, d, e, f);3377};3378DrivenPromptService.prototype.select = function(a, b, c, d, e, f) {3379 return this.delegate_.QueryInterface(CI.nsIPromptService2).select(a, b, c, d, e, f);3380};3381DrivenPromptService.prototype.promptAuth = function(a, b, c, d, e, f) {3382 fxdriver.modals.signalOpenModal(a, "");3383 return this.delegate_.QueryInterface(CI.nsIPromptService2).promptAuth(a, b, c, d, e, f);3384};3385DrivenPromptService.prototype.asyncPromptAuth = function(a, b, c, d, e, f, g, h) {3386 fxdriver.modals.signalOpenModal(a, "");3387 return this.delegate_.QueryInterface(CI.nsIPromptService2).asyncPromptAuth(a, b, c, d, e, f, g, h);3388};3389DrivenPromptService.prototype.getPrompt = function(a, b) {3390 b = this.delegate_.QueryInterface(CI.nsIPromptFactory).getPrompt(a, b);3391 return new ObservingAlert(a, b);3392};3393DrivenPromptService.prototype.observe = function(a, b, c) {3394 return this.delegate_.observe(a, b, c);3395};3396var PROMPT_SERVICE_CONTRACT_ID = "@mozilla.org/embedcomp/prompt-service;1", PROMPTER_CONTRACT_ID = "@mozilla.org/prompter;1", DRIVEN_PROMPT_SERVICE_CLASS_ID = Components.ID("{e26dbdcd-d3ba-4ded-88c3-6cb07ee3e9e0}"), service = void 0, PromptServiceSpoofFactory = {createInstance:function(a, b) {3397 if (null != a) {3398 throw Components.results.NS_ERROR_NO_AGGREGATION;3399 }3400 void 0 == service && (service = new DrivenPromptService);3401 return service;3402}};3403function PromptServiceSpoofModule() {3404 this.firstTime_ = !0;3405}3406PromptServiceSpoofModule.prototype.registerSelf = function(a, b, c, d) {3407 if (this.firstTime_) {3408 throw this.firstTime_ = !1, Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;3409 }3410 a = a.QueryInterface(CI.nsIComponentRegistrar);3411 a.registerFactoryLocation(DRIVEN_PROMPT_SERVICE_CLASS_ID, "Driven prompt service", PROMPT_SERVICE_CONTRACT_ID, b, c, d);3412 a.registerFactoryLocation(DRIVEN_PROMPT_SERVICE_CLASS_ID, "Driven prompter service", PROMPTER_CONTRACT_ID, b, c, d);3413};3414PromptServiceSpoofModule.prototype.unregisterSelf = function(a, b, c) {3415 goog.log.info(goog.log.getLogger("fxdriver.PromptServiceSpoofModule"), "Unregistering");3416 a.QueryInterface(CI.nsIComponentRegistrar);3417 a.unregisterFactoryLocation(DRIVEN_PROMPT_SERVICE_CLASS_ID, b);3418};3419PromptServiceSpoofModule.prototype.getClassObject = function(a, b, c) {3420 if (!c.equals(Components.interfaces.nsIFactory)) {3421 throw Components.results.NS_ERROR_NOT_IMPLEMENTED;3422 }3423 if (b.equals(DRIVEN_PROMPT_SERVICE_CLASS_ID)) {3424 return PromptServiceSpoofFactory;3425 }3426 throw Components.results.NS_ERROR_NO_INTERFACE;3427};3428PromptServiceSpoofModule.prototype.canUnload = function(a) {3429 return !0;3430};3431NSGetModule = function(a, b) {3432 return new PromptServiceSpoofModule;3433};3434DrivenPromptService.prototype.classID = DRIVEN_PROMPT_SERVICE_CLASS_ID;3435fxdriver.moz.load("resource://gre/modules/XPCOMUtils.jsm");...

Full Screen

Full Screen

useragent.js

Source:useragent.js Github

copy

Full Screen

1// Copyright 2006 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Rendering engine detection.16 * @see <a href="http://www.useragentstring.com/">User agent strings</a>17 * For information on the browser brand (such as Safari versus Chrome), see18 * goog.userAgent.product.19 * @see ../demos/useragent.html20 */21goog.provide('goog.userAgent');22goog.require('goog.string');23/**24 * @define {boolean} Whether we know at compile-time that the browser is IE.25 */26goog.userAgent.ASSUME_IE = false;27/**28 * @define {boolean} Whether we know at compile-time that the browser is GECKO.29 */30goog.userAgent.ASSUME_GECKO = false;31/**32 * @define {boolean} Whether we know at compile-time that the browser is WEBKIT.33 */34goog.userAgent.ASSUME_WEBKIT = false;35/**36 * @define {boolean} Whether we know at compile-time that the browser is a37 * mobile device running WebKit e.g. iPhone or Android.38 */39goog.userAgent.ASSUME_MOBILE_WEBKIT = false;40/**41 * @define {boolean} Whether we know at compile-time that the browser is OPERA.42 */43goog.userAgent.ASSUME_OPERA = false;44/**45 * @define {boolean} Whether the {@code goog.userAgent.isVersion} function will46 * return true for any version.47 */48goog.userAgent.ASSUME_ANY_VERSION = false;49/**50 * Whether we know the browser engine at compile-time.51 * @type {boolean}52 * @private53 */54goog.userAgent.BROWSER_KNOWN_ =55 goog.userAgent.ASSUME_IE ||56 goog.userAgent.ASSUME_GECKO ||57 goog.userAgent.ASSUME_MOBILE_WEBKIT ||58 goog.userAgent.ASSUME_WEBKIT ||59 goog.userAgent.ASSUME_OPERA;60/**61 * Returns the userAgent string for the current browser.62 * Some user agents (I'm thinking of you, Gears WorkerPool) do not expose a63 * navigator object off the global scope. In that case we return null.64 *65 * @return {?string} The userAgent string or null if there is none.66 */67goog.userAgent.getUserAgentString = function() {68 return goog.global['navigator'] ? goog.global['navigator'].userAgent : null;69};70/**71 * @return {Object} The native navigator object.72 */73goog.userAgent.getNavigator = function() {74 // Need a local navigator reference instead of using the global one,75 // to avoid the rare case where they reference different objects.76 // (in a WorkerPool, for example).77 return goog.global['navigator'];78};79/**80 * Initializer for goog.userAgent.81 *82 * This is a named function so that it can be stripped via the jscompiler83 * option for stripping types.84 * @private85 */86goog.userAgent.init_ = function() {87 /**88 * Whether the user agent string denotes Opera.89 * @type {boolean}90 * @private91 */92 goog.userAgent.detectedOpera_ = false;93 /**94 * Whether the user agent string denotes Internet Explorer. This includes95 * other browsers using Trident as its rendering engine. For example AOL96 * and Netscape 897 * @type {boolean}98 * @private99 */100 goog.userAgent.detectedIe_ = false;101 /**102 * Whether the user agent string denotes WebKit. WebKit is the rendering103 * engine that Safari, Android and others use.104 * @type {boolean}105 * @private106 */107 goog.userAgent.detectedWebkit_ = false;108 /**109 * Whether the user agent string denotes a mobile device.110 * @type {boolean}111 * @private112 */113 goog.userAgent.detectedMobile_ = false;114 /**115 * Whether the user agent string denotes Gecko. Gecko is the rendering116 * engine used by Mozilla, Mozilla Firefox, Camino and many more.117 * @type {boolean}118 * @private119 */120 goog.userAgent.detectedGecko_ = false;121 var ua;122 if (!goog.userAgent.BROWSER_KNOWN_ &&123 (ua = goog.userAgent.getUserAgentString())) {124 var navigator = goog.userAgent.getNavigator();125 goog.userAgent.detectedOpera_ = ua.indexOf('Opera') == 0;126 goog.userAgent.detectedIe_ = !goog.userAgent.detectedOpera_ &&127 ua.indexOf('MSIE') != -1;128 goog.userAgent.detectedWebkit_ = !goog.userAgent.detectedOpera_ &&129 ua.indexOf('WebKit') != -1;130 // WebKit also gives navigator.product string equal to 'Gecko'.131 goog.userAgent.detectedMobile_ = goog.userAgent.detectedWebkit_ &&132 ua.indexOf('Mobile') != -1;133 goog.userAgent.detectedGecko_ = !goog.userAgent.detectedOpera_ &&134 !goog.userAgent.detectedWebkit_ && navigator.product == 'Gecko';135 }136};137if (!goog.userAgent.BROWSER_KNOWN_) {138 goog.userAgent.init_();139}140/**141 * Whether the user agent is Opera.142 * @type {boolean}143 */144goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ?145 goog.userAgent.ASSUME_OPERA : goog.userAgent.detectedOpera_;146/**147 * Whether the user agent is Internet Explorer. This includes other browsers148 * using Trident as its rendering engine. For example AOL and Netscape 8149 * @type {boolean}150 */151goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ?152 goog.userAgent.ASSUME_IE : goog.userAgent.detectedIe_;153/**154 * Whether the user agent is Gecko. Gecko is the rendering engine used by155 * Mozilla, Mozilla Firefox, Camino and many more.156 * @type {boolean}157 */158goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ?159 goog.userAgent.ASSUME_GECKO :160 goog.userAgent.detectedGecko_;161/**162 * Whether the user agent is WebKit. WebKit is the rendering engine that163 * Safari, Android and others use.164 * @type {boolean}165 */166goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ?167 goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT :168 goog.userAgent.detectedWebkit_;169/**170 * Whether the user agent is running on a mobile device.171 * @type {boolean}172 */173goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT ||174 goog.userAgent.detectedMobile_;175/**176 * Used while transitioning code to use WEBKIT instead.177 * @type {boolean}178 * @deprecated Use {@link goog.userAgent.product.SAFARI} instead.179 * TODO(nicksantos): Delete this from goog.userAgent.180 */181goog.userAgent.SAFARI = goog.userAgent.WEBKIT;182/**183 * @return {string} the platform (operating system) the user agent is running184 * on. Default to empty string because navigator.platform may not be defined185 * (on Rhino, for example).186 * @private187 */188goog.userAgent.determinePlatform_ = function() {189 var navigator = goog.userAgent.getNavigator();190 return navigator && navigator.platform || '';191};192/**193 * The platform (operating system) the user agent is running on. Default to194 * empty string because navigator.platform may not be defined (on Rhino, for195 * example).196 * @type {string}197 */198goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();199/**200 * @define {boolean} Whether the user agent is running on a Macintosh operating201 * system.202 */203goog.userAgent.ASSUME_MAC = false;204/**205 * @define {boolean} Whether the user agent is running on a Windows operating206 * system.207 */208goog.userAgent.ASSUME_WINDOWS = false;209/**210 * @define {boolean} Whether the user agent is running on a Linux operating211 * system.212 */213goog.userAgent.ASSUME_LINUX = false;214/**215 * @define {boolean} Whether the user agent is running on a X11 windowing216 * system.217 */218goog.userAgent.ASSUME_X11 = false;219/**220 * @type {boolean}221 * @private222 */223goog.userAgent.PLATFORM_KNOWN_ =224 goog.userAgent.ASSUME_MAC ||225 goog.userAgent.ASSUME_WINDOWS ||226 goog.userAgent.ASSUME_LINUX ||227 goog.userAgent.ASSUME_X11;228/**229 * Initialize the goog.userAgent constants that define which platform the user230 * agent is running on.231 * @private232 */233goog.userAgent.initPlatform_ = function() {234 /**235 * Whether the user agent is running on a Macintosh operating system.236 * @type {boolean}237 * @private238 */239 goog.userAgent.detectedMac_ = goog.string.contains(goog.userAgent.PLATFORM,240 'Mac');241 /**242 * Whether the user agent is running on a Windows operating system.243 * @type {boolean}244 * @private245 */246 goog.userAgent.detectedWindows_ = goog.string.contains(247 goog.userAgent.PLATFORM, 'Win');248 /**249 * Whether the user agent is running on a Linux operating system.250 * @type {boolean}251 * @private252 */253 goog.userAgent.detectedLinux_ = goog.string.contains(goog.userAgent.PLATFORM,254 'Linux');255 /**256 * Whether the user agent is running on a X11 windowing system.257 * @type {boolean}258 * @private259 */260 goog.userAgent.detectedX11_ = !!goog.userAgent.getNavigator() &&261 goog.string.contains(goog.userAgent.getNavigator()['appVersion'] || '',262 'X11');263};264if (!goog.userAgent.PLATFORM_KNOWN_) {265 goog.userAgent.initPlatform_();266}267/**268 * Whether the user agent is running on a Macintosh operating system.269 * @type {boolean}270 */271goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ?272 goog.userAgent.ASSUME_MAC : goog.userAgent.detectedMac_;273/**274 * Whether the user agent is running on a Windows operating system.275 * @type {boolean}276 */277goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ?278 goog.userAgent.ASSUME_WINDOWS : goog.userAgent.detectedWindows_;279/**280 * Whether the user agent is running on a Linux operating system.281 * @type {boolean}282 */283goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ?284 goog.userAgent.ASSUME_LINUX : goog.userAgent.detectedLinux_;285/**286 * Whether the user agent is running on a X11 windowing system.287 * @type {boolean}288 */289goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ?290 goog.userAgent.ASSUME_X11 : goog.userAgent.detectedX11_;291/**292 * @return {string} The string that describes the version number of the user293 * agent.294 * @private295 */296goog.userAgent.determineVersion_ = function() {297 // All browsers have different ways to detect the version and they all have298 // different naming schemes.299 // version is a string rather than a number because it may contain 'b', 'a',300 // and so on.301 var version = '', re;302 if (goog.userAgent.OPERA && goog.global['opera']) {303 var operaVersion = goog.global['opera'].version;304 version = typeof operaVersion == 'function' ? operaVersion() : operaVersion;305 } else {306 if (goog.userAgent.GECKO) {307 re = /rv\:([^\);]+)(\)|;)/;308 } else if (goog.userAgent.IE) {309 re = /MSIE\s+([^\);]+)(\)|;)/;310 } else if (goog.userAgent.WEBKIT) {311 // WebKit/125.4312 re = /WebKit\/(\S+)/;313 }314 if (re) {315 var arr = re.exec(goog.userAgent.getUserAgentString());316 version = arr ? arr[1] : '';317 }318 }319 if (goog.userAgent.IE) {320 // IE9 can be in document mode 9 but be reporting an inconsistent user agent321 // version. If it is identifying as a version lower than 9 we take the322 // documentMode as the version instead. IE8 has similar behavior.323 // It is recommended to set the X-UA-Compatible header to ensure that IE9324 // uses documentMode 9.325 var docMode = goog.userAgent.getDocumentMode_();326 if (docMode > parseFloat(version)) {327 return String(docMode);328 }329 }330 return version;331};332/**333 * @return {number|undefined} Returns the document mode (for testing).334 * @private335 */336goog.userAgent.getDocumentMode_ = function() {337 // NOTE(user): goog.userAgent may be used in context where there is no DOM.338 var doc = goog.global['document'];339 return doc ? doc['documentMode'] : undefined;340};341/**342 * The version of the user agent. This is a string because it might contain343 * 'b' (as in beta) as well as multiple dots.344 * @type {string}345 */346goog.userAgent.VERSION = goog.userAgent.determineVersion_();347/**348 * Compares two version numbers.349 *350 * @param {string} v1 Version of first item.351 * @param {string} v2 Version of second item.352 *353 * @return {number} 1 if first argument is higher354 * 0 if arguments are equal355 * -1 if second argument is higher.356 * @deprecated Use goog.string.compareVersions.357 */358goog.userAgent.compare = function(v1, v2) {359 return goog.string.compareVersions(v1, v2);360};361/**362 * Cache for {@link goog.userAgent.isVersion}. Calls to compareVersions are363 * surprisingly expensive and as a browsers version number is unlikely to change364 * during a session we cache the results.365 * @type {Object}366 * @private367 */368goog.userAgent.isVersionCache_ = {};369/**370 * Whether the user agent version is higher or the same as the given version.371 * NOTE: When checking the version numbers for Firefox and Safari, be sure to372 * use the engine's version, not the browser's version number. For example,373 * Firefox 3.0 corresponds to Gecko 1.9 and Safari 3.0 to Webkit 522.11.374 * Opera and Internet Explorer versions match the product release number.<br>375 * @see <a href="http://en.wikipedia.org/wiki/Safari_version_history">376 * Webkit</a>377 * @see <a href="http://en.wikipedia.org/wiki/Gecko_engine">Gecko</a>378 *379 * @param {string|number} version The version to check.380 * @return {boolean} Whether the user agent version is higher or the same as381 * the given version.382 */383goog.userAgent.isVersion = function(version) {384 return goog.userAgent.ASSUME_ANY_VERSION ||385 goog.userAgent.isVersionCache_[version] ||386 (goog.userAgent.isVersionCache_[version] =387 goog.string.compareVersions(goog.userAgent.VERSION, version) >= 0);388};389/**390 * Cache for {@link goog.userAgent.isDocumentMode}.391 * Browsers document mode version number is unlikely to change during a session392 * we cache the results.393 * @type {Object}394 * @private395 */396goog.userAgent.isDocumentModeCache_ = {};397/**398 * Whether the IE effective document mode is higher or the same as the given399 * document mode version.400 * NOTE: Only for IE, return false for another browser.401 *402 * @param {number} documentMode The document mode version to check.403 * @return {boolean} Whether the IE effective document mode is higher or the404 * same as the given version.405 */406goog.userAgent.isDocumentMode = function(documentMode) {407 return goog.userAgent.isDocumentModeCache_[documentMode] ||408 (goog.userAgent.isDocumentModeCache_[documentMode] = goog.userAgent.IE &&409 !!document.documentMode && document.documentMode >= documentMode);...

Full Screen

Full Screen

browserfeature.js

Source:browserfeature.js Github

copy

Full Screen

1// Copyright 2005 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Trogedit constants for browser features and quirks that should16 * be used by the rich text editor.17 */18goog.provide('goog.editor.BrowserFeature');19goog.require('goog.editor.defines');20goog.require('goog.userAgent');21goog.require('goog.userAgent.product');22goog.require('goog.userAgent.product.isVersion');23/**24 * Maps browser quirks to boolean values, detailing what the current25 * browser supports.26 * @type {Object}27 */28goog.editor.BrowserFeature = {29 // Whether this browser uses the IE TextRange object.30 HAS_IE_RANGES: goog.userAgent.IE && !goog.userAgent.isDocumentMode(9),31 // Whether this browser uses the W3C standard Range object.32 // Assumes IE higher versions will be compliance with W3C standard.33 HAS_W3C_RANGES: goog.userAgent.GECKO || goog.userAgent.WEBKIT ||34 goog.userAgent.OPERA ||35 (goog.userAgent.IE && goog.userAgent.isDocumentMode(9)),36 // Has the contentEditable attribute, which makes nodes editable.37 //38 // NOTE(nicksantos): FF3 has contentEditable, but there are 3 major reasons39 // why we don't use it:40 // 1) In FF3, we listen for key events on the document, and we'd have to41 // filter them properly. See TR_Browser.USE_DOCUMENT_FOR_KEY_EVENTS.42 // 2) In FF3, we listen for focus/blur events on the document, which43 // simply doesn't make sense in contentEditable. focus/blur44 // on contentEditable elements still has some quirks, which we're45 // talking to Firefox-team about.46 // 3) We currently use Mutation events in FF3 to detect changes,47 // and these are dispatched on the document only.48 // If we ever hope to support FF3/contentEditable, all 3 of these issues49 // will need answers. Most just involve refactoring at our end.50 HAS_CONTENT_EDITABLE: goog.userAgent.IE || goog.userAgent.WEBKIT ||51 goog.userAgent.OPERA ||52 (goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3 &&53 goog.userAgent.GECKO && goog.userAgent.isVersion('1.9')),54 // Whether to use mutation event types to detect changes55 // in the field contents.56 USE_MUTATION_EVENTS: goog.userAgent.GECKO,57 // Whether the browser has a functional DOMSubtreeModified event.58 // TODO(user): Enable for all FF3 once we're confident this event fires59 // reliably. Currently it's only enabled if using contentEditable in FF as60 // we have no other choice in that case but to use this event.61 HAS_DOM_SUBTREE_MODIFIED_EVENT: goog.userAgent.WEBKIT ||62 (goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3 &&63 goog.userAgent.GECKO && goog.userAgent.isVersion('1.9')),64 // Whether nodes can be copied from one document to another65 HAS_DOCUMENT_INDEPENDENT_NODES: goog.userAgent.GECKO,66 // Whether the cursor goes before or inside the first block element on67 // focus, e.g., <body><p>foo</p></body>. FF will put the cursor before the68 // paragraph on focus, which is wrong.69 PUTS_CURSOR_BEFORE_FIRST_BLOCK_ELEMENT_ON_FOCUS: goog.userAgent.GECKO,70 // Whether the selection of one frame is cleared when another frame71 // is focused.72 CLEARS_SELECTION_WHEN_FOCUS_LEAVES:73 goog.userAgent.IE || goog.userAgent.WEBKIT || goog.userAgent.OPERA,74 // Whether "unselectable" is supported as an element style.75 HAS_UNSELECTABLE_STYLE: goog.userAgent.GECKO || goog.userAgent.WEBKIT,76 // Whether this browser's "FormatBlock" command does not suck.77 FORMAT_BLOCK_WORKS_FOR_BLOCKQUOTES: goog.userAgent.GECKO ||78 goog.userAgent.WEBKIT || goog.userAgent.OPERA,79 // Whether this browser's "FormatBlock" command may create multiple80 // blockquotes.81 CREATES_MULTIPLE_BLOCKQUOTES:82 (goog.userAgent.WEBKIT && !goog.userAgent.isVersion('534.16')) ||83 goog.userAgent.OPERA,84 // Whether this browser's "FormatBlock" command will wrap blockquotes85 // inside of divs, instead of replacing divs with blockquotes.86 WRAPS_BLOCKQUOTE_IN_DIVS: goog.userAgent.OPERA,87 // Whether the readystatechange event is more reliable than load.88 PREFERS_READY_STATE_CHANGE_EVENT: goog.userAgent.IE,89 // Whether hitting the tab key will fire a keypress event.90 // see http://www.quirksmode.org/js/keys.html91 TAB_FIRES_KEYPRESS: !goog.userAgent.IE,92 // Has a standards mode quirk where width=100% doesn't do the right thing,93 // but width=99% does.94 // TODO(user|user): This should be fixable by less hacky means95 NEEDS_99_WIDTH_IN_STANDARDS_MODE: goog.userAgent.IE,96 // Whether keyboard events only reliably fire on the document.97 // On Gecko without contentEditable, keyboard events only fire reliably on the98 // document element. With contentEditable, the field itself is focusable,99 // which means that it will fire key events.100 USE_DOCUMENT_FOR_KEY_EVENTS: goog.userAgent.GECKO &&101 !goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3,102 // Whether this browser shows non-standard attributes in innerHTML.103 SHOWS_CUSTOM_ATTRS_IN_INNER_HTML: goog.userAgent.IE,104 // Whether this browser shrinks empty nodes away to nothing.105 // (If so, we need to insert some space characters into nodes that106 // shouldn't be collapsed)107 COLLAPSES_EMPTY_NODES:108 goog.userAgent.GECKO || goog.userAgent.WEBKIT || goog.userAgent.OPERA,109 // Whether we must convert <strong> and <em> tags to <b>, <i>.110 CONVERT_TO_B_AND_I_TAGS: goog.userAgent.GECKO || goog.userAgent.OPERA,111 // Whether this browser likes to tab through images in contentEditable mode,112 // and we like to disable this feature.113 TABS_THROUGH_IMAGES: goog.userAgent.IE,114 // Whether this browser unescapes urls when you extract it from the href tag.115 UNESCAPES_URLS_WITHOUT_ASKING: goog.userAgent.IE &&116 !goog.userAgent.isVersion('7.0'),117 // Whether this browser supports execCommand("styleWithCSS") to toggle between118 // inserting html tags or inline styling for things like bold, italic, etc.119 HAS_STYLE_WITH_CSS:120 goog.userAgent.GECKO && goog.userAgent.isVersion('1.8') ||121 goog.userAgent.WEBKIT || goog.userAgent.OPERA,122 // Whether clicking on an editable link will take you to that site.123 FOLLOWS_EDITABLE_LINKS: goog.userAgent.WEBKIT,124 // Whether this browser has document.activeElement available.125 HAS_ACTIVE_ELEMENT:126 goog.userAgent.IE || goog.userAgent.OPERA ||127 goog.userAgent.GECKO && goog.userAgent.isVersion('1.9'),128 // Whether this browser supports the setCapture method on DOM elements.129 HAS_SET_CAPTURE: goog.userAgent.IE,130 // Whether this browser can't set background color when the selection131 // is collapsed.132 EATS_EMPTY_BACKGROUND_COLOR: goog.userAgent.GECKO ||133 goog.userAgent.WEBKIT && !goog.userAgent.isVersion('527'),134 // Whether this browser supports the "focusin" or "DOMFocusIn" event135 // consistently.136 // NOTE(nicksantos): FF supports DOMFocusIn, but doesn't seem to do so137 // consistently.138 SUPPORTS_FOCUSIN: goog.userAgent.IE || goog.userAgent.OPERA,139 // Whether clicking on an image will cause the selection to move to the image.140 // Note: Gecko moves the selection, but it won't always go to the image.141 // For example, if the image is wrapped in a div, and you click on the img,142 // anchorNode = focusNode = div, anchorOffset = 0, focusOffset = 1, so this143 // is another way of "selecting" the image, but there are too many special144 // cases like this so we will do the work manually.145 SELECTS_IMAGES_ON_CLICK: goog.userAgent.IE || goog.userAgent.OPERA,146 // Whether this browser moves <style> tags into new <head> elements.147 MOVES_STYLE_TO_HEAD: goog.userAgent.WEBKIT,148 // Whether this browser collapses the selection in a contenteditable when the149 // mouse is pressed in a non-editable portion of the same frame, even if150 // Event.preventDefault is called. This field is deprecated and unused -- only151 // old versions of Opera have this bug.152 COLLAPSES_SELECTION_ONMOUSEDOWN: false,153 // Whether the user can actually create a selection in this browser with the154 // caret in the MIDDLE of the selection by double-clicking.155 CARET_INSIDE_SELECTION: goog.userAgent.OPERA,156 // Whether the browser focuses <body contenteditable> automatically when157 // the user clicks on <html>. This field is deprecated and unused -- only old158 // versions of Opera don't have this behavior.159 FOCUSES_EDITABLE_BODY_ON_HTML_CLICK: true,160 // Whether to use keydown for key listening (uses keypress otherwise). Taken161 // from goog.events.KeyHandler.162 USES_KEYDOWN: goog.userAgent.IE ||163 goog.userAgent.WEBKIT && goog.userAgent.isVersion('525'),164 // Whether this browser converts spaces to non-breaking spaces when calling165 // execCommand's RemoveFormat.166 // See: https://bugs.webkit.org/show_bug.cgi?id=14062167 ADDS_NBSPS_IN_REMOVE_FORMAT:168 goog.userAgent.WEBKIT && !goog.userAgent.isVersion('531'),169 // Whether the browser will get stuck inside a link. That is, if your cursor170 // is after a link and you type, does your text go inside the link tag.171 // Bug: http://bugs.webkit.org/show_bug.cgi?id=17697172 GETS_STUCK_IN_LINKS:173 goog.userAgent.WEBKIT && !goog.userAgent.isVersion('528'),174 // Whether the browser corrupts empty text nodes in Node#normalize,175 // removing them from the Document instead of merging them.176 NORMALIZE_CORRUPTS_EMPTY_TEXT_NODES: goog.userAgent.GECKO &&177 goog.userAgent.isVersion('1.9') || goog.userAgent.IE ||178 goog.userAgent.OPERA ||179 goog.userAgent.WEBKIT && goog.userAgent.isVersion('531'),180 // Whether the browser corrupts all text nodes in Node#normalize,181 // removing them from the Document instead of merging them.182 NORMALIZE_CORRUPTS_ALL_TEXT_NODES: goog.userAgent.IE,183 // Browsers where executing subscript then superscript (or vv) will cause both184 // to be applied in a nested fashion instead of the first being overwritten by185 // the second.186 NESTS_SUBSCRIPT_SUPERSCRIPT: goog.userAgent.IE || goog.userAgent.GECKO ||187 goog.userAgent.OPERA,188 // Whether this browser can place a cursor in an empty element natively.189 CAN_SELECT_EMPTY_ELEMENT: !goog.userAgent.IE && !goog.userAgent.WEBKIT,190 FORGETS_FORMATTING_WHEN_LISTIFYING: goog.userAgent.GECKO ||191 goog.userAgent.WEBKIT && !goog.userAgent.isVersion('526'),192 LEAVES_P_WHEN_REMOVING_LISTS: goog.userAgent.IE || goog.userAgent.OPERA,193 CAN_LISTIFY_BR: !goog.userAgent.IE && !goog.userAgent.OPERA,194 // See bug 1286408. When somewhere inside your selection there is an element195 // with a style attribute that sets the font size, if you change the font196 // size, the browser creates a font tag, but the font size in the style attr197 // overrides the font tag. Only webkit removes that font size from the style198 // attr.199 DOESNT_OVERRIDE_FONT_SIZE_IN_STYLE_ATTR: !goog.userAgent.WEBKIT,200 // Implements this spec about dragging files from the filesystem to the201 // browser: http://www.whatwg/org/specs/web-apps/current-work/#dnd202 SUPPORTS_HTML5_FILE_DRAGGING: (goog.userAgent.product.CHROME &&203 goog.userAgent.product.isVersion('4')) ||204 (goog.userAgent.product.SAFARI && goog.userAgent.isVersion('533')) ||205 (goog.userAgent.GECKO && goog.userAgent.isVersion('2.0')) ||206 (goog.userAgent.IE && goog.userAgent.isVersion('10')),207 // Version of Opera that supports the opera-defaultBlock execCommand to change208 // the default block inserted when [return] is pressed. Note that this only is209 // used if the caret is not already in a block that can be repeated.210 // TODO(user): Link to public documentation of this feature if Opera puts211 // something up about it.212 SUPPORTS_OPERA_DEFAULTBLOCK_COMMAND:213 goog.userAgent.OPERA && goog.userAgent.isVersion('11.10'),214 SUPPORTS_FILE_PASTING: goog.userAgent.product.CHROME &&215 goog.userAgent.product.isVersion('12')...

Full Screen

Full Screen

browser_test.js

Source:browser_test.js Github

copy

Full Screen

1// Copyright 2013 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Unit tests for goog.labs.userAgent.browser.16 */17goog.provide('goog.labs.userAgent.browserTest');18goog.require('goog.labs.userAgent.browser');19goog.require('goog.labs.userAgent.testAgents');20goog.require('goog.labs.userAgent.util');21goog.require('goog.testing.jsunit');22goog.setTestOnly('goog.labs.userAgent.browserTest');23function setUp() {24 goog.labs.userAgent.util.setUserAgent(null);25}26function testOpera10() {27 goog.labs.userAgent.util.setUserAgent(28 goog.labs.userAgent.testAgents.OPERA_10);29 assertTrue(goog.labs.userAgent.browser.isOpera());30 assertVersion('10.00');31 assertVersionBetween('10.00', '10.10');32}33function testOperaMac() {34 goog.labs.userAgent.util.setUserAgent(35 goog.labs.userAgent.testAgents.OPERA_MAC);36 assertTrue(goog.labs.userAgent.browser.isOpera());37 assertVersion('11.52');38 assertVersionBetween('11.50', '12.00');39}40function testOperaLinux() {41 goog.labs.userAgent.util.setUserAgent(42 goog.labs.userAgent.testAgents.OPERA_LINUX);43 assertTrue(goog.labs.userAgent.browser.isOpera());44 assertVersion('11.50');45 assertVersionBetween('11.00', '12.00');46}47function testOpera15() {48 goog.labs.userAgent.util.setUserAgent(49 goog.labs.userAgent.testAgents.OPERA_15);50 assertTrue(goog.labs.userAgent.browser.isOpera());51 assertVersion('15.0.1147.100');52 assertVersionBetween('15.00', '16.00');53}54function testIE6() {55 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IE_6);56 assertTrue(goog.labs.userAgent.browser.isIE());57 assertVersion('6.0');58 assertVersionBetween('5.0', '7.0');59}60function testIE7() {61 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IE_7);62 assertTrue(goog.labs.userAgent.browser.isIE());63 assertVersion('7.0');64}65function testIE8() {66 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IE_8);67 assertTrue(goog.labs.userAgent.browser.isIE());68 assertVersion('8.0');69 assertVersionBetween('7.0', '9.0');70}71function testIE8Compatibility() {72 goog.labs.userAgent.util.setUserAgent(73 goog.labs.userAgent.testAgents.IE_8_COMPATIBILITY);74 assertTrue(goog.labs.userAgent.browser.isIE());75 assertVersion('8.0');76}77function testIE9() {78 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IE_9);79 assertTrue(goog.labs.userAgent.browser.isIE());80 assertVersion('9.0');81 assertVersionBetween('8.0', '10.0');82}83function testIE9Compatibility() {84 goog.labs.userAgent.util.setUserAgent(85 goog.labs.userAgent.testAgents.IE_9_COMPATIBILITY);86 assertTrue(goog.labs.userAgent.browser.isIE());87 assertVersion('9.0');88}89function testIE10() {90 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IE_10);91 assertTrue(goog.labs.userAgent.browser.isIE());92 assertVersion('10.0');93 assertVersionBetween('10.0', '11.0');94}95function testIE10Compatibility() {96 goog.labs.userAgent.util.setUserAgent(97 goog.labs.userAgent.testAgents.IE_10_COMPATIBILITY);98 assertTrue(goog.labs.userAgent.browser.isIE());99 assertVersion('10.0');100}101function testIE10Mobile() {102 goog.labs.userAgent.util.setUserAgent(103 goog.labs.userAgent.testAgents.IE_10_MOBILE);104 assertTrue(goog.labs.userAgent.browser.isIE());105 assertVersion('10.0');106}107function testIE11() {108 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IE_11);109 assertTrue(goog.labs.userAgent.browser.isIE());110 assertVersion('11.0');111 assertVersionBetween('10.0', '12.0');112}113function testIE11CompatibilityMSIE7() {114 goog.labs.userAgent.util.setUserAgent(115 goog.labs.userAgent.testAgents.IE_11_COMPATIBILITY_MSIE_7);116 assertTrue(goog.labs.userAgent.browser.isIE());117 assertVersion('11.0');118}119function testIE11CompatibilityMSIE9() {120 goog.labs.userAgent.util.setUserAgent(121 goog.labs.userAgent.testAgents.IE_11_COMPATIBILITY_MSIE_9);122 assertTrue(goog.labs.userAgent.browser.isIE());123 assertVersion('11.0');124}125function testFirefox19() {126 goog.labs.userAgent.util.setUserAgent(127 goog.labs.userAgent.testAgents.FIREFOX_19);128 assertTrue(goog.labs.userAgent.browser.isFirefox());129 assertVersion('19.0');130 assertVersionBetween('18.0', '20.0');131}132function testFirefoxWindows() {133 goog.labs.userAgent.util.setUserAgent(134 goog.labs.userAgent.testAgents.FIREFOX_WINDOWS);135 assertTrue(goog.labs.userAgent.browser.isFirefox());136 assertVersion('14.0.1');137 assertVersionBetween('14.0', '15.0');138}139function testFirefoxLinux() {140 goog.labs.userAgent.util.setUserAgent(141 goog.labs.userAgent.testAgents.FIREFOX_LINUX);142 assertTrue(goog.labs.userAgent.browser.isFirefox());143 assertVersion('15.0.1');144}145function testChromeAndroid() {146 goog.labs.userAgent.util.setUserAgent(147 goog.labs.userAgent.testAgents.CHROME_ANDROID);148 assertTrue(goog.labs.userAgent.browser.isChrome());149 assertVersion('18.0.1025.133');150 assertVersionBetween('18.0', '19.0');151 assertVersionBetween('17.0', '18.1');152}153function testChromeIphone() {154 goog.labs.userAgent.util.setUserAgent(155 goog.labs.userAgent.testAgents.CHROME_IPHONE);156 assertTrue(goog.labs.userAgent.browser.isChrome());157 assertVersion('22.0.1194.0');158 assertVersionBetween('22.0', '23.0');159 assertVersionBetween('22.0', '22.10');160}161function testChromeMac() {162 goog.labs.userAgent.util.setUserAgent(163 goog.labs.userAgent.testAgents.CHROME_MAC);164 assertTrue(goog.labs.userAgent.browser.isChrome());165 assertVersion('24.0.1309.0');166 assertVersionBetween('24.0', '25.0');167 assertVersionBetween('24.0', '24.10');168}169function testSafariIpad() {170 goog.labs.userAgent.util.setUserAgent(goog.labs.userAgent.testAgents.IPAD_6);171 assertTrue(goog.labs.userAgent.browser.isSafari());172 assertVersion('6.0');173 assertVersionBetween('5.1', '7.0');174}175function testSafari6() {176 goog.labs.userAgent.util.setUserAgent(177 goog.labs.userAgent.testAgents.SAFARI_6);178 assertTrue(goog.labs.userAgent.browser.isSafari());179 assertVersion('6.0');180 assertVersionBetween('6.0', '7.0');181}182function testSafariIphone() {183 goog.labs.userAgent.util.setUserAgent(184 goog.labs.userAgent.testAgents.SAFARI_IPHONE_6);185 assertTrue(goog.labs.userAgent.browser.isSafari());186 assertVersion('6.0');187 assertVersionBetween('5.0', '7.0');188}189function testCoast() {190 goog.labs.userAgent.util.setUserAgent(191 goog.labs.userAgent.testAgents.COAST);192 assertTrue(goog.labs.userAgent.browser.isCoast());193}194function testWebviewIOS() {195 goog.labs.userAgent.util.setUserAgent(196 goog.labs.userAgent.testAgents.WEBVIEW_IPHONE);197 assertTrue(goog.labs.userAgent.browser.isIosWebview());198 goog.labs.userAgent.util.setUserAgent(199 goog.labs.userAgent.testAgents.WEBVIEW_IPAD);200 assertTrue(goog.labs.userAgent.browser.isIosWebview());201}202function testAndroidBrowser235() {203 goog.labs.userAgent.util.setUserAgent(204 goog.labs.userAgent.testAgents.ANDROID_BROWSER_235);205 assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());206 assertVersion('4.0');207 assertVersionBetween('3.0', '5.0');208}209function testAndroidBrowser403() {210 goog.labs.userAgent.util.setUserAgent(211 goog.labs.userAgent.testAgents.ANDROID_BROWSER_403);212 assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());213 assertVersion('4.0');214 assertVersionBetween('3.0', '5.0');215}216function testAndroidBrowser233() {217 goog.labs.userAgent.util.setUserAgent(218 goog.labs.userAgent.testAgents.ANDROID_BROWSER_233);219 assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());220 assertVersion('4.0');221 assertVersionBetween('3.0', '5.0');222}223function testAndroidWebView411() {224 goog.labs.userAgent.util.setUserAgent(225 goog.labs.userAgent.testAgents.ANDROID_WEB_VIEW_4_1_1);226 assertFalse(goog.labs.userAgent.browser.isChrome());227 assertTrue(goog.labs.userAgent.browser.isAndroidBrowser());228 assertVersion('4.0');229 assertVersionBetween('3.0', '5.0');230}231function testAndroidWebView44() {232 goog.labs.userAgent.util.setUserAgent(233 goog.labs.userAgent.testAgents.ANDROID_WEB_VIEW_4_4);234 assertTrue(goog.labs.userAgent.browser.isChrome());235 assertFalse(goog.labs.userAgent.browser.isAndroidBrowser());236 assertVersion('30.0.0.0');237 assertVersionBetween('29.0', '31.0');238}239function testSilk() {240 goog.labs.userAgent.util.setUserAgent(241 goog.labs.userAgent.testAgents.KINDLE_FIRE);242 assertTrue(goog.labs.userAgent.browser.isSilk());243 assertVersion('2.1');244}245function assertVersion(version) {246 assertEquals(version, goog.labs.userAgent.browser.getVersion());247}248function assertVersionBetween(lowVersion, highVersion) {249 assertTrue(goog.labs.userAgent.browser.isVersionOrHigher(lowVersion));250 assertFalse(goog.labs.userAgent.browser.isVersionOrHigher(highVersion));...

Full Screen

Full Screen

product.js

Source:product.js Github

copy

Full Screen

1// Copyright 2008 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Detects the specific browser and not just the rendering engine.16 *17 */18goog.provide('goog.userAgent.product');19goog.require('goog.userAgent');20/**21 * @define {boolean} Whether the code is running on the Firefox web browser.22 */23goog.userAgent.product.ASSUME_FIREFOX = false;24/**25 * @define {boolean} Whether the code is running on the Camino web browser.26 */27goog.userAgent.product.ASSUME_CAMINO = false;28/**29 * @define {boolean} Whether we know at compile-time that the product is an30 * iPhone.31 */32goog.userAgent.product.ASSUME_IPHONE = false;33/**34 * @define {boolean} Whether we know at compile-time that the product is an35 * iPad.36 */37goog.userAgent.product.ASSUME_IPAD = false;38/**39 * @define {boolean} Whether we know at compile-time that the product is an40 * Android phone.41 */42goog.userAgent.product.ASSUME_ANDROID = false;43/**44 * @define {boolean} Whether the code is running on the Chrome web browser.45 */46goog.userAgent.product.ASSUME_CHROME = false;47/**48 * @define {boolean} Whether the code is running on the Safari web browser.49 */50goog.userAgent.product.ASSUME_SAFARI = false;51/**52 * Whether we know the product type at compile-time.53 * @type {boolean}54 * @private55 */56goog.userAgent.product.PRODUCT_KNOWN_ =57 goog.userAgent.ASSUME_IE ||58 goog.userAgent.ASSUME_OPERA ||59 goog.userAgent.product.ASSUME_FIREFOX ||60 goog.userAgent.product.ASSUME_CAMINO ||61 goog.userAgent.product.ASSUME_IPHONE ||62 goog.userAgent.product.ASSUME_IPAD ||63 goog.userAgent.product.ASSUME_ANDROID ||64 goog.userAgent.product.ASSUME_CHROME ||65 goog.userAgent.product.ASSUME_SAFARI;66/**67 * Right now we just focus on Tier 1-3 browsers at:68 * http://wiki/Nonconf/ProductPlatformGuidelines69 * As well as the YUI grade A browsers at:70 * http://developer.yahoo.com/yui/articles/gbs/71 *72 * @private73 */74goog.userAgent.product.init_ = function() {75 /**76 * Whether the code is running on the Firefox web browser.77 * @type {boolean}78 * @private79 */80 goog.userAgent.product.detectedFirefox_ = false;81 /**82 * Whether the code is running on the Camino web browser.83 * @type {boolean}84 * @private85 */86 goog.userAgent.product.detectedCamino_ = false;87 /**88 * Whether the code is running on an iPhone or iPod touch.89 * @type {boolean}90 * @private91 */92 goog.userAgent.product.detectedIphone_ = false;93 /**94 * Whether the code is running on an iPad95 * @type {boolean}96 * @private97 */98 goog.userAgent.product.detectedIpad_ = false;99 /**100 * Whether the code is running on the default browser on an Android phone.101 * @type {boolean}102 * @private103 */104 goog.userAgent.product.detectedAndroid_ = false;105 /**106 * Whether the code is running on the Chrome web browser.107 * @type {boolean}108 * @private109 */110 goog.userAgent.product.detectedChrome_ = false;111 /**112 * Whether the code is running on the Safari web browser.113 * @type {boolean}114 * @private115 */116 goog.userAgent.product.detectedSafari_ = false;117 var ua = goog.userAgent.getUserAgentString();118 if (!ua) {119 return;120 }121 // The order of the if-statements in the following code is important.122 // For example, in the WebKit section, we put Chrome in front of Safari123 // because the string 'Safari' is present on both of those browsers'124 // userAgent strings as well as the string we are looking for.125 // The idea is to prevent accidental detection of more than one client.126 if (ua.indexOf('Firefox') != -1) {127 goog.userAgent.product.detectedFirefox_ = true;128 } else if (ua.indexOf('Camino') != -1) {129 goog.userAgent.product.detectedCamino_ = true;130 } else if (ua.indexOf('iPhone') != -1 || ua.indexOf('iPod') != -1) {131 goog.userAgent.product.detectedIphone_ = true;132 } else if (ua.indexOf('iPad') != -1) {133 goog.userAgent.product.detectedIpad_ = true;134 } else if (ua.indexOf('Android') != -1) {135 goog.userAgent.product.detectedAndroid_ = true;136 } else if (ua.indexOf('Chrome') != -1) {137 goog.userAgent.product.detectedChrome_ = true;138 } else if (ua.indexOf('Safari') != -1) {139 goog.userAgent.product.detectedSafari_ = true;140 }141};142if (!goog.userAgent.product.PRODUCT_KNOWN_) {143 goog.userAgent.product.init_();144}145/**146 * Whether the code is running on the Opera web browser.147 * @type {boolean}148 */149goog.userAgent.product.OPERA = goog.userAgent.OPERA;150/**151 * Whether the code is running on an IE web browser.152 * @type {boolean}153 */154goog.userAgent.product.IE = goog.userAgent.IE;155/**156 * Whether the code is running on the Firefox web browser.157 * @type {boolean}158 */159goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ?160 goog.userAgent.product.ASSUME_FIREFOX :161 goog.userAgent.product.detectedFirefox_;162/**163 * Whether the code is running on the Camino web browser.164 * @type {boolean}165 */166goog.userAgent.product.CAMINO = goog.userAgent.product.PRODUCT_KNOWN_ ?167 goog.userAgent.product.ASSUME_CAMINO :168 goog.userAgent.product.detectedCamino_;169/**170 * Whether the code is running on an iPhone or iPod touch.171 * @type {boolean}172 */173goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ?174 goog.userAgent.product.ASSUME_IPHONE :175 goog.userAgent.product.detectedIphone_;176/**177 * Whether the code is running on an iPad.178 * @type {boolean}179 */180goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ?181 goog.userAgent.product.ASSUME_IPAD :182 goog.userAgent.product.detectedIpad_;183/**184 * Whether the code is running on the default browser on an Android phone.185 * @type {boolean}186 */187goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ?188 goog.userAgent.product.ASSUME_ANDROID :189 goog.userAgent.product.detectedAndroid_;190/**191 * Whether the code is running on the Chrome web browser.192 * @type {boolean}193 */194goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ?195 goog.userAgent.product.ASSUME_CHROME :196 goog.userAgent.product.detectedChrome_;197/**198 * Whether the code is running on the Safari web browser.199 * @type {boolean}200 */201goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ?202 goog.userAgent.product.ASSUME_SAFARI :...

Full Screen

Full Screen

useragenttestutil.js

Source:useragenttestutil.js Github

copy

Full Screen

1// Copyright 2006 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Shared test function to reset the constants in16 * goog.userAgent.*17 */18goog.provide('goog.userAgentTestUtil');19goog.provide('goog.userAgentTestUtil.UserAgents');20goog.require('goog.labs.userAgent.browser');21goog.require('goog.labs.userAgent.engine');22goog.require('goog.userAgent');23goog.require('goog.userAgent.keyboard');24goog.require('goog.userAgent.platform');25goog.require('goog.userAgent.product');26/** @suppress {extraRequire} */27goog.require('goog.userAgent.product.isVersion');28goog.setTestOnly('goog.userAgentTestUtil');29/**30 * Rerun the initialization code to set all of the goog.userAgent constants.31 * @suppress {accessControls}32 */33goog.userAgentTestUtil.reinitializeUserAgent = function() {34 // Unfortunately we can't isolate the useragent setting in a function35 // we can call, because things rely on it compiling to nothing when36 // one of the ASSUME flags is set, and the compiler isn't smart enough37 // to do that when the setting is done inside a function that's inlined.38 goog.userAgent.OPERA = goog.labs.userAgent.browser.isOpera();39 goog.userAgent.IE = goog.labs.userAgent.browser.isIE();40 goog.userAgent.GECKO = goog.labs.userAgent.engine.isGecko();41 goog.userAgent.WEBKIT = goog.labs.userAgent.engine.isWebKit();42 goog.userAgent.MOBILE = goog.userAgent.isMobile_();43 goog.userAgent.SAFARI = goog.userAgent.WEBKIT;44 // Platform in goog.userAgent.45 goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();46 goog.userAgent.initPlatform_();47 goog.userAgent.MAC = goog.userAgent.detectedMac_;48 goog.userAgent.WINDOWS = goog.userAgent.detectedWindows_;49 goog.userAgent.LINUX = goog.userAgent.detectedLinux_;50 goog.userAgent.X11 = goog.userAgent.detectedX11_;51 goog.userAgent.ANDROID = goog.userAgent.detectedAndroid_;52 goog.userAgent.IPAD = goog.userAgent.detectedIPad_;53 goog.userAgent.IPHONE = goog.userAgent.detectedIPhone_;54 goog.userAgent.VERSION = goog.userAgent.determineVersion_();55 // Product.56 goog.userAgent.product.init_();57 goog.userAgent.product.OPERA = goog.userAgent.OPERA;58 goog.userAgent.product.IE = goog.userAgent.IE;59 goog.userAgent.product.FIREFOX = goog.userAgent.product.detectedFirefox_;60 goog.userAgent.product.CAMINO = goog.userAgent.product.detectedCamino_;61 goog.userAgent.product.IPHONE = goog.userAgent.product.detectedIphone_;62 goog.userAgent.product.IPAD = goog.userAgent.product.detectedIpad_;63 goog.userAgent.product.ANDROID = goog.userAgent.product.detectedAndroid_;64 goog.userAgent.product.CHROME = goog.userAgent.product.detectedChrome_;65 goog.userAgent.product.SAFARI = goog.userAgent.product.detectedSafari_;66 goog.userAgent.product.VERSION = goog.userAgent.product.determineVersion_();67 // Platform in goog.userAgent.platform.68 goog.userAgent.platform.VERSION = goog.userAgent.platform.determineVersion_();69 // goog.userAgent.product70 goog.userAgent.product.init_();71 goog.userAgent.product.OPERA = goog.userAgent.OPERA;72 goog.userAgent.product.IE = goog.userAgent.IE;73 goog.userAgent.product.FIREFOX = goog.userAgent.product.detectedFirefox_;74 goog.userAgent.product.CAMINO = goog.userAgent.product.detectedCamino_;75 goog.userAgent.product.IPHONE = goog.userAgent.product.detectedIphone_;76 goog.userAgent.product.IPAD = goog.userAgent.product.detectedIpad_;77 goog.userAgent.product.ANDROID = goog.userAgent.product.detectedAndroid_;78 goog.userAgent.product.CHROME = goog.userAgent.product.detectedChrome_;79 goog.userAgent.product.SAFARI = goog.userAgent.product.detectedSafari_;80 goog.userAgent.product.VERSION = goog.userAgent.product.determineVersion_();81 // goog.userAgent.keyboard82 goog.userAgent.keyboard.MAC_KEYBOARD =83 goog.userAgent.keyboard.determineMacKeyboard_();84};85/**86 * Browser definitions.87 * @enum {string}88 */89goog.userAgentTestUtil.UserAgents = {90 GECKO: 'GECKO',91 IE: 'IE',92 OPERA: 'OPERA',93 WEBKIT: 'WEBKIT'94};95/**96 * Return whether a given user agent has been detected.97 * @param {string} agent Value in UserAgents.98 * @return {boolean} Whether the user agent has been detected.99 */100goog.userAgentTestUtil.getUserAgentDetected = function(agent) {101 switch (agent) {102 case goog.userAgentTestUtil.UserAgents.GECKO:103 return goog.userAgent.GECKO;104 case goog.userAgentTestUtil.UserAgents.IE:105 return goog.userAgent.IE;106 case goog.userAgentTestUtil.UserAgents.OPERA:107 return goog.userAgent.OPERA;108 case goog.userAgentTestUtil.UserAgents.WEBKIT:109 return goog.userAgent.WEBKIT;110 }111 throw Error('Unrecognized user agent');...

Full Screen

Full Screen

product_isversion.js

Source:product_isversion.js Github

copy

Full Screen

1// Copyright 2009 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Functions for understanding the version of the browser.16 * This is pulled out of product.js to ensure that only builds that need17 * this functionality actually get it, without having to rely on the compiler18 * to strip out unneeded pieces.19 *20 * TODO(nnaze): Move to more appropriate filename/namespace.21 *22 */23goog.provide('goog.userAgent.product.isVersion');24goog.require('goog.userAgent.product');25/**26 * @return {string} The string that describes the version number of the user27 * agent product. This is a string rather than a number because it may28 * contain 'b', 'a', and so on.29 * @private30 */31goog.userAgent.product.determineVersion_ = function() {32 // All browsers have different ways to detect the version and they all have33 // different naming schemes.34 if (goog.userAgent.product.FIREFOX) {35 // Firefox/2.0.0.1 or Firefox/3.5.336 return goog.userAgent.product.getFirstRegExpGroup_(/Firefox\/([0-9.]+)/);37 }38 if (goog.userAgent.product.IE || goog.userAgent.product.OPERA) {39 return goog.userAgent.VERSION;40 }41 if (goog.userAgent.product.CHROME) {42 // Chrome/4.0.223.143 return goog.userAgent.product.getFirstRegExpGroup_(/Chrome\/([0-9.]+)/);44 }45 if (goog.userAgent.product.SAFARI) {46 // Version/5.0.347 //48 // NOTE: Before version 3, Safari did not report a product version number.49 // The product version number for these browsers will be the empty string.50 // They may be differentiated by WebKit version number in goog.userAgent.51 return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);52 }53 if (goog.userAgent.product.IPHONE || goog.userAgent.product.IPAD) {54 // Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.155 // (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.356 // Version is the browser version, Mobile is the build number. We combine57 // the version string with the build number: 3.0.3A100a for the example.58 var arr = goog.userAgent.product.execRegExp_(59 /Version\/(\S+).*Mobile\/(\S+)/);60 if (arr) {61 return arr[1] + '.' + arr[2];62 }63 } else if (goog.userAgent.product.ANDROID) {64 // Mozilla/5.0 (Linux; U; Android 0.5; en-us) AppleWebKit/522+65 // (KHTML, like Gecko) Safari/419.366 //67 // Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10+68 // (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.269 //70 // Prefer Version number if present, else make do with the OS number71 var version = goog.userAgent.product.getFirstRegExpGroup_(72 /Android\s+([0-9.]+)/);73 if (version) {74 return version;75 }76 return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);77 } else if (goog.userAgent.product.CAMINO) {78 return goog.userAgent.product.getFirstRegExpGroup_(/Camino\/([0-9.]+)/);79 }80 return '';81};82/**83 * Return the first group of the given regex.84 * @param {!RegExp} re Regular expression with at least one group.85 * @return {string} Contents of the first group or an empty string if no match.86 * @private87 */88goog.userAgent.product.getFirstRegExpGroup_ = function(re) {89 var arr = goog.userAgent.product.execRegExp_(re);90 return arr ? arr[1] : '';91};92/**93 * Run regexp's exec() on the userAgent string.94 * @param {!RegExp} re Regular expression.95 * @return {Array} A result array, or null for no match.96 * @private97 */98goog.userAgent.product.execRegExp_ = function(re) {99 return re.exec(goog.userAgent.getUserAgentString());100};101/**102 * The version of the user agent. This is a string because it might contain103 * 'b' (as in beta) as well as multiple dots.104 * @type {string}105 */106goog.userAgent.product.VERSION = goog.userAgent.product.determineVersion_();107/**108 * Whether the user agent product version is higher or the same as the given109 * version.110 *111 * @param {string|number} version The version to check.112 * @return {boolean} Whether the user agent product version is higher or the113 * same as the given version.114 */115goog.userAgent.product.isVersion = function(version) {116 return goog.string.compareVersions(117 goog.userAgent.product.VERSION, version) >= 0;...

Full Screen

Full Screen

flash.js

Source:flash.js Github

copy

Full Screen

1// Copyright 2006 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Flash detection.16 * @see ../demos/useragent.html17 */18goog.provide('goog.userAgent.flash');19goog.require('goog.string');20/**21 * @define {boolean} Whether we know at compile-time that the browser doesn't22 * have flash.23 */24goog.userAgent.flash.ASSUME_NO_FLASH = false;25/**26 * Whether we can detect that the browser has flash27 * @type {boolean}28 * @private29 */30goog.userAgent.flash.detectedFlash_ = false;31/**32 * Full version information of flash installed, in form 7.0.6133 * @type {string}34 * @private35 */36goog.userAgent.flash.detectedFlashVersion_ = '';37/**38 * Initializer for goog.userAgent.flash39 *40 * This is a named function so that it can be stripped via the jscompiler if41 * goog.userAgent.flash.ASSUME_NO_FLASH is true.42 * @private43 */44goog.userAgent.flash.init_ = function() {45 if (navigator.plugins && navigator.plugins.length) {46 var plugin = navigator.plugins['Shockwave Flash'];47 if (plugin) {48 goog.userAgent.flash.detectedFlash_ = true;49 if (plugin.description) {50 goog.userAgent.flash.detectedFlashVersion_ =51 goog.userAgent.flash.getVersion_(plugin.description);52 }53 }54 if (navigator.plugins['Shockwave Flash 2.0']) {55 goog.userAgent.flash.detectedFlash_ = true;56 goog.userAgent.flash.detectedFlashVersion_ = '2.0.0.11';57 }58 } else if (navigator.mimeTypes && navigator.mimeTypes.length) {59 var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];60 goog.userAgent.flash.detectedFlash_ = mimeType && mimeType.enabledPlugin;61 if (goog.userAgent.flash.detectedFlash_) {62 goog.userAgent.flash.detectedFlashVersion_ =63 goog.userAgent.flash.getVersion_(mimeType.enabledPlugin.description);64 }65 } else {66 /** @preserveTry */67 try {68 // Try 7 first, since we know we can use GetVariable with it69 var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');70 goog.userAgent.flash.detectedFlash_ = true;71 goog.userAgent.flash.detectedFlashVersion_ =72 goog.userAgent.flash.getVersion_(ax.GetVariable('$version'));73 } catch (e) {74 // Try 6 next, some versions are known to crash with GetVariable calls75 /** @preserveTry */76 try {77 var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');78 goog.userAgent.flash.detectedFlash_ = true;79 // First public version of Flash 680 goog.userAgent.flash.detectedFlashVersion_ = '6.0.21';81 } catch (e2) {82 /** @preserveTry */83 try {84 // Try the default activeX85 var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');86 goog.userAgent.flash.detectedFlash_ = true;87 goog.userAgent.flash.detectedFlashVersion_ =88 goog.userAgent.flash.getVersion_(ax.GetVariable('$version'));89 } catch (e3) {90 // No flash91 }92 }93 }94 }95};96/**97 * Derived from Apple's suggested sniffer.98 * @param {string} desc e.g. Shockwave Flash 7.0 r61.99 * @return {string} 7.0.61.100 * @private101 */102goog.userAgent.flash.getVersion_ = function(desc) {103 var matches = desc.match(/[\d]+/g);104 matches.length = 3; // To standardize IE vs FF105 return matches.join('.');106};107if (!goog.userAgent.flash.ASSUME_NO_FLASH) {108 goog.userAgent.flash.init_();109}110/**111 * Whether we can detect that the browser has flash112 * @type {boolean}113 */114goog.userAgent.flash.HAS_FLASH = goog.userAgent.flash.detectedFlash_;115/**116 * Full version information of flash installed, in form 7.0.61117 * @type {string}118 */119goog.userAgent.flash.VERSION = goog.userAgent.flash.detectedFlashVersion_;120/**121 * Whether the installed flash version is as new or newer than a given version.122 * @param {string} version The version to check.123 * @return {boolean} Whether the installed flash version is as new or newer124 * than a given version.125 */126goog.userAgent.flash.isVersion = function(version) {127 return goog.string.compareVersions(goog.userAgent.flash.VERSION,128 version) >= 0;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 await page.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36');6 await page.screenshot({path: 'user-agent.png'});7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.setUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36');6 await page.screenshot({path: 'example.png'});7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext({13 userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36'14 });15 const page = await context.newPage();16 await page.screenshot({path: 'example.png'});17 await browser.close();18})();19const Nightmare = require('nightmare');20const nightmare = Nightmare({ show: true });21 .useragent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36')22 .end()23 .then(console.log)24 .catch(error => {25 console.error('Search failed:', error)26 })27var casper = require('casper').create({28 pageSettings: {29 userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36'30 }31});32 this.capture('example.png');33});34casper.run();35var page = require('webpage').create();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const userAgent = await page.evaluate(() => navigator.userAgent);6 console.log(userAgent);7 await browser.close();8})();9Output: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3844.0 Safari/537.3610Puppeteer’s Page.setUserAgent() method11page.setUserAgent(userAgent)12const puppeteer = require('puppeteer');13(async () => {14 const browser = await puppeteer.launch();15 const page = await browser.newPage();16 await page.setUserAgent('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3844.0 Safari/537.36');17 const userAgent = await page.evaluate(() => navigator.userAgent);18 console.log(userAgent);19 await browser.close();20})();21Output: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3844.0 Safari/537.3622Puppeteer’s Page.emulate() method23page.emulate(options)24const puppeteer = require('puppeteer');25(async () => {26 const browser = await puppeteer.launch();27 const page = await browser.newPage();28 await page.emulate({29 viewport: {30 },31 userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3844.0 Safari

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.screenshot({path: 'example.png'});6 await browser.close();7})();8const puppeteer = require('puppeteer');9(async () => {10 const browser = await puppeteer.launch();11 const page = await browser.newPage();12 await page.screenshot({path: 'example.png'});13 await browser.close();14})();15const puppeteer = require('puppeteer');16(async () => {17 const browser = await puppeteer.launch();18 const page = await browser.newPage();19 await page.screenshot({path: 'example.png'});20 await browser.close();21})();22const puppeteer = require('puppeteer');23(async () => {24 const browser = await puppeteer.launch();25 const page = await browser.newPage();26 await page.screenshot({path: 'example.png'});27 await browser.close();28})();29const puppeteer = require('puppeteer');30(async () => {31 const browser = await puppeteer.launch();32 const page = await browser.newPage();33 await page.screenshot({path: 'example.png'});34 await browser.close();35})();36const puppeteer = require('puppeteer');37(async () => {38 const browser = await puppeteer.launch();39 const page = await browser.newPage();40 await page.screenshot({path: 'example.png'});41 await browser.close();42})();43const puppeteer = require('puppeteer');44(async () => {45 const browser = await puppeteer.launch();46 const page = await browser.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2puppeteer.launch().then(async browser => {3 const page = await browser.newPage();4 const userAgent = await page.evaluate(() => navigator.userAgent);5 console.log(userAgent);6 await browser.close();7});8const puppeteer = require('puppeteer');9puppeteer.launch().then(async browser => {10 const page = await browser.newPage();11 const userAgent = await page.evaluate(() => navigator.userAgent);12 console.log(userAgent);13 await browser.close();14});15const puppeteer = require('puppeteer');16puppeteer.launch().then(async browser => {17 const page = await browser.newPage();18 const userAgent = await page.evaluate(() => navigator.userAgent);19 console.log(userAgent);20 await browser.close();21});22const puppeteer = require('puppeteer');23puppeteer.launch().then(async browser => {24 const page = await browser.newPage();25 const userAgent = await page.evaluate(() => navigator.userAgent);26 console.log(userAgent);27 await browser.close();28});29const puppeteer = require('puppeteer');30puppeteer.launch().then(async browser => {31 const page = await browser.newPage();32 const userAgent = await page.evaluate(() => navigator.userAgent);33 console.log(userAgent);34 await browser.close();35});36const puppeteer = require('puppeteer');37puppeteer.launch().then(async browser => {38 const page = await browser.newPage();39 const userAgent = await page.evaluate(() => navigator.userAgent);40 console.log(userAgent);41 await browser.close();42});43const puppeteer = require('puppeteer');44puppeteer.launch().then(async browser =>

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const userAgent = await page.evaluate(() => navigator.userAgent);6 console.log(userAgent);7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.screenshot({path: 'example.png'});6 await browser.close();7})();8const puppeteer = require('puppeteer');9(async () => {10 const browser = await puppeteer.launch();11 const page = await browser.newPage();12 await page.screenshot({path: 'example.png'});13 await browser.close();14})();15const puppeteer = require('puppeteer');16(async () => {17 const browser = await puppeteer.launch();18 const page = await browser.newPage();19 await page.screenshot({path: 'example.png'});20 await browser.close();21})();22const puppeteer = require('puppeteer');23(async () => {24 const browser = await puppeteer.launch();25 const page = await browser.newPage();26 await page.screenshot({path: 'example.png'});27 await browser.close();28})();29const puppeteer = require('puppeteer');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful