Skip to content

Instantly share code, notes, and snippets.

@ctjlewis
Created June 25, 2020 23:51
Show Gist options
  • Save ctjlewis/a32192f1e4c5bab30abe10fc07730f8a to your computer and use it in GitHub Desktop.
Save ctjlewis/a32192f1e4c5bab30abe10fc07730f8a to your computer and use it in GitHub Desktop.
/*
Licensed under the Telework Common License, available at:
https://raw.githubusercontent.com/TeleworkInc/.LICENSE/master/LICENSE
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,b){a.raw=b;return a};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};
$jscomp.arrayFromIterator=function(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c};$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var b=function(){};b.prototype=a;return new b};
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};
$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})};
$jscomp.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var g=0;g<e.length-1;g++){var f=e[g];f in d||(d[f]={});d=d[f]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&($jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+e,e=$jscomp.propertyToPolyfillSymbol[e],
$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:b})))};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},b={};try{return b.__proto__=a,b.a}catch(c){}return!1};$jscomp.setPrototypeOf=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,b){a.prototype=$jscomp.objectCreate(b.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var c=$jscomp.setPrototypeOf;c(a,b)}else for(c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.superClass_=b.prototype};$jscomp.initSymbol=function(){};
$jscomp.polyfill("Symbol",function(a){if(a)return a;var b=function(a,b){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:b})};b.prototype.toString=function(){return this.$jscomp$symbol$id_};var c=0,d=function(a){if(this instanceof d)throw new TypeError("Symbol is not a constructor");return new b("jscomp_symbol_"+(a||"")+"_"+c++,a)};return d},"es6","es3");$jscomp.initSymbolIterator=function(){};
$jscomp.polyfill("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=$jscomp.global[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&$jscomp.defineProperty(d.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return a},"es6",
"es3");$jscomp.initSymbolAsyncIterator=function(){};$jscomp.iteratorPrototype=function(a){a={next:a};a[Symbol.iterator]=function(){return this};return a};$jscomp.generator={};$jscomp.generator.ensureIteratorResultIsObject_=function(a){if(!(a instanceof Object))throw new TypeError("Iterator result "+a+" is not an object");};
$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};
$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(a){this.yieldResult=a};$jscomp.generator.Context.prototype.throw_=function(a){this.abruptCompletion_={exception:a,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(a){this.abruptCompletion_={return:a};this.nextAddress=this.finallyAddress_};
$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(a){this.abruptCompletion_={jumpTo:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(a,b){this.nextAddress=b;return{value:a}};$jscomp.generator.Context.prototype.yieldAll=function(a,b){a=$jscomp.makeIterator(a);var c=a.next();$jscomp.generator.ensureIteratorResultIsObject_(c);if(c.done)this.yieldResult=c.value,this.nextAddress=b;else return this.yieldAllIterator_=a,this.yield(c.value,b)};
$jscomp.generator.Context.prototype.jumpTo=function(a){this.nextAddress=a};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(a,b){this.catchAddress_=a;void 0!=b&&(this.finallyAddress_=b)};$jscomp.generator.Context.prototype.setFinallyBlock=function(a){this.catchAddress_=0;this.finallyAddress_=a||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(a,b){this.nextAddress=a;this.catchAddress_=b||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(a){this.catchAddress_=a||0;a=this.abruptCompletion_.exception;this.abruptCompletion_=null;return a};$jscomp.generator.Context.prototype.enterFinallyBlock=function(a,b,c){c?this.finallyContexts_[c]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=a||0;this.finallyAddress_=b||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(a,b){b=this.finallyContexts_.splice(b||0)[0];if(b=this.abruptCompletion_=this.abruptCompletion_||b){if(b.isException)return this.jumpToErrorHandler_();void 0!=b.jumpTo&&this.finallyAddress_<b.jumpTo?(this.nextAddress=b.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=a};$jscomp.generator.Context.prototype.forIn=function(a){return new $jscomp.generator.Context.PropertyIterator(a)};
$jscomp.generator.Context.PropertyIterator=function(a){this.object_=a;this.properties_=[];for(var b in a)this.properties_.push(b);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var a=this.properties_.pop();if(a in this.object_)return a}return null};$jscomp.generator.Engine_=function(a){this.context_=new $jscomp.generator.Context;this.program_=a};
$jscomp.generator.Engine_.prototype.next_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,a,this.context_.next_);this.context_.next_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(a){this.context_.start_();var b=this.context_.yieldAllIterator_;if(b)return this.yieldAllStep_("return"in b?b["return"]:function(a){return{value:a,done:!0}},a,this.context_.return);this.context_.return(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],a,this.context_.next_);this.context_.throw_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(a,b,c){try{var d=a.call(this.context_.yieldAllIterator_,b);$jscomp.generator.ensureIteratorResultIsObject_(d);if(!d.done)return this.context_.stop_(),d;var e=d.value}catch(g){return this.context_.yieldAllIterator_=null,this.context_.throw_(g),this.nextStep_()}this.context_.yieldAllIterator_=null;c.call(this.context_,e);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var a=this.program_(this.context_);if(a)return this.context_.stop_(),{value:a.value,done:!1}}catch(b){this.context_.yieldResult=void 0,this.context_.throw_(b)}this.context_.stop_();if(this.context_.abruptCompletion_){a=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(a.isException)throw a.exception;return{value:a.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(a){this.next=function(b){return a.next_(b)};this.throw=function(b){return a.throw_(b)};this.return=function(b){return a.return_(b)};this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(a,b){b=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(b));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(b,a.prototype);return b};
$jscomp.checkEs6ConformanceViaProxy=function(){try{var a={},b=Object.create(new $jscomp.global.Proxy(a,{get:function(c,d,e){return c==a&&"q"==d&&e==b}}));return!0===b.q}catch(c){return!1}};$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();$jscomp.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};
$jscomp.polyfill("WeakMap",function(a){function b(){if(!a||!Object.seal)return!1;try{var b=Object.seal({}),c=Object.seal({}),d=new a([[b,2],[c,3]]);if(2!=d.get(b)||3!=d.get(c))return!1;d.delete(b);d.set(c,4);return!d.has(b)&&4==d.get(c)}catch(l){return!1}}function c(){}function d(a){var b=typeof a;return"object"===b&&null!==a||"function"===b}function e(a){if(!$jscomp.owns(a,f)){var b=new c;$jscomp.defineProperty(a,f,{value:b})}}function g(a){var b=Object[a];b&&(Object[a]=function(a){if(a instanceof
c)return a;e(a);return b(a)})}if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$jscomp.ES6_CONFORMANCE)return a}else if(b())return a;var f="$jscomp_hidden_"+Math.random();g("freeze");g("preventExtensions");g("seal");var k=0,h=function(a){this.id_=(k+=Math.random()+1).toString();if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};h.prototype.set=function(a,b){if(!d(a))throw Error("Invalid WeakMap key");e(a);if(!$jscomp.owns(a,f))throw Error("WeakMap key fail: "+
a);a[f][this.id_]=b;return this};h.prototype.get=function(a){return d(a)&&$jscomp.owns(a,f)?a[f][this.id_]:void 0};h.prototype.has=function(a){return d(a)&&$jscomp.owns(a,f)&&$jscomp.owns(a[f],this.id_)};h.prototype.delete=function(a){return d(a)&&$jscomp.owns(a,f)&&$jscomp.owns(a[f],this.id_)?delete a[f][this.id_]:!1};return h},"es6","es3");$jscomp.MapEntry=function(){};
$jscomp.polyfill("Map",function(a){function b(){if($jscomp.ASSUME_NO_NATIVE_MAP||!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),c=new a($jscomp.makeIterator([[b,"s"]]));if("s"!=c.get(b)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var d=c.entries(),e=d.next();if(e.done||e.value[0]!=b||"s"!=e.value[1])return!1;e=d.next();return e.done||4!=e.value[0].x||"t"!=e.value[1]||!d.next().done?!1:!0}catch(l){return!1}}
if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$jscomp.ES6_CONFORMANCE)return a}else if(b())return a;var c=new WeakMap,d=function(a){this.data_={};this.head_=f();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};d.prototype.set=function(a,b){a=0===a?0:a;var c=e(this,a);c.list||(c.list=this.data_[c.id]=[]);c.entry?c.entry.value=b:(c.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:b},c.list.push(c.entry),
this.head_.previous.next=c.entry,this.head_.previous=c.entry,this.size++);return this};d.prototype.delete=function(a){a=e(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};d.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=f();this.size=0};d.prototype.has=function(a){return!!e(this,a).entry};d.prototype.get=function(a){return(a=
e(this,a).entry)&&a.value};d.prototype.entries=function(){return g(this,function(a){return[a.key,a.value]})};d.prototype.keys=function(){return g(this,function(a){return a.key})};d.prototype.values=function(){return g(this,function(a){return a.value})};d.prototype.forEach=function(a,b){for(var c=this.entries(),d;!(d=c.next()).done;)d=d.value,a.call(b,d[1],d[0],this)};d.prototype[Symbol.iterator]=d.prototype.entries;var e=function(a,b){var d=b&&typeof b;"object"==d||"function"==d?c.has(b)?d=c.get(b):
(d=""+ ++k,c.set(b,d)):d="p_"+b;var e=a.data_[d];if(e&&$jscomp.owns(a.data_,d))for(a=0;a<e.length;a++){var f=e[a];if(b!==b&&f.key!==f.key||b===f.key)return{id:d,list:e,index:a,entry:f}}return{id:d,list:e,index:-1,entry:void 0}},g=function(a,b){var c=a.head_;return $jscomp.iteratorPrototype(function(){if(c){for(;c.head!=a.head_;)c=c.previous;for(;c.next!=c.head;)return c=c.next,{done:!1,value:b(c)};c=null}return{done:!0,value:void 0}})},f=function(){var a={};return a.previous=a.next=a.head=a},k=0;
return d},"es6","es3");
$jscomp.polyfill("Set",function(a){function b(){if($jscomp.ASSUME_NO_NATIVE_SET||!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),c=new a($jscomp.makeIterator([b]));if(!c.has(b)||1!=c.size||c.add(b)!=c||1!=c.size||c.add({x:4})!=c||2!=c.size)return!1;var g=c.entries(),f=g.next();if(f.done||f.value[0]!=b||f.value[1]!=b)return!1;f=g.next();return f.done||f.value[0]==b||4!=f.value[0].x||f.value[1]!=f.value[0]?!1:g.next().done}catch(k){return!1}}
if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(a&&$jscomp.ES6_CONFORMANCE)return a}else if(b())return a;var c=function(a){this.map_=new Map;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)this.add(b.value)}this.size=this.map_.size};c.prototype.add=function(a){a=0===a?0:a;this.map_.set(a,a);this.size=this.map_.size;return this};c.prototype.delete=function(a){a=this.map_.delete(a);this.size=this.map_.size;return a};c.prototype.clear=function(){this.map_.clear();this.size=0};c.prototype.has=
function(a){return this.map_.has(a)};c.prototype.entries=function(){return this.map_.entries()};c.prototype.values=function(){return this.map_.values()};c.prototype.keys=c.prototype.values;c.prototype[Symbol.iterator]=c.prototype.values;c.prototype.forEach=function(a,b){var c=this;this.map_.forEach(function(d){return a.call(b,d,d,c)})};return c},"es6","es3");$jscomp.polyfill("Object.is",function(a){return a?a:function(a,c){return a===c?0!==a||1/a===1/c:a!==a&&c!==c}},"es6","es3");
$jscomp.polyfill("Array.prototype.includes",function(a){return a?a:function(a,c){var b=this;b instanceof String&&(b=String(b));var e=b.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var g=b[c];if(g===a||Object.is(g,a))return!0}return!1}},"es7","es3");
$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};
var WidgetLike,PRODUCTION=!1,LOAD_START=performance.now(),WIDGETS_DEBUG=!1,WIDGETS_STYLESHEET=document.createElement("style"),CACHED_STYLES=new Set,CACHED_CLASSES={},TIMES=[],DEBUG_LOG=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];return console.log.apply(console,[a+"()"].concat($jscomp.arrayFromIterable(c)))};document.head.appendChild(WIDGETS_STYLESHEET);var Inheritable=function(){};
Inheritable.cacheStyles=function(){var a=this.name,b=this.styles;!CACHED_STYLES.has(a)&&b&&(WIDGETS_DEBUG&&DEBUG_LOG("caching styles for",a,b),WIDGETS_STYLESHEET.sheet.insertRule("."+a+" {"+b+"}"),CACHED_STYLES.add(a),(this.extend||[]).forEach(function(a){return a.cacheStyles()}));return this};
$jscomp.global.Object.defineProperties(Inheritable,{className:{configurable:!0,enumerable:!0,get:function(){return this.name}},inheritedClasses:{configurable:!0,enumerable:!0,get:function(){var a=this.name;if(a in CACHED_CLASSES)return CACHED_CLASSES[a];var b=[a];this!==Widget&&b.push.apply(b,$jscomp.arrayFromIterable(Object.getPrototypeOf(this).inheritedClasses));var c=this.extend;if(c){c=$jscomp.makeIterator(c);for(var d=c.next();!d.done;d=c.next())b.push.apply(b,$jscomp.arrayFromIterable(d.value.inheritedClasses))}this.cacheStyles();
return(CACHED_CLASSES[a]=b)||[]}},extend:{configurable:!0,enumerable:!0,get:function(){}},tag:{configurable:!0,enumerable:!0,get:function(){}},styles:{configurable:!0,enumerable:!0,get:function(){}},attributes:{configurable:!0,enumerable:!0,get:function(){}}});
var Widget=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];Inheritable.call(this);this.children=b;this.tag=this.constructor.tag||(PRODUCTION?":"+this.constructor.className:this.constructor.className);this.classNames=this.constructor.inheritedClasses||[];this.styles="";this.attributes=this.constructor.attributes||{}};$jscomp.inherits(Widget,Inheritable);Widget.cacheStyles=Inheritable.cacheStyles;
Widget.prototype.animate=function(a,b,c,d){WIDGETS_DEBUG&&DEBUG_LOG("animate",arguments);(new Animator(this.element,c,d)).watch(a,b);return this};Widget.prototype.append=function(a){WIDGETS_DEBUG&&DEBUG_LOG("append",arguments);a.build();this.element.appendChild(a.element);return this};Widget.prototype.applyAttributes=function(){WIDGETS_DEBUG&&DEBUG_LOG("applyAttributes",arguments);for(var a in this.attributes)this.element.setAttribute(a,this.attributes[a]);return this};
Widget.prototype.applyClasses=function(){WIDGETS_DEBUG&&DEBUG_LOG("applyClasses",arguments);this.element.className=this.classNames.join(" ");return this};Widget.prototype.applyElement=function(){WIDGETS_DEBUG&&DEBUG_LOG("setElement",arguments);var a=document.createElement(this.tag);return this.replace(a)};Widget.prototype.applyStyles=function(){WIDGETS_DEBUG&&DEBUG_LOG("applyStyles",arguments);this.styles&&this.element.setAttribute("style",this.styles);return this};
Widget.prototype.build=function(){var a=this;WIDGETS_DEBUG&&DEBUG_LOG("build",arguments);this.applyElement().applyAttributes().applyClasses().applyStyles();this.children.length&&this.children.forEach(function(b){a.append("string"===typeof b?new TextNode(b):b)});return this};Widget.prototype.render=function(a){a=void 0===a?this.element:a;WIDGETS_DEBUG&&DEBUG_LOG("render",arguments);this.element||this.build();a.replaceWith(this.element);return this};
Widget.prototype.replace=function(a){WIDGETS_DEBUG&&DEBUG_LOG("replaceElement",arguments);this.element?this.element.replaceWith(a):this.element=a;return this};Widget.prototype.replaceText=function(a){WIDGETS_DEBUG&&DEBUG_LOG("setTextNode",arguments);var b=document.createTextNode(a);return this.replace(b)};Widget.prototype.setAttributes=function(a){WIDGETS_DEBUG&&DEBUG_LOG("setAttributes",arguments);for(var b in a)this.attributes[b]=a[b];return this};
Widget.prototype.setClasses=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];WIDGETS_DEBUG&&DEBUG_LOG("setClass",arguments);this.classNames.push.apply(this.classNames,$jscomp.arrayFromIterable(b));return this};Widget.prototype.setStyles=function(a){WIDGETS_DEBUG&&DEBUG_LOG("setStyles",arguments);this.styles+=a;return this};$jscomp.global.Object.defineProperties(Widget.prototype,{html:{configurable:!0,enumerable:!0,get:function(){return this.element.outerHTML}}});
$jscomp.global.Object.defineProperties(Widget,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n box-sizing: border-box;\n \n background-position: center center;\n background-repeat: no-repeat;\n background-size: contain;\n background-attachment: scroll;\n "}}});var TextNode=function(a){Widget.call(this);this.text=a};$jscomp.inherits(TextNode,Widget);TextNode.cacheStyles=Widget.cacheStyles;TextNode.prototype.build=function(){return this.replaceText(this.text)};
var TextWidget=function(){Widget.apply(this,arguments)};$jscomp.inherits(TextWidget,Widget);TextWidget.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(TextWidget,{styles:{configurable:!0,enumerable:!0,get:function(){return'\n font-family: "Lato", Arial, Helvetica, sans-serif;\n color: white;\n '}}});var Heading1=function(){TextWidget.apply(this,arguments)};$jscomp.inherits(Heading1,TextWidget);Heading1.cacheStyles=TextWidget.cacheStyles;
$jscomp.global.Object.defineProperties(Heading1,{tag:{configurable:!0,enumerable:!0,get:function(){return"h1"}}});var Heading2=function(){TextWidget.apply(this,arguments)};$jscomp.inherits(Heading2,TextWidget);Heading2.cacheStyles=TextWidget.cacheStyles;$jscomp.global.Object.defineProperties(Heading2,{tag:{configurable:!0,enumerable:!0,get:function(){return"h2"}}});var CenteredHeading1=function(){Heading1.apply(this,arguments)};$jscomp.inherits(CenteredHeading1,Heading1);
CenteredHeading1.cacheStyles=Heading1.cacheStyles;$jscomp.global.Object.defineProperties(CenteredHeading1,{extend:{configurable:!0,enumerable:!0,get:function(){return[Center]}}});var CenteredHeading2=function(){Heading1.apply(this,arguments)};$jscomp.inherits(CenteredHeading2,Heading1);CenteredHeading2.cacheStyles=Heading1.cacheStyles;$jscomp.global.Object.defineProperties(CenteredHeading2,{extend:{configurable:!0,enumerable:!0,get:function(){return[Center]}}});
var Flex=function(){Widget.apply(this,arguments)};$jscomp.inherits(Flex,Widget);Flex.cacheStyles=Widget.cacheStyles;Flex.prototype.setFlex=function(a){return this.setStyles("flex-grow: "+(void 0===a?1:a)+";")};$jscomp.global.Object.defineProperties(Flex,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n display: flex;\n flex-shrink: 0;\n flex-basis: 0;\n flex-grow: 1;\n flex-direction: column;\n align-items: center;\n // justify-content: space-around;\n "}}});
var Inflate=function(){Flex.apply(this,arguments)};$jscomp.inherits(Inflate,Flex);Inflate.cacheStyles=Flex.cacheStyles;$jscomp.global.Object.defineProperties(Inflate,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n width: 100%;\n height: 100%;\n // min-height: 100%;\n // min-height: -moz-available;\n // min-height: -webkit-fill-available;\n // min-height: fill-available;\n\n max-height: 100%;\n max-height: -moz-available;\n max-height: -webkit-fill-available;\n max-height: fill-available;\n\n margin: 0px;\n padding: 0px;\n "}}});
var Center=function(){Widget.apply(this,arguments)};$jscomp.inherits(Center,Widget);Center.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(Center,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n "}}});var Column=function(){Flex.apply(this,arguments)};$jscomp.inherits(Column,Flex);Column.cacheStyles=Flex.cacheStyles;
$jscomp.global.Object.defineProperties(Column,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n flex-direction: column !important;\n "}}});var Row=function(){Flex.apply(this,arguments)};$jscomp.inherits(Row,Flex);Row.cacheStyles=Flex.cacheStyles;$jscomp.global.Object.defineProperties(Row,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n flex-direction: row !important;\n "}}});var Slide=function(){Inflate.apply(this,arguments)};
$jscomp.inherits(Slide,Inflate);Slide.cacheStyles=Inflate.cacheStyles;var Card=function(){Flex.apply(this,arguments)};$jscomp.inherits(Card,Flex);Card.cacheStyles=Flex.cacheStyles;$jscomp.global.Object.defineProperties(Card,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n background: rgba(255, 255, 255, 0.1);\n border: 4px solid white;\n margin: 10px;\n "}}});var CenteredCard=function(){Card.apply(this,arguments)};
$jscomp.inherits(CenteredCard,Card);CenteredCard.cacheStyles=Card.cacheStyles;$jscomp.global.Object.defineProperties(CenteredCard,{extend:{configurable:!0,enumerable:!0,get:function(){return[Center,FullWidth]}}});var Relative=function(){Widget.apply(this,arguments)};$jscomp.inherits(Relative,Widget);Relative.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(Relative,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n position: relative;\n "}}});
var Absolute=function(){Widget.apply(this,arguments)};$jscomp.inherits(Absolute,Widget);Absolute.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(Absolute,{styles:{configurable:!0,enumerable:!0,get:function(){return"position: absolute;"}}});var Fixed=function(){Widget.apply(this,arguments)};$jscomp.inherits(Fixed,Widget);Fixed.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(Fixed,{styles:{configurable:!0,enumerable:!0,get:function(){return"position: fixed;"}}});
var FullWidth=function(){Widget.apply(this,arguments)};$jscomp.inherits(FullWidth,Widget);FullWidth.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(FullWidth,{styles:{configurable:!0,enumerable:!0,get:function(){return"width: 100%;"}}});var FullHeight=function(){Widget.apply(this,arguments)};$jscomp.inherits(FullHeight,Widget);FullHeight.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(FullHeight,{styles:{configurable:!0,enumerable:!0,get:function(){return"height: 100%;"}}});
var Scaffold=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];Widget.apply(this,[].concat($jscomp.arrayFromIterable(b)))};$jscomp.inherits(Scaffold,Widget);Scaffold.cacheStyles=Widget.cacheStyles;Scaffold.prototype.render=function(){this.element||this.build();document.body=this.element;return this};$jscomp.global.Object.defineProperties(Scaffold,{tag:{configurable:!0,enumerable:!0,get:function(){return"body"}}});
var NO_THROTTLE=["scroll"],StateGenerator,AnimationHandler,Animator=function(a,b,c){this.target=a;this.state={};this.lock=!1;this.throttle=!0;this.generator=b;this.handler=c};Animator.prototype.update=function(){var a=this;this.throttle?requestAnimationFrame(function(){a.handler.apply(a.target,[a.state]);a.lock=!1}):(this.handler.apply(this.target,[this.state]),this.lock=!1)};Animator.prototype.requestUpdate=function(){this.generator.apply(this.target,[this.state]);this.lock||(this.lock=!0,this.update.call(this))};
Animator.prototype.watch=function(a,b,c,d){for(var e=[],g=3;g<arguments.length;++g)e[g-3]=arguments[g];if(void 0!==c&&!c||NO_THROTTLE.includes(b))this.throttle=!1;a.addEventListener.apply(a,[b,this.requestUpdate.bind(this)].concat($jscomp.arrayFromIterable(e)))};var DarkText=function(){Widget.apply(this,arguments)};$jscomp.inherits(DarkText,Widget);DarkText.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(DarkText,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n color: black;\n "}}});
var BoldText=function(){Widget.apply(this,arguments)};$jscomp.inherits(BoldText,Widget);BoldText.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(BoldText,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n font-weight: bold;\n "}}});var Img=function(a){Widget.call(this);this.setAttributes({src:a})};$jscomp.inherits(Img,Widget);Img.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(Img,{tag:{configurable:!0,enumerable:!0,get:function(){return"img"}}});
var FlexImg=function(a){Inflate.call(this);this.setStyles("\n background-image: url("+a+");\n ")};$jscomp.inherits(FlexImg,Inflate);FlexImg.cacheStyles=Inflate.cacheStyles;var Horizontal=function(){Row.apply(this,arguments)};$jscomp.inherits(Horizontal,Row);Horizontal.cacheStyles=Row.cacheStyles;$jscomp.global.Object.defineProperties(Horizontal,{extend:{configurable:!0,enumerable:!0,get:function(){return[FullWidth]}},styles:{configurable:!0,enumerable:!0,get:function(){return"justify-content: space-around;"}}});
var Vertical=function(){Column.apply(this,arguments)};$jscomp.inherits(Vertical,Column);Vertical.cacheStyles=Column.cacheStyles;$jscomp.global.Object.defineProperties(Vertical,{extend:{configurable:!0,enumerable:!0,get:function(){return[FullHeight]}},styles:{configurable:!0,enumerable:!0,get:function(){return"justify-content: space-around;"}}});var BottomBar=function(){Widget.apply(this,arguments)};$jscomp.inherits(BottomBar,Widget);BottomBar.cacheStyles=Widget.cacheStyles;
$jscomp.global.Object.defineProperties(BottomBar,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n height: 80px;\n // background: blue;\n "}}});var GreyText=function(){DarkText.apply(this,arguments)};$jscomp.inherits(GreyText,DarkText);GreyText.cacheStyles=DarkText.cacheStyles;$jscomp.global.Object.defineProperties(GreyText,{styles:{configurable:!0,enumerable:!0,get:function(){return"opacity: 0.5;"}}});var MaterialIcon=function(a){Widget.call(this,a);this.setClasses("material-icons")};
$jscomp.inherits(MaterialIcon,Widget);MaterialIcon.cacheStyles=Widget.cacheStyles;$jscomp.global.Object.defineProperties(MaterialIcon,{styles:{configurable:!0,enumerable:!0,get:function(){return"\n font-size: 36px;\n user-select: none; /* Standard */\n "}},tag:{configurable:!0,enumerable:!0,get:function(){return"i"}}});
if(WIDGETS_DEBUG){var time=function(a,b){for(var c=performance.now(),d=$jscomp.makeIterator(range(b)),e=d.next();!e.done;e=d.next())a();return(performance.now()-c)/b},range=function c(b){var d;return $jscomp.generator.createGenerator(c,function(c){1==c.nextAddress&&(d=0);return d++<b?c.yield(d,2):c.jumpTo(0)})};Array.prototype.sum=function(){return this.reduce(function(b,c){return Number(b)+Number(c)})};Array.prototype.avg=function(){return this.sum()/this.length}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment