Ignore:
Timestamp:
Aug 23, 2017, 9:27:43 AM (7 years ago)
Author:
coas-nagasima
Message:

文字コードを設定

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/webapp/webmrbc/js/blockly_compressed.js

    • Property svn:keywords deleted
    • Property svn:mime-type changed from text/javascript to text/javascript;charset=UTF-8
    r270 r321  
    1 "use strict";var COMPILED=!0,goog=goog||{};goog.global=this,goog.isDef=function(e){return void 0!==e},goog.exportPath_=function(e,o,t){e=e.split("."),t=t||goog.global,e[0]in t||!t.execScript||t.execScript("var "+e[0]);for(var n;e.length&&(n=e.shift());)!e.length&&goog.isDef(o)?t[n]=o:t=t[n]?t[n]:t[n]={}},goog.define=function(e,o){var t=o;COMPILED||(goog.global.CLOSURE_UNCOMPILED_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES,e)?t=goog.global.CLOSURE_UNCOMPILED_DEFINES[e]:goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,e)&&(t=goog.global.CLOSURE_DEFINES[e])),goog.exportPath_(e,t)},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(e){if(goog.isInModuleLoader_())throw Error("goog.provide can not be used within a goog.module.");if(!COMPILED&&goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');goog.constructNamespace_(e)},goog.constructNamespace_=function(e,o){if(!COMPILED){delete goog.implicitNamespaces_[e];for(var t=e;(t=t.substring(0,t.lastIndexOf(".")))&&!goog.getObjectByName(t);)goog.implicitNamespaces_[t]=!0}goog.exportPath_(e,o)},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if(!goog.isString(e)||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInModuleLoader_())throw Error("Module "+e+" 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.");if(goog.moduleLoaderState_.moduleName=e,!COMPILED){if(goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');delete goog.implicitNamespaces_[e]}},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(e){return COMPILED?void 0:goog.isProvided_(e)?e in goog.loadedModules_?goog.loadedModules_[e]:goog.getObjectByName(e):null},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return null!=goog.moduleLoaderState_},goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInModuleLoader_())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.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(e){},COMPILED||(goog.isProvided_=function(e){return e in goog.loadedModules_||!goog.implicitNamespaces_[e]&&goog.isDefAndNotNull(goog.getObjectByName(e))},goog.implicitNamespaces_={"goog.module":!0}),goog.getObjectByName=function(e,o){for(var t,n=e.split("."),r=o||goog.global;t=n.shift();){if(!goog.isDefAndNotNull(r[t]))return null;r=r[t]}return r},goog.globalize=function(e,o){var t,n=o||goog.global;for(t in e)n[t]=e[t]},goog.addDependency=function(e,o,t,n){if(goog.DEPENDENCIES_ENABLED){var r;e=e.replace(/\\/g,"/");var i=goog.dependencies_;n&&"boolean"!=typeof n||(n=n?{module:"goog"}:{});for(var s=0;r=o[s];s++)i.nameToPath[r]=e,i.loadFlags[e]=n;for(n=0;o=t[n];n++)e in i.requires||(i.requires[e]={}),i.requires[e][o]=!0}},goog.ENABLE_DEBUG_LOADER=!0,goog.logToConsole_=function(e){goog.global.console&&goog.global.console.error(e)},goog.require=function(e){if(!COMPILED){if(goog.ENABLE_DEBUG_LOADER&&goog.IS_OLD_IE_&&goog.maybeProcessDeferredDep_(e),goog.isProvided_(e)){if(goog.isInModuleLoader_())return goog.module.getInternal_(e)}else if(goog.ENABLE_DEBUG_LOADER){var o=goog.getPathFromDeps_(e);if(!o)throw e="goog.require could not find: "+e,goog.logToConsole_(e),Error(e);goog.writeScripts_(o)}return null}},goog.basePath="",goog.nullFunction=function(){},goog.abstractMethod=function(){throw Error("unimplemented abstract method")},goog.addSingletonGetter=function(e){e.getInstance=function(){return e.instance_?e.instance_:(goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=e),e.instance_=new e)}},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.TRANSPILER="transpile.js",goog.DEPENDENCIES_ENABLED&&(goog.dependencies_={loadFlags:{},nameToPath:{},requires:{},visited:{},written:{},deferred:{}},goog.inHtmlDocument_=function(){var e=goog.global.document;return null!=e&&"write"in e},goog.findBasePath_=function(){if(goog.isDef(goog.global.CLOSURE_BASE_PATH))goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var e=goog.global.document.getElementsByTagName("SCRIPT"),o=e.length-1;o>=0;--o){var t=e[o].src,n=t.lastIndexOf("?"),n=-1==n?t.length:n;if("base.js"==t.substr(n-7,7)){goog.basePath=t.substr(0,n-7);break}}},goog.importScript_=function(e,o){(goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_)(e,o)&&(goog.dependencies_.written[e]=!0)},goog.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.importProcessedScript_=function(e,o,t){goog.importScript_("",'goog.retrieveAndExec_("'+e+'", '+o+", "+t+");")},goog.queuedModules_=[],goog.wrapModule_=function(e,o){return goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?"goog.loadModule("+goog.global.JSON.stringify(o+"\n//# sourceURL="+e+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+o+"\n;return exports});\n//# sourceURL="+e+"\n"},goog.loadQueuedModules_=function(){var e=goog.queuedModules_.length;if(e>0){var o=goog.queuedModules_;goog.queuedModules_=[];for(var t=0;e>t;t++)goog.maybeProcessDeferredPath_(o[t])}},goog.maybeProcessDeferredDep_=function(e){goog.isDeferredModule_(e)&&goog.allDepsAreAvailable_(e)&&(e=goog.getPathFromDeps_(e),goog.maybeProcessDeferredPath_(goog.basePath+e))},goog.isDeferredModule_=function(e){var o=(e=goog.getPathFromDeps_(e))&&goog.dependencies_.loadFlags[e]||{},t=o.lang||"es3";return e&&("goog"==o.module||goog.needsTranspile_(t))?goog.basePath+e in goog.dependencies_.deferred:!1},goog.allDepsAreAvailable_=function(e){if((e=goog.getPathFromDeps_(e))&&e in goog.dependencies_.requires)for(var o in goog.dependencies_.requires[e])if(!goog.isProvided_(o)&&!goog.isDeferredModule_(o))return!1;return!0},goog.maybeProcessDeferredPath_=function(e){if(e in goog.dependencies_.deferred){var o=goog.dependencies_.deferred[e];delete goog.dependencies_.deferred[e],goog.globalEval(o)}},goog.loadModuleFromUrl=function(e){goog.retrieveAndExec_(e,!0,!1)},goog.writeScriptSrcNode_=function(e){goog.global.document.write('<script type="text/javascript" src="'+e+'"></script>')},goog.appendScriptSrcNode_=function(e){var o=goog.global.document,t=o.createElement("script");t.type="text/javascript",t.src=e,t.defer=!1,t.async=!1,o.head.appendChild(t)},goog.writeScriptTag_=function(e,o){if(goog.inHtmlDocument_()){var t=goog.global.document;if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&"complete"==t.readyState){if(/\bdeps.js$/.test(e))return!1;throw Error('Cannot write "'+e+'" after document load')}if(void 0===o)if(goog.IS_OLD_IE_){var n=" onreadystatechange='goog.onScriptLoad_(this, "+ ++goog.lastNonModuleScriptIndex_+")' ";t.write('<script type="text/javascript" src="'+e+'"'+n+"></script>")}else goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING?goog.appendScriptSrcNode_(e):goog.writeScriptSrcNode_(e);else t.write('<script type="text/javascript">'+o+"</script>");return!0}return!1},goog.needsTranspile_=function(e){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(goog.requiresTranspilation_||(goog.requiresTranspilation_=goog.createRequiresTranspilation_()),e in goog.requiresTranspilation_)return goog.requiresTranspilation_[e];throw Error("Unknown language mode: "+e)},goog.requiresTranspilation_=null,goog.lastNonModuleScriptIndex_=0,goog.onScriptLoad_=function(e,o){return"complete"==e.readyState&&goog.lastNonModuleScriptIndex_==o&&goog.loadQueuedModules_(),!0},goog.writeScripts_=function(e){function o(e){if(!(e in r.written||e in r.visited)){if(r.visited[e]=!0,e in r.requires)for(var i in r.requires[e])if(!goog.isProvided_(i)){if(!(i in r.nameToPath))throw Error("Undefined nameToPath for "+i);o(r.nameToPath[i])}e in n||(n[e]=!0,t.push(e))}}var t=[],n={},r=goog.dependencies_;for(o(e),e=0;e<t.length;e++){var i=t[e];goog.dependencies_.written[i]=!0}var s=goog.moduleLoaderState_;for(goog.moduleLoaderState_=null,e=0;e<t.length;e++){if(!(i=t[e]))throw goog.moduleLoaderState_=s,Error("Undefined script input");var l=r.loadFlags[i]||{},g=goog.needsTranspile_(l.lang||"es3");"goog"==l.module||g?goog.importProcessedScript_(goog.basePath+i,"goog"==l.module,g):goog.importScript_(goog.basePath+i)}goog.moduleLoaderState_=s},goog.getPathFromDeps_=function(e){return e in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[e]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js")),goog.loadModule=function(e){var o=goog.moduleLoaderState_;try{goog.moduleLoaderState_={moduleName:void 0,declareLegacyNamespace:!1};var t;if(goog.isFunction(e))t=e.call(void 0,{});else{if(!goog.isString(e))throw Error("Invalid module definition");t=goog.loadModuleFromSource_.call(void 0,e)}var n=goog.moduleLoaderState_.moduleName;if(!goog.isString(n)||!n)throw Error('Invalid module name "'+n+'"');goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(n,t):goog.SEAL_MODULE_EXPORTS&&Object.seal&&goog.isObject(t)&&Object.seal(t),goog.loadedModules_[n]=t}finally{goog.moduleLoaderState_=o}},goog.loadModuleFromSource_=function(a){return eval(a),{}},goog.normalizePath_=function(e){e=e.split("/");for(var o=0;o<e.length;)"."==e[o]?e.splice(o,1):o&&".."==e[o]&&e[o-1]&&".."!=e[o-1]?e.splice(--o,2):o++;return e.join("/")},goog.loadFileSync_=function(e){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(e);try{var o=new goog.global.XMLHttpRequest;return o.open("get",e,!1),o.send(),0==o.status||200==o.status?o.responseText:null}catch(t){return null}},goog.retrieveAndExec_=function(e,o,t){if(!COMPILED){var n=e;e=goog.normalizePath_(e);var r=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_,i=goog.loadFileSync_(e);if(null==i)throw Error('Load of "'+e+'" failed');t&&(i=goog.transpile_.call(goog.global,i,e)),i=o?goog.wrapModule_(e,i):i+("\n//# sourceURL="+e),goog.IS_OLD_IE_?(goog.dependencies_.deferred[n]=i,goog.queuedModules_.push(n)):r(e,i)}},goog.transpile_=function(a,b){var c=goog.global.$jscomp;c||(goog.global.$jscomp=c={});var d=c.transpile;if(!d){var e=goog.basePath+goog.TRANSPILER,f=goog.loadFileSync_(e);if(f){if(eval(f+"\n//# sourceURL="+e),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,c=goog.global.$jscomp,d=c.transpile}}return d||(d=c.transpile=function(e,o){return goog.logToConsole_(o+" requires transpilation but no transpiler was found."),e}),d(a,b)},goog.typeOf=function(e){var o=typeof e;if("object"==o){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return o;var t=Object.prototype.toString.call(e);if("[object Window]"==t)return"object";if("[object Array]"==t||"number"==typeof e.length&&"undefined"!=typeof e.splice&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"==t||"undefined"!=typeof e.call&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"==o&&"undefined"==typeof e.call)return"object";return o},goog.isNull=function(e){return null===e},goog.isDefAndNotNull=function(e){return null!=e},goog.isArray=function(e){return"array"==goog.typeOf(e)},goog.isArrayLike=function(e){var o=goog.typeOf(e);return"array"==o||"object"==o&&"number"==typeof e.length},goog.isDateLike=function(e){return goog.isObject(e)&&"function"==typeof e.getFullYear},goog.isString=function(e){return"string"==typeof e},goog.isBoolean=function(e){return"boolean"==typeof e},goog.isNumber=function(e){return"number"==typeof e},goog.isFunction=function(e){return"function"==goog.typeOf(e)},goog.isObject=function(e){var o=typeof e;return"object"==o&&null!=e||"function"==o},goog.getUid=function(e){return e[goog.UID_PROPERTY_]||(e[goog.UID_PROPERTY_]=++goog.uidCounter_)},goog.hasUid=function(e){return!!e[goog.UID_PROPERTY_]},goog.removeUid=function(e){null!==e&&"removeAttribute"in e&&e.removeAttribute(goog.UID_PROPERTY_);try{delete e[goog.UID_PROPERTY_]}catch(o){}},goog.UID_PROPERTY_="closure_uid_"+(1e9*Math.random()>>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var o=goog.typeOf(e);if("object"==o||"array"==o){if(e.clone)return e.clone();var t,o="array"==o?[]:{};for(t in e)o[t]=goog.cloneObject(e[t]);return o}return e},goog.bindNative_=function(e,o,t){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,o,t){if(!e)throw Error();if(2<arguments.length){var n=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,n),e.apply(o,t)}}return function(){return e.apply(o,arguments)}},goog.bind=function(e,o,t){return Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_,goog.bind.apply(null,arguments)},goog.partial=function(e,o){var t=Array.prototype.slice.call(arguments,1);return function(){var o=t.slice();return o.push.apply(o,arguments),e.apply(this,o)}},goog.mixin=function(e,o){for(var t in o)e[t]=o[t]},goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date},goog.globalEval=function(e){if(goog.global.execScript)goog.global.execScript(e,"JavaScript");else{if(!goog.global.eval)throw Error("goog.globalEval not available");if(null==goog.evalWorksForGlobals_)if(goog.global.eval("var _evalTest_ = 1;"),"undefined"!=typeof goog.global._evalTest_){try{delete goog.global._evalTest_}catch(o){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1;if(goog.evalWorksForGlobals_)goog.global.eval(e);else{var t=goog.global.document,n=t.createElement("SCRIPT");n.type="text/javascript",n.defer=!1,n.appendChild(t.createTextNode(e)),t.body.appendChild(n),t.body.removeChild(n)}}},goog.evalWorksForGlobals_=null,goog.getCssName=function(e,o){if("."==String(e).charAt(0))throw Error('className passed in goog.getCssName must not start with ".". You passed: '+e);var t=function(e){return goog.cssNameMapping_[e]||e},n=function(e){e=e.split("-");for(var o=[],n=0;n<e.length;n++)o.push(t(e[n]));return o.join("-")},n=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?t:n:function(e){return e},n=o?e+"-"+n(o):n(e);return goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(n):n},goog.setCssNameMapping=function(e,o){goog.cssNameMapping_=e,goog.cssNameMappingStyle_=o},!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING),goog.getMsg=function(e,o){return o&&(e=e.replace(/\{\$([^}]+)}/g,function(e,t){return null!=o&&t in o?o[t]:e})),e},goog.getMsgWithFallback=function(e,o){return e},goog.exportSymbol=function(e,o,t){goog.exportPath_(e,o,t)},goog.exportProperty=function(e,o,t){e[o]=t},goog.inherits=function(e,o){function t(){}t.prototype=o.prototype,e.superClass_=o.prototype,e.prototype=new t,e.prototype.constructor=e,e.base=function(e,t,n){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return o.prototype[t].apply(e,r)}},goog.base=function(e,o,t){var n=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!n)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(n.superClass_){for(var r=Array(arguments.length-1),i=1;i<arguments.length;i++)r[i-1]=arguments[i];return n.superClass_.constructor.apply(e,r)}for(r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];for(var i=!1,s=e.constructor;s;s=s.superClass_&&s.superClass_.constructor)if(s.prototype[o]===n)i=!0;else if(i)return s.prototype[o].apply(e,r);if(e[o]===n)return e.constructor.prototype[o].apply(e,r);throw Error("goog.base called from a method of one name to a method of a different name")},goog.scope=function(e){if(goog.isInModuleLoader_())throw Error("goog.scope is not supported within a goog.module.");e.call(goog.global)},COMPILED||(goog.global.COMPILED=COMPILED),goog.defineClass=function(e,o){var t=o.constructor,n=o.statics;return t&&t!=Object.prototype.constructor||(t=function(){throw Error("cannot instantiate an interface (no constructor defined).")}),t=goog.defineClass.createSealingConstructor_(t,e),e&&goog.inherits(t,e),delete o.constructor,delete o.statics,goog.defineClass.applyProperties_(t.prototype,o),null!=n&&(n instanceof Function?n(t):goog.defineClass.applyProperties_(t,n)),t},goog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG,goog.defineClass.createSealingConstructor_=function(e,o){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return e;var t=!goog.defineClass.isUnsealable_(o),n=function(){var o=e.apply(this,arguments)||this;return o[goog.UID_PROPERTY_]=o[goog.UID_PROPERTY_],this.constructor===n&&t&&Object.seal instanceof Function&&Object.seal(o),o};return n},goog.defineClass.isUnsealable_=function(e){return e&&e.prototype&&e.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]},goog.defineClass.OBJECT_PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.defineClass.applyProperties_=function(e,o){for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);for(var n=0;n<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;n++)t=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[n],Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])},goog.tagUnsealableClass=function(e){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(e.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)},goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable",goog.createRequiresTranspilation_=function(){function a(e,o){d?c[e]=!0:o()?c[e]=!1:d=c[e]=!0}function b(a){try{return!!eval(a)}catch(f){return!1}}var c={es3:!1},d=!1;return a("es5",function(){return b("[1,].length==1")}),a("es6",function(){return 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("es6-impl",function(){return!0}),a("es7",function(){return b("2 ** 2 == 4")}),a("es8",function(){return b("async () => 1, true")}),c},goog.debug={},goog.debug.Error=function(e){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var o=Error().stack;o&&(this.stack=o)}e&&(this.message=String(e)),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.string={},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=function(e,o){return 0==e.lastIndexOf(o,0)},goog.string.endsWith=function(e,o){var t=e.length-o.length;return t>=0&&e.indexOf(o,t)==t},goog.string.caseInsensitiveStartsWith=function(e,o){return 0==goog.string.caseInsensitiveCompare(o,e.substr(0,o.length))},goog.string.caseInsensitiveEndsWith=function(e,o){return 0==goog.string.caseInsensitiveCompare(o,e.substr(e.length-o.length,o.length))},goog.string.caseInsensitiveEquals=function(e,o){return e.toLowerCase()==o.toLowerCase()},goog.string.subs=function(e,o){for(var t=e.split("%s"),n="",r=Array.prototype.slice.call(arguments,1);r.length&&1<t.length;)n+=t.shift()+r.shift();return n+t.join("%s")},goog.string.collapseWhitespace=function(e){return e.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},goog.string.isEmptyOrWhitespace=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.isEmptyString=function(e){return 0==e.length},goog.string.isEmpty=goog.string.isEmptyOrWhitespace,goog.string.isEmptyOrWhitespaceSafe=function(e){return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(e))},goog.string.isEmptySafe=goog.string.isEmptyOrWhitespaceSafe,goog.string.isBreakingWhitespace=function(e){return!/[^\t\n\r ]/.test(e)},goog.string.isAlpha=function(e){return!/[^a-zA-Z]/.test(e)},goog.string.isNumeric=function(e){return!/[^0-9]/.test(e)},goog.string.isAlphaNumeric=function(e){return!/[^a-zA-Z0-9]/.test(e)},goog.string.isSpace=function(e){return" "==e},goog.string.isUnicodeChar=function(e){return 1==e.length&&e>=" "&&"~">=e||e>="€"&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=function(e,o){var t=String(e).toLowerCase(),n=String(o).toLowerCase();return n>t?-1:t==n?0:1},goog.string.numberAwareCompare_=function(e,o,t){if(e==o)return 0;if(!e)return-1;if(!o)return 1;for(var n=e.toLowerCase().match(t),r=o.toLowerCase().match(t),i=Math.min(n.length,r.length),s=0;i>s;s++){t=n[s];var l=r[s];if(t!=l)return e=parseInt(t,10),!isNaN(e)&&(o=parseInt(l,10),!isNaN(o)&&e-o)?e-o:l>t?-1:1}return n.length!=r.length?n.length-r.length:o>e?-1:1},goog.string.intAwareCompare=function(e,o){return goog.string.numberAwareCompare_(e,o,/\d+|\D+/g)},goog.string.floatAwareCompare=function(e,o){return goog.string.numberAwareCompare_(e,o,/\d+|\.\d+|\D+/g)},goog.string.numerateCompare=goog.string.floatAwareCompare,goog.string.urlEncode=function(e){return encodeURIComponent(String(e))},goog.string.urlDecode=function(e){return decodeURIComponent(e.replace(/\+/g," "))},goog.string.newLineToBr=function(e,o){return e.replace(/(\r\n|\r|\n)/g,o?"<br />":"<br>")},goog.string.htmlEscape=function(e,o){if(o)e=e.replace(goog.string.AMP_RE_,"&amp;").replace(goog.string.LT_RE_,"&lt;").replace(goog.string.GT_RE_,"&gt;").replace(goog.string.QUOT_RE_,"&quot;").replace(goog.string.SINGLE_QUOTE_RE_,"&#39;").replace(goog.string.NULL_RE_,"&#0;"),goog.string.DETECT_DOUBLE_ESCAPING&&(e=e.replace(goog.string.E_RE_,"&#101;"));else{if(!goog.string.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.AMP_RE_,"&amp;")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.LT_RE_,"&lt;")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.GT_RE_,"&gt;")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.QUOT_RE_,"&quot;")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.SINGLE_QUOTE_RE_,"&#39;")),-1!=e.indexOf("\x00")&&(e=e.replace(goog.string.NULL_RE_,"&#0;")),goog.string.DETECT_DOUBLE_ESCAPING&&-1!=e.indexOf("e")&&(e=e.replace(goog.string.E_RE_,"&#101;"))}return e},goog.string.AMP_RE_=/&/g,goog.string.LT_RE_=/</g,goog.string.GT_RE_=/>/g,goog.string.QUOT_RE_=/"/g,goog.string.SINGLE_QUOTE_RE_=/'/g,goog.string.NULL_RE_=/\x00/g,goog.string.E_RE_=/e/g,goog.string.ALL_RE_=goog.string.DETECT_DOUBLE_ESCAPING?/[\x00&<>"'e]/:/[\x00&<>"']/,goog.string.unescapeEntities=function(e){return goog.string.contains(e,"&")?!goog.string.FORCE_NON_DOM_HTML_UNESCAPING&&"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(e):goog.string.unescapePureXmlEntities_(e):e},goog.string.unescapeEntitiesWithDocument=function(e,o){return goog.string.contains(e,"&")?goog.string.unescapeEntitiesUsingDom_(e,o):e},goog.string.unescapeEntitiesUsingDom_=function(e,o){var t,n={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"'};return t=o?o.createElement("div"):goog.global.document.createElement("div"),e.replace(goog.string.HTML_ENTITY_PATTERN_,function(e,o){var r=n[e];if(r)return r;if("#"==o.charAt(0)){var i=Number("0"+o.substr(1));isNaN(i)||(r=String.fromCharCode(i))}return r||(t.innerHTML=e+" ",r=t.firstChild.nodeValue.slice(0,-1)),n[e]=r})},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,function(e,o){switch(o){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:if("#"==o.charAt(0)){var t=Number("0"+o.substr(1));if(!isNaN(t))return String.fromCharCode(t)}return e}})},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,o){return goog.string.newLineToBr(e.replace(/  /g," &#160;"),o)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(e,o){for(var t=o.length,n=0;t>n;n++){var r=1==t?o:o.charAt(n);if(e.charAt(0)==r&&e.charAt(e.length-1)==r)return e.substring(1,e.length-1)}return e},goog.string.truncate=function(e,o,t){return t&&(e=goog.string.unescapeEntities(e)),e.length>o&&(e=e.substring(0,o-3)+"..."),t&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,o,t,n){if(t&&(e=goog.string.unescapeEntities(e)),n&&e.length>o){n>o&&(n=o);var r=e.length-n;e=e.substring(0,o-n)+"..."+e.substring(r)}else e.length>o&&(n=Math.floor(o/2),r=e.length-n,e=e.substring(0,n+o%2)+"..."+e.substring(r));return t&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","      ":"\\t","
     1"use strict";var COMPILED=!0,goog=goog||{};goog.global=this,goog.isDef=function(e){return void 0!==e},goog.exportPath_=function(e,o,t){e=e.split("."),t=t||goog.global,e[0]in t||!t.execScript||t.execScript("var "+e[0]);for(var n;e.length&&(n=e.shift());)!e.length&&goog.isDef(o)?t[n]=o:t=t[n]?t[n]:t[n]={}},goog.define=function(e,o){var t=o;COMPILED||(goog.global.CLOSURE_UNCOMPILED_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES,e)?t=goog.global.CLOSURE_UNCOMPILED_DEFINES[e]:goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,e)&&(t=goog.global.CLOSURE_DEFINES[e])),goog.exportPath_(e,t)},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(e){if(goog.isInModuleLoader_())throw Error("goog.provide can not be used within a goog.module.");if(!COMPILED&&goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');goog.constructNamespace_(e)},goog.constructNamespace_=function(e,o){if(!COMPILED){delete goog.implicitNamespaces_[e];for(var t=e;(t=t.substring(0,t.lastIndexOf(".")))&&!goog.getObjectByName(t);)goog.implicitNamespaces_[t]=!0}goog.exportPath_(e,o)},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if(!goog.isString(e)||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInModuleLoader_())throw Error("Module "+e+" 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.");if(goog.moduleLoaderState_.moduleName=e,!COMPILED){if(goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');delete goog.implicitNamespaces_[e]}},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(e){return COMPILED?void 0:goog.isProvided_(e)?e in goog.loadedModules_?goog.loadedModules_[e]:goog.getObjectByName(e):null},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return null!=goog.moduleLoaderState_},goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInModuleLoader_())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.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(e){},COMPILED||(goog.isProvided_=function(e){return e in goog.loadedModules_||!goog.implicitNamespaces_[e]&&goog.isDefAndNotNull(goog.getObjectByName(e))},goog.implicitNamespaces_={"goog.module":!0}),goog.getObjectByName=function(e,o){for(var t,n=e.split("."),r=o||goog.global;t=n.shift();){if(!goog.isDefAndNotNull(r[t]))return null;r=r[t]}return r},goog.globalize=function(e,o){var t,n=o||goog.global;for(t in e)n[t]=e[t]},goog.addDependency=function(e,o,t,n){if(goog.DEPENDENCIES_ENABLED){var r;e=e.replace(/\\/g,"/");var i=goog.dependencies_;n&&"boolean"!=typeof n||(n=n?{module:"goog"}:{});for(var s=0;r=o[s];s++)i.nameToPath[r]=e,i.loadFlags[e]=n;for(n=0;o=t[n];n++)e in i.requires||(i.requires[e]={}),i.requires[e][o]=!0}},goog.ENABLE_DEBUG_LOADER=!0,goog.logToConsole_=function(e){goog.global.console&&goog.global.console.error(e)},goog.require=function(e){if(!COMPILED){if(goog.ENABLE_DEBUG_LOADER&&goog.IS_OLD_IE_&&goog.maybeProcessDeferredDep_(e),goog.isProvided_(e)){if(goog.isInModuleLoader_())return goog.module.getInternal_(e)}else if(goog.ENABLE_DEBUG_LOADER){var o=goog.getPathFromDeps_(e);if(!o)throw e="goog.require could not find: "+e,goog.logToConsole_(e),Error(e);goog.writeScripts_(o)}return null}},goog.basePath="",goog.nullFunction=function(){},goog.abstractMethod=function(){throw Error("unimplemented abstract method")},goog.addSingletonGetter=function(e){e.getInstance=function(){return e.instance_?e.instance_:(goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=e),e.instance_=new e)}},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.TRANSPILER="transpile.js",goog.DEPENDENCIES_ENABLED&&(goog.dependencies_={loadFlags:{},nameToPath:{},requires:{},visited:{},written:{},deferred:{}},goog.inHtmlDocument_=function(){var e=goog.global.document;return null!=e&&"write"in e},goog.findBasePath_=function(){if(goog.isDef(goog.global.CLOSURE_BASE_PATH))goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var e=goog.global.document.getElementsByTagName("SCRIPT"),o=e.length-1;o>=0;--o){var t=e[o].src,n=t.lastIndexOf("?"),n=-1==n?t.length:n;if("base.js"==t.substr(n-7,7)){goog.basePath=t.substr(0,n-7);break}}},goog.importScript_=function(e,o){(goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_)(e,o)&&(goog.dependencies_.written[e]=!0)},goog.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.importProcessedScript_=function(e,o,t){goog.importScript_("",'goog.retrieveAndExec_("'+e+'", '+o+", "+t+");")},goog.queuedModules_=[],goog.wrapModule_=function(e,o){return goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?"goog.loadModule("+goog.global.JSON.stringify(o+"\n//# sourceURL="+e+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+o+"\n;return exports});\n//# sourceURL="+e+"\n"},goog.loadQueuedModules_=function(){var e=goog.queuedModules_.length;if(e>0){var o=goog.queuedModules_;goog.queuedModules_=[];for(var t=0;e>t;t++)goog.maybeProcessDeferredPath_(o[t])}},goog.maybeProcessDeferredDep_=function(e){goog.isDeferredModule_(e)&&goog.allDepsAreAvailable_(e)&&(e=goog.getPathFromDeps_(e),goog.maybeProcessDeferredPath_(goog.basePath+e))},goog.isDeferredModule_=function(e){var o=(e=goog.getPathFromDeps_(e))&&goog.dependencies_.loadFlags[e]||{},t=o.lang||"es3";return e&&("goog"==o.module||goog.needsTranspile_(t))?goog.basePath+e in goog.dependencies_.deferred:!1},goog.allDepsAreAvailable_=function(e){if((e=goog.getPathFromDeps_(e))&&e in goog.dependencies_.requires)for(var o in goog.dependencies_.requires[e])if(!goog.isProvided_(o)&&!goog.isDeferredModule_(o))return!1;return!0},goog.maybeProcessDeferredPath_=function(e){if(e in goog.dependencies_.deferred){var o=goog.dependencies_.deferred[e];delete goog.dependencies_.deferred[e],goog.globalEval(o)}},goog.loadModuleFromUrl=function(e){goog.retrieveAndExec_(e,!0,!1)},goog.writeScriptSrcNode_=function(e){goog.global.document.write('<script type="text/javascript" src="'+e+'"></script>')},goog.appendScriptSrcNode_=function(e){var o=goog.global.document,t=o.createElement("script");t.type="text/javascript",t.src=e,t.defer=!1,t.async=!1,o.head.appendChild(t)},goog.writeScriptTag_=function(e,o){if(goog.inHtmlDocument_()){var t=goog.global.document;if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&"complete"==t.readyState){if(/\bdeps.js$/.test(e))return!1;throw Error('Cannot write "'+e+'" after document load')}if(void 0===o)if(goog.IS_OLD_IE_){var n=" onreadystatechange='goog.onScriptLoad_(this, "+ ++goog.lastNonModuleScriptIndex_+")' ";t.write('<script type="text/javascript" src="'+e+'"'+n+"></script>")}else goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING?goog.appendScriptSrcNode_(e):goog.writeScriptSrcNode_(e);else t.write('<script type="text/javascript">'+o+"</script>");return!0}return!1},goog.needsTranspile_=function(e){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(goog.requiresTranspilation_||(goog.requiresTranspilation_=goog.createRequiresTranspilation_()),e in goog.requiresTranspilation_)return goog.requiresTranspilation_[e];throw Error("Unknown language mode: "+e)},goog.requiresTranspilation_=null,goog.lastNonModuleScriptIndex_=0,goog.onScriptLoad_=function(e,o){return"complete"==e.readyState&&goog.lastNonModuleScriptIndex_==o&&goog.loadQueuedModules_(),!0},goog.writeScripts_=function(e){function o(e){if(!(e in r.written||e in r.visited)){if(r.visited[e]=!0,e in r.requires)for(var i in r.requires[e])if(!goog.isProvided_(i)){if(!(i in r.nameToPath))throw Error("Undefined nameToPath for "+i);o(r.nameToPath[i])}e in n||(n[e]=!0,t.push(e))}}var t=[],n={},r=goog.dependencies_;for(o(e),e=0;e<t.length;e++){var i=t[e];goog.dependencies_.written[i]=!0}var s=goog.moduleLoaderState_;for(goog.moduleLoaderState_=null,e=0;e<t.length;e++){if(!(i=t[e]))throw goog.moduleLoaderState_=s,Error("Undefined script input");var l=r.loadFlags[i]||{},g=goog.needsTranspile_(l.lang||"es3");"goog"==l.module||g?goog.importProcessedScript_(goog.basePath+i,"goog"==l.module,g):goog.importScript_(goog.basePath+i)}goog.moduleLoaderState_=s},goog.getPathFromDeps_=function(e){return e in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[e]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js")),goog.loadModule=function(e){var o=goog.moduleLoaderState_;try{goog.moduleLoaderState_={moduleName:void 0,declareLegacyNamespace:!1};var t;if(goog.isFunction(e))t=e.call(void 0,{});else{if(!goog.isString(e))throw Error("Invalid module definition");t=goog.loadModuleFromSource_.call(void 0,e)}var n=goog.moduleLoaderState_.moduleName;if(!goog.isString(n)||!n)throw Error('Invalid module name "'+n+'"');goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(n,t):goog.SEAL_MODULE_EXPORTS&&Object.seal&&goog.isObject(t)&&Object.seal(t),goog.loadedModules_[n]=t}finally{goog.moduleLoaderState_=o}},goog.loadModuleFromSource_=function(a){return eval(a),{}},goog.normalizePath_=function(e){e=e.split("/");for(var o=0;o<e.length;)"."==e[o]?e.splice(o,1):o&&".."==e[o]&&e[o-1]&&".."!=e[o-1]?e.splice(--o,2):o++;return e.join("/")},goog.loadFileSync_=function(e){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(e);try{var o=new goog.global.XMLHttpRequest;return o.open("get",e,!1),o.send(),0==o.status||200==o.status?o.responseText:null}catch(t){return null}},goog.retrieveAndExec_=function(e,o,t){if(!COMPILED){var n=e;e=goog.normalizePath_(e);var r=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_,i=goog.loadFileSync_(e);if(null==i)throw Error('Load of "'+e+'" failed');t&&(i=goog.transpile_.call(goog.global,i,e)),i=o?goog.wrapModule_(e,i):i+("\n//# sourceURL="+e),goog.IS_OLD_IE_?(goog.dependencies_.deferred[n]=i,goog.queuedModules_.push(n)):r(e,i)}},goog.transpile_=function(a,b){var c=goog.global.$jscomp;c||(goog.global.$jscomp=c={});var d=c.transpile;if(!d){var e=goog.basePath+goog.TRANSPILER,f=goog.loadFileSync_(e);if(f){if(eval(f+"\n//# sourceURL="+e),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,c=goog.global.$jscomp,d=c.transpile}}return d||(d=c.transpile=function(e,o){return goog.logToConsole_(o+" requires transpilation but no transpiler was found."),e}),d(a,b)},goog.typeOf=function(e){var o=typeof e;if("object"==o){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return o;var t=Object.prototype.toString.call(e);if("[object Window]"==t)return"object";if("[object Array]"==t||"number"==typeof e.length&&"undefined"!=typeof e.splice&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"==t||"undefined"!=typeof e.call&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"==o&&"undefined"==typeof e.call)return"object";return o},goog.isNull=function(e){return null===e},goog.isDefAndNotNull=function(e){return null!=e},goog.isArray=function(e){return"array"==goog.typeOf(e)},goog.isArrayLike=function(e){var o=goog.typeOf(e);return"array"==o||"object"==o&&"number"==typeof e.length},goog.isDateLike=function(e){return goog.isObject(e)&&"function"==typeof e.getFullYear},goog.isString=function(e){return"string"==typeof e},goog.isBoolean=function(e){return"boolean"==typeof e},goog.isNumber=function(e){return"number"==typeof e},goog.isFunction=function(e){return"function"==goog.typeOf(e)},goog.isObject=function(e){var o=typeof e;return"object"==o&&null!=e||"function"==o},goog.getUid=function(e){return e[goog.UID_PROPERTY_]||(e[goog.UID_PROPERTY_]=++goog.uidCounter_)},goog.hasUid=function(e){return!!e[goog.UID_PROPERTY_]},goog.removeUid=function(e){null!==e&&"removeAttribute"in e&&e.removeAttribute(goog.UID_PROPERTY_);try{delete e[goog.UID_PROPERTY_]}catch(o){}},goog.UID_PROPERTY_="closure_uid_"+(1e9*Math.random()>>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var o=goog.typeOf(e);if("object"==o||"array"==o){if(e.clone)return e.clone();var t,o="array"==o?[]:{};for(t in e)o[t]=goog.cloneObject(e[t]);return o}return e},goog.bindNative_=function(e,o,t){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,o,t){if(!e)throw Error();if(2<arguments.length){var n=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,n),e.apply(o,t)}}return function(){return e.apply(o,arguments)}},goog.bind=function(e,o,t){return Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_,goog.bind.apply(null,arguments)},goog.partial=function(e,o){var t=Array.prototype.slice.call(arguments,1);return function(){var o=t.slice();return o.push.apply(o,arguments),e.apply(this,o)}},goog.mixin=function(e,o){for(var t in o)e[t]=o[t]},goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date},goog.globalEval=function(e){if(goog.global.execScript)goog.global.execScript(e,"JavaScript");else{if(!goog.global.eval)throw Error("goog.globalEval not available");if(null==goog.evalWorksForGlobals_)if(goog.global.eval("var _evalTest_ = 1;"),"undefined"!=typeof goog.global._evalTest_){try{delete goog.global._evalTest_}catch(o){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1;if(goog.evalWorksForGlobals_)goog.global.eval(e);else{var t=goog.global.document,n=t.createElement("SCRIPT");n.type="text/javascript",n.defer=!1,n.appendChild(t.createTextNode(e)),t.body.appendChild(n),t.body.removeChild(n)}}},goog.evalWorksForGlobals_=null,goog.getCssName=function(e,o){if("."==String(e).charAt(0))throw Error('className passed in goog.getCssName must not start with ".". You passed: '+e);var t=function(e){return goog.cssNameMapping_[e]||e},n=function(e){e=e.split("-");for(var o=[],n=0;n<e.length;n++)o.push(t(e[n]));return o.join("-")},n=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?t:n:function(e){return e},n=o?e+"-"+n(o):n(e);return goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(n):n},goog.setCssNameMapping=function(e,o){goog.cssNameMapping_=e,goog.cssNameMappingStyle_=o},!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING),goog.getMsg=function(e,o){return o&&(e=e.replace(/\{\$([^}]+)}/g,function(e,t){return null!=o&&t in o?o[t]:e})),e},goog.getMsgWithFallback=function(e,o){return e},goog.exportSymbol=function(e,o,t){goog.exportPath_(e,o,t)},goog.exportProperty=function(e,o,t){e[o]=t},goog.inherits=function(e,o){function t(){}t.prototype=o.prototype,e.superClass_=o.prototype,e.prototype=new t,e.prototype.constructor=e,e.base=function(e,t,n){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return o.prototype[t].apply(e,r)}},goog.base=function(e,o,t){var n=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!n)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(n.superClass_){for(var r=Array(arguments.length-1),i=1;i<arguments.length;i++)r[i-1]=arguments[i];return n.superClass_.constructor.apply(e,r)}for(r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];for(var i=!1,s=e.constructor;s;s=s.superClass_&&s.superClass_.constructor)if(s.prototype[o]===n)i=!0;else if(i)return s.prototype[o].apply(e,r);if(e[o]===n)return e.constructor.prototype[o].apply(e,r);throw Error("goog.base called from a method of one name to a method of a different name")},goog.scope=function(e){if(goog.isInModuleLoader_())throw Error("goog.scope is not supported within a goog.module.");e.call(goog.global)},COMPILED||(goog.global.COMPILED=COMPILED),goog.defineClass=function(e,o){var t=o.constructor,n=o.statics;return t&&t!=Object.prototype.constructor||(t=function(){throw Error("cannot instantiate an interface (no constructor defined).")}),t=goog.defineClass.createSealingConstructor_(t,e),e&&goog.inherits(t,e),delete o.constructor,delete o.statics,goog.defineClass.applyProperties_(t.prototype,o),null!=n&&(n instanceof Function?n(t):goog.defineClass.applyProperties_(t,n)),t},goog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG,goog.defineClass.createSealingConstructor_=function(e,o){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return e;var t=!goog.defineClass.isUnsealable_(o),n=function(){var o=e.apply(this,arguments)||this;return o[goog.UID_PROPERTY_]=o[goog.UID_PROPERTY_],this.constructor===n&&t&&Object.seal instanceof Function&&Object.seal(o),o};return n},goog.defineClass.isUnsealable_=function(e){return e&&e.prototype&&e.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]},goog.defineClass.OBJECT_PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.defineClass.applyProperties_=function(e,o){for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);for(var n=0;n<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;n++)t=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[n],Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])},goog.tagUnsealableClass=function(e){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(e.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)},goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable",goog.createRequiresTranspilation_=function(){function a(e,o){d?c[e]=!0:o()?c[e]=!1:d=c[e]=!0}function b(a){try{return!!eval(a)}catch(f){return!1}}var c={es3:!1},d=!1;return a("es5",function(){return b("[1,].length==1")}),a("es6",function(){return 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("es6-impl",function(){return!0}),a("es7",function(){return b("2 ** 2 == 4")}),a("es8",function(){return b("async () => 1, true")}),c},goog.debug={},goog.debug.Error=function(e){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var o=Error().stack;o&&(this.stack=o)}e&&(this.message=String(e)),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.string={},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:" "},goog.string.startsWith=function(e,o){return 0==e.lastIndexOf(o,0)},goog.string.endsWith=function(e,o){var t=e.length-o.length;return t>=0&&e.indexOf(o,t)==t},goog.string.caseInsensitiveStartsWith=function(e,o){return 0==goog.string.caseInsensitiveCompare(o,e.substr(0,o.length))},goog.string.caseInsensitiveEndsWith=function(e,o){return 0==goog.string.caseInsensitiveCompare(o,e.substr(e.length-o.length,o.length))},goog.string.caseInsensitiveEquals=function(e,o){return e.toLowerCase()==o.toLowerCase()},goog.string.subs=function(e,o){for(var t=e.split("%s"),n="",r=Array.prototype.slice.call(arguments,1);r.length&&1<t.length;)n+=t.shift()+r.shift();return n+t.join("%s")},goog.string.collapseWhitespace=function(e){return e.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},goog.string.isEmptyOrWhitespace=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.isEmptyString=function(e){return 0==e.length},goog.string.isEmpty=goog.string.isEmptyOrWhitespace,goog.string.isEmptyOrWhitespaceSafe=function(e){return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(e))},goog.string.isEmptySafe=goog.string.isEmptyOrWhitespaceSafe,goog.string.isBreakingWhitespace=function(e){return!/[^\t\n\r ]/.test(e)},goog.string.isAlpha=function(e){return!/[^a-zA-Z]/.test(e)},goog.string.isNumeric=function(e){return!/[^0-9]/.test(e)},goog.string.isAlphaNumeric=function(e){return!/[^a-zA-Z0-9]/.test(e)},goog.string.isSpace=function(e){return" "==e},goog.string.isUnicodeChar=function(e){return 1==e.length&&e>=" "&&"~">=e||e>="€"&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=function(e,o){var t=String(e).toLowerCase(),n=String(o).toLowerCase();return n>t?-1:t==n?0:1},goog.string.numberAwareCompare_=function(e,o,t){if(e==o)return 0;if(!e)return-1;if(!o)return 1;for(var n=e.toLowerCase().match(t),r=o.toLowerCase().match(t),i=Math.min(n.length,r.length),s=0;i>s;s++){t=n[s];var l=r[s];if(t!=l)return e=parseInt(t,10),!isNaN(e)&&(o=parseInt(l,10),!isNaN(o)&&e-o)?e-o:l>t?-1:1}return n.length!=r.length?n.length-r.length:o>e?-1:1},goog.string.intAwareCompare=function(e,o){return goog.string.numberAwareCompare_(e,o,/\d+|\D+/g)},goog.string.floatAwareCompare=function(e,o){return goog.string.numberAwareCompare_(e,o,/\d+|\.\d+|\D+/g)},goog.string.numerateCompare=goog.string.floatAwareCompare,goog.string.urlEncode=function(e){return encodeURIComponent(String(e))},goog.string.urlDecode=function(e){return decodeURIComponent(e.replace(/\+/g," "))},goog.string.newLineToBr=function(e,o){return e.replace(/(\r\n|\r|\n)/g,o?"<br />":"<br>")},goog.string.htmlEscape=function(e,o){if(o)e=e.replace(goog.string.AMP_RE_,"&amp;").replace(goog.string.LT_RE_,"&lt;").replace(goog.string.GT_RE_,"&gt;").replace(goog.string.QUOT_RE_,"&quot;").replace(goog.string.SINGLE_QUOTE_RE_,"&#39;").replace(goog.string.NULL_RE_,"&#0;"),goog.string.DETECT_DOUBLE_ESCAPING&&(e=e.replace(goog.string.E_RE_,"&#101;"));else{if(!goog.string.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.AMP_RE_,"&amp;")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.LT_RE_,"&lt;")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.GT_RE_,"&gt;")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.QUOT_RE_,"&quot;")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.SINGLE_QUOTE_RE_,"&#39;")),-1!=e.indexOf("\x00")&&(e=e.replace(goog.string.NULL_RE_,"&#0;")),goog.string.DETECT_DOUBLE_ESCAPING&&-1!=e.indexOf("e")&&(e=e.replace(goog.string.E_RE_,"&#101;"))}return e},goog.string.AMP_RE_=/&/g,goog.string.LT_RE_=/</g,goog.string.GT_RE_=/>/g,goog.string.QUOT_RE_=/"/g,goog.string.SINGLE_QUOTE_RE_=/'/g,goog.string.NULL_RE_=/\x00/g,goog.string.E_RE_=/e/g,goog.string.ALL_RE_=goog.string.DETECT_DOUBLE_ESCAPING?/[\x00&<>"'e]/:/[\x00&<>"']/,goog.string.unescapeEntities=function(e){return goog.string.contains(e,"&")?!goog.string.FORCE_NON_DOM_HTML_UNESCAPING&&"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(e):goog.string.unescapePureXmlEntities_(e):e},goog.string.unescapeEntitiesWithDocument=function(e,o){return goog.string.contains(e,"&")?goog.string.unescapeEntitiesUsingDom_(e,o):e},goog.string.unescapeEntitiesUsingDom_=function(e,o){var t,n={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"'};return t=o?o.createElement("div"):goog.global.document.createElement("div"),e.replace(goog.string.HTML_ENTITY_PATTERN_,function(e,o){var r=n[e];if(r)return r;if("#"==o.charAt(0)){var i=Number("0"+o.substr(1));isNaN(i)||(r=String.fromCharCode(i))}return r||(t.innerHTML=e+" ",r=t.firstChild.nodeValue.slice(0,-1)),n[e]=r})},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,function(e,o){switch(o){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:if("#"==o.charAt(0)){var t=Number("0"+o.substr(1));if(!isNaN(t))return String.fromCharCode(t)}return e}})},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,o){return goog.string.newLineToBr(e.replace(/  /g," &#160;"),o)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(e,o){for(var t=o.length,n=0;t>n;n++){var r=1==t?o:o.charAt(n);if(e.charAt(0)==r&&e.charAt(e.length-1)==r)return e.substring(1,e.length-1)}return e},goog.string.truncate=function(e,o,t){return t&&(e=goog.string.unescapeEntities(e)),e.length>o&&(e=e.substring(0,o-3)+"..."),t&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,o,t,n){if(t&&(e=goog.string.unescapeEntities(e)),n&&e.length>o){n>o&&(n=o);var r=e.length-n;e=e.substring(0,o-n)+"..."+e.substring(r)}else e.length>o&&(n=Math.floor(o/2),r=e.length-n,e=e.substring(0,n+o%2)+"..."+e.substring(r));return t&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","  ":"\\t","
    22":"\\x0B",'"':'\\"',"\\":"\\\\","<":"<"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(e){e=String(e);for(var o=['"'],t=0;t<e.length;t++){var n=e.charAt(t),r=n.charCodeAt(0);o[t+1]=goog.string.specialEscapeChars_[n]||(r>31&&127>r?n:goog.string.escapeChar(n))}return o.push('"'),o.join("")},goog.string.escapeString=function(e){for(var o=[],t=0;t<e.length;t++)o[t]=goog.string.escapeChar(e.charAt(t));return o.join("")},goog.string.escapeChar=function(e){if(e in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[e];if(e in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[e]=goog.string.specialEscapeChars_[e];var o,t=e.charCodeAt(0);return t>31&&127>t?o=e:(256>t?(o="\\x",(16>t||t>256)&&(o+="0")):(o="\\u",4096>t&&(o+="0")),o+=t.toString(16).toUpperCase()),goog.string.jsEscapeCache_[e]=o},goog.string.contains=function(e,o){return-1!=e.indexOf(o)},goog.string.caseInsensitiveContains=function(e,o){return goog.string.contains(e.toLowerCase(),o.toLowerCase())},goog.string.countOf=function(e,o){return e&&o?e.split(o).length-1:0},goog.string.removeAt=function(e,o,t){var n=e;return o>=0&&o<e.length&&t>0&&(n=e.substr(0,o)+e.substr(o+t,e.length-o-t)),n},goog.string.remove=function(e,o){return e.replace(o,"")},goog.string.removeAll=function(e,o){var t=new RegExp(goog.string.regExpEscape(o),"g");return e.replace(t,"")},goog.string.replaceAll=function(e,o,t){return o=new RegExp(goog.string.regExpEscape(o),"g"),e.replace(o,t.replace(/\$/g,"$$$$"))},goog.string.regExpEscape=function(e){return String(e).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},goog.string.repeat=String.prototype.repeat?function(e,o){return e.repeat(o)}:function(e,o){return Array(o+1).join(e)},goog.string.padNumber=function(e,o,t){return e=goog.isDef(t)?e.toFixed(t):String(e),t=e.indexOf("."),-1==t&&(t=e.length),goog.string.repeat("0",Math.max(0,o-t))+e},goog.string.makeSafe=function(e){return null==e?"":String(e)},goog.string.buildString=function(e){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=function(e,o){for(var t=0,n=goog.string.trim(String(e)).split("."),r=goog.string.trim(String(o)).split("."),i=Math.max(n.length,r.length),s=0;0==t&&i>s;s++){var l=n[s]||"",g=r[s]||"";do{if(l=/(\d*)(\D*)(.*)/.exec(l)||["","","",""],g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""],0==l[0].length&&0==g[0].length)break;var t=0==l[1].length?0:parseInt(l[1],10),a=0==g[1].length?0:parseInt(g[1],10),t=goog.string.compareElements_(t,a)||goog.string.compareElements_(0==l[2].length,0==g[2].length)||goog.string.compareElements_(l[2],g[2]),l=l[3],g=g[3]}while(0==t)}return t},goog.string.compareElements_=function(e,o){return o>e?-1:e>o?1:0},goog.string.hashCode=function(e){for(var o=0,t=0;t<e.length;++t)o=31*o+e.charCodeAt(t)>>>0;return o},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var o=Number(e);return 0==o&&goog.string.isEmptyOrWhitespace(e)?NaN:o},goog.string.isLowerCamelCase=function(e){return/^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return/^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return String(e).replace(/\-([a-z])/g,function(e,o){return o.toUpperCase()})},goog.string.toSelectorCase=function(e){return String(e).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,o){var t=goog.isString(o)?goog.string.regExpEscape(o):"\\s";return e.replace(new RegExp("(^"+(t?"|["+t+"]+":"")+")([a-z])","g"),function(e,o,t){return o+t.toUpperCase()})},goog.string.capitalize=function(e){return String(e.charAt(0)).toUpperCase()+String(e.substr(1)).toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e=String(e)),goog.isString(e)?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,o,t){e=e.split(o);for(var n=[];t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(o)),n},goog.string.lastComponent=function(e,o){if(!o)return e;"string"==typeof o&&(o=[o]);for(var t=-1,n=0;n<o.length;n++)if(""!=o[n]){var r=e.lastIndexOf(o[n]);r>t&&(t=r)}return-1==t?e:e.slice(t+1)},goog.string.editDistance=function(e,o){var t=[],n=[];if(e==o)return 0;if(!e.length||!o.length)return Math.max(e.length,o.length);for(var r=0;r<o.length+1;r++)t[r]=r;for(r=0;r<e.length;r++){n[0]=r+1;for(var i=0;i<o.length;i++)n[i+1]=Math.min(n[i]+1,t[i+1]+1,t[i]+Number(e[r]!=o[i]));for(i=0;i<t.length;i++)t[i]=n[i]}return n[o.length]},goog.asserts={},goog.asserts.ENABLE_ASSERTS=goog.DEBUG,goog.asserts.AssertionError=function(e,o){o.unshift(e),goog.debug.Error.call(this,goog.string.subs.apply(null,o)),o.shift(),this.messagePattern=e},goog.inherits(goog.asserts.AssertionError,goog.debug.Error),goog.asserts.AssertionError.prototype.name="AssertionError",goog.asserts.DEFAULT_ERROR_HANDLER=function(e){throw e},goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER,goog.asserts.doAssertFailure_=function(e,o,t,n){var r="Assertion failed";if(t)var r=r+(": "+t),i=n;else e&&(r+=": "+e,i=o);e=new goog.asserts.AssertionError(""+r,i||[]),goog.asserts.errorHandler_(e);
    33},goog.asserts.setErrorHandler=function(e){goog.asserts.ENABLE_ASSERTS&&(goog.asserts.errorHandler_=e)},goog.asserts.assert=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!e&&goog.asserts.doAssertFailure_("",null,o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.fail=function(e,o){goog.asserts.ENABLE_ASSERTS&&goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure"+(e?": "+e:""),Array.prototype.slice.call(arguments,1)))},goog.asserts.assertNumber=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(e)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertString=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isString(e)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertFunction=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(e)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertObject=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isObject(e)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertArray=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isArray(e)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertBoolean=function(e,o,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(e)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertElement=function(e,o,t){return!goog.asserts.ENABLE_ASSERTS||goog.isObject(e)&&e.nodeType==goog.dom.NodeType.ELEMENT||goog.asserts.doAssertFailure_("Expected Element but got %s: %s.",[goog.typeOf(e),e],o,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertInstanceof=function(e,o,t,n){return!goog.asserts.ENABLE_ASSERTS||e instanceof o||goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.",[goog.asserts.getType_(o),goog.asserts.getType_(e)],t,Array.prototype.slice.call(arguments,3)),e},goog.asserts.assertObjectPrototypeIsIntact=function(){for(var e in Object.prototype)goog.asserts.fail(e+" should not be enumerable in Object.prototype.")},goog.asserts.getType_=function(e){return e instanceof Function?e.displayName||e.name||"unknown type name":e instanceof Object?e.constructor.displayName||e.constructor.name||Object.prototype.toString.call(e):null===e?"null":typeof e},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(e){if(goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length]=e,goog.debug.entryPointRegistry.monitorsMayExist_)for(var o=goog.debug.entryPointRegistry.monitors_,t=0;t<o.length;t++)e(goog.bind(o[t].wrap,o[t]))},goog.debug.entryPointRegistry.monitorAll=function(e){goog.debug.entryPointRegistry.monitorsMayExist_=!0;for(var o=goog.bind(e.wrap,e),t=0;t<goog.debug.entryPointRegistry.refList_.length;t++)goog.debug.entryPointRegistry.refList_[t](o);goog.debug.entryPointRegistry.monitors_.push(e)},goog.debug.entryPointRegistry.unmonitorAllIfPossible=function(e){var o=goog.debug.entryPointRegistry.monitors_;goog.asserts.assert(e==o[o.length-1],"Only the most recent monitor can be unwrapped."),e=goog.bind(e.unwrap,e);for(var t=0;t<goog.debug.entryPointRegistry.refList_.length;t++)goog.debug.entryPointRegistry.refList_[t](e);o.length--},goog.array={},goog.NATIVE_ARRAY_PROTOTYPES=goog.TRUSTED_SITE,goog.array.ASSUME_NATIVE_FUNCTIONS=!1,goog.array.peek=function(e){return e[e.length-1]},goog.array.last=goog.array.peek,goog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.indexOf)?function(e,o,t){return goog.asserts.assert(null!=e.length),Array.prototype.indexOf.call(e,o,t)}:function(e,o,t){if(t=null==t?0:0>t?Math.max(0,e.length+t):t,goog.isString(e))return goog.isString(o)&&1==o.length?e.indexOf(o,t):-1;for(;t<e.length;t++)if(t in e&&e[t]===o)return t;return-1},goog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.lastIndexOf)?function(e,o,t){return goog.asserts.assert(null!=e.length),Array.prototype.lastIndexOf.call(e,o,null==t?e.length-1:t)}:function(e,o,t){if(t=null==t?e.length-1:t,0>t&&(t=Math.max(0,e.length+t)),goog.isString(e))return goog.isString(o)&&1==o.length?e.lastIndexOf(o,t):-1;for(;t>=0;t--)if(t in e&&e[t]===o)return t;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,o,t){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,o,t)}:function(e,o,t){for(var n=e.length,r=goog.isString(e)?e.split(""):e,i=0;n>i;i++)i in r&&o.call(t,r[i],i,e)},goog.array.forEachRight=function(e,o,t){for(var n=e.length,r=goog.isString(e)?e.split(""):e,n=n-1;n>=0;--n)n in r&&o.call(t,r[n],n,e)},goog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.filter)?function(e,o,t){return goog.asserts.assert(null!=e.length),Array.prototype.filter.call(e,o,t)}:function(e,o,t){for(var n=e.length,r=[],i=0,s=goog.isString(e)?e.split(""):e,l=0;n>l;l++)if(l in s){var g=s[l];o.call(t,g,l,e)&&(r[i++]=g)}return r},goog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.map)?function(e,o,t){return goog.asserts.assert(null!=e.length),Array.prototype.map.call(e,o,t)}:function(e,o,t){for(var n=e.length,r=Array(n),i=goog.isString(e)?e.split(""):e,s=0;n>s;s++)s in i&&(r[s]=o.call(t,i[s],s,e));return r},goog.array.reduce=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduce)?function(e,o,t,n){return goog.asserts.assert(null!=e.length),n&&(o=goog.bind(o,n)),Array.prototype.reduce.call(e,o,t)}:function(e,o,t,n){var r=t;return goog.array.forEach(e,function(t,i){r=o.call(n,r,t,i,e)}),r},goog.array.reduceRight=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduceRight)?function(e,o,t,n){return goog.asserts.assert(null!=e.length),goog.asserts.assert(null!=o),n&&(o=goog.bind(o,n)),Array.prototype.reduceRight.call(e,o,t)}:function(e,o,t,n){var r=t;return goog.array.forEachRight(e,function(t,i){r=o.call(n,r,t,i,e)}),r},goog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.some)?function(e,o,t){return goog.asserts.assert(null!=e.length),Array.prototype.some.call(e,o,t)}:function(e,o,t){for(var n=e.length,r=goog.isString(e)?e.split(""):e,i=0;n>i;i++)if(i in r&&o.call(t,r[i],i,e))return!0;return!1},goog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.every)?function(e,o,t){return goog.asserts.assert(null!=e.length),Array.prototype.every.call(e,o,t)}:function(e,o,t){for(var n=e.length,r=goog.isString(e)?e.split(""):e,i=0;n>i;i++)if(i in r&&!o.call(t,r[i],i,e))return!1;return!0},goog.array.count=function(e,o,t){var n=0;return goog.array.forEach(e,function(e,r,i){o.call(t,e,r,i)&&++n},t),n},goog.array.find=function(e,o,t){return o=goog.array.findIndex(e,o,t),0>o?null:goog.isString(e)?e.charAt(o):e[o]},goog.array.findIndex=function(e,o,t){for(var n=e.length,r=goog.isString(e)?e.split(""):e,i=0;n>i;i++)if(i in r&&o.call(t,r[i],i,e))return i;return-1},goog.array.findRight=function(e,o,t){return o=goog.array.findIndexRight(e,o,t),0>o?null:goog.isString(e)?e.charAt(o):e[o]},goog.array.findIndexRight=function(e,o,t){for(var n=e.length,r=goog.isString(e)?e.split(""):e,n=n-1;n>=0;n--)if(n in r&&o.call(t,r[n],n,e))return n;return-1},goog.array.contains=function(e,o){return 0<=goog.array.indexOf(e,o)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!goog.isArray(e))for(var o=e.length-1;o>=0;o--)delete e[o];e.length=0},goog.array.insert=function(e,o){goog.array.contains(e,o)||e.push(o)},goog.array.insertAt=function(e,o,t){goog.array.splice(e,t,0,o)},goog.array.insertArrayAt=function(e,o,t){goog.partial(goog.array.splice,e,t,0).apply(null,o)},goog.array.insertBefore=function(e,o,t){var n;2==arguments.length||0>(n=goog.array.indexOf(e,t))?e.push(o):goog.array.insertAt(e,o,n)},goog.array.remove=function(e,o){var t,n=goog.array.indexOf(e,o);return(t=n>=0)&&goog.array.removeAt(e,n),t},goog.array.removeLast=function(e,o){var t=goog.array.lastIndexOf(e,o);return t>=0?(goog.array.removeAt(e,t),!0):!1},goog.array.removeAt=function(e,o){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,o,1).length},goog.array.removeIf=function(e,o,t){return o=goog.array.findIndex(e,o,t),o>=0?(goog.array.removeAt(e,o),!0):!1},goog.array.removeAllIf=function(e,o,t){var n=0;return goog.array.forEachRight(e,function(r,i){o.call(t,r,i,e)&&goog.array.removeAt(e,i)&&n++}),n},goog.array.concat=function(e){return Array.prototype.concat.apply(Array.prototype,arguments)},goog.array.join=function(e){return Array.prototype.concat.apply(Array.prototype,arguments)},goog.array.toArray=function(e){var o=e.length;if(o>0){for(var t=Array(o),n=0;o>n;n++)t[n]=e[n];return t}return[]},goog.array.clone=goog.array.toArray,goog.array.extend=function(e,o){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(goog.isArrayLike(n)){var r=e.length||0,i=n.length||0;e.length=r+i;for(var s=0;i>s;s++)e[r+s]=n[s]}else e.push(n)}},goog.array.splice=function(e,o,t,n){return goog.asserts.assert(null!=e.length),Array.prototype.splice.apply(e,goog.array.slice(arguments,1))},goog.array.slice=function(e,o,t){return goog.asserts.assert(null!=e.length),2>=arguments.length?Array.prototype.slice.call(e,o):Array.prototype.slice.call(e,o,t)},goog.array.removeDuplicates=function(e,o,t){o=o||e;var n=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};t=t||n;for(var n={},r=0,i=0;i<e.length;){var s=e[i++],l=t(s);Object.prototype.hasOwnProperty.call(n,l)||(n[l]=!0,o[r++]=s)}o.length=r},goog.array.binarySearch=function(e,o,t){return goog.array.binarySearch_(e,t||goog.array.defaultCompare,!1,o)},goog.array.binarySelect=function(e,o,t){return goog.array.binarySearch_(e,o,!0,void 0,t)},goog.array.binarySearch_=function(e,o,t,n,r){for(var i,s=0,l=e.length;l>s;){var g,a=s+l>>1;g=t?o.call(r,e[a],a,e):o(n,e[a]),g>0?s=a+1:(l=a,i=!g)}return i?s:~s},goog.array.sort=function(e,o){e.sort(o||goog.array.defaultCompare)},goog.array.stableSort=function(e,o){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]={index:n,value:e[n]};var r=o||goog.array.defaultCompare;for(goog.array.sort(t,function(e,o){return r(e.value,o.value)||e.index-o.index}),n=0;n<e.length;n++)e[n]=t[n].value},goog.array.sortByKey=function(e,o,t){var n=t||goog.array.defaultCompare;goog.array.sort(e,function(e,t){return n(o(e),o(t))})},goog.array.sortObjectsByKey=function(e,o,t){goog.array.sortByKey(e,function(e){return e[o]},t)},goog.array.isSorted=function(e,o,t){o=o||goog.array.defaultCompare;for(var n=1;n<e.length;n++){var r=o(e[n-1],e[n]);if(r>0||0==r&&t)return!1}return!0},goog.array.equals=function(e,o,t){if(!goog.isArrayLike(e)||!goog.isArrayLike(o)||e.length!=o.length)return!1;var n=e.length;t=t||goog.array.defaultCompareEquality;for(var r=0;n>r;r++)if(!t(e[r],o[r]))return!1;return!0},goog.array.compare3=function(e,o,t){t=t||goog.array.defaultCompare;for(var n=Math.min(e.length,o.length),r=0;n>r;r++){var i=t(e[r],o[r]);if(0!=i)return i}return goog.array.defaultCompare(e.length,o.length)},goog.array.defaultCompare=function(e,o){return e>o?1:o>e?-1:0},goog.array.inverseDefaultCompare=function(e,o){return-goog.array.defaultCompare(e,o)},goog.array.defaultCompareEquality=function(e,o){return e===o},goog.array.binaryInsert=function(e,o,t){return t=goog.array.binarySearch(e,o,t),0>t?(goog.array.insertAt(e,o,-(t+1)),!0):!1},goog.array.binaryRemove=function(e,o,t){return o=goog.array.binarySearch(e,o,t),o>=0?goog.array.removeAt(e,o):!1},goog.array.bucket=function(e,o,t){for(var n={},r=0;r<e.length;r++){var i=e[r],s=o.call(t,i,r,e);goog.isDef(s)&&(n[s]||(n[s]=[])).push(i)}return n},goog.array.toObject=function(e,o,t){var n={};return goog.array.forEach(e,function(r,i){n[o.call(t,r,i,e)]=r}),n},goog.array.range=function(e,o,t){var n=[],r=0,i=e;if(t=t||1,void 0!==o&&(r=e,i=o),0>t*(i-r))return[];if(t>0)for(e=r;i>e;e+=t)n.push(e);else for(e=r;e>i;e+=t)n.push(e);return n},goog.array.repeat=function(e,o){for(var t=[],n=0;o>n;n++)t[n]=e;return t},goog.array.flatten=function(e){for(var o=[],t=0;t<arguments.length;t++){var n=arguments[t];if(goog.isArray(n))for(var r=0;r<n.length;r+=8192)for(var i=goog.array.slice(n,r,r+8192),i=goog.array.flatten.apply(null,i),s=0;s<i.length;s++)o.push(i[s]);else o.push(n)}return o},goog.array.rotate=function(e,o){return goog.asserts.assert(null!=e.length),e.length&&(o%=e.length,o>0?Array.prototype.unshift.apply(e,e.splice(-o,o)):0>o&&Array.prototype.push.apply(e,e.splice(0,-o))),e},goog.array.moveItem=function(e,o,t){goog.asserts.assert(o>=0&&o<e.length),goog.asserts.assert(t>=0&&t<e.length),o=Array.prototype.splice.call(e,o,1),Array.prototype.splice.call(e,t,0,o[0])},goog.array.zip=function(e){if(!arguments.length)return[];for(var o=[],t=arguments[0].length,n=1;n<arguments.length;n++)arguments[n].length<t&&(t=arguments[n].length);for(n=0;t>n;n++){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i][n]);o.push(r)}return o},goog.array.shuffle=function(e,o){for(var t=o||Math.random,n=e.length-1;n>0;n--){var r=Math.floor(t()*(n+1)),i=e[n];e[n]=e[r],e[r]=i}},goog.array.copyByIndex=function(e,o){var t=[];return goog.array.forEach(o,function(o){t.push(e[o])}),t},goog.array.concatMap=function(e,o,t){return goog.array.concat.apply([],goog.array.map(e,o,t))},goog.labs={},goog.labs.userAgent={},goog.labs.userAgent.util={},goog.labs.userAgent.util.getNativeUserAgentString_=function(){var e=goog.labs.userAgent.util.getNavigator_();return e&&(e=e.userAgent)?e:""},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(e){goog.labs.userAgent.util.userAgent_=e||goog.labs.userAgent.util.getNativeUserAgentString_()},goog.labs.userAgent.util.getUserAgent=function(){return goog.labs.userAgent.util.userAgent_},goog.labs.userAgent.util.matchUserAgent=function(e){var o=goog.labs.userAgent.util.getUserAgent();return goog.string.contains(o,e)},goog.labs.userAgent.util.matchUserAgentIgnoreCase=function(e){var o=goog.labs.userAgent.util.getUserAgent();return goog.string.caseInsensitiveContains(o,e)},goog.labs.userAgent.util.extractVersionTuples=function(e){for(var o,t=RegExp("(\\w[\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?","g"),n=[];o=t.exec(e);)n.push([o[1],o[2],o[3]||void 0]);return n},goog.object={},goog.object.is=function(e,o){return e===o?0!==e||1/e===1/o:e!==e&&o!==o},goog.object.forEach=function(e,o,t){for(var n in e)o.call(t,e[n],n,e)},goog.object.filter=function(e,o,t){var n,r={};for(n in e)o.call(t,e[n],n,e)&&(r[n]=e[n]);return r},goog.object.map=function(e,o,t){var n,r={};for(n in e)r[n]=o.call(t,e[n],n,e);return r},goog.object.some=function(e,o,t){for(var n in e)if(o.call(t,e[n],n,e))return!0;return!1},goog.object.every=function(e,o,t){for(var n in e)if(!o.call(t,e[n],n,e))return!1;return!0},goog.object.getCount=function(e){var o,t=0;for(o in e)t++;return t},goog.object.getAnyKey=function(e){for(var o in e)return o},goog.object.getAnyValue=function(e){for(var o in e)return e[o]},goog.object.contains=function(e,o){return goog.object.containsValue(e,o)},goog.object.getValues=function(e){var o,t=[],n=0;for(o in e)t[n++]=e[o];return t},goog.object.getKeys=function(e){var o,t=[],n=0;for(o in e)t[n++]=o;return t},goog.object.getValueByKeys=function(e,o){for(var t=goog.isArrayLike(o),n=t?o:arguments,t=t?0:1;t<n.length&&(e=e[n[t]],goog.isDef(e));t++);return e},goog.object.containsKey=function(e,o){return null!==e&&o in e},goog.object.containsValue=function(e,o){for(var t in e)if(e[t]==o)return!0;return!1},goog.object.findKey=function(e,o,t){for(var n in e)if(o.call(t,e[n],n,e))return n},goog.object.findValue=function(e,o,t){return(o=goog.object.findKey(e,o,t))&&e[o]},goog.object.isEmpty=function(e){for(var o in e)return!1;return!0},goog.object.clear=function(e){for(var o in e)delete e[o]},goog.object.remove=function(e,o){var t;return(t=o in e)&&delete e[o],t},goog.object.add=function(e,o,t){if(null!==e&&o in e)throw Error('The object already contains the key "'+o+'"');goog.object.set(e,o,t)},goog.object.get=function(e,o,t){return null!==e&&o in e?e[o]:t},goog.object.set=function(e,o,t){e[o]=t},goog.object.setIfUndefined=function(e,o,t){return o in e?e[o]:e[o]=t},goog.object.setWithReturnValueIfNotSet=function(e,o,t){return o in e?e[o]:(t=t(),e[o]=t)},goog.object.equals=function(e,o){for(var t in e)if(!(t in o)||e[t]!==o[t])return!1;for(t in o)if(!(t in e))return!1;return!0},goog.object.clone=function(e){var o,t={};for(o in e)t[o]=e[o];return t},goog.object.unsafeClone=function(e){var o=goog.typeOf(e);if("object"==o||"array"==o){if(goog.isFunction(e.clone))return e.clone();var t,o="array"==o?[]:{};for(t in e)o[t]=goog.object.unsafeClone(e[t]);return o}return e},goog.object.transpose=function(e){var o,t={};for(o in e)t[e[o]]=o;return t},goog.object.PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.object.extend=function(e,o){for(var t,n,r=1;r<arguments.length;r++){n=arguments[r];for(t in n)e[t]=n[t];for(var i=0;i<goog.object.PROTOTYPE_FIELDS_.length;i++)t=goog.object.PROTOTYPE_FIELDS_[i],Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}},goog.object.create=function(e){var o=arguments.length;if(1==o&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(o%2)throw Error("Uneven number of arguments");for(var t={},n=0;o>n;n+=2)t[arguments[n]]=arguments[n+1];return t},goog.object.createSet=function(e){var o=arguments.length;if(1==o&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var t={},n=0;o>n;n++)t[arguments[n]]=!0;return t},goog.object.createImmutableView=function(e){var o=e;return Object.isFrozen&&!Object.isFrozen(e)&&(o=Object.create(e),Object.freeze(o)),o},goog.object.isImmutableView=function(e){return!!Object.isFrozen&&Object.isFrozen(e)},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.matchEdge_=function(){return goog.labs.userAgent.util.matchUserAgent("Edge")},goog.labs.userAgent.browser.matchFirefox_=function(){return goog.labs.userAgent.util.matchUserAgent("Firefox")},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.matchEdge_()||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.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.matchEdge_()},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.matchEdge_,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 e(e){return e=goog.array.find(e,n),t[e]||""}var o=goog.labs.userAgent.util.getUserAgent();if(goog.labs.userAgent.browser.isIE())return goog.labs.userAgent.browser.getIEVersion_(o);var o=goog.labs.userAgent.util.extractVersionTuples(o),t={};goog.array.forEach(o,function(e){t[e[0]]=e[1]});var n=goog.partial(goog.object.containsKey,t);return goog.labs.userAgent.browser.isOpera()?e(["Version","Opera"]):goog.labs.userAgent.browser.isEdge()?e(["Edge"]):goog.labs.userAgent.browser.isChrome()?e(["Chrome","CriOS"]):(o=o[2])&&o[1]||""},goog.labs.userAgent.browser.isVersionOrHigher=function(e){return 0<=goog.string.compareVersions(goog.labs.userAgent.browser.getVersion(),e)},goog.labs.userAgent.browser.getIEVersion_=function(e){var o=/rv: *([\d\.]*)/.exec(e);if(o&&o[1])return o[1];var o="",t=/MSIE +([\d\.]+)/.exec(e);if(t&&t[1])if(e=/Trident\/(\d.\d)/.exec(e),"7.0"==t[1])if(e&&e[1])switch(e[1]){case"4.0":o="8.0";break;case"5.0":o="9.0";break;case"6.0":o="10.0";break;case"7.0":o="11.0"}else o="7.0";else o=t[1];return o},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 e=goog.labs.userAgent.util.getUserAgent();if(e){var e=goog.labs.userAgent.util.extractVersionTuples(e),o=goog.labs.userAgent.engine.getEngineTuple_(e);if(o)return"Gecko"==o[0]?goog.labs.userAgent.engine.getVersionForKey_(e,"Firefox"):o[1];var t,e=e[0];if(e&&(t=e[2])&&(t=/Trident\/([^\s;]+)/.exec(t)))return t[1]}return""},goog.labs.userAgent.engine.getEngineTuple_=function(e){if(!goog.labs.userAgent.engine.isEdge())return e[1];for(var o=0;o<e.length;o++){var t=e[o];if("Edge"==t[0])return t}},goog.labs.userAgent.engine.isVersionOrHigher=function(e){return 0<=goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(),e)},goog.labs.userAgent.engine.getVersionForKey_=function(e,o){var t=goog.array.find(e,function(e){return o==e[0]});return t&&t[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.getVersion=function(){var e=goog.labs.userAgent.util.getUserAgent(),o="";return goog.labs.userAgent.platform.isWindows()?(o=/Windows (?:NT|Phone) ([0-9.]+)/,o=(e=o.exec(e))?e[1]:"0.0"):goog.labs.userAgent.platform.isIos()?(o=/(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/,o=(e=o.exec(e))&&e[1].replace(/_/g,".")):goog.labs.userAgent.platform.isMacintosh()?(o=/Mac OS X ([0-9_.]+)/,o=(e=o.exec(e))?e[1].replace(/_/g,"."):"10"):goog.labs.userAgent.platform.isAndroid()?(o=/Android\s+([^\);]+)(\)|;)/,o=(e=o.exec(e))&&e[1]):goog.labs.userAgent.platform.isChromeOS()&&(o=/(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/,o=(e=o.exec(e))&&e[1]),o||""},goog.labs.userAgent.platform.isVersionOrHigher=function(e){return 0<=goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(),e)},goog.reflect={},goog.reflect.object=function(e,o){return o},goog.reflect.objectProperty=function(e,o){return e},goog.reflect.sinkValue=function(e){return goog.reflect.sinkValue[" "](e),e},goog.reflect.sinkValue[" "]=goog.nullFunction,goog.reflect.canAccessProperty=function(e,o){try{return goog.reflect.sinkValue(e[o]),!0}catch(t){}return!1},goog.reflect.cache=function(e,o,t,n){return n=n?n(o):o,Object.prototype.hasOwnProperty.call(e,n)?e[n]:e[n]=t(o)},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.getNavigator=function(){return goog.global.navigator||null},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 e=goog.userAgent.getNavigator();return e&&e.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.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 e=goog.userAgent.getNavigator();return!!e&&goog.string.contains(e.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.determineVersion_=function(){var e="",o=goog.userAgent.getVersionRegexResult_();return o&&(e=o?o[1]:""),goog.userAgent.IE&&(o=goog.userAgent.getDocumentMode_(),null!=o&&o>parseFloat(e))?String(o):e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv\:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,o){return goog.string.compareVersions(e,o)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)})},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return Number(goog.userAgent.DOCUMENT_MODE)>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){var e=goog.global.document,o=goog.userAgent.getDocumentMode_();return e&&goog.userAgent.IE?o||("CSS1Compat"==e.compatMode?parseInt(goog.userAgent.VERSION,10):5):void 0}(),goog.events={},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"),
    44HTML5_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.msMaxTouchPoints)},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 e,o=[];for(e in goog.Disposable.instances_)goog.Disposable.instances_.hasOwnProperty(e)&&o.push(goog.Disposable.instances_[Number(e)]);return o},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 e=goog.getUid(this);if(goog.Disposable.MONITORING_MODE==goog.Disposable.MonitoringMode.PERMANENT&&!goog.Disposable.instances_.hasOwnProperty(e))throw Error(this+" did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call");delete goog.Disposable.instances_[e]}},goog.Disposable.prototype.registerDisposable=function(e){this.addOnDisposeCallback(goog.partial(goog.dispose,e))},goog.Disposable.prototype.addOnDisposeCallback=function(e,o){this.disposed_?goog.isDef(o)?e.call(o):e():(this.onDisposeCallbacks_||(this.onDisposeCallbacks_=[]),this.onDisposeCallbacks_.push(goog.isDef(o)?goog.bind(e,o):e))},goog.Disposable.prototype.disposeInternal=function(){if(this.onDisposeCallbacks_)for(;this.onDisposeCallbacks_.length;)this.onDisposeCallbacks_.shift()()},goog.Disposable.isDisposed=function(e){return e&&"function"==typeof e.isDisposed?e.isDisposed():!1},goog.dispose=function(e){e&&"function"==typeof e.dispose&&e.dispose()},goog.disposeAll=function(e){for(var o=0,t=arguments.length;t>o;++o){var n=arguments[o];goog.isArrayLike(n)?goog.disposeAll.apply(null,n):goog.dispose(n)}},goog.events.EventId=function(e){this.id=e},goog.events.EventId.prototype.toString=function(){return this.id},goog.events.Event=function(e,o){this.type=e instanceof goog.events.EventId?String(e):e,this.currentTarget=this.target=o,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(e){e.stopPropagation()},goog.events.Event.preventDefault=function(e){e.preventDefault()},goog.events.getVendorPrefixedName_=function(e){return goog.userAgent.WEBKIT?"webkit"+e:goog.userAgent.OPERA?"o"+e.toLowerCase():e.toLowerCase()},goog.events.EventType={CLICK:"click",RIGHTCLICK:"rightclick",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",MOUSEENTER:"mouseenter",MOUSELEAVE:"mouseleave",SELECTIONCHANGE:"selectionchange",SELECTSTART:"selectstart",WHEEL:"wheel",KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup",BLUR:"blur",FOCUS:"focus",DEACTIVATE:"deactivate",FOCUSIN:goog.userAgent.IE?"focusin":"DOMFocusIn",FOCUSOUT:goog.userAgent.IE?"focusout":"DOMFocusOut",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",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",RATECHANGE:"ratechange",SEEKED:"seeked",SEEKING:"seeking",STALLED:"stalled",SUSPEND:"suspend",TIMEUPDATE:"timeupdate",VOLUMECHANGE:"volumechange",WAITING:"waiting",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",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:"textInput",COMPOSITIONSTART:"compositionstart",COMPOSITIONUPDATE:"compositionupdate",COMPOSITIONEND:"compositionend",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"},goog.events.BrowserEvent=function(e,o){goog.events.Event.call(this,e?e.type:""),this.relatedTarget=this.currentTarget=this.target=null,this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0,this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.platformModifierKey=!1,this.event_=null,e&&this.init(e,o)},goog.inherits(goog.events.BrowserEvent,goog.events.Event),goog.events.BrowserEvent.MouseButton={LEFT:0,MIDDLE:1,RIGHT:2},goog.events.BrowserEvent.IEButtonMap=[1,4,2],goog.events.BrowserEvent.prototype.init=function(e,o){var t=this.type=e.type,n=e.changedTouches?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.currentTarget=o;var r=e.relatedTarget;r?goog.userAgent.GECKO&&(goog.reflect.canAccessProperty(r,"nodeName")||(r=null)):t==goog.events.EventType.MOUSEOVER?r=e.fromElement:t==goog.events.EventType.MOUSEOUT&&(r=e.toElement),this.relatedTarget=r,goog.isNull(n)?(this.offsetX=goog.userAgent.WEBKIT||void 0!==e.offsetX?e.offsetX:e.layerX,this.offsetY=goog.userAgent.WEBKIT||void 0!==e.offsetY?e.offsetY:e.layerY,this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0):(this.clientX=void 0!==n.clientX?n.clientX:n.pageX,this.clientY=void 0!==n.clientY?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.screenY||0),this.button=e.button,this.keyCode=e.keyCode||0,this.charCode=e.charCode||("keypress"==t?e.keyCode:0),this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.platformModifierKey=goog.userAgent.MAC?e.metaKey:e.ctrlKey,this.state=e.state,this.event_=e,e.defaultPrevented&&this.preventDefault()},goog.events.BrowserEvent.prototype.isButton=function(e){return goog.events.BrowserFeature.HAS_W3C_BUTTON?this.event_.button==e:"click"==this.type?e==goog.events.BrowserEvent.MouseButton.LEFT:!!(this.event_.button&goog.events.BrowserEvent.IEButtonMap[e])},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 e=this.event_;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(o){}},goog.events.BrowserEvent.prototype.getBrowserEvent=function(){return this.event_},goog.events.Listenable=function(){},goog.events.Listenable.IMPLEMENTED_BY_PROP="closure_listenable_"+(1e6*Math.random()|0),goog.events.Listenable.addImplementation=function(e){e.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP]=!0},goog.events.Listenable.isImplementedBy=function(e){return!(!e||!e[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(e,o,t,n,r,i){goog.events.Listener.ENABLE_MONITORING&&(this.creationStack=Error().stack),this.listener=e,this.proxy=o,this.src=t,this.type=n,this.capture=!!r,this.handler=i,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(e){this.src=e,this.listeners={},this.typeCount_=0},goog.events.ListenerMap.prototype.getTypeCount=function(){return this.typeCount_},goog.events.ListenerMap.prototype.getListenerCount=function(){var e,o=0;for(e in this.listeners)o+=this.listeners[e].length;return o},goog.events.ListenerMap.prototype.add=function(e,o,t,n,r){var i=e.toString();e=this.listeners[i],e||(e=this.listeners[i]=[],this.typeCount_++);var s=goog.events.ListenerMap.findListenerIndex_(e,o,n,r);return s>-1?(o=e[s],t||(o.callOnce=!1)):(o=new goog.events.Listener(o,null,this.src,i,!!n,r),o.callOnce=t,e.push(o)),o},goog.events.ListenerMap.prototype.remove=function(e,o,t,n){if(e=e.toString(),!(e in this.listeners))return!1;var r=this.listeners[e];return o=goog.events.ListenerMap.findListenerIndex_(r,o,t,n),o>-1?(r[o].markAsRemoved(),goog.array.removeAt(r,o),0==r.length&&(delete this.listeners[e],this.typeCount_--),!0):!1},goog.events.ListenerMap.prototype.removeByKey=function(e){var o=e.type;if(!(o in this.listeners))return!1;var t=goog.array.remove(this.listeners[o],e);return t&&(e.markAsRemoved(),0==this.listeners[o].length&&(delete this.listeners[o],this.typeCount_--)),t},goog.events.ListenerMap.prototype.removeAll=function(e){e=e&&e.toString();var o,t=0;for(o in this.listeners)if(!e||o==e){for(var n=this.listeners[o],r=0;r<n.length;r++)++t,n[r].markAsRemoved();delete this.listeners[o],this.typeCount_--}return t},goog.events.ListenerMap.prototype.getListeners=function(e,o){var t=this.listeners[e.toString()],n=[];if(t)for(var r=0;r<t.length;++r){var i=t[r];i.capture==o&&n.push(i)}return n},goog.events.ListenerMap.prototype.getListener=function(e,o,t,n){e=this.listeners[e.toString()];var r=-1;return e&&(r=goog.events.ListenerMap.findListenerIndex_(e,o,t,n)),r>-1?e[r]:null},goog.events.ListenerMap.prototype.hasListener=function(e,o){var t=goog.isDef(e),n=t?e.toString():"",r=goog.isDef(o);return goog.object.some(this.listeners,function(e,i){for(var s=0;s<e.length;++s)if(!(t&&e[s].type!=n||r&&e[s].capture!=o))return!0;return!1})},goog.events.ListenerMap.findListenerIndex_=function(e,o,t,n){for(var r=0;r<e.length;++r){var i=e[r];if(!i.removed&&i.listener==o&&i.capture==!!t&&i.handler==n)return r}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(e,o,t,n,r){if(goog.isArray(o)){for(var i=0;i<o.length;i++)goog.events.listen(e,o[i],t,n,r);return null}return t=goog.events.wrapListener(t),goog.events.Listenable.isImplementedBy(e)?e.listen(o,t,n,r):goog.events.listen_(e,o,t,!1,n,r)},goog.events.listen_=function(e,o,t,n,r,i){if(!o)throw Error("Invalid event type");var s=!!r;if(s&&!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 l=goog.events.getListenerMap_(e);if(l||(e[goog.events.LISTENER_MAP_PROP_]=l=new goog.events.ListenerMap(e)),t=l.add(o,t,n,r,i),t.proxy)return t;if(n=goog.events.getProxy(),t.proxy=n,n.src=e,n.listener=t,e.addEventListener)e.addEventListener(o.toString(),n,s);else{if(!e.attachEvent)throw Error("addEventListener and attachEvent are unavailable.");e.attachEvent(goog.events.getOnString_(o.toString()),n)}return goog.events.listenerCountEstimate_++,t},goog.events.getProxy=function(){var e=goog.events.handleBrowserEvent_,o=goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT?function(t){return e.call(o.src,o.listener,t)}:function(t){return t=e.call(o.src,o.listener,t),t?void 0:t};return o},goog.events.listenOnce=function(e,o,t,n,r){if(goog.isArray(o)){for(var i=0;i<o.length;i++)goog.events.listenOnce(e,o[i],t,n,r);return null}return t=goog.events.wrapListener(t),goog.events.Listenable.isImplementedBy(e)?e.listenOnce(o,t,n,r):goog.events.listen_(e,o,t,!0,n,r)},goog.events.listenWithWrapper=function(e,o,t,n,r){o.listen(e,t,n,r)},goog.events.unlisten=function(e,o,t,n,r){if(goog.isArray(o)){for(var i=0;i<o.length;i++)goog.events.unlisten(e,o[i],t,n,r);return null}return t=goog.events.wrapListener(t),goog.events.Listenable.isImplementedBy(e)?e.unlisten(o,t,n,r):e?(n=!!n,(e=goog.events.getListenerMap_(e))&&(o=e.getListener(o,t,n,r))?goog.events.unlistenByKey(o):!1):!1},goog.events.unlistenByKey=function(e){if(goog.isNumber(e)||!e||e.removed)return!1;var o=e.src;if(goog.events.Listenable.isImplementedBy(o))return o.unlistenByKey(e);var t=e.type,n=e.proxy;return o.removeEventListener?o.removeEventListener(t,n,e.capture):o.detachEvent&&o.detachEvent(goog.events.getOnString_(t),n),goog.events.listenerCountEstimate_--,(t=goog.events.getListenerMap_(o))?(t.removeByKey(e),0==t.getTypeCount()&&(t.src=null,o[goog.events.LISTENER_MAP_PROP_]=null)):e.markAsRemoved(),!0},goog.events.unlistenWithWrapper=function(e,o,t,n,r){o.unlisten(e,t,n,r)},goog.events.removeAll=function(e,o){if(!e)return 0;if(goog.events.Listenable.isImplementedBy(e))return e.removeAllListeners(o);var t=goog.events.getListenerMap_(e);if(!t)return 0;var n,r=0,i=o&&o.toString();for(n in t.listeners)if(!i||n==i)for(var s=t.listeners[n].concat(),l=0;l<s.length;++l)goog.events.unlistenByKey(s[l])&&++r;return r},goog.events.getListeners=function(e,o,t){return goog.events.Listenable.isImplementedBy(e)?e.getListeners(o,t):e&&(e=goog.events.getListenerMap_(e))?e.getListeners(o,t):[]},goog.events.getListener=function(e,o,t,n,r){return t=goog.events.wrapListener(t),n=!!n,goog.events.Listenable.isImplementedBy(e)?e.getListener(o,t,n,r):e&&(e=goog.events.getListenerMap_(e))?e.getListener(o,t,n,r):null},goog.events.hasListener=function(e,o,t){return goog.events.Listenable.isImplementedBy(e)?e.hasListener(o,t):(e=goog.events.getListenerMap_(e),!!e&&e.hasListener(o,t))},goog.events.expose=function(e){var o,t=[];for(o in e)e[o]&&e[o].id?t.push(o+" = "+e[o]+" ("+e[o].id+")"):t.push(o+" = "+e[o]);return t.join("\n")},goog.events.getOnString_=function(e){return e in goog.events.onStringMap_?goog.events.onStringMap_[e]:goog.events.onStringMap_[e]=goog.events.onString_+e},goog.events.fireListeners=function(e,o,t,n){return goog.events.Listenable.isImplementedBy(e)?e.fireListeners(o,t,n):goog.events.fireListeners_(e,o,t,n)},goog.events.fireListeners_=function(e,o,t,n){var r=!0;if((e=goog.events.getListenerMap_(e))&&(o=e.listeners[o.toString()]))for(o=o.concat(),e=0;e<o.length;e++){var i=o[e];i&&i.capture==t&&!i.removed&&(i=goog.events.fireListener(i,n),r=r&&!1!==i)}return r},goog.events.fireListener=function(e,o){var t=e.listener,n=e.handler||e.src;return e.callOnce&&goog.events.unlistenByKey(e),t.call(n,o)},goog.events.getTotalListenerCount=function(){return goog.events.listenerCountEstimate_},goog.events.dispatchEvent=function(e,o){return goog.asserts.assert(goog.events.Listenable.isImplementedBy(e),"Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance."),e.dispatchEvent(o)},goog.events.protectBrowserEventEntryPoint=function(e){goog.events.handleBrowserEvent_=e.protectEntryPoint(goog.events.handleBrowserEvent_)},goog.events.handleBrowserEvent_=function(e,o){if(e.removed)return!0;if(!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT){var t=o||goog.getObjectByName("window.event"),n=new goog.events.BrowserEvent(t,this),r=!0;if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.ON){if(!goog.events.isMarkedIeEvent_(t)){goog.events.markIeEvent_(t);for(var t=[],i=n.currentTarget;i;i=i.parentNode)t.push(i);for(var i=e.type,s=t.length-1;!n.propagationStopped_&&s>=0;s--){n.currentTarget=t[s];var l=goog.events.fireListeners_(t[s],i,!0,n),r=r&&l}for(s=0;!n.propagationStopped_&&s<t.length;s++)n.currentTarget=t[s],l=goog.events.fireListeners_(t[s],i,!1,n),r=r&&l}}else r=goog.events.fireListener(e,n);return r}return goog.events.fireListener(e,new goog.events.BrowserEvent(o,this))},goog.events.markIeEvent_=function(e){var o=!1;if(0==e.keyCode)try{return void(e.keyCode=-1)}catch(t){o=!0}(o||void 0==e.returnValue)&&(e.returnValue=!0)},goog.events.isMarkedIeEvent_=function(e){return 0>e.keyCode||void 0!=e.returnValue},goog.events.uniqueIdCounter_=0,goog.events.getUniqueId=function(e){return e+"_"+goog.events.uniqueIdCounter_++},goog.events.getListenerMap_=function(e){return e=e[goog.events.LISTENER_MAP_PROP_],e instanceof goog.events.ListenerMap?e:null},goog.events.LISTENER_WRAPPER_PROP_="__closure_events_fn_"+(1e9*Math.random()>>>0),goog.events.wrapListener=function(e){return goog.asserts.assert(e,"Listener can not be null."),goog.isFunction(e)?e:(goog.asserts.assert(e.handleEvent,"An object listener must have handleEvent method."),e[goog.events.LISTENER_WRAPPER_PROP_]||(e[goog.events.LISTENER_WRAPPER_PROP_]=function(o){return e.handleEvent(o)}),e[goog.events.LISTENER_WRAPPER_PROP_])},goog.debug.entryPointRegistry.register(function(e){goog.events.handleBrowserEvent_=e(goog.events.handleBrowserEvent_)}),goog.math={},goog.math.randomInt=function(e){return Math.floor(Math.random()*e)},goog.math.uniformRandom=function(e,o){return e+Math.random()*(o-e)},goog.math.clamp=function(e,o,t){return Math.min(Math.max(e,o),t)},goog.math.modulo=function(e,o){var t=e%o;return 0>t*o?t+o:t},goog.math.lerp=function(e,o,t){return e+t*(o-e)},goog.math.nearlyEquals=function(e,o,t){return Math.abs(e-o)<=(t||1e-6)},goog.math.standardAngle=function(e){return goog.math.modulo(e,360)},goog.math.standardAngleInRadians=function(e){return goog.math.modulo(e,2*Math.PI)},goog.math.toRadians=function(e){return e*Math.PI/180},goog.math.toDegrees=function(e){return 180*e/Math.PI},goog.math.angleDx=function(e,o){return o*Math.cos(goog.math.toRadians(e))},goog.math.angleDy=function(e,o){return o*Math.sin(goog.math.toRadians(e))},goog.math.angle=function(e,o,t,n){return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(n-o,t-e)))},goog.math.angleDifference=function(e,o){var t=goog.math.standardAngle(o)-goog.math.standardAngle(e);return t>180?t-=360:-180>=t&&(t=360+t),t},goog.math.sign=function(e){return e>0?1:0>e?-1:e},goog.math.longestCommonSubsequence=function(e,o,t,n){t=t||function(e,o){return e==o},n=n||function(o,t){return e[o]};for(var r=e.length,i=o.length,s=[],l=0;r+1>l;l++)s[l]=[],s[l][0]=0;for(var g=0;i+1>g;g++)s[0][g]=0;for(l=1;r>=l;l++)for(g=1;i>=g;g++)t(e[l-1],o[g-1])?s[l][g]=s[l-1][g-1]+1:s[l][g]=Math.max(s[l-1][g],s[l][g-1]);for(var a=[],l=r,g=i;l>0&&g>0;)t(e[l-1],o[g-1])?(a.unshift(n(l-1,g-1)),l--,g--):s[l-1][g]>s[l][g-1]?l--:g--;return a},goog.math.sum=function(e){return goog.array.reduce(arguments,function(e,o){return e+o},0)},goog.math.average=function(e){return goog.math.sum.apply(null,arguments)/arguments.length},goog.math.sampleVariance=function(e){var o=arguments.length;if(2>o)return 0;var t=goog.math.average.apply(null,arguments);return goog.math.sum.apply(null,goog.array.map(arguments,function(e){return Math.pow(e-t,2)}))/(o-1)},goog.math.standardDeviation=function(e){return Math.sqrt(goog.math.sampleVariance.apply(null,arguments))},goog.math.isInt=function(e){return isFinite(e)&&0==e%1},goog.math.isFiniteNumber=function(e){return isFinite(e)&&!isNaN(e)},goog.math.isNegativeZero=function(e){return 0==e&&0>1/e},goog.math.log10Floor=function(e){if(e>0){var o=Math.round(Math.log(e)*Math.LOG10E);return o-(parseFloat("1e"+o)>e?1:0)}return 0==e?-(1/0):NaN},goog.math.safeFloor=function(e,o){return goog.asserts.assert(!goog.isDef(o)||o>0),Math.floor(e+(o||2e-15))},goog.math.safeCeil=function(e,o){return goog.asserts.assert(!goog.isDef(o)||o>0),Math.ceil(e-(o||2e-15))},goog.dom.BrowserFeature={CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9),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"),CAN_USE_INNER_TEXT:goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9"),CAN_USE_PARENT_ELEMENT_PROPERTY:goog.userAgent.IE||goog.userAgent.OPERA||goog.userAgent.WEBKIT,INNER_HTML_NEEDS_SCOPED_ELEMENT:goog.userAgent.IE,LEGACY_IE_RANGES:goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)},goog.dom.TagName=function(e){this.tagName_=e},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.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.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.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.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(e){return!0===goog.dom.tags.VOID_TAGS_[e]},goog.string.TypedString=function(){},goog.string.Const=function(){this.stringConstValueWithSecurityContract__googStringSecurityPrivate_="",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.string.Const.prototype.toString=function(){return"Const{"+this.stringConstValueWithSecurityContract__googStringSecurityPrivate_+"}"},goog.string.Const.unwrap=function(e){return e instanceof goog.string.Const&&e.constructor===goog.string.Const&&e.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_===goog.string.Const.TYPE_MARKER_?e.stringConstValueWithSecurityContract__googStringSecurityPrivate_:(goog.asserts.fail("expected object of type Const, got '"+e+"'"),"type_error:Const")},goog.string.Const.from=function(e){return goog.string.Const.create__googStringSecurityPrivate_(e)},goog.string.Const.TYPE_MARKER_={},goog.string.Const.create__googStringSecurityPrivate_=function(e){var o=new goog.string.Const;return o.stringConstValueWithSecurityContract__googStringSecurityPrivate_=e,o},goog.string.Const.EMPTY=goog.string.Const.from(""),goog.html={},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(e){
    5 return e=goog.string.Const.unwrap(e),0===e.length?goog.html.SafeStyle.EMPTY:(goog.html.SafeStyle.checkStyle_(e),goog.asserts.assert(goog.string.endsWith(e,";"),"Last character of style string is not ';': "+e),goog.asserts.assert(goog.string.contains(e,":"),"Style string must contain at least one ':', to specify a \"name: value\" pair: "+e),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e))},goog.html.SafeStyle.checkStyle_=function(e){goog.asserts.assert(!/[<>]/.test(e),"Forbidden characters in style string: "+e)},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(e){return e instanceof goog.html.SafeStyle&&e.constructor===goog.html.SafeStyle&&e.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeStyleWrappedValue_:(goog.asserts.fail("expected object of type SafeStyle, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeStyle")},goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse=function(e){return(new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(e)},goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_=e,this},goog.html.SafeStyle.EMPTY=goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(""),goog.html.SafeStyle.INNOCUOUS_STRING="zClosurez",goog.html.SafeStyle.create=function(e){var o,t="";for(o in e){if(!/^[-_a-zA-Z0-9]+$/.test(o))throw Error("Name allows only [-_a-zA-Z0-9], got: "+o);var n=e[o];null!=n&&(n instanceof goog.string.Const?(n=goog.string.Const.unwrap(n),goog.asserts.assert(!/[{;}]/.test(n),"Value does not allow [{;}].")):goog.html.SafeStyle.VALUE_RE_.test(n)?goog.html.SafeStyle.hasBalancedQuotes_(n)||(goog.asserts.fail("String value requires balanced quotes, got: "+n),n=goog.html.SafeStyle.INNOCUOUS_STRING):(goog.asserts.fail("String value allows only [-,.\"'%_!# a-zA-Z0-9], rgb() and rgba(), got: "+n),n=goog.html.SafeStyle.INNOCUOUS_STRING),t+=o+":"+n+";")}return t?(goog.html.SafeStyle.checkStyle_(t),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t)):goog.html.SafeStyle.EMPTY},goog.html.SafeStyle.hasBalancedQuotes_=function(e){for(var o=!0,t=!0,n=0;n<e.length;n++){var r=e.charAt(n);"'"==r&&t?o=!o:'"'==r&&o&&(t=!t)}return o&&t},goog.html.SafeStyle.VALUE_RE_=/^([-,."'%_!# a-zA-Z0-9]+|(?:rgb|hsl)a?\([0-9.%, ]+\))$/,goog.html.SafeStyle.concat=function(e){var o="",t=function(e){goog.isArray(e)?goog.array.forEach(e,t):o+=goog.html.SafeStyle.unwrap(e)};return goog.array.forEach(arguments,t),o?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(o):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.concat=function(e){var o="",t=function(e){goog.isArray(e)?goog.array.forEach(e,t):o+=goog.html.SafeStyleSheet.unwrap(e)};return goog.array.forEach(arguments,t),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(o)},goog.html.SafeStyleSheet.fromConstant=function(e){return e=goog.string.Const.unwrap(e),0===e.length?goog.html.SafeStyleSheet.EMPTY:(goog.asserts.assert(!goog.string.contains(e,"<"),"Forbidden '<' character in style sheet string: "+e),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e))},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(e){return e instanceof goog.html.SafeStyleSheet&&e.constructor===goog.html.SafeStyleSheet&&e.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_:(goog.asserts.fail("expected object of type SafeStyleSheet, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeStyleSheet")},goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse=function(e){return(new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(e)},goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=e,this},goog.html.SafeStyleSheet.EMPTY=goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(""),goog.fs={},goog.fs.url={},goog.fs.url.createObjectUrl=function(e){return goog.fs.url.getUrlObject_().createObjectURL(e)},goog.fs.url.revokeObjectUrl=function(e){goog.fs.url.getUrlObject_().revokeObjectURL(e)},goog.fs.url.getUrlObject_=function(){var e=goog.fs.url.findUrlObject_();if(null!=e)return e;throw Error("This browser doesn't seem to support blob URLs")},goog.fs.url.findUrlObject_=function(){return goog.isDef(goog.global.URL)&&goog.isDef(goog.global.URL.createObjectURL)?goog.global.URL:goog.isDef(goog.global.webkitURL)&&goog.isDef(goog.global.webkitURL.createObjectURL)?goog.global.webkitURL:goog.isDef(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)),goog.i18n.bidi.Format={LRE:"‪",RLE:"‫",PDF:"‬",LRM:"‎",RLM:"‏"},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(e,o){return"number"==typeof e?e>0?goog.i18n.bidi.Dir.LTR:0>e?goog.i18n.bidi.Dir.RTL:o?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-ï¿¿",goog.i18n.bidi.rtlChars_="֑-Û¯Ûº-߿‏יִ-ï·¿ï¹°-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,o){return o?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},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(e,o){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,o){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},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(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},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(e,o){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,o){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,o){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,o),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},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(e,o){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,o){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,o){var t=(void 0===o?goog.i18n.bidi.hasAnyRtl(e):o)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM;return e.replace(goog.i18n.bidi.bracketGuardTextRe_,t+"$&"+t)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n<span dir=rtl>"+e+"</span>"},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n<span dir=ltr>"+e+"</span>"},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+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(e){return e.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(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1×´").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(e,o){for(var t=0,n=0,r=!1,i=goog.i18n.bidi.stripHtmlIfNeeded_(e,o).split(goog.i18n.bidi.wordSeparatorRe_),s=0;s<i.length;s++){var l=i[s];goog.i18n.bidi.startsWithRtl(l)?(t++,n++):goog.i18n.bidi.isRequiredLtrRe_.test(l)?r=!0:goog.i18n.bidi.hasAnyLtr(l)?n++:goog.i18n.bidi.hasNumeralsRe_.test(l)&&(r=!0)}return 0==n?r?goog.i18n.bidi.Dir.LTR:goog.i18n.bidi.Dir.NEUTRAL:t/n>goog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,o){return goog.i18n.bidi.estimateDirection(e,o)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,o){e&&(o=goog.i18n.bidi.toDir(o))&&(e.style.textAlign=o==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=o==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,o){switch(goog.i18n.bidi.estimateDirection(o)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.SafeUrl=function(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_="",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.privateDoNotAccessOrElseSafeHtmlWrappedValue_},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.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeHtmlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm))$/i,goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SAFE_MIME_TYPE_PATTERN_.test(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:([^;,]*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){var o=e.match(goog.html.DATA_URL_PATTERN_),o=o&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(o[1]);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(o?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SAFE_URL_PATTERN_=/^(?:(?:https?|mailto|ftp):|[^&:\/?#]*(?:[\/?#]|$))/i,goog.html.SafeUrl.sanitize=function(e){return e instanceof goog.html.SafeUrl?e:(e=e.implementsGoogStringTypedString?e.getTypedStringValue():String(e),goog.html.SAFE_URL_PATTERN_.test(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e))},goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse=function(e){var o=new goog.html.SafeUrl;return o.privateDoNotAccessOrElseSafeHtmlWrappedValue_=e,o},goog.html.SafeUrl.ABOUT_BLANK=goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank"),goog.html.TrustedResourceUrl=function(){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_="",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_},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.format=function(e,o){var t=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(t))throw Error("Invalid TrustedResourceUrl format: "+t);var n=t.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(e,n){if(!Object.prototype.hasOwnProperty.call(o,n))throw Error('Found marker, "'+n+'", in format string, "'+t+'", but no valid label mapping found in args: '+JSON.stringify(o));var r=o[n];return r instanceof goog.string.Const?goog.string.Const.unwrap(r):encodeURIComponent(String(r))});return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(n)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.SCHEME_AND_ORIGIN_="(?:(?:https:)?//[0-9a-z.:[\\]-]+)?",goog.html.TrustedResourceUrl.BASE_ABSOLUTE_PATH_="(?:/[0-9a-z_~-]+(?:[/#?]|$))",goog.html.TrustedResourceUrl.BASE_URL_=new RegExp("^"+goog.html.TrustedResourceUrl.SCHEME_AND_ORIGIN_+goog.html.TrustedResourceUrl.BASE_ABSOLUTE_PATH_,"i"),goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var o="",t=0;t<e.length;t++)o+=goog.string.Const.unwrap(e[t]);return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(o)},goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse=function(e){var o=new goog.html.TrustedResourceUrl;return o.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=e,o},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.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_},goog.DEBUG&&(goog.html.SafeHtml.prototype.toString=function(){return"SafeHtml{"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"}),goog.html.SafeHtml.unwrap=function(e){return e instanceof goog.html.SafeHtml&&e.constructor===goog.html.SafeHtml&&e.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeHtmlWrappedValue_:(goog.asserts.fail("expected object of type SafeHtml, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeHtml")},goog.html.SafeHtml.htmlEscape=function(e){if(e instanceof goog.html.SafeHtml)return e;var o=null;return e.implementsGoogI18nBidiDirectionalString&&(o=e.getDirection()),e=e.implementsGoogStringTypedString?e.getTypedStringValue():String(e),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.htmlEscape(e),o)},goog.html.SafeHtml.htmlEscapePreservingNewlines=function(e){return e instanceof goog.html.SafeHtml?e:(e=goog.html.SafeHtml.htmlEscape(e),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.newLineToBr(goog.html.SafeHtml.unwrap(e)),e.getDirection()))},goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces=function(e){return e instanceof goog.html.SafeHtml?e:(e=goog.html.SafeHtml.htmlEscape(e),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.whitespaceEscape(goog.html.SafeHtml.unwrap(e)),e.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(e,o,t){return goog.html.SafeHtml.verifyTagName(String(e)),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(e),o,t)},goog.html.SafeHtml.verifyTagName=function(e){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(e))throw Error("Invalid tag name <"+e+">.");if(e.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error("Tag name <"+e+"> is not allowed for SafeHtml.")},goog.html.SafeHtml.createIframe=function(e,o,t,n){e&&goog.html.TrustedResourceUrl.unwrap(e);var r={};return r.src=e||null,r.srcdoc=o&&goog.html.SafeHtml.unwrap(o),e=goog.html.SafeHtml.combineAttributes(r,{sandbox:""},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,n)},goog.html.SafeHtml.createSandboxIframe=function(e,o,t,n){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error("The browser does not support sandboxed iframes.");var r={};return r.src=e?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e)):null,r.srcdoc=o||null,r.sandbox="",e=goog.html.SafeHtml.combineAttributes(r,{},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,n)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,o){goog.html.TrustedResourceUrl.unwrap(e);var t=goog.html.SafeHtml.combineAttributes({src:e},{},o);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",t)},goog.html.SafeHtml.createStyle=function(e,o){var t=goog.html.SafeHtml.combineAttributes({type:"text/css"},{},o),n="";e=goog.array.concat(e);for(var r=0;r<e.length;r++)n+=goog.html.SafeStyleSheet.unwrap(e[r]);return n=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n,goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style",t,n)},goog.html.SafeHtml.createMetaRefresh=function(e,o){var t=goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e));return(goog.labs.userAgent.browser.isIE()||goog.labs.userAgent.browser.isEdge())&&goog.string.contains(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta",{"http-equiv":"refresh",content:(o||0)+"; url="+t})},goog.html.SafeHtml.getAttrNameAndValue_=function(e,o,t){if(t instanceof goog.string.Const)t=goog.string.Const.unwrap(t);else if("style"==o.toLowerCase())t=goog.html.SafeHtml.getStyleValue_(t);else{if(/^on/i.test(o))throw Error('Attribute "'+o+'" requires goog.string.Const value, "'+t+'" given.');if(o.toLowerCase()in goog.html.SafeHtml.URL_ATTRIBUTES_)if(t instanceof goog.html.TrustedResourceUrl)t=goog.html.TrustedResourceUrl.unwrap(t);else if(t instanceof goog.html.SafeUrl)t=goog.html.SafeUrl.unwrap(t);else{if(!goog.isString(t))throw Error('Attribute "'+o+'" on tag "'+e+'" requires goog.html.SafeUrl, goog.string.Const, or string, value "'+t+'" given.');t=goog.html.SafeUrl.sanitize(t).getTypedStringValue()}}return t.implementsGoogStringTypedString&&(t=t.getTypedStringValue()),goog.asserts.assert(goog.isString(t)||goog.isNumber(t),"String or number value expected, got "+typeof t+" with value: "+t),o+'="'+goog.string.htmlEscape(String(t))+'"'},goog.html.SafeHtml.getStyleValue_=function(e){if(!goog.isObject(e))throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, '+typeof e+" given: "+e);return e instanceof goog.html.SafeStyle||(e=goog.html.SafeStyle.create(e)),goog.html.SafeStyle.unwrap(e)},goog.html.SafeHtml.createWithDir=function(e,o,t,n){return o=goog.html.SafeHtml.create(o,t,n),o.dir_=e,o},goog.html.SafeHtml.concat=function(e){var o=goog.i18n.bidi.Dir.NEUTRAL,t="",n=function(e){goog.isArray(e)?goog.array.forEach(e,n):(e=goog.html.SafeHtml.htmlEscape(e),t+=goog.html.SafeHtml.unwrap(e),e=e.getDirection(),o==goog.i18n.bidi.Dir.NEUTRAL?o=e:e!=goog.i18n.bidi.Dir.NEUTRAL&&o!=e&&(o=null))};return goog.array.forEach(arguments,n),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,o)},goog.html.SafeHtml.concatWithDir=function(e,o){var t=goog.html.SafeHtml.concat(goog.array.slice(arguments,1));return t.dir_=e,t},goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse=function(e,o){return(new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(e,o)},goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e,o){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=e,this.dir_=o,this},goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse=function(e,o,t){var n,r=null;return n="<"+e+goog.html.SafeHtml.stringifyAttributes(e,o),goog.isDefAndNotNull(t)?goog.isArray(t)||(t=[t]):t=[],goog.dom.tags.isVoidTag(e.toLowerCase())?(goog.asserts.assert(!t.length,"Void tag <"+e+"> does not allow content."),n+=">"):(r=goog.html.SafeHtml.concat(t),n+=">"+goog.html.SafeHtml.unwrap(r)+"</"+e+">",r=r.getDirection()),(e=o&&o.dir)&&(r=/^(ltr|rtl|auto)$/i.test(e)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n,r)},goog.html.SafeHtml.stringifyAttributes=function(e,o){var t="";if(o)for(var n in o){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(n))throw Error('Invalid attribute name "'+n+'".');var r=o[n];goog.isDefAndNotNull(r)&&(t+=" "+goog.html.SafeHtml.getAttrNameAndValue_(e,n,r))}return t},goog.html.SafeHtml.combineAttributes=function(e,o,t){var n,r={};for(n in e)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),r[n]=e[n];for(n in o)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),r[n]=o[n];for(n in t){var i=n.toLowerCase();if(i in e)throw Error('Cannot override "'+i+'" attribute, got "'+n+'" with value "'+t[n]+'"');i in o&&delete r[i],r[n]=t[n]}return r},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.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(e,o,t){e.insertAdjacentHTML(o,goog.html.SafeHtml.unwrap(t))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.setInnerHtml=function(e,o){if(goog.asserts.ENABLE_ASSERTS){var t=e.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[t])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+e.tagName+".")}e.innerHTML=goog.html.SafeHtml.unwrap(o)},goog.dom.safe.setOuterHtml=function(e,o){e.outerHTML=goog.html.SafeHtml.unwrap(o)},goog.dom.safe.setStyle=function(e,o){e.style.cssText=goog.html.SafeStyle.unwrap(o)},goog.dom.safe.documentWrite=function(e,o){e.write(goog.html.SafeHtml.unwrap(o))},goog.dom.safe.setAnchorHref=function(e,o){goog.dom.safe.assertIsHTMLAnchorElement_(e);var t;t=o instanceof goog.html.SafeUrl?o:goog.html.SafeUrl.sanitize(o),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setImageSrc=function(e,o){goog.dom.safe.assertIsHTMLImageElement_(e);var t;t=o instanceof goog.html.SafeUrl?o:goog.html.SafeUrl.sanitize(o),e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setEmbedSrc=function(e,o){goog.dom.safe.assertIsHTMLEmbedElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setFrameSrc=function(e,o){goog.dom.safe.assertIsHTMLFrameElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setIframeSrc=function(e,o){goog.dom.safe.assertIsHTMLIFrameElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setLinkHrefAndRel=function(e,o,t){goog.dom.safe.assertIsHTMLLinkElement_(e),e.rel=t,goog.string.caseInsensitiveContains(t,"stylesheet")?(goog.asserts.assert(o instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),e.href=goog.html.TrustedResourceUrl.unwrap(o)):e.href=o instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(o):o instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(o):goog.html.SafeUrl.sanitize(o).getTypedStringValue()},goog.dom.safe.setObjectData=function(e,o){goog.dom.safe.assertIsHTMLObjectElement_(e),e.data=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setScriptSrc=function(e,o){goog.dom.safe.assertIsHTMLScriptElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setLocationHref=function(e,o){goog.dom.safe.assertIsLocation_(e);var t;t=o instanceof goog.html.SafeUrl?o:goog.html.SafeUrl.sanitize(o),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.openInWindow=function(e,o,t,n,r){return e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitize(e),(o||window).open(goog.html.SafeUrl.unwrap(e),t?goog.string.Const.unwrap(t):"",n,r)},goog.dom.safe.assertIsLocation_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof Location&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof Location||!(e instanceof Element)),"Argument is not a Location (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLAnchorElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLAnchorElement&&"undefined"!=typeof Location&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLAnchorElement||!(e instanceof Location||e instanceof Element)),"Argument is not a HTMLAnchorElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLLinkElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLLinkElement&&"undefined"!=typeof Location&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLLinkElement||!(e instanceof Location||e instanceof Element)),"Argument is not a HTMLLinkElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLImageElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLImageElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLImageElement||!(e instanceof Element)),"Argument is not a HTMLImageElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLEmbedElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLEmbedElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLEmbedElement||!(e instanceof Element)),"Argument is not a HTMLEmbedElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLFrameElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLFrameElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLFrameElement||!(e instanceof Element)),"Argument is not a HTMLFrameElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLIFrameElement_=function(e){
     5return e=goog.string.Const.unwrap(e),0===e.length?goog.html.SafeStyle.EMPTY:(goog.html.SafeStyle.checkStyle_(e),goog.asserts.assert(goog.string.endsWith(e,";"),"Last character of style string is not ';': "+e),goog.asserts.assert(goog.string.contains(e,":"),"Style string must contain at least one ':', to specify a \"name: value\" pair: "+e),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e))},goog.html.SafeStyle.checkStyle_=function(e){goog.asserts.assert(!/[<>]/.test(e),"Forbidden characters in style string: "+e)},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(e){return e instanceof goog.html.SafeStyle&&e.constructor===goog.html.SafeStyle&&e.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeStyleWrappedValue_:(goog.asserts.fail("expected object of type SafeStyle, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeStyle")},goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse=function(e){return(new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(e)},goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_=e,this},goog.html.SafeStyle.EMPTY=goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(""),goog.html.SafeStyle.INNOCUOUS_STRING="zClosurez",goog.html.SafeStyle.create=function(e){var o,t="";for(o in e){if(!/^[-_a-zA-Z0-9]+$/.test(o))throw Error("Name allows only [-_a-zA-Z0-9], got: "+o);var n=e[o];null!=n&&(n instanceof goog.string.Const?(n=goog.string.Const.unwrap(n),goog.asserts.assert(!/[{;}]/.test(n),"Value does not allow [{;}].")):goog.html.SafeStyle.VALUE_RE_.test(n)?goog.html.SafeStyle.hasBalancedQuotes_(n)||(goog.asserts.fail("String value requires balanced quotes, got: "+n),n=goog.html.SafeStyle.INNOCUOUS_STRING):(goog.asserts.fail("String value allows only [-,.\"'%_!# a-zA-Z0-9], rgb() and rgba(), got: "+n),n=goog.html.SafeStyle.INNOCUOUS_STRING),t+=o+":"+n+";")}return t?(goog.html.SafeStyle.checkStyle_(t),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(t)):goog.html.SafeStyle.EMPTY},goog.html.SafeStyle.hasBalancedQuotes_=function(e){for(var o=!0,t=!0,n=0;n<e.length;n++){var r=e.charAt(n);"'"==r&&t?o=!o:'"'==r&&o&&(t=!t)}return o&&t},goog.html.SafeStyle.VALUE_RE_=/^([-,."'%_!# a-zA-Z0-9]+|(?:rgb|hsl)a?\([0-9.%, ]+\))$/,goog.html.SafeStyle.concat=function(e){var o="",t=function(e){goog.isArray(e)?goog.array.forEach(e,t):o+=goog.html.SafeStyle.unwrap(e)};return goog.array.forEach(arguments,t),o?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(o):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.concat=function(e){var o="",t=function(e){goog.isArray(e)?goog.array.forEach(e,t):o+=goog.html.SafeStyleSheet.unwrap(e)};return goog.array.forEach(arguments,t),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(o)},goog.html.SafeStyleSheet.fromConstant=function(e){return e=goog.string.Const.unwrap(e),0===e.length?goog.html.SafeStyleSheet.EMPTY:(goog.asserts.assert(!goog.string.contains(e,"<"),"Forbidden '<' character in style sheet string: "+e),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e))},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(e){return e instanceof goog.html.SafeStyleSheet&&e.constructor===goog.html.SafeStyleSheet&&e.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_:(goog.asserts.fail("expected object of type SafeStyleSheet, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeStyleSheet")},goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse=function(e){return(new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(e)},goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=e,this},goog.html.SafeStyleSheet.EMPTY=goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(""),goog.fs={},goog.fs.url={},goog.fs.url.createObjectUrl=function(e){return goog.fs.url.getUrlObject_().createObjectURL(e)},goog.fs.url.revokeObjectUrl=function(e){goog.fs.url.getUrlObject_().revokeObjectURL(e)},goog.fs.url.getUrlObject_=function(){var e=goog.fs.url.findUrlObject_();if(null!=e)return e;throw Error("This browser doesn't seem to support blob URLs")},goog.fs.url.findUrlObject_=function(){return goog.isDef(goog.global.URL)&&goog.isDef(goog.global.URL.createObjectURL)?goog.global.URL:goog.isDef(goog.global.webkitURL)&&goog.isDef(goog.global.webkitURL.createObjectURL)?goog.global.webkitURL:goog.isDef(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)),goog.i18n.bidi.Format={LRE:"‪",RLE:"‫",PDF:"‬",LRM:"‎",RLM:"‏"},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(e,o){return"number"==typeof e?e>0?goog.i18n.bidi.Dir.LTR:0>e?goog.i18n.bidi.Dir.RTL:o?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",goog.i18n.bidi.rtlChars_="֑-ۯۺ-߿‏יִ-﷿ﹰ-ﻼ",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,o){return o?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},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(e,o){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,o){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},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(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},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(e,o){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,o){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,o){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,o),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},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(e,o){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,o){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,o))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,o){var t=(void 0===o?goog.i18n.bidi.hasAnyRtl(e):o)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM;return e.replace(goog.i18n.bidi.bracketGuardTextRe_,t+"$&"+t)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n<span dir=rtl>"+e+"</span>"},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n<span dir=ltr>"+e+"</span>"},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+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(e){return e.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(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1״").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1׳")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(e,o){for(var t=0,n=0,r=!1,i=goog.i18n.bidi.stripHtmlIfNeeded_(e,o).split(goog.i18n.bidi.wordSeparatorRe_),s=0;s<i.length;s++){var l=i[s];goog.i18n.bidi.startsWithRtl(l)?(t++,n++):goog.i18n.bidi.isRequiredLtrRe_.test(l)?r=!0:goog.i18n.bidi.hasAnyLtr(l)?n++:goog.i18n.bidi.hasNumeralsRe_.test(l)&&(r=!0)}return 0==n?r?goog.i18n.bidi.Dir.LTR:goog.i18n.bidi.Dir.NEUTRAL:t/n>goog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,o){return goog.i18n.bidi.estimateDirection(e,o)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,o){e&&(o=goog.i18n.bidi.toDir(o))&&(e.style.textAlign=o==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=o==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,o){switch(goog.i18n.bidi.estimateDirection(o)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir")}},goog.i18n.bidi.DirectionalString=function(){},goog.html.SafeUrl=function(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_="",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.privateDoNotAccessOrElseSafeHtmlWrappedValue_},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.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeHtmlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm))$/i,goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SAFE_MIME_TYPE_PATTERN_.test(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:([^;,]*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){var o=e.match(goog.html.DATA_URL_PATTERN_),o=o&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(o[1]);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(o?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SAFE_URL_PATTERN_=/^(?:(?:https?|mailto|ftp):|[^&:\/?#]*(?:[\/?#]|$))/i,goog.html.SafeUrl.sanitize=function(e){return e instanceof goog.html.SafeUrl?e:(e=e.implementsGoogStringTypedString?e.getTypedStringValue():String(e),goog.html.SAFE_URL_PATTERN_.test(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e))},goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse=function(e){var o=new goog.html.SafeUrl;return o.privateDoNotAccessOrElseSafeHtmlWrappedValue_=e,o},goog.html.SafeUrl.ABOUT_BLANK=goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank"),goog.html.TrustedResourceUrl=function(){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_="",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_},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.format=function(e,o){var t=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(t))throw Error("Invalid TrustedResourceUrl format: "+t);var n=t.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(e,n){if(!Object.prototype.hasOwnProperty.call(o,n))throw Error('Found marker, "'+n+'", in format string, "'+t+'", but no valid label mapping found in args: '+JSON.stringify(o));var r=o[n];return r instanceof goog.string.Const?goog.string.Const.unwrap(r):encodeURIComponent(String(r))});return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(n)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.SCHEME_AND_ORIGIN_="(?:(?:https:)?//[0-9a-z.:[\\]-]+)?",goog.html.TrustedResourceUrl.BASE_ABSOLUTE_PATH_="(?:/[0-9a-z_~-]+(?:[/#?]|$))",goog.html.TrustedResourceUrl.BASE_URL_=new RegExp("^"+goog.html.TrustedResourceUrl.SCHEME_AND_ORIGIN_+goog.html.TrustedResourceUrl.BASE_ABSOLUTE_PATH_,"i"),goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var o="",t=0;t<e.length;t++)o+=goog.string.Const.unwrap(e[t]);return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(o)},goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse=function(e){var o=new goog.html.TrustedResourceUrl;return o.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=e,o},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.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_},goog.DEBUG&&(goog.html.SafeHtml.prototype.toString=function(){return"SafeHtml{"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+"}"}),goog.html.SafeHtml.unwrap=function(e){return e instanceof goog.html.SafeHtml&&e.constructor===goog.html.SafeHtml&&e.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeHtmlWrappedValue_:(goog.asserts.fail("expected object of type SafeHtml, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeHtml")},goog.html.SafeHtml.htmlEscape=function(e){if(e instanceof goog.html.SafeHtml)return e;var o=null;return e.implementsGoogI18nBidiDirectionalString&&(o=e.getDirection()),e=e.implementsGoogStringTypedString?e.getTypedStringValue():String(e),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.htmlEscape(e),o)},goog.html.SafeHtml.htmlEscapePreservingNewlines=function(e){return e instanceof goog.html.SafeHtml?e:(e=goog.html.SafeHtml.htmlEscape(e),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.newLineToBr(goog.html.SafeHtml.unwrap(e)),e.getDirection()))},goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces=function(e){return e instanceof goog.html.SafeHtml?e:(e=goog.html.SafeHtml.htmlEscape(e),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.whitespaceEscape(goog.html.SafeHtml.unwrap(e)),e.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(e,o,t){return goog.html.SafeHtml.verifyTagName(String(e)),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(e),o,t)},goog.html.SafeHtml.verifyTagName=function(e){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(e))throw Error("Invalid tag name <"+e+">.");if(e.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error("Tag name <"+e+"> is not allowed for SafeHtml.")},goog.html.SafeHtml.createIframe=function(e,o,t,n){e&&goog.html.TrustedResourceUrl.unwrap(e);var r={};return r.src=e||null,r.srcdoc=o&&goog.html.SafeHtml.unwrap(o),e=goog.html.SafeHtml.combineAttributes(r,{sandbox:""},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,n)},goog.html.SafeHtml.createSandboxIframe=function(e,o,t,n){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error("The browser does not support sandboxed iframes.");var r={};return r.src=e?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e)):null,r.srcdoc=o||null,r.sandbox="",e=goog.html.SafeHtml.combineAttributes(r,{},t),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",e,n)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,o){goog.html.TrustedResourceUrl.unwrap(e);var t=goog.html.SafeHtml.combineAttributes({src:e},{},o);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",t)},goog.html.SafeHtml.createStyle=function(e,o){var t=goog.html.SafeHtml.combineAttributes({type:"text/css"},{},o),n="";e=goog.array.concat(e);for(var r=0;r<e.length;r++)n+=goog.html.SafeStyleSheet.unwrap(e[r]);return n=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n,goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style",t,n)},goog.html.SafeHtml.createMetaRefresh=function(e,o){var t=goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(e));return(goog.labs.userAgent.browser.isIE()||goog.labs.userAgent.browser.isEdge())&&goog.string.contains(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta",{"http-equiv":"refresh",content:(o||0)+"; url="+t})},goog.html.SafeHtml.getAttrNameAndValue_=function(e,o,t){if(t instanceof goog.string.Const)t=goog.string.Const.unwrap(t);else if("style"==o.toLowerCase())t=goog.html.SafeHtml.getStyleValue_(t);else{if(/^on/i.test(o))throw Error('Attribute "'+o+'" requires goog.string.Const value, "'+t+'" given.');if(o.toLowerCase()in goog.html.SafeHtml.URL_ATTRIBUTES_)if(t instanceof goog.html.TrustedResourceUrl)t=goog.html.TrustedResourceUrl.unwrap(t);else if(t instanceof goog.html.SafeUrl)t=goog.html.SafeUrl.unwrap(t);else{if(!goog.isString(t))throw Error('Attribute "'+o+'" on tag "'+e+'" requires goog.html.SafeUrl, goog.string.Const, or string, value "'+t+'" given.');t=goog.html.SafeUrl.sanitize(t).getTypedStringValue()}}return t.implementsGoogStringTypedString&&(t=t.getTypedStringValue()),goog.asserts.assert(goog.isString(t)||goog.isNumber(t),"String or number value expected, got "+typeof t+" with value: "+t),o+'="'+goog.string.htmlEscape(String(t))+'"'},goog.html.SafeHtml.getStyleValue_=function(e){if(!goog.isObject(e))throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, '+typeof e+" given: "+e);return e instanceof goog.html.SafeStyle||(e=goog.html.SafeStyle.create(e)),goog.html.SafeStyle.unwrap(e)},goog.html.SafeHtml.createWithDir=function(e,o,t,n){return o=goog.html.SafeHtml.create(o,t,n),o.dir_=e,o},goog.html.SafeHtml.concat=function(e){var o=goog.i18n.bidi.Dir.NEUTRAL,t="",n=function(e){goog.isArray(e)?goog.array.forEach(e,n):(e=goog.html.SafeHtml.htmlEscape(e),t+=goog.html.SafeHtml.unwrap(e),e=e.getDirection(),o==goog.i18n.bidi.Dir.NEUTRAL?o=e:e!=goog.i18n.bidi.Dir.NEUTRAL&&o!=e&&(o=null))};return goog.array.forEach(arguments,n),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,o)},goog.html.SafeHtml.concatWithDir=function(e,o){var t=goog.html.SafeHtml.concat(goog.array.slice(arguments,1));return t.dir_=e,t},goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={},goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse=function(e,o){return(new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(e,o)},goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e,o){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=e,this.dir_=o,this},goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse=function(e,o,t){var n,r=null;return n="<"+e+goog.html.SafeHtml.stringifyAttributes(e,o),goog.isDefAndNotNull(t)?goog.isArray(t)||(t=[t]):t=[],goog.dom.tags.isVoidTag(e.toLowerCase())?(goog.asserts.assert(!t.length,"Void tag <"+e+"> does not allow content."),n+=">"):(r=goog.html.SafeHtml.concat(t),n+=">"+goog.html.SafeHtml.unwrap(r)+"</"+e+">",r=r.getDirection()),(e=o&&o.dir)&&(r=/^(ltr|rtl|auto)$/i.test(e)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n,r)},goog.html.SafeHtml.stringifyAttributes=function(e,o){var t="";if(o)for(var n in o){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(n))throw Error('Invalid attribute name "'+n+'".');var r=o[n];goog.isDefAndNotNull(r)&&(t+=" "+goog.html.SafeHtml.getAttrNameAndValue_(e,n,r))}return t},goog.html.SafeHtml.combineAttributes=function(e,o,t){var n,r={};for(n in e)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),r[n]=e[n];for(n in o)goog.asserts.assert(n.toLowerCase()==n,"Must be lower case"),r[n]=o[n];for(n in t){var i=n.toLowerCase();if(i in e)throw Error('Cannot override "'+i+'" attribute, got "'+n+'" with value "'+t[n]+'"');i in o&&delete r[i],r[n]=t[n]}return r},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.dom.safe={},goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"},goog.dom.safe.insertAdjacentHtml=function(e,o,t){e.insertAdjacentHTML(o,goog.html.SafeHtml.unwrap(t))},goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0},goog.dom.safe.setInnerHtml=function(e,o){if(goog.asserts.ENABLE_ASSERTS){var t=e.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[t])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+e.tagName+".")}e.innerHTML=goog.html.SafeHtml.unwrap(o)},goog.dom.safe.setOuterHtml=function(e,o){e.outerHTML=goog.html.SafeHtml.unwrap(o)},goog.dom.safe.setStyle=function(e,o){e.style.cssText=goog.html.SafeStyle.unwrap(o)},goog.dom.safe.documentWrite=function(e,o){e.write(goog.html.SafeHtml.unwrap(o))},goog.dom.safe.setAnchorHref=function(e,o){goog.dom.safe.assertIsHTMLAnchorElement_(e);var t;t=o instanceof goog.html.SafeUrl?o:goog.html.SafeUrl.sanitize(o),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setImageSrc=function(e,o){goog.dom.safe.assertIsHTMLImageElement_(e);var t;t=o instanceof goog.html.SafeUrl?o:goog.html.SafeUrl.sanitize(o),e.src=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.setEmbedSrc=function(e,o){goog.dom.safe.assertIsHTMLEmbedElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setFrameSrc=function(e,o){goog.dom.safe.assertIsHTMLFrameElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setIframeSrc=function(e,o){goog.dom.safe.assertIsHTMLIFrameElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setLinkHrefAndRel=function(e,o,t){goog.dom.safe.assertIsHTMLLinkElement_(e),e.rel=t,goog.string.caseInsensitiveContains(t,"stylesheet")?(goog.asserts.assert(o instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),e.href=goog.html.TrustedResourceUrl.unwrap(o)):e.href=o instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(o):o instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(o):goog.html.SafeUrl.sanitize(o).getTypedStringValue()},goog.dom.safe.setObjectData=function(e,o){goog.dom.safe.assertIsHTMLObjectElement_(e),e.data=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setScriptSrc=function(e,o){goog.dom.safe.assertIsHTMLScriptElement_(e),e.src=goog.html.TrustedResourceUrl.unwrap(o)},goog.dom.safe.setLocationHref=function(e,o){goog.dom.safe.assertIsLocation_(e);var t;t=o instanceof goog.html.SafeUrl?o:goog.html.SafeUrl.sanitize(o),e.href=goog.html.SafeUrl.unwrap(t)},goog.dom.safe.openInWindow=function(e,o,t,n,r){return e=e instanceof goog.html.SafeUrl?e:goog.html.SafeUrl.sanitize(e),(o||window).open(goog.html.SafeUrl.unwrap(e),t?goog.string.Const.unwrap(t):"",n,r)},goog.dom.safe.assertIsLocation_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof Location&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof Location||!(e instanceof Element)),"Argument is not a Location (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLAnchorElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLAnchorElement&&"undefined"!=typeof Location&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLAnchorElement||!(e instanceof Location||e instanceof Element)),"Argument is not a HTMLAnchorElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLLinkElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLLinkElement&&"undefined"!=typeof Location&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLLinkElement||!(e instanceof Location||e instanceof Element)),"Argument is not a HTMLLinkElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLImageElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLImageElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLImageElement||!(e instanceof Element)),"Argument is not a HTMLImageElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLEmbedElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLEmbedElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLEmbedElement||!(e instanceof Element)),"Argument is not a HTMLEmbedElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLFrameElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLFrameElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLFrameElement||!(e instanceof Element)),"Argument is not a HTMLFrameElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLIFrameElement_=function(e){
    66return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLIFrameElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLIFrameElement||!(e instanceof Element)),"Argument is not a HTMLIFrameElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLObjectElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLObjectElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLObjectElement||!(e instanceof Element)),"Argument is not a HTMLObjectElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.assertIsHTMLScriptElement_=function(e){return goog.asserts.ENABLE_ASSERTS&&"undefined"!=typeof HTMLScriptElement&&"undefined"!=typeof Element&&goog.asserts.assert(e&&(e instanceof HTMLScriptElement||!(e instanceof Element)),"Argument is not a HTMLScriptElement (or a non-Element mock); got: %s",goog.dom.safe.debugStringForType_(e)),e},goog.dom.safe.debugStringForType_=function(e){return goog.isObject(e)?e.constructor.displayName||e.constructor.name||Object.prototype.toString.call(e):void 0===e?"undefined":null===e?"null":typeof e},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(e){return e=goog.string.Const.unwrap(e),0===e.length?goog.html.SafeScript.EMPTY:goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeScript.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_},goog.DEBUG&&(goog.html.SafeScript.prototype.toString=function(){return"SafeScript{"+this.privateDoNotAccessOrElseSafeScriptWrappedValue_+"}"}),goog.html.SafeScript.unwrap=function(e){return e instanceof goog.html.SafeScript&&e.constructor===goog.html.SafeScript&&e.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeScriptWrappedValue_:(goog.asserts.fail("expected object of type SafeScript, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeScript")},goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse=function(e){return(new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(e)},goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_=function(e){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_=e,this},goog.html.SafeScript.EMPTY=goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(""),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(e,o,t){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(o,t||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(e,o){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.isEmpty(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(o)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(e,o){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(o)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(e,o){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(o)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(e,o){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(o)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(e,o){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(o)},goog.math.Coordinate=function(e,o){this.x=goog.isDef(e)?e:0,this.y=goog.isDef(o)?o: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(e){return e instanceof goog.math.Coordinate&&goog.math.Coordinate.equals(this,e)},goog.math.Coordinate.equals=function(e,o){return e==o?!0:e&&o?e.x==o.x&&e.y==o.y:!1},goog.math.Coordinate.distance=function(e,o){var t=e.x-o.x,n=e.y-o.y;return Math.sqrt(t*t+n*n)},goog.math.Coordinate.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},goog.math.Coordinate.azimuth=function(e){return goog.math.angle(0,0,e.x,e.y)},goog.math.Coordinate.squaredDistance=function(e,o){var t=e.x-o.x,n=e.y-o.y;return t*t+n*n},goog.math.Coordinate.difference=function(e,o){return new goog.math.Coordinate(e.x-o.x,e.y-o.y)},goog.math.Coordinate.sum=function(e,o){return new goog.math.Coordinate(e.x+o.x,e.y+o.y)},goog.math.Coordinate.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},goog.math.Coordinate.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},goog.math.Coordinate.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},goog.math.Coordinate.prototype.translate=function(e,o){return e instanceof goog.math.Coordinate?(this.x+=e.x,this.y+=e.y):(this.x+=Number(e),goog.isNumber(o)&&(this.y+=o)),this},goog.math.Coordinate.prototype.scale=function(e,o){var t=goog.isNumber(o)?o:e;return this.x*=e,this.y*=t,this},goog.math.Coordinate.prototype.rotateRadians=function(e,o){var t=o||new goog.math.Coordinate(0,0),n=this.x,r=this.y,i=Math.cos(e),s=Math.sin(e);this.x=(n-t.x)*i-(r-t.y)*s+t.x,this.y=(n-t.x)*s+(r-t.y)*i+t.y},goog.math.Coordinate.prototype.rotateDegrees=function(e,o){this.rotateRadians(goog.math.toRadians(e),o)},goog.math.Size=function(e,o){this.width=e,this.height=o},goog.math.Size.equals=function(e,o){return e==o?!0:e&&o?e.width==o.width&&e.height==o.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(){return this.width=Math.ceil(this.width),this.height=Math.ceil(this.height),this},goog.math.Size.prototype.fitsInside=function(e){return this.width<=e.width&&this.height<=e.height},goog.math.Size.prototype.floor=function(){return this.width=Math.floor(this.width),this.height=Math.floor(this.height),this},goog.math.Size.prototype.round=function(){return this.width=Math.round(this.width),this.height=Math.round(this.height),this},goog.math.Size.prototype.scale=function(e,o){var t=goog.isNumber(o)?o:e;return this.width*=e,this.height*=t,this},goog.math.Size.prototype.scaleToCover=function(e){return e=this.aspectRatio()<=e.aspectRatio()?e.width/this.width:e.height/this.height,this.scale(e)},goog.math.Size.prototype.scaleToFit=function(e){return e=this.aspectRatio()>e.aspectRatio()?e.width/this.width:e.height/this.height,this.scale(e)},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(e){return e?new goog.dom.DomHelper(goog.dom.getOwnerDocument(e)):goog.dom.defaultDomHelper_||(goog.dom.defaultDomHelper_=new goog.dom.DomHelper)},goog.dom.getDocument=function(){return document},goog.dom.getElement=function(e){return goog.dom.getElementHelper_(document,e)},goog.dom.getElementHelper_=function(e,o){return goog.isString(o)?e.getElementById(o):o},goog.dom.getRequiredElement=function(e){return goog.dom.getRequiredElementHelper_(document,e)},goog.dom.getRequiredElementHelper_=function(e,o){goog.asserts.assertString(o);var t=goog.dom.getElementHelper_(e,o);return t=goog.asserts.assertElement(t,"No element found with id: "+o)},goog.dom.$=goog.dom.getElement,goog.dom.getElementsByTagName=function(e,o){return(o||document).getElementsByTagName(String(e))},goog.dom.getElementsByTagNameAndClass=function(e,o,t){return goog.dom.getElementsByTagNameAndClass_(document,e,o,t)},goog.dom.getElementsByClass=function(e,o){var t=o||document;return goog.dom.canUseQuerySelector_(t)?t.querySelectorAll("."+e):goog.dom.getElementsByTagNameAndClass_(document,"*",e,o)},goog.dom.getElementByClass=function(e,o){var t=o||document;return(t.getElementsByClassName?t.getElementsByClassName(e)[0]:goog.dom.canUseQuerySelector_(t)?t.querySelector("."+e):goog.dom.getElementsByTagNameAndClass_(document,"*",e,o)[0])||null},goog.dom.getRequiredElementByClass=function(e,o){var t=goog.dom.getElementByClass(e,o);return goog.asserts.assert(t,"No element found with className: "+e)},goog.dom.canUseQuerySelector_=function(e){return!(!e.querySelectorAll||!e.querySelector)},goog.dom.getElementsByTagNameAndClass_=function(e,o,t,n){if(e=n||e,o=o&&"*"!=o?String(o).toUpperCase():"",goog.dom.canUseQuerySelector_(e)&&(o||t))return e.querySelectorAll(o+(t?"."+t:""));if(t&&e.getElementsByClassName){if(e=e.getElementsByClassName(t),o){n={};for(var r,i=0,s=0;r=e[s];s++)o==r.nodeName&&(n[i++]=r);return n.length=i,n}return e}if(e=e.getElementsByTagName(o||"*"),t){for(n={},s=i=0;r=e[s];s++)o=r.className,"function"==typeof o.split&&goog.array.contains(o.split(/\s+/),t)&&(n[i++]=r);return n.length=i,n}return e},goog.dom.$$=goog.dom.getElementsByTagNameAndClass,goog.dom.setProperties=function(e,o){goog.object.forEach(o,function(o,t){"style"==t?e.style.cssText=o:"class"==t?e.className=o:"for"==t?e.htmlFor=o:goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(t)?e.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[t],o):goog.string.startsWith(t,"aria-")||goog.string.startsWith(t,"data-")?e.setAttribute(t,o):e[t]=o})},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(e){return goog.dom.getViewportSize_(e||window)},goog.dom.getViewportSize_=function(e){return e=e.document,e=goog.dom.isCss1CompatMode_(e)?e.documentElement:e.body,new goog.math.Size(e.clientWidth,e.clientHeight)},goog.dom.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(window)},goog.dom.getDocumentHeightForWindow=function(e){return goog.dom.getDocumentHeight_(e)},goog.dom.getDocumentHeight_=function(e){var o=e.document,t=0;if(o){var t=o.body,n=o.documentElement;if(!n||!t)return 0;if(e=goog.dom.getViewportSize_(e).height,goog.dom.isCss1CompatMode_(o)&&n.scrollHeight)t=n.scrollHeight!=e?n.scrollHeight:n.offsetHeight;else{var o=n.scrollHeight,r=n.offsetHeight;n.clientHeight!=r&&(o=t.scrollHeight,r=t.offsetHeight),t=o>e?o>r?o:r:r>o?o:r}}return t},goog.dom.getPageScroll=function(e){return goog.dom.getDomHelper((e||goog.global||window).document).getDocumentScroll()},goog.dom.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(document)},goog.dom.getDocumentScroll_=function(e){var o=goog.dom.getDocumentScrollElement_(e);return e=goog.dom.getWindow_(e),goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("10")&&e.pageYOffset!=o.scrollTop?new goog.math.Coordinate(o.scrollLeft,o.scrollTop):new goog.math.Coordinate(e.pageXOffset||o.scrollLeft,e.pageYOffset||o.scrollTop)},goog.dom.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(document)},goog.dom.getDocumentScrollElement_=function(e){return e.scrollingElement?e.scrollingElement:!goog.userAgent.WEBKIT&&goog.dom.isCss1CompatMode_(e)?e.documentElement:e.body||e.documentElement},goog.dom.getWindow=function(e){return e?goog.dom.getWindow_(e):window},goog.dom.getWindow_=function(e){return e.parentWindow||e.defaultView},goog.dom.createDom=function(e,o,t){return goog.dom.createDom_(document,arguments)},goog.dom.createDom_=function(e,o){var t=String(o[0]),n=o[1];if(!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES&&n&&(n.name||n.type)){if(t=["<",t],n.name&&t.push(' name="',goog.string.htmlEscape(n.name),'"'),n.type){t.push(' type="',goog.string.htmlEscape(n.type),'"');var r={};goog.object.extend(r,n),delete r.type,n=r}t.push(">"),t=t.join("")}return t=e.createElement(t),n&&(goog.isString(n)?t.className=n:goog.isArray(n)?t.className=n.join(" "):goog.dom.setProperties(t,n)),2<o.length&&goog.dom.append_(e,t,o,2),t},goog.dom.append_=function(e,o,t,n){function r(t){t&&o.appendChild(goog.isString(t)?e.createTextNode(t):t)}for(;n<t.length;n++){var i=t[n];goog.isArrayLike(i)&&!goog.dom.isNodeLike(i)?goog.array.forEach(goog.dom.isNodeList(i)?goog.array.toArray(i):i,r):r(i)}},goog.dom.$dom=goog.dom.createDom,goog.dom.createElement=function(e){return goog.dom.createElement_(document,e)},goog.dom.createElement_=function(e,o){return e.createElement(String(o))},goog.dom.createTextNode=function(e){return document.createTextNode(String(e))},goog.dom.createTable=function(e,o,t){return goog.dom.createTable_(document,e,o,!!t)},goog.dom.createTable_=function(e,o,t,n){for(var r=goog.dom.createElement_(e,"TABLE"),i=r.appendChild(goog.dom.createElement_(e,"TBODY")),s=0;o>s;s++){for(var l=goog.dom.createElement_(e,"TR"),g=0;t>g;g++){var a=goog.dom.createElement_(e,"TD");n&&goog.dom.setTextContent(a,goog.string.Unicode.NBSP),l.appendChild(a)}i.appendChild(l)}return r},goog.dom.constHtmlToNode=function(e){var o=goog.array.map(arguments,goog.string.Const.unwrap),o=goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Constant HTML string, that gets turned into a Node later, so it will be automatically balanced."),o.join(""));return goog.dom.safeHtmlToNode(o)},goog.dom.safeHtmlToNode=function(e){return goog.dom.safeHtmlToNode_(document,e)},goog.dom.safeHtmlToNode_=function(e,o){var t=goog.dom.createElement_(e,"DIV");return goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT?(goog.dom.safe.setInnerHtml(t,goog.html.SafeHtml.concat(goog.html.SafeHtml.BR,o)),t.removeChild(t.firstChild)):goog.dom.safe.setInnerHtml(t,o),goog.dom.childrenToNode_(e,t)},goog.dom.childrenToNode_=function(e,o){if(1==o.childNodes.length)return o.removeChild(o.firstChild);for(var t=e.createDocumentFragment();o.firstChild;)t.appendChild(o.firstChild);return t},goog.dom.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(document)},goog.dom.isCss1CompatMode_=function(e){return goog.dom.COMPAT_MODE_KNOWN_?goog.dom.ASSUME_STANDARDS_MODE:"CSS1Compat"==e.compatMode},goog.dom.canHaveChildren=function(e){if(e.nodeType!=goog.dom.NodeType.ELEMENT)return!1;switch(e.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(e,o){e.appendChild(o)},goog.dom.append=function(e,o){goog.dom.append_(goog.dom.getOwnerDocument(e),e,arguments,1)},goog.dom.removeChildren=function(e){for(var o;o=e.firstChild;)e.removeChild(o)},goog.dom.insertSiblingBefore=function(e,o){o.parentNode&&o.parentNode.insertBefore(e,o)},goog.dom.insertSiblingAfter=function(e,o){o.parentNode&&o.parentNode.insertBefore(e,o.nextSibling)},goog.dom.insertChildAt=function(e,o,t){e.insertBefore(o,e.childNodes[t]||null)},goog.dom.removeNode=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},goog.dom.replaceNode=function(e,o){var t=o.parentNode;t&&t.replaceChild(e,o)},goog.dom.flattenElement=function(e){var o,t=e.parentNode;if(t&&t.nodeType!=goog.dom.NodeType.DOCUMENT_FRAGMENT){if(e.removeNode)return e.removeNode(!1);for(;o=e.firstChild;)t.insertBefore(o,e);return goog.dom.removeNode(e)}},goog.dom.getChildren=function(e){return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE&&void 0!=e.children?e.children:goog.array.filter(e.childNodes,function(e){return e.nodeType==goog.dom.NodeType.ELEMENT})},goog.dom.getFirstElementChild=function(e){return goog.isDef(e.firstElementChild)?e.firstElementChild:goog.dom.getNextElementNode_(e.firstChild,!0)},goog.dom.getLastElementChild=function(e){return goog.isDef(e.lastElementChild)?e.lastElementChild:goog.dom.getNextElementNode_(e.lastChild,!1)},goog.dom.getNextElementSibling=function(e){return goog.isDef(e.nextElementSibling)?e.nextElementSibling:goog.dom.getNextElementNode_(e.nextSibling,!0)},goog.dom.getPreviousElementSibling=function(e){return goog.isDef(e.previousElementSibling)?e.previousElementSibling:goog.dom.getNextElementNode_(e.previousSibling,!1)},goog.dom.getNextElementNode_=function(e,o){for(;e&&e.nodeType!=goog.dom.NodeType.ELEMENT;)e=o?e.nextSibling:e.previousSibling;return e},goog.dom.getNextNode=function(e){if(!e)return null;if(e.firstChild)return e.firstChild;for(;e&&!e.nextSibling;)e=e.parentNode;return e?e.nextSibling:null},goog.dom.getPreviousNode=function(e){if(!e)return null;if(!e.previousSibling)return e.parentNode;for(e=e.previousSibling;e&&e.lastChild;)e=e.lastChild;return e},goog.dom.isNodeLike=function(e){return goog.isObject(e)&&0<e.nodeType},goog.dom.isElement=function(e){return goog.isObject(e)&&e.nodeType==goog.dom.NodeType.ELEMENT},goog.dom.isWindow=function(e){return goog.isObject(e)&&e.window==e},goog.dom.getParentElement=function(e){var o;return!goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY||goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("9")&&!goog.userAgent.isVersionOrHigher("10")&&goog.global.SVGElement&&e instanceof goog.global.SVGElement||!(o=e.parentElement)?(o=e.parentNode,goog.dom.isElement(o)?o:null):o},goog.dom.contains=function(e,o){if(!e||!o)return!1;if(e.contains&&o.nodeType==goog.dom.NodeType.ELEMENT)return e==o||e.contains(o);if("undefined"!=typeof e.compareDocumentPosition)return e==o||!!(16&e.compareDocumentPosition(o));for(;o&&e!=o;)o=o.parentNode;return o==e},goog.dom.compareNodeOrder=function(e,o){if(e==o)return 0;if(e.compareDocumentPosition)return 2&e.compareDocumentPosition(o)?1:-1;if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)){if(e.nodeType==goog.dom.NodeType.DOCUMENT)return-1;if(o.nodeType==goog.dom.NodeType.DOCUMENT)return 1}if("sourceIndex"in e||e.parentNode&&"sourceIndex"in e.parentNode){var t=e.nodeType==goog.dom.NodeType.ELEMENT,n=o.nodeType==goog.dom.NodeType.ELEMENT;if(t&&n)return e.sourceIndex-o.sourceIndex;var r=e.parentNode,i=o.parentNode;return r==i?goog.dom.compareSiblingOrder_(e,o):!t&&goog.dom.contains(r,o)?-1*goog.dom.compareParentsDescendantNodeIe_(e,o):!n&&goog.dom.contains(i,e)?goog.dom.compareParentsDescendantNodeIe_(o,e):(t?e.sourceIndex:r.sourceIndex)-(n?o.sourceIndex:i.sourceIndex)}return n=goog.dom.getOwnerDocument(e),t=n.createRange(),t.selectNode(e),t.collapse(!0),n=n.createRange(),n.selectNode(o),n.collapse(!0),t.compareBoundaryPoints(goog.global.Range.START_TO_END,n)},goog.dom.compareParentsDescendantNodeIe_=function(e,o){var t=e.parentNode;if(t==o)return-1;for(var n=o;n.parentNode!=t;)n=n.parentNode;return goog.dom.compareSiblingOrder_(n,e)},goog.dom.compareSiblingOrder_=function(e,o){for(var t=o;t=t.previousSibling;)if(t==e)return-1;return 1},goog.dom.findCommonAncestor=function(e){var o,t=arguments.length;if(!t)return null;if(1==t)return arguments[0];var n=[],r=1/0;for(o=0;t>o;o++){for(var i=[],s=arguments[o];s;)i.unshift(s),s=s.parentNode;n.push(i),r=Math.min(r,i.length)}for(i=null,o=0;r>o;o++){for(var s=n[0][o],l=1;t>l;l++)if(s!=n[l][o])return i;i=s}return i},goog.dom.getOwnerDocument=function(e){return goog.asserts.assert(e,"Node cannot be null or undefined."),e.nodeType==goog.dom.NodeType.DOCUMENT?e:e.ownerDocument||e.document},goog.dom.getFrameContentDocument=function(e){return e.contentDocument||e.contentWindow.document},goog.dom.getFrameContentWindow=function(e){try{return e.contentWindow||(e.contentDocument?goog.dom.getWindow(e.contentDocument):null)}catch(o){}return null},goog.dom.setTextContent=function(e,o){if(goog.asserts.assert(null!=e,"goog.dom.setTextContent expects a non-null value for node"),"textContent"in e)e.textContent=o;else if(e.nodeType==goog.dom.NodeType.TEXT)e.data=o;else if(e.firstChild&&e.firstChild.nodeType==goog.dom.NodeType.TEXT){for(;e.lastChild!=e.firstChild;)e.removeChild(e.lastChild);e.firstChild.data=o}else{goog.dom.removeChildren(e);var t=goog.dom.getOwnerDocument(e);e.appendChild(t.createTextNode(String(o)))}},goog.dom.getOuterHtml=function(e){if(goog.asserts.assert(null!==e,"goog.dom.getOuterHtml expects a non-null value for element"),"outerHTML"in e)return e.outerHTML;var o=goog.dom.getOwnerDocument(e),o=goog.dom.createElement_(o,"DIV");return o.appendChild(e.cloneNode(!0)),o.innerHTML},goog.dom.findNode=function(e,o){var t=[];return goog.dom.findNodes_(e,o,t,!0)?t[0]:void 0},goog.dom.findNodes=function(e,o){var t=[];return goog.dom.findNodes_(e,o,t,!1),t},goog.dom.findNodes_=function(e,o,t,n){if(null!=e)for(e=e.firstChild;e;){if(o(e)&&(t.push(e),n)||goog.dom.findNodes_(e,o,t,n))return!0;e=e.nextSibling}return!1},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(e){return goog.dom.hasSpecifiedTabIndex_(e)&&goog.dom.isTabIndexFocusable_(e)},goog.dom.setFocusableTabIndex=function(e,o){o?e.tabIndex=0:(e.tabIndex=-1,e.removeAttribute("tabIndex"))},goog.dom.isFocusable=function(e){var o;return(o=goog.dom.nativelySupportsFocus_(e)?!e.disabled&&(!goog.dom.hasSpecifiedTabIndex_(e)||goog.dom.isTabIndexFocusable_(e)):goog.dom.isFocusableTabIndex(e))&&goog.userAgent.IE?goog.dom.hasNonZeroBoundingRect_(e):o},goog.dom.hasSpecifiedTabIndex_=function(e){return goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9")?(e=e.getAttributeNode("tabindex"),goog.isDefAndNotNull(e)&&e.specified):e.hasAttribute("tabindex")},goog.dom.isTabIndexFocusable_=function(e){return e=e.tabIndex,goog.isNumber(e)&&e>=0&&32768>e},goog.dom.nativelySupportsFocus_=function(e){return"A"==e.tagName||"INPUT"==e.tagName||"TEXTAREA"==e.tagName||"SELECT"==e.tagName||"BUTTON"==e.tagName},goog.dom.hasNonZeroBoundingRect_=function(e){return e=!goog.isFunction(e.getBoundingClientRect)||goog.userAgent.IE&&null==e.parentElement?{height:e.offsetHeight,width:e.offsetWidth}:e.getBoundingClientRect(),goog.isDefAndNotNull(e)&&0<e.height&&0<e.width},goog.dom.getTextContent=function(e){if(goog.dom.BrowserFeature.CAN_USE_INNER_TEXT&&null!==e&&"innerText"in e)e=goog.string.canonicalizeNewlines(e.innerText);else{var o=[];goog.dom.getTextContent_(e,o,!0),e=o.join("")}return e=e.replace(/ \xAD /g," ").replace(/\xAD/g,""),e=e.replace(/\u200B/g,""),goog.dom.BrowserFeature.CAN_USE_INNER_TEXT||(e=e.replace(/ +/g," "))," "!=e&&(e=e.replace(/^\s*/,"")),e},goog.dom.getRawTextContent=function(e){var o=[];return goog.dom.getTextContent_(e,o,!1),o.join("")},goog.dom.getTextContent_=function(e,o,t){if(!(e.nodeName in goog.dom.TAGS_TO_IGNORE_))if(e.nodeType==goog.dom.NodeType.TEXT)t?o.push(String(e.nodeValue).replace(/(\r\n|\r|\n)/g,"")):o.push(e.nodeValue);else if(e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)o.push(goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName]);else for(e=e.firstChild;e;)goog.dom.getTextContent_(e,o,t),e=e.nextSibling},goog.dom.getNodeTextLength=function(e){return goog.dom.getTextContent(e).length},goog.dom.getNodeTextOffset=function(e,o){for(var t=o||goog.dom.getOwnerDocument(e).body,n=[];e&&e!=t;){for(var r=e;r=r.previousSibling;)n.unshift(goog.dom.getTextContent(r));e=e.parentNode}return goog.string.trimLeft(n.join("")).replace(/ +/g," ").length},goog.dom.getNodeAtOffset=function(e,o,t){e=[e];for(var n=0,r=null;0<e.length&&o>n;)if(r=e.pop(),!(r.nodeName in goog.dom.TAGS_TO_IGNORE_))if(r.nodeType==goog.dom.NodeType.TEXT)var i=r.nodeValue.replace(/(\r\n|\r|\n)/g,"").replace(/ +/g," "),n=n+i.length;else if(r.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)n+=goog.dom.PREDEFINED_TAG_VALUES_[r.nodeName].length;else for(i=r.childNodes.length-1;i>=0;i--)e.push(r.childNodes[i]);return goog.isObject(t)&&(t.remainder=r?r.nodeValue.length+o-n-1:0,t.node=r),r},goog.dom.isNodeList=function(e){if(e&&"number"==typeof e.length){if(goog.isObject(e))return"function"==typeof e.item||"string"==typeof e.item;if(goog.isFunction(e))return"function"==typeof e.item}return!1},goog.dom.getAncestorByTagNameAndClass=function(e,o,t,n){if(!o&&!t)return null;var r=o?String(o).toUpperCase():null;return goog.dom.getAncestor(e,function(e){return(!r||e.nodeName==r)&&(!t||goog.isString(e.className)&&goog.array.contains(e.className.split(/\s+/),t))},!0,n)},goog.dom.getAncestorByClass=function(e,o,t){return goog.dom.getAncestorByTagNameAndClass(e,null,o,t)},goog.dom.getAncestor=function(e,o,t,n){for(t||(e=e.parentNode),t=0;e&&(null==n||n>=t);){if(goog.asserts.assert("parentNode"!=e.name),o(e))return e;e=e.parentNode,t++}return null},goog.dom.getActiveElement=function(e){try{return e&&e.activeElement}catch(o){}return null},goog.dom.getPixelRatio=function(){var e=goog.dom.getWindow();return goog.isDef(e.devicePixelRatio)?e.devicePixelRatio:e.matchMedia?goog.dom.matchesPixelRatio_(3)||goog.dom.matchesPixelRatio_(2)||goog.dom.matchesPixelRatio_(1.5)||goog.dom.matchesPixelRatio_(1)||.75:1},goog.dom.matchesPixelRatio_=function(e){return goog.dom.getWindow().matchMedia("(min-resolution: "+e+"dppx),(min--moz-device-pixel-ratio: "+e+"),(min-resolution: "+96*e+"dpi)").matches?e:0},goog.dom.getCanvasContext2D=function(e){return e.getContext("2d")},goog.dom.DomHelper=function(e){this.document_=e||goog.global.document||document},goog.dom.DomHelper.prototype.getDomHelper=goog.dom.getDomHelper,goog.dom.DomHelper.prototype.setDocument=function(e){this.document_=e},goog.dom.DomHelper.prototype.getDocument=function(){return this.document_},goog.dom.DomHelper.prototype.getElement=function(e){return goog.dom.getElementHelper_(this.document_,e)},goog.dom.DomHelper.prototype.getRequiredElement=function(e){return goog.dom.getRequiredElementHelper_(this.document_,e)},goog.dom.DomHelper.prototype.$=goog.dom.DomHelper.prototype.getElement,goog.dom.DomHelper.prototype.getElementsByTagName=function(e,o){return(o||this.document_).getElementsByTagName(String(e))},goog.dom.DomHelper.prototype.getElementsByTagNameAndClass=function(e,o,t){return goog.dom.getElementsByTagNameAndClass_(this.document_,e,o,t)},goog.dom.DomHelper.prototype.getElementsByClass=function(e,o){return goog.dom.getElementsByClass(e,o||this.document_)},goog.dom.DomHelper.prototype.getElementByClass=function(e,o){return goog.dom.getElementByClass(e,o||this.document_)},goog.dom.DomHelper.prototype.getRequiredElementByClass=function(e,o){return goog.dom.getRequiredElementByClass(e,o||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(e){return goog.dom.getViewportSize(e||this.getWindow())},goog.dom.DomHelper.prototype.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(this.getWindow())},goog.dom.DomHelper.prototype.createDom=function(e,o,t){return goog.dom.createDom_(this.document_,arguments)},goog.dom.DomHelper.prototype.$dom=goog.dom.DomHelper.prototype.createDom,goog.dom.DomHelper.prototype.createElement=function(e){return goog.dom.createElement_(this.document_,e)},goog.dom.DomHelper.prototype.createTextNode=function(e){return this.document_.createTextNode(String(e))},goog.dom.DomHelper.prototype.createTable=function(e,o,t){return goog.dom.createTable_(this.document_,e,o,!!t)},goog.dom.DomHelper.prototype.safeHtmlToNode=function(e){return goog.dom.safeHtmlToNode_(this.document_,e)},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(e){return goog.dom.getActiveElement(e||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,
    77goog.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(e,o){if(o&&e in o)return e;var t=goog.dom.vendor.getVendorJsPrefix();return t?(t=t.toLowerCase(),t+=goog.string.toTitleCase(e),!goog.isDef(o)||t in o?t:null):null},goog.dom.vendor.getPrefixedEventType=function(e){return((goog.dom.vendor.getVendorJsPrefix()||"")+e).toLowerCase()},goog.html.legacyconversions={},goog.html.legacyconversions.safeHtmlFromString=function(e){return goog.html.legacyconversions.reportCallback_(),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e,null)},goog.html.legacyconversions.safeStyleFromString=function(e){return goog.html.legacyconversions.reportCallback_(),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(e)},goog.html.legacyconversions.safeStyleSheetFromString=function(e){return goog.html.legacyconversions.reportCallback_(),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(e)},goog.html.legacyconversions.safeUrlFromString=function(e){return goog.html.legacyconversions.reportCallback_(),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.legacyconversions.trustedResourceUrlFromString=function(e){return goog.html.legacyconversions.reportCallback_(),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.legacyconversions.reportCallback_=goog.nullFunction,goog.html.legacyconversions.setReportCallback=function(e){goog.html.legacyconversions.reportCallback_=e},goog.math.Box=function(e,o,t,n){this.top=e,this.right=o,this.bottom=t,this.left=n},goog.math.Box.boundingBox=function(e){for(var o=new goog.math.Box(arguments[0].y,arguments[0].x,arguments[0].y,arguments[0].x),t=1;t<arguments.length;t++)o.expandToIncludeCoordinate(arguments[t]);return o},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(e){return goog.math.Box.contains(this,e)},goog.math.Box.prototype.expand=function(e,o,t,n){return goog.isObject(e)?(this.top-=e.top,this.right+=e.right,this.bottom+=e.bottom,this.left-=e.left):(this.top-=e,this.right+=Number(o),this.bottom+=Number(t),this.left-=Number(n)),this},goog.math.Box.prototype.expandToInclude=function(e){this.left=Math.min(this.left,e.left),this.top=Math.min(this.top,e.top),this.right=Math.max(this.right,e.right),this.bottom=Math.max(this.bottom,e.bottom)},goog.math.Box.prototype.expandToIncludeCoordinate=function(e){this.top=Math.min(this.top,e.y),this.right=Math.max(this.right,e.x),this.bottom=Math.max(this.bottom,e.y),this.left=Math.min(this.left,e.x)},goog.math.Box.equals=function(e,o){return e==o?!0:e&&o?e.top==o.top&&e.right==o.right&&e.bottom==o.bottom&&e.left==o.left:!1},goog.math.Box.contains=function(e,o){return e&&o?o instanceof goog.math.Box?o.left>=e.left&&o.right<=e.right&&o.top>=e.top&&o.bottom<=e.bottom:o.x>=e.left&&o.x<=e.right&&o.y>=e.top&&o.y<=e.bottom:!1},goog.math.Box.relativePositionX=function(e,o){return o.x<e.left?o.x-e.left:o.x>e.right?o.x-e.right:0},goog.math.Box.relativePositionY=function(e,o){return o.y<e.top?o.y-e.top:o.y>e.bottom?o.y-e.bottom:0},goog.math.Box.distance=function(e,o){var t=goog.math.Box.relativePositionX(e,o),n=goog.math.Box.relativePositionY(e,o);return Math.sqrt(t*t+n*n)},goog.math.Box.intersects=function(e,o){return e.left<=o.right&&o.left<=e.right&&e.top<=o.bottom&&o.top<=e.bottom},goog.math.Box.intersectsWithPadding=function(e,o,t){return e.left<=o.right+t&&o.left<=e.right+t&&e.top<=o.bottom+t&&o.top<=e.bottom+t},goog.math.Box.prototype.ceil=function(){return this.top=Math.ceil(this.top),this.right=Math.ceil(this.right),this.bottom=Math.ceil(this.bottom),this.left=Math.ceil(this.left),this},goog.math.Box.prototype.floor=function(){return this.top=Math.floor(this.top),this.right=Math.floor(this.right),this.bottom=Math.floor(this.bottom),this.left=Math.floor(this.left),this},goog.math.Box.prototype.round=function(){return this.top=Math.round(this.top),this.right=Math.round(this.right),this.bottom=Math.round(this.bottom),this.left=Math.round(this.left),this},goog.math.Box.prototype.translate=function(e,o){return e instanceof goog.math.Coordinate?(this.left+=e.x,this.right+=e.x,this.top+=e.y,this.bottom+=e.y):(goog.asserts.assertNumber(e),this.left+=e,this.right+=e,goog.isNumber(o)&&(this.top+=o,this.bottom+=o)),this},goog.math.Box.prototype.scale=function(e,o){var t=goog.isNumber(o)?o:e;return this.left*=e,this.right*=e,this.top*=t,this.bottom*=t,this},goog.math.IRect=function(){},goog.math.Rect=function(e,o,t,n){this.left=e,this.top=o,this.width=t,this.height=n},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(e,o){return new goog.math.Rect(e.x,e.y,o.width,o.height)},goog.math.Rect.createFromBox=function(e){return new goog.math.Rect(e.left,e.top,e.right-e.left,e.bottom-e.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(e,o){return e==o?!0:e&&o?e.left==o.left&&e.width==o.width&&e.top==o.top&&e.height==o.height:!1},goog.math.Rect.prototype.intersection=function(e){var o=Math.max(this.left,e.left),t=Math.min(this.left+this.width,e.left+e.width);if(t>=o){var n=Math.max(this.top,e.top);if(e=Math.min(this.top+this.height,e.top+e.height),e>=n)return this.left=o,this.top=n,this.width=t-o,this.height=e-n,!0}return!1},goog.math.Rect.intersection=function(e,o){var t=Math.max(e.left,o.left),n=Math.min(e.left+e.width,o.left+o.width);if(n>=t){var r=Math.max(e.top,o.top),i=Math.min(e.top+e.height,o.top+o.height);if(i>=r)return new goog.math.Rect(t,r,n-t,i-r)}return null},goog.math.Rect.intersects=function(e,o){return e.left<=o.left+o.width&&o.left<=e.left+e.width&&e.top<=o.top+o.height&&o.top<=e.top+e.height},goog.math.Rect.prototype.intersects=function(e){return goog.math.Rect.intersects(this,e)},goog.math.Rect.difference=function(e,o){var t=goog.math.Rect.intersection(e,o);if(!t||!t.height||!t.width)return[e.clone()];var t=[],n=e.top,r=e.height,i=e.left+e.width,s=e.top+e.height,l=o.left+o.width,g=o.top+o.height;return o.top>e.top&&(t.push(new goog.math.Rect(e.left,e.top,e.width,o.top-e.top)),n=o.top,r-=o.top-e.top),s>g&&(t.push(new goog.math.Rect(e.left,g,e.width,s-g)),r=g-n),o.left>e.left&&t.push(new goog.math.Rect(e.left,n,o.left-e.left,r)),i>l&&t.push(new goog.math.Rect(l,n,i-l,r)),t},goog.math.Rect.prototype.difference=function(e){return goog.math.Rect.difference(this,e)},goog.math.Rect.prototype.boundingRect=function(e){var o=Math.max(this.left+this.width,e.left+e.width),t=Math.max(this.top+this.height,e.top+e.height);this.left=Math.min(this.left,e.left),this.top=Math.min(this.top,e.top),this.width=o-this.left,this.height=t-this.top},goog.math.Rect.boundingRect=function(e,o){if(!e||!o)return null;var t=new goog.math.Rect(e.left,e.top,e.width,e.height);return t.boundingRect(o),t},goog.math.Rect.prototype.contains=function(e){return e instanceof goog.math.Coordinate?e.x>=this.left&&e.x<=this.left+this.width&&e.y>=this.top&&e.y<=this.top+this.height:this.left<=e.left&&this.left+this.width>=e.left+e.width&&this.top<=e.top&&this.top+this.height>=e.top+e.height},goog.math.Rect.prototype.squaredDistance=function(e){var o=e.x<this.left?this.left-e.x:Math.max(e.x-(this.left+this.width),0);return e=e.y<this.top?this.top-e.y:Math.max(e.y-(this.top+this.height),0),o*o+e*e},goog.math.Rect.prototype.distance=function(e){return Math.sqrt(this.squaredDistance(e))},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(){return this.left=Math.ceil(this.left),this.top=Math.ceil(this.top),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height),this},goog.math.Rect.prototype.floor=function(){return this.left=Math.floor(this.left),this.top=Math.floor(this.top),this.width=Math.floor(this.width),this.height=Math.floor(this.height),this},goog.math.Rect.prototype.round=function(){return this.left=Math.round(this.left),this.top=Math.round(this.top),this.width=Math.round(this.width),this.height=Math.round(this.height),this},goog.math.Rect.prototype.translate=function(e,o){return e instanceof goog.math.Coordinate?(this.left+=e.x,this.top+=e.y):(this.left+=goog.asserts.assertNumber(e),goog.isNumber(o)&&(this.top+=o)),this},goog.math.Rect.prototype.scale=function(e,o){var t=goog.isNumber(o)?o:e;return this.left*=e,this.width*=e,this.top*=t,this.height*=t,this},goog.style={},goog.style.setStyle=function(e,o,t){if(goog.isString(o))goog.style.setStyle_(e,t,o);else for(var n in o)goog.style.setStyle_(e,o[n],n)},goog.style.setStyle_=function(e,o,t){(t=goog.style.getVendorJsStyleName_(e,t))&&(e.style[t]=o)},goog.style.styleNameCache_={},goog.style.getVendorJsStyleName_=function(e,o){var t=goog.style.styleNameCache_[o];if(!t){var n=goog.string.toCamelCase(o),t=n;void 0===e.style[n]&&(n=goog.dom.vendor.getVendorJsPrefix()+goog.string.toTitleCase(n),void 0!==e.style[n]&&(t=n)),goog.style.styleNameCache_[o]=t}return t},goog.style.getVendorStyleName_=function(e,o){var t=goog.string.toCamelCase(o);return void 0===e.style[t]&&(t=goog.dom.vendor.getVendorJsPrefix()+goog.string.toTitleCase(t),void 0!==e.style[t])?goog.dom.vendor.getVendorPrefix()+"-"+o:o},goog.style.getStyle=function(e,o){var t=e.style[goog.string.toCamelCase(o)];return"undefined"!=typeof t?t:e.style[goog.style.getVendorJsStyleName_(e,o)]||""},goog.style.getComputedStyle=function(e,o){var t=goog.dom.getOwnerDocument(e);return t.defaultView&&t.defaultView.getComputedStyle&&(t=t.defaultView.getComputedStyle(e,null))?t[o]||t.getPropertyValue(o)||"":""},goog.style.getCascadedStyle=function(e,o){return e.currentStyle?e.currentStyle[o]:null},goog.style.getStyle_=function(e,o){return goog.style.getComputedStyle(e,o)||goog.style.getCascadedStyle(e,o)||e.style&&e.style[o]},goog.style.getComputedBoxSizing=function(e){return goog.style.getStyle_(e,"boxSizing")||goog.style.getStyle_(e,"MozBoxSizing")||goog.style.getStyle_(e,"WebkitBoxSizing")||null},goog.style.getComputedPosition=function(e){return goog.style.getStyle_(e,"position")},goog.style.getBackgroundColor=function(e){return goog.style.getStyle_(e,"backgroundColor")},goog.style.getComputedOverflowX=function(e){return goog.style.getStyle_(e,"overflowX")},goog.style.getComputedOverflowY=function(e){return goog.style.getStyle_(e,"overflowY")},goog.style.getComputedZIndex=function(e){return goog.style.getStyle_(e,"zIndex")},goog.style.getComputedTextAlign=function(e){return goog.style.getStyle_(e,"textAlign")},goog.style.getComputedCursor=function(e){return goog.style.getStyle_(e,"cursor")},goog.style.getComputedTransform=function(e){var o=goog.style.getVendorStyleName_(e,"transform");return goog.style.getStyle_(e,o)||goog.style.getStyle_(e,"transform")},goog.style.setPosition=function(e,o,t){var n;o instanceof goog.math.Coordinate?(n=o.x,o=o.y):(n=o,o=t),e.style.left=goog.style.getPixelStyleValue_(n,!1),e.style.top=goog.style.getPixelStyleValue_(o,!1)},goog.style.getPosition=function(e){return new goog.math.Coordinate(e.offsetLeft,e.offsetTop)},goog.style.getClientViewportElement=function(e){return e=e?goog.dom.getOwnerDocument(e):goog.dom.getDocument(),!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9)||goog.dom.getDomHelper(e).isCss1CompatMode()?e.documentElement:e.body},goog.style.getViewportPageOffset=function(e){var o=e.body;return e=e.documentElement,new goog.math.Coordinate(o.scrollLeft||e.scrollLeft,o.scrollTop||e.scrollTop)},goog.style.getBoundingClientRect_=function(e){var o;try{o=e.getBoundingClientRect()}catch(t){return{left:0,top:0,right:0,bottom:0}}return goog.userAgent.IE&&e.ownerDocument.body&&(e=e.ownerDocument,o.left-=e.documentElement.clientLeft+e.body.clientLeft,o.top-=e.documentElement.clientTop+e.body.clientTop),o},goog.style.getOffsetParent=function(e){if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(8))return goog.asserts.assert(e&&"offsetParent"in e),e.offsetParent;var o=goog.dom.getOwnerDocument(e),t=goog.style.getStyle_(e,"position"),n="fixed"==t||"absolute"==t;for(e=e.parentNode;e&&e!=o;e=e.parentNode)if(e.nodeType==goog.dom.NodeType.DOCUMENT_FRAGMENT&&e.host&&(e=e.host),t=goog.style.getStyle_(e,"position"),n=n&&"static"==t&&e!=o.documentElement&&e!=o.body,!n&&(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight||"fixed"==t||"absolute"==t||"relative"==t))return e;return null},goog.style.getVisibleRectForElement=function(e){for(var o=new goog.math.Box(0,1/0,1/0,0),t=goog.dom.getDomHelper(e),n=t.getDocument().body,r=t.getDocument().documentElement,i=t.getDocumentScrollElement();e=goog.style.getOffsetParent(e);)if(!(goog.userAgent.IE&&0==e.clientWidth||goog.userAgent.WEBKIT&&0==e.clientHeight&&e==n)&&e!=n&&e!=r&&"visible"!=goog.style.getStyle_(e,"overflow")){var s=goog.style.getPageOffset(e),l=goog.style.getClientLeftTop(e);s.x+=l.x,s.y+=l.y,o.top=Math.max(o.top,s.y),o.right=Math.min(o.right,s.x+e.clientWidth),o.bottom=Math.min(o.bottom,s.y+e.clientHeight),o.left=Math.max(o.left,s.x)}return n=i.scrollLeft,i=i.scrollTop,o.left=Math.max(o.left,n),o.top=Math.max(o.top,i),t=t.getViewportSize(),o.right=Math.min(o.right,n+t.width),o.bottom=Math.min(o.bottom,i+t.height),0<=o.top&&0<=o.left&&o.bottom>o.top&&o.right>o.left?o:null},goog.style.getContainerOffsetToScrollInto=function(e,o,t){var n=o||goog.dom.getDocumentScrollElement(),r=goog.style.getPageOffset(e),i=goog.style.getPageOffset(n),s=goog.style.getBorderBox(n);return n==goog.dom.getDocumentScrollElement()?(o=r.x-n.scrollLeft,r=r.y-n.scrollTop,goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(10)&&(o+=s.left,r+=s.top)):(o=r.x-i.x-s.left,r=r.y-i.y-s.top),s=goog.style.getSizeWithDisplay_(e),e=n.clientWidth-s.width,s=n.clientHeight-s.height,i=n.scrollLeft,n=n.scrollTop,t?(i+=o-e/2,n+=r-s/2):(i+=Math.min(o,Math.max(o-e,0)),n+=Math.min(r,Math.max(r-s,0))),new goog.math.Coordinate(i,n)},goog.style.scrollIntoContainerView=function(e,o,t){o=o||goog.dom.getDocumentScrollElement(),e=goog.style.getContainerOffsetToScrollInto(e,o,t),o.scrollLeft=e.x,o.scrollTop=e.y},goog.style.getClientLeftTop=function(e){return new goog.math.Coordinate(e.clientLeft,e.clientTop)},goog.style.getPageOffset=function(e){var o=goog.dom.getOwnerDocument(e);goog.asserts.assertObject(e,"Parameter is required");var t=new goog.math.Coordinate(0,0),n=goog.style.getClientViewportElement(o);return e==n?t:(e=goog.style.getBoundingClientRect_(e),o=goog.dom.getDomHelper(o).getDocumentScroll(),t.x=e.left+o.x,t.y=e.top+o.y,t)},goog.style.getPageOffsetLeft=function(e){return goog.style.getPageOffset(e).x},goog.style.getPageOffsetTop=function(e){return goog.style.getPageOffset(e).y},goog.style.getFramedPageOffset=function(e,o){var t=new goog.math.Coordinate(0,0),n=goog.dom.getWindow(goog.dom.getOwnerDocument(e));if(!goog.reflect.canAccessProperty(n,"parent"))return t;var r=e;do{var i=n==o?goog.style.getPageOffset(r):goog.style.getClientPositionForElement_(goog.asserts.assert(r));t.x+=i.x,t.y+=i.y}while(n&&n!=o&&n!=n.parent&&(r=n.frameElement)&&(n=n.parent));return t},goog.style.translateRectForAnotherFrame=function(e,o,t){if(o.getDocument()!=t.getDocument()){var n=o.getDocument().body;t=goog.style.getFramedPageOffset(n,t.getWindow()),t=goog.math.Coordinate.difference(t,goog.style.getPageOffset(n)),!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9)||o.isCss1CompatMode()||(t=goog.math.Coordinate.difference(t,o.getDocumentScroll())),e.left+=t.x,e.top+=t.y}},goog.style.getRelativePosition=function(e,o){var t=goog.style.getClientPosition(e),n=goog.style.getClientPosition(o);return new goog.math.Coordinate(t.x-n.x,t.y-n.y)},goog.style.getClientPositionForElement_=function(e){return e=goog.style.getBoundingClientRect_(e),new goog.math.Coordinate(e.left,e.top)},goog.style.getClientPosition=function(e){return goog.asserts.assert(e),e.nodeType==goog.dom.NodeType.ELEMENT?goog.style.getClientPositionForElement_(e):(e=e.changedTouches?e.changedTouches[0]:e,new goog.math.Coordinate(e.clientX,e.clientY))},goog.style.setPageOffset=function(e,o,t){var n=goog.style.getPageOffset(e);o instanceof goog.math.Coordinate&&(t=o.y,o=o.x),o=goog.asserts.assertNumber(o)-n.x,goog.style.setPosition(e,e.offsetLeft+o,e.offsetTop+(Number(t)-n.y))},goog.style.setSize=function(e,o,t){if(o instanceof goog.math.Size)t=o.height,o=o.width;else if(void 0==t)throw Error("missing height argument");goog.style.setWidth(e,o),goog.style.setHeight(e,t)},goog.style.getPixelStyleValue_=function(e,o){return"number"==typeof e&&(e=(o?Math.round(e):e)+"px"),e},goog.style.setHeight=function(e,o){e.style.height=goog.style.getPixelStyleValue_(o,!0)},goog.style.setWidth=function(e,o){e.style.width=goog.style.getPixelStyleValue_(o,!0)},goog.style.getSize=function(e){return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_,e)},goog.style.evaluateWithTemporaryDisplay_=function(e,o){if("none"!=goog.style.getStyle_(o,"display"))return e(o);var t=o.style,n=t.display,r=t.visibility,i=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";var s=e(o);return t.display=n,t.position=i,t.visibility=r,s},goog.style.getSizeWithDisplay_=function(e){var o=e.offsetWidth,t=e.offsetHeight,n=goog.userAgent.WEBKIT&&!o&&!t;return goog.isDef(o)&&!n||!e.getBoundingClientRect?new goog.math.Size(o,t):(e=goog.style.getBoundingClientRect_(e),new goog.math.Size(e.right-e.left,e.bottom-e.top))},goog.style.getTransformedSize=function(e){return e.getBoundingClientRect?(e=goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_,e),new goog.math.Size(e.right-e.left,e.bottom-e.top)):null},goog.style.getBounds=function(e){var o=goog.style.getPageOffset(e);return e=goog.style.getSize(e),new goog.math.Rect(o.x,o.y,e.width,e.height)},goog.style.toCamelCase=function(e){return goog.string.toCamelCase(String(e))},goog.style.toSelectorCase=function(e){return goog.string.toSelectorCase(e)},goog.style.getOpacity=function(e){goog.asserts.assert(e);var o=e.style;return e="","opacity"in o?e=o.opacity:"MozOpacity"in o?e=o.MozOpacity:"filter"in o&&(o=o.filter.match(/alpha\(opacity=([\d.]+)\)/))&&(e=String(o[1]/100)),""==e?e:Number(e)},goog.style.setOpacity=function(e,o){goog.asserts.assert(e);var t=e.style;"opacity"in t?t.opacity=o:"MozOpacity"in t?t.MozOpacity=o:"filter"in t&&(t.filter=""===o?"":"alpha(opacity="+100*Number(o)+")")},goog.style.setTransparentBackgroundImage=function(e,o){var t=e.style;goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?t.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+o+'", sizingMethod="crop")':(t.backgroundImage="url("+o+")",t.backgroundPosition="top left",t.backgroundRepeat="no-repeat")},goog.style.clearTransparentBackgroundImage=function(e){e=e.style,"filter"in e?e.filter="":e.backgroundImage="none"},goog.style.showElement=function(e,o){goog.style.setElementShown(e,o)},goog.style.setElementShown=function(e,o){e.style.display=o?"":"none"},goog.style.isElementShown=function(e){return"none"!=e.style.display},goog.style.installStyles=function(e,o){return goog.style.installSafeStyleSheet(goog.html.legacyconversions.safeStyleSheetFromString(e),o)},goog.style.installSafeStyleSheet=function(e,o){var t,n=goog.dom.getDomHelper(o),r=n.getDocument();return goog.userAgent.IE&&r.createStyleSheet?(t=r.createStyleSheet(),goog.style.setSafeStyleSheet(t,e)):(r=n.getElementsByTagNameAndClass("HEAD")[0],r||(t=n.getElementsByTagNameAndClass("BODY")[0],r=n.createDom("HEAD"),t.parentNode.insertBefore(r,t)),t=n.createDom("STYLE"),goog.style.setSafeStyleSheet(t,e),n.appendChild(r,t)),t},goog.style.uninstallStyles=function(e){goog.dom.removeNode(e.ownerNode||e.owningElement||e)},goog.style.setStyles=function(e,o){goog.style.setSafeStyleSheet(e,goog.html.legacyconversions.safeStyleSheetFromString(o))},goog.style.setSafeStyleSheet=function(e,o){var t=goog.html.SafeStyleSheet.unwrap(o);goog.userAgent.IE&&goog.isDef(e.cssText)?e.cssText=t:e.innerHTML=t},goog.style.setPreWrap=function(e){e=e.style,goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?(e.whiteSpace="pre",e.wordWrap="break-word"):e.whiteSpace=goog.userAgent.GECKO?"-moz-pre-wrap":"pre-wrap"},goog.style.setInlineBlock=function(e){e=e.style,e.position="relative",goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?(e.zoom="1",e.display="inline"):e.display="inline-block"},goog.style.isRightToLeft=function(e){return"rtl"==goog.style.getStyle_(e,"direction")},goog.style.unselectableStyle_=goog.userAgent.GECKO?"MozUserSelect":goog.userAgent.WEBKIT||goog.userAgent.EDGE?"WebkitUserSelect":null,goog.style.isUnselectable=function(e){return goog.style.unselectableStyle_?"none"==e.style[goog.style.unselectableStyle_].toLowerCase():goog.userAgent.IE||goog.userAgent.OPERA?"on"==e.getAttribute("unselectable"):!1},goog.style.setUnselectable=function(e,o,t){t=t?null:e.getElementsByTagName("*");var n=goog.style.unselectableStyle_;if(n){if(o=o?"none":"",e.style&&(e.style[n]=o),t){e=0;for(var r;r=t[e];e++)r.style&&(r.style[n]=o)}}else if((goog.userAgent.IE||goog.userAgent.OPERA)&&(o=o?"on":"",e.setAttribute("unselectable",o),t))for(e=0;r=t[e];e++)r.setAttribute("unselectable",o)},goog.style.getBorderBoxSize=function(e){return new goog.math.Size(e.offsetWidth,e.offsetHeight)},goog.style.setBorderBoxSize=function(e,o){var t=goog.dom.getOwnerDocument(e),n=goog.dom.getDomHelper(t).isCss1CompatMode();if(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10")||n&&goog.userAgent.isVersionOrHigher("8"))goog.style.setBoxSizingSize_(e,o,"border-box");else if(t=e.style,n){var n=goog.style.getPaddingBox(e),r=goog.style.getBorderBox(e);t.pixelWidth=o.width-r.left-n.left-n.right-r.right,t.pixelHeight=o.height-r.top-n.top-n.bottom-r.bottom}else t.pixelWidth=o.width,t.pixelHeight=o.height},goog.style.getContentBoxSize=function(e){var o=goog.dom.getOwnerDocument(e),t=goog.userAgent.IE&&e.currentStyle;return t&&goog.dom.getDomHelper(o).isCss1CompatMode()&&"auto"!=t.width&&"auto"!=t.height&&!t.boxSizing?(o=goog.style.getIePixelValue_(e,t.width,"width","pixelWidth"),e=goog.style.getIePixelValue_(e,t.height,"height","pixelHeight"),new goog.math.Size(o,e)):(t=goog.style.getBorderBoxSize(e),o=goog.style.getPaddingBox(e),e=goog.style.getBorderBox(e),new goog.math.Size(t.width-e.left-o.left-o.right-e.right,t.height-e.top-o.top-o.bottom-e.bottom))},goog.style.setContentBoxSize=function(e,o){var t=goog.dom.getOwnerDocument(e),n=goog.dom.getDomHelper(t).isCss1CompatMode();if(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10")||n&&goog.userAgent.isVersionOrHigher("8"))goog.style.setBoxSizingSize_(e,o,"content-box");else if(t=e.style,n)t.pixelWidth=o.width,t.pixelHeight=o.height;else{var n=goog.style.getPaddingBox(e),r=goog.style.getBorderBox(e);t.pixelWidth=o.width+r.left+n.left+n.right+r.right,t.pixelHeight=o.height+r.top+n.top+n.bottom+r.bottom}},goog.style.setBoxSizingSize_=function(e,o,t){e=e.style,goog.userAgent.GECKO?e.MozBoxSizing=t:goog.userAgent.WEBKIT?e.WebkitBoxSizing=t:e.boxSizing=t,e.width=Math.max(o.width,0)+"px",e.height=Math.max(o.height,0)+"px"},goog.style.getIePixelValue_=function(e,o,t,n){if(/^\d+px?$/.test(o))return parseInt(o,10);var r=e.style[t],i=e.runtimeStyle[t];return e.runtimeStyle[t]=e.currentStyle[t],e.style[t]=o,o=e.style[n],e.style[t]=r,e.runtimeStyle[t]=i,o},goog.style.getIePixelDistance_=function(e,o){var t=goog.style.getCascadedStyle(e,o);return t?goog.style.getIePixelValue_(e,t,"left","pixelLeft"):0},goog.style.getBox_=function(e,o){if(goog.userAgent.IE){var t=goog.style.getIePixelDistance_(e,o+"Left"),n=goog.style.getIePixelDistance_(e,o+"Right"),r=goog.style.getIePixelDistance_(e,o+"Top"),i=goog.style.getIePixelDistance_(e,o+"Bottom");return new goog.math.Box(r,n,i,t)}return t=goog.style.getComputedStyle(e,o+"Left"),n=goog.style.getComputedStyle(e,o+"Right"),r=goog.style.getComputedStyle(e,o+"Top"),i=goog.style.getComputedStyle(e,o+"Bottom"),new goog.math.Box(parseFloat(r),parseFloat(n),parseFloat(i),parseFloat(t))},goog.style.getPaddingBox=function(e){return goog.style.getBox_(e,"padding")},goog.style.getMarginBox=function(e){return goog.style.getBox_(e,"margin")},goog.style.ieBorderWidthKeywords_={thin:2,medium:4,thick:6},goog.style.getIePixelBorder_=function(e,o){if("none"==goog.style.getCascadedStyle(e,o+"Style"))return 0;var t=goog.style.getCascadedStyle(e,o+"Width");return t in goog.style.ieBorderWidthKeywords_?goog.style.ieBorderWidthKeywords_[t]:goog.style.getIePixelValue_(e,t,"left","pixelLeft")},goog.style.getBorderBox=function(e){if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)){var o=goog.style.getIePixelBorder_(e,"borderLeft"),t=goog.style.getIePixelBorder_(e,"borderRight"),n=goog.style.getIePixelBorder_(e,"borderTop");return e=goog.style.getIePixelBorder_(e,"borderBottom"),new goog.math.Box(n,t,e,o)}return o=goog.style.getComputedStyle(e,"borderLeftWidth"),t=goog.style.getComputedStyle(e,"borderRightWidth"),n=goog.style.getComputedStyle(e,"borderTopWidth"),e=goog.style.getComputedStyle(e,"borderBottomWidth"),new goog.math.Box(parseFloat(n),parseFloat(t),parseFloat(e),parseFloat(o))},goog.style.getFontFamily=function(e){var o=goog.dom.getOwnerDocument(e),t="";if(o.body.createTextRange&&goog.dom.contains(o,e)){o=o.body.createTextRange(),o.moveToElementText(e);try{t=o.queryCommandValue("FontName")}catch(n){t=""}}return t||(t=goog.style.getStyle_(e,"fontFamily")),e=t.split(","),1<e.length&&(t=e[0]),goog.string.stripQuotes(t,"\"'")},goog.style.lengthUnitRegex_=/[^\d]+$/,goog.style.getLengthUnits=function(e){return(e=e.match(goog.style.lengthUnitRegex_))&&e[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(e){var o=goog.style.getStyle_(e,"fontSize"),t=goog.style.getLengthUnits(o);if(o&&"px"==t)return parseInt(o,10);if(goog.userAgent.IE){if(String(t)in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_)return goog.style.getIePixelValue_(e,o,"left","pixelLeft");if(e.parentNode&&e.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&String(t)in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_)return e=e.parentNode,t=goog.style.getStyle_(e,"fontSize"),goog.style.getIePixelValue_(e,o==t?"1em":o,"left","pixelLeft")}return t=goog.dom.createDom("SPAN",{style:"visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"}),goog.dom.appendChild(e,t),o=t.offsetHeight,goog.dom.removeNode(t),o},goog.style.parseStyleAttribute=function(e){var o={};return goog.array.forEach(e.split(/\s*;\s*/),function(e){var t=e.match(/\s*([\w-]+)\s*\:(.+)/);t&&(e=t[1],t=goog.string.trim(t[2]),o[goog.string.toCamelCase(e.toLowerCase())]=t)}),o},goog.style.toStyleAttribute=function(e){var o=[];return goog.object.forEach(e,function(e,t){o.push(goog.string.toSelectorCase(t),":",e,";")}),o.join("")},goog.style.setFloat=function(e,o){e.style[goog.userAgent.IE?"styleFloat":"cssFloat"]=o},goog.style.getFloat=function(e){return e.style[goog.userAgent.IE?"styleFloat":"cssFloat"]||""},goog.style.getScrollbarWidth=function(e){var o=goog.dom.createElement("DIV");return e&&(o.className=e),o.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px",e=goog.dom.createElement("DIV"),goog.style.setSize(e,"200px","200px"),o.appendChild(e),goog.dom.appendChild(goog.dom.getDocument().body,o),e=o.offsetWidth-o.clientWidth,goog.dom.removeNode(o),e},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(e){return e=goog.style.getComputedTransform(e),e&&(e=e.match(goog.style.MATRIX_TRANSLATION_REGEX_))?new goog.math.Coordinate(parseFloat(e[1]),parseFloat(e[2])):new goog.math.Coordinate(0,0)},goog.Thenable=function(){},goog.Thenable.prototype.then=function(e,o,t){},goog.Thenable.IMPLEMENTED_BY_PROP="$goog_Thenable",goog.Thenable.addImplementation=function(e){e.prototype.then=e.prototype.then,COMPILED?e.prototype[goog.Thenable.IMPLEMENTED_BY_PROP]=!0:e.prototype.$goog_Thenable=!0},goog.Thenable.isImplementedBy=function(e){if(!e)return!1;try{return COMPILED?!!e[goog.Thenable.IMPLEMENTED_BY_PROP]:!!e.$goog_Thenable}catch(o){return!1}},goog.async={},goog.async.FreeList=function(e,o,t){this.limit_=t,this.create_=e,this.reset_=o,this.occupants_=0,this.head_=null},goog.async.FreeList.prototype.get=function(){var e;return 0<this.occupants_?(this.occupants_--,e=this.head_,this.head_=e.next,e.next=null):e=this.create_(),e},goog.async.FreeList.prototype.put=function(e){this.reset_(e),this.occupants_<this.limit_&&(this.occupants_++,e.next=this.head_,this.head_=e)},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(e){e.reset()},goog.async.WorkQueue.DEFAULT_MAX_UNUSED),goog.async.WorkQueue.prototype.add=function(e,o){var t=this.getUnusedItem_();t.set(e,o),this.workTail_?this.workTail_.next=t:(goog.asserts.assert(!this.workHead_),this.workHead_=t),this.workTail_=t},goog.async.WorkQueue.prototype.remove=function(){var e=null;return this.workHead_&&(e=this.workHead_,this.workHead_=this.workHead_.next,this.workHead_||(this.workTail_=null),e.next=null),e},goog.async.WorkQueue.prototype.returnUnused=function(e){goog.async.WorkQueue.freelist_.put(e)},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(e,o){this.fn=e,this.scope=o,this.next=null},goog.async.WorkItem.prototype.reset=function(){this.next=this.scope=this.fn=null},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=goog.functions.constant(!1),goog.functions.TRUE=goog.functions.constant(!0),
     
    1313var r=n.keys_[o++];return e?r:n.map_[r]},r},goog.structs.Map.hasKey_=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},goog.structs.Set=function(e){this.map_=new goog.structs.Map,e&&this.addAll(e)},goog.structs.Set.getKey_=function(e){var o=typeof e;return"object"==o&&e||"function"==o?"o"+goog.getUid(e):o.substr(0,1)+e},goog.structs.Set.prototype.getCount=function(){return this.map_.getCount()},goog.structs.Set.prototype.add=function(e){this.map_.set(goog.structs.Set.getKey_(e),e)},goog.structs.Set.prototype.addAll=function(e){e=goog.structs.getValues(e);for(var o=e.length,t=0;o>t;t++)this.add(e[t])},goog.structs.Set.prototype.removeAll=function(e){e=goog.structs.getValues(e);for(var o=e.length,t=0;o>t;t++)this.remove(e[t])},goog.structs.Set.prototype.remove=function(e){return this.map_.remove(goog.structs.Set.getKey_(e))},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(e){return this.map_.containsKey(goog.structs.Set.getKey_(e))},goog.structs.Set.prototype.containsAll=function(e){return goog.structs.every(e,this.contains,this)},goog.structs.Set.prototype.intersection=function(e){var o=new goog.structs.Set;e=goog.structs.getValues(e);for(var t=0;t<e.length;t++){var n=e[t];this.contains(n)&&o.add(n)}return o},goog.structs.Set.prototype.difference=function(e){var o=this.clone();return o.removeAll(e),o},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(e){return this.getCount()==goog.structs.getCount(e)&&this.isSubsetOf(e)},goog.structs.Set.prototype.isSubsetOf=function(e){var o=goog.structs.getCount(e);return this.getCount()>o?!1:(!(e instanceof goog.structs.Set)&&o>5&&(e=new goog.structs.Set(e)),goog.structs.every(this,function(o){return goog.structs.contains(e,o)}))},goog.structs.Set.prototype.__iterator__=function(e){return this.map_.__iterator__(!1)},goog.debug.LOGGING_ENABLED=goog.DEBUG,goog.debug.FORCE_SLOPPY_STACKS=!1,goog.debug.catchErrors=function(e,o,t){t=t||goog.global;var n=t.onerror,r=!!o;goog.userAgent.WEBKIT&&!goog.userAgent.isVersionOrHigher("535.3")&&(r=!r),t.onerror=function(o,t,i,s,l){return n&&n(o,t,i,s,l),e({message:o,fileName:t,line:i,col:s,error:l}),r}},goog.debug.expose=function(e,o){if("undefined"==typeof e)return"undefined";if(null==e)return"NULL";var t,n=[];for(t in e)if(o||!goog.isFunction(e[t])){var r=t+" = ";try{r+=e[t]}catch(i){r+="*** "+i+" ***"}n.push(r)}return n.join("\n")},goog.debug.deepExpose=function(e,o){var t=[],n=function(e,r,i){var s=r+"  ";i=new goog.structs.Set(i);try{if(goog.isDef(e))if(goog.isNull(e))t.push("NULL");else if(goog.isString(e))t.push('"'+e.replace(/\n/g,"\n"+r)+'"');else if(goog.isFunction(e))t.push(String(e).replace(/\n/g,"\n"+r));else if(goog.isObject(e))if(i.contains(e))t.push("*** reference loop detected ***");else{i.add(e),t.push("{");for(var l in e)(o||!goog.isFunction(e[l]))&&(t.push("\n"),t.push(s),t.push(l+" = "),n(e[l],s,i));t.push("\n"+r+"}")}else t.push(e);else t.push("undefined")}catch(g){t.push("*** "+g+" ***")}};return n(e,"",new goog.structs.Set),t.join("")},goog.debug.exposeArray=function(e){for(var o=[],t=0;t<e.length;t++)goog.isArray(e[t])?o.push(goog.debug.exposeArray(e[t])):o.push(e[t]);return"[ "+o.join(", ")+" ]"},goog.debug.exposeException=function(e,o){var t=goog.debug.exposeExceptionAsHtml(e,o);return goog.html.SafeHtml.unwrap(t)},goog.debug.exposeExceptionAsHtml=function(e,o){try{var t=goog.debug.normalizeErrorObject(e),n=goog.debug.createViewSourceUrl_(t.fileName);return goog.html.SafeHtml.concat(goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces("Message: "+t.message+"\nUrl: "),goog.html.SafeHtml.create("a",{href:n,target:"_new"},t.fileName),goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces("\nLine: "+t.lineNumber+"\n\nBrowser stack:\n"+t.stack+"-> [end]\n\nJS stack traversal:\n"+goog.debug.getStacktrace(o)+"-> "))}catch(r){return goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces("Exception trying to expose exception! You win, we lose. "+r)}},goog.debug.createViewSourceUrl_=function(e){return goog.isDefAndNotNull(e)||(e=""),/^https?:\/\//i.test(e)?(e=goog.html.SafeUrl.sanitize(e),goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("view-source scheme plus HTTP/HTTPS URL"),"view-source:"+goog.html.SafeUrl.unwrap(e))):goog.html.SafeUrl.fromConstant(goog.string.Const.from("sanitizedviewsrc"))},goog.debug.normalizeErrorObject=function(e){var o=goog.getObjectByName("window.location.href");if(goog.isString(e))return{message:e,name:"Unknown error",lineNumber:"Not available",fileName:o,stack:"Not available"};var t,n,r=!1;try{t=e.lineNumber||e.line||"Not available"}catch(i){t="Not available",r=!0}try{n=e.fileName||e.filename||e.sourceURL||goog.global.$googDebugFname||o}catch(i){n="Not available",r=!0}return!r&&e.lineNumber&&e.fileName&&e.stack&&e.message&&e.name?e:{message:e.message||"Not available",name:e.name||"UnknownError",lineNumber:t,fileName:n,stack:e.stack||"Not available"}},goog.debug.enhanceError=function(e,o){var t;if(e instanceof Error?t=e:(t=Error(e),Error.captureStackTrace&&Error.captureStackTrace(t,goog.debug.enhanceError)),t.stack||(t.stack=goog.debug.getStacktrace(goog.debug.enhanceError)),o){for(var n=0;t["message"+n];)++n;t["message"+n]=String(o)}return t},goog.debug.getStacktraceSimple=function(e){if(!goog.debug.FORCE_SLOPPY_STACKS){var o=goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);if(o)return o}for(var o=[],t=arguments.callee.caller,n=0;t&&(!e||e>n);){o.push(goog.debug.getFunctionName(t)),o.push("()\n");try{t=t.caller}catch(r){o.push("[exception trying to get caller]\n");break}if(n++,n>=goog.debug.MAX_STACK_DEPTH){o.push("[...long stack...]");break}}return e&&n>=e?o.push("[...reached max depth limit...]"):o.push("[end]"),o.join("")},goog.debug.MAX_STACK_DEPTH=50,goog.debug.getNativeStackTrace_=function(e){var o=Error();if(Error.captureStackTrace)return Error.captureStackTrace(o,e),String(o.stack);try{throw o}catch(t){o=t}return(e=o.stack)?String(e):null},goog.debug.getStacktrace=function(e){var o;return goog.debug.FORCE_SLOPPY_STACKS||(o=goog.debug.getNativeStackTrace_(e||goog.debug.getStacktrace)),o||(o=goog.debug.getStacktraceHelper_(e||arguments.callee.caller,[])),o},goog.debug.getStacktraceHelper_=function(e,o){var t=[];if(goog.array.contains(o,e))t.push("[...circular reference...]");else if(e&&o.length<goog.debug.MAX_STACK_DEPTH){t.push(goog.debug.getFunctionName(e)+"(");for(var n=e.arguments,r=0;n&&r<n.length;r++){r>0&&t.push(", ");var i;switch(i=n[r],typeof i){case"object":i=i?"object":"null";break;case"string":break;case"number":i=String(i);break;case"boolean":i=i?"true":"false";break;case"function":i=(i=goog.debug.getFunctionName(i))?i:"[fn]";break;default:i=typeof i}40<i.length&&(i=i.substr(0,40)+"..."),t.push(i)}o.push(e),t.push(")\n");try{t.push(goog.debug.getStacktraceHelper_(e.caller,o))}catch(s){t.push("[exception trying to get caller]\n")}}else e?t.push("[...long stack...]"):t.push("[end]");return t.join("")},goog.debug.setFunctionResolver=function(e){goog.debug.fnNameResolver_=e},goog.debug.getFunctionName=function(e){if(goog.debug.fnNameCache_[e])return goog.debug.fnNameCache_[e];if(goog.debug.fnNameResolver_){var o=goog.debug.fnNameResolver_(e);if(o)return goog.debug.fnNameCache_[e]=o}return e=String(e),goog.debug.fnNameCache_[e]||(o=/function ([^\(]+)/.exec(e),goog.debug.fnNameCache_[e]=o?o[1]:"[Anonymous]"),goog.debug.fnNameCache_[e]},goog.debug.makeWhitespaceVisible=function(e){return e.replace(/ /g,"[_]").replace(/\f/g,"[f]").replace(/\n/g,"[n]\n").replace(/\r/g,"[r]").replace(/\t/g,"[t]")},goog.debug.runtimeType=function(e){return e instanceof Function?e.displayName||e.name||"unknown type name":e instanceof Object?e.constructor.displayName||e.constructor.name||Object.prototype.toString.call(e):null===e?"null":typeof e},goog.debug.fnNameCache_={},goog.debug.LogRecord=function(e,o,t,n,r){this.reset(e,o,t,n,r)},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(e,o,t,n,r){goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS&&(this.sequenceNumber_="number"==typeof r?r:goog.debug.LogRecord.nextSequenceNumber_++),this.time_=n||goog.now(),this.level_=e,this.msg_=o,this.loggerName_=t,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(e){this.exception_=e},goog.debug.LogRecord.prototype.setLoggerName=function(e){this.loggerName_=e},goog.debug.LogRecord.prototype.getLevel=function(){return this.level_},goog.debug.LogRecord.prototype.setLevel=function(e){this.level_=e},goog.debug.LogRecord.prototype.getMessage=function(){return this.msg_},goog.debug.LogRecord.prototype.setMessage=function(e){this.msg_=e},goog.debug.LogRecord.prototype.getMillis=function(){return this.time_},goog.debug.LogRecord.prototype.setMillis=function(e){this.time_=e},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(){return goog.debug.LogBuffer.instance_||(goog.debug.LogBuffer.instance_=new goog.debug.LogBuffer),goog.debug.LogBuffer.instance_},goog.debug.LogBuffer.CAPACITY=0,goog.debug.LogBuffer.prototype.addRecord=function(e,o,t){var n=(this.curIndex_+1)%goog.debug.LogBuffer.CAPACITY;return this.curIndex_=n,this.isFull_?(n=this.buffer_[n],n.reset(e,o,t),n):(this.isFull_=n==goog.debug.LogBuffer.CAPACITY-1,this.buffer_[n]=new goog.debug.LogRecord(e,o,t))},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(e){var o=this.buffer_;if(o[0]){var t=this.curIndex_,n=this.isFull_?t:-1;do n=(n+1)%goog.debug.LogBuffer.CAPACITY,e(o[n]);while(n!=t)}},goog.debug.Logger=function(e){this.name_=e,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_HIERARCHY||(goog.debug.Logger.rootHandlers_=[]),goog.debug.Logger.Level=function(e,o){this.name=e,this.value=o},goog.debug.Logger.Level.prototype.toString=function(){return this.name},goog.debug.Logger.Level.OFF=new goog.debug.Logger.Level("OFF",1/0),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 e,o=0;e=goog.debug.Logger.Level.PREDEFINED_LEVELS[o];o++)goog.debug.Logger.Level.predefinedLevelsCache_[e.value]=e,goog.debug.Logger.Level.predefinedLevelsCache_[e.name]=e},goog.debug.Logger.Level.getPredefinedLevel=function(e){return goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_(),goog.debug.Logger.Level.predefinedLevelsCache_[e]||null},goog.debug.Logger.Level.getPredefinedLevelByValue=function(e){if(goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_(),e in goog.debug.Logger.Level.predefinedLevelsCache_)return goog.debug.Logger.Level.predefinedLevelsCache_[e];for(var o=0;o<goog.debug.Logger.Level.PREDEFINED_LEVELS.length;++o){var t=goog.debug.Logger.Level.PREDEFINED_LEVELS[o];if(t.value<=e)return t}return null},goog.debug.Logger.getLogger=function(e){return goog.debug.LogManager.getLogger(e)},goog.debug.Logger.logToProfilers=function(e){goog.global.console&&(goog.global.console.timeStamp?goog.global.console.timeStamp(e):goog.global.console.markTimeline&&goog.global.console.markTimeline(e)),goog.global.msWriteProfilerMark&&goog.global.msWriteProfilerMark(e)},goog.debug.Logger.prototype.getName=function(){return this.name_},goog.debug.Logger.prototype.addHandler=function(e){goog.debug.LOGGING_ENABLED&&(goog.debug.Logger.ENABLE_HIERARCHY?(this.handlers_||(this.handlers_=[]),this.handlers_.push(e)):(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(e)))},goog.debug.Logger.prototype.removeHandler=function(e){if(goog.debug.LOGGING_ENABLED){var o=goog.debug.Logger.ENABLE_HIERARCHY?this.handlers_:goog.debug.Logger.rootHandlers_;return!!o&&goog.array.remove(o,e)}return!1},goog.debug.Logger.prototype.getParent=function(){return this.parent_},goog.debug.Logger.prototype.getChildren=function(){return this.children_||(this.children_={}),this.children_},goog.debug.Logger.prototype.setLevel=function(e){goog.debug.LOGGING_ENABLED&&(goog.debug.Logger.ENABLE_HIERARCHY?this.level_=e:(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_=e))},goog.debug.Logger.prototype.getLevel=function(){return goog.debug.LOGGING_ENABLED?this.level_:goog.debug.Logger.Level.OFF},goog.debug.Logger.prototype.getEffectiveLevel=function(){return goog.debug.LOGGING_ENABLED?goog.debug.Logger.ENABLE_HIERARCHY?this.level_?this.level_:this.parent_?this.parent_.getEffectiveLevel():(goog.asserts.fail("Root logger has no level set."),null):goog.debug.Logger.rootLevel_:goog.debug.Logger.Level.OFF},goog.debug.Logger.prototype.isLoggable=function(e){return goog.debug.LOGGING_ENABLED&&e.value>=this.getEffectiveLevel().value},goog.debug.Logger.prototype.log=function(e,o,t){goog.debug.LOGGING_ENABLED&&this.isLoggable(e)&&(goog.isFunction(o)&&(o=o()),this.doLogRecord_(this.getLogRecord(e,o,t)))},goog.debug.Logger.prototype.getLogRecord=function(e,o,t){return e=goog.debug.LogBuffer.isBufferingEnabled()?goog.debug.LogBuffer.getInstance().addRecord(e,o,this.name_):new goog.debug.LogRecord(e,String(o),this.name_),t&&e.setException(t),e},goog.debug.Logger.prototype.shout=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.SHOUT,e,o)},goog.debug.Logger.prototype.severe=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.SEVERE,e,o)},goog.debug.Logger.prototype.warning=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.WARNING,e,o)},goog.debug.Logger.prototype.info=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.INFO,e,o)},goog.debug.Logger.prototype.config=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.CONFIG,e,o)},goog.debug.Logger.prototype.fine=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINE,e,o)},goog.debug.Logger.prototype.finer=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINER,e,o)},goog.debug.Logger.prototype.finest=function(e,o){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINEST,e,o)},goog.debug.Logger.prototype.logRecord=function(e){goog.debug.LOGGING_ENABLED&&this.isLoggable(e.getLevel())&&this.doLogRecord_(e)},goog.debug.Logger.prototype.doLogRecord_=function(e){if(goog.debug.Logger.logToProfilers("log:"+e.getMessage()),goog.debug.Logger.ENABLE_HIERARCHY)for(var o=this;o;)o.callPublish_(e),o=o.getParent();else for(var t,o=0;t=goog.debug.Logger.rootHandlers_[o++];)t(e)},goog.debug.Logger.prototype.callPublish_=function(e){if(this.handlers_)for(var o,t=0;o=this.handlers_[t];t++)o(e)},goog.debug.Logger.prototype.setParent_=function(e){this.parent_=e},goog.debug.Logger.prototype.addChild_=function(e,o){this.getChildren()[e]=o},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(){return goog.debug.LogManager.initialize(),goog.debug.LogManager.rootLogger_},goog.debug.LogManager.getLogger=function(e){return goog.debug.LogManager.initialize(),goog.debug.LogManager.loggers_[e]||goog.debug.LogManager.createLogger_(e)},goog.debug.LogManager.createFunctionForCatchErrors=function(e){return function(o){(e||goog.debug.LogManager.getRoot()).severe("Error: "+o.message+" ("+o.fileName+" @ Line: "+o.line+")")}},goog.debug.LogManager.createLogger_=function(e){var o=new goog.debug.Logger(e);if(goog.debug.Logger.ENABLE_HIERARCHY){var t=e.lastIndexOf("."),n=e.substr(0,t),t=e.substr(t+1),n=goog.debug.LogManager.getLogger(n);n.addChild_(t,o),o.setParent_(n)}return goog.debug.LogManager.loggers_[e]=o},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(e,o){if(goog.log.ENABLED){var t=goog.debug.LogManager.getLogger(e);return o&&t&&t.setLevel(o),t}return null},goog.log.addHandler=function(e,o){goog.log.ENABLED&&e&&e.addHandler(o)},goog.log.removeHandler=function(e,o){return goog.log.ENABLED&&e?e.removeHandler(o):!1},goog.log.log=function(e,o,t,n){goog.log.ENABLED&&e&&e.log(o,t,n)},goog.log.error=function(e,o,t){goog.log.ENABLED&&e&&e.severe(o,t)},goog.log.warning=function(e,o,t){goog.log.ENABLED&&e&&e.warning(o,t)},goog.log.info=function(e,o,t){goog.log.ENABLED&&e&&e.info(o,t)},goog.log.fine=function(e,o,t){goog.log.ENABLED&&e&&e.fine(o,t)},goog.string.StringBuffer=function(e,o){null!=e&&this.append.apply(this,arguments)},goog.string.StringBuffer.prototype.buffer_="",goog.string.StringBuffer.prototype.set=function(e){this.buffer_=""+e},goog.string.StringBuffer.prototype.append=function(e,o,t){if(this.buffer_+=String(e),null!=o)for(var n=1;n<arguments.length;n++)this.buffer_+=arguments[n];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(e,o,t){goog.ui.Component.call(this,t),this.config_=o||goog.ui.tree.BaseNode.defaultConfig,this.html_=goog.html.SafeHtml.htmlEscapePreservingNewlines(e),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 e=this.getElement();if(e){var o=this.getLabelElement();if(o&&!o.id&&(o.id=this.getId()+".label"),goog.a11y.aria.setRole(e,"treeitem"),goog.a11y.aria.setState(e,"selected",!1),goog.a11y.aria.setState(e,"expanded",!1),goog.a11y.aria.setState(e,"level",this.getDepth()),o&&goog.a11y.aria.setState(e,"labelledby",o.id),(e=this.getIconElement())&&goog.a11y.aria.setRole(e,"presentation"),(e=this.getExpandIconElement())&&goog.a11y.aria.setRole(e,"presentation"),(e=this.getChildrenElement())&&(goog.a11y.aria.setRole(e,"group"),e.hasChildNodes()))for(e=this.getChildCount(),o=1;e>=o;o++){var t=this.getChildAt(o-1).getElement();goog.asserts.assert(t,"The child element cannot be null"),goog.a11y.aria.setState(t,"setsize",e),goog.a11y.aria.setState(t,"posinset",o)}}},goog.ui.tree.BaseNode.prototype.createDom=function(){var e=this.getDomHelper().safeHtmlToNode(this.toSafeHtml());this.setElementInternal(e)},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(e,o,t){goog.asserts.assert(!e.getParent()),goog.asserts.assertInstanceof(e,goog.ui.tree.BaseNode),t=this.getChildAt(o-1);var n=this.getChildAt(o);if(goog.ui.tree.BaseNode.superClass_.addChildAt.call(this,e,o),e.previousSibling_=t,e.nextSibling_=n,t?t.nextSibling_=e:this.firstChild_=e,n?n.previousSibling_=e:this.lastChild_=e,(o=this.getTree())&&e.setTreeInternal(o),e.setDepth_(this.getDepth()+1),this.getElement()&&(this.updateExpandIcon(),this.getExpanded())){o=this.getChildrenElement(),e.getElement()||e.createDom();var r=e.getElement(),i=n&&n.getElement();o.insertBefore(r,i),this.isInDocument()&&e.enterDocument(),n||(t?t.updateExpandIcon():(goog.style.setElementShown(o,!0),this.setExpanded(this.getExpanded())))}},goog.ui.tree.BaseNode.prototype.add=function(e,o){return goog.asserts.assert(!o||o.getParent()==this,"Can only add nodes before siblings"),e.getParent()&&e.getParent().removeChild(e),this.addChildAt(e,o?this.indexOfChild(o):this.getChildCount()),e},goog.ui.tree.BaseNode.prototype.removeChild=function(e,o){var t=this.getTree(),n=t?t.getSelectedItem():null;if((n==e||e.contains(n))&&(t.hasFocus()?(this.select(),goog.Timer.callOnce(this.onTimeoutSelect_,10,this)):this.select()),goog.ui.tree.BaseNode.superClass_.removeChild.call(this,e),this.lastChild_==e&&(this.lastChild_=e.previousSibling_),this.firstChild_==e&&(this.firstChild_=e.nextSibling_),e.previousSibling_&&(e.previousSibling_.nextSibling_=e.nextSibling_),e.nextSibling_&&(e.nextSibling_.previousSibling_=e.previousSibling_),n=e.isLastSibling(),e.tree=null,e.depth_=-1,t&&(t.removeNode(e),this.isInDocument())){if(t=this.getChildrenElement(),e.isInDocument()){var r=e.getElement();t.removeChild(r),e.exitDocument()}n&&(n=this.getLastChild())&&n.updateExpandIcon(),this.hasChildren()||(t.style.display="none",this.updateExpandIcon(),this.updateIcon_())}return e},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 e=this.depth_;return 0>e&&(e=this.computeDepth_(),this.setDepth_(e)),e},goog.ui.tree.BaseNode.prototype.computeDepth_=function(){var e=this.getParent();return e?e.getDepth()+1:0},goog.ui.tree.BaseNode.prototype.setDepth_=function(e){if(e!=this.depth_){this.depth_=e;var o=this.getRowElement();if(o){var t=this.getPixelIndent_()+"px";this.isRightToLeft()?o.style.paddingRight=t:o.style.paddingLeft=t}this.forEachChild(function(o){o.setDepth_(e+1)})}},goog.ui.tree.BaseNode.prototype.contains=function(e){for(;e;){if(e==this)return!0;e=e.getParent()}return!1},goog.ui.tree.BaseNode.EMPTY_CHILDREN_=[],goog.ui.tree.BaseNode.prototype.getChildren=function(){var e=[];return this.forEachChild(function(o){e.push(o)}),e},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 e=this.getTree();e&&e.setSelectedItem(this)},goog.ui.tree.BaseNode.prototype.deselect=goog.nullFunction,goog.ui.tree.BaseNode.prototype.setSelectedInternal=function(e){if(this.selected_!=e){this.selected_=e,this.updateRow();var o=this.getElement();o&&(goog.a11y.aria.setState(o,"selected",e),e&&(e=this.getTree().getElement(),goog.asserts.assert(e,"The DOM element for the tree cannot be null"),goog.a11y.aria.setState(e,"activedescendant",this.getId())))}},goog.ui.tree.BaseNode.prototype.getExpanded=function(){return this.expanded_},goog.ui.tree.BaseNode.prototype.setExpandedInternal=function(e){this.expanded_=e},goog.ui.tree.BaseNode.prototype.setExpanded=function(e){var o=e!=this.expanded_;if(!o||this.dispatchEvent(e?goog.ui.tree.BaseNode.EventType.BEFORE_EXPAND:goog.ui.tree.BaseNode.EventType.BEFORE_COLLAPSE)){var t;this.expanded_=e,t=this.getTree();var n=this.getElement();if(this.hasChildren()){if(!e&&t&&this.contains(t.getSelectedItem())&&this.select(),n){if((t=this.getChildrenElement())&&(goog.style.setElementShown(t,e),e&&this.isInDocument()&&!t.hasChildNodes())){var r=[];this.forEachChild(function(e){r.push(e.toSafeHtml())}),goog.dom.safe.setInnerHtml(t,goog.html.SafeHtml.concat(r)),this.forEachChild(function(e){e.enterDocument()})}this.updateExpandIcon()}}else(t=this.getChildrenElement())&&goog.style.setElementShown(t,!1);n&&(this.updateIcon_(),goog.a11y.aria.setState(n,"expanded",e)),o&&this.dispatchEvent(e?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(e){e.collapseAll()})},goog.ui.tree.BaseNode.prototype.collapseAll=function(){this.collapseChildren(),this.collapse()},goog.ui.tree.BaseNode.prototype.expandChildren=function(){this.forEachChild(function(e){e.expandAll()})},goog.ui.tree.BaseNode.prototype.expandAll=function(){this.expandChildren(),this.expand()},goog.ui.tree.BaseNode.prototype.reveal=function(){var e=this.getParent();e&&(e.setExpanded(!0),e.reveal())},goog.ui.tree.BaseNode.prototype.setIsUserCollapsible=function(e){(this.isUserCollapsible_=e)||this.expand(),this.getElement()&&this.updateExpandIcon()},goog.ui.tree.BaseNode.prototype.isUserCollapsible=function(){return this.isUserCollapsible_},goog.ui.tree.BaseNode.prototype.toSafeHtml=function(){var e=this.getTree(),o=!e.getShowLines()||e==this.getParent()&&!e.getShowRootLines()?this.config_.cssChildrenNoLines:this.config_.cssChildren,e=this.getExpanded()&&this.hasChildren(),o={"class":o,style:this.getLineStyle()},t=[];return e&&this.forEachChild(function(e){t.push(e.toSafeHtml())}),e=goog.html.SafeHtml.create("div",o,t),goog.html.SafeHtml.create("div",{"class":this.config_.cssItem,id:this.getId()},[this.getRowSafeHtml(),e])},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 e={};e["padding-"+(this.isRightToLeft()?"right":"left")]=this.getPixelIndent_()+"px";var e={"class":this.getRowClassName(),style:e},o=[this.getExpandIconSafeHtml(),this.getIconSafeHtml(),this.getLabelSafeHtml()];return goog.html.SafeHtml.create("div",e,o)},goog.ui.tree.BaseNode.prototype.getRowClassName=function(){var e;return e=this.isSelected()?" "+this.config_.cssSelectedRow:"",this.config_.cssTreeRow+e},goog.ui.tree.BaseNode.prototype.getLabelSafeHtml=function(){var e=goog.html.SafeHtml.create("span",{"class":this.config_.cssItemLabel,title:this.getToolTip()||null},this.getSafeHtml());return goog.html.SafeHtml.concat(e,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(e){this.afterLabelHtml_=e;var o=this.getAfterLabelElement();o&&goog.dom.safe.setInnerHtml(o,e)},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 e=this.getTree(),o=!e.getShowLines()||e==this.getParent()&&!e.getShowRootLines(),t=this.config_,n=new goog.string.StringBuffer;if(n.append(t.cssTreeIcon," ",t.cssExpandTreeIcon," "),this.hasChildren()){var r=0;switch(e.getShowExpandIcons()&&this.isUserCollapsible_&&(r=this.getExpanded()?2:1),o||(r=this.isLastSibling()?r+4:r+8),r){case 1:n.append(t.cssExpandTreeIconPlus);break;case 2:n.append(t.cssExpandTreeIconMinus);break;case 4:n.append(t.cssExpandTreeIconL);break;case 5:n.append(t.cssExpandTreeIconLPlus);break;case 6:n.append(t.cssExpandTreeIconLMinus);break;case 8:n.append(t.cssExpandTreeIconT);break;case 9:n.append(t.cssExpandTreeIconTPlus);break;case 10:n.append(t.cssExpandTreeIconTMinus);break;default:n.append(t.cssExpandTreeIconBlank)}}else o?n.append(t.cssExpandTreeIconBlank):this.isLastSibling()?n.append(t.cssExpandTreeIconL):n.append(t.cssExpandTreeIconT);return n.toString()},goog.ui.tree.BaseNode.prototype.getLineStyle=function(){var e=this.getExpanded()&&this.hasChildren();return goog.html.SafeStyle.create({"background-position":this.getBackgroundPosition(),display:e?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 e=goog.ui.tree.BaseNode.superClass_.getElement.call(this);return e||(e=this.getDomHelper().getElement(this.getId()),this.setElementInternal(e)),e},goog.ui.tree.BaseNode.prototype.getRowElement=function(){var e=this.getElement();return e?e.firstChild:null},goog.ui.tree.BaseNode.prototype.getExpandIconElement=function(){var e=this.getRowElement();return e?e.firstChild:null},goog.ui.tree.BaseNode.prototype.getIconElement=function(){var e=this.getRowElement();return e?e.childNodes[1]:null},goog.ui.tree.BaseNode.prototype.getLabelElement=function(){var e=this.getRowElement();
    1414return e&&e.lastChild?e.lastChild.previousSibling:null},goog.ui.tree.BaseNode.prototype.getAfterLabelElement=function(){var e=this.getRowElement();return e?e.lastChild:null},goog.ui.tree.BaseNode.prototype.getChildrenElement=function(){var e=this.getElement();return e?e.lastChild:null},goog.ui.tree.BaseNode.prototype.setIconClass=function(e){this.iconClass_=e,this.isInDocument()&&this.updateIcon_()},goog.ui.tree.BaseNode.prototype.getIconClass=function(){return this.iconClass_},goog.ui.tree.BaseNode.prototype.setExpandedIconClass=function(e){this.expandedIconClass_=e,this.isInDocument()&&this.updateIcon_()},goog.ui.tree.BaseNode.prototype.getExpandedIconClass=function(){return this.expandedIconClass_},goog.ui.tree.BaseNode.prototype.setText=function(e){this.setSafeHtml(goog.html.SafeHtml.htmlEscape(e))},goog.ui.tree.BaseNode.prototype.getText=function(){return goog.string.unescapeEntities(goog.html.SafeHtml.unwrap(this.html_))},goog.ui.tree.BaseNode.prototype.setSafeHtml=function(e){this.html_=e;var o=this.getLabelElement();o&&goog.dom.safe.setInnerHtml(o,e),(e=this.getTree())&&e.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(e){this.toolTip_=e;var o=this.getLabelElement();o&&(o.title=e)},goog.ui.tree.BaseNode.prototype.getToolTip=function(){return this.toolTip_},goog.ui.tree.BaseNode.prototype.updateRow=function(){var e=this.getRowElement();e&&(e.className=this.getRowClassName())},goog.ui.tree.BaseNode.prototype.updateExpandIcon=function(){var e=this.getExpandIconElement();e&&(e.className=this.getExpandIconClass()),(e=this.getChildrenElement())&&(e.style.backgroundPosition=this.getBackgroundPosition())},goog.ui.tree.BaseNode.prototype.updateIcon_=function(){this.getIconElement().className=this.getCalculatedIconClass()},goog.ui.tree.BaseNode.prototype.onMouseDown=function(e){"expand"==e.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(e){"expand"==e.target.getAttribute("type")&&this.hasChildren()||this.isUserCollapsible_&&this.toggle()},goog.ui.tree.BaseNode.prototype.onKeyDown=function(e){var o=!0;switch(e.keyCode){case goog.events.KeyCodes.RIGHT:if(e.altKey)break;this.hasChildren()&&(this.getExpanded()?this.getFirstChild().select():this.setExpanded(!0));break;case goog.events.KeyCodes.LEFT:if(e.altKey)break;if(this.hasChildren()&&this.getExpanded()&&this.isUserCollapsible_)this.setExpanded(!1);else{var t=this.getParent(),n=this.getTree();t&&(n.getShowRootNode()||t!=n)&&t.select()}break;case goog.events.KeyCodes.DOWN:(t=this.getNextShownNode())&&t.select();break;case goog.events.KeyCodes.UP:(t=this.getPreviousShownNode())&&t.select();break;default:o=!1}return o&&(e.preventDefault(),(n=this.getTree())&&n.clearTypeAhead()),o},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 e,o=this;o!=this.getTree();){if(e=o.getNextSibling(),null!=e)return e;o=o.getParent()}return null},goog.ui.tree.BaseNode.prototype.getPreviousShownNode=function(){var e=this.getPreviousSibling();if(null!=e)return e.getLastShownDescendant();var e=this.getParent(),o=this.getTree();return!o.getShowRootNode()&&e==o||this==o?null:e},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(e){this.tree!=e&&(this.tree=e,e.setNode(this),this.forEachChild(function(o){o.setTreeInternal(e)}))},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.ui.tree.TreeNode=function(e,o,t){goog.ui.tree.BaseNode.call(this,e,o,t)},goog.inherits(goog.ui.tree.TreeNode,goog.ui.tree.BaseNode),goog.ui.tree.TreeNode.prototype.getTree=function(){if(this.tree)return this.tree;var e=this.getParent();return e&&(e=e.getTree())?(this.setTreeInternal(e),e):null},goog.ui.tree.TreeNode.prototype.getCalculatedIconClass=function(){var e=this.getExpanded(),o=this.getExpandedIconClass();if(e&&o)return o;if(o=this.getIconClass(),!e&&o)return o;if(o=this.getConfig(),this.hasChildren()){if(e&&o.cssExpandedFolderIcon)return o.cssTreeIcon+" "+o.cssExpandedFolderIcon;if(!e&&o.cssCollapsedFolderIcon)return o.cssTreeIcon+" "+o.cssCollapsedFolderIcon}else if(o.cssFileIcon)return o.cssTreeIcon+" "+o.cssFileIcon;return""},goog.structs.Trie=function(e){this.value_=void 0,this.childNodes_={},e&&this.setAll(e)},goog.structs.Trie.prototype.set=function(e,o){this.setOrAdd_(e,o,!1)},goog.structs.Trie.prototype.add=function(e,o){this.setOrAdd_(e,o,!0)},goog.structs.Trie.prototype.setOrAdd_=function(e,o,t){for(var n=this,r=0;r<e.length;r++){var i=e.charAt(r);n.childNodes_[i]||(n.childNodes_[i]=new goog.structs.Trie),n=n.childNodes_[i]}if(t&&void 0!==n.value_)throw Error('The collection already contains the key "'+e+'"');n.value_=o},goog.structs.Trie.prototype.setAll=function(e){var o=goog.structs.getKeys(e);e=goog.structs.getValues(e);for(var t=0;t<o.length;t++)this.set(o[t],e[t])},goog.structs.Trie.prototype.getChildNode_=function(e){for(var o=this,t=0;t<e.length;t++){var n=e.charAt(t),o=o.childNodes_[n];if(!o)return}return o},goog.structs.Trie.prototype.get=function(e){return(e=this.getChildNode_(e))?e.value_:void 0},goog.structs.Trie.prototype.getKeyAndPrefixes=function(e,o){var t=this,n={},r=o||0;for(void 0!==t.value_&&(n[r]=t.value_);r<e.length;r++){var i=e.charAt(r);if(!(i in t.childNodes_))break;t=t.childNodes_[i],void 0!==t.value_&&(n[r]=t.value_)}return n},goog.structs.Trie.prototype.getValues=function(){var e=[];return this.getValuesInternal_(e),e},goog.structs.Trie.prototype.getValuesInternal_=function(e){void 0!==this.value_&&e.push(this.value_);for(var o in this.childNodes_)this.childNodes_[o].getValuesInternal_(e)},goog.structs.Trie.prototype.getKeys=function(e){var o=[];if(e){for(var t=this,n=0;n<e.length;n++){var r=e.charAt(n);if(!t.childNodes_[r])return[];t=t.childNodes_[r]}t.getKeysInternal_(e,o)}else this.getKeysInternal_("",o);return o},goog.structs.Trie.prototype.getKeysInternal_=function(e,o){void 0!==this.value_&&o.push(e);for(var t in this.childNodes_)this.childNodes_[t].getKeysInternal_(e+t,o)},goog.structs.Trie.prototype.containsKey=function(e){return void 0!==this.get(e)},goog.structs.Trie.prototype.containsPrefix=function(e){return 0==e.length?!this.isEmpty():!!this.getChildNode_(e)},goog.structs.Trie.prototype.containsValue=function(e){if(this.value_===e)return!0;for(var o in this.childNodes_)if(this.childNodes_[o].containsValue(e))return!0;return!1},goog.structs.Trie.prototype.clear=function(){this.childNodes_={},this.value_=void 0},goog.structs.Trie.prototype.remove=function(e){for(var o=this,t=[],n=0;n<e.length;n++){var r=e.charAt(n);if(!o.childNodes_[r])throw Error('The collection does not have the key "'+e+'"');t.push([o,r]),o=o.childNodes_[r]}for(e=o.value_,delete o.value_;0<t.length&&(r=t.pop(),o=r[0],r=r[1],o.childNodes_[r].isEmpty());)delete o.childNodes_[r];return e},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(e){var o=!1;switch(e.keyCode){case goog.events.KeyCodes.DOWN:case goog.events.KeyCodes.UP:e.ctrlKey&&(this.jumpTo_(e.keyCode==goog.events.KeyCodes.DOWN?goog.ui.tree.TypeAhead.Offset.DOWN:goog.ui.tree.TypeAhead.Offset.UP),o=!0);break;case goog.events.KeyCodes.BACKSPACE:e=this.buffer_.length-1,o=!0,e>0?(this.buffer_=this.buffer_.substring(0,e),this.jumpToLabel_(this.buffer_)):0==e?this.buffer_="":o=!1;break;case goog.events.KeyCodes.ESC:this.buffer_="",o=!0}return o},goog.ui.tree.TypeAhead.prototype.handleTypeAheadChar=function(e){var o=!1;return e.ctrlKey||e.altKey||(e=String.fromCharCode(e.charCode||e.keyCode).toLowerCase(),goog.string.isUnicodeChar(e)&&(" "!=e||this.buffer_)&&(this.buffer_+=e,o=this.jumpToLabel_(this.buffer_))),o},goog.ui.tree.TypeAhead.prototype.setNodeInMap=function(e){var o=e.getText();if(o&&!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(o))){var o=o.toLowerCase(),t=this.nodeMap_.get(o);t?t.push(e):this.nodeMap_.set(o,[e])}},goog.ui.tree.TypeAhead.prototype.removeNodeFromMap=function(e){var o=e.getText();if(o&&!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(o))){var o=o.toLowerCase(),t=this.nodeMap_.get(o);if(t){for(var n=e.getChildCount(),r=0;n>r;r++)this.removeNodeFromMap(e.getChildAt(r));goog.array.remove(t,e),t.length||this.nodeMap_.remove(o)}}},goog.ui.tree.TypeAhead.prototype.jumpToLabel_=function(e){var o=!1;return(e=this.nodeMap_.getKeys(e))&&e.length&&(this.matchingLabelIndex_=this.matchingNodeIndex_=0,o=this.nodeMap_.get(e[0]),o=this.selectMatchingNode_(o))&&(this.matchingLabels_=e),o},goog.ui.tree.TypeAhead.prototype.jumpTo_=function(e){var o=!1,t=this.matchingLabels_;if(t){var o=null,n=!1;if(this.matchingNodes_){var r=this.matchingNodeIndex_+e;r>=0&&r<this.matchingNodes_.length?(this.matchingNodeIndex_=r,o=this.matchingNodes_):n=!0}o||(r=this.matchingLabelIndex_+e,r>=0&&r<t.length&&(this.matchingLabelIndex_=r),t.length>this.matchingLabelIndex_&&(o=this.nodeMap_.get(t[this.matchingLabelIndex_])),o&&o.length&&n&&(this.matchingNodeIndex_=e==goog.ui.tree.TypeAhead.Offset.UP?o.length-1:0)),(o=this.selectMatchingNode_(o))&&(this.matchingLabels_=t)}return o},goog.ui.tree.TypeAhead.prototype.selectMatchingNode_=function(e){var o;return e&&(this.matchingNodeIndex_<e.length&&(o=e[this.matchingNodeIndex_],this.matchingNodes_=e),o&&(o.reveal(),o.select())),!!o},goog.ui.tree.TypeAhead.prototype.clear=function(){this.buffer_=""},goog.ui.tree.TreeControl=function(e,o,t){if(goog.ui.tree.BaseNode.call(this,e,o,t),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,goog.userAgent.IE)try{document.execCommand("BackgroundImageCache",!1,!0)}catch(n){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(e){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(e){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(e){this.showRootNode_?goog.ui.tree.TreeControl.superClass_.setExpanded.call(this,e):this.setExpandedInternal(e)},goog.ui.tree.TreeControl.prototype.getExpandIconSafeHtml=function(){return goog.html.SafeHtml.EMPTY},goog.ui.tree.TreeControl.prototype.getIconElement=function(){var e=this.getRowElement();return e?e.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 e=this.getExpanded(),o=this.getExpandedIconClass();return e&&o?o:(o=this.getIconClass(),!e&&o?o:(o=this.getConfig(),e&&o.cssExpandedRootIcon?o.cssTreeIcon+" "+o.cssExpandedRootIcon:!e&&o.cssCollapsedRootIcon?o.cssTreeIcon+" "+o.cssCollapsedRootIcon:""))},goog.ui.tree.TreeControl.prototype.setSelectedItem=function(e){if(this.selectedItem_!=e){var o=!1;this.selectedItem_&&(o=this.selectedItem_==this.focusedNode_,this.selectedItem_.setSelectedInternal(!1)),(this.selectedItem_=e)&&(e.setSelectedInternal(!0),o&&e.select()),this.dispatchEvent(goog.events.EventType.CHANGE)}},goog.ui.tree.TreeControl.prototype.getSelectedItem=function(){return this.selectedItem_},goog.ui.tree.TreeControl.prototype.setShowLines=function(e){this.showLines_!=e&&(this.showLines_=e,this.isInDocument()&&this.updateLinesAndExpandIcons_())},goog.ui.tree.TreeControl.prototype.getShowLines=function(){return this.showLines_},goog.ui.tree.TreeControl.prototype.updateLinesAndExpandIcons_=function(){function e(r){var i=r.getChildrenElement();if(i){var s=!t||o==r.getParent()&&!n?r.getConfig().cssChildrenNoLines:r.getConfig().cssChildren;i.className=s,(i=r.getExpandIconElement())&&(i.className=r.getExpandIconClass())}r.forEachChild(e)}var o=this,t=o.getShowLines(),n=o.getShowRootLines();e(this)},goog.ui.tree.TreeControl.prototype.setShowRootLines=function(e){this.showRootLines_!=e&&(this.showRootLines_=e,this.isInDocument()&&this.updateLinesAndExpandIcons_())},goog.ui.tree.TreeControl.prototype.getShowRootLines=function(){return this.showRootLines_},goog.ui.tree.TreeControl.prototype.setShowExpandIcons=function(e){this.showExpandIcons_!=e&&(this.showExpandIcons_=e,this.isInDocument()&&this.updateLinesAndExpandIcons_())},goog.ui.tree.TreeControl.prototype.getShowExpandIcons=function(){return this.showExpandIcons_},goog.ui.tree.TreeControl.prototype.setShowRootNode=function(e){if(this.showRootNode_!=e){if(this.showRootNode_=e,this.isInDocument()){var o=this.getRowElement();o&&(o.className=this.getRowClassName())}!e&&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 e=this.getElement();goog.asserts.assert(e,"The DOM element for the tree cannot be null."),goog.a11y.aria.setRole(e,"tree"),goog.a11y.aria.setState(e,"labelledby",this.getLabelElement().id)},goog.ui.tree.TreeControl.prototype.enterDocument=function(){goog.ui.tree.TreeControl.superClass_.enterDocument.call(this);var e=this.getElement();e.className=this.getConfig().cssRoot,e.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 e=this.getElement();e.tabIndex=0;var o=this.keyHandler_=new goog.events.KeyHandler(e),t=this.focusHandler_=new goog.events.FocusHandler(e);this.getHandler().listen(t,goog.events.FocusHandler.EventType.FOCUSOUT,this.handleBlur_).listen(t,goog.events.FocusHandler.EventType.FOCUSIN,this.handleFocus_).listen(o,goog.events.KeyHandler.EventType.KEY,this.handleKeyEvent).listen(e,goog.events.EventType.MOUSEDOWN,this.handleMouseEvent_).listen(e,goog.events.EventType.CLICK,this.handleMouseEvent_).listen(e,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(e){goog.log.fine(this.logger_,"Received event "+e.type);var o=this.getNodeFromEvent_(e);if(o)switch(e.type){case goog.events.EventType.MOUSEDOWN:o.onMouseDown(e);break;case goog.events.EventType.CLICK:o.onClick_(e);break;case goog.events.EventType.DBLCLICK:o.onDoubleClick_(e)}},goog.ui.tree.TreeControl.prototype.handleKeyEvent=function(e){var o;return(o=this.typeAhead_.handleNavigation(e)||this.selectedItem_&&this.selectedItem_.onKeyDown(e)||this.typeAhead_.handleTypeAheadChar(e))&&e.preventDefault(),o},goog.ui.tree.TreeControl.prototype.getNodeFromEvent_=function(e){for(var o=e.target;null!=o;){if(e=goog.ui.tree.BaseNode.allNodes[o.id])return e;if(o==this.getElement())break;o=o.parentNode}return null},goog.ui.tree.TreeControl.prototype.createNode=function(e){return new goog.ui.tree.TreeNode(e||goog.html.SafeHtml.EMPTY,this.getConfig(),this.getDomHelper())},goog.ui.tree.TreeControl.prototype.setNode=function(e){this.typeAhead_.setNodeInMap(e)},goog.ui.tree.TreeControl.prototype.removeNode=function(e){this.typeAhead_.removeNodeFromMap(e)},goog.ui.tree.TreeControl.prototype.clearTypeAhead=function(){this.typeAhead_.clear()},goog.ui.tree.TreeControl.defaultConfig=goog.ui.tree.BaseNode.defaultConfig;var Blockly={Blocks:{}};Blockly.Touch={},Blockly.Touch.touchIdentifier_=null,Blockly.Touch.onTouchUpWrapper_=null,Blockly.Touch.TOUCH_MAP={},goog.events.BrowserFeature.TOUCH_ENABLED&&(Blockly.Touch.TOUCH_MAP={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]}),Blockly.longPid_=0,Blockly.longStart_=function(e,o){Blockly.longStop_(),Blockly.longPid_=setTimeout(function(){e.button=2,o.onMouseDown_(e)},Blockly.LONGPRESS)},Blockly.longStop_=function(){Blockly.longPid_&&(clearTimeout(Blockly.longPid_),Blockly.longPid_=0)},Blockly.onMouseUp_=function(e){e=Blockly.getMainWorkspace(),e.dragMode_!=Blockly.DRAG_NONE&&(Blockly.Touch.clearTouchIdentifier(),Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN),e.dragMode_=Blockly.DRAG_NONE,Blockly.Touch.onTouchUpWrapper_&&(Blockly.unbindEvent_(Blockly.Touch.onTouchUpWrapper_),Blockly.Touch.onTouchUpWrapper_=null),Blockly.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.onMouseMoveWrapper_),Blockly.onMouseMoveWrapper_=null))},Blockly.onMouseMove_=function(e){var o=Blockly.getMainWorkspace();if(o.dragMode_!=Blockly.DRAG_NONE){var t=e.clientX-o.startDragMouseX,n=e.clientY-o.startDragMouseY,r=o.startDragMetrics,i=o.startScrollX+t,s=o.startScrollY+n,i=Math.min(i,-r.contentLeft),s=Math.min(s,-r.contentTop),i=Math.max(i,r.viewWidth-r.contentLeft-r.contentWidth),s=Math.max(s,r.viewHeight-r.contentTop-r.contentHeight);o.scrollbar.set(-i-r.contentLeft,-s-r.contentTop),Math.sqrt(t*t+n*n)>Blockly.DRAG_RADIUS&&(Blockly.longStop_(),o.dragMode_=Blockly.DRAG_FREE),e.stopPropagation(),e.preventDefault()}},Blockly.Touch.clearTouchIdentifier=function(){Blockly.Touch.touchIdentifier_=null},Blockly.Touch.shouldHandleEvent=function(e){return!Blockly.Touch.isMouseOrTouchEvent(e)||Blockly.Touch.checkTouchIdentifier(e)},Blockly.Touch.checkTouchIdentifier=function(e){var o=e.changedTouches&&e.changedTouches[0]&&void 0!=e.changedTouches[0].identifier&&null!=e.changedTouches[0].identifier?e.changedTouches[0].identifier:"mouse";return void 0!=Blockly.Touch.touchIdentifier_&&null!=Blockly.Touch.touchIdentifier_?Blockly.Touch.touchIdentifier_==o:"mousedown"==e.type||"touchstart"==e.type?(Blockly.Touch.touchIdentifier_=o,!0):!1},Blockly.Touch.setClientFromTouch=function(e){if(goog.string.startsWith(e.type,"touch")){var o=e.changedTouches[0];e.clientX=o.clientX,e.clientY=o.clientY}},Blockly.Touch.isMouseOrTouchEvent=function(e){return goog.string.startsWith(e.type,"touch")||goog.string.startsWith(e.type,"mouse")},Blockly.Touch.splitEventByTouches=function(e){var o=[];if(e.changedTouches)for(var t=0;t<e.changedTouches.length;t++)o[t]={type:e.type,changedTouches:[e.changedTouches[t]],target:e.target,stopPropagation:function(){e.stopPropagation()},preventDefault:function(){e.preventDefault()}};else o.push(e);return o},Blockly.Workspace=function(e){this.id=Blockly.genUid(),Blockly.Workspace.WorkspaceDB_[this.id]=this,this.options=e||{},this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.topBlocks_=[],this.listeners_=[],this.undoStack_=[],this.redoStack_=[],this.blockDB_=Object.create(null),this.variableList=[]},Blockly.Workspace.prototype.rendered=!1,Blockly.Workspace.prototype.MAX_UNDO=1024,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.addTopBlock=function(e){if(this.topBlocks_.push(e),this.isFlyout){e=Blockly.Variables.allUsedVariables(e);for(var o=0;o<e.length;o++)-1==this.variableList.indexOf(e[o])&&this.variableList.push(e[o])}},Blockly.Workspace.prototype.removeTopBlock=function(e){if(!goog.array.remove(this.topBlocks_,e))throw"Block not present in workspace's list of top-most blocks."},Blockly.Workspace.prototype.getTopBlocks=function(e){var o=[].concat(this.topBlocks_);if(e&&1<o.length){var t=Math.sin(goog.math.toRadians(Blockly.Workspace.SCAN_ANGLE));this.RTL&&(t*=-1),o.sort(function(e,o){var n=e.getRelativeToSurfaceXY(),r=o.getRelativeToSurfaceXY();return n.y+t*n.x-(r.y+t*r.x)})}return o},Blockly.Workspace.prototype.getAllBlocks=function(){for(var e=this.getTopBlocks(!1),o=0;o<e.length;o++)e.push.apply(e,e[o].getChildren());return e},Blockly.Workspace.prototype.clear=function(){var e=Blockly.Events.getGroup();for(e||Blockly.Events.setGroup(!0);this.topBlocks_.length;)this.topBlocks_[0].dispose();e||Blockly.Events.setGroup(!1),this.variableList.length=0},Blockly.Workspace.prototype.updateVariableList=function(e){if(!this.isFlyout){e&&(this.variableList.length=0),e=Blockly.Variables.allUsedVariables(this);for(var o=0;o<e.length;o++)this.createVariable(e[o])}},Blockly.Workspace.prototype.renameVariable=function(e,o){var t=this.variableIndexOf(e),n=this.variableIndexOf(o);if(-1!=n&&this.variableList[n]!=o)var r=this.variableList[n];Blockly.Events.setGroup(!0);for(var i=this.getAllBlocks(),s=0;s<i.length;s++)i[s].renameVar(e,o),r&&i[s].renameVar(r,o);Blockly.Events.setGroup(!1),t==n||-1!=t&&-1==n?this.variableList[t]=o:-1!=t&&-1!=n?(this.variableList[n]=o,this.variableList.splice(t,1)):(this.variableList.push(o),console.log("Tried to rename an non-existent variable."))},Blockly.Workspace.prototype.createVariable=function(e){-1==this.variableIndexOf(e)&&this.variableList.push(e)},Blockly.Workspace.prototype.getVariableUses=function(e){for(var o=[],t=this.getAllBlocks(),n=0;n<t.length;n++){var r=t[n].getVars();if(r)for(var i=0;i<r.length;i++){var s=r[i];s&&Blockly.Names.equals(s,e)&&o.push(t[n])}}return o},Blockly.Workspace.prototype.deleteVariable=function(e){var o=this,t=this.variableIndexOf(e);if(-1!=t){for(var n,r=function(){Blockly.Events.setGroup(!0);for(var e=0;e<i.length;e++)i[e].dispose(!0,!1);Blockly.Events.setGroup(!1),o.variableList.splice(t,1)},i=this.getVariableUses(e),s=0;n=i[s];s++)if("procedures_defnoreturn"==n.type||"procedures_defreturn"==n.type)return s=n.getFieldValue("NAME"),void Blockly.alert(Blockly.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",e).replace("%2",s));1<i.length?Blockly.confirm(Blockly.Msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",i.length).replace("%2",e),function(e){e&&r()}):r()}},Blockly.Workspace.prototype.variableIndexOf=function(e){for(var o,t=0;o=this.variableList[t];t++)if(Blockly.Names.equals(o,e))return t;return-1},Blockly.Workspace.prototype.getWidth=function(){return 0},Blockly.Workspace.prototype.newBlock=function(e,o){return new Blockly.Block(this,e,o)},Blockly.Workspace.prototype.remainingCapacity=function(){return isNaN(this.options.maxBlocks)?1/0:this.options.maxBlocks-this.getAllBlocks().length},Blockly.Workspace.prototype.undo=function(e){var o=e?this.redoStack_:this.undoStack_,t=e?this.undoStack_:this.redoStack_,n=o.pop();if(n){for(var r=[n];o.length&&n.group&&n.group==o[o.length-1].group;)r.push(o.pop());for(o=0;n=r[o];o++)t.push(n);for(r=Blockly.Events.filter(r,e),Blockly.Events.recordUndo=!1,o=0;n=r[o];o++)n.run(e);Blockly.Events.recordUndo=!0}},Blockly.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0,this.redoStack_.length=0,Blockly.Events.clearPendingUndo()},Blockly.Workspace.prototype.addChangeListener=function(e){return this.listeners_.push(e),e},Blockly.Workspace.prototype.removeChangeListener=function(e){goog.array.remove(this.listeners_,e)},Blockly.Workspace.prototype.fireChangeListener=function(e){e.recordUndo&&(this.undoStack_.push(e),this.redoStack_.length=0,this.undoStack_.length>this.MAX_UNDO&&this.undoStack_.unshift());for(var o,t=0;o=this.listeners_[t];t++)o(e)},Blockly.Workspace.prototype.getBlockById=function(e){return this.blockDB_[e]||null},Blockly.Workspace.WorkspaceDB_=Object.create(null),Blockly.Workspace.getById=function(e){return Blockly.Workspace.WorkspaceDB_[e]||null},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(e,o,t,n,r,i){this.workspace_=e,this.content_=o,this.shape_=t,t=Blockly.Bubble.ARROW_ANGLE,this.workspace_.RTL&&(t=-t),this.arrow_radians_=goog.math.toRadians(t),e.getBubbleCanvas().appendChild(this.createDom_(o,!(!r||!i))),this.setAnchorLocation(n),r&&i||(o=this.content_.getBBox(),r=o.width+2*Blockly.Bubble.BORDER_WIDTH,i=o.height+2*Blockly.Bubble.BORDER_WIDTH),this.setBubbleSize(r,i),this.positionBubble_(),this.renderArrow_(),this.rendered_=!0,e.options.readOnly||(Blockly.bindEventWithChecks_(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&Blockly.bindEventWithChecks_(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_))},Blockly.Bubble.BORDER_WIDTH=6,Blockly.Bubble.ARROW_THICKNESS=5,Blockly.Bubble.ARROW_ANGLE=20,Blockly.Bubble.ARROW_BEND=4,Blockly.Bubble.ANCHOR_RADIUS=8,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.Css.setCursor(Blockly.Css.Cursor.OPEN),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.createDom_=function(e,o){this.bubbleGroup_=Blockly.createSvgElement("g",{},null);var t={filter:"url(#"+this.workspace_.options.embossFilterId+")"};return-1!=goog.userAgent.getUserAgentString().indexOf("JavaFX")&&(t={}),t=Blockly.createSvgElement("g",t,this.bubbleGroup_),this.bubbleArrow_=Blockly.createSvgElement("path",{},t),this.bubbleBack_=Blockly.createSvgElement("rect",{"class":"blocklyDraggable",x:0,y:0,rx:Blockly.Bubble.BORDER_WIDTH,ry:Blockly.Bubble.BORDER_WIDTH},t),o?(this.resizeGroup_=Blockly.createSvgElement("g",{"class":this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),t=2*Blockly.Bubble.BORDER_WIDTH,Blockly.createSvgElement("polygon",{points:"0,x x,x x,0".replace(/x/g,t.toString())},this.resizeGroup_),Blockly.createSvgElement("line",{"class":"blocklyResizeLine",x1:t/3,y1:t-1,x2:t-1,y2:t/3},this.resizeGroup_),Blockly.createSvgElement("line",{"class":"blocklyResizeLine",x1:2*t/3,y1:t-1,x2:t-1,y2:2*t/3},this.resizeGroup_)):this.resizeGroup_=null,this.bubbleGroup_.appendChild(e),this.bubbleGroup_},Blockly.Bubble.prototype.bubbleMouseDown_=function(e){this.promote_(),Blockly.Bubble.unbindDragEvents_(),Blockly.isRightButton(e)?e.stopPropagation():Blockly.isTargetInput_(e)||(Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),this.workspace_.startDrag(e,new goog.math.Coordinate(this.workspace_.RTL?-this.relativeLeft_:this.relativeLeft_,this.relativeTop_)),Blockly.Bubble.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,Blockly.Bubble.bubbleMouseUp_),Blockly.Bubble.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.bubbleMouseMove_),Blockly.hideChaff(),e.stopPropagation())},Blockly.Bubble.prototype.bubbleMouseMove_=function(e){this.autoLayout_=!1,e=this.workspace_.moveDrag(e),this.relativeLeft_=this.workspace_.RTL?-e.x:e.x,this.relativeTop_=e.y,this.positionBubble_(),this.renderArrow_()},Blockly.Bubble.prototype.resizeMouseDown_=function(e){this.promote_(),Blockly.Bubble.unbindDragEvents_(),Blockly.isRightButton(e)||(Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),this.workspace_.startDrag(e,new goog.math.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()),e.stopPropagation()},Blockly.Bubble.prototype.resizeMouseMove_=function(e){this.autoLayout_=!1,e=this.workspace_.moveDrag(e),this.setBubbleSize(this.workspace_.RTL?-e.x:e.x,e.y),this.workspace_.RTL&&this.positionBubble_()},Blockly.Bubble.prototype.registerResizeEvent=function(e){this.resizeCallback_=e},Blockly.Bubble.prototype.promote_=function(){this.bubbleGroup_.parentNode.appendChild(this.bubbleGroup_)},Blockly.Bubble.prototype.setAnchorLocation=function(e){this.anchorXY_=e,this.rendered_&&this.positionBubble_()},Blockly.Bubble.prototype.layoutBubble_=function(){var e=-this.width_/4,o=-this.height_-Blockly.BlockSvg.MIN_BLOCK_Y,t=this.workspace_.getMetrics();t.viewWidth/=this.workspace_.scale,t.viewLeft/=this.workspace_.scale;var n=this.anchorXY_.x;this.workspace_.RTL?n-t.viewLeft-e-this.width_<Blockly.Scrollbar.scrollbarThickness?e=n-t.viewLeft-this.width_-Blockly.Scrollbar.scrollbarThickness:n-t.viewLeft-e>t.viewWidth&&(e=n-t.viewLeft-t.viewWidth):n+e<t.viewLeft?e=t.viewLeft-n:t.viewLeft+t.viewWidth<n+e+this.width_+Blockly.BlockSvg.SEP_SPACE_X+Blockly.Scrollbar.scrollbarThickness&&(e=t.viewLeft+t.viewWidth-n-this.width_-Blockly.Scrollbar.scrollbarThickness),
    15 this.anchorXY_.y+o<t.viewTop&&(o=this.shape_.getBBox().height),this.relativeLeft_=e,this.relativeTop_=o},Blockly.Bubble.prototype.positionBubble_=function(){var e=this.anchorXY_.x,e=this.workspace_.RTL?e-(this.relativeLeft_+this.width_):e+this.relativeLeft_;this.bubbleGroup_.setAttribute("transform","translate("+e+","+(this.relativeTop_+this.anchorXY_.y)+")")},Blockly.Bubble.prototype.getBubbleSize=function(){return{width:this.width_,height:this.height_}},Blockly.Bubble.prototype.setBubbleSize=function(e,o){var t=2*Blockly.Bubble.BORDER_WIDTH;e=Math.max(e,t+45),o=Math.max(o,t+20),this.width_=e,this.height_=o,this.bubbleBack_.setAttribute("width",e),this.bubbleBack_.setAttribute("height",o),this.resizeGroup_&&(this.workspace_.RTL?this.resizeGroup_.setAttribute("transform","translate("+2*Blockly.Bubble.BORDER_WIDTH+","+(o-t)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(e-t)+","+(o-t)+")")),this.rendered_&&(this.autoLayout_&&this.layoutBubble_(),this.positionBubble_(),this.renderArrow_()),this.resizeCallback_&&this.resizeCallback_()},Blockly.Bubble.prototype.renderArrow_=function(){var e=[],o=this.width_/2,t=this.height_/2,n=-this.relativeLeft_,r=-this.relativeTop_;if(o==n&&t==r)e.push("M "+o+","+t);else{r-=t,n-=o,this.workspace_.RTL&&(n*=-1);var i=Math.sqrt(r*r+n*n),s=Math.acos(n/i);0>r&&(s=2*Math.PI-s);var l=s+Math.PI/2;l>2*Math.PI&&(l-=2*Math.PI);var g=Math.sin(l),a=Math.cos(l),c=this.getBubbleSize(),l=(c.width+c.height)/Blockly.Bubble.ARROW_THICKNESS,l=Math.min(l,c.width,c.height)/4,c=1-Blockly.Bubble.ANCHOR_RADIUS/i,n=o+c*n,r=t+c*r,c=o+l*a,u=t+l*g,o=o-l*a,t=t-l*g,g=s+this.arrow_radians_;g>2*Math.PI&&(g-=2*Math.PI),s=Math.sin(g)*i/Blockly.Bubble.ARROW_BEND,i=Math.cos(g)*i/Blockly.Bubble.ARROW_BEND,e.push("M"+c+","+u),e.push("C"+(c+i)+","+(u+s)+" "+n+","+r+" "+n+","+r),e.push("C"+n+","+r+" "+(o+i)+","+(t+s)+" "+o+","+t)}e.push("z"),this.bubbleArrow_.setAttribute("d",e.join(" "))},Blockly.Bubble.prototype.setColour=function(e){this.bubbleBack_.setAttribute("fill",e),this.bubbleArrow_.setAttribute("fill",e)},Blockly.Bubble.prototype.dispose=function(){Blockly.Bubble.unbindDragEvents_(),goog.dom.removeNode(this.bubbleGroup_),this.shape_=this.content_=this.workspace_=this.resizeGroup_=this.bubbleBack_=this.bubbleArrow_=this.bubbleGroup_=null},Blockly.Icon=function(e){this.block_=e},Blockly.Icon.prototype.collapseHidden=!0,Blockly.Icon.prototype.SIZE=17,Blockly.Icon.prototype.bubble_=null,Blockly.Icon.prototype.iconXY_=null,Blockly.Icon.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=Blockly.createSvgElement("g",{"class":"blocklyIconGroup"},null),this.block_.isInFlyout&&Blockly.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(){goog.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(e){this.block_.workspace.isDragging()||this.block_.isInFlyout||Blockly.isRightButton(e)||this.setVisible(!this.isVisible())},Blockly.Icon.prototype.updateColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.getColour())},Blockly.Icon.prototype.renderIcon=function(e){if(this.collapseHidden&&this.block_.isCollapsed())return this.iconGroup_.setAttribute("display","none"),e;this.iconGroup_.setAttribute("display","block");var o=this.SIZE;return this.block_.RTL&&(e-=o),this.iconGroup_.setAttribute("transform","translate("+e+",5)"),this.computeIconLocation(),e=this.block_.RTL?e-Blockly.BlockSvg.SEP_SPACE_X:e+(o+Blockly.BlockSvg.SEP_SPACE_X)},Blockly.Icon.prototype.setIconLocation=function(e){this.iconXY_=e,this.isVisible()&&this.bubble_.setAnchorLocation(e)},Blockly.Icon.prototype.computeIconLocation=function(){var e=this.block_.getRelativeToSurfaceXY(),o=Blockly.getRelativeXY_(this.iconGroup_),e=new goog.math.Coordinate(e.x+o.x+this.SIZE/2,e.y+o.y+this.SIZE/2);goog.math.Coordinate.equals(this.getIconLocation(),e)||this.setIconLocation(e)},Blockly.Icon.prototype.getIconLocation=function(){return this.iconXY_},Blockly.Comment=function(e){Blockly.Comment.superClass_.constructor.call(this,e),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(e){Blockly.createSvgElement("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},e),Blockly.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.405 0.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25 -1.201,0.998 -1.201,1.528 -1.204,2.19z"},e),Blockly.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},e)},Blockly.Comment.prototype.createEditor_=function(){this.foreignObject_=Blockly.createSvgElement("foreignObject",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null);var e=document.createElementNS(Blockly.HTML_NS,"body");e.setAttribute("xmlns",Blockly.HTML_NS),e.className="blocklyMinimalBody";var o=document.createElementNS(Blockly.HTML_NS,"textarea");return o.className="blocklyCommentTextarea",o.setAttribute("dir",this.block_.RTL?"RTL":"LTR"),e.appendChild(o),this.textarea_=o,this.foreignObject_.appendChild(e),Blockly.bindEventWithChecks_(o,"mouseup",this,this.textareaFocus_),Blockly.bindEventWithChecks_(o,"wheel",this,function(e){e.stopPropagation()}),Blockly.bindEventWithChecks_(o,"change",this,function(e){this.text_!=o.value&&(Blockly.Events.fire(new Blockly.Events.Change(this.block_,"comment",null,this.text_,o.value)),this.text_=o.value)}),setTimeout(function(){o.focus()},0),this.foreignObject_},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 e=this.bubble_.getBubbleSize(),o=2*Blockly.Bubble.BORDER_WIDTH;this.foreignObject_.setAttribute("width",e.width-o),this.foreignObject_.setAttribute("height",e.height-o),this.textarea_.style.width=e.width-o-4+"px",this.textarea_.style.height=e.height-o-4+"px"}},Blockly.Comment.prototype.setVisible=function(e){if(e!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"commentOpen",!e,e)),!this.block_.isEditable()&&!this.textarea_||goog.userAgent.IE)Blockly.Warning.prototype.setVisible.call(this,e);else{var o=this.getText(),t=this.getBubbleSize();e?(this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svgPath_,this.iconXY_,this.width_,this.height_),this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this)),this.updateColour()):(this.bubble_.dispose(),this.foreignObject_=this.textarea_=this.bubble_=null),this.setText(o),this.setBubbleSize(t.width,t.height)}},Blockly.Comment.prototype.textareaFocus_=function(e){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(e,o){this.textarea_?this.bubble_.setBubbleSize(e,o):(this.width_=e,this.height_=o)},Blockly.Comment.prototype.getText=function(){return this.textarea_?this.textarea_.value:this.text_},Blockly.Comment.prototype.setText=function(e){this.text_!=e&&(Blockly.Events.fire(new Blockly.Events.Change(this.block_,"comment",null,this.text_,e)),this.text_=e),this.textarea_&&(this.textarea_.value=e)},Blockly.Comment.prototype.dispose=function(){Blockly.Events.isEnabled()&&this.setText(""),this.block_.comment=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Connection=function(e,o){this.sourceBlock_=e,this.type=o,e.workspace.connectionDBList&&(this.db_=e.workspace.connectionDBList[o],this.dbOpposite_=e.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[o]],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.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(e){var o=this,t=o.getSourceBlock(),n=e.getSourceBlock();if(e.isConnected()&&e.disconnect(),o.isConnected()){var r=o.targetBlock(),i=o.getShadowDom();if(o.setShadowDom(null),r.isShadow())i=Blockly.Xml.blockToDom(r),r.dispose(),r=null;else if(o.type==Blockly.INPUT_VALUE){if(!r.outputConnection)throw"Orphan block does not have an output connection.";var s=Blockly.Connection.lastConnectionInRow_(n,r);s&&(r.outputConnection.connect(s),r=null)}else if(o.type==Blockly.NEXT_STATEMENT){if(!r.previousConnection)throw"Orphan block does not have a previous connection.";for(s=n;s.nextConnection;){var l=s.getNextBlock();if(!l||l.isShadow()){r.previousConnection.checkType_(s.nextConnection)&&(s.nextConnection.connect(r.previousConnection),r=null);break}s=l}}if(r&&(o.disconnect(),Blockly.Events.recordUndo)){var g=Blockly.Events.getGroup();setTimeout(function(){r.workspace&&!r.getParent()&&(Blockly.Events.setGroup(g),r.outputConnection?r.outputConnection.bumpAwayFrom_(o):r.previousConnection&&r.previousConnection.bumpAwayFrom_(o),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}o.setShadowDom(i)}var a;Blockly.Events.isEnabled()&&(a=new Blockly.Events.Move(n)),Blockly.Connection.connectReciprocally_(o,e),n.setParent(t),a&&(a.recordNew(),Blockly.Events.fire(a))},Blockly.Connection.prototype.dispose=function(){if(this.isConnected())throw"Disconnect connection before disposing of it.";this.inDB_&&this.db_.removeConnection_(this),Blockly.highlightedConnection_==this&&(Blockly.highlightedConnection_=null),Blockly.localConnection_==this&&(Blockly.localConnection_=null),this.dbOpposite_=this.db_=null},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(e){if(!e)return Blockly.Connection.REASON_TARGET_NULL;if(this.isSuperior())var o=this.sourceBlock_,t=e.getSourceBlock();else t=this.sourceBlock_,o=e.getSourceBlock();return o&&o==t?Blockly.Connection.REASON_SELF_CONNECTION:e.type!=Blockly.OPPOSITE_TYPE[this.type]?Blockly.Connection.REASON_WRONG_TYPE:o&&t&&o.workspace!==t.workspace?Blockly.Connection.REASON_DIFFERENT_WORKSPACES:this.checkType_(e)?o.isShadow()&&!t.isShadow()?Blockly.Connection.REASON_SHADOW_PARENT:Blockly.Connection.CAN_CONNECT:Blockly.Connection.REASON_CHECKS_FAILED},Blockly.Connection.prototype.checkConnection_=function(e){switch(this.canConnectWithReason_(e)){case Blockly.Connection.CAN_CONNECT:break;case Blockly.Connection.REASON_SELF_CONNECTION:throw"Attempted to connect a block to itself.";case Blockly.Connection.REASON_DIFFERENT_WORKSPACES:throw"Blocks not on same workspace.";case Blockly.Connection.REASON_WRONG_TYPE:throw"Attempt to connect incompatible types.";case Blockly.Connection.REASON_TARGET_NULL:throw"Target connection is null.";case Blockly.Connection.REASON_CHECKS_FAILED:throw"Connection checks failed.";case Blockly.Connection.REASON_SHADOW_PARENT:throw"Connecting non-shadow to shadow block.";default:throw"Unknown connection failure: this should never happen!"}},Blockly.Connection.prototype.isConnectionAllowed=function(e){return this.canConnectWithReason_(e)!=Blockly.Connection.CAN_CONNECT?!1:e.type!=Blockly.OUTPUT_VALUE&&e.type!=Blockly.PREVIOUS_STATEMENT||!e.isConnected()&&!this.isConnected()?e.type==Blockly.INPUT_VALUE&&e.isConnected()&&!e.targetBlock().isMovable()&&!e.targetBlock().isShadow()||this.type==Blockly.PREVIOUS_STATEMENT&&e.isConnected()&&!this.sourceBlock_.nextConnection&&!e.targetBlock().isShadow()&&e.targetBlock().nextConnection||-1!=Blockly.draggingConnections_.indexOf(e)?!1:!0:!1},Blockly.Connection.prototype.connect=function(e){this.targetConnection!=e&&(this.checkConnection_(e),this.isSuperior()?this.connect_(e):e.connect_(this))},Blockly.Connection.connectReciprocally_=function(e,o){goog.asserts.assert(e&&o,"Cannot connect null connections."),e.targetConnection=o,o.targetConnection=e},Blockly.Connection.singleConnection_=function(e,o){for(var t=!1,n=0;n<e.inputList.length;n++){var r=e.inputList[n].connection;if(r&&r.type==Blockly.INPUT_VALUE&&o.outputConnection.checkType_(r)){if(t)return null;t=r}}return t},Blockly.Connection.lastConnectionInRow_=function(e,o){for(var t,n=e;t=Blockly.Connection.singleConnection_(n,o);)if(n=t.targetBlock(),!n||n.isShadow())return t;return null},Blockly.Connection.prototype.disconnect=function(){var e=this.targetConnection;goog.asserts.assert(e,"Source connection not connected."),goog.asserts.assert(e.targetConnection==this,"Target connection not connected to source connection.");var o,t;this.isSuperior()?(o=this.sourceBlock_,t=e.getSourceBlock(),e=this):(o=e.getSourceBlock(),t=this.sourceBlock_),this.disconnectInternal_(o,t),e.respawnShadow_()},Blockly.Connection.prototype.disconnectInternal_=function(e,o){var t;Blockly.Events.isEnabled()&&(t=new Blockly.Events.Move(o)),this.targetConnection=this.targetConnection.targetConnection=null,o.setParent(null),t&&(t.recordNew(),Blockly.Events.fire(t))},Blockly.Connection.prototype.respawnShadow_=function(){var e=this.getSourceBlock(),o=this.getShadowDom();if(e.workspace&&o&&Blockly.Events.recordUndo)if(e=Blockly.Xml.domToBlock(o,e.workspace),e.outputConnection)this.connect(e.outputConnection);else{if(!e.previousConnection)throw"Child block does not have output or previous statement.";this.connect(e.previousConnection)}},Blockly.Connection.prototype.targetBlock=function(){return this.isConnected()?this.targetConnection.getSourceBlock():null},Blockly.Connection.prototype.checkType_=function(e){if(!this.check_||!e.check_)return!0;for(var o=0;o<this.check_.length;o++)if(-1!=e.check_.indexOf(this.check_[o]))return!0;return!1},Blockly.Connection.prototype.setCheck=function(e){return e?(goog.isArray(e)||(e=[e]),this.check_=e,this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())):this.check_=null,this},Blockly.Connection.prototype.setShadowDom=function(e){this.shadowDom_=e},Blockly.Connection.prototype.getShadowDom=function(){return this.shadowDom_},Blockly.Field=function(e,o){this.size_=new goog.math.Size(0,25),this.setValue(e),this.setValidator(o)},Blockly.Field.cacheWidths_=null,Blockly.Field.cacheReference_=0,Blockly.Field.prototype.name=void 0,Blockly.Field.prototype.maxDisplayLength=50,Blockly.Field.prototype.text_="",Blockly.Field.prototype.sourceBlock_=null,Blockly.Field.prototype.visible_=!0,Blockly.Field.prototype.validator_=null,Blockly.Field.NBSP=" ",Blockly.Field.prototype.EDITABLE=!0,Blockly.Field.prototype.setSourceBlock=function(e){goog.asserts.assert(!this.sourceBlock_,"Field already bound to a block."),this.sourceBlock_=e},Blockly.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.borderRect_=Blockly.createSvgElement("rect",{rx:4,ry:4,x:-Blockly.BlockSvg.SEP_SPACE_X/2,y:0,height:16},this.fieldGroup_,this.sourceBlock_.workspace),this.textElement_=Blockly.createSvgElement("text",{"class":"blocklyText",y:this.size_.height-12.5},this.fieldGroup_),this.updateEditable(),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.mouseUpWrapper_=Blockly.bindEventWithChecks_(this.fieldGroup_,"mouseup",this,this.onMouseUp_),this.updateTextNode_())},Blockly.Field.prototype.dispose=function(){this.mouseUpWrapper_&&(Blockly.unbindEvent_(this.mouseUpWrapper_),this.mouseUpWrapper_=null),this.sourceBlock_=null,goog.dom.removeNode(this.fieldGroup_),this.validator_=this.borderRect_=this.textElement_=this.fieldGroup_=null},Blockly.Field.prototype.updateEditable=function(){var e=this.fieldGroup_;this.EDITABLE&&e&&(this.sourceBlock_.isEditable()?(Blockly.addClass_(e,"blocklyEditableText"),Blockly.removeClass_(e,"blocklyNonEditableText"),this.fieldGroup_.style.cursor=this.CURSOR):(Blockly.addClass_(e,"blocklyNonEditableText"),Blockly.removeClass_(e,"blocklyEditableText"),this.fieldGroup_.style.cursor=""))},Blockly.Field.prototype.isVisible=function(){return this.visible_},Blockly.Field.prototype.setVisible=function(e){if(this.visible_!=e){this.visible_=e;var o=this.getSvgRoot();o&&(o.style.display=e?"block":"none",this.render_())}},Blockly.Field.prototype.setValidator=function(e){this.validator_=e},Blockly.Field.prototype.getValidator=function(){return this.validator_},Blockly.Field.prototype.classValidator=function(e){return e},Blockly.Field.prototype.callValidator=function(e){var o=this.classValidator(e);if(null===o)return null;if(void 0!==o&&(e=o),o=this.getValidator()){if(o=o.call(this,e),null===o)return null;void 0!==o&&(e=o)}return e},Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_},Blockly.Field.prototype.render_=function(){if(this.visible_&&this.textElement_){var e=this.textElement_.textContent+"\n"+this.textElement_.className.baseVal;if(Blockly.Field.cacheWidths_&&Blockly.Field.cacheWidths_[e])var o=Blockly.Field.cacheWidths_[e];else{try{o=this.textElement_.getComputedTextLength()}catch(t){o=8*this.textElement_.textContent.length}Blockly.Field.cacheWidths_&&(Blockly.Field.cacheWidths_[e]=o)}this.borderRect_&&this.borderRect_.setAttribute("width",o+Blockly.BlockSvg.SEP_SPACE_X)}else o=0;this.size_.width=o},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(){return this.size_.width||this.render_(),this.size_},Blockly.Field.prototype.getScaledBBox_=function(){var e=this.borderRect_.getBBox();return new goog.math.Size(e.width*this.sourceBlock_.workspace.scale,e.height*this.sourceBlock_.workspace.scale)},Blockly.Field.prototype.getText=function(){return this.text_},Blockly.Field.prototype.setText=function(e){null!==e&&(e=String(e),e!==this.text_&&(this.text_=e,this.updateTextNode_(),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())))},Blockly.Field.prototype.updateTextNode_=function(){if(this.textElement_){var e=this.text_;e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,Blockly.Field.NBSP),this.sourceBlock_.RTL&&e&&(e+="‏"),e||(e=Blockly.Field.NBSP),goog.dom.removeChildren(this.textElement_),e=document.createTextNode(e),this.textElement_.appendChild(e),this.size_.width=0}},Blockly.Field.prototype.getValue=function(){return this.getText()},Blockly.Field.prototype.setValue=function(e){if(null!==e){var o=this.getValue();o!=e&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,o,e)),this.setText(e))}},Blockly.Field.prototype.onMouseUp_=function(e){(!goog.userAgent.IPHONE&&!goog.userAgent.IPAD||goog.userAgent.isVersionOrHigher("537.51.2")||0===e.layerX||0===e.layerY)&&(Blockly.isRightButton(e)||this.sourceBlock_.workspace.isDragging()||this.sourceBlock_.isEditable()&&this.showEditor_())},Blockly.Field.prototype.setTooltip=function(e){},Blockly.Field.prototype.getAbsoluteXY_=function(){return goog.style.getPageOffset(this.borderRect_)},Blockly.Tooltip={},Blockly.Tooltip.visible=!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=goog.dom.createDom("DIV","blocklyTooltipDiv"),document.body.appendChild(Blockly.Tooltip.DIV))},Blockly.Tooltip.bindMouseEvents=function(e){Blockly.bindEvent_(e,"mouseover",null,Blockly.Tooltip.onMouseOver_),Blockly.bindEvent_(e,"mouseout",null,Blockly.Tooltip.onMouseOut_),e.addEventListener("mousemove",Blockly.Tooltip.onMouseMove_,!1)},Blockly.Tooltip.onMouseOver_=function(e){for(e=e.target;!goog.isString(e.tooltip)&&!goog.isFunction(e.tooltip);)e=e.tooltip;Blockly.Tooltip.element_!=e&&(Blockly.Tooltip.hide(),Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.element_=e),clearTimeout(Blockly.Tooltip.mouseOutPid_)},Blockly.Tooltip.onMouseOut_=function(e){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(e){if(Blockly.Tooltip.element_&&Blockly.Tooltip.element_.tooltip&&Blockly.dragMode_==Blockly.DRAG_NONE&&!Blockly.WidgetDiv.isVisible())if(Blockly.Tooltip.visible){var o=Blockly.Tooltip.lastX_-e.pageX;e=Blockly.Tooltip.lastY_-e.pageY,Math.sqrt(o*o+e*e)>Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()}else Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastX_=e.pageX,Blockly.Tooltip.lastY_=e.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")),clearTimeout(Blockly.Tooltip.showPid_)},Blockly.Tooltip.show_=function(){if(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.DIV){goog.dom.removeChildren(Blockly.Tooltip.DIV);for(var e=Blockly.Tooltip.element_.tooltip;goog.isFunction(e);)e=e();for(var e=Blockly.utils.wrap(e,Blockly.Tooltip.LIMIT),e=e.split("\n"),o=0;o<e.length;o++){var t=document.createElement("div");t.appendChild(document.createTextNode(e[o])),Blockly.Tooltip.DIV.appendChild(t)}e=Blockly.Tooltip.element_.RTL,o=goog.dom.getViewportSize(),Blockly.Tooltip.DIV.style.direction=e?"rtl":"ltr",Blockly.Tooltip.DIV.style.display="block",Blockly.Tooltip.visible=!0;var t=Blockly.Tooltip.lastX_,t=e?t-(Blockly.Tooltip.OFFSET_X+Blockly.Tooltip.DIV.offsetWidth):t+Blockly.Tooltip.OFFSET_X,n=Blockly.Tooltip.lastY_+Blockly.Tooltip.OFFSET_Y;n+Blockly.Tooltip.DIV.offsetHeight>o.height+window.scrollY&&(n-=Blockly.Tooltip.DIV.offsetHeight+2*Blockly.Tooltip.OFFSET_Y),e?t=Math.max(Blockly.Tooltip.MARGINS-window.scrollX,t):t+Blockly.Tooltip.DIV.offsetWidth>o.width+window.scrollX-2*Blockly.Tooltip.MARGINS&&(t=o.width-Blockly.Tooltip.DIV.offsetWidth-2*Blockly.Tooltip.MARGINS),Blockly.Tooltip.DIV.style.top=n+"px",Blockly.Tooltip.DIV.style.left=t+"px"}},Blockly.FieldLabel=function(e,o){this.size_=new goog.math.Size(0,17.5),this.class_=o,this.setValue(e)},goog.inherits(Blockly.FieldLabel,Blockly.Field),Blockly.FieldLabel.prototype.EDITABLE=!1,Blockly.FieldLabel.prototype.init=function(){this.textElement_||(this.textElement_=Blockly.createSvgElement("text",{"class":"blocklyText",y:this.size_.height-5},null),this.class_&&Blockly.addClass_(this.textElement_,this.class_),this.visible_||(this.textElement_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.textElement_),this.textElement_.tooltip=this.sourceBlock_,Blockly.Tooltip.bindMouseEvents(this.textElement_),this.updateTextNode_())},Blockly.FieldLabel.prototype.dispose=function(){goog.dom.removeNode(this.textElement_),this.textElement_=null},Blockly.FieldLabel.prototype.getSvgRoot=function(){return this.textElement_},Blockly.FieldLabel.prototype.setTooltip=function(e){this.textElement_.tooltip=e},Blockly.Input=function(e,o,t,n){this.type=e,this.name=o,this.sourceBlock_=t,this.connection=n,this.fieldRow=[]},Blockly.Input.prototype.align=Blockly.ALIGN_LEFT,Blockly.Input.prototype.visible_=!0,Blockly.Input.prototype.appendField=function(e,o){return e||o?(goog.isString(e)&&(e=new Blockly.FieldLabel(e)),e.setSourceBlock(this.sourceBlock_),this.sourceBlock_.rendered&&e.init(),e.name=o,e.prefixField&&this.appendField(e.prefixField),this.fieldRow.push(e),e.suffixField&&this.appendField(e.suffixField),this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()),this):this},Blockly.Input.prototype.appendTitle=function(e,o){return console.warn("Deprecated call to appendTitle, use appendField instead."),this.appendField(e,o)},Blockly.Input.prototype.removeField=function(e){for(var o,t=0;o=this.fieldRow[t];t++)if(o.name===e)return o.dispose(),this.fieldRow.splice(t,1),void(this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()));goog.asserts.fail('Field "%s" not found.',e)},Blockly.Input.prototype.isVisible=function(){return this.visible_},Blockly.Input.prototype.setVisible=function(e){var o=[];if(this.visible_==e)return o;for(var t,n=(this.visible_=e)?"block":"none",r=0;t=this.fieldRow[r];r++)t.setVisible(e);return this.connection&&(e?o=this.connection.unhideAll():this.connection.hideAll(),r=this.connection.targetBlock())&&(r.getSvgRoot().style.display=n,e||(r.rendered=!1)),o},Blockly.Input.prototype.setCheck=function(e){if(!this.connection)throw"This input does not have a connection.";return this.connection.setCheck(e),this},Blockly.Input.prototype.setAlign=function(e){return this.align=e,this.sourceBlock_.rendered&&this.sourceBlock_.render(),this},Blockly.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var e=0;e<this.fieldRow.length;e++)this.fieldRow[e].init()},Blockly.Input.prototype.dispose=function(){for(var e,o=0;e=this.fieldRow[o];o++)e.dispose();this.connection&&this.connection.dispose(),this.sourceBlock_=null},Blockly.ConnectionDB=function(){},Blockly.ConnectionDB.prototype=[],Blockly.ConnectionDB.constructor=Blockly.ConnectionDB,Blockly.ConnectionDB.prototype.addConnection=function(e){if(e.inDB_)throw"Connection already in database.";if(!e.getSourceBlock().isInFlyout){var o=this.findPositionForConnection_(e);this.splice(o,0,e),e.inDB_=!0}},Blockly.ConnectionDB.prototype.findConnection=function(e){if(!this.length)return-1;var o=this.findPositionForConnection_(e);if(o>=this.length)return-1;for(var t=e.y_,n=o;n>=0&&this[n].y_==t;){if(this[n]==e)return n;n--}for(;o<this.length&&this[o].y_==t;){if(this[o]==e)return o;o++}return-1},Blockly.ConnectionDB.prototype.findPositionForConnection_=function(e){if(!this.length)return 0;for(var o=0,t=this.length;t>o;){var n=Math.floor((o+t)/2);if(this[n].y_<e.y_)o=n+1;else{if(!(this[n].y_>e.y_)){o=n;break}t=n}}return o},Blockly.ConnectionDB.prototype.removeConnection_=function(e){if(!e.inDB_)throw"Connection not in database.";var o=this.findConnection(e);if(-1==o)throw"Unable to find connection in connectionDB.";e.inDB_=!1,this.splice(o,1)},Blockly.ConnectionDB.prototype.getNeighbours=function(e,o){function t(e){var t=r-n[e].x_,s=i-n[e].y_;return Math.sqrt(t*t+s*s)<=o&&a.push(n[e]),o>s}for(var n=this,r=e.x_,i=e.y_,s=0,l=n.length-2,g=l;g>s;)n[g].y_<i?s=g:l=g,g=Math.floor((s+l)/2);var a=[],l=s=g;if(n.length){for(;s>=0&&t(s);)s--;do l++;while(l<n.length&&t(l))}return a},Blockly.ConnectionDB.prototype.isInYRange_=function(e,o,t){return Math.abs(this[e].y_-o)<=t},Blockly.ConnectionDB.prototype.searchForClosest=function(e,o,t){if(!this.length)return{connection:null,radius:o};var n=e.y_,r=e.x_;e.x_=r+t.x,e.y_=n+t.y;var i=this.findPositionForConnection_(e);t=null;for(var s,l=o,g=i-1;g>=0&&this.isInYRange_(g,e.y_,o);)s=this[g],e.isConnectionAllowed(s,l)&&(t=s,l=s.distanceFrom(e)),g--;for(;i<this.length&&this.isInYRange_(i,e.y_,o);)s=this[i],e.isConnectionAllowed(s,l)&&(t=s,l=s.distanceFrom(e)),i++;return e.x_=r,e.y_=n,{connection:t,radius:l}},Blockly.ConnectionDB.init=function(e){var o=[];o[Blockly.INPUT_VALUE]=new Blockly.ConnectionDB,o[Blockly.OUTPUT_VALUE]=new Blockly.ConnectionDB,o[Blockly.NEXT_STATEMENT]=new Blockly.ConnectionDB,o[Blockly.PREVIOUS_STATEMENT]=new Blockly.ConnectionDB,e.connectionDBList=o},Blockly.constants={},Blockly.DRAG_RADIUS=5,Blockly.SNAP_RADIUS=20,Blockly.BUMP_DELAY=250,Blockly.COLLAPSE_CHARS=30,Blockly.LONGPRESS=750,Blockly.SOUND_LIMIT=100,Blockly.HSV_SATURATION=.45,Blockly.HSV_VALUE=.65,Blockly.SPRITE={width:96,height:124,url:"sprites.png"},Blockly.SVG_NS="http://www.w3.org/2000/svg",Blockly.HTML_NS="http://www.w3.org/1999/xhtml",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.Options=function(e){var o=!!e.readOnly;if(o)var t=null,n=!1,r=!1,i=!1,s=!1,l=!1,g=!1;else t=Blockly.Options.parseToolboxTree(e.toolbox),n=!(!t||!t.getElementsByTagName("category").length),r=e.trashcan,void 0===r&&(r=n),i=e.collapse,void 0===i&&(i=n),s=e.comments,void 0===s&&(s=n),l=e.disable,void 0===l&&(l=n),g=e.sounds,void 0===g&&(g=!0);var a=!!e.rtl,c=e.horizontalLayout;void 0===c&&(c=!1);var u=e.toolboxPosition,u="end"===u?!1:!0,u=c?u?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:u==a?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,h=e.scrollbars;void 0===h&&(h=n);var d=e.css;void 0===d&&(d=!0);var p="https://blockly-demo.appspot.com/static/media/";e.media?p=e.media:e.path&&(p=e.path+"media/");var y=void 0===e.oneBasedIndex?!0:!!e.oneBasedIndex;this.RTL=a,this.oneBasedIndex=y,this.collapse=i,this.comments=s,this.disable=l,this.readOnly=o,this.maxBlocks=e.maxBlocks||1/0,this.pathToMedia=p,this.hasCategories=n,this.hasScrollbars=h,this.hasTrashcan=r,this.hasSounds=g,this.hasCss=d,this.horizontalLayout=c,this.languageTree=t,this.gridOptions=Blockly.Options.parseGridOptions_(e),this.zoomOptions=Blockly.Options.parseZoomOptions_(e),this.toolboxPosition=u},Blockly.Options.prototype.parentWorkspace=null,Blockly.Options.prototype.setMetrics=null,Blockly.Options.prototype.getMetrics=null,Blockly.Options.parseZoomOptions_=function(e){e=e.zoom||{};var o={};return o.controls=void 0===e.controls?!1:!!e.controls,o.wheel=void 0===e.wheel?!1:!!e.wheel,o.startScale=void 0===e.startScale?1:parseFloat(e.startScale),o.maxScale=void 0===e.maxScale?3:parseFloat(e.maxScale),o.minScale=void 0===e.minScale?.3:parseFloat(e.minScale),o.scaleSpeed=void 0===e.scaleSpeed?1.2:parseFloat(e.scaleSpeed),o},Blockly.Options.parseGridOptions_=function(e){e=e.grid||{};var o={};return o.spacing=parseFloat(e.spacing)||0,o.colour=e.colour||"#888",o.length=parseFloat(e.length)||1,o.snap=0<o.spacing&&!!e.snap,o},Blockly.Options.parseToolboxTree=function(e){return e?("string"!=typeof e&&("undefined"==typeof XSLTProcessor&&e.outerHTML?e=e.outerHTML:e instanceof Element||(e=null)),
     15this.anchorXY_.y+o<t.viewTop&&(o=this.shape_.getBBox().height),this.relativeLeft_=e,this.relativeTop_=o},Blockly.Bubble.prototype.positionBubble_=function(){var e=this.anchorXY_.x,e=this.workspace_.RTL?e-(this.relativeLeft_+this.width_):e+this.relativeLeft_;this.bubbleGroup_.setAttribute("transform","translate("+e+","+(this.relativeTop_+this.anchorXY_.y)+")")},Blockly.Bubble.prototype.getBubbleSize=function(){return{width:this.width_,height:this.height_}},Blockly.Bubble.prototype.setBubbleSize=function(e,o){var t=2*Blockly.Bubble.BORDER_WIDTH;e=Math.max(e,t+45),o=Math.max(o,t+20),this.width_=e,this.height_=o,this.bubbleBack_.setAttribute("width",e),this.bubbleBack_.setAttribute("height",o),this.resizeGroup_&&(this.workspace_.RTL?this.resizeGroup_.setAttribute("transform","translate("+2*Blockly.Bubble.BORDER_WIDTH+","+(o-t)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(e-t)+","+(o-t)+")")),this.rendered_&&(this.autoLayout_&&this.layoutBubble_(),this.positionBubble_(),this.renderArrow_()),this.resizeCallback_&&this.resizeCallback_()},Blockly.Bubble.prototype.renderArrow_=function(){var e=[],o=this.width_/2,t=this.height_/2,n=-this.relativeLeft_,r=-this.relativeTop_;if(o==n&&t==r)e.push("M "+o+","+t);else{r-=t,n-=o,this.workspace_.RTL&&(n*=-1);var i=Math.sqrt(r*r+n*n),s=Math.acos(n/i);0>r&&(s=2*Math.PI-s);var l=s+Math.PI/2;l>2*Math.PI&&(l-=2*Math.PI);var g=Math.sin(l),a=Math.cos(l),c=this.getBubbleSize(),l=(c.width+c.height)/Blockly.Bubble.ARROW_THICKNESS,l=Math.min(l,c.width,c.height)/4,c=1-Blockly.Bubble.ANCHOR_RADIUS/i,n=o+c*n,r=t+c*r,c=o+l*a,u=t+l*g,o=o-l*a,t=t-l*g,g=s+this.arrow_radians_;g>2*Math.PI&&(g-=2*Math.PI),s=Math.sin(g)*i/Blockly.Bubble.ARROW_BEND,i=Math.cos(g)*i/Blockly.Bubble.ARROW_BEND,e.push("M"+c+","+u),e.push("C"+(c+i)+","+(u+s)+" "+n+","+r+" "+n+","+r),e.push("C"+n+","+r+" "+(o+i)+","+(t+s)+" "+o+","+t)}e.push("z"),this.bubbleArrow_.setAttribute("d",e.join(" "))},Blockly.Bubble.prototype.setColour=function(e){this.bubbleBack_.setAttribute("fill",e),this.bubbleArrow_.setAttribute("fill",e)},Blockly.Bubble.prototype.dispose=function(){Blockly.Bubble.unbindDragEvents_(),goog.dom.removeNode(this.bubbleGroup_),this.shape_=this.content_=this.workspace_=this.resizeGroup_=this.bubbleBack_=this.bubbleArrow_=this.bubbleGroup_=null},Blockly.Icon=function(e){this.block_=e},Blockly.Icon.prototype.collapseHidden=!0,Blockly.Icon.prototype.SIZE=17,Blockly.Icon.prototype.bubble_=null,Blockly.Icon.prototype.iconXY_=null,Blockly.Icon.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=Blockly.createSvgElement("g",{"class":"blocklyIconGroup"},null),this.block_.isInFlyout&&Blockly.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(){goog.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(e){this.block_.workspace.isDragging()||this.block_.isInFlyout||Blockly.isRightButton(e)||this.setVisible(!this.isVisible())},Blockly.Icon.prototype.updateColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.getColour())},Blockly.Icon.prototype.renderIcon=function(e){if(this.collapseHidden&&this.block_.isCollapsed())return this.iconGroup_.setAttribute("display","none"),e;this.iconGroup_.setAttribute("display","block");var o=this.SIZE;return this.block_.RTL&&(e-=o),this.iconGroup_.setAttribute("transform","translate("+e+",5)"),this.computeIconLocation(),e=this.block_.RTL?e-Blockly.BlockSvg.SEP_SPACE_X:e+(o+Blockly.BlockSvg.SEP_SPACE_X)},Blockly.Icon.prototype.setIconLocation=function(e){this.iconXY_=e,this.isVisible()&&this.bubble_.setAnchorLocation(e)},Blockly.Icon.prototype.computeIconLocation=function(){var e=this.block_.getRelativeToSurfaceXY(),o=Blockly.getRelativeXY_(this.iconGroup_),e=new goog.math.Coordinate(e.x+o.x+this.SIZE/2,e.y+o.y+this.SIZE/2);goog.math.Coordinate.equals(this.getIconLocation(),e)||this.setIconLocation(e)},Blockly.Icon.prototype.getIconLocation=function(){return this.iconXY_},Blockly.Comment=function(e){Blockly.Comment.superClass_.constructor.call(this,e),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(e){Blockly.createSvgElement("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},e),Blockly.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.405 0.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25 -1.201,0.998 -1.201,1.528 -1.204,2.19z"},e),Blockly.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},e)},Blockly.Comment.prototype.createEditor_=function(){this.foreignObject_=Blockly.createSvgElement("foreignObject",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null);var e=document.createElementNS(Blockly.HTML_NS,"body");e.setAttribute("xmlns",Blockly.HTML_NS),e.className="blocklyMinimalBody";var o=document.createElementNS(Blockly.HTML_NS,"textarea");return o.className="blocklyCommentTextarea",o.setAttribute("dir",this.block_.RTL?"RTL":"LTR"),e.appendChild(o),this.textarea_=o,this.foreignObject_.appendChild(e),Blockly.bindEventWithChecks_(o,"mouseup",this,this.textareaFocus_),Blockly.bindEventWithChecks_(o,"wheel",this,function(e){e.stopPropagation()}),Blockly.bindEventWithChecks_(o,"change",this,function(e){this.text_!=o.value&&(Blockly.Events.fire(new Blockly.Events.Change(this.block_,"comment",null,this.text_,o.value)),this.text_=o.value)}),setTimeout(function(){o.focus()},0),this.foreignObject_},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 e=this.bubble_.getBubbleSize(),o=2*Blockly.Bubble.BORDER_WIDTH;this.foreignObject_.setAttribute("width",e.width-o),this.foreignObject_.setAttribute("height",e.height-o),this.textarea_.style.width=e.width-o-4+"px",this.textarea_.style.height=e.height-o-4+"px"}},Blockly.Comment.prototype.setVisible=function(e){if(e!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"commentOpen",!e,e)),!this.block_.isEditable()&&!this.textarea_||goog.userAgent.IE)Blockly.Warning.prototype.setVisible.call(this,e);else{var o=this.getText(),t=this.getBubbleSize();e?(this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svgPath_,this.iconXY_,this.width_,this.height_),this.bubble_.registerResizeEvent(this.resizeBubble_.bind(this)),this.updateColour()):(this.bubble_.dispose(),this.foreignObject_=this.textarea_=this.bubble_=null),this.setText(o),this.setBubbleSize(t.width,t.height)}},Blockly.Comment.prototype.textareaFocus_=function(e){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(e,o){this.textarea_?this.bubble_.setBubbleSize(e,o):(this.width_=e,this.height_=o)},Blockly.Comment.prototype.getText=function(){return this.textarea_?this.textarea_.value:this.text_},Blockly.Comment.prototype.setText=function(e){this.text_!=e&&(Blockly.Events.fire(new Blockly.Events.Change(this.block_,"comment",null,this.text_,e)),this.text_=e),this.textarea_&&(this.textarea_.value=e)},Blockly.Comment.prototype.dispose=function(){Blockly.Events.isEnabled()&&this.setText(""),this.block_.comment=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Connection=function(e,o){this.sourceBlock_=e,this.type=o,e.workspace.connectionDBList&&(this.db_=e.workspace.connectionDBList[o],this.dbOpposite_=e.workspace.connectionDBList[Blockly.OPPOSITE_TYPE[o]],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.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(e){var o=this,t=o.getSourceBlock(),n=e.getSourceBlock();if(e.isConnected()&&e.disconnect(),o.isConnected()){var r=o.targetBlock(),i=o.getShadowDom();if(o.setShadowDom(null),r.isShadow())i=Blockly.Xml.blockToDom(r),r.dispose(),r=null;else if(o.type==Blockly.INPUT_VALUE){if(!r.outputConnection)throw"Orphan block does not have an output connection.";var s=Blockly.Connection.lastConnectionInRow_(n,r);s&&(r.outputConnection.connect(s),r=null)}else if(o.type==Blockly.NEXT_STATEMENT){if(!r.previousConnection)throw"Orphan block does not have a previous connection.";for(s=n;s.nextConnection;){var l=s.getNextBlock();if(!l||l.isShadow()){r.previousConnection.checkType_(s.nextConnection)&&(s.nextConnection.connect(r.previousConnection),r=null);break}s=l}}if(r&&(o.disconnect(),Blockly.Events.recordUndo)){var g=Blockly.Events.getGroup();setTimeout(function(){r.workspace&&!r.getParent()&&(Blockly.Events.setGroup(g),r.outputConnection?r.outputConnection.bumpAwayFrom_(o):r.previousConnection&&r.previousConnection.bumpAwayFrom_(o),Blockly.Events.setGroup(!1))},Blockly.BUMP_DELAY)}o.setShadowDom(i)}var a;Blockly.Events.isEnabled()&&(a=new Blockly.Events.Move(n)),Blockly.Connection.connectReciprocally_(o,e),n.setParent(t),a&&(a.recordNew(),Blockly.Events.fire(a))},Blockly.Connection.prototype.dispose=function(){if(this.isConnected())throw"Disconnect connection before disposing of it.";this.inDB_&&this.db_.removeConnection_(this),Blockly.highlightedConnection_==this&&(Blockly.highlightedConnection_=null),Blockly.localConnection_==this&&(Blockly.localConnection_=null),this.dbOpposite_=this.db_=null},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(e){if(!e)return Blockly.Connection.REASON_TARGET_NULL;if(this.isSuperior())var o=this.sourceBlock_,t=e.getSourceBlock();else t=this.sourceBlock_,o=e.getSourceBlock();return o&&o==t?Blockly.Connection.REASON_SELF_CONNECTION:e.type!=Blockly.OPPOSITE_TYPE[this.type]?Blockly.Connection.REASON_WRONG_TYPE:o&&t&&o.workspace!==t.workspace?Blockly.Connection.REASON_DIFFERENT_WORKSPACES:this.checkType_(e)?o.isShadow()&&!t.isShadow()?Blockly.Connection.REASON_SHADOW_PARENT:Blockly.Connection.CAN_CONNECT:Blockly.Connection.REASON_CHECKS_FAILED},Blockly.Connection.prototype.checkConnection_=function(e){switch(this.canConnectWithReason_(e)){case Blockly.Connection.CAN_CONNECT:break;case Blockly.Connection.REASON_SELF_CONNECTION:throw"Attempted to connect a block to itself.";case Blockly.Connection.REASON_DIFFERENT_WORKSPACES:throw"Blocks not on same workspace.";case Blockly.Connection.REASON_WRONG_TYPE:throw"Attempt to connect incompatible types.";case Blockly.Connection.REASON_TARGET_NULL:throw"Target connection is null.";case Blockly.Connection.REASON_CHECKS_FAILED:throw"Connection checks failed.";case Blockly.Connection.REASON_SHADOW_PARENT:throw"Connecting non-shadow to shadow block.";default:throw"Unknown connection failure: this should never happen!"}},Blockly.Connection.prototype.isConnectionAllowed=function(e){return this.canConnectWithReason_(e)!=Blockly.Connection.CAN_CONNECT?!1:e.type!=Blockly.OUTPUT_VALUE&&e.type!=Blockly.PREVIOUS_STATEMENT||!e.isConnected()&&!this.isConnected()?e.type==Blockly.INPUT_VALUE&&e.isConnected()&&!e.targetBlock().isMovable()&&!e.targetBlock().isShadow()||this.type==Blockly.PREVIOUS_STATEMENT&&e.isConnected()&&!this.sourceBlock_.nextConnection&&!e.targetBlock().isShadow()&&e.targetBlock().nextConnection||-1!=Blockly.draggingConnections_.indexOf(e)?!1:!0:!1},Blockly.Connection.prototype.connect=function(e){this.targetConnection!=e&&(this.checkConnection_(e),this.isSuperior()?this.connect_(e):e.connect_(this))},Blockly.Connection.connectReciprocally_=function(e,o){goog.asserts.assert(e&&o,"Cannot connect null connections."),e.targetConnection=o,o.targetConnection=e},Blockly.Connection.singleConnection_=function(e,o){for(var t=!1,n=0;n<e.inputList.length;n++){var r=e.inputList[n].connection;if(r&&r.type==Blockly.INPUT_VALUE&&o.outputConnection.checkType_(r)){if(t)return null;t=r}}return t},Blockly.Connection.lastConnectionInRow_=function(e,o){for(var t,n=e;t=Blockly.Connection.singleConnection_(n,o);)if(n=t.targetBlock(),!n||n.isShadow())return t;return null},Blockly.Connection.prototype.disconnect=function(){var e=this.targetConnection;goog.asserts.assert(e,"Source connection not connected."),goog.asserts.assert(e.targetConnection==this,"Target connection not connected to source connection.");var o,t;this.isSuperior()?(o=this.sourceBlock_,t=e.getSourceBlock(),e=this):(o=e.getSourceBlock(),t=this.sourceBlock_),this.disconnectInternal_(o,t),e.respawnShadow_()},Blockly.Connection.prototype.disconnectInternal_=function(e,o){var t;Blockly.Events.isEnabled()&&(t=new Blockly.Events.Move(o)),this.targetConnection=this.targetConnection.targetConnection=null,o.setParent(null),t&&(t.recordNew(),Blockly.Events.fire(t))},Blockly.Connection.prototype.respawnShadow_=function(){var e=this.getSourceBlock(),o=this.getShadowDom();if(e.workspace&&o&&Blockly.Events.recordUndo)if(e=Blockly.Xml.domToBlock(o,e.workspace),e.outputConnection)this.connect(e.outputConnection);else{if(!e.previousConnection)throw"Child block does not have output or previous statement.";this.connect(e.previousConnection)}},Blockly.Connection.prototype.targetBlock=function(){return this.isConnected()?this.targetConnection.getSourceBlock():null},Blockly.Connection.prototype.checkType_=function(e){if(!this.check_||!e.check_)return!0;for(var o=0;o<this.check_.length;o++)if(-1!=e.check_.indexOf(this.check_[o]))return!0;return!1},Blockly.Connection.prototype.setCheck=function(e){return e?(goog.isArray(e)||(e=[e]),this.check_=e,this.isConnected()&&!this.checkType_(this.targetConnection)&&((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours_())):this.check_=null,this},Blockly.Connection.prototype.setShadowDom=function(e){this.shadowDom_=e},Blockly.Connection.prototype.getShadowDom=function(){return this.shadowDom_},Blockly.Field=function(e,o){this.size_=new goog.math.Size(0,25),this.setValue(e),this.setValidator(o)},Blockly.Field.cacheWidths_=null,Blockly.Field.cacheReference_=0,Blockly.Field.prototype.name=void 0,Blockly.Field.prototype.maxDisplayLength=50,Blockly.Field.prototype.text_="",Blockly.Field.prototype.sourceBlock_=null,Blockly.Field.prototype.visible_=!0,Blockly.Field.prototype.validator_=null,Blockly.Field.NBSP=" ",Blockly.Field.prototype.EDITABLE=!0,Blockly.Field.prototype.setSourceBlock=function(e){goog.asserts.assert(!this.sourceBlock_,"Field already bound to a block."),this.sourceBlock_=e},Blockly.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.borderRect_=Blockly.createSvgElement("rect",{rx:4,ry:4,x:-Blockly.BlockSvg.SEP_SPACE_X/2,y:0,height:16},this.fieldGroup_,this.sourceBlock_.workspace),this.textElement_=Blockly.createSvgElement("text",{"class":"blocklyText",y:this.size_.height-12.5},this.fieldGroup_),this.updateEditable(),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.mouseUpWrapper_=Blockly.bindEventWithChecks_(this.fieldGroup_,"mouseup",this,this.onMouseUp_),this.updateTextNode_())},Blockly.Field.prototype.dispose=function(){this.mouseUpWrapper_&&(Blockly.unbindEvent_(this.mouseUpWrapper_),this.mouseUpWrapper_=null),this.sourceBlock_=null,goog.dom.removeNode(this.fieldGroup_),this.validator_=this.borderRect_=this.textElement_=this.fieldGroup_=null},Blockly.Field.prototype.updateEditable=function(){var e=this.fieldGroup_;this.EDITABLE&&e&&(this.sourceBlock_.isEditable()?(Blockly.addClass_(e,"blocklyEditableText"),Blockly.removeClass_(e,"blocklyNonEditableText"),this.fieldGroup_.style.cursor=this.CURSOR):(Blockly.addClass_(e,"blocklyNonEditableText"),Blockly.removeClass_(e,"blocklyEditableText"),this.fieldGroup_.style.cursor=""))},Blockly.Field.prototype.isVisible=function(){return this.visible_},Blockly.Field.prototype.setVisible=function(e){if(this.visible_!=e){this.visible_=e;var o=this.getSvgRoot();o&&(o.style.display=e?"block":"none",this.render_())}},Blockly.Field.prototype.setValidator=function(e){this.validator_=e},Blockly.Field.prototype.getValidator=function(){return this.validator_},Blockly.Field.prototype.classValidator=function(e){return e},Blockly.Field.prototype.callValidator=function(e){var o=this.classValidator(e);if(null===o)return null;if(void 0!==o&&(e=o),o=this.getValidator()){if(o=o.call(this,e),null===o)return null;void 0!==o&&(e=o)}return e},Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_},Blockly.Field.prototype.render_=function(){if(this.visible_&&this.textElement_){var e=this.textElement_.textContent+"\n"+this.textElement_.className.baseVal;if(Blockly.Field.cacheWidths_&&Blockly.Field.cacheWidths_[e])var o=Blockly.Field.cacheWidths_[e];else{try{o=this.textElement_.getComputedTextLength()}catch(t){o=8*this.textElement_.textContent.length}Blockly.Field.cacheWidths_&&(Blockly.Field.cacheWidths_[e]=o)}this.borderRect_&&this.borderRect_.setAttribute("width",o+Blockly.BlockSvg.SEP_SPACE_X)}else o=0;this.size_.width=o},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(){return this.size_.width||this.render_(),this.size_},Blockly.Field.prototype.getScaledBBox_=function(){var e=this.borderRect_.getBBox();return new goog.math.Size(e.width*this.sourceBlock_.workspace.scale,e.height*this.sourceBlock_.workspace.scale)},Blockly.Field.prototype.getText=function(){return this.text_},Blockly.Field.prototype.setText=function(e){null!==e&&(e=String(e),e!==this.text_&&(this.text_=e,this.updateTextNode_(),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_())))},Blockly.Field.prototype.updateTextNode_=function(){if(this.textElement_){var e=this.text_;e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,Blockly.Field.NBSP),this.sourceBlock_.RTL&&e&&(e+="‏"),e||(e=Blockly.Field.NBSP),goog.dom.removeChildren(this.textElement_),e=document.createTextNode(e),this.textElement_.appendChild(e),this.size_.width=0}},Blockly.Field.prototype.getValue=function(){return this.getText()},Blockly.Field.prototype.setValue=function(e){if(null!==e){var o=this.getValue();o!=e&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,o,e)),this.setText(e))}},Blockly.Field.prototype.onMouseUp_=function(e){(!goog.userAgent.IPHONE&&!goog.userAgent.IPAD||goog.userAgent.isVersionOrHigher("537.51.2")||0===e.layerX||0===e.layerY)&&(Blockly.isRightButton(e)||this.sourceBlock_.workspace.isDragging()||this.sourceBlock_.isEditable()&&this.showEditor_())},Blockly.Field.prototype.setTooltip=function(e){},Blockly.Field.prototype.getAbsoluteXY_=function(){return goog.style.getPageOffset(this.borderRect_)},Blockly.Tooltip={},Blockly.Tooltip.visible=!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=goog.dom.createDom("DIV","blocklyTooltipDiv"),document.body.appendChild(Blockly.Tooltip.DIV))},Blockly.Tooltip.bindMouseEvents=function(e){Blockly.bindEvent_(e,"mouseover",null,Blockly.Tooltip.onMouseOver_),Blockly.bindEvent_(e,"mouseout",null,Blockly.Tooltip.onMouseOut_),e.addEventListener("mousemove",Blockly.Tooltip.onMouseMove_,!1)},Blockly.Tooltip.onMouseOver_=function(e){for(e=e.target;!goog.isString(e.tooltip)&&!goog.isFunction(e.tooltip);)e=e.tooltip;Blockly.Tooltip.element_!=e&&(Blockly.Tooltip.hide(),Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.element_=e),clearTimeout(Blockly.Tooltip.mouseOutPid_)},Blockly.Tooltip.onMouseOut_=function(e){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(e){if(Blockly.Tooltip.element_&&Blockly.Tooltip.element_.tooltip&&Blockly.dragMode_==Blockly.DRAG_NONE&&!Blockly.WidgetDiv.isVisible())if(Blockly.Tooltip.visible){var o=Blockly.Tooltip.lastX_-e.pageX;e=Blockly.Tooltip.lastY_-e.pageY,Math.sqrt(o*o+e*e)>Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()}else Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastX_=e.pageX,Blockly.Tooltip.lastY_=e.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")),clearTimeout(Blockly.Tooltip.showPid_)},Blockly.Tooltip.show_=function(){if(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.DIV){goog.dom.removeChildren(Blockly.Tooltip.DIV);for(var e=Blockly.Tooltip.element_.tooltip;goog.isFunction(e);)e=e();for(var e=Blockly.utils.wrap(e,Blockly.Tooltip.LIMIT),e=e.split("\n"),o=0;o<e.length;o++){var t=document.createElement("div");t.appendChild(document.createTextNode(e[o])),Blockly.Tooltip.DIV.appendChild(t)}e=Blockly.Tooltip.element_.RTL,o=goog.dom.getViewportSize(),Blockly.Tooltip.DIV.style.direction=e?"rtl":"ltr",Blockly.Tooltip.DIV.style.display="block",Blockly.Tooltip.visible=!0;var t=Blockly.Tooltip.lastX_,t=e?t-(Blockly.Tooltip.OFFSET_X+Blockly.Tooltip.DIV.offsetWidth):t+Blockly.Tooltip.OFFSET_X,n=Blockly.Tooltip.lastY_+Blockly.Tooltip.OFFSET_Y;n+Blockly.Tooltip.DIV.offsetHeight>o.height+window.scrollY&&(n-=Blockly.Tooltip.DIV.offsetHeight+2*Blockly.Tooltip.OFFSET_Y),e?t=Math.max(Blockly.Tooltip.MARGINS-window.scrollX,t):t+Blockly.Tooltip.DIV.offsetWidth>o.width+window.scrollX-2*Blockly.Tooltip.MARGINS&&(t=o.width-Blockly.Tooltip.DIV.offsetWidth-2*Blockly.Tooltip.MARGINS),Blockly.Tooltip.DIV.style.top=n+"px",Blockly.Tooltip.DIV.style.left=t+"px"}},Blockly.FieldLabel=function(e,o){this.size_=new goog.math.Size(0,17.5),this.class_=o,this.setValue(e)},goog.inherits(Blockly.FieldLabel,Blockly.Field),Blockly.FieldLabel.prototype.EDITABLE=!1,Blockly.FieldLabel.prototype.init=function(){this.textElement_||(this.textElement_=Blockly.createSvgElement("text",{"class":"blocklyText",y:this.size_.height-5},null),this.class_&&Blockly.addClass_(this.textElement_,this.class_),this.visible_||(this.textElement_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.textElement_),this.textElement_.tooltip=this.sourceBlock_,Blockly.Tooltip.bindMouseEvents(this.textElement_),this.updateTextNode_())},Blockly.FieldLabel.prototype.dispose=function(){goog.dom.removeNode(this.textElement_),this.textElement_=null},Blockly.FieldLabel.prototype.getSvgRoot=function(){return this.textElement_},Blockly.FieldLabel.prototype.setTooltip=function(e){this.textElement_.tooltip=e},Blockly.Input=function(e,o,t,n){this.type=e,this.name=o,this.sourceBlock_=t,this.connection=n,this.fieldRow=[]},Blockly.Input.prototype.align=Blockly.ALIGN_LEFT,Blockly.Input.prototype.visible_=!0,Blockly.Input.prototype.appendField=function(e,o){return e||o?(goog.isString(e)&&(e=new Blockly.FieldLabel(e)),e.setSourceBlock(this.sourceBlock_),this.sourceBlock_.rendered&&e.init(),e.name=o,e.prefixField&&this.appendField(e.prefixField),this.fieldRow.push(e),e.suffixField&&this.appendField(e.suffixField),this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()),this):this},Blockly.Input.prototype.appendTitle=function(e,o){return console.warn("Deprecated call to appendTitle, use appendField instead."),this.appendField(e,o)},Blockly.Input.prototype.removeField=function(e){for(var o,t=0;o=this.fieldRow[t];t++)if(o.name===e)return o.dispose(),this.fieldRow.splice(t,1),void(this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()));goog.asserts.fail('Field "%s" not found.',e)},Blockly.Input.prototype.isVisible=function(){return this.visible_},Blockly.Input.prototype.setVisible=function(e){var o=[];if(this.visible_==e)return o;for(var t,n=(this.visible_=e)?"block":"none",r=0;t=this.fieldRow[r];r++)t.setVisible(e);return this.connection&&(e?o=this.connection.unhideAll():this.connection.hideAll(),r=this.connection.targetBlock())&&(r.getSvgRoot().style.display=n,e||(r.rendered=!1)),o},Blockly.Input.prototype.setCheck=function(e){if(!this.connection)throw"This input does not have a connection.";return this.connection.setCheck(e),this},Blockly.Input.prototype.setAlign=function(e){return this.align=e,this.sourceBlock_.rendered&&this.sourceBlock_.render(),this},Blockly.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var e=0;e<this.fieldRow.length;e++)this.fieldRow[e].init()},Blockly.Input.prototype.dispose=function(){for(var e,o=0;e=this.fieldRow[o];o++)e.dispose();this.connection&&this.connection.dispose(),this.sourceBlock_=null},Blockly.ConnectionDB=function(){},Blockly.ConnectionDB.prototype=[],Blockly.ConnectionDB.constructor=Blockly.ConnectionDB,Blockly.ConnectionDB.prototype.addConnection=function(e){if(e.inDB_)throw"Connection already in database.";if(!e.getSourceBlock().isInFlyout){var o=this.findPositionForConnection_(e);this.splice(o,0,e),e.inDB_=!0}},Blockly.ConnectionDB.prototype.findConnection=function(e){if(!this.length)return-1;var o=this.findPositionForConnection_(e);if(o>=this.length)return-1;for(var t=e.y_,n=o;n>=0&&this[n].y_==t;){if(this[n]==e)return n;n--}for(;o<this.length&&this[o].y_==t;){if(this[o]==e)return o;o++}return-1},Blockly.ConnectionDB.prototype.findPositionForConnection_=function(e){if(!this.length)return 0;for(var o=0,t=this.length;t>o;){var n=Math.floor((o+t)/2);if(this[n].y_<e.y_)o=n+1;else{if(!(this[n].y_>e.y_)){o=n;break}t=n}}return o},Blockly.ConnectionDB.prototype.removeConnection_=function(e){if(!e.inDB_)throw"Connection not in database.";var o=this.findConnection(e);if(-1==o)throw"Unable to find connection in connectionDB.";e.inDB_=!1,this.splice(o,1)},Blockly.ConnectionDB.prototype.getNeighbours=function(e,o){function t(e){var t=r-n[e].x_,s=i-n[e].y_;return Math.sqrt(t*t+s*s)<=o&&a.push(n[e]),o>s}for(var n=this,r=e.x_,i=e.y_,s=0,l=n.length-2,g=l;g>s;)n[g].y_<i?s=g:l=g,g=Math.floor((s+l)/2);var a=[],l=s=g;if(n.length){for(;s>=0&&t(s);)s--;do l++;while(l<n.length&&t(l))}return a},Blockly.ConnectionDB.prototype.isInYRange_=function(e,o,t){return Math.abs(this[e].y_-o)<=t},Blockly.ConnectionDB.prototype.searchForClosest=function(e,o,t){if(!this.length)return{connection:null,radius:o};var n=e.y_,r=e.x_;e.x_=r+t.x,e.y_=n+t.y;var i=this.findPositionForConnection_(e);t=null;for(var s,l=o,g=i-1;g>=0&&this.isInYRange_(g,e.y_,o);)s=this[g],e.isConnectionAllowed(s,l)&&(t=s,l=s.distanceFrom(e)),g--;for(;i<this.length&&this.isInYRange_(i,e.y_,o);)s=this[i],e.isConnectionAllowed(s,l)&&(t=s,l=s.distanceFrom(e)),i++;return e.x_=r,e.y_=n,{connection:t,radius:l}},Blockly.ConnectionDB.init=function(e){var o=[];o[Blockly.INPUT_VALUE]=new Blockly.ConnectionDB,o[Blockly.OUTPUT_VALUE]=new Blockly.ConnectionDB,o[Blockly.NEXT_STATEMENT]=new Blockly.ConnectionDB,o[Blockly.PREVIOUS_STATEMENT]=new Blockly.ConnectionDB,e.connectionDBList=o},Blockly.constants={},Blockly.DRAG_RADIUS=5,Blockly.SNAP_RADIUS=20,Blockly.BUMP_DELAY=250,Blockly.COLLAPSE_CHARS=30,Blockly.LONGPRESS=750,Blockly.SOUND_LIMIT=100,Blockly.HSV_SATURATION=.45,Blockly.HSV_VALUE=.65,Blockly.SPRITE={width:96,height:124,url:"sprites.png"},Blockly.SVG_NS="http://www.w3.org/2000/svg",Blockly.HTML_NS="http://www.w3.org/1999/xhtml",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.Options=function(e){var o=!!e.readOnly;if(o)var t=null,n=!1,r=!1,i=!1,s=!1,l=!1,g=!1;else t=Blockly.Options.parseToolboxTree(e.toolbox),n=!(!t||!t.getElementsByTagName("category").length),r=e.trashcan,void 0===r&&(r=n),i=e.collapse,void 0===i&&(i=n),s=e.comments,void 0===s&&(s=n),l=e.disable,void 0===l&&(l=n),g=e.sounds,void 0===g&&(g=!0);var a=!!e.rtl,c=e.horizontalLayout;void 0===c&&(c=!1);var u=e.toolboxPosition,u="end"===u?!1:!0,u=c?u?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:u==a?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT,h=e.scrollbars;void 0===h&&(h=n);var d=e.css;void 0===d&&(d=!0);var p="https://blockly-demo.appspot.com/static/media/";e.media?p=e.media:e.path&&(p=e.path+"media/");var y=void 0===e.oneBasedIndex?!0:!!e.oneBasedIndex;this.RTL=a,this.oneBasedIndex=y,this.collapse=i,this.comments=s,this.disable=l,this.readOnly=o,this.maxBlocks=e.maxBlocks||1/0,this.pathToMedia=p,this.hasCategories=n,this.hasScrollbars=h,this.hasTrashcan=r,this.hasSounds=g,this.hasCss=d,this.horizontalLayout=c,this.languageTree=t,this.gridOptions=Blockly.Options.parseGridOptions_(e),this.zoomOptions=Blockly.Options.parseZoomOptions_(e),this.toolboxPosition=u},Blockly.Options.prototype.parentWorkspace=null,Blockly.Options.prototype.setMetrics=null,Blockly.Options.prototype.getMetrics=null,Blockly.Options.parseZoomOptions_=function(e){e=e.zoom||{};var o={};return o.controls=void 0===e.controls?!1:!!e.controls,o.wheel=void 0===e.wheel?!1:!!e.wheel,o.startScale=void 0===e.startScale?1:parseFloat(e.startScale),o.maxScale=void 0===e.maxScale?3:parseFloat(e.maxScale),o.minScale=void 0===e.minScale?.3:parseFloat(e.minScale),o.scaleSpeed=void 0===e.scaleSpeed?1.2:parseFloat(e.scaleSpeed),o},Blockly.Options.parseGridOptions_=function(e){e=e.grid||{};var o={};return o.spacing=parseFloat(e.spacing)||0,o.colour=e.colour||"#888",o.length=parseFloat(e.length)||1,o.snap=0<o.spacing&&!!e.snap,o},Blockly.Options.parseToolboxTree=function(e){return e?("string"!=typeof e&&("undefined"==typeof XSLTProcessor&&e.outerHTML?e=e.outerHTML:e instanceof Element||(e=null)),
    1616"string"==typeof e&&(e=Blockly.Xml.textToDom(e))):e=null,e},Blockly.ScrollbarPair=function(e){this.workspace_=e,this.hScroll=new Blockly.Scrollbar(e,!0,!0),this.vScroll=new Blockly.Scrollbar(e,!1,!0),this.corner_=Blockly.createSvgElement("rect",{height:Blockly.Scrollbar.scrollbarThickness,width:Blockly.Scrollbar.scrollbarThickness,"class":"blocklyScrollbarBackground"},null),Blockly.Scrollbar.insertAfter_(this.corner_,e.getBubbleCanvas())},Blockly.ScrollbarPair.prototype.oldHostMetrics_=null,Blockly.ScrollbarPair.prototype.dispose=function(){goog.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 e=this.workspace_.getMetrics();if(e){var o=!1,t=!1;this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==e.viewWidth&&this.oldHostMetrics_.viewHeight==e.viewHeight&&this.oldHostMetrics_.absoluteTop==e.absoluteTop&&this.oldHostMetrics_.absoluteLeft==e.absoluteLeft?(this.oldHostMetrics_&&this.oldHostMetrics_.contentWidth==e.contentWidth&&this.oldHostMetrics_.viewLeft==e.viewLeft&&this.oldHostMetrics_.contentLeft==e.contentLeft||(o=!0),this.oldHostMetrics_&&this.oldHostMetrics_.contentHeight==e.contentHeight&&this.oldHostMetrics_.viewTop==e.viewTop&&this.oldHostMetrics_.contentTop==e.contentTop||(t=!0)):t=o=!0,o&&this.hScroll.resize(e),t&&this.vScroll.resize(e),this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==e.viewWidth&&this.oldHostMetrics_.absoluteLeft==e.absoluteLeft||this.corner_.setAttribute("x",this.vScroll.position_.x),this.oldHostMetrics_&&this.oldHostMetrics_.viewHeight==e.viewHeight&&this.oldHostMetrics_.absoluteTop==e.absoluteTop||this.corner_.setAttribute("y",this.hScroll.position_.y),this.oldHostMetrics_=e}},Blockly.ScrollbarPair.prototype.set=function(e,o){var t={},n=e*this.hScroll.ratio_,r=o*this.vScroll.ratio_,i=this.vScroll.scrollViewSize_;t.x=this.getRatio_(n,this.hScroll.scrollViewSize_),t.y=this.getRatio_(r,i),this.workspace_.setMetrics(t),this.hScroll.setHandlePosition(n),this.vScroll.setHandlePosition(r)},Blockly.ScrollbarPair.prototype.getRatio_=function(e,o){var t=e/o;return isNaN(t)?0:t},Blockly.Scrollbar=function(e,o,t){this.workspace_=e,this.pair_=t||!1,this.horizontal_=o,this.oldHostMetrics_=null,this.createDom_(),this.position_=new goog.math.Coordinate(0,0),o?(this.svgBackground_.setAttribute("height",Blockly.Scrollbar.scrollbarThickness),this.svgHandle_.setAttribute("height",Blockly.Scrollbar.scrollbarThickness-5),this.svgHandle_.setAttribute("y",2.5),this.lengthAttribute_="width",this.positionAttribute_="x"):(this.svgBackground_.setAttribute("width",Blockly.Scrollbar.scrollbarThickness),this.svgHandle_.setAttribute("width",Blockly.Scrollbar.scrollbarThickness-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.scrollViewSize_=0,Blockly.Scrollbar.prototype.handleLength_=0,Blockly.Scrollbar.prototype.handlePosition_=0,Blockly.Scrollbar.prototype.isVisible_=!0,Blockly.Scrollbar.scrollbarThickness=15,goog.events.BrowserFeature.TOUCH_ENABLED&&(Blockly.Scrollbar.scrollbarThickness=25),Blockly.Scrollbar.metricsAreEquivalent_=function(e,o){return e&&o&&e.viewWidth==o.viewWidth&&e.viewHeight==o.viewHeight&&e.viewLeft==o.viewLeft&&e.viewTop==o.viewTop&&e.absoluteTop==o.absoluteTop&&e.absoluteLeft==o.absoluteLeft&&e.contentWidth==o.contentWidth&&e.contentHeight==o.contentHeight&&e.contentLeft==o.contentLeft&&e.contentTop==o.contentTop?!0:!1},Blockly.Scrollbar.prototype.dispose=function(){this.cleanUp_(),Blockly.unbindEvent_(this.onMouseDownBarWrapper_),this.onMouseDownBarWrapper_=null,Blockly.unbindEvent_(this.onMouseDownHandleWrapper_),this.onMouseDownHandleWrapper_=null,goog.dom.removeNode(this.svgGroup_),this.workspace_=this.svgHandle_=this.svgBackground_=this.svgGroup_=null},Blockly.Scrollbar.prototype.setHandleLength_=function(e){this.handleLength_=e,this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)},Blockly.Scrollbar.prototype.setHandlePosition=function(e){this.handlePosition_=e,this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)},Blockly.Scrollbar.prototype.setScrollViewSize_=function(e){this.scrollViewSize_=e,this.svgBackground_.setAttribute(this.lengthAttribute_,this.scrollViewSize_)},Blockly.Scrollbar.prototype.setPosition=function(e,o){this.position_.x=e,this.position_.y=o,this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")},Blockly.Scrollbar.prototype.resize=function(e){(e||(e=this.workspace_.getMetrics()))&&(Blockly.Scrollbar.metricsAreEquivalent_(e,this.oldHostMetrics_)||(this.oldHostMetrics_=e,this.horizontal_?this.resizeHorizontal_(e):this.resizeVertical_(e),this.onScroll_()))},Blockly.Scrollbar.prototype.resizeHorizontal_=function(e){this.resizeViewHorizontal(e)},Blockly.Scrollbar.prototype.resizeViewHorizontal=function(e){var o=e.viewWidth-1;this.pair_&&(o-=Blockly.Scrollbar.scrollbarThickness),this.setScrollViewSize_(Math.max(0,o)),o=e.absoluteLeft+.5,this.pair_&&this.workspace_.RTL&&(o+=Blockly.Scrollbar.scrollbarThickness),this.setPosition(o,e.absoluteTop+e.viewHeight-Blockly.Scrollbar.scrollbarThickness-.5),this.resizeContentHorizontal(e)},Blockly.Scrollbar.prototype.resizeContentHorizontal=function(e){this.pair_||this.setVisible(this.scrollViewSize_<e.contentWidth),this.ratio_=this.scrollViewSize_/e.contentWidth,(-(1/0)==this.ratio_||1/0==this.ratio_||isNaN(this.ratio_))&&(this.ratio_=0),this.setHandleLength_(Math.max(0,e.viewWidth*this.ratio_)),this.setHandlePosition(this.constrainHandle_((e.viewLeft-e.contentLeft)*this.ratio_))},Blockly.Scrollbar.prototype.resizeVertical_=function(e){this.resizeViewVertical(e)},Blockly.Scrollbar.prototype.resizeViewVertical=function(e){var o=e.viewHeight-1;this.pair_&&(o-=Blockly.Scrollbar.scrollbarThickness),this.setScrollViewSize_(Math.max(0,o)),o=e.absoluteLeft+.5,this.workspace_.RTL||(o+=e.viewWidth-Blockly.Scrollbar.scrollbarThickness-1),this.setPosition(o,e.absoluteTop+.5),this.resizeContentVertical(e)},Blockly.Scrollbar.prototype.resizeContentVertical=function(e){this.pair_||this.setVisible(this.scrollViewSize_<e.contentHeight),this.ratio_=this.scrollViewSize_/e.contentHeight,(-(1/0)==this.ratio_||1/0==this.ratio_||isNaN(this.ratio_))&&(this.ratio_=0),this.setHandleLength_(Math.max(0,e.viewHeight*this.ratio_)),this.setHandlePosition(this.constrainHandle_((e.viewTop-e.contentTop)*this.ratio_))},Blockly.Scrollbar.prototype.createDom_=function(){this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical")},null),this.svgBackground_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarBackground"},this.svgGroup_);var e=Math.floor((Blockly.Scrollbar.scrollbarThickness-5)/2);this.svgHandle_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarHandle",rx:e,ry:e},this.svgGroup_),Blockly.Scrollbar.insertAfter_(this.svgGroup_,this.workspace_.getBubbleCanvas())},Blockly.Scrollbar.prototype.isVisible=function(){return this.isVisible_},Blockly.Scrollbar.prototype.setVisible=function(e){if(e!=this.isVisible()){if(this.pair_)throw"Unable to toggle visibility of paired scrollbars.";(this.isVisible_=e)?this.svgGroup_.setAttribute("display","block"):(this.workspace_.setMetrics({x:0,y:0}),this.svgGroup_.setAttribute("display","none"))}},Blockly.Scrollbar.prototype.onMouseDownBar_=function(e){if(this.workspace_.markFocused(),Blockly.Touch.clearTouchIdentifier(),this.cleanUp_(),Blockly.isRightButton(e))e.stopPropagation();else{var o=Blockly.mouseToSvg(e,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM()),o=this.horizontal_?o.x:o.y,t=Blockly.getSvgXY_(this.svgHandle_,this.workspace_),t=this.horizontal_?t.x:t.y,n=this.handlePosition_,r=.95*this.handleLength_;t>=o?n-=r:o>=t+this.handleLength_&&(n+=r),this.setHandlePosition(this.constrainHandle_(n)),this.onScroll_(),e.stopPropagation(),e.preventDefault()}},Blockly.Scrollbar.prototype.onMouseDownHandle_=function(e){this.workspace_.markFocused(),this.cleanUp_(),Blockly.isRightButton(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition_,this.startDragMouse=this.horizontal_?e.clientX:e.clientY,Blockly.Scrollbar.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,this.onMouseUpHandle_),Blockly.Scrollbar.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.onMouseMoveHandle_),e.stopPropagation(),e.preventDefault())},Blockly.Scrollbar.prototype.onMouseMoveHandle_=function(e){this.setHandlePosition(this.constrainHandle_(this.startDragHandle+((this.horizontal_?e.clientX:e.clientY)-this.startDragMouse))),this.onScroll_()},Blockly.Scrollbar.prototype.onMouseUpHandle_=function(){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(e){return e=0>=e||isNaN(e)||this.scrollViewSize_<this.handleLength_?0:Math.min(e,this.scrollViewSize_-this.handleLength_)},Blockly.Scrollbar.prototype.onScroll_=function(){var e=this.handlePosition_/this.scrollViewSize_;isNaN(e)&&(e=0);var o={};this.horizontal_?o.x=e:o.y=e,this.workspace_.setMetrics(o)},Blockly.Scrollbar.prototype.set=function(e){this.setHandlePosition(this.constrainHandle_(e*this.ratio_)),this.onScroll_()},Blockly.Scrollbar.insertAfter_=function(e,o){var t=o.nextSibling,n=o.parentNode;if(!n)throw"Reference node has no parent.";t?n.insertBefore(e,t):n.appendChild(e)},Blockly.Trashcan=function(e){this.workspace_=e},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.isOpen=!1,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.createSvgElement("g",{"class":"blocklyTrash"},null);var e=String(Math.random()).substring(2),o=Blockly.createSvgElement("clipPath",{id:"blocklyTrashBodyClipPath"+e},this.svgGroup_);return Blockly.createSvgElement("rect",{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},o),Blockly.createSvgElement("image",{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+e+")"},this.svgGroup_).setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url),o=Blockly.createSvgElement("clipPath",{id:"blocklyTrashLidClipPath"+e},this.svgGroup_),Blockly.createSvgElement("rect",{width:this.WIDTH_,height:this.LID_HEIGHT_},o),this.svgLid_=Blockly.createSvgElement("image",{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+e+")"},this.svgGroup_),this.svgLid_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url),Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.click),this.animateLid_(),this.svgGroup_},Blockly.Trashcan.prototype.init=function(e){return this.bottom_=this.MARGIN_BOTTOM_+e,this.setOpen_(!1),this.bottom_+this.BODY_HEIGHT_+this.LID_HEIGHT_},Blockly.Trashcan.prototype.dispose=function(){this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.workspace_=this.svgLid_=null,goog.Timer.clear(this.lidTask_)},Blockly.Trashcan.prototype.position=function(){var e=this.workspace_.getMetrics();e&&(this.workspace_.RTL?(this.left_=this.MARGIN_SIDE_+Blockly.Scrollbar.scrollbarThickness,e.toolboxPosition==Blockly.TOOLBOX_AT_LEFT&&(this.left_+=e.flyoutWidth,this.workspace_.toolbox_&&(this.left_+=e.absoluteLeft))):(this.left_=e.viewWidth+e.absoluteLeft-this.WIDTH_-this.MARGIN_SIDE_-Blockly.Scrollbar.scrollbarThickness,e.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT&&(this.left_-=e.flyoutWidth)),this.top_=e.viewHeight+e.absoluteTop-(this.BODY_HEIGHT_+this.LID_HEIGHT_)-this.bottom_,e.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM&&(this.top_-=e.flyoutHeight),this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")"))},Blockly.Trashcan.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var e=this.svgGroup_.getBoundingClientRect();return new goog.math.Rect(e.left+this.SPRITE_LEFT_-this.MARGIN_HOTSPOT_,e.top+this.SPRITE_TOP_-this.MARGIN_HOTSPOT_,this.WIDTH_+2*this.MARGIN_HOTSPOT_,this.LID_HEIGHT_+this.BODY_HEIGHT_+2*this.MARGIN_HOTSPOT_)},Blockly.Trashcan.prototype.setOpen_=function(e){this.isOpen!=e&&(goog.Timer.clear(this.lidTask_),this.isOpen=e,this.animateLid_())},Blockly.Trashcan.prototype.animateLid_=function(){this.lidOpen_+=this.isOpen?.2:-.2,this.lidOpen_=goog.math.clamp(this.lidOpen_,0,1);var e=45*this.lidOpen_;this.svgLid_.setAttribute("transform","rotate("+(this.workspace_.RTL?-e:e)+","+(this.workspace_.RTL?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")"),e=goog.math.lerp(.4,.8,this.lidOpen_),this.svgGroup_.style.opacity=e,0<this.lidOpen_&&1>this.lidOpen_&&(this.lidTask_=goog.Timer.callOnce(this.animateLid_,20,this))},Blockly.Trashcan.prototype.close=function(){this.setOpen_(!1)},Blockly.Trashcan.prototype.click=function(){var e=this.workspace_.startScrollX-this.workspace_.scrollX,o=this.workspace_.startScrollY-this.workspace_.scrollY;Math.sqrt(e*e+o*o)>Blockly.DRAG_RADIUS||console.log("TODO: Inspect trash.")},Blockly.Xml={},Blockly.Xml.workspaceToDom=function(e,o){for(var t,n=goog.dom.createDom("xml"),r=e.getTopBlocks(!0),i=0;t=r[i];i++)n.appendChild(Blockly.Xml.blockToDomWithXY(t,o));return n},Blockly.Xml.blockToDomWithXY=function(e,o){var t;e.workspace.RTL&&(t=e.workspace.getWidth());var n=Blockly.Xml.blockToDom(e,o),r=e.getRelativeToSurfaceXY();return n.setAttribute("x",Math.round(e.workspace.RTL?t-r.x:r.x)),n.setAttribute("y",Math.round(r.y)),n},Blockly.Xml.blockToDom=function(e,o){var t=goog.dom.createDom(e.isShadow()?"shadow":"block");if(t.setAttribute("type",e.type),o||t.setAttribute("id",e.id),e.mutationToDom){var n=e.mutationToDom();n&&(n.hasChildNodes()||n.hasAttributes())&&t.appendChild(n)}for(var r,n=0;r=e.inputList[n];n++)for(var i,s=0;i=r.fieldRow[s];s++)if(i.name&&i.EDITABLE){var l=goog.dom.createDom("field",null,i.getValue());l.setAttribute("name",i.name),t.appendChild(l)}for((n=e.getCommentText())&&(n=goog.dom.createDom("comment",null,n),"object"==typeof e.comment&&(n.setAttribute("pinned",e.comment.isVisible()),r=e.comment.getBubbleSize(),n.setAttribute("h",r.height),n.setAttribute("w",r.width)),t.appendChild(n)),e.data&&(n=goog.dom.createDom("data",null,e.data),t.appendChild(n)),n=0;r=e.inputList[n];n++){var g;i=!0,r.type!=Blockly.DUMMY_INPUT&&(l=r.connection.targetBlock(),r.type==Blockly.INPUT_VALUE?g=goog.dom.createDom("value"):r.type==Blockly.NEXT_STATEMENT&&(g=goog.dom.createDom("statement")),s=r.connection.getShadowDom(),!s||l&&l.isShadow()||g.appendChild(Blockly.Xml.cloneShadow_(s)),l&&(g.appendChild(Blockly.Xml.blockToDom(l,o)),i=!1),g.setAttribute("name",r.name),i||t.appendChild(g))}return e.inputsInlineDefault!=e.inputsInline&&t.setAttribute("inline",e.inputsInline),e.isCollapsed()&&t.setAttribute("collapsed",!0),e.disabled&&t.setAttribute("disabled",!0),e.isDeletable()||e.isShadow()||t.setAttribute("deletable",!1),e.isMovable()||e.isShadow()||t.setAttribute("movable",!1),e.isEditable()||t.setAttribute("editable",!1),(n=e.getNextBlock())&&(g=goog.dom.createDom("next",null,Blockly.Xml.blockToDom(n,o)),t.appendChild(g)),s=e.nextConnection&&e.nextConnection.getShadowDom(),!s||n&&n.isShadow()||g.appendChild(Blockly.Xml.cloneShadow_(s)),t},Blockly.Xml.cloneShadow_=function(e){for(var o,t=e=e.cloneNode(!0);t;)if(t.firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)o=t,t=t.parentNode,3==o.nodeType&&""==o.data.trim()&&t.firstChild!=o&&goog.dom.removeNode(o);t&&(o=t,t=t.nextSibling,3==o.nodeType&&""==o.data.trim()&&goog.dom.removeNode(o))}return e},Blockly.Xml.domToText=function(e){return(new XMLSerializer).serializeToString(e)},Blockly.Xml.domToPrettyText=function(e){e=Blockly.Xml.domToText(e).split("<");for(var o="",t=1;t<e.length;t++){var n=e[t];"/"==n[0]&&(o=o.substring(2)),e[t]=o+"<"+n,"/"!=n[0]&&"/>"!=n.slice(-2)&&(o+="  ")}return e=e.join("\n"),e=e.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>"),e.replace(/^\n/,"")},Blockly.Xml.textToDom=function(e){return(e=(new DOMParser).parseFromString(e,"text/xml"))&&e.firstChild&&"xml"==e.firstChild.nodeName.toLowerCase()&&e.firstChild===e.lastChild||goog.asserts.fail("Blockly.Xml.textToDom did not obtain a valid XML tree."),e.firstChild},Blockly.Xml.domToWorkspace=function(e,o){if(e instanceof Blockly.Workspace){var t=e;e=o,o=t,console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var n;o.RTL&&(n=o.getWidth()),Blockly.Field.startCache();var t=e.childNodes.length,r=Blockly.Events.getGroup();r||Blockly.Events.setGroup(!0),o.setResizesEnabled&&o.setResizesEnabled(!1);for(var i=0;t>i;i++){var s=e.childNodes[i],l=s.nodeName.toLowerCase();if("block"==l||"shadow"==l&&!Blockly.Events.recordUndo){var l=Blockly.Xml.domToBlock(s,o),g=parseInt(s.getAttribute("x"),10),s=parseInt(s.getAttribute("y"),10);isNaN(g)||isNaN(s)||l.moveBy(o.RTL?n-g:g,s)}else"shadow"==l&&goog.asserts.fail("Shadow block cannot be a top-level block.")}r||Blockly.Events.setGroup(!1),Blockly.Field.stopCache(),o.updateVariableList(!1),o.setResizesEnabled&&o.setResizesEnabled(!0)},Blockly.Xml.domToBlock=function(e,o){if(e instanceof Blockly.Workspace){var t=e;e=o,o=t,console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}Blockly.Events.disable();try{var n=Blockly.Xml.domToBlockHeadless_(e,o);if(o.rendered){n.setConnectionsHidden(!0);for(var r=n.getDescendants(),i=r.length-1;i>=0;i--)r[i].initSvg();for(i=r.length-1;i>=0;i--)r[i].render(!1);setTimeout(function(){n.workspace&&n.setConnectionsHidden(!1)},1),n.updateDisabled(),o.resizeContents()}}finally{Blockly.Events.enable()}return Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Create(n)),n},Blockly.Xml.domToBlockHeadless_=function(e,o){var t=null,n=e.getAttribute("type");goog.asserts.assert(n,"Block type unspecified: %s",e.outerHTML);for(var r,i=e.getAttribute("id"),t=o.newBlock(n,i),s=null,i=0;r=e.childNodes[i];i++)if(3!=r.nodeType){for(var l,g=s=null,a=0;l=r.childNodes[a];a++)1==l.nodeType&&("block"==l.nodeName.toLowerCase()?s=l:"shadow"==l.nodeName.toLowerCase()&&(g=l));switch(!s&&g&&(s=g),a=r.getAttribute("name"),r.nodeName.toLowerCase()){case"mutation":t.domToMutation&&(t.domToMutation(r),t.initSvg&&t.initSvg());break;case"comment":t.setCommentText(r.textContent);var c=r.getAttribute("pinned");c&&!t.isInFlyout&&setTimeout(function(){t.comment&&t.comment.setVisible&&t.comment.setVisible("true"==c)},1),s=parseInt(r.getAttribute("w"),10),r=parseInt(r.getAttribute("h"),10),!isNaN(s)&&!isNaN(r)&&t.comment&&t.comment.setVisible&&t.comment.setBubbleSize(s,r);break;case"data":t.data=r.textContent;break;case"title":case"field":if(s=t.getField(a),!s){console.warn("Ignoring non-existent field "+a+" in block "+n);break}s.setValue(r.textContent);break;case"value":case"statement":if(r=t.getInput(a),!r){console.warn("Ignoring non-existent input "+a+" in block "+n);break}g&&r.connection.setShadowDom(g),s&&(s=Blockly.Xml.domToBlockHeadless_(s,o),s.outputConnection?r.connection.connect(s.outputConnection):s.previousConnection?r.connection.connect(s.previousConnection):goog.asserts.fail("Child block does not have output or previous statement."));break;case"next":g&&t.nextConnection&&t.nextConnection.setShadowDom(g),s&&(goog.asserts.assert(t.nextConnection,"Next statement does not exist."),goog.asserts.assert(!t.nextConnection.isConnected(),"Next statement is already connected."),s=Blockly.Xml.domToBlockHeadless_(s,o),goog.asserts.assert(s.previousConnection,"Next block does not have previous statement."),t.nextConnection.connect(s.previousConnection));break;default:console.warn("Ignoring unknown tag: "+r.nodeName)}}if((i=e.getAttribute("inline"))&&t.setInputsInline("true"==i),(i=e.getAttribute("disabled"))&&t.setDisabled("true"==i),(i=e.getAttribute("deletable"))&&t.setDeletable("true"==i),(i=e.getAttribute("movable"))&&t.setMovable("true"==i),(i=e.getAttribute("editable"))&&t.setEditable("true"==i),(i=e.getAttribute("collapsed"))&&t.setCollapsed("true"==i),"shadow"==e.nodeName.toLowerCase()){for(n=t.getChildren(),i=0;r=n[i];i++)goog.asserts.assert(r.isShadow(),"Shadow block not allowed non-shadow child.");goog.asserts.assert(0==t.getVars().length,"Shadow blocks cannot have variable fields."),t.setShadow(!0)}return t},Blockly.Xml.deleteNext=function(e){for(var o,t=0;o=e.childNodes[t];t++)if("next"==o.nodeName.toLowerCase()){e.removeChild(o);break}},goog.global.Blockly||(goog.global.Blockly={}),goog.global.Blockly.Xml||(goog.global.Blockly.Xml={}),goog.global.Blockly.Xml.domToText=Blockly.Xml.domToText,goog.global.Blockly.Xml.domToWorkspace=Blockly.Xml.domToWorkspace,goog.global.Blockly.Xml.textToDom=Blockly.Xml.textToDom,goog.global.Blockly.Xml.workspaceToDom=Blockly.Xml.workspaceToDom,Blockly.ZoomControls=function(e){this.workspace_=e},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(){var e=this.workspace_;this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyZoom"},null);var o=String(Math.random()).substring(2),t=Blockly.createSvgElement("clipPath",{id:"blocklyZoomoutClipPath"+o},this.svgGroup_);Blockly.createSvgElement("rect",{width:32,height:32,y:77},t);var n=Blockly.createSvgElement("image",{width:Blockly.SPRITE.width,height:Blockly.SPRITE.height,x:-64,y:-15,"clip-path":"url(#blocklyZoomoutClipPath"+o+")"},this.svgGroup_);n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.options.pathToMedia+Blockly.SPRITE.url),t=Blockly.createSvgElement("clipPath",{id:"blocklyZoominClipPath"+o},this.svgGroup_),Blockly.createSvgElement("rect",{width:32,height:32,y:43},t);var r=Blockly.createSvgElement("image",{width:Blockly.SPRITE.width,height:Blockly.SPRITE.height,x:-32,y:-49,"clip-path":"url(#blocklyZoominClipPath"+o+")"},this.svgGroup_);return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.options.pathToMedia+Blockly.SPRITE.url),t=Blockly.createSvgElement("clipPath",{id:"blocklyZoomresetClipPath"+o},this.svgGroup_),Blockly.createSvgElement("rect",{width:32,height:32},t),o=Blockly.createSvgElement("image",{width:Blockly.SPRITE.width,height:Blockly.SPRITE.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+o+")"},this.svgGroup_),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.options.pathToMedia+Blockly.SPRITE.url),Blockly.bindEventWithChecks_(o,"mousedown",null,function(o){e.markFocused(),e.setScale(e.options.zoomOptions.startScale),e.scrollCenter(),Blockly.Touch.clearTouchIdentifier(),o.stopPropagation(),o.preventDefault()}),Blockly.bindEventWithChecks_(r,"mousedown",null,function(o){e.markFocused(),e.zoomCenter(1),Blockly.Touch.clearTouchIdentifier(),o.stopPropagation(),o.preventDefault()}),Blockly.bindEventWithChecks_(n,"mousedown",null,function(o){e.markFocused(),e.zoomCenter(-1),Blockly.Touch.clearTouchIdentifier(),o.stopPropagation(),o.preventDefault()}),this.svgGroup_},Blockly.ZoomControls.prototype.init=function(e){return this.bottom_=this.MARGIN_BOTTOM_+e,this.bottom_+this.HEIGHT_},Blockly.ZoomControls.prototype.dispose=function(){this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.workspace_=null},Blockly.ZoomControls.prototype.position=function(){var e=this.workspace_.getMetrics();e&&(this.workspace_.RTL?(this.left_=this.MARGIN_SIDE_+Blockly.Scrollbar.scrollbarThickness,e.toolboxPosition==Blockly.TOOLBOX_AT_LEFT&&(this.left_+=e.flyoutWidth,this.workspace_.toolbox_&&(this.left_+=e.absoluteLeft))):(this.left_=e.viewWidth+e.absoluteLeft-this.WIDTH_-this.MARGIN_SIDE_-Blockly.Scrollbar.scrollbarThickness,e.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT&&(this.left_-=e.flyoutWidth)),this.top_=e.viewHeight+e.absoluteTop-this.HEIGHT_-this.bottom_,e.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM&&(this.top_-=e.flyoutHeight),this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")"))},Blockly.WorkspaceSvg=function(e){Blockly.WorkspaceSvg.superClass_.constructor.call(this,e),this.getMetrics=e.getMetrics||Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_,this.setMetrics=e.setMetrics||Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_,Blockly.ConnectionDB.init(this),this.SOUNDS_=Object.create(null),this.highlightedBlocks_=[]},goog.inherits(Blockly.WorkspaceSvg,Blockly.Workspace),Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_=null,Blockly.WorkspaceSvg.prototype.rendered=!0,Blockly.WorkspaceSvg.prototype.isFlyout=!1,Blockly.WorkspaceSvg.prototype.isMutator=!1,Blockly.WorkspaceSvg.prototype.dragMode_=Blockly.DRAG_NONE,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.lastSound_=null,Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_=null,Blockly.WorkspaceSvg.prototype.inverseScreenCTM_=null,Blockly.WorkspaceSvg.prototype.getInverseScreenCTM=function(){return this.inverseScreenCTM_},Blockly.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){var e=this.getParentSvg().getScreenCTM();e&&(this.inverseScreenCTM_=e.inverse())},Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper=function(e){this.resizeHandlerWrapper_=e},Blockly.WorkspaceSvg.prototype.createDom=function(e){if(this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyWorkspace"},null),e&&(this.svgBackground_=Blockly.createSvgElement("rect",{height:"100%",width:"100%","class":e},this.svgGroup_),"blocklyMainBackground"==e&&(this.svgBackground_.style.fill="url(#"+this.options.gridPattern.id+")")),this.svgBlockCanvas_=Blockly.createSvgElement("g",{"class":"blocklyBlockCanvas"},this.svgGroup_,this),this.svgBubbleCanvas_=Blockly.createSvgElement("g",{"class":"blocklyBubbleCanvas"},this.svgGroup_,this),e=Blockly.Scrollbar.scrollbarThickness,this.options.hasTrashcan&&(e=this.addTrashcan_(e)),this.options.zoomOptions&&this.options.zoomOptions.controls&&(e=this.addZoomControls_(e)),!this.isFlyout){Blockly.bindEventWithChecks_(this.svgGroup_,"mousedown",this,this.onMouseDown_);var o=this;Blockly.bindEvent_(this.svgGroup_,"touchstart",null,function(e){Blockly.longStart_(e,o)}),this.options.zoomOptions&&this.options.zoomOptions.wheel&&Blockly.bindEventWithChecks_(this.svgGroup_,"wheel",this,this.onMouseWheel_)}return this.options.hasCategories?this.toolbox_=new Blockly.Toolbox(this):this.options.languageTree&&this.addFlyout_(),this.updateGridPattern_(),this.recordDeleteAreas(),this.svgGroup_},Blockly.WorkspaceSvg.prototype.dispose=function(){this.rendered=!1,Blockly.WorkspaceSvg.superClass_.dispose.call(this),this.svgGroup_&&(goog.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.options.parentWorkspace||goog.dom.removeNode(this.getParentSvg().parentNode),this.resizeHandlerWrapper_&&(Blockly.unbindEvent_(this.resizeHandlerWrapper_),this.resizeHandlerWrapper_=null)},Blockly.WorkspaceSvg.prototype.newBlock=function(e,o){return new Blockly.BlockSvg(this,e,o)},Blockly.WorkspaceSvg.prototype.addTrashcan_=function(e){this.trashcan=new Blockly.Trashcan(this);var o=this.trashcan.createDom();return this.svgGroup_.insertBefore(o,this.svgBlockCanvas_),this.trashcan.init(e)},Blockly.WorkspaceSvg.prototype.addZoomControls_=function(e){this.zoomControls_=new Blockly.ZoomControls(this);var o=this.zoomControls_.createDom();return this.svgGroup_.appendChild(o),this.zoomControls_.init(e)},Blockly.WorkspaceSvg.prototype.addFlyout_=function(){this.flyout_=new Blockly.Flyout({disabledPatternId:this.options.disabledPatternId,parentWorkspace:this,RTL:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,toolboxPosition:this.options.toolboxPosition}),this.flyout_.autoClose=!1;var e=this.flyout_.createDom();this.svgGroup_.insertBefore(e,this.svgBlockCanvas_)},Blockly.WorkspaceSvg.prototype.updateScreenCalculations_=function(){this.updateInverseScreenCTM(),this.recordDeleteAreas()},Blockly.WorkspaceSvg.prototype.resizeContents=function(){this.resizesEnabled_&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),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 e=goog.dom.getDocumentScroll();goog.math.Coordinate.equals(this.lastRecordedPageScroll_,e)||(this.lastRecordedPageScroll_=e,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 e=this.svgGroup_;e;){if("svg"==e.tagName)return this.cachedParentSvg_=e;e=e.parentNode}return null},Blockly.WorkspaceSvg.prototype.translate=function(e,o){var t="translate("+e+","+o+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",t),this.svgBubbleCanvas_.setAttribute("transform",t)},Blockly.WorkspaceSvg.prototype.getWidth=function(){var e=this.getMetrics();return e?e.viewWidth/this.scale:0},Blockly.WorkspaceSvg.prototype.setVisible=function(e){this.getParentSvg().style.display=e?"block":"none",this.toolbox_&&(this.toolbox_.HtmlDiv.style.display=e?"block":"none"),e?(this.render(),this.toolbox_&&this.toolbox_.position()):Blockly.hideChaff(!0)},Blockly.WorkspaceSvg.prototype.render=function(){for(var e=this.getAllBlocks(),o=e.length-1;o>=0;o--)e[o].render(!1)},Blockly.WorkspaceSvg.prototype.traceOn=function(){console.warn("Deprecated call to traceOn, delete this.")},Blockly.WorkspaceSvg.prototype.highlightBlock=function(e,o){if(void 0===o){for(var t,n=0;t=this.highlightedBlocks_[n];n++)t.setHighlighted(!1);this.highlightedBlocks_.length=0}(t=e?this.getBlockById(e):null)&&((n=void 0===o||o)?-1==this.highlightedBlocks_.indexOf(t)&&this.highlightedBlocks_.push(t):goog.array.remove(this.highlightedBlocks_,t),
    1717t.setHighlighted(n))},Blockly.WorkspaceSvg.prototype.paste=function(e){if(this.rendered&&!(e.getElementsByTagName("block").length>=this.remainingCapacity())){Blockly.terminateDrag_(),Blockly.Events.disable();try{var o=Blockly.Xml.domToBlock(e,this),t=parseInt(e.getAttribute("x"),10),n=parseInt(e.getAttribute("y"),10);if(!isNaN(t)&&!isNaN(n)){this.RTL&&(t=-t);do{e=!1;for(var r,i=this.getAllBlocks(),s=0;r=i[s];s++){var l=r.getRelativeToSurfaceXY();if(1>=Math.abs(t-l.x)&&1>=Math.abs(n-l.y)){e=!0;break}}if(!e)for(var g,a=o.getConnections_(!1),s=0;g=a[s];s++)if(g.closest(Blockly.SNAP_RADIUS,new goog.math.Coordinate(t,n)).connection){e=!0;break}e&&(t=this.RTL?t-Blockly.SNAP_RADIUS:t+Blockly.SNAP_RADIUS,n+=2*Blockly.SNAP_RADIUS)}while(e);o.moveBy(t,n)}}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!o.isShadow()&&Blockly.Events.fire(new Blockly.Events.Create(o)),o.select()}},Blockly.WorkspaceSvg.prototype.createVariable=function(e){Blockly.WorkspaceSvg.superClass_.createVariable.call(this,e),this.toolbox_&&this.toolbox_.flyout_&&!Blockly.Flyout.startFlyout_&&this.toolbox_.refreshSelection()},Blockly.WorkspaceSvg.prototype.recordDeleteAreas=function(){this.deleteAreaTrash_=this.trashcan?this.trashcan.getClientRect():null,this.deleteAreaToolbox_=this.flyout_?this.flyout_.getClientRect():this.toolbox_?this.toolbox_.getClientRect():null},Blockly.WorkspaceSvg.prototype.isDeleteArea=function(e){if(e=new goog.math.Coordinate(e.clientX,e.clientY),this.deleteAreaTrash_){if(this.deleteAreaTrash_.contains(e))return this.trashcan.setOpen_(!0),Blockly.Css.setCursor(Blockly.Css.Cursor.DELETE),!0;this.trashcan.setOpen_(!1)}return this.deleteAreaToolbox_&&this.deleteAreaToolbox_.contains(e)?(Blockly.Css.setCursor(Blockly.Css.Cursor.DELETE),!0):(Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),!1)},Blockly.WorkspaceSvg.prototype.onMouseDown_=function(e){this.markFocused(),Blockly.isTargetInput_(e)?Blockly.Touch.clearTouchIdentifier():(Blockly.terminateDrag_(),Blockly.hideChaff(),e.target&&e.target.nodeName&&("svg"==e.target.nodeName.toLowerCase()||e.target==this.svgBackground_)&&Blockly.selected&&!this.options.readOnly&&Blockly.selected.unselect(),Blockly.isRightButton(e)?(this.showContextMenu_(e),Blockly.Touch.clearTouchIdentifier()):this.scrollbar?(this.dragMode_=Blockly.DRAG_BEGIN,this.startDragMouseX=e.clientX,this.startDragMouseY=e.clientY,this.startDragMetrics=this.getMetrics(),this.startScrollX=this.scrollX,this.startScrollY=this.scrollY,"mouseup"in Blockly.Touch.TOUCH_MAP&&(Blockly.Touch.onTouchUpWrapper_=Blockly.Touch.onTouchUpWrapper_||[],Blockly.Touch.onTouchUpWrapper_=Blockly.Touch.onTouchUpWrapper_.concat(Blockly.bindEventWithChecks_(document,"mouseup",null,Blockly.onMouseUp_))),Blockly.onMouseMoveWrapper_=Blockly.onMouseMoveWrapper_||[],Blockly.onMouseMoveWrapper_=Blockly.onMouseMoveWrapper_.concat(Blockly.bindEventWithChecks_(document,"mousemove",null,Blockly.onMouseMove_))):Blockly.Touch.clearTouchIdentifier(),e.stopPropagation(),e.preventDefault())},Blockly.WorkspaceSvg.prototype.startDrag=function(e,o){var t=Blockly.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM());t.x/=this.scale,t.y/=this.scale,this.dragDeltaXY_=goog.math.Coordinate.difference(o,t)},Blockly.WorkspaceSvg.prototype.moveDrag=function(e){return e=Blockly.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM()),e.x/=this.scale,e.y/=this.scale,goog.math.Coordinate.sum(this.dragDeltaXY_,e)},Blockly.WorkspaceSvg.prototype.isDragging=function(){return Blockly.dragMode_==Blockly.DRAG_FREE||Blockly.Flyout.startFlyout_&&Blockly.Flyout.startFlyout_.dragMode_==Blockly.DRAG_FREE||this.dragMode_==Blockly.DRAG_FREE},Blockly.WorkspaceSvg.prototype.onMouseWheel_=function(e){Blockly.terminateDrag_();var o=0<e.deltaY?-1:1,t=Blockly.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM());this.zoom(t.x,t.y,o),e.preventDefault()},Blockly.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var e=this.getTopBlocks(!1);if(!e.length)return{x:0,y:0,width:0,height:0};for(var o=e[0].getBoundingRectangle(),t=1;t<e.length;t++){var n=e[t].getBoundingRectangle();n.topLeft.x<o.topLeft.x&&(o.topLeft.x=n.topLeft.x),n.bottomRight.x>o.bottomRight.x&&(o.bottomRight.x=n.bottomRight.x),n.topLeft.y<o.topLeft.y&&(o.topLeft.y=n.topLeft.y),n.bottomRight.y>o.bottomRight.y&&(o.bottomRight.y=n.bottomRight.y)}return{x:o.topLeft.x,y:o.topLeft.y,width:o.bottomRight.x-o.topLeft.x,height:o.bottomRight.y-o.topLeft.y}},Blockly.WorkspaceSvg.prototype.cleanUp=function(){Blockly.Events.setGroup(!0);for(var e,o=this.getTopBlocks(!0),t=0,n=0;e=o[n];n++){var r=e.getRelativeToSurfaceXY();e.moveBy(-r.x,t-r.y),e.snapToGrid(),t=e.getRelativeToSurfaceXY().y+e.getHeightWidth().height+Blockly.BlockSvg.MIN_BLOCK_Y}Blockly.Events.setGroup(!1),this.resizeContents()},Blockly.WorkspaceSvg.prototype.showContextMenu_=function(e){function o(e){if(e.isDeletable())u=u.concat(e.getDescendants());else{e=e.getChildren();for(var t=0;t<e.length;t++)o(e[t])}}function t(){Blockly.Events.setGroup(i);var e=u.shift();e&&(e.workspace?(e.dispose(!1,!0),setTimeout(t,10)):t()),Blockly.Events.setGroup(!1)}if(!this.options.readOnly&&!this.isFlyout){var n=[],r=this.getTopBlocks(!0),i=Blockly.genUid(),s={};if(s.text=Blockly.Msg.UNDO,s.enabled=0<this.undoStack_.length,s.callback=this.undo.bind(this,!1),n.push(s),s={},s.text=Blockly.Msg.REDO,s.enabled=0<this.redoStack_.length,s.callback=this.undo.bind(this,!0),n.push(s),this.scrollbar&&(s={},s.text=Blockly.Msg.CLEAN_UP,s.enabled=1<r.length,s.callback=this.cleanUp.bind(this),n.push(s)),this.options.collapse){for(var l=s=!1,g=0;g<r.length;g++)for(var a=r[g];a;)a.isCollapsed()?s=!0:l=!0,a=a.getNextBlock();var c=function(e){for(var o=0,t=0;t<r.length;t++)for(var n=r[t];n;)setTimeout(n.setCollapsed.bind(n,e),o),n=n.getNextBlock(),o+=10},l={enabled:l};l.text=Blockly.Msg.COLLAPSE_ALL,l.callback=function(){c(!0)},n.push(l),s={enabled:s},s.text=Blockly.Msg.EXPAND_ALL,s.callback=function(){c(!1)},n.push(s)}for(var u=[],g=0;g<r.length;g++)o(r[g]);s={text:1==u.length?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(u.length)),enabled:0<u.length,callback:function(){2>u.length?t():Blockly.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1",u.length),function(e){e&&t()})}},n.push(s),Blockly.ContextMenu.show(e,n,this.RTL)}},Blockly.WorkspaceSvg.prototype.loadAudio_=function(e,o){if(e.length){try{var t=new window.Audio}catch(n){return}for(var r,i=0;i<e.length;i++){var s=e[i],l=s.match(/\.(\w+)$/);if(l&&t.canPlayType("audio/"+l[1])){r=new window.Audio(s);break}}r&&r.play&&(this.SOUNDS_[o]=r)}},Blockly.WorkspaceSvg.prototype.preloadAudio_=function(){for(var e in this.SOUNDS_){var o=this.SOUNDS_[e];if(o.volume=.01,o.play(),o.pause(),goog.userAgent.IPAD||goog.userAgent.IPHONE)break}},Blockly.WorkspaceSvg.prototype.playAudio=function(e,o){var t=this.SOUNDS_[e];if(t){var n=new Date;n-this.lastSound_<Blockly.SOUND_LIMIT||(this.lastSound_=n,t=goog.userAgent.DOCUMENT_MODE&&9===goog.userAgent.DOCUMENT_MODE||goog.userAgent.IPAD||goog.userAgent.ANDROID?t:t.cloneNode(),t.volume=void 0===o?1:o,t.play())}else this.options.parentWorkspace&&this.options.parentWorkspace.playAudio(e,o)},Blockly.WorkspaceSvg.prototype.updateToolbox=function(e){if(e=Blockly.Options.parseToolboxTree(e)){if(!this.options.languageTree)throw"Existing toolbox is null.  Can't create new toolbox.";if(e.getElementsByTagName("category").length){if(!this.toolbox_)throw"Existing toolbox has no categories.  Can't change mode.";this.options.languageTree=e,this.toolbox_.populate_(e),this.toolbox_.addColour_()}else{if(!this.flyout_)throw"Existing toolbox has categories.  Can't change mode.";this.options.languageTree=e,this.flyout_.show(e.childNodes)}}else if(this.options.languageTree)throw"Can't nullify an existing toolbox."},Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():Blockly.mainWorkspace=this},Blockly.WorkspaceSvg.prototype.zoom=function(e,o,t){var n=this.options.zoomOptions.scaleSpeed,r=this.getMetrics(),i=this.getParentSvg().createSVGPoint();i.x=e,i.y=o,i=i.matrixTransform(this.getCanvas().getCTM().inverse()),e=i.x,o=i.y,i=this.getCanvas(),n=1==t?n:1/n,t=this.scale*n,t>this.options.zoomOptions.maxScale?n=this.options.zoomOptions.maxScale/this.scale:t<this.options.zoomOptions.minScale&&(n=this.options.zoomOptions.minScale/this.scale),this.scale!=t&&(this.scrollbar&&(e=i.getCTM().translate(e*(1-n),o*(1-n)).scale(n),this.scrollX=e.e-r.absoluteLeft,this.scrollY=e.f-r.absoluteTop),this.setScale(t))},Blockly.WorkspaceSvg.prototype.zoomCenter=function(e){var o=this.getMetrics();this.zoom(o.viewWidth/2,o.viewHeight/2,e)},Blockly.WorkspaceSvg.prototype.zoomToFit=function(){var e=this.getMetrics(),o=this.getBlocksBoundingBox(),t=o.width,o=o.height;if(t){var n=e.viewWidth,r=e.viewHeight;this.flyout_&&(n-=this.flyout_.width_),this.scrollbar||(t+=e.contentLeft,o+=e.contentTop),this.setScale(Math.min(n/t,r/o)),this.scrollCenter()}},Blockly.WorkspaceSvg.prototype.scrollCenter=function(){if(this.scrollbar){var e=this.getMetrics(),o=(e.contentWidth-e.viewWidth)/2;this.flyout_&&(o-=this.flyout_.width_/2),this.scrollbar.set(o,(e.contentHeight-e.viewHeight)/2)}},Blockly.WorkspaceSvg.prototype.setScale=function(e){this.options.zoomOptions.maxScale&&e>this.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&e<this.options.zoomOptions.minScale&&(e=this.options.zoomOptions.minScale),this.scale=e,this.updateGridPattern_(),this.scrollbar?this.scrollbar.resize():this.translate(this.scrollX,this.scrollY),Blockly.hideChaff(!1),this.flyout_&&this.flyout_.reflow()},Blockly.WorkspaceSvg.prototype.updateGridPattern_=function(){if(this.options.gridPattern){var e=this.options.gridOptions.spacing*this.scale||100;this.options.gridPattern.setAttribute("width",e),this.options.gridPattern.setAttribute("height",e);var e=Math.floor(this.options.gridOptions.spacing/2)+.5,o=e-this.options.gridOptions.length/2,t=e+this.options.gridOptions.length/2,n=this.options.gridPattern.firstChild,r=n&&n.nextSibling,e=e*this.scale,o=o*this.scale,t=t*this.scale;n&&(n.setAttribute("stroke-width",this.scale),n.setAttribute("x1",o),n.setAttribute("y1",e),n.setAttribute("x2",t),n.setAttribute("y2",e)),r&&(r.setAttribute("stroke-width",this.scale),r.setAttribute("x1",e),r.setAttribute("y1",o),r.setAttribute("x2",e),r.setAttribute("y2",t))}},Blockly.WorkspaceSvg.getTopLevelWorkspaceMetrics_=function(){var e=Blockly.svgSize(this.getParentSvg());this.toolbox_&&(this.toolboxPosition==Blockly.TOOLBOX_AT_TOP||this.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM?e.height-=this.toolbox_.getHeight():(this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT||this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT)&&(e.width-=this.toolbox_.getWidth()));var o=Blockly.Flyout.prototype.CORNER_RADIUS-1,t=e.width-o,n=e.height-o,r=this.getBlocksBoundingBox(),i=r.width*this.scale,s=r.height*this.scale,l=r.x*this.scale,g=r.y*this.scale;return this.scrollbar?(o=Math.min(l-t/2,l+i-t),t=Math.max(l+i+t/2,l+t),i=Math.min(g-n/2,g+s-n),n=Math.max(g+s+n/2,g+n)):(o=r.x,t=o+r.width,i=r.y,n=i+r.height),r=0,this.toolbox_&&this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT&&(r=this.toolbox_.getWidth()),s=0,this.toolbox_&&this.toolboxPosition==Blockly.TOOLBOX_AT_TOP&&(s=this.toolbox_.getHeight()),{viewHeight:e.height,viewWidth:e.width,contentHeight:n-i,contentWidth:t-o,viewTop:-this.scrollY,viewLeft:-this.scrollX,contentTop:i,contentLeft:o,absoluteTop:s,absoluteLeft:r,toolboxWidth:this.toolbox_?this.toolbox_.getWidth():0,toolboxHeight:this.toolbox_?this.toolbox_.getHeight():0,flyoutWidth:this.flyout_?this.flyout_.getWidth():0,flyoutHeight:this.flyout_?this.flyout_.getHeight():0,toolboxPosition:this.toolboxPosition}},Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_=function(e){if(!this.scrollbar)throw"Attempt to set top level workspace scroll without scrollbars.";var o=this.getMetrics();goog.isNumber(e.x)&&(this.scrollX=-o.contentWidth*e.x-o.contentLeft),goog.isNumber(e.y)&&(this.scrollY=-o.contentHeight*e.y-o.contentTop),e=this.scrollX+o.absoluteLeft,o=this.scrollY+o.absoluteTop,this.translate(e,o),this.options.gridPattern&&(this.options.gridPattern.setAttribute("x",e),this.options.gridPattern.setAttribute("y",o),goog.userAgent.IE&&this.updateGridPattern_())},Blockly.WorkspaceSvg.prototype.setResizesEnabled=function(e){var o=!this.resizesEnabled_&&e;this.resizesEnabled_=e,o&&this.resizeContents()},Blockly.WorkspaceSvg.prototype.clear=function(){this.setResizesEnabled(!1),Blockly.WorkspaceSvg.superClass_.clear.call(this),this.setResizesEnabled(!0)},Blockly.WorkspaceSvg.prototype.setVisible=Blockly.WorkspaceSvg.prototype.setVisible,Blockly.Mutator=function(e){Blockly.Mutator.superClass_.constructor.call(this,null),this.quarkNames_=e},goog.inherits(Blockly.Mutator,Blockly.Icon),Blockly.Mutator.prototype.workspaceWidth_=0,Blockly.Mutator.prototype.workspaceHeight_=0,Blockly.Mutator.prototype.drawIcon_=function(e){Blockly.createSvgElement("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},e),Blockly.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"},e),Blockly.createSvgElement("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},e)},Blockly.Mutator.prototype.iconClick_=function(e){this.block_.isEditable()&&Blockly.Icon.prototype.iconClick_.call(this,e)},Blockly.Mutator.prototype.createEditor_=function(){if(this.svgDialog_=Blockly.createSvgElement("svg",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null),this.quarkNames_.length)for(var e,o=goog.dom.createDom("xml"),t=0;e=this.quarkNames_[t];t++)o.appendChild(goog.dom.createDom("block",{type:e}));else o=null;return o={languageTree:o,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(o),this.workspace_.isMutator=!0,this.svgDialog_.appendChild(this.workspace_.createDom("blocklyMutatorBackground")),this.svgDialog_},Blockly.Mutator.prototype.updateEditable=function(){this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&Blockly.removeClass_(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&Blockly.addClass_(this.iconGroup_,"blocklyIconGroupReadonly"))),Blockly.Icon.prototype.updateEditable.call(this)},Blockly.Mutator.prototype.resizeBubble_=function(){var e,o=2*Blockly.Bubble.BORDER_WIDTH,t=this.workspace_.getCanvas().getBBox();if(e=this.block_.RTL?-t.x:t.width+t.x,t=t.height+3*o,this.workspace_.flyout_)var n=this.workspace_.flyout_.getMetrics_(),t=Math.max(t,n.contentHeight+20);e+=3*o,(Math.abs(this.workspaceWidth_-e)>o||Math.abs(this.workspaceHeight_-t)>o)&&(this.workspaceWidth_=e,this.workspaceHeight_=t,this.bubble_.setBubbleSize(e+o,t+o),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_)),this.block_.RTL&&(o="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",o)),this.workspace_.resize()},Blockly.Mutator.prototype.setVisible=function(e){if(e!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"mutatorOpen",!e,e)),e){this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svgPath_,this.iconXY_,null,null),(e=this.workspace_.options.languageTree)&&(this.workspace_.flyout_.init(this.workspace_),this.workspace_.flyout_.show(e.childNodes)),this.rootBlock_=this.block_.decompose(this.workspace_),e=this.rootBlock_.getDescendants();for(var o,t=0;o=e[t];t++)o.render();if(this.rootBlock_.setMovable(!1),this.rootBlock_.setDeletable(!1),this.workspace_.flyout_?(e=2*this.workspace_.flyout_.CORNER_RADIUS,t=this.workspace_.flyout_.width_+e):t=e=16,this.block_.RTL&&(t=-t),this.rootBlock_.moveBy(t,e),this.block_.saveConnections){var n=this;this.block_.saveConnections(this.rootBlock_),this.sourceListener_=function(){n.block_.saveConnections(n.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(){if(Blockly.dragMode_==Blockly.DRAG_NONE)for(var e,o=this.workspace_.getTopBlocks(!1),t=0;e=o[t];t++){var n=e.getRelativeToSurfaceXY(),r=e.getHeightWidth();20>n.y+r.height&&e.moveBy(0,20-r.height-n.y)}if(this.rootBlock_.workspace==this.workspace_){if(Blockly.Events.setGroup(!0),e=this.block_,o=(o=e.mutationToDom())&&Blockly.Xml.domToText(o),t=e.rendered,e.rendered=!1,e.compose(this.rootBlock_),e.rendered=t,e.initSvg(),t=(t=e.mutationToDom())&&Blockly.Xml.domToText(t),o!=t){Blockly.Events.fire(new Blockly.Events.Change(e,"mutation",null,o,t));var i=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(i),e.bumpNeighbours_(),Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)}e.rendered&&e.render(),this.resizeBubble_(),Blockly.Events.setGroup(!1)}},Blockly.Mutator.prototype.getFlyoutMetrics_=function(){return{viewHeight:this.workspaceHeight_,viewWidth:this.workspaceWidth_,absoluteTop:0,absoluteLeft:0}},Blockly.Mutator.prototype.dispose=function(){this.block_.mutator=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Mutator.reconnect=function(e,o,t){if(!e||!e.getSourceBlock().workspace)return!1;t=o.getInput(t).connection;var n=e.targetBlock();return n&&n!=o||t.targetConnection==e?!1:(t.isConnected()&&t.disconnect(),t.connect(e),!0)},goog.global.Blockly||(goog.global.Blockly={}),goog.global.Blockly.Mutator||(goog.global.Blockly.Mutator={}),goog.global.Blockly.Mutator.reconnect=Blockly.Mutator.reconnect,Blockly.Warning=function(e){Blockly.Warning.superClass_.constructor.call(this,e),this.createIcon(),this.text_={}},goog.inherits(Blockly.Warning,Blockly.Icon),Blockly.Warning.prototype.collapseHidden=!1,Blockly.Warning.prototype.drawIcon_=function(e){Blockly.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"},e),Blockly.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},e),Blockly.createSvgElement("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},e)},Blockly.Warning.textToDom_=function(e){var o=Blockly.createSvgElement("text",{"class":"blocklyText blocklyBubbleText",y:Blockly.Bubble.BORDER_WIDTH},null);e=e.split("\n");for(var t=0;t<e.length;t++){var n=Blockly.createSvgElement("tspan",{dy:"1em",x:Blockly.Bubble.BORDER_WIDTH},o),r=document.createTextNode(e[t]);n.appendChild(r)}return o},Blockly.Warning.prototype.setVisible=function(e){if(e!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"warningOpen",!e,e)),e){if(e=Blockly.Warning.textToDom_(this.getText()),this.bubble_=new Blockly.Bubble(this.block_.workspace,e,this.block_.svgPath_,this.iconXY_,null,null),this.block_.RTL)for(var o,t=e.getBBox().width,n=0;o=e.childNodes[n];n++)o.setAttribute("text-anchor","end"),o.setAttribute("x",t+Blockly.Bubble.BORDER_WIDTH);this.updateColour(),e=this.bubble_.getBubbleSize(),this.bubble_.setBubbleSize(e.width,e.height)}else this.bubble_.dispose(),this.body_=this.bubble_=null},Blockly.Warning.prototype.bodyFocus_=function(e){this.bubble_.promote_()},Blockly.Warning.prototype.setText=function(e,o){this.text_[o]!=e&&(e?this.text_[o]=e:delete this.text_[o],this.isVisible()&&(this.setVisible(!1),this.setVisible(!0)))},Blockly.Warning.prototype.getText=function(){var e,o=[];for(e in this.text_)o.push(this.text_[e]);return o.join("\n")},Blockly.Warning.prototype.dispose=function(){this.block_.warning=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Block=function(e,o,t){this.id=t&&!e.getBlockById(t)?t:Blockly.genUid(),e.blockDB_[this.id]=this,this.previousConnection=this.nextConnection=this.outputConnection=null,this.inputList=[],this.inputsInline=void 0,this.disabled=!1,this.tooltip="",this.contextMenu=!0,this.parentBlock_=null,this.childBlocks_=[],this.editable_=this.movable_=this.deletable_=!0,this.collapsed_=this.isShadow_=!1,this.comment=null,this.xy_=new goog.math.Coordinate(0,0),this.workspace=e,this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,o&&(this.type=o,t=Blockly.Blocks[o],goog.asserts.assertObject(t,'Error: "%s" is an unknown language block.',o),goog.mixin(this,t)),e.addTopBlock(this),goog.isFunction(this.init)&&this.init(),this.inputsInlineDefault=this.inputsInline,Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Create(this)),goog.isFunction(this.onchange)&&(this.onchangeWrapper_=this.onchange.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_))},Blockly.Block.obtain=function(e,o){return console.warn("Deprecated call to Blockly.Block.obtain, use workspace.newBlock instead."),e.newBlock(o)},Blockly.Block.prototype.data=null,Blockly.Block.prototype.colour_="#000000",Blockly.Block.prototype.dispose=function(e){if(this.workspace){this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_),this.unplug(e),Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Delete(this)),Blockly.Events.disable();try{this.workspace&&(this.workspace.removeTopBlock(this),delete this.workspace.blockDB_[this.id],this.workspace=null);for(var o=this.childBlocks_.length-1;o>=0;o--)this.childBlocks_[o].dispose(!1);for(var t,o=0;t=this.inputList[o];o++)t.dispose();this.inputList.length=0;for(var n=this.getConnections_(!0),o=0;o<n.length;o++){var r=n[o];r.isConnected()&&r.disconnect(),n[o].dispose()}}finally{Blockly.Events.enable()}}},Blockly.Block.prototype.unplug=function(e){if(this.outputConnection)this.outputConnection.isConnected()&&this.outputConnection.disconnect();else if(this.previousConnection){var o=null;this.previousConnection.isConnected()&&(o=this.previousConnection.targetConnection,this.previousConnection.disconnect());var t=this.getNextBlock();e&&t&&(e=this.nextConnection.targetConnection,e.disconnect(),o&&o.checkType_(e)&&o.connect(e))}},Blockly.Block.prototype.getConnections_=function(){var e=[];this.outputConnection&&e.push(this.outputConnection),this.previousConnection&&e.push(this.previousConnection),this.nextConnection&&e.push(this.nextConnection);for(var o,t=0;o=this.inputList[t];t++)o.connection&&e.push(o.connection);return e},Blockly.Block.prototype.lastConnectionInStack_=function(){for(var e=this.nextConnection;e;){var o=e.targetBlock();if(!o)return e;e=o.nextConnection}return null},Blockly.Block.prototype.bumpNeighbours_=function(){if(this.workspace&&Blockly.dragMode_==Blockly.DRAG_NONE){var e=this.getRootBlock();if(!e.isInFlyout)for(var o,t=this.getConnections_(!1),n=0;o=t[n];n++){o.isConnected()&&o.isSuperior()&&o.targetBlock().bumpNeighbours_();for(var r,i=o.neighbours_(Blockly.SNAP_RADIUS),s=0;r=i[s];s++)o.isConnected()&&r.isConnected()||r.getSourceBlock().getRootBlock()!=e&&(o.isSuperior()?r.bumpAwayFrom_(o):o.bumpAwayFrom_(r))}}},Blockly.Block.prototype.getParent=function(){return this.parentBlock_},Blockly.Block.prototype.getInputWithBlock=function(e){for(var o,t=0;o=this.inputList[t];t++)if(o.connection&&o.connection.targetBlock()==e)return o;return null},Blockly.Block.prototype.getSurroundParent=function(){var e=this;do{var o=e,e=e.getParent();if(!e)return null}while(e.getNextBlock()==o);return e},Blockly.Block.prototype.getNextBlock=function(){return this.nextConnection&&this.nextConnection.targetBlock()},Blockly.Block.prototype.getRootBlock=function(){var e,o=this;do e=o,o=e.parentBlock_;while(o);return e},Blockly.Block.prototype.getChildren=function(){return this.childBlocks_},Blockly.Block.prototype.setParent=function(e){if(e!=this.parentBlock_){if(this.parentBlock_){if(goog.array.remove(this.parentBlock_.childBlocks_,this),this.previousConnection&&this.previousConnection.isConnected())throw"Still connected to previous block.";if(this.outputConnection&&this.outputConnection.isConnected())throw"Still connected to parent block.";this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}},Blockly.Block.prototype.getDescendants=function(){for(var e,o=[this],t=0;e=this.childBlocks_[t];t++)o.push.apply(o,e.getDescendants());return o},Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)},Blockly.Block.prototype.setDeletable=function(e){this.deletable_=e},Blockly.Block.prototype.isMovable=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)},Blockly.Block.prototype.setMovable=function(e){this.movable_=e},Blockly.Block.prototype.isShadow=function(){return this.isShadow_},Blockly.Block.prototype.setShadow=function(e){this.isShadow_=e},Blockly.Block.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)},Blockly.Block.prototype.setEditable=function(e){this.editable_=e,e=0;for(var o;o=this.inputList[e];e++)for(var t,n=0;t=o.fieldRow[n];n++)t.updateEditable()},Blockly.Block.prototype.setConnectionsHidden=function(e){if(!e&&this.isCollapsed()){if(this.outputConnection&&this.outputConnection.setHidden(e),this.previousConnection&&this.previousConnection.setHidden(e),this.nextConnection){this.nextConnection.setHidden(e);var o=this.nextConnection.targetBlock();o&&o.setConnectionsHidden(e)}}else for(var t=this.getConnections_(!0),n=0;o=t[n];n++)o.setHidden(e),o.isSuperior()&&(o=o.targetBlock())&&o.setConnectionsHidden(e)},Blockly.Block.prototype.setHelpUrl=function(e){this.helpUrl=e},Blockly.Block.prototype.setTooltip=function(e){this.tooltip=e},Blockly.Block.prototype.getColour=function(){return this.colour_},Blockly.Block.prototype.setColour=function(e){var o=parseFloat(e);if(isNaN(o)){if(!goog.isString(e)||!e.match(/^#[0-9a-fA-F]{6}$/))throw"Invalid colour: "+e;this.colour_=e}else this.colour_=Blockly.hueToRgb(o)},Blockly.Block.prototype.getField=function(e){for(var o,t=0;o=this.inputList[t];t++)for(var n,r=0;n=o.fieldRow[r];r++)if(n.name===e)return n;return null},Blockly.Block.prototype.getVars=function(){for(var e,o=[],t=0;e=this.inputList[t];t++)for(var n,r=0;n=e.fieldRow[r];r++)n instanceof Blockly.FieldVariable&&o.push(n.getValue());return o},Blockly.Block.prototype.renameVar=function(e,o){for(var t,n=0;t=this.inputList[n];n++)for(var r,i=0;r=t.fieldRow[i];i++)r instanceof Blockly.FieldVariable&&Blockly.Names.equals(e,r.getValue())&&r.setValue(o)},Blockly.Block.prototype.getFieldValue=function(e){return(e=this.getField(e))?e.getValue():null},Blockly.Block.prototype.getTitleValue=function(e){return console.warn("Deprecated call to getTitleValue, use getFieldValue instead."),this.getFieldValue(e)},Blockly.Block.prototype.setFieldValue=function(e,o){var t=this.getField(o);goog.asserts.assertObject(t,'Field "%s" not found.',o),t.setValue(e)},Blockly.Block.prototype.setTitleValue=function(e,o){console.warn("Deprecated call to setTitleValue, use setFieldValue instead."),this.setFieldValue(e,o)},Blockly.Block.prototype.setPreviousStatement=function(e,o){e?(void 0===o&&(o=null),this.previousConnection||(goog.asserts.assert(!this.outputConnection,"Remove output connection prior to adding previous connection."),this.previousConnection=this.makeConnection_(Blockly.PREVIOUS_STATEMENT)),this.previousConnection.setCheck(o)):this.previousConnection&&(goog.asserts.assert(!this.previousConnection.isConnected(),"Must disconnect previous statement before removing connection."),this.previousConnection.dispose(),this.previousConnection=null)},Blockly.Block.prototype.setNextStatement=function(e,o){e?(void 0===o&&(o=null),this.nextConnection||(this.nextConnection=this.makeConnection_(Blockly.NEXT_STATEMENT)),this.nextConnection.setCheck(o)):this.nextConnection&&(goog.asserts.assert(!this.nextConnection.isConnected(),"Must disconnect next statement before removing connection."),this.nextConnection.dispose(),this.nextConnection=null)},Blockly.Block.prototype.setOutput=function(e,o){e?(void 0===o&&(o=null),this.outputConnection||(goog.asserts.assert(!this.previousConnection,"Remove previous connection prior to adding output connection."),this.outputConnection=this.makeConnection_(Blockly.OUTPUT_VALUE)),this.outputConnection.setCheck(o)):this.outputConnection&&(goog.asserts.assert(!this.outputConnection.isConnected(),"Must disconnect output value before removing connection."),this.outputConnection.dispose(),this.outputConnection=null)},Blockly.Block.prototype.setInputsInline=function(e){this.inputsInline!=e&&(Blockly.Events.fire(new Blockly.Events.Change(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)},Blockly.Block.prototype.getInputsInline=function(){if(void 0!=this.inputsInline)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1].type==Blockly.DUMMY_INPUT&&this.inputList[e].type==Blockly.DUMMY_INPUT)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1].type==Blockly.INPUT_VALUE&&this.inputList[e].type==Blockly.DUMMY_INPUT)return!0;return!1},Blockly.Block.prototype.setDisabled=function(e){this.disabled!=e&&(Blockly.Events.fire(new Blockly.Events.Change(this,"disabled",null,this.disabled,e)),this.disabled=e)},Blockly.Block.prototype.getInheritedDisabled=function(){for(var e=this;;){if(e=e.getSurroundParent(),!e)return!1;if(e.disabled)return!0}},Blockly.Block.prototype.isCollapsed=function(){return this.collapsed_},Blockly.Block.prototype.setCollapsed=function(e){this.collapsed_!=e&&(Blockly.Events.fire(new Blockly.Events.Change(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)},Blockly.Block.prototype.toString=function(e,o){var t=[],n=o||"?";if(this.collapsed_)t.push(this.getInput("_TEMP_COLLAPSED_INPUT").fieldRow[0].text_);else for(var r,i=0;r=this.inputList[i];i++){for(var s,l=0;s=r.fieldRow[l];l++)t.push(s.getText());r.connection&&((r=r.connection.targetBlock())?t.push(r.toString(void 0,o)):t.push(n))}return t=goog.string.trim(t.join(" "))||"???",e&&(t=goog.string.truncate(t,e)),t},Blockly.Block.prototype.appendValueInput=function(e){return this.appendInput_(Blockly.INPUT_VALUE,e)},Blockly.Block.prototype.appendStatementInput=function(e){return this.appendInput_(Blockly.NEXT_STATEMENT,e)},Blockly.Block.prototype.appendDummyInput=function(e){return this.appendInput_(Blockly.DUMMY_INPUT,e||"")},Blockly.Block.prototype.jsonInit=function(e){goog.asserts.assert(void 0==e.output||void 0==e.previousStatement,"Must not have both an output and a previousStatement."),void 0!==e.colour&&this.setColour(e.colour);for(var o=0;void 0!==e["message"+o];)this.interpolate_(e["message"+o],e["args"+o]||[],e["lastDummyAlign"+o]),o++;void 0!==e.inputsInline&&this.setInputsInline(e.inputsInline),void 0!==e.output&&this.setOutput(!0,e.output),void 0!==e.previousStatement&&this.setPreviousStatement(!0,e.previousStatement),void 0!==e.nextStatement&&this.setNextStatement(!0,e.nextStatement),void 0!==e.tooltip&&this.setTooltip(e.tooltip),void 0!==e.helpUrl&&this.setHelpUrl(e.helpUrl)},Blockly.Block.prototype.interpolate_=function(e,o,t){var n=Blockly.utils.tokenizeInterpolation(e),r=[],i=0;e=[];for(var s=0;s<n.length;s++){
    1818var l=n[s];"number"==typeof l?(goog.asserts.assert(l>0&&l<=o.length,'Message index "%s" out of range.',l),goog.asserts.assert(!r[l],'Message index "%s" duplicated.',l),r[l]=!0,i++,e.push(o[l-1])):(l=l.trim())&&e.push(l)}for(goog.asserts.assert(i==o.length,"Message does not reference all %s arg(s).",o.length),e.length&&("string"==typeof e[e.length-1]||goog.string.startsWith(e[e.length-1].type,"field_"))&&(s={type:"input_dummy"},t&&(s.align=t),e.push(s)),t={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE},o=[],s=0;s<e.length;s++)if(r=e[s],"string"==typeof r)o.push([r,void 0]);else{n=i=null;do if(l=!1,"string"==typeof r)i=new Blockly.FieldLabel(r);else switch(r.type){case"input_value":n=this.appendValueInput(r.name);break;case"input_statement":n=this.appendStatementInput(r.name);break;case"input_dummy":n=this.appendDummyInput(r.name);break;case"field_label":i=new Blockly.FieldLabel(r.text,r["class"]);break;case"field_input":i=new Blockly.FieldTextInput(r.text),"boolean"==typeof r.spellcheck&&i.setSpellcheck(r.spellcheck);break;case"field_angle":i=new Blockly.FieldAngle(r.angle);break;case"field_checkbox":i=new Blockly.FieldCheckbox(r.checked?"TRUE":"FALSE");break;case"field_colour":i=new Blockly.FieldColour(r.colour);break;case"field_variable":i=new Blockly.FieldVariable(r.variable);break;case"field_dropdown":i=new Blockly.FieldDropdown(r.options);break;case"field_image":i=new Blockly.FieldImage(r.src,r.width,r.height,r.alt);break;case"field_number":i=new Blockly.FieldNumber(r.value,r.min,r.max,r.precision);break;case"field_date":if(Blockly.FieldDate){i=new Blockly.FieldDate(r.date);break}default:r.alt&&(r=r.alt,l=!0)}while(l);if(i)o.push([i,r.name]);else if(n){for(r.check&&n.setCheck(r.check),r.align&&n.setAlign(t[r.align]),r=0;r<o.length;r++)n.appendField(o[r][0],o[r][1]);o.length=0}}},Blockly.Block.prototype.appendInput_=function(e,o){var t=null;return(e==Blockly.INPUT_VALUE||e==Blockly.NEXT_STATEMENT)&&(t=this.makeConnection_(e)),t=new Blockly.Input(e,o,this,t),this.inputList.push(t),t},Blockly.Block.prototype.moveInputBefore=function(e,o){if(e!=o){for(var t,n=-1,r=o?-1:this.inputList.length,i=0;t=this.inputList[i];i++)if(t.name==e){if(n=i,-1!=r)break}else if(o&&t.name==o&&(r=i,-1!=n))break;goog.asserts.assert(-1!=n,'Named input "%s" not found.',e),goog.asserts.assert(-1!=r,'Reference input "%s" not found.',o),this.moveNumberedInputBefore(n,r)}},Blockly.Block.prototype.moveNumberedInputBefore=function(e,o){goog.asserts.assert(e!=o,"Can't move input to itself."),goog.asserts.assert(e<this.inputList.length,"Input index "+e+" out of bounds."),goog.asserts.assert(o<=this.inputList.length,"Reference input "+o+" out of bounds.");var t=this.inputList[e];this.inputList.splice(e,1),o>e&&o--,this.inputList.splice(o,0,t)},Blockly.Block.prototype.removeInput=function(e,o){for(var t,n=0;t=this.inputList[n];n++)if(t.name==e){if(t.connection&&t.connection.isConnected()){t.connection.setShadowDom(null);var r=t.connection.targetBlock();r.isShadow()?r.dispose():r.unplug()}return t.dispose(),void this.inputList.splice(n,1)}o||goog.asserts.fail('Input "%s" not found.',e)},Blockly.Block.prototype.getInput=function(e){for(var o,t=0;o=this.inputList[t];t++)if(o.name==e)return o;return null},Blockly.Block.prototype.getInputTargetBlock=function(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()},Blockly.Block.prototype.getCommentText=function(){return this.comment||""},Blockly.Block.prototype.setCommentText=function(e){this.comment!=e&&(Blockly.Events.fire(new Blockly.Events.Change(this,"comment",null,this.comment,e||"")),this.comment=e)},Blockly.Block.prototype.setWarningText=function(e){},Blockly.Block.prototype.setMutator=function(e){},Blockly.Block.prototype.getRelativeToSurfaceXY=function(){return this.xy_},Blockly.Block.prototype.moveBy=function(e,o){goog.asserts.assert(!this.parentBlock_,"Block has parent.");var t=new Blockly.Events.Move(this);this.xy_.translate(e,o),t.recordNew(),Blockly.Events.fire(t)},Blockly.Block.prototype.makeConnection_=function(e){return new Blockly.Connection(this,e)},Blockly.ContextMenu={},Blockly.ContextMenu.currentBlock=null,Blockly.ContextMenu.show=function(e,o,t){if(Blockly.WidgetDiv.show(Blockly.ContextMenu,t,null),o.length){var n=new goog.ui.Menu;n.setRightToLeft(t);for(var r,i=0;r=o[i];i++){var s=new goog.ui.MenuItem(r.text);s.setRightToLeft(t),n.addChild(s,!0),s.setEnabled(r.enabled),r.enabled&&(goog.events.listen(s,goog.ui.Component.EventType.ACTION,r.callback),s.handleContextMenu=function(e){goog.events.dispatchEvent(this,goog.ui.Component.EventType.ACTION)})}goog.events.listen(n,goog.ui.Component.EventType.ACTION,Blockly.ContextMenu.hide),o=goog.dom.getViewportSize(),i=goog.style.getViewportPageOffset(document),n.render(Blockly.WidgetDiv.DIV);var l=n.getElement();Blockly.addClass_(l,"blocklyContextMenu"),Blockly.bindEventWithChecks_(l,"contextmenu",null,Blockly.noEvent),r=goog.style.getSize(l);var s=e.clientX+i.x,g=e.clientY+i.y;e.clientY+r.height>=o.height&&(g-=r.height),t?r.width>=e.clientX&&(s+=r.width):e.clientX+r.width>=o.width&&(s-=r.width),Blockly.WidgetDiv.position(s,g,o,i,t),n.setAllowAutoFocus(!0),setTimeout(function(){l.focus()},1),Blockly.ContextMenu.currentBlock=null}else Blockly.ContextMenu.hide()},Blockly.ContextMenu.hide=function(){Blockly.WidgetDiv.hideIfOwner(Blockly.ContextMenu),Blockly.ContextMenu.currentBlock=null},Blockly.ContextMenu.callbackFactory=function(e,o){return function(){Blockly.Events.disable();try{var t=Blockly.Xml.domToBlock(o,e.workspace),n=e.getRelativeToSurfaceXY();n.x=e.RTL?n.x-Blockly.SNAP_RADIUS:n.x+Blockly.SNAP_RADIUS,n.y+=2*Blockly.SNAP_RADIUS,t.moveBy(n.x,n.y)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&!t.isShadow()&&Blockly.Events.fire(new Blockly.Events.Create(t)),t.select()}},Blockly.RenderedConnection=function(e,o){Blockly.RenderedConnection.superClass_.constructor.call(this,e,o),this.offsetInBlock_=new goog.math.Coordinate(0,0)},goog.inherits(Blockly.RenderedConnection,Blockly.Connection),Blockly.RenderedConnection.prototype.distanceFrom=function(e){var o=this.x_-e.x_;return e=this.y_-e.y_,Math.sqrt(o*o+e*e)},Blockly.RenderedConnection.prototype.bumpAwayFrom_=function(e){if(Blockly.dragMode_==Blockly.DRAG_NONE){var o=this.sourceBlock_.getRootBlock();if(!o.isInFlyout){var t=!1;if(!o.isMovable()){if(o=e.getSourceBlock().getRootBlock(),!o.isMovable())return;e=this,t=!0}var n=Blockly.selected==o;n||o.addSelect();var r=e.x_+Blockly.SNAP_RADIUS-this.x_;e=e.y_+Blockly.SNAP_RADIUS-this.y_,t&&(e=-e),o.RTL&&(r=-r),o.moveBy(r,e),n||o.removeSelect()}}},Blockly.RenderedConnection.prototype.moveTo=function(e,o){this.inDB_&&this.db_.removeConnection_(this),this.x_=e,this.y_=o,this.hidden_||this.db_.addConnection(this)},Blockly.RenderedConnection.prototype.moveBy=function(e,o){this.moveTo(this.x_+e,this.y_+o)},Blockly.RenderedConnection.prototype.moveToOffset=function(e){this.moveTo(e.x+this.offsetInBlock_.x,e.y+this.offsetInBlock_.y)},Blockly.RenderedConnection.prototype.setOffsetInBlock=function(e,o){this.offsetInBlock_.x=e,this.offsetInBlock_.y=o},Blockly.RenderedConnection.prototype.tighten_=function(){var e=this.targetConnection.x_-this.x_,o=this.targetConnection.y_-this.y_;if(0!=e||0!=o){var t=this.targetBlock(),n=t.getSvgRoot();if(!n)throw"block is not rendered.";n=Blockly.getRelativeXY_(n),t.getSvgRoot().setAttribute("transform","translate("+(n.x-e)+","+(n.y-o)+")"),t.moveConnections_(-e,-o)}},Blockly.RenderedConnection.prototype.closest=function(e,o,t){return this.dbOpposite_.searchForClosest(this,e,o,t)},Blockly.RenderedConnection.prototype.highlight=function(){var e;e=this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE?"m 0,0 "+Blockly.BlockSvg.TAB_PATH_DOWN+" v 5":"m -20,0 h 5 "+Blockly.BlockSvg.NOTCH_PATH_LEFT+" h 5";var o=this.sourceBlock_.getRelativeToSurfaceXY();Blockly.Connection.highlightedPath_=Blockly.createSvgElement("path",{"class":"blocklyHighlightedConnectionPath",d:e,transform:"translate("+(this.x_-o.x)+","+(this.y_-o.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())},Blockly.RenderedConnection.prototype.unhideAll=function(){this.setHidden(!1);var e=[];if(this.type!=Blockly.INPUT_VALUE&&this.type!=Blockly.NEXT_STATEMENT)return e;var o=this.targetBlock();if(o){var t;o.isCollapsed()?(t=[],o.outputConnection&&t.push(o.outputConnection),o.nextConnection&&t.push(o.nextConnection),o.previousConnection&&t.push(o.previousConnection)):t=o.getConnections_(!0);for(var n=0;n<t.length;n++)e.push.apply(e,t[n].unhideAll());e.length||(e[0]=o)}return e},Blockly.RenderedConnection.prototype.unhighlight=function(){goog.dom.removeNode(Blockly.Connection.highlightedPath_),delete Blockly.Connection.highlightedPath_},Blockly.RenderedConnection.prototype.setHidden=function(e){(this.hidden_=e)&&this.inDB_?this.db_.removeConnection_(this):e||this.inDB_||this.db_.addConnection(this)},Blockly.RenderedConnection.prototype.hideAll=function(){if(this.setHidden(!0),this.targetConnection)for(var e=this.targetBlock().getDescendants(),o=0;o<e.length;o++){for(var t=e[o],n=t.getConnections_(!0),r=0;r<n.length;r++)n[r].setHidden(!0);for(t=t.getIcons(),r=0;r<t.length;r++)t[r].setVisible(!1)}},Blockly.RenderedConnection.prototype.isConnectionAllowed=function(e,o){return this.distanceFrom(e)>o?!1:Blockly.RenderedConnection.superClass_.isConnectionAllowed.call(this,e)},Blockly.RenderedConnection.prototype.disconnectInternal_=function(e,o){Blockly.RenderedConnection.superClass_.disconnectInternal_.call(this,e,o),e.rendered&&e.render(),o.rendered&&(o.updateDisabled(),o.render())},Blockly.RenderedConnection.prototype.respawnShadow_=function(){var e=this.getSourceBlock(),o=this.getShadowDom();if(e.workspace&&o&&Blockly.Events.recordUndo){if(Blockly.RenderedConnection.superClass_.respawnShadow_.call(this),o=this.targetBlock(),!o)throw"Couldn't respawn the shadow block that should exist here.";o.initSvg(),o.render(!1),e.rendered&&e.render()}},Blockly.RenderedConnection.prototype.neighbours_=function(e){return this.dbOpposite_.getNeighbours(this,e)},Blockly.RenderedConnection.prototype.connect_=function(e){Blockly.RenderedConnection.superClass_.connect_.call(this,e);var o=this.getSourceBlock();e=e.getSourceBlock(),o.rendered&&o.updateDisabled(),e.rendered&&e.updateDisabled(),o.rendered&&e.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?e.render():o.render())},Blockly.BlockSvg=function(e,o,t){this.svgGroup_=Blockly.createSvgElement("g",{},null),this.svgPathDark_=Blockly.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgGroup_),this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_),this.svgPathLight_=Blockly.createSvgElement("path",{"class":"blocklyPathLight"},this.svgGroup_),this.svgPath_.tooltip=this,this.rendered=!1,Blockly.Tooltip.bindMouseEvents(this.svgPath_),Blockly.BlockSvg.superClass_.constructor.call(this,e,o,t)},goog.inherits(Blockly.BlockSvg,Blockly.Block),Blockly.BlockSvg.prototype.height=0,Blockly.BlockSvg.prototype.width=0,Blockly.BlockSvg.prototype.dragStartXY_=null,Blockly.BlockSvg.INLINE=-1,Blockly.BlockSvg.prototype.initSvg=function(){goog.asserts.assert(this.workspace.rendered,"Workspace is headless.");for(var e,o=0;e=this.inputList[o];o++)e.init();for(e=this.getIcons(),o=0;o<e.length;o++)e[o].createIcon();if(this.updateColour(),this.updateMovable(),!this.workspace.options.readOnly&&!this.eventsInit_){Blockly.bindEventWithChecks_(this.getSvgRoot(),"mousedown",this,this.onMouseDown_);var t=this;Blockly.bindEvent_(this.getSvgRoot(),"touchstart",null,function(e){Blockly.longStart_(e,t)})}this.eventsInit_=!0,this.getSvgRoot().parentNode||this.workspace.getCanvas().appendChild(this.getSvgRoot())},Blockly.BlockSvg.prototype.select=function(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(Blockly.selected!=this){var e=null;if(Blockly.selected){e=Blockly.selected.id,Blockly.Events.disable();try{Blockly.selected.unselect()}finally{Blockly.Events.enable()}}e=new Blockly.Events.Ui(null,"selected",e,this.id),e.workspaceId=this.workspace.id,Blockly.Events.fire(e),Blockly.selected=this,this.addSelect()}},Blockly.BlockSvg.prototype.unselect=function(){if(Blockly.selected==this){var e=new Blockly.Events.Ui(null,"selected",this.id,null);e.workspaceId=this.workspace.id,Blockly.Events.fire(e),Blockly.selected=null,this.removeSelect()}},Blockly.BlockSvg.prototype.mutator=null,Blockly.BlockSvg.prototype.comment=null,Blockly.BlockSvg.prototype.warning=null,Blockly.BlockSvg.prototype.getIcons=function(){var e=[];return this.mutator&&e.push(this.mutator),this.comment&&e.push(this.comment),this.warning&&e.push(this.warning),e},Blockly.BlockSvg.onMouseUpWrapper_=null,Blockly.BlockSvg.onMouseMoveWrapper_=null,Blockly.BlockSvg.terminateDrag=function(){Blockly.BlockSvg.disconnectUiStop_(),Blockly.BlockSvg.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseUpWrapper_),Blockly.BlockSvg.onMouseUpWrapper_=null),Blockly.BlockSvg.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.BlockSvg.onMouseMoveWrapper_),Blockly.BlockSvg.onMouseMoveWrapper_=null);var e=Blockly.selected;if(Blockly.dragMode_==Blockly.DRAG_FREE&&e){var o=e.getRelativeToSurfaceXY(),o=goog.math.Coordinate.difference(o,e.dragStartXY_),t=new Blockly.Events.Move(e);t.oldCoordinate=e.dragStartXY_,t.recordNew(),Blockly.Events.fire(t),e.moveConnections_(o.x,o.y),delete e.draggedBubbles_,e.setDragging_(!1),e.render(),e.workspace.setResizesEnabled(!0);var n=Blockly.Events.getGroup();setTimeout(function(){Blockly.Events.setGroup(n),e.snapToGrid(),Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY/2),setTimeout(function(){Blockly.Events.setGroup(n),e.bumpNeighbours_(),Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY)}Blockly.dragMode_=Blockly.DRAG_NONE,Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)},Blockly.BlockSvg.prototype.setParent=function(e){if(e!=this.parentBlock_){var o=this.getSvgRoot();if(this.parentBlock_&&o){var t=this.getRelativeToSurfaceXY();this.workspace.getCanvas().appendChild(o),o.setAttribute("transform","translate("+t.x+","+t.y+")")}Blockly.Field.startCache(),Blockly.BlockSvg.superClass_.setParent.call(this,e),Blockly.Field.stopCache(),e&&(t=this.getRelativeToSurfaceXY(),e.getSvgRoot().appendChild(o),e=this.getRelativeToSurfaceXY(),this.moveConnections_(e.x-t.x,e.y-t.y))}},Blockly.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var e=0,o=0,t=this.getSvgRoot();if(t)do var n=Blockly.getRelativeXY_(t),e=e+n.x,o=o+n.y,t=t.parentNode;while(t&&t!=this.workspace.getCanvas());return new goog.math.Coordinate(e,o)},Blockly.BlockSvg.prototype.moveBy=function(e,o){goog.asserts.assert(!this.parentBlock_,"Block has parent.");var t=new Blockly.Events.Move(this),n=this.getRelativeToSurfaceXY();this.getSvgRoot().setAttribute("transform","translate("+(n.x+e)+","+(n.y+o)+")"),this.moveConnections_(e,o),t.recordNew(),this.workspace.resizeContents(),Blockly.Events.fire(t)},Blockly.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&Blockly.dragMode_==Blockly.DRAG_NONE&&!this.getParent()&&!this.isInFlyout&&this.workspace.options.gridOptions&&this.workspace.options.gridOptions.snap){var e=this.workspace.options.gridOptions.spacing,o=e/2,t=this.getRelativeToSurfaceXY(),n=Math.round((t.x-o)/e)*e+o-t.x,e=Math.round((t.y-o)/e)*e+o-t.y,n=Math.round(n),e=Math.round(e);0==n&&0==e||this.moveBy(n,e)}},Blockly.BlockSvg.prototype.getHeightWidth=function(){var e=this.height,o=this.width,t=this.getNextBlock();return t?(t=t.getHeightWidth(),e+=t.height-4,o=Math.max(o,t.width)):this.nextConnection||this.outputConnection||(e+=2),{height:e,width:o}},Blockly.BlockSvg.prototype.getBoundingRectangle=function(){var e,o=this.getRelativeToSurfaceXY(this),t=this.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,n=this.getHeightWidth();return this.RTL?(e=new goog.math.Coordinate(o.x-(n.width-t),o.y),o=new goog.math.Coordinate(o.x+t,o.y+n.height)):(e=new goog.math.Coordinate(o.x-t,o.y),o=new goog.math.Coordinate(o.x+n.width-t,o.y+n.height)),{topLeft:e,bottomRight:o}},Blockly.BlockSvg.prototype.setCollapsed=function(e){if(this.collapsed_!=e){for(var o,t=[],n=0;o=this.inputList[n];n++)t.push.apply(t,o.setVisible(!e));if(e){for(o=this.getIcons(),n=0;n<o.length;n++)o[n].setVisible(!1);n=this.toString(Blockly.COLLAPSE_CHARS),this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(n).init()}else this.removeInput("_TEMP_COLLAPSED_INPUT"),this.setWarningText(null);if(Blockly.BlockSvg.superClass_.setCollapsed.call(this,e),t.length||(t[0]=this),this.rendered)for(n=0;e=t[n];n++)e.render()}},Blockly.BlockSvg.prototype.tab=function(e,o){for(var t,n=[],r=0;t=this.inputList[r];r++){for(var i,s=0;i=t.fieldRow[s];s++)i instanceof Blockly.FieldTextInput&&n.push(i);t.connection&&(t=t.connection.targetBlock())&&n.push(t)}r=n.indexOf(e),-1==r&&(r=o?-1:n.length),(n=n[o?r+1:r-1])?n instanceof Blockly.Field?n.showEditor_():n.tab(null,o):(n=this.getParent())&&n.tab(this,o)},Blockly.BlockSvg.prototype.onMouseDown_=function(e){if(!this.workspace.options.readOnly)if(this.isInFlyout)"touchstart"==e.type&&Blockly.isRightButton(e)&&(Blockly.Flyout.blockRightClick_(e,this),e.stopPropagation(),e.preventDefault());else{if(this.isInMutator&&this.workspace.resize(),this.workspace.updateScreenCalculationsIfScrolled(),this.workspace.markFocused(),Blockly.terminateDrag_(),this.select(),Blockly.hideChaff(),Blockly.isRightButton(e))this.showContextMenu_(e),Blockly.Touch.clearTouchIdentifier();else{if(!this.isMovable())return;Blockly.Events.getGroup()||Blockly.Events.setGroup(!0),Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),this.dragStartXY_=this.getRelativeToSurfaceXY(),this.workspace.startDrag(e,this.dragStartXY_),Blockly.dragMode_=Blockly.DRAG_STICKY,Blockly.BlockSvg.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,this.onMouseUp_),Blockly.BlockSvg.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.onMouseMove_),this.draggedBubbles_=[];for(var o,t=this.getDescendants(),n=0;o=t[n];n++){o=o.getIcons();for(var r=0;r<o.length;r++){var i=o[r].getIconLocation();i.bubble=o[r],this.draggedBubbles_.push(i)}}}e.stopPropagation(),e.preventDefault()}},Blockly.BlockSvg.prototype.onMouseUp_=function(e){Blockly.Touch.clearTouchIdentifier(),Blockly.dragMode_==Blockly.DRAG_FREE||Blockly.WidgetDiv.isVisible()||Blockly.Events.fire(new Blockly.Events.Ui(this,"click",void 0,void 0)),Blockly.terminateDrag_(),Blockly.selected&&Blockly.highlightedConnection_?(Blockly.localConnection_.connect(Blockly.highlightedConnection_),this.rendered&&(Blockly.localConnection_.isSuperior()?Blockly.highlightedConnection_:Blockly.localConnection_).getSourceBlock().connectionUiEffect(),this.workspace.trashcan&&this.workspace.trashcan.close()):!this.getParent()&&Blockly.selected.isDeletable()&&this.workspace.isDeleteArea(e)&&((e=this.workspace.trashcan)&&goog.Timer.callOnce(e.close,100,e),Blockly.selected.dispose(!1,!0)),Blockly.highlightedConnection_&&(Blockly.highlightedConnection_.unhighlight(),Blockly.highlightedConnection_=null),Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN),Blockly.WidgetDiv.isVisible()||Blockly.Events.setGroup(!1)},Blockly.BlockSvg.prototype.showHelp_=function(){var e=goog.isFunction(this.helpUrl)?this.helpUrl():this.helpUrl;e&&window.open(e)},Blockly.BlockSvg.prototype.showContextMenu_=function(e){if(!this.workspace.options.readOnly&&this.contextMenu){var o=this,t=[];if(this.isDeletable()&&this.isMovable()&&!o.isInFlyout){var n={text:Blockly.Msg.DUPLICATE_BLOCK,enabled:!0,callback:function(){Blockly.duplicate_(o)}};if(this.getDescendants().length>this.workspace.remainingCapacity()&&(n.enabled=!1),t.push(n),this.isEditable()&&!this.collapsed_&&this.workspace.options.comments&&(n={enabled:!goog.userAgent.IE},this.comment?(n.text=Blockly.Msg.REMOVE_COMMENT,n.callback=function(){o.setCommentText(null)}):(n.text=Blockly.Msg.ADD_COMMENT,n.callback=function(){o.setCommentText("")}),t.push(n)),!this.collapsed_)for(n=1;n<this.inputList.length;n++)if(this.inputList[n-1].type!=Blockly.NEXT_STATEMENT&&this.inputList[n].type!=Blockly.NEXT_STATEMENT){var n={enabled:!0},r=this.getInputsInline();n.text=r?Blockly.Msg.EXTERNAL_INPUTS:Blockly.Msg.INLINE_INPUTS,n.callback=function(){o.setInputsInline(!r)},t.push(n);break}this.workspace.options.collapse&&(this.collapsed_?(n={enabled:!0},n.text=Blockly.Msg.EXPAND_BLOCK,n.callback=function(){o.setCollapsed(!1)}):(n={enabled:!0},n.text=Blockly.Msg.COLLAPSE_BLOCK,n.callback=function(){o.setCollapsed(!0)}),t.push(n)),this.workspace.options.disable&&(n={text:this.disabled?Blockly.Msg.ENABLE_BLOCK:Blockly.Msg.DISABLE_BLOCK,enabled:!this.getInheritedDisabled(),callback:function(){o.setDisabled(!o.disabled)}},t.push(n));var n=this.getDescendants().length,i=this.getNextBlock();i&&(n-=i.getDescendants().length),n={text:1==n?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",String(n)),enabled:!0,callback:function(){Blockly.Events.setGroup(!0),o.dispose(!0,!0),Blockly.Events.setGroup(!1)}},t.push(n)}n={enabled:!(goog.isFunction(this.helpUrl)?!this.helpUrl():!this.helpUrl)},n.text=Blockly.Msg.HELP,n.callback=function(){o.showHelp_()},t.push(n),this.customContextMenu&&!o.isInFlyout&&this.customContextMenu(t),Blockly.ContextMenu.show(e,t,this.RTL),Blockly.ContextMenu.currentBlock=this}},Blockly.BlockSvg.prototype.moveConnections_=function(e,o){if(this.rendered){for(var t=this.getConnections_(!1),n=0;n<t.length;n++)t[n].moveBy(e,o);for(t=this.getIcons(),n=0;n<t.length;n++)t[n].computeIconLocation();for(n=0;n<this.childBlocks_.length;n++)this.childBlocks_[n].moveConnections_(e,o)}},Blockly.BlockSvg.prototype.setDragging_=function(e){if(e){var o=this.getSvgRoot();o.translate_="",o.skew_="",Blockly.draggingConnections_=Blockly.draggingConnections_.concat(this.getConnections_(!0)),Blockly.addClass_(this.svgGroup_,"blocklyDragging")}else Blockly.draggingConnections_=[],Blockly.removeClass_(this.svgGroup_,"blocklyDragging");for(o=0;o<this.childBlocks_.length;o++)this.childBlocks_[o].setDragging_(e)},Blockly.BlockSvg.prototype.onMouseMove_=function(e){if("mousemove"==e.type&&1>=e.clientX&&0==e.clientY&&0==e.button)e.stopPropagation();else{var o=this.getRelativeToSurfaceXY(),t=this.workspace.moveDrag(e);if(Blockly.dragMode_==Blockly.DRAG_STICKY&&goog.math.Coordinate.distance(o,t)*this.workspace.scale>Blockly.DRAG_RADIUS){if(Blockly.dragMode_=Blockly.DRAG_FREE,Blockly.longStop_(),this.workspace.setResizesEnabled(!1),this.parentBlock_){this.unplug();var n=this.getSvgRoot();n.translate_="translate("+t.x+","+t.y+")",this.disconnectUiEffect()}this.setDragging_(!0)}if(Blockly.dragMode_==Blockly.DRAG_FREE){for(o=goog.math.Coordinate.difference(o,this.dragStartXY_),n=this.getSvgRoot(),n.translate_="translate("+t.x+","+t.y+")",n.setAttribute("transform",n.translate_+n.skew_),t=0;t<this.draggedBubbles_.length;t++)n=this.draggedBubbles_[t],n.bubble.setIconLocation(goog.math.Coordinate.sum(n,o));n=this.getConnections_(!1),(t=this.lastConnectionInStack_())&&t!=this.nextConnection&&n.push(t);for(var r=null,i=null,s=Blockly.SNAP_RADIUS,t=0;t<n.length;t++){var l=n[t],g=l.closest(s,o);g.connection&&(r=g.connection,i=l,s=g.radius)}Blockly.highlightedConnection_&&Blockly.highlightedConnection_!=r&&(Blockly.highlightedConnection_.unhighlight(),Blockly.highlightedConnection_=null,Blockly.localConnection_=null),r&&r!=Blockly.highlightedConnection_&&(r.highlight(),Blockly.highlightedConnection_=r,Blockly.localConnection_=i),this.isDeletable()&&this.workspace.isDeleteArea(e)}e.stopPropagation(),e.preventDefault()}},Blockly.BlockSvg.prototype.updateMovable=function(){this.isMovable()?Blockly.addClass_(this.svgGroup_,"blocklyDraggable"):Blockly.removeClass_(this.svgGroup_,"blocklyDraggable")},Blockly.BlockSvg.prototype.setMovable=function(e){Blockly.BlockSvg.superClass_.setMovable.call(this,e),this.updateMovable()},Blockly.BlockSvg.prototype.setEditable=function(e){Blockly.BlockSvg.superClass_.setEditable.call(this,e),e=this.getIcons();for(var o=0;o<e.length;o++)e[o].updateEditable()},Blockly.BlockSvg.prototype.setShadow=function(e){Blockly.BlockSvg.superClass_.setShadow.call(this,e),this.updateColour()},Blockly.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_},Blockly.BlockSvg.prototype.dispose=function(e,o){if(this.workspace){Blockly.Tooltip.hide(),Blockly.Field.startCache();var t=this.workspace;Blockly.selected==this&&(this.unselect(),Blockly.terminateDrag_()),Blockly.ContextMenu.currentBlock==this&&Blockly.ContextMenu.hide(),o&&this.rendered&&(this.unplug(e),this.disposeUiEffect()),this.rendered=!1,Blockly.Events.disable();try{for(var n=this.getIcons(),r=0;r<n.length;r++)n[r].dispose()}finally{Blockly.Events.enable()}Blockly.BlockSvg.superClass_.dispose.call(this,e),goog.dom.removeNode(this.svgGroup_),t.resizeContents(),this.svgPathDark_=this.svgPathLight_=this.svgPath_=this.svgGroup_=null,Blockly.Field.stopCache()}},Blockly.BlockSvg.prototype.disposeUiEffect=function(){this.workspace.playAudio("delete");var e=Blockly.getSvgXY_(this.svgGroup_,this.workspace),o=this.svgGroup_.cloneNode(!0);o.translateX_=e.x,o.translateY_=e.y,o.setAttribute("transform","translate("+o.translateX_+","+o.translateY_+")"),this.workspace.getParentSvg().appendChild(o),o.bBox_=o.getBBox(),Blockly.BlockSvg.disposeUiStep_(o,this.RTL,new Date,this.workspace.scale)},Blockly.BlockSvg.disposeUiStep_=function(e,o,t,n){var r=(new Date-t)/150;r>1?goog.dom.removeNode(e):(e.setAttribute("transform","translate("+(e.translateX_+(o?-1:1)*e.bBox_.width*n/2*r)+","+(e.translateY_+e.bBox_.height*n*r)+") scale("+(1-r)*n+")"),setTimeout(function(){Blockly.BlockSvg.disposeUiStep_(e,o,t,n)},10))},Blockly.BlockSvg.prototype.connectionUiEffect=function(){if(this.workspace.playAudio("click"),!(1>this.workspace.scale)){var e=Blockly.getSvgXY_(this.svgGroup_,this.workspace);this.outputConnection?(e.x+=(this.RTL?3:-3)*this.workspace.scale,e.y+=13*this.workspace.scale):this.previousConnection&&(e.x+=(this.RTL?-23:23)*this.workspace.scale,e.y+=3*this.workspace.scale),e=Blockly.createSvgElement("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},this.workspace.getParentSvg()),Blockly.BlockSvg.connectionUiStep_(e,new Date,this.workspace.scale)}},Blockly.BlockSvg.connectionUiStep_=function(e,o,t){var n=(new Date-o)/150;n>1?goog.dom.removeNode(e):(e.setAttribute("r",25*n*t),e.style.opacity=1-n,Blockly.BlockSvg.disconnectUiStop_.pid_=setTimeout(function(){Blockly.BlockSvg.connectionUiStep_(e,o,t)},10))},Blockly.BlockSvg.prototype.disconnectUiEffect=function(){if(this.workspace.playAudio("disconnect"),!(1>this.workspace.scale)){var e=this.getHeightWidth().height,e=Math.atan(10/e)/Math.PI*180;this.RTL||(e*=-1),Blockly.BlockSvg.disconnectUiStep_(this.svgGroup_,e,new Date)}},Blockly.BlockSvg.disconnectUiStep_=function(e,o,t){var n=(new Date-t)/200;n>1?e.skew_="":(e.skew_="skewX("+Math.round(Math.sin(n*Math.PI*3)*(1-n)*o)+")",Blockly.BlockSvg.disconnectUiStop_.group=e,Blockly.BlockSvg.disconnectUiStop_.pid=setTimeout(function(){Blockly.BlockSvg.disconnectUiStep_(e,o,t)},10)),e.setAttribute("transform",e.translate_+e.skew_)},Blockly.BlockSvg.disconnectUiStop_=function(){if(Blockly.BlockSvg.disconnectUiStop_.group){clearTimeout(Blockly.BlockSvg.disconnectUiStop_.pid);var e=Blockly.BlockSvg.disconnectUiStop_.group;e.skew_="",e.setAttribute("transform",e.translate_),Blockly.BlockSvg.disconnectUiStop_.group=null}},Blockly.BlockSvg.disconnectUiStop_.pid=0,Blockly.BlockSvg.disconnectUiStop_.group=null,Blockly.BlockSvg.prototype.updateColour=function(){if(!this.disabled){var e=this.getColour(),o=goog.color.hexToRgb(e);if(this.isShadow())o=goog.color.lighten(o,.6),e=goog.color.rgbArrayToHex(o),this.svgPathLight_.style.display="none",this.svgPathDark_.setAttribute("fill",e);else{this.svgPathLight_.style.display="";var t=goog.color.rgbArrayToHex(goog.color.lighten(o,.3)),o=goog.color.rgbArrayToHex(goog.color.darken(o,.2));this.svgPathLight_.setAttribute("stroke",t),this.svgPathDark_.setAttribute("fill",o)}for(this.svgPath_.setAttribute("fill",e),e=this.getIcons(),t=0;t<e.length;t++)e[t].updateColour();for(e=0;t=this.inputList[e];e++)for(var n,o=0;n=t.fieldRow[o];o++)n.setText(null)}},Blockly.BlockSvg.prototype.updateDisabled=function(){var e=Blockly.hasClass_(this.svgGroup_,"blocklyDisabled");this.disabled||this.getInheritedDisabled()?e||(Blockly.addClass_(this.svgGroup_,"blocklyDisabled"),this.svgPath_.setAttribute("fill","url(#"+this.workspace.options.disabledPatternId+")")):e&&(Blockly.removeClass_(this.svgGroup_,"blocklyDisabled"),this.updateColour());for(var o,e=this.getChildren(),t=0;o=e[t];t++)o.updateDisabled()},Blockly.BlockSvg.prototype.getCommentText=function(){return this.comment?this.comment.getText().replace(/\s+$/,"").replace(/ +\n/g,"\n"):""},Blockly.BlockSvg.prototype.setCommentText=function(e){var o=!1;goog.isString(e)?(this.comment||(this.comment=new Blockly.Comment(this),o=!0),this.comment.setText(e)):this.comment&&(this.comment.dispose(),o=!0),o&&this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.setWarningText=function(e,o){this.setWarningText.pid_||(this.setWarningText.pid_=Object.create(null));var t=o||"";if(t)this.setWarningText.pid_[t]&&(clearTimeout(this.setWarningText.pid_[t]),delete this.setWarningText.pid_[t]);else for(var n in this.setWarningText.pid_)clearTimeout(this.setWarningText.pid_[n]),delete this.setWarningText.pid_[n];if(Blockly.dragMode_==Blockly.DRAG_FREE){var r=this;this.setWarningText.pid_[t]=setTimeout(function(){r.workspace&&(delete r.setWarningText.pid_[t],r.setWarningText(e,t))},100)}else{this.isInFlyout&&(e=null),n=this.getSurroundParent();for(var i=null;n;)n.isCollapsed()&&(i=n),n=n.getSurroundParent();i&&i.setWarningText(e,"collapsed "+this.id+" "+t),n=!1,goog.isString(e)?(this.warning||(this.warning=new Blockly.Warning(this),n=!0),this.warning.setText(e,t)):this.warning&&!t?(this.warning.dispose(),n=!0):this.warning&&(n=this.warning.getText(),this.warning.setText("",t),(i=this.warning.getText())||this.warning.dispose(),n=n==i),n&&this.rendered&&(this.render(),this.bumpNeighbours_())}},Blockly.BlockSvg.prototype.setMutator=function(e){this.mutator&&this.mutator!==e&&this.mutator.dispose(),e&&(e.block_=this,this.mutator=e,e.createIcon())},Blockly.BlockSvg.prototype.setDisabled=function(e){this.disabled!=e&&(Blockly.BlockSvg.superClass_.setDisabled.call(this,e),this.rendered&&this.updateDisabled())},Blockly.BlockSvg.prototype.setHighlighted=function(e){e?(this.svgPath_.setAttribute("filter","url(#"+this.workspace.options.embossFilterId+")"),this.svgPathLight_.style.display="none"):(this.svgPath_.removeAttribute("filter"),this.svgPathLight_.style.display="block")},Blockly.BlockSvg.prototype.addSelect=function(){Blockly.addClass_(this.svgGroup_,"blocklySelected");var e=this;do{var o=e.getSvgRoot();o.parentNode.appendChild(o),e=e.getParent()}while(e)},Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.removeClass_(this.svgGroup_,"blocklySelected")},Blockly.BlockSvg.prototype.setColour=function(e){Blockly.BlockSvg.superClass_.setColour.call(this,e),this.rendered&&this.updateColour()},Blockly.BlockSvg.prototype.setPreviousStatement=function(e,o){Blockly.BlockSvg.superClass_.setPreviousStatement.call(this,e,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.setNextStatement=function(e,o){Blockly.BlockSvg.superClass_.setNextStatement.call(this,e,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.setOutput=function(e,o){Blockly.BlockSvg.superClass_.setOutput.call(this,e,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.setInputsInline=function(e){Blockly.BlockSvg.superClass_.setInputsInline.call(this,e),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.removeInput=function(e,o){Blockly.BlockSvg.superClass_.removeInput.call(this,e,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.moveNumberedInputBefore=function(e,o){
    19 Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,e,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.appendInput_=function(e,o){var t=Blockly.BlockSvg.superClass_.appendInput_.call(this,e,o);return this.rendered&&(this.render(),this.bumpNeighbours_()),t},Blockly.BlockSvg.prototype.getConnections_=function(e){var o=[];if((e||this.rendered)&&(this.outputConnection&&o.push(this.outputConnection),this.previousConnection&&o.push(this.previousConnection),this.nextConnection&&o.push(this.nextConnection),e||!this.collapsed_)){e=0;for(var t;t=this.inputList[e];e++)t.connection&&o.push(t.connection)}return o},Blockly.BlockSvg.prototype.makeConnection_=function(e){return new Blockly.RenderedConnection(this,e)},Blockly.BlockSvg.render={},Blockly.BlockSvg.SEP_SPACE_X=10,Blockly.BlockSvg.SEP_SPACE_Y=10,Blockly.BlockSvg.INLINE_PADDING_Y=5,Blockly.BlockSvg.MIN_BLOCK_Y=25,Blockly.BlockSvg.TAB_HEIGHT=20,Blockly.BlockSvg.TAB_WIDTH=8,Blockly.BlockSvg.NOTCH_WIDTH=30,Blockly.BlockSvg.CORNER_RADIUS=8,Blockly.BlockSvg.START_HAT=!1,Blockly.BlockSvg.START_HAT_HEIGHT=15,Blockly.BlockSvg.START_HAT_PATH="c 30,-"+Blockly.BlockSvg.START_HAT_HEIGHT+" 70,-"+Blockly.BlockSvg.START_HAT_HEIGHT+" 100,0",Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR="c 17.8,-9.2 45.3,-14.9 75,-8.7 M 100.5,0.5",Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL="m 25,-8.7 c 29.7,-6.2 57.2,-0.5 75,8.7",Blockly.BlockSvg.DISTANCE_45_INSIDE=(1-Math.SQRT1_2)*(Blockly.BlockSvg.CORNER_RADIUS-.5)+.5,Blockly.BlockSvg.DISTANCE_45_OUTSIDE=(1-Math.SQRT1_2)*(Blockly.BlockSvg.CORNER_RADIUS+.5)-.5,Blockly.BlockSvg.NOTCH_PATH_LEFT="l 6,4 3,0 6,-4",Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT="l 6,4 3,0 6,-4",Blockly.BlockSvg.NOTCH_PATH_RIGHT="l -6,4 -3,0 -6,-4",Blockly.BlockSvg.JAGGED_TEETH="l 8,0 0,4 8,4 -16,8 8,4",Blockly.BlockSvg.JAGGED_TEETH_HEIGHT=20,Blockly.BlockSvg.JAGGED_TEETH_WIDTH=15,Blockly.BlockSvg.TAB_PATH_DOWN="v 5 c 0,10 -"+Blockly.BlockSvg.TAB_WIDTH+",-8 -"+Blockly.BlockSvg.TAB_WIDTH+",7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",-2.5 "+Blockly.BlockSvg.TAB_WIDTH+",7.5",Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL="v 6.5 m -"+.97*Blockly.BlockSvg.TAB_WIDTH+",3 q -"+.05*Blockly.BlockSvg.TAB_WIDTH+",10 "+.3*Blockly.BlockSvg.TAB_WIDTH+",9.5 m "+.67*Blockly.BlockSvg.TAB_WIDTH+",-1.9 v 1.4",Blockly.BlockSvg.TOP_LEFT_CORNER_START="m 0,"+Blockly.BlockSvg.CORNER_RADIUS,Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL="m "+Blockly.BlockSvg.DISTANCE_45_INSIDE+","+Blockly.BlockSvg.DISTANCE_45_INSIDE,Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR="m 0.5,"+(Blockly.BlockSvg.CORNER_RADIUS-.5),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_LEFT_CORNER_HIGHLIGHT="A "+(Blockly.BlockSvg.CORNER_RADIUS-.5)+","+(Blockly.BlockSvg.CORNER_RADIUS-.5)+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",0.5",Blockly.BlockSvg.INNER_TOP_LEFT_CORNER=Blockly.BlockSvg.NOTCH_PATH_RIGHT+" h -"+(Blockly.BlockSvg.NOTCH_WIDTH-15-Blockly.BlockSvg.CORNER_RADIUS)+" 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.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+(-Blockly.BlockSvg.DISTANCE_45_OUTSIDE-.5)+","+(Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.DISTANCE_45_OUTSIDE),Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL="a "+(Blockly.BlockSvg.CORNER_RADIUS+.5)+","+(Blockly.BlockSvg.CORNER_RADIUS+.5)+" 0 0,0 "+(Blockly.BlockSvg.CORNER_RADIUS+.5)+","+(Blockly.BlockSvg.CORNER_RADIUS+.5),Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR="a "+(Blockly.BlockSvg.CORNER_RADIUS+.5)+","+(Blockly.BlockSvg.CORNER_RADIUS+.5)+" 0 0,0 "+(Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)+","+(Blockly.BlockSvg.DISTANCE_45_OUTSIDE+.5),Blockly.BlockSvg.prototype.render=function(e){Blockly.Field.startCache(),this.rendered=!0;var o=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(o=-o);for(var t=this.getIcons(),n=0;n<t.length;n++)o=t[n].renderIcon(o);o+=this.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X,t=this.renderCompute_(o),this.renderDraw_(o,t),this.renderMoveConnections_(),!1!==e&&((e=this.getParent())?e.render(!0):this.workspace.resizeContents()),Blockly.Field.stopCache()},Blockly.BlockSvg.prototype.renderFields_=function(e,o,t){t+=Blockly.BlockSvg.INLINE_PADDING_Y,this.RTL&&(o=-o);for(var n,r=0;n=e[r];r++){var i=n.getSvgRoot();i&&(this.RTL?(o-=n.renderSep+n.renderWidth,i.setAttribute("transform","translate("+o+","+t+")"),n.renderWidth&&(o-=Blockly.BlockSvg.SEP_SPACE_X)):(i.setAttribute("transform","translate("+(o+n.renderSep)+","+t+")"),n.renderWidth&&(o+=n.renderSep+n.renderWidth+Blockly.BlockSvg.SEP_SPACE_X)))}return this.RTL?-o:o},Blockly.BlockSvg.prototype.renderCompute_=function(e){var o=this.inputList,t=[];t.rightEdge=e+2*Blockly.BlockSvg.SEP_SPACE_X,(this.previousConnection||this.nextConnection)&&(t.rightEdge=Math.max(t.rightEdge,Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.SEP_SPACE_X));for(var n,r=0,i=0,s=!1,l=!1,g=!1,a=void 0,c=this.getInputsInline()&&!this.isCollapsed(),u=0;n=o[u];u++)if(n.isVisible()){var h;if(c&&a&&a!=Blockly.NEXT_STATEMENT&&n.type!=Blockly.NEXT_STATEMENT?h=t[t.length-1]:(a=n.type,h=[],h.type=c&&n.type!=Blockly.NEXT_STATEMENT?Blockly.BlockSvg.INLINE:n.type,h.height=0,t.push(h)),h.push(n),n.renderHeight=Blockly.BlockSvg.MIN_BLOCK_Y,n.renderWidth=c&&n.type==Blockly.INPUT_VALUE?Blockly.BlockSvg.TAB_WIDTH+1.25*Blockly.BlockSvg.SEP_SPACE_X:0,n.connection&&n.connection.isConnected()){var d=n.connection.targetBlock().getHeightWidth();n.renderHeight=Math.max(n.renderHeight,d.height),n.renderWidth=Math.max(n.renderWidth,d.width)}c||u!=o.length-1?!c&&n.type==Blockly.INPUT_VALUE&&o[u+1]&&o[u+1].type==Blockly.NEXT_STATEMENT&&n.renderHeight--:n.renderHeight--,h.height=Math.max(h.height,n.renderHeight),n.fieldWidth=0,1==t.length&&(n.fieldWidth+=this.RTL?-e:e);for(var p,d=!1,y=0;p=n.fieldRow[y];y++){0!=y&&(n.fieldWidth+=Blockly.BlockSvg.SEP_SPACE_X);var f=p.getSize();p.renderWidth=f.width,p.renderSep=d&&p.EDITABLE?Blockly.BlockSvg.SEP_SPACE_X:0,n.fieldWidth+=p.renderWidth+p.renderSep,h.height=Math.max(h.height,f.height),d=p.EDITABLE}h.type!=Blockly.BlockSvg.INLINE&&(h.type==Blockly.NEXT_STATEMENT?(l=!0,i=Math.max(i,n.fieldWidth)):(h.type==Blockly.INPUT_VALUE?s=!0:h.type==Blockly.DUMMY_INPUT&&(g=!0),r=Math.max(r,n.fieldWidth)))}for(e=0;h=t[e];e++)if(h.thicker=!1,h.type==Blockly.BlockSvg.INLINE)for(o=0;n=h[o];o++)if(n.type==Blockly.INPUT_VALUE){h.height+=2*Blockly.BlockSvg.INLINE_PADDING_Y,h.thicker=!0;break}return t.statementEdge=2*Blockly.BlockSvg.SEP_SPACE_X+i,l&&(t.rightEdge=Math.max(t.rightEdge,t.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH)),s?t.rightEdge=Math.max(t.rightEdge,r+2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.TAB_WIDTH):g&&(t.rightEdge=Math.max(t.rightEdge,r+2*Blockly.BlockSvg.SEP_SPACE_X)),t.hasValue=s,t.hasStatement=l,t.hasDummy=g,t},Blockly.BlockSvg.prototype.renderDraw_=function(e,o){if(this.startHat_=!1,this.height=0,this.outputConnection)this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!0;else{if(this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!1,this.previousConnection){var t=this.previousConnection.targetBlock();t&&t.getNextBlock()==this&&(this.squareTopLeftCorner_=!0)}else Blockly.BlockSvg.START_HAT&&(this.startHat_=this.squareTopLeftCorner_=!0,this.height+=Blockly.BlockSvg.START_HAT_HEIGHT,o.rightEdge=Math.max(o.rightEdge,100));this.getNextBlock()&&(this.squareBottomLeftCorner_=!0)}var n=[],r=[],t=[],i=[];this.renderDrawTop_(n,t,o.rightEdge);var s=this.renderDrawRight_(n,t,r,i,o,e);this.renderDrawBottom_(n,t,s),this.renderDrawLeft_(n,t),n=n.join(" ")+"\n"+r.join(" "),this.svgPath_.setAttribute("d",n),this.svgPathDark_.setAttribute("d",n),n=t.join(" ")+"\n"+i.join(" "),this.svgPathLight_.setAttribute("d",n),this.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathLight_.setAttribute("transform","scale(-1 1)"),this.svgPathDark_.setAttribute("transform","translate(1,1) scale(-1 1)"))},Blockly.BlockSvg.prototype.renderMoveConnections_=function(){var e=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(e),this.outputConnection&&this.outputConnection.moveToOffset(e);for(var o=0;o<this.inputList.length;o++){var t=this.inputList[o].connection;t&&(t.moveToOffset(e),t.isConnected()&&t.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(e),this.nextConnection.isConnected()&&this.nextConnection.tighten_())},Blockly.BlockSvg.prototype.renderDrawTop_=function(e,o,t){this.squareTopLeftCorner_?(e.push("m 0,0"),o.push("m 0.5,0.5"),this.startHat_&&(e.push(Blockly.BlockSvg.START_HAT_PATH),o.push(this.RTL?Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL:Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR))):(e.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),o.push(this.RTL?Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL:Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR),e.push(Blockly.BlockSvg.TOP_LEFT_CORNER),o.push(Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT)),this.previousConnection&&(e.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),o.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),e.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),o.push(Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT),this.previousConnection.setOffsetInBlock(this.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:Blockly.BlockSvg.NOTCH_WIDTH,0)),e.push("H",t),o.push("H",t-.5),this.width=t},Blockly.BlockSvg.prototype.renderDrawRight_=function(e,o,t,n,r,i){for(var s,l,g,a,c=0,u=0;a=r[u];u++){if(s=Blockly.BlockSvg.SEP_SPACE_X,0==u&&(s+=this.RTL?-i:i),o.push("M",r.rightEdge-.5+","+(c+.5)),this.isCollapsed()){var h=a[0];l=c,this.renderFields_(h.fieldRow,s,l),e.push(Blockly.BlockSvg.JAGGED_TEETH),o.push("h 8"),h=a.height-Blockly.BlockSvg.JAGGED_TEETH_HEIGHT,e.push("v",h),this.RTL&&(o.push("v 3.9 l 7.2,3.4 m -14.5,8.9 l 7.3,3.5"),o.push("v",h-.7)),this.width+=Blockly.BlockSvg.JAGGED_TEETH_WIDTH}else if(a.type==Blockly.BlockSvg.INLINE){for(var d=0;h=a[d];d++)l=c,a.thicker&&(l+=Blockly.BlockSvg.INLINE_PADDING_Y),s=this.renderFields_(h.fieldRow,s,l),h.type!=Blockly.DUMMY_INPUT&&(s+=h.renderWidth+Blockly.BlockSvg.SEP_SPACE_X),h.type==Blockly.INPUT_VALUE&&(t.push("M",s-Blockly.BlockSvg.SEP_SPACE_X+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y)),t.push("h",Blockly.BlockSvg.TAB_WIDTH-2-h.renderWidth),t.push(Blockly.BlockSvg.TAB_PATH_DOWN),t.push("v",h.renderHeight+1-Blockly.BlockSvg.TAB_HEIGHT),t.push("h",h.renderWidth+2-Blockly.BlockSvg.TAB_WIDTH),t.push("z"),this.RTL?(n.push("M",s-Blockly.BlockSvg.SEP_SPACE_X-2.5+Blockly.BlockSvg.TAB_WIDTH-h.renderWidth+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y+.5)),n.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),n.push("v",h.renderHeight-Blockly.BlockSvg.TAB_HEIGHT+2.5),n.push("h",h.renderWidth-Blockly.BlockSvg.TAB_WIDTH+2)):(n.push("M",s-Blockly.BlockSvg.SEP_SPACE_X+.5+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y+.5)),n.push("v",h.renderHeight+1),n.push("h",Blockly.BlockSvg.TAB_WIDTH-2-h.renderWidth),n.push("M",s-h.renderWidth-Blockly.BlockSvg.SEP_SPACE_X+.9+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y+Blockly.BlockSvg.TAB_HEIGHT-.7)),n.push("l",.46*Blockly.BlockSvg.TAB_WIDTH+",-2.1")),l=this.RTL?-s-Blockly.BlockSvg.TAB_WIDTH+Blockly.BlockSvg.SEP_SPACE_X+h.renderWidth+1:s+Blockly.BlockSvg.TAB_WIDTH-Blockly.BlockSvg.SEP_SPACE_X-h.renderWidth-1,g=c+Blockly.BlockSvg.INLINE_PADDING_Y+1,h.connection.setOffsetInBlock(l,g));s=Math.max(s,r.rightEdge),this.width=Math.max(this.width,s),e.push("H",s),o.push("H",s-.5),e.push("v",a.height),this.RTL&&o.push("v",a.height-1)}else a.type==Blockly.INPUT_VALUE?(h=a[0],l=c,h.align!=Blockly.ALIGN_LEFT&&(d=r.rightEdge-h.fieldWidth-Blockly.BlockSvg.TAB_WIDTH-2*Blockly.BlockSvg.SEP_SPACE_X,h.align==Blockly.ALIGN_RIGHT?s+=d:h.align==Blockly.ALIGN_CENTRE&&(s+=d/2)),this.renderFields_(h.fieldRow,s,l),e.push(Blockly.BlockSvg.TAB_PATH_DOWN),d=a.height-Blockly.BlockSvg.TAB_HEIGHT,e.push("v",d),this.RTL?(o.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),o.push("v",d+.5)):(o.push("M",r.rightEdge-5+","+(c+Blockly.BlockSvg.TAB_HEIGHT-.7)),o.push("l",.46*Blockly.BlockSvg.TAB_WIDTH+",-2.1")),l=this.RTL?-r.rightEdge-1:r.rightEdge+1,h.connection.setOffsetInBlock(l,c),h.connection.isConnected()&&(this.width=Math.max(this.width,r.rightEdge+h.connection.targetBlock().getHeightWidth().width-Blockly.BlockSvg.TAB_WIDTH+1))):a.type==Blockly.DUMMY_INPUT?(h=a[0],l=c,h.align!=Blockly.ALIGN_LEFT&&(d=r.rightEdge-h.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,r.hasValue&&(d-=Blockly.BlockSvg.TAB_WIDTH),h.align==Blockly.ALIGN_RIGHT?s+=d:h.align==Blockly.ALIGN_CENTRE&&(s+=d/2)),this.renderFields_(h.fieldRow,s,l),e.push("v",a.height),this.RTL&&o.push("v",a.height-1)):a.type==Blockly.NEXT_STATEMENT&&(h=a[0],0==u&&(e.push("v",Blockly.BlockSvg.SEP_SPACE_Y),this.RTL&&o.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c+=Blockly.BlockSvg.SEP_SPACE_Y),l=c,h.align!=Blockly.ALIGN_LEFT&&(d=r.statementEdge-h.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,h.align==Blockly.ALIGN_RIGHT?s+=d:h.align==Blockly.ALIGN_CENTRE&&(s+=d/2)),this.renderFields_(h.fieldRow,s,l),s=r.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH,e.push("H",s),e.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER),e.push("v",a.height-2*Blockly.BlockSvg.CORNER_RADIUS),e.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER),e.push("H",r.rightEdge),this.RTL?(o.push("M",s-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(c+Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),o.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),o.push("v",a.height-2*Blockly.BlockSvg.CORNER_RADIUS),o.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL)):(o.push("M",s-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(c+a.height-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),o.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR)),o.push("H",r.rightEdge-.5),l=this.RTL?-s:s+1,h.connection.setOffsetInBlock(l,c+1),h.connection.isConnected()&&(this.width=Math.max(this.width,r.statementEdge+h.connection.targetBlock().getHeightWidth().width)),u==r.length-1||r[u+1].type==Blockly.NEXT_STATEMENT)&&(e.push("v",Blockly.BlockSvg.SEP_SPACE_Y),this.RTL&&o.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c+=Blockly.BlockSvg.SEP_SPACE_Y);c+=a.height}return r.length||(c=Blockly.BlockSvg.MIN_BLOCK_Y,e.push("V",c),this.RTL&&o.push("V",c-1)),c},Blockly.BlockSvg.prototype.renderDrawBottom_=function(e,o,t){this.height+=t+1,this.nextConnection&&(e.push("H",Blockly.BlockSvg.NOTCH_WIDTH+(this.RTL?.5:-.5)+" "+Blockly.BlockSvg.NOTCH_PATH_RIGHT),this.nextConnection.setOffsetInBlock(this.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:Blockly.BlockSvg.NOTCH_WIDTH,t+1),this.height+=4),this.squareBottomLeftCorner_?(e.push("H 0"),this.RTL||o.push("M","0.5,"+(t-.5))):(e.push("H",Blockly.BlockSvg.CORNER_RADIUS),e.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS),this.RTL||(o.push("M",Blockly.BlockSvg.DISTANCE_45_INSIDE+","+(t-Blockly.BlockSvg.DISTANCE_45_INSIDE)),o.push("A",Blockly.BlockSvg.CORNER_RADIUS-.5+","+(Blockly.BlockSvg.CORNER_RADIUS-.5)+" 0 0,1 0.5,"+(t-Blockly.BlockSvg.CORNER_RADIUS))))},Blockly.BlockSvg.prototype.renderDrawLeft_=function(e,o){this.outputConnection?(this.outputConnection.setOffsetInBlock(0,0),e.push("V",Blockly.BlockSvg.TAB_HEIGHT),e.push("c 0,-10 -"+Blockly.BlockSvg.TAB_WIDTH+",8 -"+Blockly.BlockSvg.TAB_WIDTH+",-7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",2.5 "+Blockly.BlockSvg.TAB_WIDTH+",-7.5"),this.RTL?(o.push("M",-.25*Blockly.BlockSvg.TAB_WIDTH+",8.4"),o.push("l",-.45*Blockly.BlockSvg.TAB_WIDTH+",-2.1")):(o.push("V",Blockly.BlockSvg.TAB_HEIGHT-1.5),o.push("m",-.92*Blockly.BlockSvg.TAB_WIDTH+",-0.5 q "+-.19*Blockly.BlockSvg.TAB_WIDTH+",-5.5 0,-11"),o.push("m",.92*Blockly.BlockSvg.TAB_WIDTH+",1 V 0.5 H 1")),this.width+=Blockly.BlockSvg.TAB_WIDTH):this.RTL||(this.squareTopLeftCorner_?o.push("V",.5):o.push("V",Blockly.BlockSvg.CORNER_RADIUS)),e.push("z")},Blockly.Events={},Blockly.Events.group_="",Blockly.Events.recordUndo=!0,Blockly.Events.disabled_=0,Blockly.Events.CREATE="create",Blockly.Events.DELETE="delete",Blockly.Events.CHANGE="change",Blockly.Events.MOVE="move",Blockly.Events.UI="ui",Blockly.Events.FIRE_QUEUE_=[],Blockly.Events.fire=function(e){Blockly.Events.isEnabled()&&(Blockly.Events.FIRE_QUEUE_.length||setTimeout(Blockly.Events.fireNow_,0),Blockly.Events.FIRE_QUEUE_.push(e))},Blockly.Events.fireNow_=function(){for(var e,o=Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_,!0),t=Blockly.Events.FIRE_QUEUE_.length=0;e=o[t];t++){var n=Blockly.Workspace.getById(e.workspaceId);n&&n.fireChangeListener(e)}},Blockly.Events.filter=function(e,o){var t=goog.array.clone(e);o||t.reverse();for(var n,r=0;n=t[r];r++)for(var i,s=r+1;i=t[s];s++)n.type==i.type&&n.blockId==i.blockId&&n.workspaceId==i.workspaceId&&(n.type==Blockly.Events.MOVE?(n.newParentId=i.newParentId,n.newInputName=i.newInputName,n.newCoordinate=i.newCoordinate,t.splice(s,1),s--):n.type==Blockly.Events.CHANGE&&n.element==i.element&&n.name==i.name?(n.newValue=i.newValue,t.splice(s,1),s--):n.type!=Blockly.Events.UI||"click"!=i.element||"commentOpen"!=n.element&&"mutatorOpen"!=n.element&&"warningOpen"!=n.element||(n.newValue=i.newValue,t.splice(s,1),s--));for(r=t.length-1;r>=0;r--)t[r].isNull()&&t.splice(r,1);for(o||t.reverse(),r=1;n=t[r];r++)n.type==Blockly.Events.CHANGE&&"mutation"==n.element&&t.unshift(t.splice(r,1)[0]);return t},Blockly.Events.clearPendingUndo=function(){for(var e,o=0;e=Blockly.Events.FIRE_QUEUE_[o];o++)e.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(e){Blockly.Events.group_="boolean"==typeof e?e?Blockly.genUid():"":e},Blockly.Events.getDescendantIds_=function(e){var o=[];e=e.getDescendants();for(var t,n=0;t=e[n];n++)o[n]=t.id;return o},Blockly.Events.fromJson=function(e,o){var t;switch(e.type){case Blockly.Events.CREATE:t=new Blockly.Events.Create(null);break;case Blockly.Events.DELETE:t=new Blockly.Events.Delete(null);break;case Blockly.Events.CHANGE:t=new Blockly.Events.Change(null);break;case Blockly.Events.MOVE:t=new Blockly.Events.Move(null);break;case Blockly.Events.UI:t=new Blockly.Events.Ui(null);break;default:throw"Unknown event type."}return t.fromJson(e),t.workspaceId=o.id,t},Blockly.Events.Abstract=function(e){e&&(this.blockId=e.id,this.workspaceId=e.workspace.id),this.group=Blockly.Events.group_,this.recordUndo=Blockly.Events.recordUndo},Blockly.Events.Abstract.prototype.toJson=function(){var e={type:this.type};return this.blockId&&(e.blockId=this.blockId),this.group&&(e.group=this.group),e},Blockly.Events.Abstract.prototype.fromJson=function(e){this.blockId=e.blockId,this.group=e.group},Blockly.Events.Abstract.prototype.isNull=function(){return!1},Blockly.Events.Abstract.prototype.run=function(e){},Blockly.Events.Create=function(e){e&&(Blockly.Events.Create.superClass_.constructor.call(this,e),this.xml=Blockly.Xml.blockToDomWithXY(e),this.ids=Blockly.Events.getDescendantIds_(e))},goog.inherits(Blockly.Events.Create,Blockly.Events.Abstract),Blockly.Events.Create.prototype.type=Blockly.Events.CREATE,Blockly.Events.Create.prototype.toJson=function(){var e=Blockly.Events.Create.superClass_.toJson.call(this);return e.xml=Blockly.Xml.domToText(this.xml),e.ids=this.ids,e},Blockly.Events.Create.prototype.fromJson=function(e){Blockly.Events.Create.superClass_.fromJson.call(this,e),this.xml=Blockly.Xml.textToDom("<xml>"+e.xml+"</xml>").firstChild,this.ids=e.ids},Blockly.Events.Create.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId);if(e)e=goog.dom.createDom("xml"),e.appendChild(this.xml),Blockly.Xml.domToWorkspace(e,o);else{e=0;for(var t;t=this.ids[e];e++){var n=o.getBlockById(t);n?n.dispose(!1,!1):t==this.blockId&&console.warn("Can't uncreate non-existant block: "+t)}}},Blockly.Events.Delete=function(e){if(e){if(e.getParent())throw"Connected blocks cannot be deleted.";Blockly.Events.Delete.superClass_.constructor.call(this,e),this.oldXml=Blockly.Xml.blockToDomWithXY(e),this.ids=Blockly.Events.getDescendantIds_(e)}},goog.inherits(Blockly.Events.Delete,Blockly.Events.Abstract),Blockly.Events.Delete.prototype.type=Blockly.Events.DELETE,Blockly.Events.Delete.prototype.toJson=function(){var e=Blockly.Events.Delete.superClass_.toJson.call(this);return e.ids=this.ids,e},Blockly.Events.Delete.prototype.fromJson=function(e){Blockly.Events.Delete.superClass_.fromJson.call(this,e),this.ids=e.ids},Blockly.Events.Delete.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId);if(e){e=0;for(var t;t=this.ids[e];e++){var n=o.getBlockById(t);n?n.dispose(!1,!1):t==this.blockId&&console.warn("Can't delete non-existant block: "+t)}}else e=goog.dom.createDom("xml"),e.appendChild(this.oldXml),Blockly.Xml.domToWorkspace(e,o)},Blockly.Events.Change=function(e,o,t,n,r){e&&(Blockly.Events.Change.superClass_.constructor.call(this,e),this.element=o,this.name=t,this.oldValue=n,this.newValue=r)},goog.inherits(Blockly.Events.Change,Blockly.Events.Abstract),Blockly.Events.Change.prototype.type=Blockly.Events.CHANGE,Blockly.Events.Change.prototype.toJson=function(){var e=Blockly.Events.Change.superClass_.toJson.call(this);return e.element=this.element,this.name&&(e.name=this.name),e.newValue=this.newValue,e},Blockly.Events.Change.prototype.fromJson=function(e){Blockly.Events.Change.superClass_.fromJson.call(this,e),this.element=e.element,this.name=e.name,this.newValue=e.newValue},Blockly.Events.Change.prototype.isNull=function(){return this.oldValue==this.newValue},Blockly.Events.Change.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId);if(o)switch(o.mutator&&o.mutator.setVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(o=o.getField(this.name))?(o.callValidator(e),o.setValue(e)):console.warn("Can't set non-existant field: "+this.name);break;case"comment":o.setCommentText(e||null);break;case"collapsed":o.setCollapsed(e);break;case"disabled":o.setDisabled(e);break;case"inline":o.setInputsInline(e);break;case"mutation":var t="";if(o.mutationToDom&&(t=(t=o.mutationToDom())&&Blockly.Xml.domToText(t)),o.domToMutation){e=e||"<mutation></mutation>";var n=Blockly.Xml.textToDom("<xml>"+e+"</xml>");o.domToMutation(n.firstChild)}Blockly.Events.fire(new Blockly.Events.Change(o,"mutation",null,t,e));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existant block: "+this.blockId)},Blockly.Events.Move=function(e){e&&(Blockly.Events.Move.superClass_.constructor.call(this,e),e=this.currentLocation_(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)},goog.inherits(Blockly.Events.Move,Blockly.Events.Abstract),Blockly.Events.Move.prototype.type=Blockly.Events.MOVE,Blockly.Events.Move.prototype.toJson=function(){var e=Blockly.Events.Move.superClass_.toJson.call(this);return this.newParentId&&(e.newParentId=this.newParentId),this.newInputName&&(e.newInputName=this.newInputName),this.newCoordinate&&(e.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y)),e},Blockly.Events.Move.prototype.fromJson=function(e){Blockly.Events.Move.superClass_.fromJson.call(this,e),this.newParentId=e.newParentId,this.newInputName=e.newInputName,e.newCoordinate&&(e=e.newCoordinate.split(","),this.newCoordinate=new goog.math.Coordinate(parseFloat(e[0]),parseFloat(e[1])))},Blockly.Events.Move.prototype.recordNew=function(){var e=this.currentLocation_();this.newParentId=e.parentId,this.newInputName=e.inputName,this.newCoordinate=e.coordinate},Blockly.Events.Move.prototype.currentLocation_=function(){var e=Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId),o={},t=e.getParent();return t?(o.parentId=t.id,(e=t.getInputWithBlock(e))&&(o.inputName=e.name)):o.coordinate=e.getRelativeToSurfaceXY(),o},Blockly.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&goog.math.Coordinate.equals(this.oldCoordinate,this.newCoordinate)},Blockly.Events.Move.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId),t=o.getBlockById(this.blockId);if(t){var n=e?this.newParentId:this.oldParentId,r=e?this.newInputName:this.oldInputName;e=e?this.newCoordinate:this.oldCoordinate;var i=null;if(n&&(i=o.getBlockById(n),!i))return void console.warn("Can't connect to non-existant block: "+n);if(t.getParent()&&t.unplug(),e)r=t.getRelativeToSurfaceXY(),t.moveBy(e.x-r.x,e.y-r.y);else{var s,t=t.outputConnection||t.previousConnection;r?(o=i.getInput(r))&&(s=o.connection):t.type==Blockly.PREVIOUS_STATEMENT&&(s=i.nextConnection),s?t.connect(s):console.warn("Can't connect to non-existant input: "+r)}}else console.warn("Can't move non-existant block: "+this.blockId)},Blockly.Events.Ui=function(e,o,t,n){Blockly.Events.Ui.superClass_.constructor.call(this,e),this.element=o,this.oldValue=t,this.newValue=n,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 e=Blockly.Events.Ui.superClass_.toJson.call(this);return e.element=this.element,void 0!==this.newValue&&(e.newValue=this.newValue),e},Blockly.Events.Ui.prototype.fromJson=function(e){Blockly.Events.Ui.superClass_.fromJson.call(this,e),this.element=e.element,this.newValue=e.newValue},Blockly.Events.disableOrphans=function(e){if(e.type==Blockly.Events.MOVE||e.type==Blockly.Events.CREATE){if(Blockly.Events.disable(),e=Blockly.Workspace.getById(e.workspaceId).getBlockById(e.blockId))if(e.getParent()&&!e.getParent().disabled){e=e.getDescendants();for(var o,t=0;o=e[t];t++)o.setDisabled(!1)}else if((e.outputConnection||e.previousConnection)&&Blockly.dragMode_==Blockly.DRAG_NONE)do e.setDisabled(!0),e=e.getNextBlock();while(e);Blockly.Events.enable()}},Blockly.Msg={},goog.getMsgOrig=goog.getMsg,goog.getMsg=function(e,o){var t=goog.getMsg.blocklyMsgMap[e];return t&&(e=Blockly.Msg[t]),goog.getMsgOrig(e,o)},goog.getMsg.blocklyMsgMap={Today:"TODAY"},Blockly.FieldTextInput=function(e,o){Blockly.FieldTextInput.superClass_.constructor.call(this,e,o)},goog.inherits(Blockly.FieldTextInput,Blockly.Field),Blockly.FieldTextInput.FONTSIZE=11,Blockly.FieldTextInput.prototype.CURSOR="text",Blockly.FieldTextInput.prototype.spellcheck_=!0,Blockly.FieldTextInput.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this),Blockly.FieldTextInput.superClass_.dispose.call(this)},Blockly.FieldTextInput.prototype.setValue=function(e){if(null!==e){if(this.sourceBlock_){var o=this.callValidator(e);null!==o&&(e=o)}Blockly.Field.prototype.setValue.call(this,e)}},Blockly.FieldTextInput.prototype.setSpellcheck=function(e){this.spellcheck_=e},Blockly.FieldTextInput.prototype.showEditor_=function(e){if(this.workspace_=this.sourceBlock_.workspace,e=e||!1,!e&&(goog.userAgent.MOBILE||goog.userAgent.ANDROID||goog.userAgent.IPAD)){var o=this;Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.text_,function(e){o.sourceBlock_&&(e=o.callValidator(e)),o.setValue(e)})}else{Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_());var t=Blockly.WidgetDiv.DIV,n=goog.dom.createDom("INPUT","blocklyHtmlInput");n.setAttribute("spellcheck",this.spellcheck_);var r=Blockly.FieldTextInput.FONTSIZE*this.workspace_.scale+"pt";t.style.fontSize=r,n.style.fontSize=r,Blockly.FieldTextInput.htmlInput_=n,t.appendChild(n),n.value=n.defaultValue=this.text_,n.oldValue_=null,this.validate_(),this.resizeEditor_(),e||(n.focus(),n.select()),n.onKeyDownWrapper_=Blockly.bindEventWithChecks_(n,"keydown",this,this.onHtmlInputKeyDown_),n.onKeyUpWrapper_=Blockly.bindEventWithChecks_(n,"keyup",this,this.onHtmlInputChange_),n.onKeyPressWrapper_=Blockly.bindEventWithChecks_(n,"keypress",this,this.onHtmlInputChange_),n.onWorkspaceChangeWrapper_=this.resizeEditor_.bind(this),this.workspace_.addChangeListener(n.onWorkspaceChangeWrapper_)}},Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_=function(e){var o=Blockly.FieldTextInput.htmlInput_;13==e.keyCode?Blockly.WidgetDiv.hide():27==e.keyCode?(o.value=o.defaultValue,Blockly.WidgetDiv.hide()):9==e.keyCode&&(Blockly.WidgetDiv.hide(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())},Blockly.FieldTextInput.prototype.onHtmlInputChange_=function(e){e=Blockly.FieldTextInput.htmlInput_;var o=e.value;o!==e.oldValue_?(e.oldValue_=o,this.setValue(o),this.validate_()):goog.userAgent.WEBKIT&&this.sourceBlock_.render(),this.resizeEditor_(),Blockly.svgResize(this.sourceBlock_.workspace)},Blockly.FieldTextInput.prototype.validate_=function(){var e=!0;goog.asserts.assertObject(Blockly.FieldTextInput.htmlInput_);var o=Blockly.FieldTextInput.htmlInput_;this.sourceBlock_&&(e=this.callValidator(o.value)),null===e?Blockly.addClass_(o,"blocklyInvalidInput"):Blockly.removeClass_(o,"blocklyInvalidInput")},Blockly.FieldTextInput.prototype.resizeEditor_=function(){var e=Blockly.WidgetDiv.DIV,o=this.fieldGroup_.getBBox();if(e.style.width=o.width*this.workspace_.scale+"px",e.style.height=o.height*this.workspace_.scale+"px",o=this.getAbsoluteXY_(),this.sourceBlock_.RTL){var t=this.getScaledBBox_();o.x+=t.width,o.x-=e.offsetWidth}o.y+=1,goog.userAgent.GECKO&&Blockly.WidgetDiv.DIV.style.top&&(--o.x,--o.y),goog.userAgent.WEBKIT&&(o.y-=3),e.style.left=o.x+"px",e.style.top=o.y+"px"},Blockly.FieldTextInput.prototype.widgetDispose_=function(){var e=this;return function(){var o=Blockly.FieldTextInput.htmlInput_,t=o.value;e.sourceBlock_&&(t=e.callValidator(t),null===t?t=o.defaultValue:e.onFinishEditing_&&e.onFinishEditing_(t)),e.setValue(t),e.sourceBlock_.rendered&&e.sourceBlock_.render(),Blockly.unbindEvent_(o.onKeyDownWrapper_),Blockly.unbindEvent_(o.onKeyUpWrapper_),Blockly.unbindEvent_(o.onKeyPressWrapper_),e.workspace_.removeChangeListener(o.onWorkspaceChangeWrapper_),Blockly.FieldTextInput.htmlInput_=null,o=Blockly.WidgetDiv.DIV.style,o.width="auto",o.height="auto",o.fontSize=""}},Blockly.FieldTextInput.numberValidator=function(e){return console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead."),null===e?null:(e=String(e),e=e.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=parseFloat(e||0),isNaN(e)?null:String(e))},Blockly.FieldTextInput.nonnegativeIntegerValidator=function(e){return(e=Blockly.FieldTextInput.numberValidator(e))&&(e=String(Math.max(0,Math.floor(e)))),e},Blockly.FieldAngle=function(e,o){this.symbol_=Blockly.createSvgElement("tspan",{},null),this.symbol_.appendChild(document.createTextNode("°")),Blockly.FieldAngle.superClass_.constructor.call(this,e,o)},goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput),Blockly.FieldAngle.ROUND=15,Blockly.FieldAngle.HALF=50,Blockly.FieldAngle.CLOCKWISE=!1,Blockly.FieldAngle.OFFSET=0,Blockly.FieldAngle.WRAP=360,Blockly.FieldAngle.RADIUS=Blockly.FieldAngle.HALF-1,Blockly.FieldAngle.prototype.dispose_=function(){var e=this;return function(){Blockly.FieldAngle.superClass_.dispose_.call(e)(),e.gauge_=null,e.clickWrapper_&&Blockly.unbindEvent_(e.clickWrapper_),e.moveWrapper1_&&Blockly.unbindEvent_(e.moveWrapper1_),e.moveWrapper2_&&Blockly.unbindEvent_(e.moveWrapper2_)}},Blockly.FieldAngle.prototype.showEditor_=function(){Blockly.FieldAngle.superClass_.showEditor_.call(this,goog.userAgent.MOBILE||goog.userAgent.ANDROID||goog.userAgent.IPAD);var e=Blockly.WidgetDiv.DIV;if(e.firstChild){var e=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml",
    20 "xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",height:2*Blockly.FieldAngle.HALF+"px",width:2*Blockly.FieldAngle.HALF+"px"},e),o=Blockly.createSvgElement("circle",{cx:Blockly.FieldAngle.HALF,cy:Blockly.FieldAngle.HALF,r:Blockly.FieldAngle.RADIUS,"class":"blocklyAngleCircle"},e);this.gauge_=Blockly.createSvgElement("path",{"class":"blocklyAngleGauge"},e),this.line_=Blockly.createSvgElement("line",{x1:Blockly.FieldAngle.HALF,y1:Blockly.FieldAngle.HALF,"class":"blocklyAngleLine"},e);for(var t=0;360>t;t+=15)Blockly.createSvgElement("line",{x1:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS,y1:Blockly.FieldAngle.HALF,x2:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS-(0==t%45?10:5),y2:Blockly.FieldAngle.HALF,"class":"blocklyAngleMarks",transform:"rotate("+t+","+Blockly.FieldAngle.HALF+","+Blockly.FieldAngle.HALF+")"},e);e.style.marginLeft=15-Blockly.FieldAngle.RADIUS+"px",this.clickWrapper_=Blockly.bindEvent_(e,"click",this,Blockly.WidgetDiv.hide),this.moveWrapper1_=Blockly.bindEvent_(o,"mousemove",this,this.onMouseMove),this.moveWrapper2_=Blockly.bindEvent_(this.gauge_,"mousemove",this,this.onMouseMove),this.updateGraph_()}},Blockly.FieldAngle.prototype.onMouseMove=function(e){var o=this.gauge_.ownerSVGElement.getBoundingClientRect(),t=e.clientX-o.left-Blockly.FieldAngle.HALF;e=e.clientY-o.top-Blockly.FieldAngle.HALF,o=Math.atan(-e/t),isNaN(o)||(o=goog.math.toDegrees(o),0>t?o+=180:e>0&&(o+=360),o=Blockly.FieldAngle.CLOCKWISE?Blockly.FieldAngle.OFFSET+360-o:o-Blockly.FieldAngle.OFFSET,Blockly.FieldAngle.ROUND&&(o=Math.round(o/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND),o=this.callValidator(o),Blockly.FieldTextInput.htmlInput_.value=o,this.setValue(o),this.validate_(),this.resizeEditor_())},Blockly.FieldAngle.prototype.setText=function(e){Blockly.FieldAngle.superClass_.setText.call(this,e),this.textElement_&&(this.updateGraph_(),this.sourceBlock_.RTL?this.textElement_.insertBefore(this.symbol_,this.textElement_.firstChild):this.textElement_.appendChild(this.symbol_),this.size_.width=0)},Blockly.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var e=Number(this.getText())+Blockly.FieldAngle.OFFSET,o=goog.math.toRadians(e),e=["M ",Blockly.FieldAngle.HALF,",",Blockly.FieldAngle.HALF],t=Blockly.FieldAngle.HALF,n=Blockly.FieldAngle.HALF;if(!isNaN(o)){var r=goog.math.toRadians(Blockly.FieldAngle.OFFSET),i=Math.cos(r)*Blockly.FieldAngle.RADIUS,s=Math.sin(r)*-Blockly.FieldAngle.RADIUS;Blockly.FieldAngle.CLOCKWISE&&(o=2*r-o),t+=Math.cos(o)*Blockly.FieldAngle.RADIUS,n-=Math.sin(o)*Blockly.FieldAngle.RADIUS,o=Math.abs(Math.floor((o-r)/Math.PI)%2),Blockly.FieldAngle.CLOCKWISE&&(o=1-o),e.push(" l ",i,",",s," A ",Blockly.FieldAngle.RADIUS,",",Blockly.FieldAngle.RADIUS," 0 ",o," ",Number(Blockly.FieldAngle.CLOCKWISE)," ",t,",",n," z")}this.gauge_.setAttribute("d",e.join("")),this.line_.setAttribute("x2",t),this.line_.setAttribute("y2",n)}},Blockly.FieldAngle.prototype.classValidator=function(e){return null===e?null:(e=parseFloat(e||0),isNaN(e)?null:(e%=360,0>e&&(e+=360),e>Blockly.FieldAngle.WRAP&&(e-=360),String(e)))},Blockly.FieldCheckbox=function(e,o){Blockly.FieldCheckbox.superClass_.constructor.call(this,"",o),this.setValue(e)},goog.inherits(Blockly.FieldCheckbox,Blockly.Field),Blockly.FieldCheckbox.CHECK_CHAR="✓",Blockly.FieldCheckbox.prototype.CURSOR="default",Blockly.FieldCheckbox.prototype.init=function(){if(!this.fieldGroup_){Blockly.FieldCheckbox.superClass_.init.call(this),this.checkElement_=Blockly.createSvgElement("text",{"class":"blocklyText blocklyCheckbox",x:-3,y:14},this.fieldGroup_);var e=document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);this.checkElement_.appendChild(e),this.checkElement_.style.display=this.state_?"block":"none"}},Blockly.FieldCheckbox.prototype.getValue=function(){return String(this.state_).toUpperCase()},Blockly.FieldCheckbox.prototype.setValue=function(e){e="TRUE"==e.toUpperCase(),this.state_!==e&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.state_,e)),this.state_=e,this.checkElement_&&(this.checkElement_.style.display=e?"block":"none"))},Blockly.FieldCheckbox.prototype.showEditor_=function(){var e=!this.state_;this.sourceBlock_&&(e=this.callValidator(e)),null!==e&&this.setValue(String(e).toUpperCase())},Blockly.FieldColour=function(e,o){Blockly.FieldColour.superClass_.constructor.call(this,e,o),this.setText(Blockly.Field.NBSP+Blockly.Field.NBSP+Blockly.Field.NBSP)},goog.inherits(Blockly.FieldColour,Blockly.Field),Blockly.FieldColour.prototype.colours_=null,Blockly.FieldColour.prototype.columns_=0,Blockly.FieldColour.prototype.init=function(){Blockly.FieldColour.superClass_.init.call(this),this.borderRect_.style.fillOpacity=1,this.setValue(this.getValue())},Blockly.FieldColour.prototype.CURSOR="default",Blockly.FieldColour.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this),Blockly.FieldColour.superClass_.dispose.call(this)},Blockly.FieldColour.prototype.getValue=function(){return this.colour_},Blockly.FieldColour.prototype.setValue=function(e){this.sourceBlock_&&Blockly.Events.isEnabled()&&this.colour_!=e&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.colour_,e)),this.colour_=e,this.borderRect_&&(this.borderRect_.style.fill=e)},Blockly.FieldColour.prototype.getText=function(){var e=this.colour_,o=e.match(/^#(.)\1(.)\2(.)\3$/);return o&&(e="#"+o[1]+o[2]+o[3]),e},Blockly.FieldColour.COLOURS=goog.ui.ColorPicker.SIMPLE_GRID_COLORS,Blockly.FieldColour.COLUMNS=7,Blockly.FieldColour.prototype.setColours=function(e){return this.colours_=e,this},Blockly.FieldColour.prototype.setColumns=function(e){return this.columns_=e,this},Blockly.FieldColour.prototype.showEditor_=function(){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,Blockly.FieldColour.widgetDispose_);var e=new goog.ui.ColorPicker;e.setSize(this.columns_||Blockly.FieldColour.COLUMNS),e.setColors(this.colours_||Blockly.FieldColour.COLOURS);var o=goog.dom.getViewportSize(),t=goog.style.getViewportPageOffset(document),n=this.getAbsoluteXY_(),r=this.getScaledBBox_();e.render(Blockly.WidgetDiv.DIV),e.setSelectedColor(this.getValue());var i=goog.style.getSize(e.getElement());n.y=n.y+i.height+r.height>=o.height+t.y?n.y-(i.height-1):n.y+(r.height-1),this.sourceBlock_.RTL?(n.x+=r.width,n.x-=i.width,n.x<t.x&&(n.x=t.x)):n.x>o.width+t.x-i.width&&(n.x=o.width+t.x-i.width),Blockly.WidgetDiv.position(n.x,n.y,o,t,this.sourceBlock_.RTL);var s=this;Blockly.FieldColour.changeEventKey_=goog.events.listen(e,goog.ui.ColorPicker.EventType.CHANGE,function(e){e=e.target.getSelectedColor()||"#000000",Blockly.WidgetDiv.hide(),s.sourceBlock_&&(e=s.callValidator(e)),null!==e&&s.setValue(e)})},Blockly.FieldColour.widgetDispose_=function(){Blockly.FieldColour.changeEventKey_&&goog.events.unlistenByKey(Blockly.FieldColour.changeEventKey_)},Blockly.FieldDropdown=function(e,o){this.menuGenerator_=e,this.trimOptions_();var t=this.getOptions_()[0];Blockly.FieldDropdown.superClass_.constructor.call(this,t[1],o)},goog.inherits(Blockly.FieldDropdown,Blockly.Field),Blockly.FieldDropdown.CHECKMARK_OVERHANG=25,Blockly.FieldDropdown.ARROW_CHAR=goog.userAgent.ANDROID?"▼":"▾",Blockly.FieldDropdown.prototype.CURSOR="default",Blockly.FieldDropdown.prototype.value_="",Blockly.FieldDropdown.prototype.init=function(){if(!this.fieldGroup_){this.arrow_=Blockly.createSvgElement("tspan",{},null),this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR)),Blockly.FieldDropdown.superClass_.init.call(this);var e=this.text_;this.text_=null,this.setText(e)}},Blockly.FieldDropdown.prototype.showEditor_=function(){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,null);var e=this,o=new goog.ui.Menu;o.setRightToLeft(this.sourceBlock_.RTL);for(var t=this.getOptions_(),n=0;n<t.length;n++){var r=t[n][1],i=new goog.ui.MenuItem(t[n][0]);i.setRightToLeft(this.sourceBlock_.RTL),i.setValue(r),i.setCheckable(!0),o.addChild(i,!0),i.setChecked(r==this.value_)}goog.events.listen(o,goog.ui.Component.EventType.ACTION,function(o){(o=o.target)&&e.onItemSelected(this,o),Blockly.WidgetDiv.hideIfOwner(e)}),o.getHandler().listen(o.getElement(),goog.events.EventType.TOUCHSTART,function(e){this.getOwnerControl(e.target).handleMouseDown(e)}),o.getHandler().listen(o.getElement(),goog.events.EventType.TOUCHEND,function(e){this.getOwnerControl(e.target).performActionInternal(e)}),t=goog.dom.getViewportSize(),n=goog.style.getViewportPageOffset(document),r=this.getAbsoluteXY_(),i=this.getScaledBBox_(),o.render(Blockly.WidgetDiv.DIV);var s=o.getElement();Blockly.addClass_(s,"blocklyDropdownMenu");var l=goog.style.getSize(s);l.height=s.scrollHeight,r.y=r.y+l.height+i.height>=t.height+n.y?r.y-(l.height+2):r.y+i.height,this.sourceBlock_.RTL?(r.x+=i.width,r.x+=Blockly.FieldDropdown.CHECKMARK_OVERHANG,r.x<n.x+l.width&&(r.x=n.x+l.width)):(r.x-=Blockly.FieldDropdown.CHECKMARK_OVERHANG,r.x>t.width+n.x-l.width&&(r.x=t.width+n.x-l.width)),Blockly.WidgetDiv.position(r.x,r.y,t,n,this.sourceBlock_.RTL),o.setAllowAutoFocus(!0),s.focus()},Blockly.FieldDropdown.prototype.onItemSelected=function(e,o){var t=o.getValue();this.sourceBlock_&&(t=this.callValidator(t)),null!==t&&this.setValue(t)},Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.prefixField=null;var e=this.menuGenerator_;if(goog.isArray(e)&&!(2>e.length)){var o=e.map(function(e){return e[0]}),t=Blockly.shortestStringLength(o),n=Blockly.commonWordPrefix(o,t),r=Blockly.commonWordSuffix(o,t);if((n||r)&&!(n+r>=t)){for(n&&(this.prefixField=o[0].substring(0,n-1)),r&&(this.suffixField=o[0].substr(1-r)),o=[],t=0;t<e.length;t++){var i=e[t][0],s=e[t][1],i=i.substring(n,i.length-r);o[t]=[i,s]}this.menuGenerator_=o}}},Blockly.FieldDropdown.prototype.getOptions_=function(){return goog.isFunction(this.menuGenerator_)?this.menuGenerator_.call(this):this.menuGenerator_},Blockly.FieldDropdown.prototype.getValue=function(){return this.value_},Blockly.FieldDropdown.prototype.setValue=function(e){if(null!==e&&e!==this.value_){this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,e)),this.value_=e;for(var o=this.getOptions_(),t=0;t<o.length;t++)if(o[t][1]==e)return void this.setText(o[t][0]);this.setText(e)}},Blockly.FieldDropdown.prototype.setText=function(e){this.sourceBlock_&&this.arrow_&&(this.arrow_.style.fill=this.sourceBlock_.getColour()),null!==e&&e!==this.text_&&(this.text_=e,this.updateTextNode_(),this.textElement_&&(this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textElement_.firstChild):this.textElement_.appendChild(this.arrow_)),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()))},Blockly.FieldDropdown.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this),Blockly.FieldDropdown.superClass_.dispose.call(this)},Blockly.FieldImage=function(e,o,t,n){this.sourceBlock_=null,this.height_=Number(t),this.width_=Number(o),this.size_=new goog.math.Size(this.width_,this.height_+2*Blockly.BlockSvg.INLINE_PADDING_Y),this.text_=n||"",this.setValue(e)},goog.inherits(Blockly.FieldImage,Blockly.Field),Blockly.FieldImage.prototype.rectElement_=null,Blockly.FieldImage.prototype.EDITABLE=!1,Blockly.FieldImage.prototype.init=function(){if(!this.fieldGroup_){this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.imageElement_=Blockly.createSvgElement("image",{height:this.height_+"px",width:this.width_+"px"},this.fieldGroup_),this.setValue(this.src_),goog.userAgent.GECKO&&(this.rectElement_=Blockly.createSvgElement("rect",{height:this.height_+"px",width:this.width_+"px","fill-opacity":0},this.fieldGroup_)),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);var e=this.rectElement_||this.imageElement_;e.tooltip=this.sourceBlock_,Blockly.Tooltip.bindMouseEvents(e)}},Blockly.FieldImage.prototype.dispose=function(){goog.dom.removeNode(this.fieldGroup_),this.rectElement_=this.imageElement_=this.fieldGroup_=null},Blockly.FieldImage.prototype.setTooltip=function(e){(this.rectElement_||this.imageElement_).tooltip=e},Blockly.FieldImage.prototype.getValue=function(){return this.src_},Blockly.FieldImage.prototype.setValue=function(e){null!==e&&(this.src_=e,this.imageElement_&&this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",goog.isString(e)?e:""))},Blockly.FieldImage.prototype.setText=function(e){null!==e&&(this.text_=e)},Blockly.FieldImage.prototype.render_=function(){},Blockly.FieldNumber=function(e,o,t,n,r){e=String(e),Blockly.FieldNumber.superClass_.constructor.call(this,e,r),this.setConstraints(o,t,n)},goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput),Blockly.FieldNumber.prototype.setConstraints=function(e,o,t){t=parseFloat(t),this.precision_=isNaN(t)?0:t,e=parseFloat(e),this.min_=isNaN(e)?-(1/0):e,o=parseFloat(o),this.max_=isNaN(o)?1/0:o,this.setValue(this.callValidator(this.getValue()))},Blockly.FieldNumber.prototype.classValidator=function(e){return null===e?null:(e=String(e),e=e.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=parseFloat(e||0),isNaN(e)?null:(this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),e=goog.math.clamp(e,this.min_,this.max_),String(e)))},Blockly.FieldVariable=function(e,o){Blockly.FieldVariable.superClass_.constructor.call(this,Blockly.FieldVariable.dropdownCreate,o),this.setValue(e||"")},goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown),Blockly.FieldVariable.prototype.renameVarItemIndex_=-1,Blockly.FieldVariable.prototype.deleteVarItemIndex_=-1,Blockly.FieldVariable.prototype.init=function(){this.fieldGroup_||(Blockly.FieldVariable.superClass_.init.call(this),this.getValue()||this.setValue(Blockly.Variables.generateUniqueName(this.sourceBlock_.isInFlyout?this.sourceBlock_.workspace.targetWorkspace:this.sourceBlock_.workspace)),this.sourceBlock_.isInFlyout||this.sourceBlock_.workspace.createVariable(this.getValue()))},Blockly.FieldVariable.prototype.setSourceBlock=function(e){goog.asserts.assert(!e.isShadow(),"Variable fields are not allowed to exist on shadow blocks."),Blockly.FieldVariable.superClass_.setSourceBlock.call(this,e)},Blockly.FieldVariable.prototype.getValue=function(){return this.getText()},Blockly.FieldVariable.prototype.setValue=function(e){this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,e)),this.value_=e,this.setText(e)},Blockly.FieldVariable.dropdownCreate=function(){var e=this.sourceBlock_&&this.sourceBlock_.workspace?this.sourceBlock_.workspace.variableList.slice(0):[],o=this.getText();o&&-1==e.indexOf(o)&&e.push(o),e.sort(goog.string.caseInsensitiveCompare),this.renameVarItemIndex_=e.length,e.push(Blockly.Msg.RENAME_VARIABLE),this.deleteVarItemIndex_=e.length,e.push(Blockly.Msg.DELETE_VARIABLE.replace("%1",o));for(var o=[],t=0;t<e.length;t++)o[t]=[e[t],e[t]];return o},Blockly.FieldVariable.prototype.onItemSelected=function(e,o){e.getChildCount();var t=o.getValue();if(this.sourceBlock_){var n=this.sourceBlock_.workspace;if(0<=this.renameVarItemIndex_&&e.getChildAt(this.renameVarItemIndex_)===o){var r=this.getText();return Blockly.hideChaff(),void Blockly.Variables.promptName(Blockly.Msg.RENAME_VARIABLE_TITLE.replace("%1",r),r,function(e){e&&n.renameVariable(r,e)})}if(0<=this.deleteVarItemIndex_&&e.getChildAt(this.deleteVarItemIndex_)===o)return void n.deleteVariable(this.getText());t=this.callValidator(t)}null!==t&&this.setValue(t)},Blockly.FlyoutButton=function(e,o,t,n,r){this.workspace_=e,this.targetWorkspace_=o,this.text_=t,this.position_=new goog.math.Coordinate(0,0),this.callback_=Blockly.flyoutButtonCallbacks_[n],this.isLabel_=r},Blockly.FlyoutButton.MARGIN=5,Blockly.FlyoutButton.prototype.width=0,Blockly.FlyoutButton.prototype.height=0,Blockly.FlyoutButton.prototype.createDom=function(){if(this.svgGroup_=Blockly.createSvgElement("g",{"class":this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton"},this.workspace_.getCanvas()),!this.isLabel_)var e=Blockly.createSvgElement("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);var o=Blockly.createSvgElement("rect",{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.svgGroup_),t=Blockly.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);return t.textContent=this.text_,this.width=t.getComputedTextLength()+2*Blockly.FlyoutButton.MARGIN,this.height=20,this.isLabel_||(e.setAttribute("width",this.width),e.setAttribute("height",this.height)),o.setAttribute("width",this.width),o.setAttribute("height",this.height),t.setAttribute("x",this.width/2),t.setAttribute("y",this.height-Blockly.FlyoutButton.MARGIN),this.updateTransform_(),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(e,o){this.position_.x=e,this.position_.y=o,this.updateTransform_()},Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_},Blockly.FlyoutButton.prototype.dispose=function(){this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.targetWorkspace_=this.workspace_=null},Blockly.FlyoutButton.prototype.onMouseUp=function(e){e.preventDefault(),e.stopPropagation(),Blockly.Flyout.terminateDrag_(),this.callback_&&this.callback_(this)},Blockly.Flyout=function(e){e.getMetrics=this.getMetrics_.bind(this),e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new Blockly.WorkspaceSvg(e),this.workspace_.isFlyout=!0,this.RTL=!!e.RTL,this.horizontalLayout_=e.horizontalLayout,this.toolboxPosition_=e.toolboxPosition,this.eventWrappers_=[],this.backgroundButtons_=[],this.buttons_=[],this.listeners_=[],this.permanentlyDisabled_=[],this.startDragMouseX_=this.startDragMouseY_=0},Blockly.Flyout.startFlyout_=null,Blockly.Flyout.startDownEvent_=null,Blockly.Flyout.startBlock_=null,Blockly.Flyout.onMouseUpWrapper_=null,Blockly.Flyout.onMouseMoveWrapper_=null,Blockly.Flyout.onMouseMoveBlockWrapper_=null,Blockly.Flyout.prototype.autoClose=!0,Blockly.Flyout.prototype.CORNER_RADIUS=8,Blockly.Flyout.prototype.DRAG_RADIUS=10,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.dragMode_=Blockly.DRAG_NONE,Blockly.Flyout.prototype.dragAngleRange_=70,Blockly.Flyout.prototype.createDom=function(){return this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyFlyout"},null),this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.svgGroup_},Blockly.Flyout.prototype.init=function(e){this.targetWorkspace_=e,this.workspace_.targetWorkspace=e,this.scrollbar_=new Blockly.Scrollbar(this.workspace_,this.horizontalLayout_,!1),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.svgGroup_,"mousedown",this,this.onMouseDown_))},Blockly.Flyout.prototype.dispose=function(){this.hide(),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_&&(goog.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.getMetrics_=function(){if(!this.isVisible())return null;try{var e=this.workspace_.getCanvas().getBBox()}catch(o){e={height:0,y:0,width:0,x:0}}var t=this.SCROLLBAR_PADDING,n=this.SCROLLBAR_PADDING;if(this.horizontalLayout_){this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(t=0);var r=this.height_;this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP&&(r-=this.SCROLLBAR_PADDING);var i=this.width_-2*this.SCROLLBAR_PADDING}else n=0,r=this.height_-2*this.SCROLLBAR_PADDING,i=this.width_,this.RTL||(i-=this.SCROLLBAR_PADDING);return{viewHeight:r,viewWidth:i,contentHeight:(e.height+2*this.MARGIN)*this.workspace_.scale,contentWidth:(e.width+2*this.MARGIN)*this.workspace_.scale,viewTop:-this.workspace_.scrollY,viewLeft:-this.workspace_.scrollX,contentTop:e.y,contentLeft:e.x,absoluteTop:t,absoluteLeft:n}},Blockly.Flyout.prototype.setMetrics_=function(e){var o=this.getMetrics_();o&&(!this.horizontalLayout_&&goog.isNumber(e.y)?this.workspace_.scrollY=-o.contentHeight*e.y:this.horizontalLayout_&&goog.isNumber(e.x)&&(this.workspace_.scrollX=-o.contentWidth*e.x),this.workspace_.translate(this.workspace_.scrollX+o.absoluteLeft,this.workspace_.scrollY+o.absoluteTop))},Blockly.Flyout.prototype.position=function(){if(this.isVisible()){var e=this.targetWorkspace_.getMetrics();if(e){this.setBackgroundPath_(this.horizontalLayout_?e.viewWidth-2*this.CORNER_RADIUS:this.width_-this.CORNER_RADIUS,this.horizontalLayout_?this.height_-this.CORNER_RADIUS:e.viewHeight-2*this.CORNER_RADIUS);var o=e.absoluteLeft;this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT&&(o+=e.viewWidth,o-=this.width_);var t=e.absoluteTop;this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(t+=e.viewHeight,t-=this.height_),this.svgGroup_.setAttribute("transform","translate("+o+","+t+")"),this.horizontalLayout_?this.width_=e.viewWidth:this.height_=e.viewHeight,this.scrollbar_&&this.scrollbar_.resize()}}},Blockly.Flyout.prototype.setBackgroundPath_=function(e,o){this.horizontalLayout_?this.setBackgroundPathHorizontal_(e,o):this.setBackgroundPathVertical_(e,o)},Blockly.Flyout.prototype.setBackgroundPathVertical_=function(e,o){var t=this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT,n=e+this.CORNER_RADIUS,n=["M "+(t?n:0)+",0"];n.push("h",t?-e:e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,t?0:1,t?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",Math.max(0,o)),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,t?0:1,t?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",t?e:-e),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))},Blockly.Flyout.prototype.setBackgroundPathHorizontal_=function(e,o){var t=this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP,n=["M 0,"+(t?0:this.CORNER_RADIUS)];t?(n.push("h",e+2*this.CORNER_RADIUS),n.push("v",o),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",-1*e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),n.push("h",e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",o),n.push("h",-e-2*this.CORNER_RADIUS)),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))},Blockly.Flyout.prototype.scrollToStart=function(){this.scrollbar_.set(this.horizontalLayout_&&this.RTL?1/0:0)},Blockly.Flyout.prototype.wheel_=function(e){var o=this.horizontalLayout_?e.deltaX:e.deltaY;if(o){goog.userAgent.GECKO&&(o*=10);var t=this.getMetrics_(),o=this.horizontalLayout_?t.viewLeft+o:t.viewTop+o,o=Math.min(o,this.horizontalLayout_?t.contentWidth-t.viewWidth:t.contentHeight-t.viewHeight),o=Math.max(o,0);this.scrollbar_.set(o)}e.preventDefault(),e.stopPropagation()},Blockly.Flyout.prototype.isVisible=function(){return this.svgGroup_&&"block"==this.svgGroup_.style.display},Blockly.Flyout.prototype.hide=function(){if(this.isVisible()){this.svgGroup_.style.display="none";for(var e,o=0;e=this.listeners_[o];o++)Blockly.unbindEvent_(e);this.listeners_.length=0,this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}},Blockly.Flyout.prototype.flyoutCategory=function(e,o){return e},Blockly.Flyout.prototype.show=function(e){this.hide(),this.clearOldBlocks_(),e=this.flyoutCategory(e,this.workspace_.targetWorkspace),this.svgGroup_.style.display="block";for(var o,t=[],n=[],r=this.permanentlyDisabled_.length=0;o=e[r];r++)if(o.tagName){var i=o.tagName.toUpperCase(),s=this.horizontalLayout_?this.GAP_X:this.GAP_Y;if("BLOCK"==i)i=Blockly.Xml.domToBlock(o,this.workspace_),i.disabled&&this.permanentlyDisabled_.push(i),t.push({type:"block",block:i}),o=parseInt(o.getAttribute("gap"),10),n.push(isNaN(o)?s:o);else if("SEP"==o.tagName.toUpperCase())o=parseInt(o.getAttribute("gap"),10),!isNaN(o)&&0<n.length?n[n.length-1]=o:n.push(s);else if("BUTTON"==i||"LABEL"==i){var i="LABEL"==i,l=o.getAttribute("text");o=o.getAttribute("callbackKey"),o=new Blockly.FlyoutButton(this.workspace_,this.targetWorkspace_,l,o,i),t.push({type:"button",button:o}),n.push(s)}}this.layout_(t,n),this.listeners_.push(Blockly.bindEventWithChecks_(this.svgBackground_,"mouseover",this,function(){for(var e,o=this.workspace_.getTopBlocks(!1),t=0;e=o[t];t++)e.removeSelect()})),this.horizontalLayout_?this.height_=0:this.width_=0,this.reflow(),this.filterForCapacity_(),this.position(),this.reflowWrapper_=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper_)},Blockly.Flyout.prototype.layout_=function(e,o){this.workspace_.scale=this.targetWorkspace_.scale;var t=this.MARGIN,n=this.RTL?t:t+Blockly.BlockSvg.TAB_WIDTH;this.horizontalLayout_&&this.RTL&&(e=e.reverse());for(var r,i=0;r=e[i];i++)if("block"==r.type){r=r.block;for(var s,l=r.getDescendants(),g=0;s=l[g];g++)s.isInFlyout=!0;r.render(),l=r.getSvgRoot(),g=r.getHeightWidth(),s=r.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,this.horizontalLayout_&&(n+=s),r.moveBy(this.horizontalLayout_&&this.RTL?n+g.width-s:n,t),this.horizontalLayout_?n+=g.width+o[i]-s:t+=g.height+o[i],g=Blockly.createSvgElement("rect",{"fill-opacity":0},null),g.tooltip=r,Blockly.Tooltip.bindMouseEvents(g),this.workspace_.getCanvas().insertBefore(g,r.getSvgRoot()),r.flyoutRect_=g,this.backgroundButtons_[i]=g,this.addBlockListeners_(l,r,g)}else"button"==r.type&&(r=r.button,l=r.createDom(),r.moveTo(n,t),r.show(),Blockly.bindEventWithChecks_(l,"mouseup",r,r.onMouseUp),this.buttons_.push(r),this.horizontalLayout_?n+=r.width+o[i]:t+=r.height+o[i])},Blockly.Flyout.prototype.clearOldBlocks_=function(){for(var e,o=this.workspace_.getTopBlocks(!1),t=0;e=o[t];t++)e.workspace==this.workspace_&&e.dispose(!1,!1);for(t=0;o=this.backgroundButtons_[t];t++)goog.dom.removeNode(o);for(t=this.backgroundButtons_.length=0;o=this.buttons_[t];t++)o.dispose();this.buttons_.length=0},Blockly.Flyout.prototype.addBlockListeners_=function(e,o,t){this.listeners_.push(Blockly.bindEventWithChecks_(e,"mousedown",null,this.blockMouseDown_(o))),this.listeners_.push(Blockly.bindEventWithChecks_(t,"mousedown",null,this.blockMouseDown_(o))),this.listeners_.push(Blockly.bindEvent_(e,"mouseover",o,o.addSelect)),this.listeners_.push(Blockly.bindEvent_(e,"mouseout",o,o.removeSelect)),this.listeners_.push(Blockly.bindEvent_(t,"mouseover",o,o.addSelect)),this.listeners_.push(Blockly.bindEvent_(t,"mouseout",o,o.removeSelect))},Blockly.Flyout.blockRightClick_=function(e,o){Blockly.terminateDrag_(),Blockly.hideChaff(!0),o.showContextMenu_(e),Blockly.Touch.clearTouchIdentifier()},Blockly.Flyout.prototype.blockMouseDown_=function(e){var o=this;return function(t){Blockly.isRightButton(t)?Blockly.Flyout.blockRightClick_(t,e):(Blockly.terminateDrag_(),Blockly.hideChaff(!0),Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),o.startDragMouseY_=t.clientY,o.startDragMouseX_=t.clientX,Blockly.Flyout.startDownEvent_=t,Blockly.Flyout.startBlock_=e,Blockly.Flyout.startFlyout_=o,Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",o,o.onMouseUp_),Blockly.Flyout.onMouseMoveBlockWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",o,o.onMouseMoveBlock_)),t.stopPropagation(),t.preventDefault()}},Blockly.Flyout.prototype.onMouseDown_=function(e){Blockly.isRightButton(e)?Blockly.Touch.clearTouchIdentifier():(Blockly.hideChaff(!0),this.dragMode_=Blockly.DRAG_FREE,this.startDragMouseY_=e.clientY,this.startDragMouseX_=e.clientX,Blockly.Flyout.startFlyout_=this,Blockly.Flyout.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.onMouseMove_),Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,Blockly.Flyout.terminateDrag_),e.preventDefault(),e.stopPropagation())},Blockly.Flyout.prototype.onMouseUp_=function(e){this.workspace_.isDragging()||(Blockly.Touch.clearTouchIdentifier(),this.autoClose?this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_):Blockly.WidgetDiv.isVisible()||Blockly.Events.fire(new Blockly.Events.Ui(Blockly.Flyout.startBlock_,"click",void 0,void 0))),Blockly.terminateDrag_()},Blockly.Flyout.prototype.onMouseMove_=function(e){var o=this.getMetrics_();if(this.horizontalLayout_){if(!(0>o.contentWidth-o.viewWidth)){var t=e.clientX-this.startDragMouseX_;this.startDragMouseX_=e.clientX,e=o.viewLeft-t,e=goog.math.clamp(e,0,o.contentWidth-o.viewWidth),this.scrollbar_.set(e)}}else 0>o.contentHeight-o.viewHeight||(t=e.clientY-this.startDragMouseY_,this.startDragMouseY_=e.clientY,e=o.viewTop-t,e=goog.math.clamp(e,0,o.contentHeight-o.viewHeight),this.scrollbar_.set(e))},Blockly.Flyout.prototype.onMouseMoveBlock_=function(e){"mousemove"==e.type&&1>=e.clientX&&0==e.clientY&&0==e.button||(this.determineDragIntention_(e.clientX-Blockly.Flyout.startDownEvent_.clientX,e.clientY-Blockly.Flyout.startDownEvent_.clientY)?(Blockly.longStop_(),this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_)):this.dragMode_==Blockly.DRAG_FREE&&(Blockly.longStop_(),this.onMouseMove_(e))),e.stopPropagation()},Blockly.Flyout.prototype.determineDragIntention_=function(e,o){return this.dragMode_==Blockly.DRAG_FREE?!1:Math.sqrt(e*e+o*o)<this.DRAG_RADIUS?(this.dragMode_=Blockly.DRAG_STICKY,!1):this.isDragTowardWorkspace_(e,o)||!this.scrollbar_.isVisible()?!0:(this.dragMode_=Blockly.DRAG_FREE,!1)},Blockly.Flyout.prototype.isDragTowardWorkspace_=function(e,o){var t=Math.atan2(o,e)/Math.PI*180,n=this.dragAngleRange_;if(this.horizontalLayout_){if(90+n>t&&t>90-n||t>-90-n&&-90+n>t)return!0}else if(n>t&&t>-n||-180+n>t||t>180-n)return!0;return!1},Blockly.Flyout.prototype.createBlockFunc_=function(e){var o=this;return function(t){if(!Blockly.isRightButton(t)&&!e.disabled){Blockly.Events.disable();try{var n=o.placeNewBlock_(e)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(n))),o.autoClose?o.hide():o.filterForCapacity_(),n.onMouseDown_(t),Blockly.dragMode_=Blockly.DRAG_FREE,n.setDragging_(!0),o.targetWorkspace_.setResizesEnabled(!1)}}},Blockly.Flyout.prototype.placeNewBlock_=function(e){var o=this.targetWorkspace_,t=e.getSvgRoot();if(!t)throw"originBlock is not rendered.";var t=Blockly.getSvgXY_(t,o),n=this.workspace_.scrollX,r=this.workspace_.scale;if(t.x+=n/r-n,this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT&&(n=o.getMetrics().viewWidth-this.width_,r=o.scale,t.x+=n/r-n),n=this.workspace_.scrollY,r=this.workspace_.scale,t.y+=n/r-n,
     19Blockly.BlockSvg.superClass_.moveNumberedInputBefore.call(this,e,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.BlockSvg.prototype.appendInput_=function(e,o){var t=Blockly.BlockSvg.superClass_.appendInput_.call(this,e,o);return this.rendered&&(this.render(),this.bumpNeighbours_()),t},Blockly.BlockSvg.prototype.getConnections_=function(e){var o=[];if((e||this.rendered)&&(this.outputConnection&&o.push(this.outputConnection),this.previousConnection&&o.push(this.previousConnection),this.nextConnection&&o.push(this.nextConnection),e||!this.collapsed_)){e=0;for(var t;t=this.inputList[e];e++)t.connection&&o.push(t.connection)}return o},Blockly.BlockSvg.prototype.makeConnection_=function(e){return new Blockly.RenderedConnection(this,e)},Blockly.BlockSvg.render={},Blockly.BlockSvg.SEP_SPACE_X=10,Blockly.BlockSvg.SEP_SPACE_Y=10,Blockly.BlockSvg.INLINE_PADDING_Y=5,Blockly.BlockSvg.MIN_BLOCK_Y=25,Blockly.BlockSvg.TAB_HEIGHT=20,Blockly.BlockSvg.TAB_WIDTH=8,Blockly.BlockSvg.NOTCH_WIDTH=30,Blockly.BlockSvg.CORNER_RADIUS=8,Blockly.BlockSvg.START_HAT=!1,Blockly.BlockSvg.START_HAT_HEIGHT=15,Blockly.BlockSvg.START_HAT_PATH="c 30,-"+Blockly.BlockSvg.START_HAT_HEIGHT+" 70,-"+Blockly.BlockSvg.START_HAT_HEIGHT+" 100,0",Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR="c 17.8,-9.2 45.3,-14.9 75,-8.7 M 100.5,0.5",Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL="m 25,-8.7 c 29.7,-6.2 57.2,-0.5 75,8.7",Blockly.BlockSvg.DISTANCE_45_INSIDE=(1-Math.SQRT1_2)*(Blockly.BlockSvg.CORNER_RADIUS-.5)+.5,Blockly.BlockSvg.DISTANCE_45_OUTSIDE=(1-Math.SQRT1_2)*(Blockly.BlockSvg.CORNER_RADIUS+.5)-.5,Blockly.BlockSvg.NOTCH_PATH_LEFT="l 6,4 3,0 6,-4",Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT="l 6,4 3,0 6,-4",Blockly.BlockSvg.NOTCH_PATH_RIGHT="l -6,4 -3,0 -6,-4",Blockly.BlockSvg.JAGGED_TEETH="l 8,0 0,4 8,4 -16,8 8,4",Blockly.BlockSvg.JAGGED_TEETH_HEIGHT=20,Blockly.BlockSvg.JAGGED_TEETH_WIDTH=15,Blockly.BlockSvg.TAB_PATH_DOWN="v 5 c 0,10 -"+Blockly.BlockSvg.TAB_WIDTH+",-8 -"+Blockly.BlockSvg.TAB_WIDTH+",7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",-2.5 "+Blockly.BlockSvg.TAB_WIDTH+",7.5",Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL="v 6.5 m -"+.97*Blockly.BlockSvg.TAB_WIDTH+",3 q -"+.05*Blockly.BlockSvg.TAB_WIDTH+",10 "+.3*Blockly.BlockSvg.TAB_WIDTH+",9.5 m "+.67*Blockly.BlockSvg.TAB_WIDTH+",-1.9 v 1.4",Blockly.BlockSvg.TOP_LEFT_CORNER_START="m 0,"+Blockly.BlockSvg.CORNER_RADIUS,Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL="m "+Blockly.BlockSvg.DISTANCE_45_INSIDE+","+Blockly.BlockSvg.DISTANCE_45_INSIDE,Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR="m 0.5,"+(Blockly.BlockSvg.CORNER_RADIUS-.5),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_LEFT_CORNER_HIGHLIGHT="A "+(Blockly.BlockSvg.CORNER_RADIUS-.5)+","+(Blockly.BlockSvg.CORNER_RADIUS-.5)+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",0.5",Blockly.BlockSvg.INNER_TOP_LEFT_CORNER=Blockly.BlockSvg.NOTCH_PATH_RIGHT+" h -"+(Blockly.BlockSvg.NOTCH_WIDTH-15-Blockly.BlockSvg.CORNER_RADIUS)+" 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.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+(-Blockly.BlockSvg.DISTANCE_45_OUTSIDE-.5)+","+(Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.DISTANCE_45_OUTSIDE),Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL="a "+(Blockly.BlockSvg.CORNER_RADIUS+.5)+","+(Blockly.BlockSvg.CORNER_RADIUS+.5)+" 0 0,0 "+(Blockly.BlockSvg.CORNER_RADIUS+.5)+","+(Blockly.BlockSvg.CORNER_RADIUS+.5),Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR="a "+(Blockly.BlockSvg.CORNER_RADIUS+.5)+","+(Blockly.BlockSvg.CORNER_RADIUS+.5)+" 0 0,0 "+(Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)+","+(Blockly.BlockSvg.DISTANCE_45_OUTSIDE+.5),Blockly.BlockSvg.prototype.render=function(e){Blockly.Field.startCache(),this.rendered=!0;var o=Blockly.BlockSvg.SEP_SPACE_X;this.RTL&&(o=-o);for(var t=this.getIcons(),n=0;n<t.length;n++)o=t[n].renderIcon(o);o+=this.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X,t=this.renderCompute_(o),this.renderDraw_(o,t),this.renderMoveConnections_(),!1!==e&&((e=this.getParent())?e.render(!0):this.workspace.resizeContents()),Blockly.Field.stopCache()},Blockly.BlockSvg.prototype.renderFields_=function(e,o,t){t+=Blockly.BlockSvg.INLINE_PADDING_Y,this.RTL&&(o=-o);for(var n,r=0;n=e[r];r++){var i=n.getSvgRoot();i&&(this.RTL?(o-=n.renderSep+n.renderWidth,i.setAttribute("transform","translate("+o+","+t+")"),n.renderWidth&&(o-=Blockly.BlockSvg.SEP_SPACE_X)):(i.setAttribute("transform","translate("+(o+n.renderSep)+","+t+")"),n.renderWidth&&(o+=n.renderSep+n.renderWidth+Blockly.BlockSvg.SEP_SPACE_X)))}return this.RTL?-o:o},Blockly.BlockSvg.prototype.renderCompute_=function(e){var o=this.inputList,t=[];t.rightEdge=e+2*Blockly.BlockSvg.SEP_SPACE_X,(this.previousConnection||this.nextConnection)&&(t.rightEdge=Math.max(t.rightEdge,Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.SEP_SPACE_X));for(var n,r=0,i=0,s=!1,l=!1,g=!1,a=void 0,c=this.getInputsInline()&&!this.isCollapsed(),u=0;n=o[u];u++)if(n.isVisible()){var h;if(c&&a&&a!=Blockly.NEXT_STATEMENT&&n.type!=Blockly.NEXT_STATEMENT?h=t[t.length-1]:(a=n.type,h=[],h.type=c&&n.type!=Blockly.NEXT_STATEMENT?Blockly.BlockSvg.INLINE:n.type,h.height=0,t.push(h)),h.push(n),n.renderHeight=Blockly.BlockSvg.MIN_BLOCK_Y,n.renderWidth=c&&n.type==Blockly.INPUT_VALUE?Blockly.BlockSvg.TAB_WIDTH+1.25*Blockly.BlockSvg.SEP_SPACE_X:0,n.connection&&n.connection.isConnected()){var d=n.connection.targetBlock().getHeightWidth();n.renderHeight=Math.max(n.renderHeight,d.height),n.renderWidth=Math.max(n.renderWidth,d.width)}c||u!=o.length-1?!c&&n.type==Blockly.INPUT_VALUE&&o[u+1]&&o[u+1].type==Blockly.NEXT_STATEMENT&&n.renderHeight--:n.renderHeight--,h.height=Math.max(h.height,n.renderHeight),n.fieldWidth=0,1==t.length&&(n.fieldWidth+=this.RTL?-e:e);for(var p,d=!1,y=0;p=n.fieldRow[y];y++){0!=y&&(n.fieldWidth+=Blockly.BlockSvg.SEP_SPACE_X);var f=p.getSize();p.renderWidth=f.width,p.renderSep=d&&p.EDITABLE?Blockly.BlockSvg.SEP_SPACE_X:0,n.fieldWidth+=p.renderWidth+p.renderSep,h.height=Math.max(h.height,f.height),d=p.EDITABLE}h.type!=Blockly.BlockSvg.INLINE&&(h.type==Blockly.NEXT_STATEMENT?(l=!0,i=Math.max(i,n.fieldWidth)):(h.type==Blockly.INPUT_VALUE?s=!0:h.type==Blockly.DUMMY_INPUT&&(g=!0),r=Math.max(r,n.fieldWidth)))}for(e=0;h=t[e];e++)if(h.thicker=!1,h.type==Blockly.BlockSvg.INLINE)for(o=0;n=h[o];o++)if(n.type==Blockly.INPUT_VALUE){h.height+=2*Blockly.BlockSvg.INLINE_PADDING_Y,h.thicker=!0;break}return t.statementEdge=2*Blockly.BlockSvg.SEP_SPACE_X+i,l&&(t.rightEdge=Math.max(t.rightEdge,t.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH)),s?t.rightEdge=Math.max(t.rightEdge,r+2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.TAB_WIDTH):g&&(t.rightEdge=Math.max(t.rightEdge,r+2*Blockly.BlockSvg.SEP_SPACE_X)),t.hasValue=s,t.hasStatement=l,t.hasDummy=g,t},Blockly.BlockSvg.prototype.renderDraw_=function(e,o){if(this.startHat_=!1,this.height=0,this.outputConnection)this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!0;else{if(this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!1,this.previousConnection){var t=this.previousConnection.targetBlock();t&&t.getNextBlock()==this&&(this.squareTopLeftCorner_=!0)}else Blockly.BlockSvg.START_HAT&&(this.startHat_=this.squareTopLeftCorner_=!0,this.height+=Blockly.BlockSvg.START_HAT_HEIGHT,o.rightEdge=Math.max(o.rightEdge,100));this.getNextBlock()&&(this.squareBottomLeftCorner_=!0)}var n=[],r=[],t=[],i=[];this.renderDrawTop_(n,t,o.rightEdge);var s=this.renderDrawRight_(n,t,r,i,o,e);this.renderDrawBottom_(n,t,s),this.renderDrawLeft_(n,t),n=n.join(" ")+"\n"+r.join(" "),this.svgPath_.setAttribute("d",n),this.svgPathDark_.setAttribute("d",n),n=t.join(" ")+"\n"+i.join(" "),this.svgPathLight_.setAttribute("d",n),this.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathLight_.setAttribute("transform","scale(-1 1)"),this.svgPathDark_.setAttribute("transform","translate(1,1) scale(-1 1)"))},Blockly.BlockSvg.prototype.renderMoveConnections_=function(){var e=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(e),this.outputConnection&&this.outputConnection.moveToOffset(e);for(var o=0;o<this.inputList.length;o++){var t=this.inputList[o].connection;t&&(t.moveToOffset(e),t.isConnected()&&t.tighten_())}this.nextConnection&&(this.nextConnection.moveToOffset(e),this.nextConnection.isConnected()&&this.nextConnection.tighten_())},Blockly.BlockSvg.prototype.renderDrawTop_=function(e,o,t){this.squareTopLeftCorner_?(e.push("m 0,0"),o.push("m 0.5,0.5"),this.startHat_&&(e.push(Blockly.BlockSvg.START_HAT_PATH),o.push(this.RTL?Blockly.BlockSvg.START_HAT_HIGHLIGHT_RTL:Blockly.BlockSvg.START_HAT_HIGHLIGHT_LTR))):(e.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),o.push(this.RTL?Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL:Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR),e.push(Blockly.BlockSvg.TOP_LEFT_CORNER),o.push(Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT)),this.previousConnection&&(e.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),o.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),e.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),o.push(Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT),this.previousConnection.setOffsetInBlock(this.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:Blockly.BlockSvg.NOTCH_WIDTH,0)),e.push("H",t),o.push("H",t-.5),this.width=t},Blockly.BlockSvg.prototype.renderDrawRight_=function(e,o,t,n,r,i){for(var s,l,g,a,c=0,u=0;a=r[u];u++){if(s=Blockly.BlockSvg.SEP_SPACE_X,0==u&&(s+=this.RTL?-i:i),o.push("M",r.rightEdge-.5+","+(c+.5)),this.isCollapsed()){var h=a[0];l=c,this.renderFields_(h.fieldRow,s,l),e.push(Blockly.BlockSvg.JAGGED_TEETH),o.push("h 8"),h=a.height-Blockly.BlockSvg.JAGGED_TEETH_HEIGHT,e.push("v",h),this.RTL&&(o.push("v 3.9 l 7.2,3.4 m -14.5,8.9 l 7.3,3.5"),o.push("v",h-.7)),this.width+=Blockly.BlockSvg.JAGGED_TEETH_WIDTH}else if(a.type==Blockly.BlockSvg.INLINE){for(var d=0;h=a[d];d++)l=c,a.thicker&&(l+=Blockly.BlockSvg.INLINE_PADDING_Y),s=this.renderFields_(h.fieldRow,s,l),h.type!=Blockly.DUMMY_INPUT&&(s+=h.renderWidth+Blockly.BlockSvg.SEP_SPACE_X),h.type==Blockly.INPUT_VALUE&&(t.push("M",s-Blockly.BlockSvg.SEP_SPACE_X+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y)),t.push("h",Blockly.BlockSvg.TAB_WIDTH-2-h.renderWidth),t.push(Blockly.BlockSvg.TAB_PATH_DOWN),t.push("v",h.renderHeight+1-Blockly.BlockSvg.TAB_HEIGHT),t.push("h",h.renderWidth+2-Blockly.BlockSvg.TAB_WIDTH),t.push("z"),this.RTL?(n.push("M",s-Blockly.BlockSvg.SEP_SPACE_X-2.5+Blockly.BlockSvg.TAB_WIDTH-h.renderWidth+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y+.5)),n.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),n.push("v",h.renderHeight-Blockly.BlockSvg.TAB_HEIGHT+2.5),n.push("h",h.renderWidth-Blockly.BlockSvg.TAB_WIDTH+2)):(n.push("M",s-Blockly.BlockSvg.SEP_SPACE_X+.5+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y+.5)),n.push("v",h.renderHeight+1),n.push("h",Blockly.BlockSvg.TAB_WIDTH-2-h.renderWidth),n.push("M",s-h.renderWidth-Blockly.BlockSvg.SEP_SPACE_X+.9+","+(c+Blockly.BlockSvg.INLINE_PADDING_Y+Blockly.BlockSvg.TAB_HEIGHT-.7)),n.push("l",.46*Blockly.BlockSvg.TAB_WIDTH+",-2.1")),l=this.RTL?-s-Blockly.BlockSvg.TAB_WIDTH+Blockly.BlockSvg.SEP_SPACE_X+h.renderWidth+1:s+Blockly.BlockSvg.TAB_WIDTH-Blockly.BlockSvg.SEP_SPACE_X-h.renderWidth-1,g=c+Blockly.BlockSvg.INLINE_PADDING_Y+1,h.connection.setOffsetInBlock(l,g));s=Math.max(s,r.rightEdge),this.width=Math.max(this.width,s),e.push("H",s),o.push("H",s-.5),e.push("v",a.height),this.RTL&&o.push("v",a.height-1)}else a.type==Blockly.INPUT_VALUE?(h=a[0],l=c,h.align!=Blockly.ALIGN_LEFT&&(d=r.rightEdge-h.fieldWidth-Blockly.BlockSvg.TAB_WIDTH-2*Blockly.BlockSvg.SEP_SPACE_X,h.align==Blockly.ALIGN_RIGHT?s+=d:h.align==Blockly.ALIGN_CENTRE&&(s+=d/2)),this.renderFields_(h.fieldRow,s,l),e.push(Blockly.BlockSvg.TAB_PATH_DOWN),d=a.height-Blockly.BlockSvg.TAB_HEIGHT,e.push("v",d),this.RTL?(o.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),o.push("v",d+.5)):(o.push("M",r.rightEdge-5+","+(c+Blockly.BlockSvg.TAB_HEIGHT-.7)),o.push("l",.46*Blockly.BlockSvg.TAB_WIDTH+",-2.1")),l=this.RTL?-r.rightEdge-1:r.rightEdge+1,h.connection.setOffsetInBlock(l,c),h.connection.isConnected()&&(this.width=Math.max(this.width,r.rightEdge+h.connection.targetBlock().getHeightWidth().width-Blockly.BlockSvg.TAB_WIDTH+1))):a.type==Blockly.DUMMY_INPUT?(h=a[0],l=c,h.align!=Blockly.ALIGN_LEFT&&(d=r.rightEdge-h.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,r.hasValue&&(d-=Blockly.BlockSvg.TAB_WIDTH),h.align==Blockly.ALIGN_RIGHT?s+=d:h.align==Blockly.ALIGN_CENTRE&&(s+=d/2)),this.renderFields_(h.fieldRow,s,l),e.push("v",a.height),this.RTL&&o.push("v",a.height-1)):a.type==Blockly.NEXT_STATEMENT&&(h=a[0],0==u&&(e.push("v",Blockly.BlockSvg.SEP_SPACE_Y),this.RTL&&o.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c+=Blockly.BlockSvg.SEP_SPACE_Y),l=c,h.align!=Blockly.ALIGN_LEFT&&(d=r.statementEdge-h.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,h.align==Blockly.ALIGN_RIGHT?s+=d:h.align==Blockly.ALIGN_CENTRE&&(s+=d/2)),this.renderFields_(h.fieldRow,s,l),s=r.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH,e.push("H",s),e.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER),e.push("v",a.height-2*Blockly.BlockSvg.CORNER_RADIUS),e.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER),e.push("H",r.rightEdge),this.RTL?(o.push("M",s-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(c+Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),o.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),o.push("v",a.height-2*Blockly.BlockSvg.CORNER_RADIUS),o.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL)):(o.push("M",s-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(c+a.height-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),o.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR)),o.push("H",r.rightEdge-.5),l=this.RTL?-s:s+1,h.connection.setOffsetInBlock(l,c+1),h.connection.isConnected()&&(this.width=Math.max(this.width,r.statementEdge+h.connection.targetBlock().getHeightWidth().width)),u==r.length-1||r[u+1].type==Blockly.NEXT_STATEMENT)&&(e.push("v",Blockly.BlockSvg.SEP_SPACE_Y),this.RTL&&o.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),c+=Blockly.BlockSvg.SEP_SPACE_Y);c+=a.height}return r.length||(c=Blockly.BlockSvg.MIN_BLOCK_Y,e.push("V",c),this.RTL&&o.push("V",c-1)),c},Blockly.BlockSvg.prototype.renderDrawBottom_=function(e,o,t){this.height+=t+1,this.nextConnection&&(e.push("H",Blockly.BlockSvg.NOTCH_WIDTH+(this.RTL?.5:-.5)+" "+Blockly.BlockSvg.NOTCH_PATH_RIGHT),this.nextConnection.setOffsetInBlock(this.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:Blockly.BlockSvg.NOTCH_WIDTH,t+1),this.height+=4),this.squareBottomLeftCorner_?(e.push("H 0"),this.RTL||o.push("M","0.5,"+(t-.5))):(e.push("H",Blockly.BlockSvg.CORNER_RADIUS),e.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS),this.RTL||(o.push("M",Blockly.BlockSvg.DISTANCE_45_INSIDE+","+(t-Blockly.BlockSvg.DISTANCE_45_INSIDE)),o.push("A",Blockly.BlockSvg.CORNER_RADIUS-.5+","+(Blockly.BlockSvg.CORNER_RADIUS-.5)+" 0 0,1 0.5,"+(t-Blockly.BlockSvg.CORNER_RADIUS))))},Blockly.BlockSvg.prototype.renderDrawLeft_=function(e,o){this.outputConnection?(this.outputConnection.setOffsetInBlock(0,0),e.push("V",Blockly.BlockSvg.TAB_HEIGHT),e.push("c 0,-10 -"+Blockly.BlockSvg.TAB_WIDTH+",8 -"+Blockly.BlockSvg.TAB_WIDTH+",-7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",2.5 "+Blockly.BlockSvg.TAB_WIDTH+",-7.5"),this.RTL?(o.push("M",-.25*Blockly.BlockSvg.TAB_WIDTH+",8.4"),o.push("l",-.45*Blockly.BlockSvg.TAB_WIDTH+",-2.1")):(o.push("V",Blockly.BlockSvg.TAB_HEIGHT-1.5),o.push("m",-.92*Blockly.BlockSvg.TAB_WIDTH+",-0.5 q "+-.19*Blockly.BlockSvg.TAB_WIDTH+",-5.5 0,-11"),o.push("m",.92*Blockly.BlockSvg.TAB_WIDTH+",1 V 0.5 H 1")),this.width+=Blockly.BlockSvg.TAB_WIDTH):this.RTL||(this.squareTopLeftCorner_?o.push("V",.5):o.push("V",Blockly.BlockSvg.CORNER_RADIUS)),e.push("z")},Blockly.Events={},Blockly.Events.group_="",Blockly.Events.recordUndo=!0,Blockly.Events.disabled_=0,Blockly.Events.CREATE="create",Blockly.Events.DELETE="delete",Blockly.Events.CHANGE="change",Blockly.Events.MOVE="move",Blockly.Events.UI="ui",Blockly.Events.FIRE_QUEUE_=[],Blockly.Events.fire=function(e){Blockly.Events.isEnabled()&&(Blockly.Events.FIRE_QUEUE_.length||setTimeout(Blockly.Events.fireNow_,0),Blockly.Events.FIRE_QUEUE_.push(e))},Blockly.Events.fireNow_=function(){for(var e,o=Blockly.Events.filter(Blockly.Events.FIRE_QUEUE_,!0),t=Blockly.Events.FIRE_QUEUE_.length=0;e=o[t];t++){var n=Blockly.Workspace.getById(e.workspaceId);n&&n.fireChangeListener(e)}},Blockly.Events.filter=function(e,o){var t=goog.array.clone(e);o||t.reverse();for(var n,r=0;n=t[r];r++)for(var i,s=r+1;i=t[s];s++)n.type==i.type&&n.blockId==i.blockId&&n.workspaceId==i.workspaceId&&(n.type==Blockly.Events.MOVE?(n.newParentId=i.newParentId,n.newInputName=i.newInputName,n.newCoordinate=i.newCoordinate,t.splice(s,1),s--):n.type==Blockly.Events.CHANGE&&n.element==i.element&&n.name==i.name?(n.newValue=i.newValue,t.splice(s,1),s--):n.type!=Blockly.Events.UI||"click"!=i.element||"commentOpen"!=n.element&&"mutatorOpen"!=n.element&&"warningOpen"!=n.element||(n.newValue=i.newValue,t.splice(s,1),s--));for(r=t.length-1;r>=0;r--)t[r].isNull()&&t.splice(r,1);for(o||t.reverse(),r=1;n=t[r];r++)n.type==Blockly.Events.CHANGE&&"mutation"==n.element&&t.unshift(t.splice(r,1)[0]);return t},Blockly.Events.clearPendingUndo=function(){for(var e,o=0;e=Blockly.Events.FIRE_QUEUE_[o];o++)e.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(e){Blockly.Events.group_="boolean"==typeof e?e?Blockly.genUid():"":e},Blockly.Events.getDescendantIds_=function(e){var o=[];e=e.getDescendants();for(var t,n=0;t=e[n];n++)o[n]=t.id;return o},Blockly.Events.fromJson=function(e,o){var t;switch(e.type){case Blockly.Events.CREATE:t=new Blockly.Events.Create(null);break;case Blockly.Events.DELETE:t=new Blockly.Events.Delete(null);break;case Blockly.Events.CHANGE:t=new Blockly.Events.Change(null);break;case Blockly.Events.MOVE:t=new Blockly.Events.Move(null);break;case Blockly.Events.UI:t=new Blockly.Events.Ui(null);break;default:throw"Unknown event type."}return t.fromJson(e),t.workspaceId=o.id,t},Blockly.Events.Abstract=function(e){e&&(this.blockId=e.id,this.workspaceId=e.workspace.id),this.group=Blockly.Events.group_,this.recordUndo=Blockly.Events.recordUndo},Blockly.Events.Abstract.prototype.toJson=function(){var e={type:this.type};return this.blockId&&(e.blockId=this.blockId),this.group&&(e.group=this.group),e},Blockly.Events.Abstract.prototype.fromJson=function(e){this.blockId=e.blockId,this.group=e.group},Blockly.Events.Abstract.prototype.isNull=function(){return!1},Blockly.Events.Abstract.prototype.run=function(e){},Blockly.Events.Create=function(e){e&&(Blockly.Events.Create.superClass_.constructor.call(this,e),this.xml=Blockly.Xml.blockToDomWithXY(e),this.ids=Blockly.Events.getDescendantIds_(e))},goog.inherits(Blockly.Events.Create,Blockly.Events.Abstract),Blockly.Events.Create.prototype.type=Blockly.Events.CREATE,Blockly.Events.Create.prototype.toJson=function(){var e=Blockly.Events.Create.superClass_.toJson.call(this);return e.xml=Blockly.Xml.domToText(this.xml),e.ids=this.ids,e},Blockly.Events.Create.prototype.fromJson=function(e){Blockly.Events.Create.superClass_.fromJson.call(this,e),this.xml=Blockly.Xml.textToDom("<xml>"+e.xml+"</xml>").firstChild,this.ids=e.ids},Blockly.Events.Create.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId);if(e)e=goog.dom.createDom("xml"),e.appendChild(this.xml),Blockly.Xml.domToWorkspace(e,o);else{e=0;for(var t;t=this.ids[e];e++){var n=o.getBlockById(t);n?n.dispose(!1,!1):t==this.blockId&&console.warn("Can't uncreate non-existant block: "+t)}}},Blockly.Events.Delete=function(e){if(e){if(e.getParent())throw"Connected blocks cannot be deleted.";Blockly.Events.Delete.superClass_.constructor.call(this,e),this.oldXml=Blockly.Xml.blockToDomWithXY(e),this.ids=Blockly.Events.getDescendantIds_(e)}},goog.inherits(Blockly.Events.Delete,Blockly.Events.Abstract),Blockly.Events.Delete.prototype.type=Blockly.Events.DELETE,Blockly.Events.Delete.prototype.toJson=function(){var e=Blockly.Events.Delete.superClass_.toJson.call(this);return e.ids=this.ids,e},Blockly.Events.Delete.prototype.fromJson=function(e){Blockly.Events.Delete.superClass_.fromJson.call(this,e),this.ids=e.ids},Blockly.Events.Delete.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId);if(e){e=0;for(var t;t=this.ids[e];e++){var n=o.getBlockById(t);n?n.dispose(!1,!1):t==this.blockId&&console.warn("Can't delete non-existant block: "+t)}}else e=goog.dom.createDom("xml"),e.appendChild(this.oldXml),Blockly.Xml.domToWorkspace(e,o)},Blockly.Events.Change=function(e,o,t,n,r){e&&(Blockly.Events.Change.superClass_.constructor.call(this,e),this.element=o,this.name=t,this.oldValue=n,this.newValue=r)},goog.inherits(Blockly.Events.Change,Blockly.Events.Abstract),Blockly.Events.Change.prototype.type=Blockly.Events.CHANGE,Blockly.Events.Change.prototype.toJson=function(){var e=Blockly.Events.Change.superClass_.toJson.call(this);return e.element=this.element,this.name&&(e.name=this.name),e.newValue=this.newValue,e},Blockly.Events.Change.prototype.fromJson=function(e){Blockly.Events.Change.superClass_.fromJson.call(this,e),this.element=e.element,this.name=e.name,this.newValue=e.newValue},Blockly.Events.Change.prototype.isNull=function(){return this.oldValue==this.newValue},Blockly.Events.Change.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId);if(o)switch(o.mutator&&o.mutator.setVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(o=o.getField(this.name))?(o.callValidator(e),o.setValue(e)):console.warn("Can't set non-existant field: "+this.name);break;case"comment":o.setCommentText(e||null);break;case"collapsed":o.setCollapsed(e);break;case"disabled":o.setDisabled(e);break;case"inline":o.setInputsInline(e);break;case"mutation":var t="";if(o.mutationToDom&&(t=(t=o.mutationToDom())&&Blockly.Xml.domToText(t)),o.domToMutation){e=e||"<mutation></mutation>";var n=Blockly.Xml.textToDom("<xml>"+e+"</xml>");o.domToMutation(n.firstChild)}Blockly.Events.fire(new Blockly.Events.Change(o,"mutation",null,t,e));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existant block: "+this.blockId)},Blockly.Events.Move=function(e){e&&(Blockly.Events.Move.superClass_.constructor.call(this,e),e=this.currentLocation_(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)},goog.inherits(Blockly.Events.Move,Blockly.Events.Abstract),Blockly.Events.Move.prototype.type=Blockly.Events.MOVE,Blockly.Events.Move.prototype.toJson=function(){var e=Blockly.Events.Move.superClass_.toJson.call(this);return this.newParentId&&(e.newParentId=this.newParentId),this.newInputName&&(e.newInputName=this.newInputName),this.newCoordinate&&(e.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y)),e},Blockly.Events.Move.prototype.fromJson=function(e){Blockly.Events.Move.superClass_.fromJson.call(this,e),this.newParentId=e.newParentId,this.newInputName=e.newInputName,e.newCoordinate&&(e=e.newCoordinate.split(","),this.newCoordinate=new goog.math.Coordinate(parseFloat(e[0]),parseFloat(e[1])))},Blockly.Events.Move.prototype.recordNew=function(){var e=this.currentLocation_();this.newParentId=e.parentId,this.newInputName=e.inputName,this.newCoordinate=e.coordinate},Blockly.Events.Move.prototype.currentLocation_=function(){var e=Blockly.Workspace.getById(this.workspaceId).getBlockById(this.blockId),o={},t=e.getParent();return t?(o.parentId=t.id,(e=t.getInputWithBlock(e))&&(o.inputName=e.name)):o.coordinate=e.getRelativeToSurfaceXY(),o},Blockly.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&goog.math.Coordinate.equals(this.oldCoordinate,this.newCoordinate)},Blockly.Events.Move.prototype.run=function(e){var o=Blockly.Workspace.getById(this.workspaceId),t=o.getBlockById(this.blockId);if(t){var n=e?this.newParentId:this.oldParentId,r=e?this.newInputName:this.oldInputName;e=e?this.newCoordinate:this.oldCoordinate;var i=null;if(n&&(i=o.getBlockById(n),!i))return void console.warn("Can't connect to non-existant block: "+n);if(t.getParent()&&t.unplug(),e)r=t.getRelativeToSurfaceXY(),t.moveBy(e.x-r.x,e.y-r.y);else{var s,t=t.outputConnection||t.previousConnection;r?(o=i.getInput(r))&&(s=o.connection):t.type==Blockly.PREVIOUS_STATEMENT&&(s=i.nextConnection),s?t.connect(s):console.warn("Can't connect to non-existant input: "+r)}}else console.warn("Can't move non-existant block: "+this.blockId)},Blockly.Events.Ui=function(e,o,t,n){Blockly.Events.Ui.superClass_.constructor.call(this,e),this.element=o,this.oldValue=t,this.newValue=n,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 e=Blockly.Events.Ui.superClass_.toJson.call(this);return e.element=this.element,void 0!==this.newValue&&(e.newValue=this.newValue),e},Blockly.Events.Ui.prototype.fromJson=function(e){Blockly.Events.Ui.superClass_.fromJson.call(this,e),this.element=e.element,this.newValue=e.newValue},Blockly.Events.disableOrphans=function(e){if(e.type==Blockly.Events.MOVE||e.type==Blockly.Events.CREATE){if(Blockly.Events.disable(),e=Blockly.Workspace.getById(e.workspaceId).getBlockById(e.blockId))if(e.getParent()&&!e.getParent().disabled){e=e.getDescendants();for(var o,t=0;o=e[t];t++)o.setDisabled(!1)}else if((e.outputConnection||e.previousConnection)&&Blockly.dragMode_==Blockly.DRAG_NONE)do e.setDisabled(!0),e=e.getNextBlock();while(e);Blockly.Events.enable()}},Blockly.Msg={},goog.getMsgOrig=goog.getMsg,goog.getMsg=function(e,o){var t=goog.getMsg.blocklyMsgMap[e];return t&&(e=Blockly.Msg[t]),goog.getMsgOrig(e,o)},goog.getMsg.blocklyMsgMap={Today:"TODAY"},Blockly.FieldTextInput=function(e,o){Blockly.FieldTextInput.superClass_.constructor.call(this,e,o)},goog.inherits(Blockly.FieldTextInput,Blockly.Field),Blockly.FieldTextInput.FONTSIZE=11,Blockly.FieldTextInput.prototype.CURSOR="text",Blockly.FieldTextInput.prototype.spellcheck_=!0,Blockly.FieldTextInput.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this),Blockly.FieldTextInput.superClass_.dispose.call(this)},Blockly.FieldTextInput.prototype.setValue=function(e){if(null!==e){if(this.sourceBlock_){var o=this.callValidator(e);null!==o&&(e=o)}Blockly.Field.prototype.setValue.call(this,e)}},Blockly.FieldTextInput.prototype.setSpellcheck=function(e){this.spellcheck_=e},Blockly.FieldTextInput.prototype.showEditor_=function(e){if(this.workspace_=this.sourceBlock_.workspace,e=e||!1,!e&&(goog.userAgent.MOBILE||goog.userAgent.ANDROID||goog.userAgent.IPAD)){var o=this;Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.text_,function(e){o.sourceBlock_&&(e=o.callValidator(e)),o.setValue(e)})}else{Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_());var t=Blockly.WidgetDiv.DIV,n=goog.dom.createDom("INPUT","blocklyHtmlInput");n.setAttribute("spellcheck",this.spellcheck_);var r=Blockly.FieldTextInput.FONTSIZE*this.workspace_.scale+"pt";t.style.fontSize=r,n.style.fontSize=r,Blockly.FieldTextInput.htmlInput_=n,t.appendChild(n),n.value=n.defaultValue=this.text_,n.oldValue_=null,this.validate_(),this.resizeEditor_(),e||(n.focus(),n.select()),n.onKeyDownWrapper_=Blockly.bindEventWithChecks_(n,"keydown",this,this.onHtmlInputKeyDown_),n.onKeyUpWrapper_=Blockly.bindEventWithChecks_(n,"keyup",this,this.onHtmlInputChange_),n.onKeyPressWrapper_=Blockly.bindEventWithChecks_(n,"keypress",this,this.onHtmlInputChange_),n.onWorkspaceChangeWrapper_=this.resizeEditor_.bind(this),this.workspace_.addChangeListener(n.onWorkspaceChangeWrapper_)}},Blockly.FieldTextInput.prototype.onHtmlInputKeyDown_=function(e){var o=Blockly.FieldTextInput.htmlInput_;13==e.keyCode?Blockly.WidgetDiv.hide():27==e.keyCode?(o.value=o.defaultValue,Blockly.WidgetDiv.hide()):9==e.keyCode&&(Blockly.WidgetDiv.hide(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())},Blockly.FieldTextInput.prototype.onHtmlInputChange_=function(e){e=Blockly.FieldTextInput.htmlInput_;var o=e.value;o!==e.oldValue_?(e.oldValue_=o,this.setValue(o),this.validate_()):goog.userAgent.WEBKIT&&this.sourceBlock_.render(),this.resizeEditor_(),Blockly.svgResize(this.sourceBlock_.workspace)},Blockly.FieldTextInput.prototype.validate_=function(){var e=!0;goog.asserts.assertObject(Blockly.FieldTextInput.htmlInput_);var o=Blockly.FieldTextInput.htmlInput_;this.sourceBlock_&&(e=this.callValidator(o.value)),null===e?Blockly.addClass_(o,"blocklyInvalidInput"):Blockly.removeClass_(o,"blocklyInvalidInput")},Blockly.FieldTextInput.prototype.resizeEditor_=function(){var e=Blockly.WidgetDiv.DIV,o=this.fieldGroup_.getBBox();if(e.style.width=o.width*this.workspace_.scale+"px",e.style.height=o.height*this.workspace_.scale+"px",o=this.getAbsoluteXY_(),this.sourceBlock_.RTL){var t=this.getScaledBBox_();o.x+=t.width,o.x-=e.offsetWidth}o.y+=1,goog.userAgent.GECKO&&Blockly.WidgetDiv.DIV.style.top&&(--o.x,--o.y),goog.userAgent.WEBKIT&&(o.y-=3),e.style.left=o.x+"px",e.style.top=o.y+"px"},Blockly.FieldTextInput.prototype.widgetDispose_=function(){var e=this;return function(){var o=Blockly.FieldTextInput.htmlInput_,t=o.value;e.sourceBlock_&&(t=e.callValidator(t),null===t?t=o.defaultValue:e.onFinishEditing_&&e.onFinishEditing_(t)),e.setValue(t),e.sourceBlock_.rendered&&e.sourceBlock_.render(),Blockly.unbindEvent_(o.onKeyDownWrapper_),Blockly.unbindEvent_(o.onKeyUpWrapper_),Blockly.unbindEvent_(o.onKeyPressWrapper_),e.workspace_.removeChangeListener(o.onWorkspaceChangeWrapper_),Blockly.FieldTextInput.htmlInput_=null,o=Blockly.WidgetDiv.DIV.style,o.width="auto",o.height="auto",o.fontSize=""}},Blockly.FieldTextInput.numberValidator=function(e){return console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead."),null===e?null:(e=String(e),e=e.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=parseFloat(e||0),isNaN(e)?null:String(e))},Blockly.FieldTextInput.nonnegativeIntegerValidator=function(e){return(e=Blockly.FieldTextInput.numberValidator(e))&&(e=String(Math.max(0,Math.floor(e)))),e},Blockly.FieldAngle=function(e,o){this.symbol_=Blockly.createSvgElement("tspan",{},null),this.symbol_.appendChild(document.createTextNode("°")),Blockly.FieldAngle.superClass_.constructor.call(this,e,o)},goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput),Blockly.FieldAngle.ROUND=15,Blockly.FieldAngle.HALF=50,Blockly.FieldAngle.CLOCKWISE=!1,Blockly.FieldAngle.OFFSET=0,Blockly.FieldAngle.WRAP=360,Blockly.FieldAngle.RADIUS=Blockly.FieldAngle.HALF-1,Blockly.FieldAngle.prototype.dispose_=function(){var e=this;return function(){Blockly.FieldAngle.superClass_.dispose_.call(e)(),e.gauge_=null,e.clickWrapper_&&Blockly.unbindEvent_(e.clickWrapper_),e.moveWrapper1_&&Blockly.unbindEvent_(e.moveWrapper1_),e.moveWrapper2_&&Blockly.unbindEvent_(e.moveWrapper2_)}},Blockly.FieldAngle.prototype.showEditor_=function(){Blockly.FieldAngle.superClass_.showEditor_.call(this,goog.userAgent.MOBILE||goog.userAgent.ANDROID||goog.userAgent.IPAD);var e=Blockly.WidgetDiv.DIV;if(e.firstChild){var e=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml",
     20"xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",height:2*Blockly.FieldAngle.HALF+"px",width:2*Blockly.FieldAngle.HALF+"px"},e),o=Blockly.createSvgElement("circle",{cx:Blockly.FieldAngle.HALF,cy:Blockly.FieldAngle.HALF,r:Blockly.FieldAngle.RADIUS,"class":"blocklyAngleCircle"},e);this.gauge_=Blockly.createSvgElement("path",{"class":"blocklyAngleGauge"},e),this.line_=Blockly.createSvgElement("line",{x1:Blockly.FieldAngle.HALF,y1:Blockly.FieldAngle.HALF,"class":"blocklyAngleLine"},e);for(var t=0;360>t;t+=15)Blockly.createSvgElement("line",{x1:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS,y1:Blockly.FieldAngle.HALF,x2:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS-(0==t%45?10:5),y2:Blockly.FieldAngle.HALF,"class":"blocklyAngleMarks",transform:"rotate("+t+","+Blockly.FieldAngle.HALF+","+Blockly.FieldAngle.HALF+")"},e);e.style.marginLeft=15-Blockly.FieldAngle.RADIUS+"px",this.clickWrapper_=Blockly.bindEvent_(e,"click",this,Blockly.WidgetDiv.hide),this.moveWrapper1_=Blockly.bindEvent_(o,"mousemove",this,this.onMouseMove),this.moveWrapper2_=Blockly.bindEvent_(this.gauge_,"mousemove",this,this.onMouseMove),this.updateGraph_()}},Blockly.FieldAngle.prototype.onMouseMove=function(e){var o=this.gauge_.ownerSVGElement.getBoundingClientRect(),t=e.clientX-o.left-Blockly.FieldAngle.HALF;e=e.clientY-o.top-Blockly.FieldAngle.HALF,o=Math.atan(-e/t),isNaN(o)||(o=goog.math.toDegrees(o),0>t?o+=180:e>0&&(o+=360),o=Blockly.FieldAngle.CLOCKWISE?Blockly.FieldAngle.OFFSET+360-o:o-Blockly.FieldAngle.OFFSET,Blockly.FieldAngle.ROUND&&(o=Math.round(o/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND),o=this.callValidator(o),Blockly.FieldTextInput.htmlInput_.value=o,this.setValue(o),this.validate_(),this.resizeEditor_())},Blockly.FieldAngle.prototype.setText=function(e){Blockly.FieldAngle.superClass_.setText.call(this,e),this.textElement_&&(this.updateGraph_(),this.sourceBlock_.RTL?this.textElement_.insertBefore(this.symbol_,this.textElement_.firstChild):this.textElement_.appendChild(this.symbol_),this.size_.width=0)},Blockly.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var e=Number(this.getText())+Blockly.FieldAngle.OFFSET,o=goog.math.toRadians(e),e=["M ",Blockly.FieldAngle.HALF,",",Blockly.FieldAngle.HALF],t=Blockly.FieldAngle.HALF,n=Blockly.FieldAngle.HALF;if(!isNaN(o)){var r=goog.math.toRadians(Blockly.FieldAngle.OFFSET),i=Math.cos(r)*Blockly.FieldAngle.RADIUS,s=Math.sin(r)*-Blockly.FieldAngle.RADIUS;Blockly.FieldAngle.CLOCKWISE&&(o=2*r-o),t+=Math.cos(o)*Blockly.FieldAngle.RADIUS,n-=Math.sin(o)*Blockly.FieldAngle.RADIUS,o=Math.abs(Math.floor((o-r)/Math.PI)%2),Blockly.FieldAngle.CLOCKWISE&&(o=1-o),e.push(" l ",i,",",s," A ",Blockly.FieldAngle.RADIUS,",",Blockly.FieldAngle.RADIUS," 0 ",o," ",Number(Blockly.FieldAngle.CLOCKWISE)," ",t,",",n," z")}this.gauge_.setAttribute("d",e.join("")),this.line_.setAttribute("x2",t),this.line_.setAttribute("y2",n)}},Blockly.FieldAngle.prototype.classValidator=function(e){return null===e?null:(e=parseFloat(e||0),isNaN(e)?null:(e%=360,0>e&&(e+=360),e>Blockly.FieldAngle.WRAP&&(e-=360),String(e)))},Blockly.FieldCheckbox=function(e,o){Blockly.FieldCheckbox.superClass_.constructor.call(this,"",o),this.setValue(e)},goog.inherits(Blockly.FieldCheckbox,Blockly.Field),Blockly.FieldCheckbox.CHECK_CHAR="✓",Blockly.FieldCheckbox.prototype.CURSOR="default",Blockly.FieldCheckbox.prototype.init=function(){if(!this.fieldGroup_){Blockly.FieldCheckbox.superClass_.init.call(this),this.checkElement_=Blockly.createSvgElement("text",{"class":"blocklyText blocklyCheckbox",x:-3,y:14},this.fieldGroup_);var e=document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);this.checkElement_.appendChild(e),this.checkElement_.style.display=this.state_?"block":"none"}},Blockly.FieldCheckbox.prototype.getValue=function(){return String(this.state_).toUpperCase()},Blockly.FieldCheckbox.prototype.setValue=function(e){e="TRUE"==e.toUpperCase(),this.state_!==e&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.state_,e)),this.state_=e,this.checkElement_&&(this.checkElement_.style.display=e?"block":"none"))},Blockly.FieldCheckbox.prototype.showEditor_=function(){var e=!this.state_;this.sourceBlock_&&(e=this.callValidator(e)),null!==e&&this.setValue(String(e).toUpperCase())},Blockly.FieldColour=function(e,o){Blockly.FieldColour.superClass_.constructor.call(this,e,o),this.setText(Blockly.Field.NBSP+Blockly.Field.NBSP+Blockly.Field.NBSP)},goog.inherits(Blockly.FieldColour,Blockly.Field),Blockly.FieldColour.prototype.colours_=null,Blockly.FieldColour.prototype.columns_=0,Blockly.FieldColour.prototype.init=function(){Blockly.FieldColour.superClass_.init.call(this),this.borderRect_.style.fillOpacity=1,this.setValue(this.getValue())},Blockly.FieldColour.prototype.CURSOR="default",Blockly.FieldColour.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this),Blockly.FieldColour.superClass_.dispose.call(this)},Blockly.FieldColour.prototype.getValue=function(){return this.colour_},Blockly.FieldColour.prototype.setValue=function(e){this.sourceBlock_&&Blockly.Events.isEnabled()&&this.colour_!=e&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.colour_,e)),this.colour_=e,this.borderRect_&&(this.borderRect_.style.fill=e)},Blockly.FieldColour.prototype.getText=function(){var e=this.colour_,o=e.match(/^#(.)\1(.)\2(.)\3$/);return o&&(e="#"+o[1]+o[2]+o[3]),e},Blockly.FieldColour.COLOURS=goog.ui.ColorPicker.SIMPLE_GRID_COLORS,Blockly.FieldColour.COLUMNS=7,Blockly.FieldColour.prototype.setColours=function(e){return this.colours_=e,this},Blockly.FieldColour.prototype.setColumns=function(e){return this.columns_=e,this},Blockly.FieldColour.prototype.showEditor_=function(){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,Blockly.FieldColour.widgetDispose_);var e=new goog.ui.ColorPicker;e.setSize(this.columns_||Blockly.FieldColour.COLUMNS),e.setColors(this.colours_||Blockly.FieldColour.COLOURS);var o=goog.dom.getViewportSize(),t=goog.style.getViewportPageOffset(document),n=this.getAbsoluteXY_(),r=this.getScaledBBox_();e.render(Blockly.WidgetDiv.DIV),e.setSelectedColor(this.getValue());var i=goog.style.getSize(e.getElement());n.y=n.y+i.height+r.height>=o.height+t.y?n.y-(i.height-1):n.y+(r.height-1),this.sourceBlock_.RTL?(n.x+=r.width,n.x-=i.width,n.x<t.x&&(n.x=t.x)):n.x>o.width+t.x-i.width&&(n.x=o.width+t.x-i.width),Blockly.WidgetDiv.position(n.x,n.y,o,t,this.sourceBlock_.RTL);var s=this;Blockly.FieldColour.changeEventKey_=goog.events.listen(e,goog.ui.ColorPicker.EventType.CHANGE,function(e){e=e.target.getSelectedColor()||"#000000",Blockly.WidgetDiv.hide(),s.sourceBlock_&&(e=s.callValidator(e)),null!==e&&s.setValue(e)})},Blockly.FieldColour.widgetDispose_=function(){Blockly.FieldColour.changeEventKey_&&goog.events.unlistenByKey(Blockly.FieldColour.changeEventKey_)},Blockly.FieldDropdown=function(e,o){this.menuGenerator_=e,this.trimOptions_();var t=this.getOptions_()[0];Blockly.FieldDropdown.superClass_.constructor.call(this,t[1],o)},goog.inherits(Blockly.FieldDropdown,Blockly.Field),Blockly.FieldDropdown.CHECKMARK_OVERHANG=25,Blockly.FieldDropdown.ARROW_CHAR=goog.userAgent.ANDROID?"▼":"▾",Blockly.FieldDropdown.prototype.CURSOR="default",Blockly.FieldDropdown.prototype.value_="",Blockly.FieldDropdown.prototype.init=function(){if(!this.fieldGroup_){this.arrow_=Blockly.createSvgElement("tspan",{},null),this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR)),Blockly.FieldDropdown.superClass_.init.call(this);var e=this.text_;this.text_=null,this.setText(e)}},Blockly.FieldDropdown.prototype.showEditor_=function(){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,null);var e=this,o=new goog.ui.Menu;o.setRightToLeft(this.sourceBlock_.RTL);for(var t=this.getOptions_(),n=0;n<t.length;n++){var r=t[n][1],i=new goog.ui.MenuItem(t[n][0]);i.setRightToLeft(this.sourceBlock_.RTL),i.setValue(r),i.setCheckable(!0),o.addChild(i,!0),i.setChecked(r==this.value_)}goog.events.listen(o,goog.ui.Component.EventType.ACTION,function(o){(o=o.target)&&e.onItemSelected(this,o),Blockly.WidgetDiv.hideIfOwner(e)}),o.getHandler().listen(o.getElement(),goog.events.EventType.TOUCHSTART,function(e){this.getOwnerControl(e.target).handleMouseDown(e)}),o.getHandler().listen(o.getElement(),goog.events.EventType.TOUCHEND,function(e){this.getOwnerControl(e.target).performActionInternal(e)}),t=goog.dom.getViewportSize(),n=goog.style.getViewportPageOffset(document),r=this.getAbsoluteXY_(),i=this.getScaledBBox_(),o.render(Blockly.WidgetDiv.DIV);var s=o.getElement();Blockly.addClass_(s,"blocklyDropdownMenu");var l=goog.style.getSize(s);l.height=s.scrollHeight,r.y=r.y+l.height+i.height>=t.height+n.y?r.y-(l.height+2):r.y+i.height,this.sourceBlock_.RTL?(r.x+=i.width,r.x+=Blockly.FieldDropdown.CHECKMARK_OVERHANG,r.x<n.x+l.width&&(r.x=n.x+l.width)):(r.x-=Blockly.FieldDropdown.CHECKMARK_OVERHANG,r.x>t.width+n.x-l.width&&(r.x=t.width+n.x-l.width)),Blockly.WidgetDiv.position(r.x,r.y,t,n,this.sourceBlock_.RTL),o.setAllowAutoFocus(!0),s.focus()},Blockly.FieldDropdown.prototype.onItemSelected=function(e,o){var t=o.getValue();this.sourceBlock_&&(t=this.callValidator(t)),null!==t&&this.setValue(t)},Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.prefixField=null;var e=this.menuGenerator_;if(goog.isArray(e)&&!(2>e.length)){var o=e.map(function(e){return e[0]}),t=Blockly.shortestStringLength(o),n=Blockly.commonWordPrefix(o,t),r=Blockly.commonWordSuffix(o,t);if((n||r)&&!(n+r>=t)){for(n&&(this.prefixField=o[0].substring(0,n-1)),r&&(this.suffixField=o[0].substr(1-r)),o=[],t=0;t<e.length;t++){var i=e[t][0],s=e[t][1],i=i.substring(n,i.length-r);o[t]=[i,s]}this.menuGenerator_=o}}},Blockly.FieldDropdown.prototype.getOptions_=function(){return goog.isFunction(this.menuGenerator_)?this.menuGenerator_.call(this):this.menuGenerator_},Blockly.FieldDropdown.prototype.getValue=function(){return this.value_},Blockly.FieldDropdown.prototype.setValue=function(e){if(null!==e&&e!==this.value_){this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,e)),this.value_=e;for(var o=this.getOptions_(),t=0;t<o.length;t++)if(o[t][1]==e)return void this.setText(o[t][0]);this.setText(e)}},Blockly.FieldDropdown.prototype.setText=function(e){this.sourceBlock_&&this.arrow_&&(this.arrow_.style.fill=this.sourceBlock_.getColour()),null!==e&&e!==this.text_&&(this.text_=e,this.updateTextNode_(),this.textElement_&&(this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textElement_.firstChild):this.textElement_.appendChild(this.arrow_)),this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()))},Blockly.FieldDropdown.prototype.dispose=function(){Blockly.WidgetDiv.hideIfOwner(this),Blockly.FieldDropdown.superClass_.dispose.call(this)},Blockly.FieldImage=function(e,o,t,n){this.sourceBlock_=null,this.height_=Number(t),this.width_=Number(o),this.size_=new goog.math.Size(this.width_,this.height_+2*Blockly.BlockSvg.INLINE_PADDING_Y),this.text_=n||"",this.setValue(e)},goog.inherits(Blockly.FieldImage,Blockly.Field),Blockly.FieldImage.prototype.rectElement_=null,Blockly.FieldImage.prototype.EDITABLE=!1,Blockly.FieldImage.prototype.init=function(){if(!this.fieldGroup_){this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.visible_||(this.fieldGroup_.style.display="none"),this.imageElement_=Blockly.createSvgElement("image",{height:this.height_+"px",width:this.width_+"px"},this.fieldGroup_),this.setValue(this.src_),goog.userAgent.GECKO&&(this.rectElement_=Blockly.createSvgElement("rect",{height:this.height_+"px",width:this.width_+"px","fill-opacity":0},this.fieldGroup_)),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);var e=this.rectElement_||this.imageElement_;e.tooltip=this.sourceBlock_,Blockly.Tooltip.bindMouseEvents(e)}},Blockly.FieldImage.prototype.dispose=function(){goog.dom.removeNode(this.fieldGroup_),this.rectElement_=this.imageElement_=this.fieldGroup_=null},Blockly.FieldImage.prototype.setTooltip=function(e){(this.rectElement_||this.imageElement_).tooltip=e},Blockly.FieldImage.prototype.getValue=function(){return this.src_},Blockly.FieldImage.prototype.setValue=function(e){null!==e&&(this.src_=e,this.imageElement_&&this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",goog.isString(e)?e:""))},Blockly.FieldImage.prototype.setText=function(e){null!==e&&(this.text_=e)},Blockly.FieldImage.prototype.render_=function(){},Blockly.FieldNumber=function(e,o,t,n,r){e=String(e),Blockly.FieldNumber.superClass_.constructor.call(this,e,r),this.setConstraints(o,t,n)},goog.inherits(Blockly.FieldNumber,Blockly.FieldTextInput),Blockly.FieldNumber.prototype.setConstraints=function(e,o,t){t=parseFloat(t),this.precision_=isNaN(t)?0:t,e=parseFloat(e),this.min_=isNaN(e)?-(1/0):e,o=parseFloat(o),this.max_=isNaN(o)?1/0:o,this.setValue(this.callValidator(this.getValue()))},Blockly.FieldNumber.prototype.classValidator=function(e){return null===e?null:(e=String(e),e=e.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=parseFloat(e||0),isNaN(e)?null:(this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),e=goog.math.clamp(e,this.min_,this.max_),String(e)))},Blockly.FieldVariable=function(e,o){Blockly.FieldVariable.superClass_.constructor.call(this,Blockly.FieldVariable.dropdownCreate,o),this.setValue(e||"")},goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown),Blockly.FieldVariable.prototype.renameVarItemIndex_=-1,Blockly.FieldVariable.prototype.deleteVarItemIndex_=-1,Blockly.FieldVariable.prototype.init=function(){this.fieldGroup_||(Blockly.FieldVariable.superClass_.init.call(this),this.getValue()||this.setValue(Blockly.Variables.generateUniqueName(this.sourceBlock_.isInFlyout?this.sourceBlock_.workspace.targetWorkspace:this.sourceBlock_.workspace)),this.sourceBlock_.isInFlyout||this.sourceBlock_.workspace.createVariable(this.getValue()))},Blockly.FieldVariable.prototype.setSourceBlock=function(e){goog.asserts.assert(!e.isShadow(),"Variable fields are not allowed to exist on shadow blocks."),Blockly.FieldVariable.superClass_.setSourceBlock.call(this,e)},Blockly.FieldVariable.prototype.getValue=function(){return this.getText()},Blockly.FieldVariable.prototype.setValue=function(e){this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_,"field",this.name,this.value_,e)),this.value_=e,this.setText(e)},Blockly.FieldVariable.dropdownCreate=function(){var e=this.sourceBlock_&&this.sourceBlock_.workspace?this.sourceBlock_.workspace.variableList.slice(0):[],o=this.getText();o&&-1==e.indexOf(o)&&e.push(o),e.sort(goog.string.caseInsensitiveCompare),this.renameVarItemIndex_=e.length,e.push(Blockly.Msg.RENAME_VARIABLE),this.deleteVarItemIndex_=e.length,e.push(Blockly.Msg.DELETE_VARIABLE.replace("%1",o));for(var o=[],t=0;t<e.length;t++)o[t]=[e[t],e[t]];return o},Blockly.FieldVariable.prototype.onItemSelected=function(e,o){e.getChildCount();var t=o.getValue();if(this.sourceBlock_){var n=this.sourceBlock_.workspace;if(0<=this.renameVarItemIndex_&&e.getChildAt(this.renameVarItemIndex_)===o){var r=this.getText();return Blockly.hideChaff(),void Blockly.Variables.promptName(Blockly.Msg.RENAME_VARIABLE_TITLE.replace("%1",r),r,function(e){e&&n.renameVariable(r,e)})}if(0<=this.deleteVarItemIndex_&&e.getChildAt(this.deleteVarItemIndex_)===o)return void n.deleteVariable(this.getText());t=this.callValidator(t)}null!==t&&this.setValue(t)},Blockly.FlyoutButton=function(e,o,t,n,r){this.workspace_=e,this.targetWorkspace_=o,this.text_=t,this.position_=new goog.math.Coordinate(0,0),this.callback_=Blockly.flyoutButtonCallbacks_[n],this.isLabel_=r},Blockly.FlyoutButton.MARGIN=5,Blockly.FlyoutButton.prototype.width=0,Blockly.FlyoutButton.prototype.height=0,Blockly.FlyoutButton.prototype.createDom=function(){if(this.svgGroup_=Blockly.createSvgElement("g",{"class":this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton"},this.workspace_.getCanvas()),!this.isLabel_)var e=Blockly.createSvgElement("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);var o=Blockly.createSvgElement("rect",{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.svgGroup_),t=Blockly.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_);return t.textContent=this.text_,this.width=t.getComputedTextLength()+2*Blockly.FlyoutButton.MARGIN,this.height=20,this.isLabel_||(e.setAttribute("width",this.width),e.setAttribute("height",this.height)),o.setAttribute("width",this.width),o.setAttribute("height",this.height),t.setAttribute("x",this.width/2),t.setAttribute("y",this.height-Blockly.FlyoutButton.MARGIN),this.updateTransform_(),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(e,o){this.position_.x=e,this.position_.y=o,this.updateTransform_()},Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_},Blockly.FlyoutButton.prototype.dispose=function(){this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.targetWorkspace_=this.workspace_=null},Blockly.FlyoutButton.prototype.onMouseUp=function(e){e.preventDefault(),e.stopPropagation(),Blockly.Flyout.terminateDrag_(),this.callback_&&this.callback_(this)},Blockly.Flyout=function(e){e.getMetrics=this.getMetrics_.bind(this),e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new Blockly.WorkspaceSvg(e),this.workspace_.isFlyout=!0,this.RTL=!!e.RTL,this.horizontalLayout_=e.horizontalLayout,this.toolboxPosition_=e.toolboxPosition,this.eventWrappers_=[],this.backgroundButtons_=[],this.buttons_=[],this.listeners_=[],this.permanentlyDisabled_=[],this.startDragMouseX_=this.startDragMouseY_=0},Blockly.Flyout.startFlyout_=null,Blockly.Flyout.startDownEvent_=null,Blockly.Flyout.startBlock_=null,Blockly.Flyout.onMouseUpWrapper_=null,Blockly.Flyout.onMouseMoveWrapper_=null,Blockly.Flyout.onMouseMoveBlockWrapper_=null,Blockly.Flyout.prototype.autoClose=!0,Blockly.Flyout.prototype.CORNER_RADIUS=8,Blockly.Flyout.prototype.DRAG_RADIUS=10,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.dragMode_=Blockly.DRAG_NONE,Blockly.Flyout.prototype.dragAngleRange_=70,Blockly.Flyout.prototype.createDom=function(){return this.svgGroup_=Blockly.createSvgElement("g",{"class":"blocklyFlyout"},null),this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.svgGroup_},Blockly.Flyout.prototype.init=function(e){this.targetWorkspace_=e,this.workspace_.targetWorkspace=e,this.scrollbar_=new Blockly.Scrollbar(this.workspace_,this.horizontalLayout_,!1),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.svgGroup_,"mousedown",this,this.onMouseDown_))},Blockly.Flyout.prototype.dispose=function(){this.hide(),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_&&(goog.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.getMetrics_=function(){if(!this.isVisible())return null;try{var e=this.workspace_.getCanvas().getBBox()}catch(o){e={height:0,y:0,width:0,x:0}}var t=this.SCROLLBAR_PADDING,n=this.SCROLLBAR_PADDING;if(this.horizontalLayout_){this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(t=0);var r=this.height_;this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP&&(r-=this.SCROLLBAR_PADDING);var i=this.width_-2*this.SCROLLBAR_PADDING}else n=0,r=this.height_-2*this.SCROLLBAR_PADDING,i=this.width_,this.RTL||(i-=this.SCROLLBAR_PADDING);return{viewHeight:r,viewWidth:i,contentHeight:(e.height+2*this.MARGIN)*this.workspace_.scale,contentWidth:(e.width+2*this.MARGIN)*this.workspace_.scale,viewTop:-this.workspace_.scrollY,viewLeft:-this.workspace_.scrollX,contentTop:e.y,contentLeft:e.x,absoluteTop:t,absoluteLeft:n}},Blockly.Flyout.prototype.setMetrics_=function(e){var o=this.getMetrics_();o&&(!this.horizontalLayout_&&goog.isNumber(e.y)?this.workspace_.scrollY=-o.contentHeight*e.y:this.horizontalLayout_&&goog.isNumber(e.x)&&(this.workspace_.scrollX=-o.contentWidth*e.x),this.workspace_.translate(this.workspace_.scrollX+o.absoluteLeft,this.workspace_.scrollY+o.absoluteTop))},Blockly.Flyout.prototype.position=function(){if(this.isVisible()){var e=this.targetWorkspace_.getMetrics();if(e){this.setBackgroundPath_(this.horizontalLayout_?e.viewWidth-2*this.CORNER_RADIUS:this.width_-this.CORNER_RADIUS,this.horizontalLayout_?this.height_-this.CORNER_RADIUS:e.viewHeight-2*this.CORNER_RADIUS);var o=e.absoluteLeft;this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT&&(o+=e.viewWidth,o-=this.width_);var t=e.absoluteTop;this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(t+=e.viewHeight,t-=this.height_),this.svgGroup_.setAttribute("transform","translate("+o+","+t+")"),this.horizontalLayout_?this.width_=e.viewWidth:this.height_=e.viewHeight,this.scrollbar_&&this.scrollbar_.resize()}}},Blockly.Flyout.prototype.setBackgroundPath_=function(e,o){this.horizontalLayout_?this.setBackgroundPathHorizontal_(e,o):this.setBackgroundPathVertical_(e,o)},Blockly.Flyout.prototype.setBackgroundPathVertical_=function(e,o){var t=this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT,n=e+this.CORNER_RADIUS,n=["M "+(t?n:0)+",0"];n.push("h",t?-e:e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,t?0:1,t?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",Math.max(0,o)),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,t?0:1,t?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",t?e:-e),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))},Blockly.Flyout.prototype.setBackgroundPathHorizontal_=function(e,o){var t=this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP,n=["M 0,"+(t?0:this.CORNER_RADIUS)];t?(n.push("h",e+2*this.CORNER_RADIUS),n.push("v",o),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",-1*e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),n.push("h",e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",o),n.push("h",-e-2*this.CORNER_RADIUS)),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))},Blockly.Flyout.prototype.scrollToStart=function(){this.scrollbar_.set(this.horizontalLayout_&&this.RTL?1/0:0)},Blockly.Flyout.prototype.wheel_=function(e){var o=this.horizontalLayout_?e.deltaX:e.deltaY;if(o){goog.userAgent.GECKO&&(o*=10);var t=this.getMetrics_(),o=this.horizontalLayout_?t.viewLeft+o:t.viewTop+o,o=Math.min(o,this.horizontalLayout_?t.contentWidth-t.viewWidth:t.contentHeight-t.viewHeight),o=Math.max(o,0);this.scrollbar_.set(o)}e.preventDefault(),e.stopPropagation()},Blockly.Flyout.prototype.isVisible=function(){return this.svgGroup_&&"block"==this.svgGroup_.style.display},Blockly.Flyout.prototype.hide=function(){if(this.isVisible()){this.svgGroup_.style.display="none";for(var e,o=0;e=this.listeners_[o];o++)Blockly.unbindEvent_(e);this.listeners_.length=0,this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}},Blockly.Flyout.prototype.flyoutCategory=function(e,o){return e},Blockly.Flyout.prototype.show=function(e){this.hide(),this.clearOldBlocks_(),e=this.flyoutCategory(e,this.workspace_.targetWorkspace),this.svgGroup_.style.display="block";for(var o,t=[],n=[],r=this.permanentlyDisabled_.length=0;o=e[r];r++)if(o.tagName){var i=o.tagName.toUpperCase(),s=this.horizontalLayout_?this.GAP_X:this.GAP_Y;if("BLOCK"==i)i=Blockly.Xml.domToBlock(o,this.workspace_),i.disabled&&this.permanentlyDisabled_.push(i),t.push({type:"block",block:i}),o=parseInt(o.getAttribute("gap"),10),n.push(isNaN(o)?s:o);else if("SEP"==o.tagName.toUpperCase())o=parseInt(o.getAttribute("gap"),10),!isNaN(o)&&0<n.length?n[n.length-1]=o:n.push(s);else if("BUTTON"==i||"LABEL"==i){var i="LABEL"==i,l=o.getAttribute("text");o=o.getAttribute("callbackKey"),o=new Blockly.FlyoutButton(this.workspace_,this.targetWorkspace_,l,o,i),t.push({type:"button",button:o}),n.push(s)}}this.layout_(t,n),this.listeners_.push(Blockly.bindEventWithChecks_(this.svgBackground_,"mouseover",this,function(){for(var e,o=this.workspace_.getTopBlocks(!1),t=0;e=o[t];t++)e.removeSelect()})),this.horizontalLayout_?this.height_=0:this.width_=0,this.reflow(),this.filterForCapacity_(),this.position(),this.reflowWrapper_=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper_)},Blockly.Flyout.prototype.layout_=function(e,o){this.workspace_.scale=this.targetWorkspace_.scale;var t=this.MARGIN,n=this.RTL?t:t+Blockly.BlockSvg.TAB_WIDTH;this.horizontalLayout_&&this.RTL&&(e=e.reverse());for(var r,i=0;r=e[i];i++)if("block"==r.type){r=r.block;for(var s,l=r.getDescendants(),g=0;s=l[g];g++)s.isInFlyout=!0;r.render(),l=r.getSvgRoot(),g=r.getHeightWidth(),s=r.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,this.horizontalLayout_&&(n+=s),r.moveBy(this.horizontalLayout_&&this.RTL?n+g.width-s:n,t),this.horizontalLayout_?n+=g.width+o[i]-s:t+=g.height+o[i],g=Blockly.createSvgElement("rect",{"fill-opacity":0},null),g.tooltip=r,Blockly.Tooltip.bindMouseEvents(g),this.workspace_.getCanvas().insertBefore(g,r.getSvgRoot()),r.flyoutRect_=g,this.backgroundButtons_[i]=g,this.addBlockListeners_(l,r,g)}else"button"==r.type&&(r=r.button,l=r.createDom(),r.moveTo(n,t),r.show(),Blockly.bindEventWithChecks_(l,"mouseup",r,r.onMouseUp),this.buttons_.push(r),this.horizontalLayout_?n+=r.width+o[i]:t+=r.height+o[i])},Blockly.Flyout.prototype.clearOldBlocks_=function(){for(var e,o=this.workspace_.getTopBlocks(!1),t=0;e=o[t];t++)e.workspace==this.workspace_&&e.dispose(!1,!1);for(t=0;o=this.backgroundButtons_[t];t++)goog.dom.removeNode(o);for(t=this.backgroundButtons_.length=0;o=this.buttons_[t];t++)o.dispose();this.buttons_.length=0},Blockly.Flyout.prototype.addBlockListeners_=function(e,o,t){this.listeners_.push(Blockly.bindEventWithChecks_(e,"mousedown",null,this.blockMouseDown_(o))),this.listeners_.push(Blockly.bindEventWithChecks_(t,"mousedown",null,this.blockMouseDown_(o))),this.listeners_.push(Blockly.bindEvent_(e,"mouseover",o,o.addSelect)),this.listeners_.push(Blockly.bindEvent_(e,"mouseout",o,o.removeSelect)),this.listeners_.push(Blockly.bindEvent_(t,"mouseover",o,o.addSelect)),this.listeners_.push(Blockly.bindEvent_(t,"mouseout",o,o.removeSelect))},Blockly.Flyout.blockRightClick_=function(e,o){Blockly.terminateDrag_(),Blockly.hideChaff(!0),o.showContextMenu_(e),Blockly.Touch.clearTouchIdentifier()},Blockly.Flyout.prototype.blockMouseDown_=function(e){var o=this;return function(t){Blockly.isRightButton(t)?Blockly.Flyout.blockRightClick_(t,e):(Blockly.terminateDrag_(),Blockly.hideChaff(!0),Blockly.Css.setCursor(Blockly.Css.Cursor.CLOSED),o.startDragMouseY_=t.clientY,o.startDragMouseX_=t.clientX,Blockly.Flyout.startDownEvent_=t,Blockly.Flyout.startBlock_=e,Blockly.Flyout.startFlyout_=o,Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",o,o.onMouseUp_),Blockly.Flyout.onMouseMoveBlockWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",o,o.onMouseMoveBlock_)),t.stopPropagation(),t.preventDefault()}},Blockly.Flyout.prototype.onMouseDown_=function(e){Blockly.isRightButton(e)?Blockly.Touch.clearTouchIdentifier():(Blockly.hideChaff(!0),this.dragMode_=Blockly.DRAG_FREE,this.startDragMouseY_=e.clientY,this.startDragMouseX_=e.clientX,Blockly.Flyout.startFlyout_=this,Blockly.Flyout.onMouseMoveWrapper_=Blockly.bindEventWithChecks_(document,"mousemove",this,this.onMouseMove_),Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEventWithChecks_(document,"mouseup",this,Blockly.Flyout.terminateDrag_),e.preventDefault(),e.stopPropagation())},Blockly.Flyout.prototype.onMouseUp_=function(e){this.workspace_.isDragging()||(Blockly.Touch.clearTouchIdentifier(),this.autoClose?this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_):Blockly.WidgetDiv.isVisible()||Blockly.Events.fire(new Blockly.Events.Ui(Blockly.Flyout.startBlock_,"click",void 0,void 0))),Blockly.terminateDrag_()},Blockly.Flyout.prototype.onMouseMove_=function(e){var o=this.getMetrics_();if(this.horizontalLayout_){if(!(0>o.contentWidth-o.viewWidth)){var t=e.clientX-this.startDragMouseX_;this.startDragMouseX_=e.clientX,e=o.viewLeft-t,e=goog.math.clamp(e,0,o.contentWidth-o.viewWidth),this.scrollbar_.set(e)}}else 0>o.contentHeight-o.viewHeight||(t=e.clientY-this.startDragMouseY_,this.startDragMouseY_=e.clientY,e=o.viewTop-t,e=goog.math.clamp(e,0,o.contentHeight-o.viewHeight),this.scrollbar_.set(e))},Blockly.Flyout.prototype.onMouseMoveBlock_=function(e){"mousemove"==e.type&&1>=e.clientX&&0==e.clientY&&0==e.button||(this.determineDragIntention_(e.clientX-Blockly.Flyout.startDownEvent_.clientX,e.clientY-Blockly.Flyout.startDownEvent_.clientY)?(Blockly.longStop_(),this.createBlockFunc_(Blockly.Flyout.startBlock_)(Blockly.Flyout.startDownEvent_)):this.dragMode_==Blockly.DRAG_FREE&&(Blockly.longStop_(),this.onMouseMove_(e))),e.stopPropagation()},Blockly.Flyout.prototype.determineDragIntention_=function(e,o){return this.dragMode_==Blockly.DRAG_FREE?!1:Math.sqrt(e*e+o*o)<this.DRAG_RADIUS?(this.dragMode_=Blockly.DRAG_STICKY,!1):this.isDragTowardWorkspace_(e,o)||!this.scrollbar_.isVisible()?!0:(this.dragMode_=Blockly.DRAG_FREE,!1)},Blockly.Flyout.prototype.isDragTowardWorkspace_=function(e,o){var t=Math.atan2(o,e)/Math.PI*180,n=this.dragAngleRange_;if(this.horizontalLayout_){if(90+n>t&&t>90-n||t>-90-n&&-90+n>t)return!0}else if(n>t&&t>-n||-180+n>t||t>180-n)return!0;return!1},Blockly.Flyout.prototype.createBlockFunc_=function(e){var o=this;return function(t){if(!Blockly.isRightButton(t)&&!e.disabled){Blockly.Events.disable();try{var n=o.placeNewBlock_(e)}finally{Blockly.Events.enable()}Blockly.Events.isEnabled()&&(Blockly.Events.setGroup(!0),Blockly.Events.fire(new Blockly.Events.Create(n))),o.autoClose?o.hide():o.filterForCapacity_(),n.onMouseDown_(t),Blockly.dragMode_=Blockly.DRAG_FREE,n.setDragging_(!0),o.targetWorkspace_.setResizesEnabled(!1)}}},Blockly.Flyout.prototype.placeNewBlock_=function(e){var o=this.targetWorkspace_,t=e.getSvgRoot();if(!t)throw"originBlock is not rendered.";var t=Blockly.getSvgXY_(t,o),n=this.workspace_.scrollX,r=this.workspace_.scale;if(t.x+=n/r-n,this.toolboxPosition_==Blockly.TOOLBOX_AT_RIGHT&&(n=o.getMetrics().viewWidth-this.width_,r=o.scale,t.x+=n/r-n),n=this.workspace_.scrollY,r=this.workspace_.scale,t.y+=n/r-n,
    2121this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM&&(n=o.getMetrics().viewHeight-this.height_,r=o.scale,t.y+=n/r-n),e=Blockly.Xml.blockToDom(e),e=Blockly.Xml.domToBlock(e,o),r=e.getSvgRoot(),!r)throw"block is not rendered.";return r=Blockly.getSvgXY_(r,o),r.x+=o.scrollX/o.scale-o.scrollX,r.y+=o.scrollY/o.scale-o.scrollY,o.toolbox_&&!o.scrollbar&&(r.x+=o.toolbox_.getWidth()/o.scale,r.y+=o.toolbox_.getHeight()/o.scale),e.moveBy(t.x-r.x,t.y-r.y),e},Blockly.Flyout.prototype.filterForCapacity_=function(){for(var e,o=this.targetWorkspace_.remainingCapacity(),t=this.workspace_.getTopBlocks(!1),n=0;e=t[n];n++)if(-1==this.permanentlyDisabled_.indexOf(e)){var r=e.getDescendants();e.setDisabled(r.length>o)}},Blockly.Flyout.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var e=this.svgGroup_.getBoundingClientRect(),o=e.left,t=e.top,n=e.width,e=e.height;return this.toolboxPosition_==Blockly.TOOLBOX_AT_TOP?new goog.math.Rect(-1e9,t-1e9,2e9,1e9+e):this.toolboxPosition_==Blockly.TOOLBOX_AT_BOTTOM?new goog.math.Rect(-1e9,t,2e9,1e9+e):this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?new goog.math.Rect(o-1e9,-1e9,1e9+n,2e9):new goog.math.Rect(o,-1e9,1e9+n,2e9)},Blockly.Flyout.terminateDrag_=function(){Blockly.Flyout.startFlyout_&&(Blockly.Flyout.startFlyout_.dragMode_==Blockly.DRAG_FREE&&Blockly.Touch.clearTouchIdentifier(),Blockly.Flyout.startFlyout_.dragMode_=Blockly.DRAG_NONE,Blockly.Flyout.startFlyout_=null),Blockly.Flyout.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),Blockly.Flyout.onMouseUpWrapper_=null),Blockly.Flyout.onMouseMoveBlockWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveBlockWrapper_),Blockly.Flyout.onMouseMoveBlockWrapper_=null),Blockly.Flyout.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveWrapper_),Blockly.Flyout.onMouseMoveWrapper_=null),Blockly.Flyout.startDownEvent_=null,Blockly.Flyout.startBlock_=null},Blockly.Flyout.prototype.reflowHorizontal=function(e){this.workspace_.scale=this.targetWorkspace_.scale;for(var o,t=0,n=0;o=e[n];n++)t=Math.max(t,o.getHeightWidth().height);if(t+=1.5*this.MARGIN,t*=this.workspace_.scale,t+=Blockly.Scrollbar.scrollbarThickness,this.height_!=t){for(n=0;o=e[n];n++){var r=o.getHeightWidth();if(o.flyoutRect_){o.flyoutRect_.setAttribute("width",r.width),o.flyoutRect_.setAttribute("height",r.height);var i=o.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,s=o.getRelativeToSurfaceXY();o.flyoutRect_.setAttribute("y",s.y),o.flyoutRect_.setAttribute("x",this.RTL?s.x-r.width+i:s.x-i),(r=o.startHat_?Blockly.BlockSvg.START_HAT_HEIGHT:0)&&o.moveBy(0,r),o.flyoutRect_.setAttribute("y",s.y)}}this.height_=t,this.targetWorkspace_.resize()}},Blockly.Flyout.prototype.reflowVertical=function(e){this.workspace_.scale=this.targetWorkspace_.scale;for(var o,t=0,n=0;o=e[n];n++){var r=o.getHeightWidth().width;o.outputConnection&&(r-=Blockly.BlockSvg.TAB_WIDTH),t=Math.max(t,r)}for(n=0;o=this.buttons_[n];n++)t=Math.max(t,o.width);if(t+=1.5*this.MARGIN+Blockly.BlockSvg.TAB_WIDTH,t*=this.workspace_.scale,t+=Blockly.Scrollbar.scrollbarThickness,this.width_!=t){for(n=0;o=e[n];n++){if(r=o.getHeightWidth(),this.RTL){var i=o.getRelativeToSurfaceXY().x,s=t/this.workspace_.scale-this.MARGIN,s=s-Blockly.BlockSvg.TAB_WIDTH;o.moveBy(s-i,0)}o.flyoutRect_&&(o.flyoutRect_.setAttribute("width",r.width),o.flyoutRect_.setAttribute("height",r.height),s=o.outputConnection?Blockly.BlockSvg.TAB_WIDTH:0,i=o.getRelativeToSurfaceXY(),o.flyoutRect_.setAttribute("x",this.RTL?i.x-r.width+s:i.x-s),(r=o.startHat_?Blockly.BlockSvg.START_HAT_HEIGHT:0)&&o.moveBy(0,r),o.flyoutRect_.setAttribute("y",i.y))}this.width_=t,this.targetWorkspace_.resize()}},Blockly.Flyout.prototype.reflow=function(){this.reflowWrapper_&&this.workspace_.removeChangeListener(this.reflowWrapper_);var e=this.workspace_.getTopBlocks(!1);this.horizontalLayout_?this.reflowHorizontal(e):this.reflowVertical(e),this.reflowWrapper_&&this.workspace_.addChangeListener(this.reflowWrapper_)},Blockly.Toolbox=function(e){this.workspace_=e,this.RTL=e.options.RTL,this.horizontalLayout_=e.options.horizontalLayout,this.toolboxPosition=e.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+=e.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.treeSeparatorConfig_.cssTreeRow="blocklyTreeSeparatorHorizontal "+(e.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 e=this.workspace_,o=this.workspace_.getParentSvg();this.HtmlDiv=goog.dom.createDom("DIV","blocklyToolboxDiv"),this.HtmlDiv.setAttribute("dir",e.RTL?"RTL":"LTR"),o.parentNode.insertBefore(this.HtmlDiv,o),Blockly.bindEventWithChecks_(this.HtmlDiv,"mousedown",this,function(e){Blockly.isRightButton(e)||e.target==this.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0),Blockly.Touch.clearTouchIdentifier()}),this.flyout_=new Blockly.Flyout({disabledPatternId:e.options.disabledPatternId,parentWorkspace:e,RTL:e.RTL,oneBasedIndex:e.options.oneBasedIndex,horizontalLayout:e.horizontalLayout,toolboxPosition:e.options.toolboxPosition}),goog.dom.insertSiblingAfter(this.flyout_.createDom(),e.svgGroup_),this.flyout_.init(e),this.config_.cleardotPath=e.options.pathToMedia+"1x1.gif",this.config_.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(e.RTL?"Rtl":"Ltr"),this.tree_=o=new Blockly.Toolbox.TreeControl(this,this.config_),o.setShowRootNode(!1),o.setShowLines(!1),o.setShowExpandIcons(!1),o.setSelectedItem(null),e=this.populate_(e.options.languageTree),o.render(this.HtmlDiv),e&&o.setSelectedItem(e),this.addColour_(),this.position()},Blockly.Toolbox.prototype.dispose=function(){this.flyout_.dispose(),this.tree_.dispose(),goog.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 e=this.HtmlDiv;if(e){var o=this.workspace_.getParentSvg();goog.style.getPageOffset(o),o=Blockly.svgSize(o),this.horizontalLayout_?(e.style.left="0",e.style.height="auto",e.style.width=o.width+"px",this.height=e.offsetHeight,this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?e.style.top="0":e.style.bottom="0"):(this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?e.style.right="0":e.style.left="0",e.style.height=o.height+"px",this.width=e.offsetWidth),this.flyout_.position()}},Blockly.Toolbox.prototype.populate_=function(e){if(this.tree_.removeChildren(),this.tree_.blocks=[],this.hasColours_=!1,e=this.syncTrees_(e,this.tree_,this.workspace_.options.pathToMedia),this.tree_.blocks.length)throw"Toolbox cannot have both blocks and categories in the root level.";return this.workspace_.resizeContents(),e},Blockly.Toolbox.prototype.syncTrees_=function(e,o,t){for(var n,r=null,i=null,s=0;n=e.childNodes[s];s++)if(n.tagName)switch(n.tagName.toUpperCase()){case"CATEGORY":i=this.tree_.createNode(n.getAttribute("name")),i.blocks=[],o.add(i);var l=n.getAttribute("custom");l?i.blocks=l:(l=this.syncTrees_(n,i,t))&&(r=l),l=n.getAttribute("colour"),goog.isString(l)?(l.match(/^#[0-9a-fA-F]{6}$/)?i.hexColour=l:i.hexColour=Blockly.hueToRgb(l),this.hasColours_=!0):i.hexColour="","true"==n.getAttribute("expanded")?(i.blocks.length&&(r=i),i.setExpanded(!0)):i.setExpanded(!1),i=n;break;case"SEP":i&&("CATEGORY"==i.tagName.toUpperCase()?o.add(new Blockly.Toolbox.TreeSeparator(this.treeSeparatorConfig_)):(n=parseFloat(n.getAttribute("gap")),!isNaN(n)&&i&&i.setAttribute("gap",n)));break;case"BLOCK":case"SHADOW":case"LABEL":case"BUTTON":o.blocks.push(n),i=n}return r},Blockly.Toolbox.prototype.addColour_=function(e){e=(e||this.tree_).getChildren();for(var o,t=0;o=e[t];t++){var n=o.getRowElement();if(n){var r=this.hasColours_?"8px solid "+(o.hexColour||"#ddd"):"none";this.workspace_.RTL?n.style.borderRight=r:n.style.borderLeft=r}this.addColour_(o)}},Blockly.Toolbox.prototype.clearSelection=function(){this.tree_.setSelectedItem(null)},Blockly.Toolbox.prototype.getClientRect=function(){if(!this.HtmlDiv)return null;var e=this.HtmlDiv.getBoundingClientRect(),o=e.left,t=e.top,n=e.width,e=e.height;return this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT?new goog.math.Rect(-1e7,-1e7,1e7+o+n,2e7):this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?new goog.math.Rect(o,-1e7,1e7+n,2e7):this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?new goog.math.Rect(-1e7,-1e7,2e7,1e7+t+e):new goog.math.Rect(0,t,2e7,1e7+n)},Blockly.Toolbox.prototype.refreshSelection=function(){var e=this.tree_.getSelectedItem();e&&e.blocks&&this.flyout_.show(e.blocks)},Blockly.Toolbox.TreeControl=function(e,o){this.toolbox_=e,goog.ui.tree.TreeControl.call(this,goog.html.SafeHtml.EMPTY,o)},goog.inherits(Blockly.Toolbox.TreeControl,goog.ui.tree.TreeControl),Blockly.Toolbox.TreeControl.prototype.enterDocument=function(){Blockly.Toolbox.TreeControl.superClass_.enterDocument.call(this);var e=this.getElement();goog.events.BrowserFeature.TOUCH_ENABLED&&Blockly.bindEventWithChecks_(e,goog.events.EventType.TOUCHSTART,this,this.handleTouchEvent_)},Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_=function(e){e.preventDefault();var o=this.getNodeFromEvent_(e);o&&e.type===goog.events.EventType.TOUCHSTART&&setTimeout(function(){o.onMouseDown(e)},1)},Blockly.Toolbox.TreeControl.prototype.createNode=function(e){return new Blockly.Toolbox.TreeNode(this.toolbox_,e?goog.html.SafeHtml.htmlEscape(e):goog.html.SafeHtml.EMPTY,this.getConfig(),this.getDomHelper())},Blockly.Toolbox.TreeControl.prototype.setSelectedItem=function(e){var o=this.toolbox_;if(e!=this.selectedItem_&&e!=o.tree_){if(o.lastCategory_&&(o.lastCategory_.getRowElement().style.backgroundColor=""),e){var t=e.hexColour||"#57e";e.getRowElement().style.backgroundColor=t,o.addColour_(e)}t=this.getSelectedItem(),goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this,e),e&&e.blocks&&e.blocks.length?(o.flyout_.show(e.blocks),o.lastCategory_!=e&&o.flyout_.scrollToStart()):o.flyout_.hide(),t!=e&&t!=this&&(t=new Blockly.Events.Ui(null,"category",t&&t.getHtml(),e&&e.getHtml()),t.workspaceId=o.workspace_.id,Blockly.Events.fire(t)),e&&(o.lastCategory_=e)}},Blockly.Toolbox.TreeNode=function(e,o,t,n){goog.ui.tree.TreeNode.call(this,o,t,n),e&&(o=function(){Blockly.svgResize(e.workspace_)},goog.events.listen(e.tree_,goog.ui.tree.BaseNode.EventType.EXPAND,o),goog.events.listen(e.tree_,goog.ui.tree.BaseNode.EventType.COLLAPSE,o))},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.onMouseDown=function(e){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select(),this.updateRow()},Blockly.Toolbox.TreeNode.prototype.onDoubleClick_=function(e){},Blockly.Toolbox.TreeNode.prototype.onKeyDown=function(e){if(this.tree.toolbox_.horizontalLayout_){var o={},t=goog.events.KeyCodes.DOWN,n=goog.events.KeyCodes.UP;o[goog.events.KeyCodes.RIGHT]=this.rightToLeft_?n:t,o[goog.events.KeyCodes.LEFT]=this.rightToLeft_?t:n,o[goog.events.KeyCodes.UP]=goog.events.KeyCodes.LEFT,o[goog.events.KeyCodes.DOWN]=goog.events.KeyCodes.RIGHT,e.keyCode=o[e.keyCode]||e.keyCode}return Blockly.Toolbox.TreeNode.superClass_.onKeyDown.call(this,e)},Blockly.Toolbox.TreeSeparator=function(e){Blockly.Toolbox.TreeNode.call(this,null,"",e)},goog.inherits(Blockly.Toolbox.TreeSeparator,Blockly.Toolbox.TreeNode),Blockly.Css={},Blockly.Css.Cursor={OPEN:"handopen",CLOSED:"handclosed",DELETE:"handdelete"},Blockly.Css.currentCursor_="",Blockly.Css.styleSheet_=null,Blockly.Css.mediaPath_="",Blockly.Css.inject=function(e,o){if(!Blockly.Css.styleSheet_){var t=".blocklyDraggable {}\n";e&&(t+=Blockly.Css.CONTENT.join("\n"),Blockly.FieldDate&&(t+=Blockly.FieldDate.CSS.join("\n"))),Blockly.Css.mediaPath_=o.replace(/[\\\/]$/,"");var t=t.replace(/<<<PATH>>>/g,Blockly.Css.mediaPath_),n=document.createElement("style");document.head.insertBefore(n,document.head.firstChild),t=document.createTextNode(t),n.appendChild(t),Blockly.Css.styleSheet_=n.sheet,Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN)}},Blockly.Css.setCursor=function(e){if(Blockly.Css.currentCursor_!=e){Blockly.Css.currentCursor_=e;var o="url("+Blockly.Css.mediaPath_+"/"+e+".cur), auto",t=".blocklyDraggable {\n  cursor: "+o+";\n}\n";Blockly.Css.styleSheet_.deleteRule(0),Blockly.Css.styleSheet_.insertRule(t,0);for(var n,t=document.getElementsByClassName("blocklyToolboxDiv"),r=0;n=t[r];r++)n.style.cursor=e==Blockly.Css.Cursor.DELETE?o:"";document.body.parentNode.style.cursor=e==Blockly.Css.Cursor.OPEN?"":o}},Blockly.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","}",".blocklyNonSelectable {","user-select: none;","-moz-user-select: none;","-webkit-user-select: none;","-ms-user-select: none;","}",".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: sans-serif;","font-size: 9pt;","opacity: 0.9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #888;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;","stroke-width: 1;","}",".blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;","font-size: 11pt;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: #000;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: #000;","}",".blocklyFlyoutButton {","fill: #888;","cursor: default;","}",".blocklyFlyoutButtonShadow {","fill: #666;","}",".blocklyFlyoutButton:hover {","fill: #aaa;","}",".blocklyFlyoutLabel {","cursor: default;","}",".blocklyFlyoutLabelBackground {","opacity: 0;","}",".blocklyFlyoutLabelText {","fill: #000;","}",".blocklyFlyoutLabelText:hover {","fill: #aaa;","}",".blocklySvg text {","user-select: none;","-moz-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyCommentTextarea {","background-color: #ffc;","border: 0;","margin: 0;","padding: 2px;","resize: none;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0 1px;","width: 100%","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyZoom>image {","opacity: .4;","}",".blocklyZoom>image:hover {","opacity: .6;","}",".blocklyZoom>image:active {","opacity: .8;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyAngleCircle {","stroke: #444;","stroke-width: 1;","fill: #ddd;","fill-opacity: .8;","}",".blocklyAngleMarks {","stroke: #444;","stroke-width: 1;","}",".blocklyAngleGauge {","fill: #f88;","fill-opacity: .8;","}",".blocklyAngleLine {","stroke: #f00;","stroke-width: 2;","stroke-linecap: round;","}",".blocklyContextMenu {","border-radius: 4px;","}",".blocklyDropdownMenu {","padding: 0 !important;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px !important;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","}",".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: 0px -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {","background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}",".blocklyWidgetDiv .goog-palette {","outline: none;","cursor: default;","}",".blocklyWidgetDiv .goog-palette-table {","border: 1px solid #666;","border-collapse: collapse;","}",".blocklyWidgetDiv .goog-palette-cell {","height: 13px;","width: 15px;","margin: 0;","border: 0;","text-align: center;","vertical-align: middle;","border-right: 1px solid #666;","font-size: 1px;","}",".blocklyWidgetDiv .goog-palette-colorswatch {","position: relative;","height: 13px;","width: 15px;","border: 1px solid #666;","}",".blocklyWidgetDiv .goog-palette-cell-hover .goog-palette-colorswatch {","border: 1px solid #FFF;","}",".blocklyWidgetDiv .goog-palette-cell-selected .goog-palette-colorswatch {","border: 1px solid #000;","color: #fff;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;","border-color: #ccc #666 #666 #ccc;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","padding: 4px 7em 4px 28px;","white-space: nowrap;","}",".blocklyWidgetDiv .goog-menuitem.goog-menuitem-rtl {","padding-left: 7em;","padding-right: 28px;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem {","padding-left: 12px;","}",".blocklyWidgetDiv .goog-menu-noaccel .goog-menuitem {","padding-right: 20px;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-accel,",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content {","color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: 0.3;","-moz-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: 3px;","padding-top: 3px;","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon {","background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon {","background: url(//ssl.gstatic.com/editor/editortoolbar.png) no-repeat -512px 0;","}",".blocklyWidgetDiv .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 {","left: 0;","right: auto;","text-align: left;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-hint {","text-decoration: underline;","}",".blocklyWidgetDiv .goog-menuitem-mnemonic-separator {","color: #999;","font-size: 12px;","padding-left: 4px;","}",".blocklyWidgetDiv .goog-menuseparator {","border-top: 1px solid #ccc;","margin: 4px 0;","padding: 0;","}",""],Blockly.WidgetDiv={},Blockly.WidgetDiv.DIV=null,Blockly.WidgetDiv.owner_=null,Blockly.WidgetDiv.dispose_=null,Blockly.WidgetDiv.createDom=function(){Blockly.WidgetDiv.DIV||(Blockly.WidgetDiv.DIV=goog.dom.createDom("DIV","blocklyWidgetDiv"),document.body.appendChild(Blockly.WidgetDiv.DIV))},Blockly.WidgetDiv.show=function(e,o,t){Blockly.WidgetDiv.hide(),Blockly.WidgetDiv.owner_=e,Blockly.WidgetDiv.dispose_=t,e=goog.style.getViewportPageOffset(document),Blockly.WidgetDiv.DIV.style.top=e.y+"px",Blockly.WidgetDiv.DIV.style.direction=o?"rtl":"ltr",Blockly.WidgetDiv.DIV.style.display="block"},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,goog.dom.removeChildren(Blockly.WidgetDiv.DIV))},Blockly.WidgetDiv.isVisible=function(){return!!Blockly.WidgetDiv.owner_},Blockly.WidgetDiv.hideIfOwner=function(e){Blockly.WidgetDiv.owner_==e&&Blockly.WidgetDiv.hide()},Blockly.WidgetDiv.position=function(e,o,t,n,r){o<n.y&&(o=n.y),r?e>t.width+n.x&&(e=t.width+n.x):e<n.x&&(e=n.x),Blockly.WidgetDiv.DIV.style.left=e+"px",Blockly.WidgetDiv.DIV.style.top=o+"px",Blockly.WidgetDiv.DIV.style.height=t.height+"px"},Blockly.inject=function(e,o){if(goog.isString(e)&&(e=document.getElementById(e)||document.querySelector(e)),!goog.dom.contains(document,e))throw"Error: container is not in current document.";var t=new Blockly.Options(o||{}),n=goog.dom.createDom("div","injectionDiv");return e.appendChild(n),n=Blockly.createDom_(n,t),t=Blockly.createMainWorkspace_(n,t),Blockly.init_(t),t.markFocused(),Blockly.bindEventWithChecks_(n,"focus",t,t.markFocused),Blockly.svgResize(t),t},Blockly.createDom_=function(e,o){e.setAttribute("dir","LTR"),goog.ui.Component.setDefaultRightToLeft(o.RTL),Blockly.Css.inject(o.hasCss,o.pathToMedia);var t=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklySvg"},e),n=Blockly.createSvgElement("defs",{},t),r=String(Math.random()).substring(2),i=Blockly.createSvgElement("filter",{id:"blocklyEmbossFilter"+r},n);Blockly.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},i);var s=Blockly.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},i);return Blockly.createSvgElement("fePointLight",{x:-5e3,y:-1e4,z:2e4},s),Blockly.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},i),Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},i),o.embossFilterId=i.id,i=Blockly.createSvgElement("pattern",{id:"blocklyDisabledPattern"+r,patternUnits:"userSpaceOnUse",width:10,height:10},n),Blockly.createSvgElement("rect",{width:10,height:10,fill:"#aaa"},i),Blockly.createSvgElement("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},i),o.disabledPatternId=i.id,n=Blockly.createSvgElement("pattern",{id:"blocklyGridPattern"+r,patternUnits:"userSpaceOnUse"},n),0<o.gridOptions.length&&0<o.gridOptions.spacing&&(Blockly.createSvgElement("line",{stroke:o.gridOptions.colour},n),1<o.gridOptions.length&&Blockly.createSvgElement("line",{stroke:o.gridOptions.colour},n)),o.gridPattern=n,t},Blockly.createMainWorkspace_=function(e,o){o.parentWorkspace=null;var t=new Blockly.WorkspaceSvg(o);return t.scale=o.zoomOptions.startScale,e.appendChild(t.createDom("blocklyMainBackground")),t.translate(0,0),t.markFocused(),o.readOnly||o.hasScrollbars||t.addChangeListener(function(){if(Blockly.dragMode_==Blockly.DRAG_NONE){var e=t.getMetrics(),n=e.viewLeft+e.absoluteLeft,r=e.viewTop+e.absoluteTop;if(e.contentTop<r||e.contentTop+e.contentHeight>e.viewHeight+r||e.contentLeft<(o.RTL?e.viewLeft:n)||e.contentLeft+e.contentWidth>(o.RTL?e.viewWidth:e.viewWidth+n))for(var i,s=t.getTopBlocks(!1),l=0;i=s[l];l++){var g=i.getRelativeToSurfaceXY(),a=i.getHeightWidth(),c=r+25-a.height-g.y;c>0&&i.moveBy(0,c),c=r+e.viewHeight-25-g.y,0>c&&i.moveBy(0,c),c=25+n-g.x-(o.RTL?0:a.width),c>0&&i.moveBy(c,0),g=n+e.viewWidth-25-g.x+(o.RTL?a.width:0),0>g&&i.moveBy(g,0)}}}),Blockly.svgResize(t),Blockly.WidgetDiv.createDom(),Blockly.Tooltip.createDom(),t},Blockly.init_=function(e){var o=e.options,t=e.getParentSvg();Blockly.bindEventWithChecks_(t,"contextmenu",null,function(e){Blockly.isTargetInput_(e)||e.preventDefault()}),t=Blockly.bindEventWithChecks_(window,"resize",null,function(){Blockly.hideChaff(!0),Blockly.svgResize(e)}),e.setResizeHandlerWrapper(t),Blockly.inject.bindDocumentEvents_(),o.languageTree&&(e.toolbox_?e.toolbox_.init(e):e.flyout_&&(e.flyout_.init(e),e.flyout_.show(o.languageTree.childNodes),e.flyout_.scrollToStart(),e.scrollX=e.flyout_.width_,o.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT&&(e.scrollX*=-1),e.translate(e.scrollX,0))),o.hasScrollbars&&(e.scrollbar=new Blockly.ScrollbarPair(e),e.scrollbar.resize()),o.hasSounds&&Blockly.inject.loadSounds_(o.pathToMedia,e)},Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.bindEventWithChecks_(document,"keydown",null,Blockly.onKeyDown_),Blockly.bindEventWithChecks_(document,"touchend",null,Blockly.longStop_),Blockly.bindEventWithChecks_(document,"touchcancel",null,Blockly.longStop_),document.addEventListener("mouseup",Blockly.onMouseUp_,!1),goog.userAgent.IPAD&&Blockly.bindEventWithChecks_(window,"orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())})),Blockly.documentEventsBound_=!0},Blockly.inject.loadSounds_=function(e,o){o.loadAudio_([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),o.loadAudio_([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),o.loadAudio_([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");var t=[],n=function(){for(;t.length;)Blockly.unbindEvent_(t.pop());o.preloadAudio_()};t.push(Blockly.bindEventWithChecks_(document,"mousemove",null,n,!0)),t.push(Blockly.bindEventWithChecks_(document,"touchstart",null,n,!0))},Blockly.updateToolbox=function(e){console.warn("Deprecated call to Blockly.updateToolbox, use workspace.updateToolbox instead."),Blockly.getMainWorkspace().updateToolbox(e)},Blockly.utils={},Blockly.addClass_=function(e,o){var t=e.getAttribute("class")||"";-1==(" "+t+" ").indexOf(" "+o+" ")&&(t&&(t+=" "),e.setAttribute("class",t+o))},Blockly.removeClass_=function(e,o){var t=e.getAttribute("class");if(-1!=(" "+t+" ").indexOf(" "+o+" ")){for(var t=t.split(/\s+/),n=0;n<t.length;n++)t[n]&&t[n]!=o||(t.splice(n,1),n--);t.length?e.setAttribute("class",t.join(" ")):e.removeAttribute("class")}},Blockly.hasClass_=function(e,o){return-1!=(" "+e.getAttribute("class")+" ").indexOf(" "+o+" ")},Blockly.bindEventWithChecks_=function(e,o,t,n,r){var i=!1,s=function(e){var o=!r;e=Blockly.Touch.splitEventByTouches(e);for(var s,l=0;s=e[l];l++)(!o||Blockly.Touch.shouldHandleEvent(s))&&(Blockly.Touch.setClientFromTouch(s),t?n.call(t,s):n(s),i=!0)};e.addEventListener(o,s,!1);var l=[[e,o,s]];if(o in Blockly.Touch.TOUCH_MAP)for(var g,a=function(e){s(e),i&&e.preventDefault()},c=0;g=Blockly.Touch.TOUCH_MAP[o][c];c++)e.addEventListener(g,a,!1),l.push([e,g,a]);return l},Blockly.bindEvent_=function(e,o,t,n){var r=function(e){t?n.call(t,e):n(e)};e.addEventListener(o,r,!1);var i=[[e,o,r]];if(o in Blockly.Touch.TOUCH_MAP)for(var s,l=function(e){if(1==e.changedTouches.length){var o=e.changedTouches[0];e.clientX=o.clientX,e.clientY=o.clientY}r(e),e.preventDefault()},g=0;s=Blockly.Touch.TOUCH_MAP[o][g];g++)e.addEventListener(s,l,!1),i.push([e,s,l]);return i},Blockly.unbindEvent_=function(e){for(;e.length;){var o=e.pop(),t=o[2];o[0].removeEventListener(o[1],t,!1)}return t},Blockly.noEvent=function(e){e.preventDefault(),e.stopPropagation()},Blockly.isTargetInput_=function(e){return"textarea"==e.target.type||"text"==e.target.type||"number"==e.target.type||"email"==e.target.type||"password"==e.target.type||"search"==e.target.type||"tel"==e.target.type||"url"==e.target.type||e.target.isContentEditable},Blockly.getRelativeXY_=function(e){var o=new goog.math.Coordinate(0,0),t=e.getAttribute("x");return t&&(o.x=parseInt(t,10)),(t=e.getAttribute("y"))&&(o.y=parseInt(t,10)),(e=(e=e.getAttribute("transform"))&&e.match(Blockly.getRelativeXY_.XY_REGEXP_))&&(o.x+=parseFloat(e[1]),e[3]&&(o.y+=parseFloat(e[3]))),o},Blockly.getRelativeXY_.XY_REGEXP_=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*\))?/,Blockly.getSvgXY_=function(e,o){var t=0,n=0,r=1;(goog.dom.contains(o.getCanvas(),e)||goog.dom.contains(o.getBubbleCanvas(),e))&&(r=o.scale);do{var i=Blockly.getRelativeXY_(e);(e==o.getCanvas()||e==o.getBubbleCanvas())&&(r=1),t+=i.x*r,n+=i.y*r,e=e.parentNode}while(e&&e!=o.getParentSvg());return new goog.math.Coordinate(t,n)},Blockly.createSvgElement=function(e,o,t,n){e=document.createElementNS(Blockly.SVG_NS,e);for(var r in o)e.setAttribute(r,o[r]);return document.body.runtimeStyle&&(e.runtimeStyle=e.currentStyle=e.style),
    2222t&&t.appendChild(e),e},Blockly.isRightButton=function(e){return e.ctrlKey&&goog.userAgent.MAC?!0:2==e.button},Blockly.mouseToSvg=function(e,o,t){var n=o.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,t||(t=o.getScreenCTM().inverse()),n.matrixTransform(t)},Blockly.shortestStringLength=function(e){if(!e.length)return 0;for(var o=e[0].length,t=1;t<e.length;t++)o=Math.min(o,e[t].length);return o},Blockly.commonWordPrefix=function(e,o){if(!e.length)return 0;if(1==e.length)return e[0].length;for(var t=0,n=o||Blockly.shortestStringLength(e),r=0;n>r;r++){for(var i=e[0][r],s=1;s<e.length;s++)if(i!=e[s][r])return t;" "==i&&(t=r+1)}for(s=1;s<e.length;s++)if((i=e[s][r])&&" "!=i)return t;return n},Blockly.commonWordSuffix=function(e,o){if(!e.length)return 0;if(1==e.length)return e[0].length;for(var t=0,n=o||Blockly.shortestStringLength(e),r=0;n>r;r++){for(var i=e[0].substr(-r-1,1),s=1;s<e.length;s++)if(i!=e[s].substr(-r-1,1))return t;" "==i&&(t=r+1)}for(s=1;s<e.length;s++)if((i=e[s].charAt(e[s].length-r-1))&&" "!=i)return t;return n},Blockly.isNumber=function(e){return!!e.match(/^\s*-?\d+(\.\d+)?\s*$/)},Blockly.utils.tokenizeInterpolation=function(e){var o=[];e=e.split(""),e.push("");for(var t=0,n=[],r=null,i=0;i<e.length;i++){var s=e[i];0==t?"%"==s?t=1:n.push(s):1==t?"%"==s?(n.push(s),t=0):s>="0"&&"9">=s?(t=2,r=s,(s=n.join(""))&&o.push(s),n.length=0):(n.push("%",s),t=0):2==t&&(s>="0"&&"9">=s?r+=s:(o.push(parseInt(r,10)),i--,t=0))}return(s=n.join(""))&&o.push(s),o},Blockly.genUid=function(){for(var e=Blockly.genUid.soup_.length,o=[],t=0;20>t;t++)o[t]=Blockly.genUid.soup_.charAt(Math.random()*e);return o.join("")},Blockly.genUid.soup_="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Blockly.utils.wrap=function(e,o){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=Blockly.utils.wrap_line_(t[n],o);return t.join("\n")},Blockly.utils.wrap_line_=function(e,o){if(e.length<=o)return e;for(var t=e.trim().split(/\s+/),n=0;n<t.length;n++)t[n].length>o&&(o=t[n].length);var r,i,n=-(1/0),s=1;do{r=n,i=e;for(var l=[],g=t.length/s,a=1,n=0;n<t.length-1;n++)(n+1.5)/g>a?(a++,l[n]=!0):l[n]=!1;l=Blockly.utils.wrapMutate_(t,l,o),n=Blockly.utils.wrapScore_(t,l,o),e=Blockly.utils.wrapToText_(t,l),s++}while(n>r);return i},Blockly.utils.wrapScore_=function(e,o,t){for(var n=[0],r=[],i=0;i<e.length;i++)n[n.length-1]+=e[i].length,!0===o[i]?(n.push(0),r.push(e[i].charAt(e[i].length-1))):!1===o[i]&&n[n.length-1]++;for(e=Math.max.apply(Math,n),i=o=0;i<n.length;i++)o-=2*Math.pow(Math.abs(t-n[i]),1.5),o-=Math.pow(e-n[i],1.5),-1!=".?!".indexOf(r[i])?o+=t/3:-1!=",;)]}".indexOf(r[i])&&(o+=t/4);return 1<n.length&&n[n.length-1]<=n[n.length-2]&&(o+=.5),o},Blockly.utils.wrapMutate_=function(e,o,t){for(var n,r=Blockly.utils.wrapScore_(e,o,t),i=0;i<o.length-1;i++)if(o[i]!=o[i+1]){var s=[].concat(o);s[i]=!s[i],s[i+1]=!s[i+1];var l=Blockly.utils.wrapScore_(e,s,t);l>r&&(r=l,n=s)}return n?Blockly.utils.wrapMutate_(e,n,t):o},Blockly.utils.wrapToText_=function(e,o){for(var t=[],n=0;n<e.length;n++)t.push(e[n]),void 0!==o[n]&&t.push(o[n]?"\n":" ");return t.join("")};var CLOSURE_DEFINES={"goog.DEBUG":!1};Blockly.mainWorkspace=null,Blockly.selected=null,Blockly.highlightedConnection_=null,Blockly.localConnection_=null,Blockly.draggingConnections_=[],Blockly.clipboardXml_=null,Blockly.clipboardSource_=null,Blockly.dragMode_=Blockly.DRAG_NONE,Blockly.flyoutButtonCallbacks_={},Blockly.registerButtonCallback=function(e,o){Blockly.flyoutButtonCallbacks_[e]=o},Blockly.hueToRgb=function(e){return goog.color.hsvToHex(e,Blockly.HSV_SATURATION,255*Blockly.HSV_VALUE)},Blockly.svgSize=function(e){return{width:e.cachedWidth_,height:e.cachedHeight_}},Blockly.resizeSvgContents=function(e){e.resizeContents()},Blockly.svgResize=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;var o=e.getParentSvg(),t=o.parentNode;if(t){var n=t.offsetWidth,t=t.offsetHeight;o.cachedWidth_!=n&&(o.setAttribute("width",n+"px"),o.cachedWidth_=n),o.cachedHeight_!=t&&(o.setAttribute("height",t+"px"),o.cachedHeight_=t),e.resize()}},Blockly.onKeyDown_=function(e){if(!Blockly.mainWorkspace.options.readOnly&&!Blockly.isTargetInput_(e)){var o=!1;27==e.keyCode?Blockly.hideChaff():8==e.keyCode||46==e.keyCode?(e.preventDefault(),Blockly.selected&&Blockly.selected.isDeletable()&&(o=!0)):(e.altKey||e.ctrlKey||e.metaKey)&&(Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(67==e.keyCode?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):88==e.keyCode&&(Blockly.copy_(Blockly.selected),o=!0)),86==e.keyCode?Blockly.clipboardXml_&&(Blockly.Events.setGroup(!0),Blockly.clipboardSource_.paste(Blockly.clipboardXml_),Blockly.Events.setGroup(!1)):90==e.keyCode&&(Blockly.hideChaff(),Blockly.mainWorkspace.undo(e.shiftKey))),o&&(Blockly.Events.setGroup(!0),Blockly.hideChaff(),Blockly.selected.dispose(Blockly.dragMode_!=Blockly.DRAG_FREE,!0),Blockly.highlightedConnection_&&(Blockly.highlightedConnection_.unhighlight(),Blockly.highlightedConnection_=null),Blockly.Events.setGroup(!1))}},Blockly.terminateDrag_=function(){Blockly.BlockSvg.terminateDrag(),Blockly.Flyout.terminateDrag_()},Blockly.copy_=function(e){var o=Blockly.Xml.blockToDom(e);Blockly.dragMode_!=Blockly.DRAG_FREE&&Blockly.Xml.deleteNext(o);var t=e.getRelativeToSurfaceXY();o.setAttribute("x",e.RTL?-t.x:t.x),o.setAttribute("y",t.y),Blockly.clipboardXml_=o,Blockly.clipboardSource_=e.workspace},Blockly.duplicate_=function(e){var o=Blockly.clipboardXml_,t=Blockly.clipboardSource_;Blockly.copy_(e),e.workspace.paste(Blockly.clipboardXml_),Blockly.clipboardXml_=o,Blockly.clipboardSource_=t},Blockly.onContextMenu_=function(e){Blockly.isTargetInput_(e)||e.preventDefault()},Blockly.hideChaff=function(e){Blockly.Tooltip.hide(),Blockly.WidgetDiv.hide(),e||(e=Blockly.getMainWorkspace(),e.toolbox_&&e.toolbox_.flyout_&&e.toolbox_.flyout_.autoClose&&e.toolbox_.clearSelection())},Blockly.addChangeListener=function(e){return console.warn("Deprecated call to Blockly.addChangeListener, use workspace.addChangeListener instead."),Blockly.getMainWorkspace().addChangeListener(e)},Blockly.getMainWorkspace=function(){return Blockly.mainWorkspace},Blockly.alert=function(e,o){window.alert(e),o&&o()},Blockly.confirm=function(e,o){o(window.confirm(e))},Blockly.prompt=function(e,o,t){t(window.prompt(e,o))},Blockly.jsonInitFactory_=function(e){return function(){this.jsonInit(e)}},Blockly.defineBlocksWithJsonArray=function(e){for(var o,t=0;o=e[t];t++)Blockly.Blocks[o.type]={init:Blockly.jsonInitFactory_(o)}},goog.global.console||(goog.global.console={log:function(){},warn:function(){}}),goog.global.Blockly||(goog.global.Blockly={}),goog.global.Blockly.getMainWorkspace=Blockly.getMainWorkspace,goog.global.Blockly.addChangeListener=Blockly.addChangeListener;
Note: See TracChangeset for help on using the changeset viewer.