mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 23:29:48 +00:00
2402 lines
1.0 MiB
2402 lines
1.0 MiB
// Do not edit this file; automatically generated by build.py.
|
|
'use strict';
|
|
|
|
var $jscomp=$jscomp||{};$jscomp.scope={};var COMPILED=!0,goog=goog||{};goog.global=this||self;goog.isDef=function(a){return void 0!==a};goog.isString=function(a){return"string"==typeof a};goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};
|
|
goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]&&c[d]!==Object.prototype[d]?c[d]:c[d]={}:c[d]=b};
|
|
goog.define=function(a,b){var c=b;if(!COMPILED){var d=goog.global.CLOSURE_UNCOMPILED_DEFINES,e=goog.global.CLOSURE_DEFINES;d&&void 0===d.nodeType&&Object.prototype.hasOwnProperty.call(d,a)?c=d[a]:e&&void 0===e.nodeType&&Object.prototype.hasOwnProperty.call(e,a)&&(c=e[a])}return c};goog.FEATURESET_YEAR=2012;goog.DEBUG=!1;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1;
|
|
goog.provide=function(a){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');goog.constructNamespace_(a)};goog.constructNamespace_=function(a,b){if(!COMPILED){delete goog.implicitNamespaces_[a];for(var c=a;(c=c.substring(0,c.lastIndexOf(".")))&&!goog.getObjectByName(c);)goog.implicitNamespaces_[c]=!0}goog.exportPath_(a,b)};
|
|
goog.getScriptNonce=function(a){if(a&&a!=goog.global)return goog.getScriptNonce_(a.document);null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document));return goog.cspNonce_};goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/;goog.cspNonce_=null;goog.getScriptNonce_=function(a){return(a=a.querySelector&&a.querySelector("script[nonce]"))&&(a=a.nonce||a.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(a)?a:""};goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
|
|
goog.module=function(a){if("string"!==typeof a||!a||-1==a.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())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.");
|
|
if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)};
|
|
goog.module.getInternal_=function(a){if(!COMPILED){if(a in goog.loadedModules_)return goog.loadedModules_[a].exports;if(!goog.implicitNamespaces_[a])return a=goog.getObjectByName(a),null!=a?a:null}return null};goog.ModuleType={ES6:"es6",GOOG:"goog"};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()};goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG};
|
|
goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var a=goog.global.$jscomp;return a?"function"!=typeof a.getCurrentModulePath?!1:!!a.getCurrentModulePath():!1};
|
|
goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0};
|
|
goog.declareModuleId=function(a){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(a in goog.loadedModules_)throw Error('Module with namespace "'+a+'" already exists.');}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=a;else{var b=goog.global.$jscomp;if(!b||"function"!=typeof b.getCurrentModulePath)throw Error('Module with namespace "'+
|
|
a+'" has been loaded incorrectly.');b=b.require(b.getCurrentModulePath());goog.loadedModules_[a]={exports:b,type:goog.ModuleType.ES6,moduleId:a}}};goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.forwardDeclare=function(a){};COMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&null!=goog.getObjectByName(a)},goog.implicitNamespaces_={"goog.module":!0});
|
|
goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e=0;e<c.length;e++)if(d=d[c[e]],null==d)return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};goog.addDependency=function(a,b,c,d){!COMPILED&&goog.DEPENDENCIES_ENABLED&&goog.debugLoader_.addDependency(a,b,c,d)};goog.ENABLE_DEBUG_LOADER=!0;goog.logToConsole_=function(a){goog.global.console&&goog.global.console.error(a)};
|
|
goog.require=function(a){if(!COMPILED){goog.ENABLE_DEBUG_LOADER&&goog.debugLoader_.requested(a);if(goog.isProvided_(a)){if(goog.isInModuleLoader_())return goog.module.getInternal_(a)}else if(goog.ENABLE_DEBUG_LOADER){var b=goog.moduleLoaderState_;goog.moduleLoaderState_=null;try{goog.debugLoader_.load_(a)}finally{goog.moduleLoaderState_=b}}return null}};goog.requireType=function(a){return{}};goog.basePath="";goog.nullFunction=function(){};
|
|
goog.abstractMethod=function(){throw Error("unimplemented abstract method");};goog.addSingletonGetter=function(a){a.instance_=void 0;a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.LOAD_MODULE_USING_EVAL=!0;goog.SEAL_MODULE_EXPORTS=goog.DEBUG;goog.loadedModules_={};goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;goog.TRANSPILE="detect";
|
|
goog.ASSUME_ES_MODULES_TRANSPILED=!1;goog.TRANSPILE_TO_LANGUAGE="";goog.TRANSPILER="transpile.js";goog.hasBadLetScoping=null;goog.useSafari10Workaround=function(){if(null==goog.hasBadLetScoping){try{var a=!eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";')}catch(b){a=!1}goog.hasBadLetScoping=a}return goog.hasBadLetScoping};goog.workaroundSafari10EvalBug=function(a){return"(function(){"+a+"\n;})();\n"};
|
|
goog.loadModule=function(a){var b=goog.moduleLoaderState_;try{goog.moduleLoaderState_={moduleName:"",declareLegacyNamespace:!1,type:goog.ModuleType.GOOG};if(goog.isFunction(a))var c=a.call(void 0,{});else if("string"===typeof a)goog.useSafari10Workaround()&&(a=goog.workaroundSafari10EvalBug(a)),c=goog.loadModuleFromSource_.call(void 0,a);else throw Error("Invalid module definition");var d=goog.moduleLoaderState_.moduleName;if("string"===typeof d&&d)goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(d,
|
|
c):goog.SEAL_MODULE_EXPORTS&&Object.seal&&"object"==typeof c&&null!=c&&Object.seal(c),goog.loadedModules_[d]={exports:c,type:goog.ModuleType.GOOG,moduleId:goog.moduleLoaderState_.moduleName};else throw Error('Invalid module name "'+d+'"');}finally{goog.moduleLoaderState_=b}};goog.loadModuleFromSource_=function(a){eval(a);return{}};goog.normalizePath_=function(a){a=a.split("/");for(var b=0;b<a.length;)"."==a[b]?a.splice(b,1):b&&".."==a[b]&&a[b-1]&&".."!=a[b-1]?a.splice(--b,2):b++;return a.join("/")};
|
|
goog.loadFileSync_=function(a){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(a);try{var b=new goog.global.XMLHttpRequest;b.open("get",a,!1);b.send();return 0==b.status||200==b.status?b.responseText:null}catch(c){return null}};
|
|
goog.transpile_=function(a,b,c){var d=goog.global.$jscomp;d||(goog.global.$jscomp=d={});var e=d.transpile;if(!e){var f=goog.basePath+goog.TRANSPILER,g=goog.loadFileSync_(f);if(g){(function(){(0,eval)(g+"\n//# sourceURL="+f)}).call(goog.global);if(goog.global.$gwtExport&&goog.global.$gwtExport.$jscomp&&!goog.global.$gwtExport.$jscomp.transpile)throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: '+JSON.stringify(goog.global.$gwtExport));goog.global.$jscomp.transpile=
|
|
goog.global.$gwtExport.$jscomp.transpile;d=goog.global.$jscomp;e=d.transpile}}e||(e=d.transpile=function(a,b){goog.logToConsole_(b+" requires transpilation but no transpiler was found.");return a});return e(a,b,c)};
|
|
goog.typeOf=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
|
|
else if("function"==b&&"undefined"==typeof a.call)return"object";return b};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isFunction=function(a){return"function"==goog.typeOf(a)};
|
|
goog.isObject=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.hasUid=function(a){return!!a[goog.UID_PROPERTY_]};goog.removeUid=function(a){null!==a&&"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};goog.UID_PROPERTY_="closure_uid_"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;
|
|
goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if("function"===typeof a.clone)return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};
|
|
goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};
|
|
goog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};
|
|
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval){if(null==goog.evalWorksForGlobals_){try{goog.global.eval("var _evalTest_ = 1;")}catch(d){}if("undefined"!=typeof goog.global._evalTest_){try{delete goog.global._evalTest_}catch(d){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1}if(goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=
|
|
!1;c.appendChild(b.createTextNode(a));b.head.appendChild(c);b.head.removeChild(c)}}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;
|
|
goog.getCssName=function(a,b){if("."==String(a).charAt(0))throw Error('className passed in goog.getCssName must not start with ".". You passed: '+a);var c=function(a){return goog.cssNameMapping_[a]||a},d=function(a){a=a.split("-");for(var b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join("-")};d=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:d:function(a){return a};d=b?a+"-"+d(b):d(a);return goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(d):d};
|
|
goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b,c){c&&c.html&&(a=a.replace(/</g,"<"));b&&(a=a.replace(/\{\$([^}]+)}/g,function(a,c){return null!=b&&c in b?b[c]:a}));return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};
|
|
goog.exportProperty=function(a,b,c){a[b]=c};goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.base=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};
|
|
goog.base=function(a,b,c){var d=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!d)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");if("undefined"!==typeof d.superClass_){for(var e=Array(arguments.length-1),f=1;f<arguments.length;f++)e[f-1]=arguments[f];return d.superClass_.constructor.apply(a,e)}if("string"!=typeof b&&"symbol"!=typeof b)throw Error("method names provided to goog.base must be a string or a symbol");
|
|
e=Array(arguments.length-2);for(f=2;f<arguments.length;f++)e[f-2]=arguments[f];f=!1;for(var g=a.constructor.prototype;g;g=Object.getPrototypeOf(g))if(g[b]===d)f=!0;else if(f)return g[b].apply(a,e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error("goog.base called from a method of one name to a method of a different name");};goog.scope=function(a){if(goog.isInModuleLoader_())throw Error("goog.scope is not supported within a module.");a.call(goog.global)};
|
|
COMPILED||(goog.global.COMPILED=COMPILED);goog.defineClass=function(a,b){var c=b.constructor,d=b.statics;c&&c!=Object.prototype.constructor||(c=function(){throw Error("cannot instantiate an interface (no constructor defined).");});c=goog.defineClass.createSealingConstructor_(c,a);a&&goog.inherits(c,a);delete b.constructor;delete b.statics;goog.defineClass.applyProperties_(c.prototype,b);null!=d&&(d instanceof Function?d(c):goog.defineClass.applyProperties_(c,d));return c};
|
|
goog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG;goog.defineClass.createSealingConstructor_=function(a,b){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return a;var c=!goog.defineClass.isUnsealable_(b),d=function(){var b=a.apply(this,arguments)||this;b[goog.UID_PROPERTY_]=b[goog.UID_PROPERTY_];this.constructor===d&&c&&Object.seal instanceof Function&&Object.seal(b);return b};return d};goog.defineClass.isUnsealable_=function(a){return a&&a.prototype&&a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]};
|
|
goog.defineClass.OBJECT_PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");goog.defineClass.applyProperties_=function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c]);for(var d=0;d<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;d++)c=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d],Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])};
|
|
goog.tagUnsealableClass=function(a){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)};goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable";
|
|
!COMPILED&&goog.DEPENDENCIES_ENABLED&&(goog.inHtmlDocument_=function(){var a=goog.global.document;return null!=a&&"write"in a},goog.isDocumentLoading_=function(){var a=goog.global.document;return a.attachEvent?"complete"!=a.readyState:"loading"==a.readyState},goog.findBasePath_=function(){if(void 0!=goog.global.CLOSURE_BASE_PATH&&"string"===typeof goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_()){var a=goog.global.document,b=a.currentScript;
|
|
a=b?[b]:a.getElementsByTagName("SCRIPT");for(b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?");d=-1==d?c.length:d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}}},goog.findBasePath_(),goog.Transpiler=function(){this.requiresTranspilation_=null;this.transpilationTarget_=goog.TRANSPILE_TO_LANGUAGE},goog.Transpiler.prototype.createRequiresTranspilation_=function(){function a(a,b){e?d[a]=!0:b()?(c=a,d[a]=!1):e=d[a]=!0}function b(a){try{return!!eval(a)}catch(h){return!1}}
|
|
var c="es3",d={es3:!1},e=!1,f=goog.global.navigator&&goog.global.navigator.userAgent?goog.global.navigator.userAgent:"";a("es5",function(){return b("[1,].length==1")});a("es6",function(){return f.match(/Edge\/(\d+)(\.\d)*/i)?!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}})()')});
|
|
a("es7",function(){return b("2 ** 2 == 4")});a("es8",function(){return b("async () => 1, true")});a("es9",function(){return b("({...rest} = {}), true")});a("es_next",function(){return!1});return{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(a,b){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var c=this.createRequiresTranspilation_();this.requiresTranspilation_=c.map;this.transpilationTarget_=this.transpilationTarget_||
|
|
c.target}if(a in this.requiresTranspilation_)return this.requiresTranspilation_[a]?!0:!goog.inHtmlDocument_()||"es6"!=b||"noModule"in goog.global.document.createElement("script")?!1:!0;throw Error("Unknown language mode: "+a);},goog.Transpiler.prototype.transpile=function(a,b){return goog.transpile_(a,b,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(a){return a.replace(/<\/(SCRIPT)/ig,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={};
|
|
this.idToPath_={};this.written_={};this.loadingDeps_=[];this.depsToLoad_=[];this.paused_=!1;this.factory_=new goog.DependencyFactory(goog.transpiler_);this.deferredCallbacks_={};this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(a,b){function c(){d&&(goog.global.setTimeout(d,0),d=null)}var d=b;if(a.length){for(var e=[],f=0;f<a.length;f++){var g=this.getPathFromDeps_(a[f]);if(!g)throw Error("Unregonized namespace: "+a[f]);e.push(this.dependencies_[g])}g=goog.require;var h=0;for(f=
|
|
0;f<a.length;f++)g(a[f]),e[f].onLoad(function(){++h==a.length&&c()})}else c()},goog.DebugLoader_.prototype.loadClosureDeps=function(){this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath+"deps.js"),"deps.js",[],[],{},!1));this.loadDeps_()},goog.DebugLoader_.prototype.requested=function(a,b){var c=this.getPathFromDeps_(a);if(c&&(b||this.areDepsLoaded_(this.dependencies_[c].requires))){var d=this.deferredCallbacks_[c];d&&(delete this.deferredCallbacks_[c],d())}},goog.DebugLoader_.prototype.setDependencyFactory=
|
|
function(a){this.factory_=a},goog.DebugLoader_.prototype.load_=function(a){if(this.getPathFromDeps_(a)){var b=this,c=[],d=function(a){var e=b.getPathFromDeps_(a);if(!e)throw Error("Bad dependency path or symbol: "+a);if(!b.written_[e]){b.written_[e]=!0;a=b.dependencies_[e];for(e=0;e<a.requires.length;e++)goog.isProvided_(a.requires[e])||d(a.requires[e]);c.push(a)}};d(a);a=!!this.depsToLoad_.length;this.depsToLoad_=this.depsToLoad_.concat(c);this.paused_||a||this.loadDeps_()}else throw a="goog.require could not find: "+
|
|
a,goog.logToConsole_(a),Error(a);},goog.DebugLoader_.prototype.loadDeps_=function(){for(var a=this,b=this.paused_;this.depsToLoad_.length&&!b;)(function(){var c=!1,d=a.depsToLoad_.shift(),e=!1;a.loading_(d);var f={pause:function(){if(c)throw Error("Cannot call pause after the call to load.");b=!0},resume:function(){c?a.resume_():b=!1},loaded:function(){if(e)throw Error("Double call to loaded.");e=!0;a.loaded_(d)},pending:function(){for(var b=[],c=0;c<a.loadingDeps_.length;c++)b.push(a.loadingDeps_[c]);
|
|
return b},setModuleState:function(a){goog.moduleLoaderState_={type:a,moduleName:"",declareLegacyNamespace:!1}},registerEs6ModuleExports:function(a,b,c){c&&(goog.loadedModules_[c]={exports:b,type:goog.ModuleType.ES6,moduleId:c||""})},registerGoogModuleExports:function(a,b){goog.loadedModules_[a]={exports:b,type:goog.ModuleType.GOOG,moduleId:a}},clearModuleState:function(){goog.moduleLoaderState_=null},defer:function(b){if(c)throw Error("Cannot register with defer after the call to load.");a.defer_(d,
|
|
b)},areDepsLoaded:function(){return a.areDepsLoaded_(d.requires)}};try{d.load(f)}finally{c=!0}})();b&&this.pause_()},goog.DebugLoader_.prototype.pause_=function(){this.paused_=!0},goog.DebugLoader_.prototype.resume_=function(){this.paused_&&(this.paused_=!1,this.loadDeps_())},goog.DebugLoader_.prototype.loading_=function(a){this.loadingDeps_.push(a)},goog.DebugLoader_.prototype.loaded_=function(a){for(var b=0;b<this.loadingDeps_.length;b++)if(this.loadingDeps_[b]==a){this.loadingDeps_.splice(b,1);
|
|
break}for(b=0;b<this.deferredQueue_.length;b++)if(this.deferredQueue_[b]==a.path){this.deferredQueue_.splice(b,1);break}if(this.loadingDeps_.length==this.deferredQueue_.length&&!this.depsToLoad_.length)for(;this.deferredQueue_.length;)this.requested(this.deferredQueue_.shift(),!0);a.loaded()},goog.DebugLoader_.prototype.areDepsLoaded_=function(a){for(var b=0;b<a.length;b++){var c=this.getPathFromDeps_(a[b]);if(!c||!(c in this.deferredCallbacks_||goog.isProvided_(a[b])))return!1}return!0},goog.DebugLoader_.prototype.getPathFromDeps_=
|
|
function(a){return a in this.idToPath_?this.idToPath_[a]:a in this.dependencies_?a:null},goog.DebugLoader_.prototype.defer_=function(a,b){this.deferredCallbacks_[a.path]=b;this.deferredQueue_.push(a.path)},goog.LoadController=function(){},goog.LoadController.prototype.pause=function(){},goog.LoadController.prototype.resume=function(){},goog.LoadController.prototype.loaded=function(){},goog.LoadController.prototype.pending=function(){},goog.LoadController.prototype.registerEs6ModuleExports=function(a,
|
|
b,c){},goog.LoadController.prototype.setModuleState=function(a){},goog.LoadController.prototype.clearModuleState=function(){},goog.LoadController.prototype.defer=function(a){},goog.LoadController.prototype.areDepsLoaded=function(){},goog.Dependency=function(a,b,c,d,e){this.path=a;this.relativePath=b;this.provides=c;this.requires=d;this.loadFlags=e;this.loaded_=!1;this.loadCallbacks_=[]},goog.Dependency.prototype.getPathName=function(){var a=this.path,b=a.indexOf("://");0<=b&&(a=a.substring(b+3),b=
|
|
a.indexOf("/"),0<=b&&(a=a.substring(b+1)));return a},goog.Dependency.prototype.onLoad=function(a){this.loaded_?a():this.loadCallbacks_.push(a)},goog.Dependency.prototype.loaded=function(){this.loaded_=!0;var a=this.loadCallbacks_;this.loadCallbacks_=[];for(var b=0;b<a.length;b++)a[b]()},goog.Dependency.defer_=!1,goog.Dependency.callbackMap_={},goog.Dependency.registerCallback_=function(a){var b=Math.random().toString(32);goog.Dependency.callbackMap_[b]=a;return b},goog.Dependency.unregisterCallback_=
|
|
function(a){delete goog.Dependency.callbackMap_[a]},goog.Dependency.callback_=function(a,b){if(a in goog.Dependency.callbackMap_){for(var c=goog.Dependency.callbackMap_[a],d=[],e=1;e<arguments.length;e++)d.push(arguments[e]);c.apply(void 0,d)}else throw Error("Callback key "+a+" does not exist (was base.js loaded more than once?).");},goog.Dependency.prototype.load=function(a){if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?a.loaded():a.pause();else if(goog.inHtmlDocument_()){var b=
|
|
goog.global.document;if("complete"==b.readyState&&!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING){if(/\bdeps.js$/.test(this.path)){a.loaded();return}throw Error('Cannot write "'+this.path+'" after document load');}if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&goog.isDocumentLoading_()){var c=goog.Dependency.registerCallback_(function(b){goog.DebugLoader_.IS_OLD_IE_&&"complete"!=b.readyState||(goog.Dependency.unregisterCallback_(c),a.loaded())}),d=!goog.DebugLoader_.IS_OLD_IE_&&goog.getScriptNonce()?
|
|
' nonce="'+goog.getScriptNonce()+'"':"";d='<script src="'+this.path+'" '+(goog.DebugLoader_.IS_OLD_IE_?"onreadystatechange":"onload")+"=\"goog.Dependency.callback_('"+c+'\', this)" type="text/javascript" '+(goog.Dependency.defer_?"defer":"")+d+">\x3c/script>";b.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}else{var e=b.createElement("script");e.defer=goog.Dependency.defer_;e.async=!1;e.type="text/javascript";(d=goog.getScriptNonce())&&e.setAttribute("nonce",d);goog.DebugLoader_.IS_OLD_IE_?
|
|
(a.pause(),e.onreadystatechange=function(){if("loaded"==e.readyState||"complete"==e.readyState)a.loaded(),a.resume()}):e.onload=function(){e.onload=null;a.loaded()};e.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path;b.head.appendChild(e)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."),
|
|
a.loaded()):a.pause()},goog.Es6ModuleDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(a){function b(a,b){var c=b?'<script type="module" crossorigin>'+b+"\x3c/script>":'<script type="module" crossorigin src="'+a+'">\x3c/script>';d.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(c):c)}function c(a,b){var c=d.createElement("script");c.defer=!0;c.async=!1;
|
|
c.type="module";c.setAttribute("crossorigin",!0);var e=goog.getScriptNonce();e&&c.setAttribute("nonce",e);b?c.textContent=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScript(b):b:c.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(a):a;d.head.appendChild(c)}if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?a.loaded():a.pause();else if(goog.inHtmlDocument_()){var d=goog.global.document,e=this;if(goog.isDocumentLoading_()){var f=
|
|
b;goog.Dependency.defer_=!0}else f=c;var g=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(g);a.setModuleState(goog.ModuleType.ES6)});f(void 0,'goog.Dependency.callback_("'+g+'")');f(this.path,void 0);var h=goog.Dependency.registerCallback_(function(b){goog.Dependency.unregisterCallback_(h);a.registerEs6ModuleExports(e.path,b,goog.moduleLoaderState_.moduleName)});f(void 0,'import * as m from "'+this.path+'"; goog.Dependency.callback_("'+h+'", m)');var k=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(k);
|
|
a.clearModuleState();a.loaded()});f(void 0,'goog.Dependency.callback_("'+k+'")')}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),a.pause()},goog.TransformedDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e);this.contents_=null;this.lazyFetch_=!goog.inHtmlDocument_()||!("noModule"in goog.global.document.createElement("script"))},goog.inherits(goog.TransformedDependency,goog.Dependency),goog.TransformedDependency.prototype.load=function(a){function b(){e.contents_=
|
|
goog.loadFileSync_(e.path);e.contents_&&(e.contents_=e.transform(e.contents_),e.contents_&&(e.contents_+="\n//# sourceURL="+e.path))}function c(){e.lazyFetch_&&b();if(e.contents_){f&&a.setModuleState(goog.ModuleType.ES6);try{var c=e.contents_;e.contents_=null;goog.globalEval(c);if(f)var d=goog.moduleLoaderState_.moduleName}finally{f&&a.clearModuleState()}f&&goog.global.$jscomp.require.ensure([e.getPathName()],function(){a.registerEs6ModuleExports(e.path,goog.global.$jscomp.require(e.getPathName()),
|
|
d)});a.loaded()}}function d(){var a=goog.global.document,b=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(b);c()}),d='<script type="text/javascript">'+goog.protectScriptTag_('goog.Dependency.callback_("'+b+'");')+"\x3c/script>";a.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}var e=this;if(goog.global.CLOSURE_IMPORT_SCRIPT)b(),this.contents_&&goog.global.CLOSURE_IMPORT_SCRIPT("",this.contents_)?(this.contents_=null,a.loaded()):a.pause();
|
|
else{var f=this.loadFlags.module==goog.ModuleType.ES6;this.lazyFetch_||b();var g=1<a.pending().length,h=g&&goog.DebugLoader_.IS_OLD_IE_;g=goog.Dependency.defer_&&(g||goog.isDocumentLoading_());if(h||g)a.defer(function(){c()});else{var k=goog.global.document;h=goog.inHtmlDocument_()&&"ActiveXObject"in goog.global;if(f&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()&&!h){goog.Dependency.defer_=!0;a.pause();var l=k.onreadystatechange;k.onreadystatechange=function(){"interactive"==k.readyState&&(k.onreadystatechange=
|
|
l,c(),a.resume());goog.isFunction(l)&&l.apply(void 0,arguments)}}else!goog.DebugLoader_.IS_OLD_IE_&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()?d():c()}}},goog.TransformedDependency.prototype.transform=function(a){},goog.TranspiledDependency=function(a,b,c,d,e,f){goog.TransformedDependency.call(this,a,b,c,d,e);this.transpiler=f},goog.inherits(goog.TranspiledDependency,goog.TransformedDependency),goog.TranspiledDependency.prototype.transform=function(a){return this.transpiler.transpile(a,this.getPathName())},
|
|
goog.PreTranspiledEs6ModuleDependency=function(a,b,c,d,e){goog.TransformedDependency.call(this,a,b,c,d,e)},goog.inherits(goog.PreTranspiledEs6ModuleDependency,goog.TransformedDependency),goog.PreTranspiledEs6ModuleDependency.prototype.transform=function(a){return a},goog.GoogModuleDependency=function(a,b,c,d,e,f,g){goog.TransformedDependency.call(this,a,b,c,d,e);this.needsTranspile_=f;this.transpiler_=g},goog.inherits(goog.GoogModuleDependency,goog.TransformedDependency),goog.GoogModuleDependency.prototype.transform=
|
|
function(a){this.needsTranspile_&&(a=this.transpiler_.transpile(a,this.getPathName()));return goog.LOAD_MODULE_USING_EVAL&&void 0!==goog.global.JSON?"goog.loadModule("+goog.global.JSON.stringify(a+"\n//# sourceURL="+this.path+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+a+"\n;return exports});\n//# sourceURL="+this.path+"\n"},goog.DebugLoader_.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.DebugLoader_.prototype.addDependency=function(a,b,c,
|
|
d){b=b||[];a=a.replace(/\\/g,"/");var e=goog.normalizePath_(goog.basePath+a);d&&"boolean"!==typeof d||(d=d?{module:goog.ModuleType.GOOG}:{});c=this.factory_.createDependency(e,a,b,c,d,goog.transpiler_.needsTranspile(d.lang||"es3",d.module));this.dependencies_[e]=c;for(c=0;c<b.length;c++)this.idToPath_[b[c]]=e;this.idToPath_[a]=e},goog.DependencyFactory=function(a){this.transpiler=a},goog.DependencyFactory.prototype.createDependency=function(a,b,c,d,e,f){return e.module==goog.ModuleType.GOOG?new goog.GoogModuleDependency(a,
|
|
b,c,d,e,f,this.transpiler):f?new goog.TranspiledDependency(a,b,c,d,e,this.transpiler):e.module==goog.ModuleType.ES6?"never"==goog.TRANSPILE&&goog.ASSUME_ES_MODULES_TRANSPILED?new goog.PreTranspiledEs6ModuleDependency(a,b,c,d,e):new goog.Es6ModuleDependency(a,b,c,d,e):new goog.Dependency(a,b,c,d,e)},goog.debugLoader_=new goog.DebugLoader_,goog.loadClosureDeps=function(){goog.debugLoader_.loadClosureDeps()},goog.setDependencyFactory=function(a){goog.debugLoader_.setDependencyFactory(a)},goog.global.CLOSURE_NO_DEPS||
|
|
goog.debugLoader_.loadClosureDeps(),goog.bootstrap=function(a,b){goog.debugLoader_.bootstrap(a,b)});goog.TRUSTED_TYPES_POLICY_NAME="";goog.identity_=function(a){return a};goog.createTrustedTypesPolicy=function(a){var b=null,c=goog.global.trustedTypes||goog.global.TrustedTypes;if(!c||!c.createPolicy)return b;try{b=c.createPolicy(a,{createHTML:goog.identity_,createScript:goog.identity_,createScriptURL:goog.identity_,createURL:goog.identity_})}catch(d){goog.logToConsole_(d.message)}return b};
|
|
goog.TRUSTED_TYPES_POLICY_=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#base"):null;goog.debug={};goog.debug.Error=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a));this.reportErrorToServer=!0};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.dom={};goog.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};goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){goog.debug.Error.call(this,goog.asserts.subs_(a,b));this.messagePattern=a};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.DEFAULT_ERROR_HANDLER=function(a){throw a;};goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER;
|
|
goog.asserts.subs_=function(a,b){for(var c=a.split("%s"),d="",e=c.length-1,f=0;f<e;f++)d+=c[f]+(f<b.length?b[f]:"%s");return d+c[e]};goog.asserts.doAssertFailure_=function(a,b,c,d){var e="Assertion failed";if(c){e+=": "+c;var f=d}else a&&(e+=": "+a,f=b);a=new goog.asserts.AssertionError(""+e,f||[]);goog.asserts.errorHandler_(a)};goog.asserts.setErrorHandler=function(a){goog.asserts.ENABLE_ASSERTS&&(goog.asserts.errorHandler_=a)};
|
|
goog.asserts.assert=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!a&&goog.asserts.doAssertFailure_("",null,b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertExists=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&null==a&&goog.asserts.doAssertFailure_("Expected to exist: %s.",[a],b,Array.prototype.slice.call(arguments,2));return a};
|
|
goog.asserts.fail=function(a,b){goog.asserts.ENABLE_ASSERTS&&goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1)))};goog.asserts.assertNumber=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&"number"!==typeof a&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
|
|
goog.asserts.assertString=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&"string"!==typeof a&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertFunction=function(a,b,c){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));return a};
|
|
goog.asserts.assertObject=function(a,b,c){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));return a};goog.asserts.assertArray=function(a,b,c){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));return a};
|
|
goog.asserts.assertBoolean=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&"boolean"!==typeof a&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertElement=function(a,b,c){!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));return a};
|
|
goog.asserts.assertInstanceof=function(a,b,c,d){!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));return a};goog.asserts.assertFinite=function(a,b,c){!goog.asserts.ENABLE_ASSERTS||"number"==typeof a&&isFinite(a)||goog.asserts.doAssertFailure_("Expected %s to be a finite number but it is not.",[a],b,Array.prototype.slice.call(arguments,2));return a};
|
|
goog.asserts.assertObjectPrototypeIsIntact=function(){for(var a in Object.prototype)goog.asserts.fail(a+" should not be enumerable in Object.prototype.")};goog.asserts.getType_=function(a){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};goog.debug.entryPointRegistry={};goog.debug.EntryPointMonitor=function(){};goog.debug.entryPointRegistry.refList_=[];goog.debug.entryPointRegistry.monitors_=[];goog.debug.entryPointRegistry.monitorsMayExist_=!1;goog.debug.entryPointRegistry.register=function(a){goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length]=a;if(goog.debug.entryPointRegistry.monitorsMayExist_)for(var b=goog.debug.entryPointRegistry.monitors_,c=0;c<b.length;c++)a(goog.bind(b[c].wrap,b[c]))};
|
|
goog.debug.entryPointRegistry.monitorAll=function(a){goog.debug.entryPointRegistry.monitorsMayExist_=!0;for(var b=goog.bind(a.wrap,a),c=0;c<goog.debug.entryPointRegistry.refList_.length;c++)goog.debug.entryPointRegistry.refList_[c](b);goog.debug.entryPointRegistry.monitors_.push(a)};
|
|
goog.debug.entryPointRegistry.unmonitorAllIfPossible=function(a){var b=goog.debug.entryPointRegistry.monitors_;goog.asserts.assert(a==b[b.length-1],"Only the most recent monitor can be unwrapped.");a=goog.bind(a.unwrap,a);for(var c=0;c<goog.debug.entryPointRegistry.refList_.length;c++)goog.debug.entryPointRegistry.refList_[c](a);b.length--};goog.array={};goog.NATIVE_ARRAY_PROTOTYPES=goog.TRUSTED_SITE;goog.array.ASSUME_NATIVE_FUNCTIONS=2012<goog.FEATURESET_YEAR;goog.array.peek=function(a){return a[a.length-1]};goog.array.last=goog.array.peek;
|
|
goog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.indexOf)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if("string"===typeof a)return"string"!==typeof b||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};
|
|
goog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.lastIndexOf)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.lastIndexOf.call(a,b,null==c?a.length-1:c)}:function(a,b,c){c=null==c?a.length-1:c;0>c&&(c=Math.max(0,a.length+c));if("string"===typeof a)return"string"!==typeof b||1!=b.length?-1:a.lastIndexOf(b,c);for(;0<=c;c--)if(c in a&&a[c]===b)return c;return-1};
|
|
goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(a,b,c){goog.asserts.assert(null!=a.length);Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)};goog.array.forEachRight=function(a,b,c){var d=a.length,e="string"===typeof a?a.split(""):a;for(--d;0<=d;--d)d in e&&b.call(c,e[d],d,a)};
|
|
goog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.filter)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g="string"===typeof a?a.split(""):a,h=0;h<d;h++)if(h in g){var k=g[h];b.call(c,k,h,a)&&(e[f++]=k)}return e};
|
|
goog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.map)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f="string"===typeof a?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e};
|
|
goog.array.reduce=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduce)?function(a,b,c,d){goog.asserts.assert(null!=a.length);d&&(b=goog.bind(b,d));return Array.prototype.reduce.call(a,b,c)}:function(a,b,c,d){var e=c;goog.array.forEach(a,function(c,g){e=b.call(d,e,c,g,a)});return e};
|
|
goog.array.reduceRight=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduceRight)?function(a,b,c,d){goog.asserts.assert(null!=a.length);goog.asserts.assert(null!=b);d&&(b=goog.bind(b,d));return Array.prototype.reduceRight.call(a,b,c)}:function(a,b,c,d){var e=c;goog.array.forEachRight(a,function(c,g){e=b.call(d,e,c,g,a)});return e};
|
|
goog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.some)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return!0;return!1};
|
|
goog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.every)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};goog.array.count=function(a,b,c){var d=0;goog.array.forEach(a,function(a,f,g){b.call(c,a,f,g)&&++d},c);return d};
|
|
goog.array.find=function(a,b,c){b=goog.array.findIndex(a,b,c);return 0>b?null:"string"===typeof a?a.charAt(b):a[b]};goog.array.findIndex=function(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1};goog.array.findRight=function(a,b,c){b=goog.array.findIndexRight(a,b,c);return 0>b?null:"string"===typeof a?a.charAt(b):a[b]};
|
|
goog.array.findIndexRight=function(a,b,c){var d=a.length,e="string"===typeof a?a.split(""):a;for(--d;0<=d;d--)if(d in e&&b.call(c,e[d],d,a))return d;return-1};goog.array.contains=function(a,b){return 0<=goog.array.indexOf(a,b)};goog.array.isEmpty=function(a){return 0==a.length};goog.array.clear=function(a){if(!goog.isArray(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0};goog.array.insert=function(a,b){goog.array.contains(a,b)||a.push(b)};
|
|
goog.array.insertAt=function(a,b,c){goog.array.splice(a,c,0,b)};goog.array.insertArrayAt=function(a,b,c){goog.partial(goog.array.splice,a,c,0).apply(null,b)};goog.array.insertBefore=function(a,b,c){var d;2==arguments.length||0>(d=goog.array.indexOf(a,c))?a.push(b):goog.array.insertAt(a,b,d)};goog.array.remove=function(a,b){var c=goog.array.indexOf(a,b),d;(d=0<=c)&&goog.array.removeAt(a,c);return d};
|
|
goog.array.removeLast=function(a,b){var c=goog.array.lastIndexOf(a,b);return 0<=c?(goog.array.removeAt(a,c),!0):!1};goog.array.removeAt=function(a,b){goog.asserts.assert(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length};goog.array.removeIf=function(a,b,c){b=goog.array.findIndex(a,b,c);return 0<=b?(goog.array.removeAt(a,b),!0):!1};goog.array.removeAllIf=function(a,b,c){var d=0;goog.array.forEachRight(a,function(e,f){b.call(c,e,f,a)&&goog.array.removeAt(a,f)&&d++});return d};
|
|
goog.array.concat=function(a){return Array.prototype.concat.apply([],arguments)};goog.array.join=function(a){return Array.prototype.concat.apply([],arguments)};goog.array.toArray=function(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]};goog.array.clone=goog.array.toArray;goog.array.extend=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(goog.isArrayLike(d)){var e=a.length||0,f=d.length||0;a.length=e+f;for(var g=0;g<f;g++)a[e+g]=d[g]}else a.push(d)}};
|
|
goog.array.splice=function(a,b,c,d){goog.asserts.assert(null!=a.length);return Array.prototype.splice.apply(a,goog.array.slice(arguments,1))};goog.array.slice=function(a,b,c){goog.asserts.assert(null!=a.length);return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};
|
|
goog.array.removeDuplicates=function(a,b,c){b=b||a;var d=function(a){return goog.isObject(a)?"o"+goog.getUid(a):(typeof a).charAt(0)+a};c=c||d;d={};for(var e=0,f=0;f<a.length;){var g=a[f++],h=c(g);Object.prototype.hasOwnProperty.call(d,h)||(d[h]=!0,b[e++]=g)}b.length=e};goog.array.binarySearch=function(a,b,c){return goog.array.binarySearch_(a,c||goog.array.defaultCompare,!1,b)};goog.array.binarySelect=function(a,b,c){return goog.array.binarySearch_(a,b,!0,void 0,c)};
|
|
goog.array.binarySearch_=function(a,b,c,d,e){for(var f=0,g=a.length,h;f<g;){var k=f+(g-f>>>1);var l=c?b.call(e,a[k],k,a):b(d,a[k]);0<l?f=k+1:(g=k,h=!l)}return h?f:-f-1};goog.array.sort=function(a,b){a.sort(b||goog.array.defaultCompare)};goog.array.stableSort=function(a,b){for(var c=Array(a.length),d=0;d<a.length;d++)c[d]={index:d,value:a[d]};var e=b||goog.array.defaultCompare;goog.array.sort(c,function(a,b){return e(a.value,b.value)||a.index-b.index});for(d=0;d<a.length;d++)a[d]=c[d].value};
|
|
goog.array.sortByKey=function(a,b,c){var d=c||goog.array.defaultCompare;goog.array.sort(a,function(a,c){return d(b(a),b(c))})};goog.array.sortObjectsByKey=function(a,b,c){goog.array.sortByKey(a,function(a){return a[b]},c)};goog.array.isSorted=function(a,b,c){b=b||goog.array.defaultCompare;for(var d=1;d<a.length;d++){var e=b(a[d-1],a[d]);if(0<e||0==e&&c)return!1}return!0};
|
|
goog.array.equals=function(a,b,c){if(!goog.isArrayLike(a)||!goog.isArrayLike(b)||a.length!=b.length)return!1;var d=a.length;c=c||goog.array.defaultCompareEquality;for(var e=0;e<d;e++)if(!c(a[e],b[e]))return!1;return!0};goog.array.compare3=function(a,b,c){c=c||goog.array.defaultCompare;for(var d=Math.min(a.length,b.length),e=0;e<d;e++){var f=c(a[e],b[e]);if(0!=f)return f}return goog.array.defaultCompare(a.length,b.length)};goog.array.defaultCompare=function(a,b){return a>b?1:a<b?-1:0};
|
|
goog.array.inverseDefaultCompare=function(a,b){return-goog.array.defaultCompare(a,b)};goog.array.defaultCompareEquality=function(a,b){return a===b};goog.array.binaryInsert=function(a,b,c){c=goog.array.binarySearch(a,b,c);return 0>c?(goog.array.insertAt(a,b,-(c+1)),!0):!1};goog.array.binaryRemove=function(a,b,c){b=goog.array.binarySearch(a,b,c);return 0<=b?goog.array.removeAt(a,b):!1};
|
|
goog.array.bucket=function(a,b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],g=b.call(c,f,e,a);void 0!==g&&(d[g]||(d[g]=[])).push(f)}return d};goog.array.toObject=function(a,b,c){var d={};goog.array.forEach(a,function(e,f){d[b.call(c,e,f,a)]=e});return d};goog.array.range=function(a,b,c){var d=[],e=0,f=a;c=c||1;void 0!==b&&(e=a,f=b);if(0>c*(f-e))return[];if(0<c)for(a=e;a<f;a+=c)d.push(a);else for(a=e;a>f;a+=c)d.push(a);return d};goog.array.repeat=function(a,b){for(var c=[],d=0;d<b;d++)c[d]=a;return c};
|
|
goog.array.flatten=function(a){for(var b=[],c=0;c<arguments.length;c++){var d=arguments[c];if(goog.isArray(d))for(var e=0;e<d.length;e+=8192){var f=goog.array.slice(d,e,e+8192);f=goog.array.flatten.apply(null,f);for(var g=0;g<f.length;g++)b.push(f[g])}else b.push(d)}return b};goog.array.rotate=function(a,b){goog.asserts.assert(null!=a.length);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)));return a};
|
|
goog.array.moveItem=function(a,b,c){goog.asserts.assert(0<=b&&b<a.length);goog.asserts.assert(0<=c&&c<a.length);b=Array.prototype.splice.call(a,b,1);Array.prototype.splice.call(a,c,0,b[0])};goog.array.zip=function(a){if(!arguments.length)return[];for(var b=[],c=arguments[0].length,d=1;d<arguments.length;d++)arguments[d].length<c&&(c=arguments[d].length);for(d=0;d<c;d++){for(var e=[],f=0;f<arguments.length;f++)e.push(arguments[f][d]);b.push(e)}return b};
|
|
goog.array.shuffle=function(a,b){for(var c=b||Math.random,d=a.length-1;0<d;d--){var e=Math.floor(c()*(d+1)),f=a[d];a[d]=a[e];a[e]=f}};goog.array.copyByIndex=function(a,b){var c=[];goog.array.forEach(b,function(b){c.push(a[b])});return c};goog.array.concatMap=function(a,b,c){return goog.array.concat.apply([],goog.array.map(a,b,c))};goog.debug.errorcontext={};goog.debug.errorcontext.addErrorContext=function(a,b,c){a[goog.debug.errorcontext.CONTEXT_KEY_]||(a[goog.debug.errorcontext.CONTEXT_KEY_]={});a[goog.debug.errorcontext.CONTEXT_KEY_][b]=c};goog.debug.errorcontext.getErrorContext=function(a){return a[goog.debug.errorcontext.CONTEXT_KEY_]||{}};goog.debug.errorcontext.CONTEXT_KEY_="__closure__error__context__984382";goog.string={};goog.string.internal={};goog.string.internal.startsWith=function(a,b){return 0==a.lastIndexOf(b,0)};goog.string.internal.endsWith=function(a,b){var c=a.length-b.length;return 0<=c&&a.indexOf(b,c)==c};goog.string.internal.caseInsensitiveStartsWith=function(a,b){return 0==goog.string.internal.caseInsensitiveCompare(b,a.substr(0,b.length))};goog.string.internal.caseInsensitiveEndsWith=function(a,b){return 0==goog.string.internal.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length))};
|
|
goog.string.internal.caseInsensitiveEquals=function(a,b){return a.toLowerCase()==b.toLowerCase()};goog.string.internal.isEmptyOrWhitespace=function(a){return/^[\s\xa0]*$/.test(a)};goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};goog.string.internal.caseInsensitiveCompare=function(a,b){var c=String(a).toLowerCase(),d=String(b).toLowerCase();return c<d?-1:c==d?0:1};
|
|
goog.string.internal.newLineToBr=function(a,b){return a.replace(/(\r\n|\r|\n)/g,b?"<br />":"<br>")};
|
|
goog.string.internal.htmlEscape=function(a,b){if(b)a=a.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(goog.string.internal.AMP_RE_,"&"));-1!=a.indexOf("<")&&(a=a.replace(goog.string.internal.LT_RE_,
|
|
"<"));-1!=a.indexOf(">")&&(a=a.replace(goog.string.internal.GT_RE_,">"));-1!=a.indexOf('"')&&(a=a.replace(goog.string.internal.QUOT_RE_,"""));-1!=a.indexOf("'")&&(a=a.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(goog.string.internal.NULL_RE_,"�"))}return a};goog.string.internal.AMP_RE_=/&/g;goog.string.internal.LT_RE_=/</g;goog.string.internal.GT_RE_=/>/g;goog.string.internal.QUOT_RE_=/"/g;goog.string.internal.SINGLE_QUOTE_RE_=/'/g;
|
|
goog.string.internal.NULL_RE_=/\x00/g;goog.string.internal.ALL_RE_=/[\x00&<>"']/;goog.string.internal.whitespaceEscape=function(a,b){return goog.string.internal.newLineToBr(a.replace(/ /g,"  "),b)};goog.string.internal.contains=function(a,b){return-1!=a.indexOf(b)};goog.string.internal.caseInsensitiveContains=function(a,b){return goog.string.internal.contains(a.toLowerCase(),b.toLowerCase())};
|
|
goog.string.internal.compareVersions=function(a,b){for(var c=0,d=goog.string.internal.trim(String(a)).split("."),e=goog.string.internal.trim(String(b)).split("."),f=Math.max(d.length,e.length),g=0;0==c&&g<f;g++){var h=d[g]||"",k=e[g]||"";do{h=/(\d*)(\D*)(.*)/.exec(h)||["","","",""];k=/(\d*)(\D*)(.*)/.exec(k)||["","","",""];if(0==h[0].length&&0==k[0].length)break;c=0==h[1].length?0:parseInt(h[1],10);var l=0==k[1].length?0:parseInt(k[1],10);c=goog.string.internal.compareElements_(c,l)||goog.string.internal.compareElements_(0==
|
|
h[2].length,0==k[2].length)||goog.string.internal.compareElements_(h[2],k[2]);h=h[3];k=k[3]}while(0==c)}return c};goog.string.internal.compareElements_=function(a,b){return a<b?-1:a>b?1:0};goog.labs={};goog.labs.userAgent={};goog.labs.userAgent.util={};goog.labs.userAgent.util.getNativeUserAgentString_=function(){var a=goog.labs.userAgent.util.getNavigator_();return a&&(a=a.userAgent)?a:""};goog.labs.userAgent.util.getNavigator_=function(){return goog.global.navigator};goog.labs.userAgent.util.userAgent_=goog.labs.userAgent.util.getNativeUserAgentString_();goog.labs.userAgent.util.setUserAgent=function(a){goog.labs.userAgent.util.userAgent_=a||goog.labs.userAgent.util.getNativeUserAgentString_()};
|
|
goog.labs.userAgent.util.getUserAgent=function(){return goog.labs.userAgent.util.userAgent_};goog.labs.userAgent.util.matchUserAgent=function(a){var b=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.contains(b,a)};goog.labs.userAgent.util.matchUserAgentIgnoreCase=function(a){var b=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.caseInsensitiveContains(b,a)};
|
|
goog.labs.userAgent.util.extractVersionTuples=function(a){for(var b=RegExp("(\\w[\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?","g"),c=[],d;d=b.exec(a);)c.push([d[1],d[2],d[3]||void 0]);return c};goog.object={};goog.object.is=function(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b};goog.object.forEach=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)};goog.object.filter=function(a,b,c){var d={},e;for(e in a)b.call(c,a[e],e,a)&&(d[e]=a[e]);return d};goog.object.map=function(a,b,c){var d={},e;for(e in a)d[e]=b.call(c,a[e],e,a);return d};goog.object.some=function(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return!0;return!1};
|
|
goog.object.every=function(a,b,c){for(var d in a)if(!b.call(c,a[d],d,a))return!1;return!0};goog.object.getCount=function(a){var b=0,c;for(c in a)b++;return b};goog.object.getAnyKey=function(a){for(var b in a)return b};goog.object.getAnyValue=function(a){for(var b in a)return a[b]};goog.object.contains=function(a,b){return goog.object.containsValue(a,b)};goog.object.getValues=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b};
|
|
goog.object.getKeys=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b};goog.object.getValueByKeys=function(a,b){var c=goog.isArrayLike(b),d=c?b:arguments;for(c=c?0:1;c<d.length;c++){if(null==a)return;a=a[d[c]]}return a};goog.object.containsKey=function(a,b){return null!==a&&b in a};goog.object.containsValue=function(a,b){for(var c in a)if(a[c]==b)return!0;return!1};goog.object.findKey=function(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d};
|
|
goog.object.findValue=function(a,b,c){return(b=goog.object.findKey(a,b,c))&&a[b]};goog.object.isEmpty=function(a){for(var b in a)return!1;return!0};goog.object.clear=function(a){for(var b in a)delete a[b]};goog.object.remove=function(a,b){var c;(c=b in a)&&delete a[b];return c};goog.object.add=function(a,b,c){if(null!==a&&b in a)throw Error('The object already contains the key "'+b+'"');goog.object.set(a,b,c)};goog.object.get=function(a,b,c){return null!==a&&b in a?a[b]:c};
|
|
goog.object.set=function(a,b,c){a[b]=c};goog.object.setIfUndefined=function(a,b,c){return b in a?a[b]:a[b]=c};goog.object.setWithReturnValueIfNotSet=function(a,b,c){if(b in a)return a[b];c=c();return a[b]=c};goog.object.equals=function(a,b){for(var c in a)if(!(c in b)||a[c]!==b[c])return!1;for(var d in b)if(!(d in a))return!1;return!0};goog.object.clone=function(a){var b={},c;for(c in a)b[c]=a[c];return b};
|
|
goog.object.unsafeClone=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(goog.isFunction(a.clone))return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=goog.object.unsafeClone(a[c]);return b}return a};goog.object.transpose=function(a){var b={},c;for(c in a)b[a[c]]=c;return b};goog.object.PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
|
|
goog.object.extend=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<goog.object.PROTOTYPE_FIELDS_.length;f++)c=goog.object.PROTOTYPE_FIELDS_[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};
|
|
goog.object.create=function(a){var b=arguments.length;if(1==b&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(b%2)throw Error("Uneven number of arguments");for(var c={},d=0;d<b;d+=2)c[arguments[d]]=arguments[d+1];return c};goog.object.createSet=function(a){var b=arguments.length;if(1==b&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var c={},d=0;d<b;d++)c[arguments[d]]=!0;return c};
|
|
goog.object.createImmutableView=function(a){var b=a;Object.isFrozen&&!Object.isFrozen(a)&&(b=Object.create(a),Object.freeze(b));return b};goog.object.isImmutableView=function(a){return!!Object.isFrozen&&Object.isFrozen(a)};
|
|
goog.object.getAllPropertyNames=function(a,b,c){if(!a)return[];if(!Object.getOwnPropertyNames||!Object.getPrototypeOf)return goog.object.getKeys(a);for(var d={};a&&(a!==Object.prototype||b)&&(a!==Function.prototype||c);){for(var e=Object.getOwnPropertyNames(a),f=0;f<e.length;f++)d[e[f]]=!0;a=Object.getPrototypeOf(a)}return goog.object.getKeys(d)};goog.object.getSuperClass=function(a){return(a=Object.getPrototypeOf(a.prototype))&&a.constructor};goog.labs.userAgent.browser={};goog.labs.userAgent.browser.matchOpera_=function(){return goog.labs.userAgent.util.matchUserAgent("Opera")};goog.labs.userAgent.browser.matchIE_=function(){return goog.labs.userAgent.util.matchUserAgent("Trident")||goog.labs.userAgent.util.matchUserAgent("MSIE")};goog.labs.userAgent.browser.matchEdgeHtml_=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")};goog.labs.userAgent.browser.matchEdgeChromium_=function(){return goog.labs.userAgent.util.matchUserAgent("Edg/")};
|
|
goog.labs.userAgent.browser.matchOperaChromium_=function(){return goog.labs.userAgent.util.matchUserAgent("OPR")};goog.labs.userAgent.browser.matchFirefox_=function(){return goog.labs.userAgent.util.matchUserAgent("Firefox")||goog.labs.userAgent.util.matchUserAgent("FxiOS")};
|
|
goog.labs.userAgent.browser.matchSafari_=function(){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.matchEdgeHtml_()||goog.labs.userAgent.browser.matchEdgeChromium_()||goog.labs.userAgent.browser.matchOperaChromium_()||goog.labs.userAgent.browser.matchFirefox_()||goog.labs.userAgent.browser.isSilk()||goog.labs.userAgent.util.matchUserAgent("Android"))};
|
|
goog.labs.userAgent.browser.matchCoast_=function(){return goog.labs.userAgent.util.matchUserAgent("Coast")};goog.labs.userAgent.browser.matchIosWebview_=function(){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.browser.matchFirefox_()&&goog.labs.userAgent.util.matchUserAgent("AppleWebKit")};
|
|
goog.labs.userAgent.browser.matchChrome_=function(){return(goog.labs.userAgent.util.matchUserAgent("Chrome")||goog.labs.userAgent.util.matchUserAgent("CriOS"))&&!goog.labs.userAgent.browser.matchEdgeHtml_()};goog.labs.userAgent.browser.matchAndroidBrowser_=function(){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())};
|
|
goog.labs.userAgent.browser.isOpera=goog.labs.userAgent.browser.matchOpera_;goog.labs.userAgent.browser.isIE=goog.labs.userAgent.browser.matchIE_;goog.labs.userAgent.browser.isEdge=goog.labs.userAgent.browser.matchEdgeHtml_;goog.labs.userAgent.browser.isEdgeChromium=goog.labs.userAgent.browser.matchEdgeChromium_;goog.labs.userAgent.browser.isOperaChromium=goog.labs.userAgent.browser.matchOperaChromium_;goog.labs.userAgent.browser.isFirefox=goog.labs.userAgent.browser.matchFirefox_;
|
|
goog.labs.userAgent.browser.isSafari=goog.labs.userAgent.browser.matchSafari_;goog.labs.userAgent.browser.isCoast=goog.labs.userAgent.browser.matchCoast_;goog.labs.userAgent.browser.isIosWebview=goog.labs.userAgent.browser.matchIosWebview_;goog.labs.userAgent.browser.isChrome=goog.labs.userAgent.browser.matchChrome_;goog.labs.userAgent.browser.isAndroidBrowser=goog.labs.userAgent.browser.matchAndroidBrowser_;goog.labs.userAgent.browser.isSilk=function(){return goog.labs.userAgent.util.matchUserAgent("Silk")};
|
|
goog.labs.userAgent.browser.getVersion=function(){function a(a){a=goog.array.find(a,d);return c[a]||""}var b=goog.labs.userAgent.util.getUserAgent();if(goog.labs.userAgent.browser.isIE())return goog.labs.userAgent.browser.getIEVersion_(b);b=goog.labs.userAgent.util.extractVersionTuples(b);var c={};goog.array.forEach(b,function(a){c[a[0]]=a[1]});var d=goog.partial(goog.object.containsKey,c);return goog.labs.userAgent.browser.isOpera()?a(["Version","Opera"]):goog.labs.userAgent.browser.isEdge()?a(["Edge"]):
|
|
goog.labs.userAgent.browser.isEdgeChromium()?a(["Edg"]):goog.labs.userAgent.browser.isChrome()?a(["Chrome","CriOS"]):(b=b[2])&&b[1]||""};goog.labs.userAgent.browser.isVersionOrHigher=function(a){return 0<=goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(),a)};
|
|
goog.labs.userAgent.browser.getIEVersion_=function(a){var b=/rv: *([\d\.]*)/.exec(a);if(b&&b[1])return b[1];b="";var c=/MSIE +([\d\.]+)/.exec(a);if(c&&c[1])if(a=/Trident\/(\d.\d)/.exec(a),"7.0"==c[1])if(a&&a[1])switch(a[1]){case "4.0":b="8.0";break;case "5.0":b="9.0";break;case "6.0":b="10.0";break;case "7.0":b="11.0"}else b="7.0";else b=c[1];return b};goog.dom.asserts={};goog.dom.asserts.assertIsLocation=function(a){if(goog.asserts.ENABLE_ASSERTS){var b=goog.dom.asserts.getWindow_(a);b&&(!a||!(a instanceof b.Location)&&a instanceof b.Element)&&goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s",goog.dom.asserts.debugStringForType_(a))}return a};
|
|
goog.dom.asserts.assertIsElementType_=function(a,b){if(goog.asserts.ENABLE_ASSERTS){var c=goog.dom.asserts.getWindow_(a);c&&"undefined"!=typeof c[b]&&(a&&(a instanceof c[b]||!(a instanceof c.Location||a instanceof c.Element))||goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s",b,goog.dom.asserts.debugStringForType_(a)))}return a};goog.dom.asserts.assertIsHTMLAnchorElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLAnchorElement")};
|
|
goog.dom.asserts.assertIsHTMLButtonElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLButtonElement")};goog.dom.asserts.assertIsHTMLLinkElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLLinkElement")};goog.dom.asserts.assertIsHTMLImageElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLImageElement")};goog.dom.asserts.assertIsHTMLAudioElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLAudioElement")};
|
|
goog.dom.asserts.assertIsHTMLVideoElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLVideoElement")};goog.dom.asserts.assertIsHTMLInputElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLInputElement")};goog.dom.asserts.assertIsHTMLTextAreaElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLTextAreaElement")};goog.dom.asserts.assertIsHTMLCanvasElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLCanvasElement")};
|
|
goog.dom.asserts.assertIsHTMLEmbedElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLEmbedElement")};goog.dom.asserts.assertIsHTMLFormElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLFormElement")};goog.dom.asserts.assertIsHTMLFrameElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLFrameElement")};goog.dom.asserts.assertIsHTMLIFrameElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLIFrameElement")};
|
|
goog.dom.asserts.assertIsHTMLObjectElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLObjectElement")};goog.dom.asserts.assertIsHTMLScriptElement=function(a){return goog.dom.asserts.assertIsElementType_(a,"HTMLScriptElement")};
|
|
goog.dom.asserts.debugStringForType_=function(a){if(goog.isObject(a))try{return a.constructor.displayName||a.constructor.name||Object.prototype.toString.call(a)}catch(b){return"<object could not be stringified>"}else return void 0===a?"undefined":null===a?"null":typeof a};goog.dom.asserts.getWindow_=function(a){try{var b=a&&a.ownerDocument,c=b&&(b.defaultView||b.parentWindow);c=c||goog.global;if(c.Element&&c.Location)return c}catch(d){}return null};goog.functions={};goog.functions.constant=function(a){return function(){return a}};goog.functions.FALSE=function(){return!1};goog.functions.TRUE=function(){return!0};goog.functions.NULL=function(){return null};goog.functions.identity=function(a,b){return a};goog.functions.error=function(a){return function(){throw Error(a);}};goog.functions.fail=function(a){return function(){throw a;}};
|
|
goog.functions.lock=function(a,b){b=b||0;return function(){return a.apply(this,Array.prototype.slice.call(arguments,0,b))}};goog.functions.nth=function(a){return function(){return arguments[a]}};goog.functions.partialRight=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.push.apply(b,c);return a.apply(this,b)}};goog.functions.withReturnValue=function(a,b){return goog.functions.sequence(a,goog.functions.constant(b))};
|
|
goog.functions.equalTo=function(a,b){return function(c){return b?a==c:a===c}};goog.functions.compose=function(a,b){var c=arguments,d=c.length;return function(){var a;d&&(a=c[d-1].apply(this,arguments));for(var b=d-2;0<=b;b--)a=c[b].call(this,a);return a}};goog.functions.sequence=function(a){var b=arguments,c=b.length;return function(){for(var a,e=0;e<c;e++)a=b[e].apply(this,arguments);return a}};
|
|
goog.functions.and=function(a){var b=arguments,c=b.length;return function(){for(var a=0;a<c;a++)if(!b[a].apply(this,arguments))return!1;return!0}};goog.functions.or=function(a){var b=arguments,c=b.length;return function(){for(var a=0;a<c;a++)if(b[a].apply(this,arguments))return!0;return!1}};goog.functions.not=function(a){return function(){return!a.apply(this,arguments)}};
|
|
goog.functions.create=function(a,b){var c=function(){};c.prototype=a.prototype;c=new c;a.apply(c,Array.prototype.slice.call(arguments,1));return c};goog.functions.CACHE_RETURN_VALUE=!0;goog.functions.cacheReturnValue=function(a){var b=!1,c;return function(){if(!goog.functions.CACHE_RETURN_VALUE)return a();b||(c=a(),b=!0);return c}};goog.functions.once=function(a){var b=a;return function(){if(b){var a=b;b=null;a()}}};
|
|
goog.functions.debounce=function(a,b,c){var d=0;return function(e){goog.global.clearTimeout(d);var f=arguments;d=goog.global.setTimeout(function(){a.apply(c,f)},b)}};goog.functions.throttle=function(a,b,c){var d=0,e=!1,f=[],g=function(){d=0;e&&(e=!1,h())},h=function(){d=goog.global.setTimeout(g,b);a.apply(c,f)};return function(a){f=arguments;d?e=!0:h()}};goog.functions.rateLimit=function(a,b,c){var d=0,e=function(){d=0};return function(f){d||(d=goog.global.setTimeout(e,b),a.apply(c,arguments))}};goog.dom.HtmlElement=function(){};goog.dom.TagName=function(a){this.tagName_=a};goog.dom.TagName.prototype.toString=function(){return this.tagName_};goog.dom.TagName.A=new goog.dom.TagName("A");goog.dom.TagName.ABBR=new goog.dom.TagName("ABBR");goog.dom.TagName.ACRONYM=new goog.dom.TagName("ACRONYM");goog.dom.TagName.ADDRESS=new goog.dom.TagName("ADDRESS");goog.dom.TagName.APPLET=new goog.dom.TagName("APPLET");goog.dom.TagName.AREA=new goog.dom.TagName("AREA");goog.dom.TagName.ARTICLE=new goog.dom.TagName("ARTICLE");
|
|
goog.dom.TagName.ASIDE=new goog.dom.TagName("ASIDE");goog.dom.TagName.AUDIO=new goog.dom.TagName("AUDIO");goog.dom.TagName.B=new goog.dom.TagName("B");goog.dom.TagName.BASE=new goog.dom.TagName("BASE");goog.dom.TagName.BASEFONT=new goog.dom.TagName("BASEFONT");goog.dom.TagName.BDI=new goog.dom.TagName("BDI");goog.dom.TagName.BDO=new goog.dom.TagName("BDO");goog.dom.TagName.BIG=new goog.dom.TagName("BIG");goog.dom.TagName.BLOCKQUOTE=new goog.dom.TagName("BLOCKQUOTE");goog.dom.TagName.BODY=new goog.dom.TagName("BODY");
|
|
goog.dom.TagName.BR=new goog.dom.TagName("BR");goog.dom.TagName.BUTTON=new goog.dom.TagName("BUTTON");goog.dom.TagName.CANVAS=new goog.dom.TagName("CANVAS");goog.dom.TagName.CAPTION=new goog.dom.TagName("CAPTION");goog.dom.TagName.CENTER=new goog.dom.TagName("CENTER");goog.dom.TagName.CITE=new goog.dom.TagName("CITE");goog.dom.TagName.CODE=new goog.dom.TagName("CODE");goog.dom.TagName.COL=new goog.dom.TagName("COL");goog.dom.TagName.COLGROUP=new goog.dom.TagName("COLGROUP");
|
|
goog.dom.TagName.COMMAND=new goog.dom.TagName("COMMAND");goog.dom.TagName.DATA=new goog.dom.TagName("DATA");goog.dom.TagName.DATALIST=new goog.dom.TagName("DATALIST");goog.dom.TagName.DD=new goog.dom.TagName("DD");goog.dom.TagName.DEL=new goog.dom.TagName("DEL");goog.dom.TagName.DETAILS=new goog.dom.TagName("DETAILS");goog.dom.TagName.DFN=new goog.dom.TagName("DFN");goog.dom.TagName.DIALOG=new goog.dom.TagName("DIALOG");goog.dom.TagName.DIR=new goog.dom.TagName("DIR");goog.dom.TagName.DIV=new goog.dom.TagName("DIV");
|
|
goog.dom.TagName.DL=new goog.dom.TagName("DL");goog.dom.TagName.DT=new goog.dom.TagName("DT");goog.dom.TagName.EM=new goog.dom.TagName("EM");goog.dom.TagName.EMBED=new goog.dom.TagName("EMBED");goog.dom.TagName.FIELDSET=new goog.dom.TagName("FIELDSET");goog.dom.TagName.FIGCAPTION=new goog.dom.TagName("FIGCAPTION");goog.dom.TagName.FIGURE=new goog.dom.TagName("FIGURE");goog.dom.TagName.FONT=new goog.dom.TagName("FONT");goog.dom.TagName.FOOTER=new goog.dom.TagName("FOOTER");goog.dom.TagName.FORM=new goog.dom.TagName("FORM");
|
|
goog.dom.TagName.FRAME=new goog.dom.TagName("FRAME");goog.dom.TagName.FRAMESET=new goog.dom.TagName("FRAMESET");goog.dom.TagName.H1=new goog.dom.TagName("H1");goog.dom.TagName.H2=new goog.dom.TagName("H2");goog.dom.TagName.H3=new goog.dom.TagName("H3");goog.dom.TagName.H4=new goog.dom.TagName("H4");goog.dom.TagName.H5=new goog.dom.TagName("H5");goog.dom.TagName.H6=new goog.dom.TagName("H6");goog.dom.TagName.HEAD=new goog.dom.TagName("HEAD");goog.dom.TagName.HEADER=new goog.dom.TagName("HEADER");
|
|
goog.dom.TagName.HGROUP=new goog.dom.TagName("HGROUP");goog.dom.TagName.HR=new goog.dom.TagName("HR");goog.dom.TagName.HTML=new goog.dom.TagName("HTML");goog.dom.TagName.I=new goog.dom.TagName("I");goog.dom.TagName.IFRAME=new goog.dom.TagName("IFRAME");goog.dom.TagName.IMG=new goog.dom.TagName("IMG");goog.dom.TagName.INPUT=new goog.dom.TagName("INPUT");goog.dom.TagName.INS=new goog.dom.TagName("INS");goog.dom.TagName.ISINDEX=new goog.dom.TagName("ISINDEX");goog.dom.TagName.KBD=new goog.dom.TagName("KBD");
|
|
goog.dom.TagName.KEYGEN=new goog.dom.TagName("KEYGEN");goog.dom.TagName.LABEL=new goog.dom.TagName("LABEL");goog.dom.TagName.LEGEND=new goog.dom.TagName("LEGEND");goog.dom.TagName.LI=new goog.dom.TagName("LI");goog.dom.TagName.LINK=new goog.dom.TagName("LINK");goog.dom.TagName.MAIN=new goog.dom.TagName("MAIN");goog.dom.TagName.MAP=new goog.dom.TagName("MAP");goog.dom.TagName.MARK=new goog.dom.TagName("MARK");goog.dom.TagName.MATH=new goog.dom.TagName("MATH");goog.dom.TagName.MENU=new goog.dom.TagName("MENU");
|
|
goog.dom.TagName.MENUITEM=new goog.dom.TagName("MENUITEM");goog.dom.TagName.META=new goog.dom.TagName("META");goog.dom.TagName.METER=new goog.dom.TagName("METER");goog.dom.TagName.NAV=new goog.dom.TagName("NAV");goog.dom.TagName.NOFRAMES=new goog.dom.TagName("NOFRAMES");goog.dom.TagName.NOSCRIPT=new goog.dom.TagName("NOSCRIPT");goog.dom.TagName.OBJECT=new goog.dom.TagName("OBJECT");goog.dom.TagName.OL=new goog.dom.TagName("OL");goog.dom.TagName.OPTGROUP=new goog.dom.TagName("OPTGROUP");
|
|
goog.dom.TagName.OPTION=new goog.dom.TagName("OPTION");goog.dom.TagName.OUTPUT=new goog.dom.TagName("OUTPUT");goog.dom.TagName.P=new goog.dom.TagName("P");goog.dom.TagName.PARAM=new goog.dom.TagName("PARAM");goog.dom.TagName.PICTURE=new goog.dom.TagName("PICTURE");goog.dom.TagName.PRE=new goog.dom.TagName("PRE");goog.dom.TagName.PROGRESS=new goog.dom.TagName("PROGRESS");goog.dom.TagName.Q=new goog.dom.TagName("Q");goog.dom.TagName.RP=new goog.dom.TagName("RP");goog.dom.TagName.RT=new goog.dom.TagName("RT");
|
|
goog.dom.TagName.RTC=new goog.dom.TagName("RTC");goog.dom.TagName.RUBY=new goog.dom.TagName("RUBY");goog.dom.TagName.S=new goog.dom.TagName("S");goog.dom.TagName.SAMP=new goog.dom.TagName("SAMP");goog.dom.TagName.SCRIPT=new goog.dom.TagName("SCRIPT");goog.dom.TagName.SECTION=new goog.dom.TagName("SECTION");goog.dom.TagName.SELECT=new goog.dom.TagName("SELECT");goog.dom.TagName.SMALL=new goog.dom.TagName("SMALL");goog.dom.TagName.SOURCE=new goog.dom.TagName("SOURCE");goog.dom.TagName.SPAN=new goog.dom.TagName("SPAN");
|
|
goog.dom.TagName.STRIKE=new goog.dom.TagName("STRIKE");goog.dom.TagName.STRONG=new goog.dom.TagName("STRONG");goog.dom.TagName.STYLE=new goog.dom.TagName("STYLE");goog.dom.TagName.SUB=new goog.dom.TagName("SUB");goog.dom.TagName.SUMMARY=new goog.dom.TagName("SUMMARY");goog.dom.TagName.SUP=new goog.dom.TagName("SUP");goog.dom.TagName.SVG=new goog.dom.TagName("SVG");goog.dom.TagName.TABLE=new goog.dom.TagName("TABLE");goog.dom.TagName.TBODY=new goog.dom.TagName("TBODY");goog.dom.TagName.TD=new goog.dom.TagName("TD");
|
|
goog.dom.TagName.TEMPLATE=new goog.dom.TagName("TEMPLATE");goog.dom.TagName.TEXTAREA=new goog.dom.TagName("TEXTAREA");goog.dom.TagName.TFOOT=new goog.dom.TagName("TFOOT");goog.dom.TagName.TH=new goog.dom.TagName("TH");goog.dom.TagName.THEAD=new goog.dom.TagName("THEAD");goog.dom.TagName.TIME=new goog.dom.TagName("TIME");goog.dom.TagName.TITLE=new goog.dom.TagName("TITLE");goog.dom.TagName.TR=new goog.dom.TagName("TR");goog.dom.TagName.TRACK=new goog.dom.TagName("TRACK");goog.dom.TagName.TT=new goog.dom.TagName("TT");
|
|
goog.dom.TagName.U=new goog.dom.TagName("U");goog.dom.TagName.UL=new goog.dom.TagName("UL");goog.dom.TagName.VAR=new goog.dom.TagName("VAR");goog.dom.TagName.VIDEO=new goog.dom.TagName("VIDEO");goog.dom.TagName.WBR=new goog.dom.TagName("WBR");goog.dom.tags={};goog.dom.tags.VOID_TAGS_={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};goog.dom.tags.isVoidTag=function(a){return!0===goog.dom.tags.VOID_TAGS_[a]};goog.html={};goog.html.trustedtypes={};goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#html"):null;goog.string.TypedString=function(){};goog.string.Const=function(a,b){this.stringConstValueWithSecurityContract__googStringSecurityPrivate_=a===goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_&&b||"";this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_=goog.string.Const.TYPE_MARKER_};goog.string.Const.prototype.implementsGoogStringTypedString=!0;goog.string.Const.prototype.getTypedStringValue=function(){return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_};
|
|
goog.DEBUG&&(goog.string.Const.prototype.toString=function(){return"Const{"+this.stringConstValueWithSecurityContract__googStringSecurityPrivate_+"}"});goog.string.Const.unwrap=function(a){if(a instanceof goog.string.Const&&a.constructor===goog.string.Const&&a.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_===goog.string.Const.TYPE_MARKER_)return a.stringConstValueWithSecurityContract__googStringSecurityPrivate_;goog.asserts.fail("expected object of type Const, got '"+a+"'");return"type_error:Const"};
|
|
goog.string.Const.from=function(a){return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_,a)};goog.string.Const.TYPE_MARKER_={};goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_={};goog.string.Const.EMPTY=goog.string.Const.from("");goog.html.SafeScript=function(){this.privateDoNotAccessOrElseSafeScriptWrappedValue_="";this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeScript.prototype.implementsGoogStringTypedString=!0;goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.SafeScript.fromConstant=function(a){a=goog.string.Const.unwrap(a);return 0===a.length?goog.html.SafeScript.EMPTY:goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeScript.fromConstantAndArgs=function(a,b){for(var c=[],d=1;d<arguments.length;d++)c.push(goog.html.SafeScript.stringify_(arguments[d]));return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("("+goog.string.Const.unwrap(a)+")("+c.join(", ")+");")};goog.html.SafeScript.fromJson=function(a){return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(a))};goog.html.SafeScript.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()};
|
|
goog.DEBUG&&(goog.html.SafeScript.prototype.toString=function(){return"SafeScript{"+this.privateDoNotAccessOrElseSafeScriptWrappedValue_+"}"});goog.html.SafeScript.unwrap=function(a){return goog.html.SafeScript.unwrapTrustedScript(a).toString()};
|
|
goog.html.SafeScript.unwrapTrustedScript=function(a){if(a instanceof goog.html.SafeScript&&a.constructor===goog.html.SafeScript&&a.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeScriptWrappedValue_;goog.asserts.fail("expected object of type SafeScript, got '"+a+"' of type "+goog.typeOf(a));return"type_error:SafeScript"};
|
|
goog.html.SafeScript.stringify_=function(a){return JSON.stringify(a).replace(/</g,"\\x3c")};goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse=function(a){return(new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(a)};
|
|
goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a){this.privateDoNotAccessOrElseSafeScriptWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(a):a;return this};goog.html.SafeScript.EMPTY=goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("");goog.fs={};goog.fs.url={};goog.fs.url.createObjectUrl=function(a){return goog.fs.url.getUrlObject_().createObjectURL(a)};goog.fs.url.revokeObjectUrl=function(a){goog.fs.url.getUrlObject_().revokeObjectURL(a)};goog.fs.url.getUrlObject_=function(){var a=goog.fs.url.findUrlObject_();if(null!=a)return a;throw Error("This browser doesn't seem to support blob URLs");};
|
|
goog.fs.url.findUrlObject_=function(){return void 0!==goog.global.URL&&void 0!==goog.global.URL.createObjectURL?goog.global.URL:void 0!==goog.global.webkitURL&&void 0!==goog.global.webkitURL.createObjectURL?goog.global.webkitURL:void 0!==goog.global.createObjectURL?goog.global:null};goog.fs.url.browserSupportsObjectUrls=function(){return null!=goog.fs.url.findUrlObject_()};goog.i18n={};goog.i18n.bidi={};goog.i18n.bidi.FORCE_RTL=!1;
|
|
goog.i18n.bidi.IS_RTL=goog.i18n.bidi.FORCE_RTL||("ar"==goog.LOCALE.substring(0,2).toLowerCase()||"fa"==goog.LOCALE.substring(0,2).toLowerCase()||"he"==goog.LOCALE.substring(0,2).toLowerCase()||"iw"==goog.LOCALE.substring(0,2).toLowerCase()||"ps"==goog.LOCALE.substring(0,2).toLowerCase()||"sd"==goog.LOCALE.substring(0,2).toLowerCase()||"ug"==goog.LOCALE.substring(0,2).toLowerCase()||"ur"==goog.LOCALE.substring(0,2).toLowerCase()||"yi"==goog.LOCALE.substring(0,2).toLowerCase())&&(2==goog.LOCALE.length||
|
|
"-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))||3<=goog.LOCALE.length&&"ckb"==goog.LOCALE.substring(0,3).toLowerCase()&&(3==goog.LOCALE.length||"-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))||7<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))&&("adlm"==goog.LOCALE.substring(3,7).toLowerCase()||"arab"==goog.LOCALE.substring(3,7).toLowerCase()||"hebr"==goog.LOCALE.substring(3,7).toLowerCase()||"nkoo"==goog.LOCALE.substring(3,
|
|
7).toLowerCase()||"rohg"==goog.LOCALE.substring(3,7).toLowerCase()||"thaa"==goog.LOCALE.substring(3,7).toLowerCase())||8<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))&&("adlm"==goog.LOCALE.substring(4,8).toLowerCase()||"arab"==goog.LOCALE.substring(4,8).toLowerCase()||"hebr"==goog.LOCALE.substring(4,8).toLowerCase()||"nkoo"==goog.LOCALE.substring(4,8).toLowerCase()||"rohg"==goog.LOCALE.substring(4,8).toLowerCase()||"thaa"==goog.LOCALE.substring(4,8).toLowerCase());
|
|
goog.i18n.bidi.Format={LRE:"\u202a",RLE:"\u202b",PDF:"\u202c",LRM:"\u200e",RLM:"\u200f"};goog.i18n.bidi.Dir={LTR:1,RTL:-1,NEUTRAL:0};goog.i18n.bidi.RIGHT="right";goog.i18n.bidi.LEFT="left";goog.i18n.bidi.I18N_RIGHT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.LEFT:goog.i18n.bidi.RIGHT;goog.i18n.bidi.I18N_LEFT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT;
|
|
goog.i18n.bidi.toDir=function(a,b){return"number"==typeof a?0<a?goog.i18n.bidi.Dir.LTR:0>a?goog.i18n.bidi.Dir.RTL:b?null:goog.i18n.bidi.Dir.NEUTRAL:null==a?null:a?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR};goog.i18n.bidi.ltrChars_="A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0900-\u1fff\u200e\u2c00-\ud801\ud804-\ud839\ud83c-\udbff\uf900-\ufb1c\ufe00-\ufe6f\ufefd-\uffff";goog.i18n.bidi.rtlChars_="\u0591-\u06ef\u06fa-\u08ff\u200f\ud802-\ud803\ud83a-\ud83b\ufb1d-\ufdff\ufe70-\ufefc";
|
|
goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g;goog.i18n.bidi.stripHtmlIfNeeded_=function(a,b){return b?a.replace(goog.i18n.bidi.htmlSkipReg_,""):a};goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.hasAnyRtl=function(a,b){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl;
|
|
goog.i18n.bidi.hasAnyLtr=function(a,b){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.isRtlChar=function(a){return goog.i18n.bidi.rtlRe_.test(a)};goog.i18n.bidi.isLtrChar=function(a){return goog.i18n.bidi.ltrRe_.test(a)};goog.i18n.bidi.isNeutralChar=function(a){return!goog.i18n.bidi.isLtrChar(a)&&!goog.i18n.bidi.isRtlChar(a)};
|
|
goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.startsWithRtl=function(a,b){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl;
|
|
goog.i18n.bidi.startsWithLtr=function(a,b){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr;goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/;goog.i18n.bidi.isNeutralText=function(a,b){a=goog.i18n.bidi.stripHtmlIfNeeded_(a,b);return goog.i18n.bidi.isRequiredLtrRe_.test(a)||!goog.i18n.bidi.hasAnyLtr(a)&&!goog.i18n.bidi.hasAnyRtl(a)};
|
|
goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$");goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$");goog.i18n.bidi.endsWithLtr=function(a,b){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr;
|
|
goog.i18n.bidi.endsWithRtl=function(a,b){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl;goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;goog.i18n.bidi.isRtlLanguage=function(a){return goog.i18n.bidi.rtlLocalesRe_.test(a)};goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g;
|
|
goog.i18n.bidi.guardBracketInText=function(a,b){var c=(void 0===b?goog.i18n.bidi.hasAnyRtl(a):b)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM;return a.replace(goog.i18n.bidi.bracketGuardTextRe_,c+"$&"+c)};goog.i18n.bidi.enforceRtlInHtml=function(a){return"<"==a.charAt(0)?a.replace(/<\w+/,"$& dir=rtl"):"\n<span dir=rtl>"+a+"</span>"};goog.i18n.bidi.enforceRtlInText=function(a){return goog.i18n.bidi.Format.RLE+a+goog.i18n.bidi.Format.PDF};
|
|
goog.i18n.bidi.enforceLtrInHtml=function(a){return"<"==a.charAt(0)?a.replace(/<\w+/,"$& dir=ltr"):"\n<span dir=ltr>"+a+"</span>"};goog.i18n.bidi.enforceLtrInText=function(a){return goog.i18n.bidi.Format.LRE+a+goog.i18n.bidi.Format.PDF};goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g;goog.i18n.bidi.leftRe_=/left/gi;goog.i18n.bidi.rightRe_=/right/gi;goog.i18n.bidi.tempRe_=/%%%%/g;
|
|
goog.i18n.bidi.mirrorCSS=function(a){return a.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)};goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g;goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g;
|
|
goog.i18n.bidi.normalizeHebrewQuote=function(a){return a.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1\u05f3")};goog.i18n.bidi.wordSeparatorRe_=/\s+/;goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/;goog.i18n.bidi.rtlDetectionThreshold_=.4;
|
|
goog.i18n.bidi.estimateDirection=function(a,b){for(var c=0,d=0,e=!1,f=goog.i18n.bidi.stripHtmlIfNeeded_(a,b).split(goog.i18n.bidi.wordSeparatorRe_),g=0;g<f.length;g++){var h=f[g];goog.i18n.bidi.startsWithRtl(h)?(c++,d++):goog.i18n.bidi.isRequiredLtrRe_.test(h)?e=!0:goog.i18n.bidi.hasAnyLtr(h)?d++:goog.i18n.bidi.hasNumeralsRe_.test(h)&&(e=!0)}return 0==d?e?goog.i18n.bidi.Dir.LTR:goog.i18n.bidi.Dir.NEUTRAL:c/d>goog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR};
|
|
goog.i18n.bidi.detectRtlDirectionality=function(a,b){return goog.i18n.bidi.estimateDirection(a,b)==goog.i18n.bidi.Dir.RTL};goog.i18n.bidi.setElementDirAndAlign=function(a,b){a&&(b=goog.i18n.bidi.toDir(b))&&(a.style.textAlign=b==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,a.dir=b==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")};
|
|
goog.i18n.bidi.setElementDirByTextDirectionality=function(a,b){switch(goog.i18n.bidi.estimateDirection(b)){case goog.i18n.bidi.Dir.LTR:a.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:a.dir="rtl";break;default:a.removeAttribute("dir")}};goog.i18n.bidi.DirectionalString=function(){};goog.html.TrustedResourceUrl=function(a,b){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=a===goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&b||"";this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0;goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()};
|
|
goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR};
|
|
goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(a,b){var c=goog.html.TrustedResourceUrl.unwrap(this);c=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(c);var d=c[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(c[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",c[2]||"",a)+goog.html.TrustedResourceUrl.stringifyParams_("#",d,b))};
|
|
goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"});goog.html.TrustedResourceUrl.unwrap=function(a){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(a).toString()};
|
|
goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(a){if(a instanceof goog.html.TrustedResourceUrl&&a.constructor===goog.html.TrustedResourceUrl&&a.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+a+"' of type "+goog.typeOf(a));return"type_error:TrustedResourceUrl"};
|
|
goog.html.TrustedResourceUrl.format=function(a,b){var c=goog.string.Const.unwrap(a);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(c))throw Error("Invalid TrustedResourceUrl format: "+c);var d=c.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(a,d){if(!Object.prototype.hasOwnProperty.call(b,d))throw Error('Found marker, "'+d+'", in format string, "'+c+'", but no valid label mapping found in args: '+JSON.stringify(b));var e=b[d];return e instanceof goog.string.Const?goog.string.Const.unwrap(e):
|
|
encodeURIComponent(String(e))});return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(d)};goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g;goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i;goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/;
|
|
goog.html.TrustedResourceUrl.formatWithParams=function(a,b,c,d){return goog.html.TrustedResourceUrl.format(a,b).cloneWithParams(c,d)};goog.html.TrustedResourceUrl.fromConstant=function(a){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))};goog.html.TrustedResourceUrl.fromConstants=function(a){for(var b="",c=0;c<a.length;c++)b+=goog.string.Const.unwrap(a[c]);return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)};
|
|
goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse=function(a){a=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(a):a;return new goog.html.TrustedResourceUrl(goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_,a)};
|
|
goog.html.TrustedResourceUrl.stringifyParams_=function(a,b,c){if(null==c)return b;if("string"===typeof c)return c?a+encodeURIComponent(c):"";for(var d in c){var e=c[d];e=goog.isArray(e)?e:[e];for(var f=0;f<e.length;f++){var g=e[f];null!=g&&(b||(b=a),b+=(b.length>a.length?"&":"")+encodeURIComponent(d)+"="+encodeURIComponent(String(g)))}}return b};goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_={};goog.html.SafeUrl=function(a,b){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=a===goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_&&b||"";this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez";goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0;goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()};
|
|
goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR};goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"});
|
|
goog.html.SafeUrl.unwrap=function(a){if(a instanceof goog.html.SafeUrl&&a.constructor===goog.html.SafeUrl&&a.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeUrlWrappedValue_;goog.asserts.fail("expected object of type SafeUrl, got '"+a+"' of type "+goog.typeOf(a));return"type_error:SafeUrl"};goog.html.SafeUrl.fromConstant=function(a){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))};
|
|
goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i;goog.html.SafeUrl.isSafeMimeType=function(a){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(a)};goog.html.SafeUrl.fromBlob=function(a){a=goog.html.SAFE_MIME_TYPE_PATTERN_.test(a.type)?goog.fs.url.createObjectUrl(a):goog.html.SafeUrl.INNOCUOUS_STRING;return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.DATA_URL_PATTERN_=/^data:([^,]*);base64,[a-z0-9+\/]+=*$/i;goog.html.SafeUrl.fromDataUrl=function(a){a=a.replace(/(%0A|%0D)/g,"");var b=a.match(goog.html.DATA_URL_PATTERN_);b=b&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(b[1]);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b?a:goog.html.SafeUrl.INNOCUOUS_STRING)};goog.html.SafeUrl.fromTelUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"tel:")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i;goog.html.SafeUrl.fromSipUrl=function(a){goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(a))||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeUrl.fromFacebookMessengerUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"fb-messenger://share")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeUrl.fromWhatsAppUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"whatsapp://send")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeUrl.fromSmsUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeUrl.isSmsUrlBodyValid_=function(a){var b=a.indexOf("#");0<b&&(a=a.substring(0,b));b=a.match(/[?&]body=/gi);if(!b)return!0;if(1<b.length)return!1;a=a.match(/[?&]body=([^&]*)/)[1];if(!a)return!0;try{decodeURIComponent(a)}catch(c){return!1}return/^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(a)};goog.html.SafeUrl.fromSshUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"ssh://")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeUrl.sanitizeChromeExtensionUrl=function(a,b){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\/\/([^\/]+)\//,a,b)};goog.html.SafeUrl.sanitizeFirefoxExtensionUrl=function(a,b){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\/\/([^\/]+)\//,a,b)};goog.html.SafeUrl.sanitizeEdgeExtensionUrl=function(a,b){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\/\/([^\/]+)\//,a,b)};
|
|
goog.html.SafeUrl.sanitizeExtensionUrl_=function(a,b,c){(a=a.exec(b))?(a=a[1],-1==(c instanceof goog.string.Const?[goog.string.Const.unwrap(c)]:c.map(function(a){return goog.string.Const.unwrap(a)})).indexOf(a)&&(b=goog.html.SafeUrl.INNOCUOUS_STRING)):b=goog.html.SafeUrl.INNOCUOUS_STRING;return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)};goog.html.SafeUrl.fromTrustedResourceUrl=function(a){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(a))};
|
|
goog.html.SAFE_URL_PATTERN_=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;goog.html.SafeUrl.SAFE_URL_PATTERN=goog.html.SAFE_URL_PATTERN_;goog.html.SafeUrl.sanitize=function(a){if(a instanceof goog.html.SafeUrl)return a;a="object"==typeof a&&a.implementsGoogStringTypedString?a.getTypedStringValue():String(a);goog.html.SAFE_URL_PATTERN_.test(a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeUrl.sanitizeAssertUnchanged=function(a,b){if(a instanceof goog.html.SafeUrl)return a;a="object"==typeof a&&a.implementsGoogStringTypedString?a.getTypedStringValue():String(a);if(b&&/^data:/i.test(a)){var c=goog.html.SafeUrl.fromDataUrl(a);if(c.getTypedStringValue()==a)return c}goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(a),"%s does not match the safe URL pattern",a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse=function(a){return new goog.html.SafeUrl(goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_,a)};goog.html.SafeUrl.ABOUT_BLANK=goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank");goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_={};goog.html.SafeStyle=function(){this.privateDoNotAccessOrElseSafeStyleWrappedValue_="";this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeStyle.prototype.implementsGoogStringTypedString=!0;goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};
|
|
goog.html.SafeStyle.fromConstant=function(a){a=goog.string.Const.unwrap(a);if(0===a.length)return goog.html.SafeStyle.EMPTY;goog.asserts.assert(goog.string.internal.endsWith(a,";"),"Last character of style string is not ';': "+a);goog.asserts.assert(goog.string.internal.contains(a,":"),"Style string must contain at least one ':', to specify a \"name: value\" pair: "+a);return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(a)};
|
|
goog.html.SafeStyle.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_};goog.DEBUG&&(goog.html.SafeStyle.prototype.toString=function(){return"SafeStyle{"+this.privateDoNotAccessOrElseSafeStyleWrappedValue_+"}"});
|
|
goog.html.SafeStyle.unwrap=function(a){if(a instanceof goog.html.SafeStyle&&a.constructor===goog.html.SafeStyle&&a.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeStyleWrappedValue_;goog.asserts.fail("expected object of type SafeStyle, got '"+a+"' of type "+goog.typeOf(a));return"type_error:SafeStyle"};goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse=function(a){return(new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(a)};
|
|
goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a){this.privateDoNotAccessOrElseSafeStyleWrappedValue_=a;return this};goog.html.SafeStyle.EMPTY=goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse("");goog.html.SafeStyle.INNOCUOUS_STRING="zClosurez";
|
|
goog.html.SafeStyle.create=function(a){var b="",c;for(c in a){if(!/^[-_a-zA-Z0-9]+$/.test(c))throw Error("Name allows only [-_a-zA-Z0-9], got: "+c);var d=a[c];null!=d&&(d=goog.isArray(d)?goog.array.map(d,goog.html.SafeStyle.sanitizePropertyValue_).join(" "):goog.html.SafeStyle.sanitizePropertyValue_(d),b+=c+":"+d+";")}return b?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b):goog.html.SafeStyle.EMPTY};
|
|
goog.html.SafeStyle.sanitizePropertyValue_=function(a){if(a instanceof goog.html.SafeUrl)return'url("'+goog.html.SafeUrl.unwrap(a).replace(/</g,"%3c").replace(/[\\"]/g,"\\$&")+'")';a=a instanceof goog.string.Const?goog.string.Const.unwrap(a):goog.html.SafeStyle.sanitizePropertyValueString_(String(a));if(/[{;}]/.test(a))throw new goog.asserts.AssertionError("Value does not allow [{;}], got: %s.",[a]);return a};
|
|
goog.html.SafeStyle.sanitizePropertyValueString_=function(a){var b=a.replace(goog.html.SafeStyle.FUNCTIONS_RE_,"$1").replace(goog.html.SafeStyle.FUNCTIONS_RE_,"$1").replace(goog.html.SafeStyle.URL_RE_,"url");if(goog.html.SafeStyle.VALUE_RE_.test(b)){if(goog.html.SafeStyle.COMMENT_RE_.test(a))return goog.asserts.fail("String value disallows comments, got: "+a),goog.html.SafeStyle.INNOCUOUS_STRING;if(!goog.html.SafeStyle.hasBalancedQuotes_(a))return goog.asserts.fail("String value requires balanced quotes, got: "+
|
|
a),goog.html.SafeStyle.INNOCUOUS_STRING;if(!goog.html.SafeStyle.hasBalancedSquareBrackets_(a))return goog.asserts.fail("String value requires balanced square brackets and one identifier per pair of brackets, got: "+a),goog.html.SafeStyle.INNOCUOUS_STRING}else return goog.asserts.fail("String value allows only "+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+" and simple functions, got: "+a),goog.html.SafeStyle.INNOCUOUS_STRING;return goog.html.SafeStyle.sanitizeUrl_(a)};
|
|
goog.html.SafeStyle.hasBalancedQuotes_=function(a){for(var b=!0,c=!0,d=0;d<a.length;d++){var e=a.charAt(d);"'"==e&&c?b=!b:'"'==e&&b&&(c=!c)}return b&&c};goog.html.SafeStyle.hasBalancedSquareBrackets_=function(a){for(var b=!0,c=/^[-_a-zA-Z0-9]$/,d=0;d<a.length;d++){var e=a.charAt(d);if("]"==e){if(b)return!1;b=!0}else if("["==e){if(!b)return!1;b=!1}else if(!b&&!c.test(e))return!1}return b};goog.html.SafeStyle.VALUE_ALLOWED_CHARS_="[-,.\"'%_!# a-zA-Z0-9\\[\\]]";
|
|
goog.html.SafeStyle.VALUE_RE_=new RegExp("^"+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+"+$");goog.html.SafeStyle.URL_RE_=RegExp("\\b(url\\([ \t\n]*)('[ -&(-\\[\\]-~]*'|\"[ !#-\\[\\]-~]*\"|[!#-&*-\\[\\]-~]*)([ \t\n]*\\))","g");goog.html.SafeStyle.ALLOWED_FUNCTIONS_="calc cubic-bezier fit-content hsl hsla matrix minmax repeat rgb rgba (rotate|scale|translate)(X|Y|Z|3d)?".split(" ");
|
|
goog.html.SafeStyle.FUNCTIONS_RE_=new RegExp("\\b("+goog.html.SafeStyle.ALLOWED_FUNCTIONS_.join("|")+")\\([-+*/0-9a-z.%\\[\\], ]+\\)","g");goog.html.SafeStyle.COMMENT_RE_=/\/\*/;goog.html.SafeStyle.sanitizeUrl_=function(a){return a.replace(goog.html.SafeStyle.URL_RE_,function(a,c,d,e){var b="";d=d.replace(/^(['"])(.*)\1$/,function(a,c,d){b=c;return d});a=goog.html.SafeUrl.sanitize(d).getTypedStringValue();return c+b+a+b+e})};
|
|
goog.html.SafeStyle.concat=function(a){var b="",c=function(a){goog.isArray(a)?goog.array.forEach(a,c):b+=goog.html.SafeStyle.unwrap(a)};goog.array.forEach(arguments,c);return b?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b):goog.html.SafeStyle.EMPTY};goog.html.SafeStyleSheet=function(){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_="";this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString=!0;goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};
|
|
goog.html.SafeStyleSheet.createRule=function(a,b){if(goog.string.internal.contains(a,"<"))throw Error("Selector does not allow '<', got: "+a);var c=a.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g,"");if(!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(c))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+a);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(c))throw Error("() and [] in selector must be balanced, got: "+a);b instanceof goog.html.SafeStyle||(b=goog.html.SafeStyle.create(b));
|
|
c=a+"{"+goog.html.SafeStyle.unwrap(b).replace(/</g,"\\3C ")+"}";return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(c)};goog.html.SafeStyleSheet.hasBalancedBrackets_=function(a){for(var b={"(":")","[":"]"},c=[],d=0;d<a.length;d++){var e=a[d];if(b[e])c.push(b[e]);else if(goog.object.contains(b,e)&&c.pop()!=e)return!1}return 0==c.length};
|
|
goog.html.SafeStyleSheet.concat=function(a){var b="",c=function(a){goog.isArray(a)?goog.array.forEach(a,c):b+=goog.html.SafeStyleSheet.unwrap(a)};goog.array.forEach(arguments,c);return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)};
|
|
goog.html.SafeStyleSheet.fromConstant=function(a){a=goog.string.Const.unwrap(a);if(0===a.length)return goog.html.SafeStyleSheet.EMPTY;goog.asserts.assert(!goog.string.internal.contains(a,"<"),"Forbidden '<' character in style sheet string: "+a);return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeStyleSheet.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_};
|
|
goog.DEBUG&&(goog.html.SafeStyleSheet.prototype.toString=function(){return"SafeStyleSheet{"+this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_+"}"});
|
|
goog.html.SafeStyleSheet.unwrap=function(a){if(a instanceof goog.html.SafeStyleSheet&&a.constructor===goog.html.SafeStyleSheet&&a.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;goog.asserts.fail("expected object of type SafeStyleSheet, got '"+a+"' of type "+goog.typeOf(a));return"type_error:SafeStyleSheet"};
|
|
goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse=function(a){return(new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(a)};goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=a;return this};goog.html.SafeStyleSheet.EMPTY=goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse("");goog.html.SafeHtml=function(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_="";this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;this.dir_=null};goog.html.SafeHtml.ENABLE_ERROR_MESSAGES=goog.DEBUG;goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE=!0;goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.SafeHtml.prototype.getDirection=function(){return this.dir_};
|
|
goog.html.SafeHtml.prototype.implementsGoogStringTypedString=!0;goog.html.SafeHtml.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()};goog.DEBUG&&(goog.html.SafeHtml.prototype.toString=function(){return"SafeHtml{"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"});goog.html.SafeHtml.unwrap=function(a){return goog.html.SafeHtml.unwrapTrustedHTML(a).toString()};
|
|
goog.html.SafeHtml.unwrapTrustedHTML=function(a){if(a instanceof goog.html.SafeHtml&&a.constructor===goog.html.SafeHtml&&a.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeHtmlWrappedValue_;goog.asserts.fail("expected object of type SafeHtml, got '"+a+"' of type "+goog.typeOf(a));return"type_error:SafeHtml"};
|
|
goog.html.SafeHtml.htmlEscape=function(a){if(a instanceof goog.html.SafeHtml)return a;var b="object"==typeof a,c=null;b&&a.implementsGoogI18nBidiDirectionalString&&(c=a.getDirection());a=b&&a.implementsGoogStringTypedString?a.getTypedStringValue():String(a);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(a),c)};
|
|
goog.html.SafeHtml.htmlEscapePreservingNewlines=function(a){if(a instanceof goog.html.SafeHtml)return a;a=goog.html.SafeHtml.htmlEscape(a);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(a)),a.getDirection())};
|
|
goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces=function(a){if(a instanceof goog.html.SafeHtml)return a;a=goog.html.SafeHtml.htmlEscape(a);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(a)),a.getDirection())};goog.html.SafeHtml.from=goog.html.SafeHtml.htmlEscape;goog.html.SafeHtml.VALID_NAMES_IN_TAG_=/^[a-zA-Z0-9-]+$/;
|
|
goog.html.SafeHtml.URL_ATTRIBUTES_={action:!0,cite:!0,data:!0,formaction:!0,href:!0,manifest:!0,poster:!0,src:!0};goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_={APPLET:!0,BASE:!0,EMBED:!0,IFRAME:!0,LINK:!0,MATH:!0,META:!0,OBJECT:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0};goog.html.SafeHtml.create=function(a,b,c){goog.html.SafeHtml.verifyTagName(String(a));return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(a),b,c)};
|
|
goog.html.SafeHtml.verifyTagName=function(a){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(a))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Invalid tag name <"+a+">.":"");if(a.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Tag name <"+a+"> is not allowed for SafeHtml.":"");};
|
|
goog.html.SafeHtml.createIframe=function(a,b,c,d){a&&goog.html.TrustedResourceUrl.unwrap(a);var e={};e.src=a||null;e.srcdoc=b&&goog.html.SafeHtml.unwrap(b);a=goog.html.SafeHtml.combineAttributes(e,{sandbox:""},c);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",a,d)};
|
|
goog.html.SafeHtml.createSandboxIframe=function(a,b,c,d){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"The browser does not support sandboxed iframes.":"");var e={};e.src=a?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)):null;e.srcdoc=b||null;e.sandbox="";a=goog.html.SafeHtml.combineAttributes(e,{},c);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",a,d)};
|
|
goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype};goog.html.SafeHtml.createScriptSrc=function(a,b){goog.html.TrustedResourceUrl.unwrap(a);var c=goog.html.SafeHtml.combineAttributes({src:a},{},b);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",c)};
|
|
goog.html.SafeHtml.createScript=function(a,b){for(var c in b){var d=c.toLowerCase();if("language"==d||"src"==d||"text"==d||"type"==d)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot set "'+d+'" attribute':"");}c="";a=goog.array.concat(a);for(d=0;d<a.length;d++)c+=goog.html.SafeScript.unwrap(a[d]);c=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c,goog.i18n.bidi.Dir.NEUTRAL);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",b,c)};
|
|
goog.html.SafeHtml.createStyle=function(a,b){var c=goog.html.SafeHtml.combineAttributes({type:"text/css"},{},b),d="";a=goog.array.concat(a);for(var e=0;e<a.length;e++)d+=goog.html.SafeStyleSheet.unwrap(a[e]);d=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(d,goog.i18n.bidi.Dir.NEUTRAL);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style",c,d)};
|
|
goog.html.SafeHtml.createMetaRefresh=function(a,b){var c=goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a));(goog.labs.userAgent.browser.isIE()||goog.labs.userAgent.browser.isEdge())&&goog.string.internal.contains(c,";")&&(c="'"+c.replace(/'/g,"%27")+"'");return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta",{"http-equiv":"refresh",content:(b||0)+"; url="+c})};
|
|
goog.html.SafeHtml.getAttrNameAndValue_=function(a,b,c){if(c instanceof goog.string.Const)c=goog.string.Const.unwrap(c);else if("style"==b.toLowerCase())if(goog.html.SafeHtml.SUPPORT_STYLE_ATTRIBUTE)c=goog.html.SafeHtml.getStyleValue_(c);else throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Attribute "style" not supported.':"");else{if(/^on/i.test(b))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Attribute "'+b+'" requires goog.string.Const value, "'+c+'" given.':"");if(b.toLowerCase()in
|
|
goog.html.SafeHtml.URL_ATTRIBUTES_)if(c instanceof goog.html.TrustedResourceUrl)c=goog.html.TrustedResourceUrl.unwrap(c);else if(c instanceof goog.html.SafeUrl)c=goog.html.SafeUrl.unwrap(c);else if("string"===typeof c)c=goog.html.SafeUrl.sanitize(c).getTypedStringValue();else throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Attribute "'+b+'" on tag "'+a+'" requires goog.html.SafeUrl, goog.string.Const, or string, value "'+c+'" given.':"");}c.implementsGoogStringTypedString&&(c=c.getTypedStringValue());
|
|
goog.asserts.assert("string"===typeof c||"number"===typeof c,"String or number value expected, got "+typeof c+" with value: "+c);return b+'="'+goog.string.internal.htmlEscape(String(c))+'"'};goog.html.SafeHtml.getStyleValue_=function(a){if(!goog.isObject(a))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'The "style" attribute requires goog.html.SafeStyle or map of style properties, '+typeof a+" given: "+a:"");a instanceof goog.html.SafeStyle||(a=goog.html.SafeStyle.create(a));return goog.html.SafeStyle.unwrap(a)};
|
|
goog.html.SafeHtml.createWithDir=function(a,b,c,d){b=goog.html.SafeHtml.create(b,c,d);b.dir_=a;return b};
|
|
goog.html.SafeHtml.join=function(a,b){var c=goog.html.SafeHtml.htmlEscape(a),d=c.getDirection(),e=[],f=function(a){goog.isArray(a)?goog.array.forEach(a,f):(a=goog.html.SafeHtml.htmlEscape(a),e.push(goog.html.SafeHtml.unwrap(a)),a=a.getDirection(),d==goog.i18n.bidi.Dir.NEUTRAL?d=a:a!=goog.i18n.bidi.Dir.NEUTRAL&&d!=a&&(d=null))};goog.array.forEach(b,f);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e.join(goog.html.SafeHtml.unwrap(c)),d)};
|
|
goog.html.SafeHtml.concat=function(a){return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY,Array.prototype.slice.call(arguments))};goog.html.SafeHtml.concatWithDir=function(a,b){var c=goog.html.SafeHtml.concat(goog.array.slice(arguments,1));c.dir_=a;return c};goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse=function(a,b){return(new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(a,b)};
|
|
goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a,b){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(a):a;this.dir_=b;return this};
|
|
goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse=function(a,b,c){var d=null;var e="<"+a+goog.html.SafeHtml.stringifyAttributes(a,b);null==c?c=[]:goog.isArray(c)||(c=[c]);goog.dom.tags.isVoidTag(a.toLowerCase())?(goog.asserts.assert(!c.length,"Void tag <"+a+"> does not allow content."),e+=">"):(d=goog.html.SafeHtml.concat(c),e+=">"+goog.html.SafeHtml.unwrap(d)+"</"+a+">",d=d.getDirection());(a=b&&b.dir)&&(d=/^(ltr|rtl|auto)$/i.test(a)?goog.i18n.bidi.Dir.NEUTRAL:null);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e,
|
|
d)};goog.html.SafeHtml.stringifyAttributes=function(a,b){var c="";if(b)for(var d in b){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(d))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Invalid attribute name "'+d+'".':"");var e=b[d];null!=e&&(c+=" "+goog.html.SafeHtml.getAttrNameAndValue_(a,d,e))}return c};
|
|
goog.html.SafeHtml.combineAttributes=function(a,b,c){var d={},e;for(e in a)goog.asserts.assert(e.toLowerCase()==e,"Must be lower case"),d[e]=a[e];for(e in b)goog.asserts.assert(e.toLowerCase()==e,"Must be lower case"),d[e]=b[e];if(c)for(e in c){var f=e.toLowerCase();if(f in a)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot override "'+f+'" attribute, got "'+e+'" with value "'+c[e]+'"':"");f in b&&delete d[f];d[e]=c[e]}return d};
|
|
goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>",goog.i18n.bidi.Dir.NEUTRAL);goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL);goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>",goog.i18n.bidi.Dir.NEUTRAL);goog.html.uncheckedconversions={};goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(a,b,c){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(b,c||null)};
|
|
goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(b)};
|
|
goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b)};
|
|
goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)};
|
|
goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)};
|
|
goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)};goog.dom.safe={};goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"};goog.dom.safe.insertAdjacentHtml=function(a,b,c){a.insertAdjacentHTML(b,goog.html.SafeHtml.unwrapTrustedHTML(c))};goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0};
|
|
goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue(function(){if(goog.DEBUG&&"undefined"===typeof document)return!1;var a=document.createElement("div"),b=document.createElement("div");b.appendChild(document.createElement("div"));a.appendChild(b);if(goog.DEBUG&&!a.firstChild)return!1;b=a.firstChild.firstChild;a.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY);return!b.parentElement});
|
|
goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(a,b){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;a.lastChild;)a.removeChild(a.lastChild);a.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(b)};
|
|
goog.dom.safe.setInnerHtml=function(a,b){if(goog.asserts.ENABLE_ASSERTS){var c=a.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[c])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+a.tagName+".");}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(a,b)};goog.dom.safe.setOuterHtml=function(a,b){a.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(b)};
|
|
goog.dom.safe.setFormElementAction=function(a,b){var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLFormElement(a).action=goog.html.SafeUrl.unwrap(c)};goog.dom.safe.setButtonFormAction=function(a,b){var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLButtonElement(a).formAction=goog.html.SafeUrl.unwrap(c)};
|
|
goog.dom.safe.setInputFormAction=function(a,b){var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLInputElement(a).formAction=goog.html.SafeUrl.unwrap(c)};goog.dom.safe.setStyle=function(a,b){a.style.cssText=goog.html.SafeStyle.unwrap(b)};goog.dom.safe.documentWrite=function(a,b){a.write(goog.html.SafeHtml.unwrapTrustedHTML(b))};
|
|
goog.dom.safe.setAnchorHref=function(a,b){goog.dom.asserts.assertIsHTMLAnchorElement(a);var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.href=goog.html.SafeUrl.unwrap(c)};goog.dom.safe.setImageSrc=function(a,b){goog.dom.asserts.assertIsHTMLImageElement(a);if(b instanceof goog.html.SafeUrl)var c=b;else c=/^data:image\//i.test(b),c=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c);a.src=goog.html.SafeUrl.unwrap(c)};
|
|
goog.dom.safe.setAudioSrc=function(a,b){goog.dom.asserts.assertIsHTMLAudioElement(a);if(b instanceof goog.html.SafeUrl)var c=b;else c=/^data:audio\//i.test(b),c=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c);a.src=goog.html.SafeUrl.unwrap(c)};goog.dom.safe.setVideoSrc=function(a,b){goog.dom.asserts.assertIsHTMLVideoElement(a);if(b instanceof goog.html.SafeUrl)var c=b;else c=/^data:video\//i.test(b),c=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c);a.src=goog.html.SafeUrl.unwrap(c)};
|
|
goog.dom.safe.setEmbedSrc=function(a,b){goog.dom.asserts.assertIsHTMLEmbedElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)};goog.dom.safe.setFrameSrc=function(a,b){goog.dom.asserts.assertIsHTMLFrameElement(a);a.src=goog.html.TrustedResourceUrl.unwrap(b)};goog.dom.safe.setIframeSrc=function(a,b){goog.dom.asserts.assertIsHTMLIFrameElement(a);a.src=goog.html.TrustedResourceUrl.unwrap(b)};
|
|
goog.dom.safe.setIframeSrcdoc=function(a,b){goog.dom.asserts.assertIsHTMLIFrameElement(a);a.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(b)};
|
|
goog.dom.safe.setLinkHrefAndRel=function(a,b,c){goog.dom.asserts.assertIsHTMLLinkElement(a);a.rel=c;goog.string.internal.caseInsensitiveContains(c,"stylesheet")?(goog.asserts.assert(b instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),a.href=goog.html.TrustedResourceUrl.unwrap(b)):a.href=b instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(b):b instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(b):goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(b))};
|
|
goog.dom.safe.setObjectData=function(a,b){goog.dom.asserts.assertIsHTMLObjectElement(a);a.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)};goog.dom.safe.setScriptSrc=function(a,b){goog.dom.asserts.assertIsHTMLScriptElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);var c=goog.getScriptNonce();c&&a.setAttribute("nonce",c)};
|
|
goog.dom.safe.setScriptContent=function(a,b){goog.dom.asserts.assertIsHTMLScriptElement(a);a.text=goog.html.SafeScript.unwrapTrustedScript(b);var c=goog.getScriptNonce();c&&a.setAttribute("nonce",c)};goog.dom.safe.setLocationHref=function(a,b){goog.dom.asserts.assertIsLocation(a);var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.href=goog.html.SafeUrl.unwrap(c)};
|
|
goog.dom.safe.assignLocation=function(a,b){goog.dom.asserts.assertIsLocation(a);var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.assign(goog.html.SafeUrl.unwrap(c))};goog.dom.safe.replaceLocation=function(a,b){goog.dom.asserts.assertIsLocation(a);var c=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.replace(goog.html.SafeUrl.unwrap(c))};
|
|
goog.dom.safe.openInWindow=function(a,b,c,d,e){a=a instanceof goog.html.SafeUrl?a:goog.html.SafeUrl.sanitizeAssertUnchanged(a);return(b||goog.global).open(goog.html.SafeUrl.unwrap(a),c?goog.string.Const.unwrap(c):"",d,e)};goog.dom.safe.parseFromStringHtml=function(a,b){return goog.dom.safe.parseFromString(a,b,"text/html")};goog.dom.safe.parseFromString=function(a,b,c){return a.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(b),c)};
|
|
goog.dom.safe.createImageFromBlob=function(a){if(!/^image\/.*/g.test(a.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var b=goog.global.URL.createObjectURL(a);a=new goog.global.Image;a.onload=function(){goog.global.URL.revokeObjectURL(b)};goog.dom.safe.setImageSrc(a,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),b));return a};goog.string.DETECT_DOUBLE_ESCAPING=!1;goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1;goog.string.Unicode={NBSP:"\u00a0"};goog.string.startsWith=goog.string.internal.startsWith;goog.string.endsWith=goog.string.internal.endsWith;goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith;goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith;goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals;
|
|
goog.string.subs=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")};goog.string.collapseWhitespace=function(a){return a.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")};goog.string.isEmptyOrWhitespace=goog.string.internal.isEmptyOrWhitespace;goog.string.isEmptyString=function(a){return 0==a.length};goog.string.isEmpty=goog.string.isEmptyOrWhitespace;goog.string.isEmptyOrWhitespaceSafe=function(a){return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(a))};
|
|
goog.string.isEmptySafe=goog.string.isEmptyOrWhitespaceSafe;goog.string.isBreakingWhitespace=function(a){return!/[^\t\n\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return" "==a};goog.string.isUnicodeChar=function(a){return 1==a.length&&" "<=a&&"~">=a||"\u0080"<=a&&"\ufffd">=a};
|
|
goog.string.stripNewlines=function(a){return a.replace(/(\r\n|\r|\n)+/g," ")};goog.string.canonicalizeNewlines=function(a){return a.replace(/(\r\n|\r|\n)/g,"\n")};goog.string.normalizeWhitespace=function(a){return a.replace(/\xa0|\s/g," ")};goog.string.normalizeSpaces=function(a){return a.replace(/\xa0|[ \t]+/g," ")};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")};goog.string.trim=goog.string.internal.trim;
|
|
goog.string.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,"")};goog.string.trimRight=function(a){return a.replace(/[\s\xa0]+$/,"")};goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare;
|
|
goog.string.numberAwareCompare_=function(a,b,c){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var d=a.toLowerCase().match(c),e=b.toLowerCase().match(c),f=Math.min(d.length,e.length),g=0;g<f;g++){c=d[g];var h=e[g];if(c!=h)return a=parseInt(c,10),!isNaN(a)&&(b=parseInt(h,10),!isNaN(b)&&a-b)?a-b:c<h?-1:1}return d.length!=e.length?d.length-e.length:a<b?-1:1};goog.string.intAwareCompare=function(a,b){return goog.string.numberAwareCompare_(a,b,/\d+|\D+/g)};
|
|
goog.string.floatAwareCompare=function(a,b){return goog.string.numberAwareCompare_(a,b,/\d+|\.\d+|\D+/g)};goog.string.numerateCompare=goog.string.floatAwareCompare;goog.string.urlEncode=function(a){return encodeURIComponent(String(a))};goog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\+/g," "))};goog.string.newLineToBr=goog.string.internal.newLineToBr;
|
|
goog.string.htmlEscape=function(a,b){a=goog.string.internal.htmlEscape(a,b);goog.string.DETECT_DOUBLE_ESCAPING&&(a=a.replace(goog.string.E_RE_,"e"));return a};goog.string.E_RE_=/e/g;goog.string.unescapeEntities=function(a){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};
|
|
goog.string.unescapeEntitiesWithDocument=function(a,b){return goog.string.contains(a,"&")?goog.string.unescapeEntitiesUsingDom_(a,b):a};
|
|
goog.string.unescapeEntitiesUsingDom_=function(a,b){var c={"&":"&","<":"<",">":">",""":'"'};var d=b?b.createElement("div"):goog.global.document.createElement("div");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(a,b){var e=c[a];if(e)return e;if("#"==b.charAt(0)){var f=Number("0"+b.substr(1));isNaN(f)||(e=String.fromCharCode(f))}e||(goog.dom.safe.setInnerHtml(d,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),
|
|
a+" ")),e=d.firstChild.nodeValue.slice(0,-1));return c[a]=e})};goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(a,c){switch(c){case "amp":return"&";case "lt":return"<";case "gt":return">";case "quot":return'"';default:if("#"==c.charAt(0)){var b=Number("0"+c.substr(1));if(!isNaN(b))return String.fromCharCode(b)}return a}})};goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g;
|
|
goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g,"  "),b)};goog.string.preserveSpaces=function(a){return a.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)};goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;d<c;d++){var e=1==c?b:b.charAt(d);if(a.charAt(0)==e&&a.charAt(a.length-1)==e)return a.substring(1,a.length-1)}return a};
|
|
goog.string.truncate=function(a,b,c){c&&(a=goog.string.unescapeEntities(a));a.length>b&&(a=a.substring(0,b-3)+"...");c&&(a=goog.string.htmlEscape(a));return a};goog.string.truncateMiddle=function(a,b,c,d){c&&(a=goog.string.unescapeEntities(a));if(d&&a.length>b){d>b&&(d=b);var e=a.length-d;a=a.substring(0,b-d)+"..."+a.substring(e)}else a.length>b&&(d=Math.floor(b/2),e=a.length-d,a=a.substring(0,d+b%2)+"..."+a.substring(e));c&&(a=goog.string.htmlEscape(a));return a};
|
|
goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"};goog.string.jsEscapeCache_={"'":"\\'"};goog.string.quote=function(a){a=String(a);for(var b=['"'],c=0;c<a.length;c++){var d=a.charAt(c),e=d.charCodeAt(0);b[c+1]=goog.string.specialEscapeChars_[d]||(31<e&&127>e?d:goog.string.escapeChar(d))}b.push('"');return b.join("")};
|
|
goog.string.escapeString=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=goog.string.escapeChar(a.charAt(c));return b.join("")};
|
|
goog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var b=a.charCodeAt(0);if(31<b&&127>b)var c=a;else{if(256>b){if(c="\\x",16>b||256<b)c+="0"}else c="\\u",4096>b&&(c+="0");c+=b.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=c};goog.string.contains=goog.string.internal.contains;goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains;
|
|
goog.string.countOf=function(a,b){return a&&b?a.split(b).length-1:0};goog.string.removeAt=function(a,b,c){var d=a;0<=b&&b<a.length&&0<c&&(d=a.substr(0,b)+a.substr(b+c,a.length-b-c));return d};goog.string.remove=function(a,b){return a.replace(b,"")};goog.string.removeAll=function(a,b){var c=new RegExp(goog.string.regExpEscape(b),"g");return a.replace(c,"")};goog.string.replaceAll=function(a,b,c){b=new RegExp(goog.string.regExpEscape(b),"g");return a.replace(b,c.replace(/\$/g,"$$$$"))};
|
|
goog.string.regExpEscape=function(a){return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")};goog.string.repeat=String.prototype.repeat?function(a,b){return a.repeat(b)}:function(a,b){return Array(b+1).join(a)};goog.string.padNumber=function(a,b,c){a=void 0!==c?a.toFixed(c):String(a);c=a.indexOf(".");-1==c&&(c=a.length);return goog.string.repeat("0",Math.max(0,b-c))+a};goog.string.makeSafe=function(a){return null==a?"":String(a)};
|
|
goog.string.buildString=function(a){return Array.prototype.join.call(arguments,"")};goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)};goog.string.compareVersions=goog.string.internal.compareVersions;goog.string.hashCode=function(a){for(var b=0,c=0;c<a.length;++c)b=31*b+a.charCodeAt(c)>>>0;return b};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;
|
|
goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++};goog.string.toNumber=function(a){var b=Number(a);return 0==b&&goog.string.isEmptyOrWhitespace(a)?NaN:b};goog.string.isLowerCamelCase=function(a){return/^[a-z]+([A-Z][a-z]*)*$/.test(a)};goog.string.isUpperCamelCase=function(a){return/^([A-Z][a-z]*)+$/.test(a)};goog.string.toCamelCase=function(a){return String(a).replace(/\-([a-z])/g,function(a,c){return c.toUpperCase()})};
|
|
goog.string.toSelectorCase=function(a){return String(a).replace(/([A-Z])/g,"-$1").toLowerCase()};goog.string.toTitleCase=function(a,b){var c="string"===typeof b?goog.string.regExpEscape(b):"\\s";return a.replace(new RegExp("(^"+(c?"|["+c+"]+":"")+")([a-z])","g"),function(a,b,c){return b+c.toUpperCase()})};goog.string.capitalize=function(a){return String(a.charAt(0)).toUpperCase()+String(a.substr(1)).toLowerCase()};
|
|
goog.string.parseInt=function(a){isFinite(a)&&(a=String(a));return"string"===typeof a?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN};goog.string.splitLimit=function(a,b,c){a=a.split(b);for(var d=[];0<c&&a.length;)d.push(a.shift()),c--;a.length&&d.push(a.join(b));return d};goog.string.lastComponent=function(a,b){if(b)"string"==typeof b&&(b=[b]);else return a;for(var c=-1,d=0;d<b.length;d++)if(""!=b[d]){var e=a.lastIndexOf(b[d]);e>c&&(c=e)}return-1==c?a:a.slice(c+1)};
|
|
goog.string.editDistance=function(a,b){var c=[],d=[];if(a==b)return 0;if(!a.length||!b.length)return Math.max(a.length,b.length);for(var e=0;e<b.length+1;e++)c[e]=e;for(e=0;e<a.length;e++){d[0]=e+1;for(var f=0;f<b.length;f++)d[f+1]=Math.min(d[f]+1,c[f+1]+1,c[f]+Number(a[e]!=b[f]));for(f=0;f<c.length;f++)c[f]=d[f]}return d[b.length]};goog.labs.userAgent.engine={};goog.labs.userAgent.engine.isPresto=function(){return goog.labs.userAgent.util.matchUserAgent("Presto")};goog.labs.userAgent.engine.isTrident=function(){return goog.labs.userAgent.util.matchUserAgent("Trident")||goog.labs.userAgent.util.matchUserAgent("MSIE")};goog.labs.userAgent.engine.isEdge=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")};
|
|
goog.labs.userAgent.engine.isWebKit=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit")&&!goog.labs.userAgent.engine.isEdge()};goog.labs.userAgent.engine.isGecko=function(){return goog.labs.userAgent.util.matchUserAgent("Gecko")&&!goog.labs.userAgent.engine.isWebKit()&&!goog.labs.userAgent.engine.isTrident()&&!goog.labs.userAgent.engine.isEdge()};
|
|
goog.labs.userAgent.engine.getVersion=function(){var a=goog.labs.userAgent.util.getUserAgent();if(a){a=goog.labs.userAgent.util.extractVersionTuples(a);var b=goog.labs.userAgent.engine.getEngineTuple_(a);if(b)return"Gecko"==b[0]?goog.labs.userAgent.engine.getVersionForKey_(a,"Firefox"):b[1];a=a[0];var c;if(a&&(c=a[2])&&(c=/Trident\/([^\s;]+)/.exec(c)))return c[1]}return""};
|
|
goog.labs.userAgent.engine.getEngineTuple_=function(a){if(!goog.labs.userAgent.engine.isEdge())return a[1];for(var b=0;b<a.length;b++){var c=a[b];if("Edge"==c[0])return c}};goog.labs.userAgent.engine.isVersionOrHigher=function(a){return 0<=goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(),a)};goog.labs.userAgent.engine.getVersionForKey_=function(a,b){var c=goog.array.find(a,function(a){return b==a[0]});return c&&c[1]||""};goog.labs.userAgent.platform={};goog.labs.userAgent.platform.isAndroid=function(){return goog.labs.userAgent.util.matchUserAgent("Android")};goog.labs.userAgent.platform.isIpod=function(){return goog.labs.userAgent.util.matchUserAgent("iPod")};goog.labs.userAgent.platform.isIphone=function(){return goog.labs.userAgent.util.matchUserAgent("iPhone")&&!goog.labs.userAgent.util.matchUserAgent("iPod")&&!goog.labs.userAgent.util.matchUserAgent("iPad")};goog.labs.userAgent.platform.isIpad=function(){return goog.labs.userAgent.util.matchUserAgent("iPad")};
|
|
goog.labs.userAgent.platform.isIos=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpad()||goog.labs.userAgent.platform.isIpod()};goog.labs.userAgent.platform.isMacintosh=function(){return goog.labs.userAgent.util.matchUserAgent("Macintosh")};goog.labs.userAgent.platform.isLinux=function(){return goog.labs.userAgent.util.matchUserAgent("Linux")};goog.labs.userAgent.platform.isWindows=function(){return goog.labs.userAgent.util.matchUserAgent("Windows")};
|
|
goog.labs.userAgent.platform.isChromeOS=function(){return goog.labs.userAgent.util.matchUserAgent("CrOS")};goog.labs.userAgent.platform.isChromecast=function(){return goog.labs.userAgent.util.matchUserAgent("CrKey")};goog.labs.userAgent.platform.isKaiOS=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("KaiOS")};goog.labs.userAgent.platform.isGo2Phone=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase("GAFP")};
|
|
goog.labs.userAgent.platform.getVersion=function(){var a=goog.labs.userAgent.util.getUserAgent(),b="";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.isKaiOS()?(b=/(?:KaiOS)\/(\S+)/i,
|
|
b=(a=b.exec(a))&&a[1]):goog.labs.userAgent.platform.isAndroid()?(b=/Android\s+([^\);]+)(\)|;)/,b=(a=b.exec(a))&&a[1]):goog.labs.userAgent.platform.isChromeOS()&&(b=/(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/,b=(a=b.exec(a))&&a[1]);return b||""};goog.labs.userAgent.platform.isVersionOrHigher=function(a){return 0<=goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(),a)};goog.reflect={};goog.reflect.object=function(a,b){return b};goog.reflect.objectProperty=function(a,b){return a};goog.reflect.sinkValue=function(a){goog.reflect.sinkValue[" "](a);return a};goog.reflect.sinkValue[" "]=goog.nullFunction;goog.reflect.canAccessProperty=function(a,b){try{return goog.reflect.sinkValue(a[b]),!0}catch(c){}return!1};goog.reflect.cache=function(a,b,c,d){d=d?d(b):b;return Object.prototype.hasOwnProperty.call(a,d)?a[d]:a[d]=c(b)};goog.userAgent={};goog.userAgent.ASSUME_IE=!1;goog.userAgent.ASSUME_EDGE=!1;goog.userAgent.ASSUME_GECKO=!1;goog.userAgent.ASSUME_WEBKIT=!1;goog.userAgent.ASSUME_MOBILE_WEBKIT=!1;goog.userAgent.ASSUME_OPERA=!1;goog.userAgent.ASSUME_ANY_VERSION=!1;goog.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;goog.userAgent.getUserAgentString=function(){return goog.labs.userAgent.util.getUserAgent()};
|
|
goog.userAgent.getNavigatorTyped=function(){return goog.global.navigator||null};goog.userAgent.getNavigator=function(){return goog.userAgent.getNavigatorTyped()};goog.userAgent.OPERA=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_OPERA:goog.labs.userAgent.browser.isOpera();goog.userAgent.IE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_IE:goog.labs.userAgent.browser.isIE();goog.userAgent.EDGE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_EDGE:goog.labs.userAgent.engine.isEdge();
|
|
goog.userAgent.EDGE_OR_IE=goog.userAgent.EDGE||goog.userAgent.IE;goog.userAgent.GECKO=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_GECKO:goog.labs.userAgent.engine.isGecko();goog.userAgent.WEBKIT=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_MOBILE_WEBKIT:goog.labs.userAgent.engine.isWebKit();goog.userAgent.isMobile_=function(){return goog.userAgent.WEBKIT&&goog.labs.userAgent.util.matchUserAgent("Mobile")};
|
|
goog.userAgent.MOBILE=goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.isMobile_();goog.userAgent.SAFARI=goog.userAgent.WEBKIT;goog.userAgent.determinePlatform_=function(){var a=goog.userAgent.getNavigatorTyped();return a&&a.platform||""};goog.userAgent.PLATFORM=goog.userAgent.determinePlatform_();goog.userAgent.ASSUME_MAC=!1;goog.userAgent.ASSUME_WINDOWS=!1;goog.userAgent.ASSUME_LINUX=!1;goog.userAgent.ASSUME_X11=!1;goog.userAgent.ASSUME_ANDROID=!1;goog.userAgent.ASSUME_IPHONE=!1;
|
|
goog.userAgent.ASSUME_IPAD=!1;goog.userAgent.ASSUME_IPOD=!1;goog.userAgent.ASSUME_KAIOS=!1;goog.userAgent.ASSUME_GO2PHONE=!1;goog.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;goog.userAgent.MAC=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_MAC:goog.labs.userAgent.platform.isMacintosh();
|
|
goog.userAgent.WINDOWS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_WINDOWS:goog.labs.userAgent.platform.isWindows();goog.userAgent.isLegacyLinux_=function(){return goog.labs.userAgent.platform.isLinux()||goog.labs.userAgent.platform.isChromeOS()};goog.userAgent.LINUX=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_LINUX:goog.userAgent.isLegacyLinux_();goog.userAgent.isX11_=function(){var a=goog.userAgent.getNavigatorTyped();return!!a&&goog.string.contains(a.appVersion||"","X11")};
|
|
goog.userAgent.X11=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_X11:goog.userAgent.isX11_();goog.userAgent.ANDROID=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_ANDROID:goog.labs.userAgent.platform.isAndroid();goog.userAgent.IPHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE:goog.labs.userAgent.platform.isIphone();goog.userAgent.IPAD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad();
|
|
goog.userAgent.IPOD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIpod();goog.userAgent.IOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIos();goog.userAgent.KAIOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_KAIOS:goog.labs.userAgent.platform.isKaiOS();goog.userAgent.GO2PHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_GO2PHONE:goog.labs.userAgent.platform.isGo2Phone();
|
|
goog.userAgent.determineVersion_=function(){var a="",b=goog.userAgent.getVersionRegexResult_();b&&(a=b?b[1]:"");return goog.userAgent.IE&&(b=goog.userAgent.getDocumentMode_(),null!=b&&b>parseFloat(a))?String(b):a};
|
|
goog.userAgent.getVersionRegexResult_=function(){var a=goog.userAgent.getUserAgentString();if(goog.userAgent.GECKO)return/rv:([^\);]+)(\)|;)/.exec(a);if(goog.userAgent.EDGE)return/Edge\/([\d\.]+)/.exec(a);if(goog.userAgent.IE)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(goog.userAgent.WEBKIT)return/WebKit\/(\S+)/.exec(a);if(goog.userAgent.OPERA)return/(?:Version)[ \/]?(\S+)/.exec(a)};goog.userAgent.getDocumentMode_=function(){var a=goog.global.document;return a?a.documentMode:void 0};
|
|
goog.userAgent.VERSION=goog.userAgent.determineVersion_();goog.userAgent.compare=function(a,b){return goog.string.compareVersions(a,b)};goog.userAgent.isVersionOrHigherCache_={};goog.userAgent.isVersionOrHigher=function(a){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,a,function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,a)})};goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher;
|
|
goog.userAgent.isDocumentModeOrHigher=function(a){return Number(goog.userAgent.DOCUMENT_MODE)>=a};goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher;goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE)return goog.userAgent.getDocumentMode_()}();goog.debug.LOGGING_ENABLED=goog.DEBUG;goog.debug.FORCE_SLOPPY_STACKS=!1;goog.debug.catchErrors=function(a,b,c){c=c||goog.global;var d=c.onerror,e=!!b;goog.userAgent.WEBKIT&&!goog.userAgent.isVersionOrHigher("535.3")&&(e=!e);c.onerror=function(b,c,h,k,l){d&&d(b,c,h,k,l);a({message:b,fileName:c,line:h,lineNumber:h,col:k,error:l});return e}};
|
|
goog.debug.expose=function(a,b){if("undefined"==typeof a)return"undefined";if(null==a)return"NULL";var c=[],d;for(d in a)if(b||!goog.isFunction(a[d])){var e=d+" = ";try{e+=a[d]}catch(f){e+="*** "+f+" ***"}c.push(e)}return c.join("\n")};
|
|
goog.debug.deepExpose=function(a,b){var c=[],d=[],e={},f=function(a,g){var h=g+" ";try{if(void 0===a)c.push("undefined");else if(null===a)c.push("NULL");else if("string"===typeof a)c.push('"'+a.replace(/\n/g,"\n"+g)+'"');else if(goog.isFunction(a))c.push(String(a).replace(/\n/g,"\n"+g));else if(goog.isObject(a)){goog.hasUid(a)||d.push(a);var k=goog.getUid(a);if(e[k])c.push("*** reference loop detected (id="+k+") ***");else{e[k]=!0;c.push("{");for(var n in a)if(b||!goog.isFunction(a[n]))c.push("\n"),
|
|
c.push(h),c.push(n+" = "),f(a[n],h);c.push("\n"+g+"}");delete e[k]}}else c.push(a)}catch(p){c.push("*** "+p+" ***")}};f(a,"");for(var g=0;g<d.length;g++)goog.removeUid(d[g]);return c.join("")};goog.debug.exposeArray=function(a){for(var b=[],c=0;c<a.length;c++)goog.isArray(a[c])?b.push(goog.debug.exposeArray(a[c])):b.push(a[c]);return"[ "+b.join(", ")+" ]"};
|
|
goog.debug.normalizeErrorObject=function(a){var b=goog.getObjectByName("window.location.href");null==a&&(a='Unknown Error of type "null/undefined"');if("string"===typeof a)return{message:a,name:"Unknown error",lineNumber:"Not available",fileName:b,stack:"Not available"};var c=!1;try{var d=a.lineNumber||a.line||"Not available"}catch(f){d="Not available",c=!0}try{var e=a.fileName||a.filename||a.sourceURL||goog.global.$googDebugFname||b}catch(f){e="Not available",c=!0}return!c&&a.lineNumber&&a.fileName&&
|
|
a.stack&&a.message&&a.name?a:(b=a.message,null==b&&(b=a.constructor&&a.constructor instanceof Function?'Unknown Error of type "'+(a.constructor.name?a.constructor.name:goog.debug.getFunctionName(a.constructor))+'"':"Unknown Error of unknown type"),{message:b,name:a.name||"UnknownError",lineNumber:d,fileName:e,stack:a.stack||"Not available"})};
|
|
goog.debug.enhanceError=function(a,b){if(a instanceof Error)var c=a;else c=Error(a),Error.captureStackTrace&&Error.captureStackTrace(c,goog.debug.enhanceError);c.stack||(c.stack=goog.debug.getStacktrace(goog.debug.enhanceError));if(b){for(var d=0;c["message"+d];)++d;c["message"+d]=String(b)}return c};goog.debug.enhanceErrorWithContext=function(a,b){var c=goog.debug.enhanceError(a);if(b)for(var d in b)goog.debug.errorcontext.addErrorContext(c,d,b[d]);return c};
|
|
goog.debug.getStacktraceSimple=function(a){if(!goog.debug.FORCE_SLOPPY_STACKS){var b=goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);if(b)return b}b=[];for(var c=arguments.callee.caller,d=0;c&&(!a||d<a);){b.push(goog.debug.getFunctionName(c));b.push("()\n");try{c=c.caller}catch(e){b.push("[exception trying to get caller]\n");break}d++;if(d>=goog.debug.MAX_STACK_DEPTH){b.push("[...long stack...]");break}}a&&d>=a?b.push("[...reached max depth limit...]"):b.push("[end]");return b.join("")};
|
|
goog.debug.MAX_STACK_DEPTH=50;goog.debug.getNativeStackTrace_=function(a){var b=Error();if(Error.captureStackTrace)return Error.captureStackTrace(b,a),String(b.stack);try{throw b;}catch(c){b=c}return(a=b.stack)?String(a):null};goog.debug.getStacktrace=function(a){var b;goog.debug.FORCE_SLOPPY_STACKS||(b=goog.debug.getNativeStackTrace_(a||goog.debug.getStacktrace));b||(b=goog.debug.getStacktraceHelper_(a||arguments.callee.caller,[]));return b};
|
|
goog.debug.getStacktraceHelper_=function(a,b){var c=[];if(goog.array.contains(b,a))c.push("[...circular reference...]");else if(a&&b.length<goog.debug.MAX_STACK_DEPTH){c.push(goog.debug.getFunctionName(a)+"(");for(var d=a.arguments,e=0;d&&e<d.length;e++){0<e&&c.push(", ");var f=d[e];switch(typeof f){case "object":f=f?"object":"null";break;case "string":break;case "number":f=String(f);break;case "boolean":f=f?"true":"false";break;case "function":f=(f=goog.debug.getFunctionName(f))?f:"[fn]";break;default:f=
|
|
typeof f}40<f.length&&(f=f.substr(0,40)+"...");c.push(f)}b.push(a);c.push(")\n");try{c.push(goog.debug.getStacktraceHelper_(a.caller,b))}catch(g){c.push("[exception trying to get caller]\n")}}else a?c.push("[...long stack...]"):c.push("[end]");return c.join("")};goog.debug.getFunctionName=function(a){if(goog.debug.fnNameCache_[a])return goog.debug.fnNameCache_[a];a=String(a);if(!goog.debug.fnNameCache_[a]){var b=/function\s+([^\(]+)/m.exec(a);goog.debug.fnNameCache_[a]=b?b[1]:"[Anonymous]"}return goog.debug.fnNameCache_[a]};
|
|
goog.debug.makeWhitespaceVisible=function(a){return a.replace(/ /g,"[_]").replace(/\f/g,"[f]").replace(/\n/g,"[n]\n").replace(/\r/g,"[r]").replace(/\t/g,"[t]")};goog.debug.runtimeType=function(a){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};goog.debug.fnNameCache_={};goog.debug.freezeInternal_=goog.DEBUG&&Object.freeze||function(a){return a};
|
|
goog.debug.freeze=function(a){return goog.debug.freezeInternal_(a)};goog.events={};$jscomp.scope.purify=function(a){return{valueOf:a}.valueOf()};
|
|
goog.events.BrowserFeature={HAS_W3C_BUTTON:!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9),HAS_W3C_EVENT_SUPPORT:!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9),SET_KEY_CODE_TO_PREVENT_DEFAULT:goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9"),HAS_NAVIGATOR_ONLINE_PROPERTY:!goog.userAgent.WEBKIT||goog.userAgent.isVersionOrHigher("528"),HAS_HTML5_NETWORK_EVENT_SUPPORT:goog.userAgent.GECKO&&goog.userAgent.isVersionOrHigher("1.9b")||goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("8")||
|
|
goog.userAgent.OPERA&&goog.userAgent.isVersionOrHigher("9.5")||goog.userAgent.WEBKIT&&goog.userAgent.isVersionOrHigher("528"),HTML5_NETWORK_EVENTS_FIRE_ON_BODY:goog.userAgent.GECKO&&!goog.userAgent.isVersionOrHigher("8")||goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9"),TOUCH_ENABLED:"ontouchstart"in goog.global||!!(goog.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!goog.global.navigator||!goog.global.navigator.maxTouchPoints&&!goog.global.navigator.msMaxTouchPoints),
|
|
POINTER_EVENTS:"PointerEvent"in goog.global,MSPOINTER_EVENTS:"MSPointerEvent"in goog.global&&!(!goog.global.navigator||!goog.global.navigator.msPointerEnabled),PASSIVE_EVENTS:(0,$jscomp.scope.purify)(function(){if(!goog.global.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{goog.global.addEventListener("test",goog.nullFunction,b),goog.global.removeEventListener("test",goog.nullFunction,b)}catch(c){}return a})};goog.disposable={};goog.disposable.IDisposable=function(){};goog.disposable.IDisposable.prototype.dispose=goog.abstractMethod;goog.disposable.IDisposable.prototype.isDisposed=goog.abstractMethod;goog.Disposable=function(){goog.Disposable.MONITORING_MODE!=goog.Disposable.MonitoringMode.OFF&&(goog.Disposable.INCLUDE_STACK_ON_CREATION&&(this.creationStack=Error().stack),goog.Disposable.instances_[goog.getUid(this)]=this);this.disposed_=this.disposed_;this.onDisposeCallbacks_=this.onDisposeCallbacks_};goog.Disposable.MonitoringMode={OFF:0,PERMANENT:1,INTERACTIVE:2};goog.Disposable.MONITORING_MODE=0;goog.Disposable.INCLUDE_STACK_ON_CREATION=!0;goog.Disposable.instances_={};
|
|
goog.Disposable.getUndisposedObjects=function(){var a=[],b;for(b in goog.Disposable.instances_)goog.Disposable.instances_.hasOwnProperty(b)&&a.push(goog.Disposable.instances_[Number(b)]);return a};goog.Disposable.clearUndisposedObjects=function(){goog.Disposable.instances_={}};goog.Disposable.prototype.disposed_=!1;goog.Disposable.prototype.isDisposed=function(){return this.disposed_};goog.Disposable.prototype.getDisposed=goog.Disposable.prototype.isDisposed;
|
|
goog.Disposable.prototype.dispose=function(){if(!this.disposed_&&(this.disposed_=!0,this.disposeInternal(),goog.Disposable.MONITORING_MODE!=goog.Disposable.MonitoringMode.OFF)){var a=goog.getUid(this);if(goog.Disposable.MONITORING_MODE==goog.Disposable.MonitoringMode.PERMANENT&&!goog.Disposable.instances_.hasOwnProperty(a))throw Error(this+" did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call");if(goog.Disposable.MONITORING_MODE!=goog.Disposable.MonitoringMode.OFF&&
|
|
this.onDisposeCallbacks_&&0<this.onDisposeCallbacks_.length)throw Error(this+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete goog.Disposable.instances_[a]}};goog.Disposable.prototype.registerDisposable=function(a){this.addOnDisposeCallback(goog.partial(goog.dispose,a))};
|
|
goog.Disposable.prototype.addOnDisposeCallback=function(a,b){this.disposed_?void 0!==b?a.call(b):a():(this.onDisposeCallbacks_||(this.onDisposeCallbacks_=[]),this.onDisposeCallbacks_.push(void 0!==b?goog.bind(a,b):a))};goog.Disposable.prototype.disposeInternal=function(){if(this.onDisposeCallbacks_)for(;this.onDisposeCallbacks_.length;)this.onDisposeCallbacks_.shift()()};goog.Disposable.isDisposed=function(a){return a&&"function"==typeof a.isDisposed?a.isDisposed():!1};
|
|
goog.dispose=function(a){a&&"function"==typeof a.dispose&&a.dispose()};goog.disposeAll=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];goog.isArrayLike(d)?goog.disposeAll.apply(null,d):goog.dispose(d)}};goog.events.EventId=function(a){this.id=a};goog.events.EventId.prototype.toString=function(){return this.id};goog.events.Event=function(a,b){this.type=a instanceof goog.events.EventId?String(a):a;this.currentTarget=this.target=b;this.defaultPrevented=this.propagationStopped_=!1;this.returnValue_=!0};goog.events.Event.prototype.stopPropagation=function(){this.propagationStopped_=!0};goog.events.Event.prototype.preventDefault=function(){this.defaultPrevented=!0;this.returnValue_=!1};goog.events.Event.stopPropagation=function(a){a.stopPropagation()};goog.events.Event.preventDefault=function(a){a.preventDefault()};goog.events.getVendorPrefixedName_=function(a){return goog.userAgent.WEBKIT?"webkit"+a:goog.userAgent.OPERA?"o"+a.toLowerCase():a.toLowerCase()};
|
|
goog.events.EventType={CLICK:"click",RIGHTCLICK:"rightclick",DBLCLICK:"dblclick",AUXCLICK:"auxclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",MOUSEENTER:"mouseenter",MOUSELEAVE:"mouseleave",MOUSECANCEL:"mousecancel",SELECTIONCHANGE:"selectionchange",SELECTSTART:"selectstart",WHEEL:"wheel",KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup",BLUR:"blur",FOCUS:"focus",DEACTIVATE:"deactivate",FOCUSIN:"focusin",FOCUSOUT:"focusout",CHANGE:"change",
|
|
RESET:"reset",SELECT:"select",SUBMIT:"submit",INPUT:"input",PROPERTYCHANGE:"propertychange",DRAGSTART:"dragstart",DRAG:"drag",DRAGENTER:"dragenter",DRAGOVER:"dragover",DRAGLEAVE:"dragleave",DROP:"drop",DRAGEND:"dragend",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel",BEFOREUNLOAD:"beforeunload",CONSOLEMESSAGE:"consolemessage",CONTEXTMENU:"contextmenu",DEVICECHANGE:"devicechange",DEVICEMOTION:"devicemotion",DEVICEORIENTATION:"deviceorientation",DOMCONTENTLOADED:"DOMContentLoaded",
|
|
ERROR:"error",HELP:"help",LOAD:"load",LOSECAPTURE:"losecapture",ORIENTATIONCHANGE:"orientationchange",READYSTATECHANGE:"readystatechange",RESIZE:"resize",SCROLL:"scroll",UNLOAD:"unload",CANPLAY:"canplay",CANPLAYTHROUGH:"canplaythrough",DURATIONCHANGE:"durationchange",EMPTIED:"emptied",ENDED:"ended",LOADEDDATA:"loadeddata",LOADEDMETADATA:"loadedmetadata",PAUSE:"pause",PLAY:"play",PLAYING:"playing",PROGRESS:"progress",RATECHANGE:"ratechange",SEEKED:"seeked",SEEKING:"seeking",STALLED:"stalled",SUSPEND:"suspend",
|
|
TIMEUPDATE:"timeupdate",VOLUMECHANGE:"volumechange",WAITING:"waiting",SOURCEOPEN:"sourceopen",SOURCEENDED:"sourceended",SOURCECLOSED:"sourceclosed",ABORT:"abort",UPDATE:"update",UPDATESTART:"updatestart",UPDATEEND:"updateend",HASHCHANGE:"hashchange",PAGEHIDE:"pagehide",PAGESHOW:"pageshow",POPSTATE:"popstate",COPY:"copy",PASTE:"paste",CUT:"cut",BEFORECOPY:"beforecopy",BEFORECUT:"beforecut",BEFOREPASTE:"beforepaste",ONLINE:"online",OFFLINE:"offline",MESSAGE:"message",CONNECT:"connect",INSTALL:"install",
|
|
ACTIVATE:"activate",FETCH:"fetch",FOREIGNFETCH:"foreignfetch",MESSAGEERROR:"messageerror",STATECHANGE:"statechange",UPDATEFOUND:"updatefound",CONTROLLERCHANGE:"controllerchange",ANIMATIONSTART:goog.events.getVendorPrefixedName_("AnimationStart"),ANIMATIONEND:goog.events.getVendorPrefixedName_("AnimationEnd"),ANIMATIONITERATION:goog.events.getVendorPrefixedName_("AnimationIteration"),TRANSITIONEND:goog.events.getVendorPrefixedName_("TransitionEnd"),POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTERCANCEL:"pointercancel",
|
|
POINTERMOVE:"pointermove",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",GOTPOINTERCAPTURE:"gotpointercapture",LOSTPOINTERCAPTURE:"lostpointercapture",MSGESTURECHANGE:"MSGestureChange",MSGESTUREEND:"MSGestureEnd",MSGESTUREHOLD:"MSGestureHold",MSGESTURESTART:"MSGestureStart",MSGESTURETAP:"MSGestureTap",MSGOTPOINTERCAPTURE:"MSGotPointerCapture",MSINERTIASTART:"MSInertiaStart",MSLOSTPOINTERCAPTURE:"MSLostPointerCapture",MSPOINTERCANCEL:"MSPointerCancel",
|
|
MSPOINTERDOWN:"MSPointerDown",MSPOINTERENTER:"MSPointerEnter",MSPOINTERHOVER:"MSPointerHover",MSPOINTERLEAVE:"MSPointerLeave",MSPOINTERMOVE:"MSPointerMove",MSPOINTEROUT:"MSPointerOut",MSPOINTEROVER:"MSPointerOver",MSPOINTERUP:"MSPointerUp",TEXT:"text",TEXTINPUT:goog.userAgent.IE?"textinput":"textInput",COMPOSITIONSTART:"compositionstart",COMPOSITIONUPDATE:"compositionupdate",COMPOSITIONEND:"compositionend",BEFOREINPUT:"beforeinput",EXIT:"exit",LOADABORT:"loadabort",LOADCOMMIT:"loadcommit",LOADREDIRECT:"loadredirect",
|
|
LOADSTART:"loadstart",LOADSTOP:"loadstop",RESPONSIVE:"responsive",SIZECHANGED:"sizechanged",UNRESPONSIVE:"unresponsive",VISIBILITYCHANGE:"visibilitychange",STORAGE:"storage",DOMSUBTREEMODIFIED:"DOMSubtreeModified",DOMNODEINSERTED:"DOMNodeInserted",DOMNODEREMOVED:"DOMNodeRemoved",DOMNODEREMOVEDFROMDOCUMENT:"DOMNodeRemovedFromDocument",DOMNODEINSERTEDINTODOCUMENT:"DOMNodeInsertedIntoDocument",DOMATTRMODIFIED:"DOMAttrModified",DOMCHARACTERDATAMODIFIED:"DOMCharacterDataModified",BEFOREPRINT:"beforeprint",
|
|
AFTERPRINT:"afterprint",BEFOREINSTALLPROMPT:"beforeinstallprompt",APPINSTALLED:"appinstalled"};goog.events.getPointerFallbackEventName_=function(a,b,c){return goog.events.BrowserFeature.POINTER_EVENTS?a:goog.events.BrowserFeature.MSPOINTER_EVENTS?b:c};
|
|
goog.events.PointerFallbackEventType={POINTERDOWN:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERDOWN,goog.events.EventType.MSPOINTERDOWN,goog.events.EventType.MOUSEDOWN),POINTERUP:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERUP,goog.events.EventType.MSPOINTERUP,goog.events.EventType.MOUSEUP),POINTERCANCEL:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERCANCEL,goog.events.EventType.MSPOINTERCANCEL,goog.events.EventType.MOUSECANCEL),
|
|
POINTERMOVE:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERMOVE,goog.events.EventType.MSPOINTERMOVE,goog.events.EventType.MOUSEMOVE),POINTEROVER:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTEROVER,goog.events.EventType.MSPOINTEROVER,goog.events.EventType.MOUSEOVER),POINTEROUT:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTEROUT,goog.events.EventType.MSPOINTEROUT,goog.events.EventType.MOUSEOUT),POINTERENTER:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERENTER,
|
|
goog.events.EventType.MSPOINTERENTER,goog.events.EventType.MOUSEENTER),POINTERLEAVE:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERLEAVE,goog.events.EventType.MSPOINTERLEAVE,goog.events.EventType.MOUSELEAVE)};
|
|
goog.events.PointerTouchFallbackEventType={POINTERDOWN:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERDOWN,goog.events.EventType.MSPOINTERDOWN,goog.events.EventType.TOUCHSTART),POINTERUP:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERUP,goog.events.EventType.MSPOINTERUP,goog.events.EventType.TOUCHEND),POINTERCANCEL:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERCANCEL,goog.events.EventType.MSPOINTERCANCEL,goog.events.EventType.TOUCHCANCEL),
|
|
POINTERMOVE:goog.events.getPointerFallbackEventName_(goog.events.EventType.POINTERMOVE,goog.events.EventType.MSPOINTERMOVE,goog.events.EventType.TOUCHMOVE)};
|
|
goog.events.PointerAsMouseEventType={MOUSEDOWN:goog.events.PointerFallbackEventType.POINTERDOWN,MOUSEUP:goog.events.PointerFallbackEventType.POINTERUP,MOUSECANCEL:goog.events.PointerFallbackEventType.POINTERCANCEL,MOUSEMOVE:goog.events.PointerFallbackEventType.POINTERMOVE,MOUSEOVER:goog.events.PointerFallbackEventType.POINTEROVER,MOUSEOUT:goog.events.PointerFallbackEventType.POINTEROUT,MOUSEENTER:goog.events.PointerFallbackEventType.POINTERENTER,MOUSELEAVE:goog.events.PointerFallbackEventType.POINTERLEAVE};
|
|
goog.events.MouseAsMouseEventType={MOUSEDOWN:goog.events.EventType.MOUSEDOWN,MOUSEUP:goog.events.EventType.MOUSEUP,MOUSECANCEL:goog.events.EventType.MOUSECANCEL,MOUSEMOVE:goog.events.EventType.MOUSEMOVE,MOUSEOVER:goog.events.EventType.MOUSEOVER,MOUSEOUT:goog.events.EventType.MOUSEOUT,MOUSEENTER:goog.events.EventType.MOUSEENTER,MOUSELEAVE:goog.events.EventType.MOUSELEAVE};
|
|
goog.events.PointerAsTouchEventType={TOUCHCANCEL:goog.events.PointerTouchFallbackEventType.POINTERCANCEL,TOUCHEND:goog.events.PointerTouchFallbackEventType.POINTERUP,TOUCHMOVE:goog.events.PointerTouchFallbackEventType.POINTERMOVE,TOUCHSTART:goog.events.PointerTouchFallbackEventType.POINTERDOWN};goog.events.USE_LAYER_XY_AS_OFFSET_XY=!1;goog.events.BrowserEvent=function(a,b){goog.events.Event.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.key="";this.charCode=this.keyCode=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.state=null;this.platformModifierKey=!1;this.pointerId=0;this.pointerType="";this.event_=null;a&&this.init(a,b)};
|
|
goog.inherits(goog.events.BrowserEvent,goog.events.Event);goog.events.BrowserEvent.MouseButton={LEFT:0,MIDDLE:1,RIGHT:2};goog.events.BrowserEvent.PointerType={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"};goog.events.BrowserEvent.IEButtonMap=goog.debug.freeze([1,4,2]);goog.events.BrowserEvent.IE_BUTTON_MAP=goog.events.BrowserEvent.IEButtonMap;goog.events.BrowserEvent.IE_POINTER_TYPE_MAP=goog.debug.freeze({2:goog.events.BrowserEvent.PointerType.TOUCH,3:goog.events.BrowserEvent.PointerType.PEN,4:goog.events.BrowserEvent.PointerType.MOUSE});
|
|
goog.events.BrowserEvent.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;e?goog.userAgent.GECKO&&(goog.reflect.canAccessProperty(e,"nodeName")||(e=null)):c==goog.events.EventType.MOUSEOVER?e=a.fromElement:c==goog.events.EventType.MOUSEOUT&&(e=a.toElement);this.relatedTarget=e;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==
|
|
d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(goog.events.USE_LAYER_XY_AS_OFFSET_XY?(this.offsetX=void 0!==a.layerX?a.layerX:a.offsetX,this.offsetY=void 0!==a.layerY?a.layerY:a.offsetY):(this.offsetX=goog.userAgent.WEBKIT||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=goog.userAgent.WEBKIT||void 0!==a.offsetY?a.offsetY:a.layerY),this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=
|
|
a.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.key=a.key||"";this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.platformModifierKey=goog.userAgent.MAC?a.metaKey:a.ctrlKey;this.pointerId=a.pointerId||0;this.pointerType=goog.events.BrowserEvent.getPointerType_(a);this.state=a.state;this.event_=a;a.defaultPrevented&&this.preventDefault()};
|
|
goog.events.BrowserEvent.prototype.isButton=function(a){return goog.events.BrowserFeature.HAS_W3C_BUTTON?this.event_.button==a:"click"==this.type?a==goog.events.BrowserEvent.MouseButton.LEFT:!!(this.event_.button&goog.events.BrowserEvent.IE_BUTTON_MAP[a])};goog.events.BrowserEvent.prototype.isMouseActionButton=function(){return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT)&&!(goog.userAgent.WEBKIT&&goog.userAgent.MAC&&this.ctrlKey)};
|
|
goog.events.BrowserEvent.prototype.stopPropagation=function(){goog.events.BrowserEvent.superClass_.stopPropagation.call(this);this.event_.stopPropagation?this.event_.stopPropagation():this.event_.cancelBubble=!0};
|
|
goog.events.BrowserEvent.prototype.preventDefault=function(){goog.events.BrowserEvent.superClass_.preventDefault.call(this);var a=this.event_;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};goog.events.BrowserEvent.prototype.getBrowserEvent=function(){return this.event_};
|
|
goog.events.BrowserEvent.getPointerType_=function(a){return"string"===typeof a.pointerType?a.pointerType:goog.events.BrowserEvent.IE_POINTER_TYPE_MAP[a.pointerType]||""};goog.events.Listenable=function(){};goog.events.Listenable.IMPLEMENTED_BY_PROP="closure_listenable_"+(1E6*Math.random()|0);goog.events.Listenable.addImplementation=function(a){a.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP]=!0};goog.events.Listenable.isImplementedBy=function(a){return!(!a||!a[goog.events.Listenable.IMPLEMENTED_BY_PROP])};goog.events.ListenableKey=function(){};goog.events.ListenableKey.counter_=0;goog.events.ListenableKey.reserveKey=function(){return++goog.events.ListenableKey.counter_};goog.events.Listener=function(a,b,c,d,e,f){goog.events.Listener.ENABLE_MONITORING&&(this.creationStack=Error().stack);this.listener=a;this.proxy=b;this.src=c;this.type=d;this.capture=!!e;this.handler=f;this.key=goog.events.ListenableKey.reserveKey();this.removed=this.callOnce=!1};goog.events.Listener.ENABLE_MONITORING=!1;goog.events.Listener.prototype.markAsRemoved=function(){this.removed=!0;this.handler=this.src=this.proxy=this.listener=null};goog.events.ListenerMap=function(a){this.src=a;this.listeners={};this.typeCount_=0};goog.events.ListenerMap.prototype.getTypeCount=function(){return this.typeCount_};goog.events.ListenerMap.prototype.getListenerCount=function(){var a=0,b;for(b in this.listeners)a+=this.listeners[b].length;return a};
|
|
goog.events.ListenerMap.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.listeners[f];a||(a=this.listeners[f]=[],this.typeCount_++);var g=goog.events.ListenerMap.findListenerIndex_(a,b,d,e);-1<g?(b=a[g],c||(b.callOnce=!1)):(b=new goog.events.Listener(b,null,this.src,f,!!d,e),b.callOnce=c,a.push(b));return b};
|
|
goog.events.ListenerMap.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.listeners))return!1;var e=this.listeners[a];b=goog.events.ListenerMap.findListenerIndex_(e,b,c,d);return-1<b?(e[b].markAsRemoved(),goog.array.removeAt(e,b),0==e.length&&(delete this.listeners[a],this.typeCount_--),!0):!1};
|
|
goog.events.ListenerMap.prototype.removeByKey=function(a){var b=a.type;if(!(b in this.listeners))return!1;var c=goog.array.remove(this.listeners[b],a);c&&(a.markAsRemoved(),0==this.listeners[b].length&&(delete this.listeners[b],this.typeCount_--));return c};goog.events.ListenerMap.prototype.removeAll=function(a){a=a&&a.toString();var b=0,c;for(c in this.listeners)if(!a||c==a){for(var d=this.listeners[c],e=0;e<d.length;e++)++b,d[e].markAsRemoved();delete this.listeners[c];this.typeCount_--}return b};
|
|
goog.events.ListenerMap.prototype.getListeners=function(a,b){var c=this.listeners[a.toString()],d=[];if(c)for(var e=0;e<c.length;++e){var f=c[e];f.capture==b&&d.push(f)}return d};goog.events.ListenerMap.prototype.getListener=function(a,b,c,d){a=this.listeners[a.toString()];var e=-1;a&&(e=goog.events.ListenerMap.findListenerIndex_(a,b,c,d));return-1<e?a[e]:null};
|
|
goog.events.ListenerMap.prototype.hasListener=function(a,b){var c=void 0!==a,d=c?a.toString():"",e=void 0!==b;return goog.object.some(this.listeners,function(a,g){for(var f=0;f<a.length;++f)if(!(c&&a[f].type!=d||e&&a[f].capture!=b))return!0;return!1})};goog.events.ListenerMap.findListenerIndex_=function(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.removed&&f.listener==b&&f.capture==!!c&&f.handler==d)return e}return-1};goog.events.LISTENER_MAP_PROP_="closure_lm_"+(1E6*Math.random()|0);goog.events.onString_="on";goog.events.onStringMap_={};goog.events.CaptureSimulationMode={OFF_AND_FAIL:0,OFF_AND_SILENT:1,ON:2};goog.events.CAPTURE_SIMULATION_MODE=2;goog.events.listenerCountEstimate_=0;
|
|
goog.events.listen=function(a,b,c,d,e){if(d&&d.once)return goog.events.listenOnce(a,b,c,d,e);if(goog.isArray(b)){for(var f=0;f<b.length;f++)goog.events.listen(a,b[f],c,d,e);return null}c=goog.events.wrapListener(c);return goog.events.Listenable.isImplementedBy(a)?(d=goog.isObject(d)?!!d.capture:!!d,a.listen(b,c,d,e)):goog.events.listen_(a,b,c,!1,d,e)};
|
|
goog.events.listen_=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=goog.isObject(e)?!!e.capture:!!e;if(g&&!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT){if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.OFF_AND_FAIL)return goog.asserts.fail("Can not register capture listener in IE8-."),null;if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.OFF_AND_SILENT)return null}var h=goog.events.getListenerMap_(a);h||(a[goog.events.LISTENER_MAP_PROP_]=
|
|
h=new goog.events.ListenerMap(a));c=h.add(b,c,d,g,f);if(c.proxy)return c;d=goog.events.getProxy();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)goog.events.BrowserFeature.PASSIVE_EVENTS||(e=g),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(goog.events.getOnString_(b.toString()),d);else if(a.addListener&&a.removeListener)goog.asserts.assert("change"===b,"MediaQueryList only has a change event"),a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");
|
|
goog.events.listenerCountEstimate_++;return c};goog.events.getProxy=function(){var a=goog.events.handleBrowserEvent_,b=goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b};
|
|
goog.events.listenOnce=function(a,b,c,d,e){if(goog.isArray(b)){for(var f=0;f<b.length;f++)goog.events.listenOnce(a,b[f],c,d,e);return null}c=goog.events.wrapListener(c);return goog.events.Listenable.isImplementedBy(a)?(d=goog.isObject(d)?!!d.capture:!!d,a.listenOnce(b,c,d,e)):goog.events.listen_(a,b,c,!0,d,e)};goog.events.listenWithWrapper=function(a,b,c,d,e){b.listen(a,c,d,e)};
|
|
goog.events.unlisten=function(a,b,c,d,e){if(goog.isArray(b)){for(var f=0;f<b.length;f++)goog.events.unlisten(a,b[f],c,d,e);return null}d=goog.isObject(d)?!!d.capture:!!d;c=goog.events.wrapListener(c);if(goog.events.Listenable.isImplementedBy(a))return a.unlisten(b,c,d,e);if(!a)return!1;if(a=goog.events.getListenerMap_(a))if(b=a.getListener(b,c,d,e))return goog.events.unlistenByKey(b);return!1};
|
|
goog.events.unlistenByKey=function(a){if("number"===typeof a||!a||a.removed)return!1;var b=a.src;if(goog.events.Listenable.isImplementedBy(b))return b.unlistenByKey(a);var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(goog.events.getOnString_(c),d):b.addListener&&b.removeListener&&b.removeListener(d);goog.events.listenerCountEstimate_--;(c=goog.events.getListenerMap_(b))?(c.removeByKey(a),0==c.getTypeCount()&&(c.src=null,b[goog.events.LISTENER_MAP_PROP_]=
|
|
null)):a.markAsRemoved();return!0};goog.events.unlistenWithWrapper=function(a,b,c,d,e){b.unlisten(a,c,d,e)};goog.events.removeAll=function(a,b){if(!a)return 0;if(goog.events.Listenable.isImplementedBy(a))return a.removeAllListeners(b);var c=goog.events.getListenerMap_(a);if(!c)return 0;var d=0,e=b&&b.toString(),f;for(f in c.listeners)if(!e||f==e)for(var g=c.listeners[f].concat(),h=0;h<g.length;++h)goog.events.unlistenByKey(g[h])&&++d;return d};
|
|
goog.events.getListeners=function(a,b,c){return goog.events.Listenable.isImplementedBy(a)?a.getListeners(b,c):a?(a=goog.events.getListenerMap_(a))?a.getListeners(b,c):[]:[]};goog.events.getListener=function(a,b,c,d,e){c=goog.events.wrapListener(c);d=!!d;return goog.events.Listenable.isImplementedBy(a)?a.getListener(b,c,d,e):a?(a=goog.events.getListenerMap_(a))?a.getListener(b,c,d,e):null:null};
|
|
goog.events.hasListener=function(a,b,c){if(goog.events.Listenable.isImplementedBy(a))return a.hasListener(b,c);a=goog.events.getListenerMap_(a);return!!a&&a.hasListener(b,c)};goog.events.expose=function(a){var b=[],c;for(c in a)a[c]&&a[c].id?b.push(c+" = "+a[c]+" ("+a[c].id+")"):b.push(c+" = "+a[c]);return b.join("\n")};goog.events.getOnString_=function(a){return a in goog.events.onStringMap_?goog.events.onStringMap_[a]:goog.events.onStringMap_[a]=goog.events.onString_+a};
|
|
goog.events.fireListeners=function(a,b,c,d){return goog.events.Listenable.isImplementedBy(a)?a.fireListeners(b,c,d):goog.events.fireListeners_(a,b,c,d)};goog.events.fireListeners_=function(a,b,c,d){var e=!0;if(a=goog.events.getListenerMap_(a))if(b=a.listeners[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.removed&&(f=goog.events.fireListener(f,d),e=e&&!1!==f)}return e};
|
|
goog.events.fireListener=function(a,b){var c=a.listener,d=a.handler||a.src;a.callOnce&&goog.events.unlistenByKey(a);return c.call(d,b)};goog.events.getTotalListenerCount=function(){return goog.events.listenerCountEstimate_};goog.events.dispatchEvent=function(a,b){goog.asserts.assert(goog.events.Listenable.isImplementedBy(a),"Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance.");return a.dispatchEvent(b)};
|
|
goog.events.protectBrowserEventEntryPoint=function(a){goog.events.handleBrowserEvent_=a.protectEntryPoint(goog.events.handleBrowserEvent_)};
|
|
goog.events.handleBrowserEvent_=function(a,b){if(a.removed)return!0;if(!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT){var c=b||goog.getObjectByName("window.event"),d=new goog.events.BrowserEvent(c,this),e=!0;if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.ON){if(!goog.events.isMarkedIeEvent_(c)){goog.events.markIeEvent_(c);c=[];for(var f=d.currentTarget;f;f=f.parentNode)c.push(f);f=a.type;for(var g=c.length-1;!d.propagationStopped_&&0<=g;g--){d.currentTarget=c[g];var h=
|
|
goog.events.fireListeners_(c[g],f,!0,d);e=e&&h}for(g=0;!d.propagationStopped_&&g<c.length;g++)d.currentTarget=c[g],h=goog.events.fireListeners_(c[g],f,!1,d),e=e&&h}}else e=goog.events.fireListener(a,d);return e}return goog.events.fireListener(a,new goog.events.BrowserEvent(b,this))};goog.events.markIeEvent_=function(a){var b=!1;if(0==a.keyCode)try{a.keyCode=-1;return}catch(c){b=!0}if(b||void 0==a.returnValue)a.returnValue=!0};goog.events.isMarkedIeEvent_=function(a){return 0>a.keyCode||void 0!=a.returnValue};
|
|
goog.events.uniqueIdCounter_=0;goog.events.getUniqueId=function(a){return a+"_"+goog.events.uniqueIdCounter_++};goog.events.getListenerMap_=function(a){a=a[goog.events.LISTENER_MAP_PROP_];return a instanceof goog.events.ListenerMap?a:null};goog.events.LISTENER_WRAPPER_PROP_="__closure_events_fn_"+(1E9*Math.random()>>>0);
|
|
goog.events.wrapListener=function(a){goog.asserts.assert(a,"Listener can not be null.");if(goog.isFunction(a))return a;goog.asserts.assert(a.handleEvent,"An object listener must have handleEvent method.");a[goog.events.LISTENER_WRAPPER_PROP_]||(a[goog.events.LISTENER_WRAPPER_PROP_]=function(b){return a.handleEvent(b)});return a[goog.events.LISTENER_WRAPPER_PROP_]};goog.debug.entryPointRegistry.register(function(a){goog.events.handleBrowserEvent_=a(goog.events.handleBrowserEvent_)});goog.math={};goog.math.randomInt=function(a){return Math.floor(Math.random()*a)};goog.math.uniformRandom=function(a,b){return a+Math.random()*(b-a)};goog.math.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)};goog.math.modulo=function(a,b){var c=a%b;return 0>c*b?c+b:c};goog.math.lerp=function(a,b,c){return a+c*(b-a)};goog.math.nearlyEquals=function(a,b,c){return Math.abs(a-b)<=(c||1E-6)};goog.math.standardAngle=function(a){return goog.math.modulo(a,360)};
|
|
goog.math.standardAngleInRadians=function(a){return goog.math.modulo(a,2*Math.PI)};goog.math.toRadians=function(a){return a*Math.PI/180};goog.math.toDegrees=function(a){return 180*a/Math.PI};goog.math.angleDx=function(a,b){return b*Math.cos(goog.math.toRadians(a))};goog.math.angleDy=function(a,b){return b*Math.sin(goog.math.toRadians(a))};goog.math.angle=function(a,b,c,d){return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(d-b,c-a)))};
|
|
goog.math.angleDifference=function(a,b){var c=goog.math.standardAngle(b)-goog.math.standardAngle(a);180<c?c-=360:-180>=c&&(c=360+c);return c};goog.math.sign=function(a){return 0<a?1:0>a?-1:a};
|
|
goog.math.longestCommonSubsequence=function(a,b,c,d){c=c||function(a,b){return a==b};d=d||function(b,c){return a[b]};for(var e=a.length,f=b.length,g=[],h=0;h<e+1;h++)g[h]=[],g[h][0]=0;for(var k=0;k<f+1;k++)g[0][k]=0;for(h=1;h<=e;h++)for(k=1;k<=f;k++)c(a[h-1],b[k-1])?g[h][k]=g[h-1][k-1]+1:g[h][k]=Math.max(g[h-1][k],g[h][k-1]);var l=[];h=e;for(k=f;0<h&&0<k;)c(a[h-1],b[k-1])?(l.unshift(d(h-1,k-1)),h--,k--):g[h-1][k]>g[h][k-1]?h--:k--;return l};
|
|
goog.math.sum=function(a){return goog.array.reduce(arguments,function(a,c){return a+c},0)};goog.math.average=function(a){return goog.math.sum.apply(null,arguments)/arguments.length};goog.math.sampleVariance=function(a){var b=arguments.length;if(2>b)return 0;var c=goog.math.average.apply(null,arguments);return goog.math.sum.apply(null,goog.array.map(arguments,function(a){return Math.pow(a-c,2)}))/(b-1)};goog.math.standardDeviation=function(a){return Math.sqrt(goog.math.sampleVariance.apply(null,arguments))};
|
|
goog.math.isInt=function(a){return isFinite(a)&&0==a%1};goog.math.isFiniteNumber=function(a){return isFinite(a)};goog.math.isNegativeZero=function(a){return 0==a&&0>1/a};goog.math.log10Floor=function(a){if(0<a){var b=Math.round(Math.log(a)*Math.LOG10E);return b-(parseFloat("1e"+b)>a?1:0)}return 0==a?-Infinity:NaN};goog.math.safeFloor=function(a,b){goog.asserts.assert(void 0===b||0<b);return Math.floor(a+(b||2E-15))};
|
|
goog.math.safeCeil=function(a,b){goog.asserts.assert(void 0===b||0<b);return Math.ceil(a-(b||2E-15))};goog.math.Coordinate=function(a,b){this.x=void 0!==a?a:0;this.y=void 0!==b?b:0};goog.math.Coordinate.prototype.clone=function(){return new goog.math.Coordinate(this.x,this.y)};goog.DEBUG&&(goog.math.Coordinate.prototype.toString=function(){return"("+this.x+", "+this.y+")"});goog.math.Coordinate.prototype.equals=function(a){return a instanceof goog.math.Coordinate&&goog.math.Coordinate.equals(this,a)};goog.math.Coordinate.equals=function(a,b){return a==b?!0:a&&b?a.x==b.x&&a.y==b.y:!1};
|
|
goog.math.Coordinate.distance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)};goog.math.Coordinate.magnitude=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};goog.math.Coordinate.azimuth=function(a){return goog.math.angle(0,0,a.x,a.y)};goog.math.Coordinate.squaredDistance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d};goog.math.Coordinate.difference=function(a,b){return new goog.math.Coordinate(a.x-b.x,a.y-b.y)};
|
|
goog.math.Coordinate.sum=function(a,b){return new goog.math.Coordinate(a.x+b.x,a.y+b.y)};goog.math.Coordinate.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};goog.math.Coordinate.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};goog.math.Coordinate.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};
|
|
goog.math.Coordinate.prototype.translate=function(a,b){a instanceof goog.math.Coordinate?(this.x+=a.x,this.y+=a.y):(this.x+=Number(a),"number"===typeof b&&(this.y+=b));return this};goog.math.Coordinate.prototype.scale=function(a,b){this.x*=a;this.y*="number"===typeof b?b:a;return this};goog.math.Coordinate.prototype.rotateRadians=function(a,b){var c=b||new goog.math.Coordinate(0,0),d=this.x,e=this.y,f=Math.cos(a),g=Math.sin(a);this.x=(d-c.x)*f-(e-c.y)*g+c.x;this.y=(d-c.x)*g+(e-c.y)*f+c.y};
|
|
goog.math.Coordinate.prototype.rotateDegrees=function(a,b){this.rotateRadians(goog.math.toRadians(a),b)};goog.dom.BrowserFeature={};goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS=!1;goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS=!1;goog.dom.BrowserFeature.detectOffscreenCanvas_=function(a){try{return!!(new self.OffscreenCanvas(0,0)).getContext(a)}catch(b){}return!1};goog.dom.BrowserFeature.OFFSCREEN_CANVAS_2D=!goog.dom.BrowserFeature.ASSUME_NO_OFFSCREEN_CANVAS&&(goog.dom.BrowserFeature.ASSUME_OFFSCREEN_CANVAS||goog.dom.BrowserFeature.detectOffscreenCanvas_("2d"));
|
|
goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES=!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9);goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE=!goog.userAgent.GECKO&&!goog.userAgent.IE||goog.userAgent.IE&&goog.userAgent.isDocumentModeOrHigher(9)||goog.userAgent.GECKO&&goog.userAgent.isVersionOrHigher("1.9.1");goog.dom.BrowserFeature.CAN_USE_INNER_TEXT=goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9");
|
|
goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY=goog.userAgent.IE||goog.userAgent.OPERA||goog.userAgent.WEBKIT;goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT=goog.userAgent.IE;goog.dom.BrowserFeature.LEGACY_IE_RANGES=goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9);goog.math.Size=function(a,b){this.width=a;this.height=b};goog.math.Size.equals=function(a,b){return a==b?!0:a&&b?a.width==b.width&&a.height==b.height:!1};goog.math.Size.prototype.clone=function(){return new goog.math.Size(this.width,this.height)};goog.DEBUG&&(goog.math.Size.prototype.toString=function(){return"("+this.width+" x "+this.height+")"});goog.math.Size.prototype.getLongest=function(){return Math.max(this.width,this.height)};
|
|
goog.math.Size.prototype.getShortest=function(){return Math.min(this.width,this.height)};goog.math.Size.prototype.area=function(){return this.width*this.height};goog.math.Size.prototype.perimeter=function(){return 2*(this.width+this.height)};goog.math.Size.prototype.aspectRatio=function(){return this.width/this.height};goog.math.Size.prototype.isEmpty=function(){return!this.area()};goog.math.Size.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};
|
|
goog.math.Size.prototype.fitsInside=function(a){return this.width<=a.width&&this.height<=a.height};goog.math.Size.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};goog.math.Size.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};goog.math.Size.prototype.scale=function(a,b){this.width*=a;this.height*="number"===typeof b?b:a;return this};
|
|
goog.math.Size.prototype.scaleToCover=function(a){a=this.aspectRatio()<=a.aspectRatio()?a.width/this.width:a.height/this.height;return this.scale(a)};goog.math.Size.prototype.scaleToFit=function(a){a=this.aspectRatio()>a.aspectRatio()?a.width/this.width:a.height/this.height;return this.scale(a)};goog.dom.ASSUME_QUIRKS_MODE=!1;goog.dom.ASSUME_STANDARDS_MODE=!1;goog.dom.COMPAT_MODE_KNOWN_=goog.dom.ASSUME_QUIRKS_MODE||goog.dom.ASSUME_STANDARDS_MODE;goog.dom.getDomHelper=function(a){return a?new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)):goog.dom.defaultDomHelper_||(goog.dom.defaultDomHelper_=new goog.dom.DomHelper)};goog.dom.getDocument=function(){return document};goog.dom.getElement=function(a){return goog.dom.getElementHelper_(document,a)};
|
|
goog.dom.getElementHelper_=function(a,b){return"string"===typeof b?a.getElementById(b):b};goog.dom.getRequiredElement=function(a){return goog.dom.getRequiredElementHelper_(document,a)};goog.dom.getRequiredElementHelper_=function(a,b){goog.asserts.assertString(b);var c=goog.dom.getElementHelper_(a,b);return c=goog.asserts.assertElement(c,"No element found with id: "+b)};goog.dom.$=goog.dom.getElement;goog.dom.getElementsByTagName=function(a,b){return(b||document).getElementsByTagName(String(a))};
|
|
goog.dom.getElementsByTagNameAndClass=function(a,b,c){return goog.dom.getElementsByTagNameAndClass_(document,a,b,c)};goog.dom.getElementByTagNameAndClass=function(a,b,c){return goog.dom.getElementByTagNameAndClass_(document,a,b,c)};goog.dom.getElementsByClass=function(a,b){var c=b||document;return goog.dom.canUseQuerySelector_(c)?c.querySelectorAll("."+a):goog.dom.getElementsByTagNameAndClass_(document,"*",a,b)};
|
|
goog.dom.getElementByClass=function(a,b){var c=b||document;return(c.getElementsByClassName?c.getElementsByClassName(a)[0]:goog.dom.getElementByTagNameAndClass_(document,"*",a,b))||null};goog.dom.getRequiredElementByClass=function(a,b){var c=goog.dom.getElementByClass(a,b);return goog.asserts.assert(c,"No element found with className: "+a)};goog.dom.canUseQuerySelector_=function(a){return!(!a.querySelectorAll||!a.querySelector)};
|
|
goog.dom.getElementsByTagNameAndClass_=function(a,b,c,d){a=d||a;b=b&&"*"!=b?String(b).toUpperCase():"";if(goog.dom.canUseQuerySelector_(a)&&(b||c))return a.querySelectorAll(b+(c?"."+c:""));if(c&&a.getElementsByClassName){a=a.getElementsByClassName(c);if(b){d={};for(var e=0,f=0,g;g=a[f];f++)b==g.nodeName&&(d[e++]=g);d.length=e;return d}return a}a=a.getElementsByTagName(b||"*");if(c){d={};for(f=e=0;g=a[f];f++)b=g.className,"function"==typeof b.split&&goog.array.contains(b.split(/\s+/),c)&&(d[e++]=g);
|
|
d.length=e;return d}return a};goog.dom.getElementByTagNameAndClass_=function(a,b,c,d){var e=d||a,f=b&&"*"!=b?String(b).toUpperCase():"";return goog.dom.canUseQuerySelector_(e)&&(f||c)?e.querySelector(f+(c?"."+c:"")):goog.dom.getElementsByTagNameAndClass_(a,b,c,d)[0]||null};goog.dom.$$=goog.dom.getElementsByTagNameAndClass;
|
|
goog.dom.setProperties=function(a,b){goog.object.forEach(b,function(b,d){b&&"object"==typeof b&&b.implementsGoogStringTypedString&&(b=b.getTypedStringValue());"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(d)?a.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[d],b):goog.string.startsWith(d,"aria-")||goog.string.startsWith(d,"data-")?a.setAttribute(d,b):a[d]=b})};
|
|
goog.dom.DIRECT_ATTRIBUTE_MAP_={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};goog.dom.getViewportSize=function(a){return goog.dom.getViewportSize_(a||window)};goog.dom.getViewportSize_=function(a){a=a.document;a=goog.dom.isCss1CompatMode_(a)?a.documentElement:a.body;return new goog.math.Size(a.clientWidth,a.clientHeight)};
|
|
goog.dom.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(window)};goog.dom.getDocumentHeightForWindow=function(a){return goog.dom.getDocumentHeight_(a)};
|
|
goog.dom.getDocumentHeight_=function(a){var b=a.document,c=0;if(b){c=b.body;var d=b.documentElement;if(!d||!c)return 0;a=goog.dom.getViewportSize_(a).height;if(goog.dom.isCss1CompatMode_(b)&&d.scrollHeight)c=d.scrollHeight!=a?d.scrollHeight:d.offsetHeight;else{b=d.scrollHeight;var e=d.offsetHeight;d.clientHeight!=e&&(b=c.scrollHeight,e=c.offsetHeight);c=b>a?b>e?b:e:b<e?b:e}}return c};goog.dom.getPageScroll=function(a){return goog.dom.getDomHelper((a||goog.global||window).document).getDocumentScroll()};
|
|
goog.dom.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(document)};goog.dom.getDocumentScroll_=function(a){var b=goog.dom.getDocumentScrollElement_(a);a=goog.dom.getWindow_(a);return goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("10")&&a.pageYOffset!=b.scrollTop?new goog.math.Coordinate(b.scrollLeft,b.scrollTop):new goog.math.Coordinate(a.pageXOffset||b.scrollLeft,a.pageYOffset||b.scrollTop)};goog.dom.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(document)};
|
|
goog.dom.getDocumentScrollElement_=function(a){return a.scrollingElement?a.scrollingElement:!goog.userAgent.WEBKIT&&goog.dom.isCss1CompatMode_(a)?a.documentElement:a.body||a.documentElement};goog.dom.getWindow=function(a){return a?goog.dom.getWindow_(a):window};goog.dom.getWindow_=function(a){return a.parentWindow||a.defaultView};goog.dom.createDom=function(a,b,c){return goog.dom.createDom_(document,arguments)};
|
|
goog.dom.createDom_=function(a,b){var c=String(b[0]),d=b[1];if(!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',goog.string.htmlEscape(d.name),'"');if(d.type){c.push(' type="',goog.string.htmlEscape(d.type),'"');var e={};goog.object.extend(e,d);delete e.type;d=e}c.push(">");c=c.join("")}c=goog.dom.createElement_(a,c);d&&("string"===typeof d?c.className=d:goog.isArray(d)?c.className=d.join(" "):goog.dom.setProperties(c,d));2<b.length&&
|
|
goog.dom.append_(a,c,b,2);return c};goog.dom.append_=function(a,b,c,d){function e(c){c&&b.appendChild("string"===typeof c?a.createTextNode(c):c)}for(;d<c.length;d++){var f=c[d];goog.isArrayLike(f)&&!goog.dom.isNodeLike(f)?goog.array.forEach(goog.dom.isNodeList(f)?goog.array.toArray(f):f,e):e(f)}};goog.dom.$dom=goog.dom.createDom;goog.dom.createElement=function(a){return goog.dom.createElement_(document,a)};
|
|
goog.dom.createElement_=function(a,b){b=String(b);"application/xhtml+xml"===a.contentType&&(b=b.toLowerCase());return a.createElement(b)};goog.dom.createTextNode=function(a){return document.createTextNode(String(a))};goog.dom.createTable=function(a,b,c){return goog.dom.createTable_(document,a,b,!!c)};
|
|
goog.dom.createTable_=function(a,b,c,d){for(var e=goog.dom.createElement_(a,"TABLE"),f=e.appendChild(goog.dom.createElement_(a,"TBODY")),g=0;g<b;g++){for(var h=goog.dom.createElement_(a,"TR"),k=0;k<c;k++){var l=goog.dom.createElement_(a,"TD");d&&goog.dom.setTextContent(l,goog.string.Unicode.NBSP);h.appendChild(l)}f.appendChild(h)}return e};
|
|
goog.dom.constHtmlToNode=function(a){var b=goog.array.map(arguments,goog.string.Const.unwrap);b=goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Constant HTML string, that gets turned into a Node later, so it will be automatically balanced."),b.join(""));return goog.dom.safeHtmlToNode(b)};goog.dom.safeHtmlToNode=function(a){return goog.dom.safeHtmlToNode_(document,a)};
|
|
goog.dom.safeHtmlToNode_=function(a,b){var c=goog.dom.createElement_(a,"DIV");goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT?(goog.dom.safe.setInnerHtml(c,goog.html.SafeHtml.concat(goog.html.SafeHtml.BR,b)),c.removeChild(goog.asserts.assert(c.firstChild))):goog.dom.safe.setInnerHtml(c,b);return goog.dom.childrenToNode_(a,c)};
|
|
goog.dom.childrenToNode_=function(a,b){if(1==b.childNodes.length)return b.removeChild(goog.asserts.assert(b.firstChild));for(var c=a.createDocumentFragment();b.firstChild;)c.appendChild(b.firstChild);return c};goog.dom.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(document)};goog.dom.isCss1CompatMode_=function(a){return goog.dom.COMPAT_MODE_KNOWN_?goog.dom.ASSUME_STANDARDS_MODE:"CSS1Compat"==a.compatMode};
|
|
goog.dom.canHaveChildren=function(a){if(a.nodeType!=goog.dom.NodeType.ELEMENT)return!1;switch(a.tagName){case "APPLET":case "AREA":case "BASE":case "BR":case "COL":case "COMMAND":case "EMBED":case "FRAME":case "HR":case "IMG":case "INPUT":case "IFRAME":case "ISINDEX":case "KEYGEN":case "LINK":case "NOFRAMES":case "NOSCRIPT":case "META":case "OBJECT":case "PARAM":case "SCRIPT":case "SOURCE":case "STYLE":case "TRACK":case "WBR":return!1}return!0};
|
|
goog.dom.appendChild=function(a,b){goog.asserts.assert(null!=a&&null!=b,"goog.dom.appendChild expects non-null arguments");a.appendChild(b)};goog.dom.append=function(a,b){goog.dom.append_(goog.dom.getOwnerDocument(a),a,arguments,1)};goog.dom.removeChildren=function(a){for(var b;b=a.firstChild;)a.removeChild(b)};goog.dom.insertSiblingBefore=function(a,b){goog.asserts.assert(null!=a&&null!=b,"goog.dom.insertSiblingBefore expects non-null arguments");b.parentNode&&b.parentNode.insertBefore(a,b)};
|
|
goog.dom.insertSiblingAfter=function(a,b){goog.asserts.assert(null!=a&&null!=b,"goog.dom.insertSiblingAfter expects non-null arguments");b.parentNode&&b.parentNode.insertBefore(a,b.nextSibling)};goog.dom.insertChildAt=function(a,b,c){goog.asserts.assert(null!=a,"goog.dom.insertChildAt expects a non-null parent");a.insertBefore(b,a.childNodes[c]||null)};goog.dom.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};
|
|
goog.dom.replaceNode=function(a,b){goog.asserts.assert(null!=a&&null!=b,"goog.dom.replaceNode expects non-null arguments");var c=b.parentNode;c&&c.replaceChild(a,b)};goog.dom.flattenElement=function(a){var b,c=a.parentNode;if(c&&c.nodeType!=goog.dom.NodeType.DOCUMENT_FRAGMENT){if(a.removeNode)return a.removeNode(!1);for(;b=a.firstChild;)c.insertBefore(b,a);return goog.dom.removeNode(a)}};
|
|
goog.dom.getChildren=function(a){return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE&&void 0!=a.children?a.children:goog.array.filter(a.childNodes,function(a){return a.nodeType==goog.dom.NodeType.ELEMENT})};goog.dom.getFirstElementChild=function(a){return void 0!==a.firstElementChild?a.firstElementChild:goog.dom.getNextElementNode_(a.firstChild,!0)};goog.dom.getLastElementChild=function(a){return void 0!==a.lastElementChild?a.lastElementChild:goog.dom.getNextElementNode_(a.lastChild,!1)};
|
|
goog.dom.getNextElementSibling=function(a){return void 0!==a.nextElementSibling?a.nextElementSibling:goog.dom.getNextElementNode_(a.nextSibling,!0)};goog.dom.getPreviousElementSibling=function(a){return void 0!==a.previousElementSibling?a.previousElementSibling:goog.dom.getNextElementNode_(a.previousSibling,!1)};goog.dom.getNextElementNode_=function(a,b){for(;a&&a.nodeType!=goog.dom.NodeType.ELEMENT;)a=b?a.nextSibling:a.previousSibling;return a};
|
|
goog.dom.getNextNode=function(a){if(!a)return null;if(a.firstChild)return a.firstChild;for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null};goog.dom.getPreviousNode=function(a){if(!a)return null;if(!a.previousSibling)return a.parentNode;for(a=a.previousSibling;a&&a.lastChild;)a=a.lastChild;return a};goog.dom.isNodeLike=function(a){return goog.isObject(a)&&0<a.nodeType};goog.dom.isElement=function(a){return goog.isObject(a)&&a.nodeType==goog.dom.NodeType.ELEMENT};
|
|
goog.dom.isWindow=function(a){return goog.isObject(a)&&a.window==a};goog.dom.getParentElement=function(a){var b;if(goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY&&!(goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("9")&&!goog.userAgent.isVersionOrHigher("10")&&goog.global.SVGElement&&a instanceof goog.global.SVGElement)&&(b=a.parentElement))return b;b=a.parentNode;return goog.dom.isElement(b)?b:null};
|
|
goog.dom.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&b.nodeType==goog.dom.NodeType.ELEMENT)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};
|
|
goog.dom.compareNodeOrder=function(a,b){if(a==b)return 0;if(a.compareDocumentPosition)return a.compareDocumentPosition(b)&2?1:-1;if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)){if(a.nodeType==goog.dom.NodeType.DOCUMENT)return-1;if(b.nodeType==goog.dom.NodeType.DOCUMENT)return 1}if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var c=a.nodeType==goog.dom.NodeType.ELEMENT,d=b.nodeType==goog.dom.NodeType.ELEMENT;if(c&&d)return a.sourceIndex-b.sourceIndex;var e=a.parentNode,
|
|
f=b.parentNode;return e==f?goog.dom.compareSiblingOrder_(a,b):!c&&goog.dom.contains(e,b)?-1*goog.dom.compareParentsDescendantNodeIe_(a,b):!d&&goog.dom.contains(f,a)?goog.dom.compareParentsDescendantNodeIe_(b,a):(c?a.sourceIndex:e.sourceIndex)-(d?b.sourceIndex:f.sourceIndex)}d=goog.dom.getOwnerDocument(a);c=d.createRange();c.selectNode(a);c.collapse(!0);d=d.createRange();d.selectNode(b);d.collapse(!0);return c.compareBoundaryPoints(goog.global.Range.START_TO_END,d)};
|
|
goog.dom.compareParentsDescendantNodeIe_=function(a,b){var c=a.parentNode;if(c==b)return-1;for(var d=b;d.parentNode!=c;)d=d.parentNode;return goog.dom.compareSiblingOrder_(d,a)};goog.dom.compareSiblingOrder_=function(a,b){for(var c=b;c=c.previousSibling;)if(c==a)return-1;return 1};
|
|
goog.dom.findCommonAncestor=function(a){var b,c=arguments.length;if(!c)return null;if(1==c)return arguments[0];var d=[],e=Infinity;for(b=0;b<c;b++){for(var f=[],g=arguments[b];g;)f.unshift(g),g=g.parentNode;d.push(f);e=Math.min(e,f.length)}f=null;for(b=0;b<e;b++){g=d[0][b];for(var h=1;h<c;h++)if(g!=d[h][b])return f;f=g}return f};goog.dom.isInDocument=function(a){return 16==(a.ownerDocument.compareDocumentPosition(a)&16)};
|
|
goog.dom.getOwnerDocument=function(a){goog.asserts.assert(a,"Node cannot be null or undefined.");return a.nodeType==goog.dom.NodeType.DOCUMENT?a:a.ownerDocument||a.document};goog.dom.getFrameContentDocument=function(a){return a.contentDocument||a.contentWindow.document};goog.dom.getFrameContentWindow=function(a){try{return a.contentWindow||(a.contentDocument?goog.dom.getWindow(a.contentDocument):null)}catch(b){}return null};
|
|
goog.dom.setTextContent=function(a,b){goog.asserts.assert(null!=a,"goog.dom.setTextContent expects a non-null value for node");if("textContent"in a)a.textContent=b;else if(a.nodeType==goog.dom.NodeType.TEXT)a.data=String(b);else if(a.firstChild&&a.firstChild.nodeType==goog.dom.NodeType.TEXT){for(;a.lastChild!=a.firstChild;)a.removeChild(goog.asserts.assert(a.lastChild));a.firstChild.data=String(b)}else{goog.dom.removeChildren(a);var c=goog.dom.getOwnerDocument(a);a.appendChild(c.createTextNode(String(b)))}};
|
|
goog.dom.getOuterHtml=function(a){goog.asserts.assert(null!==a,"goog.dom.getOuterHtml expects a non-null value for element");if("outerHTML"in a)return a.outerHTML;var b=goog.dom.getOwnerDocument(a);b=goog.dom.createElement_(b,"DIV");b.appendChild(a.cloneNode(!0));return b.innerHTML};goog.dom.findNode=function(a,b){var c=[];return goog.dom.findNodes_(a,b,c,!0)?c[0]:void 0};goog.dom.findNodes=function(a,b){var c=[];goog.dom.findNodes_(a,b,c,!1);return c};
|
|
goog.dom.findNodes_=function(a,b,c,d){if(null!=a)for(a=a.firstChild;a;){if(b(a)&&(c.push(a),d)||goog.dom.findNodes_(a,b,c,d))return!0;a=a.nextSibling}return!1};goog.dom.findElement=function(a,b){for(var c=goog.dom.getChildrenReverse_(a);0<c.length;){var d=c.pop();if(b(d))return d;for(d=d.lastElementChild;d;d=d.previousElementSibling)c.push(d)}return null};
|
|
goog.dom.findElements=function(a,b){for(var c=[],d=goog.dom.getChildrenReverse_(a);0<d.length;){var e=d.pop();b(e)&&c.push(e);for(e=e.lastElementChild;e;e=e.previousElementSibling)d.push(e)}return c};goog.dom.getChildrenReverse_=function(a){if(a.nodeType==goog.dom.NodeType.DOCUMENT)return[a.documentElement];var b=[];for(a=a.lastElementChild;a;a=a.previousElementSibling)b.push(a);return b};goog.dom.TAGS_TO_IGNORE_={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1};
|
|
goog.dom.PREDEFINED_TAG_VALUES_={IMG:" ",BR:"\n"};goog.dom.isFocusableTabIndex=function(a){return goog.dom.hasSpecifiedTabIndex_(a)&&goog.dom.isTabIndexFocusable_(a)};goog.dom.setFocusableTabIndex=function(a,b){b?a.tabIndex=0:(a.tabIndex=-1,a.removeAttribute("tabIndex"))};
|
|
goog.dom.isFocusable=function(a){var b;return(b=goog.dom.nativelySupportsFocus_(a)?!a.disabled&&(!goog.dom.hasSpecifiedTabIndex_(a)||goog.dom.isTabIndexFocusable_(a)):goog.dom.isFocusableTabIndex(a))&&goog.userAgent.IE?goog.dom.hasNonZeroBoundingRect_(a):b};goog.dom.hasSpecifiedTabIndex_=function(a){return goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9")?(a=a.getAttributeNode("tabindex"),null!=a&&a.specified):a.hasAttribute("tabindex")};
|
|
goog.dom.isTabIndexFocusable_=function(a){a=a.tabIndex;return"number"===typeof a&&0<=a&&32768>a};goog.dom.nativelySupportsFocus_=function(a){return"A"==a.tagName&&a.hasAttribute("href")||"INPUT"==a.tagName||"TEXTAREA"==a.tagName||"SELECT"==a.tagName||"BUTTON"==a.tagName};
|
|
goog.dom.hasNonZeroBoundingRect_=function(a){a=!goog.isFunction(a.getBoundingClientRect)||goog.userAgent.IE&&null==a.parentElement?{height:a.offsetHeight,width:a.offsetWidth}:a.getBoundingClientRect();return null!=a&&0<a.height&&0<a.width};
|
|
goog.dom.getTextContent=function(a){if(goog.dom.BrowserFeature.CAN_USE_INNER_TEXT&&null!==a&&"innerText"in a)a=goog.string.canonicalizeNewlines(a.innerText);else{var b=[];goog.dom.getTextContent_(a,b,!0);a=b.join("")}a=a.replace(/ \xAD /g," ").replace(/\xAD/g,"");a=a.replace(/\u200B/g,"");goog.dom.BrowserFeature.CAN_USE_INNER_TEXT||(a=a.replace(/ +/g," "));" "!=a&&(a=a.replace(/^\s*/,""));return a};goog.dom.getRawTextContent=function(a){var b=[];goog.dom.getTextContent_(a,b,!1);return b.join("")};
|
|
goog.dom.getTextContent_=function(a,b,c){if(!(a.nodeName in goog.dom.TAGS_TO_IGNORE_))if(a.nodeType==goog.dom.NodeType.TEXT)c?b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)b.push(goog.dom.PREDEFINED_TAG_VALUES_[a.nodeName]);else for(a=a.firstChild;a;)goog.dom.getTextContent_(a,b,c),a=a.nextSibling};goog.dom.getNodeTextLength=function(a){return goog.dom.getTextContent(a).length};
|
|
goog.dom.getNodeTextOffset=function(a,b){for(var c=b||goog.dom.getOwnerDocument(a).body,d=[];a&&a!=c;){for(var e=a;e=e.previousSibling;)d.unshift(goog.dom.getTextContent(e));a=a.parentNode}return goog.string.trimLeft(d.join("")).replace(/ +/g," ").length};
|
|
goog.dom.getNodeAtOffset=function(a,b,c){a=[a];for(var d=0,e=null;0<a.length&&d<b;)if(e=a.pop(),!(e.nodeName in goog.dom.TAGS_TO_IGNORE_))if(e.nodeType==goog.dom.NodeType.TEXT){var f=e.nodeValue.replace(/(\r\n|\r|\n)/g,"").replace(/ +/g," ");d+=f.length}else if(e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)d+=goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName].length;else for(f=e.childNodes.length-1;0<=f;f--)a.push(e.childNodes[f]);goog.isObject(c)&&(c.remainder=e?e.nodeValue.length+b-d-1:0,c.node=e);return e};
|
|
goog.dom.isNodeList=function(a){if(a&&"number"==typeof a.length){if(goog.isObject(a))return"function"==typeof a.item||"string"==typeof a.item;if(goog.isFunction(a))return"function"==typeof a.item}return!1};goog.dom.getAncestorByTagNameAndClass=function(a,b,c,d){if(!b&&!c)return null;var e=b?String(b).toUpperCase():null;return goog.dom.getAncestor(a,function(a){return(!e||a.nodeName==e)&&(!c||"string"===typeof a.className&&goog.array.contains(a.className.split(/\s+/),c))},!0,d)};
|
|
goog.dom.getAncestorByClass=function(a,b,c){return goog.dom.getAncestorByTagNameAndClass(a,null,b,c)};goog.dom.getAncestor=function(a,b,c,d){a&&!c&&(a=a.parentNode);for(c=0;a&&(null==d||c<=d);){goog.asserts.assert("parentNode"!=a.name);if(b(a))return a;a=a.parentNode;c++}return null};goog.dom.getActiveElement=function(a){try{var b=a&&a.activeElement;return b&&b.nodeName?b:null}catch(c){return null}};
|
|
goog.dom.getPixelRatio=function(){var a=goog.dom.getWindow();return void 0!==a.devicePixelRatio?a.devicePixelRatio:a.matchMedia?goog.dom.matchesPixelRatio_(3)||goog.dom.matchesPixelRatio_(2)||goog.dom.matchesPixelRatio_(1.5)||goog.dom.matchesPixelRatio_(1)||.75:1};goog.dom.matchesPixelRatio_=function(a){return goog.dom.getWindow().matchMedia("(min-resolution: "+a+"dppx),(min--moz-device-pixel-ratio: "+a+"),(min-resolution: "+96*a+"dpi)").matches?a:0};goog.dom.getCanvasContext2D=function(a){return a.getContext("2d")};
|
|
goog.dom.DomHelper=function(a){this.document_=a||goog.global.document||document};goog.dom.DomHelper.prototype.getDomHelper=goog.dom.getDomHelper;goog.dom.DomHelper.prototype.setDocument=function(a){this.document_=a};goog.dom.DomHelper.prototype.getDocument=function(){return this.document_};goog.dom.DomHelper.prototype.getElement=function(a){return goog.dom.getElementHelper_(this.document_,a)};
|
|
goog.dom.DomHelper.prototype.getRequiredElement=function(a){return goog.dom.getRequiredElementHelper_(this.document_,a)};goog.dom.DomHelper.prototype.$=goog.dom.DomHelper.prototype.getElement;goog.dom.DomHelper.prototype.getElementsByTagName=function(a,b){return(b||this.document_).getElementsByTagName(String(a))};goog.dom.DomHelper.prototype.getElementsByTagNameAndClass=function(a,b,c){return goog.dom.getElementsByTagNameAndClass_(this.document_,a,b,c)};
|
|
goog.dom.DomHelper.prototype.getElementByTagNameAndClass=function(a,b,c){return goog.dom.getElementByTagNameAndClass_(this.document_,a,b,c)};goog.dom.DomHelper.prototype.getElementsByClass=function(a,b){return goog.dom.getElementsByClass(a,b||this.document_)};goog.dom.DomHelper.prototype.getElementByClass=function(a,b){return goog.dom.getElementByClass(a,b||this.document_)};goog.dom.DomHelper.prototype.getRequiredElementByClass=function(a,b){return goog.dom.getRequiredElementByClass(a,b||this.document_)};
|
|
goog.dom.DomHelper.prototype.$$=goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;goog.dom.DomHelper.prototype.setProperties=goog.dom.setProperties;goog.dom.DomHelper.prototype.getViewportSize=function(a){return goog.dom.getViewportSize(a||this.getWindow())};goog.dom.DomHelper.prototype.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(this.getWindow())};goog.dom.DomHelper.prototype.createDom=function(a,b,c){return goog.dom.createDom_(this.document_,arguments)};
|
|
goog.dom.DomHelper.prototype.$dom=goog.dom.DomHelper.prototype.createDom;goog.dom.DomHelper.prototype.createElement=function(a){return goog.dom.createElement_(this.document_,a)};goog.dom.DomHelper.prototype.createTextNode=function(a){return this.document_.createTextNode(String(a))};goog.dom.DomHelper.prototype.createTable=function(a,b,c){return goog.dom.createTable_(this.document_,a,b,!!c)};goog.dom.DomHelper.prototype.safeHtmlToNode=function(a){return goog.dom.safeHtmlToNode_(this.document_,a)};
|
|
goog.dom.DomHelper.prototype.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(this.document_)};goog.dom.DomHelper.prototype.getWindow=function(){return goog.dom.getWindow_(this.document_)};goog.dom.DomHelper.prototype.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(this.document_)};goog.dom.DomHelper.prototype.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(this.document_)};
|
|
goog.dom.DomHelper.prototype.getActiveElement=function(a){return goog.dom.getActiveElement(a||this.document_)};goog.dom.DomHelper.prototype.appendChild=goog.dom.appendChild;goog.dom.DomHelper.prototype.append=goog.dom.append;goog.dom.DomHelper.prototype.canHaveChildren=goog.dom.canHaveChildren;goog.dom.DomHelper.prototype.removeChildren=goog.dom.removeChildren;goog.dom.DomHelper.prototype.insertSiblingBefore=goog.dom.insertSiblingBefore;goog.dom.DomHelper.prototype.insertSiblingAfter=goog.dom.insertSiblingAfter;
|
|
goog.dom.DomHelper.prototype.insertChildAt=goog.dom.insertChildAt;goog.dom.DomHelper.prototype.removeNode=goog.dom.removeNode;goog.dom.DomHelper.prototype.replaceNode=goog.dom.replaceNode;goog.dom.DomHelper.prototype.flattenElement=goog.dom.flattenElement;goog.dom.DomHelper.prototype.getChildren=goog.dom.getChildren;goog.dom.DomHelper.prototype.getFirstElementChild=goog.dom.getFirstElementChild;goog.dom.DomHelper.prototype.getLastElementChild=goog.dom.getLastElementChild;
|
|
goog.dom.DomHelper.prototype.getNextElementSibling=goog.dom.getNextElementSibling;goog.dom.DomHelper.prototype.getPreviousElementSibling=goog.dom.getPreviousElementSibling;goog.dom.DomHelper.prototype.getNextNode=goog.dom.getNextNode;goog.dom.DomHelper.prototype.getPreviousNode=goog.dom.getPreviousNode;goog.dom.DomHelper.prototype.isNodeLike=goog.dom.isNodeLike;goog.dom.DomHelper.prototype.isElement=goog.dom.isElement;goog.dom.DomHelper.prototype.isWindow=goog.dom.isWindow;
|
|
goog.dom.DomHelper.prototype.getParentElement=goog.dom.getParentElement;goog.dom.DomHelper.prototype.contains=goog.dom.contains;goog.dom.DomHelper.prototype.compareNodeOrder=goog.dom.compareNodeOrder;goog.dom.DomHelper.prototype.findCommonAncestor=goog.dom.findCommonAncestor;goog.dom.DomHelper.prototype.getOwnerDocument=goog.dom.getOwnerDocument;goog.dom.DomHelper.prototype.getFrameContentDocument=goog.dom.getFrameContentDocument;goog.dom.DomHelper.prototype.getFrameContentWindow=goog.dom.getFrameContentWindow;
|
|
goog.dom.DomHelper.prototype.setTextContent=goog.dom.setTextContent;goog.dom.DomHelper.prototype.getOuterHtml=goog.dom.getOuterHtml;goog.dom.DomHelper.prototype.findNode=goog.dom.findNode;goog.dom.DomHelper.prototype.findNodes=goog.dom.findNodes;goog.dom.DomHelper.prototype.isFocusableTabIndex=goog.dom.isFocusableTabIndex;goog.dom.DomHelper.prototype.setFocusableTabIndex=goog.dom.setFocusableTabIndex;goog.dom.DomHelper.prototype.isFocusable=goog.dom.isFocusable;
|
|
goog.dom.DomHelper.prototype.getTextContent=goog.dom.getTextContent;goog.dom.DomHelper.prototype.getNodeTextLength=goog.dom.getNodeTextLength;goog.dom.DomHelper.prototype.getNodeTextOffset=goog.dom.getNodeTextOffset;goog.dom.DomHelper.prototype.getNodeAtOffset=goog.dom.getNodeAtOffset;goog.dom.DomHelper.prototype.isNodeList=goog.dom.isNodeList;goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass=goog.dom.getAncestorByTagNameAndClass;goog.dom.DomHelper.prototype.getAncestorByClass=goog.dom.getAncestorByClass;
|
|
goog.dom.DomHelper.prototype.getAncestor=goog.dom.getAncestor;goog.dom.DomHelper.prototype.getCanvasContext2D=goog.dom.getCanvasContext2D;goog.dom.vendor={};goog.dom.vendor.getVendorJsPrefix=function(){return goog.userAgent.WEBKIT?"Webkit":goog.userAgent.GECKO?"Moz":goog.userAgent.IE?"ms":goog.userAgent.OPERA?"O":null};goog.dom.vendor.getVendorPrefix=function(){return goog.userAgent.WEBKIT?"-webkit":goog.userAgent.GECKO?"-moz":goog.userAgent.IE?"-ms":goog.userAgent.OPERA?"-o":null};
|
|
goog.dom.vendor.getPrefixedPropertyName=function(a,b){if(b&&a in b)return a;var c=goog.dom.vendor.getVendorJsPrefix();return c?(c=c.toLowerCase(),c+=goog.string.toTitleCase(a),void 0===b||c in b?c:null):null};goog.dom.vendor.getPrefixedEventType=function(a){return((goog.dom.vendor.getVendorJsPrefix()||"")+a).toLowerCase()};goog.math.Box=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d};goog.math.Box.boundingBox=function(a){for(var b=new goog.math.Box(arguments[0].y,arguments[0].x,arguments[0].y,arguments[0].x),c=1;c<arguments.length;c++)b.expandToIncludeCoordinate(arguments[c]);return b};goog.math.Box.prototype.getWidth=function(){return this.right-this.left};goog.math.Box.prototype.getHeight=function(){return this.bottom-this.top};
|
|
goog.math.Box.prototype.clone=function(){return new goog.math.Box(this.top,this.right,this.bottom,this.left)};goog.DEBUG&&(goog.math.Box.prototype.toString=function(){return"("+this.top+"t, "+this.right+"r, "+this.bottom+"b, "+this.left+"l)"});goog.math.Box.prototype.contains=function(a){return goog.math.Box.contains(this,a)};
|
|
goog.math.Box.prototype.expand=function(a,b,c,d){goog.isObject(a)?(this.top-=a.top,this.right+=a.right,this.bottom+=a.bottom,this.left-=a.left):(this.top-=a,this.right+=Number(b),this.bottom+=Number(c),this.left-=Number(d));return this};goog.math.Box.prototype.expandToInclude=function(a){this.left=Math.min(this.left,a.left);this.top=Math.min(this.top,a.top);this.right=Math.max(this.right,a.right);this.bottom=Math.max(this.bottom,a.bottom)};
|
|
goog.math.Box.prototype.expandToIncludeCoordinate=function(a){this.top=Math.min(this.top,a.y);this.right=Math.max(this.right,a.x);this.bottom=Math.max(this.bottom,a.y);this.left=Math.min(this.left,a.x)};goog.math.Box.equals=function(a,b){return a==b?!0:a&&b?a.top==b.top&&a.right==b.right&&a.bottom==b.bottom&&a.left==b.left:!1};
|
|
goog.math.Box.contains=function(a,b){return a&&b?b instanceof goog.math.Box?b.left>=a.left&&b.right<=a.right&&b.top>=a.top&&b.bottom<=a.bottom:b.x>=a.left&&b.x<=a.right&&b.y>=a.top&&b.y<=a.bottom:!1};goog.math.Box.relativePositionX=function(a,b){return b.x<a.left?b.x-a.left:b.x>a.right?b.x-a.right:0};goog.math.Box.relativePositionY=function(a,b){return b.y<a.top?b.y-a.top:b.y>a.bottom?b.y-a.bottom:0};
|
|
goog.math.Box.distance=function(a,b){var c=goog.math.Box.relativePositionX(a,b),d=goog.math.Box.relativePositionY(a,b);return Math.sqrt(c*c+d*d)};goog.math.Box.intersects=function(a,b){return a.left<=b.right&&b.left<=a.right&&a.top<=b.bottom&&b.top<=a.bottom};goog.math.Box.intersectsWithPadding=function(a,b,c){return a.left<=b.right+c&&b.left<=a.right+c&&a.top<=b.bottom+c&&b.top<=a.bottom+c};
|
|
goog.math.Box.prototype.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};goog.math.Box.prototype.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};
|
|
goog.math.Box.prototype.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};goog.math.Box.prototype.translate=function(a,b){a instanceof goog.math.Coordinate?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(goog.asserts.assertNumber(a),this.left+=a,this.right+=a,"number"===typeof b&&(this.top+=b,this.bottom+=b));return this};
|
|
goog.math.Box.prototype.scale=function(a,b){var c="number"===typeof b?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};goog.math.IRect=function(){};goog.math.Rect=function(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d};goog.math.Rect.prototype.clone=function(){return new goog.math.Rect(this.left,this.top,this.width,this.height)};goog.math.Rect.prototype.toBox=function(){return new goog.math.Box(this.top,this.left+this.width,this.top+this.height,this.left)};goog.math.Rect.createFromPositionAndSize=function(a,b){return new goog.math.Rect(a.x,a.y,b.width,b.height)};
|
|
goog.math.Rect.createFromBox=function(a){return new goog.math.Rect(a.left,a.top,a.right-a.left,a.bottom-a.top)};goog.DEBUG&&(goog.math.Rect.prototype.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"});goog.math.Rect.equals=function(a,b){return a==b?!0:a&&b?a.left==b.left&&a.width==b.width&&a.top==b.top&&a.height==b.height:!1};
|
|
goog.math.Rect.prototype.intersection=function(a){var b=Math.max(this.left,a.left),c=Math.min(this.left+this.width,a.left+a.width);if(b<=c){var d=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(d<=a)return this.left=b,this.top=d,this.width=c-b,this.height=a-d,!0}return!1};
|
|
goog.math.Rect.intersection=function(a,b){var c=Math.max(a.left,b.left),d=Math.min(a.left+a.width,b.left+b.width);if(c<=d){var e=Math.max(a.top,b.top),f=Math.min(a.top+a.height,b.top+b.height);if(e<=f)return new goog.math.Rect(c,e,d-c,f-e)}return null};goog.math.Rect.intersects=function(a,b){return a.left<=b.left+b.width&&b.left<=a.left+a.width&&a.top<=b.top+b.height&&b.top<=a.top+a.height};goog.math.Rect.prototype.intersects=function(a){return goog.math.Rect.intersects(this,a)};
|
|
goog.math.Rect.difference=function(a,b){var c=goog.math.Rect.intersection(a,b);if(!c||!c.height||!c.width)return[a.clone()];c=[];var d=a.top,e=a.height,f=a.left+a.width,g=a.top+a.height,h=b.left+b.width,k=b.top+b.height;b.top>a.top&&(c.push(new goog.math.Rect(a.left,a.top,a.width,b.top-a.top)),d=b.top,e-=b.top-a.top);k<g&&(c.push(new goog.math.Rect(a.left,k,a.width,g-k)),e=k-d);b.left>a.left&&c.push(new goog.math.Rect(a.left,d,b.left-a.left,e));h<f&&c.push(new goog.math.Rect(h,d,f-h,e));return c};
|
|
goog.math.Rect.prototype.difference=function(a){return goog.math.Rect.difference(this,a)};goog.math.Rect.prototype.boundingRect=function(a){var b=Math.max(this.left+this.width,a.left+a.width),c=Math.max(this.top+this.height,a.top+a.height);this.left=Math.min(this.left,a.left);this.top=Math.min(this.top,a.top);this.width=b-this.left;this.height=c-this.top};goog.math.Rect.boundingRect=function(a,b){if(!a||!b)return null;var c=new goog.math.Rect(a.left,a.top,a.width,a.height);c.boundingRect(b);return c};
|
|
goog.math.Rect.prototype.contains=function(a){return a instanceof goog.math.Coordinate?a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height:this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height};goog.math.Rect.prototype.squaredDistance=function(a){var b=a.x<this.left?this.left-a.x:Math.max(a.x-(this.left+this.width),0);a=a.y<this.top?this.top-a.y:Math.max(a.y-(this.top+this.height),0);return b*b+a*a};
|
|
goog.math.Rect.prototype.distance=function(a){return Math.sqrt(this.squaredDistance(a))};goog.math.Rect.prototype.getSize=function(){return new goog.math.Size(this.width,this.height)};goog.math.Rect.prototype.getTopLeft=function(){return new goog.math.Coordinate(this.left,this.top)};goog.math.Rect.prototype.getCenter=function(){return new goog.math.Coordinate(this.left+this.width/2,this.top+this.height/2)};
|
|
goog.math.Rect.prototype.getBottomRight=function(){return new goog.math.Coordinate(this.left+this.width,this.top+this.height)};goog.math.Rect.prototype.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};goog.math.Rect.prototype.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};
|
|
goog.math.Rect.prototype.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};goog.math.Rect.prototype.translate=function(a,b){a instanceof goog.math.Coordinate?(this.left+=a.x,this.top+=a.y):(this.left+=goog.asserts.assertNumber(a),"number"===typeof b&&(this.top+=b));return this};
|
|
goog.math.Rect.prototype.scale=function(a,b){var c="number"===typeof b?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};goog.style={};goog.style.setStyle=function(a,b,c){if("string"===typeof b)goog.style.setStyle_(a,c,b);else for(var d in b)goog.style.setStyle_(a,b[d],d)};goog.style.setStyle_=function(a,b,c){(c=goog.style.getVendorJsStyleName_(a,c))&&(a.style[c]=b)};goog.style.styleNameCache_={};
|
|
goog.style.getVendorJsStyleName_=function(a,b){var c=goog.style.styleNameCache_[b];if(!c){var d=goog.string.toCamelCase(b);c=d;void 0===a.style[d]&&(d=goog.dom.vendor.getVendorJsPrefix()+goog.string.toTitleCase(d),void 0!==a.style[d]&&(c=d));goog.style.styleNameCache_[b]=c}return c};
|
|
goog.style.getVendorStyleName_=function(a,b){var c=goog.string.toCamelCase(b);return void 0===a.style[c]&&(c=goog.dom.vendor.getVendorJsPrefix()+goog.string.toTitleCase(c),void 0!==a.style[c])?goog.dom.vendor.getVendorPrefix()+"-"+b:b};goog.style.getStyle=function(a,b){var c=a.style[goog.string.toCamelCase(b)];return"undefined"!==typeof c?c:a.style[goog.style.getVendorJsStyleName_(a,b)]||""};
|
|
goog.style.getComputedStyle=function(a,b){var c=goog.dom.getOwnerDocument(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,null))?c[b]||c.getPropertyValue(b)||"":""};goog.style.getCascadedStyle=function(a,b){return a.currentStyle?a.currentStyle[b]:null};goog.style.getStyle_=function(a,b){return goog.style.getComputedStyle(a,b)||goog.style.getCascadedStyle(a,b)||a.style&&a.style[b]};
|
|
goog.style.getComputedBoxSizing=function(a){return goog.style.getStyle_(a,"boxSizing")||goog.style.getStyle_(a,"MozBoxSizing")||goog.style.getStyle_(a,"WebkitBoxSizing")||null};goog.style.getComputedPosition=function(a){return goog.style.getStyle_(a,"position")};goog.style.getBackgroundColor=function(a){return goog.style.getStyle_(a,"backgroundColor")};goog.style.getComputedOverflowX=function(a){return goog.style.getStyle_(a,"overflowX")};
|
|
goog.style.getComputedOverflowY=function(a){return goog.style.getStyle_(a,"overflowY")};goog.style.getComputedZIndex=function(a){return goog.style.getStyle_(a,"zIndex")};goog.style.getComputedTextAlign=function(a){return goog.style.getStyle_(a,"textAlign")};goog.style.getComputedCursor=function(a){return goog.style.getStyle_(a,"cursor")};goog.style.getComputedTransform=function(a){var b=goog.style.getVendorStyleName_(a,"transform");return goog.style.getStyle_(a,b)||goog.style.getStyle_(a,"transform")};
|
|
goog.style.setPosition=function(a,b,c){if(b instanceof goog.math.Coordinate){var d=b.x;b=b.y}else d=b,b=c;a.style.left=goog.style.getPixelStyleValue_(d,!1);a.style.top=goog.style.getPixelStyleValue_(b,!1)};goog.style.getPosition=function(a){return new goog.math.Coordinate(a.offsetLeft,a.offsetTop)};
|
|
goog.style.getClientViewportElement=function(a){a=a?goog.dom.getOwnerDocument(a):goog.dom.getDocument();return!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9)||goog.dom.getDomHelper(a).isCss1CompatMode()?a.documentElement:a.body};goog.style.getViewportPageOffset=function(a){var b=a.body;a=a.documentElement;return new goog.math.Coordinate(b.scrollLeft||a.scrollLeft,b.scrollTop||a.scrollTop)};
|
|
goog.style.getBoundingClientRect_=function(a){try{var b=a.getBoundingClientRect()}catch(c){return{left:0,top:0,right:0,bottom:0}}goog.userAgent.IE&&a.ownerDocument.body&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b};
|
|
goog.style.getOffsetParent=function(a){if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(8))return goog.asserts.assert(a&&"offsetParent"in a),a.offsetParent;var b=goog.dom.getOwnerDocument(a),c=goog.style.getStyle_(a,"position"),d="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(a.nodeType==goog.dom.NodeType.DOCUMENT_FRAGMENT&&a.host&&(a=a.host),c=goog.style.getStyle_(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||
|
|
a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return null};
|
|
goog.style.getVisibleRectForElement=function(a){for(var b=new goog.math.Box(0,Infinity,Infinity,0),c=goog.dom.getDomHelper(a),d=c.getDocument().body,e=c.getDocument().documentElement,f=c.getDocumentScrollElement();a=goog.style.getOffsetParent(a);)if(!(goog.userAgent.IE&&0==a.clientWidth||goog.userAgent.WEBKIT&&0==a.clientHeight&&a==d)&&a!=d&&a!=e&&"visible"!=goog.style.getStyle_(a,"overflow")){var g=goog.style.getPageOffset(a),h=goog.style.getClientLeftTop(a);g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,
|
|
g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=c.getViewportSize();b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?b:null};
|
|
goog.style.getContainerOffsetToScrollInto=function(a,b,c){var d=b||goog.dom.getDocumentScrollElement(),e=goog.style.getPageOffset(a),f=goog.style.getPageOffset(d),g=goog.style.getBorderBox(d);d==goog.dom.getDocumentScrollElement()?(b=e.x-d.scrollLeft,e=e.y-d.scrollTop,goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(10)&&(b+=g.left,e+=g.top)):(b=e.x-f.x-g.left,e=e.y-f.y-g.top);g=goog.style.getSizeWithDisplay_(a);a=d.clientWidth-g.width;g=d.clientHeight-g.height;f=d.scrollLeft;d=d.scrollTop;
|
|
c?(f+=b-a/2,d+=e-g/2):(f+=Math.min(b,Math.max(b-a,0)),d+=Math.min(e,Math.max(e-g,0)));return new goog.math.Coordinate(f,d)};goog.style.scrollIntoContainerView=function(a,b,c){b=b||goog.dom.getDocumentScrollElement();a=goog.style.getContainerOffsetToScrollInto(a,b,c);b.scrollLeft=a.x;b.scrollTop=a.y};goog.style.getClientLeftTop=function(a){return new goog.math.Coordinate(a.clientLeft,a.clientTop)};
|
|
goog.style.getPageOffset=function(a){var b=goog.dom.getOwnerDocument(a);goog.asserts.assertObject(a,"Parameter is required");var c=new goog.math.Coordinate(0,0),d=goog.style.getClientViewportElement(b);if(a==d)return c;a=goog.style.getBoundingClientRect_(a);b=goog.dom.getDomHelper(b).getDocumentScroll();c.x=a.left+b.x;c.y=a.top+b.y;return c};goog.style.getPageOffsetLeft=function(a){return goog.style.getPageOffset(a).x};goog.style.getPageOffsetTop=function(a){return goog.style.getPageOffset(a).y};
|
|
goog.style.getFramedPageOffset=function(a,b){var c=new goog.math.Coordinate(0,0),d=goog.dom.getWindow(goog.dom.getOwnerDocument(a));if(!goog.reflect.canAccessProperty(d,"parent"))return c;var e=a;do{var f=d==b?goog.style.getPageOffset(e):goog.style.getClientPositionForElement_(goog.asserts.assert(e));c.x+=f.x;c.y+=f.y}while(d&&d!=b&&d!=d.parent&&(e=d.frameElement)&&(d=d.parent));return c};
|
|
goog.style.translateRectForAnotherFrame=function(a,b,c){if(b.getDocument()!=c.getDocument()){var d=b.getDocument().body;c=goog.style.getFramedPageOffset(d,c.getWindow());c=goog.math.Coordinate.difference(c,goog.style.getPageOffset(d));!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9)||b.isCss1CompatMode()||(c=goog.math.Coordinate.difference(c,b.getDocumentScroll()));a.left+=c.x;a.top+=c.y}};
|
|
goog.style.getRelativePosition=function(a,b){var c=goog.style.getClientPosition(a),d=goog.style.getClientPosition(b);return new goog.math.Coordinate(c.x-d.x,c.y-d.y)};goog.style.getClientPositionForElement_=function(a){a=goog.style.getBoundingClientRect_(a);return new goog.math.Coordinate(a.left,a.top)};
|
|
goog.style.getClientPosition=function(a){goog.asserts.assert(a);if(a.nodeType==goog.dom.NodeType.ELEMENT)return goog.style.getClientPositionForElement_(a);a=a.changedTouches?a.changedTouches[0]:a;return new goog.math.Coordinate(a.clientX,a.clientY)};goog.style.setPageOffset=function(a,b,c){var d=goog.style.getPageOffset(a);b instanceof goog.math.Coordinate&&(c=b.y,b=b.x);b=goog.asserts.assertNumber(b)-d.x;goog.style.setPosition(a,a.offsetLeft+b,a.offsetTop+(Number(c)-d.y))};
|
|
goog.style.setSize=function(a,b,c){if(b instanceof goog.math.Size)c=b.height,b=b.width;else if(void 0==c)throw Error("missing height argument");goog.style.setWidth(a,b);goog.style.setHeight(a,c)};goog.style.getPixelStyleValue_=function(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a};goog.style.setHeight=function(a,b){a.style.height=goog.style.getPixelStyleValue_(b,!0)};goog.style.setWidth=function(a,b){a.style.width=goog.style.getPixelStyleValue_(b,!0)};
|
|
goog.style.getSize=function(a){return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_,a)};goog.style.evaluateWithTemporaryDisplay_=function(a,b){if("none"!=goog.style.getStyle_(b,"display"))return a(b);var c=b.style,d=c.display,e=c.visibility,f=c.position;c.visibility="hidden";c.position="absolute";c.display="inline";var g=a(b);c.display=d;c.position=f;c.visibility=e;return g};
|
|
goog.style.getSizeWithDisplay_=function(a){var b=a.offsetWidth,c=a.offsetHeight,d=goog.userAgent.WEBKIT&&!b&&!c;return(void 0===b||d)&&a.getBoundingClientRect?(a=goog.style.getBoundingClientRect_(a),new goog.math.Size(a.right-a.left,a.bottom-a.top)):new goog.math.Size(b,c)};goog.style.getTransformedSize=function(a){if(!a.getBoundingClientRect)return null;a=goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_,a);return new goog.math.Size(a.right-a.left,a.bottom-a.top)};
|
|
goog.style.getBounds=function(a){var b=goog.style.getPageOffset(a);a=goog.style.getSize(a);return new goog.math.Rect(b.x,b.y,a.width,a.height)};goog.style.toCamelCase=function(a){return goog.string.toCamelCase(String(a))};goog.style.toSelectorCase=function(a){return goog.string.toSelectorCase(a)};
|
|
goog.style.getOpacity=function(a){goog.asserts.assert(a);var b=a.style;a="";"opacity"in b?a=b.opacity:"MozOpacity"in b?a=b.MozOpacity:"filter"in b&&(b=b.filter.match(/alpha\(opacity=([\d.]+)\)/))&&(a=String(b[1]/100));return""==a?a:Number(a)};goog.style.setOpacity=function(a,b){goog.asserts.assert(a);var c=a.style;"opacity"in c?c.opacity=b:"MozOpacity"in c?c.MozOpacity=b:"filter"in c&&(c.filter=""===b?"":"alpha(opacity="+100*Number(b)+")")};
|
|
goog.style.setTransparentBackgroundImage=function(a,b){var c=a.style;goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?c.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+b+'", sizingMethod="crop")':(c.backgroundImage="url("+b+")",c.backgroundPosition="top left",c.backgroundRepeat="no-repeat")};goog.style.clearTransparentBackgroundImage=function(a){a=a.style;"filter"in a?a.filter="":a.backgroundImage="none"};
|
|
goog.style.showElement=function(a,b){goog.style.setElementShown(a,b)};goog.style.setElementShown=function(a,b){a.style.display=b?"":"none"};goog.style.isElementShown=function(a){return"none"!=a.style.display};
|
|
goog.style.installSafeStyleSheet=function(a,b){var c=goog.dom.getDomHelper(b),d=c.getDocument();if(goog.userAgent.IE&&d.createStyleSheet)return c=d.createStyleSheet(),goog.style.setSafeStyleSheet(c,a),c;d=c.getElementsByTagNameAndClass("HEAD")[0];if(!d){var e=c.getElementsByTagNameAndClass("BODY")[0];d=c.createDom("HEAD");e.parentNode.insertBefore(d,e)}e=c.createDom("STYLE");goog.style.setSafeStyleSheet(e,a);c.appendChild(d,e);return e};
|
|
goog.style.uninstallStyles=function(a){goog.dom.removeNode(a.ownerNode||a.owningElement||a)};goog.style.setSafeStyleSheet=function(a,b){var c=goog.html.SafeStyleSheet.unwrap(b);goog.userAgent.IE&&void 0!==a.cssText?a.cssText=c:a.innerHTML=c};goog.style.setPreWrap=function(a){a=a.style;goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?(a.whiteSpace="pre",a.wordWrap="break-word"):a.whiteSpace=goog.userAgent.GECKO?"-moz-pre-wrap":"pre-wrap"};
|
|
goog.style.setInlineBlock=function(a){a=a.style;a.position="relative";goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?(a.zoom="1",a.display="inline"):a.display="inline-block"};goog.style.isRightToLeft=function(a){return"rtl"==goog.style.getStyle_(a,"direction")};goog.style.unselectableStyle_=goog.userAgent.GECKO?"MozUserSelect":goog.userAgent.WEBKIT||goog.userAgent.EDGE?"WebkitUserSelect":null;
|
|
goog.style.isUnselectable=function(a){return goog.style.unselectableStyle_?"none"==a.style[goog.style.unselectableStyle_].toLowerCase():goog.userAgent.IE||goog.userAgent.OPERA?"on"==a.getAttribute("unselectable"):!1};
|
|
goog.style.setUnselectable=function(a,b,c){c=c?null:a.getElementsByTagName("*");var d=goog.style.unselectableStyle_;if(d){if(b=b?"none":"",a.style&&(a.style[d]=b),c){a=0;for(var e;e=c[a];a++)e.style&&(e.style[d]=b)}}else if(goog.userAgent.IE||goog.userAgent.OPERA)if(b=b?"on":"",a.setAttribute("unselectable",b),c)for(a=0;e=c[a];a++)e.setAttribute("unselectable",b)};goog.style.getBorderBoxSize=function(a){return new goog.math.Size(a.offsetWidth,a.offsetHeight)};
|
|
goog.style.setBorderBoxSize=function(a,b){var c=goog.dom.getOwnerDocument(a),d=goog.dom.getDomHelper(c).isCss1CompatMode();if(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10")||d&&goog.userAgent.isVersionOrHigher("8"))goog.style.setBoxSizingSize_(a,b,"border-box");else if(c=a.style,d){d=goog.style.getPaddingBox(a);var e=goog.style.getBorderBox(a);c.pixelWidth=b.width-e.left-d.left-d.right-e.right;c.pixelHeight=b.height-e.top-d.top-d.bottom-e.bottom}else c.pixelWidth=b.width,c.pixelHeight=
|
|
b.height};
|
|
goog.style.getContentBoxSize=function(a){var b=goog.dom.getOwnerDocument(a),c=goog.userAgent.IE&&a.currentStyle;if(c&&goog.dom.getDomHelper(b).isCss1CompatMode()&&"auto"!=c.width&&"auto"!=c.height&&!c.boxSizing)return b=goog.style.getIePixelValue_(a,c.width,"width","pixelWidth"),a=goog.style.getIePixelValue_(a,c.height,"height","pixelHeight"),new goog.math.Size(b,a);c=goog.style.getBorderBoxSize(a);b=goog.style.getPaddingBox(a);a=goog.style.getBorderBox(a);return new goog.math.Size(c.width-a.left-
|
|
b.left-b.right-a.right,c.height-a.top-b.top-b.bottom-a.bottom)};
|
|
goog.style.setContentBoxSize=function(a,b){var c=goog.dom.getOwnerDocument(a),d=goog.dom.getDomHelper(c).isCss1CompatMode();if(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10")||d&&goog.userAgent.isVersionOrHigher("8"))goog.style.setBoxSizingSize_(a,b,"content-box");else if(c=a.style,d)c.pixelWidth=b.width,c.pixelHeight=b.height;else{d=goog.style.getPaddingBox(a);var e=goog.style.getBorderBox(a);c.pixelWidth=b.width+e.left+d.left+d.right+e.right;c.pixelHeight=b.height+e.top+d.top+d.bottom+
|
|
e.bottom}};goog.style.setBoxSizingSize_=function(a,b,c){a=a.style;goog.userAgent.GECKO?a.MozBoxSizing=c:goog.userAgent.WEBKIT?a.WebkitBoxSizing=c:a.boxSizing=c;a.width=Math.max(b.width,0)+"px";a.height=Math.max(b.height,0)+"px"};goog.style.getIePixelValue_=function(a,b,c,d){if(/^\d+px?$/.test(b))return parseInt(b,10);var e=a.style[c],f=a.runtimeStyle[c];a.runtimeStyle[c]=a.currentStyle[c];a.style[c]=b;b=a.style[d];a.style[c]=e;a.runtimeStyle[c]=f;return+b};
|
|
goog.style.getIePixelDistance_=function(a,b){var c=goog.style.getCascadedStyle(a,b);return c?goog.style.getIePixelValue_(a,c,"left","pixelLeft"):0};
|
|
goog.style.getBox_=function(a,b){if(goog.userAgent.IE){var c=goog.style.getIePixelDistance_(a,b+"Left"),d=goog.style.getIePixelDistance_(a,b+"Right"),e=goog.style.getIePixelDistance_(a,b+"Top"),f=goog.style.getIePixelDistance_(a,b+"Bottom");return new goog.math.Box(e,d,f,c)}c=goog.style.getComputedStyle(a,b+"Left");d=goog.style.getComputedStyle(a,b+"Right");e=goog.style.getComputedStyle(a,b+"Top");f=goog.style.getComputedStyle(a,b+"Bottom");return new goog.math.Box(parseFloat(e),parseFloat(d),parseFloat(f),
|
|
parseFloat(c))};goog.style.getPaddingBox=function(a){return goog.style.getBox_(a,"padding")};goog.style.getMarginBox=function(a){return goog.style.getBox_(a,"margin")};goog.style.ieBorderWidthKeywords_={thin:2,medium:4,thick:6};
|
|
goog.style.getIePixelBorder_=function(a,b){if("none"==goog.style.getCascadedStyle(a,b+"Style"))return 0;var c=goog.style.getCascadedStyle(a,b+"Width");return c in goog.style.ieBorderWidthKeywords_?goog.style.ieBorderWidthKeywords_[c]:goog.style.getIePixelValue_(a,c,"left","pixelLeft")};
|
|
goog.style.getBorderBox=function(a){if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)){var b=goog.style.getIePixelBorder_(a,"borderLeft"),c=goog.style.getIePixelBorder_(a,"borderRight"),d=goog.style.getIePixelBorder_(a,"borderTop");a=goog.style.getIePixelBorder_(a,"borderBottom");return new goog.math.Box(d,c,a,b)}b=goog.style.getComputedStyle(a,"borderLeftWidth");c=goog.style.getComputedStyle(a,"borderRightWidth");d=goog.style.getComputedStyle(a,"borderTopWidth");a=goog.style.getComputedStyle(a,
|
|
"borderBottomWidth");return new goog.math.Box(parseFloat(d),parseFloat(c),parseFloat(a),parseFloat(b))};goog.style.getFontFamily=function(a){var b=goog.dom.getOwnerDocument(a),c="";if(b.body.createTextRange&&goog.dom.contains(b,a)){b=b.body.createTextRange();b.moveToElementText(a);try{c=b.queryCommandValue("FontName")}catch(d){c=""}}c||(c=goog.style.getStyle_(a,"fontFamily"));a=c.split(",");1<a.length&&(c=a[0]);return goog.string.stripQuotes(c,"\"'")};goog.style.lengthUnitRegex_=/[^\d]+$/;
|
|
goog.style.getLengthUnits=function(a){return(a=a.match(goog.style.lengthUnitRegex_))&&a[0]||null};goog.style.ABSOLUTE_CSS_LENGTH_UNITS_={cm:1,"in":1,mm:1,pc:1,pt:1};goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_={em:1,ex:1};
|
|
goog.style.getFontSize=function(a){var b=goog.style.getStyle_(a,"fontSize"),c=goog.style.getLengthUnits(b);if(b&&"px"==c)return parseInt(b,10);if(goog.userAgent.IE){if(String(c)in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_)return goog.style.getIePixelValue_(a,b,"left","pixelLeft");if(a.parentNode&&a.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&String(c)in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_)return a=a.parentNode,c=goog.style.getStyle_(a,"fontSize"),goog.style.getIePixelValue_(a,b==c?"1em":b,
|
|
"left","pixelLeft")}c=goog.dom.createDom("SPAN",{style:"visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"});goog.dom.appendChild(a,c);b=c.offsetHeight;goog.dom.removeNode(c);return b};goog.style.parseStyleAttribute=function(a){var b={};goog.array.forEach(a.split(/\s*;\s*/),function(a){var c=a.match(/\s*([\w-]+)\s*:(.+)/);c&&(a=c[1],c=goog.string.trim(c[2]),b[goog.string.toCamelCase(a.toLowerCase())]=c)});return b};
|
|
goog.style.toStyleAttribute=function(a){var b=[];goog.object.forEach(a,function(a,d){b.push(goog.string.toSelectorCase(d),":",a,";")});return b.join("")};goog.style.setFloat=function(a,b){a.style[goog.userAgent.IE?"styleFloat":"cssFloat"]=b};goog.style.getFloat=function(a){return a.style[goog.userAgent.IE?"styleFloat":"cssFloat"]||""};
|
|
goog.style.getScrollbarWidth=function(a){var b=goog.dom.createElement("DIV");a&&(b.className=a);b.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";a=goog.dom.createElement("DIV");goog.style.setSize(a,"200px","200px");b.appendChild(a);goog.dom.appendChild(goog.dom.getDocument().body,b);a=b.offsetWidth-b.clientWidth;goog.dom.removeNode(b);return a};goog.style.MATRIX_TRANSLATION_REGEX_=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;
|
|
goog.style.getCssTranslation=function(a){a=goog.style.getComputedTransform(a);return a?(a=a.match(goog.style.MATRIX_TRANSLATION_REGEX_))?new goog.math.Coordinate(parseFloat(a[1]),parseFloat(a[2])):new goog.math.Coordinate(0,0):new goog.math.Coordinate(0,0)};goog.events.EventHandler=function(a){goog.Disposable.call(this);this.handler_=a;this.keys_={}};goog.inherits(goog.events.EventHandler,goog.Disposable);goog.events.EventHandler.typeArray_=[];goog.events.EventHandler.prototype.listen=function(a,b,c,d){return this.listen_(a,b,c,d)};goog.events.EventHandler.prototype.listenWithScope=function(a,b,c,d,e){return this.listen_(a,b,c,d,e)};
|
|
goog.events.EventHandler.prototype.listen_=function(a,b,c,d,e){goog.isArray(b)||(b&&(goog.events.EventHandler.typeArray_[0]=b.toString()),b=goog.events.EventHandler.typeArray_);for(var f=0;f<b.length;f++){var g=goog.events.listen(a,b[f],c||this.handleEvent,d||!1,e||this.handler_||this);if(!g)break;this.keys_[g.key]=g}return this};goog.events.EventHandler.prototype.listenOnce=function(a,b,c,d){return this.listenOnce_(a,b,c,d)};
|
|
goog.events.EventHandler.prototype.listenOnceWithScope=function(a,b,c,d,e){return this.listenOnce_(a,b,c,d,e)};goog.events.EventHandler.prototype.listenOnce_=function(a,b,c,d,e){if(goog.isArray(b))for(var f=0;f<b.length;f++)this.listenOnce_(a,b[f],c,d,e);else{a=goog.events.listenOnce(a,b,c||this.handleEvent,d,e||this.handler_||this);if(!a)return this;this.keys_[a.key]=a}return this};goog.events.EventHandler.prototype.listenWithWrapper=function(a,b,c,d){return this.listenWithWrapper_(a,b,c,d)};
|
|
goog.events.EventHandler.prototype.listenWithWrapperAndScope=function(a,b,c,d,e){return this.listenWithWrapper_(a,b,c,d,e)};goog.events.EventHandler.prototype.listenWithWrapper_=function(a,b,c,d,e){b.listen(a,c,d,e||this.handler_||this,this);return this};goog.events.EventHandler.prototype.getListenerCount=function(){var a=0,b;for(b in this.keys_)Object.prototype.hasOwnProperty.call(this.keys_,b)&&a++;return a};
|
|
goog.events.EventHandler.prototype.unlisten=function(a,b,c,d,e){if(goog.isArray(b))for(var f=0;f<b.length;f++)this.unlisten(a,b[f],c,d,e);else if(d=goog.isObject(d)?!!d.capture:!!d,a=goog.events.getListener(a,b,c||this.handleEvent,d,e||this.handler_||this))goog.events.unlistenByKey(a),delete this.keys_[a.key];return this};goog.events.EventHandler.prototype.unlistenWithWrapper=function(a,b,c,d,e){b.unlisten(a,c,d,e||this.handler_||this,this);return this};
|
|
goog.events.EventHandler.prototype.removeAll=function(){goog.object.forEach(this.keys_,function(a,b){this.keys_.hasOwnProperty(b)&&goog.events.unlistenByKey(a)},this);this.keys_={}};goog.events.EventHandler.prototype.disposeInternal=function(){goog.events.EventHandler.superClass_.disposeInternal.call(this);this.removeAll()};goog.events.EventHandler.prototype.handleEvent=function(a){throw Error("EventHandler.handleEvent not implemented");};goog.events.EventTarget=function(){goog.Disposable.call(this);this.eventTargetListeners_=new goog.events.ListenerMap(this);this.actualEventTarget_=this;this.parentEventTarget_=null};goog.inherits(goog.events.EventTarget,goog.Disposable);goog.events.Listenable.addImplementation(goog.events.EventTarget);goog.events.EventTarget.MAX_ANCESTORS_=1E3;goog.events.EventTarget.prototype.getParentEventTarget=function(){return this.parentEventTarget_};
|
|
goog.events.EventTarget.prototype.setParentEventTarget=function(a){this.parentEventTarget_=a};goog.events.EventTarget.prototype.addEventListener=function(a,b,c,d){goog.events.listen(this,a,b,c,d)};goog.events.EventTarget.prototype.removeEventListener=function(a,b,c,d){goog.events.unlisten(this,a,b,c,d)};
|
|
goog.events.EventTarget.prototype.dispatchEvent=function(a){this.assertInitialized_();var b=this.getParentEventTarget();if(b){var c=[];for(var d=1;b;b=b.getParentEventTarget())c.push(b),goog.asserts.assert(++d<goog.events.EventTarget.MAX_ANCESTORS_,"infinite loop")}return goog.events.EventTarget.dispatchEventInternal_(this.actualEventTarget_,a,c)};
|
|
goog.events.EventTarget.prototype.disposeInternal=function(){goog.events.EventTarget.superClass_.disposeInternal.call(this);this.removeAllListeners();this.parentEventTarget_=null};goog.events.EventTarget.prototype.listen=function(a,b,c,d){this.assertInitialized_();return this.eventTargetListeners_.add(String(a),b,!1,c,d)};goog.events.EventTarget.prototype.listenOnce=function(a,b,c,d){return this.eventTargetListeners_.add(String(a),b,!0,c,d)};
|
|
goog.events.EventTarget.prototype.unlisten=function(a,b,c,d){return this.eventTargetListeners_.remove(String(a),b,c,d)};goog.events.EventTarget.prototype.unlistenByKey=function(a){return this.eventTargetListeners_.removeByKey(a)};goog.events.EventTarget.prototype.removeAllListeners=function(a){return this.eventTargetListeners_?this.eventTargetListeners_.removeAll(a):0};
|
|
goog.events.EventTarget.prototype.fireListeners=function(a,b,c){a=this.eventTargetListeners_.listeners[String(a)];if(!a)return!0;a=a.concat();for(var d=!0,e=0;e<a.length;++e){var f=a[e];if(f&&!f.removed&&f.capture==b){var g=f.listener,h=f.handler||f.src;f.callOnce&&this.unlistenByKey(f);d=!1!==g.call(h,c)&&d}}return d&&0!=c.returnValue_};goog.events.EventTarget.prototype.getListeners=function(a,b){return this.eventTargetListeners_.getListeners(String(a),b)};
|
|
goog.events.EventTarget.prototype.getListener=function(a,b,c,d){return this.eventTargetListeners_.getListener(String(a),b,c,d)};goog.events.EventTarget.prototype.hasListener=function(a,b){return this.eventTargetListeners_.hasListener(void 0!==a?String(a):void 0,b)};goog.events.EventTarget.prototype.setTargetForTesting=function(a){this.actualEventTarget_=a};goog.events.EventTarget.prototype.assertInitialized_=function(){goog.asserts.assert(this.eventTargetListeners_,"Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?")};
|
|
goog.events.EventTarget.dispatchEventInternal_=function(a,b,c){var d=b.type||b;if("string"===typeof b)b=new goog.events.Event(b,a);else if(b instanceof goog.events.Event)b.target=b.target||a;else{var e=b;b=new goog.events.Event(d,a);goog.object.extend(b,e)}e=!0;if(c)for(var f=c.length-1;!b.propagationStopped_&&0<=f;f--){var g=b.currentTarget=c[f];e=g.fireListeners(d,!0,b)&&e}b.propagationStopped_||(g=b.currentTarget=a,e=g.fireListeners(d,!0,b)&&e,b.propagationStopped_||(e=g.fireListeners(d,!1,b)&&
|
|
e));if(c)for(f=0;!b.propagationStopped_&&f<c.length;f++)g=b.currentTarget=c[f],e=g.fireListeners(d,!1,b)&&e;return e};goog.ui={};goog.ui.IdGenerator=function(){};goog.addSingletonGetter(goog.ui.IdGenerator);goog.ui.IdGenerator.prototype.nextId_=0;goog.ui.IdGenerator.prototype.idPrefix_="";goog.ui.IdGenerator.prototype.setIdPrefix=function(a){this.idPrefix_=a};goog.ui.IdGenerator.prototype.getNextUniqueId=function(){return this.idPrefix_+":"+(this.nextId_++).toString(36)};goog.ui.Component=function(a){goog.events.EventTarget.call(this);this.dom_=a||goog.dom.getDomHelper();this.rightToLeft_=goog.ui.Component.defaultRightToLeft_;this.id_=null;this.inDocument_=!1;this.element_=null;this.googUiComponentHandler_=void 0;this.childIndex_=this.children_=this.parent_=this.model_=null;this.pointerEventsEnabled_=this.wasDecorated_=!1};goog.inherits(goog.ui.Component,goog.events.EventTarget);goog.ui.Component.ALLOW_DETACHED_DECORATION=!1;
|
|
goog.ui.Component.prototype.idGenerator_=goog.ui.IdGenerator.getInstance();goog.ui.Component.DEFAULT_BIDI_DIR=0;goog.ui.Component.defaultRightToLeft_=1==goog.ui.Component.DEFAULT_BIDI_DIR?!1:-1==goog.ui.Component.DEFAULT_BIDI_DIR?!0:null;
|
|
goog.ui.Component.EventType={BEFORE_SHOW:"beforeshow",SHOW:"show",HIDE:"hide",DISABLE:"disable",ENABLE:"enable",HIGHLIGHT:"highlight",UNHIGHLIGHT:"unhighlight",ACTIVATE:"activate",DEACTIVATE:"deactivate",SELECT:"select",UNSELECT:"unselect",CHECK:"check",UNCHECK:"uncheck",FOCUS:"focus",BLUR:"blur",OPEN:"open",CLOSE:"close",ENTER:"enter",LEAVE:"leave",ACTION:"action",CHANGE:"change"};
|
|
goog.ui.Component.Error={NOT_SUPPORTED:"Method not supported",DECORATE_INVALID:"Invalid element to decorate",ALREADY_RENDERED:"Component already rendered",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document",STATE_INVALID:"Invalid component state"};
|
|
goog.ui.Component.State={ALL:255,DISABLED:1,HOVER:2,ACTIVE:4,SELECTED:8,CHECKED:16,FOCUSED:32,OPENED:64};
|
|
goog.ui.Component.getStateTransitionEvent=function(a,b){switch(a){case goog.ui.Component.State.DISABLED:return b?goog.ui.Component.EventType.DISABLE:goog.ui.Component.EventType.ENABLE;case goog.ui.Component.State.HOVER:return b?goog.ui.Component.EventType.HIGHLIGHT:goog.ui.Component.EventType.UNHIGHLIGHT;case goog.ui.Component.State.ACTIVE:return b?goog.ui.Component.EventType.ACTIVATE:goog.ui.Component.EventType.DEACTIVATE;case goog.ui.Component.State.SELECTED:return b?goog.ui.Component.EventType.SELECT:
|
|
goog.ui.Component.EventType.UNSELECT;case goog.ui.Component.State.CHECKED:return b?goog.ui.Component.EventType.CHECK:goog.ui.Component.EventType.UNCHECK;case goog.ui.Component.State.FOCUSED:return b?goog.ui.Component.EventType.FOCUS:goog.ui.Component.EventType.BLUR;case goog.ui.Component.State.OPENED:return b?goog.ui.Component.EventType.OPEN:goog.ui.Component.EventType.CLOSE}throw Error(goog.ui.Component.Error.STATE_INVALID);};
|
|
goog.ui.Component.setDefaultRightToLeft=function(a){goog.ui.Component.defaultRightToLeft_=a};goog.ui.Component.prototype.getId=function(){return this.id_||(this.id_=this.idGenerator_.getNextUniqueId())};goog.ui.Component.prototype.setId=function(a){this.parent_&&this.parent_.childIndex_&&(goog.object.remove(this.parent_.childIndex_,this.id_),goog.object.add(this.parent_.childIndex_,a,this));this.id_=a};goog.ui.Component.prototype.getElement=function(){return this.element_};
|
|
goog.ui.Component.prototype.getElementStrict=function(){var a=this.element_;goog.asserts.assert(a,"Can not call getElementStrict before rendering/decorating.");return a};goog.ui.Component.prototype.setElementInternal=function(a){this.element_=a};goog.ui.Component.prototype.getElementsByClass=function(a){return this.element_?this.dom_.getElementsByClass(a,this.element_):[]};goog.ui.Component.prototype.getElementByClass=function(a){return this.element_?this.dom_.getElementByClass(a,this.element_):null};
|
|
goog.ui.Component.prototype.getRequiredElementByClass=function(a){var b=this.getElementByClass(a);goog.asserts.assert(b,"Expected element in component with class: %s",a);return b};goog.ui.Component.prototype.getHandler=function(){this.googUiComponentHandler_||(this.googUiComponentHandler_=new goog.events.EventHandler(this));return goog.asserts.assert(this.googUiComponentHandler_)};
|
|
goog.ui.Component.prototype.setParent=function(a){if(this==a)throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);if(a&&this.parent_&&this.id_&&this.parent_.getChild(this.id_)&&this.parent_!=a)throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);this.parent_=a;goog.ui.Component.superClass_.setParentEventTarget.call(this,a)};goog.ui.Component.prototype.getParent=function(){return this.parent_};
|
|
goog.ui.Component.prototype.setParentEventTarget=function(a){if(this.parent_&&this.parent_!=a)throw Error(goog.ui.Component.Error.NOT_SUPPORTED);goog.ui.Component.superClass_.setParentEventTarget.call(this,a)};goog.ui.Component.prototype.getDomHelper=function(){return this.dom_};goog.ui.Component.prototype.isInDocument=function(){return this.inDocument_};goog.ui.Component.prototype.createDom=function(){this.element_=this.dom_.createElement("DIV")};goog.ui.Component.prototype.render=function(a){this.render_(a)};
|
|
goog.ui.Component.prototype.renderBefore=function(a){this.render_(a.parentNode,a)};goog.ui.Component.prototype.render_=function(a,b){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.element_||this.createDom();a?a.insertBefore(this.element_,b||null):this.dom_.getDocument().body.appendChild(this.element_);this.parent_&&!this.parent_.isInDocument()||this.enterDocument()};
|
|
goog.ui.Component.prototype.decorate=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);if(a&&this.canDecorate(a)){this.wasDecorated_=!0;var b=goog.dom.getOwnerDocument(a);this.dom_&&this.dom_.getDocument()==b||(this.dom_=goog.dom.getDomHelper(a));this.decorateInternal(a);goog.ui.Component.ALLOW_DETACHED_DECORATION&&!goog.dom.contains(b,a)||this.enterDocument()}else throw Error(goog.ui.Component.Error.DECORATE_INVALID);};goog.ui.Component.prototype.canDecorate=function(a){return!0};
|
|
goog.ui.Component.prototype.wasDecorated=function(){return this.wasDecorated_};goog.ui.Component.prototype.decorateInternal=function(a){this.element_=a};goog.ui.Component.prototype.enterDocument=function(){this.inDocument_=!0;this.forEachChild(function(a){!a.isInDocument()&&a.getElement()&&a.enterDocument()})};
|
|
goog.ui.Component.prototype.exitDocument=function(){this.forEachChild(function(a){a.isInDocument()&&a.exitDocument()});this.googUiComponentHandler_&&this.googUiComponentHandler_.removeAll();this.inDocument_=!1};
|
|
goog.ui.Component.prototype.disposeInternal=function(){this.inDocument_&&this.exitDocument();this.googUiComponentHandler_&&(this.googUiComponentHandler_.dispose(),delete this.googUiComponentHandler_);this.forEachChild(function(a){a.dispose()});!this.wasDecorated_&&this.element_&&goog.dom.removeNode(this.element_);this.parent_=this.model_=this.element_=this.childIndex_=this.children_=null;goog.ui.Component.superClass_.disposeInternal.call(this)};
|
|
goog.ui.Component.prototype.makeId=function(a){return this.getId()+"."+a};goog.ui.Component.prototype.makeIds=function(a){var b={},c;for(c in a)b[c]=this.makeId(a[c]);return b};goog.ui.Component.prototype.getModel=function(){return this.model_};goog.ui.Component.prototype.setModel=function(a){this.model_=a};goog.ui.Component.prototype.getFragmentFromId=function(a){return a.substring(this.getId().length+1)};
|
|
goog.ui.Component.prototype.getElementByFragment=function(a){if(!this.inDocument_)throw Error(goog.ui.Component.Error.NOT_IN_DOCUMENT);return this.dom_.getElement(this.makeId(a))};goog.ui.Component.prototype.addChild=function(a,b){this.addChildAt(a,this.getChildCount(),b)};
|
|
goog.ui.Component.prototype.addChildAt=function(a,b,c){goog.asserts.assert(!!a,"Provided element must not be null.");if(a.inDocument_&&(c||!this.inDocument_))throw Error(goog.ui.Component.Error.ALREADY_RENDERED);if(0>b||b>this.getChildCount())throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);this.childIndex_&&this.children_||(this.childIndex_={},this.children_=[]);a.getParent()==this?(goog.object.set(this.childIndex_,a.getId(),a),goog.array.remove(this.children_,a)):goog.object.add(this.childIndex_,
|
|
a.getId(),a);a.setParent(this);goog.array.insertAt(this.children_,a,b);a.inDocument_&&this.inDocument_&&a.getParent()==this?(c=this.getContentElement(),b=c.childNodes[b]||null,b!=a.getElement()&&c.insertBefore(a.getElement(),b)):c?(this.element_||this.createDom(),b=this.getChildAt(b+1),a.render_(this.getContentElement(),b?b.element_:null)):this.inDocument_&&!a.inDocument_&&a.element_&&a.element_.parentNode&&a.element_.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&a.enterDocument()};
|
|
goog.ui.Component.prototype.getContentElement=function(){return this.element_};goog.ui.Component.prototype.isRightToLeft=function(){null==this.rightToLeft_&&(this.rightToLeft_=goog.style.isRightToLeft(this.inDocument_?this.element_:this.dom_.getDocument().body));return this.rightToLeft_};goog.ui.Component.prototype.setRightToLeft=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.rightToLeft_=a};
|
|
goog.ui.Component.prototype.hasChildren=function(){return!!this.children_&&0!=this.children_.length};goog.ui.Component.prototype.getChildCount=function(){return this.children_?this.children_.length:0};goog.ui.Component.prototype.getChildIds=function(){var a=[];this.forEachChild(function(b){a.push(b.getId())});return a};goog.ui.Component.prototype.getChild=function(a){return this.childIndex_&&a?goog.object.get(this.childIndex_,a)||null:null};
|
|
goog.ui.Component.prototype.getChildAt=function(a){return this.children_?this.children_[a]||null:null};goog.ui.Component.prototype.forEachChild=function(a,b){this.children_&&goog.array.forEach(this.children_,a,b)};goog.ui.Component.prototype.indexOfChild=function(a){return this.children_&&a?goog.array.indexOf(this.children_,a):-1};
|
|
goog.ui.Component.prototype.removeChild=function(a,b){if(a){var c="string"===typeof a?a:a.getId();a=this.getChild(c);c&&a&&(goog.object.remove(this.childIndex_,c),goog.array.remove(this.children_,a),b&&(a.exitDocument(),a.element_&&goog.dom.removeNode(a.element_)),a.setParent(null))}if(!a)throw Error(goog.ui.Component.Error.NOT_OUR_CHILD);return a};goog.ui.Component.prototype.removeChildAt=function(a,b){return this.removeChild(this.getChildAt(a),b)};
|
|
goog.ui.Component.prototype.removeChildren=function(a){for(var b=[];this.hasChildren();)b.push(this.removeChildAt(0,a));return b};goog.ui.Component.prototype.pointerEventsEnabled=function(){return this.pointerEventsEnabled_};goog.ui.Component.prototype.setPointerEventsEnabled=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.pointerEventsEnabled_=a};goog.a11y={};goog.a11y.aria={};
|
|
goog.a11y.aria.Role={ALERT:"alert",ALERTDIALOG:"alertdialog",APPLICATION:"application",ARTICLE:"article",BANNER:"banner",BUTTON:"button",CHECKBOX:"checkbox",COLUMNHEADER:"columnheader",COMBOBOX:"combobox",COMPLEMENTARY:"complementary",CONTENTINFO:"contentinfo",DEFINITION:"definition",DIALOG:"dialog",DIRECTORY:"directory",DOCUMENT:"document",FORM:"form",GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",HEADING:"heading",IMG:"img",LINK:"link",LIST:"list",LISTBOX:"listbox",LISTITEM:"listitem",LOG:"log",
|
|
MAIN:"main",MARQUEE:"marquee",MATH:"math",MENU:"menu",MENUBAR:"menubar",MENU_ITEM:"menuitem",MENU_ITEM_CHECKBOX:"menuitemcheckbox",MENU_ITEM_RADIO:"menuitemradio",NAVIGATION:"navigation",NOTE:"note",OPTION:"option",PRESENTATION:"presentation",PROGRESSBAR:"progressbar",RADIO:"radio",RADIOGROUP:"radiogroup",REGION:"region",ROW:"row",ROWGROUP:"rowgroup",ROWHEADER:"rowheader",SCROLLBAR:"scrollbar",SEARCH:"search",SEPARATOR:"separator",SLIDER:"slider",SPINBUTTON:"spinbutton",STATUS:"status",TAB:"tab",
|
|
TAB_LIST:"tablist",TAB_PANEL:"tabpanel",TEXTBOX:"textbox",TEXTINFO:"textinfo",TIMER:"timer",TOOLBAR:"toolbar",TOOLTIP:"tooltip",TREE:"tree",TREEGRID:"treegrid",TREEITEM:"treeitem"};goog.a11y.aria.State={ACTIVEDESCENDANT:"activedescendant",ATOMIC:"atomic",AUTOCOMPLETE:"autocomplete",BUSY:"busy",CHECKED:"checked",COLINDEX:"colindex",CONTROLS:"controls",DESCRIBEDBY:"describedby",DISABLED:"disabled",DROPEFFECT:"dropeffect",EXPANDED:"expanded",FLOWTO:"flowto",GRABBED:"grabbed",HASPOPUP:"haspopup",HIDDEN:"hidden",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",LIVE:"live",MULTILINE:"multiline",MULTISELECTABLE:"multiselectable",ORIENTATION:"orientation",OWNS:"owns",
|
|
POSINSET:"posinset",PRESSED:"pressed",READONLY:"readonly",RELEVANT:"relevant",REQUIRED:"required",ROWINDEX:"rowindex",SELECTED:"selected",SETSIZE:"setsize",SORT:"sort",VALUEMAX:"valuemax",VALUEMIN:"valuemin",VALUENOW:"valuenow",VALUETEXT:"valuetext"};goog.a11y.aria.AutoCompleteValues={INLINE:"inline",LIST:"list",BOTH:"both",NONE:"none"};goog.a11y.aria.DropEffectValues={COPY:"copy",MOVE:"move",LINK:"link",EXECUTE:"execute",POPUP:"popup",NONE:"none"};
|
|
goog.a11y.aria.LivePriority={OFF:"off",POLITE:"polite",ASSERTIVE:"assertive"};goog.a11y.aria.OrientationValues={VERTICAL:"vertical",HORIZONTAL:"horizontal"};goog.a11y.aria.RelevantValues={ADDITIONS:"additions",REMOVALS:"removals",TEXT:"text",ALL:"all"};goog.a11y.aria.SortValues={ASCENDING:"ascending",DESCENDING:"descending",NONE:"none",OTHER:"other"};goog.a11y.aria.CheckedValues={TRUE:"true",FALSE:"false",MIXED:"mixed",UNDEFINED:"undefined"};
|
|
goog.a11y.aria.ExpandedValues={TRUE:"true",FALSE:"false",UNDEFINED:"undefined"};goog.a11y.aria.GrabbedValues={TRUE:"true",FALSE:"false",UNDEFINED:"undefined"};goog.a11y.aria.InvalidValues={FALSE:"false",TRUE:"true",GRAMMAR:"grammar",SPELLING:"spelling"};goog.a11y.aria.PressedValues={TRUE:"true",FALSE:"false",MIXED:"mixed",UNDEFINED:"undefined"};goog.a11y.aria.SelectedValues={TRUE:"true",FALSE:"false",UNDEFINED:"undefined"};goog.a11y.aria.datatables={};
|
|
goog.a11y.aria.datatables.getDefaultValuesMap=function(){goog.a11y.aria.DefaultStateValueMap_||(goog.a11y.aria.DefaultStateValueMap_=goog.object.create(goog.a11y.aria.State.ATOMIC,!1,goog.a11y.aria.State.AUTOCOMPLETE,"none",goog.a11y.aria.State.DROPEFFECT,"none",goog.a11y.aria.State.HASPOPUP,!1,goog.a11y.aria.State.LIVE,"off",goog.a11y.aria.State.MULTILINE,!1,goog.a11y.aria.State.MULTISELECTABLE,!1,goog.a11y.aria.State.ORIENTATION,"vertical",goog.a11y.aria.State.READONLY,!1,goog.a11y.aria.State.RELEVANT,
|
|
"additions text",goog.a11y.aria.State.REQUIRED,!1,goog.a11y.aria.State.SORT,"none",goog.a11y.aria.State.BUSY,!1,goog.a11y.aria.State.DISABLED,!1,goog.a11y.aria.State.HIDDEN,!1,goog.a11y.aria.State.INVALID,"false"));return goog.a11y.aria.DefaultStateValueMap_};goog.a11y.aria.ARIA_PREFIX_="aria-";goog.a11y.aria.ROLE_ATTRIBUTE_="role";goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_=goog.object.createSet("A AREA BUTTON HEAD INPUT LINK MENU META OPTGROUP OPTION PROGRESS STYLE SELECT SOURCE TEXTAREA TITLE TRACK".split(" "));
|
|
goog.a11y.aria.CONTAINER_ROLES_=[goog.a11y.aria.Role.COMBOBOX,goog.a11y.aria.Role.GRID,goog.a11y.aria.Role.GROUP,goog.a11y.aria.Role.LISTBOX,goog.a11y.aria.Role.MENU,goog.a11y.aria.Role.MENUBAR,goog.a11y.aria.Role.RADIOGROUP,goog.a11y.aria.Role.ROW,goog.a11y.aria.Role.ROWGROUP,goog.a11y.aria.Role.TAB_LIST,goog.a11y.aria.Role.TEXTBOX,goog.a11y.aria.Role.TOOLBAR,goog.a11y.aria.Role.TREE,goog.a11y.aria.Role.TREEGRID];
|
|
goog.a11y.aria.setRole=function(a,b){b?(goog.asserts.ENABLE_ASSERTS&&goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.Role,b),"No such ARIA role "+b),a.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_,b)):goog.a11y.aria.removeRole(a)};goog.a11y.aria.getRole=function(a){return a.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_)||null};goog.a11y.aria.removeRole=function(a){a.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_)};
|
|
goog.a11y.aria.setState=function(a,b,c){goog.isArray(c)&&(c=c.join(" "));var d=goog.a11y.aria.getAriaAttributeName_(b);""===c||void 0==c?(c=goog.a11y.aria.datatables.getDefaultValuesMap(),b in c?a.setAttribute(d,c[b]):a.removeAttribute(d)):a.setAttribute(d,c)};goog.a11y.aria.toggleState=function(a,b){var c=goog.a11y.aria.getState(a,b);goog.string.isEmptyOrWhitespace(goog.string.makeSafe(c))||"true"==c||"false"==c?goog.a11y.aria.setState(a,b,"true"==c?"false":"true"):goog.a11y.aria.removeState(a,b)};
|
|
goog.a11y.aria.removeState=function(a,b){a.removeAttribute(goog.a11y.aria.getAriaAttributeName_(b))};goog.a11y.aria.getState=function(a,b){var c=a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));return null==c||void 0==c?"":String(c)};goog.a11y.aria.getActiveDescendant=function(a){var b=goog.a11y.aria.getState(a,goog.a11y.aria.State.ACTIVEDESCENDANT);return goog.dom.getOwnerDocument(a).getElementById(b)};
|
|
goog.a11y.aria.setActiveDescendant=function(a,b){var c="";b&&(c=b.id,goog.asserts.assert(c,"The active element should have an id."));goog.a11y.aria.setState(a,goog.a11y.aria.State.ACTIVEDESCENDANT,c)};goog.a11y.aria.getLabel=function(a){return goog.a11y.aria.getState(a,goog.a11y.aria.State.LABEL)};goog.a11y.aria.setLabel=function(a,b){goog.a11y.aria.setState(a,goog.a11y.aria.State.LABEL,b)};
|
|
goog.a11y.aria.assertRoleIsSetInternalUtil=function(a,b){if(!goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[a.tagName]){var c=goog.a11y.aria.getRole(a);goog.asserts.assert(null!=c,"The element ARIA role cannot be null.");goog.asserts.assert(goog.array.contains(b,c),'Non existing or incorrect role set for element.The role set is "'+c+'". The role should be any of "'+b+'". Check the ARIA specification for more details http://www.w3.org/TR/wai-aria/roles.')}};
|
|
goog.a11y.aria.getStateBoolean=function(a,b){var c=a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));goog.asserts.assert("boolean"===typeof c||null==c||"true"==c||"false"==c);return null==c?c:"boolean"===typeof c?c:"true"==c};goog.a11y.aria.getStateNumber=function(a,b){var c=a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));goog.asserts.assert((null==c||!isNaN(Number(c)))&&"boolean"!==typeof c);return null==c?null:Number(c)};
|
|
goog.a11y.aria.getStateString=function(a,b){var c=a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));goog.asserts.assert((null==c||"string"===typeof c)&&(""==c||isNaN(Number(c)))&&"true"!=c&&"false"!=c);return null==c||""==c?null:c};goog.a11y.aria.getStringArrayStateInternalUtil=function(a,b){var c=a.getAttribute(goog.a11y.aria.getAriaAttributeName_(b));return goog.a11y.aria.splitStringOnWhitespace_(c)};goog.a11y.aria.hasState=function(a,b){return a.hasAttribute(goog.a11y.aria.getAriaAttributeName_(b))};
|
|
goog.a11y.aria.isContainerRole=function(a){a=goog.a11y.aria.getRole(a);return goog.array.contains(goog.a11y.aria.CONTAINER_ROLES_,a)};goog.a11y.aria.splitStringOnWhitespace_=function(a){return a?a.split(/\s+/):[]};goog.a11y.aria.getAriaAttributeName_=function(a){goog.asserts.ENABLE_ASSERTS&&(goog.asserts.assert(a,"ARIA attribute cannot be empty."),goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.State,a),"No such ARIA attribute "+a));return goog.a11y.aria.ARIA_PREFIX_+a};goog.events.KeyCodes={WIN_KEY_FF_LINUX:0,MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS_SIGN:43,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,FF_SEMICOLON:59,FF_EQUALS:61,FF_DASH:173,FF_HASH:163,FF_JP_QUOTE:58,QUESTION_MARK:63,AT_SIGN:64,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,
|
|
K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SCROLL_LOCK:145,FIRST_MEDIA_KEY:166,LAST_MEDIA_KEY:183,SEMICOLON:186,DASH:189,EQUALS:187,
|
|
COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,TILDE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,MAC_WK_CMD_LEFT:91,MAC_WK_CMD_RIGHT:93,WIN_IME:229,VK_NONAME:252,PHANTOM:255};
|
|
goog.events.KeyCodes.isTextModifyingKeyEvent=function(a){if(a.altKey&&!a.ctrlKey||a.metaKey||a.keyCode>=goog.events.KeyCodes.F1&&a.keyCode<=goog.events.KeyCodes.F12)return!1;if(goog.events.KeyCodes.isCharacterKey(a.keyCode))return!0;switch(a.keyCode){case goog.events.KeyCodes.ALT:case goog.events.KeyCodes.CAPS_LOCK:case goog.events.KeyCodes.CONTEXT_MENU:case goog.events.KeyCodes.CTRL:case goog.events.KeyCodes.DOWN:case goog.events.KeyCodes.END:case goog.events.KeyCodes.ESC:case goog.events.KeyCodes.HOME:case goog.events.KeyCodes.INSERT:case goog.events.KeyCodes.LEFT:case goog.events.KeyCodes.MAC_FF_META:case goog.events.KeyCodes.META:case goog.events.KeyCodes.NUMLOCK:case goog.events.KeyCodes.NUM_CENTER:case goog.events.KeyCodes.PAGE_DOWN:case goog.events.KeyCodes.PAGE_UP:case goog.events.KeyCodes.PAUSE:case goog.events.KeyCodes.PHANTOM:case goog.events.KeyCodes.PRINT_SCREEN:case goog.events.KeyCodes.RIGHT:case goog.events.KeyCodes.SCROLL_LOCK:case goog.events.KeyCodes.SHIFT:case goog.events.KeyCodes.UP:case goog.events.KeyCodes.VK_NONAME:case goog.events.KeyCodes.WIN_KEY:case goog.events.KeyCodes.WIN_KEY_RIGHT:return!1;case goog.events.KeyCodes.WIN_KEY_FF_LINUX:return!goog.userAgent.GECKO;
|
|
default:return a.keyCode<goog.events.KeyCodes.FIRST_MEDIA_KEY||a.keyCode>goog.events.KeyCodes.LAST_MEDIA_KEY}};
|
|
goog.events.KeyCodes.firesKeyPressEvent=function(a,b,c,d,e,f){if(goog.userAgent.WEBKIT&&!goog.userAgent.isVersionOrHigher("525"))return!0;if(goog.userAgent.MAC&&e)return goog.events.KeyCodes.isCharacterKey(a);if(e&&!d)return!1;if(!goog.userAgent.GECKO){"number"===typeof b&&(b=goog.events.KeyCodes.normalizeKeyCode(b));var g=b==goog.events.KeyCodes.CTRL||b==goog.events.KeyCodes.ALT||goog.userAgent.MAC&&b==goog.events.KeyCodes.META,h=b==goog.events.KeyCodes.SHIFT&&(d||f);if((!c||goog.userAgent.MAC)&&
|
|
g||goog.userAgent.MAC&&h)return!1}if((goog.userAgent.WEBKIT||goog.userAgent.EDGE)&&d&&c)switch(a){case goog.events.KeyCodes.BACKSLASH:case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:case goog.events.KeyCodes.TILDE:case goog.events.KeyCodes.SEMICOLON:case goog.events.KeyCodes.DASH:case goog.events.KeyCodes.EQUALS:case goog.events.KeyCodes.COMMA:case goog.events.KeyCodes.PERIOD:case goog.events.KeyCodes.SLASH:case goog.events.KeyCodes.APOSTROPHE:case goog.events.KeyCodes.SINGLE_QUOTE:return!1}if(goog.userAgent.IE&&
|
|
d&&b==a)return!1;switch(a){case goog.events.KeyCodes.ENTER:return goog.userAgent.GECKO?f||e?!1:!(c&&d):!0;case goog.events.KeyCodes.ESC:return!(goog.userAgent.WEBKIT||goog.userAgent.EDGE||goog.userAgent.GECKO)}return goog.userAgent.GECKO&&(d||e||f)?!1:goog.events.KeyCodes.isCharacterKey(a)};
|
|
goog.events.KeyCodes.isCharacterKey=function(a){if(a>=goog.events.KeyCodes.ZERO&&a<=goog.events.KeyCodes.NINE||a>=goog.events.KeyCodes.NUM_ZERO&&a<=goog.events.KeyCodes.NUM_MULTIPLY||a>=goog.events.KeyCodes.A&&a<=goog.events.KeyCodes.Z||(goog.userAgent.WEBKIT||goog.userAgent.EDGE)&&0==a)return!0;switch(a){case goog.events.KeyCodes.SPACE:case goog.events.KeyCodes.PLUS_SIGN:case goog.events.KeyCodes.QUESTION_MARK:case goog.events.KeyCodes.AT_SIGN:case goog.events.KeyCodes.NUM_PLUS:case goog.events.KeyCodes.NUM_MINUS:case goog.events.KeyCodes.NUM_PERIOD:case goog.events.KeyCodes.NUM_DIVISION:case goog.events.KeyCodes.SEMICOLON:case goog.events.KeyCodes.FF_SEMICOLON:case goog.events.KeyCodes.DASH:case goog.events.KeyCodes.EQUALS:case goog.events.KeyCodes.FF_EQUALS:case goog.events.KeyCodes.COMMA:case goog.events.KeyCodes.PERIOD:case goog.events.KeyCodes.SLASH:case goog.events.KeyCodes.APOSTROPHE:case goog.events.KeyCodes.SINGLE_QUOTE:case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:case goog.events.KeyCodes.BACKSLASH:case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:case goog.events.KeyCodes.FF_HASH:case goog.events.KeyCodes.FF_JP_QUOTE:return!0;
|
|
case goog.events.KeyCodes.FF_DASH:return goog.userAgent.GECKO;default:return!1}};goog.events.KeyCodes.normalizeKeyCode=function(a){return goog.userAgent.GECKO?goog.events.KeyCodes.normalizeGeckoKeyCode(a):goog.userAgent.MAC&&goog.userAgent.WEBKIT?goog.events.KeyCodes.normalizeMacWebKitKeyCode(a):a};
|
|
goog.events.KeyCodes.normalizeGeckoKeyCode=function(a){switch(a){case goog.events.KeyCodes.FF_EQUALS:return goog.events.KeyCodes.EQUALS;case goog.events.KeyCodes.FF_SEMICOLON:return goog.events.KeyCodes.SEMICOLON;case goog.events.KeyCodes.FF_DASH:return goog.events.KeyCodes.DASH;case goog.events.KeyCodes.MAC_FF_META:return goog.events.KeyCodes.META;case goog.events.KeyCodes.WIN_KEY_FF_LINUX:return goog.events.KeyCodes.WIN_KEY;default:return a}};
|
|
goog.events.KeyCodes.normalizeMacWebKitKeyCode=function(a){switch(a){case goog.events.KeyCodes.MAC_WK_CMD_RIGHT:return goog.events.KeyCodes.META;default:return a}};goog.events.KeyHandler=function(a,b){goog.events.EventTarget.call(this);a&&this.attach(a,b)};goog.inherits(goog.events.KeyHandler,goog.events.EventTarget);goog.events.KeyHandler.prototype.element_=null;goog.events.KeyHandler.prototype.keyPressKey_=null;goog.events.KeyHandler.prototype.keyDownKey_=null;goog.events.KeyHandler.prototype.keyUpKey_=null;goog.events.KeyHandler.prototype.lastKey_=-1;goog.events.KeyHandler.prototype.keyCode_=-1;goog.events.KeyHandler.prototype.altKey_=!1;
|
|
goog.events.KeyHandler.EventType={KEY:"key"};
|
|
goog.events.KeyHandler.safariKey_={3:goog.events.KeyCodes.ENTER,12:goog.events.KeyCodes.NUMLOCK,63232:goog.events.KeyCodes.UP,63233:goog.events.KeyCodes.DOWN,63234:goog.events.KeyCodes.LEFT,63235:goog.events.KeyCodes.RIGHT,63236:goog.events.KeyCodes.F1,63237:goog.events.KeyCodes.F2,63238:goog.events.KeyCodes.F3,63239:goog.events.KeyCodes.F4,63240:goog.events.KeyCodes.F5,63241:goog.events.KeyCodes.F6,63242:goog.events.KeyCodes.F7,63243:goog.events.KeyCodes.F8,63244:goog.events.KeyCodes.F9,63245:goog.events.KeyCodes.F10,
|
|
63246:goog.events.KeyCodes.F11,63247:goog.events.KeyCodes.F12,63248:goog.events.KeyCodes.PRINT_SCREEN,63272:goog.events.KeyCodes.DELETE,63273:goog.events.KeyCodes.HOME,63275:goog.events.KeyCodes.END,63276:goog.events.KeyCodes.PAGE_UP,63277:goog.events.KeyCodes.PAGE_DOWN,63289:goog.events.KeyCodes.NUMLOCK,63302:goog.events.KeyCodes.INSERT};
|
|
goog.events.KeyHandler.keyIdentifier_={Up:goog.events.KeyCodes.UP,Down:goog.events.KeyCodes.DOWN,Left:goog.events.KeyCodes.LEFT,Right:goog.events.KeyCodes.RIGHT,Enter:goog.events.KeyCodes.ENTER,F1:goog.events.KeyCodes.F1,F2:goog.events.KeyCodes.F2,F3:goog.events.KeyCodes.F3,F4:goog.events.KeyCodes.F4,F5:goog.events.KeyCodes.F5,F6:goog.events.KeyCodes.F6,F7:goog.events.KeyCodes.F7,F8:goog.events.KeyCodes.F8,F9:goog.events.KeyCodes.F9,F10:goog.events.KeyCodes.F10,F11:goog.events.KeyCodes.F11,F12:goog.events.KeyCodes.F12,
|
|
"U+007F":goog.events.KeyCodes.DELETE,Home:goog.events.KeyCodes.HOME,End:goog.events.KeyCodes.END,PageUp:goog.events.KeyCodes.PAGE_UP,PageDown:goog.events.KeyCodes.PAGE_DOWN,Insert:goog.events.KeyCodes.INSERT};goog.events.KeyHandler.USES_KEYDOWN_=!goog.userAgent.WEBKIT||goog.userAgent.isVersionOrHigher("525");goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_=goog.userAgent.MAC&&goog.userAgent.GECKO;
|
|
goog.events.KeyHandler.prototype.handleKeyDown_=function(a){(goog.userAgent.WEBKIT||goog.userAgent.EDGE)&&(this.lastKey_==goog.events.KeyCodes.CTRL&&!a.ctrlKey||this.lastKey_==goog.events.KeyCodes.ALT&&!a.altKey||goog.userAgent.MAC&&this.lastKey_==goog.events.KeyCodes.META&&!a.metaKey)&&this.resetState();-1==this.lastKey_&&(a.ctrlKey&&a.keyCode!=goog.events.KeyCodes.CTRL?this.lastKey_=goog.events.KeyCodes.CTRL:a.altKey&&a.keyCode!=goog.events.KeyCodes.ALT?this.lastKey_=goog.events.KeyCodes.ALT:a.metaKey&&
|
|
a.keyCode!=goog.events.KeyCodes.META&&(this.lastKey_=goog.events.KeyCodes.META));goog.events.KeyHandler.USES_KEYDOWN_&&!goog.events.KeyCodes.firesKeyPressEvent(a.keyCode,this.lastKey_,a.shiftKey,a.ctrlKey,a.altKey,a.metaKey)?this.handleEvent(a):(this.keyCode_=goog.events.KeyCodes.normalizeKeyCode(a.keyCode),goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_&&(this.altKey_=a.altKey))};goog.events.KeyHandler.prototype.resetState=function(){this.keyCode_=this.lastKey_=-1};
|
|
goog.events.KeyHandler.prototype.handleKeyup_=function(a){this.resetState();this.altKey_=a.altKey};
|
|
goog.events.KeyHandler.prototype.handleEvent=function(a){var b=a.getBrowserEvent(),c=b.altKey;if(goog.userAgent.IE&&a.type==goog.events.EventType.KEYPRESS){var d=this.keyCode_;var e=d!=goog.events.KeyCodes.ENTER&&d!=goog.events.KeyCodes.ESC?b.keyCode:0}else(goog.userAgent.WEBKIT||goog.userAgent.EDGE)&&a.type==goog.events.EventType.KEYPRESS?(d=this.keyCode_,e=0<=b.charCode&&63232>b.charCode&&goog.events.KeyCodes.isCharacterKey(d)?b.charCode:0):goog.userAgent.OPERA&&!goog.userAgent.WEBKIT?(d=this.keyCode_,
|
|
e=goog.events.KeyCodes.isCharacterKey(d)?b.keyCode:0):(a.type==goog.events.EventType.KEYPRESS?(goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_&&(c=this.altKey_),b.keyCode==b.charCode?32>b.keyCode?(d=b.keyCode,e=0):(d=this.keyCode_,e=b.charCode):(d=b.keyCode||this.keyCode_,e=b.charCode||0)):(d=b.keyCode||this.keyCode_,e=b.charCode||0),goog.userAgent.MAC&&e==goog.events.KeyCodes.QUESTION_MARK&&d==goog.events.KeyCodes.WIN_KEY&&(d=goog.events.KeyCodes.SLASH));var f=d=goog.events.KeyCodes.normalizeKeyCode(d);
|
|
d?63232<=d&&d in goog.events.KeyHandler.safariKey_?f=goog.events.KeyHandler.safariKey_[d]:25==d&&a.shiftKey&&(f=9):b.keyIdentifier&&b.keyIdentifier in goog.events.KeyHandler.keyIdentifier_&&(f=goog.events.KeyHandler.keyIdentifier_[b.keyIdentifier]);goog.userAgent.GECKO&&goog.events.KeyHandler.USES_KEYDOWN_&&a.type==goog.events.EventType.KEYPRESS&&!goog.events.KeyCodes.firesKeyPressEvent(f,this.lastKey_,a.shiftKey,a.ctrlKey,c,a.metaKey)||(a=f==this.lastKey_,this.lastKey_=f,b=new goog.events.KeyEvent(f,
|
|
e,a,b),b.altKey=c,this.dispatchEvent(b))};goog.events.KeyHandler.prototype.getElement=function(){return this.element_};
|
|
goog.events.KeyHandler.prototype.attach=function(a,b){this.keyUpKey_&&this.detach();this.element_=a;this.keyPressKey_=goog.events.listen(this.element_,goog.events.EventType.KEYPRESS,this,b);this.keyDownKey_=goog.events.listen(this.element_,goog.events.EventType.KEYDOWN,this.handleKeyDown_,b,this);this.keyUpKey_=goog.events.listen(this.element_,goog.events.EventType.KEYUP,this.handleKeyup_,b,this)};
|
|
goog.events.KeyHandler.prototype.detach=function(){this.keyPressKey_&&(goog.events.unlistenByKey(this.keyPressKey_),goog.events.unlistenByKey(this.keyDownKey_),goog.events.unlistenByKey(this.keyUpKey_),this.keyUpKey_=this.keyDownKey_=this.keyPressKey_=null);this.element_=null;this.keyCode_=this.lastKey_=-1};goog.events.KeyHandler.prototype.disposeInternal=function(){goog.events.KeyHandler.superClass_.disposeInternal.call(this);this.detach()};
|
|
goog.events.KeyEvent=function(a,b,c,d){goog.events.BrowserEvent.call(this,d);this.type=goog.events.KeyHandler.EventType.KEY;this.keyCode=a;this.charCode=b;this.repeat=c};goog.inherits(goog.events.KeyEvent,goog.events.BrowserEvent);goog.ui.ComponentUtil={};goog.ui.ComponentUtil.getMouseEventType=function(a){return a.pointerEventsEnabled()?goog.events.PointerAsMouseEventType:goog.events.MouseAsMouseEventType};goog.dom.classlist={};goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST=!1;goog.dom.classlist.getClassName_=function(a){return"string"==typeof a.className?a.className:a.getAttribute&&a.getAttribute("class")||""};goog.dom.classlist.get=function(a){return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||a.classList?a.classList:goog.dom.classlist.getClassName_(a).match(/\S+/g)||[]};goog.dom.classlist.set=function(a,b){"string"==typeof a.className?a.className=b:a.setAttribute&&a.setAttribute("class",b)};
|
|
goog.dom.classlist.contains=function(a,b){return goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||a.classList?a.classList.contains(b):goog.array.contains(goog.dom.classlist.get(a),b)};goog.dom.classlist.add=function(a,b){if(goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||a.classList)a.classList.add(b);else if(!goog.dom.classlist.contains(a,b)){var c=goog.dom.classlist.getClassName_(a);goog.dom.classlist.set(a,c+(0<c.length?" "+b:b))}};
|
|
goog.dom.classlist.addAll=function(a,b){if(goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||a.classList)goog.array.forEach(b,function(b){goog.dom.classlist.add(a,b)});else{var c={};goog.array.forEach(goog.dom.classlist.get(a),function(a){c[a]=!0});goog.array.forEach(b,function(a){c[a]=!0});var d="",e;for(e in c)d+=0<d.length?" "+e:e;goog.dom.classlist.set(a,d)}};
|
|
goog.dom.classlist.remove=function(a,b){goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||a.classList?a.classList.remove(b):goog.dom.classlist.contains(a,b)&&goog.dom.classlist.set(a,goog.array.filter(goog.dom.classlist.get(a),function(a){return a!=b}).join(" "))};
|
|
goog.dom.classlist.removeAll=function(a,b){goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||a.classList?goog.array.forEach(b,function(b){goog.dom.classlist.remove(a,b)}):goog.dom.classlist.set(a,goog.array.filter(goog.dom.classlist.get(a),function(a){return!goog.array.contains(b,a)}).join(" "))};goog.dom.classlist.enable=function(a,b,c){c?goog.dom.classlist.add(a,b):goog.dom.classlist.remove(a,b)};
|
|
goog.dom.classlist.enableAll=function(a,b,c){(c?goog.dom.classlist.addAll:goog.dom.classlist.removeAll)(a,b)};goog.dom.classlist.swap=function(a,b,c){return goog.dom.classlist.contains(a,b)?(goog.dom.classlist.remove(a,b),goog.dom.classlist.add(a,c),!0):!1};goog.dom.classlist.toggle=function(a,b){var c=!goog.dom.classlist.contains(a,b);goog.dom.classlist.enable(a,b,c);return c};goog.dom.classlist.addRemove=function(a,b,c){goog.dom.classlist.remove(a,b);goog.dom.classlist.add(a,c)};goog.ui.registry={};goog.ui.registry.getDefaultRenderer=function(a){for(var b;a;){b=goog.getUid(a);if(b=goog.ui.registry.defaultRenderers_[b])break;a=a.superClass_?a.superClass_.constructor:null}return b?goog.isFunction(b.getInstance)?b.getInstance():new b:null};
|
|
goog.ui.registry.setDefaultRenderer=function(a,b){if(!goog.isFunction(a))throw Error("Invalid component class "+a);if(!goog.isFunction(b))throw Error("Invalid renderer class "+b);var c=goog.getUid(a);goog.ui.registry.defaultRenderers_[c]=b};goog.ui.registry.getDecoratorByClassName=function(a){return a in goog.ui.registry.decoratorFunctions_?goog.ui.registry.decoratorFunctions_[a]():null};
|
|
goog.ui.registry.setDecoratorByClassName=function(a,b){if(!a)throw Error("Invalid class name "+a);if(!goog.isFunction(b))throw Error("Invalid decorator function "+b);goog.ui.registry.decoratorFunctions_[a]=b};goog.ui.registry.getDecorator=function(a){goog.asserts.assert(a);for(var b=goog.dom.classlist.get(a),c=0,d=b.length;c<d;c++)if(a=goog.ui.registry.getDecoratorByClassName(b[c]))return a;return null};
|
|
goog.ui.registry.reset=function(){goog.ui.registry.defaultRenderers_={};goog.ui.registry.decoratorFunctions_={}};goog.ui.registry.defaultRenderers_={};goog.ui.registry.decoratorFunctions_={};goog.ui.ContainerRenderer=function(a){this.ariaRole_=a};goog.addSingletonGetter(goog.ui.ContainerRenderer);goog.ui.ContainerRenderer.getCustomRenderer=function(a,b){var c=new a;c.getCssClass=function(){return b};return c};goog.ui.ContainerRenderer.CSS_CLASS="goog-container";goog.ui.ContainerRenderer.prototype.getAriaRole=function(){return this.ariaRole_};goog.ui.ContainerRenderer.prototype.enableTabIndex=function(a,b){a&&(a.tabIndex=b?0:-1)};
|
|
goog.ui.ContainerRenderer.prototype.createDom=function(a){return a.getDomHelper().createDom("DIV",this.getClassNames(a).join(" "))};goog.ui.ContainerRenderer.prototype.getContentElement=function(a){return a};goog.ui.ContainerRenderer.prototype.canDecorate=function(a){return"DIV"==a.tagName};
|
|
goog.ui.ContainerRenderer.prototype.decorate=function(a,b){b.id&&a.setId(b.id);var c=this.getCssClass(),d=!1,e=goog.dom.classlist.get(b);e&&goog.array.forEach(e,function(b){b==c?d=!0:b&&this.setStateFromClassName(a,b,c)},this);d||goog.dom.classlist.add(b,c);this.decorateChildren(a,this.getContentElement(b));return b};
|
|
goog.ui.ContainerRenderer.prototype.setStateFromClassName=function(a,b,c){b==c+"-disabled"?a.setEnabled(!1):b==c+"-horizontal"?a.setOrientation(goog.ui.Container.Orientation.HORIZONTAL):b==c+"-vertical"&&a.setOrientation(goog.ui.Container.Orientation.VERTICAL)};
|
|
goog.ui.ContainerRenderer.prototype.decorateChildren=function(a,b,c){if(b){c=c||b.firstChild;for(var d;c&&c.parentNode==b;){d=c.nextSibling;if(c.nodeType==goog.dom.NodeType.ELEMENT){var e=this.getDecoratorForChild(c);e&&(e.setElementInternal(c),a.isEnabled()||e.setEnabled(!1),a.addChild(e),e.decorate(c))}else c.nodeValue&&""!=goog.string.trim(c.nodeValue)||b.removeChild(c);c=d}}};goog.ui.ContainerRenderer.prototype.getDecoratorForChild=function(a){return goog.ui.registry.getDecorator(a)};
|
|
goog.ui.ContainerRenderer.prototype.initializeDom=function(a){a=a.getElement();goog.asserts.assert(a,"The container DOM element cannot be null.");goog.style.setUnselectable(a,!0,goog.userAgent.GECKO);goog.userAgent.IE&&(a.hideFocus=!0);var b=this.getAriaRole();b&&goog.a11y.aria.setRole(a,b)};goog.ui.ContainerRenderer.prototype.getKeyEventTarget=function(a){return a.getElement()};goog.ui.ContainerRenderer.prototype.getCssClass=function(){return goog.ui.ContainerRenderer.CSS_CLASS};
|
|
goog.ui.ContainerRenderer.prototype.getClassNames=function(a){var b=this.getCssClass(),c=a.getOrientation()==goog.ui.Container.Orientation.HORIZONTAL;c=[b,c?b+"-horizontal":b+"-vertical"];a.isEnabled()||c.push(b+"-disabled");return c};goog.ui.ContainerRenderer.prototype.getDefaultOrientation=function(){return goog.ui.Container.Orientation.VERTICAL};goog.ui.ControlRenderer=function(){};goog.addSingletonGetter(goog.ui.ControlRenderer);goog.tagUnsealableClass(goog.ui.ControlRenderer);goog.ui.ControlRenderer.getCustomRenderer=function(a,b){var c=new a;c.getCssClass=function(){return b};return c};goog.ui.ControlRenderer.CSS_CLASS="goog-control";goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS=[];
|
|
goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_=goog.object.create(goog.a11y.aria.Role.BUTTON,goog.a11y.aria.State.PRESSED,goog.a11y.aria.Role.CHECKBOX,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.MENU_ITEM,goog.a11y.aria.State.SELECTED,goog.a11y.aria.Role.MENU_ITEM_CHECKBOX,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.MENU_ITEM_RADIO,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.RADIO,goog.a11y.aria.State.CHECKED,goog.a11y.aria.Role.TAB,goog.a11y.aria.State.SELECTED,goog.a11y.aria.Role.TREEITEM,
|
|
goog.a11y.aria.State.SELECTED);goog.ui.ControlRenderer.prototype.getAriaRole=function(){};goog.ui.ControlRenderer.prototype.createDom=function(a){return a.getDomHelper().createDom("DIV",this.getClassNames(a).join(" "),a.getContent())};goog.ui.ControlRenderer.prototype.getContentElement=function(a){return a};
|
|
goog.ui.ControlRenderer.prototype.enableClassName=function(a,b,c){if(a=a.getElement?a.getElement():a){var d=[b];goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")&&(d=this.getAppliedCombinedClassNames_(goog.dom.classlist.get(a),b),d.push(b));goog.dom.classlist.enableAll(a,d,c)}};goog.ui.ControlRenderer.prototype.enableExtraClassName=function(a,b,c){this.enableClassName(a,b,c)};goog.ui.ControlRenderer.prototype.canDecorate=function(a){return!0};
|
|
goog.ui.ControlRenderer.prototype.decorate=function(a,b){b.id&&a.setId(b.id);var c=this.getContentElement(b);c&&c.firstChild?a.setContentInternal(c.firstChild.nextSibling?goog.array.clone(c.childNodes):c.firstChild):a.setContentInternal(null);var d=0,e=this.getCssClass(),f=this.getStructuralCssClass(),g=!1,h=!1,k=!1,l=goog.array.toArray(goog.dom.classlist.get(b));goog.array.forEach(l,function(a){g||a!=e?h||a!=f?d|=this.getStateFromClass(a):h=!0:(g=!0,f==e&&(h=!0));this.getStateFromClass(a)==goog.ui.Component.State.DISABLED&&
|
|
(goog.asserts.assertElement(c),goog.dom.isFocusableTabIndex(c)&&goog.dom.setFocusableTabIndex(c,!1))},this);a.setStateInternal(d);g||(l.push(e),f==e&&(h=!0));h||l.push(f);var m=a.getExtraClassNames();m&&l.push.apply(l,m);if(goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")){var n=this.getAppliedCombinedClassNames_(l);0<n.length&&(l.push.apply(l,n),k=!0)}g&&h&&!m&&!k||goog.dom.classlist.set(b,l.join(" "));return b};
|
|
goog.ui.ControlRenderer.prototype.initializeDom=function(a){a.isRightToLeft()&&this.setRightToLeft(a.getElement(),!0);a.isEnabled()&&this.setFocusable(a,a.isVisible())};goog.ui.ControlRenderer.prototype.setAriaRole=function(a,b){var c=b||this.getAriaRole();if(c){goog.asserts.assert(a,"The element passed as a first parameter cannot be null.");var d=goog.a11y.aria.getRole(a);c!=d&&goog.a11y.aria.setRole(a,c)}};
|
|
goog.ui.ControlRenderer.prototype.setAriaStates=function(a,b){goog.asserts.assert(a);goog.asserts.assert(b);var c=a.getAriaLabel();null!=c&&this.setAriaLabel(b,c);a.isVisible()||goog.a11y.aria.setState(b,goog.a11y.aria.State.HIDDEN,!a.isVisible());a.isEnabled()||this.updateAriaState(b,goog.ui.Component.State.DISABLED,!a.isEnabled());a.isSupportedState(goog.ui.Component.State.SELECTED)&&this.updateAriaState(b,goog.ui.Component.State.SELECTED,a.isSelected());a.isSupportedState(goog.ui.Component.State.CHECKED)&&
|
|
this.updateAriaState(b,goog.ui.Component.State.CHECKED,a.isChecked());a.isSupportedState(goog.ui.Component.State.OPENED)&&this.updateAriaState(b,goog.ui.Component.State.OPENED,a.isOpen())};goog.ui.ControlRenderer.prototype.setAriaLabel=function(a,b){goog.a11y.aria.setLabel(a,b)};goog.ui.ControlRenderer.prototype.setAllowTextSelection=function(a,b){goog.style.setUnselectable(a,!b,!goog.userAgent.IE&&!goog.userAgent.OPERA)};
|
|
goog.ui.ControlRenderer.prototype.setRightToLeft=function(a,b){this.enableClassName(a,this.getStructuralCssClass()+"-rtl",b)};goog.ui.ControlRenderer.prototype.isFocusable=function(a){var b;return a.isSupportedState(goog.ui.Component.State.FOCUSED)&&(b=a.getKeyEventTarget())?goog.dom.isFocusableTabIndex(b):!1};
|
|
goog.ui.ControlRenderer.prototype.setFocusable=function(a,b){var c;if(a.isSupportedState(goog.ui.Component.State.FOCUSED)&&(c=a.getKeyEventTarget())){if(!b&&a.isFocused()){try{c.blur()}catch(d){}a.isFocused()&&a.handleBlur(null)}goog.dom.isFocusableTabIndex(c)!=b&&goog.dom.setFocusableTabIndex(c,b)}};goog.ui.ControlRenderer.prototype.setVisible=function(a,b){goog.style.setElementShown(a,b);a&&goog.a11y.aria.setState(a,goog.a11y.aria.State.HIDDEN,!b)};
|
|
goog.ui.ControlRenderer.prototype.setState=function(a,b,c){var d=a.getElement();if(d){var e=this.getClassForState(b);e&&this.enableClassName(a,e,c);this.updateAriaState(d,b,c)}};
|
|
goog.ui.ControlRenderer.prototype.updateAriaState=function(a,b,c){goog.ui.ControlRenderer.ariaAttributeMap_||(goog.ui.ControlRenderer.ariaAttributeMap_=goog.object.create(goog.ui.Component.State.DISABLED,goog.a11y.aria.State.DISABLED,goog.ui.Component.State.SELECTED,goog.a11y.aria.State.SELECTED,goog.ui.Component.State.CHECKED,goog.a11y.aria.State.CHECKED,goog.ui.Component.State.OPENED,goog.a11y.aria.State.EXPANDED));goog.asserts.assert(a,"The element passed as a first parameter cannot be null.");
|
|
(b=goog.ui.ControlRenderer.getAriaStateForAriaRole_(a,goog.ui.ControlRenderer.ariaAttributeMap_[b]))&&goog.a11y.aria.setState(a,b,c)};goog.ui.ControlRenderer.getAriaStateForAriaRole_=function(a,b){var c=goog.a11y.aria.getRole(a);if(!c)return b;c=goog.ui.ControlRenderer.TOGGLE_ARIA_STATE_MAP_[c]||b;return goog.ui.ControlRenderer.isAriaState_(b)?c:b};goog.ui.ControlRenderer.isAriaState_=function(a){return a==goog.a11y.aria.State.CHECKED||a==goog.a11y.aria.State.SELECTED};
|
|
goog.ui.ControlRenderer.prototype.setContent=function(a,b){var c=this.getContentElement(a);if(c&&(goog.dom.removeChildren(c),b))if("string"===typeof b)goog.dom.setTextContent(c,b);else{var d=function(a){if(a){var b=goog.dom.getOwnerDocument(c);c.appendChild("string"===typeof a?b.createTextNode(a):a)}};goog.isArray(b)?goog.array.forEach(b,d):!goog.isArrayLike(b)||"nodeType"in b?d(b):goog.array.forEach(goog.array.clone(b),d)}};goog.ui.ControlRenderer.prototype.getKeyEventTarget=function(a){return a.getElement()};
|
|
goog.ui.ControlRenderer.prototype.getCssClass=function(){return goog.ui.ControlRenderer.CSS_CLASS};goog.ui.ControlRenderer.prototype.getIe6ClassCombinations=function(){return[]};goog.ui.ControlRenderer.prototype.getStructuralCssClass=function(){return this.getCssClass()};
|
|
goog.ui.ControlRenderer.prototype.getClassNames=function(a){var b=this.getCssClass(),c=[b],d=this.getStructuralCssClass();d!=b&&c.push(d);b=this.getClassNamesForState(a.getState());c.push.apply(c,b);(a=a.getExtraClassNames())&&c.push.apply(c,a);goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")&&c.push.apply(c,this.getAppliedCombinedClassNames_(c));return c};
|
|
goog.ui.ControlRenderer.prototype.getAppliedCombinedClassNames_=function(a,b){var c=[];b&&(a=goog.array.concat(a,[b]));goog.array.forEach(this.getIe6ClassCombinations(),function(d){!goog.array.every(d,goog.partial(goog.array.contains,a))||b&&!goog.array.contains(d,b)||c.push(d.join("_"))});return c};goog.ui.ControlRenderer.prototype.getClassNamesForState=function(a){for(var b=[];a;){var c=a&-a;b.push(this.getClassForState(c));a&=~c}return b};
|
|
goog.ui.ControlRenderer.prototype.getClassForState=function(a){this.classByState_||this.createClassByStateMap_();return this.classByState_[a]};goog.ui.ControlRenderer.prototype.getStateFromClass=function(a){this.stateByClass_||this.createStateByClassMap_();a=parseInt(this.stateByClass_[a],10);return isNaN(a)?0:a};
|
|
goog.ui.ControlRenderer.prototype.createClassByStateMap_=function(){var a=this.getStructuralCssClass(),b=!goog.string.contains(goog.string.normalizeWhitespace(a)," ");goog.asserts.assert(b,"ControlRenderer has an invalid css class: '"+a+"'");this.classByState_=goog.object.create(goog.ui.Component.State.DISABLED,a+"-disabled",goog.ui.Component.State.HOVER,a+"-hover",goog.ui.Component.State.ACTIVE,a+"-active",goog.ui.Component.State.SELECTED,a+"-selected",goog.ui.Component.State.CHECKED,a+"-checked",
|
|
goog.ui.Component.State.FOCUSED,a+"-focused",goog.ui.Component.State.OPENED,a+"-open")};goog.ui.ControlRenderer.prototype.createStateByClassMap_=function(){this.classByState_||this.createClassByStateMap_();this.stateByClass_=goog.object.transpose(this.classByState_)};goog.ui.Control=function(a,b,c){goog.ui.Component.call(this,c);this.renderer_=b||goog.ui.registry.getDefaultRenderer(this.constructor);this.setContentInternal(void 0!==a?a:null);this.ariaLabel_=null};goog.inherits(goog.ui.Control,goog.ui.Component);goog.tagUnsealableClass(goog.ui.Control);goog.ui.Control.registerDecorator=goog.ui.registry.setDecoratorByClassName;goog.ui.Control.getDecorator=goog.ui.registry.getDecorator;goog.ui.Control.prototype.content_=null;goog.ui.Control.prototype.state_=0;
|
|
goog.ui.Control.prototype.supportedStates_=goog.ui.Component.State.DISABLED|goog.ui.Component.State.HOVER|goog.ui.Component.State.ACTIVE|goog.ui.Component.State.FOCUSED;goog.ui.Control.prototype.autoStates_=goog.ui.Component.State.ALL;goog.ui.Control.prototype.statesWithTransitionEvents_=0;goog.ui.Control.prototype.visible_=!0;goog.ui.Control.prototype.extraClassNames_=null;goog.ui.Control.prototype.handleMouseEvents_=!0;goog.ui.Control.prototype.allowTextSelection_=!1;
|
|
goog.ui.Control.prototype.preferredAriaRole_=null;goog.ui.Control.prototype.isHandleMouseEvents=function(){return this.handleMouseEvents_};goog.ui.Control.prototype.setHandleMouseEvents=function(a){this.isInDocument()&&a!=this.handleMouseEvents_&&this.enableMouseEventHandling_(a);this.handleMouseEvents_=a};goog.ui.Control.prototype.getKeyEventTarget=function(){return this.renderer_.getKeyEventTarget(this)};
|
|
goog.ui.Control.prototype.getKeyHandler=function(){return this.keyHandler_||(this.keyHandler_=new goog.events.KeyHandler)};goog.ui.Control.prototype.getRenderer=function(){return this.renderer_};goog.ui.Control.prototype.setRenderer=function(a){if(this.isInDocument())throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.getElement()&&this.setElementInternal(null);this.renderer_=a};goog.ui.Control.prototype.getExtraClassNames=function(){return this.extraClassNames_};
|
|
goog.ui.Control.prototype.addClassName=function(a){a&&(this.extraClassNames_?goog.array.contains(this.extraClassNames_,a)||this.extraClassNames_.push(a):this.extraClassNames_=[a],this.renderer_.enableExtraClassName(this,a,!0))};goog.ui.Control.prototype.removeClassName=function(a){a&&this.extraClassNames_&&goog.array.remove(this.extraClassNames_,a)&&(0==this.extraClassNames_.length&&(this.extraClassNames_=null),this.renderer_.enableExtraClassName(this,a,!1))};
|
|
goog.ui.Control.prototype.enableClassName=function(a,b){b?this.addClassName(a):this.removeClassName(a)};goog.ui.Control.prototype.createDom=function(){var a=this.renderer_.createDom(this);this.setElementInternal(a);this.renderer_.setAriaRole(a,this.getPreferredAriaRole());this.isAllowTextSelection()||this.renderer_.setAllowTextSelection(a,!1);this.isVisible()||this.renderer_.setVisible(a,!1)};goog.ui.Control.prototype.getPreferredAriaRole=function(){return this.preferredAriaRole_};
|
|
goog.ui.Control.prototype.setPreferredAriaRole=function(a){this.preferredAriaRole_=a};goog.ui.Control.prototype.getAriaLabel=function(){return this.ariaLabel_};goog.ui.Control.prototype.setAriaLabel=function(a){this.ariaLabel_=a;var b=this.getElement();b&&this.renderer_.setAriaLabel(b,a)};goog.ui.Control.prototype.getContentElement=function(){return this.renderer_.getContentElement(this.getElement())};goog.ui.Control.prototype.canDecorate=function(a){return this.renderer_.canDecorate(a)};
|
|
goog.ui.Control.prototype.decorateInternal=function(a){a=this.renderer_.decorate(this,a);this.setElementInternal(a);this.renderer_.setAriaRole(a,this.getPreferredAriaRole());this.isAllowTextSelection()||this.renderer_.setAllowTextSelection(a,!1);this.visible_="none"!=a.style.display};
|
|
goog.ui.Control.prototype.enterDocument=function(){goog.ui.Control.superClass_.enterDocument.call(this);this.renderer_.setAriaStates(this,this.getElementStrict());this.renderer_.initializeDom(this);if(this.supportedStates_&~goog.ui.Component.State.DISABLED&&(this.isHandleMouseEvents()&&this.enableMouseEventHandling_(!0),this.isSupportedState(goog.ui.Component.State.FOCUSED))){var a=this.getKeyEventTarget();if(a){var b=this.getKeyHandler();b.attach(a);this.getHandler().listen(b,goog.events.KeyHandler.EventType.KEY,
|
|
this.handleKeyEvent).listen(a,goog.events.EventType.FOCUS,this.handleFocus).listen(a,goog.events.EventType.BLUR,this.handleBlur)}}};
|
|
goog.ui.Control.prototype.enableMouseEventHandling_=function(a){var b=goog.ui.ComponentUtil.getMouseEventType(this),c=this.getHandler(),d=this.getElement();a?(c.listen(d,b.MOUSEDOWN,this.handleMouseDown).listen(d,[b.MOUSEUP,b.MOUSECANCEL],this.handleMouseUp).listen(d,goog.events.EventType.MOUSEOVER,this.handleMouseOver).listen(d,goog.events.EventType.MOUSEOUT,this.handleMouseOut),this.pointerEventsEnabled()&&c.listen(d,goog.events.EventType.GOTPOINTERCAPTURE,this.preventPointerCapture_),this.handleContextMenu!=
|
|
goog.nullFunction&&c.listen(d,goog.events.EventType.CONTEXTMENU,this.handleContextMenu),goog.userAgent.IE&&(goog.userAgent.isVersionOrHigher(9)||c.listen(d,goog.events.EventType.DBLCLICK,this.handleDblClick),this.ieMouseEventSequenceSimulator_||(this.ieMouseEventSequenceSimulator_=new goog.ui.Control.IeMouseEventSequenceSimulator_(this),this.registerDisposable(this.ieMouseEventSequenceSimulator_)))):(c.unlisten(d,b.MOUSEDOWN,this.handleMouseDown).unlisten(d,[b.MOUSEUP,b.MOUSECANCEL],this.handleMouseUp).unlisten(d,
|
|
goog.events.EventType.MOUSEOVER,this.handleMouseOver).unlisten(d,goog.events.EventType.MOUSEOUT,this.handleMouseOut),this.pointerEventsEnabled()&&c.unlisten(d,goog.events.EventType.GOTPOINTERCAPTURE,this.preventPointerCapture_),this.handleContextMenu!=goog.nullFunction&&c.unlisten(d,goog.events.EventType.CONTEXTMENU,this.handleContextMenu),goog.userAgent.IE&&(goog.userAgent.isVersionOrHigher(9)||c.unlisten(d,goog.events.EventType.DBLCLICK,this.handleDblClick),goog.dispose(this.ieMouseEventSequenceSimulator_),
|
|
this.ieMouseEventSequenceSimulator_=null))};goog.ui.Control.prototype.exitDocument=function(){goog.ui.Control.superClass_.exitDocument.call(this);this.keyHandler_&&this.keyHandler_.detach();this.isVisible()&&this.isEnabled()&&this.renderer_.setFocusable(this,!1)};
|
|
goog.ui.Control.prototype.disposeInternal=function(){goog.ui.Control.superClass_.disposeInternal.call(this);this.keyHandler_&&(this.keyHandler_.dispose(),delete this.keyHandler_);delete this.renderer_;this.ieMouseEventSequenceSimulator_=this.extraClassNames_=this.content_=null};goog.ui.Control.prototype.getContent=function(){return this.content_};goog.ui.Control.prototype.setContent=function(a){this.renderer_.setContent(this.getElement(),a);this.setContentInternal(a)};
|
|
goog.ui.Control.prototype.setContentInternal=function(a){this.content_=a};goog.ui.Control.prototype.getCaption=function(){var a=this.getContent();if(!a)return"";a="string"===typeof a?a:goog.isArray(a)?goog.array.map(a,goog.dom.getRawTextContent).join(""):goog.dom.getTextContent(a);return goog.string.collapseBreakingSpaces(a)};goog.ui.Control.prototype.setCaption=function(a){this.setContent(a)};
|
|
goog.ui.Control.prototype.setRightToLeft=function(a){goog.ui.Control.superClass_.setRightToLeft.call(this,a);var b=this.getElement();b&&this.renderer_.setRightToLeft(b,a)};goog.ui.Control.prototype.isAllowTextSelection=function(){return this.allowTextSelection_};goog.ui.Control.prototype.setAllowTextSelection=function(a){this.allowTextSelection_=a;var b=this.getElement();b&&this.renderer_.setAllowTextSelection(b,a)};goog.ui.Control.prototype.isVisible=function(){return this.visible_};
|
|
goog.ui.Control.prototype.setVisible=function(a,b){if(b||this.visible_!=a&&this.dispatchEvent(a?goog.ui.Component.EventType.SHOW:goog.ui.Component.EventType.HIDE)){var c=this.getElement();c&&this.renderer_.setVisible(c,a);this.isEnabled()&&this.renderer_.setFocusable(this,a);this.visible_=a;return!0}return!1};goog.ui.Control.prototype.isEnabled=function(){return!this.hasState(goog.ui.Component.State.DISABLED)};
|
|
goog.ui.Control.prototype.isParentDisabled_=function(){var a=this.getParent();return!!a&&"function"==typeof a.isEnabled&&!a.isEnabled()};goog.ui.Control.prototype.setEnabled=function(a){!this.isParentDisabled_()&&this.isTransitionAllowed(goog.ui.Component.State.DISABLED,!a)&&(a||(this.setActive(!1),this.setHighlighted(!1)),this.isVisible()&&this.renderer_.setFocusable(this,a),this.setState(goog.ui.Component.State.DISABLED,!a,!0))};goog.ui.Control.prototype.isHighlighted=function(){return this.hasState(goog.ui.Component.State.HOVER)};
|
|
goog.ui.Control.prototype.setHighlighted=function(a){this.isTransitionAllowed(goog.ui.Component.State.HOVER,a)&&this.setState(goog.ui.Component.State.HOVER,a)};goog.ui.Control.prototype.isActive=function(){return this.hasState(goog.ui.Component.State.ACTIVE)};goog.ui.Control.prototype.setActive=function(a){this.isTransitionAllowed(goog.ui.Component.State.ACTIVE,a)&&this.setState(goog.ui.Component.State.ACTIVE,a)};goog.ui.Control.prototype.isSelected=function(){return this.hasState(goog.ui.Component.State.SELECTED)};
|
|
goog.ui.Control.prototype.setSelected=function(a){this.isTransitionAllowed(goog.ui.Component.State.SELECTED,a)&&this.setState(goog.ui.Component.State.SELECTED,a)};goog.ui.Control.prototype.isChecked=function(){return this.hasState(goog.ui.Component.State.CHECKED)};goog.ui.Control.prototype.setChecked=function(a){this.isTransitionAllowed(goog.ui.Component.State.CHECKED,a)&&this.setState(goog.ui.Component.State.CHECKED,a)};goog.ui.Control.prototype.isFocused=function(){return this.hasState(goog.ui.Component.State.FOCUSED)};
|
|
goog.ui.Control.prototype.setFocused=function(a){this.isTransitionAllowed(goog.ui.Component.State.FOCUSED,a)&&this.setState(goog.ui.Component.State.FOCUSED,a)};goog.ui.Control.prototype.isOpen=function(){return this.hasState(goog.ui.Component.State.OPENED)};goog.ui.Control.prototype.setOpen=function(a){this.isTransitionAllowed(goog.ui.Component.State.OPENED,a)&&this.setState(goog.ui.Component.State.OPENED,a)};goog.ui.Control.prototype.getState=function(){return this.state_};
|
|
goog.ui.Control.prototype.hasState=function(a){return!!(this.state_&a)};goog.ui.Control.prototype.setState=function(a,b,c){c||a!=goog.ui.Component.State.DISABLED?this.isSupportedState(a)&&b!=this.hasState(a)&&(this.renderer_.setState(this,a,b),this.state_=b?this.state_|a:this.state_&~a):this.setEnabled(!b)};goog.ui.Control.prototype.setStateInternal=function(a){this.state_=a};goog.ui.Control.prototype.isSupportedState=function(a){return!!(this.supportedStates_&a)};
|
|
goog.ui.Control.prototype.setSupportedState=function(a,b){if(this.isInDocument()&&this.hasState(a)&&!b)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);!b&&this.hasState(a)&&this.setState(a,!1);this.supportedStates_=b?this.supportedStates_|a:this.supportedStates_&~a};goog.ui.Control.prototype.isAutoState=function(a){return!!(this.autoStates_&a)&&this.isSupportedState(a)};goog.ui.Control.prototype.setAutoStates=function(a,b){this.autoStates_=b?this.autoStates_|a:this.autoStates_&~a};
|
|
goog.ui.Control.prototype.isDispatchTransitionEvents=function(a){return!!(this.statesWithTransitionEvents_&a)&&this.isSupportedState(a)};goog.ui.Control.prototype.setDispatchTransitionEvents=function(a,b){this.statesWithTransitionEvents_=b?this.statesWithTransitionEvents_|a:this.statesWithTransitionEvents_&~a};
|
|
goog.ui.Control.prototype.isTransitionAllowed=function(a,b){return this.isSupportedState(a)&&this.hasState(a)!=b&&(!(this.statesWithTransitionEvents_&a)||this.dispatchEvent(goog.ui.Component.getStateTransitionEvent(a,b)))&&!this.isDisposed()};goog.ui.Control.prototype.handleMouseOver=function(a){!goog.ui.Control.isMouseEventWithinElement_(a,this.getElement())&&this.dispatchEvent(goog.ui.Component.EventType.ENTER)&&this.isEnabled()&&this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!0)};
|
|
goog.ui.Control.prototype.handleMouseOut=function(a){!goog.ui.Control.isMouseEventWithinElement_(a,this.getElement())&&this.dispatchEvent(goog.ui.Component.EventType.LEAVE)&&(this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!1),this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!1))};goog.ui.Control.prototype.preventPointerCapture_=function(a){var b=a.target;b.releasePointerCapture&&b.releasePointerCapture(a.pointerId)};
|
|
goog.ui.Control.prototype.handleContextMenu=goog.nullFunction;goog.ui.Control.isMouseEventWithinElement_=function(a,b){return!!a.relatedTarget&&goog.dom.contains(b,a.relatedTarget)};
|
|
goog.ui.Control.prototype.handleMouseDown=function(a){this.isEnabled()&&(this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!0),a.isMouseActionButton()&&(this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!0),this.renderer_&&this.renderer_.isFocusable(this)&&this.getKeyEventTarget().focus()));!this.isAllowTextSelection()&&a.isMouseActionButton()&&a.preventDefault()};
|
|
goog.ui.Control.prototype.handleMouseUp=function(a){this.isEnabled()&&(this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!0),this.isActive()&&this.performActionInternal(a)&&this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!1))};goog.ui.Control.prototype.handleDblClick=function(a){this.isEnabled()&&this.performActionInternal(a)};
|
|
goog.ui.Control.prototype.performActionInternal=function(a){this.isAutoState(goog.ui.Component.State.CHECKED)&&this.setChecked(!this.isChecked());this.isAutoState(goog.ui.Component.State.SELECTED)&&this.setSelected(!0);this.isAutoState(goog.ui.Component.State.OPENED)&&this.setOpen(!this.isOpen());var b=new goog.events.Event(goog.ui.Component.EventType.ACTION,this);a&&(b.altKey=a.altKey,b.ctrlKey=a.ctrlKey,b.metaKey=a.metaKey,b.shiftKey=a.shiftKey,b.platformModifierKey=a.platformModifierKey);return this.dispatchEvent(b)};
|
|
goog.ui.Control.prototype.handleFocus=function(a){this.isAutoState(goog.ui.Component.State.FOCUSED)&&this.setFocused(!0)};goog.ui.Control.prototype.handleBlur=function(a){this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!1);this.isAutoState(goog.ui.Component.State.FOCUSED)&&this.setFocused(!1)};goog.ui.Control.prototype.handleKeyEvent=function(a){return this.isVisible()&&this.isEnabled()&&this.handleKeyEventInternal(a)?(a.preventDefault(),a.stopPropagation(),!0):!1};
|
|
goog.ui.Control.prototype.handleKeyEventInternal=function(a){return a.keyCode==goog.events.KeyCodes.ENTER&&this.performActionInternal(a)};goog.ui.registry.setDefaultRenderer(goog.ui.Control,goog.ui.ControlRenderer);goog.ui.registry.setDecoratorByClassName(goog.ui.ControlRenderer.CSS_CLASS,function(){return new goog.ui.Control(null)});
|
|
goog.ui.Control.IeMouseEventSequenceSimulator_=function(a){goog.Disposable.call(this);this.control_=a;this.clickExpected_=!1;this.handler_=new goog.events.EventHandler(this);this.registerDisposable(this.handler_);var b=this.control_.getElementStrict();a=goog.ui.ComponentUtil.getMouseEventType(a);this.handler_.listen(b,a.MOUSEDOWN,this.handleMouseDown_).listen(b,a.MOUSEUP,this.handleMouseUp_).listen(b,goog.events.EventType.CLICK,this.handleClick_)};
|
|
goog.inherits(goog.ui.Control.IeMouseEventSequenceSimulator_,goog.Disposable);goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_=!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9);goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleMouseDown_=function(){this.clickExpected_=!1};goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleMouseUp_=function(){this.clickExpected_=!0};
|
|
goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_=function(a,b){if(!goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_)return a.button=goog.events.BrowserEvent.MouseButton.LEFT,a.type=b,a;var c=document.createEvent("MouseEvents");c.initMouseEvent(b,a.bubbles,a.cancelable,a.view||null,a.detail,a.screenX,a.screenY,a.clientX,a.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,goog.events.BrowserEvent.MouseButton.LEFT,a.relatedTarget||null);return c};
|
|
goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.handleClick_=function(a){if(this.clickExpected_)this.clickExpected_=!1;else{var b=a.getBrowserEvent(),c=b.button,d=b.type,e=goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_(b,goog.events.EventType.MOUSEDOWN);this.control_.handleMouseDown(new goog.events.BrowserEvent(e,a.currentTarget));e=goog.ui.Control.IeMouseEventSequenceSimulator_.makeLeftMouseEvent_(b,goog.events.EventType.MOUSEUP);this.control_.handleMouseUp(new goog.events.BrowserEvent(e,
|
|
a.currentTarget));goog.ui.Control.IeMouseEventSequenceSimulator_.SYNTHETIC_EVENTS_||(b.button=c,b.type=d)}};goog.ui.Control.IeMouseEventSequenceSimulator_.prototype.disposeInternal=function(){this.control_=null;goog.ui.Control.IeMouseEventSequenceSimulator_.superClass_.disposeInternal.call(this)};goog.ui.Container=function(a,b,c){goog.ui.Component.call(this,c);this.renderer_=b||goog.ui.ContainerRenderer.getInstance();this.orientation_=a||this.renderer_.getDefaultOrientation()};goog.inherits(goog.ui.Container,goog.ui.Component);goog.tagUnsealableClass(goog.ui.Container);goog.ui.Container.EventType={AFTER_SHOW:"aftershow",AFTER_HIDE:"afterhide"};goog.ui.Container.Orientation={HORIZONTAL:"horizontal",VERTICAL:"vertical"};goog.ui.Container.prototype.keyEventTarget_=null;
|
|
goog.ui.Container.prototype.keyHandler_=null;goog.ui.Container.prototype.renderer_=null;goog.ui.Container.prototype.orientation_=null;goog.ui.Container.prototype.visible_=!0;goog.ui.Container.prototype.enabled_=!0;goog.ui.Container.prototype.focusable_=!0;goog.ui.Container.prototype.highlightedIndex_=-1;goog.ui.Container.prototype.openItem_=null;goog.ui.Container.prototype.mouseButtonPressed_=!1;goog.ui.Container.prototype.allowFocusableChildren_=!1;
|
|
goog.ui.Container.prototype.openFollowsHighlight_=!0;goog.ui.Container.prototype.childElementIdMap_=null;goog.ui.Container.prototype.getKeyEventTarget=function(){return this.keyEventTarget_||this.renderer_.getKeyEventTarget(this)};
|
|
goog.ui.Container.prototype.setKeyEventTarget=function(a){if(this.focusable_){var b=this.getKeyEventTarget(),c=this.isInDocument();this.keyEventTarget_=a;var d=this.getKeyEventTarget();c&&(this.keyEventTarget_=b,this.enableFocusHandling_(!1),this.keyEventTarget_=a,this.getKeyHandler().attach(d),this.enableFocusHandling_(!0))}else throw Error("Can't set key event target for container that doesn't support keyboard focus!");};
|
|
goog.ui.Container.prototype.getKeyHandler=function(){return this.keyHandler_||(this.keyHandler_=new goog.events.KeyHandler(this.getKeyEventTarget()))};goog.ui.Container.prototype.getRenderer=function(){return this.renderer_};goog.ui.Container.prototype.setRenderer=function(a){if(this.getElement())throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.renderer_=a};goog.ui.Container.prototype.createDom=function(){this.setElementInternal(this.renderer_.createDom(this))};
|
|
goog.ui.Container.prototype.getContentElement=function(){return this.renderer_.getContentElement(this.getElement())};goog.ui.Container.prototype.canDecorate=function(a){return this.renderer_.canDecorate(a)};goog.ui.Container.prototype.decorateInternal=function(a){this.setElementInternal(this.renderer_.decorate(this,a));"none"==a.style.display&&(this.visible_=!1)};
|
|
goog.ui.Container.prototype.enterDocument=function(){goog.ui.Container.superClass_.enterDocument.call(this);this.forEachChild(function(a){a.isInDocument()&&this.registerChildId_(a)},this);var a=this.getElement();this.renderer_.initializeDom(this);this.setVisible(this.visible_,!0);var b=goog.ui.ComponentUtil.getMouseEventType(this);this.getHandler().listen(this,goog.ui.Component.EventType.ENTER,this.handleEnterItem).listen(this,goog.ui.Component.EventType.HIGHLIGHT,this.handleHighlightItem).listen(this,
|
|
goog.ui.Component.EventType.UNHIGHLIGHT,this.handleUnHighlightItem).listen(this,goog.ui.Component.EventType.OPEN,this.handleOpenItem).listen(this,goog.ui.Component.EventType.CLOSE,this.handleCloseItem).listen(a,b.MOUSEDOWN,this.handleMouseDown).listen(goog.dom.getOwnerDocument(a),[b.MOUSEUP,b.MOUSECANCEL],this.handleDocumentMouseUp).listen(a,[b.MOUSEDOWN,b.MOUSEUP,b.MOUSECANCEL,goog.events.EventType.MOUSEOVER,goog.events.EventType.MOUSEOUT,goog.events.EventType.CONTEXTMENU],this.handleChildMouseEvents);
|
|
this.pointerEventsEnabled()&&this.getHandler().listen(a,goog.events.EventType.GOTPOINTERCAPTURE,this.preventPointerCapture_);this.isFocusable()&&this.enableFocusHandling_(!0)};goog.ui.Container.prototype.preventPointerCapture_=function(a){var b=a.target;b.releasePointerCapture&&b.releasePointerCapture(a.pointerId)};
|
|
goog.ui.Container.prototype.enableFocusHandling_=function(a){var b=this.getHandler(),c=this.getKeyEventTarget();a?b.listen(c,goog.events.EventType.FOCUS,this.handleFocus).listen(c,goog.events.EventType.BLUR,this.handleBlur).listen(this.getKeyHandler(),goog.events.KeyHandler.EventType.KEY,this.handleKeyEvent):b.unlisten(c,goog.events.EventType.FOCUS,this.handleFocus).unlisten(c,goog.events.EventType.BLUR,this.handleBlur).unlisten(this.getKeyHandler(),goog.events.KeyHandler.EventType.KEY,this.handleKeyEvent)};
|
|
goog.ui.Container.prototype.exitDocument=function(){this.setHighlightedIndex(-1);this.openItem_&&this.openItem_.setOpen(!1);this.mouseButtonPressed_=!1;goog.ui.Container.superClass_.exitDocument.call(this)};goog.ui.Container.prototype.disposeInternal=function(){goog.ui.Container.superClass_.disposeInternal.call(this);this.keyHandler_&&(this.keyHandler_.dispose(),this.keyHandler_=null);this.renderer_=this.openItem_=this.childElementIdMap_=this.keyEventTarget_=null};
|
|
goog.ui.Container.prototype.handleEnterItem=function(a){return!0};
|
|
goog.ui.Container.prototype.handleHighlightItem=function(a){var b=this.indexOfChild(a.target);if(-1<b&&b!=this.highlightedIndex_){var c=this.getHighlighted();c&&c.setHighlighted(!1);this.highlightedIndex_=b;c=this.getHighlighted();this.isMouseButtonPressed()&&c.setActive(!0);this.openFollowsHighlight_&&this.openItem_&&c!=this.openItem_&&(c.isSupportedState(goog.ui.Component.State.OPENED)?c.setOpen(!0):this.openItem_.setOpen(!1))}b=this.getElement();goog.asserts.assert(b,"The DOM element for the container cannot be null.");
|
|
null!=a.target.getElement()&&goog.a11y.aria.setState(b,goog.a11y.aria.State.ACTIVEDESCENDANT,a.target.getElement().id)};goog.ui.Container.prototype.handleUnHighlightItem=function(a){a.target==this.getHighlighted()&&(this.highlightedIndex_=-1);a=this.getElement();goog.asserts.assert(a,"The DOM element for the container cannot be null.");goog.a11y.aria.removeState(a,goog.a11y.aria.State.ACTIVEDESCENDANT)};
|
|
goog.ui.Container.prototype.handleOpenItem=function(a){(a=a.target)&&a!=this.openItem_&&a.getParent()==this&&(this.openItem_&&this.openItem_.setOpen(!1),this.openItem_=a)};goog.ui.Container.prototype.handleCloseItem=function(a){a.target==this.openItem_&&(this.openItem_=null);var b=this.getElement(),c=a.target.getElement();b&&a.target.isHighlighted()&&c&&goog.a11y.aria.setActiveDescendant(b,c)};
|
|
goog.ui.Container.prototype.handleMouseDown=function(a){this.enabled_&&this.setMouseButtonPressed(!0);var b=this.getKeyEventTarget();b&&goog.dom.isFocusableTabIndex(b)?b.focus():a.preventDefault()};goog.ui.Container.prototype.handleDocumentMouseUp=function(a){this.setMouseButtonPressed(!1)};
|
|
goog.ui.Container.prototype.handleChildMouseEvents=function(a){var b=goog.ui.ComponentUtil.getMouseEventType(this),c=this.getOwnerControl(a.target);if(c)switch(a.type){case b.MOUSEDOWN:c.handleMouseDown(a);break;case b.MOUSEUP:case b.MOUSECANCEL:c.handleMouseUp(a);break;case goog.events.EventType.MOUSEOVER:c.handleMouseOver(a);break;case goog.events.EventType.MOUSEOUT:c.handleMouseOut(a);break;case goog.events.EventType.CONTEXTMENU:c.handleContextMenu(a)}};
|
|
goog.ui.Container.prototype.getOwnerControl=function(a){if(this.childElementIdMap_)for(var b=this.getElement();a&&a!==b;){var c=a.id;if(c in this.childElementIdMap_)return this.childElementIdMap_[c];a=a.parentNode}return null};goog.ui.Container.prototype.handleFocus=function(a){};goog.ui.Container.prototype.handleBlur=function(a){this.setHighlightedIndex(-1);this.setMouseButtonPressed(!1);this.openItem_&&this.openItem_.setOpen(!1)};
|
|
goog.ui.Container.prototype.handleKeyEvent=function(a){return this.isEnabled()&&this.isVisible()&&(0!=this.getChildCount()||this.keyEventTarget_)&&this.handleKeyEventInternal(a)?(a.preventDefault(),a.stopPropagation(),!0):!1};
|
|
goog.ui.Container.prototype.handleKeyEventInternal=function(a){var b=this.getHighlighted();if(b&&"function"==typeof b.handleKeyEvent&&b.handleKeyEvent(a)||this.openItem_&&this.openItem_!=b&&"function"==typeof this.openItem_.handleKeyEvent&&this.openItem_.handleKeyEvent(a))return!0;if(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return!1;switch(a.keyCode){case goog.events.KeyCodes.ESC:if(this.isFocusable())this.getKeyEventTarget().blur();else return!1;break;case goog.events.KeyCodes.HOME:this.highlightFirst();
|
|
break;case goog.events.KeyCodes.END:this.highlightLast();break;case goog.events.KeyCodes.UP:if(this.orientation_==goog.ui.Container.Orientation.VERTICAL)this.highlightPrevious();else return!1;break;case goog.events.KeyCodes.LEFT:if(this.orientation_==goog.ui.Container.Orientation.HORIZONTAL)this.isRightToLeft()?this.highlightNext():this.highlightPrevious();else return!1;break;case goog.events.KeyCodes.DOWN:if(this.orientation_==goog.ui.Container.Orientation.VERTICAL)this.highlightNext();else return!1;
|
|
break;case goog.events.KeyCodes.RIGHT:if(this.orientation_==goog.ui.Container.Orientation.HORIZONTAL)this.isRightToLeft()?this.highlightPrevious():this.highlightNext();else return!1;break;default:return!1}return!0};goog.ui.Container.prototype.registerChildId_=function(a){var b=a.getElement();b=b.id||(b.id=a.getId());this.childElementIdMap_||(this.childElementIdMap_={});this.childElementIdMap_[b]=a};
|
|
goog.ui.Container.prototype.addChild=function(a,b){goog.asserts.assertInstanceof(a,goog.ui.Control,"The child of a container must be a control");goog.ui.Container.superClass_.addChild.call(this,a,b)};
|
|
goog.ui.Container.prototype.addChildAt=function(a,b,c){goog.asserts.assertInstanceof(a,goog.ui.Control);a.setDispatchTransitionEvents(goog.ui.Component.State.HOVER,!0);a.setDispatchTransitionEvents(goog.ui.Component.State.OPENED,!0);!this.isFocusable()&&this.isFocusableChildrenAllowed()||a.setSupportedState(goog.ui.Component.State.FOCUSED,!1);a.setHandleMouseEvents(!1);var d=a.getParent()==this?this.indexOfChild(a):-1;goog.ui.Container.superClass_.addChildAt.call(this,a,b,c);a.isInDocument()&&this.isInDocument()&&
|
|
this.registerChildId_(a);this.updateHighlightedIndex_(d,b)};goog.ui.Container.prototype.updateHighlightedIndex_=function(a,b){-1==a&&(a=this.getChildCount());a==this.highlightedIndex_?this.highlightedIndex_=Math.min(this.getChildCount()-1,b):a>this.highlightedIndex_&&b<=this.highlightedIndex_?this.highlightedIndex_++:a<this.highlightedIndex_&&b>this.highlightedIndex_&&this.highlightedIndex_--};
|
|
goog.ui.Container.prototype.removeChild=function(a,b){a="string"===typeof a?this.getChild(a):a;goog.asserts.assertInstanceof(a,goog.ui.Control);if(a){var c=this.indexOfChild(a);-1!=c&&(c==this.highlightedIndex_?(a.setHighlighted(!1),this.highlightedIndex_=-1):c<this.highlightedIndex_&&this.highlightedIndex_--);(c=a.getElement())&&c.id&&this.childElementIdMap_&&goog.object.remove(this.childElementIdMap_,c.id)}a=goog.ui.Container.superClass_.removeChild.call(this,a,b);a.setHandleMouseEvents(!0);return a};
|
|
goog.ui.Container.prototype.getOrientation=function(){return this.orientation_};goog.ui.Container.prototype.setOrientation=function(a){if(this.getElement())throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.orientation_=a};goog.ui.Container.prototype.isVisible=function(){return this.visible_};
|
|
goog.ui.Container.prototype.setVisible=function(a,b){if(b||this.visible_!=a&&this.dispatchEvent(a?goog.ui.Component.EventType.SHOW:goog.ui.Component.EventType.HIDE)){this.visible_=a;var c=this.getElement();c&&(goog.style.setElementShown(c,a),this.isFocusable()&&this.renderer_.enableTabIndex(this.getKeyEventTarget(),this.enabled_&&this.visible_),b||this.dispatchEvent(this.visible_?goog.ui.Container.EventType.AFTER_SHOW:goog.ui.Container.EventType.AFTER_HIDE));return!0}return!1};
|
|
goog.ui.Container.prototype.isEnabled=function(){return this.enabled_};
|
|
goog.ui.Container.prototype.setEnabled=function(a){this.enabled_!=a&&this.dispatchEvent(a?goog.ui.Component.EventType.ENABLE:goog.ui.Component.EventType.DISABLE)&&(a?(this.enabled_=!0,this.forEachChild(function(a){a.wasDisabled?delete a.wasDisabled:a.setEnabled(!0)})):(this.forEachChild(function(a){a.isEnabled()?a.setEnabled(!1):a.wasDisabled=!0}),this.enabled_=!1,this.setMouseButtonPressed(!1)),this.isFocusable()&&this.renderer_.enableTabIndex(this.getKeyEventTarget(),a&&this.visible_))};
|
|
goog.ui.Container.prototype.isFocusable=function(){return this.focusable_};goog.ui.Container.prototype.setFocusable=function(a){a!=this.focusable_&&this.isInDocument()&&this.enableFocusHandling_(a);this.focusable_=a;this.enabled_&&this.visible_&&this.renderer_.enableTabIndex(this.getKeyEventTarget(),a)};goog.ui.Container.prototype.isFocusableChildrenAllowed=function(){return this.allowFocusableChildren_};
|
|
goog.ui.Container.prototype.setFocusableChildrenAllowed=function(a){this.allowFocusableChildren_=a};goog.ui.Container.prototype.isOpenFollowsHighlight=function(){return this.openFollowsHighlight_};goog.ui.Container.prototype.setOpenFollowsHighlight=function(a){this.openFollowsHighlight_=a};goog.ui.Container.prototype.getHighlightedIndex=function(){return this.highlightedIndex_};
|
|
goog.ui.Container.prototype.setHighlightedIndex=function(a){(a=this.getChildAt(a))?a.setHighlighted(!0):-1<this.highlightedIndex_&&this.getHighlighted().setHighlighted(!1)};goog.ui.Container.prototype.setHighlighted=function(a){this.setHighlightedIndex(this.indexOfChild(a))};goog.ui.Container.prototype.getHighlighted=function(){return this.getChildAt(this.highlightedIndex_)};
|
|
goog.ui.Container.prototype.highlightFirst=function(){this.highlightHelper(function(a,b){return(a+1)%b},this.getChildCount()-1)};goog.ui.Container.prototype.highlightLast=function(){this.highlightHelper(function(a,b){a--;return 0>a?b-1:a},0)};goog.ui.Container.prototype.highlightNext=function(){this.highlightHelper(function(a,b){return(a+1)%b},this.highlightedIndex_)};goog.ui.Container.prototype.highlightPrevious=function(){this.highlightHelper(function(a,b){a--;return 0>a?b-1:a},this.highlightedIndex_)};
|
|
goog.ui.Container.prototype.highlightHelper=function(a,b){var c=0>b?this.indexOfChild(this.openItem_):b,d=this.getChildCount();c=a.call(this,c,d);for(var e=0;e<=d;){var f=this.getChildAt(c);if(f&&this.canHighlightItem(f))return this.setHighlightedIndexFromKeyEvent(c),!0;e++;c=a.call(this,c,d)}return!1};goog.ui.Container.prototype.canHighlightItem=function(a){return a.isVisible()&&a.isEnabled()&&a.isSupportedState(goog.ui.Component.State.HOVER)};
|
|
goog.ui.Container.prototype.setHighlightedIndexFromKeyEvent=function(a){this.setHighlightedIndex(a)};goog.ui.Container.prototype.getOpenItem=function(){return this.openItem_};goog.ui.Container.prototype.isMouseButtonPressed=function(){return this.mouseButtonPressed_};goog.ui.Container.prototype.setMouseButtonPressed=function(a){this.mouseButtonPressed_=a};goog.ui.MenuHeaderRenderer=function(){goog.ui.ControlRenderer.call(this)};goog.inherits(goog.ui.MenuHeaderRenderer,goog.ui.ControlRenderer);goog.addSingletonGetter(goog.ui.MenuHeaderRenderer);goog.ui.MenuHeaderRenderer.CSS_CLASS="goog-menuheader";goog.ui.MenuHeaderRenderer.prototype.getCssClass=function(){return goog.ui.MenuHeaderRenderer.CSS_CLASS};goog.ui.MenuHeader=function(a,b,c){goog.ui.Control.call(this,a,c||goog.ui.MenuHeaderRenderer.getInstance(),b);this.setSupportedState(goog.ui.Component.State.DISABLED,!1);this.setSupportedState(goog.ui.Component.State.HOVER,!1);this.setSupportedState(goog.ui.Component.State.ACTIVE,!1);this.setSupportedState(goog.ui.Component.State.FOCUSED,!1);this.setStateInternal(goog.ui.Component.State.DISABLED)};goog.inherits(goog.ui.MenuHeader,goog.ui.Control);
|
|
goog.ui.registry.setDecoratorByClassName(goog.ui.MenuHeaderRenderer.CSS_CLASS,function(){return new goog.ui.MenuHeader(null)});goog.ui.MenuItemRenderer=function(){goog.ui.ControlRenderer.call(this);this.classNameCache_=[]};goog.inherits(goog.ui.MenuItemRenderer,goog.ui.ControlRenderer);goog.addSingletonGetter(goog.ui.MenuItemRenderer);goog.ui.MenuItemRenderer.CSS_CLASS="goog-menuitem";goog.ui.MenuItemRenderer.CompositeCssClassIndex_={HOVER:0,CHECKBOX:1,CONTENT:2};
|
|
goog.ui.MenuItemRenderer.prototype.getCompositeCssClass_=function(a){var b=this.classNameCache_[a];if(!b){switch(a){case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER:b=this.getStructuralCssClass()+"-highlight";break;case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX:b=this.getStructuralCssClass()+"-checkbox";break;case goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT:b=this.getStructuralCssClass()+"-content"}this.classNameCache_[a]=b}return b};
|
|
goog.ui.MenuItemRenderer.prototype.getAriaRole=function(){return goog.a11y.aria.Role.MENU_ITEM};goog.ui.MenuItemRenderer.prototype.createDom=function(a){var b=a.getDomHelper().createDom("DIV",this.getClassNames(a).join(" "),this.createContent(a.getContent(),a.getDomHelper()));this.setEnableCheckBoxStructure(a,b,a.isSupportedState(goog.ui.Component.State.SELECTED)||a.isSupportedState(goog.ui.Component.State.CHECKED));return b};
|
|
goog.ui.MenuItemRenderer.prototype.getContentElement=function(a){return a&&a.firstChild};goog.ui.MenuItemRenderer.prototype.decorate=function(a,b){goog.asserts.assert(b);this.hasContentStructure(b)||b.appendChild(this.createContent(b.childNodes,a.getDomHelper()));goog.dom.classlist.contains(b,"goog-option")&&(a.setCheckable(!0),this.setCheckable(a,b,!0));return goog.ui.MenuItemRenderer.superClass_.decorate.call(this,a,b)};
|
|
goog.ui.MenuItemRenderer.prototype.setContent=function(a,b){var c=this.getContentElement(a),d=this.hasCheckBoxStructure(a)?c.firstChild:null;goog.ui.MenuItemRenderer.superClass_.setContent.call(this,a,b);d&&!this.hasCheckBoxStructure(a)&&c.insertBefore(d,c.firstChild||null)};
|
|
goog.ui.MenuItemRenderer.prototype.hasContentStructure=function(a){a=goog.dom.getFirstElementChild(a);var b=this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT);return!!a&&goog.dom.classlist.contains(a,b)};goog.ui.MenuItemRenderer.prototype.createContent=function(a,b){var c=this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CONTENT);return b.createDom("DIV",c,a)};
|
|
goog.ui.MenuItemRenderer.prototype.setSelectable=function(a,b,c){a&&b&&this.setEnableCheckBoxStructure(a,b,c)};goog.ui.MenuItemRenderer.prototype.setCheckable=function(a,b,c){a&&b&&this.setEnableCheckBoxStructure(a,b,c)};goog.ui.MenuItemRenderer.prototype.hasCheckBoxStructure=function(a){if(a=this.getContentElement(a)){a=a.firstChild;var b=this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX);return!!a&&goog.dom.isElement(a)&&goog.dom.classlist.contains(a,b)}return!1};
|
|
goog.ui.MenuItemRenderer.prototype.setEnableCheckBoxStructure=function(a,b,c){this.setAriaRole(b,a.getPreferredAriaRole());this.setAriaStates(a,b);c!=this.hasCheckBoxStructure(b)&&(goog.dom.classlist.enable(b,"goog-option",c),b=this.getContentElement(b),c?(c=this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.CHECKBOX),b.insertBefore(a.getDomHelper().createDom("DIV",c),b.firstChild||null)):b.removeChild(b.firstChild))};
|
|
goog.ui.MenuItemRenderer.prototype.getClassForState=function(a){switch(a){case goog.ui.Component.State.HOVER:return this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER);case goog.ui.Component.State.CHECKED:case goog.ui.Component.State.SELECTED:return"goog-option-selected";default:return goog.ui.MenuItemRenderer.superClass_.getClassForState.call(this,a)}};
|
|
goog.ui.MenuItemRenderer.prototype.getStateFromClass=function(a){var b=this.getCompositeCssClass_(goog.ui.MenuItemRenderer.CompositeCssClassIndex_.HOVER);switch(a){case "goog-option-selected":return goog.ui.Component.State.CHECKED;case b:return goog.ui.Component.State.HOVER;default:return goog.ui.MenuItemRenderer.superClass_.getStateFromClass.call(this,a)}};goog.ui.MenuItemRenderer.prototype.getCssClass=function(){return goog.ui.MenuItemRenderer.CSS_CLASS};goog.ui.MenuItem=function(a,b,c,d){goog.ui.Control.call(this,a,d||goog.ui.MenuItemRenderer.getInstance(),c);this.setValue(b)};goog.inherits(goog.ui.MenuItem,goog.ui.Control);goog.tagUnsealableClass(goog.ui.MenuItem);goog.ui.MenuItem.MNEMONIC_WRAPPER_CLASS_="goog-menuitem-mnemonic-separator";goog.ui.MenuItem.ACCELERATOR_CLASS="goog-menuitem-accel";goog.ui.MenuItem.prototype.getValue=function(){var a=this.getModel();return null!=a?a:this.getCaption()};goog.ui.MenuItem.prototype.setValue=function(a){this.setModel(a)};
|
|
goog.ui.MenuItem.prototype.setSupportedState=function(a,b){goog.ui.MenuItem.superClass_.setSupportedState.call(this,a,b);switch(a){case goog.ui.Component.State.SELECTED:this.setSelectableInternal_(b);break;case goog.ui.Component.State.CHECKED:this.setCheckableInternal_(b)}};goog.ui.MenuItem.prototype.setSelectable=function(a){this.setSupportedState(goog.ui.Component.State.SELECTED,a)};
|
|
goog.ui.MenuItem.prototype.setSelectableInternal_=function(a){this.isChecked()&&!a&&this.setChecked(!1);var b=this.getElement();b&&this.getRenderer().setSelectable(this,b,a)};goog.ui.MenuItem.prototype.setCheckable=function(a){this.setSupportedState(goog.ui.Component.State.CHECKED,a)};goog.ui.MenuItem.prototype.setCheckableInternal_=function(a){var b=this.getElement();b&&this.getRenderer().setCheckable(this,b,a)};
|
|
goog.ui.MenuItem.prototype.getCaption=function(){var a=this.getContent();if(goog.isArray(a)){var b=goog.ui.MenuItem.ACCELERATOR_CLASS,c=goog.ui.MenuItem.MNEMONIC_WRAPPER_CLASS_;a=goog.array.map(a,function(a){return goog.dom.isElement(a)&&(goog.dom.classlist.contains(a,b)||goog.dom.classlist.contains(a,c))?"":goog.dom.getRawTextContent(a)}).join("");return goog.string.collapseBreakingSpaces(a)}return goog.ui.MenuItem.superClass_.getCaption.call(this)};
|
|
goog.ui.MenuItem.prototype.getAccelerator=function(){var a=this.getDomHelper(),b=this.getContent();return goog.isArray(b)&&(b=goog.array.find(b,function(a){return goog.dom.classlist.contains(a,goog.ui.MenuItem.ACCELERATOR_CLASS)}))?a.getTextContent(b):null};
|
|
goog.ui.MenuItem.prototype.handleMouseUp=function(a){var b=this.getParent();if(b){var c=b.openingCoords;b.openingCoords=null;if(c&&"number"===typeof a.clientX&&(b=new goog.math.Coordinate(a.clientX,a.clientY),goog.math.Coordinate.equals(c,b)))return}goog.ui.MenuItem.superClass_.handleMouseUp.call(this,a)};
|
|
goog.ui.MenuItem.prototype.handleKeyEventInternal=function(a){return a.keyCode==this.getMnemonic()&&this.performActionInternal(a)?!0:goog.ui.MenuItem.superClass_.handleKeyEventInternal.call(this,a)};goog.ui.MenuItem.prototype.setMnemonic=function(a){this.mnemonicKey_=a};goog.ui.MenuItem.prototype.getMnemonic=function(){return this.mnemonicKey_};goog.ui.registry.setDecoratorByClassName(goog.ui.MenuItemRenderer.CSS_CLASS,function(){return new goog.ui.MenuItem(null)});
|
|
goog.ui.MenuItem.prototype.getPreferredAriaRole=function(){return this.isSupportedState(goog.ui.Component.State.CHECKED)?goog.a11y.aria.Role.MENU_ITEM_CHECKBOX:this.isSupportedState(goog.ui.Component.State.SELECTED)?goog.a11y.aria.Role.MENU_ITEM_RADIO:goog.ui.MenuItem.superClass_.getPreferredAriaRole.call(this)};goog.ui.MenuItem.prototype.getParent=function(){return goog.ui.Control.prototype.getParent.call(this)};goog.ui.MenuItem.prototype.getParentEventTarget=function(){return goog.ui.Control.prototype.getParentEventTarget.call(this)};goog.ui.MenuSeparatorRenderer=function(){goog.ui.ControlRenderer.call(this)};goog.inherits(goog.ui.MenuSeparatorRenderer,goog.ui.ControlRenderer);goog.addSingletonGetter(goog.ui.MenuSeparatorRenderer);goog.ui.MenuSeparatorRenderer.CSS_CLASS="goog-menuseparator";goog.ui.MenuSeparatorRenderer.prototype.createDom=function(a){return a.getDomHelper().createDom("DIV",this.getCssClass())};
|
|
goog.ui.MenuSeparatorRenderer.prototype.decorate=function(a,b){b.id&&a.setId(b.id);if("HR"==b.tagName){var c=b;b=this.createDom(a);goog.dom.insertSiblingBefore(b,c);goog.dom.removeNode(c)}else goog.dom.classlist.add(b,this.getCssClass());return b};goog.ui.MenuSeparatorRenderer.prototype.setContent=function(a,b){};goog.ui.MenuSeparatorRenderer.prototype.getCssClass=function(){return goog.ui.MenuSeparatorRenderer.CSS_CLASS};goog.ui.Separator=function(a,b){goog.ui.Control.call(this,null,a||goog.ui.MenuSeparatorRenderer.getInstance(),b);this.setSupportedState(goog.ui.Component.State.DISABLED,!1);this.setSupportedState(goog.ui.Component.State.HOVER,!1);this.setSupportedState(goog.ui.Component.State.ACTIVE,!1);this.setSupportedState(goog.ui.Component.State.FOCUSED,!1);this.setStateInternal(goog.ui.Component.State.DISABLED)};goog.inherits(goog.ui.Separator,goog.ui.Control);
|
|
goog.ui.Separator.prototype.enterDocument=function(){goog.ui.Separator.superClass_.enterDocument.call(this);var a=this.getElement();goog.asserts.assert(a,"The DOM element for the separator cannot be null.");goog.a11y.aria.setRole(a,"separator")};goog.ui.registry.setDecoratorByClassName(goog.ui.MenuSeparatorRenderer.CSS_CLASS,function(){return new goog.ui.Separator});goog.ui.MenuRenderer=function(a){goog.ui.ContainerRenderer.call(this,a||goog.a11y.aria.Role.MENU)};goog.inherits(goog.ui.MenuRenderer,goog.ui.ContainerRenderer);goog.addSingletonGetter(goog.ui.MenuRenderer);goog.ui.MenuRenderer.CSS_CLASS="goog-menu";goog.ui.MenuRenderer.prototype.canDecorate=function(a){return"UL"==a.tagName||goog.ui.MenuRenderer.superClass_.canDecorate.call(this,a)};
|
|
goog.ui.MenuRenderer.prototype.getDecoratorForChild=function(a){return"HR"==a.tagName?new goog.ui.Separator:goog.ui.MenuRenderer.superClass_.getDecoratorForChild.call(this,a)};goog.ui.MenuRenderer.prototype.containsElement=function(a,b){return goog.dom.contains(a.getElement(),b)};goog.ui.MenuRenderer.prototype.getCssClass=function(){return goog.ui.MenuRenderer.CSS_CLASS};
|
|
goog.ui.MenuRenderer.prototype.initializeDom=function(a){goog.ui.MenuRenderer.superClass_.initializeDom.call(this,a);a=a.getElement();goog.asserts.assert(a,"The menu DOM element cannot be null.");goog.a11y.aria.setState(a,goog.a11y.aria.State.HASPOPUP,"true")};goog.ui.MenuSeparator=function(a){goog.ui.Separator.call(this,goog.ui.MenuSeparatorRenderer.getInstance(),a)};goog.inherits(goog.ui.MenuSeparator,goog.ui.Separator);goog.ui.registry.setDecoratorByClassName(goog.ui.MenuSeparatorRenderer.CSS_CLASS,function(){return new goog.ui.Separator});goog.ui.Menu=function(a,b){goog.ui.Container.call(this,goog.ui.Container.Orientation.VERTICAL,b||goog.ui.MenuRenderer.getInstance(),a);this.setFocusable(!1)};goog.inherits(goog.ui.Menu,goog.ui.Container);goog.tagUnsealableClass(goog.ui.Menu);goog.ui.Menu.EventType={BEFORE_SHOW:goog.ui.Component.EventType.BEFORE_SHOW,SHOW:goog.ui.Component.EventType.SHOW,BEFORE_HIDE:goog.ui.Component.EventType.HIDE,HIDE:goog.ui.Component.EventType.HIDE};goog.ui.Menu.CSS_CLASS=goog.ui.MenuRenderer.CSS_CLASS;
|
|
goog.ui.Menu.prototype.allowAutoFocus_=!0;goog.ui.Menu.prototype.allowHighlightDisabled_=!1;goog.ui.Menu.prototype.getCssClass=function(){return this.getRenderer().getCssClass()};goog.ui.Menu.prototype.containsElement=function(a){if(this.getRenderer().containsElement(this,a))return!0;for(var b=0,c=this.getChildCount();b<c;b++){var d=this.getChildAt(b);if("function"==typeof d.containsElement&&d.containsElement(a))return!0}return!1};goog.ui.Menu.prototype.addItem=function(a){this.addChild(a,!0)};
|
|
goog.ui.Menu.prototype.addItemAt=function(a,b){this.addChildAt(a,b,!0)};goog.ui.Menu.prototype.removeItem=function(a){(a=this.removeChild(a,!0))&&a.dispose()};goog.ui.Menu.prototype.removeItemAt=function(a){(a=this.removeChildAt(a,!0))&&a.dispose()};goog.ui.Menu.prototype.getItemAt=function(a){return this.getChildAt(a)};goog.ui.Menu.prototype.getItemCount=function(){return this.getChildCount()};goog.ui.Menu.prototype.getItems=function(){var a=[];this.forEachChild(function(b){a.push(b)});return a};
|
|
goog.ui.Menu.prototype.setPosition=function(a,b){var c=this.isVisible();c||goog.style.setElementShown(this.getElement(),!0);goog.style.setPageOffset(this.getElement(),a,b);c||goog.style.setElementShown(this.getElement(),!1)};goog.ui.Menu.prototype.getPosition=function(){return this.isVisible()?goog.style.getPageOffset(this.getElement()):null};goog.ui.Menu.prototype.setAllowAutoFocus=function(a){(this.allowAutoFocus_=a)&&this.setFocusable(!0)};goog.ui.Menu.prototype.getAllowAutoFocus=function(){return this.allowAutoFocus_};
|
|
goog.ui.Menu.prototype.setAllowHighlightDisabled=function(a){this.allowHighlightDisabled_=a};goog.ui.Menu.prototype.getAllowHighlightDisabled=function(){return this.allowHighlightDisabled_};goog.ui.Menu.prototype.setVisible=function(a,b,c){(b=goog.ui.Menu.superClass_.setVisible.call(this,a,b))&&a&&this.isInDocument()&&this.allowAutoFocus_&&this.getKeyEventTarget().focus();this.openingCoords=a&&c&&"number"===typeof c.clientX?new goog.math.Coordinate(c.clientX,c.clientY):null;return b};
|
|
goog.ui.Menu.prototype.handleEnterItem=function(a){this.allowAutoFocus_&&this.getKeyEventTarget().focus();return goog.ui.Menu.superClass_.handleEnterItem.call(this,a)};goog.ui.Menu.prototype.highlightNextPrefix=function(a){var b=new RegExp("^"+goog.string.regExpEscape(a),"i");return this.highlightHelper(function(a,d){var c=0>a?0:a,f=!1;do{++a;a==d&&(a=0,f=!0);var g=this.getChildAt(a).getCaption();if(g&&g.match(b))return a}while(!f||a!=c);return this.getHighlightedIndex()},this.getHighlightedIndex())};
|
|
goog.ui.Menu.prototype.canHighlightItem=function(a){return(this.allowHighlightDisabled_||a.isEnabled())&&a.isVisible()&&a.isSupportedState(goog.ui.Component.State.HOVER)};goog.ui.Menu.prototype.decorateInternal=function(a){this.decorateContent(a);goog.ui.Menu.superClass_.decorateInternal.call(this,a)};
|
|
goog.ui.Menu.prototype.handleKeyEventInternal=function(a){var b=goog.ui.Menu.superClass_.handleKeyEventInternal.call(this,a);b||this.forEachChild(function(c){!b&&c.getMnemonic&&c.getMnemonic()==a.keyCode&&(this.isEnabled()&&this.setHighlighted(c),b=c.handleKeyEvent(a))},this);return b};goog.ui.Menu.prototype.setHighlightedIndex=function(a){goog.ui.Menu.superClass_.setHighlightedIndex.call(this,a);(a=this.getChildAt(a))&&goog.style.scrollIntoContainerView(a.getElement(),this.getElement())};
|
|
goog.ui.Menu.prototype.decorateContent=function(a){var b=this.getRenderer();a=this.getDomHelper().getElementsByTagNameAndClass("DIV",b.getCssClass()+"-content",a);for(var c=a.length,d=0;d<c;d++)b.decorateChildren(this,a[d])};goog.Thenable=function(){};goog.Thenable.prototype.then=function(a,b,c){};goog.Thenable.IMPLEMENTED_BY_PROP="$goog_Thenable";goog.Thenable.addImplementation=function(a){COMPILED?a.prototype[goog.Thenable.IMPLEMENTED_BY_PROP]=!0:a.prototype.$goog_Thenable=!0};goog.Thenable.isImplementedBy=function(a){if(!a)return!1;try{return COMPILED?!!a[goog.Thenable.IMPLEMENTED_BY_PROP]:!!a.$goog_Thenable}catch(b){return!1}};goog.async={};goog.async.FreeList=function(a,b,c){this.limit_=c;this.create_=a;this.reset_=b;this.occupants_=0;this.head_=null};goog.async.FreeList.prototype.get=function(){if(0<this.occupants_){this.occupants_--;var a=this.head_;this.head_=a.next;a.next=null}else a=this.create_();return a};goog.async.FreeList.prototype.put=function(a){this.reset_(a);this.occupants_<this.limit_&&(this.occupants_++,a.next=this.head_,this.head_=a)};goog.async.FreeList.prototype.occupants=function(){return this.occupants_};goog.async.WorkQueue=function(){this.workTail_=this.workHead_=null};goog.async.WorkQueue.DEFAULT_MAX_UNUSED=100;goog.async.WorkQueue.freelist_=new goog.async.FreeList(function(){return new goog.async.WorkItem},function(a){a.reset()},goog.async.WorkQueue.DEFAULT_MAX_UNUSED);goog.async.WorkQueue.prototype.add=function(a,b){var c=this.getUnusedItem_();c.set(a,b);this.workTail_?this.workTail_.next=c:(goog.asserts.assert(!this.workHead_),this.workHead_=c);this.workTail_=c};
|
|
goog.async.WorkQueue.prototype.remove=function(){var a=null;this.workHead_&&(a=this.workHead_,this.workHead_=this.workHead_.next,this.workHead_||(this.workTail_=null),a.next=null);return a};goog.async.WorkQueue.prototype.returnUnused=function(a){goog.async.WorkQueue.freelist_.put(a)};goog.async.WorkQueue.prototype.getUnusedItem_=function(){return goog.async.WorkQueue.freelist_.get()};goog.async.WorkItem=function(){this.next=this.scope=this.fn=null};
|
|
goog.async.WorkItem.prototype.set=function(a,b){this.fn=a;this.scope=b;this.next=null};goog.async.WorkItem.prototype.reset=function(){this.next=this.scope=this.fn=null};goog.async.throwException=function(a){goog.global.setTimeout(function(){throw a;},0)};goog.async.nextTick=function(a,b,c){var d=a;b&&(d=goog.bind(a,b));d=goog.async.nextTick.wrapCallback_(d);goog.isFunction(goog.global.setImmediate)&&(c||goog.async.nextTick.useSetImmediate_())?goog.global.setImmediate(d):(goog.async.nextTick.setImmediate_||(goog.async.nextTick.setImmediate_=goog.async.nextTick.getSetImmediateEmulator_()),goog.async.nextTick.setImmediate_(d))};
|
|
goog.async.nextTick.useSetImmediate_=function(){return goog.global.Window&&goog.global.Window.prototype&&!goog.labs.userAgent.browser.isEdge()&&goog.global.Window.prototype.setImmediate==goog.global.setImmediate?!1:!0};
|
|
goog.async.nextTick.getSetImmediateEmulator_=function(){var a=goog.global.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!goog.labs.userAgent.engine.isPresto()&&(a=function(){var a=goog.dom.createElement("IFRAME");a.style.display="none";goog.dom.safe.setIframeSrc(a,goog.html.TrustedResourceUrl.fromConstant(goog.string.Const.EMPTY));document.documentElement.appendChild(a);var b=a.contentWindow;a=b.document;a.open();goog.dom.safe.documentWrite(a,
|
|
goog.html.SafeHtml.EMPTY);a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host;a=goog.bind(function(a){if(("*"==d||a.origin==d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!goog.labs.userAgent.browser.isIE()){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var a=c.cb;c.cb=
|
|
null;a()}};return function(a){d.next={cb:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in goog.dom.createElement("SCRIPT")?function(a){var b=goog.dom.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){goog.global.setTimeout(a,0)}};goog.async.nextTick.wrapCallback_=goog.functions.identity;
|
|
goog.debug.entryPointRegistry.register(function(a){goog.async.nextTick.wrapCallback_=a});goog.ASSUME_NATIVE_PROMISE=!1;goog.async.run=function(a,b){goog.async.run.schedule_||goog.async.run.initializeRunner_();goog.async.run.workQueueScheduled_||(goog.async.run.schedule_(),goog.async.run.workQueueScheduled_=!0);goog.async.run.workQueue_.add(a,b)};
|
|
goog.async.run.initializeRunner_=function(){if(goog.ASSUME_NATIVE_PROMISE||goog.global.Promise&&goog.global.Promise.resolve){var a=goog.global.Promise.resolve(void 0);goog.async.run.schedule_=function(){a.then(goog.async.run.processWorkQueue)}}else goog.async.run.schedule_=function(){goog.async.nextTick(goog.async.run.processWorkQueue)}};goog.async.run.forceNextTick=function(a){goog.async.run.schedule_=function(){goog.async.nextTick(goog.async.run.processWorkQueue);a&&a(goog.async.run.processWorkQueue)}};
|
|
goog.async.run.workQueueScheduled_=!1;goog.async.run.workQueue_=new goog.async.WorkQueue;goog.DEBUG&&(goog.async.run.resetQueue=function(){goog.async.run.workQueueScheduled_=!1;goog.async.run.workQueue_=new goog.async.WorkQueue});goog.async.run.processWorkQueue=function(){for(var a;a=goog.async.run.workQueue_.remove();){try{a.fn.call(a.scope)}catch(b){goog.async.throwException(b)}goog.async.run.workQueue_.returnUnused(a)}goog.async.run.workQueueScheduled_=!1};goog.promise={};goog.promise.Resolver=function(){};goog.Promise=function(a,b){this.state_=goog.Promise.State_.PENDING;this.result_=void 0;this.callbackEntriesTail_=this.callbackEntries_=this.parent_=null;this.executing_=!1;0<goog.Promise.UNHANDLED_REJECTION_DELAY?this.unhandledRejectionId_=0:0==goog.Promise.UNHANDLED_REJECTION_DELAY&&(this.hadUnhandledRejection_=!1);goog.Promise.LONG_STACK_TRACES&&(this.stack_=[],this.addStackTrace_(Error("created")),this.currentStep_=0);if(a!=goog.nullFunction)try{var c=this;a.call(b,function(a){c.resolve_(goog.Promise.State_.FULFILLED,
|
|
a)},function(a){if(goog.DEBUG&&!(a instanceof goog.Promise.CancellationError))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(e){}c.resolve_(goog.Promise.State_.REJECTED,a)})}catch(d){this.resolve_(goog.Promise.State_.REJECTED,d)}};goog.Promise.LONG_STACK_TRACES=!1;goog.Promise.UNHANDLED_REJECTION_DELAY=0;goog.Promise.State_={PENDING:0,BLOCKED:1,FULFILLED:2,REJECTED:3};
|
|
goog.Promise.CallbackEntry_=function(){this.next=this.context=this.onRejected=this.onFulfilled=this.child=null;this.always=!1};goog.Promise.CallbackEntry_.prototype.reset=function(){this.context=this.onRejected=this.onFulfilled=this.child=null;this.always=!1};goog.Promise.DEFAULT_MAX_UNUSED=100;goog.Promise.freelist_=new goog.async.FreeList(function(){return new goog.Promise.CallbackEntry_},function(a){a.reset()},goog.Promise.DEFAULT_MAX_UNUSED);
|
|
goog.Promise.getCallbackEntry_=function(a,b,c){var d=goog.Promise.freelist_.get();d.onFulfilled=a;d.onRejected=b;d.context=c;return d};goog.Promise.returnEntry_=function(a){goog.Promise.freelist_.put(a)};goog.Promise.resolve=function(a){if(a instanceof goog.Promise)return a;var b=new goog.Promise(goog.nullFunction);b.resolve_(goog.Promise.State_.FULFILLED,a);return b};goog.Promise.reject=function(a){return new goog.Promise(function(b,c){c(a)})};
|
|
goog.Promise.resolveThen_=function(a,b,c){goog.Promise.maybeThen_(a,b,c,null)||goog.async.run(goog.partial(b,a))};goog.Promise.race=function(a){return new goog.Promise(function(b,c){a.length||b(void 0);for(var d=0,e;d<a.length;d++)e=a[d],goog.Promise.resolveThen_(e,b,c)})};
|
|
goog.Promise.all=function(a){return new goog.Promise(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,c){d--;e[a]=c;0==d&&b(e)},g=function(a){c(a)},h=0,k;h<a.length;h++)k=a[h],goog.Promise.resolveThen_(k,goog.partial(f,h),g);else b(e)})};
|
|
goog.Promise.allSettled=function(a){return new goog.Promise(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,c,f){d--;e[a]=c?{fulfilled:!0,value:f}:{fulfilled:!1,reason:f};0==d&&b(e)},g=0,h;g<a.length;g++)h=a[g],goog.Promise.resolveThen_(h,goog.partial(f,g,!0),goog.partial(f,g,!1));else b(e)})};
|
|
goog.Promise.firstFulfilled=function(a){return new goog.Promise(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a){b(a)},g=function(a,b){d--;e[a]=b;0==d&&c(e)},h=0,k;h<a.length;h++)k=a[h],goog.Promise.resolveThen_(k,f,goog.partial(g,h));else b(void 0)})};goog.Promise.withResolver=function(){var a,b,c=new goog.Promise(function(c,e){a=c;b=e});return new goog.Promise.Resolver_(c,a,b)};
|
|
goog.Promise.prototype.then=function(a,b,c){null!=a&&goog.asserts.assertFunction(a,"opt_onFulfilled should be a function.");null!=b&&goog.asserts.assertFunction(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");goog.Promise.LONG_STACK_TRACES&&this.addStackTrace_(Error("then"));return this.addChildPromise_(goog.isFunction(a)?a:null,goog.isFunction(b)?b:null,c)};goog.Thenable.addImplementation(goog.Promise);
|
|
goog.Promise.prototype.thenVoid=function(a,b,c){null!=a&&goog.asserts.assertFunction(a,"opt_onFulfilled should be a function.");null!=b&&goog.asserts.assertFunction(b,"opt_onRejected should be a function. Did you pass opt_context as the second argument instead of the third?");goog.Promise.LONG_STACK_TRACES&&this.addStackTrace_(Error("then"));this.addCallbackEntry_(goog.Promise.getCallbackEntry_(a||goog.nullFunction,b||null,c))};
|
|
goog.Promise.prototype.thenAlways=function(a,b){goog.Promise.LONG_STACK_TRACES&&this.addStackTrace_(Error("thenAlways"));var c=goog.Promise.getCallbackEntry_(a,a,b);c.always=!0;this.addCallbackEntry_(c);return this};goog.Promise.prototype.thenCatch=function(a,b){goog.Promise.LONG_STACK_TRACES&&this.addStackTrace_(Error("thenCatch"));return this.addChildPromise_(null,a,b)};
|
|
goog.Promise.prototype.cancel=function(a){if(this.state_==goog.Promise.State_.PENDING){var b=new goog.Promise.CancellationError(a);goog.async.run(function(){this.cancelInternal_(b)},this)}};goog.Promise.prototype.cancelInternal_=function(a){this.state_==goog.Promise.State_.PENDING&&(this.parent_?(this.parent_.cancelChild_(this,a),this.parent_=null):this.resolve_(goog.Promise.State_.REJECTED,a))};
|
|
goog.Promise.prototype.cancelChild_=function(a,b){if(this.callbackEntries_){for(var c=0,d=null,e=null,f=this.callbackEntries_;f&&(f.always||(c++,f.child==a&&(d=f),!(d&&1<c)));f=f.next)d||(e=f);d&&(this.state_==goog.Promise.State_.PENDING&&1==c?this.cancelInternal_(b):(e?this.removeEntryAfter_(e):this.popEntry_(),this.executeCallback_(d,goog.Promise.State_.REJECTED,b)))}};
|
|
goog.Promise.prototype.addCallbackEntry_=function(a){this.hasEntry_()||this.state_!=goog.Promise.State_.FULFILLED&&this.state_!=goog.Promise.State_.REJECTED||this.scheduleCallbacks_();this.queueEntry_(a)};
|
|
goog.Promise.prototype.addChildPromise_=function(a,b,c){var d=goog.Promise.getCallbackEntry_(null,null,null);d.child=new goog.Promise(function(e,f){d.onFulfilled=a?function(b){try{var d=a.call(c,b);e(d)}catch(k){f(k)}}:e;d.onRejected=b?function(a){try{var d=b.call(c,a);void 0===d&&a instanceof goog.Promise.CancellationError?f(a):e(d)}catch(k){f(k)}}:f});d.child.parent_=this;this.addCallbackEntry_(d);return d.child};
|
|
goog.Promise.prototype.unblockAndFulfill_=function(a){goog.asserts.assert(this.state_==goog.Promise.State_.BLOCKED);this.state_=goog.Promise.State_.PENDING;this.resolve_(goog.Promise.State_.FULFILLED,a)};goog.Promise.prototype.unblockAndReject_=function(a){goog.asserts.assert(this.state_==goog.Promise.State_.BLOCKED);this.state_=goog.Promise.State_.PENDING;this.resolve_(goog.Promise.State_.REJECTED,a)};
|
|
goog.Promise.prototype.resolve_=function(a,b){this.state_==goog.Promise.State_.PENDING&&(this===b&&(a=goog.Promise.State_.REJECTED,b=new TypeError("Promise cannot resolve to itself")),this.state_=goog.Promise.State_.BLOCKED,goog.Promise.maybeThen_(b,this.unblockAndFulfill_,this.unblockAndReject_,this)||(this.result_=b,this.state_=a,this.parent_=null,this.scheduleCallbacks_(),a!=goog.Promise.State_.REJECTED||b instanceof goog.Promise.CancellationError||goog.Promise.addUnhandledRejection_(this,b)))};
|
|
goog.Promise.maybeThen_=function(a,b,c,d){if(a instanceof goog.Promise)return a.thenVoid(b,c,d),!0;if(goog.Thenable.isImplementedBy(a))return a.then(b,c,d),!0;if(goog.isObject(a))try{var e=a.then;if(goog.isFunction(e))return goog.Promise.tryThen_(a,e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1};goog.Promise.tryThen_=function(a,b,c,d,e){var f=!1,g=function(a){f||(f=!0,c.call(e,a))},h=function(a){f||(f=!0,d.call(e,a))};try{b.call(a,g,h)}catch(k){h(k)}};
|
|
goog.Promise.prototype.scheduleCallbacks_=function(){this.executing_||(this.executing_=!0,goog.async.run(this.executeCallbacks_,this))};goog.Promise.prototype.hasEntry_=function(){return!!this.callbackEntries_};goog.Promise.prototype.queueEntry_=function(a){goog.asserts.assert(null!=a.onFulfilled);this.callbackEntriesTail_?this.callbackEntriesTail_.next=a:this.callbackEntries_=a;this.callbackEntriesTail_=a};
|
|
goog.Promise.prototype.popEntry_=function(){var a=null;this.callbackEntries_&&(a=this.callbackEntries_,this.callbackEntries_=a.next,a.next=null);this.callbackEntries_||(this.callbackEntriesTail_=null);null!=a&&goog.asserts.assert(null!=a.onFulfilled);return a};goog.Promise.prototype.removeEntryAfter_=function(a){goog.asserts.assert(this.callbackEntries_);goog.asserts.assert(null!=a);a.next==this.callbackEntriesTail_&&(this.callbackEntriesTail_=a);a.next=a.next.next};
|
|
goog.Promise.prototype.executeCallbacks_=function(){for(var a;a=this.popEntry_();)goog.Promise.LONG_STACK_TRACES&&this.currentStep_++,this.executeCallback_(a,this.state_,this.result_);this.executing_=!1};
|
|
goog.Promise.prototype.executeCallback_=function(a,b,c){b==goog.Promise.State_.REJECTED&&a.onRejected&&!a.always&&this.removeUnhandledRejection_();if(a.child)a.child.parent_=null,goog.Promise.invokeCallback_(a,b,c);else try{a.always?a.onFulfilled.call(a.context):goog.Promise.invokeCallback_(a,b,c)}catch(d){goog.Promise.handleRejection_.call(null,d)}goog.Promise.returnEntry_(a)};
|
|
goog.Promise.invokeCallback_=function(a,b,c){b==goog.Promise.State_.FULFILLED?a.onFulfilled.call(a.context,c):a.onRejected&&a.onRejected.call(a.context,c)};goog.Promise.prototype.addStackTrace_=function(a){if(goog.Promise.LONG_STACK_TRACES&&"string"===typeof a.stack){var b=a.stack.split("\n",4)[3];a=a.message;a+=Array(11-a.length).join(" ");this.stack_.push(a+b)}};
|
|
goog.Promise.prototype.appendLongStack_=function(a){if(goog.Promise.LONG_STACK_TRACES&&a&&"string"===typeof a.stack&&this.stack_.length){for(var b=["Promise trace:"],c=this;c;c=c.parent_){for(var d=this.currentStep_;0<=d;d--)b.push(c.stack_[d]);b.push("Value: ["+(c.state_==goog.Promise.State_.REJECTED?"REJECTED":"FULFILLED")+"] <"+String(c.result_)+">")}a.stack+="\n\n"+b.join("\n")}};
|
|
goog.Promise.prototype.removeUnhandledRejection_=function(){if(0<goog.Promise.UNHANDLED_REJECTION_DELAY)for(var a=this;a&&a.unhandledRejectionId_;a=a.parent_)goog.global.clearTimeout(a.unhandledRejectionId_),a.unhandledRejectionId_=0;else if(0==goog.Promise.UNHANDLED_REJECTION_DELAY)for(a=this;a&&a.hadUnhandledRejection_;a=a.parent_)a.hadUnhandledRejection_=!1};
|
|
goog.Promise.addUnhandledRejection_=function(a,b){0<goog.Promise.UNHANDLED_REJECTION_DELAY?a.unhandledRejectionId_=goog.global.setTimeout(function(){a.appendLongStack_(b);goog.Promise.handleRejection_.call(null,b)},goog.Promise.UNHANDLED_REJECTION_DELAY):0==goog.Promise.UNHANDLED_REJECTION_DELAY&&(a.hadUnhandledRejection_=!0,goog.async.run(function(){a.hadUnhandledRejection_&&(a.appendLongStack_(b),goog.Promise.handleRejection_.call(null,b))}))};goog.Promise.handleRejection_=goog.async.throwException;
|
|
goog.Promise.setUnhandledRejectionHandler=function(a){goog.Promise.handleRejection_=a};goog.Promise.CancellationError=function(a){goog.debug.Error.call(this,a)};goog.inherits(goog.Promise.CancellationError,goog.debug.Error);goog.Promise.CancellationError.prototype.name="cancel";goog.Promise.Resolver_=function(a,b,c){this.promise=a;this.resolve=b;this.reject=c};goog.Timer=function(a,b){goog.events.EventTarget.call(this);this.interval_=a||1;this.timerObject_=b||goog.Timer.defaultTimerObject;this.boundTick_=goog.bind(this.tick_,this);this.last_=goog.now()};goog.inherits(goog.Timer,goog.events.EventTarget);goog.Timer.MAX_TIMEOUT_=2147483647;goog.Timer.INVALID_TIMEOUT_ID_=-1;goog.Timer.prototype.enabled=!1;goog.Timer.defaultTimerObject=goog.global;goog.Timer.intervalScale=.8;goog.Timer.prototype.timer_=null;goog.Timer.prototype.getInterval=function(){return this.interval_};
|
|
goog.Timer.prototype.setInterval=function(a){this.interval_=a;this.timer_&&this.enabled?(this.stop(),this.start()):this.timer_&&this.stop()};goog.Timer.prototype.tick_=function(){if(this.enabled){var a=goog.now()-this.last_;0<a&&a<this.interval_*goog.Timer.intervalScale?this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_-a):(this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null),this.dispatchTick(),this.enabled&&(this.stop(),this.start()))}};
|
|
goog.Timer.prototype.dispatchTick=function(){this.dispatchEvent(goog.Timer.TICK)};goog.Timer.prototype.start=function(){this.enabled=!0;this.timer_||(this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now())};goog.Timer.prototype.stop=function(){this.enabled=!1;this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null)};goog.Timer.prototype.disposeInternal=function(){goog.Timer.superClass_.disposeInternal.call(this);this.stop();delete this.timerObject_};
|
|
goog.Timer.TICK="tick";goog.Timer.callOnce=function(a,b,c){if(goog.isFunction(a))c&&(a=goog.bind(a,c));else if(a&&"function"==typeof a.handleEvent)a=goog.bind(a.handleEvent,a);else throw Error("Invalid listener argument");return Number(b)>goog.Timer.MAX_TIMEOUT_?goog.Timer.INVALID_TIMEOUT_ID_:goog.Timer.defaultTimerObject.setTimeout(a,b||0)};goog.Timer.clear=function(a){goog.Timer.defaultTimerObject.clearTimeout(a)};
|
|
goog.Timer.promise=function(a,b){var c=null;return(new goog.Promise(function(d,e){c=goog.Timer.callOnce(function(){d(b)},a);c==goog.Timer.INVALID_TIMEOUT_ID_&&e(Error("Failed to schedule timer."))})).thenCatch(function(a){goog.Timer.clear(c);throw a;})};goog.events.MouseWheelHandler=function(a,b){goog.events.EventTarget.call(this);this.element_=a;var c=goog.dom.isElement(this.element_)?this.element_:this.element_?this.element_.body:null;this.isRtl_=!!c&&goog.style.isRightToLeft(c);this.listenKey_=goog.events.listen(this.element_,goog.userAgent.GECKO?"DOMMouseScroll":"mousewheel",this,b)};goog.inherits(goog.events.MouseWheelHandler,goog.events.EventTarget);goog.events.MouseWheelHandler.EventType={MOUSEWHEEL:"mousewheel"};
|
|
goog.events.MouseWheelHandler.prototype.setMaxDeltaX=function(a){this.maxDeltaX_=a};goog.events.MouseWheelHandler.prototype.setMaxDeltaY=function(a){this.maxDeltaY_=a};
|
|
goog.events.MouseWheelHandler.prototype.handleEvent=function(a){var b=0,c=0,d=a.getBrowserEvent();"mousewheel"==d.type?(a=goog.events.MouseWheelHandler.smartScale_(-d.wheelDelta,40),void 0!==d.wheelDeltaX?(b=goog.events.MouseWheelHandler.smartScale_(-d.wheelDeltaX,40),c=goog.events.MouseWheelHandler.smartScale_(-d.wheelDeltaY,40)):c=a):(a=d.detail,100<a?a=3:-100>a&&(a=-3),void 0!==d.axis&&d.axis===d.HORIZONTAL_AXIS?b=a:c=a);"number"===typeof this.maxDeltaX_&&(b=goog.math.clamp(b,-this.maxDeltaX_,
|
|
this.maxDeltaX_));"number"===typeof this.maxDeltaY_&&(c=goog.math.clamp(c,-this.maxDeltaY_,this.maxDeltaY_));this.isRtl_&&(b=-b);b=new goog.events.MouseWheelEvent(a,d,b,c);this.dispatchEvent(b)};goog.events.MouseWheelHandler.smartScale_=function(a,b){return goog.userAgent.WEBKIT&&(goog.userAgent.MAC||goog.userAgent.LINUX)&&0!=a%b?a:a/b};
|
|
goog.events.MouseWheelHandler.prototype.disposeInternal=function(){goog.events.MouseWheelHandler.superClass_.disposeInternal.call(this);goog.events.unlistenByKey(this.listenKey_);this.listenKey_=null};goog.events.MouseWheelEvent=function(a,b,c,d){goog.events.BrowserEvent.call(this,b);this.type=goog.events.MouseWheelHandler.EventType.MOUSEWHEEL;this.detail=a;this.deltaX=c;this.deltaY=d};goog.inherits(goog.events.MouseWheelEvent,goog.events.BrowserEvent);goog.fx={};goog.fx.Transition=function(){};goog.fx.Transition.EventType={PLAY:"play",BEGIN:"begin",RESUME:"resume",END:"end",STOP:"stop",FINISH:"finish",PAUSE:"pause"};goog.fx.TransitionBase=function(){goog.events.EventTarget.call(this);this.state_=goog.fx.TransitionBase.State.STOPPED;this.endTime=this.startTime=null};goog.inherits(goog.fx.TransitionBase,goog.events.EventTarget);goog.fx.TransitionBase.State={STOPPED:0,PAUSED:-1,PLAYING:1};goog.fx.TransitionBase.prototype.play=goog.abstractMethod;goog.fx.TransitionBase.prototype.stop=goog.abstractMethod;goog.fx.TransitionBase.prototype.pause=goog.abstractMethod;goog.fx.TransitionBase.prototype.getStateInternal=function(){return this.state_};
|
|
goog.fx.TransitionBase.prototype.setStatePlaying=function(){this.state_=goog.fx.TransitionBase.State.PLAYING};goog.fx.TransitionBase.prototype.setStatePaused=function(){this.state_=goog.fx.TransitionBase.State.PAUSED};goog.fx.TransitionBase.prototype.setStateStopped=function(){this.state_=goog.fx.TransitionBase.State.STOPPED};goog.fx.TransitionBase.prototype.isPlaying=function(){return this.state_==goog.fx.TransitionBase.State.PLAYING};
|
|
goog.fx.TransitionBase.prototype.isPaused=function(){return this.state_==goog.fx.TransitionBase.State.PAUSED};goog.fx.TransitionBase.prototype.isStopped=function(){return this.state_==goog.fx.TransitionBase.State.STOPPED};goog.fx.TransitionBase.prototype.onBegin=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.BEGIN)};goog.fx.TransitionBase.prototype.onEnd=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.END)};goog.fx.TransitionBase.prototype.onFinish=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.FINISH)};
|
|
goog.fx.TransitionBase.prototype.onPause=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.PAUSE)};goog.fx.TransitionBase.prototype.onPlay=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.PLAY)};goog.fx.TransitionBase.prototype.onResume=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.RESUME)};goog.fx.TransitionBase.prototype.onStop=function(){this.dispatchAnimationEvent(goog.fx.Transition.EventType.STOP)};
|
|
goog.fx.TransitionBase.prototype.dispatchAnimationEvent=function(a){this.dispatchEvent(a)};goog.async.AnimationDelay=function(a,b,c){goog.Disposable.call(this);this.id_=null;this.usingListeners_=!1;this.listener_=a;this.handler_=c;this.win_=b||window;this.callback_=goog.bind(this.doAction_,this)};goog.inherits(goog.async.AnimationDelay,goog.Disposable);goog.async.AnimationDelay.TIMEOUT=20;goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_="MozBeforePaint";
|
|
goog.async.AnimationDelay.prototype.start=function(){this.stop();this.usingListeners_=!1;var a=this.getRaf_(),b=this.getCancelRaf_();a&&!b&&this.win_.mozRequestAnimationFrame?(this.id_=goog.events.listen(this.win_,goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_,this.callback_),this.win_.mozRequestAnimationFrame(null),this.usingListeners_=!0):this.id_=a&&b?a.call(this.win_,this.callback_):this.win_.setTimeout(goog.functions.lock(this.callback_),goog.async.AnimationDelay.TIMEOUT)};
|
|
goog.async.AnimationDelay.prototype.startIfNotActive=function(){this.isActive()||this.start()};goog.async.AnimationDelay.prototype.stop=function(){if(this.isActive()){var a=this.getRaf_(),b=this.getCancelRaf_();a&&!b&&this.win_.mozRequestAnimationFrame?goog.events.unlistenByKey(this.id_):a&&b?b.call(this.win_,this.id_):this.win_.clearTimeout(this.id_)}this.id_=null};goog.async.AnimationDelay.prototype.fire=function(){this.stop();this.doAction_()};
|
|
goog.async.AnimationDelay.prototype.fireIfActive=function(){this.isActive()&&this.fire()};goog.async.AnimationDelay.prototype.isActive=function(){return null!=this.id_};goog.async.AnimationDelay.prototype.doAction_=function(){this.usingListeners_&&this.id_&&goog.events.unlistenByKey(this.id_);this.id_=null;this.listener_.call(this.handler_,goog.now())};goog.async.AnimationDelay.prototype.disposeInternal=function(){this.stop();goog.async.AnimationDelay.superClass_.disposeInternal.call(this)};
|
|
goog.async.AnimationDelay.prototype.getRaf_=function(){var a=this.win_;return a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||null};goog.async.AnimationDelay.prototype.getCancelRaf_=function(){var a=this.win_;return a.cancelAnimationFrame||a.cancelRequestAnimationFrame||a.webkitCancelRequestAnimationFrame||a.mozCancelRequestAnimationFrame||a.oCancelRequestAnimationFrame||a.msCancelRequestAnimationFrame||null};goog.async.Delay=function(a,b,c){goog.Disposable.call(this);this.listener_=a;this.interval_=b||0;this.handler_=c;this.callback_=goog.bind(this.doAction_,this)};goog.inherits(goog.async.Delay,goog.Disposable);goog.Delay=goog.async.Delay;goog.async.Delay.prototype.id_=0;goog.async.Delay.prototype.disposeInternal=function(){goog.async.Delay.superClass_.disposeInternal.call(this);this.stop();delete this.listener_;delete this.handler_};
|
|
goog.async.Delay.prototype.start=function(a){this.stop();this.id_=goog.Timer.callOnce(this.callback_,void 0!==a?a:this.interval_)};goog.async.Delay.prototype.startIfNotActive=function(a){this.isActive()||this.start(a)};goog.async.Delay.prototype.stop=function(){this.isActive()&&goog.Timer.clear(this.id_);this.id_=0};goog.async.Delay.prototype.fire=function(){this.stop();this.doAction_()};goog.async.Delay.prototype.fireIfActive=function(){this.isActive()&&this.fire()};
|
|
goog.async.Delay.prototype.isActive=function(){return 0!=this.id_};goog.async.Delay.prototype.doAction_=function(){this.id_=0;this.listener_&&this.listener_.call(this.handler_)};goog.fx.anim={};goog.fx.anim.Animated=function(){};goog.fx.anim.TIMEOUT=goog.async.AnimationDelay.TIMEOUT;goog.fx.anim.activeAnimations_={};goog.fx.anim.animationWindow_=null;goog.fx.anim.animationDelay_=null;goog.fx.anim.registerAnimation=function(a){var b=goog.getUid(a);b in goog.fx.anim.activeAnimations_||(goog.fx.anim.activeAnimations_[b]=a);goog.fx.anim.requestAnimationFrame_()};
|
|
goog.fx.anim.unregisterAnimation=function(a){a=goog.getUid(a);delete goog.fx.anim.activeAnimations_[a];goog.object.isEmpty(goog.fx.anim.activeAnimations_)&&goog.fx.anim.cancelAnimationFrame_()};goog.fx.anim.tearDown=function(){goog.fx.anim.animationWindow_=null;goog.dispose(goog.fx.anim.animationDelay_);goog.fx.anim.animationDelay_=null;goog.fx.anim.activeAnimations_={}};
|
|
goog.fx.anim.setAnimationWindow=function(a){var b=goog.fx.anim.animationDelay_&&goog.fx.anim.animationDelay_.isActive();goog.dispose(goog.fx.anim.animationDelay_);goog.fx.anim.animationDelay_=null;goog.fx.anim.animationWindow_=a;b&&goog.fx.anim.requestAnimationFrame_()};
|
|
goog.fx.anim.requestAnimationFrame_=function(){goog.fx.anim.animationDelay_||(goog.fx.anim.animationDelay_=goog.fx.anim.animationWindow_?new goog.async.AnimationDelay(function(a){goog.fx.anim.cycleAnimations_(a)},goog.fx.anim.animationWindow_):new goog.async.Delay(function(){goog.fx.anim.cycleAnimations_(goog.now())},goog.fx.anim.TIMEOUT));var a=goog.fx.anim.animationDelay_;a.isActive()||a.start()};goog.fx.anim.cancelAnimationFrame_=function(){goog.fx.anim.animationDelay_&&goog.fx.anim.animationDelay_.stop()};
|
|
goog.fx.anim.cycleAnimations_=function(a){goog.object.forEach(goog.fx.anim.activeAnimations_,function(b){b.onAnimationFrame(a)});goog.object.isEmpty(goog.fx.anim.activeAnimations_)||goog.fx.anim.requestAnimationFrame_()};goog.fx.Animation=function(a,b,c,d){goog.fx.TransitionBase.call(this);if(!goog.isArray(a)||!goog.isArray(b))throw Error("Start and end parameters must be arrays");if(a.length!=b.length)throw Error("Start and end points must be the same length");this.startPoint=a;this.endPoint=b;this.duration=c;this.accel_=d;this.coords=[];this.useRightPositioningForRtl_=!1;this.progress=this.fps_=0;this.lastFrame=null};goog.inherits(goog.fx.Animation,goog.fx.TransitionBase);
|
|
goog.fx.Animation.prototype.getDuration=function(){return this.duration};goog.fx.Animation.prototype.enableRightPositioningForRtl=function(a){this.useRightPositioningForRtl_=a};goog.fx.Animation.prototype.isRightPositioningForRtlEnabled=function(){return this.useRightPositioningForRtl_};
|
|
goog.fx.Animation.EventType={PLAY:goog.fx.Transition.EventType.PLAY,BEGIN:goog.fx.Transition.EventType.BEGIN,RESUME:goog.fx.Transition.EventType.RESUME,END:goog.fx.Transition.EventType.END,STOP:goog.fx.Transition.EventType.STOP,FINISH:goog.fx.Transition.EventType.FINISH,PAUSE:goog.fx.Transition.EventType.PAUSE,ANIMATE:"animate",DESTROY:"destroy"};goog.fx.Animation.TIMEOUT=goog.fx.anim.TIMEOUT;goog.fx.Animation.State=goog.fx.TransitionBase.State;goog.fx.Animation.setAnimationWindow=function(a){goog.fx.anim.setAnimationWindow(a)};
|
|
goog.fx.Animation.prototype.play=function(a){if(a||this.isStopped())this.progress=0,this.coords=this.startPoint;else if(this.isPlaying())return!1;goog.fx.anim.unregisterAnimation(this);this.startTime=a=goog.now();this.isPaused()&&(this.startTime-=this.duration*this.progress);this.endTime=this.startTime+this.duration;this.lastFrame=this.startTime;if(!this.progress)this.onBegin();this.onPlay();if(this.isPaused())this.onResume();this.setStatePlaying();goog.fx.anim.registerAnimation(this);this.cycle(a);
|
|
return!0};goog.fx.Animation.prototype.stop=function(a){goog.fx.anim.unregisterAnimation(this);this.setStateStopped();a&&(this.progress=1);this.updateCoords_(this.progress);this.onStop();this.onEnd()};goog.fx.Animation.prototype.pause=function(){this.isPlaying()&&(goog.fx.anim.unregisterAnimation(this),this.setStatePaused(),this.onPause())};goog.fx.Animation.prototype.getProgress=function(){return this.progress};
|
|
goog.fx.Animation.prototype.setProgress=function(a){this.progress=a;this.isPlaying()&&(this.startTime=goog.now()-this.duration*this.progress,this.endTime=this.startTime+this.duration)};goog.fx.Animation.prototype.disposeInternal=function(){this.isStopped()||this.stop(!1);this.onDestroy();goog.fx.Animation.superClass_.disposeInternal.call(this)};goog.fx.Animation.prototype.destroy=function(){this.dispose()};goog.fx.Animation.prototype.onAnimationFrame=function(a){this.cycle(a)};
|
|
goog.fx.Animation.prototype.cycle=function(a){goog.asserts.assertNumber(this.startTime);goog.asserts.assertNumber(this.endTime);goog.asserts.assertNumber(this.lastFrame);a<this.startTime&&(this.endTime=a+this.endTime-this.startTime,this.startTime=a);this.progress=(a-this.startTime)/(this.endTime-this.startTime);1<this.progress&&(this.progress=1);this.fps_=1E3/(a-this.lastFrame);this.lastFrame=a;this.updateCoords_(this.progress);if(1==this.progress)this.setStateStopped(),goog.fx.anim.unregisterAnimation(this),
|
|
this.onFinish(),this.onEnd();else if(this.isPlaying())this.onAnimate()};goog.fx.Animation.prototype.updateCoords_=function(a){goog.isFunction(this.accel_)&&(a=this.accel_(a));this.coords=Array(this.startPoint.length);for(var b=0;b<this.startPoint.length;b++)this.coords[b]=(this.endPoint[b]-this.startPoint[b])*a+this.startPoint[b]};goog.fx.Animation.prototype.onAnimate=function(){this.dispatchAnimationEvent(goog.fx.Animation.EventType.ANIMATE)};goog.fx.Animation.prototype.onDestroy=function(){this.dispatchAnimationEvent(goog.fx.Animation.EventType.DESTROY)};
|
|
goog.fx.Animation.prototype.dispatchAnimationEvent=function(a){this.dispatchEvent(new goog.fx.AnimationEvent(a,this))};goog.fx.AnimationEvent=function(a,b){goog.events.Event.call(this,a);this.coords=b.coords;this.x=b.coords[0];this.y=b.coords[1];this.z=b.coords[2];this.duration=b.duration;this.progress=b.getProgress();this.fps=b.fps_;this.state=b.getStateInternal();this.anim=b};goog.inherits(goog.fx.AnimationEvent,goog.events.Event);
|
|
goog.fx.AnimationEvent.prototype.coordsAsInts=function(){return goog.array.map(this.coords,Math.round)};goog.fx.AnimationQueue=function(){goog.fx.TransitionBase.call(this);this.queue=[]};goog.inherits(goog.fx.AnimationQueue,goog.fx.TransitionBase);goog.fx.AnimationQueue.prototype.add=function(a){goog.asserts.assert(this.isStopped(),"Not allowed to add animations to a running animation queue.");goog.array.contains(this.queue,a)||(this.queue.push(a),goog.events.listen(a,goog.fx.Transition.EventType.FINISH,this.onAnimationFinish,!1,this))};
|
|
goog.fx.AnimationQueue.prototype.remove=function(a){goog.asserts.assert(this.isStopped(),"Not allowed to remove animations from a running animation queue.");goog.array.remove(this.queue,a)&&goog.events.unlisten(a,goog.fx.Transition.EventType.FINISH,this.onAnimationFinish,!1,this)};goog.fx.AnimationQueue.prototype.onAnimationFinish=goog.abstractMethod;goog.fx.AnimationQueue.prototype.disposeInternal=function(){goog.array.forEach(this.queue,function(a){a.dispose()});this.queue.length=0;goog.fx.AnimationQueue.superClass_.disposeInternal.call(this)};
|
|
goog.fx.AnimationParallelQueue=function(){goog.fx.AnimationQueue.call(this);this.finishedCounter_=0};goog.inherits(goog.fx.AnimationParallelQueue,goog.fx.AnimationQueue);
|
|
goog.fx.AnimationParallelQueue.prototype.play=function(a){if(0==this.queue.length)return!1;if(a||this.isStopped())this.finishedCounter_=0,this.onBegin();else if(this.isPlaying())return!1;this.onPlay();if(this.isPaused())this.onResume();var b=this.isPaused()&&!a;this.startTime=goog.now();this.endTime=null;this.setStatePlaying();goog.array.forEach(this.queue,function(c){b&&!c.isPaused()||c.play(a)});return!0};
|
|
goog.fx.AnimationParallelQueue.prototype.pause=function(){this.isPlaying()&&(goog.array.forEach(this.queue,function(a){a.isPlaying()&&a.pause()}),this.setStatePaused(),this.onPause())};goog.fx.AnimationParallelQueue.prototype.stop=function(a){goog.array.forEach(this.queue,function(b){b.isStopped()||b.stop(a)});this.setStateStopped();this.endTime=goog.now();this.onStop();this.onEnd()};
|
|
goog.fx.AnimationParallelQueue.prototype.onAnimationFinish=function(a){this.finishedCounter_++;this.finishedCounter_==this.queue.length&&(this.endTime=goog.now(),this.setStateStopped(),this.onFinish(),this.onEnd())};goog.fx.AnimationSerialQueue=function(){goog.fx.AnimationQueue.call(this);this.current_=0};goog.inherits(goog.fx.AnimationSerialQueue,goog.fx.AnimationQueue);
|
|
goog.fx.AnimationSerialQueue.prototype.play=function(a){if(0==this.queue.length)return!1;if(a||this.isStopped())this.current_<this.queue.length&&!this.queue[this.current_].isStopped()&&this.queue[this.current_].stop(!1),this.current_=0,this.onBegin();else if(this.isPlaying())return!1;this.onPlay();if(this.isPaused())this.onResume();this.startTime=goog.now();this.endTime=null;this.setStatePlaying();this.queue[this.current_].play(a);return!0};
|
|
goog.fx.AnimationSerialQueue.prototype.pause=function(){this.isPlaying()&&(this.queue[this.current_].pause(),this.setStatePaused(),this.onPause())};goog.fx.AnimationSerialQueue.prototype.stop=function(a){this.setStateStopped();this.endTime=goog.now();if(a)for(a=this.current_;a<this.queue.length;++a){var b=this.queue[a];b.isStopped()&&b.play();b.isStopped()||b.stop(!0)}else this.current_<this.queue.length&&this.queue[this.current_].stop(!1);this.onStop();this.onEnd()};
|
|
goog.fx.AnimationSerialQueue.prototype.onAnimationFinish=function(a){this.isPlaying()&&(this.current_++,this.current_<this.queue.length?this.queue[this.current_].play():(this.endTime=goog.now(),this.setStateStopped(),this.onFinish(),this.onEnd()))};goog.userAgent.platform={};
|
|
goog.userAgent.platform.determineVersion_=function(){if(goog.userAgent.WINDOWS){var a=/Windows NT ([0-9.]+)/;return(a=a.exec(goog.userAgent.getUserAgentString()))?a[1]:"0"}return goog.userAgent.MAC?(a=/10[_.][0-9_.]+/,(a=a.exec(goog.userAgent.getUserAgentString()))?a[0].replace(/_/g,"."):"10"):goog.userAgent.ANDROID?(a=/Android\s+([^\);]+)(\)|;)/,(a=a.exec(goog.userAgent.getUserAgentString()))?a[1]:""):goog.userAgent.IPHONE||goog.userAgent.IPAD||goog.userAgent.IPOD?(a=/(?:iPhone|CPU)\s+OS\s+(\S+)/,(a=
|
|
a.exec(goog.userAgent.getUserAgentString()))?a[1].replace(/_/g,"."):""):""};goog.userAgent.platform.VERSION=goog.userAgent.platform.determineVersion_();goog.userAgent.platform.isVersion=function(a){return 0<=goog.string.compareVersions(goog.userAgent.platform.VERSION,a)};goog.userAgent.product={};goog.userAgent.product.ASSUME_FIREFOX=!1;goog.userAgent.product.ASSUME_IPHONE=!1;goog.userAgent.product.ASSUME_IPAD=!1;goog.userAgent.product.ASSUME_ANDROID=!1;goog.userAgent.product.ASSUME_CHROME=!1;goog.userAgent.product.ASSUME_SAFARI=!1;
|
|
goog.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;goog.userAgent.product.OPERA=goog.userAgent.OPERA;goog.userAgent.product.IE=goog.userAgent.IE;goog.userAgent.product.EDGE=goog.userAgent.EDGE;
|
|
goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox();goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()};goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_();
|
|
goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad();goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser();goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome();
|
|
goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()};goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_();goog.userAgent.product.determineVersion_=function(){if(goog.userAgent.product.FIREFOX)return goog.userAgent.product.getFirstRegExpGroup_(/Firefox\/([0-9.]+)/);if(goog.userAgent.product.IE||goog.userAgent.product.EDGE||goog.userAgent.product.OPERA)return goog.userAgent.VERSION;if(goog.userAgent.product.CHROME)return goog.labs.userAgent.platform.isIos()?goog.userAgent.product.getFirstRegExpGroup_(/CriOS\/([0-9.]+)/):goog.userAgent.product.getFirstRegExpGroup_(/Chrome\/([0-9.]+)/);if(goog.userAgent.product.SAFARI&&
|
|
!goog.labs.userAgent.platform.isIos())return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);if(goog.userAgent.product.IPHONE||goog.userAgent.product.IPAD){var a=goog.userAgent.product.execRegExp_(/Version\/(\S+).*Mobile\/(\S+)/);if(a)return a[1]+"."+a[2]}else if(goog.userAgent.product.ANDROID)return(a=goog.userAgent.product.getFirstRegExpGroup_(/Android\s+([0-9.]+)/))?a:goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);return""};
|
|
goog.userAgent.product.getFirstRegExpGroup_=function(a){return(a=goog.userAgent.product.execRegExp_(a))?a[1]:""};goog.userAgent.product.execRegExp_=function(a){return a.exec(goog.userAgent.getUserAgentString())};goog.userAgent.product.VERSION=goog.userAgent.product.determineVersion_();goog.userAgent.product.isVersion=function(a){return 0<=goog.string.compareVersions(goog.userAgent.product.VERSION,a)};goog.style.bidi={};goog.style.bidi.getScrollLeft=function(a){var b=goog.style.isRightToLeft(a);return b&&goog.style.bidi.usesNegativeScrollLeftInRtl_()?-a.scrollLeft:!b||goog.userAgent.EDGE_OR_IE&&goog.userAgent.isVersionOrHigher("8")||"visible"==goog.style.getComputedOverflowX(a)?a.scrollLeft:a.scrollWidth-a.clientWidth-a.scrollLeft};
|
|
goog.style.bidi.getOffsetStart=function(a){var b=a.offsetLeft,c=a.offsetParent;c||"fixed"!=goog.style.getComputedPosition(a)||(c=goog.dom.getOwnerDocument(a).documentElement);if(!c)return b;if(goog.userAgent.GECKO&&!goog.userAgent.isVersionOrHigher(58)){var d=goog.style.getBorderBox(c);b+=d.left}else goog.userAgent.isDocumentModeOrHigher(8)&&!goog.userAgent.isDocumentModeOrHigher(9)&&(d=goog.style.getBorderBox(c),b-=d.left);return goog.style.isRightToLeft(c)?c.clientWidth-(b+a.offsetWidth):b};
|
|
goog.style.bidi.setScrollOffset=function(a,b){b=Math.max(b,0);goog.style.isRightToLeft(a)?goog.style.bidi.usesNegativeScrollLeftInRtl_()?a.scrollLeft=-b:goog.userAgent.EDGE_OR_IE&&goog.userAgent.isVersionOrHigher("8")?a.scrollLeft=b:a.scrollLeft=a.scrollWidth-b-a.clientWidth:a.scrollLeft=b};
|
|
goog.style.bidi.usesNegativeScrollLeftInRtl_=function(){var a=goog.userAgent.product.SAFARI&&goog.userAgent.product.isVersion(10),b=goog.userAgent.IOS&&goog.userAgent.platform.isVersion(10);return goog.userAgent.GECKO||a||b};goog.style.bidi.setPosition=function(a,b,c,d){null!==c&&(a.style.top=c+"px");d?(a.style.right=b+"px",a.style.left=""):(a.style.left=b+"px",a.style.right="")};goog.fx.Dragger=function(a,b,c){goog.events.EventTarget.call(this);this.target=a;this.handle=b||a;this.limits=c||new goog.math.Rect(NaN,NaN,NaN,NaN);this.document_=goog.dom.getOwnerDocument(a);this.eventHandler_=new goog.events.EventHandler(this);this.registerDisposable(this.eventHandler_);this.deltaY=this.deltaX=this.startY=this.startX=this.screenY=this.screenX=this.clientY=this.clientX=0;this.enabled_=!0;this.dragging_=!1;this.preventMouseDown_=!0;this.hysteresisDistanceSquared_=0;this.useRightPositioningForRtl_=
|
|
this.ieDragStartCancellingOn_=!1;goog.events.listen(this.handle,[goog.events.EventType.TOUCHSTART,goog.events.EventType.MOUSEDOWN],this.startDrag,!1,this);this.useSetCapture_=goog.fx.Dragger.HAS_SET_CAPTURE_};goog.inherits(goog.fx.Dragger,goog.events.EventTarget);goog.tagUnsealableClass(goog.fx.Dragger);goog.fx.Dragger.HAS_SET_CAPTURE_=goog.global.document&&goog.global.document.documentElement&&!!goog.global.document.documentElement.setCapture&&!!goog.global.document.releaseCapture;
|
|
goog.fx.Dragger.cloneNode=function(a){for(var b=a.cloneNode(!0),c=goog.dom.getElementsByTagName("TEXTAREA",a),d=goog.dom.getElementsByTagName("TEXTAREA",b),e=0;e<c.length;e++)d[e].value=c[e].value;switch(a.tagName){case "TR":return goog.dom.createDom("TABLE",null,goog.dom.createDom("TBODY",null,b));case "TD":case "TH":return goog.dom.createDom("TABLE",null,goog.dom.createDom("TBODY",null,goog.dom.createDom("TR",null,b)));case "TEXTAREA":b.value=a.value;default:return b}};
|
|
goog.fx.Dragger.EventType={EARLY_CANCEL:"earlycancel",START:"start",BEFOREDRAG:"beforedrag",DRAG:"drag",END:"end"};goog.fx.Dragger.prototype.setAllowSetCapture=function(a){this.useSetCapture_=a&&goog.fx.Dragger.HAS_SET_CAPTURE_};goog.fx.Dragger.prototype.enableRightPositioningForRtl=function(a){this.useRightPositioningForRtl_=a};goog.fx.Dragger.prototype.getHandler=function(){return this.eventHandler_};goog.fx.Dragger.prototype.setLimits=function(a){this.limits=a||new goog.math.Rect(NaN,NaN,NaN,NaN)};
|
|
goog.fx.Dragger.prototype.setHysteresis=function(a){this.hysteresisDistanceSquared_=Math.pow(a,2)};goog.fx.Dragger.prototype.getHysteresis=function(){return Math.sqrt(this.hysteresisDistanceSquared_)};goog.fx.Dragger.prototype.setScrollTarget=function(a){this.scrollTarget_=a};goog.fx.Dragger.prototype.setCancelIeDragStart=function(a){this.ieDragStartCancellingOn_=a};goog.fx.Dragger.prototype.getEnabled=function(){return this.enabled_};
|
|
goog.fx.Dragger.prototype.setEnabled=function(a){this.enabled_=a};goog.fx.Dragger.prototype.setPreventMouseDown=function(a){this.preventMouseDown_=a};goog.fx.Dragger.prototype.disposeInternal=function(){goog.fx.Dragger.superClass_.disposeInternal.call(this);goog.events.unlisten(this.handle,[goog.events.EventType.TOUCHSTART,goog.events.EventType.MOUSEDOWN],this.startDrag,!1,this);this.cleanUpAfterDragging_();this.handle=this.target=null};
|
|
goog.fx.Dragger.prototype.isRightToLeft_=function(){void 0===this.rightToLeft_&&(this.rightToLeft_=goog.style.isRightToLeft(this.target));return this.rightToLeft_};
|
|
goog.fx.Dragger.prototype.startDrag=function(a){var b=a.type==goog.events.EventType.MOUSEDOWN;if(!this.enabled_||this.dragging_||b&&!a.isMouseActionButton())this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL);else{if(0==this.hysteresisDistanceSquared_)if(this.fireDragStart_(a))this.dragging_=!0,this.preventMouseDown_&&b&&a.preventDefault();else return;else this.preventMouseDown_&&b&&a.preventDefault();this.setupDragHandlers();this.clientX=this.startX=a.clientX;this.clientY=this.startY=a.clientY;
|
|
this.screenX=a.screenX;this.screenY=a.screenY;this.computeInitialPosition();this.pageScroll=goog.dom.getDomHelper(this.document_).getDocumentScroll()}};
|
|
goog.fx.Dragger.prototype.setupDragHandlers=function(){var a=this.document_,b=a.documentElement,c=!this.useSetCapture_;this.eventHandler_.listen(a,[goog.events.EventType.TOUCHMOVE,goog.events.EventType.MOUSEMOVE],this.handleMove_,{capture:c,passive:!1});this.eventHandler_.listen(a,[goog.events.EventType.TOUCHEND,goog.events.EventType.MOUSEUP],this.endDrag,c);this.useSetCapture_?(b.setCapture(!1),this.eventHandler_.listen(b,goog.events.EventType.LOSECAPTURE,this.endDrag)):this.eventHandler_.listen(goog.dom.getWindow(a),
|
|
goog.events.EventType.BLUR,this.endDrag);goog.userAgent.IE&&this.ieDragStartCancellingOn_&&this.eventHandler_.listen(a,goog.events.EventType.DRAGSTART,goog.events.Event.preventDefault);this.scrollTarget_&&this.eventHandler_.listen(this.scrollTarget_,goog.events.EventType.SCROLL,this.onScroll_,c)};goog.fx.Dragger.prototype.fireDragStart_=function(a){return this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.START,this,a.clientX,a.clientY,a))};
|
|
goog.fx.Dragger.prototype.cleanUpAfterDragging_=function(){this.eventHandler_.removeAll();this.useSetCapture_&&this.document_.releaseCapture()};goog.fx.Dragger.prototype.endDrag=function(a,b){this.cleanUpAfterDragging_();if(this.dragging_){this.dragging_=!1;var c=this.limitX(this.deltaX),d=this.limitY(this.deltaY);this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.END,this,a.clientX,a.clientY,a,c,d,b||a.type==goog.events.EventType.TOUCHCANCEL))}else this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL)};
|
|
goog.fx.Dragger.prototype.endDragCancel=function(a){this.endDrag(a,!0)};
|
|
goog.fx.Dragger.prototype.handleMove_=function(a){if(this.enabled_){var b=(this.useRightPositioningForRtl_&&this.isRightToLeft_()?-1:1)*(a.clientX-this.clientX),c=a.clientY-this.clientY;this.clientX=a.clientX;this.clientY=a.clientY;this.screenX=a.screenX;this.screenY=a.screenY;if(!this.dragging_){var d=this.startX-this.clientX,e=this.startY-this.clientY;if(d*d+e*e>this.hysteresisDistanceSquared_)if(this.fireDragStart_(a))this.dragging_=!0;else{this.isDisposed()||this.endDrag(a);return}}c=this.calculatePosition_(b,
|
|
c);b=c.x;c=c.y;this.dragging_&&this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.BEFOREDRAG,this,a.clientX,a.clientY,a,b,c))&&(this.doDrag(a,b,c,!1),a.preventDefault())}};
|
|
goog.fx.Dragger.prototype.calculatePosition_=function(a,b){var c=goog.dom.getDomHelper(this.document_).getDocumentScroll();a+=c.x-this.pageScroll.x;b+=c.y-this.pageScroll.y;this.pageScroll=c;this.deltaX+=a;this.deltaY+=b;c=this.limitX(this.deltaX);var d=this.limitY(this.deltaY);return new goog.math.Coordinate(c,d)};goog.fx.Dragger.prototype.onScroll_=function(a){var b=this.calculatePosition_(0,0);a.clientX=this.clientX;a.clientY=this.clientY;this.doDrag(a,b.x,b.y,!0)};
|
|
goog.fx.Dragger.prototype.doDrag=function(a,b,c,d){this.defaultAction(b,c);this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.DRAG,this,a.clientX,a.clientY,a,b,c))};goog.fx.Dragger.prototype.limitX=function(a){var b=this.limits,c=isNaN(b.left)?null:b.left;b=isNaN(b.width)?0:b.width;return Math.min(null!=c?c+b:Infinity,Math.max(null!=c?c:-Infinity,a))};
|
|
goog.fx.Dragger.prototype.limitY=function(a){var b=this.limits,c=isNaN(b.top)?null:b.top;b=isNaN(b.height)?0:b.height;return Math.min(null!=c?c+b:Infinity,Math.max(null!=c?c:-Infinity,a))};goog.fx.Dragger.prototype.computeInitialPosition=function(){this.deltaX=this.useRightPositioningForRtl_?goog.style.bidi.getOffsetStart(this.target):this.target.offsetLeft;this.deltaY=this.target.offsetTop};
|
|
goog.fx.Dragger.prototype.defaultAction=function(a,b){this.useRightPositioningForRtl_&&this.isRightToLeft_()?this.target.style.right=a+"px":this.target.style.left=a+"px";this.target.style.top=b+"px"};goog.fx.Dragger.prototype.isDragging=function(){return this.dragging_};goog.fx.DragEvent=function(a,b,c,d,e,f,g,h){goog.events.Event.call(this,a);this.clientX=c;this.clientY=d;this.browserEvent=e;this.left=void 0!==f?f:b.deltaX;this.top=void 0!==g?g:b.deltaY;this.dragger=b;this.dragCanceled=!!h};
|
|
goog.inherits(goog.fx.DragEvent,goog.events.Event);goog.color={};
|
|
goog.color.names={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",
|
|
darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",
|
|
ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",
|
|
lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",
|
|
moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",
|
|
seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};goog.color.parse=function(a){var b={};a=String(a);var c=goog.color.prependHashIfNecessaryHelper(a);if(goog.color.isValidHexColor_(c))return b.hex=goog.color.normalizeHex(c),b.type="hex",b;c=goog.color.isValidRgbColor_(a);if(c.length)return b.hex=goog.color.rgbArrayToHex(c),b.type="rgb",b;if(goog.color.names&&(c=goog.color.names[a.toLowerCase()]))return b.hex=c,b.type="named",b;throw Error(a+" is not a valid color string");};
|
|
goog.color.isValidColor=function(a){var b=goog.color.prependHashIfNecessaryHelper(a);return!!(goog.color.isValidHexColor_(b)||goog.color.isValidRgbColor_(a).length||goog.color.names&&goog.color.names[a.toLowerCase()])};goog.color.parseRgb=function(a){var b=goog.color.isValidRgbColor_(a);if(!b.length)throw Error(a+" is not a valid RGB color");return b};goog.color.hexToRgbStyle=function(a){return goog.color.rgbStyle_(goog.color.hexToRgb(a))};goog.color.hexTripletRe_=/#(.)(.)(.)/;
|
|
goog.color.normalizeHex=function(a){if(!goog.color.isValidHexColor_(a))throw Error("'"+a+"' is not a valid hex color");4==a.length&&(a=a.replace(goog.color.hexTripletRe_,"#$1$1$2$2$3$3"));return a.toLowerCase()};goog.color.hexToRgb=function(a){a=goog.color.normalizeHex(a);a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]};
|
|
goog.color.rgbToHex=function(a,b,c){a=Number(a);b=Number(b);c=Number(c);if(a!=(a&255)||b!=(b&255)||c!=(c&255))throw Error('"('+a+","+b+","+c+'") is not a valid RGB color');b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};goog.color.rgbArrayToHex=function(a){return goog.color.rgbToHex(a[0],a[1],a[2])};
|
|
goog.color.rgbToHsl=function(a,b,c){a/=255;b/=255;c/=255;var d=Math.max(a,b,c),e=Math.min(a,b,c),f=0,g=0,h=.5*(d+e);d!=e&&(d==a?f=60*(b-c)/(d-e):d==b?f=60*(c-a)/(d-e)+120:d==c&&(f=60*(a-b)/(d-e)+240),g=0<h&&.5>=h?(d-e)/(2*h):(d-e)/(2-2*h));return[Math.round(f+360)%360,g,h]};goog.color.rgbArrayToHsl=function(a){return goog.color.rgbToHsl(a[0],a[1],a[2])};goog.color.hueToRgb_=function(a,b,c){0>c?c+=1:1<c&&--c;return 1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+(b-a)*(2/3-c)*6:a};
|
|
goog.color.hslToRgb=function(a,b,c){a/=360;if(0==b)c=b=a=255*c;else{var d=.5>c?c*(1+b):c+b-b*c;var e=2*c-d;c=255*goog.color.hueToRgb_(e,d,a+1/3);b=255*goog.color.hueToRgb_(e,d,a);a=255*goog.color.hueToRgb_(e,d,a-1/3)}return[Math.round(c),Math.round(b),Math.round(a)]};goog.color.hslArrayToRgb=function(a){return goog.color.hslToRgb(a[0],a[1],a[2])};goog.color.validHexColorRe_=/^#(?:[0-9a-f]{3}){1,2}$/i;goog.color.isValidHexColor_=function(a){return goog.color.validHexColorRe_.test(a)};
|
|
goog.color.rgbColorRe_=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;goog.color.isValidRgbColor_=function(a){var b=a.match(goog.color.rgbColorRe_);if(b){a=Number(b[1]);var c=Number(b[2]);b=Number(b[3]);if(0<=a&&255>=a&&0<=c&&255>=c&&0<=b&&255>=b)return[a,c,b]}return[]};goog.color.prependZeroIfNecessaryHelper=function(a){return 1==a.length?"0"+a:a};goog.color.prependHashIfNecessaryHelper=function(a){return"#"==a.charAt(0)?a:"#"+a};
|
|
goog.color.rgbStyle_=function(a){return"rgb("+a.join(",")+")"};goog.color.hsvToRgb=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return[Math.round(d),Math.round(e),Math.round(f)]};
|
|
goog.color.rgbToHsv=function(a,b,c){var d=Math.max(Math.max(a,b),c),e=Math.min(Math.min(a,b),c);if(e==d)e=a=0;else{var f=d-e;e=f/d;a=60*(a==d?(b-c)/f:b==d?2+(c-a)/f:4+(a-b)/f);0>a&&(a+=360);360<a&&(a-=360)}return[a,e,d]};goog.color.rgbArrayToHsv=function(a){return goog.color.rgbToHsv(a[0],a[1],a[2])};goog.color.hsvArrayToRgb=function(a){return goog.color.hsvToRgb(a[0],a[1],a[2])};goog.color.hexToHsl=function(a){a=goog.color.hexToRgb(a);return goog.color.rgbToHsl(a[0],a[1],a[2])};
|
|
goog.color.hslToHex=function(a,b,c){return goog.color.rgbArrayToHex(goog.color.hslToRgb(a,b,c))};goog.color.hslArrayToHex=function(a){return goog.color.rgbArrayToHex(goog.color.hslToRgb(a[0],a[1],a[2]))};goog.color.hexToHsv=function(a){return goog.color.rgbArrayToHsv(goog.color.hexToRgb(a))};goog.color.hsvToHex=function(a,b,c){return goog.color.rgbArrayToHex(goog.color.hsvToRgb(a,b,c))};goog.color.hsvArrayToHex=function(a){return goog.color.hsvToHex(a[0],a[1],a[2])};
|
|
goog.color.hslDistance=function(a,b){var c=.5>=a[2]?a[1]*a[2]:a[1]*(1-a[2]);var d=.5>=b[2]?b[1]*b[2]:b[1]*(1-b[2]);return(a[2]-b[2])*(a[2]-b[2])+c*c+d*d-2*c*d*Math.cos(2*(a[0]/360-b[0]/360)*Math.PI)};goog.color.blend=function(a,b,c){c=goog.math.clamp(c,0,1);return[Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2]))]};goog.color.darken=function(a,b){return goog.color.blend([0,0,0],a,b)};
|
|
goog.color.lighten=function(a,b){return goog.color.blend([255,255,255],a,b)};goog.color.highContrast=function(a,b){for(var c=[],d=0;d<b.length;d++)c.push({color:b[d],diff:goog.color.yiqBrightnessDiff_(b[d],a)+goog.color.colorDiff_(b[d],a)});c.sort(function(a,b){return b.diff-a.diff});return c[0].color};goog.color.yiqBrightness_=function(a){return Math.round((299*a[0]+587*a[1]+114*a[2])/1E3)};goog.color.yiqBrightnessDiff_=function(a,b){return Math.abs(goog.color.yiqBrightness_(a)-goog.color.yiqBrightness_(b))};
|
|
goog.color.colorDiff_=function(a,b){return Math.abs(a[0]-b[0])+Math.abs(a[1]-b[1])+Math.abs(a[2]-b[2])};goog.fx.dom={};goog.fx.dom.PredefinedEffect=function(a,b,c,d,e){goog.fx.Animation.call(this,b,c,d,e);this.element=a};goog.inherits(goog.fx.dom.PredefinedEffect,goog.fx.Animation);goog.fx.dom.PredefinedEffect.prototype.updateStyle=goog.nullFunction;goog.fx.dom.PredefinedEffect.prototype.isRightToLeft=function(){void 0===this.rightToLeft_&&(this.rightToLeft_=goog.style.isRightToLeft(this.element));return this.rightToLeft_};
|
|
goog.fx.dom.PredefinedEffect.prototype.onAnimate=function(){this.updateStyle();goog.fx.dom.PredefinedEffect.superClass_.onAnimate.call(this)};goog.fx.dom.PredefinedEffect.prototype.onEnd=function(){this.updateStyle();goog.fx.dom.PredefinedEffect.superClass_.onEnd.call(this)};goog.fx.dom.PredefinedEffect.prototype.onBegin=function(){this.updateStyle();goog.fx.dom.PredefinedEffect.superClass_.onBegin.call(this)};
|
|
goog.fx.dom.Slide=function(a,b,c,d,e){if(2!=b.length||2!=c.length)throw Error("Start and end points must be 2D");goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e)};goog.inherits(goog.fx.dom.Slide,goog.fx.dom.PredefinedEffect);goog.fx.dom.Slide.prototype.updateStyle=function(){var a=this.isRightPositioningForRtlEnabled()&&this.isRightToLeft()?"right":"left";this.element.style[a]=Math.round(this.coords[0])+"px";this.element.style.top=Math.round(this.coords[1])+"px"};
|
|
goog.fx.dom.SlideFrom=function(a,b,c,d){goog.fx.dom.Slide.call(this,a,[a.offsetLeft,a.offsetTop],b,c,d)};goog.inherits(goog.fx.dom.SlideFrom,goog.fx.dom.Slide);goog.fx.dom.SlideFrom.prototype.onBegin=function(){this.startPoint=[this.isRightPositioningForRtlEnabled()?goog.style.bidi.getOffsetStart(this.element):this.element.offsetLeft,this.element.offsetTop];goog.fx.dom.SlideFrom.superClass_.onBegin.call(this)};
|
|
goog.fx.dom.Swipe=function(a,b,c,d,e){if(2!=b.length||2!=c.length)throw Error("Start and end points must be 2D");goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e);this.maxWidth_=Math.max(this.endPoint[0],this.startPoint[0]);this.maxHeight_=Math.max(this.endPoint[1],this.startPoint[1])};goog.inherits(goog.fx.dom.Swipe,goog.fx.dom.PredefinedEffect);
|
|
goog.fx.dom.Swipe.prototype.updateStyle=function(){var a=this.coords[0],b=this.coords[1];this.clip_(Math.round(a),Math.round(b),this.maxWidth_,this.maxHeight_);this.element.style.width=Math.round(a)+"px";var c=this.isRightPositioningForRtlEnabled()&&this.isRightToLeft()?"marginRight":"marginLeft";this.element.style[c]=Math.round(a)-this.maxWidth_+"px";this.element.style.marginTop=Math.round(b)-this.maxHeight_+"px"};
|
|
goog.fx.dom.Swipe.prototype.clip_=function(a,b,c,d){this.element.style.clip="rect("+(d-b)+"px "+c+"px "+d+"px "+(c-a)+"px)"};goog.fx.dom.Scroll=function(a,b,c,d,e){if(2!=b.length||2!=c.length)throw Error("Start and end points must be 2D");goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e)};goog.inherits(goog.fx.dom.Scroll,goog.fx.dom.PredefinedEffect);
|
|
goog.fx.dom.Scroll.prototype.updateStyle=function(){this.isRightPositioningForRtlEnabled()?goog.style.bidi.setScrollOffset(this.element,Math.round(this.coords[0])):this.element.scrollLeft=Math.round(this.coords[0]);this.element.scrollTop=Math.round(this.coords[1])};goog.fx.dom.Resize=function(a,b,c,d,e){if(2!=b.length||2!=c.length)throw Error("Start and end points must be 2D");goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e)};goog.inherits(goog.fx.dom.Resize,goog.fx.dom.PredefinedEffect);
|
|
goog.fx.dom.Resize.prototype.updateStyle=function(){this.element.style.width=Math.round(this.coords[0])+"px";this.element.style.height=Math.round(this.coords[1])+"px"};goog.fx.dom.ResizeWidth=function(a,b,c,d,e){goog.fx.dom.PredefinedEffect.call(this,a,[b],[c],d,e)};goog.inherits(goog.fx.dom.ResizeWidth,goog.fx.dom.PredefinedEffect);goog.fx.dom.ResizeWidth.prototype.updateStyle=function(){this.element.style.width=Math.round(this.coords[0])+"px"};
|
|
goog.fx.dom.ResizeHeight=function(a,b,c,d,e){goog.fx.dom.PredefinedEffect.call(this,a,[b],[c],d,e)};goog.inherits(goog.fx.dom.ResizeHeight,goog.fx.dom.PredefinedEffect);goog.fx.dom.ResizeHeight.prototype.updateStyle=function(){this.element.style.height=Math.round(this.coords[0])+"px"};
|
|
goog.fx.dom.Fade=function(a,b,c,d,e){"number"===typeof b&&(b=[b]);"number"===typeof c&&(c=[c]);goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e);if(1!=b.length||1!=c.length)throw Error("Start and end points must be 1D");this.lastOpacityUpdate_=goog.fx.dom.Fade.OPACITY_UNSET_};goog.inherits(goog.fx.dom.Fade,goog.fx.dom.PredefinedEffect);goog.fx.dom.Fade.TOLERANCE_=1/1024;goog.fx.dom.Fade.OPACITY_UNSET_=-1;
|
|
goog.fx.dom.Fade.prototype.updateStyle=function(){var a=this.coords[0];Math.abs(a-this.lastOpacityUpdate_)>=goog.fx.dom.Fade.TOLERANCE_&&(goog.style.setOpacity(this.element,a),this.lastOpacityUpdate_=a)};goog.fx.dom.Fade.prototype.onBegin=function(){this.lastOpacityUpdate_=goog.fx.dom.Fade.OPACITY_UNSET_;goog.fx.dom.Fade.superClass_.onBegin.call(this)};goog.fx.dom.Fade.prototype.onEnd=function(){this.lastOpacityUpdate_=goog.fx.dom.Fade.OPACITY_UNSET_;goog.fx.dom.Fade.superClass_.onEnd.call(this)};
|
|
goog.fx.dom.Fade.prototype.show=function(){this.element.style.display=""};goog.fx.dom.Fade.prototype.hide=function(){this.element.style.display="none"};goog.fx.dom.FadeOut=function(a,b,c){goog.fx.dom.Fade.call(this,a,1,0,b,c)};goog.inherits(goog.fx.dom.FadeOut,goog.fx.dom.Fade);goog.fx.dom.FadeIn=function(a,b,c){goog.fx.dom.Fade.call(this,a,0,1,b,c)};goog.inherits(goog.fx.dom.FadeIn,goog.fx.dom.Fade);goog.fx.dom.FadeOutAndHide=function(a,b,c){goog.fx.dom.Fade.call(this,a,1,0,b,c)};
|
|
goog.inherits(goog.fx.dom.FadeOutAndHide,goog.fx.dom.Fade);goog.fx.dom.FadeOutAndHide.prototype.onBegin=function(){this.show();goog.fx.dom.FadeOutAndHide.superClass_.onBegin.call(this)};goog.fx.dom.FadeOutAndHide.prototype.onEnd=function(){this.hide();goog.fx.dom.FadeOutAndHide.superClass_.onEnd.call(this)};goog.fx.dom.FadeInAndShow=function(a,b,c){goog.fx.dom.Fade.call(this,a,0,1,b,c)};goog.inherits(goog.fx.dom.FadeInAndShow,goog.fx.dom.Fade);
|
|
goog.fx.dom.FadeInAndShow.prototype.onBegin=function(){this.show();goog.fx.dom.FadeInAndShow.superClass_.onBegin.call(this)};goog.fx.dom.BgColorTransform=function(a,b,c,d,e){if(3!=b.length||3!=c.length)throw Error("Start and end points must be 3D");goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e)};goog.inherits(goog.fx.dom.BgColorTransform,goog.fx.dom.PredefinedEffect);
|
|
goog.fx.dom.BgColorTransform.prototype.setColor=function(){for(var a=[],b=0;b<this.coords.length;b++)a[b]=Math.round(this.coords[b]);a="rgb("+a.join(",")+")";this.element.style.backgroundColor=a};goog.fx.dom.BgColorTransform.prototype.updateStyle=function(){this.setColor()};
|
|
goog.fx.dom.bgColorFadeIn=function(a,b,c,d){function e(){a.style.backgroundColor=f}var f=a.style.backgroundColor||"",g=goog.style.getBackgroundColor(a);g=g&&"transparent"!=g&&"rgba(0, 0, 0, 0)"!=g?goog.color.hexToRgb(goog.color.parse(g).hex):[255,255,255];b=new goog.fx.dom.BgColorTransform(a,b,g,c);d?d.listen(b,goog.fx.Transition.EventType.END,e):goog.events.listen(b,goog.fx.Transition.EventType.END,e);b.play()};
|
|
goog.fx.dom.ColorTransform=function(a,b,c,d,e){if(3!=b.length||3!=c.length)throw Error("Start and end points must be 3D");goog.fx.dom.PredefinedEffect.call(this,a,b,c,d,e)};goog.inherits(goog.fx.dom.ColorTransform,goog.fx.dom.PredefinedEffect);goog.fx.dom.ColorTransform.prototype.updateStyle=function(){for(var a=[],b=0;b<this.coords.length;b++)a[b]=Math.round(this.coords[b]);a="rgb("+a.join(",")+")";this.element.style.color=a};goog.ui.RangeModel=function(){goog.events.EventTarget.call(this)};goog.inherits(goog.ui.RangeModel,goog.events.EventTarget);goog.tagUnsealableClass(goog.ui.RangeModel);goog.ui.RangeModel.prototype.value_=0;goog.ui.RangeModel.prototype.minimum_=0;goog.ui.RangeModel.prototype.maximum_=100;goog.ui.RangeModel.prototype.extent_=0;goog.ui.RangeModel.prototype.step_=1;goog.ui.RangeModel.prototype.isChanging_=!1;goog.ui.RangeModel.prototype.mute_=!1;
|
|
goog.ui.RangeModel.prototype.setMute=function(a){this.mute_=a};goog.ui.RangeModel.prototype.setValue=function(a){a=this.roundToStepWithMin(a);this.value_!=a&&(this.value_=a+this.extent_>this.maximum_?this.maximum_-this.extent_:a<this.minimum_?this.minimum_:a,this.isChanging_||this.mute_||this.dispatchEvent(goog.ui.Component.EventType.CHANGE))};goog.ui.RangeModel.prototype.getValue=function(){return this.roundToStepWithMin(this.value_)};
|
|
goog.ui.RangeModel.prototype.setExtent=function(a){a=this.roundToStepWithMin(a);this.extent_!=a&&(this.extent_=0>a?0:this.value_+a>this.maximum_?this.maximum_-this.value_:a,this.isChanging_||this.mute_||this.dispatchEvent(goog.ui.Component.EventType.CHANGE))};goog.ui.RangeModel.prototype.getExtent=function(){return this.roundToStep(this.extent_)};
|
|
goog.ui.RangeModel.prototype.setMinimum=function(a){if(this.minimum_!=a){var b=this.isChanging_;this.isChanging_=!0;this.minimum_=a;a+this.extent_>this.maximum_&&(this.extent_=this.maximum_-this.minimum_);a>this.value_&&this.setValue(a);a>this.maximum_&&(this.extent_=0,this.setMaximum(a),this.setValue(a));(this.isChanging_=b)||this.mute_||this.dispatchEvent(goog.ui.Component.EventType.CHANGE)}};goog.ui.RangeModel.prototype.getMinimum=function(){return this.roundToStepWithMin(this.minimum_)};
|
|
goog.ui.RangeModel.prototype.setMaximum=function(a){a=this.roundToStepWithMin(a);if(this.maximum_!=a){var b=this.isChanging_;this.isChanging_=!0;this.maximum_=a;a<this.value_+this.extent_&&this.setValue(a-this.extent_);a<this.minimum_&&(this.extent_=0,this.setMinimum(a),this.setValue(this.maximum_));a<this.minimum_+this.extent_&&(this.extent_=this.maximum_-this.minimum_);(this.isChanging_=b)||this.mute_||this.dispatchEvent(goog.ui.Component.EventType.CHANGE)}};
|
|
goog.ui.RangeModel.prototype.getMaximum=function(){return this.roundToStepWithMin(this.maximum_)};goog.ui.RangeModel.prototype.getStep=function(){return this.step_};goog.ui.RangeModel.prototype.setStep=function(a){this.step_!=a&&(this.step_=a,a=this.isChanging_,this.isChanging_=!0,this.setMaximum(this.getMaximum()),this.setExtent(this.getExtent()),this.setValue(this.getValue()),(this.isChanging_=a)||this.mute_||this.dispatchEvent(goog.ui.Component.EventType.CHANGE))};
|
|
goog.ui.RangeModel.prototype.roundToStepWithMin=function(a){return null==this.step_?a:this.minimum_+Math.round((a-this.minimum_)/this.step_)*this.step_};goog.ui.RangeModel.prototype.roundToStep=function(a){return null==this.step_?a:Math.round(a/this.step_)*this.step_};goog.ui.SliderBase=function(a,b){goog.ui.Component.call(this,a);this.additionalAnimations_=null;this.rangeModel=new goog.ui.RangeModel;this.labelFn_=b||goog.functions.NULL;this.focusElementOnSliderDrag_=!0;goog.events.listen(this.rangeModel,goog.ui.Component.EventType.CHANGE,this.handleRangeModelChange,!1,this)};goog.inherits(goog.ui.SliderBase,goog.ui.Component);goog.tagUnsealableClass(goog.ui.SliderBase);
|
|
goog.ui.SliderBase.EventType={DRAG_VALUE_START:goog.events.getUniqueId("dragvaluestart"),DRAG_VALUE_END:goog.events.getUniqueId("dragvalueend"),DRAG_EXTENT_START:goog.events.getUniqueId("dragextentstart"),DRAG_EXTENT_END:goog.events.getUniqueId("dragextentend"),DRAG_START:goog.events.getUniqueId("dragstart"),DRAG_END:goog.events.getUniqueId("dragend"),ANIMATION_END:goog.events.getUniqueId("animationend")};goog.ui.SliderBase.Orientation={VERTICAL:"vertical",HORIZONTAL:"horizontal"};
|
|
goog.ui.SliderBase.prototype.orientation_=goog.ui.SliderBase.Orientation.HORIZONTAL;goog.ui.SliderBase.MOUSE_DOWN_INCREMENT_INTERVAL_=200;goog.ui.SliderBase.ANIMATION_INTERVAL_=100;goog.ui.SliderBase.prototype.isAnimating_=!1;goog.ui.SliderBase.prototype.moveToPointEnabled_=!1;goog.ui.SliderBase.prototype.blockIncrement_=10;goog.ui.SliderBase.prototype.minExtent_=0;goog.ui.SliderBase.prototype.isHandleMouseWheel_=!0;goog.ui.SliderBase.prototype.mouseDownTime_=0;
|
|
goog.ui.SliderBase.prototype.MOUSE_DOWN_DELAY_=1E3;goog.ui.SliderBase.prototype.enabled_=!0;goog.ui.SliderBase.prototype.flipForRtl_=!1;goog.ui.SliderBase.prototype.enableFlipForRtl=function(a){this.flipForRtl_=a};goog.ui.SliderBase.prototype.getCssClass=goog.abstractMethod;goog.ui.SliderBase.prototype.createDom=function(){goog.ui.SliderBase.superClass_.createDom.call(this);var a=this.getDomHelper().createDom("DIV",this.getCssClass(this.orientation_));this.decorateInternal(a)};
|
|
goog.ui.SliderBase.prototype.createThumbs=goog.abstractMethod;goog.ui.SliderBase.SLIDER_DRAGGING_CSS_CLASS_="goog-slider-dragging";goog.ui.SliderBase.THUMB_DRAGGING_CSS_CLASS_="goog-slider-thumb-dragging";goog.ui.SliderBase.DISABLED_CSS_CLASS_="goog-slider-disabled";goog.ui.SliderBase.prototype.decorateInternal=function(a){goog.ui.SliderBase.superClass_.decorateInternal.call(this,a);goog.asserts.assert(a);goog.dom.classlist.add(a,this.getCssClass(this.orientation_));this.createThumbs();this.setAriaRoles()};
|
|
goog.ui.SliderBase.prototype.enterDocument=function(){goog.ui.SliderBase.superClass_.enterDocument.call(this);this.valueDragger_=new goog.fx.Dragger(this.valueThumb);this.extentDragger_=new goog.fx.Dragger(this.extentThumb);this.valueDragger_.enableRightPositioningForRtl(this.flipForRtl_);this.extentDragger_.enableRightPositioningForRtl(this.flipForRtl_);this.valueDragger_.defaultAction=this.extentDragger_.defaultAction=goog.nullFunction;this.keyHandler_=new goog.events.KeyHandler(this.getElement());
|
|
this.enableEventHandlers_(!0);this.getElement().tabIndex=0;this.updateUi_()};
|
|
goog.ui.SliderBase.prototype.enableEventHandlers_=function(a){a?(this.getHandler().listen(this.valueDragger_,goog.fx.Dragger.EventType.BEFOREDRAG,this.handleBeforeDrag_).listen(this.extentDragger_,goog.fx.Dragger.EventType.BEFOREDRAG,this.handleBeforeDrag_).listen(this.valueDragger_,[goog.fx.Dragger.EventType.START,goog.fx.Dragger.EventType.END],this.handleThumbDragStartEnd_).listen(this.extentDragger_,[goog.fx.Dragger.EventType.START,goog.fx.Dragger.EventType.END],this.handleThumbDragStartEnd_).listen(this.keyHandler_,
|
|
goog.events.KeyHandler.EventType.KEY,this.handleKeyDown_).listen(this.getElement(),goog.events.EventType.CLICK,this.handleMouseDownAndClick_).listen(this.getElement(),goog.events.EventType.MOUSEDOWN,this.handleMouseDownAndClick_),this.isHandleMouseWheel()&&this.enableMouseWheelHandling_(!0)):(this.getHandler().unlisten(this.valueDragger_,goog.fx.Dragger.EventType.BEFOREDRAG,this.handleBeforeDrag_).unlisten(this.extentDragger_,goog.fx.Dragger.EventType.BEFOREDRAG,this.handleBeforeDrag_).unlisten(this.valueDragger_,
|
|
[goog.fx.Dragger.EventType.START,goog.fx.Dragger.EventType.END],this.handleThumbDragStartEnd_).unlisten(this.extentDragger_,[goog.fx.Dragger.EventType.START,goog.fx.Dragger.EventType.END],this.handleThumbDragStartEnd_).unlisten(this.keyHandler_,goog.events.KeyHandler.EventType.KEY,this.handleKeyDown_).unlisten(this.getElement(),goog.events.EventType.CLICK,this.handleMouseDownAndClick_).unlisten(this.getElement(),goog.events.EventType.MOUSEDOWN,this.handleMouseDownAndClick_),this.isHandleMouseWheel()&&
|
|
this.enableMouseWheelHandling_(!1))};goog.ui.SliderBase.prototype.exitDocument=function(){goog.ui.SliderBase.superClass_.exitDocument.call(this);goog.disposeAll(this.valueDragger_,this.extentDragger_,this.keyHandler_,this.mouseWheelHandler_)};
|
|
goog.ui.SliderBase.prototype.handleBeforeDrag_=function(a){var b=a.dragger==this.valueDragger_?this.valueThumb:this.extentThumb;if(this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL){var c=this.getElement().clientHeight-b.offsetHeight;c=(c-a.top)/c*(this.getMaximum()-this.getMinimum())+this.getMinimum()}else c=this.getElement().clientWidth-b.offsetWidth,c=a.left/c*(this.getMaximum()-this.getMinimum())+this.getMinimum();c=a.dragger==this.valueDragger_?Math.min(Math.max(c,this.getMinimum()),
|
|
this.getValue()+this.getExtent()):Math.min(Math.max(c,this.getValue()),this.getMaximum());this.setThumbPosition_(b,c)};
|
|
goog.ui.SliderBase.prototype.handleThumbDragStartEnd_=function(a){var b=a.type==goog.fx.Dragger.EventType.START;goog.dom.classlist.enable(goog.asserts.assertElement(this.getElement()),goog.ui.SliderBase.SLIDER_DRAGGING_CSS_CLASS_,b);goog.dom.classlist.enable(goog.asserts.assertElement(a.target.handle),goog.ui.SliderBase.THUMB_DRAGGING_CSS_CLASS_,b);a=a.dragger==this.valueDragger_;b?(this.dispatchEvent(goog.ui.SliderBase.EventType.DRAG_START),this.dispatchEvent(a?goog.ui.SliderBase.EventType.DRAG_VALUE_START:
|
|
goog.ui.SliderBase.EventType.DRAG_EXTENT_START)):(this.dispatchEvent(goog.ui.SliderBase.EventType.DRAG_END),this.dispatchEvent(a?goog.ui.SliderBase.EventType.DRAG_VALUE_END:goog.ui.SliderBase.EventType.DRAG_EXTENT_END))};
|
|
goog.ui.SliderBase.prototype.handleKeyDown_=function(a){var b=!0;switch(a.keyCode){case goog.events.KeyCodes.HOME:this.animatedSetValue(this.getMinimum());break;case goog.events.KeyCodes.END:this.animatedSetValue(this.getMaximum());break;case goog.events.KeyCodes.PAGE_UP:this.moveThumbs(this.getBlockIncrement());break;case goog.events.KeyCodes.PAGE_DOWN:this.moveThumbs(-this.getBlockIncrement());break;case goog.events.KeyCodes.LEFT:var c=this.flipForRtl_&&this.isRightToLeft()?1:-1;this.moveThumbs(a.shiftKey?
|
|
c*this.getBlockIncrement():c*this.getUnitIncrement());break;case goog.events.KeyCodes.DOWN:this.moveThumbs(a.shiftKey?-this.getBlockIncrement():-this.getUnitIncrement());break;case goog.events.KeyCodes.RIGHT:c=this.flipForRtl_&&this.isRightToLeft()?-1:1;this.moveThumbs(a.shiftKey?c*this.getBlockIncrement():c*this.getUnitIncrement());break;case goog.events.KeyCodes.UP:this.moveThumbs(a.shiftKey?this.getBlockIncrement():this.getUnitIncrement());break;default:b=!1}b&&a.preventDefault()};
|
|
goog.ui.SliderBase.prototype.handleMouseDownAndClick_=function(a){this.focusElementOnSliderDrag_&&this.getElement().focus&&this.getElement().focus();var b=a.target;goog.dom.contains(this.valueThumb,b)||goog.dom.contains(this.extentThumb,b)||(b=a.type==goog.events.EventType.CLICK,b&&goog.now()<this.mouseDownTime_+this.MOUSE_DOWN_DELAY_||(b||(this.mouseDownTime_=goog.now()),this.moveToPointEnabled_?this.animatedSetValue(this.getValueFromMousePosition(a)):this.startBlockIncrementing_(a)))};
|
|
goog.ui.SliderBase.prototype.handleMouseWheel_=function(a){this.moveThumbs((0<a.detail?-1:1)*this.getUnitIncrement());a.preventDefault()};
|
|
goog.ui.SliderBase.prototype.startBlockIncrementing_=function(a){this.storeMousePos_(a);this.thumbToMove_=this.getClosestThumb_(this.getValueFromMousePosition(a));this.incrementing_=this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL?this.lastMousePosition_<this.thumbToMove_.offsetTop:this.lastMousePosition_>this.getOffsetStart_(this.thumbToMove_)+this.thumbToMove_.offsetWidth;a=goog.dom.getOwnerDocument(this.getElement());this.getHandler().listen(a,goog.events.EventType.MOUSEUP,this.stopBlockIncrementing_,
|
|
!0).listen(this.getElement(),goog.events.EventType.MOUSEMOVE,this.storeMousePos_);this.incTimer_||(this.incTimer_=new goog.Timer(goog.ui.SliderBase.MOUSE_DOWN_INCREMENT_INTERVAL_),this.getHandler().listen(this.incTimer_,goog.Timer.TICK,this.handleTimerTick_));this.handleTimerTick_();this.incTimer_.start()};
|
|
goog.ui.SliderBase.prototype.handleTimerTick_=function(){var a;if(this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL){var b=this.lastMousePosition_,c=this.thumbToMove_.offsetTop;this.incrementing_?b<c&&(a=this.getThumbPosition_(this.thumbToMove_)+this.getBlockIncrement()):b>c+this.thumbToMove_.offsetHeight&&(a=this.getThumbPosition_(this.thumbToMove_)-this.getBlockIncrement())}else b=this.lastMousePosition_,c=this.getOffsetStart_(this.thumbToMove_),this.incrementing_?b>c+this.thumbToMove_.offsetWidth&&
|
|
(a=this.getThumbPosition_(this.thumbToMove_)+this.getBlockIncrement()):b<c&&(a=this.getThumbPosition_(this.thumbToMove_)-this.getBlockIncrement());void 0!==a&&this.setThumbPosition_(this.thumbToMove_,a)};
|
|
goog.ui.SliderBase.prototype.stopBlockIncrementing_=function(){this.incTimer_&&this.incTimer_.stop();var a=goog.dom.getOwnerDocument(this.getElement());this.getHandler().unlisten(a,goog.events.EventType.MOUSEUP,this.stopBlockIncrementing_,!0).unlisten(this.getElement(),goog.events.EventType.MOUSEMOVE,this.storeMousePos_)};
|
|
goog.ui.SliderBase.prototype.getRelativeMousePos_=function(a){a=goog.style.getRelativePosition(a,this.getElement());return this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL?a.y:this.flipForRtl_&&this.isRightToLeft()?this.getElement().clientWidth-a.x:a.x};goog.ui.SliderBase.prototype.storeMousePos_=function(a){this.lastMousePosition_=this.getRelativeMousePos_(a)};
|
|
goog.ui.SliderBase.prototype.getValueFromMousePosition=function(a){var b=this.getMinimum(),c=this.getMaximum();if(this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL){var d=this.valueThumb.offsetHeight,e=this.getElement().clientHeight-d;a=this.getRelativeMousePos_(a)-d/2;return(c-b)*(e-a)/e+b}d=this.valueThumb.offsetWidth;e=this.getElement().clientWidth-d;a=this.getRelativeMousePos_(a)-d/2;return(c-b)*a/e+b};
|
|
goog.ui.SliderBase.prototype.getThumbPosition_=function(a){if(a==this.valueThumb)return this.rangeModel.getValue();if(a==this.extentThumb)return this.rangeModel.getValue()+this.rangeModel.getExtent();throw Error("Illegal thumb element. Neither minThumb nor maxThumb");};goog.ui.SliderBase.prototype.isDragging=function(){return this.valueDragger_.isDragging()||this.extentDragger_.isDragging()};
|
|
goog.ui.SliderBase.prototype.moveThumbs=function(a){Math.abs(a)<this.getStep()&&(a=goog.math.sign(a)*this.getStep());var b=this.getThumbPosition_(this.valueThumb)+a;a=this.getThumbPosition_(this.extentThumb)+a;b=goog.math.clamp(b,this.getMinimum(),this.getMaximum()-this.minExtent_);a=goog.math.clamp(a,this.getMinimum()+this.minExtent_,this.getMaximum());this.setValueAndExtent(b,a-b)};
|
|
goog.ui.SliderBase.prototype.setThumbPosition_=function(a,b){var c=this.rangeModel.roundToStepWithMin(b),d=a==this.valueThumb?c:this.rangeModel.getValue();c=a==this.extentThumb?c:this.rangeModel.getValue()+this.rangeModel.getExtent();d>=this.getMinimum()&&c>=d+this.minExtent_&&this.getMaximum()>=c&&this.setValueAndExtent(d,c-d)};
|
|
goog.ui.SliderBase.prototype.setValueAndExtent=function(a,b){this.getMinimum()<=a&&a<=this.getMaximum()-b&&this.minExtent_<=b&&b<=this.getMaximum()-a&&(a!=this.getValue()||b!=this.getExtent())&&(this.rangeModel.setMute(!0),this.rangeModel.setExtent(0),this.rangeModel.setValue(a),this.rangeModel.setExtent(b),this.rangeModel.setMute(!1),this.handleRangeModelChange(null))};goog.ui.SliderBase.prototype.getMinimum=function(){return this.rangeModel.getMinimum()};
|
|
goog.ui.SliderBase.prototype.setMinimum=function(a){this.rangeModel.setMinimum(a)};goog.ui.SliderBase.prototype.getMaximum=function(){return this.rangeModel.getMaximum()};goog.ui.SliderBase.prototype.setMaximum=function(a){this.rangeModel.setMaximum(a)};goog.ui.SliderBase.prototype.getValueThumb=function(){return this.valueThumb};goog.ui.SliderBase.prototype.getExtentThumb=function(){return this.extentThumb};
|
|
goog.ui.SliderBase.prototype.getClosestThumb_=function(a){return a<=this.rangeModel.getValue()+this.rangeModel.getExtent()/2?this.valueThumb:this.extentThumb};goog.ui.SliderBase.prototype.handleRangeModelChange=function(a){this.updateUi_();this.updateAriaStates();this.dispatchEvent(goog.ui.Component.EventType.CHANGE)};
|
|
goog.ui.SliderBase.prototype.updateUi_=function(){if(this.valueThumb&&!this.isAnimating_){var a=this.getThumbCoordinateForValue(this.getThumbPosition_(this.valueThumb)),b=this.getThumbCoordinateForValue(this.getThumbPosition_(this.extentThumb));if(this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL)this.valueThumb.style.top=a.y+"px",this.extentThumb.style.top=b.y+"px",this.rangeHighlight&&(a=this.calculateRangeHighlightPositioning_(b.y,a.y,this.valueThumb.offsetHeight),this.rangeHighlight.style.top=
|
|
a.offset+"px",this.rangeHighlight.style.height=a.size+"px");else{var c=this.flipForRtl_&&this.isRightToLeft()?"right":"left";this.valueThumb.style[c]=a.x+"px";this.extentThumb.style[c]=b.x+"px";this.rangeHighlight&&(a=this.calculateRangeHighlightPositioning_(a.x,b.x,this.valueThumb.offsetWidth),this.rangeHighlight.style[c]=a.offset+"px",this.rangeHighlight.style.width=a.size+"px")}}};
|
|
goog.ui.SliderBase.prototype.calculateRangeHighlightPositioning_=function(a,b,c){var d=Math.ceil(c/2);return{offset:a+d,size:Math.max(b-a+c-2*d,0)}};
|
|
goog.ui.SliderBase.prototype.getThumbCoordinateForValue=function(a){var b=new goog.math.Coordinate;if(this.valueThumb){var c=this.getMinimum(),d=this.getMaximum();a=a==c&&c==d?0:(a-c)/(d-c);this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL?(c=this.valueThumb.offsetHeight,c=this.getElement().clientHeight-c,a=Math.round(a*c),b.x=this.moveToPointEnabled_?0:this.getOffsetStart_(this.valueThumb),b.y=c-a):(c=this.getElement().clientWidth-this.valueThumb.offsetWidth,b.x=Math.round(a*c),b.y=this.moveToPointEnabled_?
|
|
0:this.valueThumb.offsetTop)}return b};
|
|
goog.ui.SliderBase.prototype.animatedSetValue=function(a){a=goog.math.clamp(a,this.getMinimum(),this.getMaximum());this.isAnimating_&&(this.currentAnimation_.stop(!0),this.currentAnimation_.dispose());var b=new goog.fx.AnimationParallelQueue,c=this.getClosestThumb_(a),d=this.getValue(),e=this.getExtent(),f=this.getThumbPosition_(c),g=this.getThumbCoordinateForValue(f);var h=this.getStep();Math.abs(a-f)<h&&(a=goog.math.clamp(f+(a>f?h:-h),this.getMinimum(),this.getMaximum()));this.setThumbPosition_(c,
|
|
a);f=this.getThumbCoordinateForValue(this.getThumbPosition_(c));h=this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL?[this.getOffsetStart_(c),f.y]:[f.x,c.offsetTop];g=new goog.fx.dom.Slide(c,[g.x,g.y],h,goog.ui.SliderBase.ANIMATION_INTERVAL_);g.enableRightPositioningForRtl(this.flipForRtl_);b.add(g);this.rangeHighlight&&this.addRangeHighlightAnimations_(c,d,e,f,b);this.additionalAnimations_&&(a=this.additionalAnimations_.createAnimations(d,a,goog.ui.SliderBase.ANIMATION_INTERVAL_),goog.array.forEach(a,
|
|
function(a){b.add(a)}));this.currentAnimation_=b;this.getHandler().listen(b,goog.fx.Transition.EventType.END,this.endAnimation_);this.isAnimating_=!0;b.play(!1)};goog.ui.SliderBase.prototype.isAnimating=function(){return this.isAnimating_};goog.ui.SliderBase.prototype.setAdditionalAnimations=function(a){this.additionalAnimations_=a};
|
|
goog.ui.SliderBase.prototype.addRangeHighlightAnimations_=function(a,b,c,d,e){var f=this.getThumbCoordinateForValue(b),g=this.getThumbCoordinateForValue(b+c);b=f;c=g;a==this.valueThumb?b=d:c=d;this.orientation_==goog.ui.SliderBase.Orientation.VERTICAL?(a=this.calculateRangeHighlightPositioning_(g.y,f.y,this.valueThumb.offsetHeight),f=this.calculateRangeHighlightPositioning_(c.y,b.y,this.valueThumb.offsetHeight),d=new goog.fx.dom.Slide(this.rangeHighlight,[this.getOffsetStart_(this.rangeHighlight),
|
|
a.offset],[this.getOffsetStart_(this.rangeHighlight),f.offset],goog.ui.SliderBase.ANIMATION_INTERVAL_),a=new goog.fx.dom.ResizeHeight(this.rangeHighlight,a.size,f.size,goog.ui.SliderBase.ANIMATION_INTERVAL_),d.enableRightPositioningForRtl(this.flipForRtl_),a.enableRightPositioningForRtl(this.flipForRtl_),e.add(d),e.add(a)):(a=this.calculateRangeHighlightPositioning_(f.x,g.x,this.valueThumb.offsetWidth),f=this.calculateRangeHighlightPositioning_(b.x,c.x,this.valueThumb.offsetWidth),d=new goog.fx.dom.Slide(this.rangeHighlight,
|
|
[a.offset,this.rangeHighlight.offsetTop],[f.offset,this.rangeHighlight.offsetTop],goog.ui.SliderBase.ANIMATION_INTERVAL_),a=new goog.fx.dom.ResizeWidth(this.rangeHighlight,a.size,f.size,goog.ui.SliderBase.ANIMATION_INTERVAL_),d.enableRightPositioningForRtl(this.flipForRtl_),a.enableRightPositioningForRtl(this.flipForRtl_),e.add(d),e.add(a))};goog.ui.SliderBase.prototype.endAnimation_=function(a){this.isAnimating_=!1;this.dispatchEvent(goog.ui.SliderBase.EventType.ANIMATION_END)};
|
|
goog.ui.SliderBase.prototype.setOrientation=function(a){if(this.orientation_!=a){var b=this.getCssClass(this.orientation_),c=this.getCssClass(a);this.orientation_=a;this.getElement()&&(goog.dom.classlist.swap(goog.asserts.assert(this.getElement()),b,c),a=this.flipForRtl_&&this.isRightToLeft()?"right":"left",this.valueThumb.style[a]=this.valueThumb.style.top="",this.extentThumb.style[a]=this.extentThumb.style.top="",this.rangeHighlight&&(this.rangeHighlight.style[a]=this.rangeHighlight.style.top="",
|
|
this.rangeHighlight.style.width=this.rangeHighlight.style.height=""),this.updateUi_())}};goog.ui.SliderBase.prototype.getOrientation=function(){return this.orientation_};
|
|
goog.ui.SliderBase.prototype.disposeInternal=function(){goog.ui.SliderBase.superClass_.disposeInternal.call(this);this.incTimer_&&this.incTimer_.dispose();delete this.incTimer_;this.currentAnimation_&&this.currentAnimation_.dispose();delete this.currentAnimation_;delete this.valueThumb;delete this.extentThumb;this.rangeHighlight&&delete this.rangeHighlight;this.rangeModel.dispose();delete this.rangeModel;this.keyHandler_&&(this.keyHandler_.dispose(),delete this.keyHandler_);this.mouseWheelHandler_&&
|
|
(this.mouseWheelHandler_.dispose(),delete this.mouseWheelHandler_);this.valueDragger_&&(this.valueDragger_.dispose(),delete this.valueDragger_);this.extentDragger_&&(this.extentDragger_.dispose(),delete this.extentDragger_)};goog.ui.SliderBase.prototype.getBlockIncrement=function(){return this.blockIncrement_};goog.ui.SliderBase.prototype.setBlockIncrement=function(a){this.blockIncrement_=a};goog.ui.SliderBase.prototype.setMinExtent=function(a){this.minExtent_=a};
|
|
goog.ui.SliderBase.prototype.unitIncrement_=1;goog.ui.SliderBase.prototype.getUnitIncrement=function(){return this.unitIncrement_};goog.ui.SliderBase.prototype.setUnitIncrement=function(a){this.unitIncrement_=a};goog.ui.SliderBase.prototype.getStep=function(){return this.rangeModel.getStep()};goog.ui.SliderBase.prototype.setStep=function(a){this.rangeModel.setStep(a)};goog.ui.SliderBase.prototype.getMoveToPointEnabled=function(){return this.moveToPointEnabled_};
|
|
goog.ui.SliderBase.prototype.setMoveToPointEnabled=function(a){this.moveToPointEnabled_=a};goog.ui.SliderBase.prototype.getValue=function(){return this.rangeModel.getValue()};goog.ui.SliderBase.prototype.setValue=function(a){this.setThumbPosition_(this.valueThumb,a)};goog.ui.SliderBase.prototype.getExtent=function(){return this.rangeModel.getExtent()};goog.ui.SliderBase.prototype.setExtent=function(a){this.setThumbPosition_(this.extentThumb,this.rangeModel.getValue()+a)};
|
|
goog.ui.SliderBase.prototype.setVisible=function(a){goog.style.setElementShown(this.getElement(),a);a&&this.updateUi_()};goog.ui.SliderBase.prototype.setAriaRoles=function(){var a=this.getElement();goog.asserts.assert(a,"The DOM element for the slider base cannot be null.");goog.a11y.aria.setRole(a,goog.a11y.aria.Role.SLIDER);this.updateAriaStates()};
|
|
goog.ui.SliderBase.prototype.updateAriaStates=function(){var a=this.getElement();a&&(goog.a11y.aria.setState(a,goog.a11y.aria.State.VALUEMIN,this.getMinimum()),goog.a11y.aria.setState(a,goog.a11y.aria.State.VALUEMAX,this.getMaximum()),goog.a11y.aria.setState(a,goog.a11y.aria.State.VALUENOW,this.getValue()),goog.a11y.aria.setState(a,goog.a11y.aria.State.VALUETEXT,this.getTextValue()||""))};
|
|
goog.ui.SliderBase.prototype.setHandleMouseWheel=function(a){this.isInDocument()&&a!=this.isHandleMouseWheel()&&this.enableMouseWheelHandling_(a);this.isHandleMouseWheel_=a};goog.ui.SliderBase.prototype.isHandleMouseWheel=function(){return this.isHandleMouseWheel_};
|
|
goog.ui.SliderBase.prototype.enableMouseWheelHandling_=function(a){a?(this.mouseWheelHandler_||(this.mouseWheelHandler_=new goog.events.MouseWheelHandler(this.getElement())),this.getHandler().listen(this.mouseWheelHandler_,goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,this.handleMouseWheel_,{passive:!1})):this.getHandler().unlisten(this.mouseWheelHandler_,goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,this.handleMouseWheel_,{passive:!1})};
|
|
goog.ui.SliderBase.prototype.setEnabled=function(a){this.enabled_!=a&&this.dispatchEvent(a?goog.ui.Component.EventType.ENABLE:goog.ui.Component.EventType.DISABLE)&&(this.enabled_=a,this.enableEventHandlers_(a),a||this.stopBlockIncrementing_(),goog.dom.classlist.enable(goog.asserts.assert(this.getElement()),goog.ui.SliderBase.DISABLED_CSS_CLASS_,!a))};goog.ui.SliderBase.prototype.isEnabled=function(){return this.enabled_};
|
|
goog.ui.SliderBase.prototype.getOffsetStart_=function(a){return this.flipForRtl_?goog.style.bidi.getOffsetStart(a):a.offsetLeft};goog.ui.SliderBase.prototype.getTextValue=function(){return this.labelFn_(this.getValue())};goog.ui.SliderBase.prototype.setFocusElementOnSliderDrag=function(a){this.focusElementOnSliderDrag_=a};goog.ui.SliderBase.AnimationFactory=function(){};goog.ui.Slider=function(a,b){goog.ui.SliderBase.call(this,a,b);this.rangeModel.setExtent(0)};goog.inherits(goog.ui.Slider,goog.ui.SliderBase);goog.tagUnsealableClass(goog.ui.Slider);goog.ui.Slider.Orientation=goog.ui.SliderBase.Orientation;goog.ui.Slider.CSS_CLASS_PREFIX="goog-slider";goog.ui.Slider.THUMB_CSS_CLASS=goog.ui.Slider.CSS_CLASS_PREFIX+"-thumb";
|
|
goog.ui.Slider.prototype.getCssClass=function(a){return a==goog.ui.SliderBase.Orientation.VERTICAL?goog.ui.Slider.CSS_CLASS_PREFIX+"-vertical":goog.ui.Slider.CSS_CLASS_PREFIX+"-horizontal"};goog.ui.Slider.prototype.getThumbCssClass=function(){return goog.ui.Slider.THUMB_CSS_CLASS};
|
|
goog.ui.Slider.prototype.createThumbs=function(){var a=this.getElement(),b=goog.dom.getElementsByTagNameAndClass(null,this.getThumbCssClass(),a)[0];b||(b=this.createThumb_(),a.appendChild(b));this.valueThumb=this.extentThumb=b};goog.ui.Slider.prototype.createThumb_=function(){var a=this.getDomHelper().createDom("DIV",this.getThumbCssClass());goog.a11y.aria.setRole(a,goog.a11y.aria.Role.BUTTON);return a};goog.positioning={};goog.positioning.CornerBit={BOTTOM:1,CENTER:2,RIGHT:4,FLIP_RTL:8};
|
|
goog.positioning.Corner={TOP_LEFT:0,TOP_RIGHT:goog.positioning.CornerBit.RIGHT,BOTTOM_LEFT:goog.positioning.CornerBit.BOTTOM,BOTTOM_RIGHT:goog.positioning.CornerBit.BOTTOM|goog.positioning.CornerBit.RIGHT,TOP_START:goog.positioning.CornerBit.FLIP_RTL,TOP_END:goog.positioning.CornerBit.FLIP_RTL|goog.positioning.CornerBit.RIGHT,BOTTOM_START:goog.positioning.CornerBit.BOTTOM|goog.positioning.CornerBit.FLIP_RTL,BOTTOM_END:goog.positioning.CornerBit.BOTTOM|goog.positioning.CornerBit.RIGHT|goog.positioning.CornerBit.FLIP_RTL,
|
|
TOP_CENTER:goog.positioning.CornerBit.CENTER,BOTTOM_CENTER:goog.positioning.CornerBit.BOTTOM|goog.positioning.CornerBit.CENTER};goog.positioning.Overflow={IGNORE:0,ADJUST_X:1,FAIL_X:2,ADJUST_Y:4,FAIL_Y:8,RESIZE_WIDTH:16,RESIZE_HEIGHT:32,ADJUST_X_EXCEPT_OFFSCREEN:65,ADJUST_Y_EXCEPT_OFFSCREEN:132};goog.positioning.OverflowStatus={NONE:0,ADJUSTED_X:1,ADJUSTED_Y:2,WIDTH_ADJUSTED:4,HEIGHT_ADJUSTED:8,FAILED_LEFT:16,FAILED_RIGHT:32,FAILED_TOP:64,FAILED_BOTTOM:128,FAILED_OUTSIDE_VIEWPORT:256};
|
|
goog.positioning.OverflowStatus.FAILED=goog.positioning.OverflowStatus.FAILED_LEFT|goog.positioning.OverflowStatus.FAILED_RIGHT|goog.positioning.OverflowStatus.FAILED_TOP|goog.positioning.OverflowStatus.FAILED_BOTTOM|goog.positioning.OverflowStatus.FAILED_OUTSIDE_VIEWPORT;goog.positioning.OverflowStatus.FAILED_HORIZONTAL=goog.positioning.OverflowStatus.FAILED_LEFT|goog.positioning.OverflowStatus.FAILED_RIGHT;
|
|
goog.positioning.OverflowStatus.FAILED_VERTICAL=goog.positioning.OverflowStatus.FAILED_TOP|goog.positioning.OverflowStatus.FAILED_BOTTOM;
|
|
goog.positioning.positionAtAnchor=function(a,b,c,d,e,f,g,h,k){goog.asserts.assert(c);var l=goog.positioning.getOffsetParentPageOffset(c),m=goog.positioning.getVisiblePart_(a);goog.style.translateRectForAnotherFrame(m,goog.dom.getDomHelper(a),goog.dom.getDomHelper(c));a=goog.positioning.getEffectiveCorner(a,b);b=m.left;a&goog.positioning.CornerBit.RIGHT?b+=m.width:a&goog.positioning.CornerBit.CENTER&&(b+=m.width/2);m=new goog.math.Coordinate(b,m.top+(a&goog.positioning.CornerBit.BOTTOM?m.height:0));
|
|
m=goog.math.Coordinate.difference(m,l);e&&(m.x+=(a&goog.positioning.CornerBit.RIGHT?-1:1)*e.x,m.y+=(a&goog.positioning.CornerBit.BOTTOM?-1:1)*e.y);if(g)if(k)var n=k;else if(n=goog.style.getVisibleRectForElement(c))n.top-=l.y,n.right-=l.x,n.bottom-=l.y,n.left-=l.x;return goog.positioning.positionAtCoordinate(m,c,d,f,n,g,h)};
|
|
goog.positioning.getOffsetParentPageOffset=function(a){if(a=a.offsetParent){var b="HTML"==a.tagName||"BODY"==a.tagName;if(!b||"static"!=goog.style.getComputedPosition(a)){var c=goog.style.getPageOffset(a);b||(c=goog.math.Coordinate.difference(c,new goog.math.Coordinate(goog.style.bidi.getScrollLeft(a),a.scrollTop)))}}return c||new goog.math.Coordinate};
|
|
goog.positioning.getVisiblePart_=function(a){var b=goog.style.getBounds(a);(a=goog.style.getVisibleRectForElement(a))&&b.intersection(goog.math.Rect.createFromBox(a));return b};
|
|
goog.positioning.positionAtCoordinate=function(a,b,c,d,e,f,g){a=a.clone();var h=goog.positioning.getEffectiveCorner(b,c);c=goog.style.getSize(b);g=g?g.clone():c.clone();a=goog.positioning.getPositionAtCoordinate(a,g,h,d,e,f);if(a.status&goog.positioning.OverflowStatus.FAILED)return a.status;goog.style.setPosition(b,a.rect.getTopLeft());g=a.rect.getSize();goog.math.Size.equals(c,g)||goog.style.setBorderBoxSize(b,g);return a.status};
|
|
goog.positioning.getPositionAtCoordinate=function(a,b,c,d,e,f){a=a.clone();b=b.clone();var g=goog.positioning.OverflowStatus.NONE;if(d||c!=goog.positioning.Corner.TOP_LEFT)c&goog.positioning.CornerBit.RIGHT?a.x-=b.width+(d?d.right:0):c&goog.positioning.CornerBit.CENTER?a.x-=b.width/2:d&&(a.x+=d.left),c&goog.positioning.CornerBit.BOTTOM?a.y-=b.height+(d?d.bottom:0):d&&(a.y+=d.top);f&&(g=e?goog.positioning.adjustForViewport_(a,b,e,f):goog.positioning.OverflowStatus.FAILED_OUTSIDE_VIEWPORT);c=new goog.math.Rect(0,
|
|
0,0,0);c.left=a.x;c.top=a.y;c.width=b.width;c.height=b.height;return{rect:c,status:g}};
|
|
goog.positioning.adjustForViewport_=function(a,b,c,d){var e=goog.positioning.OverflowStatus.NONE,f=goog.positioning.Overflow.ADJUST_X_EXCEPT_OFFSCREEN,g=goog.positioning.Overflow.ADJUST_Y_EXCEPT_OFFSCREEN;(d&f)==f&&(a.x<c.left||a.x>=c.right)&&(d&=~goog.positioning.Overflow.ADJUST_X);(d&g)==g&&(a.y<c.top||a.y>=c.bottom)&&(d&=~goog.positioning.Overflow.ADJUST_Y);a.x<c.left&&d&goog.positioning.Overflow.ADJUST_X&&(a.x=c.left,e|=goog.positioning.OverflowStatus.ADJUSTED_X);d&goog.positioning.Overflow.RESIZE_WIDTH&&
|
|
(f=a.x,a.x<c.left&&(a.x=c.left,e|=goog.positioning.OverflowStatus.WIDTH_ADJUSTED),a.x+b.width>c.right&&(b.width=Math.min(c.right-a.x,f+b.width-c.left),b.width=Math.max(b.width,0),e|=goog.positioning.OverflowStatus.WIDTH_ADJUSTED));a.x+b.width>c.right&&d&goog.positioning.Overflow.ADJUST_X&&(a.x=Math.max(c.right-b.width,c.left),e|=goog.positioning.OverflowStatus.ADJUSTED_X);d&goog.positioning.Overflow.FAIL_X&&(e|=(a.x<c.left?goog.positioning.OverflowStatus.FAILED_LEFT:0)|(a.x+b.width>c.right?goog.positioning.OverflowStatus.FAILED_RIGHT:
|
|
0));a.y<c.top&&d&goog.positioning.Overflow.ADJUST_Y&&(a.y=c.top,e|=goog.positioning.OverflowStatus.ADJUSTED_Y);d&goog.positioning.Overflow.RESIZE_HEIGHT&&(f=a.y,a.y<c.top&&(a.y=c.top,e|=goog.positioning.OverflowStatus.HEIGHT_ADJUSTED),a.y+b.height>c.bottom&&(b.height=Math.min(c.bottom-a.y,f+b.height-c.top),b.height=Math.max(b.height,0),e|=goog.positioning.OverflowStatus.HEIGHT_ADJUSTED));a.y+b.height>c.bottom&&d&goog.positioning.Overflow.ADJUST_Y&&(a.y=Math.max(c.bottom-b.height,c.top),e|=goog.positioning.OverflowStatus.ADJUSTED_Y);
|
|
d&goog.positioning.Overflow.FAIL_Y&&(e|=(a.y<c.top?goog.positioning.OverflowStatus.FAILED_TOP:0)|(a.y+b.height>c.bottom?goog.positioning.OverflowStatus.FAILED_BOTTOM:0));return e};goog.positioning.getEffectiveCorner=function(a,b){return(b&goog.positioning.CornerBit.FLIP_RTL&&goog.style.isRightToLeft(a)?b^goog.positioning.CornerBit.RIGHT:b)&~goog.positioning.CornerBit.FLIP_RTL};goog.positioning.flipCornerHorizontal=function(a){return a^goog.positioning.CornerBit.RIGHT};
|
|
goog.positioning.flipCornerVertical=function(a){return a^goog.positioning.CornerBit.BOTTOM};goog.positioning.flipCorner=function(a){return a^goog.positioning.CornerBit.BOTTOM^goog.positioning.CornerBit.RIGHT};goog.positioning.AbstractPosition=function(){};goog.positioning.AbstractPosition.prototype.reposition=function(a,b,c,d){};goog.positioning.ClientPosition=function(a,b){this.coordinate=a instanceof goog.math.Coordinate?a:new goog.math.Coordinate(a,b)};goog.inherits(goog.positioning.ClientPosition,goog.positioning.AbstractPosition);
|
|
goog.positioning.ClientPosition.prototype.reposition=function(a,b,c,d){goog.asserts.assert(a);var e=goog.style.getViewportPageOffset(goog.dom.getOwnerDocument(a)),f=this.coordinate.x+e.x;e=this.coordinate.y+e.y;var g=goog.positioning.getOffsetParentPageOffset(a);f-=g.x;e-=g.y;goog.positioning.positionAtCoordinate(new goog.math.Coordinate(f,e),a,b,c,null,null,d)};goog.events.FocusHandler=function(a){goog.events.EventTarget.call(this);this.element_=a;a=goog.userAgent.IE?"focusout":"blur";this.listenKeyIn_=goog.events.listen(this.element_,goog.userAgent.IE?"focusin":"focus",this,!goog.userAgent.IE);this.listenKeyOut_=goog.events.listen(this.element_,a,this,!goog.userAgent.IE)};goog.inherits(goog.events.FocusHandler,goog.events.EventTarget);goog.events.FocusHandler.EventType={FOCUSIN:"focusin",FOCUSOUT:"focusout"};
|
|
goog.events.FocusHandler.prototype.handleEvent=function(a){var b=a.getBrowserEvent();b=new goog.events.BrowserEvent(b);b.type="focusin"==a.type||"focus"==a.type?goog.events.FocusHandler.EventType.FOCUSIN:goog.events.FocusHandler.EventType.FOCUSOUT;this.dispatchEvent(b)};goog.events.FocusHandler.prototype.disposeInternal=function(){goog.events.FocusHandler.superClass_.disposeInternal.call(this);goog.events.unlistenByKey(this.listenKeyIn_);goog.events.unlistenByKey(this.listenKeyOut_);delete this.element_};goog.positioning.AnchoredPosition=function(a,b,c){this.element=a;this.corner=b;this.overflow_=c};goog.inherits(goog.positioning.AnchoredPosition,goog.positioning.AbstractPosition);goog.positioning.AnchoredPosition.prototype.reposition=function(a,b,c,d){goog.positioning.positionAtAnchor(this.element,this.corner,a,b,void 0,c,this.overflow_)};goog.positioning.ViewportPosition=function(a,b){this.coordinate=a instanceof goog.math.Coordinate?a:new goog.math.Coordinate(a,b)};goog.inherits(goog.positioning.ViewportPosition,goog.positioning.AbstractPosition);goog.positioning.ViewportPosition.prototype.reposition=function(a,b,c,d){goog.positioning.positionAtAnchor(goog.style.getClientViewportElement(a),goog.positioning.Corner.TOP_LEFT,a,b,this.coordinate,c,null,d)};goog.structs={};goog.structs.getCount=function(a){return a.getCount&&"function"==typeof a.getCount?a.getCount():goog.isArrayLike(a)||"string"===typeof a?a.length:goog.object.getCount(a)};goog.structs.getValues=function(a){if(a.getValues&&"function"==typeof a.getValues)return a.getValues();if("string"===typeof a)return a.split("");if(goog.isArrayLike(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return goog.object.getValues(a)};
|
|
goog.structs.getKeys=function(a){if(a.getKeys&&"function"==typeof a.getKeys)return a.getKeys();if(!a.getValues||"function"!=typeof a.getValues){if(goog.isArrayLike(a)||"string"===typeof a){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}return goog.object.getKeys(a)}};
|
|
goog.structs.contains=function(a,b){return a.contains&&"function"==typeof a.contains?a.contains(b):a.containsValue&&"function"==typeof a.containsValue?a.containsValue(b):goog.isArrayLike(a)||"string"===typeof a?goog.array.contains(a,b):goog.object.containsValue(a,b)};goog.structs.isEmpty=function(a){return a.isEmpty&&"function"==typeof a.isEmpty?a.isEmpty():goog.isArrayLike(a)||"string"===typeof a?goog.array.isEmpty(a):goog.object.isEmpty(a)};
|
|
goog.structs.clear=function(a){a.clear&&"function"==typeof a.clear?a.clear():goog.isArrayLike(a)?goog.array.clear(a):goog.object.clear(a)};goog.structs.forEach=function(a,b,c){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,c);else if(goog.isArrayLike(a)||"string"===typeof a)goog.array.forEach(a,b,c);else for(var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length,g=0;g<f;g++)b.call(c,e[g],d&&d[g],a)};
|
|
goog.structs.filter=function(a,b,c){if("function"==typeof a.filter)return a.filter(b,c);if(goog.isArrayLike(a)||"string"===typeof a)return goog.array.filter(a,b,c);var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length;if(d){var g={};for(var h=0;h<f;h++)b.call(c,e[h],d[h],a)&&(g[d[h]]=e[h])}else for(g=[],h=0;h<f;h++)b.call(c,e[h],void 0,a)&&g.push(e[h]);return g};
|
|
goog.structs.map=function(a,b,c){if("function"==typeof a.map)return a.map(b,c);if(goog.isArrayLike(a)||"string"===typeof a)return goog.array.map(a,b,c);var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length;if(d){var g={};for(var h=0;h<f;h++)g[d[h]]=b.call(c,e[h],d[h],a)}else for(g=[],h=0;h<f;h++)g[h]=b.call(c,e[h],void 0,a);return g};
|
|
goog.structs.some=function(a,b,c){if("function"==typeof a.some)return a.some(b,c);if(goog.isArrayLike(a)||"string"===typeof a)return goog.array.some(a,b,c);for(var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length,g=0;g<f;g++)if(b.call(c,e[g],d&&d[g],a))return!0;return!1};
|
|
goog.structs.every=function(a,b,c){if("function"==typeof a.every)return a.every(b,c);if(goog.isArrayLike(a)||"string"===typeof a)return goog.array.every(a,b,c);for(var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length,g=0;g<f;g++)if(!b.call(c,e[g],d&&d[g],a))return!1;return!0};goog.structs.Collection=function(){};goog.iter={};goog.iter.StopIteration="StopIteration"in goog.global?goog.global.StopIteration:{message:"StopIteration",stack:""};goog.iter.Iterator=function(){};goog.iter.Iterator.prototype.next=function(){throw goog.iter.StopIteration;};goog.iter.Iterator.prototype.__iterator__=function(a){return this};
|
|
goog.iter.toIterator=function(a){if(a instanceof goog.iter.Iterator)return a;if("function"==typeof a.__iterator__)return a.__iterator__(!1);if(goog.isArrayLike(a)){var b=0,c=new goog.iter.Iterator;c.next=function(){for(;;){if(b>=a.length)throw goog.iter.StopIteration;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");};
|
|
goog.iter.forEach=function(a,b,c){if(goog.isArrayLike(a))try{goog.array.forEach(a,b,c)}catch(d){if(d!==goog.iter.StopIteration)throw d;}else{a=goog.iter.toIterator(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==goog.iter.StopIteration)throw d;}}};goog.iter.filter=function(a,b,c){var d=goog.iter.toIterator(a);a=new goog.iter.Iterator;a.next=function(){for(;;){var a=d.next();if(b.call(c,a,void 0,d))return a}};return a};
|
|
goog.iter.filterFalse=function(a,b,c){return goog.iter.filter(a,goog.functions.not(b),c)};goog.iter.range=function(a,b,c){var d=0,e=a,f=c||1;1<arguments.length&&(d=a,e=+b);if(0==f)throw Error("Range step argument must not be zero");var g=new goog.iter.Iterator;g.next=function(){if(0<f&&d>=e||0>f&&d<=e)throw goog.iter.StopIteration;var a=d;d+=f;return a};return g};goog.iter.join=function(a,b){return goog.iter.toArray(a).join(b)};
|
|
goog.iter.map=function(a,b,c){var d=goog.iter.toIterator(a);a=new goog.iter.Iterator;a.next=function(){var a=d.next();return b.call(c,a,void 0,d)};return a};goog.iter.reduce=function(a,b,c,d){var e=c;goog.iter.forEach(a,function(a){e=b.call(d,e,a)});return e};goog.iter.some=function(a,b,c){a=goog.iter.toIterator(a);try{for(;;)if(b.call(c,a.next(),void 0,a))return!0}catch(d){if(d!==goog.iter.StopIteration)throw d;}return!1};
|
|
goog.iter.every=function(a,b,c){a=goog.iter.toIterator(a);try{for(;;)if(!b.call(c,a.next(),void 0,a))return!1}catch(d){if(d!==goog.iter.StopIteration)throw d;}return!0};goog.iter.chain=function(a){return goog.iter.chainFromIterable(arguments)};
|
|
goog.iter.chainFromIterable=function(a){var b=goog.iter.toIterator(a);a=new goog.iter.Iterator;var c=null;a.next=function(){for(;;){if(null==c){var a=b.next();c=goog.iter.toIterator(a)}try{return c.next()}catch(e){if(e!==goog.iter.StopIteration)throw e;c=null}}};return a};goog.iter.dropWhile=function(a,b,c){var d=goog.iter.toIterator(a);a=new goog.iter.Iterator;var e=!0;a.next=function(){for(;;){var a=d.next();if(!e||!b.call(c,a,void 0,d))return e=!1,a}};return a};
|
|
goog.iter.takeWhile=function(a,b,c){var d=goog.iter.toIterator(a);a=new goog.iter.Iterator;a.next=function(){var a=d.next();if(b.call(c,a,void 0,d))return a;throw goog.iter.StopIteration;};return a};goog.iter.toArray=function(a){if(goog.isArrayLike(a))return goog.array.toArray(a);a=goog.iter.toIterator(a);var b=[];goog.iter.forEach(a,function(a){b.push(a)});return b};
|
|
goog.iter.equals=function(a,b,c){a=goog.iter.zipLongest({},a,b);var d=c||goog.array.defaultCompareEquality;return goog.iter.every(a,function(a){return d(a[0],a[1])})};goog.iter.nextOrValue=function(a,b){try{return goog.iter.toIterator(a).next()}catch(c){if(c!=goog.iter.StopIteration)throw c;return b}};
|
|
goog.iter.product=function(a){if(goog.array.some(arguments,function(a){return!a.length})||!arguments.length)return new goog.iter.Iterator;var b=new goog.iter.Iterator,c=arguments,d=goog.array.repeat(0,c.length);b.next=function(){if(d){for(var a=goog.array.map(d,function(a,b){return c[b][a]}),b=d.length-1;0<=b;b--){goog.asserts.assert(d);if(d[b]<c[b].length-1){d[b]++;break}if(0==b){d=null;break}d[b]=0}return a}throw goog.iter.StopIteration;};return b};
|
|
goog.iter.cycle=function(a){var b=goog.iter.toIterator(a),c=[],d=0;a=new goog.iter.Iterator;var e=!1;a.next=function(){var a=null;if(!e)try{return a=b.next(),c.push(a),a}catch(g){if(g!=goog.iter.StopIteration||goog.array.isEmpty(c))throw g;e=!0}a=c[d];d=(d+1)%c.length;return a};return a};goog.iter.count=function(a,b){var c=a||0,d=void 0!==b?b:1,e=new goog.iter.Iterator;e.next=function(){var a=c;c+=d;return a};return e};
|
|
goog.iter.repeat=function(a){var b=new goog.iter.Iterator;b.next=goog.functions.constant(a);return b};goog.iter.accumulate=function(a){var b=goog.iter.toIterator(a),c=0;a=new goog.iter.Iterator;a.next=function(){return c+=b.next()};return a};goog.iter.zip=function(a){var b=arguments,c=new goog.iter.Iterator;if(0<b.length){var d=goog.array.map(b,goog.iter.toIterator);c.next=function(){return goog.array.map(d,function(a){return a.next()})}}return c};
|
|
goog.iter.zipLongest=function(a,b){var c=goog.array.slice(arguments,1),d=new goog.iter.Iterator;if(0<c.length){var e=goog.array.map(c,goog.iter.toIterator);d.next=function(){var b=!1,c=goog.array.map(e,function(c){try{var d=c.next();b=!0}catch(l){if(l!==goog.iter.StopIteration)throw l;d=a}return d});if(!b)throw goog.iter.StopIteration;return c}}return d};goog.iter.compress=function(a,b){var c=goog.iter.toIterator(b);return goog.iter.filter(a,function(){return!!c.next()})};
|
|
goog.iter.GroupByIterator_=function(a,b){this.iterator=goog.iter.toIterator(a);this.keyFunc=b||goog.functions.identity};goog.inherits(goog.iter.GroupByIterator_,goog.iter.Iterator);goog.iter.GroupByIterator_.prototype.next=function(){for(;this.currentKey==this.targetKey;)this.currentValue=this.iterator.next(),this.currentKey=this.keyFunc(this.currentValue);this.targetKey=this.currentKey;return[this.currentKey,this.groupItems_(this.targetKey)]};
|
|
goog.iter.GroupByIterator_.prototype.groupItems_=function(a){for(var b=[];this.currentKey==a;){b.push(this.currentValue);try{this.currentValue=this.iterator.next()}catch(c){if(c!==goog.iter.StopIteration)throw c;break}this.currentKey=this.keyFunc(this.currentValue)}return b};goog.iter.groupBy=function(a,b){return new goog.iter.GroupByIterator_(a,b)};
|
|
goog.iter.starMap=function(a,b,c){var d=goog.iter.toIterator(a);a=new goog.iter.Iterator;a.next=function(){var a=goog.iter.toArray(d.next());return b.apply(c,goog.array.concat(a,void 0,d))};return a};
|
|
goog.iter.tee=function(a,b){var c=goog.iter.toIterator(a),d=goog.array.map(goog.array.range("number"===typeof b?b:2),function(){return[]}),e=function(){var a=c.next();goog.array.forEach(d,function(b){b.push(a)})};return goog.array.map(d,function(a){var b=new goog.iter.Iterator;b.next=function(){goog.array.isEmpty(a)&&e();goog.asserts.assert(!goog.array.isEmpty(a));return a.shift()};return b})};goog.iter.enumerate=function(a,b){return goog.iter.zip(goog.iter.count(b),a)};
|
|
goog.iter.limit=function(a,b){goog.asserts.assert(goog.math.isInt(b)&&0<=b);var c=goog.iter.toIterator(a),d=new goog.iter.Iterator,e=b;d.next=function(){if(0<e--)return c.next();throw goog.iter.StopIteration;};return d};goog.iter.consume=function(a,b){goog.asserts.assert(goog.math.isInt(b)&&0<=b);for(var c=goog.iter.toIterator(a);0<b--;)goog.iter.nextOrValue(c,null);return c};
|
|
goog.iter.slice=function(a,b,c){goog.asserts.assert(goog.math.isInt(b)&&0<=b);a=goog.iter.consume(a,b);"number"===typeof c&&(goog.asserts.assert(goog.math.isInt(c)&&c>=b),a=goog.iter.limit(a,c-b));return a};goog.iter.hasDuplicates_=function(a){var b=[];goog.array.removeDuplicates(a,b);return a.length!=b.length};goog.iter.permutations=function(a,b){var c=goog.iter.toArray(a);c=goog.array.repeat(c,"number"===typeof b?b:c.length);c=goog.iter.product.apply(void 0,c);return goog.iter.filter(c,function(a){return!goog.iter.hasDuplicates_(a)})};
|
|
goog.iter.combinations=function(a,b){function c(a){return d[a]}var d=goog.iter.toArray(a),e=goog.iter.range(d.length);e=goog.iter.permutations(e,b);var f=goog.iter.filter(e,function(a){return goog.array.isSorted(a)});e=new goog.iter.Iterator;e.next=function(){return goog.array.map(f.next(),c)};return e};
|
|
goog.iter.combinationsWithReplacement=function(a,b){function c(a){return d[a]}var d=goog.iter.toArray(a),e=goog.array.range(d.length);e=goog.array.repeat(e,b);e=goog.iter.product.apply(void 0,e);var f=goog.iter.filter(e,function(a){return goog.array.isSorted(a)});e=new goog.iter.Iterator;e.next=function(){return goog.array.map(f.next(),c)};return e};goog.structs.Map=function(a,b){this.map_={};this.keys_=[];this.version_=this.count_=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.addAll(a)};goog.structs.Map.prototype.getCount=function(){return this.count_};goog.structs.Map.prototype.getValues=function(){this.cleanupKeysArray_();for(var a=[],b=0;b<this.keys_.length;b++)a.push(this.map_[this.keys_[b]]);return a};
|
|
goog.structs.Map.prototype.getKeys=function(){this.cleanupKeysArray_();return this.keys_.concat()};goog.structs.Map.prototype.containsKey=function(a){return goog.structs.Map.hasKey_(this.map_,a)};goog.structs.Map.prototype.containsValue=function(a){for(var b=0;b<this.keys_.length;b++){var c=this.keys_[b];if(goog.structs.Map.hasKey_(this.map_,c)&&this.map_[c]==a)return!0}return!1};
|
|
goog.structs.Map.prototype.equals=function(a,b){if(this===a)return!0;if(this.count_!=a.getCount())return!1;var c=b||goog.structs.Map.defaultEquals;this.cleanupKeysArray_();for(var d,e=0;d=this.keys_[e];e++)if(!c(this.get(d),a.get(d)))return!1;return!0};goog.structs.Map.defaultEquals=function(a,b){return a===b};goog.structs.Map.prototype.isEmpty=function(){return 0==this.count_};goog.structs.Map.prototype.clear=function(){this.map_={};this.version_=this.count_=this.keys_.length=0};
|
|
goog.structs.Map.prototype.remove=function(a){return goog.structs.Map.hasKey_(this.map_,a)?(delete this.map_[a],this.count_--,this.version_++,this.keys_.length>2*this.count_&&this.cleanupKeysArray_(),!0):!1};
|
|
goog.structs.Map.prototype.cleanupKeysArray_=function(){if(this.count_!=this.keys_.length){for(var a=0,b=0;a<this.keys_.length;){var c=this.keys_[a];goog.structs.Map.hasKey_(this.map_,c)&&(this.keys_[b++]=c);a++}this.keys_.length=b}if(this.count_!=this.keys_.length){var d={};for(b=a=0;a<this.keys_.length;)c=this.keys_[a],goog.structs.Map.hasKey_(d,c)||(this.keys_[b++]=c,d[c]=1),a++;this.keys_.length=b}};
|
|
goog.structs.Map.prototype.get=function(a,b){return goog.structs.Map.hasKey_(this.map_,a)?this.map_[a]:b};goog.structs.Map.prototype.set=function(a,b){goog.structs.Map.hasKey_(this.map_,a)||(this.count_++,this.keys_.push(a),this.version_++);this.map_[a]=b};goog.structs.Map.prototype.addAll=function(a){if(a instanceof goog.structs.Map)for(var b=a.getKeys(),c=0;c<b.length;c++)this.set(b[c],a.get(b[c]));else for(b in a)this.set(b,a[b])};
|
|
goog.structs.Map.prototype.forEach=function(a,b){for(var c=this.getKeys(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};goog.structs.Map.prototype.clone=function(){return new goog.structs.Map(this)};goog.structs.Map.prototype.transpose=function(){for(var a=new goog.structs.Map,b=0;b<this.keys_.length;b++){var c=this.keys_[b];a.set(this.map_[c],c)}return a};
|
|
goog.structs.Map.prototype.toObject=function(){this.cleanupKeysArray_();for(var a={},b=0;b<this.keys_.length;b++){var c=this.keys_[b];a[c]=this.map_[c]}return a};goog.structs.Map.prototype.getKeyIterator=function(){return this.__iterator__(!0)};goog.structs.Map.prototype.getValueIterator=function(){return this.__iterator__(!1)};
|
|
goog.structs.Map.prototype.__iterator__=function(a){this.cleanupKeysArray_();var b=0,c=this.version_,d=this,e=new goog.iter.Iterator;e.next=function(){if(c!=d.version_)throw Error("The map has changed since the iterator was created");if(b>=d.keys_.length)throw goog.iter.StopIteration;var e=d.keys_[b++];return a?e:d.map_[e]};return e};goog.structs.Map.hasKey_=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};goog.structs.Set=function(a){this.map_=new goog.structs.Map;a&&this.addAll(a)};goog.structs.Set.getUid_=goog.getUid;goog.structs.Set.getKey_=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+goog.structs.Set.getUid_(a):b.substr(0,1)+a};goog.structs.Set.prototype.getCount=function(){return this.map_.getCount()};goog.structs.Set.prototype.add=function(a){this.map_.set(goog.structs.Set.getKey_(a),a)};
|
|
goog.structs.Set.prototype.addAll=function(a){a=goog.structs.getValues(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};goog.structs.Set.prototype.removeAll=function(a){a=goog.structs.getValues(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};goog.structs.Set.prototype.remove=function(a){return this.map_.remove(goog.structs.Set.getKey_(a))};goog.structs.Set.prototype.clear=function(){this.map_.clear()};goog.structs.Set.prototype.isEmpty=function(){return this.map_.isEmpty()};
|
|
goog.structs.Set.prototype.contains=function(a){return this.map_.containsKey(goog.structs.Set.getKey_(a))};goog.structs.Set.prototype.containsAll=function(a){return goog.structs.every(a,this.contains,this)};goog.structs.Set.prototype.intersection=function(a){var b=new goog.structs.Set;a=goog.structs.getValues(a);for(var c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};goog.structs.Set.prototype.difference=function(a){var b=this.clone();b.removeAll(a);return b};
|
|
goog.structs.Set.prototype.getValues=function(){return this.map_.getValues()};goog.structs.Set.prototype.clone=function(){return new goog.structs.Set(this)};goog.structs.Set.prototype.equals=function(a){return this.getCount()==goog.structs.getCount(a)&&this.isSubsetOf(a)};
|
|
goog.structs.Set.prototype.isSubsetOf=function(a){var b=goog.structs.getCount(a);if(this.getCount()>b)return!1;!(a instanceof goog.structs.Set)&&5<b&&(a=new goog.structs.Set(a));return goog.structs.every(this,function(b){return goog.structs.contains(a,b)})};goog.structs.Set.prototype.__iterator__=function(a){return this.map_.__iterator__(!1)};goog.ui.PopupBase=function(a,b){goog.events.EventTarget.call(this);this.handler_=new goog.events.EventHandler(this);this.setElement(a||null);b&&this.setType(b)};goog.inherits(goog.ui.PopupBase,goog.events.EventTarget);goog.tagUnsealableClass(goog.ui.PopupBase);goog.ui.PopupBase.Type={TOGGLE_DISPLAY:"toggle_display",MOVE_OFFSCREEN:"move_offscreen"};goog.ui.PopupBase.prototype.element_=null;goog.ui.PopupBase.prototype.autoHide_=!0;goog.ui.PopupBase.prototype.autoHidePartners_=null;
|
|
goog.ui.PopupBase.prototype.autoHideRegion_=null;goog.ui.PopupBase.prototype.isVisible_=!1;goog.ui.PopupBase.prototype.shouldHideAsync_=!1;goog.ui.PopupBase.prototype.lastShowTime_=-1;goog.ui.PopupBase.prototype.lastHideTime_=-1;goog.ui.PopupBase.prototype.hideOnEscape_=!1;goog.ui.PopupBase.prototype.enableCrossIframeDismissal_=!0;goog.ui.PopupBase.prototype.type_=goog.ui.PopupBase.Type.TOGGLE_DISPLAY;goog.ui.PopupBase.EventType={BEFORE_SHOW:"beforeshow",SHOW:"show",BEFORE_HIDE:"beforehide",HIDE:"hide"};
|
|
goog.ui.PopupBase.DEBOUNCE_DELAY_MS=150;goog.ui.PopupBase.prototype.getType=function(){return this.type_};goog.ui.PopupBase.prototype.setType=function(a){this.type_=a};goog.ui.PopupBase.prototype.shouldHideAsync=function(){return this.shouldHideAsync_};goog.ui.PopupBase.prototype.setShouldHideAsync=function(a){this.shouldHideAsync_=a};goog.ui.PopupBase.prototype.getElement=function(){return this.element_};goog.ui.PopupBase.prototype.setElement=function(a){this.ensureNotVisible_();this.element_=a};
|
|
goog.ui.PopupBase.prototype.getAutoHide=function(){return this.autoHide_};goog.ui.PopupBase.prototype.setAutoHide=function(a){this.ensureNotVisible_();this.autoHide_=a};goog.ui.PopupBase.prototype.addAutoHidePartner=function(a){this.autoHidePartners_||(this.autoHidePartners_=[]);goog.array.insert(this.autoHidePartners_,a)};goog.ui.PopupBase.prototype.removeAutoHidePartner=function(a){this.autoHidePartners_&&goog.array.remove(this.autoHidePartners_,a)};goog.ui.PopupBase.prototype.getHideOnEscape=function(){return this.hideOnEscape_};
|
|
goog.ui.PopupBase.prototype.setHideOnEscape=function(a){this.ensureNotVisible_();this.hideOnEscape_=a};goog.ui.PopupBase.prototype.getEnableCrossIframeDismissal=function(){return this.enableCrossIframeDismissal_};goog.ui.PopupBase.prototype.setEnableCrossIframeDismissal=function(a){this.enableCrossIframeDismissal_=a};goog.ui.PopupBase.prototype.getAutoHideRegion=function(){return this.autoHideRegion_};goog.ui.PopupBase.prototype.setAutoHideRegion=function(a){this.autoHideRegion_=a};
|
|
goog.ui.PopupBase.prototype.setTransition=function(a,b){this.showTransition_=a;this.hideTransition_=b};goog.ui.PopupBase.prototype.getLastShowTime=function(){return this.lastShowTime_};goog.ui.PopupBase.prototype.getLastHideTime=function(){return this.lastHideTime_};goog.ui.PopupBase.prototype.getHandler=function(){return this.handler_};goog.ui.PopupBase.prototype.ensureNotVisible_=function(){if(this.isVisible_)throw Error("Can not change this state of the popup while showing.");};
|
|
goog.ui.PopupBase.prototype.isVisible=function(){return this.isVisible_};goog.ui.PopupBase.prototype.isOrWasRecentlyVisible=function(){return this.isVisible_||goog.now()-this.lastHideTime_<goog.ui.PopupBase.DEBOUNCE_DELAY_MS};goog.ui.PopupBase.prototype.setVisible=function(a){this.showTransition_&&this.showTransition_.stop();this.hideTransition_&&this.hideTransition_.stop();a?this.show_():this.hide_()};goog.ui.PopupBase.prototype.reposition=goog.nullFunction;
|
|
goog.ui.PopupBase.prototype.show_=function(){if(!this.isVisible_&&this.onBeforeShow()){if(!this.element_)throw Error("Caller must call setElement before trying to show the popup");this.reposition();var a=goog.dom.getOwnerDocument(this.element_);this.hideOnEscape_&&this.handler_.listen(a,goog.events.EventType.KEYDOWN,this.onDocumentKeyDown_,!0);if(this.autoHide_)if(this.handler_.listen(a,goog.events.EventType.MOUSEDOWN,this.onDocumentMouseDown_,!0),goog.userAgent.IE){try{var b=a.activeElement}catch(d){}for(;b&&
|
|
"IFRAME"==b.nodeName;){try{var c=goog.dom.getFrameContentDocument(b)}catch(d){break}a=c;b=a.activeElement}this.handler_.listen(a,goog.events.EventType.MOUSEDOWN,this.onDocumentMouseDown_,!0);this.handler_.listen(a,goog.events.EventType.DEACTIVATE,this.onDocumentBlur_)}else this.handler_.listen(a,goog.events.EventType.BLUR,this.onDocumentBlur_);this.type_==goog.ui.PopupBase.Type.TOGGLE_DISPLAY?this.showPopupElement():this.type_==goog.ui.PopupBase.Type.MOVE_OFFSCREEN&&this.reposition();this.isVisible_=
|
|
!0;this.lastShowTime_=goog.now();this.lastHideTime_=-1;if(this.showTransition_)goog.events.listenOnce(this.showTransition_,goog.fx.Transition.EventType.END,this.onShow,!1,this),this.showTransition_.play();else this.onShow()}};
|
|
goog.ui.PopupBase.prototype.hide_=function(a){if(!this.isVisible_||!this.onBeforeHide(a))return!1;this.handler_&&this.handler_.removeAll();this.isVisible_=!1;this.lastHideTime_=goog.now();this.hideTransition_?(goog.events.listenOnce(this.hideTransition_,goog.fx.Transition.EventType.END,goog.partial(this.continueHidingPopup_,a),!1,this),this.hideTransition_.play()):this.continueHidingPopup_(a);return!0};
|
|
goog.ui.PopupBase.prototype.continueHidingPopup_=function(a){this.type_==goog.ui.PopupBase.Type.TOGGLE_DISPLAY?this.shouldHideAsync_?goog.Timer.callOnce(this.hidePopupElement,0,this):this.hidePopupElement():this.type_==goog.ui.PopupBase.Type.MOVE_OFFSCREEN&&this.moveOffscreen_();this.onHide(a)};goog.ui.PopupBase.prototype.showPopupElement=function(){this.element_.style.visibility="visible";goog.style.setElementShown(this.element_,!0)};
|
|
goog.ui.PopupBase.prototype.hidePopupElement=function(){this.element_.style.visibility="hidden";goog.style.setElementShown(this.element_,!1)};goog.ui.PopupBase.prototype.moveOffscreen_=function(){this.element_.style.top="-10000px"};goog.ui.PopupBase.prototype.onBeforeShow=function(){return this.dispatchEvent(goog.ui.PopupBase.EventType.BEFORE_SHOW)};goog.ui.PopupBase.prototype.onShow=function(){this.dispatchEvent(goog.ui.PopupBase.EventType.SHOW)};
|
|
goog.ui.PopupBase.prototype.onBeforeHide=function(a){return this.dispatchEvent({type:goog.ui.PopupBase.EventType.BEFORE_HIDE,target:a})};goog.ui.PopupBase.prototype.onHide=function(a){this.dispatchEvent({type:goog.ui.PopupBase.EventType.HIDE,target:a})};goog.ui.PopupBase.prototype.onDocumentMouseDown_=function(a){a=a.target;goog.dom.contains(this.element_,a)||this.isOrWithinAutoHidePartner_(a)||!this.isWithinAutoHideRegion_(a)||this.shouldDebounce_()||this.hide_(a)};
|
|
goog.ui.PopupBase.prototype.onDocumentKeyDown_=function(a){a.keyCode==goog.events.KeyCodes.ESC&&this.hide_(a.target)&&(a.preventDefault(),a.stopPropagation())};goog.ui.PopupBase.prototype.onDocumentBlur_=function(a){if(this.enableCrossIframeDismissal_){var b=goog.dom.getOwnerDocument(this.element_);if("undefined"!=typeof document.activeElement){if(a=b.activeElement,!a||goog.dom.contains(this.element_,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;this.shouldDebounce_()||this.hide_()}};
|
|
goog.ui.PopupBase.prototype.isOrWithinAutoHidePartner_=function(a){return goog.array.some(this.autoHidePartners_||[],function(b){return a===b||goog.dom.contains(b,a)})};goog.ui.PopupBase.prototype.isWithinAutoHideRegion_=function(a){return this.autoHideRegion_?goog.dom.contains(this.autoHideRegion_,a):!0};goog.ui.PopupBase.prototype.shouldDebounce_=function(){return goog.now()-this.lastShowTime_<goog.ui.PopupBase.DEBOUNCE_DELAY_MS};
|
|
goog.ui.PopupBase.prototype.disposeInternal=function(){goog.ui.PopupBase.superClass_.disposeInternal.call(this);this.handler_.dispose();goog.dispose(this.showTransition_);goog.dispose(this.hideTransition_);delete this.element_;delete this.handler_;delete this.autoHidePartners_};goog.ui.Popup=function(a,b){this.popupCorner_=goog.positioning.Corner.TOP_START;this.position_=b||void 0;goog.ui.PopupBase.call(this,a)};goog.inherits(goog.ui.Popup,goog.ui.PopupBase);goog.tagUnsealableClass(goog.ui.Popup);goog.ui.Popup.prototype.getPinnedCorner=function(){return this.popupCorner_};goog.ui.Popup.prototype.setPinnedCorner=function(a){this.popupCorner_=a;this.isVisible()&&this.reposition()};goog.ui.Popup.prototype.getPosition=function(){return this.position_||null};
|
|
goog.ui.Popup.prototype.setPosition=function(a){this.position_=a||void 0;this.isVisible()&&this.reposition()};goog.ui.Popup.prototype.getMargin=function(){return this.margin_||null};goog.ui.Popup.prototype.setMargin=function(a,b,c,d){this.margin_=null==a||a instanceof goog.math.Box?a:new goog.math.Box(a,b,c,d);this.isVisible()&&this.reposition()};
|
|
goog.ui.Popup.prototype.reposition=function(){if(this.position_){var a=!this.isVisible()&&this.getType()!=goog.ui.PopupBase.Type.MOVE_OFFSCREEN,b=this.getElement();a&&(b.style.visibility="hidden",goog.style.setElementShown(b,!0));this.position_.reposition(b,this.popupCorner_,this.margin_);a&&goog.style.setElementShown(b,!1)}};goog.ui.Tooltip=function(a,b,c){this.dom_=c||(a?goog.dom.getDomHelper(goog.dom.getElement(a)):goog.dom.getDomHelper());goog.ui.Popup.call(this,this.dom_.createDom("DIV",{style:"position:absolute;display:none;"}));this.cursorPosition=new goog.math.Coordinate(1,1);this.elements_=new goog.structs.Set;this.tooltipFocusHandler_=null;a&&this.attach(a);null!=b&&this.setText(b)};goog.inherits(goog.ui.Tooltip,goog.ui.Popup);goog.tagUnsealableClass(goog.ui.Tooltip);goog.ui.Tooltip.activeInstances_=[];
|
|
goog.ui.Tooltip.prototype.activeEl_=null;goog.ui.Tooltip.prototype.className="goog-tooltip";goog.ui.Tooltip.prototype.showDelayMs_=500;goog.ui.Tooltip.prototype.hideDelayMs_=0;goog.ui.Tooltip.State={INACTIVE:0,WAITING_TO_SHOW:1,SHOWING:2,WAITING_TO_HIDE:3,UPDATING:4};goog.ui.Tooltip.Activation={CURSOR:0,FOCUS:1};goog.ui.Tooltip.prototype.getDomHelper=function(){return this.dom_};goog.ui.Tooltip.prototype.getChildTooltip=function(){return this.childTooltip_};
|
|
goog.ui.Tooltip.prototype.attach=function(a){a=goog.dom.getElement(a);this.elements_.add(a);goog.events.listen(a,goog.events.EventType.MOUSEOVER,this.handleMouseOver,!1,this);goog.events.listen(a,goog.events.EventType.MOUSEOUT,this.handleMouseOutAndBlur,!1,this);goog.events.listen(a,goog.events.EventType.MOUSEMOVE,this.handleMouseMove,!1,this);goog.events.listen(a,goog.events.EventType.FOCUS,this.handleFocus,!1,this);goog.events.listen(a,goog.events.EventType.BLUR,this.handleMouseOutAndBlur,!1,this)};
|
|
goog.ui.Tooltip.prototype.detach=function(a){if(a)a=goog.dom.getElement(a),this.detachElement_(a),this.elements_.remove(a);else{for(var b=this.elements_.getValues(),c=0;a=b[c];c++)this.detachElement_(a);this.elements_.clear()}};
|
|
goog.ui.Tooltip.prototype.detachElement_=function(a){goog.events.unlisten(a,goog.events.EventType.MOUSEOVER,this.handleMouseOver,!1,this);goog.events.unlisten(a,goog.events.EventType.MOUSEOUT,this.handleMouseOutAndBlur,!1,this);goog.events.unlisten(a,goog.events.EventType.MOUSEMOVE,this.handleMouseMove,!1,this);goog.events.unlisten(a,goog.events.EventType.FOCUS,this.handleFocus,!1,this);goog.events.unlisten(a,goog.events.EventType.BLUR,this.handleMouseOutAndBlur,!1,this)};
|
|
goog.ui.Tooltip.prototype.setShowDelayMs=function(a){this.showDelayMs_=a};goog.ui.Tooltip.prototype.getShowDelayMs=function(){return this.showDelayMs_};goog.ui.Tooltip.prototype.setHideDelayMs=function(a){this.hideDelayMs_=a};goog.ui.Tooltip.prototype.getHideDelayMs=function(){return this.hideDelayMs_};goog.ui.Tooltip.prototype.setText=function(a){goog.dom.setTextContent(this.getElement(),a)};
|
|
goog.ui.Tooltip.prototype.setSafeHtml=function(a){var b=this.getElement();b&&goog.dom.safe.setInnerHtml(b,a)};goog.ui.Tooltip.prototype.setElement=function(a){var b=this.getElement();b&&goog.dom.removeNode(b);goog.ui.Tooltip.superClass_.setElement.call(this,a);a?(b=this.dom_.getDocument().body,b.insertBefore(a,b.lastChild),this.registerContentFocusEvents_()):(goog.dispose(this.tooltipFocusHandler_),this.tooltipFocusHandler_=null)};
|
|
goog.ui.Tooltip.prototype.registerContentFocusEvents_=function(){goog.dispose(this.tooltipFocusHandler_);this.tooltipFocusHandler_=new goog.events.FocusHandler(goog.asserts.assert(this.getElement()));this.registerDisposable(this.tooltipFocusHandler_);goog.events.listen(this.tooltipFocusHandler_,goog.events.FocusHandler.EventType.FOCUSIN,this.clearHideTimer,void 0,this);goog.events.listen(this.tooltipFocusHandler_,goog.events.FocusHandler.EventType.FOCUSOUT,this.startHideTimer,void 0,this)};
|
|
goog.ui.Tooltip.prototype.getText=function(){return goog.dom.getTextContent(this.getElement())};goog.ui.Tooltip.prototype.getHtml=function(){return this.getElement().innerHTML};goog.ui.Tooltip.prototype.getState=function(){return this.showTimer?this.isVisible()?goog.ui.Tooltip.State.UPDATING:goog.ui.Tooltip.State.WAITING_TO_SHOW:this.hideTimer?goog.ui.Tooltip.State.WAITING_TO_HIDE:this.isVisible()?goog.ui.Tooltip.State.SHOWING:goog.ui.Tooltip.State.INACTIVE};
|
|
goog.ui.Tooltip.prototype.setRequireInteraction=function(a){this.requireInteraction_=a};goog.ui.Tooltip.prototype.isCoordinateInTooltip=function(a){if(!this.isVisible())return!1;var b=goog.style.getPageOffset(this.getElement()),c=goog.style.getSize(this.getElement());return b.x<=a.x&&a.x<=b.x+c.width&&b.y<=a.y&&a.y<=b.y+c.height};
|
|
goog.ui.Tooltip.prototype.onBeforeShow=function(){if(!goog.ui.PopupBase.prototype.onBeforeShow.call(this))return!1;if(this.anchor)for(var a,b=0;a=goog.ui.Tooltip.activeInstances_[b];b++)goog.dom.contains(a.getElement(),this.anchor)||a.setVisible(!1);goog.array.insert(goog.ui.Tooltip.activeInstances_,this);a=this.getElement();a.className=this.className;this.clearHideTimer();goog.events.listen(a,goog.events.EventType.MOUSEOVER,this.handleTooltipMouseOver,!1,this);goog.events.listen(a,goog.events.EventType.MOUSEOUT,
|
|
this.handleTooltipMouseOut,!1,this);this.clearShowTimer();return!0};
|
|
goog.ui.Tooltip.prototype.onHide=function(){goog.array.remove(goog.ui.Tooltip.activeInstances_,this);for(var a=this.getElement(),b,c=0;b=goog.ui.Tooltip.activeInstances_[c];c++)b.anchor&&goog.dom.contains(a,b.anchor)&&b.setVisible(!1);this.parentTooltip_&&this.parentTooltip_.startHideTimer();goog.events.unlisten(a,goog.events.EventType.MOUSEOVER,this.handleTooltipMouseOver,!1,this);goog.events.unlisten(a,goog.events.EventType.MOUSEOUT,this.handleTooltipMouseOut,!1,this);this.anchor=void 0;this.getState()==
|
|
goog.ui.Tooltip.State.INACTIVE&&(this.seenInteraction_=!1);goog.ui.PopupBase.prototype.onHide.call(this)};goog.ui.Tooltip.prototype.maybeShow=function(a,b){this.anchor==a&&this.elements_.contains(this.anchor)&&(this.seenInteraction_||!this.requireInteraction_?(this.setVisible(!1),this.isVisible()||this.positionAndShow_(a,b)):this.anchor=void 0);this.showTimer=void 0};goog.ui.Tooltip.prototype.getElements=function(){return this.elements_};goog.ui.Tooltip.prototype.getActiveElement=function(){return this.activeEl_};
|
|
goog.ui.Tooltip.prototype.setActiveElement=function(a){this.activeEl_=a};goog.ui.Tooltip.prototype.showForElement=function(a,b){this.attach(a);this.activeEl_=a;this.positionAndShow_(a,b)};goog.ui.Tooltip.prototype.positionAndShow_=function(a,b){this.anchor=a;this.setPosition(b||this.getPositioningStrategy(goog.ui.Tooltip.Activation.CURSOR));this.setVisible(!0)};
|
|
goog.ui.Tooltip.prototype.maybeHide=function(a){this.hideTimer=void 0;if(a==this.anchor){a=this.getDomHelper();var b=a.getActiveElement();a=b&&this.getElement()&&a.contains(this.getElement(),b);null!=this.activeEl_&&(this.activeEl_==this.getElement()||this.elements_.contains(this.activeEl_))||a||this.hasActiveChild()||this.setVisible(!1)}};goog.ui.Tooltip.prototype.hasActiveChild=function(){return!(!this.childTooltip_||!this.childTooltip_.activeEl_)};
|
|
goog.ui.Tooltip.prototype.saveCursorPosition_=function(a){var b=this.dom_.getDocumentScroll();this.cursorPosition.x=a.clientX+b.x;this.cursorPosition.y=a.clientY+b.y};goog.ui.Tooltip.prototype.handleMouseOver=function(a){var b=this.getAnchorFromElement(a.target);this.activeEl_=b;this.clearHideTimer();b!=this.anchor&&(this.anchor=b,this.startShowTimer(b),this.checkForParentTooltip_(),this.saveCursorPosition_(a))};
|
|
goog.ui.Tooltip.prototype.getAnchorFromElement=function(a){try{for(;a&&!this.elements_.contains(a);)a=a.parentNode;return a}catch(b){return null}};goog.ui.Tooltip.prototype.handleMouseMove=function(a){this.saveCursorPosition_(a);this.seenInteraction_=!0};
|
|
goog.ui.Tooltip.prototype.handleFocus=function(a){this.activeEl_=a=this.getAnchorFromElement(a.target);this.seenInteraction_=!0;if(this.anchor!=a){this.anchor=a;var b=this.getPositioningStrategy(goog.ui.Tooltip.Activation.FOCUS);this.clearHideTimer();this.startShowTimer(a,b);this.checkForParentTooltip_()}};goog.ui.Tooltip.prototype.getPositioningStrategy=function(a){return a==goog.ui.Tooltip.Activation.CURSOR?(a=this.cursorPosition.clone(),new goog.ui.Tooltip.CursorTooltipPosition(a)):new goog.ui.Tooltip.ElementTooltipPosition(this.activeEl_)};
|
|
goog.ui.Tooltip.prototype.checkForParentTooltip_=function(){if(this.anchor)for(var a,b=0;a=goog.ui.Tooltip.activeInstances_[b];b++)goog.dom.contains(a.getElement(),this.anchor)&&(a.childTooltip_=this,this.parentTooltip_=a)};
|
|
goog.ui.Tooltip.prototype.handleMouseOutAndBlur=function(a){var b=this.getAnchorFromElement(a.target),c=this.getAnchorFromElement(a.relatedTarget);b!=c&&(b==this.activeEl_&&(this.activeEl_=null),this.clearShowTimer(),this.seenInteraction_=!1,!this.isVisible()||a.relatedTarget&&goog.dom.contains(this.getElement(),a.relatedTarget)?this.anchor=void 0:this.startHideTimer())};
|
|
goog.ui.Tooltip.prototype.handleTooltipMouseOver=function(a){a=this.getElement();this.activeEl_!=a&&(this.clearHideTimer(),this.activeEl_=a)};goog.ui.Tooltip.prototype.handleTooltipMouseOut=function(a){var b=this.getElement();this.activeEl_!=b||a.relatedTarget&&goog.dom.contains(b,a.relatedTarget)||(this.activeEl_=null,this.startHideTimer())};goog.ui.Tooltip.prototype.startShowTimer=function(a,b){this.showTimer||(this.showTimer=goog.Timer.callOnce(goog.bind(this.maybeShow,this,a,b),this.showDelayMs_))};
|
|
goog.ui.Tooltip.prototype.clearShowTimer=function(){this.showTimer&&(goog.Timer.clear(this.showTimer),this.showTimer=void 0)};goog.ui.Tooltip.prototype.startHideTimer=function(){this.getState()==goog.ui.Tooltip.State.SHOWING&&(this.hideTimer=goog.Timer.callOnce(goog.bind(this.maybeHide,this,this.anchor),this.getHideDelayMs()))};goog.ui.Tooltip.prototype.clearHideTimer=function(){this.hideTimer&&(goog.Timer.clear(this.hideTimer),this.hideTimer=void 0)};
|
|
goog.ui.Tooltip.prototype.disposeInternal=function(){this.setVisible(!1);this.clearShowTimer();this.detach();this.getElement()&&goog.dom.removeNode(this.getElement());this.activeEl_=null;delete this.dom_;goog.ui.Tooltip.superClass_.disposeInternal.call(this)};goog.ui.Tooltip.CursorTooltipPosition=function(a,b){goog.positioning.ViewportPosition.call(this,a,b)};goog.inherits(goog.ui.Tooltip.CursorTooltipPosition,goog.positioning.ViewportPosition);
|
|
goog.ui.Tooltip.CursorTooltipPosition.prototype.reposition=function(a,b,c){b=goog.style.getClientViewportElement(a);b=goog.style.getVisibleRectForElement(b);c=c?new goog.math.Box(c.top+10,c.right,c.bottom,c.left+10):new goog.math.Box(10,0,0,10);goog.positioning.positionAtCoordinate(this.coordinate,a,goog.positioning.Corner.TOP_START,c,b,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.FAIL_Y)&goog.positioning.OverflowStatus.FAILED&&goog.positioning.positionAtCoordinate(this.coordinate,
|
|
a,goog.positioning.Corner.TOP_START,c,b,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.ADJUST_Y)};goog.ui.Tooltip.ElementTooltipPosition=function(a){goog.positioning.AnchoredPosition.call(this,a,goog.positioning.Corner.BOTTOM_RIGHT)};goog.inherits(goog.ui.Tooltip.ElementTooltipPosition,goog.positioning.AnchoredPosition);
|
|
goog.ui.Tooltip.ElementTooltipPosition.prototype.reposition=function(a,b,c){var d=new goog.math.Coordinate(10,0);goog.positioning.positionAtAnchor(this.element,this.corner,a,b,d,c,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.FAIL_Y)&goog.positioning.OverflowStatus.FAILED&&goog.positioning.positionAtAnchor(this.element,goog.positioning.Corner.TOP_RIGHT,a,goog.positioning.Corner.BOTTOM_LEFT,d,c,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.ADJUST_Y)};goog.ui.ButtonSide={NONE:0,START:1,END:2,BOTH:3};goog.ui.ButtonRenderer=function(){goog.ui.ControlRenderer.call(this)};goog.inherits(goog.ui.ButtonRenderer,goog.ui.ControlRenderer);goog.addSingletonGetter(goog.ui.ButtonRenderer);goog.ui.ButtonRenderer.CSS_CLASS="goog-button";goog.ui.ButtonRenderer.prototype.getAriaRole=function(){return goog.a11y.aria.Role.BUTTON};
|
|
goog.ui.ButtonRenderer.prototype.updateAriaState=function(a,b,c){switch(b){case goog.ui.Component.State.SELECTED:case goog.ui.Component.State.CHECKED:goog.asserts.assert(a,"The button DOM element cannot be null.");goog.a11y.aria.setState(a,goog.a11y.aria.State.PRESSED,c);break;default:case goog.ui.Component.State.OPENED:case goog.ui.Component.State.DISABLED:goog.ui.ButtonRenderer.superClass_.updateAriaState.call(this,a,b,c)}};
|
|
goog.ui.ButtonRenderer.prototype.createDom=function(a){var b=goog.ui.ButtonRenderer.superClass_.createDom.call(this,a);this.setTooltip(b,a.getTooltip());var c=a.getValue();c&&this.setValue(b,c);a.isSupportedState(goog.ui.Component.State.CHECKED)&&this.updateAriaState(b,goog.ui.Component.State.CHECKED,a.isChecked());return b};
|
|
goog.ui.ButtonRenderer.prototype.decorate=function(a,b){b=goog.ui.ButtonRenderer.superClass_.decorate.call(this,a,b);a.setValueInternal(this.getValue(b));a.setTooltipInternal(this.getTooltip(b));a.isSupportedState(goog.ui.Component.State.CHECKED)&&this.updateAriaState(b,goog.ui.Component.State.CHECKED,a.isChecked());return b};goog.ui.ButtonRenderer.prototype.getValue=goog.nullFunction;goog.ui.ButtonRenderer.prototype.setValue=goog.nullFunction;goog.ui.ButtonRenderer.prototype.getTooltip=function(a){return a.title};
|
|
goog.ui.ButtonRenderer.prototype.setTooltip=function(a,b){a&&(b?a.title=b:a.removeAttribute("title"))};goog.ui.ButtonRenderer.prototype.setCollapsed=function(a,b){var c=a.isRightToLeft(),d=this.getStructuralCssClass()+"-collapse-left",e=this.getStructuralCssClass()+"-collapse-right";a.enableClassName(c?e:d,!!(b&goog.ui.ButtonSide.START));a.enableClassName(c?d:e,!!(b&goog.ui.ButtonSide.END))};goog.ui.ButtonRenderer.prototype.getCssClass=function(){return goog.ui.ButtonRenderer.CSS_CLASS};goog.dom.InputType={BUTTON:"button",CHECKBOX:"checkbox",COLOR:"color",DATE:"date",DATETIME:"datetime",DATETIME_LOCAL:"datetime-local",EMAIL:"email",FILE:"file",HIDDEN:"hidden",IMAGE:"image",MENU:"menu",MONTH:"month",NUMBER:"number",PASSWORD:"password",RADIO:"radio",RANGE:"range",RESET:"reset",SEARCH:"search",SELECT_MULTIPLE:"select-multiple",SELECT_ONE:"select-one",SUBMIT:"submit",TEL:"tel",TEXT:"text",TEXTAREA:"textarea",TIME:"time",URL:"url",WEEK:"week"};goog.ui.NativeButtonRenderer=function(){goog.ui.ButtonRenderer.call(this)};goog.inherits(goog.ui.NativeButtonRenderer,goog.ui.ButtonRenderer);goog.addSingletonGetter(goog.ui.NativeButtonRenderer);goog.ui.NativeButtonRenderer.prototype.getAriaRole=function(){};
|
|
goog.ui.NativeButtonRenderer.prototype.createDom=function(a){this.setUpNativeButton_(a);return a.getDomHelper().createDom("BUTTON",{"class":this.getClassNames(a).join(" "),disabled:!a.isEnabled(),title:a.getTooltip()||"",value:a.getValue()||""},a.getCaption()||"")};goog.ui.NativeButtonRenderer.prototype.canDecorate=function(a){return"BUTTON"==a.tagName||"INPUT"==a.tagName&&(a.type==goog.dom.InputType.BUTTON||a.type==goog.dom.InputType.SUBMIT||a.type==goog.dom.InputType.RESET)};
|
|
goog.ui.NativeButtonRenderer.prototype.decorate=function(a,b){this.setUpNativeButton_(a);if(b.disabled){var c=goog.asserts.assertString(this.getClassForState(goog.ui.Component.State.DISABLED));goog.dom.classlist.add(b,c)}return goog.ui.NativeButtonRenderer.superClass_.decorate.call(this,a,b)};goog.ui.NativeButtonRenderer.prototype.initializeDom=function(a){a.getHandler().listen(a.getElement(),goog.events.EventType.CLICK,a.performActionInternal)};
|
|
goog.ui.NativeButtonRenderer.prototype.setAllowTextSelection=goog.nullFunction;goog.ui.NativeButtonRenderer.prototype.setRightToLeft=goog.nullFunction;goog.ui.NativeButtonRenderer.prototype.isFocusable=function(a){return a.isEnabled()};goog.ui.NativeButtonRenderer.prototype.setFocusable=goog.nullFunction;
|
|
goog.ui.NativeButtonRenderer.prototype.setState=function(a,b,c){goog.ui.NativeButtonRenderer.superClass_.setState.call(this,a,b,c);(a=a.getElement())&&b==goog.ui.Component.State.DISABLED&&(a.disabled=c)};goog.ui.NativeButtonRenderer.prototype.getValue=function(a){return a.value};goog.ui.NativeButtonRenderer.prototype.setValue=function(a,b){a&&(a.value=b)};goog.ui.NativeButtonRenderer.prototype.updateAriaState=goog.nullFunction;
|
|
goog.ui.NativeButtonRenderer.prototype.setUpNativeButton_=function(a){a.setHandleMouseEvents(!1);a.setAutoStates(goog.ui.Component.State.ALL,!1);a.setSupportedState(goog.ui.Component.State.FOCUSED,!1)};goog.ui.Button=function(a,b,c){goog.ui.Control.call(this,a,b||goog.ui.NativeButtonRenderer.getInstance(),c)};goog.inherits(goog.ui.Button,goog.ui.Control);goog.tagUnsealableClass(goog.ui.Button);goog.ui.Button.Side=goog.ui.ButtonSide;goog.ui.Button.prototype.getValue=function(){return this.value_};goog.ui.Button.prototype.setValue=function(a){this.value_=a;this.getRenderer().setValue(this.getElement(),a)};goog.ui.Button.prototype.setValueInternal=function(a){this.value_=a};
|
|
goog.ui.Button.prototype.getTooltip=function(){return this.tooltip_};goog.ui.Button.prototype.setTooltip=function(a){this.tooltip_=a;this.getRenderer().setTooltip(this.getElement(),a)};goog.ui.Button.prototype.setTooltipInternal=function(a){this.tooltip_=a};goog.ui.Button.prototype.setCollapsed=function(a){this.getRenderer().setCollapsed(this,a)};goog.ui.Button.prototype.disposeInternal=function(){goog.ui.Button.superClass_.disposeInternal.call(this);delete this.value_;delete this.tooltip_};
|
|
goog.ui.Button.prototype.enterDocument=function(){goog.ui.Button.superClass_.enterDocument.call(this);if(this.isSupportedState(goog.ui.Component.State.FOCUSED)){var a=this.getKeyEventTarget();a&&this.getHandler().listen(a,goog.events.EventType.KEYUP,this.handleKeyEventInternal)}};
|
|
goog.ui.Button.prototype.handleKeyEventInternal=function(a){return a.keyCode==goog.events.KeyCodes.ENTER&&a.type==goog.events.KeyHandler.EventType.KEY||a.keyCode==goog.events.KeyCodes.SPACE&&a.type==goog.events.EventType.KEYUP?this.performActionInternal(a):a.keyCode==goog.events.KeyCodes.SPACE};goog.ui.registry.setDecoratorByClassName(goog.ui.ButtonRenderer.CSS_CLASS,function(){return new goog.ui.Button(null)});goog.ui.INLINE_BLOCK_CLASSNAME="goog-inline-block";goog.ui.CustomButtonRenderer=function(){goog.ui.ButtonRenderer.call(this)};goog.inherits(goog.ui.CustomButtonRenderer,goog.ui.ButtonRenderer);goog.addSingletonGetter(goog.ui.CustomButtonRenderer);goog.ui.CustomButtonRenderer.CSS_CLASS="goog-custom-button";
|
|
goog.ui.CustomButtonRenderer.prototype.createDom=function(a){var b=this.getClassNames(a);b=a.getDomHelper().createDom("DIV",goog.ui.INLINE_BLOCK_CLASSNAME+" "+b.join(" "),this.createButton(a.getContent(),a.getDomHelper()));this.setTooltip(b,a.getTooltip());return b};goog.ui.CustomButtonRenderer.prototype.getAriaRole=function(){return goog.a11y.aria.Role.BUTTON};goog.ui.CustomButtonRenderer.prototype.getContentElement=function(a){return a&&a.firstChild&&a.firstChild.firstChild};
|
|
goog.ui.CustomButtonRenderer.prototype.createButton=function(a,b){return b.createDom("DIV",goog.ui.INLINE_BLOCK_CLASSNAME+" "+(this.getCssClass()+"-outer-box"),b.createDom("DIV",goog.ui.INLINE_BLOCK_CLASSNAME+" "+(this.getCssClass()+"-inner-box"),a))};goog.ui.CustomButtonRenderer.prototype.canDecorate=function(a){return"DIV"==a.tagName};
|
|
goog.ui.CustomButtonRenderer.prototype.hasBoxStructure=function(a,b){var c=a.getDomHelper().getFirstElementChild(b),d=this.getCssClass()+"-outer-box";return c&&goog.dom.classlist.contains(c,d)&&(c=a.getDomHelper().getFirstElementChild(c),d=this.getCssClass()+"-inner-box",c&&goog.dom.classlist.contains(c,d))?!0:!1};
|
|
goog.ui.CustomButtonRenderer.prototype.decorate=function(a,b){goog.asserts.assert(b);goog.ui.CustomButtonRenderer.trimTextNodes_(b,!0);goog.ui.CustomButtonRenderer.trimTextNodes_(b,!1);this.hasBoxStructure(a,b)||b.appendChild(this.createButton(b.childNodes,a.getDomHelper()));goog.dom.classlist.addAll(b,[goog.ui.INLINE_BLOCK_CLASSNAME,this.getCssClass()]);return goog.ui.CustomButtonRenderer.superClass_.decorate.call(this,a,b)};goog.ui.CustomButtonRenderer.prototype.getCssClass=function(){return goog.ui.CustomButtonRenderer.CSS_CLASS};
|
|
goog.ui.CustomButtonRenderer.trimTextNodes_=function(a,b){if(a)for(var c=b?a.firstChild:a.lastChild,d;c&&c.parentNode==a;){d=b?c.nextSibling:c.previousSibling;if(c.nodeType==goog.dom.NodeType.TEXT){var e=c.nodeValue;if(""==goog.string.trim(e))a.removeChild(c);else{c.nodeValue=b?goog.string.trimLeft(e):goog.string.trimRight(e);break}}else break;c=d}};goog.ui.CustomButton=function(a,b,c){goog.ui.Button.call(this,a,b||goog.ui.CustomButtonRenderer.getInstance(),c)};goog.inherits(goog.ui.CustomButton,goog.ui.Button);goog.ui.registry.setDecoratorByClassName(goog.ui.CustomButtonRenderer.CSS_CLASS,function(){return new goog.ui.CustomButton(null)});goog.string.StringBuffer=function(a,b){null!=a&&this.append.apply(this,arguments)};goog.string.StringBuffer.prototype.buffer_="";goog.string.StringBuffer.prototype.set=function(a){this.buffer_=""+a};goog.string.StringBuffer.prototype.append=function(a,b,c){this.buffer_+=String(a);if(null!=b)for(var d=1;d<arguments.length;d++)this.buffer_+=arguments[d];return this};goog.string.StringBuffer.prototype.clear=function(){this.buffer_=""};goog.string.StringBuffer.prototype.getLength=function(){return this.buffer_.length};
|
|
goog.string.StringBuffer.prototype.toString=function(){return this.buffer_};goog.ui.tree={};goog.ui.tree.BaseNode=function(a,b,c){goog.ui.Component.call(this,c);this.config_=b||goog.ui.tree.BaseNode.defaultConfig;this.html_=goog.html.SafeHtml.htmlEscapePreservingNewlines(a);this.expanded_=this.selected_=!1;this.toolTip_=null;this.afterLabelHtml_=goog.html.SafeHtml.EMPTY;this.isUserCollapsible_=!0;this.depth_=-1};goog.inherits(goog.ui.tree.BaseNode,goog.ui.Component);
|
|
goog.ui.tree.BaseNode.EventType={BEFORE_EXPAND:"beforeexpand",EXPAND:"expand",BEFORE_COLLAPSE:"beforecollapse",COLLAPSE:"collapse"};goog.ui.tree.BaseNode.allNodes={};goog.ui.tree.BaseNode.prototype.disposeInternal=function(){goog.ui.tree.BaseNode.superClass_.disposeInternal.call(this);this.tree&&(this.tree.removeNode(this),this.tree=null);this.setElementInternal(null)};
|
|
goog.ui.tree.BaseNode.prototype.initAccessibility=function(){var a=this.getElement();if(a){var b=this.getLabelElement();b&&!b.id&&(b.id=this.getId()+".label");goog.a11y.aria.setRole(a,"treeitem");goog.a11y.aria.setState(a,"selected",!1);goog.a11y.aria.setState(a,"level",this.getDepth());b&&goog.a11y.aria.setState(a,"labelledby",b.id);(b=this.getIconElement())&&goog.a11y.aria.setRole(b,"presentation");(b=this.getExpandIconElement())&&goog.a11y.aria.setRole(b,"presentation");if(b=this.getChildrenElement())if(goog.a11y.aria.setRole(b,
|
|
"group"),b.hasChildNodes())for(goog.a11y.aria.setState(a,goog.a11y.aria.State.EXPANDED,!1),a=this.getChildCount(),b=1;b<=a;b++){var c=this.getChildAt(b-1).getElement();goog.asserts.assert(c,"The child element cannot be null");goog.a11y.aria.setState(c,"setsize",a);goog.a11y.aria.setState(c,"posinset",b)}}};goog.ui.tree.BaseNode.prototype.createDom=function(){var a=this.getDomHelper().safeHtmlToNode(this.toSafeHtml());this.setElementInternal(a)};
|
|
goog.ui.tree.BaseNode.prototype.enterDocument=function(){goog.ui.tree.BaseNode.superClass_.enterDocument.call(this);goog.ui.tree.BaseNode.allNodes[this.getId()]=this;this.initAccessibility()};goog.ui.tree.BaseNode.prototype.exitDocument=function(){goog.ui.tree.BaseNode.superClass_.exitDocument.call(this);delete goog.ui.tree.BaseNode.allNodes[this.getId()]};
|
|
goog.ui.tree.BaseNode.prototype.addChildAt=function(a,b,c){goog.asserts.assert(!a.getParent());goog.asserts.assertInstanceof(a,goog.ui.tree.BaseNode);c=this.getChildAt(b-1);var d=this.getChildAt(b);goog.ui.tree.BaseNode.superClass_.addChildAt.call(this,a,b);a.previousSibling_=c;a.nextSibling_=d;c?c.nextSibling_=a:this.firstChild_=a;d?d.previousSibling_=a:this.lastChild_=a;(b=this.getTree())&&a.setTreeInternal(b);a.setDepth_(this.getDepth()+1);if(b=this.getElement())if(this.updateExpandIcon(),goog.a11y.aria.setState(b,
|
|
goog.a11y.aria.State.EXPANDED,this.getExpanded()),this.getExpanded()){b=this.getChildrenElement();a.getElement()||a.createDom();var e=a.getElement(),f=d&&d.getElement();b.insertBefore(e,f);this.isInDocument()&&a.enterDocument();d||(c?c.updateExpandIcon():(goog.style.setElementShown(b,!0),this.setExpanded(this.getExpanded())))}};
|
|
goog.ui.tree.BaseNode.prototype.add=function(a,b){goog.asserts.assert(!b||b.getParent()==this,"Can only add nodes before siblings");a.getParent()&&a.getParent().removeChild(a);this.addChildAt(a,b?this.indexOfChild(b):this.getChildCount());return a};
|
|
goog.ui.tree.BaseNode.prototype.removeChild=function(a,b){var c=this.getTree(),d=c?c.getSelectedItem():null;if(d==a||a.contains(d))c.hasFocus()?(this.select(),goog.Timer.callOnce(this.onTimeoutSelect_,10,this)):this.select();goog.ui.tree.BaseNode.superClass_.removeChild.call(this,a);this.lastChild_==a&&(this.lastChild_=a.previousSibling_);this.firstChild_==a&&(this.firstChild_=a.nextSibling_);a.previousSibling_&&(a.previousSibling_.nextSibling_=a.nextSibling_);a.nextSibling_&&(a.nextSibling_.previousSibling_=
|
|
a.previousSibling_);d=a.isLastSibling();a.tree=null;a.depth_=-1;if(c&&(c.removeNode(a),this.isInDocument())){c=this.getChildrenElement();if(a.isInDocument()){var e=a.getElement();c.removeChild(e);a.exitDocument()}d&&(d=this.getLastChild())&&d.updateExpandIcon();this.hasChildren()||(c.style.display="none",this.updateExpandIcon(),this.updateIcon_(),(d=this.getElement())&&goog.a11y.aria.removeState(d,goog.a11y.aria.State.EXPANDED))}return a};goog.ui.tree.BaseNode.prototype.remove=goog.ui.tree.BaseNode.prototype.removeChild;
|
|
goog.ui.tree.BaseNode.prototype.onTimeoutSelect_=function(){this.select()};goog.ui.tree.BaseNode.prototype.getTree=goog.abstractMethod;goog.ui.tree.BaseNode.prototype.getDepth=function(){var a=this.depth_;0>a&&(a=this.computeDepth_(),this.setDepth_(a));return a};goog.ui.tree.BaseNode.prototype.computeDepth_=function(){var a=this.getParent();return a?a.getDepth()+1:0};
|
|
goog.ui.tree.BaseNode.prototype.setDepth_=function(a){if(a!=this.depth_){this.depth_=a;var b=this.getRowElement();if(b){var c=this.getPixelIndent_()+"px";this.isRightToLeft()?b.style.paddingRight=c:b.style.paddingLeft=c}this.forEachChild(function(b){b.setDepth_(a+1)})}};goog.ui.tree.BaseNode.prototype.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};goog.ui.tree.BaseNode.EMPTY_CHILDREN_=[];
|
|
goog.ui.tree.BaseNode.prototype.getChildren=function(){var a=[];this.forEachChild(function(b){a.push(b)});return a};goog.ui.tree.BaseNode.prototype.getFirstChild=function(){return this.getChildAt(0)};goog.ui.tree.BaseNode.prototype.getLastChild=function(){return this.getChildAt(this.getChildCount()-1)};goog.ui.tree.BaseNode.prototype.getPreviousSibling=function(){return this.previousSibling_};goog.ui.tree.BaseNode.prototype.getNextSibling=function(){return this.nextSibling_};
|
|
goog.ui.tree.BaseNode.prototype.isLastSibling=function(){return!this.nextSibling_};goog.ui.tree.BaseNode.prototype.isSelected=function(){return this.selected_};goog.ui.tree.BaseNode.prototype.select=function(){var a=this.getTree();a&&a.setSelectedItem(this)};goog.ui.tree.BaseNode.prototype.deselect=goog.nullFunction;
|
|
goog.ui.tree.BaseNode.prototype.setSelectedInternal=function(a){if(this.selected_!=a){this.selected_=a;this.updateRow();var b=this.getElement();b&&(goog.a11y.aria.setState(b,"selected",a),a&&(a=this.getTree().getElement(),goog.asserts.assert(a,"The DOM element for the tree cannot be null"),goog.a11y.aria.setState(a,"activedescendant",this.getId())))}};goog.ui.tree.BaseNode.prototype.getExpanded=function(){return this.expanded_};
|
|
goog.ui.tree.BaseNode.prototype.setExpandedInternal=function(a){this.expanded_=a};
|
|
goog.ui.tree.BaseNode.prototype.setExpanded=function(a){var b=a!=this.expanded_;if(!b||this.dispatchEvent(a?goog.ui.tree.BaseNode.EventType.BEFORE_EXPAND:goog.ui.tree.BaseNode.EventType.BEFORE_COLLAPSE)){this.expanded_=a;var c=this.getTree();var d=this.getElement();if(this.hasChildren()){if(!a&&c&&this.contains(c.getSelectedItem())&&this.select(),d){if(c=this.getChildrenElement())if(goog.style.setElementShown(c,a),goog.a11y.aria.setState(d,goog.a11y.aria.State.EXPANDED,a),a&&this.isInDocument()&&
|
|
!c.hasChildNodes()){var e=[];this.forEachChild(function(a){e.push(a.toSafeHtml())});goog.dom.safe.setInnerHtml(c,goog.html.SafeHtml.concat(e));this.forEachChild(function(a){a.enterDocument()})}this.updateExpandIcon()}}else(c=this.getChildrenElement())&&goog.style.setElementShown(c,!1);d&&this.updateIcon_();b&&this.dispatchEvent(a?goog.ui.tree.BaseNode.EventType.EXPAND:goog.ui.tree.BaseNode.EventType.COLLAPSE)}};goog.ui.tree.BaseNode.prototype.toggle=function(){this.setExpanded(!this.getExpanded())};
|
|
goog.ui.tree.BaseNode.prototype.expand=function(){this.setExpanded(!0)};goog.ui.tree.BaseNode.prototype.collapse=function(){this.setExpanded(!1)};goog.ui.tree.BaseNode.prototype.collapseChildren=function(){this.forEachChild(function(a){a.collapseAll()})};goog.ui.tree.BaseNode.prototype.collapseAll=function(){this.collapseChildren();this.collapse()};goog.ui.tree.BaseNode.prototype.expandChildren=function(){this.forEachChild(function(a){a.expandAll()})};
|
|
goog.ui.tree.BaseNode.prototype.expandAll=function(){this.expandChildren();this.expand()};goog.ui.tree.BaseNode.prototype.reveal=function(){var a=this.getParent();a&&(a.setExpanded(!0),a.reveal())};goog.ui.tree.BaseNode.prototype.setIsUserCollapsible=function(a){(this.isUserCollapsible_=a)||this.expand();this.getElement()&&this.updateExpandIcon()};goog.ui.tree.BaseNode.prototype.isUserCollapsible=function(){return this.isUserCollapsible_};
|
|
goog.ui.tree.BaseNode.prototype.toSafeHtml=function(){var a=this.getTree(),b=!a.getShowLines()||a==this.getParent()&&!a.getShowRootLines()?this.config_.cssChildrenNoLines:this.config_.cssChildren;a=this.getExpanded()&&this.hasChildren();b={"class":b,style:this.getLineStyle()};var c=[];a&&this.forEachChild(function(a){c.push(a.toSafeHtml())});a=goog.html.SafeHtml.create("div",b,c);return goog.html.SafeHtml.create("div",{"class":this.config_.cssItem,id:this.getId()},[this.getRowSafeHtml(),a])};
|
|
goog.ui.tree.BaseNode.prototype.getPixelIndent_=function(){return Math.max(0,(this.getDepth()-1)*this.config_.indentWidth)};goog.ui.tree.BaseNode.prototype.getRowSafeHtml=function(){var a={};a["padding-"+(this.isRightToLeft()?"right":"left")]=this.getPixelIndent_()+"px";a={"class":this.getRowClassName(),style:a};var b=[this.getExpandIconSafeHtml(),this.getIconSafeHtml(),this.getLabelSafeHtml()];return goog.html.SafeHtml.create("div",a,b)};
|
|
goog.ui.tree.BaseNode.prototype.getRowClassName=function(){var a=this.isSelected()?" "+this.config_.cssSelectedRow:"";return this.config_.cssTreeRow+a};goog.ui.tree.BaseNode.prototype.getLabelSafeHtml=function(){var a=goog.html.SafeHtml.create("span",{"class":this.config_.cssItemLabel,title:this.getToolTip()||null},this.getSafeHtml());return goog.html.SafeHtml.concat(a,goog.html.SafeHtml.create("span",{},this.getAfterLabelSafeHtml()))};goog.ui.tree.BaseNode.prototype.getAfterLabelHtml=function(){return goog.html.SafeHtml.unwrap(this.getAfterLabelSafeHtml())};
|
|
goog.ui.tree.BaseNode.prototype.getAfterLabelSafeHtml=function(){return this.afterLabelHtml_};goog.ui.tree.BaseNode.prototype.setAfterLabelSafeHtml=function(a){this.afterLabelHtml_=a;var b=this.getAfterLabelElement();b&&goog.dom.safe.setInnerHtml(b,a)};goog.ui.tree.BaseNode.prototype.getIconSafeHtml=function(){return goog.html.SafeHtml.create("span",{style:{display:"inline-block"},"class":this.getCalculatedIconClass()})};goog.ui.tree.BaseNode.prototype.getCalculatedIconClass=goog.abstractMethod;
|
|
goog.ui.tree.BaseNode.prototype.getExpandIconSafeHtml=function(){return goog.html.SafeHtml.create("span",{type:"expand",style:{display:"inline-block"},"class":this.getExpandIconClass()})};
|
|
goog.ui.tree.BaseNode.prototype.getExpandIconClass=function(){var a=this.getTree(),b=!a.getShowLines()||a==this.getParent()&&!a.getShowRootLines(),c=this.config_,d=new goog.string.StringBuffer;d.append(c.cssTreeIcon," ",c.cssExpandTreeIcon," ");if(this.hasChildren()){var e=0;a.getShowExpandIcons()&&this.isUserCollapsible_&&(e=this.getExpanded()?2:1);b||(e=this.isLastSibling()?e+4:e+8);switch(e){case 1:d.append(c.cssExpandTreeIconPlus);break;case 2:d.append(c.cssExpandTreeIconMinus);break;case 4:d.append(c.cssExpandTreeIconL);
|
|
break;case 5:d.append(c.cssExpandTreeIconLPlus);break;case 6:d.append(c.cssExpandTreeIconLMinus);break;case 8:d.append(c.cssExpandTreeIconT);break;case 9:d.append(c.cssExpandTreeIconTPlus);break;case 10:d.append(c.cssExpandTreeIconTMinus);break;default:d.append(c.cssExpandTreeIconBlank)}}else b?d.append(c.cssExpandTreeIconBlank):this.isLastSibling()?d.append(c.cssExpandTreeIconL):d.append(c.cssExpandTreeIconT);return d.toString()};
|
|
goog.ui.tree.BaseNode.prototype.getLineStyle=function(){var a=this.getExpanded()&&this.hasChildren();return goog.html.SafeStyle.create({"background-position":this.getBackgroundPosition(),display:a?null:"none"})};goog.ui.tree.BaseNode.prototype.getBackgroundPosition=function(){return(this.isLastSibling()?"-100":(this.getDepth()-1)*this.config_.indentWidth)+"px 0"};
|
|
goog.ui.tree.BaseNode.prototype.getElement=function(){var a=goog.ui.tree.BaseNode.superClass_.getElement.call(this);a||(a=this.getDomHelper().getElement(this.getId()),this.setElementInternal(a));return a};goog.ui.tree.BaseNode.prototype.getRowElement=function(){var a=this.getElement();return a?a.firstChild:null};goog.ui.tree.BaseNode.prototype.getExpandIconElement=function(){var a=this.getRowElement();return a?a.firstChild:null};
|
|
goog.ui.tree.BaseNode.prototype.getIconElement=function(){var a=this.getRowElement();return a?a.childNodes[1]:null};goog.ui.tree.BaseNode.prototype.getLabelElement=function(){var a=this.getRowElement();return a&&a.lastChild?a.lastChild.previousSibling:null};goog.ui.tree.BaseNode.prototype.getAfterLabelElement=function(){var a=this.getRowElement();return a?a.lastChild:null};goog.ui.tree.BaseNode.prototype.getChildrenElement=function(){var a=this.getElement();return a?a.lastChild:null};
|
|
goog.ui.tree.BaseNode.prototype.setIconClass=function(a){this.iconClass_=a;this.isInDocument()&&this.updateIcon_()};goog.ui.tree.BaseNode.prototype.getIconClass=function(){return this.iconClass_};goog.ui.tree.BaseNode.prototype.setExpandedIconClass=function(a){this.expandedIconClass_=a;this.isInDocument()&&this.updateIcon_()};goog.ui.tree.BaseNode.prototype.getExpandedIconClass=function(){return this.expandedIconClass_};goog.ui.tree.BaseNode.prototype.setText=function(a){this.setSafeHtml(goog.html.SafeHtml.htmlEscape(a))};
|
|
goog.ui.tree.BaseNode.prototype.getText=function(){return goog.string.unescapeEntities(goog.html.SafeHtml.unwrap(this.html_))};goog.ui.tree.BaseNode.prototype.setSafeHtml=function(a){this.html_=a;var b=this.getLabelElement();b&&goog.dom.safe.setInnerHtml(b,a);(a=this.getTree())&&a.setNode(this)};goog.ui.tree.BaseNode.prototype.getHtml=function(){return goog.html.SafeHtml.unwrap(this.getSafeHtml())};goog.ui.tree.BaseNode.prototype.getSafeHtml=function(){return this.html_};
|
|
goog.ui.tree.BaseNode.prototype.setToolTip=function(a){this.toolTip_=a;var b=this.getLabelElement();b&&(b.title=a)};goog.ui.tree.BaseNode.prototype.getToolTip=function(){return this.toolTip_};goog.ui.tree.BaseNode.prototype.updateRow=function(){var a=this.getRowElement();a&&(a.className=this.getRowClassName())};
|
|
goog.ui.tree.BaseNode.prototype.updateExpandIcon=function(){var a=this.getExpandIconElement();a&&(a.className=this.getExpandIconClass());if(a=this.getChildrenElement())a.style.backgroundPosition=this.getBackgroundPosition()};goog.ui.tree.BaseNode.prototype.updateIcon_=function(){this.getIconElement().className=this.getCalculatedIconClass()};
|
|
goog.ui.tree.BaseNode.prototype.onMouseDown=function(a){"expand"==a.target.getAttribute("type")&&this.hasChildren()?this.isUserCollapsible_&&this.toggle():(this.select(),this.updateRow())};goog.ui.tree.BaseNode.prototype.onClick_=goog.events.Event.preventDefault;goog.ui.tree.BaseNode.prototype.onDoubleClick_=function(a){"expand"==a.target.getAttribute("type")&&this.hasChildren()||this.isUserCollapsible_&&this.toggle()};
|
|
goog.ui.tree.BaseNode.prototype.onKeyDown=function(a){var b=!0;switch(a.keyCode){case goog.events.KeyCodes.RIGHT:if(a.altKey)break;this.hasChildren()&&(this.getExpanded()?this.getFirstChild().select():this.setExpanded(!0));break;case goog.events.KeyCodes.LEFT:if(a.altKey)break;if(this.hasChildren()&&this.getExpanded()&&this.isUserCollapsible_)this.setExpanded(!1);else{var c=this.getParent(),d=this.getTree();c&&(d.getShowRootNode()||c!=d)&&c.select()}break;case goog.events.KeyCodes.DOWN:(c=this.getNextShownNode())&&
|
|
c.select();break;case goog.events.KeyCodes.UP:(c=this.getPreviousShownNode())&&c.select();break;default:b=!1}b&&(a.preventDefault(),(d=this.getTree())&&d.clearTypeAhead());return b};goog.ui.tree.BaseNode.prototype.getLastShownDescendant=function(){return this.getExpanded()&&this.hasChildren()?this.getLastChild().getLastShownDescendant():this};
|
|
goog.ui.tree.BaseNode.prototype.getNextShownNode=function(){if(this.hasChildren()&&this.getExpanded())return this.getFirstChild();for(var a=this,b;a!=this.getTree();){b=a.getNextSibling();if(null!=b)return b;a=a.getParent()}return null};goog.ui.tree.BaseNode.prototype.getPreviousShownNode=function(){var a=this.getPreviousSibling();if(null!=a)return a.getLastShownDescendant();a=this.getParent();var b=this.getTree();return!b.getShowRootNode()&&a==b||this==b?null:a};
|
|
goog.ui.tree.BaseNode.prototype.getClientData=goog.ui.tree.BaseNode.prototype.getModel;goog.ui.tree.BaseNode.prototype.setClientData=goog.ui.tree.BaseNode.prototype.setModel;goog.ui.tree.BaseNode.prototype.getConfig=function(){return this.config_};goog.ui.tree.BaseNode.prototype.setTreeInternal=function(a){this.tree!=a&&(this.tree=a,a.setNode(this),this.forEachChild(function(b){b.setTreeInternal(a)}))};
|
|
goog.ui.tree.BaseNode.defaultConfig={indentWidth:19,cssRoot:"goog-tree-root goog-tree-item",cssHideRoot:"goog-tree-hide-root",cssItem:"goog-tree-item",cssChildren:"goog-tree-children",cssChildrenNoLines:"goog-tree-children-nolines",cssTreeRow:"goog-tree-row",cssItemLabel:"goog-tree-item-label",cssTreeIcon:"goog-tree-icon",cssExpandTreeIcon:"goog-tree-expand-icon",cssExpandTreeIconPlus:"goog-tree-expand-icon-plus",cssExpandTreeIconMinus:"goog-tree-expand-icon-minus",cssExpandTreeIconTPlus:"goog-tree-expand-icon-tplus",
|
|
cssExpandTreeIconTMinus:"goog-tree-expand-icon-tminus",cssExpandTreeIconLPlus:"goog-tree-expand-icon-lplus",cssExpandTreeIconLMinus:"goog-tree-expand-icon-lminus",cssExpandTreeIconT:"goog-tree-expand-icon-t",cssExpandTreeIconL:"goog-tree-expand-icon-l",cssExpandTreeIconBlank:"goog-tree-expand-icon-blank",cssExpandedFolderIcon:"goog-tree-expanded-folder-icon",cssCollapsedFolderIcon:"goog-tree-collapsed-folder-icon",cssFileIcon:"goog-tree-file-icon",cssExpandedRootIcon:"goog-tree-expanded-folder-icon",
|
|
cssCollapsedRootIcon:"goog-tree-collapsed-folder-icon",cssSelectedRow:"selected"};goog.debug.LogRecord=function(a,b,c,d,e){this.reset(a,b,c,d,e)};goog.debug.LogRecord.prototype.sequenceNumber_=0;goog.debug.LogRecord.prototype.exception_=null;goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS=!0;goog.debug.LogRecord.nextSequenceNumber_=0;
|
|
goog.debug.LogRecord.prototype.reset=function(a,b,c,d,e){goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS&&(this.sequenceNumber_="number"==typeof e?e:goog.debug.LogRecord.nextSequenceNumber_++);this.time_=d||goog.now();this.level_=a;this.msg_=b;this.loggerName_=c;delete this.exception_};goog.debug.LogRecord.prototype.getLoggerName=function(){return this.loggerName_};goog.debug.LogRecord.prototype.getException=function(){return this.exception_};
|
|
goog.debug.LogRecord.prototype.setException=function(a){this.exception_=a};goog.debug.LogRecord.prototype.setLoggerName=function(a){this.loggerName_=a};goog.debug.LogRecord.prototype.getLevel=function(){return this.level_};goog.debug.LogRecord.prototype.setLevel=function(a){this.level_=a};goog.debug.LogRecord.prototype.getMessage=function(){return this.msg_};goog.debug.LogRecord.prototype.setMessage=function(a){this.msg_=a};goog.debug.LogRecord.prototype.getMillis=function(){return this.time_};
|
|
goog.debug.LogRecord.prototype.setMillis=function(a){this.time_=a};goog.debug.LogRecord.prototype.getSequenceNumber=function(){return this.sequenceNumber_};goog.debug.LogBuffer=function(){goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(),"Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY.");this.clear()};goog.debug.LogBuffer.getInstance=function(){goog.debug.LogBuffer.instance_||(goog.debug.LogBuffer.instance_=new goog.debug.LogBuffer);return goog.debug.LogBuffer.instance_};goog.debug.LogBuffer.CAPACITY=0;
|
|
goog.debug.LogBuffer.prototype.addRecord=function(a,b,c){var d=(this.curIndex_+1)%goog.debug.LogBuffer.CAPACITY;this.curIndex_=d;if(this.isFull_)return d=this.buffer_[d],d.reset(a,b,c),d;this.isFull_=d==goog.debug.LogBuffer.CAPACITY-1;return this.buffer_[d]=new goog.debug.LogRecord(a,b,c)};goog.debug.LogBuffer.isBufferingEnabled=function(){return 0<goog.debug.LogBuffer.CAPACITY};
|
|
goog.debug.LogBuffer.prototype.clear=function(){this.buffer_=Array(goog.debug.LogBuffer.CAPACITY);this.curIndex_=-1;this.isFull_=!1};goog.debug.LogBuffer.prototype.forEachRecord=function(a){var b=this.buffer_;if(b[0]){var c=this.curIndex_,d=this.isFull_?c:-1;do d=(d+1)%goog.debug.LogBuffer.CAPACITY,a(b[d]);while(d!=c)}};goog.debug.Logger=function(a){this.name_=a;this.handlers_=this.children_=this.level_=this.parent_=null};goog.debug.Logger.ROOT_LOGGER_NAME="";goog.debug.Logger.ENABLE_HIERARCHY=!0;goog.debug.Logger.ENABLE_PROFILER_LOGGING=!1;goog.debug.Logger.ENABLE_HIERARCHY||(goog.debug.Logger.rootHandlers_=[]);goog.debug.Logger.Level=function(a,b){this.name=a;this.value=b};goog.debug.Logger.Level.prototype.toString=function(){return this.name};goog.debug.Logger.Level.OFF=new goog.debug.Logger.Level("OFF",Infinity);
|
|
goog.debug.Logger.Level.SHOUT=new goog.debug.Logger.Level("SHOUT",1200);goog.debug.Logger.Level.SEVERE=new goog.debug.Logger.Level("SEVERE",1E3);goog.debug.Logger.Level.WARNING=new goog.debug.Logger.Level("WARNING",900);goog.debug.Logger.Level.INFO=new goog.debug.Logger.Level("INFO",800);goog.debug.Logger.Level.CONFIG=new goog.debug.Logger.Level("CONFIG",700);goog.debug.Logger.Level.FINE=new goog.debug.Logger.Level("FINE",500);goog.debug.Logger.Level.FINER=new goog.debug.Logger.Level("FINER",400);
|
|
goog.debug.Logger.Level.FINEST=new goog.debug.Logger.Level("FINEST",300);goog.debug.Logger.Level.ALL=new goog.debug.Logger.Level("ALL",0);goog.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];
|
|
goog.debug.Logger.Level.predefinedLevelsCache_=null;goog.debug.Logger.Level.createPredefinedLevelsCache_=function(){goog.debug.Logger.Level.predefinedLevelsCache_={};for(var a=0,b;b=goog.debug.Logger.Level.PREDEFINED_LEVELS[a];a++)goog.debug.Logger.Level.predefinedLevelsCache_[b.value]=b,goog.debug.Logger.Level.predefinedLevelsCache_[b.name]=b};
|
|
goog.debug.Logger.Level.getPredefinedLevel=function(a){goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_();return goog.debug.Logger.Level.predefinedLevelsCache_[a]||null};
|
|
goog.debug.Logger.Level.getPredefinedLevelByValue=function(a){goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_();if(a in goog.debug.Logger.Level.predefinedLevelsCache_)return goog.debug.Logger.Level.predefinedLevelsCache_[a];for(var b=0;b<goog.debug.Logger.Level.PREDEFINED_LEVELS.length;++b){var c=goog.debug.Logger.Level.PREDEFINED_LEVELS[b];if(c.value<=a)return c}return null};goog.debug.Logger.getLogger=function(a){return goog.debug.LogManager.getLogger(a)};
|
|
goog.debug.Logger.logToProfilers=function(a){if(goog.debug.Logger.ENABLE_PROFILER_LOGGING){var b=goog.global.msWriteProfilerMark;b?b(a):(b=goog.global.console)&&b.timeStamp&&b.timeStamp(a)}};goog.debug.Logger.prototype.getName=function(){return this.name_};
|
|
goog.debug.Logger.prototype.addHandler=function(a){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)))};
|
|
goog.debug.Logger.prototype.removeHandler=function(a){if(goog.debug.LOGGING_ENABLED){var b=goog.debug.Logger.ENABLE_HIERARCHY?this.handlers_:goog.debug.Logger.rootHandlers_;return!!b&&goog.array.remove(b,a)}return!1};goog.debug.Logger.prototype.getParent=function(){return this.parent_};goog.debug.Logger.prototype.getChildren=function(){this.children_||(this.children_={});return this.children_};
|
|
goog.debug.Logger.prototype.setLevel=function(a){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))};goog.debug.Logger.prototype.getLevel=function(){return goog.debug.LOGGING_ENABLED?this.level_:goog.debug.Logger.Level.OFF};
|
|
goog.debug.Logger.prototype.getEffectiveLevel=function(){if(!goog.debug.LOGGING_ENABLED)return goog.debug.Logger.Level.OFF;if(!goog.debug.Logger.ENABLE_HIERARCHY)return goog.debug.Logger.rootLevel_;if(this.level_)return this.level_;if(this.parent_)return this.parent_.getEffectiveLevel();goog.asserts.fail("Root logger has no level set.");return null};goog.debug.Logger.prototype.isLoggable=function(a){return goog.debug.LOGGING_ENABLED&&a.value>=this.getEffectiveLevel().value};
|
|
goog.debug.Logger.prototype.log=function(a,b,c){goog.debug.LOGGING_ENABLED&&this.isLoggable(a)&&(goog.isFunction(b)&&(b=b()),this.doLogRecord_(this.getLogRecord(a,b,c)))};goog.debug.Logger.prototype.getLogRecord=function(a,b,c){a=goog.debug.LogBuffer.isBufferingEnabled()?goog.debug.LogBuffer.getInstance().addRecord(a,b,this.name_):new goog.debug.LogRecord(a,String(b),this.name_);c&&a.setException(c);return a};
|
|
goog.debug.Logger.prototype.shout=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.SHOUT,a,b)};goog.debug.Logger.prototype.severe=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.SEVERE,a,b)};goog.debug.Logger.prototype.warning=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.WARNING,a,b)};goog.debug.Logger.prototype.info=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.INFO,a,b)};
|
|
goog.debug.Logger.prototype.config=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.CONFIG,a,b)};goog.debug.Logger.prototype.fine=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINE,a,b)};goog.debug.Logger.prototype.finer=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINER,a,b)};goog.debug.Logger.prototype.finest=function(a,b){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINEST,a,b)};
|
|
goog.debug.Logger.prototype.logRecord=function(a){goog.debug.LOGGING_ENABLED&&this.isLoggable(a.getLevel())&&this.doLogRecord_(a)};goog.debug.Logger.prototype.doLogRecord_=function(a){goog.debug.Logger.ENABLE_PROFILER_LOGGING&&goog.debug.Logger.logToProfilers("log:"+a.getMessage());if(goog.debug.Logger.ENABLE_HIERARCHY)for(var b=this;b;)b.callPublish_(a),b=b.getParent();else{b=0;for(var c;c=goog.debug.Logger.rootHandlers_[b++];)c(a)}};
|
|
goog.debug.Logger.prototype.callPublish_=function(a){if(this.handlers_)for(var b=0,c;c=this.handlers_[b];b++)c(a)};goog.debug.Logger.prototype.setParent_=function(a){this.parent_=a};goog.debug.Logger.prototype.addChild_=function(a,b){this.getChildren()[a]=b};goog.debug.LogManager={};goog.debug.LogManager.loggers_={};goog.debug.LogManager.rootLogger_=null;
|
|
goog.debug.LogManager.initialize=function(){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))};goog.debug.LogManager.getLoggers=function(){return goog.debug.LogManager.loggers_};
|
|
goog.debug.LogManager.getRoot=function(){goog.debug.LogManager.initialize();return goog.debug.LogManager.rootLogger_};goog.debug.LogManager.getLogger=function(a){goog.debug.LogManager.initialize();return goog.debug.LogManager.loggers_[a]||goog.debug.LogManager.createLogger_(a)};goog.debug.LogManager.createFunctionForCatchErrors=function(a){return function(b){(a||goog.debug.LogManager.getRoot()).severe("Error: "+b.message+" ("+b.fileName+" @ Line: "+b.line+")")}};
|
|
goog.debug.LogManager.createLogger_=function(a){var b=new goog.debug.Logger(a);if(goog.debug.Logger.ENABLE_HIERARCHY){var c=a.lastIndexOf("."),d=a.substr(0,c);c=a.substr(c+1);d=goog.debug.LogManager.getLogger(d);d.addChild_(c,b);b.setParent_(d)}return goog.debug.LogManager.loggers_[a]=b};goog.log={};goog.log.ENABLED=goog.debug.LOGGING_ENABLED;goog.log.ROOT_LOGGER_NAME=goog.debug.Logger.ROOT_LOGGER_NAME;goog.log.Logger=goog.debug.Logger;goog.log.Level=goog.debug.Logger.Level;goog.log.LogRecord=goog.debug.LogRecord;goog.log.getLogger=function(a,b){if(goog.log.ENABLED){var c=goog.debug.LogManager.getLogger(a);b&&c&&c.setLevel(b);return c}return null};goog.log.addHandler=function(a,b){goog.log.ENABLED&&a&&a.addHandler(b)};
|
|
goog.log.removeHandler=function(a,b){return goog.log.ENABLED&&a?a.removeHandler(b):!1};goog.log.log=function(a,b,c,d){goog.log.ENABLED&&a&&a.log(b,c,d)};goog.log.error=function(a,b,c){goog.log.ENABLED&&a&&a.severe(b,c)};goog.log.warning=function(a,b,c){goog.log.ENABLED&&a&&a.warning(b,c)};goog.log.info=function(a,b,c){goog.log.ENABLED&&a&&a.info(b,c)};goog.log.fine=function(a,b,c){goog.log.ENABLED&&a&&a.fine(b,c)};goog.ui.tree.TreeNode=function(a,b,c){goog.ui.tree.BaseNode.call(this,a,b,c)};goog.inherits(goog.ui.tree.TreeNode,goog.ui.tree.BaseNode);goog.ui.tree.TreeNode.prototype.getTree=function(){if(this.tree)return this.tree;var a=this.getParent();return a&&(a=a.getTree())?(this.setTreeInternal(a),a):null};
|
|
goog.ui.tree.TreeNode.prototype.getCalculatedIconClass=function(){var a=this.getExpanded(),b=this.getExpandedIconClass();if(a&&b)return b;b=this.getIconClass();if(!a&&b)return b;b=this.getConfig();if(this.hasChildren()){if(a&&b.cssExpandedFolderIcon)return b.cssTreeIcon+" "+b.cssExpandedFolderIcon;if(!a&&b.cssCollapsedFolderIcon)return b.cssTreeIcon+" "+b.cssCollapsedFolderIcon}else if(b.cssFileIcon)return b.cssTreeIcon+" "+b.cssFileIcon;return""};goog.structs.Trie=function(a){this.value_=void 0;this.childNodes_={};a&&this.setAll(a)};goog.structs.Trie.prototype.set=function(a,b){this.setOrAdd_(a,b,!1)};goog.structs.Trie.prototype.add=function(a,b){this.setOrAdd_(a,b,!0)};
|
|
goog.structs.Trie.prototype.setOrAdd_=function(a,b,c){for(var d=this,e=0;e<a.length;e++){var f=a.charAt(e);d.childNodes_[f]||(d.childNodes_[f]=new goog.structs.Trie);d=d.childNodes_[f]}if(c&&void 0!==d.value_)throw Error('The collection already contains the key "'+a+'"');d.value_=b};goog.structs.Trie.prototype.setAll=function(a){var b=goog.structs.getKeys(a);a=goog.structs.getValues(a);for(var c=0;c<b.length;c++)this.set(b[c],a[c])};
|
|
goog.structs.Trie.prototype.getChildNode_=function(a){for(var b=this,c=0;c<a.length;c++){var d=a.charAt(c);b=b.childNodes_[d];if(!b)return}return b};goog.structs.Trie.prototype.get=function(a){return(a=this.getChildNode_(a))?a.value_:void 0};goog.structs.Trie.prototype.getKeyAndPrefixes=function(a,b){var c=this,d={},e=b||0;void 0!==c.value_&&(d[e]=c.value_);for(;e<a.length;e++){var f=a.charAt(e);if(!(f in c.childNodes_))break;c=c.childNodes_[f];void 0!==c.value_&&(d[e]=c.value_)}return d};
|
|
goog.structs.Trie.prototype.getValues=function(){var a=[];this.getValuesInternal_(a);return a};goog.structs.Trie.prototype.getValuesInternal_=function(a){void 0!==this.value_&&a.push(this.value_);for(var b in this.childNodes_)this.childNodes_[b].getValuesInternal_(a)};goog.structs.Trie.prototype.getKeys=function(a){var b=[];if(a){for(var c=this,d=0;d<a.length;d++){var e=a.charAt(d);if(!c.childNodes_[e])return[];c=c.childNodes_[e]}c.getKeysInternal_(a,b)}else this.getKeysInternal_("",b);return b};
|
|
goog.structs.Trie.prototype.getKeysInternal_=function(a,b){void 0!==this.value_&&b.push(a);for(var c in this.childNodes_)this.childNodes_[c].getKeysInternal_(a+c,b)};goog.structs.Trie.prototype.containsKey=function(a){return void 0!==this.get(a)};goog.structs.Trie.prototype.containsPrefix=function(a){return 0==a.length?!this.isEmpty():!!this.getChildNode_(a)};
|
|
goog.structs.Trie.prototype.containsValue=function(a){if(this.value_===a)return!0;for(var b in this.childNodes_)if(this.childNodes_[b].containsValue(a))return!0;return!1};goog.structs.Trie.prototype.clear=function(){this.childNodes_={};this.value_=void 0};
|
|
goog.structs.Trie.prototype.remove=function(a){for(var b=this,c=[],d=0;d<a.length;d++){var e=a.charAt(d);if(!b.childNodes_[e])throw Error('The collection does not have the key "'+a+'"');c.push([b,e]);b=b.childNodes_[e]}a=b.value_;for(delete b.value_;0<c.length;)if(e=c.pop(),b=e[0],e=e[1],b.childNodes_[e].isEmpty())delete b.childNodes_[e];else break;return a};goog.structs.Trie.prototype.clone=function(){return new goog.structs.Trie(this)};goog.structs.Trie.prototype.getCount=function(){return goog.structs.getCount(this.getValues())};
|
|
goog.structs.Trie.prototype.isEmpty=function(){return void 0===this.value_&&goog.object.isEmpty(this.childNodes_)};goog.ui.tree.TypeAhead=function(){this.nodeMap_=new goog.structs.Trie;this.buffer_="";this.matchingNodes_=this.matchingLabels_=null;this.matchingNodeIndex_=this.matchingLabelIndex_=0};goog.ui.tree.TypeAhead.Offset={DOWN:1,UP:-1};
|
|
goog.ui.tree.TypeAhead.prototype.handleNavigation=function(a){var b=!1;switch(a.keyCode){case goog.events.KeyCodes.DOWN:case goog.events.KeyCodes.UP:a.ctrlKey&&(this.jumpTo_(a.keyCode==goog.events.KeyCodes.DOWN?goog.ui.tree.TypeAhead.Offset.DOWN:goog.ui.tree.TypeAhead.Offset.UP),b=!0);break;case goog.events.KeyCodes.BACKSPACE:a=this.buffer_.length-1;b=!0;0<a?(this.buffer_=this.buffer_.substring(0,a),this.jumpToLabel_(this.buffer_)):0==a?this.buffer_="":b=!1;break;case goog.events.KeyCodes.ESC:this.buffer_=
|
|
"",b=!0}return b};goog.ui.tree.TypeAhead.prototype.handleTypeAheadChar=function(a){var b=!1;a.ctrlKey||a.altKey||(a=String.fromCharCode(a.charCode||a.keyCode).toLowerCase(),goog.string.isUnicodeChar(a)&&(" "!=a||this.buffer_)&&(this.buffer_+=a,b=this.jumpToLabel_(this.buffer_)));return b};
|
|
goog.ui.tree.TypeAhead.prototype.setNodeInMap=function(a){var b=a.getText();if(b&&!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(b))){b=b.toLowerCase();var c=this.nodeMap_.get(b);c?c.push(a):this.nodeMap_.set(b,[a])}};
|
|
goog.ui.tree.TypeAhead.prototype.removeNodeFromMap=function(a){var b=a.getText();if(b&&!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(b))){b=b.toLowerCase();var c=this.nodeMap_.get(b);if(c){for(var d=a.getChildCount(),e=0;e<d;e++)this.removeNodeFromMap(a.getChildAt(e));goog.array.remove(c,a);c.length||this.nodeMap_.remove(b)}}};
|
|
goog.ui.tree.TypeAhead.prototype.jumpToLabel_=function(a){var b=!1;(a=this.nodeMap_.getKeys(a))&&a.length&&(this.matchingLabelIndex_=this.matchingNodeIndex_=0,b=this.nodeMap_.get(a[0]),b=this.selectMatchingNode_(b))&&(this.matchingLabels_=a);return b};
|
|
goog.ui.tree.TypeAhead.prototype.jumpTo_=function(a){var b=!1,c=this.matchingLabels_;if(c){b=null;var d=!1;if(this.matchingNodes_){var e=this.matchingNodeIndex_+a;0<=e&&e<this.matchingNodes_.length?(this.matchingNodeIndex_=e,b=this.matchingNodes_):d=!0}b||(e=this.matchingLabelIndex_+a,0<=e&&e<c.length&&(this.matchingLabelIndex_=e),c.length>this.matchingLabelIndex_&&(b=this.nodeMap_.get(c[this.matchingLabelIndex_])),b&&b.length&&d&&(this.matchingNodeIndex_=a==goog.ui.tree.TypeAhead.Offset.UP?b.length-
|
|
1:0));if(b=this.selectMatchingNode_(b))this.matchingLabels_=c}return b};goog.ui.tree.TypeAhead.prototype.selectMatchingNode_=function(a){if(a){if(this.matchingNodeIndex_<a.length){var b=a[this.matchingNodeIndex_];this.matchingNodes_=a}b&&(b.reveal(),b.select())}return!!b};goog.ui.tree.TypeAhead.prototype.clear=function(){this.buffer_=""};goog.ui.tree.TreeControl=function(a,b,c){goog.ui.tree.BaseNode.call(this,a,b,c);this.setExpandedInternal(!0);this.setSelectedInternal(!0);this.selectedItem_=this;this.typeAhead_=new goog.ui.tree.TypeAhead;this.focusHandler_=this.keyHandler_=null;this.logger_=goog.log.getLogger("this");this.focused_=!1;this.focusedNode_=null;this.showRootLines_=this.showRootNode_=this.showExpandIcons_=this.showLines_=!0;if(goog.userAgent.IE)try{document.execCommand("BackgroundImageCache",!1,!0)}catch(d){goog.log.warning(this.logger_,
|
|
"Failed to enable background image cache")}};goog.inherits(goog.ui.tree.TreeControl,goog.ui.tree.BaseNode);goog.ui.tree.TreeControl.prototype.getTree=function(){return this};goog.ui.tree.TreeControl.prototype.getDepth=function(){return 0};goog.ui.tree.TreeControl.prototype.reveal=function(){};goog.ui.tree.TreeControl.prototype.handleFocus_=function(a){this.focused_=!0;goog.dom.classlist.add(goog.asserts.assert(this.getElement()),"focused");this.selectedItem_&&this.selectedItem_.select()};
|
|
goog.ui.tree.TreeControl.prototype.handleBlur_=function(a){this.focused_=!1;goog.dom.classlist.remove(goog.asserts.assert(this.getElement()),"focused")};goog.ui.tree.TreeControl.prototype.hasFocus=function(){return this.focused_};goog.ui.tree.TreeControl.prototype.getExpanded=function(){return!this.showRootNode_||goog.ui.tree.TreeControl.superClass_.getExpanded.call(this)};
|
|
goog.ui.tree.TreeControl.prototype.setExpanded=function(a){this.showRootNode_?goog.ui.tree.TreeControl.superClass_.setExpanded.call(this,a):this.setExpandedInternal(a)};goog.ui.tree.TreeControl.prototype.getExpandIconSafeHtml=function(){return goog.html.SafeHtml.EMPTY};goog.ui.tree.TreeControl.prototype.getIconElement=function(){var a=this.getRowElement();return a?a.firstChild:null};goog.ui.tree.TreeControl.prototype.getExpandIconElement=function(){return null};
|
|
goog.ui.tree.TreeControl.prototype.updateExpandIcon=function(){};goog.ui.tree.TreeControl.prototype.getRowClassName=function(){return goog.ui.tree.TreeControl.superClass_.getRowClassName.call(this)+(this.showRootNode_?"":" "+this.getConfig().cssHideRoot)};
|
|
goog.ui.tree.TreeControl.prototype.getCalculatedIconClass=function(){var a=this.getExpanded(),b=this.getExpandedIconClass();if(a&&b)return b;b=this.getIconClass();if(!a&&b)return b;b=this.getConfig();return a&&b.cssExpandedRootIcon?b.cssTreeIcon+" "+b.cssExpandedRootIcon:!a&&b.cssCollapsedRootIcon?b.cssTreeIcon+" "+b.cssCollapsedRootIcon:""};
|
|
goog.ui.tree.TreeControl.prototype.setSelectedItem=function(a){if(this.selectedItem_!=a){var b=!1;this.selectedItem_&&(b=this.selectedItem_==this.focusedNode_,this.selectedItem_.setSelectedInternal(!1));if(this.selectedItem_=a)a.setSelectedInternal(!0),b&&a.select();this.dispatchEvent(goog.events.EventType.CHANGE)}};goog.ui.tree.TreeControl.prototype.getSelectedItem=function(){return this.selectedItem_};
|
|
goog.ui.tree.TreeControl.prototype.setShowLines=function(a){this.showLines_!=a&&(this.showLines_=a,this.isInDocument()&&this.updateLinesAndExpandIcons_())};goog.ui.tree.TreeControl.prototype.getShowLines=function(){return this.showLines_};
|
|
goog.ui.tree.TreeControl.prototype.updateLinesAndExpandIcons_=function(){function a(e){var f=e.getChildrenElement();if(f){var g=!c||b==e.getParent()&&!d?e.getConfig().cssChildrenNoLines:e.getConfig().cssChildren;f.className=g;if(f=e.getExpandIconElement())f.className=e.getExpandIconClass()}e.forEachChild(a)}var b=this,c=b.getShowLines(),d=b.getShowRootLines();a(this)};
|
|
goog.ui.tree.TreeControl.prototype.setShowRootLines=function(a){this.showRootLines_!=a&&(this.showRootLines_=a,this.isInDocument()&&this.updateLinesAndExpandIcons_())};goog.ui.tree.TreeControl.prototype.getShowRootLines=function(){return this.showRootLines_};goog.ui.tree.TreeControl.prototype.setShowExpandIcons=function(a){this.showExpandIcons_!=a&&(this.showExpandIcons_=a,this.isInDocument()&&this.updateLinesAndExpandIcons_())};goog.ui.tree.TreeControl.prototype.getShowExpandIcons=function(){return this.showExpandIcons_};
|
|
goog.ui.tree.TreeControl.prototype.setShowRootNode=function(a){if(this.showRootNode_!=a){this.showRootNode_=a;if(this.isInDocument()){var b=this.getRowElement();b&&(b.className=this.getRowClassName())}!a&&this.getSelectedItem()==this&&this.getFirstChild()&&this.setSelectedItem(this.getFirstChild())}};goog.ui.tree.TreeControl.prototype.getShowRootNode=function(){return this.showRootNode_};
|
|
goog.ui.tree.TreeControl.prototype.initAccessibility=function(){goog.ui.tree.TreeControl.superClass_.initAccessibility.call(this);var a=this.getElement();goog.asserts.assert(a,"The DOM element for the tree cannot be null.");goog.a11y.aria.setRole(a,"tree");goog.a11y.aria.setState(a,"labelledby",this.getLabelElement().id)};
|
|
goog.ui.tree.TreeControl.prototype.enterDocument=function(){goog.ui.tree.TreeControl.superClass_.enterDocument.call(this);var a=this.getElement();a.className=this.getConfig().cssRoot;a.setAttribute("hideFocus","true");this.attachEvents_();this.initAccessibility()};goog.ui.tree.TreeControl.prototype.exitDocument=function(){goog.ui.tree.TreeControl.superClass_.exitDocument.call(this);this.detachEvents_()};
|
|
goog.ui.tree.TreeControl.prototype.attachEvents_=function(){var a=this.getElement();a.tabIndex=0;var b=this.keyHandler_=new goog.events.KeyHandler(a),c=this.focusHandler_=new goog.events.FocusHandler(a);this.getHandler().listen(c,goog.events.FocusHandler.EventType.FOCUSOUT,this.handleBlur_).listen(c,goog.events.FocusHandler.EventType.FOCUSIN,this.handleFocus_).listen(b,goog.events.KeyHandler.EventType.KEY,this.handleKeyEvent).listen(a,goog.events.EventType.MOUSEDOWN,this.handleMouseEvent_).listen(a,
|
|
goog.events.EventType.CLICK,this.handleMouseEvent_).listen(a,goog.events.EventType.DBLCLICK,this.handleMouseEvent_)};goog.ui.tree.TreeControl.prototype.detachEvents_=function(){this.keyHandler_.dispose();this.keyHandler_=null;this.focusHandler_.dispose();this.focusHandler_=null};
|
|
goog.ui.tree.TreeControl.prototype.handleMouseEvent_=function(a){goog.log.fine(this.logger_,"Received event "+a.type);var b=this.getNodeFromEvent_(a);if(b)switch(a.type){case goog.events.EventType.MOUSEDOWN:b.onMouseDown(a);break;case goog.events.EventType.CLICK:b.onClick_(a);break;case goog.events.EventType.DBLCLICK:b.onDoubleClick_(a)}};
|
|
goog.ui.tree.TreeControl.prototype.handleKeyEvent=function(a){var b;(b=this.typeAhead_.handleNavigation(a)||this.selectedItem_&&this.selectedItem_.onKeyDown(a)||this.typeAhead_.handleTypeAheadChar(a))&&a.preventDefault();return b};goog.ui.tree.TreeControl.prototype.getNodeFromEvent_=function(a){for(var b=a.target;null!=b;){if(a=goog.ui.tree.BaseNode.allNodes[b.id])return a;if(b==this.getElement())break;b=b.parentNode}return null};
|
|
goog.ui.tree.TreeControl.prototype.createNode=function(a){return new goog.ui.tree.TreeNode(a||goog.html.SafeHtml.EMPTY,this.getConfig(),this.getDomHelper())};goog.ui.tree.TreeControl.prototype.setNode=function(a){this.typeAhead_.setNodeInMap(a)};goog.ui.tree.TreeControl.prototype.removeNode=function(a){this.typeAhead_.removeNodeFromMap(a)};goog.ui.tree.TreeControl.prototype.clearTypeAhead=function(){this.typeAhead_.clear()};goog.ui.tree.TreeControl.defaultConfig=goog.ui.tree.BaseNode.defaultConfig;
|
|
var Blockly={};Blockly.Blocks=Object.create(null);Blockly.Msg={};goog.getMsgOrig=goog.getMsg;goog.getMsg=function(a,b){var c=goog.getMsg.blocklyMsgMap[a];c&&(a=Blockly.Msg[c]);return goog.getMsgOrig(a,b)};goog.getMsg.blocklyMsgMap={Today:"TODAY"};
|
|
Blockly.utils={};Blockly.utils.base={};Blockly.utils.global=this||self;Blockly.utils.Coordinate=function(a,b){this.x=a;this.y=b};Blockly.utils.Coordinate.equals=function(a,b){return a==b?!0:a&&b?a.x==b.x&&a.y==b.y:!1};Blockly.utils.Coordinate.distance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)};Blockly.utils.Coordinate.magnitude=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};Blockly.utils.Coordinate.difference=function(a,b){return new Blockly.utils.Coordinate(a.x-b.x,a.y-b.y)};
|
|
Blockly.utils.Coordinate.sum=function(a,b){return new Blockly.utils.Coordinate(a.x+b.x,a.y+b.y)};Blockly.utils.Coordinate.prototype.scale=function(a){this.x*=a;this.y*=a;return this};Blockly.utils.Coordinate.prototype.translate=function(a,b){this.x+=a;this.y+=b;return this};Blockly.utils.Coordinate.prototype.clone=function(){return new Blockly.utils.Coordinate(this.x,this.y)};Blockly.utils.dom={};Blockly.utils.dom.SVG_NS="http://www.w3.org/2000/svg";Blockly.utils.dom.HTML_NS="http://www.w3.org/1999/xhtml";Blockly.utils.dom.XLINK_NS="http://www.w3.org/1999/xlink";Blockly.utils.dom.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};
|
|
Blockly.utils.dom.createSvgElement=function(a,b,c){a=document.createElementNS(Blockly.utils.dom.SVG_NS,a);for(var d in b)a.setAttribute(d,b[d]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);c&&c.appendChild(a);return a};Blockly.utils.dom.addClass=function(a,b){var c=a.getAttribute("class")||"";if(-1!=(" "+c+" ").indexOf(" "+b+" "))return!1;c&&(c+=" ");a.setAttribute("class",c+b);return!0};
|
|
Blockly.utils.dom.removeClass=function(a,b){var c=a.getAttribute("class");if(-1==(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(var d=0;d<c.length;d++)c[d]&&c[d]!=b||(c.splice(d,1),d--);c.length?a.setAttribute("class",c.join(" ")):a.removeAttribute("class");return!0};Blockly.utils.dom.hasClass=function(a,b){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")};Blockly.utils.dom.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};
|
|
Blockly.utils.dom.insertAfter=function(a,b){var c=b.nextSibling,d=b.parentNode;if(!d)throw Error("Reference node has no parent.");c?d.insertBefore(a,c):d.appendChild(a)};Blockly.utils.dom.containsNode=function(a,b){return!!(a.compareDocumentPosition(b)&Blockly.utils.dom.Node.DOCUMENT_POSITION_CONTAINED_BY)};Blockly.utils.dom.setCssTransform=function(a,b){a.style.transform=b;a.style["-webkit-transform"]=b};Blockly.utils.string={};Blockly.utils.string.startsWith=function(a,b){return 0==a.lastIndexOf(b,0)};Blockly.utils.string.shortestStringLength=function(a){return a.length?a.reduce(function(a,c){return a.length<c.length?a:c}).length:0};
|
|
Blockly.utils.string.commonWordPrefix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.utils.string.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0][e],g=1;g<a.length;g++)if(f!=a[g][e])return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g][e])&&" "!=f)return c;return d};
|
|
Blockly.utils.string.commonWordSuffix=function(a,b){if(!a.length)return 0;if(1==a.length)return a[0].length;for(var c=0,d=b||Blockly.utils.string.shortestStringLength(a),e=0;e<d;e++){for(var f=a[0].substr(-e-1,1),g=1;g<a.length;g++)if(f!=a[g].substr(-e-1,1))return c;" "==f&&(c=e+1)}for(g=1;g<a.length;g++)if((f=a[g].charAt(a[g].length-e-1))&&" "!=f)return c;return d};Blockly.utils.string.wrap=function(a,b){for(var c=a.split("\n"),d=0;d<c.length;d++)c[d]=Blockly.utils.string.wrapLine_(c[d],b);return c.join("\n")};
|
|
Blockly.utils.string.wrapLine_=function(a,b){if(a.length<=b)return a;for(var c=a.trim().split(/\s+/),d=0;d<c.length;d++)c[d].length>b&&(b=c[d].length);d=-Infinity;var e=1;do{var f=d;var g=a;var h=[],k=c.length/e,l=1;for(d=0;d<c.length-1;d++)l<(d+1.5)/k?(l++,h[d]=!0):h[d]=!1;h=Blockly.utils.string.wrapMutate_(c,h,b);d=Blockly.utils.string.wrapScore_(c,h,b);a=Blockly.utils.string.wrapToText_(c,h);e++}while(d>f);return g};
|
|
Blockly.utils.string.wrapScore_=function(a,b,c){for(var d=[0],e=[],f=0;f<a.length;f++)d[d.length-1]+=a[f].length,!0===b[f]?(d.push(0),e.push(a[f].charAt(a[f].length-1))):!1===b[f]&&d[d.length-1]++;a=Math.max.apply(Math,d);for(f=b=0;f<d.length;f++)b-=2*Math.pow(Math.abs(c-d[f]),1.5),b-=Math.pow(a-d[f],1.5),-1!=".?!".indexOf(e[f])?b+=c/3:-1!=",;)]}".indexOf(e[f])&&(b+=c/4);1<d.length&&d[d.length-1]<=d[d.length-2]&&(b+=.5);return b};
|
|
Blockly.utils.string.wrapMutate_=function(a,b,c){for(var d=Blockly.utils.string.wrapScore_(a,b,c),e,f=0;f<b.length-1;f++)if(b[f]!=b[f+1]){var g=[].concat(b);g[f]=!g[f];g[f+1]=!g[f+1];var h=Blockly.utils.string.wrapScore_(a,g,c);h>d&&(d=h,e=g)}return e?Blockly.utils.string.wrapMutate_(a,e,c):b};Blockly.utils.string.wrapToText_=function(a,b){for(var c=[],d=0;d<a.length;d++)c.push(a[d]),void 0!==b[d]&&c.push(b[d]?"\n":" ");return c.join("")};Blockly.utils.userAgent={};
|
|
(function(a){function b(a){return-1!=c.indexOf(a.toUpperCase())}Blockly.utils.userAgent.raw=a;var c=Blockly.utils.userAgent.raw.toUpperCase();Blockly.utils.userAgent.IE=b("Trident")||b("MSIE");Blockly.utils.userAgent.EDGE=b("Edge");Blockly.utils.userAgent.JAVA_FX=b("JavaFX");Blockly.utils.userAgent.WEBKIT=b("WebKit")&&!Blockly.utils.userAgent.EDGE;Blockly.utils.userAgent.GECKO=b("Gecko")&&!Blockly.utils.userAgent.WEBKIT&&!Blockly.utils.userAgent.IE&&!Blockly.utils.userAgent.EDGE;Blockly.utils.userAgent.ANDROID=
|
|
b("Android");Blockly.utils.userAgent.IPAD=b("iPad");Blockly.utils.userAgent.IPOD=b("iPod");Blockly.utils.userAgent.IPHONE=b("iPhone")&&!Blockly.utils.userAgent.IPAD&&!Blockly.utils.userAgent.IPOD;Blockly.utils.userAgent.MAC=b("Macintosh");Blockly.utils.userAgent.TABLET=Blockly.utils.userAgent.IPAD||Blockly.utils.userAgent.ANDROID&&!b("Mobile")||b("Silk");Blockly.utils.userAgent.MOBILE=!Blockly.utils.userAgent.TABLET&&(Blockly.utils.userAgent.IPOD||Blockly.utils.userAgent.IPHONE||Blockly.utils.userAgent.ANDROID||
|
|
b("IEMobile"))})(Blockly.utils.global.navigator&&Blockly.utils.global.navigator.userAgent||"");
|
|
Blockly.utils.dom.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};Blockly.utils.noEvent=function(a){a.preventDefault();a.stopPropagation()};Blockly.utils.isTargetInput=function(a){return"textarea"==a.target.type||"text"==a.target.type||"number"==a.target.type||"email"==a.target.type||"password"==a.target.type||"search"==a.target.type||"tel"==a.target.type||"url"==a.target.type||a.target.isContentEditable};
|
|
Blockly.utils.getRelativeXY=function(a){var b=new Blockly.utils.Coordinate(0,0),c=a.getAttribute("x");c&&(b.x=parseInt(c,10));if(c=a.getAttribute("y"))b.y=parseInt(c,10);if(c=(c=a.getAttribute("transform"))&&c.match(Blockly.utils.getRelativeXY.XY_REGEX_))b.x+=parseFloat(c[1]),c[3]&&(b.y+=parseFloat(c[3]));(a=a.getAttribute("style"))&&-1<a.indexOf("translate")&&(a=a.match(Blockly.utils.getRelativeXY.XY_STYLE_REGEX_))&&(b.x+=parseFloat(a[1]),a[3]&&(b.y+=parseFloat(a[3])));return b};
|
|
Blockly.utils.getInjectionDivXY_=function(a){for(var b=0,c=0;a;){var d=Blockly.utils.getRelativeXY(a);b+=d.x;c+=d.y;if(-1!=(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;a=a.parentNode}return new Blockly.utils.Coordinate(b,c)};Blockly.utils.getRelativeXY.XY_REGEX_=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/;Blockly.utils.getRelativeXY.XY_STYLE_REGEX_=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/;
|
|
Blockly.utils.isRightButton=function(a){return a.ctrlKey&&Blockly.utils.userAgent.MAC?!0:2==a.button};Blockly.utils.mouseToSvg=function(a,b,c){var d=b.createSVGPoint();d.x=a.clientX;d.y=a.clientY;c||(c=b.getScreenCTM().inverse());return d.matrixTransform(c)};
|
|
Blockly.utils.getScrollDeltaPixels=function(a){switch(a.deltaMode){case 0:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*Blockly.LINE_MODE_MULTIPLIER,y:a.deltaY*Blockly.LINE_MODE_MULTIPLIER};case 2:return{x:a.deltaX*Blockly.PAGE_MODE_MULTIPLIER,y:a.deltaY*Blockly.PAGE_MODE_MULTIPLIER}}};Blockly.utils.tokenizeInterpolation=function(a){return Blockly.utils.tokenizeInterpolation_(a,!0)};
|
|
Blockly.utils.replaceMessageReferences=function(a){if("string"!=typeof a)return a;a=Blockly.utils.tokenizeInterpolation_(a,!1);return a.length?a[0]:""};Blockly.utils.checkMessageReferences=function(a){var b=!0,c=Blockly.Msg;a=a.match(/%{BKY_[A-Z]\w*}/ig);for(var d=0;d<a.length;d++){var e=a[d].toUpperCase();void 0==c[e.slice(6,-1)]&&(b=!1)}return b};
|
|
Blockly.utils.tokenizeInterpolation_=function(a,b){var c=[],d=a.split("");d.push("");for(var e=0,f=[],g=null,h=0;h<d.length;h++){var k=d[h];0==e?"%"==k?((k=f.join(""))&&c.push(k),f.length=0,e=1):f.push(k):1==e?"%"==k?(f.push(k),e=0):b&&"0"<=k&&"9">=k?(e=2,g=k,(k=f.join(""))&&c.push(k),f.length=0):"{"==k?e=3:(f.push("%",k),e=0):2==e?"0"<=k&&"9">=k?g+=k:(c.push(parseInt(g,10)),h--,e=0):3==e&&(""==k?(f.splice(0,0,"%{"),h--,e=0):"}"!=k?f.push(k):(e=f.join(""),/[A-Z]\w*/i.test(e)?(k=e.toUpperCase(),(k=
|
|
Blockly.utils.string.startsWith(k,"BKY_")?k.substring(4):null)&&k in Blockly.Msg?(e=Blockly.Msg[k],"string"==typeof e?Array.prototype.push.apply(c,Blockly.utils.tokenizeInterpolation_(e,b)):b?c.push(String(e)):c.push(e)):c.push("%{"+e+"}")):c.push("%{"+e+"}"),e=f.length=0))}(k=f.join(""))&&c.push(k);d=[];for(h=f.length=0;h<c.length;++h)"string"==typeof c[h]?f.push(c[h]):((k=f.join(""))&&d.push(k),f.length=0,d.push(c[h]));(k=f.join(""))&&d.push(k);f.length=0;return d};
|
|
Blockly.utils.genUid=function(){for(var a=Blockly.utils.genUid.soup_.length,b=[],c=0;20>c;c++)b[c]=Blockly.utils.genUid.soup_.charAt(Math.random()*a);return b.join("")};Blockly.utils.genUid.soup_="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
Blockly.utils.is3dSupported=function(){if(void 0!==Blockly.utils.is3dSupported.cached_)return Blockly.utils.is3dSupported.cached_;if(!Blockly.utils.global.getComputedStyle)return!1;var a=document.createElement("p"),b="none",c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(a,null);for(var d in c)if(void 0!==a.style[d]){a.style[d]="translate3d(1px,1px,1px)";b=Blockly.utils.global.getComputedStyle(a);
|
|
if(!b)return document.body.removeChild(a),!1;b=b.getPropertyValue(c[d])}document.body.removeChild(a);Blockly.utils.is3dSupported.cached_="none"!==b;return Blockly.utils.is3dSupported.cached_};Blockly.utils.runAfterPageLoad=function(a){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)a();else var b=setInterval(function(){"complete"==document.readyState&&(clearInterval(b),a())},10)};
|
|
Blockly.utils.getViewportBBox=function(){var a=goog.style.getViewportPageOffset(document);return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}};Blockly.utils.arrayRemove=function(a,b){var c=a.indexOf(b);if(-1==c)return!1;a.splice(c,1);return!0};
|
|
Blockly.utils.getDocumentScroll=function(){var a=document.documentElement,b=window;return Blockly.utils.userAgent.IE&&b.pageYOffset!=a.scrollTop?new Blockly.utils.Coordinate(a.scrollLeft,a.scrollTop):new Blockly.utils.Coordinate(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)};
|
|
Blockly.utils.getBlockTypeCounts=function(a,b){var c=Object.create(null),d=a.getDescendants(!0);if(b){var e=a.getNextBlock();e&&(e=d.indexOf(e),d.splice(e,d.length-e))}e=0;for(var f;f=d[e];e++)c[f.type]?c[f.type]++:c[f.type]=1;return c};
|
|
Blockly.Events={};Blockly.Events.group_="";Blockly.Events.recordUndo=!0;Blockly.Events.disabled_=0;Blockly.Events.CREATE="create";Blockly.Events.BLOCK_CREATE=Blockly.Events.CREATE;Blockly.Events.DELETE="delete";Blockly.Events.BLOCK_DELETE=Blockly.Events.DELETE;Blockly.Events.CHANGE="change";Blockly.Events.BLOCK_CHANGE=Blockly.Events.CHANGE;Blockly.Events.MOVE="move";Blockly.Events.BLOCK_MOVE=Blockly.Events.MOVE;Blockly.Events.VAR_CREATE="var_create";Blockly.Events.VAR_DELETE="var_delete";
|
|
Blockly.Events.VAR_RENAME="var_rename";Blockly.Events.COMMENT_CREATE="comment_create";Blockly.Events.COMMENT_DELETE="comment_delete";Blockly.Events.COMMENT_CHANGE="comment_change";Blockly.Events.COMMENT_MOVE="comment_move";Blockly.Events.UI="ui";Blockly.Events.END_DRAG="end_drag";Blockly.Events.COMMENT_CREATE="comment_create";Blockly.Events.COMMENT_DELETE="comment_delete";Blockly.Events.COMMENT_CHANGE="comment_change";Blockly.Events.COMMENT_MOVE="comment_move";Blockly.Events.FINISHED_LOADING="finished_loading";
|
|
Blockly.Events.BUMP_EVENTS=[Blockly.Events.BLOCK_CREATE,Blockly.Events.BLOCK_MOVE,Blockly.Events.COMMENT_CREATE,Blockly.Events.COMMENT_MOVE];Blockly.Events.FIRE_QUEUE_=[];Blockly.Events.fire=function(a){Blockly.Events.isEnabled()&&(Blockly.Events.FIRE_QUEUE_.length||setTimeout(Blockly.Events.fireNow_,0),Blockly.Events.FIRE_QUEUE_.push(a))};
|
|
Blockly.Events.fireNow_=function(){for(var a=Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_,!0),b=Blockly.Events.FIRE_QUEUE_.length=0,c;c=a[b];b++){var d=Blockly.Workspace.getById(c.workspaceId);d&&d.fireChangeListener(c)}};
|
|
Blockly.Events.filter=function(a,b){var c=a.slice();b||c.reverse();for(var d=[],e=Object.create(null),f=0,g;g=c[f];f++)if(!g.isNull()){var h=[g.type,g.blockId,g.workspaceId].join(" "),k=e[h],l=k?k.event:null;if(!k)e[h]={event:g,index:f},d.push(g);else if(g.type==Blockly.Events.MOVE&&k.index==f-1)l.newParentId=g.newParentId,l.newInputName=g.newInputName,l.newCoordinate=g.newCoordinate,k.index=f;else if(g.type==Blockly.Events.CHANGE&&g.element==l.element&&g.name==l.name)l.newValue=g.newValue;else if(g.type!=
|
|
Blockly.Events.UI||"click"!=g.element||"commentOpen"!=l.element&&"mutatorOpen"!=l.element&&"warningOpen"!=l.element&&"breakpointSet"!=l.element)e[h]={event:g,index:1},d.push(g)}c=d.filter(function(a){return!a.isNull()});b||c.reverse();for(f=1;g=c[f];f++)g.type==Blockly.Events.CHANGE&&"mutation"==g.element&&c.unshift(c.splice(f,1)[0]);return c};Blockly.Events.clearPendingUndo=function(){for(var a=0,b;b=Blockly.Events.FIRE_QUEUE_[a];a++)b.recordUndo=!1};Blockly.Events.disable=function(){Blockly.Events.disabled_++};
|
|
Blockly.Events.enable=function(){Blockly.Events.disabled_--};Blockly.Events.isEnabled=function(){return 0==Blockly.Events.disabled_};Blockly.Events.getGroup=function(){return Blockly.Events.group_};Blockly.Events.setGroup=function(a){Blockly.Events.group_="boolean"==typeof a?a?Blockly.utils.genUid():"":a};Blockly.Events.getDescendantIds_=function(a){var b=[];a=a.getDescendants(!1);for(var c=0,d;d=a[c];c++)b[c]=d.id;return b};
|
|
Blockly.Events.fromJson=function(a,b){switch(a.type){case Blockly.Events.CREATE:var c=new Blockly.Events.Create(null);break;case Blockly.Events.DELETE:c=new Blockly.Events.Delete(null);break;case Blockly.Events.CHANGE:c=new Blockly.Events.Change(null,"","","","");break;case Blockly.Events.MOVE:c=new Blockly.Events.Move(null);break;case Blockly.Events.VAR_CREATE:c=new Blockly.Events.VarCreate(null);break;case Blockly.Events.VAR_DELETE:c=new Blockly.Events.VarDelete(null);break;case Blockly.Events.VAR_RENAME:c=
|
|
new Blockly.Events.VarRename(null,"");break;case Blockly.Events.UI:c=new Blockly.Events.Ui(null);break;case Blockly.Events.COMMENT_CREATE:c=new Blockly.Events.CommentCreate(null);break;case Blockly.Events.COMMENT_CHANGE:c=new Blockly.Events.CommentChange(null);break;case Blockly.Events.COMMENT_MOVE:c=new Blockly.Events.CommentMove(null);break;case Blockly.Events.COMMENT_DELETE:new Blockly.Events.CommentDelete(null);case Blockly.Events.END_DRAG:c=new Blockly.Events.EndBlockDrag(null,!1);break;default:throw Error("Unknown event type.");
|
|
}c.fromJson(a);c.workspaceId=b.id;return c};Blockly.Events.disableOrphans=function(a){if(a.type==Blockly.Events.MOVE||a.type==Blockly.Events.CREATE){var b=Blockly.Workspace.getById(a.workspaceId);if(a=b.getBlockById(a.blockId)){var c=a.getParent();if(c&&c.isEnabled())for(b=a.getDescendants(!1),a=0;c=b[a];a++)c.setEnabled(!0);else if((a.outputConnection||a.previousConnection)&&!b.isDragging()){do a.setEnabled(!1),a=a.getNextBlock();while(a)}}}};
|
|
Blockly.Events.Abstract=function(){this.workspaceId=void 0;this.group=Blockly.Events.group_;this.recordUndo=Blockly.Events.recordUndo};Blockly.Events.Abstract.prototype.toJson=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};Blockly.Events.Abstract.prototype.fromJson=function(a){this.group=a.group};Blockly.Events.Abstract.prototype.isNull=function(){return!1};Blockly.Events.Abstract.prototype.run=function(a){};
|
|
Blockly.Events.Abstract.prototype.getEventWorkspace_=function(){var a=Blockly.Workspace.getById(this.workspaceId);if(!a)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return a};Blockly.utils.xml={};Blockly.utils.xml.NAME_SPACE="https://developers.google.com/blockly/xml";Blockly.utils.xml.createElement=function(a){return document.createElementNS(Blockly.utils.xml.NAME_SPACE,a)};Blockly.utils.xml.createTextNode=function(a){return document.createTextNode(a)};Blockly.utils.xml.textToDomDocument=function(a){return(new DOMParser).parseFromString(a,"text/xml")};Blockly.utils.xml.domToText=function(a){return(new XMLSerializer).serializeToString(a)};Blockly.Events.BlockBase=function(a){Blockly.Events.BlockBase.superClass_.constructor.call(this);this.blockId=a.id;this.workspaceId=a.workspace.id};goog.inherits(Blockly.Events.BlockBase,Blockly.Events.Abstract);Blockly.Events.BlockBase.prototype.toJson=function(){var a=Blockly.Events.BlockBase.superClass_.toJson.call(this);a.blockId=this.blockId;return a};Blockly.Events.BlockBase.prototype.fromJson=function(a){Blockly.Events.BlockBase.superClass_.toJson.call(this);this.blockId=a.blockId};
|
|
Blockly.Events.Change=function(a,b,c,d,e){a&&(Blockly.Events.Change.superClass_.constructor.call(this,a),this.element=b,this.name=c,this.oldValue=d,this.newValue=e)};goog.inherits(Blockly.Events.Change,Blockly.Events.BlockBase);Blockly.Events.BlockChange=Blockly.Events.Change;Blockly.Events.Change.prototype.type=Blockly.Events.CHANGE;
|
|
Blockly.Events.Change.prototype.toJson=function(){var a=Blockly.Events.Change.superClass_.toJson.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};Blockly.Events.Change.prototype.fromJson=function(a){Blockly.Events.Change.superClass_.fromJson.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};Blockly.Events.Change.prototype.isNull=function(){return this.oldValue==this.newValue};
|
|
Blockly.Events.Change.prototype.run=function(a){var b=this.getEventWorkspace_().getBlockById(this.blockId);if(b)switch(b.mutator&&b.mutator.setVisible(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(b=b.getField(this.name))?(b.callValidator(a),b.setValue(a)):console.warn("Can't set non-existent field: "+this.name);break;case "breakpoint":b.enableBreakpoint(a);break;case "comment":b.setCommentText(a||null);break;case "collapsed":b.setCollapsed(a);break;case "disabled":b.setEnabled(!a);
|
|
break;case "inline":b.setInputsInline(a);break;case "mutation":var c="";b.mutationToDom&&(c=(c=b.mutationToDom())&&Blockly.Xml.domToText(c));if(b.domToMutation){var d=Blockly.Xml.textToDom(a||"<mutation/>");b.domToMutation(d);b.initSvg();b.rendered&&b.render()}Blockly.Events.fire(new Blockly.Events.Change(b,"mutation",null,c,a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)};
|
|
Blockly.Events.Create=function(a){a&&(Blockly.Events.Create.superClass_.constructor.call(this,a),this.xml=a.workspace.rendered?Blockly.Xml.blockToDomWithXY(a):Blockly.Xml.blockToDom(a),this.ids=Blockly.Events.getDescendantIds_(a))};goog.inherits(Blockly.Events.Create,Blockly.Events.BlockBase);Blockly.Events.BlockCreate=Blockly.Events.Create;Blockly.Events.Create.prototype.type=Blockly.Events.CREATE;
|
|
Blockly.Events.Create.prototype.toJson=function(){var a=Blockly.Events.Create.superClass_.toJson.call(this);a.xml=Blockly.Xml.domToText(this.xml);a.ids=this.ids;return a};Blockly.Events.Create.prototype.fromJson=function(a){Blockly.Events.Create.superClass_.fromJson.call(this,a);this.xml=Blockly.Xml.textToDom(a.xml);this.ids=a.ids};
|
|
Blockly.Events.Create.prototype.run=function(a){var b=this.getEventWorkspace_();if(a)a=Blockly.utils.xml.createElement("xml"),a.appendChild(this.xml),Blockly.Xml.domToWorkspace(a,b);else{a=0;for(var c;c=this.ids[a];a++){var d=b.getBlockById(c);d?d.dispose(!1,!1):c==this.blockId&&console.warn("Can't uncreate non-existent block: "+c)}}};
|
|
Blockly.Events.Delete=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");Blockly.Events.Delete.superClass_.constructor.call(this,a);this.oldXml=a.workspace.rendered?Blockly.Xml.blockToDomWithXY(a):Blockly.Xml.blockToDom(a);this.ids=Blockly.Events.getDescendantIds_(a)}};goog.inherits(Blockly.Events.Delete,Blockly.Events.BlockBase);Blockly.Events.BlockDelete=Blockly.Events.Delete;Blockly.Events.Delete.prototype.type=Blockly.Events.DELETE;
|
|
Blockly.Events.Delete.prototype.toJson=function(){var a=Blockly.Events.Delete.superClass_.toJson.call(this);a.ids=this.ids;return a};Blockly.Events.Delete.prototype.fromJson=function(a){Blockly.Events.Delete.superClass_.fromJson.call(this,a);this.ids=a.ids};
|
|
Blockly.Events.Delete.prototype.run=function(a){var b=this.getEventWorkspace_();if(a){a=0;for(var c;c=this.ids[a];a++){var d=b.getBlockById(c);d?d.dispose(!1,!1):c==this.blockId&&console.warn("Can't delete non-existent block: "+c)}}else a=Blockly.utils.xml.createElement("xml"),a.appendChild(this.oldXml),Blockly.Xml.domToWorkspace(a,b)};
|
|
Blockly.Events.Move=function(a){a&&(Blockly.Events.Move.superClass_.constructor.call(this,a),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)};goog.inherits(Blockly.Events.Move,Blockly.Events.BlockBase);Blockly.Events.BlockMove=Blockly.Events.Move;Blockly.Events.Move.prototype.type=Blockly.Events.MOVE;
|
|
Blockly.Events.Move.prototype.toJson=function(){var a=Blockly.Events.Move.superClass_.toJson.call(this);this.newParentId&&(a.newParentId=this.newParentId);this.newInputName&&(a.newInputName=this.newInputName);this.newCoordinate&&(a.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y));return a};
|
|
Blockly.Events.Move.prototype.fromJson=function(a){Blockly.Events.Move.superClass_.fromJson.call(this,a);this.newParentId=a.newParentId;this.newInputName=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.newCoordinate=new Blockly.utils.Coordinate(parseFloat(a[0]),parseFloat(a[1])))};Blockly.Events.Move.prototype.recordNew=function(){var a=this.currentLocation_();this.newParentId=a.parentId;this.newInputName=a.inputName;this.newCoordinate=a.coordinate};
|
|
Blockly.Events.Move.prototype.currentLocation_=function(){var a=Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId),b={},c=a.getParent();if(c){if(b.parentId=c.id,a=c.getInputWithBlock(a))b.inputName=a.name}else b.coordinate=a.getRelativeToSurfaceXY();return b};Blockly.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&Blockly.utils.Coordinate.equals(this.oldCoordinate,this.newCoordinate)};
|
|
Blockly.Events.Move.prototype.run=function(a){var b=this.getEventWorkspace_(),c=b.getBlockById(this.blockId);if(c){var d=a?this.newParentId:this.oldParentId,e=a?this.newInputName:this.oldInputName;a=a?this.newCoordinate:this.oldCoordinate;var f=null;if(d&&(f=b.getBlockById(d),!f)){console.warn("Can't connect to non-existent block: "+d);return}c.getParent()&&c.unplug();if(a)e=c.getRelativeToSurfaceXY(),c.moveBy(a.x-e.x,a.y-e.y);else{c=c.outputConnection||c.previousConnection;if(e){if(b=f.getInput(e))var g=
|
|
b.connection}else c.type==Blockly.PREVIOUS_STATEMENT&&(g=f.nextConnection);g?c.connect(g):console.warn("Can't connect to non-existent input: "+e)}}else console.warn("Can't move non-existent block: "+this.blockId)};Blockly.Events.Ui=function(a,b,c,d){Blockly.Events.Ui.superClass_.constructor.call(this);this.blockId=a?a.id:null;this.workspaceId=a?a.workspace.id:null;this.element=b;this.oldValue=c;this.newValue=d;this.recordUndo=!1};goog.inherits(Blockly.Events.Ui,Blockly.Events.Abstract);Blockly.Events.Ui.prototype.type=Blockly.Events.UI;
|
|
Blockly.Events.Ui.prototype.toJson=function(){var a=Blockly.Events.Ui.superClass_.toJson.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.blockId&&(a.blockId=this.blockId);return a};Blockly.Events.Ui.prototype.fromJson=function(a){Blockly.Events.Ui.superClass_.fromJson.call(this,a);this.element=a.element;this.newValue=a.newValue;this.blockId=a.blockId};Blockly.Icon=function(a){this.block_=a};Blockly.Icon.prototype.collapseHidden=!0;Blockly.Icon.prototype.SIZE=25;Blockly.Icon.prototype.bubble_=null;Blockly.Icon.prototype.iconXY_=null;
|
|
Blockly.Icon.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyIconGroup"},null),this.block_.isInFlyout&&Blockly.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.block_.getSvgRoot().appendChild(this.iconGroup_),Blockly.bindEventWithChecks_(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable())};
|
|
Blockly.Icon.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.iconGroup_);this.iconGroup_=null;this.setVisible(!1);this.block_=null};Blockly.Icon.prototype.updateEditable=function(){};Blockly.Icon.prototype.isVisible=function(){return!!this.bubble_};Blockly.Icon.prototype.iconClick_=function(a){this.block_.workspace.isDragging()||this.block_.isInFlyout||Blockly.utils.isRightButton(a)||this.setVisible(!this.isVisible())};
|
|
Blockly.Icon.prototype.updateColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.getColour(),this.block_.getColourSecondary())};
|
|
Blockly.Icon.prototype.renderIcon=function(a){if(this.collapseHidden&&this.block_.isCollapsed()||this.block_.isInsertionMarker())return this.iconGroup_.setAttribute("display","none"),a;this.iconGroup_.setAttribute("display","block");var b=this.SIZE;this.block_.RTL&&(a-=b);this.iconGroup_.setAttribute("transform","translate("+a+",9),scale(1.4)");this.computeIconLocation();return a=this.block_.RTL?a-Blockly.BlockSvg.SEP_SPACE_X:a+(b+Blockly.BlockSvg.SEP_SPACE_X)};
|
|
Blockly.Icon.prototype.moveIcon=function(a,b){var c=this.SIZE;this.block_.RTL&&(a-=c);this.iconGroup_.setAttribute("transform","translate("+a+","+(9+b)+"),scale(1.4)");return a=this.block_.RTL?a-Blockly.BlockSvg.SEP_SPACE_X:a+(c+Blockly.BlockSvg.SEP_SPACE_X)};Blockly.Icon.prototype.setIconLocation=function(a){this.iconXY_=a;this.isVisible()&&this.bubble_.setAnchorLocation(a)};
|
|
Blockly.Icon.prototype.computeIconLocation=function(){var a=this.block_.getRelativeToSurfaceXY(),b=Blockly.utils.getRelativeXY(this.iconGroup_);a=new Blockly.utils.Coordinate(a.x+b.x+this.SIZE/2,a.y+b.y+this.SIZE/2);Blockly.utils.Coordinate.equals(this.getIconLocation(),a)||this.setIconLocation(a)};Blockly.Icon.prototype.getIconLocation=function(){return this.iconXY_};Blockly.Breakpoint=function(a){Blockly.Breakpoint.superClass_.constructor.call(this,a);this.createIcon();this.set_=a.isBreakpointSet()||!1};goog.inherits(Blockly.Breakpoint,Blockly.Icon);Blockly.Breakpoint.prototype.collapseHidden=!1;
|
|
Blockly.Breakpoint.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyBreakpointIconGroup"},null),this.block_.isInFlyout&&Blockly.utils.dom.addClass(this.iconGroup_,"blocklyBreakpointIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.block_.getSvgRoot().appendChild(this.iconGroup_),Blockly.bindEventWithChecks_(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable())};
|
|
Blockly.Breakpoint.prototype.drawIcon_=function(a){var b=this.block_.isBreakpointSet()?"#f00":"#ccc";this.bigDot=Blockly.utils.dom.createSvgElement("circle",{"class":"blocklyBreakpointSymbol",fill:b,stroke:"white","stroke-width":2,cx:7,cy:11.5,r:8},a)};Blockly.Breakpoint.prototype.enableBreakpoint=function(){this.setVisible(this.block_.isBreakpointSet())};Blockly.Breakpoint.prototype.dispose=function(){this.block_.breakpoint=null;goog.dom.removeNode(this.iconGroup_);this.block_=this.iconGroup_=null};
|
|
Blockly.Breakpoint.prototype.setVisible=function(a){a!=this.isVisible()&&(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"breakpointSet",!a,a)),a?this.bigDot.setAttribute("fill","#f00"):this.bigDot.setAttribute("fill","#ccc"),this.set_=!this.set_,this.block_.setBreakpoint(a))};Blockly.Breakpoint.prototype.isVisible=function(){return!!this.set_};Blockly.Breakpoint.prototype.setIconLocation=function(a){this.iconXY_=a};Blockly.Breakpoint.prototype.updateColour=function(){};
|
|
Blockly.Colours={text:"#575E75",workspace:"#F9F9F9",toolboxHover:"#4C97FF",toolboxSelected:"#e9eef2",toolboxText:"#575E75",toolbox:"#FFFFFF",flyout:"#444",scrollbar:"#CECDCE",scrollbarHover:"#CECDCE",textField:"#FFFFFF",insertionMarker:"#000000",insertionMarkerOpacity:.2,dragShadowOpacity:.4,stackGlow:"#FFF200",stackGlowSize:4,stackGlowOpacity:1,replacementGlow:"#FFF200",replacementGlowSize:2,replacementGlowOpacity:1,highlightGlow:"#FFF200",highlightGlowSize:1.1,highlightGlowOpacity:1,selectedGlow:"#FFF200",
|
|
selectedGlowSize:.4,warningGlow:"#E53D00",warningGlowSize:1.1,warningGlowOpacity:1,colourPickerStroke:"#FFFFFF",fieldShadow:"rgba(255, 255, 255, 0.2)",dropDownShadow:"rgba(0, 0, 0, .3)",numPadBackground:"#547AB2",numPadBorder:"#435F91",numPadActiveBackground:"#435F91",numPadText:"#FFFFFF",valueReportBackground:"#FFFFFF",valueReportBorder:"#AAAAAA",canvasTransitionLength:500};Blockly.Touch={};Blockly.Touch.TOUCH_ENABLED="ontouchstart"in Blockly.utils.global||!!(Blockly.utils.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!Blockly.utils.global.navigator||!Blockly.utils.global.navigator.maxTouchPoints&&!Blockly.utils.global.navigator.msMaxTouchPoints);Blockly.Touch.touchIdentifier_=null;Blockly.Touch.TOUCH_MAP={};
|
|
Blockly.utils.global.PointerEvent?Blockly.Touch.TOUCH_MAP={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:Blockly.Touch.TOUCH_ENABLED&&(Blockly.Touch.TOUCH_MAP={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});Blockly.longPid_=0;
|
|
Blockly.longStart_=function(a,b){Blockly.longStop_();a.changedTouches&&1!=a.changedTouches.length||(Blockly.longPid_=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);b&&b.handleRightClick(a)},Blockly.LONGPRESS))};Blockly.longStop_=function(){Blockly.longPid_&&(clearTimeout(Blockly.longPid_),Blockly.longPid_=0)};Blockly.Touch.clearTouchIdentifier=function(){Blockly.Touch.touchIdentifier_=null};
|
|
Blockly.Touch.shouldHandleEvent=function(a){return!Blockly.Touch.isMouseOrTouchEvent(a)||Blockly.Touch.checkTouchIdentifier(a)};Blockly.Touch.getTouchIdentifierFromEvent=function(a){return void 0!=a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};
|
|
Blockly.Touch.checkTouchIdentifier=function(a){var b=Blockly.Touch.getTouchIdentifierFromEvent(a);return void 0!==Blockly.Touch.touchIdentifier_&&null!==Blockly.Touch.touchIdentifier_?Blockly.Touch.touchIdentifier_==b:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(Blockly.Touch.touchIdentifier_=b,!0):!1};Blockly.Touch.setClientFromTouch=function(a){if(Blockly.utils.string.startsWith(a.type,"touch")){var b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}};
|
|
Blockly.Touch.isMouseOrTouchEvent=function(a){return Blockly.utils.string.startsWith(a.type,"touch")||Blockly.utils.string.startsWith(a.type,"mouse")||Blockly.utils.string.startsWith(a.type,"pointer")};Blockly.Touch.isTouchEvent=function(a){return Blockly.utils.string.startsWith(a.type,"touch")||Blockly.utils.string.startsWith(a.type,"pointer")};
|
|
Blockly.Touch.splitEventByTouches=function(a){var b=[];if(a.changedTouches)for(var c=0;c<a.changedTouches.length;c++)b[c]={type:a.type,changedTouches:[a.changedTouches[c]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else b.push(a);return b};Blockly.utils.math={};Blockly.utils.math.toRadians=function(a){return a*Math.PI/180};Blockly.utils.math.toDegrees=function(a){return 180*a/Math.PI};Blockly.utils.math.clamp=function(a,b,c){if(c<a){var d=c;c=a;a=d}return Math.max(a,Math.min(b,c))};Blockly.Events.VarBase=function(a){Blockly.Events.VarBase.superClass_.constructor.call(this);this.varId=a.getId();this.workspaceId=a.workspace.id};goog.inherits(Blockly.Events.VarBase,Blockly.Events.Abstract);Blockly.Events.VarBase.prototype.toJson=function(){var a=Blockly.Events.VarBase.superClass_.toJson.call(this);a.varId=this.varId;return a};Blockly.Events.VarBase.prototype.fromJson=function(a){Blockly.Events.VarBase.superClass_.toJson.call(this);this.varId=a.varId};
|
|
Blockly.Events.VarCreate=function(a){a&&(Blockly.Events.VarCreate.superClass_.constructor.call(this,a),this.varType=a.type,this.varName=a.name)};goog.inherits(Blockly.Events.VarCreate,Blockly.Events.VarBase);Blockly.Events.VarCreate.prototype.type=Blockly.Events.VAR_CREATE;Blockly.Events.VarCreate.prototype.toJson=function(){var a=Blockly.Events.VarCreate.superClass_.toJson.call(this);a.varType=this.varType;a.varName=this.varName;return a};
|
|
Blockly.Events.VarCreate.prototype.fromJson=function(a){Blockly.Events.VarCreate.superClass_.fromJson.call(this,a);this.varType=a.varType;this.varName=a.varName};Blockly.Events.VarCreate.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.createVariable(this.varName,this.varType,this.varId):b.deleteVariableById(this.varId)};Blockly.Events.VarDelete=function(a){a&&(Blockly.Events.VarDelete.superClass_.constructor.call(this,a),this.varType=a.type,this.varName=a.name)};
|
|
goog.inherits(Blockly.Events.VarDelete,Blockly.Events.VarBase);Blockly.Events.VarDelete.prototype.type=Blockly.Events.VAR_DELETE;Blockly.Events.VarDelete.prototype.toJson=function(){var a=Blockly.Events.VarDelete.superClass_.toJson.call(this);a.varType=this.varType;a.varName=this.varName;return a};Blockly.Events.VarDelete.prototype.fromJson=function(a){Blockly.Events.VarDelete.superClass_.fromJson.call(this,a);this.varType=a.varType;this.varName=a.varName};
|
|
Blockly.Events.VarDelete.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.deleteVariableById(this.varId):b.createVariable(this.varName,this.varType,this.varId)};Blockly.Events.VarRename=function(a,b){a&&(Blockly.Events.VarRename.superClass_.constructor.call(this,a),this.oldName=a.name,this.newName=b)};goog.inherits(Blockly.Events.VarRename,Blockly.Events.VarBase);Blockly.Events.VarRename.prototype.type=Blockly.Events.VAR_RENAME;
|
|
Blockly.Events.VarRename.prototype.toJson=function(){var a=Blockly.Events.VarRename.superClass_.toJson.call(this);a.oldName=this.oldName;a.newName=this.newName;return a};Blockly.Events.VarRename.prototype.fromJson=function(a){Blockly.Events.VarRename.superClass_.fromJson.call(this,a);this.oldName=a.oldName;this.newName=a.newName};Blockly.Events.VarRename.prototype.run=function(a){var b=this.getEventWorkspace_();a?b.renameVariableById(this.varId,this.newName):b.renameVariableById(this.varId,this.oldName)};
|
|
Blockly.VariableMap=function(a){this.variableMap_=Object.create(null);this.workspace=a};Blockly.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)};Blockly.VariableMap.prototype.renameVariable=function(a,b){var c=this.getVariable(b,a.type),d=this.workspace.getAllBlocks(!1);Blockly.Events.setGroup(!0);try{c&&c.getId()!=a.getId()?this.renameVariableWithConflict_(a,b,c,d):this.renameVariableAndUses_(a,b,d)}finally{Blockly.Events.setGroup(!1)}};
|
|
Blockly.VariableMap.prototype.renameVariableById=function(a,b){var c=this.getVariableById(a);if(!c)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.renameVariable(c,b)};Blockly.VariableMap.prototype.renameVariableAndUses_=function(a,b,c){Blockly.Events.fire(new Blockly.Events.VarRename(a,b));a.name=b;for(b=0;b<c.length;b++)c[b].updateVarName(a)};
|
|
Blockly.VariableMap.prototype.renameVariableWithConflict_=function(a,b,c,d){var e=a.type;b!=c.name&&this.renameVariableAndUses_(c,b,d);for(b=0;b<d.length;b++)d[b].renameVarById(a.getId(),c.getId());Blockly.Events.fire(new Blockly.Events.VarDelete(a));a=this.getVariablesOfType(e).indexOf(a);this.variableMap_[e].splice(a,1)};
|
|
Blockly.VariableMap.prototype.createVariable=function(a,b,c){var d=this.getVariable(a,b);if(d)return d;if(c&&this.getVariableById(c))throw Error('Variable id, "'+c+'", is already in use.');d=c||Blockly.utils.genUid();b=b||"";d=new Blockly.VariableModel(this.workspace,a,b,d);a=this.variableMap_[b]||[];a.push(d);delete this.variableMap_[b];this.variableMap_[b]=a;return d};
|
|
Blockly.VariableMap.prototype.deleteVariable=function(a){for(var b=this.variableMap_[a.type],c=0,d;d=b[c];c++)if(d.getId()==a.getId()){b.splice(c,1);Blockly.Events.fire(new Blockly.Events.VarDelete(a));break}};
|
|
Blockly.VariableMap.prototype.deleteVariableById=function(a){var b=this.getVariableById(a);if(b){var c=b.name,d=this.getVariableUsesById(a);a=0;for(var e;e=d[a];a++)if("procedures_defnoreturn"==e.type||"procedures_defreturn"==e.type){a=e.getFieldValue("NAME");c=Blockly.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",c).replace("%2",a);Blockly.alert(c);return}var f=this;1<d.length?(c=Blockly.Msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(d.length)).replace("%2",c),Blockly.confirm(c,function(a){a&&
|
|
f.deleteVariableInternal_(b,d)})):f.deleteVariableInternal_(b,d)}else console.warn("Can't delete non-existent variable: "+a)};Blockly.VariableMap.prototype.deleteVariableInternal_=function(a,b){var c=Blockly.Events.getGroup();c||Blockly.Events.setGroup(!0);try{for(var d=0;d<b.length;d++)b[d].dispose(!0,!1);this.deleteVariable(a)}finally{c||Blockly.Events.setGroup(!1)}};
|
|
Blockly.VariableMap.prototype.getVariable=function(a,b){var c=this.variableMap_[b||""];if(c)for(var d=0,e;e=c[d];d++)if(Blockly.Names.equals(e.name,a))return e;return null};Blockly.VariableMap.prototype.getVariableById=function(a){for(var b=Object.keys(this.variableMap_),c=0;c<b.length;c++)for(var d=b[c],e=0,f;f=this.variableMap_[d][e];e++)if(f.getId()==a)return f;return null};Blockly.VariableMap.prototype.getVariablesOfType=function(a){return(a=this.variableMap_[a||""])?a.slice():[]};
|
|
Blockly.VariableMap.prototype.getVariableTypes=function(a){var b=[];a&&a.getPotentialVariableMap()&&(b=Object.keys(a.getPotentialVariableMap().variableMap_));a=Object.keys(this.variableMap_).concat(b);b=!1;for(var c=0;c<a.length;c++)""==a[c]&&(b=!0);b||a.push("");return a};Blockly.VariableMap.prototype.getAllVariables=function(){var a=[],b;for(b in this.variableMap_)a=a.concat(this.variableMap_[b]);return a};
|
|
Blockly.VariableMap.prototype.getVariableUsesById=function(a){for(var b=[],c=this.workspace.getAllBlocks(!1),d=0;d<c.length;d++){var e=c[d].getVarModels();if(e)for(var f=0;f<e.length;f++)e[f].getId()==a&&b.push(c[d])}return b};Blockly.Events.CommentBase=function(a){this.commentId=a.id;this.workspaceId=a.workspace.id;this.blockId=a.blockId||null;this.group=Blockly.Events.group_;this.recordUndo=Blockly.Events.recordUndo};goog.inherits(Blockly.Events.CommentBase,Blockly.Events.Abstract);Blockly.Events.CommentBase.prototype.toJson=function(){var a={type:this.type};this.group&&(a.group=this.group);this.commentId&&(a.commentId=this.commentId);this.blockId&&(a.blockId=this.blockId);return a};
|
|
Blockly.Events.CommentBase.prototype.fromJson=function(a){this.commentId=a.commentId;this.group=a.group;this.blockId=a.blockId};Blockly.Events.CommentBase.prototype.getComment_=function(){return this.getEventWorkspace_().getCommentById(this.commentId)};Blockly.Events.CommentChange=function(a,b,c){a&&(Blockly.Events.CommentChange.superClass_.constructor.call(this,a),this.oldContents_=b,this.newContents_=c)};goog.inherits(Blockly.Events.CommentChange,Blockly.Events.CommentBase);
|
|
Blockly.Events.CommentChange.prototype.type=Blockly.Events.COMMENT_CHANGE;Blockly.Events.CommentChange.prototype.toJson=function(){var a=Blockly.Events.CommentChange.superClass_.toJson.call(this);a.newContents=this.newContents_;return a};Blockly.Events.CommentChange.prototype.fromJson=function(a){Blockly.Events.CommentChange.superClass_.fromJson.call(this,a);this.newContents_=a.newValue};Blockly.Events.CommentChange.prototype.isNull=function(){return this.oldContents_==this.newContents_};
|
|
Blockly.Events.CommentChange.prototype.run=function(a){var b=this.getComment_();b?(a=a?this.newContents_:this.oldContents_,a.hasOwnProperty("minimized")&&b.setMinimized(a.minimized),a.hasOwnProperty("width")&&a.hasOwnProperty("height")&&b.setSize(a.width,a.height),a.hasOwnProperty("text")&&b.setContent(a.text)):console.warn("Can't change non-existent comment: "+this.commentId)};
|
|
Blockly.Events.CommentCreate=function(a){a&&(Blockly.Events.CommentCreate.superClass_.constructor.call(this,a),this.text=a.getContent(),this.xy=a.getXY(),this.width=a.getWidth(),this.height=a.getHeight(),this.minimized=a.isMinimized()||!1,this.xml=a.toXmlWithXY())};goog.inherits(Blockly.Events.CommentCreate,Blockly.Events.CommentBase);Blockly.Events.CommentCreate.prototype.type=Blockly.Events.COMMENT_CREATE;
|
|
Blockly.Events.CommentCreate.prototype.toJson=function(){var a=Blockly.Events.CommentCreate.superClass_.toJson.call(this);a.xml=Blockly.Xml.domToText(this.xml);return a};Blockly.Events.CommentCreate.prototype.fromJson=function(a){Blockly.Events.CommentCreate.superClass_.fromJson.call(this,a);this.xml=Blockly.Xml.textToDom("<xml>"+a.xml+"</xml>").firstChild};
|
|
Blockly.Events.CommentCreate.prototype.run=function(a){if(a)if(a=this.getEventWorkspace_(),this.blockId)(a=a.getBlockById(this.blockId))&&a.setCommentText("",this.commentId,this.xy.x,this.xy.y,this.minimized);else{var b=Blockly.utils.xml.createElement("xml");b.appendChild(this.xml);Blockly.Xml.domToWorkspace(b,a)}else(a=this.getComment_())?a.dispose(!1,!1):console.warn("Can't uncreate non-existent comment: "+this.commentId)};
|
|
Blockly.Events.CommentDelete=function(a){a&&(Blockly.Events.CommentDelete.superClass_.constructor.call(this,a),this.xy=a.getXY(),this.minimized=a.isMinimized()||!1,this.text=a.getContent(),this.height=a.getHeight(),this.width=a.getWidth(),this.xml=a.toXmlWithXY())};goog.inherits(Blockly.Events.CommentDelete,Blockly.Events.CommentBase);Blockly.Events.CommentDelete.prototype.type=Blockly.Events.COMMENT_DELETE;Blockly.Events.CommentDelete.prototype.toJson=function(){return Blockly.Events.CommentDelete.superClass_.toJson.call(this)};
|
|
Blockly.Events.CommentDelete.prototype.fromJson=function(a){Blockly.Events.CommentDelete.superClass_.fromJson.call(this,a)};
|
|
Blockly.Events.CommentDelete.prototype.run=function(a){if(a)(a=this.getComment_())?a.dispose(!1,!1):console.warn("Can't delete non-existent comment: "+this.commentId);else if(a=this.getEventWorkspace_(),this.blockId)a=a.getBlockById(this.blockId),a.setCommentText(this.text,this.commentId,this.xy.x,this.xy.y,this.minimized),a.comment.setSize(this.width,this.height);else{var b=Blockly.utils.xml.createElement("xml");b.appendChild(this.xml);Blockly.Xml.domToWorkspace(b,a)}};
|
|
Blockly.Events.CommentMove=function(a){a&&(Blockly.Events.CommentMove.superClass_.constructor.call(this,a),this.comment_=a,this.workspaceWidth_=a.workspace.getWidth(),this.oldCoordinate_=this.currentLocation_(),this.newCoordinate_=null)};goog.inherits(Blockly.Events.CommentMove,Blockly.Events.CommentBase);
|
|
Blockly.Events.CommentMove.prototype.currentLocation_=function(){var a=this.comment_.getXY();if(!this.comment_.workspace.RTL)return a;if(this.comment_ instanceof Blockly.ScratchBlockComment){var b=this.comment_.getBubbleSize().width;b=this.workspaceWidth_-a.x-b}else b=this.workspaceWidth_-a.x;return new Blockly.utils.Coordinate(b,a.y)};
|
|
Blockly.Events.CommentMove.prototype.recordNew=function(){if(!this.comment_)throw Error("Tried to record the new position of a comment on the same event twice.");this.newCoordinate_=this.currentLocation_();this.comment_=null};Blockly.Events.CommentMove.prototype.type=Blockly.Events.COMMENT_MOVE;Blockly.Events.CommentMove.prototype.setOldCoordinate=function(a){this.oldCoordinate_=new Blockly.utils.Coordinate(this.comment_.workspace.RTL?this.workspaceWidth_-a.x:a.x,a.y)};
|
|
Blockly.Events.CommentMove.prototype.toJson=function(){var a=Blockly.Events.CommentMove.superClass_.toJson.call(this);this.newCoordinate_&&(a.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y));return a};Blockly.Events.CommentMove.prototype.fromJson=function(a){Blockly.Events.CommentMove.superClass_.fromJson.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.newCoordinate_=new Blockly.utils.Coordinate(parseFloat(a[0]),parseFloat(a[1])))};
|
|
Blockly.Events.CommentMove.prototype.isNull=function(){return Blockly.utils.Coordinate.equals(this.oldCoordinate_,this.newCoordinate_)};Blockly.Events.CommentMove.prototype.run=function(a){var b=this.getComment_();if(b){a=a?this.newCoordinate_:this.oldCoordinate_;var c=b.getXY();b.workspace.RTL?b.moveBy(-(a.x-(this.workspaceWidth_-c.x)),a.y-c.y):b.moveBy(a.x-c.x,a.y-c.y)}else console.warn("Can't move non-existent comment: "+this.commentId)};Blockly.WorkspaceComment=function(a,b,c,d,e,f){this.id=f&&!a.getCommentById(f)?f:Blockly.utils.genUid();a.addTopComment(this);this.xy_=new Blockly.utils.Coordinate(0,0);this.height_=c;this.width_=d;this.isMinimized_=e;this.workspace=a;this.RTL=a.RTL;this.editable_=this.movable_=this.deletable_=!0;this.content_=b.trim();this.isComment=!0;Blockly.WorkspaceComment.fireCreateEvent(this)};Blockly.WorkspaceComment.MAX_LABEL_LENGTH=12;Blockly.WorkspaceComment.COMMENT_TEXT_LIMIT=8E3;
|
|
Blockly.WorkspaceComment.prototype.data=null;Blockly.WorkspaceComment.prototype.dispose=function(){this.workspace&&(Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.CommentDelete(this)),this.workspace.removeTopComment(this),this.workspace=null)};Blockly.WorkspaceComment.prototype.getHeight=function(){return this.height_};Blockly.WorkspaceComment.prototype.setHeight=function(a){this.height_=a};Blockly.WorkspaceComment.prototype.getWidth=function(){return this.width_};
|
|
Blockly.WorkspaceComment.prototype.setWidth=function(a){this.width_=a};Blockly.WorkspaceComment.prototype.getXY=function(){return new Blockly.utils.Coordinate(this.xy_.x,this.xy_.y)};Blockly.WorkspaceComment.prototype.moveBy=function(a,b){var c=new Blockly.Events.CommentMove(this);this.xy_.translate(a,b);c.recordNew();Blockly.Events.fire(c)};Blockly.WorkspaceComment.prototype.isDeletable=function(){return this.deletable_&&!(this.workspace&&this.workspace.options.readOnly)};
|
|
Blockly.WorkspaceComment.prototype.setDeletable=function(a){this.deletable_=a};Blockly.WorkspaceComment.prototype.isMovable=function(){return this.movable_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.WorkspaceComment.prototype.setMovable=function(a){this.movable_=a};Blockly.WorkspaceComment.prototype.isEditable=function(){return this.editable_};Blockly.WorkspaceComment.prototype.setEditable=function(a){this.editable_=a};Blockly.WorkspaceComment.prototype.getContent=function(){return this.content_};
|
|
Blockly.WorkspaceComment.prototype.setContent=function(a){this.content_!=a&&(a=a.trim(),Blockly.Events.fire(new Blockly.Events.CommentChange(this,{text:this.content_},{text:a})),this.content_=a)};Blockly.WorkspaceComment.prototype.isMinimized=function(){return this.isMinimized_};Blockly.WorkspaceComment.prototype.getRelativeToSurfaceXY=function(){return this.xy_};
|
|
Blockly.WorkspaceComment.prototype.toXmlWithXY=function(a){a=this.toXml(a);a.setAttribute("x",Math.round(this.xy_.x));a.setAttribute("y",Math.round(this.xy_.y));a.setAttribute("h",this.height_);a.setAttribute("w",this.width_);return a};
|
|
Blockly.WorkspaceComment.prototype.getLabelText=function(){return this.content_.length>Blockly.WorkspaceComment.MAX_LABEL_LENGTH?this.RTL?"\u2026"+this.content_.slice(0,Blockly.WorkspaceComment.MAX_LABEL_LENGTH):this.content_.slice(0,Blockly.WorkspaceComment.MAX_LABEL_LENGTH)+"\u2026":this.content_};
|
|
Blockly.WorkspaceComment.prototype.toXml=function(a){var b=Blockly.utils.xml.createElement("comment");a||(b.id=this.id);b.textContent=this.getContent();this.isMinimized_&&b.setAttribute("minimized",!0);this.data&&b.setAttribute("data",this.data);return b};Blockly.WorkspaceComment.fireCreateEvent=function(a){if(Blockly.Events.isEnabled()){var b=Blockly.Events.getGroup();b||Blockly.Events.setGroup(!0);try{Blockly.Events.fire(new Blockly.Events.CommentCreate(a))}finally{b||Blockly.Events.setGroup(!1)}}};
|
|
Blockly.WorkspaceComment.fromXml=function(a,b){var c=Blockly.WorkspaceComment.parseAttributes(a);c=new Blockly.WorkspaceComment(b,c.content,c.h,c.w,c.minimized,c.id);c.data=a.getAttribute("data");var d=parseInt(a.getAttribute("x"),10),e=parseInt(a.getAttribute("y"),10);isNaN(d)||isNaN(e)||c.moveBy(d,e);Blockly.WorkspaceComment.fireCreateEvent(c);return c};
|
|
Blockly.WorkspaceComment.parseAttributes=function(a){var b=a.getAttribute("h"),c=a.getAttribute("w");return{id:a.getAttribute("id"),h:b?parseInt(b,10):100,w:c?parseInt(c,10):100,x:parseInt(a.getAttribute("x"),10),y:parseInt(a.getAttribute("y"),10),minimized:"true"==a.getAttribute("minimized")||!1,content:a.textContent}};Blockly.Theme=function(a,b){this.blockStyles_=a;this.categoryStyles_=b};Blockly.Theme.prototype.setAllBlockStyles=function(a){for(var b in a)this.setBlockStyle(b,a[b])};Blockly.Theme.prototype.getAllBlockStyles=function(){return this.blockStyles_};Blockly.Theme.prototype.getBlockStyle=function(a){return this.blockStyles_[a]};Blockly.Theme.prototype.setBlockStyle=function(a,b){this.blockStyles_[a]=b};Blockly.Theme.prototype.getCategoryStyle=function(a){return this.categoryStyles_[a]};
|
|
Blockly.Theme.prototype.setCategoryStyle=function(a,b){this.categoryStyles_[a]=b};Blockly.Themes={};Blockly.Themes.Classic={};
|
|
Blockly.Themes.Classic.defaultBlockStyles={colour_blocks:{colourPrimary:"#CF63CF"},field_blocks:{colourPrimary:Blockly.Colours.textField,colourSecondary:Blockly.Colours.textField,colourTertiary:Blockly.Colours.textField},list_blocks:{colourPrimary:"#FF661A"},logic_blocks:{colourPrimary:"#FFBF00"},loop_blocks:{colourPrimary:"#FFAB19"},math_blocks:{colourPrimary:"#59C059"},procedure_blocks:{colourPrimary:"#9966FF"},text_blocks:{colourPrimary:"#4CBFE6"},variable_blocks:{colourPrimary:"#FF8C1A"},variable_dynamic_blocks:{colourPrimary:"310"},
|
|
hat_blocks:{colourPrimary:"330",hat:"cap"}};Blockly.Themes.Classic.categoryStyles={colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}};Blockly.Themes.Classic=new Blockly.Theme(Blockly.Themes.Classic.defaultBlockStyles,Blockly.Themes.Classic.categoryStyles);Blockly.Workspace=function(a){this.id=Blockly.utils.genUid();Blockly.Workspace.WorkspaceDB_[this.id]=this;this.options=a||{};this.RTL=!!this.options.RTL;this.horizontalLayout=!!this.options.horizontalLayout;this.toolboxPosition=this.options.toolboxPosition;this.topBlocks_=[];this.topComments_=[];this.commentDB_=Object.create(null);this.listeners_=[];this.tapListeners_=[];this.undoStack_=[];this.redoStack_=[];this.blockDB_=Object.create(null);this.typedBlocksDB_=Object.create(null);this.variableMap_=
|
|
new Blockly.VariableMap(this);this.potentialVariableMap_=null;Blockly.getTheme()||Blockly.setTheme(Blockly.Themes.Classic)};Blockly.Workspace.prototype.rendered=!1;Blockly.Workspace.prototype.isClearing=!1;Blockly.Workspace.prototype.MAX_UNDO=1024;Blockly.Workspace.prototype.connectionDBList=null;Blockly.Workspace.prototype.dispose=function(){this.listeners_.length=0;this.clear();delete Blockly.Workspace.WorkspaceDB_[this.id]};Blockly.Workspace.SCAN_ANGLE=3;
|
|
Blockly.Workspace.prototype.sortObjects_=function(a,b){var c=a.getRelativeToSurfaceXY(),d=b.getRelativeToSurfaceXY();return c.y+Blockly.Workspace.prototype.sortObjects_.offset*c.x-(d.y+Blockly.Workspace.prototype.sortObjects_.offset*d.x)};Blockly.Workspace.prototype.addTopBlock=function(a){this.topBlocks_.push(a)};Blockly.Workspace.prototype.removeTopBlock=function(a){if(!Blockly.utils.arrayRemove(this.topBlocks_,a))throw Error("Block not present in workspace's list of top-most blocks.");};
|
|
Blockly.Workspace.prototype.getTopBlocks=function(a){var b=[].concat(this.topBlocks_);a&&1<b.length&&(this.sortObjects_.offset=Math.sin(Blockly.utils.math.toRadians(Blockly.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b};Blockly.Workspace.prototype.addTypedBlock=function(a){this.typedBlocksDB_[a.type]||(this.typedBlocksDB_[a.type]=[]);this.typedBlocksDB_[a.type].push(a)};
|
|
Blockly.Workspace.prototype.removeTypedBlock=function(a){this.typedBlocksDB_[a.type].splice(this.typedBlocksDB_[a.type].indexOf(a),1);this.typedBlocksDB_[a.type].length||delete this.typedBlocksDB_[a.type]};
|
|
Blockly.Workspace.prototype.getBlocksByType=function(a,b){if(!this.typedBlocksDB_[a])return[];var c=this.typedBlocksDB_[a].slice(0);b&&1<c.length&&(this.sortObjects_.offset=Math.sign(Blockly.utils.math.toRadians(Blockly.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),c.sort(this.sortObjects_));return c};
|
|
Blockly.Workspace.prototype.addTopComment=function(a){this.topComments_.push(a);this.commentDB_[a.id]&&console.warn('Overriding an existing comment on this workspace, with id "'+a.id+'"');this.commentDB_[a.id]=a};Blockly.Workspace.prototype.removeTopComment=function(a){if(!Blockly.utils.arrayRemove(this.topComments_,a))throw Error("Comment not present in workspace's list of top-most comments.");delete this.commentDB_[a.id]};
|
|
Blockly.Workspace.prototype.getTopComments=function(a){var b=[].concat(this.topComments_);a&&1<b.length&&(this.sortObjects_.offset=Math.sin(Blockly.utils.math.toRadians(Blockly.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),b.sort(this.sortObjects_));return b};
|
|
Blockly.Workspace.prototype.getTopComments=function(a){var b=[].concat(this.topComments_);if(a&&1<b.length){var c=Math.sin(goog.math.toRadians(Blockly.Workspace.SCAN_ANGLE));this.RTL&&(c*=-1);b.sort(function(a,b){var d=a.getRelativeToSurfaceXY(),e=b.getRelativeToSurfaceXY();return d.y+c*d.x-(e.y+c*e.x)})}return b};
|
|
Blockly.Workspace.prototype.getAllBlocks=function(a){if(a){a=this.getTopBlocks(!0);for(var b=[],c=0;c<a.length;c++)b.push.apply(b,a[c].getDescendants(!0))}else for(b=this.getTopBlocks(!1),c=0;c<b.length;c++)b.push.apply(b,b[c].getChildren(!1));return b.filter(function(a){return!a.isInsertionMarker()})};
|
|
Blockly.Workspace.prototype.clear=function(){this.isClearing=!0;try{var a=Blockly.Events.getGroup();for(a||Blockly.Events.setGroup(!0);this.topBlocks_.length;)this.topBlocks_[0].dispose();for(;this.topComments_.length;)this.topComments_[this.topComments_.length-1].dispose();a||Blockly.Events.setGroup(!1);this.variableMap_.clear();Blockly.DropDownDiv&&Blockly.DropDownDiv.hideWithoutAnimation();Blockly.WidgetDiv&&Blockly.WidgetDiv.hide(!0);this.potentialVariableMap_&&this.potentialVariableMap_.clear()}finally{this.isClearing=
|
|
!1}};Blockly.Workspace.prototype.renameVariableById=function(a,b){this.variableMap_.renameVariableById(a,b)};Blockly.Workspace.prototype.createVariable=function(a,b,c){return this.variableMap_.createVariable(a,b,c)};Blockly.Workspace.prototype.getVariableUsesById=function(a){return this.variableMap_.getVariableUsesById(a)};Blockly.Workspace.prototype.deleteVariableById=function(a){this.variableMap_.deleteVariableById(a)};
|
|
Blockly.Workspace.prototype.deleteVariableInternal_=function(a,b){this.variableMap_.deleteVariableInternal_(a,b)};Blockly.Workspace.prototype.variableIndexOf=function(a){console.warn("Deprecated call to Blockly.Workspace.prototype.variableIndexOf");return-1};Blockly.Workspace.prototype.getVariable=function(a,b){return this.variableMap_.getVariable(a,b)};Blockly.Workspace.prototype.getVariableById=function(a){return this.variableMap_.getVariableById(a)};
|
|
Blockly.Workspace.prototype.getVariablesOfType=function(a){return this.variableMap_.getVariablesOfType(a)};Blockly.Workspace.prototype.getVariableTypes=function(){return this.variableMap_.getVariableTypes(this)};Blockly.Workspace.prototype.getAllVariables=function(){return this.variableMap_.getAllVariables()};Blockly.Workspace.prototype.getWidth=function(){return 0};Blockly.Workspace.prototype.newBlock=function(a,b){return new Blockly.Block(this,a,b)};
|
|
Blockly.Workspace.prototype.remainingCapacity=function(){return isNaN(this.options.maxBlocks)?Infinity:this.options.maxBlocks-this.getAllBlocks().length};Blockly.Workspace.prototype.remainingCapacityOfType=function(a){return this.options.maxInstances?(this.options.maxInstances[a]||Infinity)-this.getBlocksByType(a).length:Infinity};
|
|
Blockly.Workspace.prototype.isCapacityAvailable=function(a){if(!this.hasBlockLimits())return!0;var b=0,c;for(c in a){if(a[c]>this.remainingCapacityOfType(c))return!1;b+=a[c]}return b>this.remainingCapacity()?!1:!0};Blockly.Workspace.prototype.hasBlockLimits=function(){return Infinity!=this.options.maxBlocks||!!this.options.maxInstances};
|
|
Blockly.Workspace.prototype.undo=function(a){var b=a?this.redoStack_:this.undoStack_,c=a?this.undoStack_:this.redoStack_,d=b.pop();if(d){for(var e=[d];b.length&&d.group&&d.group==b[b.length-1].group;)e.push(b.pop());for(b=0;d=e[b];b++)c.push(d);e=Blockly.Events.filter(e,a);Blockly.Events.recordUndo=!1;try{for(b=0;d=e[b];b++)d.run(a)}finally{Blockly.Events.recordUndo=!0}}};Blockly.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0;this.redoStack_.length=0;Blockly.Events.clearPendingUndo()};
|
|
Blockly.Workspace.prototype.hasRedoStack=function(){return 0!=this.redoStack_.length};Blockly.Workspace.prototype.hasUndoStack=function(){return 0!=this.undoStack_.length};Blockly.Workspace.prototype.addChangeListener=function(a){this.listeners_.push(a);return a};Blockly.Workspace.prototype.removeChangeListener=function(a){Blockly.utils.arrayRemove(this.listeners_,a)};
|
|
Blockly.Workspace.prototype.fireChangeListener=function(a){if(a.recordUndo)for(this.undoStack_.push(a),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var b=this.listeners_.slice(),c=0,d;d=b[c];c++)d(a)};Blockly.Workspace.prototype.getBlockById=function(a){var b=this.blockDB_[a];!b&&this.getFlyout()&&this.getFlyout().getWorkspace()&&(b=this.getFlyout().getWorkspace().blockDB_[a]);return b||null};Blockly.Workspace.prototype.getFlyout=function(){return null};
|
|
Blockly.Workspace.prototype.getCommentById=function(a){return this.commentDB_[a]||null};Blockly.Workspace.prototype.addCommentById=function(a){this.commentDB_[a.id]&&console.warn('Overriding an existing comment on this workspace, with id "'+a.id+'"');this.commentDB_[a.id]=a};Blockly.Workspace.prototype.removeCommentById=function(a){delete this.commentDB_[a]};Blockly.Workspace.prototype.getCommentById=function(a){return this.commentDB_[a]||null};
|
|
Blockly.Workspace.prototype.allInputsFilled=function(a){for(var b=this.getTopBlocks(!1),c=0,d;d=b[c];c++)if(!d.allInputsFilled(a))return!1;return!0};Blockly.Workspace.prototype.getPotentialVariableMap=function(){return this.potentialVariableMap_};Blockly.Workspace.prototype.createPotentialVariableMap=function(){this.potentialVariableMap_=new Blockly.VariableMap(this)};Blockly.Workspace.prototype.getVariableMap=function(){return this.variableMap_};Blockly.Workspace.WorkspaceDB_=Object.create(null);
|
|
Blockly.Workspace.getById=function(a){return Blockly.Workspace.WorkspaceDB_[a]||null};Blockly.Workspace.prototype.setDebugModeOption=function(a){this.options.debugMode=a};Blockly.Workspace.getAll=function(){var a=[],b;for(b in Blockly.Workspace.WorkspaceDB_)a.push(Blockly.Workspace.WorkspaceDB_[b]);return a};Blockly.Workspace.prototype.clear=Blockly.Workspace.prototype.clear;Blockly.Workspace.prototype.clearUndo=Blockly.Workspace.prototype.clearUndo;Blockly.Workspace.prototype.addChangeListener=Blockly.Workspace.prototype.addChangeListener;
|
|
Blockly.Workspace.prototype.removeChangeListener=Blockly.Workspace.prototype.removeChangeListener;Blockly.Bubble=function(a,b,c,d,e,f){this.workspace_=a;this.content_=b;this.shape_=c;c=Blockly.Bubble.ARROW_ANGLE;this.workspace_.RTL&&(c=-c);this.arrow_radians_=Blockly.utils.math.toRadians(c);a.getBubbleCanvas().appendChild(this.createDom_(b,!(!e||!f)));this.setAnchorLocation(d);e&&f||(b=this.content_.getBBox(),e=b.width+2*Blockly.Bubble.BORDER_WIDTH,f=b.height+2*Blockly.Bubble.BORDER_WIDTH);this.setBubbleSize(e,f);this.positionBubble_();this.renderArrow_();this.rendered_=!0;a.options.readOnly||
|
|
(Blockly.bindEventWithChecks_(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&Blockly.bindEventWithChecks_(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_))};Blockly.Bubble.BORDER_WIDTH=1;Blockly.Bubble.RESIZE_SIZE=12*Blockly.Bubble.BORDER_WIDTH;Blockly.Bubble.ARROW_THICKNESS=5;Blockly.Bubble.ARROW_ANGLE=20;Blockly.Bubble.ARROW_BEND=4;Blockly.Bubble.ANCHOR_RADIUS=8;Blockly.Bubble.LINE_THICKNESS=1;Blockly.Bubble.onMouseUpWrapper_=null;
|
|
Blockly.Bubble.onMouseMoveWrapper_=null;Blockly.Bubble.prototype.resizeCallback_=null;Blockly.Bubble.unbindDragEvents_=function(){Blockly.Bubble.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Bubble.onMouseUpWrapper_),Blockly.Bubble.onMouseUpWrapper_=null);Blockly.Bubble.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Bubble.onMouseMoveWrapper_),Blockly.Bubble.onMouseMoveWrapper_=null)};Blockly.Bubble.bubbleMouseUp_=function(){Blockly.Touch.clearTouchIdentifier();Blockly.Bubble.unbindDragEvents_()};
|
|
Blockly.Bubble.prototype.rendered_=!1;Blockly.Bubble.prototype.anchorXY_=null;Blockly.Bubble.prototype.relativeLeft_=0;Blockly.Bubble.prototype.relativeTop_=0;Blockly.Bubble.prototype.width_=0;Blockly.Bubble.prototype.height_=0;Blockly.Bubble.prototype.autoLayout_=!0;Blockly.Bubble.prototype.useArrow_=!1;
|
|
Blockly.Bubble.prototype.createDom_=function(a,b){this.bubbleGroup_=Blockly.utils.dom.createSvgElement("g",{},null);var c={filter:"url(#"+this.workspace_.options.embossFilterId+")"};if(Blockly.utils.userAgent.JAVA_FX||!this.useArrow_)c={};c=Blockly.utils.dom.createSvgElement("g",c,this.bubbleGroup_);this.bubbleArrow_=Blockly.utils.dom.createSvgElement(this.useArrow_?"path":"line",{},c);this.bubbleBack_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyDraggable",x:0,y:0,rx:Blockly.Bubble.BORDER_WIDTH,
|
|
ry:Blockly.Bubble.BORDER_WIDTH},c);this.bubbleGroup_.appendChild(a);b?(this.resizeGroup_=Blockly.utils.dom.createSvgElement("g",{"class":this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),c=Blockly.Bubble.RESIZE_SIZE,Blockly.utils.dom.createSvgElement("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.resizeGroup_),Blockly.utils.dom.createSvgElement("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/3},this.resizeGroup_),Blockly.utils.dom.createSvgElement("line",
|
|
{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.resizeGroup_)):this.resizeGroup_=null;return this.bubbleGroup_};Blockly.Bubble.prototype.getSvgRoot=function(){return this.bubbleGroup_};Blockly.Bubble.prototype.setSvgId=function(a){this.bubbleGroup_.dataset&&(this.bubbleGroup_.dataset.blockId=a)};Blockly.Bubble.prototype.bubbleMouseDown_=function(a){var b=this.workspace_.getGesture(a);b&&b.handleBubbleStart(a,this)};Blockly.Bubble.prototype.showContextMenu_=function(a){};
|
|
Blockly.Bubble.prototype.isDeletable=function(){return!1};
|
|
Blockly.Bubble.prototype.resizeMouseDown_=function(a){this.promote_();Blockly.Bubble.unbindDragEvents_();Blockly.utils.isRightButton(a)||(this.workspace_.startDrag(a,new Blockly.utils.Coordinate(this.workspace_.RTL?-this.width_:this.width_,this.height_)),Blockly.Bubble.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,Blockly.Bubble.bubbleMouseUp_),Blockly.Bubble.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.resizeMouseMove_),Blockly.hideChaff());
|
|
a.stopPropagation()};Blockly.Bubble.prototype.resizeMouseMove_=function(a){this.autoLayout_=!1;a=this.workspace_.moveDrag(a);this.setBubbleSize(this.workspace_.RTL?-a.x:a.x,a.y);this.workspace_.RTL&&this.positionBubble_()};Blockly.Bubble.prototype.registerResizeEvent=function(a){this.resizeCallback_=a};Blockly.Bubble.prototype.promote_=function(){var a=this.bubbleGroup_.parentNode;return a.lastChild!==this.bubbleGroup_?(a.appendChild(this.bubbleGroup_),!0):!1};
|
|
Blockly.Bubble.prototype.setAnchorLocation=function(a){this.anchorXY_=a;this.rendered_&&this.positionBubble_()};
|
|
Blockly.Bubble.prototype.layoutBubble_=function(){var a=this.workspace_.getMetrics();a.viewLeft/=this.workspace_.scale;a.viewWidth/=this.workspace_.scale;a.viewTop/=this.workspace_.scale;a.viewHeight/=this.workspace_.scale;var b=this.getOptimalRelativeLeft_(a),c=this.getOptimalRelativeTop_(a),d=this.shape_.getBBox(),e={x:b,y:-this.height_-Blockly.BlockSvg.MIN_BLOCK_Y},f={x:-this.width_-30,y:c};c={x:d.width,y:c};var g={x:b,y:d.height};b=d.width<d.height?c:g;d=d.width<d.height?g:c;c=this.getOverlap_(e,
|
|
a);g=this.getOverlap_(f,a);var h=this.getOverlap_(b,a);a=this.getOverlap_(d,a);a=Math.max(c,g,h,a);c==a?(this.relativeLeft_=e.x,this.relativeTop_=e.y):g==a?(this.relativeLeft_=f.x,this.relativeTop_=f.y):h==a?(this.relativeLeft_=b.x,this.relativeTop_=b.y):(this.relativeLeft_=d.x,this.relativeTop_=d.y)};
|
|
Blockly.Bubble.prototype.getOverlap_=function(a,b){var c=this.workspace_.RTL?this.anchorXY_.x-a.x-this.width_:a.x+this.anchorXY_.x,d=a.y+this.anchorXY_.y;return Math.max(0,Math.min(1,(Math.min(c+this.width_,b.viewLeft+b.viewWidth)-Math.max(c,b.viewLeft))*(Math.min(d+this.height_,b.viewTop+b.viewHeight)-Math.max(d,b.viewTop))/(this.width_*this.height_)))};
|
|
Blockly.Bubble.prototype.getOptimalRelativeLeft_=function(a){var b=-this.width_/4;if(this.width_>a.viewWidth)return b;if(this.workspace_.RTL)var c=this.anchorXY_.x-b,d=c-this.width_,e=a.viewLeft+a.viewWidth,f=a.viewLeft+Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale;else d=b+this.anchorXY_.x,c=d+this.width_,f=a.viewLeft,e=a.viewLeft+a.viewWidth-Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale;this.workspace_.RTL?d<f?b=-(f-this.anchorXY_.x+this.width_):c>e&&(b=-(e-this.anchorXY_.x)):
|
|
d<f?b=f-this.anchorXY_.x:c>e&&(b=e-this.anchorXY_.x-this.width_);return b};Blockly.Bubble.prototype.getOptimalRelativeTop_=function(a){var b=-this.height_/4;if(this.height_>a.viewHeight)return b;var c=this.anchorXY_.y+b,d=c+this.height_,e=a.viewTop;a=a.viewTop+a.viewHeight-Blockly.Scrollbar.scrollbarThickness/this.workspace_.scale;var f=this.anchorXY_.y;c<e?b=e-f:d>a&&(b=a-f-this.height_);return b};
|
|
Blockly.Bubble.prototype.positionBubble_=function(){var a=this.anchorXY_.x;a=this.workspace_.RTL?a-this.relativeLeft_:a+this.relativeLeft_;this.moveTo(a,this.relativeTop_+this.anchorXY_.y)};Blockly.Bubble.prototype.moveTo=function(a,b){this.bubbleGroup_.setAttribute("transform","translate("+a+","+b+")")};Blockly.Bubble.prototype.getBubbleSize=function(){return{width:this.width_,height:this.height_}};
|
|
Blockly.Bubble.prototype.setBubbleSize=function(a,b){var c=2*Blockly.Bubble.BORDER_WIDTH;a=Math.max(a,c+45);b=Math.max(b,c+20);this.width_=a;this.height_=b;this.bubbleBack_.setAttribute("width",a);this.bubbleBack_.setAttribute("height",b);if(this.resizeGroup_){var d=Blockly.Bubble.RESIZE_SIZE;this.workspace_.RTL?this.resizeGroup_.setAttribute("transform","translate("+d+","+(b-c)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(a-d)+","+(b-d)+")")}this.rendered_&&(this.autoLayout_&&
|
|
this.layoutBubble_(),this.positionBubble_(),this.renderArrow_());this.resizeCallback_&&this.resizeCallback_()};Blockly.Bubble.prototype.renderArrow_=function(){this.useArrow_?this.drawArrow_():this.drawLine_()};
|
|
Blockly.Bubble.prototype.drawArrow_=function(){var a=[],b=this.width_/2,c=this.height_/2,d=-this.relativeLeft_,e=-this.relativeTop_;if(b==d&&c==e)a.push("M "+b+","+c);else{e-=c;d-=b;this.workspace_.RTL&&(d*=-1);var f=Math.sqrt(e*e+d*d),g=Math.acos(d/f);0>e&&(g=2*Math.PI-g);var h=g+Math.PI/2;h>2*Math.PI&&(h-=2*Math.PI);var k=Math.sin(h),l=Math.cos(h),m=this.getBubbleSize();h=(m.width+m.height)/Blockly.Bubble.ARROW_THICKNESS;h=Math.min(h,m.width,m.height)/4;m=1-Blockly.Bubble.ANCHOR_RADIUS/f;d=b+m*
|
|
d;e=c+m*e;m=b+h*l;var n=c+h*k;b-=h*l;c-=h*k;k=g+this.arrow_radians_;k>2*Math.PI&&(k-=2*Math.PI);g=Math.sin(k)*f/Blockly.Bubble.ARROW_BEND;f=Math.cos(k)*f/Blockly.Bubble.ARROW_BEND;a.push("M"+m+","+n);a.push("C"+(m+f)+","+(n+g)+" "+d+","+e+" "+d+","+e);a.push("C"+d+","+e+" "+(b+f)+","+(c+g)+" "+b+","+c)}a.push("z");this.bubbleArrow_.setAttribute("d",a.join(" "))};
|
|
Blockly.Bubble.prototype.drawLine_=function(){var a=this.width_/2,b=Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT/2,c=-this.relativeLeft_,d=-this.relativeTop_;if(a!=c||b!=d)d-=b,c-=a,this.workspace_.RTL&&(c=-1*c-this.width_),this.bubbleArrow_.setAttribute("x1",a),this.bubbleArrow_.setAttribute("y1",b),this.bubbleArrow_.setAttribute("x2",a+c),this.bubbleArrow_.setAttribute("y2",b+d),this.bubbleArrow_.setAttribute("stroke-width",Blockly.Bubble.LINE_THICKNESS)};
|
|
Blockly.Bubble.prototype.setColour=function(a,b){this.bubbleBack_.setAttribute("fill",a);this.useArrow_?this.bubbleArrow_.setAttribute("fill",a):(this.bubbleBack_.setAttribute("stroke",b),this.bubbleArrow_.setAttribute("stroke",b))};Blockly.Bubble.prototype.dispose=function(){Blockly.Bubble.unbindDragEvents_();Blockly.utils.dom.removeNode(this.bubbleGroup_);this.shape_=this.content_=this.workspace_=this.resizeGroup_=this.bubbleBack_=this.bubbleArrow_=this.bubbleGroup_=null};
|
|
Blockly.Bubble.prototype.moveDuringDrag=function(a,b){a?a.translateSurface(b.x,b.y):this.moveTo(b.x,b.y);this.relativeLeft_=this.workspace_.RTL?this.anchorXY_.x-b.x-this.width_:b.x-this.anchorXY_.x;this.relativeTop_=b.y-this.anchorXY_.y;this.renderArrow_()};Blockly.Bubble.prototype.getRelativeToSurfaceXY=function(){return new Blockly.utils.Coordinate(this.workspace_.RTL?this.anchorXY_.x-this.relativeLeft_:this.anchorXY_.x+this.relativeLeft_,this.anchorXY_.y+this.relativeTop_)};
|
|
Blockly.Bubble.prototype.setAutoLayout=function(a){this.autoLayout_=a};
|
|
Blockly.Comment=function(a){Blockly.Comment.superClass_.constructor.call(this,a);this.createIcon()};goog.inherits(Blockly.Comment,Blockly.Icon);Blockly.Comment.prototype.text_="";Blockly.Comment.prototype.width_=160;Blockly.Comment.prototype.height_=80;
|
|
Blockly.Comment.prototype.drawIcon_=function(a){Blockly.utils.dom.createSvgElement("path",{"class":"blocklyIconShape",d:"m 2,2 0,9.2211 3.0026599,0 1.6008929,1.5989 1.8138195,-1.5989 6.6046683,0 0,-9.2211 -13.0220406,0 z",style:"fill: #fff;"},a);Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"4",y:"8",height:"1",width:"6",style:"fill: #575E75;"},a);Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"4",y:"6",height:"1",width:"6",style:"fill: #575E75;"},
|
|
a);Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"4",y:"4",height:"1",width:"8",style:"fill: #575E75;"},a)};
|
|
Blockly.Comment.prototype.createEditor_=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyCommentBubble"},null);this.svgGroup_.translate_="";this.createTextEditor_();this.svgGroup_.appendChild(this.foreignObject_);this.createTopBarIcons_();Blockly.bindEventWithChecks_(this.deleteIcon_,"mousedown",this,this.deleteMouseDown_);Blockly.bindEventWithChecks_(this.deleteIcon_,"mouseup",this,this.deleteMouseUp_);Blockly.bindEventWithChecks_(this.minimizeArrow_,"mousedown",
|
|
this,this.minimizeMouseUp_);return this.svgGroup_};
|
|
Blockly.Comment.prototype.createTextEditor_=function(){this.foreignObject_=Blockly.utils.dom.createSvgElement("foreignObject",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH+Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT},null);var a=document.createElementNS(Blockly.utils.dom.HTML_NS,"body");a.setAttribute("xmlns",Blockly.utils.dom.HTML_NS);a.className="blocklyMinimalBody";var b=document.createElementNS(Blockly.utils.dom.HTML_NS,"textarea");b.className="blocklyCommentTextarea";b.setAttribute("dir",
|
|
this.block_.RTL?"RTL":"LTR");a.appendChild(b);this.textarea_=b;this.foreignObject_.appendChild(a);Blockly.bindEventWithChecks_(b,"mouseup",this,this.textareaFocus_,!0,!0);Blockly.bindEventWithChecks_(b,"wheel",this,function(a){a.stopPropagation()});Blockly.bindEventWithChecks_(b,"change",this,function(a){this.text_!=b.value&&(Blockly.Events.fire(new Blockly.Events.BlockChange(this.block_,"comment",null,this.text_,b.value)),this.text_=b.value)});setTimeout(function(){b.focus()},0);return this.foreignObject_};
|
|
Blockly.Comment.prototype.createTopBarIcons_=function(){this.minimizeArrow_=Blockly.utils.dom.createSvgElement("image",{x:Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET,y:Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT/2+Blockly.WorkspaceCommentSvg.BORDER_WIDTH-Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE/2,width:Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE,height:Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE},this.svgGroup_);this.minimizeArrow_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",
|
|
Blockly.mainWorkspace.options.pathToMedia+"comment-arrow-down.svg");this.deleteIcon_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyCommentDeleteIcon"},this.svgGroup_);Blockly.utils.dom.createSvgElement("rect",{x:"-12.5",y:"1",width:"27.5",height:"27.5",fill:"transparent","class":"blocklyDeleteIconShape"},this.deleteIcon_);Blockly.WorkspaceCommentSvg.drawDeleteIcon(this.deleteIcon_)};Blockly.Comment.prototype.deleteMouseDown_=function(a){a.stopPropagation()};
|
|
Blockly.Comment.prototype.deleteMouseUp_=function(a){this.block_.setCommentText(null);a.stopPropagation();Blockly.Touch.clearTouchIdentifier()};Blockly.Comment.prototype.minimizeMouseUp_=function(a){this.block_.comment.setVisible(!1);a.stopPropagation();Blockly.Touch.clearTouchIdentifier()};Blockly.Comment.prototype.updateEditable=function(){this.isVisible()&&(this.setVisible(!1),this.setVisible(!0));Blockly.Icon.prototype.updateEditable.call(this)};
|
|
Blockly.Comment.prototype.resizeBubble_=function(){if(this.isVisible()){var a=this.bubble_.getBubbleSize(),b=2*Blockly.Bubble.BORDER_WIDTH,c=Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT;this.foreignObject_.setAttribute("width",Math.max(a.width-b,0));this.foreignObject_.setAttribute("height",Math.max(a.height-b-c,0));this.textarea_.style.width=a.width-b-4+"px";this.textarea_.style.height=a.height-b-c-4+"px";this.RTL?(this.minimizeArrow_.setAttribute("x",a.width-Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE-
|
|
Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET),this.minimizeArrow_.setAttribute("transform","translate("+-a.width+", 1)"),this.deleteIcon_.setAttribute("transform","translate("+(-a.width+Blockly.WorkspaceCommentSvg.DELETE_ICON_SIZE+Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET)+",0) scale(-1 1)")):this.deleteIcon_.setAttribute("transform","translate("+(a.width-Blockly.WorkspaceCommentSvg.DELETE_ICON_SIZE-Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET)+",0)")}};
|
|
Blockly.Comment.prototype.setVisible=function(a){if(a!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"commentOpen",!a,a)),!this.block_.isEditable()&&!this.textarea_||Blockly.utils.userAgent.IE)Blockly.Warning.prototype.setVisible.call(this,a);else{var b=this.getText(),c=this.getBubbleSize();a?(this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svgPath_,this.iconXY_,this.width_,this.height_),this.bubble_.setSvgId(this.block_.id),this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this)),
|
|
this.updateColour()):(this.bubble_.dispose(),this.foreignObject_=this.textarea_=this.bubble_=null);this.setText(b);this.setBubbleSize(c.width,c.height)}};Blockly.Comment.prototype.textareaFocus_=function(a){this.bubble_.promote_()&&this.textarea_.focus()};Blockly.Comment.prototype.getBubbleSize=function(){return this.isVisible()?this.bubble_.getBubbleSize():{width:this.width_,height:this.height_}};
|
|
Blockly.Comment.prototype.setBubbleSize=function(a,b){this.textarea_?this.bubble_.setBubbleSize(a,b):(this.width_=a,this.height_=b)};Blockly.Comment.prototype.getText=function(){return this.textarea_?this.textarea_.value:this.text_};Blockly.Comment.prototype.setText=function(a){this.text_!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(this.block_,"comment",null,this.text_,a)),this.text_=a);this.textarea_&&(this.textarea_.value=a)};
|
|
Blockly.Comment.prototype.dispose=function(){Blockly.Events.isEnabled()&&this.setText("");this.block_.comment=null;Blockly.Icon.prototype.dispose.call(this)};Blockly.Events.FinishedLoading=function(a){this.workspaceId=a.id;this.group=Blockly.Events.group_;this.recordUndo=!1};goog.inherits(Blockly.Events.FinishedLoading,Blockly.Events.Abstract);Blockly.Events.FinishedLoading.prototype.type=Blockly.Events.FINISHED_LOADING;Blockly.Events.FinishedLoading.prototype.toJson=function(){var a={type:this.type};this.group&&(a.group=this.group);this.workspaceId&&(a.workspaceId=this.workspaceId);return a};
|
|
Blockly.Events.FinishedLoading.prototype.fromJson=function(a){this.workspaceId=a.workspaceId;this.group=a.group};Blockly.Xml={};Blockly.Xml.workspaceToDom=function(a,b){var c=Blockly.utils.xml.createElement("xml"),d=Blockly.Xml.variablesToDom(a.getAllVariables(a));d.hasChildNodes()&&c.appendChild(d);var e=a.getTopComments(!0);d=0;for(var f;f=e[d];d++)c.appendChild(f.toXmlWithXY(b));e=a.getTopBlocks(!0);for(d=0;f=e[d];d++)c.appendChild(Blockly.Xml.blockToDomWithXY(f,b));return c};
|
|
Blockly.Xml.variablesToDom=function(a){for(var b=Blockly.utils.xml.createElement("variables"),c=0,d;d=a[c];c++){var e=Blockly.utils.xml.createElement("variable");e.appendChild(Blockly.utils.xml.createTextNode(d.name));d.type&&e.setAttribute("type",d.type);e.id=d.getId();b.appendChild(e)}return b};
|
|
Blockly.Xml.blockToDomWithXY=function(a,b){var c;a.workspace.RTL&&(c=a.workspace.getWidth());var d=Blockly.Xml.blockToDom(a,b),e=a.getRelativeToSurfaceXY();d.setAttribute("x",Math.round(a.workspace.RTL?c-e.x:e.x));d.setAttribute("y",Math.round(e.y));return d};Blockly.Xml.fieldToDom_=function(a){if(a.isSerializable()){var b=Blockly.utils.xml.createElement("field");b.setAttribute("name",a.name);return a.toXml(b)}return null};
|
|
Blockly.Xml.allFieldsToDom_=function(a,b){for(var c=0,d;d=a.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)(f=Blockly.Xml.fieldToDom_(f))&&b.appendChild(f)};
|
|
Blockly.Xml.blockToDom=function(a,b){var c=Blockly.utils.xml.createElement(a.isShadow()?"shadow":"block");c.setAttribute("type",a.type);b||(c.id=a.id);if(a.mutationToDom){var d=a.mutationToDom();d&&(d.hasChildNodes()||d.hasAttributes())&&c.appendChild(d)}Blockly.Xml.allFieldsToDom_(a,c);a.isBreakpointSet()&&(d=goog.dom.createDom("breakpoint",null,""),c.appendChild(d));var e=a.getCommentText();e&&(d=Blockly.utils.xml.createElement("comment"),d.appendChild(Blockly.utils.xml.createTextNode(e)),"object"==
|
|
typeof a.comment&&(d.setAttribute("id",a.comment.id),d.setAttribute("pinned",a.comment.isVisible()),e=a.comment.getBubbleSize(),d.setAttribute("h",e.height),d.setAttribute("w",e.width)),c.appendChild(d));a.data&&(d=Blockly.utils.xml.createElement("data"),d.appendChild(Blockly.utils.xml.createTextNode(a.data)),c.appendChild(d));e=0;for(var f;f=a.inputList[e];e++){var g,h=!0;if(f.type!=Blockly.DUMMY_INPUT){var k=f.connection.targetBlock();f.type==Blockly.INPUT_VALUE?g=Blockly.utils.xml.createElement("value"):
|
|
f.type==Blockly.NEXT_STATEMENT&&(g=Blockly.utils.xml.createElement("statement"));d=f.connection.getShadowDom();!d||k&&k.isShadow()||g.appendChild(Blockly.Xml.cloneShadow_(d,b));k&&(g.appendChild(Blockly.Xml.blockToDom(k,b)),h=!1);g.setAttribute("name",f.name);h||c.appendChild(g)}}void 0!=a.inputsInline&&a.inputsInline!=a.inputsInlineDefault&&c.setAttribute("inline",a.inputsInline);a.isCollapsed()&&c.setAttribute("collapsed",!0);a.isEnabled()||c.setAttribute("disabled",!0);a.isDeletable()||a.isShadow()||
|
|
c.setAttribute("deletable",!1);a.isMovablePersisted()||a.isShadow()||c.setAttribute("movable",!1);a.isEditablePersisted()||c.setAttribute("editable",!1);if(e=a.getNextBlock())g=Blockly.utils.xml.createElement("next"),g.appendChild(Blockly.Xml.blockToDom(e,b)),c.appendChild(g);d=a.nextConnection&&a.nextConnection.getShadowDom();!d||e&&e.isShadow()||g.appendChild(Blockly.Xml.cloneShadow_(d,b));return c};
|
|
Blockly.Xml.cloneShadow_=function(a,b){for(var c=a=a.cloneNode(!0),d;c;)if(b&&"shadow"==c.nodeName&&c.removeAttribute("id"),c.firstChild)c=c.firstChild;else{for(;c&&!c.nextSibling;)d=c,c=c.parentNode,d.nodeType==Blockly.utils.dom.Node.TEXT_NODE&&""==d.data.trim()&&c.firstChild!=d&&Blockly.utils.dom.removeNode(d);c&&(d=c,c=c.nextSibling,d.nodeType==Blockly.utils.dom.Node.TEXT_NODE&&""==d.data.trim()&&Blockly.utils.dom.removeNode(d))}return a};Blockly.Xml.domToText=function(a){return Blockly.utils.xml.domToText(a)};
|
|
Blockly.Xml.domToPrettyText=function(a){a=Blockly.Xml.domToText(a).split("<");for(var b="",c=1;c<a.length;c++){var d=a[c];"/"==d[0]&&(b=b.substring(2));a[c]=b+"<"+d;"/"!=d[0]&&"/>"!=d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")};
|
|
Blockly.Xml.textToDom=function(a){a=a.replace(/xmlns="(.*?)"/,'xmlns="'+Blockly.utils.xml.NAME_SPACE+'"');var b=Blockly.utils.xml.textToDomDocument(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement};Blockly.Xml.clearWorkspaceAndLoadFromXml=function(a,b){b.setResizesEnabled(!1);b.clear();var c=Blockly.Xml.domToWorkspace(a,b);b.setResizesEnabled(!0);return c};
|
|
Blockly.Xml.domToWorkspace=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var d;b.RTL&&(d=b.getWidth());c=[];Blockly.Field.startCache();var e=a.childNodes.length,f=Blockly.Events.getGroup();f||Blockly.Events.setGroup(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var g=!0;try{for(var h=0;h<e;h++){var k=a.childNodes[h],l=k.nodeName.toLowerCase();if("block"==l||"shadow"==l&&!Blockly.Events.recordUndo){var m=
|
|
Blockly.Xml.domToBlock(k,b);c.push(m.id);var n=k.hasAttribute("x")?parseInt(k.getAttribute("x"),10):10,p=k.hasAttribute("y")?parseInt(k.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?d-n:n,p);g=!1}else{if("shadow"==l)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==l)b.rendered?Blockly.WorkspaceCommentSvg.fromXml(k,b,d):Blockly.WorkspaceComment.fromXml(k,b);else if("variables"==l){if(g)Blockly.Xml.domToVariables(k,b);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");
|
|
g=!1}}}}finally{f||Blockly.Events.setGroup(!1),Blockly.Field.stopCache()}b.setResizesEnabled&&b.setResizesEnabled(!0);Blockly.Events.fire(new Blockly.Events.FinishedLoading(b));return c};
|
|
Blockly.Xml.appendDomToWorkspace=function(a,b){if(b.hasOwnProperty("scale")){var c=Blockly.BlockSvg.TAB_WIDTH;try{Blockly.BlockSvg.TAB_WIDTH=0;var d=b.getBlocksBoundingBox()}finally{Blockly.BlockSvg.TAB_WIDTH=c}}c=Blockly.Xml.domToWorkspace(a,b);if(d&&d.top!=d.bottom){var e=d.bottom;var f=d.left;var g=Infinity,h=Infinity;for(d=0;d<c.length;d++){var k=b.getBlockById(c[d]).getRelativeToSurfaceXY();k.y<h&&(h=k.y);k.x<g&&(g=k.x)}e=e-h+Blockly.BlockSvg.SEP_SPACE_Y;f-=g;var l;b.RTL&&(l=b.getWidth());for(d=
|
|
0;d<c.length;d++)b.getBlockById(c[d]).moveBy(b.RTL?l-f:f,e)}return c};
|
|
Blockly.Xml.domToBlock=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();c=b.getAllVariables();try{var d=Blockly.Xml.domToBlockHeadless_(a,b),e=d.getDescendants(!1);if(b.rendered){d.setConnectionsHidden(!0);for(var f=e.length-1;0<=f;f--)e[f].initSvg();for(f=e.length-1;0<=f;f--)e[f].render(!1);setTimeout(function(){d.workspace&&d.setConnectionsHidden(!1)},1);d.updateDisabled();b.resizeContents()}else for(f=
|
|
e.length-1;0<=f;f--)e[f].initModel()}finally{Blockly.Events.enable()}if(Blockly.Events.isEnabled()){e=Blockly.Variables.getAddedVariables(b,c);for(f=0;f<e.length;f++)Blockly.Events.fire(new Blockly.Events.VarCreate(e[f]));Blockly.Events.fire(new Blockly.Events.BlockCreate(d))}return d};
|
|
Blockly.Xml.domToVariables=function(a,b){for(var c=0,d;d=a.childNodes[c];c++)if(d.nodeType==Blockly.utils.dom.Node.ELEMENT_NODE){var e=d.getAttribute("type"),f=d.getAttribute("id");b.createVariable(d.textContent,e,f)}};
|
|
Blockly.Xml.domToBlockHeadless_=function(a,b){var c=null,d=a.getAttribute("type");if(!d)throw TypeError("Block type unspecified: "+a.outerHTML);var e=a.getAttribute("id");c=b.newBlock(d,e);var f=null;for(d=0;e=a.childNodes[d];d++)if(e.nodeType!=Blockly.utils.dom.Node.TEXT_NODE){for(var g=f=null,h=0,k;k=e.childNodes[h];h++)k.nodeType==Blockly.utils.dom.Node.ELEMENT_NODE&&("block"==k.nodeName.toLowerCase()?f=k:"shadow"==k.nodeName.toLowerCase()&&(g=k));!f&&g&&(f=g);h=e.getAttribute("name");switch(e.nodeName.toLowerCase()){case "mutation":c.domToMutation&&
|
|
(c.domToMutation(e),c.initSvg&&c.initSvg());break;case "comment":c.setCommentText(e.textContent);var l=e.getAttribute("pinned");l&&!c.isInFlyout&&setTimeout(function(){c.comment&&c.comment.setVisible&&c.comment.setVisible("true"==l)},1);f=parseInt(e.getAttribute("w"),10);e=parseInt(e.getAttribute("h"),10);!isNaN(f)&&!isNaN(e)&&c.comment&&c.comment.setVisible&&c.comment.setBubbleSize(f,e);break;case "data":c.data=e.textContent;break;case "title":case "field":Blockly.Xml.domToField_(c,h,e);break;case "value":case "statement":e=
|
|
c.getInput(h);if(!e)break;g&&e.connection.setShadowDom(g);if(f)if(f=Blockly.Xml.domToBlockHeadless_(f,b),f.outputConnection)e.connection.connect(f.outputConnection);else if(f.previousConnection)e.connection.connect(f.previousConnection);else throw TypeError("Child block does not have output or previous statement.");break;case "next":g&&c.nextConnection&&c.nextConnection.setShadowDom(g);if(f){if(!c.nextConnection)throw TypeError("Next statement does not exist.");if(c.nextConnection.isConnected())throw TypeError("Next statement is already connected.");
|
|
f=Blockly.Xml.domToBlockHeadless_(f,b);if(!f.previousConnection)throw TypeError("Next block does not have previous statement.");c.nextConnection.connect(f.previousConnection)}break;case "breakpoint":c.setBreakpoint(!0);break;default:console.warn("Ignoring unknown tag: "+e.nodeName)}}(d=a.getAttribute("inline"))&&c.setInputsInline("true"==d);(d=a.getAttribute("disabled"))&&c.setEnabled("true"!=d&&"disabled"!=d);(d=a.getAttribute("deletable"))&&c.setDeletable("true"==d);(d=a.getAttribute("movable"))&&
|
|
c.setMovable("true"==d);(d=a.getAttribute("editable"))&&c.setEditable("true"==d);(d=a.getAttribute("collapsed"))&&c.setCollapsed("true"==d);"shadow"==a.nodeName.toLowerCase()&&c.setShadow(!0);return c};Blockly.Xml.domToField_=function(a,b,c){var d=a.getField(b);d?d.fromXml(c):console.warn("Ignoring non-existent field "+b+" in block "+a.type)};Blockly.Xml.deleteNext=function(a){for(var b=0,c;c=a.childNodes[b];b++)if("next"==c.nodeName.toLowerCase()){a.removeChild(c);break}};
|
|
Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={});Blockly.utils.global.Blockly.Xml||(Blockly.utils.global.Blockly.Xml={});Blockly.utils.global.Blockly.Xml.domToText=Blockly.Xml.domToText;Blockly.utils.global.Blockly.Xml.domToWorkspace=Blockly.Xml.domToWorkspace;Blockly.utils.global.Blockly.Xml.textToDom=Blockly.Xml.textToDom;Blockly.utils.global.Blockly.Xml.workspaceToDom=Blockly.Xml.workspaceToDom;Blockly.Connection=function(a,b){this.sourceBlock_=a;this.type=b;a.workspace.connectionDBList&&(this.db_=a.workspace.connectionDBList[b],this.dbOpposite_=a.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[b]],this.hidden_=!this.db_)};Blockly.Connection.CAN_CONNECT=0;Blockly.Connection.REASON_SELF_CONNECTION=1;Blockly.Connection.REASON_WRONG_TYPE=2;Blockly.Connection.REASON_TARGET_NULL=3;Blockly.Connection.REASON_CHECKS_FAILED=4;Blockly.Connection.REASON_DIFFERENT_WORKSPACES=5;
|
|
Blockly.Connection.REASON_SHADOW_PARENT=6;Blockly.Connection.REASON_CUSTOM_PROCEDURE=7;Blockly.Connection.prototype.targetConnection=null;Blockly.Connection.prototype.check_=null;Blockly.Connection.prototype.shadowDom_=null;Blockly.Connection.prototype.x_=0;Blockly.Connection.prototype.y_=0;Blockly.Connection.prototype.inDB_=!1;Blockly.Connection.prototype.db_=null;Blockly.Connection.prototype.dbOpposite_=null;Blockly.Connection.prototype.hidden_=null;
|
|
Blockly.Connection.prototype.connect_=function(a){var b=this,c=b.getSourceBlock(),d=a.getSourceBlock(),e=!1;b==c.getFirstStatementConnection()&&(e=!0);if(a.isConnected()){if(e)var f=a.targetConnection;a.disconnect()}if(b.isConnected()){var g=b.targetBlock(),h=b.getShadowDom();b.setShadowDom(null);if(g.isShadow())h=Blockly.Xml.blockToDom(g),g.dispose(),g=null;else if(b.type==Blockly.NEXT_STATEMENT){if(!g.previousConnection)throw Error("Orphan block does not have a previous connection.");for(var k=
|
|
d;k.nextConnection;){var l=k.getNextBlock();if(l&&!l.isShadow())k=l;else{g.previousConnection.checkType_(k.nextConnection)&&(k.nextConnection.connect(g.previousConnection),g=null);break}}}if(g&&(b.disconnect(),Blockly.Events.recordUndo)){var m=Blockly.Events.getGroup();setTimeout(function(){g.workspace&&!g.getParent()&&(Blockly.Events.setGroup(m),g.outputConnection?g.outputConnection.bumpAwayFrom_(b):g.previousConnection&&g.previousConnection.bumpAwayFrom_(b),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}b.setShadowDom(h)}e&&
|
|
f&&f.connect(c.previousConnection);var n;Blockly.Events.isEnabled()&&(n=new Blockly.Events.BlockMove(d));Blockly.Connection.connectReciprocally_(b,a);d.setParent(c);n&&(n.recordNew(),Blockly.Events.fire(n))};Blockly.Connection.prototype.dispose=function(){if(this.isConnected())throw Error("Disconnect connection before disposing of it.");this.inDB_&&this.db_.removeConnection_(this)};Blockly.Connection.prototype.isConnectedToNonInsertionMarker=function(){return this.targetConnection&&!this.targetBlock().isInsertionMarker()};
|
|
Blockly.Connection.prototype.getSourceBlock=function(){return this.sourceBlock_};Blockly.Connection.prototype.isSuperior=function(){return this.type==Blockly.INPUT_VALUE||this.type==Blockly.NEXT_STATEMENT};Blockly.Connection.prototype.isConnected=function(){return!!this.targetConnection};
|
|
Blockly.Connection.prototype.canConnectWithReason_=function(a){if(!a)return Blockly.Connection.REASON_TARGET_NULL;if(this.isSuperior())var b=this.sourceBlock_,c=a.getSourceBlock();else c=this.sourceBlock_,b=a.getSourceBlock();return b&&b==c?Blockly.Connection.REASON_SELF_CONNECTION:a.type!=Blockly.OPPOSITE_TYPE[this.type]?Blockly.Connection.REASON_WRONG_TYPE:b&&c&&b.workspace!==c.workspace?Blockly.Connection.REASON_DIFFERENT_WORKSPACES:this.checkType_(a)?Blockly.Connection.CAN_CONNECT:Blockly.Connection.REASON_CHECKS_FAILED};
|
|
Blockly.Connection.prototype.checkConnection_=function(a){switch(this.canConnectWithReason_(a)){case Blockly.Connection.CAN_CONNECT:break;case Blockly.Connection.REASON_SELF_CONNECTION:throw Error("Attempted to connect a block to itself.");case Blockly.Connection.REASON_DIFFERENT_WORKSPACES:throw Error("Blocks not on same workspace.");case Blockly.Connection.REASON_WRONG_TYPE:throw Error("Attempt to connect incompatible types.");case Blockly.Connection.REASON_TARGET_NULL:throw Error("Target connection is null.");
|
|
case Blockly.Connection.REASON_CHECKS_FAILED:throw Error("Connection checks failed. "+(this+" expected "+this.check_+", found "+a.check_));case Blockly.Connection.REASON_SHADOW_PARENT:throw Error("Connecting non-shadow to shadow block.");case Blockly.Connection.REASON_CUSTOM_PROCEDURE:throw Error("Trying to replace a shadow on a custom procedure definition.");default:throw Error("Unknown connection failure: this should never happen!");}};
|
|
Blockly.Connection.prototype.canConnectToPrevious_=function(a){if(this.targetConnection||-1!=Blockly.draggingConnections_.indexOf(a))return!1;var b=this.sourceBlock_.getFirstStatementConnection(),c=this==b,d=this==this.sourceBlock_.nextConnection;if(null!=b&&!c&&!d)return!1;b=null!=this.sourceBlock_.previousConnection;if(c&&b||!a.targetConnection)return!0;a=a.targetBlock();return a.isInsertionMarker()?!a.getPreviousBlock():!1};
|
|
Blockly.Connection.prototype.isConnectionAllowed=function(a){if(a.sourceBlock_.isInsertionMarker()||this.canConnectWithReason_(a)!=Blockly.Connection.CAN_CONNECT)return!1;this.sourceBlock_.getFirstStatementConnection();switch(a.type){case Blockly.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(a);case Blockly.OUTPUT_VALUE:return!1;case Blockly.INPUT_VALUE:if(a.isConnected()&&!a.targetBlock().isMovable()&&!a.targetBlock().isShadow())return!1;if(a.targetConnection){var b=a.targetBlock();if(b.isShadow()&&
|
|
Blockly.Functions.isFunctionArgumentReporter(b))return!1}if(Blockly.Functions.isFunctionArgumentReporter(this.sourceBlock_)&&(b=a.getSourceBlock().getRootBlock(),!Blockly.pxtBlocklyUtils.hasMatchingArgumentReporter(b,this.sourceBlock_)))return!1;break;case Blockly.NEXT_STATEMENT:if(a.isConnected()&&!this.sourceBlock_.nextConnection&&!a.targetBlock().isShadow()&&a.targetBlock().nextConnection)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=Blockly.draggingConnections_.indexOf(a)?
|
|
!1:!0};Blockly.Connection.prototype.connect=function(a){if(this.targetConnection!=a){this.checkConnection_(a);var b=Blockly.Events.getGroup();b||Blockly.Events.setGroup(!0);this.isSuperior()?this.connect_(a):a.connect_(this);b||Blockly.Events.setGroup(!1)}};Blockly.Connection.connectReciprocally_=function(a,b){if(!a||!b)throw Error("Cannot connect null connections.");a.targetConnection=b;b.targetConnection=a};
|
|
Blockly.Connection.singleConnection_=function(a,b){for(var c=!1,d=0;d<a.inputList.length;d++){var e=a.inputList[d].connection;if(e&&e.type==Blockly.INPUT_VALUE&&b.outputConnection.checkType_(e)){if(c)return null;c=e}}return c};Blockly.Connection.lastConnectionInRow_=function(a,b){for(var c=a,d;d=Blockly.Connection.singleConnection_(c,b);)if(c=d.targetBlock(),!c||c.isShadow())return d;return null};
|
|
Blockly.Connection.prototype.disconnect=function(){var a=this.targetConnection;if(!a)throw Error("Source connection not connected.");if(a.targetConnection!=this)throw Error("Target connection not connected to source connection.");if(this.isSuperior()){var b=this.sourceBlock_;var c=a.getSourceBlock();a=this}else b=a.getSourceBlock(),c=this.sourceBlock_;var d=Blockly.Events.getGroup();d||Blockly.Events.setGroup(!0);this.disconnectInternal_(b,c);a.respawnShadow_();d||Blockly.Events.setGroup(!1)};
|
|
Blockly.Connection.prototype.disconnectInternal_=function(a,b){var c;Blockly.Events.isEnabled()&&(c=new Blockly.Events.BlockMove(b));this.targetConnection=this.targetConnection.targetConnection=null;b.setParent(null);c&&(c.recordNew(),Blockly.Events.fire(c))};
|
|
Blockly.Connection.prototype.respawnShadow_=function(){var a=this.getSourceBlock(),b=this.getShadowDom();if(a.workspace&&b&&Blockly.Events.recordUndo)if(a=Blockly.Xml.domToBlock(b,a.workspace),a.outputConnection)this.connect(a.outputConnection);else if(a.previousConnection)this.connect(a.previousConnection);else throw Error("Child block does not have output or previous statement.");};
|
|
Blockly.Connection.prototype.targetBlock=function(){return this.isConnected()?this.targetConnection.getSourceBlock():null};Blockly.Connection.prototype.checkType_=function(a){if(!this.check_||!a.check_)return!0;for(var b=0;b<this.check_.length;b++)if(-1!=a.check_.indexOf(this.check_[b]))return!0;return!1};Blockly.Connection.prototype.onCheckChanged_=function(){this.isConnected()&&!this.checkType_(this.targetConnection)&&(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()};
|
|
Blockly.Connection.prototype.setCheck=function(a){a?(Array.isArray(a)||(a=[a]),this.check_=a,this.onCheckChanged_()):this.check_=null;return this};Blockly.Connection.prototype.getCheck=function(){return this.check_};Blockly.Connection.prototype.getOutputShape=function(){if(!this.check_)return Blockly.OUTPUT_SHAPE_ROUND;if(-1!==this.check_.indexOf("Boolean"))return Blockly.OUTPUT_SHAPE_HEXAGONAL;if(-1!==this.check_.indexOf("Number"))return Blockly.OUTPUT_SHAPE_ROUND;this.check_.indexOf("String");return Blockly.OUTPUT_SHAPE_ROUND};
|
|
Blockly.Connection.prototype.setShadowDom=function(a){this.shadowDom_=a};Blockly.Connection.prototype.getShadowDom=function(){return this.shadowDom_};Blockly.Connection.prototype.neighbours_=function(a){return[]};
|
|
Blockly.Connection.prototype.toString=function(){var a=this.sourceBlock_;if(a)if(a.outputConnection==this)var b="Output Connection of ";else if(a.previousConnection==this)b="Previous Connection of ";else if(a.nextConnection==this)b="Next Connection of ";else{b=null;for(var c=0,d;d=a.inputList[c];c++)if(d.connection==this){b=d;break}if(b)b='Input "'+b.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}else return"Orphan Connection";
|
|
return b+a.toDevString()};Blockly.ConnectionDB=function(){this.connections_=[]};Blockly.ConnectionDB.prototype.addConnection=function(a){if(a.inDB_)throw Error("Connection already in database.");if(!a.getSourceBlock().isInFlyout){var b=this.findPositionForConnection_(a);this.connections_.splice(b,0,a);a.inDB_=!0}};
|
|
Blockly.ConnectionDB.prototype.findConnection=function(a){if(!this.connections_.length)return-1;var b=this.findPositionForConnection_(a);if(b>=this.connections_.length)return-1;for(var c=a.y_,d=b;0<=d&&this.connections_[d].y_==c;){if(this.connections_[d]==a)return d;d--}for(;b<this.connections_.length&&this.connections_[b].y_==c;){if(this.connections_[b]==a)return b;b++}return-1};
|
|
Blockly.ConnectionDB.prototype.findPositionForConnection_=function(a){if(!this.connections_.length)return 0;for(var b=0,c=this.connections_.length;b<c;){var d=Math.floor((b+c)/2);if(this.connections_[d].y_<a.y_)b=d+1;else if(this.connections_[d].y_>a.y_)c=d;else{b=d;break}}return b};
|
|
Blockly.ConnectionDB.prototype.removeConnection_=function(a){if(!a.inDB_)throw Error("Connection not in database.");var b=this.findConnection(a);if(-1==b)throw Error("Unable to find connection in connectionDB.");a.inDB_=!1;this.connections_.splice(b,1)};
|
|
Blockly.ConnectionDB.prototype.getNeighbours=function(a,b){function c(a){var c=e-d[a].x_,g=f-d[a].y_;Math.sqrt(c*c+g*g)<=b&&l.push(d[a]);return g<b}for(var d=this.connections_,e=a.x_,f=a.y_,g=0,h=d.length-2,k=h;g<k;)d[k].y_<f?g=k:h=k,k=Math.floor((g+h)/2);var l=[];h=g=k;if(d.length){for(;0<=g&&c(g);)g--;do h++;while(h<d.length&&c(h))}return l};Blockly.ConnectionDB.prototype.isInYRange_=function(a,b,c){return Math.abs(this.connections_[a].y_-b)<=c};
|
|
Blockly.ConnectionDB.prototype.searchForClosest=function(a,b,c){if(!this.connections_.length)return{connection:null,radius:b};var d=a.y_,e=a.x_;a.x_=e+c.x;a.y_=d+c.y;var f=this.findPositionForConnection_(a);c=null;for(var g=b,h,k=f-1;0<=k&&this.isInYRange_(k,a.y_,b);)h=this.connections_[k],a.isConnectionAllowed(h,g)&&(c=h,g=h.distanceFrom(a)),k--;for(;f<this.connections_.length&&this.isInYRange_(f,a.y_,b);)h=this.connections_[f],a.isConnectionAllowed(h,g)&&(c=h,g=h.distanceFrom(a)),f++;a.x_=e;a.y_=
|
|
d;return{connection:c,radius:g}};Blockly.ConnectionDB.init=function(){var a=[];a[Blockly.INPUT_VALUE]=new Blockly.ConnectionDB;a[Blockly.OUTPUT_VALUE]=new Blockly.ConnectionDB;a[Blockly.NEXT_STATEMENT]=new Blockly.ConnectionDB;a[Blockly.PREVIOUS_STATEMENT]=new Blockly.ConnectionDB;return a};Blockly.constants={};Blockly.LINE_MODE_MULTIPLIER=40;Blockly.PAGE_MODE_MULTIPLIER=125;Blockly.DRAG_RADIUS=3;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly.SNAP_RADIUS=48;Blockly.CONNECTING_SNAP_RADIUS=96;Blockly.CURRENT_CONNECTION_PREFERENCE=20;Blockly.BUMP_DELAY=0;Blockly.BUMP_RANDOMNESS=10;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.SOUND_LIMIT=100;Blockly.DRAG_STACK=!0;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};
|
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.DELETE_AREA_NONE=null;Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";
|
|
Blockly.CREATE_VARIABLE_ID="CREATE_VARIABLE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.FUNCTION_DEFINITION_BLOCK_TYPE="function_definition";Blockly.FUNCTION_DECLARATION_BLOCK_TYPE="function_declaration";Blockly.FUNCTION_CALL_BLOCK_TYPE="function_call";Blockly.DropDownDiv=function(){};Blockly.DropDownDiv.DIV_=null;Blockly.DropDownDiv.boundsElement_=null;Blockly.DropDownDiv.owner_=null;Blockly.DropDownDiv.positionToField_=null;Blockly.DropDownDiv.ARROW_SIZE=16;Blockly.DropDownDiv.BORDER_SIZE=1;Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING=12;Blockly.DropDownDiv.PADDING_Y=20;Blockly.DropDownDiv.ANIMATION_TIME=.25;Blockly.DropDownDiv.animateOutTimer_=null;Blockly.DropDownDiv.onHide_=0;
|
|
Blockly.DropDownDiv.createDom=function(){if(!Blockly.DropDownDiv.DIV_){var a=document.createElement("div");a.className="blocklyDropDownDiv";document.body.appendChild(a);Blockly.DropDownDiv.DIV_=a;var b=document.createElement("div");b.className="blocklyDropDownContent";a.appendChild(b);Blockly.DropDownDiv.content_=b;b=document.createElement("div");b.className="blocklyDropDownArrow";a.appendChild(b);Blockly.DropDownDiv.arrow_=b;Blockly.DropDownDiv.DIV_.style.opacity=0;Blockly.DropDownDiv.DIV_.style.transition=
|
|
"transform "+Blockly.DropDownDiv.ANIMATION_TIME+"s, opacity "+Blockly.DropDownDiv.ANIMATION_TIME+"s"}};Blockly.DropDownDiv.setBoundsElement=function(a){Blockly.DropDownDiv.boundsElement_=a};Blockly.DropDownDiv.getContentDiv=function(){return Blockly.DropDownDiv.content_};Blockly.DropDownDiv.clearContent=function(){Blockly.DropDownDiv.content_.innerHTML="";Blockly.DropDownDiv.content_.style.width=""};
|
|
Blockly.DropDownDiv.setColour=function(a,b){Blockly.DropDownDiv.DIV_.style.backgroundColor=a;Blockly.DropDownDiv.DIV_.style.borderColor=b};Blockly.DropDownDiv.setCategory=function(a){Blockly.DropDownDiv.DIV_.setAttribute("data-category",a)};
|
|
Blockly.DropDownDiv.showPositionedByBlock=function(a,b,c,d){var e=b.workspace.scale,f=b.width,g=b.height;f*=e;g*=e;e=b.getSvgRoot().getBoundingClientRect();f=e.left+f/2;g=e.top+g;e=e.top;d&&(e+=d);Blockly.DropDownDiv.setBoundsElement(b.workspace.getParentSvg().parentNode);return Blockly.DropDownDiv.show(a,f,g,f,e,c)};
|
|
Blockly.DropDownDiv.showPositionedByField=function(a,b,c){var d=a.fieldGroup_.getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;c&&(d+=c);Blockly.DropDownDiv.positionToField_=!0;Blockly.DropDownDiv.setBoundsElement(a.getSourceBlock().workspace.getParentSvg().parentNode);return Blockly.DropDownDiv.show(a,e,f,e,d,b)};
|
|
Blockly.DropDownDiv.show=function(a,b,c,d,e,f){Blockly.DropDownDiv.owner_=a;Blockly.DropDownDiv.onHide_=f;a=Blockly.DropDownDiv.getPositionMetrics(b,c,d,e);Blockly.DropDownDiv.arrow_.style.transform="translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)";Blockly.DropDownDiv.arrow_.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom");Blockly.DropDownDiv.arrow_.style.display=a.arrowVisible?"":"none";Blockly.DropDownDiv.positionInternal_(a.initialX,a.initialY,
|
|
a.finalX,a.finalY);return a.arrowAtTop};Blockly.DropDownDiv.getBoundsInfo_=function(){var a=Blockly.DropDownDiv.boundsElement_.getBoundingClientRect(),b=goog.style.getSize(Blockly.DropDownDiv.boundsElement_);return{left:a.left,right:a.left+b.width,top:a.top,bottom:a.top+b.height,width:b.width,height:b.height}};
|
|
Blockly.DropDownDiv.getPositionMetrics=function(a,b,c,d){var e=Blockly.DropDownDiv.getBoundsInfo_(),f=goog.style.getSize(Blockly.DropDownDiv.DIV_);if(b+f.height>e.bottom)if(d-f.height<e.top){c=0;var g=!1;var h=!0}else a=c,c=d-f.height-Blockly.DropDownDiv.PADDING_Y,g=!0;else c=b+Blockly.DropDownDiv.PADDING_Y,g=!1;var k=a;a-=f.width/2;a=Blockly.utils.math.clamp(e.left,a,e.right-f.width);k-=Blockly.DropDownDiv.ARROW_SIZE/2;k=Blockly.utils.math.clamp(e.left,k,e.right);e=Blockly.utils.math.clamp(Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING,
|
|
k-a,f.width-Blockly.DropDownDiv.ARROW_HORIZONTAL_PADDING-Blockly.DropDownDiv.ARROW_SIZE);k=g?f.height-Blockly.DropDownDiv.BORDER_SIZE:0;k-=Blockly.DropDownDiv.ARROW_SIZE/2+Blockly.DropDownDiv.BORDER_SIZE;return{initialX:a,initialY:g?d-f.height:b,finalX:a,finalY:c,arrowX:e,arrowY:k,arrowAtTop:!g,arrowVisible:!h}};Blockly.DropDownDiv.isVisible=function(){return!!Blockly.DropDownDiv.owner_};
|
|
Blockly.DropDownDiv.hideIfOwner=function(a){return Blockly.DropDownDiv.owner_===a?(Blockly.DropDownDiv.hide(),!0):!1};Blockly.DropDownDiv.hide=function(){var a=Blockly.DropDownDiv.DIV_;a.style.transform="translate(0px, 0px)";a.style.opacity=0;Blockly.DropDownDiv.animateOutTimer_=setTimeout(function(){Blockly.DropDownDiv.hideWithoutAnimation()},1E3*Blockly.DropDownDiv.ANIMATION_TIME);Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null)};
|
|
Blockly.DropDownDiv.hideWithoutAnimation=function(){if(Blockly.DropDownDiv.isVisible()){Blockly.DropDownDiv.animateOutTimer_&&clearTimeout(Blockly.DropDownDiv.animateOutTimer_);var a=Blockly.DropDownDiv.DIV_;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";Blockly.DropDownDiv.clearContent();Blockly.DropDownDiv.owner_=null;Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null)}};
|
|
Blockly.DropDownDiv.positionInternal_=function(a,b,c,d){a=Math.floor(a);b=Math.floor(b);c=Math.floor(c);d=Math.floor(d);var e=Blockly.DropDownDiv.DIV_;e.style.left=a+"px";e.style.top=b+"px";e.style.display="block";e.style.opacity=1;e.style.transform="translate("+(c-a)+"px,"+(d-b)+"px)"};
|
|
Blockly.DropDownDiv.repositionForWindowResize=function(){if(Blockly.DropDownDiv.owner_){var a=Blockly.DropDownDiv.owner_.getSourceBlock(),b=a.workspace.scale,c=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.owner_.size_.width:a.width,d=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.owner_.size_.height:a.height;c*=b;d*=b;a=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.owner_.fieldGroup_.getBoundingClientRect():a.getSvgRoot().getBoundingClientRect();c=a.left+c/2;d=Blockly.DropDownDiv.getPositionMetrics(c,
|
|
a.top+d,c,a.top);Blockly.DropDownDiv.positionInternal_(d.initialX,d.initialY,d.finalX,d.finalY)}else Blockly.DropDownDiv.hide()};Blockly.blockAnimations={};Blockly.blockAnimations.disconnectPid_=0;Blockly.blockAnimations.disconnectGroup_=null;Blockly.blockAnimations.disposeUiEffect=function(a){var b=a.workspace,c=a.getSvgRoot();b.getAudioManager().play("delete");a=b.getSvgXY(c);c=c.cloneNode(!0);c.translateX_=a.x;c.translateY_=a.y;c.setAttribute("transform","translate("+a.x+","+a.y+")");b.getParentSvg().appendChild(c);c.bBox_=c.getBBox();Blockly.blockAnimations.disposeUiStep_(c,b.RTL,new Date,b.scale)};
|
|
Blockly.blockAnimations.disposeUiStep_=function(a,b,c,d){var e=(new Date-c)/150;1<e?Blockly.utils.dom.removeNode(a):(a.setAttribute("transform","translate("+(a.translateX_+(b?-1:1)*a.bBox_.width*d/2*e)+","+(a.translateY_+a.bBox_.height*d*e)+") scale("+(1-e)*d+")"),setTimeout(Blockly.blockAnimations.disposeUiStep_,10,a,b,c,d))};
|
|
Blockly.blockAnimations.connectionUiEffect=function(a){var b=a.workspace,c=b.scale;b.getAudioManager().play("click");if(!(1>c)){var d=b.getSvgXY(a.getSvgRoot());a.outputConnection?(d.x+=(a.RTL?3:-3)*c,d.y+=13*c):a.previousConnection&&(d.x+=(a.RTL?-23:23)*c,d.y+=3*c);a=Blockly.utils.dom.createSvgElement("circle",{cx:d.x,cy:d.y,r:0,fill:"none",stroke:"#888","stroke-width":10},b.getParentSvg());Blockly.blockAnimations.connectionUiStep_(a,new Date,c)}};
|
|
Blockly.blockAnimations.connectionUiStep_=function(a,b,c){var d=(new Date-b)/150;1<d?Blockly.utils.dom.removeNode(a):(a.setAttribute("r",25*d*c),a.style.opacity=1-d,Blockly.blockAnimations.disconnectPid_=setTimeout(Blockly.blockAnimations.connectionUiStep_,10,a,b,c))};
|
|
Blockly.blockAnimations.disconnectUiEffect=function(a){a.workspace.getAudioManager().play("disconnect");if(!(1>a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);Blockly.blockAnimations.disconnectUiStep_(a.getSvgRoot(),b,new Date)}};
|
|
Blockly.blockAnimations.disconnectUiStep_=function(a,b,c){var d=(new Date-c)/200;1<d?a.skew_="":(a.skew_="skewX("+Math.round(Math.sin(d*Math.PI*3)*(1-d)*b)+")",Blockly.blockAnimations.disconnectGroup_=a,Blockly.blockAnimations.disconnectPid_=setTimeout(Blockly.blockAnimations.disconnectUiStep_,10,a,b,c));a.setAttribute("transform",a.translate_+a.skew_)};
|
|
Blockly.blockAnimations.disconnectUiStop=function(){if(Blockly.blockAnimations.disconnectGroup_){clearTimeout(Blockly.blockAnimations.disconnectPid_);var a=Blockly.blockAnimations.disconnectGroup_;a.skew_="";a.setAttribute("transform",a.translate_);Blockly.blockAnimations.disconnectGroup_=null}};/*
|
|
|
|
PXT Blockly fork
|
|
|
|
The MIT License (MIT)
|
|
|
|
Copyright (c) Microsoft Corporation
|
|
|
|
All rights reserved.
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
*/
|
|
Blockly.Events.EndBlockDrag=function(a){a&&(Blockly.Events.EndBlockDrag.superClass_.constructor.call(this,a),this.recordUndo=!1,this.blockId=a.id,this.allNestedIds=a.getDescendants().map(function(a){return a.id}))};goog.inherits(Blockly.Events.EndBlockDrag,Blockly.Events.BlockBase);Blockly.Events.EndBlockDrag.prototype.type=Blockly.Events.END_DRAG;
|
|
Blockly.Events.EndBlockDrag.prototype.toJson=function(){var a=Blockly.Events.EndBlockDrag.superClass_.toJson.call(this);this.blockId&&(a.blockId=this.blockId);this.allNestedIds&&(a.allNestedIds=this.allNestedIds);return a};Blockly.Events.EndBlockDrag.prototype.fromJson=function(a){Blockly.Events.EndBlockDrag.superClass_.fromJson.call(this,a);this.blockId=a.blockId;this.allNestedIds=a.allNestedIds};Blockly.RenderedConnection=function(a,b){Blockly.RenderedConnection.superClass_.constructor.call(this,a,b);this.offsetInBlock_=new Blockly.utils.Coordinate(0,0)};goog.inherits(Blockly.RenderedConnection,Blockly.Connection);
|
|
Blockly.RenderedConnection.prototype.distanceFrom=function(a){if(a.renderedWidth_&&(!this.renderedWidth_||a.renderedWidth_>this.renderedWidth_))return a.distanceFrom(this);var b=this.x_-a.x_;100<this.renderedWidth_&&(b=Math.min(Math.abs(b),Math.abs(b+(this.renderedWidth_>>1)),Math.abs(b+this.renderedWidth_)));a=this.y_-a.y_;return Math.sqrt(b*b+a*a)};
|
|
Blockly.RenderedConnection.prototype.bumpAwayFrom_=function(a){if(!this.sourceBlock_.workspace.isDragging()){var b=this.sourceBlock_.getRootBlock();if(!b.isInFlyout){var c=!1;if(!b.isMovable()){b=a.getSourceBlock().getRootBlock();if(!b.isMovable())return;a=this;c=!0}var d=Blockly.selected==b;d||b.addSelect();var e=a.x_+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_,f=a.y_+Blockly.SNAP_RADIUS+Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.y_;c&&(f=-f);b.RTL&&
|
|
(e=a.x_-Blockly.SNAP_RADIUS-Math.floor(Math.random()*Blockly.BUMP_RANDOMNESS)-this.x_);b.moveBy(e,f);d||b.removeSelect()}}};Blockly.RenderedConnection.prototype.moveTo=function(a,b){this.inDB_&&this.db_.removeConnection_(this);this.x_=a;this.y_=b;this.hidden_||this.db_.addConnection(this)};Blockly.RenderedConnection.prototype.moveBy=function(a,b){this.moveTo(this.x_+a,this.y_+b)};Blockly.RenderedConnection.prototype.moveToOffset=function(a){this.moveTo(a.x+this.offsetInBlock_.x,a.y+this.offsetInBlock_.y)};
|
|
Blockly.RenderedConnection.prototype.setOffsetInBlock=function(a,b){this.offsetInBlock_.x=a;this.offsetInBlock_.y=b};Blockly.RenderedConnection.prototype.tighten_=function(){var a=this.targetConnection.x_-this.x_,b=this.targetConnection.y_-this.y_;if(0!=a||0!=b){var c=this.targetBlock(),d=c.getSvgRoot();if(!d)throw Error("block is not rendered.");c.rendered&&(d=Blockly.utils.getRelativeXY(d),c.getSvgRoot().setAttribute("transform","translate("+(d.x-a)+","+(d.y-b)+")"),c.moveConnections_(-a,-b))}};
|
|
Blockly.RenderedConnection.prototype.closest=function(a,b){return this.dbOpposite_.searchForClosest(this,a,b)};
|
|
Blockly.RenderedConnection.prototype.highlight=function(){var a="m -24,0 h 5 "+Blockly.BlockSvg.NOTCH_PATH_LEFT+" h 5";var b=this.sourceBlock_.getRelativeToSurfaceXY();Blockly.Connection.highlightedPath_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.x_-b.x)+","+(this.y_-b.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())};
|
|
Blockly.RenderedConnection.prototype.unhideAll=function(){this.setHidden(!1);var a=[];if(this.type!=Blockly.INPUT_VALUE&&this.type!=Blockly.NEXT_STATEMENT)return a;var b=this.targetBlock();if(b){if(b.isCollapsed()){var c=[];b.outputConnection&&c.push(b.outputConnection);b.nextConnection&&c.push(b.nextConnection);b.previousConnection&&c.push(b.previousConnection)}else c=b.getConnections_(!0);for(var d=0;d<c.length;d++)a.push.apply(a,c[d].unhideAll());a.length||(a[0]=b)}return a};
|
|
Blockly.RenderedConnection.prototype.unhighlight=function(){Blockly.utils.dom.removeNode(Blockly.Connection.highlightedPath_);delete Blockly.Connection.highlightedPath_};Blockly.RenderedConnection.prototype.setHidden=function(a){(this.hidden_=a)&&this.inDB_?this.db_.removeConnection_(this):a||this.inDB_||this.db_.addConnection(this)};
|
|
Blockly.RenderedConnection.prototype.hideAll=function(){this.setHidden(!0);if(this.targetConnection)for(var a=this.targetBlock().getDescendants(!1),b=0;b<a.length;b++){for(var c=a[b],d=c.getConnections_(!0),e=0;e<d.length;e++)d[e].setHidden(!0);c=c.getIcons();for(e=0;e<c.length;e++)c[e].setVisible(!1)}};Blockly.RenderedConnection.prototype.isConnectionAllowed=function(a,b){return this.distanceFrom(a)>b?!1:Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,a)};
|
|
Blockly.RenderedConnection.prototype.disconnectInternal_=function(a,b){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,a,b);a.rendered&&a.render();b.rendered&&(b.updateDisabled(),b.render())};
|
|
Blockly.RenderedConnection.prototype.respawnShadow_=function(){var a=this.getSourceBlock(),b=this.getShadowDom();if(a.workspace&&b&&Blockly.Events.recordUndo){Blockly.RenderedConnection.superClass_.respawnShadow_.call(this);b=this.targetBlock();if(!b)throw Error("Couldn't respawn the shadow block that should exist here.");b.initSvg();b.render(!1);a.rendered&&a.render()}};Blockly.RenderedConnection.prototype.neighbours_=function(a){return this.dbOpposite_.getNeighbours(this,a)};
|
|
Blockly.RenderedConnection.prototype.connect_=function(a){Blockly.RenderedConnection.superClass_.connect_.call(this,a);var b=this.getSourceBlock();a=a.getSourceBlock();b.rendered&&b.updateDisabled();a.rendered&&a.updateDisabled();b.rendered&&a.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?a.render():b.render())};
|
|
Blockly.RenderedConnection.prototype.onCheckChanged_=function(){this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())};Blockly.InsertionMarkerManager=function(a,b){this.topBlock_=Blockly.selected=a;this.workspace_=a.workspace;this.lastMarker_=this.lastOnStack_=null;this.firstMarker_=this.createMarkerBlock_(this.topBlock_);this.localConnection_=this.closestConnection_=null;this.wouldDeleteBlock_=!1;this.markerConnection_=null;this.highlightingBlock_=!1;this.highlightedBlock_=null;this.availableConnections_=this.initAvailableConnections_();if(a.outputConnection){var c=new Blockly.utils.Coordinate(a.outputConnection.x_,
|
|
a.outputConnection.y_);this.handleDXY=Blockly.utils.Coordinate.difference(b,c);this.workspace_.getBlockDragSurface().setOpacity(.7)}else this.handleDXY=new Blockly.utils.Coordinate(0,0)};
|
|
Blockly.InsertionMarkerManager.prototype.dispose=function(){this.workspace_.getBlockDragSurface().setOpacity(1);this.workspace_=this.topBlock_=null;this.availableConnections_.length=0;this.localConnection_=this.closestConnection_=null;Blockly.Events.disable();try{this.firstMarker_&&(this.firstMarker_.dispose(),this.firstMarker_=null),this.lastMarker_&&(this.lastMarker_.dispose(),this.lastMarker_=null)}finally{Blockly.Events.enable()}this.highlightedBlock_=null};
|
|
Blockly.InsertionMarkerManager.prototype.wouldDeleteBlock=function(){return this.wouldDeleteBlock_};Blockly.InsertionMarkerManager.prototype.wouldConnectBlock=function(){return!!this.closestConnection_};
|
|
Blockly.InsertionMarkerManager.prototype.applyConnections=function(){if(this.closestConnection_&&(Blockly.Events.disable(),this.hidePreview_(),Blockly.Events.enable(),this.localConnection_.connect(this.closestConnection_),this.topBlock_.rendered)){var a=this.localConnection_.isSuperior()?this.closestConnection_:this.localConnection_;Blockly.blockAnimations.connectionUiEffect(a.getSourceBlock());this.topBlock_.getRootBlock().bringToFront()}};
|
|
Blockly.InsertionMarkerManager.prototype.update=function(a,b){var c=this.getCandidate_(a);if((this.wouldDeleteBlock_=this.shouldDelete_(c,b))||this.shouldUpdatePreviews_(c,a))Blockly.Events.disable(),this.maybeHidePreview_(c),this.maybeShowPreview_(c),Blockly.Events.enable()};Blockly.InsertionMarkerManager.prototype.removeHighlighting_=function(){this.closestConnection_&&this.closestConnection_.unhighlight()};
|
|
Blockly.InsertionMarkerManager.prototype.addHighlighting_=function(){this.closestConnection_&&this.closestConnection_.highlight()};
|
|
Blockly.InsertionMarkerManager.prototype.createMarkerBlock_=function(a){var b=a.type;Blockly.Events.disable();try{var c=this.workspace_.newBlock(b);c.setInsertionMarker(!0,a.width);c.setCollapsed(a.isCollapsed());if(a.mutationToDom){var d=a.mutationToDom();d&&c.domToMutation(d)}for(b=0;b<a.inputList.length;b++){var e=a.inputList[b];for(d=0;d<e.fieldRow.length;d++){var f=e.fieldRow[d];c.setFieldValue(f.getValue(),f.name)}}c.initSvg();c.getSvgRoot().setAttribute("visibility","hidden")}finally{Blockly.Events.enable()}return c};
|
|
Blockly.InsertionMarkerManager.prototype.initAvailableConnections_=function(){var a=this.topBlock_.getConnections_(!1),b=this.topBlock_.lastConnectionInStack();b&&b!=this.topBlock_.nextConnection&&(a.push(b),this.lastOnStack_=b,this.lastMarker_=this.createMarkerBlock_(b.sourceBlock_));return a};
|
|
Blockly.InsertionMarkerManager.prototype.shouldUpdatePreviews_=function(a,b){var c=a.local,d=a.closest,e=a.radius;if(c&&d){if(this.localConnection_&&this.closestConnection_){if(this.closestConnection_==d&&this.localConnection_==c)return!1;c=this.localConnection_.x_+b.x-this.closestConnection_.x_;var f=this.localConnection_.y_+b.y-this.closestConnection_.y_;c=Math.sqrt(c*c+f*f);return!(d&&e>c-Blockly.CURRENT_CONNECTION_PREFERENCE)}if(this.localConnection_||this.closestConnection_)console.error("Only one of localConnection_ and closestConnection_ was set.");
|
|
else return!0}else return!(!this.localConnection_||!this.closestConnection_);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0};
|
|
Blockly.InsertionMarkerManager.prototype.getCandidate_=function(a){for(var b=this.getStartRadius_(),c=null,d=null,e=0;e<this.availableConnections_.length;e++){var f=this.availableConnections_[e],g=a;this.topBlock_.outputConnection===f&&(g=Blockly.utils.Coordinate.sum(a,this.handleDXY));g=f.closest(b,g);g.connection&&(c=g.connection,d=f,b=g.radius)}return{closest:c,local:d,radius:b}};
|
|
Blockly.InsertionMarkerManager.prototype.getStartRadius_=function(){return this.closestConnection_&&this.localConnection_?Blockly.CONNECTING_SNAP_RADIUS:Blockly.SNAP_RADIUS};Blockly.InsertionMarkerManager.prototype.shouldReplace_=function(){var a=this.closestConnection_,b=this.localConnection_;return b.type==Blockly.OUTPUT_VALUE?!0:b==b.sourceBlock_.getFirstStatementConnection()?!1:!this.topBlock_.nextConnection&&b.type==Blockly.PREVIOUS_STATEMENT&&a.isConnected()?!0:!1};
|
|
Blockly.InsertionMarkerManager.prototype.shouldDelete_=function(a,b){var c=a&&!!a.closest&&b!=Blockly.DELETE_AREA_TOOLBOX;return!!b&&!this.topBlock_.getParent()&&this.topBlock_.isDeletable()&&!c};Blockly.InsertionMarkerManager.prototype.maybeShowPreview_=function(a){if(!this.wouldDeleteBlock_){var b=a.closest;a=a.local;b&&(b==this.closestConnection_||b.sourceBlock_.isInsertionMarker()?console.log("trying to connect to an insertion marker"):(this.closestConnection_=b,this.localConnection_=a,this.showPreview_()))}};
|
|
Blockly.InsertionMarkerManager.prototype.showPreview_=function(){this.shouldReplace_()?this.highlightBlock_():this.connectMarker_()};Blockly.InsertionMarkerManager.prototype.maybeHidePreview_=function(a){if(a.closest){var b=this.closestConnection_!=a.closest;a=this.localConnection_!=a.local;this.closestConnection_&&this.localConnection_&&(b||a||this.wouldDeleteBlock_)&&this.hidePreview_()}else this.hidePreview_();this.localConnection_=this.closestConnection_=this.markerConnection_=null};
|
|
Blockly.InsertionMarkerManager.prototype.hidePreview_=function(){this.closestConnection_&&this.closestConnection_.unhighlight();this.highlightingBlock_?this.unhighlightBlock_():this.markerConnection_&&this.disconnectMarker_()};
|
|
Blockly.InsertionMarkerManager.prototype.highlightBlock_=function(){var a=this.closestConnection_,b=this.localConnection_;a.targetBlock()?(this.highlightedBlock_=a.targetBlock(),a.targetBlock().highlightForReplacement(!0)):b.type==Blockly.OUTPUT_VALUE&&(this.highlightedBlock_=a.sourceBlock_,a.sourceBlock_.highlightShapeForInput(a,!0));this.highlightingBlock_=!0};
|
|
Blockly.InsertionMarkerManager.prototype.unhighlightBlock_=function(){var a=this.closestConnection_;a.type!=Blockly.INPUT_VALUE||a.isConnected()?this.highlightedBlock_.highlightForReplacement(!1):this.highlightedBlock_.highlightShapeForInput(a,!1);this.highlightedBlock_=null;this.highlightingBlock_=!1};
|
|
Blockly.InsertionMarkerManager.prototype.disconnectMarker_=function(){if(this.markerConnection_){var a=this.markerConnection_,b=a.sourceBlock_,c=b.nextConnection,d=b.previousConnection,e=b.outputConnection;e=a.type==Blockly.INPUT_VALUE&&!(e&&e.targetConnection);!(a!=c||d&&d.targetConnection)||e?a.targetBlock().unplug(!1):a.type==Blockly.NEXT_STATEMENT&&a!=c?(c=a.targetConnection,c.sourceBlock_.unplug(!1),d=d?d.targetConnection:null,b.unplug(!0),d&&d.connect(c)):b.unplug(!0);if(a.targetConnection)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");
|
|
this.markerConnection_=null;b.getSvgRoot().setAttribute("visibility","hidden");this.removeHighlighting_()}else console.log("No insertion marker connection to disconnect")};
|
|
Blockly.InsertionMarkerManager.prototype.connectMarker_=function(){var a=this.localConnection_,b=this.closestConnection_,c=this.lastOnStack_&&a==this.lastOnStack_?this.lastMarker_:this.firstMarker_;a=c.getMatchingConnection(a.sourceBlock_,a);if(a==this.markerConnection_)throw Error("Made it to connectMarker_ even though the marker isn't changing");c.render();c.rendered=!0;c.getSvgRoot().setAttribute("visibility","visible");c.positionNewBlock(c,a,b);a.connect(b);this.markerConnection_=a;this.addHighlighting_()};
|
|
Blockly.InsertionMarkerManager.prototype.getInsertionMarkers=function(){var a=[];this.firstMarker_&&a.push(this.firstMarker_);this.lastMarker_&&a.push(this.lastMarker_);return a};Blockly.BlockDragger=function(a,b,c){this.draggingBlock_=a;this.workspace_=b;this.draggedConnectionManager_=new Blockly.InsertionMarkerManager(this.draggingBlock_,this.pixelsToWorkspaceUnits_(Blockly.utils.Coordinate.difference(c,this.workspaceOriginInPixels_())));this.deleteArea_=null;this.wouldDeleteBlock_=!1;this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY();this.dragIconData_=Blockly.BlockDragger.initIconData_(a)};
|
|
Blockly.BlockDragger.prototype.dispose=function(){this.startWorkspace_=this.workspace_=this.draggingBlock_=null;this.dragIconData_.length=0;this.draggedConnectionManager_&&(this.draggedConnectionManager_.dispose(),this.draggedConnectionManager_=null)};Blockly.BlockDragger.initIconData_=function(a){var b=[];a=a.getDescendants(!1);for(var c=0,d;d=a[c];c++){d=d.getIcons();for(var e=0;e<d.length;e++){var f={location:d[e].getIconLocation(),icon:d[e]};f.location&&b.push(f)}}return b};
|
|
Blockly.BlockDragger.prototype.startBlockDrag=function(a,b){Blockly.Events.getGroup()||Blockly.Events.setGroup(!0);this.workspace_.isMutator&&this.draggingBlock_.bringToFront();Blockly.Field.startCache();this.workspace_.setResizesEnabled(!1);Blockly.blockAnimations.disconnectUiStop();if(this.draggingBlock_.getParent()||b&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock()){this.draggingBlock_.unplug(b);var c=this.pixelsToWorkspaceUnits_(a);c=Blockly.utils.Coordinate.sum(this.startXY_,
|
|
c);this.draggingBlock_.translate(c.x,c.y);Blockly.blockAnimations.disconnectUiEffect(this.draggingBlock_)}this.draggingBlock_.setDragging(!0);this.draggingBlock_.moveToDragSurface_();if(c=this.workspace_.getToolbox()){var d=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";c.addStyle(d)}};
|
|
Blockly.BlockDragger.prototype.dragBlock=function(a,b){var c=this.pixelsToWorkspaceUnits_(b),d=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBlock_.moveDuringDrag(d);this.dragIcons_(c);this.deleteArea_=this.workspace_.isDeleteArea(a);this.draggedConnectionManager_.update(c,this.deleteArea_);this.updateCursorDuringBlockDrag_()};
|
|
Blockly.BlockDragger.prototype.endBlockDrag=function(a,b){this.dragBlock(a,b);this.dragIconData_=[];Blockly.Field.stopCache();Blockly.blockAnimations.disconnectUiStop();var c=this.pixelsToWorkspaceUnits_(b),d=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBlock_.moveOffDragSurface_(d);this.maybeDeleteBlock_()||(this.draggingBlock_.moveConnections_(c.x,c.y),this.draggingBlock_.setDragging(!1),this.fireMoveEvent_(),this.fireEndDragEvent_(),this.draggedConnectionManager_.wouldConnectBlock()?
|
|
this.draggedConnectionManager_.applyConnections():this.draggingBlock_.render(),this.draggingBlock_.scheduleSnapAndBump());this.workspace_.setResizesEnabled(!0);if(c=this.workspace_.getToolbox())d=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab",c.removeStyle(d);Blockly.Events.setGroup(!1)};Blockly.BlockDragger.prototype.fireMoveEvent_=function(){var a=new Blockly.Events.BlockMove(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();Blockly.Events.fire(a)};
|
|
Blockly.BlockDragger.prototype.fireEndDragEvent_=function(){var a=new Blockly.Events.EndBlockDrag(this.draggingBlock_);Blockly.Events.fire(a)};Blockly.BlockDragger.prototype.maybeDeleteBlock_=function(){var a=this.workspace_.trashcan;this.wouldDeleteBlock_?(a&&setTimeout(a.close.bind(a),100),this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0)):a&&a.close();return this.wouldDeleteBlock_};
|
|
Blockly.BlockDragger.prototype.updateCursorDuringBlockDrag_=function(){this.wouldDeleteBlock_=this.draggedConnectionManager_.wouldDeleteBlock();var a=this.workspace_.trashcan;this.wouldDeleteBlock_?(this.draggingBlock_.setDeleteStyle(!0),this.deleteArea_==Blockly.DELETE_AREA_TRASH&&a&&a.setOpen_(!0)):(this.draggingBlock_.setDeleteStyle(!1),a&&a.setOpen_(!1))};
|
|
Blockly.BlockDragger.prototype.pixelsToWorkspaceUnits_=function(a){a=new Blockly.utils.Coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a};Blockly.BlockDragger.prototype.workspaceOriginInPixels_=function(){var a=goog.style.getPageOffset(this.workspace_.getInjectionDiv()),b=this.workspace_.getOriginOffsetInPixels();return Blockly.utils.Coordinate.sum(a,b)};
|
|
Blockly.BlockDragger.prototype.dragIcons_=function(a){for(var b=0;b<this.dragIconData_.length;b++){var c=this.dragIconData_[b];c.icon.setIconLocation(Blockly.utils.Coordinate.sum(c.location,a))}};Blockly.BlockDragger.prototype.getInsertionMarkers=function(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]};Blockly.utils.Rect=function(a,b,c,d){this.top=a;this.bottom=b;this.left=c;this.right=d};Blockly.utils.Rect.prototype.contains=function(a,b){return a>=this.left&&a<=this.right&&b>=this.top&&b<=this.bottom};Blockly.WorkspaceCommentSvg=function(a,b,c,d,e,f){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyComment"},null);this.svgGroup_.translate_="";this.svgRect_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyCommentRect",x:0,y:0,rx:Blockly.WorkspaceCommentSvg.BORDER_WIDTH,ry:Blockly.WorkspaceCommentSvg.BORDER_WIDTH});this.svgGroup_.appendChild(this.svgRect_);this.rendered_=!1;this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.blockDragSurface_;Blockly.WorkspaceCommentSvg.superClass_.constructor.call(this,
|
|
a,b,c,d,e,f);this.render()};goog.inherits(Blockly.WorkspaceCommentSvg,Blockly.WorkspaceComment);Blockly.WorkspaceCommentSvg.DEFAULT_SIZE=200;
|
|
Blockly.WorkspaceCommentSvg.prototype.dispose=function(){this.workspace&&(Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture()),Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.CommentDelete(this)),Blockly.utils.dom.removeNode(this.svgGroup_),this.svgRect_=this.svgGroup_=null,this.disposeInternal_(),Blockly.Events.disable(),Blockly.WorkspaceCommentSvg.superClass_.dispose.call(this),Blockly.Events.enable())};
|
|
Blockly.WorkspaceCommentSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");this.workspace.options.readOnly||this.eventsInit_||(Blockly.bindEventWithChecks_(this.svgRectTarget_,"mousedown",this,this.pathMouseDown_),Blockly.bindEventWithChecks_(this.svgHandleTarget_,"mousedown",this,this.pathMouseDown_));this.eventsInit_=!0;this.updateMovable();this.getSvgRoot().parentNode||this.workspace.getBubbleCanvas().appendChild(this.getSvgRoot())};
|
|
Blockly.WorkspaceCommentSvg.prototype.pathMouseDown_=function(a){var b=this.workspace.getGesture(a);b&&b.handleBubbleStart(a,this)};Blockly.WorkspaceCommentSvg.prototype.showContextMenu_=function(a){if(!this.workspace.options.readOnly){var b=[];this.isDeletable()&&this.isMovable()&&(b.push(Blockly.ContextMenu.commentDuplicateOption(this)),b.push(Blockly.ContextMenu.commentDeleteOption(this)));Blockly.ContextMenu.show(a,b,this.RTL)}};
|
|
Blockly.WorkspaceCommentSvg.prototype.select=function(){if(Blockly.selected!=this){var a=null;if(Blockly.selected){a=Blockly.selected.id;Blockly.Events.disable();try{Blockly.selected.unselect()}finally{Blockly.Events.enable()}}a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect()}};
|
|
Blockly.WorkspaceCommentSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect();this.blurFocus()}};Blockly.WorkspaceCommentSvg.prototype.addSelect=function(){Blockly.utils.dom.addClass(this.svgGroup_,"blocklySelected");this.setFocus()};
|
|
Blockly.WorkspaceCommentSvg.prototype.removeSelect=function(){Blockly.utils.dom.removeClass(this.svgGroup_,"blocklySelected");this.blurFocus()};Blockly.WorkspaceCommentSvg.prototype.addFocus=function(){Blockly.utils.dom.addClass(this.svgGroup_,"blocklyFocused")};Blockly.WorkspaceCommentSvg.prototype.removeFocus=function(){Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyFocused")};
|
|
Blockly.WorkspaceCommentSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.useDragSurface_?this.workspace.blockDragSurface_.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.utils.getRelativeXY(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.blockDragSurface_.getCurrentBlock()==d&&(e=this.workspace.blockDragSurface_.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getBubbleCanvas()&&d!=c)}return this.xy_=new Blockly.utils.Coordinate(a,
|
|
b)};Blockly.WorkspaceCommentSvg.prototype.moveBy=function(a,b){var c=new Blockly.Events.CommentMove(this),d=this.getRelativeToSurfaceXY();this.translate(d.x+a,d.y+b);this.xy_=new Blockly.utils.Coordinate(d.x+a,d.y+b);c.recordNew();Blockly.Events.fire(c);this.workspace.resizeContents()};Blockly.WorkspaceCommentSvg.prototype.translate=function(a,b){this.xy_=new Blockly.utils.Coordinate(a,b);this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
|
|
Blockly.WorkspaceCommentSvg.prototype.moveToDragSurface_=function(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.blockDragSurface_.translateSurface(a.x,a.y);this.workspace.blockDragSurface_.setBlocksAndShow(this.getSvgRoot())}};Blockly.WorkspaceCommentSvg.prototype.moveOffDragSurface_=function(a){this.useDragSurface_&&(this.translate(a.x,a.y),this.workspace.blockDragSurface_.clearAndHide(this.workspace.getCanvas()))};
|
|
Blockly.WorkspaceCommentSvg.prototype.moveDuringDrag=function(a,b){a?a.translateSurface(b.x,b.y):(this.svgGroup_.translate_="translate("+b.x+","+b.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))};Blockly.WorkspaceCommentSvg.prototype.moveTo=function(a,b){this.translate(a,b)};Blockly.WorkspaceCommentSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")};
|
|
Blockly.WorkspaceCommentSvg.prototype.getBubbleSize=function(){if(this.rendered_)return{width:parseInt(this.svgRect_.getAttribute("width")),height:parseInt(this.svgRect_.getAttribute("height"))};this.getHeightWidth()};Blockly.WorkspaceCommentSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(),b=this.getHeightWidth(),c=a.y,d=a.y+b.height;if(this.RTL){var e=a.x-b.width;a=a.x}else e=a.x,a=a.x+b.width;return new Blockly.utils.Rect(c,d,e,a)};
|
|
Blockly.WorkspaceCommentSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDraggable"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDraggable")};Blockly.WorkspaceCommentSvg.prototype.setMovable=function(a){Blockly.WorkspaceCommentSvg.superClass_.setMovable.call(this,a);this.updateMovable()};
|
|
Blockly.WorkspaceCommentSvg.prototype.setDragging=function(a){a?(a=this.getSvgRoot(),a.translate_="",a.skew_="",Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDragging")):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDragging")};Blockly.WorkspaceCommentSvg.prototype.getSvgRoot=function(){return this.svgGroup_};Blockly.WorkspaceCommentSvg.prototype.getContent=function(){return this.textarea_?this.textarea_.value:this.content_};
|
|
Blockly.WorkspaceCommentSvg.prototype.setContent=function(a){Blockly.WorkspaceCommentSvg.superClass_.setContent.call(this,a);this.textarea_&&(this.textarea_.value=a)};Blockly.WorkspaceCommentSvg.prototype.setDeleteStyle=function(a){a?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDraggingDelete"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDraggingDelete")};Blockly.WorkspaceCommentSvg.prototype.setAutoLayout=function(){};
|
|
Blockly.WorkspaceCommentSvg.fromXml=function(a,b,c){Blockly.Events.disable();try{var d=Blockly.WorkspaceComment.parseAttributes(a),e=new Blockly.WorkspaceCommentSvg(b,d.content,d.h,d.w,d.minimized,d.id);e.data=a.getAttribute("data");b.rendered&&(e.initSvg(),e.render(!1));if(!isNaN(d.x)&&!isNaN(d.y))if(b.RTL){var f=c||b.getWidth();e.moveBy(f-d.x,d.y)}else e.moveBy(d.x,d.y)}finally{Blockly.Events.enable()}Blockly.WorkspaceComment.fireCreateEvent(e);return e};
|
|
Blockly.WorkspaceCommentSvg.prototype.toXmlWithXY=function(a){var b;this.workspace.RTL&&(b=this.workspace.getWidth());a=this.toXml(a);var c=this.getRelativeToSurfaceXY();a.setAttribute("x",Math.round(this.workspace.RTL?b-c.x:c.x));a.setAttribute("y",Math.round(c.y));a.setAttribute("h",this.getHeight());a.setAttribute("w",this.getWidth());return a};Blockly.WorkspaceCommentSvg.prototype.getHeightWidth=function(){console.warn("method is overriden by workspace_comment_render_svg.js")};Blockly.BubbleDragger=function(a,b){this.draggingBubble_=a;this.workspace_=b;this.deleteArea_=null;this.wouldDeleteBubble_=!1;this.startXY_=this.draggingBubble_.getRelativeToSurfaceXY();this.dragSurface_=Blockly.utils.is3dSupported()&&b.getBlockDragSurface()?b.getBlockDragSurface():null};Blockly.BubbleDragger.prototype.dispose=function(){this.dragSurface_=this.workspace_=this.draggingBubble_=null};
|
|
Blockly.BubbleDragger.prototype.startBubbleDrag=function(){Blockly.Events.getGroup()||Blockly.Events.setGroup(!0);this.workspace_.setResizesEnabled(!1);this.draggingBubble_.setAutoLayout(!1);this.dragSurface_&&this.moveToDragSurface_();this.draggingBubble_.setDragging&&this.draggingBubble_.setDragging(!0);var a=this.workspace_.getToolbox();if(a){var b=this.draggingBubble_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";a.addStyle(b)}};
|
|
Blockly.BubbleDragger.prototype.dragBubble=function(a,b){var c=this.pixelsToWorkspaceUnits_(b);c=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBubble_.moveDuringDrag(this.dragSurface_,c);this.draggingBubble_.isDeletable()&&(this.deleteArea_=this.workspace_.isDeleteArea(a),this.updateCursorDuringBubbleDrag_())};
|
|
Blockly.BubbleDragger.prototype.maybeDeleteBubble_=function(){var a=this.workspace_.trashcan;this.wouldDeleteBubble_?(a&&setTimeout(a.close.bind(a),100),this.fireMoveEvent_(),this.draggingBubble_.dispose(!1,!0)):a&&a.close();return this.wouldDeleteBubble_};
|
|
Blockly.BubbleDragger.prototype.updateCursorDuringBubbleDrag_=function(){this.wouldDeleteBubble_=this.deleteArea_!=Blockly.DELETE_AREA_NONE;var a=this.workspace_.trashcan;this.wouldDeleteBubble_?(this.draggingBubble_.setDeleteStyle(!0),this.deleteArea_==Blockly.DELETE_AREA_TRASH&&a&&a.setOpen_(!0)):(this.draggingBubble_.setDeleteStyle(!1),a&&a.setOpen_(!1))};
|
|
Blockly.BubbleDragger.prototype.endBubbleDrag=function(a,b){this.dragBubble(a,b);var c=this.pixelsToWorkspaceUnits_(b);c=Blockly.utils.Coordinate.sum(this.startXY_,c);this.draggingBubble_.moveTo(c.x,c.y);this.maybeDeleteBubble_()||(this.dragSurface_&&this.dragSurface_.clearAndHide(this.workspace_.getBubbleCanvas()),this.draggingBubble_.setDragging&&this.draggingBubble_.setDragging(!1),this.fireMoveEvent_());this.workspace_.setResizesEnabled(!0);this.workspace_.toolbox_&&(c=this.draggingBubble_.isDeletable()?
|
|
"blocklyToolboxDelete":"blocklyToolboxGrab",this.workspace_.toolbox_.removeStyle(c));Blockly.Events.setGroup(!1)};Blockly.BubbleDragger.prototype.fireMoveEvent_=function(){if(this.draggingBubble_.isComment){var a=new Blockly.Events.CommentMove(this.draggingBubble_);a.setOldCoordinate(this.startXY_);a.recordNew();Blockly.Events.fire(a)}};
|
|
Blockly.BubbleDragger.prototype.pixelsToWorkspaceUnits_=function(a){a=new Blockly.utils.Coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a};Blockly.BubbleDragger.prototype.moveToDragSurface_=function(){this.draggingBubble_.moveTo(0,0);this.dragSurface_.translateSurface(this.startXY_.x,this.startXY_.y);this.dragSurface_.setBlocksAndShow(this.draggingBubble_.getSvgRoot())};Blockly.WorkspaceDragger=function(a){this.workspace_=a;this.startScrollXY_=new Blockly.utils.Coordinate(a.scrollX,a.scrollY)};Blockly.WorkspaceDragger.prototype.dispose=function(){this.workspace_=null};Blockly.WorkspaceDragger.prototype.startDrag=function(){Blockly.selected&&Blockly.selected.unselect();this.workspace_.setupDragSurface()};Blockly.WorkspaceDragger.prototype.endDrag=function(a){this.drag(a);this.workspace_.resetDragSurface()};
|
|
Blockly.WorkspaceDragger.prototype.drag=function(a){a=Blockly.utils.Coordinate.sum(this.startScrollXY_,a);this.workspace_.scroll(a.x,a.y)};Blockly.FlyoutDragger=function(a){Blockly.FlyoutDragger.superClass_.constructor.call(this,a.getWorkspace());this.scrollbar_=a.scrollbar_;this.horizontalLayout_=a.horizontalLayout_};goog.inherits(Blockly.FlyoutDragger,Blockly.WorkspaceDragger);Blockly.FlyoutDragger.prototype.updateScroll_=function(a,b){this.horizontalLayout_?this.scrollbar_.set(a):this.scrollbar_.set(b)};/*
|
|
|
|
PXT Blockly
|
|
|
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
https://github.com/Microsoft/pxt-blockly
|
|
|
|
See LICENSE file for details.
|
|
*/
|
|
Blockly.pxtBlocklyUtils={};Blockly.pxtBlocklyUtils._duplicateOnDragWhitelist=null;Blockly.pxtBlocklyUtils.measureText=function(a,b,c,d){var e=document.createElement("canvas").getContext("2d");e.font=c+" "+a+" "+b;return e.measureText(d).width};
|
|
Blockly.pxtBlocklyUtils.isShadowArgumentReporter=function(a){return a.isShadow()&&("variables_get_reporter"===a.type||"argument_reporter_boolean"===a.type||"argument_reporter_number"===a.type||"argument_reporter_string"===a.type||"argument_reporter_custom"===a.type||Blockly.pxtBlocklyUtils._duplicateOnDragWhitelist&&-1!==Blockly.pxtBlocklyUtils._duplicateOnDragWhitelist.indexOf(a.type))};
|
|
Blockly.pxtBlocklyUtils.whitelistDraggableBlockTypes=function(a){Blockly.pxtBlocklyUtils._duplicateOnDragWhitelist=a.slice()};Blockly.pxtBlocklyUtils.hasMatchingArgumentReporter=function(a,b){for(var c=b.getFieldValue("VALUE"),d=b.getTypeName(),e=0;e<a.inputList.length;++e){var f=a.inputList[e];if(f.type==Blockly.INPUT_VALUE){var g=f.connection.targetBlock();if(g&&g.type==b.type&&(f=g.getFieldValue("VALUE"),g=g.getTypeName(),f==c&&d==g))return!0}}return!1};Blockly.Tooltip={};Blockly.Tooltip.visible=!1;Blockly.Tooltip.blocked_=!1;Blockly.Tooltip.LIMIT=50;Blockly.Tooltip.mouseOutPid_=0;Blockly.Tooltip.showPid_=0;Blockly.Tooltip.lastX_=0;Blockly.Tooltip.lastY_=0;Blockly.Tooltip.element_=null;Blockly.Tooltip.poisonedElement_=null;Blockly.Tooltip.OFFSET_X=0;Blockly.Tooltip.OFFSET_Y=10;Blockly.Tooltip.RADIUS_OK=10;Blockly.Tooltip.HOVER_MS=750;Blockly.Tooltip.MARGINS=5;Blockly.Tooltip.DIV=null;
|
|
Blockly.Tooltip.createDom=function(){Blockly.Tooltip.DIV||(Blockly.Tooltip.DIV=document.createElement("div"),Blockly.Tooltip.DIV.className="blocklyTooltipDiv",document.body.appendChild(Blockly.Tooltip.DIV))};Blockly.Tooltip.bindMouseEvents=function(a){Blockly.bindEvent_(a,"mouseover",null,Blockly.Tooltip.onMouseOver_);Blockly.bindEvent_(a,"mouseout",null,Blockly.Tooltip.onMouseOut_);a.addEventListener("mousemove",Blockly.Tooltip.onMouseMove_,!1)};
|
|
Blockly.Tooltip.onMouseOver_=function(a){if(!Blockly.Tooltip.blocked_){for(a=a.currentTarget;"string"!=typeof a.tooltip&&"function"!=typeof a.tooltip;)a=a.tooltip;Blockly.Tooltip.element_!=a&&(Blockly.Tooltip.hide(),Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.element_=a);clearTimeout(Blockly.Tooltip.mouseOutPid_)}};
|
|
Blockly.Tooltip.onMouseOut_=function(a){Blockly.Tooltip.blocked_||(Blockly.Tooltip.mouseOutPid_=setTimeout(function(){Blockly.Tooltip.element_=null;Blockly.Tooltip.poisonedElement_=null;Blockly.Tooltip.hide()},1),clearTimeout(Blockly.Tooltip.showPid_))};
|
|
Blockly.Tooltip.onMouseMove_=function(a){if(Blockly.Tooltip.element_&&Blockly.Tooltip.element_.tooltip&&!Blockly.Tooltip.blocked_)if(Blockly.Tooltip.visible){var b=Blockly.Tooltip.lastX_-a.pageX;a=Blockly.Tooltip.lastY_-a.pageY;Math.sqrt(b*b+a*a)>Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()}else Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastX_=a.pageX,Blockly.Tooltip.lastY_=a.pageY,Blockly.Tooltip.showPid_=setTimeout(Blockly.Tooltip.show_,
|
|
Blockly.Tooltip.HOVER_MS))};Blockly.Tooltip.hide=function(){Blockly.Tooltip.visible&&(Blockly.Tooltip.visible=!1,Blockly.Tooltip.DIV&&(Blockly.Tooltip.DIV.style.display="none"));Blockly.Tooltip.showPid_&&clearTimeout(Blockly.Tooltip.showPid_)};Blockly.Tooltip.block=function(){Blockly.Tooltip.hide();Blockly.Tooltip.blocked_=!0};Blockly.Tooltip.unblock=function(){Blockly.Tooltip.blocked_=!1};
|
|
Blockly.Tooltip.show_=function(){if(!Blockly.Tooltip.blocked_&&(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.DIV)){Blockly.Tooltip.DIV.innerHTML="";for(var a=Blockly.Tooltip.element_.tooltip;"function"==typeof a;)a=a();a=Blockly.utils.string.wrap(a,Blockly.Tooltip.LIMIT);a=a.split("\n");for(var b=0;b<a.length;b++){var c=document.createElement("div");c.appendChild(document.createTextNode(a[b]));Blockly.Tooltip.DIV.appendChild(c)}a=Blockly.Tooltip.element_.RTL;b=document.documentElement.clientWidth;
|
|
c=document.documentElement.clientHeight;Blockly.Tooltip.DIV.style.direction=a?"rtl":"ltr";Blockly.Tooltip.DIV.style.display="block";Blockly.Tooltip.visible=!0;var d=Blockly.Tooltip.lastX_;d=a?d-(Blockly.Tooltip.OFFSET_X+Blockly.Tooltip.DIV.offsetWidth):d+Blockly.Tooltip.OFFSET_X;var e=Blockly.Tooltip.lastY_+Blockly.Tooltip.OFFSET_Y;e+Blockly.Tooltip.DIV.offsetHeight>c+window.scrollY&&(e-=Blockly.Tooltip.DIV.offsetHeight+2*Blockly.Tooltip.OFFSET_Y);a?d=Math.max(Blockly.Tooltip.MARGINS-window.scrollX,
|
|
d):d+Blockly.Tooltip.DIV.offsetWidth>b+window.scrollX-2*Blockly.Tooltip.MARGINS&&(d=b-Blockly.Tooltip.DIV.offsetWidth-2*Blockly.Tooltip.MARGINS);Blockly.Tooltip.DIV.style.top=e+"px";Blockly.Tooltip.DIV.style.left=d+"px"}};Blockly.Gesture=function(a,b){this.startWorkspace_=this.targetBlock_=this.startBlock_=this.startField_=this.startBubble_=this.currentDragDeltaXY_=this.mouseDownXY_=null;this.creatorWorkspace_=b;this.isDraggingBubble_=this.isDraggingBlock_=this.isDraggingWorkspace_=this.hasExceededDragRadius_=!1;this.mostRecentEvent_=a;this.flyout_=this.workspaceDragger_=this.blockDragger_=this.bubbleDragger_=this.onUpWrapper_=this.onMoveWrapper_=null;this.shouldDuplicateOnDrag_=this.isEnding_=this.hasStarted_=this.calledUpdateIsDragging_=
|
|
!1;this.healStack_=!Blockly.DRAG_STACK};
|
|
Blockly.Gesture.prototype.dispose=function(){Blockly.Touch.clearTouchIdentifier();Blockly.Tooltip.unblock();this.creatorWorkspace_.clearGesture();this.onMoveWrapper_&&Blockly.unbindEvent_(this.onMoveWrapper_);this.onUpWrapper_&&Blockly.unbindEvent_(this.onUpWrapper_);this.flyout_=this.startWorkspace_=this.targetBlock_=this.startBlock_=this.startField_=null;this.blockDragger_&&(this.blockDragger_.dispose(),this.blockDragger_=null);this.workspaceDragger_&&(this.workspaceDragger_.dispose(),this.workspaceDragger_=
|
|
null);this.bubbleDragger_&&(this.bubbleDragger_.dispose(),this.bubbleDragger_=null)};Blockly.Gesture.prototype.updateFromEvent_=function(a){var b=new Blockly.utils.Coordinate(a.clientX,a.clientY);this.updateDragDelta_(b)&&(this.updateIsDragging_(),Blockly.longStop_());this.mostRecentEvent_=a};
|
|
Blockly.Gesture.prototype.updateDragDelta_=function(a){this.currentDragDeltaXY_=Blockly.utils.Coordinate.difference(a,this.mouseDownXY_);return this.hasExceededDragRadius_?!1:this.hasExceededDragRadius_=Blockly.utils.Coordinate.magnitude(this.currentDragDeltaXY_)>(this.flyout_?Blockly.FLYOUT_DRAG_RADIUS:Blockly.DRAG_RADIUS)};
|
|
Blockly.Gesture.prototype.updateIsDraggingFromFlyout_=function(){return this.flyout_.isBlockCreatable_(this.targetBlock_)?!this.flyout_.isScrollable()||this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_)?(this.startWorkspace_=this.flyout_.targetWorkspace_,this.startWorkspace_.updateScreenCalculationsIfScrolled(),Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0):!1:!1};
|
|
Blockly.Gesture.prototype.updateIsDraggingBubble_=function(){if(!this.startBubble_)return!1;this.isDraggingBubble_=!0;this.startDraggingBubble_();return!0};Blockly.Gesture.prototype.updateIsDraggingBlock_=function(){if(!this.targetBlock_)return!1;if(this.flyout_)this.isDraggingBlock_=this.updateIsDraggingFromFlyout_();else if(this.targetBlock_.isMovable()||this.shouldDuplicateOnDrag_)this.isDraggingBlock_=!0;return this.isDraggingBlock_?(this.startDraggingBlock_(),!0):!1};
|
|
Blockly.Gesture.prototype.updateIsDraggingWorkspace_=function(){if(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())this.workspaceDragger_=this.flyout_?new Blockly.FlyoutDragger(this.flyout_):new Blockly.WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag()};
|
|
Blockly.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0;this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()};
|
|
Blockly.Gesture.prototype.startDraggingBlock_=function(){this.shouldDuplicateOnDrag_&&this.duplicateOnDrag_();this.blockDragger_=new Blockly.BlockDragger(this.targetBlock_,this.startWorkspace_,this.mouseDownXY_);this.blockDragger_.startBlockDrag(this.currentDragDeltaXY_,this.healStack_);this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_)};
|
|
Blockly.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new Blockly.BubbleDragger(this.startBubble_,this.startWorkspace_);this.bubbleDragger_.startBubbleDrag();this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)};
|
|
Blockly.Gesture.prototype.doStart=function(a){Blockly.utils.isTargetInput(a)?this.cancel():(this.hasStarted_=!0,Blockly.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.startWorkspace_.markFocused(),this.mostRecentEvent_=a,Blockly.hideChaff(!!this.flyout_),Blockly.Tooltip.block(),this.targetBlock_&&this.targetBlock_.select(),Blockly.utils.isRightButton(a)?this.handleRightClick(a):("touchstart"!=
|
|
a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||Blockly.longStart_(a,this),this.mouseDownXY_=new Blockly.utils.Coordinate(a.clientX,a.clientY),this.healStack_=a.altKey||a.ctrlKey||a.metaKey,this.bindMouseEvents(a)))};
|
|
Blockly.Gesture.prototype.bindMouseEvents=function(a){this.onMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",null,this.handleMove.bind(this));this.onUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",null,this.handleUp.bind(this));a.preventDefault();a.stopPropagation()};
|
|
Blockly.Gesture.prototype.handleMove=function(a){this.updateFromEvent_(a);this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.dragBlock(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_);a.preventDefault();a.stopPropagation()};
|
|
Blockly.Gesture.prototype.handleUp=function(a){this.updateFromEvent_(a);Blockly.longStop_();this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(a,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endBlockDrag(a,this.currentDragDeltaXY_):this.isDraggingWorkspace_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_():this.isFieldClick_()?this.doFieldClick_(a):
|
|
this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(),a.preventDefault(),a.stopPropagation(),this.dispose())};
|
|
Blockly.Gesture.prototype.cancel=function(){this.isEnding_||(this.isEnding_=!0,Blockly.longStop_(),this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endBlockDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingWorkspace_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())};
|
|
Blockly.Gesture.prototype.handleRightClick=function(a){this.targetBlock_?(this.bringBlockToFront_(),Blockly.hideChaff(this.flyout_),this.targetBlock_.showContextMenu_(a)):this.startBubble_?this.startBubble_.showContextMenu_(a):this.startWorkspace_&&!this.flyout_&&(Blockly.hideChaff(),this.startWorkspace_.showContextMenu_(a));a.preventDefault();a.stopPropagation();this.dispose()};
|
|
Blockly.Gesture.prototype.handleWsStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(b);this.mostRecentEvent_=a;this.doStart(a)};Blockly.Gesture.prototype.handleFlyoutStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(b);this.handleWsStart(a,b.getWorkspace())};
|
|
Blockly.Gesture.prototype.handleBlockStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(b);this.mostRecentEvent_=a};Blockly.Gesture.prototype.handleBubbleStart=function(a,b){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(b);this.mostRecentEvent_=a};
|
|
Blockly.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus();this.startBubble_.select&&this.startBubble_.select()};Blockly.Gesture.prototype.doFieldClick_=function(a){this.startField_.showEditor_(a);this.bringBlockToFront_()};
|
|
Blockly.Gesture.prototype.doBlockClick_=function(){this.flyout_&&this.flyout_.autoClose?this.targetBlock_.isEnabled()&&(Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump()):Blockly.WidgetDiv.isVisible()||Blockly.DropDownDiv.isVisible()||Blockly.Events.fire(new Blockly.Events.Ui(this.startBlock_,"click",void 0,void 0));this.bringBlockToFront_();Blockly.Events.setGroup(!1)};
|
|
Blockly.Gesture.prototype.doWorkspaceClick_=function(){Blockly.selected&&Blockly.selected.unselect()};Blockly.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()};Blockly.Gesture.prototype.setStartField=function(a){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=a)};
|
|
Blockly.Gesture.prototype.setStartBubble=function(a){this.startBubble_||(this.startBubble_=a)};Blockly.Gesture.prototype.setStartBlock=function(a){this.startBlock_||this.startBubble_||(this.startBlock_=a,this.shouldDuplicateOnDrag_=!a.disabled&&!a.getInheritedDisabled()&&!a.isInFlyout&&Blockly.pxtBlocklyUtils.isShadowArgumentReporter(a),a.isInFlyout&&a!=a.getRootBlock()?this.setTargetBlock_(a.getRootBlock()):this.setTargetBlock_(a))};
|
|
Blockly.Gesture.prototype.setTargetBlock_=function(a){a.isShadow()&&!this.shouldDuplicateOnDrag_?this.setTargetBlock_(a.getParent()):this.targetBlock_=a};Blockly.Gesture.prototype.setStartWorkspace_=function(a){this.startWorkspace_||(this.startWorkspace_=a)};Blockly.Gesture.prototype.setStartFlyout_=function(a){this.flyout_||(this.flyout_=a)};Blockly.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_};
|
|
Blockly.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()};Blockly.Gesture.prototype.isFieldClick_=function(){return(this.startField_?this.startField_.isClickable():!1)&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)};Blockly.Gesture.prototype.isWorkspaceClick_=function(){return!this.startBlock_&&!this.startBubble_&&!this.startField_&&!this.hasExceededDragRadius_};
|
|
Blockly.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_};Blockly.Gesture.prototype.hasStarted=function(){return this.hasStarted_};Blockly.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]};Blockly.Gesture.inProgress=function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)if(c.currentGesture_)return!0;return!1};
|
|
Blockly.Gesture.prototype.forceStartBlockDrag=function(a,b){this.handleBlockStart(a,b);this.handleWsStart(a,b.workspace);this.hasExceededDragRadius_=this.isDraggingBlock_=!0;this.startDraggingBlock_()};
|
|
Blockly.Gesture.prototype.duplicateOnDrag_=function(){var a=null;Blockly.Events.disable();try{this.startWorkspace_.setResizesEnabled(!1);var b=Blockly.Xml.blockToDom(this.targetBlock_);if("variables_get_reporter"==b.getAttribute("type")){var c=b.firstChild;if(!c)throw"unable to create a variable_get block from a variables_get_reporter block, block has no VAR field";var d=document.createElement("block");d.setAttribute("type","variables_get");var e=document.createElement("field");e.setAttribute("name",
|
|
c.getAttribute("name"));e.setAttribute("id",c.getAttribute("id"));e.textContent=c.textContent;d.appendChild(e);b=d}this.targetBlock_.inputList[0]&&this.targetBlock_.inputList[0].fieldRow[0]&&this.targetBlock_.inputList[0].fieldRow[0].clearHover&&this.targetBlock_.inputList[0].fieldRow[0].clearHover();a=Blockly.Xml.domToBlock(b,this.startWorkspace_);var f=this.targetBlock_.getRelativeToSurfaceXY();a.moveBy(f.x,f.y);a.setShadow(!1)}finally{Blockly.Events.enable()}a?(Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockCreate(a)),
|
|
a.select(),this.targetBlock_=a):console.error("Something went wrong while duplicating a block.")};Blockly.TouchGesture=function(a,b){Blockly.TouchGesture.superClass_.constructor.call(this,a,b);this.isMultiTouch_=!1;this.cachedPoints_={};this.startDistance_=this.previousScale_=0;this.onStartWrapper_=null};goog.inherits(Blockly.TouchGesture,Blockly.Gesture);Blockly.TouchGesture.ZOOM_IN_MULTIPLIER=5;Blockly.TouchGesture.ZOOM_OUT_MULTIPLIER=6;Blockly.TouchGesture.prototype.doStart=function(a){Blockly.TouchGesture.superClass_.doStart.call(this,a);!this.isEnding_&&Blockly.Touch.isTouchEvent(a)&&this.handleTouchStart(a)};
|
|
Blockly.TouchGesture.prototype.bindMouseEvents=function(a){this.onStartWrapper_=Blockly.bindEventWithChecks_(document,"mousedown",null,this.handleStart.bind(this),!0);this.onMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",null,this.handleMove.bind(this),!0);this.onUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",null,this.handleUp.bind(this),!0);a.preventDefault();a.stopPropagation()};
|
|
Blockly.TouchGesture.prototype.handleStart=function(a){!this.isDragging()&&Blockly.Touch.isTouchEvent(a)&&(this.handleTouchStart(a),this.isMultiTouch()&&Blockly.longStop_())};Blockly.TouchGesture.prototype.handleMove=function(a){this.isDragging()?Blockly.Touch.shouldHandleEvent(a)&&Blockly.TouchGesture.superClass_.handleMove.call(this,a):this.isMultiTouch()?(Blockly.Touch.isTouchEvent(a)&&this.handleTouchMove(a),Blockly.longStop_()):Blockly.TouchGesture.superClass_.handleMove.call(this,a)};
|
|
Blockly.TouchGesture.prototype.handleUp=function(a){Blockly.Touch.isTouchEvent(a)&&!this.isDragging()&&this.handleTouchEnd(a);!this.isMultiTouch()||this.isDragging()?Blockly.Touch.shouldHandleEvent(a)&&Blockly.TouchGesture.superClass_.handleUp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.dispose())};Blockly.TouchGesture.prototype.isMultiTouch=function(){return this.isMultiTouch_};
|
|
Blockly.TouchGesture.prototype.dispose=function(){Blockly.TouchGesture.superClass_.dispose.call(this);this.onStartWrapper_&&Blockly.unbindEvent_(this.onStartWrapper_)};Blockly.TouchGesture.prototype.handleTouchStart=function(a){var b=Blockly.Touch.getTouchIdentifierFromEvent(a);this.cachedPoints_[b]=this.getTouchPoint(a);b=Object.keys(this.cachedPoints_);2==b.length&&(this.startDistance_=Blockly.utils.Coordinate.distance(this.cachedPoints_[b[0]],this.cachedPoints_[b[1]]),this.isMultiTouch_=!0,a.preventDefault())};
|
|
Blockly.TouchGesture.prototype.handleTouchMove=function(a){var b=Blockly.Touch.getTouchIdentifierFromEvent(a);this.cachedPoints_[b]=this.getTouchPoint(a);b=Object.keys(this.cachedPoints_);if(2==b.length){b=this.touchScale_=Blockly.utils.Coordinate.distance(this.cachedPoints_[b[0]],this.cachedPoints_[b[1]])/this.startDistance_;if(0<this.previousScale_&&Infinity>this.previousScale_){var c=b-this.previousScale_;c=0<c?c*Blockly.TouchGesture.ZOOM_IN_MULTIPLIER:c*Blockly.TouchGesture.ZOOM_OUT_MULTIPLIER;
|
|
var d=this.startWorkspace_,e=Blockly.utils.mouseToSvg(a,d.getParentSvg(),d.getInverseScreenCTM());d.zoom(e.x,e.y,c)}this.previousScale_=b;a.preventDefault()}};Blockly.TouchGesture.prototype.handleTouchEnd=function(a){a=Blockly.Touch.getTouchIdentifierFromEvent(a);this.cachedPoints_[a]&&delete this.cachedPoints_[a];2>Object.keys(this.cachedPoints_).length&&(this.cachedPoints_={},this.previousScale_=0)};
|
|
Blockly.TouchGesture.prototype.getTouchPoint=function(a){return this.startWorkspace_?new Blockly.utils.Coordinate(a.pageX?a.pageX:a.changedTouches[0].pageX,a.pageY?a.pageY:a.changedTouches[0].pageY):null};Blockly.Grid=function(a,b){this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap;this.imageOptions_=b.image};Blockly.Grid.prototype.scale_=1;Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null};Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};Blockly.Grid.prototype.getSpacing=function(){return this.spacing_};Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id};
|
|
Blockly.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",this.imageOptions_&&this.imageOptions_.width?this.imageOptions_.width:b);this.gridPattern_.setAttribute("height",this.imageOptions_&&this.imageOptions_.height?this.imageOptions_.height:b);b=Math.floor(this.spacing_/2)+.5;var c=b-this.length_/2,d=b+this.length_/2;b*=a;c*=a;d*=a;this.imageOptions_?this.gridPattern_.setAttribute("patternTransform","scale("+a+")"):(this.setLineAttributes_(this.line1_,
|
|
a,c,d,b,b),this.setLineAttributes_(this.line2_,a,b,b,c,d))};Blockly.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))};Blockly.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a);this.gridPattern_.setAttribute("y",b);(Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE)&&this.update(this.scale_)};
|
|
Blockly.Grid.createDom=function(a,b,c){a=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);0<b.length&&0<b.spacing?(Blockly.utils.dom.createSvgElement("line",{stroke:b.colour},a),1<b.length&&Blockly.utils.dom.createSvgElement("line",{stroke:b.colour},a)):b.image&&b.image.path?(b=b.image,c=JSON.parse(JSON.stringify(b)),delete c.path,Blockly.utils.dom.createSvgElement("image",c,a).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b.path),
|
|
this.imageOptions_=b):Blockly.utils.dom.createSvgElement("line",{},a);return a};Blockly.Options=function(a){var b=!!a.readOnly;if(b)var c=null,d=!1,e=!1,f=!1,g=!1,h=!1,k=!1,l=!1;else{c=Blockly.Options.parseToolboxTree(a.toolbox||null);d=void 0!=a.hasCategories?a.hasCategories:!(!c||!c.getElementsByTagName("category").length);e=a.trashcan;void 0===e&&(e=d);var m=a.maxTrashcanContents;e?void 0===m&&(m=32):m=0;f=a.collapse;void 0===f&&(f=d);g=a.comments;void 0===g&&(g=d);h=a.disable;void 0===h&&(h=d);k=a.sounds;void 0===k&&(k=!0)}var n=!!a.rtl,p=a.horizontalLayout;void 0===p&&(p=
|
|
!1);var q=a.toolboxPosition;q="end"===q?!1:!0;q=p?q?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:q==n?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT;var r=a.css;void 0===r&&(r=!0);var t="https://blockly-demo.appspot.com/static/media/";a.media?t=a.media:a.path&&(t=a.path+"media/");var w=void 0===a.oneBasedIndex?!0:!!a.oneBasedIndex,x=a.theme||Blockly.Themes.Classic,u=a.colours;if(u)for(var v in u)u.hasOwnProperty(v)&&Blockly.Colours.hasOwnProperty(v)&&(Blockly.Colours[v]=u[v]);this.RTL=n;this.oneBasedIndex=
|
|
w;this.collapse=f;this.comments=g;this.debugMode=l;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.maxInstances=a.maxInstances;this.newFunctions=1==a.newFunctions;this.pathToMedia=t;this.hasCategories=d;this.moveOptions=Blockly.Options.parseMoveOptions(a,d);this.hasScrollbars=this.moveOptions.scrollbars;this.hasTrashcan=e;this.maxTrashcanContents=m;this.hasSounds=k;this.hasCss=r;this.horizontalLayout=p;this.languageTree=c;this.gridOptions=Blockly.Options.parseGridOptions_(a);
|
|
this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.toolboxPosition=q;this.theme=x;a=a.toolboxOptions||{};this.toolboxOptions={};void 0==a.border&&(a.border=!0);void 0==a.colour&&(a.colour=!1);void 0==a.inverted&&(a.inverted=!1);void 0==a.invertedMultiplier&&(a.invertedMultiplier=.3);void 0==a.disabledOpacity&&(a.disabledOpacity=.4);this.toolboxOptions.border=a.border;this.toolboxOptions.colour=a.colour;this.toolboxOptions.inverted=a.inverted;this.toolboxOptions.invertedMultiplier=a.invertedMultiplier;
|
|
this.toolboxOptions.disabledOpacity=a.disabledOpacity};Blockly.Options.prototype.parentWorkspace=null;Blockly.Options.prototype.setMetrics=null;Blockly.Options.prototype.getMetrics=null;Blockly.Options.parseMoveOptions=function(a,b){var c=a.move||{},d={};d.scrollbars=void 0===c.scrollbars&&void 0===a.scrollbars?b:!!c.scrollbars||!!a.scrollbars;d.wheel=d.scrollbars&&void 0!==c.wheel?!!c.wheel:!1;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d};
|
|
Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:parseFloat(a.startScale);b.maxScale=void 0===a.maxScale?3:parseFloat(a.maxScale);b.minScale=void 0===a.minScale?.3:parseFloat(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:parseFloat(a.scaleSpeed);return b};
|
|
Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=parseFloat(a.spacing)||0;b.colour=a.colour||"#888";b.length=parseFloat(a.length)||1;b.snap=0<b.spacing&&!!a.snap;b.image=Blockly.Options.parseGridImageOptions_(a);return b};Blockly.Options.parseGridImageOptions_=function(a){a=a.image;if(!a||!a.path)return null;a.width=a.width||100;a.height=a.height||100;return a};
|
|
Blockly.Options.parseToolboxTree=function(a){if(a){if("string"!=typeof a&&(Blockly.utils.userAgent.IE&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=Blockly.Xml.textToDom(a),"xml"!=a.nodeName.toLowerCase()))throw TypeError("Toolbox should be an <xml> document.");}else a=null;return a};Blockly.ScrollbarPair=function(a){this.workspace_=a;this.hScroll=new Blockly.Scrollbar(a,!0,!0,"blocklyMainWorkspaceScrollbar");this.vScroll=new Blockly.Scrollbar(a,!1,!0,"blocklyMainWorkspaceScrollbar");this.corner_=Blockly.utils.dom.createSvgElement("rect",{height:Blockly.Scrollbar.scrollbarThickness,width:Blockly.Scrollbar.scrollbarThickness,"class":"blocklyScrollbarBackground"},null);Blockly.utils.dom.insertAfter(this.corner_,a.getBubbleCanvas())};
|
|
Blockly.ScrollbarPair.prototype.oldHostMetrics_=null;Blockly.ScrollbarPair.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.corner_);this.oldHostMetrics_=this.workspace_=this.corner_=null;this.hScroll.dispose();this.hScroll=null;this.vScroll.dispose();this.vScroll=null};
|
|
Blockly.ScrollbarPair.prototype.resize=function(){var a=this.workspace_.getMetrics();if(a){var b=!1,c=!1;this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==a.viewWidth&&this.oldHostMetrics_.viewHeight==a.viewHeight&&this.oldHostMetrics_.absoluteTop==a.absoluteTop&&this.oldHostMetrics_.absoluteLeft==a.absoluteLeft?(this.oldHostMetrics_&&this.oldHostMetrics_.contentWidth==a.contentWidth&&this.oldHostMetrics_.viewLeft==a.viewLeft&&this.oldHostMetrics_.contentLeft==a.contentLeft||(b=!0),this.oldHostMetrics_&&
|
|
this.oldHostMetrics_.contentHeight==a.contentHeight&&this.oldHostMetrics_.viewTop==a.viewTop&&this.oldHostMetrics_.contentTop==a.contentTop||(c=!0)):c=b=!0;b&&this.hScroll.resize(a);c&&this.vScroll.resize(a);this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==a.viewWidth&&this.oldHostMetrics_.absoluteLeft==a.absoluteLeft||this.corner_.setAttribute("x",this.vScroll.position_.x);this.oldHostMetrics_&&this.oldHostMetrics_.viewHeight==a.viewHeight&&this.oldHostMetrics_.absoluteTop==a.absoluteTop||this.corner_.setAttribute("y",
|
|
this.hScroll.position_.y);this.oldHostMetrics_=a}};Blockly.ScrollbarPair.prototype.set=function(a,b){var c={},d=a*this.hScroll.ratio_,e=b*this.vScroll.ratio_,f=this.vScroll.scrollViewSize_;c.x=this.getRatio_(d,this.hScroll.scrollViewSize_);c.y=this.getRatio_(e,f);this.workspace_.setMetrics(c);this.hScroll.setHandlePosition(d);this.vScroll.setHandlePosition(e)};Blockly.ScrollbarPair.prototype.getRatio_=function(a,b){var c=a/b;return isNaN(c)?0:c};
|
|
Blockly.Scrollbar=function(a,b,c,d){this.workspace_=a;this.pair_=c||!1;this.horizontal_=b;this.svgGroup_=this.oldHostMetrics_=null;this.createDom_(d);this.position_=new Blockly.utils.Coordinate(0,0);a=Blockly.Scrollbar.scrollbarThickness;b?(this.svgBackground_.setAttribute("height",a),this.outerSvg_.setAttribute("height",a),this.svgHandle_.setAttribute("height",a-5),this.svgHandle_.setAttribute("y",2.5),this.lengthAttribute_="width",this.positionAttribute_="x"):(this.svgBackground_.setAttribute("width",
|
|
a),this.outerSvg_.setAttribute("width",a),this.svgHandle_.setAttribute("width",a-5),this.svgHandle_.setAttribute("x",2.5),this.lengthAttribute_="height",this.positionAttribute_="y");this.onMouseDownBarWrapper_=Blockly.bindEventWithChecks_(this.svgBackground_,"mousedown",this,this.onMouseDownBar_);this.onMouseDownHandleWrapper_=Blockly.bindEventWithChecks_(this.svgHandle_,"mousedown",this,this.onMouseDownHandle_)};Blockly.Scrollbar.prototype.origin_=new Blockly.utils.Coordinate(0,0);
|
|
Blockly.Scrollbar.prototype.originHasChanged_=!0;Blockly.Scrollbar.prototype.startDragMouse_=0;Blockly.Scrollbar.prototype.scrollViewSize_=0;Blockly.Scrollbar.prototype.handleLength_=0;Blockly.Scrollbar.prototype.handlePosition_=0;Blockly.Scrollbar.prototype.isVisible_=!0;Blockly.Scrollbar.prototype.containerVisible_=!0;Blockly.Scrollbar.scrollbarThickness=15;Blockly.Touch.TOUCH_ENABLED&&(Blockly.Scrollbar.scrollbarThickness=25);
|
|
Blockly.Scrollbar.metricsAreEquivalent_=function(a,b){return a&&b&&a.viewWidth==b.viewWidth&&a.viewHeight==b.viewHeight&&a.viewLeft==b.viewLeft&&a.viewTop==b.viewTop&&a.absoluteTop==b.absoluteTop&&a.absoluteLeft==b.absoluteLeft&&a.contentWidth==b.contentWidth&&a.contentHeight==b.contentHeight&&a.contentLeft==b.contentLeft&&a.contentTop==b.contentTop?!0:!1};
|
|
Blockly.Scrollbar.prototype.dispose=function(){this.cleanUp_();Blockly.unbindEvent_(this.onMouseDownBarWrapper_);this.onMouseDownBarWrapper_=null;Blockly.unbindEvent_(this.onMouseDownHandleWrapper_);this.onMouseDownHandleWrapper_=null;Blockly.utils.dom.removeNode(this.outerSvg_);this.workspace_=this.svgHandle_=this.svgBackground_=this.svgGroup_=this.outerSvg_=null};Blockly.Scrollbar.prototype.setHandleLength_=function(a){this.handleLength_=a;this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)};
|
|
Blockly.Scrollbar.prototype.setHandlePosition=function(a){this.handlePosition_=a;this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)};Blockly.Scrollbar.prototype.setScrollViewSize_=function(a){this.scrollViewSize_=a;this.outerSvg_.setAttribute(this.lengthAttribute_,this.scrollViewSize_);this.svgBackground_.setAttribute(this.lengthAttribute_,this.scrollViewSize_)};Blockly.ScrollbarPair.prototype.setContainerVisible=function(a){this.hScroll.setContainerVisible(a);this.vScroll.setContainerVisible(a)};
|
|
Blockly.Scrollbar.prototype.setPosition_=function(a,b){this.position_.x=a;this.position_.y=b;Blockly.utils.dom.setCssTransform(this.outerSvg_,"translate("+(this.position_.x+this.origin_.x)+"px,"+(this.position_.y+this.origin_.y)+"px)")};
|
|
Blockly.Scrollbar.prototype.resize=function(a){if(!a&&(a=this.workspace_.getMetrics(),!a))return;if(this.originHasChanged_)this.originHasChanged_=!1;else if(Blockly.Scrollbar.metricsAreEquivalent_(a,this.oldHostMetrics_))return;this.oldHostMetrics_=a;this.horizontal_?this.resizeHorizontal_(a):this.resizeVertical_(a);this.onScroll_()};Blockly.Scrollbar.prototype.resizeHorizontal_=function(a){this.resizeViewHorizontal(a)};
|
|
Blockly.Scrollbar.prototype.resizeViewHorizontal=function(a){var b=a.viewWidth-1;this.pair_&&(b-=Blockly.Scrollbar.scrollbarThickness);this.setScrollViewSize_(Math.max(0,b));b=a.absoluteLeft+.5;this.pair_&&this.workspace_.RTL&&(b+=Blockly.Scrollbar.scrollbarThickness);this.setPosition_(b,a.absoluteTop+a.viewHeight-Blockly.Scrollbar.scrollbarThickness-.5);this.resizeContentHorizontal(a)};
|
|
Blockly.Scrollbar.prototype.resizeContentHorizontal=function(a){this.pair_||this.setVisible(this.scrollViewSize_<a.contentWidth);this.ratio_=this.scrollViewSize_/a.contentWidth;if(-Infinity==this.ratio_||Infinity==this.ratio_||isNaN(this.ratio_))this.ratio_=0;this.setHandleLength_(Math.max(0,a.viewWidth*this.ratio_));this.setHandlePosition(this.constrainHandle_((a.viewLeft-a.contentLeft)*this.ratio_))};Blockly.Scrollbar.prototype.resizeVertical_=function(a){this.resizeViewVertical(a)};
|
|
Blockly.Scrollbar.prototype.resizeViewVertical=function(a){var b=a.viewHeight-1;this.pair_&&(b-=Blockly.Scrollbar.scrollbarThickness);this.setScrollViewSize_(Math.max(0,b));b=a.absoluteLeft+.5;this.workspace_.RTL||(b+=a.viewWidth-Blockly.Scrollbar.scrollbarThickness-1);this.setPosition_(b,a.absoluteTop+.5);this.resizeContentVertical(a)};
|
|
Blockly.Scrollbar.prototype.resizeContentVertical=function(a){this.pair_||this.setVisible(this.scrollViewSize_<a.contentHeight);this.ratio_=this.scrollViewSize_/a.contentHeight;if(-Infinity==this.ratio_||Infinity==this.ratio_||isNaN(this.ratio_))this.ratio_=0;this.setHandleLength_(Math.max(0,a.viewHeight*this.ratio_));this.setHandlePosition(this.constrainHandle_((a.viewTop-a.contentTop)*this.ratio_))};
|
|
Blockly.Scrollbar.prototype.createDom_=function(a){var b="blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical");a&&(b+=" "+a);this.outerSvg_=Blockly.utils.dom.createSvgElement("svg",{"class":b},null);this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{},this.outerSvg_);this.svgBackground_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyScrollbarBackground"},this.svgGroup_);a=Math.floor((Blockly.Scrollbar.scrollbarThickness-5)/2);this.svgHandle_=Blockly.utils.dom.createSvgElement("rect",
|
|
{"class":"blocklyScrollbarHandle",rx:a,ry:a},this.svgGroup_);Blockly.utils.dom.insertAfter(this.outerSvg_,this.workspace_.getParentSvg())};Blockly.Scrollbar.prototype.isVisible=function(){return this.isVisible_};Blockly.Scrollbar.prototype.setContainerVisible=function(a){var b=a!=this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()};
|
|
Blockly.Scrollbar.prototype.setVisible=function(a){var b=a!=this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");this.isVisible_=a;b&&this.updateDisplay_()};Blockly.Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")};
|
|
Blockly.Scrollbar.prototype.onMouseDownBar_=function(a){this.workspace_.markFocused();Blockly.Touch.clearTouchIdentifier();this.cleanUp_();if(Blockly.utils.isRightButton(a))a.stopPropagation();else{var b=Blockly.utils.mouseToSvg(a,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM());b=this.horizontal_?b.x:b.y;var c=Blockly.utils.getInjectionDivXY_(this.svgHandle_);c=this.horizontal_?c.x:c.y;var d=this.handlePosition_,e=.95*this.handleLength_;b<=c?d-=e:b>=c+this.handleLength_&&(d+=
|
|
e);Blockly.WidgetDiv.hide(!0);Blockly.DropDownDiv.hideWithoutAnimation();this.setHandlePosition(this.constrainHandle_(d));this.onScroll_();a.stopPropagation();a.preventDefault()}};
|
|
Blockly.Scrollbar.prototype.onMouseDownHandle_=function(a){this.workspace_.markFocused();this.cleanUp_();Blockly.utils.isRightButton(a)?a.stopPropagation():(this.startDragHandle=this.handlePosition_,this.workspace_.setupDragSurface(),this.startDragMouse_=this.horizontal_?a.clientX:a.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,this.onMouseUpHandle_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.onMouseMoveHandle_),
|
|
Blockly.WidgetDiv.hide(!0),Blockly.DropDownDiv.hideWithoutAnimation(),a.stopPropagation(),a.preventDefault())};Blockly.Scrollbar.prototype.onMouseMoveHandle_=function(a){this.setHandlePosition(this.constrainHandle_(this.startDragHandle+((this.horizontal_?a.clientX:a.clientY)-this.startDragMouse_)));this.onScroll_()};Blockly.Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface();Blockly.Touch.clearTouchIdentifier();this.cleanUp_()};
|
|
Blockly.Scrollbar.prototype.cleanUp_=function(){Blockly.hideChaff(!0);Blockly.Scrollbar.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_),Blockly.Scrollbar.onMouseUpWrapper_=null);Blockly.Scrollbar.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_),Blockly.Scrollbar.onMouseMoveWrapper_=null)};
|
|
Blockly.Scrollbar.prototype.constrainHandle_=function(a){return a=0>=a||isNaN(a)||this.scrollViewSize_<this.handleLength_?0:Math.min(a,this.scrollViewSize_-this.handleLength_)};Blockly.Scrollbar.prototype.onScroll_=function(){var a=this.handlePosition_/this.scrollViewSize_;isNaN(a)&&(a=0);var b={};this.horizontal_?b.x=a:b.y=a;this.workspace_.setMetrics(b)};Blockly.Scrollbar.prototype.set=function(a){a=this.constrainHandle_(a*this.ratio_);this.handlePosition_!==a&&(this.setHandlePosition(a),this.onScroll_())};
|
|
Blockly.Scrollbar.prototype.setOrigin=function(a,b){this.origin_=new Blockly.utils.Coordinate(a,b)};Blockly.Trashcan=function(a){this.workspace_=a;this.hasBlocks_=!1;this.contents_=[];0>=this.workspace_.options.maxTrashcanContents||(a={scrollbars:!0,disabledPatternId:this.workspace_.options.disabledPatternId,parentWorkspace:this.workspace_,RTL:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex},this.workspace_.horizontalLayout?(a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_TOP?Blockly.TOOLBOX_AT_BOTTOM:Blockly.TOOLBOX_AT_TOP,this.flyout_=new Blockly.HorizontalFlyout(a)):
|
|
(a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?Blockly.TOOLBOX_AT_LEFT:Blockly.TOOLBOX_AT_RIGHT,this.flyout_=new Blockly.VerticalFlyout(a)),this.workspace_.addChangeListener(this.onDelete_()))};Blockly.Trashcan.prototype.WIDTH_=47;Blockly.Trashcan.prototype.BODY_HEIGHT_=44;Blockly.Trashcan.prototype.LID_HEIGHT_=16;Blockly.Trashcan.prototype.MARGIN_BOTTOM_=20;Blockly.Trashcan.prototype.MARGIN_SIDE_=20;Blockly.Trashcan.prototype.MARGIN_HOTSPOT_=10;
|
|
Blockly.Trashcan.prototype.SPRITE_LEFT_=0;Blockly.Trashcan.prototype.SPRITE_TOP_=32;Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE=.1;Blockly.Trashcan.prototype.isOpen=!1;Blockly.Trashcan.prototype.minOpenness_=0;Blockly.Trashcan.prototype.svgGroup_=null;Blockly.Trashcan.prototype.svgLid_=null;Blockly.Trashcan.prototype.lidTask_=0;Blockly.Trashcan.prototype.lidOpen_=0;Blockly.Trashcan.prototype.left_=0;Blockly.Trashcan.prototype.top_=0;
|
|
Blockly.Trashcan.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var b=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.svgGroup_);Blockly.utils.dom.createSvgElement("rect",{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},b);var c=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,
|
|
y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.svgGroup_);c.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url);b=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyTrashLidClipPath"+a},this.svgGroup_);Blockly.utils.dom.createSvgElement("rect",{width:this.WIDTH_,height:this.LID_HEIGHT_},b);this.svgLid_=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,
|
|
y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.svgGroup_);this.svgLid_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.click);Blockly.bindEvent_(c,"mouseover",this,this.mouseOver_);Blockly.bindEvent_(c,"mouseout",this,this.mouseOut_);this.animateLid_();return this.svgGroup_};
|
|
Blockly.Trashcan.prototype.init=function(a){0<this.workspace_.options.maxTrashcanContents&&(Blockly.utils.dom.insertAfter(this.flyout_.createDom("svg"),this.workspace_.getParentSvg()),this.flyout_.init(this.workspace_),this.flyout_.isBlockCreatable_=function(){return!0});this.verticalSpacing_=this.MARGIN_BOTTOM_+a;this.setOpen_(!1);return this.verticalSpacing_+this.BODY_HEIGHT_+this.LID_HEIGHT_};
|
|
Blockly.Trashcan.prototype.dispose=function(){this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.workspace_=this.svgLid_=null;clearTimeout(this.lidTask_)};
|
|
Blockly.Trashcan.prototype.position=function(){if(this.verticalSpacing_){var a=this.workspace_.getMetrics();a&&(this.left_=a.toolboxPosition==Blockly.TOOLBOX_AT_LEFT||this.workspace_.horizontalLayout&&!this.workspace_.RTL?a.viewWidth+a.absoluteLeft-this.WIDTH_-this.MARGIN_SIDE_-Blockly.Scrollbar.scrollbarThickness:this.MARGIN_SIDE_+Blockly.Scrollbar.scrollbarThickness,this.top_=a.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM?this.verticalSpacing_:a.viewHeight+a.absoluteTop-(this.BODY_HEIGHT_+this.LID_HEIGHT_)-
|
|
this.verticalSpacing_,this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")"))}};Blockly.Trashcan.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.top+this.SPRITE_TOP_-this.MARGIN_HOTSPOT_;a=a.left+this.SPRITE_LEFT_-this.MARGIN_HOTSPOT_;return new Blockly.utils.Rect(b,b+this.LID_HEIGHT_+this.BODY_HEIGHT_+2*this.MARGIN_HOTSPOT_,a,a+this.WIDTH_+2*this.MARGIN_HOTSPOT_)};
|
|
Blockly.Trashcan.prototype.setOpen_=function(a){this.isOpen!=a&&(clearTimeout(this.lidTask_),this.isOpen=a,this.animateLid_())};Blockly.Trashcan.prototype.animateLid_=function(){this.lidOpen_+=this.isOpen?.2:-.2;this.lidOpen_=Math.min(Math.max(this.lidOpen_,this.minOpenness_),1);this.setLidAngle_(45*this.lidOpen_);this.svgGroup_.style.opacity=.4+.4*this.lidOpen_;this.lidOpen_>this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),20))};
|
|
Blockly.Trashcan.prototype.setLidAngle_=function(a){var b=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")};Blockly.Trashcan.prototype.close=function(){this.setOpen_(!1)};Blockly.Trashcan.prototype.click=function(){if(this.hasBlocks_){for(var a=[],b=0,c;c=this.contents_[b];b++)a[b]=Blockly.Xml.textToDom(c);this.flyout_.show(a)}};
|
|
Blockly.Trashcan.prototype.mouseOver_=function(){this.hasBlocks_&&this.setOpen_(!0)};Blockly.Trashcan.prototype.mouseOut_=function(){this.setOpen_(!1)};
|
|
Blockly.Trashcan.prototype.onDelete_=function(){var a=this;return function(b){0>=a.workspace_.options.maxTrashcanContents||b.type!=Blockly.Events.BLOCK_DELETE||"shadow"==b.oldXml.tagName.toLowerCase()||(b=a.cleanBlockXML_(b.oldXml),-1==a.contents_.indexOf(b)&&(a.contents_.unshift(b),a.contents_.length>a.workspace_.options.maxTrashcanContents&&a.contents_.splice(a.workspace_.options.maxTrashcanContents,a.contents_.length-a.workspace_.options.maxTrashcanContents),a.hasBlocks_=!0,a.minOpenness_=a.HAS_BLOCKS_LID_ANGLE,
|
|
a.setLidAngle_(45*a.minOpenness_)))}};Blockly.Trashcan.prototype.cleanBlockXML_=function(a){for(var b=a=a.cloneNode(!0);b;){b.removeAttribute&&(b.removeAttribute("x"),b.removeAttribute("y"),b.removeAttribute("id"));var c=b.firstChild||b.nextSibling;if(!c)for(c=b.parentNode;c;){if(c.nextSibling){c=c.nextSibling;break}c=c.parentNode}b=c}return Blockly.Xml.domToText(a)};Blockly.VariableModel=function(a,b,c,d){this.workspace=a;this.name=b;this.type=c||"";this.id_=d||Blockly.utils.genUid();Blockly.Events.fire(new Blockly.Events.VarCreate(this))};Blockly.VariableModel.prototype.getId=function(){return this.id_};Blockly.VariableModel.compareByName=function(a,b){var c=a.name.toLowerCase(),d=b.name.toLowerCase();return c<d?-1:c==d?0:1};Blockly.Variables={};Blockly.Variables.NAME_TYPE=Blockly.VARIABLE_CATEGORY_NAME;Blockly.Variables.allUsedVarModels=function(a){var b=a.getAllBlocks(!1).filter(function(a){return!a.disabled});a=Object.create(null);for(var c=0;c<b.length;c++){var d=b[c].getVarModels();if(d)for(var e=0;e<d.length;e++){var f=d[e],g=f.getId();g&&(a[g]=f)}}b=[];for(g in a)b.push(a[g]);return b};Blockly.Variables.allUsedVariables=function(){console.warn("Deprecated call to Blockly.Variables.allUsedVariables. Use Blockly.Variables.allUsedVarModels instead.\nIf this is a major issue please file a bug on GitHub.")};
|
|
Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_={};
|
|
Blockly.Variables.allDeveloperVariables=function(a){a=a.getAllBlocks(!1);for(var b=Object.create(null),c=0,d;d=a[c];c++){var e=d.getDeveloperVariables;!e&&d.getDeveloperVars&&(e=d.getDeveloperVars,Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_[d.type]||(console.warn("Function getDeveloperVars() deprecated. Use getDeveloperVariables() (block type '"+d.type+"')"),Blockly.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_[d.type]=!0));if(e)for(d=e(),e=0;e<d.length;e++)b[d[e]]=!0}return Object.keys(b)};
|
|
Blockly.Variables.flyoutCategory=function(a){var b=[],c=document.createElement("button");c.setAttribute("text","%{BKY_NEW_VARIABLE}");c.setAttribute("callbackKey","CREATE_VARIABLE");a.registerButtonCallback(Blockly.CREATE_VARIABLE_ID,function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace())});b.push(c);a=Blockly.Variables.flyoutCategoryBlocks(a);return b=b.concat(a)};
|
|
Blockly.Variables.flyoutCategoryBlocks=function(a){a=a.getVariablesOfType("");var b=[];if(0<a.length){var c=a[a.length-1];if(Blockly.Blocks.variables_set){var d=Blockly.utils.xml.createElement("block");d.setAttribute("type","variables_set");d.setAttribute("gap",Blockly.Blocks.math_change?8:24);d.appendChild(Blockly.Variables.generateVariableFieldDom(c));b.push(d)}Blockly.Blocks.math_change&&(d=Blockly.utils.xml.createElement("block"),d.setAttribute("type","math_change"),d.setAttribute("gap",Blockly.Blocks.variables_get?
|
|
20:8),d.appendChild(Blockly.Variables.generateVariableFieldDom(c)),c=Blockly.Xml.textToDom('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),d.appendChild(c),b.push(d));if(Blockly.Blocks.variables_get){a.sort(Blockly.VariableModel.compareByName);c=0;for(var e;e=a[c];c++)d=Blockly.utils.xml.createElement("block"),d.setAttribute("type","variables_get"),d.setAttribute("gap",8),d.appendChild(Blockly.Variables.generateVariableFieldDom(e)),b.push(d)}}return b};
|
|
Blockly.Variables.generateUniqueName=function(a){a=a.getAllVariables();var b="";if(a.length)for(var c=1,d=0,e="ijkmnopqrstuvwxyzabcdefgh".charAt(d);!b;){for(var f=!1,g=0;g<a.length;g++)if(a[g].name.toLowerCase()==e){f=!0;break}f?(d++,25==d&&(d=0,c++),e="ijkmnopqrstuvwxyzabcdefgh".charAt(d),1<c&&(e+=c)):b=e}else b="i";return b};
|
|
Blockly.Variables.createVariableButtonHandler=function(a,b,c){var d=c||"",e=function(c){Blockly.Variables.promptName(Blockly.Msg.NEW_VARIABLE_TITLE,c,function(c){if(c){var f=Blockly.Variables.nameUsedWithAnyType_(c,a),g=Blockly.Functions.getDefinition(c,a);if(f||g){var l=c.toLowerCase();g||f.type==d?g=Blockly.Msg.VARIABLE_ALREADY_EXISTS.replace("%1",l):(g=Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,g=g.replace("%1",l).replace("%2",f.type));Blockly.alert(g,function(){e(c)})}else a.createVariable(c,
|
|
d),b&&b(c)}else b&&b(null)})};e("")};goog.exportSymbol("Blockly.Variables.createVariableButtonHandler",Blockly.Variables.createVariableButtonHandler);Blockly.Variables.createVariable=Blockly.Variables.createVariableButtonHandler;goog.exportSymbol("Blockly.Variables.createVariable",Blockly.Variables.createVariable);
|
|
Blockly.Variables.renameVariable=function(a,b,c){var d=function(e){var f=Blockly.Msg.RENAME_VARIABLE_TITLE.replace("%1",b.name);Blockly.Variables.promptName(f,e,function(e){if(e){var f=Blockly.Variables.nameUsedWithOtherType_(e,b.type,a);f?(f=Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",e.toLowerCase()).replace("%2",f.type),Blockly.alert(f,function(){d(e)})):(a.renameVariableById(b.getId(),e),c&&c(e))}else c&&c(null)})};d("")};
|
|
Blockly.Variables.promptName=function(a,b,c){Blockly.prompt(a,b,function(a){a&&(a=a.replace(/[\s\xa0]+/g," ").trim(),a==Blockly.Msg.RENAME_VARIABLE||a==Blockly.Msg.NEW_VARIABLE)&&(a=null);c(a)})};Blockly.Variables.nameUsedWithOtherType_=function(a,b,c){c=c.getVariableMap().getAllVariables();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()==a&&e.type!=b)return e;return null};
|
|
Blockly.Variables.nameUsedWithAnyType_=function(a,b){var c=b.getVariableMap().getAllVariables();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()==a)return e;return null};Blockly.Variables.generateVariableFieldXmlString=function(a){var b=a.type;return'<field name="VAR" id="'+a.getId()+'" variabletype="'+goog.string.htmlEscape(b)+'">'+goog.string.htmlEscape(a.name)+"</field>"};
|
|
Blockly.Variables.generateVariableFieldDom=function(a){var b=Blockly.utils.xml.createElement("field");b.setAttribute("name","VAR");b.setAttribute("id",a.getId());b.setAttribute("variabletype",a.type);a=Blockly.utils.xml.createTextNode(a.name);b.appendChild(a);return b};Blockly.Variables.getOrCreateVariablePackage=function(a,b,c,d){var e=Blockly.Variables.getVariable(a,b,c,d);e||(e=Blockly.Variables.createVariable_(a,b,c,d));return e};
|
|
Blockly.Variables.getVariable=function(a,b,c,d){var e=a.getPotentialVariableMap();if(b){var f=a.getVariableById(b);!f&&e&&(f=e.getVariableById(b));if(f)return f}if(c){if(void 0==d)throw Error("Tried to look up a variable by name without a type");f=a.getVariable(c,d);!f&&e&&(f=e.getVariable(c,d))}return f};
|
|
Blockly.Variables.createVariable_=function(a,b,c,d){var e=a.getPotentialVariableMap();c||(c=Blockly.Variables.generateUniqueName(a.isFlyout?a.targetWorkspace:a));return e?e.createVariable(c,d,b):a.createVariable(c,d,b)};Blockly.Variables.getAddedVariables=function(a,b){var c=a.getAllVariables(),d=[];if(b.length!=c.length)for(var e=0;e<c.length;e++){var f=c[e];-1==b.indexOf(f)&&d.push(f)}return d};Blockly.VariablesDynamic={};Blockly.VariablesDynamic.onCreateVariableButtonClick_String=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"String")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Number=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"Number")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"Colour")};
|
|
Blockly.VariablesDynamic.flyoutCategory=function(a){var b=[],c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_STRING_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_STRING");b.push(c);c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_NUMBER_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER");b.push(c);c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_COLOUR_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR");
|
|
b.push(c);a.registerButtonCallback("CREATE_VARIABLE_STRING",Blockly.VariablesDynamic.onCreateVariableButtonClick_String);a.registerButtonCallback("CREATE_VARIABLE_NUMBER",Blockly.VariablesDynamic.onCreateVariableButtonClick_Number);a.registerButtonCallback("CREATE_VARIABLE_COLOUR",Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour);a=Blockly.VariablesDynamic.flyoutCategoryBlocks(a);return b=b.concat(a)};
|
|
Blockly.VariablesDynamic.flyoutCategoryBlocks=function(a){a=a.getAllVariables();var b=[];if(0<a.length){if(Blockly.Blocks.variables_set_dynamic){var c=a[a.length-1],d=Blockly.utils.xml.createElement("block");d.setAttribute("type","variables_set_dynamic");d.setAttribute("gap",24);d.appendChild(Blockly.Variables.generateVariableFieldDom(c));b.push(d)}if(Blockly.Blocks.variables_get_dynamic){a.sort(Blockly.VariableModel.compareByName);c=0;for(var e;e=a[c];c++)d=Blockly.utils.xml.createElement("block"),
|
|
d.setAttribute("type","variables_get_dynamic"),d.setAttribute("gap",8),d.appendChild(Blockly.Variables.generateVariableFieldDom(e)),b.push(d)}}return b};Blockly.WorkspaceAudio=function(a){this.parentWorkspace_=a;this.SOUNDS_=Object.create(null)};Blockly.WorkspaceAudio.prototype.lastSound_=null;Blockly.WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null};
|
|
Blockly.WorkspaceAudio.prototype.load=function(a,b){if(a.length){try{var c=new Blockly.utils.global.Audio}catch(h){return}for(var d,e=0;e<a.length;e++){var f=a[e],g=f.match(/\.(\w+)$/);if(g&&c.canPlayType("audio/"+g[1])){d=new Blockly.utils.global.Audio(f);break}}d&&d.play&&(this.SOUNDS_[b]=d)}};Blockly.WorkspaceAudio.prototype.preload=function(){for(var a in this.SOUNDS_){var b=this.SOUNDS_[a];b.volume=.01;b.play()["catch"](function(){});b.pause();if(Blockly.utils.userAgent.IPAD||Blockly.utils.userAgent.IPHONE)break}};
|
|
Blockly.WorkspaceAudio.prototype.play=function(a,b){var c=this.SOUNDS_[a];if(c){var d=new Date;null!=this.lastSound_&&d-this.lastSound_<Blockly.SOUND_LIMIT||(this.lastSound_=d,c=Blockly.utils.userAgent.IPAD||Blockly.utils.userAgent.ANDROID?c:c.cloneNode(),c.volume=void 0===b?1:b,c.play())}else this.parentWorkspace_&&this.parentWorkspace_.getAudioManager().play(a,b)};Blockly.WorkspaceCommentSvg.render={};Blockly.WorkspaceCommentSvg.BORDER_WIDTH=1;Blockly.WorkspaceCommentSvg.RESIZE_SIZE=12*Blockly.WorkspaceCommentSvg.BORDER_WIDTH;Blockly.WorkspaceCommentSvg.TEXTAREA_OFFSET=12;Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT=32;Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE=16;Blockly.WorkspaceCommentSvg.DELETE_ICON_SIZE=12;Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET=6;Blockly.WorkspaceCommentSvg.MINIMIZE_WIDTH=200;
|
|
Blockly.WorkspaceCommentSvg.UNEDITABLE_TEXT_LENGTH=35;Blockly.WorkspaceCommentSvg.UNEDITABLE_LINE_GAP=30;Blockly.WorkspaceCommentSvg.prototype.getHeightWidth=function(){return{width:this.getWidth(),height:this.getHeight()}};
|
|
Blockly.WorkspaceCommentSvg.prototype.render=function(){if(!this.rendered_){var a=this.getHeightWidth();!this.isEditable()||Blockly.utils.userAgent.IE?(this.createUneditableText_(),this.svgGroup_.appendChild(this.uneditableTextGroup_)):(this.commentEditor_=this.createEditor_(),this.svgGroup_.appendChild(this.commentEditor_));var b=this.commentEditor_||this.uneditableTextGroup_;this.svgHandleTarget_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyCommentHandleTarget",fill:"transparent",
|
|
rx:Blockly.WorkspaceCommentSvg.BORDER_WIDTH,ry:Blockly.WorkspaceCommentSvg.BORDER_WIDTH,height:Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT},this.svgGroup_);this.svgRectTarget_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyDraggable blocklyCommentTarget",x:0,y:0,rx:4*Blockly.WorkspaceCommentSvg.BORDER_WIDTH,ry:4*Blockly.WorkspaceCommentSvg.BORDER_WIDTH},this.svgGroup_);this.isEditable()&&!Blockly.utils.userAgent.IE&&this.addResizeDom_();this.createTopBarIcons_();this.createTopBarLabel_();
|
|
this.isMinimized()?(this.minimizeArrow_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.mainWorkspace.options.pathToMedia+"comment-arrow-up.svg"),b.setAttribute("display","none"),this.resizeGroup_.setAttribute("display","none")):(this.minimizeArrow_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.mainWorkspace.options.pathToMedia+"comment-arrow-down.svg"),this.topBarLabel_.setAttribute("display","none"));if(this.textarea_)this.textarea_.value=this.content_;else for(b=
|
|
0;b<this.content_.length;b+=Blockly.WorkspaceCommentSvg.UNEDITABLE_TEXT_LENGTH){var c=this.content_.substring(b,b+Blockly.WorkspaceCommentSvg.UNEDITABLE_TEXT_LENGTH);this.pushUneditableTextLine_(c)}this.isEditable()&&!Blockly.utils.userAgent.IE?this.setSize(a.width,a.height):this.setSize(8*Blockly.WorkspaceCommentSvg.UNEDITABLE_TEXT_LENGTH+25,this.uneditableTextLineY-10);this.rendered_=!0;this.resizeGroup_&&(Blockly.bindEventWithChecks_(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_),Blockly.bindEventWithChecks_(this.resizeGroup_,
|
|
"mouseup",this,this.resizeMouseUp_));Blockly.bindEventWithChecks_(this.minimizeArrow_,"mousedown",this,this.minimizeArrowMouseDown_);Blockly.bindEventWithChecks_(this.minimizeArrow_,"mouseout",this,this.minimizeArrowMouseOut_);Blockly.bindEventWithChecks_(this.minimizeArrow_,"mouseup",this,this.minimizeArrowMouseUp_);this.isDeletable()&&(Blockly.bindEventWithChecks_(this.deleteIcon_,"mousedown",this,this.deleteMouseDown_),Blockly.bindEventWithChecks_(this.deleteIcon_,"mouseout",this,this.deleteMouseOut_),
|
|
Blockly.bindEventWithChecks_(this.deleteIcon_,"mouseup",this,this.deleteMouseUp_))}};
|
|
Blockly.WorkspaceCommentSvg.prototype.createEditor_=function(){this.foreignObject_=Blockly.utils.dom.createSvgElement("foreignObject",{x:Blockly.WorkspaceCommentSvg.BORDER_WIDTH,y:Blockly.WorkspaceCommentSvg.BORDER_WIDTH+Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT,"class":"blocklyCommentForeignObject"},null);var a=document.createElementNS(Blockly.utils.dom.HTML_NS,"body");a.setAttribute("xmlns",Blockly.utils.dom.HTML_NS);a.className="blocklyMinimalBody";var b=document.createElementNS(Blockly.utils.dom.HTML_NS,
|
|
"textarea");b.className="blocklyCommentTextarea";b.setAttribute("dir",this.RTL?"RTL":"LTR");b.setAttribute("maxlength",Blockly.WorkspaceComment.COMMENT_TEXT_LIMIT);a.appendChild(b);this.textarea_=b;this.textarea_.style.margin=Blockly.WorkspaceCommentSvg.TEXTAREA_OFFSET+"px";this.foreignObject_.appendChild(a);Blockly.bindEventWithChecks_(b,"wheel",this,function(a){a.stopPropagation()});Blockly.bindEventWithChecks_(b,"change",this,function(a){this.text_!=b.value&&this.setContent(b.value)});this.labelText_=
|
|
this.getLabelText();return this.foreignObject_};
|
|
Blockly.WorkspaceCommentSvg.prototype.addResizeDom_=function(){this.resizeGroup_=Blockly.utils.dom.createSvgElement("g",{"class":this.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.svgGroup_);var a=Blockly.WorkspaceCommentSvg.RESIZE_SIZE;Blockly.utils.dom.createSvgElement("polygon",{points:"0,0 0,x x,x x,0".replace(/x/g,a.toString())},this.resizeGroup_);Blockly.utils.dom.createSvgElement("line",{"class":"blocklyResizeLine",x1:a/3,y1:a-1,x2:a-1,y2:a/3},this.resizeGroup_);Blockly.utils.dom.createSvgElement("line",
|
|
{"class":"blocklyResizeLine",x1:2*a/3,y1:a-1,x2:a-1,y2:2*a/3},this.resizeGroup_)};Blockly.WorkspaceCommentSvg.prototype.createCommentTopBar_=function(){this.svgHandleTarget_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyDraggable blocklyCommentHandleTarget",fill:"transparent",rx:Blockly.WorkspaceCommentSvg.BORDER_WIDTH,ry:Blockly.WorkspaceCommentSvg.BORDER_WIDTH,height:Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT},this.svgGroup_);this.createTopBarIcons_();this.createTopBarLabel_()};
|
|
Blockly.WorkspaceCommentSvg.prototype.createTopBarLabel_=function(){this.topBarLabel_=Blockly.utils.dom.createSvgElement("text",{"class":"blocklyCommentText",x:this.width_/2,y:Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT/2+Blockly.WorkspaceCommentSvg.BORDER_WIDTH,"text-anchor":"middle","dominant-baseline":"middle"},this.svgGroup_);var a=document.createTextNode(this.labelText_);this.topBarLabel_.appendChild(a)};
|
|
Blockly.WorkspaceCommentSvg.prototype.createTopBarIcons_=function(){this.minimizeArrow_=Blockly.utils.dom.createSvgElement("image",{x:Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET,y:Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT/2+Blockly.WorkspaceCommentSvg.BORDER_WIDTH-Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE/2,width:Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE,height:Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE},this.svgGroup_);this.isDeletable()&&(this.deleteIcon_=Blockly.utils.dom.createSvgElement("g",
|
|
{"class":"blocklyCommentDeleteIcon"},this.svgGroup_),Blockly.utils.dom.createSvgElement("rect",{x:"-12.5",y:"1",width:"27.5",height:"27.5",fill:"transparent","class":"blocklyDeleteIconShape"},this.deleteGroup_),Blockly.WorkspaceCommentSvg.drawDeleteIcon(this.deleteIcon_))};
|
|
Blockly.WorkspaceCommentSvg.drawDeleteIcon=function(a){a=Blockly.utils.dom.createSvgElement("g",{transform:"scale (1.5) translate(-6, 1)"},a);Blockly.utils.dom.createSvgElement("rect",{x:5,y:2,width:"4",height:"2",stroke:"#fff","stroke-width":"1",fill:"transparent"},a);Blockly.utils.dom.createSvgElement("line",{x1:1,y1:4,x2:13,y2:4,stroke:"#fff","stroke-width":"1","stroke-linecap":"round"},a);Blockly.utils.dom.createSvgElement("rect",{x:2,y:4,width:10,height:12,rx:"1",ry:"1",stroke:"#fff","stroke-width":"1",
|
|
fill:"transparent"},a);Blockly.utils.dom.createSvgElement("line",{x1:5,y1:7,x2:5,y2:13,stroke:"#fff","stroke-width":"1","stroke-linecap":"round"},a);Blockly.utils.dom.createSvgElement("line",{x1:7,y1:7,x2:7,y2:13,stroke:"#fff","stroke-width":"1","stroke-linecap":"round"},a);Blockly.utils.dom.createSvgElement("line",{x1:9,y1:7,x2:9,y2:13,stroke:"#fff","stroke-width":"1","stroke-linecap":"round"},a)};
|
|
Blockly.WorkspaceCommentSvg.prototype.minimizeArrowMouseDown_=function(a){this.shouldToggleMinimize_=!0;a.stopPropagation()};Blockly.WorkspaceCommentSvg.prototype.minimizeArrowMouseOut_=function(a){this.shouldToggleMinimize_=!1};Blockly.WorkspaceCommentSvg.prototype.minimizeArrowMouseUp_=function(a){this.shouldToggleMinimize_&&(this.shouldToggleMinimize=!1,this.toggleMinimize_());a.stopPropagation();Blockly.Touch.clearTouchIdentifier()};
|
|
Blockly.WorkspaceCommentSvg.prototype.deleteMouseDown_=function(a){this.shouldDelete_=!0;a.stopPropagation()};Blockly.WorkspaceCommentSvg.prototype.deleteMouseOut_=function(a){this.shouldDelete_=!1};Blockly.WorkspaceCommentSvg.prototype.deleteMouseUp_=function(a){this.shouldDelete_&&this.dispose();a.stopPropagation();Blockly.Touch.clearTouchIdentifier()};
|
|
Blockly.WorkspaceCommentSvg.prototype.resizeMouseDown_=function(a){this.resizeStartSize_={width:this.width_,height:this.height_};this.unbindDragEvents_();this.workspace.setResizesEnabled(!1);Blockly.utils.isRightButton(a)||(this.workspace.startDrag(a,new Blockly.utils.Coordinate(this.workspace.RTL?-this.width_:this.width_,this.height_)),this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,this.resizeMouseUp_),this.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",
|
|
this,this.resizeMouseMove_),Blockly.hideChaff());a.stopPropagation()};
|
|
Blockly.WorkspaceCommentSvg.prototype.setRenderedMinimizeState_=function(a,b){var c=this.commentEditor_||this.uneditableTextGroup_;a?(this.minimizeArrow_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.mainWorkspace.options.pathToMedia+"comment-arrow-up.svg"),c.setAttribute("display","none"),this.resizeGroup_&&this.resizeGroup_.setAttribute("display","none"),b&&this.labelText_!=b&&(this.topBarLabel_.textContent=b),this.topBarLabel_.removeAttribute("display")):(this.minimizeArrow_.setAttributeNS("http://www.w3.org/1999/xlink",
|
|
"xlink:href",Blockly.mainWorkspace.options.pathToMedia+"comment-arrow-down.svg"),this.topBarLabel_.setAttribute("display","none"),c.removeAttribute("display"),this.resizeGroup_&&this.resizeGroup_.removeAttribute("display"))};Blockly.WorkspaceCommentSvg.prototype.unbindDragEvents_=function(){this.onMouseUpWrapper_&&(Blockly.unbindEvent_(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null);this.onMouseMoveWrapper_&&(Blockly.unbindEvent_(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null)};
|
|
Blockly.WorkspaceCommentSvg.prototype.resizeMouseUp_=function(){Blockly.Touch.clearTouchIdentifier();this.unbindDragEvents_();var a=this.resizeStartSize_;this.resizeStartSize_=null;if(this.width_!=a.width||this.height_!=a.height)Blockly.Events.fire(new Blockly.Events.CommentChange(this,{width:a.width,height:a.height},{width:this.width_,height:this.height_})),this.workspace.setResizesEnabled(!0)};
|
|
Blockly.WorkspaceCommentSvg.prototype.resizeMouseMove_=function(a){this.autoLayout_=!1;a=this.workspace.moveDrag(a);var b=!1;Blockly.Events.isEnabled()&&(Blockly.Events.disable(),b=!0);this.setSize(this.RTL?-a.x:a.x,a.y);b&&Blockly.Events.enable()};
|
|
Blockly.WorkspaceCommentSvg.prototype.resizeComment_=function(){var a=2*Blockly.WorkspaceCommentSvg.BORDER_WIDTH,b=Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT,c=2*Blockly.WorkspaceCommentSvg.TEXTAREA_OFFSET,d=this.commentEditor_||this.uneditableBackground_;d.setAttribute("width",this.width_-a);d.setAttribute("height",this.height_-a-b);this.RTL&&d.setAttribute("x",-this.width_);this.textarea_&&(this.textarea_.style.width=this.width_-c+"px",this.textarea_.style.height=this.height_-a-c-b+"px")};
|
|
Blockly.WorkspaceCommentSvg.prototype.setSize=function(a,b){var c=this.width_,d=this.height_,e=2*Blockly.WorkspaceCommentSvg.BORDER_WIDTH;this.isMinimized_?(a=Blockly.WorkspaceCommentSvg.MINIMIZE_WIDTH,b=Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT):(a=Math.max(a,e+50),b=Math.max(b,e+20+Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT),this.width_=a,this.height_=b,Blockly.Events.fire(new Blockly.Events.CommentChange(this,{width:c,height:d},{width:this.width_,height:this.height_})));this.svgRect_.setAttribute("width",
|
|
a);this.svgRect_.setAttribute("height",b);this.svgRectTarget_.setAttribute("width",a);this.svgRectTarget_.setAttribute("height",b);this.svgHandleTarget_.setAttribute("width",a);this.svgHandleTarget_.setAttribute("height",Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT);this.RTL?(this.minimizeArrow_.setAttribute("x",a-Blockly.WorkspaceCommentSvg.MINIMIZE_ICON_SIZE-Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET),this.svgRect_.setAttribute("transform","scale(-1 1)"),this.svgHandleTarget_.setAttribute("transform",
|
|
"scale(-1 1)"),this.svgHandleTarget_.setAttribute("transform","translate("+-a+", 1)"),this.minimizeArrow_.setAttribute("transform","translate("+-a+", 1)"),this.isDeletable()&&this.deleteIcon_.setAttribute("transform","translate("+(-a+Blockly.WorkspaceCommentSvg.DELETE_ICON_SIZE+Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET)+",0) scale(-1 1)")):this.isDeletable()&&this.deleteIcon_.setAttribute("transform","translate("+(a-Blockly.WorkspaceCommentSvg.DELETE_ICON_SIZE-Blockly.WorkspaceCommentSvg.TOP_BAR_ICON_INSET)+
|
|
",0)");c=Blockly.WorkspaceCommentSvg.RESIZE_SIZE;this.resizeGroup_&&(this.RTL?this.resizeGroup_.setAttribute("transform","translate("+(-a+c)+","+(b-c)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(a-e-c)+","+(b-e-c)+")"));this.isMinimized_&&(this.topBarLabel_.setAttribute("x",a/2),this.topBarLabel_.setAttribute("y",b/2));this.resizeComment_()};Blockly.WorkspaceComment.prototype.toggleMinimize_=function(){this.setMinimized(!this.isMinimized_)};
|
|
Blockly.WorkspaceComment.prototype.setMinimized=function(a){this.isMinimized_!=a&&(Blockly.Events.fire(new Blockly.Events.CommentChange(this,{minimized:this.isMinimized_},{minimized:a})),(this.isMinimized_=a)?(this.rendered_&&this.setRenderedMinimizeState_(!0,this.getLabelText()),this.setSize(Blockly.WorkspaceCommentSvg.MINIMIZE_WIDTH,Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT)):(this.rendered_&&this.setRenderedMinimizeState_(!1),this.setContent(this.content_),this.setSize(this.width_,this.height_)))};
|
|
Blockly.WorkspaceCommentSvg.prototype.disposeInternal_=function(){this.svgHandleTarget_=this.svgRectTarget_=this.svgRect_=this.foreignObject_=this.textarea_=null;this.disposed_=!0};Blockly.WorkspaceCommentSvg.prototype.setFocus=function(){var a=this;this.focused_=!0;setTimeout(function(){a.disposed_||(a.textarea_.focus(),a.addFocus(),Blockly.utils.dom.addClass(a.svgRectTarget_,"blocklyCommentTargetFocused"),Blockly.utils.dom.addClass(a.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)};
|
|
Blockly.WorkspaceCommentSvg.prototype.blurFocus=function(){var a=this;this.focused_=!1;setTimeout(function(){a.disposed_||(a.textarea_.blur(),a.removeFocus(),Blockly.utils.dom.removeClass(a.svgRectTarget_,"blocklyCommentTargetFocused"),Blockly.utils.dom.removeClass(a.svgHandleTarget_,"blocklyCommentHandleTargetFocused"))},0)};
|
|
Blockly.WorkspaceCommentSvg.prototype.createUneditableText_=function(){this.uneditableTextGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyUneditableComment"},this.svgGroup_);this.uneditableBackground_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyUneditableMinimalBody",y:Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT.toString()},this.svgGroup_);this.uneditableTextGroup_.appendChild(this.uneditableBackground_);this.uneditableTextLineY=2*Blockly.WorkspaceCommentSvg.TOP_BAR_HEIGHT};
|
|
Blockly.WorkspaceCommentSvg.prototype.pushUneditableTextLine_=function(a){var b=Blockly.utils.dom.createSvgElement("text",{x:15,y:this.uneditableTextLineY},this.uneditableTextGroup_);a=document.createTextNode(a);b.appendChild(a);this.uneditableTextLineY+=Blockly.WorkspaceCommentSvg.UNEDITABLE_LINE_GAP};Blockly.WorkspaceDragSurfaceSvg=function(a){this.container_=a;this.createDom()};Blockly.WorkspaceDragSurfaceSvg.prototype.SVG_=null;Blockly.WorkspaceDragSurfaceSvg.prototype.dragGroup_=null;Blockly.WorkspaceDragSurfaceSvg.prototype.container_=null;
|
|
Blockly.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.utils.dom.createSvgElement("svg",{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))};
|
|
Blockly.WorkspaceDragSurfaceSvg.prototype.translateSurface=function(a,b){var c=a.toFixed(0),d=b.toFixed(0);this.SVG_.style.display="block";Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+c+"px, "+d+"px, 0px)")};Blockly.WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return Blockly.utils.getRelativeXY(this.SVG_)};
|
|
Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var b=this.SVG_.childNodes[0],c=this.SVG_.childNodes[1];if(!(b&&c&&Blockly.utils.dom.hasClass(b,"blocklyBlockCanvas")&&Blockly.utils.dom.hasClass(c,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.previousSibling_?Blockly.utils.dom.insertAfter(b,this.previousSibling_):a.insertBefore(b,a.firstChild);
|
|
Blockly.utils.dom.insertAfter(c,b);this.SVG_.style.display="none";if(this.SVG_.childNodes.length)throw Error("Drag surface was not cleared.");Blockly.utils.dom.setCssTransform(this.SVG_,"");this.previousSibling_=null};
|
|
Blockly.WorkspaceDragSurfaceSvg.prototype.setContentsAndShow=function(a,b,c,d,e,f){if(this.SVG_.childNodes.length)throw Error("Already dragging a block.");this.previousSibling_=c;a.setAttribute("transform","translate(0, 0) scale("+f+")");b.setAttribute("transform","translate(0, 0) scale("+f+")");this.SVG_.setAttribute("width",d);this.SVG_.setAttribute("height",e);this.SVG_.appendChild(a);this.SVG_.appendChild(b);this.SVG_.style.display="block"};
|
|
Blockly.ZoomControls=function(a){this.workspace_=a};Blockly.ZoomControls.prototype.WIDTH_=32;Blockly.ZoomControls.prototype.HEIGHT_=110;Blockly.ZoomControls.prototype.MARGIN_BOTTOM_=20;Blockly.ZoomControls.prototype.MARGIN_SIDE_=20;Blockly.ZoomControls.prototype.svgGroup_=null;Blockly.ZoomControls.prototype.left_=0;Blockly.ZoomControls.prototype.top_=0;
|
|
Blockly.ZoomControls.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{},null);var a=String(Math.random()).substring(2);this.createZoomOutSvg_(a);this.createZoomInSvg_(a);this.workspace_.isMovable()&&this.createZoomResetSvg_(a);return this.svgGroup_};Blockly.ZoomControls.prototype.init=function(a){this.verticalSpacing_=this.MARGIN_BOTTOM_+a;return this.verticalSpacing_+this.HEIGHT_};
|
|
Blockly.ZoomControls.prototype.dispose=function(){this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.workspace_=null};
|
|
Blockly.ZoomControls.prototype.position=function(){if(this.verticalSpacing_){var a=this.workspace_.getMetrics();a&&(this.left_=a.toolboxPosition==Blockly.TOOLBOX_AT_LEFT||this.workspace_.horizontalLayout&&!this.workspace_.RTL?a.viewWidth+a.absoluteLeft-this.WIDTH_-this.MARGIN_SIDE_-Blockly.Scrollbar.scrollbarThickness:this.MARGIN_SIDE_+Blockly.Scrollbar.scrollbarThickness,a.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM?(this.top_=this.verticalSpacing_,this.zoomInGroup_.setAttribute("transform","translate(0, 34)"),
|
|
this.zoomResetGroup_&&this.zoomResetGroup_.setAttribute("transform","translate(0, 77)")):(this.top_=a.viewHeight+a.absoluteTop-this.HEIGHT_-this.verticalSpacing_,this.zoomInGroup_.setAttribute("transform","translate(0, 43)"),this.zoomOutGroup_.setAttribute("transform","translate(0, 77)")),this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")"))}};
|
|
Blockly.ZoomControls.prototype.createZoomOutSvg_=function(a){var b=this.workspace_;this.zoomOutGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyZoom"},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyZoomoutClipPath"+a},this.zoomOutGroup_);Blockly.utils.dom.createSvgElement("rect",{width:32,height:32},c);a=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,height:Blockly.SPRITE.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+
|
|
a+")"},this.zoomOutGroup_);a.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",b.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(a,"mousedown",null,function(a){b.markFocused();b.zoomCenter(-1);Blockly.Touch.clearTouchIdentifier();a.stopPropagation();a.preventDefault()})};
|
|
Blockly.ZoomControls.prototype.createZoomInSvg_=function(a){var b=this.workspace_;this.zoomInGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyZoom"},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyZoominClipPath"+a},this.zoomInGroup_);Blockly.utils.dom.createSvgElement("rect",{width:32,height:32},c);a=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,height:Blockly.SPRITE.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+
|
|
a+")"},this.zoomInGroup_);a.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",b.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(a,"mousedown",null,function(a){b.markFocused();b.zoomCenter(1);Blockly.Touch.clearTouchIdentifier();a.stopPropagation();a.preventDefault()})};
|
|
Blockly.ZoomControls.prototype.createZoomResetSvg_=function(a){var b=this.workspace_;this.zoomResetGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyZoom"},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyZoomresetClipPath"+a},this.zoomResetGroup_);Blockly.utils.dom.createSvgElement("rect",{width:32,height:32},c);a=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,height:Blockly.SPRITE.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+
|
|
a+")"},this.zoomResetGroup_);a.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",b.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(a,"mousedown",null,function(a){b.markFocused();b.setScale(b.options.zoomOptions.startScale);b.beginCanvasTransition();b.scrollCenter();setTimeout(function(){b.endCanvasTransition()},500);Blockly.Touch.clearTouchIdentifier();a.stopPropagation();a.preventDefault()})};
|
|
Blockly.WorkspaceSvg=function(a,b,c){Blockly.WorkspaceSvg.superClass_.constructor.call(this,a);this.getMetrics=a.getMetrics||Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_;this.setMetrics=a.setMetrics||Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_;this.connectionDBList=Blockly.ConnectionDB.init();b&&(this.blockDragSurface_=b);c&&(this.workspaceDragSurface_=c);this.useWorkspaceDragSurface_=this.workspaceDragSurface_&&Blockly.utils.is3dSupported();this.highlightedBlocks_=[];this.audioManager_=
|
|
new Blockly.WorkspaceAudio(a.parentWorkspace);this.grid_=this.options.gridPattern?new Blockly.Grid(a.gridPattern,a.gridOptions):null;Blockly.Variables&&Blockly.Variables.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.VARIABLE_CATEGORY_NAME,Blockly.Variables.flyoutCategory);Blockly.VariablesDynamic&&Blockly.VariablesDynamic.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME,Blockly.VariablesDynamic.flyoutCategory);a.newFunctions&&Blockly.Functions&&
|
|
Blockly.Functions.flyoutCategory?this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,Blockly.Functions.flyoutCategory):Blockly.Procedures&&Blockly.Procedures.flyoutCategory&&this.registerToolboxCategoryCallback(Blockly.PROCEDURE_CATEGORY_NAME,Blockly.Procedures.flyoutCategory)};goog.inherits(Blockly.WorkspaceSvg,Blockly.Workspace);Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_=null;Blockly.WorkspaceSvg.prototype.rendered=!0;Blockly.WorkspaceSvg.prototype.isVisible_=!0;
|
|
Blockly.WorkspaceSvg.prototype.isFlyout=!1;Blockly.WorkspaceSvg.prototype.isMutator=!1;Blockly.WorkspaceSvg.prototype.resizesEnabled_=!0;Blockly.WorkspaceSvg.prototype.scrollX=0;Blockly.WorkspaceSvg.prototype.scrollY=0;Blockly.WorkspaceSvg.prototype.startScrollX=0;Blockly.WorkspaceSvg.prototype.startScrollY=0;Blockly.WorkspaceSvg.prototype.dragDeltaXY_=null;Blockly.WorkspaceSvg.prototype.scale=1;Blockly.WorkspaceSvg.prototype.trashcan=null;Blockly.WorkspaceSvg.prototype.scrollbar=null;
|
|
Blockly.WorkspaceSvg.prototype.flyout_=null;Blockly.WorkspaceSvg.prototype.toolbox_=null;Blockly.WorkspaceSvg.prototype.currentGesture_=null;Blockly.WorkspaceSvg.prototype.blockDragSurface_=null;Blockly.WorkspaceSvg.prototype.workspaceDragSurface_=null;Blockly.WorkspaceSvg.prototype.useWorkspaceDragSurface_=!1;Blockly.WorkspaceSvg.prototype.isDragSurfaceActive_=!1;Blockly.WorkspaceSvg.prototype.injectionDiv_=null;Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_=null;
|
|
Blockly.WorkspaceSvg.prototype.injectionDiv_=null;Blockly.WorkspaceSvg.prototype.flyoutButtonCallbacks_={};Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_={};Blockly.WorkspaceSvg.prototype.configureContextMenu=null;Blockly.WorkspaceSvg.prototype.targetWorkspace=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTM_=null;Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_=!0;
|
|
Blockly.WorkspaceSvg.prototype.getInverseScreenCTM=function(){if(this.inverseScreenCTMDirty_){var a=this.getParentSvg().getScreenCTM();a&&(this.inverseScreenCTM_=a.inverse(),this.inverseScreenCTMDirty_=!1)}return this.inverseScreenCTM_};Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){this.inverseScreenCTMDirty_=!0};Blockly.WorkspaceSvg.prototype.isVisible=function(){return this.isVisible_};
|
|
Blockly.WorkspaceSvg.prototype.getSvgXY=function(a){var b=0,c=0,d=1;if(Blockly.utils.dom.containsNode(this.getCanvas(),a)||Blockly.utils.dom.containsNode(this.getBubbleCanvas(),a))d=this.scale;do{var e=Blockly.utils.getRelativeXY(a);if(a==this.getCanvas()||a==this.getBubbleCanvas())d=1;b+=e.x*d;c+=e.y*d;a=a.parentNode}while(a&&a!=this.getParentSvg());return new Blockly.utils.Coordinate(b,c)};Blockly.WorkspaceSvg.prototype.getOriginOffsetInPixels=function(){return Blockly.utils.getInjectionDivXY_(this.svgBlockCanvas_)};
|
|
Blockly.WorkspaceSvg.prototype.getInjectionDiv=function(){if(!this.injectionDiv_)for(var a=this.svgGroup_;a;){if(-1!=(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){this.injectionDiv_=a;break}a=a.parentNode}return this.injectionDiv_};Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper=function(a){this.resizeHandlerWrapper_=a};
|
|
Blockly.WorkspaceSvg.prototype.createDom=function(a){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyWorkspace"},null);a&&(this.svgBackground_=Blockly.utils.dom.createSvgElement("rect",{height:"100%",width:"100%","class":a},this.svgGroup_),"blocklyMainBackground"==a&&this.grid_&&(this.svgBackground_.style.fill="url(#"+this.grid_.getPatternId()+")"));this.svgBlockCanvas_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyBlockCanvas"},this.svgGroup_);this.svgBubbleCanvas_=
|
|
Blockly.utils.dom.createSvgElement("g",{"class":"blocklyBubbleCanvas"},this.svgGroup_);this.isFlyout||(Blockly.bindEventWithChecks_(this.svgGroup_,"mousedown",this,this.onMouseDown_,!1,!0),Blockly.bindEventWithChecks_(this.svgGroup_,"wheel",this,this.onMouseWheel_));this.options.hasCategories&&(this.toolbox_=new Blockly.Toolbox(this));this.grid_&&this.grid_.update(this.scale);this.recordDeleteAreas();return this.svgGroup_};
|
|
Blockly.WorkspaceSvg.prototype.dispose=function(){this.rendered=!1;this.currentGesture_&&this.currentGesture_.cancel();Blockly.WorkspaceSvg.superClass_.dispose.call(this);this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.svgBubbleCanvas_=this.svgBlockCanvas_=null;this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null);this.flyout_&&(this.flyout_.dispose(),this.flyout_=null);this.trashcan&&(this.trashcan.dispose(),this.trashcan=null);this.scrollbar&&(this.scrollbar.dispose(),
|
|
this.scrollbar=null);this.zoomControls_&&(this.zoomControls_.dispose(),this.zoomControls_=null);this.audioManager_&&(this.audioManager_.dispose(),this.audioManager_=null);this.grid_&&(this.grid_.dispose(),this.grid_=null);this.flyoutButtonCallbacks_=this.toolboxCategoryCallbacks_=this.connectionDBList=null;if(!this.options.parentWorkspace){var a=this.getParentSvg().parentNode;a&&Blockly.utils.dom.removeNode(a)}this.resizeHandlerWrapper_&&(Blockly.unbindEvent_(this.resizeHandlerWrapper_),this.resizeHandlerWrapper_=
|
|
null)};Blockly.WorkspaceSvg.prototype.newBlock=function(a,b){return new Blockly.BlockSvg(this,a,b)};Blockly.WorkspaceSvg.prototype.addTrashcan=function(){this.trashcan=new Blockly.Trashcan(this);var a=this.trashcan.createDom();this.svgGroup_.insertBefore(a,this.svgBlockCanvas_)};Blockly.WorkspaceSvg.prototype.addZoomControls=function(){this.zoomControls_=new Blockly.ZoomControls(this);var a=this.zoomControls_.createDom();this.svgGroup_.appendChild(a)};
|
|
Blockly.WorkspaceSvg.prototype.addFlyout_=function(a){var b={disabledPatternId:this.options.disabledPatternId,parentWorkspace:this,RTL:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,toolboxPosition:this.options.toolboxPosition};this.flyout_=this.horizontalLayout?new Blockly.HorizontalFlyout(b):new Blockly.VerticalFlyout(b);this.flyout_.autoClose=!1;return this.flyout_.createDom(a)};
|
|
Blockly.WorkspaceSvg.prototype.getFlyout=function(){return this.flyout_?this.flyout_:this.toolbox_?this.toolbox_.flyout_:null};Blockly.WorkspaceSvg.prototype.getToolbox=function(){return this.toolbox_};Blockly.WorkspaceSvg.prototype.updateScreenCalculations_=function(){this.updateInverseScreenCTM();this.recordDeleteAreas()};
|
|
Blockly.WorkspaceSvg.prototype.resizeContents=function(){if(this.resizesEnabled_&&this.rendered){if(this.scrollbar){var a=this.getMetrics();this.scrollbar.hScroll.resizeContentHorizontal(a);this.scrollbar.vScroll.resizeContentVertical(a)}this.updateInverseScreenCTM()}};
|
|
Blockly.WorkspaceSvg.prototype.resize=function(){this.toolbox_&&this.toolbox_.position();this.flyout_&&this.flyout_.position();this.trashcan&&this.trashcan.position();this.zoomControls_&&this.zoomControls_.position();this.scrollbar&&this.scrollbar.resize();this.updateScreenCalculations_()};
|
|
Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled=function(){var a=Blockly.utils.getDocumentScroll();Blockly.utils.Coordinate.equals(this.lastRecordedPageScroll_,a)||(this.lastRecordedPageScroll_=a,this.updateScreenCalculations_())};Blockly.WorkspaceSvg.prototype.getCanvas=function(){return this.svgBlockCanvas_};Blockly.WorkspaceSvg.prototype.getBubbleCanvas=function(){return this.svgBubbleCanvas_};
|
|
Blockly.WorkspaceSvg.prototype.getParentSvg=function(){if(this.cachedParentSvg_)return this.cachedParentSvg_;for(var a=this.svgGroup_;a;){if("svg"==a.tagName)return this.cachedParentSvg_=a;a=a.parentNode}return null};
|
|
Blockly.WorkspaceSvg.prototype.translate=function(a,b){if(this.useWorkspaceDragSurface_&&this.isDragSurfaceActive_)this.workspaceDragSurface_.translateSurface(a,b);else{var c="translate("+a+","+b+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",c);this.svgBubbleCanvas_.setAttribute("transform",c)}this.blockDragSurface_&&this.blockDragSurface_.translateAndScaleGroup(a,b,this.scale);this.grid_&&this.grid_.moveTo(a,b)};
|
|
Blockly.WorkspaceSvg.prototype.resetDragSurface=function(){if(this.useWorkspaceDragSurface_){this.isDragSurfaceActive_=!1;var a=this.workspaceDragSurface_.getSurfaceTranslation();this.workspaceDragSurface_.clearAndHide(this.svgGroup_);a="translate("+a.x+","+a.y+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",a);this.svgBubbleCanvas_.setAttribute("transform",a)}};
|
|
Blockly.WorkspaceSvg.prototype.setupDragSurface=function(){if(this.useWorkspaceDragSurface_&&!this.isDragSurfaceActive_){this.isDragSurfaceActive_=!0;var a=this.svgBlockCanvas_.previousSibling,b=parseInt(this.getParentSvg().getAttribute("width"),10),c=parseInt(this.getParentSvg().getAttribute("height"),10),d=Blockly.utils.getRelativeXY(this.svgBlockCanvas_);this.workspaceDragSurface_.setContentsAndShow(this.svgBlockCanvas_,this.svgBubbleCanvas_,a,b,c,this.scale);this.workspaceDragSurface_.translateSurface(d.x,
|
|
d.y)}};Blockly.WorkspaceSvg.prototype.getBlockDragSurface=function(){return this.blockDragSurface_};Blockly.WorkspaceSvg.prototype.getWidth=function(){var a=this.getMetrics();return a?a.viewWidth/this.scale:0};
|
|
Blockly.WorkspaceSvg.prototype.setVisible=function(a){this.scrollbar&&this.scrollbar.setContainerVisible(a);this.getFlyout()&&this.getFlyout().setContainerVisible(a);this.getParentSvg().style.display=a?"block":"none";this.toolbox_&&(this.toolbox_.HtmlDiv.style.display=a?"block":"none");a?(this.render(),this.resize()):(Blockly.hideChaff(!0),Blockly.DropDownDiv.hideWithoutAnimation());this.isVisible_=a};
|
|
Blockly.WorkspaceSvg.prototype.render=function(){for(var a=this.getAllBlocks(!1),b=a.length-1;0<=b;b--)a[b].render(!1);if(this.currentGesture_)for(a=this.currentGesture_.getInsertionMarkers(),b=0;b<a.length;b++)a[b].render(!1)};Blockly.WorkspaceSvg.prototype.traceOn=function(){console.warn("Deprecated call to traceOn, delete this.")};
|
|
Blockly.WorkspaceSvg.prototype.highlightBlock=function(a,b){if(void 0===b){for(var c=0,d;d=this.highlightedBlocks_[c];c++)d.setHighlightBlock(!1);this.highlightedBlocks_.length=0}if(d=a?this.getBlockById(a):null)(c=void 0===b||b)?-1==this.highlightedBlocks_.indexOf(d)&&this.highlightedBlocks_.push(d):Blockly.utils.arrayRemove(this.highlightedBlocks_,d),d.setHighlightBlock(c)};
|
|
Blockly.WorkspaceSvg.prototype.glowBlock=function(a,b){var c=null;if(a&&(c=this.getBlockById(a),!c))throw"Tried to glow block that does not exist.";c.setGlowBlock(b)};Blockly.WorkspaceSvg.prototype.glowStack=function(a,b){var c=null;if(a&&(c=this.getBlockById(a),!c))throw"Tried to glow stack on block that does not exist.";c.setGlowStack(b)};
|
|
Blockly.WorkspaceSvg.prototype.paste=function(a){this.rendered&&(this.currentGesture_&&this.currentGesture_.cancel(),"comment"==a.tagName.toLowerCase()?this.pasteWorkspaceComment_(a):this.pasteBlock_(a))};
|
|
Blockly.WorkspaceSvg.prototype.pasteBlock_=function(a){Blockly.Events.disable();try{var b=Blockly.Xml.domToBlock(a,this),c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);if(!isNaN(c)&&!isNaN(d)){this.RTL&&(c=-c);do{a=!1;for(var e=this.getAllBlocks(!1),f=0,g;g=e[f];f++){var h=g.getRelativeToSurfaceXY();if(1>=Math.abs(c-h.x)&&1>=Math.abs(d-h.y)){a=!0;break}}if(!a){var k=b.getConnections_(!1);f=0;for(var l;l=k[f];f++)if(l.closest(Blockly.SNAP_RADIUS,new Blockly.utils.Coordinate(c,
|
|
d)).connection){a=!0;break}}a&&(c=this.RTL?c-Blockly.SNAP_RADIUS:c+Blockly.SNAP_RADIUS,d+=2*Blockly.SNAP_RADIUS)}while(a);b.moveBy(c,d)}}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!b.isShadow()&&Blockly.Events.fire(new Blockly.Events.BlockCreate(b));b.select()};
|
|
Blockly.WorkspaceSvg.prototype.pasteWorkspaceComment_=function(a){Blockly.Events.disable();try{var b=Blockly.WorkspaceCommentSvg.fromXml(a,this),c=parseInt(a.getAttribute("x"),10),d=parseInt(a.getAttribute("y"),10);isNaN(c)||isNaN(d)||(this.RTL&&(c=-c),b.moveBy(c+50,d+50))}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&Blockly.WorkspaceComment.fireCreateEvent(b);b.select()};
|
|
Blockly.WorkspaceSvg.prototype.refreshToolboxSelection=function(){var a=this.isFlyout?this.targetWorkspace:this;a&&!a.currentGesture_&&a.toolbox_&&a.toolbox_.flyout_&&a.toolbox_.refreshSelection()};Blockly.WorkspaceSvg.prototype.renameVariableById=function(a,b){Blockly.WorkspaceSvg.superClass_.renameVariableById.call(this,a,b);this.refreshToolboxSelection()};Blockly.WorkspaceSvg.prototype.deleteVariableById=function(a){Blockly.WorkspaceSvg.superClass_.deleteVariableById.call(this,a);this.refreshToolboxSelection()};
|
|
Blockly.WorkspaceSvg.prototype.createVariable=function(a,b,c){a=Blockly.WorkspaceSvg.superClass_.createVariable.call(this,a,b,c);this.refreshToolboxSelection();return a};Blockly.WorkspaceSvg.prototype.recordDeleteAreas=function(){this.deleteAreaTrash_=this.trashcan&&this.svgGroup_.parentNode?this.trashcan.getClientRect():null;this.deleteAreaToolbox_=this.flyout_?this.flyout_.getClientRect():this.toolbox_?this.toolbox_.getClientRect():null};
|
|
Blockly.WorkspaceSvg.prototype.isDeleteArea=function(a){return this.deleteAreaTrash_&&this.deleteAreaTrash_.contains(a.clientX,a.clientY)?Blockly.DELETE_AREA_TRASH:this.deleteAreaToolbox_&&this.deleteAreaToolbox_.contains(a.clientX,a.clientY)?Blockly.DELETE_AREA_TOOLBOX:Blockly.DELETE_AREA_NONE};Blockly.WorkspaceSvg.prototype.onMouseDown_=function(a){var b=this.getGesture(a);b&&b.handleWsStart(a,this)};
|
|
Blockly.WorkspaceSvg.prototype.startDrag=function(a,b){var c=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM());c.x/=this.scale;c.y/=this.scale;this.dragDeltaXY_=Blockly.utils.Coordinate.difference(b,c)};Blockly.WorkspaceSvg.prototype.moveDrag=function(a){a=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM());a.x/=this.scale;a.y/=this.scale;return Blockly.utils.Coordinate.sum(this.dragDeltaXY_,a)};
|
|
Blockly.WorkspaceSvg.prototype.isDragging=function(){return null!=this.currentGesture_&&this.currentGesture_.isDragging()};Blockly.WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag};
|
|
Blockly.WorkspaceSvg.prototype.isContentBounded=function(){return this.options.moveOptions&&this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.controls||this.options.zoomOptions&&this.options.zoomOptions.wheel};
|
|
Blockly.WorkspaceSvg.prototype.isMovable=function(){return this.options.moveOptions&&this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel};
|
|
Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(a){if(Blockly.Gesture.inProgress())a.preventDefault(),a.stopPropagation();else{var b=this.options.zoomOptions&&this.options.zoomOptions.wheel,c=this.options.moveOptions&&this.options.moveOptions.wheel;if(b||c){var d=Blockly.utils.getScrollDeltaPixels(a);!b||!a.ctrlKey&&c?(b=this.scrollX-d.x,c=this.scrollY-d.y,a.shiftKey&&!d.x&&(b=this.scrollX-d.y,c=this.scrollY),this.scroll(b,c)):(d=-d.y/50,b=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM()),
|
|
this.zoom(b.x,b.y,d));a.ctrlKey||a.metaKey?(d=-a.deltaY/50,b=Blockly.utils.mouseToSvg(a,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(b.x,b.y,d)):(Blockly.WidgetDiv.hide(!0),Blockly.DropDownDiv.hideWithoutAnimation(),b=this.scrollX-a.deltaX,c=this.scrollY-a.deltaY,this.startDragMetrics=this.getMetrics(),this.scroll(b,c));a.preventDefault()}}};
|
|
Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var a=this.getTopBlocks(!1),b=this.getTopComments(!1);a=a.concat(b);if(!a.length)return new Blockly.utils.Rect(0,0,0,0);b=a[0].getBoundingRectangle();for(var c=1;c<a.length;c++){var d=a[c].getBoundingRectangle();d.top<b.top&&(b.top=d.top);d.bottom>b.bottom&&(b.bottom=d.bottom);d.left<b.left&&(b.left=d.left);d.right>b.right&&(b.right=d.right)}return b};
|
|
Blockly.WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1);Blockly.Events.setGroup(!0);for(var a=this.getTopBlocks(!0),b=0,c=0,d;d=a[c];c++)if(d.isMovable()){var e=d.getRelativeToSurfaceXY();d.moveBy(-e.x,b-e.y);d.snapToGrid();b=d.getRelativeToSurfaceXY().y+d.getHeightWidth().height+Blockly.BlockSvg.MIN_BLOCK_Y}Blockly.Events.setGroup(!1);this.setResizesEnabled(!0)};
|
|
Blockly.WorkspaceSvg.prototype.showContextMenu_=function(a){function b(){Blockly.Events.setGroup(e);var a=n.shift();a&&(a.workspace?(a.dispose(!1,!0),setTimeout(b,q)):b());Blockly.Events.setGroup(!1)}if(!this.options.readOnly&&!this.isFlyout){var c=[],d=this.getTopBlocks(!0),e=Blockly.utils.genUid(),f=this,g={};g.text=Blockly.Msg.UNDO;g.enabled=0<this.undoStack_.length;g.callback=this.undo.bind(this,!1);c.push(g);g={};g.text=Blockly.Msg.REDO;g.enabled=0<this.redoStack_.length;g.callback=this.undo.bind(this,
|
|
!0);c.push(g);this.options.comments&&c.push(Blockly.ContextMenu.workspaceCommentOption(f,a));this.isMovable()&&(g={},g.text=Blockly.Msg.CLEAN_UP,g.enabled=1<d.length,g.callback=this.cleanUp.bind(this),c.push(g));if(this.options.collapse){for(var h=g=!1,k=0;k<d.length;k++)for(var l=d[k];l;)l.isCollapsed()?g=!0:h=!0,l=l.getNextBlock();var m=function(a){for(var b=0,c=0;c<d.length;c++)for(var e=d[c];e;)setTimeout(e.setCollapsed.bind(e,a),b),e=e.getNextBlock(),b+=q};h={enabled:h};h.text=Blockly.Msg.COLLAPSE_ALL;
|
|
h.callback=function(){m(!0)};c.push(h);g={enabled:g};g.text=Blockly.Msg.EXPAND_ALL;g.callback=function(){m(!1)};c.push(g)}var n=Blockly.WorkspaceSvg.buildDeleteList_(d),p=0;for(k=0;k<n.length;k++)n[k].isShadow()||p++;var q=10;g={text:1==n.length?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(n.length)),enabled:0<n.length,callback:function(){f.currentGesture_&&f.currentGesture_.cancel();2>p?b():Blockly.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1",n.length),function(a){a&&
|
|
b()})}};c.push(g);this.configureContextMenu&&this.configureContextMenu(c);Blockly.ContextMenu.show(a,c,this.RTL)}};Blockly.WorkspaceSvg.buildDeleteList_=function(a){function b(a){if(a.isDeletable())c=c.concat(a.getDescendants());else{a=a.getChildren();for(var d=0;d<a.length;d++)b(a[d])}}for(var c=[],d=0;d<a.length;d++)b(a[d]);return c};
|
|
Blockly.WorkspaceSvg.prototype.updateToolbox=function(a){if(a=Blockly.Options.parseToolboxTree(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(a.getElementsByTagName("category").length){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=a;var b=this.toolbox_.populate_(a);b?this.toolbox_.tree_.setSelectedItem(b):this.toolbox_.flyout_.hide();b=this.toolbox_.populate_(a);this.toolbox_.addColour_();
|
|
this.toolbox_.position();this.toolbox_.tree_.setSelectedItem(b)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=a;this.flyout_.show(a.childNodes)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.");};Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(Blockly.mainWorkspace=this,this.setBrowserFocus())};
|
|
Blockly.WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur();try{this.getParentSvg().focus()}catch(a){try{this.getParentSvg().parentNode.setActive()}catch(b){this.getParentSvg().parentNode.focus()}}};
|
|
Blockly.WorkspaceSvg.prototype.zoom=function(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var d=this.scale*c;if(this.scale!=d){d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:d<this.options.zoomOptions.minScale&&(c=this.options.zoomOptions.minScale/this.scale);var e=this.getCanvas().getCTM(),f=this.getParentSvg().createSVGPoint();f.x=a;f.y=b;f=f.matrixTransform(e.inverse());a=f.x;b=f.y;e=e.translate(a*(1-c),b*(1-c)).scale(c);this.scrollX=e.e;this.scrollY=
|
|
e.f;this.setScale(d);Blockly.WidgetDiv.hide(!0);Blockly.DropDownDiv.hideWithoutAnimation()}};Blockly.WorkspaceSvg.prototype.zoomCenter=function(a){var b=this.getMetrics();if(this.flyout_){var c=b.svgWidth/2;b=b.svgHeight/2}else c=b.viewWidth/2+b.absoluteLeft,b=b.viewHeight/2+b.absoluteTop;this.zoom(c,b,a)};
|
|
Blockly.WorkspaceSvg.prototype.zoomToFit=function(){if(this.isMovable()){var a=this.getMetrics(),b=a.viewWidth;a=a.viewHeight;var c=this.getBlocksBoundingBox(),d=c.right-c.left;c=c.bottom-c.top;d&&(this.flyout_&&(this.horizontalLayout?(a+=this.flyout_.height_,c+=this.flyout_.height_/this.scale):(b+=this.flyout_.getWidth(),d+=this.flyout_.getWidth()/this.scale)),this.setScale(Math.min(b/d,a/c)),this.scrollCenter())}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")};
|
|
Blockly.WorkspaceSvg.prototype.beginCanvasTransition=function(){Blockly.utils.dom.addClass(this.svgBlockCanvas_,"blocklyCanvasTransitioning");Blockly.utils.dom.addClass(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")};Blockly.WorkspaceSvg.prototype.endCanvasTransition=function(){Blockly.utils.dom.removeClass(this.svgBlockCanvas_,"blocklyCanvasTransitioning");Blockly.utils.dom.removeClass(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")};
|
|
Blockly.WorkspaceSvg.prototype.scrollCenter=function(){if(this.isMovable()){var a=this.getMetrics(),b=(a.contentWidth-a.viewWidth)/2,c=(a.contentHeight-a.viewHeight)/2;b=-b-a.contentLeft;c=-c-a.contentTop;this.scroll(b,c)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")};
|
|
Blockly.WorkspaceSvg.prototype.centerOnBlock=function(a,b){if(this.isMovable()){var c=this.getBlockById(a);if(c){b&&Blockly.utils.dom.addClass(this.svgBlockCanvas_,"blocklyTransitioning");var d=c.getRelativeToSurfaceXY(),e=this.scale,f=(d.x+(this.RTL?-1:1)*c.width/2)*e;c=(d.y+c.height/2)*e;d=this.getMetrics();f=-(f-d.contentLeft-d.viewWidth/2)-d.contentLeft;c=-(c-d.contentTop-d.viewHeight/2)-d.contentTop;Blockly.hideChaff();this.scroll(f,c);var g=this.svgBlockCanvas_;setTimeout(function(){Blockly.utils.dom.removeClass(g,
|
|
"blocklyTransitioning")},Blockly.Colours.canvasTransitionLength)}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")};
|
|
Blockly.WorkspaceSvg.prototype.setScale=function(a){this.options.zoomOptions.maxScale&&a>this.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&a<this.options.zoomOptions.minScale&&(a=this.options.zoomOptions.minScale);this.scale=a;Blockly.hideChaff(!1);this.flyout_&&(this.flyout_.reflow(),this.recordDeleteAreas());this.grid_&&this.grid_.update(this.scale);a=this.getMetrics();this.scrollX-=a.absoluteLeft;this.scrollY-=a.absoluteTop;a.viewLeft+=a.absoluteLeft;
|
|
a.viewTop+=a.absoluteTop;this.scroll(this.scrollX,this.scrollY);this.scrollbar&&(this.flyout_?(this.scrollbar.hScroll.resizeViewHorizontal(a),this.scrollbar.vScroll.resizeViewVertical(a)):(this.scrollbar.hScroll.resizeContentHorizontal(a),this.scrollbar.vScroll.resizeContentVertical(a)))};
|
|
Blockly.WorkspaceSvg.prototype.scroll=function(a,b){Blockly.hideChaff(!0);var c=this.getMetrics(),d=c.contentWidth+c.contentLeft-c.viewWidth,e=c.contentHeight+c.contentTop-c.viewHeight;a=Math.min(a,-c.contentLeft);b=Math.min(b,-c.contentTop);a=Math.max(a,-d);b=Math.max(b,-e);this.scrollX=a;this.scrollY=b;this.scrollbar&&(this.scrollbar.hScroll.setHandlePosition(-(a+c.contentLeft)*this.scrollbar.hScroll.ratio_),this.scrollbar.vScroll.setHandlePosition(-(b+c.contentTop)*this.scrollbar.vScroll.ratio_));
|
|
a+=c.absoluteLeft;b+=c.absoluteTop;Blockly.WidgetDiv.hide(!0);Blockly.DropDownDiv.hideWithoutAnimation();this.translate(a,b)};Blockly.WorkspaceSvg.prototype.updateStackGlowScale_=function(){this.options.stackGlowBlur&&this.options.stackGlowBlur.setAttribute("stdDeviation",Blockly.STACK_GLOW_RADIUS/this.scale);this.options.selectedGlowBlur&&this.options.selectedGlowBlur.setAttribute("stdDeviation",Blockly.STACK_GLOW_RADIUS/this.scale)};
|
|
Blockly.WorkspaceSvg.getDimensionsPx_=function(a){var b=0,c=0;a&&(b=a.getWidth(),c=a.getHeight());return{width:b,height:c}};Blockly.WorkspaceSvg.getContentDimensions_=function(a,b){return a.isContentBounded()?Blockly.WorkspaceSvg.getContentDimensionsBounded_(a,b):Blockly.WorkspaceSvg.getContentDimensionsExact_(a)};
|
|
Blockly.WorkspaceSvg.getContentDimensionsExact_=function(a){var b=a.getBlocksBoundingBox(),c=a.scale;a=b.top*c;var d=b.bottom*c,e=b.left*c;b=b.right*c;return{top:a,bottom:d,left:e,right:b,width:b-e,height:d-a}};
|
|
Blockly.WorkspaceSvg.getContentDimensionsBounded_=function(a,b){var c=Blockly.WorkspaceSvg.getContentDimensionsExact_(a),d=b.width,e=b.height,f=d/2,g=e/2,h=Math.min(c.left-f,c.right-d),k=Math.min(c.top-g,c.bottom-e);return{left:h,top:k,height:Math.max(c.bottom+g,c.top+e)-k,width:Math.max(c.right+f,c.left+d)-h}};
|
|
Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_=function(){var a=Blockly.WorkspaceSvg.getDimensionsPx_(this.toolbox_),b=Blockly.WorkspaceSvg.getDimensionsPx_(this.flyout_),c=Blockly.svgSize(this.getParentSvg()),d={height:c.height,width:c.width};if(this.toolbox_)if(this.toolboxPosition==Blockly.TOOLBOX_AT_TOP||this.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM)d.height-=a.height;else{if(this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT||this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT)d.width-=a.width}else if(this.flyout_)if(this.toolboxPosition==
|
|
Blockly.TOOLBOX_AT_TOP||this.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM)d.height-=b.height;else if(this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT||this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT)d.width-=b.width;var e=Blockly.WorkspaceSvg.getContentDimensions_(this,d),f=0;this.toolbox_&&this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT?f=a.width:this.flyout_&&this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT&&(f=b.width);var g=0;this.toolbox_&&this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?g=a.height:this.flyout_&&
|
|
this.toolboxPosition==Blockly.TOOLBOX_AT_TOP&&(g=b.height);return{contentHeight:e.height,contentWidth:e.width,contentTop:e.top,contentLeft:e.left,viewHeight:d.height,viewWidth:d.width,viewTop:-this.scrollY,viewLeft:-this.scrollX,absoluteTop:g,absoluteLeft:f,svgHeight:c.height,svgWidth:c.width,toolboxWidth:a.width,toolboxHeight:a.height,flyoutWidth:b.width,flyoutHeight:b.height,toolboxPosition:this.toolboxPosition}};
|
|
Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_=function(a){var b=this.getMetrics();"number"==typeof a.x&&(this.scrollX=-b.contentWidth*a.x-b.contentLeft);"number"==typeof a.y&&(this.scrollY=-b.contentHeight*a.y-b.contentTop);this.translate(this.scrollX+b.absoluteLeft,this.scrollY+b.absoluteTop)};Blockly.WorkspaceSvg.prototype.setResizesEnabled=function(a){var b=!this.resizesEnabled_&&a;this.resizesEnabled_=a;b&&this.resizeContents()};
|
|
Blockly.WorkspaceSvg.prototype.clear=function(){this.setResizesEnabled(!1);Blockly.WorkspaceSvg.superClass_.clear.call(this);this.setResizesEnabled(!0)};Blockly.WorkspaceSvg.prototype.registerButtonCallback=function(a,b){if("function"!=typeof b)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks_[a]=b};Blockly.WorkspaceSvg.prototype.getButtonCallback=function(a){return(a=this.flyoutButtonCallbacks_[a])?a:null};
|
|
Blockly.WorkspaceSvg.prototype.removeButtonCallback=function(a){this.flyoutButtonCallbacks_[a]=null};Blockly.WorkspaceSvg.prototype.registerToolboxCategoryCallback=function(a,b){if("function"!=typeof b)throw TypeError("Toolbox category callbacks must be functions.");this.toolboxCategoryCallbacks_[a]=b};Blockly.WorkspaceSvg.prototype.getToolboxCategoryCallback=function(a){return this.toolboxCategoryCallbacks_[a]||null};
|
|
Blockly.WorkspaceSvg.prototype.removeToolboxCategoryCallback=function(a){this.toolboxCategoryCallbacks_[a]=null};Blockly.WorkspaceSvg.prototype.getGesture=function(a){var b="mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type,c=this.currentGesture_;return c?b&&c.hasStarted()?(console.warn("Tried to start the same gesture twice."),c.cancel(),null):c:b?this.currentGesture_=new Blockly.TouchGesture(a,this):null};
|
|
Blockly.WorkspaceSvg.prototype.clearGesture=function(){this.currentGesture_=null};Blockly.WorkspaceSvg.prototype.cancelCurrentGesture=function(){this.currentGesture_&&this.currentGesture_.cancel()};Blockly.WorkspaceSvg.prototype.startDragWithFakeEvent=function(a,b){Blockly.Touch.clearTouchIdentifier();Blockly.Touch.checkTouchIdentifier(a);b.workspace.getGesture(a).forceStartBlockDrag(a,b)};Blockly.WorkspaceSvg.prototype.getAudioManager=function(){return this.audioManager_};
|
|
Blockly.WorkspaceSvg.prototype.getGrid=function(){return this.grid_};Blockly.WorkspaceSvg.prototype.getMetrics=function(){console.warn("WorkspaceSvg getOptions should be overriden by constructor")};Blockly.WorkspaceSvg.prototype.setVisible=Blockly.WorkspaceSvg.prototype.setVisible;Blockly.Mutator=function(a){Blockly.Mutator.superClass_.constructor.call(this,null);this.quarkNames_=a};goog.inherits(Blockly.Mutator,Blockly.Icon);Blockly.Mutator.prototype.workspaceWidth_=0;Blockly.Mutator.prototype.workspaceHeight_=0;
|
|
Blockly.Mutator.prototype.drawIcon_=function(a){Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconShape",rx:"10",ry:"10",height:"16",width:"16"},a);Blockly.utils.dom.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a);
|
|
Blockly.utils.dom.createSvgElement("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};Blockly.Mutator.prototype.iconClick_=function(a){this.block_.isEditable()&&Blockly.Icon.prototype.iconClick_.call(this,a)};
|
|
Blockly.Mutator.prototype.createEditor_=function(){this.svgDialog_=Blockly.utils.dom.createSvgElement("svg",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null);if(this.quarkNames_.length)for(var a=Blockly.utils.xml.createElement("xml"),b=0,c;c=this.quarkNames_[b];b++){var d=Blockly.utils.xml.createElement("block");d.setAttribute("type",c);a.appendChild(d)}else a=null;a={disable:!1,disabledPatternId:this.block_.workspace.options.disabledPatternId,languageTree:a,parentWorkspace:this.block_.workspace,
|
|
pathToMedia:this.block_.workspace.options.pathToMedia,RTL:this.block_.RTL,toolboxPosition:this.block_.RTL?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,horizontalLayout:!1,getMetrics:this.getFlyoutMetrics_.bind(this),setMetrics:null};this.workspace_=new Blockly.WorkspaceSvg(a,this.block_.workspace.dragSurface);this.workspace_.isMutator=!0;this.workspace_.addChangeListener(Blockly.Events.disableOrphans);a=this.workspace_.addFlyout_("g");b=this.workspace_.createDom("blocklyMutatorBackground");b.insertBefore(a,
|
|
this.workspace_.svgBlockCanvas_);this.svgDialog_.appendChild(b);return this.svgDialog_};Blockly.Mutator.prototype.updateEditable=function(){this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&Blockly.utils.dom.removeClass(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&Blockly.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly")));Blockly.Icon.prototype.updateEditable.call(this)};
|
|
Blockly.Mutator.prototype.resizeBubble_=function(){var a=2*Blockly.Bubble.BORDER_WIDTH,b=this.workspace_.getCanvas().getBBox();var c=this.block_.RTL?-b.x:b.width+b.x;b=b.height+3*a;if(this.workspace_.flyout_){var d=this.workspace_.flyout_.getMetrics_();b=Math.max(b,d.contentHeight+20)}c+=3*a;if(Math.abs(this.workspaceWidth_-c)>a||Math.abs(this.workspaceHeight_-b)>a)this.workspaceWidth_=c,this.workspaceHeight_=b,this.bubble_.setBubbleSize(c+a,b+a),this.svgDialog_.setAttribute("width",this.workspaceWidth_),
|
|
this.svgDialog_.setAttribute("height",this.workspaceHeight_);this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a));this.workspace_.resize()};
|
|
Blockly.Mutator.prototype.setVisible=function(a){if(a!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"mutatorOpen",!a,a)),a){this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svgPath_,this.iconXY_,null,null);this.bubble_.setSvgId(this.block_.id);if(a=this.workspace_.options.languageTree)this.workspace_.flyout_.init(this.workspace_),this.workspace_.flyout_.show(a.childNodes);this.rootBlock_=this.block_.decompose(this.workspace_);a=this.rootBlock_.getDescendants(!1);
|
|
for(var b=0,c;c=a[b];b++)c.render();this.rootBlock_.setMovable(!1);this.rootBlock_.setDeletable(!1);this.workspace_.flyout_?(a=2*this.workspace_.flyout_.CORNER_RADIUS,b=this.workspace_.getFlyout().getWidth()+a):b=a=16;this.block_.RTL&&(b=-b);this.rootBlock_.moveBy(b,a);if(this.block_.saveConnections){var d=this;this.block_.saveConnections(this.rootBlock_);this.sourceListener_=function(){d.block_.saveConnections(d.rootBlock_)};this.block_.workspace.addChangeListener(this.sourceListener_)}this.resizeBubble_();
|
|
this.workspace_.addChangeListener(this.workspaceChanged_.bind(this));this.updateColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)};
|
|
Blockly.Mutator.prototype.workspaceChanged_=function(a){if(a.type!=Blockly.Events.UI&&(a.type!=Blockly.Events.CHANGE||"disabled"!=a.element)){if(!this.workspace_.isDragging()){a=this.workspace_.getTopBlocks(!1);for(var b=0,c;c=a[b];b++){var d=c.getRelativeToSurfaceXY(),e=c.getHeightWidth();20>d.y+e.height&&c.moveBy(0,20-e.height-d.y)}}if(this.rootBlock_.workspace==this.workspace_){Blockly.Events.setGroup(!0);c=this.block_;a=(a=c.mutationToDom())&&Blockly.Xml.domToText(a);b=c.rendered;c.rendered=!1;
|
|
c.compose(this.rootBlock_);c.rendered=b;c.initSvg();b=(b=c.mutationToDom())&&Blockly.Xml.domToText(b);if(a!=b){Blockly.Events.fire(new Blockly.Events.BlockChange(c,"mutation",null,a,b));var f=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(f);c.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)}c.rendered&&c.render();this.workspace_.isDragging()||this.resizeBubble_();Blockly.Events.setGroup(!1)}}};
|
|
Blockly.Mutator.prototype.getFlyoutMetrics_=function(){return{viewHeight:this.workspaceHeight_,viewWidth:this.workspaceWidth_-this.workspace_.getFlyout().getWidth(),absoluteTop:0,absoluteLeft:this.workspace_.RTL?0:this.workspace_.getFlyout().getWidth()}};Blockly.Mutator.prototype.dispose=function(){this.block_.mutator=null;Blockly.Icon.prototype.dispose.call(this)};
|
|
Blockly.Mutator.prototype.updateBlockStyle=function(){var a=this.workspace_;if(a&&a.getAllBlocks()){for(var b=a.getAllBlocks(),c=0;c<b.length;c++){var d=b[c];d.setStyle(d.getStyleName())}a=a.flyout_.workspace_.getAllBlocks();for(c=0;c<a.length;c++)d=a[c],d.setStyle(d.getStyleName())}};
|
|
Blockly.Mutator.reconnect=function(a,b,c){if(!a||!a.getSourceBlock().workspace)return!1;c=b.getInput(c).connection;var d=a.targetBlock();return d&&d!=b||c.targetConnection==a?!1:(c.isConnected()&&c.disconnect(),c.connect(a),!0)};Blockly.Mutator.findParentWs=function(a){var b=null;if(a&&a.options){var c=a.options.parentWorkspace;a.isFlyout?c&&c.options&&(b=c.options.parentWorkspace):c&&(b=c)}return b};Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={});
|
|
Blockly.utils.global.Blockly.Mutator||(Blockly.utils.global.Blockly.Mutator={});Blockly.utils.global.Blockly.Mutator.reconnect=Blockly.Mutator.reconnect;Blockly.Extensions={};Blockly.Extensions.ALL_={};Blockly.Extensions.register=function(a,b){if("string"!=typeof a||""==a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(Blockly.Extensions.ALL_[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!=typeof b)throw Error('Error: Extension "'+a+'" must be a function');Blockly.Extensions.ALL_[a]=b};
|
|
Blockly.Extensions.registerMixin=function(a,b){if(!b||"object"!=typeof b)throw Error('Error: Mixin "'+a+'" must be a object');Blockly.Extensions.register(a,function(){this.mixin(b)})};
|
|
Blockly.Extensions.registerMutator=function(a,b,c,d){var e='Error when registering mutator "'+a+'": ';Blockly.Extensions.checkHasFunction_(e,b.domToMutation,"domToMutation");Blockly.Extensions.checkHasFunction_(e,b.mutationToDom,"mutationToDom");var f=Blockly.Extensions.checkMutatorDialog_(b,e);if(c&&"function"!=typeof c)throw Error('Extension "'+a+'" is not a function');Blockly.Extensions.register(a,function(){f&&this.setMutator(new Blockly.Mutator(d));this.mixin(b);c&&c.apply(this)})};
|
|
Blockly.Extensions.apply=function(a,b,c){var d=Blockly.Extensions.ALL_[a];if("function"!=typeof d)throw Error('Error: Extension "'+a+'" not found.');if(c)Blockly.Extensions.checkNoMutatorProperties_(a,b);else var e=Blockly.Extensions.getMutatorProperties_(b);d.apply(b);if(c)Blockly.Extensions.checkBlockHasMutatorProperties_('Error after applying mutator "'+a+'": ',b);else if(!Blockly.Extensions.mutatorPropertiesMatch_(e,b))throw Error('Error when applying extension "'+a+'": mutation properties changed when applying a non-mutator extension.');
|
|
};Blockly.Extensions.checkHasFunction_=function(a,b,c){if(!b)throw Error(a+'missing required property "'+c+'"');if("function"!=typeof b)throw Error(a+'" required property "'+c+'" must be a function');};Blockly.Extensions.checkNoMutatorProperties_=function(a,b){if(Blockly.Extensions.getMutatorProperties_(b).length)throw Error('Error: tried to apply mutation "'+a+'" to a block that already has mutator functions. Block id: '+b.id);};
|
|
Blockly.Extensions.checkMutatorDialog_=function(a,b){var c=void 0!==a.compose,d=void 0!==a.decompose;if(c&&d){if("function"!=typeof a.compose)throw Error(b+"compose must be a function.");if("function"!=typeof a.decompose)throw Error(b+"decompose must be a function.");return!0}if(c||d)throw Error(b+'Must have both or neither of "compose" and "decompose"');return!1};
|
|
Blockly.Extensions.checkBlockHasMutatorProperties_=function(a,b){if("function"!=typeof b.domToMutation)throw Error(a+'Applying a mutator didn\'t add "domToMutation"');if("function"!=typeof b.mutationToDom)throw Error(a+'Applying a mutator didn\'t add "mutationToDom"');Blockly.Extensions.checkMutatorDialog_(b,a)};
|
|
Blockly.Extensions.getMutatorProperties_=function(a){var b=[];void 0!==a.domToMutation&&b.push(a.domToMutation);void 0!==a.mutationToDom&&b.push(a.mutationToDom);void 0!==a.compose&&b.push(a.compose);void 0!==a.decompose&&b.push(a.decompose);return b};Blockly.Extensions.mutatorPropertiesMatch_=function(a,b){var c=Blockly.Extensions.getMutatorProperties_(b);if(c.length!=a.length)return!1;for(var d=0;d<c.length;d++)if(a[d]!=c[d])return!1;return!0};
|
|
Blockly.Extensions.buildTooltipForDropdown=function(a,b){var c=[];"object"==typeof document&&Blockly.utils.runAfterPageLoad(function(){for(var a in b)Blockly.utils.checkMessageReferences(b[a])});return function(){this.type&&-1===c.indexOf(this.type)&&(Blockly.Extensions.checkDropdownOptionsInTable_(this,a,b),c.push(this.type));this.setTooltip(function(){var d=this.getFieldValue(a),e=b[d];null==e?-1===c.indexOf(this.type)&&(d="No tooltip mapping for value "+d+" of field "+a,null!=this.type&&(d+=" of block type "+
|
|
this.type),console.warn(d+".")):e=Blockly.utils.replaceMessageReferences(e);return e}.bind(this))}};Blockly.Extensions.checkDropdownOptionsInTable_=function(a,b,c){var d=a.getField(b);if(!d.isOptionListDynamic()){d=d.getOptions();for(var e=0;e<d.length;++e){var f=d[e][1];null==c[f]&&console.warn("No tooltip mapping for value "+f+" of field "+b+" of block type "+a.type)}}};
|
|
Blockly.Extensions.buildTooltipWithFieldText=function(a,b){"object"==typeof document&&Blockly.utils.runAfterPageLoad(function(){Blockly.utils.checkMessageReferences(a)});return function(){this.setTooltip(function(){var c=this.getField(b);return Blockly.utils.replaceMessageReferences(a).replace("%1",c?c.getText():"")}.bind(this))}};
|
|
Blockly.Extensions.extensionParentTooltip_=function(){this.tooltipWhenNotConnected_=this.tooltip;this.setTooltip(function(){var a=this.getParent();return a&&a.getInputsInline()&&a.tooltip||this.tooltipWhenNotConnected_}.bind(this))};Blockly.Extensions.register("parent_tooltip_when_inline",Blockly.Extensions.extensionParentTooltip_);Blockly.Field=function(a,b){this.size_=new goog.math.Size(Blockly.BlockSvg.FIELD_WIDTH,Blockly.BlockSvg.FIELD_HEIGHT);this.setValue(a);this.setValidator(b);this.maxDisplayLength=Blockly.BlockSvg.MAX_DISPLAY_LENGTH};Blockly.Field.TYPE_MAP_={};Blockly.Field.register=function(a,b){if("string"!=typeof a||""==a.trim())throw Error('Invalid field type "'+a+'"');if(!b||"function"!=typeof b.fromJson)throw Error('Field "'+b+'" must have a fromJson function');Blockly.Field.TYPE_MAP_[a]=b};
|
|
Blockly.Field.fromJson=function(a){var b=Blockly.Field.TYPE_MAP_[a.type];return b?b.fromJson(a):null};Blockly.Field.cacheWidths_=null;Blockly.Field.cacheReference_=0;Blockly.Field.prototype.name=void 0;Blockly.Field.prototype.className_="blocklyText";Blockly.Field.prototype.disposed=!1;Blockly.Field.prototype.maxDisplayLength=50;Blockly.Field.prototype.value_=null;Blockly.Field.prototype.text_="";Blockly.Field.prototype.tooltip_=null;Blockly.Field.prototype.sourceBlock_=null;
|
|
Blockly.Field.prototype.isDirty_=!0;Blockly.Field.prototype.visible_=!0;Blockly.Field.prototype.argType_=null;Blockly.Field.prototype.validator_=null;Blockly.Field.prototype.arrow_=null;Blockly.Field.prototype.box_=null;Blockly.Field.prototype.arrowWidth_=0;Blockly.Field.prototype.size_=null;Blockly.Field.prototype.fieldGroup_=null;Blockly.Field.prototype.clickTarget_=null;Blockly.Field.NBSP="\u00a0";Blockly.Field.IE_TEXT_OFFSET="0.3em";Blockly.Field.prototype.EDITABLE=!0;
|
|
Blockly.Field.prototype.SERIALIZABLE=!1;Blockly.Field.prototype.setSourceBlock=function(a){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=a};Blockly.Field.prototype.getSourceBlock=function(){return this.sourceBlock_};
|
|
Blockly.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.utils.dom.createSvgElement("g",{},null),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.setDataAttribute_(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.size_.width=0,this.initModel())};Blockly.Field.prototype.initView=function(){this.createTextElement_()};
|
|
Blockly.Field.prototype.createBorderRect_=function(){this.borderRect_=Blockly.utils.dom.createSvgElement("rect",{rx:4,ry:4,x:-Blockly.BlockSvg.SEP_SPACE_X/4,y:0,height:24,width:this.size_.width+Blockly.BlockSvg.SEP_SPACE_X},this.fieldGroup_)};
|
|
Blockly.Field.prototype.createTextElement_=function(){this.textElement_=Blockly.utils.dom.createSvgElement("text",{"class":this.className_,x:this.sourceBlock_.RTL?-this.size_.width/2:this.size_.width/2,y:this.size_.height/2+Blockly.BlockSvg.FIELD_TOP_PADDING,dy:Blockly.utils.userAgent.EDGE_OR_IE?Blockly.Field.IE_TEXT_OFFSET:"0","text-anchor":"middle"},this.fieldGroup_);this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)};
|
|
Blockly.Field.prototype.setDataAttribute_=function(){null!==this.getArgTypes()&&(this.sourceBlock_.isShadow()?this.sourceBlock_.svgGroup_.setAttribute("data-argument-type",this.getArgTypes()):this.fieldGroup_.setAttribute("data-argument-type",this.getArgTypes()))};Blockly.Field.prototype.bindEvents_=function(){Blockly.Tooltip.bindMouseEvents(this.getClickTarget_());this.mouseDownWrapper_=Blockly.bindEventWithChecks_(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)};
|
|
Blockly.Field.prototype.initModel=function(){};Blockly.Field.prototype.fromXml=function(a){this.setValue(a.textContent)};Blockly.Field.prototype.toXml=function(a){a.textContent=this.getValue();return a};Blockly.Field.prototype.dispose=function(){Blockly.DropDownDiv.hideIfOwner(this);Blockly.WidgetDiv.hideIfOwner(this);this.mouseDownWrapper_&&Blockly.unbindEvent_(this.mouseDownWrapper_);Blockly.utils.dom.removeNode(this.fieldGroup_);this.disposed=!0};
|
|
Blockly.Field.prototype.updateEditable=function(){var a=this.fieldGroup_;this.EDITABLE&&a&&(this.sourceBlock_.isEditable()?(Blockly.utils.dom.addClass(a,"blocklyEditableText"),Blockly.utils.dom.removeClass(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(Blockly.utils.dom.addClass(a,"blocklyNonEditableText"),Blockly.utils.dom.removeClass(a,"blocklyEditableText"),a.style.cursor=""))};
|
|
Blockly.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"===typeof this.showEditor_};Blockly.Field.prototype.isCurrentlyEditable=function(){return this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()};
|
|
Blockly.Field.prototype.isSerializable=function(){var a=!1;this.name&&(this.SERIALIZABLE?a=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),a=!0));return a};Blockly.Field.prototype.isVisible=function(){return this.visible_};
|
|
Blockly.Field.prototype.setVisible=function(a){if(this.visible_!=a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")}};Blockly.Field.prototype.addArgType=function(a){null==this.argType_&&(this.argType_=[]);this.argType_.push(a)};Blockly.Field.prototype.getArgTypes=function(){return null===this.argType_||0===this.argType_.length?null:this.argType_.join(" ")};Blockly.Field.prototype.setValidator=function(a){this.validator_=a};Blockly.Field.prototype.getValidator=function(){return this.validator_};
|
|
Blockly.Field.prototype.classValidator=function(a){return a};Blockly.Field.prototype.callValidator=function(a){var b=this.classValidator(a);if(null===b)return null;void 0!==b&&(a=b);if(b=this.getValidator()){b=b.call(this,a);if(null===b)return null;void 0!==b&&(a=b)}return a};Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_};Blockly.Field.prototype.updateColour=function(){};
|
|
Blockly.Field.prototype.render_=function(){if(this.visible_&&this.textElement_){this.textElement_.textContent=this.getDisplayText_();this.updateSize_();var a=this.leftMargin_||0,b=(this.size_.width+a-this.arrowWidth_)/2;this.sourceBlock_.RTL&&(b+=this.arrowWidth_,b-=a);this.sourceBlock_.isShadow()&&!this.positionArrow&&(a=Blockly.BlockSvg.FIELD_WIDTH/2,b=this.sourceBlock_.RTL?Math.min(this.size_.width-a,b):Math.max(a,b));this.textElement_.setAttribute("x",b)}this.box_&&(this.box_.setAttribute("width",
|
|
this.size_.width),this.box_.setAttribute("height",this.size_.height))};Blockly.Field.prototype.updateWidth=function(){console.warn("Deprecated call to updateWidth, call Blockly.Field.updateSize_ to force an update to the size of the field, or Blockly.Field.getCachedWidth() to check the size of the field.");this.updateSize_()};
|
|
Blockly.Field.prototype.updateSize_=function(){var a=Blockly.Field.getCachedWidth(this.textElement_);this.EDITABLE&&(a+=Blockly.BlockSvg.EDITABLE_FIELD_PADDING);this.leftMargin_=0;this.positionLeft&&(this.leftMargin_=this.positionLeft(a),a+=this.leftMargin_);this.arrowWidth_=0;this.positionArrow&&(this.arrowWidth_=this.positionArrow(a),a+=this.arrowWidth_);this.box_&&(a+=2*Blockly.BlockSvg.BOX_FIELD_PADDING);this.size_.width=a};
|
|
Blockly.Field.getCachedWidth=function(a){var b=a.textContent+"\n"+a.className.baseVal,c;if(Blockly.Field.cacheWidths_&&(c=Blockly.Field.cacheWidths_[b]))return c;try{c=Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE?a.getBBox().width:a.getComputedTextLength()}catch(d){return 8*a.textContent.length}Blockly.Field.cacheWidths_&&(Blockly.Field.cacheWidths_[b]=c);return c};
|
|
Blockly.Field.startCache=function(){Blockly.Field.cacheReference_++;Blockly.Field.cacheWidths_||(Blockly.Field.cacheWidths_={})};Blockly.Field.stopCache=function(){Blockly.Field.cacheReference_--;Blockly.Field.cacheReference_||(Blockly.Field.cacheWidths_=null)};
|
|
Blockly.Field.prototype.getSize=function(){if(!this.isVisible())return new goog.math.Size(0,0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&!this.sourceBlock_.isInsertionMarker_&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_());return this.size_};
|
|
Blockly.Field.prototype.getScaledBBox_=function(){var a=this.getSize(),b=a.height*this.sourceBlock_.workspace.scale;a=a.width*this.sourceBlock_.workspace.scale;var c=this.getAbsoluteXY_();return{top:c.y,bottom:c.y+b,left:c.x,right:c.x+a}};Blockly.Field.prototype.getDisplayText_=function(){var a=this.text_;if(!a)return Blockly.Field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Blockly.Field.NBSP);this.sourceBlock_.RTL&&(a+="\u200f");return a};
|
|
Blockly.Field.prototype.getText=function(){return this.text_};Blockly.Field.prototype.setText=function(a){null!==a&&(a=String(a),a!==this.text_&&(this.text_=a,this.forceRerender()))};Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())};
|
|
Blockly.Field.prototype.updateTextNode_=function(){if(this.textElement_){var a=this.text_;a.length>this.maxDisplayLength?(a=a.substring(0,this.maxDisplayLength-2)+"\u2026",this.textElement_.setAttribute("class",this.className_+" blocklyTextTruncated")):this.textElement_.setAttribute("class",this.className_);goog.dom.removeChildren(this.textElement_);a=a.replace(/\s/g,Blockly.Field.NBSP);this.sourceBlock_.RTL&&a&&(a+="\u200f");a||(a=Blockly.Field.NBSP);a=document.createTextNode(a);this.textElement_.appendChild(a);
|
|
this.size_.width=0}};Blockly.Field.prototype.setValue=function(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.getValue();b!==a&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,b,a)),this.doValueUpdate_(a),this.isDirty_&&this.forceRerender())}}};
|
|
Blockly.Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};Blockly.Field.prototype.getValue=function(){return this.value_};Blockly.Field.prototype.doClassValidation_=function(a){return a=this.classValidator(a)};Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0;this.text_=String(a)};Blockly.Field.prototype.doValueInvalid_=function(a){};
|
|
Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)};Blockly.Field.prototype.setTooltip=function(a){var b=this.getClickTarget_();b?b.tooltip=a||""===a?a:this.sourceBlock_:this.tooltip_=a};
|
|
Blockly.Field.prototype.getClickTarget_=function(){if(this.clickTarget_)return this.clickTarget_;for(var a=0,b=0,c=0,d;d=this.sourceBlock_.inputList[c];c++){for(var e=0,f;f=d.fieldRow[e];e++)f instanceof Blockly.FieldLabel||a++;d.connection&&b++}return this.clickTarget_=1>=a&&this.sourceBlock_.outputConnection&&!b?this.sourceBlock_.getSvgRoot():this.getSvgRoot()};Blockly.Field.prototype.getTotalFields_=function(){for(var a=0,b=0,c;c=this.sourceBlock_.inputList[b];b++)a+=c.fieldRow.length;return a};
|
|
Blockly.Field.prototype.getAbsoluteXY_=function(){return goog.style.getPageOffset(this.getClickTarget_())};Blockly.Field.prototype.showEditor_=function(a){console.warn("Field should override showEditor_",a)};Blockly.Field.prototype.referencesVariables=function(){return!1};Blockly.FieldLabel=function(a,b){this.size_=new goog.math.Size(0,0);this.class_=b;a=this.doClassValidation_(a);null===a&&(a="");this.setValue(a)};goog.inherits(Blockly.FieldLabel,Blockly.Field);Blockly.FieldLabel.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabel(b,a["class"])};Blockly.FieldLabel.prototype.EDITABLE=!1;Blockly.FieldLabel.prototype.bindEvents_=function(){};
|
|
Blockly.FieldLabel.prototype.initView=function(){this.createTextElement_();this.textElement_.setAttribute("y",Blockly.BlockSvg.FIELD_TOP_PADDING);this.class_&&Blockly.utils.dom.addClass(this.textElement_,this.class_)};Blockly.FieldLabel.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};Blockly.Field.register("field_label",Blockly.FieldLabel);Blockly.FieldLabelHover=function(a,b){Blockly.FieldLabelHover.superClass_.constructor.call(this,a,b);this.arrowWidth_=0};goog.inherits(Blockly.FieldLabelHover,Blockly.FieldLabel);
|
|
Blockly.FieldLabelHover.prototype.init=function(){this.fieldGroup_||(Blockly.FieldLabelHover.superClass_.init.call(this),this.sourceBlock_.isEditable()&&(this.mouseOverWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_),this.mouseOutWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_)))};Blockly.FieldLabelHover.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabelHover(b,a["class"])};
|
|
Blockly.FieldLabelHover.prototype.EDITABLE=!1;Blockly.FieldLabelHover.prototype.SERIALIZABLE=!0;Blockly.FieldLabelHover.prototype.updateWidth=function(){this.size_.width=Blockly.Field.getCachedWidth(this.textElement_)};
|
|
Blockly.FieldLabelHover.prototype.render_=function(){if(this.visible_&&this.textElement_){goog.dom.removeChildren(this.textElement_);var a=document.createTextNode(this.getDisplayText_());this.textElement_.appendChild(a);this.updateWidth();a=this.size_.width/2;var b=Blockly.BlockSvg.FIELD_WIDTH/2;a=this.sourceBlock_.RTL?Math.min(this.size_.width-b,a):Math.max(b,a);this.textElement_.setAttribute("x",a)}};
|
|
Blockly.FieldLabelHover.prototype.onMouseOver_=function(a){!this.sourceBlock_.isInFlyout&&this.sourceBlock_.isShadow()&&(a=this.sourceBlock_.workspace.getGesture(a),a&&a.isDragging()||!this.sourceBlock_.svgPath_||(Blockly.utils.dom.addClass(this.sourceBlock_.svgPath_,"blocklyFieldHover"),this.sourceBlock_.svgPath_.style.strokeDasharray="2"))};
|
|
Blockly.FieldLabelHover.prototype.clearHover=function(){this.sourceBlock_.svgPath_&&(Blockly.utils.dom.removeClass(this.sourceBlock_.svgPath_,"blocklyFieldHover"),this.sourceBlock_.svgPath_.style.strokeDasharray="")};Blockly.FieldLabelHover.prototype.onMouseOut_=function(a){!this.sourceBlock_.isInFlyout&&this.sourceBlock_.isShadow()&&((a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||this.clearHover())};
|
|
Blockly.FieldLabelHover.dispose=function(){this.mouseOverWrapper_&&(Blockly.unbindEvent_(this.mouseOverWrapper_),this.mouseOverWrapper_=null);this.mouseOutWrapper_&&(Blockly.unbindEvent_(this.mouseOutWrapper_),this.mouseOutWrapper_=null);Blockly.FieldLabelHover.superClass_.dispose.call(this);this.variableMap_=this.workspace_=null};Blockly.Field.register("field_label_hover",Blockly.FieldLabelHover);Blockly.FieldVariableGetter=function(a,b,c,d){this.size_=new goog.math.Size(Blockly.BlockSvg.FIELD_WIDTH,Blockly.BlockSvg.FIELD_HEIGHT);this.setValidator(b);this.defaultVariableName=a||"";this.setTypes_(c,d);this.value_=null};goog.inherits(Blockly.FieldVariableGetter,Blockly.Field);Blockly.FieldVariableGetter.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariableGetter(b,null,a.variableTypes,a.defaultType)};
|
|
Blockly.FieldVariableGetter.prototype.workspace_=null;Blockly.FieldVariableGetter.prototype.CURSOR="copy";Blockly.FieldVariableGetter.prototype.EDITABLE=!1;Blockly.FieldVariableGetter.prototype.SERIALIZABLE=!0;
|
|
Blockly.FieldVariableGetter.prototype.init=function(){this.fieldGroup_||(Blockly.FieldVariableGetter.superClass_.init.call(this),this.initModel(),this.sourceBlock_.isEditable()&&(this.mouseOverWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_),this.mouseOutWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_)))};
|
|
Blockly.FieldVariableGetter.prototype.initModel=function(){if(!this.variable_){this.workspace_=this.sourceBlock_.workspace;var a=Blockly.Variables.getOrCreateVariablePackage(this.workspace_,null,this.defaultVariableName,this.defaultType_);Blockly.Events.disable();try{this.setValue(a.getId())}finally{Blockly.Events.enable()}}};
|
|
Blockly.FieldVariableGetter.prototype.onMouseOver_=function(a){this.sourceBlock_.isInFlyout||(a=this.sourceBlock_.workspace.getGesture(a),a&&a.isDragging()||!this.sourceBlock_.svgPath_||(Blockly.utils.dom.addClass(this.sourceBlock_.svgPath_,"blocklyFieldHover"),this.sourceBlock_.svgPath_.style.strokeDasharray="2"))};
|
|
Blockly.FieldVariableGetter.prototype.clearHover=function(){this.sourceBlock_.svgPath_&&(Blockly.utils.dom.removeClass(this.sourceBlock_.svgPath_,"blocklyFieldHover"),this.sourceBlock_.svgPath_.style.strokeDasharray="")};Blockly.FieldVariableGetter.prototype.onMouseOut_=function(a){this.sourceBlock_.isInFlyout||(a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||this.clearHover()};
|
|
Blockly.FieldVariableGetter.dispose=function(){this.mouseOverWrapper_&&(Blockly.unbindEvent_(this.mouseOverWrapper_),this.mouseOverWrapper_=null);this.mouseOutWrapper_&&(Blockly.unbindEvent_(this.mouseOutWrapper_),this.mouseOutWrapper_=null);Blockly.FieldVariableGetter.superClass_.dispose.call(this);this.variableMap_=this.workspace_=null};
|
|
Blockly.FieldVariableGetter.prototype.fromXml=function(a){a.getAttribute("id");var b=a.textContent,c=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=Blockly.Variables.getOrCreateVariablePackage(this.workspace_,null,b,c);if(null!=c&&c!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())};
|
|
Blockly.FieldVariableGetter.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariableGetter.prototype.setSourceBlock=function(a){goog.asserts.assert(!a.isShadow(),"Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariableGetter.superClass_.setSourceBlock.call(this,a);this.workspace_=a.workspace};
|
|
Blockly.FieldVariableGetter.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};Blockly.FieldVariableGetter.prototype.getText=function(){return this.variable_?this.variable_.name:""};Blockly.FieldVariableGetter.prototype.getVariable=function(){return this.variable_};
|
|
Blockly.FieldVariableGetter.prototype.setValue=function(a){var b=Blockly.Variables.getVariable(this.sourceBlock_.workspace,a);if(!b)throw Error("Variable id doesn't point to a real variable! ID was "+a);var c=b.type;if(!this.typeIsAllowed_(c))throw Error("Variable type doesn't match this field! Type was "+c);this.sourceBlock_&&Blockly.Events.isEnabled()&&(c=this.variable_?this.variable_.getId():null,Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,c,a)));this.variable_=
|
|
b;this.value_=a;this.setText(b.name)};Blockly.FieldVariableGetter.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;c<b.length;c++)if(a==b[c])return!0;return!1};Blockly.FieldVariableGetter.prototype.getVariableTypes_=function(){var a=this.variableTypes;if(null===a&&this.sourceBlock_)return this.sourceBlock_.workspace.getVariableTypes();a=a||[""];if(0==a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a};
|
|
Blockly.FieldVariableGetter.prototype.setTypes_=function(a,b){var c=b||"";if(null==a||void 0==a)var d=null;else if(Array.isArray(a)){d=a;for(var e=!1,f=0;f<d.length;f++)d[f]==c&&(e=!0);if(!e)throw Error("Invalid default type '"+c+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType_=c;this.variableTypes=d};Blockly.FieldVariableGetter.prototype.showEditor_=function(){};
|
|
Blockly.FieldVariableGetter.prototype.updateEditable=function(){!this.sourceBlock_.isInFlyout&&this.sourceBlock_.isEditable()&&(this.fieldGroup_.style.cursor=this.CURSOR)};Blockly.FieldVariableGetter.prototype.referencesVariables=function(){return!0};Blockly.Field.register("field_variable_getter",Blockly.FieldVariableGetter);Blockly.Input=function(a,b,c,d){if(a!=Blockly.DUMMY_INPUT&&!b)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=b;this.sourceBlock_=c;this.connection=d;this.fieldRow=[];this.outlinePath=null};Blockly.Input.prototype.align=Blockly.ALIGN_LEFT;Blockly.Input.prototype.visible_=!0;Blockly.Input.prototype.appendField=function(a,b){this.insertFieldAt(this.fieldRow.length,a,b);return this};
|
|
Blockly.Input.prototype.insertFieldAt=function(a,b,c){if(0>a||a>this.fieldRow.length)throw Error("index "+a+" out of bounds.");if(!b&&!c)return a;"string"==typeof b&&(b=new Blockly.FieldLabel(b));b.setSourceBlock(this.sourceBlock_);this.sourceBlock_.rendered&&b.init();b.name=c;b.prefixField&&(a=this.insertFieldAt(a,b.prefixField));this.fieldRow.splice(a,0,b);++a;b.suffixField&&(a=this.insertFieldAt(a,b.suffixField));this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_());
|
|
return a};Blockly.Input.prototype.removeField=function(a){for(var b=0,c;c=this.fieldRow[b];b++)if(c.name===a){c.dispose();this.fieldRow.splice(b,1);this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_());return}throw Error('Field "%s" not found.',a);};Blockly.Input.prototype.isVisible=function(){return this.visible_};
|
|
Blockly.Input.prototype.setVisible=function(a){var b=[];if(this.visible_==a)return b;this.visible_=a;!a&&this.outlinePath&&this.outlinePath.setAttribute("style","visibility: hidden");for(var c=a?"block":"none",d=0,e;e=this.fieldRow[d];d++)e.setVisible(a);this.connection&&(a?b=this.connection.unhideAll():this.connection.hideAll(),d=this.connection.targetBlock())&&(d.getSvgRoot().style.display=c,a||(d.rendered=!1));return b};
|
|
Blockly.Input.prototype.setCheck=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.setCheck(a);return this};Blockly.Input.prototype.setAlign=function(a){this.align=a;this.sourceBlock_.rendered&&this.sourceBlock_.render();return this};Blockly.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var a=0;a<this.fieldRow.length;a++)this.fieldRow[a].init(this.sourceBlock_)};
|
|
Blockly.Input.prototype.dispose=function(){this.outlinePath&&goog.dom.removeNode(this.outlinePath);for(var a=0,b;b=this.fieldRow[a];a++)b.dispose();this.connection&&this.connection.dispose();this.sourceBlock_=null};Blockly.Input.prototype.initOutlinePath=function(a){this.sourceBlock_.workspace.rendered&&!this.outlinePath&&this.type==Blockly.INPUT_VALUE&&(this.outlinePath=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath",style:"visibility: hidden",d:""},a))};Blockly.Warning=function(a){Blockly.Warning.superClass_.constructor.call(this,a);this.createIcon();this.text_={}};goog.inherits(Blockly.Warning,Blockly.Icon);Blockly.Warning.prototype.collapseHidden=!1;
|
|
Blockly.Warning.prototype.drawIcon_=function(a){Blockly.utils.dom.createSvgElement("path",{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},a);Blockly.utils.dom.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)};
|
|
Blockly.Warning.textToDom_=function(a){var b=Blockly.utils.dom.createSvgElement("text",{"class":"blocklyText blocklyBubbleText",y:Blockly.Bubble.BORDER_WIDTH},null);a=a.split("\n");for(var c=0;c<a.length;c++){var d=Blockly.utils.dom.createSvgElement("tspan",{dy:"1em",x:Blockly.Bubble.BORDER_WIDTH},b),e=document.createTextNode(a[c]);d.appendChild(e)}return b};
|
|
Blockly.Warning.prototype.setVisible=function(a){if(a!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"warningOpen",!a,a)),a){a=Blockly.Warning.textToDom_(this.getText());this.bubble_=new Blockly.Bubble(this.block_.workspace,a,this.block_.svgPath_,this.iconXY_,null,null);this.bubble_.setSvgId(this.block_.id);if(this.block_.RTL)for(var b=a.getBBox().width,c=0,d;d=a.childNodes[c];c++)d.setAttribute("text-anchor","end"),d.setAttribute("x",b+Blockly.Bubble.BORDER_WIDTH);this.updateColour();
|
|
a=this.bubble_.getBubbleSize();this.bubble_.setBubbleSize(a.width,a.height)}else this.bubble_.dispose(),this.body_=this.bubble_=null};Blockly.Warning.prototype.bodyFocus_=function(a){this.bubble_.promote_()};Blockly.Warning.prototype.setText=function(a,b){this.text_[b]!=a&&(a?this.text_[b]=a:delete this.text_[b],this.isVisible()&&(this.setVisible(!1),this.setVisible(!0)))};Blockly.Warning.prototype.getText=function(){var a=[],b;for(b in this.text_)a.push(this.text_[b]);return a.join("\n")};
|
|
Blockly.Warning.prototype.dispose=function(){this.block_.warning=null;Blockly.Icon.prototype.dispose.call(this)};Blockly.Block=function(a,b,c){if("undefined"!==typeof Blockly.Generator.prototype[b])throw Error('Block prototypeName "'+b+'" conflicts with Blockly.Generator members.');var d=a&&a.getFlyout&&a.getFlyout()?a.getFlyout().getWorkspace():null;this.id=!c||a.getBlockById(c)||d&&d.getBlockById(c)?Blockly.utils.genUid():c;a.blockDB_[this.id]=this;this.previousConnection=this.nextConnection=this.outputConnection=null;this.inputList=[];this.inputsInline=!0;this.disabled=this.startHat=!1;this.tooltip="";this.contextMenu=
|
|
!0;this.parentBlock_=null;this.childBlocks_=[];this.editable_=this.movable_=this.deletable_=!0;this.collapsed_=this.isShadow_=!1;this.category_=this.outputShape_=this.comment=null;this.xy_=new Blockly.utils.Coordinate(0,0);this.workspace=a;this.isInFlyout=a.isFlyout;this.isInMutator=a.isMutator;this.RTL=a.RTL;this.isInsertionMarker_=!1;this.hat=void 0;if(b){this.type=b;c=Blockly.Blocks[b];if(!c||"object"!=typeof c)throw TypeError("Unknown block type: "+b);goog.mixin(this,c)}a.addTopBlock(this);a.addTypedBlock(this);
|
|
"function"==typeof this.init&&this.init();this.inputsInlineDefault=this.inputsInline;if(Blockly.Events.isEnabled()){(a=Blockly.Events.getGroup())||Blockly.Events.setGroup(!0);try{Blockly.Events.fire(new Blockly.Events.BlockCreate(this))}finally{a||Blockly.Events.setGroup(!1)}}"function"==typeof this.onchange&&this.setOnChange(this.onchange)};Blockly.Block.obtain=function(a,b){console.warn("Deprecated call to Blockly.Block.obtain, use workspace.newBlock instead.");return a.newBlock(b)};
|
|
Blockly.Block.prototype.data=null;Blockly.Block.prototype.hue_=null;Blockly.Block.prototype.colour_="#000000";Blockly.Block.prototype.colourSecondary_="#000000";Blockly.Block.prototype.colourTertiary_="#000000";Blockly.Block.prototype.shadowColour_=null;Blockly.Block.prototype.styleName_=null;
|
|
Blockly.Block.prototype.dispose=function(a){if(this.workspace){this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);this.unplug(a);Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockDelete(this));Blockly.Events.disable();try{this.workspace&&(this.workspace.removeTopBlock(this),this.workspace.removeTypedBlock(this),delete this.workspace.blockDB_[this.id],this.workspace=null);Blockly.selected==this&&(Blockly.selected=null);for(var b=this.childBlocks_.length-
|
|
1;0<=b;b--)this.childBlocks_[b].dispose(!1);b=0;for(var c;c=this.inputList[b];b++)c.dispose();this.inputList.length=0;var d=this.getConnections_(!0);for(b=0;b<d.length;b++){var e=d[b];e.isConnected()&&e.disconnect();d[b].dispose()}}finally{Blockly.Events.enable()}}};Blockly.Block.prototype.initModel=function(){for(var a=0,b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.initModel&&d.initModel()};
|
|
Blockly.Block.prototype.unplug=function(a){this.outputConnection?this.unplugFromRow_(a):this.previousConnection&&this.unplugFromStack_(a)};Blockly.Block.prototype.unplugFromRow_=function(a){var b=null;this.outputConnection.isConnected()&&(b=this.outputConnection.targetConnection,this.outputConnection.disconnect());b&&a&&(a=this.getOnlyValueConnection_())&&a.isConnected()&&!a.targetBlock().isShadow()&&(a=a.targetConnection,a.checkType_(b)&&(a.disconnect(),b.connect(a)))};
|
|
Blockly.Block.prototype.getOnlyValueConnection_=function(){for(var a=null,b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;if(c&&c.type==Blockly.INPUT_VALUE&&c.targetConnection){if(a)return null;a=c}}return a};
|
|
Blockly.Block.prototype.unplugFromStack_=function(a){var b=null;this.previousConnection.isConnected()&&(b=this.previousConnection.targetConnection,this.previousConnection.disconnect());var c=this.getNextBlock();a&&c&&!c.isShadow()&&(a=this.nextConnection.targetConnection,a.disconnect(),b&&b.checkType_(a)&&b.connect(a))};
|
|
Blockly.Block.prototype.getConnections_=function(a){a=[];this.outputConnection&&a.push(this.outputConnection);this.previousConnection&&a.push(this.previousConnection);this.nextConnection&&a.push(this.nextConnection);for(var b=0,c;c=this.inputList[b];b++)c.connection&&a.push(c.connection);return a};Blockly.Block.prototype.lastConnectionInStack=function(){for(var a=this.nextConnection;a;){var b=a.targetBlock();if(!b)return a;a=b.nextConnection}return null};Blockly.Block.prototype.bumpNeighbours_=function(){console.warn("Not expected to reach Block.bumpNeighbours_ function. BlockSvg.bumpNeighbours_ was expected to be called instead.")};
|
|
Blockly.Block.prototype.getParent=function(){return this.parentBlock_};Blockly.Block.prototype.getInputWithBlock=function(a){for(var b=0,c;c=this.inputList[b];b++)if(c.connection&&c.connection.targetBlock()==a)return c;return null};Blockly.Block.prototype.getInputWithConnection=function(a){for(var b=0,c;c=this.inputList[b];b++)if(c.connection==a)return c;return null};
|
|
Blockly.Block.prototype.getSurroundParent=function(){var a=this;do{var b=a;a=a.getParent();if(!a)return null}while(a.getNextBlock()==b);return a};Blockly.Block.prototype.getNextBlock=function(){return this.nextConnection&&this.nextConnection.targetBlock()};Blockly.Block.prototype.getPreviousBlock=function(){return this.previousConnection&&this.previousConnection.targetBlock()};
|
|
Blockly.Block.prototype.getFirstStatementConnection=function(){for(var a=0,b;b=this.inputList[a];a++)if(b.connection&&b.connection.type==Blockly.NEXT_STATEMENT)return b.connection;return null};Blockly.Block.prototype.getRootBlock=function(){var a=this;do{var b=a;a=b.parentBlock_}while(a);return b};
|
|
Blockly.Block.prototype.getChildren=function(a){if(!a)return this.childBlocks_;a=[];for(var b=0,c;c=this.inputList[b];b++)c.connection&&(c=c.connection.targetBlock())&&a.push(c);(b=this.getNextBlock())&&a.push(b);return a};
|
|
Blockly.Block.prototype.setParent=function(a){if(a!=this.parentBlock_){if(this.parentBlock_){Blockly.utils.arrayRemove(this.parentBlock_.childBlocks_,this);if(this.previousConnection&&this.previousConnection.isConnected())throw Error("Still connected to previous block.");if(this.outputConnection&&this.outputConnection.isConnected())throw Error("Still connected to parent block.");this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=a)?a.childBlocks_.push(this):this.workspace.addTopBlock(this)}};
|
|
Blockly.Block.prototype.getDescendants=function(a,b){for(var c=[this],d=this.getChildren(a),e,f=0;e=d[f];f++)b&&e.isShadow_||c.push.apply(c,e.getDescendants(a,b));return c};Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setDeletable=function(a){this.deletable_=a};Blockly.Block.prototype.isMovable=function(){return this.isMovablePersisted()&&!(this.workspace&&this.workspace.options.debugMode)};
|
|
Blockly.Block.prototype.isMovablePersisted=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setMovable=function(a){this.movable_=a};Blockly.Block.prototype.isDuplicatable=function(){return this.workspace.hasBlockLimits()?this.workspace.isCapacityAvailable(Blockly.utils.getBlockTypeCounts(this,!0)):!0};Blockly.Block.prototype.isShadow=function(){return this.isShadow_};
|
|
Blockly.Block.prototype.setShadow=function(a){this.isShadow_=a};Blockly.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_};Blockly.Block.prototype.setInsertionMarker=function(a){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(this.setColour(Blockly.Colours.insertionMarker),this.setOpacity(Blockly.Colours.insertionMarkerOpacity),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyInsertionMarker"))};
|
|
Blockly.Block.prototype.isEditable=function(){return this.isEditablePersisted()&&!(this.workspace&&this.workspace.options.debugMode)};Blockly.Block.prototype.isEditablePersisted=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)};Blockly.Block.prototype.setEditable=function(a){this.editable_=a;a=0;for(var b;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateEditable()};
|
|
Blockly.Block.prototype.setConnectionsHidden=function(a){if(!a&&this.isCollapsed()){if(this.outputConnection&&this.outputConnection.setHidden(a),this.previousConnection&&this.previousConnection.setHidden(a),this.nextConnection){this.nextConnection.setHidden(a);var b=this.nextConnection.targetBlock();b&&b.setConnectionsHidden(a)}}else for(var c=this.getConnections_(!0),d=0;b=c[d];d++)b.setHidden(a),b.isSuperior()&&(b=b.targetBlock())&&b.setConnectionsHidden(a)};
|
|
Blockly.Block.prototype.getMatchingConnection=function(a,b){var c=this.getConnections_(!0),d=a.getConnections_(!0);if(c.length!=d.length)throw Error("Connection lists did not match in length.");for(var e=0;e<d.length;e++)if(d[e]==b)return c[e];return null};Blockly.Block.prototype.setHelpUrl=function(a){this.helpUrl=a};Blockly.Block.prototype.setTooltip=function(a){this.tooltip=a};Blockly.Block.prototype.getColour=function(){return this.colour_};Blockly.Block.prototype.getColourSecondary=function(){return this.colourSecondary_};
|
|
Blockly.Block.prototype.getColourTertiary=function(){return this.colourTertiary_};Blockly.Block.prototype.getColourShadow=function(){var a=this.getColourSecondary();return a?a:Blockly.utils.colour.blend("white",this.getColour(),.6)};
|
|
Blockly.Block.prototype.getColourBorder=function(){var a=this.getColourTertiary();if(a)return{colourBorder:a,colourLight:null,colourDark:null};a=this.getColour();return{colourBorder:null,colourLight:Blockly.utils.colour.blend("white",a,.3),colourDark:Blockly.utils.colour.blend("black",a,.2)}};Blockly.Block.prototype.getStyleName=function(){return this.styleName_};Blockly.Block.prototype.getHue=function(){return this.hue_};Blockly.Block.prototype.getColourSecondary=function(){return this.colourSecondary_};
|
|
Blockly.Block.prototype.getColourTertiary=function(){return this.colourTertiary_};Blockly.Block.prototype.getShadowColour=function(){return this.shadowColour_};Blockly.Block.prototype.setShadowColour=function(a){this.shadowColour_=this.makeColour_(a);this.rendered&&this.updateColour()};Blockly.Block.prototype.clearShadowColour=function(){this.shadowColour_=null;this.rendered&&this.updateColour()};
|
|
Blockly.Block.prototype.makeColour_=function(a){var b="string"==typeof a?Blockly.utils.replaceMessageReferences(a):a,c=Number(b);if(!isNaN(c)&&0<=c&&360>=c)return Blockly.hueToHex(c);if(c=Blockly.utils.colour.parse(b))return c;c='Invalid colour: "'+b+'"';a!=b&&(c+=' (from "'+a+'")');throw Error(c);};
|
|
Blockly.Block.prototype.setColour=function(a,b,c){this.colour_=this.makeColour_(a);this.colourSecondary_=void 0!==b?this.makeColour_(b):Blockly.utils.colour.darken(this.colour_,.15);this.colourTertiary_=void 0!==c?this.makeColour_(c):Blockly.utils.colour.darken(this.colour_,.25);this.rendered&&this.updateColour()};
|
|
Blockly.Block.prototype.setStyle=function(a){var b=Blockly.getTheme();if(!b)throw Error("Trying to set block style to "+a+" before theme was defined via Blockly.setTheme().");b=b.getBlockStyle(a);this.styleName_=a;if(b)this.hat=b.hat,this.setColour(b.colourPrimary,b.colourSecondary,b.colourTertiary);else throw Error("Invalid style name: "+a);};
|
|
Blockly.Block.prototype.setOnChange=function(a){if(a&&"function"!=typeof a)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_);if(this.onchange=a)this.onchangeWrapper_=a.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_)};Blockly.Block.prototype.getField=function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(e.name===a)return e;return null};
|
|
Blockly.Block.prototype.getVars=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.push(e.getValue());return a};Blockly.Block.prototype.getVarModels=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&(e=this.workspace.getVariableById(e.getValue()))&&a.push(e);return a};
|
|
Blockly.Block.prototype.updateVarName=function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)e.referencesVariables()&&a.getId()==e.getValue()&&e.setText(a.name)};Blockly.Block.prototype.renameVarById=function(a,b){for(var c=0,d;d=this.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)f.referencesVariables()&&a==f.getValue()&&f.setValue(b)};Blockly.Block.prototype.getFieldValue=function(a){return(a=this.getField(a))?a.getValue():null};
|
|
Blockly.Block.prototype.setFieldValue=function(a,b){var c=this.getField(b);if(!c)throw Error('Field "'+b+'" not found.');c.setValue(a)};
|
|
Blockly.Block.prototype.setPreviousStatement=function(a,b){if(a){void 0===b&&(b=null);if(!this.previousConnection){if(this.outputConnection)throw Error("Remove output connection prior to adding previous connection.");this.previousConnection=this.makeConnection_(Blockly.PREVIOUS_STATEMENT)}this.previousConnection.setCheck(b)}else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose();
|
|
this.previousConnection=null}};Blockly.Block.prototype.setNextStatement=function(a,b){if(a)void 0===b&&(b=null),this.nextConnection||(this.nextConnection=this.makeConnection_(Blockly.NEXT_STATEMENT)),this.nextConnection.setCheck(b);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");this.nextConnection.dispose();this.nextConnection=null}};
|
|
Blockly.Block.prototype.setOutput=function(a,b){if(a){void 0===b&&(b=null);if(!this.outputConnection){if(this.previousConnection)throw Error("Remove previous connection prior to adding output connection.");this.outputConnection=this.makeConnection_(Blockly.OUTPUT_VALUE)}this.outputConnection.setCheck(b)}else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose();this.outputConnection=
|
|
null}};Blockly.Block.prototype.setInputsInline=function(a){this.inputsInline!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(this,"inline",null,this.inputsInline,a)),this.inputsInline=a)};
|
|
Blockly.Block.prototype.getInputsInline=function(){if(void 0!=this.inputsInline)return this.inputsInline;for(var a=1;a<this.inputList.length;a++)if(this.inputList[a-1].type==Blockly.DUMMY_INPUT&&this.inputList[a].type==Blockly.DUMMY_INPUT)return!1;for(a=1;a<this.inputList.length;a++)if(this.inputList[a-1].type==Blockly.INPUT_VALUE&&this.inputList[a].type==Blockly.DUMMY_INPUT)return!0;return!1};Blockly.Block.prototype.setStartHat=function(a){this.startHat!=a&&(this.startHat=a)};
|
|
Blockly.Block.prototype.getStartHat=function(){return this.startHat};Blockly.Block.prototype.setDisabled=function(a){console.warn("Deprecated call to Blockly.Block.prototype.setDisabled, use Blockly.Block.prototype.setEnabled instead.");this.setEnabled(!a)};Blockly.Block.prototype.isEnabled=function(){return!this.disabled};Blockly.Block.prototype.setEnabled=function(a){this.isEnabled()!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(this,"disabled",null,this.disabled,!a)),this.disabled=!a)};
|
|
Blockly.Block.prototype.getInheritedDisabled=function(){for(var a=this.getSurroundParent();a;){if(a.disabled)return!0;a=a.getSurroundParent()}return!1};Blockly.Block.prototype.isCollapsed=function(){return this.collapsed_};Blockly.Block.prototype.setCollapsed=function(a){this.collapsed_!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(this,"collapsed",null,this.collapsed_,a)),this.collapsed_=a)};
|
|
Blockly.Block.prototype.toString=function(a,b){var c=[],d=b||"?";if(this.collapsed_)c.push(this.getInput("_TEMP_COLLAPSED_INPUT").fieldRow[0].text_);else for(var e=0,f;f=this.inputList[e];e++){for(var g=0,h;h=f.fieldRow[g];g++)h instanceof Blockly.FieldDropdown&&!h.getValue()?c.push(d):c.push(h.getText());f.connection&&((f=f.connection.targetBlock())?c.push(f.toString(void 0,b)):c.push(d))}c=c.join(" ").trim()||"???";a&&c.length>a&&(c=c.substring(0,a-3)+"...");return c};
|
|
Blockly.Block.prototype.appendValueInput=function(a){return this.appendInput_(Blockly.INPUT_VALUE,a)};Blockly.Block.prototype.appendStatementInput=function(a){return this.appendInput_(Blockly.NEXT_STATEMENT,a)};Blockly.Block.prototype.appendDummyInput=function(a){return this.appendInput_(Blockly.DUMMY_INPUT,a||"")};
|
|
Blockly.Block.prototype.jsonInit=function(a){var b=a.type?'Block "'+a.type+'": ':"";if(a.output&&a.previousStatement)throw Error(b+"Must not have both an output and a previousStatement.");a.style&&a.style.hat&&(this.hat=a.style.hat,a.style=null);if(a.style&&a.colour)throw Error(b+"Must not have both a colour and a style.");a.style?this.jsonInitStyle_(a,b):this.jsonInitColour_(a,b);for(var c=0;void 0!==a["message"+c];)this.interpolate_(a["message"+c],a["args"+c]||[],a["lastDummyAlign"+c]),c++;void 0!==
|
|
a.inputsInline&&this.setInputsInline(a.inputsInline);void 0!==a.startHat&&this.setStartHat(a.startHat);void 0!==a.output&&this.setOutput(!0,a.output);void 0!==a.previousStatement&&this.setPreviousStatement(!0,a.previousStatement);void 0!==a.nextStatement&&this.setNextStatement(!0,a.nextStatement);void 0!==a.tooltip&&(c=a.tooltip,c=Blockly.utils.replaceMessageReferences(c),this.setTooltip(c));void 0!==a.enableContextMenu&&(c=a.enableContextMenu,this.contextMenu=!!c);void 0!==a.helpUrl&&(c=a.helpUrl,
|
|
c=Blockly.utils.replaceMessageReferences(c),this.setHelpUrl(c));"string"==typeof a.extensions&&(console.warn(b+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+a.type+"' block."),a.extensions=[a.extensions]);void 0!==a.mutator&&Blockly.Extensions.apply(a.mutator,this,!0);if(Array.isArray(a.extensions))for(b=a.extensions,c=0;c<b.length;++c)Blockly.Extensions.apply(b[c],this,!1);void 0!==a.outputShape&&this.setOutputShape(a.outputShape);void 0!==a.category&&
|
|
this.setCategory(a.category)};Blockly.Block.prototype.setColourFromRawValues_=function(a,b,c){a=goog.isString(a)?Blockly.utils.replaceMessageReferences(a):a;b=goog.isString(b)?Blockly.utils.replaceMessageReferences(b):b;c=goog.isString(c)?Blockly.utils.replaceMessageReferences(c):c;this.setColour(a,b,c)};
|
|
Blockly.Block.prototype.jsonInitColour_=function(a,b){if("colour"in a)if(void 0===a.colour)console.warn(b+"Undefined colour value.");else{var c=a.colour;try{this.setColourFromRawValues_(c,a.colourSecondary,a.colourTertiary)}catch(d){console.warn(b+"Illegal colour value: ",c)}}};Blockly.Block.prototype.jsonInitStyle_=function(a,b){var c=a.style;try{this.setStyle(c)}catch(d){console.warn(b+"Style does not exist: ",c)}};
|
|
Blockly.Block.prototype.mixin=function(a,b){if(void 0!==b&&"boolean"!=typeof b)throw Error("opt_disableCheck must be a boolean if provided");if(!b){var c=[],d;for(d in a)void 0!==this[d]&&c.push(d);if(c.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(c));}goog.mixin(this,a)};
|
|
Blockly.Block.prototype.interpolate_=function(a,b,c){var d=Blockly.utils.tokenizeInterpolation(a),e=[],f=0;a=[];for(var g=0;g<d.length;g++){var h=d[g];if("number"==typeof h){if(0>=h||h>b.length)throw Error('Block "'+this.type+'": Message index %'+h+" out of range.");if(e[h])throw Error('Block "'+this.type+'": Message index %'+h+" duplicated.");e[h]=!0;f++;a.push(b[h-1])}else(h=h.trim())&&a.push(h)}if(f!=b.length)throw Error('Block "'+this.type+'": Message does not reference all '+b.length+" arg(s).");
|
|
a.length&&("string"==typeof a[a.length-1]||Blockly.utils.string.startsWith(a[a.length-1].type,"field_"))&&(g={type:"input_dummy"},c&&(g.align=c),a.push(g));c={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE};b=[];for(g=0;g<a.length;g++)if(e=a[g],"string"==typeof e)b.push([e,void 0]);else{d=f=null;do if(h=!1,"string"==typeof e)f=new Blockly.FieldLabel(e);else switch(e.type){case "input_value":d=this.appendValueInput(e.name);break;case "input_statement":d=this.appendStatementInput(e.name);
|
|
break;case "input_dummy":d=this.appendDummyInput(e.name);break;default:f=Blockly.Field.fromJson(e),f||(e.alt?(e=e.alt,h=!0):console.warn("Blockly could not create a field of type "+e.type+". You may need to register your custom field. See github.com/google/blockly/issues/1584"))}while(h);if(f)b.push([f,e.name]);else if(d){e.check&&d.setCheck(e.check);e.align&&d.setAlign(c[e.align]);for(e=0;e<b.length;e++)d.appendField(b[e][0],b[e][1]);b.length=0}}};
|
|
Blockly.Block.prototype.appendInput_=function(a,b){var c=null;if(a==Blockly.INPUT_VALUE||a==Blockly.NEXT_STATEMENT)c=this.makeConnection_(a);c=new Blockly.Input(a,b,this,c);this.inputList.push(c);return c};
|
|
Blockly.Block.prototype.moveInputBefore=function(a,b){if(a!=b){for(var c=-1,d=b?-1:this.inputList.length,e=0,f;f=this.inputList[e];e++)if(f.name==a){if(c=e,-1!=d)break}else if(b&&f.name==b&&(d=e,-1!=c))break;if(-1==c)throw Error('Named input "'+a+'" not found.');if(-1==d)throw Error('Reference input "'+b+'" not found.');this.moveNumberedInputBefore(c,d)}};
|
|
Blockly.Block.prototype.moveNumberedInputBefore=function(a,b){if(a==b)throw Error("Can't move input to itself.");if(a>=this.inputList.length)throw RangeError("Input index "+a+" out of bounds.");if(b>this.inputList.length)throw RangeError("Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);a<b&&b--;this.inputList.splice(b,0,c)};
|
|
Blockly.Block.prototype.removeInput=function(a,b){for(var c=0,d;d=this.inputList[c];c++)if(d.name==a){if(d.connection&&d.connection.isConnected()){d.connection.setShadowDom(null);var e=d.connection.targetBlock();e.isShadow()?e.dispose():e.unplug()}d.dispose();this.inputList.splice(c,1);return}if(!b)throw Error("Input not found: "+a);};Blockly.Block.prototype.getInput=function(a){for(var b=0,c;c=this.inputList[b];b++)if(c.name==a)return c;return null};
|
|
Blockly.Block.prototype.getInputTargetBlock=function(a){return(a=this.getInput(a))&&a.connection&&a.connection.targetBlock()};Blockly.Block.prototype.getCommentText=function(){return this.comment||""};Blockly.Block.prototype.setCommentText=function(a){this.comment!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(this,"comment",null,this.comment,a||"")),this.comment=a)};
|
|
Blockly.Block.prototype.enableBreakpoint=function(a){var b=!1;a?(this.breakpoint||(this.breakpoint=new Blockly.Breakpoint(this),b=!0),this.breakpoint.setVisible(this.isBreakpointSet())):this.breakpoint&&(this.breakpoint.dispose(),b=!0);b&&Blockly.Events.fire(new Blockly.Events.BlockChange(this,"breakpoint",null,!a,a))};Blockly.Block.prototype.isBreakpointSet=function(){return this.breakpointSet_||!1};Blockly.Block.prototype.setBreakpoint=function(a){this.breakpointSet_=a};
|
|
Blockly.Block.prototype.setOutputShape=function(a){this.outputShape_=a};Blockly.Block.prototype.getOutputShape=function(){return this.outputShape_||Blockly.OUTPUT_SHAPE_SQUARE};Blockly.Block.prototype.setCategory=function(a){this.category_=a};Blockly.Block.prototype.getCategory=function(){return this.category_};Blockly.Block.prototype.setWarningText=function(a,b){};Blockly.Block.prototype.setMutator=function(a){};Blockly.Block.prototype.getRelativeToSurfaceXY=function(){return this.xy_};
|
|
Blockly.Block.prototype.moveBy=function(a,b){if(this.parentBlock_)throw Error("Block has parent.");var c=new Blockly.Events.BlockMove(this);this.xy_.translate(a,b);c.recordNew();Blockly.Events.fire(c)};Blockly.Block.prototype.makeConnection_=function(a){return new Blockly.Connection(this,a)};
|
|
Blockly.Block.prototype.allInputsFilled=function(a){void 0===a&&(a=!0);if(!a&&this.isShadow())return!1;for(var b=0,c;c=this.inputList[b];b++)if(c.connection&&(c=c.connection.targetBlock(),!c||!c.allInputsFilled(a)))return!1;return(b=this.getNextBlock())?b.allInputsFilled(a):!0};Blockly.Block.prototype.toDevString=function(){var a=this.type?'"'+this.type+'" block':"Block";this.id&&(a+=' (id="'+this.id+'")');return a};Blockly.BlockDragSurfaceSvg=function(a){this.container_=a;this.createDom()};Blockly.BlockDragSurfaceSvg.prototype.SVG_=null;Blockly.BlockDragSurfaceSvg.prototype.dragGroup_=null;Blockly.BlockDragSurfaceSvg.prototype.container_=null;Blockly.BlockDragSurfaceSvg.prototype.scale_=1;Blockly.BlockDragSurfaceSvg.prototype.surfaceXY_=null;Blockly.BlockDragSurfaceSvg.prototype.dragShadowFilterId_="";Blockly.BlockDragSurfaceSvg.SHADOW_STD_DEVIATION=6;
|
|
Blockly.BlockDragSurfaceSvg.prototype.createDom=function(){if(!this.SVG_){this.SVG_=Blockly.utils.dom.createSvgElement("svg",{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1","class":"blocklyBlockDragSurface"},this.container_);var a=Blockly.utils.dom.createSvgElement("defs",{},this.SVG_);this.dragShadowFilterId_=this.createDropShadowDom_(a);this.dragGroup_=Blockly.utils.dom.createSvgElement("g",{},this.SVG_);this.dragGroup_.setAttribute("filter",
|
|
"url(#"+this.dragShadowFilterId_+")")}};
|
|
Blockly.BlockDragSurfaceSvg.prototype.createDropShadowDom_=function(a){var b=String(Math.random()).substring(2);a=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyDragShadowFilter"+b,height:"140%",width:"140%",y:"-20%",x:"-20%"},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:Blockly.BlockDragSurfaceSvg.SHADOW_STD_DEVIATION},a);b=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"offsetBlur"},a);Blockly.utils.dom.createSvgElement("feFuncA",
|
|
{type:"linear",slope:Blockly.Colours.dragShadowOpacity},b);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"offsetBlur",operator:"over"},a);return a.id};
|
|
Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(a){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(a);this.SVG_.style.display="block";this.surfaceXY_=new Blockly.utils.Coordinate(0,0);document.getElementsByClassName("injectionDiv")[0].style.overflow="visible"};
|
|
Blockly.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(a,b,c){this.scale_=c;a=a.toFixed(0);b=b.toFixed(0);this.dragGroup_.setAttribute("transform","translate("+a+","+b+") scale("+c+")")};Blockly.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var a=this.surfaceXY_.x,b=this.surfaceXY_.y;a=a.toFixed(0);b=b.toFixed(0);this.SVG_.style.display="block";Blockly.utils.dom.setCssTransform(this.SVG_,"translate3d("+a+"px, "+b+"px, 0px)")};
|
|
Blockly.BlockDragSurfaceSvg.prototype.translateSurface=function(a,b){this.surfaceXY_=new Blockly.utils.Coordinate(a*this.scale_,b*this.scale_);this.translateSurfaceInternal_()};Blockly.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var a=Blockly.utils.getRelativeXY(this.SVG_);return new Blockly.utils.Coordinate(a.x/this.scale_,a.y/this.scale_)};Blockly.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_};Blockly.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild};
|
|
Blockly.BlockDragSurfaceSvg.prototype.clearAndHide=function(a){a?this.getCurrentBlock()&&a.appendChild(this.getCurrentBlock()):this.getCurrentBlock()&&this.dragGroup_.removeChild(this.getCurrentBlock());this.SVG_.style.display="none";if(this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null;document.getElementsByClassName("injectionDiv")[0].style.overflow="hidden"};
|
|
Blockly.BlockDragSurfaceSvg.prototype.setOpacity=function(a){this.SVG_.setAttribute("opacity",a)};Blockly.utils.uiMenu={};Blockly.utils.uiMenu.getSize=function(a){a=a.getElement();var b=goog.style.getSize(a);b.height=a.scrollHeight;return b};Blockly.utils.uiMenu.adjustBBoxesForRTL=function(a,b,c){b.left+=c.width;b.right+=c.width;a.left+=c.width;a.right+=c.width};Blockly.ContextMenu={};Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_=null;Blockly.ContextMenu.show=function(a,b,c){Blockly.WidgetDiv.show(Blockly.ContextMenu,c,null);if(b.length){var d=Blockly.ContextMenu.populate_(b,c);goog.events.listen(d,goog.ui.Component.EventType.ACTION,Blockly.ContextMenu.hide);Blockly.ContextMenu.position_(d,a,c);setTimeout(function(){d.getElement().focus()},1);Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()};
|
|
Blockly.ContextMenu.populate_=function(a,b){var c=new goog.ui.Menu;c.setRightToLeft(b);for(var d=0,e;e=a[d];d++){var f=e.separator?new goog.ui.MenuSeparator:new goog.ui.MenuItem(e.text);f.setRightToLeft(b);c.addChild(f,!0);f.setEnabled(e.enabled);e.enabled&&(goog.events.listen(f,goog.ui.Component.EventType.ACTION,e.callback),f.handleContextMenu=function(){goog.events.dispatchEvent(this,goog.ui.Component.EventType.ACTION)})}return c};
|
|
Blockly.ContextMenu.position_=function(a,b,c){var d=Blockly.utils.getViewportBBox();b={top:b.clientY+d.top,bottom:b.clientY+d.top,left:b.clientX+d.left,right:b.clientX+d.left};Blockly.ContextMenu.createWidget_(a);var e=Blockly.utils.uiMenu.getSize(a);c&&Blockly.utils.uiMenu.adjustBBoxesForRTL(d,b,e);Blockly.WidgetDiv.positionWithAnchor(d,b,e,c);a.getElement().focus()};
|
|
Blockly.ContextMenu.createWidget_=function(a){a.render(Blockly.WidgetDiv.DIV);var b=a.getElement();Blockly.utils.dom.addClass(b,"blocklyContextMenu");Blockly.bindEventWithChecks_(b,"contextmenu",null,Blockly.utils.noEvent);a.setAllowAutoFocus(!0)};Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu);Blockly.ContextMenu.currentBlock=null;Blockly.ContextMenu.eventWrapper_&&Blockly.unbindEvent_(Blockly.ContextMenu.eventWrapper_)};
|
|
Blockly.ContextMenu.callbackFactory=function(a,b){return function(){Blockly.Events.disable();try{var c=Blockly.Xml.domToBlock(b,a.workspace),d=a.getRelativeToSurfaceXY();d.x=a.RTL?d.x-Blockly.SNAP_RADIUS:d.x+Blockly.SNAP_RADIUS;d.y+=2*Blockly.SNAP_RADIUS;c.moveBy(d.x,d.y)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!c.isShadow()&&Blockly.Events.fire(new Blockly.Events.BlockCreate(c));c.select()}};
|
|
Blockly.ContextMenu.blockDeleteOption=function(a){var b=a.getDescendants(!1,!0).length,c=a.getNextBlock();c&&(b-=c.getDescendants(!1,!0).length);return{text:1==b?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(b)),enabled:!0,callback:function(){Blockly.Events.setGroup(!0);a.dispose(!0,!0);Blockly.Events.setGroup(!1)}}};Blockly.ContextMenu.blockHelpOption=function(a){return{enabled:!("function"==typeof a.helpUrl?!a.helpUrl():!a.helpUrl),text:Blockly.Msg.HELP,callback:function(){a.showHelp_()}}};
|
|
Blockly.ContextMenu.blockDuplicateOption=function(a){var b=a.isDuplicatable();return{text:Blockly.Msg.DUPLICATE_BLOCK,enabled:b,callback:function(){Blockly.duplicate_(a)}}};Blockly.ContextMenu.blockCommentOption=function(a){var b={enabled:!Blockly.utils.userAgent.IE};a.comment?(b.text=Blockly.Msg.REMOVE_COMMENT,b.callback=function(){a.setCommentText(null)}):(b.text=Blockly.Msg.ADD_COMMENT,b.callback=function(){a.setCommentText("");a.comment.setVisible(!0)});return b};
|
|
Blockly.ContextMenu.commentDeleteOption=function(a){return{text:Blockly.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){Blockly.Events.setGroup(!0);a.dispose(!0,!0);Blockly.Events.setGroup(!1)}}};Blockly.ContextMenu.commentDuplicateOption=function(a){return{text:Blockly.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){Blockly.duplicate_(a)}}};
|
|
Blockly.ContextMenu.workspaceCommentOption=function(a,b){var c={enabled:!Blockly.utils.userAgent.IE};c.text=Blockly.Msg.ADD_COMMENT;c.callback=function(){var c=new Blockly.WorkspaceCommentSvg(a,Blockly.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE,Blockly.WorkspaceCommentSvg.DEFAULT_SIZE),e=a.getInjectionDiv().getBoundingClientRect();e=new Blockly.utils.Coordinate(b.clientX-e.left,b.clientY-e.top);var f=a.getOriginOffsetInPixels();e=Blockly.utils.Coordinate.difference(e,
|
|
f);e.scale(1/a.scale);c.moveBy(e.x,e.y);a.rendered&&(c.initSvg(),c.render(!1),c.select())};return c};Blockly.BlockSvg=function(a,b,c){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{},null);this.svgGroup_.translate_="";this.svgPathDark_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgGroup_);this.svgPath_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath blocklyBlockBackground"},this.svgGroup_);this.svgPathLight_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathLight"},this.svgGroup_);this.svgPath_.tooltip=
|
|
this;this.rendered=!1;this.useDragSurface_=Blockly.utils.is3dSupported()&&!!a.blockDragSurface_;Blockly.Tooltip.bindMouseEvents(this.svgPath_);Blockly.BlockSvg.superClass_.constructor.call(this,a,b,c);this.svgGroup_.dataset&&(this.svgGroup_.dataset.id=this.id)};goog.inherits(Blockly.BlockSvg,Blockly.Block);Blockly.BlockSvg.prototype.height=0;Blockly.BlockSvg.prototype.width=0;Blockly.BlockSvg.prototype.insertionMarkerMinWidth_=0;Blockly.BlockSvg.prototype.opacity_=1;
|
|
Blockly.BlockSvg.prototype.dragStartXY_=null;Blockly.BlockSvg.prototype.isGlowingBlock_=!1;Blockly.BlockSvg.prototype.isGlowingStack_=!1;Blockly.BlockSvg.prototype.isHighlightingBlock_=!1;Blockly.BlockSvg.prototype.warningTextDb_=null;Blockly.BlockSvg.INLINE=-1;Blockly.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";
|
|
Blockly.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");if(!this.isInsertionMarker()){for(var a=0,b;b=this.inputList[a];a++)b.init(),b.initOutlinePath(this.svgGroup_);b=this.getIcons();for(a=0;a<b.length;a++)b[a].createIcon()}this.updateColour();this.updateMovable();this.workspace.options.readOnly||this.eventsInit_||Blockly.bindEventWithChecks_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);this.eventsInit_=!0;this.getSvgRoot().parentNode||
|
|
this.workspace.getCanvas().appendChild(this.getSvgRoot());!this.workspace.options.readOnly&&this.outputConnection&&this.bindReporterHoverEvents_()};
|
|
Blockly.BlockSvg.prototype.select=function(){if(this.isMovable())if(this.isShadow()&&this.getParent())this.getParent().select();else if(Blockly.selected!=this){var a=null;if(Blockly.selected){a=Blockly.selected.id;Blockly.Events.disable();try{Blockly.selected.unselect()}finally{Blockly.Events.enable()}}a=new Blockly.Events.Ui(null,"selected",a,this.id);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=this;this.addSelect()}};
|
|
Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var a=new Blockly.Events.Ui(null,"selected",this.id,null);a.workspaceId=this.workspace.id;Blockly.Events.fire(a);Blockly.selected=null;this.removeSelect()}};Blockly.BlockSvg.prototype.setGlowBlock=function(a){this.rendered&&(this.isGlowingBlock_=a,this.updateColour())};
|
|
Blockly.BlockSvg.prototype.setGlowStack=function(a){this.rendered&&(this.isGlowingStack_=a,a=this.getSvgRoot(),this.isGlowingStack_&&!a.hasAttribute("filter")?a.setAttribute("filter","url(#"+(Blockly.mainWorkspace.options.stackGlowFilterId||"blocklyStackGlowFilter")+")"):!this.isGlowingStack_&&a.hasAttribute("filter")&&a.removeAttribute("filter"))};
|
|
Blockly.BlockSvg.prototype.setHighlightWarning=function(a){this.rendered&&((this.isHighlightingWarningBlock_=a)&&!this.svgPathWarningHighlight_?(a=Blockly.mainWorkspace.options.warningGlowFilterId||"blocklyHighlightWarningFilter",this.svgPathWarningHighlight_=this.svgPath_.cloneNode(!0),this.svgPathWarningHighlight_.setAttribute("fill","none"),this.svgPathWarningHighlight_.setAttribute("filter","url(#"+a+")"),this.getSvgRoot().appendChild(this.svgPathWarningHighlight_)):!this.isHighlightingWarningBlock_&&
|
|
this.svgPathWarningHighlight_&&(this.getSvgRoot().removeChild(this.svgPathWarningHighlight_),this.svgPathWarningHighlight_=null))};
|
|
Blockly.BlockSvg.prototype.setHighlightBlock=function(a){this.rendered&&((this.isHighlightingBlock_=a)&&!this.svgPathHighlight_?(a=Blockly.mainWorkspace.options.highlightGlowFilterId||"blocklyHighlightGlowFilter",this.svgPathHighlight_=this.svgPath_.cloneNode(!0),this.svgPathHighlight_.setAttribute("fill","none"),this.svgPathHighlight_.setAttribute("filter","url(#"+a+")"),this.getSvgRoot().appendChild(this.svgPathHighlight_)):!this.isHighlightingBlock_&&this.svgPathHighlight_&&(this.getSvgRoot().removeChild(this.svgPathHighlight_),
|
|
this.svgPathHighlight_=null))};
|
|
Blockly.BlockSvg.prototype.setSelectedBlock=function(a){this.rendered&&(this.isSelectingBlock_=a,a=this.getSvgRoot(),this.isSelectingBlock_&&!this.svgPathSelected_?(a=Blockly.mainWorkspace.options.selectedGlowFilterId||"blocklySelectedGlowFilter",this.svgPathSelected_=this.svgPath_.cloneNode(!0),Blockly.utils.dom.removeClass(this.svgPathSelected_,"hover-emphasis"),this.svgPathSelected_.setAttribute("fill","none"),this.svgPathSelected_.setAttribute("stroke",Blockly.Colours.selectedGlow),this.svgPathSelected_.setAttribute("filter",
|
|
"url(#"+a+")"),this.getSvgRoot().appendChild(this.svgPathSelected_)):!this.isSelectingBlock_&&this.svgPathSelected_&&(a.removeChild(this.svgPathSelected_),this.svgPathSelected_=null))};Blockly.BlockSvg.prototype.mutator=null;Blockly.BlockSvg.prototype.comment=null;Blockly.BlockSvg.prototype.warning=null;Blockly.BlockSvg.prototype.breakpoint=null;
|
|
Blockly.BlockSvg.prototype.getIcons=function(){var a=[];this.breakpoint&&a.push(this.breakpoint);this.mutator&&a.push(this.mutator);this.comment&&a.push(this.comment);this.warning&&a.push(this.warning);return a};
|
|
Blockly.BlockSvg.prototype.setParent=function(a){var b=this.parentBlock_;if(a!=b){Blockly.Field.startCache();Blockly.BlockSvg.superClass_.setParent.call(this,a);Blockly.Field.stopCache();var c=this.getSvgRoot();if(!this.workspace.isClearing&&c){var d=this.getRelativeToSurfaceXY();a?(a.getSvgRoot().appendChild(c),b=this.getRelativeToSurfaceXY(),this.moveConnections_(b.x-d.x,b.y-d.y),this.isShadow()&&this.setColour(this.getColour(),this.getColourSecondary(),a.getColourTertiary())):b?(this.workspace.getCanvas().appendChild(c),
|
|
this.translate(d.x,d.y)):b&&(this.workspace.getCanvas().appendChild(c),this.translate(d.x,d.y))}}};
|
|
Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var a=0,b=0,c=this.useDragSurface_?this.workspace.blockDragSurface_.getGroup():null,d=this.getSvgRoot();if(d){do{var e=Blockly.utils.getRelativeXY(d);a+=e.x;b+=e.y;this.useDragSurface_&&this.workspace.blockDragSurface_.getCurrentBlock()==d&&(e=this.workspace.blockDragSurface_.getSurfaceTranslation(),a+=e.x,b+=e.y);d=d.parentNode}while(d&&d!=this.workspace.getCanvas()&&d!=c)}return new Blockly.utils.Coordinate(a,b)};
|
|
Blockly.BlockSvg.prototype.moveBy=function(a,b){if(this.parentBlock_)throw Error("Block has parent.");var c=Blockly.Events.isEnabled();if(c)var d=new Blockly.Events.BlockMove(this);var e=this.getRelativeToSurfaceXY();this.translate(e.x+a,e.y+b);this.moveConnections_(a,b);c&&(d.recordNew(),Blockly.Events.fire(d));this.workspace.resizeContents()};Blockly.BlockSvg.prototype.translate=function(a,b){this.getSvgRoot().setAttribute("transform","translate("+a+","+b+")")};
|
|
Blockly.BlockSvg.prototype.moveToDragSurface_=function(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.blockDragSurface_.translateSurface(a.x,a.y);this.workspace.blockDragSurface_.setBlocksAndShow(this.getSvgRoot())}};Blockly.BlockSvg.prototype.moveOffDragSurface_=function(a){this.useDragSurface_&&(this.translate(a.x,a.y),this.workspace.blockDragSurface_.clearAndHide(this.workspace.getCanvas()))};
|
|
Blockly.BlockSvg.prototype.moveDuringDrag=function(a){this.useDragSurface_?this.workspace.blockDragSurface_.translateSurface(a.x,a.y):(this.svgGroup_.translate_="translate("+a.x+","+a.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))};Blockly.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")};
|
|
Blockly.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&!this.workspace.isDragging()&&!this.getParent()&&!this.isInFlyout){var a=this.workspace.getGrid();if(a&&a.shouldSnap()){var b=a.getSpacing(),c=b/2,d=this.getRelativeToSurfaceXY();a=Math.round((d.x-c)/b)*b+c-d.x;b=Math.round((d.y-c)/b)*b+c-d.y;a=Math.round(a);b=Math.round(b);0==a&&0==b||this.moveBy(a,b)}}};
|
|
Blockly.BlockSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(this),b=this.getHeightWidth(),c=a.y,d=a.y+b.height;if(this.RTL){var e=a.x-b.width;a=a.x}else e=a.x,a=a.x+b.width;this.startHat_&&(c-=Blockly.BlockSvg.START_HAT_HEIGHT);return new Blockly.utils.Rect(c,d,e,a)};Blockly.BlockSvg.prototype.setOpacity=function(a){this.opacity_=a;this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.getOpacity=function(){return this.opacity_};
|
|
Blockly.BlockSvg.prototype.setCollapsed=function(a){if(this.collapsed_!=a){for(var b=[],c=0,d;d=this.inputList[c];c++)b.push.apply(b,d.setVisible(!a));if(a){d=this.getIcons();for(c=0;c<d.length;c++)d[c].setVisible(!1);c=this.toString(Blockly.COLLAPSE_CHARS);this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(c).init();d=this.getDescendants(!0);if(c=this.getNextBlock())c=d.indexOf(c),d.splice(c,d.length-c);c=1;for(var e;e=d[c];c++)if(e.warning){this.setWarningText(Blockly.Msg.COLLAPSED_WARNINGS_WARNING,
|
|
Blockly.BlockSvg.COLLAPSED_WARNING_ID);break}}else this.removeInput("_TEMP_COLLAPSED_INPUT"),this.warning&&(this.warning.setText("",Blockly.BlockSvg.COLLAPSED_WARNING_ID),Object.keys(this.warning.text_).length||this.setWarningText(null));Blockly.BlockSvg.superClass_.setCollapsed.call(this,a);b.length||(b[0]=this);if(this.rendered)for(c=0;e=b[c];c++)e.render()}};
|
|
Blockly.BlockSvg.prototype.tab=function(a,b){var c=this.createTabList_(),d=c.indexOf(a);-1==d&&(d=b?-1:c.length);(c=c[b?d+1:d-1])?c instanceof Blockly.Field?c.showEditor_():c.tab(null,b):(c=this.outputConnection&&this.outputConnection.targetBlock())?c.tab(this,b):(c=b?this.getNextBlock():this.getPreviousBlock())&&c.tab(this,b)};
|
|
Blockly.BlockSvg.prototype.createTabList_=function(){for(var a=[],b=0,c;c=this.inputList[b];b++){for(var d=0,e;e=c.fieldRow[d];d++)e instanceof Blockly.FieldTextInput&&a.push(e);c.connection&&(c=c.connection.targetBlock())&&a.push(c)}return a};Blockly.BlockSvg.prototype.onMouseDown_=function(a){var b=this.workspace&&this.workspace.getGesture(a);b&&b.handleBlockStart(a,this)};Blockly.BlockSvg.prototype.showHelp_=function(){var a="function"==typeof this.helpUrl?this.helpUrl():this.helpUrl;a&&alert(a)};
|
|
Blockly.BlockSvg.prototype.generateContextMenu=function(){if(this.workspace.options.readOnly||!this.contextMenu)return null;var a=this,b=[];if(!this.isInFlyout){this.isDeletable()&&this.isMovable()&&b.push(Blockly.ContextMenu.blockDuplicateOption(a));this.workspace.options.comments&&!this.collapsed_&&this.isEditable()&&b.push(Blockly.ContextMenu.blockCommentOption(a));if(this.isMovable())if(this.collapsed_)this.workspace.options.collapse&&(c={enabled:!0},c.text=Blockly.Msg.EXPAND_BLOCK,c.callback=
|
|
function(){a.setCollapsed(!1)},b.push(c));else{if(this.workspace.options.inline)for(var c=1;c<this.inputList.length;c++)if(this.inputList[c-1].type!=Blockly.NEXT_STATEMENT&&this.inputList[c].type!=Blockly.NEXT_STATEMENT){c={enabled:!0};var d=this.getInputsInline();c.text=d?Blockly.Msg.EXTERNAL_INPUTS:Blockly.Msg.INLINE_INPUTS;c.callback=function(){a.setInputsInline(!d)};b.push(c);break}this.workspace.options.collapse&&(c={enabled:!0},c.text=Blockly.Msg.COLLAPSE_BLOCK,c.callback=function(){a.setCollapsed(!0)},
|
|
b.push(c))}this.workspace.options.disable&&this.isEditable()&&(c={text:this.isEnabled()?Blockly.Msg.DISABLE_BLOCK:Blockly.Msg.ENABLE_BLOCK,enabled:!this.getInheritedDisabled(),callback:function(){var b=Blockly.Events.getGroup();b||Blockly.Events.setGroup(!0);a.setEnabled(!a.isEnabled());b||Blockly.Events.setGroup(!1)}},b.push(c));this.isDeletable()&&b.push(Blockly.ContextMenu.blockDeleteOption(a))}b.push(Blockly.ContextMenu.blockHelpOption(a));this.customContextMenu&&this.customContextMenu(b);return b};
|
|
Blockly.BlockSvg.prototype.showContextMenu_=function(a){if(this.parentBlock_&&this.isShadow_&&!Blockly.pxtBlocklyUtils.isShadowArgumentReporter(this))this.parentBlock_.showContextMenu_(a);else{var b=this.generateContextMenu();b&&b.length&&(Blockly.ContextMenu.show(a,b,this.RTL),Blockly.ContextMenu.currentBlock=this)}};
|
|
Blockly.BlockSvg.prototype.moveConnections_=function(a,b){if(this.rendered){for(var c=this.getConnections_(!1),d=0;d<c.length;d++)c[d].moveBy(a,b);c=this.getIcons();for(d=0;d<c.length;d++)c[d].computeIconLocation();for(d=0;d<this.childBlocks_.length;d++)this.childBlocks_[d].moveConnections_(a,b)}};
|
|
Blockly.BlockSvg.prototype.setDragging=function(a){if(a){var b=this.getSvgRoot();b.translate_="";b.skew_="";Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0));Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDragging")}else Blockly.draggingConnections_=[],Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDragging");for(b=0;b<this.childBlocks_.length;b++)this.childBlocks_[b].setDragging(a)};
|
|
Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDraggable"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDraggable")};Blockly.BlockSvg.prototype.setMovable=function(a){Blockly.BlockSvg.superClass_.setMovable.call(this,a);a||this.unselect();this.updateMovable()};Blockly.BlockSvg.prototype.setEditable=function(a){Blockly.BlockSvg.superClass_.setEditable.call(this,a);a=this.getIcons();for(var b=0;b<a.length;b++)a[b].updateEditable()};
|
|
Blockly.BlockSvg.prototype.setShadow=function(a){Blockly.BlockSvg.superClass_.setShadow.call(this,a);this.updateColour()};Blockly.BlockSvg.prototype.setInsertionMarker=function(a,b){this.isInsertionMarker_!=a&&(this.isInsertionMarker_=a)&&(Blockly.BlockSvg.superClass_.setInsertionMarker.call(this,a),this.insertionMarkerMinWidth_=b,this.setColour(Blockly.Colours.insertionMarker),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyInsertionMarker"))};Blockly.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_};
|
|
Blockly.BlockSvg.prototype.dispose=function(a,b){if(this.workspace){Blockly.Tooltip.hide();Blockly.Field.startCache();var c=this.workspace;Blockly.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture());Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide();b&&this.rendered&&(this.unplug(a),Blockly.blockAnimations.disposeUiEffect(this));this.rendered=!1;if(this.warningTextDb_){for(var d in this.warningTextDb_)clearTimeout(this.warningTextDb_[d]);this.warningTextDb_=null}this.unplug(a);
|
|
var e;Blockly.Events.isEnabled()&&(e=new Blockly.Events.BlockDelete(this));Blockly.Events.disable();try{var f=this.getIcons();for(d=0;d<f.length;d++)f[d].dispose();Blockly.BlockSvg.superClass_.dispose.call(this,a)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&e&&Blockly.Events.fire(e);Blockly.utils.dom.removeNode(this.svgGroup_);c.resizeContents();this.svgPath_=this.svgGroup_=null;Blockly.Field.stopCache()}};
|
|
Blockly.BlockSvg.prototype.updateColour=function(){if(this.isEnabled()){this.isShadow()?this.setShadowColour_():(this.setBorderColour_(),this.svgPath_.setAttribute("fill",this.getColour()));for(var a=this.getIcons(),b=0;b<a.length;b++)a[b].updateColour();for(a=0;b=this.inputList[a];a++)for(var c=0,d;d=b.fieldRow[c];c++)d.updateColour()}};
|
|
Blockly.BlockSvg.prototype.setBorderColour_=function(){var a=this.getColourBorder();a.colourBorder?(this.svgPathLight_.style.display="none",this.svgPathDark_.style.display="none",this.svgPath_.setAttribute("stroke",a.colourBorder)):(this.svgPathLight_.style.display="",this.svgPathDark_.style.display="",this.svgPath_.setAttribute("stroke","none"),this.svgPathLight_.setAttribute("stroke",a.colourLight),this.svgPathDark_.setAttribute("fill",a.colourDark))};
|
|
Blockly.BlockSvg.prototype.setShadowColour_=function(){var a=this.getColourShadow();this.svgPathLight_.style.display="none";this.svgPathDark_.setAttribute("fill",a);this.svgPath_.setAttribute("stroke","none");this.svgPath_.setAttribute("fill",a);return a};
|
|
Blockly.BlockSvg.prototype.updateDisabled=function(){!this.isEnabled()||this.getInheritedDisabled()?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDisabled")&&this.svgPath_.setAttribute("fill","url(#"+this.workspace.options.disabledPatternId+")"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDisabled")&&this.updateColour();for(var a=this.getChildren(!1),b=0,c;c=a[b];b++)c.updateDisabled()};
|
|
Blockly.BlockSvg.prototype.getCommentText=function(){return this.comment?this.comment.getText().replace(/\s+$/,"").replace(/ +\n/g,"\n"):""};Blockly.BlockSvg.prototype.enableBreakpoint=function(a){var b=!1;a?this.breakpoint||(this.breakpoint=new Blockly.Breakpoint(this),b=!0,this.breakpoint.enableBreakpoint()):this.breakpoint&&(this.breakpoint.dispose(),b=!0);b&&this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
Blockly.BlockSvg.prototype.setCommentText=function(a){var b=!1;"string"==typeof a?(this.comment||(this.comment=new Blockly.Comment(this),b=!0),this.comment.setText(a)):this.comment&&(this.comment.dispose(),b=!0);b&&this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
Blockly.BlockSvg.prototype.setWarningText=function(a,b){this.warningTextDb_||(this.warningTextDb_=Object.create(null));var c=b||"";if(c)this.warningTextDb_[c]&&(clearTimeout(this.warningTextDb_[c]),delete this.warningTextDb_[c]);else for(var d in this.warningTextDb_)clearTimeout(this.warningTextDb_[d]),delete this.warningTextDb_[d];if(this.workspace.isDragging()){var e=this;this.warningTextDb_[c]=setTimeout(function(){e.workspace&&(delete e.warningTextDb_[c],e.setWarningText(a,c))},100)}else{this.isInFlyout&&
|
|
(a=null);d=this.getSurroundParent();for(var f=null;d;)d.isCollapsed()&&(f=d),d=d.getSurroundParent();f&&f.setWarningText(Blockly.Msg.COLLAPSED_WARNINGS_WARNING,Blockly.BlockSvg.COLLAPSED_WARNING_ID);d=!1;"string"==typeof a?(this.warning||(this.warning=new Blockly.Warning(this),d=!0),this.warning.setText(a,c)):this.warning&&!c?(this.warning.dispose(),d=!0):this.warning&&(d=this.warning.getText(),this.warning.setText("",c),(f=this.warning.getText())||this.warning.dispose(),d=d!=f);d&&this.rendered&&
|
|
(this.render(),this.bumpNeighbours_())}};Blockly.BlockSvg.prototype.setMutator=function(a){this.mutator&&this.mutator!==a&&this.mutator.dispose();a&&(a.block_=this,this.mutator=a,a.createIcon())};Blockly.BlockSvg.prototype.setDisabled=function(a){console.warn("Deprecated call to Blockly.BlockSvg.prototype.setDisabled, use Blockly.BlockSvg.prototype.setEnabled instead.");this.setEnabled(!a)};
|
|
Blockly.BlockSvg.prototype.setEnabled=function(a){this.isEnabled()!=a&&(Blockly.BlockSvg.superClass_.setEnabled.call(this,a),this.rendered&&this.updateDisabled())};Blockly.BlockSvg.prototype.setHighlighted=function(a){this.rendered&&(a?this.svgPath_.setAttribute("filter","url(#"+this.workspace.options.embossFilterId+")"):(this.svgPath_.setAttribute("filter","none"),this.svgPathLight_.style.display="inline"))};
|
|
Blockly.BlockSvg.prototype.addSelect=function(){Blockly.utils.dom.addClass(this.svgGroup_,"blocklySelected");this.setSelectedBlock(!0)};Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.utils.dom.removeClass(this.svgGroup_,"blocklySelected");this.setSelectedBlock(!1)};Blockly.BlockSvg.prototype.setDeleteStyle=function(a){a?Blockly.utils.dom.addClass(this.svgGroup_,"blocklyDraggingDelete"):Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyDraggingDelete")};
|
|
Blockly.BlockSvg.prototype.setColour=function(a,b,c){Blockly.BlockSvg.superClass_.setColour.call(this,a,b,c);this.rendered&&this.updateColour()};Blockly.BlockSvg.prototype.bringToFront=function(){var a=this;do{var b=a.getSvgRoot();b.parentNode.appendChild(b);a=a.getParent()}while(a)};Blockly.BlockSvg.prototype.setPreviousStatement=function(a,b){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
Blockly.BlockSvg.prototype.setNextStatement=function(a,b){Blockly.BlockSvg.superClass_.setNextStatement.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setOutput=function(a,b){Blockly.BlockSvg.superClass_.setOutput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.setInputsInline=function(a){Blockly.BlockSvg.superClass_.setInputsInline.call(this,a);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
Blockly.BlockSvg.prototype.removeInput=function(a,b){Blockly.BlockSvg.superClass_.removeInput.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(a,b){Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_())};
|
|
Blockly.BlockSvg.prototype.appendInput_=function(a,b){var c=Blockly.BlockSvg.superClass_.appendInput_.call(this,a,b);this.rendered&&(this.render(),this.bumpNeighbours_());return c};Blockly.BlockSvg.prototype.getConnections_=function(a){var b=[];if(a||this.rendered)if(this.outputConnection&&b.push(this.outputConnection),this.previousConnection&&b.push(this.previousConnection),this.nextConnection&&b.push(this.nextConnection),a||!this.collapsed_){a=0;for(var c;c=this.inputList[a];a++)c.connection&&b.push(c.connection)}return b};
|
|
Blockly.BlockSvg.prototype.makeConnection_=function(a){return new Blockly.RenderedConnection(this,a)};
|
|
Blockly.BlockSvg.prototype.bumpNeighbours_=function(){if(this.workspace&&!this.workspace.isDragging()){var a=this.getRootBlock();if(!a.isInFlyout)for(var b=this.getConnections_(!1),c=0,d;d=b[c];c++){d.isConnected()&&d.isSuperior()&&d.targetBlock().bumpNeighbours_();for(var e=d.neighbours_(Blockly.SNAP_RADIUS),f=0,g;g=e[f];f++)d.isConnected()&&g.isConnected()||g.getSourceBlock().getRootBlock()!=a&&(d.isSuperior()?g.bumpAwayFrom_(d):d.bumpAwayFrom_(g))}}};
|
|
Blockly.BlockSvg.prototype.scheduleSnapAndBump=function(){var a=this,b=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(b);a.snapToGrid();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY/2);setTimeout(function(){Blockly.Events.setGroup(b);a.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)};
|
|
Blockly.BlockSvg.prototype.bindReporterHoverEvents_=function(){var a=this;Blockly.bindEvent_(this.svgGroup_,"mouseover",null,function(b){var c=a;if(!c.isInFlyout){for(;c.isShadow_&&c.parentBlock_;)c=c.parentBlock_;c.parentBlock_&&c.outputConnection&&(Blockly.utils.dom.addClass(c.svgPath_,"blocklyReporterHover"),b.stopPropagation())}});Blockly.bindEvent_(this.svgGroup_,"mouseout",null,function(){a.isInFlyout||Blockly.utils.dom.removeClass(a.svgPath_,"blocklyReporterHover")})};
|
|
Blockly.BlockSvg.prototype.getHeightWidth=function(){console.warn("method is overriden by block_render_svg.js")};Blockly.BlockSvg.prototype.render=function(a){console.warn("method is overriden by block_render_svg.js",a)};Blockly.BlockSvg.render={};Blockly.BlockSvg.PathObject=function(){this.steps=[];this.highlightSteps=[];this.inlineSteps=[];this.highlightInlineSteps=[]};Blockly.BlockSvg.GRID_UNIT=4;Blockly.BlockSvg.TAB_WIDTH=8;Blockly.BlockSvg.SEP_SPACE_X=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.SEP_SPACE_Y=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X=16*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X_OUTPUT=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X_SHADOW_OUTPUT=10*Blockly.BlockSvg.GRID_UNIT;
|
|
Blockly.BlockSvg.MIN_BLOCK_Y=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT=40*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_Y_SINGLE_FIELD_OUTPUT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT=6*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.NOTCH_WIDTH=8*Blockly.BlockSvg.GRID_UNIT;
|
|
Blockly.BlockSvg.NOTCH_HEIGHT=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.STATEMENT_INPUT_EDGE_WIDTH=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.START_HAT=!0;Blockly.BlockSvg.START_HAT_HEIGHT=16;Blockly.BlockSvg.ICON_SEPARATOR_HEIGHT=10*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.START_HAT_PATH="c 25,-22 71,-22 96,0";Blockly.BlockSvg.NOTCH_PATH_LEFT="c 2,0 3,1 4,2 l 4,4 c 1,1 2,2 4,2 h 12 c 2,0 3,-1 4,-2 l 4,-4 c 1,-1 2,-2 4,-2";
|
|
Blockly.BlockSvg.NOTCH_PATH_RIGHT="c -2,0 -3,1 -4,2 l -4,4 c -1,1 -2,2 -4,2 h -12 c -2,0 -3,-1 -4,-2 l -4,-4 c -1,-1 -2,-2 -4,-2";Blockly.BlockSvg.NOTCH_START_PADDING=3*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TOP_LEFT_CORNER_START="m 0,"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",0";
|
|
Blockly.BlockSvg.TOP_RIGHT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.BOTTOM_RIGHT_CORNER=" a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
|
|
Blockly.BlockSvg.BOTTOM_LEFT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS;Blockly.BlockSvg.INNER_TOP_LEFT_CORNER=" a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 -"+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
|
|
Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS;
|
|
Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL="M "+4*Blockly.BlockSvg.GRID_UNIT+",0 h "+4*Blockly.BlockSvg.GRID_UNIT+" l "+4*Blockly.BlockSvg.GRID_UNIT+","+4*Blockly.BlockSvg.GRID_UNIT+" l "+-4*Blockly.BlockSvg.GRID_UNIT+","+4*Blockly.BlockSvg.GRID_UNIT+" h "+-4*Blockly.BlockSvg.GRID_UNIT+" l "+-4*Blockly.BlockSvg.GRID_UNIT+","+-4*Blockly.BlockSvg.GRID_UNIT+" l "+4*Blockly.BlockSvg.GRID_UNIT+","+-4*Blockly.BlockSvg.GRID_UNIT+" z";Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;
|
|
Blockly.BlockSvg.INPUT_SHAPE_SQUARE=Blockly.BlockSvg.TOP_LEFT_CORNER_START+Blockly.BlockSvg.TOP_LEFT_CORNER+" h "+(12*Blockly.BlockSvg.GRID_UNIT-2*Blockly.BlockSvg.CORNER_RADIUS)+Blockly.BlockSvg.TOP_RIGHT_CORNER+" v "+(8*Blockly.BlockSvg.GRID_UNIT-2*Blockly.BlockSvg.CORNER_RADIUS)+Blockly.BlockSvg.BOTTOM_RIGHT_CORNER+" h "+(-12*Blockly.BlockSvg.GRID_UNIT+2*Blockly.BlockSvg.CORNER_RADIUS)+Blockly.BlockSvg.BOTTOM_LEFT_CORNER+" z";Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH=10*Blockly.BlockSvg.GRID_UNIT;
|
|
Blockly.BlockSvg.INPUT_SHAPE_ROUND="M "+4*Blockly.BlockSvg.GRID_UNIT+",0 h "+4*Blockly.BlockSvg.GRID_UNIT+" a "+4*Blockly.BlockSvg.GRID_UNIT+" "+4*Blockly.BlockSvg.GRID_UNIT+" 0 0 1 0 "+8*Blockly.BlockSvg.GRID_UNIT+" h "+-4*Blockly.BlockSvg.GRID_UNIT+" a "+4*Blockly.BlockSvg.GRID_UNIT+" "+4*Blockly.BlockSvg.GRID_UNIT+" 0 0 1 0 -"+8*Blockly.BlockSvg.GRID_UNIT+" z";Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.INPUT_SHAPE_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;
|
|
Blockly.BlockSvg.FIELD_HEIGHT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_WIDTH=6*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.EDITABLE_FIELD_PADDING=6;Blockly.BlockSvg.BOX_FIELD_PADDING=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.DROPDOWN_ARROW_PADDING=2*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_WIDTH_MIN_EDIT=8*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_WIDTH_MAX_EDIT=Infinity;Blockly.BlockSvg.FIELD_HEIGHT_MAX_EDIT=Blockly.BlockSvg.FIELD_HEIGHT;
|
|
Blockly.BlockSvg.FIELD_TOP_PADDING=Blockly.BlockSvg.GRID_UNIT+2;Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS=1*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS=4*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.MAX_DISPLAY_LENGTH=Infinity;Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X=12*Blockly.BlockSvg.GRID_UNIT;Blockly.BlockSvg.INLINE_PADDING_Y=1*Blockly.BlockSvg.GRID_UNIT;
|
|
Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_INITIAL=12;Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_FINAL=12;Blockly.BlockSvg.FIELD_TEXTINPUT_EXPAND_PAST_TRUNCATION=!1;Blockly.BlockSvg.FIELD_TEXTINPUT_ANIMATE_POSITIONING=!1;
|
|
Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING={1:{0:5*Blockly.BlockSvg.GRID_UNIT,1:2*Blockly.BlockSvg.GRID_UNIT,2:5*Blockly.BlockSvg.GRID_UNIT,3:5*Blockly.BlockSvg.GRID_UNIT},2:{0:3*Blockly.BlockSvg.GRID_UNIT,1:3*Blockly.BlockSvg.GRID_UNIT,2:1*Blockly.BlockSvg.GRID_UNIT,3:2*Blockly.BlockSvg.GRID_UNIT},3:{0:2*Blockly.BlockSvg.GRID_UNIT,1:2*Blockly.BlockSvg.GRID_UNIT,2:2*Blockly.BlockSvg.GRID_UNIT,3:2*Blockly.BlockSvg.GRID_UNIT}};
|
|
Blockly.BlockSvg.prototype.updateColour=function(){var a=this.getColourTertiary(),b=this.isShadow()&&!Blockly.pxtBlocklyUtils.isShadowArgumentReporter(this);b&&this.parentBlock_&&(a=this.parentBlock_.getColourTertiary(),this.inputList[0]&&this.inputList[0].fieldRow[0]&&(this.inputList[0].fieldRow[0]instanceof Blockly.FieldColour||this.inputList[0].fieldRow[0]instanceof Blockly.FieldColourSlider)&&(a=Blockly.Colours.colourPickerStroke));this.svgPath_.setAttribute("stroke",a);a=this.isGlowingBlock_||
|
|
b?this.getShadowColour()?this.getShadowColour():this.getColourSecondary():this.getColour();this.svgPath_.setAttribute("fill",a);this.svgPath_.setAttribute("fill-opacity",this.getOpacity());for(b=0;a=this.inputList[b];b++)a.outlinePath&&a.outlinePath.setAttribute("fill",this.getColourTertiary());a=this.getIcons();for(b=0;b<a.length;b++)a[b].updateColour();for(b=0;a=this.inputList[b];b++)for(var c=0,d;d=a.fieldRow[c];c++)d.setText(null)};
|
|
Blockly.BlockSvg.prototype.getHeightWidth=function(){var a=this.height,b=this.width,c=this.getNextBlock();c&&(c=c.getHeightWidth(),a+=c.height,a-=Blockly.BlockSvg.NOTCH_HEIGHT,b=Math.max(b,c.width));return{height:a,width:b}};
|
|
Blockly.BlockSvg.prototype.render=function(a){Blockly.Field.startCache();this.rendered=!0;var b=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(b=-b);for(var c=this.getIcons(),d=0;d<c.length;d++)b=c[d].renderIcon(b);b+=this.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X;c=this.renderCompute_(b);this.renderDraw_(b,c);this.renderMoveConnections_();this.renderClassify_();!1!==a&&((a=this.getParent())?a.render(!0):Blockly.resizeSvgContents(this.workspace));Blockly.Field.stopCache()};
|
|
Blockly.BlockSvg.prototype.renderFields_=function(a,b,c,d){this.RTL&&(b=-b);for(var e=0,f;f=a[e];e++){var g=f.getSvgRoot();if(g){!this.previousConnection||f instanceof Blockly.FieldLabel||f instanceof Blockly.FieldImage||0!=d||(b=this.RTL?Math.min(b,-Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X):Math.max(b,Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X));var h=-f.getSize().height/2,k="";if(this.RTL){var l=b-=f.renderSep+f.renderWidth;h=c+h;f.renderWidth&&(b-=Blockly.BlockSvg.SEP_SPACE_X)}else l=b+f.renderSep,h=
|
|
c+h,f.renderWidth&&(b+=f.renderSep+f.renderWidth+Blockly.BlockSvg.SEP_SPACE_X);this.RTL&&f instanceof Blockly.FieldImage&&f.getFlipRtl()&&(k="scale(-1 1)",l+=f.renderWidth);g.setAttribute("transform","translate("+l+", "+h+") "+k);this.isInsertionMarker()&&g.setAttribute("display","none")}}return this.RTL?-b:b};
|
|
Blockly.BlockSvg.prototype.renderCompute_=function(a){var b=this.inputList,c=[];c.rightEdge=0;for(var d=c.bottomEdge=0,e=!1,f=!1,g=!1,h=void 0,k=this.getInputsInline(),l,m=0,n;n=b[m];m++)if(n.isVisible()){if(k&&h&&h!=Blockly.NEXT_STATEMENT&&n.type!=Blockly.NEXT_STATEMENT)var p=c[c.length-1];else h=n.type,p=this.createRowForInput_(n),c.push(p);p.push(n);n.renderHeight=this.computeInputHeight_(n,p,l);n.renderWidth=this.computeInputWidth_(n);p.statementNotchAtBottom=!0;n.connection&&n.connection.type===
|
|
Blockly.NEXT_STATEMENT&&(l=n.connection.targetBlock())&&!l.lastConnectionInStack()&&(p.statementNotchAtBottom=!1);if(n.connection){l=n.connection.targetBlock();var q=0;l?(q=l.getHeightWidth(),l=q.height,q=q.width):l=Blockly.BlockSvg.INPUT_SHAPE_HEIGHT;n.connection.type===Blockly.INPUT_VALUE&&(l+=2*Blockly.BlockSvg.INLINE_PADDING_Y);n.connection.type===Blockly.NEXT_STATEMENT&&p.statementNotchAtBottom&&(l-=Blockly.BlockSvg.NOTCH_HEIGHT);n.renderHeight=Math.max(n.renderHeight,l);n.renderWidth=Math.max(n.renderWidth,
|
|
q)}p.height=Math.max(p.height,n.renderHeight);n.fieldWidth=0;1==c.length&&(n.fieldWidth+=this.RTL?-a:a);l=!1;q=0;for(var r;r=n.fieldRow[q];q++){0!=q&&(n.fieldWidth+=Blockly.BlockSvg.SEP_SPACE_X);var t=r.getSize();r.renderWidth=t.width;r.renderSep=l&&r.EDITABLE?Blockly.BlockSvg.SEP_SPACE_X:0;n.fieldWidth+=r.renderWidth+r.renderSep;p.height=Math.max(p.height,t.height);l=r.EDITABLE}p.type!=Blockly.BlockSvg.INLINE&&(p.type==Blockly.NEXT_STATEMENT?(f=!0,d=Math.max(d,n.fieldWidth)):p.type==Blockly.INPUT_VALUE?
|
|
e=!0:p.type==Blockly.DUMMY_INPUT&&(g=!0));l=p}for(m=0;m<c.length;m++)c.bottomEdge+=c[m].height;this.computeOutputPadding_(c);c.statementEdge=Blockly.BlockSvg.STATEMENT_INPUT_EDGE_WIDTH+d;c.rightEdge=this.computeRightEdge_(c.rightEdge,f);c.hasValue=e;c.hasStatement=f;c.hasDummy=g;return c};
|
|
Blockly.BlockSvg.prototype.computeInputWidth_=function(a){if(a.type!=Blockly.INPUT_VALUE||a.connection&&a.connection.isConnected())return 0;switch(a.connection.getOutputShape()){case Blockly.OUTPUT_SHAPE_SQUARE:return Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH;case Blockly.OUTPUT_SHAPE_ROUND:return Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH;case Blockly.OUTPUT_SHAPE_HEXAGONAL:return Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH;default:return 0}};
|
|
Blockly.BlockSvg.prototype.computeInputHeight_=function(a,b,c){return 1===this.inputList.length&&this.outputConnection&&this.isShadow()?Blockly.BlockSvg.MIN_BLOCK_Y_SINGLE_FIELD_OUTPUT:this.outputConnection?Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER:b.type==Blockly.NEXT_STATEMENT?Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT:c&&c.type==Blockly.NEXT_STATEMENT?Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y:Blockly.BlockSvg.MIN_BLOCK_Y};
|
|
Blockly.BlockSvg.prototype.createRowForInput_=function(a){var b=[];b.type=a.type!=Blockly.NEXT_STATEMENT?Blockly.BlockSvg.INLINE:a.type;b.height=0;b.paddingStart=Blockly.BlockSvg.SEP_SPACE_X;b.paddingEnd=Blockly.BlockSvg.SEP_SPACE_X;return b};
|
|
Blockly.BlockSvg.prototype.computeRightEdge_=function(a,b){var c=a;this.previousConnection||this.nextConnection?c=Math.max(c,Blockly.BlockSvg.MIN_BLOCK_X):this.outputConnection&&(c=this.isShadow()&&!Blockly.pxtBlocklyUtils.isShadowArgumentReporter(this)?Math.max(c,Blockly.BlockSvg.MIN_BLOCK_X_SHADOW_OUTPUT):Math.max(c,Blockly.BlockSvg.MIN_BLOCK_X_OUTPUT));b&&(c=Math.max(c,Blockly.BlockSvg.MIN_BLOCK_X_WITH_STATEMENT));0<this.insertionMarkerMinWidth_&&(c=Math.max(c,this.insertionMarkerMinWidth_));return c};
|
|
Blockly.BlockSvg.prototype.computeOutputPadding_=function(a){if(this.getOutputShape()&&this.outputConnection&&(!this.isShadow()||Blockly.pxtBlocklyUtils.isShadowArgumentReporter(this)))for(var b=this.getOutputShape(),c=0,d;d=a[c];c++){d.paddingStart=0;d.paddingEnd=0;var e=d[0];if(e.fieldRow[0])var f=0;else f=e.connection,f=f.targetConnection?f.targetConnection.getSourceBlock().getOutputShape():f.getOutputShape(),b==Blockly.OUTPUT_SHAPE_HEXAGONAL&&f!=Blockly.OUTPUT_SHAPE_HEXAGONAL&&(e=e.renderHeight-
|
|
Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER,d.paddingStart+=e/2);d.paddingStart+=Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING[b][f];e=d[d.length-1];e.connection?(f=e.connection,f=f.targetConnection?f.targetConnection.getSourceBlock().getOutputShape():f.getOutputShape(),b==Blockly.OUTPUT_SHAPE_HEXAGONAL&&f!=Blockly.OUTPUT_SHAPE_HEXAGONAL&&(e=e.renderHeight-Blockly.BlockSvg.MIN_BLOCK_Y_REPORTER,d.paddingEnd+=e/2)):f=0;d.paddingEnd+=Blockly.BlockSvg.SHAPE_IN_SHAPE_PADDING[b][f];b==Blockly.OUTPUT_SHAPE_ROUND&&1<
|
|
a.length&&0<a.bottomEdge&&(f=a.bottomEdge/2,f*=1-Math.sin(Math.acos((f-2*Blockly.BlockSvg.GRID_UNIT)/f)),d.paddingStart+=f,d.paddingEnd+=f)}};
|
|
Blockly.BlockSvg.prototype.renderDraw_=function(a,b){this.squareTopLeftCorner_=this.startHat_=!1;this.outputConnection||this.previousConnection||!Blockly.BlockSvg.START_HAT&&!this.getStartHat()||(this.startHat_=this.squareTopLeftCorner_=!0,b.rightEdge=Math.max(b.rightEdge,100));this.edgeShapeWidth_=0;this.edgeShape_=null;if(this.outputConnection){var c=this.getOutputShape();if(c===Blockly.OUTPUT_SHAPE_HEXAGONAL||c===Blockly.OUTPUT_SHAPE_ROUND)this.edgeShapeWidth_=b.bottomEdge/2,this.edgeShape_=c,
|
|
this.squareTopLeftCorner_=!0}c=new Blockly.BlockSvg.PathObject;this.renderDrawTop_(c,b.rightEdge);var d=this.renderDrawRight_(c,b,a);this.renderDrawBottom_(c,d);this.renderDrawLeft_(c);this.setPaths_(c)};
|
|
Blockly.BlockSvg.prototype.setPaths_=function(a){a=a.steps.join(" ");this.svgPath_.setAttribute("d",a);this.svgPathWarningHighlight_&&this.svgPathWarningHighlight_.setAttribute("d",a);this.svgPathHighlight_&&this.svgPathHighlight_.setAttribute("d",a);this.svgPathSelected_&&this.svgPathSelected_.setAttribute("d",a);this.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathWarningHighlight_&&this.svgPathWarningHighlight_.setAttribute("transform","scale(-1 1)"),this.svgPathHighlight_&&
|
|
this.svgPathHighlight_.setAttribute("transform","scale(-1 1)"),this.svgPathSelected_&&this.svgPathSelected_.setAttribute("transform","scale(-1 1)"))};
|
|
Blockly.BlockSvg.prototype.renderClassify_=function(){var a=[];if(this.outputConnection)this.isShadow_?a.push("argument"):a.push("reporter"),this.edgeShape_===Blockly.OUTPUT_SHAPE_HEXAGONAL?a.push("boolean"):this.edgeShape_===Blockly.OUTPUT_SHAPE_ROUND&&a.push("round");else{for(var b=this.inputList,c=0,d=0,e;e=b[d];d++)e.connection&&e.connection.type===Blockly.NEXT_STATEMENT&&c++;c&&(a.push("c-block"),a.push("c-"+c));this.startHat_?a.push("hat"):c||a.push("stack");this.nextConnection||a.push("end")}this.svgGroup_.setAttribute("data-shapes",
|
|
a.join(" "))};Blockly.BlockSvg.prototype.renderMoveConnections_=function(){var a=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(a);this.outputConnection&&this.outputConnection.moveToOffset(a);for(var b=0;b<this.inputList.length;b++){var c=this.inputList[b].connection;c&&(c.moveToOffset(a),c.isConnected()&&c.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(a),this.nextConnection.isConnected()&&this.nextConnection.tighten_())};
|
|
Blockly.BlockSvg.prototype.renderDrawTop_=function(a,b){var c=a.steps;this.squareTopLeftCorner_?(c.push("m 0,0"),this.startHat_&&c.push(Blockly.BlockSvg.START_HAT_PATH),this.edgeShapeWidth_&&c.push("m "+this.edgeShapeWidth_+",0")):(c.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),c.push(Blockly.BlockSvg.TOP_LEFT_CORNER));this.previousConnection&&(c.push("H",Blockly.BlockSvg.NOTCH_START_PADDING),c.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),this.previousConnection.setOffsetInBlock(this.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:
|
|
Blockly.BlockSvg.NOTCH_WIDTH,0));this.width=b};
|
|
Blockly.BlockSvg.prototype.renderDrawRight_=function(a,b,c){function d(){0<g&&(k.edgeShape_?a.steps.push("H",h-k.edgeShapeWidth_):(a.steps.push("H",h-Blockly.BlockSvg.CORNER_RADIUS-k.edgeShapeWidth_),a.steps.push(Blockly.BlockSvg.TOP_RIGHT_CORNER)),k.edgeShape_||a.steps.push("v",g-2*Blockly.BlockSvg.CORNER_RADIUS),g=0)}var e={x:0,y:0},f={x:0,y:0},g=0,h=0,k=this,l=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(l=-l);for(var m=this.getIcons(),n=0;n<m.length;n++)l=m[n].moveIcon(l,(e.y+b[0].height)/2-24);for(l=
|
|
0;m=b[l];l++)e.x=m.paddingStart,0==l&&(e.x+=this.RTL?-c:c),m.type==Blockly.BlockSvg.INLINE?(g+=this.renderInlineRow_(a,m,e,f,b,l),h=e.x):m.type==Blockly.NEXT_STATEMENT&&(d(),this.renderStatementInput_(a,m,e,f,b,l)),e.y+=m.height;d();this.drawEdgeShapeRight_(a);b.length||(e.y=Blockly.BlockSvg.MIN_BLOCK_Y,a.steps.push("V",e.y));return e.y};
|
|
Blockly.BlockSvg.prototype.renderInputShape_=function(a,b,c){var d=a.outlinePath;d&&(a.connection.targetConnection?d.setAttribute("style","visibility: hidden"):(a=Blockly.BlockSvg.getInputShapeInfo_(a.connection.getOutputShape()),b=this.RTL?-b-a.width:b,c-=Blockly.BlockSvg.INPUT_SHAPE_HEIGHT/2,d.setAttribute("d",a.path),d.setAttribute("transform","translate("+b+","+c+")"),d.setAttribute("data-argument-type",a.argType),d.setAttribute("style","visibility: visible")))};
|
|
Blockly.BlockSvg.prototype.renderDrawBottom_=function(a,b){var c=a.steps;this.height=b;this.edgeShape_||c.push(Blockly.BlockSvg.BOTTOM_RIGHT_CORNER);this.nextConnection&&(c.push("H",Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.NOTCH_START_PADDING+Blockly.BlockSvg.CORNER_RADIUS," "),c.push(Blockly.BlockSvg.NOTCH_PATH_RIGHT),this.nextConnection.setOffsetInBlock(this.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:Blockly.BlockSvg.NOTCH_WIDTH,b),this.height+=Blockly.BlockSvg.NOTCH_HEIGHT);this.edgeShape_?c.push("H",
|
|
this.edgeShapeWidth_):(c.push("H",Blockly.BlockSvg.CORNER_RADIUS),c.push(Blockly.BlockSvg.BOTTOM_LEFT_CORNER))};
|
|
Blockly.BlockSvg.prototype.renderDrawLeft_=function(a){a=a.steps;this.outputConnection&&this.outputConnection.setOffsetInBlock(0,this.height/2);this.edgeShape_&&(this.edgeShape_===Blockly.OUTPUT_SHAPE_ROUND?a.push("a "+this.edgeShapeWidth_+" "+this.edgeShapeWidth_+" 0 0 1 0 -"+2*this.edgeShapeWidth_):this.edgeShape_===Blockly.OUTPUT_SHAPE_HEXAGONAL&&a.push("l "+-this.edgeShapeWidth_+" "+-this.edgeShapeWidth_+" l "+this.edgeShapeWidth_+" "+-this.edgeShapeWidth_));a.push("z")};
|
|
Blockly.BlockSvg.prototype.renderInlineRow_=function(a,b,c,d,e,f){a=0;for(var g;g=b[a];a++){var h=c.y+b.height/2,k=Blockly.BlockSvg.getAlignedCursor_(c.x,g,e.rightEdge);c.x=this.renderFields_(g.fieldRow,k,h,f);g.type==Blockly.INPUT_VALUE&&(this.previousConnection&&(c.x=Math.max(c.x,Blockly.BlockSvg.INPUT_AND_FIELD_MIN_X)),d.x=this.RTL?-c.x:c.x,h=b.height/2,d.y=c.y+h,g.connection.setOffsetInBlock(d.x,d.y),this.renderInputShape_(g,c.x,c.y+h),c.x+=g.renderWidth+Blockly.BlockSvg.SEP_SPACE_X,g.connection.renderedWidth_=
|
|
g.renderWidth)}c.x-=Blockly.BlockSvg.SEP_SPACE_X;c.x+=b.paddingEnd;e.rightEdge=Math.max(c.x,e.rightEdge);c.x=Math.max(c.x,e.rightEdge);this.width=Math.max(this.width,c.x);return b.height};
|
|
Blockly.BlockSvg.prototype.renderStatementInput_=function(a,b,c,d,e,f){var g=a.steps,h=b[0],k=c.x,l=c.y;l+=Blockly.BlockSvg.MIN_STATEMENT_INPUT_HEIGHT/2;this.renderFields_(h.fieldRow,k,l,f);c.x=e.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH;Blockly.BlockSvg.drawStatementInputFromTopRight_(a,c.x,e.rightEdge,b);d.x=this.RTL?-c.x:c.x;h.connection.setOffsetInBlock(d.x,c.y);h.connection.isConnected()&&(this.width=Math.max(this.width,e.statementEdge+h.connection.targetBlock().getHeightWidth().width));if(f==
|
|
e.length-1||e[f+1].type==Blockly.NEXT_STATEMENT)g.push(Blockly.BlockSvg.TOP_RIGHT_CORNER),g.push("v",Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y-2*Blockly.BlockSvg.CORNER_RADIUS),c.y+=Blockly.BlockSvg.EXTRA_STATEMENT_ROW_Y};
|
|
Blockly.BlockSvg.prototype.drawEdgeShapeRight_=function(a){a=a.steps;this.edgeShape_&&(this.edgeShape_===Blockly.OUTPUT_SHAPE_ROUND?a.push("a "+this.edgeShapeWidth_+" "+this.edgeShapeWidth_+" 0 0 1 0 "+2*this.edgeShapeWidth_):this.edgeShape_===Blockly.OUTPUT_SHAPE_HEXAGONAL&&a.push("l "+this.edgeShapeWidth_+" "+this.edgeShapeWidth_+" l "+-this.edgeShapeWidth_+" "+this.edgeShapeWidth_))};
|
|
Blockly.BlockSvg.prototype.positionNewBlock=function(a,b,c){b.type!=Blockly.NEXT_STATEMENT&&b.type!=Blockly.INPUT_VALUE||a.moveBy(c.x_-b.x_,c.y_-b.y_)};Blockly.BlockSvg.drawStatementInputFromTopRight_=function(a,b,c,d){var e=a.steps;Blockly.BlockSvg.drawStatementInputTop_(a,b);e.push("v",d.height-2*Blockly.BlockSvg.CORNER_RADIUS);Blockly.BlockSvg.drawStatementInputBottom_(a,c,d)};
|
|
Blockly.BlockSvg.drawStatementInputTop_=function(a,b){var c=a.steps;c.push(Blockly.BlockSvg.BOTTOM_RIGHT_CORNER);c.push("H",b+Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE+2*Blockly.BlockSvg.CORNER_RADIUS);c.push(Blockly.BlockSvg.NOTCH_PATH_RIGHT);c.push("h","-"+Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE);c.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER)};
|
|
Blockly.BlockSvg.drawStatementInputBottom_=function(a,b,c){a=a.steps;a.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER);c.statementNotchAtBottom&&(a.push("h ",Blockly.BlockSvg.STATEMENT_INPUT_INNER_SPACE),a.push(Blockly.BlockSvg.NOTCH_PATH_LEFT));a.push("H",b-Blockly.BlockSvg.CORNER_RADIUS)};
|
|
Blockly.BlockSvg.getInputShapeInfo_=function(a){switch(a){case Blockly.OUTPUT_SHAPE_HEXAGONAL:a=Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL;var b=Blockly.BlockSvg.INPUT_SHAPE_HEXAGONAL_WIDTH;var c="boolean";break;case Blockly.OUTPUT_SHAPE_ROUND:a=Blockly.BlockSvg.INPUT_SHAPE_ROUND;b=Blockly.BlockSvg.INPUT_SHAPE_ROUND_WIDTH;c="round";break;default:a=Blockly.BlockSvg.INPUT_SHAPE_SQUARE,b=Blockly.BlockSvg.INPUT_SHAPE_SQUARE_WIDTH,c="square"}return{path:a,argType:c,width:b}};
|
|
Blockly.BlockSvg.getAlignedCursor_=function(a,b,c){b.align===Blockly.ALIGN_RIGHT?a=Math.max(a,c-b.fieldWidth-Blockly.BlockSvg.SEP_SPACE_X):b.align===Blockly.ALIGN_CENTRE&&(a=Math.max(a,c/2-b.fieldWidth/2));return a};
|
|
Blockly.BlockSvg.prototype.highlightForReplacement=function(a){a?(this.svgPath_.setAttribute("filter","url(#"+(this.workspace.options.replacementGlowFilterId||"blocklyReplacementGlowFilter")+")"),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyReplaceable")):(this.svgPath_.removeAttribute("filter"),Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyReplaceable"))};
|
|
Blockly.BlockSvg.prototype.highlightShapeForInput=function(a,b){var c=this.getInputWithConnection(a);if(!c)throw"No input found for the connection";c.outlinePath&&(b?(c.outlinePath.setAttribute("filter","url(#"+(this.workspace.options.replacementGlowFilterId||"blocklyReplacementGlowFilter")+")"),Blockly.utils.dom.addClass(this.svgGroup_,"blocklyReplaceable")):(c.outlinePath.removeAttribute("filter"),Blockly.utils.dom.removeClass(this.svgGroup_,"blocklyReplaceable")))};Blockly.FieldTextInput=function(a,b,c){a=this.doClassValidation_(a);null===a&&(a="");Blockly.FieldTextInput.superClass_.constructor.call(this,a,b);this.setRestrictor(c);this.addArgType("text")};goog.inherits(Blockly.FieldTextInput,Blockly.Field);Blockly.FieldTextInput.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);b=new Blockly.FieldTextInput(b,a["class"]);"boolean"===typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};Blockly.FieldTextInput.ANIMATION_TIME=.25;
|
|
Blockly.FieldTextInput.TEXT_MEASURE_PADDING_MAGIC=45;Blockly.FieldTextInput.prototype.htmlInput_=null;Blockly.FieldTextInput.prototype.SERIALIZABLE=!0;Blockly.FieldTextInput.FONTSIZE=11;Blockly.FieldTextInput.prototype.CURSOR="text";Blockly.FieldTextInput.prototype.spellcheck_=!0;Blockly.FieldTextInput.prototype.autoCapitalize_=!0;
|
|
Blockly.FieldTextInput.prototype.init=function(){if(!this.fieldGroup_){var a=!this.sourceBlock_.isShadow()&&this.sourceBlock_.inputList&&1<this.sourceBlock_.inputList.length;a&&(this.className_+=" blocklyEditableLabel");Blockly.FieldTextInput.superClass_.init.call(this);a&&(this.box_=Blockly.utils.dom.createSvgElement("rect",{rx:Blockly.BlockSvg.CORNER_RADIUS,ry:Blockly.BlockSvg.CORNER_RADIUS,x:0,y:0,width:this.size_.width,height:this.size_.height,fill:Blockly.Colours.textField,stroke:this.sourceBlock_.getColourTertiary()}),
|
|
this.fieldGroup_.insertBefore(this.box_,this.textElement_));this.sourceBlock_.isEditable()&&this.sourceBlock_.getOutputShape()==Blockly.OUTPUT_SHAPE_ROUND&&(this.mouseOverWrapper_=Blockly.bindEventWithChecks_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_),this.mouseOutWrapper_=Blockly.bindEventWithChecks_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_))}};
|
|
Blockly.FieldTextInput.prototype.onMouseOver_=function(a){this.sourceBlock_.isInFlyout||(a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||this.sourceBlock_.svgPath_&&Blockly.utils.dom.addClass(this.sourceBlock_.svgPath_,"blocklyFieldHover")};Blockly.FieldTextInput.prototype.onMouseOut_=function(a){this.sourceBlock_.isInFlyout||(a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||this.sourceBlock_.svgPath_&&Blockly.utils.dom.removeClass(this.sourceBlock_.svgPath_,"blocklyFieldHover")};
|
|
Blockly.FieldTextInput.prototype.dispose=function(){this.mouseOverWrapper_&&(Blockly.unbindEvent_(this.mouseOverWrapper_),this.mouseOverWrapper_=null);this.mouseOutWrapper_&&(Blockly.unbindEvent_(this.mouseOutWrapper_),this.mouseOutWrapper_=null);Blockly.WidgetDiv.hideIfOwner(this);Blockly.FieldTextInput.superClass_.dispose.call(this)};Blockly.FieldTextInput.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};
|
|
Blockly.FieldTextInput.prototype.doValueInvalid_=function(a){this.isBeingEdited_&&(this.isTextValid_=!1,a=this.value_,this.value_=this.htmlInput_.untypedDefaultValue_,this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,a,this.value_)))};Blockly.FieldTextInput.prototype.doValueUpdate_=function(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.text_=String(a),this.isDirty_=!0)};
|
|
Blockly.FieldTextInput.prototype.render_=function(){Blockly.FieldTextInput.superClass_.render_.call(this);this.isBeingEdited_&&(this.resizeEditor_(),this.isTextValid_?Blockly.utils.dom.removeClass(this.htmlInput_,"blocklyInvalidInput"):Blockly.utils.dom.addClass(this.htmlInput_,"blocklyInvalidInput"))};Blockly.FieldTextInput.prototype.setSpellcheck=function(a){this.spellcheck_=a};Blockly.FieldTextInput.prototype.setAutoCapitalize=function(a){this.autoCapitalize_=a};
|
|
Blockly.FieldTextInput.prototype.setRestrictor=function(a){this.restrictor_=a};Blockly.FieldTextInput.prototype.showEditor_=function(a,b,c,d,e){this.workspace_=this.sourceBlock_.workspace;a=b||!1;c=c||!1;!a&&(Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(a,c,d,e)};Blockly.FieldTextInput.prototype.showPromptEditor_=function(){var a=this;Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.text_,function(b){a.setValue(b)})};
|
|
Blockly.FieldTextInput.prototype.showInlineEditor_=function(a,b,c,d){this.isBeingEdited_=!0;Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_(b,c,d);d&&d.call(this);a||(this.focus(),this.htmlInput_.setSelectionRange(0,99999))};
|
|
Blockly.FieldTextInput.prototype.widgetCreate_=function(a,b,c){var d=Blockly.WidgetDiv.DIV;Blockly.utils.dom.addClass(d,"fieldTextInput");var e=document.createElement("input");e.className="blocklyHtmlInput";e.setAttribute("spellcheck",this.spellcheck_);a&&e.setAttribute("readonly","true");this.autoCapitalize_||e.setAttribute("autocapitalize","none");e.style.fontSize=Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_FINAL+"pt";d.appendChild(e);b&&(this.sourceBlock_.RTL?e.style.paddingLeft=this.arrowSize_+
|
|
Blockly.BlockSvg.DROPDOWN_ARROW_PADDING+"px":e.style.paddingRight=this.arrowSize_+Blockly.BlockSvg.DROPDOWN_ARROW_PADDING+"px",a=document.createElement("img"),a.className="blocklyTextDropDownArrow",a.style.width=this.arrowSize_+"px",a.style.height=this.arrowSize_+"px",a.style.top=this.arrowY_+"px",a.style.cursor="pointer",this.sourceBlock_.RTL?a.style.left="11px":a.style.right="11px",c&&(e.dropDownArrowMouseWrapper_=Blockly.bindEventWithChecks_(a,"mousedown",this,c)),d.appendChild(a));e.value=e.defaultValue=
|
|
this.value_;e.untypedDefaultValue_=this.value_;e.oldValue_=null;this.resizeEditor_();this.bindInputEvents_(e);return e};
|
|
Blockly.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;this.value_!==this.text_&&(this.text_=String(this.value_),this.isTextValid_=!0,this.forceRerender());if(this.onFinishEditing_)this.onFinishEditing_(this.value_);this.unbindInputEvents_();this.htmlInput_.dropDownArrowMouseWrapper_&&Blockly.unbindEvent_(this.htmlInput_.dropDownArrowMouseWrapper_);Blockly.Events.setGroup(!1);this.htmlInput_.style.fontSize=Blockly.BlockSvg.FIELD_TEXTINPUT_FONTSIZE_INITIAL+"pt";var a=Blockly.WidgetDiv.DIV;
|
|
Blockly.utils.dom.removeClass(a,"fieldTextInput");a.style={}};
|
|
Blockly.FieldTextInput.prototype.bindInputEvents_=function(a){this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyUpWrapper_=Blockly.bindEventWithChecks_(a,"keyup",this,this.onHtmlInputChange_);this.onKeyPressWrapper_=Blockly.bindEventWithChecks_(a,"keypress",this,this.onHtmlInputChange_);this.onInputWrapper_=Blockly.bindEventWithChecks_(a,"input",this,this.onHtmlInputChange_);this.onWorkspaceChangeWrapper_=this.resizeEditor_.bind(this);this.workspace_.addChangeListener(this.onWorkspaceChangeWrapper_)};
|
|
Blockly.FieldTextInput.prototype.unbindInputEvents_=function(){Blockly.unbindEvent_(this.onKeyDownWrapper_);Blockly.unbindEvent_(this.onKeyUpWrapper_);Blockly.unbindEvent_(this.onKeyPressWrapper_);Blockly.unbindEvent_(this.onInputWrapper_);this.workspace_.removeChangeListener(this.onWorkspaceChangeWrapper_)};
|
|
Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_=function(a){13==a.keyCode?(Blockly.WidgetDiv.hide(!0),Blockly.DropDownDiv.hideWithoutAnimation()):27==a.keyCode?(this.htmlInput_.value=this.htmlInput_.defaultValue,Blockly.WidgetDiv.hide(),Blockly.DropDownDiv.hideWithoutAnimation()):9==a.keyCode&&(Blockly.WidgetDiv.hide(!0),Blockly.DropDownDiv.hideWithoutAnimation(),this.sourceBlock_.tab(this,!a.shiftKey),a.preventDefault())};Blockly.FieldTextInput.GECKO_KEYCODE_WHITELIST=[97,99,118,120];
|
|
Blockly.FieldTextInput.prototype.onHtmlInputChange_=function(a){if("keypress"===a.type&&this.restrictor_){var b=!1;if(Blockly.utils.userAgent.GECKO){var c=a.charCode;if(32>c||127==c)b=!0;else if(a.metaKey||a.ctrlKey)b=-1<Blockly.FieldTextInput.GECKO_KEYCODE_WHITELIST.indexOf(c)}else c=a.keyCode;c=String.fromCharCode(c);if(!b&&!this.restrictor_.test(c)&&a.preventDefault){a.preventDefault();return}}a=this.htmlInput_.value;a!==this.htmlInput_.oldValue_?(this.htmlInput_.oldValue_=a,Blockly.Events.setGroup(!0),
|
|
this.setValue(a)):Blockly.utils.userAgent.WEBKIT&&this.sourceBlock_.render();this.text_=this.htmlInput_.value;this.forceRerender();Blockly.Events.setGroup(!1);this.resizeEditor_()};Blockly.FieldTextInput.prototype.focus=function(){this.htmlInput_.focus();this.htmlInput_.select()};
|
|
Blockly.FieldTextInput.prototype.resizeEditor_=function(){var a=this.sourceBlock_.workspace.scale,b=Blockly.WidgetDiv.DIV;var c=this.sourceBlock_.isShadow()||1==this.getTotalFields_()?this.sourceBlock_.getHeightWidth().width*a:this.size_.width*a;if(Blockly.BlockSvg.FIELD_TEXTINPUT_EXPAND_PAST_TRUNCATION){var d=Blockly.pxtBlocklyUtils.measureText(this.htmlInput_.style.fontSize,this.htmlInput_.style.fontFamily,this.htmlInput_.style.fontWeight,this.htmlInput_.value);d+=Blockly.FieldTextInput.TEXT_MEASURE_PADDING_MAGIC;
|
|
d*=a}else d=c;d=Math.max(d,Blockly.BlockSvg.FIELD_WIDTH_MIN_EDIT*a);d=Math.min(d,Blockly.BlockSvg.FIELD_WIDTH_MAX_EDIT*a);var e=1==this.getTotalFields_()?this.sourceBlock_.getHeightWidth().height:Blockly.BlockSvg.FIELD_HEIGHT;b.style.width=d/a+1+"px";b.style.height=e+1+"px";b.style.transform="scale("+a+")";b.style.marginLeft=-.5*(d-c)+"px";c=this.getBorderRadius()+.5;b.style.borderRadius=c+"px";c=this.sourceBlock_.getColourTertiary();b.style.borderColor=c;c=this.getAbsoluteXY_();c.x-=a/2;c.y-=a/2;
|
|
this.sourceBlock_.RTL&&(c.x+=d,c.x-=b.offsetWidth*a,c.x+=1*a);c.y+=1*a;Blockly.utils.userAgent.GECKO&&Blockly.WidgetDiv.DIV.style.top&&(c.x+=2*a,c.y+=1*a);Blockly.utils.userAgent.WEBKIT&&(c.y-=1*a);b.style.left=c.x+"px";b.style.top=c.y+"px"};Blockly.FieldTextInput.prototype.getBorderRadius=function(){return this.sourceBlock_.getOutputShape()==Blockly.OUTPUT_SHAPE_ROUND?Blockly.BlockSvg.NUMBER_FIELD_CORNER_RADIUS:Blockly.BlockSvg.TEXT_FIELD_CORNER_RADIUS};
|
|
Blockly.FieldTextInput.prototype.maybeSaveEdit_=function(){var a=this.htmlInput_,b=a.value;if(this.sourceBlock_)if(b=this.callValidator(b),null===b)b=a.defaultValue;else if(this.onFinishEditing_)this.onFinishEditing_(b);this.setText(b);this.sourceBlock_.rendered&&this.sourceBlock_.render();this.sourceBlock_.workspace&&Blockly.Events.fire(new Blockly.Events.Ui(this.sourceBlock_,"saveEdit",void 0,b))};
|
|
Blockly.FieldTextInput.numberValidator=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=parseFloat(a||0);return isNaN(a)?null:String(a)};Blockly.FieldTextInput.nonnegativeIntegerValidator=function(a){(a=Blockly.FieldTextInput.numberValidator(a))&&(a=String(Math.max(0,Math.floor(a))));return a};Blockly.Field.register("field_input",Blockly.FieldTextInput);Blockly.FieldAngle=function(a,b){a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldAngle.superClass_.constructor.call(this,a,b);this.addArgType("angle")};goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput);Blockly.FieldAngle.fromJson=function(a){return new Blockly.FieldAngle(a.angle)};Blockly.FieldAngle.prototype.SERIALIZABLE=!0;Blockly.FieldAngle.ROUND=15;Blockly.FieldAngle.HALF=60;Blockly.FieldAngle.CLOCKWISE=!0;Blockly.FieldAngle.OFFSET=90;Blockly.FieldAngle.WRAP=180;
|
|
Blockly.FieldAngle.HANDLE_RADIUS=10;Blockly.FieldAngle.ARROW_WIDTH=Blockly.FieldAngle.HANDLE_RADIUS;Blockly.FieldAngle.RADIUS=Blockly.FieldAngle.HALF-Blockly.FieldAngle.HANDLE_RADIUS-1;Blockly.FieldAngle.CENTER_RADIUS=2;Blockly.FieldAngle.ARROW_SVG_DATAURI="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgd2lkdGg9IjhweCIKICAgaGVpZ2h0PSIxMHB4IgogICB2aWV3Qm94PSIwIDAgOCAxMCIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0ic3ZnMiIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMC45MSByMTM3MjUiCiAgIHNvZGlwb2RpOmRvY25hbWU9ImFycm93LnN2ZyI+CiAgPG1ldGFkYXRhCiAgICAgaWQ9Im1ldGFkYXRhMTYiPgogICAgPHJkZjpSREY+CiAgICAgIDxjYzpXb3JrCiAgICAgICAgIHJkZjphYm91dD0iIj4KICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4KICAgICAgICA8ZGM6dHlwZQogICAgICAgICAgIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+CiAgICAgIDwvY2M6V29yaz4KICAgIDwvcmRmOlJERj4KICA8L21ldGFkYXRhPgogIDxzb2RpcG9kaTpuYW1lZHZpZXcKICAgICBwYWdlY29sb3I9IiNmZmZmZmYiCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgYm9yZGVyb3BhY2l0eT0iMSIKICAgICBvYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGdyaWR0b2xlcmFuY2U9IjEwIgogICAgIGd1aWRldG9sZXJhbmNlPSIxMCIKICAgICBpbmtzY2FwZTpwYWdlb3BhY2l0eT0iMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTE3OSIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSI3MTAiCiAgICAgaWQ9Im5hbWVkdmlldzE0IgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyMy42IgogICAgIGlua3NjYXBlOmN4PSI0IgogICAgIGlua3NjYXBlOmN5PSI1IgogICAgIGlua3NjYXBlOndpbmRvdy14PSIwIgogICAgIGlua3NjYXBlOndpbmRvdy15PSIwIgogICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjAiCiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0ic3ZnMiIgLz4KICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQzLjIgKDM5MDY5KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICA8dGl0bGUKICAgICBpZD0idGl0bGU0Ij5hcnJvdzwvdGl0bGU+CiAgPGRlc2MKICAgICBpZD0iZGVzYzYiPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogIDxkZWZzCiAgICAgaWQ9ImRlZnM4IiAvPgogIDxnCiAgICAgaWQ9IlBhZ2UtMSIKICAgICBzdHJva2U9Im5vbmUiCiAgICAgc3Ryb2tlLXdpZHRoPSIxIgogICAgIGZpbGw9Im5vbmUiCiAgICAgZmlsbC1ydWxlPSJldmVub2RkIgogICAgIHRyYW5zZm9ybT0icm90YXRlKDkwLCA0LCA1KSIKICAgICBzdHlsZT0iZmlsbDojMDAwMDAwIj4KICAgIDxnCiAgICAgICBpZD0iYXJyb3ciCiAgICAgICB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNC4wMDAwMDAsIC0zLjAwMDAwMCkiCiAgICAgICBmaWxsPSIjNEM5N0ZGIgogICAgICAgc3R5bGU9ImZpbGw6IzAwMDAwMCI+CiAgICAgIDxwYXRoCiAgICAgICAgIGQ9Ik04LjAxODkxMDgzLDYuNjgyMjMwNTUgTDMuNTA5OTE2MDEsNy40MzM3Mjk2OSBDMy4yNDY3OTEzMSw3LjQ3NzU4MzggMy4wMTg5MTA4Myw3LjczOTQyMTUxIDMuMDE4OTEwODMsOC4wMTU1NjM4OCBDMy4wMTg5MTA4Myw4LjI4MzYzMDI5IDMuMjM4NzQxMzQsOC41NTIyMDIzIDMuNTA5OTE2MDEsOC41OTczOTgwOCBMOC4wMTg5MTA4Myw5LjM0ODg5NzIyIEw4LjAxODkxMDgzLDExLjAxODUzMzcgQzguMDE4OTEwODMsMTEuNTYyNTI3NiA4LjM4MzI2Njg2LDExLjc1MjAwMzIgOC44MzI3MjI3OSwxMS40MjY4ODQ3IEwxMi42NDEwMTc2LDguNjcyMTE1ODcgQzEzLjA5ODE2MzgsOC4zNDE0MzQ1NSAxMy4wOTU3MjIzLDcuODE0NzA1MTggMTIuNjUyNzQxMSw3LjQ4MzIwODA2IEw4LjgyMDk5OTM2LDQuNjE1NzkyNTMgQzguMzc1NTc2NjQsNC4yODI0NjgzOCA4LjAxODkxMDgzLDQuNDYxOTQ5NDggOC4wMTg5MTA4Myw1LjAxMjU5NDAyIEw4LjAxODkxMDgzLDYuNjgyMjMwNTUgWiIKICAgICAgICAgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoOC4wMDE2NzMsIDguMDE3MjM3KSByb3RhdGUoLTkwLjAwMDAwMCkgdHJhbnNsYXRlKC04LjAwMTY3MywgLTguMDE3MjM3KSAiCiAgICAgICAgIGlkPSJwYXRoMTIiCiAgICAgICAgIHN0eWxlPSJmaWxsOiMwMDAwMDAiIC8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K";
|
|
Blockly.FieldAngle.prototype.initView=function(){Blockly.FieldAngle.superClass_.initView.call(this);this.symbol_=Blockly.utils.dom.createSvgElement("tspan",{},null);this.symbol_.appendChild(document.createTextNode("\u00b0"));this.textElement_.appendChild(this.symbol_)};Blockly.FieldAngle.prototype.render_=function(){Blockly.FieldAngle.superClass_.render_.call(this);this.updateGraph_()};
|
|
Blockly.FieldAngle.prototype.showEditor_=function(){Blockly.FieldAngle.superClass_.showEditor_.call(this,Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD);Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();var a=this.dropdownCreate_();Blockly.DropDownDiv.getContentDiv().appendChild(a);a=this.sourceBlock_.getColourBorder();a=a.colourBorder||a.colourLight;Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(),a);Blockly.DropDownDiv.showPositionedByField(this,
|
|
this.dropdownDispose_.bind(this));this.updateGraph_()};
|
|
Blockly.FieldAngle.prototype.dropdownCreate_=function(){var a=Blockly.utils.dom.createSvgElement("svg",{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1",height:2*Blockly.FieldAngle.HALF+"px",width:2*Blockly.FieldAngle.HALF+"px"},null),b=Blockly.utils.dom.createSvgElement("circle",{cx:Blockly.FieldAngle.HALF,cy:Blockly.FieldAngle.HALF,r:Blockly.FieldAngle.RADIUS,"class":"blocklyAngleCircle"},a);this.gauge_=Blockly.utils.dom.createSvgElement("path",
|
|
{"class":"blocklyAngleGauge"},a);this.line_=Blockly.utils.dom.createSvgElement("line",{x1:Blockly.FieldAngle.HALF,y1:Blockly.FieldAngle.HALF,"class":"blocklyAngleLine"},a);var c=Math.PI*Blockly.FieldAngle.OFFSET/180;Blockly.utils.dom.createSvgElement("line",{x1:Blockly.FieldAngle.HALF,y1:Blockly.FieldAngle.HALF,x2:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS*Math.cos(c),y2:Blockly.FieldAngle.HALF-Blockly.FieldAngle.RADIUS*Math.sin(c),"class":"blocklyAngleLine"},a);for(c=0;360>c;c+=15)Blockly.utils.dom.createSvgElement("line",
|
|
{x1:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS-13,y1:Blockly.FieldAngle.HALF,x2:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS-7,y2:Blockly.FieldAngle.HALF,"class":"blocklyAngleMarks",transform:"rotate("+c+","+Blockly.FieldAngle.HALF+","+Blockly.FieldAngle.HALF+")"},a);Blockly.utils.dom.createSvgElement("circle",{cx:Blockly.FieldAngle.HALF,cy:Blockly.FieldAngle.HALF,r:Blockly.FieldAngle.CENTER_RADIUS,"class":"blocklyAngleCenterPoint"},a);this.handle_=Blockly.utils.dom.createSvgElement("g",
|
|
{},a);Blockly.utils.dom.createSvgElement("circle",{cx:0,cy:0,r:Blockly.FieldAngle.HANDLE_RADIUS,"class":"blocklyAngleDragHandle"},this.handle_);this.arrowSvg_=Blockly.utils.dom.createSvgElement("image",{width:Blockly.FieldAngle.ARROW_WIDTH,height:Blockly.FieldAngle.ARROW_WIDTH,x:-Blockly.FieldAngle.ARROW_WIDTH/2,y:-Blockly.FieldAngle.ARROW_WIDTH/2},this.handle_);this.arrowSvg_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.FieldAngle.ARROW_SVG_DATAURI);Blockly.DropDownDiv.setColour(this.sourceBlock_.parentBlock_.getColour(),
|
|
this.sourceBlock_.getColourTertiary());Blockly.DropDownDiv.setCategory(this.sourceBlock_.parentBlock_.getCategory());Blockly.DropDownDiv.showPositionedByBlock(this,this.sourceBlock_);this.clickWrapper_=Blockly.bindEvent_(a,"click",this,this.hide_);this.moveWrapper1_=Blockly.bindEvent_(b,"mousemove",this,this.onMouseMove);this.moveWrapper2_=Blockly.bindEvent_(this.gauge_,"mousemove",this,this.onMouseMove);return a};
|
|
Blockly.FieldAngle.prototype.onMouseDown=function(){this.mouseMoveWrapper_=Blockly.bindEvent_(document.body,"mousemove",this,this.onMouseMove);this.mouseUpWrapper_=Blockly.bindEvent_(document.body,"mouseup",this,this.onMouseUp)};Blockly.FieldAngle.prototype.onMouseUp=function(){Blockly.unbindEvent_(this.mouseMoveWrapper_);Blockly.unbindEvent_(this.mouseUpWrapper_)};
|
|
Blockly.FieldAngle.prototype.onMouseMove=function(a){a.preventDefault();var b=this.gauge_.ownerSVGElement.getBoundingClientRect(),c=a.clientX-b.left-Blockly.FieldAngle.HALF;b=a.clientY-b.top-Blockly.FieldAngle.HALF;a=Math.atan(-b/c);isNaN(a)||(a=Blockly.utils.math.toDegrees(a),0>c?a+=180:0<b&&(a+=360),a=Blockly.FieldAngle.CLOCKWISE?Blockly.FieldAngle.OFFSET+360-a:360-(Blockly.FieldAngle.OFFSET-a),360<a&&(a-=360),Blockly.FieldAngle.ROUND&&(a=Math.round(a/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND),
|
|
a>Blockly.FieldAngle.WRAP&&(a-=360),c=String(a),c!=this.text_&&(this.htmlInput_.value=a,this.setValue(a),this.text_=c,this.forceRerender()))};
|
|
Blockly.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var a=Number(this.getText())+Blockly.FieldAngle.OFFSET;a%=360;var b=Blockly.utils.math.toRadians(a),c=["M ",Blockly.FieldAngle.HALF,",",Blockly.FieldAngle.HALF],d=Blockly.FieldAngle.HALF,e=Blockly.FieldAngle.HALF;if(!isNaN(b)){var f=Blockly.utils.math.toRadians(Blockly.FieldAngle.OFFSET),g=Math.cos(f)*Blockly.FieldAngle.RADIUS,h=Math.sin(f)*-Blockly.FieldAngle.RADIUS;Blockly.FieldAngle.CLOCKWISE&&(b=2*f-b);d+=Math.cos(b)*Blockly.FieldAngle.RADIUS;
|
|
e-=Math.sin(b)*Blockly.FieldAngle.RADIUS;b=180<Math.abs(a-Blockly.FieldAngle.OFFSET)?1:0;f=Number(Blockly.FieldAngle.CLOCKWISE);a<Blockly.FieldAngle.OFFSET&&(f=1-f);c.push(" l ",g,",",h," A ",Blockly.FieldAngle.RADIUS,",",Blockly.FieldAngle.RADIUS," 0 ",b," ",f," ",d,",",e," z");this.arrowSvg_.setAttribute("transform","rotate("+(Blockly.FieldAngle.CLOCKWISE?a+2*Blockly.FieldAngle.OFFSET:-a)+")")}this.gauge_.setAttribute("d",c.join(""));this.line_.setAttribute("x2",d);this.line_.setAttribute("y2",
|
|
e);this.handle_.setAttribute("transform","translate("+d+","+e+")")}};Blockly.FieldAngle.prototype.doClassValidation_=function(a){if(isNaN(a))return null;a=parseFloat(a||0);a%=360;0>a&&(a+=360);a>Blockly.FieldAngle.WRAP&&(a-=360);return a};Blockly.Field.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b){a=this.doClassValidation_(a);null===a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b);this.size_.width=Blockly.FieldCheckbox.WIDTH;this.addArgType("checkbox")};goog.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked)};Blockly.FieldCheckbox.WIDTH=5;Blockly.FieldCheckbox.CHECK_CHAR="\u2713";Blockly.FieldCheckbox.CHECK_X_OFFSET=-3;
|
|
Blockly.FieldCheckbox.CHECK_Y_OFFSET=14;Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0;Blockly.FieldCheckbox.prototype.CURSOR="default";Blockly.FieldCheckbox.prototype.isDirty_=!1;
|
|
Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this);this.textElement_.setAttribute("x",Blockly.FieldCheckbox.CHECK_X_OFFSET);this.textElement_.setAttribute("y",Blockly.FieldCheckbox.CHECK_Y_OFFSET);Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox");var a=document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);this.textElement_.appendChild(a);this.textElement_.style.display=this.value_?"block":"none"};
|
|
Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)};Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"};
|
|
Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.Field.register("field_checkbox",Blockly.FieldCheckbox);Blockly.utils.colour={};
|
|
Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;b="0x"==a.substring(0,2)?"#"+a.substring(2):a;b="#"==b[0]?b:"#"+b;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?Blockly.utils.colour.rgbToHex(a,b,
|
|
c):null};Blockly.utils.colour.rgbToHex=function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};Blockly.utils.colour.rgbArrayToHex=function(a){return Blockly.utils.colour.rgbToHex(a[0],a[1],a[2])};Blockly.utils.colour.hexToRgb=function(a){a=Blockly.utils.colour.parse(a);if(!a)return[0,0,0];a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]};
|
|
Blockly.utils.colour.hsvToHex=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return Blockly.utils.colour.rgbToHex(Math.floor(d),Math.floor(e),Math.floor(f))};Blockly.hueToRgb=function(a){return Blockly.utils.colour.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};
|
|
Blockly.utils.colour.blend=function(a,b,c){a=Blockly.utils.colour.hexToRgb(Blockly.utils.colour.parse(a));b=Blockly.utils.colour.hexToRgb(Blockly.utils.colour.parse(b));return Blockly.utils.colour.rgbToHex(Math.round(b[0]+c*(a[0]-b[0])),Math.round(b[1]+c*(a[1]-b[1])),Math.round(b[2]+c*(a[2]-b[2])))};Blockly.utils.colour.darken=function(a,b){return Blockly.utils.colour.blend("#000000",a,b)};Blockly.utils.colour.lighten=function(a,b){return Blockly.utils.colour.blend("#ffffff",a,b)};
|
|
Blockly.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};Blockly.FieldColour=function(a,b){a=this.doClassValidation_(a);Blockly.FieldColour.superClass_.constructor.call(this,a,b);this.addArgType("colour")};goog.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour)};Blockly.FieldColour.DEFAULT_WIDTH=16;Blockly.FieldColour.DEFAULT_HEIGHT=12;Blockly.FieldColour.prototype.SERIALIZABLE=!0;Blockly.FieldColour.prototype.CURSOR="default";Blockly.FieldColour.prototype.isDirty_=!1;
|
|
Blockly.FieldColour.prototype.colours_=null;Blockly.FieldColour.prototype.titles_=null;Blockly.FieldColour.prototype.columns_=0;Blockly.FieldColour.prototype.colorPicker_=null;Blockly.FieldColour.prototype.DROPDOWN_BORDER_COLOUR="silver";Blockly.FieldColour.prototype.DROPDOWN_BACKGROUND_COLOUR="white";
|
|
Blockly.FieldColour.prototype.initView=function(){this.size_=new goog.math.Size(Blockly.FieldColour.DEFAULT_WIDTH,Blockly.FieldColour.DEFAULT_HEIGHT);this.createBorderRect_();this.borderRect_.style.fillOpacity=0;this.sourceBlock_&&this.setValue(this.getValue())};Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)};
|
|
Blockly.FieldColour.prototype.doValueUpdate_=function(a){this.value_=a;this.borderRect_&&(this.borderRect_.style.fill=a);this.sourceBlock_&&this.sourceBlock_.setColour(a,a,a)};Blockly.FieldColour.prototype.getText=function(){var a=this.value_;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};Blockly.FieldColour.prototype.getSize=function(){return new goog.math.Size(Blockly.BlockSvg.FIELD_WIDTH,Blockly.BlockSvg.FIELD_HEIGHT)};Blockly.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" ");
|
|
Blockly.FieldColour.TITLES=[];Blockly.FieldColour.COLUMNS=7;Blockly.FieldColour.prototype.setColours=function(a,b){this.colours_=a;void 0!==b&&(this.titles_=b);return this};Blockly.FieldColour.prototype.setColumns=function(a){this.columns_=a;return this};
|
|
Blockly.FieldColour.prototype.showEditor_=function(){this.colorPicker_=this.dropdownCreate_();Blockly.DropDownDiv.getContentDiv().appendChild(this.colorPicker_);Blockly.DropDownDiv.setColour(this.DROPDOWN_BACKGROUND_COLOUR,this.DROPDOWN_BORDER_COLOUR);Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this))};Blockly.FieldColour.prototype.onClick_=function(a){(a=a.target)&&!a.label&&(a=a.parentNode);a=a&&a.label;null!==a&&(this.setValue(a),Blockly.DropDownDiv.hideIfOwner(this))};
|
|
Blockly.FieldColour.prototype.dropdownCreate_=function(){var a=this.columns_||Blockly.FieldColour.COLUMNS,b=this.colours_||Blockly.FieldColour.COLOURS,c=this.titles_||Blockly.FieldColour.TITLES,d=this.getValue(),e=document.createElement("table");e.className="blocklyColourTable";for(var f,g=0;g<b.length;g++){0==g%a&&(f=document.createElement("tr"),e.appendChild(f));var h=document.createElement("td");f.appendChild(h);var k=document.createElement("div");h.appendChild(k);h.label=b[g];h.title=c[g]||b[g];
|
|
k.style.backgroundColor=b[g];b[g]==d&&(k.className="blocklyColourSelected")}this.onUpWrapper_=Blockly.bindEvent_(e,"mouseup",this,this.onClick_);return e};Blockly.FieldColour.prototype.dropdownDispose_=function(){Blockly.unbindEvent_(this.onUpWrapper_)};Blockly.Field.register("field_colour",Blockly.FieldColour);Blockly.FieldColourSlider=function(a,b){Blockly.FieldColourSlider.superClass_.constructor.call(this,a,b);this.addArgType("colour")};goog.inherits(Blockly.FieldColourSlider,Blockly.Field);Blockly.FieldColourSlider.fromJson=function(a){return new Blockly.FieldColourSlider(a.colour)};Blockly.FieldColourSlider.prototype.init=function(a){Blockly.FieldColourSlider.superClass_.init.call(this,a);this.setValue(this.getValue())};Blockly.FieldColourSlider.prototype.getValue=function(){return this.colour_};
|
|
Blockly.FieldColourSlider.prototype.setValue=function(a){this.sourceBlock_&&Blockly.Events.isEnabled()&&this.colour_!=a&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name,this.colour_,a));this.colour_=a;this.sourceBlock_&&this.sourceBlock_.setColour(a,a,this.sourceBlock_.getColourTertiary());this.updateSliderHandles_();this.updateDom_()};
|
|
Blockly.FieldColourSlider.prototype.createColourStops_=function(a){for(var b=[],c=0;360>=c;c+=20)switch(a){case "hue":b.push(Blockly.utils.colour.hsvToHex(c,this.saturation_,this.brightness_));break;case "saturation":b.push(Blockly.utils.colour.hsvToHex(this.hue_,c/360,this.brightness_));break;case "brightness":b.push(Blockly.utils.colour.hsvToHex(this.hue_,this.saturation_,255*c/360));break;default:throw Error("Unknown channel for colour sliders: "+a);}return b};
|
|
Blockly.FieldColourSlider.prototype.setGradient_=function(a,b){var c=this.createColourStops_(b).join(",");goog.style.setStyle(a,"background","-moz-linear-gradient(left, "+c+")");goog.style.setStyle(a,"background","-webkit-linear-gradient(left, "+c+")");goog.style.setStyle(a,"background","-o-linear-gradient(left, "+c+")");goog.style.setStyle(a,"background","-ms-linear-gradient(left, "+c+")");goog.style.setStyle(a,"background","linear-gradient(left, "+c+")")};
|
|
Blockly.FieldColourSlider.prototype.updateDom_=function(){this.hueSlider_&&(this.setGradient_(this.hueSlider_.getElement(),"hue"),this.setGradient_(this.saturationSlider_.getElement(),"saturation"),this.setGradient_(this.brightnessSlider_.getElement(),"brightness"),this.hueReadout_.textContent=Math.floor(100*this.hue_/360).toFixed(0),this.saturationReadout_.textContent=Math.floor(100*this.saturation_).toFixed(0),this.brightnessReadout_.textContent=Math.floor(100*this.brightness_/255).toFixed(0))};
|
|
Blockly.FieldColourSlider.prototype.updateSliderHandles_=function(){this.hueSlider_&&(this.hueSlider_.setValue(this.hue_),this.saturationSlider_.setValue(this.saturation_),this.brightnessSlider_.setValue(this.brightness_))};Blockly.FieldColourSlider.prototype.getText=function(){var a=this.colour_,b=a.match(/^#(.)\1(.)\2(.)\3$/);b&&(a="#"+b[1]+b[2]+b[3]);return a};
|
|
Blockly.FieldColourSlider.prototype.createLabelDom_=function(a){var b=document.createElement("div");b.setAttribute("class","blocklyColourPickerLabel");var c=document.createElement("span");c.setAttribute("class","blocklyColourPickerReadout");var d=document.createElement("span");d.setAttribute("class","blocklyColourPickerLabelText");d.textContent=a;b.appendChild(d);b.appendChild(c);return[b,c]};
|
|
Blockly.FieldColourSlider.prototype.sliderCallbackFactory_=function(a){var b=this;return function(c){c=c.target.getValue();var d=Blockly.utils.colour.hexToHsv(b.getValue());switch(a){case "hue":d[0]=b.hue_=c;break;case "saturation":d[1]=b.saturation_=c;break;case "brightness":d[2]=b.brightness_=c}c=Blockly.utils.colour.hsvToHex(d[0],d[1],d[2]);b.sourceBlock_&&(c=b.callValidator(c));null!==c&&b.setValue(c,!0)}};
|
|
Blockly.FieldColourSlider.prototype.showEditor_=function(){Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();var a=Blockly.DropDownDiv.getContentDiv(),b=Blockly.utils.colour.hexToHsv(this.getValue());this.hue_=b[0];this.saturation_=b[1];this.brightness_=b[2];b=this.createLabelDom_("Hue");a.appendChild(b[0]);this.hueReadout_=b[1];this.hueSlider_=new goog.ui.Slider;this.hueSlider_.setUnitIncrement(5);this.hueSlider_.setMinimum(0);this.hueSlider_.setMaximum(360);this.hueSlider_.render(a);
|
|
b=this.createLabelDom_("Saturation");a.appendChild(b[0]);this.saturationReadout_=b[1];this.saturationSlider_=new goog.ui.Slider;this.saturationSlider_.setUnitIncrement(.01);this.saturationSlider_.setStep(.001);this.saturationSlider_.setMinimum(0);this.saturationSlider_.setMaximum(1);this.saturationSlider_.render(a);b=this.createLabelDom_("Brightness");a.appendChild(b[0]);this.brightnessReadout_=b[1];this.brightnessSlider_=new goog.ui.Slider;this.brightnessSlider_.setUnitIncrement(2);this.brightnessSlider_.setMinimum(0);
|
|
this.brightnessSlider_.setMaximum(255);this.brightnessSlider_.render(a);Blockly.FieldColourSlider.hueChangeEventKey_=goog.events.listen(this.hueSlider_,goog.ui.Component.EventType.CHANGE,this.sliderCallbackFactory_("hue"));Blockly.FieldColourSlider.saturationChangeEventKey_=goog.events.listen(this.saturationSlider_,goog.ui.Component.EventType.CHANGE,this.sliderCallbackFactory_("saturation"));Blockly.FieldColourSlider.brightnessChangeEventKey_=goog.events.listen(this.brightnessSlider_,goog.ui.Component.EventType.CHANGE,
|
|
this.sliderCallbackFactory_("brightness"));Blockly.DropDownDiv.setColour("#ffffff","#dddddd");Blockly.DropDownDiv.setCategory(this.sourceBlock_.parentBlock_.getCategory());Blockly.DropDownDiv.showPositionedByBlock(this,this.sourceBlock_);this.setValue(this.getValue())};
|
|
Blockly.FieldColourSlider.prototype.dispose=function(){Blockly.FieldColourSlider.hueChangeEventKey_&&goog.events.unlistenByKey(Blockly.FieldColourSlider.hueChangeEventKey_);Blockly.FieldColourSlider.saturationChangeEventKey_&&goog.events.unlistenByKey(Blockly.FieldColourSlider.saturationChangeEventKey_);Blockly.FieldColourSlider.brightnessChangeEventKey_&&goog.events.unlistenByKey(Blockly.FieldColourSlider.brightnessChangeEventKey_);Blockly.Events.setGroup(!1);Blockly.FieldColourSlider.superClass_.dispose.call(this)};
|
|
Blockly.Field.register("field_colour_slider",Blockly.FieldColourSlider);Blockly.FieldDropdown=function(a,b){this.menuGenerator_=a;this.trimOptions_();var c=this.getOptions();Blockly.FieldDropdown.validateOptions_(c);Blockly.FieldDropdown.superClass_.constructor.call(this,c[0][1],b);this.addArgType("dropdown")};goog.inherits(Blockly.FieldDropdown,Blockly.Field);Blockly.FieldDropdown.fromJson=function(a){return new Blockly.FieldDropdown(a.options)};Blockly.FieldDropdown.prototype.EDITABLE=!1;Blockly.FieldDropdown.prototype.SERIALIZABLE=!0;
|
|
Blockly.FieldDropdown.CHECKMARK_OVERHANG=25;Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH=.45;Blockly.FieldDropdown.IMAGE_Y_OFFSET=5;Blockly.FieldDropdown.prototype.CURSOR="pointer";Blockly.FieldDropdown.prototype.selectedItem=null;Blockly.FieldDropdown.prototype.value_="";Blockly.FieldDropdown.prototype.imageElement_=null;Blockly.FieldDropdown.prototype.imageJson_=null;Blockly.FieldDropdown.DROPDOWN_SVG_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=";
|
|
Blockly.FieldDropdown.prototype.init=function(){if(!this.fieldGroup_){Blockly.FieldDropdown.superClass_.initView.call(this);this.arrowSize_=12;this.arrowX_=0;this.arrowY_=11;var a=Blockly.utils.userAgent.IE||Blockly.utils.userAgent.IOS,b=a?Blockly.FieldDropdown.DROPDOWN_SVG_DATAURI:"#blocklyDropdownArrowSvg";this.arrow_=Blockly.utils.dom.createSvgElement(a?"image":"use",{height:this.arrowSize_+"px",width:this.arrowSize_+"px"});this.arrow_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",
|
|
b);this.className_+=" blocklyDropdownText";Blockly.FieldDropdown.superClass_.init.call(this);this.shouldShowRect_()&&(this.box_=Blockly.utils.dom.createSvgElement("rect",{rx:Blockly.BlockSvg.CORNER_RADIUS,ry:Blockly.BlockSvg.CORNER_RADIUS,x:0,y:0,width:this.size_.width,height:this.size_.height,stroke:this.sourceBlock_.getColourTertiary(),fill:this.sourceBlock_.getColour(),"class":"blocklyBlockBackground","fill-opacity":1},null),this.fieldGroup_.insertBefore(this.box_,this.textElement_));a=this.text_;
|
|
this.text_=null;this.setText(a);this.sourceBlock_.isEditable()&&(this.mouseOverWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_),this.mouseOutWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_))}};
|
|
Blockly.FieldDropdown.prototype.onMouseOver_=function(a){this.sourceBlock_.isInFlyout||(a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||(this.box_?Blockly.utils.dom.addClass(this.box_,"blocklyFieldHover"):this.sourceBlock_.svgPath_&&Blockly.utils.dom.addClass(this.sourceBlock_.svgPath_,"blocklyFieldHover"))};
|
|
Blockly.FieldDropdown.prototype.onMouseOut_=function(a){this.sourceBlock_.isInFlyout||(a=this.sourceBlock_.workspace.getGesture(a))&&a.isDragging()||(this.box_?Blockly.utils.dom.removeClass(this.box_,"blocklyFieldHover"):this.sourceBlock_.svgPath_&&Blockly.utils.dom.removeClass(this.sourceBlock_.svgPath_,"blocklyFieldHover"))};Blockly.FieldDropdown.prototype.shouldShowRect_=function(){return!this.sourceBlock_.isShadow()};
|
|
Blockly.FieldDropdown.prototype.showEditor_=function(){var a=this.getOptions();if(0!=a.length){this.dropDownOpen_=!0;Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();var b=Blockly.DropDownDiv.getContentDiv(),c=this,d=!1,e=new goog.ui.Menu;e.setRightToLeft(this.sourceBlock_.RTL);for(var f=0;f<a.length;f++){var g=a[f][0],h=a[f][1];if("SEPARATOR"===h)g=new goog.ui.MenuSeparator,g.setRightToLeft(this.sourceBlock_.RTL),e.addChild(g,!0),g.getElement().style.borderColor=this.sourceBlock_.getColourTertiary();
|
|
else{if("object"==typeof g){var k=new Image(g.width,g.height);k.src=g.src;k.alt=g.alt||"";g=k}g=new goog.ui.MenuItem(g);g.setRightToLeft(this.sourceBlock_.RTL);g.setValue(h);g.setCheckable(!0);e.addChild(g,!0);h=h==this.value_;g.setChecked(h);h&&(this.selectedItem=g)}}goog.events.listen(e,goog.ui.Component.EventType.ACTION,function(a){if(!d){if(a=a.target)c.onItemSelected(this,a),d=!0;Blockly.DropDownDiv.hide();Blockly.Events.setGroup(!1)}});e.render(b);a=e.getElement();Blockly.utils.dom.addClass(a,
|
|
"blocklyDropdownMenu");Blockly.utils.uiMenu.getSize(e).height=a.scrollHeight;b=this.sourceBlock_.isShadow()?this.sourceBlock_.parentBlock_.getColour():this.sourceBlock_.getColour();Blockly.DropDownDiv.setColour(b,this.sourceBlock_.getColourTertiary());b=this.sourceBlock_.isShadow()?this.sourceBlock_.parentBlock_.getCategory():this.sourceBlock_.getCategory();Blockly.DropDownDiv.setCategory(b);Blockly.DropDownDiv.showPositionedByField(this,this.onHide.bind(this));e.setAllowAutoFocus(!0);a.focus();this.disableColourChange_||
|
|
(this.sourceBlock_.isShadow()?this.sourceBlock_.setShadowColour(this.sourceBlock_.getColourTertiary()):this.box_&&this.box_.setAttribute("fill",this.sourceBlock_.getColourTertiary()))}};Blockly.FieldDropdown.prototype.onHide=function(){this.dropDownOpen_=!1;!this.disableColourChange_&&this.sourceBlock_&&(this.sourceBlock_.isShadow()?this.sourceBlock_.clearShadowColour():this.box_&&this.box_.setAttribute("fill",this.sourceBlock_.getColour()))};
|
|
Blockly.FieldDropdown.prototype.onItemSelected=function(a,b){if(this.dropDownOpen_){var c=b.getValue();this.sourceBlock_&&(c=this.callValidator(c));null!==c&&(this.setValue(c),this.sourceBlock_.workspace&&Blockly.Events.fire(new Blockly.Events.Ui(this.sourceBlock_,"itemSelected",void 0,c)))}};
|
|
Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.prefixField=null;var a=this.menuGenerator_;if(Array.isArray(a)){for(var b=!1,c=0;c<a.length;c++){var d=a[c][0];"string"==typeof d?a[c][0]=Blockly.utils.replaceMessageReferences(d):(null!=d.alt&&(a[c][0].alt=Blockly.utils.replaceMessageReferences(d.alt)),b=!0)}if(!(b||2>a.length)){var e=[];for(c=0;c<a.length;c++)e.push(a[c][0]);c=Blockly.utils.string.shortestStringLength(e);b=Blockly.utils.string.commonWordPrefix(e,c);d=
|
|
Blockly.utils.string.commonWordSuffix(e,c);if((b||d)&&!(c<=b+d)){b&&(this.prefixField=e[0].substring(0,b-1));d&&(this.suffixField=e[0].substr(1-d));e=[];for(c=0;c<a.length;c++){var f=a[c][0],g=a[c][1];f=f.substring(b,f.length-d);e[c]=[f,g]}this.menuGenerator_=e}}}};Blockly.FieldDropdown.prototype.isOptionListDynamic=function(){return"function"==typeof this.menuGenerator_};
|
|
Blockly.FieldDropdown.prototype.getOptions=function(){if(this.isOptionListDynamic()){var a=this.menuGenerator_.call(this);Blockly.FieldDropdown.validateOptions_(a);return a}return this.menuGenerator_};
|
|
Blockly.FieldDropdown.prototype.doClassValidation_=function(a){for(var b=!1,c=this.getOptions(),d=0,e;e=c[d];d++)if(e[1]==a){b=!0;break}b||this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+a);return a};
|
|
Blockly.FieldDropdown.prototype.doValueUpdate_=function(a){Blockly.FieldDropdown.superClass_.doValueUpdate_.call(this,a);this.selectedItem&&(this.selectedItem.setChecked(!1),this.selectedItem=null);a=this.getOptions();for(var b=0,c;c=a[b];b++)c[1]==this.value_&&(c=c[0],"object"==typeof c?(this.imageJson_=c,this.text_=c.alt):(this.imageJson_=null,this.text_=c))};
|
|
Blockly.FieldDropdown.prototype.updateColour=function(){this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?this.arrow_.style.fill=this.sourceBlock_.getColourShadow():this.arrow_.style.fill=this.sourceBlock_.getColour())};Blockly.FieldDropdown.prototype.setText=function(a){null!==a&&a!==this.text_&&(this.text_=a,this.updateTextNode_(),this.textElement_&&this.textElement_.parentNode.appendChild(this.arrow_),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()))};
|
|
Blockly.FieldDropdown.prototype.positionArrow=function(a){if(!this.arrow_)return 0;this.arrowX_=this.sourceBlock_.RTL?this.arrowSize_-Blockly.BlockSvg.DROPDOWN_ARROW_PADDING:a+Blockly.BlockSvg.DROPDOWN_ARROW_PADDING/2;a=this.arrowSize_+Blockly.BlockSvg.DROPDOWN_ARROW_PADDING;this.box_&&(this.arrowX_+=Blockly.BlockSvg.BOX_FIELD_PADDING);this.arrow_.setAttribute("transform","translate("+this.arrowX_+","+this.arrowY_+")");return a};
|
|
Blockly.FieldDropdown.prototype.dispose=function(){this.mouseOverWrapper_&&(Blockly.unbindEvent_(this.mouseOverWrapper_),this.mouseOverWrapper_=null);this.mouseOutWrapper_&&(Blockly.unbindEvent_(this.mouseOutWrapper_),this.mouseOutWrapper_=null);this.selectedItem=null;Blockly.WidgetDiv.hideIfOwner(this);Blockly.FieldDropdown.superClass_.dispose.call(this)};
|
|
Blockly.FieldDropdown.validateOptions_=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");for(var b=!1,c=0;c<a.length;++c){var d=a[c];Array.isArray(d)?"string"!=typeof d[1]?(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option id must be a string. Found "+d[1]+" in: ",d)):d[0]&&"string"!=typeof d[0]&&"string"!=typeof d[0].src&&(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must have a string label or image description. Found"+
|
|
d[0]+" in: ",d)):(b=!0,console.error("Invalid option["+c+"]: Each FieldDropdown option must be an array. Found: ",d))}if(b)throw TypeError("Found invalid FieldDropdown options.");};Blockly.Field.register("field_dropdown",Blockly.FieldDropdown);Blockly.FieldIconMenu=function(a){this.icons_=a;Blockly.FieldIconMenu.superClass_.constructor.call(this,a[0].value);this.addArgType("iconmenu")};goog.inherits(Blockly.FieldIconMenu,Blockly.Field);Blockly.FieldIconMenu.fromJson=function(a){return new Blockly.FieldIconMenu(a.options)};Blockly.FieldIconMenu.DROPDOWN_WIDTH=168;Blockly.FieldIconMenu.savedPrimary_=null;
|
|
Blockly.FieldIconMenu.prototype.init=function(a){this.arrowX_=18;this.arrowY_=10;a.RTL&&(this.arrowX_=-this.arrowX_-12);this.arrowIcon_=Blockly.utils.dom.createSvgElement("image",{height:"12px",width:"12px",transform:"translate("+this.arrowX_+","+this.arrowY_+")"});this.arrowIcon_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.mainWorkspace.options.pathToMedia+"dropdown-arrow.svg");a.getSvgRoot().appendChild(this.arrowIcon_);Blockly.FieldIconMenu.superClass_.init.call(this,a)};
|
|
Blockly.FieldIconMenu.prototype.CURSOR="default";Blockly.FieldIconMenu.prototype.setValue=function(a){null!==a&&a!==this.value_&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,a)),this.value_=a,this.setParentFieldImage(this.getSrcForValue(this.value_)))};
|
|
Blockly.FieldIconMenu.prototype.setParentFieldImage=function(a){if(this.sourceBlock_&&this.sourceBlock_.parentBlock_)for(var b=this.sourceBlock_.parentBlock_,c=0,d;d=b.inputList[c];c++)for(var e=0,f;f=d.fieldRow[e];e++)if(f instanceof Blockly.FieldImage){f.setValue(a);return}};Blockly.FieldIconMenu.prototype.getValue=function(){return this.value_};Blockly.FieldIconMenu.prototype.getSrcForValue=function(a){for(var b=0,c;c=this.icons_[b];b++)if(c.value===a)return c.src};
|
|
Blockly.FieldIconMenu.prototype.showEditor_=function(){if(!Blockly.DropDownDiv.hideIfOwner(this)){Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();var a=Blockly.DropDownDiv.getContentDiv();a.setAttribute("role","menu");a.setAttribute("aria-haspopup","true");for(var b=0,c;c=this.icons_[b];b++)if("placeholder"==c.type){var d=document.createElement("span");d.setAttribute("class","blocklyDropDownPlaceholder");d.style.width=c.width+"px";d.style.height=c.height+"px";a.appendChild(d)}else{d=
|
|
document.createElement("button");d.setAttribute("id",":"+b);d.setAttribute("role","menuitem");d.setAttribute("class","blocklyDropDownButton");d.title=c.alt;d.style.width=c.width+"px";d.style.height=c.height+"px";var e=this.sourceBlock_.getColour();c.value==this.getValue()&&(e=this.sourceBlock_.getColourTertiary(),d.setAttribute("aria-selected","true"));d.style.backgroundColor=e;d.style.borderColor=this.sourceBlock_.getColourTertiary();Blockly.bindEvent_(d,"click",this,this.buttonClick_);Blockly.bindEvent_(d,
|
|
"mouseup",this,this.buttonClick_);Blockly.bindEvent_(d,"mousedown",d,function(a){this.setAttribute("class","blocklyDropDownButton blocklyDropDownButtonHover");a.preventDefault()});Blockly.bindEvent_(d,"mouseover",d,function(){this.setAttribute("class","blocklyDropDownButton blocklyDropDownButtonHover");a.setAttribute("aria-activedescendant",this.id)});Blockly.bindEvent_(d,"mouseout",d,function(){this.setAttribute("class","blocklyDropDownButton");a.removeAttribute("aria-activedescendant")});e=document.createElement("img");
|
|
e.src=c.src;d.setAttribute("data-value",c.value);e.setAttribute("data-value",c.value);d.appendChild(e);a.appendChild(d)}a.style.width=Blockly.FieldIconMenu.DROPDOWN_WIDTH+"px";Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(),this.sourceBlock_.getColourTertiary());Blockly.DropDownDiv.setCategory(this.sourceBlock_.parentBlock_.getCategory());this.savedPrimary_=this.sourceBlock_.getColour();this.sourceBlock_.setColour(this.sourceBlock_.getColourSecondary(),this.sourceBlock_.getColourSecondary(),
|
|
this.sourceBlock_.getColourTertiary());b=this.sourceBlock_.workspace.scale;b=-(Blockly.BlockSvg.MIN_BLOCK_Y*b)-Blockly.BlockSvg.FIELD_Y_OFFSET*b;Blockly.DropDownDiv.showPositionedByBlock(this,this.sourceBlock_,this.onHide_.bind(this),b)||this.arrowIcon_.setAttribute("transform","translate("+(this.arrowX_+Blockly.DropDownDiv.ARROW_SIZE/1.5+1)+","+(this.arrowY_+Blockly.DropDownDiv.ARROW_SIZE/1.5)+") rotate(180)")}};
|
|
Blockly.FieldIconMenu.prototype.buttonClick_=function(a){a=a.target.getAttribute("data-value");this.setValue(a);Blockly.DropDownDiv.hide()};
|
|
Blockly.FieldIconMenu.prototype.onHide_=function(){this.sourceBlock_&&this.sourceBlock_.setColour(this.savedPrimary_,this.sourceBlock_.getColourSecondary(),this.sourceBlock_.getColourTertiary());Blockly.DropDownDiv.content_.removeAttribute("role");Blockly.DropDownDiv.content_.removeAttribute("aria-haspopup");Blockly.DropDownDiv.content_.removeAttribute("aria-activedescendant");this.arrowIcon_.setAttribute("transform","translate("+this.arrowX_+","+this.arrowY_+")")};
|
|
Blockly.Field.register("field_iconmenu",Blockly.FieldIconMenu);Blockly.FieldLabelSerializable=function(a,b){Blockly.FieldLabelSerializable.superClass_.constructor.call(this,a,b)};goog.inherits(Blockly.FieldLabelSerializable,Blockly.FieldLabel);Blockly.FieldLabelSerializable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldLabelSerializable(b,a["class"])};Blockly.FieldLabelSerializable.prototype.EDITABLE=!1;Blockly.FieldLabelSerializable.prototype.SERIALIZABLE=!0;
|
|
Blockly.Field.register("field_label_serializable",Blockly.FieldLabelSerializable);Blockly.FieldImage=function(a,b,c,d,e,f){this.sourceBlock_=null;this.height_=Number(c);this.width_=Number(b);this.size_=new goog.math.Size(this.width_,this.height_);this.text_=d||"";this.flipRtl_=f;this.setValue(a||"");"function"==typeof e&&(this.clickHandler_=e)};goog.inherits(Blockly.FieldImage,Blockly.Field);
|
|
Blockly.FieldImage.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.src),c=Number(Blockly.utils.replaceMessageReferences(a.width)),d=Number(Blockly.utils.replaceMessageReferences(a.height)),e=Blockly.utils.replaceMessageReferences(a.alt);return new Blockly.FieldImage(b,c,d,e,null,!!a.flipRtl)};Blockly.FieldImage.prototype.EDITABLE=!1;Blockly.FieldImage.prototype.SERIALIZABLE=!1;Blockly.FieldImage.prototype.isDirty_=!1;
|
|
Blockly.FieldImage.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.utils.dom.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.imageElement_=Blockly.utils.dom.createSvgElement("image",{height:this.height_+"px",width:this.width_+"px"},this.fieldGroup_),this.setValue(this.src_),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.setTooltip(this.sourceBlock_),Blockly.Tooltip.bindMouseEvents(this.imageElement_),this.maybeAddClickHandler_())};
|
|
Blockly.FieldImage.prototype.dispose=function(){Blockly.utils.dom.removeNode(this.fieldGroup_);this.imageElement_=this.fieldGroup_=null};Blockly.FieldImage.prototype.maybeAddClickHandler_=function(){this.clickHandler_&&(this.mouseDownWrapper_=Blockly.bindEventWithChecks_(this.fieldGroup_,"mousedown",this,this.onMouseDown_),this.imageElement_&&(this.imageElement_.style.cursor="pointer"))};Blockly.FieldImage.prototype.setTooltip=function(a){this.imageElement_.tooltip=a};
|
|
Blockly.FieldImage.prototype.getValue=function(){return this.src_};Blockly.FieldImage.prototype.setValue=function(a){null!==a&&(this.src_=a,this.imageElement_&&this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a||""))};Blockly.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};Blockly.FieldImage.prototype.setText=function(a){null!==a&&(this.text_=a)};Blockly.FieldImage.prototype.render_=function(){};Blockly.FieldImage.prototype.forceRerender=function(){};
|
|
Blockly.FieldImage.prototype.updateWidth=function(){};Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};Blockly.Field.register("field_image",Blockly.FieldImage);Blockly.FieldTextDropdown=function(a,b,c,d){this.menuGenerator_=b;Blockly.FieldDropdown.prototype.trimOptions_.call(this);Blockly.FieldTextDropdown.superClass_.constructor.call(this,a,c,d);this.addArgType("textdropdown")};goog.inherits(Blockly.FieldTextDropdown,Blockly.FieldTextInput);Blockly.FieldTextDropdown.fromJson=function(a){var b=new Blockly.FieldTextDropdown(a.text,a.options);"boolean"==typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};
|
|
Blockly.FieldTextDropdown.DROPDOWN_SVG_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiM1NzVFNzUiLz48L3N2Zz4K";
|
|
Blockly.FieldTextDropdown.prototype.init=function(){Blockly.FieldTextDropdown.superClass_.init.call(this);this.arrow_||(this.arrowSize_=12,this.arrowX_=0,this.arrowY_=11,this.arrow_=Blockly.utils.dom.createSvgElement("image",{height:this.arrowSize_+"px",width:this.arrowSize_+"px"}),this.arrow_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.FieldTextDropdown.DROPDOWN_SVG_DATAURI),this.arrow_.style.cursor="pointer",this.fieldGroup_.appendChild(this.arrow_),this.sourceBlock_.isEditable()&&
|
|
(this.mouseUpWrapper_=Blockly.bindEvent_(this.arrow_,"mousedown",this,function(a){Blockly.FieldTextDropdown.prototype.showEditor_.call(this,a);a.preventDefault();a.stopPropagation()})));this.disableColourChange_=!0};Blockly.FieldTextDropdown.prototype.dispose=function(){this.mouseUpWrapper_&&(Blockly.unbindEvent_(this.mouseUpWrapper_),this.mouseUpWrapper_=null,Blockly.Touch.clearTouchIdentifier());Blockly.FieldTextDropdown.superClass_.dispose.call(this)};
|
|
Blockly.FieldTextDropdown.prototype.showEditor_=function(a){Blockly.FieldTextDropdown.superClass_.showEditor_.call(this,a,!1,Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD,!0,function(){this.dropDownOpen_||this.showDropdown_();Blockly.Touch.clearTouchIdentifier()})};Blockly.FieldTextDropdown.prototype.isOptionListDynamic=Blockly.FieldDropdown.prototype.isOptionListDynamic;Blockly.FieldTextDropdown.prototype.getOptions=Blockly.FieldDropdown.prototype.getOptions;
|
|
Blockly.FieldTextDropdown.prototype.positionArrow=Blockly.FieldDropdown.prototype.positionArrow;Blockly.FieldTextDropdown.prototype.showDropdown_=Blockly.FieldDropdown.prototype.showEditor_;Blockly.FieldTextDropdown.prototype.onHide=function(){Blockly.WidgetDiv.hide();Blockly.FieldDropdown.prototype.onHide.call(this)};Blockly.FieldTextDropdown.prototype.onItemSelected=function(a,b){var c=b.getValue();this.sourceBlock_&&(c=this.callValidator(c));if(null!==c){var d=this.htmlInput_;d&&(d.value=c);this.setValue(c)}};
|
|
Blockly.Field.register("field_textdropdown",Blockly.FieldTextDropdown);Blockly.FieldNumber=function(a,b,c,d,e){b=this.getNumRestrictor(b,c,d);a=this.doClassValidation_(a);null===a&&(a=0);Blockly.FieldNumber.superClass_.constructor.call(this,a,e,b);this.addArgType("number")};goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput);Blockly.FieldNumber.fromJson=function(a){return new Blockly.FieldNumber(a.value,a.min,a.max,a.precision)};Blockly.FieldNumber.prototype.SERIALIZABLE=!0;Blockly.FieldNumber.DROPDOWN_WIDTH=168;Blockly.FieldNumber.NUMPAD_BUTTONS="789456123.0- ".split("");
|
|
Blockly.FieldNumber.NUMPAD_DELETE_ICON="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M28.89,11.45H16.79a2.86,2.86,0,0,0-2,.84L9.09,18a2.85,2.85,0,0,0,0,4l5.69,5.69a2.86,2.86,0,0,0,2,.84h12.1a2.86,2.86,0,0,0,2.86-2.86V14.31A2.86,2.86,0,0,0,28.89,11.45ZM27.15,22.73a1,1,0,0,1,0,1.41,1,1,0,0,1-.71.3,1,1,0,0,1-.71-0.3L23,21.41l-2.73,2.73a1,1,0,0,1-1.41,0,1,1,0,0,1,0-1.41L21.59,20l-2.73-2.73a1,1,0,0,1,0-1.41,1,1,0,0,1,1.41,0L23,18.59l2.73-2.73a1,1,0,1,1,1.42,1.41L24.42,20Z' fill='%23"+
|
|
Blockly.Colours.numPadText.substr(1)+"'/%3E%3C/svg%3E";Blockly.FieldNumber.activeField_=null;Blockly.FieldNumber.prototype.getNumRestrictor=function(a,b,c){this.setConstraints_(a,b,c);a="[\\d]";this.decimalAllowed_&&(a+="|[\\.]");this.negativeAllowed_&&(a+="|[-]");return new RegExp(a)};
|
|
Blockly.FieldNumber.prototype.setConstraints_=function(a,b,c){this.decimalAllowed_="undefined"==typeof c||null===c||isNaN(c)||0==c||Math.floor(c)!=c;this.negativeAllowed_="undefined"==typeof a||null===a||isNaN(a)||0>a;this.setMinInternal_(a);this.setMaxInternal_(b);this.setPrecisionInternal_(c);this.setValue(this.getValue())};Blockly.FieldNumber.prototype.setMin=function(a){this.setMinInternal_(a);this.setValue(this.getValue())};
|
|
Blockly.FieldNumber.prototype.setMinInternal_=function(a){null==a?this.min_=-Infinity:(a=Number(a),isNaN(a)||(this.min_=a))};Blockly.FieldNumber.prototype.getMin=function(){return this.min_};Blockly.FieldNumber.prototype.setMax=function(a){this.setMaxInternal_(a);this.setValue(this.getValue())};Blockly.FieldNumber.prototype.setMaxInternal_=function(a){null==a?this.max_=Infinity:(a=Number(a),isNaN(a)||(this.max_=a))};Blockly.FieldNumber.prototype.getMax=function(){return this.max_};
|
|
Blockly.FieldNumber.prototype.setPrecision=function(a){this.setPrecisionInternal_(a);this.setValue(this.getValue())};Blockly.FieldNumber.prototype.setPrecisionInternal_=function(a){null==a?this.precision_=0:(a=Number(a),isNaN(a)||(this.precision_=a));var b=this.precision_.toString(),c=b.indexOf(".");this.decimalPlaces_=-1==c?a?0:null:b.length-c-1};Blockly.FieldNumber.prototype.getPrecision=function(){return this.precision_};
|
|
Blockly.FieldNumber.prototype.showEditor_=function(a,b){Blockly.FieldNumber.activeField_=this;var c="undefined"!==typeof b?b:Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD;Blockly.FieldNumber.superClass_.showEditor_.call(this,a,c,c);c&&this.showNumPad_()};
|
|
Blockly.FieldNumber.prototype.showNumPad_=function(){Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();var a=Blockly.DropDownDiv.getContentDiv();a.setAttribute("role","menu");a.setAttribute("aria-haspopup","true");this.addButtons_(a);var b=this.sourceBlock_.parentBlock_?this.sourceBlock_.parentBlock_.getColour():Blockly.Colours.numPadBackground,c=this.sourceBlock_.parentBlock_?this.sourceBlock_.getColourTertiary():Blockly.Colours.numPadBorder;Blockly.DropDownDiv.setColour(b,
|
|
c);a.style.width=Blockly.FieldNumber.DROPDOWN_WIDTH+"px";Blockly.DropDownDiv.showPositionedByField(this,this.onHide_.bind(this))};
|
|
Blockly.FieldNumber.prototype.addButtons_=function(a){for(var b=this.sourceBlock_.parentBlock_?this.sourceBlock_.parentBlock_.getColour():Blockly.Colours.numPadBackground,c=this.sourceBlock_.parentBlock_?this.sourceBlock_.parentBlock_.getColourTertiary():this.sourceBlock_.getColourTertiary(),d=Blockly.FieldNumber.NUMPAD_BUTTONS,e=0,f;f=d[e];e++){var g=document.createElement("button");g.setAttribute("role","menuitem");g.setAttribute("class","blocklyNumPadButton");g.setAttribute("style","background:"+
|
|
b+";border: 1px solid "+c+";");g.title=f;g.innerHTML=f;Blockly.bindEvent_(g,"mousedown",this,this.numPadButtonTouch);if("."!=f||this.decimalAllowed_)if("-"!=f||this.negativeAllowed_)if(" "!=f||this.negativeAllowed_)" "==f&&this.negativeAllowed_&&g.setAttribute("style","visibility: hidden");else continue;else continue;else g.setAttribute("style","visibility: hidden");a.appendChild(g)}d=document.createElement("button");d.setAttribute("role","menuitem");d.setAttribute("class","blocklyNumPadButton");
|
|
d.setAttribute("style","background:"+b+";border: 1px solid "+c+";");d.title="Delete";b=document.createElement("img");b.src=Blockly.FieldNumber.NUMPAD_DELETE_ICON;d.appendChild(b);Blockly.bindEvent_(d,"mousedown",this,this.numPadEraseButtonTouch);a.appendChild(d)};
|
|
Blockly.FieldNumber.prototype.numPadButtonTouch=function(a){var b=a.target.innerText,c=this.htmlInput_.value,d=this.htmlInput_.selectionStart,e=this.htmlInput_.selectionEnd,f=c.slice(0,d)+b+c.slice(e);0==e-d&&(f=c+b);this.updateDisplay_(f);Blockly.Touch.clearTouchIdentifier();a.preventDefault()};
|
|
Blockly.FieldNumber.prototype.numPadEraseButtonTouch=function(a){var b=this.htmlInput_.value,c=this.htmlInput_.selectionStart,d=this.htmlInput_.selectionEnd,e=b.slice(0,c)+b.slice(d);0==d-c&&(e=0==d?b.slice(0,b.length-1):b.slice(0,c-1)+b.slice(c));this.updateDisplay_(e);Blockly.Touch.clearTouchIdentifier();a.preventDefault()};
|
|
Blockly.FieldNumber.prototype.updateDisplay_=function(a){this.htmlInput_.value=a;Blockly.FieldNumber.superClass_.resizeEditor_.call(this);this.htmlInput_.setSelectionRange(a.length,a.length);this.htmlInput_.scrollLeft=this.htmlInput_.scrollWidth;this.onHtmlInputChange_({})};Blockly.FieldNumber.prototype.onHide_=function(){Blockly.DropDownDiv.content_.removeAttribute("role");Blockly.DropDownDiv.content_.removeAttribute("aria-haspopup")};
|
|
Blockly.FieldNumber.prototype.doClassValidation_=function(a){if(null===a||void 0===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=parseFloat(a||0);if(isNaN(a))return null;this.precision_&&isFinite(a)&&(a=Math.round(a/this.precision_)*this.precision_);null!=this.decimalPlaces_&&(a=Number(a.toFixed(this.decimalPlaces_)));return a};Blockly.Field.register("field_number",Blockly.FieldNumber);Blockly.FieldNumberDropdown=function(a,b,c,d,e,f){this.setConstraints_=Blockly.FieldNumber.prototype.setConstraints_;this.setMinInternal_=Blockly.FieldNumber.prototype.setMinInternal_;this.setMaxInternal_=Blockly.FieldNumber.prototype.setMaxInternal_;this.setPrecisionInternal_=Blockly.FieldNumber.prototype.setPrecisionInternal_;c=Blockly.FieldNumber.prototype.getNumRestrictor.call(this,c,d,e);Blockly.FieldNumberDropdown.superClass_.constructor.call(this,a,b,f,c);this.addArgType("numberdropdown")};
|
|
goog.inherits(Blockly.FieldNumberDropdown,Blockly.FieldTextDropdown);Blockly.FieldNumberDropdown.fromJson=function(a){return new Blockly.FieldNumberDropdown(a.value,a.options,a.min,a.max,a.precision)};Blockly.FieldNumberDropdown.prototype.classValidator=Blockly.FieldNumber.prototype.classValidator;Blockly.Field.register("field_numberdropdown",Blockly.FieldNumberDropdown);Blockly.FieldVariable=function(a,b,c,d){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.size_=new goog.math.Size(Blockly.BlockSvg.FIELD_WIDTH,Blockly.BlockSvg.FIELD_HEIGHT);this.setValidator(b);this.defaultVariableName=a||"";this.setTypes_(c,d);this.value_=null};goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,null,a.variableTypes,a.defaultType)};
|
|
Blockly.FieldVariable.prototype.workspace_=null;Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.initModel=function(){if(!this.variable_){var a=Blockly.Variables.getOrCreateVariablePackage(this.workspace_,null,this.defaultVariableName,this.defaultType_);Blockly.Events.disable();this.setValue(a.getId());Blockly.Events.enable()}};
|
|
Blockly.FieldVariable.prototype.fromXml=function(a){a.getAttribute("id");var b=a.textContent,c=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=Blockly.Variables.getOrCreateVariablePackage(this.workspace_,null,b,c);if(null!=c&&c!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())};
|
|
Blockly.FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a);this.workspace_=a.workspace};
|
|
Blockly.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};Blockly.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""};Blockly.FieldVariable.prototype.getVariable=function(){return this.variable_};Blockly.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null};
|
|
Blockly.FieldVariable.prototype.doClassValidation_=function(a){var b=Blockly.Variables.getVariable(this.workspace_,a);if(!b)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;b=b.type;return this.typeIsAllowed_(b)?a:(console.warn("Variable type doesn't match this field! Type was "+b),null)};
|
|
Blockly.FieldVariable.prototype.doValueUpdate_=function(a){this.variable_=Blockly.Variables.getVariable(this.workspace_,a);this.value_=a;this.text_=this.variable_.name;this.isDirty_=!0};Blockly.FieldVariable.prototype.typeIsAllowed_=function(a){var b=this.getVariableTypes_();if(!b)return!0;for(var c=0;c<b.length;c++)if(a==b[c])return!0;return!1};
|
|
Blockly.FieldVariable.prototype.getVariableTypes_=function(){var a=this.variableTypes;if(null===a&&this.workspace_)return this.workspace_.getVariableTypes();a=a||[""];if(0==a.length)throw a=this.getText(),Error("'variableTypes' of field variable "+a+" was an empty list");return a};
|
|
Blockly.FieldVariable.prototype.setTypes_=function(a,b){var c=b||"";if(null==a||void 0==a)var d=null;else if(Array.isArray(a)){d=a;for(var e=!1,f=0;f<d.length;f++)d[f]==c&&(e=!0);if(!e)throw Error("Invalid default type '"+c+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");this.defaultType_=c;this.variableTypes=d};
|
|
Blockly.FieldVariable.dropdownCreate=function(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var a=this.getText(),b=[];if(this.workspace_)for(var c=this.getVariableTypes_(),d=0;d<c.length;d++){var e=this.workspace_.getVariablesOfType(c[d]);b=b.concat(e)}b.sort(Blockly.VariableModel.compareByName);c=[];for(d=0;d<b.length;d++)c[d]=[b[d].name,b[d].getId()];b=this.workspace_.getVariableById(this.getValue()).type;c.push([b?Blockly.Msg.NEW_VARIABLE_TYPE_DROPDOWN.replace("%1",
|
|
b):Blockly.Msg.NEW_VARIABLE_DROPDOWN,Blockly.CREATE_VARIABLE_ID]);c.push([void 0,"SEPARATOR"]);c.push([Blockly.Msg.RENAME_VARIABLE,Blockly.RENAME_VARIABLE_ID]);Blockly.Msg.DELETE_VARIABLE&&c.push([Blockly.Msg.DELETE_VARIABLE.replace("%1",a),Blockly.DELETE_VARIABLE_ID]);return c};
|
|
Blockly.FieldVariable.prototype.onItemSelected=function(a,b){var c=b.getValue();if(this.workspace_){if(c==Blockly.RENAME_VARIABLE_ID){Blockly.Variables.renameVariable(this.workspace_,this.variable_);return}if(c==Blockly.DELETE_VARIABLE_ID){this.workspace_.deleteVariableById(this.variable_.getId());return}if(c==Blockly.CREATE_VARIABLE_ID){var d=this,e=this.workspace_.getVariableById(this.getValue()).type;Blockly.Variables.createVariableButtonHandler(this.workspace_,function(a){a=d.workspace_.getVariable(a,
|
|
e);d.setValue(a.getId())},e);return}}this.setValue(c)};Blockly.FieldVariable.prototype.shouldShowRect_=function(){return!this.sourceBlock_.isShadow()&&"variables_get"!=this.sourceBlock_.type&&"variables_get_reporter"!=this.sourceBlock_.type};Blockly.FieldVariable.prototype.referencesVariables=function(){return!0};Blockly.Field.register("field_variable",Blockly.FieldVariable);
|
|
Blockly.FieldVerticalSeparator=function(){this.sourceBlock_=null;this.width_=1;this.height_=Blockly.BlockSvg.ICON_SEPARATOR_HEIGHT;this.size_=new goog.math.Size(this.width_,this.height_)};goog.inherits(Blockly.FieldVerticalSeparator,Blockly.Field);Blockly.FieldVerticalSeparator.fromJson=function(a){return new Blockly.FieldVerticalSeparator};Blockly.FieldVerticalSeparator.prototype.EDITABLE=!1;
|
|
Blockly.FieldVerticalSeparator.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.utils.dom.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.lineElement_=Blockly.utils.dom.createSvgElement("line",{stroke:this.sourceBlock_.getColourSecondary(),"stroke-linecap":"round",x1:0,y1:0,x2:0,y2:this.height_},this.fieldGroup_),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_))};
|
|
Blockly.FieldVerticalSeparator.prototype.setLineHeight=function(a){this.lineElement_.setAttribute("y2",a)};Blockly.FieldVerticalSeparator.prototype.dispose=function(){goog.dom.removeNode(this.fieldGroup_);this.lineElement_=this.fieldGroup_=null};Blockly.FieldVerticalSeparator.prototype.getValue=function(){return null};Blockly.FieldVerticalSeparator.prototype.setValue=function(a){};Blockly.FieldVerticalSeparator.prototype.setText=function(a){};Blockly.FieldVerticalSeparator.prototype.render_=function(){};
|
|
Blockly.FieldVerticalSeparator.prototype.updateWidth=function(){};Blockly.Field.register("field_vertical_separator",Blockly.FieldVerticalSeparator);Blockly.FieldSlider=function(a,b,c,d,e,f,g){Blockly.FieldSlider.superClass_.constructor.call(this,a,null,null,null,g);this.setConstraints_(b,c,d);this.step_=parseFloat(e);this.labelText_=f};goog.inherits(Blockly.FieldSlider,Blockly.FieldNumber);Blockly.FieldSlider.prototype.min_=null;Blockly.FieldSlider.prototype.max_=null;Blockly.FieldSlider.prototype.step_=null;Blockly.FieldSlider.prototype.precision_=null;Blockly.FieldSlider.prototype.labelText_=null;
|
|
Blockly.FieldSlider.fromJson=function(a){return new Blockly.FieldSlider(a.value,a.min,a.max,a.precision,a.step,a.labelText)};Blockly.FieldSlider.prototype.setOptions=function(a,b,c,d){this.setConstraints_(a,b,d);this.step_=parseFloat(c)||void 0;a=this.getNumRestrictor(this.min_,this.max_,this.precision_);this.setRestrictor(a)};Blockly.FieldSlider.prototype.setLabel=function(a){void 0!=a&&(this.labelText_=a)};Blockly.FieldSlider.prototype.setColor=function(a){void 0!=a&&(this.sliderColor_=a)};
|
|
Blockly.FieldSlider.prototype.init=function(){Blockly.FieldTextInput.superClass_.init.call(this);this.setValue(this.getValue());this.sourceBlock_.isEditable()&&(this.mouseOverWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_),this.mouseOutWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_))};
|
|
Blockly.FieldSlider.prototype.showEditor_=function(a){Blockly.FieldSlider.superClass_.showEditor_.call(this,a,!1);Infinity!=this.max_&&-Infinity!=this.min_&&(this.showSlider_(),this.setValue(this.getValue()))};
|
|
Blockly.FieldSlider.prototype.showSlider_=function(){Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();var a=Blockly.DropDownDiv.getContentDiv();a.setAttribute("role","menu");a.setAttribute("aria-haspopup","true");this.addSlider_(a);Blockly.DropDownDiv.setColour("#ffffff","#dddddd");Blockly.DropDownDiv.showPositionedByBlock(this,this.sourceBlock_);this.slider_&&this.slider_.setVisible(!0)};
|
|
Blockly.FieldSlider.prototype.addSlider_=function(a){if(this.labelText_){var b=this.createLabelDom_(this.labelText_);a.appendChild(b[0]);this.readout_=b[1]}this.slider_=new goog.ui.Slider;this.slider_.setMoveToPointEnabled(!1);this.slider_.setMinimum(this.min_);this.slider_.setMaximum(this.max_);this.step_&&this.slider_.setUnitIncrement(this.step_);this.slider_.setRightToLeft(this.sourceBlock_.RTL);b=parseFloat(this.getValue());b=isNaN(b)?0:b;this.slider_.setValue(b);this.slider_.render(a);var c=
|
|
this;Blockly.FieldSlider.changeEventKey_=goog.events.listen(this.slider_,goog.ui.Component.EventType.CHANGE,function(a){a=a.target.getValue()||0;c.sourceBlock_&&(a=c.callValidator(a));if(null!==a){c.setValue(a);var b=c.htmlInput_;b.value=a;b.focus()}});Blockly.FieldSlider.focusEventKey_=goog.events.listen(this.slider_.getElement(),goog.ui.Component.EventType.FOCUS,function(){c.htmlInput_.focus()})};
|
|
Blockly.FieldSlider.prototype.createLabelDom_=function(a){var b=document.createElement("div");b.setAttribute("class","blocklyFieldSliderLabel");var c=document.createElement("span");c.setAttribute("class","blocklyFieldSliderReadout");var d=document.createElement("span");d.setAttribute("class","blocklyFieldSliderLabelText");d.innerHTML=a;b.appendChild(d);b.appendChild(c);return[b,c]};
|
|
Blockly.FieldSlider.prototype.setValue=function(a){Blockly.FieldSlider.superClass_.setValue.call(this,a);this.updateSliderHandles_();this.updateDom_()};Blockly.FieldSlider.prototype.updateDom_=function(){this.slider_&&this.readout_&&(this.setBackground_(this.slider_.getElement()),this.setReadout_(this.readout_,this.getValue()))};
|
|
Blockly.FieldSlider.prototype.setBackground_=function(a){this.sliderColor_?goog.style.setStyle(a,"background",this.sliderColor_):this.sourceBlock_.isShadow()&&this.sourceBlock_.parentBlock_&&goog.style.setStyle(a,"background",this.sourceBlock_.parentBlock_.getColourTertiary())};Blockly.FieldSlider.prototype.setReadout_=function(a,b){a.innerHTML=b};Blockly.FieldSlider.prototype.updateSliderHandles_=function(){this.slider_&&this.slider_.setValue(parseFloat(this.getValue()))};
|
|
Blockly.FieldSlider.prototype.onHtmlInputChange_=function(a){Blockly.FieldSlider.superClass_.onHtmlInputChange_.call(this,a);this.slider_&&this.slider_.setValue(parseFloat(this.getValue()))};Blockly.FieldSlider.prototype.dispose=function(){Blockly.FieldSlider.changeEventKey_&&goog.events.unlistenByKey(Blockly.FieldSlider.changeEventKey_);Blockly.FieldSlider.focusEventKey_&&goog.events.unlistenByKey(Blockly.FieldSlider.focusEventKey_);Blockly.Events.setGroup(!1);Blockly.FieldSlider.superClass_.dispose.call(this)};
|
|
Blockly.Field.register("field_slider",Blockly.FieldSlider);Blockly.FieldString=function(a,b,c){Blockly.FieldString.superClass_.constructor.call(this,a,b);this.setRestrictor(c);this.addArgType("text")};goog.inherits(Blockly.FieldString,Blockly.FieldTextInput);Blockly.FieldString.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);b=new Blockly.FieldString(b,a["class"]);"boolean"==typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};Blockly.FieldString.quotePadding=0;
|
|
Blockly.FieldString.prototype.init=function(){Blockly.FieldTextInput.superClass_.init.call(this);this.quoteSize_=16;this.quoteWidth_=8;this.quoteRightX_=this.quoteLeftX_=0;this.quoteY_=22;this.quoteLeft_&&this.quoteLeft_.parentNode.removeChild(this.quoteLeft_);this.quoteLeft_=Blockly.utils.dom.createSvgElement("text",{"font-size":this.quoteSize_+"px","class":"field-text-quote"});this.quoteRight_&&this.quoteRight_.parentNode.removeChild(this.quoteRight_);this.quoteRight_=Blockly.utils.dom.createSvgElement("text",
|
|
{"font-size":this.quoteSize_+"px","class":"field-text-quote"});this.quoteLeft_.appendChild(document.createTextNode('"'));this.quoteRight_.appendChild(document.createTextNode('"'));var a=this.text_;this.text_=null;this.setText(a);this.mouseOverWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseover",this,this.onMouseOver_);this.mouseOutWrapper_=Blockly.bindEvent_(this.getClickTarget_(),"mouseout",this,this.onMouseOut_)};
|
|
Blockly.FieldString.prototype.setText=function(a){null!==a&&a!==this.text_&&(this.text_=a,this.textElement_&&this.textElement_.parentNode.appendChild(this.quoteLeft_),this.updateTextNode_(),this.textElement_&&this.textElement_.parentNode.appendChild(this.quoteRight_),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()))};
|
|
Blockly.FieldString.prototype.positionLeft=function(a){if(!this.quoteLeft_)return 0;this.quoteLeftX_=this.sourceBlock_.RTL?a+this.quoteWidth_+2*Blockly.FieldString.quotePadding:0;a=this.quoteWidth_+Blockly.FieldString.quotePadding;this.quoteLeft_.setAttribute("transform","translate("+this.quoteLeftX_+","+this.quoteY_+")");return a};
|
|
Blockly.FieldString.prototype.positionArrow=function(a){if(!this.quoteRight_)return 0;this.quoteRightX_=this.sourceBlock_.RTL?Blockly.FieldString.quotePadding:a+Blockly.FieldString.quotePadding;a=this.quoteWidth_+Blockly.FieldString.quotePadding;this.quoteRight_.setAttribute("transform","translate("+this.quoteRightX_+","+this.quoteY_+")");return a};Blockly.Field.register("field_string",Blockly.FieldString);Blockly.FieldArgumentEditor=function(a,b,c){Blockly.FieldArgumentEditor.superClass_.constructor.call(this,a,b,c)};goog.inherits(Blockly.FieldArgumentEditor,Blockly.FieldTextInput);Blockly.FieldArgumentEditor.REMOVE_ARG_URI="data:image/svg+xml;charset=UTF-8,%3c?xml version='1.0' encoding='UTF-8' standalone='no'?%3e%3csvg width='20px' height='20px' viewBox='0 0 20 20' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!-- Generator: Sketch 48.1 (47250) - http://www.bohemiancoding.com/sketch --%3e%3ctitle%3edelete-argument v2%3c/title%3e%3cdesc%3eCreated with Sketch.%3c/desc%3e%3cdefs%3e%3c/defs%3e%3cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3e%3cg id='delete-argument-v2' stroke='%23FF661A'%3e%3cg id='Group' transform='translate(3.000000, 2.500000)'%3e%3cpath d='M1,3 L13,3 L11.8900496,14.0995037 C11.8389294,14.6107055 11.4087639,15 10.8950124,15 L3.10498756,15 C2.59123611,15 2.16107055,14.6107055 2.10995037,14.0995037 L1,3 Z' id='Rectangle' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3c/path%3e%3cpath d='M7,11 L7,6' id='Line' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3c/path%3e%3cpath d='M9.5,11 L9.5,6' id='Line-Copy' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3c/path%3e%3cpath d='M4.5,11 L4.5,6' id='Line-Copy-2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3e%3c/path%3e%3crect id='Rectangle-2' fill='%23FF661A' x='0' y='2.5' width='14' height='1' rx='0.5'%3e%3c/rect%3e%3cpath d='M6,0 L8,0 C8.55228475,-1.01453063e-16 9,0.44771525 9,1 L9,3 L5,3 L5,1 C5,0.44771525 5.44771525,1.01453063e-16 6,0 Z' id='Rectangle-3' stroke-width='1.5'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
|
|
Blockly.FieldArgumentEditor.prototype.showEditor_=function(){Blockly.FieldArgumentEditor.superClass_.showEditor_.call(this);var a=Blockly.WidgetDiv.DIV;a.className+=" argumentEditorInput";var b=document.createElement("img");b.setAttribute("class","argumentEditorRemoveIcon");b.setAttribute("src",Blockly.FieldArgumentEditor.REMOVE_ARG_URI);this.removeButtonMouseWrapper_=Blockly.bindEvent_(b,"mousedown",this,this.removeCallback_);a.appendChild(b);if(this.sourceBlock_&&this.sourceBlock_.typeName_&&(b=
|
|
Blockly.PXTBlockly.FunctionUtils.getArgumentIcon(this.sourceBlock_.typeName_))){b+=" icon argumentEditorTypeIcon";var c=document.createElement("i");c.className=b;a.appendChild(c)}};Blockly.FieldArgumentEditor.prototype.removeCallback_=function(){this.sourceBlock_&&this.sourceBlock_.removeFieldCallback?this.sourceBlock_.removeFieldCallback(this):console.warn("Expected a source block with removeFieldCallback")};
|
|
Blockly.FieldArgumentEditor.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);b=new Blockly.FieldArgumentEditor(b,a["class"]);"boolean"==typeof a.spellcheck&&b.setSpellcheck(a.spellcheck);return b};Blockly.Field.register("field_argument_editor",Blockly.FieldArgumentEditor);Blockly.Generator=function(a){this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")};Blockly.Generator.NAME_TYPE="generated_function";Blockly.Generator.prototype.INFINITE_LOOP_TRAP=null;Blockly.Generator.prototype.STATEMENT_PREFIX=null;Blockly.Generator.prototype.STATEMENT_SUFFIX=null;Blockly.Generator.prototype.INDENT=" ";Blockly.Generator.prototype.COMMENT_WRAP=60;Blockly.Generator.prototype.ORDER_OVERRIDES=[];
|
|
Blockly.Generator.prototype.workspaceToCode=function(a){a||(console.warn("No workspace specified in workspaceToCode call. Guessing."),a=Blockly.getMainWorkspace());var b=[];this.init(a);a=a.getTopBlocks(!0);for(var c=0,d;d=a[c];c++){var e=this.blockToCode(d);Array.isArray(e)&&(e=e[0]);e&&(d.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!d.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,d)+e),this.STATEMENT_SUFFIX&&!d.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,
|
|
d))),b.push(e))}b=b.join("\n");b=this.finish(b);b=b.replace(/^\s+\n/,"");b=b.replace(/\n\s+$/,"\n");return b=b.replace(/[ \t]+\n/g,"\n")};Blockly.Generator.prototype.prefixLines=function(a,b){return b+a.replace(/(?!\n$)\n/g,"\n"+b)};Blockly.Generator.prototype.allNestedComments=function(a){var b=[];a=a.getDescendants(!0);for(var c=0;c<a.length;c++){var d=a[c].getCommentText();d&&b.push(d)}b.length&&b.push("");return b.join("\n")};
|
|
Blockly.Generator.prototype.blockToCode=function(a,b){if(!a)return"";if(!a.isEnabled())return b?"":this.blockToCode(a.getNextBlock());var c=this[a.type];if("function"!=typeof c)throw Error('Language "'+this.name_+'" does not know how to generate code for block type "'+a.type+'".');c=c.call(a,a);if(Array.isArray(c)){if(!a.outputConnection)throw TypeError("Expecting string from statement block: "+a.type);return[this.scrub_(a,c[0],b),c[1]]}if("string"==typeof c)return this.STATEMENT_PREFIX&&!a.suppressPrefixSuffix&&
|
|
(c=this.injectId(this.STATEMENT_PREFIX,a)+c),this.STATEMENT_SUFFIX&&!a.suppressPrefixSuffix&&(c+=this.injectId(this.STATEMENT_SUFFIX,a)),this.scrub_(a,c,b);if(null===c)return"";throw SyntaxError("Invalid code generated: "+c);};
|
|
Blockly.Generator.prototype.valueToCode=function(a,b,c){if(isNaN(c))throw TypeError("Expecting valid order from block: "+a.type);var d=a.getInputTargetBlock(b);if(!d)return"";b=this.blockToCode(d);if(""===b)return"";if(!Array.isArray(b))throw TypeError("Expecting tuple from value block: "+d.type);a=b[0];b=b[1];if(isNaN(b))throw TypeError("Expecting valid order from value block: "+d.type);if(!a)return"";d=!1;var e=Math.floor(c),f=Math.floor(b);if(e<=f&&(e!=f||0!=e&&99!=e))for(d=!0,e=0;e<this.ORDER_OVERRIDES.length;e++)if(this.ORDER_OVERRIDES[e][0]==
|
|
c&&this.ORDER_OVERRIDES[e][1]==b){d=!1;break}d&&(a="("+a+")");return a};Blockly.Generator.prototype.statementToCode=function(a,b){var c=a.getInputTargetBlock(b),d=this.blockToCode(c);if("string"!=typeof d)throw TypeError("Expecting code from statement block: "+(c&&c.type));d&&(d=this.prefixLines(d,this.INDENT));return d};
|
|
Blockly.Generator.prototype.addLoopTrap=function(a,b){this.INFINITE_LOOP_TRAP&&(a=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,b),this.INDENT)+a);this.STATEMENT_SUFFIX&&!b.suppressPrefixSuffix&&(a=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,b),this.INDENT)+a);this.STATEMENT_PREFIX&&!b.suppressPrefixSuffix&&(a+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,b),this.INDENT));return a};
|
|
Blockly.Generator.prototype.injectId=function(a,b){var c=b.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+c+"'")};Blockly.Generator.prototype.RESERVED_WORDS_="";Blockly.Generator.prototype.addReservedWords=function(a){this.RESERVED_WORDS_+=a+","};Blockly.Generator.prototype.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}";
|
|
Blockly.Generator.prototype.provideFunction_=function(a,b){if(!this.definitions_[a]){var c=this.variableDB_.getDistinctName(a,Blockly.Procedures.NAME_TYPE);this.functionNames_[a]=c;c=b.join("\n").replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,c);for(var d;d!=c;)d=c,c=c.replace(/^(( {2})*) {2}/gm,"$1\x00");c=c.replace(/\0/g,this.INDENT);this.definitions_[a]=c}return this.functionNames_[a]};Blockly.Generator.prototype.init=function(a){};Blockly.Generator.prototype.scrub_=function(a,b){return b};
|
|
Blockly.Generator.prototype.finish=function(a){return a};Blockly.Generator.prototype.scrubNakedValue=function(a){return a};Blockly.Names=function(a,b){this.variablePrefix_=b||"";this.reservedDict_=Object.create(null);if(a)for(var c=a.split(","),d=0;d<c.length;d++)this.reservedDict_[c[d]]=!0;this.reset()};Blockly.Names.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE";Blockly.Names.prototype.reset=function(){this.db_=Object.create(null);this.dbReverse_=Object.create(null);this.variableMap_=null};Blockly.Names.prototype.setVariableMap=function(a){this.variableMap_=a};
|
|
Blockly.Names.prototype.getNameForUserVariable_=function(a){return this.variableMap_?(a=this.variableMap_.getVariableById(a))?a.name:null:(console.log("Deprecated call to Blockly.Names.prototype.getName without defining a variable map. To fix, add the folowing code in your generator's init() function:\nBlockly.YourGeneratorName.variableDB_.setVariableMap(workspace.getVariableMap());"),null)};
|
|
Blockly.Names.prototype.getName=function(a,b){if(b==Blockly.Variables.NAME_TYPE){var c=this.getNameForUserVariable_(a);c&&(a=c)}c=a.toLowerCase()+"_"+b;var d=b==Blockly.Variables.NAME_TYPE||b==Blockly.Names.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"";if(c in this.db_)return d+this.db_[c];var e=this.getDistinctName(a,b);this.db_[c]=e.substr(d.length);return e};
|
|
Blockly.Names.prototype.getDistinctName=function(a,b){for(var c=this.safeName_(a),d="";this.dbReverse_[c+d]||c+d in this.reservedDict_;)d=d?d+1:2;c+=d;this.dbReverse_[c]=!0;return(b==Blockly.Variables.NAME_TYPE||b==Blockly.Names.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"")+c};Blockly.Names.prototype.safeName_=function(a){a?(a=encodeURI(a.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(a[0])&&(a="my_"+a)):a="unnamed";return a};
|
|
Blockly.Names.equals=function(a,b){return a.toLowerCase()==b.toLowerCase()};Blockly.Procedures={};Blockly.Procedures.NAME_TYPE=Blockly.PROCEDURE_CATEGORY_NAME;Blockly.Procedures.allProcedures=function(a){a=a.getAllBlocks(!1);for(var b=[],c=[],d=0;d<a.length;d++)if(a[d].getProcedureDef){var e=a[d].getProcedureDef();e&&(e[2]?b.push(e):c.push(e))}c.sort(Blockly.Procedures.procTupleComparator_);b.sort(Blockly.Procedures.procTupleComparator_);return[c,b]};Blockly.Procedures.procTupleComparator_=function(a,b){return a[0].toLowerCase().localeCompare(b[0].toLowerCase())};
|
|
Blockly.Procedures.findLegalName=function(a,b){if(b.isInFlyout)return a;for(;!Blockly.Procedures.isLegalName_(a,b.workspace,b);){var c=a.match(/^(.*?)(\d+)$/);a=c?c[1]+(parseInt(c[2],10)+1):a+"2"}return a};Blockly.Procedures.isLegalName_=function(a,b,c){return!Blockly.Procedures.isNameUsed(a,b,c)};
|
|
Blockly.Procedures.isNameUsed=function(a,b,c){b=b.getAllBlocks(!1);for(var d=0;d<b.length;d++)if(b[d]!=c){var e="";b[d].getProcedureDef?e=b[d].getProcedureDef()[0]:b[d].getName&&(e=b[d].getName());if(Blockly.Names.equals(e,a))return!0}return!1};
|
|
Blockly.Procedures.rename=function(a){a=a.trim();var b=Blockly.Procedures.findLegalName(a,this.getSourceBlock()),c=this.getValue();if(!b)return c;if(c!=a&&c!=b){a=this.getSourceBlock().workspace.getAllBlocks(!1);for(var d=0;d<a.length;d++)a[d].renameProcedure&&a[d].renameProcedure(c,b)}return b};
|
|
Blockly.Procedures.flyoutCategory=function(a){function b(a,b){for(var d=0;d<a.length;d++){var e=a[d][0],f=a[d][1],g=Blockly.utils.xml.createElement("block");g.setAttribute("type",b);g.setAttribute("gap",16);var n=Blockly.utils.xml.createElement("mutation");n.setAttribute("name",e);g.appendChild(n);for(e=0;e<f.length;e++){var p=Blockly.utils.xml.createElement("arg");p.setAttribute("name",f[e]);n.appendChild(p)}c.push(g)}}var c=[];if(Blockly.Blocks.procedures_defnoreturn){var d=Blockly.utils.xml.createElement("block");
|
|
d.setAttribute("type","procedures_defnoreturn");d.setAttribute("gap",16);var e=Blockly.utils.xml.createElement("field");e.setAttribute("name","NAME");e.appendChild(Blockly.utils.xml.createTextNode(Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE));d.appendChild(e);c.push(d)}Blockly.Blocks.procedures_defreturn&&(d=Blockly.utils.xml.createElement("block"),d.setAttribute("type","procedures_defreturn"),d.setAttribute("gap",16),e=Blockly.utils.xml.createElement("field"),e.setAttribute("name","NAME"),e.appendChild(Blockly.utils.xml.createTextNode(Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE)),
|
|
d.appendChild(e),c.push(d));Blockly.Blocks.procedures_ifreturn&&(d=Blockly.utils.xml.createElement("block"),d.setAttribute("type","procedures_ifreturn"),d.setAttribute("gap",16),c.push(d));c.length&&c[c.length-1].setAttribute("gap",24);a=Blockly.Procedures.allProcedures(a);b(a[0],"procedures_callnoreturn");b(a[1],"procedures_callreturn");return c};
|
|
Blockly.Procedures.getCallers=function(a,b){for(var c=[],d=b.getAllBlocks(!1),e=0;e<d.length;e++)if(d[e].getProcedureCall){var f=d[e].getProcedureCall();f&&Blockly.Names.equals(f,a)&&c.push(d[e])}return c};
|
|
Blockly.Procedures.mutateCallers=function(a){var b=Blockly.Events.recordUndo,c=a.getProcedureDef()[0],d=a.mutationToDom(!0);a=Blockly.Procedures.getCallers(c,a.workspace);c=0;for(var e;e=a[c];c++){var f=e.mutationToDom();f=f&&Blockly.Xml.domToText(f);e.domToMutation(d);var g=e.mutationToDom();g=g&&Blockly.Xml.domToText(g);f!=g&&(Blockly.Events.recordUndo=!1,Blockly.Events.fire(new Blockly.Events.BlockChange(e,"mutation",null,f,g)),Blockly.Events.recordUndo=b)}};
|
|
Blockly.Procedures.getDefinition=function(a,b){for(var c=b.getTopBlocks(!1),d=0;d<c.length;d++)if(c[d].getProcedureDef){var e=c[d].getProcedureDef();if(e&&Blockly.Names.equals(e[0],a))return c[d]}return null};Blockly.Functions={};Blockly.Functions.NAME_TYPE=Blockly.PROCEDURE_CATEGORY_NAME;
|
|
Blockly.Functions.flyoutCategory=function(a){var b=[];Blockly.Functions.addCreateButton_(a,b);a=Blockly.Functions.getAllFunctionDefinitionBlocks(a);for(var c=0;c<a.length;c++){var d=a[c].getName(),e=a[c].getArguments(),f=Blockly.utils.xml.createElement("block");f.setAttribute("type","function_call");f.setAttribute("gap",16);var g=Blockly.utils.xml.createElement("mutation");g.setAttribute("name",d);f.appendChild(g);for(d=0;d<e.length;d++){var h=Blockly.utils.xml.createElement("arg");h.setAttribute("name",
|
|
e[d].name);h.setAttribute("type",e[d].type);h.setAttribute("id",e[d].id);g.appendChild(h)}b.push(f)}return b};Blockly.Functions.addCreateButton_=function(a,b){var c=document.createElement("button");c.setAttribute("text",Blockly.Msg.FUNCTION_CREATE_NEW);c.setAttribute("callbackKey","CREATE_FUNCTION");a.registerButtonCallback("CREATE_FUNCTION",function(){Blockly.Functions.createFunctionCallback_(a)});b.push(c)};
|
|
Blockly.Functions.getCallers=function(a,b){for(var c=[],d=b.getAllBlocks(),e=0;e<d.length;e++)d[e].getName&&d[e].getName()==a&&c.push(d[e]);return c};Blockly.Functions.getDefinition=function(a,b){for(var c=b.getTopBlocks(!1),d=0;d<c.length;d++)if(c[d].type==Blockly.FUNCTION_DEFINITION_BLOCK_TYPE&&c[d].getName&&c[d].getName()==a)return c[d];return null};
|
|
Blockly.Functions.getAllFunctionDefinitionBlocks=function(a){a=a.getTopBlocks(!1);for(var b=[],c=0;c<a.length;c++)a[c].type===Blockly.FUNCTION_DEFINITION_BLOCK_TYPE&&b.push(a[c]);return b};Blockly.Functions.isCustomType=function(a){return!("boolean"==a||"string"==a||"number"==a)};
|
|
Blockly.Functions.newFunctionMutation=function(a){a='<xml><mutation name="'+Blockly.Functions.findLegalName(Blockly.Msg.FUNCTIONS_DEFAULT_FUNCTION_NAME,a)+'" functionid="'+Blockly.utils.genUid()+'"></mutation></xml>';a=Blockly.Xml.textToDom(a).firstChild;a.removeAttribute("xmlns");return a};Blockly.Functions.incrementNameSuffix=function(a){var b=a.match(/^(.*?)(\d+)$/);return a=b?b[1]+(parseInt(b[2],10)+1):a+"2"};
|
|
Blockly.Functions.findUniqueParamName=function(a,b){for(;!Blockly.Functions.isUniqueParamName(a,b);)a=Blockly.Functions.incrementNameSuffix(a);return a};Blockly.Functions.isUniqueParamName=function(a,b){return b?-1==b.indexOf(a):!0};Blockly.Functions.createFunctionCallback_=function(a){Blockly.hideChaff();Blockly.selected&&Blockly.selected.unselect();Blockly.Functions.editFunctionExternalHandler(Blockly.Functions.newFunctionMutation(a),Blockly.Functions.createFunctionCallbackFactory_(a))};
|
|
Blockly.Functions.createFunctionCallbackFactory_=function(a){return function(b){if(b){b='<xml><block type="'+Blockly.FUNCTION_DEFINITION_BLOCK_TYPE+'">'+Blockly.Xml.domToText(b)+"</block></xml>";b=Blockly.Xml.textToDom(b);Blockly.Events.setGroup(!0);var c=a.getTopBlocks(!0)[0];b=Blockly.Xml.domToBlock(b.firstChild,a);if(c){var d=c.getBoundingRectangle();c=d.top;d=d.left;var e=b.getHeightWidth().height;b.moveBy(d,c-e-20/a.scale);b.scheduleSnapAndBump()}a.centerOnBlock(b.id);Blockly.Events.setGroup(!1)}}};
|
|
Blockly.Functions.editFunctionCallback_=function(a){if(a.type==Blockly.FUNCTION_CALL_BLOCK_TYPE){var b=a.workspace.isFlyout?a.workspace.targetWorkspace:a.workspace;a=Blockly.Functions.getDefinition(a.getName(),b)}Blockly.hideChaff();Blockly.selected&&Blockly.selected.unselect();Blockly.Functions.editFunctionExternalHandler(a.mutationToDom(),Blockly.Functions.editFunctionCallbackFactory_(a))};
|
|
Blockly.Functions.editFunctionCallbackFactory_=function(a){return function(b){b&&Blockly.Functions.mutateCallersAndDefinition(a.getName(),a.workspace,b)}};Blockly.Functions.editFunctionExternalHandler=function(a,b){console.warn("External function editor must be overriden: Blockly.Functions.editFunctionExternalHandler",a,b)};Blockly.Functions.makeEditOption=function(a){return{enabled:!0,text:Blockly.Msg.FUNCTIONS_EDIT_OPTION,callback:function(){Blockly.Functions.editFunctionCallback_(a)}}};
|
|
Blockly.Functions.getReporterArgumentType=function(a){switch(a){case "Boolean":case "Number":case "String":return a.toLowerCase();default:return a}};
|
|
Blockly.Functions.namesInUse=function(a,b,c){var d={};a.getAllVariables().forEach(function(a){d[a.name]=!0});a.getAllBlocks().forEach(function(a){if(!(a==b||c&&a.getFunctionId&&a.getFunctionId()==c))if(a.type==Blockly.FUNCTION_DEFINITION_BLOCK_TYPE)d[a.getName()]=!0;else if("procedures_defreturn"==a.type||"procedures_defnoreturn"==a.type)d[a.getProcedureDef()[0]]=!0});return d};
|
|
Blockly.Functions.findLegalName=function(a,b,c){if(c&&c.isInFlyout)return a;for(b=Blockly.Functions.namesInUse(b,c);b[a];)a=Blockly.Functions.incrementNameSuffix(a);return a};
|
|
Blockly.Functions.rename=function(a){a=a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"");var b=Blockly.Functions.findLegalName(a,this.sourceBlock_.workspace,this.sourceBlock_),c=this.text_;if(!b)return c;if(c!=a&&c!=b){a=this.sourceBlock_;a.name_=b;var d=a.mutationToDom();a.name_=c;Blockly.Functions.mutateCallersAndDefinition(c,a.workspace,d)}return b};
|
|
Blockly.Functions.validateFunctionExternal=function(a,b){var c=a.getAttribute("name");if(!c)return Blockly.alert(Blockly.Msg.FUNCTION_WARNING_EMPTY_NAME),!1;for(var d={},e=0;e<a.childNodes.length;++e){var f=a.childNodes[e].getAttribute("name");if(!f)return Blockly.alert(Blockly.Msg.FUNCTION_WARNING_EMPTY_NAME),!1;if(d[f])return Blockly.alert(Blockly.Msg.FUNCTION_WARNING_DUPLICATE_ARG),!1;d[f]=!0}if(d[c])return Blockly.alert(Blockly.Msg.FUNCTION_WARNING_ARG_NAME_IS_FUNCTION_NAME),!1;d=a.getAttribute("functionid");
|
|
return Blockly.Functions.namesInUse(b,null,d)[c]?(Blockly.alert(Blockly.Msg.VARIABLE_ALREADY_EXISTS.replace("%1",c)),!1):!0};Blockly.Functions.getArgMap=function(a,b){for(var c={},d=0;d<a.childNodes.length;++d){var e=a.childNodes[d],f=b?e.getAttribute("id"):e.getAttribute("name");e=b?e.getAttribute("name"):e.getAttribute("id");c[f]=e}return c};
|
|
Blockly.Functions.mutateCallersAndDefinition=function(a,b,c){var d=Blockly.Functions.getDefinition(a,b);d?(a=Blockly.Functions.getCallers(a,d.workspace),a.push(d),Blockly.Events.setGroup(!0),a.forEach(function(a){var b=a.mutationToDom(),e=b&&Blockly.Xml.domToText(b);a.domToMutation(c);var h=a.mutationToDom(),k=h&&Blockly.Xml.domToText(h);if(e!=k)if(Blockly.Events.fire(new Blockly.Events.BlockChange(a,"mutation",null,e,k)),a.id==d.id){var l=Blockly.Functions.getArgMap(b),m=Blockly.Functions.getArgMap(h,
|
|
!0);d.getDescendants().forEach(function(a){if(Blockly.Functions.isFunctionArgumentReporter(a)){var b=a.getFieldValue("VALUE"),c=l[b];m[c]?m[c]!==b&&a.setFieldValue(m[c],"VALUE"):a.dispose()}})}else setTimeout(function(){a.bumpNeighbours_()},Blockly.BUMP_DELAY)}),Blockly.Events.setGroup(!1)):console.warn("Attempted to change function "+a+", but no definition block was found on the workspace")};
|
|
Blockly.Functions.isFunctionArgumentReporter=function(a){return"argument_reporter_boolean"==a.type||"argument_reporter_number"==a.type||"argument_reporter_string"==a.type||"argument_reporter_custom"==a.type};
|
|
Blockly.Functions.createFlyout=function(a,b){var c={disabledPatternId:a.options.disabledPatternId,parentWorkspace:a,RTL:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,toolboxPosition:a.options.toolboxPosition,zoomOptions:a.options.zoomOptions,newFunctions:a.options.newFunctions};c=c.horizontalLayout?new Blockly.HorizontalFlyout(c):new Blockly.VerticalFlyout(c);var d=c.createDom("svg");goog.dom.insertSiblingAfter(d,b);c.init(a);return c};Blockly.FlyoutButton=function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.getAttribute("text");this.position_=new Blockly.utils.Coordinate(0,0);this.isLabel_=d;this.helpButtonIcon_=c.getAttribute("web-help-button")||null;this.callbackKey_=c.getAttribute("callbackKey");this.cssClass_=c.getAttribute("web-class")||null;this.icon_=c.getAttribute("web-icon")||null;this.iconClass_=c.getAttribute("web-icon-class")||null;this.iconColor_=c.getAttribute("web-icon-color")||null;this.line_=
|
|
c.getAttribute("web-line")||null;this.lineWidth_=c.getAttribute("web-line-width")||null};Blockly.FlyoutButton.MARGIN=40;Blockly.FlyoutButton.prototype.width=0;Blockly.FlyoutButton.prototype.height=40;Blockly.FlyoutButton.prototype.onMouseUpWrapper_=null;Blockly.FlyoutButton.HELP_IMAGE_URI="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAyNiAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTMiIGN5PSIxMyIgcj0iMTMiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0xNy45NTIgOS4xODQwMkMxNy45NTIgMTAuMjU2IDE3LjgxNiAxMS4wNzIgMTcuNTQ0IDExLjYzMkMxNy4yODggMTIuMTkyIDE2Ljc1MiAxMi43OTIgMTUuOTM2IDEzLjQzMkMxNS4xMiAxNC4wNzIgMTQuNTc2IDE0LjU4NCAxNC4zMDQgMTQuOTY4QzE0LjA0OCAxNS4zMzYgMTMuOTIgMTUuNzM2IDEzLjkyIDE2LjE2OFYxNi45NkgxMS44MDhDMTEuNDI0IDE2LjQ2NCAxMS4yMzIgMTUuODQgMTEuMjMyIDE1LjA4OEMxMS4yMzIgMTQuNjg4IDExLjM4NCAxNC4yODggMTEuNjg4IDEzLjg4OEMxMS45OTIgMTMuNDg4IDEyLjUzNiAxMi45NjggMTMuMzIgMTIuMzI4QzE0LjEwNCAxMS42NzIgMTQuNjI0IDExLjE2OCAxNC44OCAxMC44MTZDMTUuMTM2IDEwLjQ0OCAxNS4yNjQgOS45NjgwMiAxNS4yNjQgOS4zNzYwMkMxNS4yNjQgOC4yMDgwMiAxNC40MTYgNy42MjQwMiAxMi43MiA3LjYyNDAyQzExLjc2IDcuNjI0MDIgMTAuNzUyIDcuNzM2MDIgOS42OTYgNy45NjAwMkw5LjE0NCA4LjA4MDAyTDkgNi4wODgwMkMxMC40ODggNS41NjAwMiAxMS44NCA1LjI5NjAyIDEzLjA1NiA1LjI5NjAyQzE0LjczNiA1LjI5NjAyIDE1Ljk2OCA1LjYwODAyIDE2Ljc1MiA2LjIzMjAyQzE3LjU1MiA2Ljg0MDAyIDE3Ljk1MiA3LjgyNDAyIDE3Ljk1MiA5LjE4NDAyWk0xMS40IDIyVjE4LjY0SDE0LjE4NFYyMkgxMS40WiIgZmlsbD0iIzU5NUU3NCIvPgo8L3N2Zz4K";
|
|
Blockly.FlyoutButton.prototype.createDom=function(){var a=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass_&&(a+=" "+this.cssClass_);this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":a},this.workspace_.getCanvas());if(!this.isLabel_)var b=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);a=Blockly.utils.dom.createSvgElement("rect",{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",
|
|
rx:4,ry:4},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);c.textContent=Blockly.utils.replaceMessageReferences(this.text_);this.width=Blockly.Field.getCachedWidth(c);if(this.icon_||this.iconClass_){var d=Blockly.utils.dom.createSvgElement("text",{"class":this.iconClass_?"blocklyFlyoutLabelIcon "+this.iconClass_:"blocklyFlyoutLabelIcon",x:0,y:0,"text-anchor":"start"},this.svgGroup_);
|
|
this.icon_&&(d.textContent=this.icon_);this.iconColor_&&d.setAttribute("style","fill: "+this.iconColor_);d.setAttribute("dominant-baseline","central");d.setAttribute("dy",Blockly.utils.userAgent.EDGE_OR_IE?Blockly.Field.IE_TEXT_OFFSET:"0");d.setAttribute("x",this.targetWorkspace_.RTL?this.width+Blockly.FlyoutButton.MARGIN:0);d.setAttribute("y",this.height/2);this.width+=Blockly.Field.getCachedWidth(d)+Blockly.FlyoutButton.MARGIN}this.helpButtonIcon_&&(this.helpButtonImage_=Blockly.utils.dom.createSvgElement("image",
|
|
{"class":"blocklyFlyoutButton",height:"25px",width:"25px",x:(this.workspace_.RTL?-this.width+Blockly.FlyoutButton.MARGIN+15:this.width+15)+"px",y:"10px"},this.svgGroup_),this.helpButtonImage_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.FlyoutButton.HELP_IMAGE_URI));this.line_&&(d=Blockly.utils.dom.createSvgElement("line",{"class":"blocklyFlyoutLine","stroke-dasharray":this.line_,"text-anchor":"middle"},this.svgGroup_),d.setAttribute("x1",0),d.setAttribute("x2",null!=this.lineWidth_?
|
|
this.lineWidth_:this.width),d.setAttribute("y1",this.height),d.setAttribute("y2",this.height));this.isLabel_||(this.width+=2*Blockly.FlyoutButton.MARGIN,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);c.setAttribute("text-anchor","middle");c.setAttribute("dominant-baseline","central");c.setAttribute("dy",Blockly.utils.userAgent.EDGE_OR_IE?Blockly.Field.IE_TEXT_OFFSET:"0");c.setAttribute("x",this.width/
|
|
2);c.setAttribute("y",this.height/2);this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(this.helpButtonIcon_&&this.callback_?this.helpButtonImage_:this.svgGroup_,"mouseup",this,this.onMouseUp_);return this.svgGroup_};Blockly.FlyoutButton.prototype.show=function(){this.updateTransform_();this.svgGroup_.setAttribute("display","block")};Blockly.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")};
|
|
Blockly.FlyoutButton.prototype.moveTo=function(a,b){this.position_.x=a;this.position_.y=b;this.updateTransform_()};Blockly.FlyoutButton.prototype.getPosition=function(){return this.position_};Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_};Blockly.FlyoutButton.prototype.getText=function(){return this.text_};Blockly.FlyoutButton.prototype.getPosition=function(){return this.position_};
|
|
Blockly.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&Blockly.unbindEvent_(this.onMouseUpWrapper_);this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace_=this.workspace_=null};
|
|
Blockly.FlyoutButton.prototype.onMouseUp_=function(a){(a=this.targetWorkspace_.getGesture(a))&&a.cancel();this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)};Blockly.Flyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);this.workspace_=new Blockly.WorkspaceSvg(a);this.workspace_.isFlyout=!0;this.RTL=!!a.RTL;this.toolboxPosition_=a.toolboxPosition;this.eventWrappers_=[];this.mats_=[];this.buttons_=[];this.listeners_=[];this.permanentlyDisabled_=[]};Blockly.Flyout.prototype.autoClose=!0;Blockly.Flyout.prototype.isVisible_=!1;Blockly.Flyout.prototype.containerVisible_=!0;
|
|
Blockly.Flyout.prototype.CORNER_RADIUS=8;Blockly.Flyout.prototype.MARGIN=Blockly.Flyout.prototype.CORNER_RADIUS;Blockly.Flyout.prototype.GAP_X=3*Blockly.Flyout.prototype.MARGIN;Blockly.Flyout.prototype.GAP_Y=3*Blockly.Flyout.prototype.MARGIN;Blockly.Flyout.prototype.SCROLLBAR_PADDING=2;Blockly.Flyout.prototype.width_=0;Blockly.Flyout.prototype.height_=0;Blockly.Flyout.prototype.dragAngleRange_=70;Blockly.Flyout.prototype.svgGroup_=null;Blockly.Flyout.prototype.scrollbar_=null;
|
|
Blockly.Flyout.prototype.targetWorkspace_=null;Blockly.Flyout.prototype.createDom=function(a){this.svgGroup_=Blockly.utils.dom.createSvgElement(a,{"class":"blocklyFlyout",style:"display: none"},null);this.svgBackground_=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_);this.svgGroup_.appendChild(this.workspace_.createDom());return this.svgGroup_};
|
|
Blockly.Flyout.prototype.init=function(a){this.targetWorkspace_=a;this.workspace_.targetWorkspace=a;this.scrollbar_=new Blockly.Scrollbar(this.workspace_,this.horizontalLayout_,!1,"blocklyFlyoutScrollbar");this.hide();Array.prototype.push.apply(this.eventWrappers_,Blockly.bindEventWithChecks_(this.svgGroup_,"wheel",this,this.wheel_));this.autoClose||(this.filterWrapper_=this.filterForCapacity_.bind(this),this.targetWorkspace_.addChangeListener(this.filterWrapper_));Array.prototype.push.apply(this.eventWrappers_,
|
|
Blockly.bindEventWithChecks_(this.svgBackground_,"mousedown",this,this.onMouseDown_));this.workspace_.getGesture=this.targetWorkspace_.getGesture.bind(this.targetWorkspace_);this.workspace_.variableMap_=this.targetWorkspace_.getVariableMap();this.workspace_.createPotentialVariableMap()};
|
|
Blockly.Flyout.prototype.dispose=function(){this.hide();this.clearOldEventListeners_();Blockly.unbindEvent_(this.eventWrappers_);this.filterWrapper_&&(this.targetWorkspace_.removeChangeListener(this.filterWrapper_),this.filterWrapper_=null);this.scrollbar_&&(this.scrollbar_.dispose(),this.scrollbar_=null);this.workspace_&&(this.workspace_.targetWorkspace=null,this.workspace_.dispose(),this.workspace_=null);this.svgGroup_&&(Blockly.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null);this.targetWorkspace_=
|
|
this.svgBackground_=null};Blockly.Flyout.prototype.getWidth=function(){return this.width_};Blockly.Flyout.prototype.getHeight=function(){return this.height_};Blockly.Flyout.prototype.getWorkspace=function(){return this.workspace_};Blockly.Flyout.prototype.isVisible=function(){return this.isVisible_};Blockly.Flyout.prototype.setVisible=function(a){var b=a!=this.isVisible();this.isVisible_=a;b&&this.updateDisplay_()};
|
|
Blockly.Flyout.prototype.setContainerVisible=function(a){var b=a!=this.containerVisible_;this.containerVisible_=a;b&&this.updateDisplay_()};Blockly.Flyout.prototype.updateDisplay_=function(){var a=this.containerVisible_?this.isVisible():!1;this.svgGroup_.style.display=a?"block":"none";this.scrollbar_.setContainerVisible(a)};
|
|
Blockly.Flyout.prototype.positionAt_=function(a,b,c,d){this.svgGroup_.setAttribute("width",a);this.svgGroup_.setAttribute("height",b);"svg"==this.svgGroup_.tagName?Blockly.utils.dom.setCssTransform(this.svgGroup_,"translate("+c+"px,"+d+"px)"):this.svgGroup_.setAttribute("transform","translate("+c+","+d+")");this.scrollbar_&&(this.scrollbar_.setOrigin(c,d),this.scrollbar_.resize(),this.scrollbar_.setPosition_(this.scrollbar_.position_.x,this.scrollbar_.position_.y))};
|
|
Blockly.Flyout.prototype.hide=function(){this.isVisible()&&this.setVisible(!1)};Blockly.Flyout.prototype.clearOldEventListeners_=function(){for(var a=0,b;b=this.listeners_[a];a++)Blockly.unbindEvent_(b);this.listeners_.length=0;this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)};
|
|
Blockly.Flyout.prototype.show=function(a){this.workspace_.setResizesEnabled(!1);this.hide();this.clearOldEventListeners_();this.clearOldBlocks_();if("string"==typeof a){a=this.workspace_.targetWorkspace.getToolboxCategoryCallback(a);if("function"!=typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");a=a(this.workspace_.targetWorkspace);if(!Array.isArray(a))throw TypeError("Result of toolbox category callback must be an array.");}this.setVisible(!0);var b=
|
|
[],c=[];this.permanentlyDisabled_.length=0;for(var d=this.horizontalLayout_?this.GAP_X:this.GAP_Y,e=0,f;f=a[e];e++)if(f.tagName)switch(f.tagName.toUpperCase()){case "BLOCK":var g=Blockly.Xml.domToBlock(f,this.workspace_);g.isEnabled()||this.permanentlyDisabled_.push(g);b.push({type:"block",block:g});f=parseInt(f.getAttribute("gap"),10);c.push(isNaN(f)?d:f);break;case "SEP":f=parseInt(f.getAttribute("gap"),10);!isNaN(f)&&0<c.length?c[c.length-1]=f:c.push(d);break;case "LABEL":case "BUTTON":g="LABEL"==
|
|
f.tagName.toUpperCase(),f=new Blockly.FlyoutButton(this.workspace_,this.targetWorkspace_,f,g),b.push({type:"button",button:f}),c.push(d)}this.layout_(b,c);this.listeners_.push(Blockly.bindEventWithChecks_(this.svgBackground_,"mouseover",this,function(){for(var a=this.workspace_.getTopBlocks(!1),b=0,c;c=a[b];b++)c.removeSelect()}));this.horizontalLayout_?this.height_=0:this.width_=0;this.workspace_.setResizesEnabled(!0);this.reflow();this.filterForCapacity_();this.position();this.reflowWrapper_=this.reflow.bind(this);
|
|
this.workspace_.addChangeListener(this.reflowWrapper_)};Blockly.Flyout.prototype.clearOldBlocks_=function(){for(var a=this.workspace_.getTopBlocks(!1),b=0,c;c=a[b];b++)c.workspace==this.workspace_&&c.dispose(!1,!1);for(b=0;b<this.mats_.length;b++)(a=this.mats_[b])&&Blockly.utils.dom.removeNode(a);for(b=this.mats_.length=0;a=this.buttons_[b];b++)a.dispose();this.buttons_.length=0;this.workspace_.getPotentialVariableMap().clear()};
|
|
Blockly.Flyout.prototype.addBlockListeners_=function(a,b,c){this.listeners_.push(Blockly.bindEventWithChecks_(a,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(Blockly.bindEventWithChecks_(c,"mousedown",null,this.blockMouseDown_(b)));this.listeners_.push(Blockly.bindEvent_(a,"mouseenter",b,b.addSelect));this.listeners_.push(Blockly.bindEvent_(a,"mouseleave",b,b.removeSelect));this.listeners_.push(Blockly.bindEvent_(c,"mouseenter",b,b.addSelect));this.listeners_.push(Blockly.bindEvent_(c,
|
|
"mouseleave",b,b.removeSelect))};Blockly.Flyout.prototype.blockMouseDown_=function(a){var b=this;return function(c){var d=b.targetWorkspace_.getGesture(c);d&&(d.setStartBlock(a),d.handleFlyoutStart(c,b))}};Blockly.Flyout.prototype.onMouseDown_=function(a){var b=this.targetWorkspace_.getGesture(a);b&&b.handleFlyoutStart(a,this)};Blockly.Flyout.prototype.isBlockCreatable_=function(a){return a.isEnabled()};
|
|
Blockly.Flyout.prototype.createBlock=function(a){var b=null;Blockly.Events.disable();var c=this.targetWorkspace_.getAllVariables();this.targetWorkspace_.setResizesEnabled(!1);try{b=this.placeNewBlock_(a),Blockly.hideChaff()}finally{Blockly.Events.enable()}a=Blockly.Variables.getAddedVariables(this.targetWorkspace_,c);if(Blockly.Events.isEnabled())for(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(b)),c=0;c<a.length;c++)Blockly.Events.fire(new Blockly.Events.VarCreate(a[c]));
|
|
this.autoClose?this.hide():this.filterForCapacity_();return b};Blockly.Flyout.prototype.initFlyoutButton_=function(a,b,c){var d=a.createDom();a.moveTo(b,c);a.show();this.listeners_.push(Blockly.bindEventWithChecks_(d,"mousedown",this,this.onMouseDown_));this.buttons_.push(a)};
|
|
Blockly.Flyout.prototype.createRect_=function(a,b,c,d,e){b=Blockly.utils.dom.createSvgElement("rect",{"fill-opacity":0,x:b,y:c,height:d.height,width:d.width},null);b.tooltip=a;Blockly.Tooltip.bindMouseEvents(b);this.workspace_.getCanvas().insertBefore(b,a.getSvgRoot());a.flyoutRect_=b;return this.mats_[e]=b};
|
|
Blockly.Flyout.prototype.moveRectToBlock_=function(a,b){var c=b.getHeightWidth();a.setAttribute("width",c.width);a.setAttribute("height",c.height);var d=b.startHat_?Blockly.BlockSvg.START_HAT_HEIGHT:0;d&&b.moveBy(0,d);d=b.getRelativeToSurfaceXY();a.setAttribute("y",d.y);a.setAttribute("x",this.RTL?d.x-c.width:d.x)};
|
|
Blockly.Flyout.prototype.filterForCapacity_=function(){for(var a=this.workspace_.getTopBlocks(!1),b=0,c;c=a[b];b++)if(-1==this.permanentlyDisabled_.indexOf(c))for(var d=this.targetWorkspace_.isCapacityAvailable(Blockly.utils.getBlockTypeCounts(c));c;)c.setEnabled(d),c=c.getNextBlock()};Blockly.Flyout.prototype.reflow=function(){this.reflowWrapper_&&this.workspace_.removeChangeListener(this.reflowWrapper_);this.reflowInternal_();this.reflowWrapper_&&this.workspace_.addChangeListener(this.reflowWrapper_)};
|
|
Blockly.Flyout.prototype.isScrollable=function(){return this.scrollbar_?this.scrollbar_.isVisible():!1};
|
|
Blockly.Flyout.prototype.placeNewBlock_=function(a){var b=this.targetWorkspace_;if(!a.getSvgRoot())throw Error("oldBlock is not rendered.");"function_call"==a.type&&a.inputList.forEach(function(a){if(a.connection&&a.connection.targetConnection&&"variables_get"==a.connection.targetBlock().type){a=a.connection.targetBlock();var c=a.inputList[0].fieldRow[0].getText();c=Blockly.Variables.getOrCreateVariablePackage(b,null,c,"").getId();a.setFieldValue(c,"VAR")}});var c=Blockly.Xml.blockToDom(a,!0);b.setResizesEnabled(!1);
|
|
c=Blockly.Xml.domToBlock(c,b);if(!c.getSvgRoot())throw Error("block is not rendered.");var d=b.getOriginOffsetInPixels(),e=this.workspace_.getOriginOffsetInPixels();a=a.getRelativeToSurfaceXY();a.scale(this.workspace_.scale);a=Blockly.utils.Coordinate.sum(e,a);d=Blockly.utils.Coordinate.difference(a,d);d.scale(1/b.scale);c.moveBy(d.x,d.y);return c};Blockly.HorizontalFlyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);Blockly.HorizontalFlyout.superClass_.constructor.call(this,a);this.horizontalLayout_=!0};goog.inherits(Blockly.HorizontalFlyout,Blockly.Flyout);
|
|
Blockly.HorizontalFlyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0,width:0,x:0}}var b=this.SCROLLBAR_PADDING,c=this.SCROLLBAR_PADDING;this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(b=0);var d=this.height_;this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP&&(d-=this.SCROLLBAR_PADDING);return{viewHeight:d,viewWidth:this.width_-2*this.SCROLLBAR_PADDING,contentHeight:(a.height+2*this.MARGIN)*this.workspace_.scale,
|
|
contentWidth:(a.width+2*this.MARGIN)*this.workspace_.scale,viewTop:-this.workspace_.scrollY,viewLeft:-this.workspace_.scrollX,contentTop:0,contentLeft:0,absoluteTop:b,absoluteLeft:c}};Blockly.HorizontalFlyout.prototype.setMetrics_=function(a){var b=this.getMetrics_();b&&("number"==typeof a.x&&(this.workspace_.scrollX=-b.contentWidth*a.x),this.workspace_.translate(this.workspace_.scrollX+b.absoluteLeft,this.workspace_.scrollY+b.absoluteTop))};
|
|
Blockly.HorizontalFlyout.prototype.position=function(){if(this.isVisible()){var a=this.targetWorkspace_.getMetrics();a&&(this.width_=a.viewWidth,this.setBackgroundPath_(a.viewWidth-2*this.CORNER_RADIUS,this.height_-this.CORNER_RADIUS),this.positionAt_(this.width_,this.height_,0,this.targetWorkspace_.toolboxPosition==this.toolboxPosition_?a.toolboxHeight?this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?a.toolboxHeight:a.viewHeight-this.height_:this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?0:a.viewHeight:
|
|
this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?0:a.viewHeight+a.absoluteTop-this.height_))}};
|
|
Blockly.HorizontalFlyout.prototype.setBackgroundPath_=function(a,b){var c=this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP,d=["M 0,"+(c?0:this.CORNER_RADIUS)];c?(d.push("h",a+2*this.CORNER_RADIUS),d.push("v",b),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("h",-1*a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),
|
|
d.push("h",a),d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),d.push("v",b),d.push("h",-a-2*this.CORNER_RADIUS));d.push("z");this.svgBackground_.setAttribute("d",d.join(" "))};Blockly.HorizontalFlyout.prototype.scrollToStart=function(){this.scrollbar_.set(this.RTL?Infinity:0)};
|
|
Blockly.HorizontalFlyout.prototype.wheel_=function(a){var b=Blockly.utils.getScrollDeltaPixels(a),c=b.x||b.y;c&&(b=this.getMetrics_(),c=b.viewLeft+c,c=Math.min(c,b.contentWidth-b.viewWidth),c=Math.max(c,0),this.scrollbar_.set(c),Blockly.WidgetDiv.hide(),Blockly.DropDownDiv.hideWithoutAnimation());a.preventDefault();a.stopPropagation()};
|
|
Blockly.HorizontalFlyout.prototype.layout_=function(a,b){this.workspace_.scale=this.targetWorkspace_.scale;var c=this.MARGIN,d=this.RTL?c:c+Blockly.BlockSvg.TAB_WIDTH;this.RTL&&(a=a.reverse());for(var e=0,f;f=a[e];e++)if("block"==f.type){f=f.block;for(var g=f.getDescendants(!1),h=0,k;k=g[h];h++)k.isInFlyout=!0;f.render();g=f.getSvgRoot();h=f.getHeightWidth();k=d;this.RTL&&(k+=h.width);f.moveBy(k,c);k=this.createRect_(f,k,c,h,e);d+=h.width+b[e];this.addBlockListeners_(g,f,k)}else"button"==f.type&&
|
|
(this.initFlyoutButton_(f.button,d,c),d+=f.button.width+b[e])};Blockly.HorizontalFlyout.prototype.isDragTowardWorkspace=function(a){a=Math.atan2(a.y,a.x)/Math.PI*180;var b=this.dragAngleRange_;return a<90+b&&a>90-b||a>-90-b&&a<-90+b?!0:!1};
|
|
Blockly.HorizontalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.top;return this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?new Blockly.utils.Rect(-1E9,b+a.height,-1E9,1E9):new Blockly.utils.Rect(b,-1E9,-1E9,1E9)};
|
|
Blockly.HorizontalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++)a=Math.max(a,d.getHeightWidth().height);a+=1.5*this.MARGIN;a*=this.workspace_.scale;a+=Blockly.Scrollbar.scrollbarThickness;if(this.height_!=a){for(c=0;d=b[c];c++)d.flyoutRect_&&this.moveRectToBlock_(d.flyoutRect_,d);this.height_=a;this.position()}};Blockly.VerticalFlyout=function(a){a.getMetrics=this.getMetrics_.bind(this);a.setMetrics=this.setMetrics_.bind(this);Blockly.VerticalFlyout.superClass_.constructor.call(this,a);this.horizontalLayout_=!1};goog.inherits(Blockly.VerticalFlyout,Blockly.Flyout);
|
|
Blockly.VerticalFlyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;try{var a=this.workspace_.getCanvas().getBBox()}catch(e){a={height:0,y:0,width:0,x:0}}var b=this.SCROLLBAR_PADDING,c=this.height_-2*this.SCROLLBAR_PADDING,d=this.width_;this.RTL||(d-=this.SCROLLBAR_PADDING);return{viewHeight:c,viewWidth:d,contentHeight:a.height*this.workspace_.scale+2*this.MARGIN,contentWidth:a.width*this.workspace_.scale+2*this.MARGIN,viewTop:-this.workspace_.scrollY+a.y,viewLeft:-this.workspace_.scrollX,
|
|
contentTop:a.y,contentLeft:a.x,absoluteTop:b,absoluteLeft:0}};Blockly.VerticalFlyout.prototype.setMetrics_=function(a){var b=this.getMetrics_();b&&("number"==typeof a.y&&(this.workspace_.scrollY=-b.contentHeight*a.y),this.workspace_.translate(this.workspace_.scrollX+b.absoluteLeft,this.workspace_.scrollY+b.absoluteTop))};
|
|
Blockly.VerticalFlyout.prototype.position=function(){if(this.isVisible()){var a=this.targetWorkspace_.getMetrics();a&&(this.height_=a.viewHeight,this.setBackgroundPath_(this.width_-this.CORNER_RADIUS,a.viewHeight-2*this.CORNER_RADIUS),this.positionAt_(this.width_,this.height_,this.targetWorkspace_.toolboxPosition==this.toolboxPosition_?a.toolboxWidth?this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?a.toolboxWidth:a.viewWidth-this.width_:this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?0:a.viewWidth:this.toolboxPosition_==
|
|
Blockly.TOOLBOX_AT_LEFT?0:a.viewWidth+a.absoluteLeft-this.width_,0))}};
|
|
Blockly.VerticalFlyout.prototype.setBackgroundPath_=function(a,b){var c=this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT,d=a+this.CORNER_RADIUS;d=["M "+(c?d:0)+",0"];d.push("h",c?-a:a);d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,c?0:1,c?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("v",Math.max(0,b));d.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,c?0:1,c?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS);d.push("h",c?a:-a);d.push("z");this.svgBackground_.setAttribute("d",
|
|
d.join(" "))};Blockly.VerticalFlyout.prototype.scrollToStart=function(){this.scrollbar_.set(0)};Blockly.VerticalFlyout.prototype.wheel_=function(a){var b=Blockly.utils.getScrollDeltaPixels(a);if(b.y){var c=this.getMetrics_();b=c.viewTop-c.contentTop+b.y;b=Math.min(b,c.contentHeight-c.viewHeight);b=Math.max(b,0);this.scrollbar_.set(b);Blockly.WidgetDiv.hide()}a.preventDefault();a.stopPropagation()};
|
|
Blockly.VerticalFlyout.prototype.layout_=function(a,b){this.workspace_.scale=this.targetWorkspace_.scale;for(var c=this.MARGIN,d=this.RTL?c:c+Blockly.BlockSvg.TAB_WIDTH,e=0,f;f=a[e];e++)if("block"==f.type){f=f.block;for(var g=f.getDescendants(!1),h=0,k;k=g[h];h++)k.isInFlyout=!0;f.render();g=f.getSvgRoot();h=f.getHeightWidth();f.moveBy(d,c);k=this.createRect_(f,this.RTL?d-h.width:d,c,h,e);this.addBlockListeners_(g,f,k);c+=h.height+b[e]}else"button"==f.type&&(this.initFlyoutButton_(f.button,d,c),c+=
|
|
f.button.height+b[e])};Blockly.VerticalFlyout.prototype.isDragTowardWorkspace=function(a){a=Math.atan2(a.y,a.x)/Math.PI*180;var b=this.dragAngleRange_;return a<b&&a>-b||a<-180+b||a>180-b?!0:!1};
|
|
Blockly.VerticalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.left;if(this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT)return new Blockly.utils.Rect(-1E9,1E9,-1E9,b+a.width);Blockly.utils.userAgent.GECKO&&this.targetWorkspace_&&this.targetWorkspace_.isMutator&&(a=this.targetWorkspace_.svgGroup_.getBoundingClientRect().x,10>Math.abs(a-b)&&(b+=this.leftEdge_*this.targetWorkspace_.options.parentWorkspace.scale));return new Blockly.utils.Rect(-1E9,
|
|
1E9,b,1E9)};
|
|
Blockly.VerticalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++){var e=d.getHeightWidth().width;d.outputConnection&&(e-=Blockly.BlockSvg.TAB_WIDTH);a=Math.max(a,e)}for(c=0;d=this.buttons_[c];c++)a=Math.max(a,d.width);a+=1.5*this.MARGIN+Blockly.BlockSvg.TAB_WIDTH;a*=this.workspace_.scale;a+=Blockly.Scrollbar.scrollbarThickness;(c=this.targetWorkspace_.getMetrics())&&(a=Math.min(a,c.viewWidth));
|
|
if(this.width_!=a){for(c=0;d=b[c];c++)this.RTL&&(e=d.getRelativeToSurfaceXY().x,d.moveBy(a/this.workspace_.scale-this.MARGIN-Blockly.BlockSvg.TAB_WIDTH-e,0)),d.flyoutRect_&&this.moveRectToBlock_(d.flyoutRect_,d);if(this.RTL)for(c=0;d=this.buttons_[c];c++)b=d.getPosition().y,d.moveTo(a/this.workspace_.scale-d.width-this.MARGIN-Blockly.BlockSvg.TAB_WIDTH,b);this.width_=a;this.position()}};Blockly.PXTUtils={};Blockly.PXTUtils.fadeColour=function(a,b,c){a=a.replace(/[^0-9a-f]/gi,"");6>a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]);for(var d="#",e=0;3>e;e++){var f=parseInt(a.substr(2*e,2),16);f=Math.round(Math.min(Math.max(0,c?f+f*b:f-f*b),255));f=f.toString(16);d+=("00"+f).substr(f.length)}return d};Blockly.Toolbox=function(a){this.workspace_=a;this.RTL=a.options.RTL;this.horizontalLayout_=a.options.horizontalLayout;this.toolboxPosition=a.options.toolboxPosition;this.config_={indentWidth:19,cssRoot:"blocklyTreeRoot",cssHideRoot:"blocklyHidden",cssItem:"",cssTreeRow:"blocklyTreeRow",cssItemLabel:"blocklyTreeLabel",cssTreeIcon:"blocklyTreeIcon",cssExpandedFolderIcon:"blocklyTreeIconOpen",cssFileIcon:"blocklyTreeIconNone",cssSelectedRow:"blocklyTreeSelected"};this.treeSeparatorConfig_={cssTreeRow:"blocklyTreeSeparator"};
|
|
this.horizontalLayout_&&(this.config_.cssTreeRow+=a.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.treeSeparatorConfig_.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.RTL?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"),this.config_.cssTreeIcon="")};Blockly.Toolbox.prototype.width=0;Blockly.Toolbox.prototype.height=0;Blockly.Toolbox.prototype.selectedOption_=null;Blockly.Toolbox.prototype.lastCategory_=null;
|
|
Blockly.Toolbox.prototype.init=function(){var a=this.workspace_,b=this.workspace_.getParentSvg();this.HtmlDiv=document.createElement("div");this.HtmlDiv.className="blocklyToolboxDiv";this.HtmlDiv.setAttribute("dir",a.RTL?"RTL":"LTR");b.parentNode.insertBefore(this.HtmlDiv,b);Blockly.bindEventWithChecks_(this.HtmlDiv,"mousedown",this,function(a){a.target==this.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0);Blockly.Touch.clearTouchIdentifier()},!1,!0);this.flyout_=Blockly.Functions.createFlyout(a,
|
|
this.workspace_.getParentSvg());this.config_.cleardotPath=a.options.pathToMedia+"1x1.gif";this.config_.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.RTL?"Rtl":"Ltr");this.tree_=b=new Blockly.Toolbox.TreeControl(this,this.config_);b.setShowRootNode(!1);b.setShowLines(!1);b.setShowExpandIcons(!1);b.setSelectedItem(null);a=this.populate_(a.options.languageTree);b.render(this.HtmlDiv);a&&b.setSelectedItem(a);this.addColour_();this.position()};
|
|
Blockly.Toolbox.prototype.dispose=function(){this.flyout_.dispose();this.tree_.dispose();Blockly.utils.dom.removeNode(this.HtmlDiv);this.lastCategory_=this.workspace_=null};Blockly.Toolbox.prototype.getWidth=function(){return this.width};Blockly.Toolbox.prototype.getHeight=function(){return this.height};
|
|
Blockly.Toolbox.prototype.position=function(){var a=this.HtmlDiv;if(a){var b=this.workspace_.getParentSvg();b=Blockly.svgSize(b);this.horizontalLayout_?(a.style.left="0",a.style.height="auto",a.style.width=b.width+"px",this.height=a.offsetHeight,this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?a.style.top="0":a.style.bottom="0"):(this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?a.style.right="0":a.style.left="0",a.style.height=b.height+"px",this.width=a.offsetWidth);this.flyout_.position()}};
|
|
Blockly.Toolbox.prototype.populate_=function(a){this.tree_.removeChildren();this.tree_.blocks=[];this.hasColours_=!1;a=this.syncTrees_(a,this.tree_,this.workspace_.options.pathToMedia);if(this.tree_.blocks.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");this.workspace_.resizeContents();return a};
|
|
Blockly.Toolbox.prototype.syncTrees_=function(a,b,c){for(var d=null,e=null,f=0,g;g=a.childNodes[f];f++)if(g.tagName)switch(g.tagName.toUpperCase()){case "CATEGORY":var h=Blockly.utils.replaceMessageReferences(g.getAttribute("name"));e=this.tree_.createNode(h);e.blocks=[];b.add(e);var k=g.getAttribute("custom");k?e.blocks=k:(k=this.syncTrees_(g,e,c))&&(d=k);k=g.getAttribute("categorystyle");var l=g.getAttribute("colour");l&&k?(e.hexColour="",console.warn('Toolbox category "'+h+'" can not have both a style and a colour')):
|
|
k?this.setColourFromStyle_(k,e,h):this.setColour_(l,e,h);h=g.getAttribute("iconclass");goog.isString(h)&&e.setIconClass(this.config_.cssTreeIcon+" "+h);h=g.getAttribute("expandedclass");goog.isString(h)&&e.setExpandedIconClass(this.config_.cssTreeIcon+" "+h);h=g.getAttribute("disabled");goog.isString(h)&&(e.disabled=!0);"true"==g.getAttribute("expanded")?(e.blocks.length&&(d=e),e.setExpanded(!0)):e.setExpanded(!1);e=g;break;case "SEP":if(e&&"CATEGORY"==e.tagName.toUpperCase()){b.add(new Blockly.Toolbox.TreeSeparator(this.treeSeparatorConfig_));
|
|
break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":b.blocks.push(g),e=g}return d};Blockly.Toolbox.prototype.isInverted_=function(){return this.workspace_.options.toolboxOptions&&this.workspace_.options.toolboxOptions.inverted};
|
|
Blockly.Toolbox.prototype.setColour_=function(a,b,c){a=Blockly.utils.replaceMessageReferences(a);if(null===a||""===a)b.hexColour="";else{var d=Number(a);isNaN(d)?(d=Blockly.utils.colour.parse(a))?(b.hexColour=d,this.hasColours_=!0):(b.hexColour="",console.warn('Toolbox category "'+c+'" has unrecognized colour attribute: '+a)):(b.hexColour=Blockly.hueToHex(d),this.hasColours_=!0)}};
|
|
Blockly.Toolbox.prototype.setColourFromStyle_=function(a,b,c){if((b.styleName=a)&&Blockly.getTheme()){var d=Blockly.getTheme().getCategoryStyle(a);d&&d.colour?this.setColour_(d.colour,b,c):console.warn('Style "'+a+'" must exist and contain a colour value')}};Blockly.Toolbox.prototype.updateColourFromTheme_=function(a){if(a=a||this.tree_){a=a.getChildren(!1);for(var b=0,c;c=a[b];b++)c.styleName&&(this.setColourFromStyle_(c.styleName,c,""),this.addColour_()),this.updateColourFromTheme_(c)}};
|
|
Blockly.Toolbox.prototype.updateColourFromTheme=function(){var a=this.tree_;a&&(this.updateColourFromTheme_(a),this.updateSelectedItemColour_(a))};Blockly.Toolbox.prototype.updateSelectedItemColour_=function(a){var b=a.selectedItem_;if(b){var c=b.hexColour||"#57e";b.getRowElement().style.backgroundColor=c;a.toolbox_.addColour_(b)}};
|
|
Blockly.Toolbox.prototype.addColour_=function(a){var b=this.workspace_.options;a=(a||this.tree_).getChildren(!1);for(var c=0,d;d=a[c];c++){var e=d.getRowElement();if(e){var f=b.toolboxOptions;if(f.inverted){if(this.hasColours_){e.style.color="#fff";e.style.background=d.hexColour||"#ddd";var g=f.invertedMultiplier;d.disabled||(Blockly.bindEvent_(d.getRowElement(),"mouseenter",d,function(){this.isSelected()||(this.getRowElement().style.background=Blockly.PXTUtils.fadeColour(this.hexColour||"#ddd",g,
|
|
!1))}),Blockly.bindEvent_(d.getRowElement(),"mouseleave",d,function(){this.isSelected()||(this.getRowElement().style.background=this.hexColour||"#ddd")}))}}else{if(f.border){var h=this.hasColours_?"8px solid "+(d.hexColour||"#ddd"):"none";this.workspace_.RTL?e.style.borderRight=h:e.style.borderLeft=h}f.colour&&this.hasColours_&&(e.style.color=d.hexColour||"#000")}d.disabled&&(e.style.opacity=f.disabledOpacity)}this.addColour_(d)}};Blockly.Toolbox.prototype.clearSelection=function(){this.tree_.setSelectedItem(null)};
|
|
Blockly.Toolbox.prototype.addStyle=function(a){Blockly.utils.dom.addClass(this.HtmlDiv,a)};Blockly.Toolbox.prototype.removeStyle=function(a){Blockly.utils.dom.removeClass(this.HtmlDiv,a)};
|
|
Blockly.Toolbox.prototype.getClientRect=function(){if(!this.HtmlDiv)return null;var a=this.HtmlDiv.getBoundingClientRect(),b=a.top,c=b+a.height,d=a.left;a=d+a.width;return this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?new Blockly.utils.Rect(-1E7,c,-1E7,1E7):this.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM?new Blockly.utils.Rect(b,1E7,-1E7,1E7):this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT?new Blockly.utils.Rect(-1E7,1E7,-1E7,a):new Blockly.utils.Rect(-1E7,1E7,d,1E7)};
|
|
Blockly.Toolbox.prototype.refreshSelection=function(){var a=this.tree_.getSelectedItem();a&&a.blocks&&this.flyout_.show(a.blocks)};Blockly.Toolbox.TreeControl=function(a,b){this.toolbox_=a;goog.ui.tree.TreeControl.call(this,goog.html.SafeHtml.EMPTY,b)};goog.inherits(Blockly.Toolbox.TreeControl,goog.ui.tree.TreeControl);
|
|
Blockly.Toolbox.TreeControl.prototype.enterDocument=function(){Blockly.Toolbox.TreeControl.superClass_.enterDocument.call(this);if(Blockly.Touch.TOUCH_ENABLED){var a=this.getElement();Blockly.bindEventWithChecks_(a,goog.events.EventType.TOUCHEND,this,this.handleTouchEvent_)}a=this.getElement();Blockly.bindEventWithChecks_(a,goog.events.EventType.CONTEXTMENU,this,Blockly.utils.noEvent)};
|
|
Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_=function(a){var b=this.getNodeFromEvent_(a);b&&a.type===goog.events.EventType.TOUCHEND&&setTimeout(function(){b.onClick_(a)},1)};
|
|
Blockly.Toolbox.TreeControl.prototype.createNode=function(a){if(this.toolbox_&&!this.eventHandlerRegistered_){var b=function(){Blockly.svgResize(this.toolbox_.workspace_)};goog.events.listen(this.toolbox_.tree_,goog.ui.tree.BaseNode.EventType.EXPAND,b);goog.events.listen(this.toolbox_.tree_,goog.ui.tree.BaseNode.EventType.COLLAPSE,b);this.eventHandlerRegistered_=!0}a=a?goog.html.SafeHtml.htmlEscape(a):goog.html.SafeHtml.EMPTY;return new Blockly.Toolbox.TreeNode(this.toolbox_,a,this.getConfig())};
|
|
Blockly.Toolbox.TreeControl.prototype.setSelectedItem=function(a){var b=this.toolbox_;if(a!=this.selectedItem_&&a!=b.tree_){b.lastCategory_&&!b.isInverted_()&&(b.lastCategory_.getRowElement().style.backgroundColor="");if(a){var c=a.hexColour||"#57e";a.getRowElement().style.backgroundColor=c;b.addColour_(a)}c=this.getSelectedItem();goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this,a);a&&a.blocks&&a.blocks.length?(b.flyout_.show(a.blocks),b.lastCategory_!=a&&b.flyout_.scrollToStart()):b.flyout_.hide();
|
|
c!=a&&c!=this&&(c=new Blockly.Events.Ui(null,"category",c&&c.getHtml(),a&&a.getHtml()),c.workspaceId=b.workspace_.id,Blockly.Events.fire(c));a&&(b.lastCategory_=a)}};Blockly.Toolbox.TreeNode=function(a,b,c){goog.ui.tree.TreeNode.call(this,b,c);a&&(b=function(){Blockly.svgResize(a.workspace_)},goog.events.listen(a.tree_,goog.ui.tree.BaseNode.EventType.EXPAND,b),goog.events.listen(a.tree_,goog.ui.tree.BaseNode.EventType.COLLAPSE,b))};goog.inherits(Blockly.Toolbox.TreeNode,goog.ui.tree.TreeNode);
|
|
Blockly.Toolbox.TreeNode.prototype.getExpandIconSafeHtml=function(){return goog.html.SafeHtml.create("span")};Blockly.Toolbox.TreeNode.prototype.onClick_=function(a){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select();this.updateRow()};Blockly.Toolbox.TreeNode.prototype.onMouseDown=function(a){};Blockly.Toolbox.TreeNode.prototype.onDoubleClick_=function(a){};
|
|
Blockly.Toolbox.TreeNode.prototype.onKeyDown=function(a){if(this.tree.toolbox_.horizontalLayout_){var b={},c=goog.events.KeyCodes.DOWN,d=goog.events.KeyCodes.UP;b[goog.events.KeyCodes.RIGHT]=this.rightToLeft_?d:c;b[goog.events.KeyCodes.LEFT]=this.rightToLeft_?c:d;b[goog.events.KeyCodes.UP]=goog.events.KeyCodes.LEFT;b[goog.events.KeyCodes.DOWN]=goog.events.KeyCodes.RIGHT;a.keyCode=b[a.keyCode]||a.keyCode}return Blockly.Toolbox.TreeNode.superClass_.onKeyDown.call(this,a)};
|
|
Blockly.Toolbox.TreeSeparator=function(a){Blockly.Toolbox.TreeNode.call(this,null,goog.html.SafeHtml.EMPTY,a)};goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode);Blockly.Css={};Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"};Blockly.Css.currentCursor_="";Blockly.Css.injected_=!1;Blockly.Css.mediaPath_="";
|
|
Blockly.Css.inject=function(a,b){if(!Blockly.Css.injected_){Blockly.Css.injected_=!0;var c=".blocklyDraggable {}\n";a&&(c+=Blockly.Css.CONTENT.join("\n"),Blockly.Css.CONTENT=null,Blockly.FieldDate&&(c+=Blockly.FieldDate.CSS.join("\n")));Blockly.Css.mediaPath_=b.replace(/[\\\/]$/,"");c=c.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_);for(var d in Blockly.Colours)Blockly.Colours.hasOwnProperty(d)&&(c=c.replace(new RegExp("\\$colour\\_"+d,"g"),Blockly.Colours[d]));d=document.createElement("style");c=
|
|
document.createTextNode(c);d.appendChild(c);document.head.insertBefore(d,document.head.firstChild)}};Blockly.Css.setCursor=function(a){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")};
|
|
Blockly.Css.CONTENT=[".blocklySvg {","background-color: $colour_workspace;","outline: none;","overflow: hidden;","position: absolute;","display: block;","touch-action: none;","}",".blocklyRelativeWrapper {","position: relative;","width: 100%;","height: 100%;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyWidgetDiv.fieldTextInput {","overflow: hidden;",
|
|
"border: 1px solid;","box-sizing: border-box;","transform-origin: 0 0;","-ms-transform-origin: 0 0;","-moz-transform-origin: 0 0;","-webkit-transform-origin: 0 0;","}",".blocklyTextDropDownArrow {","position: absolute;","}",".blocklyNonSelectable {","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","touch-action: none;","cursor: move;","}",".blocklyWsDragSurface.blocklyOverflowVisible {",
|
|
"overflow: visible;","}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyTransitioning {","transition: all 0.5s ease-in-out;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {",
|
|
"background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 9pt;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: fixed;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-radius: 2px;","box-shadow: 0px 0px 8px 1px "+Blockly.Colours.dropDownShadow+";",
|
|
"padding: 4px;","-webkit-user-select: none;","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;","overflow-x: hidden;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;",
|
|
"cursor: pointer;","}",".blocklyDropDownButtonHover {","box-shadow: 0px 0px 0px 4px "+Blockly.Colours.fieldShadow+";","}",".blocklyDropDownButton:active {","box-shadow: 0px 0px 0px 6px "+Blockly.Colours.fieldShadow+";","}",".blocklyDropDownButton > img {","width: 80%;","height: 80%;","margin-top: 5%","}",".blocklyDropDownPlaceholder {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","}",".blocklyNumPadButton {","display: inline-block;","float: left;","padding: 0;","width: 48px;",
|
|
"height: 48px;","margin: 4px;","border-radius: 4px;","background: $colour_numPadBackground;","color: $colour_numPadText;","outline: none;","border: 1px solid $colour_numPadBorder;","cursor: pointer;","font-weight: 600;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 12pt;","-webkit-tap-highlight-color: rgba(0,0,0,0);","}",".blocklyNumPadButton > img {","margin-top: 10%;","width: 80%;","height: 80%;","}",".blocklyNumPadButton:active {","background: $colour_numPadActiveBackground;",
|
|
"-webkit-tap-highlight-color: rgba(0,0,0,0);","}",".arrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;","border-color: inherit;","}",".arrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".valueReportBox {","min-width: 50px;","max-width: 300px;","max-height: 200px;","overflow: auto;","word-wrap: break-word;","text-align: center;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',
|
|
"font-size: .8em;","}",".blocklyResizeSE {","cursor: se-resize;","fill: transparent;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: transparent;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #FFF200;","stroke-width: 4px;","}",".blocklyPath {","stroke-width: 1px;","transition: stroke .4s;","}",".blocklyDraggable:not(.blocklySelected)>.blocklyPath.blocklyReporterHover {","stroke-width: 2px;","stroke: white;",
|
|
"}",".blocklyBlockBackground.blocklyFieldHover {","stroke-width: 2px;","stroke: white;","}",".blocklySelected>.blocklyPath {","}",".blocklyDraggable {",'cursor: url("<<<PATH>>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","touch-action: none;","}",".blocklyDragging {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","touch-action: none;","}",".blocklyDraggable:active {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;",
|
|
"cursor: -webkit-grabbing;","}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyToolboxDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging>.blocklyPath {",
|
|
"fill-opacity: 1.0;","stroke-opacity: 1.0;","}",".blocklyDragging>.blocklyPath {","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDisabled .blocklyEditableText .blocklyBlockBackground,",".blocklyDisabled .blocklyNonEditableText .blocklyBlockBackground,",'.blocklyDisabled g[data-argument-type="dropdown"] .blocklyBlockBackground {',"fill-opacity: 0.1 !important;","}",".blocklyInsertionMarker>.blocklyPath {","stroke: none;","}",".blocklyInsertionMarker>.blocklyIconGroup {",
|
|
"display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyReplaceable .blocklyPath {","fill-opacity: 0.5;","}",".blocklyReplaceable .blocklyPathLight,",".blocklyReplaceable .blocklyPathDark {","display: none;","}",".blocklyText {","cursor: default;","fill: #fff;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 12pt;","font-weight: bold;",
|
|
"}",".blocklyTextTruncated {","font-size: 11pt;","}",".blocklyNonEditableText>g>text {","pointer-events: none;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text,",".blocklyNonEditableText>g>text,",".blocklyEditableText>g>text {","fill: $colour_text;","}",".blocklyDropdownText {","fill: #fff !important;","}",".blocklyBubbleText {","fill: #fff;","}",".blocklyBubbleCanvas {","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyFlyout {",
|
|
"position: absolute;","z-index: 20;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyFlyoutButton {","fill: #F4F4F4;","}",".blocklyFlyoutButtonBackground {","stroke: #fff;","}",".blocklyFlyoutButton .blocklyText {","fill: $colour_text;","}",".blocklyFlyoutButtonShadow {","fill: none;","}",".blocklyFlyoutButton:hover {","fill: #EAEAEA;","cursor: pointer;","}",".blocklyFlyoutLabel {","cursor: default;","}",".blocklyFlyoutLabelBackground {","opacity: 0;","}",".blocklyFlyoutLabelText {",
|
|
'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 14pt;","fill: $colour_text;","font-weight: bold;","}",".blocklySvg text, .blocklyBlockDragSurface text, .blocklyFlyout text, .blocklyToolboxDiv text {","user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup,",".blocklyBreakpointIconGroup {",
|
|
"cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyBreakpointIconGroup:hover,",".blocklyBreakpointIconGroupReadonly {","fill-opacity: .6;","}",".blocklyIconShape {","fill: #000;","stroke-width: 1px;","stroke: #fff;","cursor: pointer;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","background-color: #FAF6BD;","}",".blocklyUneditableMinimalBody {","fill: #FAF6BD;","}",".blocklyCommentForeignObject {",
|
|
"position: relative;","z-index: 0;","}",".blocklyComment > image {","cursor: pointer","}",".blocklyCommentRect {","fill: #FAF6BD;","stroke: #F9F3A1;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #F9F3A1;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentText {","fill: #000;","pointer-events: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;","}",".blocklyFocused>.blocklyCommentRect {",
|
|
"fill: #FFB900;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {","stroke: #FFB900;","stroke-width: 1px;","}",".blocklyCommentForeignObject {","position: relative;","z-index: 0;","}",".blocklyCommentRect {","fill: #FAF6BD;","stroke: #F9F3A1;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #F9F3A1;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;",
|
|
"}",".blocklyCommentTextarea {","background-color: #FAF6BD;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","color: $colour_text;","overflow: hidden;","font-size: 12pt;","line-height: 22px;","}",".blocklyUneditableComment {","fill: $colour_text;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklyFocused > .blocklyCommentDeleteIcon, .blocklyCommentBubble > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {",
|
|
"fill: rgba(255, 255, 255, 0.20);","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyHtmlInput {","border: none;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 12pt;","height: 100%;","margin: 0;","outline: none;","box-sizing: border-box;","width: 100%;","text-align: center;","color: $colour_text;","font-weight: bold;","}",".blocklyMainBackground {",
|
|
"stroke-width: 1;","stroke: #c6c6c6;","touch-action: none;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: $colour_flyout;","fill-opacity: .8;","}",".blocklyTransparentBackground {","opacity: 0;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","touch-action: none;","}",
|
|
".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: $colour_scrollbar;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: $colour_scrollbarHover;","}",".blocklyZoom>image {","opacity: 1;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {",
|
|
"background: #faa;","}",".blocklyAngleCenterPoint {","stroke: #fff;","stroke-width: 1;","fill: #fff;","}",".blocklyAngleDragHandle {","stroke: #fff;","stroke-width: 5;","stroke-opacity: 0.25;","fill: #fff;","cursor: pointer;","}",".blocklyAngleMarks {","stroke: #fff;","stroke-width: 1;","stroke-opacity: 0.5;","}",".blocklyAngleGauge {","fill: #fff;","fill-opacity: 0.20;","}",".blocklyAngleLine {","stroke: #fff;","stroke-width: 1;","stroke-linecap: round;","pointer-events: none;","}",".blocklyContextMenu {",
|
|
"border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","padding: 0 !important;","}",".blocklyDropDownNumPad {","background-color: $colour_numPadBackground;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;","}",".blocklyToolboxDiv {","background-color: $colour_toolbox;","color: $colour_toolboxText;","overflow-x: visible;","overflow-y: auto;",
|
|
"position: absolute;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"user-select: none;","-moz-user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","z-index: 40;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {","height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;",
|
|
"margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {",
|
|
"background-image: url(<<<PATH>>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {",
|
|
"background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyColourTable {",
|
|
"outline: none;","border-radius: 11px;","margin-bottom: 20px;","border-collapse: collapse;","}",".blocklyColourTable > tr > td {","height: 22px;","width: 22px;","margin: 0;","padding: 2px;","border: 0;","text-align: center;","cursor: pointer;","}",".blocklyColourTable > tr > td > div {","position: relative;","height: 22px;","width: 22px;","border-radius: 4px;","border: 2px solid rgba(0,0,0,.1);","}",".blocklyColourTable > tr > td:hover > div {","border: 1px solid #FFF;","box-sizing: border-box;",
|
|
"}",".blocklyColourTable > tr > td > .blocklyColourSelected {","border: 1px solid #000;","box-sizing: border-box;","color: #fff;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","z-index: 20000;","box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
|
|
"outline: none;","z-index: 20000;","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem, ",".blocklyDropDownDiv .goog-menuitem {","color: #000;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"list-style: none;","margin: 0;","padding: 5px 7em 5px 28px;","white-space: nowrap;","}",".blocklyDropDownDiv .goog-menuitem {","color: #fff;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
|
|
"font-weight: bold;","list-style: none;","margin: 0;","min-width: 7em;","padding: 5px 5px 5px 28px;","white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl, ",".blocklyDropDownDiv .goog-menuitem.goog-menuitem-rtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem { ",
|
|
"padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem, ",".blocklyDropDownDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon, ",
|
|
".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: 0.3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight, ",".blocklyWidgetDiv .goog-menuitem-hover {","background-color: #d6e9f8;","border-color: #d6e9f8;","border-style: dotted;","border-width: 1px 0;","padding-bottom: 4px;","padding-top: 4px;","}",".blocklyDropDownDiv .goog-menuitem-highlight, ",".blocklyDropDownDiv .goog-menuitem-hover {","background-color: rgba(0, 0, 0, 0.2);","}",".blocklyWidgetDiv .goog-menuitem-checkbox, ",
|
|
".blocklyWidgetDiv .goog-menuitem-icon, ",".blocklyDropDownDiv .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-icon {","background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {",
|
|
"background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-left: 6px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon, ",
|
|
".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}",".blocklyWidgetDiv .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-accel {","color: #999;","direction: ltr;","left: auto;","padding: 0 6px;","position: absolute;","right: 0;","text-align: right;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-accel, ",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-accel {",
|
|
"left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator, ",".blocklyDropDownDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator, ",".blocklyDropDownDiv .goog-menuseparator {","border-top: 1px solid #ccc;","margin: 4px 0;","padding: 0;",
|
|
"}",".blocklyDropDownDiv .goog-slider-horizontal {","margin: 8px;","height: 22px;","width: 150px;","position: relative;","outline: none;","border-radius: 11px;","margin-bottom: 20px;","background: #547AB2","}",".blocklyDropDownDiv .goog-slider-horizontal .goog-slider-thumb {","width: 26px;","height: 26px;","margin-top: -1px;","position: absolute;","background-color: white;","border-radius: 100%;","-webkit-box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);","-moz-box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);",
|
|
"box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);","cursor: pointer","}",".blocklyFieldSliderLabel {",'font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;',"font-size: 0.65rem;","color: $colour_toolboxText;","margin: 8px;","}",".blocklyFieldSliderLabelText {","font-weight: bold;","}",".blocklyFieldSliderReadout {","margin-left: 10px;","}",".blocklyHighlighted>.blocklyPath {","stroke: #ff8b27;","stroke-width: 5px;","}",".argumentEditorRemoveIcon {","position: absolute;","width: 24px;","height: 24px;",
|
|
"top: -40px;","left: 50%;","margin-left: -12px;","cursor: pointer;","}",".functioneditor i.argumentEditorTypeIcon {","position: absolute;","width: 24px;","height: 24px;","top: 40px;","left: 50%;","margin-left: -12px;","}",".blocklyWidgetDiv.fieldTextInput.argumentEditorInput {","overflow: visible;","}",".functionNameText {","font-weight: bold;","}",".field-text-quote {","fill: #a31515 !important;","}",""];Blockly.WidgetDiv={};Blockly.WidgetDiv.DIV=null;Blockly.WidgetDiv.owner_=null;Blockly.WidgetDiv.dispose_=null;Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=document.createElement("div"),Blockly.WidgetDiv.DIV.className="blocklyWidgetDiv",document.body.appendChild(Blockly.WidgetDiv.DIV))};
|
|
Blockly.WidgetDiv.show=function(a,b,c){Blockly.WidgetDiv.hide();Blockly.WidgetDiv.owner_=a;Blockly.WidgetDiv.dispose_=c;a=goog.style.getViewportPageOffset(document);Blockly.WidgetDiv.DIV.style.top=a.y+"px";Blockly.WidgetDiv.DIV.style.direction=b?"rtl":"ltr";Blockly.WidgetDiv.DIV.style.display="block"};
|
|
Blockly.WidgetDiv.repositionForWindowResize=function(){if(Blockly.WidgetDiv.owner_&&Blockly.WidgetDiv.owner_.getScaledBBox_&&Blockly.WidgetDiv.owner_.getSize){var a=Blockly.WidgetDiv.owner_.getScaledBBox_(),b=Blockly.WidgetDiv.owner_.getSize();Blockly.WidgetDiv.positionInternal_(a.left,a.top,b.height)}else Blockly.WidgetDiv.hide()};
|
|
Blockly.WidgetDiv.hide=function(){Blockly.WidgetDiv.owner_&&(Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.DIV.style.display="none",Blockly.WidgetDiv.DIV.style.left="",Blockly.WidgetDiv.DIV.style.top="",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.dispose_=null,Blockly.WidgetDiv.DIV.innerHTML="")};Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_};Blockly.WidgetDiv.hideIfOwner=function(a){Blockly.WidgetDiv.owner_==a&&Blockly.WidgetDiv.hide()};
|
|
Blockly.WidgetDiv.positionInternal_=function(a,b,c){Blockly.WidgetDiv.DIV.style.left=a+"px";Blockly.WidgetDiv.DIV.style.top=b+"px";Blockly.WidgetDiv.DIV.style.height=c+"px"};Blockly.WidgetDiv.positionWithAnchor=function(a,b,c,d){var e=Blockly.WidgetDiv.calculateY_(a,b,c);a=Blockly.WidgetDiv.calculateX_(a,b,c,d);0>e?Blockly.WidgetDiv.positionInternal_(a,0,c.height+e):Blockly.WidgetDiv.positionInternal_(a,e,c.height)};
|
|
Blockly.WidgetDiv.calculateX_=function(a,b,c,d){if(d)return b=Math.max(b.right-c.width,a.left),Math.min(b,a.right-c.width);b=Math.min(b.left,a.right-c.width);return Math.max(b,a.left)};Blockly.WidgetDiv.calculateY_=function(a,b,c){return b.bottom+c.height>=a.bottom?b.top-c.height:b.bottom};Blockly.inject=function(a,b){Blockly.checkBlockColourConstants();"string"==typeof a&&(a=document.getElementById(a)||document.querySelector(a));if(!Blockly.utils.dom.containsNode(document,a))throw Error("Error: container is not in current document.");var c=new Blockly.Options(b||{}),d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);Blockly.Field.startCache();var e=Blockly.createDom_(d,c),f=new Blockly.BlockDragSurfaceSvg(d);d=new Blockly.WorkspaceDragSurfaceSvg(d);e=Blockly.createMainWorkspace_(e,
|
|
c,f,d);Blockly.setTheme(c.theme);Blockly.init_(e);Blockly.mainWorkspace=e;Blockly.svgResize(e);return e};
|
|
Blockly.createDom_=function(a,b){a.setAttribute("dir","LTR");goog.ui.Component.setDefaultRightToLeft(b.RTL);Blockly.Css.inject(b.hasCss,b.pathToMedia);var c=Blockly.utils.dom.createSvgElement("svg",{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1","class":"blocklySvg"},a),d=Blockly.utils.dom.createSvgElement("defs",{},c),e=String(Math.random()).substring(2),f=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyStackGlowFilter"+
|
|
e,height:"160%",width:"180%",y:"-30%",x:"-40%"},d);b.stackGlowBlur=Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:Blockly.Colours.stackGlowSize},f);var g=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},f);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0"+goog.string.repeat(" 1",16)},g);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":Blockly.Colours.stackGlow,"flood-opacity":Blockly.Colours.stackGlowOpacity,
|
|
result:"outColor"},f);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},f);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"outGlow",operator:"over"},f);var h=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyReplacementGlowFilter"+e,height:"160%",width:"180%",y:"-30%",x:"-40%"},d);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:Blockly.Colours.replacementGlowSize},
|
|
h);g=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},h);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0"+goog.string.repeat(" 1",16)},g);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":Blockly.Colours.replacementGlow,"flood-opacity":Blockly.Colours.replacementGlowOpacity,result:"outColor"},h);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},h);Blockly.utils.dom.createSvgElement("feComposite",
|
|
{"in":"SourceGraphic",in2:"outGlow",operator:"over"},h);var k=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyHighlightGlowFilter"+e,height:"160%",width:"180%",y:"-30%",x:"-40%"},d);b.highlightGlowBlur=Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:Blockly.Colours.highlightGlowSize},k);g=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},k);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0"+goog.string.repeat(" 1",
|
|
16)},g);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":Blockly.Colours.highlightGlow,"flood-opacity":Blockly.Colours.highlightGlowOpacity,result:"outColor"},k);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},k);var l=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyHighlightWarningFilter"+e,height:"160%",width:"180%",y:"-30%",x:"-40%"},d);b.highlightGlowBlur=Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",
|
|
stdDeviation:Blockly.Colours.warningGlowSize},l);g=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},l);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0"+goog.string.repeat(" 1",16)},g);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":Blockly.Colours.warningGlow,"flood-opacity":Blockly.Colours.warningGlowOpacity,result:"outColor"},l);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},
|
|
l);var m=Blockly.utils.dom.createSvgElement("filter",{id:"blocklySelectedGlowFilter"+e,height:"160%",width:"180%",y:"-30%",x:"-40%","color-interpolation-filters":"sRGB"},d);b.selectedGlowBlur=Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:Blockly.Colours.selectedGlowSize},m);g=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},m);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0"+goog.string.repeat(" 1",16)},
|
|
g);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":Blockly.Colours.selectedGlow,"flood-opacity":"1.0",result:"outColor"},m);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},m);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"outGlow",operator:"over"},m);g=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyEmbossFilter"+e},d);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",
|
|
operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},g);b.embossFilterId=g.id;g=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyDisabledPattern"+e,patternUnits:"userSpaceOnUse",width:10,height:10},d);Blockly.utils.dom.createSvgElement("rect",{width:10,height:10,fill:"#aaa"},g);Blockly.utils.dom.createSvgElement("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},g);Blockly.utils.dom.createSvgElement("image",{id:"blocklyDropdownArrowSvg",height:"12px",width:"12px"},d).setAttributeNS("http://www.w3.org/1999/xlink",
|
|
"xlink:href",Blockly.FieldDropdown.DROPDOWN_SVG_DATAURI);b.stackGlowFilterId=f.id;b.replacementGlowFilterId=h.id;b.highlightGlowFilterId=k.id;b.warningGlowFilterId=l.id;b.selectedGlowFilterId=m.id;b.disabledPatternId=g.id;b.gridPattern=Blockly.Grid.createDom(e,b.gridOptions,d);return c};
|
|
Blockly.createMainWorkspace_=function(a,b,c,d){b.parentWorkspace=null;var e=new Blockly.WorkspaceSvg(b,c,d);e.scale=b.zoomOptions.startScale;a.appendChild(e.createDom("blocklyMainBackground"));!b.hasCategories&&b.languageTree&&(c=e.addFlyout_("svg"),Blockly.utils.dom.insertAfter(c,a));b.hasTrashcan&&e.addTrashcan();b.zoomOptions&&b.zoomOptions.controls&&e.addZoomControls();e.translate(0,0);Blockly.mainWorkspace=e;b.readOnly||e.isMovable()||e.addChangeListener(function(a){if(!e.isDragging()&&!e.isMovable()&&
|
|
-1!=Blockly.Events.BUMP_EVENTS.indexOf(a.type)){var b=Object.create(null),c=e.getMetrics(),d=e.scale;b.viewLeft=c.viewLeft/d;b.viewTop=c.viewTop/d;b.viewRight=(c.viewLeft+c.viewWidth)/d;b.viewBottom=(c.viewTop+c.viewHeight)/d;e.isContentBounded()?(c=e.getBlocksBoundingBox(),b.contentLeft=c.left,b.contentTop=c.top,b.contentRight=c.right,b.contentBottom=c.bottom):(b.contentLeft=c.contentLeft/d,b.contentTop=c.contentTop/d,b.contentRight=(c.contentLeft+c.contentWidth)/d,b.contentBottom=(c.contentTop+
|
|
c.contentHeight)/d);if(b.contentTop<b.viewTop||b.contentBottom>b.viewBottom||b.contentLeft<b.viewLeft||b.contentRight>b.viewRight){c=null;a&&(c=Blockly.Events.getGroup(),Blockly.Events.setGroup(a.group));switch(a.type){case Blockly.Events.BLOCK_CREATE:case Blockly.Events.BLOCK_MOVE:var f=e.getBlockById(a.blockId);f=f.getRootBlock();break;case Blockly.Events.COMMENT_CREATE:case Blockly.Events.COMMENT_MOVE:f=e.getCommentById(a.commentId)}if(f){d=f.getBoundingRectangle();var m=b.viewTop-d.top;0<m&&f.moveBy(0,
|
|
m);m=b.viewBottom-d.bottom;0>m&&f.moveBy(0,m);m=b.viewLeft-d.left;0<m&&f.moveBy(m,0);b=b.viewRight-d.right;0>b&&f.moveBy(b,0)}a&&(a.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),Blockly.Events.setGroup(c))}}});Blockly.svgResize(e);Blockly.WidgetDiv.createDom();Blockly.DropDownDiv.createDom();Blockly.Tooltip.createDom();return e};
|
|
Blockly.init_=function(a){var b=a.options,c=a.getParentSvg();Blockly.bindEventWithChecks_(c.parentNode,"contextmenu",null,function(a){Blockly.utils.isTargetInput(a)||a.preventDefault()});c=Blockly.bindEventWithChecks_(window,"resize",null,function(){Blockly.hideChaffOnResize(!0);Blockly.svgResize(a)});a.setResizeHandlerWrapper(c);Blockly.inject.bindDocumentEvents_();b.languageTree&&(a.toolbox_?a.toolbox_.init(a):a.flyout_&&(a.flyout_.init(a),a.flyout_.show(b.languageTree.childNodes),a.flyout_.scrollToStart(),
|
|
b.horizontalLayout?(a.scrollY=a.flyout_.height_,b.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM&&(a.scrollY*=-1)):(a.scrollX=a.flyout_.width_,b.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT&&(a.scrollX*=-1)),a.translate(a.scrollX,a.scrollY)));c=Blockly.Scrollbar.scrollbarThickness;b.hasTrashcan&&(c=a.trashcan.init(c));b.zoomOptions&&b.zoomOptions.controls&&a.zoomControls_.init(c);b.moveOptions&&b.moveOptions.scrollbars?(a.scrollbar=new Blockly.ScrollbarPair(a),a.scrollbar.resize()):a.setMetrics({x:.5,y:.5});
|
|
b.hasSounds&&Blockly.inject.loadSounds_(b.pathToMedia,a)};
|
|
Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.bindEventWithChecks_(document,"scroll",null,function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)c.updateInverseScreenCTM&&c.updateInverseScreenCTM()}),Blockly.bindEventWithChecks_(document,"keydown",null,Blockly.onKeyDown_),Blockly.bindEvent_(document,"touchend",null,Blockly.longStop_),Blockly.bindEvent_(document,"touchcancel",null,Blockly.longStop_),Blockly.utils.userAgent.IPAD&&Blockly.bindEventWithChecks_(window,
|
|
"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())}));Blockly.documentEventsBound_=!0};
|
|
Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[],e=function(){for(;d.length;)Blockly.unbindEvent_(d.pop());c.preload()};d.push(Blockly.bindEventWithChecks_(document,"mousemove",null,e,!0));d.push(Blockly.bindEventWithChecks_(document,"touchstart",null,e,!0))};
|
|
Blockly.updateToolbox=function(a){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead.");Blockly.getMainWorkspace().updateToolbox(a)};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections_=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.theme_=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()};
|
|
Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}};
|
|
Blockly.onKeyDown_=function(a){var b=Blockly.mainWorkspace;if(!(b.options.readOnly||Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible())){var c=!1;if(27==a.keyCode)Blockly.hideChaff(),Blockly.DropDownDiv.hide();else if(8==a.keyCode||46==a.keyCode){a.preventDefault();if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&(c=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&
|
|
(67==a.keyCode?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):88!=a.keyCode||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),c=!0,Blockly.hideChaff(),Blockly.selected.dispose(!0,!0)));86==a.keyCode?Blockly.clipboardXml_&&(a=Blockly.clipboardSource_,a.isFlyout&&(a=a.targetWorkspace),Blockly.clipboardTypeCounts_&&a.isCapacityAvailable(Blockly.clipboardTypeCounts_)&&(Blockly.Events.setGroup(!0),a.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1))):90==a.keyCode&&(Blockly.hideChaff(),
|
|
b.undo(a.shiftKey))}c&&!Blockly.selected.workspace.isFlyout&&(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(!0,!0),Blockly.Events.setGroup(!1))}};
|
|
Blockly.copy_=function(a){if(a.isComment)var b=a.toXmlWithXY();else{b=Blockly.Xml.blockToDom(a,!0);Blockly.Xml.deleteNext(b);var c=a.getRelativeToSurfaceXY();b.setAttribute("x",a.RTL?-c.x:c.x);b.setAttribute("y",c.y)}Blockly.clipboardXml_=b;Blockly.clipboardSource_=a.workspace;Blockly.clipboardTypeCounts_=a.isComment?null:Blockly.utils.getBlockTypeCounts(a,!0)};
|
|
Blockly.duplicate_=function(a){var b=Blockly.clipboardXml_,c=Blockly.clipboardSource_;Blockly.copy_(a);a.workspace.paste(Blockly.clipboardXml_);Blockly.clipboardXml_=b;Blockly.clipboardSource_=c};Blockly.onContextMenu_=function(a){Blockly.utils.isTargetInput(a)||a.preventDefault()};Blockly.hideChaff=function(a){Blockly.hideChaffInternal_(a);Blockly.WidgetDiv.hide(!0);Blockly.DropDownDiv.hideWithoutAnimation()};
|
|
Blockly.hideChaffOnResize=function(a){Blockly.hideChaffInternal_(a);Blockly.WidgetDiv.repositionForWindowResize();Blockly.DropDownDiv.repositionForWindowResize()};Blockly.hideChaffInternal_=function(a){Blockly.Tooltip.hide();Blockly.WidgetDiv.hide();Blockly.DropDownDiv.hideWithoutAnimation();var b=Blockly.getMainWorkspace();b.trashcan&&b.trashcan.flyout_&&b.trashcan.flyout_.hide();a||b.toolbox_&&b.toolbox_.flyout_&&b.toolbox_.flyout_.autoClose&&b.toolbox_.clearSelection()};
|
|
Blockly.addChangeListener=function(a){console.warn("Deprecated call to Blockly.addChangeListener, use workspace.addChangeListener instead.");return Blockly.getMainWorkspace().addChangeListener(a)};Blockly.getMainWorkspace=function(){return Blockly.mainWorkspace};Blockly.alert=function(a,b){alert(a);b&&b()};Blockly.confirm=function(a,b){b(confirm(a))};Blockly.prompt=function(a,b,c){c(prompt(a,b))};Blockly.jsonInitFactory_=function(a){return function(){this.jsonInit(a)}};
|
|
Blockly.defineBlocksWithJsonArray=function(a){for(var b=0;b<a.length;b++){var c=a[b];if(c){var d=c.type;null==d||""===d?console.warn("Block definition #"+b+" in JSON array is missing a type attribute. Skipping."):(Blockly.Blocks[d]&&console.warn("Block definition #"+b+' in JSON array overwrites prior definition of "'+d+'".'),Blockly.Blocks[d]={init:Blockly.jsonInitFactory_(c)})}else console.warn("Block definition #"+b+" in JSON array is "+c+". Skipping.")}};
|
|
Blockly.bindEventWithChecks_=function(a,b,c,d,e,f){var g=!1,h=function(a){var b=!e;a=Blockly.Touch.splitEventByTouches(a);for(var f=0,h;h=a[f];f++)if(!b||Blockly.Touch.shouldHandleEvent(h))Blockly.Touch.setClientFromTouch(h),c?d.call(c,h):d(h),g=!0},k=[];if(Blockly.utils.global.PointerEvent&&b in Blockly.Touch.TOUCH_MAP)for(var l=0,m;m=Blockly.Touch.TOUCH_MAP[b][l];l++)a.addEventListener(m,h,!1),k.push([a,m,h]);else if(a.addEventListener(b,h,!1),k.push([a,b,h]),b in Blockly.Touch.TOUCH_MAP){var n=
|
|
function(a){h(a);var b=!f;g&&b&&a.preventDefault()};for(l=0;m=Blockly.Touch.TOUCH_MAP[b][l];l++)a.addEventListener(m,n,!1),k.push([a,m,n])}return k};
|
|
Blockly.bindEvent_=function(a,b,c,d){var e=function(a){c?d.call(c,a):d(a)},f=[];if(Blockly.utils.global.PointerEvent&&b in Blockly.Touch.TOUCH_MAP)for(var g=0,h;h=Blockly.Touch.TOUCH_MAP[b][g];g++)a.addEventListener(h,e,!1),f.push([a,h,e]);else if(a.addEventListener(b,e,!1),f.push([a,b,e]),b in Blockly.Touch.TOUCH_MAP){var k=function(a){if(a.changedTouches&&1==a.changedTouches.length){var b=a.changedTouches[0];a.clientX=b.clientX;a.clientY=b.clientY}e(a);a.preventDefault()};for(g=0;h=Blockly.Touch.TOUCH_MAP[b][g];g++)a.addEventListener(h,
|
|
k,!1),f.push([a,h,k])}return f};Blockly.unbindEvent_=function(a){for(;a.length;){var b=a.pop(),c=b[2];b[0].removeEventListener(b[1],c,!1)}return c};Blockly.isNumber=function(a){return/^\s*-?\d+(\.\d+)?\s*$/.test(a)};Blockly.hueToHex=function(a){return Blockly.utils.colour.hsvToHex(a,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)};
|
|
Blockly.checkBlockColourConstants=function(){Blockly.checkBlockColourConstant_("LOGIC_HUE",["Blocks","logic","HUE"],void 0);Blockly.checkBlockColourConstant_("LOGIC_HUE",["Constants","Logic","HUE"],210);Blockly.checkBlockColourConstant_("LOOPS_HUE",["Blocks","loops","HUE"],void 0);Blockly.checkBlockColourConstant_("LOOPS_HUE",["Constants","Loops","HUE"],120);Blockly.checkBlockColourConstant_("MATH_HUE",["Blocks","math","HUE"],void 0);Blockly.checkBlockColourConstant_("MATH_HUE",["Constants","Math",
|
|
"HUE"],230);Blockly.checkBlockColourConstant_("TEXTS_HUE",["Blocks","texts","HUE"],void 0);Blockly.checkBlockColourConstant_("TEXTS_HUE",["Constants","Text","HUE"],160);Blockly.checkBlockColourConstant_("LISTS_HUE",["Blocks","lists","HUE"],void 0);Blockly.checkBlockColourConstant_("LISTS_HUE",["Constants","Lists","HUE"],260);Blockly.checkBlockColourConstant_("COLOUR_HUE",["Blocks","colour","HUE"],void 0);Blockly.checkBlockColourConstant_("COLOUR_HUE",["Constants","Colour","HUE"],20);Blockly.checkBlockColourConstant_("VARIABLES_HUE",
|
|
["Blocks","variables","HUE"],void 0);Blockly.checkBlockColourConstant_("VARIABLES_HUE",["Constants","Variables","HUE"],330);Blockly.checkBlockColourConstant_("VARIABLES_DYNAMIC_HUE",["Constants","VariablesDynamic","HUE"],310);Blockly.checkBlockColourConstant_("PROCEDURES_HUE",["Blocks","procedures","HUE"],void 0)};
|
|
Blockly.checkBlockColourConstant_=function(a,b,c){for(var d="Blockly",e=Blockly,f=0;f<b.length;++f)d+="."+b[f],e&&(e=e[b[f]]);e&&e!==c&&(a=(void 0===c?'%1 has been removed. Use Blockly.Msg["%2"].':'%1 is deprecated and unused. Override Blockly.Msg["%2"].').replace("%1",d).replace("%2",a),console.warn(a))};Blockly.setTheme=function(a){Blockly.theme_=a;(a=Blockly.getMainWorkspace())&&Blockly.refreshTheme_(a)};
|
|
Blockly.refreshTheme_=function(a){Blockly.updateBlockStyles_(a.getAllBlocks().filter(function(a){return void 0!==a.getStyleName()}));!a.toolbox_&&a.flyout_&&a.flyout_.workspace_?Blockly.updateBlockStyles_(a.flyout_.workspace_.getAllBlocks()):a.refreshToolboxSelection();a.toolbox_&&a.toolbox_.updateColourFromTheme();var b=new Blockly.Events.Ui(null,"theme");b.workspaceId=a.id;Blockly.Events.fire(b)};
|
|
Blockly.updateBlockStyles_=function(a){for(var b=0,c;c=a[b];b++){var d=c.getStyleName();c.setStyle(d);c.mutator&&c.mutator.updateBlockStyle(d)}};Blockly.getTheme=function(){return Blockly.theme_};Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={});Blockly.utils.global.Blockly.getMainWorkspace=Blockly.getMainWorkspace;Blockly.utils.global.Blockly.addChangeListener=Blockly.addChangeListener; |